aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/ncurses
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ncurses/ncurses')
-rw-r--r--contrib/ncurses/ncurses/Makefile.in54
-rw-r--r--contrib/ncurses/ncurses/README23
-rw-r--r--contrib/ncurses/ncurses/base/MKkeyname.awk21
-rwxr-xr-xcontrib/ncurses/ncurses/base/MKlib_gen.sh75
-rw-r--r--contrib/ncurses/ncurses/base/MKunctrl.awk26
-rw-r--r--contrib/ncurses/ncurses/base/define_key.c39
-rw-r--r--contrib/ncurses/ncurses/base/key_defined.c20
-rw-r--r--contrib/ncurses/ncurses/base/keybound.c23
-rw-r--r--contrib/ncurses/ncurses/base/keyok.c39
-rw-r--r--contrib/ncurses/ncurses/base/legacy_coding.c25
-rw-r--r--contrib/ncurses/ncurses/base/lib_addch.c80
-rw-r--r--contrib/ncurses/ncurses/base/lib_addstr.c19
-rw-r--r--contrib/ncurses/ncurses/base/lib_beep.c27
-rw-r--r--contrib/ncurses/ncurses/base/lib_bkgd.c16
-rw-r--r--contrib/ncurses/ncurses/base/lib_box.c9
-rw-r--r--contrib/ncurses/ncurses/base/lib_chgat.c8
-rw-r--r--contrib/ncurses/ncurses/base/lib_clear.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_clearok.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_clrbot.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_clreol.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_color.c544
-rw-r--r--contrib/ncurses/ncurses/base/lib_colorset.c19
-rw-r--r--contrib/ncurses/ncurses/base/lib_delch.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_delwin.c21
-rw-r--r--contrib/ncurses/ncurses/base/lib_dft_fgbg.c70
-rw-r--r--contrib/ncurses/ncurses/base/lib_driver.c143
-rw-r--r--contrib/ncurses/ncurses/base/lib_echo.c36
-rw-r--r--contrib/ncurses/ncurses/base/lib_endwin.c39
-rw-r--r--contrib/ncurses/ncurses/base/lib_erase.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_flash.c30
-rw-r--r--contrib/ncurses/ncurses/base/lib_freeall.c62
-rw-r--r--contrib/ncurses/ncurses/base/lib_getch.c181
-rw-r--r--contrib/ncurses/ncurses/base/lib_getstr.c25
-rw-r--r--contrib/ncurses/ncurses/base/lib_hline.c10
-rw-r--r--contrib/ncurses/ncurses/base/lib_immedok.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_inchstr.c11
-rw-r--r--contrib/ncurses/ncurses/base/lib_initscr.c8
-rw-r--r--contrib/ncurses/ncurses/base/lib_insch.c48
-rw-r--r--contrib/ncurses/ncurses/base/lib_insdel.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_insnstr.c10
-rw-r--r--contrib/ncurses/ncurses/base/lib_instr.c30
-rw-r--r--contrib/ncurses/ncurses/base/lib_isendwin.c20
-rw-r--r--contrib/ncurses/ncurses/base/lib_leaveok.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_mouse.c277
-rw-r--r--contrib/ncurses/ncurses/base/lib_move.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_mvwin.c20
-rw-r--r--contrib/ncurses/ncurses/base/lib_newterm.c234
-rw-r--r--contrib/ncurses/ncurses/base/lib_newwin.c154
-rw-r--r--contrib/ncurses/ncurses/base/lib_nl.c46
-rw-r--r--contrib/ncurses/ncurses/base/lib_overlay.c16
-rw-r--r--contrib/ncurses/ncurses/base/lib_pad.c82
-rw-r--r--contrib/ncurses/ncurses/base/lib_printw.c16
-rw-r--r--contrib/ncurses/ncurses/base/lib_redrawln.c27
-rw-r--r--contrib/ncurses/ncurses/base/lib_refresh.c69
-rw-r--r--contrib/ncurses/ncurses/base/lib_restart.c78
-rw-r--r--contrib/ncurses/ncurses/base/lib_scanw.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_screen.c126
-rw-r--r--contrib/ncurses/ncurses/base/lib_scroll.c10
-rw-r--r--contrib/ncurses/ncurses/base/lib_scrollok.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_scrreg.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_set_term.c472
-rw-r--r--contrib/ncurses/ncurses/base/lib_slk.c242
-rw-r--r--contrib/ncurses/ncurses/base/lib_slkatr_set.c48
-rw-r--r--contrib/ncurses/ncurses/base/lib_slkatrof.c26
-rw-r--r--contrib/ncurses/ncurses/base/lib_slkatron.c26
-rw-r--r--contrib/ncurses/ncurses/base/lib_slkatrset.c20
-rw-r--r--contrib/ncurses/ncurses/base/lib_slkattr.c24
-rw-r--r--contrib/ncurses/ncurses/base/lib_slkclear.c30
-rw-r--r--contrib/ncurses/ncurses/base/lib_slkcolor.c40
-rw-r--r--contrib/ncurses/ncurses/base/lib_slkinit.c39
-rw-r--r--contrib/ncurses/ncurses/base/lib_slklab.c22
-rw-r--r--contrib/ncurses/ncurses/base/lib_slkrefr.c91
-rw-r--r--contrib/ncurses/ncurses/base/lib_slkset.c28
-rw-r--r--contrib/ncurses/ncurses/base/lib_slktouch.c24
-rw-r--r--contrib/ncurses/ncurses/base/lib_touch.c14
-rw-r--r--contrib/ncurses/ncurses/base/lib_ungetch.c14
-rw-r--r--contrib/ncurses/ncurses/base/lib_vline.c10
-rw-r--r--contrib/ncurses/ncurses/base/lib_wattroff.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_wattron.c8
-rw-r--r--contrib/ncurses/ncurses/base/lib_winch.c12
-rw-r--r--contrib/ncurses/ncurses/base/lib_window.c66
-rw-r--r--contrib/ncurses/ncurses/base/nc_panel.c18
-rw-r--r--contrib/ncurses/ncurses/base/resizeterm.c198
-rw-r--r--contrib/ncurses/ncurses/base/safe_sprintf.c37
-rw-r--r--contrib/ncurses/ncurses/base/tries.c12
-rw-r--r--contrib/ncurses/ncurses/base/use_window.c6
-rw-r--r--contrib/ncurses/ncurses/base/wresize.c33
-rw-r--r--contrib/ncurses/ncurses/build.priv.h108
-rw-r--r--contrib/ncurses/ncurses/curses.priv.h878
-rw-r--r--contrib/ncurses/ncurses/llib-lncurses1026
-rw-r--r--contrib/ncurses/ncurses/llib-lncursest1055
-rw-r--r--contrib/ncurses/ncurses/llib-lncursestw5270
-rw-r--r--contrib/ncurses/ncurses/llib-lncursesw1071
-rw-r--r--contrib/ncurses/ncurses/modules370
-rw-r--r--contrib/ncurses/ncurses/tinfo/MKcaptab.sh136
-rw-r--r--contrib/ncurses/ncurses/tinfo/MKcodes.awk23
-rwxr-xr-xcontrib/ncurses/ncurses/tinfo/MKfallback.sh18
-rw-r--r--contrib/ncurses/ncurses/tinfo/MKnames.awk26
-rw-r--r--contrib/ncurses/ncurses/tinfo/access.c7
-rw-r--r--contrib/ncurses/ncurses/tinfo/add_tries.c11
-rw-r--r--contrib/ncurses/ncurses/tinfo/alloc_entry.c19
-rw-r--r--contrib/ncurses/ncurses/tinfo/alloc_ttype.c90
-rw-r--r--contrib/ncurses/ncurses/tinfo/captoinfo.c49
-rw-r--r--contrib/ncurses/ncurses/tinfo/comp_expand.c6
-rw-r--r--contrib/ncurses/ncurses/tinfo/comp_hash.c334
-rw-r--r--contrib/ncurses/ncurses/tinfo/comp_parse.c18
-rw-r--r--contrib/ncurses/ncurses/tinfo/comp_scan.c94
-rw-r--r--contrib/ncurses/ncurses/tinfo/db_iterator.c11
-rw-r--r--contrib/ncurses/ncurses/tinfo/entries.c18
-rw-r--r--contrib/ncurses/ncurses/tinfo/free_ttype.c6
-rw-r--r--contrib/ncurses/ncurses/tinfo/hashed_db.c58
-rw-r--r--contrib/ncurses/ncurses/tinfo/home_terminfo.c6
-rw-r--r--contrib/ncurses/ncurses/tinfo/init_keytry.c20
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_acs.c82
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_baudrate.c32
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_cur_term.c112
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_data.c50
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_has_cap.c53
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_kernel.c82
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_longname.c42
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_napms.c21
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_options.c277
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_print.c39
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_raw.c202
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_setup.c401
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_termcap.c227
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_termname.c22
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_ti.c162
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_tparm.c49
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_tputs.c168
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_ttyflags.c207
-rw-r--r--contrib/ncurses/ncurses/tinfo/make_hash.c294
-rw-r--r--contrib/ncurses/ncurses/tinfo/make_keys.c24
-rw-r--r--contrib/ncurses/ncurses/tinfo/name_match.c3
-rw-r--r--contrib/ncurses/ncurses/tinfo/parse_entry.c55
-rw-r--r--contrib/ncurses/ncurses/tinfo/read_entry.c71
-rw-r--r--contrib/ncurses/ncurses/tinfo/read_termcap.c20
-rw-r--r--contrib/ncurses/ncurses/tinfo/setbuf.c35
-rw-r--r--contrib/ncurses/ncurses/tinfo/tinfo_driver.c1337
-rw-r--r--contrib/ncurses/ncurses/tinfo/trim_sgr0.c38
-rw-r--r--contrib/ncurses/ncurses/tinfo/use_screen.c8
-rw-r--r--contrib/ncurses/ncurses/tinfo/write_entry.c82
-rw-r--r--contrib/ncurses/ncurses/trace/lib_trace.c37
-rw-r--r--contrib/ncurses/ncurses/trace/lib_traceatr.c55
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracebits.c7
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracechr.c10
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracedmp.c12
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracemse.c42
-rw-r--r--contrib/ncurses/ncurses/trace/trace_buf.c11
-rw-r--r--contrib/ncurses/ncurses/trace/trace_tries.c14
-rw-r--r--contrib/ncurses/ncurses/trace/trace_xnames.c7
-rw-r--r--contrib/ncurses/ncurses/trace/varargs.c4
-rw-r--r--contrib/ncurses/ncurses/trace/visbuf.c57
-rwxr-xr-xcontrib/ncurses/ncurses/tty/MKexpanded.sh61
-rw-r--r--contrib/ncurses/ncurses/tty/hardscroll.c113
-rw-r--r--contrib/ncurses/ncurses/tty/hashmap.c259
-rw-r--r--contrib/ncurses/ncurses/tty/lib_mvcur.c504
-rw-r--r--contrib/ncurses/ncurses/tty/lib_tstp.c45
-rw-r--r--contrib/ncurses/ncurses/tty/lib_twait.c82
-rw-r--r--contrib/ncurses/ncurses/tty/lib_vidattr.c133
-rw-r--r--contrib/ncurses/ncurses/tty/tty_update.c1228
-rw-r--r--contrib/ncurses/ncurses/wcwidth.h309
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_add_wch.c438
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_box_set.c6
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_cchar.c34
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_erasewchar.c8
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_get_wch.c33
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_get_wstr.c7
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_hline_set.c12
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_in_wch.c6
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c6
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_ins_wch.c62
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_inwstr.c8
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_pecho_wchar.c8
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_unget_wch.c28
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_vid_attr.c124
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_vline_set.c12
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_wacs.c31
-rw-r--r--contrib/ncurses/ncurses/widechar/lib_wunctrl.c26
-rw-r--r--contrib/ncurses/ncurses/win32con/gettimeofday.c51
-rw-r--r--contrib/ncurses/ncurses/win32con/wcwidth.c50
-rw-r--r--contrib/ncurses/ncurses/win32con/win_driver.c1241
182 files changed, 20183 insertions, 4531 deletions
diff --git a/contrib/ncurses/ncurses/Makefile.in b/contrib/ncurses/ncurses/Makefile.in
index 558f79f0bbf3..45a26b9d7eaa 100644
--- a/contrib/ncurses/ncurses/Makefile.in
+++ b/contrib/ncurses/ncurses/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.113 2008/10/18 14:11:54 tom Exp $
+# $Id: Makefile.in,v 1.130 2010/11/27 21:45:27 tom Exp $
##############################################################################
-# Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), #
@@ -46,6 +46,7 @@
.SUFFIXES:
SHELL = /bin/sh
+VPATH = @srcdir@
THIS = Makefile
CF_MFLAGS = @cf_cv_makeflags@
@@ -71,6 +72,7 @@ LIBTOOL_COMPILE = @LIB_COMPILE@
LIBTOOL_LINK = @LIB_LINK@
LIBTOOL_INSTALL = @LIB_INSTALL@
LIBTOOL_UNINSTALL = @LIB_UNINSTALL@
+LT_UNDEF = @LT_UNDEF@
INSTALL = @INSTALL@
INSTALL_LIB = @INSTALL@ @INSTALL_LIB@
@@ -78,11 +80,14 @@ INSTALL_PROG = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
AR = @AR@
-AR_OPTS = @AR_OPTS@
+ARFLAGS = @ARFLAGS@
AWK = @AWK@
LD = @LD@
LN_S = @LN_S@
+CTAGS = @CTAGS@
+ETAGS = @ETAGS@
+
CC = @CC@
CPP = @CPP@
CFLAGS = @CFLAGS@
@@ -92,7 +97,7 @@ CPPFLAGS = -DHAVE_CONFIG_H -I../ncurses -I$(srcdir) @CPPFLAGS@
CCFLAGS = $(CPPFLAGS) $(CFLAGS)
-BUILD_CPPFLAGS = -I../include @BUILD_CPPFLAGS@
+BUILD_CPPFLAGS = -I../include -DUSE_BUILD_CC @BUILD_CPPFLAGS@
BUILD_CC = @BUILD_CC@
BUILD_CCFLAGS = -DHAVE_CONFIG_H -I../ncurses -I$(srcdir) -I$(INCDIR) $(BUILD_CPPFLAGS) @BUILD_CFLAGS@
BUILD_LDFLAGS = @BUILD_LDFLAGS@
@@ -140,6 +145,10 @@ FALLBACK_LIST = @FALLBACK_LIST@
USE_BIG_STRINGS = @USE_BIG_STRINGS@
TERMINFO_CAPS = $(top_srcdir)/include/@TERMINFO_CAPS@
+TERMINFO = @TERMINFO@
+TERMINFO_SRC = @TERMINFO_SRC@
+TIC_PATH = @TIC_PATH@
+
AUTO_SRC = \
./codes.c \
./comp_captab.c \
@@ -153,6 +162,18 @@ AUTO_SRC = \
init_keytry.h \
keys.list
+HEADER_DEPS = \
+ $(srcdir)/curses.priv.h \
+ ../include/ncurses_dll.h \
+ ../include/ncurses_cfg.h \
+ ../include/curses.h \
+ $(INCDIR)/nc_panel.h \
+ ../include/term.h \
+ $(INCDIR)/term_entry.h \
+ $(INCDIR)/nc_tparm.h \
+ $(INCDIR)/nc_alloc.h \
+ $(INCDIR)/nc_mingw.h
+
TEST_DEPS = ../lib/@LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@
TEST_ARGS = @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@
TEST_LDFLAGS = @LD_MODEL@ $(TEST_ARGS) @LIBS@ @LOCAL_LDFLAGS@ @LDFLAGS@
@@ -164,11 +185,12 @@ TEST_PROGS = \
hashmap$x \
lib_mvcur$x
-base = $(srcdir)/base
-serial = $(srcdir)/tty
-tinfo = $(srcdir)/tinfo
-trace = $(srcdir)/trace
-wide = $(srcdir)/widechar
+base = $(srcdir)/base
+serial = $(srcdir)/tty
+tinfo = $(srcdir)/tinfo
+trace = $(srcdir)/trace
+wide = $(srcdir)/widechar
+win32con = $(srcdir)/win32con
################################################################################
all \
@@ -178,12 +200,12 @@ sources: $(AUTO_SRC)
$(DESTDIR)$(bindir) \
$(DESTDIR)$(libdir) :
- sh $(srcdir)/../mkdirs.sh $@
+ mkdir -p $@
../lib : ; mkdir $@
./fallback.c : $(tinfo)/MKfallback.sh
- sh -e $(tinfo)/MKfallback.sh @TERMINFO@ @TERMINFO_SRC@ $(FALLBACK_LIST) >$@
+ sh -e $(tinfo)/MKfallback.sh $(TERMINFO) $(TERMINFO_SRC) $(TIC_PATH) $(FALLBACK_LIST) >$@
./lib_gen.c : $(base)/MKlib_gen.sh ../include/curses.h
sh -e $(base)/MKlib_gen.sh "$(CPP) $(CPPFLAGS)" "$(AWK)" generated <../include/curses.h >$@
@@ -200,11 +222,11 @@ make_keys$(BUILD_EXEEXT) : \
$(BUILD_CC) -o $@ $(BUILD_CCFLAGS) $(tinfo)/make_keys.c $(BUILD_LDFLAGS) $(BUILD_LIBS)
make_hash$(BUILD_EXEEXT) : \
- $(tinfo)/comp_hash.c \
+ $(tinfo)/make_hash.c \
../include/hashsize.h
- $(BUILD_CC) -o $@ $(BUILD_CCFLAGS) -DMAIN_PROGRAM $(tinfo)/comp_hash.c $(BUILD_LDFLAGS) $(BUILD_LIBS)
+ $(BUILD_CC) -o $@ $(BUILD_CCFLAGS) $(tinfo)/make_hash.c $(BUILD_LDFLAGS) $(BUILD_LIBS)
-./expanded.c : $(serial)/MKexpanded.sh
+./expanded.c : $(srcdir)/curses.priv.h $(serial)/MKexpanded.sh
sh -e $(serial)/MKexpanded.sh "$(CPP)" $(CPPFLAGS) > $@
./comp_captab.c: \
@@ -227,10 +249,10 @@ make_hash$(BUILD_EXEEXT) : \
echo | $(AWK) -f $(base)/MKunctrl.awk bigstrings=$(USE_BIG_STRINGS) >$@
tags:
- ctags *.[ch] */*.[ch]
+ $(CTAGS) *.[ch] */*.[ch]
@MAKE_UPPER_TAGS@TAGS:
-@MAKE_UPPER_TAGS@ etags *.[ch] */*.[ch]
+@MAKE_UPPER_TAGS@ $(ETAGS) *.[ch] */*.[ch]
mostlyclean ::
-rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace
diff --git a/contrib/ncurses/ncurses/README b/contrib/ncurses/ncurses/README
index 120aa5b82c1d..cbde3354a6a3 100644
--- a/contrib/ncurses/ncurses/README
+++ b/contrib/ncurses/ncurses/README
@@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
--- Copyright (c) 1998-2000,2006 Free Software Foundation, Inc. --
+-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
@@ -25,7 +25,26 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: README,v 1.9 2006/04/22 22:19:37 tom Exp $
+-- $Id: README,v 1.10 2009/06/27 14:44:30 tom Exp $
-------------------------------------------------------------------------------
For discussion of the package internals, see hackguide.html in the doc/html
directory.
+
+-------------------------------------------------------------------------------
+The llib-lXXXX files could be used as lint-library sources (and were, at one
+time). However, they are actually used as a documentation aid to keep track
+of changes to the public/private interfaces in ncurses. Most of the text in
+these files is generated using cproto; some manual cleanup and adjustment of
+types (to reflect #define's in curses.h) is needed. The functions listed in
+the llib-lXXXX files do not correspond to the default configure options; some
+additional ones are added to include "all" of the entrypoints for each of the
+major configurations (normal, wide-character, threaded):
+
+ --disable-macros
+ --disable-root-environ
+ --enable-expanded
+ --enable-getcap
+ --enable-getcap-cache
+ --enable-sp-funcs
+ --enable-termcap
+ --with-develop
diff --git a/contrib/ncurses/ncurses/base/MKkeyname.awk b/contrib/ncurses/ncurses/base/MKkeyname.awk
index b35ba2a98027..bb2599acb558 100644
--- a/contrib/ncurses/ncurses/base/MKkeyname.awk
+++ b/contrib/ncurses/ncurses/base/MKkeyname.awk
@@ -1,6 +1,6 @@
-# $Id: MKkeyname.awk,v 1.40 2008/07/12 18:40:00 tom Exp $
+# $Id: MKkeyname.awk,v 1.45 2010/12/19 01:36:14 tom Exp $
##############################################################################
-# Copyright (c) 1999-2007,2008 Free Software Foundation, Inc. #
+# Copyright (c) 1999-2009,2010 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), #
@@ -31,7 +31,6 @@ BEGIN {
print ""
print "#include <curses.priv.h>"
print "#include <tic.h>"
- print "#include <term_entry.h>"
print ""
first = 1;
}
@@ -67,7 +66,8 @@ END {
print "#define SIZEOF_TABLE 256"
print "#define MyTable _nc_globals.keyname_table"
print ""
- print "NCURSES_EXPORT(NCURSES_CONST char *) _nc_keyname (SCREEN *sp, int c)"
+ print "NCURSES_EXPORT(NCURSES_CONST char *)"
+ print "safe_keyname (SCREEN *sp, int c)"
print "{"
print " int i;"
print " char name[20];"
@@ -116,14 +116,14 @@ END {
print " result = MyTable[c];"
print " }"
print "#if NCURSES_EXT_FUNCS && NCURSES_XNAMES"
- print " } else if (result == 0 && cur_term != 0) {"
+ print " } else if (result == 0 && HasTerminal(sp)) {"
print " int j, k;"
print " char * bound;"
- print " TERMTYPE *tp = &(cur_term->type);"
- print " int save_trace = _nc_tracing;"
+ print " TERMTYPE *tp = &(TerminalOf(sp)->type);"
+ print " unsigned save_trace = _nc_tracing;"
print ""
print " _nc_tracing = 0; /* prevent recursion via keybound() */"
- print " for (j = 0; (bound = keybound(c, j)) != 0; ++j) {"
+ print " for (j = 0; (bound = NCURSES_SP_NAME(keybound)(NCURSES_SP_ARGx c, j)) != 0; ++j) {"
print " for(k = STRCOUNT; k < (int) NUM_STRINGS(tp); k++) {"
print " if (tp->Strings[k] != 0 && !strcmp(bound, tp->Strings[k])) {"
print " result = ExtStrname(tp, k, strnames);"
@@ -141,9 +141,10 @@ END {
print " return result;"
print "}"
print ""
- print "NCURSES_EXPORT(NCURSES_CONST char *) keyname (int c)"
+ print "NCURSES_EXPORT(NCURSES_CONST char *)"
+ print "keyname (int c)"
print "{"
- print "\treturn _nc_keyname(SP, c);"
+ print " return safe_keyname (CURRENT_SCREEN, c);"
print "}"
print ""
print "#if NO_LEAKS"
diff --git a/contrib/ncurses/ncurses/base/MKlib_gen.sh b/contrib/ncurses/ncurses/base/MKlib_gen.sh
index a984e8545eff..66ae295c607c 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.34 2008/08/30 19:20:50 tom Exp $)
+# ($Id: MKlib_gen.sh,v 1.43 2011/01/22 19:47:29 tom Exp $)
#
##############################################################################
-# Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2010,2011 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"), #
@@ -51,7 +51,7 @@
# them.
# 5. cpp: macro-expand the file so the macro calls turn into C calls
# 6. awk: strip the expansion junk off the front and add the new header
-# 7. sed: squeeze spaces, strip off gen_ prefix, create needed #undef
+# 7. sed: squeeze spaces, strip off gen_ prefix.
#
# keep the editing independent of locale:
@@ -82,6 +82,8 @@ if test "$USE" = implemented ; then
cat >$ED1 <<EOF1
/^extern.*implemented/{
h
+ s/NCURSES_SP_NAME(\([^)]*\))/NCURSES_SP_NAME___\1/
+ h
s/^.*implemented:\([^ *]*\).*/P_POUNDCif_USE_\1_SUPPORT/p
g
s/^extern \([^;]*\);.*/\1/p
@@ -151,14 +153,13 @@ cat >$ED3 <<EOF3
s/( /(/g
s/ )/)/g
s/ gen_/ /
- s/^M_/#undef /
s/^[ ]*@[ ]*@[ ]*/ /
:done
EOF3
if test "$USE" = generated ; then
cat >$ED4 <<EOF
- s/^\(.*\) \(.*\) (\(.*\))\$/NCURSES_EXPORT(\1) \2 (\3)/
+ s/^\(.*\) \(.*\) (\(.*\))\$/NCURSES_EXPORT(\1) (\2) (\3)/
EOF
else
cat >$ED4 <<EOF
@@ -169,6 +170,7 @@ cat >$ED4 <<EOF
g
s/^\(.*\) \(.*\) (\(.*\))\$/\1 call_\2 (\3)/
}
+s/\([^_]\)NCURSES_SP_NAME___\([a-zA-Z][a-zA-Z_]*\)/\1NCURSES_SP_NAME(\2)/g
EOF
fi
@@ -198,14 +200,16 @@ $0 !~ /^P_/ {
}
}
second = first + 1;
+ returnCast = "";
if ( $first == "chtype" ) {
- returnType = "Char";
+ returnType = "Chtype";
} else if ( $first == "SCREEN" ) {
returnType = "SP";
} else if ( $first == "WINDOW" ) {
returnType = "Win";
} else if ( $first == "attr_t" || $second == "attrset" || $second == "standout" || $second == "standend" || $second == "wattrset" || $second == "wstandout" || $second == "wstandend" ) {
- returnType = "Attr";
+ returnType = "IntAttr";
+ returnCast = "(attr_t)";
} else if ( $first == "bool" || $first == "NCURSES_BOOL" ) {
returnType = "Bool";
} else if ( $second == "*" ) {
@@ -220,9 +224,6 @@ $0 !~ /^P_/ {
break;
}
}
- if (using == "generated") {
- print "M_" $myfunc
- }
print $0;
print "{";
argcount = 1;
@@ -247,6 +248,9 @@ $0 !~ /^P_/ {
if ($myfunc ~ /ripoffline/) {
dotrace = 0;
argcount = 2;
+ if ($myfunc ~ /NCURSES_SP_NAME/) {
+ argcount = 3;
+ }
}
if ($myfunc ~ /wunctrl/) {
dotrace = 0;
@@ -262,24 +266,26 @@ $0 !~ /^P_/ {
argtype = ""
for (i = myfunc; i <= NF; i++) {
ch = $i;
- if ( ch == "*" )
+ if ( ch == "*" ) {
pointer = 1;
- else if ( ch == "va_list" )
+ } else if ( ch == "va_list" ) {
va_list = 1;
- else if ( ch == "..." )
+ } else if ( ch == "..." ) {
varargs = 1;
- else if ( ch == "char" )
+ } else if ( ch == "char" ) {
argtype = "char";
- else if ( ch == "int" )
+ } else if ( ch == "int" ) {
argtype = "int";
- else if ( ch == "short" )
+ } else if ( ch == "short" ) {
argtype = "short";
- else if ( ch == "chtype" )
+ } else if ( ch == "chtype" ) {
argtype = "chtype";
- else if ( ch == "attr_t" || ch == "NCURSES_ATTR_T" )
+ } else if ( ch == "attr_t" || ch == "NCURSES_ATTR_T" ) {
argtype = "attr";
+ }
if ( ch == "," || ch == ")" ) {
+ argcast = "";
if (va_list) {
call = call "%s"
} else if (varargs) {
@@ -289,8 +295,10 @@ $0 !~ /^P_/ {
call = call "%s"
comma = comma "_nc_visbuf2(" num ","
pointer = 0;
- } else
+ } else {
call = call "%p"
+ comma = comma "(const void *)"
+ }
} else if (argcount != 0) {
if ( argtype == "int" || argtype == "short" ) {
call = call "%d"
@@ -298,6 +306,9 @@ $0 !~ /^P_/ {
} else if ( argtype != "" ) {
call = call "%s"
comma = comma "_trace" argtype "2(" num ","
+ if (argtype == "attr") {
+ argcast = "(chtype)";
+ }
} else {
call = call "%#lx"
comma = comma "(long)"
@@ -311,7 +322,7 @@ $0 !~ /^P_/ {
} else if ( varargs ) {
args = args comma "\"...\""
} else {
- args = args comma "z"
+ args = args comma argcast "z"
}
}
call = call ch
@@ -322,7 +333,7 @@ $0 !~ /^P_/ {
pointer = 0;
argtype = ""
}
- if ( i == 2 || ch == "(" )
+ if ( i == myfunc || ch == "(" )
call = call ch
}
call = call "\")"
@@ -333,12 +344,16 @@ $0 !~ /^P_/ {
if (dotrace)
printf "%s", call
- if (match($0, "^void"))
+ if (match($0, "^void")) {
call = ""
- else if (dotrace)
+ } else if (dotrace) {
call = sprintf("return%s( ", returnType);
- else
+ if (returnCast != "") {
+ call = call returnCast;
+ }
+ } else {
call = "@@return ";
+ }
call = call $myfunc "(";
for (i = 1; i < argcount; i++) {
@@ -353,8 +368,9 @@ $0 !~ /^P_/ {
}
if (!match($0, "^void"))
call = call ") ";
- if (dotrace)
+ if (dotrace) {
call = call ")";
+ }
print call ";"
if (match($0, "^void"))
@@ -381,8 +397,17 @@ BEGIN {
}
print " */"
print "#define NCURSES_ATTR_T int"
+ print "#include <ncurses_cfg.h>"
+ print ""
+ print "#undef NCURSES_NOMACROS /* _this_ file uses macros */"
+ print ""
print "#include <curses.priv.h>"
print ""
+ print "#undef vw_scanw"
+ print "#undef vwscanw"
+ print ""
+ print "#undef vw_printw"
+ print "#undef vwprintw"
}
/^DECLARATIONS/ {start = 1; next;}
{if (start) print \$0;}
diff --git a/contrib/ncurses/ncurses/base/MKunctrl.awk b/contrib/ncurses/ncurses/base/MKunctrl.awk
index 36fbeecb2e76..2140900e8c3b 100644
--- a/contrib/ncurses/ncurses/base/MKunctrl.awk
+++ b/contrib/ncurses/ncurses/base/MKunctrl.awk
@@ -1,6 +1,6 @@
-# $Id: MKunctrl.awk,v 1.23 2008/10/04 21:40:24 tom Exp $
+# $Id: MKunctrl.awk,v 1.26 2009/07/04 22:05:15 Clemens.Ladisch Exp $
##############################################################################
-# Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2008,2009 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"), #
@@ -36,19 +36,12 @@ BEGIN {
print "#include <curses.priv.h>"
print "#include <ctype.h>"
print ""
- print "#if USE_WIDEC_SUPPORT"
- print "#if HAVE_WCTYPE_H"
- print "#include <wctype.h>"
- print "#endif"
- print "#endif"
- print ""
print "#undef unctrl"
print ""
}
END {
- print "NCURSES_EXPORT(NCURSES_CONST char *) _nc_unctrl (SCREEN *sp, chtype ch)"
+ print "NCURSES_EXPORT(NCURSES_CONST char *) safe_unctrl(SCREEN *sp, chtype ch)"
print "{"
-
blob=""
offset=0
if (bigstrings) {
@@ -158,16 +151,6 @@ END {
print "\t\t && (check < 160))"
printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
print "\t\telse"
- print "#if USE_WIDEC_SUPPORT"
- print "\t\tif ((check >= 160)"
- print "\t\t && (check < 256)"
- print "\t\t && ((sp != 0)"
- print "\t\t && ((sp->_legacy_coding > 0)"
- print "\t\t || (sp->_legacy_coding == 0"
- print "\t\t && (isprint(check) || iswprint(check))))))"
- printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
- print "\t\telse"
- print "#else"
print "\t\tif ((check >= 160)"
print "\t\t && (check < 256)"
print "\t\t && ((sp != 0)"
@@ -176,7 +159,6 @@ END {
print "\t\t && isprint(check)))))"
printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
print "\t\telse"
- print "#endif /* USE_WIDEC_SUPPORT */"
print "#endif /* NCURSES_EXT_FUNCS */"
printf "\t\t\tresult = %s_table[check];\n", stringname;
print "\t} else {"
@@ -187,6 +169,6 @@ END {
print ""
print "NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype ch)"
print "{"
- print "\treturn _nc_unctrl(SP, ch);"
+ print "\treturn safe_unctrl(CURRENT_SCREEN, ch);"
print "}"
}
diff --git a/contrib/ncurses/ncurses/base/define_key.c b/contrib/ncurses/ncurses/base/define_key.c
index 3d5815f906d6..a49b094279c8 100644
--- a/contrib/ncurses/ncurses/base/define_key.c
+++ b/contrib/ncurses/ncurses/base/define_key.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2009 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,33 +27,40 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 1997-on *
+ * Author: Thomas E. Dickey 1997-on *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
#include <curses.priv.h>
-MODULE_ID("$Id: define_key.c,v 1.13 2006/12/30 23:23:31 tom Exp $")
+MODULE_ID("$Id: define_key.c,v 1.20 2009/11/28 22:53:17 tom Exp $")
NCURSES_EXPORT(int)
-define_key(const char *str, int keycode)
+NCURSES_SP_NAME(define_key) (NCURSES_SP_DCLx const char *str, int keycode)
{
int code = ERR;
- T((T_CALLED("define_key(%s,%d)"), _nc_visbuf(str), keycode));
- if (SP == 0) {
+ T((T_CALLED("define_key(%p, %s,%d)"), (void *) SP_PARM, _nc_visbuf(str), keycode));
+ if (SP_PARM == 0 || !HasTInfoTerminal(SP_PARM)) {
code = ERR;
} else if (keycode > 0) {
unsigned ukey = (unsigned) keycode;
+#ifdef USE_TERM_DRIVER
+#define CallHasKey(keycode) CallDriver_1(SP_PARM, kyExist, keycode)
+#else
+#define CallHasKey(keycode) NCURSES_SP_NAME(has_key)(NCURSES_SP_ARGx keycode)
+#endif
+
if (str != 0) {
- define_key(str, 0);
- } else if (has_key(keycode)) {
- while (_nc_remove_key(&(SP->_keytry), ukey))
+ NCURSES_SP_NAME(define_key) (NCURSES_SP_ARGx str, 0);
+ } else if (CallHasKey(keycode)) {
+ while (_nc_remove_key(&(SP_PARM->_keytry), ukey))
code = OK;
}
if (str != 0) {
- if (key_defined(str) == 0) {
- if (_nc_add_to_try(&(SP->_keytry), str, ukey) == OK) {
+ if (NCURSES_SP_NAME(key_defined) (NCURSES_SP_ARGx str) == 0) {
+ if (_nc_add_to_try(&(SP_PARM->_keytry), str, ukey) == OK) {
code = OK;
} else {
code = ERR;
@@ -63,8 +70,16 @@ define_key(const char *str, int keycode)
}
}
} else {
- while (_nc_remove_string(&(SP->_keytry), str))
+ while (_nc_remove_string(&(SP_PARM->_keytry), str))
code = OK;
}
returnCode(code);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+define_key(const char *str, int keycode)
+{
+ return NCURSES_SP_NAME(define_key) (CURRENT_SCREEN, str, keycode);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/key_defined.c b/contrib/ncurses/ncurses/base/key_defined.c
index 759ad824318d..ef987a5484d5 100644
--- a/contrib/ncurses/ncurses/base/key_defined.c
+++ b/contrib/ncurses/ncurses/base/key_defined.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2003,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 2003-2006,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -32,7 +32,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: key_defined.c,v 1.6 2006/12/30 23:22:55 tom Exp $")
+MODULE_ID("$Id: key_defined.c,v 1.9 2009/10/24 22:15:47 tom Exp $")
static int
find_definition(TRIES * tree, const char *str)
@@ -65,14 +65,22 @@ find_definition(TRIES * tree, const char *str)
* Otherwise, return the keycode's value (neither OK/ERR).
*/
NCURSES_EXPORT(int)
-key_defined(const char *str)
+NCURSES_SP_NAME(key_defined) (NCURSES_SP_DCLx const char *str)
{
int code = ERR;
- T((T_CALLED("key_defined(%s)"), _nc_visbuf(str)));
- if (SP != 0 && str != 0) {
- code = find_definition(SP->_keytry, str);
+ T((T_CALLED("key_defined(%p, %s)"), (void *) SP_PARM, _nc_visbuf(str)));
+ if (SP_PARM != 0 && str != 0) {
+ code = find_definition(SP_PARM->_keytry, str);
}
returnCode(code);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+key_defined(const char *str)
+{
+ return NCURSES_SP_NAME(key_defined) (CURRENT_SCREEN, str);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/keybound.c b/contrib/ncurses/ncurses/base/keybound.c
index 2995714ba936..65e6bfc63620 100644
--- a/contrib/ncurses/ncurses/base/keybound.c
+++ b/contrib/ncurses/ncurses/base/keybound.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2006,2009 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,25 +27,34 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 1999-on *
+ * Author: Thomas E. Dickey 1999-on *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
#include <curses.priv.h>
-MODULE_ID("$Id: keybound.c,v 1.7 2006/06/17 18:19:24 tom Exp $")
+MODULE_ID("$Id: keybound.c,v 1.10 2009/10/24 22:15:47 tom Exp $")
/*
* Returns the count'th string definition which is associated with the
* given keycode. The result is malloc'd, must be freed by the caller.
*/
NCURSES_EXPORT(char *)
-keybound(int code, int count)
+NCURSES_SP_NAME(keybound) (NCURSES_SP_DCLx int code, int count)
{
char *result = 0;
- T((T_CALLED("keybound(%d,%d)"), code, count));
- if (SP != 0 && code >= 0) {
- result = _nc_expand_try(SP->_keytry, (unsigned) code, &count, 0);
+ T((T_CALLED("keybound(%p, %d,%d)"), (void *) SP_PARM, code, count));
+ if (SP_PARM != 0 && code >= 0) {
+ result = _nc_expand_try(SP_PARM->_keytry, (unsigned) code, &count, 0);
}
returnPtr(result);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(char *)
+keybound(int code, int count)
+{
+ return NCURSES_SP_NAME(keybound) (CURRENT_SCREEN, code, count);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/keyok.c b/contrib/ncurses/ncurses/base/keyok.c
index ad8988cded3b..0eacf4926300 100644
--- a/contrib/ncurses/ncurses/base/keyok.c
+++ b/contrib/ncurses/ncurses/base/keyok.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2000,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2009 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,12 +27,13 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 1997-on *
+ * Author: Thomas E. Dickey 1997-on *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
#include <curses.priv.h>
-MODULE_ID("$Id: keyok.c,v 1.7 2006/12/30 16:22:33 tom Exp $")
+MODULE_ID("$Id: keyok.c,v 1.10 2009/10/24 22:15:47 tom Exp $")
/*
* Enable (or disable) ncurses' interpretation of a keycode by adding (or
@@ -45,28 +46,33 @@ MODULE_ID("$Id: keyok.c,v 1.7 2006/12/30 16:22:33 tom Exp $")
*/
NCURSES_EXPORT(int)
-keyok(int c, bool flag)
+NCURSES_SP_NAME(keyok) (NCURSES_SP_DCLx int c, bool flag)
{
int code = ERR;
- int count = 0;
- char *s;
+ T((T_CALLED("keyok(%p, %d,%d)"), (void *) SP_PARM, c, flag));
+#ifdef USE_TERM_DRIVER
+ code = CallDriver_2(sp, kyOk, c, flag);
+#else
T((T_CALLED("keyok(%d,%d)"), c, flag));
if (c >= 0) {
+ int count = 0;
+ char *s;
unsigned ch = (unsigned) c;
+
if (flag) {
- while ((s = _nc_expand_try(SP->_key_ok, ch, &count, 0)) != 0
- && _nc_remove_key(&(SP->_key_ok), ch)) {
- code = _nc_add_to_try(&(SP->_keytry), s, ch);
+ while ((s = _nc_expand_try(SP_PARM->_key_ok, ch, &count, 0)) != 0
+ && _nc_remove_key(&(SP_PARM->_key_ok), ch)) {
+ code = _nc_add_to_try(&(SP_PARM->_keytry), s, ch);
free(s);
count = 0;
if (code != OK)
break;
}
} else {
- while ((s = _nc_expand_try(SP->_keytry, ch, &count, 0)) != 0
- && _nc_remove_key(&(SP->_keytry), ch)) {
- code = _nc_add_to_try(&(SP->_key_ok), s, ch);
+ while ((s = _nc_expand_try(SP_PARM->_keytry, ch, &count, 0)) != 0
+ && _nc_remove_key(&(SP_PARM->_keytry), ch)) {
+ code = _nc_add_to_try(&(SP_PARM->_key_ok), s, ch);
free(s);
count = 0;
if (code != OK)
@@ -74,5 +80,14 @@ keyok(int c, bool flag)
}
}
}
+#endif
returnCode(code);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+keyok(int c, bool flag)
+{
+ return NCURSES_SP_NAME(keyok) (CURRENT_SCREEN, c, flag);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/legacy_coding.c b/contrib/ncurses/ncurses/base/legacy_coding.c
index 1c2f160a605d..d8c80208c6a9 100644
--- a/contrib/ncurses/ncurses/base/legacy_coding.c
+++ b/contrib/ncurses/ncurses/base/legacy_coding.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2005 Free Software Foundation, Inc. *
+ * Copyright (c) 2005,2009 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,22 +27,31 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey *
+ * Author: Thomas E. Dickey 2005 *
+ * Juergen Pfeifer 2009 *
****************************************************************************/
#include <curses.priv.h>
-MODULE_ID("$Id: legacy_coding.c,v 1.2 2005/12/17 23:38:17 tom Exp $")
+MODULE_ID("$Id: legacy_coding.c,v 1.5 2009/10/24 22:15:00 tom Exp $")
NCURSES_EXPORT(int)
-use_legacy_coding(int level)
+NCURSES_SP_NAME(use_legacy_coding) (NCURSES_SP_DCLx int level)
{
int result = ERR;
- T((T_CALLED("use_legacy_coding(%d)"), level));
- if (level >= 0 && level <= 2 && SP != 0) {
- result = SP->_legacy_coding;
- SP->_legacy_coding = level;
+ T((T_CALLED("use_legacy_coding(%p,%d)"), (void *) SP_PARM, level));
+ if (level >= 0 && level <= 2 && SP_PARM != 0) {
+ result = SP_PARM->_legacy_coding;
+ SP_PARM->_legacy_coding = level;
}
returnCode(result);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+use_legacy_coding(int level)
+{
+ return NCURSES_SP_NAME(use_legacy_coding) (CURRENT_SCREEN, level);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_addch.c b/contrib/ncurses/ncurses/base/lib_addch.c
index 20a97a01a011..515ebaf0b8fc 100644
--- a/contrib/ncurses/ncurses/base/lib_addch.c
+++ b/contrib/ncurses/ncurses/base/lib_addch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -36,7 +36,7 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_addch.c,v 1.113 2008/08/16 19:20:04 tom Exp $")
+MODULE_ID("$Id: lib_addch.c,v 1.124 2010/04/24 22:41:05 tom Exp $")
static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT);
@@ -77,12 +77,6 @@ render_char(WINDOW *win, NCURSES_CH_T ch)
if ((pair = GET_WINDOW_PAIR(win)) == 0)
pair = GetPair(win->_nc_bkgd);
}
-#if 0
- if (pair > 255) {
- NCURSES_CH_T fixme = ch;
- SetPair(fixme, pair);
- }
-#endif
AddAttr(ch, (a & COLOR_MASK(AttrOf(ch))));
SetPair(ch, pair);
}
@@ -131,7 +125,7 @@ newline_forces_scroll(WINDOW *win, NCURSES_SIZE_T * ypos)
*ypos = win->_regbottom;
result = TRUE;
} else {
- *ypos += 1;
+ *ypos = (NCURSES_SIZE_T) (*ypos + 1);
}
return result;
}
@@ -176,8 +170,8 @@ fill_cells(WINDOW *win, int count)
if (waddch_literal(win, blank) == ERR)
break;
}
- win->_curx = save_x;
- win->_cury = save_y;
+ win->_curx = (NCURSES_SIZE_T) save_x;
+ win->_cury = (NCURSES_SIZE_T) save_y;
}
#endif
@@ -213,9 +207,9 @@ _nc_build_wch(WINDOW *win, ARG_CH_T ch)
buffer[WINDOW_EXT(win, addch_used)] = (char) CharOf(CHDEREF(ch));
WINDOW_EXT(win, addch_used) += 1;
buffer[WINDOW_EXT(win, addch_used)] = '\0';
- if ((len = mbrtowc(&result,
- buffer,
- WINDOW_EXT(win, addch_used), &state)) > 0) {
+ if ((len = (int) mbrtowc(&result,
+ buffer,
+ WINDOW_EXT(win, addch_used), &state)) > 0) {
attr_t attrs = AttrOf(CHDEREF(ch));
if_EXT_COLORS(int pair = GetPair(CHDEREF(ch)));
SetChar(CHDEREF(ch), result, attrs);
@@ -260,20 +254,37 @@ waddch_literal(WINDOW *win, NCURSES_CH_T ch)
/*
* Build up multibyte characters until we have a wide-character.
*/
+#if NCURSES_SP_FUNCS
+#define DeriveSP() SCREEN *sp = _nc_screen_of(win);
+#else
+#define DeriveSP() /*nothing */
+#endif
if_WIDEC({
+ DeriveSP();
if (WINDOW_EXT(win, addch_used) != 0 || !Charable(ch)) {
int len = _nc_build_wch(win, CHREF(ch));
if (len >= -1) {
- /* handle EILSEQ */
- if (is8bits(CharOf(ch))) {
- const char *s = unctrl((chtype) CharOf(ch));
- if (s[1] != 0) {
- return waddstr(win, s);
+ attr_t attr = AttrOf(ch);
+
+ /* handle EILSEQ (i.e., when len >= -1) */
+ if (len == -1 && is8bits(CharOf(ch))) {
+ int rc = OK;
+ const char *s = NCURSES_SP_NAME(unctrl)
+ (NCURSES_SP_ARGx (chtype) CharOf(ch));
+
+ if (s[1] != '\0') {
+ while (*s != '\0') {
+ rc = waddch(win, UChar(*s) | attr);
+ if (rc != OK)
+ break;
+ ++s;
+ }
+ return rc;
}
}
if (len == -1)
- return waddch(win, ' ');
+ return waddch(win, ' ' | attr);
} else {
return OK;
}
@@ -327,6 +338,7 @@ waddch_literal(WINDOW *win, NCURSES_CH_T ch)
return ERR;
x = win->_curx;
y = win->_cury;
+ line = win->_line + y;
}
/*
* Check for cells which are orphaned by adding this character, set
@@ -384,7 +396,7 @@ waddch_literal(WINDOW *win, NCURSES_CH_T ch)
if (x > win->_maxx) {
return wrap_to_next_line(win);
}
- win->_curx = x;
+ win->_curx = (NCURSES_SIZE_T) x;
return OK;
}
@@ -393,9 +405,12 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch)
/* the workhorse function -- add a character to the given window */
{
NCURSES_SIZE_T x, y;
- chtype t = CharOf(ch);
- const char *s = unctrl(t);
-
+ chtype t = (chtype) CharOf(ch);
+#if USE_WIDEC_SUPPORT || NCURSES_SP_FUNCS || USE_REENTRANT
+ SCREEN *sp = _nc_screen_of(win);
+#endif
+ const char *s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx t);
+ int tabsize = 8;
/*
* If we are using the alternate character set, forget about locale.
* Otherwise, if unctrl() returns a single-character or the locale
@@ -404,14 +419,14 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch)
if ((AttrOf(ch) & A_ALTCHARSET)
|| (
#if USE_WIDEC_SUPPORT
- (SP != 0 && SP->_legacy_coding) &&
+ (sp != 0 && sp->_legacy_coding) &&
#endif
s[1] == 0
)
|| (
isprint(t)
#if USE_WIDEC_SUPPORT
- || ((SP == 0 || !SP->_legacy_coding) &&
+ || ((sp == 0 || !sp->_legacy_coding) &&
(WINDOW_EXT(win, addch_used)
|| !_nc_is_charable(CharOf(ch))))
#endif
@@ -427,8 +442,12 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch)
switch (t) {
case '\t':
- x += (TABSIZE - (x % TABSIZE));
-
+#if USE_REENTRANT
+ tabsize = *ptrTabsize(sp);
+#else
+ tabsize = TABSIZE;
+#endif
+ x = (NCURSES_SIZE_T) (x + (tabsize - (x % tabsize)));
/*
* Space-fill the tab on the bottom line so that we'll get the
* "correct" cursor position.
@@ -514,7 +533,7 @@ waddch(WINDOW *win, const chtype ch)
NCURSES_CH_T wch;
SetChar2(wch, ch);
- TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("waddch(%p, %s)"), win,
+ TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("waddch(%p, %s)"), (void *) win,
_tracechtype(ch)));
if (win && (waddch_nosync(win, wch) != ERR)) {
@@ -533,7 +552,8 @@ wechochar(WINDOW *win, const chtype ch)
NCURSES_CH_T wch;
SetChar2(wch, ch);
- TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"), win,
+ TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"),
+ (void *) win,
_tracechtype(ch)));
if (win && (waddch_nosync(win, wch) != ERR)) {
diff --git a/contrib/ncurses/ncurses/base/lib_addstr.c b/contrib/ncurses/ncurses/base/lib_addstr.c
index 4e3a040cf032..d73ce00a4519 100644
--- a/contrib/ncurses/ncurses/base/lib_addstr.c
+++ b/contrib/ncurses/ncurses/base/lib_addstr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -44,7 +44,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_addstr.c,v 1.48 2007/10/13 19:56:57 tom Exp $")
+MODULE_ID("$Id: lib_addstr.c,v 1.51 2010/12/19 01:22:58 tom Exp $")
NCURSES_EXPORT(int)
waddnstr(WINDOW *win, const char *astr, int n)
@@ -52,7 +52,7 @@ waddnstr(WINDOW *win, const char *astr, int n)
const char *str = astr;
int code = ERR;
- T((T_CALLED("waddnstr(%p,%s,%d)"), win, _nc_visbufn(astr, n), n));
+ T((T_CALLED("waddnstr(%p,%s,%d)"), (void *) win, _nc_visbufn(astr, n), n));
if (win && (str != 0)) {
TR(TRACE_VIRTPUT | TRACE_ATTRS,
@@ -85,7 +85,7 @@ waddchnstr(WINDOW *win, const chtype *astr, int n)
int i;
struct ldat *line;
- T((T_CALLED("waddchnstr(%p,%p,%d)"), win, astr, n));
+ T((T_CALLED("waddchnstr(%p,%p,%d)"), (void *) win, (const void *) astr, n));
if (!win)
returnCode(ERR);
@@ -107,7 +107,7 @@ waddchnstr(WINDOW *win, const chtype *astr, int n)
for (i = 0; i < n && ChCharOf(astr[i]) != '\0'; ++i) {
SetChar2(line->text[i + x], astr[i]);
}
- CHANGED_RANGE(line, x, x + n - 1);
+ CHANGED_RANGE(line, x, (NCURSES_SIZE_T) (x + n - 1));
_nc_synchook(win);
returnCode(code);
@@ -135,7 +135,10 @@ wadd_wchnstr(WINDOW *win, const cchar_t *astr, int n)
struct ldat *line;
int i, j, start, len, end;
- T((T_CALLED("wadd_wchnstr(%p,%s,%d)"), win, _nc_viscbuf(astr, n), n));
+ T((T_CALLED("wadd_wchnstr(%p,%s,%d)"),
+ (void *) win,
+ _nc_viscbuf(astr, n),
+ n));
if (!win)
returnCode(ERR);
@@ -190,7 +193,7 @@ wadd_wchnstr(WINDOW *win, const cchar_t *astr, int n)
SetWidecExt(line->text[x + j], j);
}
}
- x += len;
+ x = (NCURSES_SIZE_T) (x + len);
end += len - 1;
} else {
break;
@@ -217,7 +220,7 @@ waddnwstr(WINDOW *win, const wchar_t *str, int n)
{
int code = ERR;
- T((T_CALLED("waddnwstr(%p,%s,%d)"), win, _nc_viswbufn(str, n), n));
+ T((T_CALLED("waddnwstr(%p,%s,%d)"), (void *) win, _nc_viswbufn(str, n), n));
if (win && (str != 0)) {
TR(TRACE_VIRTPUT | TRACE_ATTRS,
diff --git a/contrib/ncurses/ncurses/base/lib_beep.c b/contrib/ncurses/ncurses/base/lib_beep.c
index b478f251a1bb..9d7f7fd96f01 100644
--- a/contrib/ncurses/ncurses/base/lib_beep.c
+++ b/contrib/ncurses/ncurses/base/lib_beep.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 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 *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -40,9 +41,12 @@
*/
#include <curses.priv.h>
-#include <term.h> /* beep, flash */
-MODULE_ID("$Id: lib_beep.c,v 1.10 2005/04/09 15:20:04 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_beep.c,v 1.15 2009/10/24 22:02:14 tom Exp $")
/*
* beep()
@@ -53,12 +57,16 @@ MODULE_ID("$Id: lib_beep.c,v 1.10 2005/04/09 15:20:04 tom Exp $")
*/
NCURSES_EXPORT(int)
-beep(void)
+NCURSES_SP_NAME(beep) (NCURSES_SP_DCL0)
{
int res = ERR;
- T((T_CALLED("beep()")));
+ T((T_CALLED("beep(%p)"), (void *) SP_PARM));
+#ifdef USE_TERM_DRIVER
+ if (SP_PARM != 0)
+ res = CallDriver_1(SP_PARM, doBeepOrFlash, TRUE);
+#else
/* FIXME: should make sure that we are not in altchar mode */
if (cur_term == 0) {
res = ERR;
@@ -71,6 +79,15 @@ beep(void)
res = putp(flash_screen);
_nc_flush();
}
+#endif
returnCode(res);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+beep(void)
+{
+ return NCURSES_SP_NAME(beep) (CURRENT_SCREEN);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_bkgd.c b/contrib/ncurses/ncurses/base/lib_bkgd.c
index c99e0c5fc3a8..0396ba8f47a8 100644
--- a/contrib/ncurses/ncurses/base/lib_bkgd.c
+++ b/contrib/ncurses/ncurses/base/lib_bkgd.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -36,7 +36,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_bkgd.c,v 1.36 2008/03/23 00:09:14 tom Exp $")
+MODULE_ID("$Id: lib_bkgd.c,v 1.43 2011/01/22 19:47:37 tom Exp $")
/*
* Set the window's background information.
@@ -48,7 +48,7 @@ static NCURSES_INLINE void
#endif
wbkgrndset(WINDOW *win, const ARG_CH_T ch)
{
- T((T_CALLED("wbkgdset(%p,%s)"), win, _tracech_t(ch)));
+ T((T_CALLED("wbkgdset(%p,%s)"), (void *) win, _tracech_t(ch)));
if (win) {
attr_t off = AttrOf(win->_nc_bkgd);
@@ -85,12 +85,12 @@ wbkgrndset(WINDOW *win, const ARG_CH_T ch)
cchar_t wch;
int tmp;
- wgetbkgrnd(win, &wch);
+ (void) wgetbkgrnd(win, &wch);
tmp = _nc_to_char((wint_t) CharOf(wch));
win->_bkgd = (((tmp == EOF) ? ' ' : (chtype) tmp)
| (AttrOf(wch) & ALL_BUT_COLOR)
- | COLOR_PAIR(GET_WINDOW_PAIR(win)));
+ | (chtype) ColorPair(GET_WINDOW_PAIR(win)));
}
#endif
}
@@ -120,14 +120,14 @@ wbkgrnd(WINDOW *win, const ARG_CH_T ch)
int x, y;
NCURSES_CH_T new_bkgd = CHDEREF(ch);
- T((T_CALLED("wbkgd(%p,%s)"), win, _tracech_t(ch)));
+ T((T_CALLED("wbkgd(%p,%s)"), (void *) win, _tracech_t(ch)));
if (win) {
NCURSES_CH_T old_bkgrnd;
wgetbkgrnd(win, &old_bkgrnd);
- wbkgrndset(win, CHREF(new_bkgd));
- wattrset(win, AttrOf(win->_nc_bkgd));
+ (void) wbkgrndset(win, CHREF(new_bkgd));
+ (void) wattrset(win, AttrOf(win->_nc_bkgd));
for (y = 0; y <= win->_maxy; y++) {
for (x = 0; x <= win->_maxx; x++) {
diff --git a/contrib/ncurses/ncurses/base/lib_box.c b/contrib/ncurses/ncurses/base/lib_box.c
index d6cfc6cfe09c..6f17c97a5b07 100644
--- a/contrib/ncurses/ncurses/base/lib_box.c
+++ b/contrib/ncurses/ncurses/base/lib_box.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -42,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_box.c,v 1.22 2005/11/26 15:39:42 tom Exp $")
+MODULE_ID("$Id: lib_box.c,v 1.24 2010/04/24 23:51:57 tom Exp $")
#if USE_WIDEC_SUPPORT
static NCURSES_INLINE chtype
@@ -51,8 +51,9 @@ _my_render(WINDOW *win, chtype ch)
NCURSES_CH_T wch;
SetChar2(wch, ch);
wch = _nc_render(win, wch);
- return CharOf(wch) | AttrOf(wch);
+ return ((attr_t) CharOf(wch)) | AttrOf(wch);
}
+
#define RENDER_WITH_DEFAULT(ch,def) w ## ch = _my_render(win, (ch == 0) ? def : ch)
#else
#define RENDER_WITH_DEFAULT(ch,def) w ## ch = _nc_render(win, (ch == 0) ? def : ch)
@@ -70,7 +71,7 @@ wborder(WINDOW *win,
chtype wls, wrs, wts, wbs, wtl, wtr, wbl, wbr;
T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"),
- win,
+ (void *) win,
_tracechtype2(1, ls),
_tracechtype2(2, rs),
_tracechtype2(3, ts),
diff --git a/contrib/ncurses/ncurses/base/lib_chgat.c b/contrib/ncurses/ncurses/base/lib_chgat.c
index 89eefa7e82fe..cdddaeae995c 100644
--- a/contrib/ncurses/ncurses/base/lib_chgat.c
+++ b/contrib/ncurses/ncurses/base/lib_chgat.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -42,19 +42,19 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_chgat.c,v 1.7 2006/07/15 22:07:11 tom Exp $")
+MODULE_ID("$Id: lib_chgat.c,v 1.9 2010/03/31 23:38:02 tom Exp $")
NCURSES_EXPORT(int)
wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED)
{
int i;
- T((T_CALLED("wchgat(%p,%d,%s,%d)"), win, n, _traceattr(attr), color));
+ T((T_CALLED("wchgat(%p,%d,%s,%d)"), (void *) win, n, _traceattr(attr), color));
if (win) {
struct ldat *line = &(win->_line[win->_cury]);
- toggle_attr_on(attr, COLOR_PAIR(color));
+ toggle_attr_on(attr, ColorPair(color));
for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) {
SetAttr(line->text[i], attr);
diff --git a/contrib/ncurses/ncurses/base/lib_clear.c b/contrib/ncurses/ncurses/base/lib_clear.c
index e0b4edf9e224..008744ccbabb 100644
--- a/contrib/ncurses/ncurses/base/lib_clear.c
+++ b/contrib/ncurses/ncurses/base/lib_clear.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000,2009 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,14 +40,14 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_clear.c,v 1.7 2000/12/10 02:43:26 tom Exp $")
+MODULE_ID("$Id: lib_clear.c,v 1.8 2009/10/24 22:33:29 tom Exp $")
NCURSES_EXPORT(int)
wclear(WINDOW *win)
{
int code = ERR;
- T((T_CALLED("wclear(%p)"), win));
+ T((T_CALLED("wclear(%p)"), (void *) win));
if ((code = werase(win)) != ERR)
win->_clear = TRUE;
diff --git a/contrib/ncurses/ncurses/base/lib_clearok.c b/contrib/ncurses/ncurses/base/lib_clearok.c
index 9b56bd1ec63a..ffc7d02dc0ff 100644
--- a/contrib/ncurses/ncurses/base/lib_clearok.c
+++ b/contrib/ncurses/ncurses/base/lib_clearok.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000,2009 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,12 +40,12 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_clearok.c,v 1.4 2000/12/10 02:43:26 tom Exp $")
+MODULE_ID("$Id: lib_clearok.c,v 1.5 2009/10/24 22:34:53 tom Exp $")
NCURSES_EXPORT(int)
clearok(WINDOW *win, bool flag)
{
- T((T_CALLED("clearok(%p,%d)"), win, flag));
+ T((T_CALLED("clearok(%p,%d)"), (void *) win, flag));
if (win) {
win->_clear = flag;
diff --git a/contrib/ncurses/ncurses/base/lib_clrbot.c b/contrib/ncurses/ncurses/base/lib_clrbot.c
index df196e815f82..cbf2206d5581 100644
--- a/contrib/ncurses/ncurses/base/lib_clrbot.c
+++ b/contrib/ncurses/ncurses/base/lib_clrbot.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2001,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2009 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,14 +40,14 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_clrbot.c,v 1.20 2006/10/14 20:43:31 tom Exp $")
+MODULE_ID("$Id: lib_clrbot.c,v 1.21 2009/10/24 22:33:19 tom Exp $")
NCURSES_EXPORT(int)
wclrtobot(WINDOW *win)
{
int code = ERR;
- T((T_CALLED("wclrtobot(%p)"), win));
+ T((T_CALLED("wclrtobot(%p)"), (void *) win));
if (win) {
NCURSES_SIZE_T y;
diff --git a/contrib/ncurses/ncurses/base/lib_clreol.c b/contrib/ncurses/ncurses/base/lib_clreol.c
index c46ebd93a332..7aff84b35a42 100644
--- a/contrib/ncurses/ncurses/base/lib_clreol.c
+++ b/contrib/ncurses/ncurses/base/lib_clreol.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2001,2009 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,14 +40,14 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_clreol.c,v 1.21 2001/12/19 01:06:04 tom Exp $")
+MODULE_ID("$Id: lib_clreol.c,v 1.22 2009/10/24 22:33:06 tom Exp $")
NCURSES_EXPORT(int)
wclrtoeol(WINDOW *win)
{
int code = ERR;
- T((T_CALLED("wclrtoeol(%p)"), win));
+ T((T_CALLED("wclrtoeol(%p)"), (void *) win));
if (win) {
NCURSES_CH_T blank;
diff --git a/contrib/ncurses/ncurses/base/lib_color.c b/contrib/ncurses/ncurses/base/lib_color.c
index 9cae495436fe..a5c181c8b4b1 100644
--- a/contrib/ncurses/ncurses/base/lib_color.c
+++ b/contrib/ncurses/ncurses/base/lib_color.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/* lib_color.c
@@ -38,12 +39,33 @@
*/
#include <curses.priv.h>
-
-#include <term.h>
#include <tic.h>
-MODULE_ID("$Id: lib_color.c,v 1.85 2007/04/07 17:07:28 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_color.c,v 1.98 2010/04/24 22:57:53 tom Exp $")
+
+#ifdef USE_TERM_DRIVER
+#define CanChange InfoOf(SP_PARM).canchange
+#define DefaultPalette InfoOf(SP_PARM).defaultPalette
+#define HasColor InfoOf(SP_PARM).hascolor
+#define InitColor InfoOf(SP_PARM).initcolor
+#define MaxColors InfoOf(SP_PARM).maxcolors
+#define MaxPairs InfoOf(SP_PARM).maxpairs
+#define UseHlsPalette (DefaultPalette == _nc_hls_palette)
+#else
+#define CanChange can_change
+#define DefaultPalette (hue_lightness_saturation ? hls_palette : cga_palette)
+#define HasColor has_color
+#define InitColor initialize_color
+#define MaxColors max_colors
+#define MaxPairs max_pairs
+#define UseHlsPalette (hue_lightness_saturation)
+#endif
+#ifndef USE_TERM_DRIVER
/*
* These should be screen structure members. They need to be globals for
* historical reasons. So we assign them in start_color() and also in
@@ -64,6 +86,7 @@ NCURSES_PUBLIC_VAR(COLORS) (void)
NCURSES_EXPORT_VAR(int) COLOR_PAIRS = 0;
NCURSES_EXPORT_VAR(int) COLORS = 0;
#endif
+#endif /* !USE_TERM_DRIVER */
#define DATA(r,g,b) {r,g,b, 0,0,0, 0}
@@ -71,7 +94,7 @@ NCURSES_EXPORT_VAR(int) COLORS = 0;
#define MAX_PALETTE 8
-#define OkColorHi(n) (((n) < COLORS) && ((n) < max_colors))
+#define OkColorHi(n) (((n) < COLORS) && ((n) < maxcolors))
#define InPalette(n) ((n) >= 0 && (n) < MAX_PALETTE)
/*
@@ -106,29 +129,43 @@ static const color_t hls_palette[] =
DATA( 300, 50, 100), /* COLOR_CYAN */
DATA( 0, 50, 100), /* COLOR_WHITE */
};
+
+#ifdef USE_TERM_DRIVER
+NCURSES_EXPORT_VAR(const color_t*) _nc_cga_palette = cga_palette;
+NCURSES_EXPORT_VAR(const color_t*) _nc_hls_palette = hls_palette;
+#endif
+
/* *INDENT-ON* */
+/*
+ * Ensure that we use color pairs only when colors have been started, and also
+ * that the index is within the limits of the table which we allocated.
+ */
+#define ValidPair(pair) \
+ ((SP_PARM != 0) && (pair >= 0) && (pair < SP_PARM->_pair_limit) && SP_PARM->_coloron)
+
#if NCURSES_EXT_FUNCS
/*
* These are called from _nc_do_color(), which in turn is called from
- * vidattr - so we have to assume that SP may be null.
+ * vidattr - so we have to assume that sp may be null.
*/
static int
-default_fg(void)
+default_fg(NCURSES_SP_DCL0)
{
- return (SP != 0) ? SP->_default_fg : COLOR_WHITE;
+ return (SP_PARM != 0) ? SP_PARM->_default_fg : COLOR_WHITE;
}
static int
-default_bg(void)
+default_bg(NCURSES_SP_DCL0)
{
- return SP != 0 ? SP->_default_bg : COLOR_BLACK;
+ return SP_PARM != 0 ? SP_PARM->_default_bg : COLOR_BLACK;
}
#else
-#define default_fg() COLOR_WHITE
-#define default_bg() COLOR_BLACK
+#define default_fg(sp) COLOR_WHITE
+#define default_bg(sp) COLOR_BLACK
#endif
+#ifndef USE_TERM_DRIVER
/*
* SVr4 curses is known to interchange color codes (1,4) and (3,6), possibly
* to maintain compatibility with a pre-ANSI scheme. The same scheme is
@@ -145,52 +182,70 @@ toggled_colors(int c)
}
return c;
}
+#endif
static void
-set_background_color(int bg, int (*outc) (int))
+set_background_color(NCURSES_SP_DCLx int bg, NCURSES_SP_OUTC outc)
{
+#ifdef USE_TERM_DRIVER
+ CallDriver_3(SP_PARM, color, FALSE, bg, outc);
+#else
if (set_a_background) {
TPUTS_TRACE("set_a_background");
- tputs(TPARM_1(set_a_background, bg), 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_a_background, bg),
+ 1, outc);
} else {
TPUTS_TRACE("set_background");
- tputs(TPARM_1(set_background, toggled_colors(bg)), 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_background, toggled_colors(bg)),
+ 1, outc);
}
+#endif
}
static void
-set_foreground_color(int fg, int (*outc) (int))
+set_foreground_color(NCURSES_SP_DCLx int fg, NCURSES_SP_OUTC outc)
{
+#ifdef USE_TERM_DRIVER
+ CallDriver_3(SP_PARM, color, TRUE, fg, outc);
+#else
if (set_a_foreground) {
TPUTS_TRACE("set_a_foreground");
- tputs(TPARM_1(set_a_foreground, fg), 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_a_foreground, fg),
+ 1, outc);
} else {
TPUTS_TRACE("set_foreground");
- tputs(TPARM_1(set_foreground, toggled_colors(fg)), 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_foreground, toggled_colors(fg)),
+ 1, outc);
}
+#endif
}
static void
-init_color_table(void)
+init_color_table(NCURSES_SP_DCL0)
{
- const color_t *tp;
+ const color_t *tp = DefaultPalette;
int n;
- tp = (hue_lightness_saturation) ? hls_palette : cga_palette;
+ assert(tp != 0);
+
for (n = 0; n < COLORS; n++) {
if (InPalette(n)) {
- SP->_color_table[n] = tp[n];
+ SP_PARM->_color_table[n] = tp[n];
} else {
- SP->_color_table[n] = tp[n % MAX_PALETTE];
- if (hue_lightness_saturation) {
- SP->_color_table[n].green = 100;
+ SP_PARM->_color_table[n] = tp[n % MAX_PALETTE];
+ if (UseHlsPalette) {
+ SP_PARM->_color_table[n].green = 100;
} else {
- if (SP->_color_table[n].red)
- SP->_color_table[n].red = 1000;
- if (SP->_color_table[n].green)
- SP->_color_table[n].green = 1000;
- if (SP->_color_table[n].blue)
- SP->_color_table[n].blue = 1000;
+ if (SP_PARM->_color_table[n].red)
+ SP_PARM->_color_table[n].red = 1000;
+ if (SP_PARM->_color_table[n].green)
+ SP_PARM->_color_table[n].green = 1000;
+ if (SP_PARM->_color_table[n].blue)
+ SP_PARM->_color_table[n].blue = 1000;
}
}
}
@@ -200,16 +255,21 @@ init_color_table(void)
* Reset the color pair, e.g., to whatever color pair 0 is.
*/
static bool
-reset_color_pair(void)
+reset_color_pair(NCURSES_SP_DCL0)
{
+#ifdef USE_TERM_DRIVER
+ return CallDriver(SP_PARM, rescol);
+#else
bool result = FALSE;
+ (void) SP_PARM;
if (orig_pair != 0) {
TPUTS_TRACE("orig_pair");
putp(orig_pair);
result = TRUE;
}
return result;
+#endif
}
/*
@@ -217,65 +277,93 @@ reset_color_pair(void)
* badly-written terminal descriptions than for the relatively rare case where
* someone has changed the color definitions.
*/
-bool
-_nc_reset_colors(void)
+NCURSES_EXPORT(bool)
+NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_DCL0)
{
int result = FALSE;
- T((T_CALLED("_nc_reset_colors()")));
- if (SP->_color_defs > 0)
- SP->_color_defs = -(SP->_color_defs);
-
- if (reset_color_pair())
+ T((T_CALLED("_nc_reset_colors(%p)"), (void *) SP_PARM));
+ if (SP_PARM->_color_defs > 0)
+ SP_PARM->_color_defs = -(SP_PARM->_color_defs);
+ if (reset_color_pair(NCURSES_SP_ARG))
result = TRUE;
+
+#ifdef USE_TERM_DRIVER
+ result = CallDriver(SP_PARM, rescolors);
+#else
if (orig_colors != 0) {
TPUTS_TRACE("orig_colors");
putp(orig_colors);
result = TRUE;
}
+#endif
returnBool(result);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(bool)
+_nc_reset_colors(void)
+{
+ return NCURSES_SP_NAME(_nc_reset_colors) (CURRENT_SCREEN);
+}
+#endif
+
NCURSES_EXPORT(int)
-start_color(void)
+NCURSES_SP_NAME(start_color) (NCURSES_SP_DCL0)
{
int result = ERR;
+ int maxpairs = 0, maxcolors = 0;
- T((T_CALLED("start_color()")));
+ T((T_CALLED("start_color(%p)"), (void *) SP_PARM));
- if (SP == 0) {
+ if (SP_PARM == 0) {
result = ERR;
- } else if (SP->_coloron) {
+ } else if (SP_PARM->_coloron) {
result = OK;
} else {
-
- if (reset_color_pair() != TRUE) {
- set_foreground_color(default_fg(), _nc_outch);
- set_background_color(default_bg(), _nc_outch);
+ maxpairs = MaxPairs;
+ maxcolors = MaxColors;
+ if (reset_color_pair(NCURSES_SP_ARG) != TRUE) {
+ set_foreground_color(NCURSES_SP_ARGx
+ default_fg(NCURSES_SP_ARG),
+ NCURSES_SP_NAME(_nc_outch));
+ set_background_color(NCURSES_SP_ARGx
+ default_bg(NCURSES_SP_ARG),
+ NCURSES_SP_NAME(_nc_outch));
}
- if (max_pairs > 0 && max_colors > 0) {
- SP->_pair_count = max_pairs;
- SP->_color_count = max_colors;
+ if (maxpairs > 0 && maxcolors > 0) {
+ SP_PARM->_pair_limit = maxpairs;
+
+#if NCURSES_EXT_FUNCS
+ /*
+ * If using default colors, allocate extra space in table to
+ * allow for default-color as a component of a color-pair.
+ */
+ SP_PARM->_pair_limit += (1 + (2 * maxcolors));
+#endif
+ SP_PARM->_pair_count = maxpairs;
+ SP_PARM->_color_count = maxcolors;
#if !USE_REENTRANT
- COLOR_PAIRS = max_pairs;
- COLORS = max_colors;
+ COLOR_PAIRS = maxpairs;
+ COLORS = maxcolors;
#endif
- if ((SP->_color_pairs = TYPE_CALLOC(colorpair_t,
- max_pairs)) != 0) {
- if ((SP->_color_table = TYPE_CALLOC(color_t,
- max_colors)) != 0) {
- SP->_color_pairs[0] = PAIR_OF(default_fg(), default_bg());
- init_color_table();
+ SP_PARM->_color_pairs = TYPE_CALLOC(colorpair_t, SP_PARM->_pair_limit);
+ if (SP_PARM->_color_pairs != 0) {
+ SP_PARM->_color_table = TYPE_CALLOC(color_t, maxcolors);
+ if (SP_PARM->_color_table != 0) {
+ SP_PARM->_color_pairs[0] = PAIR_OF(default_fg(NCURSES_SP_ARG),
+ default_bg(NCURSES_SP_ARG));
+ init_color_table(NCURSES_SP_ARG);
T(("started color: COLORS = %d, COLOR_PAIRS = %d",
COLORS, COLOR_PAIRS));
- SP->_coloron = 1;
+ SP_PARM->_coloron = 1;
result = OK;
- } else if (SP->_color_pairs != 0) {
- FreeAndNull(SP->_color_pairs);
+ } else if (SP_PARM->_color_pairs != 0) {
+ FreeAndNull(SP_PARM->_color_pairs);
}
}
} else {
@@ -285,6 +373,14 @@ start_color(void)
returnCode(result);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+start_color(void)
+{
+ return NCURSES_SP_NAME(start_color) (CURRENT_SCREEN);
+}
+#endif
+
/* This function was originally written by Daniel Weaver <danw@znyx.com> */
static void
rgb2hls(short r, short g, short b, short *h, short *l, short *s)
@@ -298,7 +394,7 @@ rgb2hls(short r, short g, short b, short *h, short *l, short *s)
max = b;
/* calculate lightness */
- *l = (min + max) / 20;
+ *l = (short) ((min + max) / 20);
if (min == max) { /* black, white and all shades of gray */
*h = 0;
@@ -308,17 +404,17 @@ rgb2hls(short r, short g, short b, short *h, short *l, short *s)
/* calculate saturation */
if (*l < 50)
- *s = ((max - min) * 100) / (max + min);
+ *s = (short) (((max - min) * 100) / (max + min));
else
- *s = ((max - min) * 100) / (2000 - max - min);
+ *s = (short) (((max - min) * 100) / (2000 - max - min));
/* calculate hue */
if (r == max)
- t = 120 + ((g - b) * 60) / (max - min);
+ t = (short) (120 + ((g - b) * 60) / (max - min));
else if (g == max)
- t = 240 + ((b - r) * 60) / (max - min);
+ t = (short) (240 + ((b - r) * 60) / (max - min));
else
- t = 360 + ((r - g) * 60) / (max - min);
+ t = (short) (360 + ((r - g) * 60) / (max - min));
*h = t % 360;
}
@@ -328,24 +424,75 @@ rgb2hls(short r, short g, short b, short *h, short *l, short *s)
* values.
*/
NCURSES_EXPORT(int)
-init_pair(short pair, short f, short b)
+NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx short pair, short f, short b)
{
colorpair_t result;
+ colorpair_t previous;
+ int maxcolors;
- T((T_CALLED("init_pair(%d,%d,%d)"), pair, f, b));
+ T((T_CALLED("init_pair(%p,%d,%d,%d)"), (void *) SP_PARM, pair, f, b));
- if ((pair < 0) || (pair >= COLOR_PAIRS) || SP == 0 || !SP->_coloron)
+ if (!ValidPair(pair))
returnCode(ERR);
+
+ maxcolors = MaxColors;
+
+ previous = SP_PARM->_color_pairs[pair];
#if NCURSES_EXT_FUNCS
- if (SP->_default_color) {
- if (f < 0)
+ if (SP_PARM->_default_color) {
+ bool isDefault = FALSE;
+ bool wasDefault = FALSE;
+ int default_pairs = SP_PARM->_default_pairs;
+
+ /*
+ * Map caller's color number, e.g., -1, 0, 1, .., 7, etc., into
+ * internal unsigned values which we will store in the _color_pairs[]
+ * table.
+ */
+ if (isDefaultColor(f)) {
f = COLOR_DEFAULT;
- if (b < 0)
+ isDefault = TRUE;
+ } else if (!OkColorHi(f)) {
+ returnCode(ERR);
+ }
+
+ if (isDefaultColor(b)) {
b = COLOR_DEFAULT;
- if (!OkColorHi(f) && !isDefaultColor(f))
+ isDefault = TRUE;
+ } else if (!OkColorHi(b)) {
returnCode(ERR);
- if (!OkColorHi(b) && !isDefaultColor(b))
+ }
+
+ /*
+ * Check if the table entry that we are going to init/update used
+ * default colors.
+ */
+ if ((FORE_OF(previous) == COLOR_DEFAULT)
+ || (BACK_OF(previous) == COLOR_DEFAULT))
+ wasDefault = TRUE;
+
+ /*
+ * Keep track of the number of entries in the color pair table which
+ * used a default color.
+ */
+ if (isDefault && !wasDefault) {
+ ++default_pairs;
+ } else if (wasDefault && !isDefault) {
+ --default_pairs;
+ }
+
+ /*
+ * As an extension, ncurses allows the pair number to exceed the
+ * terminal's color_pairs value for pairs using a default color.
+ *
+ * Note that updating a pair which used a default color with one
+ * that does not will decrement the count - and possibly interfere
+ * with sequentially adding new pairs.
+ */
+ if (pair > (SP_PARM->_pair_count + default_pairs)) {
returnCode(ERR);
+ }
+ SP_PARM->_default_pairs = default_pairs;
} else
#endif
{
@@ -361,14 +508,14 @@ init_pair(short pair, short f, short b)
* pair colors with the new ones).
*/
result = PAIR_OF(f, b);
- if (SP->_color_pairs[pair] != 0
- && SP->_color_pairs[pair] != result) {
+ if (previous != 0
+ && previous != result) {
int y, x;
- for (y = 0; y <= curscr->_maxy; y++) {
- struct ldat *ptr = &(curscr->_line[y]);
+ for (y = 0; y <= CurScreen(SP_PARM)->_maxy; y++) {
+ struct ldat *ptr = &(CurScreen(SP_PARM)->_line[y]);
bool changed = FALSE;
- for (x = 0; x <= curscr->_maxx; x++) {
+ for (x = 0; x <= CurScreen(SP_PARM)->_maxx; x++) {
if (GetPair(ptr->text[x]) == pair) {
/* Set the old cell to zero to ensure it will be
updated on the next doupdate() */
@@ -378,15 +525,19 @@ init_pair(short pair, short f, short b)
}
}
if (changed)
- _nc_make_oldhash(y);
+ NCURSES_SP_NAME(_nc_make_oldhash) (NCURSES_SP_ARGx y);
}
}
- SP->_color_pairs[pair] = result;
- if (GET_SCREEN_PAIR(SP) == pair)
- SET_SCREEN_PAIR(SP, (chtype) (~0)); /* force attribute update */
+ SP_PARM->_color_pairs[pair] = result;
+ if (GET_SCREEN_PAIR(SP_PARM) == pair)
+ SET_SCREEN_PAIR(SP_PARM, (chtype) (~0)); /* force attribute update */
+
+#ifdef USE_TERM_DRIVER
+ CallDriver_3(SP_PARM, initpair, pair, f, b);
+#else
if (initialize_pair && InPalette(f) && InPalette(b)) {
- const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette;
+ const color_t *tp = DefaultPalette;
TR(TRACE_ATTRS,
("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)",
@@ -400,80 +551,148 @@ init_pair(short pair, short f, short b)
tp[f].red, tp[f].green, tp[f].blue,
tp[b].red, tp[b].green, tp[b].blue));
}
+#endif
returnCode(OK);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+init_pair(short pair, short f, short b)
+{
+ return NCURSES_SP_NAME(init_pair) (CURRENT_SCREEN, pair, f, b);
+}
+#endif
+
#define okRGB(n) ((n) >= 0 && (n) <= 1000)
NCURSES_EXPORT(int)
-init_color(short color, short r, short g, short b)
+NCURSES_SP_NAME(init_color) (NCURSES_SP_DCLx
+ short color, short r, short g, short b)
{
int result = ERR;
+ int maxcolors;
+
+ T((T_CALLED("init_color(%p,%d,%d,%d,%d)"),
+ (void *) SP_PARM,
+ color,
+ r, g, b));
- T((T_CALLED("init_color(%d,%d,%d,%d)"), color, r, g, b));
+ if (SP_PARM == 0)
+ returnCode(result);
- if (initialize_color != NULL
- && SP != 0
- && SP->_coloron
+ maxcolors = MaxColors;
+
+ if (InitColor
+ && SP_PARM->_coloron
&& (color >= 0 && OkColorHi(color))
&& (okRGB(r) && okRGB(g) && okRGB(b))) {
- SP->_color_table[color].init = 1;
- SP->_color_table[color].r = r;
- SP->_color_table[color].g = g;
- SP->_color_table[color].b = b;
+ SP_PARM->_color_table[color].init = 1;
+ SP_PARM->_color_table[color].r = r;
+ SP_PARM->_color_table[color].g = g;
+ SP_PARM->_color_table[color].b = b;
- if (hue_lightness_saturation) {
+ if (UseHlsPalette) {
rgb2hls(r, g, b,
- &SP->_color_table[color].red,
- &SP->_color_table[color].green,
- &SP->_color_table[color].blue);
+ &SP_PARM->_color_table[color].red,
+ &SP_PARM->_color_table[color].green,
+ &SP_PARM->_color_table[color].blue);
} else {
- SP->_color_table[color].red = r;
- SP->_color_table[color].green = g;
- SP->_color_table[color].blue = b;
+ SP_PARM->_color_table[color].red = r;
+ SP_PARM->_color_table[color].green = g;
+ SP_PARM->_color_table[color].blue = b;
}
+#ifdef USE_TERM_DRIVER
+ CallDriver_4(SP_PARM, initcolor, color, r, g, b);
+#else
TPUTS_TRACE("initialize_color");
putp(TPARM_4(initialize_color, color, r, g, b));
- SP->_color_defs = max(color + 1, SP->_color_defs);
+#endif
+ SP_PARM->_color_defs = max(color + 1, SP_PARM->_color_defs);
+
result = OK;
}
returnCode(result);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+init_color(short color, short r, short g, short b)
+{
+ return NCURSES_SP_NAME(init_color) (CURRENT_SCREEN, color, r, g, b);
+}
+#endif
+
+NCURSES_EXPORT(bool)
+NCURSES_SP_NAME(can_change_color) (NCURSES_SP_DCL)
+{
+ T((T_CALLED("can_change_color(%p)"), (void *) SP_PARM));
+ returnCode((CanChange != 0) ? TRUE : FALSE);
+}
+
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(bool)
can_change_color(void)
{
- T((T_CALLED("can_change_color()")));
- returnCode((can_change != 0) ? TRUE : FALSE);
+ return NCURSES_SP_NAME(can_change_color) (CURRENT_SCREEN);
}
+#endif
NCURSES_EXPORT(bool)
-has_colors(void)
+NCURSES_SP_NAME(has_colors) (NCURSES_SP_DCL0)
{
+ int code;
+
+ (void) SP_PARM;
T((T_CALLED("has_colors()")));
- returnCode((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs)
- && (((set_foreground != NULL)
- && (set_background != NULL))
- || ((set_a_foreground != NULL)
- && (set_a_background != NULL))
- || set_color_pair)) ? TRUE : FALSE);
+#ifdef USE_TERM_DRIVER
+ code = HasColor;
+#else
+ code = ((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs)
+ && (((set_foreground != NULL)
+ && (set_background != NULL))
+ || ((set_a_foreground != NULL)
+ && (set_a_background != NULL))
+ || set_color_pair)) ? TRUE : FALSE);
+#endif
+ returnCode(code);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(bool)
+has_colors(void)
+{
+ return NCURSES_SP_NAME(has_colors) (CURRENT_SCREEN);
+}
+#endif
+
NCURSES_EXPORT(int)
-color_content(short color, short *r, short *g, short *b)
+NCURSES_SP_NAME(color_content) (NCURSES_SP_DCLx
+ short color, short *r, short *g, short *b)
{
- int result;
+ int result = ERR;
+ int maxcolors;
+
+ T((T_CALLED("color_content(%p,%d,%p,%p,%p)"),
+ (void *) SP_PARM,
+ color,
+ (void *) r,
+ (void *) g,
+ (void *) b));
+
+ if (SP_PARM == 0)
+ returnCode(result);
- T((T_CALLED("color_content(%d,%p,%p,%p)"), color, r, g, b));
- if (color < 0 || !OkColorHi(color) || SP == 0 || !SP->_coloron) {
+ maxcolors = MaxColors;
+
+ if (color < 0 || !OkColorHi(color) || !SP_PARM->_coloron) {
result = ERR;
} else {
- NCURSES_COLOR_T c_r = SP->_color_table[color].red;
- NCURSES_COLOR_T c_g = SP->_color_table[color].green;
- NCURSES_COLOR_T c_b = SP->_color_table[color].blue;
+ NCURSES_COLOR_T c_r = SP_PARM->_color_table[color].red;
+ NCURSES_COLOR_T c_g = SP_PARM->_color_table[color].green;
+ NCURSES_COLOR_T c_b = SP_PARM->_color_table[color].blue;
if (r)
*r = c_r;
@@ -489,18 +708,31 @@ color_content(short color, short *r, short *g, short *b)
returnCode(result);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-pair_content(short pair, short *f, short *b)
+color_content(short color, short *r, short *g, short *b)
+{
+ return NCURSES_SP_NAME(color_content) (CURRENT_SCREEN, color, r, g, b);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(pair_content) (NCURSES_SP_DCLx
+ short pair, short *f, short *b)
{
int result;
- T((T_CALLED("pair_content(%d,%p,%p)"), pair, f, b));
+ T((T_CALLED("pair_content(%p,%d,%p,%p)"),
+ (void *) SP_PARM,
+ pair,
+ (void *) f,
+ (void *) b));
- if ((pair < 0) || (pair >= COLOR_PAIRS) || SP == 0 || !SP->_coloron) {
+ if (!ValidPair(pair)) {
result = ERR;
} else {
- NCURSES_COLOR_T fg = ((SP->_color_pairs[pair] >> C_SHIFT) & C_MASK);
- NCURSES_COLOR_T bg = (SP->_color_pairs[pair] & C_MASK);
+ NCURSES_COLOR_T fg = FORE_OF(SP_PARM->_color_pairs[pair]);
+ NCURSES_COLOR_T bg = BACK_OF(SP_PARM->_color_pairs[pair]);
#if NCURSES_EXT_FUNCS
if (fg == COLOR_DEFAULT)
@@ -514,33 +746,53 @@ pair_content(short pair, short *f, short *b)
if (b)
*b = bg;
- TR(TRACE_ATTRS, ("...pair_content(%d,%d,%d)", pair, fg, bg));
+ TR(TRACE_ATTRS, ("...pair_content(%p,%d,%d,%d)",
+ (void *) SP_PARM,
+ pair,
+ fg, bg));
result = OK;
}
returnCode(result);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+pair_content(short pair, short *f, short *b)
+{
+ return NCURSES_SP_NAME(pair_content) (CURRENT_SCREEN, pair, f, b);
+}
+#endif
+
NCURSES_EXPORT(void)
-_nc_do_color(short old_pair, short pair, bool reverse, int (*outc) (int))
+NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx
+ short old_pair,
+ short pair,
+ bool reverse,
+ NCURSES_SP_OUTC outc)
{
+#ifdef USE_TERM_DRIVER
+ CallDriver_4(SP_PARM, docolor, old_pair, pair, reverse, outc);
+#else
NCURSES_COLOR_T fg = COLOR_DEFAULT;
NCURSES_COLOR_T bg = COLOR_DEFAULT;
NCURSES_COLOR_T old_fg, old_bg;
- if (pair < 0 || pair >= COLOR_PAIRS) {
+ if (!ValidPair(pair)) {
return;
} else if (pair != 0) {
if (set_color_pair) {
TPUTS_TRACE("set_color_pair");
- tputs(TPARM_1(set_color_pair, pair), 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_color_pair, pair),
+ 1, outc);
return;
- } else if (SP != 0) {
+ } else if (SP_PARM != 0) {
pair_content((short) pair, &fg, &bg);
}
}
if (old_pair >= 0
- && SP != 0
+ && SP_PARM != 0
&& pair_content(old_pair, &old_fg, &old_bg) != ERR) {
if ((isDefaultColor(fg) && !isDefaultColor(old_fg))
|| (isDefaultColor(bg) && !isDefaultColor(old_bg))) {
@@ -550,29 +802,29 @@ _nc_do_color(short old_pair, short pair, bool reverse, int (*outc) (int))
* the terminal description, treat it as screen's indicator of ECMA
* SGR 39 and SGR 49, and assume the two sequences are independent.
*/
- if (SP->_has_sgr_39_49
+ if (SP_PARM->_has_sgr_39_49
&& isDefaultColor(old_bg)
&& !isDefaultColor(old_fg)) {
- tputs("\033[39m", 1, outc);
- } else if (SP->_has_sgr_39_49
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[39m", 1, outc);
+ } else if (SP_PARM->_has_sgr_39_49
&& isDefaultColor(old_fg)
&& !isDefaultColor(old_bg)) {
- tputs("\033[49m", 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[49m", 1, outc);
} else
#endif
- reset_color_pair();
+ reset_color_pair(NCURSES_SP_ARG);
}
} else {
- reset_color_pair();
+ reset_color_pair(NCURSES_SP_ARG);
if (old_pair < 0)
return;
}
#if NCURSES_EXT_FUNCS
if (isDefaultColor(fg))
- fg = default_fg();
+ fg = (short) default_fg(NCURSES_SP_ARG);
if (isDefaultColor(bg))
- bg = default_bg();
+ bg = (short) default_bg(NCURSES_SP_ARG);
#endif
if (reverse) {
@@ -585,9 +837,23 @@ _nc_do_color(short old_pair, short pair, bool reverse, int (*outc) (int))
fg, bg));
if (!isDefaultColor(fg)) {
- set_foreground_color(fg, outc);
+ set_foreground_color(NCURSES_SP_ARGx fg, outc);
}
if (!isDefaultColor(bg)) {
- set_background_color(bg, outc);
+ set_background_color(NCURSES_SP_ARGx bg, outc);
}
+#endif
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_do_color(short old_pair, short pair, bool reverse, NCURSES_OUTC outc)
+{
+ SetSafeOutcWrapper(outc);
+ NCURSES_SP_NAME(_nc_do_color) (CURRENT_SCREEN,
+ old_pair,
+ pair,
+ reverse,
+ _nc_outc_wrapper);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_colorset.c b/contrib/ncurses/ncurses/base/lib_colorset.c
index a973c5350c8f..6210a0e8a8f9 100644
--- a/contrib/ncurses/ncurses/base/lib_colorset.c
+++ b/contrib/ncurses/ncurses/base/lib_colorset.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2009 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 @@
/****************************************************************************
* Author: Juergen Pfeifer, 1998 *
- * and: Thomas E. Dickey, 2005 *
+ * and: Thomas E. Dickey, 2005-on *
****************************************************************************/
/*
@@ -41,20 +41,23 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_colorset.c,v 1.11 2005/01/29 21:40:51 tom Exp $")
+MODULE_ID("$Id: lib_colorset.c,v 1.13 2009/10/24 22:02:14 tom Exp $")
NCURSES_EXPORT(int)
wcolor_set(WINDOW *win, short color_pair_number, void *opts)
{
- T((T_CALLED("wcolor_set(%p,%d)"), win, color_pair_number));
+ int code = ERR;
+
+ T((T_CALLED("wcolor_set(%p,%d)"), (void *) win, color_pair_number));
if (win
&& !opts
+ && (SP != 0)
&& (color_pair_number >= 0)
- && (color_pair_number < COLOR_PAIRS)) {
+ && (color_pair_number < SP->_pair_limit)) {
TR(TRACE_ATTRS, ("... current %ld", (long) GET_WINDOW_PAIR(win)));
SET_WINDOW_PAIR(win, color_pair_number);
if_EXT_COLORS(win->_color = color_pair_number);
- returnCode(OK);
- } else
- returnCode(ERR);
+ code = OK;
+ }
+ returnCode(code);
}
diff --git a/contrib/ncurses/ncurses/base/lib_delch.c b/contrib/ncurses/ncurses/base/lib_delch.c
index 0c30f2d93c1b..64c9da73edf8 100644
--- a/contrib/ncurses/ncurses/base/lib_delch.c
+++ b/contrib/ncurses/ncurses/base/lib_delch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2001,2009 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,14 +40,14 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_delch.c,v 1.12 2001/12/19 01:06:09 tom Exp $")
+MODULE_ID("$Id: lib_delch.c,v 1.13 2009/10/24 22:32:47 tom Exp $")
NCURSES_EXPORT(int)
wdelch(WINDOW *win)
{
int code = ERR;
- T((T_CALLED("wdelch(%p)"), win));
+ T((T_CALLED("wdelch(%p)"), (void *) win));
if (win) {
NCURSES_CH_T blank = win->_nc_bkgd;
diff --git a/contrib/ncurses/ncurses/base/lib_delwin.c b/contrib/ncurses/ncurses/base/lib_delwin.c
index b92c40335958..4bb536ca86ad 100644
--- a/contrib/ncurses/ncurses/base/lib_delwin.c
+++ b/contrib/ncurses/ncurses/base/lib_delwin.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,6 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer 2008 *
****************************************************************************/
/*
@@ -40,15 +42,18 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_delwin.c,v 1.17 2008/06/07 14:10:56 tom Exp $")
+MODULE_ID("$Id: lib_delwin.c,v 1.20 2009/10/24 22:02:14 tom Exp $")
static bool
cannot_delete(WINDOW *win)
{
WINDOWLIST *p;
bool result = TRUE;
+#ifdef USE_SP_WINDOWLIST
+ SCREEN *sp = _nc_screen_of(win);
+#endif
- for (each_window(p)) {
+ for (each_window(SP_PARM, p)) {
if (&(p->win) == win) {
result = FALSE;
} else if ((p->win._flags & _SUBWIN) != 0
@@ -65,18 +70,20 @@ delwin(WINDOW *win)
{
int result = ERR;
- T((T_CALLED("delwin(%p)"), win));
+ T((T_CALLED("delwin(%p)"), (void *) win));
if (_nc_try_global(curses) == 0) {
if (win == 0
|| cannot_delete(win)) {
result = ERR;
} else {
-
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = _nc_screen_of(win);
+#endif
if (win->_flags & _SUBWIN)
touchwin(win->_parent);
- else if (curscr != 0)
- touchwin(curscr);
+ else if (CurScreen(SP_PARM) != 0)
+ touchwin(CurScreen(SP_PARM));
result = _nc_freewin(win);
}
diff --git a/contrib/ncurses/ncurses/base/lib_dft_fgbg.c b/contrib/ncurses/ncurses/base/lib_dft_fgbg.c
index 8953c148b09e..4bb9fc2774a9 100644
--- a/contrib/ncurses/ncurses/base/lib_dft_fgbg.c
+++ b/contrib/ncurses/ncurses/base/lib_dft_fgbg.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2009 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,49 +27,73 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey *
+ * Author: Thomas E. Dickey 1998-on *
+ * Juergen Pfeifer 2009 *
****************************************************************************/
#include <curses.priv.h>
-#include <term.h>
-MODULE_ID("$Id: lib_dft_fgbg.c,v 1.18 2005/11/26 20:03:38 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_dft_fgbg.c,v 1.25 2009/10/24 22:15:00 tom Exp $")
/*
* Modify the behavior of color-pair 0 so that the library doesn't assume that
* it is white on black. This is an extension to XSI curses.
*/
NCURSES_EXPORT(int)
+NCURSES_SP_NAME(use_default_colors) (NCURSES_SP_DCL0)
+{
+ T((T_CALLED("use_default_colors(%p)"), (void *) SP_PARM));
+ returnCode(NCURSES_SP_NAME(assume_default_colors) (NCURSES_SP_ARGx -1, -1));
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
use_default_colors(void)
{
- T((T_CALLED("use_default_colors()")));
- returnCode(assume_default_colors(-1, -1));
+ return NCURSES_SP_NAME(use_default_colors) (CURRENT_SCREEN);
}
+#endif
/*
* Modify the behavior of color-pair 0 so that the library assumes that it
* is something specific, possibly not white on black.
*/
NCURSES_EXPORT(int)
-assume_default_colors(int fg, int bg)
+NCURSES_SP_NAME(assume_default_colors) (NCURSES_SP_DCLx int fg, int bg)
{
- T((T_CALLED("assume_default_colors(%d,%d)"), fg, bg));
+ int code = ERR;
- if (!orig_pair && !orig_colors)
- returnCode(ERR);
+ T((T_CALLED("assume_default_colors(%p,%d,%d)"), (void *) SP_PARM, fg, bg));
+#ifdef USE_TERM_DRIVER
+ if (sp != 0)
+ code = CallDriver_2(sp, defaultcolors, fg, bg);
+#else
+ if ((orig_pair || orig_colors) && !initialize_pair) {
- if (initialize_pair) /* don't know how to handle this */
- returnCode(ERR);
-
- SP->_default_color = isDefaultColor(fg) || isDefaultColor(bg);
- SP->_has_sgr_39_49 = (tigetflag("AX") == TRUE);
- SP->_default_fg = isDefaultColor(fg) ? COLOR_DEFAULT : (fg & C_MASK);
- SP->_default_bg = isDefaultColor(bg) ? COLOR_DEFAULT : (bg & C_MASK);
- if (SP->_color_pairs != 0) {
- bool save = SP->_default_color;
- SP->_default_color = TRUE;
- init_pair(0, (short) fg, (short) bg);
- SP->_default_color = save;
+ SP_PARM->_default_color = isDefaultColor(fg) || isDefaultColor(bg);
+ SP_PARM->_has_sgr_39_49 = (tigetflag("AX") == TRUE);
+ SP_PARM->_default_fg = isDefaultColor(fg) ? COLOR_DEFAULT : (fg & C_MASK);
+ SP_PARM->_default_bg = isDefaultColor(bg) ? COLOR_DEFAULT : (bg & C_MASK);
+ if (SP_PARM->_color_pairs != 0) {
+ bool save = SP_PARM->_default_color;
+ SP_PARM->_default_color = TRUE;
+ init_pair(0, (short) fg, (short) bg);
+ SP_PARM->_default_color = save;
+ }
+ code = OK;
}
- returnCode(OK);
+#endif
+ returnCode(code);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+assume_default_colors(int fg, int bg)
+{
+ return NCURSES_SP_NAME(assume_default_colors) (CURRENT_SCREEN, fg, bg);
}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_driver.c b/contrib/ncurses/ncurses/base/lib_driver.c
new file mode 100644
index 000000000000..40487609be4d
--- /dev/null
+++ b/contrib/ncurses/ncurses/base/lib_driver.c
@@ -0,0 +1,143 @@
+/****************************************************************************
+ * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc. *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a *
+ * copy of this software and associated documentation files (the *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Juergen Pfeifer *
+ * *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_driver.c,v 1.3 2010/12/20 00:29:17 tom Exp $")
+
+typedef struct DriverEntry {
+ const char *name;
+ TERM_DRIVER *driver;
+} DRIVER_ENTRY;
+
+static DRIVER_ENTRY DriverTable[] =
+{
+#ifdef __MINGW32__
+ {"win", &_nc_WIN_DRIVER},
+#endif
+ {"tinfo", &_nc_TINFO_DRIVER}
+};
+
+NCURSES_EXPORT(int)
+_nc_get_driver(TERMINAL_CONTROL_BLOCK * TCB, const char *name, int *errret)
+{
+ int code = ERR;
+ size_t i;
+ TERM_DRIVER *res = (TERM_DRIVER *) 0;
+ TERM_DRIVER *use = 0;
+
+ T((T_CALLED("_nc_get_driver(%p, %s, %p)"),
+ (void *) TCB, NonNull(name), (void *) errret));
+
+ assert(TCB != 0);
+
+ for (i = 0; i < SIZEOF(DriverTable); i++) {
+ res = DriverTable[i].driver;
+ if (res->CanHandle(TCB, name, errret)) {
+ use = res;
+ break;
+ }
+ }
+ if (use != 0) {
+ TCB->drv = use;
+ code = OK;
+ }
+ returnCode(code);
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(has_key) (SCREEN *sp, int keycode)
+{
+ T((T_CALLED("has_key(%p, %d)"), (void *) sp, keycode));
+ returnCode(IsValidTIScreen(sp) ? CallDriver_1(sp, kyExist, keycode) : FALSE);
+}
+
+NCURSES_EXPORT(int)
+has_key(int keycode)
+{
+ return NCURSES_SP_NAME(has_key) (CURRENT_SCREEN, keycode);
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_mcprint) (SCREEN *sp, char *data, int len)
+{
+ int code = ERR;
+
+ if (0 != TerminalOf(sp))
+ code = CallDriver_2(sp, print, data, len);
+ return (code);
+}
+
+NCURSES_EXPORT(int)
+mcprint(char *data, int len)
+{
+ return NCURSES_SP_NAME(_nc_mcprint) (CURRENT_SCREEN, data, len);
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(doupdate) (SCREEN *sp)
+{
+ int code = ERR;
+
+ T((T_CALLED("doupdate(%p)"), (void *) sp));
+
+ if (IsValidScreen(sp))
+ code = CallDriver(sp, update);
+
+ returnCode(code);
+}
+
+NCURSES_EXPORT(int)
+doupdate(void)
+{
+ return NCURSES_SP_NAME(doupdate) (CURRENT_SCREEN);
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(mvcur) (SCREEN *sp, int yold, int xold, int ynew, int xnew)
+{
+ int code = ERR;
+ TR(TRACE_CALLS | TRACE_MOVE, (T_CALLED("mvcur(%p,%d,%d,%d,%d)"),
+ (void *) sp, yold, xold, ynew, xnew));
+ if (HasTerminal(sp)) {
+ code = CallDriver_4(sp, hwcur, yold, xold, ynew, xnew);
+ }
+ returnCode(code);
+}
+
+NCURSES_EXPORT(int)
+mvcur(int yold, int xold, int ynew, int xnew)
+/* optimized cursor move from (yold, xold) to (ynew, xnew) */
+{
+ return NCURSES_SP_NAME(mvcur) (CURRENT_SCREEN, yold, xold, ynew, xnew);
+}
diff --git a/contrib/ncurses/ncurses/base/lib_echo.c b/contrib/ncurses/ncurses/base/lib_echo.c
index df44713d1a11..9e1d3c265741 100644
--- a/contrib/ncurses/ncurses/base/lib_echo.c
+++ b/contrib/ncurses/ncurses/base/lib_echo.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,6 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -42,20 +44,40 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_echo.c,v 1.5 2000/12/10 02:43:27 tom Exp $")
+MODULE_ID("$Id: lib_echo.c,v 1.8 2009/10/24 22:02:14 tom Exp $")
NCURSES_EXPORT(int)
+NCURSES_SP_NAME(echo) (NCURSES_SP_DCL0)
+{
+ T((T_CALLED("echo(%p)"), (void *) SP_PARM));
+ if (0 == SP_PARM)
+ returnCode(ERR);
+ SP_PARM->_echo = TRUE;
+ returnCode(OK);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
echo(void)
{
- T((T_CALLED("echo()")));
- SP->_echo = TRUE;
+ return NCURSES_SP_NAME(echo) (CURRENT_SCREEN);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(noecho) (NCURSES_SP_DCL0)
+{
+ T((T_CALLED("noecho(%p)"), (void *) SP_PARM));
+ if (0 == SP_PARM)
+ returnCode(ERR);
+ SP_PARM->_echo = FALSE;
returnCode(OK);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
noecho(void)
{
- T((T_CALLED("noecho()")));
- SP->_echo = FALSE;
- returnCode(OK);
+ return NCURSES_SP_NAME(noecho) (CURRENT_SCREEN);
}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_endwin.c b/contrib/ncurses/ncurses/base/lib_endwin.c
index 66662871962b..4596d0749633 100644
--- a/contrib/ncurses/ncurses/base/lib_endwin.c
+++ b/contrib/ncurses/ncurses/base/lib_endwin.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,6 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -39,22 +41,39 @@
*/
#include <curses.priv.h>
-#include <term.h>
-MODULE_ID("$Id: lib_endwin.c,v 1.19 2000/12/10 02:43:27 tom Exp $")
+MODULE_ID("$Id: lib_endwin.c,v 1.22 2009/10/24 22:02:14 tom Exp $")
NCURSES_EXPORT(int)
-endwin(void)
+NCURSES_SP_NAME(endwin) (NCURSES_SP_DCL0)
{
- T((T_CALLED("endwin()")));
+ int code = ERR;
+
+ T((T_CALLED("endwin(%p)"), (void *) SP_PARM));
- if (SP) {
- SP->_endwin = TRUE;
- SP->_mouse_wrap(SP);
+ if (SP_PARM) {
+#ifdef USE_TERM_DRIVER
+ TERMINAL_CONTROL_BLOCK *TCB = TCBOf(SP_PARM);
+
+ SP_PARM->_endwin = TRUE;
+ if (TCB && TCB->drv && TCB->drv->scexit)
+ TCB->drv->scexit(SP_PARM);
+#else
+ SP_PARM->_endwin = TRUE;
+ SP_PARM->_mouse_wrap(SP_PARM);
_nc_screen_wrap();
_nc_mvcur_wrap(); /* wrap up cursor addressing */
- returnCode(reset_shell_mode());
+#endif
+ code = NCURSES_SP_NAME(reset_shell_mode) (NCURSES_SP_ARG);
}
- returnCode(ERR);
+ returnCode(code);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+endwin(void)
+{
+ return NCURSES_SP_NAME(endwin) (CURRENT_SCREEN);
}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_erase.c b/contrib/ncurses/ncurses/base/lib_erase.c
index 2566e8b39820..bbf10ef81b92 100644
--- a/contrib/ncurses/ncurses/base/lib_erase.c
+++ b/contrib/ncurses/ncurses/base/lib_erase.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2009 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_erase.c,v 1.16 2005/10/30 00:36:36 tom Exp $")
+MODULE_ID("$Id: lib_erase.c,v 1.17 2009/10/24 22:32:29 tom Exp $")
NCURSES_EXPORT(int)
werase(WINDOW *win)
@@ -51,7 +51,7 @@ werase(WINDOW *win)
NCURSES_CH_T blank;
NCURSES_CH_T *sp, *end, *start;
- T((T_CALLED("werase(%p)"), win));
+ T((T_CALLED("werase(%p)"), (void *) win));
if (win) {
blank = win->_nc_bkgd;
diff --git a/contrib/ncurses/ncurses/base/lib_flash.c b/contrib/ncurses/ncurses/base/lib_flash.c
index a6b022a8e816..03f11d923b6d 100644
--- a/contrib/ncurses/ncurses/base/lib_flash.c
+++ b/contrib/ncurses/ncurses/base/lib_flash.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,6 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -39,9 +41,12 @@
*/
#include <curses.priv.h>
-#include <term.h> /* beep, flash */
-MODULE_ID("$Id: lib_flash.c,v 1.6 2000/12/10 02:43:27 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_flash.c,v 1.11 2009/10/24 22:02:14 tom Exp $")
/*
* flash()
@@ -52,12 +57,15 @@ MODULE_ID("$Id: lib_flash.c,v 1.6 2000/12/10 02:43:27 tom Exp $")
*/
NCURSES_EXPORT(int)
-flash(void)
+NCURSES_SP_NAME(flash) (NCURSES_SP_DCL0)
{
int res = ERR;
- T((T_CALLED("flash()")));
-
+ T((T_CALLED("flash(%p)"), (void *) SP_PARM));
+#ifdef USE_TERM_DRIVER
+ if (SP_PARM != 0)
+ res = CallDriver_1(SP_PARM, doBeepOrFlash, FALSE);
+#else
/* FIXME: should make sure that we are not in altchar mode */
if (flash_screen) {
TPUTS_TRACE("flash_screen");
@@ -68,6 +76,14 @@ flash(void)
res = putp(bell);
_nc_flush();
}
-
+#endif
returnCode(res);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+flash(void)
+{
+ return NCURSES_SP_NAME(flash) (CURRENT_SCREEN);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_freeall.c b/contrib/ncurses/ncurses/base/lib_freeall.c
index 564026582911..5bcc974bc257 100644
--- a/contrib/ncurses/ncurses/base/lib_freeall.c
+++ b/contrib/ncurses/ncurses/base/lib_freeall.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -31,7 +31,6 @@
****************************************************************************/
#include <curses.priv.h>
-#include <term_entry.h>
#include <tic.h>
#if HAVE_NC_FREEALL
@@ -40,40 +39,40 @@
extern int malloc_errfd; /* FIXME */
#endif
-MODULE_ID("$Id: lib_freeall.c,v 1.54 2008/09/27 13:09:57 tom Exp $")
+MODULE_ID("$Id: lib_freeall.c,v 1.59 2010/01/23 17:57:43 tom Exp $")
/*
* Free all ncurses data. This is used for testing only (there's no practical
* use for it as an extension).
*/
NCURSES_EXPORT(void)
-_nc_freeall(void)
+NCURSES_SP_NAME(_nc_freeall) (NCURSES_SP_DCL0)
{
WINDOWLIST *p, *q;
static va_list empty_va;
T((T_CALLED("_nc_freeall()")));
#if NO_LEAKS
- if (SP != 0) {
- if (SP->_oldnum_list != 0) {
- FreeAndNull(SP->_oldnum_list);
+ if (SP_PARM != 0) {
+ if (SP_PARM->_oldnum_list != 0) {
+ FreeAndNull(SP_PARM->_oldnum_list);
}
- if (SP->_panelHook.destroy != 0) {
- SP->_panelHook.destroy(SP->_panelHook.stdscr_pseudo_panel);
+ if (SP_PARM->_panelHook.destroy != 0) {
+ SP_PARM->_panelHook.destroy(SP_PARM->_panelHook.stdscr_pseudo_panel);
}
}
#endif
- if (SP != 0) {
+ if (SP_PARM != 0) {
_nc_lock_global(curses);
- while (_nc_windows != 0) {
+ while (WindowList(SP_PARM) != 0) {
bool deleted = FALSE;
/* Delete only windows that're not a parent */
- for (each_window(p)) {
+ for (each_window(SP_PARM, p)) {
bool found = FALSE;
- for (each_window(q)) {
+ for (each_window(SP_PARM, q)) {
if ((p != q)
&& (q->win._flags & _SUBWIN)
&& (&(p->win) == q->win._parent)) {
@@ -95,11 +94,9 @@ _nc_freeall(void)
if (!deleted)
break;
}
- delscreen(SP);
+ delscreen(SP_PARM);
_nc_unlock_global(curses);
}
- if (cur_term != 0)
- del_curterm(cur_term);
(void) _nc_printf_string(0, empty_va);
#ifdef TRACE
@@ -121,12 +118,20 @@ _nc_freeall(void)
returnVoid;
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(void)
-_nc_free_and_exit(int code)
+_nc_freeall(void)
+{
+ NCURSES_SP_NAME(_nc_freeall) (CURRENT_SCREEN);
+}
+#endif
+
+NCURSES_EXPORT(void)
+NCURSES_SP_NAME(_nc_free_and_exit) (NCURSES_SP_DCLx int code)
{
- char *last_setbuf = (SP != 0) ? SP->_setbuf : 0;
+ char *last_setbuf = (SP_PARM != 0) ? SP_PARM->_setbuf : 0;
- _nc_freeall();
+ NCURSES_SP_NAME(_nc_freeall) (NCURSES_SP_ARG);
#ifdef TRACE
trace(0); /* close trace file, freeing its setbuf */
{
@@ -146,12 +151,21 @@ _nc_freeall(void)
}
NCURSES_EXPORT(void)
-_nc_free_and_exit(int code)
+NCURSES_SP_NAME(_nc_free_and_exit) (NCURSES_SP_DCLx int code)
{
- if (SP)
- delscreen(SP);
- if (cur_term != 0)
- del_curterm(cur_term);
+ if (SP_PARM) {
+ delscreen(SP_PARM);
+ if (SP_PARM->_term)
+ NCURSES_SP_NAME(del_curterm) (NCURSES_SP_ARGx SP_PARM->_term);
+ }
exit(code);
}
#endif
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_free_and_exit(int code)
+{
+ NCURSES_SP_NAME(_nc_free_and_exit) (CURRENT_SCREEN, code);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_getch.c b/contrib/ncurses/ncurses/base/lib_getch.c
index e7ba0b210e34..130c502431b3 100644
--- a/contrib/ncurses/ncurses/base/lib_getch.c
+++ b/contrib/ncurses/ncurses/base/lib_getch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -41,40 +42,80 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_getch.c,v 1.99 2008/09/20 19:46:13 tom Exp $")
+MODULE_ID("$Id: lib_getch.c,v 1.121 2010/12/25 23:24:04 tom Exp $")
#include <fifo_defs.h>
#if USE_REENTRANT
-#define GetEscdelay(sp) (sp)->_ESCDELAY
+#define GetEscdelay(sp) *_nc_ptr_Escdelay(sp)
NCURSES_EXPORT(int)
NCURSES_PUBLIC_VAR(ESCDELAY) (void)
{
- return SP ? GetEscdelay(SP) : 1000;
+ return *(_nc_ptr_Escdelay(CURRENT_SCREEN));
+}
+
+NCURSES_EXPORT(int *)
+_nc_ptr_Escdelay(SCREEN *sp)
+{
+ return ptrEscdelay(sp);
}
#else
#define GetEscdelay(sp) ESCDELAY
-NCURSES_EXPORT_VAR(int)
-ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */
+NCURSES_EXPORT_VAR(int) ESCDELAY = 1000;
#endif
#if NCURSES_EXT_FUNCS
NCURSES_EXPORT(int)
-set_escdelay(int value)
+NCURSES_SP_NAME(set_escdelay) (NCURSES_SP_DCLx int value)
{
int code = OK;
#if USE_REENTRANT
- if (SP) {
- SP->_ESCDELAY = value;
+ if (SP_PARM) {
+ SET_ESCDELAY(value);
} else {
code = ERR;
}
#else
+ (void) SP_PARM;
ESCDELAY = value;
#endif
return code;
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+set_escdelay(int value)
+{
+ int code;
+#if USE_REENTRANT
+ code = NCURSES_SP_NAME(set_escdelay) (CURRENT_SCREEN, value);
+#else
+ ESCDELAY = value;
+ code = OK;
+#endif
+ return code;
+}
+#endif
+#endif /* NCURSES_EXT_FUNCS */
+
+#if NCURSES_EXT_FUNCS
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(get_escdelay) (NCURSES_SP_DCL0)
+{
+#if !USE_REENTRANT
+ (void) SP_PARM;
+#endif
+ return GetEscdelay(SP_PARM);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+get_escdelay(void)
+{
+ return NCURSES_SP_NAME(get_escdelay) (CURRENT_SCREEN);
+}
#endif
+#endif /* NCURSES_EXT_FUNCS */
static int
_nc_use_meta(WINDOW *win)
@@ -83,12 +124,6 @@ _nc_use_meta(WINDOW *win)
return (sp ? sp->_use_meta : 0);
}
-#ifdef NCURSES_WGETCH_EVENTS
-#define TWAIT_MASK 7
-#else
-#define TWAIT_MASK 3
-#endif
-
/*
* Check for mouse activity, returning nonzero if we find any.
*/
@@ -97,19 +132,29 @@ check_mouse_activity(SCREEN *sp, int delay EVENTLIST_2nd(_nc_eventlist * evl))
{
int rc;
+#ifdef USE_TERM_DRIVER
+ rc = TCBOf(sp)->drv->testmouse(TCBOf(sp), delay);
+#else
#if USE_SYSMOUSE
if ((sp->_mouse_type == M_SYSMOUSE)
&& (sp->_sysmouse_head < sp->_sysmouse_tail)) {
- return 2;
- }
+ rc = TW_MOUSE;
+ } else
#endif
- rc = _nc_timed_wait(sp, TWAIT_MASK, delay, (int *) 0 EVENTLIST_2nd(evl));
+ {
+ rc = _nc_timed_wait(sp,
+ TWAIT_MASK,
+ delay,
+ (int *) 0
+ EVENTLIST_2nd(evl));
#if USE_SYSMOUSE
- if ((sp->_mouse_type == M_SYSMOUSE)
- && (sp->_sysmouse_head < sp->_sysmouse_tail)
- && (rc == 0)
- && (errno == EINTR)) {
- rc |= 2;
+ if ((sp->_mouse_type == M_SYSMOUSE)
+ && (sp->_sysmouse_head < sp->_sysmouse_tail)
+ && (rc == 0)
+ && (errno == EINTR)) {
+ rc |= TW_MOUSE;
+ }
+#endif
}
#endif
return rc;
@@ -173,9 +218,9 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
} else
mask = 0;
- if (mask & 4) {
+ if (mask & TW_EVENT) {
T(("fifo_push: ungetch KEY_EVENT"));
- _nc_ungetch(sp, KEY_EVENT);
+ safe_ungetch(sp, KEY_EVENT);
return KEY_EVENT;
}
#elif USE_GPM_SUPPORT || USE_EMX_MOUSE || USE_SYSMOUSE
@@ -185,7 +230,7 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
#endif
#if USE_GPM_SUPPORT || USE_EMX_MOUSE
- if ((sp->_mouse_fd >= 0) && (mask & 2)) {
+ if ((sp->_mouse_fd >= 0) && (mask & TW_MOUSE)) {
sp->_mouse_event(sp);
ch = KEY_MOUSE;
n = 1;
@@ -204,10 +249,33 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
n = 1;
} else
#endif
+#ifdef USE_TERM_DRIVER
+ if ((sp->_mouse_type == M_TERM_DRIVER)
+ && (sp->_drv_mouse_head < sp->_drv_mouse_tail)) {
+ sp->_mouse_event(sp);
+ ch = KEY_MOUSE;
+ n = 1;
+ } else
+#endif
{ /* Can block... */
+#ifdef USE_TERM_DRIVER
+ int buf;
+ n = CallDriver_1(sp, read, &buf);
+ ch = buf;
+#else
unsigned char c2 = 0;
- n = read(sp->_ifd, &c2, 1);
+# if USE_PTHREADS_EINTR
+# if USE_WEAK_SYMBOLS
+ if ((pthread_self) && (pthread_kill) && (pthread_equal))
+# endif
+ _nc_globals.read_thread = pthread_self();
+# endif
+ n = (int) read(sp->_ifd, &c2, 1);
+#if USE_PTHREADS_EINTR
+ _nc_globals.read_thread = 0;
+#endif
ch = c2;
+#endif
}
#ifdef HIDE_EINTR
@@ -220,7 +288,11 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
* We don't want this difference to show. This piece of code
* tries to make it look like we always have restarting signals.
*/
- if (n <= 0 && errno == EINTR)
+ if (n <= 0 && errno == EINTR
+# if USE_PTHREADS_EINTR
+ && (_nc_globals.have_sigwinch == 0)
+# endif
+ )
goto again;
#endif
@@ -260,12 +332,12 @@ recur_wrefresh(WINDOW *win)
{
#ifdef USE_PTHREADS
SCREEN *sp = _nc_screen_of(win);
- if (_nc_use_pthreads && sp != SP) {
+ if (_nc_use_pthreads && sp != CURRENT_SCREEN) {
SCREEN *save_SP;
/* temporarily switch to the window's screen to check/refresh */
_nc_lock_global(curses);
- save_SP = SP;
+ save_SP = CURRENT_SCREEN;
_nc_set_screen(sp);
recur_wrefresh(win);
_nc_set_screen(save_SP);
@@ -286,12 +358,12 @@ recur_wgetnstr(WINDOW *win, char *buf)
if (sp != 0) {
#ifdef USE_PTHREADS
- if (_nc_use_pthreads && sp != SP) {
+ if (_nc_use_pthreads && sp != CURRENT_SCREEN) {
SCREEN *save_SP;
/* temporarily switch to the window's screen to get cooked input */
_nc_lock_global(curses);
- save_SP = SP;
+ save_SP = CURRENT_SCREEN;
_nc_set_screen(sp);
rc = recur_wgetnstr(win, buf);
_nc_set_screen(save_SP);
@@ -311,17 +383,18 @@ recur_wgetnstr(WINDOW *win, char *buf)
NCURSES_EXPORT(int)
_nc_wgetch(WINDOW *win,
- unsigned long *result,
+ int *result,
int use_meta
EVENTLIST_2nd(_nc_eventlist * evl))
{
SCREEN *sp;
int ch;
+ int rc = 0;
#ifdef NCURSES_WGETCH_EVENTS
long event_delay = -1;
#endif
- T((T_CALLED("_nc_wgetch(%p)"), win));
+ T((T_CALLED("_nc_wgetch(%p)"), (void *) win));
*result = 0;
@@ -352,19 +425,20 @@ _nc_wgetch(WINDOW *win,
!sp->_cbreak &&
!sp->_called_wgetch) {
char buf[MAXCOLUMNS], *bufp;
- int rc;
TR(TRACE_IEVENT, ("filling queue in cooked mode"));
- rc = recur_wgetnstr(win, buf);
-
/* ungetch in reverse order */
#ifdef NCURSES_WGETCH_EVENTS
+ rc = recur_wgetnstr(win, buf);
if (rc != KEY_EVENT)
+ safe_ungetch(sp, '\n');
+#else
+ (void) recur_wgetnstr(win, buf);
+ safe_ungetch(sp, '\n');
#endif
- _nc_ungetch(sp, '\n');
for (bufp = buf + strlen(buf); bufp > buf; bufp--)
- _nc_ungetch(sp, bufp[-1]);
+ safe_ungetch(sp, bufp[-1]);
#ifdef NCURSES_WGETCH_EVENTS
/* Return it first */
@@ -384,7 +458,6 @@ _nc_wgetch(WINDOW *win,
if (win->_notimeout || (win->_delay >= 0) || (sp->_cbreak > 1)) {
if (head == -1) { /* fifo is empty */
int delay;
- int rc;
TR(TRACE_IEVENT, ("timed delay in wgetch()"));
if (sp->_cbreak > 1)
@@ -402,13 +475,13 @@ _nc_wgetch(WINDOW *win,
rc = check_mouse_activity(sp, delay EVENTLIST_2nd(evl));
#ifdef NCURSES_WGETCH_EVENTS
- if (rc & 4) {
+ if (rc & TW_EVENT) {
*result = KEY_EVENT;
returnCode(KEY_CODE_YES);
}
#endif
if (!rc) {
- returnCode(ERR);
+ goto check_sigwinch;
}
}
/* else go on to read data available */
@@ -427,7 +500,6 @@ _nc_wgetch(WINDOW *win,
* increase the wait with mouseinterval().
*/
int runcount = 0;
- int rc;
do {
ch = kgetch(sp EVENTLIST_2nd(evl));
@@ -442,11 +514,11 @@ _nc_wgetch(WINDOW *win,
(ch == KEY_MOUSE
&& (((rc = check_mouse_activity(sp, sp->_maxclick
EVENTLIST_2nd(evl))) != 0
- && !(rc & 4))
+ && !(rc & TW_EVENT))
|| !sp->_mouse_parse(sp, runcount)));
#ifdef NCURSES_WGETCH_EVENTS
- if ((rc & 4) && !ch == KEY_EVENT) {
- _nc_ungetch(sp, ch);
+ if ((rc & TW_EVENT) && !(ch == KEY_EVENT)) {
+ safe_ungetch(sp, ch);
ch = KEY_EVENT;
}
#endif
@@ -454,12 +526,12 @@ _nc_wgetch(WINDOW *win,
#ifdef NCURSES_WGETCH_EVENTS
/* mouse event sequence ended by an event, report event */
if (ch == KEY_EVENT) {
- _nc_ungetch(sp, KEY_MOUSE); /* FIXME This interrupts a gesture... */
+ safe_ungetch(sp, KEY_MOUSE); /* FIXME This interrupts a gesture... */
} else
#endif
{
/* mouse event sequence ended by keystroke, store keystroke */
- _nc_ungetch(sp, ch);
+ safe_ungetch(sp, ch);
ch = KEY_MOUSE;
}
}
@@ -470,6 +542,7 @@ _nc_wgetch(WINDOW *win,
}
if (ch == ERR) {
+ check_sigwinch:
#if USE_SIZECHANGE
if (_nc_handle_sigwinch(sp)) {
_nc_update_screensize(sp);
@@ -508,7 +581,7 @@ _nc_wgetch(WINDOW *win,
* cursor to the left.
*/
if (sp->_echo && !(win->_flags & _ISPAD)) {
- chtype backup = (ch == KEY_BACKSPACE) ? '\b' : ch;
+ chtype backup = (chtype) ((ch == KEY_BACKSPACE) ? '\b' : ch);
if (backup < KEY_MIN)
wechochar(win, backup);
}
@@ -539,7 +612,7 @@ NCURSES_EXPORT(int)
wgetch_events(WINDOW *win, _nc_eventlist * evl)
{
int code;
- unsigned long value;
+ int value;
T((T_CALLED("wgetch_events(%p,%p)"), win, evl));
code = _nc_wgetch(win,
@@ -556,9 +629,9 @@ NCURSES_EXPORT(int)
wgetch(WINDOW *win)
{
int code;
- unsigned long value;
+ int value;
- T((T_CALLED("wgetch(%p)"), win));
+ T((T_CALLED("wgetch(%p)"), (void *) win));
code = _nc_wgetch(win,
&value,
_nc_use_meta(win)
@@ -632,7 +705,7 @@ kgetch(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
break;
}
TR(TRACE_IEVENT, ("ptr=%p, ch=%d, value=%d",
- ptr, ptr->ch, ptr->value));
+ (void *) ptr, ptr->ch, ptr->value));
if (ptr->value != 0) { /* sequence terminated */
TR(TRACE_IEVENT, ("end of sequence"));
@@ -651,7 +724,7 @@ kgetch(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
TR(TRACE_IEVENT, ("waiting for rest of sequence"));
rc = check_mouse_activity(sp, timeleft EVENTLIST_2nd(evl));
#ifdef NCURSES_WGETCH_EVENTS
- if (rc & 4) {
+ if (rc & TW_EVENT) {
TR(TRACE_IEVENT, ("interrupted by a user event"));
/* FIXME Should have preserved remainder timeleft for reuse... */
peek = head; /* Restart interpreting later */
diff --git a/contrib/ncurses/ncurses/base/lib_getstr.c b/contrib/ncurses/ncurses/base/lib_getstr.c
index b17df03d2a41..21d8baa05c8b 100644
--- a/contrib/ncurses/ncurses/base/lib_getstr.c
+++ b/contrib/ncurses/ncurses/base/lib_getstr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 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,9 +39,8 @@
*/
#include <curses.priv.h>
-#include <term.h>
-MODULE_ID("$Id: lib_getstr.c,v 1.27 2008/08/16 19:20:04 tom Exp $")
+MODULE_ID("$Id: lib_getstr.c,v 1.29 2009/10/24 21:59:02 tom Exp $")
/*
* This wipes out the last character, no matter whether it was a tab, control
@@ -84,24 +83,24 @@ wgetnstr_events(WINDOW *win,
int ch;
int y, x;
- T((T_CALLED("wgetnstr(%p,%p, %d)"), win, str, maxlen));
+ T((T_CALLED("wgetnstr(%p,%p,%d)"), (void *) win, (void *) str, maxlen));
if (!win)
returnCode(ERR);
- _nc_get_tty_mode(&buf);
+ NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_ARGx &buf);
oldnl = sp->_nl;
oldecho = sp->_echo;
oldraw = sp->_raw;
oldcbreak = sp->_cbreak;
- nl();
- noecho();
- noraw();
- cbreak();
+ NCURSES_SP_NAME(nl) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(noecho) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(noraw) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(cbreak) (NCURSES_SP_ARG);
- erasec = erasechar();
- killc = killchar();
+ erasec = NCURSES_SP_NAME(erasechar) (NCURSES_SP_ARG);
+ killc = NCURSES_SP_NAME(killchar) (NCURSES_SP_ARG);
oldstr = str;
getyx(win, y, x);
@@ -144,7 +143,7 @@ wgetnstr_events(WINDOW *win,
}
} else if (ch >= KEY_MIN
|| (maxlen >= 0 && str - oldstr >= maxlen)) {
- beep();
+ NCURSES_SP_NAME(beep) (NCURSES_SP_ARG);
} else {
*str++ = (char) ch;
if (oldecho == TRUE) {
@@ -193,7 +192,7 @@ wgetnstr_events(WINDOW *win,
sp->_raw = oldraw;
sp->_cbreak = oldcbreak;
- _nc_set_tty_mode(&buf);
+ NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf);
*str = '\0';
if (ch == ERR)
diff --git a/contrib/ncurses/ncurses/base/lib_hline.c b/contrib/ncurses/ncurses/base/lib_hline.c
index 2ef2cc585e10..1f0380830ddc 100644
--- a/contrib/ncurses/ncurses/base/lib_hline.c
+++ b/contrib/ncurses/ncurses/base/lib_hline.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2001,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -40,16 +40,16 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_hline.c,v 1.11 2006/03/11 21:52:27 tom Exp $")
+MODULE_ID("$Id: lib_hline.c,v 1.13 2010/12/19 01:48:39 tom Exp $")
NCURSES_EXPORT(int)
whline(WINDOW *win, chtype ch, int n)
{
int code = ERR;
- NCURSES_SIZE_T start;
- NCURSES_SIZE_T end;
+ int start;
+ int end;
- T((T_CALLED("whline(%p,%s,%d)"), win, _tracechtype(ch), n));
+ T((T_CALLED("whline(%p,%s,%d)"), (void *) win, _tracechtype(ch), n));
if (win) {
struct ldat *line = &(win->_line[win->_cury]);
diff --git a/contrib/ncurses/ncurses/base/lib_immedok.c b/contrib/ncurses/ncurses/base/lib_immedok.c
index 87988b66f1a3..d51b60a30857 100644
--- a/contrib/ncurses/ncurses/base/lib_immedok.c
+++ b/contrib/ncurses/ncurses/base/lib_immedok.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000,2009 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,12 +40,12 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_immedok.c,v 1.4 2000/12/10 02:43:27 tom Exp $")
+MODULE_ID("$Id: lib_immedok.c,v 1.5 2009/10/24 22:32:11 tom Exp $")
NCURSES_EXPORT(void)
immedok(WINDOW *win, bool flag)
{
- T((T_CALLED("immedok(%p,%d)"), win, flag));
+ T((T_CALLED("immedok(%p,%d)"), (void *) win, flag));
if (win)
win->_immed = flag;
diff --git a/contrib/ncurses/ncurses/base/lib_inchstr.c b/contrib/ncurses/ncurses/base/lib_inchstr.c
index 6ff01687826e..aebb6d625d5c 100644
--- a/contrib/ncurses/ncurses/base/lib_inchstr.c
+++ b/contrib/ncurses/ncurses/base/lib_inchstr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -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 *
****************************************************************************/
/*
@@ -40,14 +41,14 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_inchstr.c,v 1.10 2001/06/02 23:37:58 skimo Exp $")
+MODULE_ID("$Id: lib_inchstr.c,v 1.12 2010/12/20 01:37:41 tom Exp $")
NCURSES_EXPORT(int)
-winchnstr(WINDOW *win, chtype * str, int n)
+winchnstr(WINDOW *win, chtype *str, int n)
{
int i = 0;
- T((T_CALLED("winchnstr(%p,%p,%d)"), win, str, n));
+ T((T_CALLED("winchnstr(%p,%p,%d)"), (void *) win, (void *) str, n));
if (!str)
returnCode(0);
@@ -55,7 +56,7 @@ winchnstr(WINDOW *win, chtype * str, int n)
if (win) {
for (; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++)
str[i] =
- CharOf(win->_line[win->_cury].text[win->_curx + i]) |
+ (chtype) CharOf(win->_line[win->_cury].text[win->_curx + i]) |
AttrOf(win->_line[win->_cury].text[win->_curx + i]);
}
str[i] = (chtype) 0;
diff --git a/contrib/ncurses/ncurses/base/lib_initscr.c b/contrib/ncurses/ncurses/base/lib_initscr.c
index b2fef0c1d085..334682fab71d 100644
--- a/contrib/ncurses/ncurses/base/lib_initscr.c
+++ b/contrib/ncurses/ncurses/base/lib_initscr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -45,7 +45,7 @@
#include <sys/termio.h> /* needed for ISC */
#endif
-MODULE_ID("$Id: lib_initscr.c,v 1.38 2008/08/16 21:20:48 Werner.Fink Exp $")
+MODULE_ID("$Id: lib_initscr.c,v 1.39 2009/02/14 20:55:49 tom Exp $")
NCURSES_EXPORT(WINDOW *)
initscr(void)
@@ -90,7 +90,11 @@ initscr(void)
}
/* def_shell_mode - done in newterm/_nc_setupscreen */
+#if NCURSES_SP_FUNCS
+ NCURSES_SP_NAME(def_prog_mode) (CURRENT_SCREEN);
+#else
def_prog_mode();
+#endif
}
result = stdscr;
_nc_unlock_global(curses);
diff --git a/contrib/ncurses/ncurses/base/lib_insch.c b/contrib/ncurses/ncurses/base/lib_insch.c
index 9166ea5240e7..e21ec02bc84f 100644
--- a/contrib/ncurses/ncurses/base/lib_insch.c
+++ b/contrib/ncurses/ncurses/base/lib_insch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 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,24 +43,31 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_insch.c,v 1.25 2008/02/03 00:14:37 tom Exp $")
+MODULE_ID("$Id: lib_insch.c,v 1.32 2009/10/24 22:04:35 tom Exp $")
/*
* Insert the given character, updating the current location to simplify
* inserting a string.
*/
NCURSES_EXPORT(int)
-_nc_insert_ch(WINDOW *win, chtype ch)
+_nc_insert_ch(SCREEN *sp, WINDOW *win, chtype ch)
{
int code = OK;
NCURSES_CH_T wch;
int count;
NCURSES_CONST char *s;
+ int tabsize = (
+#if USE_REENTRANT
+ sp->_TABSIZE
+#else
+ TABSIZE
+#endif
+ );
switch (ch) {
case '\t':
- for (count = (TABSIZE - (win->_curx % TABSIZE)); count > 0; count--) {
- if ((code = _nc_insert_ch(win, ' ')) != OK)
+ for (count = (tabsize - (win->_curx % tabsize)); count > 0; count--) {
+ if ((code = _nc_insert_ch(sp, win, ' ')) != OK)
break;
}
break;
@@ -76,7 +83,9 @@ _nc_insert_ch(WINDOW *win, chtype ch)
WINDOW_EXT(win, addch_used) == 0 &&
#endif
is8bits(ChCharOf(ch)) &&
- isprint(ChCharOf(ch))) {
+ (isprint(ChCharOf(ch)) ||
+ (ChAttrOf(ch) & A_ALTCHARSET) ||
+ (sp != 0 && sp->_legacy_coding && !iscntrl(ChCharOf(ch))))) {
if (win->_curx <= win->_maxx) {
struct ldat *line = &(win->_line[win->_cury]);
NCURSES_CH_T *end = &(line->text[win->_curx]);
@@ -93,9 +102,9 @@ _nc_insert_ch(WINDOW *win, chtype ch)
win->_curx++;
}
} else if (is8bits(ChCharOf(ch)) && iscntrl(ChCharOf(ch))) {
- s = unctrl(ChCharOf(ch));
+ s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx ChCharOf(ch));
while (*s != '\0') {
- code = _nc_insert_ch(win, ChAttrOf(ch) | UChar(*s));
+ code = _nc_insert_ch(sp, win, ChAttrOf(ch) | UChar(*s));
if (code != OK)
break;
++s;
@@ -110,16 +119,21 @@ _nc_insert_ch(WINDOW *win, chtype ch)
wch = _nc_render(win, wch);
count = _nc_build_wch(win, &wch);
if (count > 0) {
- code = wins_wch(win, &wch);
+ code = _nc_insert_wch(win, &wch);
} else if (count == -1) {
/* handle EILSEQ */
if (is8bits(ch)) {
- s = unctrl(ChCharOf(ch));
- while (*s != '\0') {
- code = _nc_insert_ch(win, ChAttrOf(ch) | UChar(*s));
- if (code != OK)
- break;
- ++s;
+ s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx ChCharOf(ch));
+ if (strlen(s) > 1) {
+ while (*s != '\0') {
+ code = _nc_insert_ch(sp, win,
+ ChAttrOf(ch) | UChar(*s));
+ if (code != OK)
+ break;
+ ++s;
+ }
+ } else {
+ code = ERR;
}
} else {
code = ERR;
@@ -139,13 +153,13 @@ winsch(WINDOW *win, chtype c)
NCURSES_SIZE_T ox;
int code = ERR;
- T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(c)));
+ T((T_CALLED("winsch(%p, %s)"), (void *) win, _tracechtype(c)));
if (win != 0) {
oy = win->_cury;
ox = win->_curx;
- code = _nc_insert_ch(win, c);
+ code = _nc_insert_ch(_nc_screen_of(win), win, c);
win->_curx = ox;
win->_cury = oy;
diff --git a/contrib/ncurses/ncurses/base/lib_insdel.c b/contrib/ncurses/ncurses/base/lib_insdel.c
index 342c6541f95f..8f51bbed4844 100644
--- a/contrib/ncurses/ncurses/base/lib_insdel.c
+++ b/contrib/ncurses/ncurses/base/lib_insdel.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2001,2003 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -42,14 +42,14 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_insdel.c,v 1.12 2003/07/26 22:40:06 tom Exp $")
+MODULE_ID("$Id: lib_insdel.c,v 1.13 2009/10/24 22:34:41 tom Exp $")
NCURSES_EXPORT(int)
winsdelln(WINDOW *win, int n)
{
int code = ERR;
- T((T_CALLED("winsdelln(%p,%d)"), win, n));
+ T((T_CALLED("winsdelln(%p,%d)"), (void *) win, n));
if (win) {
if (n != 0) {
diff --git a/contrib/ncurses/ncurses/base/lib_insnstr.c b/contrib/ncurses/ncurses/base/lib_insnstr.c
index b6ddfde3c52b..ce03e64be002 100644
--- a/contrib/ncurses/ncurses/base/lib_insnstr.c
+++ b/contrib/ncurses/ncurses/base/lib_insnstr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2004 Free Software Foundation, Inc. *
+ * Copyright (c) 2004,2009 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_insnstr.c,v 1.1 2004/02/28 23:44:56 tom Exp $")
+MODULE_ID("$Id: lib_insnstr.c,v 1.3 2009/10/24 22:04:35 tom Exp $")
NCURSES_EXPORT(int)
winsnstr(WINDOW *win, const char *s, int n)
@@ -51,13 +51,15 @@ winsnstr(WINDOW *win, const char *s, int n)
const unsigned char *str = (const unsigned char *) s;
const unsigned char *cp;
- T((T_CALLED("winsnstr(%p,%s,%d)"), win, _nc_visbufn(s, n), n));
+ T((T_CALLED("winsnstr(%p,%s,%d)"), (void *) win, _nc_visbufn(s, n), n));
if (win != 0 && str != 0) {
+ SCREEN *sp = _nc_screen_of(win);
+
oy = win->_cury;
ox = win->_curx;
for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) {
- _nc_insert_ch(win, (chtype) UChar(*cp));
+ _nc_insert_ch(sp, win, (chtype) UChar(*cp));
}
win->_curx = ox;
win->_cury = oy;
diff --git a/contrib/ncurses/ncurses/base/lib_instr.c b/contrib/ncurses/ncurses/base/lib_instr.c
index 3fb29490ad06..e6d1a739c94f 100644
--- a/contrib/ncurses/ncurses/base/lib_instr.c
+++ b/contrib/ncurses/ncurses/base/lib_instr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2009 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,14 +41,14 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_instr.c,v 1.16 2007/07/21 20:18:10 tom Exp $")
+MODULE_ID("$Id: lib_instr.c,v 1.17 2009/10/24 22:55:45 tom Exp $")
NCURSES_EXPORT(int)
winnstr(WINDOW *win, char *str, int n)
{
int i = 0, row, col;
- T((T_CALLED("winnstr(%p,%p,%d)"), win, str, n));
+ T((T_CALLED("winnstr(%p,%p,%d)"), (void *) win, str, n));
if (!str)
returnCode(0);
@@ -79,18 +79,18 @@ winnstr(WINDOW *win, char *str, int n)
init_mb(state);
n3 = wcstombs(0, wch, 0);
- if (isEILSEQ(n3) || (n3 == 0)) {
- ;
- } else if ((int) (n3 + i) > n) {
- done = TRUE;
- } else if ((tmp = typeCalloc(char, n3 + 10)) == 0) {
- done = TRUE;
- } else {
- init_mb(state);
- wcstombs(tmp, wch, n3);
- for (i3 = 0; i3 < n3; ++i3)
- str[i++] = tmp[i3];
- free(tmp);
+ if (!isEILSEQ(n3) && (n3 != 0)) {
+ if (((int) n3 + i) > n) {
+ done = TRUE;
+ } else if ((tmp = typeCalloc(char, n3 + 10)) == 0) {
+ done = TRUE;
+ } else {
+ init_mb(state);
+ wcstombs(tmp, wch, n3);
+ for (i3 = 0; i3 < n3; ++i3)
+ str[i++] = tmp[i3];
+ free(tmp);
+ }
}
}
free(wch);
diff --git a/contrib/ncurses/ncurses/base/lib_isendwin.c b/contrib/ncurses/ncurses/base/lib_isendwin.c
index b337d97a94c3..923e35bf122f 100644
--- a/contrib/ncurses/ncurses/base/lib_isendwin.c
+++ b/contrib/ncurses/ncurses/base/lib_isendwin.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,6 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -40,12 +42,20 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_isendwin.c,v 1.6 2000/12/10 02:43:27 tom Exp $")
+MODULE_ID("$Id: lib_isendwin.c,v 1.7 2009/02/15 00:36:24 tom Exp $")
NCURSES_EXPORT(bool)
-isendwin(void)
+NCURSES_SP_NAME(isendwin) (NCURSES_SP_DCL0)
{
- if (SP == NULL)
+ if (SP_PARM == NULL)
return FALSE;
- return SP->_endwin;
+ return SP_PARM->_endwin;
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(bool)
+isendwin(void)
+{
+ return NCURSES_SP_NAME(isendwin) (CURRENT_SCREEN);
}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_leaveok.c b/contrib/ncurses/ncurses/base/lib_leaveok.c
index 17d095d0f8c8..e6995f85cb4d 100644
--- a/contrib/ncurses/ncurses/base/lib_leaveok.c
+++ b/contrib/ncurses/ncurses/base/lib_leaveok.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000,2009 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,12 +40,12 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_leaveok.c,v 1.5 2000/12/10 02:43:27 tom Exp $")
+MODULE_ID("$Id: lib_leaveok.c,v 1.6 2009/10/24 22:34:23 tom Exp $")
NCURSES_EXPORT(int)
leaveok(WINDOW *win, bool flag)
{
- T((T_CALLED("leaveok(%p,%d)"), win, flag));
+ T((T_CALLED("leaveok(%p,%d)"), (void *) win, flag));
if (win) {
win->_leaveok = flag;
diff --git a/contrib/ncurses/ncurses/base/lib_mouse.c b/contrib/ncurses/ncurses/base/lib_mouse.c
index 95f29aa69111..dac039551165 100644
--- a/contrib/ncurses/ncurses/base/lib_mouse.c
+++ b/contrib/ncurses/ncurses/base/lib_mouse.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 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 *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2008 *
****************************************************************************/
/*
@@ -79,9 +80,12 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_mouse.c,v 1.102 2008/10/18 21:48:55 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_mouse.c,v 1.121 2011/01/22 19:47:47 tom Exp $")
-#include <term.h>
#include <tic.h>
#if USE_GPM_SUPPORT
@@ -118,12 +122,12 @@ make an error
#define MY_TRACE TRACE_ICALLS|TRACE_IEVENT
-#define MASK_RELEASE(x) NCURSES_MOUSE_MASK(x, 001)
-#define MASK_PRESS(x) NCURSES_MOUSE_MASK(x, 002)
-#define MASK_CLICK(x) NCURSES_MOUSE_MASK(x, 004)
-#define MASK_DOUBLE_CLICK(x) NCURSES_MOUSE_MASK(x, 010)
-#define MASK_TRIPLE_CLICK(x) NCURSES_MOUSE_MASK(x, 020)
-#define MASK_RESERVED_EVENT(x) NCURSES_MOUSE_MASK(x, 040)
+#define MASK_RELEASE(x) (mmask_t) NCURSES_MOUSE_MASK(x, 001)
+#define MASK_PRESS(x) (mmask_t) NCURSES_MOUSE_MASK(x, 002)
+#define MASK_CLICK(x) (mmask_t) NCURSES_MOUSE_MASK(x, 004)
+#define MASK_DOUBLE_CLICK(x) (mmask_t) NCURSES_MOUSE_MASK(x, 010)
+#define MASK_TRIPLE_CLICK(x) (mmask_t) NCURSES_MOUSE_MASK(x, 020)
+#define MASK_RESERVED_EVENT(x) (mmask_t) NCURSES_MOUSE_MASK(x, 040)
#if NCURSES_MOUSE_VERSION == 1
#define BUTTON_CLICKED (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED | BUTTON4_CLICKED)
@@ -150,7 +154,7 @@ make an error
#define LIBGPM_SONAME "libgpm.so"
#endif
-#define GET_DLSYM(name) (my_##name = (TYPE_##name) dlsym(SP->_dlopen_gpm, #name))
+#define GET_DLSYM(name) (my_##name = (TYPE_##name) dlsym(sp->_dlopen_gpm, #name))
#endif /* USE_GPM_SUPPORT */
@@ -164,13 +168,13 @@ static void _nc_mouse_wrap(SCREEN *);
#define LastEV(sp) ((sp)->_mouse_events + EV_MAX - 1)
#undef NEXT
-#define NEXT(ep) ((ep >= LastEV(sp)) \
- ? FirstEV(sp) \
+#define NEXT(ep) ((ep >= LastEV(SP_PARM)) \
+ ? FirstEV(SP_PARM) \
: ep + 1)
#undef PREV
-#define PREV(ep) ((ep <= FirstEV(sp)) \
- ? LastEV(sp) \
+#define PREV(ep) ((ep <= FirstEV(SP_PARM)) \
+ ? LastEV(SP_PARM) \
: ep - 1)
#define IndexEV(sp, ep) (ep - FirstEV(sp))
@@ -185,7 +189,7 @@ _trace_slot(SCREEN *sp, const char *tag)
{
MEVENT *ep;
- _tracef(tag);
+ _tracef("%s", tag);
for (ep = FirstEV(sp); ep <= LastEV(sp); ep++)
_tracef("mouse event queue slot %ld = %s",
@@ -340,10 +344,13 @@ sysmouse_server(SCREEN *sp)
static void
handle_sysmouse(int sig GCC_UNUSED)
{
- sysmouse_server(SP);
+ sysmouse_server(CURRENT_SCREEN);
}
#endif /* USE_SYSMOUSE */
+#ifndef USE_TERM_DRIVER
+#define xterm_kmous "\033[M"
+
static void
init_xterm_mouse(SCREEN *sp)
{
@@ -352,6 +359,7 @@ init_xterm_mouse(SCREEN *sp)
if (!VALID_STRING(sp->_mouse_xtermcap))
sp->_mouse_xtermcap = "\033[?1000%?%p1%{1}%=%th%el%;";
}
+#endif
static void
enable_xterm_mouse(SCREEN *sp, int enable)
@@ -359,7 +367,9 @@ enable_xterm_mouse(SCREEN *sp, int enable)
#if USE_EMX_MOUSE
sp->_emxmouse_activated = enable;
#else
- putp(TPARM_1(sp->_mouse_xtermcap, enable));
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+ "xterm-mouse",
+ TPARM_1(sp->_mouse_xtermcap, enable));
#endif
sp->_mouse_active = enable;
}
@@ -398,7 +408,7 @@ allow_gpm_mouse(void)
static void
unload_gpm_library(SCREEN *sp)
{
- if (SP->_dlopen_gpm != 0) {
+ if (sp->_dlopen_gpm != 0) {
T(("unload GPM library"));
sp->_mouse_gpm_loaded = FALSE;
sp->_mouse_fd = -1;
@@ -440,6 +450,8 @@ enable_gpm_mouse(SCREEN *sp, bool enable)
}
#endif
if (sp->_mouse_gpm_loaded) {
+ int code;
+
/* GPM: initialize connection to gpm server */
sp->_mouse_gpm_connect.eventMask = GPM_DOWN | GPM_UP;
sp->_mouse_gpm_connect.defaultMask =
@@ -454,7 +466,16 @@ enable_gpm_mouse(SCREEN *sp, bool enable)
* The former is recognized by wscons (SunOS), and the latter by
* xterm. Those will not show up in ncurses' traces.
*/
- result = (my_Gpm_Open(&sp->_mouse_gpm_connect, 0) >= 0);
+ code = my_Gpm_Open(&sp->_mouse_gpm_connect, 0);
+ result = (code >= 0);
+
+ /*
+ * GPM can return a -2 if it is trying to do something with xterm.
+ * Ignore that, since it conflicts with our use of stdin.
+ */
+ if (code == -2) {
+ my_Gpm_Close();
+ }
} else {
result = FALSE;
}
@@ -478,8 +499,6 @@ enable_gpm_mouse(SCREEN *sp, bool enable)
}
#endif /* USE_GPM_SUPPORT */
-#define xterm_kmous "\033[M"
-
static void
initialize_mousetype(SCREEN *sp)
{
@@ -514,7 +533,7 @@ initialize_mousetype(SCREEN *sp)
/* OS/2 VIO */
#if USE_EMX_MOUSE
if (!sp->_emxmouse_thread
- && strstr(cur_term->type.term_names, "xterm") == 0
+ && strstr(TerminalOf(sp)->type.term_names, "xterm") == 0
&& key_mouse) {
int handles[2];
@@ -621,16 +640,21 @@ initialize_mousetype(SCREEN *sp)
}
#endif /* USE_SYSMOUSE */
+#ifdef USE_TERM_DRIVER
+ CallDriver(sp, initmouse);
+#else
/* we know how to recognize mouse events under "xterm" */
if (key_mouse != 0) {
if (!strcmp(key_mouse, xterm_kmous)
- || strstr(cur_term->type.term_names, "xterm") != 0) {
+ || strstr(TerminalOf(sp)->type.term_names, "xterm") != 0) {
init_xterm_mouse(sp);
}
- } else if (strstr(cur_term->type.term_names, "xterm") != 0) {
+ } else if (strstr(TerminalOf(sp)->type.term_names, "xterm") != 0) {
if (_nc_add_to_try(&(sp->_keytry), xterm_kmous, KEY_MOUSE) == OK)
init_xterm_mouse(sp);
}
+#endif
+
returnVoid;
}
@@ -665,7 +689,7 @@ _nc_mouse_init(SCREEN *sp)
* fifo_push() in lib_getch.c
*/
static bool
-_nc_mouse_event(SCREEN *sp GCC_UNUSED)
+_nc_mouse_event(SCREEN *sp)
{
MEVENT *eventp = sp->_mouse_eventp;
bool result = FALSE;
@@ -694,11 +718,16 @@ _nc_mouse_event(SCREEN *sp GCC_UNUSED)
#if USE_GPM_SUPPORT
case M_GPM:
- {
+ if (sp->_mouse_fd >= 0) {
/* query server for event, return TRUE if we find one */
Gpm_Event ev;
- if (my_Gpm_GetEvent(&ev) == 1) {
+ switch (my_Gpm_GetEvent(&ev)) {
+ case 0:
+ /* Connection closed, drop the mouse. */
+ sp->_mouse_fd = -1;
+ break;
+ case 1:
/* there's only one mouse... */
eventp->id = NORMAL_EVENT;
@@ -729,8 +758,9 @@ _nc_mouse_event(SCREEN *sp GCC_UNUSED)
eventp->z = 0;
/* bump the next-free pointer into the circular list */
- sp->_mouse_eventp = eventp = NEXT(eventp);
+ sp->_mouse_eventp = NEXT(eventp);
result = TRUE;
+ break;
}
}
break;
@@ -759,6 +789,28 @@ _nc_mouse_event(SCREEN *sp GCC_UNUSED)
break;
#endif /* USE_SYSMOUSE */
+#ifdef USE_TERM_DRIVER
+ case M_TERM_DRIVER:
+ while (sp->_drv_mouse_head < sp->_drv_mouse_tail) {
+ *eventp = sp->_drv_mouse_fifo[sp->_drv_mouse_head];
+
+ /*
+ * Point the fifo-head to the next possible location. If there
+ * are none, reset the indices.
+ */
+ sp->_drv_mouse_head += 1;
+ if (sp->_drv_mouse_head == sp->_drv_mouse_tail) {
+ sp->_drv_mouse_tail = 0;
+ sp->_drv_mouse_head = 0;
+ }
+
+ /* bump the next-free pointer into the circular list */
+ sp->_mouse_eventp = eventp = NEXT(eventp);
+ result = TRUE;
+ }
+ break;
+#endif
+
case M_NONE:
break;
}
@@ -814,17 +866,26 @@ _nc_mouse_inline(SCREEN *sp)
* Wheel mice may return buttons 4 and 5 when the wheel is turned.
* We encode those as button presses.
*/
+# if USE_PTHREADS_EINTR
+# if USE_WEAK_SYMBOLS
+ if ((pthread_self) && (pthread_kill) && (pthread_equal))
+# endif
+ _nc_globals.read_thread = pthread_self();
+# endif
for (grabbed = 0; grabbed < 3; grabbed += (size_t) res) {
/* For VIO mouse we add extra bit 64 to disambiguate button-up. */
#if USE_EMX_MOUSE
- res = read(M_FD(sp) >= 0 ? M_FD(sp) : sp->_ifd, &kbuf, 3);
+ res = (int) read(M_FD(sp) >= 0 ? M_FD(sp) : sp->_ifd, &kbuf, 3);
#else
- res = read(sp->_ifd, kbuf + grabbed, 3 - grabbed);
+ res = (int) read(sp->_ifd, kbuf + grabbed, 3 - grabbed);
#endif
if (res == -1)
break;
}
+#if USE_PTHREADS_EINTR
+ _nc_globals.read_thread = 0;
+#endif
kbuf[3] = '\0';
TR(TRACE_IEVENT,
@@ -937,7 +998,7 @@ mouse_activate(SCREEN *sp, bool on)
switch (sp->_mouse_type) {
case M_XTERM:
#if NCURSES_EXT_FUNCS
- keyok(KEY_MOUSE, on);
+ NCURSES_SP_NAME(keyok) (NCURSES_SP_ARGx KEY_MOUSE, on);
#endif
TPUTS_TRACE("xterm mouse initialization");
enable_xterm_mouse(sp, 1);
@@ -956,6 +1017,11 @@ mouse_activate(SCREEN *sp, bool on)
sp->_mouse_active = TRUE;
break;
#endif
+#ifdef USE_TERM_DRIVER
+ case M_TERM_DRIVER:
+ sp->_mouse_active = TRUE;
+ break;
+#endif
case M_NONE:
return;
}
@@ -985,11 +1051,16 @@ mouse_activate(SCREEN *sp, bool on)
sp->_mouse_active = FALSE;
break;
#endif
+#ifdef USE_TERM_DRIVER
+ case M_TERM_DRIVER:
+ sp->_mouse_active = FALSE;
+ break;
+#endif
case M_NONE:
return;
}
}
- _nc_flush();
+ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
}
/**************************************************************************
@@ -1222,6 +1293,11 @@ _nc_mouse_wrap(SCREEN *sp)
mouse_activate(sp, FALSE);
break;
#endif
+#ifdef USE_TERM_DRIVER
+ case M_TERM_DRIVER:
+ mouse_activate(sp, FALSE);
+ break;
+#endif
case M_NONE:
break;
}
@@ -1253,6 +1329,13 @@ _nc_mouse_resume(SCREEN *sp)
mouse_activate(sp, TRUE);
break;
#endif
+
+#ifdef USE_TERM_DRIVER
+ case M_TERM_DRIVER:
+ mouse_activate(sp, TRUE);
+ break;
+#endif
+
case M_NONE:
break;
}
@@ -1264,80 +1347,92 @@ _nc_mouse_resume(SCREEN *sp)
*
**************************************************************************/
-static int
-_nc_getmouse(SCREEN *sp, MEVENT * aevent)
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(getmouse) (NCURSES_SP_DCLx MEVENT * aevent)
{
- T((T_CALLED("getmouse(%p)"), aevent));
+ int result = ERR;
- if ((aevent != 0) && (sp != 0) && (sp->_mouse_type != M_NONE)) {
- MEVENT *eventp = sp->_mouse_eventp;
+ T((T_CALLED("getmouse(%p,%p)"), (void *) SP_PARM, (void *) aevent));
+
+ if ((aevent != 0) && (SP_PARM != 0) && (SP_PARM->_mouse_type != M_NONE)) {
+ MEVENT *eventp = SP_PARM->_mouse_eventp;
/* compute the current-event pointer */
MEVENT *prev = PREV(eventp);
- /* copy the event we find there */
- *aevent = *prev;
+ if (prev->id != INVALID_EVENT) {
+ /* copy the event we find there */
+ *aevent = *prev;
- TR(TRACE_IEVENT, ("getmouse: returning event %s from slot %ld",
- _nc_tracemouse(sp, prev),
- (long) IndexEV(sp, prev)));
+ TR(TRACE_IEVENT, ("getmouse: returning event %s from slot %ld",
+ _nc_tracemouse(SP_PARM, prev),
+ (long) IndexEV(SP_PARM, prev)));
- prev->id = INVALID_EVENT; /* so the queue slot becomes free */
- returnCode(OK);
+ prev->id = INVALID_EVENT; /* so the queue slot becomes free */
+ SP_PARM->_mouse_eventp = PREV(prev);
+ result = OK;
+ }
}
- returnCode(ERR);
+ returnCode(result);
}
+#if NCURSES_SP_FUNCS
/* grab a copy of the current mouse event */
NCURSES_EXPORT(int)
getmouse(MEVENT * aevent)
{
- return _nc_getmouse(SP, aevent);
+ return NCURSES_SP_NAME(getmouse) (CURRENT_SCREEN, aevent);
}
+#endif
-static int
-_nc_ungetmouse(SCREEN *sp, MEVENT * aevent)
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(ungetmouse) (NCURSES_SP_DCLx MEVENT * aevent)
{
int result = ERR;
- T((T_CALLED("ungetmouse(%p)"), aevent));
+ T((T_CALLED("ungetmouse(%p,%p)"), (void *) SP_PARM, (void *) aevent));
- if (aevent != 0 && sp != 0) {
- MEVENT *eventp = sp->_mouse_eventp;
+ if (aevent != 0 && SP_PARM != 0) {
+ MEVENT *eventp = SP_PARM->_mouse_eventp;
/* stick the given event in the next-free slot */
*eventp = *aevent;
/* bump the next-free pointer into the circular list */
- sp->_mouse_eventp = NEXT(eventp);
+ SP_PARM->_mouse_eventp = NEXT(eventp);
/* push back the notification event on the keyboard queue */
- result = _nc_ungetch(sp, KEY_MOUSE);
+ result = NCURSES_SP_NAME(ungetch) (NCURSES_SP_ARGx KEY_MOUSE);
}
returnCode(result);
}
+#if NCURSES_SP_FUNCS
/* enqueue a synthesized mouse event to be seen by the next wgetch() */
NCURSES_EXPORT(int)
ungetmouse(MEVENT * aevent)
{
- return _nc_ungetmouse(SP, aevent);
+ return NCURSES_SP_NAME(ungetmouse) (CURRENT_SCREEN, aevent);
}
+#endif
NCURSES_EXPORT(mmask_t)
-mousemask(mmask_t newmask, mmask_t * oldmask)
+NCURSES_SP_NAME(mousemask) (NCURSES_SP_DCLx mmask_t newmask, mmask_t * oldmask)
/* set the mouse event mask */
{
mmask_t result = 0;
- T((T_CALLED("mousemask(%#lx,%p)"), (unsigned long) newmask, oldmask));
+ T((T_CALLED("mousemask(%p,%#lx,%p)"),
+ (void *) SP_PARM,
+ (unsigned long) newmask,
+ (void *) oldmask));
- if (SP != 0) {
+ if (SP_PARM != 0) {
if (oldmask)
- *oldmask = SP->_mouse_mask;
+ *oldmask = SP_PARM->_mouse_mask;
- if (newmask || SP->_mouse_initialized) {
- _nc_mouse_init(SP);
- if (SP->_mouse_type != M_NONE) {
+ if (newmask || SP_PARM->_mouse_initialized) {
+ _nc_mouse_init(SP_PARM);
+ if (SP_PARM->_mouse_type != M_NONE) {
result = newmask &
(REPORT_MOUSE_POSITION
| BUTTON_ALT
@@ -1349,14 +1444,22 @@ mousemask(mmask_t newmask, mmask_t * oldmask)
| BUTTON_DOUBLE_CLICKED
| BUTTON_TRIPLE_CLICKED);
- mouse_activate(SP, (bool) (result != 0));
+ mouse_activate(SP_PARM, (bool) (result != 0));
- SP->_mouse_mask = result;
+ SP_PARM->_mouse_mask = result;
}
}
}
- returnBits(result);
+ returnMMask(result);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(mmask_t)
+mousemask(mmask_t newmask, mmask_t * oldmask)
+{
+ return NCURSES_SP_NAME(mousemask) (CURRENT_SCREEN, newmask, oldmask);
}
+#endif
NCURSES_EXPORT(bool)
wenclose(const WINDOW *win, int y, int x)
@@ -1364,7 +1467,7 @@ wenclose(const WINDOW *win, int y, int x)
{
bool result = FALSE;
- T((T_CALLED("wenclose(%p,%d,%d)"), win, y, x));
+ T((T_CALLED("wenclose(%p,%d,%d)"), (const void *) win, y, x));
if (win != 0) {
y -= win->_yoffset;
@@ -1377,17 +1480,17 @@ wenclose(const WINDOW *win, int y, int x)
}
NCURSES_EXPORT(int)
-mouseinterval(int maxclick)
+NCURSES_SP_NAME(mouseinterval) (NCURSES_SP_DCLx int maxclick)
/* set the maximum mouse interval within which to recognize a click */
{
int oldval;
- T((T_CALLED("mouseinterval(%d)"), maxclick));
+ T((T_CALLED("mouseinterval(%p,%d)"), (void *) SP_PARM, maxclick));
- if (SP != 0) {
- oldval = SP->_maxclick;
+ if (SP_PARM != 0) {
+ oldval = SP_PARM->_maxclick;
if (maxclick >= 0)
- SP->_maxclick = maxclick;
+ SP_PARM->_maxclick = maxclick;
} else {
oldval = DEFAULT_MAXCLICK;
}
@@ -1395,20 +1498,46 @@ mouseinterval(int maxclick)
returnCode(oldval);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+mouseinterval(int maxclick)
+{
+ return NCURSES_SP_NAME(mouseinterval) (CURRENT_SCREEN, maxclick);
+}
+#endif
+
/* This may be used by other routines to ask for the existence of mouse
support */
-NCURSES_EXPORT(int)
-_nc_has_mouse(void)
+NCURSES_EXPORT(bool)
+_nc_has_mouse(SCREEN *sp)
+{
+ return (((0 == sp) || (sp->_mouse_type == M_NONE)) ? FALSE : TRUE);
+}
+
+NCURSES_EXPORT(bool)
+NCURSES_SP_NAME(has_mouse) (NCURSES_SP_DCL0)
{
- return (SP->_mouse_type == M_NONE ? 0 : 1);
+ return _nc_has_mouse(SP_PARM);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(bool)
+has_mouse(void)
+{
+ return _nc_has_mouse(CURRENT_SCREEN);
+}
+#endif
+
NCURSES_EXPORT(bool)
wmouse_trafo(const WINDOW *win, int *pY, int *pX, bool to_screen)
{
bool result = FALSE;
- T((T_CALLED("wmouse_trafo(%p,%p,%p,%d)"), win, pY, pX, to_screen));
+ T((T_CALLED("wmouse_trafo(%p,%p,%p,%d)"),
+ (const void *) win,
+ (void *) pY,
+ (void *) pX,
+ to_screen));
if (win && pY && pX) {
int y = *pY;
diff --git a/contrib/ncurses/ncurses/base/lib_move.c b/contrib/ncurses/ncurses/base/lib_move.c
index 652c44d7b718..488b195d15a3 100644
--- a/contrib/ncurses/ncurses/base/lib_move.c
+++ b/contrib/ncurses/ncurses/base/lib_move.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2000,2004 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,2009 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,12 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_move.c,v 1.12 2004/12/04 21:50:07 tom Exp $")
+MODULE_ID("$Id: lib_move.c,v 1.13 2009/10/24 22:34:07 tom Exp $")
NCURSES_EXPORT(int)
wmove(WINDOW *win, int y, int x)
{
- T((T_CALLED("wmove(%p,%d,%d)"), win, y, x));
+ T((T_CALLED("wmove(%p,%d,%d)"), (void *) win, y, x));
if (LEGALYX(win, y, x)) {
win->_curx = (NCURSES_SIZE_T) x;
diff --git a/contrib/ncurses/ncurses/base/lib_mvwin.c b/contrib/ncurses/ncurses/base/lib_mvwin.c
index e4dad4a746f0..18d31c13319b 100644
--- a/contrib/ncurses/ncurses/base/lib_mvwin.c
+++ b/contrib/ncurses/ncurses/base/lib_mvwin.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2001,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,6 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer *
****************************************************************************/
/*
@@ -40,12 +42,16 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_mvwin.c,v 1.14 2006/02/25 22:53:46 tom Exp $")
+MODULE_ID("$Id: lib_mvwin.c,v 1.18 2010/12/19 01:22:58 tom Exp $")
NCURSES_EXPORT(int)
mvwin(WINDOW *win, int by, int bx)
{
- T((T_CALLED("mvwin(%p,%d,%d)"), win, by, bx));
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = _nc_screen_of(win);
+#endif
+
+ T((T_CALLED("mvwin(%p,%d,%d)"), (void *) win, by, bx));
if (!win || (win->_flags & _ISPAD))
returnCode(ERR);
@@ -96,8 +102,8 @@ mvwin(WINDOW *win, int by, int bx)
}
#endif
- if (by + win->_maxy > screen_lines - 1
- || bx + win->_maxx > screen_columns - 1
+ if (by + win->_maxy > screen_lines(SP_PARM) - 1
+ || bx + win->_maxx > screen_columns(SP_PARM) - 1
|| by < 0
|| bx < 0)
returnCode(ERR);
@@ -108,7 +114,7 @@ mvwin(WINDOW *win, int by, int bx)
* new location. This ensures that if the caller has refreshed another
* window at the same location, that this one will be displayed.
*/
- win->_begy = by;
- win->_begx = bx;
+ win->_begy = (NCURSES_SIZE_T) by;
+ win->_begx = (NCURSES_SIZE_T) bx;
returnCode(touchwin(win));
}
diff --git a/contrib/ncurses/ncurses/base/lib_newterm.c b/contrib/ncurses/ncurses/base/lib_newterm.c
index 05982b84cee4..e12208b7d02d 100644
--- a/contrib/ncurses/ncurses/base/lib_newterm.c
+++ b/contrib/ncurses/ncurses/base/lib_newterm.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -45,10 +46,19 @@
#define _POSIX_SOURCE
#endif
-#include <term.h> /* clear_screen, cup & friends, cur_term */
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
#include <tic.h>
-MODULE_ID("$Id: lib_newterm.c,v 1.73 2008/08/16 21:20:48 Werner.Fink Exp $")
+MODULE_ID("$Id: lib_newterm.c,v 1.86 2010/05/20 23:25:18 tom Exp $")
+
+#ifdef USE_TERM_DRIVER
+#define NumLabels InfoOf(SP_PARM).numlabels
+#else
+#define NumLabels num_labels
+#endif
#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */
#define ONLCR 0
@@ -63,27 +73,29 @@ MODULE_ID("$Id: lib_newterm.c,v 1.73 2008/08/16 21:20:48 Werner.Fink Exp $")
* is supposed to behave as if it calls newterm, we do it here.
*/
static NCURSES_INLINE int
-_nc_initscr(void)
+_nc_initscr(NCURSES_SP_DCL0)
{
int result = ERR;
+ TERMINAL *term = TerminalOf(SP_PARM);
/* for extended XPG4 conformance requires cbreak() at this point */
/* (SVr4 curses does this anyway) */
- if (cbreak() == OK) {
+ if (NCURSES_SP_NAME(cbreak) (NCURSES_SP_ARG) == OK) {
TTY buf;
- buf = cur_term->Nttyb;
+ buf = term->Nttyb;
#ifdef TERMIOS
- buf.c_lflag &= ~(ECHO | ECHONL);
- buf.c_iflag &= ~(ICRNL | INLCR | IGNCR);
- buf.c_oflag &= ~(ONLCR);
+ buf.c_lflag &= (unsigned) ~(ECHO | ECHONL);
+ buf.c_iflag &= (unsigned) ~(ICRNL | INLCR | IGNCR);
+ buf.c_oflag &= (unsigned) ~(ONLCR);
#elif HAVE_SGTTY_H
buf.sg_flags &= ~(ECHO | CRMOD);
#else
memset(&buf, 0, sizeof(buf));
#endif
- if ((result = _nc_set_tty_mode(&buf)) == OK)
- cur_term->Nttyb = buf;
+ result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf);
+ if (result == OK)
+ term->Nttyb = buf;
}
return result;
}
@@ -95,13 +107,30 @@ _nc_initscr(void)
* initialized.
*/
NCURSES_EXPORT(void)
+NCURSES_SP_NAME(filter) (NCURSES_SP_DCL0)
+{
+ START_TRACE();
+ T((T_CALLED("filter(%p)"), (void *) SP_PARM));
+#if NCURSES_SP_FUNCS
+ if (IsPreScreen(SP_PARM)) {
+ SP_PARM->_filtered = TRUE;
+ }
+#else
+ _nc_prescreen.filter_mode = TRUE;
+#endif
+ returnVoid;
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
filter(void)
{
START_TRACE();
- T((T_CALLED("filter")));
+ T((T_CALLED("filter()")));
_nc_prescreen.filter_mode = TRUE;
returnVoid;
}
+#endif
#if NCURSES_EXT_FUNCS
/*
@@ -109,62 +138,125 @@ filter(void)
* requiring it to also be filtered.
*/
NCURSES_EXPORT(void)
+NCURSES_SP_NAME(nofilter) (NCURSES_SP_DCL0)
+{
+ START_TRACE();
+ T((T_CALLED("nofilter(%p)"), (void *) SP_PARM));
+#if NCURSES_SP_FUNCS
+ if (IsPreScreen(SP_PARM)) {
+ SP_PARM->_filtered = FALSE;
+ }
+#else
+ _nc_prescreen.filter_mode = FALSE;
+#endif
+ returnVoid;
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
nofilter(void)
{
START_TRACE();
- T((T_CALLED("nofilter")));
+ T((T_CALLED("nofilter()")));
_nc_prescreen.filter_mode = FALSE;
returnVoid;
}
#endif
+#endif /* NCURSES_EXT_FUNCS */
NCURSES_EXPORT(SCREEN *)
-newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
+NCURSES_SP_NAME(newterm) (NCURSES_SP_DCLx
+ NCURSES_CONST char *name,
+ FILE *ofp,
+ FILE *ifp)
{
int value;
int errret;
- SCREEN *current;
SCREEN *result = 0;
+ SCREEN *current;
TERMINAL *its_term;
+ FILE *_ofp = ofp ? ofp : stdout;
+ FILE *_ifp = ifp ? ifp : stdin;
+ int cols;
+ int slk_format;
+ int filter_mode;
+ TERMINAL *new_term = 0;
START_TRACE();
- T((T_CALLED("newterm(\"%s\",%p,%p)"), name, ofp, ifp));
+ T((T_CALLED("newterm(%p, \"%s\", %p,%p)"),
+ (void *) SP_PARM,
+ name,
+ (void *) ofp,
+ (void *) ifp));
+
+#if NCURSES_SP_FUNCS
+ assert(SP_PARM != 0);
+ if (SP_PARM == 0)
+ returnSP(SP_PARM);
+#endif
_nc_init_pthreads();
_nc_lock_global(curses);
- current = SP;
- its_term = (SP ? SP->_term : 0);
+ current = CURRENT_SCREEN;
+ its_term = (current ? current->_term : 0);
+ INIT_TERM_DRIVER();
/* this loads the capability entry, then sets LINES and COLS */
- if (setupterm(name, fileno(ofp), &errret) != ERR) {
- int slk_format = _nc_globals.slk_format;
+ if (
+#if NCURSES_SP_FUNCS
+ SP_PARM->_prescreen &&
+#endif
+ TINFO_SETUP_TERM(&new_term, name,
+ fileno(_ofp), &errret, FALSE) != ERR) {
+
+ _nc_set_screen(0);
+#ifdef USE_TERM_DRIVER
+ assert(new_term != 0);
+#endif
+
+#if NCURSES_SP_FUNCS
+ slk_format = SP_PARM->slk_format;
+ filter_mode = SP_PARM->_filtered;
+#else
+ slk_format = _nc_globals.slk_format;
+ filter_mode = _nc_prescreen.filter_mode;
+#endif
/*
* This actually allocates the screen structure, and saves the original
* terminal settings.
*/
- _nc_set_screen(0);
-
- /* allow user to set maximum escape delay from the environment */
- if ((value = _nc_getenv_num("ESCDELAY")) >= 0) {
- set_escdelay(value);
- }
-
- if (_nc_setupscreen(LINES,
- COLS,
- ofp,
- _nc_prescreen.filter_mode,
- slk_format) == ERR) {
+ if (NCURSES_SP_NAME(_nc_setupscreen) (
+#if NCURSES_SP_FUNCS
+ &SP_PARM,
+#endif
+ *(ptrLines(SP_PARM)),
+ *(ptrCols(SP_PARM)),
+ _ofp,
+ filter_mode,
+ slk_format) == ERR) {
_nc_set_screen(current);
result = 0;
} else {
- assert(SP != 0);
+#ifdef USE_TERM_DRIVER
+ TERMINAL_CONTROL_BLOCK *TCB;
+#elif !NCURSES_SP_FUNCS
+ _nc_set_screen(CURRENT_SCREEN);
+#endif
+ assert(SP_PARM != 0);
+ cols = *(ptrCols(SP_PARM));
+#ifdef USE_TERM_DRIVER
+ _nc_set_screen(SP_PARM);
+ TCB = (TERMINAL_CONTROL_BLOCK *) new_term;
+ TCB->csp = SP_PARM;
+#endif
/*
* In setupterm() we did a set_curterm(), but it was before we set
- * SP. So the "current" screen's terminal pointer was overwritten
- * with a different terminal. Later, in _nc_setupscreen(), we set
- * SP and the terminal pointer in the new screen.
+ * CURRENT_SCREEN. So the "current" screen's terminal pointer was
+ * overwritten with a different terminal. Later, in
+ * _nc_setupscreen(), we set CURRENT_SCREEN and the terminal
+ * pointer in the new screen.
*
* Restore the terminal-pointer for the pre-existing screen, if
* any.
@@ -172,37 +264,53 @@ newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
if (current)
current->_term = its_term;
+#ifdef USE_TERM_DRIVER
+ SP_PARM->_term = new_term;
+#else
+ new_term = SP_PARM->_term;
+#endif
+
+ /* allow user to set maximum escape delay from the environment */
+ if ((value = _nc_getenv_num("ESCDELAY")) >= 0) {
+ NCURSES_SP_NAME(set_escdelay) (NCURSES_SP_ARGx value);
+ }
+
/* if the terminal type has real soft labels, set those up */
- if (slk_format && num_labels > 0 && SLK_STDFMT(slk_format))
- _nc_slk_initialize(stdscr, COLS);
+ if (slk_format && NumLabels > 0 && SLK_STDFMT(slk_format))
+ _nc_slk_initialize(StdScreen(SP_PARM), cols);
- SP->_ifd = fileno(ifp);
- typeahead(fileno(ifp));
+ SP_PARM->_ifd = fileno(_ifp);
+ NCURSES_SP_NAME(typeahead) (NCURSES_SP_ARGx fileno(_ifp));
#ifdef TERMIOS
- SP->_use_meta = ((cur_term->Ottyb.c_cflag & CSIZE) == CS8 &&
- !(cur_term->Ottyb.c_iflag & ISTRIP));
+ SP_PARM->_use_meta = ((new_term->Ottyb.c_cflag & CSIZE) == CS8 &&
+ !(new_term->Ottyb.c_iflag & ISTRIP));
#else
- SP->_use_meta = FALSE;
+ SP_PARM->_use_meta = FALSE;
#endif
- SP->_endwin = FALSE;
-
+ SP_PARM->_endwin = FALSE;
+#ifndef USE_TERM_DRIVER
/*
* Check whether we can optimize scrolling under dumb terminals in
* case we do not have any of these capabilities, scrolling
* optimization will be useless.
*/
- SP->_scrolling = ((scroll_forward && scroll_reverse) ||
- ((parm_rindex ||
- parm_insert_line ||
- insert_line) &&
- (parm_index ||
- parm_delete_line ||
- delete_line)));
+ SP_PARM->_scrolling = ((scroll_forward && scroll_reverse) ||
+ ((parm_rindex ||
+ parm_insert_line ||
+ insert_line) &&
+ (parm_index ||
+ parm_delete_line ||
+ delete_line)));
+#endif
- baudrate(); /* sets a field in the SP structure */
+ NCURSES_SP_NAME(baudrate) (NCURSES_SP_ARG); /* sets a field in the screen structure */
- SP->_keytry = 0;
+ SP_PARM->_keytry = 0;
+ /* compute movement costs so we can do better move optimization */
+#ifdef USE_TERM_DRIVER
+ TCBOf(SP_PARM)->drv->scinit(SP_PARM);
+#else
/*
* Check for mismatched graphic-rendition capabilities. Most SVr4
* terminfo trees contain entries that have rmul or rmso equated to
@@ -213,23 +321,31 @@ newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
* shouldn't be looking at this detail.
*/
#define SGR0_TEST(mode) (mode != 0) && (exit_attribute_mode == 0 || strcmp(mode, exit_attribute_mode))
- SP->_use_rmso = SGR0_TEST(exit_standout_mode);
- SP->_use_rmul = SGR0_TEST(exit_underline_mode);
+ SP_PARM->_use_rmso = SGR0_TEST(exit_standout_mode);
+ SP_PARM->_use_rmul = SGR0_TEST(exit_underline_mode);
/* compute movement costs so we can do better move optimization */
_nc_mvcur_init();
/* initialize terminal to a sane state */
_nc_screen_init();
+#endif
/* Initialize the terminal line settings. */
- _nc_initscr();
+ _nc_initscr(NCURSES_SP_ARG);
_nc_signal_handler(TRUE);
-
- result = SP;
+ result = SP_PARM;
}
}
_nc_unlock_global(curses);
returnSP(result);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(SCREEN *)
+newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
+{
+ return NCURSES_SP_NAME(newterm) (CURRENT_SCREEN_PRE, name, ofp, ifp);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_newwin.c b/contrib/ncurses/ncurses/base/lib_newwin.c
index 587e83a92009..72d8af84b703 100644
--- a/contrib/ncurses/ncurses/base/lib_newwin.c
+++ b/contrib/ncurses/ncurses/base/lib_newwin.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 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 *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -42,7 +43,7 @@
#include <curses.priv.h>
#include <stddef.h>
-MODULE_ID("$Id: lib_newwin.c,v 1.52 2008/06/07 13:58:09 tom Exp $")
+MODULE_ID("$Id: lib_newwin.c,v 1.69 2011/03/07 21:58:17 tom Exp $")
#define window_is(name) ((sp)->_##name == win)
@@ -61,6 +62,17 @@ remove_window_from_screen(WINDOW *win)
{
SCREEN *sp;
+#ifdef USE_SP_WINDOWLIST
+ if ((sp = _nc_screen_of(win)) != 0) {
+ if (window_is(curscr)) {
+ remove_window(curscr);
+ } else if (window_is(stdscr)) {
+ remove_window(stdscr);
+ } else if (window_is(newscr)) {
+ remove_window(newscr);
+ }
+ }
+#else
for (each_screen(sp)) {
if (window_is(curscr)) {
remove_window(curscr);
@@ -73,6 +85,7 @@ remove_window_from_screen(WINDOW *win)
break;
}
}
+#endif
}
NCURSES_EXPORT(int)
@@ -81,17 +94,20 @@ _nc_freewin(WINDOW *win)
WINDOWLIST *p, *q;
int i;
int result = ERR;
+#ifdef USE_SP_WINDOWLIST
+ SCREEN *sp = _nc_screen_of(win); /* pretend this is parameter */
+#endif
- T((T_CALLED("_nc_freewin(%p)"), win));
+ T((T_CALLED("_nc_freewin(%p)"), (void *) win));
if (win != 0) {
- if (_nc_try_global(curses) == 0) {
+ if (_nc_nonsp_try_global(curses) == 0) {
q = 0;
- for (each_window(p)) {
+ for (each_window(SP_PARM, p)) {
if (&(p->win) == win) {
remove_window_from_screen(win);
if (q == 0)
- _nc_windows = p->next;
+ WindowList(SP_PARM) = p->next;
else
q->next = p->next;
@@ -103,35 +119,39 @@ _nc_freewin(WINDOW *win)
free(p);
result = OK;
- T(("...deleted win=%p", win));
+ T(("...deleted win=%p", (void *) win));
break;
}
q = p;
}
- _nc_unlock_global(curses);
+ _nc_nonsp_unlock_global(curses);
}
}
returnCode(result);
}
NCURSES_EXPORT(WINDOW *)
-newwin(int num_lines, int num_columns, int begy, int begx)
+NCURSES_SP_NAME(newwin) (NCURSES_SP_DCLx
+ int num_lines, int num_columns, int begy, int begx)
{
WINDOW *win;
NCURSES_CH_T *ptr;
int i;
- T((T_CALLED("newwin(%d,%d,%d,%d)"), num_lines, num_columns, begy, begx));
+ T((T_CALLED("newwin(%p, %d,%d,%d,%d)"), (void *) SP_PARM, num_lines, num_columns,
+ begy, begx));
if (begy < 0 || begx < 0 || num_lines < 0 || num_columns < 0)
returnWin(0);
if (num_lines == 0)
- num_lines = SP->_lines_avail - begy;
+ num_lines = SP_PARM->_lines_avail - begy;
if (num_columns == 0)
- num_columns = screen_columns - begx;
+ num_columns = screen_columns(SP_PARM) - begx;
- if ((win = _nc_makenew(num_lines, num_columns, begy, begx, 0)) == 0)
+ win = NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_ARGx
+ num_lines, num_columns, begy, begx, 0);
+ if (win == 0)
returnWin(0);
for (i = 0; i < num_lines; i++) {
@@ -149,14 +169,30 @@ newwin(int num_lines, int num_columns, int begy, int begx)
returnWin(win);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(WINDOW *)
+newwin(int num_lines, int num_columns, int begy, int begx)
+{
+ WINDOW *win;
+ _nc_sp_lock_global(curses);
+ win = NCURSES_SP_NAME(newwin) (CURRENT_SCREEN,
+ num_lines, num_columns, begy, begx);
+ _nc_sp_unlock_global(curses);
+ return (win);
+}
+#endif
+
NCURSES_EXPORT(WINDOW *)
derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx)
{
WINDOW *win;
int i;
int flags = _SUBWIN;
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = _nc_screen_of(orig);
+#endif
- T((T_CALLED("derwin(%p,%d,%d,%d,%d)"), orig, num_lines, num_columns,
+ T((T_CALLED("derwin(%p,%d,%d,%d,%d)"), (void *) orig, num_lines, num_columns,
begy, begx));
/*
@@ -177,8 +213,10 @@ derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx)
if (orig->_flags & _ISPAD)
flags |= _ISPAD;
- if ((win = _nc_makenew(num_lines, num_columns, orig->_begy + begy,
- orig->_begx + begx, flags)) == 0)
+ win = NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_ARGx num_lines, num_columns,
+ orig->_begy + begy,
+ orig->_begx + begx, flags);
+ if (win == 0)
returnWin(0);
win->_pary = begy;
@@ -197,7 +235,7 @@ derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx)
NCURSES_EXPORT(WINDOW *)
subwin(WINDOW *w, int l, int c, int y, int x)
{
- T((T_CALLED("subwin(%p, %d, %d, %d, %d)"), w, l, c, y, x));
+ T((T_CALLED("subwin(%p, %d, %d, %d, %d)"), (void *) w, l, c, y, x));
T(("parent has begy = %ld, begx = %ld", (long) w->_begy, (long) w->_begx));
returnWin(derwin(w, l, c, y - w->_begy, x - w->_begx));
@@ -206,21 +244,27 @@ subwin(WINDOW *w, int l, int c, int y, int x)
static bool
dimension_limit(int value)
{
- NCURSES_SIZE_T test = value;
+ NCURSES_SIZE_T test = (NCURSES_SIZE_T) value;
return (test == value && value > 0);
}
NCURSES_EXPORT(WINDOW *)
-_nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags)
+NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_DCLx
+ int num_lines,
+ int num_columns,
+ int begy,
+ int begx,
+ int flags)
{
int i;
WINDOWLIST *wp;
WINDOW *win;
- bool is_pad = (flags & _ISPAD);
+ bool is_padwin = (flags & _ISPAD);
- T((T_CALLED("_nc_makenew(%d,%d,%d,%d)"), num_lines, num_columns, begy, begx));
+ T((T_CALLED("_nc_makenew(%p,%d,%d,%d,%d)"),
+ (void *) SP_PARM, num_lines, num_columns, begy, begx));
- if (SP == 0)
+ if (SP_PARM == 0)
returnWin(0);
if (!dimension_limit(num_lines) || !dimension_limit(num_columns))
@@ -232,26 +276,28 @@ _nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags)
win = &(wp->win);
if ((win->_line = typeCalloc(struct ldat, ((unsigned) num_lines))) == 0) {
- free(win);
+ free(wp);
returnWin(0);
}
- _nc_lock_global(curses);
+ _nc_nonsp_lock_global(curses);
win->_curx = 0;
win->_cury = 0;
- win->_maxy = num_lines - 1;
- win->_maxx = num_columns - 1;
- win->_begy = begy;
- win->_begx = begx;
- win->_yoffset = SP->_topstolen;
+ win->_maxy = (NCURSES_SIZE_T) (num_lines - 1);
+ win->_maxx = (NCURSES_SIZE_T) (num_columns - 1);
+ win->_begy = (NCURSES_SIZE_T) begy;
+ win->_begx = (NCURSES_SIZE_T) begx;
+ win->_yoffset = SP_PARM->_topstolen;
- win->_flags = flags;
+ win->_flags = (short) flags;
WINDOW_ATTRS(win) = A_NORMAL;
SetChar(win->_nc_bkgd, BLANK_TEXT, BLANK_ATTR);
- win->_clear = is_pad ? FALSE : (num_lines == screen_lines
- && num_columns == screen_columns);
+ win->_clear = (is_padwin
+ ? FALSE
+ : (num_lines == screen_lines(SP_PARM)
+ && num_columns == screen_columns(SP_PARM)));
win->_idlok = FALSE;
win->_idcok = TRUE;
win->_scroll = FALSE;
@@ -265,7 +311,7 @@ _nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags)
win->_parent = 0;
win->_regtop = 0;
- win->_regbottom = num_lines - 1;
+ win->_regbottom = (NCURSES_SIZE_T) (num_lines - 1);
win->_pad._pad_y = -1;
win->_pad._pad_x = -1;
@@ -295,28 +341,28 @@ _nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags)
* So that's how we want ncurses to behave.
*/
win->_line[i].firstchar = 0;
- win->_line[i].lastchar = num_columns - 1;
+ win->_line[i].lastchar = (NCURSES_SIZE_T) (num_columns - 1);
if_USE_SCROLL_HINTS(win->_line[i].oldindex = i);
}
- if (!is_pad && (begx + num_columns == screen_columns)) {
+ if (!is_padwin && (begx + num_columns == screen_columns(SP_PARM))) {
win->_flags |= _ENDLINE;
- if (begx == 0 && num_lines == screen_lines && begy == 0)
+ if (begx == 0 && num_lines == screen_lines(SP_PARM) && begy == 0)
win->_flags |= _FULLWIN;
- if (begy + num_lines == screen_lines)
+ if (begy + num_lines == screen_lines(SP_PARM))
win->_flags |= _SCROLLWIN;
}
- wp->next = _nc_windows;
- wp->screen = SP;
- _nc_windows = wp;
+ wp->next = WindowList(SP_PARM);
+ wp->screen = SP_PARM;
+ WindowList(SP_PARM) = wp;
- T((T_CREATE("window %p"), win));
+ T((T_CREATE("window %p"), (void *) win));
- _nc_unlock_global(curses);
+ _nc_nonsp_unlock_global(curses);
returnWin(win);
}
@@ -325,14 +371,22 @@ _nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags)
* internally, and it is useful to allow those to be invoked without switching
* SCREEN's, e.g., for multi-threaded applications.
*/
-NCURSES_EXPORT(SCREEN *)
-_nc_screen_of(WINDOW *win)
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(WINDOW *)
+_nc_curscr_of(SCREEN *sp)
{
- SCREEN *sp = 0;
+ return sp == 0 ? 0 : CurScreen(sp);
+}
- if (win != 0) {
- WINDOWLIST *wp = (WINDOWLIST *) win;
- sp = wp->screen;
- }
- return (sp);
+NCURSES_EXPORT(WINDOW *)
+_nc_newscr_of(SCREEN *sp)
+{
+ return sp == 0 ? 0 : NewScreen(sp);
+}
+
+NCURSES_EXPORT(WINDOW *)
+_nc_stdscr_of(SCREEN *sp)
+{
+ return sp == 0 ? 0 : StdScreen(sp);
}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_nl.c b/contrib/ncurses/ncurses/base/lib_nl.c
index 32515da0be81..34254871c985 100644
--- a/contrib/ncurses/ncurses/base/lib_nl.c
+++ b/contrib/ncurses/ncurses/base/lib_nl.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,6 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -42,38 +44,52 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_nl.c,v 1.8 2000/12/10 02:43:27 tom Exp $")
+MODULE_ID("$Id: lib_nl.c,v 1.12 2009/10/24 22:05:55 tom Exp $")
#ifdef __EMX__
#include <io.h>
#endif
NCURSES_EXPORT(int)
-nl(void)
+NCURSES_SP_NAME(nl) (NCURSES_SP_DCL0)
{
- T((T_CALLED("nl()")));
-
- SP->_nl = TRUE;
-
+ T((T_CALLED("nl(%p)"), (void *) SP_PARM));
+ if (0 == SP_PARM)
+ returnCode(ERR);
+ SP_PARM->_nl = TRUE;
#ifdef __EMX__
_nc_flush();
- _fsetmode(NC_OUTPUT, "t");
+ _fsetmode(NC_OUTPUT(SP_PARM), "t");
#endif
-
returnCode(OK);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-nonl(void)
+nl(void)
{
- T((T_CALLED("nonl()")));
-
- SP->_nl = FALSE;
+ return NCURSES_SP_NAME(nl) (CURRENT_SCREEN);
+}
+#endif
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(nonl) (NCURSES_SP_DCL0)
+{
+ T((T_CALLED("nonl(%p)"), (void *) SP_PARM));
+ if (0 == SP_PARM)
+ returnCode(ERR);
+ SP_PARM->_nl = FALSE;
#ifdef __EMX__
_nc_flush();
- _fsetmode(NC_OUTPUT, "b");
+ _fsetmode(NC_OUTPUT(SP_PARM), "b");
#endif
-
returnCode(OK);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+nonl(void)
+{
+ return NCURSES_SP_NAME(nonl) (CURRENT_SCREEN);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_overlay.c b/contrib/ncurses/ncurses/base/lib_overlay.c
index 669e8e72c07f..bfb817bc3108 100644
--- a/contrib/ncurses/ncurses/base/lib_overlay.c
+++ b/contrib/ncurses/ncurses/base/lib_overlay.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 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.27 2008/06/07 23:30:34 tom Exp $")
+MODULE_ID("$Id: lib_overlay.c,v 1.29 2009/10/24 23:21:31 tom Exp $")
static int
overlap(const WINDOW *const src, WINDOW *const dst, int const flag)
@@ -52,7 +52,7 @@ overlap(const WINDOW *const src, WINDOW *const dst, int const flag)
int dminrow, dmincol;
int dmaxrow, dmaxcol;
- T((T_CALLED("overlap(%p,%p,%d)"), src, dst, flag));
+ T((T_CALLED("overlap(%p,%p,%d)"), (const void *) src, (void *) dst, flag));
if (src != 0 && dst != 0) {
_nc_lock_global(curses);
@@ -110,7 +110,7 @@ overlap(const WINDOW *const src, WINDOW *const dst, int const flag)
NCURSES_EXPORT(int)
overlay(const WINDOW *win1, WINDOW *win2)
{
- T((T_CALLED("overlay(%p,%p)"), win1, win2));
+ T((T_CALLED("overlay(%p,%p)"), (const void *) win1, (void *) win2));
returnCode(overlap(win1, win2, TRUE));
}
@@ -127,7 +127,7 @@ overlay(const WINDOW *win1, WINDOW *win2)
NCURSES_EXPORT(int)
overwrite(const WINDOW *win1, WINDOW *win2)
{
- T((T_CALLED("overwrite(%p,%p)"), win1, win2));
+ T((T_CALLED("overwrite(%p,%p)"), (const void *) win1, (void *) win2));
returnCode(overlap(win1, win2, FALSE));
}
@@ -145,7 +145,11 @@ copywin(const WINDOW *src, WINDOW *dst,
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));
+ (const void *) src,
+ (void *) dst,
+ sminrow, smincol,
+ dminrow, dmincol,
+ dmaxrow, dmaxcol, over));
if (src && dst) {
_nc_lock_global(curses);
diff --git a/contrib/ncurses/ncurses/base/lib_pad.c b/contrib/ncurses/ncurses/base/lib_pad.c
index 6cad9c54b064..b87498b500cd 100644
--- a/contrib/ncurses/ncurses/base/lib_pad.c
+++ b/contrib/ncurses/ncurses/base/lib_pad.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2004,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,6 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -40,21 +42,22 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_pad.c,v 1.41 2006/10/14 20:47:13 tom Exp $")
+MODULE_ID("$Id: lib_pad.c,v 1.46 2010/04/24 23:50:45 tom Exp $")
NCURSES_EXPORT(WINDOW *)
-newpad(int l, int c)
+NCURSES_SP_NAME(newpad) (NCURSES_SP_DCLx int l, int c)
{
WINDOW *win;
NCURSES_CH_T *ptr;
int i;
- T((T_CALLED("newpad(%d, %d)"), l, c));
+ T((T_CALLED("newpad(%p,%d, %d)"), (void *) SP_PARM, l, c));
if (l <= 0 || c <= 0)
returnWin(0);
- if ((win = _nc_makenew(l, c, 0, 0, _ISPAD)) == NULL)
+ win = NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_ARGx l, c, 0, 0, _ISPAD);
+ if (win == NULL)
returnWin(0);
for (i = 0; i < l; i++) {
@@ -70,6 +73,14 @@ newpad(int l, int c)
returnWin(win);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(WINDOW *)
+newpad(int l, int c)
+{
+ return NCURSES_SP_NAME(newpad) (CURRENT_SCREEN, l, c);
+}
+#endif
+
NCURSES_EXPORT(WINDOW *)
subpad(WINDOW *orig, int l, int c, int begy, int begx)
{
@@ -94,10 +105,14 @@ prefresh(WINDOW *win,
int smaxrow,
int smaxcol)
{
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = _nc_screen_of(win);
+#endif
+
T((T_CALLED("prefresh()")));
if (pnoutrefresh(win, pminrow, pmincol, sminrow, smincol, smaxrow,
smaxcol) != ERR
- && doupdate() != ERR) {
+ && NCURSES_SP_NAME(doupdate) (NCURSES_SP_ARG) != ERR) {
returnCode(OK);
}
returnCode(ERR);
@@ -112,10 +127,11 @@ pnoutrefresh(WINDOW *win,
int smaxrow,
int smaxcol)
{
- NCURSES_SIZE_T i, j;
- NCURSES_SIZE_T m, n;
- NCURSES_SIZE_T pmaxrow;
- NCURSES_SIZE_T pmaxcol;
+ int i, j;
+ int m, n;
+ int pmaxrow;
+ int pmaxcol;
+ SCREEN *sp;
#if USE_SCROLL_HINTS
const int my_len = 2; /* parameterize the threshold for hardscroll */
@@ -124,7 +140,7 @@ pnoutrefresh(WINDOW *win,
#endif
T((T_CALLED("pnoutrefresh(%p, %d, %d, %d, %d, %d, %d)"),
- win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol));
+ (void *) win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol));
if (win == 0)
returnCode(ERR);
@@ -132,6 +148,8 @@ pnoutrefresh(WINDOW *win,
if (!(win->_flags & _ISPAD))
returnCode(ERR);
+ sp = _nc_screen_of(win);
+
/* negative values are interpreted as zero */
if (pminrow < 0)
pminrow = 0;
@@ -162,8 +180,8 @@ pnoutrefresh(WINDOW *win,
pmaxcol = pmincol + smaxcol - smincol;
}
- if (smaxrow >= screen_lines
- || smaxcol >= screen_columns
+ if (smaxrow >= screen_lines(sp)
+ || smaxcol >= screen_columns(sp)
|| sminrow > smaxrow
|| smincol > smaxcol)
returnCode(ERR);
@@ -194,13 +212,13 @@ pnoutrefresh(WINDOW *win,
* merely change the costs of various update cases.
*/
#if USE_SCROLL_HINTS
- wide = (smincol < my_len && smaxcol > (newscr->_maxx - my_len));
+ wide = (smincol < my_len && smaxcol > (NewScreen(sp)->_maxx - my_len));
#endif
for (i = pminrow, m = sminrow + win->_yoffset;
- i <= pmaxrow && m <= newscr->_maxy;
+ i <= pmaxrow && m <= NewScreen(sp)->_maxy;
i++, m++) {
- register struct ldat *nline = &newscr->_line[m];
+ register struct ldat *nline = &NewScreen(sp)->_line[m];
register struct ldat *oline = &win->_line[i];
for (j = pmincol, n = smincol; j <= pmaxcol; j++, n++) {
NCURSES_CH_T ch = oline->text[j];
@@ -229,9 +247,9 @@ pnoutrefresh(WINDOW *win,
|| nind > smaxrow) {
nind = _NEWINDEX;
} else if (displaced) {
- register struct ldat *pline = &curscr->_line[nind];
+ register struct ldat *pline = &CurScreen(sp)->_line[nind];
for (j = 0; j <= my_len; j++) {
- int k = newscr->_maxx - j;
+ int k = NewScreen(sp)->_maxx - j;
if (pline->text[j] != nline->text[j]
|| pline->text[k] != nline->text[k]) {
nind = _NEWINDEX;
@@ -261,12 +279,12 @@ pnoutrefresh(WINDOW *win,
win->_line[i].oldindex = _NEWINDEX;
#endif
- win->_begx = smincol;
- win->_begy = sminrow;
+ win->_begx = (NCURSES_SIZE_T) smincol;
+ win->_begy = (NCURSES_SIZE_T) sminrow;
if (win->_clear) {
win->_clear = FALSE;
- newscr->_clear = TRUE;
+ NewScreen(sp)->_clear = TRUE;
}
/*
@@ -278,10 +296,12 @@ pnoutrefresh(WINDOW *win,
&& win->_curx >= pmincol
&& win->_cury <= pmaxrow
&& win->_curx <= pmaxcol) {
- newscr->_cury = win->_cury - pminrow + win->_begy + win->_yoffset;
- newscr->_curx = win->_curx - pmincol + win->_begx;
+ NewScreen(sp)->_cury = (NCURSES_SIZE_T) (win->_cury - pminrow
+ + win->_begy + win->_yoffset);
+ NewScreen(sp)->_curx = (NCURSES_SIZE_T) (win->_curx - pmincol
+ + win->_begx);
}
- newscr->_leaveok = win->_leaveok;
+ NewScreen(sp)->_leaveok = win->_leaveok;
win->_flags &= ~_HASMOVED;
/*
@@ -289,12 +309,12 @@ pnoutrefresh(WINDOW *win,
* We will use this on subsequent calls to this function to derive
* values to stuff into 'oldindex[]' -- for scrolling optimization.
*/
- win->_pad._pad_y = pminrow;
- win->_pad._pad_x = pmincol;
- win->_pad._pad_top = sminrow;
- win->_pad._pad_left = smincol;
- win->_pad._pad_bottom = smaxrow;
- win->_pad._pad_right = smaxcol;
+ win->_pad._pad_y = (NCURSES_SIZE_T) pminrow;
+ win->_pad._pad_x = (NCURSES_SIZE_T) pmincol;
+ win->_pad._pad_top = (NCURSES_SIZE_T) sminrow;
+ win->_pad._pad_left = (NCURSES_SIZE_T) smincol;
+ win->_pad._pad_bottom = (NCURSES_SIZE_T) smaxrow;
+ win->_pad._pad_right = (NCURSES_SIZE_T) smaxcol;
returnCode(OK);
}
@@ -302,7 +322,7 @@ pnoutrefresh(WINDOW *win,
NCURSES_EXPORT(int)
pechochar(WINDOW *pad, const chtype ch)
{
- T((T_CALLED("pechochar(%p, %s)"), pad, _tracechtype(ch)));
+ T((T_CALLED("pechochar(%p, %s)"), (void *) pad, _tracechtype(ch)));
if (pad == 0)
returnCode(ERR);
diff --git a/contrib/ncurses/ncurses/base/lib_printw.c b/contrib/ncurses/ncurses/base/lib_printw.c
index 62ae921e650d..963181d9a494 100644
--- a/contrib/ncurses/ncurses/base/lib_printw.c
+++ b/contrib/ncurses/ncurses/base/lib_printw.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2009 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_printw.c,v 1.18 2006/12/17 19:21:39 tom Exp $")
+MODULE_ID("$Id: lib_printw.c,v 1.20 2009/10/24 22:07:03 tom Exp $")
NCURSES_EXPORT(int)
printw(const char *fmt,...)
@@ -70,7 +70,7 @@ wprintw(WINDOW *win, const char *fmt,...)
#ifdef TRACE
va_start(argp, fmt);
T((T_CALLED("wprintw(%p,%s%s)"),
- win, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
+ (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
va_end(argp);
#endif
@@ -111,7 +111,7 @@ mvwprintw(WINDOW *win, int y, int x, const char *fmt,...)
#ifdef TRACE
va_start(argp, fmt);
T((T_CALLED("mvwprintw(%d,%d,%p,%s%s)"),
- y, x, win, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
+ y, x, (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
va_end(argp);
#endif
@@ -128,10 +128,14 @@ vwprintw(WINDOW *win, const char *fmt, va_list argp)
{
char *buf;
int code = ERR;
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = _nc_screen_of(win);
+#endif
- T((T_CALLED("vwprintw(%p,%s,va_list)"), win, _nc_visbuf(fmt)));
+ T((T_CALLED("vwprintw(%p,%s,va_list)"), (void *) win, _nc_visbuf(fmt)));
- if ((buf = _nc_printf_string(fmt, argp)) != 0) {
+ buf = NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_ARGx fmt, argp);
+ if (buf != 0) {
code = waddstr(win, buf);
}
returnCode(code);
diff --git a/contrib/ncurses/ncurses/base/lib_redrawln.c b/contrib/ncurses/ncurses/base/lib_redrawln.c
index 6b0905f07d67..72905f84d656 100644
--- a/contrib/ncurses/ncurses/base/lib_redrawln.c
+++ b/contrib/ncurses/ncurses/base/lib_redrawln.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -39,7 +39,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_redrawln.c,v 1.12 2007/10/13 20:08:56 tom Exp $")
+MODULE_ID("$Id: lib_redrawln.c,v 1.17 2010/12/19 00:03:23 tom Exp $")
NCURSES_EXPORT(int)
wredrawln(WINDOW *win, int beg, int num)
@@ -47,37 +47,40 @@ wredrawln(WINDOW *win, int beg, int num)
int i;
int end;
size_t len;
+ SCREEN *sp;
- T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num));
+ T((T_CALLED("wredrawln(%p,%d,%d)"), (void *) win, beg, num));
if (win == 0)
returnCode(ERR);
+ sp = _nc_screen_of(win);
+
if (beg < 0)
beg = 0;
if (touchline(win, beg, num) == ERR)
returnCode(ERR);
- if (touchline(curscr, beg + win->_begy, num) == ERR)
+ if (touchline(CurScreen(sp), beg + win->_begy, num) == ERR)
returnCode(ERR);
end = beg + num;
- if (end > curscr->_maxy + 1)
- end = curscr->_maxy + 1;
+ if (end > CurScreen(sp)->_maxy + 1 - win->_begy)
+ end = CurScreen(sp)->_maxy + 1 - win->_begy;
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]);
+ len = (size_t) (win->_maxx + 1);
+ if (len > (size_t) (CurScreen(sp)->_maxx + 1 - win->_begx))
+ len = (size_t) (CurScreen(sp)->_maxx + 1 - win->_begx);
+ len *= sizeof(CurScreen(sp)->_line[0].text[0]);
for (i = beg; i < end; i++) {
int crow = i + win->_begy;
- memset(curscr->_line[crow].text + win->_begx, 0, len);
- _nc_make_oldhash(crow);
+ memset(CurScreen(sp)->_line[crow].text + win->_begx, 0, len);
+ NCURSES_SP_NAME(_nc_make_oldhash) (NCURSES_SP_ARGx crow);
}
returnCode(OK);
diff --git a/contrib/ncurses/ncurses/base/lib_refresh.c b/contrib/ncurses/ncurses/base/lib_refresh.c
index 2a9cafb7b0ad..8c02086a707d 100644
--- a/contrib/ncurses/ncurses/base/lib_refresh.c
+++ b/contrib/ncurses/ncurses/base/lib_refresh.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer *
****************************************************************************/
/*
@@ -41,24 +42,27 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_refresh.c,v 1.41 2007/09/29 20:39:34 tom Exp $")
+MODULE_ID("$Id: lib_refresh.c,v 1.44 2010/12/19 01:22:58 tom Exp $")
NCURSES_EXPORT(int)
wrefresh(WINDOW *win)
{
int code;
+#if NCURSES_SP_FUNCS
+ SCREEN *SP_PARM = _nc_screen_of(win);
+#endif
- T((T_CALLED("wrefresh(%p)"), win));
+ T((T_CALLED("wrefresh(%p)"), (void *) win));
if (win == 0) {
code = ERR;
- } else if (win == curscr) {
- curscr->_clear = TRUE;
- code = doupdate();
+ } else if (win == CurScreen(SP_PARM)) {
+ CurScreen(SP_PARM)->_clear = TRUE;
+ code = NCURSES_SP_NAME(doupdate) (NCURSES_SP_ARG);
} else if ((code = wnoutrefresh(win)) == OK) {
if (win->_clear)
- newscr->_clear = TRUE;
- code = doupdate();
+ NewScreen(SP_PARM)->_clear = TRUE;
+ code = NCURSES_SP_NAME(doupdate) (NCURSES_SP_ARG);
/*
* Reset the clearok() flag in case it was set for the special
* case in hardscroll.c (if we don't reset it here, we'll get 2
@@ -73,16 +77,19 @@ wrefresh(WINDOW *win)
NCURSES_EXPORT(int)
wnoutrefresh(WINDOW *win)
{
- NCURSES_SIZE_T limit_x;
- NCURSES_SIZE_T src_row, src_col;
- NCURSES_SIZE_T begx;
- NCURSES_SIZE_T begy;
- NCURSES_SIZE_T dst_row, dst_col;
+ int limit_x;
+ int src_row, src_col;
+ int begx;
+ int begy;
+ int dst_row, dst_col;
#if USE_SCROLL_HINTS
bool wide;
#endif
+#if NCURSES_SP_FUNCS
+ SCREEN *SP_PARM = _nc_screen_of(win);
+#endif
- T((T_CALLED("wnoutrefresh(%p)"), win));
+ T((T_CALLED("wnoutrefresh(%p)"), (void *) win));
#ifdef TRACE
if (USE_TRACEF(TRACE_UPDATE)) {
_tracedump("...win", win);
@@ -101,8 +108,8 @@ wnoutrefresh(WINDOW *win)
begx = win->_begx;
begy = win->_begy;
- newscr->_nc_bkgd = win->_nc_bkgd;
- WINDOW_ATTRS(newscr) = WINDOW_ATTRS(win);
+ NewScreen(SP_PARM)->_nc_bkgd = win->_nc_bkgd;
+ WINDOW_ATTRS(NewScreen(SP_PARM)) = WINDOW_ATTRS(win);
/* merge in change information from all subwindows of this window */
wsyncdown(win);
@@ -122,7 +129,7 @@ wnoutrefresh(WINDOW *win)
* windows). Note that changing this formula will not break any code,
* merely change the costs of various update cases.
*/
- wide = (begx <= 1 && win->_maxx >= (newscr->_maxx - 1));
+ wide = (begx <= 1 && win->_maxx >= (NewScreen(SP_PARM)->_maxx - 1));
#endif
win->_flags &= ~_HASMOVED;
@@ -137,14 +144,14 @@ wnoutrefresh(WINDOW *win)
/* limit(dst_col) */
limit_x = win->_maxx;
/* limit(src_col) */
- if (limit_x > newscr->_maxx - begx)
- limit_x = newscr->_maxx - begx;
+ if (limit_x > NewScreen(SP_PARM)->_maxx - begx)
+ limit_x = NewScreen(SP_PARM)->_maxx - begx;
for (src_row = 0, dst_row = begy + win->_yoffset;
- src_row <= win->_maxy && dst_row <= newscr->_maxy;
+ src_row <= win->_maxy && dst_row <= NewScreen(SP_PARM)->_maxy;
src_row++, dst_row++) {
- register struct ldat *nline = &newscr->_line[dst_row];
- register struct ldat *oline = &win->_line[src_row];
+ struct ldat *nline = &(NewScreen(SP_PARM)->_line[dst_row]);
+ struct ldat *oline = &win->_line[src_row];
if (oline->firstchar != _NOCHANGE) {
int last_src = oline->lastchar;
@@ -156,7 +163,7 @@ wnoutrefresh(WINDOW *win)
dst_col = src_col + begx;
if_WIDEC({
- register int j;
+ int j;
/*
* Ensure that we will copy complete multi-column characters
@@ -197,7 +204,7 @@ wnoutrefresh(WINDOW *win)
: win->_maxx);
int fix_left = dst_col;
int fix_right = last_dst;
- register int j;
+ int j;
/*
* Check for boundary cases where we may overwrite part of a
@@ -225,7 +232,8 @@ wnoutrefresh(WINDOW *win)
* this character. Find the end of the character.
*/
++j;
- while (j <= newscr->_maxx && isWidecExt(nline->text[j])) {
+ while (j <= NewScreen(SP_PARM)->_maxx &&
+ isWidecExt(nline->text[j])) {
fix_right = j++;
}
}
@@ -269,18 +277,19 @@ wnoutrefresh(WINDOW *win)
if (win->_clear) {
win->_clear = FALSE;
- newscr->_clear = TRUE;
+ NewScreen(SP_PARM)->_clear = TRUE;
}
if (!win->_leaveok) {
- newscr->_cury = win->_cury + win->_begy + win->_yoffset;
- newscr->_curx = win->_curx + win->_begx;
+ NewScreen(SP_PARM)->_cury = (NCURSES_SIZE_T) (win->_cury +
+ win->_begy + win->_yoffset);
+ NewScreen(SP_PARM)->_curx = (NCURSES_SIZE_T) (win->_curx + win->_begx);
}
- newscr->_leaveok = win->_leaveok;
+ NewScreen(SP_PARM)->_leaveok = win->_leaveok;
#ifdef TRACE
if (USE_TRACEF(TRACE_UPDATE)) {
- _tracedump("newscr", newscr);
+ _tracedump("newscr", NewScreen(SP_PARM));
_nc_unlock_global(tracef);
}
#endif /* TRACE */
diff --git a/contrib/ncurses/ncurses/base/lib_restart.c b/contrib/ncurses/ncurses/base/lib_restart.c
index da770d4e7c92..b28cfd1f2ffd 100644
--- a/contrib/ncurses/ncurses/base/lib_restart.c
+++ b/contrib/ncurses/ncurses/base/lib_restart.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 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 *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2008 *
****************************************************************************/
/*
@@ -44,49 +45,62 @@
#define _POSIX_SOURCE
#endif
-#include <term.h> /* lines, columns, cur_term */
-
-MODULE_ID("$Id: lib_restart.c,v 1.10 2008/06/21 17:31:22 tom Exp $")
+MODULE_ID("$Id: lib_restart.c,v 1.13 2009/10/24 22:47:43 tom Exp $")
NCURSES_EXPORT(int)
-restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
+NCURSES_SP_NAME(restartterm) (NCURSES_SP_DCLx
+ NCURSES_CONST char *termp,
+ int filenum,
+ int *errret)
{
int result;
+#ifdef USE_TERM_DRIVER
+ TERMINAL *new_term;
+#endif
- T((T_CALLED("restartterm(%s,%d,%p)"), termp, filenum, errret));
+ T((T_CALLED("restartterm(%p,%s,%d,%p)"),
+ (void *) SP_PARM,
+ termp,
+ filenum,
+ (void *) errret));
- if (setupterm(termp, filenum, errret) != OK) {
+ if (TINFO_SETUP_TERM(&new_term, termp, filenum, errret, FALSE) != OK) {
result = ERR;
- } else if (SP != 0) {
- int saveecho = SP->_echo;
- int savecbreak = SP->_cbreak;
- int saveraw = SP->_raw;
- int savenl = SP->_nl;
+ } else if (SP_PARM != 0) {
+ int saveecho = SP_PARM->_echo;
+ int savecbreak = SP_PARM->_cbreak;
+ int saveraw = SP_PARM->_raw;
+ int savenl = SP_PARM->_nl;
- if (saveecho)
- echo();
- else
- noecho();
+#ifdef USE_TERM_DRIVER
+ SP_PARM->_term = new_term;
+#endif
+ if (saveecho) {
+ NCURSES_SP_NAME(echo) (NCURSES_SP_ARG);
+ } else {
+ NCURSES_SP_NAME(noecho) (NCURSES_SP_ARG);
+ }
if (savecbreak) {
- cbreak();
- noraw();
+ NCURSES_SP_NAME(cbreak) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(noraw) (NCURSES_SP_ARG);
} else if (saveraw) {
- nocbreak();
- raw();
+ NCURSES_SP_NAME(nocbreak) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(raw) (NCURSES_SP_ARG);
+ } else {
+ NCURSES_SP_NAME(nocbreak) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(noraw) (NCURSES_SP_ARG);
+ }
+ if (savenl) {
+ NCURSES_SP_NAME(nl) (NCURSES_SP_ARG);
} else {
- nocbreak();
- noraw();
+ NCURSES_SP_NAME(nonl) (NCURSES_SP_ARG);
}
- if (savenl)
- nl();
- else
- nonl();
- reset_prog_mode();
+ NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_ARG);
#if USE_SIZECHANGE
- _nc_update_screensize(SP);
+ _nc_update_screensize(SP_PARM);
#endif
result = OK;
@@ -95,3 +109,11 @@ restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
}
returnCode(result);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
+{
+ return NCURSES_SP_NAME(restartterm) (CURRENT_SCREEN, termp, filenum, errret);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_scanw.c b/contrib/ncurses/ncurses/base/lib_scanw.c
index b8a5a227a1a9..a8621e63e172 100644
--- a/contrib/ncurses/ncurses/base/lib_scanw.c
+++ b/contrib/ncurses/ncurses/base/lib_scanw.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2001,2009 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_scanw.c,v 1.11 2001/06/30 23:39:41 tom Exp $")
+MODULE_ID("$Id: lib_scanw.c,v 1.12 2009/10/24 22:35:14 tom Exp $")
NCURSES_EXPORT(int)
vwscanw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp)
@@ -73,7 +73,7 @@ wscanw(WINDOW *win, NCURSES_CONST char *fmt,...)
int code;
va_list ap;
- T(("wscanw(%p,\"%s\",...) called", win, fmt));
+ T(("wscanw(%p,\"%s\",...) called", (void *) win, fmt));
va_start(ap, fmt);
code = vwscanw(win, fmt, ap);
diff --git a/contrib/ncurses/ncurses/base/lib_screen.c b/contrib/ncurses/ncurses/base/lib_screen.c
index 4aa58ea2a19c..27212b790611 100644
--- a/contrib/ncurses/ncurses/base/lib_screen.c
+++ b/contrib/ncurses/ncurses/base/lib_screen.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 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 *
@@ -30,35 +30,45 @@
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Thomas E. Dickey 1996 on *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_screen.c,v 1.31 2008/08/16 19:05:37 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_screen.c,v 1.38 2009/10/24 22:08:55 tom Exp $")
#define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */
NCURSES_EXPORT(WINDOW *)
-getwin(FILE *filep)
+NCURSES_SP_NAME(getwin) (NCURSES_SP_DCLx FILE *filep)
{
WINDOW tmp, *nwin;
int n;
- T((T_CALLED("getwin(%p)"), filep));
+ T((T_CALLED("getwin(%p)"), (void *) filep));
clearerr(filep);
- (void) fread(&tmp, sizeof(WINDOW), 1, filep);
- if (ferror(filep)
+ if (fread(&tmp, 1, sizeof(WINDOW), filep) < sizeof(WINDOW)
+ || ferror(filep)
|| tmp._maxy == 0
|| tmp._maxy > MAX_SIZE
|| tmp._maxx == 0
- || tmp._maxx > MAX_SIZE)
+ || tmp._maxx > MAX_SIZE) {
returnWin(0);
+ }
if (tmp._flags & _ISPAD) {
- nwin = newpad(tmp._maxy + 1, tmp._maxx + 1);
+ nwin = NCURSES_SP_NAME(newpad) (NCURSES_SP_ARGx
+ tmp._maxy + 1,
+ tmp._maxx + 1);
} else {
- nwin = newwin(tmp._maxy + 1, tmp._maxx + 1, 0, 0);
+ nwin = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx
+ tmp._maxy + 1,
+ tmp._maxx + 1, 0, 0);
}
/*
@@ -67,6 +77,8 @@ getwin(FILE *filep)
* made sense is probably gone.
*/
if (nwin != 0) {
+ size_t linesize = sizeof(NCURSES_CH_T) * (size_t) (tmp._maxx + 1);
+
nwin->_curx = tmp._curx;
nwin->_cury = tmp._cury;
nwin->_maxy = tmp._maxy;
@@ -98,11 +110,8 @@ getwin(FILE *filep)
for (n = 0; n <= nwin->_maxy; n++) {
clearerr(filep);
- (void) fread(nwin->_line[n].text,
- sizeof(NCURSES_CH_T),
- (size_t) (nwin->_maxx + 1),
- filep);
- if (ferror(filep)) {
+ if (fread(nwin->_line[n].text, 1, linesize, filep) < linesize
+ || ferror(filep)) {
delwin(nwin);
returnWin(0);
}
@@ -112,13 +121,21 @@ getwin(FILE *filep)
returnWin(nwin);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(WINDOW *)
+getwin(FILE *filep)
+{
+ return NCURSES_SP_NAME(getwin) (CURRENT_SCREEN, filep);
+}
+#endif
+
NCURSES_EXPORT(int)
putwin(WINDOW *win, FILE *filep)
{
int code = ERR;
int n;
- T((T_CALLED("putwin(%p,%p)"), win, filep));
+ T((T_CALLED("putwin(%p,%p)"), (void *) win, (void *) filep));
if (win != 0) {
size_t len = (size_t) (win->_maxx + 1);
@@ -141,26 +158,34 @@ putwin(WINDOW *win, FILE *filep)
}
NCURSES_EXPORT(int)
-scr_restore(const char *file)
+NCURSES_SP_NAME(scr_restore) (NCURSES_SP_DCLx const char *file)
{
FILE *fp = 0;
- T((T_CALLED("scr_restore(%s)"), _nc_visbuf(file)));
+ T((T_CALLED("scr_restore(%p,%s)"), (void *) SP_PARM, _nc_visbuf(file)));
if (_nc_access(file, R_OK) < 0
|| (fp = fopen(file, "rb")) == 0) {
returnCode(ERR);
} else {
- delwin(newscr);
- SP->_newscr = getwin(fp);
+ delwin(NewScreen(SP_PARM));
+ NewScreen(SP_PARM) = getwin(fp);
#if !USE_REENTRANT
- newscr = SP->_newscr;
+ newscr = NewScreen(SP_PARM);
#endif
(void) fclose(fp);
returnCode(OK);
}
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+scr_restore(const char *file)
+{
+ return NCURSES_SP_NAME(scr_restore) (CURRENT_SCREEN, file);
+}
+#endif
+
NCURSES_EXPORT(int)
scr_dump(const char *file)
{
@@ -179,42 +204,63 @@ scr_dump(const char *file)
}
NCURSES_EXPORT(int)
-scr_init(const char *file)
+NCURSES_SP_NAME(scr_init) (NCURSES_SP_DCLx const char *file)
{
FILE *fp = 0;
+ int code = ERR;
- T((T_CALLED("scr_init(%s)"), _nc_visbuf(file)));
-
- if (exit_ca_mode && non_rev_rmcup)
- returnCode(ERR);
+ T((T_CALLED("scr_init(%p,%s)"), (void *) SP_PARM, _nc_visbuf(file)));
- if (_nc_access(file, R_OK) < 0
- || (fp = fopen(file, "rb")) == 0) {
- returnCode(ERR);
- } else {
- delwin(curscr);
- SP->_curscr = getwin(fp);
+ if (SP_PARM != 0 &&
+#ifdef USE_TERM_DRIVER
+ InfoOf(SP_PARM).caninit
+#else
+ !(exit_ca_mode && non_rev_rmcup)
+#endif
+ ) {
+ if (_nc_access(file, R_OK) >= 0
+ && (fp = fopen(file, "rb")) != 0) {
+ delwin(CurScreen(SP_PARM));
+ CurScreen(SP_PARM) = getwin(fp);
#if !USE_REENTRANT
- curscr = SP->_curscr;
+ curscr = CurScreen(SP_PARM);
#endif
- (void) fclose(fp);
- returnCode(OK);
+ (void) fclose(fp);
+ code = OK;
+ }
}
+ returnCode(code);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-scr_set(const char *file)
+scr_init(const char *file)
{
- T((T_CALLED("scr_set(%s)"), _nc_visbuf(file)));
+ return NCURSES_SP_NAME(scr_init) (CURRENT_SCREEN, file);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(scr_set) (NCURSES_SP_DCLx const char *file)
+{
+ T((T_CALLED("scr_set(%p,%s)"), (void *) SP_PARM, _nc_visbuf(file)));
- if (scr_init(file) == ERR) {
+ if (NCURSES_SP_NAME(scr_init) (NCURSES_SP_ARGx file) == ERR) {
returnCode(ERR);
} else {
- delwin(newscr);
- SP->_newscr = dupwin(curscr);
+ delwin(NewScreen(SP_PARM));
+ NewScreen(SP_PARM) = dupwin(curscr);
#if !USE_REENTRANT
- newscr = SP->_newscr;
+ newscr = NewScreen(SP_PARM);
#endif
returnCode(OK);
}
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+scr_set(const char *file)
+{
+ return NCURSES_SP_NAME(scr_set) (CURRENT_SCREEN, file);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_scroll.c b/contrib/ncurses/ncurses/base/lib_scroll.c
index ac85bd55ea1d..fe4e80804dae 100644
--- a/contrib/ncurses/ncurses/base/lib_scroll.c
+++ b/contrib/ncurses/ncurses/base/lib_scroll.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2004,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -43,7 +43,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_scroll.c,v 1.26 2006/10/14 20:46:08 tom Exp $")
+MODULE_ID("$Id: lib_scroll.c,v 1.28 2010/12/19 01:48:09 tom Exp $")
NCURSES_EXPORT(void)
_nc_scroll_window(WINDOW *win,
@@ -55,10 +55,10 @@ _nc_scroll_window(WINDOW *win,
int limit;
int line;
int j;
- size_t to_copy = (size_t) (sizeof(NCURSES_CH_T) * (win->_maxx + 1));
+ size_t to_copy = (sizeof(NCURSES_CH_T) * (size_t) (win->_maxx + 1));
TR(TRACE_MOVE, ("_nc_scroll_window(%p, %d, %ld, %ld)",
- win, n, (long) top, (long) bottom));
+ (void *) win, n, (long) top, (long) bottom));
if (top < 0
|| bottom < top
@@ -135,7 +135,7 @@ _nc_scroll_window(WINDOW *win,
NCURSES_EXPORT(int)
wscrl(WINDOW *win, int n)
{
- T((T_CALLED("wscrl(%p,%d)"), win, n));
+ T((T_CALLED("wscrl(%p,%d)"), (void *) win, n));
if (!win || !win->_scroll) {
TR(TRACE_MOVE, ("...scrollok is false"));
diff --git a/contrib/ncurses/ncurses/base/lib_scrollok.c b/contrib/ncurses/ncurses/base/lib_scrollok.c
index f6b30259be73..6a698a368da2 100644
--- a/contrib/ncurses/ncurses/base/lib_scrollok.c
+++ b/contrib/ncurses/ncurses/base/lib_scrollok.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000,2009 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,12 +40,12 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_scrollok.c,v 1.4 2000/12/10 02:43:27 tom Exp $")
+MODULE_ID("$Id: lib_scrollok.c,v 1.5 2009/10/24 22:35:38 tom Exp $")
NCURSES_EXPORT(int)
scrollok(WINDOW *win, bool flag)
{
- T((T_CALLED("scrollok(%p,%d)"), win, flag));
+ T((T_CALLED("scrollok(%p,%d)"), (void *) win, flag));
if (win) {
win->_scroll = flag;
diff --git a/contrib/ncurses/ncurses/base/lib_scrreg.c b/contrib/ncurses/ncurses/base/lib_scrreg.c
index c85d60f1164d..546fbc183a3c 100644
--- a/contrib/ncurses/ncurses/base/lib_scrreg.c
+++ b/contrib/ncurses/ncurses/base/lib_scrreg.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000,2009 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,12 +40,12 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_scrreg.c,v 1.10 2000/12/10 02:43:27 tom Exp $")
+MODULE_ID("$Id: lib_scrreg.c,v 1.11 2009/10/24 22:35:28 tom Exp $")
NCURSES_EXPORT(int)
wsetscrreg(WINDOW *win, int top, int bottom)
{
- T((T_CALLED("wsetscrreg(%p,%d,%d)"), win, top, bottom));
+ T((T_CALLED("wsetscrreg(%p,%d,%d)"), (void *) win, top, bottom));
if (win &&
top >= 0 && top <= win->_maxy &&
diff --git a/contrib/ncurses/ncurses/base/lib_set_term.c b/contrib/ncurses/ncurses/base/lib_set_term.c
index aff432bb9fd1..df0a276aef8a 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-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -40,11 +41,21 @@
*/
#include <curses.priv.h>
-
-#include <term.h> /* cur_term */
#include <tic.h>
-MODULE_ID("$Id: lib_set_term.c,v 1.117 2008/08/04 18:11:12 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_set_term.c,v 1.138 2010/12/20 00:42:20 tom Exp $")
+
+#ifdef USE_TERM_DRIVER
+#define MaxColors InfoOf(sp).maxcolors
+#define NumLabels InfoOf(sp).numlabels
+#else
+#define MaxColors max_colors
+#define NumLabels num_labels
+#endif
NCURSES_EXPORT(SCREEN *)
set_term(SCREEN *screenp)
@@ -52,25 +63,25 @@ set_term(SCREEN *screenp)
SCREEN *oldSP;
SCREEN *newSP;
- T((T_CALLED("set_term(%p)"), screenp));
+ T((T_CALLED("set_term(%p)"), (void *) screenp));
_nc_lock_global(curses);
- oldSP = SP;
+ oldSP = CURRENT_SCREEN;
_nc_set_screen(screenp);
- newSP = SP;
+ newSP = screenp;
if (newSP != 0) {
- set_curterm(newSP->_term);
+ TINFO_SET_CURTERM(newSP, newSP->_term);
#if !USE_REENTRANT
- curscr = newSP->_curscr;
- newscr = newSP->_newscr;
- stdscr = newSP->_stdscr;
+ curscr = CurScreen(newSP);
+ newscr = NewScreen(newSP);
+ stdscr = StdScreen(newSP);
COLORS = newSP->_color_count;
COLOR_PAIRS = newSP->_pair_count;
#endif
} else {
- set_curterm(0);
+ TINFO_SET_CURTERM(oldSP, 0);
#if !USE_REENTRANT
curscr = 0;
newscr = 0;
@@ -82,7 +93,7 @@ set_term(SCREEN *screenp)
_nc_unlock_global(curses);
- T((T_RETURN("%p"), oldSP));
+ T((T_RETURN("%p"), (void *) oldSP));
return (oldSP);
}
@@ -106,7 +117,7 @@ delink_screen(SCREEN *sp)
for (each_screen(temp)) {
if (temp == sp) {
if (last)
- last = sp->_next_screen;
+ last->_next_screen = sp->_next_screen;
else
_nc_screen_chain = sp->_next_screen;
result = TRUE;
@@ -125,14 +136,27 @@ delscreen(SCREEN *sp)
{
int i;
- T((T_CALLED("delscreen(%p)"), sp));
+ T((T_CALLED("delscreen(%p)"), (void *) sp));
_nc_lock_global(curses);
if (delink_screen(sp)) {
+#ifdef USE_SP_RIPOFF
+ ripoff_t *rop;
+ if (safe_ripoff_sp && safe_ripoff_sp != safe_ripoff_stack) {
+ for (rop = safe_ripoff_stack;
+ rop != safe_ripoff_sp && (rop - safe_ripoff_stack) < N_RIPS;
+ rop++) {
+ if (rop->win) {
+ (void) delwin(rop->win);
+ rop->win = 0;
+ }
+ }
+ }
+#endif
- (void) _nc_freewin(sp->_curscr);
- (void) _nc_freewin(sp->_newscr);
- (void) _nc_freewin(sp->_stdscr);
+ (void) _nc_freewin(CurScreen(sp));
+ (void) _nc_freewin(NewScreen(sp));
+ (void) _nc_freewin(StdScreen(sp));
if (sp->_slk != 0) {
if (sp->_slk->ent != 0) {
@@ -176,7 +200,7 @@ delscreen(SCREEN *sp)
free(sp->_setbuf);
}
- del_curterm(sp->_term);
+ NCURSES_SP_NAME(del_curterm) (NCURSES_SP_ARGx sp->_term);
free(sp);
/*
@@ -184,7 +208,7 @@ delscreen(SCREEN *sp)
* application might try to use (except cur_term, which may have
* multiple references in different screens).
*/
- if (sp == SP) {
+ if (sp == CURRENT_SCREEN) {
#if !USE_REENTRANT
curscr = 0;
newscr = 0;
@@ -248,50 +272,98 @@ extract_fgbg(char *src, int *result)
}
#endif
+#define ReturnScreenError() _nc_set_screen(0); \
+ returnCode(ERR)
+
/* OS-independent screen initializations */
NCURSES_EXPORT(int)
-_nc_setupscreen(int slines GCC_UNUSED,
- int scolumns GCC_UNUSED,
- FILE *output,
- bool filtered,
- int slk_format)
+NCURSES_SP_NAME(_nc_setupscreen) (
+#if NCURSES_SP_FUNCS
+ SCREEN **spp,
+#endif
+ int slines,
+ int scolumns,
+ FILE *output,
+ bool filtered,
+ int slk_format)
{
char *env;
int bottom_stolen = 0;
- bool support_cookies = USE_XMC_SUPPORT;
ripoff_t *rop;
+ SCREEN *sp;
+#ifndef USE_TERM_DRIVER
+ bool support_cookies = USE_XMC_SUPPORT;
+#endif
T((T_CALLED("_nc_setupscreen(%d, %d, %p, %d, %d)"),
- slines, scolumns, output, filtered, slk_format));
+ slines, scolumns, (void *) output, filtered, slk_format));
+
+ assert(CURRENT_SCREEN == 0); /* has been reset in newterm() ! */
+
+#if NCURSES_SP_FUNCS
+ assert(spp != 0);
+ sp = *spp;
- assert(SP == 0); /* has been reset in newterm() ! */
+ if (!sp) {
+ sp = _nc_alloc_screen_sp();
+ *spp = sp;
+ }
+ if (!sp
+ || ((sp->_acs_map = typeCalloc(chtype, ACS_LEN)) == 0)
+ || ((sp->_screen_acs_map = typeCalloc(bool, ACS_LEN)) == 0)) {
+ ReturnScreenError();
+ }
+
+ T(("created SP %p", (void *) sp));
+ sp->_next_screen = _nc_screen_chain;
+ _nc_screen_chain = sp;
+
+ if ((sp->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0) {
+ ReturnScreenError();
+ }
+#else
if (!_nc_alloc_screen()
|| ((SP->_acs_map = typeCalloc(chtype, ACS_LEN)) == 0)
|| ((SP->_screen_acs_map = typeCalloc(bool, ACS_LEN)) == 0)) {
returnCode(ERR);
}
- T(("created SP %p", SP));
- SP->_next_screen = _nc_screen_chain;
- _nc_screen_chain = SP;
+ T(("created SP %p", (void *) SP));
- if ((SP->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0)
+ sp = SP; /* fixup so SET_LINES and SET_COLS works */
+ sp->_next_screen = _nc_screen_chain;
+ _nc_screen_chain = sp;
+
+ if ((sp->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0)
returnCode(ERR);
+#endif
/*
* We should always check the screensize, just in case.
*/
- _nc_get_screensize(SP, &slines, &scolumns);
+ _nc_set_screen(sp);
+ sp->_term = cur_term;
+#ifdef USE_TERM_DRIVER
+ TCBOf(sp)->csp = sp;
+ _nc_get_screensize(sp, sp->_term, &slines, &scolumns);
+#else
+ _nc_get_screensize(sp, &slines, &scolumns);
+#endif
SET_LINES(slines);
SET_COLS(scolumns);
- T((T_CREATE("screen %s %dx%d"), termname(), LINES, COLS));
- SP->_filtered = filtered;
+ T((T_CREATE("screen %s %dx%d"),
+ NCURSES_SP_NAME(termname) (NCURSES_SP_ARG), slines, scolumns));
+
+ sp->_filtered = filtered;
/* implement filter mode */
if (filtered) {
slines = 1;
SET_LINES(slines);
+#ifdef USE_TERM_DRIVER
+ CallDriver(sp, setfilter);
+#else
clear_screen = 0;
cursor_down = parm_down_cursor = 0;
cursor_address = 0;
@@ -299,34 +371,25 @@ _nc_setupscreen(int slines GCC_UNUSED,
row_address = 0;
cursor_home = carriage_return;
- T(("filter screensize %dx%d", LINES, COLS));
+#endif
+ T(("filter screensize %dx%d", slines, scolumns));
}
#ifdef __DJGPP__
T(("setting output mode to binary"));
fflush(output);
setmode(output, O_BINARY);
#endif
- _nc_set_buffer(output, TRUE);
- SP->_term = cur_term;
- SP->_lines = slines;
- SP->_lines_avail = slines;
- SP->_columns = scolumns;
- SP->_cursrow = -1;
- SP->_curscol = -1;
- SP->_nl = TRUE;
- SP->_raw = FALSE;
- SP->_cbreak = 0;
- SP->_echo = TRUE;
- SP->_fifohead = -1;
- SP->_endwin = TRUE;
- SP->_ofp = output;
- SP->_cursor = -1; /* cannot know real cursor shape */
-
- SetNoPadding(SP);
+ NCURSES_SP_NAME(_nc_set_buffer) (NCURSES_SP_ARGx output, TRUE);
+ sp->_lines = (NCURSES_SIZE_T) slines;
+ sp->_lines_avail = (NCURSES_SIZE_T) slines;
+ sp->_columns = (NCURSES_SIZE_T) scolumns;
+ sp->_ofp = output;
+ SP_PRE_INIT(sp);
+ SetNoPadding(sp);
#if NCURSES_EXT_FUNCS
- SP->_default_color = FALSE;
- SP->_has_sgr_39_49 = FALSE;
+ sp->_default_color = FALSE;
+ sp->_has_sgr_39_49 = FALSE;
/*
* Set our assumption of the terminal's default foreground and background
@@ -348,11 +411,11 @@ _nc_setupscreen(int slines GCC_UNUSED,
* or black-on-white display under control of the application than not).
*/
#ifdef USE_ASSUMED_COLOR
- SP->_default_fg = COLOR_WHITE;
- SP->_default_bg = COLOR_BLACK;
+ sp->_default_fg = COLOR_WHITE;
+ sp->_default_bg = COLOR_BLACK;
#else
- SP->_default_fg = C_MASK;
- SP->_default_bg = C_MASK;
+ sp->_default_fg = C_MASK;
+ sp->_default_bg = C_MASK;
#endif
/*
@@ -364,14 +427,14 @@ _nc_setupscreen(int slines GCC_UNUSED,
char sep1, sep2;
int count = sscanf(env, "%d%c%d%c", &fg, &sep1, &bg, &sep2);
if (count >= 1) {
- SP->_default_fg = (fg >= 0 && fg < max_colors) ? fg : C_MASK;
+ sp->_default_fg = ((fg >= 0 && fg < MaxColors) ? fg : C_MASK);
if (count >= 3) {
- SP->_default_bg = (bg >= 0 && bg < max_colors) ? bg : C_MASK;
+ sp->_default_bg = ((bg >= 0 && bg < MaxColors) ? bg : C_MASK);
}
TR(TRACE_CHARPUT | TRACE_MOVE,
("from environment assumed fg=%d, bg=%d",
- SP->_default_fg,
- SP->_default_bg));
+ sp->_default_fg,
+ sp->_default_bg));
}
}
#if USE_COLORFGBG
@@ -384,48 +447,51 @@ _nc_setupscreen(int slines GCC_UNUSED,
if (getenv("COLORFGBG") != 0) {
char *p = getenv("COLORFGBG");
TR(TRACE_CHARPUT | TRACE_MOVE, ("decoding COLORFGBG %s", p));
- p = extract_fgbg(p, &(SP->_default_fg));
- p = extract_fgbg(p, &(SP->_default_bg));
+ p = extract_fgbg(p, &(sp->_default_fg));
+ p = extract_fgbg(p, &(sp->_default_bg));
if (*p) /* assume rxvt was compiled with xpm support */
- p = extract_fgbg(p, &(SP->_default_bg));
+ p = extract_fgbg(p, &(sp->_default_bg));
TR(TRACE_CHARPUT | TRACE_MOVE, ("decoded fg=%d, bg=%d",
- SP->_default_fg, SP->_default_bg));
- if (SP->_default_fg >= max_colors) {
+ sp->_default_fg, sp->_default_bg));
+ if (sp->_default_fg >= MaxColors) {
if (set_a_foreground != ABSENT_STRING
&& !strcmp(set_a_foreground, "\033[3%p1%dm")) {
set_a_foreground = "\033[3%?%p1%{8}%>%t9%e%p1%d%;m";
} else {
- SP->_default_fg %= max_colors;
+ sp->_default_fg %= MaxColors;
}
}
- if (SP->_default_bg >= max_colors) {
+ if (sp->_default_bg >= MaxColors) {
if (set_a_background != ABSENT_STRING
&& !strcmp(set_a_background, "\033[4%p1%dm")) {
set_a_background = "\033[4%?%p1%{8}%>%t9%e%p1%d%;m";
} else {
- SP->_default_bg %= max_colors;
+ sp->_default_bg %= MaxColors;
}
}
}
#endif
#endif /* NCURSES_EXT_FUNCS */
- SP->_maxclick = DEFAULT_MAXCLICK;
- SP->_mouse_event = no_mouse_event;
- SP->_mouse_inline = no_mouse_inline;
- SP->_mouse_parse = no_mouse_parse;
- SP->_mouse_resume = no_mouse_resume;
- SP->_mouse_wrap = no_mouse_wrap;
- SP->_mouse_fd = -1;
+ sp->_maxclick = DEFAULT_MAXCLICK;
+ sp->_mouse_event = no_mouse_event;
+ sp->_mouse_inline = no_mouse_inline;
+ sp->_mouse_parse = no_mouse_parse;
+ sp->_mouse_resume = no_mouse_resume;
+ sp->_mouse_wrap = no_mouse_wrap;
+ sp->_mouse_fd = -1;
/*
* If we've no magic cookie support, we suppress attributes that xmc would
* affect, i.e., the attributes that affect the rendition of a space.
*/
- SP->_ok_attributes = termattrs();
- if (has_colors()) {
- SP->_ok_attributes |= A_COLOR;
+ sp->_ok_attributes = NCURSES_SP_NAME(termattrs) (NCURSES_SP_ARG);
+ if (NCURSES_SP_NAME(has_colors) (NCURSES_SP_ARG)) {
+ sp->_ok_attributes |= A_COLOR;
}
+#ifdef USE_TERM_DRIVER
+ _nc_cookie_init(sp);
+#else
#if USE_XMC_SUPPORT
/*
* If we have no magic-cookie support compiled-in, or if it is suppressed
@@ -444,7 +510,7 @@ _nc_setupscreen(int slines GCC_UNUSED,
if (magic_cookie_glitch > 0) { /* tvi, wyse */
- SP->_xmc_triggers = SP->_ok_attributes & (
+ sp->_xmc_triggers = sp->_ok_attributes & (
A_STANDOUT |
A_UNDERLINE |
A_REVERSE |
@@ -461,12 +527,12 @@ _nc_setupscreen(int slines GCC_UNUSED,
* cookies.
*/
if (has_colors()) {
- SP->_xmc_triggers |= A_COLOR;
+ sp->_xmc_triggers |= A_COLOR;
}
#endif
- SP->_xmc_suppress = SP->_xmc_triggers & (chtype) ~(A_BOLD);
+ sp->_xmc_suppress = sp->_xmc_triggers & (chtype) ~(A_BOLD);
- T(("magic cookie attributes %s", _traceattr(SP->_xmc_suppress)));
+ T(("magic cookie attributes %s", _traceattr(sp->_xmc_suppress)));
/*
* Supporting line-drawing may be possible. But make the regular
* video attributes work first.
@@ -506,7 +572,7 @@ _nc_setupscreen(int slines GCC_UNUSED,
/* initialize normal acs before wide, since we use mapping in the latter */
#if !USE_WIDEC_SUPPORT
- if (_nc_unicode_locale() && _nc_locale_breaks_acs(cur_term)) {
+ if (_nc_unicode_locale() && _nc_locale_breaks_acs(sp->_term)) {
acs_chars = NULL;
ena_acs = NULL;
enter_alt_charset_mode = NULL;
@@ -514,134 +580,194 @@ _nc_setupscreen(int slines GCC_UNUSED,
set_attributes = NULL;
}
#endif
- _nc_init_acs();
+#endif
+
+ NCURSES_SP_NAME(_nc_init_acs) (NCURSES_SP_ARG);
#if USE_WIDEC_SUPPORT
_nc_init_wacs();
- SP->_screen_acs_fix = (_nc_unicode_locale()
- && _nc_locale_breaks_acs(cur_term));
+ sp->_screen_acs_fix = (_nc_unicode_locale()
+ && _nc_locale_breaks_acs(sp->_term));
#endif
env = _nc_get_locale();
- SP->_legacy_coding = ((env == 0)
+ sp->_legacy_coding = ((env == 0)
|| !strcmp(env, "C")
|| !strcmp(env, "POSIX"));
- T(("legacy-coding %d", SP->_legacy_coding));
+ T(("legacy-coding %d", sp->_legacy_coding));
- _nc_idcok = TRUE;
- _nc_idlok = FALSE;
+ sp->_nc_sp_idcok = TRUE;
+ sp->_nc_sp_idlok = FALSE;
- SP->oldhash = 0;
- SP->newhash = 0;
+ sp->oldhash = 0;
+ sp->newhash = 0;
T(("creating newscr"));
- if ((SP->_newscr = newwin(slines, scolumns, 0, 0)) == 0)
- returnCode(ERR);
-
+ NewScreen(sp) = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx slines, scolumns,
+ 0, 0);
+ if (NewScreen(sp) == 0) {
+ ReturnScreenError();
+ }
T(("creating curscr"));
- if ((SP->_curscr = newwin(slines, scolumns, 0, 0)) == 0)
- returnCode(ERR);
-
+ CurScreen(sp) = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx slines, scolumns,
+ 0, 0);
+ if (CurScreen(sp) == 0) {
+ ReturnScreenError();
+ }
#if !USE_REENTRANT
- newscr = SP->_newscr;
- curscr = SP->_curscr;
+ newscr = NewScreen(sp);
+ curscr = CurScreen(sp);
#endif
#if USE_SIZECHANGE
- SP->_resize = resizeterm;
+ sp->_resize = NCURSES_SP_NAME(resizeterm);
#endif
- newscr->_clear = TRUE;
- curscr->_clear = FALSE;
-
- def_shell_mode();
- def_prog_mode();
-
- 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->win = w;
- rop->hook(w, scolumns);
- } else {
- returnCode(ERR);
+ NewScreen(sp)->_clear = TRUE;
+ CurScreen(sp)->_clear = FALSE;
+
+ NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_ARG);
+
+ if (safe_ripoff_sp && safe_ripoff_sp != safe_ripoff_stack) {
+ for (rop = safe_ripoff_stack;
+ rop != safe_ripoff_sp && (rop - safe_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 (!(NumLabels <= 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 = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx
+ count, scolumns,
+ ((rop->line < 0)
+ ? sp->_lines_avail - count
+ : 0),
+ 0);
+ if (w) {
+ rop->win = w;
+ rop->hook(w, scolumns);
+ } else {
+ ReturnScreenError();
+ }
+ if (rop->line < 0) {
+ bottom_stolen += count;
+ } else {
+ sp->_topstolen = (NCURSES_SIZE_T) (sp->_topstolen + count);
+ }
+ sp->_lines_avail = (NCURSES_SIZE_T) (sp->_lines_avail - count);
}
- if (rop->line < 0)
- bottom_stolen += count;
- else
- SP->_topstolen += count;
- SP->_lines_avail -= count;
}
+ /* reset the stack */
+ safe_ripoff_sp = safe_ripoff_stack;
}
- /* reset the stack */
- ripoff_sp = ripoff_stack;
T(("creating stdscr"));
- assert((SP->_lines_avail + SP->_topstolen + bottom_stolen) == slines);
- if ((SP->_stdscr = newwin(SP->_lines_avail, scolumns, 0, 0)) == 0)
- returnCode(ERR);
-
- SET_LINES(SP->_lines_avail);
+ assert((sp->_lines_avail + sp->_topstolen + bottom_stolen) == slines);
+ if ((StdScreen(sp) = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx
+ sp->_lines_avail,
+ scolumns, 0, 0)) == 0) {
+ ReturnScreenError();
+ }
+ SET_LINES(sp->_lines_avail);
#if !USE_REENTRANT
- stdscr = SP->_stdscr;
+ stdscr = StdScreen(sp);
#endif
-
+ sp->_prescreen = FALSE;
returnCode(OK);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+_nc_setupscreen(int slines GCC_UNUSED,
+ int scolumns GCC_UNUSED,
+ FILE *output,
+ bool filtered,
+ int slk_format)
+{
+ SCREEN *sp = 0;
+ int rc = NCURSES_SP_NAME(_nc_setupscreen) (&sp,
+ slines,
+ scolumns,
+ output,
+ filtered,
+ slk_format);
+ if (rc != OK)
+ _nc_set_screen(0);
+ return rc;
+}
+#endif
+
/*
* 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))
+NCURSES_SP_NAME(_nc_ripoffline) (NCURSES_SP_DCLx
+ int line,
+ int (*init) (WINDOW *, int))
{
- T((T_CALLED("_nc_ripoffline(%d, %p)"), line, init));
+ int code = ERR;
- if (line != 0) {
-
- if (ripoff_sp == 0)
- ripoff_sp = ripoff_stack;
- if (ripoff_sp >= ripoff_stack + N_RIPS)
- returnCode(ERR);
+ START_TRACE();
+ T((T_CALLED("ripoffline(%p,%d,%p)"), (void *) SP_PARM, line, init));
- ripoff_sp->line = line;
- ripoff_sp->hook = init;
- ripoff_sp++;
+#if NCURSES_SP_FUNCS
+ if (SP_PARM != 0 && SP_PARM->_prescreen)
+#endif
+ {
+ if (line == 0) {
+ code = OK;
+ } else {
+ if (safe_ripoff_sp == 0)
+ safe_ripoff_sp = safe_ripoff_stack;
+ if (safe_ripoff_sp < safe_ripoff_stack + N_RIPS) {
+ safe_ripoff_sp->line = line;
+ safe_ripoff_sp->hook = init;
+ (safe_ripoff_sp)++;
+ code = OK;
+ }
+ }
}
- returnCode(OK);
+ returnCode(code);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-ripoffline(int line, int (*init) (WINDOW *, int))
+_nc_ripoffline(int line, int (*init) (WINDOW *, int))
{
- START_TRACE();
- T((T_CALLED("ripoffline(%d,%p)"), line, init));
+ return NCURSES_SP_NAME(_nc_ripoffline) (CURRENT_SCREEN_PRE, line, init);
+}
+#endif
- if (line == 0)
- returnCode(OK);
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(ripoffline) (NCURSES_SP_DCLx
+ int line,
+ int (*init) (WINDOW *, int))
+{
+ return NCURSES_SP_NAME(_nc_ripoffline) (NCURSES_SP_ARGx
+ (line < 0) ? -1 : 1,
+ init);
+}
- returnCode(_nc_ripoffline((line < 0) ? -1 : 1, init));
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+ripoffline(int line, int (*init) (WINDOW *, int))
+{
+ return NCURSES_SP_NAME(ripoffline) (CURRENT_SCREEN_PRE, line, init);
}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_slk.c b/contrib/ncurses/ncurses/base/lib_slk.c
index 662f7e45b116..84f17ae03705 100644
--- a/contrib/ncurses/ncurses/base/lib_slk.c
+++ b/contrib/ncurses/ncurses/base/lib_slk.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 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,26 +41,94 @@
*/
#include <curses.priv.h>
-
#include <ctype.h>
-#include <term.h> /* num_labels, label_*, plab_norm */
-MODULE_ID("$Id: lib_slk.c,v 1.35 2008/09/27 14:07:33 juergen Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_slk.c,v 1.48 2011/03/05 21:21:52 tom Exp $")
+
+#ifdef USE_TERM_DRIVER
+#define NumLabels InfoOf(SP_PARM).numlabels
+#define NoColorVideo InfoOf(SP_PARM).nocolorvideo
+#define LabelWidth InfoOf(SP_PARM).labelwidth
+#define LabelHeight InfoOf(SP_PARM).labelheight
+#else
+#define NumLabels num_labels
+#define NoColorVideo no_color_video
+#define LabelWidth label_width
+#define LabelHeight label_height
+#endif
/*
* Free any memory related to soft labels, return an error.
*/
static int
-slk_failed(void)
+slk_failed(NCURSES_SP_DCL0)
{
- if (SP->_slk) {
- FreeIfNeeded(SP->_slk->ent);
- free(SP->_slk);
- SP->_slk = (SLK *) 0;
+ if ((0 != SP_PARM) && SP_PARM->_slk) {
+ FreeIfNeeded(SP_PARM->_slk->ent);
+ free(SP_PARM->_slk);
+ SP_PARM->_slk = (SLK *) 0;
}
return ERR;
}
+NCURSES_EXPORT(int)
+_nc_format_slks(NCURSES_SP_DCLx int cols)
+{
+ int gap, i, x;
+ int max_length;
+
+ if (!SP_PARM || !SP_PARM->_slk)
+ return ERR;
+
+ max_length = SP_PARM->_slk->maxlen;
+ if (SP_PARM->slk_format >= 3) { /* PC style */
+ gap = (cols - 3 * (3 + 4 * max_length)) / 2;
+
+ if (gap < 1)
+ gap = 1;
+
+ for (i = x = 0; i < SP_PARM->_slk->maxlab; i++) {
+ SP_PARM->_slk->ent[i].ent_x = x;
+ x += max_length;
+ x += (i == 3 || i == 7) ? gap : 1;
+ }
+ } else {
+ if (SP_PARM->slk_format == 2) { /* 4-4 */
+ gap = cols - (int) (SP_PARM->_slk->maxlab * max_length) - 6;
+
+ if (gap < 1)
+ gap = 1;
+ for (i = x = 0; i < SP_PARM->_slk->maxlab; i++) {
+ SP_PARM->_slk->ent[i].ent_x = x;
+ x += max_length;
+ x += (i == 3) ? gap : 1;
+ }
+ } else {
+ if (SP_PARM->slk_format == 1) { /* 1 -> 3-2-3 */
+ gap = (cols - (SP_PARM->_slk->maxlab * max_length) - 5)
+ / 2;
+
+ if (gap < 1)
+ gap = 1;
+ for (i = x = 0; i < SP_PARM->_slk->maxlab; i++) {
+ SP_PARM->_slk->ent[i].ent_x = x;
+ x += max_length;
+ x += (i == 2 || i == 4) ? gap : 1;
+ }
+ } else {
+ return slk_failed(NCURSES_SP_ARG);
+ }
+ }
+ }
+ SP_PARM->_slk->dirty = TRUE;
+
+ return OK;
+}
+
/*
* Initialize soft labels.
* Called from newterm()
@@ -68,108 +136,90 @@ slk_failed(void)
NCURSES_EXPORT(int)
_nc_slk_initialize(WINDOW *stwin, int cols)
{
- int i, x;
+ int i;
int res = OK;
- unsigned max_length;
+ size_t max_length;
+ SCREEN *sp;
+ int numlab;
T((T_CALLED("_nc_slk_initialize()")));
- if (SP->_slk) { /* we did this already, so simply return */
+ assert(stwin);
+
+ sp = _nc_screen_of(stwin);
+ if (0 == sp)
+ returnCode(ERR);
+
+ assert(TerminalOf(SP_PARM));
+
+ numlab = NumLabels;
+
+ if (SP_PARM->_slk) { /* we did this already, so simply return */
returnCode(OK);
- } else if ((SP->_slk = typeCalloc(SLK, 1)) == 0)
+ } else if ((SP_PARM->_slk = typeCalloc(SLK, 1)) == 0)
returnCode(ERR);
- SP->_slk->ent = NULL;
+ if (!SP_PARM->slk_format)
+ SP_PARM->slk_format = _nc_globals.slk_format;
/*
* If we use colors, vidputs() will suppress video attributes that conflict
* with colors. In that case, we're still guaranteed that "reverse" would
* work.
*/
- if ((no_color_video & 1) == 0)
- SetAttr(SP->_slk->attr, A_STANDOUT);
+ if ((NoColorVideo & 1) == 0)
+ SetAttr(SP_PARM->_slk->attr, A_STANDOUT);
else
- SetAttr(SP->_slk->attr, A_REVERSE);
-
- SP->_slk->maxlab = ((num_labels > 0)
- ? num_labels
- : MAX_SKEY(_nc_globals.slk_format));
- SP->_slk->maxlen = ((num_labels > 0)
- ? label_width * label_height
- : MAX_SKEY_LEN(_nc_globals.slk_format));
- SP->_slk->labcnt = ((SP->_slk->maxlab < MAX_SKEY(_nc_globals.slk_format))
- ? MAX_SKEY(_nc_globals.slk_format)
- : SP->_slk->maxlab);
-
- if (SP->_slk->maxlen <= 0
- || SP->_slk->labcnt <= 0
- || (SP->_slk->ent = typeCalloc(slk_ent,
- (unsigned) SP->_slk->labcnt)) == NULL)
- returnCode(slk_failed());
-
- max_length = SP->_slk->maxlen;
- for (i = 0; i < SP->_slk->labcnt; i++) {
+ SetAttr(SP_PARM->_slk->attr, A_REVERSE);
+
+ SP_PARM->_slk->maxlab = (short) ((numlab > 0)
+ ? numlab
+ : MAX_SKEY(SP_PARM->slk_format));
+ SP_PARM->_slk->maxlen = (short) ((numlab > 0)
+ ? LabelWidth * LabelHeight
+ : MAX_SKEY_LEN(SP_PARM->slk_format));
+ SP_PARM->_slk->labcnt = (short) ((SP_PARM->_slk->maxlab < MAX_SKEY(SP_PARM->slk_format))
+ ? MAX_SKEY(SP_PARM->slk_format)
+ : SP_PARM->_slk->maxlab);
+
+ if (SP_PARM->_slk->maxlen <= 0
+ || SP_PARM->_slk->labcnt <= 0
+ || (SP_PARM->_slk->ent = typeCalloc(slk_ent,
+ (size_t) SP_PARM->_slk->labcnt))
+ == NULL)
+ returnCode(slk_failed(NCURSES_SP_ARG));
+
+ max_length = (size_t) SP_PARM->_slk->maxlen;
+ for (i = 0; i < SP_PARM->_slk->labcnt; i++) {
size_t used = max_length + 1;
- if ((SP->_slk->ent[i].ent_text = (char *) _nc_doalloc(0, used)) == 0)
- returnCode(slk_failed());
- memset(SP->_slk->ent[i].ent_text, 0, used);
-
- if ((SP->_slk->ent[i].form_text = (char *) _nc_doalloc(0, used)) == 0)
- returnCode(slk_failed());
- memset(SP->_slk->ent[i].form_text, 0, used);
+ SP_PARM->_slk->ent[i].ent_text = (char *) _nc_doalloc(0, used);
+ if (SP_PARM->_slk->ent[i].ent_text == 0)
+ returnCode(slk_failed(NCURSES_SP_ARG));
+ memset(SP_PARM->_slk->ent[i].ent_text, 0, used);
- memset(SP->_slk->ent[i].form_text, ' ', max_length);
- SP->_slk->ent[i].visible = (char) (i < SP->_slk->maxlab);
- }
- if (_nc_globals.slk_format >= 3) { /* PC style */
- int gap = (cols - 3 * (3 + 4 * max_length)) / 2;
-
- if (gap < 1)
- gap = 1;
+ SP_PARM->_slk->ent[i].form_text = (char *) _nc_doalloc(0, used);
+ if (SP_PARM->_slk->ent[i].form_text == 0)
+ returnCode(slk_failed(NCURSES_SP_ARG));
- for (i = x = 0; i < SP->_slk->maxlab; i++) {
- SP->_slk->ent[i].ent_x = x;
- x += max_length;
- x += (i == 3 || i == 7) ? gap : 1;
+ if (used > 1) {
+ memset(SP_PARM->_slk->ent[i].form_text, ' ', used - 1);
}
- } else {
- if (_nc_globals.slk_format == 2) { /* 4-4 */
- int gap = cols - (SP->_slk->maxlab * max_length) - 6;
+ SP_PARM->_slk->ent[i].form_text[used - 1] = '\0';
- if (gap < 1)
- gap = 1;
- for (i = x = 0; i < SP->_slk->maxlab; i++) {
- SP->_slk->ent[i].ent_x = x;
- x += max_length;
- x += (i == 3) ? gap : 1;
- }
- } else {
- if (_nc_globals.slk_format == 1) { /* 1 -> 3-2-3 */
- int gap = (cols - (SP->_slk->maxlab * max_length) - 5)
- / 2;
-
- if (gap < 1)
- gap = 1;
- for (i = x = 0; i < SP->_slk->maxlab; i++) {
- SP->_slk->ent[i].ent_x = x;
- x += max_length;
- x += (i == 2 || i == 4) ? gap : 1;
- }
- } else
- returnCode(slk_failed());
- }
+ SP_PARM->_slk->ent[i].visible = (char) (i < SP_PARM->_slk->maxlab);
}
- SP->_slk->dirty = TRUE;
- if ((SP->_slk->win = stwin) == NULL) {
- returnCode(slk_failed());
+
+ res = _nc_format_slks(NCURSES_SP_ARGx cols);
+
+ if ((SP_PARM->_slk->win = stwin) == NULL) {
+ returnCode(slk_failed(NCURSES_SP_ARG));
}
/* We now reset the format so that the next newterm has again
* per default no SLK keys and may call slk_init again to
* define a new layout. (juergen 03-Mar-1999)
*/
- SP->slk_format = _nc_globals.slk_format;
_nc_globals.slk_format = 0;
returnCode(res);
}
@@ -178,14 +228,24 @@ _nc_slk_initialize(WINDOW *stwin, int cols)
* Restore the soft labels on the screen.
*/
NCURSES_EXPORT(int)
-slk_restore(void)
+NCURSES_SP_NAME(slk_restore) (NCURSES_SP_DCL0)
{
- T((T_CALLED("slk_restore()")));
+ T((T_CALLED("slk_restore(%p)"), (void *) SP_PARM));
+
+ if (0 == SP_PARM)
+ returnCode(ERR);
+ if (SP_PARM->_slk == NULL)
+ returnCode(ERR);
+ SP_PARM->_slk->hidden = FALSE;
+ SP_PARM->_slk->dirty = TRUE;
- if (SP->_slk == NULL)
- return (ERR);
- SP->_slk->hidden = FALSE;
- SP->_slk->dirty = TRUE;
+ returnCode(NCURSES_SP_NAME(slk_refresh) (NCURSES_SP_ARG));
+}
- returnCode(slk_refresh());
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+slk_restore(void)
+{
+ return NCURSES_SP_NAME(slk_restore) (CURRENT_SCREEN);
}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_slkatr_set.c b/contrib/ncurses/ncurses/base/lib_slkatr_set.c
index f83616beaf17..bd5f539672a7 100644
--- a/contrib/ncurses/ncurses/base/lib_slkatr_set.c
+++ b/contrib/ncurses/ncurses/base/lib_slkatr_set.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2009 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 @@
/****************************************************************************
* Author: Juergen Pfeifer, 1998 *
- * and: Thomas E. Dickey 2005 *
+ * and: Thomas E. Dickey 2005-on *
****************************************************************************/
/*
@@ -38,22 +38,42 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkatr_set.c,v 1.10 2005/01/28 21:11:53 tom Exp $")
+MODULE_ID("$Id: lib_slkatr_set.c,v 1.14 2009/10/24 22:47:03 tom Exp $")
NCURSES_EXPORT(int)
-slk_attr_set(const attr_t attr, short color_pair_number, void *opts)
+NCURSES_SP_NAME(slk_attr_set) (NCURSES_SP_DCLx
+ const attr_t attr,
+ short color_pair_number,
+ void *opts)
{
- T((T_CALLED("slk_attr_set(%s,%d)"), _traceattr(attr), color_pair_number));
+ int code = ERR;
+
+ T((T_CALLED("slk_attr_set(%p,%s,%d)"),
+ (void *) SP_PARM,
+ _traceattr(attr),
+ color_pair_number));
- if (SP != 0 && SP->_slk != 0 && !opts &&
- color_pair_number >= 0 && color_pair_number < COLOR_PAIRS) {
- TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP->_slk->attr))));
- SetAttr(SP->_slk->attr, attr);
+ if (SP_PARM != 0
+ && SP_PARM->_slk != 0
+ && !opts
+ && color_pair_number >= 0
+ && color_pair_number < SP_PARM->_pair_limit) {
+ TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
+ SetAttr(SP_PARM->_slk->attr, attr);
if (color_pair_number > 0) {
- SetPair(SP->_slk->attr, color_pair_number);
+ SetPair(SP_PARM->_slk->attr, color_pair_number);
}
- TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP->_slk->attr))));
- returnCode(OK);
- } else
- returnCode(ERR);
+ TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
+ code = OK;
+ }
+ returnCode(code);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+slk_attr_set(const attr_t attr, short color_pair_number, void *opts)
+{
+ return NCURSES_SP_NAME(slk_attr_set) (CURRENT_SCREEN, attr,
+ color_pair_number, opts);
}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_slkatrof.c b/contrib/ncurses/ncurses/base/lib_slkatrof.c
index 14b4c3bfadcc..bb980ab812cf 100644
--- a/contrib/ncurses/ncurses/base/lib_slkatrof.c
+++ b/contrib/ncurses/ncurses/base/lib_slkatrof.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2009 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,21 +38,29 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkatrof.c,v 1.8 2005/01/08 23:01:32 tom Exp $")
+MODULE_ID("$Id: lib_slkatrof.c,v 1.11 2009/10/24 22:12:21 tom Exp $")
NCURSES_EXPORT(int)
-slk_attroff(const chtype attr)
+NCURSES_SP_NAME(slk_attroff) (NCURSES_SP_DCLx const chtype attr)
{
- T((T_CALLED("slk_attroff(%s)"), _traceattr(attr)));
+ T((T_CALLED("slk_attroff(%p,%s)"), (void *) SP_PARM, _traceattr(attr)));
- if (SP != 0 && SP->_slk != 0) {
- TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP->_slk->attr))));
- RemAttr(SP->_slk->attr, attr);
+ if (SP_PARM != 0 && SP_PARM->_slk != 0) {
+ TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
+ RemAttr(SP_PARM->_slk->attr, attr);
if ((attr & A_COLOR) != 0) {
- SetPair(SP->_slk->attr, 0);
+ SetPair(SP_PARM->_slk->attr, 0);
}
- TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP->_slk->attr))));
+ TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
returnCode(OK);
} else
returnCode(ERR);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+slk_attroff(const chtype attr)
+{
+ return NCURSES_SP_NAME(slk_attroff) (CURRENT_SCREEN, attr);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_slkatron.c b/contrib/ncurses/ncurses/base/lib_slkatron.c
index 90add86dc1c8..bc2fb3308eea 100644
--- a/contrib/ncurses/ncurses/base/lib_slkatron.c
+++ b/contrib/ncurses/ncurses/base/lib_slkatron.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -38,21 +38,29 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkatron.c,v 1.8 2005/01/08 23:02:01 tom Exp $")
+MODULE_ID("$Id: lib_slkatron.c,v 1.12 2010/03/31 23:38:02 tom Exp $")
NCURSES_EXPORT(int)
-slk_attron(const chtype attr)
+NCURSES_SP_NAME(slk_attron) (NCURSES_SP_DCLx const chtype attr)
{
- T((T_CALLED("slk_attron(%s)"), _traceattr(attr)));
+ T((T_CALLED("slk_attron(%p,%s)"), (void *) SP_PARM, _traceattr(attr)));
- if (SP != 0 && SP->_slk != 0) {
- TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP->_slk->attr))));
- AddAttr(SP->_slk->attr, attr);
+ if (SP_PARM != 0 && SP_PARM->_slk != 0) {
+ TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
+ AddAttr(SP_PARM->_slk->attr, attr);
if ((attr & A_COLOR) != 0) {
- SetPair(SP->_slk->attr, PAIR_NUMBER(attr));
+ SetPair(SP_PARM->_slk->attr, PairNumber(attr));
}
- TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP->_slk->attr))));
+ TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
returnCode(OK);
} else
returnCode(ERR);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+slk_attron(const chtype attr)
+{
+ return NCURSES_SP_NAME(slk_attron) (CURRENT_SCREEN, attr);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_slkatrset.c b/contrib/ncurses/ncurses/base/lib_slkatrset.c
index 8da9981b3b3e..544b8d0faab7 100644
--- a/contrib/ncurses/ncurses/base/lib_slkatrset.c
+++ b/contrib/ncurses/ncurses/base/lib_slkatrset.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2009 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,16 +38,24 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkatrset.c,v 1.7 2005/01/08 21:46:47 tom Exp $")
+MODULE_ID("$Id: lib_slkatrset.c,v 1.10 2009/10/24 22:12:21 tom Exp $")
NCURSES_EXPORT(int)
-slk_attrset(const chtype attr)
+NCURSES_SP_NAME(slk_attrset) (NCURSES_SP_DCLx const chtype attr)
{
- T((T_CALLED("slk_attrset(%s)"), _traceattr(attr)));
+ T((T_CALLED("slk_attrset(%p,%s)"), (void *) SP_PARM, _traceattr(attr)));
- if (SP != 0 && SP->_slk != 0) {
- SetAttr(SP->_slk->attr, attr);
+ if (SP_PARM != 0 && SP_PARM->_slk != 0) {
+ SetAttr(SP_PARM->_slk->attr, attr);
returnCode(OK);
} else
returnCode(ERR);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+slk_attrset(const chtype attr)
+{
+ return NCURSES_SP_NAME(slk_attrset) (CURRENT_SCREEN, attr);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_slkattr.c b/contrib/ncurses/ncurses/base/lib_slkattr.c
index da82ee5b623e..bec11e84c667 100644
--- a/contrib/ncurses/ncurses/base/lib_slkattr.c
+++ b/contrib/ncurses/ncurses/base/lib_slkattr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -38,19 +38,27 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkattr.c,v 1.6 2005/01/08 21:44:28 tom Exp $")
+MODULE_ID("$Id: lib_slkattr.c,v 1.11 2010/12/20 01:41:25 tom Exp $")
NCURSES_EXPORT(attr_t)
-slk_attr(void)
+NCURSES_SP_NAME(slk_attr) (NCURSES_SP_DCL0)
{
- T((T_CALLED("slk_attr()")));
+ T((T_CALLED("slk_attr(%p)"), (void *) SP_PARM));
- if (SP != 0 && SP->_slk != 0) {
- attr_t result = AttrOf(SP->_slk->attr) & ALL_BUT_COLOR;
- int pair = GetPair(SP->_slk->attr);
+ if (SP_PARM != 0 && SP_PARM->_slk != 0) {
+ attr_t result = AttrOf(SP_PARM->_slk->attr) & ALL_BUT_COLOR;
+ int pair = GetPair(SP_PARM->_slk->attr);
- result |= COLOR_PAIR(pair);
+ result |= (attr_t) ColorPair(pair);
returnAttr(result);
} else
returnAttr(0);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(attr_t)
+slk_attr(void)
+{
+ return NCURSES_SP_NAME(slk_attr) (CURRENT_SCREEN);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_slkclear.c b/contrib/ncurses/ncurses/base/lib_slkclear.c
index 946ceeaf0e0d..264c8c40812c 100644
--- a/contrib/ncurses/ncurses/base/lib_slkclear.c
+++ b/contrib/ncurses/ncurses/base/lib_slkclear.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2009 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,27 +40,35 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkclear.c,v 1.10 2007/12/29 17:51:47 tom Exp $")
+MODULE_ID("$Id: lib_slkclear.c,v 1.14 2009/11/07 16:27:05 tom Exp $")
NCURSES_EXPORT(int)
-slk_clear(void)
+NCURSES_SP_NAME(slk_clear) (NCURSES_SP_DCL0)
{
int rc = ERR;
- T((T_CALLED("slk_clear()")));
+ T((T_CALLED("slk_clear(%p)"), (void *) SP_PARM));
- if (SP != NULL && SP->_slk != NULL) {
- SP->_slk->hidden = TRUE;
+ if (SP_PARM != 0 && SP_PARM->_slk != 0) {
+ SP_PARM->_slk->hidden = TRUE;
/* For simulated SLK's it looks much more natural to
inherit those attributes from the standard screen */
- SP->_slk->win->_nc_bkgd = stdscr->_nc_bkgd;
- WINDOW_ATTRS(SP->_slk->win) = WINDOW_ATTRS(stdscr);
- if (SP->_slk->win == stdscr) {
+ SP_PARM->_slk->win->_nc_bkgd = StdScreen(SP_PARM)->_nc_bkgd;
+ WINDOW_ATTRS(SP_PARM->_slk->win) = WINDOW_ATTRS(StdScreen(SP_PARM));
+ if (SP_PARM->_slk->win == StdScreen(SP_PARM)) {
rc = OK;
} else {
- werase(SP->_slk->win);
- rc = wrefresh(SP->_slk->win);
+ werase(SP_PARM->_slk->win);
+ rc = wrefresh(SP_PARM->_slk->win);
}
}
returnCode(rc);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+slk_clear(void)
+{
+ return NCURSES_SP_NAME(slk_clear) (CURRENT_SCREEN);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_slkcolor.c b/contrib/ncurses/ncurses/base/lib_slkcolor.c
index b677b65a529a..c1211bcb884a 100644
--- a/contrib/ncurses/ncurses/base/lib_slkcolor.c
+++ b/contrib/ncurses/ncurses/base/lib_slkcolor.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2009 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,8 +27,8 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer, 1998 *
- * and: Thomas E. Dickey 2005 *
+ * Author: Juergen Pfeifer, 1998,2009 *
+ * and: Thomas E. Dickey 2005-on *
****************************************************************************/
/*
@@ -38,19 +38,31 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkcolor.c,v 1.12 2005/01/28 21:11:53 tom Exp $")
+MODULE_ID("$Id: lib_slkcolor.c,v 1.16 2009/10/24 22:12:21 tom Exp $")
NCURSES_EXPORT(int)
-slk_color(short color_pair_number)
+NCURSES_SP_NAME(slk_color) (NCURSES_SP_DCLx short color_pair_number)
{
- T((T_CALLED("slk_color(%d)"), color_pair_number));
+ int code = ERR;
+
+ T((T_CALLED("slk_color(%p,%d)"), (void *) SP_PARM, color_pair_number));
+
+ if (SP_PARM != 0
+ && SP_PARM->_slk != 0
+ && color_pair_number >= 0
+ && color_pair_number < SP_PARM->_pair_limit) {
+ TR(TRACE_ATTRS, ("... current is %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
+ SetPair(SP_PARM->_slk->attr, color_pair_number);
+ TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
+ code = OK;
+ }
+ returnCode(code);
+}
- if (SP != 0 && SP->_slk != 0 &&
- color_pair_number >= 0 && color_pair_number < COLOR_PAIRS) {
- TR(TRACE_ATTRS, ("... current is %s", _tracech_t(CHREF(SP->_slk->attr))));
- SetPair(SP->_slk->attr, color_pair_number);
- TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP->_slk->attr))));
- returnCode(OK);
- } else
- returnCode(ERR);
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+slk_color(short color_pair_number)
+{
+ return NCURSES_SP_NAME(slk_color) (CURRENT_SCREEN, color_pair_number);
}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_slkinit.c b/contrib/ncurses/ncurses/base/lib_slkinit.c
index c440109b34e6..9cbdfea98430 100644
--- a/contrib/ncurses/ncurses/base/lib_slkinit.c
+++ b/contrib/ncurses/ncurses/base/lib_slkinit.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 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 *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -39,17 +40,41 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkinit.c,v 1.7 2008/01/12 20:23:39 tom Exp $")
+MODULE_ID("$Id: lib_slkinit.c,v 1.13 2009/10/31 00:10:46 tom Exp $")
+
+#ifdef USE_SP_RIPOFF
+#define SoftkeyFormat SP_PARM->slk_format
+#else
+#define SoftkeyFormat _nc_globals.slk_format
+#endif
NCURSES_EXPORT(int)
-slk_init(int format)
+NCURSES_SP_NAME(slk_init) (NCURSES_SP_DCLx int format)
{
int code = ERR;
- T((T_CALLED("slk_init(%d)"), format));
- if (format >= 0 && format <= 3 && !_nc_globals.slk_format) {
- _nc_globals.slk_format = 1 + format;
- code = _nc_ripoffline(-SLK_LINES(_nc_globals.slk_format), _nc_slk_initialize);
+ START_TRACE();
+ T((T_CALLED("slk_init(%p,%d)"), (void *) SP_PARM, format));
+
+ if (format >= 0
+ && format <= 3
+#ifdef USE_SP_RIPOFF
+ && SP_PARM
+ && SP_PARM->_prescreen
+#endif
+ && !SoftkeyFormat) {
+ SoftkeyFormat = 1 + format;
+ code = NCURSES_SP_NAME(_nc_ripoffline) (NCURSES_SP_ARGx
+ -SLK_LINES(SoftkeyFormat),
+ _nc_slk_initialize);
}
returnCode(code);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+slk_init(int format)
+{
+ return NCURSES_SP_NAME(slk_init) (CURRENT_SCREEN_PRE, format);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_slklab.c b/contrib/ncurses/ncurses/base/lib_slklab.c
index 42bb4ac1425d..d0b2a230796a 100644
--- a/contrib/ncurses/ncurses/base/lib_slklab.c
+++ b/contrib/ncurses/ncurses/base/lib_slklab.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,6 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Juergen Pfeifer, 1998,2009 *
+ * and: Thomas E. Dickey 1998-on *
****************************************************************************/
/*
@@ -38,14 +40,22 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slklab.c,v 1.7 2003/03/29 22:53:48 tom Exp $")
+MODULE_ID("$Id: lib_slklab.c,v 1.10 2009/10/24 22:12:21 tom Exp $")
NCURSES_EXPORT(char *)
-slk_label(int n)
+NCURSES_SP_NAME(slk_label) (NCURSES_SP_DCLx int n)
{
- T((T_CALLED("slk_label(%d)"), n));
+ T((T_CALLED("slk_label(%p,%d)"), (void *) SP_PARM, n));
- if (SP == NULL || SP->_slk == NULL || n < 1 || n > SP->_slk->labcnt)
+ if (SP_PARM == 0 || SP_PARM->_slk == 0 || n < 1 || n > SP_PARM->_slk->labcnt)
returnPtr(0);
- returnPtr(SP->_slk->ent[n - 1].ent_text);
+ returnPtr(SP_PARM->_slk->ent[n - 1].ent_text);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(char *)
+slk_label(int n)
+{
+ return NCURSES_SP_NAME(slk_label) (CURRENT_SCREEN, n);
}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_slkrefr.c b/contrib/ncurses/ncurses/base/lib_slkrefr.c
index cb1beba0e2a1..b06bf8d7f802 100644
--- a/contrib/ncurses/ncurses/base/lib_slkrefr.c
+++ b/contrib/ncurses/ncurses/base/lib_slkrefr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -38,9 +38,18 @@
* Write SLK window to the (virtual) screen.
*/
#include <curses.priv.h>
-#include <term.h> /* num_labels, label_*, plab_norm */
-MODULE_ID("$Id: lib_slkrefr.c,v 1.17 2008/09/27 14:07:53 juergen Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_slkrefr.c,v 1.26 2010/05/01 19:17:28 tom Exp $")
+
+#ifdef USE_TERM_DRIVER
+#define NumLabels InfoOf(SP_PARM).numlabels
+#else
+#define NumLabels num_labels
+#endif
/*
* Paint the info line for the PC style SLK emulation.
@@ -53,7 +62,7 @@ slk_paint_info(WINDOW *win)
if (win && sp && (sp->slk_format == 4)) {
int i;
- mvwhline(win, 0, 0, 0, getmaxx(win));
+ (void) mvwhline(win, 0, 0, 0, getmaxx(win));
wmove(win, 0, 0);
for (i = 0; i < sp->_slk->maxlab; i++) {
@@ -66,31 +75,47 @@ slk_paint_info(WINDOW *win)
* Write the soft labels to the soft-key window.
*/
static void
-slk_intern_refresh(SLK * slk)
+slk_intern_refresh(SCREEN *sp)
{
int i;
- int fmt = SP->slk_format;
+ int fmt;
+ SLK *slk;
+ int numlab;
+
+ if (sp == 0)
+ return;
+
+ slk = sp->_slk;
+ fmt = sp->slk_format;
+ numlab = NumLabels;
+
+ if (slk->hidden)
+ return;
for (i = 0; i < slk->labcnt; i++) {
if (slk->dirty || slk->ent[i].dirty) {
if (slk->ent[i].visible) {
- if (num_labels > 0 && SLK_STDFMT(fmt)) {
+ if (numlab > 0 && SLK_STDFMT(fmt)) {
+#ifdef USE_TERM_DRIVER
+ CallDriver_2(sp, hwlabel, i + 1, slk->ent[i].form_text);
+#else
if (i < num_labels) {
TPUTS_TRACE("plab_norm");
putp(TPARM_2(plab_norm, i + 1, slk->ent[i].form_text));
}
+#endif
} else {
if (fmt == 4)
slk_paint_info(slk->win);
wmove(slk->win, SLK_LINES(fmt) - 1, slk->ent[i].ent_x);
- if (SP->_slk) {
- wattrset(slk->win, AttrOf(SP->_slk->attr));
+ if (sp->_slk) {
+ (void) wattrset(slk->win, AttrOf(sp->_slk->attr));
}
waddstr(slk->win, slk->ent[i].form_text);
/* if we simulate SLK's, it's looking much more
natural to use the current ATTRIBUTE also
for the label window */
- wattrset(slk->win, WINDOW_ATTRS(stdscr));
+ (void) wattrset(slk->win, WINDOW_ATTRS(StdScreen(sp)));
}
}
slk->ent[i].dirty = FALSE;
@@ -98,7 +123,10 @@ slk_intern_refresh(SLK * slk)
}
slk->dirty = FALSE;
- if (num_labels > 0) {
+ if (numlab > 0) {
+#ifdef USE_TERM_DRIVER
+ CallDriver_1(sp, hwlabelOnOff, slk->hidden ? FALSE : TRUE);
+#else
if (slk->hidden) {
TPUTS_TRACE("label_off");
putp(label_off);
@@ -106,6 +134,7 @@ slk_intern_refresh(SLK * slk)
TPUTS_TRACE("label_on");
putp(label_on);
}
+#endif
}
}
@@ -113,32 +142,48 @@ slk_intern_refresh(SLK * slk)
* Refresh the soft labels.
*/
NCURSES_EXPORT(int)
-slk_noutrefresh(void)
+NCURSES_SP_NAME(slk_noutrefresh) (NCURSES_SP_DCL0)
{
- T((T_CALLED("slk_noutrefresh()")));
+ T((T_CALLED("slk_noutrefresh(%p)"), (void *) SP_PARM));
- if (SP == NULL || SP->_slk == NULL)
+ if (SP_PARM == 0 || SP_PARM->_slk == 0)
returnCode(ERR);
- if (SP->_slk->hidden)
+ if (SP_PARM->_slk->hidden)
returnCode(OK);
- slk_intern_refresh(SP->_slk);
+ slk_intern_refresh(SP_PARM);
- returnCode(wnoutrefresh(SP->_slk->win));
+ returnCode(wnoutrefresh(SP_PARM->_slk->win));
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+slk_noutrefresh(void)
+{
+ return NCURSES_SP_NAME(slk_noutrefresh) (CURRENT_SCREEN);
+}
+#endif
+
/*
* Refresh the soft labels.
*/
NCURSES_EXPORT(int)
-slk_refresh(void)
+NCURSES_SP_NAME(slk_refresh) (NCURSES_SP_DCL0)
{
- T((T_CALLED("slk_refresh()")));
+ T((T_CALLED("slk_refresh(%p)"), (void *) SP_PARM));
- if (SP == NULL || SP->_slk == NULL)
+ if (SP_PARM == 0 || SP_PARM->_slk == 0)
returnCode(ERR);
- if (SP->_slk->hidden)
+ if (SP_PARM->_slk->hidden)
returnCode(OK);
- slk_intern_refresh(SP->_slk);
+ slk_intern_refresh(SP_PARM);
+
+ returnCode(wrefresh(SP_PARM->_slk->win));
+}
- returnCode(wrefresh(SP->_slk->win));
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+slk_refresh(void)
+{
+ return NCURSES_SP_NAME(slk_refresh) (CURRENT_SCREEN);
}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_slkset.c b/contrib/ncurses/ncurses/base/lib_slkset.c
index e19f88e60ac4..91483f103b23 100644
--- a/contrib/ncurses/ncurses/base/lib_slkset.c
+++ b/contrib/ncurses/ncurses/base/lib_slkset.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -44,10 +44,10 @@
#endif
#endif
-MODULE_ID("$Id: lib_slkset.c,v 1.17 2007/10/13 20:08:46 tom Exp $")
+MODULE_ID("$Id: lib_slkset.c,v 1.21 2010/12/25 23:43:58 tom Exp $")
NCURSES_EXPORT(int)
-slk_set(int i, const char *astr, int format)
+NCURSES_SP_NAME(slk_set) (NCURSES_SP_DCLx int i, const char *astr, int format)
{
SLK *slk;
int offset;
@@ -57,20 +57,20 @@ slk_set(int i, const char *astr, int format)
const char *str = astr;
const char *p;
- T((T_CALLED("slk_set(%d, \"%s\", %d)"), i, str, format));
+ T((T_CALLED("slk_set(%p, %d, \"%s\", %d)"), (void *) SP_PARM, i, str, format));
- if (SP == 0
- || (slk = SP->_slk) == 0
+ if (SP_PARM == 0
+ || (slk = SP_PARM->_slk) == 0
|| i < 1
|| i > slk->labcnt
|| format < 0
|| format > 2)
returnCode(ERR);
- if (str == NULL)
+ if (str == 0)
str = "";
--i; /* Adjust numbering of labels */
- limit = MAX_SKEY_LEN(SP->slk_format);
+ limit = MAX_SKEY_LEN(SP_PARM->slk_format);
while (isspace(UChar(*str)))
str++; /* skip over leading spaces */
p = str;
@@ -94,12 +94,12 @@ slk_set(int i, const char *astr, int format)
numcols += wcwidth(wc);
p += need;
}
- numchrs = (p - str);
+ numchrs = (int) (p - str);
#else
while (isprint(UChar(*p)))
p++; /* The first non-print stops */
- numcols = (p - str);
+ numcols = (int) (p - str);
if (numcols > limit)
numcols = limit;
numchrs = numcols;
@@ -147,3 +147,11 @@ slk_set(int i, const char *astr, int format)
slk->ent[i].dirty = TRUE;
returnCode(OK);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+slk_set(int i, const char *astr, int format)
+{
+ return NCURSES_SP_NAME(slk_set) (CURRENT_SCREEN, i, astr, format);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_slktouch.c b/contrib/ncurses/ncurses/base/lib_slktouch.c
index 5eb5df385b82..ba77fd2375b7 100644
--- a/contrib/ncurses/ncurses/base/lib_slktouch.c
+++ b/contrib/ncurses/ncurses/base/lib_slktouch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000,2009 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,8 +27,8 @@
****************************************************************************/
/****************************************************************************
- * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
- * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * Author: Juergen Pfeifer 1997,2009 *
+ * and: Thomas E. Dickey 1996-on *
****************************************************************************/
/*
@@ -38,16 +38,24 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slktouch.c,v 1.5 2000/12/10 02:43:27 tom Exp $")
+MODULE_ID("$Id: lib_slktouch.c,v 1.8 2009/10/24 22:12:21 tom Exp $")
NCURSES_EXPORT(int)
-slk_touch(void)
+NCURSES_SP_NAME(slk_touch) (NCURSES_SP_DCL0)
{
- T((T_CALLED("slk_touch()")));
+ T((T_CALLED("slk_touch(%p)"), (void *) SP_PARM));
- if (SP == NULL || SP->_slk == NULL)
+ if (SP_PARM == 0 || SP_PARM->_slk == 0)
returnCode(ERR);
- SP->_slk->dirty = TRUE;
+ SP_PARM->_slk->dirty = TRUE;
returnCode(OK);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+slk_touch(void)
+{
+ return NCURSES_SP_NAME(slk_touch) (CURRENT_SCREEN);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/lib_touch.c b/contrib/ncurses/ncurses/base/lib_touch.c
index 2ac21f2e0d1f..8023c7058027 100644
--- a/contrib/ncurses/ncurses/base/lib_touch.c
+++ b/contrib/ncurses/ncurses/base/lib_touch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -43,12 +43,12 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_touch.c,v 1.9 2000/12/10 02:43:27 tom Exp $")
+MODULE_ID("$Id: lib_touch.c,v 1.11 2010/12/19 01:22:58 tom Exp $")
NCURSES_EXPORT(bool)
is_linetouched(WINDOW *win, int line)
{
- T((T_CALLED("is_linetouched(%p,%d)"), win, line));
+ T((T_CALLED("is_linetouched(%p,%d)"), (void *) win, line));
/* XSI doesn't define any error */
if (!win || (line > win->_maxy) || (line < 0))
@@ -62,7 +62,7 @@ is_wintouched(WINDOW *win)
{
int i;
- T((T_CALLED("is_wintouched(%p)"), win));
+ T((T_CALLED("is_wintouched(%p)"), (void *) win));
if (win)
for (i = 0; i <= win->_maxy; i++)
@@ -76,7 +76,7 @@ wtouchln(WINDOW *win, int y, int n, int changed)
{
int i;
- T((T_CALLED("wtouchln(%p,%d,%d,%d)"), win, y, n, changed));
+ T((T_CALLED("wtouchln(%p,%d,%d,%d)"), (void *) win, y, n, changed));
if (!win || (n < 0) || (y < 0) || (y > win->_maxy))
returnCode(ERR);
@@ -85,7 +85,9 @@ wtouchln(WINDOW *win, int y, int n, int changed)
if (i > win->_maxy)
break;
win->_line[i].firstchar = changed ? 0 : _NOCHANGE;
- win->_line[i].lastchar = changed ? win->_maxx : _NOCHANGE;
+ win->_line[i].lastchar = (NCURSES_SIZE_T) (changed
+ ? win->_maxx
+ : _NOCHANGE);
}
returnCode(OK);
}
diff --git a/contrib/ncurses/ncurses/base/lib_ungetch.c b/contrib/ncurses/ncurses/base/lib_ungetch.c
index 8742f867fa94..63a14cff7594 100644
--- a/contrib/ncurses/ncurses/base/lib_ungetch.c
+++ b/contrib/ncurses/ncurses/base/lib_ungetch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 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 *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -41,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_ungetch.c,v 1.11 2008/05/31 16:44:54 tom Exp $")
+MODULE_ID("$Id: lib_ungetch.c,v 1.14 2009/10/24 22:12:21 tom Exp $")
#include <fifo_defs.h>
@@ -57,10 +58,12 @@ _nc_fifo_dump(SCREEN *sp)
#endif /* TRACE */
NCURSES_EXPORT(int)
-_nc_ungetch(SCREEN *sp, int ch)
+safe_ungetch(SCREEN *sp, int ch)
{
int rc = ERR;
+ T((T_CALLED("ungetch(%p,%s)"), (void *) sp, _nc_tracechar(sp, ch)));
+
if (tail != -1) {
if (head == -1) {
head = 0;
@@ -79,12 +82,11 @@ _nc_ungetch(SCREEN *sp, int ch)
#endif
rc = OK;
}
- return rc;
+ returnCode(rc);
}
NCURSES_EXPORT(int)
ungetch(int ch)
{
- T((T_CALLED("ungetch(%s)"), _nc_tracechar(SP, ch)));
- returnCode(_nc_ungetch(SP, ch));
+ return safe_ungetch(CURRENT_SCREEN, ch);
}
diff --git a/contrib/ncurses/ncurses/base/lib_vline.c b/contrib/ncurses/ncurses/base/lib_vline.c
index 1a2537e7eb6a..2f3148eca77c 100644
--- a/contrib/ncurses/ncurses/base/lib_vline.c
+++ b/contrib/ncurses/ncurses/base/lib_vline.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2001,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -40,16 +40,16 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_vline.c,v 1.10 2006/03/11 21:52:19 tom Exp $")
+MODULE_ID("$Id: lib_vline.c,v 1.12 2010/12/19 01:22:58 tom Exp $")
NCURSES_EXPORT(int)
wvline(WINDOW *win, chtype ch, int n)
{
int code = ERR;
- NCURSES_SIZE_T row, col;
- NCURSES_SIZE_T end;
+ int row, col;
+ int end;
- T((T_CALLED("wvline(%p,%s,%d)"), win, _tracechtype(ch), n));
+ T((T_CALLED("wvline(%p,%s,%d)"), (void *) win, _tracechtype(ch), n));
if (win) {
NCURSES_CH_T wch;
diff --git a/contrib/ncurses/ncurses/base/lib_wattroff.c b/contrib/ncurses/ncurses/base/lib_wattroff.c
index bf2020e06027..fff0b395f1d8 100644
--- a/contrib/ncurses/ncurses/base/lib_wattroff.c
+++ b/contrib/ncurses/ncurses/base/lib_wattroff.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2009 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,12 +42,12 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_wattroff.c,v 1.9 2006/05/27 19:30:33 tom Exp $")
+MODULE_ID("$Id: lib_wattroff.c,v 1.10 2009/10/24 22:36:08 tom Exp $")
NCURSES_EXPORT(int)
wattr_off(WINDOW *win, attr_t at, void *opts GCC_UNUSED)
{
- T((T_CALLED("wattr_off(%p,%s)"), win, _traceattr(at)));
+ T((T_CALLED("wattr_off(%p,%s)"), (void *) win, _traceattr(at)));
if (win) {
T(("... current %s (%d)",
_traceattr(WINDOW_ATTRS(win)),
diff --git a/contrib/ncurses/ncurses/base/lib_wattron.c b/contrib/ncurses/ncurses/base/lib_wattron.c
index 2e17d965e94a..3806285e2a38 100644
--- a/contrib/ncurses/ncurses/base/lib_wattron.c
+++ b/contrib/ncurses/ncurses/base/lib_wattron.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -42,12 +42,12 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_wattron.c,v 1.9 2006/05/27 19:30:46 tom Exp $")
+MODULE_ID("$Id: lib_wattron.c,v 1.11 2010/03/31 23:38:02 tom Exp $")
NCURSES_EXPORT(int)
wattr_on(WINDOW *win, attr_t at, void *opts GCC_UNUSED)
{
- T((T_CALLED("wattr_on(%p,%s)"), win, _traceattr(at)));
+ T((T_CALLED("wattr_on(%p,%s)"), (void *) win, _traceattr(at)));
if (win != 0) {
T(("... current %s (%d)",
_traceattr(WINDOW_ATTRS(win)),
@@ -55,7 +55,7 @@ wattr_on(WINDOW *win, attr_t at, void *opts GCC_UNUSED)
if_EXT_COLORS({
if (at & A_COLOR)
- win->_color = PAIR_NUMBER(at);
+ win->_color = PairNumber(at);
});
toggle_attr_on(WINDOW_ATTRS(win), at);
returnCode(OK);
diff --git a/contrib/ncurses/ncurses/base/lib_winch.c b/contrib/ncurses/ncurses/base/lib_winch.c
index 18da9c594945..7e75f85bf390 100644
--- a/contrib/ncurses/ncurses/base/lib_winch.c
+++ b/contrib/ncurses/ncurses/base/lib_winch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -39,16 +39,16 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_winch.c,v 1.5 2001/06/02 23:42:08 skimo Exp $")
+MODULE_ID("$Id: lib_winch.c,v 1.8 2010/12/19 01:22:58 tom Exp $")
NCURSES_EXPORT(chtype)
winch(WINDOW *win)
{
- T((T_CALLED("winch(%p)"), win));
+ T((T_CALLED("winch(%p)"), (void *) win));
if (win != 0) {
- returnChar(CharOf(win->_line[win->_cury].text[win->_curx]) |
- AttrOf(win->_line[win->_cury].text[win->_curx]));
+ returnChtype((chtype) CharOf(win->_line[win->_cury].text[win->_curx])
+ | AttrOf(win->_line[win->_cury].text[win->_curx]));
} else {
- returnChar(0);
+ returnChtype(0);
}
}
diff --git a/contrib/ncurses/ncurses/base/lib_window.c b/contrib/ncurses/ncurses/base/lib_window.c
index a3236e206a37..4baa36943c44 100644
--- a/contrib/ncurses/ncurses/base/lib_window.c
+++ b/contrib/ncurses/ncurses/base/lib_window.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -39,7 +39,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_window.c,v 1.25 2008/06/07 14:12:56 tom Exp $")
+MODULE_ID("$Id: lib_window.c,v 1.29 2010/12/19 01:47:22 tom Exp $")
NCURSES_EXPORT(void)
_nc_synchook(WINDOW *win)
@@ -57,32 +57,30 @@ mvderwin(WINDOW *win, int y, int x)
{
WINDOW *orig;
int i;
+ int rc = ERR;
- T((T_CALLED("mvderwin(%p,%d,%d)"), win, y, x));
+ T((T_CALLED("mvderwin(%p,%d,%d)"), (void *) win, y, x));
- if (win && (orig = win->_parent)) {
- if (win->_parx == x && win->_pary == y)
- returnCode(OK);
- if (x < 0 || y < 0)
- returnCode(ERR);
- if ((x + getmaxx(win) > getmaxx(orig)) ||
- (y + getmaxy(win) > getmaxy(orig)))
- returnCode(ERR);
- } else
- returnCode(ERR);
- wsyncup(win);
- win->_parx = x;
- win->_pary = y;
- for (i = 0; i < getmaxy(win); i++)
- win->_line[i].text = &(orig->_line[y++].text[x]);
- returnCode(OK);
+ if (win != 0
+ && (orig = win->_parent) != 0
+ && (x >= 0 && y >= 0)
+ && (x + getmaxx(win) <= getmaxx(orig))
+ && (y + getmaxy(win) <= getmaxy(orig))) {
+ wsyncup(win);
+ win->_parx = x;
+ win->_pary = y;
+ for (i = 0; i < getmaxy(win); i++)
+ win->_line[i].text = &(orig->_line[y++].text[x]);
+ rc = OK;
+ }
+ returnCode(rc);
}
NCURSES_EXPORT(int)
syncok(WINDOW *win, bool bf)
/* enable/disable automatic wsyncup() on each change to window */
{
- T((T_CALLED("syncok(%p,%d)"), win, bf));
+ T((T_CALLED("syncok(%p,%d)"), (void *) win, bf));
if (win) {
win->_sync = bf;
@@ -98,7 +96,7 @@ wsyncup(WINDOW *win)
{
WINDOW *wp;
- T((T_CALLED("wsyncup(%p)"), win));
+ T((T_CALLED("wsyncup(%p)"), (void *) win));
if (win && win->_parent) {
for (wp = win; wp->_parent; wp = wp->_parent) {
int y;
@@ -128,7 +126,7 @@ wsyncdown(WINDOW *win)
/* mark changed every cell in win that is changed in any of its ancestors */
/* Rewritten by J. Pfeifer, 1-Apr-96 (don't even think that...) */
{
- T((T_CALLED("wsyncdown(%p)"), win));
+ T((T_CALLED("wsyncdown(%p)"), (void *) win));
if (win && win->_parent) {
WINDOW *pp = win->_parent;
@@ -167,7 +165,7 @@ wcursyncup(WINDOW *win)
{
WINDOW *wp;
- T((T_CALLED("wcursyncup(%p)"), win));
+ T((T_CALLED("wcursyncup(%p)"), (void *) win));
for (wp = win; wp && wp->_parent; wp = wp->_parent) {
wmove(wp->_parent, wp->_pary + wp->_cury, wp->_parx + wp->_curx);
}
@@ -182,19 +180,23 @@ dupwin(WINDOW *win)
size_t linesize;
int i;
- T((T_CALLED("dupwin(%p)"), win));
+ T((T_CALLED("dupwin(%p)"), (void *) win));
if (win != 0) {
-
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = _nc_screen_of(win);
+#endif
_nc_lock_global(curses);
if (win->_flags & _ISPAD) {
- nwin = newpad(win->_maxy + 1,
- win->_maxx + 1);
+ nwin = NCURSES_SP_NAME(newpad) (NCURSES_SP_ARGx
+ win->_maxy + 1,
+ win->_maxx + 1);
} else {
- nwin = newwin(win->_maxy + 1,
- win->_maxx + 1,
- win->_begy,
- win->_begx);
+ nwin = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx
+ win->_maxy + 1,
+ win->_maxx + 1,
+ win->_begy,
+ win->_begx);
}
if (nwin != 0) {
@@ -237,7 +239,7 @@ dupwin(WINDOW *win)
if (win->_flags & _ISPAD)
nwin->_pad = win->_pad;
- linesize = (win->_maxx + 1) * sizeof(NCURSES_CH_T);
+ linesize = (unsigned) (win->_maxx + 1) * sizeof(NCURSES_CH_T);
for (i = 0; i <= nwin->_maxy; i++) {
memcpy(nwin->_line[i].text, win->_line[i].text, linesize);
nwin->_line[i].firstchar = win->_line[i].firstchar;
diff --git a/contrib/ncurses/ncurses/base/nc_panel.c b/contrib/ncurses/ncurses/base/nc_panel.c
index 59bfbbe86ef6..69b10bc0c662 100644
--- a/contrib/ncurses/ncurses/base/nc_panel.c
+++ b/contrib/ncurses/ncurses/base/nc_panel.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2000,2009 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,10 +32,22 @@
#include <curses.priv.h>
-MODULE_ID("$Id: nc_panel.c,v 1.4 2000/12/10 02:43:28 tom Exp $")
+MODULE_ID("$Id: nc_panel.c,v 1.5 2009/04/11 21:05:10 tom Exp $")
NCURSES_EXPORT(struct panelhook *)
+NCURSES_SP_NAME(_nc_panelhook) (NCURSES_SP_DCL0)
+{
+ return (SP_PARM
+ ? &(SP_PARM->_panelHook)
+ : (CURRENT_SCREEN
+ ? &(CURRENT_SCREEN->_panelHook)
+ : 0));
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(struct panelhook *)
_nc_panelhook(void)
{
- return (SP ? &(SP->_panelHook) : NULL);
+ return NCURSES_SP_NAME(_nc_panelhook) (CURRENT_SCREEN);
}
+#endif
diff --git a/contrib/ncurses/ncurses/base/resizeterm.c b/contrib/ncurses/ncurses/base/resizeterm.c
index a94cfc3aaaa8..3f1d36e89d7a 100644
--- a/contrib/ncurses/ncurses/base/resizeterm.c
+++ b/contrib/ncurses/ncurses/base/resizeterm.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2011 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,6 +28,7 @@
/****************************************************************************
* Author: Thomas E. Dickey *
+ * and: Juergen Pfeifer *
****************************************************************************/
/*
@@ -39,11 +40,12 @@
*/
#include <curses.priv.h>
-#include <term.h>
-MODULE_ID("$Id: resizeterm.c,v 1.34 2008/06/07 13:58:40 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
-#define stolen_lines (screen_lines - SP->_lines_avail)
+MODULE_ID("$Id: resizeterm.c,v 1.43 2011/01/10 01:34:49 tom Exp $")
/*
* If we're trying to be reentrant, do not want any local statics.
@@ -64,18 +66,23 @@ static int current_cols;
static void
show_window_sizes(const char *name)
{
+ SCREEN *sp;
WINDOWLIST *wp;
_nc_lock_global(curses);
- _tracef("%s resizing: %2d x %2d (%2d x %2d)", name, LINES, COLS,
- screen_lines, screen_columns);
- for (each_window(wp)) {
- _tracef(" window %p is %2ld x %2ld at %2ld,%2ld",
- &(wp->win),
- (long) wp->win._maxy + 1,
- (long) wp->win._maxx + 1,
- (long) wp->win._begy,
- (long) wp->win._begx);
+ for (each_screen(sp)) {
+ _tracef("%s resizing: %p: %2d x %2d (%2d x %2d)", name, (void *) sp,
+ *(ptrLines(sp)),
+ *(ptrCols(sp)),
+ screen_lines(sp), screen_columns(sp));
+ for (each_window(sp, wp)) {
+ _tracef(" window %p is %2ld x %2ld at %2ld,%2ld",
+ (void *) &(wp->win),
+ (long) wp->win._maxy + 1,
+ (long) wp->win._maxx + 1,
+ (long) wp->win._begy,
+ (long) wp->win._begx);
+ }
}
_nc_unlock_global(curses);
}
@@ -86,15 +93,23 @@ show_window_sizes(const char *name)
* structure's size.
*/
NCURSES_EXPORT(bool)
-is_term_resized(int ToLines, int ToCols)
+NCURSES_SP_NAME(is_term_resized) (NCURSES_SP_DCLx int ToLines, int ToCols)
{
- T((T_CALLED("is_term_resized(%d, %d)"), ToLines, ToCols));
+ T((T_CALLED("is_term_resized(%p, %d, %d)"), (void *) SP_PARM, ToLines, ToCols));
returnCode(ToLines > 0
&& ToCols > 0
- && (ToLines != screen_lines
- || ToCols != screen_columns));
+ && (ToLines != screen_lines(SP_PARM)
+ || ToCols != screen_columns(SP_PARM)));
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(bool)
+is_term_resized(int ToLines, int ToCols)
+{
+ return NCURSES_SP_NAME(is_term_resized) (CURRENT_SCREEN, ToLines, ToCols);
+}
+#endif
+
/*
*/
static ripoff_t *
@@ -104,6 +119,9 @@ ripped_window(WINDOW *win)
ripoff_t *rop;
if (win != 0) {
+#ifdef USE_SP_RIPOFF
+ SCREEN *sp = _nc_screen_of(win);
+#endif
for (each_ripoff(rop)) {
if (rop->win == win && rop->line != 0) {
result = rop;
@@ -125,6 +143,9 @@ ripped_bottom(WINDOW *win)
ripoff_t *rop;
if (win != 0) {
+#ifdef USE_SP_RIPOFF
+ SCREEN *sp = _nc_screen_of(win);
+#endif
for (each_ripoff(rop)) {
if (rop->line < 0) {
result -= rop->line;
@@ -146,9 +167,12 @@ child_depth(WINDOW *cmp)
int depth = 0;
if (cmp != 0) {
+#ifdef USE_SP_WINDOWLIST
+ SCREEN *sp = _nc_screen_of(cmp);
+#endif
WINDOWLIST *wp;
- for (each_window(wp)) {
+ for (each_window(sp, wp)) {
WINDOW *tst = &(wp->win);
if (tst->_parent == cmp) {
depth = 1 + child_depth(tst);
@@ -184,13 +208,13 @@ static int
adjust_window(WINDOW *win, int ToLines, int ToCols, int stolen EXTRA_DCLS)
{
int result;
- int bottom = CurLines + SP->_topstolen - stolen;
+ int bottom = CurLines + _nc_screen_of(win)->_topstolen - stolen;
int myLines = win->_maxy + 1;
int myCols = win->_maxx + 1;
ripoff_t *rop = ripped_window(win);
T((T_CALLED("adjust_window(%p,%d,%d)%s depth %d/%d currently %ldx%ld at %ld,%ld"),
- win, ToLines, ToCols,
+ (void *) win, ToLines, ToCols,
(rop != 0) ? " (rip)" : "",
parent_depth(win),
child_depth(win),
@@ -202,13 +226,19 @@ adjust_window(WINDOW *win, int ToLines, int ToCols, int stolen EXTRA_DCLS)
* If it is a ripped-off window at the bottom of the screen, simply
* move it to the same relative position.
*/
- win->_begy = ToLines - ripped_bottom(win) - 0 - win->_yoffset;
+ win->_begy = (NCURSES_SIZE_T) (ToLines - ripped_bottom(win) - 0 - win->_yoffset);
+ if (rop->hook == _nc_slk_initialize)
+ _nc_format_slks(
+#if NCURSES_SP_FUNCS
+ _nc_screen_of(win),
+#endif
+ ToCols);
} else if (win->_begy >= bottom) {
/*
* If it is below the bottom of the new screen, move up by the same
* amount that the screen shrank.
*/
- win->_begy += (ToLines - CurLines);
+ win->_begy = (NCURSES_SIZE_T) (win->_begy + (ToLines - CurLines));
} else {
if (myLines == (CurLines - stolen)
&& ToLines != CurLines) {
@@ -239,19 +269,19 @@ adjust_window(WINDOW *win, int ToLines, int ToCols, int stolen EXTRA_DCLS)
* children, decrease those to fit, then decrease the containing window, etc.
*/
static int
-decrease_size(int ToLines, int ToCols, int stolen EXTRA_DCLS)
+decrease_size(NCURSES_SP_DCLx int ToLines, int ToCols, int stolen EXTRA_DCLS)
{
bool found;
int depth = 0;
WINDOWLIST *wp;
- T((T_CALLED("decrease_size(%d, %d)"), ToLines, ToCols));
+ T((T_CALLED("decrease_size(%p, %d, %d)"), (void *) SP_PARM, ToLines, ToCols));
do {
found = FALSE;
TR(TRACE_UPDATE, ("decreasing size of windows to %dx%d, depth=%d",
ToLines, ToCols, depth));
- for (each_window(wp)) {
+ for (each_window(SP_PARM, wp)) {
WINDOW *win = &(wp->win);
if (!(win->_flags & _ISPAD)) {
@@ -273,19 +303,19 @@ decrease_size(int ToLines, int ToCols, int stolen EXTRA_DCLS)
* parent, increase those to fit, then increase the contained window, etc.
*/
static int
-increase_size(int ToLines, int ToCols, int stolen EXTRA_DCLS)
+increase_size(NCURSES_SP_DCLx int ToLines, int ToCols, int stolen EXTRA_DCLS)
{
bool found;
int depth = 0;
WINDOWLIST *wp;
- T((T_CALLED("increase_size(%d, %d)"), ToLines, ToCols));
+ T((T_CALLED("increase_size(%p, %d, %d)"), (void *) SP_PARM, ToLines, ToCols));
do {
found = FALSE;
TR(TRACE_UPDATE, ("increasing size of windows to %dx%d, depth=%d",
ToLines, ToCols, depth));
- for (each_window(wp)) {
+ for (each_window(SP_PARM, wp)) {
WINDOW *win = &(wp->win);
if (!(win->_flags & _ISPAD)) {
@@ -307,25 +337,26 @@ increase_size(int ToLines, int ToCols, int stolen EXTRA_DCLS)
* such as ungetch().
*/
NCURSES_EXPORT(int)
-resize_term(int ToLines, int ToCols)
+NCURSES_SP_NAME(resize_term) (NCURSES_SP_DCLx int ToLines, int ToCols)
{
int result = OK EXTRA_ARGS;
int was_stolen;
- T((T_CALLED("resize_term(%d,%d) old(%d,%d)"),
- ToLines, ToCols,
- screen_lines, screen_columns));
+ T((T_CALLED("resize_term(%p,%d,%d) old(%d,%d)"),
+ (void *) SP_PARM, ToLines, ToCols,
+ (SP_PARM == 0) ? -1 : screen_lines(SP_PARM),
+ (SP_PARM == 0) ? -1 : screen_columns(SP_PARM)));
- if (SP == 0) {
+ if (SP_PARM == 0) {
returnCode(ERR);
}
- _nc_lock_global(curses);
+ _nc_nonsp_lock_global(curses);
- was_stolen = (screen_lines - SP->_lines_avail);
- if (is_term_resized(ToLines, ToCols)) {
- int myLines = CurLines = screen_lines;
- int myCols = CurCols = screen_columns;
+ was_stolen = (screen_lines(SP_PARM) - SP_PARM->_lines_avail);
+ if (NCURSES_SP_NAME(is_term_resized) (NCURSES_SP_ARGx ToLines, ToCols)) {
+ int myLines = CurLines = screen_lines(SP_PARM);
+ int myCols = CurCols = screen_columns(SP_PARM);
#ifdef TRACE
if (USE_TRACEF(TRACE_UPDATE)) {
@@ -333,33 +364,42 @@ resize_term(int ToLines, int ToCols)
_nc_unlock_global(tracef);
}
#endif
- if (ToLines > screen_lines) {
- increase_size(myLines = ToLines, myCols, was_stolen EXTRA_ARGS);
+ if (ToLines > screen_lines(SP_PARM)) {
+ increase_size(NCURSES_SP_ARGx
+ myLines = ToLines, myCols, was_stolen EXTRA_ARGS);
CurLines = myLines;
CurCols = myCols;
}
- if (ToCols > screen_columns) {
- increase_size(myLines, myCols = ToCols, was_stolen EXTRA_ARGS);
+ if (ToCols > screen_columns(SP_PARM)) {
+ increase_size(NCURSES_SP_ARGx
+ myLines, myCols = ToCols, was_stolen EXTRA_ARGS);
CurLines = myLines;
CurCols = myCols;
}
if (ToLines < myLines ||
ToCols < myCols) {
- decrease_size(ToLines, ToCols, was_stolen EXTRA_ARGS);
+ decrease_size(NCURSES_SP_ARGx ToLines, ToCols, was_stolen EXTRA_ARGS);
}
- screen_lines = lines = ToLines;
- screen_columns = columns = ToCols;
+ screen_lines(SP_PARM) = (NCURSES_SIZE_T) ToLines;
+ screen_columns(SP_PARM) = (NCURSES_SIZE_T) ToCols;
- SP->_lines_avail = lines - was_stolen;
+#ifdef USE_TERM_DRIVER
+ CallDriver_2(SP_PARM, setsize, ToLines, ToCols);
+#else
+ lines = (NCURSES_SIZE_T) ToLines;
+ columns = (NCURSES_SIZE_T) ToCols;
+#endif
- if (SP->oldhash) {
- FreeAndNull(SP->oldhash);
+ SP_PARM->_lines_avail = (NCURSES_SIZE_T) (ToLines - was_stolen);
+
+ if (SP_PARM->oldhash) {
+ FreeAndNull(SP_PARM->oldhash);
}
- if (SP->newhash) {
- FreeAndNull(SP->newhash);
+ if (SP_PARM->newhash) {
+ FreeAndNull(SP_PARM->newhash);
}
#ifdef TRACE
if (USE_TRACEF(TRACE_UPDATE)) {
@@ -378,11 +418,23 @@ resize_term(int ToLines, int ToCols)
SET_LINES(ToLines - was_stolen);
SET_COLS(ToCols);
- _nc_unlock_global(curses);
+ _nc_nonsp_unlock_global(curses);
returnCode(result);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+resize_term(int ToLines, int ToCols)
+{
+ int res = ERR;
+ _nc_sp_lock_global(curses);
+ res = NCURSES_SP_NAME(resize_term) (CURRENT_SCREEN, ToLines, ToCols);
+ _nc_sp_unlock_global(curses);
+ return (res);
+}
+#endif
+
/*
* This function reallocates NCURSES window structures. It is invoked in
* response to a SIGWINCH interrupt. Other user-defined windows may also need
@@ -392,34 +444,35 @@ resize_term(int ToLines, int ToCols)
* invoked directly from the signal handler.
*/
NCURSES_EXPORT(int)
-resizeterm(int ToLines, int ToCols)
+NCURSES_SP_NAME(resizeterm) (NCURSES_SP_DCLx int ToLines, int ToCols)
{
int result = ERR;
- T((T_CALLED("resizeterm(%d,%d) old(%d,%d)"),
- ToLines, ToCols,
- screen_lines, screen_columns));
+ T((T_CALLED("resizeterm(%p, %d,%d) old(%d,%d)"),
+ (void *) SP_PARM, ToLines, ToCols,
+ (SP_PARM == 0) ? -1 : screen_lines(SP_PARM),
+ (SP_PARM == 0) ? -1 : screen_columns(SP_PARM)));
- if (SP != 0) {
+ if (SP_PARM != 0) {
result = OK;
- SP->_sig_winch = FALSE;
+ SP_PARM->_sig_winch = FALSE;
- if (is_term_resized(ToLines, ToCols)) {
+ if (NCURSES_SP_NAME(is_term_resized) (NCURSES_SP_ARGx ToLines, ToCols)) {
#if USE_SIGWINCH
ripoff_t *rop;
- bool slk_visible = (SP != 0
- && SP->_slk != 0
- && !(SP->_slk->hidden));
+ bool slk_visible = (SP_PARM != 0
+ && SP_PARM->_slk != 0
+ && !(SP_PARM->_slk->hidden));
if (slk_visible) {
slk_clear();
}
#endif
- result = resize_term(ToLines, ToCols);
+ result = NCURSES_SP_NAME(resize_term) (NCURSES_SP_ARGx ToLines, ToCols);
#if USE_SIGWINCH
- _nc_ungetch(SP, KEY_RESIZE); /* so application can know this */
- clearok(curscr, TRUE); /* screen contents are unknown */
+ safe_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */
+ clearok(CurScreen(SP_PARM), TRUE); /* screen contents are unknown */
/* ripped-off lines are a special case: if we did not lengthen
* them, we haven't moved them either. repaint them, too.
@@ -429,7 +482,7 @@ resizeterm(int ToLines, int ToCols)
* not know which are really on top.
*/
for (each_ripoff(rop)) {
- if (rop->win != stdscr
+ if (rop->win != StdScreen(SP_PARM)
&& rop->win != 0
&& rop->line < 0) {
@@ -442,10 +495,9 @@ resizeterm(int ToLines, int ToCols)
/* soft-keys are a special case: we _know_ how to repaint them */
if (slk_visible) {
- slk_restore();
- slk_touch();
-
- slk_refresh();
+ NCURSES_SP_NAME(slk_restore) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(slk_touch) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(slk_refresh) (NCURSES_SP_ARG);
}
#endif
}
@@ -453,3 +505,11 @@ resizeterm(int ToLines, int ToCols)
returnCode(result);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+resizeterm(int ToLines, int ToCols)
+{
+ return NCURSES_SP_NAME(resizeterm) (CURRENT_SCREEN, ToLines, ToCols);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/safe_sprintf.c b/contrib/ncurses/ncurses/base/safe_sprintf.c
index 8fc5d89dd210..e73307bac282 100644
--- a/contrib/ncurses/ncurses/base/safe_sprintf.c
+++ b/contrib/ncurses/ncurses/base/safe_sprintf.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -33,7 +33,7 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: safe_sprintf.c,v 1.20 2007/04/21 22:28:06 tom Exp $")
+MODULE_ID("$Id: safe_sprintf.c,v 1.24 2010/06/05 22:22:27 tom Exp $")
#if USE_SAFE_SPRINTF
@@ -111,7 +111,7 @@ _nc_printf_length(const char *fmt, va_list ap)
}
sprintf(fmt_arg, "%d", ival);
fmt_len += strlen(fmt_arg);
- if ((format = realloc(format, fmt_len)) == 0) {
+ if ((format = _nc_doalloc(format, fmt_len)) == 0) {
return -1;
}
strcpy(&format[--f], fmt_arg);
@@ -214,13 +214,20 @@ _nc_printf_length(const char *fmt, va_list ap)
* 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)
+NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_DCLx
+ const char *fmt,
+ va_list ap)
{
char *result = 0;
if (fmt != 0) {
#if USE_SAFE_SPRINTF
- int len = _nc_printf_length(fmt, ap);
+ va_list ap2;
+ int len;
+
+ begin_va_copy(ap2, ap);
+ len = _nc_printf_length(fmt, ap2);
+ end_va_copy(ap2);
if ((int) my_length < len + 1) {
my_length = 2 * (len + 1);
@@ -237,12 +244,12 @@ _nc_printf_string(const char *fmt, va_list ap)
#define MyCols _nc_globals.safeprint_cols
#define MyRows _nc_globals.safeprint_rows
- 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;
+ if (screen_lines(SP_PARM) > MyRows || screen_columns(SP_PARM) > MyCols) {
+ if (screen_lines(SP_PARM) > MyRows)
+ MyRows = screen_lines(SP_PARM);
+ if (screen_columns(SP_PARM) > MyCols)
+ MyCols = screen_columns(SP_PARM);
+ my_length = (size_t) (MyRows * (MyCols + 1)) + 1;
my_buffer = typeRealloc(char, my_length, my_buffer);
}
@@ -262,3 +269,11 @@ _nc_printf_string(const char *fmt, va_list ap)
}
return result;
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(char *)
+_nc_printf_string(const char *fmt, va_list ap)
+{
+ return NCURSES_SP_NAME(_nc_printf_string) (CURRENT_SCREEN, fmt, ap);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/base/tries.c b/contrib/ncurses/ncurses/base/tries.c
index c4263c7e50eb..ad85d229213d 100644
--- a/contrib/ncurses/ncurses/base/tries.c
+++ b/contrib/ncurses/ncurses/base/tries.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -39,7 +39,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: tries.c,v 1.27 2008/08/16 19:22:55 tom Exp $")
+MODULE_ID("$Id: tries.c,v 1.30 2010/08/28 21:08:23 tom Exp $")
/*
* Expand a keycode into the string that it corresponds to, returning null if
@@ -72,7 +72,9 @@ _nc_expand_try(TRIES * tree, unsigned code, int *count, size_t len)
*((unsigned char *) (result + len)) = 128;
#ifdef TRACE
if (len == 0 && USE_TRACEF(TRACE_MAXIMUM)) {
- _tracef("expand_key %s %s", _nc_tracechar(SP, code), _nc_visbuf(result));
+ _tracef("expand_key %s %s",
+ _nc_tracechar(CURRENT_SCREEN, (int) code),
+ _nc_visbuf(result));
_nc_unlock_global(tracef);
}
#endif
@@ -87,7 +89,7 @@ _nc_expand_try(TRIES * tree, unsigned code, int *count, size_t len)
NCURSES_EXPORT(int)
_nc_remove_key(TRIES ** tree, unsigned code)
{
- T((T_CALLED("_nc_remove_key(%p,%d)"), tree, code));
+ T((T_CALLED("_nc_remove_key(%p,%d)"), (void *) tree, code));
if (code == 0)
returnCode(FALSE);
@@ -119,7 +121,7 @@ _nc_remove_key(TRIES ** tree, unsigned code)
NCURSES_EXPORT(int)
_nc_remove_string(TRIES ** tree, const char *string)
{
- T((T_CALLED("_nc_remove_string(%p,%s)"), tree, _nc_visbuf(string)));
+ T((T_CALLED("_nc_remove_string(%p,%s)"), (void *) tree, _nc_visbuf(string)));
if (string == 0 || *string == 0)
returnCode(FALSE);
diff --git a/contrib/ncurses/ncurses/base/use_window.c b/contrib/ncurses/ncurses/base/use_window.c
index f6408c37928e..8eb733919848 100644
--- a/contrib/ncurses/ncurses/base/use_window.c
+++ b/contrib/ncurses/ncurses/base/use_window.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 2007-2008,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -32,14 +32,14 @@
#include <curses.priv.h>
-MODULE_ID("$Id: use_window.c,v 1.8 2008/06/07 14:13:46 tom Exp $")
+MODULE_ID("$Id: use_window.c,v 1.9 2009/10/24 22:40:24 tom Exp $")
NCURSES_EXPORT(int)
use_window(WINDOW *win, NCURSES_WINDOW_CB func, void *data)
{
int code = OK;
- T((T_CALLED("use_window(%p,%p,%p)"), win, func, data));
+ T((T_CALLED("use_window(%p,%p,%p)"), (void *) win, func, data));
_nc_lock_global(curses);
code = func(win, data);
_nc_unlock_global(curses);
diff --git a/contrib/ncurses/ncurses/base/wresize.c b/contrib/ncurses/ncurses/base/wresize.c
index f46085af59fa..9a6ea500727e 100644
--- a/contrib/ncurses/ncurses/base/wresize.c
+++ b/contrib/ncurses/ncurses/base/wresize.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -27,12 +27,13 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 1996-2002 *
+ * Author: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer *
****************************************************************************/
#include <curses.priv.h>
-MODULE_ID("$Id: wresize.c,v 1.29 2008/06/07 13:59:01 tom Exp $")
+MODULE_ID("$Id: wresize.c,v 1.34 2010/06/05 22:36:26 tom Exp $")
static int
cleanup_lines(struct ldat *data, int length)
@@ -53,10 +54,13 @@ repair_subwindows(WINDOW *cmp)
WINDOWLIST *wp;
struct ldat *pline = cmp->_line;
int row;
+#ifdef USE_SP_WINDOWLIST
+ SCREEN *sp = _nc_screen_of(cmp);
+#endif
_nc_lock_global(curses);
- for (each_window(wp)) {
+ for (each_window(SP_PARM, wp)) {
WINDOW *tst = &(wp->win);
if (tst->_parent == cmp) {
@@ -67,9 +71,9 @@ repair_subwindows(WINDOW *cmp)
tst->_parx = cmp->_maxx;
if (tst->_maxy + tst->_pary > cmp->_maxy)
- tst->_maxy = cmp->_maxy - tst->_pary;
+ tst->_maxy = (NCURSES_SIZE_T) (cmp->_maxy - tst->_pary);
if (tst->_maxx + tst->_parx > cmp->_maxx)
- tst->_maxx = cmp->_maxx - tst->_parx;
+ tst->_maxx = (NCURSES_SIZE_T) (cmp->_maxx - tst->_parx);
for (row = 0; row <= tst->_maxy; ++row) {
tst->_line[row].text = &pline[tst->_pary + row].text[tst->_parx];
@@ -93,7 +97,7 @@ wresize(WINDOW *win, int ToLines, int ToCols)
struct ldat *new_lines = 0;
#ifdef TRACE
- T((T_CALLED("wresize(%p,%d,%d)"), win, ToLines, ToCols));
+ T((T_CALLED("wresize(%p,%d,%d)"), (void *) win, ToLines, ToCols));
if (win) {
TR(TRACE_UPDATE, ("...beg (%ld, %ld), max(%ld,%ld), reg(%ld,%ld)",
(long) win->_begy, (long) win->_begx,
@@ -153,7 +157,8 @@ wresize(WINDOW *win, int ToLines, int ToCols)
if (!(win->_flags & _SUBWIN)) {
if (row <= size_y) {
if (ToCols != size_x) {
- if ((s = typeMalloc(NCURSES_CH_T, ToCols + 1)) == 0)
+ s = typeMalloc(NCURSES_CH_T, (unsigned) ToCols + 1);
+ if (s == 0)
returnCode(cleanup_lines(new_lines, row));
for (col = 0; col <= ToCols; ++col) {
s[col] = (col <= size_x
@@ -164,12 +169,14 @@ wresize(WINDOW *win, int ToLines, int ToCols)
s = win->_line[row].text;
}
} else {
- if ((s = typeMalloc(NCURSES_CH_T, ToCols + 1)) == 0)
+ s = typeMalloc(NCURSES_CH_T, (unsigned) ToCols + 1);
+ if (s == 0)
returnCode(cleanup_lines(new_lines, row));
for (col = 0; col <= ToCols; ++col)
s[col] = win->_nc_bkgd;
}
} else {
+ assert(pline != 0);
s = &pline[win->_pary + row].text[win->_parx];
}
@@ -181,11 +188,11 @@ wresize(WINDOW *win, int ToLines, int ToCols)
if ((ToCols != size_x) || (row > size_y)) {
if (end >= begin) { /* growing */
if (new_lines[row].firstchar < begin)
- new_lines[row].firstchar = begin;
+ new_lines[row].firstchar = (NCURSES_SIZE_T) begin;
} else { /* shrinking */
new_lines[row].firstchar = 0;
}
- new_lines[row].lastchar = ToCols;
+ new_lines[row].lastchar = (NCURSES_SIZE_T) ToCols;
}
new_lines[row].text = s;
}
@@ -212,8 +219,8 @@ wresize(WINDOW *win, int ToLines, int ToCols)
* Finally, adjust the parameters showing screen size and cursor
* position:
*/
- win->_maxx = ToCols;
- win->_maxy = ToLines;
+ win->_maxx = (NCURSES_SIZE_T) ToCols;
+ win->_maxy = (NCURSES_SIZE_T) ToLines;
if (win->_regtop > win->_maxy)
win->_regtop = win->_maxy;
diff --git a/contrib/ncurses/ncurses/build.priv.h b/contrib/ncurses/ncurses/build.priv.h
new file mode 100644
index 000000000000..be00d73ea430
--- /dev/null
+++ b/contrib/ncurses/ncurses/build.priv.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * Copyright (c) 2010 Free Software Foundation, Inc. *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a *
+ * copy of this software and associated documentation files (the *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Thomas E. Dickey 2010 *
+ ****************************************************************************/
+
+
+/*
+ * $Id: build.priv.h,v 1.6 2010/05/22 20:30:35 tom Exp $
+ *
+ * build.priv.h
+ *
+ * This is a reduced version of curses.priv.h, for build-time utilties.
+ * Because it has fewer dependencies, this simplifies cross-compiling.
+ *
+ */
+
+#ifndef CURSES_PRIV_H
+#define CURSES_PRIV_H 1
+
+#include <ncurses_dll.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <ncurses_cfg.h>
+
+#if USE_RCS_IDS
+#define MODULE_ID(id) static const char Ident[] = id;
+#else
+#define MODULE_ID(id) /*nothing*/
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include <assert.h>
+#include <stdio.h>
+
+#include <errno.h>
+
+#include <curses.h> /* we'll use -Ipath directive to get the right one! */
+
+/* usually in <unistd.h> */
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#endif
+
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#endif
+
+#define FreeAndNull(p) free(p); p = 0
+#define UChar(c) ((unsigned char)(c))
+#define SIZEOF(v) (sizeof(v) / sizeof(v[0]))
+
+#include <nc_alloc.h>
+
+/* declare these, to avoid needing term.h */
+#if BROKEN_LINKER || USE_REENTRANT
+#define NCURSES_ARRAY(name) \
+ NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, name)
+
+NCURSES_ARRAY(boolnames);
+NCURSES_ARRAY(boolfnames);
+NCURSES_ARRAY(numnames);
+NCURSES_ARRAY(numfnames);
+NCURSES_ARRAY(strnames);
+NCURSES_ARRAY(strfnames);
+#endif
+
+#if NO_LEAKS
+NCURSES_EXPORT(void) _nc_names_leaks(void);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CURSES_PRIV_H */
diff --git a/contrib/ncurses/ncurses/curses.priv.h b/contrib/ncurses/ncurses/curses.priv.h
index 29e131953415..49346c122a70 100644
--- a/contrib/ncurses/ncurses/curses.priv.h
+++ b/contrib/ncurses/ncurses/curses.priv.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 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 *
@@ -30,11 +30,11 @@
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer *
****************************************************************************/
-
/*
- * $Id: curses.priv.h,v 1.394 2008/10/04 21:37:45 tom Exp $
+ * $Id: curses.priv.h,v 1.475 2011/01/22 21:10:19 tom Exp $
*
* curses.priv.h
*
@@ -45,6 +45,7 @@
#ifndef CURSES_PRIV_H
#define CURSES_PRIV_H 1
+/* *INDENT-OFF* */
#include <ncurses_dll.h>
@@ -60,6 +61,7 @@ extern "C" {
#define MODULE_ID(id) /*nothing*/
#endif
+#include <stddef.h> /* for offsetof */
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
@@ -97,8 +99,6 @@ extern "C" {
extern int errno;
#endif
-#include <nc_panel.h>
-
/* Some systems have a broken 'select()', but workable 'poll()'. Use that */
#if HAVE_WORKING_POLL
#define USE_FUNC_POLL 1
@@ -178,6 +178,20 @@ extern NCURSES_EXPORT(void *) _nc_memmove (void *, const void *, size_t);
#endif
/*
+ * If we have va_copy(), use it for assigning va_list's.
+ */
+#if defined(HAVE___VA_COPY)
+#define begin_va_copy(dst,src) __va_copy(dst, src)
+#define end_va_copy(dst) va_end(dst)
+#elif defined(va_copy) || defined(HAVE_VA_COPY)
+#define begin_va_copy(dst,src) va_copy(dst, src)
+#define end_va_copy(dst) va_end(dst)
+#else
+#define begin_va_copy(dst,src) (dst) = (src)
+#define end_va_copy(dst) /* nothing */
+#endif
+
+/*
* Scroll hints are useless when hashmap is used
*/
#if !USE_SCROLL_HINTS
@@ -195,6 +209,15 @@ extern NCURSES_EXPORT(void *) _nc_memmove (void *, const void *, size_t);
#endif
/*
+ * Options for terminal drivers, etc...
+ */
+#ifdef USE_TERM_DRIVER
+#define USE_SP_RIPOFF 1
+#define USE_SP_TERMTYPE 1
+#define USE_SP_WINDOWLIST 1
+#endif
+
+/*
* Note: ht/cbt expansion flakes out randomly under Linux 1.1.47, but only
* when we're throwing control codes at the screen at high volume. To see
* this, re-enable USE_HARD_TABS and run worm for a while. Other systems
@@ -247,6 +270,7 @@ color_t;
#define _nc_bkgd _bkgrnd
#else
#undef _XOPEN_SOURCE_EXTENDED
+#undef _XPG5
#define _nc_bkgd _bkgd
#define wgetbkgrnd(win, wch) *wch = win->_bkgd
#define wbkgrnd wbkgd
@@ -257,39 +281,127 @@ color_t;
#define NCURSES_OPAQUE 0
#include <curses.h> /* we'll use -Ipath directive to get the right one! */
+
+/*
+ * If curses.h did not expose the SCREEN-functions, then we do not need the
+ * parameter in the corresponding unextended functions.
+ */
+
+#define USE_SP_FUNC_SUPPORT NCURSES_SP_FUNCS
+#define USE_EXT_SP_FUNC_SUPPORT (NCURSES_SP_FUNCS && NCURSES_EXT_FUNCS)
+
+#if NCURSES_SP_FUNCS
+#define SP_PARM sp /* use parameter */
+#define NCURSES_SP_ARG SP_PARM
+#define NCURSES_SP_DCL SCREEN *NCURSES_SP_ARG
+#define NCURSES_SP_DCL0 NCURSES_SP_DCL
+#define NCURSES_SP_ARGx NCURSES_SP_ARG,
+#define NCURSES_SP_DCLx SCREEN *NCURSES_SP_ARGx
+#else
+#define SP_PARM SP /* use global variable */
+#define NCURSES_SP_ARG
+#define NCURSES_SP_DCL
+#define NCURSES_SP_DCL0 void
+#define NCURSES_SP_ARGx
+#define NCURSES_SP_DCLx
+#endif
+
+#include <nc_panel.h>
+
+#define IsPreScreen(sp) (((sp) != 0) && sp->_prescreen)
+#define HasTerminal(sp) (((sp) != 0) && (0 != ((sp)->_term)))
+#define IsValidScreen(sp) (HasTerminal(sp) && !IsPreScreen(sp))
+
+#if BROKEN_LINKER || USE_REENTRANT
+#define CurTerm _nc_prescreen._cur_term
+#else
+#define CurTerm cur_term
+#endif
+
+#if NCURSES_SP_FUNCS
+#define TerminalOf(sp) ((sp) ? ((sp)->_term ? (sp)->_term : CurTerm) : CurTerm)
+#else
+#define TerminalOf(sp) CurTerm
+#endif
+
#include <term.h>
+
+/*
+ * Reduce dependency on cur_term global by using terminfo data from SCREEN's
+ * pointer to this data.
+ */
+#ifdef USE_SP_TERMTYPE
+#undef CUR
+#endif
+
+#define SP_TERMTYPE TerminalOf(sp)->type.
+
#include <term_entry.h>
+
#include <nc_tparm.h>
-#if NCURSES_EXT_COLORS && USE_WIDEC_SUPPORT
+/*
+ * Use these macros internally, to make tracing less verbose. But leave the
+ * option for compiling the tracing into the library.
+ */
+#if 1
+#define ColorPair(n) NCURSES_BITS(n, 0)
+#define PairNumber(a) (NCURSES_CAST(int,(((unsigned long)(a) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
+#else
+#define ColorPair(pair) COLOR_PAIR(pair)
+#define PairNumber(attr) PAIR_NUMBER(attr)
+#endif
+
+#define unColor(n) unColor2(AttrOf(n))
+#define unColor2(a) ((a) & ALL_BUT_COLOR)
+
+/*
+ * Extended-colors stores the color pair in a separate struct-member than the
+ * attributes. But for compatibility, we handle most cases where a program
+ * written for non-extended colors stores the color in the attributes by
+ * checking for a color pair in both places.
+ */
+#if NCURSES_EXT_COLORS
#define if_EXT_COLORS(stmt) stmt
-#define NetPair(value,p) (value).ext_color = (p), \
- AttrOf(value) &= ALL_BUT_COLOR, \
- AttrOf(value) |= (A_COLOR & COLOR_PAIR((p > 255) ? 255 : p))
-#define SetPair(value,p) (value).ext_color = (p)
-#define GetPair(value) (value).ext_color
-#define unColor(n) (AttrOf(n) & ALL_BUT_COLOR)
-#define GET_WINDOW_PAIR(w) (w)->_color
+#define SetPair(value,p) SetPair2((value).ext_color, AttrOf(value), p)
+#define SetPair2(c,a,p) c = (p), \
+ a = (unColor2(a) | (A_COLOR & ColorPair(oldColor(c))))
+#define GetPair(value) GetPair2((value).ext_color, AttrOf(value))
+#define GetPair2(c,a) ((c) ? (c) : PairNumber(a))
+#define oldColor(p) (((p) > 255) ? 255 : (p))
+#define GET_WINDOW_PAIR(w) GetPair2((w)->_color, (w)->_attrs)
#define SET_WINDOW_PAIR(w,p) (w)->_color = (p)
#define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b) && GetPair(a) == GetPair(b))
-#define VIDATTR(attr, pair) vid_attr(attr, pair, 0)
+
+#if NCURSES_SP_FUNCS
+#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vid_attr)(sp, attr, pair, 0)
#else
+#define VIDATTR(sp,attr,pair) vid_attr(attr, pair, 0)
+#endif
+
+#else /* !NCURSES_EXT_COLORS */
+
#define if_EXT_COLORS(stmt) /* nothing */
#define SetPair(value,p) RemAttr(value, A_COLOR), \
- SetAttr(value, AttrOf(value) | (A_COLOR & COLOR_PAIR(p)))
-#define GetPair(value) PAIR_NUMBER(AttrOf(value))
-#define unColor(n) (AttrOf(n) & ALL_BUT_COLOR)
-#define GET_WINDOW_PAIR(w) PAIR_NUMBER(WINDOW_ATTRS(w))
+ SetAttr(value, AttrOf(value) | (A_COLOR & (attr_t) ColorPair(p)))
+#define GetPair(value) PairNumber(AttrOf(value))
+#define GET_WINDOW_PAIR(w) PairNumber(WINDOW_ATTRS(w))
#define SET_WINDOW_PAIR(w,p) WINDOW_ATTRS(w) &= ALL_BUT_COLOR, \
- WINDOW_ATTRS(w) |= (A_COLOR & COLOR_PAIR(p))
+ WINDOW_ATTRS(w) |= (A_COLOR & (attr_t) ColorPair(p))
#define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b))
-#define VIDATTR(attr, pair) vidattr(attr)
+
+#if NCURSES_SP_FUNCS
+#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vidattr)(sp, attr)
+#else
+#define VIDATTR(sp,attr,pair) vidattr(attr)
#endif
+#endif /* NCURSES_EXT_COLORS */
+
#if NCURSES_NO_PADDING
#define GetNoPadding(sp) ((sp) ? (sp)->_no_padding : _nc_prescreen._no_padding)
#define SetNoPadding(sp) _nc_set_no_padding(sp)
-extern NCURSES_EXPORT(void) _nc_set_no_padding(SCREEN *);
+extern NCURSES_EXPORT(void) _nc_set_no_padding(SCREEN *);
#else
#define GetNoPadding(sp) FALSE
#define SetNoPadding(sp) /*nothing*/
@@ -301,18 +413,37 @@ extern NCURSES_EXPORT(void) _nc_set_no_padding(SCREEN *);
#define GET_SCREEN_PAIR(s) GetPair(SCREEN_ATTRS(s))
#define SET_SCREEN_PAIR(s,p) SetPair(SCREEN_ATTRS(s), p)
+#if USE_REENTRANT || NCURSES_SP_FUNCS
+NCURSES_EXPORT(int *) _nc_ptr_Lines (SCREEN *);
+NCURSES_EXPORT(int *) _nc_ptr_Cols (SCREEN *);
+NCURSES_EXPORT(int *) _nc_ptr_Tabsize (SCREEN *);
+NCURSES_EXPORT(int *) _nc_ptr_Escdelay (SCREEN *);
+#endif
+
#if USE_REENTRANT
-NCURSES_EXPORT(int *) _nc_ptr_Lines (void);
-NCURSES_EXPORT(int *) _nc_ptr_Cols (void);
-#define ptrLines() (SP ? &(SP->_LINES) : &(_nc_prescreen._LINES))
-#define ptrCols() (SP ? &(SP->_COLS) : &(_nc_prescreen._COLS))
-#define SET_LINES(value) *_nc_ptr_Lines() = value
-#define SET_COLS(value) *_nc_ptr_Cols() = value
+
+#define ptrLines(sp) (sp ? &(sp->_LINES) : &(_nc_prescreen._LINES))
+#define ptrCols(sp) (sp ? &(sp->_COLS) : &(_nc_prescreen._COLS))
+#define ptrTabsize(sp) (sp ? &(sp->_TABSIZE) : &(_nc_prescreen._TABSIZE))
+#define ptrEscdelay(sp) (sp ? &(sp->_ESCDELAY) : &(_nc_prescreen._ESCDELAY))
+
+#define SET_LINES(value) *_nc_ptr_Lines(SP_PARM) = value
+#define SET_COLS(value) *_nc_ptr_Cols(SP_PARM) = value
+#define SET_TABSIZE(value) *_nc_ptr_Tabsize(SP_PARM) = value
+#define SET_ESCDELAY(value) *_nc_ptr_Escdelay(SP_PARM) = value
+
#else
-#define ptrLines() &LINES
-#define ptrCols() &COLS
-#define SET_LINES(value) LINES = value
-#define SET_COLS(value) COLS = value
+
+#define ptrLines(sp) &LINES
+#define ptrCols(sp) &COLS
+#define ptrTabsize(sp) &TABSIZE
+#define ptrEscdelay(sp) &ESCDELAY
+
+#define SET_LINES(value) LINES = value
+#define SET_COLS(value) COLS = value
+#define SET_TABSIZE(value) TABSIZE = value
+#define SET_ESCDELAY(value) ESCDELAY = value
+
#endif
#define TR_MUTEX(data) _tracef("%s@%d: me:%08lX COUNT:%2u/%2d/%6d/%2d/%s%9u: " #data, \
@@ -326,6 +457,19 @@ NCURSES_EXPORT(int *) _nc_ptr_Cols (void);
data.__data.__nusers)
#define TR_GLOBAL_MUTEX(name) TR_MUTEX(_nc_globals.mutex_##name)
+#if USE_WEAK_SYMBOLS
+#if defined(__GNUC__)
+# if defined __USE_ISOC99
+# define _cat_pragma(exp) _Pragma(#exp)
+# define _weak_pragma(exp) _cat_pragma(weak name)
+# else
+# define _weak_pragma(exp)
+# endif
+# define _declare(name) __extension__ extern __typeof__(name) name
+# define weak_symbol(name) _weak_pragma(name) _declare(name) __attribute__((weak))
+#endif
+#endif
+
#ifdef USE_PTHREADS
#if USE_REENTRANT
@@ -343,22 +487,10 @@ extern NCURSES_EXPORT(int) _nc_mutex_unlock(pthread_mutex_t *);
#error POSIX threads requires --enable-reentrant option
#endif
-#if USE_WEAK_SYMBOLS
-#if defined(__GNUC__)
-# if defined __USE_ISOC99
-# define _cat_pragma(exp) _Pragma(#exp)
-# define _weak_pragma(exp) _cat_pragma(weak name)
-# else
-# define _weak_pragma(exp)
-# endif
-# define _declare(name) __extension__ extern __typeof__(name) name
-# define weak_symbol(name) _weak_pragma(name) _declare(name) __attribute__((weak))
-#endif
-#endif
-
#ifdef USE_PTHREADS
# if USE_WEAK_SYMBOLS
weak_symbol(pthread_sigmask);
+weak_symbol(pthread_kill);
weak_symbol(pthread_self);
weak_symbol(pthread_equal);
weak_symbol(pthread_mutex_init);
@@ -380,6 +512,19 @@ extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *);
#else /* !USE_PTHREADS */
+#if USE_PTHREADS_EINTR
+# if USE_WEAK_SYMBOLS
+#include <pthread.h>
+weak_symbol(pthread_sigmask);
+weak_symbol(pthread_kill);
+weak_symbol(pthread_self);
+weak_symbol(pthread_equal);
+extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *);
+# undef sigprocmask
+# define sigprocmask _nc_sigprocmask
+# endif
+#endif /* USE_PTHREADS_EINTR */
+
#define _nc_init_pthreads() /* nothing */
#define _nc_mutex_init(obj) /* nothing */
@@ -389,6 +534,36 @@ extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *);
#endif /* USE_PTHREADS */
+/*
+ * When using sp-funcs, locks are targeted to SCREEN-level granularity.
+ * So the locking is done in the non-sp-func (which calls the sp-func) rather
+ * than in the sp-func itself.
+ *
+ * Use the _nc_nonsp_XXX functions in the function using "NCURSES_SP_NAME()".
+ * Use the _nc_sp_XXX functions in the function using "#if NCURSES_SP_FUNCS".
+ */
+#if NCURSES_SP_FUNCS
+
+#define _nc_nonsp_lock_global(name) /* nothing */
+#define _nc_nonsp_try_global(name) 0
+#define _nc_nonsp_unlock_global(name) /* nothing */
+
+#define _nc_sp_lock_global(name) _nc_lock_global(name)
+#define _nc_sp_try_global(name) _nc_try_global(name)
+#define _nc_sp_unlock_global(name) _nc_unlock_global(name)
+
+#else
+
+#define _nc_nonsp_lock_global(name) _nc_lock_global(name)
+#define _nc_nonsp_try_global(name) _nc_try_global(name)
+#define _nc_nonsp_unlock_global(name) _nc_unlock_global(name)
+
+#define _nc_sp_lock_global(name) /* nothing */
+#define _nc_sp_try_global(name) 0
+#define _nc_sp_unlock_global(name) /* nothing */
+
+#endif
+
#if HAVE_GETTIMEOFDAY
# define PRECISE_GETTIME 1
# define TimeType struct timeval
@@ -403,12 +578,14 @@ extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *);
typedef unsigned colorpair_t; /* type big enough to store PAIR_OF() */
#define C_SHIFT 9 /* we need more bits than there are colors */
#define C_MASK ((1 << C_SHIFT) - 1)
-#define PAIR_OF(fg, bg) ((((fg) & C_MASK) << C_SHIFT) | ((bg) & C_MASK))
+#define PAIR_OF(fg, bg) (colorpair_t) ((((fg) & C_MASK) << C_SHIFT) | ((bg) & C_MASK))
+#define FORE_OF(c) (((c) >> C_SHIFT) & C_MASK)
+#define BACK_OF(c) ((c) & C_MASK)
#define isDefaultColor(c) ((c) >= COLOR_DEFAULT || (c) < 0)
#define COLOR_DEFAULT C_MASK
-#if defined(USE_TERMLIB) && !defined(NEED_NCURSES_CH_T)
+#if defined(USE_BUILD_CC) || (defined(USE_TERMLIB) && !defined(NEED_NCURSES_CH_T))
#undef NCURSES_CH_T /* this is not a termlib feature */
#define NCURSES_CH_T void /* ...but we need a pointer in SCREEN */
@@ -434,6 +611,9 @@ typedef enum {
#if USE_SYSMOUSE
,M_SYSMOUSE /* FreeBSD sysmouse on console */
#endif
+#ifdef USE_TERM_DRIVER
+ ,M_TERM_DRIVER /* Win32 console, etc */
+#endif
} MouseType;
/*
@@ -452,7 +632,7 @@ typedef struct {
struct _SLK;
-#ifndef USE_TERMLIB
+#if !(defined(USE_TERMLIB) || defined(USE_BUILD_CC))
typedef struct
{
@@ -464,13 +644,13 @@ typedef struct
} slk_ent;
typedef struct _SLK {
- char dirty; /* all labels have changed */
- char hidden; /* soft labels are hidden */
- WINDOW *win;
+ bool dirty; /* all labels have changed */
+ bool hidden; /* soft labels are hidden */
+ WINDOW *win;
slk_ent *ent;
- short maxlab; /* number of available labels */
- short labcnt; /* number of allocated labels */
- short maxlen; /* length of labels */
+ short maxlab; /* number of available labels */
+ short labcnt; /* number of allocated labels */
+ short maxlen; /* length of labels */
NCURSES_CH_T attr; /* soft label attribute */
} SLK;
@@ -493,10 +673,10 @@ typedef int (*TYPE_Gpm_Open) (Gpm_Connect *, int);
typedef int (*TYPE_Gpm_Close) (void);
typedef int (*TYPE_Gpm_GetEvent) (Gpm_Event *);
-#define my_gpm_fd SP->_mouse_gpm_fd
-#define my_Gpm_Open SP->_mouse_Gpm_Open
-#define my_Gpm_Close SP->_mouse_Gpm_Close
-#define my_Gpm_GetEvent SP->_mouse_Gpm_GetEvent
+#define my_gpm_fd SP_PARM->_mouse_gpm_fd
+#define my_Gpm_Open SP_PARM->_mouse_Gpm_Open
+#define my_Gpm_Close SP_PARM->_mouse_Gpm_Close
+#define my_Gpm_GetEvent SP_PARM->_mouse_Gpm_GetEvent
#else
/* link statically to GPM */
#define my_gpm_fd &gpm_fd
@@ -563,8 +743,10 @@ typedef struct {
*/
#if MIXEDCASE_FILENAMES
#define LEAF_FMT "%c"
+#define LEAF_LEN 1
#else
#define LEAF_FMT "%02x"
+#define LEAF_LEN 2
#endif
/*
@@ -577,6 +759,13 @@ typedef struct {
#define TRACEMSE_MAX (80 + (5 * 10) + (32 * 15))
#define TRACEMSE_FMT "id %2d at (%2d, %2d, %2d) state %4lx = {" /* } */
+#ifdef USE_TERM_DRIVER
+struct DriverTCB; /* Terminal Control Block forward declaration */
+#define INIT_TERM_DRIVER() _nc_globals.term_driver = _nc_get_driver
+#else
+#define INIT_TERM_DRIVER() /* nothing */
+#endif
+
/*
* Global data which is not specific to a screen.
*/
@@ -609,8 +798,10 @@ typedef struct {
int tgetent_index;
long tgetent_sequence;
+#ifndef USE_SP_WINDOWLIST
WINDOWLIST *_nc_windowlist;
-#define _nc_windows _nc_globals._nc_windowlist
+#define WindowList(sp) _nc_globals._nc_windowlist
+#endif
#if USE_HOME_TERMINFO
char *home_terminfo;
@@ -621,6 +812,10 @@ typedef struct {
int safeprint_rows;
#endif
+#ifdef USE_TERM_DRIVER
+ int (*term_driver)(struct DriverTCB*, const char*, int*);
+#endif
+
#ifdef TRACE
bool init_trace;
char trace_fname[PATH_MAX];
@@ -644,7 +839,9 @@ typedef struct {
char traceatr_color_buf[2][80];
int traceatr_color_sel;
int traceatr_color_last;
-
+#if !defined(USE_PTHREADS) && USE_REENTRANT
+ int nested_tracef;
+#endif
#endif /* TRACE */
#ifdef USE_PTHREADS
@@ -655,6 +852,9 @@ typedef struct {
int use_pthreads;
#define _nc_use_pthreads _nc_globals.use_pthreads
#endif
+#if USE_PTHREADS_EINTR
+ pthread_t read_thread; /* The reading thread */
+#endif
} NCURSES_GLOBALS;
extern NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals;
@@ -669,17 +869,22 @@ typedef struct {
bool use_env;
bool filter_mode;
attr_t previous_attr;
+#ifndef USE_SP_RIPOFF
ripoff_t rippedoff[N_RIPS];
ripoff_t *rsp;
+#endif
TPARM_STATE tparm_state;
TTY *saved_tty; /* savetty/resetty information */
#if NCURSES_NO_PADDING
bool _no_padding; /* flag to set if padding disabled */
#endif
+ NCURSES_SP_OUTC _outch; /* output handler if not putc */
#if BROKEN_LINKER || USE_REENTRANT
chtype *real_acs_map;
int _LINES;
int _COLS;
+ int _TABSIZE;
+ int _ESCDELAY;
TERMINAL *_cur_term;
#ifdef TRACE
long _outchars;
@@ -688,8 +893,16 @@ typedef struct {
#endif
} NCURSES_PRESCREEN;
-#define ripoff_sp _nc_prescreen.rsp
-#define ripoff_stack _nc_prescreen.rippedoff
+/*
+ * Use screen-specific ripoff data (for softkeys) rather than global.
+ */
+#ifdef USE_SP_RIPOFF
+#define safe_ripoff_sp (sp)->rsp
+#define safe_ripoff_stack (sp)->rippedoff
+#else
+#define safe_ripoff_sp _nc_prescreen.rsp
+#define safe_ripoff_stack _nc_prescreen.rippedoff
+#endif
extern NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen;
@@ -703,6 +916,8 @@ struct screen {
char *_setbuf; /* buffered I/O for output */
bool _filtered; /* filter() was called */
bool _buffered; /* setvbuf uses _setbuf data */
+ bool _prescreen; /* is in prescreen phase */
+ bool _use_env; /* LINES & COLS from environment? */
int _checkfd; /* filedesc for typeahead check */
TERMINAL *_term; /* terminal type information */
TTY _saved_tty; /* savetty/resetty information */
@@ -716,6 +931,10 @@ struct screen {
WINDOW *_newscr; /* virtual screen to be updated to */
WINDOW *_stdscr; /* screen's full-window context */
+#define CurScreen(sp) (sp)->_curscr
+#define NewScreen(sp) (sp)->_newscr
+#define StdScreen(sp) (sp)->_stdscr
+
TRIES *_keytry; /* "Try" for use with keypad mode */
TRIES *_key_ok; /* Disabled keys via keyok(,FALSE) */
bool _tried; /* keypad mode was initialized */
@@ -794,11 +1013,13 @@ struct screen {
int _color_count; /* count of colors in palette */
colorpair_t *_color_pairs; /* screen's color pair list */
int _pair_count; /* count of color pairs */
+ int _pair_limit; /* actual limit of color-pairs */
#if NCURSES_EXT_FUNCS
bool _default_color; /* use default colors */
bool _has_sgr_39_49; /* has ECMA default color support */
int _default_fg; /* assumed default foreground */
int _default_bg; /* assumed default background */
+ int _default_pairs; /* count pairs using default color */
#endif
chtype _ok_attributes; /* valid attributes for terminal */
chtype _xmc_suppress; /* attributes to suppress if xmc */
@@ -820,8 +1041,6 @@ struct screen {
*/
bool _nc_sp_idlok;
bool _nc_sp_idcok;
-#define _nc_idlok SP->_nc_sp_idlok
-#define _nc_idcok SP->_nc_sp_idcok
/*
* These are the data that support the mouse interface.
@@ -871,11 +1090,18 @@ struct screen {
int _sysmouse_new_buttons;
#endif
+#ifdef USE_TERM_DRIVER
+ MEVENT _drv_mouse_fifo[FIFO_SIZE];
+ int _drv_mouse_head;
+ int _drv_mouse_tail;
+ int _drv_mouse_old_buttons;
+ int _drv_mouse_new_buttons;
+#endif
/*
* This supports automatic resizing
*/
#if USE_SIZECHANGE
- int (*_resize)(int,int);
+ int (*_resize)(NCURSES_SP_DCLx int y, int x);
#endif
/*
@@ -895,7 +1121,7 @@ struct screen {
int _oldnum_size;
bool _cleanup; /* cleanup after int/quit signal */
- int (*_outch)(int); /* output handler if not putc */
+ NCURSES_SP_OUTC _outch; /* output handler if not putc */
int _legacy_coding; /* see use_legacy_coding() */
@@ -915,6 +1141,15 @@ struct screen {
char tracechr_buf[40];
char tracemse_buf[TRACEMSE_MAX];
#endif
+#ifdef USE_SP_WINDOWLIST
+ WINDOWLIST* _windowlist;
+#define WindowList(sp) (sp)->_windowlist
+#endif
+ NCURSES_OUTC jump;
+
+ ripoff_t rippedoff[N_RIPS];
+ ripoff_t *rsp;
+
/*
* ncurses/ncursesw are the same up to this point.
*/
@@ -930,10 +1165,10 @@ 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 */
WINDOWLIST *next;
SCREEN *screen; /* screen containing the window */
-#ifdef _XOPEN_SOURCE_EXTENDED
+ WINDOW win; /* WINDOW_EXT() needs to account for offset */
+#ifdef NCURSES_WIDECHAR
char addch_work[(MB_LEN_MAX * 9) + 1];
unsigned addch_used; /* number of bytes in addch_work[] */
int addch_x; /* x-position for addch_work[] */
@@ -941,7 +1176,21 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#endif
};
-#define WINDOW_EXT(win,field) (((WINDOWLIST *)(win))->field)
+#define WINDOW_EXT(w,m) (((WINDOWLIST *)((void *)((char *)(w) - offsetof(WINDOWLIST, win))))->m)
+
+#define SP_PRE_INIT(sp) \
+ sp->_cursrow = -1; \
+ sp->_curscol = -1; \
+ sp->_nl = TRUE; \
+ sp->_raw = FALSE; \
+ sp->_cbreak = 0; \
+ sp->_echo = TRUE; \
+ sp->_fifohead = -1; \
+ sp->_endwin = TRUE; \
+ sp->_cursor = -1; \
+ WindowList(sp) = 0; \
+ sp->_outch = NCURSES_SP_NAME(_nc_outch); \
+ sp->jump = 0 \
/* usually in <limits.h> */
#ifndef UCHAR_MAX
@@ -1017,6 +1266,7 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#define RESET_OUTCHARS() COUNT_OUTCHARS(-_nc_outchars)
#define UChar(c) ((unsigned char)(c))
+#define UShort(c) ((unsigned short)(c))
#define ChCharOf(c) ((c) & (chtype)A_CHARTEXT)
#define ChAttrOf(c) ((c) & (chtype)A_ATTRIBUTES)
@@ -1061,9 +1311,9 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#define SetChar(ch,c,a) do { \
NCURSES_CH_T *_cp = &ch; \
memset(_cp, 0, sizeof(ch)); \
- _cp->chars[0] = (c); \
+ _cp->chars[0] = (wchar_t) (c); \
_cp->attr = (a); \
- if_EXT_COLORS(SetPair(ch, PAIR_NUMBER(a))); \
+ if_EXT_COLORS(SetPair(ch, PairNumber(a))); \
} while (0)
#define CHREF(wch) (&wch)
#define CHDEREF(wch) (*wch)
@@ -1082,14 +1332,14 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
PUTC_ch = (ch).chars[PUTC_i]; \
if (PUTC_ch == L'\0') \
break; \
- PUTC_n = wcrtomb(PUTC_buf, \
- (ch).chars[PUTC_i], &PUT_st); \
+ PUTC_n = (int) wcrtomb(PUTC_buf, \
+ (ch).chars[PUTC_i], &PUT_st); \
if (PUTC_n <= 0) { \
if (PUTC_ch && is8bits(PUTC_ch) && PUTC_i == 0) \
putc(PUTC_ch,b); \
break; \
} \
- fwrite(PUTC_buf, (unsigned) PUTC_n, 1, b); \
+ IGNORE_RC(fwrite(PUTC_buf, (unsigned) PUTC_n, 1, b)); \
} \
COUNT_OUTCHARS(PUTC_i); \
} } } while (0)
@@ -1105,14 +1355,14 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
* zero. Otherwise we can use those bits to tell if a cell is the
* first or extension part of a wide character.
*/
-#define WidecExt(ch) (AttrOf(ch) & A_CHARTEXT)
+#define WidecExt(ch) (int) (AttrOf(ch) & A_CHARTEXT)
#define isWidecBase(ch) (WidecExt(ch) == 1)
#define isWidecExt(ch) (WidecExt(ch) > 1 && WidecExt(ch) < 32)
#define SetWidecExt(dst, ext) AttrOf(dst) &= ~A_CHARTEXT, \
- AttrOf(dst) |= (ext + 1)
+ AttrOf(dst) |= (attr_t) (ext + 1)
#define if_WIDEC(code) code
-#define Charable(ch) ((SP != 0 && SP->_legacy_coding) \
+#define Charable(ch) ((SP_PARM != 0 && SP_PARM->_legacy_coding) \
|| (AttrOf(ch) & A_ALTCHARSET) \
|| (!isWidecExt(ch) && \
(ch).chars[1] == L'\0' && \
@@ -1162,25 +1412,25 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#define CHANGED_CELL(line,col) \
if (line->firstchar == _NOCHANGE) \
- line->firstchar = line->lastchar = col; \
+ line->firstchar = line->lastchar = (NCURSES_SIZE_T) col; \
else if ((col) < line->firstchar) \
- line->firstchar = col; \
+ line->firstchar = (NCURSES_SIZE_T) col; \
else if ((col) > line->lastchar) \
- line->lastchar = col
+ line->lastchar = (NCURSES_SIZE_T) col
#define CHANGED_RANGE(line,start,end) \
if (line->firstchar == _NOCHANGE \
|| line->firstchar > (start)) \
- line->firstchar = start; \
+ line->firstchar = (NCURSES_SIZE_T) start; \
if (line->lastchar == _NOCHANGE \
|| line->lastchar < (end)) \
- line->lastchar = end
+ line->lastchar = (NCURSES_SIZE_T) end
#define CHANGED_TO_EOL(line,start,end) \
if (line->firstchar == _NOCHANGE \
|| line->firstchar > (start)) \
- line->firstchar = start; \
- line->lastchar = end
+ line->firstchar = (NCURSES_SIZE_T) start; \
+ line->lastchar = (NCURSES_SIZE_T) end
#define SIZEOF(v) (sizeof(v)/sizeof(v[0]))
@@ -1214,8 +1464,8 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
* Standardize/simplify common loops
*/
#define each_screen(p) p = _nc_screen_chain; p != 0; p = (p)->_next_screen
-#define each_window(p) p = _nc_windows; p != 0; p = (p)->next
-#define each_ripoff(p) p = ripoff_stack; (p - ripoff_stack) < N_RIPS; ++p
+#define each_window(sp,p) p = WindowList(sp); p != 0; p = (p)->next
+#define each_ripoff(p) p = safe_ripoff_stack; (p - safe_ripoff_stack) < N_RIPS; ++p
/*
* Prefixes for call/return points of library function traces. We use these to
@@ -1256,15 +1506,22 @@ extern NCURSES_EXPORT(void) _nc_locked_tracef (const char *, ...) GCC_PRINTFLIKE
#define TR(n, a) if (USE_TRACEF(n)) _nc_locked_tracef a
#define T(a) TR(TRACE_CALLS, a)
-#define TRACE_RETURN(value,type) return _nc_retrace_##type(value)
+#define TRACE_RETURN(value,type) return _nc_retrace_##type(value)
+#define TRACE_RETURN2(value,dst,src) return _nc_retrace_##dst##_##src(value)
+#define TRACE_RETURN_SP(value,type) return _nc_retrace_##type(SP_PARM, value)
+
+#define NonNull(s) ((s) != 0 ? s : "<null>")
#define returnAttr(code) TRACE_RETURN(code,attr_t)
#define returnBits(code) TRACE_RETURN(code,unsigned)
#define returnBool(code) TRACE_RETURN(code,bool)
#define returnCPtr(code) TRACE_RETURN(code,cptr)
#define returnCVoidPtr(code) TRACE_RETURN(code,cvoid_ptr)
-#define returnChar(code) TRACE_RETURN(code,chtype)
+#define returnChar(code) TRACE_RETURN(code,char)
+#define returnChtype(code) TRACE_RETURN(code,chtype)
#define returnCode(code) TRACE_RETURN(code,int)
+#define returnIntAttr(code) TRACE_RETURN2(code,int,attr_t)
+#define returnMMask(code) TRACE_RETURN_SP(code,mmask_t)
#define returnPtr(code) TRACE_RETURN(code,ptr)
#define returnSP(code) TRACE_RETURN(code,sp)
#define returnVoid T((T_RETURN(""))); return
@@ -1282,7 +1539,10 @@ extern NCURSES_EXPORT(char *) _nc_varargs (const char *, va_list);
extern NCURSES_EXPORT(chtype) _nc_retrace_chtype (chtype);
extern NCURSES_EXPORT(const char *) _nc_altcharset_name(attr_t, chtype);
extern NCURSES_EXPORT(const char *) _nc_retrace_cptr (const char *);
+extern NCURSES_EXPORT(char) _nc_retrace_char (char);
extern NCURSES_EXPORT(int) _nc_retrace_int (int);
+extern NCURSES_EXPORT(int) _nc_retrace_int_attr_t (attr_t);
+extern NCURSES_EXPORT(mmask_t) _nc_retrace_mmask_t (SCREEN *, mmask_t);
extern NCURSES_EXPORT(unsigned) _nc_retrace_unsigned (unsigned);
extern NCURSES_EXPORT(void *) _nc_retrace_void_ptr (void *);
extern NCURSES_EXPORT(void) _nc_fifo_dump (SCREEN *);
@@ -1322,8 +1582,11 @@ extern NCURSES_EXPORT(const char *) _nc_viscbuf (const NCURSES_CH_T *, int);
#define returnBool(code) return code
#define returnCPtr(code) return code
#define returnCVoidPtr(code) return code
-#define returnChar(code) return code
+#define returnChar(code) return ((char) code)
+#define returnChtype(code) return code
#define returnCode(code) return code
+#define returnIntAttr(code) return code
+#define returnMMask(code) return code
#define returnPtr(code) return code
#define returnSP(code) return code
#define returnVoid return
@@ -1333,6 +1596,15 @@ extern NCURSES_EXPORT(const char *) _nc_viscbuf (const NCURSES_CH_T *, int);
#endif /* TRACE/!TRACE */
/*
+ * Workaround for defective implementation of gcc attribute warn_unused_result
+ */
+#if defined(__GNUC__) && defined(_FORTIFY_SOURCE)
+#define IGNORE_RC(func) errno = (int) func
+#else
+#define IGNORE_RC(func) (void) func
+#endif /* gcc workarounds */
+
+/*
* Return-codes for tgetent() and friends.
*/
#define TGETENT_YES 1 /* entry is found */
@@ -1348,57 +1620,58 @@ extern NCURSES_EXPORT(void) name (void); \
#define ALL_BUT_COLOR ((chtype)~(A_COLOR))
#define NONBLANK_ATTR (A_NORMAL|A_BOLD|A_DIM|A_BLINK)
-#define XMC_CHANGES(c) ((c) & SP->_xmc_suppress)
+#define XMC_CHANGES(c) ((c) & SP_PARM->_xmc_suppress)
#define toggle_attr_on(S,at) {\
- if (PAIR_NUMBER(at) > 0) {\
- (S) = ((S) & ALL_BUT_COLOR) | (at);\
+ if (PairNumber(at) > 0) {\
+ (S) = ((S) & ALL_BUT_COLOR) | (attr_t) (at);\
} else {\
- (S) |= (at);\
+ (S) |= (attr_t) (at);\
}\
TR(TRACE_ATTRS, ("new attribute is %s", _traceattr((S))));}
#define toggle_attr_off(S,at) {\
- if (PAIR_NUMBER(at) > 0) {\
+ if (PairNumber(at) > 0) {\
(S) &= ~(at|A_COLOR);\
} else {\
(S) &= ~(at);\
}\
TR(TRACE_ATTRS, ("new attribute is %s", _traceattr((S))));}
-#define DelCharCost(count) \
+#define DelCharCost(sp,count) \
((parm_dch != 0) \
- ? SP->_dch_cost \
+ ? sp->_dch_cost \
: ((delete_character != 0) \
- ? (SP->_dch1_cost * count) \
+ ? (sp->_dch1_cost * count) \
: INFINITY))
-#define InsCharCost(count) \
+#define InsCharCost(sp,count) \
((parm_ich != 0) \
- ? SP->_ich_cost \
+ ? sp->_ich_cost \
: ((enter_insert_mode && exit_insert_mode) \
- ? SP->_smir_cost + SP->_rmir_cost + (SP->_ip_cost * count) \
+ ? sp->_smir_cost + sp->_rmir_cost + (sp->_ip_cost * count) \
: ((insert_character != 0) \
- ? ((SP->_ich1_cost + SP->_ip_cost) * count) \
+ ? ((sp->_ich1_cost + sp->_ip_cost) * count) \
: INFINITY)))
#if USE_XMC_SUPPORT
-#define UpdateAttrs(c) if (!SameAttrOf(SCREEN_ATTRS(SP), c)) { \
- attr_t chg = AttrOf(SCREEN_ATTRS(SP)); \
- VIDATTR(AttrOf(c), GetPair(c)); \
+#define UpdateAttrs(sp,c) if (!SameAttrOf(SCREEN_ATTRS(sp), c)) { \
+ attr_t chg = AttrOf(SCREEN_ATTRS(sp)); \
+ VIDATTR(sp, AttrOf(c), GetPair(c)); \
if (magic_cookie_glitch > 0 \
- && XMC_CHANGES((chg ^ AttrOf(SCREEN_ATTRS(SP))))) { \
+ && XMC_CHANGES((chg ^ AttrOf(SCREEN_ATTRS(sp))))) { \
T(("%s @%d before glitch %d,%d", \
__FILE__, __LINE__, \
- SP->_cursrow, \
- SP->_curscol)); \
- _nc_do_xmc_glitch(chg); \
+ sp->_cursrow, \
+ sp->_curscol)); \
+ NCURSES_SP_NAME(_nc_do_xmc_glitch)(NCURSES_SP_ARGx chg); \
} \
}
#else
-#define UpdateAttrs(c) if (!SameAttrOf(SCREEN_ATTRS(SP), c)) \
- VIDATTR(AttrOf(c), GetPair(c));
+#define UpdateAttrs(sp,c) if (!SameAttrOf(SCREEN_ATTRS(sp), c)) { \
+ VIDATTR(sp, AttrOf(c), GetPair(c)); \
+ }
#endif
/*
@@ -1408,10 +1681,12 @@ extern NCURSES_EXPORT(void) name (void); \
#define EVENTLIST_0th(param) param
#define EVENTLIST_1st(param) param
#define EVENTLIST_2nd(param) , param
+#define TWAIT_MASK (TW_ANY | TW_EVENT)
#else
#define EVENTLIST_0th(param) void
#define EVENTLIST_1st(param) /* nothing */
#define EVENTLIST_2nd(param) /* nothing */
+#define TWAIT_MASK TW_ANY
#endif
#if NCURSES_EXPANDED && NCURSES_EXT_FUNCS
@@ -1425,16 +1700,28 @@ extern NCURSES_EXPORT(void) _nc_toggle_attr_on (attr_t *, attr_t);
extern NCURSES_EXPORT(void) _nc_toggle_attr_off (attr_t *, attr_t);
#undef DelCharCost
-#define DelCharCost(count) _nc_DelCharCost(count)
-extern NCURSES_EXPORT(int) _nc_DelCharCost (int);
+#define DelCharCost(sp, count) NCURSES_SP_NAME(_nc_DelCharCost)(NCURSES_SP_ARGx count)
#undef InsCharCost
-#define InsCharCost(count) _nc_InsCharCost(count)
-extern NCURSES_EXPORT(int) _nc_InsCharCost (int);
+#define InsCharCost(sp, count) NCURSES_SP_NAME(_nc_InsCharCost)(NCURSES_SP_ARGx count)
+
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_DelCharCost) (NCURSES_SP_DCLx int _c);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_InsCharCost) (NCURSES_SP_DCLx int _c);
#undef UpdateAttrs
-#define UpdateAttrs(c) _nc_UpdateAttrs(c)
-extern NCURSES_EXPORT(void) _nc_UpdateAttrs (NCURSES_CH_T);
+#define UpdateAttrs(sp,c) NCURSES_SP_NAME(_nc_UpdateAttrs)(NCURSES_SP_ARGx CHREF(c))
+
+#if USE_WIDEC_SUPPORT || defined(NEED_NCURSES_CH_T)
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_UpdateAttrs) (NCURSES_SP_DCLx CARG_CH_T _c);
+#else
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_UpdateAttrs) (NCURSES_SP_DCLx chtype c);
+#endif
+
+#if NCURSES_SP_FUNCS
+extern NCURSES_EXPORT(int) _nc_DelCharCost (int);
+extern NCURSES_EXPORT(int) _nc_InsCharCost (int);
+extern NCURSES_EXPORT(void) _nc_UpdateAttrs (CARG_CH_T);
+#endif /* NCURSES_SP_FUNCS */
#else
@@ -1483,8 +1770,8 @@ extern NCURSES_EXPORT(void) _nc_linedump (void);
#endif
/* lib_acs.c */
-extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */
-extern NCURSES_EXPORT(int) _nc_msec_cost (const char *const, int); /* used by 'tack' program */
+extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */
+extern NCURSES_EXPORT(int) _nc_msec_cost (const char *const, int); /* used by 'tack' program */
/* lib_addch.c */
#if USE_WIDEC_SUPPORT
@@ -1492,7 +1779,7 @@ NCURSES_EXPORT(int) _nc_build_wch(WINDOW *win, ARG_CH_T ch);
#endif
/* lib_addstr.c */
-#if USE_WIDEC_SUPPORT && !defined(USE_TERMLIB)
+#if USE_WIDEC_SUPPORT && !(defined(USE_TERMLIB) || defined(USE_BUILD_CC))
extern NCURSES_EXPORT(int) _nc_wchstrlen(const cchar_t *);
#endif
@@ -1500,10 +1787,10 @@ extern NCURSES_EXPORT(int) _nc_wchstrlen(const cchar_t *);
extern NCURSES_EXPORT(bool) _nc_reset_colors(void);
/* lib_getch.c */
-extern NCURSES_EXPORT(int) _nc_wgetch(WINDOW *, unsigned long *, int EVENTLIST_2nd(_nc_eventlist *));
+extern NCURSES_EXPORT(int) _nc_wgetch(WINDOW *, int *, int EVENTLIST_2nd(_nc_eventlist *));
/* lib_insch.c */
-extern NCURSES_EXPORT(int) _nc_insert_ch(WINDOW *, chtype);
+extern NCURSES_EXPORT(int) _nc_insert_ch(SCREEN *, WINDOW *, chtype);
/* lib_mvcur.c */
#define INFINITY 1000000 /* cost: too high to use */
@@ -1519,7 +1806,7 @@ extern NCURSES_EXPORT(void) _nc_screen_resume (void);
extern NCURSES_EXPORT(void) _nc_screen_wrap (void);
/* lib_mouse.c */
-extern NCURSES_EXPORT(int) _nc_has_mouse (void);
+extern NCURSES_EXPORT(bool) _nc_has_mouse (SCREEN *);
/* lib_mvcur.c */
#define INFINITY 1000000 /* cost: too high to use */
@@ -1527,10 +1814,13 @@ extern NCURSES_EXPORT(int) _nc_has_mouse (void);
/* lib_setup.c */
extern NCURSES_EXPORT(char *) _nc_get_locale(void);
-extern NCURSES_EXPORT(int) _nc_unicode_locale(void);
-extern NCURSES_EXPORT(int) _nc_locale_breaks_acs(TERMINAL *);
-extern NCURSES_EXPORT(int) _nc_setupterm(NCURSES_CONST char *, int, int *, bool);
-extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, int *, int *);
+extern NCURSES_EXPORT(int) _nc_unicode_locale(void);
+extern NCURSES_EXPORT(int) _nc_locale_breaks_acs(TERMINAL *);
+extern NCURSES_EXPORT(int) _nc_setupterm(NCURSES_CONST char *, int, int *, bool);
+extern NCURSES_EXPORT(void) _nc_tinfo_cmdch(TERMINAL *, char);
+
+/* lib_set_term.c */
+extern NCURSES_EXPORT(int) _nc_ripoffline(int, int(*)(WINDOW*, int));
/* lib_tstp.c */
#if USE_SIGWINCH
@@ -1539,9 +1829,6 @@ extern NCURSES_EXPORT(int) _nc_handle_sigwinch(SCREEN *);
#define _nc_handle_sigwinch(a) /* nothing */
#endif
-/* lib_ungetch.c */
-extern NCURSES_EXPORT(int) _nc_ungetch (SCREEN *, int);
-
/* lib_wacs.c */
#if USE_WIDEC_SUPPORT
extern NCURSES_EXPORT(void) _nc_init_wacs(void);
@@ -1577,9 +1864,8 @@ extern NCURSES_EXPORT(int) _nc_remove_string (TRIES **, const char *);
/* elsewhere ... */
extern NCURSES_EXPORT(ENTRY *) _nc_delink_entry (ENTRY *, TERMTYPE *);
-extern NCURSES_EXPORT(NCURSES_CONST char *) _nc_keyname (SCREEN *, int);
-extern NCURSES_EXPORT(NCURSES_CONST char *) _nc_unctrl (SCREEN *, chtype);
extern NCURSES_EXPORT(SCREEN *) _nc_screen_of (WINDOW *);
+extern NCURSES_EXPORT(TERMINAL*) _nc_get_cur_term (void);
extern NCURSES_EXPORT(WINDOW *) _nc_makenew (int, int, int, int, int);
extern NCURSES_EXPORT(char *) _nc_trace_buf (int, size_t);
extern NCURSES_EXPORT(char *) _nc_trace_bufcat (int, const char *);
@@ -1592,12 +1878,15 @@ extern NCURSES_EXPORT(int) _nc_getenv_num (const char *);
extern NCURSES_EXPORT(int) _nc_keypad (SCREEN *, bool);
extern NCURSES_EXPORT(int) _nc_ospeed (int);
extern NCURSES_EXPORT(int) _nc_outch (int);
+extern NCURSES_EXPORT(int) _nc_putp(const char *, const char *);
+extern NCURSES_EXPORT(int) _nc_putp_flush(const char *, const char *);
extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const);
extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, bool, int);
+extern NCURSES_EXPORT(int) _nc_setup_tinfo(const char *, TERMTYPE *);
extern NCURSES_EXPORT(int) _nc_timed_wait (SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *));
-extern NCURSES_EXPORT(void) _nc_do_color (short, short, bool, int (*)(int));
+extern NCURSES_EXPORT(void) _nc_do_color (short, short, bool, NCURSES_OUTC);
extern NCURSES_EXPORT(void) _nc_flush (void);
-extern NCURSES_EXPORT(void) _nc_free_and_exit (int);
+extern NCURSES_EXPORT(void) _nc_free_and_exit (int) GCC_NORETURN;
extern NCURSES_EXPORT(void) _nc_free_entry (ENTRY *, TERMTYPE *);
extern NCURSES_EXPORT(void) _nc_freeall (void);
extern NCURSES_EXPORT(void) _nc_hash_map (void);
@@ -1622,13 +1911,17 @@ extern NCURSES_EXPORT(void) _nc_names_leaks(void);
extern NCURSES_EXPORT(void) _nc_tgetent_leaks(void);
#endif
-#ifndef USE_TERMLIB
+#if !(defined(USE_TERMLIB) || defined(USE_BUILD_CC))
extern NCURSES_EXPORT(NCURSES_CH_T) _nc_render (WINDOW *, NCURSES_CH_T);
extern NCURSES_EXPORT(int) _nc_waddch_nosync (WINDOW *, const NCURSES_CH_T);
extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, NCURSES_SIZE_T const, NCURSES_SIZE_T const, NCURSES_CH_T);
#endif
-#if USE_WIDEC_SUPPORT && !defined(USE_TERMLIB)
+#if USE_WIDEC_SUPPORT
+extern NCURSES_EXPORT(int) _nc_insert_wch(WINDOW *, const cchar_t *);
+#endif
+
+#if USE_WIDEC_SUPPORT && !(defined(USE_TERMLIB) || defined(USE_BUILD_CC))
extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate_t *);
#endif
@@ -1650,6 +1943,26 @@ extern NCURSES_EXPORT(int) _nc_eventlist_timeout(_nc_eventlist *);
#endif
/*
+ * Wide-character macros to hide some platform-differences.
+ */
+#if USE_WIDEC_SUPPORT
+#if HAVE_MBTOWC && HAVE_MBLEN
+#define reset_mbytes(state) IGNORE_RC(mblen(NULL, 0)), IGNORE_RC(mbtowc(NULL, NULL, 0))
+#define count_mbytes(buffer,length,state) mblen(buffer,length)
+#define check_mbytes(wch,buffer,length,state) \
+ (int) mbtowc(&wch, buffer, length)
+#define state_unused
+#elif HAVE_MBRTOWC && HAVE_MBRLEN
+#define reset_mbytes(state) init_mb(state)
+#define count_mbytes(buffer,length,state) mbrlen(buffer,length,&state)
+#define check_mbytes(wch,buffer,length,state) \
+ (int) mbrtowc(&wch, buffer, length, &state)
+#else
+make an error
+#endif
+#endif
+
+/*
* Not everyone has vsscanf(), but we'd like to use it for scanw().
*/
#if !HAVE_VSSCANF
@@ -1661,24 +1974,34 @@ extern NCURSES_EXPORT_VAR(int *) _nc_oldnums;
#define USE_SETBUF_0 0
-#define NC_BUFFERED(flag) _nc_set_buffer(SP->_ofp, flag)
+#define NC_BUFFERED(sp,flag) NCURSES_SP_NAME(_nc_set_buffer)(NCURSES_SP_ARGx sp->_ofp, flag)
-#define NC_OUTPUT ((SP != 0) ? SP->_ofp : stdout)
+#define NC_OUTPUT(sp) ((sp != 0) ? sp->_ofp : stdout)
/*
* On systems with a broken linker, define 'SP' as a function to force the
* linker to pull in the data-only module with 'SP'.
*/
+#define _nc_alloc_screen_sp() typeCalloc(SCREEN, 1)
+
#if BROKEN_LINKER
#define SP _nc_screen()
extern NCURSES_EXPORT(SCREEN *) _nc_screen (void);
-extern NCURSES_EXPORT(int) _nc_alloc_screen (void);
-extern NCURSES_EXPORT(void) _nc_set_screen (SCREEN *);
+extern NCURSES_EXPORT(int) _nc_alloc_screen (void);
+extern NCURSES_EXPORT(void) _nc_set_screen (SCREEN *);
+#define CURRENT_SCREEN _nc_screen()
#else
/* current screen is private data; avoid possible linking conflicts too */
extern NCURSES_EXPORT_VAR(SCREEN *) SP;
-#define _nc_alloc_screen() ((SP = typeCalloc(SCREEN, 1)) != 0)
-#define _nc_set_screen(sp) SP = sp
+#define CURRENT_SCREEN SP
+#define _nc_alloc_screen() ((SP = _nc_alloc_screen_sp()) != 0)
+#define _nc_set_screen(sp) SP = sp
+#endif
+
+#if NCURSES_SP_FUNCS
+#define CURRENT_SCREEN_PRE (IsPreScreen(CURRENT_SCREEN) ? CURRENT_SCREEN : new_prescr())
+#else
+#define CURRENT_SCREEN_PRE CURRENT_SCREEN
#endif
/*
@@ -1686,10 +2009,11 @@ extern NCURSES_EXPORT_VAR(SCREEN *) SP;
* if the application is running multiple screens under X, it's quite possible
* they could all have type xterm but have different sizes! So...
*/
-#define screen_lines SP->_lines
-#define screen_columns SP->_columns
+#define screen_lines(sp) (sp)->_lines
+#define screen_columns(sp) (sp)->_columns
extern NCURSES_EXPORT(int) _nc_slk_initialize (WINDOW *, int);
+extern NCURSES_EXPORT(int) _nc_format_slks (NCURSES_SP_DCLx int _c);
/*
* Some constants related to SLK's
@@ -1707,16 +2031,282 @@ extern NCURSES_EXPORT(int) _nc_slk_initialize (WINDOW *, int);
#define MAX_SKEY(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_OLD : MAX_SKEY_PC)
#define MAX_SKEY_LEN(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_LEN_OLD : MAX_SKEY_LEN_PC)
-extern NCURSES_EXPORT(int) _nc_ripoffline (int line, int (*init)(WINDOW *,int));
-
/*
* Common error messages
*/
#define MSG_NO_MEMORY "Out of memory"
#define MSG_NO_INPUTS "Premature EOF"
+extern NCURSES_EXPORT(int) _nc_set_tty_mode(TTY *);
+extern NCURSES_EXPORT(int) _nc_get_tty_mode(TTY *);
+
+/* timed_wait flag definitions */
+#define TW_NONE 0
+#define TW_INPUT 1
+#define TW_MOUSE 2
+#define TW_ANY (TW_INPUT | TW_MOUSE)
+#define TW_EVENT 4
+
+#define SetSafeOutcWrapper(outc) \
+ SCREEN* sp = CURRENT_SCREEN; \
+ if (sp==0) { \
+ struct screen dummy; \
+ sp = &dummy; \
+ memset(sp,0,sizeof(struct screen)); \
+ sp->_outch = _nc_outc_wrapper; \
+ }\
+ sp->jump = outc
+
+#ifdef USE_TERM_DRIVER
+typedef void* TERM_HANDLE;
+
+typedef struct _termInfo
+{
+ bool caninit;
+
+ bool hascolor;
+ bool initcolor;
+ bool canchange;
+
+ int tabsize;
+
+ int maxcolors;
+ int maxpairs;
+ int nocolorvideo;
+
+ int numbuttons;
+ int numlabels;
+ int labelwidth;
+ int labelheight;
+
+ const color_t* defaultPalette;
+} TerminalInfo;
+
+typedef struct term_driver {
+ bool isTerminfo;
+ bool (*CanHandle)(struct DriverTCB*,const char*,int*);
+ void (*init)(struct DriverTCB*);
+ void (*release)(struct DriverTCB*);
+ int (*size)(struct DriverTCB*, int* Line, int *Cols);
+ int (*sgmode)(struct DriverTCB*, bool setFlag, TTY*);
+ chtype (*conattr)(struct DriverTCB*);
+ int (*hwcur)(struct DriverTCB*, int yold, int xold, int y, int x);
+ int (*mode)(struct DriverTCB*, bool progFlag, bool defFlag);
+ bool (*rescol)(struct DriverTCB*);
+ bool (*rescolors)(struct DriverTCB*);
+ void (*color)(struct DriverTCB*,bool fore, int color, int(*)(SCREEN*,int));
+ int (*doBeepOrFlash)(struct DriverTCB*, bool);
+ void (*initpair)(struct DriverTCB*,short,short,short);
+ void (*initcolor)(struct DriverTCB*,short,short,short,short);
+ void (*docolor)(struct DriverTCB*,short,short,bool,int(*)(SCREEN*,int));
+ void (*initmouse)(struct DriverTCB*);
+ int (*testmouse)(struct DriverTCB*,int);
+ void (*setfilter)(struct DriverTCB*);
+ void (*hwlabel)(struct DriverTCB*,int,char*);
+ void (*hwlabelOnOff)(struct DriverTCB*,bool);
+ int (*update)(struct DriverTCB*);
+ int (*defaultcolors)(struct DriverTCB*,int,int);
+ int (*print)(struct DriverTCB*,char*,int);
+ int (*getsize)(struct DriverTCB*,int*,int*);
+ int (*setsize)(struct DriverTCB*,int,int);
+ void (*initacs)(struct DriverTCB*,chtype*,chtype*);
+ void (*scinit)(SCREEN *);
+ void (*scexit)(SCREEN *);
+ int (*twait)(struct DriverTCB*,int,int,int* EVENTLIST_2nd(_nc_eventlist*));
+ int (*read)(struct DriverTCB*,int*);
+ int (*nap)(struct DriverTCB*,int);
+ int (*kpad)(struct DriverTCB*, bool);
+ int (*kyOk)(struct DriverTCB*, int, bool);
+ bool (*kyExist)(struct DriverTCB*, int);
+} TERM_DRIVER;
+
+typedef struct DriverTCB
+{
+ TERMINAL term; /* needs to be the first Element !!! */
+ TERM_HANDLE inp; /* The input handle of the Terminal */
+ TERM_HANDLE out; /* The output handle of the Terminal in shell mode */
+ TERM_HANDLE hdl; /* The output handle of the Terminal in prog mode */
+ TERM_DRIVER* drv; /* The driver for that Terminal */
+ SCREEN* csp; /* The screen that owns that Terminal */
+ TerminalInfo info; /* Driver independent core capabilities of the Terminal */
+ void* prop; /* Driver dependent property storage to be used by the Driver */
+ long magic;
+} TERMINAL_CONTROL_BLOCK;
+
+#define NCDRV_MAGIC(id) (0x47110000 | (id&0xffff))
+#define NCDRV_TINFO 0x01
+#define NCDRV_WINCONSOLE 0x02
+
+#define TCBOf(sp) ((TERMINAL_CONTROL_BLOCK*)(TerminalOf(sp)))
+#define InfoOf(sp) TCBOf(sp)->info
+#define CallDriver(sp,method) TCBOf(sp)->drv->method(TCBOf(sp))
+#define CallDriver_1(sp,method,arg1) TCBOf(sp)->drv->method(TCBOf(sp),arg1)
+#define CallDriver_2(sp,method,arg1,arg2) TCBOf(sp)->drv->method(TCBOf(sp),arg1,arg2)
+#define CallDriver_3(sp,method,arg1,arg2,arg3) TCBOf(sp)->drv->method(TCBOf(sp),arg1,arg2,arg3)
+#define CallDriver_4(sp,method,arg1,arg2,arg3,arg4) TCBOf(sp)->drv->method(TCBOf(sp),arg1,arg2,arg3,arg4)
+
+extern NCURSES_EXPORT_VAR(const color_t*) _nc_cga_palette;
+extern NCURSES_EXPORT_VAR(const color_t*) _nc_hls_palette;
+
+extern NCURSES_EXPORT(int) _nc_get_driver(TERMINAL_CONTROL_BLOCK*, const char*, int*);
+extern NCURSES_EXPORT(void) _nc_get_screensize_ex(SCREEN *, TERMINAL *, int *, int *);
+#endif /* USE_TERM_DRIVER */
+
+/*
+ * Entrypoints which are actually provided in the terminal driver, which would
+ * be an sp-name otherwise.
+ */
+#ifdef USE_TERM_DRIVER
+#define TINFO_HAS_KEY _nc_tinfo_has_key
+#define TINFO_DOUPDATE _nc_tinfo_doupdate
+#define TINFO_MVCUR _nc_tinfo_mvcur
+extern NCURSES_EXPORT(int) TINFO_HAS_KEY(SCREEN*, int);
+extern NCURSES_EXPORT(int) TINFO_DOUPDATE(SCREEN *);
+extern NCURSES_EXPORT(int) TINFO_MVCUR(SCREEN*, int, int, int, int);
+#else
+#define TINFO_HAS_KEY NCURSES_SP_NAME(has_key)
+#define TINFO_DOUPDATE NCURSES_SP_NAME(doupdate)
+#define TINFO_MVCUR NCURSES_SP_NAME(mvcur)
+#endif
+
+/*
+ * Entrypoints using an extra parameter with the terminal driver.
+ */
+#ifdef USE_TERM_DRIVER
+extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, TERMINAL *, int *, int *);
+extern NCURSES_EXPORT(int) _nc_setupterm_ex(TERMINAL **, NCURSES_CONST char *, int , int *, bool);
+#define TINFO_GET_SIZE(sp, tp, lp, cp) \
+ _nc_get_screensize(sp, tp, lp, cp)
+#define TINFO_SET_CURTERM(sp, tp) \
+ NCURSES_SP_NAME(set_curterm)(sp, tp)
+#define TINFO_SETUP_TERM(tpp, name, fd, err, reuse) \
+ _nc_setupterm_ex(tpp, name, fd, err, reuse)
+#else /* !USE_TERM_DRIVER */
+extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, int *, int *);
+#define TINFO_GET_SIZE(sp, tp, lp, cp) \
+ _nc_get_screensize(sp, lp, cp)
+#define TINFO_SET_CURTERM(sp, tp) \
+ set_curterm(tp)
+#define TINFO_SETUP_TERM(tpp, name, fd, err, reuse) \
+ _nc_setupterm(name, fd, err, reuse)
+#endif /* !USE_TERM_DRIVER */
+
+#ifdef USE_TERM_DRIVER
+#ifdef __MINGW32__
+#include <nc_mingw.h>
+extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_WIN_DRIVER;
+#endif
+extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER;
+#endif
+
+#ifdef USE_TERM_DRIVER
+#define IsTermInfo(sp) (TCBOf(sp) && ((TCBOf(sp)->drv->isTerminfo)))
+#else
+#define IsTermInfo(sp) TRUE
+#endif
+
+#define HasTInfoTerminal(sp) ((0 != TerminalOf(sp)) && IsTermInfo(sp))
+#define IsValidTIScreen(sp) (HasTInfoTerminal(sp))
+
+/*
+ * Exported entrypoints beyond the published API
+ */
+#if NCURSES_SP_FUNCS
+extern NCURSES_EXPORT(WINDOW *) _nc_curscr_of(SCREEN*);
+extern NCURSES_EXPORT(WINDOW *) _nc_newscr_of(SCREEN*);
+extern NCURSES_EXPORT(WINDOW *) _nc_stdscr_of(SCREEN*);
+extern NCURSES_EXPORT(int) _nc_outc_wrapper(SCREEN*,int);
+
+#if USE_REENTRANT
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_TABSIZE)(SCREEN*);
+extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(longname)(SCREEN*);
+#endif
+
+#if NCURSES_EXT_FUNCS
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_set_tabsize)(SCREEN*, int);
+#endif
+
+/*
+ * We put the safe versions of various calls here as they are not published
+ * part of the API up to now
+ */
+extern NCURSES_EXPORT(TERMINAL*) NCURSES_SP_NAME(_nc_get_cur_term) (SCREEN *sp);
+extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(_nc_makenew) (SCREEN*, int, int, int, int, int);
+extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(_nc_reset_colors)(SCREEN*);
+extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(_nc_printf_string)(SCREEN*, const char *, va_list);
+extern NCURSES_EXPORT(chtype) NCURSES_SP_NAME(_nc_acs_char)(SCREEN*,int);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_curs_set)(SCREEN*,int);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_get_tty_mode)(SCREEN*,TTY*);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_mcprint)(SCREEN*,char*, int);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_msec_cost)(SCREEN*, const char *, int);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_outch)(SCREEN*, int);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putp)(SCREEN*, const char *, const char*);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putp_flush)(SCREEN*, const char *, const char *);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_resetty)(SCREEN*);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_resize_term)(SCREEN*,int,int);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_ripoffline)(SCREEN*, int, int (*)(WINDOW *,int));
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_savetty)(SCREEN*);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_scr_init)(SCREEN*,const char*);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_scr_restore)(SCREEN*, const char*);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_scrolln)(SCREEN*, int, int, int, int);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_set_tty_mode)(SCREEN*, TTY*);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_setupscreen)(SCREEN**, int, int, FILE *, bool, int);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tgetent)(SCREEN*,char*,const char *);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tigetnum)(SCREEN*,NCURSES_CONST char*);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vid_attr)(SCREEN *, attr_t, short, void *);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vidputs)(SCREEN*,chtype,int(*) (SCREEN*, int));
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_color)(SCREEN*, short, short, bool, NCURSES_SP_OUTC);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_xmc_glitch)(SCREEN*, attr_t);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_flush)(SCREEN*);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_free_and_exit)(SCREEN*, int) GCC_NORETURN;
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_freeall)(SCREEN*);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_hash_map)(SCREEN*);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_init_acs)(SCREEN*);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_make_oldhash)(SCREEN*, int i);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_mvcur_init)(SCREEN*);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_mvcur_resume)(SCREEN*);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_mvcur_wrap)(SCREEN*);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_screen_init)(SCREEN*);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_screen_resume)(SCREEN*);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_screen_wrap)(SCREEN*);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_scroll_oldhash)(SCREEN*, int n, int top, int bot);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_scroll_optimize)(SCREEN*);
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_set_buffer)(SCREEN*, FILE *, bool);
+
+extern NCURSES_EXPORT(void) _nc_cookie_init(SCREEN *sp);
+
+#if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG)
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_linedump)(SCREEN*);
+#endif
+
+#if USE_WIDEC_SUPPORT
+extern NCURSES_EXPORT(wchar_t *) NCURSES_SP_NAME(_nc_wunctrl)(SCREEN*, cchar_t *);
+#endif
+
+#endif /* NCURSES_SP_FUNCS */
+
+#if NCURSES_SP_FUNCS
+
+#define safe_keyname NCURSES_SP_NAME(keyname)
+#define safe_unctrl NCURSES_SP_NAME(unctrl)
+#define safe_ungetch NCURSES_SP_NAME(ungetch)
+
+#else
+
+#define safe_keyname _nc_keyname
+#define safe_unctrl _nc_unctrl
+#define safe_ungetch _nc_ungetch
+
+extern NCURSES_EXPORT(NCURSES_CONST char *) _nc_keyname (SCREEN *, int);
+extern NCURSES_EXPORT(int) _nc_ungetch (SCREEN *, int);
+extern NCURSES_EXPORT(NCURSES_CONST char *) _nc_unctrl (SCREEN *, chtype);
+
+#endif
+
#ifdef __cplusplus
}
#endif
+/* *INDENT-ON* */
+
#endif /* CURSES_PRIV_H */
diff --git a/contrib/ncurses/ncurses/llib-lncurses b/contrib/ncurses/ncurses/llib-lncurses
index cc0e3667e681..48f42830272a 100644
--- a/contrib/ncurses/ncurses/llib-lncurses
+++ b/contrib/ncurses/ncurses/llib-lncurses
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 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-2008 *
+ * Author: Thomas E. Dickey 1996-2010,2011 *
****************************************************************************/
/* LINTLIBRARY */
@@ -38,27 +38,54 @@
#undef _nc_oldnums
int *_nc_oldnums;
+#undef _nc_scroll_optimize_sp
+void _nc_scroll_optimize_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_scroll_optimize
void _nc_scroll_optimize(void)
{ /* void */ }
+#undef _nc_linedump_sp
+void _nc_linedump_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_linedump
void _nc_linedump(void)
{ /* void */ }
/* ./tty/hashmap.c */
-#include <term.h>
+#undef _nc_hash_map_sp
+void _nc_hash_map_sp(
+ SCREEN *sp)
+ { /* void */ }
#undef _nc_hash_map
void _nc_hash_map(void)
{ /* void */ }
+#undef _nc_make_oldhash_sp
+void _nc_make_oldhash_sp(
+ SCREEN *sp,
+ int i)
+ { /* void */ }
+
#undef _nc_make_oldhash
void _nc_make_oldhash(
int i)
{ /* void */ }
+#undef _nc_scroll_oldhash_sp
+void _nc_scroll_oldhash_sp(
+ SCREEN *sp,
+ int n,
+ int top,
+ int bot)
+ { /* void */ }
+
#undef _nc_scroll_oldhash
void _nc_scroll_oldhash(
int n,
@@ -112,6 +139,11 @@ int waddchnstr(
/* ./base/lib_beep.c */
+#undef beep_sp
+int beep_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef beep
int beep(void)
{ return(*(int *)0); }
@@ -194,14 +226,32 @@ int COLOR_PAIRS;
#undef COLORS
int COLORS;
+#undef _nc_reset_colors_sp
+NCURSES_BOOL _nc_reset_colors_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef _nc_reset_colors
NCURSES_BOOL _nc_reset_colors(void)
{ return(*(NCURSES_BOOL *)0); }
+#undef start_color_sp
+int start_color_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef start_color
int start_color(void)
{ return(*(int *)0); }
+#undef init_pair_sp
+int init_pair_sp(
+ SCREEN *sp,
+ short pair,
+ short f,
+ short b)
+ { return(*(int *)0); }
+
#undef init_pair
int init_pair(
short pair,
@@ -209,6 +259,15 @@ int init_pair(
short b)
{ return(*(int *)0); }
+#undef init_color_sp
+int init_color_sp(
+ SCREEN *sp,
+ short color,
+ short r,
+ short g,
+ short b)
+ { return(*(int *)0); }
+
#undef init_color
int init_color(
short color,
@@ -217,14 +276,33 @@ int init_color(
short b)
{ return(*(int *)0); }
+#undef can_change_color_sp
+NCURSES_BOOL can_change_color_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef can_change_color
NCURSES_BOOL can_change_color(void)
{ return(*(NCURSES_BOOL *)0); }
+#undef has_colors_sp
+NCURSES_BOOL has_colors_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef has_colors
NCURSES_BOOL has_colors(void)
{ return(*(NCURSES_BOOL *)0); }
+#undef color_content_sp
+int color_content_sp(
+ SCREEN *sp,
+ short color,
+ short *r,
+ short *g,
+ short *b)
+ { return(*(int *)0); }
+
#undef color_content
int color_content(
short color,
@@ -233,6 +311,14 @@ int color_content(
short *b)
{ return(*(int *)0); }
+#undef pair_content_sp
+int pair_content_sp(
+ SCREEN *sp,
+ short pair,
+ short *f,
+ short *b)
+ { return(*(int *)0); }
+
#undef pair_content
int pair_content(
short pair,
@@ -240,13 +326,21 @@ int pair_content(
short *b)
{ return(*(int *)0); }
+#undef _nc_do_color_sp
+void _nc_do_color_sp(
+ SCREEN *sp,
+ short old_pair,
+ short pair,
+ NCURSES_BOOL reverse,
+ NCURSES_OUTC_sp outc)
+ { /* void */ }
+
#undef _nc_do_color
void _nc_do_color(
short old_pair,
short pair,
NCURSES_BOOL reverse,
- int (*outc)(
- int p1))
+ NCURSES_OUTC outc)
{ /* void */ }
/* ./base/lib_colorset.c */
@@ -274,16 +368,31 @@ int delwin(
/* ./base/lib_echo.c */
+#undef echo_sp
+int echo_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef echo
int echo(void)
{ return(*(int *)0); }
+#undef noecho_sp
+int noecho_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef noecho
int noecho(void)
{ return(*(int *)0); }
/* ./base/lib_endwin.c */
+#undef endwin_sp
+int endwin_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef endwin
int endwin(void)
{ return(*(int *)0); }
@@ -297,6 +406,11 @@ int werase(
/* ./base/lib_flash.c */
+#undef flash_sp
+int flash_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef flash
int flash(void)
{ return(*(int *)0); }
@@ -1107,11 +1221,21 @@ NCURSES_BOOL is_notimeout(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
+#undef is_pad
+NCURSES_BOOL is_pad(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef is_scrollok
NCURSES_BOOL is_scrollok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
+#undef is_subwin
+NCURSES_BOOL is_subwin(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef is_syncok
NCURSES_BOOL is_syncok(
const WINDOW *z)
@@ -1138,15 +1262,30 @@ NCURSES_BOOL mouse_trafo(
#undef ESCDELAY
int ESCDELAY;
+#undef set_escdelay_sp
+int set_escdelay_sp(
+ SCREEN *sp,
+ int value)
+ { return(*(int *)0); }
+
#undef set_escdelay
int set_escdelay(
int value)
{ return(*(int *)0); }
+#undef get_escdelay_sp
+int get_escdelay_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef get_escdelay
+int get_escdelay(void)
+ { return(*(int *)0); }
+
#undef _nc_wgetch
int _nc_wgetch(
WINDOW *win,
- unsigned long *result,
+ int *result,
int use_meta)
{ return(*(int *)0); }
@@ -1200,6 +1339,7 @@ WINDOW *initscr(void)
#undef _nc_insert_ch
int _nc_insert_ch(
+ SCREEN *sp,
WINDOW *win,
chtype ch)
{ return(*(int *)0); }
@@ -1238,6 +1378,11 @@ int winnstr(
/* ./base/lib_isendwin.c */
+#undef isendwin_sp
+NCURSES_BOOL isendwin_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef isendwin
NCURSES_BOOL isendwin(void)
{ return(*(NCURSES_BOOL *)0); }
@@ -1252,16 +1397,35 @@ int leaveok(
/* ./base/lib_mouse.c */
+#undef getmouse_sp
+int getmouse_sp(
+ SCREEN *sp,
+ MEVENT *aevent)
+ { return(*(int *)0); }
+
#undef getmouse
int getmouse(
MEVENT *aevent)
{ return(*(int *)0); }
+#undef ungetmouse_sp
+int ungetmouse_sp(
+ SCREEN *sp,
+ MEVENT *aevent)
+ { return(*(int *)0); }
+
#undef ungetmouse
int ungetmouse(
MEVENT *aevent)
{ return(*(int *)0); }
+#undef mousemask_sp
+mmask_t mousemask_sp(
+ SCREEN *sp,
+ mmask_t newmask,
+ mmask_t *oldmask)
+ { return(*(mmask_t *)0); }
+
#undef mousemask
mmask_t mousemask(
mmask_t newmask,
@@ -1275,14 +1439,30 @@ NCURSES_BOOL wenclose(
int x)
{ return(*(NCURSES_BOOL *)0); }
+#undef mouseinterval_sp
+int mouseinterval_sp(
+ SCREEN *sp,
+ int maxclick)
+ { return(*(int *)0); }
+
#undef mouseinterval
int mouseinterval(
int maxclick)
{ return(*(int *)0); }
#undef _nc_has_mouse
-int _nc_has_mouse(void)
- { return(*(int *)0); }
+NCURSES_BOOL _nc_has_mouse(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef has_mouse_sp
+NCURSES_BOOL has_mouse_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef has_mouse
+NCURSES_BOOL has_mouse(void)
+ { return(*(NCURSES_BOOL *)0); }
#undef wmouse_trafo
NCURSES_BOOL wmouse_trafo(
@@ -1303,24 +1483,55 @@ int wmove(
/* ./tty/lib_mvcur.c */
+#undef _nc_msec_cost_sp
+int _nc_msec_cost_sp(
+ SCREEN *sp,
+ const char *const cap,
+ int affcnt)
+ { return(*(int *)0); }
+
#undef _nc_msec_cost
int _nc_msec_cost(
const char *const cap,
int affcnt)
{ return(*(int *)0); }
+#undef _nc_mvcur_resume_sp
+void _nc_mvcur_resume_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_mvcur_resume
void _nc_mvcur_resume(void)
{ /* void */ }
+#undef _nc_mvcur_init_sp
+void _nc_mvcur_init_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_mvcur_init
void _nc_mvcur_init(void)
{ /* void */ }
+#undef _nc_mvcur_wrap_sp
+void _nc_mvcur_wrap_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_mvcur_wrap
void _nc_mvcur_wrap(void)
{ /* void */ }
+#undef mvcur_sp
+int mvcur_sp(
+ SCREEN *sp,
+ int yold,
+ int xold,
+ int ynew,
+ int xnew)
+ { return(*(int *)0); }
+
#undef mvcur
int mvcur(
int yold,
@@ -1343,14 +1554,32 @@ int mvwin(
/* ./base/lib_newterm.c */
+#undef filter_sp
+void filter_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef filter
void filter(void)
{ /* void */ }
+#undef nofilter_sp
+void nofilter_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef nofilter
void nofilter(void)
{ /* void */ }
+#undef newterm_sp
+SCREEN *newterm_sp(
+ SCREEN *sp,
+ char *name,
+ FILE *ofp,
+ FILE *ifp)
+ { return(*(SCREEN **)0); }
+
#undef newterm
SCREEN *newterm(
char *name,
@@ -1365,6 +1594,15 @@ int _nc_freewin(
WINDOW *win)
{ return(*(int *)0); }
+#undef newwin_sp
+WINDOW *newwin_sp(
+ SCREEN *sp,
+ int num_lines,
+ int num_columns,
+ int begy,
+ int begx)
+ { return(*(WINDOW **)0); }
+
#undef newwin
WINDOW *newwin(
int num_lines,
@@ -1391,8 +1629,9 @@ WINDOW *subwin(
int x)
{ return(*(WINDOW **)0); }
-#undef _nc_makenew
-WINDOW *_nc_makenew(
+#undef _nc_makenew_sp
+WINDOW *_nc_makenew_sp(
+ SCREEN *sp,
int num_lines,
int num_columns,
int begy,
@@ -1400,17 +1639,37 @@ WINDOW *_nc_makenew(
int flags)
{ return(*(WINDOW **)0); }
-#undef _nc_screen_of
-SCREEN *_nc_screen_of(
- WINDOW *win)
- { return(*(SCREEN **)0); }
+#undef _nc_curscr_of
+WINDOW *_nc_curscr_of(
+ SCREEN *sp)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_newscr_of
+WINDOW *_nc_newscr_of(
+ SCREEN *sp)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_stdscr_of
+WINDOW *_nc_stdscr_of(
+ SCREEN *sp)
+ { return(*(WINDOW **)0); }
/* ./base/lib_nl.c */
+#undef nl_sp
+int nl_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef nl
int nl(void)
{ return(*(int *)0); }
+#undef nonl_sp
+int nonl_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef nonl
int nonl(void)
{ return(*(int *)0); }
@@ -1444,6 +1703,13 @@ int copywin(
/* ./base/lib_pad.c */
+#undef newpad_sp
+WINDOW *newpad_sp(
+ SCREEN *sp,
+ int l,
+ int c)
+ { return(*(WINDOW **)0); }
+
#undef newpad
WINDOW *newpad(
int l,
@@ -1549,6 +1815,14 @@ int wnoutrefresh(
/* ./base/lib_restart.c */
+#undef restartterm_sp
+int restartterm_sp(
+ SCREEN *sp,
+ char *termp,
+ int filenum,
+ int *errret)
+ { return(*(int *)0); }
+
#undef restartterm
int restartterm(
char *termp,
@@ -1597,6 +1871,12 @@ int mvwscanw(
/* ./base/lib_screen.c */
+#undef getwin_sp
+WINDOW *getwin_sp(
+ SCREEN *sp,
+ FILE *filep)
+ { return(*(WINDOW **)0); }
+
#undef getwin
WINDOW *getwin(
FILE *filep)
@@ -1608,6 +1888,12 @@ int putwin(
FILE *filep)
{ return(*(int *)0); }
+#undef scr_restore_sp
+int scr_restore_sp(
+ SCREEN *sp,
+ const char *file)
+ { return(*(int *)0); }
+
#undef scr_restore
int scr_restore(
const char *file)
@@ -1618,11 +1904,23 @@ int scr_dump(
const char *file)
{ return(*(int *)0); }
+#undef scr_init_sp
+int scr_init_sp(
+ SCREEN *sp,
+ const char *file)
+ { return(*(int *)0); }
+
#undef scr_init
int scr_init(
const char *file)
{ return(*(int *)0); }
+#undef scr_set_sp
+int scr_set_sp(
+ SCREEN *sp,
+ const char *file)
+ { return(*(int *)0); }
+
#undef scr_set
int scr_set(
const char *file)
@@ -1674,6 +1972,16 @@ void delscreen(
SCREEN *sp)
{ /* void */ }
+#undef _nc_setupscreen_sp
+int _nc_setupscreen_sp(
+ SCREEN **spp,
+ int slines,
+ int scolumns,
+ FILE *output,
+ NCURSES_BOOL filtered,
+ int slk_format)
+ { return(*(int *)0); }
+
#undef _nc_setupscreen
int _nc_setupscreen(
int slines,
@@ -1683,6 +1991,15 @@ int _nc_setupscreen(
int slk_format)
{ return(*(int *)0); }
+#undef _nc_ripoffline_sp
+int _nc_ripoffline_sp(
+ SCREEN *sp,
+ int line,
+ int (*init)(
+ WINDOW *p1,
+ int p2))
+ { return(*(int *)0); }
+
#undef _nc_ripoffline
int _nc_ripoffline(
int line,
@@ -1691,6 +2008,15 @@ int _nc_ripoffline(
int p2))
{ return(*(int *)0); }
+#undef ripoffline_sp
+int ripoffline_sp(
+ SCREEN *sp,
+ int line,
+ int (*init)(
+ WINDOW *p1,
+ int p2))
+ { return(*(int *)0); }
+
#undef ripoffline
int ripoffline(
int line,
@@ -1701,18 +2027,37 @@ int ripoffline(
/* ./base/lib_slk.c */
+#undef _nc_format_slks
+int _nc_format_slks(
+ SCREEN *sp,
+ int cols)
+ { return(*(int *)0); }
+
#undef _nc_slk_initialize
int _nc_slk_initialize(
WINDOW *stwin,
int cols)
{ return(*(int *)0); }
+#undef slk_restore_sp
+int slk_restore_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_restore
int slk_restore(void)
{ return(*(int *)0); }
/* ./base/lib_slkatr_set.c */
+#undef slk_attr_set_sp
+int slk_attr_set_sp(
+ SCREEN *sp,
+ const attr_t attr,
+ short color_pair_number,
+ void *opts)
+ { return(*(int *)0); }
+
#undef slk_attr_set
int slk_attr_set(
const attr_t attr,
@@ -1722,6 +2067,12 @@ int slk_attr_set(
/* ./base/lib_slkatrof.c */
+#undef slk_attroff_sp
+int slk_attroff_sp(
+ SCREEN *sp,
+ const chtype attr)
+ { return(*(int *)0); }
+
#undef slk_attroff
int slk_attroff(
const chtype attr)
@@ -1729,6 +2080,12 @@ int slk_attroff(
/* ./base/lib_slkatron.c */
+#undef slk_attron_sp
+int slk_attron_sp(
+ SCREEN *sp,
+ const chtype attr)
+ { return(*(int *)0); }
+
#undef slk_attron
int slk_attron(
const chtype attr)
@@ -1736,6 +2093,12 @@ int slk_attron(
/* ./base/lib_slkatrset.c */
+#undef slk_attrset_sp
+int slk_attrset_sp(
+ SCREEN *sp,
+ const chtype attr)
+ { return(*(int *)0); }
+
#undef slk_attrset
int slk_attrset(
const chtype attr)
@@ -1743,18 +2106,34 @@ int slk_attrset(
/* ./base/lib_slkattr.c */
+#undef slk_attr_sp
+attr_t slk_attr_sp(
+ SCREEN *sp)
+ { return(*(attr_t *)0); }
+
#undef slk_attr
attr_t slk_attr(void)
{ return(*(attr_t *)0); }
/* ./base/lib_slkclear.c */
+#undef slk_clear_sp
+int slk_clear_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_clear
int slk_clear(void)
{ return(*(int *)0); }
/* ./base/lib_slkcolor.c */
+#undef slk_color_sp
+int slk_color_sp(
+ SCREEN *sp,
+ short color_pair_number)
+ { return(*(int *)0); }
+
#undef slk_color
int slk_color(
short color_pair_number)
@@ -1762,6 +2141,12 @@ int slk_color(
/* ./base/lib_slkinit.c */
+#undef slk_init_sp
+int slk_init_sp(
+ SCREEN *sp,
+ int format)
+ { return(*(int *)0); }
+
#undef slk_init
int slk_init(
int format)
@@ -1769,6 +2154,12 @@ int slk_init(
/* ./base/lib_slklab.c */
+#undef slk_label_sp
+char *slk_label_sp(
+ SCREEN *sp,
+ int n)
+ { return(*(char **)0); }
+
#undef slk_label
char *slk_label(
int n)
@@ -1776,16 +2167,34 @@ char *slk_label(
/* ./base/lib_slkrefr.c */
+#undef slk_noutrefresh_sp
+int slk_noutrefresh_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_noutrefresh
int slk_noutrefresh(void)
{ return(*(int *)0); }
+#undef slk_refresh_sp
+int slk_refresh_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_refresh
int slk_refresh(void)
{ return(*(int *)0); }
/* ./base/lib_slkset.c */
+#undef slk_set_sp
+int slk_set_sp(
+ SCREEN *sp,
+ int i,
+ const char *astr,
+ int format)
+ { return(*(int *)0); }
+
#undef slk_set
int slk_set(
int i,
@@ -1795,6 +2204,11 @@ int slk_set(
/* ./base/lib_slktouch.c */
+#undef slk_touch_sp
+int slk_touch_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_touch
int slk_touch(void)
{ return(*(int *)0); }
@@ -1836,6 +2250,12 @@ char *_nc_tracemouse(
MEVENT const *ep)
{ return(*(char **)0); }
+#undef _nc_retrace_mmask_t
+mmask_t _nc_retrace_mmask_t(
+ SCREEN *sp,
+ mmask_t code)
+ { return(*(mmask_t *)0); }
+
#undef _tracemouse
char *_tracemouse(
MEVENT const *ep)
@@ -1857,8 +2277,8 @@ void _nc_fifo_dump(
SCREEN *sp)
{ /* void */ }
-#undef _nc_ungetch
-int _nc_ungetch(
+#undef ungetch_sp
+int ungetch_sp(
SCREEN *sp,
int ch)
{ return(*(int *)0); }
@@ -1870,11 +2290,23 @@ int ungetch(
/* ./tty/lib_vidattr.c */
+#undef vidputs_sp
+int vidputs_sp(
+ SCREEN *sp,
+ chtype newmode,
+ NCURSES_OUTC_sp outc)
+ { return(*(int *)0); }
+
#undef vidputs
int vidputs(
chtype newmode,
- int (*outc)(
- int p1))
+ NCURSES_OUTC outc)
+ { return(*(int *)0); }
+
+#undef vidattr_sp
+int vidattr_sp(
+ SCREEN *sp,
+ chtype newmode)
{ return(*(int *)0); }
#undef vidattr
@@ -1882,6 +2314,11 @@ int vidattr(
chtype newmode)
{ return(*(int *)0); }
+#undef termattrs_sp
+chtype termattrs_sp(
+ SCREEN *sp)
+ { return(*(chtype *)0); }
+
#undef termattrs
chtype termattrs(void)
{ return(*(chtype *)0); }
@@ -1962,12 +2399,24 @@ WINDOW *dupwin(
/* ./base/nc_panel.c */
+#undef _nc_panelhook_sp
+struct panelhook *_nc_panelhook_sp(
+ SCREEN *sp)
+ { return(*(struct panelhook **)0); }
+
#undef _nc_panelhook
struct panelhook *_nc_panelhook(void)
{ return(*(struct panelhook **)0); }
/* ./base/safe_sprintf.c */
+#undef _nc_printf_string_sp
+char *_nc_printf_string_sp(
+ SCREEN *sp,
+ const char *fmt,
+ va_list ap)
+ { return(*(char **)0); }
+
#undef _nc_printf_string
char *_nc_printf_string(
const char *fmt,
@@ -1979,10 +2428,24 @@ char *_nc_printf_string(
#include <sys/time.h>
#include <sys/times.h>
+#undef doupdate_sp
+int doupdate_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef doupdate
int doupdate(void)
{ return(*(int *)0); }
+#undef _nc_scrolln_sp
+int _nc_scrolln_sp(
+ SCREEN *sp,
+ int n,
+ int top,
+ int bot,
+ int maxy)
+ { return(*(int *)0); }
+
#undef _nc_scrolln
int _nc_scrolln(
int n,
@@ -1991,18 +2454,39 @@ int _nc_scrolln(
int maxy)
{ return(*(int *)0); }
+#undef _nc_screen_resume_sp
+void _nc_screen_resume_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_screen_resume
void _nc_screen_resume(void)
{ /* void */ }
+#undef _nc_screen_init_sp
+void _nc_screen_init_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_screen_init
void _nc_screen_init(void)
{ /* void */ }
+#undef _nc_screen_wrap_sp
+void _nc_screen_wrap_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_screen_wrap
void _nc_screen_wrap(void)
{ /* void */ }
+#undef _nc_do_xmc_glitch_sp
+void _nc_do_xmc_glitch_sp(
+ SCREEN *sp,
+ attr_t previous)
+ { /* void */ }
+
#undef _nc_do_xmc_glitch
void _nc_do_xmc_glitch(
attr_t previous)
@@ -2034,12 +2518,16 @@ void _nc_vsscanf(void)
/* ./base/lib_freeall.c */
-#include <term_entry.h>
-
#undef _nc_freeall
void _nc_freeall(void)
{ /* void */ }
+#undef _nc_free_and_exit_sp
+void _nc_free_and_exit_sp(
+ SCREEN *sp,
+ int code)
+ { /* void */ }
+
#undef _nc_free_and_exit
void _nc_free_and_exit(
int code)
@@ -2059,6 +2547,24 @@ void _nc_toggle_attr_off(
attr_t at)
{ /* void */ }
+#undef _nc_DelCharCost_sp
+int _nc_DelCharCost_sp(
+ SCREEN *sp,
+ int count)
+ { return(*(int *)0); }
+
+#undef _nc_InsCharCost_sp
+int _nc_InsCharCost_sp(
+ SCREEN *sp,
+ int count)
+ { return(*(int *)0); }
+
+#undef _nc_UpdateAttrs_sp
+void _nc_UpdateAttrs_sp(
+ SCREEN *sp,
+ chtype c)
+ { /* void */ }
+
#undef _nc_DelCharCost
int _nc_DelCharCost(
int count)
@@ -2076,6 +2582,12 @@ void _nc_UpdateAttrs(
/* ./base/legacy_coding.c */
+#undef use_legacy_coding_sp
+int use_legacy_coding_sp(
+ SCREEN *sp,
+ int level)
+ { return(*(int *)0); }
+
#undef use_legacy_coding
int use_legacy_coding(
int level)
@@ -2083,10 +2595,22 @@ int use_legacy_coding(
/* ./base/lib_dft_fgbg.c */
+#undef use_default_colors_sp
+int use_default_colors_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef use_default_colors
int use_default_colors(void)
{ return(*(int *)0); }
+#undef assume_default_colors_sp
+int assume_default_colors_sp(
+ SCREEN *sp,
+ int fg,
+ int bg)
+ { return(*(int *)0); }
+
#undef assume_default_colors
int assume_default_colors(
int fg,
@@ -2095,6 +2619,13 @@ int assume_default_colors(
/* ./tinfo/lib_print.c */
+#undef mcprint_sp
+int mcprint_sp(
+ SCREEN *sp,
+ char *data,
+ int len)
+ { return(*(int *)0); }
+
#undef mcprint
int mcprint(
char *data,
@@ -2103,18 +2634,39 @@ int mcprint(
/* ./base/resizeterm.c */
+#undef is_term_resized_sp
+NCURSES_BOOL is_term_resized_sp(
+ SCREEN *sp,
+ int ToLines,
+ int ToCols)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef is_term_resized
NCURSES_BOOL is_term_resized(
int ToLines,
int ToCols)
{ return(*(NCURSES_BOOL *)0); }
+#undef resize_term_sp
+int resize_term_sp(
+ SCREEN *sp,
+ int ToLines,
+ int ToCols)
+ { return(*(int *)0); }
+
#undef resize_term
int resize_term(
int ToLines,
int ToCols)
{ return(*(int *)0); }
+#undef resizeterm_sp
+int resizeterm_sp(
+ SCREEN *sp,
+ int ToLines,
+ int ToCols)
+ { return(*(int *)0); }
+
#undef resizeterm
int resizeterm(
int ToLines,
@@ -2157,9 +2709,6 @@ int wresize(
/* ./tinfo/access.c */
-#include <sys/stat.h>
-#include <nc_alloc.h>
-
#undef _nc_rootname
char *_nc_rootname(
char *path)
@@ -2232,7 +2781,32 @@ char *const numcodes[] = {0};
#undef strcodes
char *const strcodes[] = {0};
+/* ./comp_captab.c */
+
+#include <hashsize.h>
+
+#undef _nc_get_table
+const struct name_table_entry *_nc_get_table(
+ NCURSES_BOOL termcap)
+ { return(*(const struct name_table_entry **)0); }
+
+#undef _nc_get_hash_table
+const HashValue *_nc_get_hash_table(
+ NCURSES_BOOL termcap)
+ { return(*(const HashValue **)0); }
+
+#undef _nc_get_alias_table
+const struct alias *_nc_get_alias_table(
+ NCURSES_BOOL termcap)
+ { return(*(const struct alias **)0); }
+
+#undef _nc_get_hash_info
+const HashData *_nc_get_hash_info(
+ NCURSES_BOOL termcap)
+ { return(*(const HashData **)0); }
+
/* ./tinfo/comp_error.c */
+
#undef _nc_suppress_warnings
NCURSES_BOOL _nc_suppress_warnings;
#undef _nc_curr_line
@@ -2277,6 +2851,21 @@ void _nc_syserr_abort(
...)
{ /* void */ }
+/* ./tinfo/comp_hash.c */
+
+#undef _nc_find_entry
+struct name_table_entry const *_nc_find_entry(
+ const char *string,
+ const HashValue *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,
+ NCURSES_BOOL termcap)
+ { return(*(struct name_table_entry const **)0); }
+
/* ./tinfo/db_iterator.c */
#undef _nc_tic_dir
@@ -2397,6 +2986,11 @@ void _nc_init_keytry(
#undef acs_map
chtype acs_map[128];
+#undef _nc_init_acs_sp
+void _nc_init_acs_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_init_acs
void _nc_init_acs(void)
{ /* void */ }
@@ -2420,6 +3014,11 @@ int _nc_ospeed(
int BaudRate)
{ return(*(int *)0); }
+#undef baudrate_sp
+int baudrate_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef baudrate
int baudrate(void)
{ return(*(int *)0); }
@@ -2429,11 +3028,23 @@ int baudrate(void)
#undef cur_term
TERMINAL *cur_term;
+#undef set_curterm_sp
+TERMINAL *set_curterm_sp(
+ SCREEN *sp,
+ TERMINAL *termp)
+ { return(*(TERMINAL **)0); }
+
#undef set_curterm
TERMINAL *set_curterm(
TERMINAL *termp)
{ return(*(TERMINAL **)0); }
+#undef del_curterm_sp
+int del_curterm_sp(
+ SCREEN *sp,
+ TERMINAL *termp)
+ { return(*(int *)0); }
+
#undef del_curterm
int del_curterm(
TERMINAL *termp)
@@ -2456,26 +3067,56 @@ NCURSES_GLOBALS _nc_globals;
#undef _nc_prescreen
NCURSES_PRESCREEN _nc_prescreen;
+#undef _nc_screen_of
+SCREEN *_nc_screen_of(
+ WINDOW *win)
+ { return(*(SCREEN **)0); }
+
/* ./tinfo/lib_has_cap.c */
+#undef has_ic_sp
+NCURSES_BOOL has_ic_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef has_ic
NCURSES_BOOL has_ic(void)
{ return(*(NCURSES_BOOL *)0); }
+#undef has_il_sp
+NCURSES_BOOL has_il_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef has_il
NCURSES_BOOL has_il(void)
{ return(*(NCURSES_BOOL *)0); }
/* ./tinfo/lib_kernel.c */
+#undef erasechar_sp
+char erasechar_sp(
+ SCREEN *sp)
+ { return(*(char *)0); }
+
#undef erasechar
char erasechar(void)
{ return(*(char *)0); }
+#undef killchar_sp
+char killchar_sp(
+ SCREEN *sp)
+ { return(*(char *)0); }
+
#undef killchar
char killchar(void)
{ return(*(char *)0); }
+#undef flushinp_sp
+int flushinp_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef flushinp
int flushinp(void)
{ return(*(int *)0); }
@@ -2484,8 +3125,8 @@ int flushinp(void)
struct kn { short offset; int code; };
-#undef _nc_keyname
-char *_nc_keyname(
+#undef keyname_sp
+char *keyname_sp(
SCREEN *sp,
int c)
{ return(*(char **)0); }
@@ -2505,6 +3146,12 @@ char *longname(void)
#include <time.h>
+#undef napms_sp
+int napms_sp(
+ SCREEN *sp,
+ int ms)
+ { return(*(int *)0); }
+
#undef napms
int napms(
int ms)
@@ -2524,6 +3171,12 @@ void idcok(
NCURSES_BOOL flag)
{ /* void */ }
+#undef halfdelay_sp
+int halfdelay_sp(
+ SCREEN *sp,
+ int t)
+ { return(*(int *)0); }
+
#undef halfdelay
int halfdelay(
int t)
@@ -2559,21 +3212,46 @@ int meta(
NCURSES_BOOL flag)
{ return(*(int *)0); }
+#undef curs_set_sp
+int curs_set_sp(
+ SCREEN *sp,
+ int vis)
+ { return(*(int *)0); }
+
#undef curs_set
int curs_set(
int vis)
{ return(*(int *)0); }
+#undef typeahead_sp
+int typeahead_sp(
+ SCREEN *sp,
+ int fd)
+ { return(*(int *)0); }
+
#undef typeahead
int typeahead(
int fd)
{ return(*(int *)0); }
+#undef has_key_sp
+int has_key_sp(
+ SCREEN *sp,
+ int keycode)
+ { return(*(int *)0); }
+
#undef has_key
int has_key(
int keycode)
{ return(*(int *)0); }
+#undef _nc_putp_flush_sp
+int _nc_putp_flush_sp(
+ SCREEN *sp,
+ const char *name,
+ const char *value)
+ { return(*(int *)0); }
+
#undef _nc_keypad
int _nc_keypad(
SCREEN *sp,
@@ -2582,30 +3260,67 @@ int _nc_keypad(
/* ./tinfo/lib_raw.c */
+#undef raw_sp
+int raw_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef raw
int raw(void)
{ return(*(int *)0); }
+#undef cbreak_sp
+int cbreak_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef cbreak
int cbreak(void)
{ return(*(int *)0); }
+#undef qiflush_sp
+void qiflush_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef qiflush
void qiflush(void)
{ /* void */ }
+#undef noraw_sp
+int noraw_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef noraw
int noraw(void)
{ return(*(int *)0); }
+#undef nocbreak_sp
+int nocbreak_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef nocbreak
int nocbreak(void)
{ return(*(int *)0); }
+#undef noqiflush_sp
+void noqiflush_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef noqiflush
void noqiflush(void)
{ /* void */ }
+#undef intrflush_sp
+int intrflush_sp(
+ SCREEN *sp,
+ WINDOW *win,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
#undef intrflush
int intrflush(
WINDOW *win,
@@ -2627,6 +3342,12 @@ int COLS;
#undef TABSIZE
int TABSIZE;
+#undef set_tabsize_sp
+int set_tabsize_sp(
+ SCREEN *sp,
+ int value)
+ { return(*(int *)0); }
+
#undef set_tabsize
int set_tabsize(
int value)
@@ -2637,6 +3358,12 @@ int _nc_handle_sigwinch(
SCREEN *sp)
{ return(*(int *)0); }
+#undef use_env_sp
+void use_env_sp(
+ SCREEN *sp,
+ NCURSES_BOOL f)
+ { /* void */ }
+
#undef use_env
void use_env(
NCURSES_BOOL f)
@@ -2654,6 +3381,18 @@ void _nc_update_screensize(
SCREEN *sp)
{ /* void */ }
+#undef _nc_setup_tinfo
+int _nc_setup_tinfo(
+ const char *const tn,
+ TERMTYPE *const tp)
+ { return(*(int *)0); }
+
+#undef _nc_tinfo_cmdch
+void _nc_tinfo_cmdch(
+ TERMINAL *termp,
+ char proto)
+ { /* void */ }
+
#undef _nc_get_locale
char *_nc_get_locale(void)
{ return(*(char **)0); }
@@ -2675,6 +3414,10 @@ int _nc_setupterm(
NCURSES_BOOL reuse)
{ return(*(int *)0); }
+#undef new_prescr
+SCREEN *new_prescr(void)
+ { return(*(SCREEN **)0); }
+
#undef setupterm
int setupterm(
char *tname,
@@ -2689,8 +3432,9 @@ char *UP;
#undef BC
char *BC;
-#undef tgetent
-int tgetent(
+#undef tgetent_sp
+int tgetent_sp(
+ SCREEN *sp,
char *bufp,
const char *name)
{ return(*(int *)0); }
@@ -2701,16 +3445,41 @@ int tgetent(
#endif
+#undef tgetent
+int tgetent(
+ char *bufp,
+ const char *name)
+ { return(*(int *)0); }
+
+#undef tgetflag_sp
+int tgetflag_sp(
+ SCREEN *sp,
+ char *id)
+ { return(*(int *)0); }
+
#undef tgetflag
int tgetflag(
char *id)
{ return(*(int *)0); }
+#undef tgetnum_sp
+int tgetnum_sp(
+ SCREEN *sp,
+ char *id)
+ { return(*(int *)0); }
+
#undef tgetnum
int tgetnum(
char *id)
{ return(*(int *)0); }
+#undef tgetstr_sp
+char *tgetstr_sp(
+ SCREEN *sp,
+ char *id,
+ char **area)
+ { return(*(char **)0); }
+
#undef tgetstr
char *tgetstr(
char *id,
@@ -2719,6 +3488,11 @@ char *tgetstr(
/* ./tinfo/lib_termname.c */
+#undef termname_sp
+char *termname_sp(
+ SCREEN *sp)
+ { return(*(char **)0); }
+
#undef termname
char *termname(void)
{ return(*(char **)0); }
@@ -2734,16 +3508,34 @@ char *tgoto(
/* ./tinfo/lib_ti.c */
+#undef tigetflag_sp
+int tigetflag_sp(
+ SCREEN *sp,
+ char *str)
+ { return(*(int *)0); }
+
#undef tigetflag
int tigetflag(
char *str)
{ return(*(int *)0); }
+#undef tigetnum_sp
+int tigetnum_sp(
+ SCREEN *sp,
+ char *str)
+ { return(*(int *)0); }
+
#undef tigetnum
int tigetnum(
char *str)
{ return(*(int *)0); }
+#undef tigetstr_sp
+char *tigetstr_sp(
+ SCREEN *sp,
+ char *str)
+ { return(*(char **)0); }
+
#undef tigetstr
char *tigetstr(
char *str)
@@ -2767,6 +3559,12 @@ char *tparm(
...)
{ return(*(char **)0); }
+#undef tiparm
+char *tiparm(
+ const char *string,
+ ...)
+ { return(*(char **)0); }
+
/* ./tinfo/lib_tputs.c */
#undef PC
@@ -2781,25 +3579,75 @@ void _nc_set_no_padding(
SCREEN *sp)
{ /* void */ }
+#undef delay_output_sp
+int delay_output_sp(
+ SCREEN *sp,
+ int ms)
+ { return(*(int *)0); }
+
#undef delay_output
int delay_output(
int ms)
{ return(*(int *)0); }
+#undef _nc_flush_sp
+void _nc_flush_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_flush
void _nc_flush(void)
{ /* void */ }
+#undef _nc_outch_sp
+int _nc_outch_sp(
+ SCREEN *sp,
+ int ch)
+ { return(*(int *)0); }
+
#undef _nc_outch
int _nc_outch(
int ch)
{ return(*(int *)0); }
+#undef putp_sp
+int putp_sp(
+ SCREEN *sp,
+ const char *string)
+ { return(*(int *)0); }
+
+#undef _nc_putp_sp
+int _nc_putp_sp(
+ SCREEN *sp,
+ const char *name,
+ const char *string)
+ { return(*(int *)0); }
+
#undef putp
int putp(
const char *string)
{ return(*(int *)0); }
+#undef _nc_putp
+int _nc_putp(
+ const char *name,
+ const char *string)
+ { return(*(int *)0); }
+
+#undef tputs_sp
+int tputs_sp(
+ SCREEN *sp,
+ const char *string,
+ int affcnt,
+ NCURSES_OUTC_sp outc)
+ { return(*(int *)0); }
+
+#undef _nc_outc_wrapper
+int _nc_outc_wrapper(
+ SCREEN *sp,
+ int c)
+ { return(*(int *)0); }
+
#undef tputs
int tputs(
const char *string,
@@ -2833,6 +3681,11 @@ NCURSES_BOOL _nc_retrace_bool(
NCURSES_BOOL code)
{ return(*(NCURSES_BOOL *)0); }
+#undef _nc_retrace_char
+char _nc_retrace_char(
+ char code)
+ { return(*(char *)0); }
+
#undef _nc_retrace_int
int _nc_retrace_int(
int code)
@@ -2886,6 +3739,11 @@ char *_traceattr(
attr_t newmode)
{ return(*(char **)0); }
+#undef _nc_retrace_int_attr_t
+int _nc_retrace_int_attr_t(
+ attr_t code)
+ { return(*(int *)0); }
+
#undef _nc_retrace_attr_t
attr_t _nc_retrace_attr_t(
attr_t code)
@@ -2944,36 +3802,78 @@ char *_tracechar(
/* ./tinfo/lib_ttyflags.c */
+#undef _nc_get_tty_mode_sp
+int _nc_get_tty_mode_sp(
+ SCREEN *sp,
+ struct termios *buf)
+ { return(*(int *)0); }
+
#undef _nc_get_tty_mode
int _nc_get_tty_mode(
struct termios *buf)
{ return(*(int *)0); }
+#undef _nc_set_tty_mode_sp
+int _nc_set_tty_mode_sp(
+ SCREEN *sp,
+ struct termios *buf)
+ { return(*(int *)0); }
+
#undef _nc_set_tty_mode
int _nc_set_tty_mode(
struct termios *buf)
{ return(*(int *)0); }
+#undef def_shell_mode_sp
+int def_shell_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef def_shell_mode
int def_shell_mode(void)
{ return(*(int *)0); }
+#undef def_prog_mode_sp
+int def_prog_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef def_prog_mode
int def_prog_mode(void)
{ return(*(int *)0); }
+#undef reset_prog_mode_sp
+int reset_prog_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef reset_prog_mode
int reset_prog_mode(void)
{ return(*(int *)0); }
+#undef reset_shell_mode_sp
+int reset_shell_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef reset_shell_mode
int reset_shell_mode(void)
{ return(*(int *)0); }
+#undef savetty_sp
+int savetty_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef savetty
int savetty(void)
{ return(*(int *)0); }
+#undef resetty_sp
+int resetty_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef resetty
int resetty(void)
{ return(*(int *)0); }
@@ -3053,6 +3953,13 @@ int _nc_read_termcap_entry(
/* ./tinfo/setbuf.c */
+#undef _nc_set_buffer_sp
+void _nc_set_buffer_sp(
+ SCREEN *sp,
+ FILE *ofp,
+ NCURSES_BOOL buffered)
+ { /* void */ }
+
#undef _nc_set_buffer
void _nc_set_buffer(
FILE *ofp,
@@ -3144,8 +4051,8 @@ char *_nc_trim_sgr0(
/* ./unctrl.c */
-#undef _nc_unctrl
-char *_nc_unctrl(
+#undef unctrl_sp
+char *unctrl_sp(
SCREEN *sp,
chtype ch)
{ return(*(char **)0); }
@@ -3232,25 +4139,6 @@ char *_nc_infotocap(
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
@@ -3260,21 +4148,6 @@ char *_nc_tic_expand(
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
@@ -3394,6 +4267,13 @@ int _nc_tic_written(void)
/* ./base/define_key.c */
+#undef define_key_sp
+int define_key_sp(
+ SCREEN *sp,
+ const char *str,
+ int keycode)
+ { return(*(int *)0); }
+
#undef define_key
int define_key(
const char *str,
@@ -3408,6 +4288,12 @@ void _nc_hashed_db(void)
/* ./base/key_defined.c */
+#undef key_defined_sp
+int key_defined_sp(
+ SCREEN *sp,
+ const char *str)
+ { return(*(int *)0); }
+
#undef key_defined
int key_defined(
const char *str)
@@ -3415,6 +4301,13 @@ int key_defined(
/* ./base/keybound.c */
+#undef keybound_sp
+char *keybound_sp(
+ SCREEN *sp,
+ int code,
+ int count)
+ { return(*(char **)0); }
+
#undef keybound
char *keybound(
int code,
@@ -3423,6 +4316,13 @@ char *keybound(
/* ./base/keyok.c */
+#undef keyok_sp
+int keyok_sp(
+ SCREEN *sp,
+ int c,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
#undef keyok
int keyok(
int c,
diff --git a/contrib/ncurses/ncurses/llib-lncursest b/contrib/ncurses/ncurses/llib-lncursest
index d29ef60d561b..f5739cb1e79d 100644
--- a/contrib/ncurses/ncurses/llib-lncursest
+++ b/contrib/ncurses/ncurses/llib-lncursest
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2008 Free Software Foundation, Inc. *
+ * Copyright (c) 2008-2010,2011 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 2008 *
+ * Author: Thomas E. Dickey 2008-on *
****************************************************************************/
/* LINTLIBRARY */
@@ -38,27 +38,54 @@
#undef _nc_oldnums
int *_nc_oldnums;
+#undef _nc_scroll_optimize_sp
+void _nc_scroll_optimize_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_scroll_optimize
void _nc_scroll_optimize(void)
{ /* void */ }
+#undef _nc_linedump_sp
+void _nc_linedump_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_linedump
void _nc_linedump(void)
{ /* void */ }
/* ./tty/hashmap.c */
-#include <term.h>
+#undef _nc_hash_map_sp
+void _nc_hash_map_sp(
+ SCREEN *sp)
+ { /* void */ }
#undef _nc_hash_map
void _nc_hash_map(void)
{ /* void */ }
+#undef _nc_make_oldhash_sp
+void _nc_make_oldhash_sp(
+ SCREEN *sp,
+ int i)
+ { /* void */ }
+
#undef _nc_make_oldhash
void _nc_make_oldhash(
int i)
{ /* void */ }
+#undef _nc_scroll_oldhash_sp
+void _nc_scroll_oldhash_sp(
+ SCREEN *sp,
+ int n,
+ int top,
+ int bot)
+ { /* void */ }
+
#undef _nc_scroll_oldhash
void _nc_scroll_oldhash(
int n,
@@ -112,6 +139,11 @@ int waddchnstr(
/* ./base/lib_beep.c */
+#undef beep_sp
+int beep_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef beep
int beep(void)
{ return(*(int *)0); }
@@ -197,14 +229,32 @@ int _nc_COLOR_PAIRS(void)
int _nc_COLORS(void)
{ return(*(int *)0); }
+#undef _nc_reset_colors_sp
+NCURSES_BOOL _nc_reset_colors_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef _nc_reset_colors
NCURSES_BOOL _nc_reset_colors(void)
{ return(*(NCURSES_BOOL *)0); }
+#undef start_color_sp
+int start_color_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef start_color
int start_color(void)
{ return(*(int *)0); }
+#undef init_pair_sp
+int init_pair_sp(
+ SCREEN *sp,
+ short pair,
+ short f,
+ short b)
+ { return(*(int *)0); }
+
#undef init_pair
int init_pair(
short pair,
@@ -212,6 +262,15 @@ int init_pair(
short b)
{ return(*(int *)0); }
+#undef init_color_sp
+int init_color_sp(
+ SCREEN *sp,
+ short color,
+ short r,
+ short g,
+ short b)
+ { return(*(int *)0); }
+
#undef init_color
int init_color(
short color,
@@ -220,14 +279,33 @@ int init_color(
short b)
{ return(*(int *)0); }
+#undef can_change_color_sp
+NCURSES_BOOL can_change_color_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef can_change_color
NCURSES_BOOL can_change_color(void)
{ return(*(NCURSES_BOOL *)0); }
+#undef has_colors_sp
+NCURSES_BOOL has_colors_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef has_colors
NCURSES_BOOL has_colors(void)
{ return(*(NCURSES_BOOL *)0); }
+#undef color_content_sp
+int color_content_sp(
+ SCREEN *sp,
+ short color,
+ short *r,
+ short *g,
+ short *b)
+ { return(*(int *)0); }
+
#undef color_content
int color_content(
short color,
@@ -236,6 +314,14 @@ int color_content(
short *b)
{ return(*(int *)0); }
+#undef pair_content_sp
+int pair_content_sp(
+ SCREEN *sp,
+ short pair,
+ short *f,
+ short *b)
+ { return(*(int *)0); }
+
#undef pair_content
int pair_content(
short pair,
@@ -243,13 +329,21 @@ int pair_content(
short *b)
{ return(*(int *)0); }
+#undef _nc_do_color_sp
+void _nc_do_color_sp(
+ SCREEN *sp,
+ short old_pair,
+ short pair,
+ NCURSES_BOOL reverse,
+ NCURSES_OUTC_sp outc)
+ { /* void */ }
+
#undef _nc_do_color
void _nc_do_color(
short old_pair,
short pair,
NCURSES_BOOL reverse,
- int (*outc)(
- int p1))
+ NCURSES_OUTC outc)
{ /* void */ }
/* ./base/lib_colorset.c */
@@ -277,16 +371,31 @@ int delwin(
/* ./base/lib_echo.c */
+#undef echo_sp
+int echo_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef echo
int echo(void)
{ return(*(int *)0); }
+#undef noecho_sp
+int noecho_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef noecho
int noecho(void)
{ return(*(int *)0); }
/* ./base/lib_endwin.c */
+#undef endwin_sp
+int endwin_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef endwin
int endwin(void)
{ return(*(int *)0); }
@@ -300,6 +409,11 @@ int werase(
/* ./base/lib_flash.c */
+#undef flash_sp
+int flash_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef flash
int flash(void)
{ return(*(int *)0); }
@@ -1110,11 +1224,21 @@ NCURSES_BOOL is_notimeout(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
+#undef is_pad
+NCURSES_BOOL is_pad(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef is_scrollok
NCURSES_BOOL is_scrollok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
+#undef is_subwin
+NCURSES_BOOL is_subwin(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef is_syncok
NCURSES_BOOL is_syncok(
const WINDOW *z)
@@ -1142,15 +1266,35 @@ NCURSES_BOOL mouse_trafo(
int _nc_ESCDELAY(void)
{ return(*(int *)0); }
+#undef _nc_ptr_Escdelay
+int *_nc_ptr_Escdelay(
+ SCREEN *sp)
+ { return(*(int **)0); }
+
+#undef set_escdelay_sp
+int set_escdelay_sp(
+ SCREEN *sp,
+ int value)
+ { return(*(int *)0); }
+
#undef set_escdelay
int set_escdelay(
int value)
{ return(*(int *)0); }
+#undef get_escdelay_sp
+int get_escdelay_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef get_escdelay
+int get_escdelay(void)
+ { return(*(int *)0); }
+
#undef _nc_wgetch
int _nc_wgetch(
WINDOW *win,
- unsigned long *result,
+ int *result,
int use_meta)
{ return(*(int *)0); }
@@ -1204,6 +1348,7 @@ WINDOW *initscr(void)
#undef _nc_insert_ch
int _nc_insert_ch(
+ SCREEN *sp,
WINDOW *win,
chtype ch)
{ return(*(int *)0); }
@@ -1242,6 +1387,11 @@ int winnstr(
/* ./base/lib_isendwin.c */
+#undef isendwin_sp
+NCURSES_BOOL isendwin_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef isendwin
NCURSES_BOOL isendwin(void)
{ return(*(NCURSES_BOOL *)0); }
@@ -1256,16 +1406,35 @@ int leaveok(
/* ./base/lib_mouse.c */
+#undef getmouse_sp
+int getmouse_sp(
+ SCREEN *sp,
+ MEVENT *aevent)
+ { return(*(int *)0); }
+
#undef getmouse
int getmouse(
MEVENT *aevent)
{ return(*(int *)0); }
+#undef ungetmouse_sp
+int ungetmouse_sp(
+ SCREEN *sp,
+ MEVENT *aevent)
+ { return(*(int *)0); }
+
#undef ungetmouse
int ungetmouse(
MEVENT *aevent)
{ return(*(int *)0); }
+#undef mousemask_sp
+mmask_t mousemask_sp(
+ SCREEN *sp,
+ mmask_t newmask,
+ mmask_t *oldmask)
+ { return(*(mmask_t *)0); }
+
#undef mousemask
mmask_t mousemask(
mmask_t newmask,
@@ -1279,14 +1448,30 @@ NCURSES_BOOL wenclose(
int x)
{ return(*(NCURSES_BOOL *)0); }
+#undef mouseinterval_sp
+int mouseinterval_sp(
+ SCREEN *sp,
+ int maxclick)
+ { return(*(int *)0); }
+
#undef mouseinterval
int mouseinterval(
int maxclick)
{ return(*(int *)0); }
#undef _nc_has_mouse
-int _nc_has_mouse(void)
- { return(*(int *)0); }
+NCURSES_BOOL _nc_has_mouse(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef has_mouse_sp
+NCURSES_BOOL has_mouse_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef has_mouse
+NCURSES_BOOL has_mouse(void)
+ { return(*(NCURSES_BOOL *)0); }
#undef wmouse_trafo
NCURSES_BOOL wmouse_trafo(
@@ -1307,24 +1492,55 @@ int wmove(
/* ./tty/lib_mvcur.c */
+#undef _nc_msec_cost_sp
+int _nc_msec_cost_sp(
+ SCREEN *sp,
+ const char *const cap,
+ int affcnt)
+ { return(*(int *)0); }
+
#undef _nc_msec_cost
int _nc_msec_cost(
const char *const cap,
int affcnt)
{ return(*(int *)0); }
+#undef _nc_mvcur_resume_sp
+void _nc_mvcur_resume_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_mvcur_resume
void _nc_mvcur_resume(void)
{ /* void */ }
+#undef _nc_mvcur_init_sp
+void _nc_mvcur_init_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_mvcur_init
void _nc_mvcur_init(void)
{ /* void */ }
+#undef _nc_mvcur_wrap_sp
+void _nc_mvcur_wrap_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_mvcur_wrap
void _nc_mvcur_wrap(void)
{ /* void */ }
+#undef mvcur_sp
+int mvcur_sp(
+ SCREEN *sp,
+ int yold,
+ int xold,
+ int ynew,
+ int xnew)
+ { return(*(int *)0); }
+
#undef mvcur
int mvcur(
int yold,
@@ -1347,14 +1563,32 @@ int mvwin(
/* ./base/lib_newterm.c */
+#undef filter_sp
+void filter_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef filter
void filter(void)
{ /* void */ }
+#undef nofilter_sp
+void nofilter_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef nofilter
void nofilter(void)
{ /* void */ }
+#undef newterm_sp
+SCREEN *newterm_sp(
+ SCREEN *sp,
+ char *name,
+ FILE *ofp,
+ FILE *ifp)
+ { return(*(SCREEN **)0); }
+
#undef newterm
SCREEN *newterm(
char *name,
@@ -1369,6 +1603,15 @@ int _nc_freewin(
WINDOW *win)
{ return(*(int *)0); }
+#undef newwin_sp
+WINDOW *newwin_sp(
+ SCREEN *sp,
+ int num_lines,
+ int num_columns,
+ int begy,
+ int begx)
+ { return(*(WINDOW **)0); }
+
#undef newwin
WINDOW *newwin(
int num_lines,
@@ -1395,8 +1638,9 @@ WINDOW *subwin(
int x)
{ return(*(WINDOW **)0); }
-#undef _nc_makenew
-WINDOW *_nc_makenew(
+#undef _nc_makenew_sp
+WINDOW *_nc_makenew_sp(
+ SCREEN *sp,
int num_lines,
int num_columns,
int begy,
@@ -1404,17 +1648,37 @@ WINDOW *_nc_makenew(
int flags)
{ return(*(WINDOW **)0); }
-#undef _nc_screen_of
-SCREEN *_nc_screen_of(
- WINDOW *win)
- { return(*(SCREEN **)0); }
+#undef _nc_curscr_of
+WINDOW *_nc_curscr_of(
+ SCREEN *sp)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_newscr_of
+WINDOW *_nc_newscr_of(
+ SCREEN *sp)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_stdscr_of
+WINDOW *_nc_stdscr_of(
+ SCREEN *sp)
+ { return(*(WINDOW **)0); }
/* ./base/lib_nl.c */
+#undef nl_sp
+int nl_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef nl
int nl(void)
{ return(*(int *)0); }
+#undef nonl_sp
+int nonl_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef nonl
int nonl(void)
{ return(*(int *)0); }
@@ -1448,6 +1712,13 @@ int copywin(
/* ./base/lib_pad.c */
+#undef newpad_sp
+WINDOW *newpad_sp(
+ SCREEN *sp,
+ int l,
+ int c)
+ { return(*(WINDOW **)0); }
+
#undef newpad
WINDOW *newpad(
int l,
@@ -1553,6 +1824,14 @@ int wnoutrefresh(
/* ./base/lib_restart.c */
+#undef restartterm_sp
+int restartterm_sp(
+ SCREEN *sp,
+ char *termp,
+ int filenum,
+ int *errret)
+ { return(*(int *)0); }
+
#undef restartterm
int restartterm(
char *termp,
@@ -1601,6 +1880,12 @@ int mvwscanw(
/* ./base/lib_screen.c */
+#undef getwin_sp
+WINDOW *getwin_sp(
+ SCREEN *sp,
+ FILE *filep)
+ { return(*(WINDOW **)0); }
+
#undef getwin
WINDOW *getwin(
FILE *filep)
@@ -1612,6 +1897,12 @@ int putwin(
FILE *filep)
{ return(*(int *)0); }
+#undef scr_restore_sp
+int scr_restore_sp(
+ SCREEN *sp,
+ const char *file)
+ { return(*(int *)0); }
+
#undef scr_restore
int scr_restore(
const char *file)
@@ -1622,11 +1913,23 @@ int scr_dump(
const char *file)
{ return(*(int *)0); }
+#undef scr_init_sp
+int scr_init_sp(
+ SCREEN *sp,
+ const char *file)
+ { return(*(int *)0); }
+
#undef scr_init
int scr_init(
const char *file)
{ return(*(int *)0); }
+#undef scr_set_sp
+int scr_set_sp(
+ SCREEN *sp,
+ const char *file)
+ { return(*(int *)0); }
+
#undef scr_set
int scr_set(
const char *file)
@@ -1678,6 +1981,16 @@ void delscreen(
SCREEN *sp)
{ /* void */ }
+#undef _nc_setupscreen_sp
+int _nc_setupscreen_sp(
+ SCREEN **spp,
+ int slines,
+ int scolumns,
+ FILE *output,
+ NCURSES_BOOL filtered,
+ int slk_format)
+ { return(*(int *)0); }
+
#undef _nc_setupscreen
int _nc_setupscreen(
int slines,
@@ -1687,6 +2000,15 @@ int _nc_setupscreen(
int slk_format)
{ return(*(int *)0); }
+#undef _nc_ripoffline_sp
+int _nc_ripoffline_sp(
+ SCREEN *sp,
+ int line,
+ int (*init)(
+ WINDOW *p1,
+ int p2))
+ { return(*(int *)0); }
+
#undef _nc_ripoffline
int _nc_ripoffline(
int line,
@@ -1695,6 +2017,15 @@ int _nc_ripoffline(
int p2))
{ return(*(int *)0); }
+#undef ripoffline_sp
+int ripoffline_sp(
+ SCREEN *sp,
+ int line,
+ int (*init)(
+ WINDOW *p1,
+ int p2))
+ { return(*(int *)0); }
+
#undef ripoffline
int ripoffline(
int line,
@@ -1705,18 +2036,37 @@ int ripoffline(
/* ./base/lib_slk.c */
+#undef _nc_format_slks
+int _nc_format_slks(
+ SCREEN *sp,
+ int cols)
+ { return(*(int *)0); }
+
#undef _nc_slk_initialize
int _nc_slk_initialize(
WINDOW *stwin,
int cols)
{ return(*(int *)0); }
+#undef slk_restore_sp
+int slk_restore_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_restore
int slk_restore(void)
{ return(*(int *)0); }
/* ./base/lib_slkatr_set.c */
+#undef slk_attr_set_sp
+int slk_attr_set_sp(
+ SCREEN *sp,
+ const attr_t attr,
+ short color_pair_number,
+ void *opts)
+ { return(*(int *)0); }
+
#undef slk_attr_set
int slk_attr_set(
const attr_t attr,
@@ -1726,6 +2076,12 @@ int slk_attr_set(
/* ./base/lib_slkatrof.c */
+#undef slk_attroff_sp
+int slk_attroff_sp(
+ SCREEN *sp,
+ const chtype attr)
+ { return(*(int *)0); }
+
#undef slk_attroff
int slk_attroff(
const chtype attr)
@@ -1733,6 +2089,12 @@ int slk_attroff(
/* ./base/lib_slkatron.c */
+#undef slk_attron_sp
+int slk_attron_sp(
+ SCREEN *sp,
+ const chtype attr)
+ { return(*(int *)0); }
+
#undef slk_attron
int slk_attron(
const chtype attr)
@@ -1740,6 +2102,12 @@ int slk_attron(
/* ./base/lib_slkatrset.c */
+#undef slk_attrset_sp
+int slk_attrset_sp(
+ SCREEN *sp,
+ const chtype attr)
+ { return(*(int *)0); }
+
#undef slk_attrset
int slk_attrset(
const chtype attr)
@@ -1747,18 +2115,34 @@ int slk_attrset(
/* ./base/lib_slkattr.c */
+#undef slk_attr_sp
+attr_t slk_attr_sp(
+ SCREEN *sp)
+ { return(*(attr_t *)0); }
+
#undef slk_attr
attr_t slk_attr(void)
{ return(*(attr_t *)0); }
/* ./base/lib_slkclear.c */
+#undef slk_clear_sp
+int slk_clear_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_clear
int slk_clear(void)
{ return(*(int *)0); }
/* ./base/lib_slkcolor.c */
+#undef slk_color_sp
+int slk_color_sp(
+ SCREEN *sp,
+ short color_pair_number)
+ { return(*(int *)0); }
+
#undef slk_color
int slk_color(
short color_pair_number)
@@ -1766,6 +2150,12 @@ int slk_color(
/* ./base/lib_slkinit.c */
+#undef slk_init_sp
+int slk_init_sp(
+ SCREEN *sp,
+ int format)
+ { return(*(int *)0); }
+
#undef slk_init
int slk_init(
int format)
@@ -1773,6 +2163,12 @@ int slk_init(
/* ./base/lib_slklab.c */
+#undef slk_label_sp
+char *slk_label_sp(
+ SCREEN *sp,
+ int n)
+ { return(*(char **)0); }
+
#undef slk_label
char *slk_label(
int n)
@@ -1780,16 +2176,34 @@ char *slk_label(
/* ./base/lib_slkrefr.c */
+#undef slk_noutrefresh_sp
+int slk_noutrefresh_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_noutrefresh
int slk_noutrefresh(void)
{ return(*(int *)0); }
+#undef slk_refresh_sp
+int slk_refresh_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_refresh
int slk_refresh(void)
{ return(*(int *)0); }
/* ./base/lib_slkset.c */
+#undef slk_set_sp
+int slk_set_sp(
+ SCREEN *sp,
+ int i,
+ const char *astr,
+ int format)
+ { return(*(int *)0); }
+
#undef slk_set
int slk_set(
int i,
@@ -1799,6 +2213,11 @@ int slk_set(
/* ./base/lib_slktouch.c */
+#undef slk_touch_sp
+int slk_touch_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_touch
int slk_touch(void)
{ return(*(int *)0); }
@@ -1840,6 +2259,12 @@ char *_nc_tracemouse(
MEVENT const *ep)
{ return(*(char **)0); }
+#undef _nc_retrace_mmask_t
+mmask_t _nc_retrace_mmask_t(
+ SCREEN *sp,
+ mmask_t code)
+ { return(*(mmask_t *)0); }
+
#undef _tracemouse
char *_tracemouse(
MEVENT const *ep)
@@ -1861,8 +2286,8 @@ void _nc_fifo_dump(
SCREEN *sp)
{ /* void */ }
-#undef _nc_ungetch
-int _nc_ungetch(
+#undef ungetch_sp
+int ungetch_sp(
SCREEN *sp,
int ch)
{ return(*(int *)0); }
@@ -1874,11 +2299,23 @@ int ungetch(
/* ./tty/lib_vidattr.c */
+#undef vidputs_sp
+int vidputs_sp(
+ SCREEN *sp,
+ chtype newmode,
+ NCURSES_OUTC_sp outc)
+ { return(*(int *)0); }
+
#undef vidputs
int vidputs(
chtype newmode,
- int (*outc)(
- int p1))
+ NCURSES_OUTC outc)
+ { return(*(int *)0); }
+
+#undef vidattr_sp
+int vidattr_sp(
+ SCREEN *sp,
+ chtype newmode)
{ return(*(int *)0); }
#undef vidattr
@@ -1886,6 +2323,11 @@ int vidattr(
chtype newmode)
{ return(*(int *)0); }
+#undef termattrs_sp
+chtype termattrs_sp(
+ SCREEN *sp)
+ { return(*(chtype *)0); }
+
#undef termattrs
chtype termattrs(void)
{ return(*(chtype *)0); }
@@ -1966,12 +2408,24 @@ WINDOW *dupwin(
/* ./base/nc_panel.c */
+#undef _nc_panelhook_sp
+struct panelhook *_nc_panelhook_sp(
+ SCREEN *sp)
+ { return(*(struct panelhook **)0); }
+
#undef _nc_panelhook
struct panelhook *_nc_panelhook(void)
{ return(*(struct panelhook **)0); }
/* ./base/safe_sprintf.c */
+#undef _nc_printf_string_sp
+char *_nc_printf_string_sp(
+ SCREEN *sp,
+ const char *fmt,
+ va_list ap)
+ { return(*(char **)0); }
+
#undef _nc_printf_string
char *_nc_printf_string(
const char *fmt,
@@ -1983,10 +2437,24 @@ char *_nc_printf_string(
#include <sys/time.h>
#include <sys/times.h>
+#undef doupdate_sp
+int doupdate_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef doupdate
int doupdate(void)
{ return(*(int *)0); }
+#undef _nc_scrolln_sp
+int _nc_scrolln_sp(
+ SCREEN *sp,
+ int n,
+ int top,
+ int bot,
+ int maxy)
+ { return(*(int *)0); }
+
#undef _nc_scrolln
int _nc_scrolln(
int n,
@@ -1995,18 +2463,39 @@ int _nc_scrolln(
int maxy)
{ return(*(int *)0); }
+#undef _nc_screen_resume_sp
+void _nc_screen_resume_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_screen_resume
void _nc_screen_resume(void)
{ /* void */ }
+#undef _nc_screen_init_sp
+void _nc_screen_init_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_screen_init
void _nc_screen_init(void)
{ /* void */ }
+#undef _nc_screen_wrap_sp
+void _nc_screen_wrap_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_screen_wrap
void _nc_screen_wrap(void)
{ /* void */ }
+#undef _nc_do_xmc_glitch_sp
+void _nc_do_xmc_glitch_sp(
+ SCREEN *sp,
+ attr_t previous)
+ { /* void */ }
+
#undef _nc_do_xmc_glitch
void _nc_do_xmc_glitch(
attr_t previous)
@@ -2038,12 +2527,16 @@ void _nc_vsscanf(void)
/* ./base/lib_freeall.c */
-#include <term_entry.h>
-
#undef _nc_freeall
void _nc_freeall(void)
{ /* void */ }
+#undef _nc_free_and_exit_sp
+void _nc_free_and_exit_sp(
+ SCREEN *sp,
+ int code)
+ { /* void */ }
+
#undef _nc_free_and_exit
void _nc_free_and_exit(
int code)
@@ -2063,6 +2556,24 @@ void _nc_toggle_attr_off(
attr_t at)
{ /* void */ }
+#undef _nc_DelCharCost_sp
+int _nc_DelCharCost_sp(
+ SCREEN *sp,
+ int count)
+ { return(*(int *)0); }
+
+#undef _nc_InsCharCost_sp
+int _nc_InsCharCost_sp(
+ SCREEN *sp,
+ int count)
+ { return(*(int *)0); }
+
+#undef _nc_UpdateAttrs_sp
+void _nc_UpdateAttrs_sp(
+ SCREEN *sp,
+ chtype c)
+ { /* void */ }
+
#undef _nc_DelCharCost
int _nc_DelCharCost(
int count)
@@ -2080,6 +2591,12 @@ void _nc_UpdateAttrs(
/* ./base/legacy_coding.c */
+#undef use_legacy_coding_sp
+int use_legacy_coding_sp(
+ SCREEN *sp,
+ int level)
+ { return(*(int *)0); }
+
#undef use_legacy_coding
int use_legacy_coding(
int level)
@@ -2087,10 +2604,22 @@ int use_legacy_coding(
/* ./base/lib_dft_fgbg.c */
+#undef use_default_colors_sp
+int use_default_colors_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef use_default_colors
int use_default_colors(void)
{ return(*(int *)0); }
+#undef assume_default_colors_sp
+int assume_default_colors_sp(
+ SCREEN *sp,
+ int fg,
+ int bg)
+ { return(*(int *)0); }
+
#undef assume_default_colors
int assume_default_colors(
int fg,
@@ -2099,6 +2628,13 @@ int assume_default_colors(
/* ./tinfo/lib_print.c */
+#undef mcprint_sp
+int mcprint_sp(
+ SCREEN *sp,
+ char *data,
+ int len)
+ { return(*(int *)0); }
+
#undef mcprint
int mcprint(
char *data,
@@ -2107,18 +2643,39 @@ int mcprint(
/* ./base/resizeterm.c */
+#undef is_term_resized_sp
+NCURSES_BOOL is_term_resized_sp(
+ SCREEN *sp,
+ int ToLines,
+ int ToCols)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef is_term_resized
NCURSES_BOOL is_term_resized(
int ToLines,
int ToCols)
{ return(*(NCURSES_BOOL *)0); }
+#undef resize_term_sp
+int resize_term_sp(
+ SCREEN *sp,
+ int ToLines,
+ int ToCols)
+ { return(*(int *)0); }
+
#undef resize_term
int resize_term(
int ToLines,
int ToCols)
{ return(*(int *)0); }
+#undef resizeterm_sp
+int resizeterm_sp(
+ SCREEN *sp,
+ int ToLines,
+ int ToCols)
+ { return(*(int *)0); }
+
#undef resizeterm
int resizeterm(
int ToLines,
@@ -2161,9 +2718,6 @@ int wresize(
/* ./tinfo/access.c */
-#include <sys/stat.h>
-#include <nc_alloc.h>
-
#undef _nc_rootname
char *_nc_rootname(
char *path)
@@ -2241,6 +2795,30 @@ char *const *_nc_numcodes(void)
char *const *_nc_strcodes(void)
{ 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 HashValue *_nc_get_hash_table(
+ NCURSES_BOOL termcap)
+ { return(*(const HashValue **)0); }
+
+#undef _nc_get_alias_table
+const struct alias *_nc_get_alias_table(
+ NCURSES_BOOL termcap)
+ { return(*(const struct alias **)0); }
+
+#undef _nc_get_hash_info
+const HashData *_nc_get_hash_info(
+ NCURSES_BOOL termcap)
+ { return(*(const HashData **)0); }
+
/* ./tinfo/comp_error.c */
#undef _nc_suppress_warnings
@@ -2287,6 +2865,21 @@ void _nc_syserr_abort(
...)
{ /* void */ }
+/* ./tinfo/comp_hash.c */
+
+#undef _nc_find_entry
+struct name_table_entry const *_nc_find_entry(
+ const char *string,
+ const HashValue *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,
+ NCURSES_BOOL termcap)
+ { return(*(struct name_table_entry const **)0); }
+
/* ./tinfo/db_iterator.c */
#undef _nc_tic_dir
@@ -2408,6 +3001,11 @@ void _nc_init_keytry(
chtype *_nc_acs_map(void)
{ return(*(chtype **)0); }
+#undef _nc_init_acs_sp
+void _nc_init_acs_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_init_acs
void _nc_init_acs(void)
{ /* void */ }
@@ -2431,21 +3029,47 @@ int _nc_ospeed(
int BaudRate)
{ return(*(int *)0); }
+#undef baudrate_sp
+int baudrate_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef baudrate
int baudrate(void)
{ return(*(int *)0); }
/* ./tinfo/lib_cur_term.c */
+#undef _nc_get_cur_term_sp
+TERMINAL *_nc_get_cur_term_sp(
+ SCREEN *sp)
+ { return(*(TERMINAL **)0); }
+
+#undef _nc_get_cur_term
+TERMINAL *_nc_get_cur_term(void)
+ { return(*(TERMINAL **)0); }
+
#undef _nc_cur_term
TERMINAL *_nc_cur_term(void)
{ return(*(TERMINAL **)0); }
+#undef set_curterm_sp
+TERMINAL *set_curterm_sp(
+ SCREEN *sp,
+ TERMINAL *termp)
+ { return(*(TERMINAL **)0); }
+
#undef set_curterm
TERMINAL *set_curterm(
TERMINAL *termp)
{ return(*(TERMINAL **)0); }
+#undef del_curterm_sp
+int del_curterm_sp(
+ SCREEN *sp,
+ TERMINAL *termp)
+ { return(*(int *)0); }
+
#undef del_curterm
int del_curterm(
TERMINAL *termp)
@@ -2474,6 +3098,11 @@ NCURSES_GLOBALS _nc_globals;
#undef _nc_prescreen
NCURSES_PRESCREEN _nc_prescreen;
+#undef _nc_screen_of
+SCREEN *_nc_screen_of(
+ WINDOW *win)
+ { return(*(SCREEN **)0); }
+
#undef _nc_init_pthreads
void _nc_init_pthreads(void)
{ /* void */ }
@@ -2500,24 +3129,49 @@ int _nc_mutex_unlock(
/* ./tinfo/lib_has_cap.c */
+#undef has_ic_sp
+NCURSES_BOOL has_ic_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef has_ic
NCURSES_BOOL has_ic(void)
{ return(*(NCURSES_BOOL *)0); }
+#undef has_il_sp
+NCURSES_BOOL has_il_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef has_il
NCURSES_BOOL has_il(void)
{ return(*(NCURSES_BOOL *)0); }
/* ./tinfo/lib_kernel.c */
+#undef erasechar_sp
+char erasechar_sp(
+ SCREEN *sp)
+ { return(*(char *)0); }
+
#undef erasechar
char erasechar(void)
{ return(*(char *)0); }
+#undef killchar_sp
+char killchar_sp(
+ SCREEN *sp)
+ { return(*(char *)0); }
+
#undef killchar
char killchar(void)
{ return(*(char *)0); }
+#undef flushinp_sp
+int flushinp_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef flushinp
int flushinp(void)
{ return(*(int *)0); }
@@ -2526,8 +3180,8 @@ int flushinp(void)
struct kn { short offset; int code; };
-#undef _nc_keyname
-char *_nc_keyname(
+#undef keyname_sp
+char *keyname_sp(
SCREEN *sp,
int c)
{ return(*(char **)0); }
@@ -2539,12 +3193,23 @@ char *keyname(
/* ./tinfo/lib_longname.c */
+#undef longname_sp
+char *longname_sp(
+ SCREEN *sp)
+ { return(*(char **)0); }
+
#undef longname
char *longname(void)
{ return(*(char **)0); }
/* ./tinfo/lib_napms.c */
+#undef napms_sp
+int napms_sp(
+ SCREEN *sp,
+ int ms)
+ { return(*(int *)0); }
+
#undef napms
int napms(
int ms)
@@ -2564,6 +3229,12 @@ void idcok(
NCURSES_BOOL flag)
{ /* void */ }
+#undef halfdelay_sp
+int halfdelay_sp(
+ SCREEN *sp,
+ int t)
+ { return(*(int *)0); }
+
#undef halfdelay
int halfdelay(
int t)
@@ -2599,21 +3270,46 @@ int meta(
NCURSES_BOOL flag)
{ return(*(int *)0); }
+#undef curs_set_sp
+int curs_set_sp(
+ SCREEN *sp,
+ int vis)
+ { return(*(int *)0); }
+
#undef curs_set
int curs_set(
int vis)
{ return(*(int *)0); }
+#undef typeahead_sp
+int typeahead_sp(
+ SCREEN *sp,
+ int fd)
+ { return(*(int *)0); }
+
#undef typeahead
int typeahead(
int fd)
{ return(*(int *)0); }
+#undef has_key_sp
+int has_key_sp(
+ SCREEN *sp,
+ int keycode)
+ { return(*(int *)0); }
+
#undef has_key
int has_key(
int keycode)
{ return(*(int *)0); }
+#undef _nc_putp_flush_sp
+int _nc_putp_flush_sp(
+ SCREEN *sp,
+ const char *name,
+ const char *value)
+ { return(*(int *)0); }
+
#undef _nc_keypad
int _nc_keypad(
SCREEN *sp,
@@ -2622,30 +3318,67 @@ int _nc_keypad(
/* ./tinfo/lib_raw.c */
+#undef raw_sp
+int raw_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef raw
int raw(void)
{ return(*(int *)0); }
+#undef cbreak_sp
+int cbreak_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef cbreak
int cbreak(void)
{ return(*(int *)0); }
+#undef qiflush_sp
+void qiflush_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef qiflush
void qiflush(void)
{ /* void */ }
+#undef noraw_sp
+int noraw_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef noraw
int noraw(void)
{ return(*(int *)0); }
+#undef nocbreak_sp
+int nocbreak_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef nocbreak
int nocbreak(void)
{ return(*(int *)0); }
+#undef noqiflush_sp
+void noqiflush_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef noqiflush
void noqiflush(void)
{ /* void */ }
+#undef intrflush_sp
+int intrflush_sp(
+ SCREEN *sp,
+ WINDOW *win,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
#undef intrflush
int intrflush(
WINDOW *win,
@@ -2663,7 +3396,8 @@ char *_nc_ttytype(void)
{ return(*(char **)0); }
#undef _nc_ptr_Lines
-int *_nc_ptr_Lines(void)
+int *_nc_ptr_Lines(
+ SCREEN *sp)
{ return(*(int **)0); }
#undef _nc_LINES
@@ -2671,17 +3405,29 @@ int _nc_LINES(void)
{ return(*(int *)0); }
#undef _nc_ptr_Cols
-int *_nc_ptr_Cols(void)
+int *_nc_ptr_Cols(
+ SCREEN *sp)
{ return(*(int **)0); }
#undef _nc_COLS
int _nc_COLS(void)
{ return(*(int *)0); }
+#undef _nc_ptr_Tabsize
+int *_nc_ptr_Tabsize(
+ SCREEN *sp)
+ { return(*(int **)0); }
+
#undef _nc_TABSIZE
int _nc_TABSIZE(void)
{ return(*(int *)0); }
+#undef set_tabsize_sp
+int set_tabsize_sp(
+ SCREEN *sp,
+ int value)
+ { return(*(int *)0); }
+
#undef set_tabsize
int set_tabsize(
int value)
@@ -2692,6 +3438,12 @@ int _nc_handle_sigwinch(
SCREEN *sp)
{ return(*(int *)0); }
+#undef use_env_sp
+void use_env_sp(
+ SCREEN *sp,
+ NCURSES_BOOL f)
+ { /* void */ }
+
#undef use_env
void use_env(
NCURSES_BOOL f)
@@ -2709,6 +3461,18 @@ void _nc_update_screensize(
SCREEN *sp)
{ /* void */ }
+#undef _nc_setup_tinfo
+int _nc_setup_tinfo(
+ const char *const tn,
+ TERMTYPE *const tp)
+ { return(*(int *)0); }
+
+#undef _nc_tinfo_cmdch
+void _nc_tinfo_cmdch(
+ TERMINAL *termp,
+ char proto)
+ { /* void */ }
+
#undef _nc_get_locale
char *_nc_get_locale(void)
{ return(*(char **)0); }
@@ -2730,6 +3494,10 @@ int _nc_setupterm(
NCURSES_BOOL reuse)
{ return(*(int *)0); }
+#undef new_prescr
+SCREEN *new_prescr(void)
+ { return(*(SCREEN **)0); }
+
#undef setupterm
int setupterm(
char *tname,
@@ -2744,8 +3512,9 @@ char *UP;
#undef BC
char *BC;
-#undef tgetent
-int tgetent(
+#undef tgetent_sp
+int tgetent_sp(
+ SCREEN *sp,
char *bufp,
const char *name)
{ return(*(int *)0); }
@@ -2756,16 +3525,41 @@ int tgetent(
#endif
+#undef tgetent
+int tgetent(
+ char *bufp,
+ const char *name)
+ { return(*(int *)0); }
+
+#undef tgetflag_sp
+int tgetflag_sp(
+ SCREEN *sp,
+ char *id)
+ { return(*(int *)0); }
+
#undef tgetflag
int tgetflag(
char *id)
{ return(*(int *)0); }
+#undef tgetnum_sp
+int tgetnum_sp(
+ SCREEN *sp,
+ char *id)
+ { return(*(int *)0); }
+
#undef tgetnum
int tgetnum(
char *id)
{ return(*(int *)0); }
+#undef tgetstr_sp
+char *tgetstr_sp(
+ SCREEN *sp,
+ char *id,
+ char **area)
+ { return(*(char **)0); }
+
#undef tgetstr
char *tgetstr(
char *id,
@@ -2774,6 +3568,11 @@ char *tgetstr(
/* ./tinfo/lib_termname.c */
+#undef termname_sp
+char *termname_sp(
+ SCREEN *sp)
+ { return(*(char **)0); }
+
#undef termname
char *termname(void)
{ return(*(char **)0); }
@@ -2789,16 +3588,34 @@ char *tgoto(
/* ./tinfo/lib_ti.c */
+#undef tigetflag_sp
+int tigetflag_sp(
+ SCREEN *sp,
+ char *str)
+ { return(*(int *)0); }
+
#undef tigetflag
int tigetflag(
char *str)
{ return(*(int *)0); }
+#undef tigetnum_sp
+int tigetnum_sp(
+ SCREEN *sp,
+ char *str)
+ { return(*(int *)0); }
+
#undef tigetnum
int tigetnum(
char *str)
{ return(*(int *)0); }
+#undef tigetstr_sp
+char *tigetstr_sp(
+ SCREEN *sp,
+ char *str)
+ { return(*(char **)0); }
+
#undef tigetstr
char *tigetstr(
char *str)
@@ -2822,6 +3639,12 @@ char *tparm(
...)
{ return(*(char **)0); }
+#undef tiparm
+char *tiparm(
+ const char *string,
+ ...)
+ { return(*(char **)0); }
+
/* ./tinfo/lib_tputs.c */
#undef PC
@@ -2836,25 +3659,75 @@ void _nc_set_no_padding(
SCREEN *sp)
{ /* void */ }
+#undef delay_output_sp
+int delay_output_sp(
+ SCREEN *sp,
+ int ms)
+ { return(*(int *)0); }
+
#undef delay_output
int delay_output(
int ms)
{ return(*(int *)0); }
+#undef _nc_flush_sp
+void _nc_flush_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_flush
void _nc_flush(void)
{ /* void */ }
+#undef _nc_outch_sp
+int _nc_outch_sp(
+ SCREEN *sp,
+ int ch)
+ { return(*(int *)0); }
+
#undef _nc_outch
int _nc_outch(
int ch)
{ return(*(int *)0); }
+#undef putp_sp
+int putp_sp(
+ SCREEN *sp,
+ const char *string)
+ { return(*(int *)0); }
+
+#undef _nc_putp_sp
+int _nc_putp_sp(
+ SCREEN *sp,
+ const char *name,
+ const char *string)
+ { return(*(int *)0); }
+
#undef putp
int putp(
const char *string)
{ return(*(int *)0); }
+#undef _nc_putp
+int _nc_putp(
+ const char *name,
+ const char *string)
+ { return(*(int *)0); }
+
+#undef tputs_sp
+int tputs_sp(
+ SCREEN *sp,
+ const char *string,
+ int affcnt,
+ NCURSES_OUTC_sp outc)
+ { return(*(int *)0); }
+
+#undef _nc_outc_wrapper
+int _nc_outc_wrapper(
+ SCREEN *sp,
+ int c)
+ { return(*(int *)0); }
+
#undef tputs
int tputs(
const char *string,
@@ -2902,6 +3775,11 @@ NCURSES_BOOL _nc_retrace_bool(
NCURSES_BOOL code)
{ return(*(NCURSES_BOOL *)0); }
+#undef _nc_retrace_char
+char _nc_retrace_char(
+ char code)
+ { return(*(char *)0); }
+
#undef _nc_retrace_int
int _nc_retrace_int(
int code)
@@ -2966,6 +3844,11 @@ char *_traceattr(
attr_t newmode)
{ return(*(char **)0); }
+#undef _nc_retrace_int_attr_t
+int _nc_retrace_int_attr_t(
+ attr_t code)
+ { return(*(int *)0); }
+
#undef _nc_retrace_attr_t
attr_t _nc_retrace_attr_t(
attr_t code)
@@ -3024,36 +3907,78 @@ char *_tracechar(
/* ./tinfo/lib_ttyflags.c */
+#undef _nc_get_tty_mode_sp
+int _nc_get_tty_mode_sp(
+ SCREEN *sp,
+ struct termios *buf)
+ { return(*(int *)0); }
+
#undef _nc_get_tty_mode
int _nc_get_tty_mode(
struct termios *buf)
{ return(*(int *)0); }
+#undef _nc_set_tty_mode_sp
+int _nc_set_tty_mode_sp(
+ SCREEN *sp,
+ struct termios *buf)
+ { return(*(int *)0); }
+
#undef _nc_set_tty_mode
int _nc_set_tty_mode(
struct termios *buf)
{ return(*(int *)0); }
+#undef def_shell_mode_sp
+int def_shell_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef def_shell_mode
int def_shell_mode(void)
{ return(*(int *)0); }
+#undef def_prog_mode_sp
+int def_prog_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef def_prog_mode
int def_prog_mode(void)
{ return(*(int *)0); }
+#undef reset_prog_mode_sp
+int reset_prog_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef reset_prog_mode
int reset_prog_mode(void)
{ return(*(int *)0); }
+#undef reset_shell_mode_sp
+int reset_shell_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef reset_shell_mode
int reset_shell_mode(void)
{ return(*(int *)0); }
+#undef savetty_sp
+int savetty_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef savetty
int savetty(void)
{ return(*(int *)0); }
+#undef resetty_sp
+int resetty_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef resetty
int resetty(void)
{ return(*(int *)0); }
@@ -3144,6 +4069,13 @@ int _nc_read_termcap_entry(
/* ./tinfo/setbuf.c */
+#undef _nc_set_buffer_sp
+void _nc_set_buffer_sp(
+ SCREEN *sp,
+ FILE *ofp,
+ NCURSES_BOOL buffered)
+ { /* void */ }
+
#undef _nc_set_buffer
void _nc_set_buffer(
FILE *ofp,
@@ -3235,8 +4167,8 @@ char *_nc_trim_sgr0(
/* ./unctrl.c */
-#undef _nc_unctrl
-char *_nc_unctrl(
+#undef unctrl_sp
+char *unctrl_sp(
SCREEN *sp,
chtype ch)
{ return(*(char **)0); }
@@ -3323,25 +4255,6 @@ char *_nc_infotocap(
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
@@ -3351,21 +4264,6 @@ char *_nc_tic_expand(
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
@@ -3485,6 +4383,13 @@ int _nc_tic_written(void)
/* ./base/define_key.c */
+#undef define_key_sp
+int define_key_sp(
+ SCREEN *sp,
+ const char *str,
+ int keycode)
+ { return(*(int *)0); }
+
#undef define_key
int define_key(
const char *str,
@@ -3499,6 +4404,12 @@ void _nc_hashed_db(void)
/* ./base/key_defined.c */
+#undef key_defined_sp
+int key_defined_sp(
+ SCREEN *sp,
+ const char *str)
+ { return(*(int *)0); }
+
#undef key_defined
int key_defined(
const char *str)
@@ -3506,6 +4417,13 @@ int key_defined(
/* ./base/keybound.c */
+#undef keybound_sp
+char *keybound_sp(
+ SCREEN *sp,
+ int code,
+ int count)
+ { return(*(char **)0); }
+
#undef keybound
char *keybound(
int code,
@@ -3514,6 +4432,13 @@ char *keybound(
/* ./base/keyok.c */
+#undef keyok_sp
+int keyok_sp(
+ SCREEN *sp,
+ int c,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
#undef keyok
int keyok(
int c,
diff --git a/contrib/ncurses/ncurses/llib-lncursestw b/contrib/ncurses/ncurses/llib-lncursestw
new file mode 100644
index 000000000000..5230bc758aff
--- /dev/null
+++ b/contrib/ncurses/ncurses/llib-lncursestw
@@ -0,0 +1,5270 @@
+/****************************************************************************
+ * Copyright (c) 2009-2010,2011 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 2009-2010,2011 *
+ ****************************************************************************/
+/* LINTLIBRARY */
+
+/* ./tty/hardscroll.c */
+
+#include <curses.priv.h>
+
+#undef _nc_oldnums
+int *_nc_oldnums;
+
+#undef _nc_scroll_optimize_sp
+void _nc_scroll_optimize_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_scroll_optimize
+void _nc_scroll_optimize(void)
+ { /* void */ }
+
+#undef _nc_linedump_sp
+void _nc_linedump_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_linedump
+void _nc_linedump(void)
+ { /* void */ }
+
+/* ./tty/hashmap.c */
+
+#undef _nc_hash_map_sp
+void _nc_hash_map_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_hash_map
+void _nc_hash_map(void)
+ { /* void */ }
+
+#undef _nc_make_oldhash_sp
+void _nc_make_oldhash_sp(
+ SCREEN *sp,
+ int i)
+ { /* void */ }
+
+#undef _nc_make_oldhash
+void _nc_make_oldhash(
+ int i)
+ { /* void */ }
+
+#undef _nc_scroll_oldhash_sp
+void _nc_scroll_oldhash_sp(
+ SCREEN *sp,
+ int n,
+ int top,
+ int bot)
+ { /* void */ }
+
+#undef _nc_scroll_oldhash
+void _nc_scroll_oldhash(
+ int n,
+ int top,
+ int bot)
+ { /* void */ }
+
+/* ./base/lib_addch.c */
+
+#include <ctype.h>
+
+#undef _nc_render
+cchar_t _nc_render(
+ WINDOW *win,
+ cchar_t ch)
+ { return(*(cchar_t *)0); }
+
+#undef _nc_build_wch
+int _nc_build_wch(
+ WINDOW *win,
+ cchar_t *ch)
+ { return(*(int *)0); }
+
+#undef _nc_waddch_nosync
+int _nc_waddch_nosync(
+ WINDOW *win,
+ const cchar_t c)
+ { return(*(int *)0); }
+
+#undef waddch
+int waddch(
+ WINDOW *win,
+ const chtype ch)
+ { return(*(int *)0); }
+
+#undef wechochar
+int wechochar(
+ WINDOW *win,
+ const chtype ch)
+ { return(*(int *)0); }
+
+/* ./base/lib_addstr.c */
+
+#undef waddnstr
+int waddnstr(
+ WINDOW *win,
+ const char *astr,
+ int n)
+ { return(*(int *)0); }
+
+#undef waddchnstr
+int waddchnstr(
+ WINDOW *win,
+ const chtype *astr,
+ int n)
+ { return(*(int *)0); }
+
+#undef _nc_wchstrlen
+int _nc_wchstrlen(
+ const cchar_t *s)
+ { return(*(int *)0); }
+
+#undef wadd_wchnstr
+int wadd_wchnstr(
+ WINDOW *win,
+ const cchar_t *astr,
+ int n)
+ { return(*(int *)0); }
+
+#undef waddnwstr
+int waddnwstr(
+ WINDOW *win,
+ const wchar_t *str,
+ int n)
+ { return(*(int *)0); }
+
+/* ./base/lib_beep.c */
+
+#undef beep_sp
+int beep_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef beep
+int beep(void)
+ { return(*(int *)0); }
+
+/* ./base/lib_bkgd.c */
+
+#undef wbkgrndset
+void wbkgrndset(
+ WINDOW *win,
+ const cchar_t *ch)
+ { /* void */ }
+
+#undef wbkgdset
+void wbkgdset(
+ WINDOW *win,
+ chtype ch)
+ { /* void */ }
+
+#undef wbkgrnd
+int wbkgrnd(
+ WINDOW *win,
+ const cchar_t *ch)
+ { return(*(int *)0); }
+
+#undef wbkgd
+int wbkgd(
+ WINDOW *win,
+ chtype ch)
+ { return(*(int *)0); }
+
+/* ./base/lib_box.c */
+
+#undef wborder
+int wborder(
+ WINDOW *win,
+ chtype ls,
+ chtype rs,
+ chtype ts,
+ chtype bs,
+ chtype tl,
+ chtype tr,
+ chtype bl,
+ chtype br)
+ { return(*(int *)0); }
+
+/* ./base/lib_chgat.c */
+
+#undef wchgat
+int wchgat(
+ WINDOW *win,
+ int n,
+ attr_t attr,
+ short color,
+ const void *opts)
+ { return(*(int *)0); }
+
+/* ./base/lib_clear.c */
+
+#undef wclear
+int wclear(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./base/lib_clearok.c */
+
+#undef clearok
+int clearok(
+ WINDOW *win,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
+/* ./base/lib_clrbot.c */
+
+#undef wclrtobot
+int wclrtobot(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./base/lib_clreol.c */
+
+#undef wclrtoeol
+int wclrtoeol(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./base/lib_color.c */
+
+#include <tic.h>
+
+#undef _nc_COLOR_PAIRS
+int _nc_COLOR_PAIRS(void)
+ { return(*(int *)0); }
+
+#undef _nc_COLORS
+int _nc_COLORS(void)
+ { return(*(int *)0); }
+
+#undef _nc_reset_colors_sp
+NCURSES_BOOL _nc_reset_colors_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_reset_colors
+NCURSES_BOOL _nc_reset_colors(void)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef start_color_sp
+int start_color_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef start_color
+int start_color(void)
+ { return(*(int *)0); }
+
+#undef init_pair_sp
+int init_pair_sp(
+ SCREEN *sp,
+ short pair,
+ short f,
+ short b)
+ { return(*(int *)0); }
+
+#undef init_pair
+int init_pair(
+ short pair,
+ short f,
+ short b)
+ { return(*(int *)0); }
+
+#undef init_color_sp
+int init_color_sp(
+ SCREEN *sp,
+ short color,
+ short r,
+ short g,
+ short b)
+ { return(*(int *)0); }
+
+#undef init_color
+int init_color(
+ short color,
+ short r,
+ short g,
+ short b)
+ { return(*(int *)0); }
+
+#undef can_change_color_sp
+NCURSES_BOOL can_change_color_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef can_change_color
+NCURSES_BOOL can_change_color(void)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef has_colors_sp
+NCURSES_BOOL has_colors_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef has_colors
+NCURSES_BOOL has_colors(void)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef color_content_sp
+int color_content_sp(
+ SCREEN *sp,
+ short color,
+ short *r,
+ short *g,
+ short *b)
+ { return(*(int *)0); }
+
+#undef color_content
+int color_content(
+ short color,
+ short *r,
+ short *g,
+ short *b)
+ { return(*(int *)0); }
+
+#undef pair_content_sp
+int pair_content_sp(
+ SCREEN *sp,
+ short pair,
+ short *f,
+ short *b)
+ { return(*(int *)0); }
+
+#undef pair_content
+int pair_content(
+ short pair,
+ short *f,
+ short *b)
+ { return(*(int *)0); }
+
+#undef _nc_do_color_sp
+void _nc_do_color_sp(
+ SCREEN *sp,
+ short old_pair,
+ short pair,
+ NCURSES_BOOL reverse,
+ NCURSES_OUTC_sp outc)
+ { /* void */ }
+
+#undef _nc_do_color
+void _nc_do_color(
+ short old_pair,
+ short pair,
+ NCURSES_BOOL reverse,
+ NCURSES_OUTC outc)
+ { /* void */ }
+
+/* ./base/lib_colorset.c */
+
+#undef wcolor_set
+int wcolor_set(
+ WINDOW *win,
+ short color_pair_number,
+ void *opts)
+ { return(*(int *)0); }
+
+/* ./base/lib_delch.c */
+
+#undef wdelch
+int wdelch(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./base/lib_delwin.c */
+
+#undef delwin
+int delwin(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./base/lib_echo.c */
+
+#undef echo_sp
+int echo_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef echo
+int echo(void)
+ { return(*(int *)0); }
+
+#undef noecho_sp
+int noecho_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef noecho
+int noecho(void)
+ { return(*(int *)0); }
+
+/* ./base/lib_endwin.c */
+
+#undef endwin_sp
+int endwin_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef endwin
+int endwin(void)
+ { return(*(int *)0); }
+
+/* ./base/lib_erase.c */
+
+#undef werase
+int werase(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./base/lib_flash.c */
+
+#undef flash_sp
+int flash_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef flash
+int flash(void)
+ { return(*(int *)0); }
+
+/* ./lib_gen.c */
+
+#undef addch
+int addch(
+ const chtype z)
+ { return(*(int *)0); }
+
+#undef addchnstr
+int addchnstr(
+ const chtype *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef addchstr
+int addchstr(
+ const chtype *z)
+ { return(*(int *)0); }
+
+#undef addnstr
+int addnstr(
+ const char *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef addstr
+int addstr(
+ const char *z)
+ { return(*(int *)0); }
+
+#undef attroff
+int attroff(
+ NCURSES_ATTR_T z)
+ { return(*(int *)0); }
+
+#undef attron
+int attron(
+ NCURSES_ATTR_T z)
+ { return(*(int *)0); }
+
+#undef attrset
+int attrset(
+ NCURSES_ATTR_T z)
+ { return(*(int *)0); }
+
+#undef attr_get
+int attr_get(
+ attr_t *a1,
+ short *a2,
+ void *z)
+ { return(*(int *)0); }
+
+#undef attr_off
+int attr_off(
+ attr_t a1,
+ void *z)
+ { return(*(int *)0); }
+
+#undef attr_on
+int attr_on(
+ attr_t a1,
+ void *z)
+ { return(*(int *)0); }
+
+#undef attr_set
+int attr_set(
+ attr_t a1,
+ short a2,
+ void *z)
+ { return(*(int *)0); }
+
+#undef bkgd
+int bkgd(
+ chtype z)
+ { return(*(int *)0); }
+
+#undef bkgdset
+void bkgdset(
+ chtype z)
+ { /* void */ }
+
+#undef border
+int border(
+ chtype a1,
+ chtype a2,
+ chtype a3,
+ chtype a4,
+ chtype a5,
+ chtype a6,
+ chtype a7,
+ chtype z)
+ { return(*(int *)0); }
+
+#undef box
+int box(
+ WINDOW *a1,
+ chtype a2,
+ chtype z)
+ { return(*(int *)0); }
+
+#undef chgat
+int chgat(
+ int a1,
+ attr_t a2,
+ short a3,
+ const void *z)
+ { return(*(int *)0); }
+
+#undef clear
+int clear(void)
+ { return(*(int *)0); }
+
+#undef clrtobot
+int clrtobot(void)
+ { return(*(int *)0); }
+
+#undef clrtoeol
+int clrtoeol(void)
+ { return(*(int *)0); }
+
+#undef color_set
+int color_set(
+ short a1,
+ void *z)
+ { return(*(int *)0); }
+
+#undef COLOR_PAIR
+int COLOR_PAIR(
+ int z)
+ { return(*(int *)0); }
+
+#undef delch
+int delch(void)
+ { return(*(int *)0); }
+
+#undef deleteln
+int deleteln(void)
+ { return(*(int *)0); }
+
+#undef echochar
+int echochar(
+ const chtype z)
+ { return(*(int *)0); }
+
+#undef erase
+int erase(void)
+ { return(*(int *)0); }
+
+#undef getbkgd
+chtype getbkgd(
+ WINDOW *z)
+ { return(*(chtype *)0); }
+
+#undef getch
+int getch(void)
+ { return(*(int *)0); }
+
+#undef getnstr
+int getnstr(
+ char *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef getstr
+int getstr(
+ char *z)
+ { return(*(int *)0); }
+
+#undef hline
+int hline(
+ chtype a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef inch
+chtype inch(void)
+ { return(*(chtype *)0); }
+
+#undef inchnstr
+int inchnstr(
+ chtype *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef inchstr
+int inchstr(
+ chtype *z)
+ { return(*(int *)0); }
+
+#undef innstr
+int innstr(
+ char *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef insch
+int insch(
+ chtype z)
+ { return(*(int *)0); }
+
+#undef insdelln
+int insdelln(
+ int z)
+ { return(*(int *)0); }
+
+#undef insertln
+int insertln(void)
+ { return(*(int *)0); }
+
+#undef insnstr
+int insnstr(
+ const char *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef insstr
+int insstr(
+ const char *z)
+ { return(*(int *)0); }
+
+#undef instr
+int instr(
+ char *z)
+ { return(*(int *)0); }
+
+#undef move
+int move(
+ int a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvaddch
+int mvaddch(
+ int a1,
+ int a2,
+ const chtype z)
+ { return(*(int *)0); }
+
+#undef mvaddchnstr
+int mvaddchnstr(
+ int a1,
+ int a2,
+ const chtype *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvaddchstr
+int mvaddchstr(
+ int a1,
+ int a2,
+ const chtype *z)
+ { return(*(int *)0); }
+
+#undef mvaddnstr
+int mvaddnstr(
+ int a1,
+ int a2,
+ const char *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvaddstr
+int mvaddstr(
+ int a1,
+ int a2,
+ const char *z)
+ { return(*(int *)0); }
+
+#undef mvchgat
+int mvchgat(
+ int a1,
+ int a2,
+ int a3,
+ attr_t a4,
+ short a5,
+ const void *z)
+ { return(*(int *)0); }
+
+#undef mvdelch
+int mvdelch(
+ int a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvgetch
+int mvgetch(
+ int a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvgetnstr
+int mvgetnstr(
+ int a1,
+ int a2,
+ char *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvgetstr
+int mvgetstr(
+ int a1,
+ int a2,
+ char *z)
+ { return(*(int *)0); }
+
+#undef mvhline
+int mvhline(
+ int a1,
+ int a2,
+ chtype a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvinch
+chtype mvinch(
+ int a1,
+ int z)
+ { return(*(chtype *)0); }
+
+#undef mvinchnstr
+int mvinchnstr(
+ int a1,
+ int a2,
+ chtype *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvinchstr
+int mvinchstr(
+ int a1,
+ int a2,
+ chtype *z)
+ { return(*(int *)0); }
+
+#undef mvinnstr
+int mvinnstr(
+ int a1,
+ int a2,
+ char *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvinsch
+int mvinsch(
+ int a1,
+ int a2,
+ chtype z)
+ { return(*(int *)0); }
+
+#undef mvinsnstr
+int mvinsnstr(
+ int a1,
+ int a2,
+ const char *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvinsstr
+int mvinsstr(
+ int a1,
+ int a2,
+ const char *z)
+ { return(*(int *)0); }
+
+#undef mvinstr
+int mvinstr(
+ int a1,
+ int a2,
+ char *z)
+ { return(*(int *)0); }
+
+#undef mvvline
+int mvvline(
+ int a1,
+ int a2,
+ chtype a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwaddch
+int mvwaddch(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const chtype z)
+ { return(*(int *)0); }
+
+#undef mvwaddchnstr
+int mvwaddchnstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const chtype *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwaddchstr
+int mvwaddchstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const chtype *z)
+ { return(*(int *)0); }
+
+#undef mvwaddnstr
+int mvwaddnstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const char *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwaddstr
+int mvwaddstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const char *z)
+ { return(*(int *)0); }
+
+#undef mvwchgat
+int mvwchgat(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ int a4,
+ attr_t a5,
+ short a6,
+ const void *z)
+ { return(*(int *)0); }
+
+#undef mvwdelch
+int mvwdelch(
+ WINDOW *a1,
+ int a2,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwgetch
+int mvwgetch(
+ WINDOW *a1,
+ int a2,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwgetnstr
+int mvwgetnstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ char *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwgetstr
+int mvwgetstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ char *z)
+ { return(*(int *)0); }
+
+#undef mvwhline
+int mvwhline(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ chtype a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwinch
+chtype mvwinch(
+ WINDOW *a1,
+ int a2,
+ int z)
+ { return(*(chtype *)0); }
+
+#undef mvwinchnstr
+int mvwinchnstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ chtype *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwinchstr
+int mvwinchstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ chtype *z)
+ { return(*(int *)0); }
+
+#undef mvwinnstr
+int mvwinnstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ char *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwinsch
+int mvwinsch(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ chtype z)
+ { return(*(int *)0); }
+
+#undef mvwinsnstr
+int mvwinsnstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const char *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwinsstr
+int mvwinsstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const char *z)
+ { return(*(int *)0); }
+
+#undef mvwinstr
+int mvwinstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ char *z)
+ { return(*(int *)0); }
+
+#undef mvwvline
+int mvwvline(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ chtype a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef PAIR_NUMBER
+int PAIR_NUMBER(
+ int z)
+ { return(*(int *)0); }
+
+#undef redrawwin
+int redrawwin(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+#undef refresh
+int refresh(void)
+ { return(*(int *)0); }
+
+#undef scrl
+int scrl(
+ int z)
+ { return(*(int *)0); }
+
+#undef scroll
+int scroll(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+#undef setscrreg
+int setscrreg(
+ int a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef slk_attr_off
+int slk_attr_off(
+ const attr_t a1,
+ void *z)
+ { return(*(int *)0); }
+
+#undef slk_attr_on
+int slk_attr_on(
+ attr_t a1,
+ void *z)
+ { return(*(int *)0); }
+
+#undef standout
+int standout(void)
+ { return(*(int *)0); }
+
+#undef standend
+int standend(void)
+ { return(*(int *)0); }
+
+#undef timeout
+void timeout(
+ int z)
+ { /* void */ }
+
+#undef touchline
+int touchline(
+ WINDOW *a1,
+ int a2,
+ int z)
+ { return(*(int *)0); }
+
+#undef touchwin
+int touchwin(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+#undef untouchwin
+int untouchwin(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+#undef vline
+int vline(
+ chtype a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef vw_printw
+int vw_printw(
+ WINDOW *a1,
+ const char *a2,
+ va_list z)
+ { return(*(int *)0); }
+
+#undef vw_scanw
+int vw_scanw(
+ WINDOW *a1,
+ char *a2,
+ va_list z)
+ { return(*(int *)0); }
+
+#undef waddchstr
+int waddchstr(
+ WINDOW *a1,
+ const chtype *z)
+ { return(*(int *)0); }
+
+#undef waddstr
+int waddstr(
+ WINDOW *a1,
+ const char *z)
+ { return(*(int *)0); }
+
+#undef wattron
+int wattron(
+ WINDOW *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef wattroff
+int wattroff(
+ WINDOW *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef wattrset
+int wattrset(
+ WINDOW *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef wattr_get
+int wattr_get(
+ WINDOW *a1,
+ attr_t *a2,
+ short *a3,
+ void *z)
+ { return(*(int *)0); }
+
+#undef wattr_set
+int wattr_set(
+ WINDOW *a1,
+ attr_t a2,
+ short a3,
+ void *z)
+ { return(*(int *)0); }
+
+#undef wdeleteln
+int wdeleteln(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+#undef wgetstr
+int wgetstr(
+ WINDOW *a1,
+ char *z)
+ { return(*(int *)0); }
+
+#undef winchstr
+int winchstr(
+ WINDOW *a1,
+ chtype *z)
+ { return(*(int *)0); }
+
+#undef winsertln
+int winsertln(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+#undef winsstr
+int winsstr(
+ WINDOW *a1,
+ const char *z)
+ { return(*(int *)0); }
+
+#undef winstr
+int winstr(
+ WINDOW *a1,
+ char *z)
+ { return(*(int *)0); }
+
+#undef wstandout
+int wstandout(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+#undef wstandend
+int wstandend(
+ WINDOW *z)
+ { return(*(int *)0); }
+
+#undef getattrs
+int getattrs(
+ const WINDOW *z)
+ { return(*(int *)0); }
+
+#undef getcurx
+int getcurx(
+ const WINDOW *z)
+ { return(*(int *)0); }
+
+#undef getcury
+int getcury(
+ const WINDOW *z)
+ { return(*(int *)0); }
+
+#undef getbegx
+int getbegx(
+ const WINDOW *z)
+ { return(*(int *)0); }
+
+#undef getbegy
+int getbegy(
+ const WINDOW *z)
+ { return(*(int *)0); }
+
+#undef getmaxx
+int getmaxx(
+ const WINDOW *z)
+ { return(*(int *)0); }
+
+#undef getmaxy
+int getmaxy(
+ const WINDOW *z)
+ { return(*(int *)0); }
+
+#undef getparx
+int getparx(
+ const WINDOW *z)
+ { return(*(int *)0); }
+
+#undef getpary
+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_pad
+NCURSES_BOOL is_pad(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_scrollok
+NCURSES_BOOL is_scrollok(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_subwin
+NCURSES_BOOL is_subwin(
+ 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)
+ { return(*(int *)0); }
+
+#undef add_wchnstr
+int add_wchnstr(
+ const cchar_t *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef add_wchstr
+int add_wchstr(
+ const cchar_t *z)
+ { return(*(int *)0); }
+
+#undef addnwstr
+int addnwstr(
+ const wchar_t *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef addwstr
+int addwstr(
+ const wchar_t *z)
+ { return(*(int *)0); }
+
+#undef bkgrnd
+int bkgrnd(
+ const cchar_t *z)
+ { return(*(int *)0); }
+
+#undef bkgrndset
+void bkgrndset(
+ const cchar_t *z)
+ { /* void */ }
+
+#undef border_set
+int border_set(
+ const cchar_t *a1,
+ const cchar_t *a2,
+ const cchar_t *a3,
+ const cchar_t *a4,
+ const cchar_t *a5,
+ const cchar_t *a6,
+ const cchar_t *a7,
+ const cchar_t *z)
+ { return(*(int *)0); }
+
+#undef box_set
+int box_set(
+ WINDOW *a1,
+ const cchar_t *a2,
+ const cchar_t *z)
+ { return(*(int *)0); }
+
+#undef echo_wchar
+int echo_wchar(
+ const cchar_t *z)
+ { return(*(int *)0); }
+
+#undef get_wch
+int get_wch(
+ wint_t *z)
+ { return(*(int *)0); }
+
+#undef get_wstr
+int get_wstr(
+ wint_t *z)
+ { return(*(int *)0); }
+
+#undef getbkgrnd
+int getbkgrnd(
+ cchar_t *z)
+ { return(*(int *)0); }
+
+#undef getn_wstr
+int getn_wstr(
+ wint_t *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef hline_set
+int hline_set(
+ const cchar_t *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef in_wch
+int in_wch(
+ cchar_t *z)
+ { return(*(int *)0); }
+
+#undef in_wchnstr
+int in_wchnstr(
+ cchar_t *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef in_wchstr
+int in_wchstr(
+ cchar_t *z)
+ { return(*(int *)0); }
+
+#undef innwstr
+int innwstr(
+ wchar_t *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef ins_nwstr
+int ins_nwstr(
+ const wchar_t *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef ins_wch
+int ins_wch(
+ const cchar_t *z)
+ { return(*(int *)0); }
+
+#undef ins_wstr
+int ins_wstr(
+ const wchar_t *z)
+ { return(*(int *)0); }
+
+#undef inwstr
+int inwstr(
+ wchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvadd_wch
+int mvadd_wch(
+ int a1,
+ int a2,
+ const cchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvadd_wchnstr
+int mvadd_wchnstr(
+ int a1,
+ int a2,
+ const cchar_t *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvadd_wchstr
+int mvadd_wchstr(
+ int a1,
+ int a2,
+ const cchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvaddnwstr
+int mvaddnwstr(
+ int a1,
+ int a2,
+ const wchar_t *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvaddwstr
+int mvaddwstr(
+ int a1,
+ int a2,
+ const wchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvget_wch
+int mvget_wch(
+ int a1,
+ int a2,
+ wint_t *z)
+ { return(*(int *)0); }
+
+#undef mvget_wstr
+int mvget_wstr(
+ int a1,
+ int a2,
+ wint_t *z)
+ { return(*(int *)0); }
+
+#undef mvgetn_wstr
+int mvgetn_wstr(
+ int a1,
+ int a2,
+ wint_t *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvhline_set
+int mvhline_set(
+ int a1,
+ int a2,
+ const cchar_t *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvin_wch
+int mvin_wch(
+ int a1,
+ int a2,
+ cchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvin_wchnstr
+int mvin_wchnstr(
+ int a1,
+ int a2,
+ cchar_t *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvin_wchstr
+int mvin_wchstr(
+ int a1,
+ int a2,
+ cchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvinnwstr
+int mvinnwstr(
+ int a1,
+ int a2,
+ wchar_t *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvins_nwstr
+int mvins_nwstr(
+ int a1,
+ int a2,
+ const wchar_t *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvins_wch
+int mvins_wch(
+ int a1,
+ int a2,
+ const cchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvins_wstr
+int mvins_wstr(
+ int a1,
+ int a2,
+ const wchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvinwstr
+int mvinwstr(
+ int a1,
+ int a2,
+ wchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvvline_set
+int mvvline_set(
+ int a1,
+ int a2,
+ const cchar_t *a3,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwadd_wch
+int mvwadd_wch(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const cchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvwadd_wchnstr
+int mvwadd_wchnstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const cchar_t *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwadd_wchstr
+int mvwadd_wchstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const cchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvwaddnwstr
+int mvwaddnwstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const wchar_t *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwaddwstr
+int mvwaddwstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const wchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvwget_wch
+int mvwget_wch(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ wint_t *z)
+ { return(*(int *)0); }
+
+#undef mvwget_wstr
+int mvwget_wstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ wint_t *z)
+ { return(*(int *)0); }
+
+#undef mvwgetn_wstr
+int mvwgetn_wstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ wint_t *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwhline_set
+int mvwhline_set(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const cchar_t *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwin_wch
+int mvwin_wch(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ cchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvwin_wchnstr
+int mvwin_wchnstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ cchar_t *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwin_wchstr
+int mvwin_wchstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ cchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvwinnwstr
+int mvwinnwstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ wchar_t *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwins_nwstr
+int mvwins_nwstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const wchar_t *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef mvwins_wch
+int mvwins_wch(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const cchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvwins_wstr
+int mvwins_wstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const wchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvwinwstr
+int mvwinwstr(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ wchar_t *z)
+ { return(*(int *)0); }
+
+#undef mvwvline_set
+int mvwvline_set(
+ WINDOW *a1,
+ int a2,
+ int a3,
+ const cchar_t *a4,
+ int z)
+ { return(*(int *)0); }
+
+#undef vline_set
+int vline_set(
+ const cchar_t *a1,
+ int z)
+ { return(*(int *)0); }
+
+#undef wadd_wchstr
+int wadd_wchstr(
+ WINDOW *a1,
+ const cchar_t *z)
+ { return(*(int *)0); }
+
+#undef waddwstr
+int waddwstr(
+ WINDOW *a1,
+ const wchar_t *z)
+ { return(*(int *)0); }
+
+#undef wget_wstr
+int wget_wstr(
+ WINDOW *a1,
+ wint_t *z)
+ { return(*(int *)0); }
+
+#undef wgetbkgrnd
+int wgetbkgrnd(
+ WINDOW *a1,
+ cchar_t *z)
+ { return(*(int *)0); }
+
+#undef win_wchstr
+int win_wchstr(
+ WINDOW *a1,
+ cchar_t *z)
+ { return(*(int *)0); }
+
+#undef wins_wstr
+int wins_wstr(
+ WINDOW *a1,
+ const wchar_t *z)
+ { return(*(int *)0); }
+
+#undef mouse_trafo
+NCURSES_BOOL mouse_trafo(
+ int *a1,
+ int *a2,
+ NCURSES_BOOL z)
+ { return(*(NCURSES_BOOL *)0); }
+
+/* ./base/lib_getch.c */
+
+#include <fifo_defs.h>
+
+#undef _nc_ESCDELAY
+int _nc_ESCDELAY(void)
+ { return(*(int *)0); }
+
+#undef _nc_ptr_Escdelay
+int *_nc_ptr_Escdelay(
+ SCREEN *sp)
+ { return(*(int **)0); }
+
+#undef set_escdelay_sp
+int set_escdelay_sp(
+ SCREEN *sp,
+ int value)
+ { return(*(int *)0); }
+
+#undef set_escdelay
+int set_escdelay(
+ int value)
+ { return(*(int *)0); }
+
+#undef get_escdelay_sp
+int get_escdelay_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef get_escdelay
+int get_escdelay(void)
+ { return(*(int *)0); }
+
+#undef _nc_wgetch
+int _nc_wgetch(
+ WINDOW *win,
+ int *result,
+ int use_meta)
+ { return(*(int *)0); }
+
+#undef wgetch
+int wgetch(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./base/lib_getstr.c */
+
+#undef wgetnstr
+int wgetnstr(
+ WINDOW *win,
+ char *str,
+ int maxlen)
+ { return(*(int *)0); }
+
+/* ./base/lib_hline.c */
+
+#undef whline
+int whline(
+ WINDOW *win,
+ chtype ch,
+ int n)
+ { return(*(int *)0); }
+
+/* ./base/lib_immedok.c */
+
+#undef immedok
+void immedok(
+ WINDOW *win,
+ NCURSES_BOOL flag)
+ { /* void */ }
+
+/* ./base/lib_inchstr.c */
+
+#undef winchnstr
+int winchnstr(
+ WINDOW *win,
+ chtype *str,
+ int n)
+ { return(*(int *)0); }
+
+/* ./base/lib_initscr.c */
+
+#undef initscr
+WINDOW *initscr(void)
+ { return(*(WINDOW **)0); }
+
+/* ./base/lib_insch.c */
+
+#undef _nc_insert_ch
+int _nc_insert_ch(
+ SCREEN *sp,
+ WINDOW *win,
+ chtype ch)
+ { return(*(int *)0); }
+
+#undef winsch
+int winsch(
+ WINDOW *win,
+ chtype c)
+ { return(*(int *)0); }
+
+/* ./base/lib_insdel.c */
+
+#undef winsdelln
+int winsdelln(
+ WINDOW *win,
+ int n)
+ { return(*(int *)0); }
+
+/* ./base/lib_insnstr.c */
+
+#undef winsnstr
+int winsnstr(
+ WINDOW *win,
+ const char *s,
+ int n)
+ { return(*(int *)0); }
+
+/* ./base/lib_instr.c */
+
+#undef winnstr
+int winnstr(
+ WINDOW *win,
+ char *str,
+ int n)
+ { return(*(int *)0); }
+
+/* ./base/lib_isendwin.c */
+
+#undef isendwin_sp
+NCURSES_BOOL isendwin_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef isendwin
+NCURSES_BOOL isendwin(void)
+ { return(*(NCURSES_BOOL *)0); }
+
+/* ./base/lib_leaveok.c */
+
+#undef leaveok
+int leaveok(
+ WINDOW *win,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
+/* ./base/lib_mouse.c */
+
+#undef getmouse_sp
+int getmouse_sp(
+ SCREEN *sp,
+ MEVENT *aevent)
+ { return(*(int *)0); }
+
+#undef getmouse
+int getmouse(
+ MEVENT *aevent)
+ { return(*(int *)0); }
+
+#undef ungetmouse_sp
+int ungetmouse_sp(
+ SCREEN *sp,
+ MEVENT *aevent)
+ { return(*(int *)0); }
+
+#undef ungetmouse
+int ungetmouse(
+ MEVENT *aevent)
+ { return(*(int *)0); }
+
+#undef mousemask_sp
+mmask_t mousemask_sp(
+ SCREEN *sp,
+ mmask_t newmask,
+ mmask_t *oldmask)
+ { return(*(mmask_t *)0); }
+
+#undef mousemask
+mmask_t mousemask(
+ mmask_t newmask,
+ mmask_t *oldmask)
+ { return(*(mmask_t *)0); }
+
+#undef wenclose
+NCURSES_BOOL wenclose(
+ const WINDOW *win,
+ int y,
+ int x)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef mouseinterval_sp
+int mouseinterval_sp(
+ SCREEN *sp,
+ int maxclick)
+ { return(*(int *)0); }
+
+#undef mouseinterval
+int mouseinterval(
+ int maxclick)
+ { return(*(int *)0); }
+
+#undef _nc_has_mouse
+NCURSES_BOOL _nc_has_mouse(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef has_mouse_sp
+NCURSES_BOOL has_mouse_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef has_mouse
+NCURSES_BOOL has_mouse(void)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef wmouse_trafo
+NCURSES_BOOL wmouse_trafo(
+ const WINDOW *win,
+ int *pY,
+ int *pX,
+ NCURSES_BOOL to_screen)
+ { return(*(NCURSES_BOOL *)0); }
+
+/* ./base/lib_move.c */
+
+#undef wmove
+int wmove(
+ WINDOW *win,
+ int y,
+ int x)
+ { return(*(int *)0); }
+
+/* ./tty/lib_mvcur.c */
+
+#undef _nc_msec_cost_sp
+int _nc_msec_cost_sp(
+ SCREEN *sp,
+ const char *const cap,
+ int affcnt)
+ { return(*(int *)0); }
+
+#undef _nc_msec_cost
+int _nc_msec_cost(
+ const char *const cap,
+ int affcnt)
+ { return(*(int *)0); }
+
+#undef _nc_mvcur_resume_sp
+void _nc_mvcur_resume_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_mvcur_resume
+void _nc_mvcur_resume(void)
+ { /* void */ }
+
+#undef _nc_mvcur_init_sp
+void _nc_mvcur_init_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_mvcur_init
+void _nc_mvcur_init(void)
+ { /* void */ }
+
+#undef _nc_mvcur_wrap_sp
+void _nc_mvcur_wrap_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_mvcur_wrap
+void _nc_mvcur_wrap(void)
+ { /* void */ }
+
+#undef mvcur_sp
+int mvcur_sp(
+ SCREEN *sp,
+ int yold,
+ int xold,
+ int ynew,
+ int xnew)
+ { return(*(int *)0); }
+
+#undef mvcur
+int mvcur(
+ int yold,
+ int xold,
+ int ynew,
+ int xnew)
+ { return(*(int *)0); }
+
+#undef _nc_optimize_enable
+int _nc_optimize_enable;
+
+/* ./base/lib_mvwin.c */
+
+#undef mvwin
+int mvwin(
+ WINDOW *win,
+ int by,
+ int bx)
+ { return(*(int *)0); }
+
+/* ./base/lib_newterm.c */
+
+#undef filter_sp
+void filter_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef filter
+void filter(void)
+ { /* void */ }
+
+#undef nofilter_sp
+void nofilter_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef nofilter
+void nofilter(void)
+ { /* void */ }
+
+#undef newterm_sp
+SCREEN *newterm_sp(
+ SCREEN *sp,
+ char *name,
+ FILE *ofp,
+ FILE *ifp)
+ { return(*(SCREEN **)0); }
+
+#undef newterm
+SCREEN *newterm(
+ char *name,
+ FILE *ofp,
+ FILE *ifp)
+ { return(*(SCREEN **)0); }
+
+/* ./base/lib_newwin.c */
+
+#undef _nc_freewin
+int _nc_freewin(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+#undef newwin_sp
+WINDOW *newwin_sp(
+ SCREEN *sp,
+ int num_lines,
+ int num_columns,
+ int begy,
+ int begx)
+ { return(*(WINDOW **)0); }
+
+#undef newwin
+WINDOW *newwin(
+ int num_lines,
+ int num_columns,
+ int begy,
+ int begx)
+ { return(*(WINDOW **)0); }
+
+#undef derwin
+WINDOW *derwin(
+ WINDOW *orig,
+ int num_lines,
+ int num_columns,
+ int begy,
+ int begx)
+ { return(*(WINDOW **)0); }
+
+#undef subwin
+WINDOW *subwin(
+ WINDOW *w,
+ int l,
+ int c,
+ int y,
+ int x)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_makenew_sp
+WINDOW *_nc_makenew_sp(
+ SCREEN *sp,
+ int num_lines,
+ int num_columns,
+ int begy,
+ int begx,
+ int flags)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_curscr_of
+WINDOW *_nc_curscr_of(
+ SCREEN *sp)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_newscr_of
+WINDOW *_nc_newscr_of(
+ SCREEN *sp)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_stdscr_of
+WINDOW *_nc_stdscr_of(
+ SCREEN *sp)
+ { return(*(WINDOW **)0); }
+
+/* ./base/lib_nl.c */
+
+#undef nl_sp
+int nl_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef nl
+int nl(void)
+ { return(*(int *)0); }
+
+#undef nonl_sp
+int nonl_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef nonl
+int nonl(void)
+ { return(*(int *)0); }
+
+/* ./base/lib_overlay.c */
+
+#undef overlay
+int overlay(
+ const WINDOW *win1,
+ WINDOW *win2)
+ { return(*(int *)0); }
+
+#undef overwrite
+int overwrite(
+ const WINDOW *win1,
+ WINDOW *win2)
+ { return(*(int *)0); }
+
+#undef copywin
+int copywin(
+ const WINDOW *src,
+ WINDOW *dst,
+ int sminrow,
+ int smincol,
+ int dminrow,
+ int dmincol,
+ int dmaxrow,
+ int dmaxcol,
+ int over)
+ { return(*(int *)0); }
+
+/* ./base/lib_pad.c */
+
+#undef newpad_sp
+WINDOW *newpad_sp(
+ SCREEN *sp,
+ int l,
+ int c)
+ { return(*(WINDOW **)0); }
+
+#undef newpad
+WINDOW *newpad(
+ int l,
+ int c)
+ { return(*(WINDOW **)0); }
+
+#undef subpad
+WINDOW *subpad(
+ WINDOW *orig,
+ int l,
+ int c,
+ int begy,
+ int begx)
+ { return(*(WINDOW **)0); }
+
+#undef prefresh
+int prefresh(
+ WINDOW *win,
+ int pminrow,
+ int pmincol,
+ int sminrow,
+ int smincol,
+ int smaxrow,
+ int smaxcol)
+ { return(*(int *)0); }
+
+#undef pnoutrefresh
+int pnoutrefresh(
+ WINDOW *win,
+ int pminrow,
+ int pmincol,
+ int sminrow,
+ int smincol,
+ int smaxrow,
+ int smaxcol)
+ { return(*(int *)0); }
+
+#undef pechochar
+int pechochar(
+ WINDOW *pad,
+ const chtype ch)
+ { return(*(int *)0); }
+
+/* ./base/lib_printw.c */
+
+#undef printw
+int printw(
+ const char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+#undef wprintw
+int wprintw(
+ WINDOW *win,
+ const char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+#undef mvprintw
+int mvprintw(
+ int y,
+ int x,
+ const char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+#undef mvwprintw
+int mvwprintw(
+ WINDOW *win,
+ int y,
+ int x,
+ const char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+#undef vwprintw
+int vwprintw(
+ WINDOW *win,
+ const char *fmt,
+ va_list argp)
+ { return(*(int *)0); }
+
+/* ./base/lib_redrawln.c */
+
+#undef wredrawln
+int wredrawln(
+ WINDOW *win,
+ int beg,
+ int num)
+ { return(*(int *)0); }
+
+/* ./base/lib_refresh.c */
+
+#undef wrefresh
+int wrefresh(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+#undef wnoutrefresh
+int wnoutrefresh(
+ WINDOW *win)
+ { return(*(int *)0); }
+
+/* ./base/lib_restart.c */
+
+#undef restartterm_sp
+int restartterm_sp(
+ SCREEN *sp,
+ char *termp,
+ int filenum,
+ int *errret)
+ { return(*(int *)0); }
+
+#undef restartterm
+int restartterm(
+ char *termp,
+ int filenum,
+ int *errret)
+ { return(*(int *)0); }
+
+/* ./base/lib_scanw.c */
+
+#undef vwscanw
+int vwscanw(
+ WINDOW *win,
+ char *fmt,
+ va_list argp)
+ { return(*(int *)0); }
+
+#undef scanw
+int scanw(
+ char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+#undef wscanw
+int wscanw(
+ WINDOW *win,
+ char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+#undef mvscanw
+int mvscanw(
+ int y,
+ int x,
+ char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+#undef mvwscanw
+int mvwscanw(
+ WINDOW *win,
+ int y,
+ int x,
+ char *fmt,
+ ...)
+ { return(*(int *)0); }
+
+/* ./base/lib_screen.c */
+
+#undef getwin_sp
+WINDOW *getwin_sp(
+ SCREEN *sp,
+ FILE *filep)
+ { return(*(WINDOW **)0); }
+
+#undef getwin
+WINDOW *getwin(
+ FILE *filep)
+ { return(*(WINDOW **)0); }
+
+#undef putwin
+int putwin(
+ WINDOW *win,
+ FILE *filep)
+ { return(*(int *)0); }
+
+#undef scr_restore_sp
+int scr_restore_sp(
+ SCREEN *sp,
+ const char *file)
+ { return(*(int *)0); }
+
+#undef scr_restore
+int scr_restore(
+ const char *file)
+ { return(*(int *)0); }
+
+#undef scr_dump
+int scr_dump(
+ const char *file)
+ { return(*(int *)0); }
+
+#undef scr_init_sp
+int scr_init_sp(
+ SCREEN *sp,
+ const char *file)
+ { return(*(int *)0); }
+
+#undef scr_init
+int scr_init(
+ const char *file)
+ { return(*(int *)0); }
+
+#undef scr_set_sp
+int scr_set_sp(
+ SCREEN *sp,
+ const char *file)
+ { return(*(int *)0); }
+
+#undef scr_set
+int scr_set(
+ const char *file)
+ { return(*(int *)0); }
+
+/* ./base/lib_scroll.c */
+
+#undef _nc_scroll_window
+void _nc_scroll_window(
+ WINDOW *win,
+ int const n,
+ int const top,
+ int const bottom,
+ cchar_t blank)
+ { /* void */ }
+
+#undef wscrl
+int wscrl(
+ WINDOW *win,
+ int n)
+ { return(*(int *)0); }
+
+/* ./base/lib_scrollok.c */
+
+#undef scrollok
+int scrollok(
+ WINDOW *win,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
+/* ./base/lib_scrreg.c */
+
+#undef wsetscrreg
+int wsetscrreg(
+ WINDOW *win,
+ int top,
+ int bottom)
+ { return(*(int *)0); }
+
+/* ./base/lib_set_term.c */
+
+#undef set_term
+SCREEN *set_term(
+ SCREEN *screenp)
+ { return(*(SCREEN **)0); }
+
+#undef delscreen
+void delscreen(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_setupscreen_sp
+int _nc_setupscreen_sp(
+ SCREEN **spp,
+ int slines,
+ int scolumns,
+ FILE *output,
+ NCURSES_BOOL filtered,
+ int slk_format)
+ { return(*(int *)0); }
+
+#undef _nc_setupscreen
+int _nc_setupscreen(
+ int slines,
+ int scolumns,
+ FILE *output,
+ NCURSES_BOOL filtered,
+ int slk_format)
+ { return(*(int *)0); }
+
+#undef _nc_ripoffline_sp
+int _nc_ripoffline_sp(
+ SCREEN *sp,
+ int line,
+ int (*init)(
+ WINDOW *p1,
+ int p2))
+ { return(*(int *)0); }
+
+#undef _nc_ripoffline
+int _nc_ripoffline(
+ int line,
+ int (*init)(
+ WINDOW *p1,
+ int p2))
+ { return(*(int *)0); }
+
+#undef ripoffline_sp
+int ripoffline_sp(
+ SCREEN *sp,
+ int line,
+ int (*init)(
+ WINDOW *p1,
+ int p2))
+ { return(*(int *)0); }
+
+#undef ripoffline
+int ripoffline(
+ int line,
+ int (*init)(
+ WINDOW *p1,
+ int p2))
+ { return(*(int *)0); }
+
+/* ./base/lib_slk.c */
+
+#undef _nc_format_slks
+int _nc_format_slks(
+ SCREEN *sp,
+ int cols)
+ { return(*(int *)0); }
+
+#undef _nc_slk_initialize
+int _nc_slk_initialize(
+ WINDOW *stwin,
+ int cols)
+ { return(*(int *)0); }
+
+#undef slk_restore_sp
+int slk_restore_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef slk_restore
+int slk_restore(void)
+ { return(*(int *)0); }
+
+/* ./base/lib_slkatr_set.c */
+
+#undef slk_attr_set_sp
+int slk_attr_set_sp(
+ SCREEN *sp,
+ const attr_t attr,
+ short color_pair_number,
+ void *opts)
+ { return(*(int *)0); }
+
+#undef slk_attr_set
+int slk_attr_set(
+ const attr_t attr,
+ short color_pair_number,
+ void *opts)
+ { return(*(int *)0); }
+
+/* ./base/lib_slkatrof.c */
+
+#undef slk_attroff_sp
+int slk_attroff_sp(
+ SCREEN *sp,
+ const chtype attr)
+ { return(*(int *)0); }
+
+#undef slk_attroff
+int slk_attroff(
+ const chtype attr)
+ { return(*(int *)0); }
+
+/* ./base/lib_slkatron.c */
+
+#undef slk_attron_sp
+int slk_attron_sp(
+ SCREEN *sp,
+ const chtype attr)
+ { return(*(int *)0); }
+
+#undef slk_attron
+int slk_attron(
+ const chtype attr)
+ { return(*(int *)0); }
+
+/* ./base/lib_slkatrset.c */
+
+#undef slk_attrset_sp
+int slk_attrset_sp(
+ SCREEN *sp,
+ const chtype attr)
+ { return(*(int *)0); }
+
+#undef slk_attrset
+int slk_attrset(
+ const chtype attr)
+ { return(*(int *)0); }
+
+/* ./base/lib_slkattr.c */
+
+#undef slk_attr_sp
+attr_t slk_attr_sp(
+ SCREEN *sp)
+ { return(*(attr_t *)0); }
+
+#undef slk_attr
+attr_t slk_attr(void)
+ { return(*(attr_t *)0); }
+
+/* ./base/lib_slkclear.c */
+
+#undef slk_clear_sp
+int slk_clear_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef slk_clear
+int slk_clear(void)
+ { return(*(int *)0); }
+
+/* ./base/lib_slkcolor.c */
+
+#undef slk_color_sp
+int slk_color_sp(
+ SCREEN *sp,
+ short color_pair_number)
+ { return(*(int *)0); }
+
+#undef slk_color
+int slk_color(
+ short color_pair_number)
+ { return(*(int *)0); }
+
+/* ./base/lib_slkinit.c */
+
+#undef slk_init_sp
+int slk_init_sp(
+ SCREEN *sp,
+ int format)
+ { return(*(int *)0); }
+
+#undef slk_init
+int slk_init(
+ int format)
+ { return(*(int *)0); }
+
+/* ./base/lib_slklab.c */
+
+#undef slk_label_sp
+char *slk_label_sp(
+ SCREEN *sp,
+ int n)
+ { return(*(char **)0); }
+
+#undef slk_label
+char *slk_label(
+ int n)
+ { return(*(char **)0); }
+
+/* ./base/lib_slkrefr.c */
+
+#undef slk_noutrefresh_sp
+int slk_noutrefresh_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef slk_noutrefresh
+int slk_noutrefresh(void)
+ { return(*(int *)0); }
+
+#undef slk_refresh_sp
+int slk_refresh_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef slk_refresh
+int slk_refresh(void)
+ { return(*(int *)0); }
+
+/* ./base/lib_slkset.c */
+
+#include <wctype.h>
+
+#undef slk_set_sp
+int slk_set_sp(
+ SCREEN *sp,
+ int i,
+ const char *astr,
+ int format)
+ { return(*(int *)0); }
+
+#undef slk_set
+int slk_set(
+ int i,
+ const char *astr,
+ int format)
+ { return(*(int *)0); }
+
+/* ./base/lib_slktouch.c */
+
+#undef slk_touch_sp
+int slk_touch_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef slk_touch
+int slk_touch(void)
+ { return(*(int *)0); }
+
+/* ./base/lib_touch.c */
+
+#undef is_linetouched
+NCURSES_BOOL is_linetouched(
+ WINDOW *win,
+ int line)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_wintouched
+NCURSES_BOOL is_wintouched(
+ WINDOW *win)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef wtouchln
+int wtouchln(
+ WINDOW *win,
+ int y,
+ int n,
+ int changed)
+ { return(*(int *)0); }
+
+/* ./trace/lib_tracedmp.c */
+
+#undef _tracedump
+void _tracedump(
+ const char *name,
+ WINDOW *win)
+ { /* void */ }
+
+/* ./trace/lib_tracemse.c */
+
+#undef _nc_tracemouse
+char *_nc_tracemouse(
+ SCREEN *sp,
+ MEVENT const *ep)
+ { return(*(char **)0); }
+
+#undef _nc_retrace_mmask_t
+mmask_t _nc_retrace_mmask_t(
+ SCREEN *sp,
+ mmask_t code)
+ { return(*(mmask_t *)0); }
+
+#undef _tracemouse
+char *_tracemouse(
+ MEVENT const *ep)
+ { return(*(char **)0); }
+
+/* ./tty/lib_tstp.c */
+
+#include <SigAction.h>
+
+#undef _nc_signal_handler
+void _nc_signal_handler(
+ NCURSES_BOOL enable)
+ { /* void */ }
+
+/* ./base/lib_ungetch.c */
+
+#undef _nc_fifo_dump
+void _nc_fifo_dump(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef ungetch_sp
+int ungetch_sp(
+ SCREEN *sp,
+ int ch)
+ { return(*(int *)0); }
+
+#undef ungetch
+int ungetch(
+ int ch)
+ { return(*(int *)0); }
+
+/* ./tty/lib_vidattr.c */
+
+#undef vidputs_sp
+int vidputs_sp(
+ SCREEN *sp,
+ chtype newmode,
+ NCURSES_OUTC_sp outc)
+ { return(*(int *)0); }
+
+#undef vidputs
+int vidputs(
+ chtype newmode,
+ NCURSES_OUTC outc)
+ { return(*(int *)0); }
+
+#undef vidattr_sp
+int vidattr_sp(
+ SCREEN *sp,
+ chtype newmode)
+ { return(*(int *)0); }
+
+#undef vidattr
+int vidattr(
+ chtype newmode)
+ { return(*(int *)0); }
+
+#undef termattrs_sp
+chtype termattrs_sp(
+ SCREEN *sp)
+ { return(*(chtype *)0); }
+
+#undef termattrs
+chtype termattrs(void)
+ { return(*(chtype *)0); }
+
+/* ./base/lib_vline.c */
+
+#undef wvline
+int wvline(
+ WINDOW *win,
+ chtype ch,
+ int n)
+ { return(*(int *)0); }
+
+/* ./base/lib_wattroff.c */
+
+#undef wattr_off
+int wattr_off(
+ WINDOW *win,
+ attr_t at,
+ void *opts)
+ { return(*(int *)0); }
+
+/* ./base/lib_wattron.c */
+
+#undef wattr_on
+int wattr_on(
+ WINDOW *win,
+ attr_t at,
+ void *opts)
+ { return(*(int *)0); }
+
+/* ./base/lib_winch.c */
+
+#undef winch
+chtype winch(
+ WINDOW *win)
+ { return(*(chtype *)0); }
+
+/* ./base/lib_window.c */
+
+#undef _nc_synchook
+void _nc_synchook(
+ WINDOW *win)
+ { /* void */ }
+
+#undef mvderwin
+int mvderwin(
+ WINDOW *win,
+ int y,
+ int x)
+ { return(*(int *)0); }
+
+#undef syncok
+int syncok(
+ WINDOW *win,
+ NCURSES_BOOL bf)
+ { return(*(int *)0); }
+
+#undef wsyncup
+void wsyncup(
+ WINDOW *win)
+ { /* void */ }
+
+#undef wsyncdown
+void wsyncdown(
+ WINDOW *win)
+ { /* void */ }
+
+#undef wcursyncup
+void wcursyncup(
+ WINDOW *win)
+ { /* void */ }
+
+#undef dupwin
+WINDOW *dupwin(
+ WINDOW *win)
+ { return(*(WINDOW **)0); }
+
+/* ./base/nc_panel.c */
+
+#undef _nc_panelhook_sp
+struct panelhook *_nc_panelhook_sp(
+ SCREEN *sp)
+ { return(*(struct panelhook **)0); }
+
+#undef _nc_panelhook
+struct panelhook *_nc_panelhook(void)
+ { return(*(struct panelhook **)0); }
+
+/* ./base/safe_sprintf.c */
+
+#undef _nc_printf_string_sp
+char *_nc_printf_string_sp(
+ SCREEN *sp,
+ const char *fmt,
+ va_list ap)
+ { return(*(char **)0); }
+
+#undef _nc_printf_string
+char *_nc_printf_string(
+ const char *fmt,
+ va_list ap)
+ { return(*(char **)0); }
+
+/* ./tty/tty_update.c */
+
+#include <sys/time.h>
+#include <sys/times.h>
+
+#undef doupdate_sp
+int doupdate_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef doupdate
+int doupdate(void)
+ { return(*(int *)0); }
+
+#undef _nc_scrolln_sp
+int _nc_scrolln_sp(
+ SCREEN *sp,
+ int n,
+ int top,
+ int bot,
+ int maxy)
+ { return(*(int *)0); }
+
+#undef _nc_scrolln
+int _nc_scrolln(
+ int n,
+ int top,
+ int bot,
+ int maxy)
+ { return(*(int *)0); }
+
+#undef _nc_screen_resume_sp
+void _nc_screen_resume_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_screen_resume
+void _nc_screen_resume(void)
+ { /* void */ }
+
+#undef _nc_screen_init_sp
+void _nc_screen_init_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_screen_init
+void _nc_screen_init(void)
+ { /* void */ }
+
+#undef _nc_screen_wrap_sp
+void _nc_screen_wrap_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_screen_wrap
+void _nc_screen_wrap(void)
+ { /* void */ }
+
+#undef _nc_do_xmc_glitch_sp
+void _nc_do_xmc_glitch_sp(
+ SCREEN *sp,
+ attr_t previous)
+ { /* void */ }
+
+#undef _nc_do_xmc_glitch
+void _nc_do_xmc_glitch(
+ attr_t previous)
+ { /* void */ }
+
+/* ./trace/varargs.c */
+
+typedef enum {
+ atUnknown = 0, atInteger, atFloat, atPoint, atString
+} ARGTYPE;
+
+#undef _nc_varargs
+char *_nc_varargs(
+ const char *fmt,
+ va_list ap)
+ { return(*(char **)0); }
+
+/* ./base/memmove.c */
+
+#undef _nc_memmove
+void _nc_memmove(void)
+ { /* void */ }
+
+/* ./base/vsscanf.c */
+
+#undef _nc_vsscanf
+void _nc_vsscanf(void)
+ { /* void */ }
+
+/* ./base/lib_freeall.c */
+
+#undef _nc_freeall
+void _nc_freeall(void)
+ { /* void */ }
+
+#undef _nc_free_and_exit_sp
+void _nc_free_and_exit_sp(
+ SCREEN *sp,
+ int code)
+ { /* void */ }
+
+#undef _nc_free_and_exit
+void _nc_free_and_exit(
+ int code)
+ { /* void */ }
+
+/* ./widechar/charable.c */
+
+#undef _nc_is_charable
+NCURSES_BOOL _nc_is_charable(
+ wchar_t ch)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_to_char
+int _nc_to_char(
+ wint_t ch)
+ { return(*(int *)0); }
+
+#undef _nc_to_widechar
+wint_t _nc_to_widechar(
+ int ch)
+ { return(*(wint_t *)0); }
+
+/* ./widechar/lib_add_wch.c */
+
+#undef wadd_wch
+int wadd_wch(
+ WINDOW *win,
+ const cchar_t *wch)
+ { return(*(int *)0); }
+
+#undef wecho_wchar
+int wecho_wchar(
+ WINDOW *win,
+ const cchar_t *wch)
+ { return(*(int *)0); }
+
+/* ./widechar/lib_box_set.c */
+
+#undef wborder_set
+int wborder_set(
+ WINDOW *win,
+ const cchar_t *ls,
+ const cchar_t *rs,
+ const cchar_t *ts,
+ const cchar_t *bs,
+ const cchar_t *tl,
+ const cchar_t *tr,
+ const cchar_t *bl,
+ const cchar_t *br)
+ { return(*(int *)0); }
+
+/* ./widechar/lib_cchar.c */
+
+#undef setcchar
+int setcchar(
+ cchar_t *wcval,
+ const wchar_t *wch,
+ const attr_t attrs,
+ short color_pair,
+ const void *opts)
+ { return(*(int *)0); }
+
+#undef getcchar
+int getcchar(
+ const cchar_t *wcval,
+ wchar_t *wch,
+ attr_t *attrs,
+ short *color_pair,
+ void *opts)
+ { return(*(int *)0); }
+
+/* ./widechar/lib_erasewchar.c */
+
+#undef erasewchar
+int erasewchar(
+ wchar_t *wch)
+ { return(*(int *)0); }
+
+#undef killwchar
+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
+int wgetn_wstr(
+ WINDOW *win,
+ wint_t *str,
+ int maxlen)
+ { return(*(int *)0); }
+
+/* ./widechar/lib_hline_set.c */
+
+#undef whline_set
+int whline_set(
+ WINDOW *win,
+ const cchar_t *ch,
+ int n)
+ { return(*(int *)0); }
+
+/* ./widechar/lib_in_wch.c */
+
+#undef win_wch
+int win_wch(
+ WINDOW *win,
+ cchar_t *wcval)
+ { return(*(int *)0); }
+
+/* ./widechar/lib_in_wchnstr.c */
+
+#undef win_wchnstr
+int win_wchnstr(
+ WINDOW *win,
+ cchar_t *wchstr,
+ int n)
+ { return(*(int *)0); }
+
+/* ./widechar/lib_ins_wch.c */
+
+#undef _nc_insert_wch
+int _nc_insert_wch(
+ WINDOW *win,
+ const cchar_t *wch)
+ { return(*(int *)0); }
+
+#undef wins_wch
+int wins_wch(
+ WINDOW *win,
+ const cchar_t *wch)
+ { return(*(int *)0); }
+
+#undef wins_nwstr
+int wins_nwstr(
+ WINDOW *win,
+ const wchar_t *wstr,
+ int n)
+ { return(*(int *)0); }
+
+/* ./widechar/lib_inwstr.c */
+
+#undef winnwstr
+int winnwstr(
+ WINDOW *win,
+ wchar_t *wstr,
+ int n)
+ { return(*(int *)0); }
+
+#undef winwstr
+int winwstr(
+ WINDOW *win,
+ 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
+int pecho_wchar(
+ WINDOW *pad,
+ const cchar_t *wch)
+ { return(*(int *)0); }
+
+/* ./widechar/lib_slk_wset.c */
+
+#undef slk_wset
+int slk_wset(
+ int i,
+ const wchar_t *astr,
+ int format)
+ { return(*(int *)0); }
+
+/* ./widechar/lib_unget_wch.c */
+
+#undef _nc_wcrtomb
+size_t _nc_wcrtomb(
+ char *target,
+ wchar_t source,
+ mbstate_t *state)
+ { return(*(size_t *)0); }
+
+#undef unget_wch_sp
+int unget_wch_sp(
+ SCREEN *sp,
+ const wchar_t wch)
+ { return(*(int *)0); }
+
+#undef unget_wch
+int unget_wch(
+ const wchar_t wch)
+ { return(*(int *)0); }
+
+/* ./widechar/lib_vid_attr.c */
+
+#undef vid_puts_sp
+int vid_puts_sp(
+ SCREEN *sp,
+ attr_t newmode,
+ short pair,
+ void *opts,
+ NCURSES_OUTC_sp outc)
+ { return(*(int *)0); }
+
+#undef vid_puts
+int vid_puts(
+ attr_t newmode,
+ short pair,
+ void *opts,
+ NCURSES_OUTC outc)
+ { return(*(int *)0); }
+
+#undef vid_attr_sp
+int vid_attr_sp(
+ SCREEN *sp,
+ attr_t newmode,
+ short pair,
+ void *opts)
+ { return(*(int *)0); }
+
+#undef vid_attr
+int vid_attr(
+ attr_t newmode,
+ short pair,
+ void *opts)
+ { return(*(int *)0); }
+
+#undef term_attrs_sp
+attr_t term_attrs_sp(
+ SCREEN *sp)
+ { return(*(attr_t *)0); }
+
+#undef term_attrs
+attr_t term_attrs(void)
+ { return(*(attr_t *)0); }
+
+/* ./widechar/lib_vline_set.c */
+
+#undef wvline_set
+int wvline_set(
+ WINDOW *win,
+ const cchar_t *ch,
+ int n)
+ { return(*(int *)0); }
+
+/* ./widechar/lib_wacs.c */
+
+#undef _nc_wacs
+cchar_t *_nc_wacs;
+
+#undef _nc_init_wacs
+void _nc_init_wacs(void)
+ { /* void */ }
+
+/* ./widechar/lib_wunctrl.c */
+
+#undef wunctrl_sp
+wchar_t *wunctrl_sp(
+ SCREEN *sp,
+ cchar_t *wc)
+ { return(*(wchar_t **)0); }
+
+#undef wunctrl
+wchar_t *wunctrl(
+ cchar_t *wc)
+ { return(*(wchar_t **)0); }
+
+/* ./expanded.c */
+
+#undef _nc_toggle_attr_on
+void _nc_toggle_attr_on(
+ attr_t *S,
+ attr_t at)
+ { /* void */ }
+
+#undef _nc_toggle_attr_off
+void _nc_toggle_attr_off(
+ attr_t *S,
+ attr_t at)
+ { /* void */ }
+
+#undef _nc_DelCharCost_sp
+int _nc_DelCharCost_sp(
+ SCREEN *sp,
+ int count)
+ { return(*(int *)0); }
+
+#undef _nc_InsCharCost_sp
+int _nc_InsCharCost_sp(
+ SCREEN *sp,
+ int count)
+ { return(*(int *)0); }
+
+#undef _nc_UpdateAttrs_sp
+void _nc_UpdateAttrs_sp(
+ SCREEN *sp,
+ const cchar_t *c)
+ { /* void */ }
+
+#undef _nc_DelCharCost
+int _nc_DelCharCost(
+ int count)
+ { return(*(int *)0); }
+
+#undef _nc_InsCharCost
+int _nc_InsCharCost(
+ int count)
+ { return(*(int *)0); }
+
+#undef _nc_UpdateAttrs
+void _nc_UpdateAttrs(
+ const cchar_t *c)
+ { /* void */ }
+
+/* ./base/legacy_coding.c */
+
+#undef use_legacy_coding_sp
+int use_legacy_coding_sp(
+ SCREEN *sp,
+ int level)
+ { return(*(int *)0); }
+
+#undef use_legacy_coding
+int use_legacy_coding(
+ int level)
+ { return(*(int *)0); }
+
+/* ./base/lib_dft_fgbg.c */
+
+#undef use_default_colors_sp
+int use_default_colors_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef use_default_colors
+int use_default_colors(void)
+ { return(*(int *)0); }
+
+#undef assume_default_colors_sp
+int assume_default_colors_sp(
+ SCREEN *sp,
+ int fg,
+ int bg)
+ { return(*(int *)0); }
+
+#undef assume_default_colors
+int assume_default_colors(
+ int fg,
+ int bg)
+ { return(*(int *)0); }
+
+/* ./tinfo/lib_print.c */
+
+#undef mcprint_sp
+int mcprint_sp(
+ SCREEN *sp,
+ char *data,
+ int len)
+ { return(*(int *)0); }
+
+#undef mcprint
+int mcprint(
+ char *data,
+ int len)
+ { return(*(int *)0); }
+
+/* ./base/resizeterm.c */
+
+#undef is_term_resized_sp
+NCURSES_BOOL is_term_resized_sp(
+ SCREEN *sp,
+ int ToLines,
+ int ToCols)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef is_term_resized
+NCURSES_BOOL is_term_resized(
+ int ToLines,
+ int ToCols)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef resize_term_sp
+int resize_term_sp(
+ SCREEN *sp,
+ int ToLines,
+ int ToCols)
+ { return(*(int *)0); }
+
+#undef resize_term
+int resize_term(
+ int ToLines,
+ int ToCols)
+ { return(*(int *)0); }
+
+#undef resizeterm_sp
+int resizeterm_sp(
+ SCREEN *sp,
+ int ToLines,
+ int ToCols)
+ { return(*(int *)0); }
+
+#undef resizeterm
+int resizeterm(
+ int ToLines,
+ int ToCols)
+ { return(*(int *)0); }
+
+/* ./trace/trace_xnames.c */
+
+#undef _nc_trace_xnames
+void _nc_trace_xnames(
+ TERMTYPE *tp)
+ { /* void */ }
+
+/* ./tinfo/use_screen.c */
+
+#undef use_screen
+int use_screen(
+ SCREEN *screen,
+ NCURSES_SCREEN_CB func,
+ void *data)
+ { return(*(int *)0); }
+
+/* ./base/use_window.c */
+
+#undef use_window
+int use_window(
+ WINDOW *win,
+ NCURSES_WINDOW_CB func,
+ void *data)
+ { return(*(int *)0); }
+
+/* ./base/wresize.c */
+
+#undef wresize
+int wresize(
+ WINDOW *win,
+ int ToLines,
+ int ToCols)
+ { return(*(int *)0); }
+
+/* ./tinfo/access.c */
+
+#undef _nc_rootname
+char *_nc_rootname(
+ char *path)
+ { return(*(char **)0); }
+
+#undef _nc_is_abs_path
+NCURSES_BOOL _nc_is_abs_path(
+ const char *path)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_pathlast
+unsigned _nc_pathlast(
+ const char *path)
+ { return(*(unsigned *)0); }
+
+#undef _nc_basename
+char *_nc_basename(
+ char *path)
+ { return(*(char **)0); }
+
+#undef _nc_access
+int _nc_access(
+ const char *path,
+ int mode)
+ { return(*(int *)0); }
+
+#undef _nc_is_dir_path
+NCURSES_BOOL _nc_is_dir_path(
+ const char *path)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_is_file_path
+NCURSES_BOOL _nc_is_file_path(
+ const char *path)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_env_access
+int _nc_env_access(void)
+ { return(*(int *)0); }
+
+/* ./tinfo/add_tries.c */
+
+#undef _nc_add_to_try
+int _nc_add_to_try(
+ TRIES **tree,
+ const char *str,
+ unsigned code)
+ { return(*(int *)0); }
+
+/* ./tinfo/alloc_ttype.c */
+
+#undef _nc_align_termtype
+void _nc_align_termtype(
+ TERMTYPE *to,
+ TERMTYPE *from)
+ { /* void */ }
+
+#undef _nc_copy_termtype
+void _nc_copy_termtype(
+ TERMTYPE *dst,
+ TERMTYPE *src)
+ { /* void */ }
+
+/* ./codes.c */
+
+#undef _nc_boolcodes
+char *const *_nc_boolcodes(void)
+ { return(*(char **)0); }
+
+#undef _nc_numcodes
+char *const *_nc_numcodes(void)
+ { return(*(char **)0); }
+
+#undef _nc_strcodes
+char *const *_nc_strcodes(void)
+ { 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 HashValue *_nc_get_hash_table(
+ NCURSES_BOOL termcap)
+ { return(*(const HashValue **)0); }
+
+#undef _nc_get_alias_table
+const struct alias *_nc_get_alias_table(
+ NCURSES_BOOL termcap)
+ { return(*(const struct alias **)0); }
+
+#undef _nc_get_hash_info
+const HashData *_nc_get_hash_info(
+ NCURSES_BOOL termcap)
+ { return(*(const HashData **)0); }
+
+/* ./tinfo/comp_error.c */
+
+#undef _nc_suppress_warnings
+NCURSES_BOOL _nc_suppress_warnings;
+#undef _nc_curr_line
+int _nc_curr_line;
+#undef _nc_curr_col
+int _nc_curr_col;
+
+#undef _nc_get_source
+const char *_nc_get_source(void)
+ { return(*(const char **)0); }
+
+#undef _nc_set_source
+void _nc_set_source(
+ const char *const name)
+ { /* void */ }
+
+#undef _nc_set_type
+void _nc_set_type(
+ const char *const name)
+ { /* void */ }
+
+#undef _nc_get_type
+void _nc_get_type(
+ char *name)
+ { /* void */ }
+
+#undef _nc_warning
+void _nc_warning(
+ const char *const fmt,
+ ...)
+ { /* void */ }
+
+#undef _nc_err_abort
+void _nc_err_abort(
+ const char *const fmt,
+ ...)
+ { /* void */ }
+
+#undef _nc_syserr_abort
+void _nc_syserr_abort(
+ const char *const fmt,
+ ...)
+ { /* void */ }
+
+/* ./tinfo/comp_hash.c */
+
+#undef _nc_find_entry
+struct name_table_entry const *_nc_find_entry(
+ const char *string,
+ const HashValue *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,
+ NCURSES_BOOL termcap)
+ { return(*(struct name_table_entry const **)0); }
+
+/* ./tinfo/db_iterator.c */
+
+#undef _nc_tic_dir
+const char *_nc_tic_dir(
+ const char *path)
+ { return(*(const char **)0); }
+
+#undef _nc_keep_tic_dir
+void _nc_keep_tic_dir(
+ const char *path)
+ { /* void */ }
+
+#undef _nc_last_db
+void _nc_last_db(void)
+ { /* void */ }
+
+#undef _nc_next_db
+const char *_nc_next_db(
+ DBDIRS *state,
+ int *offset)
+ { return(*(const char **)0); }
+
+#undef _nc_first_db
+void _nc_first_db(
+ DBDIRS *state,
+ int *offset)
+ { /* void */ }
+
+/* ./tinfo/doalloc.c */
+
+#undef _nc_doalloc
+void *_nc_doalloc(
+ void *oldp,
+ 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
+const TERMTYPE *_nc_fallback(
+ const char *name)
+ { return(*(const TERMTYPE **)0); }
+
+/* ./tinfo/free_ttype.c */
+
+#undef _nc_free_termtype
+void _nc_free_termtype(
+ TERMTYPE *ptr)
+ { /* void */ }
+
+#undef _nc_user_definable
+NCURSES_BOOL _nc_user_definable;
+
+#undef use_extended_names
+int use_extended_names(
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
+/* ./tinfo/getenv_num.c */
+
+#undef _nc_getenv_num
+int _nc_getenv_num(
+ const char *name)
+ { return(*(int *)0); }
+
+/* ./tinfo/home_terminfo.c */
+
+#undef _nc_home_terminfo
+char *_nc_home_terminfo(void)
+ { return(*(char **)0); }
+
+/* ./tinfo/init_keytry.c */
+
+#if 0
+
+#include <init_keytry.h>
+
+#undef _nc_tinfo_fkeys
+const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0};
+
+#endif
+
+#undef _nc_init_keytry
+void _nc_init_keytry(
+ SCREEN *sp)
+ { /* void */ }
+
+/* ./tinfo/lib_acs.c */
+
+#undef _nc_acs_map
+chtype *_nc_acs_map(void)
+ { return(*(chtype **)0); }
+
+#undef _nc_init_acs_sp
+void _nc_init_acs_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_init_acs
+void _nc_init_acs(void)
+ { /* void */ }
+
+/* ./tinfo/lib_baudrate.c */
+
+#include <termcap.h>
+
+struct speed {
+ int s;
+ int sp;
+};
+
+#undef _nc_baudrate
+int _nc_baudrate(
+ int OSpeed)
+ { return(*(int *)0); }
+
+#undef _nc_ospeed
+int _nc_ospeed(
+ int BaudRate)
+ { return(*(int *)0); }
+
+#undef baudrate_sp
+int baudrate_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef baudrate
+int baudrate(void)
+ { return(*(int *)0); }
+
+/* ./tinfo/lib_cur_term.c */
+
+#undef _nc_get_cur_term_sp
+TERMINAL *_nc_get_cur_term_sp(
+ SCREEN *sp)
+ { return(*(TERMINAL **)0); }
+
+#undef _nc_get_cur_term
+TERMINAL *_nc_get_cur_term(void)
+ { return(*(TERMINAL **)0); }
+
+#undef _nc_cur_term
+TERMINAL *_nc_cur_term(void)
+ { return(*(TERMINAL **)0); }
+
+#undef set_curterm_sp
+TERMINAL *set_curterm_sp(
+ SCREEN *sp,
+ TERMINAL *termp)
+ { return(*(TERMINAL **)0); }
+
+#undef set_curterm
+TERMINAL *set_curterm(
+ TERMINAL *termp)
+ { return(*(TERMINAL **)0); }
+
+#undef del_curterm_sp
+int del_curterm_sp(
+ SCREEN *sp,
+ TERMINAL *termp)
+ { return(*(int *)0); }
+
+#undef del_curterm
+int del_curterm(
+ TERMINAL *termp)
+ { return(*(int *)0); }
+
+/* ./tinfo/lib_data.c */
+
+#undef _nc_stdscr
+WINDOW *_nc_stdscr(void)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_curscr
+WINDOW *_nc_curscr(void)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_newscr
+WINDOW *_nc_newscr(void)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_screen_chain
+SCREEN *_nc_screen_chain;
+#undef SP
+SCREEN *SP;
+#undef _nc_globals
+NCURSES_GLOBALS _nc_globals;
+#undef _nc_prescreen
+NCURSES_PRESCREEN _nc_prescreen;
+
+#undef _nc_screen_of
+SCREEN *_nc_screen_of(
+ WINDOW *win)
+ { return(*(SCREEN **)0); }
+
+#undef _nc_init_pthreads
+void _nc_init_pthreads(void)
+ { /* void */ }
+
+#undef _nc_mutex_init
+void _nc_mutex_init(
+ pthread_mutex_t *obj)
+ { /* void */ }
+
+#undef _nc_mutex_lock
+int _nc_mutex_lock(
+ pthread_mutex_t *obj)
+ { return(*(int *)0); }
+
+#undef _nc_mutex_trylock
+int _nc_mutex_trylock(
+ pthread_mutex_t *obj)
+ { return(*(int *)0); }
+
+#undef _nc_mutex_unlock
+int _nc_mutex_unlock(
+ pthread_mutex_t *obj)
+ { return(*(int *)0); }
+
+/* ./tinfo/lib_has_cap.c */
+
+#undef has_ic_sp
+NCURSES_BOOL has_ic_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef has_ic
+NCURSES_BOOL has_ic(void)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef has_il_sp
+NCURSES_BOOL has_il_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef has_il
+NCURSES_BOOL has_il(void)
+ { return(*(NCURSES_BOOL *)0); }
+
+/* ./tinfo/lib_kernel.c */
+
+#undef erasechar_sp
+char erasechar_sp(
+ SCREEN *sp)
+ { return(*(char *)0); }
+
+#undef erasechar
+char erasechar(void)
+ { return(*(char *)0); }
+
+#undef killchar_sp
+char killchar_sp(
+ SCREEN *sp)
+ { return(*(char *)0); }
+
+#undef killchar
+char killchar(void)
+ { return(*(char *)0); }
+
+#undef flushinp_sp
+int flushinp_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef flushinp
+int flushinp(void)
+ { return(*(int *)0); }
+
+/* ./lib_keyname.c */
+
+struct kn { short offset; int code; };
+
+#undef keyname_sp
+char *keyname_sp(
+ SCREEN *sp,
+ int c)
+ { return(*(char **)0); }
+
+#undef keyname
+char *keyname(
+ int c)
+ { return(*(char **)0); }
+
+/* ./tinfo/lib_longname.c */
+
+#undef longname_sp
+char *longname_sp(
+ SCREEN *sp)
+ { return(*(char **)0); }
+
+#undef longname
+char *longname(void)
+ { return(*(char **)0); }
+
+/* ./tinfo/lib_napms.c */
+
+#undef napms_sp
+int napms_sp(
+ SCREEN *sp,
+ int ms)
+ { return(*(int *)0); }
+
+#undef napms
+int napms(
+ int ms)
+ { return(*(int *)0); }
+
+/* ./tinfo/lib_options.c */
+
+#undef idlok
+int idlok(
+ WINDOW *win,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
+#undef idcok
+void idcok(
+ WINDOW *win,
+ NCURSES_BOOL flag)
+ { /* void */ }
+
+#undef halfdelay_sp
+int halfdelay_sp(
+ SCREEN *sp,
+ int t)
+ { return(*(int *)0); }
+
+#undef halfdelay
+int halfdelay(
+ int t)
+ { return(*(int *)0); }
+
+#undef nodelay
+int nodelay(
+ WINDOW *win,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
+#undef notimeout
+int notimeout(
+ WINDOW *win,
+ NCURSES_BOOL f)
+ { return(*(int *)0); }
+
+#undef wtimeout
+void wtimeout(
+ WINDOW *win,
+ int delay)
+ { /* void */ }
+
+#undef keypad
+int keypad(
+ WINDOW *win,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
+#undef meta
+int meta(
+ WINDOW *win,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
+#undef curs_set_sp
+int curs_set_sp(
+ SCREEN *sp,
+ int vis)
+ { return(*(int *)0); }
+
+#undef curs_set
+int curs_set(
+ int vis)
+ { return(*(int *)0); }
+
+#undef typeahead_sp
+int typeahead_sp(
+ SCREEN *sp,
+ int fd)
+ { return(*(int *)0); }
+
+#undef typeahead
+int typeahead(
+ int fd)
+ { return(*(int *)0); }
+
+#undef has_key_sp
+int has_key_sp(
+ SCREEN *sp,
+ int keycode)
+ { return(*(int *)0); }
+
+#undef has_key
+int has_key(
+ int keycode)
+ { return(*(int *)0); }
+
+#undef _nc_putp_flush_sp
+int _nc_putp_flush_sp(
+ SCREEN *sp,
+ const char *name,
+ const char *value)
+ { return(*(int *)0); }
+
+#undef _nc_keypad
+int _nc_keypad(
+ SCREEN *sp,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
+/* ./tinfo/lib_raw.c */
+
+#undef raw_sp
+int raw_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef raw
+int raw(void)
+ { return(*(int *)0); }
+
+#undef cbreak_sp
+int cbreak_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef cbreak
+int cbreak(void)
+ { return(*(int *)0); }
+
+#undef qiflush_sp
+void qiflush_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef qiflush
+void qiflush(void)
+ { /* void */ }
+
+#undef noraw_sp
+int noraw_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef noraw
+int noraw(void)
+ { return(*(int *)0); }
+
+#undef nocbreak_sp
+int nocbreak_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef nocbreak
+int nocbreak(void)
+ { return(*(int *)0); }
+
+#undef noqiflush_sp
+void noqiflush_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef noqiflush
+void noqiflush(void)
+ { /* void */ }
+
+#undef intrflush_sp
+int intrflush_sp(
+ SCREEN *sp,
+ WINDOW *win,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
+#undef intrflush
+int intrflush(
+ WINDOW *win,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
+/* ./tinfo/lib_setup.c */
+
+#include <locale.h>
+#include <sys/ioctl.h>
+#include <langinfo.h>
+
+#undef _nc_ttytype
+char *_nc_ttytype(void)
+ { return(*(char **)0); }
+
+#undef _nc_ptr_Lines
+int *_nc_ptr_Lines(
+ SCREEN *sp)
+ { return(*(int **)0); }
+
+#undef _nc_LINES
+int _nc_LINES(void)
+ { return(*(int *)0); }
+
+#undef _nc_ptr_Cols
+int *_nc_ptr_Cols(
+ SCREEN *sp)
+ { return(*(int **)0); }
+
+#undef _nc_COLS
+int _nc_COLS(void)
+ { return(*(int *)0); }
+
+#undef _nc_ptr_Tabsize
+int *_nc_ptr_Tabsize(
+ SCREEN *sp)
+ { return(*(int **)0); }
+
+#undef _nc_TABSIZE
+int _nc_TABSIZE(void)
+ { return(*(int *)0); }
+
+#undef set_tabsize_sp
+int set_tabsize_sp(
+ SCREEN *sp,
+ int value)
+ { return(*(int *)0); }
+
+#undef set_tabsize
+int set_tabsize(
+ int value)
+ { return(*(int *)0); }
+
+#undef _nc_handle_sigwinch
+int _nc_handle_sigwinch(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef use_env_sp
+void use_env_sp(
+ SCREEN *sp,
+ NCURSES_BOOL f)
+ { /* void */ }
+
+#undef use_env
+void use_env(
+ NCURSES_BOOL f)
+ { /* void */ }
+
+#undef _nc_get_screensize
+void _nc_get_screensize(
+ SCREEN *sp,
+ int *linep,
+ int *colp)
+ { /* void */ }
+
+#undef _nc_update_screensize
+void _nc_update_screensize(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_setup_tinfo
+int _nc_setup_tinfo(
+ const char *const tn,
+ TERMTYPE *const tp)
+ { return(*(int *)0); }
+
+#undef _nc_tinfo_cmdch
+void _nc_tinfo_cmdch(
+ TERMINAL *termp,
+ char proto)
+ { /* void */ }
+
+#undef _nc_get_locale
+char *_nc_get_locale(void)
+ { return(*(char **)0); }
+
+#undef _nc_unicode_locale
+int _nc_unicode_locale(void)
+ { return(*(int *)0); }
+
+#undef _nc_locale_breaks_acs
+int _nc_locale_breaks_acs(
+ TERMINAL *termp)
+ { return(*(int *)0); }
+
+#undef _nc_setupterm
+int _nc_setupterm(
+ char *tname,
+ int Filedes,
+ int *errret,
+ NCURSES_BOOL reuse)
+ { return(*(int *)0); }
+
+#undef new_prescr
+SCREEN *new_prescr(void)
+ { return(*(SCREEN **)0); }
+
+#undef setupterm
+int setupterm(
+ char *tname,
+ int Filedes,
+ int *errret)
+ { return(*(int *)0); }
+
+/* ./tinfo/lib_termcap.c */
+
+#undef UP
+char *UP;
+#undef BC
+char *BC;
+
+#undef tgetent_sp
+int tgetent_sp(
+ SCREEN *sp,
+ char *bufp,
+ const char *name)
+ { return(*(int *)0); }
+
+#if 0
+
+#include <capdefaults.c>
+
+#endif
+
+#undef tgetent
+int tgetent(
+ char *bufp,
+ const char *name)
+ { return(*(int *)0); }
+
+#undef tgetflag_sp
+int tgetflag_sp(
+ SCREEN *sp,
+ char *id)
+ { return(*(int *)0); }
+
+#undef tgetflag
+int tgetflag(
+ char *id)
+ { return(*(int *)0); }
+
+#undef tgetnum_sp
+int tgetnum_sp(
+ SCREEN *sp,
+ char *id)
+ { return(*(int *)0); }
+
+#undef tgetnum
+int tgetnum(
+ char *id)
+ { return(*(int *)0); }
+
+#undef tgetstr_sp
+char *tgetstr_sp(
+ SCREEN *sp,
+ char *id,
+ char **area)
+ { return(*(char **)0); }
+
+#undef tgetstr
+char *tgetstr(
+ char *id,
+ char **area)
+ { return(*(char **)0); }
+
+/* ./tinfo/lib_termname.c */
+
+#undef termname_sp
+char *termname_sp(
+ SCREEN *sp)
+ { return(*(char **)0); }
+
+#undef termname
+char *termname(void)
+ { return(*(char **)0); }
+
+/* ./tinfo/lib_tgoto.c */
+
+#undef tgoto
+char *tgoto(
+ const char *string,
+ int x,
+ int y)
+ { return(*(char **)0); }
+
+/* ./tinfo/lib_ti.c */
+
+#undef tigetflag_sp
+int tigetflag_sp(
+ SCREEN *sp,
+ char *str)
+ { return(*(int *)0); }
+
+#undef tigetflag
+int tigetflag(
+ char *str)
+ { return(*(int *)0); }
+
+#undef tigetnum_sp
+int tigetnum_sp(
+ SCREEN *sp,
+ char *str)
+ { return(*(int *)0); }
+
+#undef tigetnum
+int tigetnum(
+ char *str)
+ { return(*(int *)0); }
+
+#undef tigetstr_sp
+char *tigetstr_sp(
+ SCREEN *sp,
+ char *str)
+ { return(*(char **)0); }
+
+#undef tigetstr
+char *tigetstr(
+ char *str)
+ { return(*(char **)0); }
+
+/* ./tinfo/lib_tparm.c */
+
+#undef _nc_tparm_err
+int _nc_tparm_err;
+
+#undef _nc_tparm_analyze
+int _nc_tparm_analyze(
+ const char *string,
+ char *p_is_s[9],
+ int *popcount)
+ { return(*(int *)0); }
+
+#undef tparm
+char *tparm(
+ char *string,
+ ...)
+ { return(*(char **)0); }
+
+#undef tiparm
+char *tiparm(
+ const char *string,
+ ...)
+ { return(*(char **)0); }
+
+/* ./tinfo/lib_tputs.c */
+
+#undef PC
+char PC;
+#undef ospeed
+NCURSES_OSPEED ospeed;
+#undef _nc_nulls_sent
+int _nc_nulls_sent;
+
+#undef _nc_set_no_padding
+void _nc_set_no_padding(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef delay_output_sp
+int delay_output_sp(
+ SCREEN *sp,
+ int ms)
+ { return(*(int *)0); }
+
+#undef delay_output
+int delay_output(
+ int ms)
+ { return(*(int *)0); }
+
+#undef _nc_flush_sp
+void _nc_flush_sp(
+ SCREEN *sp)
+ { /* void */ }
+
+#undef _nc_flush
+void _nc_flush(void)
+ { /* void */ }
+
+#undef _nc_outch_sp
+int _nc_outch_sp(
+ SCREEN *sp,
+ int ch)
+ { return(*(int *)0); }
+
+#undef _nc_outch
+int _nc_outch(
+ int ch)
+ { return(*(int *)0); }
+
+#undef putp_sp
+int putp_sp(
+ SCREEN *sp,
+ const char *string)
+ { return(*(int *)0); }
+
+#undef _nc_putp_sp
+int _nc_putp_sp(
+ SCREEN *sp,
+ const char *name,
+ const char *string)
+ { return(*(int *)0); }
+
+#undef putp
+int putp(
+ const char *string)
+ { return(*(int *)0); }
+
+#undef _nc_putp
+int _nc_putp(
+ const char *name,
+ const char *string)
+ { return(*(int *)0); }
+
+#undef tputs_sp
+int tputs_sp(
+ SCREEN *sp,
+ const char *string,
+ int affcnt,
+ NCURSES_OUTC_sp outc)
+ { return(*(int *)0); }
+
+#undef _nc_outc_wrapper
+int _nc_outc_wrapper(
+ SCREEN *sp,
+ int c)
+ { return(*(int *)0); }
+
+#undef tputs
+int tputs(
+ const char *string,
+ int affcnt,
+ int (*outc)(
+ int p1))
+ { return(*(int *)0); }
+
+/* ./trace/lib_trace.c */
+
+#undef _nc_tracing
+unsigned _nc_tracing;
+
+#undef _nc__nc_tputs_trace
+const char *_nc__nc_tputs_trace(void)
+ { return(*(const char **)0); }
+
+#undef _nc__nc_outchars
+long _nc__nc_outchars(void)
+ { return(*(long *)0); }
+
+#undef _nc_set_tputs_trace
+void _nc_set_tputs_trace(
+ const char *s)
+ { /* void */ }
+
+#undef _nc_count_outchars
+void _nc_count_outchars(
+ long increment)
+ { /* void */ }
+
+#undef trace
+void trace(
+ const unsigned int tracelevel)
+ { /* void */ }
+
+#undef _tracef
+void _tracef(
+ const char *fmt,
+ ...)
+ { /* void */ }
+
+#undef _nc_retrace_bool
+NCURSES_BOOL _nc_retrace_bool(
+ NCURSES_BOOL code)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_retrace_char
+char _nc_retrace_char(
+ char code)
+ { return(*(char *)0); }
+
+#undef _nc_retrace_int
+int _nc_retrace_int(
+ int code)
+ { return(*(int *)0); }
+
+#undef _nc_retrace_unsigned
+unsigned _nc_retrace_unsigned(
+ unsigned code)
+ { return(*(unsigned *)0); }
+
+#undef _nc_retrace_ptr
+char *_nc_retrace_ptr(
+ char *code)
+ { return(*(char **)0); }
+
+#undef _nc_retrace_cptr
+const char *_nc_retrace_cptr(
+ const char *code)
+ { return(*(const char **)0); }
+
+#undef _nc_retrace_cvoid_ptr
+void *_nc_retrace_cvoid_ptr(
+ void *code)
+ { return(*(void **)0); }
+
+#undef _nc_retrace_void_ptr
+void *_nc_retrace_void_ptr(
+ void *code)
+ { return(*(void **)0); }
+
+#undef _nc_retrace_sp
+SCREEN *_nc_retrace_sp(
+ SCREEN *code)
+ { return(*(SCREEN **)0); }
+
+#undef _nc_retrace_win
+WINDOW *_nc_retrace_win(
+ WINDOW *code)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_use_tracef
+int _nc_use_tracef(
+ unsigned mask)
+ { return(*(int *)0); }
+
+#undef _nc_locked_tracef
+void _nc_locked_tracef(
+ const char *fmt,
+ ...)
+ { /* void */ }
+
+/* ./trace/lib_traceatr.c */
+
+#undef _traceattr2
+char *_traceattr2(
+ int bufnum,
+ chtype newmode)
+ { return(*(char **)0); }
+
+#undef _traceattr
+char *_traceattr(
+ attr_t newmode)
+ { return(*(char **)0); }
+
+#undef _nc_retrace_int_attr_t
+int _nc_retrace_int_attr_t(
+ attr_t code)
+ { return(*(int *)0); }
+
+#undef _nc_retrace_attr_t
+attr_t _nc_retrace_attr_t(
+ attr_t code)
+ { return(*(attr_t *)0); }
+
+#undef _nc_altcharset_name
+const char *_nc_altcharset_name(
+ attr_t attr,
+ chtype ch)
+ { return(*(const char **)0); }
+
+#undef _tracechtype2
+char *_tracechtype2(
+ int bufnum,
+ chtype ch)
+ { return(*(char **)0); }
+
+#undef _tracechtype
+char *_tracechtype(
+ chtype ch)
+ { return(*(char **)0); }
+
+#undef _nc_retrace_chtype
+chtype _nc_retrace_chtype(
+ chtype code)
+ { return(*(chtype *)0); }
+
+#undef _tracecchar_t2
+char *_tracecchar_t2(
+ int bufnum,
+ const cchar_t *ch)
+ { return(*(char **)0); }
+
+#undef _tracecchar_t
+char *_tracecchar_t(
+ const cchar_t *ch)
+ { return(*(char **)0); }
+
+/* ./trace/lib_tracebits.c */
+
+typedef struct {
+ unsigned int val;
+ const char *name;
+} BITNAMES;
+
+#undef _nc_trace_ttymode
+char *_nc_trace_ttymode(
+ struct termios *tty)
+ { return(*(char **)0); }
+
+#undef _nc_tracebits
+char *_nc_tracebits(void)
+ { return(*(char **)0); }
+
+/* ./trace/lib_tracechr.c */
+
+#undef _nc_tracechar
+char *_nc_tracechar(
+ SCREEN *sp,
+ int ch)
+ { return(*(char **)0); }
+
+#undef _tracechar
+char *_tracechar(
+ int ch)
+ { return(*(char **)0); }
+
+/* ./tinfo/lib_ttyflags.c */
+
+#undef _nc_get_tty_mode_sp
+int _nc_get_tty_mode_sp(
+ SCREEN *sp,
+ struct termios *buf)
+ { return(*(int *)0); }
+
+#undef _nc_get_tty_mode
+int _nc_get_tty_mode(
+ struct termios *buf)
+ { return(*(int *)0); }
+
+#undef _nc_set_tty_mode_sp
+int _nc_set_tty_mode_sp(
+ SCREEN *sp,
+ struct termios *buf)
+ { return(*(int *)0); }
+
+#undef _nc_set_tty_mode
+int _nc_set_tty_mode(
+ struct termios *buf)
+ { return(*(int *)0); }
+
+#undef def_shell_mode_sp
+int def_shell_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef def_shell_mode
+int def_shell_mode(void)
+ { return(*(int *)0); }
+
+#undef def_prog_mode_sp
+int def_prog_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef def_prog_mode
+int def_prog_mode(void)
+ { return(*(int *)0); }
+
+#undef reset_prog_mode_sp
+int reset_prog_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef reset_prog_mode
+int reset_prog_mode(void)
+ { return(*(int *)0); }
+
+#undef reset_shell_mode_sp
+int reset_shell_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef reset_shell_mode
+int reset_shell_mode(void)
+ { return(*(int *)0); }
+
+#undef savetty_sp
+int savetty_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef savetty
+int savetty(void)
+ { return(*(int *)0); }
+
+#undef resetty_sp
+int resetty_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef resetty
+int resetty(void)
+ { return(*(int *)0); }
+
+/* ./tty/lib_twait.c */
+
+#undef _nc_timed_wait
+int _nc_timed_wait(
+ SCREEN *sp,
+ int mode,
+ int milliseconds,
+ int *timeleft)
+ { return(*(int *)0); }
+
+/* ./tinfo/name_match.c */
+
+#undef _nc_first_name
+char *_nc_first_name(
+ const char *const sp)
+ { return(*(char **)0); }
+
+#undef _nc_name_match
+int _nc_name_match(
+ const char *const namelst,
+ const char *const name,
+ const char *const delim)
+ { return(*(int *)0); }
+
+/* ./names.c */
+
+#undef _nc_boolnames
+char *const *_nc_boolnames(void)
+ { return(*(char **)0); }
+
+#undef _nc_boolfnames
+char *const *_nc_boolfnames(void)
+ { return(*(char **)0); }
+
+#undef _nc_numnames
+char *const *_nc_numnames(void)
+ { return(*(char **)0); }
+
+#undef _nc_numfnames
+char *const *_nc_numfnames(void)
+ { return(*(char **)0); }
+
+#undef _nc_strnames
+char *const *_nc_strnames(void)
+ { return(*(char **)0); }
+
+#undef _nc_strfnames
+char *const *_nc_strfnames(void)
+ { return(*(char **)0); }
+
+/* ./tinfo/read_entry.c */
+
+#include <hashed_db.h>
+
+#undef _nc_read_termtype
+int _nc_read_termtype(
+ TERMTYPE *ptr,
+ char *buffer,
+ int limit)
+ { return(*(int *)0); }
+
+#undef _nc_read_file_entry
+int _nc_read_file_entry(
+ const char *const filename,
+ TERMTYPE *ptr)
+ { return(*(int *)0); }
+
+#undef _nc_read_entry
+int _nc_read_entry(
+ const char *const name,
+ char *const filename,
+ TERMTYPE *const tp)
+ { return(*(int *)0); }
+
+/* ./tinfo/read_termcap.c */
+
+#include <sys/types.h>
+
+#undef _nc_read_termcap_entry
+int _nc_read_termcap_entry(
+ const char *const tn,
+ TERMTYPE *const tp)
+ { return(*(int *)0); }
+
+/* ./tinfo/setbuf.c */
+
+#undef _nc_set_buffer_sp
+void _nc_set_buffer_sp(
+ SCREEN *sp,
+ FILE *ofp,
+ NCURSES_BOOL buffered)
+ { /* void */ }
+
+#undef _nc_set_buffer
+void _nc_set_buffer(
+ FILE *ofp,
+ NCURSES_BOOL buffered)
+ { /* void */ }
+
+/* ./tinfo/strings.c */
+
+#undef _nc_str_init
+string_desc *_nc_str_init(
+ string_desc *dst,
+ char *src,
+ size_t len)
+ { return(*(string_desc **)0); }
+
+#undef _nc_str_null
+string_desc *_nc_str_null(
+ string_desc *dst,
+ size_t len)
+ { return(*(string_desc **)0); }
+
+#undef _nc_str_copy
+string_desc *_nc_str_copy(
+ string_desc *dst,
+ string_desc *src)
+ { return(*(string_desc **)0); }
+
+#undef _nc_safe_strcat
+NCURSES_BOOL _nc_safe_strcat(
+ string_desc *dst,
+ const char *src)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_safe_strcpy
+NCURSES_BOOL _nc_safe_strcpy(
+ string_desc *dst,
+ const char *src)
+ { return(*(NCURSES_BOOL *)0); }
+
+/* ./trace/trace_buf.c */
+
+#undef _nc_trace_buf
+char *_nc_trace_buf(
+ int bufnum,
+ size_t want)
+ { return(*(char **)0); }
+
+#undef _nc_trace_bufcat
+char *_nc_trace_bufcat(
+ int bufnum,
+ const char *value)
+ { return(*(char **)0); }
+
+/* ./trace/trace_tries.c */
+
+#undef _nc_trace_tries
+void _nc_trace_tries(
+ TRIES *tree)
+ { /* void */ }
+
+/* ./base/tries.c */
+
+#undef _nc_expand_try
+char *_nc_expand_try(
+ TRIES *tree,
+ unsigned code,
+ int *count,
+ size_t len)
+ { return(*(char **)0); }
+
+#undef _nc_remove_key
+int _nc_remove_key(
+ TRIES **tree,
+ unsigned code)
+ { return(*(int *)0); }
+
+#undef _nc_remove_string
+int _nc_remove_string(
+ TRIES **tree,
+ const char *string)
+ { return(*(int *)0); }
+
+/* ./tinfo/trim_sgr0.c */
+
+#undef _nc_trim_sgr0
+char *_nc_trim_sgr0(
+ TERMTYPE *tp)
+ { return(*(char **)0); }
+
+/* ./unctrl.c */
+
+#undef unctrl_sp
+char *unctrl_sp(
+ SCREEN *sp,
+ chtype ch)
+ { return(*(char **)0); }
+
+#undef unctrl
+char *unctrl(
+ chtype ch)
+ { return(*(char **)0); }
+
+/* ./trace/visbuf.c */
+
+#undef _nc_visbuf2
+const char *_nc_visbuf2(
+ int bufnum,
+ const char *buf)
+ { return(*(const char **)0); }
+
+#undef _nc_visbuf
+const char *_nc_visbuf(
+ const char *buf)
+ { return(*(const char **)0); }
+
+#undef _nc_visbufn
+const char *_nc_visbufn(
+ const char *buf,
+ int len)
+ { return(*(const char **)0); }
+
+#undef _nc_viswbuf2
+const char *_nc_viswbuf2(
+ int bufnum,
+ const wchar_t *buf)
+ { return(*(const char **)0); }
+
+#undef _nc_viswbuf
+const char *_nc_viswbuf(
+ const wchar_t *buf)
+ { return(*(const char **)0); }
+
+#undef _nc_viswbufn
+const char *_nc_viswbufn(
+ const wchar_t *buf,
+ int len)
+ { return(*(const char **)0); }
+
+#undef _nc_viswibuf
+const char *_nc_viswibuf(
+ const wint_t *buf)
+ { return(*(const char **)0); }
+
+#undef _nc_viscbuf2
+const char *_nc_viscbuf2(
+ int bufnum,
+ const cchar_t *buf,
+ int len)
+ { return(*(const char **)0); }
+
+#undef _nc_viscbuf
+const char *_nc_viscbuf(
+ const cchar_t *buf,
+ 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); }
+
+/* ./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_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
+void _nc_set_writedir(
+ char *dir)
+ { /* void */ }
+
+#undef _nc_write_entry
+void _nc_write_entry(
+ TERMTYPE *const tp)
+ { /* void */ }
+
+#undef _nc_tic_written
+int _nc_tic_written(void)
+ { return(*(int *)0); }
+
+/* ./base/define_key.c */
+
+#undef define_key_sp
+int define_key_sp(
+ SCREEN *sp,
+ const char *str,
+ int keycode)
+ { return(*(int *)0); }
+
+#undef define_key
+int define_key(
+ const char *str,
+ int keycode)
+ { return(*(int *)0); }
+
+/* ./tinfo/hashed_db.c */
+
+#undef _nc_hashed_db
+void _nc_hashed_db(void)
+ { /* void */ }
+
+/* ./base/key_defined.c */
+
+#undef key_defined_sp
+int key_defined_sp(
+ SCREEN *sp,
+ const char *str)
+ { return(*(int *)0); }
+
+#undef key_defined
+int key_defined(
+ const char *str)
+ { return(*(int *)0); }
+
+/* ./base/keybound.c */
+
+#undef keybound_sp
+char *keybound_sp(
+ SCREEN *sp,
+ int code,
+ int count)
+ { return(*(char **)0); }
+
+#undef keybound
+char *keybound(
+ int code,
+ int count)
+ { return(*(char **)0); }
+
+/* ./base/keyok.c */
+
+#undef keyok_sp
+int keyok_sp(
+ SCREEN *sp,
+ int c,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
+#undef keyok
+int keyok(
+ int c,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
+/* ./base/version.c */
+
+#undef curses_version
+const char *curses_version(void)
+ { return(*(const char **)0); }
diff --git a/contrib/ncurses/ncurses/llib-lncursesw b/contrib/ncurses/ncurses/llib-lncursesw
index 96e7257691d8..28e68034ea8d 100644
--- a/contrib/ncurses/ncurses/llib-lncursesw
+++ b/contrib/ncurses/ncurses/llib-lncursesw
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2001-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 2001-2010,2011 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 2001-2008 *
+ * Author: Thomas E. Dickey 2001-2010,2011 *
****************************************************************************/
/* LINTLIBRARY */
@@ -38,27 +38,54 @@
#undef _nc_oldnums
int *_nc_oldnums;
+#undef _nc_scroll_optimize_sp
+void _nc_scroll_optimize_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_scroll_optimize
void _nc_scroll_optimize(void)
{ /* void */ }
+#undef _nc_linedump_sp
+void _nc_linedump_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_linedump
void _nc_linedump(void)
{ /* void */ }
/* ./tty/hashmap.c */
-#include <term.h>
+#undef _nc_hash_map_sp
+void _nc_hash_map_sp(
+ SCREEN *sp)
+ { /* void */ }
#undef _nc_hash_map
void _nc_hash_map(void)
{ /* void */ }
+#undef _nc_make_oldhash_sp
+void _nc_make_oldhash_sp(
+ SCREEN *sp,
+ int i)
+ { /* void */ }
+
#undef _nc_make_oldhash
void _nc_make_oldhash(
int i)
{ /* void */ }
+#undef _nc_scroll_oldhash_sp
+void _nc_scroll_oldhash_sp(
+ SCREEN *sp,
+ int n,
+ int top,
+ int bot)
+ { /* void */ }
+
#undef _nc_scroll_oldhash
void _nc_scroll_oldhash(
int n,
@@ -137,6 +164,11 @@ int waddnwstr(
/* ./base/lib_beep.c */
+#undef beep_sp
+int beep_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef beep
int beep(void)
{ return(*(int *)0); }
@@ -231,14 +263,32 @@ int COLOR_PAIRS;
#undef COLORS
int COLORS;
+#undef _nc_reset_colors_sp
+NCURSES_BOOL _nc_reset_colors_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef _nc_reset_colors
NCURSES_BOOL _nc_reset_colors(void)
{ return(*(NCURSES_BOOL *)0); }
+#undef start_color_sp
+int start_color_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef start_color
int start_color(void)
{ return(*(int *)0); }
+#undef init_pair_sp
+int init_pair_sp(
+ SCREEN *sp,
+ short pair,
+ short f,
+ short b)
+ { return(*(int *)0); }
+
#undef init_pair
int init_pair(
short pair,
@@ -246,6 +296,15 @@ int init_pair(
short b)
{ return(*(int *)0); }
+#undef init_color_sp
+int init_color_sp(
+ SCREEN *sp,
+ short color,
+ short r,
+ short g,
+ short b)
+ { return(*(int *)0); }
+
#undef init_color
int init_color(
short color,
@@ -254,14 +313,33 @@ int init_color(
short b)
{ return(*(int *)0); }
+#undef can_change_color_sp
+NCURSES_BOOL can_change_color_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef can_change_color
NCURSES_BOOL can_change_color(void)
{ return(*(NCURSES_BOOL *)0); }
+#undef has_colors_sp
+NCURSES_BOOL has_colors_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef has_colors
NCURSES_BOOL has_colors(void)
{ return(*(NCURSES_BOOL *)0); }
+#undef color_content_sp
+int color_content_sp(
+ SCREEN *sp,
+ short color,
+ short *r,
+ short *g,
+ short *b)
+ { return(*(int *)0); }
+
#undef color_content
int color_content(
short color,
@@ -270,6 +348,14 @@ int color_content(
short *b)
{ return(*(int *)0); }
+#undef pair_content_sp
+int pair_content_sp(
+ SCREEN *sp,
+ short pair,
+ short *f,
+ short *b)
+ { return(*(int *)0); }
+
#undef pair_content
int pair_content(
short pair,
@@ -277,13 +363,21 @@ int pair_content(
short *b)
{ return(*(int *)0); }
+#undef _nc_do_color_sp
+void _nc_do_color_sp(
+ SCREEN *sp,
+ short old_pair,
+ short pair,
+ NCURSES_BOOL reverse,
+ NCURSES_OUTC_sp outc)
+ { /* void */ }
+
#undef _nc_do_color
void _nc_do_color(
short old_pair,
short pair,
NCURSES_BOOL reverse,
- int (*outc)(
- int p1))
+ NCURSES_OUTC outc)
{ /* void */ }
/* ./base/lib_colorset.c */
@@ -311,16 +405,31 @@ int delwin(
/* ./base/lib_echo.c */
+#undef echo_sp
+int echo_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef echo
int echo(void)
{ return(*(int *)0); }
+#undef noecho_sp
+int noecho_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef noecho
int noecho(void)
{ return(*(int *)0); }
/* ./base/lib_endwin.c */
+#undef endwin_sp
+int endwin_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef endwin
int endwin(void)
{ return(*(int *)0); }
@@ -334,6 +443,11 @@ int werase(
/* ./base/lib_flash.c */
+#undef flash_sp
+int flash_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef flash
int flash(void)
{ return(*(int *)0); }
@@ -1156,11 +1270,21 @@ NCURSES_BOOL is_notimeout(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
+#undef is_pad
+NCURSES_BOOL is_pad(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef is_scrollok
NCURSES_BOOL is_scrollok(
const WINDOW *z)
{ return(*(NCURSES_BOOL *)0); }
+#undef is_subwin
+NCURSES_BOOL is_subwin(
+ const WINDOW *z)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef is_syncok
NCURSES_BOOL is_syncok(
const WINDOW *z)
@@ -1646,15 +1770,30 @@ NCURSES_BOOL mouse_trafo(
#undef ESCDELAY
int ESCDELAY;
+#undef set_escdelay_sp
+int set_escdelay_sp(
+ SCREEN *sp,
+ int value)
+ { return(*(int *)0); }
+
#undef set_escdelay
int set_escdelay(
int value)
{ return(*(int *)0); }
+#undef get_escdelay_sp
+int get_escdelay_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
+#undef get_escdelay
+int get_escdelay(void)
+ { return(*(int *)0); }
+
#undef _nc_wgetch
int _nc_wgetch(
WINDOW *win,
- unsigned long *result,
+ int *result,
int use_meta)
{ return(*(int *)0); }
@@ -1708,6 +1847,7 @@ WINDOW *initscr(void)
#undef _nc_insert_ch
int _nc_insert_ch(
+ SCREEN *sp,
WINDOW *win,
chtype ch)
{ return(*(int *)0); }
@@ -1746,6 +1886,11 @@ int winnstr(
/* ./base/lib_isendwin.c */
+#undef isendwin_sp
+NCURSES_BOOL isendwin_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef isendwin
NCURSES_BOOL isendwin(void)
{ return(*(NCURSES_BOOL *)0); }
@@ -1760,16 +1905,35 @@ int leaveok(
/* ./base/lib_mouse.c */
+#undef getmouse_sp
+int getmouse_sp(
+ SCREEN *sp,
+ MEVENT *aevent)
+ { return(*(int *)0); }
+
#undef getmouse
int getmouse(
MEVENT *aevent)
{ return(*(int *)0); }
+#undef ungetmouse_sp
+int ungetmouse_sp(
+ SCREEN *sp,
+ MEVENT *aevent)
+ { return(*(int *)0); }
+
#undef ungetmouse
int ungetmouse(
MEVENT *aevent)
{ return(*(int *)0); }
+#undef mousemask_sp
+mmask_t mousemask_sp(
+ SCREEN *sp,
+ mmask_t newmask,
+ mmask_t *oldmask)
+ { return(*(mmask_t *)0); }
+
#undef mousemask
mmask_t mousemask(
mmask_t newmask,
@@ -1783,14 +1947,30 @@ NCURSES_BOOL wenclose(
int x)
{ return(*(NCURSES_BOOL *)0); }
+#undef mouseinterval_sp
+int mouseinterval_sp(
+ SCREEN *sp,
+ int maxclick)
+ { return(*(int *)0); }
+
#undef mouseinterval
int mouseinterval(
int maxclick)
{ return(*(int *)0); }
#undef _nc_has_mouse
-int _nc_has_mouse(void)
- { return(*(int *)0); }
+NCURSES_BOOL _nc_has_mouse(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef has_mouse_sp
+NCURSES_BOOL has_mouse_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef has_mouse
+NCURSES_BOOL has_mouse(void)
+ { return(*(NCURSES_BOOL *)0); }
#undef wmouse_trafo
NCURSES_BOOL wmouse_trafo(
@@ -1811,24 +1991,55 @@ int wmove(
/* ./tty/lib_mvcur.c */
+#undef _nc_msec_cost_sp
+int _nc_msec_cost_sp(
+ SCREEN *sp,
+ const char *const cap,
+ int affcnt)
+ { return(*(int *)0); }
+
#undef _nc_msec_cost
int _nc_msec_cost(
const char *const cap,
int affcnt)
{ return(*(int *)0); }
+#undef _nc_mvcur_resume_sp
+void _nc_mvcur_resume_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_mvcur_resume
void _nc_mvcur_resume(void)
{ /* void */ }
+#undef _nc_mvcur_init_sp
+void _nc_mvcur_init_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_mvcur_init
void _nc_mvcur_init(void)
{ /* void */ }
+#undef _nc_mvcur_wrap_sp
+void _nc_mvcur_wrap_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_mvcur_wrap
void _nc_mvcur_wrap(void)
{ /* void */ }
+#undef mvcur_sp
+int mvcur_sp(
+ SCREEN *sp,
+ int yold,
+ int xold,
+ int ynew,
+ int xnew)
+ { return(*(int *)0); }
+
#undef mvcur
int mvcur(
int yold,
@@ -1851,14 +2062,32 @@ int mvwin(
/* ./base/lib_newterm.c */
+#undef filter_sp
+void filter_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef filter
void filter(void)
{ /* void */ }
+#undef nofilter_sp
+void nofilter_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef nofilter
void nofilter(void)
{ /* void */ }
+#undef newterm_sp
+SCREEN *newterm_sp(
+ SCREEN *sp,
+ char *name,
+ FILE *ofp,
+ FILE *ifp)
+ { return(*(SCREEN **)0); }
+
#undef newterm
SCREEN *newterm(
char *name,
@@ -1873,6 +2102,15 @@ int _nc_freewin(
WINDOW *win)
{ return(*(int *)0); }
+#undef newwin_sp
+WINDOW *newwin_sp(
+ SCREEN *sp,
+ int num_lines,
+ int num_columns,
+ int begy,
+ int begx)
+ { return(*(WINDOW **)0); }
+
#undef newwin
WINDOW *newwin(
int num_lines,
@@ -1899,8 +2137,9 @@ WINDOW *subwin(
int x)
{ return(*(WINDOW **)0); }
-#undef _nc_makenew
-WINDOW *_nc_makenew(
+#undef _nc_makenew_sp
+WINDOW *_nc_makenew_sp(
+ SCREEN *sp,
int num_lines,
int num_columns,
int begy,
@@ -1908,17 +2147,37 @@ WINDOW *_nc_makenew(
int flags)
{ return(*(WINDOW **)0); }
-#undef _nc_screen_of
-SCREEN *_nc_screen_of(
- WINDOW *win)
- { return(*(SCREEN **)0); }
+#undef _nc_curscr_of
+WINDOW *_nc_curscr_of(
+ SCREEN *sp)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_newscr_of
+WINDOW *_nc_newscr_of(
+ SCREEN *sp)
+ { return(*(WINDOW **)0); }
+
+#undef _nc_stdscr_of
+WINDOW *_nc_stdscr_of(
+ SCREEN *sp)
+ { return(*(WINDOW **)0); }
/* ./base/lib_nl.c */
+#undef nl_sp
+int nl_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef nl
int nl(void)
{ return(*(int *)0); }
+#undef nonl_sp
+int nonl_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef nonl
int nonl(void)
{ return(*(int *)0); }
@@ -1952,6 +2211,13 @@ int copywin(
/* ./base/lib_pad.c */
+#undef newpad_sp
+WINDOW *newpad_sp(
+ SCREEN *sp,
+ int l,
+ int c)
+ { return(*(WINDOW **)0); }
+
#undef newpad
WINDOW *newpad(
int l,
@@ -2057,6 +2323,14 @@ int wnoutrefresh(
/* ./base/lib_restart.c */
+#undef restartterm_sp
+int restartterm_sp(
+ SCREEN *sp,
+ char *termp,
+ int filenum,
+ int *errret)
+ { return(*(int *)0); }
+
#undef restartterm
int restartterm(
char *termp,
@@ -2105,6 +2379,12 @@ int mvwscanw(
/* ./base/lib_screen.c */
+#undef getwin_sp
+WINDOW *getwin_sp(
+ SCREEN *sp,
+ FILE *filep)
+ { return(*(WINDOW **)0); }
+
#undef getwin
WINDOW *getwin(
FILE *filep)
@@ -2116,6 +2396,12 @@ int putwin(
FILE *filep)
{ return(*(int *)0); }
+#undef scr_restore_sp
+int scr_restore_sp(
+ SCREEN *sp,
+ const char *file)
+ { return(*(int *)0); }
+
#undef scr_restore
int scr_restore(
const char *file)
@@ -2126,11 +2412,23 @@ int scr_dump(
const char *file)
{ return(*(int *)0); }
+#undef scr_init_sp
+int scr_init_sp(
+ SCREEN *sp,
+ const char *file)
+ { return(*(int *)0); }
+
#undef scr_init
int scr_init(
const char *file)
{ return(*(int *)0); }
+#undef scr_set_sp
+int scr_set_sp(
+ SCREEN *sp,
+ const char *file)
+ { return(*(int *)0); }
+
#undef scr_set
int scr_set(
const char *file)
@@ -2182,6 +2480,16 @@ void delscreen(
SCREEN *sp)
{ /* void */ }
+#undef _nc_setupscreen_sp
+int _nc_setupscreen_sp(
+ SCREEN **spp,
+ int slines,
+ int scolumns,
+ FILE *output,
+ NCURSES_BOOL filtered,
+ int slk_format)
+ { return(*(int *)0); }
+
#undef _nc_setupscreen
int _nc_setupscreen(
int slines,
@@ -2191,6 +2499,15 @@ int _nc_setupscreen(
int slk_format)
{ return(*(int *)0); }
+#undef _nc_ripoffline_sp
+int _nc_ripoffline_sp(
+ SCREEN *sp,
+ int line,
+ int (*init)(
+ WINDOW *p1,
+ int p2))
+ { return(*(int *)0); }
+
#undef _nc_ripoffline
int _nc_ripoffline(
int line,
@@ -2199,6 +2516,15 @@ int _nc_ripoffline(
int p2))
{ return(*(int *)0); }
+#undef ripoffline_sp
+int ripoffline_sp(
+ SCREEN *sp,
+ int line,
+ int (*init)(
+ WINDOW *p1,
+ int p2))
+ { return(*(int *)0); }
+
#undef ripoffline
int ripoffline(
int line,
@@ -2209,18 +2535,37 @@ int ripoffline(
/* ./base/lib_slk.c */
+#undef _nc_format_slks
+int _nc_format_slks(
+ SCREEN *sp,
+ int cols)
+ { return(*(int *)0); }
+
#undef _nc_slk_initialize
int _nc_slk_initialize(
WINDOW *stwin,
int cols)
{ return(*(int *)0); }
+#undef slk_restore_sp
+int slk_restore_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_restore
int slk_restore(void)
{ return(*(int *)0); }
/* ./base/lib_slkatr_set.c */
+#undef slk_attr_set_sp
+int slk_attr_set_sp(
+ SCREEN *sp,
+ const attr_t attr,
+ short color_pair_number,
+ void *opts)
+ { return(*(int *)0); }
+
#undef slk_attr_set
int slk_attr_set(
const attr_t attr,
@@ -2230,6 +2575,12 @@ int slk_attr_set(
/* ./base/lib_slkatrof.c */
+#undef slk_attroff_sp
+int slk_attroff_sp(
+ SCREEN *sp,
+ const chtype attr)
+ { return(*(int *)0); }
+
#undef slk_attroff
int slk_attroff(
const chtype attr)
@@ -2237,6 +2588,12 @@ int slk_attroff(
/* ./base/lib_slkatron.c */
+#undef slk_attron_sp
+int slk_attron_sp(
+ SCREEN *sp,
+ const chtype attr)
+ { return(*(int *)0); }
+
#undef slk_attron
int slk_attron(
const chtype attr)
@@ -2244,6 +2601,12 @@ int slk_attron(
/* ./base/lib_slkatrset.c */
+#undef slk_attrset_sp
+int slk_attrset_sp(
+ SCREEN *sp,
+ const chtype attr)
+ { return(*(int *)0); }
+
#undef slk_attrset
int slk_attrset(
const chtype attr)
@@ -2251,18 +2614,34 @@ int slk_attrset(
/* ./base/lib_slkattr.c */
+#undef slk_attr_sp
+attr_t slk_attr_sp(
+ SCREEN *sp)
+ { return(*(attr_t *)0); }
+
#undef slk_attr
attr_t slk_attr(void)
{ return(*(attr_t *)0); }
/* ./base/lib_slkclear.c */
+#undef slk_clear_sp
+int slk_clear_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_clear
int slk_clear(void)
{ return(*(int *)0); }
/* ./base/lib_slkcolor.c */
+#undef slk_color_sp
+int slk_color_sp(
+ SCREEN *sp,
+ short color_pair_number)
+ { return(*(int *)0); }
+
#undef slk_color
int slk_color(
short color_pair_number)
@@ -2270,6 +2649,12 @@ int slk_color(
/* ./base/lib_slkinit.c */
+#undef slk_init_sp
+int slk_init_sp(
+ SCREEN *sp,
+ int format)
+ { return(*(int *)0); }
+
#undef slk_init
int slk_init(
int format)
@@ -2277,6 +2662,12 @@ int slk_init(
/* ./base/lib_slklab.c */
+#undef slk_label_sp
+char *slk_label_sp(
+ SCREEN *sp,
+ int n)
+ { return(*(char **)0); }
+
#undef slk_label
char *slk_label(
int n)
@@ -2284,10 +2675,20 @@ char *slk_label(
/* ./base/lib_slkrefr.c */
+#undef slk_noutrefresh_sp
+int slk_noutrefresh_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_noutrefresh
int slk_noutrefresh(void)
{ return(*(int *)0); }
+#undef slk_refresh_sp
+int slk_refresh_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_refresh
int slk_refresh(void)
{ return(*(int *)0); }
@@ -2296,6 +2697,14 @@ int slk_refresh(void)
#include <wctype.h>
+#undef slk_set_sp
+int slk_set_sp(
+ SCREEN *sp,
+ int i,
+ const char *astr,
+ int format)
+ { return(*(int *)0); }
+
#undef slk_set
int slk_set(
int i,
@@ -2305,6 +2714,11 @@ int slk_set(
/* ./base/lib_slktouch.c */
+#undef slk_touch_sp
+int slk_touch_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef slk_touch
int slk_touch(void)
{ return(*(int *)0); }
@@ -2346,6 +2760,12 @@ char *_nc_tracemouse(
MEVENT const *ep)
{ return(*(char **)0); }
+#undef _nc_retrace_mmask_t
+mmask_t _nc_retrace_mmask_t(
+ SCREEN *sp,
+ mmask_t code)
+ { return(*(mmask_t *)0); }
+
#undef _tracemouse
char *_tracemouse(
MEVENT const *ep)
@@ -2367,8 +2787,8 @@ void _nc_fifo_dump(
SCREEN *sp)
{ /* void */ }
-#undef _nc_ungetch
-int _nc_ungetch(
+#undef ungetch_sp
+int ungetch_sp(
SCREEN *sp,
int ch)
{ return(*(int *)0); }
@@ -2380,11 +2800,23 @@ int ungetch(
/* ./tty/lib_vidattr.c */
+#undef vidputs_sp
+int vidputs_sp(
+ SCREEN *sp,
+ chtype newmode,
+ NCURSES_OUTC_sp outc)
+ { return(*(int *)0); }
+
#undef vidputs
int vidputs(
chtype newmode,
- int (*outc)(
- int p1))
+ NCURSES_OUTC outc)
+ { return(*(int *)0); }
+
+#undef vidattr_sp
+int vidattr_sp(
+ SCREEN *sp,
+ chtype newmode)
{ return(*(int *)0); }
#undef vidattr
@@ -2392,6 +2824,11 @@ int vidattr(
chtype newmode)
{ return(*(int *)0); }
+#undef termattrs_sp
+chtype termattrs_sp(
+ SCREEN *sp)
+ { return(*(chtype *)0); }
+
#undef termattrs
chtype termattrs(void)
{ return(*(chtype *)0); }
@@ -2472,12 +2909,24 @@ WINDOW *dupwin(
/* ./base/nc_panel.c */
+#undef _nc_panelhook_sp
+struct panelhook *_nc_panelhook_sp(
+ SCREEN *sp)
+ { return(*(struct panelhook **)0); }
+
#undef _nc_panelhook
struct panelhook *_nc_panelhook(void)
{ return(*(struct panelhook **)0); }
/* ./base/safe_sprintf.c */
+#undef _nc_printf_string_sp
+char *_nc_printf_string_sp(
+ SCREEN *sp,
+ const char *fmt,
+ va_list ap)
+ { return(*(char **)0); }
+
#undef _nc_printf_string
char *_nc_printf_string(
const char *fmt,
@@ -2489,10 +2938,24 @@ char *_nc_printf_string(
#include <sys/time.h>
#include <sys/times.h>
+#undef doupdate_sp
+int doupdate_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef doupdate
int doupdate(void)
{ return(*(int *)0); }
+#undef _nc_scrolln_sp
+int _nc_scrolln_sp(
+ SCREEN *sp,
+ int n,
+ int top,
+ int bot,
+ int maxy)
+ { return(*(int *)0); }
+
#undef _nc_scrolln
int _nc_scrolln(
int n,
@@ -2501,18 +2964,39 @@ int _nc_scrolln(
int maxy)
{ return(*(int *)0); }
+#undef _nc_screen_resume_sp
+void _nc_screen_resume_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_screen_resume
void _nc_screen_resume(void)
{ /* void */ }
+#undef _nc_screen_init_sp
+void _nc_screen_init_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_screen_init
void _nc_screen_init(void)
{ /* void */ }
+#undef _nc_screen_wrap_sp
+void _nc_screen_wrap_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_screen_wrap
void _nc_screen_wrap(void)
{ /* void */ }
+#undef _nc_do_xmc_glitch_sp
+void _nc_do_xmc_glitch_sp(
+ SCREEN *sp,
+ attr_t previous)
+ { /* void */ }
+
#undef _nc_do_xmc_glitch
void _nc_do_xmc_glitch(
attr_t previous)
@@ -2544,12 +3028,16 @@ void _nc_vsscanf(void)
/* ./base/lib_freeall.c */
-#include <term_entry.h>
-
#undef _nc_freeall
void _nc_freeall(void)
{ /* void */ }
+#undef _nc_free_and_exit_sp
+void _nc_free_and_exit_sp(
+ SCREEN *sp,
+ int code)
+ { /* void */ }
+
#undef _nc_free_and_exit
void _nc_free_and_exit(
int code)
@@ -2678,6 +3166,12 @@ int win_wchnstr(
/* ./widechar/lib_ins_wch.c */
+#undef _nc_insert_wch
+int _nc_insert_wch(
+ WINDOW *win,
+ const cchar_t *wch)
+ { return(*(int *)0); }
+
#undef wins_wch
int wins_wch(
WINDOW *win,
@@ -2739,6 +3233,12 @@ size_t _nc_wcrtomb(
mbstate_t *state)
{ return(*(size_t *)0); }
+#undef unget_wch_sp
+int unget_wch_sp(
+ SCREEN *sp,
+ const wchar_t wch)
+ { return(*(int *)0); }
+
#undef unget_wch
int unget_wch(
const wchar_t wch)
@@ -2746,13 +3246,29 @@ int unget_wch(
/* ./widechar/lib_vid_attr.c */
+#undef vid_puts_sp
+int vid_puts_sp(
+ SCREEN *sp,
+ attr_t newmode,
+ short pair,
+ void *opts,
+ NCURSES_OUTC_sp outc)
+ { return(*(int *)0); }
+
#undef vid_puts
int vid_puts(
attr_t newmode,
short pair,
void *opts,
- int (*outc)(
- int p1))
+ NCURSES_OUTC outc)
+ { return(*(int *)0); }
+
+#undef vid_attr_sp
+int vid_attr_sp(
+ SCREEN *sp,
+ attr_t newmode,
+ short pair,
+ void *opts)
{ return(*(int *)0); }
#undef vid_attr
@@ -2762,6 +3278,11 @@ int vid_attr(
void *opts)
{ return(*(int *)0); }
+#undef term_attrs_sp
+attr_t term_attrs_sp(
+ SCREEN *sp)
+ { return(*(attr_t *)0); }
+
#undef term_attrs
attr_t term_attrs(void)
{ return(*(attr_t *)0); }
@@ -2786,6 +3307,12 @@ void _nc_init_wacs(void)
/* ./widechar/lib_wunctrl.c */
+#undef wunctrl_sp
+wchar_t *wunctrl_sp(
+ SCREEN *sp,
+ cchar_t *wc)
+ { return(*(wchar_t **)0); }
+
#undef wunctrl
wchar_t *wunctrl(
cchar_t *wc)
@@ -2805,6 +3332,24 @@ void _nc_toggle_attr_off(
attr_t at)
{ /* void */ }
+#undef _nc_DelCharCost_sp
+int _nc_DelCharCost_sp(
+ SCREEN *sp,
+ int count)
+ { return(*(int *)0); }
+
+#undef _nc_InsCharCost_sp
+int _nc_InsCharCost_sp(
+ SCREEN *sp,
+ int count)
+ { return(*(int *)0); }
+
+#undef _nc_UpdateAttrs_sp
+void _nc_UpdateAttrs_sp(
+ SCREEN *sp,
+ const cchar_t *c)
+ { /* void */ }
+
#undef _nc_DelCharCost
int _nc_DelCharCost(
int count)
@@ -2817,11 +3362,17 @@ int _nc_InsCharCost(
#undef _nc_UpdateAttrs
void _nc_UpdateAttrs(
- cchar_t c)
+ const cchar_t *c)
{ /* void */ }
/* ./base/legacy_coding.c */
+#undef use_legacy_coding_sp
+int use_legacy_coding_sp(
+ SCREEN *sp,
+ int level)
+ { return(*(int *)0); }
+
#undef use_legacy_coding
int use_legacy_coding(
int level)
@@ -2829,10 +3380,22 @@ int use_legacy_coding(
/* ./base/lib_dft_fgbg.c */
+#undef use_default_colors_sp
+int use_default_colors_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef use_default_colors
int use_default_colors(void)
{ return(*(int *)0); }
+#undef assume_default_colors_sp
+int assume_default_colors_sp(
+ SCREEN *sp,
+ int fg,
+ int bg)
+ { return(*(int *)0); }
+
#undef assume_default_colors
int assume_default_colors(
int fg,
@@ -2841,6 +3404,13 @@ int assume_default_colors(
/* ./tinfo/lib_print.c */
+#undef mcprint_sp
+int mcprint_sp(
+ SCREEN *sp,
+ char *data,
+ int len)
+ { return(*(int *)0); }
+
#undef mcprint
int mcprint(
char *data,
@@ -2849,18 +3419,39 @@ int mcprint(
/* ./base/resizeterm.c */
+#undef is_term_resized_sp
+NCURSES_BOOL is_term_resized_sp(
+ SCREEN *sp,
+ int ToLines,
+ int ToCols)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef is_term_resized
NCURSES_BOOL is_term_resized(
int ToLines,
int ToCols)
{ return(*(NCURSES_BOOL *)0); }
+#undef resize_term_sp
+int resize_term_sp(
+ SCREEN *sp,
+ int ToLines,
+ int ToCols)
+ { return(*(int *)0); }
+
#undef resize_term
int resize_term(
int ToLines,
int ToCols)
{ return(*(int *)0); }
+#undef resizeterm_sp
+int resizeterm_sp(
+ SCREEN *sp,
+ int ToLines,
+ int ToCols)
+ { return(*(int *)0); }
+
#undef resizeterm
int resizeterm(
int ToLines,
@@ -2903,9 +3494,6 @@ int wresize(
/* ./tinfo/access.c */
-#include <sys/stat.h>
-#include <nc_alloc.h>
-
#undef _nc_rootname
char *_nc_rootname(
char *path)
@@ -2978,7 +3566,32 @@ char *const numcodes[] = {0};
#undef strcodes
char *const strcodes[] = {0};
+/* ./comp_captab.c */
+
+#include <hashsize.h>
+
+#undef _nc_get_table
+const struct name_table_entry *_nc_get_table(
+ NCURSES_BOOL termcap)
+ { return(*(const struct name_table_entry **)0); }
+
+#undef _nc_get_hash_table
+const HashValue *_nc_get_hash_table(
+ NCURSES_BOOL termcap)
+ { return(*(const HashValue **)0); }
+
+#undef _nc_get_alias_table
+const struct alias *_nc_get_alias_table(
+ NCURSES_BOOL termcap)
+ { return(*(const struct alias **)0); }
+
+#undef _nc_get_hash_info
+const HashData *_nc_get_hash_info(
+ NCURSES_BOOL termcap)
+ { return(*(const HashData **)0); }
+
/* ./tinfo/comp_error.c */
+
#undef _nc_suppress_warnings
NCURSES_BOOL _nc_suppress_warnings;
#undef _nc_curr_line
@@ -3023,6 +3636,21 @@ void _nc_syserr_abort(
...)
{ /* void */ }
+/* ./tinfo/comp_hash.c */
+
+#undef _nc_find_entry
+struct name_table_entry const *_nc_find_entry(
+ const char *string,
+ const HashValue *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,
+ NCURSES_BOOL termcap)
+ { return(*(struct name_table_entry const **)0); }
+
/* ./tinfo/db_iterator.c */
#undef _nc_tic_dir
@@ -3143,6 +3771,11 @@ void _nc_init_keytry(
#undef acs_map
chtype acs_map[128];
+#undef _nc_init_acs_sp
+void _nc_init_acs_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_init_acs
void _nc_init_acs(void)
{ /* void */ }
@@ -3166,6 +3799,11 @@ int _nc_ospeed(
int BaudRate)
{ return(*(int *)0); }
+#undef baudrate_sp
+int baudrate_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef baudrate
int baudrate(void)
{ return(*(int *)0); }
@@ -3175,11 +3813,23 @@ int baudrate(void)
#undef cur_term
TERMINAL *cur_term;
+#undef set_curterm_sp
+TERMINAL *set_curterm_sp(
+ SCREEN *sp,
+ TERMINAL *termp)
+ { return(*(TERMINAL **)0); }
+
#undef set_curterm
TERMINAL *set_curterm(
TERMINAL *termp)
{ return(*(TERMINAL **)0); }
+#undef del_curterm_sp
+int del_curterm_sp(
+ SCREEN *sp,
+ TERMINAL *termp)
+ { return(*(int *)0); }
+
#undef del_curterm
int del_curterm(
TERMINAL *termp)
@@ -3202,26 +3852,56 @@ NCURSES_GLOBALS _nc_globals;
#undef _nc_prescreen
NCURSES_PRESCREEN _nc_prescreen;
+#undef _nc_screen_of
+SCREEN *_nc_screen_of(
+ WINDOW *win)
+ { return(*(SCREEN **)0); }
+
/* ./tinfo/lib_has_cap.c */
+#undef has_ic_sp
+NCURSES_BOOL has_ic_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef has_ic
NCURSES_BOOL has_ic(void)
{ return(*(NCURSES_BOOL *)0); }
+#undef has_il_sp
+NCURSES_BOOL has_il_sp(
+ SCREEN *sp)
+ { return(*(NCURSES_BOOL *)0); }
+
#undef has_il
NCURSES_BOOL has_il(void)
{ return(*(NCURSES_BOOL *)0); }
/* ./tinfo/lib_kernel.c */
+#undef erasechar_sp
+char erasechar_sp(
+ SCREEN *sp)
+ { return(*(char *)0); }
+
#undef erasechar
char erasechar(void)
{ return(*(char *)0); }
+#undef killchar_sp
+char killchar_sp(
+ SCREEN *sp)
+ { return(*(char *)0); }
+
#undef killchar
char killchar(void)
{ return(*(char *)0); }
+#undef flushinp_sp
+int flushinp_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef flushinp
int flushinp(void)
{ return(*(int *)0); }
@@ -3230,8 +3910,8 @@ int flushinp(void)
struct kn { short offset; int code; };
-#undef _nc_keyname
-char *_nc_keyname(
+#undef keyname_sp
+char *keyname_sp(
SCREEN *sp,
int c)
{ return(*(char **)0); }
@@ -3251,6 +3931,12 @@ char *longname(void)
#include <time.h>
+#undef napms_sp
+int napms_sp(
+ SCREEN *sp,
+ int ms)
+ { return(*(int *)0); }
+
#undef napms
int napms(
int ms)
@@ -3270,6 +3956,12 @@ void idcok(
NCURSES_BOOL flag)
{ /* void */ }
+#undef halfdelay_sp
+int halfdelay_sp(
+ SCREEN *sp,
+ int t)
+ { return(*(int *)0); }
+
#undef halfdelay
int halfdelay(
int t)
@@ -3305,21 +3997,46 @@ int meta(
NCURSES_BOOL flag)
{ return(*(int *)0); }
+#undef curs_set_sp
+int curs_set_sp(
+ SCREEN *sp,
+ int vis)
+ { return(*(int *)0); }
+
#undef curs_set
int curs_set(
int vis)
{ return(*(int *)0); }
+#undef typeahead_sp
+int typeahead_sp(
+ SCREEN *sp,
+ int fd)
+ { return(*(int *)0); }
+
#undef typeahead
int typeahead(
int fd)
{ return(*(int *)0); }
+#undef has_key_sp
+int has_key_sp(
+ SCREEN *sp,
+ int keycode)
+ { return(*(int *)0); }
+
#undef has_key
int has_key(
int keycode)
{ return(*(int *)0); }
+#undef _nc_putp_flush_sp
+int _nc_putp_flush_sp(
+ SCREEN *sp,
+ const char *name,
+ const char *value)
+ { return(*(int *)0); }
+
#undef _nc_keypad
int _nc_keypad(
SCREEN *sp,
@@ -3328,30 +4045,67 @@ int _nc_keypad(
/* ./tinfo/lib_raw.c */
+#undef raw_sp
+int raw_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef raw
int raw(void)
{ return(*(int *)0); }
+#undef cbreak_sp
+int cbreak_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef cbreak
int cbreak(void)
{ return(*(int *)0); }
+#undef qiflush_sp
+void qiflush_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef qiflush
void qiflush(void)
{ /* void */ }
+#undef noraw_sp
+int noraw_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef noraw
int noraw(void)
{ return(*(int *)0); }
+#undef nocbreak_sp
+int nocbreak_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef nocbreak
int nocbreak(void)
{ return(*(int *)0); }
+#undef noqiflush_sp
+void noqiflush_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef noqiflush
void noqiflush(void)
{ /* void */ }
+#undef intrflush_sp
+int intrflush_sp(
+ SCREEN *sp,
+ WINDOW *win,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
#undef intrflush
int intrflush(
WINDOW *win,
@@ -3373,6 +4127,12 @@ int COLS;
#undef TABSIZE
int TABSIZE;
+#undef set_tabsize_sp
+int set_tabsize_sp(
+ SCREEN *sp,
+ int value)
+ { return(*(int *)0); }
+
#undef set_tabsize
int set_tabsize(
int value)
@@ -3383,6 +4143,12 @@ int _nc_handle_sigwinch(
SCREEN *sp)
{ return(*(int *)0); }
+#undef use_env_sp
+void use_env_sp(
+ SCREEN *sp,
+ NCURSES_BOOL f)
+ { /* void */ }
+
#undef use_env
void use_env(
NCURSES_BOOL f)
@@ -3400,6 +4166,18 @@ void _nc_update_screensize(
SCREEN *sp)
{ /* void */ }
+#undef _nc_setup_tinfo
+int _nc_setup_tinfo(
+ const char *const tn,
+ TERMTYPE *const tp)
+ { return(*(int *)0); }
+
+#undef _nc_tinfo_cmdch
+void _nc_tinfo_cmdch(
+ TERMINAL *termp,
+ char proto)
+ { /* void */ }
+
#undef _nc_get_locale
char *_nc_get_locale(void)
{ return(*(char **)0); }
@@ -3421,6 +4199,10 @@ int _nc_setupterm(
NCURSES_BOOL reuse)
{ return(*(int *)0); }
+#undef new_prescr
+SCREEN *new_prescr(void)
+ { return(*(SCREEN **)0); }
+
#undef setupterm
int setupterm(
char *tname,
@@ -3435,8 +4217,9 @@ char *UP;
#undef BC
char *BC;
-#undef tgetent
-int tgetent(
+#undef tgetent_sp
+int tgetent_sp(
+ SCREEN *sp,
char *bufp,
const char *name)
{ return(*(int *)0); }
@@ -3447,16 +4230,41 @@ int tgetent(
#endif
+#undef tgetent
+int tgetent(
+ char *bufp,
+ const char *name)
+ { return(*(int *)0); }
+
+#undef tgetflag_sp
+int tgetflag_sp(
+ SCREEN *sp,
+ char *id)
+ { return(*(int *)0); }
+
#undef tgetflag
int tgetflag(
char *id)
{ return(*(int *)0); }
+#undef tgetnum_sp
+int tgetnum_sp(
+ SCREEN *sp,
+ char *id)
+ { return(*(int *)0); }
+
#undef tgetnum
int tgetnum(
char *id)
{ return(*(int *)0); }
+#undef tgetstr_sp
+char *tgetstr_sp(
+ SCREEN *sp,
+ char *id,
+ char **area)
+ { return(*(char **)0); }
+
#undef tgetstr
char *tgetstr(
char *id,
@@ -3465,6 +4273,11 @@ char *tgetstr(
/* ./tinfo/lib_termname.c */
+#undef termname_sp
+char *termname_sp(
+ SCREEN *sp)
+ { return(*(char **)0); }
+
#undef termname
char *termname(void)
{ return(*(char **)0); }
@@ -3480,16 +4293,34 @@ char *tgoto(
/* ./tinfo/lib_ti.c */
+#undef tigetflag_sp
+int tigetflag_sp(
+ SCREEN *sp,
+ char *str)
+ { return(*(int *)0); }
+
#undef tigetflag
int tigetflag(
char *str)
{ return(*(int *)0); }
+#undef tigetnum_sp
+int tigetnum_sp(
+ SCREEN *sp,
+ char *str)
+ { return(*(int *)0); }
+
#undef tigetnum
int tigetnum(
char *str)
{ return(*(int *)0); }
+#undef tigetstr_sp
+char *tigetstr_sp(
+ SCREEN *sp,
+ char *str)
+ { return(*(char **)0); }
+
#undef tigetstr
char *tigetstr(
char *str)
@@ -3513,6 +4344,12 @@ char *tparm(
...)
{ return(*(char **)0); }
+#undef tiparm
+char *tiparm(
+ const char *string,
+ ...)
+ { return(*(char **)0); }
+
/* ./tinfo/lib_tputs.c */
#undef PC
@@ -3527,25 +4364,75 @@ void _nc_set_no_padding(
SCREEN *sp)
{ /* void */ }
+#undef delay_output_sp
+int delay_output_sp(
+ SCREEN *sp,
+ int ms)
+ { return(*(int *)0); }
+
#undef delay_output
int delay_output(
int ms)
{ return(*(int *)0); }
+#undef _nc_flush_sp
+void _nc_flush_sp(
+ SCREEN *sp)
+ { /* void */ }
+
#undef _nc_flush
void _nc_flush(void)
{ /* void */ }
+#undef _nc_outch_sp
+int _nc_outch_sp(
+ SCREEN *sp,
+ int ch)
+ { return(*(int *)0); }
+
#undef _nc_outch
int _nc_outch(
int ch)
{ return(*(int *)0); }
+#undef putp_sp
+int putp_sp(
+ SCREEN *sp,
+ const char *string)
+ { return(*(int *)0); }
+
+#undef _nc_putp_sp
+int _nc_putp_sp(
+ SCREEN *sp,
+ const char *name,
+ const char *string)
+ { return(*(int *)0); }
+
#undef putp
int putp(
const char *string)
{ return(*(int *)0); }
+#undef _nc_putp
+int _nc_putp(
+ const char *name,
+ const char *string)
+ { return(*(int *)0); }
+
+#undef tputs_sp
+int tputs_sp(
+ SCREEN *sp,
+ const char *string,
+ int affcnt,
+ NCURSES_OUTC_sp outc)
+ { return(*(int *)0); }
+
+#undef _nc_outc_wrapper
+int _nc_outc_wrapper(
+ SCREEN *sp,
+ int c)
+ { return(*(int *)0); }
+
#undef tputs
int tputs(
const char *string,
@@ -3579,6 +4466,11 @@ NCURSES_BOOL _nc_retrace_bool(
NCURSES_BOOL code)
{ return(*(NCURSES_BOOL *)0); }
+#undef _nc_retrace_char
+char _nc_retrace_char(
+ char code)
+ { return(*(char *)0); }
+
#undef _nc_retrace_int
int _nc_retrace_int(
int code)
@@ -3632,6 +4524,11 @@ char *_traceattr(
attr_t newmode)
{ return(*(char **)0); }
+#undef _nc_retrace_int_attr_t
+int _nc_retrace_int_attr_t(
+ attr_t code)
+ { return(*(int *)0); }
+
#undef _nc_retrace_attr_t
attr_t _nc_retrace_attr_t(
attr_t code)
@@ -3701,36 +4598,78 @@ char *_tracechar(
/* ./tinfo/lib_ttyflags.c */
+#undef _nc_get_tty_mode_sp
+int _nc_get_tty_mode_sp(
+ SCREEN *sp,
+ struct termios *buf)
+ { return(*(int *)0); }
+
#undef _nc_get_tty_mode
int _nc_get_tty_mode(
struct termios *buf)
{ return(*(int *)0); }
+#undef _nc_set_tty_mode_sp
+int _nc_set_tty_mode_sp(
+ SCREEN *sp,
+ struct termios *buf)
+ { return(*(int *)0); }
+
#undef _nc_set_tty_mode
int _nc_set_tty_mode(
struct termios *buf)
{ return(*(int *)0); }
+#undef def_shell_mode_sp
+int def_shell_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef def_shell_mode
int def_shell_mode(void)
{ return(*(int *)0); }
+#undef def_prog_mode_sp
+int def_prog_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef def_prog_mode
int def_prog_mode(void)
{ return(*(int *)0); }
+#undef reset_prog_mode_sp
+int reset_prog_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef reset_prog_mode
int reset_prog_mode(void)
{ return(*(int *)0); }
+#undef reset_shell_mode_sp
+int reset_shell_mode_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef reset_shell_mode
int reset_shell_mode(void)
{ return(*(int *)0); }
+#undef savetty_sp
+int savetty_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef savetty
int savetty(void)
{ return(*(int *)0); }
+#undef resetty_sp
+int resetty_sp(
+ SCREEN *sp)
+ { return(*(int *)0); }
+
#undef resetty
int resetty(void)
{ return(*(int *)0); }
@@ -3810,6 +4749,13 @@ int _nc_read_termcap_entry(
/* ./tinfo/setbuf.c */
+#undef _nc_set_buffer_sp
+void _nc_set_buffer_sp(
+ SCREEN *sp,
+ FILE *ofp,
+ NCURSES_BOOL buffered)
+ { /* void */ }
+
#undef _nc_set_buffer
void _nc_set_buffer(
FILE *ofp,
@@ -3901,8 +4847,8 @@ char *_nc_trim_sgr0(
/* ./unctrl.c */
-#undef _nc_unctrl
-char *_nc_unctrl(
+#undef unctrl_sp
+char *unctrl_sp(
SCREEN *sp,
chtype ch)
{ return(*(char **)0); }
@@ -4011,25 +4957,6 @@ char *_nc_infotocap(
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
@@ -4039,21 +4966,6 @@ char *_nc_tic_expand(
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
@@ -4173,6 +5085,13 @@ int _nc_tic_written(void)
/* ./base/define_key.c */
+#undef define_key_sp
+int define_key_sp(
+ SCREEN *sp,
+ const char *str,
+ int keycode)
+ { return(*(int *)0); }
+
#undef define_key
int define_key(
const char *str,
@@ -4187,6 +5106,12 @@ void _nc_hashed_db(void)
/* ./base/key_defined.c */
+#undef key_defined_sp
+int key_defined_sp(
+ SCREEN *sp,
+ const char *str)
+ { return(*(int *)0); }
+
#undef key_defined
int key_defined(
const char *str)
@@ -4194,6 +5119,13 @@ int key_defined(
/* ./base/keybound.c */
+#undef keybound_sp
+char *keybound_sp(
+ SCREEN *sp,
+ int code,
+ int count)
+ { return(*(char **)0); }
+
#undef keybound
char *keybound(
int code,
@@ -4202,6 +5134,13 @@ char *keybound(
/* ./base/keyok.c */
+#undef keyok_sp
+int keyok_sp(
+ SCREEN *sp,
+ int c,
+ NCURSES_BOOL flag)
+ { return(*(int *)0); }
+
#undef keyok
int keyok(
int c,
diff --git a/contrib/ncurses/ncurses/modules b/contrib/ncurses/ncurses/modules
index f28ef81a3b33..caf1799fa87d 100644
--- a/contrib/ncurses/ncurses/modules
+++ b/contrib/ncurses/ncurses/modules
@@ -1,6 +1,6 @@
-# $Id: modules,v 1.112 2007/09/08 22:03:34 tom Exp $
+# $Id: modules,v 1.117 2010/08/07 18:41:02 tom Exp $
##############################################################################
-# Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), #
@@ -32,201 +32,213 @@
@ base
# Library objects
-hardscroll lib $(serial)
-hashmap lib $(serial) ../include/term.h
-lib_addch lib $(base)
-lib_addstr lib $(base)
-lib_beep lib $(base) ../include/term.h
-lib_bkgd lib $(base)
-lib_box lib $(base)
-lib_chgat lib $(base)
-lib_clear lib $(base)
-lib_clearok lib $(base)
-lib_clrbot lib $(base)
-lib_clreol lib $(base)
-lib_color lib $(base) ../include/term.h
-lib_colorset lib $(base)
-lib_delch lib $(base)
-lib_delwin lib $(base)
-lib_echo lib $(base)
-lib_endwin lib $(base) ../include/term.h
-lib_erase lib $(base)
-lib_flash lib $(base) ../include/term.h
-lib_gen lib . ../include/curses.h
-lib_getch lib $(base)
-lib_getstr lib $(base) ../include/term.h
-lib_hline lib $(base)
-lib_immedok lib $(base)
-lib_inchstr lib $(base)
-lib_initscr lib $(base) $(INCDIR)/tic.h
-lib_insch lib $(base)
-lib_insdel lib $(base)
-lib_insnstr lib $(base)
-lib_instr lib $(base)
-lib_isendwin lib $(base)
-lib_leaveok lib $(base)
-lib_mouse lib $(base) ../include/term.h
-lib_move lib $(base)
-lib_mvcur lib $(serial) ../include/term.h $(INCDIR)/tic.h
-lib_mvwin lib $(base)
-lib_newterm lib $(base) ../include/term.h
-lib_newwin lib $(base)
-lib_nl lib $(base)
-lib_overlay lib $(base)
-lib_pad lib $(base)
-lib_printw lib $(base)
-lib_redrawln lib $(base)
-lib_refresh lib $(base)
-lib_restart lib $(base) ../include/term.h
-lib_scanw lib $(base)
-lib_screen lib $(base) ../include/term.h
-lib_scroll lib $(base)
-lib_scrollok lib $(base)
-lib_scrreg lib $(base)
-lib_set_term lib $(base) ../include/term.h
-lib_slk lib $(base) ../include/term.h
-lib_slkatr_set lib $(base)
-lib_slkatrof lib $(base)
-lib_slkatron lib $(base)
-lib_slkatrset lib $(base)
-lib_slkattr lib $(base)
-lib_slkclear lib $(base)
-lib_slkcolor lib $(base)
-lib_slkinit lib $(base)
-lib_slklab lib $(base)
-lib_slkrefr lib $(base) ../include/term.h
-lib_slkset lib $(base)
-lib_slktouch lib $(base)
-lib_touch lib $(base)
-lib_tracedmp lib $(trace)
-lib_tracemse lib $(trace)
-lib_tstp lib $(serial) $(srcdir)/SigAction.h
-lib_ungetch lib $(base)
-lib_vidattr lib $(serial) ../include/term.h
-lib_vline lib $(base)
-lib_wattroff lib $(base)
-lib_wattron lib $(base)
-lib_winch lib $(base)
-lib_window lib $(base)
-link_test lib . ../include/curses.h
-nc_panel lib $(base)
-safe_sprintf lib $(base)
-tty_update lib $(serial) ../include/term.h
-varargs lib $(trace)
+hardscroll lib $(serial) $(HEADER_DEPS)
+hashmap lib $(serial) $(HEADER_DEPS)
+lib_addch lib $(base) $(HEADER_DEPS)
+lib_addstr lib $(base) $(HEADER_DEPS)
+lib_beep lib $(base) $(HEADER_DEPS)
+lib_bkgd lib $(base) $(HEADER_DEPS)
+lib_box lib $(base) $(HEADER_DEPS)
+lib_chgat lib $(base) $(HEADER_DEPS)
+lib_clear lib $(base) $(HEADER_DEPS)
+lib_clearok lib $(base) $(HEADER_DEPS)
+lib_clrbot lib $(base) $(HEADER_DEPS)
+lib_clreol lib $(base) $(HEADER_DEPS)
+lib_color lib $(base) $(HEADER_DEPS) $(INCDIR)/tic.h
+lib_colorset lib $(base) $(HEADER_DEPS)
+lib_delch lib $(base) $(HEADER_DEPS)
+lib_delwin lib $(base) $(HEADER_DEPS)
+lib_echo lib $(base) $(HEADER_DEPS)
+lib_endwin lib $(base) $(HEADER_DEPS)
+lib_erase lib $(base) $(HEADER_DEPS)
+lib_flash lib $(base) $(HEADER_DEPS)
+lib_gen lib . $(HEADER_DEPS)
+lib_getch lib $(base) $(HEADER_DEPS) $(srcdir)/fifo_defs.h
+lib_getstr lib $(base) $(HEADER_DEPS)
+lib_hline lib $(base) $(HEADER_DEPS)
+lib_immedok lib $(base) $(HEADER_DEPS)
+lib_inchstr lib $(base) $(HEADER_DEPS)
+lib_initscr lib $(base) $(HEADER_DEPS)
+lib_insch lib $(base) $(HEADER_DEPS)
+lib_insdel lib $(base) $(HEADER_DEPS)
+lib_insnstr lib $(base) $(HEADER_DEPS)
+lib_instr lib $(base) $(HEADER_DEPS)
+lib_isendwin lib $(base) $(HEADER_DEPS)
+lib_leaveok lib $(base) $(HEADER_DEPS)
+lib_mouse lib $(base) $(HEADER_DEPS) $(INCDIR)/tic.h
+lib_move lib $(base) $(HEADER_DEPS)
+lib_mvcur lib $(serial) $(HEADER_DEPS) $(INCDIR)/tic.h $(srcdir)/../progs/dump_entry.h
+lib_mvwin lib $(base) $(HEADER_DEPS)
+lib_newterm lib $(base) $(HEADER_DEPS) $(INCDIR)/tic.h
+lib_newwin lib $(base) $(HEADER_DEPS)
+lib_nl lib $(base) $(HEADER_DEPS)
+lib_overlay lib $(base) $(HEADER_DEPS)
+lib_pad lib $(base) $(HEADER_DEPS)
+lib_printw lib $(base) $(HEADER_DEPS)
+lib_redrawln lib $(base) $(HEADER_DEPS)
+lib_refresh lib $(base) $(HEADER_DEPS)
+lib_restart lib $(base) $(HEADER_DEPS)
+lib_scanw lib $(base) $(HEADER_DEPS)
+lib_screen lib $(base) $(HEADER_DEPS)
+lib_scroll lib $(base) $(HEADER_DEPS)
+lib_scrollok lib $(base) $(HEADER_DEPS)
+lib_scrreg lib $(base) $(HEADER_DEPS)
+lib_set_term lib $(base) $(HEADER_DEPS) $(INCDIR)/tic.h
+lib_slk lib $(base) $(HEADER_DEPS)
+lib_slkatr_set lib $(base) $(HEADER_DEPS)
+lib_slkatrof lib $(base) $(HEADER_DEPS)
+lib_slkatron lib $(base) $(HEADER_DEPS)
+lib_slkatrset lib $(base) $(HEADER_DEPS)
+lib_slkattr lib $(base) $(HEADER_DEPS)
+lib_slkclear lib $(base) $(HEADER_DEPS)
+lib_slkcolor lib $(base) $(HEADER_DEPS)
+lib_slkinit lib $(base) $(HEADER_DEPS)
+lib_slklab lib $(base) $(HEADER_DEPS)
+lib_slkrefr lib $(base) $(HEADER_DEPS)
+lib_slkset lib $(base) $(HEADER_DEPS)
+lib_slktouch lib $(base) $(HEADER_DEPS)
+lib_touch lib $(base) $(HEADER_DEPS)
+lib_tracedmp lib $(trace) $(HEADER_DEPS)
+lib_tracemse lib $(trace) $(HEADER_DEPS)
+lib_tstp lib $(serial) $(HEADER_DEPS) $(srcdir)/SigAction.h
+lib_ungetch lib $(base) $(HEADER_DEPS) $(srcdir)/fifo_defs.h
+lib_vidattr lib $(serial) $(HEADER_DEPS)
+lib_vline lib $(base) $(HEADER_DEPS)
+lib_wattroff lib $(base) $(HEADER_DEPS)
+lib_wattron lib $(base) $(HEADER_DEPS)
+lib_winch lib $(base) $(HEADER_DEPS)
+lib_window lib $(base) $(HEADER_DEPS)
+link_test lib . $(HEADER_DEPS)
+nc_panel lib $(base) $(HEADER_DEPS)
+safe_sprintf lib $(base) $(HEADER_DEPS)
+tty_update lib $(serial) $(HEADER_DEPS)
+varargs lib $(trace) $(HEADER_DEPS)
# Modules for porting
-memmove lib $(base)
-vsscanf lib $(base)
+memmove lib $(base) $(HEADER_DEPS)
+vsscanf lib $(base) $(HEADER_DEPS)
# actually an extension, but with its own configure option (--disable-leaks)
-lib_freeall lib $(base)
+lib_freeall lib $(base) $(HEADER_DEPS) $(INCDIR)/tic.h
# XSI extensions to the base library (wide-character)
@ widechar
-charable lib $(wide)
-lib_add_wch lib $(wide)
-lib_box_set lib $(wide)
-lib_cchar 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)
-lib_vid_attr lib $(wide) ../include/term.h
-lib_vline_set lib $(wide)
-lib_wacs lib $(wide)
-lib_wunctrl lib $(wide)
+charable lib $(wide) $(HEADER_DEPS)
+lib_add_wch lib $(wide) $(HEADER_DEPS)
+lib_box_set lib $(wide) $(HEADER_DEPS)
+lib_cchar lib $(wide) $(HEADER_DEPS)
+lib_erasewchar lib $(wide) $(HEADER_DEPS)
+lib_get_wch lib $(wide) $(HEADER_DEPS)
+lib_get_wstr lib $(wide) $(HEADER_DEPS)
+lib_hline_set lib $(wide) $(HEADER_DEPS)
+lib_in_wch lib $(wide) $(HEADER_DEPS)
+lib_in_wchnstr lib $(wide) $(HEADER_DEPS)
+lib_ins_wch lib $(wide) $(HEADER_DEPS)
+lib_inwstr lib $(wide) $(HEADER_DEPS)
+lib_key_name lib $(wide) $(HEADER_DEPS)
+lib_pecho_wchar lib $(wide) $(HEADER_DEPS)
+lib_slk_wset lib $(wide) $(HEADER_DEPS)
+lib_unget_wch lib $(wide) $(HEADER_DEPS)
+lib_vid_attr lib $(wide) $(HEADER_DEPS)
+lib_vline_set lib $(wide) $(HEADER_DEPS)
+lib_wacs lib $(wide) $(HEADER_DEPS)
+lib_wunctrl lib $(wide) $(HEADER_DEPS)
# Extensions to the base library
@ ext_funcs
-expanded lib .
-legacy_coding lib $(base) ../include/term.h
-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
+expanded lib . $(HEADER_DEPS)
+legacy_coding lib $(base) $(HEADER_DEPS)
+lib_dft_fgbg lib $(base) $(HEADER_DEPS)
+lib_print lib $(tinfo) $(HEADER_DEPS)
+resizeterm lib $(base) $(HEADER_DEPS)
+trace_xnames lib $(trace) $(HEADER_DEPS)
+use_screen lib $(tinfo) $(HEADER_DEPS)
+use_window lib $(base) $(HEADER_DEPS)
+wresize lib $(base) $(HEADER_DEPS)
# Support for termcap (and tic, etc.), which can be a separate library
@ termlib
-access lib $(tinfo)
-add_tries lib $(tinfo)
-alloc_ttype lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h
-codes lib .
-comp_error 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)
-home_terminfo lib $(tinfo)
-init_keytry lib $(tinfo) ../include/term.h $(INCDIR)/tic.h init_keytry.h
-lib_acs lib $(tinfo) ../include/term.h
-lib_baudrate lib $(tinfo) ../include/term.h
-lib_cur_term lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h
-lib_data lib $(tinfo)
-lib_has_cap lib $(tinfo) ../include/term.h
-lib_kernel lib $(tinfo) ../include/term.h
-lib_keyname lib . ../include/term.h
-lib_longname lib $(tinfo)
-lib_napms lib $(tinfo)
-lib_options lib $(tinfo) ../include/term.h
-lib_raw lib $(tinfo) ../include/term.h
-lib_setup lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h
-lib_termcap lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h $(INCDIR)/capdefaults.c
-lib_termname lib $(tinfo) $(INCDIR)/tic.h
-lib_tgoto lib $(tinfo) ../include/term.h $(INCDIR)/tic.h
-lib_ti lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h
-lib_tparm lib $(tinfo) ../include/term.h $(INCDIR)/tic.h
-lib_tputs lib $(tinfo) ../include/term.h $(INCDIR)/tic.h
-lib_trace lib $(trace) $(INCDIR)/tic.h
-lib_traceatr lib $(trace) ../include/term.h
-lib_tracebits lib $(trace) ../include/term.h
-lib_tracechr lib $(trace)
-lib_ttyflags lib $(tinfo) ../include/term.h
-lib_twait lib $(serial)
-name_match lib $(tinfo) ../include/term.h $(INCDIR)/tic.h
-names lib .
-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)
-strings lib $(tinfo)
-trace_buf lib $(trace)
-trace_tries lib $(trace)
-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
+access lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+add_tries lib $(tinfo) $(HEADER_DEPS)
+alloc_ttype lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+codes lib . $(HEADER_DEPS)
+comp_captab lib . $(HEADER_DEPS) $(INCDIR)/tic.h ../include/hashsize.h
+comp_error lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+comp_hash lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h ../include/hashsize.h
+db_iterator lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+doalloc lib $(tinfo) $(HEADER_DEPS)
+entries lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+fallback lib . $(HEADER_DEPS)
+free_ttype lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+getenv_num lib $(tinfo) $(HEADER_DEPS)
+home_terminfo lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+init_keytry lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h init_keytry.h
+lib_acs lib $(tinfo) $(HEADER_DEPS)
+lib_baudrate lib $(tinfo) $(HEADER_DEPS) ../include/termcap.h
+lib_cur_term lib $(tinfo) $(HEADER_DEPS) ../include/termcap.h
+lib_data lib $(tinfo) $(HEADER_DEPS)
+lib_has_cap lib $(tinfo) $(HEADER_DEPS)
+lib_kernel lib $(tinfo) $(HEADER_DEPS)
+lib_keyname lib . $(HEADER_DEPS) $(INCDIR)/tic.h
+lib_longname lib $(tinfo) $(HEADER_DEPS)
+lib_napms lib $(tinfo) $(HEADER_DEPS)
+lib_options lib $(tinfo) $(HEADER_DEPS)
+lib_raw lib $(tinfo) $(HEADER_DEPS)
+lib_setup lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+lib_termcap lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h ../include/termcap.h $(INCDIR)/capdefaults.c
+lib_termname lib $(tinfo) $(HEADER_DEPS)
+lib_tgoto lib $(tinfo) $(HEADER_DEPS) ../include/termcap.h
+lib_ti lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+lib_tparm lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+lib_tputs lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h ../include/termcap.h
+lib_trace lib $(trace) $(HEADER_DEPS) $(INCDIR)/tic.h
+lib_traceatr lib $(trace) $(HEADER_DEPS)
+lib_tracebits lib $(trace) $(HEADER_DEPS)
+lib_tracechr lib $(trace) $(HEADER_DEPS)
+lib_ttyflags lib $(tinfo) $(HEADER_DEPS)
+lib_twait lib $(serial) $(HEADER_DEPS)
+name_match lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+names lib . $(HEADER_DEPS)
+read_entry lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h $(INCDIR)/hashed_db.h
+read_termcap lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+setbuf lib $(tinfo) $(HEADER_DEPS)
+strings lib $(tinfo) $(HEADER_DEPS)
+trace_buf lib $(trace) $(HEADER_DEPS)
+trace_tries lib $(trace) $(HEADER_DEPS)
+tries lib $(base) $(HEADER_DEPS)
+trim_sgr0 lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+unctrl lib . $(HEADER_DEPS)
+visbuf lib $(trace) $(HEADER_DEPS) $(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
+alloc_entry lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+captoinfo lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+comp_expand lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+comp_parse lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+comp_scan lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
+parse_entry lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h ../include/parametrized.h
+write_entry lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h $(INCDIR)/hashed_db.h
# Extensions to the termlib library
@ ext_tinfo
-define_key lib $(base)
-hashed_db lib $(tinfo)
-key_defined lib $(base)
-keybound lib $(base)
-keyok lib $(base)
-version lib $(base)
+define_key lib $(base) $(HEADER_DEPS)
+hashed_db lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h $(INCDIR)/hashed_db.h
+key_defined lib $(base) $(HEADER_DEPS)
+keybound lib $(base) $(HEADER_DEPS)
+keyok lib $(base) $(HEADER_DEPS)
+version lib $(base) $(HEADER_DEPS)
+
+# Porting
+@ port_drivers
+lib_driver lib $(base) $(HEADER_DEPS)
+
+@ port_win32con
+gettimeofday lib $(win32con) $(HEADER_DEPS)
+wcwidth lib $(win32con) $(HEADER_DEPS)
+win_driver lib $(win32con) $(HEADER_DEPS)
+
+@ port_tinfo
+tinfo_driver lib $(tinfo) $(HEADER_DEPS) $(INCDIR)/tic.h
# vile:makemode
diff --git a/contrib/ncurses/ncurses/tinfo/MKcaptab.sh b/contrib/ncurses/ncurses/tinfo/MKcaptab.sh
index 98c04e884309..4d1b53a5bd9a 100644
--- a/contrib/ncurses/ncurses/tinfo/MKcaptab.sh
+++ b/contrib/ncurses/ncurses/tinfo/MKcaptab.sh
@@ -1,6 +1,6 @@
#!/bin/sh
##############################################################################
-# Copyright (c) 2007 Free Software Foundation, Inc. #
+# Copyright (c) 2007-2009,2010 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), #
@@ -26,12 +26,19 @@
# 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 $
+# $Id: MKcaptab.sh,v 1.13 2010/12/25 23:43:58 tom Exp $
AWK=${1-awk}
OPT1=${2-0}
OPT2=${3-tinfo/MKcaptab.awk}
DATA=${4-../include/Caps}
+cat <<EOF
+/*
+ * generated by $0
+ */
+
+EOF
+
cat <<'EOF'
/*
* comp_captab.c -- The names of the capabilities indexed via a hash
@@ -48,7 +55,7 @@ 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=capalias <$DATA
$AWK -f $OPT2 bigstrings=$OPT1 tablename=infoalias <$DATA
@@ -58,7 +65,7 @@ cat <<EOF
static void
next_string(const char *strings, unsigned *offset)
{
- *offset += strlen(strings + *offset) + 1;
+ *offset += (unsigned) strlen(strings + *offset) + 1;
}
static const struct name_table_entry *
@@ -66,21 +73,21 @@ _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);
- }
- }
+ 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;
+ }
+ return *actual;
}
#define add_alias(field) \\
@@ -94,18 +101,18 @@ _nc_build_alias(struct alias **actual,
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);
- }
- }
+ 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;
+ }
+ return *actual;
}
#define build_names(root) _nc_build_names(&_nc_##root##_table, \\
@@ -122,27 +129,82 @@ _nc_build_alias(struct alias **actual,
NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool termcap)
{
- return termcap ? build_names(cap) : build_names(info) ;
+ return termcap ? build_names(cap) : build_names(info) ;
}
-NCURSES_EXPORT(const short *) _nc_get_hash_table (bool termcap)
+/* entrypoint used by tack (do not alter) */
+NCURSES_EXPORT(const HashValue *) _nc_get_hash_table (bool termcap)
{
- return termcap ? _nc_cap_hash_table: _nc_info_hash_table ;
+ 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) ;
+ return termcap ? build_alias(cap) : build_alias(info) ;
+}
+
+static HashValue
+info_hash(const char *string)
+{
+ long sum = 0;
+
+ DEBUG(9, ("hashing %s", string));
+ while (*string) {
+ sum += (long) (*string + (*(string + 1) << 8));
+ string++;
+ }
+
+ DEBUG(9, ("sum is %ld", sum));
+ return (HashValue) (sum % HASHTABSIZE);
+}
+
+#define TCAP_LEN 2 /* only 1- or 2-character names are used */
+
+static HashValue
+tcap_hash(const char *string)
+{
+ char temp[TCAP_LEN + 1];
+ int limit = 0;
+
+ while (*string) {
+ temp[limit++] = *string++;
+ if (limit >= TCAP_LEN)
+ break;
+ }
+ temp[limit] = '\0';
+ return info_hash(temp);
+}
+
+static int
+compare_tcap_names(const char *a, const char *b)
+{
+ return !strncmp(a, b, TCAP_LEN);
+}
+
+static int
+compare_info_names(const char *a, const char *b)
+{
+ return !strcmp(a, b);
+}
+
+static const HashData hash_data[2] = {
+ { HASHTABSIZE, _nc_info_hash_table, info_hash, compare_info_names },
+ { HASHTABSIZE, _nc_cap_hash_table, tcap_hash, compare_tcap_names }
+};
+
+NCURSES_EXPORT(const HashData *) _nc_get_hash_info (bool termcap)
+{
+ return &hash_data[(termcap != FALSE)];
}
#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);
+ FreeIfNeeded(_nc_cap_table);
+ FreeIfNeeded(_nc_info_table);
+ FreeIfNeeded(_nc_capalias_table);
+ FreeIfNeeded(_nc_infoalias_table);
#endif
}
#endif /* NO_LEAKS */
diff --git a/contrib/ncurses/ncurses/tinfo/MKcodes.awk b/contrib/ncurses/ncurses/tinfo/MKcodes.awk
index b9ba636e0ccd..97e5131ba07c 100644
--- a/contrib/ncurses/ncurses/tinfo/MKcodes.awk
+++ b/contrib/ncurses/ncurses/tinfo/MKcodes.awk
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), #
@@ -25,7 +25,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: MKcodes.awk,v 1.5 2008/06/28 23:13:25 tom Exp $
+# $Id: MKcodes.awk,v 1.9 2010/01/23 17:57:43 tom Exp $
function large_item(value) {
result = sprintf("%d,", offset);
offset = offset + length(value) + 1;
@@ -101,8 +101,6 @@ 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;
@@ -117,28 +115,39 @@ END {
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 " (*value)[n] = (NCURSES_CONST char *) _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)); }"
+ print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API NCURSES_PUBLIC_VAR(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 "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API NCURSES_PUBLIC_VAR(it)(void) { return data##it; }"
}
print ""
+ print "/* remove public definition which conflicts with FIX() */"
+ print "#undef boolcodes"
+ print "#undef numcodes"
+ print "#undef strcodes"
+ print ""
+ print "/* add local definition */"
print "FIX(boolcodes)"
print "FIX(numcodes)"
print "FIX(strcodes)"
print ""
+ print "/* restore the public definition */"
+ print ""
print "#define FREE_FIX(it) if (ptr_##it) { FreeAndNull(ptr_##it); }"
+ print "#define boolcodes NCURSES_PUBLIC_VAR(boolcodes())"
+ print "#define numcodes NCURSES_PUBLIC_VAR(numcodes())"
+ print "#define strcodes NCURSES_PUBLIC_VAR(strcodes())"
print ""
print "#if NO_LEAKS"
print "NCURSES_EXPORT(void)"
diff --git a/contrib/ncurses/ncurses/tinfo/MKfallback.sh b/contrib/ncurses/ncurses/tinfo/MKfallback.sh
index 9feab3507cc0..11f1d2ead138 100755
--- a/contrib/ncurses/ncurses/tinfo/MKfallback.sh
+++ b/contrib/ncurses/ncurses/tinfo/MKfallback.sh
@@ -1,6 +1,6 @@
#!/bin/sh
##############################################################################
-# Copyright (c) 1998-2001,2006 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), #
@@ -26,7 +26,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: MKfallback.sh,v 1.13 2006/07/15 16:54:20 tom Exp $
+# $Id: MKfallback.sh,v 1.15 2010/08/07 20:32:34 tom Exp $
#
# MKfallback.sh -- create fallback table for entry reads
#
@@ -42,6 +42,17 @@ shift
terminfo_src=$1
shift
+tic_path=$1
+shift
+
+case $tic_path in #(vi
+/*)
+ tic_head=`echo "$tic_path" | sed -e 's,/[^/]*$,,'`
+ PATH=$tic_head:$PATH
+ export PATH
+ ;;
+esac
+
if test $# != 0 ; then
tmp_info=tmp_info
echo creating temporary terminfo directory... >&2
@@ -52,7 +63,7 @@ if test $# != 0 ; then
TERMINFO_DIRS=$TERMINFO:$terminfo_dir
export TERMINFO_DIRS
- tic -x $terminfo_src >&2
+ $tic_path -x $terminfo_src >&2
else
tmp_info=
fi
@@ -63,7 +74,6 @@ cat <<EOF
*/
#include <curses.priv.h>
-#include <term.h>
EOF
diff --git a/contrib/ncurses/ncurses/tinfo/MKnames.awk b/contrib/ncurses/ncurses/tinfo/MKnames.awk
index 7e5074480864..7685d1831ef0 100644
--- a/contrib/ncurses/ncurses/tinfo/MKnames.awk
+++ b/contrib/ncurses/ncurses/tinfo/MKnames.awk
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2007,2008 Free Software Foundation, Inc. #
+# Copyright (c) 2007-2008,2009 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), #
@@ -25,7 +25,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: MKnames.awk,v 1.20 2008/10/11 21:07:56 tom Exp $
+# $Id: MKnames.awk,v 1.22 2009/03/21 21:03:39 tom Exp $
function large_item(value) {
result = sprintf("%d,", offset);
offset = offset + length(value) + 1;
@@ -107,8 +107,6 @@ 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;
@@ -133,7 +131,7 @@ END {
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)); }"
+ print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API NCURSES_PUBLIC_VAR(it)(void) { return alloc_array(&ptr_##it, _nc_offset_##it, SIZEOF(_nc_offset_##it)); }"
} else {
print "#define DCL(it) static IT data##it[]"
print ""
@@ -143,9 +141,18 @@ END {
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 "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API NCURSES_PUBLIC_VAR(it)(void) { return data##it; }"
}
print ""
+ print "/* remove public definition which conflicts with FIX() */"
+ print "#undef boolnames"
+ print "#undef boolfnames"
+ print "#undef numnames"
+ print "#undef numfnames"
+ print "#undef strnames"
+ print "#undef strfnames"
+ print ""
+ print "/* add local definition */"
print "FIX(boolnames)"
print "FIX(boolfnames)"
print "FIX(numnames)"
@@ -153,6 +160,13 @@ END {
print "FIX(strnames)"
print "FIX(strfnames)"
print ""
+ print "/* restore the public definition */"
+ print "#define boolnames NCURSES_PUBLIC_VAR(boolnames())"
+ print "#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())"
+ print "#define numnames NCURSES_PUBLIC_VAR(numnames())"
+ print "#define numfnames NCURSES_PUBLIC_VAR(numfnames())"
+ print "#define strnames NCURSES_PUBLIC_VAR(strnames())"
+ print "#define strfnames NCURSES_PUBLIC_VAR(strfnames())"
print ""
print "#define FREE_FIX(it) if (ptr_##it) { FreeAndNull(ptr_##it); }"
print ""
diff --git a/contrib/ncurses/ncurses/tinfo/access.c b/contrib/ncurses/ncurses/tinfo/access.c
index ce8ccdac53f6..87c4f462fd4f 100644
--- a/contrib/ncurses/ncurses/tinfo/access.c
+++ b/contrib/ncurses/ncurses/tinfo/access.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -36,9 +36,8 @@
#include <sys/stat.h>
#include <tic.h>
-#include <nc_alloc.h>
-MODULE_ID("$Id: access.c,v 1.14 2007/11/18 00:57:53 tom Exp $")
+MODULE_ID("$Id: access.c,v 1.16 2010/01/23 17:57:43 tom Exp $")
#define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c))
@@ -97,7 +96,7 @@ _nc_pathlast(const char *path)
test = path;
else
test++;
- return (test - path);
+ return (unsigned) (test - path);
}
NCURSES_EXPORT(char *)
diff --git a/contrib/ncurses/ncurses/tinfo/add_tries.c b/contrib/ncurses/ncurses/tinfo/add_tries.c
index 455d142edc8e..29a1a60045b5 100644
--- a/contrib/ncurses/ncurses/tinfo/add_tries.c
+++ b/contrib/ncurses/ncurses/tinfo/add_tries.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -39,7 +39,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: add_tries.c,v 1.8 2006/12/30 23:15:26 tom Exp $")
+MODULE_ID("$Id: add_tries.c,v 1.10 2010/12/19 01:31:14 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))
@@ -50,7 +50,8 @@ _nc_add_to_try(TRIES ** tree, const char *str, unsigned code)
TRIES *ptr, *savedptr;
unsigned const char *txt = (unsigned const char *) str;
- T((T_CALLED("_nc_add_to_try(%p, %s, %u)"), *tree, _nc_visbuf(str), code));
+ T((T_CALLED("_nc_add_to_try(%p, %s, %u)"),
+ (void *) *tree, _nc_visbuf(str), code));
if (txt == 0 || *txt == '\0' || code == 0)
returnCode(ERR);
@@ -66,7 +67,7 @@ _nc_add_to_try(TRIES ** tree, const char *str, unsigned code)
if (CMP_TRY(ptr->ch, cmp)) {
if (*(++txt) == '\0') {
- ptr->value = code;
+ ptr->value = (unsigned short) code;
returnCode(OK);
}
if (ptr->child != 0)
@@ -115,6 +116,6 @@ _nc_add_to_try(TRIES ** tree, const char *str, unsigned code)
ptr->value = 0;
}
- ptr->value = code;
+ ptr->value = (unsigned short) code;
returnCode(OK);
}
diff --git a/contrib/ncurses/ncurses/tinfo/alloc_entry.c b/contrib/ncurses/ncurses/tinfo/alloc_entry.c
index 4638e99c4d58..506fb386d208 100644
--- a/contrib/ncurses/ncurses/tinfo/alloc_entry.c
+++ b/contrib/ncurses/ncurses/tinfo/alloc_entry.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -46,9 +46,8 @@
#include <curses.priv.h>
#include <tic.h>
-#include <term_entry.h>
-MODULE_ID("$Id: alloc_entry.c,v 1.48 2008/08/16 16:25:31 tom Exp $")
+MODULE_ID("$Id: alloc_entry.c,v 1.51 2010/12/25 23:06:01 tom Exp $")
#define ABSENT_OFFSET -1
#define CANCELLED_OFFSET -2
@@ -65,8 +64,10 @@ _nc_init_entry(TERMTYPE *const tp)
unsigned i;
#if NO_LEAKS
- if (tp == 0 && stringbuf != 0) {
- FreeAndNull(stringbuf);
+ if (tp == 0) {
+ if (stringbuf != 0) {
+ FreeAndNull(stringbuf);
+ }
return;
}
#endif
@@ -181,7 +182,7 @@ _nc_wrap_entry(ENTRY * const ep, bool copy_strings)
} else if (tp->Strings[i] == CANCELLED_STRING) {
offsets[i] = CANCELLED_OFFSET;
} else {
- offsets[i] = tp->Strings[i] - stringbuf;
+ offsets[i] = (int) (tp->Strings[i] - stringbuf);
}
}
}
@@ -190,7 +191,7 @@ _nc_wrap_entry(ENTRY * const ep, bool copy_strings)
if (ep->uses[i].name == 0)
useoffsets[i] = ABSENT_OFFSET;
else
- useoffsets[i] = ep->uses[i].name - stringbuf;
+ useoffsets[i] = (int) (ep->uses[i].name - stringbuf);
}
if ((tp->str_table = typeMalloc(char, next_free)) == (char *) 0)
@@ -214,10 +215,10 @@ _nc_wrap_entry(ENTRY * const ep, bool copy_strings)
if (!copy_strings) {
if ((n = (unsigned) NUM_EXT_NAMES(tp)) != 0) {
if (n < SIZEOF(offsets)) {
- unsigned length = 0;
+ size_t length = 0;
for (i = 0; i < n; i++) {
length += strlen(tp->ext_Names[i]) + 1;
- offsets[i] = tp->ext_Names[i] - stringbuf;
+ offsets[i] = (int) (tp->ext_Names[i] - stringbuf);
}
if ((tp->ext_str_table = typeMalloc(char, length)) == 0)
_nc_err_abort(MSG_NO_MEMORY);
diff --git a/contrib/ncurses/ncurses/tinfo/alloc_ttype.c b/contrib/ncurses/ncurses/tinfo/alloc_ttype.c
index b2b06d1b79ce..b02cb9c6010e 100644
--- a/contrib/ncurses/ncurses/tinfo/alloc_ttype.c
+++ b/contrib/ncurses/ncurses/tinfo/alloc_ttype.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999-2006,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -41,9 +41,8 @@
#include <curses.priv.h>
#include <tic.h>
-#include <term_entry.h>
-MODULE_ID("$Id: alloc_ttype.c,v 1.17 2008/10/12 16:12:00 tom Exp $")
+MODULE_ID("$Id: alloc_ttype.c,v 1.22 2010/12/19 00:24:09 tom Exp $")
#if NCURSES_XNAMES
/*
@@ -91,6 +90,9 @@ find_name(char **table, int length, char *name)
return FALSE;
}
+#define EXTEND_NUM(num, ext) \
+ to->num = (unsigned short) (to->num + (ext - to->ext))
+
static void
realign_data(TERMTYPE *to, char **ext_Names,
int ext_Booleans,
@@ -101,7 +103,7 @@ realign_data(TERMTYPE *to, char **ext_Names,
int limit = (to->ext_Booleans + to->ext_Numbers + to->ext_Strings);
if (to->ext_Booleans != ext_Booleans) {
- to->num_Booleans += (ext_Booleans - to->ext_Booleans);
+ EXTEND_NUM(num_Booleans, ext_Booleans);
to->Booleans = typeRealloc(NCURSES_SBOOL, to->num_Booleans, to->Booleans);
for (n = to->ext_Booleans - 1,
m = ext_Booleans - 1,
@@ -112,10 +114,10 @@ realign_data(TERMTYPE *to, char **ext_Names,
to->Booleans[base + m] = FALSE;
}
}
- to->ext_Booleans = ext_Booleans;
+ to->ext_Booleans = UShort(ext_Booleans);
}
if (to->ext_Numbers != ext_Numbers) {
- to->num_Numbers += (ext_Numbers - to->ext_Numbers);
+ EXTEND_NUM(num_Numbers, ext_Numbers);
to->Numbers = typeRealloc(short, to->num_Numbers, to->Numbers);
for (n = to->ext_Numbers - 1,
m = ext_Numbers - 1,
@@ -126,10 +128,10 @@ realign_data(TERMTYPE *to, char **ext_Names,
to->Numbers[base + m] = ABSENT_NUMERIC;
}
}
- to->ext_Numbers = ext_Numbers;
+ to->ext_Numbers = UShort(ext_Numbers);
}
if (to->ext_Strings != ext_Strings) {
- to->num_Strings += (ext_Strings - to->ext_Strings);
+ EXTEND_NUM(num_Strings, ext_Strings);
to->Strings = typeRealloc(char *, to->num_Strings, to->Strings);
for (n = to->ext_Strings - 1,
m = ext_Strings - 1,
@@ -140,17 +142,17 @@ realign_data(TERMTYPE *to, char **ext_Names,
to->Strings[base + m] = ABSENT_STRING;
}
}
- to->ext_Strings = ext_Strings;
+ to->ext_Strings = UShort(ext_Strings);
}
}
/*
* Returns the first index in ext_Names[] for the given token-type
*/
-static int
+static unsigned
_nc_first_ext_name(TERMTYPE *tp, int token_type)
{
- int first;
+ unsigned first;
switch (token_type) {
case BOOLEAN:
@@ -160,7 +162,7 @@ _nc_first_ext_name(TERMTYPE *tp, int token_type)
first = tp->ext_Booleans;
break;
case STRING:
- first = tp->ext_Booleans + tp->ext_Numbers;
+ first = (unsigned) (tp->ext_Booleans + tp->ext_Numbers);
break;
default:
first = 0;
@@ -172,17 +174,17 @@ _nc_first_ext_name(TERMTYPE *tp, int token_type)
/*
* Returns the last index in ext_Names[] for the given token-type
*/
-static int
+static unsigned
_nc_last_ext_name(TERMTYPE *tp, int token_type)
{
- int last;
+ unsigned last;
switch (token_type) {
case BOOLEAN:
last = tp->ext_Booleans;
break;
case NUMBER:
- last = tp->ext_Booleans + tp->ext_Numbers;
+ last = (unsigned) (tp->ext_Booleans + tp->ext_Numbers);
break;
default:
case STRING:
@@ -204,7 +206,7 @@ _nc_find_ext_name(TERMTYPE *tp, char *name, int token_type)
for (j = first; j < last; j++) {
if (!strcmp(name, tp->ext_Names[j])) {
- return j;
+ return (int) j;
}
}
return -1;
@@ -244,7 +246,7 @@ _nc_del_ext_name(TERMTYPE *tp, char *name, int token_type)
int first, last;
if ((first = _nc_find_ext_name(tp, name, token_type)) >= 0) {
- last = NUM_EXT_NAMES(tp) - 1;
+ last = (int) NUM_EXT_NAMES(tp) - 1;
for (j = first; j < last; j++) {
tp->ext_Names[j] = tp->ext_Names[j + 1];
}
@@ -254,22 +256,22 @@ _nc_del_ext_name(TERMTYPE *tp, char *name, int token_type)
last = tp->num_Booleans - 1;
for (j = first; j < last; j++)
tp->Booleans[j] = tp->Booleans[j + 1];
- tp->ext_Booleans -= 1;
- tp->num_Booleans -= 1;
+ tp->ext_Booleans--;
+ tp->num_Booleans--;
break;
case NUMBER:
last = tp->num_Numbers - 1;
for (j = first; j < last; j++)
tp->Numbers[j] = tp->Numbers[j + 1];
- tp->ext_Numbers -= 1;
- tp->num_Numbers -= 1;
+ tp->ext_Numbers--;
+ tp->num_Numbers--;
break;
case STRING:
last = tp->num_Strings - 1;
for (j = first; j < last; j++)
tp->Strings[j] = tp->Strings[j + 1];
- tp->ext_Strings -= 1;
- tp->num_Strings -= 1;
+ tp->ext_Strings--;
+ tp->num_Strings--;
break;
}
return TRUE;
@@ -303,32 +305,32 @@ _nc_ins_ext_name(TERMTYPE *tp, char *name, int token_type)
for (k = total - 1; k > j; k--)
tp->ext_Names[k] = tp->ext_Names[k - 1];
tp->ext_Names[j] = name;
- j = _nc_ext_data_index(tp, (int) j, token_type);
+ j = (unsigned) _nc_ext_data_index(tp, (int) j, token_type);
switch (token_type) {
case BOOLEAN:
- tp->ext_Booleans += 1;
- tp->num_Booleans += 1;
+ tp->ext_Booleans++;
+ tp->num_Booleans++;
tp->Booleans = typeRealloc(NCURSES_SBOOL, tp->num_Booleans, tp->Booleans);
- for (k = tp->num_Booleans - 1; k > j; k--)
+ for (k = (unsigned) (tp->num_Booleans - 1); k > j; k--)
tp->Booleans[k] = tp->Booleans[k - 1];
break;
case NUMBER:
- tp->ext_Numbers += 1;
- tp->num_Numbers += 1;
+ tp->ext_Numbers++;
+ tp->num_Numbers++;
tp->Numbers = typeRealloc(short, tp->num_Numbers, tp->Numbers);
- for (k = tp->num_Numbers - 1; k > j; k--)
+ for (k = (unsigned) (tp->num_Numbers - 1); k > j; k--)
tp->Numbers[k] = tp->Numbers[k - 1];
break;
case STRING:
- tp->ext_Strings += 1;
- tp->num_Strings += 1;
+ tp->ext_Strings++;
+ tp->num_Strings++;
tp->Strings = typeRealloc(char *, tp->num_Strings, tp->Strings);
- for (k = tp->num_Strings - 1; k > j; k--)
+ for (k = (unsigned) (tp->num_Strings - 1); k > j; k--)
tp->Strings[k] = tp->Strings[k - 1];
break;
}
- return j;
+ return (int) j;
}
/*
@@ -345,10 +347,10 @@ adjust_cancels(TERMTYPE *to, TERMTYPE *from)
for (j = first; j < last;) {
char *name = to->ext_Names[j];
- unsigned j_str = to->num_Strings - first - to->ext_Strings;
+ int j_str = to->num_Strings - first - to->ext_Strings;
if (to->Strings[j + j_str] == CANCELLED_STRING) {
- if ((k = _nc_find_ext_name(from, to->ext_Names[j], BOOLEAN)) >= 0) {
+ if (_nc_find_ext_name(from, to->ext_Names[j], BOOLEAN) >= 0) {
if (_nc_del_ext_name(to, name, STRING)
|| _nc_del_ext_name(to, name, NUMBER)) {
k = _nc_ins_ext_name(to, name, BOOLEAN);
@@ -356,8 +358,7 @@ adjust_cancels(TERMTYPE *to, TERMTYPE *from)
} else {
j++;
}
- } else if ((k = _nc_find_ext_name(from, to->ext_Names[j],
- NUMBER)) >= 0) {
+ } else if (_nc_find_ext_name(from, to->ext_Names[j], NUMBER) >= 0) {
if (_nc_del_ext_name(to, name, STRING)
|| _nc_del_ext_name(to, name, BOOLEAN)) {
k = _nc_ins_ext_name(to, name, NUMBER);
@@ -365,8 +366,7 @@ adjust_cancels(TERMTYPE *to, TERMTYPE *from)
} else {
j++;
}
- } else if ((k = _nc_find_ext_name(from, to->ext_Names[j],
- STRING)) >= 0) {
+ } else if (_nc_find_ext_name(from, to->ext_Names[j], STRING) >= 0) {
if (_nc_del_ext_name(to, name, NUMBER)
|| _nc_del_ext_name(to, name, BOOLEAN)) {
k = _nc_ins_ext_name(to, name, STRING);
@@ -386,8 +386,8 @@ adjust_cancels(TERMTYPE *to, TERMTYPE *from)
NCURSES_EXPORT(void)
_nc_align_termtype(TERMTYPE *to, TERMTYPE *from)
{
- int na = NUM_EXT_NAMES(to);
- int nb = NUM_EXT_NAMES(from);
+ int na = (int) NUM_EXT_NAMES(to);
+ int nb = (int) NUM_EXT_NAMES(from);
int n;
bool same;
char **ext_Names;
@@ -417,7 +417,7 @@ _nc_align_termtype(TERMTYPE *to, TERMTYPE *from)
* into it, updating to's counts for booleans, etc. Fortunately we do
* this only for the terminfo compiler (tic) and comparer (infocmp).
*/
- ext_Names = typeMalloc(char *, na + nb);
+ ext_Names = typeMalloc(char *, (size_t)(na + nb));
if (to->ext_Strings && (from->ext_Booleans + from->ext_Numbers))
adjust_cancels(to, from);
@@ -461,8 +461,8 @@ _nc_align_termtype(TERMTYPE *to, TERMTYPE *from)
if (nb != (ext_Booleans + ext_Numbers + ext_Strings)) {
nb = (ext_Booleans + ext_Numbers + ext_Strings);
realign_data(from, ext_Names, ext_Booleans, ext_Numbers, ext_Strings);
- from->ext_Names = typeRealloc(char *, nb, from->ext_Names);
- memcpy(from->ext_Names, ext_Names, sizeof(char *) * nb);
+ from->ext_Names = typeRealloc(char *, (size_t) nb, from->ext_Names);
+ memcpy(from->ext_Names, ext_Names, sizeof(char *) * (size_t) nb);
DEBUG(2, ("realigned %d extended names for '%s' (from)",
NUM_EXT_NAMES(from), from->term_names));
}
diff --git a/contrib/ncurses/ncurses/tinfo/captoinfo.c b/contrib/ncurses/ncurses/tinfo/captoinfo.c
index 93300c1be3e4..a0da44dea989 100644
--- a/contrib/ncurses/ncurses/tinfo/captoinfo.c
+++ b/contrib/ncurses/ncurses/tinfo/captoinfo.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -93,7 +93,7 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: captoinfo.c,v 1.52 2008/08/16 19:24:51 tom Exp $")
+MODULE_ID("$Id: captoinfo.c,v 1.58 2010/12/04 20:08:19 tom Exp $")
#define MAX_PUSHED 16 /* max # args we can push onto the stack */
@@ -125,10 +125,10 @@ init_string(void)
static char *
save_string(char *d, const char *const s)
{
- size_t have = (d - my_string);
+ size_t have = (size_t) (d - my_string);
size_t need = have + strlen(s) + 2;
if (need > my_length) {
- my_string = (char *) realloc(my_string, my_length = (need + need));
+ my_string = (char *) _nc_doalloc(my_string, my_length = (need + need));
if (my_string == 0)
_nc_err_abort(MSG_NO_MEMORY);
d = my_string + have;
@@ -196,7 +196,7 @@ cvtchar(register const char *sp)
case '3':
len = 1;
while (isdigit(UChar(*sp))) {
- c = 8 * c + (*sp++ - '0');
+ c = (unsigned char) (8 * c + (*sp++ - '0'));
len++;
}
break;
@@ -207,7 +207,7 @@ cvtchar(register const char *sp)
}
break;
case '^':
- c = (*++sp & 0x1f);
+ c = (unsigned char) (*++sp & 0x1f);
len = 2;
break;
default:
@@ -643,6 +643,7 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
int seenone = 0, seentwo = 0, saw_m = 0, saw_n = 0;
const char *padding;
const char *trimmed = 0;
+ int in0, in1, in2;
char ch1 = 0, ch2 = 0;
char *bufptr = init_string();
int len;
@@ -666,8 +667,27 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
int c1, c2;
char *cp = 0;
- if (str[0] == '\\' && (str[1] == '^' || str[1] == ',')) {
- bufptr = save_char(bufptr, *++str);
+ if (str[0] == '^') {
+ if (str[1] == '\0' || (str + 1) == trimmed) {
+ bufptr = save_string(bufptr, "\\136");
+ ++str;
+ } else {
+ bufptr = save_char(bufptr, *str++);
+ bufptr = save_char(bufptr, *str);
+ }
+ } else if (str[0] == '\\') {
+ if (str[1] == '\0' || (str + 1) == trimmed) {
+ bufptr = save_string(bufptr, "\\134");
+ ++str;
+ } else if (str[1] == '^') {
+ bufptr = save_string(bufptr, "\\136");
+ ++str;
+ } else if (str[1] == ',') {
+ bufptr = save_char(bufptr, *++str);
+ } else {
+ bufptr = save_char(bufptr, *str++);
+ bufptr = save_char(bufptr, *str);
+ }
} else if (str[0] == '$' && str[1] == '<') { /* discard padding */
str += 2;
while (isdigit(UChar(*str))
@@ -677,6 +697,19 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz
|| *str == '>')
str++;
--str;
+ } else if (sscanf(str,
+ "[%%?%%p1%%{8}%%<%%t%d%%p1%%d%%e%%p1%%{16}%%<%%t%d%%p1%%{8}%%-%%d%%e%d;5;%%p1%%d%%;m",
+ &in0, &in1, &in2) == 3
+ && ((in0 == 4 && in1 == 10 && in2 == 48)
+ || (in0 == 3 && in1 == 9 && in2 == 38))) {
+ /* dumb-down an optimized case from xterm-256color for termcap */
+ str = strstr(str, ";m");
+ ++str;
+ if (in2 == 48) {
+ bufptr = save_string(bufptr, "[48;5;%dm");
+ } else {
+ bufptr = save_string(bufptr, "[38;5;%dm");
+ }
} else if (str[0] == '%' && str[1] == '%') { /* escaped '%' */
bufptr = save_string(bufptr, "%%");
++str;
diff --git a/contrib/ncurses/ncurses/tinfo/comp_expand.c b/contrib/ncurses/ncurses/tinfo/comp_expand.c
index 6e79a926b5ac..71012b6355e3 100644
--- a/contrib/ncurses/ncurses/tinfo/comp_expand.c
+++ b/contrib/ncurses/ncurses/tinfo/comp_expand.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -35,7 +35,7 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: comp_expand.c,v 1.20 2008/08/16 19:29:42 tom Exp $")
+MODULE_ID("$Id: comp_expand.c,v 1.21 2010/01/16 17:11:23 tom Exp $")
static int
trailing_spaces(const char *src)
@@ -91,7 +91,7 @@ _nc_tic_expand(const char *srcp, bool tic_format, int numbers)
&& REALPRINT(str + 1)
&& str[2] == S_QUOTE) {
sprintf(buffer + bufp, "{%d}", str[1]);
- bufp += strlen(buffer + bufp);
+ bufp += (int) strlen(buffer + bufp);
str += 2;
} else {
buffer[bufp++] = *str;
diff --git a/contrib/ncurses/ncurses/tinfo/comp_hash.c b/contrib/ncurses/ncurses/tinfo/comp_hash.c
index b7fbd0616345..959c6e156431 100644
--- a/contrib/ncurses/ncurses/tinfo/comp_hash.c
+++ b/contrib/ncurses/ncurses/tinfo/comp_hash.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 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,110 +44,36 @@
#include <tic.h>
#include <hashsize.h>
-#ifdef MAIN_PROGRAM
-#include <ctype.h>
-#undef DEBUG
-#define DEBUG(level, params) /*nothing */
-#endif
-
-MODULE_ID("$Id: comp_hash.c,v 1.36 2008/08/16 17:06:53 tom Exp $")
-
-static int hash_function(const char *);
+MODULE_ID("$Id: comp_hash.c,v 1.48 2009/08/08 17:36:21 tom Exp $")
/*
- * _nc_make_hash_table()
- *
- * Takes the entries in table[] and hashes them into hash_table[]
- * by name. There are CAPTABSIZE entries in table[] and HASHTABSIZE
- * slots in hash_table[].
- *
+ * Finds the entry for the given string in the hash table if present.
+ * Returns a pointer to the entry in the table or 0 if not found.
*/
-
-#ifdef MAIN_PROGRAM
-
-#undef MODULE_ID
-#define MODULE_ID(id) /*nothing */
-#include <tinfo/doalloc.c>
-
-static void
-_nc_make_hash_table(struct name_table_entry *table,
- short *hash_table)
-{
- short 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] >= 0)
- collisions++;
-
- if (hash_table[hashvalue] != 0)
- table[i].nte_link = hash_table[hashvalue];
- hash_table[hashvalue] = i;
- }
-
- DEBUG(4, ("Hash table complete: %d collisions out of %d entries",
- collisions, CAPTABSIZE));
-}
-#endif
-
-/*
- * int hash_function(string)
- *
- * Computes the hashing function on the given string.
- *
- * The current hash function is the sum of each consectutive pair
- * of characters, taken as two-byte integers, mod HASHTABSIZE.
- *
- */
-
-static int
-hash_function(const char *string)
-{
- long sum = 0;
-
- DEBUG(9, ("hashing %s", string));
- while (*string) {
- sum += (long) (*string + (*(string + 1) << 8));
- string++;
- }
-
- DEBUG(9, ("sum is %ld", sum));
- return (int) (sum % HASHTABSIZE);
-}
-
-/*
- * struct name_table_entry *
- * find_entry(string)
- *
- * Finds the entry for the given string in the hash table if present.
- * Returns a pointer to the entry in the table or 0 if not found.
- *
- */
-
-#ifndef MAIN_PROGRAM
+/* entrypoint used by tack (do not alter) */
NCURSES_EXPORT(struct name_table_entry const *)
_nc_find_entry(const char *string,
- const short *hash_table)
+ const HashValue * hash_table)
{
+ bool termcap = (hash_table != _nc_get_hash_table(FALSE));
+ const HashData *data = _nc_get_hash_info(termcap);
int hashvalue;
struct name_table_entry const *ptr = 0;
struct name_table_entry const *real_table;
- hashvalue = hash_function(string);
+ hashvalue = data->hash_of(string);
+
+ if (data->table_data[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 = real_table + (ptr->nte_link + hash_table[HASHTABSIZE]);
+ real_table = _nc_get_table(termcap);
+ ptr = real_table + data->table_data[hashvalue];
+ while (!data->compare_names(ptr->nte_name, string)) {
+ if (ptr->nte_link < 0) {
+ ptr = 0;
+ break;
+ }
+ ptr = real_table + (ptr->nte_link
+ + data->table_data[data->table_size]);
}
}
@@ -155,216 +81,34 @@ _nc_find_entry(const char *string,
}
/*
- * struct name_table_entry *
- * find_type_entry(string, type, table)
+ * Finds the entry for the given name with the given type in the given table if
+ * present (as distinct from _nc_find_entry, which finds the last entry
+ * regardless of type).
*
- * Finds the first entry for the given name with the given type in the
- * given table if present (as distinct from find_entry, which finds the
- * the last entry regardless of type). You can use this if you detect
- * a name clash. It's slower, though. Returns a pointer to the entry
- * in the table or 0 if not found.
+ * Returns a pointer to the entry in the table or 0 if not found.
*/
-
NCURSES_EXPORT(struct name_table_entry const *)
_nc_find_type_entry(const char *string,
int type,
- const struct name_table_entry *table)
-{
- struct name_table_entry const *ptr;
-
- for (ptr = table; ptr < table + CAPTABSIZE; ptr++) {
- if (ptr->nte_type == type && strcmp(string, ptr->nte_name) == 0)
- return (ptr);
- }
-
- return ((struct name_table_entry *) NULL);
-}
-#endif
-
-#ifdef MAIN_PROGRAM
-/*
- * This filter reads from standard input a list of tab-delimited columns,
- * (e.g., from Caps.filtered) computes the hash-value of a specified column and
- * writes the hashed tables to standard output.
- *
- * By compiling the hash table at build time, we're able to make the entire
- * set of terminfo and termcap tables readonly (and also provide some runtime
- * performance enhancement).
- */
-
-#define MAX_COLUMNS BUFSIZ /* this _has_ to be worst-case */
-
-static char **
-parse_columns(char *buffer)
+ bool termcap)
{
- static char **list;
-
- int col = 0;
-
- if (list == 0 && (list = typeCalloc(char *, MAX_COLUMNS)) == 0)
- return (0);
-
- if (*buffer != '#') {
- while (*buffer != '\0') {
- char *s;
- for (s = buffer; (*s != '\0') && !isspace(UChar(*s)); s++)
- /*EMPTY */ ;
- if (s != buffer) {
- char mark = *s;
- *s = '\0';
- if ((s - buffer) > 1
- && (*buffer == '"')
- && (s[-1] == '"')) { /* strip the quotes */
- assert(s > buffer + 1);
- s[-1] = '\0';
- buffer++;
- }
- list[col] = buffer;
- col++;
- if (mark == '\0')
- break;
- while (*++s && isspace(UChar(*s)))
- /*EMPTY */ ;
- buffer = s;
- } else
+ struct name_table_entry const *ptr = NULL;
+ const HashData *data = _nc_get_hash_info(termcap);
+ int hashvalue = data->hash_of(string);
+
+ if (data->table_data[hashvalue] >= 0) {
+ const struct name_table_entry *const table = _nc_get_table(termcap);
+
+ ptr = table + data->table_data[hashvalue];
+ while (ptr->nte_type != type
+ || !data->compare_names(ptr->nte_name, string)) {
+ if (ptr->nte_link < 0) {
+ ptr = 0;
break;
- }
- }
- return col ? list : 0;
-}
-
-int
-main(int argc, char **argv)
-{
- struct name_table_entry *name_table = typeCalloc(struct
- name_table_entry, CAPTABSIZE);
- short *hash_table = typeCalloc(short, HASHTABSIZE);
- const char *root_name = "";
- int column = 0;
- int bigstring = 0;
- int n;
- char buffer[BUFSIZ];
-
- static const char *typenames[] =
- {"BOOLEAN", "NUMBER", "STRING"};
-
- short BoolCount = 0;
- short NumCount = 0;
- short StrCount = 0;
-
- /* The first argument is the column-number (starting with 0).
- * The second is the root name of the tables to generate.
- */
- if (argc <= 3
- || (column = atoi(argv[1])) <= 0
- || (column >= MAX_COLUMNS)
- || *(root_name = argv[2]) == 0
- || (bigstring = atoi(argv[3])) < 0
- || name_table == 0
- || hash_table == 0) {
- fprintf(stderr, "usage: make_hash column root_name bigstring\n");
- exit(EXIT_FAILURE);
- }
-
- /*
- * Read the table into our arrays.
- */
- for (n = 0; (n < CAPTABSIZE) && fgets(buffer, BUFSIZ, stdin);) {
- char **list, *nlp = strchr(buffer, '\n');
- if (nlp)
- *nlp = '\0';
- list = parse_columns(buffer);
- if (list == 0) /* blank or comment */
- continue;
- name_table[n].nte_link = -1; /* end-of-hash */
- name_table[n].nte_name = strdup(list[column]);
- if (!strcmp(list[2], "bool")) {
- name_table[n].nte_type = BOOLEAN;
- name_table[n].nte_index = BoolCount++;
- } else if (!strcmp(list[2], "num")) {
- name_table[n].nte_type = NUMBER;
- name_table[n].nte_index = NumCount++;
- } else if (!strcmp(list[2], "str")) {
- name_table[n].nte_type = STRING;
- name_table[n].nte_index = StrCount++;
- } else {
- fprintf(stderr, "Unknown type: %s\n", list[2]);
- exit(EXIT_FAILURE);
- }
- n++;
- }
- _nc_make_hash_table(name_table, hash_table);
-
- /*
- * Write the compiled tables to standard output
- */
- if (bigstring) {
- int len = 0;
- int nxt;
-
- printf("static const char %s_names_text[] = \\\n", root_name);
- for (n = 0; n < CAPTABSIZE; n++) {
- nxt = (int) 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;
+ ptr = table + (ptr->nte_link + data->table_data[data->table_size]);
}
- 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 += (int) 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("static const short _nc_%s_hash_table[%d] =\n",
- root_name,
- HASHTABSIZE + 1);
- printf("{\n");
- for (n = 0; n < HASHTABSIZE; n++) {
- printf("\t%3d,\n", hash_table[n]);
}
- printf("\t0\t/* base-of-table */\n");
- printf("};\n\n");
-
- printf("#if (BOOLCOUNT!=%d)||(NUMCOUNT!=%d)||(STRCOUNT!=%d)\n",
- BoolCount, NumCount, StrCount);
- printf("#error\t--> term.h and comp_captab.c disagree about the <--\n");
- printf("#error\t--> numbers of booleans, numbers and/or strings <--\n");
- printf("#endif\n\n");
- free(hash_table);
- return EXIT_SUCCESS;
+ return ptr;
}
-#endif
diff --git a/contrib/ncurses/ncurses/tinfo/comp_parse.c b/contrib/ncurses/ncurses/tinfo/comp_parse.c
index 3325a0ddae6c..8204d75a8193 100644
--- a/contrib/ncurses/ncurses/tinfo/comp_parse.c
+++ b/contrib/ncurses/ncurses/tinfo/comp_parse.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -51,9 +51,8 @@
#include <ctype.h>
#include <tic.h>
-#include <term_entry.h>
-MODULE_ID("$Id: comp_parse.c,v 1.69 2008/08/16 21:58:16 tom Exp $")
+MODULE_ID("$Id: comp_parse.c,v 1.73 2010/12/25 23:06:37 tom Exp $")
static void sanity_check2(TERMTYPE *, bool);
NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE *, bool) = sanity_check2;
@@ -92,16 +91,18 @@ force_bar(char *dst, char *src)
}
return src;
}
+#define ForceBar(dst, src) ((strchr(src, '|') == 0) ? force_bar(dst, src) : src)
NCURSES_EXPORT(bool)
_nc_entry_match(char *n1, char *n2)
/* do any of the aliases in a pair of terminal names match? */
{
char *pstart, *qstart, *pend, *qend;
- char nc1[MAX_NAME_SIZE + 2], nc2[MAX_NAME_SIZE + 2];
+ char nc1[MAX_NAME_SIZE + 2];
+ char nc2[MAX_NAME_SIZE + 2];
- n1 = force_bar(nc1, n1);
- n2 = force_bar(nc2, n2);
+ n1 = ForceBar(nc1, n1);
+ n2 = ForceBar(nc2, n2);
for (pstart = n1; (pend = strchr(pstart, '|')); pstart = pend + 1)
for (qstart = n2; (qend = strchr(qstart, '|')); qstart = qend + 1)
@@ -273,7 +274,7 @@ _nc_resolve_uses2(bool fullresolve, bool literal)
unresolved++;
total_unresolved++;
- _nc_curr_line = lookline;
+ _nc_curr_line = (int) lookline;
_nc_warning("resolution of use=%s failed", lookfor);
qp->uses[i].link = 0;
}
@@ -375,7 +376,7 @@ _nc_resolve_uses2(bool fullresolve, bool literal)
if (_nc_check_termtype != 0) {
_nc_curr_col = -1;
for_entry_list(qp) {
- _nc_curr_line = qp->startline;
+ _nc_curr_line = (int) qp->startline;
_nc_set_type(_nc_first_name(qp->tterm.term_names));
_nc_check_termtype2(&qp->tterm, literal);
}
@@ -473,7 +474,6 @@ _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();
diff --git a/contrib/ncurses/ncurses/tinfo/comp_scan.c b/contrib/ncurses/ncurses/tinfo/comp_scan.c
index da97dad89ad8..71af5e70e81b 100644
--- a/contrib/ncurses/ncurses/tinfo/comp_scan.c
+++ b/contrib/ncurses/ncurses/tinfo/comp_scan.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -50,10 +50,9 @@
#include <curses.priv.h>
#include <ctype.h>
-#include <term_entry.h>
#include <tic.h>
-MODULE_ID("$Id: comp_scan.c,v 1.83 2008/08/16 19:22:55 tom Exp $")
+MODULE_ID("$Id: comp_scan.c,v 1.89 2010/12/25 23:06:37 tom Exp $")
/*
* Maximum length of string capability we'll accept before raising an error.
@@ -63,19 +62,13 @@ MODULE_ID("$Id: comp_scan.c,v 1.83 2008/08/16 19:22:55 tom Exp $")
#define iswhite(ch) (ch == ' ' || ch == '\t')
-NCURSES_EXPORT_VAR(int)
-_nc_syntax = 0; /* termcap or terminfo? */
-NCURSES_EXPORT_VAR(long)
-_nc_curr_file_pos = 0; /* file offset of current line */
-NCURSES_EXPORT_VAR(long)
-_nc_comment_start = 0; /* start of comment range before name */
-NCURSES_EXPORT_VAR(long)
-_nc_comment_end = 0; /* end of comment range before name */
-NCURSES_EXPORT_VAR(long)
-_nc_start_line = 0; /* start line of current entry */
-
-NCURSES_EXPORT_VAR(struct token)
-_nc_curr_token =
+NCURSES_EXPORT_VAR (int) _nc_syntax = 0; /* termcap or terminfo? */
+NCURSES_EXPORT_VAR (long) _nc_curr_file_pos = 0; /* file offset of current line */
+NCURSES_EXPORT_VAR (long) _nc_comment_start = 0; /* start of comment range before name */
+NCURSES_EXPORT_VAR (long) _nc_comment_end = 0; /* end of comment range before name */
+NCURSES_EXPORT_VAR (long) _nc_start_line = 0; /* start line of current entry */
+
+NCURSES_EXPORT_VAR (struct token) _nc_curr_token =
{
0, 0, 0
};
@@ -93,8 +86,7 @@ static int pushtype; /* type of pushback token */
static char *pushname;
#if NCURSES_EXT_FUNCS
-NCURSES_EXPORT_VAR(bool)
-_nc_disable_period = FALSE; /* used by tic -a option */
+NCURSES_EXPORT_VAR (bool) _nc_disable_period = FALSE; /* used by tic -a option */
#endif
/*****************************************************************************
@@ -213,6 +205,10 @@ next_char(void)
if (fgets(result + used, (int) (allocated - used), yyin) != 0) {
bufstart = result;
if (used == 0) {
+ if (_nc_curr_line == 0
+ && IS_TIC_MAGIC(result)) {
+ _nc_err_abort("This is a compiled terminal description, not a source");
+ }
_nc_curr_line++;
_nc_curr_col = 0;
}
@@ -433,7 +429,7 @@ _nc_get_token(bool silent)
&& !strchr(terminfo_punct, (char) ch)) {
if (!silent)
_nc_warning("Illegal character (expected alphanumeric or %s) - '%s'",
- terminfo_punct, unctrl((chtype) ch));
+ terminfo_punct, unctrl(UChar(ch)));
_nc_panic_mode(separator);
goto start_token;
}
@@ -489,7 +485,6 @@ _nc_get_token(bool silent)
if (OkToAdd()) {
AddCh(ch);
} else {
- ch = EOF;
break;
}
}
@@ -600,7 +595,7 @@ _nc_get_token(bool silent)
case '@':
if ((ch = next_char()) != separator && !silent)
_nc_warning("Missing separator after `%s', have %s",
- tok_buf, unctrl((chtype) ch));
+ tok_buf, unctrl(UChar(ch)));
_nc_curr_token.tk_name = tok_buf;
type = CANCEL;
break;
@@ -621,7 +616,7 @@ _nc_get_token(bool silent)
_nc_warning("Missing separator");
}
_nc_curr_token.tk_name = tok_buf;
- _nc_curr_token.tk_valnumber = number;
+ _nc_curr_token.tk_valnumber = (int) number;
type = NUMBER;
break;
@@ -641,7 +636,7 @@ _nc_get_token(bool silent)
/* just to get rid of the compiler warning */
type = UNDEF;
if (!silent)
- _nc_warning("Illegal character - '%s'", unctrl((chtype) ch));
+ _nc_warning("Illegal character - '%s'", unctrl(UChar(ch)));
}
} /* end else (first_column == FALSE) */
} /* end else (ch != EOF) */
@@ -734,48 +729,47 @@ _nc_trans_string(char *ptr, char *last)
int count = 0;
int number = 0;
int i, c;
- chtype ch, last_ch = '\0';
+ int last_ch = '\0';
bool ignored = FALSE;
bool long_warning = FALSE;
- while ((ch = c = next_char()) != (chtype) separator && c != EOF) {
+ while ((c = next_char()) != separator && c != EOF) {
if (ptr >= (last - 1)) {
if (c != EOF) {
while ((c = next_char()) != separator && c != EOF) {
;
}
- ch = c;
}
break;
}
if ((_nc_syntax == SYN_TERMCAP) && c == '\n')
break;
- if (ch == '^' && last_ch != '%') {
- ch = c = next_char();
+ if (c == '^' && last_ch != '%') {
+ c = next_char();
if (c == EOF)
_nc_err_abort(MSG_NO_INPUTS);
- if (!(is7bits(ch) && isprint(ch))) {
- _nc_warning("Illegal ^ character - '%s'", unctrl(ch));
+ if (!(is7bits(c) && isprint(c))) {
+ _nc_warning("Illegal ^ character - '%s'", unctrl(UChar(c)));
}
- if (ch == '?') {
+ if (c == '?') {
*(ptr++) = '\177';
if (_nc_tracing)
_nc_warning("Allow ^? as synonym for \\177");
} else {
- if ((ch &= 037) == 0)
- ch = 128;
- *(ptr++) = (char) (ch);
+ if ((c &= 037) == 0)
+ c = 128;
+ *(ptr++) = (char) (c);
}
- } else if (ch == '\\') {
- ch = c = next_char();
+ } else if (c == '\\') {
+ c = next_char();
if (c == EOF)
_nc_err_abort(MSG_NO_INPUTS);
- if (ch >= '0' && ch <= '7') {
- number = ch - '0';
+ if (c >= '0' && c <= '7') {
+ number = c - '0';
for (i = 0; i < 2; i++) {
- ch = c = next_char();
+ c = next_char();
if (c == EOF)
_nc_err_abort(MSG_NO_INPUTS);
@@ -852,31 +846,31 @@ _nc_trans_string(char *ptr, char *last)
default:
_nc_warning("Illegal character '%s' in \\ sequence",
- unctrl(ch));
+ unctrl(UChar(c)));
/* FALLTHRU */
case '|':
- *(ptr++) = (char) ch;
- } /* endswitch (ch) */
- } /* endelse (ch < '0' || ch > '7') */
+ *(ptr++) = (char) c;
+ } /* endswitch (c) */
+ } /* endelse (c < '0' || c > '7') */
}
- /* end else if (ch == '\\') */
- else if (ch == '\n' && (_nc_syntax == SYN_TERMINFO)) {
+ /* end else if (c == '\\') */
+ else if (c == '\n' && (_nc_syntax == SYN_TERMINFO)) {
/*
* Newlines embedded in a terminfo string are ignored, provided
* that the next line begins with whitespace.
*/
ignored = TRUE;
} else {
- *(ptr++) = (char) ch;
+ *(ptr++) = (char) c;
}
if (!ignored) {
if (_nc_curr_col <= 1) {
- push_back((char) ch);
- ch = '\n';
+ push_back((char) c);
+ c = '\n';
break;
}
- last_ch = ch;
+ last_ch = c;
count++;
}
ignored = FALSE;
@@ -889,7 +883,7 @@ _nc_trans_string(char *ptr, char *last)
*ptr = '\0';
- return (ch);
+ return (c);
}
/*
diff --git a/contrib/ncurses/ncurses/tinfo/db_iterator.c b/contrib/ncurses/ncurses/tinfo/db_iterator.c
index fdc2bb09eadc..82665cb54be6 100644
--- a/contrib/ncurses/ncurses/tinfo/db_iterator.c
+++ b/contrib/ncurses/ncurses/tinfo/db_iterator.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 2006-2007,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -38,7 +38,7 @@
#include <tic.h>
-MODULE_ID("$Id: db_iterator.c,v 1.6 2007/04/22 00:00:26 tom Exp $")
+MODULE_ID("$Id: db_iterator.c,v 1.9 2010/12/25 23:00:25 tom Exp $")
#define HaveTicDirectory _nc_globals.have_tic_directory
#define KeepTicDirectory _nc_globals.keep_tic_directory
@@ -104,7 +104,7 @@ next_list_item(const char *source, int *offset)
if (source != 0) {
FreeIfNeeded(ThisDbList);
ThisDbList = strdup(source);
- ThisDbSize = strlen(source);
+ ThisDbSize = (int) strlen(source);
}
if (ThisDbList != 0 && ThisDbSize && *offset < ThisDbSize) {
@@ -118,11 +118,10 @@ next_list_item(const char *source, int *offset)
* again, using the data at the offset.
*/
if (marker == 0) {
- *offset += strlen(result) + 1;
- marker = result + *offset;
+ *offset += (int) strlen(result);
} else {
*marker++ = 0;
- *offset = marker - ThisDbList;
+ *offset = (int) (marker - ThisDbList);
}
if (*result == 0 && result != (ThisDbList + ThisDbSize))
result = system_db;
diff --git a/contrib/ncurses/ncurses/tinfo/entries.c b/contrib/ncurses/ncurses/tinfo/entries.c
index cf2a8337b870..b1e14a803f31 100644
--- a/contrib/ncurses/ncurses/tinfo/entries.c
+++ b/contrib/ncurses/ncurses/tinfo/entries.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2006-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 2006-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -28,6 +28,7 @@
/****************************************************************************
* Author: Thomas E. Dickey *
+ * and: Juergen Pfeifer *
****************************************************************************/
#include <curses.priv.h>
@@ -35,9 +36,8 @@
#include <ctype.h>
#include <tic.h>
-#include <term_entry.h>
-MODULE_ID("$Id: entries.c,v 1.8 2008/09/27 13:11:10 tom Exp $")
+MODULE_ID("$Id: entries.c,v 1.17 2010/01/23 17:57:43 tom Exp $")
/****************************************************************************
*
@@ -119,6 +119,12 @@ _nc_leaks_tinfo(void)
#if NO_LEAKS
_nc_free_tparm();
_nc_tgetent_leaks();
+
+ if (TerminalOf(CURRENT_SCREEN) != 0) {
+ del_curterm(TerminalOf(CURRENT_SCREEN));
+ }
+
+ _nc_comp_captab_leaks();
_nc_free_entries(_nc_head);
_nc_get_type(0);
_nc_first_name(0);
@@ -131,6 +137,12 @@ _nc_leaks_tinfo(void)
if ((s = _nc_home_terminfo()) != 0)
free(s);
+
+#ifdef TRACE
+ trace(0);
+ _nc_trace_buf(-1, 0);
+#endif
+
#endif /* NO_LEAKS */
returnVoid;
}
diff --git a/contrib/ncurses/ncurses/tinfo/free_ttype.c b/contrib/ncurses/ncurses/tinfo/free_ttype.c
index fa0fff1b83fb..ad056ba4545b 100644
--- a/contrib/ncurses/ncurses/tinfo/free_ttype.c
+++ b/contrib/ncurses/ncurses/tinfo/free_ttype.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2010,2011 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,9 +41,8 @@
#include <curses.priv.h>
#include <tic.h>
-#include <term_entry.h>
-MODULE_ID("$Id: free_ttype.c,v 1.13 2006/06/25 10:46:02 tom Exp $")
+MODULE_ID("$Id: free_ttype.c,v 1.15 2011/02/06 01:08:31 tom Exp $")
NCURSES_EXPORT(void)
_nc_free_termtype(TERMTYPE *ptr)
@@ -70,6 +69,7 @@ use_extended_names(bool flag)
{
int oldflag = _nc_user_definable;
+ START_TRACE();
T((T_CALLED("use_extended_names(%d)"), flag));
_nc_user_definable = flag;
returnBool(oldflag);
diff --git a/contrib/ncurses/ncurses/tinfo/hashed_db.c b/contrib/ncurses/ncurses/tinfo/hashed_db.c
index 3fc04eae3cca..bf7a968ee96d 100644
--- a/contrib/ncurses/ncurses/tinfo/hashed_db.c
+++ b/contrib/ncurses/ncurses/tinfo/hashed_db.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2006 Free Software Foundation, Inc. *
+ * Copyright (c) 2006,2008 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 2006-on *
****************************************************************************/
#include <curses.priv.h>
@@ -36,7 +36,7 @@
#if USE_HASHED_DB
-MODULE_ID("$Id: hashed_db.c,v 1.13 2006/08/19 19:48:38 tom Exp $")
+MODULE_ID("$Id: hashed_db.c,v 1.14 2008/12/13 20:59:02 tom Exp $")
#if HASHED_DB_API >= 2
static DBC *cursor;
@@ -49,27 +49,30 @@ NCURSES_EXPORT(DB *)
_nc_db_open(const char *path, bool modify)
{
DB *result = 0;
+ int code;
#if HASHED_DB_API >= 4
db_create(&result, NULL, 0);
- result->open(result,
- NULL,
- path,
- NULL,
- DB_HASH,
- modify ? DB_CREATE : DB_RDONLY,
- 0644);
+ if ((code = result->open(result,
+ NULL,
+ path,
+ NULL,
+ DB_HASH,
+ modify ? DB_CREATE : DB_RDONLY,
+ 0644)) != 0) {
+ result = 0;
+ }
#elif HASHED_DB_API >= 3
db_create(&result, NULL, 0);
- result->open(result,
- path,
- NULL,
- DB_HASH,
- modify ? DB_CREATE : DB_RDONLY,
- 0644);
+ if ((code = result->open(result,
+ path,
+ NULL,
+ DB_HASH,
+ modify ? DB_CREATE : DB_RDONLY,
+ 0644)) != 0) {
+ result = 0;
+ }
#elif HASHED_DB_API >= 2
- int code;
-
if ((code = db_open(path,
DB_HASH,
modify ? DB_CREATE : DB_RDONLY,
@@ -77,21 +80,22 @@ _nc_db_open(const char *path, bool modify)
(DB_ENV *) 0,
(DB_INFO *) 0,
&result)) != 0) {
- T(("cannot open %s: %s", path, strerror(code)));
result = 0;
- } else {
- T(("opened %s", path));
}
#else
- result = dbopen(path,
- modify ? (O_CREAT | O_RDWR) : O_RDONLY,
- 0644,
- DB_HASH,
- NULL);
+ if ((result = dbopen(path,
+ modify ? (O_CREAT | O_RDWR) : O_RDONLY,
+ 0644,
+ DB_HASH,
+ NULL)) == 0) {
+ code = errno;
+ }
+#endif
if (result != 0) {
T(("opened %s", path));
+ } else {
+ T(("cannot open %s: %s", path, strerror(code)));
}
-#endif
return result;
}
diff --git a/contrib/ncurses/ncurses/tinfo/home_terminfo.c b/contrib/ncurses/ncurses/tinfo/home_terminfo.c
index 4521c4a8da68..69d69f95bf7c 100644
--- a/contrib/ncurses/ncurses/tinfo/home_terminfo.c
+++ b/contrib/ncurses/ncurses/tinfo/home_terminfo.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -37,7 +37,7 @@
#include <curses.priv.h>
#include <tic.h>
-MODULE_ID("$Id: home_terminfo.c,v 1.11 2008/08/03 23:43:11 tom Exp $")
+MODULE_ID("$Id: home_terminfo.c,v 1.12 2010/12/25 23:43:58 tom Exp $")
/* ncurses extension...fall back on user's private directory */
@@ -53,7 +53,7 @@ _nc_home_terminfo(void)
if (use_terminfo_vars()) {
if (MyBuffer == 0) {
if ((home = getenv("HOME")) != 0) {
- unsigned want = (strlen(home) + sizeof(PRIVATE_INFO));
+ size_t want = (strlen(home) + sizeof(PRIVATE_INFO));
MyBuffer = typeMalloc(char, want);
if (MyBuffer == 0)
_nc_err_abort(MSG_NO_MEMORY);
diff --git a/contrib/ncurses/ncurses/tinfo/init_keytry.c b/contrib/ncurses/ncurses/tinfo/init_keytry.c
index 2f6fe4f6fad7..ea47b382b493 100644
--- a/contrib/ncurses/ncurses/tinfo/init_keytry.c
+++ b/contrib/ncurses/ncurses/tinfo/init_keytry.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999-2006,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -27,16 +27,9 @@
****************************************************************************/
#include <curses.priv.h>
-
-#include <term.h>
-/* keypad_xmit, keypad_local, meta_on, meta_off */
-/* cursor_visible,cursor_normal,cursor_invisible */
-
#include <tic.h> /* struct tinfo_fkeys */
-#include <term_entry.h>
-
-MODULE_ID("$Id: init_keytry.c,v 1.12 2008/05/24 21:44:51 tom Exp $")
+MODULE_ID("$Id: init_keytry.c,v 1.17 2010/04/24 22:29:56 tom Exp $")
/*
** _nc_init_keytry()
@@ -50,7 +43,7 @@ MODULE_ID("$Id: init_keytry.c,v 1.12 2008/05/24 21:44:51 tom Exp $")
* than cur_term.
*/
#undef CUR
-#define CUR (sp->_term)->type.
+#define CUR SP_TERMTYPE
#if BROKEN_LINKER
#undef _nc_tinfo_fkeys
@@ -73,7 +66,7 @@ _nc_tinfo_fkeysf(void)
NCURSES_EXPORT(void)
_nc_init_keytry(SCREEN *sp)
{
- size_t n;
+ unsigned n;
/* The sp->_keytry value is initialized in newterm(), where the sp
* structure is created, because we can not tell where keypad() or
@@ -97,12 +90,13 @@ _nc_init_keytry(SCREEN *sp)
{
TERMTYPE *tp = &(sp->_term->type);
for (n = STRCOUNT; n < NUM_STRINGS(tp); ++n) {
- const char *name = ExtStrname(tp, n, strnames);
+ const char *name = ExtStrname(tp, (int) n, strnames);
char *value = tp->Strings[n];
if (name != 0
&& *name == 'k'
&& value != 0
- && key_defined(value) == 0) {
+ && NCURSES_SP_NAME(key_defined) (NCURSES_SP_ARGx
+ value) == 0) {
(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 919e47287a7b..d8fdedca843f 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_acs.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_acs.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -30,17 +30,21 @@
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer 2008 *
****************************************************************************/
#include <curses.priv.h>
-#include <term.h> /* ena_acs, acs_chars */
-MODULE_ID("$Id: lib_acs.c,v 1.36 2008/08/16 19:22:55 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_acs.c,v 1.43 2010/12/25 23:00:45 tom Exp $")
#if BROKEN_LINKER || USE_REENTRANT
#define MyBuffer _nc_prescreen.real_acs_map
-NCURSES_EXPORT_VAR(chtype *)
-_nc_acs_map(void)
+NCURSES_EXPORT(chtype *)
+NCURSES_PUBLIC_VAR(acs_map) (void)
{
if (MyBuffer == 0)
MyBuffer = typeCalloc(chtype, ACS_LEN);
@@ -48,17 +52,35 @@ _nc_acs_map(void)
}
#undef MyBuffer
#else
-NCURSES_EXPORT_VAR(chtype) acs_map[ACS_LEN] =
+NCURSES_EXPORT_VAR (chtype) acs_map[ACS_LEN] =
{
0
};
#endif
+#ifdef USE_TERM_DRIVER
+NCURSES_EXPORT(chtype)
+NCURSES_SP_NAME(_nc_acs_char) (NCURSES_SP_DCLx int c)
+{
+ chtype *map;
+ if (c < 0 || c >= ACS_LEN)
+ return (chtype) 0;
+ map = (SP_PARM != 0) ? SP_PARM->_acs_map :
+#if BROKEN_LINKER || USE_REENTRANT
+ _nc_prescreen.real_acs_map
+#else
+ acs_map
+#endif
+ ;
+ return map[c];
+}
+#endif /* USE_TERM_DRIVER */
+
NCURSES_EXPORT(void)
-_nc_init_acs(void)
+NCURSES_SP_NAME(_nc_init_acs) (NCURSES_SP_DCL0)
{
chtype *fake_map = acs_map;
- chtype *real_map = SP != 0 ? SP->_acs_map : fake_map;
+ chtype *real_map = SP_PARM != 0 ? SP_PARM->_acs_map : fake_map;
int j;
T(("initializing ACS map"));
@@ -71,9 +93,9 @@ _nc_init_acs(void)
if (real_map != fake_map) {
for (j = 1; j < ACS_LEN; ++j) {
real_map[j] = 0;
- fake_map[j] = A_ALTCHARSET | j;
- if (SP)
- SP->_screen_acs_map[j] = FALSE;
+ fake_map[j] = A_ALTCHARSET | (chtype) j;
+ if (SP_PARM)
+ SP_PARM->_screen_acs_map[j] = FALSE;
}
} else {
for (j = 1; j < ACS_LEN; ++j) {
@@ -118,7 +140,34 @@ _nc_init_acs(void)
real_map['{'] = '*'; /* should be greek pi */
real_map['|'] = '!'; /* should be not-equal */
real_map['}'] = 'f'; /* should be pound-sterling symbol */
+ /* thick-line-drawing */
+ real_map['L'] = '+'; /* upper left corner */
+ real_map['M'] = '+'; /* lower left corner */
+ real_map['K'] = '+'; /* upper right corner */
+ real_map['J'] = '+'; /* lower right corner */
+ real_map['T'] = '+'; /* tee pointing left */
+ real_map['U'] = '+'; /* tee pointing right */
+ real_map['V'] = '+'; /* tee pointing up */
+ real_map['W'] = '+'; /* tee pointing down */
+ real_map['Q'] = '-'; /* horizontal line */
+ real_map['X'] = '|'; /* vertical line */
+ real_map['N'] = '+'; /* large plus or crossover */
+ /* double-line-drawing */
+ real_map['C'] = '+'; /* upper left corner */
+ real_map['D'] = '+'; /* lower left corner */
+ real_map['B'] = '+'; /* upper right corner */
+ real_map['A'] = '+'; /* lower right corner */
+ real_map['G'] = '+'; /* tee pointing left */
+ real_map['F'] = '+'; /* tee pointing right */
+ real_map['H'] = '+'; /* tee pointing up */
+ real_map['I'] = '+'; /* tee pointing down */
+ real_map['R'] = '-'; /* horizontal line */
+ real_map['Y'] = '|'; /* vertical line */
+ real_map['E'] = '+'; /* large plus or crossover */
+#ifdef USE_TERM_DRIVER
+ CallDriver_2(SP_PARM, initacs, real_map, fake_map);
+#else
if (ena_acs != NULL) {
TPUTS_TRACE("ena_acs");
putp(ena_acs);
@@ -140,7 +189,7 @@ _nc_init_acs(void)
size_t i;
for (i = 1; i < ACS_LEN; ++i) {
if (real_map[i] == 0) {
- real_map[i] = i;
+ real_map[i] = (chtype) i;
if (real_map != fake_map) {
if (SP != 0)
SP->_screen_acs_map[i] = TRUE;
@@ -191,4 +240,13 @@ _nc_init_acs(void)
_nc_unlock_global(tracef);
}
#endif /* TRACE */
+#endif
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_init_acs(void)
+{
+ NCURSES_SP_NAME(_nc_init_acs) (CURRENT_SCREEN);
}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/lib_baudrate.c b/contrib/ncurses/ncurses/tinfo/lib_baudrate.c
index b9cdfda9acce..9302f022b89c 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_baudrate.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_baudrate.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -38,7 +38,6 @@
*/
#include <curses.priv.h>
-#include <term.h> /* cur_term, pad_char */
#include <termcap.h> /* ospeed */
#if defined(__FreeBSD__)
#include <sys/param.h>
@@ -80,7 +79,7 @@
#undef USE_OLD_TTY
#endif /* USE_OLD_TTY */
-MODULE_ID("$Id: lib_baudrate.c,v 1.27 2008/06/28 15:19:24 tom Exp $")
+MODULE_ID("$Id: lib_baudrate.c,v 1.31 2010/12/19 01:50:50 tom Exp $")
/*
* int
@@ -195,11 +194,11 @@ _nc_ospeed(int BaudRate)
}
NCURSES_EXPORT(int)
-baudrate(void)
+NCURSES_SP_NAME(baudrate) (NCURSES_SP_DCL0)
{
int result;
- T((T_CALLED("baudrate()")));
+ T((T_CALLED("baudrate(%p)"), (void *) SP_PARM));
/*
* In debugging, allow the environment symbol to override when we're
@@ -207,32 +206,41 @@ baudrate(void)
* that take into account costs that depend on baudrate.
*/
#ifdef TRACE
- if (!isatty(fileno(SP ? SP->_ofp : stdout))
+ if (IsValidTIScreen(SP_PARM)
+ && !isatty(fileno(SP_PARM ? SP_PARM->_ofp : stdout))
&& getenv("BAUDRATE") != 0) {
int ret;
if ((ret = _nc_getenv_num("BAUDRATE")) <= 0)
ret = 9600;
- ospeed = _nc_ospeed(ret);
+ ospeed = (NCURSES_OSPEED) _nc_ospeed(ret);
returnCode(ret);
}
#endif
- if (cur_term != 0) {
+ if (IsValidTIScreen(SP_PARM)) {
#ifdef USE_OLD_TTY
- result = cfgetospeed(&cur_term->Nttyb);
+ result = cfgetospeed(&(TerminalOf(SP_PARM)->Nttyb));
ospeed = _nc_ospeed(result);
#else /* !USE_OLD_TTY */
#ifdef TERMIOS
- ospeed = cfgetospeed(&cur_term->Nttyb);
+ ospeed = (NCURSES_OSPEED) cfgetospeed(&(TerminalOf(SP_PARM)->Nttyb));
#else
- ospeed = cur_term->Nttyb.sg_ospeed;
+ ospeed = (NCURSES_OSPEED) TerminalOf(SP_PARM)->Nttyb.sg_ospeed;
#endif
result = _nc_baudrate(ospeed);
#endif
- cur_term->_baudrate = result;
+ TerminalOf(SP_PARM)->_baudrate = result;
} else {
result = ERR;
}
returnCode(result);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+baudrate(void)
+{
+ return NCURSES_SP_NAME(baudrate) (CURRENT_SCREEN);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/lib_cur_term.c b/contrib/ncurses/ncurses/tinfo/lib_cur_term.c
index 626578d5c08b..86e130e78527 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_cur_term.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_cur_term.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -37,69 +37,141 @@
*/
#include <curses.priv.h>
-#include <term_entry.h> /* TTY, cur_term */
#include <termcap.h> /* ospeed */
-MODULE_ID("$Id: lib_cur_term.c,v 1.18 2008/08/16 19:22:55 tom Exp $")
+MODULE_ID("$Id: lib_cur_term.c,v 1.30 2010/12/19 01:38:45 tom Exp $")
#undef CUR
#define CUR termp->type.
-#if BROKEN_LINKER || USE_REENTRANT
+#if BROKEN_LINKER && !USE_REENTRANT
+NCURSES_EXPORT_VAR(TERMINAL *) cur_term = 0;
+#elif BROKEN_LINKER || USE_REENTRANT
+
+NCURSES_EXPORT(TERMINAL *)
+NCURSES_SP_NAME(_nc_get_cur_term) (NCURSES_SP_DCL0)
+{
+ return ((0 != TerminalOf(SP_PARM)) ? TerminalOf(SP_PARM) : CurTerm);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(TERMINAL *)
+_nc_get_cur_term(void)
+{
+ return NCURSES_SP_NAME(_nc_get_cur_term) (CURRENT_SCREEN);
+}
+#endif
+
NCURSES_EXPORT(TERMINAL *)
NCURSES_PUBLIC_VAR(cur_term) (void)
{
- return (SP != 0 && SP->_term != 0) ? SP->_term : _nc_prescreen._cur_term;
+#if NCURSES_SP_FUNCS
+ return NCURSES_SP_NAME(_nc_get_cur_term) (CURRENT_SCREEN);
+#else
+ return NCURSES_SP_NAME(_nc_get_cur_term) (NCURSES_SP_ARG);
+#endif
}
+
#else
NCURSES_EXPORT_VAR(TERMINAL *) cur_term = 0;
#endif
NCURSES_EXPORT(TERMINAL *)
-set_curterm(TERMINAL * termp)
+NCURSES_SP_NAME(set_curterm) (NCURSES_SP_DCLx TERMINAL * termp)
{
TERMINAL *oldterm;
- T((T_CALLED("set_curterm(%p)"), termp));
+ T((T_CALLED("set_curterm(%p)"), (void *) termp));
_nc_lock_global(curses);
oldterm = cur_term;
- if (SP)
- SP->_term = termp;
-#if BROKEN_LINKER || USE_REENTRANT
- _nc_prescreen._cur_term = termp;
-#else
+ if (SP_PARM)
+ SP_PARM->_term = termp;
+#if BROKEN_LINKER && !USE_REENTRANT
cur_term = termp;
+#else
+ CurTerm = termp;
#endif
if (termp != 0) {
- ospeed = _nc_ospeed(termp->_baudrate);
+#ifdef USE_TERM_DRIVER
+ TERMINAL_CONTROL_BLOCK *TCB = (TERMINAL_CONTROL_BLOCK *) termp;
+ ospeed = (NCURSES_OSPEED) _nc_ospeed(termp->_baudrate);
+ if (TCB->drv->isTerminfo && termp->type.Strings) {
+ PC = (char) ((pad_char != NULL) ? pad_char[0] : 0);
+ }
+ TCB->csp = SP_PARM;
+#else
+ ospeed = (NCURSES_OSPEED) _nc_ospeed(termp->_baudrate);
if (termp->type.Strings) {
PC = (char) ((pad_char != NULL) ? pad_char[0] : 0);
}
+#endif
}
_nc_unlock_global(curses);
- T((T_RETURN("%p"), oldterm));
+ T((T_RETURN("%p"), (void *) oldterm));
return (oldterm);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(TERMINAL *)
+set_curterm(TERMINAL * termp)
+{
+ return NCURSES_SP_NAME(set_curterm) (CURRENT_SCREEN, termp);
+}
+#endif
+
NCURSES_EXPORT(int)
-del_curterm(TERMINAL * termp)
+NCURSES_SP_NAME(del_curterm) (NCURSES_SP_DCLx TERMINAL * termp)
{
int rc = ERR;
- T((T_CALLED("del_curterm(%p)"), termp));
+ T((T_CALLED("del_curterm(%p, %p)"), (void *) SP_PARM, (void *) termp));
- _nc_lock_global(curses);
if (termp != 0) {
+#ifdef USE_TERM_DRIVER
+ TERMINAL_CONTROL_BLOCK *TCB = (TERMINAL_CONTROL_BLOCK *) termp;
+#endif
+ TERMINAL *cur = (
+#if BROKEN_LINKER && !USE_REENTRANT
+ cur_term
+#elif BROKEN_LINKER || USE_REENTRANT
+ NCURSES_SP_NAME(_nc_get_cur_term) (NCURSES_SP_ARG)
+#else
+ cur_term
+#endif
+ );
+
_nc_free_termtype(&(termp->type));
+ if (termp == cur)
+ NCURSES_SP_NAME(set_curterm) (NCURSES_SP_ARGx 0);
+
FreeIfNeeded(termp->_termname);
+#if USE_HOME_TERMINFO
+ if (_nc_globals.home_terminfo != 0)
+ FreeAndNull(_nc_globals.home_terminfo);
+#endif
+#ifdef USE_TERM_DRIVER
+ if (TCB->drv)
+ TCB->drv->release(TCB);
+#endif
free(termp);
- if (termp == cur_term)
- set_curterm(0);
+
rc = OK;
}
+ returnCode(rc);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+del_curterm(TERMINAL * termp)
+{
+ int rc = ERR;
+
+ _nc_lock_global(curses);
+ rc = NCURSES_SP_NAME(del_curterm) (CURRENT_SCREEN, termp);
_nc_unlock_global(curses);
- returnCode(rc);
+ return (rc);
}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/lib_data.c b/contrib/ncurses/ncurses/tinfo/lib_data.c
index e84209d4022c..195ddf978ab6 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_data.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_data.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer *
****************************************************************************/
/*
@@ -41,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_data.c,v 1.52 2008/08/23 22:16:15 tom Exp $")
+MODULE_ID("$Id: lib_data.c,v 1.61 2010/05/15 22:06:56 tom Exp $")
/*
* OS/2's native linker complains if we don't initialize public data when
@@ -51,17 +52,17 @@ MODULE_ID("$Id: lib_data.c,v 1.52 2008/08/23 22:16:15 tom Exp $")
NCURSES_EXPORT(WINDOW *)
NCURSES_PUBLIC_VAR(stdscr) (void)
{
- return SP ? SP->_stdscr : 0;
+ return CURRENT_SCREEN ? StdScreen(CURRENT_SCREEN) : 0;
}
NCURSES_EXPORT(WINDOW *)
NCURSES_PUBLIC_VAR(curscr) (void)
{
- return SP ? SP->_curscr : 0;
+ return CURRENT_SCREEN ? CurScreen(CURRENT_SCREEN) : 0;
}
NCURSES_EXPORT(WINDOW *)
NCURSES_PUBLIC_VAR(newscr) (void)
{
- return SP ? SP->_newscr : 0;
+ return CURRENT_SCREEN ? NewScreen(CURRENT_SCREEN) : 0;
}
#else
NCURSES_EXPORT_VAR(WINDOW *) stdscr = 0;
@@ -93,7 +94,7 @@ _nc_screen(void)
NCURSES_EXPORT(int)
_nc_alloc_screen(void)
{
- return ((my_screen = typeCalloc(SCREEN, 1)) != 0);
+ return ((my_screen = _nc_alloc_screen_sp()) != 0);
}
NCURSES_EXPORT(void)
@@ -103,6 +104,7 @@ _nc_set_screen(SCREEN *sp)
}
#else
+
NCURSES_EXPORT_VAR(SCREEN *) SP = NULL; /* Some linkers require initialized data... */
#endif
/* *INDENT-OFF* */
@@ -140,7 +142,9 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
0, /* tgetent_index */
0, /* tgetent_sequence */
+#ifndef USE_SP_WINDOWLIST
0, /* _nc_windowlist */
+#endif
#if USE_HOME_TERMINFO
NULL, /* home_terminfo */
@@ -151,6 +155,10 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
0, /* safeprint_rows */
#endif
+#ifdef USE_TERM_DRIVER
+ 0, /* term_driver */
+#endif
+
#ifdef TRACE
FALSE, /* init_trace */
CHARS_0s, /* trace_fname */
@@ -174,7 +182,9 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
{ CHARS_0s, CHARS_0s }, /* traceatr_color_buf */
0, /* traceatr_color_sel */
-1, /* traceatr_color_last */
-
+#if !defined(USE_PTHREADS) && USE_REENTRANT
+ 0, /* nested_tracef */
+#endif
#endif /* TRACE */
#ifdef USE_PTHREADS
PTHREAD_MUTEX_INITIALIZER, /* mutex_curses */
@@ -183,6 +193,9 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
0, /* nested_tracef */
0, /* use_pthreads */
#endif
+#if USE_PTHREADS_EINTR
+ 0, /* read_thread */
+#endif
};
#define STACK_FRAME_0 { { 0 }, 0 }
@@ -196,8 +209,10 @@ NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = {
TRUE, /* use_env */
FALSE, /* filter_mode */
A_NORMAL, /* previous_attr */
+#ifndef USE_SP_RIPOFF
RIPOFF_0s, /* ripoff */
NULL, /* rsp */
+#endif
{ /* tparm_state */
#ifdef TRACE
NULL, /* tname */
@@ -221,10 +236,13 @@ NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = {
#if NCURSES_NO_PADDING
FALSE, /* flag to set if padding disabled */
#endif
+ 0, /* _outch */
#if BROKEN_LINKER || USE_REENTRANT
NULL, /* real_acs_map */
0, /* LINES */
0, /* COLS */
+ 8, /* TABSIZE */
+ 1000, /* ESCDELAY */
0, /* cur_term */
#ifdef TRACE
0L, /* _outchars */
@@ -234,6 +252,22 @@ NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = {
};
/* *INDENT-ON* */
+/*
+ * wgetch() and other functions with a WINDOW* parameter may use a SCREEN*
+ * internally, and it is useful to allow those to be invoked without switching
+ * SCREEN's, e.g., for multi-threaded applications.
+ */
+NCURSES_EXPORT(SCREEN *)
+_nc_screen_of(WINDOW *win)
+{
+ SCREEN *sp = 0;
+
+ if (win != 0) {
+ sp = WINDOW_EXT(win, screen);
+ }
+ return (sp);
+}
+
/******************************************************************************/
#ifdef USE_PTHREADS
static void
@@ -314,7 +348,9 @@ _nc_mutex_unlock(pthread_mutex_t * obj)
return 0;
return pthread_mutex_unlock(obj);
}
+#endif /* USE_PTHREADS */
+#if defined(USE_PTHREADS) || USE_PTHREADS_EINTR
#if USE_WEAK_SYMBOLS
/*
* NB: sigprocmask(2) is global but pthread_sigmask(3p)
diff --git a/contrib/ncurses/ncurses/tinfo/lib_has_cap.c b/contrib/ncurses/ncurses/tinfo/lib_has_cap.c
index 0dc66bd9b918..d1b9b8d966da 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_has_cap.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_has_cap.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2009 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 *
@@ -30,6 +30,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: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -41,25 +42,53 @@
#include <curses.priv.h>
-#include <term.h>
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
-MODULE_ID("$Id: lib_has_cap.c,v 1.4 2003/10/25 19:43:55 tom Exp $")
+MODULE_ID("$Id: lib_has_cap.c,v 1.9 2009/10/24 22:15:47 tom Exp $")
NCURSES_EXPORT(bool)
+NCURSES_SP_NAME(has_ic) (NCURSES_SP_DCL0)
+{
+ bool code = FALSE;
+
+ T((T_CALLED("has_ic(%p)"), (void *) SP_PARM));
+
+ if (IsValidTIScreen(SP_PARM) && IsTermInfo(SP_PARM)) {
+ code = ((insert_character || parm_ich
+ || (enter_insert_mode && exit_insert_mode))
+ && (delete_character || parm_dch)) ? TRUE : FALSE;
+ }
+
+ returnCode(code);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(bool)
has_ic(void)
{
- T((T_CALLED("has_ic()")));
- returnCode(cur_term &&
- (insert_character || parm_ich
- || (enter_insert_mode && exit_insert_mode))
- && (delete_character || parm_dch));
+ return NCURSES_SP_NAME(has_ic) (CURRENT_SCREEN);
+}
+#endif
+
+NCURSES_EXPORT(bool)
+NCURSES_SP_NAME(has_il) (NCURSES_SP_DCL0)
+{
+ bool code = FALSE;
+ T((T_CALLED("has_il(%p)"), (void *) SP_PARM));
+ if (IsValidTIScreen(SP_PARM) && IsTermInfo(SP_PARM)) {
+ code = ((insert_line || parm_insert_line)
+ && (delete_line || parm_delete_line)) ? TRUE : FALSE;
+ }
+
+ returnCode(code);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(bool)
has_il(void)
{
- T((T_CALLED("has_il()")));
- returnCode(cur_term
- && (insert_line || parm_insert_line)
- && (delete_line || parm_delete_line));
+ return NCURSES_SP_NAME(has_il) (CURRENT_SCREEN);
}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/lib_kernel.c b/contrib/ncurses/ncurses/tinfo/lib_kernel.c
index 89dc1e80ea8e..37f70842907d 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_kernel.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_kernel.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,7 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
- * and: Thomas E. Dickey 2002 *
+ * and: Thomas E. Dickey 2002 *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -46,9 +47,8 @@
*/
#include <curses.priv.h>
-#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_kernel.c,v 1.24 2004/05/08 17:11:21 tom Exp $")
+MODULE_ID("$Id: lib_kernel.c,v 1.31 2010/12/19 01:21:19 tom Exp $")
static int
_nc_vdisable(void)
@@ -59,7 +59,7 @@ _nc_vdisable(void)
#endif
#if defined(_PC_VDISABLE)
if (value == -1) {
- value = fpathconf(0, _PC_VDISABLE);
+ value = (int) fpathconf(0, _PC_VDISABLE);
if (value == -1) {
value = 0377;
}
@@ -79,22 +79,32 @@ _nc_vdisable(void)
*/
NCURSES_EXPORT(char)
-erasechar(void)
+NCURSES_SP_NAME(erasechar) (NCURSES_SP_DCL0)
{
int result = ERR;
- T((T_CALLED("erasechar()")));
+ TERMINAL *termp = TerminalOf(SP_PARM);
+
+ T((T_CALLED("erasechar(%p)"), (void *) SP_PARM));
- if (cur_term != 0) {
+ if (termp != 0) {
#ifdef TERMIOS
- result = cur_term->Ottyb.c_cc[VERASE];
+ result = termp->Ottyb.c_cc[VERASE];
if (result == _nc_vdisable())
result = ERR;
#else
- result = cur_term->Ottyb.sg_erase;
+ result = termp->Ottyb.sg_erase;
#endif
}
- returnCode(result);
+ returnChar((char) result);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(char)
+erasechar(void)
+{
+ return NCURSES_SP_NAME(erasechar) (CURRENT_SCREEN);
}
+#endif
/*
* killchar()
@@ -104,22 +114,32 @@ erasechar(void)
*/
NCURSES_EXPORT(char)
-killchar(void)
+NCURSES_SP_NAME(killchar) (NCURSES_SP_DCL0)
{
int result = ERR;
- T((T_CALLED("killchar()")));
+ TERMINAL *termp = TerminalOf(SP_PARM);
- if (cur_term != 0) {
+ T((T_CALLED("killchar(%p)"), (void *) SP_PARM));
+
+ if (termp != 0) {
#ifdef TERMIOS
- result = cur_term->Ottyb.c_cc[VKILL];
+ result = termp->Ottyb.c_cc[VKILL];
if (result == _nc_vdisable())
result = ERR;
#else
- result = cur_term->Ottyb.sg_kill;
+ result = termp->Ottyb.sg_kill;
#endif
}
- returnCode(result);
+ returnChar((char) result);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(char)
+killchar(void)
+{
+ return NCURSES_SP_NAME(killchar) (CURRENT_SCREEN);
}
+#endif
/*
* flushinp()
@@ -129,26 +149,36 @@ killchar(void)
*/
NCURSES_EXPORT(int)
-flushinp(void)
+NCURSES_SP_NAME(flushinp) (NCURSES_SP_DCL0)
{
- T((T_CALLED("flushinp()")));
+ TERMINAL *termp = TerminalOf(SP_PARM);
+
+ T((T_CALLED("flushinp(%p)"), (void *) SP_PARM));
- if (cur_term != 0) {
+ if (termp != 0) {
#ifdef TERMIOS
- tcflush(cur_term->Filedes, TCIFLUSH);
+ tcflush(termp->Filedes, TCIFLUSH);
#else
errno = 0;
do {
- ioctl(cur_term->Filedes, TIOCFLUSH, 0);
+ ioctl(termp->Filedes, TIOCFLUSH, 0);
} while
(errno == EINTR);
#endif
- if (SP) {
- SP->_fifohead = -1;
- SP->_fifotail = 0;
- SP->_fifopeek = 0;
+ if (SP_PARM) {
+ SP_PARM->_fifohead = -1;
+ SP_PARM->_fifotail = 0;
+ SP_PARM->_fifopeek = 0;
}
returnCode(OK);
}
returnCode(ERR);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+flushinp(void)
+{
+ return NCURSES_SP_NAME(flushinp) (CURRENT_SCREEN);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/lib_longname.c b/contrib/ncurses/ncurses/tinfo/lib_longname.c
index 1301ee516944..14903175b322 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_longname.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_longname.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,6 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -40,8 +42,38 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_longname.c,v 1.9 2000/12/10 02:55:07 tom Exp $")
+MODULE_ID("$Id: lib_longname.c,v 1.12 2010/12/20 00:31:26 tom Exp $")
+#if USE_REENTRANT
+NCURSES_EXPORT(char *)
+NCURSES_SP_NAME(longname) (NCURSES_SP_DCL0)
+{
+ static char empty[] =
+ {'\0'};
+ char *ptr;
+
+ T((T_CALLED("longname(%p)"), (void *) SP_PARM));
+
+ if (SP_PARM) {
+ for (ptr = SP_PARM->_ttytype + strlen(SP_PARM->_ttytype);
+ ptr > SP_PARM->_ttytype;
+ ptr--)
+ if (*ptr == '|')
+ returnPtr(ptr + 1);
+ returnPtr(SP_PARM->_ttytype);
+ }
+ return empty;
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(char *)
+longname(void)
+{
+ return NCURSES_SP_NAME(longname) (CURRENT_SCREEN);
+}
+#endif
+
+#else
NCURSES_EXPORT(char *)
longname(void)
{
@@ -49,9 +81,11 @@ longname(void)
T((T_CALLED("longname()")));
- for (ptr = ttytype + strlen(ttytype); ptr > ttytype; ptr--)
+ for (ptr = ttytype + strlen(ttytype);
+ ptr > ttytype;
+ ptr--)
if (*ptr == '|')
returnPtr(ptr + 1);
-
returnPtr(ttytype);
}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/lib_napms.c b/contrib/ncurses/ncurses/tinfo/lib_napms.c
index 417b3b4b4dbc..1e6abda10d09 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_napms.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_napms.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,6 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -49,13 +51,17 @@
#endif
#endif
-MODULE_ID("$Id: lib_napms.c,v 1.17 2008/05/03 21:34:13 tom Exp $")
+MODULE_ID("$Id: lib_napms.c,v 1.20 2009/11/07 20:37:30 tom Exp $")
NCURSES_EXPORT(int)
-napms(int ms)
+NCURSES_SP_NAME(napms) (NCURSES_SP_DCLx int ms)
{
+ (void) SP_PARM;
T((T_CALLED("napms(%d)"), ms));
+#ifdef USE_TERM_DRIVER
+ CallDriver_1(SP_PARM, nap, ms);
+#else /* !USE_TERM_DRIVER */
#if HAVE_NANOSLEEP
{
struct timespec request, remaining;
@@ -69,6 +75,15 @@ napms(int ms)
#else
_nc_timed_wait(0, 0, ms, (int *) 0 EVENTLIST_2nd(0));
#endif
+#endif /* !USE_TERM_DRIVER */
returnCode(OK);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+napms(int ms)
+{
+ return NCURSES_SP_NAME(napms) (CURRENT_SCREEN, ms);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/lib_options.c b/contrib/ncurses/ncurses/tinfo/lib_options.c
index f3b1485bf111..654bf940aa1f 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_options.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_options.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 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 *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -41,53 +42,67 @@
#include <curses.priv.h>
-#include <term.h>
-
-MODULE_ID("$Id: lib_options.c,v 1.58 2008/08/16 21:20:48 Werner.Fink Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
-static int _nc_curs_set(SCREEN *, int);
-static int _nc_meta(SCREEN *, bool);
+MODULE_ID("$Id: lib_options.c,v 1.71 2009/10/24 21:56:15 tom Exp $")
NCURSES_EXPORT(int)
idlok(WINDOW *win, bool flag)
{
- T((T_CALLED("idlok(%p,%d)"), win, flag));
+ int res = ERR;
+ T((T_CALLED("idlok(%p,%d)"), (void *) win, flag));
if (win) {
- _nc_idlok = win->_idlok = (flag && (has_il() || change_scroll_region));
- returnCode(OK);
- } else
- returnCode(ERR);
+ SCREEN *sp = _nc_screen_of(win);
+ if (sp && IsTermInfo(sp)) {
+ sp->_nc_sp_idlok =
+ win->_idlok = (flag && (NCURSES_SP_NAME(has_il) (NCURSES_SP_ARG)
+ || change_scroll_region));
+ res = OK;
+ }
+ }
+ returnCode(res);
}
NCURSES_EXPORT(void)
idcok(WINDOW *win, bool flag)
{
- T((T_CALLED("idcok(%p,%d)"), win, flag));
-
- if (win)
- _nc_idcok = win->_idcok = (flag && has_ic());
+ T((T_CALLED("idcok(%p,%d)"), (void *) win, flag));
+ if (win) {
+ SCREEN *sp = _nc_screen_of(win);
+ sp->_nc_sp_idcok = win->_idcok = (flag && NCURSES_SP_NAME(has_ic) (NCURSES_SP_ARG));
+ }
returnVoid;
}
NCURSES_EXPORT(int)
-halfdelay(int t)
+NCURSES_SP_NAME(halfdelay) (NCURSES_SP_DCLx int t)
{
- T((T_CALLED("halfdelay(%d)"), t));
+ T((T_CALLED("halfdelay(%p,%d)"), (void *) SP_PARM, t));
- if (t < 1 || t > 255 || SP == 0)
+ if (t < 1 || t > 255 || !IsValidTIScreen(SP_PARM))
returnCode(ERR);
- cbreak();
- SP->_cbreak = t + 1;
+ NCURSES_SP_NAME(cbreak) (NCURSES_SP_ARG);
+ SP_PARM->_cbreak = t + 1;
returnCode(OK);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+halfdelay(int t)
+{
+ return NCURSES_SP_NAME(halfdelay) (CURRENT_SCREEN, t);
+}
+#endif
+
NCURSES_EXPORT(int)
nodelay(WINDOW *win, bool flag)
{
- T((T_CALLED("nodelay(%p,%d)"), win, flag));
+ T((T_CALLED("nodelay(%p,%d)"), (void *) win, flag));
if (win) {
if (flag == TRUE)
@@ -102,7 +117,7 @@ nodelay(WINDOW *win, bool flag)
NCURSES_EXPORT(int)
notimeout(WINDOW *win, bool f)
{
- T((T_CALLED("notimeout(%p,%d)"), win, f));
+ T((T_CALLED("notimeout(%p,%d)"), (void *) win, f));
if (win) {
win->_notimeout = f;
@@ -114,7 +129,7 @@ notimeout(WINDOW *win, bool f)
NCURSES_EXPORT(void)
wtimeout(WINDOW *win, int delay)
{
- T((T_CALLED("wtimeout(%p,%d)"), win, delay));
+ T((T_CALLED("wtimeout(%p,%d)"), (void *) win, delay));
if (win) {
win->_delay = delay;
@@ -125,11 +140,11 @@ wtimeout(WINDOW *win, int delay)
NCURSES_EXPORT(int)
keypad(WINDOW *win, bool flag)
{
- T((T_CALLED("keypad(%p,%d)"), win, flag));
+ T((T_CALLED("keypad(%p,%d)"), (void *) win, flag));
if (win) {
win->_use_keypad = flag;
- returnCode(_nc_keypad(SP, flag));
+ returnCode(_nc_keypad(_nc_screen_of(win), flag));
} else
returnCode(ERR);
}
@@ -137,38 +152,106 @@ keypad(WINDOW *win, bool flag)
NCURSES_EXPORT(int)
meta(WINDOW *win GCC_UNUSED, bool flag)
{
- int result;
+ int result = ERR;
+ SCREEN *sp = (win == 0) ? CURRENT_SCREEN : _nc_screen_of(win);
+
+ /* Ok, we stay relaxed and don't signal an error if win is NULL */
+ T((T_CALLED("meta(%p,%d)"), (void *) win, flag));
/* Ok, we stay relaxed and don't signal an error if win is NULL */
- T((T_CALLED("meta(%p,%d)"), win, flag));
- result = _nc_meta(SP, flag);
+
+ if (sp != 0) {
+ sp->_use_meta = flag;
+#ifdef USE_TERM_DRIVER
+ if (IsTermInfo(sp)) {
+ if (flag) {
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_on", meta_on);
+ } else {
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_off", meta_off);
+ }
+ }
+#else
+ if (flag) {
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_on", meta_on);
+ } else {
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_off", meta_off);
+ }
+#endif
+ result = OK;
+ }
returnCode(result);
}
/* curs_set() moved here to narrow the kernel interface */
NCURSES_EXPORT(int)
-curs_set(int vis)
+NCURSES_SP_NAME(curs_set) (NCURSES_SP_DCLx int vis)
{
- int result;
+ int code = ERR;
+ T((T_CALLED("curs_set(%p,%d)"), (void *) SP_PARM, vis));
- T((T_CALLED("curs_set(%d)"), vis));
- result = _nc_curs_set(SP, vis);
- returnCode(result);
+ if (SP_PARM != 0 && vis >= 0 && vis <= 2) {
+ int cursor = SP_PARM->_cursor;
+ bool bBuiltIn = !IsTermInfo(SP_PARM);
+ if (vis == cursor) {
+ code = cursor;
+ } else {
+ if (!bBuiltIn) {
+ switch (vis) {
+ case 2:
+ code = NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
+ "cursor_visible",
+ cursor_visible);
+ break;
+ case 1:
+ code = NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
+ "cursor_normal",
+ cursor_normal);
+ break;
+ case 0:
+ code = NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
+ "cursor_invisible",
+ cursor_invisible);
+ break;
+ }
+ } else
+ code = ERR;
+ if (code != ERR)
+ code = (cursor == -1 ? 1 : cursor);
+ SP_PARM->_cursor = vis;
+ }
+ }
+ returnCode(code);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-typeahead(int fd)
+curs_set(int vis)
{
- T((T_CALLED("typeahead(%d)"), fd));
- if (SP != 0) {
- SP->_checkfd = fd;
+ return (NCURSES_SP_NAME(curs_set) (CURRENT_SCREEN, vis));
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(typeahead) (NCURSES_SP_DCLx int fd)
+{
+ T((T_CALLED("typeahead(%p, %d)"), (void *) SP_PARM, fd));
+ if (IsValidTIScreen(SP_PARM)) {
+ SP_PARM->_checkfd = fd;
returnCode(OK);
} else {
returnCode(ERR);
}
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+typeahead(int fd)
+{
+ return NCURSES_SP_NAME(typeahead) (CURRENT_SCREEN, fd);
+}
+#endif
+
/*
** has_key()
**
@@ -189,42 +272,49 @@ has_key_internal(int keycode, TRIES * tp)
|| has_key_internal(keycode, tp->sibling));
}
+#ifdef USE_TERM_DRIVER
+NCURSES_EXPORT(int)
+TINFO_HAS_KEY(SCREEN *sp, int keycode)
+{
+ return IsValidTIScreen(sp) ?
+ has_key_internal(keycode, sp->_keytry) : 0;
+}
+#else
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(has_key) (NCURSES_SP_DCLx int keycode)
+{
+ T((T_CALLED("has_key(%p,%d)"), (void *) SP_PARM, keycode));
+ returnCode(SP != 0 ? has_key_internal(keycode, SP_PARM->_keytry) : FALSE);
+}
+
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
has_key(int keycode)
{
- T((T_CALLED("has_key(%d)"), keycode));
- returnCode(SP != 0 ? has_key_internal(keycode, SP->_keytry) : FALSE);
+ return NCURSES_SP_NAME(has_key) (CURRENT_SCREEN, keycode);
}
+#endif
+#endif
#endif /* NCURSES_EXT_FUNCS */
-/*
- * Internal entrypoints use SCREEN* parameter to obtain capabilities rather
- * than cur_term.
- */
-#undef CUR
-#define CUR (sp->_term)->type.
-
-static int
-_nc_putp(const char *name GCC_UNUSED, const char *value)
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_DCLx
+ const char *name, const char *value)
{
- int rc = ERR;
-
- if (value) {
- TPUTS_TRACE(name);
- rc = putp(value);
+ int rc = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx name, value);
+ if (rc != ERR) {
+ _nc_flush();
}
return rc;
}
-static int
+#if 0 && NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
_nc_putp_flush(const char *name, const char *value)
{
- int rc = _nc_putp(name, value);
- if (rc != ERR) {
- _nc_flush();
- }
- return rc;
+ return NCURSES_SP_NAME(_nc_putp_flush) (CURRENT_SCREEN, name, value);
}
+#endif
/* Turn the keypad on/off
*
@@ -245,12 +335,12 @@ _nc_keypad(SCREEN *sp, bool flag)
* has wgetch() reading in more than one thread. putp() and below
* may use SP explicitly.
*/
- if (_nc_use_pthreads && sp != SP) {
+ if (_nc_use_pthreads && sp != CURRENT_SCREEN) {
SCREEN *save_sp;
/* cannot use use_screen(), since that is not in tinfo library */
_nc_lock_global(curses);
- save_sp = SP;
+ save_sp = CURRENT_SCREEN;
_nc_set_screen(sp);
rc = _nc_keypad(sp, flag);
_nc_set_screen(save_sp);
@@ -258,10 +348,19 @@ _nc_keypad(SCREEN *sp, bool flag)
} else
#endif
{
+#ifdef USE_TERM_DRIVER
+ rc = CallDriver_1(sp, kpad, flag);
+ if (rc == OK)
+ sp->_keypad_on = flag;
+#else
if (flag) {
- (void) _nc_putp_flush("keypad_xmit", keypad_xmit);
+ (void) NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
+ "keypad_xmit",
+ keypad_xmit);
} else if (!flag && keypad_local) {
- (void) _nc_putp_flush("keypad_local", keypad_local);
+ (void) NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
+ "keypad_local",
+ keypad_local);
}
if (flag && !sp->_tried) {
@@ -270,58 +369,8 @@ _nc_keypad(SCREEN *sp, bool flag)
}
sp->_keypad_on = flag;
rc = OK;
+#endif
}
}
return (rc);
}
-
-static int
-_nc_curs_set(SCREEN *sp, int vis)
-{
- int result = ERR;
-
- T((T_CALLED("curs_set(%d)"), vis));
- if (sp != 0 && vis >= 0 && vis <= 2) {
- int cursor = sp->_cursor;
-
- if (vis == cursor) {
- result = cursor;
- } else {
- switch (vis) {
- case 2:
- result = _nc_putp_flush("cursor_visible", cursor_visible);
- break;
- case 1:
- result = _nc_putp_flush("cursor_normal", cursor_normal);
- break;
- case 0:
- result = _nc_putp_flush("cursor_invisible", cursor_invisible);
- break;
- }
- if (result != ERR)
- result = (cursor == -1 ? 1 : cursor);
- sp->_cursor = vis;
- }
- }
- returnCode(result);
-}
-
-static int
-_nc_meta(SCREEN *sp, bool flag)
-{
- int result = ERR;
-
- /* Ok, we stay relaxed and don't signal an error if win is NULL */
-
- if (SP != 0) {
- SP->_use_meta = flag;
-
- if (flag) {
- _nc_putp("meta_on", meta_on);
- } else {
- _nc_putp("meta_off", meta_off);
- }
- result = OK;
- }
- return result;
-}
diff --git a/contrib/ncurses/ncurses/tinfo/lib_print.c b/contrib/ncurses/ncurses/tinfo/lib_print.c
index 975b46d85773..c7bd3a62fa87 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_print.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_print.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,23 +29,31 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer *
****************************************************************************/
#include <curses.priv.h>
-#include <term.h>
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
-MODULE_ID("$Id: lib_print.c,v 1.16 2006/11/26 00:26:34 tom Exp $")
+MODULE_ID("$Id: lib_print.c,v 1.20 2010/06/05 22:18:35 tom Exp $")
NCURSES_EXPORT(int)
-mcprint(char *data, int len)
+NCURSES_SP_NAME(mcprint) (NCURSES_SP_DCLx char *data, int len)
/* ship binary character data to the printer via mc4/mc5/mc5p */
{
+ int result;
char *mybuf, *switchon;
- size_t onsize, offsize, res;
+ size_t onsize, offsize;
+ size_t need;
errno = 0;
- if (!cur_term || (!prtr_non && (!prtr_on || !prtr_off))) {
+ if (!HasTInfoTerminal(SP_PARM)
+ || len <= 0
+ || (!prtr_non && (!prtr_on || !prtr_off))) {
errno = ENODEV;
return (ERR);
}
@@ -60,8 +68,10 @@ mcprint(char *data, int len)
offsize = strlen(prtr_off);
}
+ need = onsize + (size_t) len + offsize;
+
if (switchon == 0
- || (mybuf = typeMalloc(char, onsize + len + offsize + 1)) == 0) {
+ || (mybuf = typeMalloc(char, need + 1)) == 0) {
errno = ENOMEM;
return (ERR);
}
@@ -78,15 +88,24 @@ mcprint(char *data, int len)
* data has actually been shipped to the terminal. If the write(2)
* operation is truly atomic we're protected from this.
*/
- res = write(cur_term->Filedes, mybuf, onsize + len + offsize);
+ result = (int) write(TerminalOf(SP_PARM)->Filedes, mybuf, need);
/*
* By giving up our scheduler slot here we increase the odds that the
* kernel will ship the contiguous clist items from the last write
* immediately.
*/
+#ifndef __MINGW32__
(void) sleep(0);
-
+#endif
free(mybuf);
- return (res);
+ return (result);
+}
+
+#if NCURSES_SP_FUNCS && !defined(USE_TERM_DRIVER)
+NCURSES_EXPORT(int)
+mcprint(char *data, int len)
+{
+ return NCURSES_SP_NAME(mcprint) (CURRENT_SCREEN, data, len);
}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/lib_raw.c b/contrib/ncurses/ncurses/tinfo/lib_raw.c
index 58e71889af12..b524a1bb55be 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_raw.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_raw.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,7 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
- * and: Thomas E. Dickey 1998 on *
+ * and: Thomas E. Dickey 1998-on *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -47,9 +48,8 @@
*/
#include <curses.priv.h>
-#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_raw.c,v 1.14 2007/09/29 21:50:22 tom Exp $")
+MODULE_ID("$Id: lib_raw.c,v 1.19 2010/04/24 23:49:12 tom Exp $")
#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
@@ -61,7 +61,7 @@ MODULE_ID("$Id: lib_raw.c,v 1.14 2007/09/29 21:50:22 tom Exp $")
#ifdef __EMX__
#include <io.h>
-#define _nc_setmode(mode) setmode(SP->_ifd, mode)
+#define _nc_setmode(mode) setmode(SP_PARM->_ifd, mode)
#else
#define _nc_setmode(mode) /* nothing */
#endif
@@ -77,188 +77,235 @@ MODULE_ID("$Id: lib_raw.c,v 1.14 2007/09/29 21:50:22 tom Exp $")
#endif /* TRACE */
NCURSES_EXPORT(int)
-raw(void)
+NCURSES_SP_NAME(raw) (NCURSES_SP_DCL0)
{
int result = ERR;
+ TERMINAL *termp;
- T((T_CALLED("raw()")));
-
- if (SP != 0 && cur_term != 0) {
+ T((T_CALLED("raw(%p)"), (void *) SP_PARM));
+ if ((termp = TerminalOf(SP_PARM)) != 0) {
TTY buf;
BEFORE("raw");
_nc_setmode(O_BINARY);
- buf = cur_term->Nttyb;
+ buf = termp->Nttyb;
#ifdef TERMIOS
- buf.c_lflag &= ~(ICANON | ISIG | IEXTEN);
- buf.c_iflag &= ~(COOKED_INPUT);
+ buf.c_lflag &= (unsigned) ~(ICANON | ISIG | IEXTEN);
+ buf.c_iflag &= (unsigned) ~(COOKED_INPUT);
buf.c_cc[VMIN] = 1;
buf.c_cc[VTIME] = 0;
#else
buf.sg_flags |= RAW;
#endif
- if ((result = _nc_set_tty_mode(&buf)) == OK) {
- SP->_raw = TRUE;
- SP->_cbreak = 1;
- cur_term->Nttyb = buf;
+ result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf);
+ if (result == OK) {
+ SP_PARM->_raw = TRUE;
+ SP_PARM->_cbreak = 1;
+ termp->Nttyb = buf;
}
AFTER("raw");
}
returnCode(result);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-cbreak(void)
+raw(void)
{
- int result = ERR;
+ return NCURSES_SP_NAME(raw) (CURRENT_SCREEN);
+}
+#endif
- T((T_CALLED("cbreak()")));
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(cbreak) (NCURSES_SP_DCL0)
+{
+ int result = ERR;
+ TERMINAL *termp;
- if (SP != 0 && cur_term != 0) {
+ T((T_CALLED("cbreak(%p)"), (void *) SP_PARM));
+ if ((termp = TerminalOf(SP_PARM)) != 0) {
TTY buf;
BEFORE("cbreak");
_nc_setmode(O_BINARY);
- buf = cur_term->Nttyb;
+ buf = termp->Nttyb;
#ifdef TERMIOS
- buf.c_lflag &= ~ICANON;
- buf.c_iflag &= ~ICRNL;
+ buf.c_lflag &= (unsigned) ~ICANON;
+ buf.c_iflag &= (unsigned) ~ICRNL;
buf.c_lflag |= ISIG;
buf.c_cc[VMIN] = 1;
buf.c_cc[VTIME] = 0;
#else
buf.sg_flags |= CBREAK;
#endif
- if ((result = _nc_set_tty_mode(&buf)) == OK) {
- SP->_cbreak = 1;
- cur_term->Nttyb = buf;
+ result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf);
+ if (result == OK) {
+ SP_PARM->_cbreak = 1;
+ termp->Nttyb = buf;
}
AFTER("cbreak");
}
returnCode(result);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+cbreak(void)
+{
+ return NCURSES_SP_NAME(cbreak) (CURRENT_SCREEN);
+}
+#endif
+
/*
* Note:
* this implementation may be wrong. See the comment under intrflush().
*/
NCURSES_EXPORT(void)
-qiflush(void)
+NCURSES_SP_NAME(qiflush) (NCURSES_SP_DCL0)
{
int result = ERR;
+ TERMINAL *termp;
- T((T_CALLED("qiflush()")));
-
- if (cur_term != 0) {
+ T((T_CALLED("qiflush(%p)"), (void *) SP_PARM));
+ if ((termp = TerminalOf(SP_PARM)) != 0) {
TTY buf;
BEFORE("qiflush");
- buf = cur_term->Nttyb;
+ buf = termp->Nttyb;
#ifdef TERMIOS
- buf.c_lflag &= ~(NOFLSH);
- result = _nc_set_tty_mode(&buf);
+ buf.c_lflag &= (unsigned) ~(NOFLSH);
+ result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf);
#else
/* FIXME */
#endif
if (result == OK)
- cur_term->Nttyb = buf;
+ termp->Nttyb = buf;
AFTER("qiflush");
}
returnVoid;
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+qiflush(void)
+{
+ NCURSES_SP_NAME(qiflush) (CURRENT_SCREEN);
+}
+#endif
+
NCURSES_EXPORT(int)
-noraw(void)
+NCURSES_SP_NAME(noraw) (NCURSES_SP_DCL0)
{
int result = ERR;
+ TERMINAL *termp;
- T((T_CALLED("noraw()")));
-
- if (SP != 0 && cur_term != 0) {
+ T((T_CALLED("noraw(%p)"), (void *) SP_PARM));
+ if ((termp = TerminalOf(SP_PARM)) != 0) {
TTY buf;
BEFORE("noraw");
_nc_setmode(O_TEXT);
- buf = cur_term->Nttyb;
+ buf = termp->Nttyb;
#ifdef TERMIOS
buf.c_lflag |= ISIG | ICANON |
- (cur_term->Ottyb.c_lflag & IEXTEN);
+ (termp->Ottyb.c_lflag & IEXTEN);
buf.c_iflag |= COOKED_INPUT;
#else
buf.sg_flags &= ~(RAW | CBREAK);
#endif
- if ((result = _nc_set_tty_mode(&buf)) == OK) {
- SP->_raw = FALSE;
- SP->_cbreak = 0;
- cur_term->Nttyb = buf;
+ result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf);
+ if (result == OK) {
+ SP_PARM->_raw = FALSE;
+ SP_PARM->_cbreak = 0;
+ termp->Nttyb = buf;
}
AFTER("noraw");
}
returnCode(result);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-nocbreak(void)
+noraw(void)
{
- int result = ERR;
+ return NCURSES_SP_NAME(noraw) (CURRENT_SCREEN);
+}
+#endif
- T((T_CALLED("nocbreak()")));
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(nocbreak) (NCURSES_SP_DCL0)
+{
+ int result = ERR;
+ TERMINAL *termp;
- if (SP != 0 && cur_term != 0) {
+ T((T_CALLED("nocbreak(%p)"), (void *) SP_PARM));
+ if ((termp = TerminalOf(SP_PARM)) != 0) {
TTY buf;
BEFORE("nocbreak");
_nc_setmode(O_TEXT);
- buf = cur_term->Nttyb;
+ buf = termp->Nttyb;
#ifdef TERMIOS
buf.c_lflag |= ICANON;
buf.c_iflag |= ICRNL;
#else
buf.sg_flags &= ~CBREAK;
#endif
- if ((result = _nc_set_tty_mode(&buf)) == OK) {
- SP->_cbreak = 0;
- cur_term->Nttyb = buf;
+ result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf);
+ if (result == OK) {
+ SP_PARM->_cbreak = 0;
+ termp->Nttyb = buf;
}
AFTER("nocbreak");
}
returnCode(result);
}
-/*
- * Note:
- * this implementation may be wrong. See the comment under intrflush().
- */
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+nocbreak(void)
+{
+ return NCURSES_SP_NAME(nocbreak) (CURRENT_SCREEN);
+}
+#endif
+
NCURSES_EXPORT(void)
-noqiflush(void)
+NCURSES_SP_NAME(noqiflush) (NCURSES_SP_DCL0)
{
int result = ERR;
+ TERMINAL *termp;
- T((T_CALLED("noqiflush()")));
-
- if (cur_term != 0) {
+ T((T_CALLED("noqiflush(%p)"), (void *) SP_PARM));
+ if ((termp = TerminalOf(SP_PARM)) != 0) {
TTY buf;
BEFORE("noqiflush");
- buf = cur_term->Nttyb;
+ buf = termp->Nttyb;
#ifdef TERMIOS
buf.c_lflag |= NOFLSH;
- result = _nc_set_tty_mode(&buf);
+ result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf);
#else
/* FIXME */
#endif
- if (result == OK) {
- cur_term->Nttyb = buf;
- }
+ if (result == OK)
+ termp->Nttyb = buf;
AFTER("noqiflush");
}
returnVoid;
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+noqiflush(void)
+{
+ NCURSES_SP_NAME(noqiflush) (CURRENT_SCREEN);
+}
+#endif
+
/*
* This call does the same thing as the qiflush()/noqiflush() pair. We know
* for certain that SVr3 intrflush() tweaks the NOFLSH bit; on the other hand,
@@ -267,30 +314,41 @@ noqiflush(void)
* curs_inopts(3x) is too exact to be coincidence.
*/
NCURSES_EXPORT(int)
-intrflush(WINDOW *win GCC_UNUSED, bool flag)
+NCURSES_SP_NAME(intrflush) (NCURSES_SP_DCLx WINDOW *win GCC_UNUSED, bool flag)
{
int result = ERR;
+ TERMINAL *termp;
- T((T_CALLED("intrflush(%d)"), flag));
+ T((T_CALLED("intrflush(%p,%d)"), (void *) SP_PARM, flag));
+ if (SP_PARM == 0)
+ returnCode(ERR);
- if (cur_term != 0) {
+ if ((termp = TerminalOf(SP_PARM)) != 0) {
TTY buf;
BEFORE("intrflush");
- buf = cur_term->Nttyb;
+ buf = termp->Nttyb;
#ifdef TERMIOS
if (flag)
- buf.c_lflag &= ~(NOFLSH);
+ buf.c_lflag &= (unsigned) ~(NOFLSH);
else
buf.c_lflag |= (NOFLSH);
- result = _nc_set_tty_mode(&buf);
+ result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf);
#else
/* FIXME */
#endif
if (result == OK) {
- cur_term->Nttyb = buf;
+ termp->Nttyb = buf;
}
AFTER("intrflush");
}
returnCode(result);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+intrflush(WINDOW *win GCC_UNUSED, bool flag)
+{
+ return NCURSES_SP_NAME(intrflush) (CURRENT_SCREEN, win, flag);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/lib_setup.c b/contrib/ncurses/ncurses/tinfo/lib_setup.c
index 8cfaf12c5348..5fcf2ae3fc32 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_setup.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_setup.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 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 *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -41,7 +42,6 @@
#include <curses.priv.h>
#include <tic.h> /* for MAX_NAME_SIZE */
-#include <term_entry.h>
#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
@@ -51,9 +51,7 @@
#include <locale.h>
#endif
-#include <term.h> /* lines, columns, cur_term */
-
-MODULE_ID("$Id: lib_setup.c,v 1.111 2008/08/03 22:42:33 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.135 2011/02/06 01:04:21 tom Exp $")
/****************************************************************************
*
@@ -109,61 +107,96 @@ MODULE_ID("$Id: lib_setup.c,v 1.111 2008/08/03 22:42:33 tom Exp $")
* Wrap global variables in this module.
*/
#if USE_REENTRANT
+
NCURSES_EXPORT(char *)
NCURSES_PUBLIC_VAR(ttytype) (void)
{
static char empty[] = "";
- return cur_term ? cur_term->type.term_names : empty;
+ char *result = empty;
+
+#if NCURSES_SP_FUNCS
+ if (CURRENT_SCREEN) {
+ TERMINAL *termp = TerminalOf(CURRENT_SCREEN);
+ if (termp != 0) {
+ result = termp->type.term_names;
+ }
+ }
+#else
+ if (cur_term != 0) {
+ result = cur_term->type.term_names;
+ }
+#endif
+ return result;
}
+
NCURSES_EXPORT(int *)
-_nc_ptr_Lines(void)
+_nc_ptr_Lines(SCREEN *sp)
{
- return ptrLines();
+ return ptrLines(sp);
}
+
NCURSES_EXPORT(int)
NCURSES_PUBLIC_VAR(LINES) (void)
{
- return *_nc_ptr_Lines();
+ return *_nc_ptr_Lines(CURRENT_SCREEN);
}
+
NCURSES_EXPORT(int *)
-_nc_ptr_Cols(void)
+_nc_ptr_Cols(SCREEN *sp)
{
- return ptrCols();
+ return ptrCols(sp);
}
+
NCURSES_EXPORT(int)
NCURSES_PUBLIC_VAR(COLS) (void)
{
- return *_nc_ptr_Cols();
+ return *_nc_ptr_Cols(CURRENT_SCREEN);
+}
+
+NCURSES_EXPORT(int *)
+_nc_ptr_Tabsize(SCREEN *sp)
+{
+ return ptrTabsize(sp);
}
+
NCURSES_EXPORT(int)
NCURSES_PUBLIC_VAR(TABSIZE) (void)
{
- return SP ? SP->_TABSIZE : 8;
+ return *_nc_ptr_Tabsize(CURRENT_SCREEN);
}
#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;
+NCURSES_EXPORT_VAR(int) TABSIZE = 8;
#endif
#if NCURSES_EXT_FUNCS
NCURSES_EXPORT(int)
-set_tabsize(int value)
+NCURSES_SP_NAME(set_tabsize) (NCURSES_SP_DCLx int value)
{
int code = OK;
#if USE_REENTRANT
- if (SP) {
- SP->_TABSIZE = value;
+ if (SP_PARM) {
+ SP_PARM->_TABSIZE = value;
} else {
code = ERR;
}
#else
+ (void) SP_PARM;
TABSIZE = value;
#endif
return code;
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+set_tabsize(int value)
+{
+ return NCURSES_SP_NAME(set_tabsize) (CURRENT_SCREEN, value);
+}
#endif
+#endif /* NCURSES_EXT_FUNCS */
#if USE_SIGWINCH
/*
@@ -188,42 +221,71 @@ _nc_handle_sigwinch(SCREEN *sp)
#endif
NCURSES_EXPORT(void)
+NCURSES_SP_NAME(use_env) (NCURSES_SP_DCLx bool f)
+{
+ T((T_CALLED("use_env(%p,%d)"), (void *) SP_PARM, (int) f));
+#if NCURSES_SP_FUNCS
+ if (IsPreScreen(SP_PARM)) {
+ SP_PARM->_use_env = f;
+ }
+#else
+ _nc_prescreen.use_env = f;
+#endif
+ returnVoid;
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
use_env(bool f)
{
- T((T_CALLED("use_env()")));
+ T((T_CALLED("use_env(%d)"), (int) f));
_nc_prescreen.use_env = f;
returnVoid;
}
+#endif
NCURSES_EXPORT(void)
-_nc_get_screensize(SCREEN *sp, int *linep, int *colp)
+_nc_get_screensize(SCREEN *sp,
+#ifdef USE_TERM_DRIVER
+ TERMINAL * termp,
+#endif
+ int *linep, int *colp)
/* Obtain lines/columns values from the environment and/or terminfo entry */
{
+#ifdef USE_TERM_DRIVER
+ TERMINAL_CONTROL_BLOCK *TCB;
+ int my_tabsize;
+
+ assert(termp != 0 && linep != 0 && colp != 0);
+ TCB = (TERMINAL_CONTROL_BLOCK *) termp;
+
+ my_tabsize = TCB->info.tabsize;
+ TCB->drv->size(TCB, linep, colp);
+
+#if USE_REENTRANT
+ if (sp != 0) {
+ sp->_TABSIZE = my_tabsize;
+ }
+#else
+ (void) sp;
+ TABSIZE = my_tabsize;
+#endif
+ T(("TABSIZE = %d", my_tabsize));
+#else /* !USE_TERM_DRIVER */
TERMINAL *termp = cur_term;
int my_tabsize;
/* figure out the size of the screen */
T(("screen size: terminfo lines = %d columns = %d", lines, columns));
- if (!_nc_prescreen.use_env) {
- *linep = (int) lines;
- *colp = (int) columns;
- } else { /* usually want to query LINES and COLUMNS from environment */
- int value;
-
- *linep = *colp = 0;
+ *linep = (int) lines;
+ *colp = (int) columns;
- /* first, look for environment variables */
- if ((value = _nc_getenv_num("LINES")) > 0) {
- *linep = value;
- }
- if ((value = _nc_getenv_num("COLUMNS")) > 0) {
- *colp = value;
- }
- T(("screen size: environment LINES = %d COLUMNS = %d", *linep, *colp));
+ if (_nc_prescreen.use_env) {
+ int value;
#ifdef __EMX__
- if (*linep <= 0 || *colp <= 0) {
+ {
int screendata[2];
_scrsize(screendata);
*colp = screendata[0];
@@ -233,33 +295,41 @@ _nc_get_screensize(SCREEN *sp, int *linep, int *colp)
}
#endif
#if HAVE_SIZECHANGE
- /* if that didn't work, maybe we can try asking the OS */
- if (*linep <= 0 || *colp <= 0) {
- if (isatty(cur_term->Filedes)) {
- STRUCT_WINSIZE size;
-
- errno = 0;
- do {
- if (ioctl(cur_term->Filedes, IOCTL_WINSIZE, &size) < 0
- && errno != EINTR)
- goto failure;
- } while
- (errno == EINTR);
-
- /*
- * Solaris lets users override either dimension with an
- * environment variable.
- */
- if (*linep <= 0)
- *linep = (sp != 0 && sp->_filtered) ? 1 : WINSIZE_ROWS(size);
- if (*colp <= 0)
+ /* try asking the OS */
+ if (isatty(cur_term->Filedes)) {
+ STRUCT_WINSIZE size;
+
+ errno = 0;
+ do {
+ if (ioctl(cur_term->Filedes, IOCTL_WINSIZE, &size) >= 0) {
+ *linep = ((sp != 0 && sp->_filtered)
+ ? 1
+ : WINSIZE_ROWS(size));
*colp = WINSIZE_COLS(size);
- }
- /* FALLTHRU */
- failure:;
+ T(("SYS screen size: environment LINES = %d COLUMNS = %d",
+ *linep, *colp));
+ break;
+ }
+ } while
+ (errno == EINTR);
}
#endif /* HAVE_SIZECHANGE */
+ /*
+ * Finally, look for environment variables.
+ *
+ * Solaris lets users override either dimension with an environment
+ * variable.
+ */
+ if ((value = _nc_getenv_num("LINES")) > 0) {
+ *linep = value;
+ T(("screen size: environment LINES = %d", *linep));
+ }
+ if ((value = _nc_getenv_num("COLUMNS")) > 0) {
+ *colp = value;
+ T(("screen size: environment COLUMNS = %d", *colp));
+ }
+
/* if we can't get dynamic info about the size, use static */
if (*linep <= 0) {
*linep = (int) lines;
@@ -298,19 +368,31 @@ _nc_get_screensize(SCREEN *sp, int *linep, int *colp)
TABSIZE = my_tabsize;
#endif
T(("TABSIZE = %d", TABSIZE));
+#endif /* USE_TERM_DRIVER */
}
#if USE_SIZECHANGE
NCURSES_EXPORT(void)
_nc_update_screensize(SCREEN *sp)
{
+ int new_lines;
+ int new_cols;
+
+#ifdef USE_TERM_DRIVER
+ int old_lines;
+ int old_cols;
+
+ assert(sp != 0);
+
+ CallDriver_2(sp, getsize, &old_lines, &old_cols);
+
+#else
TERMINAL *termp = cur_term;
int old_lines = lines;
- int new_lines;
int old_cols = columns;
- int new_cols;
+#endif
- _nc_get_screensize(sp, &new_lines, &new_cols);
+ TINFO_GET_SIZE(sp, sp->_term, &new_lines, &new_cols);
/*
* See is_term_resized() and resizeterm().
@@ -320,7 +402,7 @@ _nc_update_screensize(SCREEN *sp)
if (sp != 0
&& sp->_resize != 0) {
if ((new_lines != old_lines) || (new_cols != old_cols))
- sp->_resize(new_lines, new_cols);
+ sp->_resize(NCURSES_SP_ARGx new_lines, new_cols);
sp->_sig_winch = FALSE;
}
}
@@ -353,8 +435,8 @@ _nc_update_screensize(SCREEN *sp)
* Return 1 if entry found, 0 if not found, -1 if database not accessible,
* just like tgetent().
*/
-static int
-grab_entry(const char *const tn, TERMTYPE *const tp)
+int
+_nc_setup_tinfo(const char *const tn, TERMTYPE *const tp)
{
char filename[PATH_MAX];
int status = _nc_read_entry(tn, filename, tp);
@@ -381,28 +463,27 @@ grab_entry(const char *const tn, TERMTYPE *const tp)
#endif
/*
-** do_prototype()
-**
** Take the real command character out of the CC environment variable
** and substitute it in for the prototype given in 'command_character'.
*/
-static void
-do_prototype(TERMINAL * termp)
+void
+_nc_tinfo_cmdch(TERMINAL * termp, char proto)
{
unsigned i;
char CC;
- char proto;
char *tmp;
- if ((tmp = getenv("CC")) != 0) {
- if ((CC = *tmp) != 0) {
- proto = *command_character;
-
- for_each_string(i, &(termp->type)) {
- for (tmp = termp->type.Strings[i]; *tmp; tmp++) {
- if (*tmp == proto)
- *tmp = CC;
- }
+ /*
+ * Only use the character if the string is a single character,
+ * since it is fairly common for developers to set the C compiler
+ * name as an environment variable - using the same symbol.
+ */
+ if ((tmp = getenv("CC")) != 0 && strlen(tmp) == 1) {
+ CC = *tmp;
+ for_each_string(i, &(termp->type)) {
+ for (tmp = termp->type.Strings[i]; *tmp; tmp++) {
+ if (*tmp == proto)
+ *tmp = CC;
}
}
}
@@ -465,39 +546,64 @@ _nc_unicode_locale(void)
NCURSES_EXPORT(int)
_nc_locale_breaks_acs(TERMINAL * termp)
{
+ const char *env_name = "NCURSES_NO_UTF8_ACS";
char *env;
+ int value;
+ int result = 0;
- if ((env = getenv("NCURSES_NO_UTF8_ACS")) != 0) {
- return atoi(env);
+ if ((env = getenv(env_name)) != 0) {
+ result = _nc_getenv_num(env_name);
+ } else if ((value = tigetnum("U8")) >= 0) {
+ result = value; /* use extension feature */
} else if ((env = getenv("TERM")) != 0) {
- if (strstr(env, "linux"))
- return 1; /* always broken */
- if (strstr(env, "screen") != 0
- && ((env = getenv("TERMCAP")) != 0
- && strstr(env, "screen") != 0)
- && strstr(env, "hhII00") != 0) {
+ if (strstr(env, "linux")) {
+ result = 1; /* always broken */
+ } else if (strstr(env, "screen") != 0
+ && ((env = getenv("TERMCAP")) != 0
+ && strstr(env, "screen") != 0)
+ && strstr(env, "hhII00") != 0) {
if (CONTROL_N(enter_alt_charset_mode) ||
CONTROL_O(enter_alt_charset_mode) ||
CONTROL_N(set_attributes) ||
- CONTROL_O(set_attributes))
- return 1;
+ CONTROL_O(set_attributes)) {
+ result = 1;
+ }
}
}
- return 0;
+ return result;
}
-/*
- * This entrypoint is called from tgetent() to allow a special case of reusing
- * the same TERMINAL data (see comment).
- */
NCURSES_EXPORT(int)
-_nc_setupterm(NCURSES_CONST char *tname, int Filedes, int *errret, bool reuse)
+TINFO_SETUP_TERM(TERMINAL ** tp,
+ NCURSES_CONST char *tname,
+ int Filedes,
+ int *errret,
+ bool reuse)
{
- TERMINAL *termp;
+#ifdef USE_TERM_DRIVER
+ TERMINAL_CONTROL_BLOCK *TCB = 0;
+#else
int status;
+#endif
+ TERMINAL *termp;
+ SCREEN *sp = 0;
+ int code = ERR;
START_TRACE();
- T((T_CALLED("setupterm(%s,%d,%p)"), _nc_visbuf(tname), Filedes, errret));
+
+#ifdef USE_TERM_DRIVER
+ T((T_CALLED("_nc_setupterm_ex(%p,%s,%d,%p)"),
+ (void *) tp, _nc_visbuf(tname), Filedes, (void *) errret));
+
+ if (tp == 0) {
+ ret_error0(TGETENT_ERR,
+ "Invalid parameter, internal error.\n");
+ } else
+ termp = *tp;
+#else
+ termp = cur_term;
+ T((T_CALLED("setupterm(%s,%d,%p)"), _nc_visbuf(tname), Filedes, (void *) errret));
+#endif
if (tname == 0) {
tname = getenv("TERM");
@@ -538,22 +644,37 @@ _nc_setupterm(NCURSES_CONST char *tname, int Filedes, int *errret, bool reuse)
* properly with this feature).
*/
if (reuse
- && (termp = cur_term) != 0
+ && (termp != 0)
&& termp->Filedes == Filedes
&& termp->_termname != 0
&& !strcmp(termp->_termname, tname)
&& _nc_name_match(termp->type.term_names, tname, "|")) {
T(("reusing existing terminal information and mode-settings"));
+ code = OK;
} else {
-
+#ifdef USE_TERM_DRIVER
+ termp = (TERMINAL *) typeCalloc(TERMINAL_CONTROL_BLOCK, 1);
+#else
termp = typeCalloc(TERMINAL, 1);
-
+#endif
if (termp == 0) {
ret_error0(TGETENT_ERR,
"Not enough memory to create terminal structure.\n");
}
+#ifdef USE_TERM_DRIVER
+ INIT_TERM_DRIVER();
+ TCB = (TERMINAL_CONTROL_BLOCK *) termp;
+ code = _nc_globals.term_driver(TCB, tname, errret);
+ if (code == OK) {
+ termp->Filedes = (short) Filedes;
+ termp->_termname = strdup(tname);
+ } else {
+ ret_error0(TGETENT_ERR,
+ "Could not find any driver to handle this terminal.\n");
+ }
+#else
#if USE_DATABASE || USE_TERMCAP
- status = grab_entry(tname, &termp->type);
+ status = _nc_setup_tinfo(tname, &termp->type);
#else
status = TGETENT_NO;
#endif
@@ -581,13 +702,13 @@ _nc_setupterm(NCURSES_CONST char *tname, int Filedes, int *errret, bool reuse)
ttytype[NAMESIZE - 1] = '\0';
#endif
- termp->Filedes = Filedes;
+ termp->Filedes = (short) Filedes;
termp->_termname = strdup(tname);
set_curterm(termp);
- if (command_character && getenv("CC"))
- do_prototype(termp);
+ if (command_character)
+ _nc_tinfo_cmdch(termp, *command_character);
/*
* If an application calls setupterm() rather than initscr() or
@@ -599,24 +720,94 @@ _nc_setupterm(NCURSES_CONST char *tname, int Filedes, int *errret, bool reuse)
def_prog_mode();
baudrate();
}
+ code = OK;
+#endif
}
+#ifdef USE_TERM_DRIVER
+ *tp = termp;
+ NCURSES_SP_NAME(set_curterm) (sp, termp);
+ TCB->drv->init(TCB);
+#else
+ sp = SP;
+#endif
+
/*
* We should always check the screensize, just in case.
*/
- _nc_get_screensize(SP, ptrLines(), ptrCols());
+ TINFO_GET_SIZE(sp, termp, ptrLines(sp), ptrCols(sp));
if (errret)
*errret = TGETENT_YES;
+#ifndef USE_TERM_DRIVER
if (generic_type) {
ret_error(TGETENT_NO, "'%s': I need something more specific.\n", tname);
}
if (hard_copy) {
ret_error(TGETENT_YES, "'%s': I can't handle hardcopy terminals.\n", tname);
}
- returnCode(OK);
+#endif
+ returnCode(code);
+}
+
+#if NCURSES_SP_FUNCS
+/*
+ * In case of handling multiple screens, we need to have a screen before
+ * initialization in setupscreen takes place. This is to extend the substitute
+ * for some of the stuff in _nc_prescreen, especially for slk and ripoff
+ * handling which should be done per screen.
+ */
+NCURSES_EXPORT(SCREEN *)
+new_prescr(void)
+{
+ static SCREEN *sp;
+
+ START_TRACE();
+ T((T_CALLED("new_prescr()")));
+
+ if (sp == 0) {
+ sp = _nc_alloc_screen_sp();
+ if (sp != 0) {
+ sp->rsp = sp->rippedoff;
+ sp->_filtered = _nc_prescreen.filter_mode;
+ sp->_use_env = _nc_prescreen.use_env;
+#if NCURSES_NO_PADDING
+ sp->_no_padding = _nc_prescreen._no_padding;
+#endif
+ sp->slk_format = 0;
+ sp->_slk = 0;
+ sp->_prescreen = TRUE;
+ SP_PRE_INIT(sp);
+#if USE_REENTRANT
+ sp->_TABSIZE = _nc_prescreen._TABSIZE;
+ sp->_ESCDELAY = _nc_prescreen._ESCDELAY;
+#endif
+ }
+ }
+ returnSP(sp);
+}
+#endif
+
+#ifdef USE_TERM_DRIVER
+/*
+ * This entrypoint is called from tgetent() to allow a special case of reusing
+ * the same TERMINAL data (see comment).
+ */
+NCURSES_EXPORT(int)
+_nc_setupterm(NCURSES_CONST char *tname,
+ int Filedes,
+ int *errret,
+ bool reuse)
+{
+ int res;
+ TERMINAL *termp;
+ res = TINFO_SETUP_TERM(&termp, tname, Filedes, errret, reuse);
+ if (ERR != res)
+ NCURSES_SP_NAME(set_curterm) (CURRENT_SCREEN_PRE, termp);
+ return res;
}
+#endif
/*
* setupterm(termname, Filedes, errret)
diff --git a/contrib/ncurses/ncurses/tinfo/lib_termcap.c b/contrib/ncurses/ncurses/tinfo/lib_termcap.c
index addcc2472bd7..21db21be3d3b 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_termcap.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_termcap.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer *
* *
* some of the code in here was contributed by: *
* Magnus Bengtsson, d6mbeng@dtek.chalmers.se (Nov'93) *
@@ -45,9 +46,11 @@
#include <tic.h>
#include <ctype.h>
-#include <term_entry.h>
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
-MODULE_ID("$Id: lib_termcap.c,v 1.63 2008/08/16 19:22:55 tom Exp $")
+MODULE_ID("$Id: lib_termcap.c,v 1.73 2010/12/25 19:27:12 tom Exp $")
NCURSES_EXPORT_VAR(char *) UP = 0;
NCURSES_EXPORT_VAR(char *) BC = 0;
@@ -82,16 +85,26 @@ extern char _nc_termcap[]; /* buffer to copy out */
***************************************************************************/
NCURSES_EXPORT(int)
-tgetent(char *bufp, const char *name)
+NCURSES_SP_NAME(tgetent) (NCURSES_SP_DCLx char *bufp, const char *name)
{
- int errcode;
+ int rc = ERR;
int n;
bool found_cache = FALSE;
+#ifdef USE_TERM_DRIVER
+ TERMINAL *termp = 0;
+#endif
START_TRACE();
T((T_CALLED("tgetent()")));
- _nc_setupterm((NCURSES_CONST char *) name, STDOUT_FILENO, &errcode, TRUE);
+ TINFO_SETUP_TERM(&termp, (NCURSES_CONST char *) name,
+ STDOUT_FILENO, &rc, TRUE);
+
+#ifdef USE_TERM_DRIVER
+ if (termp == 0 ||
+ !((TERMINAL_CONTROL_BLOCK *) termp)->drv->isTerminfo)
+ return (rc);
+#endif
/*
* In general we cannot tell if the fixed sgr0 is still used by the
@@ -115,9 +128,9 @@ tgetent(char *bufp, const char *name)
/*
* Also free the terminfo data that we loaded (much bigger leak).
*/
- if (LAST_TRM != 0 && LAST_TRM != cur_term) {
+ if (LAST_TRM != 0 && LAST_TRM != TerminalOf(SP_PARM)) {
TERMINAL *trm = LAST_TRM;
- del_curterm(LAST_TRM);
+ NCURSES_SP_NAME(del_curterm) (NCURSES_SP_ARGx LAST_TRM);
for (CacheInx = 0; CacheInx < TGETENT_MAX; ++CacheInx)
if (LAST_TRM == trm)
LAST_TRM = 0;
@@ -137,7 +150,7 @@ tgetent(char *bufp, const char *name)
}
CacheInx = best;
}
- LAST_TRM = cur_term;
+ LAST_TRM = TerminalOf(SP_PARM);
LAST_SEQ = ++CacheSeq;
PC = 0;
@@ -145,7 +158,7 @@ tgetent(char *bufp, const char *name)
BC = 0;
FIX_SGR0 = 0; /* don't free it - application may still use */
- if (errcode == 1) {
+ if (rc == 1) {
if (cursor_left)
if ((backspaces_with_bs = (char) !strcmp(cursor_left, "\b")) == 0)
@@ -159,7 +172,7 @@ tgetent(char *bufp, const char *name)
if (backspace_if_not_bs != NULL)
BC = backspace_if_not_bs;
- if ((FIX_SGR0 = _nc_trim_sgr0(&(cur_term->type))) != 0) {
+ if ((FIX_SGR0 = _nc_trim_sgr0(&(TerminalOf(SP_PARM)->type))) != 0) {
if (!strcmp(FIX_SGR0, exit_attribute_mode)) {
if (FIX_SGR0 != exit_attribute_mode) {
free(FIX_SGR0);
@@ -170,8 +183,8 @@ tgetent(char *bufp, const char *name)
LAST_BUF = bufp;
LAST_USE = TRUE;
- SetNoPadding(SP);
- (void) baudrate(); /* sets ospeed as a side-effect */
+ SetNoPadding(SP_PARM);
+ (void) NCURSES_SP_NAME(baudrate) (NCURSES_SP_ARG); /* sets ospeed as a side-effect */
/* LINT_PREPRO
#if 0*/
@@ -190,8 +203,27 @@ tgetent(char *bufp, const char *name)
strncpy(bufp, _nc_termcap, 1024);
#endif
- returnCode(errcode);
+ returnCode(rc);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+tgetent(char *bufp, const char *name)
+{
+ return NCURSES_SP_NAME(tgetent) (CURRENT_SCREEN, bufp, name);
+}
+#endif
+
+#if 0
+static bool
+same_tcname(const char *a, const char *b)
+{
+ fprintf(stderr, "compare(%s,%s)\n", a, b);
+ return !strncmp(a, b, 2);
}
+#else
+#define same_tcname(a,b) !strncmp(a,b,2)
+#endif
/***************************************************************************
*
@@ -203,24 +235,48 @@ tgetent(char *bufp, const char *name)
***************************************************************************/
NCURSES_EXPORT(int)
-tgetflag(NCURSES_CONST char *id)
+NCURSES_SP_NAME(tgetflag) (NCURSES_SP_DCLx NCURSES_CONST char *id)
{
- unsigned i;
-
- T((T_CALLED("tgetflag(%s)"), id));
- if (cur_term != 0) {
- TERMTYPE *tp = &(cur_term->type);
- for_each_boolean(i, tp) {
- const char *capname = ExtBoolname(tp, i, boolcodes);
- if (!strncmp(id, capname, 2)) {
- /* setupterm forces invalid booleans to false */
- returnCode(tp->Booleans[i]);
+ int result = 0; /* Solaris returns zero for missing flag */
+ int i, j;
+
+ T((T_CALLED("tgetflag(%p, %s)"), (void *) SP_PARM, id));
+ if (HasTInfoTerminal(SP_PARM)) {
+ TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
+ struct name_table_entry const *entry_ptr;
+
+ entry_ptr = _nc_find_type_entry(id, BOOLEAN, TRUE);
+ if (entry_ptr != 0) {
+ j = entry_ptr->nte_index;
+ }
+#if NCURSES_XNAMES
+ else {
+ j = -1;
+ for_each_ext_boolean(i, tp) {
+ const char *capname = ExtBoolname(tp, i, boolcodes);
+ if (same_tcname(id, capname)) {
+ j = i;
+ break;
+ }
}
}
+#endif
+ if (j >= 0) {
+ /* note: setupterm forces invalid booleans to false */
+ result = tp->Booleans[j];
+ }
}
- returnCode(0); /* Solaris does this */
+ returnCode(result);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+tgetflag(NCURSES_CONST char *id)
+{
+ return NCURSES_SP_NAME(tgetflag) (CURRENT_SCREEN, id);
+}
+#endif
+
/***************************************************************************
*
* tgetnum(str)
@@ -231,25 +287,48 @@ tgetflag(NCURSES_CONST char *id)
***************************************************************************/
NCURSES_EXPORT(int)
-tgetnum(NCURSES_CONST char *id)
+NCURSES_SP_NAME(tgetnum) (NCURSES_SP_DCLx NCURSES_CONST char *id)
{
- unsigned i;
-
- T((T_CALLED("tgetnum(%s)"), id));
- if (cur_term != 0) {
- TERMTYPE *tp = &(cur_term->type);
- for_each_number(i, tp) {
- const char *capname = ExtNumname(tp, i, numcodes);
- if (!strncmp(id, capname, 2)) {
- if (!VALID_NUMERIC(tp->Numbers[i]))
- returnCode(ABSENT_NUMERIC);
- returnCode(tp->Numbers[i]);
+ int result = ABSENT_NUMERIC;
+ int i, j;
+
+ T((T_CALLED("tgetnum(%p, %s)"), (void *) SP_PARM, id));
+ if (HasTInfoTerminal(SP_PARM)) {
+ TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
+ struct name_table_entry const *entry_ptr;
+
+ entry_ptr = _nc_find_type_entry(id, NUMBER, TRUE);
+ if (entry_ptr != 0) {
+ j = entry_ptr->nte_index;
+ }
+#if NCURSES_XNAMES
+ else {
+ j = -1;
+ for_each_ext_number(i, tp) {
+ const char *capname = ExtNumname(tp, i, numcodes);
+ if (same_tcname(id, capname)) {
+ j = i;
+ break;
+ }
}
}
+#endif
+ if (j >= 0) {
+ if (VALID_NUMERIC(tp->Numbers[j]))
+ result = tp->Numbers[j];
+ }
}
- returnCode(ABSENT_NUMERIC);
+ returnCode(result);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+tgetnum(NCURSES_CONST char *id)
+{
+ return NCURSES_SP_NAME(tgetnum) (CURRENT_SCREEN, id);
+}
+#endif
+
/***************************************************************************
*
* tgetstr(str, area)
@@ -260,40 +339,62 @@ tgetnum(NCURSES_CONST char *id)
***************************************************************************/
NCURSES_EXPORT(char *)
-tgetstr(NCURSES_CONST char *id, char **area)
+NCURSES_SP_NAME(tgetstr) (NCURSES_SP_DCLx NCURSES_CONST char *id, char **area)
{
- unsigned i;
char *result = NULL;
+ int i, j;
- T((T_CALLED("tgetstr(%s,%p)"), id, area));
- if (cur_term != 0) {
- TERMTYPE *tp = &(cur_term->type);
- for_each_string(i, tp) {
- const char *capname = ExtStrname(tp, i, strcodes);
- if (!strncmp(id, capname, 2)) {
- result = tp->Strings[i];
- TR(TRACE_DATABASE, ("found match : %s", _nc_visbuf(result)));
- /* setupterm forces canceled strings to null */
- if (VALID_STRING(result)) {
- if (result == exit_attribute_mode
- && FIX_SGR0 != 0) {
- result = FIX_SGR0;
- TR(TRACE_DATABASE, ("altered to : %s", _nc_visbuf(result)));
- }
- if (area != 0
- && *area != 0) {
- (void) strcpy(*area, result);
- result = *area;
- *area += strlen(*area) + 1;
- }
+ T((T_CALLED("tgetstr(%s,%p)"), id, (void *) area));
+ if (HasTInfoTerminal(SP_PARM)) {
+ TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
+ struct name_table_entry const *entry_ptr;
+
+ entry_ptr = _nc_find_type_entry(id, STRING, TRUE);
+ if (entry_ptr != 0) {
+ j = entry_ptr->nte_index;
+ }
+#if NCURSES_XNAMES
+ else {
+ j = -1;
+ for_each_ext_string(i, tp) {
+ const char *capname = ExtStrname(tp, i, strcodes);
+ if (same_tcname(id, capname)) {
+ j = i;
+ break;
+ }
+ }
+ }
+#endif
+ if (j >= 0) {
+ result = tp->Strings[j];
+ TR(TRACE_DATABASE, ("found match : %s", _nc_visbuf(result)));
+ /* setupterm forces canceled strings to null */
+ if (VALID_STRING(result)) {
+ if (result == exit_attribute_mode
+ && FIX_SGR0 != 0) {
+ result = FIX_SGR0;
+ TR(TRACE_DATABASE, ("altered to : %s", _nc_visbuf(result)));
+ }
+ if (area != 0
+ && *area != 0) {
+ (void) strcpy(*area, result);
+ result = *area;
+ *area += strlen(*area) + 1;
}
- break;
}
}
}
returnPtr(result);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(char *)
+tgetstr(NCURSES_CONST char *id, char **area)
+{
+ return NCURSES_SP_NAME(tgetstr) (CURRENT_SCREEN, id, area);
+}
+#endif
+
#if NO_LEAKS
NCURSES_EXPORT(void)
_nc_tgetent_leaks(void)
diff --git a/contrib/ncurses/ncurses/tinfo/lib_termname.c b/contrib/ncurses/ncurses/tinfo/lib_termname.c
index 713d0be8c360..e3f6827ee018 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_termname.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_termname.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2001,2003 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2009 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,17 +28,31 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_termname.c,v 1.8 2003/12/27 18:23:01 tom Exp $")
+MODULE_ID("$Id: lib_termname.c,v 1.12 2009/10/24 21:56:58 tom Exp $")
NCURSES_EXPORT(char *)
-termname(void)
+NCURSES_SP_NAME(termname) (NCURSES_SP_DCL0)
{
char *name = 0;
- T((T_CALLED("termname()")));
+ T((T_CALLED("termname(%p)"), (void *) SP_PARM));
+#if NCURSES_SP_FUNCS
+ if (TerminalOf(SP_PARM) != 0) {
+ name = TerminalOf(SP_PARM)->_termname;
+ }
+#else
if (cur_term != 0)
name = cur_term->_termname;
+#endif
returnPtr(name);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(char *)
+termname(void)
+{
+ return NCURSES_SP_NAME(termname) (CURRENT_SCREEN);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/lib_ti.c b/contrib/ncurses/ncurses/tinfo/lib_ti.c
index df460f953ea7..e41234210c85 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_ti.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_ti.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,75 +29,159 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
****************************************************************************/
#include <curses.priv.h>
-#include <term_entry.h>
#include <tic.h>
-MODULE_ID("$Id: lib_ti.c,v 1.23 2003/05/24 21:10:28 tom Exp $")
+MODULE_ID("$Id: lib_ti.c,v 1.29 2010/01/23 17:57:43 tom Exp $")
+
+#if 0
+static bool
+same_name(const char *a, const char *b)
+{
+ fprintf(stderr, "compare(%s,%s)\n", a, b);
+ return !strcmp(a, b);
+}
+#else
+#define same_name(a,b) !strcmp(a,b)
+#endif
NCURSES_EXPORT(int)
-tigetflag(NCURSES_CONST char *str)
+NCURSES_SP_NAME(tigetflag) (NCURSES_SP_DCLx NCURSES_CONST char *str)
{
- unsigned i;
+ int result = ABSENT_BOOLEAN;
+ int i, j;
- T((T_CALLED("tigetflag(%s)"), str));
+ T((T_CALLED("tigetflag(%p, %s)"), (void *) SP_PARM, str));
- if (cur_term != 0) {
- TERMTYPE *tp = &(cur_term->type);
- for_each_boolean(i, tp) {
- const char *capname = ExtBoolname(tp, i, boolnames);
- if (!strcmp(str, capname)) {
- /* setupterm forces invalid booleans to false */
- returnCode(tp->Booleans[i]);
+ if (HasTInfoTerminal(SP_PARM)) {
+ TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
+ struct name_table_entry const *entry_ptr;
+
+ entry_ptr = _nc_find_type_entry(str, BOOLEAN, FALSE);
+ if (entry_ptr != 0) {
+ j = entry_ptr->nte_index;
+ }
+#if NCURSES_XNAMES
+ else {
+ j = -1;
+ for_each_ext_boolean(i, tp) {
+ const char *capname = ExtBoolname(tp, i, boolnames);
+ if (same_name(str, capname)) {
+ j = i;
+ break;
+ }
}
}
+#endif
+ if (j >= 0) {
+ /* note: setupterm forces invalid booleans to false */
+ result = tp->Booleans[j];
+ }
}
- returnCode(ABSENT_BOOLEAN);
+ returnCode(result);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-tigetnum(NCURSES_CONST char *str)
+tigetflag(NCURSES_CONST char *str)
+{
+ return NCURSES_SP_NAME(tigetflag) (CURRENT_SCREEN, str);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(tigetnum) (NCURSES_SP_DCLx NCURSES_CONST char *str)
{
- unsigned i;
-
- T((T_CALLED("tigetnum(%s)"), str));
-
- if (cur_term != 0) {
- TERMTYPE *tp = &(cur_term->type);
- for_each_number(i, tp) {
- const char *capname = ExtNumname(tp, i, numnames);
- if (!strcmp(str, capname)) {
- if (!VALID_NUMERIC(tp->Numbers[i]))
- returnCode(ABSENT_NUMERIC);
- returnCode(tp->Numbers[i]);
+ int i, j;
+ int result = CANCELLED_NUMERIC; /* Solaris returns a -1 on error */
+
+ T((T_CALLED("tigetnum(%p, %s)"), (void *) SP_PARM, str));
+
+ if (HasTInfoTerminal(SP_PARM)) {
+ TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
+ struct name_table_entry const *entry_ptr;
+
+ entry_ptr = _nc_find_type_entry(str, NUMBER, FALSE);
+ if (entry_ptr != 0) {
+ j = entry_ptr->nte_index;
+ }
+#if NCURSES_XNAMES
+ else {
+ j = -1;
+ for_each_ext_number(i, tp) {
+ const char *capname = ExtNumname(tp, i, numnames);
+ if (same_name(str, capname)) {
+ j = i;
+ break;
+ }
}
}
+#endif
+ if (j >= 0) {
+ if (VALID_NUMERIC(tp->Numbers[j]))
+ result = tp->Numbers[j];
+ else
+ result = ABSENT_NUMERIC;
+ }
}
- returnCode(CANCELLED_NUMERIC); /* Solaris returns a -1 instead */
+ returnCode(result);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+tigetnum(NCURSES_CONST char *str)
+{
+ return NCURSES_SP_NAME(tigetnum) (CURRENT_SCREEN, str);
}
+#endif
NCURSES_EXPORT(char *)
-tigetstr(NCURSES_CONST char *str)
+NCURSES_SP_NAME(tigetstr) (NCURSES_SP_DCLx NCURSES_CONST char *str)
{
- unsigned i;
+ char *result = CANCELLED_STRING;
+ int i, j;
- T((T_CALLED("tigetstr(%s)"), str));
+ T((T_CALLED("tigetstr(%p, %s)"), (void *) SP_PARM, str));
- if (cur_term != 0) {
- TERMTYPE *tp = &(cur_term->type);
- for_each_string(i, tp) {
- const char *capname = ExtStrname(tp, i, strnames);
- if (!strcmp(str, capname)) {
- /* setupterm forces cancelled strings to null */
- returnPtr(tp->Strings[i]);
+ if (HasTInfoTerminal(SP_PARM)) {
+ TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
+ struct name_table_entry const *entry_ptr;
+
+ entry_ptr = _nc_find_type_entry(str, STRING, FALSE);
+ if (entry_ptr != 0) {
+ j = entry_ptr->nte_index;
+ }
+#if NCURSES_XNAMES
+ else {
+ j = -1;
+ for_each_ext_string(i, tp) {
+ const char *capname = ExtStrname(tp, i, strnames);
+ if (same_name(str, capname)) {
+ j = i;
+ break;
+ }
}
}
+#endif
+ if (j >= 0) {
+ /* note: setupterm forces cancelled strings to null */
+ result = tp->Strings[j];
+ }
}
- returnPtr(CANCELLED_STRING);
+ returnPtr(result);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(char *)
+tigetstr(NCURSES_CONST char *str)
+{
+ return NCURSES_SP_NAME(tigetstr) (CURRENT_SCREEN, str);
}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/lib_tparm.c b/contrib/ncurses/ncurses/tinfo/lib_tparm.c
index ba2a8404030e..7cd12f7f6845 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_tparm.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_tparm.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 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,10 +40,9 @@
#include <curses.priv.h>
#include <ctype.h>
-#include <term.h>
#include <tic.h>
-MODULE_ID("$Id: lib_tparm.c,v 1.76 2008/08/16 19:22:55 tom Exp $")
+MODULE_ID("$Id: lib_tparm.c,v 1.82 2011/01/15 22:19:12 tom Exp $")
/*
* char *
@@ -140,7 +139,7 @@ save_text(const char *fmt, const char *s, int len)
{
size_t s_len = strlen(s);
if (len > (int) s_len)
- s_len = len;
+ s_len = (size_t) len;
get_space(s_len + 1);
@@ -451,12 +450,13 @@ _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)
+tparam_internal(bool use_TPARM_ARG, const char *string, va_list ap)
{
char *p_is_s[NUM_PARM];
TPARM_ARG param[NUM_PARM];
- int popcount;
+ int popcount = 0;
int number;
+ int num_args;
int len;
int level;
int x, y;
@@ -479,7 +479,13 @@ tparam_internal(const char *string, va_list ap)
if (TPS(fmt_buff) == 0)
return NULL;
- for (i = 0; i < max(popcount, number); i++) {
+ if (number > NUM_PARM)
+ number = NUM_PARM;
+ if (popcount > NUM_PARM)
+ popcount = NUM_PARM;
+ num_args = max(popcount, number);
+
+ for (i = 0; i < num_args; i++) {
/*
* A few caps (such as plab_norm) have string-valued parms.
* We'll have to assume that the caller knows the difference, since
@@ -489,8 +495,11 @@ tparam_internal(const char *string, va_list ap)
*/
if (p_is_s[i] != 0) {
p_is_s[i] = va_arg(ap, char *);
- } else {
+ param[i] = 0;
+ } else if (use_TPARM_ARG) {
param[i] = va_arg(ap, TPARM_ARG);
+ } else {
+ param[i] = (TPARM_ARG) va_arg(ap, int);
}
}
@@ -508,7 +517,7 @@ tparam_internal(const char *string, va_list ap)
if (p_is_s[i])
spush(p_is_s[i]);
else
- npush(param[i]);
+ npush((int) param[i]);
}
}
#ifdef TRACE
@@ -517,7 +526,7 @@ tparam_internal(const char *string, va_list ap)
if (p_is_s[i] != 0)
save_text(", %s", _nc_visbuf(p_is_s[i]), 0);
else
- save_number(", %d", param[i], 0);
+ save_number(", %d", (int) param[i], 0);
}
_tracef(T_CALLED("%s(%s%s)"), TPS(tname), _nc_visbuf(cp), TPS(out_buff));
TPS(out_used) = 0;
@@ -564,7 +573,7 @@ tparam_internal(const char *string, va_list ap)
if (p_is_s[i])
spush(p_is_s[i]);
else
- npush(param[i]);
+ npush((int) param[i]);
}
break;
@@ -772,7 +781,7 @@ tparm_varargs(NCURSES_CONST char *string,...)
#ifdef TRACE
TPS(tname) = "tparm";
#endif /* TRACE */
- result = tparam_internal(string, ap);
+ result = tparam_internal(TRUE, string, ap);
va_end(ap);
return result;
}
@@ -793,3 +802,19 @@ tparm_proto(NCURSES_CONST char *string,
return tparm_varargs(string, a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
#endif /* NCURSES_TPARM_VARARGS */
+
+NCURSES_EXPORT(char *)
+tiparm(const char *string,...)
+{
+ va_list ap;
+ char *result;
+
+ _nc_tparm_err = 0;
+ va_start(ap, string);
+#ifdef TRACE
+ TPS(tname) = "tiparm";
+#endif /* TRACE */
+ result = tparam_internal(FALSE, string, ap);
+ va_end(ap);
+ return result;
+}
diff --git a/contrib/ncurses/ncurses/tinfo/lib_tputs.c b/contrib/ncurses/ncurses/tinfo/lib_tputs.c
index a8b7276895a5..dc70f3e0b0b8 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_tputs.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_tputs.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -41,12 +42,16 @@
*/
#include <curses.priv.h>
+
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
#include <ctype.h>
-#include <term.h> /* padding_baud_rate, xon_xoff */
#include <termcap.h> /* ospeed */
#include <tic.h>
-MODULE_ID("$Id: lib_tputs.c,v 1.66 2008/06/28 13:12:15 tom Exp $")
+MODULE_ID("$Id: lib_tputs.c,v 1.81 2010/12/20 00:42:50 tom Exp $")
NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */
NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */
@@ -69,63 +74,136 @@ _nc_set_no_padding(SCREEN *sp)
}
#endif
-static int (*my_outch) (int c) = _nc_outch;
+#if NCURSES_SP_FUNCS
+#define SetOutCh(func) if (SP_PARM) SP_PARM->_outch = func; else _nc_prescreen._outch = func
+#define GetOutCh() (SP_PARM ? SP_PARM->_outch : _nc_prescreen._outch)
+#else
+#define SetOutCh(func) static_outch = func
+#define GetOutCh() static_outch
+static NCURSES_SP_OUTC static_outch = NCURSES_SP_NAME(_nc_outch);
+#endif
NCURSES_EXPORT(int)
-delay_output(int ms)
+NCURSES_SP_NAME(delay_output) (NCURSES_SP_DCLx int ms)
{
- T((T_CALLED("delay_output(%d)"), ms));
+ T((T_CALLED("delay_output(%p,%d)"), (void *) SP_PARM, ms));
+
+ if (!HasTInfoTerminal(SP_PARM))
+ returnCode(ERR);
if (no_pad_char) {
- _nc_flush();
+ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
napms(ms);
} else {
+ NCURSES_SP_OUTC my_outch = GetOutCh();
register int nullcount;
nullcount = (ms * _nc_baudrate(ospeed)) / (BAUDBYTE * 1000);
for (_nc_nulls_sent += nullcount; nullcount > 0; nullcount--)
- my_outch(PC);
- if (my_outch == _nc_outch)
- _nc_flush();
+ my_outch(NCURSES_SP_ARGx PC);
+ if (my_outch == NCURSES_SP_NAME(_nc_outch))
+ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
}
returnCode(OK);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+delay_output(int ms)
+{
+ return NCURSES_SP_NAME(delay_output) (CURRENT_SCREEN, ms);
+}
+#endif
+
+NCURSES_EXPORT(void)
+NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_DCL0)
+{
+ (void) fflush(NC_OUTPUT(SP_PARM));
+}
+
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(void)
_nc_flush(void)
{
- (void) fflush(NC_OUTPUT);
+ NCURSES_SP_NAME(_nc_flush) (CURRENT_SCREEN);
}
+#endif
NCURSES_EXPORT(int)
-_nc_outch(int ch)
+NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_DCLx int ch)
{
+ int rc = OK;
+
COUNT_OUTCHARS(1);
- if (SP != 0
- && SP->_cleanup) {
- char tmp = ch;
+ if (HasTInfoTerminal(SP_PARM)
+ && SP_PARM != 0
+ && SP_PARM->_cleanup) {
+ char tmp = (char) ch;
/*
* POSIX says write() is safe in a signal handler, but the
* buffered I/O is not.
*/
- write(fileno(NC_OUTPUT), &tmp, 1);
+ if (write(fileno(NC_OUTPUT(SP_PARM)), &tmp, 1) == -1)
+ rc = ERR;
} else {
- putc(ch, NC_OUTPUT);
+ if (putc(ch, NC_OUTPUT(SP_PARM)) == EOF)
+ rc = ERR;
}
- return OK;
+ return rc;
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+_nc_outch(int ch)
+{
+ return NCURSES_SP_NAME(_nc_outch) (CURRENT_SCREEN, ch);
}
+#endif
NCURSES_EXPORT(int)
+NCURSES_SP_NAME(putp) (NCURSES_SP_DCLx const char *string)
+{
+ return NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ string, 1, NCURSES_SP_NAME(_nc_outch));
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_DCLx
+ const char *name GCC_UNUSED,
+ const char *string)
+{
+ int rc = ERR;
+
+ if (string != 0) {
+ TPUTS_TRACE(name);
+ rc = NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx string);
+ }
+ return rc;
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
putp(const char *string)
{
- return tputs(string, 1, _nc_outch);
+ return NCURSES_SP_NAME(putp) (CURRENT_SCREEN, string);
}
NCURSES_EXPORT(int)
-tputs(const char *string, int affcnt, int (*outc) (int))
+_nc_putp(const char *name, const char *string)
{
+ return NCURSES_SP_NAME(_nc_putp) (CURRENT_SCREEN, name, string);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(tputs) (NCURSES_SP_DCLx
+ const char *string,
+ int affcnt,
+ NCURSES_SP_OUTC outc)
+{
+ NCURSES_SP_OUTC my_outch = GetOutCh();
bool always_delay;
bool normal_delay;
int number;
@@ -137,7 +215,7 @@ tputs(const char *string, int affcnt, int (*outc) (int))
char addrbuf[32];
if (USE_TRACEF(TRACE_TPUTS)) {
- if (outc == _nc_outch)
+ if (outc == NCURSES_SP_NAME(_nc_outch))
(void) strcpy(addrbuf, "_nc_outch");
else
(void) sprintf(addrbuf, "%p", outc);
@@ -152,10 +230,19 @@ tputs(const char *string, int affcnt, int (*outc) (int))
}
#endif /* TRACE */
+ if (SP_PARM != 0 && !HasTInfoTerminal(SP_PARM))
+ return ERR;
+
if (!VALID_STRING(string))
return ERR;
- if (cur_term == 0) {
+ if (
+#if NCURSES_SP_FUNCS
+ (SP_PARM != 0 && SP_PARM->_term == 0)
+#else
+ cur_term == 0
+#endif
+ ) {
always_delay = FALSE;
normal_delay = TRUE;
} else {
@@ -164,7 +251,7 @@ tputs(const char *string, int affcnt, int (*outc) (int))
!xon_xoff
&& padding_baud_rate
#if NCURSES_NO_PADDING
- && !GetNoPadding(SP)
+ && !GetNoPadding(SP_PARM)
#endif
&& (_nc_baudrate(ospeed) >= padding_baud_rate);
}
@@ -198,24 +285,24 @@ tputs(const char *string, int affcnt, int (*outc) (int))
}
#endif /* BSD_TPUTS */
- my_outch = outc; /* redirect delay_output() */
+ SetOutCh(outc); /* redirect delay_output() */
while (*string) {
if (*string != '$')
- (*outc) (*string);
+ (*outc) (NCURSES_SP_ARGx *string);
else {
string++;
if (*string != '<') {
- (*outc) ('$');
+ (*outc) (NCURSES_SP_ARGx '$');
if (*string)
- (*outc) (*string);
+ (*outc) (NCURSES_SP_ARGx *string);
} else {
bool mandatory;
string++;
if ((!isdigit(UChar(*string)) && *string != '.')
|| !strchr(string, '>')) {
- (*outc) ('$');
- (*outc) ('<');
+ (*outc) (NCURSES_SP_ARGx '$');
+ (*outc) (NCURSES_SP_ARGx '<');
continue;
}
@@ -250,7 +337,7 @@ tputs(const char *string, int affcnt, int (*outc) (int))
&& (always_delay
|| normal_delay
|| mandatory))
- delay_output(number / 10);
+ NCURSES_SP_NAME(delay_output) (NCURSES_SP_ARGx number / 10);
} /* endelse (*string == '<') */
} /* endelse (*string == '$') */
@@ -270,6 +357,25 @@ tputs(const char *string, int affcnt, int (*outc) (int))
delay_output(trailpad / 10);
#endif /* BSD_TPUTS */
- my_outch = _nc_outch;
+ SetOutCh(my_outch);
return OK;
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+_nc_outc_wrapper(SCREEN *sp, int c)
+{
+ if (0 == sp) {
+ return (ERR);
+ } else {
+ return sp->jump(c);
+ }
+}
+
+NCURSES_EXPORT(int)
+tputs(const char *string, int affcnt, int (*outc) (int))
+{
+ SetSafeOutcWrapper(outc);
+ return NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx string, affcnt, _nc_outc_wrapper);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
index a2b38a3327f1..663a06898090 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -36,159 +36,246 @@
*/
#include <curses.priv.h>
-#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_ttyflags.c,v 1.18 2008/08/03 22:10:44 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_ttyflags.c,v 1.27 2010/12/25 23:43:58 tom Exp $")
NCURSES_EXPORT(int)
-_nc_get_tty_mode(TTY * buf)
+NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_DCLx TTY * buf)
{
int result = OK;
- if (buf == 0) {
+ if (buf == 0 || SP_PARM == 0) {
result = ERR;
} else {
- if (cur_term == 0) {
+ TERMINAL *termp = TerminalOf(SP_PARM);
+
+ if (0 == termp) {
result = ERR;
} else {
+#ifdef USE_TERM_DRIVER
+ result = CallDriver_2(SP_PARM, sgmode, FALSE, buf);
+#else
for (;;) {
- if (GET_TTY(cur_term->Filedes, buf) != 0) {
+ if (GET_TTY(termp->Filedes, buf) != 0) {
if (errno == EINTR)
continue;
result = ERR;
}
break;
}
+#endif
}
if (result == ERR)
memset(buf, 0, sizeof(*buf));
TR(TRACE_BITS, ("_nc_get_tty_mode(%d): %s",
- cur_term ? cur_term->Filedes : -1,
+ termp ? termp->Filedes : -1,
_nc_trace_ttymode(buf)));
}
return (result);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-_nc_set_tty_mode(TTY * buf)
+_nc_get_tty_mode(TTY * buf)
+{
+ return NCURSES_SP_NAME(_nc_get_tty_mode) (CURRENT_SCREEN, buf);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_DCLx TTY * buf)
{
int result = OK;
- if (buf == 0) {
+ if (buf == 0 || SP_PARM == 0) {
result = ERR;
} else {
- if (cur_term == 0) {
+ TERMINAL *termp = TerminalOf(SP_PARM);
+
+ if (0 == termp) {
result = ERR;
} else {
+#ifdef USE_TERM_DRIVER
+ result = CallDriver_2(SP_PARM, sgmode, TRUE, buf);
+#else
for (;;) {
- if (SET_TTY(cur_term->Filedes, buf) != 0) {
+ if (SET_TTY(termp->Filedes, buf) != 0) {
if (errno == EINTR)
continue;
- if ((errno == ENOTTY) && (SP != 0))
- SP->_notty = TRUE;
+ if ((errno == ENOTTY) && (SP_PARM != 0))
+ SP_PARM->_notty = TRUE;
result = ERR;
}
break;
}
+#endif
}
TR(TRACE_BITS, ("_nc_set_tty_mode(%d): %s",
- cur_term ? cur_term->Filedes : -1,
+ termp ? termp->Filedes : -1,
_nc_trace_ttymode(buf)));
}
return (result);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-def_shell_mode(void)
+_nc_set_tty_mode(TTY * buf)
+{
+ return NCURSES_SP_NAME(_nc_set_tty_mode) (CURRENT_SCREEN, buf);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_DCL0)
{
int rc = ERR;
+ TERMINAL *termp = TerminalOf(SP_PARM);
- T((T_CALLED("def_shell_mode()")));
+ T((T_CALLED("def_shell_mode(%p)"), (void *) SP_PARM));
- if (cur_term != 0) {
+ if (termp != 0) {
+#ifdef USE_TERM_DRIVER
+ rc = CallDriver_2(SP_PARM, mode, FALSE, TRUE);
+#else
/*
* If XTABS was on, remove the tab and backtab capabilities.
*/
- if (_nc_get_tty_mode(&cur_term->Ottyb) == OK) {
+ if (_nc_get_tty_mode(&termp->Ottyb) == OK) {
#ifdef TERMIOS
- if (cur_term->Ottyb.c_oflag & OFLAGS_TABS)
+ if (termp->Ottyb.c_oflag & OFLAGS_TABS)
tab = back_tab = NULL;
#else
- if (cur_term->Ottyb.sg_flags & XTABS)
+ if (termp->Ottyb.sg_flags & XTABS)
tab = back_tab = NULL;
#endif
rc = OK;
}
+#endif
}
returnCode(rc);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-def_prog_mode(void)
+def_shell_mode(void)
+{
+ return NCURSES_SP_NAME(def_shell_mode) (CURRENT_SCREEN);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_DCL0)
{
int rc = ERR;
+ TERMINAL *termp = TerminalOf(SP_PARM);
- T((T_CALLED("def_prog_mode()")));
+ T((T_CALLED("def_prog_mode(%p)"), (void *) SP_PARM));
- if (cur_term != 0) {
+ if (termp != 0) {
+#ifdef USE_TERM_DRIVER
+ rc = CallDriver_2(SP_PARM, mode, TRUE, TRUE);
+#else
/*
* Turn off the XTABS bit in the tty structure if it was on.
*/
- if (_nc_get_tty_mode(&cur_term->Nttyb) == OK) {
+ if (_nc_get_tty_mode(&termp->Nttyb) == OK) {
#ifdef TERMIOS
- cur_term->Nttyb.c_oflag &= ~OFLAGS_TABS;
+ termp->Nttyb.c_oflag &= (unsigned) (~OFLAGS_TABS);
#else
- cur_term->Nttyb.sg_flags &= ~XTABS;
+ termp->Nttyb.sg_flags &= (unsigned) (~XTABS);
#endif
rc = OK;
}
+#endif
}
returnCode(rc);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-reset_prog_mode(void)
+def_prog_mode(void)
{
- T((T_CALLED("reset_prog_mode()")));
+ return NCURSES_SP_NAME(def_prog_mode) (CURRENT_SCREEN);
+}
+#endif
- if (cur_term != 0) {
- if (_nc_set_tty_mode(&cur_term->Nttyb) == OK) {
- if (SP) {
- if (SP->_keypad_on)
- _nc_keypad(SP, TRUE);
- NC_BUFFERED(TRUE);
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_DCL0)
+{
+ int rc = ERR;
+ TERMINAL *termp = TerminalOf(SP_PARM);
+
+ T((T_CALLED("reset_prog_mode(%p)"), (void *) SP_PARM));
+
+ if (termp != 0) {
+#ifdef USE_TERM_DRIVER
+ rc = CallDriver_2(SP_PARM, mode, TRUE, FALSE);
+#else
+ if (_nc_set_tty_mode(&termp->Nttyb) == OK) {
+ if (SP_PARM) {
+ if (SP_PARM->_keypad_on)
+ _nc_keypad(SP_PARM, TRUE);
+ NC_BUFFERED(SP_PARM, TRUE);
}
- returnCode(OK);
+ rc = OK;
}
+#endif
}
- returnCode(ERR);
+ returnCode(rc);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-reset_shell_mode(void)
+reset_prog_mode(void)
{
- T((T_CALLED("reset_shell_mode()")));
+ return NCURSES_SP_NAME(reset_prog_mode) (CURRENT_SCREEN);
+}
+#endif
- if (cur_term != 0) {
- if (SP) {
- _nc_keypad(SP, FALSE);
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(reset_shell_mode) (NCURSES_SP_DCL0)
+{
+ int rc = ERR;
+ TERMINAL *termp = TerminalOf(SP_PARM);
+
+ T((T_CALLED("reset_shell_mode(%p)"), (void *) SP_PARM));
+
+ if (termp != 0) {
+#ifdef USE_TERM_DRIVER
+ rc = CallDriver_2(SP_PARM, mode, FALSE, FALSE);
+#else
+ if (SP_PARM) {
+ _nc_keypad(SP_PARM, FALSE);
_nc_flush();
- NC_BUFFERED(FALSE);
+ NC_BUFFERED(SP_PARM, FALSE);
}
- returnCode(_nc_set_tty_mode(&cur_term->Ottyb));
+ rc = _nc_set_tty_mode(&termp->Ottyb);
+#endif
}
- returnCode(ERR);
+ returnCode(rc);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+reset_shell_mode(void)
+{
+ return NCURSES_SP_NAME(reset_shell_mode) (CURRENT_SCREEN);
+}
+#endif
+
static TTY *
-saved_tty(void)
+saved_tty(NCURSES_SP_DCL0)
{
TTY *result = 0;
- if (SP != 0) {
- result = &(SP->_saved_tty);
+ if (SP_PARM != 0) {
+ result = (TTY *) & (SP_PARM->_saved_tty);
} else {
if (_nc_prescreen.saved_tty == 0) {
_nc_prescreen.saved_tty = typeCalloc(TTY, 1);
@@ -204,17 +291,31 @@ saved_tty(void)
*/
NCURSES_EXPORT(int)
+NCURSES_SP_NAME(savetty) (NCURSES_SP_DCL0)
+{
+ T((T_CALLED("savetty(%p)"), (void *) SP_PARM));
+ returnCode(NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_ARGx saved_tty(NCURSES_SP_ARG)));
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
savetty(void)
{
- T((T_CALLED("savetty()")));
+ return NCURSES_SP_NAME(savetty) (CURRENT_SCREEN);
+}
+#endif
- returnCode(_nc_get_tty_mode(saved_tty()));
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(resetty) (NCURSES_SP_DCL0)
+{
+ T((T_CALLED("resetty(%p)"), (void *) SP_PARM));
+ returnCode(NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx saved_tty(NCURSES_SP_ARG)));
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
resetty(void)
{
- T((T_CALLED("resetty()")));
-
- returnCode(_nc_set_tty_mode(saved_tty()));
+ return NCURSES_SP_NAME(resetty) (CURRENT_SCREEN);
}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/make_hash.c b/contrib/ncurses/ncurses/tinfo/make_hash.c
new file mode 100644
index 000000000000..15c281def50c
--- /dev/null
+++ b/contrib/ncurses/ncurses/tinfo/make_hash.c
@@ -0,0 +1,294 @@
+/****************************************************************************
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a *
+ * copy of this software and associated documentation files (the *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ ****************************************************************************/
+
+/*
+ * make_hash.c --- build-time program for constructing comp_captab.c
+ *
+ */
+
+#include <build.priv.h>
+
+#include <tic.h>
+#include <hashsize.h>
+
+#include <ctype.h>
+
+MODULE_ID("$Id: make_hash.c,v 1.3 2010/05/22 18:02:50 tom Exp $")
+
+/*
+ * _nc_make_hash_table()
+ *
+ * Takes the entries in table[] and hashes them into hash_table[]
+ * by name. There are CAPTABSIZE entries in table[] and HASHTABSIZE
+ * slots in hash_table[].
+ *
+ */
+
+#undef MODULE_ID
+#define MODULE_ID(id) /*nothing */
+#include <tinfo/doalloc.c>
+
+/*
+ * int hash_function(string)
+ *
+ * Computes the hashing function on the given string.
+ *
+ * The current hash function is the sum of each consectutive pair
+ * of characters, taken as two-byte integers, mod HASHTABSIZE.
+ *
+ */
+
+static int
+hash_function(const char *string)
+{
+ long sum = 0;
+
+ while (*string) {
+ sum += (long) (*string + (*(string + 1) << 8));
+ string++;
+ }
+
+ return (int) (sum % HASHTABSIZE);
+}
+
+static void
+_nc_make_hash_table(struct name_table_entry *table,
+ HashValue * hash_table)
+{
+ short 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] >= 0)
+ collisions++;
+
+ if (hash_table[hashvalue] != 0)
+ table[i].nte_link = hash_table[hashvalue];
+ hash_table[hashvalue] = i;
+ }
+
+ printf("/* %d collisions out of %d entries */\n", collisions, CAPTABSIZE);
+}
+
+/*
+ * This filter reads from standard input a list of tab-delimited columns,
+ * (e.g., from Caps.filtered) computes the hash-value of a specified column and
+ * writes the hashed tables to standard output.
+ *
+ * By compiling the hash table at build time, we're able to make the entire
+ * set of terminfo and termcap tables readonly (and also provide some runtime
+ * performance enhancement).
+ */
+
+#define MAX_COLUMNS BUFSIZ /* this _has_ to be worst-case */
+
+static char **
+parse_columns(char *buffer)
+{
+ static char **list;
+
+ int col = 0;
+
+ if (list == 0 && (list = typeCalloc(char *, MAX_COLUMNS)) == 0)
+ return (0);
+
+ if (*buffer != '#') {
+ while (*buffer != '\0') {
+ char *s;
+ for (s = buffer; (*s != '\0') && !isspace(UChar(*s)); s++)
+ /*EMPTY */ ;
+ if (s != buffer) {
+ char mark = *s;
+ *s = '\0';
+ if ((s - buffer) > 1
+ && (*buffer == '"')
+ && (s[-1] == '"')) { /* strip the quotes */
+ assert(s > buffer + 1);
+ s[-1] = '\0';
+ buffer++;
+ }
+ list[col] = buffer;
+ col++;
+ if (mark == '\0')
+ break;
+ while (*++s && isspace(UChar(*s)))
+ /*EMPTY */ ;
+ buffer = s;
+ } else
+ break;
+ }
+ }
+ return col ? list : 0;
+}
+
+int
+main(int argc, char **argv)
+{
+ struct name_table_entry *name_table = typeCalloc(struct
+ name_table_entry, CAPTABSIZE);
+ HashValue *hash_table = typeCalloc(HashValue, HASHTABSIZE);
+ const char *root_name = "";
+ int column = 0;
+ int bigstring = 0;
+ int n;
+ char buffer[BUFSIZ];
+
+ static const char *typenames[] =
+ {"BOOLEAN", "NUMBER", "STRING"};
+
+ short BoolCount = 0;
+ short NumCount = 0;
+ short StrCount = 0;
+
+ /* The first argument is the column-number (starting with 0).
+ * The second is the root name of the tables to generate.
+ */
+ if (argc <= 3
+ || (column = atoi(argv[1])) <= 0
+ || (column >= MAX_COLUMNS)
+ || *(root_name = argv[2]) == 0
+ || (bigstring = atoi(argv[3])) < 0
+ || name_table == 0
+ || hash_table == 0) {
+ fprintf(stderr, "usage: make_hash column root_name bigstring\n");
+ exit(EXIT_FAILURE);
+ }
+
+ /*
+ * Read the table into our arrays.
+ */
+ for (n = 0; (n < CAPTABSIZE) && fgets(buffer, BUFSIZ, stdin);) {
+ char **list, *nlp = strchr(buffer, '\n');
+ if (nlp)
+ *nlp = '\0';
+ list = parse_columns(buffer);
+ if (list == 0) /* blank or comment */
+ continue;
+ name_table[n].nte_link = -1; /* end-of-hash */
+ name_table[n].nte_name = strdup(list[column]);
+ if (!strcmp(list[2], "bool")) {
+ name_table[n].nte_type = BOOLEAN;
+ name_table[n].nte_index = BoolCount++;
+ } else if (!strcmp(list[2], "num")) {
+ name_table[n].nte_type = NUMBER;
+ name_table[n].nte_index = NumCount++;
+ } else if (!strcmp(list[2], "str")) {
+ name_table[n].nte_type = STRING;
+ name_table[n].nte_index = StrCount++;
+ } else {
+ fprintf(stderr, "Unknown type: %s\n", list[2]);
+ exit(EXIT_FAILURE);
+ }
+ n++;
+ }
+ _nc_make_hash_table(name_table, hash_table);
+
+ /*
+ * Write the compiled tables to standard output
+ */
+ if (bigstring) {
+ int len = 0;
+ int nxt;
+
+ printf("static const char %s_names_text[] = \\\n", root_name);
+ for (n = 0; n < CAPTABSIZE; n++) {
+ nxt = (int) 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 += (int) 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("static const HashValue _nc_%s_hash_table[%d] =\n",
+ root_name,
+ HASHTABSIZE + 1);
+ printf("{\n");
+ for (n = 0; n < HASHTABSIZE; n++) {
+ printf("\t%3d,\n", hash_table[n]);
+ }
+ printf("\t0\t/* base-of-table */\n");
+ printf("};\n\n");
+
+ printf("#if (BOOLCOUNT!=%d)||(NUMCOUNT!=%d)||(STRCOUNT!=%d)\n",
+ BoolCount, NumCount, StrCount);
+ printf("#error\t--> term.h and comp_captab.c disagree about the <--\n");
+ printf("#error\t--> numbers of booleans, numbers and/or strings <--\n");
+ printf("#endif\n\n");
+
+ free(hash_table);
+ return EXIT_SUCCESS;
+}
diff --git a/contrib/ncurses/ncurses/tinfo/make_keys.c b/contrib/ncurses/ncurses/tinfo/make_keys.c
index c084f87fb943..a7854e3fe604 100644
--- a/contrib/ncurses/ncurses/tinfo/make_keys.c
+++ b/contrib/ncurses/ncurses/tinfo/make_keys.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -37,18 +37,18 @@
*/
#define USE_TERMLIB 1
-#include <curses.priv.h>
+#include <build.priv.h>
-MODULE_ID("$Id: make_keys.c,v 1.14 2008/08/03 21:57:22 tom Exp $")
+MODULE_ID("$Id: make_keys.c,v 1.19 2010/06/05 22:08:00 tom Exp $")
#include <names.c>
-#define UNKNOWN (SIZEOF(strnames) + SIZEOF(strfnames))
+#define UNKNOWN (unsigned) (SIZEOF(strnames) + SIZEOF(strfnames))
-static size_t
+static unsigned
lookup(const char *name)
{
- size_t n;
+ unsigned n;
bool found = FALSE;
for (n = 0; strnames[n] != 0; n++) {
if (!strcmp(name, strnames[n])) {
@@ -73,7 +73,7 @@ make_keys(FILE *ifp, FILE *ofp)
char buffer[BUFSIZ];
char from[256];
char to[256];
- int maxlen = 16;
+ unsigned maxlen = 16;
int scanned;
while (fgets(buffer, sizeof(buffer), ifp) != 0) {
@@ -85,14 +85,14 @@ make_keys(FILE *ifp, FILE *ofp)
scanned = sscanf(buffer, "%255s %255s", to, from);
if (scanned == 2) {
- int code = lookup(from);
+ unsigned code = lookup(from);
if (code == UNKNOWN)
continue;
- if ((int) strlen(from) > maxlen)
- maxlen = strlen(from);
- fprintf(ofp, "\t{ %4d, %-*.*s },\t/* %s */\n",
+ if (strlen(from) > maxlen)
+ maxlen = (unsigned) strlen(from);
+ fprintf(ofp, "\t{ %4u, %-*.*s },\t/* %s */\n",
code,
- maxlen, maxlen,
+ (int) maxlen, (int) maxlen,
to,
from);
}
diff --git a/contrib/ncurses/ncurses/tinfo/name_match.c b/contrib/ncurses/ncurses/tinfo/name_match.c
index d576901fa2e9..a9ac64278888 100644
--- a/contrib/ncurses/ncurses/tinfo/name_match.c
+++ b/contrib/ncurses/ncurses/tinfo/name_match.c
@@ -31,10 +31,9 @@
****************************************************************************/
#include <curses.priv.h>
-#include <term.h>
#include <tic.h>
-MODULE_ID("$Id: name_match.c,v 1.17 2008/08/03 19:49:33 tom Exp $")
+MODULE_ID("$Id: name_match.c,v 1.18 2008/11/16 00:19:59 juergen Exp $")
/*
* _nc_first_name(char *names)
diff --git a/contrib/ncurses/ncurses/tinfo/parse_entry.c b/contrib/ncurses/ncurses/tinfo/parse_entry.c
index cf7a5f409d7c..ddbc25204fec 100644
--- a/contrib/ncurses/ncurses/tinfo/parse_entry.c
+++ b/contrib/ncurses/ncurses/tinfo/parse_entry.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -46,9 +46,8 @@
#include <ctype.h>
#include <tic.h>
-#include <term_entry.h>
-MODULE_ID("$Id: parse_entry.c,v 1.69 2008/08/16 21:52:03 tom Exp $")
+MODULE_ID("$Id: parse_entry.c,v 1.75 2010/05/01 19:35:09 tom Exp $")
#ifdef LINT
static short const parametrized[] =
@@ -84,13 +83,13 @@ _nc_extend_names(ENTRY * entryp, char *name, int token_type)
case NUMBER:
first = tp->ext_Booleans;
last = tp->ext_Numbers + first;
- offset = tp->ext_Booleans + tp->ext_Numbers;
+ offset = (unsigned) (tp->ext_Booleans + tp->ext_Numbers);
tindex = tp->num_Numbers;
break;
case STRING:
- first = tp->ext_Booleans + tp->ext_Numbers;
+ first = (unsigned) (tp->ext_Booleans + tp->ext_Numbers);
last = tp->ext_Strings + first;
- offset = tp->ext_Booleans + tp->ext_Numbers + tp->ext_Strings;
+ offset = (unsigned) (tp->ext_Booleans + tp->ext_Numbers + tp->ext_Strings);
tindex = tp->num_Strings;
break;
case CANCEL:
@@ -137,27 +136,31 @@ _nc_extend_names(ENTRY * entryp, char *name, int token_type)
break;
}
}
+
+#define for_each_value(max) \
+ for (last = (unsigned) (max - 1); last > tindex; last--)
+
if (!found) {
switch (token_type) {
case BOOLEAN:
- tp->ext_Booleans += 1;
- tp->num_Booleans += 1;
+ tp->ext_Booleans++;
+ tp->num_Booleans++;
tp->Booleans = typeRealloc(NCURSES_SBOOL, tp->num_Booleans, tp->Booleans);
- for (last = tp->num_Booleans - 1; last > tindex; last--)
+ for_each_value(tp->num_Booleans)
tp->Booleans[last] = tp->Booleans[last - 1];
break;
case NUMBER:
- tp->ext_Numbers += 1;
- tp->num_Numbers += 1;
+ tp->ext_Numbers++;
+ tp->num_Numbers++;
tp->Numbers = typeRealloc(short, tp->num_Numbers, tp->Numbers);
- for (last = tp->num_Numbers - 1; last > tindex; last--)
+ for_each_value(tp->num_Numbers)
tp->Numbers[last] = tp->Numbers[last - 1];
break;
case STRING:
- tp->ext_Strings += 1;
- tp->num_Strings += 1;
+ tp->ext_Strings++;
+ tp->num_Strings++;
tp->Strings = typeRealloc(char *, tp->num_Strings, tp->Strings);
- for (last = tp->num_Strings - 1; last > tindex; last--)
+ for_each_value(tp->num_Strings)
tp->Strings[last] = tp->Strings[last - 1];
break;
}
@@ -170,7 +173,7 @@ _nc_extend_names(ENTRY * entryp, char *name, int token_type)
temp.nte_name = tp->ext_Names[offset];
temp.nte_type = token_type;
- temp.nte_index = tindex;
+ temp.nte_index = (short) tindex;
temp.nte_link = -1;
return &temp;
@@ -379,16 +382,14 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent)
&& !strcmp("ma", _nc_curr_token.tk_name)) {
/* tell max_attributes from arrow_key_map */
entry_ptr = _nc_find_type_entry("ma", NUMBER,
- _nc_get_table(_nc_syntax
- != 0));
+ _nc_syntax != 0);
assert(entry_ptr != 0);
} else if (token_type == STRING
&& !strcmp("MT", _nc_curr_token.tk_name)) {
/* map terminfo's string MT to MT */
entry_ptr = _nc_find_type_entry("MT", STRING,
- _nc_get_table(_nc_syntax
- != 0));
+ _nc_syntax != 0);
assert(entry_ptr != 0);
} else if (token_type == BOOLEAN
@@ -444,7 +445,7 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent)
case NUMBER:
entryp->tterm.Numbers[entry_ptr->nte_index] =
- _nc_curr_token.tk_valnumber;
+ (short) _nc_curr_token.tk_valnumber;
break;
case STRING:
@@ -510,9 +511,9 @@ NCURSES_EXPORT(int)
_nc_capcmp(const char *s, const char *t)
/* compare two string capabilities, stripping out padding */
{
- if (!s && !t)
+ if (!VALID_STRING(s) && !VALID_STRING(t))
return (0);
- else if (!s || !t)
+ else if (!VALID_STRING(s) || !VALID_STRING(t))
return (1);
for (;;) {
@@ -667,7 +668,7 @@ postprocess_termcap(TERMTYPE *tp, bool has_base)
else if (PRESENT(backspace_if_not_bs))
cursor_left = backspace_if_not_bs;
}
- /* vi doesn't use "do", but it does seems to use nl (or '\n') instead */
+ /* vi doesn't use "do", but it does seem to use nl (or '\n') instead */
if (WANTED(cursor_down)) {
if (PRESENT(linefeed_if_not_lf))
cursor_down = linefeed_if_not_lf;
@@ -772,7 +773,7 @@ postprocess_termcap(TERMTYPE *tp, bool has_base)
* isn't from mytinfo...
*/
if (PRESENT(other_non_function_keys)) {
- char *base = other_non_function_keys;
+ char *base;
char *bp, *cp, *dp;
struct name_table_entry const *from_ptr;
struct name_table_entry const *to_ptr;
@@ -788,7 +789,7 @@ postprocess_termcap(TERMTYPE *tp, bool has_base)
for (base = other_non_function_keys;
(cp = strchr(base, ',')) != 0;
base = cp + 1) {
- size_t len = cp - base;
+ size_t len = (unsigned) (cp - base);
for (ap = ko_xlate; ap->from; ap++) {
if (len == strlen(ap->from)
@@ -840,7 +841,7 @@ postprocess_termcap(TERMTYPE *tp, bool has_base)
} else
*dp++ = *bp;
}
- *dp++ = '\0';
+ *dp = '\0';
tp->Strings[to_ptr->nte_index] = _nc_save_str(buf2);
}
diff --git a/contrib/ncurses/ncurses/tinfo/read_entry.c b/contrib/ncurses/ncurses/tinfo/read_entry.c
index b4ea61ca194e..e38b9cbe49d8 100644
--- a/contrib/ncurses/ncurses/tinfo/read_entry.c
+++ b/contrib/ncurses/ncurses/tinfo/read_entry.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 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,9 +40,8 @@
#include <hashed_db.h>
#include <tic.h>
-#include <term_entry.h>
-MODULE_ID("$Id: read_entry.c,v 1.102 2008/08/03 19:33:04 tom Exp $")
+MODULE_ID("$Id: read_entry.c,v 1.108 2011/02/26 15:36:06 tom Exp $")
#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts))
@@ -57,7 +56,7 @@ convert_shorts(char *buf, short *Numbers, int count)
else if (IS_NEG2(buf + 2 * i))
Numbers[i] = CANCELLED_NUMERIC;
else
- Numbers[i] = LOW_MSB(buf + 2 * i);
+ Numbers[i] = (short) LOW_MSB(buf + 2 * i);
TR(TRACE_DATABASE, ("get Numbers[%d]=%d", i, Numbers[i]));
}
}
@@ -99,9 +98,9 @@ fake_read(char *src, int *offset, int limit, char *dst, unsigned want)
if (have > 0) {
if ((int) want > have)
- want = have;
+ want = (unsigned) have;
memcpy(dst, src + *offset, want);
- *offset += want;
+ *offset += (int) want;
} else {
want = 0;
}
@@ -155,7 +154,7 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
return (TGETENT_NO);
}
- want = str_size + name_size + 1;
+ want = (unsigned) (str_size + name_size + 1);
if (str_size) {
/* try to allocate space for the string table */
if (str_count * 2 >= (int) sizeof(buf)
@@ -173,14 +172,14 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
want = min(MAX_NAME_SIZE, (unsigned) name_size);
ptr->str_table = string_table;
ptr->term_names = string_table;
- if ((have = Read(ptr->term_names, want)) != want) {
+ if ((have = (unsigned) Read(ptr->term_names, want)) != want) {
memset(ptr->term_names + have, 0, want - have);
}
ptr->term_names[want] = '\0';
string_table += (want + 1);
if (have > MAX_NAME_SIZE)
- offset = (have - MAX_NAME_SIZE);
+ offset = (int) (have - MAX_NAME_SIZE);
/* grab the booleans */
if ((ptr->Booleans = TYPE_CALLOC(NCURSES_SBOOL,
@@ -234,7 +233,7 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
int ext_str_count = LOW_MSB(buf + 4);
int ext_str_size = LOW_MSB(buf + 6);
int ext_str_limit = LOW_MSB(buf + 8);
- unsigned need = (ext_bool_count + ext_num_count + ext_str_count);
+ unsigned need = (unsigned) (ext_bool_count + ext_num_count + ext_str_count);
int base = 0;
if (need >= sizeof(buf)
@@ -247,9 +246,9 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
|| ext_str_limit < 0)
return (TGETENT_NO);
- ptr->num_Booleans = BOOLCOUNT + ext_bool_count;
- ptr->num_Numbers = NUMCOUNT + ext_num_count;
- ptr->num_Strings = STRCOUNT + ext_str_count;
+ ptr->num_Booleans = UShort(BOOLCOUNT + ext_bool_count);
+ ptr->num_Numbers = UShort(NUMCOUNT + ext_num_count);
+ ptr->num_Strings = UShort(STRCOUNT + ext_str_count);
ptr->Booleans = typeRealloc(NCURSES_SBOOL, ptr->num_Booleans, ptr->Booleans);
ptr->Numbers = typeRealloc(short, ptr->num_Numbers, ptr->Numbers);
@@ -261,7 +260,7 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
TR(TRACE_DATABASE, ("READ %d extended-booleans @%d",
ext_bool_count, offset));
- if ((ptr->ext_Booleans = ext_bool_count) != 0) {
+ if ((ptr->ext_Booleans = UShort(ext_bool_count)) != 0) {
if (Read(ptr->Booleans + BOOLCOUNT, (unsigned)
ext_bool_count) != ext_bool_count)
return (TGETENT_NO);
@@ -270,7 +269,7 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
TR(TRACE_DATABASE, ("READ %d extended-numbers @%d",
ext_num_count, offset));
- if ((ptr->ext_Numbers = ext_num_count) != 0) {
+ if ((ptr->ext_Numbers = UShort(ext_num_count)) != 0) {
if (!read_shorts(buf, ext_num_count))
return (TGETENT_NO);
TR(TRACE_DATABASE, ("Before converting extended-numbers"));
@@ -279,21 +278,22 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
TR(TRACE_DATABASE, ("READ extended-offsets @%d", offset));
if ((ext_str_count || need)
- && !read_shorts(buf, ext_str_count + need))
+ && !read_shorts(buf, ext_str_count + (int) need))
return (TGETENT_NO);
TR(TRACE_DATABASE, ("READ %d bytes of extended-strings @%d",
ext_str_limit, offset));
if (ext_str_limit) {
- if ((ptr->ext_str_table = typeMalloc(char, ext_str_limit)) == 0)
- return (TGETENT_NO);
+ ptr->ext_str_table = typeMalloc(char, (size_t) ext_str_limit);
+ if (ptr->ext_str_table == 0)
+ return (TGETENT_NO);
if (Read(ptr->ext_str_table, (unsigned) ext_str_limit) != ext_str_limit)
return (TGETENT_NO);
TR(TRACE_DATABASE, ("first extended-string is %s", _nc_visbuf(ptr->ext_str_table)));
}
- if ((ptr->ext_Strings = ext_str_count) != 0) {
+ if ((ptr->ext_Strings = UShort(ext_str_count)) != 0) {
TR(TRACE_DATABASE,
("Before computing extended-string capabilities str_count=%d, ext_str_count=%d",
str_count, ext_str_count));
@@ -305,7 +305,7 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
_nc_visbuf(ptr->Strings[i + str_count])));
ptr->Strings[i + STRCOUNT] = ptr->Strings[i + str_count];
if (VALID_STRING(ptr->Strings[i + STRCOUNT]))
- base += (strlen(ptr->Strings[i + STRCOUNT]) + 1);
+ base += (int) (strlen(ptr->Strings[i + STRCOUNT]) + 1);
TR(TRACE_DATABASE, ("... to [%d] %s",
i + STRCOUNT,
_nc_visbuf(ptr->Strings[i + STRCOUNT])));
@@ -314,7 +314,7 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
if (need) {
if (ext_str_count >= (MAX_ENTRY_SIZE * 2))
- return (TGETENT_NO);
+ return (TGETENT_NO);
if ((ptr->ext_Names = TYPE_CALLOC(char *, need)) == 0)
return (TGETENT_NO);
TR(TRACE_DATABASE,
@@ -364,16 +364,18 @@ NCURSES_EXPORT(int)
_nc_read_file_entry(const char *const filename, TERMTYPE *ptr)
/* return 1 if read, 0 if not found or garbled */
{
- int code, fd = -1;
+ FILE *fp = 0;
+ int code;
int limit;
char buffer[MAX_ENTRY_SIZE + 1];
if (_nc_access(filename, R_OK) < 0
- || (fd = open(filename, O_RDONLY | O_BINARY)) < 0) {
+ || (fp = fopen(filename, "rb")) == 0) {
T(("cannot open terminfo %s (errno=%d)", filename, errno));
code = TGETENT_NO;
} else {
- if ((limit = read(fd, buffer, sizeof(buffer))) > 0) {
+ if ((limit = (int) fread(buffer, sizeof(char), sizeof(buffer), fp))
+ > 0) {
T(("read terminfo %s", filename));
if ((code = _nc_read_termtype(ptr, buffer, limit)) == TGETENT_NO) {
@@ -382,7 +384,7 @@ _nc_read_file_entry(const char *const filename, TERMTYPE *ptr)
} else {
code = TGETENT_NO;
}
- close(fd);
+ fclose(fp);
}
return (code);
@@ -404,26 +406,22 @@ _nc_read_tic_entry(char *filename,
/*
* If we are looking in a directory, assume the entry is a file under that,
* according to the normal rules.
- *
- * FIXME - add caseless-filename fixup.
*/
- if (_nc_is_dir_path(path)) {
- unsigned need = 4 + strlen(path) + strlen(name);
+ unsigned need = (unsigned) (LEAF_LEN + 3 + strlen(path) + strlen(name));
+ if (need <= limit)
+ (void) sprintf(filename, "%s/" LEAF_FMT "/%s", path, *name, name);
- if (need <= limit) {
- (void) sprintf(filename, "%s/" LEAF_FMT "/%s", path, *name, name);
- result = _nc_read_file_entry(filename, tp);
- }
- }
+ if (_nc_is_dir_path(path))
+ result = _nc_read_file_entry(filename, tp);
#if USE_HASHED_DB
else {
static const char suffix[] = DBM_SUFFIX;
DB *capdbp;
unsigned lens = sizeof(suffix) - 1;
unsigned size = strlen(path);
- unsigned need = lens + size;
+ unsigned test = lens + size;
- if (need <= limit) {
+ if (test < limit) {
if (size >= lens
&& !strcmp(path + size - lens, suffix))
(void) strcpy(filename, path);
@@ -515,6 +513,7 @@ _nc_read_entry(const char *const name, char *const filename, TERMTYPE *const tp)
{
int code = TGETENT_NO;
+ sprintf(filename, "%.*s", PATH_MAX - 1, name);
if (strlen(name) == 0
|| strcmp(name, ".") == 0
|| strcmp(name, "..") == 0
diff --git a/contrib/ncurses/ncurses/tinfo/read_termcap.c b/contrib/ncurses/ncurses/tinfo/read_termcap.c
index d94d1a42466d..b39a5bebaa47 100644
--- a/contrib/ncurses/ncurses/tinfo/read_termcap.c
+++ b/contrib/ncurses/ncurses/tinfo/read_termcap.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -56,9 +56,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <tic.h>
-#include <term_entry.h>
-MODULE_ID("$Id: read_termcap.c,v 1.71 2006/07/29 12:06:51 tom Exp $")
+MODULE_ID("$Id: read_termcap.c,v 1.74 2010/01/23 17:57:43 tom Exp $")
#if !PURE_TERMINFO
@@ -79,6 +78,15 @@ get_termpath(void)
return result;
}
+/*
+ * Note:
+ * getcap(), cgetent(), etc., are BSD functions. A copy of those was added to
+ * this file in November 1995, derived from the BSD4.4 Lite sources.
+ *
+ * The initial adaptation uses 518 lines from that source.
+ * The current source (in 2009) uses 183 lines of BSD4.4 Lite (441 ignoring
+ * whitespace).
+ */
#if USE_GETCAP
#if HAVE_BSD_CGETENT
@@ -107,11 +115,7 @@ static int _nc_nfcmp(const char *, char *);
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/contrib/ncurses/ncurses/tinfo/setbuf.c b/contrib/ncurses/ncurses/tinfo/setbuf.c
index ba910e8983a4..a2e2660c8664 100644
--- a/contrib/ncurses/ncurses/tinfo/setbuf.c
+++ b/contrib/ncurses/ncurses/tinfo/setbuf.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,6 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer 2008 *
****************************************************************************/
/*
@@ -40,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: setbuf.c,v 1.13 2007/05/12 19:04:02 tom Exp $")
+MODULE_ID("$Id: setbuf.c,v 1.16 2010/08/28 21:08:31 tom Exp $")
/*
* If the output file descriptor is connected to a tty (the typical case) it
@@ -98,11 +100,20 @@ MODULE_ID("$Id: setbuf.c,v 1.13 2007/05/12 19:04:02 tom Exp $")
* buffer. So we disable this by default (there may yet be a workaround).
*/
NCURSES_EXPORT(void)
-_nc_set_buffer(FILE *ofp, bool buffered)
+NCURSES_SP_NAME(_nc_set_buffer) (NCURSES_SP_DCLx FILE *ofp, bool buffered)
{
+ int Cols;
+ int Lines;
+
+ if (0 == SP_PARM)
+ return;
+
+ Cols = *(ptrCols(SP_PARM));
+ Lines = *(ptrLines(SP_PARM));
+
/* optional optimization hack -- do before any output to ofp */
#if HAVE_SETVBUF || HAVE_SETBUFFER
- if (SP->_buffered != buffered) {
+ if (SP_PARM->_buffered != buffered) {
unsigned buf_len;
char *buf_ptr;
@@ -114,11 +125,11 @@ _nc_set_buffer(FILE *ofp, bool buffered)
setmode(ofp, O_BINARY);
#endif
if (buffered != 0) {
- buf_len = min(LINES * (COLS + 6), 2800);
- if ((buf_ptr = SP->_setbuf) == 0) {
+ buf_len = (unsigned) min(Lines * (Cols + 6), 2800);
+ if ((buf_ptr = SP_PARM->_setbuf) == 0) {
if ((buf_ptr = typeMalloc(char, buf_len)) == NULL)
return;
- SP->_setbuf = buf_ptr;
+ SP_PARM->_setbuf = buf_ptr;
/* Don't try to free this! */
}
#if !USE_SETBUF_0
@@ -144,7 +155,15 @@ _nc_set_buffer(FILE *ofp, bool buffered)
(void) setbuffer(ofp, buf_ptr, (int) buf_len);
#endif
- SP->_buffered = buffered;
+ SP_PARM->_buffered = buffered;
}
#endif /* HAVE_SETVBUF || HAVE_SETBUFFER */
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_set_buffer(FILE *ofp, bool buffered)
+{
+ NCURSES_SP_NAME(_nc_set_buffer) (CURRENT_SCREEN, ofp, buffered);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/tinfo/tinfo_driver.c b/contrib/ncurses/ncurses/tinfo/tinfo_driver.c
new file mode 100644
index 000000000000..5b3b55a4519e
--- /dev/null
+++ b/contrib/ncurses/ncurses/tinfo/tinfo_driver.c
@@ -0,0 +1,1337 @@
+/****************************************************************************
+ * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc. *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a *
+ * copy of this software and associated documentation files (the *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Juergen Pfeifer *
+ * *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+#define CUR ((TERMINAL*)TCB)->type.
+#include <tic.h>
+
+#if HAVE_NANOSLEEP
+#include <time.h>
+#if HAVE_SYS_TIME_H
+#include <sys/time.h> /* needed for MacOS X DP3 */
+#endif
+#endif
+
+#if HAVE_SIZECHANGE
+# if !defined(sun) || !TERMIOS
+# if HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+# endif
+# endif
+#endif
+
+MODULE_ID("$Id: tinfo_driver.c,v 1.13 2010/12/20 01:47:09 tom Exp $")
+
+/*
+ * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS,
+ * Solaris, IRIX) define TIOCGWINSZ and struct winsize.
+ */
+#ifdef TIOCGSIZE
+# define IOCTL_WINSIZE TIOCGSIZE
+# define STRUCT_WINSIZE struct ttysize
+# define WINSIZE_ROWS(n) (int)n.ts_lines
+# define WINSIZE_COLS(n) (int)n.ts_cols
+#else
+# ifdef TIOCGWINSZ
+# define IOCTL_WINSIZE TIOCGWINSZ
+# define STRUCT_WINSIZE struct winsize
+# define WINSIZE_ROWS(n) (int)n.ws_row
+# define WINSIZE_COLS(n) (int)n.ws_col
+# endif
+#endif
+
+/*
+ * 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 CURRENT_SCREEN ? CURRENT_SCREEN->_pair_count : -1;
+}
+NCURSES_EXPORT(int)
+NCURSES_PUBLIC_VAR(COLORS) (void)
+{
+ return CURRENT_SCREEN ? CURRENT_SCREEN->_color_count : -1;
+}
+#else
+NCURSES_EXPORT_VAR(int) COLOR_PAIRS = 0;
+NCURSES_EXPORT_VAR(int) COLORS = 0;
+#endif
+
+#define TCBMAGIC NCDRV_MAGIC(NCDRV_TINFO)
+#define AssertTCB() assert(TCB!=0 && TCB->magic==TCBMAGIC)
+#define SetSP() assert(TCB->csp!=0); sp = TCB->csp
+
+/*
+ * This routine needs to do all the work to make curscr look
+ * like newscr.
+ */
+static int
+drv_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ AssertTCB();
+ return TINFO_DOUPDATE(TCB->csp);
+}
+
+#define ret_error(code, fmt, arg) if (errret) {\
+ *errret = code;\
+ return(FALSE); \
+ } else {\
+ fprintf(stderr, fmt, arg);\
+ exit(EXIT_FAILURE);\
+ }
+
+#define ret_error0(code, msg) if (errret) {\
+ *errret = code;\
+ return(FALSE);\
+ } else {\
+ fprintf(stderr, msg);\
+ exit(EXIT_FAILURE);\
+ }
+
+static bool
+drv_CanHandle(TERMINAL_CONTROL_BLOCK * TCB, const char *tname, int *errret)
+{
+ bool result = FALSE;
+ int status;
+ TERMINAL *termp;
+ SCREEN *sp;
+
+ assert(TCB != 0 && tname != 0);
+ termp = (TERMINAL *) TCB;
+ sp = TCB->csp;
+ TCB->magic = TCBMAGIC;
+
+#if (USE_DATABASE || USE_TERMCAP)
+ status = _nc_setup_tinfo(tname, &termp->type);
+#else
+ status = TGETENT_NO;
+#endif
+
+ /* try fallback list if entry on disk */
+ if (status != TGETENT_YES) {
+ const TERMTYPE *fallback = _nc_fallback(tname);
+
+ if (fallback) {
+ termp->type = *fallback;
+ status = TGETENT_YES;
+ }
+ }
+
+ if (status != TGETENT_YES) {
+ NCURSES_SP_NAME(del_curterm) (NCURSES_SP_ARGx termp);
+ if (status == TGETENT_ERR) {
+ ret_error0(status, "terminals database is inaccessible\n");
+ } else if (status == TGETENT_NO) {
+ ret_error(status, "'%s': unknown terminal type.\n", tname);
+ }
+ }
+ result = TRUE;
+#if !USE_REENTRANT
+ strncpy(ttytype, termp->type.term_names, NAMESIZE - 1);
+ ttytype[NAMESIZE - 1] = '\0';
+#endif
+
+ if (command_character)
+ _nc_tinfo_cmdch(termp, *command_character);
+
+ if (generic_type) {
+ ret_error(TGETENT_NO, "'%s': I need something more specific.\n", tname);
+ }
+ if (hard_copy) {
+ ret_error(TGETENT_YES, "'%s': I can't handle hardcopy terminals.\n", tname);
+ }
+
+ return result;
+}
+
+static int
+drv_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB, bool beepFlag)
+{
+ SCREEN *sp;
+ int res = ERR;
+
+ AssertTCB();
+ SetSP();
+
+ /* FIXME: should make sure that we are not in altchar mode */
+ if (beepFlag) {
+ if (bell) {
+ res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "bell", bell);
+ NCURSES_SP_NAME(_nc_flush) (sp);
+ } else if (flash_screen) {
+ res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+ "flash_screen",
+ flash_screen);
+ NCURSES_SP_NAME(_nc_flush) (sp);
+ }
+ } else {
+ if (flash_screen) {
+ res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+ "flash_screen",
+ flash_screen);
+ NCURSES_SP_NAME(_nc_flush) (sp);
+ } else if (bell) {
+ res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "bell", bell);
+ NCURSES_SP_NAME(_nc_flush) (sp);
+ }
+ }
+ return res;
+}
+
+/*
+ * SVr4 curses is known to interchange color codes (1,4) and (3,6), possibly
+ * to maintain compatibility with a pre-ANSI scheme. The same scheme is
+ * also used in the FreeBSD syscons.
+ */
+static int
+toggled_colors(int c)
+{
+ if (c < 16) {
+ static const int table[] =
+ {0, 4, 2, 6, 1, 5, 3, 7,
+ 8, 12, 10, 14, 9, 13, 11, 15};
+ c = table[c];
+ }
+ return c;
+}
+
+static int
+drv_print(TERMINAL_CONTROL_BLOCK * TCB, char *data, int len)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+#if NCURSES_EXT_FUNCS
+ return NCURSES_SP_NAME(mcprint) (TCB->csp, data, len);
+#else
+ return ERR;
+#endif
+}
+
+static int
+drv_defaultcolors(TERMINAL_CONTROL_BLOCK * TCB, int fg, int bg)
+{
+ SCREEN *sp;
+ int code = ERR;
+
+ AssertTCB();
+ SetSP();
+
+ if (sp != 0 && orig_pair && orig_colors && (initialize_pair != 0)) {
+#if NCURSES_EXT_FUNCS
+ sp->_default_color = isDefaultColor(fg) || isDefaultColor(bg);
+ sp->_has_sgr_39_49 = (NCURSES_SP_NAME(tigetflag) (NCURSES_SP_ARGx
+ "AX")
+ == TRUE);
+ sp->_default_fg = isDefaultColor(fg) ? COLOR_DEFAULT : (fg & C_MASK);
+ sp->_default_bg = isDefaultColor(bg) ? COLOR_DEFAULT : (bg & C_MASK);
+ if (sp->_color_pairs != 0) {
+ bool save = sp->_default_color;
+ sp->_default_color = TRUE;
+ NCURSES_SP_NAME(init_pair) (NCURSES_SP_ARGx
+ 0,
+ (short)fg,
+ (short)bg);
+ sp->_default_color = save;
+ }
+#endif
+ code = OK;
+ }
+ return (code);
+}
+
+static void
+drv_setcolor(TERMINAL_CONTROL_BLOCK * TCB,
+ bool fore,
+ int color,
+ NCURSES_SP_OUTC outc)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ if (fore) {
+ if (set_a_foreground) {
+ TPUTS_TRACE("set_a_foreground");
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_a_foreground, color), 1, outc);
+ } else {
+ TPUTS_TRACE("set_foreground");
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_foreground,
+ toggled_colors(color)), 1, outc);
+ }
+ } else {
+ if (set_a_background) {
+ TPUTS_TRACE("set_a_background");
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_a_background, color), 1, outc);
+ } else {
+ TPUTS_TRACE("set_background");
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_background,
+ toggled_colors(color)), 1, outc);
+ }
+ }
+}
+
+static bool
+drv_rescol(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ bool result = FALSE;
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ if (orig_pair != 0) {
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "orig_pair", orig_pair);
+ result = TRUE;
+ }
+ return result;
+}
+
+static bool
+drv_rescolors(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ int result = FALSE;
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ if (orig_colors != 0) {
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "orig_colors", orig_colors);
+ result = TRUE;
+ }
+ return result;
+}
+
+static int
+drv_size(TERMINAL_CONTROL_BLOCK * TCB, int *linep, int *colp)
+{
+ SCREEN *sp;
+ bool useEnv = TRUE;
+
+ AssertTCB();
+ sp = TCB->csp; /* can be null here */
+
+ if (sp) {
+ useEnv = sp->_use_env;
+ } else
+ useEnv = _nc_prescreen.use_env;
+
+ /* figure out the size of the screen */
+ T(("screen size: terminfo lines = %d columns = %d", lines, columns));
+
+ *linep = (int) lines;
+ *colp = (int) columns;
+
+ if (useEnv) {
+ int value;
+
+#ifdef __EMX__
+ {
+ int screendata[2];
+ _scrsize(screendata);
+ *colp = screendata[0];
+ *linep = screendata[1];
+ T(("EMX screen size: environment LINES = %d COLUMNS = %d",
+ *linep, *colp));
+ }
+#endif
+#if HAVE_SIZECHANGE
+ /* try asking the OS */
+ {
+ TERMINAL *termp = (TERMINAL *) TCB;
+ if (isatty(termp->Filedes)) {
+ STRUCT_WINSIZE size;
+
+ errno = 0;
+ do {
+ if (ioctl(termp->Filedes, IOCTL_WINSIZE, &size) >= 0) {
+ *linep = ((sp != 0 && sp->_filtered)
+ ? 1
+ : WINSIZE_ROWS(size));
+ *colp = WINSIZE_COLS(size);
+ T(("SYS screen size: environment LINES = %d COLUMNS = %d",
+ *linep, *colp));
+ break;
+ }
+ } while
+ (errno == EINTR);
+ }
+ }
+#endif /* HAVE_SIZECHANGE */
+
+ /*
+ * Finally, look for environment variables.
+ *
+ * Solaris lets users override either dimension with an environment
+ * variable.
+ */
+ if ((value = _nc_getenv_num("LINES")) > 0) {
+ *linep = value;
+ T(("screen size: environment LINES = %d", *linep));
+ }
+ if ((value = _nc_getenv_num("COLUMNS")) > 0) {
+ *colp = value;
+ T(("screen size: environment COLUMNS = %d", *colp));
+ }
+
+ /* if we can't get dynamic info about the size, use static */
+ if (*linep <= 0) {
+ *linep = (int) lines;
+ }
+ if (*colp <= 0) {
+ *colp = (int) columns;
+ }
+
+ /* the ultimate fallback, assume fixed 24x80 size */
+ if (*linep <= 0) {
+ *linep = 24;
+ }
+ if (*colp <= 0) {
+ *colp = 80;
+ }
+
+ /*
+ * Put the derived values back in the screen-size caps, so
+ * tigetnum() and tgetnum() will do the right thing.
+ */
+ lines = (short) (*linep);
+ columns = (short) (*colp);
+ }
+
+ T(("screen size is %dx%d", *linep, *colp));
+ return OK;
+}
+
+static int
+drv_getsize(TERMINAL_CONTROL_BLOCK * TCB, int *l, int *c)
+{
+ AssertTCB();
+ assert(l != 0 && c != 0);
+ *l = lines;
+ *c = columns;
+ return OK;
+}
+
+static int
+drv_setsize(TERMINAL_CONTROL_BLOCK * TCB, int l, int c)
+{
+ AssertTCB();
+ lines = (short) l;
+ columns = (short) c;
+ return OK;
+}
+
+static int
+drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, bool setFlag, TTY * buf)
+{
+ SCREEN *sp = TCB->csp;
+ TERMINAL *_term = (TERMINAL *) TCB;
+ int result = OK;
+
+ AssertTCB();
+ if (setFlag) {
+ for (;;) {
+ if (SET_TTY(_term->Filedes, buf) != 0) {
+ if (errno == EINTR)
+ continue;
+ if (errno == ENOTTY) {
+ if (sp)
+ sp->_notty = TRUE;
+ }
+ result = ERR;
+ }
+ break;
+ }
+ } else {
+ for (;;) {
+ if (GET_TTY(_term->Filedes, buf) != 0) {
+ if (errno == EINTR)
+ continue;
+ result = ERR;
+ }
+ break;
+ }
+ }
+ return result;
+}
+
+static int
+drv_mode(TERMINAL_CONTROL_BLOCK * TCB, bool progFlag, bool defFlag)
+{
+ SCREEN *sp;
+ TERMINAL *_term = (TERMINAL *) TCB;
+ int code = ERR;
+
+ AssertTCB();
+ sp = TCB->csp;
+
+ if (progFlag) /* prog mode */
+ {
+ if (defFlag) {
+ /* def_prog_mode */
+ /*
+ * Turn off the XTABS bit in the tty structure if it was on.
+ */
+ if ((drv_sgmode(TCB, FALSE, &(_term->Nttyb)) == OK)) {
+#ifdef TERMIOS
+ _term->Nttyb.c_oflag &= (unsigned) ~OFLAGS_TABS;
+#else
+ _term->Nttyb.sg_flags &= (unsigned) ~XTABS;
+#endif
+ code = OK;
+ }
+ } else {
+ /* reset_prog_mode */
+ if (drv_sgmode(TCB, TRUE, &(_term->Nttyb)) == OK) {
+ if (sp) {
+ if (sp->_keypad_on)
+ _nc_keypad(sp, TRUE);
+ NC_BUFFERED(sp, TRUE);
+ }
+ code = OK;
+ }
+ }
+ } else { /* shell mode */
+ if (defFlag) {
+ /* def_shell_mode */
+ /*
+ * If XTABS was on, remove the tab and backtab capabilities.
+ */
+ if (drv_sgmode(TCB, FALSE, &(_term->Ottyb)) == OK) {
+#ifdef TERMIOS
+ if (_term->Ottyb.c_oflag & OFLAGS_TABS)
+ tab = back_tab = NULL;
+#else
+ if (_term->Ottyb.sg_flags & XTABS)
+ tab = back_tab = NULL;
+#endif
+ code = OK;
+ }
+ } else {
+ /* reset_shell_mode */
+ if (sp) {
+ _nc_keypad(sp, FALSE);
+ NCURSES_SP_NAME(_nc_flush) (sp);
+ NC_BUFFERED(sp, FALSE);
+ }
+ code = drv_sgmode(TCB, TRUE, &(_term->Ottyb));
+ }
+ }
+ return (code);
+}
+
+static void
+drv_wrap(SCREEN *sp)
+{
+ if (sp) {
+ sp->_mouse_wrap(sp);
+ NCURSES_SP_NAME(_nc_screen_wrap) (sp);
+ NCURSES_SP_NAME(_nc_mvcur_wrap) (sp); /* wrap up cursor addressing */
+ }
+}
+
+static void
+drv_release(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED)
+{
+}
+
+# define SGR0_TEST(mode) (mode != 0) && (exit_attribute_mode == 0 || strcmp(mode, exit_attribute_mode))
+
+static void
+drv_screen_init(SCREEN *sp)
+{
+ TERMINAL_CONTROL_BLOCK *TCB = TCBOf(sp);
+
+ AssertTCB();
+
+ /*
+ * Check for mismatched graphic-rendition capabilities. Most SVr4
+ * terminfo trees contain entries that have rmul or rmso equated to
+ * sgr0 (Solaris curses copes with those entries). We do this only
+ * for curses, since many termcap applications assume that
+ * smso/rmso and smul/rmul are paired, and will not function
+ * properly if we remove rmso or rmul. Curses applications
+ * shouldn't be looking at this detail.
+ */
+ sp->_use_rmso = SGR0_TEST(exit_standout_mode);
+ sp->_use_rmul = SGR0_TEST(exit_underline_mode);
+
+ /*
+ * Check whether we can optimize scrolling under dumb terminals in
+ * case we do not have any of these capabilities, scrolling
+ * optimization will be useless.
+ */
+ sp->_scrolling = ((scroll_forward && scroll_reverse) ||
+ ((parm_rindex ||
+ parm_insert_line ||
+ insert_line) &&
+ (parm_index ||
+ parm_delete_line ||
+ delete_line)));
+
+ NCURSES_SP_NAME(baudrate) (sp);
+
+ NCURSES_SP_NAME(_nc_mvcur_init) (sp);
+ /* initialize terminal to a sane state */
+ NCURSES_SP_NAME(_nc_screen_init) (sp);
+}
+
+static void
+drv_init(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ SCREEN *sp;
+ TERMINAL *trm;
+
+ AssertTCB();
+
+ trm = (TERMINAL *) TCB;
+ sp = TCB->csp;
+
+ TCB->info.initcolor = initialize_color;
+ TCB->info.canchange = can_change;
+ TCB->info.hascolor = ((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs)
+ && (((set_foreground != NULL)
+ && (set_background != NULL))
+ || ((set_a_foreground != NULL)
+ && (set_a_background != NULL))
+ || set_color_pair)) ? TRUE : FALSE);
+
+ TCB->info.caninit = !(exit_ca_mode && non_rev_rmcup);
+
+ TCB->info.maxpairs = VALID_NUMERIC(max_pairs) ? max_pairs : 0;
+ TCB->info.maxcolors = VALID_NUMERIC(max_colors) ? max_colors : 0;
+ TCB->info.numlabels = VALID_NUMERIC(num_labels) ? num_labels : 0;
+ TCB->info.labelwidth = VALID_NUMERIC(label_width) ? label_width : 0;
+ TCB->info.labelheight = VALID_NUMERIC(label_height) ? label_height : 0;
+ TCB->info.nocolorvideo = VALID_NUMERIC(no_color_video) ? no_color_video
+ : 0;
+ TCB->info.tabsize = VALID_NUMERIC(init_tabs) ? (int) init_tabs : 8;
+
+ TCB->info.defaultPalette = hue_lightness_saturation ? _nc_hls_palette : _nc_cga_palette;
+
+ /*
+ * If an application calls setupterm() rather than initscr() or
+ * newterm(), we will not have the def_prog_mode() call in
+ * _nc_setupscreen(). Do it now anyway, so we can initialize the
+ * baudrate.
+ */
+ if (isatty(trm->Filedes)) {
+ TCB->drv->mode(TCB, TRUE, TRUE);
+ }
+}
+
+#define MAX_PALETTE 8
+#define InPalette(n) ((n) >= 0 && (n) < MAX_PALETTE)
+
+static void
+drv_initpair(TERMINAL_CONTROL_BLOCK * TCB, short pair, short f, short b)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ if ((initialize_pair != NULL) && InPalette(f) && InPalette(b)) {
+ const color_t *tp = InfoOf(sp).defaultPalette;
+
+ 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));
+
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+ "initialize_pair",
+ TPARM_7(initialize_pair,
+ pair,
+ tp[f].red, tp[f].green, tp[f].blue,
+ tp[b].red, tp[b].green, tp[b].blue));
+ }
+}
+
+static int
+default_fg(SCREEN *sp)
+{
+#if NCURSES_EXT_FUNCS
+ return (sp != 0) ? sp->_default_fg : COLOR_WHITE;
+#else
+ return COLOR_WHITE;
+#endif
+}
+
+static int
+default_bg(SCREEN *sp)
+{
+#if NCURSES_EXT_FUNCS
+ return sp != 0 ? sp->_default_bg : COLOR_BLACK;
+#else
+ return COLOR_BLACK;
+#endif
+}
+
+static void
+drv_initcolor(TERMINAL_CONTROL_BLOCK * TCB,
+ short color, short r, short g, short b)
+{
+ SCREEN *sp = TCB->csp;
+
+ AssertTCB();
+ if (initialize_color != NULL) {
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+ "initialize_color",
+ TPARM_4(initialize_color, color, r, g, b));
+ }
+}
+
+static void
+drv_do_color(TERMINAL_CONTROL_BLOCK * TCB,
+ short old_pair,
+ short pair,
+ bool reverse,
+ NCURSES_SP_OUTC outc)
+{
+ SCREEN *sp = TCB->csp;
+ NCURSES_COLOR_T fg = COLOR_DEFAULT;
+ NCURSES_COLOR_T bg = COLOR_DEFAULT;
+ NCURSES_COLOR_T old_fg, old_bg;
+
+ AssertTCB();
+ if (sp == 0)
+ return;
+
+ if (pair < 0 || pair >= COLOR_PAIRS) {
+ return;
+ } else if (pair != 0) {
+ if (set_color_pair) {
+ TPUTS_TRACE("set_color_pair");
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_color_pair, pair), 1, outc);
+ return;
+ } else if (sp != 0) {
+ NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx
+ (short) pair,
+ &fg,
+ &bg);
+ }
+ }
+
+ if (old_pair >= 0
+ && sp != 0
+ && NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx
+ old_pair,
+ &old_fg,
+ &old_bg) !=ERR) {
+ if ((isDefaultColor(fg) && !isDefaultColor(old_fg))
+ || (isDefaultColor(bg) && !isDefaultColor(old_bg))) {
+#if NCURSES_EXT_FUNCS
+ /*
+ * A minor optimization - but extension. If "AX" is specified in
+ * the terminal description, treat it as screen's indicator of ECMA
+ * SGR 39 and SGR 49, and assume the two sequences are independent.
+ */
+ if (sp->_has_sgr_39_49
+ && isDefaultColor(old_bg)
+ && !isDefaultColor(old_fg)) {
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[39m", 1, outc);
+ } else if (sp->_has_sgr_39_49
+ && isDefaultColor(old_fg)
+ && !isDefaultColor(old_bg)) {
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[49m", 1, outc);
+ } else
+#endif
+ drv_rescol(TCB);
+ }
+ } else {
+ drv_rescol(TCB);
+ if (old_pair < 0)
+ return;
+ }
+
+#if NCURSES_EXT_FUNCS
+ if (isDefaultColor(fg))
+ fg = (NCURSES_COLOR_T) default_fg(sp);
+ if (isDefaultColor(bg))
+ bg = (NCURSES_COLOR_T) default_bg(sp);
+#endif
+
+ if (reverse) {
+ NCURSES_COLOR_T xx = fg;
+ fg = bg;
+ bg = xx;
+ }
+
+ TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair,
+ fg, bg));
+
+ if (!isDefaultColor(fg)) {
+ drv_setcolor(TCB, TRUE, fg, outc);
+ }
+ if (!isDefaultColor(bg)) {
+ drv_setcolor(TCB, FALSE, bg, outc);
+ }
+}
+
+#define xterm_kmous "\033[M"
+static void
+init_xterm_mouse(SCREEN *sp)
+{
+ sp->_mouse_type = M_XTERM;
+ sp->_mouse_xtermcap = NCURSES_SP_NAME(tigetstr) (NCURSES_SP_ARGx "XM");
+ if (!VALID_STRING(sp->_mouse_xtermcap))
+ sp->_mouse_xtermcap = "\033[?1000%?%p1%{1}%=%th%el%;";
+}
+
+static void
+drv_initmouse(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ /* we know how to recognize mouse events under "xterm" */
+ if (sp != 0) {
+ if (key_mouse != 0) {
+ if (!strcmp(key_mouse, xterm_kmous)
+ || strstr(TerminalOf(sp)->type.term_names, "xterm") != 0) {
+ init_xterm_mouse(sp);
+ }
+ } else if (strstr(TerminalOf(sp)->type.term_names, "xterm") != 0) {
+ if (_nc_add_to_try(&(sp->_keytry), xterm_kmous, KEY_MOUSE) == OK)
+ init_xterm_mouse(sp);
+ }
+ }
+}
+
+static int
+drv_testmouse(TERMINAL_CONTROL_BLOCK * TCB, int delay)
+{
+ int rc = 0;
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+#if USE_SYSMOUSE
+ if ((sp->_mouse_type == M_SYSMOUSE)
+ && (sp->_sysmouse_head < sp->_sysmouse_tail)) {
+ rc = TW_MOUSE;
+ } else
+#endif
+ {
+ rc = TCBOf(sp)->drv->twait(TCBOf(sp),
+ TWAIT_MASK,
+ delay,
+ (int *) 0
+ EVENTLIST_2nd(evl));
+#if USE_SYSMOUSE
+ if ((sp->_mouse_type == M_SYSMOUSE)
+ && (sp->_sysmouse_head < sp->_sysmouse_tail)
+ && (rc == 0)
+ && (errno == EINTR)) {
+ rc |= TW_MOUSE;
+ }
+#endif
+ }
+ return rc;
+}
+
+static int
+drv_mvcur(TERMINAL_CONTROL_BLOCK * TCB, int yold, int xold, int ynew, int xnew)
+{
+ SCREEN *sp = TCB->csp;
+ AssertTCB();
+ return TINFO_MVCUR(sp, yold, xold, ynew, xnew);
+}
+
+static void
+drv_hwlabel(TERMINAL_CONTROL_BLOCK * TCB, int labnum, char *text)
+{
+ SCREEN *sp = TCB->csp;
+
+ AssertTCB();
+ if (labnum > 0 && labnum <= num_labels) {
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+ "plab_norm",
+ TPARM_2(plab_norm, labnum, text));
+ }
+}
+
+static void
+drv_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB, bool OnFlag)
+{
+ SCREEN *sp = TCB->csp;
+
+ AssertTCB();
+ if (OnFlag) {
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "label_on", label_on);
+ } else {
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "label_off", label_off);
+ }
+}
+
+static chtype
+drv_conattr(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ SCREEN *sp = TCB->csp;
+ chtype attrs = A_NORMAL;
+
+ AssertTCB();
+ if (enter_alt_charset_mode)
+ attrs |= A_ALTCHARSET;
+
+ if (enter_blink_mode)
+ attrs |= A_BLINK;
+
+ if (enter_bold_mode)
+ attrs |= A_BOLD;
+
+ if (enter_dim_mode)
+ attrs |= A_DIM;
+
+ if (enter_reverse_mode)
+ attrs |= A_REVERSE;
+
+ if (enter_standout_mode)
+ attrs |= A_STANDOUT;
+
+ if (enter_protected_mode)
+ attrs |= A_PROTECT;
+
+ if (enter_secure_mode)
+ attrs |= A_INVIS;
+
+ if (enter_underline_mode)
+ attrs |= A_UNDERLINE;
+
+ if (sp && sp->_coloron)
+ attrs |= A_COLOR;
+
+ return (attrs);
+}
+
+static void
+drv_setfilter(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ AssertTCB();
+
+ clear_screen = 0;
+ cursor_down = parm_down_cursor = 0;
+ cursor_address = 0;
+ cursor_up = parm_up_cursor = 0;
+ row_address = 0;
+ cursor_home = carriage_return;
+}
+
+static void
+drv_initacs(TERMINAL_CONTROL_BLOCK * TCB, chtype *real_map, chtype *fake_map)
+{
+ SCREEN *sp = TCB->csp;
+
+ AssertTCB();
+ assert(sp != 0);
+ if (ena_acs != NULL) {
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "ena_acs", ena_acs);
+ }
+#if NCURSES_EXT_FUNCS
+ /*
+ * Linux console "supports" the "PC ROM" character set by the coincidence
+ * that smpch/rmpch and smacs/rmacs have the same values. ncurses has
+ * no codepage support (see SCO Merge for an example). Outside of the
+ * values defined in acsc, there are no definitions for the "PC ROM"
+ * character set (assumed by some applications to be codepage 437), but we
+ * allow those applications to use those codepoints.
+ *
+ * test/blue.c uses this feature.
+ */
+#define PCH_KLUDGE(a,b) (a != 0 && b != 0 && !strcmp(a,b))
+ if (PCH_KLUDGE(enter_pc_charset_mode, enter_alt_charset_mode) &&
+ PCH_KLUDGE(exit_pc_charset_mode, exit_alt_charset_mode)) {
+ size_t i;
+ for (i = 1; i < ACS_LEN; ++i) {
+ if (real_map[i] == 0) {
+ real_map[i] = i;
+ if (real_map != fake_map) {
+ if (sp != 0)
+ sp->_screen_acs_map[i] = TRUE;
+ }
+ }
+ }
+ }
+#endif
+
+ if (acs_chars != NULL) {
+ size_t i = 0;
+ size_t length = strlen(acs_chars);
+
+ while (i + 1 < length) {
+ if (acs_chars[i] != 0 && UChar(acs_chars[i]) < ACS_LEN) {
+ real_map[UChar(acs_chars[i])] = UChar(acs_chars[i + 1]) | A_ALTCHARSET;
+ if (sp != 0)
+ sp->_screen_acs_map[UChar(acs_chars[i])] = TRUE;
+ }
+ i += 2;
+ }
+ }
+#ifdef TRACE
+ /* Show the equivalent mapping, noting if it does not match the
+ * given attribute, whether by re-ordering or duplication.
+ */
+ if (USE_TRACEF(TRACE_CALLS)) {
+ size_t n, m;
+ char show[ACS_LEN * 2 + 1];
+ for (n = 1, m = 0; n < ACS_LEN; n++) {
+ if (real_map[n] != 0) {
+ show[m++] = (char) n;
+ show[m++] = (char) ChCharOf(real_map[n]);
+ }
+ }
+ show[m] = 0;
+ if (acs_chars == NULL || strcmp(acs_chars, show))
+ _tracef("%s acs_chars %s",
+ (acs_chars == NULL) ? "NULL" : "READ",
+ _nc_visbuf(acs_chars));
+ _tracef("%s acs_chars %s",
+ (acs_chars == NULL)
+ ? "NULL"
+ : (strcmp(acs_chars, show)
+ ? "DIFF"
+ : "SAME"),
+ _nc_visbuf(show));
+
+ _nc_unlock_global(tracef);
+ }
+#endif /* TRACE */
+}
+
+#define ENSURE_TINFO(sp) (TCBOf(sp)->drv->isTerminfo)
+
+NCURSES_EXPORT(void)
+_nc_cookie_init(SCREEN *sp)
+{
+ bool support_cookies = USE_XMC_SUPPORT;
+ TERMINAL_CONTROL_BLOCK *TCB = (TERMINAL_CONTROL_BLOCK *) (sp->_term);
+
+ if (sp == 0 || !ENSURE_TINFO(sp))
+ return;
+
+#if USE_XMC_SUPPORT
+ /*
+ * If we have no magic-cookie support compiled-in, or if it is suppressed
+ * in the environment, reset the support-flag.
+ */
+ if (magic_cookie_glitch >= 0) {
+ if (getenv("NCURSES_NO_MAGIC_COOKIE") != 0) {
+ support_cookies = FALSE;
+ }
+ }
+#endif
+
+ if (!support_cookies && magic_cookie_glitch >= 0) {
+ T(("will disable attributes to work w/o magic cookies"));
+ }
+
+ if (magic_cookie_glitch > 0) { /* tvi, wyse */
+
+ sp->_xmc_triggers = sp->_ok_attributes & (
+ A_STANDOUT |
+ A_UNDERLINE |
+ A_REVERSE |
+ A_BLINK |
+ A_DIM |
+ A_BOLD |
+ A_INVIS |
+ A_PROTECT
+ );
+#if 0
+ /*
+ * We "should" treat colors as an attribute. The wyse350 (and its
+ * clones) appear to be the only ones that have both colors and magic
+ * cookies.
+ */
+ if (has_colors()) {
+ sp->_xmc_triggers |= A_COLOR;
+ }
+#endif
+ sp->_xmc_suppress = sp->_xmc_triggers & (chtype) ~(A_BOLD);
+
+ T(("magic cookie attributes %s", _traceattr(sp->_xmc_suppress)));
+ /*
+ * Supporting line-drawing may be possible. But make the regular
+ * video attributes work first.
+ */
+ acs_chars = ABSENT_STRING;
+ ena_acs = ABSENT_STRING;
+ enter_alt_charset_mode = ABSENT_STRING;
+ exit_alt_charset_mode = ABSENT_STRING;
+#if USE_XMC_SUPPORT
+ /*
+ * To keep the cookie support simple, suppress all of the optimization
+ * hooks except for clear_screen and the cursor addressing.
+ */
+ if (support_cookies) {
+ clr_eol = ABSENT_STRING;
+ clr_eos = ABSENT_STRING;
+ set_attributes = ABSENT_STRING;
+ }
+#endif
+ } else if (magic_cookie_glitch == 0) { /* hpterm */
+ }
+
+ /*
+ * If magic cookies are not supported, cancel the strings that set
+ * video attributes.
+ */
+ if (!support_cookies && magic_cookie_glitch >= 0) {
+ magic_cookie_glitch = ABSENT_NUMERIC;
+ set_attributes = ABSENT_STRING;
+ enter_blink_mode = ABSENT_STRING;
+ enter_bold_mode = ABSENT_STRING;
+ enter_dim_mode = ABSENT_STRING;
+ enter_reverse_mode = ABSENT_STRING;
+ enter_standout_mode = ABSENT_STRING;
+ enter_underline_mode = ABSENT_STRING;
+ }
+
+ /* initialize normal acs before wide, since we use mapping in the latter */
+#if !USE_WIDEC_SUPPORT
+ if (_nc_unicode_locale() && _nc_locale_breaks_acs(sp->_term)) {
+ acs_chars = NULL;
+ ena_acs = NULL;
+ enter_alt_charset_mode = NULL;
+ exit_alt_charset_mode = NULL;
+ set_attributes = NULL;
+ }
+#endif
+}
+
+static int
+drv_twait(TERMINAL_CONTROL_BLOCK * TCB,
+ int mode,
+ int milliseconds,
+ int *timeleft
+ EVENTLIST_2nd(_nc_eventlist * evl))
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ return _nc_timed_wait(sp, mode, milliseconds, timeleft EVENTLIST_2nd(evl));
+}
+
+static int
+drv_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf)
+{
+ SCREEN *sp;
+ unsigned char c2 = 0;
+ int n;
+
+ AssertTCB();
+ assert(buf);
+ SetSP();
+
+# if USE_PTHREADS_EINTR
+ if ((pthread_self) && (pthread_kill) && (pthread_equal))
+ _nc_globals.read_thread = pthread_self();
+# endif
+ n = read(sp->_ifd, &c2, 1);
+#if USE_PTHREADS_EINTR
+ _nc_globals.read_thread = 0;
+#endif
+ *buf = (int) c2;
+ return n;
+}
+
+static int
+drv_nap(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int ms)
+{
+#if HAVE_NANOSLEEP
+ {
+ struct timespec request, remaining;
+ request.tv_sec = ms / 1000;
+ request.tv_nsec = (ms % 1000) * 1000000;
+ while (nanosleep(&request, &remaining) == -1
+ && errno == EINTR) {
+ request = remaining;
+ }
+ }
+#else
+ _nc_timed_wait(0, 0, ms, (int *) 0 EVENTLIST_2nd(0));
+#endif
+ return OK;
+}
+
+static int
+__nc_putp(SCREEN *sp, const char *name GCC_UNUSED, const char *value)
+{
+ int rc = ERR;
+
+ if (value) {
+ rc = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx name, value);
+ }
+ return rc;
+}
+
+static int
+__nc_putp_flush(SCREEN *sp, const char *name, const char *value)
+{
+ int rc = __nc_putp(sp, name, value);
+ if (rc != ERR) {
+ NCURSES_SP_NAME(_nc_flush) (sp);
+ }
+ return rc;
+}
+
+static int
+drv_kpad(TERMINAL_CONTROL_BLOCK * TCB, bool flag)
+{
+ int ret = ERR;
+ SCREEN *sp;
+
+ AssertTCB();
+
+ sp = TCB->csp;
+
+ if (sp) {
+ if (flag) {
+ (void) __nc_putp_flush(sp, "keypad_xmit", keypad_xmit);
+ } else if (!flag && keypad_local) {
+ (void) __nc_putp_flush(sp, "keypad_local", keypad_local);
+ }
+ if (flag && !sp->_tried) {
+ _nc_init_keytry(sp);
+ sp->_tried = TRUE;
+ }
+ ret = OK;
+ }
+
+ return ret;
+}
+
+static int
+drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int c, bool flag)
+{
+ SCREEN *sp;
+ int code = ERR;
+ int count = 0;
+ char *s;
+
+ AssertTCB();
+ SetSP();
+
+ if (c >= 0) {
+ unsigned ch = (unsigned) c;
+ if (flag) {
+ while ((s = _nc_expand_try(sp->_key_ok, ch, &count, 0)) != 0
+ && _nc_remove_key(&(sp->_key_ok), ch)) {
+ code = _nc_add_to_try(&(sp->_keytry), s, ch);
+ free(s);
+ count = 0;
+ if (code != OK)
+ break;
+ }
+ } else {
+ while ((s = _nc_expand_try(sp->_keytry, ch, &count, 0)) != 0
+ && _nc_remove_key(&(sp->_keytry), ch)) {
+ code = _nc_add_to_try(&(sp->_key_ok), s, ch);
+ free(s);
+ count = 0;
+ if (code != OK)
+ break;
+ }
+ }
+ }
+ return (code);
+}
+
+static bool
+drv_kyExist(TERMINAL_CONTROL_BLOCK * TCB, int key)
+{
+ bool res = FALSE;
+
+ AssertTCB();
+ if (TCB->csp)
+ res = TINFO_HAS_KEY(TCB->csp, key) == 0 ? FALSE : TRUE;
+
+ return res;
+}
+
+NCURSES_EXPORT_VAR (TERM_DRIVER) _nc_TINFO_DRIVER = {
+ TRUE,
+ drv_CanHandle, /* CanHandle */
+ drv_init, /* init */
+ drv_release, /* release */
+ drv_size, /* size */
+ drv_sgmode, /* sgmode */
+ drv_conattr, /* conattr */
+ drv_mvcur, /* hwcur */
+ drv_mode, /* mode */
+ drv_rescol, /* rescol */
+ drv_rescolors, /* rescolors */
+ drv_setcolor, /* color */
+ drv_dobeepflash, /* doBeepOrFlash */
+ drv_initpair, /* initpair */
+ drv_initcolor, /* initcolor */
+ drv_do_color, /* docolor */
+ drv_initmouse, /* initmouse */
+ drv_testmouse, /* testmouse */
+ drv_setfilter, /* setfilter */
+ drv_hwlabel, /* hwlabel */
+ drv_hwlabelOnOff, /* hwlabelOnOff */
+ drv_doupdate, /* update */
+ drv_defaultcolors, /* defaultcolors */
+ drv_print, /* print */
+ drv_getsize, /* getsize */
+ drv_setsize, /* setsize */
+ drv_initacs, /* initacs */
+ drv_screen_init, /* scinit */
+ drv_wrap, /* scexit */
+ drv_twait, /* twait */
+ drv_read, /* read */
+ drv_nap, /* nap */
+ drv_kpad, /* kpad */
+ drv_keyok, /* kyOk */
+ drv_kyExist /* kyExist */
+};
diff --git a/contrib/ncurses/ncurses/tinfo/trim_sgr0.c b/contrib/ncurses/ncurses/tinfo/trim_sgr0.c
index 80c8f77fbebe..1f99208667ec 100644
--- a/contrib/ncurses/ncurses/tinfo/trim_sgr0.c
+++ b/contrib/ncurses/ncurses/tinfo/trim_sgr0.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2005-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 2005-2007,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -35,9 +35,8 @@
#include <ctype.h>
#include <tic.h>
-#include <term_entry.h>
-MODULE_ID("$Id: trim_sgr0.c,v 1.8 2007/04/07 17:14:11 tom Exp $")
+MODULE_ID("$Id: trim_sgr0.c,v 1.12 2010/12/25 23:03:57 tom Exp $")
#undef CUR
#define CUR tp->
@@ -100,8 +99,8 @@ rewrite_sgr(char *s, char *attr)
{
if (PRESENT(s)) {
if (PRESENT(attr)) {
- unsigned len_s = strlen(s);
- unsigned len_a = strlen(attr);
+ size_t len_s = strlen(s);
+ size_t len_a = strlen(attr);
if (len_s > len_a && !strncmp(attr, s, len_a)) {
unsigned n;
@@ -124,8 +123,8 @@ similar_sgr(char *a, char *b)
bool result = FALSE;
int csi_a = is_csi(a);
int csi_b = is_csi(b);
- unsigned len_a;
- unsigned len_b;
+ size_t len_a;
+ size_t len_b;
TR(TRACE_DATABASE, ("similar_sgr:\n\t%s\n\t%s",
_nc_visbuf2(1, a),
@@ -170,13 +169,13 @@ chop_out(char *string, unsigned i, unsigned j)
* Returns the number of chars from 'full' that we matched. If any mismatch
* occurs, return zero.
*/
-static int
+static unsigned
compare_part(const char *part, const char *full)
{
const char *next_part;
const char *next_full;
- int used_full = 0;
- int used_delay = 0;
+ unsigned used_full = 0;
+ unsigned used_delay = 0;
while (*part != 0) {
if (*part != *full) {
@@ -199,7 +198,7 @@ compare_part(const char *part, const char *full)
next_part = skip_delay(part);
next_full = skip_delay(full);
if (next_part != part && next_full != full) {
- used_delay += (next_full - full);
+ used_delay += (unsigned) (next_full - full);
full = next_full;
part = next_part;
continue;
@@ -261,10 +260,11 @@ _nc_trim_sgr0(TERMTYPE *tp)
k = strlen(exit_alt_charset_mode);
if (j > k) {
for (i = 0; i <= (j - k); ++i) {
- int k2 = compare_part(exit_alt_charset_mode, off + i);
+ unsigned k2 = compare_part(exit_alt_charset_mode,
+ off + i);
if (k2 != 0) {
found = TRUE;
- chop_out(off, i, i + k2);
+ chop_out(off, (unsigned) i, (unsigned) (i + k2));
break;
}
}
@@ -274,18 +274,18 @@ _nc_trim_sgr0(TERMTYPE *tp)
* SGR 10 would reset to normal font.
*/
if (!found) {
- if ((i = is_csi(off)) != 0
+ if ((i = (size_t) is_csi(off)) != 0
&& off[strlen(off) - 1] == 'm') {
TR(TRACE_DATABASE, ("looking for SGR 10 in %s",
_nc_visbuf(off)));
tmp = skip_zero(off + i);
if (tmp[0] == '1'
&& skip_zero(tmp + 1) != tmp + 1) {
- i = tmp - off;
+ i = (size_t) (tmp - off);
if (off[i - 1] == ';')
i--;
- j = skip_zero(tmp + 1) - off;
- i = chop_out(off, i, j);
+ j = (size_t) (skip_zero(tmp + 1) - off);
+ (void) chop_out(off, (unsigned) i, (unsigned) j);
found = TRUE;
}
}
@@ -293,10 +293,10 @@ _nc_trim_sgr0(TERMTYPE *tp)
if (!found
&& (tmp = strstr(end, off)) != 0
&& strcmp(end, off) != 0) {
- i = tmp - end;
+ i = (size_t) (tmp - end);
j = strlen(off);
tmp = strdup(end);
- chop_out(tmp, i, j);
+ chop_out(tmp, (unsigned) i, (unsigned) j);
free(off);
result = tmp;
}
diff --git a/contrib/ncurses/ncurses/tinfo/use_screen.c b/contrib/ncurses/ncurses/tinfo/use_screen.c
index 6c3b12fb9238..6a0297cebd51 100644
--- a/contrib/ncurses/ncurses/tinfo/use_screen.c
+++ b/contrib/ncurses/ncurses/tinfo/use_screen.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 2007-2008,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -32,7 +32,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: use_screen.c,v 1.6 2008/06/07 19:16:56 tom Exp $")
+MODULE_ID("$Id: use_screen.c,v 1.8 2009/10/24 22:40:20 tom Exp $")
NCURSES_EXPORT(int)
use_screen(SCREEN *screen, NCURSES_SCREEN_CB func, void *data)
@@ -40,14 +40,14 @@ use_screen(SCREEN *screen, NCURSES_SCREEN_CB func, void *data)
SCREEN *save_SP;
int code = OK;
- T((T_CALLED("use_screen(%p,%p,%p)"), screen, func, data));
+ T((T_CALLED("use_screen(%p,%p,%p)"), (void *) screen, func, (void *) 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(curses);
- save_SP = SP;
+ save_SP = CURRENT_SCREEN;
set_term(screen);
code = func(screen, data);
diff --git a/contrib/ncurses/ncurses/tinfo/write_entry.c b/contrib/ncurses/ncurses/tinfo/write_entry.c
index b53bb210230d..a86c11267e93 100644
--- a/contrib/ncurses/ncurses/tinfo/write_entry.c
+++ b/contrib/ncurses/ncurses/tinfo/write_entry.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -42,7 +42,6 @@
#include <sys/stat.h>
#include <tic.h>
-#include <term_entry.h>
#ifndef S_ISDIR
#define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR)
@@ -54,7 +53,7 @@
#define TRACE_OUT(p) /*nothing */
#endif
-MODULE_ID("$Id: write_entry.c,v 1.72 2008/08/03 19:24:00 tom Exp $")
+MODULE_ID("$Id: write_entry.c,v 1.78 2010/12/25 23:23:08 tom Exp $")
static int total_written;
@@ -137,10 +136,12 @@ make_db_path(char *dst, const char *src, unsigned limit)
if (_nc_is_dir_path(dst)) {
rc = -1;
} else {
+ static const char suffix[] = DBM_SUFFIX;
unsigned have = strlen(dst);
- if (have > 3 && strcmp(dst + have - 3, DBM_SUFFIX)) {
- if (have + 3 <= limit)
- strcat(dst, DBM_SUFFIX);
+ unsigned need = strlen(suffix);
+ if (have > need && strcmp(dst + have - need, suffix)) {
+ if (have + need <= limit)
+ strcat(dst, suffix);
else
rc = -1;
}
@@ -171,7 +172,11 @@ make_db_root(const char *path)
struct stat statbuf;
if ((rc = stat(path, &statbuf)) < 0) {
- rc = mkdir(path, 0777);
+ rc = mkdir(path
+#if !defined(__MINGW32__)
+ ,0777
+#endif
+ );
} else if (_nc_access(path, R_OK | W_OK | X_OK) < 0) {
rc = -1; /* permission denied */
} else if (!(S_ISDIR(statbuf.st_mode))) {
@@ -338,6 +343,7 @@ _nc_write_entry(TERMTYPE *const tp)
while (*other_names != '\0') {
ptr = other_names++;
+ assert(ptr < buffer + sizeof(buffer) - 1);
while (*other_names != '|' && *other_names != '\0')
other_names++;
@@ -357,7 +363,7 @@ _nc_write_entry(TERMTYPE *const tp)
start_time = 0;
}
- if (strlen(first_name) >= sizeof(filename) - 3)
+ if (strlen(first_name) >= sizeof(filename) - (2 + LEAF_LEN))
_nc_warning("terminal name too long.");
sprintf(filename, LEAF_FMT "/%s", first_name[0], first_name);
@@ -385,14 +391,13 @@ _nc_write_entry(TERMTYPE *const tp)
}
while (*other_names != '\0') {
ptr = other_names++;
- assert(ptr < buffer + sizeof(buffer) - 1);
while (*other_names != '|' && *other_names != '\0')
other_names++;
if (*other_names != '\0')
*(other_names++) = '\0';
- if (strlen(ptr) > sizeof(linkname) - 3) {
+ if (strlen(ptr) > sizeof(linkname) - (2 + LEAF_LEN)) {
_nc_warning("terminal alias %s too long.", ptr);
continue;
}
@@ -414,8 +419,12 @@ _nc_write_entry(TERMTYPE *const tp)
{
int code;
#if USE_SYMLINKS
- strcpy(symlinkname, "../");
- strncat(symlinkname, filename, sizeof(symlinkname) - 4);
+ if (first_name[0] == linkname[0])
+ strncpy(symlinkname, first_name, sizeof(symlinkname) - 1);
+ else {
+ strcpy(symlinkname, "../");
+ strncat(symlinkname, filename, sizeof(symlinkname) - 4);
+ }
symlinkname[sizeof(symlinkname) - 1] = '\0';
#endif /* USE_SYMLINKS */
#if HAVE_REMOVE
@@ -460,26 +469,26 @@ _nc_write_entry(TERMTYPE *const tp)
#endif /* USE_HASHED_DB */
}
-static unsigned
+static size_t
fake_write(char *dst,
unsigned *offset,
- unsigned limit,
+ size_t limit,
char *src,
- unsigned want,
- unsigned size)
+ size_t want,
+ size_t size)
{
- int have = (limit - *offset);
+ size_t have = (limit - *offset);
want *= size;
if (have > 0) {
- if ((int) want > have)
+ if (want > have)
want = have;
memcpy(dst + *offset, src, want);
- *offset += want;
+ *offset += (unsigned) want;
} else {
want = 0;
}
- return (int) (want / size);
+ return (want / size);
}
#define Write(buf, size, count) fake_write(buffer, offset, limit, (char *) buf, count, size)
@@ -487,15 +496,16 @@ fake_write(char *dst,
#undef LITTLE_ENDIAN /* BSD/OS defines this as a feature macro */
#define HI(x) ((x) / 256)
#define LO(x) ((x) % 256)
-#define LITTLE_ENDIAN(p, x) (p)[0] = LO(x), (p)[1] = HI(x)
+#define LITTLE_ENDIAN(p, x) (p)[0] = (unsigned char)LO(x), \
+ (p)[1] = (unsigned char)HI(x)
#define WRITE_STRING(str) (Write(str, sizeof(char), strlen(str) + 1) == strlen(str) + 1)
static int
-compute_offsets(char **Strings, unsigned strmax, short *offsets)
+compute_offsets(char **Strings, size_t strmax, short *offsets)
{
- size_t nextfree = 0;
- unsigned i;
+ int nextfree = 0;
+ size_t i;
for (i = 0; i < strmax; i++) {
if (Strings[i] == ABSENT_STRING) {
@@ -503,8 +513,8 @@ compute_offsets(char **Strings, unsigned strmax, short *offsets)
} else if (Strings[i] == CANCELLED_STRING) {
offsets[i] = -2;
} else {
- offsets[i] = nextfree;
- nextfree += strlen(Strings[i]) + 1;
+ offsets[i] = (short) nextfree;
+ nextfree += (int) strlen(Strings[i]) + 1;
TRACE_OUT(("put Strings[%d]=%s(%d)", (int) i,
_nc_visbuf(Strings[i]), (int) nextfree));
}
@@ -513,9 +523,9 @@ compute_offsets(char **Strings, unsigned strmax, short *offsets)
}
static void
-convert_shorts(unsigned char *buf, short *Numbers, unsigned count)
+convert_shorts(unsigned char *buf, short *Numbers, size_t count)
{
- unsigned i;
+ size_t i;
for (i = 0; i < count; i++) {
if (Numbers[i] == ABSENT_NUMERIC) { /* HI/LO won't work */
buf[2 * i] = buf[2 * i + 1] = 0377;
@@ -524,7 +534,7 @@ convert_shorts(unsigned char *buf, short *Numbers, unsigned count)
buf[2 * i + 1] = 0377;
} else {
LITTLE_ENDIAN(buf + 2 * i, Numbers[i]);
- TRACE_OUT(("put Numbers[%d]=%d", i, Numbers[i]));
+ TRACE_OUT(("put Numbers[%u]=%d", (unsigned) i, Numbers[i]));
}
}
}
@@ -536,8 +546,8 @@ convert_shorts(unsigned char *buf, short *Numbers, unsigned count)
static unsigned
extended_Booleans(TERMTYPE *tp)
{
- unsigned short result = 0;
- unsigned short i;
+ unsigned result = 0;
+ unsigned i;
for (i = 0; i < tp->ext_Booleans; ++i) {
if (tp->Booleans[BOOLCOUNT + i] == TRUE)
@@ -549,8 +559,8 @@ extended_Booleans(TERMTYPE *tp)
static unsigned
extended_Numbers(TERMTYPE *tp)
{
- unsigned short result = 0;
- unsigned short i;
+ unsigned result = 0;
+ unsigned i;
for (i = 0; i < tp->ext_Numbers; ++i) {
if (tp->Numbers[NUMCOUNT + i] != ABSENT_NUMERIC)
@@ -567,7 +577,7 @@ extended_Strings(TERMTYPE *tp)
for (i = 0; i < tp->ext_Strings; ++i) {
if (tp->Strings[STRCOUNT + i] != ABSENT_STRING)
- result = (i + 1);
+ result = (unsigned short) (i + 1);
}
return result;
}
@@ -597,7 +607,7 @@ write_object(TERMTYPE *tp, char *buffer, unsigned *offset, unsigned limit)
size_t namelen, boolmax, nummax, strmax;
char zero = '\0';
size_t i;
- short nextfree;
+ int nextfree;
short offsets[MAX_ENTRY_SIZE / 2];
unsigned char buf[MAX_ENTRY_SIZE];
unsigned last_bool = BOOLWRITE;
@@ -690,7 +700,7 @@ write_object(TERMTYPE *tp, char *buffer, unsigned *offset, unsigned limit)
#if NCURSES_XNAMES
if (extended_object(tp)) {
- unsigned extcnt = NUM_EXT_NAMES(tp);
+ unsigned extcnt = (unsigned) NUM_EXT_NAMES(tp);
if (even_boundary(nextfree))
return (ERR);
diff --git a/contrib/ncurses/ncurses/trace/lib_trace.c b/contrib/ncurses/ncurses/trace/lib_trace.c
index 743b1f64f1ae..a726901d4a3a 100644
--- a/contrib/ncurses/ncurses/trace/lib_trace.c
+++ b/contrib/ncurses/ncurses/trace/lib_trace.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer *
****************************************************************************/
/*
@@ -46,7 +47,7 @@
#include <ctype.h>
-MODULE_ID("$Id: lib_trace.c,v 1.71 2008/08/23 18:04:29 tom Exp $")
+MODULE_ID("$Id: lib_trace.c,v 1.76 2010/12/19 01:21:19 tom Exp $")
NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */
@@ -56,26 +57,26 @@ NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */
NCURSES_EXPORT(const char *)
NCURSES_PUBLIC_VAR(_nc_tputs_trace) (void)
{
- return SP ? SP->_tputs_trace : _nc_prescreen._tputs_trace;
+ return CURRENT_SCREEN ? CURRENT_SCREEN->_tputs_trace : _nc_prescreen._tputs_trace;
}
NCURSES_EXPORT(long)
NCURSES_PUBLIC_VAR(_nc_outchars) (void)
{
- return SP ? SP->_outchars : _nc_prescreen._outchars;
+ return CURRENT_SCREEN ? CURRENT_SCREEN->_outchars : _nc_prescreen._outchars;
}
NCURSES_EXPORT(void)
_nc_set_tputs_trace(const char *s)
{
- if (SP)
- SP->_tputs_trace = s;
+ if (CURRENT_SCREEN)
+ CURRENT_SCREEN->_tputs_trace = s;
else
_nc_prescreen._tputs_trace = s;
}
NCURSES_EXPORT(void)
_nc_count_outchars(long increment)
{
- if (SP)
- SP->_outchars += increment;
+ if (CURRENT_SCREEN)
+ CURRENT_SCREEN->_outchars += increment;
else
_nc_prescreen._outchars += increment;
}
@@ -95,7 +96,7 @@ trace(const unsigned int tracelevel)
const char *mode = _nc_globals.init_trace ? "ab" : "wb";
if (TracePath[0] == '\0') {
- int size = sizeof(TracePath) - 12;
+ size_t size = sizeof(TracePath) - 12;
if (getcwd(TracePath, size) == 0) {
perror("curses: Can't get working directory");
exit(EXIT_FAILURE);
@@ -121,7 +122,7 @@ trace(const unsigned int tracelevel)
*/
#if HAVE_SETVBUF /* ANSI */
(void) setvbuf(TraceFP, (char *) 0, _IOLBF, 0);
-#elif HAVE_SETBUF /* POSIX */
+#elif HAVE_SETBUF /* POSIX */
(void) setbuffer(TraceFP, (char *) 0);
#endif
_tracef("TRACING NCURSES version %s.%d (tracelevel=%#x)",
@@ -183,8 +184,12 @@ _nc_va_tracef(const char *fmt, va_list ap)
# if USE_WEAK_SYMBOLS
if ((pthread_self))
# endif
+#ifdef __MINGW32__
+ fprintf(TraceFP, "%#lx:", (long) (void *) pthread_self().p);
+#else
fprintf(TraceFP, "%#lx:", (long) (void *) pthread_self());
#endif
+#endif
if (before || after) {
int n;
for (n = 1; n < TraceLevel; n++)
@@ -219,6 +224,14 @@ _nc_retrace_bool(NCURSES_BOOL code)
return code;
}
+/* Trace 'char' return-values */
+NCURSES_EXPORT(char)
+_nc_retrace_char(char code)
+{
+ T((T_RETURN("%c"), code));
+ return code;
+}
+
/* Trace 'int' return-values */
NCURSES_EXPORT(int)
_nc_retrace_int(int code)
@@ -271,7 +284,7 @@ _nc_retrace_void_ptr(void *code)
NCURSES_EXPORT(SCREEN *)
_nc_retrace_sp(SCREEN *code)
{
- T((T_RETURN("%p"), code));
+ T((T_RETURN("%p"), (void *) code));
return code;
}
@@ -279,7 +292,7 @@ _nc_retrace_sp(SCREEN *code)
NCURSES_EXPORT(WINDOW *)
_nc_retrace_win(WINDOW *code)
{
- T((T_RETURN("%p"), code));
+ T((T_RETURN("%p"), (void *) code));
return code;
}
diff --git a/contrib/ncurses/ncurses/trace/lib_traceatr.c b/contrib/ncurses/ncurses/trace/lib_traceatr.c
index 45a03cea05fe..35ba0d3e6797 100644
--- a/contrib/ncurses/ncurses/trace/lib_traceatr.c
+++ b/contrib/ncurses/ncurses/trace/lib_traceatr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 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 *
@@ -30,6 +30,7 @@
* Author: Thomas Dickey 1996-on *
* and: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Juergen Pfeifer *
****************************************************************************/
/*
@@ -37,9 +38,12 @@
*/
#include <curses.priv.h>
-#include <term.h> /* acs_chars */
-MODULE_ID("$Id: lib_traceatr.c,v 1.63 2008/08/03 16:24:53 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_traceatr.c,v 1.74 2011/01/22 19:48:01 tom Exp $")
#define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name))
@@ -128,11 +132,11 @@ _traceattr2(int bufnum, chtype newmode)
for (n = 0; n < SIZEOF(names); n++) {
if ((newmode & names[n].val) != 0) {
if (result[1] != '\0')
- result = _nc_trace_bufcat(bufnum, "|");
+ (void) _nc_trace_bufcat(bufnum, "|");
result = _nc_trace_bufcat(bufnum, names[n].name);
if (names[n].val == A_COLOR) {
- short pairnum = PAIR_NUMBER(newmode);
+ short pairnum = (short) PairNumber(newmode);
#ifdef USE_TERMLIB
/* pair_content lives in libncurses */
(void) sprintf(temp, "{%d}", pairnum);
@@ -172,6 +176,14 @@ _traceattr(attr_t newmode)
}
/* Trace 'int' return-values */
+NCURSES_EXPORT(int)
+_nc_retrace_int_attr_t(attr_t code)
+{
+ T((T_RETURN("%s"), _traceattr(code)));
+ return (int) code;
+}
+
+/* Trace 'attr_t' return-values */
NCURSES_EXPORT(attr_t)
_nc_retrace_attr_t(attr_t code)
{
@@ -186,6 +198,9 @@ _nc_altcharset_name(attr_t attr, chtype ch)
unsigned int val;
const char *name;
} ALT_NAMES;
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = CURRENT_SCREEN;
+#endif
static const ALT_NAMES names[] =
{
{'l', "ACS_ULCORNER"}, /* upper left corner */
@@ -225,23 +240,26 @@ _nc_altcharset_name(attr_t attr, chtype ch)
const char *result = 0;
+#if NCURSES_SP_FUNCS
+ (void) sp;
+#endif
if ((attr & A_ALTCHARSET) && (acs_chars != 0)) {
char *cp;
char *found = 0;
- const ALT_NAMES *sp;
+ const ALT_NAMES *strp;
for (cp = acs_chars; cp[0] && cp[1]; cp += 2) {
- if (ChCharOf(cp[1]) == ChCharOf(ch)) {
+ if (ChCharOf(UChar(cp[1])) == ChCharOf(ch)) {
found = cp;
/* don't exit from loop - there may be redefinitions */
}
}
if (found != 0) {
- ch = ChCharOf(*found);
- for (sp = names; sp->val; sp++)
- if (sp->val == ch) {
- result = sp->name;
+ ch = ChCharOf(UChar(*found));
+ for (strp = names; strp->val; strp++)
+ if (strp->val == ch) {
+ result = strp->name;
break;
}
}
@@ -260,7 +278,9 @@ _tracechtype2(int bufnum, chtype ch)
if ((found = _nc_altcharset_name(ChAttrOf(ch), ch)) != 0) {
(void) _nc_trace_bufcat(bufnum, found);
} else
- (void) _nc_trace_bufcat(bufnum, _nc_tracechar(SP, (int) ChCharOf(ch)));
+ (void) _nc_trace_bufcat(bufnum,
+ _nc_tracechar(CURRENT_SCREEN,
+ (int) ChCharOf(ch)));
if (ChAttrOf(ch) != A_NORMAL) {
(void) _nc_trace_bufcat(bufnum, " | ");
@@ -313,14 +333,17 @@ _tracecchar_t2(int bufnum, const cchar_t *ch)
(void) _nc_trace_bufcat(bufnum, "{ ");
for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) {
PUTC_ch = ch->chars[PUTC_i];
- if (PUTC_ch == L'\0')
+ if (PUTC_ch == L'\0') {
+ if (PUTC_i == 0)
+ (void) _nc_trace_bufcat(bufnum, "\\000");
break;
- PUTC_n = wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st);
+ }
+ PUTC_n = (int) wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st);
if (PUTC_n <= 0) {
if (PUTC_ch != L'\0') {
/* it could not be a multibyte sequence */
(void) _nc_trace_bufcat(bufnum,
- _nc_tracechar(SP,
+ _nc_tracechar(CURRENT_SCREEN,
UChar(ch->chars[PUTC_i])));
}
break;
@@ -329,7 +352,7 @@ _tracecchar_t2(int bufnum, const cchar_t *ch)
if (n)
(void) _nc_trace_bufcat(bufnum, ", ");
(void) _nc_trace_bufcat(bufnum,
- _nc_tracechar(SP,
+ _nc_tracechar(CURRENT_SCREEN,
UChar(PUTC_buf[n])));
}
}
diff --git a/contrib/ncurses/ncurses/trace/lib_tracebits.c b/contrib/ncurses/ncurses/trace/lib_tracebits.c
index cc441b391e5b..d19d0e420acc 100644
--- a/contrib/ncurses/ncurses/trace/lib_tracebits.c
+++ b/contrib/ncurses/ncurses/trace/lib_tracebits.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2011 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,9 +33,8 @@
****************************************************************************/
#include <curses.priv.h>
-#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_tracebits.c,v 1.17 2008/08/03 16:09:26 tom Exp $")
+MODULE_ID("$Id: lib_tracebits.c,v 1.19 2011/01/09 00:23:03 tom Exp $")
#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
@@ -262,5 +261,5 @@ _nc_tracebits(void)
return _nc_trace_ttymode(&(cur_term->Nttyb));
}
#else
-EMPTY_MODULE(_nc_tracebits)
+EMPTY_MODULE(_nc_empty_lib_tracebits)
#endif /* TRACE */
diff --git a/contrib/ncurses/ncurses/trace/lib_tracechr.c b/contrib/ncurses/ncurses/trace/lib_tracechr.c
index 79cf03b4870c..a1f9f5aa2706 100644
--- a/contrib/ncurses/ncurses/trace/lib_tracechr.c
+++ b/contrib/ncurses/ncurses/trace/lib_tracechr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 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 <ctype.h>
-MODULE_ID("$Id: lib_tracechr.c,v 1.19 2008/08/03 15:39:29 tom Exp $")
+MODULE_ID("$Id: lib_tracechr.c,v 1.20 2009/04/18 22:48:29 tom Exp $")
#ifdef TRACE
@@ -52,7 +52,7 @@ _nc_tracechar(SCREEN *sp, int ch)
: _nc_globals.tracechr_buf);
if (ch > KEY_MIN || ch < 0) {
- name = _nc_keyname(sp, ch);
+ name = safe_keyname(SP_PARM, ch);
if (name == 0 || *name == '\0')
name = "NULL";
(void) sprintf(MyBuffer, "'%.30s' = %#03o", name, ch);
@@ -64,7 +64,7 @@ _nc_tracechar(SCREEN *sp, int ch)
*/
(void) sprintf(MyBuffer, "%#03o", ch);
} else {
- name = _nc_unctrl(sp, (chtype) ch);
+ name = safe_unctrl(SP_PARM, (chtype) ch);
if (name == 0 || *name == 0)
name = "null"; /* shouldn't happen */
(void) sprintf(MyBuffer, "'%.30s' = %#03o", name, ch);
@@ -75,7 +75,7 @@ _nc_tracechar(SCREEN *sp, int ch)
NCURSES_EXPORT(char *)
_tracechar(int ch)
{
- return _nc_tracechar(SP, ch);
+ return _nc_tracechar(CURRENT_SCREEN, ch);
}
#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 58732a06c246..c7fcbf2e0d56 100644
--- a/contrib/ncurses/ncurses/trace/lib_tracedmp.c
+++ b/contrib/ncurses/ncurses/trace/lib_tracedmp.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -39,7 +39,7 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_tracedmp.c,v 1.31 2008/08/16 19:30:56 tom Exp $")
+MODULE_ID("$Id: lib_tracedmp.c,v 1.32 2009/04/18 21:01:38 tom Exp $")
#ifdef TRACE
@@ -68,7 +68,7 @@ _tracedump(const char *name, WINDOW *win)
if (width < win->_maxx)
++width;
if (++width + 1 > (int) my_length) {
- my_length = 2 * (width + 1);
+ my_length = (unsigned) (2 * (width + 1));
my_buffer = typeRealloc(char, my_length, my_buffer);
}
@@ -82,7 +82,7 @@ _tracedump(const char *name, WINDOW *win)
* we map those to '.' and '?' respectively.
*/
for (j = 0; j < width; ++j) {
- chtype test = CharOf(win->_line[n].text[j]);
+ chtype test = (chtype) CharOf(win->_line[n].text[j]);
ep[j] = (char) ((UChar(test) == test
#if USE_WIDEC_SUPPORT
&& (win->_line[n].text[j].chars[1] == 0)
@@ -111,7 +111,7 @@ _tracedump(const char *name, WINDOW *win)
if (multicolumn) {
ep = my_buffer;
for (j = 0; j < width; ++j) {
- int test = WidecExt(win->_line[n].text[j]);
+ chtype test = WidecExt(win->_line[n].text[j]);
if (test) {
ep[j] = (char) (test + '0');
} else {
@@ -153,7 +153,7 @@ _tracedump(const char *name, WINDOW *win)
for (i = 0; i < 4; ++i) {
const char *hex = " 123456789ABCDEF";
- attr_t mask = (0xf << ((i + 4) * 4));
+ attr_t mask = (attr_t) (0xf << ((i + 4) * 4));
haveattrs = FALSE;
for (j = 0; j < width; ++j)
diff --git a/contrib/ncurses/ncurses/trace/lib_tracemse.c b/contrib/ncurses/ncurses/trace/lib_tracemse.c
index 74cc177d51bb..1afd15d2e785 100644
--- a/contrib/ncurses/ncurses/trace/lib_tracemse.c
+++ b/contrib/ncurses/ncurses/trace/lib_tracemse.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 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,23 +38,16 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_tracemse.c,v 1.15 2008/08/03 15:39:29 tom Exp $")
+MODULE_ID("$Id: lib_tracemse.c,v 1.18 2011/01/22 19:48:08 tom Exp $")
#ifdef TRACE
#define my_buffer sp->tracemse_buf
-NCURSES_EXPORT(char *)
-_nc_tracemouse(SCREEN *sp, MEVENT const *ep)
+static char *
+_trace_mmask_t(SCREEN *sp, mmask_t code)
{
- (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(my_buffer, s), ", ")
+#define SHOW(m, s) if ((code & m) == m) strcat(strcat(my_buffer, s), ", ")
SHOW(BUTTON1_RELEASED, "release-1");
SHOW(BUTTON1_PRESSED, "press-1");
@@ -110,14 +103,37 @@ _nc_tracemouse(SCREEN *sp, MEVENT const *ep)
if (my_buffer[strlen(my_buffer) - 1] == ' ')
my_buffer[strlen(my_buffer) - 2] = '\0';
+
+ return (my_buffer);
+}
+
+NCURSES_EXPORT(char *)
+_nc_tracemouse(SCREEN *sp, MEVENT const *ep)
+{
+ (void) sprintf(my_buffer, TRACEMSE_FMT,
+ ep->id,
+ ep->x,
+ ep->y,
+ ep->z,
+ (unsigned long) ep->bstate);
+
+ (void) _trace_mmask_t(sp, ep->bstate);
(void) strcat(my_buffer, "}");
return (my_buffer);
}
+NCURSES_EXPORT(mmask_t)
+_nc_retrace_mmask_t(SCREEN *sp, mmask_t code)
+{
+ *my_buffer = '\0';
+ T((T_RETURN("{%s}"), _trace_mmask_t(sp, code)));
+ return code;
+}
+
NCURSES_EXPORT(char *)
_tracemouse(MEVENT const *ep)
{
- return _nc_tracemouse(SP, ep);
+ return _nc_tracemouse(CURRENT_SCREEN, ep);
}
#else /* !TRACE */
diff --git a/contrib/ncurses/ncurses/trace/trace_buf.c b/contrib/ncurses/ncurses/trace/trace_buf.c
index 6345acc035fc..46baba4796b2 100644
--- a/contrib/ncurses/ncurses/trace/trace_buf.c
+++ b/contrib/ncurses/ncurses/trace/trace_buf.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 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,9 @@
#include <curses.priv.h>
-MODULE_ID("$Id: trace_buf.c,v 1.14 2008/08/03 15:13:56 tom Exp $")
+MODULE_ID("$Id: trace_buf.c,v 1.17 2011/01/22 19:48:16 tom Exp $")
+
+#ifdef TRACE
#define MyList _nc_globals.tracebuf_ptr
#define MySize _nc_globals.tracebuf_used
@@ -47,7 +49,7 @@ _nc_trace_alloc(int bufnum, size_t want)
if (bufnum >= 0) {
if ((size_t) (bufnum + 1) > MySize) {
- size_t need = (bufnum + 1) * 2;
+ size_t need = (size_t) (bufnum + 1) * 2;
if ((MyList = typeRealloc(TRACEBUF, need, MyList)) != 0) {
while (need > MySize)
MyList[MySize++].text = 0;
@@ -112,3 +114,6 @@ _nc_trace_bufcat(int bufnum, const char *value)
}
return buffer;
}
+#else
+EMPTY_MODULE(_nc_empty_trace_buf)
+#endif /* TRACE */
diff --git a/contrib/ncurses/ncurses/trace/trace_tries.c b/contrib/ncurses/ncurses/trace/trace_tries.c
index f813aba15825..d3380131ecac 100644
--- a/contrib/ncurses/ncurses/trace/trace_tries.c
+++ b/contrib/ncurses/ncurses/trace/trace_tries.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2009,2011 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> 1999 *
+ * Author: Thomas E. Dickey 1999 *
****************************************************************************/
/*
* trace_tries.c - Tracing/Debugging buffers (keycode tries-trees)
@@ -35,7 +35,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: trace_tries.c,v 1.13 2008/08/03 15:43:30 tom Exp $")
+MODULE_ID("$Id: trace_tries.c,v 1.16 2011/01/09 00:23:27 tom Exp $")
#ifdef TRACE
#define my_buffer _nc_globals.tracetry_buf
@@ -46,7 +46,7 @@ recur_tries(TRIES * tree, unsigned level)
{
if (level > my_length) {
my_length = (level + 1) * 4;
- my_buffer = (unsigned char *) realloc(my_buffer, my_length);
+ my_buffer = (unsigned char *) _nc_doalloc(my_buffer, my_length);
}
while (tree != 0) {
@@ -67,12 +67,12 @@ NCURSES_EXPORT(void)
_nc_trace_tries(TRIES * tree)
{
my_buffer = typeMalloc(unsigned char, my_length = 80);
- _tracef("BEGIN tries %p", tree);
+ _tracef("BEGIN tries %p", (void *) tree);
recur_tries(tree, 0);
- _tracef(". . . tries %p", tree);
+ _tracef(". . . tries %p", (void *) tree);
free(my_buffer);
}
#else
-EMPTY_MODULE(_nc_trace_tries)
+EMPTY_MODULE(_nc_empty_trace_tries)
#endif
diff --git a/contrib/ncurses/ncurses/trace/trace_xnames.c b/contrib/ncurses/ncurses/trace/trace_xnames.c
index 9b0b5920d814..38a48730ccdc 100644
--- a/contrib/ncurses/ncurses/trace/trace_xnames.c
+++ b/contrib/ncurses/ncurses/trace/trace_xnames.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2000,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -34,12 +34,11 @@
*/
#include <curses.priv.h>
-#include <term_entry.h>
-MODULE_ID("$Id: trace_xnames.c,v 1.5 2000/12/10 03:02:45 tom Exp $")
+MODULE_ID("$Id: trace_xnames.c,v 1.6 2010/01/23 17:59:27 tom Exp $")
NCURSES_EXPORT(void)
-_nc_trace_xnames(TERMTYPE * tp GCC_UNUSED)
+_nc_trace_xnames(TERMTYPE *tp GCC_UNUSED)
{
#ifdef TRACE
#if NCURSES_XNAMES
diff --git a/contrib/ncurses/ncurses/trace/varargs.c b/contrib/ncurses/ncurses/trace/varargs.c
index f4ee46710abb..541173d27459 100644
--- a/contrib/ncurses/ncurses/trace/varargs.c
+++ b/contrib/ncurses/ncurses/trace/varargs.c
@@ -34,7 +34,7 @@
#include <ctype.h>
-MODULE_ID("$Id: varargs.c,v 1.7 2008/08/03 15:42:49 tom Exp $")
+MODULE_ID("$Id: varargs.c,v 1.8 2008/11/16 00:19:59 juergen Exp $")
#ifdef TRACE
@@ -44,7 +44,7 @@ typedef enum {
atUnknown = 0, atInteger, atFloat, atPoint, atString
} ARGTYPE;
-#define VA_INT(type) ival = va_arg(ap, type)
+#define VA_INT(type) ival = (int) va_arg(ap, type)
#define VA_FLT(type) fval = va_arg(ap, type)
#define VA_PTR(type) pval = (char *)va_arg(ap, type)
#define VA_STR(type) sval = va_arg(ap, type)
diff --git a/contrib/ncurses/ncurses/trace/visbuf.c b/contrib/ncurses/ncurses/trace/visbuf.c
index bf9fb1472003..66da4f4beca3 100644
--- a/contrib/ncurses/ncurses/trace/visbuf.c
+++ b/contrib/ncurses/ncurses/trace/visbuf.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2001-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 2001-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -42,7 +42,9 @@
#include <tic.h>
#include <ctype.h>
-MODULE_ID("$Id: visbuf.c,v 1.32 2008/08/04 23:07:39 tom Exp $")
+MODULE_ID("$Id: visbuf.c,v 1.37 2010/05/29 18:51:41 tom Exp $")
+
+#define NUM_VISBUFS 4
#define NormalLen(len) (size_t) (((size_t)(len) + 1) * 4)
#define WideLen(len) (size_t) (((size_t)(len) + 1) * 4 * MB_CUR_MAX)
@@ -92,7 +94,7 @@ _nc_vischar(char *tp, unsigned c)
static const char *
_nc_visbuf2n(int bufnum, const char *buf, int len)
{
- const char *vbuf;
+ const char *vbuf = 0;
char *tp;
int c;
@@ -108,9 +110,16 @@ _nc_visbuf2n(int bufnum, const char *buf, int len)
vbuf = tp = _nc_trace_buf(bufnum, NormalLen(len));
#else
{
- static char *mybuf[4];
- mybuf[bufnum] = typeRealloc(char, NormalLen(len), mybuf[bufnum]);
- vbuf = tp = mybuf[bufnum];
+ static char *mybuf[NUM_VISBUFS];
+ if (bufnum < 0) {
+ for (c = 0; c < NUM_VISBUFS; ++c) {
+ FreeAndNull(mybuf[c]);
+ }
+ tp = 0;
+ } else {
+ mybuf[bufnum] = typeRealloc(char, NormalLen(len), mybuf[bufnum]);
+ vbuf = tp = mybuf[bufnum];
+ }
}
#endif
if (tp != 0) {
@@ -119,7 +128,7 @@ _nc_visbuf2n(int bufnum, const char *buf, int len)
tp = _nc_vischar(tp, UChar(c));
}
*tp++ = D_QUOTE;
- *tp++ = '\0';
+ *tp = '\0';
} else {
vbuf = ("(_nc_visbuf2n failed)");
}
@@ -177,7 +186,7 @@ _nc_viswbuf2n(int bufnum, const wchar_t *buf, int len)
vbuf = tp = _nc_trace_buf(bufnum, WideLen(len));
#else
{
- static char *mybuf[2];
+ static char *mybuf[NUM_VISBUFS];
mybuf[bufnum] = typeRealloc(char, WideLen(len), mybuf[bufnum]);
vbuf = tp = mybuf[bufnum];
}
@@ -196,7 +205,7 @@ _nc_viswbuf2n(int bufnum, const wchar_t *buf, int len)
}
}
*tp++ = D_QUOTE;
- *tp++ = '\0';
+ *tp = '\0';
} else {
vbuf = ("(_nc_viswbuf2n failed)");
}
@@ -229,7 +238,9 @@ _nc_viswibuf(const wint_t *buf)
static unsigned mylen;
unsigned n;
- for (n = 0; buf[n] != 0; ++n) ;
+ for (n = 0; buf[n] != 0; ++n) {
+ ; /* empty */
+ }
if (mylen < ++n) {
mylen = n + 80;
if (mybuf != 0)
@@ -237,8 +248,10 @@ _nc_viswibuf(const wint_t *buf)
else
mybuf = typeMalloc(wchar_t, mylen);
}
- for (n = 0; buf[n] != 0; ++n)
+ for (n = 0; buf[n] != 0; ++n) {
mybuf[n] = (wchar_t) buf[n];
+ }
+ mybuf[n] = L'\0';
return _nc_viswbuf2(0, mybuf);
}
@@ -274,12 +287,12 @@ _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);
+ (void) _nc_trace_bufcat(bufnum, l_brace);
+ (void) _nc_trace_bufcat(bufnum, d_quote);
for (j = first; j <= last; ++j) {
found = _nc_altcharset_name(attr, (chtype) CharOf(buf[j]));
if (found != 0) {
- result = _nc_trace_bufcat(bufnum, found);
+ (void) _nc_trace_bufcat(bufnum, found);
attr &= ~A_ALTCHARSET;
} else
#if USE_WIDEC_SUPPORT
@@ -291,15 +304,19 @@ _nc_viscbuf2(int bufnum, const NCURSES_CH_T * buf, int len)
int k;
PUTC_ch = buf[j].chars[PUTC_i];
- if (PUTC_ch == L'\0')
+ if (PUTC_ch == L'\0') {
+ if (PUTC_i == 0)
+ (void) _nc_trace_bufcat(bufnum, "\\000");
break;
- PUTC_n = (int) wcrtomb(PUTC_buf, buf[j].chars[PUTC_i], &PUT_st);
+ }
+ PUTC_n = (int) wcrtomb(PUTC_buf,
+ buf[j].chars[PUTC_i], &PUT_st);
if (PUTC_n <= 0)
break;
for (k = 0; k < PUTC_n; k++) {
char temp[80];
_nc_vischar(temp, UChar(PUTC_buf[k]));
- result = _nc_trace_bufcat(bufnum, temp);
+ (void) _nc_trace_bufcat(bufnum, temp);
}
}
}
@@ -311,10 +328,10 @@ _nc_viscbuf2(int bufnum, const NCURSES_CH_T * buf, int len)
}
#endif /* USE_WIDEC_SUPPORT */
}
- result = _nc_trace_bufcat(bufnum, d_quote);
+ (void) _nc_trace_bufcat(bufnum, d_quote);
if (attr != A_NORMAL) {
- result = _nc_trace_bufcat(bufnum, " | ");
- result = _nc_trace_bufcat(bufnum, _traceattr2(bufnum + 20, attr));
+ (void) _nc_trace_bufcat(bufnum, " | ");
+ (void) _nc_trace_bufcat(bufnum, _traceattr2(bufnum + 20, attr));
}
result = _nc_trace_bufcat(bufnum, r_brace);
first = last + 1;
diff --git a/contrib/ncurses/ncurses/tty/MKexpanded.sh b/contrib/ncurses/ncurses/tty/MKexpanded.sh
index bf9acf21aa43..7a5f5993c487 100755
--- a/contrib/ncurses/ncurses/tty/MKexpanded.sh
+++ b/contrib/ncurses/ncurses/tty/MKexpanded.sh
@@ -1,6 +1,6 @@
#! /bin/sh
##############################################################################
-# Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), #
@@ -27,9 +27,9 @@
# authorization. #
##############################################################################
#
-# Author: Thomas E. Dickey <dickey@clark.net> 1997
+# Author: Thomas E. Dickey, 1997-on
#
-# $Id: MKexpanded.sh,v 1.11 2005/01/02 01:06:40 tom Exp $
+# $Id: MKexpanded.sh,v 1.17 2010/01/23 17:57:43 tom Exp $
#
# Script to generate 'expanded.c', a dummy source that contains functions
# corresponding to complex macros used in this library. By making functions,
@@ -52,8 +52,13 @@ trap "rm -f $TMP" 0 1 2 5 15
cat <<EOF
/* generated by MKexpanded.sh */
+#define NEED_NCURSES_CH_T 1
#include <curses.priv.h>
-#include <term.h>
+
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
#if NCURSES_EXPANDED
EOF
@@ -68,29 +73,59 @@ cat >$TMP <<EOF
#undef FALSE
/* this is a marker */
IGNORE
-NCURSES_EXPORT(void) _nc_toggle_attr_on (attr_t *S, attr_t at)
+NCURSES_EXPORT(void)
+_nc_toggle_attr_on (attr_t *S, attr_t at)
{
toggle_attr_on(*S,at);
}
-NCURSES_EXPORT(void) _nc_toggle_attr_off (attr_t *S, attr_t at)
+
+NCURSES_EXPORT(void)
+_nc_toggle_attr_off (attr_t *S, attr_t at)
{
toggle_attr_off(*S,at);
}
-NCURSES_EXPORT(int) _nc_DelCharCost (int count)
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_DelCharCost) (NCURSES_SP_DCLx int count)
+{
+ return DelCharCost(SP_PARM, count);
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_InsCharCost) (NCURSES_SP_DCLx int count)
{
- return DelCharCost(count);
+ return InsCharCost(SP_PARM, count);
}
-NCURSES_EXPORT(int) _nc_InsCharCost (int count)
+
+NCURSES_EXPORT(void)
+NCURSES_SP_NAME(_nc_UpdateAttrs) (NCURSES_SP_DCLx CARG_CH_T c)
{
- return InsCharCost(count);
+ UpdateAttrs(SP_PARM, CHDEREF(c));
}
-NCURSES_EXPORT(void) _nc_UpdateAttrs (NCURSES_CH_T c)
+
+@if_NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+_nc_DelCharCost (int count)
+{
+ return NCURSES_SP_NAME(_nc_DelCharCost) (CURRENT_SCREEN, count);
+}
+
+NCURSES_EXPORT(int)
+_nc_InsCharCost (int count)
+{
+ return NCURSES_SP_NAME(_nc_InsCharCost)(CURRENT_SCREEN, count);
+}
+
+NCURSES_EXPORT(void)
+_nc_UpdateAttrs (CARG_CH_T c)
{
- UpdateAttrs(c);
+ NCURSES_SP_NAME(_nc_UpdateAttrs)(CURRENT_SCREEN,c);
}
+@endif
EOF
-$preprocessor $TMP 2>/dev/null | sed -e '1,/^IGNORE$/d'
+$preprocessor $TMP 2>/dev/null | \
+ sed -e '1,/^IGNORE$/d' -e 's/^@/#/' -e 's/^#if_/#if /'
cat <<EOF
#else /* ! NCURSES_EXPANDED */
diff --git a/contrib/ncurses/ncurses/tty/hardscroll.c b/contrib/ncurses/ncurses/tty/hardscroll.c
index 2c40997fb6b1..af68c961728d 100644
--- a/contrib/ncurses/ncurses/tty/hardscroll.c
+++ b/contrib/ncurses/ncurses/tty/hardscroll.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -147,90 +147,98 @@ AUTHOR
#include <curses.priv.h>
-MODULE_ID("$Id: hardscroll.c,v 1.42 2008/08/03 23:49:30 tom Exp $")
+MODULE_ID("$Id: hardscroll.c,v 1.47 2010/04/24 23:46:47 tom Exp $")
#if defined(SCROLLDEBUG) || defined(HASHDEBUG)
# undef screen_lines
-# define screen_lines MAXLINES
-NCURSES_EXPORT_VAR(int)
-oldnums[MAXLINES];
-# define OLDNUM(n) oldnums[n]
+# define screen_lines(sp) MAXLINES
+NCURSES_EXPORT_VAR (int)
+ oldnums[MAXLINES];
+# define OLDNUM(sp,n) oldnums[n]
# define _tracef printf
# undef TR
# define TR(n, a) if (_nc_tracing & (n)) { _tracef a ; putchar('\n'); }
-extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing;
+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; /* obsolete: keep for ABI compat */
+NCURSES_EXPORT_VAR (int *)
+ _nc_oldnums = 0; /* obsolete: keep for ABI compat */
# if USE_HASHMAP
-# define oldnums SP->_oldnum_list
-# define OLDNUM(n) oldnums[n]
+# define oldnums(sp) (sp)->_oldnum_list
+# define OLDNUM(sp,n) oldnums(sp)[n]
# else /* !USE_HASHMAP */
-# define OLDNUM(n) newscr->_line[n].oldindex
+# define OLDNUM(sp,n) NewScreen(sp)->_line[n].oldindex
# endif /* !USE_HASHMAP */
-#define OLDNUM_SIZE SP->_oldnum_size
+#define OLDNUM_SIZE(sp) (sp)->_oldnum_size
#endif /* defined(SCROLLDEBUG) || defined(HASHDEBUG) */
NCURSES_EXPORT(void)
-_nc_scroll_optimize(void)
+NCURSES_SP_NAME(_nc_scroll_optimize) (NCURSES_SP_DCL0)
/* scroll optimization to transform curscr to newscr */
{
int i;
int start, end, shift;
- TR(TRACE_ICALLS, (T_CALLED("_nc_scroll_optimize")));
+ TR(TRACE_ICALLS, (T_CALLED("_nc_scroll_optimize(%p)"), (void *) SP_PARM));
#if !defined(SCROLLDEBUG) && !defined(HASHDEBUG)
#if USE_HASHMAP
/* get enough storage */
- if (OLDNUM_SIZE < screen_lines) {
- int *new_oldnums = typeRealloc(int, screen_lines, oldnums);
+ if (OLDNUM_SIZE(SP_PARM) < screen_lines(SP_PARM)) {
+ int *new_oldnums = typeRealloc(int,
+ (size_t) screen_lines(SP_PARM),
+ oldnums(SP_PARM));
if (!new_oldnums)
return;
- oldnums = new_oldnums;
- OLDNUM_SIZE = screen_lines;
+ oldnums(SP_PARM) = new_oldnums;
+ OLDNUM_SIZE(SP_PARM) = screen_lines(SP_PARM);
}
/* calculate the indices */
- _nc_hash_map();
+ NCURSES_SP_NAME(_nc_hash_map) (NCURSES_SP_ARG);
#endif
#endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */
#ifdef TRACE
if (USE_TRACEF(TRACE_UPDATE | TRACE_MOVE)) {
- _nc_linedump();
+ NCURSES_SP_NAME(_nc_linedump) (NCURSES_SP_ARG);
_nc_unlock_global(tracef);
}
#endif /* TRACE */
/* pass 1 - from top to bottom scrolling up */
- for (i = 0; i < screen_lines;) {
- while (i < screen_lines && (OLDNUM(i) == _NEWINDEX || OLDNUM(i) <= i))
+ for (i = 0; i < screen_lines(SP_PARM);) {
+ while (i < screen_lines(SP_PARM)
+ && (OLDNUM(SP_PARM, i) == _NEWINDEX || OLDNUM(SP_PARM, i) <= i))
i++;
- if (i >= screen_lines)
+ if (i >= screen_lines(SP_PARM))
break;
- shift = OLDNUM(i) - i; /* shift > 0 */
+ shift = OLDNUM(SP_PARM, i) - i; /* shift > 0 */
start = i;
i++;
- while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i
- == shift)
+ while (i < screen_lines(SP_PARM)
+ && OLDNUM(SP_PARM, i) != _NEWINDEX
+ && OLDNUM(SP_PARM, i) - i == shift)
i++;
end = i - 1 + shift;
TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", start, end, shift));
#if !defined(SCROLLDEBUG) && !defined(HASHDEBUG)
- if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) {
+ if (NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_ARGx
+ shift,
+ start,
+ end,
+ screen_lines(SP_PARM) - 1) == ERR) {
TR(TRACE_UPDATE | TRACE_MOVE, ("unable to scroll"));
continue;
}
@@ -238,23 +246,33 @@ _nc_scroll_optimize(void)
}
/* pass 2 - from bottom to top scrolling down */
- for (i = screen_lines - 1; i >= 0;) {
- while (i >= 0 && (OLDNUM(i) == _NEWINDEX || OLDNUM(i) >= i))
+ for (i = screen_lines(SP_PARM) - 1; i >= 0;) {
+ while (i >= 0
+ && (OLDNUM(SP_PARM, i) == _NEWINDEX
+ || OLDNUM(SP_PARM, i) >= i)) {
i--;
+ }
if (i < 0)
break;
- shift = OLDNUM(i) - i; /* shift < 0 */
+ shift = OLDNUM(SP_PARM, i) - i; /* shift < 0 */
end = i;
i--;
- while (i >= 0 && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift)
+ while (i >= 0
+ && OLDNUM(SP_PARM, i) != _NEWINDEX
+ && OLDNUM(SP_PARM, i) - i == shift) {
i--;
+ }
start = i + 1 - (-shift);
TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", start, end, shift));
#if !defined(SCROLLDEBUG) && !defined(HASHDEBUG)
- if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) {
+ if (NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_ARGx
+ shift,
+ start,
+ end,
+ screen_lines(SP_PARM) - 1) == ERR) {
TR(TRACE_UPDATE | TRACE_MOVE, ("unable to scroll"));
continue;
}
@@ -263,24 +281,41 @@ _nc_scroll_optimize(void)
TR(TRACE_ICALLS, (T_RETURN("")));
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_scroll_optimize(void)
+{
+ NCURSES_SP_NAME(_nc_scroll_optimize) (CURRENT_SCREEN);
+}
+#endif
+
#if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG)
NCURSES_EXPORT(void)
-_nc_linedump(void)
+NCURSES_SP_NAME(_nc_linedump) (NCURSES_SP_DCL0)
/* dump the state of the real and virtual oldnum fields */
{
int n;
char *buf = 0;
- size_t want = (screen_lines + 1) * 4;
+ size_t want = ((size_t) screen_lines(SP_PARM) + 1) * 4;
if ((buf = typeMalloc(char, want)) != 0) {
- (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));
+ *buf = '\0';
+ for (n = 0; n < screen_lines(SP_PARM); n++)
+ (void) sprintf(buf + strlen(buf), " %02d", OLDNUM(SP_PARM, n));
+ TR(TRACE_UPDATE | TRACE_MOVE, ("virt %s", buf));
free(buf);
}
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_linedump(void)
+{
+ NCURSES_SP_NAME(_nc_linedump) (CURRENT_SCREEN);
+}
+#endif
+
#endif /* defined(TRACE) || defined(SCROLLDEBUG) */
#ifdef SCROLLDEBUG
diff --git a/contrib/ncurses/ncurses/tty/hashmap.c b/contrib/ncurses/ncurses/tty/hashmap.c
index 9b60df62d5cf..b670e1b9691f 100644
--- a/contrib/ncurses/ncurses/tty/hashmap.c
+++ b/contrib/ncurses/ncurses/tty/hashmap.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -68,9 +68,12 @@ AUTHOR
*****************************************************************************/
#include <curses.priv.h>
-#include <term.h> /* for back_color_erase */
-MODULE_ID("$Id: hashmap.c,v 1.56 2007/10/13 18:47:25 Miroslav.Lichvar Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: hashmap.c,v 1.62 2010/04/24 23:46:07 tom Exp $")
#ifdef HASHDEBUG
@@ -83,25 +86,25 @@ MODULE_ID("$Id: hashmap.c,v 1.56 2007/10/13 18:47:25 Miroslav.Lichvar Exp $")
int oldnums[MAXLINES], reallines[MAXLINES];
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]
-# define PENDING(n) 1
+# define OLDNUM(sp,n) oldnums[n]
+# define OLDTEXT(sp,n) oldtext[n]
+# define NEWTEXT(sp,m) newtext[m]
+# define PENDING(sp,n) 1
#else /* !HASHDEBUG */
-# 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)
-# define PENDING(n) (newscr->_line[n].firstchar != _NOCHANGE)
+# define OLDNUM(sp,n) (sp)->_oldnum_list[n]
+# define OLDTEXT(sp,n) CurScreen(sp)->_line[n].text
+# define NEWTEXT(sp,m) NewScreen(sp)->_line[m].text
+# define TEXTWIDTH(sp) (CurScreen(sp)->_maxx + 1)
+# define PENDING(sp,n) (NewScreen(sp)->_line[n].firstchar != _NOCHANGE)
#endif /* !HASHDEBUG */
-#define oldhash (SP->oldhash)
-#define newhash (SP->newhash)
-#define hashtab (SP->hashtab)
-#define lines_alloc (SP->hashtab_len)
+#define oldhash(sp) ((sp)->oldhash)
+#define newhash(sp) ((sp)->newhash)
+#define hashtab(sp) ((sp)->hashtab)
+#define lines_alloc(sp) ((sp)->hashtab_len)
#if USE_WIDEC_SUPPORT
#define HASH_VAL(ch) (ch.chars[0])
@@ -112,26 +115,26 @@ static NCURSES_CH_T newtext[MAXLINES][TEXTWIDTH];
static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT);
static NCURSES_INLINE unsigned long
-hash(NCURSES_CH_T * text)
+hash(SCREEN *sp, NCURSES_CH_T * text)
{
int i;
NCURSES_CH_T ch;
unsigned long result = 0;
- for (i = TEXTWIDTH; i > 0; i--) {
+ for (i = TEXTWIDTH(sp); i > 0; i--) {
ch = *text++;
- result += (result << 5) + HASH_VAL(ch);
+ result += (result << 5) + (unsigned long) HASH_VAL(ch);
}
return result;
}
/* approximate update cost */
static int
-update_cost(NCURSES_CH_T * from, NCURSES_CH_T * to)
+update_cost(SCREEN *sp, NCURSES_CH_T * from, NCURSES_CH_T * to)
{
int cost = 0;
int i;
- for (i = TEXTWIDTH; i > 0; i--, from++, to++)
+ for (i = TEXTWIDTH(sp); i > 0; i--, from++, to++)
if (!(CharEq(*from, *to)))
cost++;
@@ -139,7 +142,7 @@ update_cost(NCURSES_CH_T * from, NCURSES_CH_T * to)
}
static int
-update_cost_from_blank(NCURSES_CH_T * to)
+update_cost_from_blank(SCREEN *sp, NCURSES_CH_T * to)
{
int cost = 0;
int i;
@@ -148,7 +151,7 @@ update_cost_from_blank(NCURSES_CH_T * to)
if (back_color_erase)
SetPair(blank, GetPair(stdscr->_nc_bkgd));
- for (i = TEXTWIDTH; i > 0; i--, to++)
+ for (i = TEXTWIDTH(sp); i > 0; i--, to++)
if (!(CharEq(blank, *to)))
cost++;
@@ -160,14 +163,14 @@ update_cost_from_blank(NCURSES_CH_T * to)
* effective. 'blank' indicates whether the line 'to' would become blank.
*/
static NCURSES_INLINE bool
-cost_effective(const int from, const int to, const bool blank)
+cost_effective(SCREEN *sp, const int from, const int to, const bool blank)
{
int new_from;
if (from == to)
return FALSE;
- new_from = OLDNUM(from);
+ new_from = OLDNUM(sp, from);
if (new_from == _NEWINDEX)
new_from = from;
@@ -175,16 +178,17 @@ cost_effective(const int from, const int to, const bool blank)
* On the left side of >= is the cost before moving;
* on the right side -- cost after moving.
*/
- return (((blank ? update_cost_from_blank(NEWTEXT(to))
- : update_cost(OLDTEXT(to), NEWTEXT(to)))
- + update_cost(OLDTEXT(new_from), NEWTEXT(from)))
- >= ((new_from == from ? update_cost_from_blank(NEWTEXT(from))
- : update_cost(OLDTEXT(new_from), NEWTEXT(from)))
- + update_cost(OLDTEXT(from), NEWTEXT(to)))) ? TRUE : FALSE;
+ return (((blank ? update_cost_from_blank(sp, NEWTEXT(sp, to))
+ : update_cost(sp, OLDTEXT(sp, to), NEWTEXT(sp, to)))
+ + update_cost(sp, OLDTEXT(sp, new_from), NEWTEXT(sp, from)))
+ >= ((new_from == from ? update_cost_from_blank(sp, NEWTEXT(sp, from))
+ : update_cost(sp, OLDTEXT(sp, new_from), NEWTEXT(sp, from)))
+ + update_cost(sp, OLDTEXT(sp, from), NEWTEXT(sp, to))))
+ ? TRUE : FALSE;
}
static void
-grow_hunks(void)
+grow_hunks(SCREEN *sp)
{
int start, end, shift;
int back_limit, forward_limit; /* limits for cells to fill */
@@ -200,35 +204,36 @@ grow_hunks(void)
back_ref_limit = 0;
i = 0;
- while (i < screen_lines && OLDNUM(i) == _NEWINDEX)
+ while (i < screen_lines(sp) && OLDNUM(sp, i) == _NEWINDEX)
i++;
- for (; i < screen_lines; i = next_hunk) {
+ for (; i < screen_lines(sp); i = next_hunk) {
start = i;
- shift = OLDNUM(i) - i;
+ shift = OLDNUM(sp, i) - i;
/* get forward limit */
i = start + 1;
- while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i
- == shift)
+ while (i < screen_lines(sp)
+ && OLDNUM(sp, i) != _NEWINDEX
+ && OLDNUM(sp, i) - i == shift)
i++;
end = i;
- while (i < screen_lines && OLDNUM(i) == _NEWINDEX)
+ while (i < screen_lines(sp) && OLDNUM(sp, i) == _NEWINDEX)
i++;
next_hunk = i;
forward_limit = i;
- if (i >= screen_lines || OLDNUM(i) >= i)
+ if (i >= screen_lines(sp) || OLDNUM(sp, i) >= i)
forward_ref_limit = i;
else
- forward_ref_limit = OLDNUM(i);
+ forward_ref_limit = OLDNUM(sp, i);
i = start - 1;
/* grow back */
if (shift < 0)
back_limit = back_ref_limit + (-shift);
while (i >= back_limit) {
- if (newhash[i] == oldhash[i + shift]
- || cost_effective(i + shift, i, shift < 0)) {
- OLDNUM(i) = i + shift;
+ if (newhash(sp)[i] == oldhash(sp)[i + shift]
+ || cost_effective(sp, i + shift, i, shift < 0)) {
+ OLDNUM(sp, i) = i + shift;
TR(TRACE_UPDATE | TRACE_MOVE,
("connected new line %d to old line %d (backward continuation)",
i, i + shift));
@@ -246,9 +251,9 @@ grow_hunks(void)
if (shift > 0)
forward_limit = forward_ref_limit - shift;
while (i < forward_limit) {
- if (newhash[i] == oldhash[i + shift]
- || cost_effective(i + shift, i, shift > 0)) {
- OLDNUM(i) = i + shift;
+ if (newhash(sp)[i] == oldhash(sp)[i + shift]
+ || cost_effective(sp, i + shift, i, shift > 0)) {
+ OLDNUM(sp, i) = i + shift;
TR(TRACE_UPDATE | TRACE_MOVE,
("connected new line %d to old line %d (forward continuation)",
i, i + shift));
@@ -268,51 +273,54 @@ grow_hunks(void)
}
NCURSES_EXPORT(void)
-_nc_hash_map(void)
+NCURSES_SP_NAME(_nc_hash_map) (NCURSES_SP_DCL0)
{
- HASHMAP *sp;
+ HASHMAP *hsp;
register int i;
int start, shift, size;
- if (screen_lines > lines_alloc) {
- if (hashtab)
- free(hashtab);
- hashtab = typeMalloc(HASHMAP, (screen_lines + 1) * 2);
- if (!hashtab) {
- if (oldhash) {
- FreeAndNull(oldhash);
+ if (screen_lines(SP_PARM) > lines_alloc(SP_PARM)) {
+ if (hashtab(SP_PARM))
+ free(hashtab(SP_PARM));
+ hashtab(SP_PARM) = typeMalloc(HASHMAP,
+ ((size_t) screen_lines(SP_PARM) + 1) * 2);
+ if (!hashtab(SP_PARM)) {
+ if (oldhash(SP_PARM)) {
+ FreeAndNull(oldhash(SP_PARM));
}
- lines_alloc = 0;
+ lines_alloc(SP_PARM) = 0;
return;
}
- lines_alloc = screen_lines;
+ lines_alloc(SP_PARM) = screen_lines(SP_PARM);
}
- if (oldhash && newhash) {
+ if (oldhash(SP_PARM) && newhash(SP_PARM)) {
/* re-hash only changed lines */
- for (i = 0; i < screen_lines; i++) {
- if (PENDING(i))
- newhash[i] = hash(NEWTEXT(i));
+ for (i = 0; i < screen_lines(SP_PARM); i++) {
+ if (PENDING(SP_PARM, i))
+ newhash(SP_PARM)[i] = hash(SP_PARM, NEWTEXT(SP_PARM, i));
}
} else {
/* re-hash all */
- if (oldhash == 0)
- oldhash = typeCalloc(unsigned long, (unsigned) screen_lines);
- if (newhash == 0)
- newhash = typeCalloc(unsigned long, (unsigned) screen_lines);
- if (!oldhash || !newhash)
+ if (oldhash(SP_PARM) == 0)
+ oldhash(SP_PARM) = typeCalloc(unsigned long,
+ (size_t) screen_lines(SP_PARM));
+ if (newhash(SP_PARM) == 0)
+ newhash(SP_PARM) = typeCalloc(unsigned long,
+ (size_t) screen_lines(SP_PARM));
+ if (!oldhash(SP_PARM) || !newhash(SP_PARM))
return; /* malloc failure */
- for (i = 0; i < screen_lines; i++) {
- newhash[i] = hash(NEWTEXT(i));
- oldhash[i] = hash(OLDTEXT(i));
+ for (i = 0; i < screen_lines(SP_PARM); i++) {
+ newhash(SP_PARM)[i] = hash(SP_PARM, NEWTEXT(SP_PARM, i));
+ oldhash(SP_PARM)[i] = hash(SP_PARM, OLDTEXT(SP_PARM, i));
}
}
#ifdef HASH_VERIFY
- for (i = 0; i < screen_lines; i++) {
- if (newhash[i] != hash(NEWTEXT(i)))
+ for (i = 0; i < screen_lines(SP_PARM); i++) {
+ if (newhash(SP_PARM)[i] != hash(SP_PARM, NEWTEXT(SP_PARM, i)))
fprintf(stderr, "error in newhash[%d]\n", i);
- if (oldhash[i] != hash(OLDTEXT(i)))
+ if (oldhash(SP_PARM)[i] != hash(SP_PARM, OLDTEXT(SP_PARM, i)))
fprintf(stderr, "error in oldhash[%d]\n", i);
}
#endif
@@ -320,28 +328,30 @@ _nc_hash_map(void)
/*
* Set up and count line-hash values.
*/
- memset(hashtab, '\0', sizeof(*hashtab) * (screen_lines + 1) * 2);
- for (i = 0; i < screen_lines; i++) {
- unsigned long hashval = oldhash[i];
-
- for (sp = hashtab; sp->hashval; sp++)
- if (sp->hashval == hashval)
+ memset(hashtab(SP_PARM), '\0',
+ sizeof(*(hashtab(SP_PARM)))
+ * ((size_t) screen_lines(SP_PARM) + 1) * 2);
+ for (i = 0; i < screen_lines(SP_PARM); i++) {
+ unsigned long hashval = oldhash(SP_PARM)[i];
+
+ for (hsp = hashtab(SP_PARM); hsp->hashval; hsp++)
+ if (hsp->hashval == hashval)
break;
- sp->hashval = hashval; /* in case this is a new entry */
- sp->oldcount++;
- sp->oldindex = i;
+ hsp->hashval = hashval; /* in case this is a new entry */
+ hsp->oldcount++;
+ hsp->oldindex = i;
}
- for (i = 0; i < screen_lines; i++) {
- unsigned long hashval = newhash[i];
+ for (i = 0; i < screen_lines(SP_PARM); i++) {
+ unsigned long hashval = newhash(SP_PARM)[i];
- for (sp = hashtab; sp->hashval; sp++)
- if (sp->hashval == hashval)
+ for (hsp = hashtab(SP_PARM); hsp->hashval; hsp++)
+ if (hsp->hashval == hashval)
break;
- sp->hashval = hashval; /* in case this is a new entry */
- sp->newcount++;
- sp->newindex = i;
+ hsp->hashval = hashval; /* in case this is a new entry */
+ hsp->newcount++;
+ hsp->newindex = i;
- OLDNUM(i) = _NEWINDEX; /* initialize old indices array */
+ OLDNUM(SP_PARM, i) = _NEWINDEX; /* initialize old indices array */
}
/*
@@ -351,16 +361,16 @@ _nc_hash_map(void)
* extending hunks by cost_effective. Otherwise, it does not
* have any side effects.
*/
- for (sp = hashtab; sp->hashval; sp++)
- if (sp->oldcount == 1 && sp->newcount == 1
- && sp->oldindex != sp->newindex) {
+ for (hsp = hashtab(SP_PARM); hsp->hashval; hsp++)
+ if (hsp->oldcount == 1 && hsp->newcount == 1
+ && hsp->oldindex != hsp->newindex) {
TR(TRACE_UPDATE | TRACE_MOVE,
("new line %d is hash-identical to old line %d (unique)",
- sp->newindex, sp->oldindex));
- OLDNUM(sp->newindex) = sp->oldindex;
+ hsp->newindex, hsp->oldindex));
+ OLDNUM(SP_PARM, hsp->newindex) = hsp->oldindex;
}
- grow_hunks();
+ grow_hunks(SP_PARM);
/*
* Eliminate bad or impossible shifts -- this includes removing
@@ -368,58 +378,83 @@ _nc_hash_map(void)
* those which are to be moved too far, they are likely to destroy
* more than carry.
*/
- for (i = 0; i < screen_lines;) {
- while (i < screen_lines && OLDNUM(i) == _NEWINDEX)
+ for (i = 0; i < screen_lines(SP_PARM);) {
+ while (i < screen_lines(SP_PARM) && OLDNUM(SP_PARM, i) == _NEWINDEX)
i++;
- if (i >= screen_lines)
+ if (i >= screen_lines(SP_PARM))
break;
start = i;
- shift = OLDNUM(i) - i;
+ shift = OLDNUM(SP_PARM, i) - i;
i++;
- while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i
- == shift)
+ while (i < screen_lines(SP_PARM)
+ && OLDNUM(SP_PARM, i) != _NEWINDEX
+ && OLDNUM(SP_PARM, i) - i == shift)
i++;
size = i - start;
if (size < 3 || size + min(size / 8, 2) < abs(shift)) {
while (start < i) {
- OLDNUM(start) = _NEWINDEX;
+ OLDNUM(SP_PARM, start) = _NEWINDEX;
start++;
}
}
}
/* After clearing invalid hunks, try grow the rest. */
- grow_hunks();
+ grow_hunks(SP_PARM);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_hash_map(void)
+{
+ NCURSES_SP_NAME(_nc_hash_map) (CURRENT_SCREEN);
+}
+#endif
+
+NCURSES_EXPORT(void)
+NCURSES_SP_NAME(_nc_make_oldhash) (NCURSES_SP_DCLx int i)
+{
+ if (oldhash(SP_PARM))
+ oldhash(SP_PARM)[i] = hash(SP_PARM, OLDTEXT(SP_PARM, i));
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(void)
_nc_make_oldhash(int i)
{
- if (oldhash)
- oldhash[i] = hash(OLDTEXT(i));
+ NCURSES_SP_NAME(_nc_make_oldhash) (CURRENT_SCREEN, i);
}
+#endif
NCURSES_EXPORT(void)
-_nc_scroll_oldhash(int n, int top, int bot)
+NCURSES_SP_NAME(_nc_scroll_oldhash) (NCURSES_SP_DCLx int n, int top, int bot)
{
size_t size;
int i;
- if (!oldhash)
+ if (!oldhash(SP_PARM))
return;
- size = sizeof(*oldhash) * (bot - top + 1 - abs(n));
+ size = sizeof(*(oldhash(SP_PARM))) * (size_t) (bot - top + 1 - abs(n));
if (n > 0) {
- memmove(oldhash + top, oldhash + top + n, size);
+ memmove(oldhash(SP_PARM) + top, oldhash(SP_PARM) + top + n, size);
for (i = bot; i > bot - n; i--)
- oldhash[i] = hash(OLDTEXT(i));
+ oldhash(SP_PARM)[i] = hash(SP_PARM, OLDTEXT(SP_PARM, i));
} else {
- memmove(oldhash + top - n, oldhash + top, size);
+ memmove(oldhash(SP_PARM) + top - n, oldhash(SP_PARM) + top, size);
for (i = top; i < top - n; i++)
- oldhash[i] = hash(OLDTEXT(i));
+ oldhash(SP_PARM)[i] = hash(SP_PARM, OLDTEXT(SP_PARM, i));
}
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_scroll_oldhash(int n, int top, int bot)
+{
+ NCURSES_SP_NAME(_nc_scroll_oldhash) (CURRENT_SCREEN, n, top, bot);
+}
+#endif
+
#ifdef HASHDEBUG
static void
usage(void)
diff --git a/contrib/ncurses/ncurses/tty/lib_mvcur.c b/contrib/ncurses/ncurses/tty/lib_mvcur.c
index 8e66fa3bf64c..ad41f8dd72d8 100644
--- a/contrib/ncurses/ncurses/tty/lib_mvcur.c
+++ b/contrib/ncurses/ncurses/tty/lib_mvcur.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 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 *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -109,8 +110,8 @@
* LONG_DIST and (b) further inward from the right or left edge than LONG_DIST,
* we'll consider nonlocal.
*/
-#define NOT_LOCAL(fy, fx, ty, tx) ((tx > LONG_DIST) \
- && (tx < screen_columns - 1 - LONG_DIST) \
+#define NOT_LOCAL(sp, fy, fx, ty, tx) ((tx > LONG_DIST) \
+ && (tx < screen_columns(sp) - 1 - LONG_DIST) \
&& (abs(ty-fy) + abs(tx-fx) > LONG_DIST))
/****************************************************************************
@@ -152,13 +153,21 @@
*/
#include <curses.priv.h>
-#include <term.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_mvcur.c,v 1.113 2008/08/16 19:30:58 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_mvcur.c,v 1.126 2011/01/22 19:48:21 tom Exp $")
+
+#define WANT_CHAR(sp, y, x) NewScreen(sp)->_line[y].text[x] /* desired state */
-#define WANT_CHAR(y, x) SP->_newscr->_line[y].text[x] /* desired state */
-#define BAUDRATE cur_term->_baudrate /* bits per second */
+#if NCURSES_SP_FUNCS
+#define BAUDRATE(sp) sp->_term->_baudrate /* bits per second */
+#else
+#define BAUDRATE(sp) cur_term->_baudrate /* bits per second */
+#endif
#if defined(MAIN) || defined(NCURSES_TEST)
#include <sys/time.h>
@@ -169,7 +178,7 @@ static float diff;
#define OPT_SIZE 512
-static int normalized_cost(const char *const cap, int affcnt);
+static int normalized_cost(NCURSES_SP_DCLx const char *const cap, int affcnt);
/****************************************************************************
*
@@ -179,34 +188,34 @@ static int normalized_cost(const char *const cap, int affcnt);
#ifdef TRACE
static int
-trace_cost_of(const char *capname, const char *cap, int affcnt)
+trace_cost_of(NCURSES_SP_DCLx const char *capname, const char *cap, int affcnt)
{
- int result = _nc_msec_cost(cap, affcnt);
+ int result = NCURSES_SP_NAME(_nc_msec_cost) (NCURSES_SP_ARGx cap, affcnt);
TR(TRACE_CHARPUT | TRACE_MOVE,
("CostOf %s %d %s", capname, result, _nc_visbuf(cap)));
return result;
}
-#define CostOf(cap,affcnt) trace_cost_of(#cap,cap,affcnt);
+#define CostOf(cap,affcnt) trace_cost_of(NCURSES_SP_ARGx #cap, cap, affcnt)
static int
-trace_normalized_cost(const char *capname, const char *cap, int affcnt)
+trace_normalized_cost(NCURSES_SP_DCLx const char *capname, const char *cap, int affcnt)
{
- int result = normalized_cost(cap, affcnt);
+ int result = normalized_cost(NCURSES_SP_ARGx cap, affcnt);
TR(TRACE_CHARPUT | TRACE_MOVE,
("NormalizedCost %s %d %s", capname, result, _nc_visbuf(cap)));
return result;
}
-#define NormalizedCost(cap,affcnt) trace_normalized_cost(#cap,cap,affcnt);
+#define NormalizedCost(cap,affcnt) trace_normalized_cost(NCURSES_SP_ARGx #cap, cap, affcnt)
#else
-#define CostOf(cap,affcnt) _nc_msec_cost(cap,affcnt);
-#define NormalizedCost(cap,affcnt) normalized_cost(cap,affcnt);
+#define CostOf(cap,affcnt) NCURSES_SP_NAME(_nc_msec_cost)(NCURSES_SP_ARGx cap, affcnt)
+#define NormalizedCost(cap,affcnt) normalized_cost(NCURSES_SP_ARGx cap, affcnt)
#endif
NCURSES_EXPORT(int)
-_nc_msec_cost(const char *const cap, int affcnt)
+NCURSES_SP_NAME(_nc_msec_cost) (NCURSES_SP_DCLx const char *const cap, int affcnt)
/* compute the cost of a given operation */
{
if (cap == 0)
@@ -222,53 +231,68 @@ _nc_msec_cost(const char *const cap, int affcnt)
for (cp += 2; *cp != '>'; cp++) {
if (isdigit(UChar(*cp)))
- number = number * 10 + (*cp - '0');
+ number = number * 10 + (float) (*cp - '0');
else if (*cp == '*')
- number *= affcnt;
+ number *= (float) affcnt;
else if (*cp == '.' && (*++cp != '>') && isdigit(UChar(*cp)))
- number += (*cp - '0') / 10.0;
+ number += (float) ((*cp - '0') / 10.0);
}
#if NCURSES_NO_PADDING
- if (!GetNoPadding(SP))
+ if (!GetNoPadding(SP_PARM))
#endif
cum_cost += number * 10;
- } else
- cum_cost += SP->_char_padding;
+ } else if (SP_PARM) {
+ cum_cost += (float) SP_PARM->_char_padding;
+ }
}
return ((int) cum_cost);
}
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+_nc_msec_cost(const char *const cap, int affcnt)
+{
+ return NCURSES_SP_NAME(_nc_msec_cost) (CURRENT_SCREEN, cap, affcnt);
+}
+#endif
+
static int
-normalized_cost(const char *const cap, int affcnt)
+normalized_cost(NCURSES_SP_DCLx const char *const cap, int affcnt)
/* compute the effective character-count for an operation (round up) */
{
- int cost = _nc_msec_cost(cap, affcnt);
+ int cost = NCURSES_SP_NAME(_nc_msec_cost) (NCURSES_SP_ARGx cap, affcnt);
if (cost != INFINITY)
- cost = (cost + SP->_char_padding - 1) / SP->_char_padding;
+ cost = (cost + SP_PARM->_char_padding - 1) / SP_PARM->_char_padding;
return cost;
}
static void
-reset_scroll_region(void)
+reset_scroll_region(NCURSES_SP_DCL0)
/* Set the scroll-region to a known state (the default) */
{
if (change_scroll_region) {
- TPUTS_TRACE("change_scroll_region");
- putp(TPARM_2(change_scroll_region, 0, screen_lines - 1));
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+ "change_scroll_region",
+ TPARM_2(change_scroll_region,
+ 0, screen_lines(SP_PARM) - 1));
}
}
NCURSES_EXPORT(void)
-_nc_mvcur_resume(void)
+NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_DCL0)
/* what to do at initialization time and after each shellout */
{
+ if (SP_PARM && !IsTermInfo(SP_PARM))
+ return;
+
/* initialize screen for cursor access */
if (enter_ca_mode) {
- TPUTS_TRACE("enter_ca_mode");
- putp(enter_ca_mode);
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+ "enter_ca_mode",
+ enter_ca_mode);
}
/*
@@ -280,53 +304,63 @@ _nc_mvcur_resume(void)
* they know the screen size. This is useful when you're running
* a vt100 emulation through xterm.
*/
- reset_scroll_region();
- SP->_cursrow = SP->_curscol = -1;
+ reset_scroll_region(NCURSES_SP_ARG);
+ SP_PARM->_cursrow = SP_PARM->_curscol = -1;
/* restore cursor shape */
- if (SP->_cursor != -1) {
- int cursor = SP->_cursor;
- SP->_cursor = -1;
- curs_set(cursor);
+ if (SP_PARM->_cursor != -1) {
+ int cursor = SP_PARM->_cursor;
+ SP_PARM->_cursor = -1;
+ NCURSES_SP_NAME(curs_set) (NCURSES_SP_ARGx cursor);
}
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(void)
-_nc_mvcur_init(void)
+_nc_mvcur_resume(void)
+{
+ NCURSES_SP_NAME(_nc_mvcur_resume) (CURRENT_SCREEN);
+}
+#endif
+
+NCURSES_EXPORT(void)
+NCURSES_SP_NAME(_nc_mvcur_init) (NCURSES_SP_DCL0)
/* initialize the cost structure */
{
- if (isatty(fileno(SP->_ofp)))
- SP->_char_padding = ((BAUDBYTE * 1000 * 10)
- / (BAUDRATE > 0 ? BAUDRATE : 9600));
+ if (SP_PARM->_ofp && isatty(fileno(SP_PARM->_ofp)))
+ SP_PARM->_char_padding = ((BAUDBYTE * 1000 * 10)
+ / (BAUDRATE(SP_PARM) > 0
+ ? BAUDRATE(SP_PARM)
+ : 9600));
else
- SP->_char_padding = 1; /* must be nonzero */
- if (SP->_char_padding <= 0)
- SP->_char_padding = 1; /* must be nonzero */
- TR(TRACE_CHARPUT | TRACE_MOVE, ("char_padding %d msecs", SP->_char_padding));
+ SP_PARM->_char_padding = 1; /* must be nonzero */
+ if (SP_PARM->_char_padding <= 0)
+ SP_PARM->_char_padding = 1; /* must be nonzero */
+ TR(TRACE_CHARPUT | TRACE_MOVE, ("char_padding %d msecs", SP_PARM->_char_padding));
/* non-parameterized local-motion strings */
- SP->_cr_cost = CostOf(carriage_return, 0);
- SP->_home_cost = CostOf(cursor_home, 0);
- SP->_ll_cost = CostOf(cursor_to_ll, 0);
+ SP_PARM->_cr_cost = CostOf(carriage_return, 0);
+ SP_PARM->_home_cost = CostOf(cursor_home, 0);
+ SP_PARM->_ll_cost = CostOf(cursor_to_ll, 0);
#if USE_HARD_TABS
if (getenv("NCURSES_NO_HARD_TABS") == 0) {
- SP->_ht_cost = CostOf(tab, 0);
- SP->_cbt_cost = CostOf(back_tab, 0);
+ SP_PARM->_ht_cost = CostOf(tab, 0);
+ SP_PARM->_cbt_cost = CostOf(back_tab, 0);
} else {
- SP->_ht_cost = INFINITY;
- SP->_cbt_cost = INFINITY;
+ SP_PARM->_ht_cost = INFINITY;
+ SP_PARM->_cbt_cost = INFINITY;
}
#endif /* USE_HARD_TABS */
- SP->_cub1_cost = CostOf(cursor_left, 0);
- SP->_cuf1_cost = CostOf(cursor_right, 0);
- SP->_cud1_cost = CostOf(cursor_down, 0);
- SP->_cuu1_cost = CostOf(cursor_up, 0);
-
- SP->_smir_cost = CostOf(enter_insert_mode, 0);
- SP->_rmir_cost = CostOf(exit_insert_mode, 0);
- SP->_ip_cost = 0;
+ SP_PARM->_cub1_cost = CostOf(cursor_left, 0);
+ SP_PARM->_cuf1_cost = CostOf(cursor_right, 0);
+ SP_PARM->_cud1_cost = CostOf(cursor_down, 0);
+ SP_PARM->_cuu1_cost = CostOf(cursor_up, 0);
+
+ SP_PARM->_smir_cost = CostOf(enter_insert_mode, 0);
+ SP_PARM->_rmir_cost = CostOf(exit_insert_mode, 0);
+ SP_PARM->_ip_cost = 0;
if (insert_padding) {
- SP->_ip_cost = CostOf(insert_padding, 0);
+ SP_PARM->_ip_cost = CostOf(insert_padding, 0);
}
/*
@@ -335,7 +369,7 @@ _nc_mvcur_init(void)
* can treat it like absolute screen addressing. This seems to be true
* for all cursor_mem_address terminal types in the terminfo database.
*/
- SP->_address_cursor = cursor_address ? cursor_address : cursor_mem_address;
+ SP_PARM->_address_cursor = cursor_address ? cursor_address : cursor_mem_address;
/*
* Parametrized local-motion strings. This static cost computation
@@ -361,40 +395,43 @@ _nc_mvcur_init(void)
* All these averages depend on the assumption that all parameter values
* are equally probable.
*/
- SP->_cup_cost = CostOf(TPARM_2(SP->_address_cursor, 23, 23), 1);
- SP->_cub_cost = CostOf(TPARM_1(parm_left_cursor, 23), 1);
- SP->_cuf_cost = CostOf(TPARM_1(parm_right_cursor, 23), 1);
- SP->_cud_cost = CostOf(TPARM_1(parm_down_cursor, 23), 1);
- SP->_cuu_cost = CostOf(TPARM_1(parm_up_cursor, 23), 1);
- SP->_hpa_cost = CostOf(TPARM_1(column_address, 23), 1);
- SP->_vpa_cost = CostOf(TPARM_1(row_address, 23), 1);
+ SP_PARM->_cup_cost = CostOf(TPARM_2(SP_PARM->_address_cursor, 23, 23), 1);
+ SP_PARM->_cub_cost = CostOf(TPARM_1(parm_left_cursor, 23), 1);
+ SP_PARM->_cuf_cost = CostOf(TPARM_1(parm_right_cursor, 23), 1);
+ SP_PARM->_cud_cost = CostOf(TPARM_1(parm_down_cursor, 23), 1);
+ SP_PARM->_cuu_cost = CostOf(TPARM_1(parm_up_cursor, 23), 1);
+ SP_PARM->_hpa_cost = CostOf(TPARM_1(column_address, 23), 1);
+ SP_PARM->_vpa_cost = CostOf(TPARM_1(row_address, 23), 1);
/* non-parameterized screen-update strings */
- SP->_ed_cost = NormalizedCost(clr_eos, 1);
- SP->_el_cost = NormalizedCost(clr_eol, 1);
- SP->_el1_cost = NormalizedCost(clr_bol, 1);
- SP->_dch1_cost = NormalizedCost(delete_character, 1);
- SP->_ich1_cost = NormalizedCost(insert_character, 1);
+ SP_PARM->_ed_cost = NormalizedCost(clr_eos, 1);
+ SP_PARM->_el_cost = NormalizedCost(clr_eol, 1);
+ SP_PARM->_el1_cost = NormalizedCost(clr_bol, 1);
+ SP_PARM->_dch1_cost = NormalizedCost(delete_character, 1);
+ SP_PARM->_ich1_cost = NormalizedCost(insert_character, 1);
/*
* If this is a bce-terminal, we want to bias the choice so we use clr_eol
* rather than spaces at the end of a line.
*/
if (back_color_erase)
- SP->_el_cost = 0;
+ SP_PARM->_el_cost = 0;
/* parameterized screen-update strings */
- SP->_dch_cost = NormalizedCost(TPARM_1(parm_dch, 23), 1);
- SP->_ich_cost = NormalizedCost(TPARM_1(parm_ich, 23), 1);
- SP->_ech_cost = NormalizedCost(TPARM_1(erase_chars, 23), 1);
- SP->_rep_cost = NormalizedCost(TPARM_2(repeat_char, ' ', 23), 1);
-
- SP->_cup_ch_cost = NormalizedCost(TPARM_2(SP->_address_cursor, 23, 23), 1);
- SP->_hpa_ch_cost = NormalizedCost(TPARM_1(column_address, 23), 1);
- SP->_cuf_ch_cost = NormalizedCost(TPARM_1(parm_right_cursor, 23), 1);
- SP->_inline_cost = min(SP->_cup_ch_cost,
- min(SP->_hpa_ch_cost,
- SP->_cuf_ch_cost));
+ SP_PARM->_dch_cost = NormalizedCost(TPARM_1(parm_dch, 23), 1);
+ SP_PARM->_ich_cost = NormalizedCost(TPARM_1(parm_ich, 23), 1);
+ SP_PARM->_ech_cost = NormalizedCost(TPARM_1(erase_chars, 23), 1);
+ SP_PARM->_rep_cost = NormalizedCost(TPARM_2(repeat_char, ' ', 23), 1);
+
+ SP_PARM->_cup_ch_cost = NormalizedCost(
+ TPARM_2(SP_PARM->_address_cursor,
+ 23, 23),
+ 1);
+ SP_PARM->_hpa_ch_cost = NormalizedCost(TPARM_1(column_address, 23), 1);
+ SP_PARM->_cuf_ch_cost = NormalizedCost(TPARM_1(parm_right_cursor, 23), 1);
+ SP_PARM->_inline_cost = min(SP_PARM->_cup_ch_cost,
+ min(SP_PARM->_hpa_ch_cost,
+ SP_PARM->_cuf_ch_cost));
/*
* If save_cursor is used within enter_ca_mode, we should not use it for
@@ -411,30 +448,42 @@ _nc_mvcur_init(void)
}
/*
- * A different, possibly better way to arrange this would be to set
- * SP->_endwin = TRUE at window initialization time and let this be
+ * A different, possibly better way to arrange this would be to set the
+ * SCREEN's _endwin to TRUE at window initialization time and let this be
* called by doupdate's return-from-shellout code.
*/
- _nc_mvcur_resume();
+ NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_ARG);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(void)
-_nc_mvcur_wrap(void)
+_nc_mvcur_init(void)
+{
+ NCURSES_SP_NAME(_nc_mvcur_init) (CURRENT_SCREEN);
+}
+#endif
+
+NCURSES_EXPORT(void)
+NCURSES_SP_NAME(_nc_mvcur_wrap) (NCURSES_SP_DCL0)
/* wrap up cursor-addressing mode */
{
/* leave cursor at screen bottom */
- mvcur(-1, -1, screen_lines - 1, 0);
+ TINFO_MVCUR(NCURSES_SP_ARGx -1, -1, screen_lines(SP_PARM) - 1, 0);
+
+ if (!SP_PARM || !IsTermInfo(SP_PARM))
+ return;
/* set cursor to normal mode */
- if (SP->_cursor != -1) {
- int cursor = SP->_cursor;
- curs_set(1);
- SP->_cursor = cursor;
+ if (SP_PARM->_cursor != -1) {
+ int cursor = SP_PARM->_cursor;
+ NCURSES_SP_NAME(curs_set) (NCURSES_SP_ARGx 1);
+ SP_PARM->_cursor = cursor;
}
if (exit_ca_mode) {
- TPUTS_TRACE("exit_ca_mode");
- putp(exit_ca_mode);
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+ "exit_ca_mode",
+ exit_ca_mode);
}
/*
* Reset terminal's tab counter. There's a long-time bug that
@@ -444,9 +493,17 @@ _nc_mvcur_wrap(void)
* escape sequences that reset things as column positions.
* Utter a \r to reset this invisibly.
*/
- _nc_outch('\r');
+ NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\r');
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_mvcur_wrap(void)
+{
+ NCURSES_SP_NAME(_nc_mvcur_wrap) (CURRENT_SCREEN);
+}
+#endif
+
/****************************************************************************
*
* Optimized cursor movement
@@ -459,7 +516,7 @@ _nc_mvcur_wrap(void)
static NCURSES_INLINE int
repeated_append(string_desc * target, int total, int num, int repeat, const char *src)
{
- size_t need = repeat * strlen(src);
+ size_t need = (size_t) repeat * strlen(src);
if (need < target->s_size) {
while (repeat-- > 0) {
@@ -486,8 +543,13 @@ repeated_append(string_desc * target, int total, int num, int repeat, const char
#define LASTTAB(fr) ((fr > 0) ? ((fr - 1) / init_tabs) * init_tabs : -1)
static int
-relative_move(string_desc * target, int from_y, int from_x, int to_y, int
- to_x, bool ovw)
+relative_move(NCURSES_SP_DCLx
+ string_desc * target,
+ int from_y,
+ int from_x,
+ int to_y,
+ int to_x,
+ bool ovw)
/* move via local motions (cuu/cuu1/cud/cud1/cub1/cub/cuf1/cuf/vpa/hpa) */
{
string_desc save;
@@ -500,38 +562,38 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int
if (row_address != 0
&& _nc_safe_strcat(target, TPARM_1(row_address, to_y))) {
- vcost = SP->_vpa_cost;
+ vcost = SP_PARM->_vpa_cost;
}
if (to_y > from_y) {
n = (to_y - from_y);
if (parm_down_cursor
- && SP->_cud_cost < vcost
+ && SP_PARM->_cud_cost < vcost
&& _nc_safe_strcat(_nc_str_copy(target, &save),
TPARM_1(parm_down_cursor, n))) {
- vcost = SP->_cud_cost;
+ vcost = SP_PARM->_cud_cost;
}
if (cursor_down
- && (*cursor_down != '\n' || SP->_nl)
- && (n * SP->_cud1_cost < vcost)) {
+ && (*cursor_down != '\n' || SP_PARM->_nl)
+ && (n * SP_PARM->_cud1_cost < vcost)) {
vcost = repeated_append(_nc_str_copy(target, &save), 0,
- SP->_cud1_cost, n, cursor_down);
+ SP_PARM->_cud1_cost, n, cursor_down);
}
} else { /* (to_y < from_y) */
n = (from_y - to_y);
if (parm_up_cursor
- && SP->_cuu_cost < vcost
+ && SP_PARM->_cuu_cost < vcost
&& _nc_safe_strcat(_nc_str_copy(target, &save),
TPARM_1(parm_up_cursor, n))) {
- vcost = SP->_cuu_cost;
+ vcost = SP_PARM->_cuu_cost;
}
- if (cursor_up && (n * SP->_cuu1_cost < vcost)) {
+ if (cursor_up && (n * SP_PARM->_cuu1_cost < vcost)) {
vcost = repeated_append(_nc_str_copy(target, &save), 0,
- SP->_cuu1_cost, n, cursor_up);
+ SP_PARM->_cuu1_cost, n, cursor_up);
}
}
@@ -550,17 +612,17 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int
if (column_address
&& _nc_safe_strcat(_nc_str_copy(target, &save),
TPARM_1(column_address, to_x))) {
- hcost = SP->_hpa_cost;
+ hcost = SP_PARM->_hpa_cost;
}
if (to_x > from_x) {
n = to_x - from_x;
if (parm_right_cursor
- && SP->_cuf_cost < hcost
+ && SP_PARM->_cuf_cost < hcost
&& _nc_safe_strcat(_nc_str_copy(target, &save),
TPARM_1(parm_right_cursor, n))) {
- hcost = SP->_cuf_cost;
+ hcost = SP_PARM->_cuf_cost;
}
if (cursor_right) {
@@ -575,7 +637,7 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int
for (fr = from_x; (nxt = NEXTTAB(fr)) <= to_x; fr = nxt) {
lhcost = repeated_append(&check, lhcost,
- SP->_ht_cost, 1, tab);
+ SP_PARM->_ht_cost, 1, tab);
if (lhcost == INFINITY)
break;
}
@@ -599,7 +661,7 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int
&& n < (int) check.s_size
&& vcost == 0
&& str[0] == '\0') {
- int wanted = CharOf(WANT_CHAR(to_y, from_x));
+ int wanted = CharOf(WANT_CHAR(SP_PARM, to_y, from_x));
if (is8bits(wanted) && isdigit(wanted))
ovw = FALSE;
}
@@ -616,8 +678,8 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int
int i;
for (i = 0; i < n; i++) {
- NCURSES_CH_T ch = WANT_CHAR(to_y, from_x + i);
- if (!SameAttrOf(ch, SCREEN_ATTRS(SP))
+ NCURSES_CH_T ch = WANT_CHAR(SP_PARM, to_y, from_x + i);
+ if (!SameAttrOf(ch, SCREEN_ATTRS(SP_PARM))
#if USE_WIDEC_SUPPORT
|| !Charable(ch)
#endif
@@ -631,13 +693,13 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int
int i;
for (i = 0; i < n; i++)
- *check.s_tail++ = (char) CharOf(WANT_CHAR(to_y,
+ *check.s_tail++ = (char) CharOf(WANT_CHAR(SP_PARM, to_y,
from_x + i));
*check.s_tail = '\0';
- check.s_size -= n;
- lhcost += n * SP->_char_padding;
+ check.s_size -= (size_t) n;
+ lhcost += n * SP_PARM->_char_padding;
} else {
- lhcost = repeated_append(&check, lhcost, SP->_cuf1_cost,
+ lhcost = repeated_append(&check, lhcost, SP_PARM->_cuf1_cost,
n, cursor_right);
}
@@ -650,10 +712,10 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int
n = from_x - to_x;
if (parm_left_cursor
- && SP->_cub_cost < hcost
+ && SP_PARM->_cub_cost < hcost
&& _nc_safe_strcat(_nc_str_copy(target, &save),
TPARM_1(parm_left_cursor, n))) {
- hcost = SP->_cub_cost;
+ hcost = SP_PARM->_cub_cost;
}
if (cursor_left) {
@@ -667,7 +729,8 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int
for (fr = from_x; (nxt = LASTTAB(fr)) >= to_x; fr = nxt) {
lhcost = repeated_append(&check, lhcost,
- SP->_cbt_cost, 1, back_tab);
+ SP_PARM->_cbt_cost,
+ 1, back_tab);
if (lhcost == INFINITY)
break;
}
@@ -676,7 +739,9 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int
}
#endif /* USE_HARD_TABS */
- lhcost = repeated_append(&check, lhcost, SP->_cub1_cost, n, cursor_left);
+ lhcost = repeated_append(&check, lhcost,
+ SP_PARM->_cub1_cost,
+ n, cursor_left);
if (lhcost < hcost
&& _nc_safe_strcat(_nc_str_copy(target, &save), str)) {
@@ -705,7 +770,7 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int
*/
static NCURSES_INLINE int
-onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw)
+onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw)
/* onscreen move from (yold, xold) to (ynew, xnew) */
{
string_desc result;
@@ -723,9 +788,9 @@ onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw)
#define InitResult _nc_str_init(&result, buffer, sizeof(buffer))
/* tactic #0: use direct cursor addressing */
- if (_nc_safe_strcpy(InitResult, TPARM_2(SP->_address_cursor, ynew, xnew))) {
+ if (_nc_safe_strcpy(InitResult, TPARM_2(SP_PARM->_address_cursor, ynew, xnew))) {
tactic = 0;
- usecost = SP->_cup_cost;
+ usecost = SP_PARM->_cup_cost;
#if defined(TRACE) || defined(NCURSES_TEST)
if (!(_nc_optimize_enable & OPTIMIZE_MVCUR))
@@ -740,7 +805,7 @@ onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw)
* (like, say, local-movement \n getting mapped to some obscure
* character because A_ALTCHARSET is on).
*/
- if (yold == -1 || xold == -1 || NOT_LOCAL(yold, xold, ynew, xnew)) {
+ if (yold == -1 || xold == -1 || NOT_LOCAL(SP_PARM, yold, xold, ynew, xnew)) {
#if defined(MAIN) || defined(NCURSES_TEST)
if (!profiling) {
(void) fputs("nonlocal\n", stderr);
@@ -754,8 +819,10 @@ onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw)
#ifndef NO_OPTIMIZE
/* tactic #1: use local movement */
if (yold != -1 && xold != -1
- && ((newcost = relative_move(NullResult, yold, xold, ynew, xnew,
- ovw)) != INFINITY)
+ && ((newcost = relative_move(NCURSES_SP_ARGx
+ NullResult,
+ yold, xold,
+ ynew, xnew, ovw)) != INFINITY)
&& newcost < usecost) {
tactic = 1;
usecost = newcost;
@@ -763,42 +830,51 @@ onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw)
/* tactic #2: use carriage-return + local movement */
if (yold != -1 && carriage_return
- && ((newcost = relative_move(NullResult, yold, 0, ynew, xnew, ovw))
- != INFINITY)
- && SP->_cr_cost + newcost < usecost) {
+ && ((newcost = relative_move(NCURSES_SP_ARGx
+ NullResult,
+ yold, 0,
+ ynew, xnew, ovw)) != INFINITY)
+ && SP_PARM->_cr_cost + newcost < usecost) {
tactic = 2;
- usecost = SP->_cr_cost + newcost;
+ usecost = SP_PARM->_cr_cost + newcost;
}
/* tactic #3: use home-cursor + local movement */
if (cursor_home
- && ((newcost = relative_move(NullResult, 0, 0, ynew, xnew, ovw)) != INFINITY)
- && SP->_home_cost + newcost < usecost) {
+ && ((newcost = relative_move(NCURSES_SP_ARGx
+ NullResult,
+ 0, 0,
+ ynew, xnew, ovw)) != INFINITY)
+ && SP_PARM->_home_cost + newcost < usecost) {
tactic = 3;
- usecost = SP->_home_cost + newcost;
+ usecost = SP_PARM->_home_cost + newcost;
}
/* tactic #4: use home-down + local movement */
if (cursor_to_ll
- && ((newcost = relative_move(NullResult, screen_lines - 1, 0, ynew,
- xnew, ovw)) != INFINITY)
- && SP->_ll_cost + newcost < usecost) {
+ && ((newcost = relative_move(NCURSES_SP_ARGx
+ NullResult,
+ screen_lines(SP_PARM) - 1, 0,
+ ynew, xnew, ovw)) != INFINITY)
+ && SP_PARM->_ll_cost + newcost < usecost) {
tactic = 4;
- usecost = SP->_ll_cost + newcost;
+ usecost = SP_PARM->_ll_cost + newcost;
}
/*
* tactic #5: use left margin for wrap to right-hand side,
* unless strange wrap behavior indicated by xenl might hose us.
*/
- t5_cr_cost = (xold > 0 ? SP->_cr_cost : 0);
+ t5_cr_cost = (xold > 0 ? SP_PARM->_cr_cost : 0);
if (auto_left_margin && !eat_newline_glitch
&& yold > 0 && cursor_left
- && ((newcost = relative_move(NullResult, yold - 1, screen_columns -
- 1, ynew, xnew, ovw)) != INFINITY)
- && t5_cr_cost + SP->_cub1_cost + newcost < usecost) {
+ && ((newcost = relative_move(NCURSES_SP_ARGx
+ NullResult,
+ yold - 1, screen_columns(SP_PARM) - 1,
+ ynew, xnew, ovw)) != INFINITY)
+ && t5_cr_cost + SP_PARM->_cub1_cost + newcost < usecost) {
tactic = 5;
- usecost = t5_cr_cost + SP->_cub1_cost + newcost;
+ usecost = t5_cr_cost + SP_PARM->_cub1_cost + newcost;
}
/*
@@ -808,26 +884,39 @@ onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw)
InitResult;
switch (tactic) {
case 1:
- (void) relative_move(&result, yold, xold, ynew, xnew, ovw);
+ (void) relative_move(NCURSES_SP_ARGx
+ &result,
+ yold, xold,
+ ynew, xnew, ovw);
break;
case 2:
(void) _nc_safe_strcpy(&result, carriage_return);
- (void) relative_move(&result, yold, 0, ynew, xnew, ovw);
+ (void) relative_move(NCURSES_SP_ARGx
+ &result,
+ yold, 0,
+ ynew, xnew, ovw);
break;
case 3:
(void) _nc_safe_strcpy(&result, cursor_home);
- (void) relative_move(&result, 0, 0, ynew, xnew, ovw);
+ (void) relative_move(NCURSES_SP_ARGx
+ &result, 0, 0,
+ ynew, xnew, ovw);
break;
case 4:
(void) _nc_safe_strcpy(&result, cursor_to_ll);
- (void) relative_move(&result, screen_lines - 1, 0, ynew, xnew, ovw);
+ (void) relative_move(NCURSES_SP_ARGx
+ &result,
+ screen_lines(SP_PARM) - 1, 0,
+ ynew, xnew, ovw);
break;
case 5:
if (xold > 0)
(void) _nc_safe_strcat(&result, carriage_return);
(void) _nc_safe_strcat(&result, cursor_left);
- (void) relative_move(&result, yold - 1, screen_columns - 1, ynew,
- xnew, ovw);
+ (void) relative_move(NCURSES_SP_ARGx
+ &result,
+ yold - 1, screen_columns(SP_PARM) - 1,
+ ynew, xnew, ovw);
break;
}
#endif /* !NO_OPTIMIZE */
@@ -845,25 +934,26 @@ onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw)
if (usecost != INFINITY) {
TPUTS_TRACE("mvcur");
- tputs(buffer, 1, _nc_outch);
- SP->_cursrow = ynew;
- SP->_curscol = xnew;
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ buffer, 1, NCURSES_SP_NAME(_nc_outch));
+ SP_PARM->_cursrow = ynew;
+ SP_PARM->_curscol = xnew;
return (OK);
} else
return (ERR);
}
NCURSES_EXPORT(int)
-mvcur(int yold, int xold, int ynew, int xnew)
+TINFO_MVCUR(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew)
/* optimized cursor move from (yold, xold) to (ynew, xnew) */
{
NCURSES_CH_T oldattr;
int code;
- TR(TRACE_CALLS | TRACE_MOVE, (T_CALLED("mvcur(%d,%d,%d,%d)"),
- yold, xold, ynew, xnew));
+ TR(TRACE_CALLS | TRACE_MOVE, (T_CALLED("_nc_tinfo_mvcur(%p,%d,%d,%d,%d)"),
+ (void *) SP_PARM, yold, xold, ynew, xnew));
- if (SP == 0) {
+ if (SP_PARM == 0) {
code = ERR;
} else if (yold == ynew && xold == xnew) {
code = OK;
@@ -874,9 +964,9 @@ mvcur(int yold, int xold, int ynew, int xnew)
* column position implied by wraparound or the lack thereof and
* rolling up the screen to get ynew on the screen.
*/
- if (xnew >= screen_columns) {
- ynew += xnew / screen_columns;
- xnew %= screen_columns;
+ if (xnew >= screen_columns(SP_PARM)) {
+ ynew += xnew / screen_columns(SP_PARM);
+ xnew %= screen_columns(SP_PARM);
}
/*
@@ -884,38 +974,40 @@ mvcur(int yold, int xold, int ynew, int xnew)
* character set -- these have a strong tendency to screw up the CR &
* LF used for local character motions!
*/
- oldattr = SCREEN_ATTRS(SP);
+ oldattr = SCREEN_ATTRS(SP_PARM);
if ((AttrOf(oldattr) & A_ALTCHARSET)
|| (AttrOf(oldattr) && !move_standout_mode)) {
TR(TRACE_CHARPUT, ("turning off (%#lx) %s before move",
(unsigned long) AttrOf(oldattr),
_traceattr(AttrOf(oldattr))));
- (void) VIDATTR(A_NORMAL, 0);
+ (void) VIDATTR(SP_PARM, A_NORMAL, 0);
}
- if (xold >= screen_columns) {
+ if (xold >= screen_columns(SP_PARM)) {
int l;
- if (SP->_nl) {
- l = (xold + 1) / screen_columns;
+ if (SP_PARM->_nl) {
+ l = (xold + 1) / screen_columns(SP_PARM);
yold += l;
- if (yold >= screen_lines)
- l -= (yold - screen_lines - 1);
+ if (yold >= screen_lines(SP_PARM))
+ l -= (yold - screen_lines(SP_PARM) - 1);
if (l > 0) {
if (carriage_return) {
- TPUTS_TRACE("carriage_return");
- putp(carriage_return);
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+ "carriage_return",
+ carriage_return);
} else
- _nc_outch('\r');
+ NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\r');
xold = 0;
while (l > 0) {
if (newline) {
- TPUTS_TRACE("newline");
- putp(newline);
+ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+ "newline",
+ newline);
} else
- _nc_outch('\n');
+ NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\n');
l--;
}
}
@@ -929,27 +1021,35 @@ mvcur(int yold, int xold, int ynew, int xnew)
}
}
- if (yold > screen_lines - 1)
- yold = screen_lines - 1;
- if (ynew > screen_lines - 1)
- ynew = screen_lines - 1;
+ if (yold > screen_lines(SP_PARM) - 1)
+ yold = screen_lines(SP_PARM) - 1;
+ if (ynew > screen_lines(SP_PARM) - 1)
+ ynew = screen_lines(SP_PARM) - 1;
/* destination location is on screen now */
- code = onscreen_mvcur(yold, xold, ynew, xnew, TRUE);
+ code = onscreen_mvcur(NCURSES_SP_ARGx yold, xold, ynew, xnew, TRUE);
/*
* Restore attributes if we disabled them before moving.
*/
- if (!SameAttrOf(oldattr, SCREEN_ATTRS(SP))) {
+ if (!SameAttrOf(oldattr, SCREEN_ATTRS(SP_PARM))) {
TR(TRACE_CHARPUT, ("turning on (%#lx) %s after move",
(unsigned long) AttrOf(oldattr),
_traceattr(AttrOf(oldattr))));
- (void) VIDATTR(AttrOf(oldattr), GetPair(oldattr));
+ (void) VIDATTR(SP_PARM, AttrOf(oldattr), GetPair(oldattr));
}
}
returnCode(code);
}
+#if NCURSES_SP_FUNCS && !defined(USE_TERM_DRIVER)
+NCURSES_EXPORT(int)
+mvcur(int yold, int xold, int ynew, int xnew)
+{
+ return NCURSES_SP_NAME(mvcur) (CURRENT_SCREEN, yold, xold, ynew, xnew);
+}
+#endif
+
#if defined(TRACE) || defined(NCURSES_TEST)
NCURSES_EXPORT_VAR(int) _nc_optimize_enable = OPTIMIZE_ALL;
#endif
@@ -1212,25 +1312,25 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
speeds[i], overhead, totalest);
}
} else if (buf[0] == 'c') {
- (void) printf("char padding: %d\n", SP->_char_padding);
- (void) printf("cr cost: %d\n", SP->_cr_cost);
- (void) printf("cup cost: %d\n", SP->_cup_cost);
- (void) printf("home cost: %d\n", SP->_home_cost);
- (void) printf("ll cost: %d\n", SP->_ll_cost);
+ (void) printf("char padding: %d\n", CURRENT_SCREEN->_char_padding);
+ (void) printf("cr cost: %d\n", CURRENT_SCREEN->_cr_cost);
+ (void) printf("cup cost: %d\n", CURRENT_SCREEN->_cup_cost);
+ (void) printf("home cost: %d\n", CURRENT_SCREEN->_home_cost);
+ (void) printf("ll cost: %d\n", CURRENT_SCREEN->_ll_cost);
#if USE_HARD_TABS
- (void) printf("ht cost: %d\n", SP->_ht_cost);
- (void) printf("cbt cost: %d\n", SP->_cbt_cost);
+ (void) printf("ht cost: %d\n", CURRENT_SCREEN->_ht_cost);
+ (void) printf("cbt cost: %d\n", CURRENT_SCREEN->_cbt_cost);
#endif /* USE_HARD_TABS */
- (void) printf("cub1 cost: %d\n", SP->_cub1_cost);
- (void) printf("cuf1 cost: %d\n", SP->_cuf1_cost);
- (void) printf("cud1 cost: %d\n", SP->_cud1_cost);
- (void) printf("cuu1 cost: %d\n", SP->_cuu1_cost);
- (void) printf("cub cost: %d\n", SP->_cub_cost);
- (void) printf("cuf cost: %d\n", SP->_cuf_cost);
- (void) printf("cud cost: %d\n", SP->_cud_cost);
- (void) printf("cuu cost: %d\n", SP->_cuu_cost);
- (void) printf("hpa cost: %d\n", SP->_hpa_cost);
- (void) printf("vpa cost: %d\n", SP->_vpa_cost);
+ (void) printf("cub1 cost: %d\n", CURRENT_SCREEN->_cub1_cost);
+ (void) printf("cuf1 cost: %d\n", CURRENT_SCREEN->_cuf1_cost);
+ (void) printf("cud1 cost: %d\n", CURRENT_SCREEN->_cud1_cost);
+ (void) printf("cuu1 cost: %d\n", CURRENT_SCREEN->_cuu1_cost);
+ (void) printf("cub cost: %d\n", CURRENT_SCREEN->_cub_cost);
+ (void) printf("cuf cost: %d\n", CURRENT_SCREEN->_cuf_cost);
+ (void) printf("cud cost: %d\n", CURRENT_SCREEN->_cud_cost);
+ (void) printf("cuu cost: %d\n", CURRENT_SCREEN->_cuu_cost);
+ (void) printf("hpa cost: %d\n", CURRENT_SCREEN->_hpa_cost);
+ (void) printf("vpa cost: %d\n", CURRENT_SCREEN->_vpa_cost);
} else if (buf[0] == 'x' || buf[0] == 'q')
break;
else
diff --git a/contrib/ncurses/ncurses/tty/lib_tstp.c b/contrib/ncurses/ncurses/tty/lib_tstp.c
index 06c8411caa4d..70f805a2ad5e 100644
--- a/contrib/ncurses/ncurses/tty/lib_tstp.c
+++ b/contrib/ncurses/ncurses/tty/lib_tstp.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -46,7 +46,7 @@
#define _POSIX_SOURCE
#endif
-MODULE_ID("$Id: lib_tstp.c,v 1.37 2008/05/03 16:24:56 tom Exp $")
+MODULE_ID("$Id: lib_tstp.c,v 1.41 2010/05/15 21:31:12 tom Exp $")
#if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC)
#define USE_SIGTSTP 1
@@ -59,16 +59,20 @@ static const char *
signal_name(int sig)
{
switch (sig) {
+#ifdef SIGALRM
case SIGALRM:
return "SIGALRM";
+#endif
#ifdef SIGCONT
case SIGCONT:
return "SIGCONT";
#endif
case SIGINT:
return "SIGINT";
+#ifdef SIGQUIT
case SIGQUIT:
return "SIGQUIT";
+#endif
case SIGTERM:
return "SIGTERM";
#ifdef SIGTSTP
@@ -136,6 +140,7 @@ signal_name(int sig)
static void
tstp(int dummy GCC_UNUSED)
{
+ SCREEN *sp = CURRENT_SCREEN;
sigset_t mask, omask;
sigaction_t act, oact;
@@ -154,11 +159,11 @@ tstp(int dummy GCC_UNUSED)
* parent was stopped before us, and we would likely pick up the
* settings already modified by the shell.
*/
- if (SP != 0 && !SP->_endwin) /* don't do this if we're not in curses */
+ if (sp != 0 && !sp->_endwin) /* don't do this if we're not in curses */
#if HAVE_TCGETPGRP
if (tcgetpgrp(STDIN_FILENO) == getpgrp())
#endif
- def_prog_mode();
+ NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_ARG);
/*
* Block window change and timer signals. The latter
@@ -166,7 +171,9 @@ tstp(int dummy GCC_UNUSED)
* to repaint the screen.
*/
(void) sigemptyset(&mask);
+#ifdef SIGALRM
(void) sigaddset(&mask, SIGALRM);
+#endif
#if USE_SIGWINCH
(void) sigaddset(&mask, SIGWINCH);
#endif
@@ -185,7 +192,7 @@ tstp(int dummy GCC_UNUSED)
* End window mode, which also resets the terminal state to the
* original (pre-curses) modes.
*/
- endwin();
+ NCURSES_SP_NAME(endwin) (NCURSES_SP_ARG);
/* Unblock SIGTSTP. */
(void) sigemptyset(&mask);
@@ -212,19 +219,19 @@ tstp(int dummy GCC_UNUSED)
T(("SIGCONT received"));
sigaction(SIGTSTP, &oact, NULL);
- flushinp();
+ NCURSES_SP_NAME(flushinp) (NCURSES_SP_ARG);
/*
* If the user modified the tty state while suspended, he wants
* those changes to stick. So save the new "default" terminal state.
*/
- def_shell_mode();
+ NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_ARG);
/*
* This relies on the fact that doupdate() will restore the
* program-mode tty state, and issue enter_ca_mode if need be.
*/
- doupdate();
+ NCURSES_SP_NAME(doupdate) (NCURSES_SP_ARG);
/* Reset the signals. */
(void) sigprocmask(SIG_SETMASK, &omask, NULL);
@@ -234,6 +241,8 @@ tstp(int dummy GCC_UNUSED)
static void
cleanup(int sig)
{
+ SCREEN *sp = CURRENT_SCREEN;
+
/*
* 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
@@ -241,7 +250,10 @@ cleanup(int sig)
*/
if (!_nc_globals.cleanup_nested++
&& (sig == SIGINT
- || sig == SIGQUIT)) {
+#ifdef SIGQUIT
+ || sig == SIGQUIT
+#endif
+ )) {
#if HAVE_SIGACTION || HAVE_SIGVEC
sigaction_t act;
sigemptyset(&act.sa_mask);
@@ -257,12 +269,12 @@ cleanup(int sig)
if (scan->_ofp != 0
&& isatty(fileno(scan->_ofp))) {
scan->_cleanup = TRUE;
- scan->_outch = _nc_outch;
+ scan->_outch = NCURSES_SP_NAME(_nc_outch);
}
set_term(scan);
- endwin();
- if (SP)
- SP->_endwin = FALSE; /* in case we have an atexit! */
+ NCURSES_SP_NAME(endwin) (NCURSES_SP_ARG);
+ if (sp)
+ sp->_endwin = FALSE; /* in case we have an atexit! */
}
}
}
@@ -274,6 +286,13 @@ static void
sigwinch(int sig GCC_UNUSED)
{
_nc_globals.have_sigwinch = 1;
+# if USE_PTHREADS_EINTR
+ if (_nc_globals.read_thread) {
+ if (!pthread_equal(pthread_self(), _nc_globals.read_thread))
+ pthread_kill(_nc_globals.read_thread, SIGWINCH);
+ _nc_globals.read_thread = 0;
+ }
+# endif
}
#endif /* USE_SIGWINCH */
diff --git a/contrib/ncurses/ncurses/tty/lib_twait.c b/contrib/ncurses/ncurses/tty/lib_twait.c
index 16d12edbbe3c..329ec29a019f 100644
--- a/contrib/ncurses/ncurses/tty/lib_twait.c
+++ b/contrib/ncurses/ncurses/tty/lib_twait.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -65,10 +65,12 @@
# include <sys/select.h>
# endif
#endif
-
+#ifdef __MINGW32__
+# include <sys/time.h>
+#endif
#undef CUR
-MODULE_ID("$Id: lib_twait.c,v 1.59 2008/08/30 20:08:19 tom Exp $")
+MODULE_ID("$Id: lib_twait.c,v 1.61 2010/12/25 23:43:58 tom Exp $")
static long
_nc_gettime(TimeType * t0, bool first)
@@ -124,15 +126,27 @@ _nc_eventlist_timeout(_nc_eventlist * evl)
}
#endif /* NCURSES_WGETCH_EVENTS */
+#if (USE_FUNC_POLL || HAVE_SELECT)
+# define MAYBE_UNUSED
+#else
+# define MAYBE_UNUSED GCC_UNUSED
+#endif
+
+#if (USE_FUNC_POLL || HAVE_SELECT)
+# define MAYBE_UNUSED
+#else
+# define MAYBE_UNUSED GCC_UNUSED
+#endif
+
/*
* Wait a specified number of milliseconds, returning nonzero if the timer
* didn't expire before there is activity on the specified file descriptors.
* The file-descriptors are specified by the mode:
- * 0 - none (absolute time)
- * 1 - ncurses' normal input-descriptor
- * 2 - mouse descriptor, if any
- * 3 - either input or mouse.
- *
+ * TW_NONE 0 - none (absolute time)
+ * TW_INPUT 1 - ncurses' normal input-descriptor
+ * TW_MOUSE 2 - mouse descriptor, if any
+ * TW_ANY 3 - either input or mouse.
+ * TW_EVENT 4 -
* Experimental: if NCURSES_WGETCH_EVENTS is defined, (mode & 4) determines
* whether to pay attention to evl argument. If set, the smallest of
* millisecond and of timeout of evl is taken.
@@ -143,16 +157,18 @@ _nc_eventlist_timeout(_nc_eventlist * evl)
* descriptors.
*/
NCURSES_EXPORT(int)
-_nc_timed_wait(SCREEN *sp,
- int mode,
+_nc_timed_wait(SCREEN *sp MAYBE_UNUSED,
+ int mode MAYBE_UNUSED,
int milliseconds,
int *timeleft
EVENTLIST_2nd(_nc_eventlist * evl))
{
- int fd;
int count;
- int result = 0;
+ int result = TW_NONE;
TimeType t0;
+#if (USE_FUNC_POLL || HAVE_SELECT)
+ int fd;
+#endif
#ifdef NCURSES_WGETCH_EVENTS
int timeout_is_event = 0;
@@ -174,7 +190,7 @@ _nc_timed_wait(SCREEN *sp,
milliseconds, mode));
#ifdef NCURSES_WGETCH_EVENTS
- if (mode & 4) {
+ if (mode & TW_EVENT) {
int event_delay = _nc_eventlist_timeout(evl);
if (event_delay >= 0
@@ -193,7 +209,7 @@ _nc_timed_wait(SCREEN *sp,
count = 0;
#ifdef NCURSES_WGETCH_EVENTS
- if ((mode & 4) && evl)
+ if ((mode & TW_EVENT) && evl)
evl->result_flags = 0;
#endif
@@ -201,23 +217,23 @@ _nc_timed_wait(SCREEN *sp,
memset(fd_list, 0, sizeof(fd_list));
#ifdef NCURSES_WGETCH_EVENTS
- if ((mode & 4) && evl)
+ if ((mode & TW_EVENT) && evl)
fds = typeMalloc(struct pollfd, MIN_FDS + evl->count);
#endif
- if (mode & 1) {
+ if (mode & TW_INPUT) {
fds[count].fd = sp->_ifd;
fds[count].events = POLLIN;
count++;
}
- if ((mode & 2)
+ if ((mode & TW_MOUSE)
&& (fd = sp->_mouse_fd) >= 0) {
fds[count].fd = fd;
fds[count].events = POLLIN;
count++;
}
#ifdef NCURSES_WGETCH_EVENTS
- if ((mode & 4) && evl) {
+ if ((mode & TW_EVENT) && evl) {
for (n = 0; n < evl->count; ++n) {
_nc_event *ev = evl->events[n];
@@ -234,7 +250,7 @@ _nc_timed_wait(SCREEN *sp,
result = poll(fds, (unsigned) count, milliseconds);
#ifdef NCURSES_WGETCH_EVENTS
- if ((mode & 4) && evl) {
+ if ((mode & TW_EVENT) && evl) {
int c;
if (!result)
@@ -276,8 +292,8 @@ _nc_timed_wait(SCREEN *sp,
*
* FIXME: this assumes mode&1 if milliseconds < 0 (see lib_getch.c).
*/
- result = 0;
- if (mode & 1) {
+ result = TW_NONE;
+ if (mode & TW_INPUT) {
int step = (milliseconds < 0) ? 0 : 5000;
bigtime_t d;
bigtime_t useconds = milliseconds * 1000;
@@ -313,17 +329,17 @@ _nc_timed_wait(SCREEN *sp,
*/
FD_ZERO(&set);
- if (mode & 1) {
+ if (mode & TW_INPUT) {
FD_SET(sp->_ifd, &set);
count = sp->_ifd + 1;
}
- if ((mode & 2)
+ if ((mode & TW_MOUSE)
&& (fd = sp->_mouse_fd) >= 0) {
FD_SET(fd, &set);
count = max(fd, count) + 1;
}
#ifdef NCURSES_WGETCH_EVENTS
- if ((mode & 4) && evl) {
+ if ((mode & TW_EVENT) && evl) {
for (n = 0; n < evl->count; ++n) {
_nc_event *ev = evl->events[n];
@@ -346,7 +362,7 @@ _nc_timed_wait(SCREEN *sp,
}
#ifdef NCURSES_WGETCH_EVENTS
- if ((mode & 4) && evl) {
+ if ((mode & TW_EVENT) && evl) {
evl->result_flags = 0;
for (n = 0; n < evl->count; ++n) {
_nc_event *ev = evl->events[n];
@@ -370,7 +386,7 @@ _nc_timed_wait(SCREEN *sp,
returntime = _nc_gettime(&t0, FALSE);
if (milliseconds >= 0)
- milliseconds -= (returntime - starttime);
+ milliseconds -= (int) (returntime - starttime);
#ifdef NCURSES_WGETCH_EVENTS
if (evl) {
@@ -428,22 +444,22 @@ _nc_timed_wait(SCREEN *sp,
}
}
#elif defined(__BEOS__)
- result = 1; /* redundant, but simple */
+ result = TW_INPUT; /* redundant, but simple */
#elif HAVE_SELECT
- if ((mode & 2)
+ if ((mode & TW_MOUSE)
&& (fd = sp->_mouse_fd) >= 0
&& FD_ISSET(fd, &set))
- result |= 2;
- if ((mode & 1)
+ result |= TW_MOUSE;
+ if ((mode & TW_INPUT)
&& FD_ISSET(sp->_ifd, &set))
- result |= 1;
+ result |= TW_INPUT;
#endif
} else
result = 0;
}
#ifdef NCURSES_WGETCH_EVENTS
- if ((mode & 4) && evl && evl->result_flags)
- result |= 4;
+ if ((mode & TW_EVENT) && evl && evl->result_flags)
+ result |= TW_EVENT;
#endif
return (result);
diff --git a/contrib/ncurses/ncurses/tty/lib_vidattr.c b/contrib/ncurses/ncurses/tty/lib_vidattr.c
index ac2a74f08e01..9656b3c70ee6 100644
--- a/contrib/ncurses/ncurses/tty/lib_vidattr.c
+++ b/contrib/ncurses/ncurses/tty/lib_vidattr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,7 +29,8 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
- * and: Thomas E. Dickey 1996 on *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*
@@ -63,11 +64,16 @@
*/
#include <curses.priv.h>
-#include <term.h>
-MODULE_ID("$Id: lib_vidattr.c,v 1.49 2007/06/30 21:58:04 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_vidattr.c,v 1.61 2010/06/05 22:22:04 tom Exp $")
-#define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc)
+#define doPut(mode) \
+ TPUTS_TRACE(#mode); \
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx mode, 1, outc)
#define TurnOn(mask,mode) \
if ((turn_on & mask) && mode) { doPut(mode); }
@@ -78,40 +84,49 @@ MODULE_ID("$Id: lib_vidattr.c,v 1.49 2007/06/30 21:58:04 tom Exp $")
/* if there is no current screen, assume we *can* do color */
#define SetColorsIf(why,old_attr) \
if (can_color && (why)) { \
- int old_pair = PAIR_NUMBER(old_attr); \
+ int old_pair = PairNumber(old_attr); \
TR(TRACE_ATTRS, ("old pair = %d -- new pair = %d", old_pair, pair)); \
if ((pair != old_pair) \
|| (fix_pair0 && (pair == 0)) \
|| (reverse ^ ((old_attr & A_REVERSE) != 0))) { \
- _nc_do_color(old_pair, pair, reverse, outc); \
+ NCURSES_SP_NAME(_nc_do_color)(NCURSES_SP_ARGx \
+ (short) old_pair, \
+ (short) pair, \
+ reverse, outc); \
} \
}
#define PreviousAttr _nc_prescreen.previous_attr
NCURSES_EXPORT(int)
-vidputs(chtype newmode, int (*outc) (int))
+NCURSES_SP_NAME(vidputs) (NCURSES_SP_DCLx
+ chtype newmode,
+ NCURSES_SP_OUTC outc)
{
attr_t turn_on, turn_off;
int pair;
bool reverse = FALSE;
- bool can_color = (SP == 0 || SP->_coloron);
+ bool can_color = (SP_PARM == 0 || SP_PARM->_coloron);
#if NCURSES_EXT_FUNCS
- bool fix_pair0 = (SP != 0 && SP->_coloron && !SP->_default_color);
+ bool fix_pair0 = (SP_PARM != 0 && SP_PARM->_coloron && !SP_PARM->_default_color);
#else
#define fix_pair0 FALSE
#endif
newmode &= A_ATTRIBUTES;
- T((T_CALLED("vidputs(%s)"), _traceattr(newmode)));
+
+ T((T_CALLED("vidputs(%p,%s)"), (void *) SP_PARM, _traceattr(newmode)));
+
+ if (!IsTermInfo(SP_PARM))
+ returnCode(ERR);
/* this allows us to go on whether or not newterm() has been called */
- if (SP)
- PreviousAttr = AttrOf(SCREEN_ATTRS(SP));
+ if (SP_PARM)
+ PreviousAttr = AttrOf(SCREEN_ATTRS(SP_PARM));
TR(TRACE_ATTRS, ("previous attribute was %s", _traceattr(PreviousAttr)));
- if ((SP != 0)
+ if ((SP_PARM != 0)
&& (magic_cookie_glitch > 0)) {
#if USE_XMC_SUPPORT
static const chtype table[] =
@@ -135,7 +150,7 @@ vidputs(chtype newmode, int (*outc) (int))
* the terminfo max_attributes value.
*/
for (n = 0; n < SIZEOF(table); ++n) {
- if ((table[n] & SP->_ok_attributes) == 0) {
+ if ((table[n] & SP_PARM->_ok_attributes) == 0) {
newmode &= ~table[n];
} else if ((table[n] & newmode) != 0) {
if (used++ >= limit) {
@@ -148,7 +163,7 @@ vidputs(chtype newmode, int (*outc) (int))
}
}
#else
- newmode &= ~(SP->_xmc_suppress);
+ newmode &= ~(SP_PARM->_xmc_suppress);
#endif
TR(TRACE_ATTRS, ("suppressed attribute is %s", _traceattr(newmode)));
}
@@ -172,7 +187,7 @@ vidputs(chtype newmode, int (*outc) (int))
* A_ALTCHARSET (256) down 2 to line up. We use the NCURSES_BITS
* macro so this will work properly for the wide-character layout.
*/
- unsigned value = no_color_video;
+ unsigned value = (unsigned) no_color_video;
attr_t mask = NCURSES_BITS((value & 63)
| ((value & 192) << 1)
| ((value & 256) >> 2), 8);
@@ -188,7 +203,7 @@ vidputs(chtype newmode, int (*outc) (int))
if (newmode == PreviousAttr)
returnCode(OK);
- pair = PAIR_NUMBER(newmode);
+ pair = PairNumber(newmode);
if (reverse) {
newmode &= ~A_REVERSE;
@@ -208,10 +223,10 @@ vidputs(chtype newmode, int (*outc) (int))
if (exit_attribute_mode) {
doPut(exit_attribute_mode);
} else {
- if (!SP || SP->_use_rmul) {
+ if (!SP_PARM || SP_PARM->_use_rmul) {
TurnOff(A_UNDERLINE, exit_underline_mode);
}
- if (!SP || SP->_use_rmso) {
+ if (!SP_PARM || SP_PARM->_use_rmso) {
TurnOff(A_STANDOUT, exit_standout_mode);
}
}
@@ -222,16 +237,18 @@ vidputs(chtype newmode, int (*outc) (int))
} else if (set_attributes) {
if (turn_on || turn_off) {
TPUTS_TRACE("set_attributes");
- tputs(tparm(set_attributes,
- (newmode & A_STANDOUT) != 0,
- (newmode & A_UNDERLINE) != 0,
- (newmode & A_REVERSE) != 0,
- (newmode & A_BLINK) != 0,
- (newmode & A_DIM) != 0,
- (newmode & A_BOLD) != 0,
- (newmode & A_INVIS) != 0,
- (newmode & A_PROTECT) != 0,
- (newmode & A_ALTCHARSET) != 0), 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ tparm(set_attributes,
+ (newmode & A_STANDOUT) != 0,
+ (newmode & A_UNDERLINE) != 0,
+ (newmode & A_REVERSE) != 0,
+ (newmode & A_BLINK) != 0,
+ (newmode & A_DIM) != 0,
+ (newmode & A_BOLD) != 0,
+ (newmode & A_INVIS) != 0,
+ (newmode & A_PROTECT) != 0,
+ (newmode & A_ALTCHARSET) != 0),
+ 1, outc);
PreviousAttr &= ALL_BUT_COLOR;
}
SetColorsIf((pair != 0) || fix_pair0, PreviousAttr);
@@ -241,11 +258,11 @@ vidputs(chtype newmode, int (*outc) (int))
TurnOff(A_ALTCHARSET, exit_alt_charset_mode);
- if (!SP || SP->_use_rmul) {
+ if (!SP_PARM || SP_PARM->_use_rmul) {
TurnOff(A_UNDERLINE, exit_underline_mode);
}
- if (!SP || SP->_use_rmso) {
+ if (!SP_PARM || SP_PARM->_use_rmso) {
TurnOff(A_STANDOUT, exit_standout_mode);
}
@@ -282,28 +299,53 @@ vidputs(chtype newmode, int (*outc) (int))
if (reverse)
newmode |= A_REVERSE;
- if (SP)
- SetAttr(SCREEN_ATTRS(SP), newmode);
+ if (SP_PARM)
+ SetAttr(SCREEN_ATTRS(SP_PARM), newmode);
else
PreviousAttr = newmode;
returnCode(OK);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-vidattr(chtype newmode)
+vidputs(chtype newmode, NCURSES_OUTC outc)
{
- T((T_CALLED("vidattr(%s)"), _traceattr(newmode)));
+ SetSafeOutcWrapper(outc);
+ return NCURSES_SP_NAME(vidputs) (CURRENT_SCREEN,
+ newmode,
+ _nc_outc_wrapper);
+}
+#endif
- returnCode(vidputs(newmode, _nc_outch));
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(vidattr) (NCURSES_SP_DCLx chtype newmode)
+{
+ T((T_CALLED("vidattr(%p,%s)"), (void *) SP_PARM, _traceattr(newmode)));
+ returnCode(NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx
+ newmode,
+ NCURSES_SP_NAME(_nc_outch)));
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+vidattr(chtype newmode)
+{
+ return NCURSES_SP_NAME(vidattr) (CURRENT_SCREEN, newmode);
+}
+#endif
+
NCURSES_EXPORT(chtype)
-termattrs(void)
+NCURSES_SP_NAME(termattrs) (NCURSES_SP_DCL0)
{
chtype attrs = A_NORMAL;
- T((T_CALLED("termattrs()")));
+ T((T_CALLED("termattrs(%p)"), (void *) SP_PARM));
+#ifdef USE_TERM_DRIVER
+ if (HasTerminal(SP_PARM))
+ attrs = CallDriver(SP_PARM, conattr);
+#else
+
if (enter_alt_charset_mode)
attrs |= A_ALTCHARSET;
@@ -331,8 +373,17 @@ termattrs(void)
if (enter_underline_mode)
attrs |= A_UNDERLINE;
- if (SP->_coloron)
+ if (SP_PARM->_coloron)
attrs |= A_COLOR;
- returnChar(attrs);
+#endif
+ returnChtype(attrs);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(chtype)
+termattrs(void)
+{
+ return NCURSES_SP_NAME(termattrs) (CURRENT_SCREEN);
}
+#endif
diff --git a/contrib/ncurses/ncurses/tty/tty_update.c b/contrib/ncurses/ncurses/tty/tty_update.c
index 6a3a0c8e9341..f0d2369c18d6 100644
--- a/contrib/ncurses/ncurses/tty/tty_update.c
+++ b/contrib/ncurses/ncurses/tty/tty_update.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -30,6 +30,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 *
+ * and: Juergen Pfeifer 2009 *
****************************************************************************/
/*-----------------------------------------------------------------
@@ -38,12 +39,16 @@
*
* The routine doupdate() and its dependents.
* All physical output is concentrated here (except _nc_outch()
- * in lib_tputs.c).
+ * in lib_tputs.c).
*
*-----------------------------------------------------------------*/
#include <curses.priv.h>
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
#if defined __HAIKU__ && defined __BEOS__
#undef __BEOS__
#endif
@@ -76,9 +81,8 @@
#endif
#include <ctype.h>
-#include <term.h>
-MODULE_ID("$Id: tty_update.c,v 1.246 2008/08/30 20:08:19 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.264 2010/12/19 01:21:02 tom Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
@@ -91,7 +95,7 @@ MODULE_ID("$Id: tty_update.c,v 1.246 2008/08/30 20:08:19 tom Exp $")
*/
#define CHECK_INTERVAL 5
-#define FILL_BCE() (SP->_coloron && !SP->_default_color && !back_color_erase)
+#define FILL_BCE(sp) (sp->_coloron && !sp->_default_color && !back_color_erase)
static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT);
static NCURSES_CH_T normal = NewChar(BLANK_TEXT);
@@ -103,13 +107,23 @@ static NCURSES_CH_T normal = NewChar(BLANK_TEXT);
*/
/* #define POSITION_DEBUG */
-static NCURSES_INLINE NCURSES_CH_T ClrBlank(WINDOW *win);
+static NCURSES_INLINE NCURSES_CH_T ClrBlank(NCURSES_SP_DCLx WINDOW *win);
+
+#if NCURSES_SP_FUNCS
+static int ClrBottom(SCREEN *, int total);
+static void ClearScreen(SCREEN *, NCURSES_CH_T blank);
+static void ClrUpdate(SCREEN *);
+static void DelChar(SCREEN *, int count);
+static void InsStr(SCREEN *, NCURSES_CH_T * line, int count);
+static void TransformLine(SCREEN *, int const lineno);
+#else
static int ClrBottom(int total);
static void ClearScreen(NCURSES_CH_T blank);
static void ClrUpdate(void);
static void DelChar(int count);
static void InsStr(NCURSES_CH_T * line, int count);
static void TransformLine(int const lineno);
+#endif
#ifdef POSITION_DEBUG
/****************************************************************************
@@ -119,7 +133,7 @@ static void TransformLine(int const lineno);
****************************************************************************/
static void
-position_check(int expected_y, int expected_x, char *legend)
+position_check(NCURSES_SP_DCLx int expected_y, int expected_x, char *legend)
/* check to see if the real cursor position matches the virtual */
{
char buf[20];
@@ -129,10 +143,10 @@ position_check(int expected_y, int expected_x, char *legend)
if (!_nc_tracing || (expected_y < 0 && expected_x < 0))
return;
- _nc_flush();
+ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
memset(buf, '\0', sizeof(buf));
- putp("\033[6n"); /* only works on ANSI-compatibles */
- _nc_flush();
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx "\033[6n"); /* only works on ANSI-compatibles */
+ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
*(s = buf) = 0;
do {
int ask = sizeof(buf) - 1 - (s - buf);
@@ -152,8 +166,12 @@ position_check(int expected_y, int expected_x, char *legend)
if (expected_y < 0)
expected_y = y - 1;
if (y - 1 != expected_y || x - 1 != expected_x) {
- beep();
- tputs(tparm("\033[%d;%dH", expected_y + 1, expected_x + 1), 1, _nc_outch);
+ NCURSES_SP_NAME(beep) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ tparm("\033[%d;%dH",
+ expected_y + 1,
+ expected_x + 1),
+ 1, NCURSES_SP_NAME(_nc_outch));
_tracef("position seen (%d, %d) doesn't match expected one (%d, %d) in %s",
y - 1, x - 1, expected_y, expected_x, legend);
} else {
@@ -162,7 +180,7 @@ position_check(int expected_y, int expected_x, char *legend)
}
}
#else
-#define position_check(expected_y, expected_x, legend) /* nothing */
+#define position_check(sp, expected_y, expected_x, legend) /* nothing */
#endif /* POSITION_DEBUG */
/****************************************************************************
@@ -172,19 +190,22 @@ position_check(int expected_y, int expected_x, char *legend)
****************************************************************************/
static NCURSES_INLINE void
-GoTo(int const row, int const col)
+GoTo(NCURSES_SP_DCLx int const row, int const col)
{
- TR(TRACE_MOVE, ("GoTo(%d, %d) from (%d, %d)",
- row, col, SP->_cursrow, SP->_curscol));
+ TR(TRACE_MOVE, ("GoTo(%p, %d, %d) from (%d, %d)",
+ (void *) SP_PARM, row, col, SP_PARM->_cursrow, SP_PARM->_curscol));
- position_check(SP->_cursrow, SP->_curscol, "GoTo");
+ position_check(SP_PARM, SP_PARM->_cursrow, SP_PARM->_curscol, "GoTo");
- mvcur(SP->_cursrow, SP->_curscol, row, col);
- position_check(SP->_cursrow, SP->_curscol, "GoTo2");
+ TINFO_MVCUR(NCURSES_SP_ARGx
+ SP_PARM->_cursrow,
+ SP_PARM->_curscol,
+ row, col);
+ position_check(SP_PARM, SP_PARM->_cursrow, SP_PARM->_curscol, "GoTo2");
}
static NCURSES_INLINE void
-PutAttrChar(CARG_CH_T ch)
+PutAttrChar(NCURSES_SP_DCLx CARG_CH_T ch)
{
int chlen = 1;
NCURSES_CH_T my_ch;
@@ -194,7 +215,7 @@ PutAttrChar(CARG_CH_T ch)
TR(TRACE_CHARPUT, ("PutAttrChar(%s) at (%d, %d)",
_tracech_t(ch),
- SP->_cursrow, SP->_curscol));
+ SP_PARM->_cursrow, SP_PARM->_curscol));
#if USE_WIDEC_SUPPORT
/*
* If this is not a valid character, there is nothing more to do.
@@ -224,12 +245,12 @@ PutAttrChar(CARG_CH_T ch)
*/
if (is8bits(CharOf(CHDEREF(ch)))
&& (isprint(CharOf(CHDEREF(ch)))
- || (SP->_legacy_coding > 0 && CharOf(CHDEREF(ch)) >= 160)
- || (SP->_legacy_coding > 1 && CharOf(CHDEREF(ch)) >= 128)
+ || (SP_PARM->_legacy_coding > 0 && CharOf(CHDEREF(ch)) >= 160)
+ || (SP_PARM->_legacy_coding > 1 && CharOf(CHDEREF(ch)) >= 128)
|| (AttrOf(attr) & A_ALTCHARSET
&& ((CharOfD(ch) < ACS_LEN
- && SP->_acs_map != 0
- && SP->_acs_map[CharOfD(ch)] != 0)
+ && SP_PARM->_acs_map != 0
+ && SP_PARM->_acs_map[CharOfD(ch)] != 0)
|| (CharOfD(ch) >= 128))))) {
;
} else {
@@ -241,7 +262,7 @@ PutAttrChar(CARG_CH_T ch)
#endif
if ((AttrOf(attr) & A_ALTCHARSET)
- && SP->_acs_map != 0
+ && SP_PARM->_acs_map != 0
&& CharOfD(ch) < ACS_LEN) {
my_ch = CHDEREF(ch); /* work around const param */
#if USE_WIDEC_SUPPORT
@@ -251,8 +272,8 @@ PutAttrChar(CARG_CH_T ch)
* character, and uses the wide-character mapping when we expect the
* normal one to be broken (by mis-design ;-).
*/
- if (SP->_screen_acs_fix
- && SP->_screen_acs_map[CharOf(my_ch)]) {
+ if (SP_PARM->_screen_acs_fix
+ && SP_PARM->_screen_acs_map[CharOf(my_ch)]) {
RemAttr(attr, A_ALTCHARSET);
my_ch = _nc_wacs[CharOf(my_ch)];
}
@@ -265,9 +286,9 @@ PutAttrChar(CARG_CH_T ch)
*/
if (AttrOf(attr) & A_ALTCHARSET) {
int j = CharOfD(ch);
- chtype temp = UChar(SP->_acs_map[j]);
+ chtype temp = UChar(SP_PARM->_acs_map[j]);
- if (!(SP->_screen_acs_map[j])) {
+ if (!(SP_PARM->_screen_acs_map[j])) {
RemAttr(attr, A_ALTCHARSET);
if (temp == 0)
temp = ' ';
@@ -282,28 +303,28 @@ PutAttrChar(CARG_CH_T ch)
ch = CHREF(tilde);
}
- UpdateAttrs(attr);
+ UpdateAttrs(SP_PARM, attr);
#if !USE_WIDEC_SUPPORT
/* FIXME - we do this special case for signal handling, should see how to
* make it work for wide characters.
*/
- if (SP->_outch != 0) {
- SP->_outch(UChar(ch));
+ if (SP_PARM->_outch != 0) {
+ SP_PARM->_outch(NCURSES_SP_ARGx UChar(ch));
} else
#endif
{
- PUTC(CHDEREF(ch), SP->_ofp); /* macro's fastest... */
+ PUTC(CHDEREF(ch), SP_PARM->_ofp); /* macro's fastest... */
COUNT_OUTCHARS(1);
}
- SP->_curscol += chlen;
+ SP_PARM->_curscol += chlen;
if (char_padding) {
TPUTS_TRACE("char_padding");
- putp(char_padding);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx char_padding);
}
}
static bool
-check_pending(void)
+check_pending(NCURSES_SP_DCL0)
/* check for pending input */
{
bool have_pending = FALSE;
@@ -313,13 +334,13 @@ check_pending(void)
* have the refreshing slow down drastically (or stop) if there's an
* unread character available.
*/
- if (SP->_fifohold != 0)
+ if (SP_PARM->_fifohold != 0)
return FALSE;
- if (SP->_checkfd >= 0) {
+ if (SP_PARM->_checkfd >= 0) {
#if USE_FUNC_POLL
struct pollfd fds[1];
- fds[0].fd = SP->_checkfd;
+ fds[0].fd = SP_PARM->_checkfd;
fds[0].events = POLLIN;
if (poll(fds, 1, 0) > 0) {
have_pending = TRUE;
@@ -347,43 +368,52 @@ check_pending(void)
ktimeout.tv_usec = 0;
FD_ZERO(&fdset);
- FD_SET(SP->_checkfd, &fdset);
- if (select(SP->_checkfd + 1, &fdset, NULL, NULL, &ktimeout) != 0) {
+ FD_SET(SP_PARM->_checkfd, &fdset);
+ if (select(SP_PARM->_checkfd + 1, &fdset, NULL, NULL, &ktimeout) != 0) {
have_pending = TRUE;
}
#endif
}
if (have_pending) {
- SP->_fifohold = 5;
- _nc_flush();
+ SP_PARM->_fifohold = 5;
+ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
}
return FALSE;
}
/* put char at lower right corner */
static void
-PutCharLR(const ARG_CH_T ch)
+PutCharLR(NCURSES_SP_DCLx const ARG_CH_T ch)
{
if (!auto_right_margin) {
/* we can put the char directly */
- PutAttrChar(ch);
+ PutAttrChar(NCURSES_SP_ARGx ch);
} else if (enter_am_mode && exit_am_mode) {
/* we can suppress automargin */
TPUTS_TRACE("exit_am_mode");
- putp(exit_am_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_am_mode);
- PutAttrChar(ch);
- SP->_curscol--;
- position_check(SP->_cursrow, SP->_curscol, "exit_am_mode");
+ PutAttrChar(NCURSES_SP_ARGx ch);
+ SP_PARM->_curscol--;
+ position_check(SP_PARM,
+ SP_PARM->_cursrow,
+ SP_PARM->_curscol,
+ "exit_am_mode");
TPUTS_TRACE("enter_am_mode");
- putp(enter_am_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx enter_am_mode);
} else if ((enter_insert_mode && exit_insert_mode)
|| insert_character || parm_ich) {
- GoTo(screen_lines - 1, screen_columns - 2);
- PutAttrChar(ch);
- GoTo(screen_lines - 1, screen_columns - 2);
- InsStr(newscr->_line[screen_lines - 1].text + screen_columns - 2, 1);
+ GoTo(NCURSES_SP_ARGx
+ screen_lines(SP_PARM) - 1,
+ screen_columns(SP_PARM) - 2);
+ PutAttrChar(NCURSES_SP_ARGx ch);
+ GoTo(NCURSES_SP_ARGx
+ screen_lines(SP_PARM) - 1,
+ screen_columns(SP_PARM) - 2);
+ InsStr(NCURSES_SP_ARGx
+ NewScreen(SP_PARM)->_line[screen_lines(SP_PARM) - 1].text +
+ screen_columns(SP_PARM) - 2, 1);
}
}
@@ -391,7 +421,7 @@ PutCharLR(const ARG_CH_T ch)
* Wrap the cursor position, i.e., advance to the beginning of the next line.
*/
static void
-wrap_cursor(void)
+wrap_cursor(NCURSES_SP_DCL0)
{
if (eat_newline_glitch) {
/*
@@ -407,40 +437,45 @@ wrap_cursor(void)
* it's safe to just tell the code that the cursor is in hyperspace and
* let the next mvcur() call straighten things out.
*/
- SP->_curscol = -1;
- SP->_cursrow = -1;
+ SP_PARM->_curscol = -1;
+ SP_PARM->_cursrow = -1;
} else if (auto_right_margin) {
- SP->_curscol = 0;
- SP->_cursrow++;
+ SP_PARM->_curscol = 0;
+ SP_PARM->_cursrow++;
/*
* We've actually moved - but may have to work around problems with
* video attributes not working.
*/
- if (!move_standout_mode && AttrOf(SCREEN_ATTRS(SP))) {
+ if (!move_standout_mode && AttrOf(SCREEN_ATTRS(SP_PARM))) {
TR(TRACE_CHARPUT, ("turning off (%#lx) %s before wrapping",
- (unsigned long) AttrOf(SCREEN_ATTRS(SP)),
- _traceattr(AttrOf(SCREEN_ATTRS(SP)))));
- (void) VIDATTR(A_NORMAL, 0);
+ (unsigned long) AttrOf(SCREEN_ATTRS(SP_PARM)),
+ _traceattr(AttrOf(SCREEN_ATTRS(SP_PARM)))));
+ (void) VIDATTR(SP_PARM, A_NORMAL, 0);
}
} else {
- SP->_curscol--;
+ SP_PARM->_curscol--;
}
- position_check(SP->_cursrow, SP->_curscol, "wrap_cursor");
+ position_check(SP_PARM,
+ SP_PARM->_cursrow,
+ SP_PARM->_curscol,
+ "wrap_cursor");
}
static NCURSES_INLINE void
-PutChar(const ARG_CH_T ch)
+PutChar(NCURSES_SP_DCLx const ARG_CH_T ch)
/* insert character, handling automargin stuff */
{
- if (SP->_cursrow == screen_lines - 1 && SP->_curscol == screen_columns - 1)
- PutCharLR(ch);
- else
- PutAttrChar(ch);
+ if (SP_PARM->_cursrow == screen_lines(SP_PARM) - 1 &&
+ SP_PARM->_curscol == screen_columns(SP_PARM) - 1) {
+ PutCharLR(NCURSES_SP_ARGx ch);
+ } else {
+ PutAttrChar(NCURSES_SP_ARGx ch);
+ }
- if (SP->_curscol >= screen_columns)
- wrap_cursor();
+ if (SP_PARM->_curscol >= screen_columns(SP_PARM))
+ wrap_cursor(NCURSES_SP_ARG);
- position_check(SP->_cursrow, SP->_curscol, "PutChar");
+ position_check(SP_PARM, SP_PARM->_cursrow, SP_PARM->_curscol, "PutChar");
}
/*
@@ -450,19 +485,21 @@ PutChar(const ARG_CH_T ch)
* or can be output by clearing (A_COLOR in case of bce-terminal) are excluded.
*/
static NCURSES_INLINE bool
-can_clear_with(ARG_CH_T ch)
+can_clear_with(NCURSES_SP_DCLx ARG_CH_T ch)
{
- if (!back_color_erase && SP->_coloron) {
+ if (!back_color_erase && SP_PARM->_coloron) {
#if NCURSES_EXT_FUNCS
int pair;
- if (!SP->_default_color)
+ if (!SP_PARM->_default_color)
return FALSE;
- if (SP->_default_fg != C_MASK || SP->_default_bg != C_MASK)
+ if (SP_PARM->_default_fg != C_MASK || SP_PARM->_default_bg != C_MASK)
return FALSE;
if ((pair = GetPair(CHDEREF(ch))) != 0) {
short fg, bg;
- pair_content(pair, &fg, &bg);
+ NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx
+ (short) pair,
+ &fg, &bg);
if (fg != C_MASK || bg != C_MASK)
return FALSE;
}
@@ -488,7 +525,7 @@ can_clear_with(ARG_CH_T ch)
* This code is optimized using ech and rep.
*/
static int
-EmitRange(const NCURSES_CH_T * ntext, int num)
+EmitRange(NCURSES_SP_DCLx const NCURSES_CH_T * ntext, int num)
{
int i;
@@ -500,13 +537,13 @@ EmitRange(const NCURSES_CH_T * ntext, int num)
NCURSES_CH_T ntext0;
while (num > 1 && !CharEq(ntext[0], ntext[1])) {
- PutChar(CHREF(ntext[0]));
+ PutChar(NCURSES_SP_ARGx CHREF(ntext[0]));
ntext++;
num--;
}
ntext0 = ntext[0];
if (num == 1) {
- PutChar(CHREF(ntext0));
+ PutChar(NCURSES_SP_ARGx CHREF(ntext0));
return 0;
}
runcount = 2;
@@ -523,10 +560,11 @@ EmitRange(const NCURSES_CH_T * ntext, int num)
* which it would be marginally advantageous.
*/
if (erase_chars
- && runcount > SP->_ech_cost + SP->_cup_ch_cost
- && can_clear_with(CHREF(ntext0))) {
- UpdateAttrs(ntext0);
- putp(TPARM_1(erase_chars, runcount));
+ && runcount > SP_PARM->_ech_cost + SP_PARM->_cup_ch_cost
+ && can_clear_with(NCURSES_SP_ARGx CHREF(ntext0))) {
+ UpdateAttrs(SP_PARM, ntext0);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
+ TPARM_1(erase_chars, runcount));
/*
* If this is the last part of the given interval,
@@ -534,27 +572,34 @@ EmitRange(const NCURSES_CH_T * ntext, int num)
* last update on the line.
*/
if (runcount < num) {
- GoTo(SP->_cursrow, SP->_curscol + runcount);
+ GoTo(NCURSES_SP_ARGx
+ SP_PARM->_cursrow,
+ SP_PARM->_curscol + runcount);
} else {
return 1; /* cursor stays in the middle */
}
- } else if (repeat_char && runcount > SP->_rep_cost) {
- bool wrap_possible = (SP->_curscol + runcount >= screen_columns);
+ } else if (repeat_char && runcount > SP_PARM->_rep_cost) {
+ bool wrap_possible = (SP_PARM->_curscol + runcount >=
+ screen_columns(SP_PARM));
int rep_count = runcount;
if (wrap_possible)
rep_count--;
- UpdateAttrs(ntext0);
- tputs(TPARM_2(repeat_char, CharOf(ntext0), rep_count),
- rep_count, _nc_outch);
- SP->_curscol += rep_count;
+ UpdateAttrs(SP_PARM, ntext0);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_2(repeat_char,
+ CharOf(ntext0),
+ rep_count),
+ rep_count,
+ NCURSES_SP_NAME(_nc_outch));
+ SP_PARM->_curscol += rep_count;
if (wrap_possible)
- PutChar(CHREF(ntext0));
+ PutChar(NCURSES_SP_ARGx CHREF(ntext0));
} else {
for (i = 0; i < runcount; i++)
- PutChar(CHREF(ntext[i]));
+ PutChar(NCURSES_SP_ARGx CHREF(ntext[i]));
}
ntext += runcount;
num -= runcount;
@@ -563,7 +608,7 @@ EmitRange(const NCURSES_CH_T * ntext, int num)
}
for (i = 0; i < num; i++)
- PutChar(CHREF(ntext[i]));
+ PutChar(NCURSES_SP_ARGx CHREF(ntext[i]));
return 0;
}
@@ -576,39 +621,43 @@ EmitRange(const NCURSES_CH_T * ntext, int num)
* Returns: same as EmitRange
*/
static int
-PutRange(const NCURSES_CH_T * otext,
+PutRange(NCURSES_SP_DCLx
+ const NCURSES_CH_T * otext,
const NCURSES_CH_T * ntext,
int row,
int first, int last)
{
int i, j, same;
- TR(TRACE_CHARPUT, ("PutRange(%p, %p, %d, %d, %d)",
- otext, ntext, row, first, last));
+ TR(TRACE_CHARPUT, ("PutRange(%p, %p, %p, %d, %d, %d)",
+ (void *) SP_PARM,
+ (const void *) otext,
+ (const void *) ntext,
+ row, first, last));
if (otext != ntext
- && (last - first + 1) > SP->_inline_cost) {
+ && (last - first + 1) > SP_PARM->_inline_cost) {
for (j = first, same = 0; j <= last; j++) {
if (!same && isWidecExt(otext[j]))
continue;
if (CharEq(otext[j], ntext[j])) {
same++;
} else {
- if (same > SP->_inline_cost) {
- EmitRange(ntext + first, j - same - first);
- GoTo(row, first = j);
+ if (same > SP_PARM->_inline_cost) {
+ EmitRange(NCURSES_SP_ARGx ntext + first, j - same - first);
+ GoTo(NCURSES_SP_ARGx row, first = j);
}
same = 0;
}
}
- i = EmitRange(ntext + first, j - same - first);
+ i = EmitRange(NCURSES_SP_ARGx ntext + first, j - same - first);
/*
* Always return 1 for the next GoTo() after a PutRange() if we found
* identical characters at end of interval
*/
return (same == 0 ? i : 1);
}
- return EmitRange(ntext + first, last - first + 1);
+ return EmitRange(NCURSES_SP_ARGx ntext + first, last - first + 1);
}
/* leave unbracketed here so 'indent' works */
@@ -618,7 +667,7 @@ PutRange(const NCURSES_CH_T * otext,
if_USE_SCROLL_HINTS(win->_line[row].oldindex = row)
NCURSES_EXPORT(int)
-doupdate(void)
+TINFO_DOUPDATE(NCURSES_SP_DCL0)
{
int i;
int nonempty;
@@ -626,30 +675,49 @@ doupdate(void)
struct tms before, after;
#endif /* USE_TRACE_TIMES */
- T((T_CALLED("doupdate()")));
+ T((T_CALLED("_nc_tinfo:doupdate(%p)"), (void *) SP_PARM));
- if (curscr == 0
- || newscr == 0)
+#if !USE_REENTRANT
+ /*
+ * It is "legal" but unlikely that an application could assign a new
+ * value to one of the standard windows. Check for that possibility
+ * and try to recover.
+ *
+ * We do not allow applications to assign new values in the reentrant
+ * model.
+ */
+#define SyncScreens(internal,exported) \
+ if (internal == 0) internal = exported; \
+ if (internal != exported) exported = internal
+
+ SyncScreens(CurScreen(SP_PARM), curscr);
+ SyncScreens(NewScreen(SP_PARM), newscr);
+ SyncScreens(StdScreen(SP_PARM), stdscr);
+#endif
+
+ if (CurScreen(SP_PARM) == 0
+ || NewScreen(SP_PARM) == 0
+ || StdScreen(SP_PARM) == 0)
returnCode(ERR);
#ifdef TRACE
if (USE_TRACEF(TRACE_UPDATE)) {
- if (curscr->_clear)
+ if (CurScreen(SP_PARM)->_clear)
_tracef("curscr is clear");
else
- _tracedump("curscr", curscr);
- _tracedump("newscr", newscr);
+ _tracedump("curscr", CurScreen(SP_PARM));
+ _tracedump("newscr", NewScreen(SP_PARM));
_nc_unlock_global(tracef);
}
#endif /* TRACE */
_nc_signal_handler(FALSE);
- if (SP->_fifohold)
- SP->_fifohold--;
+ if (SP_PARM->_fifohold)
+ SP_PARM->_fifohold--;
#if USE_SIZECHANGE
- if (SP->_endwin || _nc_handle_sigwinch(SP)) {
+ if (SP_PARM->_endwin || _nc_handle_sigwinch(SP_PARM)) {
/*
* This is a transparent extension: XSI does not address it,
* and applications need not know that ncurses can do it.
@@ -658,20 +726,20 @@ doupdate(void)
* (this can happen in an xterm, for example), and resize the
* ncurses data structures accordingly.
*/
- _nc_update_screensize(SP);
+ _nc_update_screensize(SP_PARM);
}
#endif
- if (SP->_endwin) {
+ if (SP_PARM->_endwin) {
T(("coming back from shell mode"));
- reset_prog_mode();
+ NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_ARG);
- _nc_mvcur_resume();
- _nc_screen_resume();
- SP->_mouse_resume(SP);
+ NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_ARG);
+ SP_PARM->_mouse_resume(SP_PARM);
- SP->_endwin = FALSE;
+ SP_PARM->_endwin = FALSE;
}
#if USE_TRACE_TIMES
/* zero the metering machinery */
@@ -695,11 +763,11 @@ doupdate(void)
int j, k;
attr_t rattr = A_NORMAL;
- for (i = 0; i < screen_lines; i++) {
- for (j = 0; j < screen_columns; j++) {
+ for (i = 0; i < screen_lines(SP_PARM); i++) {
+ for (j = 0; j < screen_columns(SP_PARM); j++) {
bool failed = FALSE;
- NCURSES_CH_T *thisline = newscr->_line[i].text;
- attr_t thisattr = AttrOf(thisline[j]) & SP->_xmc_triggers;
+ NCURSES_CH_T *thisline = NewScreen(SP_PARM)->_line[i].text;
+ attr_t thisattr = AttrOf(thisline[j]) & SP_PARM->_xmc_triggers;
attr_t turnon = thisattr & ~rattr;
/* is an attribute turned on here? */
@@ -717,8 +785,8 @@ doupdate(void)
* there's enough room to set the attribute before the first
* non-blank in the run.
*/
-#define SAFE(a) (!((a) & SP->_xmc_triggers))
- if (ISBLANK(thisline[j]) && SAFE(turnon)) {
+#define SAFE(scr,a) (!((a) & (scr)->_xmc_triggers))
+ if (ISBLANK(thisline[j]) && SAFE(SP_PARM, turnon)) {
RemAttr(thisline[j], turnon);
continue;
}
@@ -727,14 +795,14 @@ doupdate(void)
for (k = 1; k <= magic_cookie_glitch; k++) {
if (j - k < 0
|| !ISBLANK(thisline[j - k])
- || !SAFE(AttrOf(thisline[j - k]))) {
+ || !SAFE(SP_PARM, AttrOf(thisline[j - k]))) {
failed = TRUE;
TR(TRACE_ATTRS, ("No room at start in %d,%d%s%s",
i, j - k,
(ISBLANK(thisline[j - k])
? ""
: ":nonblank"),
- (SAFE(AttrOf(thisline[j - k]))
+ (SAFE(SP_PARM, AttrOf(thisline[j - k]))
? ""
: ":unsafe")));
break;
@@ -745,10 +813,11 @@ doupdate(void)
int m, n = j;
/* find end of span, if it's onscreen */
- for (m = i; m < screen_lines; m++) {
- for (; n < screen_columns; n++) {
- attr_t testattr = AttrOf(newscr->_line[m].text[n]);
- if ((testattr & SP->_xmc_triggers) == rattr) {
+ for (m = i; m < screen_lines(SP_PARM); m++) {
+ for (; n < screen_columns(SP_PARM); n++) {
+ attr_t testattr =
+ AttrOf(NewScreen(SP_PARM)->_line[m].text[n]);
+ if ((testattr & SP_PARM->_xmc_triggers) == rattr) {
end_onscreen = TRUE;
TR(TRACE_ATTRS,
("Range attributed with %s ends at (%d, %d)",
@@ -764,7 +833,8 @@ doupdate(void)
foundit:;
if (end_onscreen) {
- NCURSES_CH_T *lastline = newscr->_line[m].text;
+ NCURSES_CH_T *lastline =
+ NewScreen(SP_PARM)->_line[m].text;
/*
* If there are safely-attributed blanks at the end of
@@ -773,15 +843,15 @@ doupdate(void)
*/
while (n >= 0
&& ISBLANK(lastline[n])
- && SAFE(AttrOf(lastline[n]))) {
+ && SAFE(SP_PARM, AttrOf(lastline[n]))) {
RemAttr(lastline[n--], turnon);
}
/* check that there's enough room at end of span */
for (k = 1; k <= magic_cookie_glitch; k++) {
- if (n + k >= screen_columns
+ if (n + k >= screen_columns(SP_PARM)
|| !ISBLANK(lastline[n + k])
- || !SAFE(AttrOf(lastline[n + k]))) {
+ || !SAFE(SP_PARM, AttrOf(lastline[n + k]))) {
failed = TRUE;
TR(TRACE_ATTRS,
("No room at end in %d,%d%s%s",
@@ -789,7 +859,7 @@ doupdate(void)
(ISBLANK(lastline[n + k])
? ""
: ":nonblank"),
- (SAFE(AttrOf(lastline[n + k]))
+ (SAFE(SP_PARM, AttrOf(lastline[n + k]))
? ""
: ":unsafe")));
break;
@@ -806,12 +876,12 @@ doupdate(void)
_traceattr(turnon), i, j));
/* turn off new attributes over span */
- for (p = i; p < screen_lines; p++) {
- for (; q < screen_columns; q++) {
+ for (p = i; p < screen_lines(SP_PARM); p++) {
+ for (; q < screen_columns(SP_PARM); q++) {
attr_t testattr = AttrOf(newscr->_line[p].text[q]);
- if ((testattr & SP->_xmc_triggers) == rattr)
+ if ((testattr & SP_PARM->_xmc_triggers) == rattr)
goto foundend;
- RemAttr(newscr->_line[p].text[q], turnon);
+ RemAttr(NewScreen(SP_PARM)->_line[p].text[q], turnon);
}
q = 0;
}
@@ -837,7 +907,7 @@ doupdate(void)
/* show altered highlights after magic-cookie check */
if (USE_TRACEF(TRACE_UPDATE)) {
_tracef("After magic-cookie check...");
- _tracedump("newscr", newscr);
+ _tracedump("newscr", NewScreen(SP_PARM));
_nc_unlock_global(tracef);
}
#endif /* TRACE */
@@ -845,23 +915,23 @@ doupdate(void)
#endif /* USE_XMC_SUPPORT */
nonempty = 0;
- if (curscr->_clear || newscr->_clear) { /* force refresh ? */
- ClrUpdate();
- curscr->_clear = FALSE; /* reset flag */
- newscr->_clear = FALSE; /* reset flag */
+ if (CurScreen(SP_PARM)->_clear || NewScreen(SP_PARM)->_clear) { /* force refresh ? */
+ ClrUpdate(NCURSES_SP_ARG);
+ CurScreen(SP_PARM)->_clear = FALSE; /* reset flag */
+ NewScreen(SP_PARM)->_clear = FALSE; /* reset flag */
} else {
int changedlines = CHECK_INTERVAL;
- if (check_pending())
+ if (check_pending(NCURSES_SP_ARG))
goto cleanup;
- nonempty = min(screen_lines, newscr->_maxy + 1);
+ nonempty = min(screen_lines(SP_PARM), NewScreen(SP_PARM)->_maxy + 1);
- if (SP->_scrolling) {
- _nc_scroll_optimize();
+ if (SP_PARM->_scrolling) {
+ NCURSES_SP_NAME(_nc_scroll_optimize) (NCURSES_SP_ARG);
}
- nonempty = ClrBottom(nonempty);
+ nonempty = ClrBottom(NCURSES_SP_ARGx nonempty);
TR(TRACE_UPDATE, ("Transforming lines, nonempty %d", nonempty));
for (i = 0; i < nonempty; i++) {
@@ -869,7 +939,7 @@ doupdate(void)
* Here is our line-breakout optimization.
*/
if (changedlines == CHECK_INTERVAL) {
- if (check_pending())
+ if (check_pending(NCURSES_SP_ARG))
goto cleanup;
changedlines = 0;
}
@@ -880,35 +950,35 @@ doupdate(void)
* is normally set by _nc_scroll_window in the
* vertical-movement optimization code,
*/
- if (newscr->_line[i].firstchar != _NOCHANGE
- || curscr->_line[i].firstchar != _NOCHANGE) {
- TransformLine(i);
+ if (NewScreen(SP_PARM)->_line[i].firstchar != _NOCHANGE
+ || CurScreen(SP_PARM)->_line[i].firstchar != _NOCHANGE) {
+ TransformLine(NCURSES_SP_ARGx i);
changedlines++;
}
/* mark line changed successfully */
- if (i <= newscr->_maxy) {
- MARK_NOCHANGE(newscr, i);
+ if (i <= NewScreen(SP_PARM)->_maxy) {
+ MARK_NOCHANGE(NewScreen(SP_PARM), i);
}
- if (i <= curscr->_maxy) {
- MARK_NOCHANGE(curscr, i);
+ if (i <= CurScreen(SP_PARM)->_maxy) {
+ MARK_NOCHANGE(CurScreen(SP_PARM), i);
}
}
}
/* put everything back in sync */
- for (i = nonempty; i <= newscr->_maxy; i++) {
- MARK_NOCHANGE(newscr, i);
+ for (i = nonempty; i <= NewScreen(SP_PARM)->_maxy; i++) {
+ MARK_NOCHANGE(NewScreen(SP_PARM), i);
}
- for (i = nonempty; i <= curscr->_maxy; i++) {
- MARK_NOCHANGE(curscr, i);
+ for (i = nonempty; i <= CurScreen(SP_PARM)->_maxy; i++) {
+ MARK_NOCHANGE(CurScreen(SP_PARM), i);
}
- if (!newscr->_leaveok) {
- curscr->_curx = newscr->_curx;
- curscr->_cury = newscr->_cury;
+ if (!NewScreen(SP_PARM)->_leaveok) {
+ CurScreen(SP_PARM)->_curx = NewScreen(SP_PARM)->_curx;
+ CurScreen(SP_PARM)->_cury = NewScreen(SP_PARM)->_cury;
- GoTo(curscr->_cury, curscr->_curx);
+ GoTo(NCURSES_SP_ARGx CurScreen(SP_PARM)->_cury, CurScreen(SP_PARM)->_curx);
}
cleanup:
@@ -921,10 +991,10 @@ doupdate(void)
#if USE_XMC_SUPPORT
if (magic_cookie_glitch != 0)
#endif
- UpdateAttrs(normal);
+ UpdateAttrs(SP_PARM, normal);
- _nc_flush();
- WINDOW_ATTRS(curscr) = WINDOW_ATTRS(newscr);
+ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
+ WINDOW_ATTRS(CurScreen(SP_PARM)) = WINDOW_ATTRS(NewScreen(SP_PARM));
#if USE_TRACE_TIMES
(void) times(&after);
@@ -940,6 +1010,14 @@ doupdate(void)
returnCode(OK);
}
+#if NCURSES_SP_FUNCS && !defined(USE_TERM_DRIVER)
+NCURSES_EXPORT(int)
+doupdate(void)
+{
+ return TINFO_DOUPDATE(CURRENT_SCREEN);
+}
+#endif
+
/*
* ClrBlank(win)
*
@@ -951,14 +1029,14 @@ doupdate(void)
* in the wbkgd() call. Assume 'stdscr' for this case.
*/
#define BCE_ATTRS (A_NORMAL|A_COLOR)
-#define BCE_BKGD(win) (((win) == curscr ? stdscr : (win))->_nc_bkgd)
+#define BCE_BKGD(sp,win) (((win) == CurScreen(sp) ? StdScreen(sp) : (win))->_nc_bkgd)
static NCURSES_INLINE NCURSES_CH_T
-ClrBlank(WINDOW *win)
+ClrBlank(NCURSES_SP_DCLx WINDOW *win)
{
NCURSES_CH_T blank = blankchar;
if (back_color_erase)
- AddAttr(blank, (AttrOf(BCE_BKGD(win)) & BCE_ATTRS));
+ AddAttr(blank, (AttrOf(BCE_BKGD(SP_PARM, win)) & BCE_ATTRS));
return blank;
}
@@ -970,23 +1048,24 @@ ClrBlank(WINDOW *win)
*/
static void
-ClrUpdate(void)
+ClrUpdate(NCURSES_SP_DCL0)
{
- int i;
- NCURSES_CH_T blank = ClrBlank(stdscr);
- int nonempty = min(screen_lines, newscr->_maxy + 1);
-
TR(TRACE_UPDATE, (T_CALLED("ClrUpdate")));
+ if (0 != SP_PARM) {
+ int i;
+ NCURSES_CH_T blank = ClrBlank(NCURSES_SP_ARGx StdScreen(SP_PARM));
+ int nonempty = min(screen_lines(SP_PARM),
+ NewScreen(SP_PARM)->_maxy + 1);
- ClearScreen(blank);
-
- TR(TRACE_UPDATE, ("updating screen from scratch"));
+ ClearScreen(NCURSES_SP_ARGx blank);
- nonempty = ClrBottom(nonempty);
+ TR(TRACE_UPDATE, ("updating screen from scratch"));
- for (i = 0; i < nonempty; i++)
- TransformLine(i);
+ nonempty = ClrBottom(NCURSES_SP_ARGx nonempty);
+ for (i = 0; i < nonempty; i++)
+ TransformLine(NCURSES_SP_ARGx i);
+ }
TR(TRACE_UPDATE, (T_RETURN("")));
}
@@ -997,35 +1076,36 @@ ClrUpdate(void)
*/
static void
-ClrToEOL(NCURSES_CH_T blank, bool needclear)
+ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, bool needclear)
{
int j;
- if (curscr != 0
- && SP->_cursrow >= 0) {
- for (j = SP->_curscol; j < screen_columns; j++) {
- if (j >= 0) {
- NCURSES_CH_T *cp = &(curscr->_line[SP->_cursrow].text[j]);
-
- if (!CharEq(*cp, blank)) {
- *cp = blank;
- needclear = TRUE;
+ if (SP_PARM != 0) {
+ if (CurScreen(SP_PARM) != 0
+ && SP_PARM->_cursrow >= 0) {
+ for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) {
+ if (j >= 0) {
+ NCURSES_CH_T *cp =
+ &(CurScreen(SP_PARM)->_line[SP_PARM->_cursrow].text[j]);
+
+ if (!CharEq(*cp, blank)) {
+ *cp = blank;
+ needclear = TRUE;
+ }
}
}
}
- } else {
- needclear = TRUE;
}
- if (needclear) {
- UpdateAttrs(blank);
+ if (needclear && (SP_PARM != 0)) {
+ UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("clr_eol");
- if (clr_eol && SP->_el_cost <= (screen_columns - SP->_curscol)) {
- putp(clr_eol);
+ if (clr_eol && SP_PARM->_el_cost <= (screen_columns(SP_PARM) - SP_PARM->_curscol)) {
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol);
} else {
- int count = (screen_columns - SP->_curscol);
+ int count = (screen_columns(SP_PARM) - SP_PARM->_curscol);
while (count-- > 0)
- PutChar(CHREF(blank));
+ PutChar(NCURSES_SP_ARGx CHREF(blank));
}
}
}
@@ -1037,23 +1117,29 @@ ClrToEOL(NCURSES_CH_T blank, bool needclear)
*/
static void
-ClrToEOS(NCURSES_CH_T blank)
+ClrToEOS(NCURSES_SP_DCLx NCURSES_CH_T blank)
{
int row, col;
- row = SP->_cursrow;
- col = SP->_curscol;
+ if (0 == SP_PARM)
+ return;
+
+ row = SP_PARM->_cursrow;
+ col = SP_PARM->_curscol;
- UpdateAttrs(blank);
+ UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("clr_eos");
- tputs(clr_eos, screen_lines - row, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ clr_eos,
+ screen_lines(SP_PARM) - row,
+ NCURSES_SP_NAME(_nc_outch));
- while (col < screen_columns)
- curscr->_line[row].text[col++] = blank;
+ while (col < screen_columns(SP_PARM))
+ CurScreen(SP_PARM)->_line[row].text[col++] = blank;
- for (row++; row < screen_lines; row++) {
- for (col = 0; col < screen_columns; col++)
- curscr->_line[row].text[col] = blank;
+ for (row++; row < screen_lines(SP_PARM); row++) {
+ for (col = 0; col < screen_columns(SP_PARM); col++)
+ CurScreen(SP_PARM)->_line[row].text[col] = blank;
}
}
@@ -1065,26 +1151,26 @@ ClrToEOS(NCURSES_CH_T blank)
* screen, checking if each is blank, and one or more are changed.
*/
static int
-ClrBottom(int total)
+ClrBottom(NCURSES_SP_DCLx int total)
{
int row;
int col;
int top = total;
- int last = min(screen_columns, newscr->_maxx + 1);
- NCURSES_CH_T blank = newscr->_line[total - 1].text[last - 1];
+ int last = min(screen_columns(SP_PARM), NewScreen(SP_PARM)->_maxx + 1);
+ NCURSES_CH_T blank = NewScreen(SP_PARM)->_line[total - 1].text[last - 1];
bool ok;
- if (clr_eos && can_clear_with(CHREF(blank))) {
+ if (clr_eos && can_clear_with(NCURSES_SP_ARGx CHREF(blank))) {
for (row = total - 1; row >= 0; row--) {
for (col = 0, ok = TRUE; ok && col < last; col++) {
- ok = (CharEq(newscr->_line[row].text[col], blank));
+ ok = (CharEq(NewScreen(SP_PARM)->_line[row].text[col], blank));
}
if (!ok)
break;
for (col = 0; ok && col < last; col++) {
- ok = (CharEq(curscr->_line[row].text[col], blank));
+ ok = (CharEq(CurScreen(SP_PARM)->_line[row].text[col], blank));
}
if (!ok)
top = row;
@@ -1092,11 +1178,11 @@ ClrBottom(int total)
/* don't use clr_eos for just one line if clr_eol available */
if (top < total) {
- GoTo(top, 0);
- ClrToEOS(blank);
- if (SP->oldhash && SP->newhash) {
- for (row = top; row < screen_lines; row++)
- SP->oldhash[row] = SP->newhash[row];
+ GoTo(NCURSES_SP_ARGx top, 0);
+ ClrToEOS(NCURSES_SP_ARGx blank);
+ if (SP_PARM->oldhash && SP_PARM->newhash) {
+ for (row = top; row < screen_lines(SP_PARM); row++)
+ SP_PARM->oldhash[row] = SP_PARM->newhash[row];
}
}
}
@@ -1105,22 +1191,22 @@ ClrBottom(int total)
#if USE_XMC_SUPPORT
#if USE_WIDEC_SUPPORT
-#define check_xmc_transition(a, b) \
- ((((a)->attr ^ (b)->attr) & ~((a)->attr) & SP->_xmc_triggers) != 0)
-#define xmc_turn_on(a,b) check_xmc_transition(&(a), &(b))
+#define check_xmc_transition(sp, a, b) \
+ ((((a)->attr ^ (b)->attr) & ~((a)->attr) & (sp)->_xmc_triggers) != 0)
+#define xmc_turn_on(sp,a,b) check_xmc_transition(sp,&(a), &(b))
#else
-#define xmc_turn_on(a,b) ((((a)^(b)) & ~(a) & SP->_xmc_triggers) != 0)
+#define xmc_turn_on(sp,a,b) ((((a)^(b)) & ~(a) & (sp)->_xmc_triggers) != 0)
#endif
-#define xmc_new(r,c) newscr->_line[r].text[c]
-#define xmc_turn_off(a,b) xmc_turn_on(b,a)
+#define xmc_new(sp,r,c) NewScreen(sp)->_line[r].text[c]
+#define xmc_turn_off(sp,a,b) xmc_turn_on(sp,b,a)
#endif /* USE_XMC_SUPPORT */
/*
** TransformLine(lineno)
**
** Transform the given line in curscr to the one in newscr, using
-** Insert/Delete Character if _nc_idcok && has_ic().
+** Insert/Delete Character if idcok && has_ic().
**
** firstChar = position of first different character in line
** oLastChar = position of last different character in old line
@@ -1135,19 +1221,19 @@ ClrBottom(int total)
*/
static void
-TransformLine(int const lineno)
+TransformLine(NCURSES_SP_DCLx int const lineno)
{
int firstChar, oLastChar, nLastChar;
- NCURSES_CH_T *newLine = newscr->_line[lineno].text;
- NCURSES_CH_T *oldLine = curscr->_line[lineno].text;
+ NCURSES_CH_T *newLine = NewScreen(SP_PARM)->_line[lineno].text;
+ NCURSES_CH_T *oldLine = CurScreen(SP_PARM)->_line[lineno].text;
int n;
bool attrchanged = FALSE;
- TR(TRACE_UPDATE, (T_CALLED("TransformLine(%d)"), lineno));
+ TR(TRACE_UPDATE, (T_CALLED("TransformLine(%p, %d)"), (void *) SP_PARM, lineno));
/* copy new hash value to old one */
- if (SP->oldhash && SP->newhash)
- SP->oldhash[lineno] = SP->newhash[lineno];
+ if (SP_PARM->oldhash && SP_PARM->newhash)
+ SP_PARM->oldhash[lineno] = SP_PARM->newhash[lineno];
/*
* If we have colors, there is the possibility of having two color pairs
@@ -1155,19 +1241,20 @@ TransformLine(int const lineno)
* for this case, and update the old line with the new line's colors when
* they are equivalent.
*/
- if (SP->_coloron) {
+ if (SP_PARM->_coloron) {
int oldPair;
int newPair;
- for (n = 0; n < screen_columns; n++) {
+ for (n = 0; n < screen_columns(SP_PARM); n++) {
if (!CharEq(newLine[n], oldLine[n])) {
oldPair = GetPair(oldLine[n]);
newPair = GetPair(newLine[n]);
if (oldPair != newPair
&& unColor(oldLine[n]) == unColor(newLine[n])) {
- if (oldPair < COLOR_PAIRS
- && newPair < COLOR_PAIRS
- && SP->_color_pairs[oldPair] == SP->_color_pairs[newPair]) {
+ if (oldPair < SP_PARM->_pair_limit
+ && newPair < SP_PARM->_pair_limit
+ && (SP_PARM->_color_pairs[oldPair] ==
+ SP_PARM->_color_pairs[newPair])) {
SetPair(oldLine[n], GetPair(newLine[n]));
}
}
@@ -1177,7 +1264,7 @@ TransformLine(int const lineno)
if (ceol_standout_glitch && clr_eol) {
firstChar = 0;
- while (firstChar < screen_columns) {
+ while (firstChar < screen_columns(SP_PARM)) {
if (!SameAttrOf(newLine[firstChar], oldLine[firstChar])) {
attrchanged = TRUE;
break;
@@ -1189,9 +1276,13 @@ TransformLine(int const lineno)
firstChar = 0;
if (attrchanged) { /* we may have to disregard the whole line */
- GoTo(lineno, firstChar);
- ClrToEOL(ClrBlank(curscr), FALSE);
- PutRange(oldLine, newLine, lineno, 0, (screen_columns - 1));
+ GoTo(NCURSES_SP_ARGx lineno, firstChar);
+ ClrToEOL(NCURSES_SP_ARGx
+ ClrBlank(NCURSES_SP_ARGx
+ CurScreen(SP_PARM)), FALSE);
+ PutRange(NCURSES_SP_ARGx
+ oldLine, newLine, lineno, 0,
+ screen_columns(SP_PARM) - 1);
#if USE_XMC_SUPPORT
/*
@@ -1206,8 +1297,8 @@ TransformLine(int const lineno)
* following operation.
*/
} else if (magic_cookie_glitch > 0) {
- GoTo(lineno, firstChar);
- for (n = 0; n < screen_columns; n++) {
+ GoTo(NCURSES_SP_ARGx lineno, firstChar);
+ for (n = 0; n < screen_columns(SP_PARM); n++) {
int m = n + magic_cookie_glitch;
/* check for turn-on:
@@ -1216,26 +1307,30 @@ TransformLine(int const lineno)
*/
if (ISBLANK(newLine[n])
&& ((n > 0
- && xmc_turn_on(newLine[n - 1], newLine[n]))
+ && xmc_turn_on(SP_PARM, newLine[n - 1], newLine[n]))
|| (n == 0
&& lineno > 0
- && xmc_turn_on(xmc_new(lineno - 1, screen_columns - 1),
+ && xmc_turn_on(SP_PARM,
+ xmc_new(SP_PARM, lineno - 1,
+ screen_columns(SP_PARM) - 1),
newLine[n])))) {
n = m;
}
- PutChar(CHREF(newLine[n]));
+ PutChar(NCURSES_SP_ARGx CHREF(newLine[n]));
/* check for turn-off:
* If we are writing an attributed non-blank, where the
* next cell is blank, and not attributed.
*/
if (!ISBLANK(newLine[n])
- && ((n + 1 < screen_columns
- && xmc_turn_off(newLine[n], newLine[n + 1]))
- || (n + 1 >= screen_columns
- && lineno + 1 < screen_lines
- && xmc_turn_off(newLine[n], xmc_new(lineno + 1, 0))))) {
+ && ((n + 1 < screen_columns(SP_PARM)
+ && xmc_turn_off(SP_PARM, newLine[n], newLine[n + 1]))
+ || (n + 1 >= screen_columns(SP_PARM)
+ && lineno + 1 < screen_lines(SP_PARM)
+ && xmc_turn_off(SP_PARM,
+ newLine[n],
+ xmc_new(SP_PARM, lineno + 1, 0))))) {
n = m;
}
@@ -1246,38 +1341,42 @@ TransformLine(int const lineno)
/* it may be cheap to clear leading whitespace with clr_bol */
blank = newLine[0];
- if (clr_bol && can_clear_with(CHREF(blank))) {
+ if (clr_bol && can_clear_with(NCURSES_SP_ARGx CHREF(blank))) {
int oFirstChar, nFirstChar;
- for (oFirstChar = 0; oFirstChar < screen_columns; oFirstChar++)
+ for (oFirstChar = 0;
+ oFirstChar < screen_columns(SP_PARM);
+ oFirstChar++)
if (!CharEq(oldLine[oFirstChar], blank))
break;
- for (nFirstChar = 0; nFirstChar < screen_columns; nFirstChar++)
+ for (nFirstChar = 0;
+ nFirstChar < screen_columns(SP_PARM);
+ nFirstChar++)
if (!CharEq(newLine[nFirstChar], blank))
break;
if (nFirstChar == oFirstChar) {
firstChar = nFirstChar;
/* find the first differing character */
- while (firstChar < screen_columns
+ while (firstChar < screen_columns(SP_PARM)
&& CharEq(newLine[firstChar], oldLine[firstChar]))
firstChar++;
} else if (oFirstChar > nFirstChar) {
firstChar = nFirstChar;
} else { /* oFirstChar < nFirstChar */
firstChar = oFirstChar;
- if (SP->_el1_cost < nFirstChar - oFirstChar) {
- if (nFirstChar >= screen_columns
- && SP->_el_cost <= SP->_el1_cost) {
- GoTo(lineno, 0);
- UpdateAttrs(blank);
+ if (SP_PARM->_el1_cost < nFirstChar - oFirstChar) {
+ if (nFirstChar >= screen_columns(SP_PARM)
+ && SP_PARM->_el_cost <= SP_PARM->_el1_cost) {
+ GoTo(NCURSES_SP_ARGx lineno, 0);
+ UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("clr_eol");
- putp(clr_eol);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol);
} else {
- GoTo(lineno, nFirstChar - 1);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx lineno, nFirstChar - 1);
+ UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("clr_bol");
- putp(clr_bol);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_bol);
}
while (firstChar < nFirstChar)
@@ -1286,64 +1385,81 @@ TransformLine(int const lineno)
}
} else {
/* find the first differing character */
- while (firstChar < screen_columns
+ while (firstChar < screen_columns(SP_PARM)
&& CharEq(newLine[firstChar], oldLine[firstChar]))
firstChar++;
}
/* if there wasn't one, we're done */
- if (firstChar >= screen_columns) {
+ if (firstChar >= screen_columns(SP_PARM)) {
TR(TRACE_UPDATE, (T_RETURN("")));
return;
}
- blank = newLine[screen_columns - 1];
+ blank = newLine[screen_columns(SP_PARM) - 1];
- if (!can_clear_with(CHREF(blank))) {
+ if (!can_clear_with(NCURSES_SP_ARGx CHREF(blank))) {
/* find the last differing character */
- nLastChar = screen_columns - 1;
+ nLastChar = screen_columns(SP_PARM) - 1;
while (nLastChar > firstChar
&& CharEq(newLine[nLastChar], oldLine[nLastChar]))
nLastChar--;
if (nLastChar >= firstChar) {
- GoTo(lineno, firstChar);
- PutRange(oldLine, newLine, lineno, firstChar, nLastChar);
+ GoTo(NCURSES_SP_ARGx lineno, firstChar);
+ PutRange(NCURSES_SP_ARGx
+ oldLine,
+ newLine,
+ lineno,
+ firstChar,
+ nLastChar);
memcpy(oldLine + firstChar,
newLine + firstChar,
- (nLastChar - firstChar + 1) * sizeof(NCURSES_CH_T));
+ (unsigned) (nLastChar - firstChar + 1) * sizeof(NCURSES_CH_T));
}
TR(TRACE_UPDATE, (T_RETURN("")));
return;
}
/* find last non-blank character on old line */
- oLastChar = screen_columns - 1;
+ oLastChar = screen_columns(SP_PARM) - 1;
while (oLastChar > firstChar && CharEq(oldLine[oLastChar], blank))
oLastChar--;
/* find last non-blank character on new line */
- nLastChar = screen_columns - 1;
+ nLastChar = screen_columns(SP_PARM) - 1;
while (nLastChar > firstChar && CharEq(newLine[nLastChar], blank))
nLastChar--;
if ((nLastChar == firstChar)
- && (SP->_el_cost < (oLastChar - nLastChar))) {
- GoTo(lineno, firstChar);
+ && (SP_PARM->_el_cost < (oLastChar - nLastChar))) {
+ GoTo(NCURSES_SP_ARGx lineno, firstChar);
if (!CharEq(newLine[firstChar], blank))
- PutChar(CHREF(newLine[firstChar]));
- ClrToEOL(blank, FALSE);
+ PutChar(NCURSES_SP_ARGx CHREF(newLine[firstChar]));
+ ClrToEOL(NCURSES_SP_ARGx blank, FALSE);
} else if ((nLastChar != oLastChar)
&& (!CharEq(newLine[nLastChar], oldLine[oLastChar])
- || !(_nc_idcok && has_ic()))) {
- GoTo(lineno, firstChar);
- if ((oLastChar - nLastChar) > SP->_el_cost) {
- if (PutRange(oldLine, newLine, lineno, firstChar, nLastChar))
- GoTo(lineno, nLastChar + 1);
- ClrToEOL(blank, FALSE);
+ || !(SP_PARM->_nc_sp_idcok
+ && NCURSES_SP_NAME(has_ic) (NCURSES_SP_ARG)))) {
+ GoTo(NCURSES_SP_ARGx lineno, firstChar);
+ if ((oLastChar - nLastChar) > SP_PARM->_el_cost) {
+ if (PutRange(NCURSES_SP_ARGx
+ oldLine,
+ newLine,
+ lineno,
+ firstChar,
+ nLastChar)) {
+ GoTo(NCURSES_SP_ARGx lineno, nLastChar + 1);
+ }
+ ClrToEOL(NCURSES_SP_ARGx blank, FALSE);
} else {
n = max(nLastChar, oLastChar);
- PutRange(oldLine, newLine, lineno, firstChar, n);
+ PutRange(NCURSES_SP_ARGx
+ oldLine,
+ newLine,
+ lineno,
+ firstChar,
+ n);
}
} else {
int nLastNonblank = nLastChar;
@@ -1364,8 +1480,13 @@ TransformLine(int const lineno)
n = min(oLastChar, nLastChar);
if (n >= firstChar) {
- GoTo(lineno, firstChar);
- PutRange(oldLine, newLine, lineno, firstChar, n);
+ GoTo(NCURSES_SP_ARGx lineno, firstChar);
+ PutRange(NCURSES_SP_ARGx
+ oldLine,
+ newLine,
+ lineno,
+ firstChar,
+ n);
}
if (oLastChar < nLastChar) {
@@ -1376,21 +1497,26 @@ TransformLine(int const lineno)
--oLastChar;
}
#endif
- GoTo(lineno, n + 1);
+ GoTo(NCURSES_SP_ARGx lineno, n + 1);
if ((nLastChar < nLastNonblank)
- || InsCharCost(nLastChar - oLastChar) > (m - n)) {
- PutRange(oldLine, newLine, lineno, n + 1, m);
+ || InsCharCost(SP_PARM, nLastChar - oLastChar) > (m - n)) {
+ PutRange(NCURSES_SP_ARGx
+ oldLine,
+ newLine,
+ lineno,
+ n + 1,
+ m);
} else {
- InsStr(&newLine[n + 1], nLastChar - oLastChar);
+ InsStr(NCURSES_SP_ARGx &newLine[n + 1], nLastChar - oLastChar);
}
} else if (oLastChar > nLastChar) {
- GoTo(lineno, n + 1);
- if (DelCharCost(oLastChar - nLastChar)
- > SP->_el_cost + nLastNonblank - (n + 1)) {
- if (PutRange(oldLine, newLine, lineno,
+ GoTo(NCURSES_SP_ARGx lineno, n + 1);
+ if (DelCharCost(SP_PARM, oLastChar - nLastChar)
+ > SP_PARM->_el_cost + nLastNonblank - (n + 1)) {
+ if (PutRange(NCURSES_SP_ARGx oldLine, newLine, lineno,
n + 1, nLastNonblank))
- GoTo(lineno, nLastNonblank + 1);
- ClrToEOL(blank, FALSE);
+ GoTo(NCURSES_SP_ARGx lineno, nLastNonblank + 1);
+ ClrToEOL(NCURSES_SP_ARGx blank, FALSE);
} else {
/*
* The delete-char sequence will
@@ -1400,18 +1526,18 @@ TransformLine(int const lineno)
* setting the video attributes from
* the last character on the row.
*/
- UpdateAttrs(blank);
- DelChar(oLastChar - nLastChar);
+ UpdateAttrs(SP_PARM, blank);
+ DelChar(NCURSES_SP_ARGx oLastChar - nLastChar);
}
}
}
}
/* update the code's internal representation */
- if (screen_columns > firstChar)
+ if (screen_columns(SP_PARM) > firstChar)
memcpy(oldLine + firstChar,
newLine + firstChar,
- (screen_columns - firstChar) * sizeof(NCURSES_CH_T));
+ (unsigned) (screen_columns(SP_PARM) - firstChar) * sizeof(NCURSES_CH_T));
TR(TRACE_UPDATE, (T_RETURN("")));
return;
}
@@ -1424,7 +1550,7 @@ TransformLine(int const lineno)
*/
static void
-ClearScreen(NCURSES_CH_T blank)
+ClearScreen(NCURSES_SP_DCLx NCURSES_CH_T blank)
{
int i, j;
bool fast_clear = (clear_screen || clr_eos || clr_eol);
@@ -1432,9 +1558,13 @@ ClearScreen(NCURSES_CH_T blank)
TR(TRACE_UPDATE, ("ClearScreen() called"));
#if NCURSES_EXT_FUNCS
- if (SP->_coloron
- && !SP->_default_color) {
- _nc_do_color(GET_SCREEN_PAIR(SP), 0, FALSE, _nc_outch);
+ if (SP_PARM->_coloron
+ && !SP_PARM->_default_color) {
+ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx
+ (short) GET_SCREEN_PAIR(SP_PARM),
+ 0,
+ FALSE,
+ NCURSES_SP_NAME(_nc_outch));
if (!back_color_erase) {
fast_clear = FALSE;
}
@@ -1443,42 +1573,46 @@ ClearScreen(NCURSES_CH_T blank)
if (fast_clear) {
if (clear_screen) {
- UpdateAttrs(blank);
+ UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("clear_screen");
- putp(clear_screen);
- SP->_cursrow = SP->_curscol = 0;
- position_check(SP->_cursrow, SP->_curscol, "ClearScreen");
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clear_screen);
+ SP_PARM->_cursrow = SP_PARM->_curscol = 0;
+ position_check(SP_PARM,
+ SP_PARM->_cursrow,
+ SP_PARM->_curscol,
+ "ClearScreen");
} else if (clr_eos) {
- SP->_cursrow = SP->_curscol = -1;
- GoTo(0, 0);
-
- UpdateAttrs(blank);
+ SP_PARM->_cursrow = SP_PARM->_curscol = -1;
+ GoTo(NCURSES_SP_ARGx 0, 0);
+ UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("clr_eos");
- tputs(clr_eos, screen_lines, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ clr_eos,
+ screen_lines(SP_PARM),
+ NCURSES_SP_NAME(_nc_outch));
} else if (clr_eol) {
- SP->_cursrow = SP->_curscol = -1;
-
- UpdateAttrs(blank);
- for (i = 0; i < screen_lines; i++) {
- GoTo(i, 0);
+ SP_PARM->_cursrow = SP_PARM->_curscol = -1;
+ UpdateAttrs(SP_PARM, blank);
+ for (i = 0; i < screen_lines(SP_PARM); i++) {
+ GoTo(NCURSES_SP_ARGx i, 0);
TPUTS_TRACE("clr_eol");
- putp(clr_eol);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol);
}
- GoTo(0, 0);
+ GoTo(NCURSES_SP_ARGx 0, 0);
}
} else {
- UpdateAttrs(blank);
- for (i = 0; i < screen_lines; i++) {
- GoTo(i, 0);
- for (j = 0; j < screen_columns; j++)
- PutChar(CHREF(blank));
+ UpdateAttrs(SP_PARM, blank);
+ for (i = 0; i < screen_lines(SP_PARM); i++) {
+ GoTo(NCURSES_SP_ARGx i, 0);
+ for (j = 0; j < screen_columns(SP_PARM); j++)
+ PutChar(NCURSES_SP_ARGx CHREF(blank));
}
- GoTo(0, 0);
+ GoTo(NCURSES_SP_ARGx 0, 0);
}
- for (i = 0; i < screen_lines; i++) {
- for (j = 0; j < screen_columns; j++)
- curscr->_line[i].text[j] = blank;
+ for (i = 0; i < screen_lines(SP_PARM); i++) {
+ for (j = 0; j < screen_columns(SP_PARM); j++)
+ CurScreen(SP_PARM)->_line[i].text[j] = blank;
}
TR(TRACE_UPDATE, ("screen cleared"));
@@ -1492,49 +1626,54 @@ ClearScreen(NCURSES_CH_T blank)
*/
static void
-InsStr(NCURSES_CH_T * line, int count)
+InsStr(NCURSES_SP_DCLx NCURSES_CH_T * line, int count)
{
- TR(TRACE_UPDATE, ("InsStr(%p,%d) called", line, count));
+ TR(TRACE_UPDATE, ("InsStr(%p, %p,%d) called",
+ (void *) SP_PARM,
+ (void *) line, count));
/* Prefer parm_ich as it has the smallest cost - no need to shift
* the whole line on each character. */
/* The order must match that of InsCharCost. */
if (parm_ich) {
TPUTS_TRACE("parm_ich");
- tputs(TPARM_1(parm_ich, count), count, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(parm_ich, count),
+ count,
+ NCURSES_SP_NAME(_nc_outch));
while (count) {
- PutAttrChar(CHREF(*line));
+ PutAttrChar(NCURSES_SP_ARGx CHREF(*line));
line++;
count--;
}
} else if (enter_insert_mode && exit_insert_mode) {
TPUTS_TRACE("enter_insert_mode");
- putp(enter_insert_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx enter_insert_mode);
while (count) {
- PutAttrChar(CHREF(*line));
+ PutAttrChar(NCURSES_SP_ARGx CHREF(*line));
if (insert_padding) {
TPUTS_TRACE("insert_padding");
- putp(insert_padding);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_padding);
}
line++;
count--;
}
TPUTS_TRACE("exit_insert_mode");
- putp(exit_insert_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_insert_mode);
} else {
while (count) {
TPUTS_TRACE("insert_character");
- putp(insert_character);
- PutAttrChar(CHREF(*line));
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_character);
+ PutAttrChar(NCURSES_SP_ARGx CHREF(*line));
if (insert_padding) {
TPUTS_TRACE("insert_padding");
- putp(insert_padding);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_padding);
}
line++;
count--;
}
}
- position_check(SP->_cursrow, SP->_curscol, "InsStr");
+ position_check(SP_PARM, SP_PARM->_cursrow, SP_PARM->_curscol, "InsStr");
}
/*
@@ -1545,22 +1684,25 @@ InsStr(NCURSES_CH_T * line, int count)
*/
static void
-DelChar(int count)
+DelChar(NCURSES_SP_DCLx int count)
{
int n;
- TR(TRACE_UPDATE, ("DelChar(%d) called, position = (%ld,%ld)",
- count,
- (long) newscr->_cury,
- (long) newscr->_curx));
+ TR(TRACE_UPDATE, ("DelChar(%p, %d) called, position = (%ld,%ld)",
+ (void *) SP_PARM, count,
+ (long) NewScreen(SP_PARM)->_cury,
+ (long) NewScreen(SP_PARM)->_curx));
if (parm_dch) {
TPUTS_TRACE("parm_dch");
- tputs(TPARM_1(parm_dch, count), count, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(parm_dch, count),
+ count,
+ NCURSES_SP_NAME(_nc_outch));
} else {
for (n = 0; n < count; n++) {
TPUTS_TRACE("delete_character");
- putp(delete_character);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_character);
}
}
}
@@ -1599,54 +1741,66 @@ DelChar(int count)
/* Try to scroll up assuming given csr (miny, maxy). Returns ERR on failure */
static int
-scroll_csr_forward(int n, int top, int bot, int miny, int maxy, NCURSES_CH_T blank)
+scroll_csr_forward(NCURSES_SP_DCLx
+ int n,
+ int top,
+ int bot,
+ int miny,
+ int maxy,
+ NCURSES_CH_T blank)
{
int i;
if (n == 1 && scroll_forward && top == miny && bot == maxy) {
- GoTo(bot, 0);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx bot, 0);
+ UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("scroll_forward");
- putp(scroll_forward);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_forward);
} else if (n == 1 && delete_line && bot == maxy) {
- GoTo(top, 0);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx top, 0);
+ UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("delete_line");
- putp(delete_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
} else if (parm_index && top == miny && bot == maxy) {
- GoTo(bot, 0);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx bot, 0);
+ UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("parm_index");
- tputs(TPARM_2(parm_index, n, 0), n, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_2(parm_index, n, 0),
+ n,
+ NCURSES_SP_NAME(_nc_outch));
} else if (parm_delete_line && bot == maxy) {
- GoTo(top, 0);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx top, 0);
+ UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("parm_delete_line");
- tputs(TPARM_2(parm_delete_line, n, 0), n, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_2(parm_delete_line, n, 0),
+ n,
+ NCURSES_SP_NAME(_nc_outch));
} else if (scroll_forward && top == miny && bot == maxy) {
- GoTo(bot, 0);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx bot, 0);
+ UpdateAttrs(SP_PARM, blank);
for (i = 0; i < n; i++) {
TPUTS_TRACE("scroll_forward");
- putp(scroll_forward);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_forward);
}
} else if (delete_line && bot == maxy) {
- GoTo(top, 0);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx top, 0);
+ UpdateAttrs(SP_PARM, blank);
for (i = 0; i < n; i++) {
TPUTS_TRACE("delete_line");
- putp(delete_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
}
} else
return ERR;
#if NCURSES_EXT_FUNCS
- if (FILL_BCE()) {
+ if (FILL_BCE(SP_PARM)) {
int j;
for (i = 0; i < n; i++) {
- GoTo(bot - i, 0);
- for (j = 0; j < screen_columns; j++)
- PutChar(CHREF(blank));
+ GoTo(NCURSES_SP_ARGx bot - i, 0);
+ for (j = 0; j < screen_columns(SP_PARM); j++)
+ PutChar(NCURSES_SP_ARGx CHREF(blank));
}
}
#endif
@@ -1656,55 +1810,66 @@ scroll_csr_forward(int n, int top, int bot, int miny, int maxy, NCURSES_CH_T bla
/* Try to scroll down assuming given csr (miny, maxy). Returns ERR on failure */
/* n > 0 */
static int
-scroll_csr_backward(int n, int top, int bot, int miny, int maxy,
+scroll_csr_backward(NCURSES_SP_DCLx
+ int n,
+ int top,
+ int bot,
+ int miny,
+ int maxy,
NCURSES_CH_T blank)
{
int i;
if (n == 1 && scroll_reverse && top == miny && bot == maxy) {
- GoTo(top, 0);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx top, 0);
+ UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("scroll_reverse");
- putp(scroll_reverse);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_reverse);
} else if (n == 1 && insert_line && bot == maxy) {
- GoTo(top, 0);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx top, 0);
+ UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("insert_line");
- putp(insert_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
} else if (parm_rindex && top == miny && bot == maxy) {
- GoTo(top, 0);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx top, 0);
+ UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("parm_rindex");
- tputs(TPARM_2(parm_rindex, n, 0), n, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_2(parm_rindex, n, 0),
+ n,
+ NCURSES_SP_NAME(_nc_outch));
} else if (parm_insert_line && bot == maxy) {
- GoTo(top, 0);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx top, 0);
+ UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("parm_insert_line");
- tputs(TPARM_2(parm_insert_line, n, 0), n, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_2(parm_insert_line, n, 0),
+ n,
+ NCURSES_SP_NAME(_nc_outch));
} else if (scroll_reverse && top == miny && bot == maxy) {
- GoTo(top, 0);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx top, 0);
+ UpdateAttrs(SP_PARM, blank);
for (i = 0; i < n; i++) {
TPUTS_TRACE("scroll_reverse");
- putp(scroll_reverse);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_reverse);
}
} else if (insert_line && bot == maxy) {
- GoTo(top, 0);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx top, 0);
+ UpdateAttrs(SP_PARM, blank);
for (i = 0; i < n; i++) {
TPUTS_TRACE("insert_line");
- putp(insert_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
}
} else
return ERR;
#if NCURSES_EXT_FUNCS
- if (FILL_BCE()) {
+ if (FILL_BCE(SP_PARM)) {
int j;
for (i = 0; i < n; i++) {
- GoTo(top + i, 0);
- for (j = 0; j < screen_columns; j++)
- PutChar(CHREF(blank));
+ GoTo(NCURSES_SP_ARGx top + i, 0);
+ for (j = 0; j < screen_columns(SP_PARM); j++)
+ PutChar(NCURSES_SP_ARGx CHREF(blank));
}
}
#endif
@@ -1714,40 +1879,46 @@ scroll_csr_backward(int n, int top, int bot, int miny, int maxy,
/* scroll by using delete_line at del and insert_line at ins */
/* n > 0 */
static int
-scroll_idl(int n, int del, int ins, NCURSES_CH_T blank)
+scroll_idl(NCURSES_SP_DCLx int n, int del, int ins, NCURSES_CH_T blank)
{
int i;
if (!((parm_delete_line || delete_line) && (parm_insert_line || insert_line)))
return ERR;
- GoTo(del, 0);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx del, 0);
+ UpdateAttrs(SP_PARM, blank);
if (n == 1 && delete_line) {
TPUTS_TRACE("delete_line");
- putp(delete_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
} else if (parm_delete_line) {
TPUTS_TRACE("parm_delete_line");
- tputs(TPARM_2(parm_delete_line, n, 0), n, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_2(parm_delete_line, n, 0),
+ n,
+ NCURSES_SP_NAME(_nc_outch));
} else { /* if (delete_line) */
for (i = 0; i < n; i++) {
TPUTS_TRACE("delete_line");
- putp(delete_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
}
}
- GoTo(ins, 0);
- UpdateAttrs(blank);
+ GoTo(NCURSES_SP_ARGx ins, 0);
+ UpdateAttrs(SP_PARM, blank);
if (n == 1 && insert_line) {
TPUTS_TRACE("insert_line");
- putp(insert_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
} else if (parm_insert_line) {
TPUTS_TRACE("parm_insert_line");
- tputs(TPARM_2(parm_insert_line, n, 0), n, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_2(parm_insert_line, n, 0),
+ n,
+ NCURSES_SP_NAME(_nc_outch));
} else { /* if (insert_line) */
for (i = 0; i < n; i++) {
TPUTS_TRACE("insert_line");
- putp(insert_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
}
}
@@ -1763,15 +1934,25 @@ scroll_idl(int n, int del, int ins, NCURSES_CH_T blank)
* save/restore cursor capabilities if the terminal has them.
*/
NCURSES_EXPORT(int)
-_nc_scrolln(int n, int top, int bot, int maxy)
+NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_DCLx
+ int n,
+ int top,
+ int bot,
+ int maxy)
/* scroll region from top to bot by n lines */
{
- NCURSES_CH_T blank = ClrBlank(stdscr);
+ NCURSES_CH_T blank;
int i;
bool cursor_saved = FALSE;
int res;
- TR(TRACE_MOVE, ("mvcur_scrolln(%d, %d, %d, %d)", n, top, bot, maxy));
+ TR(TRACE_MOVE, ("_nc_scrolln(%p, %d, %d, %d, %d)",
+ (void *) SP_PARM, n, top, bot, maxy));
+
+ if (!IsValidScreen(SP_PARM))
+ return (ERR);
+
+ blank = ClrBlank(NCURSES_SP_ARGx StdScreen(SP_PARM));
#if USE_XMC_SUPPORT
/*
@@ -1787,34 +1968,36 @@ _nc_scrolln(int n, int top, int bot, int maxy)
* Explicitly clear if stuff pushed off top of region might
* be saved by the terminal.
*/
- res = scroll_csr_forward(n, top, bot, 0, maxy, blank);
+ res = scroll_csr_forward(NCURSES_SP_ARGx n, top, bot, 0, maxy, blank);
if (res == ERR && change_scroll_region) {
if ((((n == 1 && scroll_forward) || parm_index)
- && (SP->_cursrow == bot || SP->_cursrow == bot - 1))
+ && (SP_PARM->_cursrow == bot || SP_PARM->_cursrow == bot - 1))
&& save_cursor && restore_cursor) {
cursor_saved = TRUE;
TPUTS_TRACE("save_cursor");
- putp(save_cursor);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx save_cursor);
}
TPUTS_TRACE("change_scroll_region");
- putp(TPARM_2(change_scroll_region, top, bot));
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
+ TPARM_2(change_scroll_region, top, bot));
if (cursor_saved) {
TPUTS_TRACE("restore_cursor");
- putp(restore_cursor);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx restore_cursor);
} else {
- SP->_cursrow = SP->_curscol = -1;
+ SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
- res = scroll_csr_forward(n, top, bot, top, bot, blank);
+ res = scroll_csr_forward(NCURSES_SP_ARGx n, top, bot, top, bot, blank);
TPUTS_TRACE("change_scroll_region");
- putp(TPARM_2(change_scroll_region, 0, maxy));
- SP->_cursrow = SP->_curscol = -1;
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
+ TPARM_2(change_scroll_region, 0, maxy));
+ SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
- if (res == ERR && _nc_idlok)
- res = scroll_idl(n, top, bot - n + 1, blank);
+ if (res == ERR && SP_PARM->_nc_sp_idlok)
+ res = scroll_idl(NCURSES_SP_ARGx n, top, bot - n + 1, blank);
/*
* Clear the newly shifted-in text.
@@ -1823,44 +2006,49 @@ _nc_scrolln(int n, int top, int bot, int maxy)
&& (non_dest_scroll_region || (memory_below && bot == maxy))) {
static const NCURSES_CH_T blank2 = NewChar(BLANK_TEXT);
if (bot == maxy && clr_eos) {
- GoTo(bot - n + 1, 0);
- ClrToEOS(blank2);
+ GoTo(NCURSES_SP_ARGx bot - n + 1, 0);
+ ClrToEOS(NCURSES_SP_ARGx blank2);
} else {
for (i = 0; i < n; i++) {
- GoTo(bot - i, 0);
- ClrToEOL(blank2, FALSE);
+ GoTo(NCURSES_SP_ARGx bot - i, 0);
+ ClrToEOL(NCURSES_SP_ARGx blank2, FALSE);
}
}
}
} else { /* (n < 0) - scroll down (backward) */
- res = scroll_csr_backward(-n, top, bot, 0, maxy, blank);
+ res = scroll_csr_backward(NCURSES_SP_ARGx -n, top, bot, 0, maxy, blank);
if (res == ERR && change_scroll_region) {
- if (top != 0 && (SP->_cursrow == top || SP->_cursrow == top - 1)
+ if (top != 0
+ && (SP_PARM->_cursrow == top ||
+ SP_PARM->_cursrow == top - 1)
&& save_cursor && restore_cursor) {
cursor_saved = TRUE;
TPUTS_TRACE("save_cursor");
- putp(save_cursor);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx save_cursor);
}
TPUTS_TRACE("change_scroll_region");
- putp(TPARM_2(change_scroll_region, top, bot));
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
+ TPARM_2(change_scroll_region, top, bot));
if (cursor_saved) {
TPUTS_TRACE("restore_cursor");
- putp(restore_cursor);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx restore_cursor);
} else {
- SP->_cursrow = SP->_curscol = -1;
+ SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
- res = scroll_csr_backward(-n, top, bot, top, bot, blank);
+ res = scroll_csr_backward(NCURSES_SP_ARGx
+ -n, top, bot, top, bot, blank);
TPUTS_TRACE("change_scroll_region");
- putp(TPARM_2(change_scroll_region, 0, maxy));
- SP->_cursrow = SP->_curscol = -1;
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
+ TPARM_2(change_scroll_region, 0, maxy));
+ SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
- if (res == ERR && _nc_idlok)
- res = scroll_idl(-n, bot + n + 1, top, blank);
+ if (res == ERR && SP_PARM->_nc_sp_idlok)
+ res = scroll_idl(NCURSES_SP_ARGx -n, bot + n + 1, top, blank);
/*
* Clear the newly shifted-in text.
@@ -1869,8 +2057,8 @@ _nc_scrolln(int n, int top, int bot, int maxy)
&& (non_dest_scroll_region || (memory_above && top == 0))) {
static const NCURSES_CH_T blank2 = NewChar(BLANK_TEXT);
for (i = 0; i < -n; i++) {
- GoTo(i + top, 0);
- ClrToEOL(blank2, FALSE);
+ GoTo(NCURSES_SP_ARGx i + top, 0);
+ ClrToEOL(NCURSES_SP_ARGx blank2, FALSE);
}
}
}
@@ -1878,99 +2066,163 @@ _nc_scrolln(int n, int top, int bot, int maxy)
if (res == ERR)
return (ERR);
- _nc_scroll_window(curscr, n, top, bot, blank);
+ _nc_scroll_window(CurScreen(SP_PARM), n,
+ (NCURSES_SIZE_T) top,
+ (NCURSES_SIZE_T) bot,
+ blank);
/* shift hash values too - they can be reused */
- _nc_scroll_oldhash(n, top, bot);
+ NCURSES_SP_NAME(_nc_scroll_oldhash) (NCURSES_SP_ARGx n, top, bot);
return (OK);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+_nc_scrolln(int n, int top, int bot, int maxy)
+{
+ return NCURSES_SP_NAME(_nc_scrolln) (CURRENT_SCREEN, n, top, bot, maxy);
+}
+#endif
+
NCURSES_EXPORT(void)
-_nc_screen_resume(void)
+NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_DCL0)
{
+ assert(SP_PARM);
+
/* make sure terminal is in a sane known state */
- SetAttr(SCREEN_ATTRS(SP), A_NORMAL);
- newscr->_clear = TRUE;
+ SetAttr(SCREEN_ATTRS(SP_PARM), A_NORMAL);
+ NewScreen(SP_PARM)->_clear = TRUE;
/* reset color pairs and definitions */
- if (SP->_coloron || SP->_color_defs)
- _nc_reset_colors();
+ if (SP_PARM->_coloron || SP_PARM->_color_defs)
+ NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG);
/* restore user-defined colors, if any */
- if (SP->_color_defs < 0) {
+ if (SP_PARM->_color_defs < 0) {
int n;
- SP->_color_defs = -(SP->_color_defs);
- for (n = 0; n < SP->_color_defs; ++n) {
- if (SP->_color_table[n].init) {
- init_color(n,
- SP->_color_table[n].r,
- SP->_color_table[n].g,
- SP->_color_table[n].b);
+ SP_PARM->_color_defs = -(SP_PARM->_color_defs);
+ for (n = 0; n < SP_PARM->_color_defs; ++n) {
+ if (SP_PARM->_color_table[n].init) {
+ NCURSES_SP_NAME(init_color) (NCURSES_SP_ARGx
+ (short) n,
+ SP_PARM->_color_table[n].r,
+ SP_PARM->_color_table[n].g,
+ SP_PARM->_color_table[n].b);
}
}
}
if (exit_attribute_mode)
- putp(exit_attribute_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_attribute_mode);
else {
/* turn off attributes */
if (exit_alt_charset_mode)
- putp(exit_alt_charset_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_alt_charset_mode);
if (exit_standout_mode)
- putp(exit_standout_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_standout_mode);
if (exit_underline_mode)
- putp(exit_underline_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_underline_mode);
}
if (exit_insert_mode)
- putp(exit_insert_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_insert_mode);
if (enter_am_mode && exit_am_mode)
- putp(auto_right_margin ? enter_am_mode : exit_am_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
+ (auto_right_margin
+ ? enter_am_mode
+ : exit_am_mode));
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_screen_resume(void)
+{
+ NCURSES_SP_NAME(_nc_screen_resume) (CURRENT_SCREEN);
+}
+#endif
+
+NCURSES_EXPORT(void)
+NCURSES_SP_NAME(_nc_screen_init) (NCURSES_SP_DCL0)
+{
+ NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_ARG);
+}
+
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(void)
_nc_screen_init(void)
{
- _nc_screen_resume();
+ NCURSES_SP_NAME(_nc_screen_init) (CURRENT_SCREEN);
}
+#endif
/* wrap up screen handling */
NCURSES_EXPORT(void)
-_nc_screen_wrap(void)
+NCURSES_SP_NAME(_nc_screen_wrap) (NCURSES_SP_DCL0)
{
- UpdateAttrs(normal);
+ if (SP_PARM == 0)
+ return;
+
+ UpdateAttrs(SP_PARM, normal);
#if NCURSES_EXT_FUNCS
- if (SP->_coloron
- && !SP->_default_color) {
+ if (SP_PARM->_coloron
+ && !SP_PARM->_default_color) {
static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
- SP->_default_color = TRUE;
- _nc_do_color(-1, 0, FALSE, _nc_outch);
- SP->_default_color = FALSE;
-
- mvcur(SP->_cursrow, SP->_curscol, screen_lines - 1, 0);
-
- ClrToEOL(blank, TRUE);
+ SP_PARM->_default_color = TRUE;
+ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx
+ -1,
+ 0,
+ FALSE,
+ NCURSES_SP_NAME(_nc_outch));
+ SP_PARM->_default_color = FALSE;
+
+ TINFO_MVCUR(NCURSES_SP_ARGx
+ SP_PARM->_cursrow,
+ SP_PARM->_curscol,
+ screen_lines(SP_PARM) - 1,
+ 0);
+
+ ClrToEOL(NCURSES_SP_ARGx blank, TRUE);
}
#endif
- if (SP->_color_defs) {
- _nc_reset_colors();
+ if (SP_PARM->_color_defs) {
+ NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG);
}
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_screen_wrap(void)
+{
+ NCURSES_SP_NAME(_nc_screen_wrap) (CURRENT_SCREEN);
+}
+#endif
+
#if USE_XMC_SUPPORT
NCURSES_EXPORT(void)
-_nc_do_xmc_glitch(attr_t previous)
+NCURSES_SP_NAME(_nc_do_xmc_glitch) (NCURSES_SP_DCLx attr_t previous)
{
- attr_t chg = XMC_CHANGES(previous ^ AttrOf(SCREEN_ATTRS(SP)));
-
- while (chg != 0) {
- if (chg & 1) {
- SP->_curscol += magic_cookie_glitch;
- if (SP->_curscol >= SP->_columns)
- wrap_cursor();
- TR(TRACE_UPDATE, ("bumped to %d,%d after cookie", SP->_cursrow, SP->_curscol));
+ if (SP_PARM != 0) {
+ attr_t chg = XMC_CHANGES(previous ^ AttrOf(SCREEN_ATTRS(SP_PARM)));
+
+ while (chg != 0) {
+ if (chg & 1) {
+ SP_PARM->_curscol += magic_cookie_glitch;
+ if (SP_PARM->_curscol >= SP_PARM->_columns)
+ wrap_cursor(NCURSES_SP_ARG);
+ TR(TRACE_UPDATE, ("bumped to %d,%d after cookie",
+ SP_PARM->_cursrow, SP_PARM->_curscol));
+ }
+ chg >>= 1;
}
- chg >>= 1;
}
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_do_xmc_glitch(attr_t previous)
+{
+ NCURSES_SP_NAME(_nc_do_xmc_glitch) (CURRENT_SCREEN, previous);
+}
+#endif
+
#endif /* USE_XMC_SUPPORT */
diff --git a/contrib/ncurses/ncurses/wcwidth.h b/contrib/ncurses/ncurses/wcwidth.h
new file mode 100644
index 000000000000..61e822ad679f
--- /dev/null
+++ b/contrib/ncurses/ncurses/wcwidth.h
@@ -0,0 +1,309 @@
+/*
+ * This is an implementation of wcwidth() and wcswidth() (defined in
+ * IEEE Std 1002.1-2001) for Unicode.
+ *
+ * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html
+ * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html
+ *
+ * In fixed-width output devices, Latin characters all occupy a single
+ * "cell" position of equal width, whereas ideographic CJK characters
+ * occupy two such cells. Interoperability between terminal-line
+ * applications and (teletype-style) character terminals using the
+ * UTF-8 encoding requires agreement on which character should advance
+ * the cursor by how many cell positions. No established formal
+ * standards exist at present on which Unicode character shall occupy
+ * how many cell positions on character terminals. These routines are
+ * a first attempt of defining such behavior based on simple rules
+ * applied to data provided by the Unicode Consortium.
+ *
+ * For some graphical characters, the Unicode standard explicitly
+ * defines a character-cell width via the definition of the East Asian
+ * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes.
+ * In all these cases, there is no ambiguity about which width a
+ * terminal shall use. For characters in the East Asian Ambiguous (A)
+ * class, the width choice depends purely on a preference of backward
+ * compatibility with either historic CJK or Western practice.
+ * Choosing single-width for these characters is easy to justify as
+ * the appropriate long-term solution, as the CJK practice of
+ * displaying these characters as double-width comes from historic
+ * implementation simplicity (8-bit encoded characters were displayed
+ * single-width and 16-bit ones double-width, even for Greek,
+ * Cyrillic, etc.) and not any typographic considerations.
+ *
+ * Much less clear is the choice of width for the Not East Asian
+ * (Neutral) class. Existing practice does not dictate a width for any
+ * of these characters. It would nevertheless make sense
+ * typographically to allocate two character cells to characters such
+ * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be
+ * represented adequately with a single-width glyph. The following
+ * routines at present merely assign a single-cell width to all
+ * neutral characters, in the interest of simplicity. This is not
+ * entirely satisfactory and should be reconsidered before
+ * establishing a formal standard in this area. At the moment, the
+ * decision which Not East Asian (Neutral) characters should be
+ * represented by double-width glyphs cannot yet be answered by
+ * applying a simple rule from the Unicode database content. Setting
+ * up a proper standard for the behavior of UTF-8 character terminals
+ * will require a careful analysis not only of each Unicode character,
+ * but also of each presentation form, something the author of these
+ * routines has avoided to do so far.
+ *
+ * http://www.unicode.org/unicode/reports/tr11/
+ *
+ * Markus Kuhn -- 2007-05-26 (Unicode 5.0)
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * for any purpose and without fee is hereby granted. The author
+ * disclaims all warranties with regard to this software.
+ *
+ * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
+ */
+
+#include <wchar.h>
+
+struct interval {
+ int first;
+ int last;
+};
+
+/* auxiliary function for binary search in interval table */
+static int bisearch(wchar_t ucs, const struct interval *table, int max) {
+ int min = 0;
+ int mid;
+
+ if (ucs < table[0].first || ucs > table[max].last)
+ return 0;
+ while (max >= min) {
+ mid = (min + max) / 2;
+ if (ucs > table[mid].last)
+ min = mid + 1;
+ else if (ucs < table[mid].first)
+ max = mid - 1;
+ else
+ return 1;
+ }
+
+ return 0;
+}
+
+
+/* The following two functions define the column width of an ISO 10646
+ * character as follows:
+ *
+ * - The null character (U+0000) has a column width of 0.
+ *
+ * - Other C0/C1 control characters and DEL will lead to a return
+ * value of -1.
+ *
+ * - Non-spacing and enclosing combining characters (general
+ * category code Mn or Me in the Unicode database) have a
+ * column width of 0.
+ *
+ * - SOFT HYPHEN (U+00AD) has a column width of 1.
+ *
+ * - Other format characters (general category code Cf in the Unicode
+ * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0.
+ *
+ * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF)
+ * have a column width of 0.
+ *
+ * - Spacing characters in the East Asian Wide (W) or East Asian
+ * Full-width (F) category as defined in Unicode Technical
+ * Report #11 have a column width of 2.
+ *
+ * - All remaining characters (including all printable
+ * ISO 8859-1 and WGL4 characters, Unicode control characters,
+ * etc.) have a column width of 1.
+ *
+ * This implementation assumes that wchar_t characters are encoded
+ * in ISO 10646.
+ */
+
+int mk_wcwidth(wchar_t ucs)
+{
+ /* sorted list of non-overlapping intervals of non-spacing characters */
+ /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
+ static const struct interval combining[] = {
+ { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 },
+ { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 },
+ { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 },
+ { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 },
+ { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED },
+ { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A },
+ { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 },
+ { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D },
+ { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 },
+ { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD },
+ { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C },
+ { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D },
+ { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC },
+ { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD },
+ { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C },
+ { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D },
+ { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 },
+ { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 },
+ { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC },
+ { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD },
+ { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D },
+ { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 },
+ { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E },
+ { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC },
+ { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 },
+ { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E },
+ { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 },
+ { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 },
+ { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 },
+ { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F },
+ { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 },
+ { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD },
+ { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD },
+ { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 },
+ { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B },
+ { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 },
+ { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 },
+ { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF },
+ { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 },
+ { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F },
+ { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B },
+ { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F },
+ { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB },
+ { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F },
+ { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 },
+ { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD },
+ { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F },
+ { 0xE0100, 0xE01EF }
+ };
+
+ /* test for 8-bit control characters */
+ if (ucs == 0)
+ return 0;
+ if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0))
+ return -1;
+
+ /* binary search in table of non-spacing characters */
+ if (bisearch(ucs, combining,
+ sizeof(combining) / sizeof(struct interval) - 1))
+ return 0;
+
+ /* if we arrive here, ucs is not a combining or C0/C1 control character */
+
+ return 1 +
+ (ucs >= 0x1100 &&
+ (ucs <= 0x115f || /* Hangul Jamo init. consonants */
+ ucs == 0x2329 || ucs == 0x232a ||
+ (ucs >= 0x2e80 && ucs <= 0xa4cf &&
+ ucs != 0x303f) || /* CJK ... Yi */
+ (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */
+ (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */
+ (ucs >= 0xfe10 && ucs <= 0xfe19) || /* Vertical forms */
+ (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */
+ (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */
+ (ucs >= 0xffe0 && ucs <= 0xffe6) ||
+ (ucs >= 0x20000 && ucs <= 0x2fffd) ||
+ (ucs >= 0x30000 && ucs <= 0x3fffd)));
+}
+
+
+int mk_wcswidth(const wchar_t *pwcs, size_t n)
+{
+ int w, width = 0;
+
+ for (;*pwcs && n-- > 0; pwcs++)
+ if ((w = mk_wcwidth(*pwcs)) < 0)
+ return -1;
+ else
+ width += w;
+
+ return width;
+}
+
+
+/*
+ * The following functions are the same as mk_wcwidth() and
+ * mk_wcswidth(), except that spacing characters in the East Asian
+ * Ambiguous (A) category as defined in Unicode Technical Report #11
+ * have a column width of 2. This variant might be useful for users of
+ * CJK legacy encodings who want to migrate to UCS without changing
+ * the traditional terminal character-width behaviour. It is not
+ * otherwise recommended for general use.
+ */
+int mk_wcwidth_cjk(wchar_t ucs)
+{
+ /* sorted list of non-overlapping intervals of East Asian Ambiguous
+ * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */
+ static const struct interval ambiguous[] = {
+ { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 },
+ { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 },
+ { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 },
+ { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 },
+ { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED },
+ { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA },
+ { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 },
+ { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B },
+ { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 },
+ { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 },
+ { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 },
+ { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE },
+ { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 },
+ { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA },
+ { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 },
+ { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB },
+ { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB },
+ { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 },
+ { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 },
+ { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 },
+ { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 },
+ { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 },
+ { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 },
+ { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 },
+ { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC },
+ { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 },
+ { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 },
+ { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 },
+ { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 },
+ { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 },
+ { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 },
+ { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B },
+ { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 },
+ { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 },
+ { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E },
+ { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 },
+ { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 },
+ { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F },
+ { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 },
+ { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF },
+ { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B },
+ { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 },
+ { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 },
+ { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 },
+ { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 },
+ { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 },
+ { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 },
+ { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 },
+ { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 },
+ { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F },
+ { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF },
+ { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD }
+ };
+
+ /* binary search in table of non-spacing characters */
+ if (bisearch(ucs, ambiguous,
+ sizeof(ambiguous) / sizeof(struct interval) - 1))
+ return 2;
+
+ return mk_wcwidth(ucs);
+}
+
+
+int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
+{
+ int w, width = 0;
+
+ for (;*pwcs && n-- > 0; pwcs++)
+ if ((w = mk_wcwidth_cjk(*pwcs)) < 0)
+ return -1;
+ else
+ width += w;
+
+ return width;
+}
diff --git a/contrib/ncurses/ncurses/widechar/lib_add_wch.c b/contrib/ncurses/ncurses/widechar/lib_add_wch.c
index 93b41bb4930c..38d3130a54c4 100644
--- a/contrib/ncurses/ncurses/widechar/lib_add_wch.c
+++ b/contrib/ncurses/ncurses/widechar/lib_add_wch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2004,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 2004-2010,2011 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,79 +35,409 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_add_wch.c,v 1.6 2006/12/02 21:19:17 tom Exp $")
+#if HAVE_WCTYPE_H
+#include <wctype.h>
+#endif
-NCURSES_EXPORT(int)
-wadd_wch(WINDOW *win, const cchar_t *wch)
+MODULE_ID("$Id: lib_add_wch.c,v 1.12 2011/03/22 09:31:15 Petr.Pavlu Exp $")
+
+/* clone/adapt lib_addch.c */
+static const cchar_t blankchar = NewChar(BLANK_TEXT);
+
+/*
+ * Ugly microtweaking alert. Everything from here to end of module is
+ * likely to be speed-critical -- profiling data sure says it is!
+ * Most of the important screen-painting functions are shells around
+ * wadd_wch(). So we make every effort to reduce function-call overhead
+ * by inlining stuff, even at the cost of making wrapped copies for
+ * export. Also we supply some internal versions that don't call the
+ * window sync hook, for use by string-put functions.
+ */
+
+/* Return bit mask for clearing color pair number if given ch has color */
+#define COLOR_MASK(ch) (~(attr_t)((ch) & A_COLOR ? A_COLOR : 0))
+
+static NCURSES_INLINE cchar_t
+render_char(WINDOW *win, cchar_t ch)
+/* compute a rendition of the given char correct for the current context */
{
- PUTC_DATA;
- int n;
- int code = ERR;
+ attr_t a = WINDOW_ATTRS(win);
+ int pair = GetPair(ch);
+
+ if (ISBLANK(ch)
+ && AttrOf(ch) == A_NORMAL
+ && pair == 0) {
+ /* color/pair in attrs has precedence over bkgrnd */
+ ch = win->_nc_bkgd;
+ SetAttr(ch, a | AttrOf(win->_nc_bkgd));
+ if ((pair = GET_WINDOW_PAIR(win)) == 0)
+ pair = GetPair(win->_nc_bkgd);
+ SetPair(ch, pair);
+ } else {
+ /* color in attrs has precedence over bkgrnd */
+ a |= AttrOf(win->_nc_bkgd) & COLOR_MASK(a);
+ /* color in ch has precedence */
+ if (pair == 0) {
+ if ((pair = GET_WINDOW_PAIR(win)) == 0)
+ pair = GetPair(win->_nc_bkgd);
+ }
+ AddAttr(ch, (a & COLOR_MASK(AttrOf(ch))));
+ SetPair(ch, pair);
+ }
+
+ TR(TRACE_VIRTPUT,
+ ("render_char bkg %s (%d), attrs %s (%d) -> ch %s (%d)",
+ _tracech_t2(1, CHREF(win->_nc_bkgd)),
+ GetPair(win->_nc_bkgd),
+ _traceattr(WINDOW_ATTRS(win)),
+ GET_WINDOW_PAIR(win),
+ _tracech_t2(3, CHREF(ch)),
+ GetPair(ch)));
+
+ return (ch);
+}
+
+/* check if position is legal; if not, return error */
+#ifndef NDEBUG /* treat this like an assertion */
+#define CHECK_POSITION(win, x, y) \
+ if (y > win->_maxy \
+ || x > win->_maxx \
+ || y < 0 \
+ || x < 0) { \
+ TR(TRACE_VIRTPUT, ("Alert! Win=%p _curx = %d, _cury = %d " \
+ "(_maxx = %d, _maxy = %d)", win, x, y, \
+ win->_maxx, win->_maxy)); \
+ return(ERR); \
+ }
+#else
+#define CHECK_POSITION(win, x, y) /* nothing */
+#endif
+
+static bool
+newline_forces_scroll(WINDOW *win, NCURSES_SIZE_T * ypos)
+{
+ bool result = FALSE;
+
+ if (*ypos >= win->_regtop && *ypos == win->_regbottom) {
+ *ypos = win->_regbottom;
+ result = TRUE;
+ } else {
+ *ypos = (NCURSES_SIZE_T) (*ypos + 1);
+ }
+ return result;
+}
- TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wadd_wch(%p, %s)"), win,
- _tracech_t(wch)));
-
- if (win != 0) {
- PUTC_INIT;
- for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) {
- attr_t attrs = (wch->attr & A_ATTRIBUTES);
-
- if ((PUTC_ch = wch->chars[PUTC_i]) == L'\0')
- break;
- if ((PUTC_n = wcrtomb(PUTC_buf, PUTC_ch, &PUT_st)) <= 0) {
- code = ERR;
- if (is8bits(PUTC_ch))
- code = waddch(win, UChar(PUTC_ch) | attrs);
- break;
+/*
+ * The _WRAPPED flag is useful only for telling an application that we've just
+ * wrapped the cursor. We don't do anything with this flag except set it when
+ * wrapping, and clear it whenever we move the cursor. If we try to wrap at
+ * the lower-right corner of a window, we cannot move the cursor (since that
+ * wouldn't be legal). So we return an error (which is what SVr4 does).
+ * Unlike SVr4, we can successfully add a character to the lower-right corner
+ * (Solaris 2.6 does this also, however).
+ */
+static int
+wrap_to_next_line(WINDOW *win)
+{
+ win->_flags |= _WRAPPED;
+ if (newline_forces_scroll(win, &(win->_cury))) {
+ win->_curx = win->_maxx;
+ if (!win->_scroll)
+ return (ERR);
+ scroll(win);
+ }
+ win->_curx = 0;
+ return (OK);
+}
+
+static int wadd_wch_literal(WINDOW *, cchar_t);
+/*
+ * Fill the given number of cells with blanks using the current background
+ * rendition. This saves/restores the current x-position.
+ */
+static void
+fill_cells(WINDOW *win, int count)
+{
+ cchar_t blank = blankchar;
+ int save_x = win->_curx;
+ int save_y = win->_cury;
+
+ while (count-- > 0) {
+ if (wadd_wch_literal(win, blank) == ERR)
+ break;
+ }
+ win->_curx = (NCURSES_SIZE_T) save_x;
+ win->_cury = (NCURSES_SIZE_T) save_y;
+}
+
+static int
+wadd_wch_literal(WINDOW *win, cchar_t ch)
+{
+ int x;
+ int y;
+ struct ldat *line;
+
+ x = win->_curx;
+ y = win->_cury;
+
+ CHECK_POSITION(win, x, y);
+
+ ch = render_char(win, ch);
+
+ line = win->_line + y;
+
+ CHANGED_CELL(line, x);
+
+ /*
+ * Non-spacing characters are added to the current cell.
+ *
+ * Spacing characters that are wider than one column require some display
+ * adjustments.
+ */
+ {
+ int len = wcwidth(CharOf(ch));
+ int i;
+ int j;
+ wchar_t *chars;
+
+ if (len == 0) { /* non-spacing */
+ if ((x > 0 && y >= 0)
+ || (win->_maxx >= 0 && win->_cury >= 1)) {
+ if (x > 0 && y >= 0)
+ chars = (win->_line[y].text[x - 1].chars);
+ else
+ chars = (win->_line[y - 1].text[win->_maxx].chars);
+ for (i = 0; i < CCHARW_MAX; ++i) {
+ if (chars[i] == 0) {
+ TR(TRACE_VIRTPUT,
+ ("added non-spacing %d: %x",
+ x, (int) CharOf(ch)));
+ chars[i] = CharOf(ch);
+ break;
+ }
+ }
+ }
+ goto testwrapping;
+ } else if (len > 1) { /* multi-column characters */
+ /*
+ * Check if the character will fit on the current line. If it does
+ * not fit, fill in the remainder of the line with blanks. and
+ * move to the next line.
+ */
+ if (len > win->_maxx + 1) {
+ TR(TRACE_VIRTPUT, ("character will not fit"));
+ return ERR;
+ } else if (x + len > win->_maxx + 1) {
+ int count = win->_maxx + 1 - x;
+ TR(TRACE_VIRTPUT, ("fill %d remaining cells", count));
+ fill_cells(win, count);
+ if (wrap_to_next_line(win) == ERR)
+ return ERR;
+ x = win->_curx;
+ y = win->_cury;
+ line = win->_line + y;
}
- for (n = 0; n < PUTC_n; n++) {
- if ((code = waddch(win, UChar(PUTC_buf[n]) | attrs)) == ERR) {
+ /*
+ * Check for cells which are orphaned by adding this character, set
+ * those to blanks.
+ *
+ * FIXME: this actually could fill j-i cells, more complicated to
+ * setup though.
+ */
+ for (i = 0; i < len; ++i) {
+ if (isWidecBase(win->_line[y].text[x + i])) {
+ break;
+ } else if (isWidecExt(win->_line[y].text[x + i])) {
+ for (j = i; x + j <= win->_maxx; ++j) {
+ if (!isWidecExt(win->_line[y].text[x + j])) {
+ TR(TRACE_VIRTPUT, ("fill %d orphan cells", j));
+ fill_cells(win, j);
+ break;
+ }
+ }
break;
}
}
- if (code == ERR)
- break;
+ /*
+ * Finally, add the cells for this character.
+ */
+ for (i = 0; i < len; ++i) {
+ cchar_t value = ch;
+ SetWidecExt(value, i);
+ TR(TRACE_VIRTPUT, ("multicolumn %d:%d (%d,%d)",
+ i + 1, len,
+ win->_begy + y, win->_begx + x));
+ line->text[x] = value;
+ CHANGED_CELL(line, x);
+ ++x;
+ }
+ goto testwrapping;
}
}
- TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_RETURN("%d"), code));
- return (code);
+ /*
+ * Single-column characters.
+ */
+ line->text[x++] = ch;
+ /*
+ * This label is used only for wide-characters.
+ */
+ testwrapping:
+
+ TR(TRACE_VIRTPUT, ("cell (%ld, %ld..%d) = %s",
+ (long) win->_cury, (long) win->_curx, x - 1,
+ _tracech_t(CHREF(ch))));
+
+ if (x > win->_maxx) {
+ return wrap_to_next_line(win);
+ }
+ win->_curx = (NCURSES_SIZE_T) x;
+ return OK;
}
-NCURSES_EXPORT(int)
-wecho_wchar(WINDOW *win, const cchar_t *wch)
+static NCURSES_INLINE int
+wadd_wch_nosync(WINDOW *win, cchar_t ch)
+/* the workhorse function -- add a character to the given window */
{
- PUTC_DATA;
- int n;
- int code = ERR;
+ NCURSES_SIZE_T x, y;
+ wchar_t *s;
+ int tabsize = 8;
+#if USE_REENTRANT
+ SCREEN *sp = _nc_screen_of(win);
+#endif
+
+ /*
+ * If we are using the alternate character set, forget about locale.
+ * Otherwise, if the locale claims the code is printable, treat it that
+ * way.
+ */
+ if ((AttrOf(ch) & A_ALTCHARSET)
+ || iswprint((wint_t) CharOf(ch)))
+ return wadd_wch_literal(win, ch);
- TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wecho_wchar(%p, %s)"), win,
- _tracech_t(wch)));
-
- if (win != 0) {
- PUTC_INIT;
- for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) {
- attr_t attrs = (wch->attr & A_ATTRIBUTES);
-
- if ((PUTC_ch = wch->chars[PUTC_i]) == L'\0')
- break;
- if ((PUTC_n = wcrtomb(PUTC_buf, PUTC_ch, &PUT_st)) <= 0) {
- code = ERR;
- if (is8bits(PUTC_ch))
- code = waddch(win, UChar(PUTC_ch) | attrs);
- break;
+ /*
+ * Handle carriage control and other codes that are not printable, or are
+ * known to expand to more than one character according to unctrl().
+ */
+ x = win->_curx;
+ y = win->_cury;
+
+ switch (CharOf(ch)) {
+ case '\t':
+#if USE_REENTRANT
+ tabsize = *ptrTabsize(sp);
+#else
+ tabsize = TABSIZE;
+#endif
+ x = (NCURSES_SIZE_T) (x + (tabsize - (x % tabsize)));
+ /*
+ * Space-fill the tab on the bottom line so that we'll get the
+ * "correct" cursor position.
+ */
+ if ((!win->_scroll && (y == win->_regbottom))
+ || (x <= win->_maxx)) {
+ cchar_t blank = blankchar;
+ AddAttr(blank, AttrOf(ch));
+ while (win->_curx < x) {
+ if (wadd_wch_literal(win, blank) == ERR)
+ return (ERR);
}
- for (n = 0; n < PUTC_n; n++) {
- if ((code = waddch(win, UChar(PUTC_buf[n]) | attrs)) == ERR) {
- break;
+ break;
+ } else {
+ wclrtoeol(win);
+ win->_flags |= _WRAPPED;
+ if (newline_forces_scroll(win, &y)) {
+ x = win->_maxx;
+ if (win->_scroll) {
+ scroll(win);
+ x = 0;
}
+ } else {
+ x = 0;
+ }
+ }
+ break;
+ case '\n':
+ wclrtoeol(win);
+ if (newline_forces_scroll(win, &y)) {
+ if (win->_scroll)
+ scroll(win);
+ else
+ return (ERR);
+ }
+ /* FALLTHRU */
+ case '\r':
+ x = 0;
+ win->_flags &= ~_WRAPPED;
+ break;
+ case '\b':
+ if (x == 0)
+ return (OK);
+ x--;
+ win->_flags &= ~_WRAPPED;
+ break;
+ default:
+ if ((s = wunctrl(&ch)) != 0) {
+ while (*s) {
+ cchar_t sch;
+ SetChar(sch, *s++, AttrOf(ch));
+ if_EXT_COLORS(SetPair(sch, GetPair(ch)));
+ if (wadd_wch_literal(win, sch) == ERR)
+ return ERR;
}
- if (code == ERR)
- break;
+ return OK;
}
- wrefresh(win);
+ return ERR;
}
+ win->_curx = x;
+ win->_cury = y;
+
+ return OK;
+}
+
+/*
+ * The versions below call _nc_synchook(). We wanted to avoid this in the
+ * version exported for string puts; they'll call _nc_synchook once at end
+ * of run.
+ */
+
+/* These are actual entry points */
+
+NCURSES_EXPORT(int)
+wadd_wch(WINDOW *win, const cchar_t *wch)
+{
+ int code = ERR;
+
+ TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wadd_wch(%p, %s)"),
+ (void *) win,
+ _tracecchar_t(wch)));
+
+ if (win && (wadd_wch_nosync(win, *wch) != ERR)) {
+ _nc_synchook(win);
+ code = OK;
+ }
+
+ TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_RETURN("%d"), code));
+ return (code);
+}
+
+NCURSES_EXPORT(int)
+wecho_wchar(WINDOW *win, const cchar_t *wch)
+{
+ int code = ERR;
+
+ TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"),
+ (void *) win,
+ _tracecchar_t(wch)));
+
+ if (win && (wadd_wch_nosync(win, *wch) != ERR)) {
+ bool save_immed = win->_immed;
+ win->_immed = TRUE;
+ _nc_synchook(win);
+ win->_immed = save_immed;
+ code = OK;
+ }
TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_RETURN("%d"), code));
return (code);
}
diff --git a/contrib/ncurses/ncurses/widechar/lib_box_set.c b/contrib/ncurses/ncurses/widechar/lib_box_set.c
index 35fce46d8d40..585c94963b0f 100644
--- a/contrib/ncurses/ncurses/widechar/lib_box_set.c
+++ b/contrib/ncurses/ncurses/widechar/lib_box_set.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2003,2009 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_box_set.c,v 1.4 2003/12/06 18:02:13 tom Exp $")
+MODULE_ID("$Id: lib_box_set.c,v 1.5 2009/10/24 22:36:56 tom Exp $")
NCURSES_EXPORT(int)
wborder_set(WINDOW *win,
@@ -53,7 +53,7 @@ wborder_set(WINDOW *win,
NCURSES_CH_T wls, wrs, wts, wbs, wtl, wtr, wbl, wbr;
T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"),
- win,
+ (void *) win,
_tracech_t2(1, ls),
_tracech_t2(2, rs),
_tracech_t2(3, ts),
diff --git a/contrib/ncurses/ncurses/widechar/lib_cchar.c b/contrib/ncurses/ncurses/widechar/lib_cchar.c
index b4a0c37a285f..c61c79529db7 100644
--- a/contrib/ncurses/ncurses/widechar/lib_cchar.c
+++ b/contrib/ncurses/ncurses/widechar/lib_cchar.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2001-2005,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 2001-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -35,7 +35,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_cchar.c,v 1.12 2007/05/12 19:03:06 tom Exp $")
+MODULE_ID("$Id: lib_cchar.c,v 1.20 2010/12/25 23:46:26 tom Exp $")
/*
* The SuSv2 description leaves some room for interpretation. We'll assume wch
@@ -50,15 +50,15 @@ setcchar(cchar_t *wcval,
short color_pair,
const void *opts)
{
- int i;
- int len;
+ unsigned i;
+ unsigned len;
int code = OK;
TR(TRACE_CCALLS, (T_CALLED("setcchar(%p,%s,%lu,%d,%p)"),
- wcval, _nc_viswbuf(wch),
+ (void *) wcval, _nc_viswbuf(wch),
(unsigned long) attrs, color_pair, opts));
- len = wcslen(wch);
+ len = (unsigned) wcslen(wch);
if (opts != NULL
|| (len > 1 && wcwidth(wch[0]) < 0)) {
code = ERR;
@@ -80,7 +80,7 @@ setcchar(cchar_t *wcval,
memset(wcval, 0, sizeof(*wcval));
if (len != 0) {
- SetAttr(*wcval, attrs | COLOR_PAIR(color_pair));
+ SetAttr(*wcval, attrs | (attr_t) ColorPair(color_pair));
SetPair(CHDEREF(wcval), color_pair);
memcpy(&wcval->chars, wch, len * sizeof(wchar_t));
TR(TRACE_CCALLS, ("copy %d wchars, first is %s", len,
@@ -104,20 +104,28 @@ getcchar(const cchar_t *wcval,
int code = ERR;
TR(TRACE_CCALLS, (T_CALLED("getcchar(%p,%p,%p,%p,%p)"),
- wcval, wch, attrs, color_pair, opts));
+ (const void *) wcval,
+ (void *) wch,
+ (void *) attrs,
+ (void *) color_pair,
+ opts));
if (opts == NULL) {
- len = (wp = wmemchr(wcval->chars, L'\0', CCHARW_MAX))
- ? wp - wcval->chars
- : CCHARW_MAX;
+ len = ((wp = wmemchr(wcval->chars, L'\0', CCHARW_MAX))
+ ? (int) (wp - wcval->chars)
+ : CCHARW_MAX);
if (wch == NULL) {
- code = len;
+ /*
+ * If the value is a null, set the length to 1.
+ * If the value is not a null, return the length plus 1 for null.
+ */
+ code = (len < CCHARW_MAX) ? (len + 1) : CCHARW_MAX;
} else if (attrs == 0 || color_pair == 0) {
code = ERR;
} else if (len >= 0) {
*attrs = AttrOf(*wcval) & A_ATTRIBUTES;
- *color_pair = GetPair(*wcval);
+ *color_pair = (short) GetPair(*wcval);
wmemcpy(wch, wcval->chars, (unsigned) len);
wch[len] = L'\0';
code = OK;
diff --git a/contrib/ncurses/ncurses/widechar/lib_erasewchar.c b/contrib/ncurses/ncurses/widechar/lib_erasewchar.c
index 7d6455370ff9..a4ee93ffa428 100644
--- a/contrib/ncurses/ncurses/widechar/lib_erasewchar.c
+++ b/contrib/ncurses/ncurses/widechar/lib_erasewchar.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002 Free Software Foundation, Inc. *
+ * Copyright (c) 2002,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -32,7 +32,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_erasewchar.c,v 1.1 2002/05/11 20:38:06 tom Exp $")
+MODULE_ID("$Id: lib_erasewchar.c,v 1.2 2010/07/24 11:35:12 tom Exp $")
/*
* erasewchar()
@@ -42,7 +42,7 @@ MODULE_ID("$Id: lib_erasewchar.c,v 1.1 2002/05/11 20:38:06 tom Exp $")
*/
NCURSES_EXPORT(int)
-erasewchar(wchar_t * wch)
+erasewchar(wchar_t *wch)
{
int value;
int result = ERR;
@@ -63,7 +63,7 @@ erasewchar(wchar_t * wch)
*/
NCURSES_EXPORT(int)
-killwchar(wchar_t * wch)
+killwchar(wchar_t *wch)
{
int value;
int result = ERR;
diff --git a/contrib/ncurses/ncurses/widechar/lib_get_wch.c b/contrib/ncurses/ncurses/widechar/lib_get_wch.c
index 6cf3129f2d18..32033df2ff9b 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-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -40,22 +40,7 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_get_wch.c,v 1.17 2008/08/16 19:22:55 tom Exp $")
-
-#if HAVE_MBTOWC && HAVE_MBLEN
-#define reset_mbytes(state) mblen(NULL, 0), mbtowc(NULL, NULL, 0)
-#define count_mbytes(buffer,length,state) mblen(buffer,length)
-#define check_mbytes(wch,buffer,length,state) \
- (int) mbtowc(&wch, buffer, length)
-#define state_unused
-#elif HAVE_MBRTOWC && HAVE_MBRLEN
-#define reset_mbytes(state) init_mb(state)
-#define count_mbytes(buffer,length,state) mbrlen(buffer,length,&state)
-#define check_mbytes(wch,buffer,length,state) \
- (int) mbrtowc(&wch, buffer, length, &state)
-#else
-make an error
-#endif
+MODULE_ID("$Id: lib_get_wch.c,v 1.22 2010/08/28 21:00:35 tom Exp $")
NCURSES_EXPORT(int)
wget_wch(WINDOW *win, wint_t *result)
@@ -65,13 +50,13 @@ wget_wch(WINDOW *win, wint_t *result)
char buffer[(MB_LEN_MAX * 9) + 1]; /* allow some redundant shifts */
int status;
size_t count = 0;
- unsigned long value;
+ int value = 0;
wchar_t wch;
#ifndef state_unused
mbstate_t state;
#endif
- T((T_CALLED("wget_wch(%p)"), win));
+ T((T_CALLED("wget_wch(%p)"), (void *) win));
/*
* We can get a stream of single-byte characters and KEY_xxx codes from
@@ -95,12 +80,12 @@ wget_wch(WINDOW *win, wint_t *result)
* whether the improvement would be worth the effort.
*/
if (count != 0) {
- _nc_ungetch(sp, (int) value);
+ safe_ungetch(SP_PARM, value);
code = ERR;
}
break;
} else if (count + 1 >= sizeof(buffer)) {
- _nc_ungetch(sp, (int) value);
+ safe_ungetch(SP_PARM, value);
code = ERR;
break;
} else {
@@ -111,7 +96,7 @@ wget_wch(WINDOW *win, wint_t *result)
reset_mbytes(state);
if (check_mbytes(wch, buffer, count, state) != status) {
code = ERR; /* the two calls should match */
- _nc_ungetch(sp, (int) value);
+ safe_ungetch(SP_PARM, value);
}
value = wch;
break;
@@ -121,8 +106,8 @@ wget_wch(WINDOW *win, wint_t *result)
} else {
code = ERR;
}
- *result = value;
+ *result = (wint_t) value;
_nc_unlock_global(curses);
- T(("result %#lo", value));
+ T(("result %#o", value));
returnCode(code);
}
diff --git a/contrib/ncurses/ncurses/widechar/lib_get_wstr.c b/contrib/ncurses/ncurses/widechar/lib_get_wstr.c
index baa70a5a53f9..0b450211b2c3 100644
--- a/contrib/ncurses/ncurses/widechar/lib_get_wstr.c
+++ b/contrib/ncurses/ncurses/widechar/lib_get_wstr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002-2004,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2008,2009 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,9 +38,8 @@
*/
#include <curses.priv.h>
-#include <term.h>
-MODULE_ID("$Id: lib_get_wstr.c,v 1.10 2008/08/16 19:25:33 tom Exp $")
+MODULE_ID("$Id: lib_get_wstr.c,v 1.12 2009/10/24 22:38:11 tom Exp $")
static int
wadd_wint(WINDOW *win, wint_t *src)
@@ -96,7 +95,7 @@ wgetn_wstr(WINDOW *win, wint_t *str, int maxlen)
wint_t ch;
int y, x, code;
- T((T_CALLED("wgetn_wstr(%p,%p, %d)"), win, str, maxlen));
+ T((T_CALLED("wgetn_wstr(%p,%p, %d)"), (void *) win, (void *) str, maxlen));
if (!win)
returnCode(ERR);
diff --git a/contrib/ncurses/ncurses/widechar/lib_hline_set.c b/contrib/ncurses/ncurses/widechar/lib_hline_set.c
index 43175de83464..da92b834f1c3 100644
--- a/contrib/ncurses/ncurses/widechar/lib_hline_set.c
+++ b/contrib/ncurses/ncurses/widechar/lib_hline_set.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -39,16 +39,16 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_hline_set.c,v 1.2 2002/03/23 21:35:34 tom Exp $")
+MODULE_ID("$Id: lib_hline_set.c,v 1.4 2010/12/19 01:45:03 tom Exp $")
NCURSES_EXPORT(int)
-whline_set(WINDOW *win, const cchar_t * ch, int n)
+whline_set(WINDOW *win, const cchar_t *ch, int n)
{
int code = ERR;
- NCURSES_SIZE_T start;
- NCURSES_SIZE_T end;
+ int start;
+ int end;
- T((T_CALLED("whline_set(%p,%s,%d)"), win, _tracecchar_t(ch), n));
+ T((T_CALLED("whline_set(%p,%s,%d)"), (void *) win, _tracecchar_t(ch), n));
if (win) {
struct ldat *line = &(win->_line[win->_cury]);
diff --git a/contrib/ncurses/ncurses/widechar/lib_in_wch.c b/contrib/ncurses/ncurses/widechar/lib_in_wch.c
index 5cd92e382de4..b2396508ba25 100644
--- a/contrib/ncurses/ncurses/widechar/lib_in_wch.c
+++ b/contrib/ncurses/ncurses/widechar/lib_in_wch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002-2004,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2006,2009 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_in_wch.c,v 1.4 2006/09/03 15:41:22 tom Exp $")
+MODULE_ID("$Id: lib_in_wch.c,v 1.5 2009/10/24 22:37:55 tom Exp $")
NCURSES_EXPORT(int)
win_wch(WINDOW *win, cchar_t *wcval)
@@ -47,7 +47,7 @@ win_wch(WINDOW *win, cchar_t *wcval)
int row, col;
int code = OK;
- TR(TRACE_CCALLS, (T_CALLED("win_wch(%p,%p)"), win, wcval));
+ TR(TRACE_CCALLS, (T_CALLED("win_wch(%p,%p)"), (void *) win, (void *) wcval));
if (win != 0
&& wcval != 0) {
getyx(win, row, col);
diff --git a/contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c b/contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c
index e9f0646ea66a..57cc2ca6e73f 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-2007 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2007,2009 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,14 +39,14 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_in_wchnstr.c,v 1.7 2007/02/11 01:00:00 tom Exp $")
+MODULE_ID("$Id: lib_in_wchnstr.c,v 1.8 2009/10/24 22:37:48 tom Exp $")
NCURSES_EXPORT(int)
win_wchnstr(WINDOW *win, cchar_t *wchstr, int n)
{
int code = OK;
- T((T_CALLED("win_wchnstr(%p,%p,%d)"), win, wchstr, n));
+ T((T_CALLED("win_wchnstr(%p,%p,%d)"), (void *) win, (void *) wchstr, n));
if (win != 0
&& wchstr != 0) {
NCURSES_CH_T *src;
diff --git a/contrib/ncurses/ncurses/widechar/lib_ins_wch.c b/contrib/ncurses/ncurses/widechar/lib_ins_wch.c
index c3d0420e53b8..1eee8a3ec016 100644
--- a/contrib/ncurses/ncurses/widechar/lib_ins_wch.c
+++ b/contrib/ncurses/ncurses/widechar/lib_ins_wch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002-2003,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -39,39 +39,44 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_ins_wch.c,v 1.8 2005/12/03 20:24:19 tom Exp $")
+MODULE_ID("$Id: lib_ins_wch.c,v 1.16 2010/12/19 01:34:04 tom Exp $")
/*
* Insert the given character, updating the current location to simplify
* inserting a string.
*/
-static int
+NCURSES_EXPORT(int)
_nc_insert_wch(WINDOW *win, const cchar_t *wch)
{
int cells = wcwidth(CharOf(CHDEREF(wch)));
int cell;
+ int code = OK;
+
+ if (cells < 0) {
+ code = winsch(win, (chtype) CharOf(CHDEREF(wch)));
+ } else {
+ if (cells == 0)
+ cells = 1;
+
+ if (win->_curx <= win->_maxx) {
+ struct ldat *line = &(win->_line[win->_cury]);
+ NCURSES_CH_T *end = &(line->text[win->_curx]);
+ NCURSES_CH_T *temp1 = &(line->text[win->_maxx]);
+ NCURSES_CH_T *temp2 = temp1 - cells;
+
+ CHANGED_TO_EOL(line, win->_curx, win->_maxx);
+ while (temp1 > end)
+ *temp1-- = *temp2--;
+
+ *temp1 = _nc_render(win, *wch);
+ for (cell = 1; cell < cells; ++cell) {
+ SetWidecExt(temp1[cell], cell);
+ }
- if (cells <= 0)
- cells = 1;
-
- if (win->_curx <= win->_maxx) {
- struct ldat *line = &(win->_line[win->_cury]);
- NCURSES_CH_T *end = &(line->text[win->_curx]);
- NCURSES_CH_T *temp1 = &(line->text[win->_maxx]);
- NCURSES_CH_T *temp2 = temp1 - cells;
-
- CHANGED_TO_EOL(line, win->_curx, win->_maxx);
- while (temp1 > end)
- *temp1-- = *temp2--;
-
- *temp1 = _nc_render(win, *wch);
- for (cell = 1; cell < cells; ++cell) {
- SetWidecExt(temp1[cell], cell);
+ win->_curx++;
}
-
- win->_curx++;
}
- return OK;
+ return code;
}
NCURSES_EXPORT(int)
@@ -81,7 +86,7 @@ wins_wch(WINDOW *win, const cchar_t *wch)
NCURSES_SIZE_T ox;
int code = ERR;
- T((T_CALLED("wins_wch(%p, %s)"), win, _tracecchar_t(wch)));
+ T((T_CALLED("wins_wch(%p, %s)"), (void *) win, _tracecchar_t(wch)));
if (win != 0) {
oy = win->_cury;
@@ -104,20 +109,23 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
NCURSES_SIZE_T ox;
const wchar_t *cp;
- T((T_CALLED("wins_nwstr(%p,%s,%d)"), win, _nc_viswbufn(wstr, n), n));
+ T((T_CALLED("wins_nwstr(%p,%s,%d)"),
+ (void *) win, _nc_viswbufn(wstr, n), n));
if (win != 0
&& wstr != 0) {
if (n < 1)
- n = wcslen(wstr);
+ n = (int) wcslen(wstr);
code = OK;
if (n > 0) {
+ SCREEN *sp = _nc_screen_of(win);
+
oy = win->_cury;
ox = win->_curx;
for (cp = wstr; *cp && ((cp - wstr) < n); cp++) {
int len = wcwidth(*cp);
- if (len != 1 || !is8bits(*cp)) {
+ if ((len >= 0 && len != 1) || !is7bits(*cp)) {
cchar_t tmp_cchar;
wchar_t tmp_wchar = *cp;
memset(&tmp_cchar, 0, sizeof(tmp_cchar));
@@ -129,7 +137,7 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
code = _nc_insert_wch(win, &tmp_cchar);
} else {
/* tabs, other ASCII stuff */
- code = _nc_insert_ch(win, (chtype) (*cp));
+ code = _nc_insert_ch(sp, win, (chtype) (*cp));
}
if (code != OK)
break;
diff --git a/contrib/ncurses/ncurses/widechar/lib_inwstr.c b/contrib/ncurses/ncurses/widechar/lib_inwstr.c
index 2207a5f5d19f..4cf7182ae061 100644
--- a/contrib/ncurses/ncurses/widechar/lib_inwstr.c
+++ b/contrib/ncurses/ncurses/widechar/lib_inwstr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002,2004 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2004,2009 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_inwstr.c,v 1.4 2004/10/23 20:41:28 tom Exp $")
+MODULE_ID("$Id: lib_inwstr.c,v 1.5 2009/10/24 22:37:29 tom Exp $")
NCURSES_EXPORT(int)
winnwstr(WINDOW *win, wchar_t *wstr, int n)
@@ -50,7 +50,7 @@ winnwstr(WINDOW *win, wchar_t *wstr, int n)
cchar_t *text;
wchar_t wch;
- T((T_CALLED("winnwstr(%p,%p,%d)"), win, wstr, n));
+ T((T_CALLED("winnwstr(%p,%p,%d)"), (void *) win, (void *) wstr, n));
if (wstr != 0) {
if (win) {
getyx(win, row, col);
@@ -93,7 +93,7 @@ NCURSES_EXPORT(int)
winwstr(WINDOW *win, wchar_t *wstr)
{
int result = OK;
- T((T_CALLED("winwstr(%p,%p)"), win, wstr));
+ T((T_CALLED("winwstr(%p,%p)"), (void *) win, (void *) wstr));
if (winnwstr(win, wstr, CCHARW_MAX * (win->_maxx - win->_curx + 1)) == ERR)
result = ERR;
returnCode(result);
diff --git a/contrib/ncurses/ncurses/widechar/lib_pecho_wchar.c b/contrib/ncurses/ncurses/widechar/lib_pecho_wchar.c
index e61277574311..b6da7a865698 100644
--- a/contrib/ncurses/ncurses/widechar/lib_pecho_wchar.c
+++ b/contrib/ncurses/ncurses/widechar/lib_pecho_wchar.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2004 Free Software Foundation, Inc. *
+ * Copyright (c) 2004,2009 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,12 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_pecho_wchar.c,v 1.1 2004/01/03 21:42:01 tom Exp $")
+MODULE_ID("$Id: lib_pecho_wchar.c,v 1.2 2009/10/24 22:43:32 tom Exp $")
NCURSES_EXPORT(int)
-pecho_wchar(WINDOW *pad, const cchar_t * wch)
+pecho_wchar(WINDOW *pad, const cchar_t *wch)
{
- T((T_CALLED("pecho_wchar(%p, %s)"), pad, _tracech_t(wch)));
+ T((T_CALLED("pecho_wchar(%p, %s)"), (void *) pad, _tracech_t(wch)));
if (pad == 0)
returnCode(ERR);
diff --git a/contrib/ncurses/ncurses/widechar/lib_unget_wch.c b/contrib/ncurses/ncurses/widechar/lib_unget_wch.c
index bb2c4a084b15..7a626a9eee84 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-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -39,7 +39,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_unget_wch.c,v 1.10 2008/06/07 14:50:37 tom Exp $")
+MODULE_ID("$Id: lib_unget_wch.c,v 1.14 2010/07/24 11:35:21 tom Exp $")
/*
* Wrapper for wcrtomb() which obtains the length needed for the given
@@ -55,24 +55,24 @@ _nc_wcrtomb(char *target, wchar_t source, mbstate_t * state)
const wchar_t *tempp = temp;
temp[0] = source;
temp[1] = 0;
- result = wcsrtombs(NULL, &tempp, 0, state);
+ result = (int) wcsrtombs(NULL, &tempp, 0, state);
} else {
- result = wcrtomb(target, source, state);
+ result = (int) wcrtomb(target, source, state);
}
if (!isEILSEQ(result) && (result == 0))
result = 1;
- return result;
+ return (size_t) result;
}
NCURSES_EXPORT(int)
-unget_wch(const wchar_t wch)
+NCURSES_SP_NAME(unget_wch) (NCURSES_SP_DCLx const wchar_t wch)
{
int result = OK;
mbstate_t state;
size_t length;
int n;
- T((T_CALLED("unget_wch(%#lx)"), (unsigned long) wch));
+ T((T_CALLED("unget_wch(%p, %#lx)"), (void *) SP_PARM, (unsigned long) wch));
init_mb(state);
length = _nc_wcrtomb(0, wch, &state);
@@ -83,10 +83,12 @@ unget_wch(const wchar_t wch)
if ((string = (char *) malloc(length)) != 0) {
init_mb(state);
- wcrtomb(string, wch, &state);
+ /* ignore the result, since we already validated the character */
+ IGNORE_RC((int) wcrtomb(string, wch, &state));
for (n = (int) (length - 1); n >= 0; --n) {
- if (_nc_ungetch(SP, string[n]) != OK) {
+ if (NCURSES_SP_NAME(ungetch) (NCURSES_SP_ARGx
+ UChar(string[n])) !=OK) {
result = ERR;
break;
}
@@ -101,3 +103,11 @@ unget_wch(const wchar_t wch)
returnCode(result);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+unget_wch(const wchar_t wch)
+{
+ return NCURSES_SP_NAME(unget_wch) (CURRENT_SCREEN, wch);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/widechar/lib_vid_attr.c b/contrib/ncurses/ncurses/widechar/lib_vid_attr.c
index 1dc679e6d907..e4cf093a1f6b 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-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -31,11 +31,14 @@
****************************************************************************/
#include <curses.priv.h>
-#include <term.h>
-MODULE_ID("$Id: lib_vid_attr.c,v 1.5 2007/06/30 22:03:02 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_vid_attr.c,v 1.14 2010/12/19 01:44:24 tom Exp $")
-#define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc)
+#define doPut(mode) TPUTS_TRACE(#mode); NCURSES_SP_NAME(tputs)(NCURSES_SP_ARGx mode, 1, outc)
#define TurnOn(mask,mode) \
if ((turn_on & mask) && mode) { doPut(mode); }
@@ -50,14 +53,22 @@ MODULE_ID("$Id: lib_vid_attr.c,v 1.5 2007/06/30 22:03:02 tom Exp $")
if ((pair != old_pair) \
|| (fix_pair0 && (pair == 0)) \
|| (reverse ^ ((old_attr & A_REVERSE) != 0))) { \
- _nc_do_color(old_pair, pair, reverse, outc); \
+ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx \
+ old_pair, pair, \
+ reverse, outc); \
} \
}
-#define set_color(mode, pair) mode &= ALL_BUT_COLOR; mode |= COLOR_PAIR(pair)
+#define set_color(mode, pair) \
+ mode &= ALL_BUT_COLOR; \
+ mode |= (attr_t) ColorPair(pair)
NCURSES_EXPORT(int)
-vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
+NCURSES_SP_NAME(vid_puts) (NCURSES_SP_DCLx
+ attr_t newmode,
+ short pair,
+ void *opts GCC_UNUSED,
+ NCURSES_SP_OUTC outc)
{
#if NCURSES_EXT_COLORS
static attr_t previous_attr = A_NORMAL;
@@ -65,9 +76,9 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
attr_t turn_on, turn_off;
bool reverse = FALSE;
- bool can_color = (SP == 0 || SP->_coloron);
+ bool can_color = (SP_PARM == 0 || SP_PARM->_coloron);
#if NCURSES_EXT_FUNCS
- bool fix_pair0 = (SP != 0 && SP->_coloron && !SP->_default_color);
+ bool fix_pair0 = (SP_PARM != 0 && SP_PARM->_coloron && !SP_PARM->_default_color);
#else
#define fix_pair0 FALSE
#endif
@@ -76,18 +87,18 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair));
/* this allows us to go on whether or not newterm() has been called */
- if (SP) {
- previous_attr = AttrOf(SCREEN_ATTRS(SP));
- previous_pair = GetPair(SCREEN_ATTRS(SP));
+ if (SP_PARM) {
+ previous_attr = AttrOf(SCREEN_ATTRS(SP_PARM));
+ previous_pair = GetPair(SCREEN_ATTRS(SP_PARM));
}
TR(TRACE_ATTRS, ("previous attribute was %s, %d",
_traceattr(previous_attr), previous_pair));
#if !USE_XMC_SUPPORT
- if ((SP != 0)
+ if ((SP_PARM != 0)
&& (magic_cookie_glitch > 0))
- newmode &= ~(SP->_xmc_suppress);
+ newmode &= ~(SP_PARM->_xmc_suppress);
#endif
/*
@@ -144,10 +155,10 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
if (exit_attribute_mode) {
doPut(exit_attribute_mode);
} else {
- if (!SP || SP->_use_rmul) {
+ if (!SP_PARM || SP_PARM->_use_rmul) {
TurnOff(A_UNDERLINE, exit_underline_mode);
}
- if (!SP || SP->_use_rmso) {
+ if (!SP_PARM || SP_PARM->_use_rmso) {
TurnOff(A_STANDOUT, exit_standout_mode);
}
}
@@ -159,16 +170,18 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
} else if (set_attributes) {
if (turn_on || turn_off) {
TPUTS_TRACE("set_attributes");
- tputs(TPARM_9(set_attributes,
- (newmode & A_STANDOUT) != 0,
- (newmode & A_UNDERLINE) != 0,
- (newmode & A_REVERSE) != 0,
- (newmode & A_BLINK) != 0,
- (newmode & A_DIM) != 0,
- (newmode & A_BOLD) != 0,
- (newmode & A_INVIS) != 0,
- (newmode & A_PROTECT) != 0,
- (newmode & A_ALTCHARSET) != 0), 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_9(set_attributes,
+ (newmode & A_STANDOUT) != 0,
+ (newmode & A_UNDERLINE) != 0,
+ (newmode & A_REVERSE) != 0,
+ (newmode & A_BLINK) != 0,
+ (newmode & A_DIM) != 0,
+ (newmode & A_BOLD) != 0,
+ (newmode & A_INVIS) != 0,
+ (newmode & A_PROTECT) != 0,
+ (newmode & A_ALTCHARSET) != 0),
+ 1, outc);
previous_attr &= ALL_BUT_COLOR;
previous_pair = 0;
}
@@ -179,11 +192,11 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
TurnOff(A_ALTCHARSET, exit_alt_charset_mode);
- if (!SP || SP->_use_rmul) {
+ if (!SP_PARM || SP_PARM->_use_rmul) {
TurnOff(A_UNDERLINE, exit_underline_mode);
}
- if (!SP || SP->_use_rmso) {
+ if (!SP_PARM || SP_PARM->_use_rmso) {
TurnOff(A_STANDOUT, exit_standout_mode);
}
@@ -221,9 +234,9 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
if (reverse)
newmode |= A_REVERSE;
- if (SP) {
- SetAttr(SCREEN_ATTRS(SP), newmode);
- SetPair(SCREEN_ATTRS(SP), pair);
+ if (SP_PARM) {
+ SetAttr(SCREEN_ATTRS(SP_PARM), newmode);
+ SetPair(SCREEN_ATTRS(SP_PARM), pair);
} else {
previous_attr = newmode;
previous_pair = pair;
@@ -233,29 +246,60 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
#else
T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair));
set_color(newmode, pair);
- returnCode(vidputs(newmode, outc));
+ returnCode(NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx newmode, outc));
#endif
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+vid_puts(attr_t newmode,
+ short pair,
+ void *opts GCC_UNUSED,
+ NCURSES_OUTC outc)
+{
+ SetSafeOutcWrapper(outc);
+ return NCURSES_SP_NAME(vid_puts) (CURRENT_SCREEN,
+ newmode,
+ pair,
+ opts,
+ _nc_outc_wrapper);
+}
+#endif
+
#undef vid_attr
NCURSES_EXPORT(int)
-vid_attr(attr_t newmode, short pair, void *opts)
+NCURSES_SP_NAME(vid_attr) (NCURSES_SP_DCLx
+ attr_t newmode,
+ short pair,
+ void *opts)
{
T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), pair));
- returnCode(vid_puts(newmode, pair, opts, _nc_outch));
+ returnCode(NCURSES_SP_NAME(vid_puts) (NCURSES_SP_ARGx
+ newmode,
+ pair,
+ opts,
+ NCURSES_SP_NAME(_nc_outch)));
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+vid_attr(attr_t newmode, short pair, void *opts)
+{
+ return NCURSES_SP_NAME(vid_attr) (CURRENT_SCREEN, newmode, pair, opts);
+}
+#endif
+
/*
* This implementation uses the same mask values for A_xxx and WA_xxx, so
* we can use termattrs() for part of the logic.
*/
NCURSES_EXPORT(attr_t)
-term_attrs(void)
+NCURSES_SP_NAME(term_attrs) (NCURSES_SP_DCL0)
{
attr_t attrs;
T((T_CALLED("term_attrs()")));
- attrs = termattrs();
+ attrs = SP_PARM ? NCURSES_SP_NAME(termattrs) (NCURSES_SP_ARG) : 0;
/* these are only supported for wide-character mode */
if (enter_horizontal_hl_mode)
@@ -273,3 +317,11 @@ term_attrs(void)
returnAttr(attrs);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(attr_t)
+term_attrs(void)
+{
+ return NCURSES_SP_NAME(term_attrs) (CURRENT_SCREEN);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/widechar/lib_vline_set.c b/contrib/ncurses/ncurses/widechar/lib_vline_set.c
index af42df1f24ab..917caac44b44 100644
--- a/contrib/ncurses/ncurses/widechar/lib_vline_set.c
+++ b/contrib/ncurses/ncurses/widechar/lib_vline_set.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -39,16 +39,16 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_vline_set.c,v 1.2 2002/03/23 21:36:01 tom Exp $")
+MODULE_ID("$Id: lib_vline_set.c,v 1.4 2010/12/19 01:50:50 tom Exp $")
NCURSES_EXPORT(int)
-wvline_set(WINDOW *win, const cchar_t * ch, int n)
+wvline_set(WINDOW *win, const cchar_t *ch, int n)
{
int code = ERR;
- NCURSES_SIZE_T row, col;
- NCURSES_SIZE_T end;
+ int row, col;
+ int end;
- T((T_CALLED("wvline(%p,%s,%d)"), win, _tracecchar_t(ch), n));
+ T((T_CALLED("wvline(%p,%s,%d)"), (void *) win, _tracecchar_t(ch), n));
if (win) {
NCURSES_CH_T wch;
diff --git a/contrib/ncurses/ncurses/widechar/lib_wacs.c b/contrib/ncurses/ncurses/widechar/lib_wacs.c
index fe893b4d2f8b..5a16e457e091 100644
--- a/contrib/ncurses/ncurses/widechar/lib_wacs.c
+++ b/contrib/ncurses/ncurses/widechar/lib_wacs.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -31,9 +31,8 @@
****************************************************************************/
#include <curses.priv.h>
-#include <term.h>
-MODULE_ID("$Id: lib_wacs.c,v 1.7 2006/12/17 15:16:17 tom Exp $")
+MODULE_ID("$Id: lib_wacs.c,v 1.10 2010/12/19 01:43:19 tom Exp $")
NCURSES_EXPORT_VAR(cchar_t) * _nc_wacs = 0;
@@ -42,7 +41,7 @@ _nc_init_wacs(void)
{
/* *INDENT-OFF* */
static const struct {
- int map;
+ unsigned map;
int value[2];
} table[] = {
/* VT100 symbols */
@@ -80,6 +79,30 @@ _nc_init_wacs(void)
{ '{', { '*', 0x03c0 }}, /* greek pi */
{ '|', { '!', 0x2260 }}, /* not-equal */
{ '}', { 'f', 0x00a3 }}, /* pound-sterling symbol */
+ /* thick-line-drawing */
+ { 'L', { '+', 0x250f }}, /* upper left corner */
+ { 'M', { '+', 0x2517 }}, /* lower left corner */
+ { 'K', { '+', 0x2513 }}, /* upper right corner */
+ { 'J', { '+', 0x251b }}, /* lower right corner */
+ { 'T', { '+', 0x2523 }}, /* tee pointing left */
+ { 'U', { '+', 0x252b }}, /* tee pointing right */
+ { 'V', { '+', 0x253b }}, /* tee pointing up */
+ { 'W', { '+', 0x2533 }}, /* tee pointing down */
+ { 'Q', { '-', 0x2501 }}, /* horizontal line */
+ { 'X', { '|', 0x2503 }}, /* vertical line */
+ { 'N', { '+', 0x254b }}, /* large plus or crossover */
+ /* double-line-drawing */
+ { 'C', { '+', 0x2554 }}, /* upper left corner */
+ { 'D', { '+', 0x255a }}, /* lower left corner */
+ { 'B', { '+', 0x2557 }}, /* upper right corner */
+ { 'A', { '+', 0x255d }}, /* lower right corner */
+ { 'G', { '+', 0x2563 }}, /* tee pointing left */
+ { 'F', { '+', 0x2560 }}, /* tee pointing right */
+ { 'H', { '+', 0x2569 }}, /* tee pointing up */
+ { 'I', { '+', 0x2566 }}, /* tee pointing down */
+ { 'R', { '-', 0x2550 }}, /* horizontal line */
+ { 'Y', { '|', 0x2551 }}, /* vertical line */
+ { 'E', { '+', 0x256c }}, /* large plus or crossover */
};
/* *INDENT-ON* */
diff --git a/contrib/ncurses/ncurses/widechar/lib_wunctrl.c b/contrib/ncurses/ncurses/widechar/lib_wunctrl.c
index be2259acdcff..50958e44c7bb 100644
--- a/contrib/ncurses/ncurses/widechar/lib_wunctrl.c
+++ b/contrib/ncurses/ncurses/widechar/lib_wunctrl.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2001-2005,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 2001-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -35,21 +35,31 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_wunctrl.c,v 1.12 2007/06/12 20:22:32 tom Exp $")
+MODULE_ID("$Id: lib_wunctrl.c,v 1.14 2010/12/19 01:42:15 tom Exp $")
NCURSES_EXPORT(wchar_t *)
-wunctrl(cchar_t *wc)
+NCURSES_SP_NAME(wunctrl) (NCURSES_SP_DCLx cchar_t *wc)
{
- static wchar_t str[CCHARW_MAX + 1], *sp;
+ static wchar_t str[CCHARW_MAX + 1], *wsp;
if (Charable(*wc)) {
- const char *p = unctrl((unsigned) _nc_to_char((wint_t) CharOf(*wc)));
+ const char *p =
+ NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx
+ (unsigned) _nc_to_char((wint_t)CharOf(*wc)));
- for (sp = str; *p; ++p) {
- *sp++ = _nc_to_widechar(*p);
+ for (wsp = str; *p; ++p) {
+ *wsp++ = (wchar_t) _nc_to_widechar(*p);
}
- *sp = 0;
+ *wsp = 0;
return str;
} else
return wc->chars;
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(wchar_t *)
+wunctrl(cchar_t *wc)
+{
+ return NCURSES_SP_NAME(wunctrl) (CURRENT_SCREEN, wc);
+}
+#endif
diff --git a/contrib/ncurses/ncurses/win32con/gettimeofday.c b/contrib/ncurses/ncurses/win32con/gettimeofday.c
new file mode 100644
index 000000000000..e1ef3401de34
--- /dev/null
+++ b/contrib/ncurses/ncurses/win32con/gettimeofday.c
@@ -0,0 +1,51 @@
+/****************************************************************************
+ * Copyright (c) 2008,2010 Free Software Foundation, Inc. *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a *
+ * copy of this software and associated documentation files (the *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+#define WINVER 0x0501
+
+#include <curses.priv.h>
+
+#include <windows.h>
+
+MODULE_ID("$Id: gettimeofday.c,v 1.2 2010/01/16 15:18:51 tom Exp $")
+
+#define JAN1970 116444736000000000LL /* the value for 01/01/1970 00:00 */
+
+int
+gettimeofday(struct timeval *tv, void *tz GCC_UNUSED)
+{
+ union {
+ FILETIME ft;
+ long long since1601; /* time since 1 Jan 1601 in 100ns units */
+ } data;
+
+ GetSystemTimeAsFileTime(&data.ft);
+ tv->tv_usec = (long) ((data.since1601 / 10LL) % 1000000LL);
+ tv->tv_sec = (long) ((data.since1601 - JAN1970) / 10000000LL);
+ return (0);
+}
diff --git a/contrib/ncurses/ncurses/win32con/wcwidth.c b/contrib/ncurses/ncurses/win32con/wcwidth.c
new file mode 100644
index 000000000000..cdef64a23c0e
--- /dev/null
+++ b/contrib/ncurses/ncurses/win32con/wcwidth.c
@@ -0,0 +1,50 @@
+/****************************************************************************
+ * Copyright (c) 2010 Free Software Foundation, Inc. *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a *
+ * copy of this software and associated documentation files (the *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+#include <curses.priv.h>
+
+MODULE_ID("$Id: wcwidth.c,v 1.2 2010/08/07 20:52:43 tom Exp $")
+
+#if USE_WIDEC_SUPPORT
+#define mk_wcwidth(ucs) _nc_wcwidth(ucs)
+#define mk_wcswidth(pwcs, n) _nc_wcswidth(pwcs, n)
+#define mk_wcwidth_cjk(ucs) _nc_wcwidth_cjk(ucs)
+#define mk_wcswidth_cjk(pwcs, n) _nc_wcswidth_cjk(pwcs, n)
+
+extern int mk_wcwidth(wchar_t);
+extern int mk_wcswidth(const wchar_t *, size_t);
+extern int mk_wcwidth_cjk(wchar_t);
+extern int mk_wcswidth_cjk(const wchar_t *, size_t);
+
+#include <wcwidth.h>
+#else
+void _nc_empty_wcwidth(void);
+void
+_nc_empty_wcwidth(void)
+{
+}
+#endif
diff --git a/contrib/ncurses/ncurses/win32con/win_driver.c b/contrib/ncurses/ncurses/win32con/win_driver.c
new file mode 100644
index 000000000000..c214639cd4df
--- /dev/null
+++ b/contrib/ncurses/ncurses/win32con/win_driver.c
@@ -0,0 +1,1241 @@
+/****************************************************************************
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a *
+ * copy of this software and associated documentation files (the *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Juergen Pfeifer *
+ * *
+ ****************************************************************************/
+
+/*
+ * TODO - GetMousePos(POINT * result) from ntconio.c
+ * TODO - implement nodelay
+ */
+
+#include <curses.priv.h>
+#define CUR my_term.type.
+
+MODULE_ID("$Id: win_driver.c,v 1.10 2010/12/25 19:28:21 tom Exp $")
+
+#define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE)
+
+#define AssertTCB() assert(TCB!=0 && TCB->magic==WINMAGIC)
+#define SetSP() assert(TCB->csp!=0); sp = TCB->csp
+
+#define GenMap(vKey,key) MAKELONG(key, vKey)
+
+static const LONG keylist[] =
+{
+ GenMap(VK_PRIOR, KEY_PPAGE),
+ GenMap(VK_NEXT, KEY_NPAGE),
+ GenMap(VK_END, KEY_END),
+ GenMap(VK_HOME, KEY_HOME),
+ GenMap(VK_LEFT, KEY_LEFT),
+ GenMap(VK_UP, KEY_UP),
+ GenMap(VK_RIGHT, KEY_RIGHT),
+ GenMap(VK_DOWN, KEY_DOWN),
+ GenMap(VK_DELETE, KEY_DC),
+ GenMap(VK_INSERT, KEY_IC)
+};
+#define N_INI ((int)(sizeof(keylist)/sizeof(keylist[0])))
+#define FKEYS 24
+#define MAPSIZE (FKEYS + N_INI)
+#define NUMPAIRS 64
+
+typedef struct props {
+ CONSOLE_SCREEN_BUFFER_INFO SBI;
+ bool progMode;
+ DWORD map[MAPSIZE];
+ DWORD rmap[MAPSIZE];
+ WORD pairs[NUMPAIRS];
+} Properties;
+
+#define PropOf(TCB) ((Properties*)TCB->prop)
+
+int
+_nc_mingw_ioctl(int fd GCC_UNUSED,
+ long int request GCC_UNUSED,
+ struct termios *arg GCC_UNUSED)
+{
+ return 0;
+ endwin();
+ fprintf(stderr, "TERMINFO currently not supported on Windows.\n");
+ exit(1);
+}
+
+static WORD
+MapColor(bool fore, int color)
+{
+ static const int _cmap[] =
+ {0, 4, 2, 6, 1, 5, 3, 7};
+ int a;
+ if (color < 0 || color > 7)
+ a = fore ? 7 : 0;
+ else
+ a = _cmap[color];
+ if (!fore)
+ a = a << 4;
+ return (WORD) a;
+}
+
+static WORD
+MapAttr(TERMINAL_CONTROL_BLOCK * TCB, WORD res, chtype ch)
+{
+ if (ch & A_COLOR) {
+ int p;
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+ p = PairNumber(ch);
+ if (p > 0 && p < NUMPAIRS && TCB != 0 && sp != 0) {
+ WORD a;
+ a = PropOf(TCB)->pairs[p];
+ res = (res & 0xff00) | a;
+ }
+ }
+
+ if (ch & A_REVERSE)
+ res = ((res & 0xff00) | (((res & 0x07) << 4) | ((res & 0x70) >> 4)));
+
+ if (ch & A_STANDOUT)
+ res = ((res & 0xff00) | (((res & 0x07) << 4) | ((res & 0x70) >> 4))
+ | BACKGROUND_INTENSITY);
+
+ if (ch & A_BOLD)
+ res |= FOREGROUND_INTENSITY;
+
+ if (ch & A_DIM)
+ res |= BACKGROUND_INTENSITY;
+
+ return res;
+}
+
+static BOOL
+con_write(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n)
+{
+ CHAR_INFO ci[n];
+ COORD loc, siz;
+ SMALL_RECT rec;
+ int i;
+ chtype ch;
+ SCREEN *sp;
+
+ AssertTCB();
+
+ if (TCB == 0 || InvalidConsoleHandle(TCB->hdl))
+ return FALSE;
+
+ SetSP();
+
+ for (i = 0; i < n; i++) {
+ ch = str[i];
+ ci[i].Char.AsciiChar = ChCharOf(ch);
+ ci[i].Attributes = MapAttr(TCB,
+ PropOf(TCB)->SBI.wAttributes,
+ ChAttrOf(ch));
+ if (ChAttrOf(ch) & A_ALTCHARSET) {
+ if (sp->_acs_map)
+ ci[i].Char.AsciiChar =
+ ChCharOf(NCURSES_SP_NAME(_nc_acs_char) (sp, ChCharOf(ch)));
+ }
+ }
+
+ loc.X = (short) 0;
+ loc.Y = (short) 0;
+ siz.X = (short) n;
+ siz.Y = 1;
+
+ rec.Left = (short) x;
+ rec.Top = (short) y;
+ rec.Right = (short) (x + n - 1);
+ rec.Bottom = rec.Top;
+
+ return WriteConsoleOutput(TCB->hdl, ci, siz, loc, &rec);
+}
+
+#define MARK_NOCHANGE(win,row) \
+ win->_line[row].firstchar = _NOCHANGE; \
+ win->_line[row].lastchar = _NOCHANGE
+
+static int
+drv_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ int y, nonempty, n, x0, x1, Width, Height;
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ Width = screen_columns(sp);
+ Height = screen_lines(sp);
+ nonempty = min(Height, NewScreen(sp)->_maxy + 1);
+
+ if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) {
+ int x;
+ chtype empty[Width];
+
+ for (x = 0; x < Width; x++)
+ empty[x] = ' ';
+
+ for (y = 0; y < nonempty; y++) {
+ con_write(TCB, y, 0, empty, Width);
+ memcpy(empty,
+ CurScreen(sp)->_line[y].text,
+ Width * sizeof(chtype));
+ }
+ CurScreen(sp)->_clear = FALSE;
+ NewScreen(sp)->_clear = FALSE;
+ touchwin(NewScreen(sp));
+ }
+
+ for (y = 0; y < nonempty; y++) {
+ x0 = NewScreen(sp)->_line[y].firstchar;
+ if (x0 != _NOCHANGE) {
+ x1 = NewScreen(sp)->_line[y].lastchar;
+ n = x1 - x0 + 1;
+ if (n > 0) {
+ memcpy(CurScreen(sp)->_line[y].text + x0,
+ NewScreen(sp)->_line[y].text + x0,
+ n * sizeof(chtype));
+ con_write(TCB,
+ y,
+ x0,
+ ((chtype *) CurScreen(sp)->_line[y].text) + x0, n);
+
+ /* mark line changed successfully */
+ if (y <= NewScreen(sp)->_maxy) {
+ MARK_NOCHANGE(NewScreen(sp), y);
+ }
+ if (y <= CurScreen(sp)->_maxy) {
+ MARK_NOCHANGE(CurScreen(sp), y);
+ }
+ }
+ }
+ }
+
+ /* put everything back in sync */
+ for (y = nonempty; y <= NewScreen(sp)->_maxy; y++) {
+ MARK_NOCHANGE(NewScreen(sp), y);
+ }
+ for (y = nonempty; y <= CurScreen(sp)->_maxy; y++) {
+ MARK_NOCHANGE(CurScreen(sp), y);
+ }
+
+ if (!NewScreen(sp)->_leaveok) {
+ CurScreen(sp)->_curx = NewScreen(sp)->_curx;
+ CurScreen(sp)->_cury = NewScreen(sp)->_cury;
+
+ TCB->drv->hwcur(TCB, 0, 0, CurScreen(sp)->_cury, CurScreen(sp)->_curx);
+ }
+ SetConsoleActiveScreenBuffer(TCB->hdl);
+ return OK;
+}
+
+static bool
+drv_CanHandle(TERMINAL_CONTROL_BLOCK * TCB,
+ const char *tname,
+ int *errret GCC_UNUSED)
+{
+ bool code = FALSE;
+
+ T((T_CALLED("win32con::drv_CanHandle(%p)"), TCB));
+
+ assert(TCB != 0);
+ assert(tname != 0);
+
+ TCB->magic = WINMAGIC;
+ if (*tname == 0 || *tname == 0) {
+ code = TRUE;
+ } else {
+ TERMINAL my_term;
+ int status;
+
+ code = FALSE;
+#if (USE_DATABASE || USE_TERMCAP)
+ status = _nc_setup_tinfo(tname, &my_term.type);
+#else
+ status = TGETENT_NO;
+#endif
+ if (status != TGETENT_YES) {
+ const TERMTYPE *fallback = _nc_fallback(tname);
+
+ if (fallback) {
+ my_term.type = *fallback;
+ status = TGETENT_YES;
+ } else if (!strcmp(tname, "unknown")) {
+ code = TRUE;
+ }
+ }
+ if (status == TGETENT_YES) {
+ if (generic_type || hard_copy)
+ code = TRUE;
+ }
+ }
+
+ if (code) {
+ if ((TCB->term.type.Booleans) == 0) {
+ _nc_init_entry(&(TCB->term.type));
+ }
+ }
+
+ returnBool(code);
+}
+
+static int
+drv_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB,
+ bool beepFlag GCC_UNUSED)
+{
+ SCREEN *sp;
+ int res = ERR;
+
+ AssertTCB();
+ SetSP();
+
+ return res;
+}
+
+static int
+drv_print(TERMINAL_CONTROL_BLOCK * TCB,
+ char *data GCC_UNUSED,
+ int len GCC_UNUSED)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ return ERR;
+}
+
+static int
+drv_defaultcolors(TERMINAL_CONTROL_BLOCK * TCB,
+ int fg GCC_UNUSED,
+ int bg GCC_UNUSED)
+{
+ SCREEN *sp;
+ int code = ERR;
+
+ AssertTCB();
+ SetSP();
+
+ return (code);
+}
+
+static void
+drv_setcolor(TERMINAL_CONTROL_BLOCK * TCB,
+ bool fore,
+ int color,
+ int (*outc) (SCREEN *, int) GCC_UNUSED)
+{
+ AssertTCB();
+
+ if (TCB && !InvalidConsoleHandle(TCB->hdl)) {
+ WORD a = MapColor(fore, color);
+ a = ((PropOf(TCB)->SBI.wAttributes) & (fore ? 0xfff8 : 0xff8f)) | a;
+ SetConsoleTextAttribute(TCB->hdl, a);
+ GetConsoleScreenBufferInfo(TCB->hdl, &(PropOf(TCB)->SBI));
+ }
+}
+
+static bool
+drv_rescol(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ bool res = FALSE;
+
+ AssertTCB();
+ if (TCB && !InvalidConsoleHandle(TCB->hdl)) {
+ WORD a = FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN;
+ SetConsoleTextAttribute(TCB->hdl, a);
+ GetConsoleScreenBufferInfo(TCB->hdl, &(PropOf(TCB)->SBI));
+ res = TRUE;
+ }
+ return res;
+}
+
+static bool
+drv_rescolors(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ int result = FALSE;
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ return result;
+}
+
+static int
+drv_size(TERMINAL_CONTROL_BLOCK * TCB, int *Lines, int *Cols)
+{
+ AssertTCB();
+
+ if (TCB == NULL || Lines == NULL || Cols == NULL || InvalidConsoleHandle(TCB->hdl))
+ return ERR;
+
+ *Lines = (int) (PropOf(TCB)->SBI.dwSize.Y);
+ *Cols = (int) (PropOf(TCB)->SBI.dwSize.X);
+ return OK;
+}
+
+static int
+drv_setsize(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED,
+ int l GCC_UNUSED,
+ int c GCC_UNUSED)
+{
+ AssertTCB();
+ return ERR;
+}
+
+static int
+drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, bool setFlag, TTY * buf)
+{
+ DWORD dwFlag = 0;
+ tcflag_t iflag;
+ tcflag_t lflag;
+
+ AssertTCB();
+
+ if (TCB == 0 || buf == NULL)
+ return ERR;
+
+ if (setFlag) {
+ iflag = buf->c_iflag;
+ lflag = buf->c_lflag;
+
+ GetConsoleMode(TCB->inp, &dwFlag);
+
+ if (lflag & ICANON)
+ dwFlag |= ENABLE_LINE_INPUT;
+ else
+ dwFlag &= ~ENABLE_LINE_INPUT;
+
+ if (lflag & ECHO)
+ dwFlag |= ENABLE_ECHO_INPUT;
+ else
+ dwFlag &= ~ENABLE_ECHO_INPUT;
+
+ if (iflag & BRKINT)
+ dwFlag |= ENABLE_PROCESSED_INPUT;
+ else
+ dwFlag &= ~ENABLE_PROCESSED_INPUT;
+
+ dwFlag |= ENABLE_MOUSE_INPUT;
+
+ buf->c_iflag = iflag;
+ buf->c_lflag = lflag;
+ SetConsoleMode(TCB->inp, dwFlag);
+ TCB->term.Nttyb = *buf;
+ } else {
+ iflag = TCB->term.Nttyb.c_iflag;
+ lflag = TCB->term.Nttyb.c_lflag;
+ GetConsoleMode(TCB->inp, &dwFlag);
+
+ if (dwFlag & ENABLE_LINE_INPUT)
+ lflag |= ICANON;
+ else
+ lflag &= ~ICANON;
+
+ if (dwFlag & ENABLE_ECHO_INPUT)
+ lflag |= ECHO;
+ else
+ lflag &= ~ECHO;
+
+ if (dwFlag & ENABLE_PROCESSED_INPUT)
+ iflag |= BRKINT;
+ else
+ iflag &= ~BRKINT;
+
+ TCB->term.Nttyb.c_iflag = iflag;
+ TCB->term.Nttyb.c_lflag = lflag;
+
+ *buf = TCB->term.Nttyb;
+ }
+ return OK;
+}
+
+static int
+drv_mode(TERMINAL_CONTROL_BLOCK * TCB, bool progFlag, bool defFlag)
+{
+ SCREEN *sp;
+ TERMINAL *_term = (TERMINAL *) TCB;
+ int code = ERR;
+
+ AssertTCB();
+ sp = TCB->csp;
+
+ PropOf(TCB)->progMode = progFlag;
+ SetConsoleActiveScreenBuffer(progFlag ? TCB->hdl : TCB->out);
+
+ if (progFlag) /* prog mode */ {
+ if (defFlag) {
+ if ((drv_sgmode(TCB, FALSE, &(_term->Nttyb)) == OK)) {
+ _term->Nttyb.c_oflag &= ~OFLAGS_TABS;
+ code = OK;
+ }
+ } else {
+ /* reset_prog_mode */
+ if (drv_sgmode(TCB, TRUE, &(_term->Nttyb)) == OK) {
+ if (sp) {
+ if (sp->_keypad_on)
+ _nc_keypad(sp, TRUE);
+ NC_BUFFERED(sp, TRUE);
+ }
+ code = OK;
+ }
+ }
+ } else { /* shell mode */
+ if (defFlag) {
+ /* def_shell_mode */
+ if (drv_sgmode(TCB, FALSE, &(_term->Ottyb)) == OK) {
+ code = OK;
+ }
+ } else {
+ /* reset_shell_mode */
+ if (sp) {
+ _nc_keypad(sp, FALSE);
+ NCURSES_SP_NAME(_nc_flush) (sp);
+ NC_BUFFERED(sp, FALSE);
+ }
+ code = drv_sgmode(TCB, TRUE, &(_term->Ottyb));
+ }
+ }
+
+ return (code);
+}
+
+static void
+drv_screen_init(SCREEN *sp GCC_UNUSED)
+{
+}
+
+static void
+drv_wrap(SCREEN *sp GCC_UNUSED)
+{
+}
+
+static int
+rkeycompare(const void *el1, const void *el2)
+{
+ WORD key1 = (LOWORD((*((const LONG *) el1)))) & 0x7fff;
+ WORD key2 = (LOWORD((*((const LONG *) el2)))) & 0x7fff;
+
+ return ((key1 < key2) ? -1 : ((key1 == key2) ? 0 : 1));
+}
+
+static int
+keycompare(const void *el1, const void *el2)
+{
+ WORD key1 = HIWORD((*((const LONG *) el1)));
+ WORD key2 = HIWORD((*((const LONG *) el2)));
+
+ return ((key1 < key2) ? -1 : ((key1 == key2) ? 0 : 1));
+}
+
+static int
+MapKey(TERMINAL_CONTROL_BLOCK * TCB, WORD vKey)
+{
+ WORD nKey = 0;
+ void *res;
+ LONG key = GenMap(vKey, 0);
+ int code = -1;
+
+ AssertTCB();
+
+ res = bsearch(&key,
+ PropOf(TCB)->map,
+ (size_t) (N_INI + FKEYS),
+ sizeof(keylist[0]),
+ keycompare);
+ if (res) {
+ key = *((LONG *) res);
+ nKey = LOWORD(key);
+ code = (int) (nKey & 0x7fff);
+ if (nKey & 0x8000)
+ code = -code;
+ }
+ return code;
+}
+
+static void
+drv_release(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ T((T_CALLED("win32con::drv_release(%p)"), TCB));
+
+ AssertTCB();
+ if (TCB->prop)
+ free(TCB->prop);
+
+ returnVoid;
+}
+
+static void
+drv_init(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ DWORD num_buttons;
+
+ T((T_CALLED("win32con::drv_init(%p)"), TCB));
+
+ AssertTCB();
+
+ if (TCB) {
+ BOOL b = AllocConsole();
+ WORD a;
+ int i;
+
+ if (!b)
+ b = AttachConsole(ATTACH_PARENT_PROCESS);
+
+ TCB->inp = GetStdHandle(STD_INPUT_HANDLE);
+ TCB->out = GetStdHandle(STD_OUTPUT_HANDLE);
+
+ if (getenv("NCGDB"))
+ TCB->hdl = TCB->out;
+ else
+ TCB->hdl = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE,
+ 0,
+ NULL,
+ CONSOLE_TEXTMODE_BUFFER,
+ NULL);
+
+ if (!InvalidConsoleHandle(TCB->hdl)) {
+ TCB->prop = typeCalloc(Properties, 1);
+ GetConsoleScreenBufferInfo(TCB->hdl, &(PropOf(TCB)->SBI));
+ }
+
+ TCB->info.initcolor = TRUE;
+ TCB->info.canchange = FALSE;
+ TCB->info.hascolor = TRUE;
+ TCB->info.caninit = TRUE;
+
+ TCB->info.maxpairs = NUMPAIRS;
+ TCB->info.maxcolors = 8;
+ TCB->info.numlabels = 0;
+ TCB->info.labelwidth = 0;
+ TCB->info.labelheight = 0;
+ TCB->info.nocolorvideo = 1;
+ TCB->info.tabsize = 8;
+
+ if (GetNumberOfConsoleMouseButtons(&num_buttons)) {
+ T(("mouse has %ld buttons", num_buttons));
+ TCB->info.numbuttons = num_buttons;
+ } else {
+ TCB->info.numbuttons = 1;
+ }
+
+ TCB->info.defaultPalette = _nc_cga_palette;
+
+ for (i = 0; i < (N_INI + FKEYS); i++) {
+ if (i < N_INI)
+ PropOf(TCB)->rmap[i] = PropOf(TCB)->map[i] = keylist[i];
+ else
+ PropOf(TCB)->rmap[i] = PropOf(TCB)->map[i] =
+ GenMap((VK_F1 + (i - N_INI)), (KEY_F(1) + (i - N_INI)));
+ }
+ qsort(PropOf(TCB)->map,
+ (size_t) (MAPSIZE),
+ sizeof(keylist[0]),
+ keycompare);
+ qsort(PropOf(TCB)->rmap,
+ (size_t) (MAPSIZE),
+ sizeof(keylist[0]),
+ rkeycompare);
+
+ a = MapColor(true, COLOR_WHITE) | MapColor(false, COLOR_BLACK);
+ for (i = 0; i < NUMPAIRS; i++)
+ PropOf(TCB)->pairs[i] = a;
+ }
+ returnVoid;
+}
+
+static void
+drv_initpair(TERMINAL_CONTROL_BLOCK * TCB,
+ short pair,
+ short f,
+ short b)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ if ((pair > 0) && (pair < NUMPAIRS) && (f >= 0) && (f < 8)
+ && (b >= 0) && (b < 8)) {
+ PropOf(TCB)->pairs[pair] = MapColor(true, f) | MapColor(false, b);
+ }
+}
+
+static void
+drv_initcolor(TERMINAL_CONTROL_BLOCK * TCB,
+ short color GCC_UNUSED,
+ short r GCC_UNUSED,
+ short g GCC_UNUSED,
+ short b GCC_UNUSED)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+}
+
+static void
+drv_do_color(TERMINAL_CONTROL_BLOCK * TCB,
+ short old_pair GCC_UNUSED,
+ short pair GCC_UNUSED,
+ bool reverse GCC_UNUSED,
+ int (*outc) (SCREEN *, int) GCC_UNUSED
+)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+}
+
+static void
+drv_initmouse(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ sp->_mouse_type = M_TERM_DRIVER;
+}
+
+static int
+drv_testmouse(TERMINAL_CONTROL_BLOCK * TCB, int delay)
+{
+ int rc = 0;
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ if (sp->_drv_mouse_head < sp->_drv_mouse_tail) {
+ rc = TW_MOUSE;
+ } else {
+ rc = TCBOf(sp)->drv->twait(TCBOf(sp),
+ TWAIT_MASK,
+ delay,
+ (int *) 0
+ EVENTLIST_2nd(evl));
+ }
+
+ return rc;
+}
+
+static int
+drv_mvcur(TERMINAL_CONTROL_BLOCK * TCB,
+ int yold GCC_UNUSED, int xold GCC_UNUSED,
+ int y, int x)
+{
+ int ret = ERR;
+ if (TCB && !InvalidConsoleHandle(TCB->hdl)) {
+ COORD loc;
+ loc.X = (short) x;
+ loc.Y = (short) y;
+ SetConsoleCursorPosition(TCB->hdl, loc);
+ ret = OK;
+ }
+ return ret;
+}
+
+static void
+drv_hwlabel(TERMINAL_CONTROL_BLOCK * TCB,
+ int labnum GCC_UNUSED,
+ char *text GCC_UNUSED)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+}
+
+static void
+drv_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB,
+ bool OnFlag GCC_UNUSED)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+}
+
+static chtype
+drv_conattr(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED)
+{
+ chtype res = A_NORMAL;
+ res |= (A_BOLD | A_DIM | A_REVERSE | A_STANDOUT | A_COLOR);
+ return res;
+}
+
+static void
+drv_setfilter(TERMINAL_CONTROL_BLOCK * TCB)
+{
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+}
+
+static void
+drv_initacs(TERMINAL_CONTROL_BLOCK * TCB,
+ chtype *real_map GCC_UNUSED,
+ chtype *fake_map GCC_UNUSED)
+{
+#define DATA(a,b) { a, b }
+ static struct {
+ int acs_code;
+ int use_code;
+ } table[] = {
+ DATA('a', 0xb1), /* ACS_CKBOARD */
+ DATA('f', 0xf8), /* ACS_DEGREE */
+ DATA('g', 0xf1), /* ACS_PLMINUS */
+ DATA('j', 0xd9), /* ACS_LRCORNER */
+ DATA('l', 0xda), /* ACS_ULCORNER */
+ DATA('k', 0xbf), /* ACS_URCORNER */
+ DATA('m', 0xc0), /* ACS_LLCORNER */
+ DATA('n', 0xc5), /* ACS_PLUS */
+ DATA('q', 0xc4), /* ACS_HLINE */
+ DATA('t', 0xc3), /* ACS_LTEE */
+ DATA('u', 0xb4), /* ACS_RTEE */
+ DATA('v', 0xc1), /* ACS_BTEE */
+ DATA('w', 0xc2), /* ACS_TTEE */
+ DATA('x', 0xb3), /* ACS_VLINE */
+ DATA('y', 0xf3), /* ACS_LEQUAL */
+ DATA('z', 0xf2), /* ACS_GEQUAL */
+ DATA('0', 0xdb), /* ACS_BLOCK */
+ DATA('{', 0xe3), /* ACS_PI */
+ DATA('}', 0x9c), /* ACS_STERLING */
+ DATA(',', 0xae), /* ACS_LARROW */
+ DATA('+', 0xaf), /* ACS_RARROW */
+ DATA('~', 0xf9), /* ACS_BULLET */
+ };
+#undef DATA
+ unsigned n;
+
+ SCREEN *sp;
+ AssertTCB();
+ SetSP();
+
+ for (n = 0; n < SIZEOF(table); ++n) {
+ real_map[table[n].acs_code] = table[n].use_code | A_ALTCHARSET;
+ if (sp != 0)
+ sp->_screen_acs_map[table[n].acs_code] = TRUE;
+ }
+}
+
+static ULONGLONG
+tdiff(FILETIME fstart, FILETIME fend)
+{
+ ULARGE_INTEGER ustart;
+ ULARGE_INTEGER uend;
+ ULONGLONG diff;
+
+ ustart.LowPart = fstart.dwLowDateTime;
+ ustart.HighPart = fstart.dwHighDateTime;
+ uend.LowPart = fend.dwLowDateTime;
+ uend.HighPart = fend.dwHighDateTime;
+
+ diff = (uend.QuadPart - ustart.QuadPart) / 10000;
+ return diff;
+}
+
+static int
+Adjust(int milliseconds, int diff)
+{
+ if (milliseconds == INFINITY)
+ return milliseconds;
+ milliseconds -= diff;
+ if (milliseconds < 0)
+ milliseconds = 0;
+ return milliseconds;
+}
+
+#define BUTTON_MASK (FROM_LEFT_1ST_BUTTON_PRESSED | \
+ FROM_LEFT_2ND_BUTTON_PRESSED | \
+ FROM_LEFT_3RD_BUTTON_PRESSED | \
+ FROM_LEFT_4TH_BUTTON_PRESSED | \
+ RIGHTMOST_BUTTON_PRESSED)
+
+static int
+decode_mouse(TERMINAL_CONTROL_BLOCK * TCB, int mask)
+{
+ SCREEN *sp;
+ int result = 0;
+
+ AssertTCB();
+ SetSP();
+
+ if (mask & FROM_LEFT_1ST_BUTTON_PRESSED)
+ result |= BUTTON1_PRESSED;
+ if (mask & FROM_LEFT_2ND_BUTTON_PRESSED)
+ result |= BUTTON2_PRESSED;
+ if (mask & FROM_LEFT_3RD_BUTTON_PRESSED)
+ result |= BUTTON3_PRESSED;
+ if (mask & FROM_LEFT_4TH_BUTTON_PRESSED)
+ result |= BUTTON4_PRESSED;
+
+ if (mask & RIGHTMOST_BUTTON_PRESSED) {
+ switch (TCB->info.numbuttons) {
+ case 1:
+ result |= BUTTON1_PRESSED;
+ break;
+ case 2:
+ result |= BUTTON2_PRESSED;
+ break;
+ case 3:
+ result |= BUTTON3_PRESSED;
+ break;
+ case 4:
+ result |= BUTTON4_PRESSED;
+ break;
+ }
+ }
+
+ return result;
+}
+
+static int
+drv_twait(TERMINAL_CONTROL_BLOCK * TCB,
+ int mode,
+ int milliseconds,
+ int *timeleft
+ EVENTLIST_2nd(_nc_eventlist * evl))
+{
+ SCREEN *sp;
+ INPUT_RECORD inp_rec;
+ BOOL b;
+ DWORD nRead = 0, rc = -1;
+ int code = 0;
+ FILETIME fstart;
+ FILETIME fend;
+ int diff;
+ bool isImmed = (milliseconds == 0);
+
+#define CONSUME() ReadConsoleInput(TCB->inp,&inp_rec,1,&nRead)
+
+ AssertTCB();
+ SetSP();
+
+ TR(TRACE_IEVENT, ("start twait: %d milliseconds, mode: %d",
+ milliseconds, mode));
+
+ if (milliseconds < 0)
+ milliseconds = INFINITY;
+
+ memset(&inp_rec, 0, sizeof(inp_rec));
+
+ while (true) {
+ GetSystemTimeAsFileTime(&fstart);
+ rc = WaitForSingleObject(TCB->inp, milliseconds);
+ GetSystemTimeAsFileTime(&fend);
+ diff = (int) tdiff(fstart, fend);
+ milliseconds = Adjust(milliseconds, diff);
+
+ if (!isImmed && milliseconds == 0)
+ break;
+
+ if (rc == WAIT_OBJECT_0) {
+ if (mode) {
+ b = GetNumberOfConsoleInputEvents(TCB->inp, &nRead);
+ if (b && nRead > 0) {
+ b = PeekConsoleInput(TCB->inp, &inp_rec, 1, &nRead);
+ if (b && nRead > 0) {
+ switch (inp_rec.EventType) {
+ case KEY_EVENT:
+ if (mode & TW_INPUT) {
+ WORD vk = inp_rec.Event.KeyEvent.wVirtualKeyCode;
+ char ch = inp_rec.Event.KeyEvent.uChar.AsciiChar;
+
+ if (inp_rec.Event.KeyEvent.bKeyDown) {
+ if (0 == ch) {
+ int nKey = MapKey(TCB, vk);
+ if ((nKey < 0) || FALSE == sp->_keypad_on) {
+ CONSUME();
+ continue;
+ }
+ }
+ code = TW_INPUT;
+ goto end;
+ } else {
+ CONSUME();
+ }
+ }
+ continue;
+ case MOUSE_EVENT:
+ if (decode_mouse(TCB,
+ (inp_rec.Event.MouseEvent.dwButtonState
+ & BUTTON_MASK)) == 0) {
+ CONSUME();
+ } else if (mode & TW_MOUSE) {
+ code = TW_MOUSE;
+ goto end;
+ }
+ continue;
+ default:
+ SetConsoleActiveScreenBuffer(!PropOf(TCB)->progMode ?
+ TCB->hdl : TCB->out);
+ continue;
+ }
+ }
+ }
+ }
+ continue;
+ } else {
+ if (rc != WAIT_TIMEOUT) {
+ code = -1;
+ break;
+ } else {
+ code = 0;
+ break;
+ }
+ }
+ }
+ end:
+
+ TR(TRACE_IEVENT, ("end twait: returned %d (%d), remaining time %d msec",
+ code, errno, milliseconds));
+
+ if (timeleft)
+ *timeleft = milliseconds;
+
+ return code;
+}
+
+static bool
+handle_mouse(TERMINAL_CONTROL_BLOCK * TCB, MOUSE_EVENT_RECORD mer)
+{
+ SCREEN *sp;
+ MEVENT work;
+ bool result = FALSE;
+
+ AssertTCB();
+ SetSP();
+
+ sp->_drv_mouse_old_buttons = sp->_drv_mouse_new_buttons;
+ sp->_drv_mouse_new_buttons = mer.dwButtonState & BUTTON_MASK;
+
+ /*
+ * We're only interested if the button is pressed or released.
+ * FIXME: implement continuous event-tracking.
+ */
+ if (sp->_drv_mouse_new_buttons != sp->_drv_mouse_old_buttons) {
+
+ memset(&work, 0, sizeof(work));
+
+ if (sp->_drv_mouse_new_buttons) {
+
+ work.bstate |= decode_mouse(TCB, sp->_drv_mouse_new_buttons);
+
+ } else {
+
+ /* cf: BUTTON_PRESSED, BUTTON_RELEASED */
+ work.bstate |= (decode_mouse(TCB, sp->_drv_mouse_old_buttons) >> 1);
+
+ result = TRUE;
+ }
+
+ work.x = mer.dwMousePosition.X;
+ work.y = mer.dwMousePosition.Y;
+
+ sp->_drv_mouse_fifo[sp->_drv_mouse_tail] = work;
+ sp->_drv_mouse_tail += 1;
+ }
+
+ return result;
+}
+
+static int
+drv_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf)
+{
+ SCREEN *sp;
+ int n = 1;
+ INPUT_RECORD inp_rec;
+ BOOL b;
+ DWORD nRead;
+ WORD vk;
+ WORD sc;
+
+ AssertTCB();
+ assert(buf);
+ SetSP();
+
+ memset(&inp_rec, 0, sizeof(inp_rec));
+
+ T((T_CALLED("win32con::drv_read(%p)"), TCB));
+ while ((b = ReadConsoleInput(TCB->inp, &inp_rec, 1, &nRead))) {
+ if (b && nRead > 0) {
+ if (inp_rec.EventType == KEY_EVENT) {
+ if (!inp_rec.Event.KeyEvent.bKeyDown)
+ continue;
+ *buf = (int) inp_rec.Event.KeyEvent.uChar.AsciiChar;
+ vk = inp_rec.Event.KeyEvent.wVirtualKeyCode;
+ sc = inp_rec.Event.KeyEvent.wVirtualScanCode;
+ if (*buf == 0) {
+ if (sp->_keypad_on) {
+ *buf = MapKey(TCB, vk);
+ if (0 > (*buf))
+ continue;
+ else
+ break;
+ } else
+ continue;
+ } else { /* *buf != 0 */
+ break;
+ }
+ } else if (inp_rec.EventType == MOUSE_EVENT) {
+ if (handle_mouse(TCB, inp_rec.Event.MouseEvent)) {
+ *buf = KEY_MOUSE;
+ break;
+ }
+ }
+ continue;
+ }
+ }
+ returnCode(n);
+}
+
+static int
+drv_nap(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int ms)
+{
+ Sleep(ms);
+ return OK;
+}
+
+static bool
+drv_kyExist(TERMINAL_CONTROL_BLOCK * TCB, int keycode)
+{
+ SCREEN *sp;
+ WORD nKey;
+ void *res;
+ bool found = FALSE;
+ LONG key = GenMap(0, (WORD) keycode);
+
+ AssertTCB();
+ SetSP();
+
+ AssertTCB();
+
+ res = bsearch(&key,
+ PropOf(TCB)->rmap,
+ (size_t) (N_INI + FKEYS),
+ sizeof(keylist[0]),
+ rkeycompare);
+ if (res) {
+ key = *((LONG *) res);
+ nKey = LOWORD(key);
+ if (!(nKey & 0x8000))
+ found = TRUE;
+ }
+ return found;
+}
+
+static int
+drv_kpad(TERMINAL_CONTROL_BLOCK * TCB, bool flag GCC_UNUSED)
+{
+ SCREEN *sp;
+ int code = ERR;
+
+ AssertTCB();
+ sp = TCB->csp;
+
+ if (sp) {
+ code = OK;
+ }
+ return code;
+}
+
+static int
+drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int keycode, bool flag)
+{
+ int code = ERR;
+ SCREEN *sp;
+ WORD nKey;
+ WORD vKey;
+ void *res;
+ LONG key = GenMap(0, (WORD) keycode);
+
+ AssertTCB();
+ SetSP();
+
+ if (sp) {
+ res = bsearch(&key,
+ PropOf(TCB)->rmap,
+ (size_t) (N_INI + FKEYS),
+ sizeof(keylist[0]),
+ rkeycompare);
+ if (res) {
+ key = *((LONG *) res);
+ vKey = HIWORD(key);
+ nKey = (LOWORD(key)) & 0x7fff;
+ if (!flag)
+ nKey |= 0x8000;
+ *(LONG *) res = GenMap(vKey, nKey);
+ }
+ }
+ return code;
+}
+
+NCURSES_EXPORT_VAR (TERM_DRIVER) _nc_WIN_DRIVER = {
+ FALSE,
+ drv_CanHandle, /* CanHandle */
+ drv_init, /* init */
+ drv_release, /* release */
+ drv_size, /* size */
+ drv_sgmode, /* sgmode */
+ drv_conattr, /* conattr */
+ drv_mvcur, /* hwcur */
+ drv_mode, /* mode */
+ drv_rescol, /* rescol */
+ drv_rescolors, /* rescolors */
+ drv_setcolor, /* color */
+ drv_dobeepflash, /* DoBeepFlash */
+ drv_initpair, /* initpair */
+ drv_initcolor, /* initcolor */
+ drv_do_color, /* docolor */
+ drv_initmouse, /* initmouse */
+ drv_testmouse, /* testmouse */
+ drv_setfilter, /* setfilter */
+ drv_hwlabel, /* hwlabel */
+ drv_hwlabelOnOff, /* hwlabelOnOff */
+ drv_doupdate, /* update */
+ drv_defaultcolors, /* defaultcolors */
+ drv_print, /* print */
+ drv_size, /* getsize */
+ drv_setsize, /* setsize */
+ drv_initacs, /* initacs */
+ drv_screen_init, /* scinit */
+ drv_wrap, /* scexit */
+ drv_twait, /* twait */
+ drv_read, /* read */
+ drv_nap, /* nap */
+ drv_kpad, /* kpad */
+ drv_keyok, /* kyOk */
+ drv_kyExist /* kyExist */
+};