diff options
Diffstat (limited to 'contrib/ncurses/ncurses')
113 files changed, 8551 insertions, 1534 deletions
diff --git a/contrib/ncurses/ncurses/Makefile.in b/contrib/ncurses/ncurses/Makefile.in index 0061f82..9b9a39e 100644 --- a/contrib/ncurses/ncurses/Makefile.in +++ b/contrib/ncurses/ncurses/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.72 2001/03/24 19:53:31 tom Exp $ +# $Id: Makefile.in,v 1.83 2002/04/20 22:02:39 tom Exp $ ############################################################################## -# Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. # +# Copyright (c) 1998,1999,2000,2001,2002 Free 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,7 +27,7 @@ # authorization. # ############################################################################## # -# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 +# Author: Thomas E. Dickey 1996-2001 # # Makefile for ncurses source code. # @@ -55,9 +55,11 @@ CF_MFLAGS = @cf_cv_makeflags@ MODEL = @DFT_LWR_MODEL@ DESTDIR = @DESTDIR@ +top_srcdir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ +bindir = @bindir@ libdir = @libdir@ includedir = @includedir@ datadir = @datadir@ @@ -66,6 +68,7 @@ LIBTOOL = @LIBTOOL@ INSTALL = @INSTALL@ INSTALL_LIB = @INSTALL@ @INSTALL_LIB@ +INSTALL_PROG = @INSTALL_PROG@ INSTALL_DATA = @INSTALL_DATA@ AR = @AR@ @@ -85,8 +88,9 @@ CPPFLAGS = -I../ncurses -I$(srcdir) @CPPFLAGS@ \ CCFLAGS = $(CPPFLAGS) $(CFLAGS) HOSTCC = @BUILD_CC@ -HOSTCCFLAGS = @CFLAGS@ $(CPPFLAGS) -HOSTLDFLAGS = @LDFLAGS@ @LIBS@ +HOSTCCFLAGS = @BUILD_CFLAGS@ $(CPPFLAGS) +HOSTLDFLAGS = @BUILD_LDFLAGS@ +HOSTLIBS = @BUILD_LIBS@ CFLAGS_LIBTOOL = $(CCFLAGS) CFLAGS_NORMAL = $(CCFLAGS) @@ -99,7 +103,7 @@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) LINK = $(LIBTOOL) $(CC) LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ -SHLIB_DIRS = -L../lib -L$(libdir) +SHLIB_DIRS = -L../lib SHLIB_LIST = $(SHLIB_DIRS) @SHLIB_LIST@ TINFO_LIST = $(SHLIB_DIRS) @TINFO_LIST@ @@ -112,6 +116,8 @@ ABI_VERSION = @cf_cv_abi_version@ RANLIB = @RANLIB@ +IMPORT_LIB = @IMPORT_LIB@ +SHARED_LIB = @SHARED_LIB@ LIBRARIES = @LIBS_TO_MAKE@ LINT = @LINT@ @@ -120,17 +126,21 @@ LINT_LIBS = -lncurses @LIBS@ FALLBACK_LIST = @FALLBACK_LIST@ +TERMINFO_CAPS = $(top_srcdir)/include/@TERMINFO_CAPS@ + AUTO_SRC = \ ../include/nomacros.h \ - ./comp_captab.c \ - ./expanded.c \ - ./fallback.c \ + codes.c \ + comp_captab.c \ + expanded.c \ + fallback.c \ init_keytry.h \ - ./lib_keyname.c \ - ./lib_gen.c \ - ./codes.c \ - ./names.c \ - ./unctrl.c + keys.list \ + lib_gen.c \ + lib_keyname.c \ + link_test.c \ + names.c \ + unctrl.c TEST_DEPS = ../lib/@LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@ TEST_ARGS = -L../lib -lncurses@DFT_ARG_SUFFIX@ @@ -139,6 +149,7 @@ TEST_LDFLAGS = @LD_MODEL@ $(TEST_ARGS) @LIBS@ @EXTRA_LIBS@ @LOCAL_LDFLAGS@ @LDFL TEST_PROGS = \ captoinfo$x \ hardscroll$x \ + link_test$x \ hashmap$x \ lib_mvcur$x @@ -146,6 +157,7 @@ base = $(srcdir)/base serial = $(srcdir)/tty tinfo = $(srcdir)/tinfo trace = $(srcdir)/trace +wide = $(srcdir)/widechar ################################################################################ all \ @@ -153,53 +165,57 @@ libs :: $(AUTO_SRC) ../lib $(LIBRARIES) sources: $(AUTO_SRC) +$(DESTDIR)$(bindir) \ $(DESTDIR)$(libdir) : - $(srcdir)/../mkinstalldirs $@ + sh $(srcdir)/../mkinstalldirs $@ ../lib : ; mkdir $@ -./fallback.c : $(tinfo)/MKfallback.sh - sh $(tinfo)/MKfallback.sh $(FALLBACK_LIST) >$@ +fallback.c : $(tinfo)/MKfallback.sh + sh $(tinfo)/MKfallback.sh @TERMINFO@ @TERMINFO_SRC@ $(FALLBACK_LIST) >$@ -./lib_gen.c : $(base)/MKlib_gen.sh ../include/curses.h - sh $(base)/MKlib_gen.sh "$(CPP)" "$(AWK)" <../include/curses.h >$@ +lib_gen.c : $(base)/MKlib_gen.sh ../include/curses.h + sh $(base)/MKlib_gen.sh "$(CPP) $(CPPFLAGS)" "$(AWK)" generated <../include/curses.h >$@ ../include/nomacros.h : $(base)/MKlib_gen.sh ../include/curses.h - sh $(base)/MKlib_gen.sh "$(CPP)" "$(AWK)" <../include/curses.h | \ + sh $(base)/MKlib_gen.sh "$(CPP) $(CPPFLAGS)" "$(AWK)" generated <../include/curses.h | \ fgrep undef >$@ -init_keytry.h: make_keys$x $(tinfo)/keys.list - ./make_keys $(tinfo)/keys.list > $@ +init_keytry.h: make_keys$x keys.list + ./make_keys keys.list > $@ + +keys.list : $(tinfo)/MKkeys_list.sh + AWK=$(AWK) sh $(tinfo)/MKkeys_list.sh $(TERMINFO_CAPS) | sort >$@ make_keys$x : \ $(tinfo)/make_keys.c \ - ./names.c - $(HOSTCC) -o $@ $(HOSTCCFLAGS) $(tinfo)/make_keys.c $(HOSTLDFLAGS) + names.c + $(HOSTCC) -o $@ $(HOSTCCFLAGS) $(tinfo)/make_keys.c $(HOSTLDFLAGS) $(HOSTLIBS) make_hash$x : \ $(tinfo)/comp_hash.c \ ../include/hashsize.h - $(HOSTCC) -o $@ $(HOSTCCFLAGS) -DMAIN_PROGRAM $(tinfo)/comp_hash.c $(HOSTLDFLAGS) + $(HOSTCC) -o $@ $(HOSTCCFLAGS) -DMAIN_PROGRAM $(tinfo)/comp_hash.c $(HOSTLDFLAGS) $(HOSTLIBS) -./expanded.c : $(serial)/MKexpanded.sh +expanded.c : $(serial)/MKexpanded.sh sh $(serial)/MKexpanded.sh "$(CPP)" $(CPPFLAGS) > $@ -./comp_captab.c: \ +comp_captab.c: \ make_hash$x \ ../include/hashsize.h \ $(tinfo)/MKcaptab.awk - sh $(tinfo)/MKcaptab.awk $(AWK) $(srcdir)/../include/Caps > $@ + sh $(tinfo)/MKcaptab.awk $(AWK) $(srcdir)/../include/@TERMINFO_CAPS@ > $@ -./lib_keyname.c: $(tinfo)/keys.list $(base)/MKkeyname.awk - $(AWK) -f $(base)/MKkeyname.awk $(tinfo)/keys.list > $@ +lib_keyname.c: keys.list $(base)/MKkeyname.awk + $(AWK) -f $(base)/MKkeyname.awk keys.list > $@ -./names.c ./codes.c: $(tinfo)/MKnames.awk - $(AWK) -f $(tinfo)/MKnames.awk $(srcdir)/../include/Caps - cat namehdr boolnames boolfnames numnames numfnames strnames strfnames nameftr >./names.c - cat namehdr boolcodes numcodes strcodes codeftr >./codes.c +names.c codes.c: $(tinfo)/MKnames.awk + $(AWK) -f $(tinfo)/MKnames.awk $(srcdir)/../include/@TERMINFO_CAPS@ + cat namehdr boolnames boolfnames numnames numfnames strnames strfnames nameftr >names.c + cat namehdr boolcodes numcodes strcodes codeftr >codes.c -rm -f namehdr nameftr codeftr boolnames boolfnames boolcodes numnames numfnames numcodes strnames strfnames strcodes -./unctrl.c: $(base)/MKunctrl.awk +unctrl.c: $(base)/MKunctrl.awk echo | $(AWK) -f $(base)/MKunctrl.awk >$@ tags: @@ -209,7 +225,7 @@ tags: @MAKE_UPPER_TAGS@ etags *.[ch] mostlyclean :: - -rm -f core tags TAGS *~ *.i *.ln *.atac trace + -rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace -rm -f $(TEST_PROGS) clean :: mostlyclean @@ -232,6 +248,9 @@ realclean :: distclean # These rules build test-programs for the modules that have test-drivers test_progs : $(TEST_PROGS) +link_test.c : $(base)/MKlib_gen.sh ../include/curses.h + sh $(base)/MKlib_gen.sh "$(CPP) $(CPPFLAGS)" "$(AWK)" implemented <../include/curses.h >$@ + captoinfo$x : $(tinfo)/captoinfo.c $(TEST_DEPS) @ECHO_LINK@ $(CC) -o $@ $(CFLAGS_DEFAULT) -DMAIN $(tinfo)/captoinfo.c $(TEST_LDFLAGS) @@ -245,6 +264,10 @@ lib_mvcur$x : $(serial)/lib_mvcur.c $(TEST_DEPS) \ ../@DFT_OBJ_SUBDIR@/dump_entry.o @ECHO_LINK@ $(CC) -o $@ $(CFLAGS_DEFAULT) -DNCURSES_TEST -I$(serial)/../../progs $(serial)/lib_mvcur.c ../@DFT_OBJ_SUBDIR@/dump_entry.o $(TEST_LDFLAGS) +link_test$x : link_test.c $(TEST_DEPS) \ + ../@DFT_OBJ_SUBDIR@/link_test.o + @ECHO_LINK@ $(CC) -o $@ $(CFLAGS_DEFAULT) ../@DFT_OBJ_SUBDIR@/link_test.o $(TEST_LDFLAGS) + ../@DFT_OBJ_SUBDIR@/dump_entry.o: cd ../progs && $(MAKE) ../@DFT_OBJ_SUBDIR@/dump_entry.o diff --git a/contrib/ncurses/ncurses/base/MKkeyname.awk b/contrib/ncurses/ncurses/base/MKkeyname.awk index c067733..5aab936 100644 --- a/contrib/ncurses/ncurses/base/MKkeyname.awk +++ b/contrib/ncurses/ncurses/base/MKkeyname.awk @@ -1,6 +1,6 @@ -# $Id: MKkeyname.awk,v 1.18 2000/12/10 02:25:23 tom Exp $ +# $Id: MKkeyname.awk,v 1.21 2002/02/23 22:36:33 tom Exp $ ############################################################################## -# Copyright (c) 1999,2000 Free Software Foundation, Inc. # +# Copyright (c) 1999-2001,2002 Free 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"), # @@ -29,10 +29,7 @@ BEGIN { print "/* generated by MKkeyname.awk */" print "" - print "#include <ncurses_cfg.h>" - print "#include <stdlib.h>" - print "#include <string.h>" - print "#include <curses.h>" + print "#include <curses.priv.h>" print "#include <tic.h>" print "" print "const struct kn _nc_key_names[] = {" @@ -47,28 +44,47 @@ END { print "" print "NCURSES_EXPORT(NCURSES_CONST char *) keyname (int c)" print "{" + print "static char **table;" print "int i;" - print "static char name[20];" + print "char name[20];" print "char *p;" print "" print "\tfor (i = 0; _nc_key_names[i].name != 0; i++)" print "\t\tif (_nc_key_names[i].code == c)" print "\t\t\treturn (NCURSES_CONST char *)_nc_key_names[i].name;" print "\tif (c >= 256) return \"UNKNOWN KEY\";" - print "\tp = name;" - print "\tif (c >= 128) {" - print "\t\tstrcpy(p, \"M-\");" - print "\t\tp += 2;" - print "\t\tc -= 128;" + print "" + print "\tif (table == 0)" + print "\t\ttable = typeCalloc(char *, 256);" + print "\tif (table == 0)" + print "\t\treturn keyname(256);" + print "" + print "\tif (table[c] == 0) {" + print "\t\tp = name;" + print "\t\tif (c >= 128) {" + print "\t\t\tstrcpy(p, \"M-\");" + print "\t\t\tp += 2;" + print "\t\t\tc -= 128;" + print "\t\t}" + print "\t\tif (c < 0)" + print "\t\t\tsprintf(p, \"%d\", c);" + print "\t\telse if (c < 32)" + print "\t\t\tsprintf(p, \"^%c\", c + '@');" + print "\t\telse if (c == 127)" + print "\t\t\tstrcpy(p, \"^?\");" + print "\t\telse" + print "\t\t\tsprintf(p, \"%c\", c);" + print "\t\ttable[c] = strdup(name);" print "\t}" - print "\tif (c < 0)" - print "\t\tsprintf(p, \"%d\", c);" - print "\telse if (c < 32)" - print "\t\tsprintf(p, \"^%c\", c + '@');" - print "\telse if (c == 127)" - print "\t\tstrcpy(p, \"^?\");" - print "\telse" - print "\t\tsprintf(p, \"%c\", c);" - print "\treturn (NCURSES_CONST char *)name;" + print "\treturn (NCURSES_CONST char *)table[c];" + print "}" + print "" + print "#if USE_WIDEC_SUPPORT" + print "NCURSES_EXPORT(NCURSES_CONST char *) key_name (wchar_t c)" + print "{" + print "\tchar *result = keyname((int)c);" + print "\tif (!strncmp(result, \"M-\", 2)) result = \"UNKNOWN KEY\";" + print "\treturn result;" print "}" + print "#endif" } diff --git a/contrib/ncurses/ncurses/base/MKlib_gen.sh b/contrib/ncurses/ncurses/base/MKlib_gen.sh index 4de2a5a..e172feb 100755 --- a/contrib/ncurses/ncurses/base/MKlib_gen.sh +++ b/contrib/ncurses/ncurses/base/MKlib_gen.sh @@ -2,7 +2,35 @@ # # MKlib_gen.sh -- generate sources from curses.h macro definitions # -# ($Id: MKlib_gen.sh,v 1.13 2000/12/10 00:30:25 tom Exp $) +# ($Id: MKlib_gen.sh,v 1.18 2002/04/30 00:37:55 tom Exp $) +# +############################################################################## +# Copyright (c) 1998-2001,2002 Free 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. # +############################################################################## # # The XSI Curses standard requires all curses entry points to exist as # functions, even though many definitions would normally be shadowed @@ -28,21 +56,30 @@ preprocessor="$1 -I../include" AWK="$2" -ED1=sed1$$.sed -ED2=sed2$$.sed -ED3=sed3$$.sed -AW1=awk1$$.awk -TMP=gen$$.c -trap "rm -f $ED1 $ED2 $ED3 $AW1 $TMP" 0 1 2 5 15 - -(cat <<EOF -#include <ncurses_cfg.h> -#include <curses.h> +USE="$3" -DECLARATIONS +PID=$$ +ED1=sed1_${PID}.sed +ED2=sed2_${PID}.sed +ED3=sed3_${PID}.sed +ED4=sed4_${PID}.sed +AW1=awk1_${PID}.awk +AW2=awk2_${PID}.awk +TMP=gen__${PID}.c +trap "rm -f $ED1 $ED2 $ED3 $ED4 $AW1 $AW2 $TMP" 0 1 2 5 15 -EOF -cat >$ED1 <<EOF1 +ALL=$USE +if test "$USE" = implemented ; then + CALL="call_" + cat >$ED1 <<EOF1 +/^extern.*implemented/{ + h + s/^.*implemented:\([^ *]*\).*/P_#if_USE_\1_SUPPORT/p + g + s/^extern \([^;]*\);.*/\1/p + g + s/^.*implemented:\([^ *]*\).*/P_#endif/p +} /^extern.*generated/{ h s/^.*generated:\([^ *]*\).*/P_#if_USE_\1_SUPPORT/p @@ -52,6 +89,19 @@ cat >$ED1 <<EOF1 s/^.*generated:\([^ *]*\).*/P_#endif/p } EOF1 +else + CALL="" + cat >$ED1 <<EOF1 +/^extern.*${ALL}/{ + h + s/^.*${ALL}:\([^ *]*\).*/P_#if_USE_\1_SUPPORT/p + g + s/^extern \([^;]*\);.*/\1/p + g + s/^.*${ALL}:\([^ *]*\).*/P_#endif/p +} +EOF1 +fi cat >$ED2 <<EOF2 /^P_/b nc @@ -74,6 +124,7 @@ cat >$ED2 <<EOF2 s/*/ * /g s/%/ , /g s/)/ z)/ + s/\.\.\. z)/...)/ :nc /(/s// ( / s/)/ )/ @@ -88,6 +139,7 @@ cat >$ED3 <<EOF3 s/ */ /g s/ */ /g s/ ,/,/g + s/( /(/g s/ )/)/g s/ gen_/ / s/^M_/#undef / @@ -95,34 +147,74 @@ cat >$ED3 <<EOF3 :done EOF3 +if test "$USE" = generated ; then +cat >$ED4 <<EOF + s/^\(.*\) \(.*\) (\(.*\))\$/NCURSES_EXPORT(\1) \2 (\3)/ +EOF +else +cat >$ED4 <<EOF +/^\(.*\) \(.*\) (\(.*\))\$/ { + h + s/^\(.*\) \(.*\) (\(.*\))\$/extern \1 call_\2 (\3);/ + p + g + s/^\(.*\) \(.*\) (\(.*\))\$/\1 call_\2 (\3)/ + } +EOF +fi + cat >$AW1 <<\EOF1 BEGIN { skip=0; } - /^P_#if/ { +/^P_#if/ { print "\n" print $0 skip=0; - } - /^P_#endif/ { +} +/^P_#endif/ { print $0 skip=1; - } - $0 !~ /^P_/ { +} +$0 !~ /^P_/ { if (skip) print "\n" skip=1; - if ( $1 == "chtype" ) { + first=$1 + for (i = 1; i <= NF; i++) { + if ( $i != "NCURSES_CONST" ) { + first = i; + break; + } + } + second = first + 1; + if ( $first == "chtype" ) { returnType = "Char"; + } else if ( $first == "SCREEN" ) { + returnType = "SP"; + } else if ( $first == "WINDOW" ) { + returnType = "Win"; + } else if ( $second == "*" ) { + returnType = "Ptr"; } else { returnType = "Code"; } - print "M_" $2 + myfunc = second; + for (i = second; i <= NF; i++) { + if ($i != "*") { + myfunc = i; + break; + } + } + if (using == "generated") { + print "M_" $myfunc + } print $0; print "{"; argcount = 1; - if (NF == 5 && $4 == "void") + check = NF - 1; + if ($check == "void") argcount = 0; if (argcount != 0) { for (i = 1; i <= NF; i++) @@ -133,8 +225,19 @@ BEGIN { # suppress trace-code for functions that we cannot do properly here, # since they return data. dotrace = 1; - if ($2 == "innstr") + if ($myfunc ~ /innstr/) + dotrace = 0; + if ($myfunc ~ /innwstr/) + dotrace = 0; + + # workaround functions that we do not parse properly + if ($myfunc ~ /ripoffline/) { dotrace = 0; + argcount = 2; + } + if ($myfunc ~ /wunctrl/) { + dotrace = 0; + } call = "%%T((T_CALLED(\"" args = "" @@ -142,7 +245,7 @@ BEGIN { num = 0; pointer = 0; argtype = "" - for (i = 1; i <= NF; i++) { + for (i = myfunc; i <= NF; i++) { ch = $i; if ( ch == "*" ) pointer = 1; @@ -181,7 +284,7 @@ BEGIN { } if (ch == ",") args = args comma "a" ++num; - else if (argcount != 0) + else if ( argcount != 0 && $check != "..." ) args = args comma "z" call = call ch if (pointer == 0 && argcount != 0 && argtype != "" ) @@ -209,11 +312,17 @@ BEGIN { else call = "%%return "; - call = call $2 "("; - for (i = 1; i < argcount; i++) - call = call "a" i ", "; - if (argcount != 0) + call = call $myfunc "("; + for (i = 1; i < argcount; i++) { + if (i != 1) + call = call ", "; + call = call "a" i; + } + if ( argcount != 0 && $check != "..." ) { + if (argcount != 1) + call = call ", "; call = call "z"; + } if (!match($0, "^void")) call = call ") "; if (dotrace) @@ -226,38 +335,54 @@ BEGIN { } EOF1 -sed -n -f $ED1 \ -| sed -e 's/NCURSES_EXPORT(\(.*\)) \(.*\) (\(.*\))/\1 \2(\3)/' \ -| sed -f $ED2 \ -| $AWK -f $AW1 ) \ -| sed \ - -e '/^\([a-z_][a-z_]*\) /s//\1 gen_/' >$TMP - $preprocessor $TMP 2>/dev/null \ -| $AWK ' +cat >$AW2 <<EOF1 BEGIN { - print "/*" - print " * DO NOT EDIT THIS FILE BY HAND!" - print " * It is generated by MKlib_gen.sh." - print " *" - print " * This is a file of trivial functions generated from macro" - print " * definitions in curses.h to satisfy the XSI Curses requirement" - print " * that every macro also exist as a callable function." - print " *" - print " * It will never be linked unless you call one of the entry" - print " * points with its normal macro definition disabled. In that" - print " * case, if you have no shared libraries, it will indirectly" - print " * pull most of the rest of the library into your link image." - print " */" - print "#include <curses.priv.h>" - print "" + print "/*" + print " * DO NOT EDIT THIS FILE BY HAND!" + printf " * It is generated by $0 %s.\n", "$USE" + if ( "$USE" == "generated" ) { + print " *" + print " * This is a file of trivial functions generated from macro" + print " * definitions in curses.h to satisfy the XSI Curses requirement" + print " * that every macro also exist as a callable function." + print " *" + print " * It will never be linked unless you call one of the entry" + print " * points with its normal macro definition disabled. In that" + print " * case, if you have no shared libraries, it will indirectly" + print " * pull most of the rest of the library into your link image." + } + print " */" + print "#include <curses.priv.h>" + print "" } /^DECLARATIONS/ {start = 1; next;} - {if (start) print $0;} -' \ + {if (start) print \$0;} +END { + if ( "$USE" != "generated" ) { + print "int main(void) { return 0; }" + } + } +EOF1 + +cat >$TMP <<EOF +#include <ncurses_cfg.h> +#include <curses.h> + +DECLARATIONS + +EOF + +sed -n -f $ED1 \ +| sed -e 's/NCURSES_EXPORT(\(.*\)) \(.*\) (\(.*\))/\1 \2(\3)/' \ +| sed -f $ED2 \ +| $AWK -f $AW1 using=$USE \ +| sed -e 's/^\([a-z_][a-z_]*[ *]*\)/\1 gen_/' -e 's/ / /g' >>$TMP + +$preprocessor $TMP 2>/dev/null \ +| sed -e 's/ / /g' -e 's/^ //' \ +| $AWK -f $AW2 \ | sed -f $ED3 \ | sed \ -e 's/^.*T_CALLED.*returnCode( \([a-z].*) \));/ return \1;/' \ -e 's/^.*T_CALLED.*returnCode( \((wmove.*) \));/ return \1;/' \ -| sed \ - -e 's/^\(.*\) \(.*\) (\(.*\))$/NCURSES_EXPORT(\1) \2 (\3)/' - +| sed -f $ED4 diff --git a/contrib/ncurses/ncurses/base/MKunctrl.awk b/contrib/ncurses/ncurses/base/MKunctrl.awk index d9d5da5..d8a6587 100644 --- a/contrib/ncurses/ncurses/base/MKunctrl.awk +++ b/contrib/ncurses/ncurses/base/MKunctrl.awk @@ -1,6 +1,6 @@ -# $Id: MKunctrl.awk,v 1.8 2000/12/10 02:25:37 tom Exp $ +# $Id: MKunctrl.awk,v 1.9 2001/06/02 23:59:20 skimo Exp $ ############################################################################## -# Copyright (c) 1998,2000 Free Software Foundation, Inc. # +# Copyright (c) 1998,2000,2001 Free 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"), # @@ -64,6 +64,6 @@ END { } print "};" print "" - print "\treturn (NCURSES_CONST char *)table[TextOf(ch)];" + print "\treturn (NCURSES_CONST char *)table[ChCharOf(ch)];" print "}" } diff --git a/contrib/ncurses/ncurses/base/lib_addch.c b/contrib/ncurses/ncurses/base/lib_addch.c index 799fbf6..423a45e 100644 --- a/contrib/ncurses/ncurses/base/lib_addch.c +++ b/contrib/ncurses/ncurses/base/lib_addch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -26,11 +26,6 @@ * authorization. * ****************************************************************************/ -/**************************************************************************** - * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * - * and: Eric S. Raymond <esr@snark.thyrsus.com> * - ****************************************************************************/ - /* ** lib_addch.c ** @@ -41,7 +36,7 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$Id: lib_addch.c,v 1.47 2000/12/10 02:43:26 tom Exp $") +MODULE_ID("$Id: lib_addch.c,v 1.64 2002/05/11 18:16:43 tom Exp $") /* * Ugly microtweaking alert. Everything from here to end of module is @@ -54,41 +49,35 @@ MODULE_ID("$Id: lib_addch.c,v 1.47 2000/12/10 02:43:26 tom Exp $") */ /* Return bit mask for clearing color pair number if given ch has color */ -#define COLOR_MASK(ch) (~(chtype)((ch)&A_COLOR?A_COLOR:0)) +#define COLOR_MASK(ch) (~(attr_t)((ch)&A_COLOR?A_COLOR:0)) -static inline chtype -render_char(WINDOW *win, chtype ch) +static inline NCURSES_CH_T +render_char(WINDOW *win, NCURSES_CH_T ch) /* compute a rendition of the given char correct for the current context */ { - chtype a = win->_attrs; + attr_t a = win->_attrs; - if (ch == ' ') { - /* color in attrs has precedence over bkgd */ - ch = a | (win->_bkgd & COLOR_MASK(a)); + if (ISBLANK(ch) && AttrOf(ch) == A_NORMAL) { + /* color in attrs has precedence over bkgrnd */ + ch = win->_nc_bkgd; + SetAttr(ch, a | (AttrOf(win->_nc_bkgd) & COLOR_MASK(a))); } else { - /* color in attrs has precedence over bkgd */ - a |= (win->_bkgd & A_ATTRIBUTES) & COLOR_MASK(a); + /* color in attrs has precedence over bkgrnd */ + a |= (AttrOf(win->_nc_bkgd) & A_ATTRIBUTES) & COLOR_MASK(a); /* color in ch has precedence */ - ch |= (a & COLOR_MASK(ch)); + AddAttr(ch, (a & COLOR_MASK(AttrOf(ch)))); } - TR(TRACE_VIRTPUT, ("bkg = %lx, attrs = %lx -> ch = %lx", win->_bkgd, - win->_attrs, ch)); + TR(TRACE_VIRTPUT, ("bkg = %s, attrs = %s -> ch = %s", + _tracech_t2(1, CHREF(win->_nc_bkgd)), + _traceattr(win->_attrs), + _tracech_t2(3, CHREF(ch)))); return (ch); } -NCURSES_EXPORT(chtype) -_nc_background -(WINDOW *win) -/* make render_char() visible while still allowing us to inline it below */ -{ - return (win->_bkgd); -} - -NCURSES_EXPORT(chtype) -_nc_render -(WINDOW *win, chtype ch) +NCURSES_EXPORT(NCURSES_CH_T) +_nc_render(WINDOW *win, NCURSES_CH_T ch) /* make render_char() visible while still allowing us to inline it below */ { return render_char(win, ch); @@ -111,7 +100,7 @@ _nc_render #endif static inline int -waddch_literal(WINDOW *win, chtype ch) +waddch_literal(WINDOW *win, NCURSES_CH_T ch) { int x; struct ldat *line; @@ -140,8 +129,12 @@ waddch_literal(WINDOW *win, chtype ch) CHANGED_CELL(line, x); line->text[x++] = ch; + if_WIDEC({ + if (wcwidth(CharOf(ch)) > 1) + AddAttr(line->text[x++], WA_NAC); + }); - TR(TRACE_VIRTPUT, ("(%d, %d) = %s", win->_cury, x, _tracechtype(ch))); + TR(TRACE_VIRTPUT, ("(%d, %d) = %s", win->_cury, x, _tracech_t(CHREF(ch)))); if (x > win->_maxx) { /* * The _WRAPPED flag is useful only for telling an application that @@ -169,15 +162,15 @@ waddch_literal(WINDOW *win, chtype ch) } static inline int -waddch_nosync(WINDOW *win, const chtype ch) +waddch_nosync(WINDOW *win, const NCURSES_CH_T ch) /* the workhorse function -- add a character to the given window */ { int x, y; chtype t = 0; const char *s = 0; - if ((ch & A_ALTCHARSET) - || ((t = TextOf(ch)) > 127) + if ((AttrOf(ch) & A_ALTCHARSET) + || ((t = CharOf(ch)) > 127) || ((s = unctrl(t))[1] == 0)) return waddch_literal(win, ch); @@ -194,7 +187,8 @@ waddch_nosync(WINDOW *win, const chtype ch) */ if ((!win->_scroll && (y == win->_regbottom)) || (x <= win->_maxx)) { - chtype blank = (' ' | AttrOf(ch)); + NCURSES_CH_T blank = NewChar2(BLANK_TEXT, BLANK_ATTR); + AddAttr(blank, AttrOf(ch)); while (win->_curx < x) { if (waddch_literal(win, blank) == ERR) return (ERR); @@ -236,9 +230,12 @@ waddch_nosync(WINDOW *win, const chtype ch) win->_flags &= ~_WRAPPED; break; default: - while (*s) - if (waddch_literal(win, (*s++) | AttrOf(ch)) == ERR) + while (*s) { + NCURSES_CH_T sch; + SetChar(sch, *s++, AttrOf(ch)); + if (waddch_literal(win, sch) == ERR) return ERR; + } return (OK); } @@ -249,8 +246,7 @@ waddch_nosync(WINDOW *win, const chtype ch) } NCURSES_EXPORT(int) -_nc_waddch_nosync -(WINDOW *win, const chtype c) +_nc_waddch_nosync(WINDOW *win, const NCURSES_CH_T c) /* export copy of waddch_nosync() so the string-put functions can use it */ { return (waddch_nosync(win, c)); @@ -265,15 +261,16 @@ _nc_waddch_nosync /* These are actual entry points */ NCURSES_EXPORT(int) -waddch -(WINDOW *win, const chtype ch) +waddch(WINDOW *win, const chtype ch) { int code = ERR; + NCURSES_CH_T wch; + SetChar2(wch, ch); TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("waddch(%p, %s)"), win, _tracechtype(ch))); - if (win && (waddch_nosync(win, ch) != ERR)) { + if (win && (waddch_nosync(win, wch) != ERR)) { _nc_synchook(win); code = OK; } @@ -283,15 +280,53 @@ waddch } NCURSES_EXPORT(int) -wechochar -(WINDOW *win, const chtype ch) +wechochar(WINDOW *win, const chtype ch) { int code = ERR; + NCURSES_CH_T wch; + SetChar2(wch, ch); TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"), win, _tracechtype(ch))); - if (win && (waddch_nosync(win, ch) != ERR)) { + if (win && (waddch_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); +} + +#if USE_WIDEC_SUPPORT +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)"), win, + _tracech_t(wch))); + + if (win && (waddch_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("wecho_wchar(%p, %s)"), win, + _tracech_t(wch))); + + if (win && (waddch_nosync(win, *wch) != ERR)) { bool save_immed = win->_immed; win->_immed = TRUE; _nc_synchook(win); @@ -301,3 +336,4 @@ wechochar TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_RETURN("%d"), code)); return (code); } +#endif /* USE_WIDEC_SUPPORT */ diff --git a/contrib/ncurses/ncurses/base/lib_addstr.c b/contrib/ncurses/ncurses/base/lib_addstr.c index 60bf944..343555a3 100644 --- a/contrib/ncurses/ncurses/base/lib_addstr.c +++ b/contrib/ncurses/ncurses/base/lib_addstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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,69 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_addstr.c,v 1.19 2000/12/10 01:24:50 tom Exp $") +MODULE_ID("$Id: lib_addstr.c,v 1.31 2001/12/19 01:05:52 tom Exp $") + +#if USE_WIDEC_SUPPORT +#define CONV_DATA mbstate_t state; wchar_t cached; int clen = 0 +#define CONV_INIT memset (&state, '\0', sizeof (state)); cached = (wchar_t)WEOF +#define NEXT_CHAR(s,ch, n) \ + { \ + int len, i = 0; \ + memset(&ch, 0, sizeof(cchar_t)); \ + if (cached != (wchar_t) WEOF) { \ + ch.chars[i++] = cached; \ + cached = (wchar_t) WEOF; \ + n -= clen; \ + s += clen; \ + } \ + for (; i < CCHARW_MAX && n > 0; ++i) { \ + if ((len = mbrtowc(&ch.chars[i], s, n, &state)) < 0) { \ + code = ERR; \ + break; \ + } \ + if (i == 0 || wcwidth(ch.chars[i]) == 0) { \ + n -= len; \ + s += len; \ + } else { \ + cached = ch.chars[i]; \ + clen = len; \ + ch.chars[i] = L'\0'; \ + break; \ + } \ + } \ + if (code == ERR) \ + break; \ + } +#else +#define CONV_DATA +#define CONV_INIT +#define NEXT_CHAR(s,ch, n) \ + ch = *s++; \ + --n +#endif NCURSES_EXPORT(int) -waddnstr -(WINDOW *win, const char *const astr, int n) +waddnstr(WINDOW *win, const char *const astr, int n) { unsigned const char *str = (unsigned const char *) astr; int code = ERR; + CONV_DATA; T((T_CALLED("waddnstr(%p,%s,%d)"), win, _nc_visbuf(astr), n)); if (win && (str != 0)) { TR(TRACE_VIRTPUT | TRACE_ATTRS, ("... current %s", _traceattr(win->_attrs))); - TR(TRACE_VIRTPUT, ("str is not null")); code = OK; if (n < 0) n = (int) strlen(astr); - while ((n-- > 0) && (*str != '\0')) { + TR(TRACE_VIRTPUT, ("str is not null, length = %d", n)); + CONV_INIT; + while ((n > 0) && (*str != '\0')) { + NCURSES_CH_T ch; TR(TRACE_VIRTPUT, ("*str = %#x", *str)); - if (_nc_waddch_nosync(win, (chtype) * str++) == ERR) { + NEXT_CHAR(str, ch, n); + if (_nc_waddch_nosync(win, ch) == ERR) { code = ERR; break; } @@ -72,8 +114,7 @@ waddnstr } NCURSES_EXPORT(int) -waddchnstr -(WINDOW *win, const chtype * const astr, int n) +waddchnstr(WINDOW *win, const chtype * const astr, int n) { NCURSES_SIZE_T y = win->_cury; NCURSES_SIZE_T x = win->_curx; @@ -97,9 +138,116 @@ waddchnstr returnCode(code); line = &(win->_line[y]); +#if USE_WIDEC_SUPPORT + { + int i; + for (i = 0; i < n; ++i) + SetChar(line->text[i + x], ChCharOf(astr[i]), ChAttrOf(astr[i])); + } +#else memcpy(line->text + x, astr, n * sizeof(*astr)); +#endif CHANGED_RANGE(line, x, x + n - 1); _nc_synchook(win); returnCode(code); } + +#if USE_WIDEC_SUPPORT + +int +_nc_wchstrlen(const cchar_t * s) +{ + int result = 0; + while (CharOf(s[result]) != L'\0') { + result++; + } + return result; +} + +NCURSES_EXPORT(int) +wadd_wchnstr(WINDOW *win, const cchar_t * const astr, int n) +{ + NCURSES_SIZE_T y = win->_cury; + NCURSES_SIZE_T x = win->_curx; + int code = OK; + struct ldat *line; + int i, start, end; + + T((T_CALLED("wadd_wchnstr(%p,%s,%d)"), win, _nc_viscbuf(astr, n), n)); + + if (!win) + returnCode(ERR); + + if (n < 0) { + n = _nc_wchstrlen(astr); + } + if (n > win->_maxx - x + 1) + n = win->_maxx - x + 1; + if (n == 0) + returnCode(code); + + line = &(win->_line[y]); + start = x; + end = x + n - 1; + if (isnac(line->text[x])) { + line->text[x - 1] = win->_nc_bkgd; + --start; + } + for (i = 0; i < n && x <= win->_maxx; ++i) { + line->text[x++] = astr[i]; + if (wcwidth(CharOf(astr[i])) > 1) { + if (x <= win->_maxx) + AddAttr(line->text[x++], WA_NAC); + else + line->text[x - 1] = win->_nc_bkgd; + } + } + if (x <= win->_maxx && isnac(line->text[x])) { + line->text[x] = win->_nc_bkgd; + ++end; + } + CHANGED_RANGE(line, start, end); + + _nc_synchook(win); + returnCode(code); +} + +NCURSES_EXPORT(int) +waddnwstr(WINDOW *win, const wchar_t * str, int n) +{ + int code = ERR; + int i; + + T((T_CALLED("waddnwstr(%p,%s,%d)"), win, _nc_viswbuf(str), n)); + + if (win && (str != 0)) { + TR(TRACE_VIRTPUT | TRACE_ATTRS, ("... current %s", _traceattr(win->_attrs))); + code = OK; + if (n < 0) + n = (int) wcslen(str); + + TR(TRACE_VIRTPUT, ("str is not null, length = %d", n)); + while ((n-- > 0) && (*str != L('\0'))) { + NCURSES_CH_T ch; + TR(TRACE_VIRTPUT, ("*str[0] = %#lx", *str)); + SetChar(ch, *str++, A_NORMAL); + i = 1; + while (i < CCHARW_MAX && n > 0 && (*str != L('\0')) + && wcwidth(*str) == 0) { + TR(TRACE_VIRTPUT, ("*str[%d] = %#lx", i, *str)); + ch.chars[i++] = *str++; + --n; + } + if (_nc_waddch_nosync(win, ch) == ERR) { + code = ERR; + break; + } + } + _nc_synchook(win); + } + TR(TRACE_VIRTPUT, ("waddnwstr returns %d", code)); + returnCode(code); +} + +#endif diff --git a/contrib/ncurses/ncurses/base/lib_bkgd.c b/contrib/ncurses/ncurses/base/lib_bkgd.c index 071924c..a3d7c30 100644 --- a/contrib/ncurses/ncurses/base/lib_bkgd.c +++ b/contrib/ncurses/ncurses/base/lib_bkgd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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,51 +33,93 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_bkgd.c,v 1.14 2000/12/10 02:43:26 tom Exp $") +MODULE_ID("$Id: lib_bkgd.c,v 1.26 2001/12/19 01:36:58 tom Exp $") +/* + * Set the window's background information. + */ +#if USE_WIDEC_SUPPORT NCURSES_EXPORT(void) -wbkgdset(WINDOW *win, chtype ch) +#else +static inline void +#endif +wbkgrndset(WINDOW *win, const ARG_CH_T ch) { - T((T_CALLED("wbkgdset(%p,%s)"), win, _tracechtype(ch))); + T((T_CALLED("wbkgdset(%p,%s)"), win, _tracech_t(ch))); if (win) { - chtype off = AttrOf(win->_bkgd); - chtype on = AttrOf(ch); + attr_t off = AttrOf(win->_nc_bkgd); + attr_t on = AttrOf(CHDEREF(ch)); toggle_attr_off(win->_attrs, off); toggle_attr_on(win->_attrs, on); - if (TextOf(ch) == 0) - ch |= BLANK; - win->_bkgd = ch; + if (CharOf(CHDEREF(ch)) == L('\0')) + SetChar(win->_nc_bkgd, BLANK_TEXT, AttrOf(CHDEREF(ch))); + else + win->_nc_bkgd = CHDEREF(ch); +#if USE_WIDEC_SUPPORT + /* + * If we're compiled for wide-character support, _bkgrnd is the + * preferred location for the background information since it stores + * more than _bkgd. Update _bkgd each time we modify _bkgrnd, so the + * macro getbkgd() will work. + */ + { + cchar_t wch; + int tmp; + + wgetbkgrnd(win, &wch); + tmp = wctob(CharOf(wch)); + + win->_bkgd = ((tmp == EOF) ? ' ' : (chtype) tmp) | AttrOf(wch); + } +#endif } returnVoid; } +NCURSES_EXPORT(void) +wbkgdset(WINDOW *win, chtype ch) +{ + NCURSES_CH_T wch; + SetChar2(wch, ch); + wbkgrndset(win, CHREF(wch)); +} + +/* + * Set the window's background information and apply it to each cell. + */ +#if USE_WIDEC_SUPPORT NCURSES_EXPORT(int) -wbkgd(WINDOW *win, const chtype ch) +#else +static inline int +#undef wbkgrnd +#endif +wbkgrnd(WINDOW *win, const ARG_CH_T ch) { int code = ERR; int x, y; - chtype new_bkgd = ch; + NCURSES_CH_T new_bkgd = CHDEREF(ch); - T((T_CALLED("wbkgd(%p,%s)"), win, _tracechtype(new_bkgd))); + T((T_CALLED("wbkgd(%p,%s)"), win, _tracech_t(ch))); if (win) { - chtype old_bkgd = getbkgd(win); + NCURSES_CH_T old_bkgrnd; + wgetbkgrnd(win, &old_bkgrnd); - wbkgdset(win, new_bkgd); - wattrset(win, AttrOf(win->_bkgd)); + wbkgrndset(win, CHREF(new_bkgd)); + wattrset(win, AttrOf(win->_nc_bkgd)); for (y = 0; y <= win->_maxy; y++) { for (x = 0; x <= win->_maxx; x++) { - if (win->_line[y].text[x] == old_bkgd) - win->_line[y].text[x] = win->_bkgd; - else - win->_line[y].text[x] = - _nc_render(win, (A_ALTCHARSET & - AttrOf(win->_line[y].text[x])) - | TextOf(win->_line[y].text[x])); + if (CharEq(win->_line[y].text[x], old_bkgrnd)) + win->_line[y].text[x] = win->_nc_bkgd; + else { + NCURSES_CH_T wch = win->_line[y].text[x]; + RemAttr(wch, ~A_ALTCHARSET); + win->_line[y].text[x] = _nc_render(win, wch); + } } } touchwin(win); @@ -86,3 +128,11 @@ wbkgd(WINDOW *win, const chtype ch) } returnCode(code); } + +NCURSES_EXPORT(int) +wbkgd(WINDOW *win, const chtype ch) +{ + NCURSES_CH_T wch; + SetChar2(wch, ch); + return wbkgrnd(win, CHREF(wch)); +} diff --git a/contrib/ncurses/ncurses/base/lib_box.c b/contrib/ncurses/ncurses/base/lib_box.c index d018fd89..7181edb 100644 --- a/contrib/ncurses/ncurses/base/lib_box.c +++ b/contrib/ncurses/ncurses/base/lib_box.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001,2002 Free 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,18 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_box.c,v 1.13 2000/12/10 02:43:26 tom Exp $") +MODULE_ID("$Id: lib_box.c,v 1.18 2002/02/23 20:40:06 tom Exp $") NCURSES_EXPORT(int) -wborder -(WINDOW *win, - chtype ls, chtype rs, chtype ts, chtype bs, - chtype tl, chtype tr, chtype bl, chtype br) +wborder(WINDOW *win, + chtype ls, chtype rs, + chtype ts, chtype bs, + chtype tl, chtype tr, + chtype bl, chtype br) { NCURSES_SIZE_T i; NCURSES_SIZE_T endx, endy; + chtype wls, wrs, wts, wbs, wtl, wtr, wbl, wbr; T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"), win, @@ -65,55 +67,47 @@ wborder if (!win) returnCode(ERR); - if (ls == 0) - ls = ACS_VLINE; - if (rs == 0) - rs = ACS_VLINE; - if (ts == 0) - ts = ACS_HLINE; - if (bs == 0) - bs = ACS_HLINE; - if (tl == 0) - tl = ACS_ULCORNER; - if (tr == 0) - tr = ACS_URCORNER; - if (bl == 0) - bl = ACS_LLCORNER; - if (br == 0) - br = ACS_LRCORNER; +#define RENDER_WITH_DEFAULT(ch,def) w ## ch = (ch == 0) ? def : ch - ls = _nc_render(win, ls); - rs = _nc_render(win, rs); - ts = _nc_render(win, ts); - bs = _nc_render(win, bs); - tl = _nc_render(win, tl); - tr = _nc_render(win, tr); - bl = _nc_render(win, bl); - br = _nc_render(win, br); + RENDER_WITH_DEFAULT(ls, ACS_VLINE); + RENDER_WITH_DEFAULT(rs, ACS_VLINE); + RENDER_WITH_DEFAULT(ts, ACS_HLINE); + RENDER_WITH_DEFAULT(bs, ACS_HLINE); + RENDER_WITH_DEFAULT(tl, ACS_ULCORNER); + RENDER_WITH_DEFAULT(tr, ACS_URCORNER); + RENDER_WITH_DEFAULT(bl, ACS_LLCORNER); + RENDER_WITH_DEFAULT(br, ACS_LRCORNER); - T(("using %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx", - ls, rs, ts, bs, tl, tr, bl, br)); + T(("using %s, %s, %s, %s, %s, %s, %s, %s", + _tracechtype2(1, wls), + _tracechtype2(2, wrs), + _tracechtype2(3, wts), + _tracechtype2(4, wbs), + _tracechtype2(5, wtl), + _tracechtype2(6, wtr), + _tracechtype2(7, wbl), + _tracechtype2(8, wbr))); endx = win->_maxx; endy = win->_maxy; for (i = 0; i <= endx; i++) { - win->_line[0].text[i] = ts; - win->_line[endy].text[i] = bs; + SetChar(win->_line[0].text[i], ChCharOf(wts), ChAttrOf(wts)); + SetChar(win->_line[endy].text[i], ChCharOf(wbs), ChAttrOf(wbs)); } win->_line[endy].firstchar = win->_line[0].firstchar = 0; win->_line[endy].lastchar = win->_line[0].lastchar = endx; for (i = 0; i <= endy; i++) { - win->_line[i].text[0] = ls; - win->_line[i].text[endx] = rs; + SetChar(win->_line[i].text[0], ChCharOf(wls), ChAttrOf(wls)); + SetChar(win->_line[i].text[endx], ChCharOf(wrs), ChAttrOf(wrs)); win->_line[i].firstchar = 0; win->_line[i].lastchar = endx; } - win->_line[0].text[0] = tl; - win->_line[0].text[endx] = tr; - win->_line[endy].text[0] = bl; - win->_line[endy].text[endx] = br; + SetChar(win->_line[0].text[0], ChCharOf(wtl), ChAttrOf(wtl)); + SetChar(win->_line[0].text[endx], ChCharOf(wtr), ChAttrOf(wtr)); + SetChar(win->_line[endy].text[0], ChCharOf(wbl), ChAttrOf(wbl)); + SetChar(win->_line[endy].text[endx], ChCharOf(wbr), ChAttrOf(wbr)); _nc_synchook(win); returnCode(OK); diff --git a/contrib/ncurses/ncurses/base/lib_chgat.c b/contrib/ncurses/ncurses/base/lib_chgat.c index 66c6a09..54e66ed 100644 --- a/contrib/ncurses/ncurses/base/lib_chgat.c +++ b/contrib/ncurses/ncurses/base/lib_chgat.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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_chgat.c,v 1.4 2000/12/10 02:43:26 tom Exp $") +MODULE_ID("$Id: lib_chgat.c,v 1.5 2001/06/03 00:05:02 skimo Exp $") NCURSES_EXPORT(int) wchgat @@ -54,8 +54,7 @@ wchgat toggle_attr_on(attr, COLOR_PAIR(color)); for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) - win->_line[win->_cury].text[i] - = TextOf(win->_line[win->_cury].text[i]) | attr; + SetAttr(win->_line[win->_cury].text[i], attr); returnCode(OK); } else diff --git a/contrib/ncurses/ncurses/base/lib_clrbot.c b/contrib/ncurses/ncurses/base/lib_clrbot.c index 805e7c2..bc12960 100644 --- a/contrib/ncurses/ncurses/base/lib_clrbot.c +++ b/contrib/ncurses/ncurses/base/lib_clrbot.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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_clrbot.c,v 1.17 2000/12/10 02:43:26 tom Exp $") +MODULE_ID("$Id: lib_clrbot.c,v 1.19 2001/12/19 01:05:59 tom Exp $") NCURSES_EXPORT(int) wclrtobot(WINDOW *win) @@ -52,15 +52,15 @@ wclrtobot(WINDOW *win) if (win) { NCURSES_SIZE_T y; NCURSES_SIZE_T startx = win->_curx; - chtype blank = _nc_background(win); + NCURSES_CH_T blank = win->_nc_bkgd; T(("clearing from y = %d to y = %d with maxx = %d", win->_cury, win->_maxy, win->_maxx)); for (y = win->_cury; y <= win->_maxy; y++) { struct ldat *line = &(win->_line[y]); - chtype *ptr = &(line->text[startx]); - chtype *end = &(line->text[win->_maxx]); + NCURSES_CH_T *ptr = &(line->text[startx]); + NCURSES_CH_T *end = &(line->text[win->_maxx]); CHANGED_TO_EOL(line, startx, win->_maxx); diff --git a/contrib/ncurses/ncurses/base/lib_clreol.c b/contrib/ncurses/ncurses/base/lib_clreol.c index fa0afe4..c46ebd9 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 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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_clreol.c,v 1.19 2000/12/10 02:43:26 tom Exp $") +MODULE_ID("$Id: lib_clreol.c,v 1.21 2001/12/19 01:06:04 tom Exp $") NCURSES_EXPORT(int) wclrtoeol(WINDOW *win) @@ -50,8 +50,8 @@ wclrtoeol(WINDOW *win) T((T_CALLED("wclrtoeol(%p)"), win)); if (win) { - chtype blank; - chtype *ptr, *end; + NCURSES_CH_T blank; + NCURSES_CH_T *ptr, *end; struct ldat *line; NCURSES_SIZE_T y = win->_cury; NCURSES_SIZE_T x = win->_curx; @@ -74,7 +74,7 @@ wclrtoeol(WINDOW *win) || x > win->_maxx) returnCode(ERR); - blank = _nc_background(win); + blank = win->_nc_bkgd; line = &win->_line[y]; CHANGED_TO_EOL(line, x, win->_maxx); diff --git a/contrib/ncurses/ncurses/base/lib_color.c b/contrib/ncurses/ncurses/base/lib_color.c index 1fa5732..42d301d 100644 --- a/contrib/ncurses/ncurses/base/lib_color.c +++ b/contrib/ncurses/ncurses/base/lib_color.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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,17 +41,15 @@ #include <term.h> #include <tic.h> -MODULE_ID("$Id: lib_color.c,v 1.55 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_color.c,v 1.58 2001/09/01 21:42:59 tom Exp $") /* * These should be screen structure members. They need to be globals for * historical reasons. So we assign them in start_color() and also in * set_term()'s screen-switching logic. */ -NCURSES_EXPORT_VAR(int) -COLOR_PAIRS = 0; -NCURSES_EXPORT_VAR(int) -COLORS = 0; +NCURSES_EXPORT_VAR(int) COLOR_PAIRS = 0; +NCURSES_EXPORT_VAR(int) COLORS = 0; /* * Given a RGB range of 0..1000, we'll normally set the individual values @@ -92,8 +90,8 @@ static const color_t hls_palette[] = * These are called from _nc_do_color(), which in turn is called from * vidattr - so we have to assume that SP may be null. */ - static int - default_fg(void) +static int +default_fg(void) { return (SP != 0) ? SP->_default_fg : COLOR_WHITE; } @@ -113,8 +111,8 @@ default_bg(void) * to maintain compatibility with a pre-ANSI scheme. The same scheme is * also used in the FreeBSD syscons. */ - static int - toggled_colors(int c) +static int +toggled_colors(int c) { if (c < 16) { static const int table[] = @@ -259,8 +257,7 @@ 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) +init_pair(short pair, short f, short b) { unsigned result; @@ -302,10 +299,10 @@ init_pair struct ldat *ptr = &(curscr->_line[y]); bool changed = FALSE; for (x = 0; x <= curscr->_maxx; x++) { - if ((ptr->text[x] & A_COLOR) == z) { + if ((AttrOf(ptr->text[x]) & A_COLOR) == z) { /* Set the old cell to zero to ensure it will be updated on the next doupdate() */ - ptr->text[x] = 0; + SetChar(ptr->text[x], 0, 0); CHANGED_CELL(ptr, x); changed = TRUE; } @@ -339,8 +336,7 @@ init_pair } NCURSES_EXPORT(int) -init_color -(short color, short r, short g, short b) +init_color(short color, short r, short g, short b) { T((T_CALLED("init_color(%d,%d,%d,%d)"), color, r, g, b)); @@ -390,8 +386,7 @@ has_colors(void) } NCURSES_EXPORT(int) -color_content -(short color, short *r, short *g, short *b) +color_content(short color, short *r, short *g, short *b) { T((T_CALLED("color_content(%d,%p,%p,%p)"), color, r, g, b)); if (color < 0 || color >= COLORS) @@ -407,8 +402,7 @@ color_content } NCURSES_EXPORT(int) -pair_content -(short pair, short *f, short *b) +pair_content(short pair, short *f, short *b) { T((T_CALLED("pair_content(%d,%p,%p)"), pair, f, b)); @@ -423,8 +417,7 @@ pair_content } NCURSES_EXPORT(void) -_nc_do_color -(int old_pair, int pair, bool reverse, int (*outc) (int)) +_nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) { NCURSES_COLOR_T fg = C_MASK, bg = C_MASK; NCURSES_COLOR_T old_fg, old_bg; diff --git a/contrib/ncurses/ncurses/base/lib_delch.c b/contrib/ncurses/ncurses/base/lib_delch.c index 918e225..0c30f2d 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 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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_delch.c,v 1.10 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_delch.c,v 1.12 2001/12/19 01:06:09 tom Exp $") NCURSES_EXPORT(int) wdelch(WINDOW *win) @@ -50,11 +50,11 @@ wdelch(WINDOW *win) T((T_CALLED("wdelch(%p)"), win)); if (win) { - chtype blank = _nc_background(win); + NCURSES_CH_T blank = win->_nc_bkgd; struct ldat *line = &(win->_line[win->_cury]); - chtype *end = &(line->text[win->_maxx]); - chtype *temp2 = &(line->text[win->_curx + 1]); - chtype *temp1 = temp2 - 1; + NCURSES_CH_T *end = &(line->text[win->_maxx]); + NCURSES_CH_T *temp2 = &(line->text[win->_curx + 1]); + NCURSES_CH_T *temp1 = temp2 - 1; CHANGED_TO_EOL(line, win->_curx, win->_maxx); while (temp1 < end) diff --git a/contrib/ncurses/ncurses/base/lib_delwin.c b/contrib/ncurses/ncurses/base/lib_delwin.c index 7c56869..89d8e7c3 100644 --- a/contrib/ncurses/ncurses/base/lib_delwin.c +++ b/contrib/ncurses/ncurses/base/lib_delwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -40,7 +40,7 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_delwin.c,v 1.12 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_delwin.c,v 1.13 2001/08/26 00:40:20 tom Exp $") static bool cannot_delete(WINDOW *win) @@ -49,10 +49,10 @@ cannot_delete(WINDOW *win) bool result = TRUE; for (p = _nc_windows; p != 0; p = p->next) { - if (p->win == win) { + if (&(p->win) == win) { result = FALSE; - } else if ((p->win->_flags & _SUBWIN) != 0 - && p->win->_parent == win) { + } else if ((p->win._flags & _SUBWIN) != 0 + && p->win._parent == win) { result = TRUE; break; } diff --git a/contrib/ncurses/ncurses/base/lib_erase.c b/contrib/ncurses/ncurses/base/lib_erase.c index 87673b7..5e39731 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 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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,20 +40,20 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_erase.c,v 1.13 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_erase.c,v 1.15 2001/12/19 01:06:13 tom Exp $") NCURSES_EXPORT(int) werase(WINDOW *win) { int code = ERR; int y; - chtype blank; - chtype *sp, *end, *start; + NCURSES_CH_T blank; + NCURSES_CH_T *sp, *end, *start; T((T_CALLED("werase(%p)"), win)); if (win) { - blank = _nc_background(win); + blank = win->_nc_bkgd; for (y = 0; y <= win->_maxy; y++) { start = win->_line[y].text; end = &start[win->_maxx]; diff --git a/contrib/ncurses/ncurses/base/lib_freeall.c b/contrib/ncurses/ncurses/base/lib_freeall.c index bbd8c0e..2063c6f 100644 --- a/contrib/ncurses/ncurses/base/lib_freeall.c +++ b/contrib/ncurses/ncurses/base/lib_freeall.c @@ -39,7 +39,7 @@ extern int malloc_errfd; /* FIXME */ #endif -MODULE_ID("$Id: lib_freeall.c,v 1.18 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_freeall.c,v 1.19 2001/09/15 21:32:48 tom Exp $") static void free_slk(SLK * p) @@ -85,15 +85,15 @@ _nc_freeall(void) for (q = _nc_windows; q != 0; q = q->next) { if ((p != q) - && (q->win->_flags & _SUBWIN) - && (p->win == q->win->_parent)) { + && (q->win._flags & _SUBWIN) + && (&(p->win) == q->win._parent)) { found = TRUE; break; } } if (!found) { - delwin(p->win); + delwin(&(p->win)); break; } } @@ -104,6 +104,9 @@ _nc_freeall(void) free_slk(SP->_slk); FreeIfNeeded(SP->_color_pairs); FreeIfNeeded(SP->_color_table); + FreeIfNeeded(SP->oldhash); + FreeIfNeeded(SP->newhash); + FreeIfNeeded(SP->hashtab); #if !BROKEN_LINKER FreeAndNull(SP); #endif diff --git a/contrib/ncurses/ncurses/base/lib_getch.c b/contrib/ncurses/ncurses/base/lib_getch.c index 9deafec..f4ecbda 100644 --- a/contrib/ncurses/ncurses/base/lib_getch.c +++ b/contrib/ncurses/ncurses/base/lib_getch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2002 Free 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,15 +40,15 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_getch.c,v 1.54 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_getch.c,v 1.60 2002/03/17 00:46:01 tom Exp $") #include <fifo_defs.h> NCURSES_EXPORT_VAR(int) ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */ - static inline int - fifo_peek(void) +static inline int +fifo_peek(void) { int ch = SP->_fifo[peek]; TR(TRACE_IEVENT, ("peeking at %d", peek)); @@ -62,7 +62,7 @@ fifo_pull(void) { int ch; ch = SP->_fifo[head]; - TR(TRACE_IEVENT, ("pulling %d from %d", ch, head)); + TR(TRACE_IEVENT, ("pulling %s from %d", _tracechar(ch), head)); if (peek == head) { h_inc(); @@ -102,7 +102,7 @@ fifo_push(void) { unsigned char c2 = 0; n = read(SP->_ifd, &c2, 1); - ch = CharOf(c2); + ch = c2; } #ifdef HIDE_EINTR @@ -130,7 +130,7 @@ fifo_push(void) if (head == -1) head = peek = tail; t_inc(); - TR(TRACE_IEVENT, ("pushed %#x at %d", ch, tail)); + TR(TRACE_IEVENT, ("pushed %s at %d", _tracechar(ch), tail)); #ifdef TRACE if (_nc_tracing & TRACE_IEVENT) _nc_fifo_dump(); @@ -141,26 +141,25 @@ fifo_push(void) static inline void fifo_clear(void) { - int i; - for (i = 0; i < FIFO_SIZE; i++) - SP->_fifo[i] = 0; + memset(SP->_fifo, 0, sizeof(SP->_fifo)); head = -1; tail = peek = 0; } -static int kgetch(WINDOW *); +static int kgetch(void); #define wgetch_should_refresh(win) (\ (is_wintouched(win) || (win->_flags & _HASMOVED)) \ && !(win->_flags & _ISPAD)) NCURSES_EXPORT(int) -wgetch(WINDOW *win) +_nc_wgetch(WINDOW *win, unsigned long *result, int use_meta) { int ch; T((T_CALLED("wgetch(%p)"), win)); + *result = 0; if (!win) returnCode(ERR); @@ -168,9 +167,8 @@ wgetch(WINDOW *win) if (wgetch_should_refresh(win)) wrefresh(win); - ch = fifo_pull(); - T(("wgetch returning (pre-cooked): %#x = %s", ch, _trace_key(ch))); - returnCode(ch); + *result = fifo_pull(); + returnCode(OK); } /* @@ -190,9 +188,13 @@ wgetch(WINDOW *win) for (sp = buf + strlen(buf); sp > buf; sp--) ungetch(sp[-1]); - returnCode(fifo_pull()); + *result = fifo_pull(); + returnCode(OK); } + if (win->_use_keypad != SP->_keypad_on) + _nc_keypad(win->_use_keypad); + if (wgetch_should_refresh(win)) wrefresh(win); @@ -228,12 +230,14 @@ wgetch(WINDOW *win) int runcount = 0; do { - ch = kgetch(win); + ch = kgetch(); if (ch == KEY_MOUSE) { ++runcount; if (SP->_mouse_inline(SP)) break; } + if (SP->_maxclick < 0) + break; } while (ch == KEY_MOUSE && (_nc_timed_wait(3, SP->_maxclick, (int *) 0) @@ -255,13 +259,11 @@ wgetch(WINDOW *win) _nc_update_screensize(); /* resizeterm can push KEY_RESIZE */ if (cooked_key_in_fifo()) { - ch = fifo_pull(); - T(("wgetch returning (pre-cooked): %#x = %s", ch, _trace_key(ch))); - returnCode(ch); + *result = fifo_pull(); + returnCode(OK); } } #endif - T(("wgetch returning ERR")); returnCode(ERR); } @@ -300,13 +302,27 @@ wgetch(WINDOW *win) * that display only 7-bit characters. Note that 'ch' may be a * function key at this point, so we mustn't strip _those_. */ - if ((ch < KEY_MIN) && (ch & 0x80)) - if (!SP->_use_meta) + if (!use_meta) + if ((ch < KEY_MIN) && (ch & 0x80)) ch &= 0x7f; - T(("wgetch returning : %#x = %s", ch, _trace_key(ch))); + T(("wgetch returning : %s", _tracechar(ch))); + + *result = ch; + returnCode(ch >= KEY_MIN ? KEY_CODE_YES : OK); +} + +NCURSES_EXPORT(int) +wgetch(WINDOW *win) +{ + int code; + unsigned long value; - returnCode(ch); + T((T_CALLED("wgetch(%p)"), win)); + code = _nc_wgetch(win, &value, SP->_use_meta); + if (code != ERR) + code = value; + returnCode(code); } /* @@ -319,19 +335,19 @@ wgetch(WINDOW *win) ** sequence is received by the time the alarm goes off, pass through ** the sequence gotten so far. ** -** This function must be called when there is no cooked keys in queue. +** This function must be called when there are no cooked keys in queue. ** (that is head==-1 || peek==head) ** */ static int -kgetch(WINDOW *win GCC_UNUSED) +kgetch(void) { struct tries *ptr; int ch = 0; int timeleft = ESCDELAY; - TR(TRACE_IEVENT, ("kgetch(%p) called", win)); + TR(TRACE_IEVENT, ("kgetch() called")); ptr = SP->_keytry; @@ -350,19 +366,16 @@ kgetch(WINDOW *win GCC_UNUSED) return ch; } - TR(TRACE_IEVENT, ("ch: %s", _trace_key((unsigned char) ch))); + TR(TRACE_IEVENT, ("ch: %s", _tracechar((unsigned char) ch))); while ((ptr != NULL) && (ptr->ch != (unsigned char) ch)) ptr = ptr->sibling; -#ifdef TRACE + if (ptr == NULL) { TR(TRACE_IEVENT, ("ptr is null")); - } else - TR(TRACE_IEVENT, ("ptr=%p, ch=%d, value=%d", - ptr, ptr->ch, ptr->value)); -#endif /* TRACE */ - - if (ptr == NULL) break; + } + TR(TRACE_IEVENT, ("ptr=%p, ch=%d, value=%d", + ptr, ptr->ch, ptr->value)); if (ptr->value != 0) { /* sequence terminated */ TR(TRACE_IEVENT, ("end of sequence")); diff --git a/contrib/ncurses/ncurses/base/lib_hline.c b/contrib/ncurses/ncurses/base/lib_hline.c index 72d1ddb..2cb6cc5 100644 --- a/contrib/ncurses/ncurses/base/lib_hline.c +++ b/contrib/ncurses/ncurses/base/lib_hline.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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_hline.c,v 1.8 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_hline.c,v 1.10 2001/06/03 00:39:24 skimo Exp $") NCURSES_EXPORT(int) whline(WINDOW *win, chtype ch, int n) @@ -53,6 +53,7 @@ whline(WINDOW *win, chtype ch, int n) if (win) { struct ldat *line = &(win->_line[win->_cury]); + NCURSES_CH_T wch; start = win->_curx; end = start + n - 1; @@ -62,11 +63,13 @@ whline(WINDOW *win, chtype ch, int n) CHANGED_RANGE(line, start, end); if (ch == 0) - ch = ACS_HLINE; - ch = _nc_render(win, ch); + SetChar(wch, ChCharOf(ACS_HLINE), ChAttrOf(ACS_HLINE)); + else + SetChar(wch, ChCharOf(ch), ChAttrOf(ch)); + wch = _nc_render(win, wch); while (end >= start) { - line->text[end] = ch; + line->text[end] = wch; end--; } diff --git a/contrib/ncurses/ncurses/base/lib_inchstr.c b/contrib/ncurses/ncurses/base/lib_inchstr.c index 31625bb..6ff0168 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 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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_inchstr.c,v 1.9 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_inchstr.c,v 1.10 2001/06/02 23:37:58 skimo Exp $") NCURSES_EXPORT(int) winchnstr(WINDOW *win, chtype * str, int n) @@ -54,7 +54,9 @@ winchnstr(WINDOW *win, chtype * str, int n) if (win) { for (; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++) - str[i] = win->_line[win->_cury].text[win->_curx + i]; + str[i] = + 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 b6e34ef..832da74 100644 --- a/contrib/ncurses/ncurses/base/lib_initscr.c +++ b/contrib/ncurses/ncurses/base/lib_initscr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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.28 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_initscr.c,v 1.29 2001/08/26 01:05:05 tom Exp $") NCURSES_EXPORT(WINDOW *) initscr(void) @@ -53,6 +53,12 @@ initscr(void) static bool initialized = FALSE; NCURSES_CONST char *name; int value; +#ifdef TRACE + int t = _nc_getenv_num("NCURSES_TRACE"); + + if (t >= 0) + trace(t); +#endif T((T_CALLED("initscr()"))); /* Portable applications must not call initscr() more than once */ diff --git a/contrib/ncurses/ncurses/base/lib_insch.c b/contrib/ncurses/ncurses/base/lib_insch.c index 8d495f5..c3671e5 100644 --- a/contrib/ncurses/ncurses/base/lib_insch.c +++ b/contrib/ncurses/ncurses/base/lib_insch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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_insch.c,v 1.12 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_insch.c,v 1.15 2001/06/09 23:47:38 skimo Exp $") NCURSES_EXPORT(int) winsch(WINDOW *win, chtype c) @@ -51,15 +51,17 @@ winsch(WINDOW *win, chtype c) if (win) { struct ldat *line = &(win->_line[win->_cury]); - chtype *end = &(line->text[win->_curx]); - chtype *temp1 = &(line->text[win->_maxx]); - chtype *temp2 = temp1 - 1; + NCURSES_CH_T *end = &(line->text[win->_curx]); + NCURSES_CH_T *temp1 = &(line->text[win->_maxx]); + NCURSES_CH_T *temp2 = temp1 - 1; + NCURSES_CH_T wch; + SetChar2(wch, c); CHANGED_TO_EOL(line, win->_curx, win->_maxx); while (temp1 > end) *temp1-- = *temp2--; - *temp1 = _nc_render(win, c); + *temp1 = _nc_render(win, wch); code = OK; } returnCode(code); diff --git a/contrib/ncurses/ncurses/base/lib_insdel.c b/contrib/ncurses/ncurses/base/lib_insdel.c index 1a23a86..432bcac 100644 --- a/contrib/ncurses/ncurses/base/lib_insdel.c +++ b/contrib/ncurses/ncurses/base/lib_insdel.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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_insdel.c,v 1.10 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_insdel.c,v 1.11 2001/12/19 01:10:49 tom Exp $") NCURSES_EXPORT(int) winsdelln(WINDOW *win, int n) @@ -54,7 +54,7 @@ winsdelln(WINDOW *win, int n) if (win) { if (n != 0) { _nc_scroll_window(win, -n, win->_cury, win->_maxy, - _nc_background(win)); + win->_nc_bkgd); _nc_synchook(win); } code = OK; diff --git a/contrib/ncurses/ncurses/base/lib_insstr.c b/contrib/ncurses/ncurses/base/lib_insstr.c index f4c215d..a16ab13 100644 --- a/contrib/ncurses/ncurses/base/lib_insstr.c +++ b/contrib/ncurses/ncurses/base/lib_insstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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> #include <ctype.h> -MODULE_ID("$Id: lib_insstr.c,v 1.17 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_insstr.c,v 1.19 2001/06/09 23:43:02 skimo Exp $") NCURSES_EXPORT(int) winsnstr(WINDOW *win, const char *s, int n) @@ -58,9 +58,11 @@ winsnstr(WINDOW *win, const char *s, int n) oy = win->_cury; ox = win->_curx; for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) { - if (*cp == '\n' || *cp == '\r' || *cp == '\t' || *cp == '\b') - _nc_waddch_nosync(win, (chtype) (*cp)); - else if (is7bits(*cp) && iscntrl(*cp)) { + if (*cp == '\n' || *cp == '\r' || *cp == '\t' || *cp == '\b') { + NCURSES_CH_T wch; + SetChar2(wch, *cp); + _nc_waddch_nosync(win, wch); + } else if (is7bits(*cp) && iscntrl(*cp)) { winsch(win, ' ' + (chtype) (*cp)); winsch(win, (chtype) '^'); win->_curx += 2; diff --git a/contrib/ncurses/ncurses/base/lib_instr.c b/contrib/ncurses/ncurses/base/lib_instr.c index 588f6c4..3eaf989 100644 --- a/contrib/ncurses/ncurses/base/lib_instr.c +++ b/contrib/ncurses/ncurses/base/lib_instr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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_instr.c,v 1.10 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_instr.c,v 1.11 2001/06/02 23:42:06 skimo Exp $") NCURSES_EXPORT(int) winnstr(WINDOW *win, char *str, int n) @@ -59,7 +59,7 @@ winnstr(WINDOW *win, char *str, int n) n = win->_maxx - win->_curx + 1; for (; i < n;) { - str[i++] = TextOf(win->_line[row].text[col]); + str[i++] = CharOf(win->_line[row].text[col]); if (++col > win->_maxx) { col = 0; if (++row > win->_maxy) diff --git a/contrib/ncurses/ncurses/base/lib_mouse.c b/contrib/ncurses/ncurses/base/lib_mouse.c index 01d3057..69af58d 100644 --- a/contrib/ncurses/ncurses/base/lib_mouse.c +++ b/contrib/ncurses/ncurses/base/lib_mouse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2002 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -84,7 +84,7 @@ #endif #endif -MODULE_ID("$Id: lib_mouse.c,v 1.57 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.58 2002/01/12 22:38:07 tom Exp $") #define MY_TRACE TRACE_ICALLS|TRACE_IEVENT @@ -655,7 +655,7 @@ _nc_mouse_parse(int runcount) /* first pass; merge press/release pairs */ do { merge = FALSE; - for (ep = runp; next = NEXT(ep), next != eventp; ep = next) { + for (ep = runp; (next = NEXT(ep)) != eventp; ep = next) { if (ep->x == next->x && ep->y == next->y && (ep->bstate & (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED)) && (!(ep->bstate & BUTTON1_PRESSED) @@ -720,7 +720,7 @@ _nc_mouse_parse(int runcount) MEVENT *follower; merge = FALSE; - for (ep = runp; next = NEXT(ep), next != eventp; ep = next) + for (ep = runp; (next = NEXT(ep)) != eventp; ep = next) if (ep->id != INVALID_EVENT) { if (next->id != INVALID_EVENT) continue; diff --git a/contrib/ncurses/ncurses/base/lib_mvwin.c b/contrib/ncurses/ncurses/base/lib_mvwin.c index 28b78f8..63d54cc 100644 --- a/contrib/ncurses/ncurses/base/lib_mvwin.c +++ b/contrib/ncurses/ncurses/base/lib_mvwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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_mvwin.c,v 1.9 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_mvwin.c,v 1.12 2001/12/19 01:06:22 tom Exp $") NCURSES_EXPORT(int) mvwin(WINDOW *win, int by, int bx) @@ -69,7 +69,8 @@ mvwin(WINDOW *win, int by, int bx) /* now we have the clone, so relocate win */ werase(win); /* Erase the original place */ - wbkgd(win, parent->_bkgd); /* fill with parents background */ + /* fill with parents background */ + wbkgrnd(win, CHREF(parent->_nc_bkgd)); wsyncup(win); /* Tell the parent(s) */ err = mvderwin(win, diff --git a/contrib/ncurses/ncurses/base/lib_newterm.c b/contrib/ncurses/ncurses/base/lib_newterm.c index 02f6ff5..d95c4a9 100644 --- a/contrib/ncurses/ncurses/base/lib_newterm.c +++ b/contrib/ncurses/ncurses/base/lib_newterm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -47,7 +47,7 @@ #include <term.h> /* clear_screen, cup & friends, cur_term */ #include <tic.h> -MODULE_ID("$Id: lib_newterm.c,v 1.50 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_newterm.c,v 1.52 2001/08/04 16:47:48 tom Exp $") #ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */ #define ONLCR 0 @@ -89,7 +89,9 @@ static int filter_mode = FALSE; NCURSES_EXPORT(void) filter(void) { + T((T_CALLED("filter"))); filter_mode = TRUE; + returnVoid; } NCURSES_EXPORT(SCREEN *) @@ -110,7 +112,7 @@ newterm /* this loads the capability entry, then sets LINES and COLS */ if (setupterm(name, fileno(ofp), &errret) == ERR) - return 0; + returnSP(0); /* implement filter mode */ if (filter_mode) { @@ -140,7 +142,7 @@ newterm if (slk_format) { if (ERR == _nc_ripoffline(-SLK_LINES(slk_format), _nc_slk_initialize)) - return 0; + returnSP(0); } /* this actually allocates the screen structure, and saves the * original terminal settings. @@ -149,7 +151,7 @@ newterm _nc_set_screen(0); if (_nc_setupscreen(LINES, COLS, ofp) == ERR) { _nc_set_screen(current); - return 0; + returnSP(0); } /* if the terminal type has real soft labels, set those up */ @@ -192,26 +194,6 @@ newterm SP->_use_rmso = SGR0_TEST(exit_standout_mode); SP->_use_rmul = SGR0_TEST(exit_underline_mode); -#if USE_WIDEC_SUPPORT - /* - * XFree86 xterm can be configured to support UTF-8 based on environment - * variable settings. - */ - { - char *s; - s = getenv("LC_ALL"); - if (s == NULL || *s == '\0') { - s = getenv("LC_CTYPE"); - if (s == NULL || *s == '\0') { - s = getenv("LANG"); - } - } - if (s != NULL && *s != '\0' && strstr(s, "UTF-8") != NULL) { - SP->_outch = _nc_utf8_outch; - } - } -#endif - /* compute movement costs so we can do better move optimization */ _nc_mvcur_init(); @@ -223,6 +205,5 @@ newterm _nc_signal_handler(TRUE); - T((T_RETURN("%p"), SP)); - return (SP); + returnSP(SP); } diff --git a/contrib/ncurses/ncurses/base/lib_newwin.c b/contrib/ncurses/ncurses/base/lib_newwin.c index 08921f2..3cd8238 100644 --- a/contrib/ncurses/ncurses/base/lib_newwin.c +++ b/contrib/ncurses/ncurses/base/lib_newwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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_newwin.c,v 1.27 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_newwin.c,v 1.33 2001/12/19 01:06:30 tom Exp $") NCURSES_EXPORT(int) _nc_freewin(WINDOW *win) @@ -51,19 +51,18 @@ _nc_freewin(WINDOW *win) if (win != 0) { for (p = _nc_windows, q = 0; p != 0; q = p, p = p->next) { - if (p->win == win) { + if (&(p->win) == win) { if (q == 0) _nc_windows = p->next; else q->next = p->next; - free(p); if (!(win->_flags & _SUBWIN)) { for (i = 0; i <= win->_maxy; i++) FreeIfNeeded(win->_line[i].text); } free(win->_line); - free(win); + free(p); if (win == curscr) curscr = 0; @@ -82,11 +81,10 @@ _nc_freewin(WINDOW *win) } NCURSES_EXPORT(WINDOW *) -newwin -(int num_lines, int num_columns, int begy, int begx) +newwin(int num_lines, int num_columns, int begy, int begx) { WINDOW *win; - chtype *ptr; + NCURSES_CH_T *ptr; int i; T((T_CALLED("newwin(%d,%d,%d,%d)"), num_lines, num_columns, begy, begx)); @@ -106,24 +104,22 @@ newwin returnWin(0); for (i = 0; i < num_lines; i++) { - win->_line[i].text = typeCalloc(chtype, (unsigned) num_columns); + win->_line[i].text = typeCalloc(NCURSES_CH_T, (unsigned) num_columns); if (win->_line[i].text == 0) { (void) _nc_freewin(win); returnWin(0); } - for (ptr = win->_line[i].text; ptr < win->_line[i].text + - num_columns;) - *ptr++ = ' '; + for (ptr = win->_line[i].text; + ptr < win->_line[i].text + num_columns; + ptr++) + SetChar(*ptr, BLANK_TEXT, BLANK_ATTR); } - T(("newwin: returned window is %p", win)); - returnWin(win); } NCURSES_EXPORT(WINDOW *) -derwin -(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) +derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) { WINDOW *win; int i; @@ -133,7 +129,7 @@ derwin begy, begx)); /* - ** make sure window fits inside the original one + * make sure window fits inside the original one */ if (begy < 0 || begx < 0 || orig == 0 || num_lines < 0 || num_columns < 0) returnWin(0); @@ -157,21 +153,18 @@ derwin win->_pary = begy; win->_parx = begx; win->_attrs = orig->_attrs; - win->_bkgd = orig->_bkgd; + win->_nc_bkgd = orig->_nc_bkgd; for (i = 0; i < num_lines; i++) win->_line[i].text = &orig->_line[begy++].text[begx]; win->_parent = orig; - T(("derwin: returned window is %p", win)); - returnWin(win); } NCURSES_EXPORT(WINDOW *) -subwin -(WINDOW *w, int l, int c, int y, int x) +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(("parent has begy = %d, begx = %d", w->_begy, w->_begx)); @@ -187,8 +180,7 @@ dimension_limit(int value) } NCURSES_EXPORT(WINDOW *) -_nc_makenew -(int num_lines, int num_columns, int begy, int begx, int flags) +_nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags) { int i; WINDOWLIST *wp; @@ -203,8 +195,7 @@ _nc_makenew if ((wp = typeCalloc(WINDOWLIST, 1)) == 0) return 0; - if ((win = typeCalloc(WINDOW, 1)) == 0) - return 0; + win = &(wp->win); if ((win->_line = typeCalloc(struct ldat, ((unsigned) num_lines))) == 0) { free(win); @@ -221,7 +212,7 @@ _nc_makenew win->_flags = flags; win->_attrs = A_NORMAL; - win->_bkgd = BLANK; + SetChar(win->_nc_bkgd, BLANK_TEXT, BLANK_ATTR); win->_clear = is_pad ? FALSE : (num_lines == screen_lines && num_columns == screen_columns); @@ -284,7 +275,6 @@ _nc_makenew } wp->next = _nc_windows; - wp->win = win; _nc_windows = wp; T((T_CREATE("window %p"), win)); diff --git a/contrib/ncurses/ncurses/base/lib_overlay.c b/contrib/ncurses/ncurses/base/lib_overlay.c index 592e7ad..010e6d1 100644 --- a/contrib/ncurses/ncurses/base/lib_overlay.c +++ b/contrib/ncurses/ncurses/base/lib_overlay.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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.14 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_overlay.c,v 1.20 2001/12/19 01:06:37 tom Exp $") static int overlap(const WINDOW *const s, WINDOW *const d, int const flag) @@ -109,8 +109,8 @@ copywin { int sx, sy, dx, dy; bool touched; - chtype bk = AttrOf(dst->_bkgd); - chtype mask = ~(chtype) ((bk & A_COLOR) ? A_COLOR : 0); + attr_t bk = AttrOf(dst->_nc_bkgd); + attr_t mask = ~(attr_t) ((bk & A_COLOR) ? A_COLOR : 0); T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"), src, dst, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, over)); @@ -137,14 +137,15 @@ copywin touched = FALSE; for (dx = dmincol, sx = smincol; dx <= dmaxcol; sx++, dx++) { if (over) { - if ((TextOf(src->_line[sy].text[sx]) != ' ') && - (dst->_line[dy].text[dx] != src->_line[sy].text[sx])) { - dst->_line[dy].text[dx] = - (src->_line[sy].text[sx] & mask) | bk; + if ((CharOf(src->_line[sy].text[sx]) != L(' ')) && + (!CharEq(dst->_line[dy].text[dx], src->_line[sy].text[sx]))) { + dst->_line[dy].text[dx] = src->_line[sy].text[sx]; + SetAttr(dst->_line[dy].text[dx], + (AttrOf(src->_line[sy].text[sx]) & mask) | bk); touched = TRUE; } } else { - if (dst->_line[dy].text[dx] != src->_line[sy].text[sx]) { + if (!CharEq(dst->_line[dy].text[dx], src->_line[sy].text[sx])) { dst->_line[dy].text[dx] = src->_line[sy].text[sx]; touched = TRUE; } diff --git a/contrib/ncurses/ncurses/base/lib_pad.c b/contrib/ncurses/ncurses/base/lib_pad.c index 8a9dae8..556fb19 100644 --- a/contrib/ncurses/ncurses/base/lib_pad.c +++ b/contrib/ncurses/ncurses/base/lib_pad.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2002 Free 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,13 +40,13 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_pad.c,v 1.32 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_pad.c,v 1.36 2002/05/18 21:28:44 Kriang.Lerdsuwanakij Exp $") NCURSES_EXPORT(WINDOW *) newpad(int l, int c) { WINDOW *win; - chtype *ptr; + NCURSES_CH_T *ptr; int i; T((T_CALLED("newpad(%d, %d)"), l, c)); @@ -59,12 +59,12 @@ newpad(int l, int c) for (i = 0; i < l; i++) { if_USE_SCROLL_HINTS(win->_line[i].oldindex = _NEWINDEX); - if ((win->_line[i].text = typeCalloc(chtype, ((size_t) c))) == 0) { + if ((win->_line[i].text = typeCalloc(NCURSES_CH_T, ((size_t) c))) == 0) { (void) _nc_freewin(win); returnWin(0); } - for (ptr = win->_line[i].text; ptr < win->_line[i].text + c;) - *ptr++ = ' '; + for (ptr = win->_line[i].text; ptr < win->_line[i].text + c; ptr++) + SetChar(*ptr, BLANK_TEXT, BLANK_ATTR); } returnWin(win); @@ -193,9 +193,23 @@ pnoutrefresh i++, m++) { register struct ldat *nline = &newscr->_line[m]; register struct ldat *oline = &win->_line[i]; + NCURSES_CH_T ch; + + /* + * Special case for leftmost character of the displayed area. + * Only half of a double-width character may be visible. + */ + ch = oline->text[pmincol]; + if_WIDEC(isnac(ch)) { + SetChar(ch, L(' '), AttrOf(oline->text[pmincol - 1])); + } + if (!CharEq(ch, nline->text[smincol])) { + nline->text[smincol] = ch; + CHANGED_CELL(nline, smincol); + } - for (j = pmincol, n = smincol; j <= pmaxcol; j++, n++) { - if (oline->text[j] != nline->text[n]) { + for (j = pmincol + 1, n = smincol + 1; j <= pmaxcol; j++, n++) { + if (!CharEq(oline->text[j], nline->text[n])) { nline->text[n] = oline->text[j]; CHANGED_CELL(nline, n); } diff --git a/contrib/ncurses/ncurses/base/lib_printw.c b/contrib/ncurses/ncurses/base/lib_printw.c index f6b7036..f821a96 100644 --- a/contrib/ncurses/ncurses/base/lib_printw.c +++ b/contrib/ncurses/ncurses/base/lib_printw.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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.9 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_printw.c,v 1.12 2001/10/20 20:33:46 tom Exp $") NCURSES_EXPORT(int) printw(NCURSES_CONST char *fmt,...) @@ -47,13 +47,18 @@ printw(NCURSES_CONST char *fmt,...) va_list argp; int code; - T(("printw(%s,...) called", _nc_visbuf(fmt))); +#ifdef TRACE + va_start(argp, fmt); + T((T_CALLED("printw(%s%s)"), + _nc_visbuf(fmt), _nc_varargs(fmt, argp))); + va_end(argp); +#endif va_start(argp, fmt); code = vwprintw(stdscr, fmt, argp); va_end(argp); - return code; + returnCode(code); } NCURSES_EXPORT(int) @@ -62,56 +67,76 @@ wprintw(WINDOW *win, NCURSES_CONST char *fmt,...) va_list argp; int code; - T(("wprintw(%p,%s,...) called", win, _nc_visbuf(fmt))); +#ifdef TRACE + va_start(argp, fmt); + T((T_CALLED("wprintw(%p,%s%s)"), + win, _nc_visbuf(fmt), _nc_varargs(fmt, argp))); + va_end(argp); +#endif va_start(argp, fmt); code = vwprintw(win, fmt, argp); va_end(argp); - return code; + returnCode(code); } NCURSES_EXPORT(int) mvprintw(int y, int x, NCURSES_CONST char *fmt,...) { va_list argp; - int code = move(y, x); + int code; - if (code != ERR) { +#ifdef TRACE + va_start(argp, fmt); + T((T_CALLED("mvprintw(%d,%d,%s%s)"), + y, x, _nc_visbuf(fmt), _nc_varargs(fmt, argp))); + va_end(argp); +#endif + + if ((code = move(y, x)) != ERR) { va_start(argp, fmt); code = vwprintw(stdscr, fmt, argp); va_end(argp); } - return code; + returnCode(code); } NCURSES_EXPORT(int) -mvwprintw -(WINDOW *win, int y, int x, NCURSES_CONST char *fmt,...) +mvwprintw(WINDOW *win, int y, int x, NCURSES_CONST char *fmt,...) { va_list argp; - int code = wmove(win, y, x); + int code; + +#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))); + va_end(argp); +#endif - if (code != ERR) { + if ((code = wmove(win, y, x)) != ERR) { va_start(argp, fmt); code = vwprintw(win, fmt, argp); va_end(argp); } - return code; + returnCode(code); } NCURSES_EXPORT(int) -vwprintw -(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) +vwprintw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) { - char *buf = _nc_printf_string(fmt, argp); + char *buf; int code = ERR; - if (buf != 0) { + T((T_CALLED("wprintw(%p,%s,%p)"), + win, _nc_visbuf(fmt), argp)); + + if ((buf = _nc_printf_string(fmt, argp)) != 0) { code = waddstr(win, buf); #if USE_SAFE_SPRINTF free(buf); #endif } - return code; + returnCode(code); } diff --git a/contrib/ncurses/ncurses/base/lib_redrawln.c b/contrib/ncurses/ncurses/base/lib_redrawln.c index dd0a51e..91a0371 100644 --- a/contrib/ncurses/ncurses/base/lib_redrawln.c +++ b/contrib/ncurses/ncurses/base/lib_redrawln.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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_redrawln.c,v 1.9 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_redrawln.c,v 1.10 2001/09/29 17:41:31 tom Exp $") NCURSES_EXPORT(int) wredrawln(WINDOW *win, int beg, int num) { int i; int end; - size_t len = (win->_maxx + 1) * sizeof(chtype); + size_t len = (win->_maxx + 1); T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num)); @@ -57,9 +57,15 @@ wredrawln(WINDOW *win, int beg, int num) returnCode(ERR); end = beg + num; + if (end > curscr->_maxy + 1) + end = curscr->_maxy + 1; if (end > win->_maxy + 1) end = win->_maxy + 1; + if (len > (size_t) (curscr->_maxx + 1)) + len = (size_t) (curscr->_maxx + 1); + len *= sizeof(curscr->_line[0].text[0]); + for (i = beg; i < end; i++) { memset(curscr->_line[i + win->_begy].text + win->_begx, 0, len); _nc_make_oldhash(i + win->_begy); diff --git a/contrib/ncurses/ncurses/base/lib_refresh.c b/contrib/ncurses/ncurses/base/lib_refresh.c index bd03ce7..42c1f49 100644 --- a/contrib/ncurses/ncurses/base/lib_refresh.c +++ b/contrib/ncurses/ncurses/base/lib_refresh.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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_refresh.c,v 1.28 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_refresh.c,v 1.31 2001/12/19 01:06:41 tom Exp $") NCURSES_EXPORT(int) wrefresh(WINDOW *win) @@ -96,7 +96,7 @@ wnoutrefresh(WINDOW *win) begx = win->_begx; begy = win->_begy; - newscr->_bkgd = win->_bkgd; + newscr->_nc_bkgd = win->_nc_bkgd; newscr->_attrs = win->_attrs; /* merge in change information from all subwindows of this window */ @@ -148,7 +148,7 @@ wnoutrefresh(WINDOW *win) last = limit_x; for (j = oline->firstchar, n = j + begx; j <= last; j++, n++) { - if (oline->text[j] != nline->text[n]) { + if (!CharEq(oline->text[j], nline->text[n])) { nline->text[n] = oline->text[j]; CHANGED_CELL(nline, n); } diff --git a/contrib/ncurses/ncurses/base/lib_scanw.c b/contrib/ncurses/ncurses/base/lib_scanw.c index 3e1c9d0..b8a5a22 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 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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,15 +40,7 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_scanw.c,v 1.10 2000/12/10 02:43:27 tom Exp $") - -#if !HAVE_VSSCANF -#if defined(__QNX__) -extern int vsscanf(const char *str, const char *format, __va_list __arg); -#else -extern int vsscanf(const char *str, const char *format,...); -#endif -#endif +MODULE_ID("$Id: lib_scanw.c,v 1.11 2001/06/30 23:39:41 tom Exp $") NCURSES_EXPORT(int) vwscanw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) diff --git a/contrib/ncurses/ncurses/base/lib_screen.c b/contrib/ncurses/ncurses/base/lib_screen.c index 5e674b3..3b2d929 100644 --- a/contrib/ncurses/ncurses/base/lib_screen.c +++ b/contrib/ncurses/ncurses/base/lib_screen.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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 <time.h> #include <term.h> /* exit_ca_mode, non_rev_rmcup */ -MODULE_ID("$Id: lib_screen.c,v 1.17 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_screen.c,v 1.19 2001/12/19 00:55:28 tom Exp $") static time_t dumptime; @@ -71,7 +71,7 @@ getwin(FILE * filep) nwin->_flags = tmp._flags & ~(_SUBWIN | _ISPAD); nwin->_attrs = tmp._attrs; - nwin->_bkgd = tmp._bkgd; + nwin->_nc_bkgd = tmp._nc_bkgd; nwin->_clear = tmp._clear; nwin->_scroll = tmp._scroll; diff --git a/contrib/ncurses/ncurses/base/lib_scroll.c b/contrib/ncurses/ncurses/base/lib_scroll.c index dcde0fc..39c62d0 100644 --- a/contrib/ncurses/ncurses/base/lib_scroll.c +++ b/contrib/ncurses/ncurses/base/lib_scroll.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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,8 @@ ****************************************************************************/ /**************************************************************************** - * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * + * Author: Thomas E. Dickey 1996-2001 * + * and: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ @@ -42,18 +43,26 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_scroll.c,v 1.20 2000/12/10 02:54:03 tom Exp $") +MODULE_ID("$Id: lib_scroll.c,v 1.23 2001/12/19 01:06:55 tom Exp $") NCURSES_EXPORT(void) -_nc_scroll_window -(WINDOW *win, int const n, NCURSES_SIZE_T const top, - NCURSES_SIZE_T const bottom, chtype blank) +_nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, + NCURSES_SIZE_T const bottom, NCURSES_CH_T blank) { - int line, j; - size_t to_copy = (size_t) (sizeof(chtype) * (win->_maxx + 1)); + int limit; + int line; + int j; + size_t to_copy = (size_t) (sizeof(NCURSES_CH_T) * (win->_maxx + 1)); TR(TRACE_MOVE, ("_nc_scroll_window(%p, %d, %d, %d)", win, n, top, bottom)); + if (top < 0 + || bottom < top + || bottom > win->_maxy) { + TR(TRACE_MOVE, ("nothing to scroll")); + return; + } + /* * This used to do a line-text pointer-shuffle instead of text copies. * That (a) doesn't work when the window is derived and doesn't have @@ -67,15 +76,26 @@ _nc_scroll_window /* shift n lines downwards */ if (n < 0) { - for (line = bottom; line >= top - n; line--) { - memcpy(win->_line[line].text, - win->_line[line + n].text, - to_copy); - if_USE_SCROLL_HINTS( - win->_line[line].oldindex = - win->_line[line + n].oldindex); + limit = top - n; + if (limit > win->_maxy) + limit = win->_maxy; + for (line = bottom; line >= limit; line--) { + if (line + n >= 0) { + TR(TRACE_MOVE, ("...copying %d to %d", line + n, line)); + memcpy(win->_line[line].text, + win->_line[line + n].text, + to_copy); + if_USE_SCROLL_HINTS(win->_line[line].oldindex = + win->_line[line + n].oldindex); + } else { + TR(TRACE_MOVE, ("...filling %d", line)); + for (j = 0; j <= win->_maxx; j++) + win->_line[line].text[j] = blank; + if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX); + } } - for (line = top; line < top - n; line++) { + for (line = top; line < limit; line++) { + TR(TRACE_MOVE, ("...filling %d", line)); for (j = 0; j <= win->_maxx; j++) win->_line[line].text[j] = blank; if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX); @@ -84,14 +104,26 @@ _nc_scroll_window /* shift n lines upwards */ if (n > 0) { - for (line = top; line <= bottom - n; line++) { - memcpy(win->_line[line].text, - win->_line[line + n].text, - to_copy); - if_USE_SCROLL_HINTS(win->_line[line].oldindex = - win->_line[line + n].oldindex); + limit = bottom - n; + if (limit < 0) + limit = 0; + for (line = top; line <= limit; line++) { + if (line + n <= win->_maxy) { + TR(TRACE_MOVE, ("...copying %d to %d", line + n, line)); + memcpy(win->_line[line].text, + win->_line[line + n].text, + to_copy); + if_USE_SCROLL_HINTS(win->_line[line].oldindex = + win->_line[line + n].oldindex); + } else { + TR(TRACE_MOVE, ("...filling %d", line)); + for (j = 0; j <= win->_maxx; j++) + win->_line[line].text[j] = blank; + if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX); + } } - for (line = bottom; line > bottom - n; line--) { + for (line = bottom; line > limit; line--) { + TR(TRACE_MOVE, ("...filling %d", line)); for (j = 0; j <= win->_maxx; j++) win->_line[line].text[j] = blank; if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX); @@ -105,17 +137,15 @@ wscrl(WINDOW *win, int n) { T((T_CALLED("wscrl(%p,%d)"), win, n)); - if (!win || !win->_scroll) + if (!win || !win->_scroll) { + TR(TRACE_MOVE, ("...scrollok is false")); returnCode(ERR); + } if (n == 0) returnCode(OK); - if ((n > (win->_regbottom - win->_regtop)) || - (-n > (win->_regbottom - win->_regtop))) - returnCode(ERR); - - _nc_scroll_window(win, n, win->_regtop, win->_regbottom, _nc_background(win)); + _nc_scroll_window(win, n, win->_regtop, win->_regbottom, win->_nc_bkgd); _nc_synchook(win); returnCode(OK); diff --git a/contrib/ncurses/ncurses/base/lib_set_term.c b/contrib/ncurses/ncurses/base/lib_set_term.c index e2afbec..03bb5bf 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,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -43,7 +43,7 @@ #include <term.h> /* cur_term */ #include <tic.h> -MODULE_ID("$Id: lib_set_term.c,v 1.61 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_set_term.c,v 1.64 2002/02/10 00:21:10 tom Exp $") NCURSES_EXPORT(SCREEN *) set_term(SCREEN * screenp) @@ -268,8 +268,13 @@ _nc_setupscreen */ 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)); + if (*p) /* assume rxvt was compiled with xpm support */ + p = extract_fgbg(p, &(SP->_default_bg)); + TR(TRACE_CHARPUT | TRACE_MOVE, ("decoded fg=%d, bg=%d", + SP->_default_fg, SP->_default_bg)); } #endif #endif /* NCURSES_EXT_FUNCS */ @@ -319,6 +324,9 @@ _nc_setupscreen acs_chars = 0; #endif } +#if USE_WIDEC_SUPPORT + _nc_init_wacs(); +#endif _nc_init_acs(); memcpy(SP->_acs_map, acs_map, sizeof(chtype) * ACS_LEN); @@ -347,6 +355,9 @@ _nc_setupscreen newscr->_clear = TRUE; curscr->_clear = FALSE; + def_shell_mode(); + def_prog_mode(); + for (i = 0, rsp = rippedoff; rsp->line && (i < N_RIPS); rsp++, i++) { if (rsp->hook) { WINDOW *w; @@ -382,9 +393,6 @@ _nc_setupscreen return ERR; SP->_stdscr = stdscr; - def_shell_mode(); - def_prog_mode(); - return OK; } diff --git a/contrib/ncurses/ncurses/base/lib_slkclear.c b/contrib/ncurses/ncurses/base/lib_slkclear.c index 47e5245..03e6721 100644 --- a/contrib/ncurses/ncurses/base/lib_slkclear.c +++ b/contrib/ncurses/ncurses/base/lib_slkclear.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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 <curses.priv.h> -MODULE_ID("$Id: lib_slkclear.c,v 1.6 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_slkclear.c,v 1.8 2001/12/19 01:07:01 tom Exp $") NCURSES_EXPORT(int) slk_clear(void) @@ -50,7 +50,7 @@ slk_clear(void) SP->_slk->hidden = TRUE; /* For simulated SLK's it's looks much more natural to inherit those attributes from the standard screen */ - SP->_slk->win->_bkgd = stdscr->_bkgd; + SP->_slk->win->_nc_bkgd = stdscr->_nc_bkgd; SP->_slk->win->_attrs = stdscr->_attrs; if (SP->_slk->win == stdscr) { returnCode(OK); diff --git a/contrib/ncurses/ncurses/base/lib_slkset.c b/contrib/ncurses/ncurses/base/lib_slkset.c index c3fb1a1..d15002f 100644 --- a/contrib/ncurses/ncurses/base/lib_slkset.c +++ b/contrib/ncurses/ncurses/base/lib_slkset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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 <curses.priv.h> #include <ctype.h> -MODULE_ID("$Id: lib_slkset.c,v 1.6 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_slkset.c,v 1.7 2001/06/02 22:50:29 skimo Exp $") NCURSES_EXPORT(int) slk_set(int i, const char *astr, int format) @@ -55,10 +55,10 @@ slk_set(int i, const char *astr, int format) if (str == NULL) str = ""; - while (isspace(CharOf(*str))) + while (isspace(UChar(*str))) str++; /* skip over leading spaces */ p = str; - while (isprint(CharOf(*p))) + while (isprint(UChar(*p))) p++; /* The first non-print stops */ --i; /* Adjust numbering of labels */ diff --git a/contrib/ncurses/ncurses/base/lib_ungetch.c b/contrib/ncurses/ncurses/base/lib_ungetch.c index d28d3de..ba057c0 100644 --- a/contrib/ncurses/ncurses/base/lib_ungetch.c +++ b/contrib/ncurses/ncurses/base/lib_ungetch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -40,7 +40,7 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_ungetch.c,v 1.4 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_ungetch.c,v 1.7 2001/12/29 23:01:09 tom Exp $") #include <fifo_defs.h> @@ -51,15 +51,17 @@ _nc_fifo_dump(void) int i; T(("head = %d, tail = %d, peek = %d", head, tail, peek)); for (i = 0; i < 10; i++) - T(("char %d = %s", i, _trace_key(SP->_fifo[i]))); + T(("char %d = %s", i, _tracechar(SP->_fifo[i]))); } #endif /* TRACE */ NCURSES_EXPORT(int) ungetch(int ch) { + T((T_CALLED("ungetch(%d)"), ch)); + if (tail == -1) - return ERR; + returnCode(ERR); if (head == -1) { head = 0; t_inc() @@ -73,5 +75,5 @@ ungetch(int ch) if (_nc_tracing & TRACE_IEVENT) _nc_fifo_dump(); #endif - return OK; + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_vline.c b/contrib/ncurses/ncurses/base/lib_vline.c index 0174baa..c19570b 100644 --- a/contrib/ncurses/ncurses/base/lib_vline.c +++ b/contrib/ncurses/ncurses/base/lib_vline.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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_vline.c,v 1.7 2000/12/10 02:43:28 tom Exp $") +MODULE_ID("$Id: lib_vline.c,v 1.9 2001/06/03 00:39:24 skimo Exp $") NCURSES_EXPORT(int) wvline(WINDOW *win, chtype ch, int n) @@ -52,6 +52,7 @@ wvline(WINDOW *win, chtype ch, int n) T((T_CALLED("wvline(%p,%s,%d)"), win, _tracechtype(ch), n)); if (win) { + NCURSES_CH_T wch; row = win->_cury; col = win->_curx; end = row + n - 1; @@ -59,12 +60,14 @@ wvline(WINDOW *win, chtype ch, int n) end = win->_maxy; if (ch == 0) - ch = ACS_VLINE; - ch = _nc_render(win, ch); + SetChar(wch, ChCharOf(ACS_VLINE), ChAttrOf(ACS_VLINE)); + else + SetChar(wch, ChCharOf(ch), ChAttrOf(ch)); + wch = _nc_render(win, wch); while (end >= row) { struct ldat *line = &(win->_line[end]); - line->text[col] = ch; + line->text[col] = wch; CHANGED_CELL(line, col); end--; } diff --git a/contrib/ncurses/ncurses/base/lib_winch.c b/contrib/ncurses/ncurses/base/lib_winch.c index 236b11a..18da9c5 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 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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,15 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_winch.c,v 1.4 2000/12/10 02:43:28 tom Exp $") +MODULE_ID("$Id: lib_winch.c,v 1.5 2001/06/02 23:42:08 skimo Exp $") NCURSES_EXPORT(chtype) winch(WINDOW *win) { T((T_CALLED("winch(%p)"), win)); if (win != 0) { - returnChar(win->_line[win->_cury].text[win->_curx]); + returnChar(CharOf(win->_line[win->_cury].text[win->_curx]) | + AttrOf(win->_line[win->_cury].text[win->_curx])); } else { returnChar(0); } diff --git a/contrib/ncurses/ncurses/base/lib_window.c b/contrib/ncurses/ncurses/base/lib_window.c index 9cef79c..943f6e0 100644 --- a/contrib/ncurses/ncurses/base/lib_window.c +++ b/contrib/ncurses/ncurses/base/lib_window.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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.15 2000/12/10 02:43:28 tom Exp $") +MODULE_ID("$Id: lib_window.c,v 1.18 2001/12/19 01:07:15 tom Exp $") NCURSES_EXPORT(void) _nc_synchook(WINDOW *win) @@ -98,7 +98,8 @@ wsyncup(WINDOW *win) { WINDOW *wp; - if (win && win->_parent) + T((T_CALLED("wsyncup(%p)"), win)); + if (win && win->_parent) { for (wp = win; wp->_parent; wp = wp->_parent) { int y; WINDOW *pp = wp->_parent; @@ -118,6 +119,8 @@ wsyncup(WINDOW *win) } } } + } + returnVoid; } NCURSES_EXPORT(void) @@ -125,6 +128,8 @@ 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)); + if (win && win->_parent) { WINDOW *pp = win->_parent; int y; @@ -153,6 +158,7 @@ wsyncdown(WINDOW *win) } } } + returnVoid; } NCURSES_EXPORT(void) @@ -160,9 +166,12 @@ wcursyncup(WINDOW *win) /* sync the cursor in all derived windows to its value in the base window */ { WINDOW *wp; + + T((T_CALLED("wcursyncup(%p)"), win)); for (wp = win; wp && wp->_parent; wp = wp->_parent) { wmove(wp->_parent, wp->_pary + wp->_cury, wp->_parx + wp->_curx); } + returnVoid; } NCURSES_EXPORT(WINDOW *) @@ -177,7 +186,7 @@ dupwin(WINDOW *win) if ((win == NULL) || ((nwin = newwin(win->_maxy + 1, win->_maxx + 1, win->_begy, - win->_begx)) == NULL)) + win->_begx)) == NULL)) returnWin(0); nwin->_curx = win->_curx; @@ -194,7 +203,7 @@ dupwin(WINDOW *win) */ nwin->_attrs = win->_attrs; - nwin->_bkgd = win->_bkgd; + nwin->_nc_bkgd = win->_nc_bkgd; nwin->_clear = win->_clear; nwin->_scroll = win->_scroll; diff --git a/contrib/ncurses/ncurses/base/resizeterm.c b/contrib/ncurses/ncurses/base/resizeterm.c index 303aa5e..f454b20 100644 --- a/contrib/ncurses/ncurses/base/resizeterm.c +++ b/contrib/ncurses/ncurses/base/resizeterm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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,39 +41,34 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$Id: resizeterm.c,v 1.9 2000/12/10 02:43:28 tom Exp $") +MODULE_ID("$Id: resizeterm.c,v 1.13 2002/02/02 19:26:27 tom Exp $") + +NCURSES_EXPORT(bool) +is_term_resized(int ToLines, int ToCols) +{ + return (ToLines != screen_lines + || ToCols != screen_columns); +} /* - * This function reallocates NCURSES window structures. It is invoked in - * response to a SIGWINCH interrupt. Other user-defined windows may also need - * to be reallocated. - * - * Because this performs memory allocation, it should not (in general) be - * invoked directly from the signal handler. + * This function reallocates NCURSES window structures, with no side-effects + * such as ungetch(). */ NCURSES_EXPORT(int) -resizeterm(int ToLines, int ToCols) +resize_term(int ToLines, int ToCols) { int stolen = screen_lines - SP->_lines_avail; int bottom = screen_lines + SP->_topstolen - stolen; - T((T_CALLED("resizeterm(%d,%d) old(%d,%d)"), + T((T_CALLED("resize_term(%d,%d) old(%d,%d)"), ToLines, ToCols, screen_lines, screen_columns)); - SP->_sig_winch = FALSE; - - if (ToLines != screen_lines - || ToCols != screen_columns) { + if (is_term_resized(ToLines, ToCols)) { WINDOWLIST *wp; -#if USE_SIGWINCH - ungetch(KEY_RESIZE); /* so application can know this */ - clearok(curscr, TRUE); /* screen contents are unknown */ -#endif - for (wp = _nc_windows; wp != 0; wp = wp->next) { - WINDOW *win = wp->win; + WINDOW *win = &(wp->win); int myLines = win->_maxy + 1; int myCols = win->_maxx + 1; @@ -122,3 +117,35 @@ resizeterm(int ToLines, int ToCols) returnCode(OK); } + +/* + * This function reallocates NCURSES window structures. It is invoked in + * response to a SIGWINCH interrupt. Other user-defined windows may also need + * to be reallocated. + * + * Because this performs memory allocation, it should not (in general) be + * invoked directly from the signal handler. + */ +NCURSES_EXPORT(int) +resizeterm(int ToLines, int ToCols) +{ + int result = OK; + + SP->_sig_winch = FALSE; + + T((T_CALLED("resizeterm(%d,%d) old(%d,%d)"), + ToLines, ToCols, + screen_lines, screen_columns)); + + if (is_term_resized(ToLines, ToCols)) { + +#if USE_SIGWINCH + ungetch(KEY_RESIZE); /* so application can know this */ + clearok(curscr, TRUE); /* screen contents are unknown */ +#endif + + result = resize_term(ToLines, ToCols); + } + + returnCode(result); +} diff --git a/contrib/ncurses/ncurses/base/safe_sprintf.c b/contrib/ncurses/ncurses/base/safe_sprintf.c index e534776..cb48365 100644 --- a/contrib/ncurses/ncurses/base/safe_sprintf.c +++ b/contrib/ncurses/ncurses/base/safe_sprintf.c @@ -33,7 +33,7 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$Id: safe_sprintf.c,v 1.13 2000/12/10 02:43:28 tom Exp $") +MODULE_ID("$Id: safe_sprintf.c,v 1.14 2001/07/08 00:58:34 tom Exp $") #if USE_SAFE_SPRINTF @@ -84,7 +84,7 @@ _nc_printf_length(const char *fmt, va_list ap) while (*++fmt != '\0' && len >= 0 && !done) { format[f++] = *fmt; - if (isdigit(*fmt)) { + if (isdigit(UChar(*fmt))) { int num = *fmt - '0'; if (state == Flags && num != 0) state = Width; @@ -108,7 +108,7 @@ _nc_printf_length(const char *fmt, va_list ap) } sprintf(&format[--f], "%d", ival); f = strlen(format); - } else if (isalpha(*fmt)) { + } else if (isalpha(UChar(*fmt))) { done = TRUE; switch (*fmt) { case 'Z': /* FALLTHRU */ diff --git a/contrib/ncurses/ncurses/base/sigaction.c b/contrib/ncurses/ncurses/base/sigaction.c index 8819638..8ba8629 100644 --- a/contrib/ncurses/ncurses/base/sigaction.c +++ b/contrib/ncurses/ncurses/base/sigaction.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2002 Free 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,6 @@ #include <curses.priv.h> -#include <signal.h> #include <SigAction.h> /* This file provides sigaction() emulation using sigvec() */ @@ -41,7 +40,7 @@ #if !HAVE_SIGACTION && HAVE_SIGVEC -MODULE_ID("$Id: sigaction.c,v 1.11 2000/12/10 02:43:28 tom Exp $") +MODULE_ID("$Id: sigaction.c,v 1.13 2002/05/18 19:56:26 tom Exp $") NCURSES_EXPORT(int) sigaction diff --git a/contrib/ncurses/ncurses/base/tries.c b/contrib/ncurses/ncurses/base/tries.c index 04f8b91..fe7d93e 100644 --- a/contrib/ncurses/ncurses/base/tries.c +++ b/contrib/ncurses/ncurses/base/tries.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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.14 2000/12/10 02:43:28 tom Exp $") +MODULE_ID("$Id: tries.c,v 1.15 2001/12/16 00:50:40 tom Exp $") /* * Expand a keycode into the string that it corresponds to, returning null if @@ -73,7 +73,7 @@ _nc_expand_try *((unsigned char *) (result + len)) = 128; #ifdef TRACE if (len == 0) - _tracef("expand_key %s %s", _trace_key(code), _nc_visbuf(result)); + _tracef("expand_key %s %s", _tracechar(code), _nc_visbuf(result)); #endif } return result; diff --git a/contrib/ncurses/ncurses/base/vsscanf.c b/contrib/ncurses/ncurses/base/vsscanf.c index 70d0517..65794b7 100644 --- a/contrib/ncurses/ncurses/base/vsscanf.c +++ b/contrib/ncurses/ncurses/base/vsscanf.c @@ -1,3 +1,35 @@ +/**************************************************************************** + * Copyright (c) 1998,2000,2001,2002 Free 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. * + ****************************************************************************/ + +/**************************************************************************** + * State-machine fallback written by Thomas E. Dickey 2002 * + ****************************************************************************/ + /* * This function is needed to support vwscanw */ @@ -6,14 +38,132 @@ #if !HAVE_VSSCANF -MODULE_ID("$Id: vsscanf.c,v 1.12 2000/12/10 02:43:28 tom Exp $") +MODULE_ID("$Id: vsscanf.c,v 1.15 2002/02/03 00:49:45 tom Exp $") + +#if !(HAVE_VFSCANF || HAVE__DOSCAN) + +#include <ctype.h> + +#define L_SQUARE '[' +#define R_SQUARE ']' + +typedef enum { + cUnknown + ,cError /* anything that isn't ANSI */ + ,cAssigned + ,cChar + ,cInt + ,cFloat + ,cDouble + ,cPointer + ,cLong + ,cShort + ,cRange + ,cString +} ChunkType; + +typedef enum { + oUnknown + ,oShort + ,oLong +} OtherType; + +typedef enum { + sUnknown + ,sPercent /* last was '%' beginning a format */ + ,sNormal /* ...somewhere in the middle */ + ,sLeft /* last was left square bracket beginning a range */ + ,sRange /* ...somewhere in the middle */ + ,sFinal /* last finished a format */ +} ScanState; + +static ChunkType +final_ch(int ch, OtherType other) +{ + ChunkType result = cUnknown; + + switch (ch) { + case 'c': + if (other == oUnknown) + result = cChar; + else + result = cError; + break; + case 'd': + case 'i': + case 'X': + case 'x': + switch (other) { + case oUnknown: + result = cInt; + break; + case oShort: + result = cShort; + break; + case oLong: + result = cLong; + break; + } + break; + case 'E': + case 'e': + case 'f': + case 'g': + switch (other) { + case oUnknown: + result = cFloat; + break; + case oShort: + result = cError; + break; + case oLong: + result = cDouble; + break; + } + break; + case 'n': + if (other == oUnknown) + result = cAssigned; + else + result = cError; + break; + case 'p': + if (other == oUnknown) + result = cPointer; + else + result = cError; + break; + case 's': + if (other == oUnknown) + result = cString; + else + result = cError; + break; + } + return result; +} + +static OtherType +other_ch(int ch) +{ + OtherType result = oUnknown; + switch (ch) { + case 'h': + result = oShort; + break; + case 'l': + result = oLong; + break; + } + return result; +} +#endif -#if defined(_IOREAD) && defined(_NFILE) /*VARARGS2*/ NCURSES_EXPORT(int) -vsscanf -(const char *str, const char *format, va_list ap) +vsscanf(const char *str, const char *format, va_list ap) { +#if HAVE_VFSCANF || HAVE__DOSCAN /* * This code should work on anything descended from AT&T SVr1. */ @@ -29,22 +179,171 @@ vsscanf #else return (_doscan(&strbuf, format, ap)); #endif -} #else -/*VARARGS2*/ -NCURSES_EXPORT(int) -vsscanf -(const char *str, const char *format, va_list ap) -{ + static int can_convert = -1; + + int assigned = 0; + int consumed = 0; + + T((T_CALLED("vsscanf(%s,%s,...)"), + _nc_visbuf2(1, str), + _nc_visbuf2(2, format))); + /* - * You don't have a native vsscanf(3), and you don't have System-V - * compatible stdio internals. You're probably using a BSD - * older than 4.4 or a really old Linux. You lose. Upgrade - * to a current C library to win. + * This relies on having a working "%n" format conversion. Check if it + * works. Only very old C libraries do not support it. + * + * FIXME: move this check into the configure script. */ - return -1; /* not implemented */ -} + if (can_convert < 0) { + int check1; + int check2; + if (sscanf("123", "%d%n", &check1, &check2) > 0 + && check1 == 123 + && check2 == 3) { + can_convert = 1; + } else { + can_convert = 0; + } + } + + if (can_convert) { + size_t len_fmt = strlen(format) + 32; + char *my_fmt = malloc(len_fmt); + ChunkType other, chunk, check; + ScanState state; + unsigned n; + int eaten; + void *pointer; + + if (my_fmt != 0) { + /* + * Split the original format into chunks, adding a "%n" to the end + * of each (except of course if it used %n), and use that + * information to decide where to start scanning the next chunk. + * + * FIXME: does %n count bytes or characters? If the latter, this + * will require further work for multibyte strings. + */ + while (*format != '\0') { + /* find a chunk */ + state = sUnknown; + chunk = cUnknown; + other = cUnknown; + pointer = 0; + for (n = 0; format[n] != 0 && state != sFinal; ++n) { + my_fmt[n] = format[n]; + switch (state) { + case sUnknown: + if (format[n] == '%') + state = sPercent; + break; + case sPercent: + if (format[n] == '%') { + state = sUnknown; + } else if (format[n] == L_SQUARE) { + state = sLeft; + } else { + state = sNormal; + --n; + } + break; + case sLeft: + state = sRange; + if (format[n] == '^') { + ++n; + my_fmt[n] = format[n]; + } + break; + case sRange: + if (format[n] == R_SQUARE) { + state = sFinal; + chunk = cRange; + } + break; + case sNormal: + if (format[n] == '*') { + state = sUnknown; + } else { + if ((check = final_ch(format[n], other)) != cUnknown) { + state = sFinal; + chunk = check; + } else if ((check = other_ch(format[n])) != oUnknown) { + other = check; + } else if (isalpha(format[n])) { + state = sFinal; + chunk = cError; + } + } + break; + case sFinal: + break; + } + } + my_fmt[n] = '\0'; + format += n; + + if (chunk == cUnknown + || chunk == cError) { + if (assigned == 0) + assigned = EOF; + break; + } + + /* add %n, if the format was not that */ + if (chunk != cAssigned) { + strcat(my_fmt, "%n"); + } + + switch (chunk) { + case cAssigned: + strcat(my_fmt, "%n"); + pointer = &eaten; + break; + case cInt: + pointer = va_arg(ap, int *); + break; + case cShort: + pointer = va_arg(ap, short *); + break; + case cFloat: + pointer = va_arg(ap, float *); + break; + case cDouble: + pointer = va_arg(ap, double *); + break; + case cLong: + pointer = va_arg(ap, long *); + break; + case cPointer: + pointer = va_arg(ap, void *); + break; + case cChar: + case cRange: + case cString: + pointer = va_arg(ap, char *); + break; + case cError: + case cUnknown: + break; + } + /* do the conversion */ + T(("...converting chunk #%d type %d(%s,%s)", + assigned + 1, chunk, + _nc_visbuf2(1, str + consumed), + _nc_visbuf2(2, my_fmt))); + if (sscanf(str + consumed, my_fmt, pointer, &eaten) > 0) + consumed += eaten; + else + break; + ++assigned; + } + free(my_fmt); + } + } + returnCode(assigned); #endif +} #else extern NCURSES_EXPORT(void) diff --git a/contrib/ncurses/ncurses/base/wresize.c b/contrib/ncurses/ncurses/base/wresize.c index 4889ee0..fa97a2b 100644 --- a/contrib/ncurses/ncurses/base/wresize.c +++ b/contrib/ncurses/ncurses/base/wresize.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2002 Free 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: wresize.c,v 1.18 2000/12/10 02:43:28 tom Exp $") +MODULE_ID("$Id: wresize.c,v 1.21 2002/05/11 19:36:29 tom Exp $") /* * Reallocate a curses WINDOW struct to either shrink or grow to the specified @@ -42,7 +42,7 @@ MODULE_ID("$Id: wresize.c,v 1.18 2000/12/10 02:43:28 tom Exp $") #define DOALLOC(p,t,n) typeRealloc(t, n, p) #define ld_ALLOC(p,n) DOALLOC(p,struct ldat,n) -#define c_ALLOC(p,n) DOALLOC(p,chtype,n) +#define c_ALLOC(p,n) DOALLOC(p,NCURSES_CH_T,n) NCURSES_EXPORT(int) wresize(WINDOW *win, int ToLines, int ToCols) @@ -50,7 +50,7 @@ wresize(WINDOW *win, int ToLines, int ToCols) register int row; int size_x, size_y; struct ldat *pline; - chtype blank; + NCURSES_CH_T blank; #ifdef TRACE T((T_CALLED("wresize(%p,%d,%d)"), win, ToLines, ToCols)); @@ -117,9 +117,9 @@ wresize(WINDOW *win, int ToLines, int ToCols) /* * Adjust the width of the columns: */ - blank = _nc_background(win); + blank = win->_nc_bkgd; for (row = 0; row <= ToLines; row++) { - chtype *s = win->_line[row].text; + NCURSES_CH_T *s = win->_line[row].text; int begin = (s == 0) ? 0 : size_x + 1; int end = ToCols; @@ -130,7 +130,7 @@ wresize(WINDOW *win, int ToLines, int ToCols) win->_line[row].text = s = c_ALLOC(s, ToCols + 1); if (win->_line[row].text == 0) returnCode(ERR); - } else if (s == 0) { + } else { win->_line[row].text = s = &pline[win->_pary + row].text[win->_parx]; } @@ -138,14 +138,15 @@ wresize(WINDOW *win, int ToLines, int ToCols) if (end >= begin) { /* growing */ if (win->_line[row].firstchar < begin) win->_line[row].firstchar = begin; - win->_line[row].lastchar = ToCols; - do { - s[end] = blank; - } while (--end >= begin); + if (!(win->_flags & _SUBWIN)) { + do { + s[end] = blank; + } while (--end >= begin); + } } else { /* shrinking */ win->_line[row].firstchar = 0; - win->_line[row].lastchar = ToCols; } + win->_line[row].lastchar = ToCols; } } diff --git a/contrib/ncurses/ncurses/curses.priv.h b/contrib/ncurses/ncurses/curses.priv.h index 042fdd1..d901eca 100644 --- a/contrib/ncurses/ncurses/curses.priv.h +++ b/contrib/ncurses/ncurses/curses.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2002 Free 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,11 +29,12 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * * and: Eric S. Raymond <esr@snark.thyrsus.com> * + * and: Thomas E. Dickey 1996-2002 * ****************************************************************************/ /* - * $Id: curses.priv.h,v 1.171 2000/12/10 00:13:52 tom Exp $ + * $Id: curses.priv.h,v 1.218 2002/05/18 19:48:38 tom Exp $ * * curses.priv.h * @@ -110,6 +111,9 @@ extern int errno; #define USE_FUNC_POLL 0 #endif +/* include signal.h before curses.h to work-around defect in glibc 2.1.3 */ +#include <signal.h> + /* Alessandro Rubini's GPM (general-purpose mouse) */ #if HAVE_LIBGPM && HAVE_GPM_H #define USE_GPM_SUPPORT 1 @@ -140,7 +144,7 @@ extern int errno; #undef HAVE_SIZECHANGE #endif -#if HAVE_SIZECHANGE +#if HAVE_SIZECHANGE && defined(SIGWINCH) #define USE_SIZECHANGE 1 #else #undef USE_SIGWINCH @@ -214,6 +218,7 @@ struct tries { #define L_BRACE '{' #define R_BRACE '}' #define S_QUOTE '\'' +#define D_QUOTE '"' /* * Structure for palette tables @@ -233,8 +238,25 @@ color_t; #define WINDOWLIST struct _win_list +#if USE_WIDEC_SUPPORT +#define _nc_bkgd _bkgrnd +#else +#undef _XOPEN_SOURCE_EXTENDED +#define _nc_bkgd _bkgd +#define wgetbkgrnd(win, wch) *wch = win->_bkgd +#define wbkgrnd wbkgd +#endif + #include <curses.h> /* we'll use -Ipath directive to get the right one! */ +struct ldat +{ + NCURSES_CH_T *text; /* text of the line */ + NCURSES_SIZE_T firstchar; /* first changed character in the line */ + NCURSES_SIZE_T lastchar; /* last changed character in the line */ + NCURSES_SIZE_T oldindex; /* index of the line at last update */ +}; + /* * Structure for soft labels. */ @@ -260,6 +282,12 @@ typedef struct { chtype attr; /* soft label attribute */ } SLK; +typedef struct { + unsigned long hashval; + int oldcount, newcount; + int oldindex, newindex; +} HASHMAP; + struct screen { int _ifd; /* input file ptr for screen */ FILE *_ofp; /* output file ptr for screen */ @@ -278,7 +306,8 @@ struct screen { struct tries *_keytry; /* "Try" for use with keypad mode */ struct tries *_key_ok; /* Disabled keys via keyok(,FALSE) */ - int _tried; /* keypad mode was initialized */ + bool _tried; /* keypad mode was initialized */ + bool _keypad_on; /* keypad mode is currently on */ unsigned int _fifo[FIFO_SIZE]; /* input push-back buffer */ short _fifohead, /* head of fifo queue */ @@ -287,7 +316,7 @@ struct screen { _fifohold; /* set if breakout marked */ int _endwin; /* are we out of window mode? */ - unsigned long _current_attr; /* terminal attribute current set */ + attr_t _current_attr; /* terminal attribute current set */ int _coloron; /* is color enabled? */ int _cursor; /* visibility of the cursor */ int _cursrow; /* physical cursor row */ @@ -411,6 +440,8 @@ struct screen { /* hashes for old and new lines */ unsigned long *oldhash, *newhash; + HASHMAP *hashtab; + int hashtab_len; bool _cleanup; /* cleanup after int/quit signal */ int (*_outch)(int); /* output handler if not putc */ @@ -422,9 +453,19 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain; #include <nomacros.h> #endif +/* + * The margins are used in resizeterm() to retain the original layout after + * resizing. + */ WINDOWLIST { WINDOWLIST *next; - WINDOW *win; +#if HAVE_RESIZETERM + int l_margin; + int r_margin; + int t_margin; + int b_margin; +#endif + WINDOW win; }; typedef struct { @@ -486,11 +527,89 @@ typedef struct { #define O_BINARY 0 #endif -#define CharOf(c) ((unsigned char)(c)) -#define TextOf(c) ((c) & (chtype)A_CHARTEXT) -#define AttrOf(c) ((c) & (chtype)A_ATTRIBUTES) - -#define BLANK (' '|A_NORMAL) +#define UChar(c) ((unsigned char)(c)) +#define ChCharOf(c) ((c) & (chtype)A_CHARTEXT) +#define ChAttrOf(c) ((c) & (chtype)A_ATTRIBUTES) + +#if USE_WIDEC_SUPPORT /* { */ +#define CharOf(c) ((c).chars[0]) +#define AttrOf(c) ((c).attr) +#define AddAttr(c,a) (c).attr |= a +#define RemAttr(c,a) (c).attr &= ~(a) +#define SetAttr(c,a) (c).attr = a +#define NewChar(ch) { ChAttrOf(ch), { ChCharOf(ch) } } +#define NewChar2(c,a) { a, { c } } +#define CharEq(a,b) (!memcmp(&a, &b, sizeof(a))) +#define SetChar(ch,c,a) do { \ + NCURSES_CH_T *_cp = &ch; \ + memset(_cp,0,sizeof(ch)); _cp->chars[0] = c; _cp->attr = a; \ + } while (0) +#define CHREF(wch) (&wch) +#define CHDEREF(wch) (*wch) +#define ARG_CH_T NCURSES_CH_T * +#define CARG_CH_T const NCURSES_CH_T * +#define PUTC_DATA char PUTC_buf[MB_LEN_MAX]; int PUTC_i, PUTC_n; \ + mbstate_t PUT_st; wchar_t PUTC_ch +#define PUTC(ch,b) do { if(!isnac(ch)) { \ + memset (&PUT_st, '\0', sizeof (PUT_st)); \ + PUTC_i = 0; \ + do { \ + PUTC_ch = PUTC_i < CCHARW_MAX ? \ + (ch).chars[PUTC_i] : L'\0'; \ + PUTC_n = wcrtomb(PUTC_buf, \ + (ch).chars[PUTC_i], &PUT_st); \ + if (PUTC_ch == L'\0') \ + --PUTC_n; \ + if (PUTC_n <= 0) \ + break; \ + fwrite(PUTC_buf, (unsigned) PUTC_n, 1, b); \ + ++PUTC_i; \ + } while (PUTC_ch != L'\0'); \ + } } while (0) + +#define BLANK { WA_NORMAL, ' ' } +#define ISBLANK(ch) ((ch).chars[0] == L' ' && (ch).chars[1] == L'\0') + +#define WA_NAC 1 +#define isnac(ch) (AttrOf(ch) & WA_NAC) +#define if_WIDEC(code) code +#define Charable(ch) (!isnac(ch) && \ + (ch).chars[1] == L'\0' && \ + (wctob(CharOf(ch)) == (char)CharOf(ch))) + +#define L(ch) L ## ch +#else /* }{ */ +#define CharOf(c) ChCharOf(c) +#define AttrOf(c) ChAttrOf(c) +#define AddAttr(c,a) c |= a +#define RemAttr(c,a) c &= ~(a & A_ATTRIBUTES) +#define SetAttr(c,a) c = (c & ~A_ATTRIBUTES) | a +#define NewChar(ch) (ch) +#define NewChar2(c,a) (c | a) +#define CharEq(a,b) (a == b) +#define SetChar(ch,c,a) ch = c | a +#define CHREF(wch) wch +#define CHDEREF(wch) wch +#define ARG_CH_T NCURSES_CH_T +#define CARG_CH_T NCURSES_CH_T +#define PUTC_DATA int data = 0 +#define PUTC(a,b) do { data = CharOf(ch); putc(data,b); } while (0) + +#define BLANK (' '|A_NORMAL) +#define ISBLANK(ch) (CharOf(ch) == ' ') + +#define isnac(ch) (0) +#define if_WIDEC(code) /* nothing */ + +#define L(ch) ch +#endif /* } */ + +#define AttrOfD(ch) AttrOf(CHDEREF(ch)) +#define CharOfD(ch) CharOf(CHDEREF(ch)) +#define SetChar2(wch,ch) SetChar(wch,ChCharOf(ch),ChAttrOf(ch)) + +#define BLANK_ATTR A_NORMAL +#define BLANK_TEXT L(' ') #define CHANGED -1 @@ -532,9 +651,9 @@ typedef struct { * instrument the public functions so that the traces can be easily transformed * into regression scripts. */ -#define T_CALLED(fmt) "called " fmt -#define T_CREATE(fmt) "create " fmt -#define T_RETURN(fmt) "return " fmt +#define T_CALLED(fmt) "called {" fmt +#define T_CREATE(fmt) "create :" fmt +#define T_RETURN(fmt) "return }" fmt #ifdef TRACE #define TR(n, a) if (_nc_tracing & (n)) _tracef a @@ -545,16 +664,26 @@ typedef struct { #define returnChar(code) TRACE_RETURN(code,chtype) #define returnCode(code) TRACE_RETURN(code,int) #define returnPtr(code) TRACE_RETURN(code,ptr) +#define returnSP(code) TRACE_RETURN(code,sp) #define returnVoid T((T_RETURN(""))); return #define returnWin(code) TRACE_RETURN(code,win) +extern NCURSES_EXPORT(SCREEN *) _nc_retrace_sp (SCREEN *); extern NCURSES_EXPORT(WINDOW *) _nc_retrace_win (WINDOW *); extern NCURSES_EXPORT(attr_t) _nc_retrace_attr_t (attr_t); extern NCURSES_EXPORT(attr_t) _nc_retrace_chtype (chtype); extern NCURSES_EXPORT(char *) _nc_retrace_ptr (char *); -extern NCURSES_EXPORT_VAR(const char *) _nc_tputs_trace; +extern NCURSES_EXPORT(char *) _nc_varargs (const char *, va_list); +extern NCURSES_EXPORT(const char *) _nc_altcharset_name(attr_t, chtype); extern NCURSES_EXPORT(int) _nc_retrace_int (int); -extern NCURSES_EXPORT_VAR(long) _nc_outchars; extern NCURSES_EXPORT(void) _nc_fifo_dump (void); +extern NCURSES_EXPORT_VAR(const char *) _nc_tputs_trace; +extern NCURSES_EXPORT_VAR(long) _nc_outchars; +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; +#if USE_WIDEC_SUPPORT +extern NCURSES_EXPORT(const char *) _nc_viswbuf2 (int, const wchar_t *); +extern NCURSES_EXPORT(const char *) _nc_viscbuf2 (int, const cchar_t *, int); +extern NCURSES_EXPORT(const char *) _nc_viscbuf (const cchar_t *, int); +#endif #else #define T(a) #define TR(n, a) @@ -563,14 +692,17 @@ extern NCURSES_EXPORT(void) _nc_fifo_dump (void); #define returnChar(code) return code #define returnCode(code) return code #define returnPtr(code) return code +#define returnSP(code) return code #define returnVoid return #define returnWin(code) return code #endif -extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; -extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *); +#define empty_module(name) \ +extern NCURSES_EXPORT(void) name (void); \ + NCURSES_EXPORT(void) name (void) { } -#define _trace_key(ch) ((ch > KEY_MIN) ? keyname(ch) : _tracechar((unsigned char)ch)) +/* used in _nc_visbuf() whether or not we're tracing */ +extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *); #define ALL_BUT_COLOR ((chtype)~(A_COLOR)) #define IGNORE_COLOR_OFF FALSE @@ -617,13 +749,12 @@ extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *); : INFINITY))) #if USE_XMC_SUPPORT -#define UpdateAttrs(c) if (SP->_current_attr != AttrOf(c)) { \ +#define UpdateAttrs(a) if (SP->_current_attr != (a)) { \ attr_t chg = SP->_current_attr; \ - vidattr(AttrOf(c)); \ + vidattr((a)); \ if (magic_cookie_glitch > 0 \ && XMC_CHANGES((chg ^ SP->_current_attr))) { \ - TR(TRACE_ATTRS, \ - ("%s @%d before glitch %d,%d", \ + T(("%s @%d before glitch %d,%d", \ __FILE__, __LINE__, \ SP->_cursrow, \ SP->_curscol)); \ @@ -631,8 +762,8 @@ extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *); } \ } #else -#define UpdateAttrs(c) if (SP->_current_attr != AttrOf(c)) \ - vidattr(AttrOf(c)) +#define UpdateAttrs(a) if (SP->_current_attr != (a)) \ + vidattr((a)); #endif #if NCURSES_EXPANDED && NCURSES_EXT_FUNCS @@ -681,6 +812,14 @@ extern NCURSES_EXPORT(void) _nc_linedump (void); 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_addstr.c */ +#if USE_WIDEC_SUPPORT +extern NCURSES_EXPORT(int) _nc_wchstrlen(const cchar_t *); +#endif + +/* lib_getch.c */ +extern NCURSES_EXPORT(int) _nc_wgetch(WINDOW *, unsigned long *, int); + /* lib_mvcur.c */ #define INFINITY 1000000 /* cost: too high to use */ @@ -700,6 +839,11 @@ extern NCURSES_EXPORT(int) _nc_has_mouse (void); /* lib_mvcur.c */ #define INFINITY 1000000 /* cost: too high to use */ +/* lib_wacs.c */ +#if USE_WIDEC_SUPPORT +extern NCURSES_EXPORT(void) _nc_init_wacs(void); +#endif + typedef struct { char *s_head; char *s_tail; @@ -707,11 +851,11 @@ typedef struct { } string_desc; /* strings.c */ -extern NCURSES_EXPORT(string_desc *) _nc_str_init (string_desc * dst, char *src, size_t len); -extern NCURSES_EXPORT(string_desc *) _nc_str_null (string_desc * dst, size_t len); -extern NCURSES_EXPORT(string_desc *) _nc_str_copy (string_desc * dst, string_desc * src); -extern NCURSES_EXPORT(bool) _nc_safe_strcat (string_desc * dst, const char *src); -extern NCURSES_EXPORT(bool) _nc_safe_strcpy (string_desc * dst, const char *src); +extern NCURSES_EXPORT(string_desc *) _nc_str_init (string_desc *, char *, size_t); +extern NCURSES_EXPORT(string_desc *) _nc_str_null (string_desc *, size_t); +extern NCURSES_EXPORT(string_desc *) _nc_str_copy (string_desc *, string_desc *); +extern NCURSES_EXPORT(bool) _nc_safe_strcat (string_desc *, const char *); +extern NCURSES_EXPORT(bool) _nc_safe_strcpy (string_desc *, const char *); extern NCURSES_EXPORT(void) _nc_mvcur_init (void); extern NCURSES_EXPORT(void) _nc_mvcur_resume (void); @@ -729,30 +873,29 @@ extern NCURSES_EXPORT(char *) _nc_strstr (const char *, const char *); #endif /* safe_sprintf.c */ -extern NCURSES_EXPORT(char *) _nc_printf_string (const char *fmt, va_list ap); +extern NCURSES_EXPORT(char *) _nc_printf_string (const char *, va_list); /* tries.c */ -extern NCURSES_EXPORT(void) _nc_add_to_try (struct tries **tree, const char *str, unsigned short code); -extern NCURSES_EXPORT(char *) _nc_expand_try (struct tries *tree, unsigned short code, int *count, size_t len); -extern NCURSES_EXPORT(int) _nc_remove_key (struct tries **tree, unsigned short code); -extern NCURSES_EXPORT(int) _nc_remove_string (struct tries **tree, char *string); +extern NCURSES_EXPORT(void) _nc_add_to_try (struct tries **, const char *, unsigned short); +extern NCURSES_EXPORT(char *) _nc_expand_try (struct tries *, unsigned short, int *, size_t); +extern NCURSES_EXPORT(int) _nc_remove_key (struct tries **, unsigned short); +extern NCURSES_EXPORT(int) _nc_remove_string (struct tries **, char *); /* elsewhere ... */ extern NCURSES_EXPORT(WINDOW *) _nc_makenew (int, int, int, int, int); extern NCURSES_EXPORT(char *) _nc_home_terminfo (void); extern NCURSES_EXPORT(char *) _nc_trace_buf (int, size_t); -extern NCURSES_EXPORT(chtype) _nc_background (WINDOW *); -extern NCURSES_EXPORT(chtype) _nc_render (WINDOW *, chtype); +extern NCURSES_EXPORT(NCURSES_CH_T) _nc_render (WINDOW *, NCURSES_CH_T); extern NCURSES_EXPORT(int) _nc_access (const char *, int); extern NCURSES_EXPORT(int) _nc_baudrate (int); -extern NCURSES_EXPORT(int) _nc_freewin (WINDOW *win); +extern NCURSES_EXPORT(int) _nc_freewin (WINDOW *); extern NCURSES_EXPORT(int) _nc_getenv_num (const char *); extern NCURSES_EXPORT(int) _nc_keypad (bool); extern NCURSES_EXPORT(int) _nc_ospeed (int); extern NCURSES_EXPORT(int) _nc_outch (int); extern NCURSES_EXPORT(int) _nc_setupscreen (short, short const, FILE *); extern NCURSES_EXPORT(int) _nc_timed_wait (int, int, int *); -extern NCURSES_EXPORT(int) _nc_waddch_nosync (WINDOW *, const chtype); +extern NCURSES_EXPORT(int) _nc_waddch_nosync (WINDOW *, const NCURSES_CH_T); extern NCURSES_EXPORT(void) _nc_do_color (int, int, bool, int (*)(int)); extern NCURSES_EXPORT(void) _nc_flush (void); extern NCURSES_EXPORT(void) _nc_freeall (void); @@ -763,18 +906,27 @@ extern NCURSES_EXPORT(void) _nc_make_oldhash (int i); extern NCURSES_EXPORT(void) _nc_outstr (const char *str); extern NCURSES_EXPORT(void) _nc_scroll_oldhash (int n, int top, int bot); extern NCURSES_EXPORT(void) _nc_scroll_optimize (void); -extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, short const, short const, chtype); +extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, short const, short const, NCURSES_CH_T); extern NCURSES_EXPORT(void) _nc_set_buffer (FILE *, bool); extern NCURSES_EXPORT(void) _nc_signal_handler (bool); -extern NCURSES_EXPORT(void) _nc_synchook (WINDOW *win); -extern NCURSES_EXPORT(void) _nc_trace_tries (struct tries *tree); +extern NCURSES_EXPORT(void) _nc_synchook (WINDOW *); +extern NCURSES_EXPORT(void) _nc_trace_tries (struct tries *); #if USE_SIZECHANGE extern NCURSES_EXPORT(void) _nc_update_screensize (void); #endif -#if USE_WIDEC_SUPPORT -extern NCURSES_EXPORT(int) _nc_utf8_outch (int); +#if HAVE_RESIZETERM +extern NCURSES_EXPORT(void) _nc_resize_margins (WINDOW *); +#else +#define _nc_resize_margins(wp) /* nothing */ +#endif + +/* + * Not everyone has vsscanf(), but we'd like to use it for scanw(). + */ +#if !HAVE_VSSCANF +extern int vsscanf(const char *str, const char *format, va_list __arg); #endif /* scroll indices */ @@ -805,10 +957,9 @@ extern NCURSES_EXPORT_VAR(SCREEN *) SP; #endif /* - * We don't want to use the lines or columns capabilities internally, - * because if the application is running multiple screens under - * X windows, it's quite possible they could all have type xterm - * but have different sizes! So... + * We don't want to use the lines or columns capabilities internally, because + * 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 diff --git a/contrib/ncurses/ncurses/fifo_defs.h b/contrib/ncurses/ncurses/fifo_defs.h index f4dd7be..6779957 100644 --- a/contrib/ncurses/ncurses/fifo_defs.h +++ b/contrib/ncurses/ncurses/fifo_defs.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2002 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,7 +34,7 @@ /* * Common macros for lib_getch.c, lib_ungetch.c * - * $Id: fifo_defs.h,v 1.2 1998/02/11 12:13:56 tom Exp $ + * $Id: fifo_defs.h,v 1.4 2002/03/16 20:47:50 tom Exp $ */ #ifndef FIFO_DEFS_H @@ -46,13 +46,13 @@ #define peek SP->_fifopeek #define h_inc() { head == FIFO_SIZE-1 ? head = 0 : head++; if (head == tail) head = -1, tail = 0;} -#define h_dec() { head == 0 ? head = FIFO_SIZE-1 : head--; if (head == tail) tail = -1;} +#define h_dec() { head == 0 ? head = FIFO_SIZE-1 : head--; if (head == tail) tail = -1;} #define t_inc() { tail == FIFO_SIZE-1 ? tail = 0 : tail++; if (tail == head) tail = -1;} -#define t_dec() { tail == 0 ? tail = FIFO_SIZE-1 : tail--; if (head == tail) fifo_clear();} +#define t_dec() { tail == 0 ? tail = FIFO_SIZE-1 : tail--; if (head == tail) fifo_clear();} #define p_inc() { peek == FIFO_SIZE-1 ? peek = 0 : peek++;} -#define cooked_key_in_fifo() (head!=-1 && peek!=head) -#define raw_key_in_fifo() (head!=-1 && peek!=tail) +#define cooked_key_in_fifo() ((head != -1) && (peek != head)) +#define raw_key_in_fifo() ((head != -1) && (peek != tail)) #undef HIDE_EINTR diff --git a/contrib/ncurses/ncurses/llib-lncurses b/contrib/ncurses/ncurses/llib-lncurses index 8ea89d1..1a6e5cf 100644 --- a/contrib/ncurses/ncurses/llib-lncurses +++ b/contrib/ncurses/ncurses/llib-lncurses @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2002 Free 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> 1996-2000 * + * Author: Thomas E. Dickey 1996-2001,2002 * ****************************************************************************/ /* LINTLIBRARY */ @@ -50,12 +50,6 @@ void _nc_linedump(void) #include <term.h> -typedef struct { - unsigned long hashval; - int oldcount, newcount; - int oldindex, newindex; -} sym; - #undef _nc_hash_map void _nc_hash_map(void) { /* void */ } @@ -76,11 +70,6 @@ void _nc_scroll_oldhash( #include <ctype.h> -#undef _nc_background -chtype _nc_background( - WINDOW *win) - { return(*(chtype *)0); } - #undef _nc_render chtype _nc_render( WINDOW *win, @@ -179,7 +168,7 @@ int wclear( #undef clearok int clearok( WINDOW *win, - bool flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./base/lib_clrbot.c */ @@ -225,12 +214,12 @@ int init_color( { return(*(int *)0); } #undef can_change_color -bool can_change_color(void) - { return(*(bool *)0); } +NCURSES_BOOL can_change_color(void) + { return(*(NCURSES_BOOL *)0); } #undef has_colors -bool has_colors(void) - { return(*(bool *)0); } +NCURSES_BOOL has_colors(void) + { return(*(NCURSES_BOOL *)0); } #undef color_content int color_content( @@ -251,7 +240,7 @@ int pair_content( void _nc_do_color( int old_pair, int pair, - bool reverse, + NCURSES_BOOL reverse, int (*outc)( int p1)) { /* void */ } @@ -1025,11 +1014,11 @@ int wstandend( { return(*(int *)0); } #undef mouse_trafo -bool mouse_trafo( +NCURSES_BOOL mouse_trafo( int *a1, int *a2, - bool z) - { return(*(bool *)0); } + NCURSES_BOOL z) + { return(*(NCURSES_BOOL *)0); } /* ./base/lib_getch.c */ @@ -1038,6 +1027,13 @@ bool mouse_trafo( #undef ESCDELAY int ESCDELAY; +#undef _nc_wgetch +int _nc_wgetch( + WINDOW *win, + unsigned long *result, + int use_meta) + { return(*(int *)0); } + #undef wgetch int wgetch( WINDOW *win) @@ -1066,7 +1062,7 @@ int whline( #undef immedok void immedok( WINDOW *win, - bool flag) + NCURSES_BOOL flag) { /* void */ } /* ./base/lib_inchstr.c */ @@ -1121,15 +1117,15 @@ int winnstr( /* ./base/lib_isendwin.c */ #undef isendwin -bool isendwin(void) - { return(*(bool *)0); } +NCURSES_BOOL isendwin(void) + { return(*(NCURSES_BOOL *)0); } /* ./base/lib_leaveok.c */ #undef leaveok int leaveok( WINDOW *win, - bool flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./base/lib_mouse.c */ @@ -1151,11 +1147,11 @@ mmask_t mousemask( { return(*(mmask_t *)0); } #undef wenclose -bool wenclose( +NCURSES_BOOL wenclose( const WINDOW *win, int y, int x) - { return(*(bool *)0); } + { return(*(NCURSES_BOOL *)0); } #undef mouseinterval int mouseinterval( @@ -1167,12 +1163,12 @@ int _nc_has_mouse(void) { return(*(int *)0); } #undef wmouse_trafo -bool wmouse_trafo( +NCURSES_BOOL wmouse_trafo( const WINDOW *win, int *pY, int *pX, - bool to_screen) - { return(*(bool *)0); } + NCURSES_BOOL to_screen) + { return(*(NCURSES_BOOL *)0); } /* ./base/lib_move.c */ @@ -1470,7 +1466,6 @@ int mvwscanw( /* ./base/lib_screen.c */ -#include <sys/stat.h> #include <time.h> #undef getwin @@ -1526,7 +1521,7 @@ int wscrl( #undef scrollok int scrollok( WINDOW *win, - bool flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./base/lib_scrreg.c */ @@ -1679,15 +1674,15 @@ int slk_touch(void) /* ./base/lib_touch.c */ #undef is_linetouched -bool is_linetouched( +NCURSES_BOOL is_linetouched( WINDOW *win, int line) - { return(*(bool *)0); } + { return(*(NCURSES_BOOL *)0); } #undef is_wintouched -bool is_wintouched( +NCURSES_BOOL is_wintouched( WINDOW *win) - { return(*(bool *)0); } + { return(*(NCURSES_BOOL *)0); } #undef wtouchln int wtouchln( @@ -1715,6 +1710,12 @@ 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, @@ -1753,7 +1754,7 @@ char *_tracemouse( #undef _nc_signal_handler void _nc_signal_handler( - bool enable) + NCURSES_BOOL enable) { /* void */ } /* ./base/lib_ungetch.c */ @@ -1771,14 +1772,14 @@ int ungetch( #undef vidputs int vidputs( - attr_t newmode, + chtype newmode, int (*outc)( int p1)) { return(*(int *)0); } #undef vidattr int vidattr( - attr_t newmode) + chtype newmode) { return(*(int *)0); } #undef termattrs @@ -1836,7 +1837,7 @@ int mvderwin( #undef syncok int syncok( WINDOW *win, - bool bf) + NCURSES_BOOL bf) { return(*(int *)0); } #undef wsyncup @@ -1912,6 +1913,18 @@ 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 @@ -1980,7 +1993,7 @@ char *keybound( #undef keyok int keyok( int c, - bool flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./base/lib_dft_fgbg.c */ @@ -2013,6 +2026,18 @@ int mcprint( /* ./base/resizeterm.c */ +#undef is_term_resized +NCURSES_BOOL is_term_resized( + int ToLines, + int ToCols) + { return(*(NCURSES_BOOL *)0); } + +#undef resize_term +int resize_term( + int ToLines, + int ToCols) + { return(*(int *)0); } + #undef resizeterm int resizeterm( int ToLines, @@ -2065,6 +2090,11 @@ int wresize( /* ./tinfo/access.c */ +#undef _nc_rootname +char *_nc_rootname( + char *path) + { return(*(char **)0); } + #undef _nc_basename char *_nc_basename( char *path) @@ -2109,7 +2139,7 @@ char *_nc_save_str( #undef _nc_wrap_entry void _nc_wrap_entry( ENTRY *const ep, - bool copy_strings) + NCURSES_BOOL copy_strings) { /* void */ } #undef _nc_merge_entry @@ -2172,18 +2202,18 @@ const struct alias _nc_infoalias_table[] = {0}; #undef _nc_get_table const struct name_table_entry *_nc_get_table( - bool termcap) + NCURSES_BOOL termcap) { return(*(const struct name_table_entry **)0); } #undef _nc_get_hash_table const struct name_table_entry *const *_nc_get_hash_table( - bool termcap) + NCURSES_BOOL termcap) { return(*(const struct name_table_entry **)0); } /* ./tinfo/comp_error.c */ #undef _nc_suppress_warnings -bool _nc_suppress_warnings; +NCURSES_BOOL _nc_suppress_warnings; #undef _nc_curr_line int _nc_curr_line; #undef _nc_curr_col @@ -2227,7 +2257,7 @@ void _nc_syserr_abort( #undef _nc_tic_expand char *_nc_tic_expand( const char *srcp, - bool tic_format, + NCURSES_BOOL tic_format, int numbers) { return(*(char **)0); } @@ -2264,24 +2294,24 @@ void _nc_free_entries( { /* void */ } #undef _nc_entry_match -bool _nc_entry_match( +NCURSES_BOOL _nc_entry_match( char *n1, char *n2) - { return(*(bool *)0); } + { return(*(NCURSES_BOOL *)0); } #undef _nc_read_entry_source void _nc_read_entry_source( FILE *fp, char *buf, int literal, - bool silent, - bool (*hook)( + NCURSES_BOOL silent, + NCURSES_BOOL (*hook)( ENTRY *p1)) { /* void */ } #undef _nc_resolve_uses int _nc_resolve_uses( - bool fullresolve) + NCURSES_BOOL fullresolve) { return(*(int *)0); } /* ./tinfo/comp_scan.c */ @@ -2299,11 +2329,11 @@ long _nc_start_line; #undef _nc_curr_token struct token _nc_curr_token; #undef _nc_disable_period -bool _nc_disable_period; +NCURSES_BOOL _nc_disable_period; #undef _nc_get_token int _nc_get_token( - bool silent) + NCURSES_BOOL silent) { return(*(int *)0); } #undef _nc_trans_string @@ -2351,11 +2381,11 @@ void _nc_free_termtype( { /* void */ } #undef _nc_user_definable -bool _nc_user_definable; +NCURSES_BOOL _nc_user_definable; #undef use_extended_names int use_extended_names( - bool flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./tinfo/getenv_num.c */ @@ -2449,12 +2479,12 @@ SCREEN *SP; /* ./tinfo/lib_has_cap.c */ #undef has_ic -bool has_ic(void) - { return(*(bool *)0); } +NCURSES_BOOL has_ic(void) + { return(*(NCURSES_BOOL *)0); } #undef has_il -bool has_il(void) - { return(*(bool *)0); } +NCURSES_BOOL has_il(void) + { return(*(NCURSES_BOOL *)0); } /* ./tinfo/lib_kernel.c */ @@ -2472,10 +2502,6 @@ int flushinp(void) /* ./lib_keyname.c */ -#include <stdlib.h> -#include <string.h> -#include <curses.h> - #undef _nc_key_names const struct kn _nc_key_names[] = {0}; @@ -2502,13 +2528,13 @@ int napms( #undef idlok int idlok( WINDOW *win, - bool flag) + NCURSES_BOOL flag) { return(*(int *)0); } #undef idcok void idcok( WINDOW *win, - bool flag) + NCURSES_BOOL flag) { /* void */ } #undef halfdelay @@ -2519,13 +2545,13 @@ int halfdelay( #undef nodelay int nodelay( WINDOW *win, - bool flag) + NCURSES_BOOL flag) { return(*(int *)0); } #undef notimeout int notimeout( WINDOW *win, - bool f) + NCURSES_BOOL f) { return(*(int *)0); } #undef wtimeout @@ -2537,13 +2563,13 @@ void wtimeout( #undef keypad int keypad( WINDOW *win, - bool flag) + NCURSES_BOOL flag) { return(*(int *)0); } #undef meta int meta( WINDOW *win, - bool flag) + NCURSES_BOOL flag) { return(*(int *)0); } #undef curs_set @@ -2563,7 +2589,7 @@ int has_key( #undef _nc_keypad int _nc_keypad( - bool flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./tinfo/lib_raw.c */ @@ -2595,7 +2621,7 @@ void noqiflush(void) #undef intrflush int intrflush( WINDOW *win, - bool flag) + NCURSES_BOOL flag) { return(*(int *)0); } /* ./tinfo/lib_setup.c */ @@ -2604,7 +2630,7 @@ int intrflush( #undef use_env void use_env( - bool f) + NCURSES_BOOL f) { /* void */ } #undef LINES @@ -2702,9 +2728,12 @@ typedef struct { unsigned int num; char *str; } data; - bool num_type; + NCURSES_BOOL num_type; } stack_frame; +#undef _nc_tparm_err +int _nc_tparm_err; + #undef tparm char *tparm( char *string, @@ -2761,17 +2790,6 @@ void trace( const unsigned int tracelevel) { /* void */ } -#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 _tracef void _tracef( const char *fmt, @@ -2788,6 +2806,11 @@ char *_nc_retrace_ptr( char *code) { return(*(char **)0); } +#undef _nc_retrace_sp +SCREEN *_nc_retrace_sp( + SCREEN *code) + { return(*(SCREEN **)0); } + #undef _nc_retrace_win WINDOW *_nc_retrace_win( WINDOW *code) @@ -2808,7 +2831,7 @@ char *_nc_tracebits(void) #undef _tracechar char *_tracechar( - const unsigned char ch) + int ch) { return(*(char **)0); } /* ./tinfo/lib_ttyflags.c */ @@ -2891,7 +2914,7 @@ char *const strfnames[] = {0}; int _nc_parse_entry( struct entry *entryp, int literal, - bool silent) + NCURSES_BOOL silent) { return(*(int *)0); } #undef _nc_capcmp @@ -2932,10 +2955,6 @@ int _nc_read_entry( /* ./tinfo/read_termcap.c */ -#undef _nc_read_termcap -void _nc_read_termcap(void) - { /* void */ } - #undef _nc_read_termcap_entry int _nc_read_termcap_entry( const char *const tn, @@ -2947,7 +2966,7 @@ int _nc_read_termcap_entry( #undef _nc_set_buffer void _nc_set_buffer( FILE *ofp, - bool buffered) + NCURSES_BOOL buffered) { /* void */ } /* ./tinfo/strings.c */ @@ -2972,16 +2991,16 @@ string_desc *_nc_str_copy( { return(*(string_desc **)0); } #undef _nc_safe_strcat -bool _nc_safe_strcat( +NCURSES_BOOL _nc_safe_strcat( string_desc *dst, const char *src) - { return(*(bool *)0); } + { return(*(NCURSES_BOOL *)0); } #undef _nc_safe_strcpy -bool _nc_safe_strcpy( +NCURSES_BOOL _nc_safe_strcpy( string_desc *dst, const char *src) - { return(*(bool *)0); } + { return(*(NCURSES_BOOL *)0); } /* ./trace/trace_buf.c */ @@ -3010,6 +3029,19 @@ 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); } + /* ./tinfo/write_entry.c */ #undef _nc_set_writedir diff --git a/contrib/ncurses/ncurses/llib-lncursesw b/contrib/ncurses/ncurses/llib-lncursesw new file mode 100644 index 0000000..ffb0af6 --- /dev/null +++ b/contrib/ncurses/ncurses/llib-lncursesw @@ -0,0 +1,3756 @@ +/**************************************************************************** + * Copyright (c) 2001,2002 Free 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 2001,2002 * + ****************************************************************************/ +/* LINTLIBRARY */ + +/* ./tty/hardscroll.c */ + +#include <curses.priv.h> + +#undef _nc_oldnums +int *_nc_oldnums; + +#undef _nc_scroll_optimize +void _nc_scroll_optimize(void) + { /* void */ } + +#undef _nc_linedump +void _nc_linedump(void) + { /* void */ } + +/* ./tty/hashmap.c */ + +#include <term.h> + +#undef _nc_hash_map +void _nc_hash_map(void) + { /* void */ } + +#undef _nc_make_oldhash +void _nc_make_oldhash( + int i) + { /* 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_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); } + +#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); } + +/* ./base/lib_addstr.c */ + +#undef waddnstr +int waddnstr( + WINDOW *win, + const char *const astr, + int n) + { return(*(int *)0); } + +#undef waddchnstr +int waddchnstr( + WINDOW *win, + const chtype *const 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 *const 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 +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, + const 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 COLOR_PAIRS +int COLOR_PAIRS; +#undef COLORS +int COLORS; + +#undef start_color +int start_color(void) + { return(*(int *)0); } + +#undef init_pair +int init_pair( + short pair, + short f, + 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 +NCURSES_BOOL can_change_color(void) + { return(*(NCURSES_BOOL *)0); } + +#undef has_colors +NCURSES_BOOL has_colors(void) + { return(*(NCURSES_BOOL *)0); } + +#undef color_content +int color_content( + short color, + short *r, + short *g, + short *b) + { return(*(int *)0); } + +#undef pair_content +int pair_content( + short pair, + short *f, + short *b) + { return(*(int *)0); } + +#undef _nc_do_color +void _nc_do_color( + int old_pair, + int pair, + NCURSES_BOOL reverse, + int (*outc)( + int p1)) + { /* 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 +int echo(void) + { return(*(int *)0); } + +#undef noecho +int noecho(void) + { return(*(int *)0); } + +/* ./base/lib_endwin.c */ + +#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 +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 vid_attr +int vid_attr( + attr_t a1, + short a2, + void *z) + { return(*(int *)0); } + +#undef vline +int vline( + chtype a1, + int z) + { return(*(int *)0); } + +#undef vw_printw +int vw_printw( + WINDOW *a1, + 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 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 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 ESCDELAY +int ESCDELAY; + +#undef _nc_wgetch +int _nc_wgetch( + WINDOW *win, + unsigned long *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 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_insstr.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 +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 +int getmouse( + MEVENT *aevent) + { return(*(int *)0); } + +#undef ungetmouse +int ungetmouse( + MEVENT *aevent) + { return(*(int *)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 +int mouseinterval( + int maxclick) + { return(*(int *)0); } + +#undef _nc_has_mouse +int _nc_has_mouse(void) + { return(*(int *)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 +int _nc_msec_cost( + const char *const cap, + int affcnt) + { return(*(int *)0); } + +#undef _nc_mvcur_resume +void _nc_mvcur_resume(void) + { /* void */ } + +#undef _nc_mvcur_init +void _nc_mvcur_init(void) + { /* void */ } + +#undef _nc_mvcur_wrap +void _nc_mvcur_wrap(void) + { /* void */ } + +#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 +void filter(void) + { /* void */ } + +#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 +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 +WINDOW *_nc_makenew( + int num_lines, + int num_columns, + int begy, + int begx, + int flags) + { return(*(WINDOW **)0); } + +/* ./base/lib_nl.c */ + +#undef nl +int nl(void) + { 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 +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( + char *fmt, + ...) + { return(*(int *)0); } + +#undef wprintw +int wprintw( + WINDOW *win, + char *fmt, + ...) + { return(*(int *)0); } + +#undef mvprintw +int mvprintw( + int y, + int x, + char *fmt, + ...) + { return(*(int *)0); } + +#undef mvwprintw +int mvwprintw( + WINDOW *win, + int y, + int x, + char *fmt, + ...) + { return(*(int *)0); } + +#undef vwprintw +int vwprintw( + WINDOW *win, + 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 +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 */ + +#include <time.h> + +#undef getwin +WINDOW *getwin( + FILE *filep) + { return(*(WINDOW **)0); } + +#undef putwin +int putwin( + WINDOW *win, + FILE *filep) + { 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 +int scr_init( + 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, + short const top, + short 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 +int _nc_setupscreen( + short slines, + short const scolumns, + FILE *output) + { return(*(int *)0); } + +#undef _nc_ripoffline +int _nc_ripoffline( + 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_slk_format +int _nc_slk_format; + +#undef _nc_slk_initialize +int _nc_slk_initialize( + WINDOW *stwin, + int cols) + { return(*(int *)0); } + +#undef slk_restore +int slk_restore(void) + { return(*(int *)0); } + +/* ./base/lib_slkatr_set.c */ + +#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 +int slk_attroff( + const chtype attr) + { return(*(int *)0); } + +/* ./base/lib_slkatron.c */ + +#undef slk_attron +int slk_attron( + const chtype attr) + { return(*(int *)0); } + +/* ./base/lib_slkatrset.c */ + +#undef slk_attrset +int slk_attrset( + const chtype attr) + { return(*(int *)0); } + +/* ./base/lib_slkattr.c */ + +#undef slk_attr +attr_t slk_attr(void) + { return(*(attr_t *)0); } + +/* ./base/lib_slkclear.c */ + +#undef slk_clear +int slk_clear(void) + { return(*(int *)0); } + +/* ./base/lib_slkcolor.c */ + +#undef slk_color +int slk_color( + short color_pair_number) + { return(*(int *)0); } + +/* ./base/lib_slkinit.c */ + +#undef slk_init +int slk_init( + int format) + { return(*(int *)0); } + +/* ./base/lib_slklab.c */ + +#undef slk_label +char *slk_label( + int n) + { return(*(char **)0); } + +/* ./base/lib_slkrefr.c */ + +#undef slk_noutrefresh +int slk_noutrefresh(void) + { return(*(int *)0); } + +#undef slk_refresh +int slk_refresh(void) + { return(*(int *)0); } + +/* ./base/lib_slkset.c */ + +#undef slk_set +int slk_set( + int i, + const char *astr, + int format) + { return(*(int *)0); } + +/* ./base/lib_slktouch.c */ + +#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_traceatr.c */ + +#undef _traceattr2 +char *_traceattr2( + int bufnum, + attr_t newmode) + { return(*(char **)0); } + +#undef _traceattr +char *_traceattr( + attr_t newmode) + { return(*(char **)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 +attr_t _nc_retrace_chtype( + attr_t code) + { return(*(attr_t *)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_tracedmp.c */ + +#undef _tracedump +void _tracedump( + const char *name, + WINDOW *win) + { /* void */ } + +/* ./trace/lib_tracemse.c */ + +#undef _tracemouse +char *_tracemouse( + MEVENT const *ep) + { return(*(char **)0); } + +/* ./tty/lib_tstp.c */ + +#include <signal.h> +#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(void) + { /* void */ } + +#undef ungetch +int ungetch( + int ch) + { return(*(int *)0); } + +/* ./tty/lib_vidattr.c */ + +#undef vidputs +int vidputs( + chtype newmode, + int (*outc)( + int p1)) + { return(*(int *)0); } + +#undef vidattr +int vidattr( + chtype newmode) + { return(*(int *)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 +struct panelhook *_nc_panelhook(void) + { return(*(struct panelhook **)0); } + +/* ./base/safe_sprintf.c */ + +#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 +int doupdate(void) + { return(*(int *)0); } + +#undef _nc_outstr +void _nc_outstr( + const char *str) + { /* void */ } + +#undef _nc_scrolln +int _nc_scrolln( + int n, + int top, + int bot, + int maxy) + { return(*(int *)0); } + +#undef _nc_screen_resume +void _nc_screen_resume(void) + { /* void */ } + +#undef _nc_screen_init +void _nc_screen_init(void) + { /* void */ } + +#undef _nc_screen_wrap +void _nc_screen_wrap(void) + { /* 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/sigaction.c */ + +#undef _nc_sigaction +void _nc_sigaction(void) + { /* void */ } + +/* ./base/vsscanf.c */ + +#undef _nc_vsscanf +void _nc_vsscanf(void) + { /* void */ } + +/* ./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_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_nwstr.c */ + +#undef wins_nwstr +int wins_nwstr( + WINDOW *win, + const wchar_t *wstr, + int n) + { return(*(int *)0); } + +/* ./widechar/lib_ins_wch.c */ + +#undef wins_wch +int wins_wch( + WINDOW *win, + const cchar_t *wch) + { 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_unget_wch.c */ + +#undef unget_wch +int unget_wch( + const wchar_t wch) + { return(*(int *)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 +wchar_t *wunctrl( + cchar_t *wc) + { return(*(wchar_t **)0); } + +/* ./base/define_key.c */ + +#undef define_key +int define_key( + char *str, + int keycode) + { return(*(int *)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 +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( + chtype c) + { /* void */ } + +/* ./base/keybound.c */ + +#undef keybound +char *keybound( + int code, + int count) + { return(*(char **)0); } + +/* ./base/keyok.c */ + +#undef keyok +int keyok( + int c, + NCURSES_BOOL flag) + { return(*(int *)0); } + +/* ./base/lib_dft_fgbg.c */ + +#undef use_default_colors +int use_default_colors(void) + { return(*(int *)0); } + +#undef assume_default_colors +int assume_default_colors( + int fg, + int bg) + { return(*(int *)0); } + +/* ./base/lib_freeall.c */ + +#include <term_entry.h> + +#undef _nc_freeall +void _nc_freeall(void) + { /* void */ } + +/* ./tinfo/lib_print.c */ + +#undef mcprint +int mcprint( + char *data, + int len) + { return(*(int *)0); } + +/* ./base/resizeterm.c */ + +#undef is_term_resized +NCURSES_BOOL is_term_resized( + int ToLines, + int ToCols) + { return(*(NCURSES_BOOL *)0); } + +#undef resize_term +int resize_term( + 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 */ } + +/* ./base/tries.c */ + +#undef _nc_expand_try +char *_nc_expand_try( + struct tries *tree, + unsigned short code, + int *count, + size_t len) + { return(*(char **)0); } + +#undef _nc_remove_key +int _nc_remove_key( + struct tries **tree, + unsigned short code) + { return(*(int *)0); } + +#undef _nc_remove_string +int _nc_remove_string( + struct tries **tree, + char *string) + { return(*(int *)0); } + +/* ./base/version.c */ + +#undef curses_version +const char *curses_version(void) + { return(*(const char **)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_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_env_access +int _nc_env_access(void) + { return(*(int *)0); } + +/* ./tinfo/add_tries.c */ + +#undef _nc_add_to_try +void _nc_add_to_try( + struct tries **tree, + const char *str, + unsigned short code) + { /* void */ } + +/* ./tinfo/alloc_entry.c */ + +#undef _nc_init_entry +void _nc_init_entry( + TERMTYPE *const tp) + { /* void */ } + +#undef _nc_copy_entry +ENTRY *_nc_copy_entry( + ENTRY *oldp) + { return(*(ENTRY **)0); } + +#undef _nc_save_str +char *_nc_save_str( + const char *const string) + { return(*(char **)0); } + +#undef _nc_wrap_entry +void _nc_wrap_entry( + ENTRY *const ep, + NCURSES_BOOL copy_strings) + { /* void */ } + +#undef _nc_merge_entry +void _nc_merge_entry( + TERMTYPE *const to, + TERMTYPE *const from) + { /* void */ } + +/* ./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 */ } + +/* ./tinfo/captoinfo.c */ + +#undef _nc_captoinfo +char *_nc_captoinfo( + const char *cap, + const char *s, + int const parametrized) + { return(*(char **)0); } + +#undef _nc_infotocap +char *_nc_infotocap( + const char *cap, + const char *str, + int const parametrized) + { return(*(char **)0); } + +/* ./codes.c */ + +#undef boolcodes +char *const boolcodes[] = {0}; +#undef numcodes +char *const numcodes[] = {0}; +#undef strcodes +char *const strcodes[] = {0}; + +/* ./comp_captab.c */ + +#include <ncurses_cfg.h> + +#undef _nc_info_hash_table +const struct name_table_entry *const _nc_info_hash_table[995] = {0}; +#undef _nc_cap_hash_table +const struct name_table_entry *const _nc_cap_hash_table[995] = {0}; +#undef _nc_capalias_table +const struct alias _nc_capalias_table[] = {0}; +#undef _nc_infoalias_table +const struct alias _nc_infoalias_table[] = {0}; + +#undef _nc_get_table +const struct name_table_entry *_nc_get_table( + NCURSES_BOOL termcap) + { return(*(const struct name_table_entry **)0); } + +#undef _nc_get_hash_table +const struct name_table_entry *const *_nc_get_hash_table( + NCURSES_BOOL termcap) + { return(*(const struct name_table_entry **)0); } + +/* ./tinfo/comp_error.c */ + +#undef _nc_suppress_warnings +NCURSES_BOOL _nc_suppress_warnings; +#undef _nc_curr_line +int _nc_curr_line; +#undef _nc_curr_col +int _nc_curr_col; + +#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_expand.c */ + +#undef _nc_tic_expand +char *_nc_tic_expand( + const char *srcp, + NCURSES_BOOL tic_format, + int numbers) + { return(*(char **)0); } + +/* ./tinfo/comp_hash.c */ + +#include <hashsize.h> + +#undef _nc_find_entry +struct name_table_entry const *_nc_find_entry( + const char *string, + const struct name_table_entry *const *hash_table) + { return(*(struct name_table_entry const **)0); } + +#undef _nc_find_type_entry +struct name_table_entry const *_nc_find_type_entry( + const char *string, + int type, + const struct name_table_entry *table) + { return(*(struct name_table_entry const **)0); } + +/* ./tinfo/comp_parse.c */ + +#undef _nc_check_termtype +void (*_nc_check_termtype)( + TERMTYPE *p1); +#undef _nc_head +ENTRY *_nc_head; +#undef _nc_tail +ENTRY *_nc_tail; + +#undef _nc_free_entries +void _nc_free_entries( + ENTRY *headp) + { /* void */ } + +#undef _nc_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_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_get_token +int _nc_get_token( + NCURSES_BOOL silent) + { return(*(int *)0); } + +#undef _nc_trans_string +char _nc_trans_string( + char *ptr, + char *last) + { return(*(char *)0); } + +#undef _nc_push_token +void _nc_push_token( + int tokclass) + { /* void */ } + +#undef _nc_panic_mode +void _nc_panic_mode( + char ch) + { /* void */ } + +#undef _nc_reset_input +void _nc_reset_input( + FILE *fp, + char *buf) + { /* void */ } + +/* ./tinfo/doalloc.c */ + +#undef _nc_doalloc +void *_nc_doalloc( + void *oldp, + size_t amount) + { return(*(void **)0); } + +/* ./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 +struct tinfo_fkeys _nc_tinfo_fkeys[]; + +#endif + +#undef _nc_init_keytry +void _nc_init_keytry(void) + { /* void */ } + +/* ./tinfo/lib_acs.c */ + +#undef acs_map +chtype acs_map[128 ]; + +#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 +int baudrate(void) + { return(*(int *)0); } + +/* ./tinfo/lib_cur_term.c */ + +#undef cur_term +TERMINAL *cur_term; + +#undef set_curterm +TERMINAL *set_curterm( + TERMINAL *termp) + { return(*(TERMINAL **)0); } + +#undef del_curterm +int del_curterm( + TERMINAL *termp) + { return(*(int *)0); } + +/* ./tinfo/lib_data.c */ + +#undef stdscr +WINDOW *stdscr; +#undef curscr +WINDOW *curscr; +#undef newscr +WINDOW *newscr; +#undef _nc_screen_chain +SCREEN *_nc_screen_chain; +#undef SP +SCREEN *SP; + +/* ./tinfo/lib_has_cap.c */ + +#undef has_ic +NCURSES_BOOL has_ic(void) + { return(*(NCURSES_BOOL *)0); } + +#undef has_il +NCURSES_BOOL has_il(void) + { return(*(NCURSES_BOOL *)0); } + +/* ./tinfo/lib_kernel.c */ + +#undef erasechar +char erasechar(void) + { return(*(char *)0); } + +#undef killchar +char killchar(void) + { return(*(char *)0); } + +#undef flushinp +int flushinp(void) + { return(*(int *)0); } + +/* ./lib_keyname.c */ + +#undef _nc_key_names +const struct kn _nc_key_names[] = {0}; + +#undef keyname +char *keyname( + int c) + { return(*(char **)0); } + +#undef key_name +char *key_name( + wchar_t c) + { return(*(char **)0); } + +/* ./tinfo/lib_longname.c */ + +#undef longname +char *longname(void) + { return(*(char **)0); } + +/* ./tinfo/lib_napms.c */ + +#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 +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 +int curs_set( + int vis) + { return(*(int *)0); } + +#undef typeahead +int typeahead( + int fd) + { return(*(int *)0); } + +#undef has_key +int has_key( + int keycode) + { return(*(int *)0); } + +#undef _nc_keypad +int _nc_keypad( + NCURSES_BOOL flag) + { return(*(int *)0); } + +/* ./tinfo/lib_raw.c */ + +#undef raw +int raw(void) + { return(*(int *)0); } + +#undef cbreak +int cbreak(void) + { return(*(int *)0); } + +#undef qiflush +void qiflush(void) + { /* void */ } + +#undef noraw +int noraw(void) + { return(*(int *)0); } + +#undef nocbreak +int nocbreak(void) + { return(*(int *)0); } + +#undef noqiflush +void noqiflush(void) + { /* void */ } + +#undef intrflush +int intrflush( + WINDOW *win, + NCURSES_BOOL flag) + { return(*(int *)0); } + +/* ./tinfo/lib_setup.c */ + +#include <sys/ioctl.h> + +#undef use_env +void use_env( + NCURSES_BOOL f) + { /* void */ } + +#undef LINES +int LINES; +#undef COLS +int COLS; +#undef TABSIZE +int TABSIZE; + +#undef _nc_update_screensize +void _nc_update_screensize(void) + { /* void */ } + +#undef ttytype +char ttytype[256 ]; + +#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 +int tgetent( + char *bufp, + const char *name) + { return(*(int *)0); } + +#if 0 + +#include <capdefaults.c> + +#endif + +#undef tgetflag +int tgetflag( + char *id) + { return(*(int *)0); } + +#undef tgetnum +int tgetnum( + char *id) + { return(*(int *)0); } + +#undef tgetstr +char *tgetstr( + char *id, + char **area) + { return(*(char **)0); } + +/* ./tinfo/lib_termname.c */ + +#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 +int tigetflag( + char *str) + { return(*(int *)0); } + +#undef tigetnum +int tigetnum( + char *str) + { return(*(int *)0); } + +#undef tigetstr +char *tigetstr( + char *str) + { return(*(char **)0); } + +/* ./tinfo/lib_tparm.c */ + +typedef struct { + union { + unsigned int num; + char *str; + } data; + NCURSES_BOOL num_type; +} stack_frame; + +#undef _nc_tparm_err +int _nc_tparm_err; + +#undef tparm +char *tparm( + char *string, + ...) + { return(*(char **)0); } + +/* ./tinfo/lib_tputs.c */ + +#undef PC +char PC; +#undef ospeed +short ospeed; +#undef _nc_nulls_sent +int _nc_nulls_sent; + +#undef delay_output +int delay_output( + int ms) + { return(*(int *)0); } + +#undef _nc_flush +void _nc_flush(void) + { /* void */ } + +#undef _nc_outch +int _nc_outch( + int ch) + { return(*(int *)0); } + +#undef putp +int putp( + const char *string) + { 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_tputs_trace +const char *_nc_tputs_trace = {0}; +#undef _nc_outchars +long _nc_outchars; + +#undef trace +void trace( + const unsigned int tracelevel) + { /* void */ } + +#undef _tracef +void _tracef( + const char *fmt, + ...) + { /* void */ } + +#undef _nc_retrace_int +int _nc_retrace_int( + int code) + { return(*(int *)0); } + +#undef _nc_retrace_ptr +char *_nc_retrace_ptr( + char *code) + { return(*(char **)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); } + +/* ./trace/lib_tracebits.c */ + +typedef struct { + unsigned int val; + const char *name; +} BITNAMES; + +#undef _nc_tracebits +char *_nc_tracebits(void) + { return(*(char **)0); } + +/* ./trace/lib_tracechr.c */ + +#undef _tracechar +char *_tracechar( + int ch) + { return(*(char **)0); } + +/* ./tinfo/lib_ttyflags.c */ + +#undef _nc_get_tty_mode +int _nc_get_tty_mode( + 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 +int def_shell_mode(void) + { return(*(int *)0); } + +#undef def_prog_mode +int def_prog_mode(void) + { return(*(int *)0); } + +#undef reset_prog_mode +int reset_prog_mode(void) + { return(*(int *)0); } + +#undef reset_shell_mode +int reset_shell_mode(void) + { return(*(int *)0); } + +#undef savetty +int savetty(void) + { return(*(int *)0); } + +#undef resetty +int resetty(void) + { return(*(int *)0); } + +/* ./tty/lib_twait.c */ + +#undef _nc_timed_wait +int _nc_timed_wait( + 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 boolnames +char *const boolnames[] = {0}; +#undef boolfnames +char *const boolfnames[] = {0}; +#undef numnames +char *const numnames[] = {0}; +#undef numfnames +char *const numfnames[] = {0}; +#undef strnames +char *const strnames[] = {0}; +#undef strfnames +char *const strfnames[] = {0}; + +/* ./tinfo/parse_entry.c */ + +#undef _nc_parse_entry +int _nc_parse_entry( + struct entry *entryp, + int literal, + NCURSES_BOOL silent) + { return(*(int *)0); } + +#undef _nc_capcmp +int _nc_capcmp( + const char *s, + const char *t) + { return(*(int *)0); } + +typedef struct { + const char *from; + const char *to; +} assoc; + +/* ./tinfo/read_entry.c */ + +#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_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 tn, + char *const filename, + TERMTYPE *const tp) + { return(*(int *)0); } + +/* ./tinfo/read_termcap.c */ + +#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 +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 */ + +typedef struct { + char *text; + size_t size; +} LIST; + +#undef _nc_trace_buf +char *_nc_trace_buf( + int bufnum, + size_t want) + { return(*(char **)0); } + +/* ./trace/trace_tries.c */ + +#undef _nc_trace_tries +void _nc_trace_tries( + struct tries *tree) + { /* void */ } + +/* ./unctrl.c */ + +#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_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_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/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); } diff --git a/contrib/ncurses/ncurses/modules b/contrib/ncurses/ncurses/modules index eb84a07..541df6f 100644 --- a/contrib/ncurses/ncurses/modules +++ b/contrib/ncurses/ncurses/modules @@ -1,6 +1,6 @@ -# $Id: modules,v 1.74 2000/10/03 08:51:18 tom Exp $ +# $Id: modules,v 1.90 2002/05/11 20:14:41 tom Exp $ ############################################################################## -# Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. # +# Copyright (c) 1998-2001,2002 Free 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,7 +27,7 @@ # authorization. # ############################################################################## # -# Author: Thomas E. Dickey <dickey@clark.net> 1996-1998 +# Author: Thomas E. Dickey <dickey@clark.net> 1996-1998, etc. # @ base @@ -109,15 +109,36 @@ 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) # Modules for porting memmove lib $(base) sigaction lib $(base) vsscanf lib $(base) +# XSI extensions to the base library (wide-character) +@ widechar +lib_box_set lib $(wide) +lib_cchar lib $(wide) +lib_get_wch lib $(wide) +lib_erasewchar lib $(wide) +lib_get_wstr lib $(wide) +lib_hline_set lib $(wide) +lib_in_wch lib $(wide) +lib_in_wchnstr lib $(wide) +lib_ins_nwstr lib $(wide) +lib_ins_wch lib $(wide) +lib_inwstr 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) + # Extensions to the base library @ ext_funcs define_key lib $(base) @@ -186,4 +207,5 @@ strings lib $(tinfo) trace_buf lib $(trace) trace_tries lib $(trace) unctrl lib . +visbuf lib $(trace) $(INCDIR)/tic.h write_entry lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h diff --git a/contrib/ncurses/ncurses/tinfo/MKfallback.sh b/contrib/ncurses/ncurses/tinfo/MKfallback.sh index de3e23a..d1abcd2 100755 --- a/contrib/ncurses/ncurses/tinfo/MKfallback.sh +++ b/contrib/ncurses/ncurses/tinfo/MKfallback.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: MKfallback.sh,v 1.10 2000/12/10 00:14:39 tom Exp $ +# $Id: MKfallback.sh,v 1.11 2001/12/02 01:55:30 tom Exp $ # # MKfallback.sh -- create fallback table for entry reads # @@ -8,6 +8,28 @@ # from an on-disk terminfo tree) tries to match the type with one of a # specified list of types generated in. # + +terminfo_dir=$1 +shift + +terminfo_src=$1 +shift + +if test $# != 0 ; then + tmp_info=tmp_info + echo creating temporary terminfo directory... >&2 + + TERMINFO=`pwd`/$tmp_info + export TERMINFO + + TERMINFO_DIRS=$TERMINFO:$terminfo_dir + export TERMINFO_DIRS + + tic $terminfo_src >&2 +else + tmp_info= +fi + cat <<EOF /* * DO NOT EDIT THIS FILE BY HAND! It is generated by MKfallback.sh. @@ -73,3 +95,8 @@ cat <<EOF return((TERMTYPE *)0); } EOF + +if test -n "$tmp_info" ; then + echo removing temporary terminfo directory... >&2 + rm -rf $tmp_info +fi diff --git a/contrib/ncurses/ncurses/tinfo/MKkeys_list.sh b/contrib/ncurses/ncurses/tinfo/MKkeys_list.sh new file mode 100755 index 0000000..98d5b13 --- /dev/null +++ b/contrib/ncurses/ncurses/tinfo/MKkeys_list.sh @@ -0,0 +1,62 @@ +#! /bin/sh +# $Id: MKkeys_list.sh,v 1.2 2001/06/16 16:50:35 tom Exp $ +############################################################################## +# Copyright (c) 2001 Free 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. # +############################################################################## +# +# MKkey_defs.sh -- generate list of function-keys for terminfo database +# +# Author: Thomas E. Dickey <dickey@herndon4.his.com> 2001 +# +# Extract function-key names from the Caps file +# +: ${AWK-awk} +DATA=${1-../../include/Caps} + +data=data$$ +trap 'rm -f $data' 0 1 2 5 15 +sed -e 's/[ ]\+/ /g' < $DATA >$data + +cat <<EOF +# These definitions were generated by $0 $DATA +KEY_BREAK +KEY_SRESET +KEY_RESET +KEY_RESIZE +EOF + +${AWK-awk} <$data ' +/^#/ {next;} +/^capalias/ {next;} +/^infoalias/ {next;} + +$5 != "-" { + if (substr($5, 1, 4) == "KEY_" ) { + printf "%s %s\n", $5, $1 + } +} +' diff --git a/contrib/ncurses/ncurses/tinfo/access.c b/contrib/ncurses/ncurses/tinfo/access.c index c8071d8..f5240c1 100644 --- a/contrib/ncurses/ncurses/tinfo/access.c +++ b/contrib/ncurses/ncurses/tinfo/access.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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,13 +27,42 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey <dickey@clark.net> 1998,2000 * + * Author: Thomas E. Dickey <dickey@clark.net> 1998,2000,2001 * ****************************************************************************/ #include <curses.priv.h> #include <tic.h> +#include <nc_alloc.h> -MODULE_ID("$Id: access.c,v 1.7 2000/12/10 02:55:07 tom Exp $") +MODULE_ID("$Id: access.c,v 1.9 2001/06/23 22:11:49 tom Exp $") + +#define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c)) + +NCURSES_EXPORT(char *) +_nc_rootname(char *path) +{ + char *result = _nc_basename(path); +#if !defined(MIXEDCASE_FILENAMES) || defined(PROG_EXT) + static char *temp; + char *s; + + temp = strdup(result); + result = temp; +#if !defined(MIXEDCASE_FILENAMES) + int n; + for (s = result; *s != '\0'; ++s) { + *s = LOWERCASE(*s); + } +#endif +#if defined(PROG_EXT) + if ((s = strrchr(result, '.')) != 0) { + if (!strcmp(s, PROG_EXT)) + *s = '\0'; + } +#endif +#endif + return result; +} NCURSES_EXPORT(char *) _nc_basename(char *path) diff --git a/contrib/ncurses/ncurses/tinfo/alloc_entry.c b/contrib/ncurses/ncurses/tinfo/alloc_entry.c index e668e36..5c064cf 100644 --- a/contrib/ncurses/ncurses/tinfo/alloc_entry.c +++ b/contrib/ncurses/ncurses/tinfo/alloc_entry.c @@ -47,14 +47,14 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$Id: alloc_entry.c,v 1.35 2001/01/13 22:40:17 tom Exp $") +MODULE_ID("$Id: alloc_entry.c,v 1.36 2001/09/22 21:10:26 tom Exp $") #define ABSENT_OFFSET -1 #define CANCELLED_OFFSET -2 #define MAX_STRTAB 4096 /* documented maximum entry size */ -static char stringbuf[MAX_STRTAB]; /* buffer for string capabilities */ +static char *stringbuf; /* buffer for string capabilities */ static size_t next_free; /* next free character in stringbuf */ NCURSES_EXPORT(void) @@ -63,6 +63,9 @@ _nc_init_entry(TERMTYPE * const tp) { int i; + if (stringbuf == 0) + stringbuf = malloc(MAX_STRTAB); + #if NCURSES_XNAMES tp->num_Booleans = BOOLCOUNT; tp->num_Numbers = NUMCOUNT; diff --git a/contrib/ncurses/ncurses/tinfo/captoinfo.c b/contrib/ncurses/ncurses/tinfo/captoinfo.c index 9b68cd2..bf3116a 100644 --- a/contrib/ncurses/ncurses/tinfo/captoinfo.c +++ b/contrib/ncurses/ncurses/tinfo/captoinfo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -92,7 +92,7 @@ #include <ctype.h> #include <tic.h> -MODULE_ID("$Id: captoinfo.c,v 1.40 2000/11/05 00:22:36 tom Exp $") +MODULE_ID("$Id: captoinfo.c,v 1.41 2001/06/02 22:50:31 skimo Exp $") #define MAX_PUSHED 16 /* max # args we can push onto the stack */ @@ -194,7 +194,7 @@ cvtchar(register const char *sp) case '2': case '3': len = 1; - while (isdigit(CharOf(*sp))) { + while (isdigit(UChar(*sp))) { c = 8 * c + (*sp++ - '0'); len++; } @@ -294,9 +294,9 @@ _nc_captoinfo(const char *cap, const char *s, int const parametrized) capstart = 0; if (s == 0) s = ""; - if (parametrized >= 0 && isdigit(CharOf(*s))) + if (parametrized >= 0 && isdigit(UChar(*s))) for (capstart = s;; s++) - if (!(isdigit(CharOf(*s)) || *s == '*' || *s == '.')) + if (!(isdigit(UChar(*s)) || *s == '*' || *s == '.')) break; while (*s != '\0') { @@ -464,7 +464,7 @@ _nc_captoinfo(const char *cap, const char *s, int const parametrized) dp = save_char(dp, '%'); s--; _nc_warning("unknown %% code %s (%#x) in %s", - unctrl((chtype) * s), CharOf(*s), cap); + unctrl((chtype) * s), UChar(*s), cap); break; } break; @@ -545,7 +545,7 @@ _nc_captoinfo(const char *cap, const char *s, int const parametrized) if (capstart) { dp = save_string(dp, "$<"); for (s = capstart;; s++) - if (isdigit(CharOf(*s)) || *s == '*' || *s == '.') + if (isdigit(UChar(*s)) || *s == '*' || *s == '.') dp = save_char(dp, *s); else break; @@ -569,8 +569,8 @@ bcd_expression(const char *str) char ch1, ch2; if (sscanf(str, fmt, &ch1, &ch2) == 2 - && isdigit(CharOf(ch1)) - && isdigit(CharOf(ch2)) + && isdigit(UChar(ch1)) + && isdigit(UChar(ch2)) && (ch1 == ch2)) { len = 28; #ifndef NDEBUG @@ -651,13 +651,13 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parametrize padding = str + strlen(str) - 1; if (*padding == '>' && *--padding == '/') { --padding; - while (isdigit(CharOf(*padding)) || *padding == '.' || *padding == '*') + while (isdigit(UChar(*padding)) || *padding == '.' || *padding == '*') padding--; if (*padding == '<' && *--padding == '$') trimmed = padding; padding += 2; - while (isdigit(CharOf(*padding)) || *padding == '.' || *padding == '*') + while (isdigit(UChar(*padding)) || *padding == '.' || *padding == '*') bufptr = save_char(bufptr, *padding++); } @@ -669,7 +669,7 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parametrize bufptr = save_char(bufptr, *++str); } else if (str[0] == '$' && str[1] == '<') { /* discard padding */ str += 2; - while (isdigit(CharOf(*str)) + while (isdigit(UChar(*str)) || *str == '.' || *str == '*' || *str == '/' @@ -737,7 +737,7 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parametrize case '8': case '9': bufptr = save_char(bufptr, '%'); - while (isdigit(CharOf(*str))) + while (isdigit(UChar(*str))) bufptr = save_char(bufptr, *str++); if (strchr("doxX.", *str)) { if (*str != 'd') /* termcap doesn't have octal, hex */ diff --git a/contrib/ncurses/ncurses/tinfo/comp_error.c b/contrib/ncurses/ncurses/tinfo/comp_error.c index a39de81..e67cb79 100644 --- a/contrib/ncurses/ncurses/tinfo/comp_error.c +++ b/contrib/ncurses/ncurses/tinfo/comp_error.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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,14 @@ #include <tic.h> -MODULE_ID("$Id: comp_error.c,v 1.21 2000/12/10 02:55:07 tom Exp $") +MODULE_ID("$Id: comp_error.c,v 1.23 2001/09/23 00:58:30 tom Exp $") NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings = FALSE; -NCURSES_EXPORT_VAR(int) -_nc_curr_line = 0; /* current line # in input */ -NCURSES_EXPORT_VAR(int) -_nc_curr_col = 0; /* current column # in input */ +NCURSES_EXPORT_VAR(int) _nc_curr_line = 0; /* current line # in input */ +NCURSES_EXPORT_VAR(int) _nc_curr_col = 0; /* current column # in input */ - static const char *sourcename; - static char termtype[MAX_NAME_SIZE + 1]; +static const char *sourcename; +static char *termtype; NCURSES_EXPORT(void) _nc_set_source(const char *const name) @@ -60,15 +58,17 @@ _nc_set_source(const char *const name) NCURSES_EXPORT(void) _nc_set_type(const char *const name) { + if (termtype == 0) + termtype = _nc_doalloc(termtype, MAX_NAME_SIZE + 1); termtype[0] = '\0'; if (name) - strncat(termtype, name, sizeof(termtype) - 1); + strncat(termtype, name, MAX_NAME_SIZE); } NCURSES_EXPORT(void) _nc_get_type(char *name) { - strcpy(name, termtype); + strcpy(name, termtype != 0 ? termtype : ""); } static inline void @@ -79,7 +79,7 @@ where_is_problem(void) fprintf(stderr, ", line %d", _nc_curr_line); if (_nc_curr_col >= 0) fprintf(stderr, ", col %d", _nc_curr_col); - if (termtype[0]) + if (termtype != 0 && termtype[0] != '\0') fprintf(stderr, ", terminal '%s'", termtype); fputc(':', stderr); fputc(' ', stderr); diff --git a/contrib/ncurses/ncurses/tinfo/comp_expand.c b/contrib/ncurses/ncurses/tinfo/comp_expand.c index cf6339d..7ba438a 100644 --- a/contrib/ncurses/ncurses/tinfo/comp_expand.c +++ b/contrib/ncurses/ncurses/tinfo/comp_expand.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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.15 2000/12/10 01:30:10 tom Exp $") +MODULE_ID("$Id: comp_expand.c,v 1.17 2001/09/22 19:16:52 tom Exp $") static int trailing_spaces(const char *src) @@ -46,9 +46,8 @@ trailing_spaces(const char *src) } /* this deals with differences over whether 0x7f and 0x80..0x9f are controls */ -#define CHAR_OF(s) (*(unsigned const char *)(s)) -#define REALCTL(s) (CHAR_OF(s) < 127 && iscntrl(CHAR_OF(s))) -#define REALPRINT(s) (CHAR_OF(s) < 127 && isprint(CHAR_OF(s))) +#define REALCTL(s) (UChar(*(s)) < 127 && iscntrl(UChar(*(s)))) +#define REALPRINT(s) (UChar(*(s)) < 127 && isprint(UChar(*(s)))) NCURSES_EXPORT(char *) _nc_tic_expand @@ -69,7 +68,7 @@ _nc_tic_expand } bufp = 0; - while ((ch = CharOf(*str)) != 0) { + while ((ch = UChar(*str)) != 0) { if (ch == '%' && REALPRINT(str + 1)) { buffer[bufp++] = *str++; /* @@ -99,7 +98,7 @@ _nc_tic_expand */ case 1: if (str[0] == L_BRACE - && isdigit(CharOf(str[1]))) { + && isdigit(UChar(str[1]))) { char *dst = 0; long value = strtol(str + 1, &dst, 0); if (dst != 0 @@ -169,7 +168,7 @@ _nc_tic_expand } #define UnCtl(c) ((c) + '@') else if (REALCTL(str) && ch != '\\' - && (!islong || isdigit(CharOf(str[1])))) { + && (!islong || isdigit(UChar(str[1])))) { (void) sprintf(&buffer[bufp], "^%c", UnCtl(ch)); bufp += 2; } else { diff --git a/contrib/ncurses/ncurses/tinfo/comp_hash.c b/contrib/ncurses/ncurses/tinfo/comp_hash.c index fb18e3a..9f2ee71 100644 --- a/contrib/ncurses/ncurses/tinfo/comp_hash.c +++ b/contrib/ncurses/ncurses/tinfo/comp_hash.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -48,7 +48,7 @@ #define DEBUG(level, params) /*nothing */ #endif -MODULE_ID("$Id: comp_hash.c,v 1.24 2000/12/10 02:55:07 tom Exp $") +MODULE_ID("$Id: comp_hash.c,v 1.25 2001/06/02 22:50:42 skimo Exp $") static int hash_function(const char *); @@ -201,7 +201,7 @@ parse_columns(char *buffer) if (*buffer != '#') { while (*buffer != '\0') { char *s; - for (s = buffer; (*s != '\0') && !isspace(CharOf(*s)); s++) + for (s = buffer; (*s != '\0') && !isspace(UChar(*s)); s++) /*EMPTY */ ; if (s != buffer) { char mark = *s; @@ -216,7 +216,7 @@ parse_columns(char *buffer) col++; if (mark == '\0') break; - while (*++s && isspace(CharOf(*s))) + while (*++s && isspace(UChar(*s))) /*EMPTY */ ; buffer = s; } else diff --git a/contrib/ncurses/ncurses/tinfo/comp_parse.c b/contrib/ncurses/ncurses/tinfo/comp_parse.c index 917f95c..d59e4a5 100644 --- a/contrib/ncurses/ncurses/tinfo/comp_parse.c +++ b/contrib/ncurses/ncurses/tinfo/comp_parse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -52,7 +52,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$Id: comp_parse.c,v 1.48 2001/01/15 00:44:51 tom Exp $") +MODULE_ID("$Id: comp_parse.c,v 1.50 2001/06/16 17:52:18 tom Exp $") static void sanity_check(TERMTYPE *); NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype) (TERMTYPE *) = sanity_check; @@ -180,7 +180,7 @@ _nc_read_entry_source(FILE * fp, char *buf, memset(&thisentry, 0, sizeof(thisentry)); if (_nc_parse_entry(&thisentry, literal, silent) == ERR) break; - if (!isalnum(CharOf(thisentry.tterm.term_names[0]))) + if (!isalnum(UChar(thisentry.tterm.term_names[0]))) _nc_err_abort("terminal names must start with letter or digit"); /* @@ -486,6 +486,8 @@ sanity_check(TERMTYPE * tp) PAIRED(enter_xon_mode, exit_xon_mode); PAIRED(enter_am_mode, exit_am_mode); ANDMISSING(label_off, label_on); +#ifdef remove_clock PAIRED(display_clock, remove_clock); +#endif ANDMISSING(set_color_pair, initialize_pair); } diff --git a/contrib/ncurses/ncurses/tinfo/comp_scan.c b/contrib/ncurses/ncurses/tinfo/comp_scan.c index a6ad55f..52fb13a 100644 --- a/contrib/ncurses/ncurses/tinfo/comp_scan.c +++ b/contrib/ncurses/ncurses/tinfo/comp_scan.c @@ -50,7 +50,7 @@ #include <term_entry.h> #include <tic.h> -MODULE_ID("$Id: comp_scan.c,v 1.56 2001/04/21 18:53:34 tom Exp $") +MODULE_ID("$Id: comp_scan.c,v 1.59 2001/09/23 00:56:29 tom Exp $") /* * Maximum length of string capability we'll accept before raising an error. @@ -86,7 +86,7 @@ _nc_curr_token = static bool first_column; /* See 'next_char()' below */ static char separator; /* capability separator */ static int pushtype; /* type of pushback token */ -static char pushname[MAX_NAME_SIZE + 1]; +static char *pushname; #if NCURSES_EXT_FUNCS NCURSES_EXPORT_VAR(bool) @@ -146,26 +146,28 @@ NCURSES_EXPORT(int) _nc_get_token(bool silent) { static const char terminfo_punct[] = "@%&*!#"; - long number; - int type; - int ch; + static char *buffer; + char *numchk; - char numbuf[80]; - unsigned found; - static char buffer[MAX_ENTRY_SIZE]; char *ptr; + char numbuf[80]; + int ch; int dot_flag = FALSE; + int type; + long number; long token_start; + unsigned found; if (pushtype != NO_PUSHBACK) { int retval = pushtype; - _nc_set_type(pushname); + _nc_set_type(pushname != 0 ? pushname : ""); DEBUG(3, ("pushed-back token: `%s', class %d", _nc_curr_token.tk_name, pushtype)); pushtype = NO_PUSHBACK; - pushname[0] = '\0'; + if (pushname != 0) + pushname[0] = '\0'; /* currtok wasn't altered by _nc_push_token() */ return (retval); @@ -218,6 +220,9 @@ _nc_get_token(bool silent) goto start_token; } + if (buffer == 0) + buffer = _nc_doalloc(buffer, MAX_ENTRY_SIZE); + ptr = buffer; *(ptr++) = ch; @@ -302,7 +307,7 @@ _nc_get_token(bool silent) * special characters can be dangerous due to shell expansion. */ for (ptr = buffer; ptr < desc; ptr++) { - if (isspace(CharOf(*ptr))) { + if (isspace(UChar(*ptr))) { if (!silent) _nc_warning("whitespace in name or alias field"); break; @@ -373,7 +378,7 @@ _nc_get_token(bool silent) break; case '=': - ch = _nc_trans_string(ptr, buffer + sizeof(buffer)); + ch = _nc_trans_string(ptr, buffer + MAX_ENTRY_SIZE); if (!silent && ch != separator) _nc_warning("Missing separator"); _nc_curr_token.tk_name = buffer; @@ -629,10 +634,12 @@ _nc_push_token(int tokclass) /* * This implementation is kind of bogus, it will fail if we ever do more * than one pushback at a time between get_token() calls. It relies on the - * fact that curr_tok is static storage that nothing but get_token() - * touches. + * fact that _nc_curr_token is static storage that nothing but + * _nc_get_token() touches. */ pushtype = tokclass; + if (pushname == 0) + pushname = _nc_doalloc(pushname, MAX_NAME_SIZE + 1); _nc_get_type(pushname); DEBUG(3, ("pushing token: `%s', class %d", @@ -680,7 +687,8 @@ NCURSES_EXPORT(void) _nc_reset_input(FILE * fp, char *buf) { pushtype = NO_PUSHBACK; - pushname[0] = '\0'; + if (pushname != 0) + pushname[0] = '\0'; yyin = fp; bufstart = bufptr = buf; _nc_curr_file_pos = 0L; @@ -699,7 +707,7 @@ last_char(void) { size_t len = strlen(bufptr); while (len--) { - if (!isspace(CharOf(bufptr[len]))) + if (!isspace(UChar(bufptr[len]))) return bufptr[len]; } return 0; diff --git a/contrib/ncurses/ncurses/tinfo/lib_acs.c b/contrib/ncurses/ncurses/tinfo/lib_acs.c index 54554a8..b84d8e2 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_acs.c +++ b/contrib/ncurses/ncurses/tinfo/lib_acs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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,23 @@ #include <curses.priv.h> #include <term.h> /* ena_acs, acs_chars */ -MODULE_ID("$Id: lib_acs.c,v 1.18 2000/12/10 02:55:07 tom Exp $") +MODULE_ID("$Id: lib_acs.c,v 1.21 2001/12/23 00:15:10 tom Exp $") +#if BROKEN_LINKER +NCURSES_EXPORT_VAR(chtype *) +_nc_acs_map(void) +{ + static chtype *the_map = 0; + if (the_map == 0) + the_map = typeCalloc(chtype, ACS_LEN); + return the_map; +} +#else NCURSES_EXPORT_VAR(chtype) acs_map[ACS_LEN] = { 0 }; +#endif NCURSES_EXPORT(void) _nc_init_acs(void) @@ -143,11 +154,11 @@ _nc_init_acs(void) */ if (_nc_tracing & TRACE_CALLS) { size_t n, m; - char show[SIZEOF(acs_map) + 1]; - for (n = 1, m = 0; n < SIZEOF(acs_map); n++) { + char show[ACS_LEN + 1]; + for (n = 1, m = 0; n < ACS_LEN; n++) { if (acs_map[n] != 0) { show[m++] = (char) n; - show[m++] = TextOf(acs_map[n]); + show[m++] = ChCharOf(acs_map[n]); } } show[m] = 0; diff --git a/contrib/ncurses/ncurses/tinfo/lib_baudrate.c b/contrib/ncurses/ncurses/tinfo/lib_baudrate.c index ec62810..5238924 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_baudrate.c +++ b/contrib/ncurses/ncurses/tinfo/lib_baudrate.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2002 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -69,13 +69,14 @@ #undef B115200 #undef B230400 #undef B460800 +#undef B921600 #define USE_OLD_TTY #include <sys/ttydev.h> #else #undef USE_OLD_TTY #endif /* USE_OLD_TTY */ -MODULE_ID("$Id: lib_baudrate.c,v 1.21 2001/06/30 22:59:22 tom Exp $") +MODULE_ID("$Id: lib_baudrate.c,v 1.22 2002/01/19 23:07:53 Andrey.A.Chernov Exp $") /* * int @@ -132,6 +133,9 @@ static struct speed const speeds[] = #ifdef B460800 {B460800, 460800}, #endif +#ifdef B921600 + {B921600, 921600}, +#endif }; NCURSES_EXPORT(int) @@ -203,14 +207,14 @@ baudrate(void) #ifdef USE_OLD_TTY result = cfgetospeed(&cur_term->Nttyb); ospeed = _nc_ospeed(result); -#else +#else /* !USE_OLD_TTY */ #ifdef TERMIOS ospeed = cfgetospeed(&cur_term->Nttyb); #else ospeed = cur_term->Nttyb.sg_ospeed; #endif result = _nc_baudrate(ospeed); -#endif /* __FreeBSD__ */ +#endif if (cur_term != 0) cur_term->_baudrate = result; diff --git a/contrib/ncurses/ncurses/tinfo/lib_kernel.c b/contrib/ncurses/ncurses/tinfo/lib_kernel.c index ab8e4db..b4d3c7f 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_kernel.c +++ b/contrib/ncurses/ncurses/tinfo/lib_kernel.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2002 Free 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 2002 * ****************************************************************************/ /* @@ -47,7 +48,28 @@ #include <curses.priv.h> #include <term.h> /* cur_term */ -MODULE_ID("$Id: lib_kernel.c,v 1.21 2000/12/10 02:55:07 tom Exp $") +MODULE_ID("$Id: lib_kernel.c,v 1.22 2002/05/11 20:32:18 tom Exp $") + +static int +_nc_vdisable(void) +{ + int value; +#if defined(_POSIX_VDISABLE) && defined(HAVE_UNISTD_H) + value = _POSIX_VDISABLE; +#endif +#if defined(_PC_VDISABLE) + if (value == -1) { + value = fpathconf(0, _PC_VDISABLE); + if (value == -1) { + value = 0377; + } + } +#elif defined(VDISABLE) + if (value == -1) + value = VDISABLE; +#endif + return value; +} /* * erasechar() @@ -59,16 +81,19 @@ MODULE_ID("$Id: lib_kernel.c,v 1.21 2000/12/10 02:55:07 tom Exp $") NCURSES_EXPORT(char) erasechar(void) { + int result = ERR; T((T_CALLED("erasechar()"))); if (cur_term != 0) { #ifdef TERMIOS - returnCode(cur_term->Ottyb.c_cc[VERASE]); + result = cur_term->Ottyb.c_cc[VERASE]; + if (result == _nc_vdisable()) + result = ERR; #else - returnCode(cur_term->Ottyb.sg_erase); + result = cur_term->Ottyb.sg_erase; #endif } - returnCode(ERR); + returnCode(result); } /* @@ -81,16 +106,19 @@ erasechar(void) NCURSES_EXPORT(char) killchar(void) { + int result = ERR; T((T_CALLED("killchar()"))); if (cur_term != 0) { #ifdef TERMIOS - returnCode(cur_term->Ottyb.c_cc[VKILL]); + result = cur_term->Ottyb.c_cc[VKILL]; + if (result == _nc_vdisable()) + result = ERR; #else - returnCode(cur_term->Ottyb.sg_kill); + result = cur_term->Ottyb.sg_kill; #endif } - returnCode(ERR); + returnCode(result); } /* diff --git a/contrib/ncurses/ncurses/tinfo/lib_napms.c b/contrib/ncurses/ncurses/tinfo/lib_napms.c index df1c2e4..20537be 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_napms.c +++ b/contrib/ncurses/ncurses/tinfo/lib_napms.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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,20 +45,9 @@ #if HAVE_SYS_TIME_H #include <sys/time.h> /* needed for MacOS X DP3 */ #endif -#elif USE_FUNC_POLL -#if HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#elif HAVE_SELECT -#if HAVE_SYS_TIME_H && HAVE_SYS_TIME_SELECT -#include <sys/time.h> -#endif -#if HAVE_SYS_SELECT_H -#include <sys/select.h> -#endif #endif -MODULE_ID("$Id: lib_napms.c,v 1.11 2000/12/10 02:55:07 tom Exp $") +MODULE_ID("$Id: lib_napms.c,v 1.12 2001/12/22 22:20:40 tom Exp $") NCURSES_EXPORT(int) napms(int ms) @@ -72,18 +61,9 @@ napms(int ms) ts.tv_nsec = (ms % 1000) * 1000000; nanosleep(&ts, NULL); } -#elif USE_FUNC_POLL - { - struct pollfd fds[1]; - poll(fds, 0, ms); - } -#elif HAVE_SELECT - { - struct timeval tval; - tval.tv_sec = ms / 1000; - tval.tv_usec = (ms % 1000) * 1000; - select(0, NULL, NULL, NULL, &tval); - } +#else + _nc_timed_wait(0, ms, (int *) 0); #endif + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_options.c b/contrib/ncurses/ncurses/tinfo/lib_options.c index 581357d..05bd476 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_options.c +++ b/contrib/ncurses/ncurses/tinfo/lib_options.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001,2002 Free 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 <term.h> -MODULE_ID("$Id: lib_options.c,v 1.42 2000/12/10 02:55:07 tom Exp $") +MODULE_ID("$Id: lib_options.c,v 1.46 2002/02/02 19:40:54 tom Exp $") NCURSES_EXPORT(int) idlok(WINDOW *win, bool flag) @@ -115,6 +115,7 @@ wtimeout(WINDOW *win, int delay) if (win) { win->_delay = delay; } + returnVoid; } NCURSES_EXPORT(int) @@ -251,5 +252,6 @@ _nc_keypad(bool flag) _nc_init_keytry(); SP->_tried = TRUE; } + SP->_keypad_on = flag; return (OK); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_print.c b/contrib/ncurses/ncurses/tinfo/lib_print.c index 291e84c..01540ea 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_print.c +++ b/contrib/ncurses/ncurses/tinfo/lib_print.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2002 Free 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 <term.h> -MODULE_ID("$Id: lib_print.c,v 1.13 2000/12/10 02:55:07 tom Exp $") +MODULE_ID("$Id: lib_print.c,v 1.14 2002/03/16 21:45:08 tom Exp $") NCURSES_EXPORT(int) mcprint(char *data, int len) @@ -66,7 +66,7 @@ mcprint(char *data, int len) } (void) strcpy(mybuf, switchon); - memcpy(mybuf + onsize, data, len); + memcpy(mybuf + onsize, data, (unsigned) len); if (offsize) (void) strcpy(mybuf + onsize + len, prtr_off); diff --git a/contrib/ncurses/ncurses/tinfo/lib_raw.c b/contrib/ncurses/ncurses/tinfo/lib_raw.c index 0a65b8f..97cf0cb 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_raw.c +++ b/contrib/ncurses/ncurses/tinfo/lib_raw.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -48,7 +48,7 @@ #include <curses.priv.h> #include <term.h> /* cur_term */ -MODULE_ID("$Id: lib_raw.c,v 1.10 2000/12/10 02:55:07 tom Exp $") +MODULE_ID("$Id: lib_raw.c,v 1.12 2001/08/04 17:18:38 tom Exp $") #if SVR4_TERMIO && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE @@ -140,8 +140,8 @@ qiflush(void) cur_term->Nttyb.c_lflag &= ~(NOFLSH); AFTER("qiflush"); (void) _nc_set_tty_mode(&cur_term->Nttyb); - returnVoid; #endif + returnVoid; } NCURSES_EXPORT(int) @@ -205,8 +205,8 @@ noqiflush(void) cur_term->Nttyb.c_lflag |= NOFLSH; AFTER("noqiflush"); (void) _nc_set_tty_mode(&cur_term->Nttyb); - returnVoid; #endif + returnVoid; } NCURSES_EXPORT(int) diff --git a/contrib/ncurses/ncurses/tinfo/lib_setup.c b/contrib/ncurses/ncurses/tinfo/lib_setup.c index e73e7e0..1e49b2b 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_setup.c +++ b/contrib/ncurses/ncurses/tinfo/lib_setup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -48,7 +48,7 @@ #include <term.h> /* lines, columns, cur_term */ -MODULE_ID("$Id: lib_setup.c,v 1.64 2000/12/10 02:55:07 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.68 2001/12/08 22:14:18 tom Exp $") /**************************************************************************** * @@ -97,18 +97,17 @@ static void do_prototype(void); NCURSES_EXPORT(void) use_env(bool f) { + T((T_CALLED("use_env()"))); _use_env = f; + returnVoid; } -NCURSES_EXPORT_VAR(int) -LINES = 0; -NCURSES_EXPORT_VAR(int) -COLS = 0; -NCURSES_EXPORT_VAR(int) -TABSIZE = 0; +NCURSES_EXPORT_VAR(int) LINES = 0; +NCURSES_EXPORT_VAR(int) COLS = 0; +NCURSES_EXPORT_VAR(int) TABSIZE = 0; - static void - _nc_get_screensize(int *linep, int *colp) +static void +_nc_get_screensize(int *linep, int *colp) /* Obtain lines/columns values from the environment and/or terminfo entry */ { /* figure out the size of the screen */ @@ -178,8 +177,10 @@ TABSIZE = 0; } /* the ultimate fallback, assume fixed 24x80 size */ - if (*linep <= 0 || *colp <= 0) { + if (*linep <= 0) { *linep = 24; + } + if (*colp <= 0) { *colp = 80; } @@ -235,7 +236,7 @@ _nc_update_screensize(void) exit(EXIT_FAILURE);\ } -#if USE_DATABASE +#if USE_DATABASE || USE_TERMCAP static int grab_entry(const char *const tn, TERMTYPE * const tp) /* return 1 if entry found, 0 if not found, -1 if database not accessible */ @@ -249,6 +250,7 @@ grab_entry(const char *const tn, TERMTYPE * const tp) if (strchr(tn, '/')) return 0; +#if USE_DATABASE if ((status = _nc_read_entry(tn, filename, tp)) != 1) { #if !PURE_TERMINFO @@ -262,6 +264,9 @@ grab_entry(const char *const tn, TERMTYPE * const tp) #endif /* PURE_TERMINFO */ } +#else + status = _nc_read_termcap_entry(tn, tp); +#endif /* * If we have an entry, force all of the cancelled strings to null @@ -295,8 +300,7 @@ NCURSES_EXPORT_VAR(char) ttytype[NAMESIZE] = ""; */ NCURSES_EXPORT(int) -setupterm -(NCURSES_CONST char *tname, int Filedes, int *errret) +setupterm(NCURSES_CONST char *tname, int Filedes, int *errret) { struct term *term_ptr; int status; @@ -321,7 +325,7 @@ setupterm if (term_ptr == 0) { ret_error0(-1, "Not enough memory to create terminal structure.\n"); } -#if USE_DATABASE +#if USE_DATABASE || USE_TERMCAP status = grab_entry(tname, &term_ptr->type); #else status = 0; diff --git a/contrib/ncurses/ncurses/tinfo/lib_termcap.c b/contrib/ncurses/ncurses/tinfo/lib_termcap.c index c88887b..c647b97 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_termcap.c +++ b/contrib/ncurses/ncurses/tinfo/lib_termcap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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,27 +29,80 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * * and: Eric S. Raymond <esr@snark.thyrsus.com> * + * * + * some of the code in here was contributed by: * + * Magnus Bengtsson, d6mbeng@dtek.chalmers.se (Nov'93) * ****************************************************************************/ #include <curses.priv.h> #include <termcap.h> #include <tic.h> +#include <ctype.h> #define __INTERNAL_CAPS_VISIBLE #include <term_entry.h> -MODULE_ID("$Id: lib_termcap.c,v 1.39 2000/12/10 02:56:30 tom Exp $") +MODULE_ID("$Id: lib_termcap.c,v 1.42 2001/09/22 19:17:31 tom Exp $") + +#define CSI 233 +#define ESC 033 /* ^[ */ +#define L_BRACK '[' +#define SHIFT_OUT 017 /* ^N */ + +NCURSES_EXPORT_VAR(char *) UP = 0; +NCURSES_EXPORT_VAR(char *) BC = 0; + +static char *fix_me = 0; + +static char * +set_attribute_9(int flag) +{ + const char *result; + + if ((result = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag)) == 0) + result = ""; + return strdup(result); +} -/* - some of the code in here was contributed by: - Magnus Bengtsson, d6mbeng@dtek.chalmers.se -*/ +static int +is_csi(char *s) +{ + if (UChar(s[0]) == CSI) + return 1; + else if (s[0] == ESC && s[1] == L_BRACK) + return 2; + return 0; +} -NCURSES_EXPORT_VAR(char *) -UP = 0; -NCURSES_EXPORT_VAR(char *) -BC = 0; +static char * +skip_zero(char *s) +{ + if (s[0] == '0') { + if (s[1] == ';') + s += 2; + else if (isalpha(UChar(s[1]))) + s += 1; + } + return s; +} + +static bool +similar_sgr(char *a, char *b) +{ + int csi_a = is_csi(a); + int csi_b = is_csi(b); + + if (csi_a != 0 && csi_b != 0 && csi_a == csi_b) { + a += csi_a; + b += csi_b; + if (*a != *b) { + a = skip_zero(a); + b = skip_zero(b); + } + } + return strcmp(a, b) == 0; +} /*************************************************************************** * @@ -67,8 +120,7 @@ BC = 0; ***************************************************************************/ NCURSES_EXPORT(int) -tgetent -(char *bufp GCC_UNUSED, const char *name) +tgetent(char *bufp GCC_UNUSED, const char *name) { int errcode; @@ -76,6 +128,11 @@ tgetent setupterm((NCURSES_CONST char *) name, STDOUT_FILENO, &errcode); + PC = 0; + UP = 0; + BC = 0; + fix_me = 0; + if (errcode == 1) { if (cursor_left) @@ -90,6 +147,68 @@ tgetent if (backspace_if_not_bs != NULL) BC = backspace_if_not_bs; + /* + * While 'sgr0' is the "same" as termcap 'me', there is a compatibility + * issue. The sgr/sgr0 capabilities include setting/clearing alternate + * character set mode. A termcap application cannot use sgr, so sgr0 + * strings that reset alternate character set mode will be + * misinterpreted. Here, we remove those from the more common + * ISO/ANSI/VT100 entries, which have sgr0 agreeing with sgr. + */ + if (exit_attribute_mode != 0 + && set_attributes != 0) { + char *on = set_attribute_9(1); + char *off = set_attribute_9(0); + char *tmp; + size_t i, j, k; + + if (similar_sgr(off, exit_attribute_mode) + && !similar_sgr(off, on)) { + TR(TRACE_DATABASE, ("adjusting sgr0 : %s", _nc_visbuf(off))); + FreeIfNeeded(fix_me); + fix_me = off; + for (i = 0; off[i] != '\0'; ++i) { + if (on[i] != off[i]) { + j = strlen(off); + k = strlen(on); + while (j != 0 + && k != 0 + && off[j - 1] == on[k - 1]) { + --j, --k; + } + while (off[j] != '\0') { + off[i++] = off[j++]; + } + off[i] = '\0'; + break; + } + } + /* SGR 10 would reset to normal font */ + if ((i = is_csi(off)) != 0 + && off[strlen(off) - 1] == 'm') { + tmp = skip_zero(off + i); + if (tmp[0] == '1' + && skip_zero(tmp + 1) != tmp + 1) { + i = tmp - off; + if (off[i - 1] == ';') + i--; + j = skip_zero(tmp + 1) - off; + while (off[j] != '\0') { + off[i++] = off[j++]; + } + off[i] = '\0'; + } + } + TR(TRACE_DATABASE, ("...adjusted me : %s", _nc_visbuf(fix_me))); + if (!strcmp(fix_me, exit_attribute_mode)) { + TR(TRACE_DATABASE, ("...same result, discard")); + free(fix_me); + fix_me = 0; + } + } + free(on); + } + (void) baudrate(); /* sets ospeed as a side-effect */ /* LINT_PREPRO @@ -169,10 +288,10 @@ tgetnum(NCURSES_CONST char *id) ***************************************************************************/ NCURSES_EXPORT(char *) -tgetstr -(NCURSES_CONST char *id, char **area) +tgetstr(NCURSES_CONST char *id, char **area) { int i; + char *result = NULL; T((T_CALLED("tgetstr(%s,%p)"), id, area)); if (cur_term != 0) { @@ -180,17 +299,24 @@ tgetstr for_each_string(i, tp) { const char *capname = ExtStrname(tp, i, strcodes); if (!strncmp(id, capname, 2)) { - TR(TRACE_DATABASE, ("found match : %s", _nc_visbuf(tp->Strings[i]))); + result = tp->Strings[i]; + TR(TRACE_DATABASE, ("found match : %s", _nc_visbuf(result))); /* setupterm forces canceled strings to null */ - if (area != 0 - && *area != 0 - && VALID_STRING(tp->Strings[i])) { - (void) strcpy(*area, tp->Strings[i]); - *area += strlen(*area) + 1; + if (VALID_STRING(result)) { + if (result == exit_attribute_mode + && fix_me != 0) { + result = fix_me; + TR(TRACE_DATABASE, ("altered to : %s", _nc_visbuf(result))); + } + if (area != 0 + && *area != 0) { + (void) strcpy(*area, result); + *area += strlen(*area) + 1; + } } - returnPtr(tp->Strings[i]); + break; } } } - returnPtr(NULL); + returnPtr(result); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_termname.c b/contrib/ncurses/ncurses/tinfo/lib_termname.c index 6b287e0..57ce807 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_termname.c +++ b/contrib/ncurses/ncurses/tinfo/lib_termname.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ #include <curses.priv.h> #include <tic.h> /* for MAX_ALIAS */ -MODULE_ID("$Id: lib_termname.c,v 1.6 2000/12/10 02:55:08 tom Exp $") +MODULE_ID("$Id: lib_termname.c,v 1.7 2001/08/04 19:29:38 tom Exp $") NCURSES_EXPORT(char *) termname(void) @@ -37,12 +37,12 @@ termname(void) char *name = getenv("TERM"); static char ret[MAX_ALIAS + 1]; - T(("termname() called")); + T((T_CALLED("termname()"))); if (name != 0) { ret[0] = '\0'; (void) strncat(ret, name, sizeof(ret) - 1); name = ret; } - return name; + returnPtr(name); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_tgoto.c b/contrib/ncurses/ncurses/tinfo/lib_tgoto.c index 19edb4f..17649d5 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_tgoto.c +++ b/contrib/ncurses/ncurses/tinfo/lib_tgoto.c @@ -35,7 +35,7 @@ #include <ctype.h> #include <termcap.h> -MODULE_ID("$Id: lib_tgoto.c,v 1.7 2001/03/24 22:25:55 tom Exp $") +MODULE_ID("$Id: lib_tgoto.c,v 1.8 2001/06/02 22:44:42 tom Exp $") #if !PURE_TERMINFO static bool @@ -112,7 +112,7 @@ tgoto_internal(const char *string, int x, int y) *value %= 1000; break; case '+': - *value += CharOf(*++string); + *value += UChar(*++string); /* FALLTHRU */ case '.': /* diff --git a/contrib/ncurses/ncurses/tinfo/lib_tparm.c b/contrib/ncurses/ncurses/tinfo/lib_tparm.c index e62b824..931669e 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_tparm.c +++ b/contrib/ncurses/ncurses/tinfo/lib_tparm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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 <term.h> #include <tic.h> -MODULE_ID("$Id: lib_tparm.c,v 1.52 2001/03/11 15:12:48 tom Exp $") +MODULE_ID("$Id: lib_tparm.c,v 1.53 2001/06/02 22:53:59 tom Exp $") /* * char * @@ -301,7 +301,7 @@ parse_format(const char *s, char *format, int *len) } break; default: - if (isdigit(CharOf(*s))) { + if (isdigit(UChar(*s))) { value = (value * 10) + (*s - '0'); if (value > 10000) err = TRUE; diff --git a/contrib/ncurses/ncurses/tinfo/lib_tputs.c b/contrib/ncurses/ncurses/tinfo/lib_tputs.c index 63dbbd9..26d805b 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_tputs.c +++ b/contrib/ncurses/ncurses/tinfo/lib_tputs.c @@ -45,7 +45,7 @@ #include <termcap.h> /* ospeed */ #include <tic.h> -MODULE_ID("$Id: lib_tputs.c,v 1.56 2001/04/21 18:53:53 tom Exp $") +MODULE_ID("$Id: lib_tputs.c,v 1.59 2001/09/22 18:35:23 tom Exp $") NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */ @@ -104,72 +104,6 @@ _nc_outch(int ch) return OK; } -#if USE_WIDEC_SUPPORT -/* - * Reference: The Unicode Standard 2.0 - * - * No surrogates supported (we're storing only one 16-bit Unicode value per - * cell). - */ -NCURSES_EXPORT(int) -_nc_utf8_outch(int ch) -{ - static const unsigned byteMask = 0xBF; - static const unsigned otherMark = 0x80; - static const unsigned firstMark[] = - {0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC}; - - int result[7], *ptr; - int count = 0; - - if ((unsigned int) ch < 0x80) - count = 1; - else if ((unsigned int) ch < 0x800) - count = 2; - else if ((unsigned int) ch < 0x10000) - count = 3; - else if ((unsigned int) ch < 0x200000) - count = 4; - else if ((unsigned int) ch < 0x4000000) - count = 5; - else if ((unsigned int) ch <= 0x7FFFFFFF) - count = 6; - else { - count = 3; - ch = 0xFFFD; - } - ptr = result + count; - switch (count) { - case 6: - *--ptr = (ch | otherMark) & byteMask; - ch >>= 6; - /* FALLTHRU */ - case 5: - *--ptr = (ch | otherMark) & byteMask; - ch >>= 6; - /* FALLTHRU */ - case 4: - *--ptr = (ch | otherMark) & byteMask; - ch >>= 6; - /* FALLTHRU */ - case 3: - *--ptr = (ch | otherMark) & byteMask; - ch >>= 6; - /* FALLTHRU */ - case 2: - *--ptr = (ch | otherMark) & byteMask; - ch >>= 6; - /* FALLTHRU */ - case 1: - *--ptr = (ch | firstMark[count]); - break; - } - while (count--) - _nc_outch(*ptr++); - return OK; -} -#endif - NCURSES_EXPORT(int) putp(const char *string) { @@ -228,19 +162,19 @@ tputs * (like nethack) actually do the likes of tputs("50") to get delays. */ trailpad = 0; - if (isdigit(*string)) { - while (isdigit(*string)) { + if (isdigit(UChar(*string))) { + while (isdigit(UChar(*string))) { trailpad = trailpad * 10 + (*string - '0'); string++; } trailpad *= 10; if (*string == '.') { string++; - if (isdigit(*string)) { + if (isdigit(UChar(*string))) { trailpad += (*string - '0'); string++; } - while (isdigit(*string)) + while (isdigit(UChar(*string))) string++; } @@ -265,7 +199,7 @@ tputs bool mandatory; string++; - if ((!isdigit(CharOf(*string)) && *string != '.') + if ((!isdigit(UChar(*string)) && *string != '.') || !strchr(string, '>')) { (*outc) ('$'); (*outc) ('<'); @@ -273,18 +207,18 @@ tputs } number = 0; - while (isdigit(CharOf(*string))) { + while (isdigit(UChar(*string))) { number = number * 10 + (*string - '0'); string++; } number *= 10; if (*string == '.') { string++; - if (isdigit(CharOf(*string))) { + if (isdigit(UChar(*string))) { number += (*string - '0'); string++; } - while (isdigit(CharOf(*string))) + while (isdigit(UChar(*string))) string++; } diff --git a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c index d72df2d..e71be89 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c +++ b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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 <curses.priv.h> #include <term.h> /* cur_term */ -MODULE_ID("$Id: lib_ttyflags.c,v 1.5 2000/12/10 02:55:08 tom Exp $") +MODULE_ID("$Id: lib_ttyflags.c,v 1.6 2001/12/16 01:19:01 tom Exp $") #undef tabs @@ -121,7 +121,7 @@ reset_prog_mode(void) if (cur_term != 0) { _nc_set_tty_mode(&cur_term->Nttyb); if (SP) { - if (stdscr && stdscr->_use_keypad) + if (SP->_keypad_on) _nc_keypad(TRUE); NC_BUFFERED(TRUE); } diff --git a/contrib/ncurses/ncurses/tinfo/name_match.c b/contrib/ncurses/ncurses/tinfo/name_match.c index 934b24a..e7205d5 100644 --- a/contrib/ncurses/ncurses/tinfo/name_match.c +++ b/contrib/ncurses/ncurses/tinfo/name_match.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,7 +34,7 @@ #include <term.h> #include <tic.h> -MODULE_ID("$Id: name_match.c,v 1.10 2000/12/10 02:55:08 tom Exp $") +MODULE_ID("$Id: name_match.c,v 1.11 2001/09/22 21:11:34 tom Exp $") /* * _nc_first_name(char *names) @@ -46,10 +46,12 @@ NCURSES_EXPORT(char *) _nc_first_name(const char *const sp) /* get the first name from the given name list */ { - static char buf[MAX_NAME_SIZE + 1]; + static char *buf; register unsigned n; - for (n = 0; n < sizeof(buf) - 1; n++) { + if (buf == 0) + buf = _nc_doalloc(buf, MAX_NAME_SIZE + 1); + for (n = 0; n < MAX_NAME_SIZE; n++) { if ((buf[n] = sp[n]) == '\0' || (buf[n] == '|')) break; diff --git a/contrib/ncurses/ncurses/tinfo/parse_entry.c b/contrib/ncurses/ncurses/tinfo/parse_entry.c index ef66b30..797974c 100644 --- a/contrib/ncurses/ncurses/tinfo/parse_entry.c +++ b/contrib/ncurses/ncurses/tinfo/parse_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -47,7 +47,7 @@ #define __INTERNAL_CAPS_VISIBLE #include <term_entry.h> -MODULE_ID("$Id: parse_entry.c,v 1.53 2001/03/03 21:13:09 Todd.C.Miller Exp $") +MODULE_ID("$Id: parse_entry.c,v 1.55 2002/04/22 00:01:30 tom Exp $") #ifdef LINT static short const parametrized[] = @@ -243,7 +243,7 @@ _nc_parse_entry (base == entryp->tterm.term_names) ? "primary name" : "alias", - ptr - base, base); + (int) (ptr - base), base); } } @@ -482,7 +482,7 @@ _nc_capcmp(const char *s, const char *t) for (;;) { if (s[0] == '$' && s[1] == '<') { for (s += 2;; s++) - if (!(isdigit(CharOf(*s)) + if (!(isdigit(UChar(*s)) || *s == '.' || *s == '*' || *s == '/' @@ -492,7 +492,7 @@ _nc_capcmp(const char *s, const char *t) if (t[0] == '$' && t[1] == '<') { for (t += 2;; t++) - if (!(isdigit(CharOf(*t)) + if (!(isdigit(UChar(*t)) || *t == '.' || *t == '*' || *t == '/' diff --git a/contrib/ncurses/ncurses/tinfo/read_termcap.c b/contrib/ncurses/ncurses/tinfo/read_termcap.c index da88f0b..c6e7e35 100644 --- a/contrib/ncurses/ncurses/tinfo/read_termcap.c +++ b/contrib/ncurses/ncurses/tinfo/read_termcap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -52,10 +52,12 @@ #include <curses.priv.h> #include <ctype.h> +#include <sys/types.h> +#include <sys/stat.h> #include <tic.h> #include <term_entry.h> -MODULE_ID("$Id: read_termcap.c,v 1.55 2000/12/10 02:55:08 tom Exp $") +MODULE_ID("$Id: read_termcap.c,v 1.58 2001/10/28 01:11:34 tom Exp $") #if !PURE_TERMINFO @@ -72,6 +74,17 @@ MODULE_ID("$Id: read_termcap.c,v 1.55 2000/12/10 02:55:08 tom Exp $") #define TC_SYS_ERR -3 #define TC_REF_LOOP -4 +static char * +get_termpath(void) +{ + char *result; + + if (!use_terminfo_vars() || (result = getenv("TERMPATH")) == 0) + result = TERMPATH; + T(("TERMPATH is %s", result)); + return result; +} + #if USE_GETCAP #if HAVE_BSD_CGETENT @@ -125,13 +138,7 @@ static int _nc_nfcmp(const char *, char *); #define BFRAG 1024 #define BSIZE 1024 -#define ESC ('[' & 037) /* ASCII ESC */ #define MAX_RECURSION 32 /* maximum getent recursion */ -#define SFRAG 100 /* cgetstr mallocs in SFRAG chunks */ - -#define RECOK (char)0 -#define TCERR (char)1 -#define SHADOW (char)2 static size_t topreclen; /* toprec length */ static char *toprec; /* Additional record specified by cgetset() */ @@ -797,9 +804,9 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) */ _nc_str_init(&desc, pathbuf, sizeof(pathbuf)); if (cp == NULL) { - _nc_safe_strcpy(&desc, "/etc/termcap /usr/share/misc/termcap"); + _nc_safe_strcpy(&desc, get_termpath()); } else if (!is_pathname(cp)) { /* TERMCAP holds an entry */ - if ((termpath = getenv("TERMPATH")) != 0) { + if ((termpath = get_termpath()) != 0) { _nc_safe_strcat(&desc, termpath); } else { char temp[PBUFSIZ]; @@ -812,8 +819,8 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) /* if no $HOME look in current directory */ strcat(temp, ".termcap"); _nc_safe_strcat(&desc, temp); - _nc_safe_strcat(&desc, " /etc/termcap"); - _nc_safe_strcat(&desc, " /usr/share/misc/termcap"); + _nc_safe_strcat(&desc, " "); + _nc_safe_strcat(&desc, get_termpath()); } } else { /* user-defined name in TERMCAP */ _nc_safe_strcat(&desc, cp); /* still can be tokenized */ @@ -908,18 +915,24 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) static int add_tc(char *termpaths[], char *path, int count) { + char *save = strchr(path, NCURSES_PATHSEP); + if (save != 0) + *save = '\0'; if (count < MAXPATHS - && _nc_access(path, R_OK) == 0) + && _nc_access(path, R_OK) == 0) { termpaths[count++] = path; + T(("Adding termpath %s", path)); + } termpaths[count] = 0; + if (save != 0) + *save = NCURSES_PATHSEP; return count; } #define ADD_TC(path, count) filecount = add_tc(termpaths, path, count) #endif /* !USE_GETCAP */ NCURSES_EXPORT(int) -_nc_read_termcap_entry -(const char *const tn, TERMTYPE * const tp) +_nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) { int found = FALSE; ENTRY *ep; @@ -931,6 +944,7 @@ _nc_read_termcap_entry static char *source; static int lineno; + T(("read termcap entry for %s", tn)); if (use_terminfo_vars() && (p = getenv("TERMCAP")) != 0 && !is_pathname(p) && _nc_name_match(p, tn, "|:")) { /* TERMCAP holds a termcap entry */ @@ -976,41 +990,38 @@ _nc_read_termcap_entry FILE *fp; char *tc, *termpaths[MAXPATHS]; int filecount = 0; + int j, k; bool use_buffer = FALSE; + bool normal = TRUE; char tc_buf[1024]; char pathbuf[PATH_MAX]; + char *copied = 0; + char *cp; + struct stat test_stat[MAXPATHS]; termpaths[filecount] = 0; if (use_terminfo_vars() && (tc = getenv("TERMCAP")) != 0) { if (is_pathname(tc)) { /* interpret as a filename */ ADD_TC(tc, 0); + normal = FALSE; } else if (_nc_name_match(tc, tn, "|:")) { /* treat as a capability file */ use_buffer = TRUE; (void) sprintf(tc_buf, "%.*s\n", (int) sizeof(tc_buf) - 2, tc); - } else if ((tc = getenv("TERMPATH")) != 0) { - char *cp; - - for (cp = tc; *cp; cp++) { - if (*cp == NCURSES_PATHSEP) - *cp = '\0'; - else if (cp == tc || cp[-1] == '\0') { - ADD_TC(cp, filecount); - } - } + normal = FALSE; } - } else { /* normal case */ - char envhome[PATH_MAX], *h; + } - filecount = 0; + if (normal) { /* normal case */ + char envhome[PATH_MAX], *h; - /* - * Probably /etc/termcap is a symlink to /usr/share/misc/termcap. - * Avoid reading the same file twice. - */ - if (_nc_access("/etc/termcap", F_OK) == 0) - ADD_TC("/etc/termcap", filecount); - else - ADD_TC("/usr/share/misc/termcap", filecount); + copied = strdup(get_termpath()); + for (cp = copied; *cp; cp++) { + if (*cp == NCURSES_PATHSEP) + *cp = '\0'; + else if (cp == copied || cp[-1] == '\0') { + ADD_TC(cp, filecount); + } + } #define PRIVATE_CAP "%s/.termcap" @@ -1023,6 +1034,37 @@ _nc_read_termcap_entry } } + /* + * Probably /etc/termcap is a symlink to /usr/share/misc/termcap. + * Avoid reading the same file twice. + */ +#ifdef HAVE_LINK + for (j = 0; j < filecount; j++) { + bool omit = FALSE; + if (stat(termpaths[j], &test_stat[j]) != 0 + || (test_stat[j].st_mode & S_IFMT) != S_IFREG) { + omit = TRUE; + } else { + for (k = 0; k < j; k++) { + if (test_stat[k].st_dev == test_stat[j].st_dev + && test_stat[k].st_ino == test_stat[j].st_ino) { + omit = TRUE; + break; + } + } + } + if (omit) { + T(("Path %s is a duplicate", termpaths[j])); + for (k = j + 1; k < filecount; k++) { + termpaths[k - 1] = termpaths[k]; + test_stat[k - 1] = test_stat[k]; + } + --filecount; + --j; + } + } +#endif + /* parse the sources */ if (use_buffer) { _nc_set_source("TERMCAP"); @@ -1038,7 +1080,8 @@ _nc_read_termcap_entry for (i = 0; i < filecount; i++) { T(("Looking for %s in %s", tn, termpaths[i])); - if ((fp = fopen(termpaths[i], "r")) != (FILE *) 0) { + if (_nc_access(termpaths[i], R_OK) == 0 + && (fp = fopen(termpaths[i], "r")) != (FILE *) 0) { _nc_set_source(termpaths[i]); /* @@ -1052,6 +1095,8 @@ _nc_read_termcap_entry } } } + if (copied != 0) + free(copied); #endif /* USE_GETCAP */ if (_nc_head == 0) diff --git a/contrib/ncurses/ncurses/tinfo/write_entry.c b/contrib/ncurses/ncurses/tinfo/write_entry.c index ffcf402..9750dff 100644 --- a/contrib/ncurses/ncurses/tinfo/write_entry.c +++ b/contrib/ncurses/ncurses/tinfo/write_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2002 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -52,7 +52,7 @@ #define TRACE_OUT(p) /*nothing */ #endif -MODULE_ID("$Id: write_entry.c,v 1.56 2000/12/10 02:55:08 tom Exp $") +MODULE_ID("$Id: write_entry.c,v 1.58 2002/04/21 20:35:08 tom Exp $") static int total_written; @@ -214,6 +214,10 @@ _nc_write_entry(TERMTYPE * const tp) char linkname[PATH_MAX]; #if USE_SYMLINKS char symlinkname[PATH_MAX]; +#if !HAVE_LINK +#undef HAVE_LINK +#define HAVE_LINK 1 +#endif #endif /* USE_SYMLINKS */ static int call_count; static time_t start_time; /* time at start of writes */ @@ -361,10 +365,10 @@ _nc_write_entry(TERMTYPE * const tp) #define WRITE_STRING(str) (fwrite(str, sizeof(char), strlen(str) + 1, fp) == strlen(str) + 1) static int -compute_offsets(char **Strings, int strmax, short *offsets) +compute_offsets(char **Strings, unsigned strmax, short *offsets) { size_t nextfree = 0; - int i; + unsigned i; for (i = 0; i < strmax; i++) { if (Strings[i] == ABSENT_STRING) { @@ -381,9 +385,9 @@ compute_offsets(char **Strings, int strmax, short *offsets) } static void -convert_shorts(unsigned char *buf, short *Numbers, int count) +convert_shorts(unsigned char *buf, short *Numbers, unsigned count) { - int i; + unsigned 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; diff --git a/contrib/ncurses/ncurses/trace/lib_trace.c b/contrib/ncurses/ncurses/trace/lib_trace.c index 08790bb..29eecc0 100644 --- a/contrib/ncurses/ncurses/trace/lib_trace.c +++ b/contrib/ncurses/ncurses/trace/lib_trace.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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 <ctype.h> -MODULE_ID("$Id: lib_trace.c,v 1.38 2000/12/10 03:02:45 tom Exp $") +MODULE_ID("$Id: lib_trace.c,v 1.48 2001/10/20 20:35:25 tom Exp $") NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */ @@ -59,10 +59,10 @@ trace(const unsigned int tracelevel GCC_UNUSED) static bool been_here = FALSE; static char my_name[] = "trace"; - _nc_tracing = tracelevel; if (!been_here && tracelevel) { been_here = TRUE; + _nc_tracing = tracelevel; if (_nc_access(my_name, W_OK) < 0 || (tracefp = fopen(my_name, "wb")) == 0) { perror("curses: Can't open 'trace' file: "); @@ -77,73 +77,14 @@ trace(const unsigned int tracelevel GCC_UNUSED) #elif HAVE_SETBUF /* POSIX */ (void) setbuffer(tracefp, (char *) 0); #endif - _tracef("TRACING NCURSES version %s", curses_version()); + _tracef("TRACING NCURSES version %s (tracelevel=%#x)", + curses_version(), tracelevel); + } else if (_nc_tracing != tracelevel) { + _nc_tracing = tracelevel; + _tracef("tracelevel=%#x", tracelevel); } } -#endif - -NCURSES_EXPORT(const char *) -_nc_visbuf2(int bufnum, const char *buf) -/* visibilize a given string */ -{ - char *vbuf; - char *tp; - int c; - - if (buf == 0) - return ("(null)"); - if (buf == CANCELLED_STRING) - return ("(cancelled)"); - -#ifdef TRACE - tp = vbuf = _nc_trace_buf(bufnum, (strlen(buf) * 4) + 5); -#else - { - static char *mybuf[2]; - mybuf[bufnum] = _nc_doalloc(mybuf[bufnum], (strlen(buf) * 4) + 5); - tp = vbuf = mybuf[bufnum]; - } -#endif - *tp++ = '"'; - while ((c = *buf++) != '\0') { - if (c == '"') { - *tp++ = '\\'; - *tp++ = '"'; - } else if (is7bits(c) && (isgraph(c) || c == ' ')) { - *tp++ = c; - } else if (c == '\n') { - *tp++ = '\\'; - *tp++ = 'n'; - } else if (c == '\r') { - *tp++ = '\\'; - *tp++ = 'r'; - } else if (c == '\b') { - *tp++ = '\\'; - *tp++ = 'b'; - } else if (c == '\033') { - *tp++ = '\\'; - *tp++ = 'e'; - } else if (is7bits(c) && iscntrl(c)) { - *tp++ = '\\'; - *tp++ = '^'; - *tp++ = '@' + c; - } else { - sprintf(tp, "\\%03o", CharOf(c)); - tp += strlen(tp); - } - } - *tp++ = '"'; - *tp++ = '\0'; - return (vbuf); -} -NCURSES_EXPORT(const char *) -_nc_visbuf(const char *buf) -{ - return _nc_visbuf2(0, buf); -} - -#ifdef TRACE NCURSES_EXPORT(void) _tracef(const char *fmt,...) { @@ -208,6 +149,14 @@ _nc_retrace_ptr(char *code) return code; } +/* Trace 'SCREEN *' return-values */ +NCURSES_EXPORT(SCREEN *) +_nc_retrace_sp(SCREEN * code) +{ + T((T_RETURN("%p"), code)); + return code; +} + /* Trace 'WINDOW *' return-values */ NCURSES_EXPORT(WINDOW *) _nc_retrace_win(WINDOW *code) diff --git a/contrib/ncurses/ncurses/trace/lib_traceatr.c b/contrib/ncurses/ncurses/trace/lib_traceatr.c index 3584b6e..714e508 100644 --- a/contrib/ncurses/ncurses/trace/lib_traceatr.c +++ b/contrib/ncurses/ncurses/trace/lib_traceatr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2002 Free 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,8 @@ ****************************************************************************/ /**************************************************************************** - * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * + * Author: Thomas Dickey 1996-2001 * + * and: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ @@ -38,11 +39,15 @@ #include <curses.priv.h> #include <term.h> /* acs_chars */ -MODULE_ID("$Id: lib_traceatr.c,v 1.32 2000/12/10 03:02:45 tom Exp $") +MODULE_ID("$Id: lib_traceatr.c,v 1.41 2002/02/10 01:26:56 tom Exp $") #define COLOR_OF(c) (c < 0 || c > 7 ? "default" : colors[c].name) #ifdef TRACE + +static const char l_brace[] = {L_BRACE, 0}; +static const char r_brace[] = {R_BRACE, 0}; + NCURSES_EXPORT(char *) _traceattr2(int bufnum, attr_t newmode) { @@ -87,7 +92,7 @@ _traceattr2(int bufnum, attr_t newmode) unsigned save_nc_tracing = _nc_tracing; _nc_tracing = 0; - strcpy(tmp++, "{"); + strcpy(tmp++, l_brace); for (n = 0; n < SIZEOF(names); n++) { if ((newmode & names[n].val) != 0) { @@ -112,14 +117,14 @@ _traceattr2(int bufnum, attr_t newmode) } } } - if (AttrOf(newmode) == A_NORMAL) { + if (ChAttrOf(newmode) == A_NORMAL) { if (buf[1] != '\0') strcat(tmp, "|"); strcat(tmp, "A_NORMAL"); } _nc_tracing = save_nc_tracing; - return (strcat(buf, "}")); + return (strcat(buf, r_brace)); } NCURSES_EXPORT(char *) @@ -136,15 +141,14 @@ _nc_retrace_attr_t(attr_t code) return code; } -NCURSES_EXPORT(char *) -_tracechtype2(int bufnum, chtype ch) +const char * +_nc_altcharset_name(attr_t attr, chtype ch) { - char *buf = _nc_trace_buf(bufnum, BUFSIZ); - char *found = 0; + const char *result = 0; - strcpy(buf, "{"); - if (ch & A_ALTCHARSET) { + if (attr & A_ALTCHARSET) { char *cp; + char *found = 0; static const struct { unsigned int val; const char *name; @@ -189,32 +193,41 @@ _tracechtype2(int bufnum, chtype ch) *sp; for (cp = acs_chars; cp[0] && cp[1]; cp += 2) { - if (TextOf(cp[1]) == TextOf(ch)) { + if (ChCharOf(cp[1]) == ChCharOf(ch)) { found = cp; /* don't exit from loop - there may be redefinitions */ } } if (found != 0) { - ch = TextOf(*found); + ch = ChCharOf(*found); for (sp = names; sp->val; sp++) if (sp->val == ch) { - (void) strcat(buf, sp->name); - ch &= ~A_ALTCHARSET; + result = sp->name; break; } } } + return result; +} - if (found == 0) - (void) strcat(buf, _tracechar(TextOf(ch))); +NCURSES_EXPORT(char *) +_tracechtype2(int bufnum, chtype ch) +{ + char *buf = _nc_trace_buf(bufnum, BUFSIZ); + const char *found; - if (AttrOf(ch) != A_NORMAL) + strcpy(buf, l_brace); + if ((found = _nc_altcharset_name(ChAttrOf(ch), ch)) != 0) { + (void) strcat(buf, found); + } else + (void) strcat(buf, _tracechar(ChCharOf(ch))); + + if (ChAttrOf(ch) != A_NORMAL) (void) sprintf(buf + strlen(buf), " | %s", - _traceattr2(bufnum + 20, AttrOf(ch))); + _traceattr2(bufnum + 20, ChAttrOf(ch))); - strcat(buf, "}"); - return (buf); + return (strcat(buf, r_brace)); } NCURSES_EXPORT(char *) @@ -231,9 +244,55 @@ _nc_retrace_chtype (attr_t code) return code; } -#else -extern NCURSES_EXPORT(void) _nc_lib_traceatr (void); -NCURSES_EXPORT(void) _nc_lib_traceatr (void) +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(char *) +_tracecchar_t2 (int bufnum, const cchar_t *ch) { + char *buf = _nc_trace_buf(bufnum, BUFSIZ); + attr_t attr = AttrOfD(ch); + const char *found; + + strcpy(buf, l_brace); + if ((found = _nc_altcharset_name(attr, CharOfD(ch))) != 0) { + (void) strcat(buf, found); + attr &= ~A_ALTCHARSET; + } else if (!isnac(CHDEREF(ch))) { + PUTC_DATA; + int n; + + memset (&PUT_st, '\0', sizeof (PUT_st)); + PUTC_i = 0; + (void) strcat(buf, "{ "); + do { + PUTC_ch = PUTC_i < CCHARW_MAX ? ch->chars[PUTC_i] : L'\0'; + PUTC_n = wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st); + if (PUTC_ch == L'\0') + --PUTC_n; + if (PUTC_n <= 0) + break; + for (n = 0; n < PUTC_n; n++) { + if (n) + (void) strcat(buf, ", "); + (void) strcat(buf, _tracechar(UChar(PUTC_buf[n]))); + } + ++PUTC_i; + } while (PUTC_ch != L'\0'); + (void) strcat(buf, " }"); + } + if (attr != A_NORMAL) + (void) sprintf(buf + strlen(buf), " | %s", + _traceattr2(bufnum + 20, attr)); + + return (strcat(buf, r_brace)); } + +NCURSES_EXPORT(char *) +_tracecchar_t (const cchar_t *ch) +{ + return _tracecchar_t2(0, ch); +} +#endif + +#else +empty_module(_nc_lib_traceatr) #endif /* TRACE */ diff --git a/contrib/ncurses/ncurses/trace/lib_tracebits.c b/contrib/ncurses/ncurses/trace/lib_tracebits.c index 21a3b92..a2153d4 100644 --- a/contrib/ncurses/ncurses/trace/lib_tracebits.c +++ b/contrib/ncurses/ncurses/trace/lib_tracebits.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,7 +34,7 @@ #include <curses.priv.h> #include <term.h> /* cur_term */ -MODULE_ID("$Id: lib_tracebits.c,v 1.10 2001/03/24 21:58:23 tom Exp $") +MODULE_ID("$Id: lib_tracebits.c,v 1.11 2001/10/20 22:44:32 tom Exp $") #if SVR4_TERMIO && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE @@ -238,10 +238,5 @@ _nc_tracebits(void) return (buf); } #else -NCURSES_EXPORT(char *) -_nc_tracebits(void) -{ - static char tmp[] = ""; - return tmp; -} +empty_module(_nc_tracebits) #endif /* TRACE */ diff --git a/contrib/ncurses/ncurses/trace/lib_tracechr.c b/contrib/ncurses/ncurses/trace/lib_tracechr.c index a019969..5b7c90c 100644 --- a/contrib/ncurses/ncurses/trace/lib_tracechr.c +++ b/contrib/ncurses/ncurses/trace/lib_tracechr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2002 Free 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,22 +36,20 @@ */ #include <curses.priv.h> -MODULE_ID("$Id: lib_tracechr.c,v 1.4 2000/12/10 03:02:45 tom Exp $") +MODULE_ID("$Id: lib_tracechr.c,v 1.8 2002/02/10 01:26:04 tom Exp $") #ifdef TRACE NCURSES_EXPORT(char *) -_tracechar(const unsigned char ch) +_tracechar(int ch) { - static char crep[20]; - (void) sprintf(crep, "'%s' = 0x%02x", unctrl(ch), (unsigned) ch); + static char crep[40]; + (void) sprintf(crep, "'%.30s' = %#03o", + (ch > KEY_MIN) + ? keyname(ch) + : unctrl(ch), + (unsigned) ch); return (crep); } #else -extern -NCURSES_EXPORT(void) -_nc_lib_tracechr(void); -NCURSES_EXPORT(void) -_nc_lib_tracechr(void) -{ -} +empty_module(_nc_lib_tracechr) #endif diff --git a/contrib/ncurses/ncurses/trace/lib_tracedmp.c b/contrib/ncurses/ncurses/trace/lib_tracedmp.c index 22304ce..8f87536 100644 --- a/contrib/ncurses/ncurses/trace/lib_tracedmp.c +++ b/contrib/ncurses/ncurses/trace/lib_tracedmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free 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,8 @@ ****************************************************************************/ /**************************************************************************** - * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * + * Author: Thomas E. Dickey 1996-2001 * + * and: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ @@ -36,20 +37,24 @@ */ #include <curses.priv.h> +#include <ctype.h> -MODULE_ID("$Id: lib_tracedmp.c,v 1.16 2000/12/10 03:02:45 tom Exp $") +MODULE_ID("$Id: lib_tracedmp.c,v 1.22 2001/11/03 15:45:35 tom Exp $") #ifdef TRACE NCURSES_EXPORT(void) _tracedump(const char *name, WINDOW *win) { + static char *buf = 0; + static size_t used = 0; + int i, j, n, width; /* compute narrowest possible display width */ - for (width = i = 0; i <= win->_maxy; i++) { + for (width = i = 0; i <= win->_maxy; ++i) { n = 0; - for (j = 0; j <= win->_maxx; j++) - if (win->_line[i].text[j] != ' ') + for (j = 0; j <= win->_maxx; ++j) + if (CharOf(win->_line[i].text[j]) != L(' ')) n = j; if (n > width) @@ -57,73 +62,83 @@ _tracedump(const char *name, WINDOW *win) } if (width < win->_maxx) ++width; + if (++width + 1 > (int) used) { + used = 2 * (width + 1); + buf = _nc_doalloc(buf, used); + } - for (n = 0; n <= win->_maxy; n++) { - char buf[BUFSIZ], *ep; + for (n = 0; n <= win->_maxy; ++n) { + char *ep = buf; bool haveattrs, havecolors; - /* dump A_CHARTEXT part */ - (void) sprintf(buf, "%s[%2d] %3d%3d ='", - name, n, - win->_line[n].firstchar, - win->_line[n].lastchar); - ep = buf + strlen(buf); - for (j = 0; j <= width; j++) { - ep[j] = TextOf(win->_line[n].text[j]); - if (ep[j] == 0) - ep[j] = '.'; + /* + * Dump A_CHARTEXT part. It is more important to make the grid line up + * in the trace file than to represent control- and wide-characters, so + * we map those to '.' and '?' respectively. + */ + for (j = 0; j < width; ++j) { + chtype test = CharOf(win->_line[n].text[j]); + ep[j] = (UChar(test) == test +#if USE_WIDEC_SUPPORT + && (win->_line[n].text[j].chars[1] == 0) +#endif + ) + ? (iscntrl(UChar(test)) + ? '.' + : UChar(test)) + : '?'; } - ep[j] = '\''; - ep[j + 1] = '\0'; - _tracef("%s", buf); + ep[j] = '\0'; + _tracef("%s[%2d] %3d%3d ='%s'", + name, n, + win->_line[n].firstchar, + win->_line[n].lastchar, + ep); /* dump A_COLOR part, will screw up if there are more than 96 */ havecolors = FALSE; - for (j = 0; j <= width; j++) - if (win->_line[n].text[j] & A_COLOR) { + for (j = 0; j < width; ++j) + if (AttrOf(win->_line[n].text[j]) & A_COLOR) { havecolors = TRUE; break; } if (havecolors) { - (void) sprintf(buf, "%*s[%2d]%*s='", (int) strlen(name), - "colors", n, 8, " "); - ep = buf + strlen(buf); - for (j = 0; j <= width; j++) - ep[j] = CharOf(win->_line[n].text[j] >> 8) + ' '; - ep[j] = '\''; - ep[j + 1] = '\0'; - _tracef("%s", buf); + ep = buf; + for (j = 0; j < width; ++j) + ep[j] = UChar(CharOf(win->_line[n].text[j]) >> + NCURSES_ATTR_SHIFT) + ' '; + ep[j] = '\0'; + _tracef("%*s[%2d]%*s='%s'", (int) strlen(name), + "colors", n, 8, " ", buf); } - for (i = 0; i < 4; i++) { + for (i = 0; i < 4; ++i) { const char *hex = " 123456789ABCDEF"; - chtype mask = (0xf << ((i + 4) * 4)); + attr_t mask = (0xf << ((i + 4) * 4)); haveattrs = FALSE; - for (j = 0; j <= width; j++) - if (win->_line[n].text[j] & mask) { + for (j = 0; j < width; ++j) + if (AttrOf(win->_line[n].text[j]) & mask) { haveattrs = TRUE; break; } if (haveattrs) { - (void) sprintf(buf, "%*s%d[%2d]%*s='", (int) strlen(name) - - 1, "attrs", i, n, 8, " "); - ep = buf + strlen(buf); - for (j = 0; j <= width; j++) - ep[j] = hex[(win->_line[n].text[j] & mask) >> ((i + 4) * 4)]; - ep[j] = '\''; - ep[j + 1] = '\0'; - _tracef("%s", buf); + ep = buf; + for (j = 0; j < width; ++j) + ep[j] = hex[(AttrOf(win->_line[n].text[j]) & mask) >> + ((i + 4) * 4)]; + ep[j] = '\0'; + _tracef("%*s%d[%2d]%*s='%s'", (int) strlen(name) - + 1, "attrs", i, n, 8, " ", buf); } } } +#if NO_LEAKS + free(buf); + used = 0; +#endif } + #else -extern -NCURSES_EXPORT(void) -_nc_lib_tracedmp(void); -NCURSES_EXPORT(void) -_nc_lib_tracedmp(void) -{ -} +empty_module(_nc_lib_tracedmp) #endif /* TRACE */ diff --git a/contrib/ncurses/ncurses/trace/lib_tracemse.c b/contrib/ncurses/ncurses/trace/lib_tracemse.c index 38dd57e..f4a100b 100644 --- a/contrib/ncurses/ncurses/trace/lib_tracemse.c +++ b/contrib/ncurses/ncurses/trace/lib_tracemse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001,2002 Free 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> -MODULE_ID("$Id: lib_tracemse.c,v 1.8 2000/12/10 03:02:45 tom Exp $") +MODULE_ID("$Id: lib_tracemse.c,v 1.10 2002/01/12 22:32:25 tom Exp $") #ifdef TRACE @@ -49,50 +49,44 @@ _tracemouse(MEVENT const *ep) (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {", ep->id, ep->x, ep->y, ep->z, ep->bstate); -#define SHOW(m, s) if ((ep->bstate & m)==m) {strcat(buf,s); strcat(buf, ", ");} - SHOW(BUTTON1_RELEASED, "release-1") - SHOW(BUTTON1_PRESSED, "press-1") - SHOW(BUTTON1_CLICKED, "click-1") - SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1") - SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1") - SHOW(BUTTON1_RESERVED_EVENT, "reserved-1") - SHOW(BUTTON2_RELEASED, "release-2") - SHOW(BUTTON2_PRESSED, "press-2") - SHOW(BUTTON2_CLICKED, "click-2") - SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2") - SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2") - SHOW(BUTTON2_RESERVED_EVENT, "reserved-2") - SHOW(BUTTON3_RELEASED, "release-3") - SHOW(BUTTON3_PRESSED, "press-3") - SHOW(BUTTON3_CLICKED, "click-3") - SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3") - SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3") - SHOW(BUTTON3_RESERVED_EVENT, "reserved-3") - SHOW(BUTTON4_RELEASED, "release-4") - SHOW(BUTTON4_PRESSED, "press-4") - SHOW(BUTTON4_CLICKED, "click-4") - SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4") - SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4") - SHOW(BUTTON4_RESERVED_EVENT, "reserved-4") - SHOW(BUTTON_CTRL, "ctrl") - SHOW(BUTTON_SHIFT, "shift") - SHOW(BUTTON_ALT, "alt") - SHOW(ALL_MOUSE_EVENTS, "all-events") - SHOW(REPORT_MOUSE_POSITION, "position") +#define SHOW(m, s) if ((ep->bstate & m) == m) strcat(strcat(buf, s), ", ") + SHOW(BUTTON1_RELEASED, "release-1"); + SHOW(BUTTON1_PRESSED, "press-1"); + SHOW(BUTTON1_CLICKED, "click-1"); + SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1"); + SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1"); + SHOW(BUTTON1_RESERVED_EVENT, "reserved-1"); + SHOW(BUTTON2_RELEASED, "release-2"); + SHOW(BUTTON2_PRESSED, "press-2"); + SHOW(BUTTON2_CLICKED, "click-2"); + SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2"); + SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2"); + SHOW(BUTTON2_RESERVED_EVENT, "reserved-2"); + SHOW(BUTTON3_RELEASED, "release-3"); + SHOW(BUTTON3_PRESSED, "press-3"); + SHOW(BUTTON3_CLICKED, "click-3"); + SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3"); + SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3"); + SHOW(BUTTON3_RESERVED_EVENT, "reserved-3"); + SHOW(BUTTON4_RELEASED, "release-4"); + SHOW(BUTTON4_PRESSED, "press-4"); + SHOW(BUTTON4_CLICKED, "click-4"); + SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4"); + SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4"); + SHOW(BUTTON4_RESERVED_EVENT, "reserved-4"); + SHOW(BUTTON_CTRL, "ctrl"); + SHOW(BUTTON_SHIFT, "shift"); + SHOW(BUTTON_ALT, "alt"); + SHOW(ALL_MOUSE_EVENTS, "all-events"); + SHOW(REPORT_MOUSE_POSITION, "position"); #undef SHOW - if (buf[strlen(buf) - 1] == ' ') + if (buf[strlen(buf) - 1] == ' ') buf[strlen(buf) - 2] = '\0'; (void) strcat(buf, "}"); return (buf); } #else /* !TRACE */ -/* don't make empty module */ -NCURSES_EXPORT(void) -_nc_lib_tracemouse(void); -NCURSES_EXPORT(void) -_nc_lib_tracemouse(void) -{ -} +empty_module(_nc_lib_tracemouse) #endif diff --git a/contrib/ncurses/ncurses/trace/trace_tries.c b/contrib/ncurses/ncurses/trace/trace_tries.c index fdf3a09..d703322 100644 --- a/contrib/ncurses/ncurses/trace/trace_tries.c +++ b/contrib/ncurses/ncurses/trace/trace_tries.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000,2001 Free 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: trace_tries.c,v 1.8 2000/12/10 03:03:51 tom Exp $") +MODULE_ID("$Id: trace_tries.c,v 1.10 2001/10/20 22:42:51 tom Exp $") #ifdef TRACE static unsigned char *buffer; @@ -72,8 +72,5 @@ _nc_trace_tries(struct tries *tree) } #else -NCURSES_EXPORT(void) -_nc_trace_tries(struct tries *tree GCC_UNUSED) -{ -} +empty_module(_nc_trace_tries) #endif diff --git a/contrib/ncurses/ncurses/trace/varargs.c b/contrib/ncurses/ncurses/trace/varargs.c new file mode 100644 index 0000000..7a1a742 --- /dev/null +++ b/contrib/ncurses/ncurses/trace/varargs.c @@ -0,0 +1,171 @@ +/**************************************************************************** + * Copyright (c) 2001 Free 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 2001 * + ****************************************************************************/ + +#include <curses.priv.h> + +#include <ctype.h> + +MODULE_ID("$Id: varargs.c,v 1.1 2001/10/20 20:37:48 tom Exp $") + +#ifdef TRACE + +typedef enum { + atUnknown = 0, atInteger, atFloat, atPoint, atString +} ARGTYPE; + +#define VA_INT(type) ival = va_arg(ap, type) +#define VA_FLT(type) fval = va_arg(ap, type) +#define VA_PTR(type) pval = (void *)va_arg(ap, type) +#define VA_STR(type) sval = va_arg(ap, type) + +/* + * Returns a string that represents the parameter list of a printf-style call. + */ +NCURSES_EXPORT(char *) +_nc_varargs(const char *fmt, va_list ap) +{ + static char *result_buf; + static size_t result_len; + + char buffer[BUFSIZ]; + + if (fmt == 0 || *fmt == '\0') + return ""; + if (result_len == 0) + result_buf = typeMalloc(char, result_len = BUFSIZ); + if (result_buf == 0) + return ""; + *result_buf = '\0'; + + while (*fmt != '\0') { + if (*fmt == '%') { + char *pval = 0; /* avoid const-cast */ + const char *sval = ""; + double fval = 0.0; + int done = FALSE; + int ival = 0; + int type = 0; + ARGTYPE used = atUnknown; + + while (*++fmt != '\0' && !done) { + + if (*fmt == '*') { + VA_INT(int); + used = atInteger; + break; + } else if (isalpha(UChar(*fmt))) { + done = TRUE; + switch (*fmt) { + case 'Z': /* FALLTHRU */ + case 'h': /* FALLTHRU */ + case 'l': /* FALLTHRU */ + done = FALSE; + type = *fmt; + break; + case 'i': /* FALLTHRU */ + case 'd': /* FALLTHRU */ + case 'u': /* FALLTHRU */ + case 'x': /* FALLTHRU */ + case 'X': /* FALLTHRU */ + if (type == 'l') + VA_INT(long); + else if (type == 'Z') + VA_INT(size_t); + else + VA_INT(int); + used = atInteger; + break; + case 'f': /* FALLTHRU */ + case 'e': /* FALLTHRU */ + case 'E': /* FALLTHRU */ + case 'g': /* FALLTHRU */ + case 'G': /* FALLTHRU */ + VA_FLT(double); + used = atFloat; + break; + case 'c': + VA_INT(int); + used = atInteger; + break; + case 's': + VA_STR(const char *); + used = atString; + break; + case 'p': + VA_PTR(void *); + used = atPoint; + break; + case 'n': + VA_PTR(int *); + used = atPoint; + break; + default: + break; + } + } else if (*fmt == '%') { + done = TRUE; + } + if (used != atUnknown) { + const char *param = buffer; + switch (used) { + case atInteger: + sprintf(buffer, "%d", ival); + break; + case atFloat: + sprintf(buffer, "%f", fval); + break; + case atPoint: + sprintf(buffer, "%p", pval); + break; + case atString: + param = _nc_visbuf2(1, sval); + break; + default: + strcpy(buffer, "?"); + break; + } + result_len += strlen(param) + 2; + result_buf = typeRealloc(char, result_len, result_buf); + sprintf(result_buf + strlen(result_buf), ",%s", param); + used = atUnknown; + } + } + } else { + fmt++; + } + } + + return (result_buf); +} +#else +empty_module(_nc_varargs) +#endif diff --git a/contrib/ncurses/ncurses/trace/visbuf.c b/contrib/ncurses/ncurses/trace/visbuf.c new file mode 100644 index 0000000..5f2460f --- /dev/null +++ b/contrib/ncurses/ncurses/trace/visbuf.c @@ -0,0 +1,232 @@ +/**************************************************************************** + * Copyright (c) 2001 Free 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 1996-2001 * + * and: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* + * visbuf.c - Tracing/Debugging support routines + */ + +#include <curses.priv.h> + +#include <tic.h> +#include <ctype.h> + +MODULE_ID("$Id: visbuf.c,v 1.3 2001/11/10 23:47:51 tom Exp $") + +static char * +_nc_vischar(char *tp, unsigned c) +{ + if (c == '"' || c == '\\') { + *tp++ = '\\'; + *tp++ = c; + } else if (is7bits(c) && (isgraph(c) || c == ' ')) { + *tp++ = c; + } else if (c == '\n') { + *tp++ = '\\'; + *tp++ = 'n'; + } else if (c == '\r') { + *tp++ = '\\'; + *tp++ = 'r'; + } else if (c == '\b') { + *tp++ = '\\'; + *tp++ = 'b'; + } else if (c == '\033') { + *tp++ = '\\'; + *tp++ = 'e'; + } else if (is7bits(c) && iscntrl(UChar(c))) { + *tp++ = '\\'; + *tp++ = '^'; + *tp++ = '@' + c; + } else { + sprintf(tp, "\\%03lo", ChCharOf(c)); + tp += strlen(tp); + } + return tp; +} + +NCURSES_EXPORT(const char *) +_nc_visbuf2(int bufnum, const char *buf) +{ + char *vbuf; + char *tp; + int c; + + if (buf == 0) + return ("(null)"); + if (buf == CANCELLED_STRING) + return ("(cancelled)"); + +#ifdef TRACE + tp = vbuf = _nc_trace_buf(bufnum, (strlen(buf) * 4) + 5); +#else + { + static char *mybuf[2]; + mybuf[bufnum] = _nc_doalloc(mybuf[bufnum], (strlen(buf) * 4) + 5); + tp = vbuf = mybuf[bufnum]; + } +#endif + *tp++ = D_QUOTE; + while ((c = *buf++) != '\0') { + tp = _nc_vischar(tp, UChar(c)); + } + *tp++ = D_QUOTE; + *tp++ = '\0'; + return (vbuf); +} + +NCURSES_EXPORT(const char *) +_nc_visbuf(const char *buf) +{ + return _nc_visbuf2(0, buf); +} + +#if USE_WIDEC_SUPPORT +#ifdef TRACE +NCURSES_EXPORT(const char *) +_nc_viswbuf2(int bufnum, const wchar_t * buf) +{ + char *vbuf; + char *tp; + int c; + + if (buf == 0) + return ("(null)"); + +#ifdef TRACE + tp = vbuf = _nc_trace_buf(bufnum, (wcslen(buf) * 4) + 5); +#else + { + static char *mybuf[2]; + mybuf[bufnum] = _nc_doalloc(mybuf[bufnum], (wcslen(buf) * 4) + 5); + tp = vbuf = mybuf[bufnum]; + } +#endif + *tp++ = D_QUOTE; + while ((c = *buf++) != '\0') { + tp = _nc_vischar(tp, ChCharOf(c)); + } + *tp++ = D_QUOTE; + *tp++ = '\0'; + return (vbuf); +} + +NCURSES_EXPORT(const char *) +_nc_viswbuf(const wchar_t * buf) +{ + return _nc_viswbuf2(0, buf); +} + +NCURSES_EXPORT(const char *) +_nc_viscbuf2(int bufnum, const cchar_t * buf, int len) +{ + size_t have = BUFSIZ; + char *result = _nc_trace_buf(bufnum, have); + char *tp = result; + int n; + bool same = TRUE; + attr_t attr = A_NORMAL; + const char *found; + + if (len < 0) + len = _nc_wchstrlen(buf); + + for (n = 1; n < len; n++) { + if (AttrOf(buf[n]) != AttrOf(buf[0])) { + same = FALSE; + break; + } + } + + /* + * If the rendition is the same for the whole string, display it as a + * quoted string, followed by the rendition. Otherwise, use the more + * detailed trace function that displays each character separately. + */ + if (same) { + *tp++ = D_QUOTE; + while (len-- > 0) { + if ((found = _nc_altcharset_name(attr, CharOfD(buf))) != 0) { + (void) strcpy(tp, found); + tp += strlen(tp); + attr &= ~A_ALTCHARSET; + } else if (!isnac(CHDEREF(buf))) { + PUTC_DATA; + + memset(&PUT_st, '\0', sizeof(PUT_st)); + PUTC_i = 0; + do { + PUTC_ch = PUTC_i < CCHARW_MAX ? buf->chars[PUTC_i] : L'\0'; + PUTC_n = wcrtomb(PUTC_buf, buf->chars[PUTC_i], &PUT_st); + if (PUTC_ch == L'\0') + --PUTC_n; + if (PUTC_n <= 0) + break; + for (n = 0; n < PUTC_n; n++) { + tp = _nc_vischar(tp, UChar(PUTC_buf[n])); + } + ++PUTC_i; + } while (PUTC_ch != L'\0'); + } + buf++; + } + *tp++ = D_QUOTE; + *tp++ = '\0'; + if (attr != A_NORMAL) + (void) sprintf(tp, " | %s", + _traceattr2(bufnum + 20, attr)); + } else { + *tp++ = L_BRACE; + while (len-- > 0) { + char *temp = _tracecchar_t2(bufnum + 20, buf++); + size_t used = (tp - result); + size_t want = strlen(temp) + 5 + used; + if (want > have) { + result = _nc_trace_buf(bufnum, have = want); + tp = result + used; + } + (void) strcpy(tp, temp); + tp += strlen(tp); + } + *tp++ = R_BRACE; + *tp++ = '\0'; + } + return result; +} + +NCURSES_EXPORT(const char *) +_nc_viscbuf(const cchar_t * buf, int len) +{ + return _nc_viscbuf2(0, buf, len); +} +#endif /* TRACE */ +#endif /* USE_WIDEC_SUPPORT */ diff --git a/contrib/ncurses/ncurses/tty/hashmap.c b/contrib/ncurses/ncurses/tty/hashmap.c index 6d3d61d..1c30526 100644 --- a/contrib/ncurses/ncurses/tty/hashmap.c +++ b/contrib/ncurses/ncurses/tty/hashmap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -70,7 +70,7 @@ AUTHOR #include <curses.priv.h> #include <term.h> /* for back_color_erase */ -MODULE_ID("$Id: hashmap.c,v 1.36 2000/12/10 03:04:30 tom Exp $") +MODULE_ID("$Id: hashmap.c,v 1.45 2001/12/19 01:06:49 tom Exp $") #ifdef HASHDEBUG @@ -97,47 +97,56 @@ static chtype oldtext[MAXLINES][TEXTWIDTH], newtext[MAXLINES][TEXTWIDTH]; #endif /* !HASHDEBUG */ -#define oldhash (SP->oldhash) -#define newhash (SP->newhash) +#define oldhash (SP->oldhash) +#define newhash (SP->newhash) +#define hashtab (SP->hashtab) +#define lines_alloc (SP->hashtab_len) + +#if USE_WIDEC_SUPPORT +#define HASH_VAL(ch) (ch.chars[0]) +#else +#define HASH_VAL(ch) (ch) +#endif static inline unsigned long -hash(chtype * text) +hash(NCURSES_CH_T * text) { int i; - chtype ch; + NCURSES_CH_T ch; unsigned long result = 0; for (i = TEXTWIDTH; i > 0; i--) { ch = *text++; - result += (result << 5) + ch; + result += (result << 5) + HASH_VAL(ch); } return result; } /* approximate update cost */ static int -update_cost(chtype * from, chtype * to) +update_cost(NCURSES_CH_T * from, NCURSES_CH_T * to) { int cost = 0; int i; for (i = TEXTWIDTH; i > 0; i--) - if (*from++ != *to++) + if (!(CharEq(*from++, *to++))) cost++; return cost; } + static int -update_cost_from_blank(chtype * to) +update_cost_from_blank(NCURSES_CH_T * to) { int cost = 0; int i; - chtype blank = BLANK; + NCURSES_CH_T blank = NewChar2(BLANK_TEXT, BLANK_ATTR); if (back_color_erase) - blank |= (stdscr->_bkgd & A_COLOR); + AddAttr(blank, (AttrOf(stdscr->_nc_bkgd) & A_COLOR)); for (i = TEXTWIDTH; i > 0; i--) - if (blank != *to++) + if (!(CharEq(blank, *to++))) cost++; return cost; @@ -171,15 +180,6 @@ cost_effective(const int from, const int to, const bool blank) + update_cost(OLDTEXT(from), NEWTEXT(to)))) ? TRUE : FALSE; } -typedef struct { - unsigned long hashval; - int oldcount, newcount; - int oldindex, newindex; -} sym; - -static sym *hashtab = 0; -static int lines_alloc = 0; - static void grow_hunks(void) { @@ -267,14 +267,14 @@ grow_hunks(void) NCURSES_EXPORT(void) _nc_hash_map(void) { - sym *sp; + HASHMAP *sp; register int i; int start, shift, size; if (screen_lines > lines_alloc) { if (hashtab) free(hashtab); - hashtab = typeMalloc(sym, (screen_lines + 1) * 2); + hashtab = typeMalloc(HASHMAP, (screen_lines + 1) * 2); if (!hashtab) { if (oldhash) { FreeAndNull(oldhash); @@ -387,11 +387,6 @@ _nc_hash_map(void) /* After clearing invalid hunks, try grow the rest. */ grow_hunks(); - -#if NO_LEAKS - FreeAndNull(hashtab); - lines_alloc = 0; -#endif } NCURSES_EXPORT(void) @@ -404,7 +399,7 @@ _nc_make_oldhash(int i) NCURSES_EXPORT(void) _nc_scroll_oldhash(int n, int top, int bot) { - int size; + size_t size; int i; if (!oldhash) diff --git a/contrib/ncurses/ncurses/tty/lib_mvcur.c b/contrib/ncurses/ncurses/tty/lib_mvcur.c index cb7a5ce..89b503f 100644 --- a/contrib/ncurses/ncurses/tty/lib_mvcur.c +++ b/contrib/ncurses/ncurses/tty/lib_mvcur.c @@ -152,7 +152,7 @@ #include <term.h> #include <ctype.h> -MODULE_ID("$Id: lib_mvcur.c,v 1.78 2001/04/14 22:26:14 tom Exp $") +MODULE_ID("$Id: lib_mvcur.c,v 1.85 2001/06/03 01:48:29 skimo Exp $") #define CURRENT_ROW SP->_cursrow /* phys cursor row */ #define CURRENT_COLUMN SP->_curscol /* phys cursor column */ @@ -207,8 +207,7 @@ trace_normalized_cost(const char *capname, const char *cap, int affcnt) #endif NCURSES_EXPORT(int) -_nc_msec_cost -(const char *const cap, int affcnt) +_nc_msec_cost(const char *const cap, int affcnt) /* compute the cost of a given operation */ { if (cap == 0) @@ -223,11 +222,11 @@ _nc_msec_cost float number = 0.0; for (cp += 2; *cp != '>'; cp++) { - if (isdigit(CharOf(*cp))) + if (isdigit(UChar(*cp))) number = number * 10 + (*cp - '0'); else if (*cp == '*') number *= affcnt; - else if (*cp == '.' && (*++cp != '>') && isdigit(CharOf(*cp))) + else if (*cp == '.' && (*++cp != '>') && isdigit(UChar(*cp))) number += (*cp - '0') / 10.0; } @@ -499,7 +498,9 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int vcost = SP->_cud_cost; } - if (cursor_down && (n * SP->_cud1_cost < vcost)) { + if (cursor_down + && (*cursor_down != '\n' || SP->_nl) + && (n * SP->_cud1_cost < vcost)) { vcost = repeated_append(_nc_str_copy(target, &save), 0, SP->_cud1_cost, n, cursor_down); } @@ -584,7 +585,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' - && isdigit(TextOf(WANT_CHAR(to_y, from_x)))) + && isdigit(CharOf(WANT_CHAR(to_y, from_x)))) ovw = FALSE; #endif /* @@ -599,11 +600,10 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int int i; for (i = 0; i < n; i++) { - chtype ch = WANT_CHAR(to_y, from_x + i); - if ((ch & A_ATTRIBUTES) != CURRENT_ATTR + NCURSES_CH_T ch = WANT_CHAR(to_y, from_x + i); + if (AttrOf(ch) != CURRENT_ATTR #if USE_WIDEC_SUPPORT - || (TextOf(ch) >= 0x80 - && SP->_outch == _nc_utf8_outch) + || !Charable(ch) #endif ) { ovw = FALSE; @@ -615,7 +615,7 @@ 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++ = WANT_CHAR(to_y, from_x + i); + *check.s_tail++ = CharOf(WANT_CHAR(to_y, from_x + i)); *check.s_tail = '\0'; check.s_size -= n; lhcost += n * SP->_char_padding; @@ -837,14 +837,17 @@ onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw) } NCURSES_EXPORT(int) -mvcur -(int yold, int xold, int ynew, int xnew) +mvcur(int yold, int xold, int ynew, int xnew) /* optimized cursor move from (yold, xold) to (ynew, xnew) */ { - TR(TRACE_MOVE, ("mvcur(%d,%d,%d,%d) called", yold, xold, ynew, xnew)); + TR(TRACE_CALLS | TRACE_MOVE, (T_CALLED("mvcur(%d,%d,%d,%d)"), + yold, xold, ynew, xnew)); + + if (SP == 0) + returnCode(ERR); if (yold == ynew && xold == xnew) - return (OK); + returnCode(OK); /* * Most work here is rounding for terminal boundaries getting the @@ -859,26 +862,35 @@ mvcur if (xold >= screen_columns) { int l; - l = (xold + 1) / screen_columns; - yold += l; - if (yold >= screen_lines) - l -= (yold - screen_lines - 1); + if (SP->_nl) { + l = (xold + 1) / screen_columns; + yold += l; + if (yold >= screen_lines) + l -= (yold - screen_lines - 1); - while (l > 0) { - if (newline) { - TPUTS_TRACE("newline"); - tputs(newline, 0, _nc_outch); - } else - putchar('\n'); - l--; - if (xold > 0) { - if (carriage_return) { - TPUTS_TRACE("carriage_return"); - tputs(carriage_return, 0, _nc_outch); + while (l > 0) { + if (newline) { + TPUTS_TRACE("newline"); + tputs(newline, 0, _nc_outch); } else - putchar('\r'); - xold = 0; + putchar('\n'); + l--; + if (xold > 0) { + if (carriage_return) { + TPUTS_TRACE("carriage_return"); + tputs(carriage_return, 0, _nc_outch); + } else + putchar('\r'); + xold = 0; + } } + } else { + /* + * If caller set nonl(), we cannot really use newlines to position + * to the next row. + */ + xold = -1; + yold = -1; } } @@ -888,11 +900,12 @@ mvcur ynew = screen_lines - 1; /* destination location is on screen now */ - return (onscreen_mvcur(yold, xold, ynew, xnew, TRUE)); + returnCode(onscreen_mvcur(yold, xold, ynew, xnew, TRUE)); } #if defined(TRACE) || defined(NCURSES_TEST) -NCURSES_EXPORT_VAR(int) _nc_optimize_enable = OPTIMIZE_ALL; +NCURSES_EXPORT_VAR(int) +_nc_optimize_enable = OPTIMIZE_ALL; #endif #if defined(MAIN) || defined(NCURSES_TEST) @@ -912,8 +925,7 @@ _nc_progname = "mvcur"; /* these override lib_tputs.c */ NCURSES_EXPORT(int) -tputs -(const char *string, int affcnt GCC_UNUSED, int (*outc) (int) GCC_UNUSED) +tputs(const char *string, int affcnt GCC_UNUSED, int (*outc) (int) GCC_UNUSED) /* stub tputs() that dumps sequences in a visible form */ { if (profiling) @@ -938,8 +950,7 @@ _nc_outch(int ch) NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */ NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */ -NCURSES_EXPORT_VAR(int) -_nc_nulls_sent = 0; /* used by 'tack' program */ +NCURSES_EXPORT_VAR(int) _nc_nulls_sent = 0; /* used by 'tack' program */ NCURSES_EXPORT(int) delay_output(int ms GCC_UNUSED) diff --git a/contrib/ncurses/ncurses/tty/lib_tstp.c b/contrib/ncurses/ncurses/tty/lib_tstp.c index ba146a0..c850e41 100644 --- a/contrib/ncurses/ncurses/tty/lib_tstp.c +++ b/contrib/ncurses/ncurses/tty/lib_tstp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2002 Free 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 Dickey 1995-2001 * ****************************************************************************/ /* @@ -37,17 +38,15 @@ ** The routine _nc_signal_handler(). ** */ - #include <curses.priv.h> -#include <signal.h> #include <SigAction.h> #if SVR4_ACTION && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE #endif -MODULE_ID("$Id: lib_tstp.c,v 1.24 2000/12/10 03:04:30 tom Exp $") +MODULE_ID("$Id: lib_tstp.c,v 1.30 2002/05/18 19:55:38 tom Exp $") #if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC) #define USE_SIGTSTP 1 @@ -55,6 +54,41 @@ MODULE_ID("$Id: lib_tstp.c,v 1.24 2000/12/10 03:04:30 tom Exp $") #define USE_SIGTSTP 0 #endif +#ifdef TRACE +static const char * +signal_name(int sig) +{ + switch (sig) { + case SIGALRM: + return "SIGALRM"; +#ifdef SIGCONT + case SIGCONT: + return "SIGCONT"; +#endif + case SIGINT: + return "SIGINT"; + case SIGQUIT: + return "SIGQUIT"; + case SIGTERM: + return "SIGTERM"; +#ifdef SIGTSTP + case SIGTSTP: + return "SIGTSTP"; +#endif +#ifdef SIGTTOU + case SIGTTOU: + return "SIGTTOU"; +#endif +#ifdef SIGWINCH + case SIGWINCH: + return "SIGWINCH"; +#endif + default: + return "unknown signal"; + } +} +#endif + /* * Note: This code is fragile! Its problem is that different OSs * handle restart of system calls interrupted by signals differently. @@ -215,7 +249,7 @@ cleanup(int sig) sigemptyset(&act.sa_mask); act.sa_flags = 0; act.sa_handler = SIG_IGN; - if (sigaction(sig, &act, (sigaction_t *) 0) == 0) + if (sigaction(sig, &act, NULL) == 0) #else if (signal(sig, SIG_IGN) != SIG_ERR) #endif @@ -255,43 +289,57 @@ sigwinch(int sig GCC_UNUSED) * If the given signal is still in its default state, set it to the given * handler. */ -#if HAVE_SIGACTION || HAVE_SIGVEC static int -CatchIfDefault(int sig, sigaction_t * act) +CatchIfDefault(int sig, RETSIGTYPE (*handler) (int)) { + int result; +#if HAVE_SIGACTION || HAVE_SIGVEC sigaction_t old_act; + sigaction_t new_act; + + memset(&new_act, 0, sizeof(new_act)); + sigemptyset(&new_act.sa_mask); +#ifdef SA_RESTART +#ifdef SIGWINCH + if (sig != SIGWINCH) +#endif + new_act.sa_flags |= SA_RESTART; +#endif /* SA_RESTART */ + new_act.sa_handler = handler; - if (sigaction(sig, (sigaction_t *) 0, &old_act) == 0 + if (sigaction(sig, NULL, &old_act) == 0 && (old_act.sa_handler == SIG_DFL + || old_act.sa_handler == handler #if USE_SIGWINCH || (sig == SIGWINCH && old_act.sa_handler == SIG_IGN) #endif )) { - (void) sigaction(sig, act, (sigaction_t *) 0); - return TRUE; + (void) sigaction(sig, &new_act, NULL); + result = TRUE; + } else { + result = FALSE; } - return FALSE; -} -#else -static int -CatchIfDefault(int sig, RETSIGTYPE(*handler) (int)) -{ - void (*ohandler) (int); +#else /* !HAVE_SIGACTION */ + RETSIGTYPE (*ohandler) (int); ohandler = signal(sig, SIG_IGN); if (ohandler == SIG_DFL + || ohandler == handler #if USE_SIGWINCH || (sig == SIGWINCH && ohandler == SIG_IGN) #endif ) { signal(sig, handler); - return TRUE; + result = TRUE; } else { signal(sig, ohandler); - return FALSE; + result = FALSE; } -} #endif + T(("CatchIfDefault - will %scatch %s", + result ? "" : "not ", signal_name(sig))); + return result; +} /* * This is invoked once at the beginning (e.g., from 'initscr()'), to @@ -307,60 +355,45 @@ CatchIfDefault(int sig, RETSIGTYPE(*handler) (int)) NCURSES_EXPORT(void) _nc_signal_handler(bool enable) { -#if USE_SIGTSTP /* Xenix 2.x doesn't have SIGTSTP, for example */ - static sigaction_t act, oact; - static int ignore; - - if (!ignore) { - if (!enable) { - act.sa_handler = SIG_IGN; - sigaction(SIGTSTP, &act, &oact); - } else if (act.sa_handler) { - sigaction(SIGTSTP, &oact, NULL); - } else { /*initialize */ - sigemptyset(&act.sa_mask); - act.sa_flags = 0; -#if USE_SIGWINCH - act.sa_handler = sigwinch; - CatchIfDefault(SIGWINCH, &act); -#endif + static bool initialized = FALSE; + T((T_CALLED("_nc_signal_handler(%d)"), enable)); +#if USE_SIGTSTP /* Xenix 2.x doesn't have SIGTSTP, for example */ + { + static bool ignore_tstp = FALSE; + + if (!ignore_tstp) { + static sigaction_t act, oact; + + if (!enable) { + act.sa_handler = SIG_IGN; + sigaction(SIGTSTP, &act, &oact); + } else if (act.sa_handler != SIG_DFL) { + sigaction(SIGTSTP, &oact, NULL); + } else if (sigaction(SIGTSTP, NULL, &oact) == 0 + && (oact.sa_handler == SIG_DFL)) { + sigemptyset(&act.sa_mask); #ifdef SA_RESTART - act.sa_flags |= SA_RESTART; + act.sa_flags |= SA_RESTART; #endif /* SA_RESTART */ - act.sa_handler = cleanup; - CatchIfDefault(SIGINT, &act); - CatchIfDefault(SIGTERM, &act); - - act.sa_handler = tstp; - if (!CatchIfDefault(SIGTSTP, &act)) - ignore = TRUE; + act.sa_handler = tstp; + (void) sigaction(SIGTSTP, &act, NULL); + } else { + ignore_tstp = TRUE; + } } } -#else /* !USE_SIGTSTP */ - if (enable) { -#if HAVE_SIGACTION || HAVE_SIGVEC - static sigaction_t act; - sigemptyset(&act.sa_mask); -#if USE_SIGWINCH - act.sa_handler = sigwinch; - CatchIfDefault(SIGWINCH, &act); -#endif -#ifdef SA_RESTART - act.sa_flags |= SA_RESTART; -#endif /* SA_RESTART */ - act.sa_handler = cleanup; - CatchIfDefault(SIGINT, &act); - CatchIfDefault(SIGTERM, &act); - -#else /* !(HAVE_SIGACTION || HAVE_SIGVEC) */ +#endif /* !USE_SIGTSTP */ - CatchIfDefault(SIGINT, cleanup); - CatchIfDefault(SIGTERM, cleanup); + if (!initialized) { + if (enable) { + CatchIfDefault(SIGINT, cleanup); + CatchIfDefault(SIGTERM, cleanup); #if USE_SIGWINCH - CatchIfDefault(SIGWINCH, sigwinch); + CatchIfDefault(SIGWINCH, sigwinch); #endif -#endif /* !(HAVE_SIGACTION || HAVE_SIGVEC) */ + initialized = TRUE; + } } -#endif /* !USE_SIGTSTP */ + returnVoid; } diff --git a/contrib/ncurses/ncurses/tty/lib_twait.c b/contrib/ncurses/ncurses/tty/lib_twait.c index 2dfcb10..9829a7e 100644 --- a/contrib/ncurses/ncurses/tty/lib_twait.c +++ b/contrib/ncurses/ncurses/tty/lib_twait.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free 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,14 @@ ** comments, none of the original code remains - T.Dickey). */ +#include <curses.priv.h> + #ifdef __BEOS__ +#undef false +#undef true #include <OS.h> #endif -#include <curses.priv.h> - #if USE_FUNC_POLL # if HAVE_SYS_TIME_H # include <sys/time.h> @@ -59,7 +61,7 @@ # endif #endif -MODULE_ID("$Id: lib_twait.c,v 1.41 2000/12/10 03:04:30 tom Exp $") +MODULE_ID("$Id: lib_twait.c,v 1.44 2002/04/21 21:06:29 tom Exp $") static long _nc_gettime(bool first) @@ -85,7 +87,7 @@ _nc_gettime(bool first) } res = (t1 - t0) * 1000; #endif - T(("%s time: %ld msec", first ? "get" : "elapsed", res)); + TR(TRACE_IEVENT, ("%s time: %ld msec", first ? "get" : "elapsed", res)); return res; } @@ -103,8 +105,7 @@ _nc_gettime(bool first) * descriptors. */ NCURSES_EXPORT(int) -_nc_timed_wait -(int mode, int milliseconds, int *timeleft) +_nc_timed_wait(int mode, int milliseconds, int *timeleft) { int fd; int count; @@ -120,7 +121,10 @@ _nc_timed_wait long starttime, returntime; - T(("start twait: %d milliseconds, mode: %d", milliseconds, mode)); + if (milliseconds < 0) + milliseconds = 0; + TR(TRACE_IEVENT, ("start twait: %d milliseconds, mode: %d", + milliseconds, mode)); #if PRECISE_GETTIME retry: @@ -228,8 +232,8 @@ _nc_timed_wait if (timeleft) *timeleft = milliseconds; - T(("end twait: returned %d (%d), remaining time %d msec", - result, errno, milliseconds)); + TR(TRACE_IEVENT, ("end twait: returned %d (%d), remaining time %d msec", + result, errno, milliseconds)); /* * Both 'poll()' and 'select()' return the number of file descriptors diff --git a/contrib/ncurses/ncurses/tty/lib_vidattr.c b/contrib/ncurses/ncurses/tty/lib_vidattr.c index 464973d..00611f4 100644 --- a/contrib/ncurses/ncurses/tty/lib_vidattr.c +++ b/contrib/ncurses/ncurses/tty/lib_vidattr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -64,7 +64,7 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$Id: lib_vidattr.c,v 1.36 2000/12/10 03:05:48 tom Exp $") +MODULE_ID("$Id: lib_vidattr.c,v 1.39 2001/08/26 00:40:46 Philippe.Blain Exp $") #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) @@ -88,13 +88,12 @@ MODULE_ID("$Id: lib_vidattr.c,v 1.36 2000/12/10 03:05:48 tom Exp $") NCURSES_EXPORT(int) vidputs -(attr_t newmode, int (*outc) (int)) +(chtype newmode, int (*outc) (int)) { static attr_t previous_attr = A_NORMAL; attr_t turn_on, turn_off; int pair; bool reverse = FALSE; - bool used_ncv = FALSE; bool can_color = (SP == 0 || SP->_coloron); #if NCURSES_EXT_FUNCS bool fix_pair0 = (SP != 0 && SP->_coloron && !SP->_default_color); @@ -182,7 +181,7 @@ vidputs } SetColorsIf((pair != 0) || fix_pair0, previous_attr); - } else if (set_attributes && !used_ncv) { + } else if (set_attributes) { if (turn_on || turn_off) { TPUTS_TRACE("set_attributes"); tputs(tparm(set_attributes, @@ -230,12 +229,24 @@ vidputs TurnOn(A_PROTECT, enter_protected_mode); TurnOn(A_INVIS, enter_secure_mode); TurnOn(A_UNDERLINE, enter_underline_mode); +#ifdef enter_horizontal_hl_mode TurnOn(A_HORIZONTAL, enter_horizontal_hl_mode); +#endif +#ifdef enter_left_hl_mode TurnOn(A_LEFT, enter_left_hl_mode); +#endif +#ifdef enter_low_hl_mode TurnOn(A_LOW, enter_low_hl_mode); +#endif +#ifdef enter_right_hl_mode TurnOn(A_RIGHT, enter_right_hl_mode); +#endif +#ifdef enter_top_hl_mode TurnOn(A_TOP, enter_top_hl_mode); +#endif +#ifdef enter_vertical_hl_mode TurnOn(A_VERTICAL, enter_vertical_hl_mode); +#endif /* *INDENT-ON* */ } @@ -252,7 +263,7 @@ vidputs } NCURSES_EXPORT(int) -vidattr(attr_t newmode) +vidattr(chtype newmode) { T((T_CALLED("vidattr(%s)"), _traceattr(newmode))); diff --git a/contrib/ncurses/ncurses/tty/tty_update.c b/contrib/ncurses/ncurses/tty/tty_update.c index d292ad3..e06de1b 100644 --- a/contrib/ncurses/ncurses/tty/tty_update.c +++ b/contrib/ncurses/ncurses/tty/tty_update.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000,2001,2002 Free 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,14 @@ * *-----------------------------------------------------------------*/ +#include <curses.priv.h> + #ifdef __BEOS__ +#undef false +#undef true #include <OS.h> #endif -#include <curses.priv.h> - #if defined(TRACE) && HAVE_SYS_TIMES_H && HAVE_TIMES #define USE_TRACE_TIMES 1 #else @@ -70,7 +72,7 @@ #include <term.h> -MODULE_ID("$Id: tty_update.c,v 1.151 2001/02/03 23:41:55 tom Exp $") +MODULE_ID("$Id: tty_update.c,v 1.174 2002/04/21 21:04:16 tom Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -92,12 +94,12 @@ MODULE_ID("$Id: tty_update.c,v 1.151 2001/02/03 23:41:55 tom Exp $") */ /* #define POSITION_DEBUG */ -static inline chtype ClrBlank(WINDOW *win); +static inline NCURSES_CH_T ClrBlank(WINDOW *win); static int ClrBottom(int total); -static void ClearScreen(chtype blank); +static void ClearScreen(NCURSES_CH_T blank); static void ClrUpdate(void); static void DelChar(int count); -static void InsStr(chtype * line, int count); +static void InsStr(NCURSES_CH_T * line, int count); static void TransformLine(int const lineno); #ifdef POSITION_DEBUG @@ -163,7 +165,7 @@ position_check(int expected_y, int expected_x, char *legend) static inline void GoTo(int const row, int const col) { - chtype oldattr = SP->_current_attr; + attr_t oldattr = SP->_current_attr; TR(TRACE_MOVE, ("GoTo(%d, %d) from (%d, %d)", row, col, SP->_cursrow, SP->_curscol)); @@ -189,22 +191,30 @@ GoTo(int const row, int const col) } static inline void -PutAttrChar(chtype ch) +PutAttrChar(CARG_CH_T ch) { - int data; + PUTC_DATA; + NCURSES_CH_T tilde; - if (tilde_glitch && (TextOf(ch) == '~')) - ch = ('`' | AttrOf(ch)); + if (tilde_glitch && (CharOfD(ch) == L('~'))) { + SetChar(tilde, L('`'), AttrOfD(ch)); + ch = CHREF(tilde); + } TR(TRACE_CHARPUT, ("PutAttrChar(%s) at (%d, %d)", - _tracechtype(ch), + _tracech_t(ch), SP->_cursrow, SP->_curscol)); - UpdateAttrs(ch); - data = TextOf(ch); + UpdateAttrs(AttrOfD(ch)); +#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(data); - } else { - putc(data, SP->_ofp); /* macro's fastest... */ + SP->_outch(ch); + } else +#endif + { + PUTC(CHDEREF(ch), SP->_ofp); /* macro's fastest... */ #ifdef TRACE _nc_outchars++; #endif /* TRACE */ @@ -276,7 +286,7 @@ check_pending(void) /* put char at lower right corner */ static void -PutCharLR(chtype const ch) +PutCharLR(const ARG_CH_T ch) { if (!auto_right_margin) { /* we can put the char directly */ @@ -333,7 +343,7 @@ wrap_cursor(void) } static inline void -PutChar(chtype const ch) +PutChar(const ARG_CH_T ch) /* insert character, handling automargin stuff */ { if (SP->_cursrow == screen_lines - 1 && SP->_curscol == screen_columns - 1) @@ -354,19 +364,27 @@ PutChar(chtype const ch) * or can be output by clearing (A_COLOR in case of bce-terminal) are excluded. */ static inline bool -can_clear_with(chtype ch) +can_clear_with(ARG_CH_T ch) { if (!back_color_erase && SP->_coloron) { - if (ch & A_COLOR) - return FALSE; #if NCURSES_EXT_FUNCS if (!SP->_default_color) return FALSE; if (SP->_default_fg != C_MASK || SP->_default_bg != C_MASK) return FALSE; + if (AttrOfD(ch) & A_COLOR) { + short fg, bg; + pair_content(PAIR_NUMBER(AttrOfD(ch)), &fg, &bg); + if (fg != C_MASK || bg != C_MASK) + return FALSE; + } +#else + if (AttrOfD(ch) & A_COLOR) + return FALSE; #endif } - return ((ch & ~(NONBLANK_ATTR | A_COLOR)) == BLANK); + return (ISBLANK(CHDEREF(ch)) && + (AttrOfD(ch) & ~(NONBLANK_ATTR | A_COLOR)) == BLANK_ATTR); } /* @@ -382,28 +400,28 @@ can_clear_with(chtype ch) * This code is optimized using ech and rep. */ static int -EmitRange(const chtype * ntext, int num) +EmitRange(const NCURSES_CH_T * ntext, int num) { int i; if (erase_chars || repeat_char) { while (num > 0) { int runcount; - chtype ntext0; + NCURSES_CH_T ntext0; - while (num > 1 && ntext[0] != ntext[1]) { - PutChar(ntext[0]); + while (num > 1 && !CharEq(ntext[0], ntext[1])) { + PutChar(CHREF(ntext[0])); ntext++; num--; } ntext0 = ntext[0]; if (num == 1) { - PutChar(ntext0); + PutChar(CHREF(ntext0)); return 0; } runcount = 2; - while (runcount < num && ntext[runcount] == ntext0) + while (runcount < num && CharEq(ntext[runcount], ntext0)) runcount++; /* @@ -416,8 +434,8 @@ EmitRange(const chtype * ntext, int num) */ if (erase_chars && runcount > SP->_ech_cost + SP->_cup_ch_cost - && can_clear_with(ntext0)) { - UpdateAttrs(ntext0); + && can_clear_with(CHREF(ntext0))) { + UpdateAttrs(AttrOf(ntext0)); putp(tparm(erase_chars, runcount)); /* @@ -437,15 +455,15 @@ EmitRange(const chtype * ntext, int num) if (wrap_possible) rep_count--; - UpdateAttrs(ntext0); - putp(tparm(repeat_char, TextOf(ntext0), rep_count)); + UpdateAttrs(AttrOf(ntext0)); + putp(tparm(repeat_char, CharOf(ntext0), rep_count)); SP->_curscol += rep_count; if (wrap_possible) - PutChar(ntext0); + PutChar(CHREF(ntext0)); } else { for (i = 0; i < runcount; i++) - PutChar(ntext[i]); + PutChar(CHREF(ntext[i])); } ntext += runcount; num -= runcount; @@ -454,7 +472,7 @@ EmitRange(const chtype * ntext, int num) } for (i = 0; i < num; i++) - PutChar(ntext[i]); + PutChar(CHREF(ntext[i])); return 0; } @@ -468,8 +486,8 @@ EmitRange(const chtype * ntext, int num) */ static int PutRange( - const chtype * otext, - const chtype * ntext, + const NCURSES_CH_T * otext, + const NCURSES_CH_T * ntext, int row, int first, int last) { @@ -481,7 +499,9 @@ PutRange( if (otext != ntext && (last - first + 1) > SP->_inline_cost) { for (j = first, run = 0; j <= last; j++) { - if (otext[j] == ntext[j]) { + if (!run && isnac(otext[j])) + continue; + if (CharEq(otext[j], ntext[j])) { run++; } else { if (run > SP->_inline_cost) { @@ -580,7 +600,7 @@ doupdate(void) for (i = 0; i < screen_lines; i++) { for (j = 0; j < screen_columns; j++) { bool failed = FALSE; - chtype turnon = AttrOf(newscr->_line[i].text[j]) & ~rattr; + attr_t turnon = AttrOf(newscr->_line[i].text[j]) & ~rattr; /* is an attribute turned on here? */ if (turnon == 0) { @@ -597,16 +617,16 @@ doupdate(void) * ensure there's enough room to set the attribute before * the first non-blank in the run. */ -#define SAFE(a) (!((a) & (chtype)~NONBLANK_ATTR)) - if (TextOf(newscr->_line[i].text[j]) == ' ' && SAFE(turnon)) { - newscr->_line[i].text[j] &= ~turnon; +#define SAFE(a) (!((a) & (attr_t)~NONBLANK_ATTR)) + if (ISBLANK(newscr->_line[i].text[j]) && SAFE(turnon)) { + RemAttr(newscr->_line[i].text[j], turnon); continue; } /* check that there's enough room at start of span */ for (k = 1; k <= magic_cookie_glitch; k++) { if (j - k < 0 - || TextOf(newscr->_line[i].text[j - k]) != ' ' + || !ISBLANK(newscr->_line[i].text[j - k]) || !SAFE(AttrOf(newscr->_line[i].text[j - k]))) failed = TRUE; } @@ -633,7 +653,7 @@ doupdate(void) foundit:; if (end_onscreen) { - chtype *lastline = newscr->_line[m].text; + NCURSES_CH_T *lastline = newscr->_line[m].text; /* * If there are safely-attributed blanks at the @@ -642,14 +662,14 @@ doupdate(void) * of span. */ while (n >= 0 - && TextOf(lastline[n]) == ' ' + && ISBLANK(lastline[n]) && SAFE(AttrOf(lastline[n]))) - lastline[n--] &= ~turnon; + 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 - || TextOf(lastline[n + k]) != ' ' + || !ISBLANK(lastline[n + k]) || !SAFE(AttrOf(lastline[n + k]))) failed = TRUE; } @@ -667,7 +687,7 @@ doupdate(void) for (; q < screen_columns; q++) { if (AttrOf(newscr->_line[p].text[q]) == rattr) goto foundend; - newscr->_line[p].text[q] &= ~turnon; + RemAttr(newscr->_line[p].text[q], turnon); } q = 0; } @@ -682,7 +702,7 @@ doupdate(void) * for cookies before the first nonblank character */ for (k = 1; k <= magic_cookie_glitch; k++) - newscr->_line[i].text[j - k] |= turnon; + AddAttr(newscr->_line[i].text[j - k], turnon); } rattr = AttrOf(newscr->_line[i].text[j]); @@ -782,8 +802,8 @@ doupdate(void) TR(TRACE_TIMES, ("Update cost: %ld chars, %ld clocks system time, %ld clocks user time", _nc_outchars, - after.tms_stime - before.tms_stime, - after.tms_utime - before.tms_utime)); + (long) (after.tms_stime - before.tms_stime), + (long) (after.tms_utime - before.tms_utime))); #endif /* USE_TRACE_TIMES */ _nc_signal_handler(TRUE); @@ -802,14 +822,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))->_bkgd) +#define BCE_BKGD(win) (((win) == curscr ? stdscr : (win))->_nc_bkgd) -static inline chtype +static inline NCURSES_CH_T ClrBlank(WINDOW *win) { - chtype blank = BLANK; + NCURSES_CH_T blank = NewChar(BLANK_TEXT); if (back_color_erase) - blank |= (BCE_BKGD(win) & BCE_ATTRS); + AddAttr(blank, (AttrOf(BCE_BKGD(win)) & BCE_ATTRS)); return blank; } @@ -824,7 +844,7 @@ static void ClrUpdate(void) { int i; - chtype blank = ClrBlank(stdscr); + NCURSES_CH_T blank = ClrBlank(stdscr); int nonempty = min(screen_lines, newscr->_maxy + 1); TR(TRACE_UPDATE, ("ClrUpdate() called")); @@ -846,7 +866,7 @@ ClrUpdate(void) */ static void -ClrToEOL(chtype blank, bool needclear) +ClrToEOL(NCURSES_CH_T blank, bool needclear) { int j; @@ -854,9 +874,9 @@ ClrToEOL(chtype blank, bool needclear) && SP->_cursrow >= 0) { for (j = SP->_curscol; j < screen_columns; j++) { if (j >= 0) { - chtype *cp = &(curscr->_line[SP->_cursrow].text[j]); + NCURSES_CH_T *cp = &(curscr->_line[SP->_cursrow].text[j]); - if (*cp != blank) { + if (!CharEq(*cp, blank)) { *cp = blank; needclear = TRUE; } @@ -867,12 +887,12 @@ ClrToEOL(chtype blank, bool needclear) } if (needclear) { - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); TPUTS_TRACE("clr_eol"); if (SP->_el_cost > (screen_columns - SP->_curscol)) { int count = (screen_columns - SP->_curscol); while (count-- > 0) - PutChar(blank); + PutChar(CHREF(blank)); } else { putp(clr_eol); } @@ -886,14 +906,14 @@ ClrToEOL(chtype blank, bool needclear) */ static void -ClrToEOS(chtype blank) +ClrToEOS(NCURSES_CH_T blank) { int row, col; row = SP->_cursrow; col = SP->_curscol; - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); TPUTS_TRACE("clr_eos"); tputs(clr_eos, screen_lines - row, _nc_outch); @@ -920,20 +940,20 @@ ClrBottom(int total) int col; int top = total; int last = min(screen_columns, newscr->_maxx + 1); - chtype blank = ClrBlank(stdscr); + NCURSES_CH_T blank = ClrBlank(stdscr); bool ok; - if (clr_eos && can_clear_with(blank)) { + if (clr_eos && can_clear_with(CHREF(blank))) { for (row = total - 1; row >= 0; row--) { for (col = 0, ok = TRUE; ok && col < last; col++) { - ok = (newscr->_line[row].text[col] == blank); + ok = (CharEq(newscr->_line[row].text[col], blank)); } if (!ok) break; for (col = 0; ok && col < last; col++) { - ok = (curscr->_line[row].text[col] == blank); + ok = (CharEq(curscr->_line[row].text[col], blank)); } if (!ok) top = row; @@ -953,6 +973,25 @@ ClrBottom(int total) return total; } +#if USE_XMC_SUPPORT +#if USE_WIDEC_SUPPORT +static inline bool +check_xmc_transition(NCURSES_CH_T * a, NCURSES_CH_T * b) +{ + if (((a->attr ^ b->attr) & ~(a->attr) & SP->_xmc_triggers) != 0) { + return TRUE; + } + return FALSE; +} +#define xmc_turn_on(a,b) check_xmc_transition(&(a), &(b)) +#else +#define xmc_turn_on(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) +#endif /* USE_XMC_SUPPORT */ + /* ** TransformLine(lineno) ** @@ -975,8 +1014,8 @@ static void TransformLine(int const lineno) { int firstChar, oLastChar, nLastChar; - chtype *newLine = newscr->_line[lineno].text; - chtype *oldLine = curscr->_line[lineno].text; + NCURSES_CH_T *newLine = newscr->_line[lineno].text; + NCURSES_CH_T *oldLine = curscr->_line[lineno].text; int n; bool attrchanged = FALSE; @@ -986,8 +1025,8 @@ TransformLine(int const lineno) if (SP->oldhash && SP->newhash) SP->oldhash[lineno] = SP->newhash[lineno]; -#define ColorOf(n) ((n) & A_COLOR) -#define unColor(n) ((n) & ALL_BUT_COLOR) +#define ColorOf(n) (AttrOf(n) & A_COLOR) +#define unColor(n) (AttrOf(n) & ALL_BUT_COLOR) /* * If we have colors, there is the possibility of having two color pairs * that display as the same colors. For instance, Lynx does this. Check @@ -995,13 +1034,13 @@ TransformLine(int const lineno) * they are equivalent. */ if (SP->_coloron) { - chtype oldColor; - chtype newColor; + attr_t oldColor; + attr_t newColor; int oldPair; int newPair; for (n = 0; n < screen_columns; n++) { - if (newLine[n] != oldLine[n]) { + if (!CharEq(newLine[n], oldLine[n])) { oldColor = ColorOf(oldLine[n]); newColor = ColorOf(newLine[n]); if (oldColor != newColor @@ -1011,8 +1050,8 @@ TransformLine(int const lineno) if (oldPair < COLOR_PAIRS && newPair < COLOR_PAIRS && SP->_color_pairs[oldPair] == SP->_color_pairs[newPair]) { - oldLine[n] &= ~A_COLOR; - oldLine[n] |= ColorOf(newLine[n]); + RemAttr(oldLine[n], A_COLOR); + AddAttr(oldLine[n], ColorOf(newLine[n])); } } } @@ -1036,10 +1075,6 @@ TransformLine(int const lineno) PutRange(oldLine, newLine, lineno, 0, (screen_columns - 1)); #if USE_XMC_SUPPORT -#define NEW(r,c) newscr->_line[r].text[c] -#define xmc_turn_on(a,b) ((((a)^(b)) & ~(a) & SP->_xmc_triggers) != 0) -#define xmc_turn_off(a,b) xmc_turn_on(b,a) - /* * This is a very simple loop to paint characters which may have the * magic cookie glitch embedded. It doesn't know much about video @@ -1060,40 +1095,39 @@ TransformLine(int const lineno) * If we are writing an attributed blank, where the * previous cell is not attributed. */ - if (TextOf(newLine[n]) == ' ' + if (ISBLANK(newLine[n]) && ((n > 0 && xmc_turn_on(newLine[n - 1], newLine[n])) || (n == 0 && lineno > 0 - && xmc_turn_on(NEW(lineno - 1, screen_columns - 1), + && xmc_turn_on(xmc_new(lineno - 1, screen_columns - 1), newLine[n])))) { n = m; } - PutChar(newLine[n]); + PutChar(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 (TextOf(newLine[n]) != ' ' + 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], NEW(lineno + 1, 0))))) { + && xmc_turn_off(newLine[n], xmc_new(lineno + 1, 0))))) { n = m; } } -#undef NEW #endif } else { - chtype blank; + NCURSES_CH_T blank; /* find the first differing character */ while (firstChar < screen_columns && - newLine[firstChar] == oldLine[firstChar]) + CharEq(newLine[firstChar], oldLine[firstChar])) firstChar++; /* if there wasn't one, we're done */ @@ -1101,25 +1135,25 @@ TransformLine(int const lineno) return; /* it may be cheap to clear leading whitespace with clr_bol */ - if (clr_bol && can_clear_with(blank = newLine[0])) { + if (clr_bol && (blank = newLine[0], can_clear_with(CHREF(blank)))) { int oFirstChar, nFirstChar; for (oFirstChar = 0; oFirstChar < screen_columns; oFirstChar++) - if (oldLine[oFirstChar] != blank) + if (!CharEq(oldLine[oFirstChar], blank)) break; for (nFirstChar = 0; nFirstChar < screen_columns; nFirstChar++) - if (newLine[nFirstChar] != blank) + if (!CharEq(newLine[nFirstChar], blank)) break; if (nFirstChar > oFirstChar + SP->_el1_cost) { if (nFirstChar >= screen_columns && SP->_el_cost <= SP->_el1_cost) { GoTo(lineno, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); TPUTS_TRACE("clr_eol"); putp(clr_eol); } else { GoTo(lineno, nFirstChar - 1); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); TPUTS_TRACE("clr_bol"); putp(clr_bol); } @@ -1134,12 +1168,12 @@ TransformLine(int const lineno) blank = newLine[screen_columns - 1]; - if (!can_clear_with(blank)) { + if (!can_clear_with(CHREF(blank))) { /* find the last differing character */ nLastChar = screen_columns - 1; while (nLastChar > firstChar - && newLine[nLastChar] == oldLine[nLastChar]) + && CharEq(newLine[nLastChar], oldLine[nLastChar])) nLastChar--; if (nLastChar >= firstChar) { @@ -1147,29 +1181,29 @@ TransformLine(int const lineno) PutRange(oldLine, newLine, lineno, firstChar, nLastChar); memcpy(oldLine + firstChar, newLine + firstChar, - (nLastChar - firstChar + 1) * sizeof(chtype)); + (nLastChar - firstChar + 1) * sizeof(NCURSES_CH_T)); } return; } /* find last non-blank character on old line */ oLastChar = screen_columns - 1; - while (oLastChar > firstChar && oldLine[oLastChar] == blank) + while (oLastChar > firstChar && CharEq(oldLine[oLastChar], blank)) oLastChar--; /* find last non-blank character on new line */ nLastChar = screen_columns - 1; - while (nLastChar > firstChar && newLine[nLastChar] == blank) + while (nLastChar > firstChar && CharEq(newLine[nLastChar], blank)) nLastChar--; if ((nLastChar == firstChar) && (SP->_el_cost < (oLastChar - nLastChar))) { GoTo(lineno, firstChar); - if (newLine[firstChar] != blank) - PutChar(newLine[firstChar]); + if (!CharEq(newLine[firstChar], blank)) + PutChar(CHREF(newLine[firstChar])); ClrToEOL(blank, FALSE); } else if ((nLastChar != oLastChar) - && (newLine[nLastChar] != oldLine[oLastChar] + && (!CharEq(newLine[nLastChar], oldLine[oLastChar]) || !(_nc_idcok && has_ic()))) { GoTo(lineno, firstChar); if ((oLastChar - nLastChar) > SP->_el_cost) { @@ -1185,14 +1219,16 @@ TransformLine(int const lineno) int oLastNonblank = oLastChar; /* find the last characters that really differ */ - while (newLine[nLastChar] == oldLine[oLastChar]) { - if (nLastChar != 0 - && oLastChar != 0) { - nLastChar--; - oLastChar--; - } else { + /* can be -1 if no characters differ */ + while (CharEq(newLine[nLastChar], oldLine[oLastChar])) { + /* don't split a wide char */ + if (isnac(newLine[nLastChar]) && + !CharEq(newLine[nLastChar - 1], oldLine[oLastChar - 1])) + break; + nLastChar--; + oLastChar--; + if (nLastChar == -1 || oLastChar == -1) break; - } } n = min(oLastChar, nLastChar); @@ -1227,7 +1263,7 @@ TransformLine(int const lineno) * setting the video attributes from * the last character on the row. */ - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); DelChar(oLastChar - nLastChar); } } @@ -1238,7 +1274,7 @@ TransformLine(int const lineno) if (screen_columns > firstChar) memcpy(oldLine + firstChar, newLine + firstChar, - (screen_columns - firstChar) * sizeof(chtype)); + (screen_columns - firstChar) * sizeof(NCURSES_CH_T)); } /* @@ -1249,7 +1285,7 @@ TransformLine(int const lineno) */ static void -ClearScreen(chtype blank) +ClearScreen(NCURSES_CH_T blank) { int i, j; bool fast_clear = (clear_screen || clr_eos || clr_eol); @@ -1268,7 +1304,7 @@ ClearScreen(chtype blank) if (fast_clear) { if (clear_screen) { - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); TPUTS_TRACE("clear_screen"); putp(clear_screen); SP->_cursrow = SP->_curscol = 0; @@ -1277,13 +1313,13 @@ ClearScreen(chtype blank) SP->_cursrow = SP->_curscol = -1; GoTo(0, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); TPUTS_TRACE("clr_eos"); putp(clr_eos); } else if (clr_eol) { SP->_cursrow = SP->_curscol = -1; - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); for (i = 0; i < screen_lines; i++) { GoTo(i, 0); TPUTS_TRACE("clr_eol"); @@ -1292,11 +1328,11 @@ ClearScreen(chtype blank) GoTo(0, 0); } } else { - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); for (i = 0; i < screen_lines; i++) { GoTo(i, 0); for (j = 0; j < screen_columns; j++) - PutChar(blank); + PutChar(CHREF(blank)); } GoTo(0, 0); } @@ -1317,7 +1353,7 @@ ClearScreen(chtype blank) */ static void -InsStr(chtype * line, int count) +InsStr(NCURSES_CH_T * line, int count) { TR(TRACE_UPDATE, ("InsStr(%p,%d) called", line, count)); @@ -1328,7 +1364,7 @@ InsStr(chtype * line, int count) TPUTS_TRACE("parm_ich"); tputs(tparm(parm_ich, count), count, _nc_outch); while (count) { - PutAttrChar(*line); + PutAttrChar(CHREF(*line)); line++; count--; } @@ -1336,7 +1372,7 @@ InsStr(chtype * line, int count) TPUTS_TRACE("enter_insert_mode"); putp(enter_insert_mode); while (count) { - PutAttrChar(*line); + PutAttrChar(CHREF(*line)); if (insert_padding) { TPUTS_TRACE("insert_padding"); putp(insert_padding); @@ -1350,7 +1386,7 @@ InsStr(chtype * line, int count) while (count) { TPUTS_TRACE("insert_character"); putp(insert_character); - PutAttrChar(*line); + PutAttrChar(CHREF(*line)); if (insert_padding) { TPUTS_TRACE("insert_padding"); putp(insert_padding); @@ -1435,40 +1471,40 @@ _nc_outstr(const char *str) /* 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, chtype blank) +scroll_csr_forward(int n, int top, int bot, int miny, int maxy, NCURSES_CH_T blank) { int i, j; if (n == 1 && scroll_forward && top == miny && bot == maxy) { GoTo(bot, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); TPUTS_TRACE("scroll_forward"); tputs(scroll_forward, 0, _nc_outch); } else if (n == 1 && delete_line && bot == maxy) { GoTo(top, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); TPUTS_TRACE("delete_line"); tputs(delete_line, 0, _nc_outch); } else if (parm_index && top == miny && bot == maxy) { GoTo(bot, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); TPUTS_TRACE("parm_index"); tputs(tparm(parm_index, n, 0), n, _nc_outch); } else if (parm_delete_line && bot == maxy) { GoTo(top, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); TPUTS_TRACE("parm_delete_line"); tputs(tparm(parm_delete_line, n, 0), n, _nc_outch); } else if (scroll_forward && top == miny && bot == maxy) { GoTo(bot, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); for (i = 0; i < n; i++) { TPUTS_TRACE("scroll_forward"); tputs(scroll_forward, 0, _nc_outch); } } else if (delete_line && bot == maxy) { GoTo(top, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); for (i = 0; i < n; i++) { TPUTS_TRACE("delete_line"); tputs(delete_line, 0, _nc_outch); @@ -1481,7 +1517,7 @@ scroll_csr_forward(int n, int top, int bot, int miny, int maxy, chtype blank) for (i = 0; i < n; i++) { GoTo(bot - i, 0); for (j = 0; j < screen_columns; j++) - PutChar(blank); + PutChar(CHREF(blank)); } } #endif @@ -1491,40 +1527,41 @@ scroll_csr_forward(int n, int top, int bot, int miny, int maxy, chtype blank) /* 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, chtype blank) +scroll_csr_backward(int n, int top, int bot, int miny, int maxy, + NCURSES_CH_T blank) { int i, j; if (n == 1 && scroll_reverse && top == miny && bot == maxy) { GoTo(top, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); TPUTS_TRACE("scroll_reverse"); tputs(scroll_reverse, 0, _nc_outch); } else if (n == 1 && insert_line && bot == maxy) { GoTo(top, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); TPUTS_TRACE("insert_line"); tputs(insert_line, 0, _nc_outch); } else if (parm_rindex && top == miny && bot == maxy) { GoTo(top, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); TPUTS_TRACE("parm_rindex"); tputs(tparm(parm_rindex, n, 0), n, _nc_outch); } else if (parm_insert_line && bot == maxy) { GoTo(top, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); TPUTS_TRACE("parm_insert_line"); tputs(tparm(parm_insert_line, n, 0), n, _nc_outch); } else if (scroll_reverse && top == miny && bot == maxy) { GoTo(top, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); for (i = 0; i < n; i++) { TPUTS_TRACE("scroll_reverse"); tputs(scroll_reverse, 0, _nc_outch); } } else if (insert_line && bot == maxy) { GoTo(top, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); for (i = 0; i < n; i++) { TPUTS_TRACE("insert_line"); tputs(insert_line, 0, _nc_outch); @@ -1537,7 +1574,7 @@ scroll_csr_backward(int n, int top, int bot, int miny, int maxy, chtype blank) for (i = 0; i < n; i++) { GoTo(top + i, 0); for (j = 0; j < screen_columns; j++) - PutChar(blank); + PutChar(CHREF(blank)); } } #endif @@ -1547,7 +1584,7 @@ scroll_csr_backward(int n, int top, int bot, int miny, int maxy, chtype blank) /* scroll by using delete_line at del and insert_line at ins */ /* n > 0 */ static int -scroll_idl(int n, int del, int ins, chtype blank) +scroll_idl(int n, int del, int ins, NCURSES_CH_T blank) { int i; @@ -1555,7 +1592,7 @@ scroll_idl(int n, int del, int ins, chtype blank) return ERR; GoTo(del, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); if (n == 1 && delete_line) { TPUTS_TRACE("delete_line"); tputs(delete_line, 0, _nc_outch); @@ -1570,7 +1607,7 @@ scroll_idl(int n, int del, int ins, chtype blank) } GoTo(ins, 0); - UpdateAttrs(blank); + UpdateAttrs(AttrOf(blank)); if (n == 1 && insert_line) { TPUTS_TRACE("insert_line"); tputs(insert_line, 0, _nc_outch); @@ -1592,7 +1629,7 @@ _nc_scrolln (int n, int top, int bot, int maxy) /* scroll region from top to bot by n lines */ { - chtype blank = ClrBlank(stdscr); + NCURSES_CH_T blank = ClrBlank(stdscr); int i; bool cursor_saved = FALSE; int res; @@ -1647,13 +1684,14 @@ _nc_scrolln */ if (res != ERR && (non_dest_scroll_region || (memory_below && bot == maxy))) { + NCURSES_CH_T blank2 = NewChar(BLANK_TEXT); if (bot == maxy && clr_eos) { GoTo(bot - n, 0); - ClrToEOS(BLANK); + ClrToEOS(blank2); } else { for (i = 0; i < n; i++) { GoTo(bot - i, 0); - ClrToEOL(BLANK, FALSE); + ClrToEOL(blank2, FALSE); } } } @@ -1692,9 +1730,10 @@ _nc_scrolln */ if (res != ERR && (non_dest_scroll_region || (memory_above && top == 0))) { + NCURSES_CH_T blank2 = NewChar(BLANK_TEXT); for (i = 0; i < -n; i++) { GoTo(i + top, 0); - ClrToEOL(BLANK, FALSE); + ClrToEOL(blank2, FALSE); } } } @@ -1750,6 +1789,7 @@ _nc_screen_wrap(void) #if NCURSES_EXT_FUNCS if (SP->_coloron && !SP->_default_color) { + NCURSES_CH_T blank = NewChar(BLANK_TEXT); SP->_default_color = TRUE; _nc_do_color(-1, 0, FALSE, _nc_outch); SP->_default_color = FALSE; @@ -1758,7 +1798,7 @@ _nc_screen_wrap(void) SP->_cursrow = screen_lines - 1; SP->_curscol = 0; - ClrToEOL(BLANK, TRUE); + ClrToEOL(blank, TRUE); } #endif } diff --git a/contrib/ncurses/ncurses/widechar/lib_box_set.c b/contrib/ncurses/ncurses/widechar/lib_box_set.c new file mode 100644 index 0000000..7f69e5aa --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_box_set.c @@ -0,0 +1,113 @@ +/**************************************************************************** + * Copyright (c) 2002 Free 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. * + ****************************************************************************/ + +/**************************************************************************** + * Authors: Sven Verdoolaege and Thomas Dickey 2001,2002 * + ****************************************************************************/ + +/* +** lib_box_set.c +** +** The routine wborder_set(). +** +*/ + +#include <curses.priv.h> + +MODULE_ID("$Id: lib_box_set.c,v 1.2 2002/03/23 21:35:24 tom Exp $") + +NCURSES_EXPORT(int) +wborder_set(WINDOW *win, + const ARG_CH_T ls, const ARG_CH_T rs, + const ARG_CH_T ts, const ARG_CH_T bs, + const ARG_CH_T tl, const ARG_CH_T tr, + const ARG_CH_T bl, const ARG_CH_T br) +{ + NCURSES_SIZE_T i; + NCURSES_SIZE_T endx, endy; + 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, + _tracech_t2(1, ls), + _tracech_t2(2, rs), + _tracech_t2(3, ts), + _tracech_t2(4, bs), + _tracech_t2(5, tl), + _tracech_t2(6, tr), + _tracech_t2(7, bl), + _tracech_t2(8, br))); + + if (!win) + returnCode(ERR); + +#define RENDER_WITH_DEFAULT(ch,def) w ##ch = (ch == 0) ? *def : *ch + + RENDER_WITH_DEFAULT(ls, WACS_VLINE); + RENDER_WITH_DEFAULT(rs, WACS_VLINE); + RENDER_WITH_DEFAULT(ts, WACS_HLINE); + RENDER_WITH_DEFAULT(bs, WACS_HLINE); + RENDER_WITH_DEFAULT(tl, WACS_ULCORNER); + RENDER_WITH_DEFAULT(tr, WACS_URCORNER); + RENDER_WITH_DEFAULT(bl, WACS_LLCORNER); + RENDER_WITH_DEFAULT(br, WACS_LRCORNER); + + T(("using %s, %s, %s, %s, %s, %s, %s, %s", + _tracech_t2(1, CHREF(wls)), + _tracech_t2(2, CHREF(wrs)), + _tracech_t2(3, CHREF(wts)), + _tracech_t2(4, CHREF(wbs)), + _tracech_t2(5, CHREF(wtl)), + _tracech_t2(6, CHREF(wtr)), + _tracech_t2(7, CHREF(wbl)), + _tracech_t2(8, CHREF(wbr)))); + + endx = win->_maxx; + endy = win->_maxy; + + for (i = 0; i <= endx; i++) { + win->_line[0].text[i] = wts; + win->_line[endy].text[i] = wbs; + } + win->_line[endy].firstchar = win->_line[0].firstchar = 0; + win->_line[endy].lastchar = win->_line[0].lastchar = endx; + + for (i = 0; i <= endy; i++) { + win->_line[i].text[0] = wls; + win->_line[i].text[endx] = wrs; + win->_line[i].firstchar = 0; + win->_line[i].lastchar = endx; + } + win->_line[0].text[0] = wtl; + win->_line[0].text[endx] = wtr; + win->_line[endy].text[0] = wbl; + win->_line[endy].text[endx] = wbr; + + _nc_synchook(win); + returnCode(OK); +} diff --git a/contrib/ncurses/ncurses/widechar/lib_cchar.c b/contrib/ncurses/ncurses/widechar/lib_cchar.c new file mode 100644 index 0000000..efbfc69 --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_cchar.c @@ -0,0 +1,114 @@ +/**************************************************************************** + * Copyright (c) 2001,2002 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/* +** lib_cchar.c +** +** The routines setcchar() and getcchar(). +** +*/ + +#include <curses.priv.h> + +MODULE_ID("$Id: lib_cchar.c,v 1.5 2002/04/27 22:35:46 tom Exp $") + +/* + * The SuSv2 description leaves some room for interpretation. We'll assume wch + * is L'\0' terminated, contains at most one character with strictly positive + * width, which must be the first, and contains no characters of negative + * width. + */ +NCURSES_EXPORT(int) +setcchar(cchar_t * wcval, const wchar_t * wch, const attr_t attrs, + short color_pair, const void *opts) +{ + int i; + int len; + int code = OK; + + TR(TRACE_CCALLS, (T_CALLED("setcchar(%p,%s,%ld,%d,%p)"), + wcval, _nc_viswbuf(wch), attrs, color_pair, opts)); + + if (opts != NULL || (len = wcslen(wch)) > CCHARW_MAX + || (len > 0 && wcwidth(wch[0]) < 0)) { + code = ERR; + } else { + + for (i = 1; i < len; ++i) { + if (wcwidth(wch[i]) != 0) { + code = ERR; + break; + } + } + + if (code != ERR) { + memset(wcval, 0, sizeof(*wcval)); + + if (len != 0) { + SetAttr(*wcval, attrs | color_pair); + memcpy(&wcval->chars, wch, len * sizeof(wchar_t)); + TR(TRACE_CCALLS, ("copy %d wchars, first is %s", len, + _tracecchar_t(wcval))); + } + } + } + + TR(TRACE_CCALLS, (T_RETURN("%d"), code)); + return (code); +} + +NCURSES_EXPORT(int) +getcchar(const cchar_t * wcval, wchar_t * wch, attr_t * attrs, + short *color_pair, void *opts) +{ + wchar_t *wp; + int len; + int code = ERR; + + TR(TRACE_CCALLS, (T_CALLED("getcchar(%p,%p,%p,%p,%p)"), + wcval, wch, attrs, color_pair, opts)); + + if (opts == NULL) { + len = (wp = wmemchr(wcval->chars, L'\0', CCHARW_MAX)) + ? wp - wcval->chars + : CCHARW_MAX; + + if (wch == NULL) { + code = len; + } else if (len >= 0) { + *attrs = AttrOf(*wcval) & A_ATTRIBUTES; + *color_pair = AttrOf(*wcval) & A_COLOR; + wmemcpy(wch, wcval->chars, (unsigned) len); + wch[len] = L'\0'; + code = OK; + } + } + + TR(TRACE_CCALLS, (T_RETURN("%d"), code)); + return (code); +} diff --git a/contrib/ncurses/ncurses/widechar/lib_erasewchar.c b/contrib/ncurses/ncurses/widechar/lib_erasewchar.c new file mode 100644 index 0000000..7d64553 --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_erasewchar.c @@ -0,0 +1,77 @@ +/**************************************************************************** + * Copyright (c) 2002 Free 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 2002 * + ****************************************************************************/ + +#include <curses.priv.h> + +MODULE_ID("$Id: lib_erasewchar.c,v 1.1 2002/05/11 20:38:06 tom Exp $") + +/* + * erasewchar() + * + * Return erase character as given in cur_term->Ottyb. + * + */ + +NCURSES_EXPORT(int) +erasewchar(wchar_t * wch) +{ + int value; + int result = ERR; + + T((T_CALLED("erasewchar()"))); + if ((value = erasechar()) != ERR) { + *wch = value; + result = OK; + } + returnCode(result); +} + +/* + * killwchar() + * + * Return kill character as given in cur_term->Ottyb. + * + */ + +NCURSES_EXPORT(int) +killwchar(wchar_t * wch) +{ + int value; + int result = ERR; + + T((T_CALLED("killwchar()"))); + if ((value = killchar()) != ERR) { + *wch = value; + result = OK; + } + returnCode(result); +} diff --git a/contrib/ncurses/ncurses/widechar/lib_get_wch.c b/contrib/ncurses/ncurses/widechar/lib_get_wch.c new file mode 100644 index 0000000..21c40a5 --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_get_wch.c @@ -0,0 +1,99 @@ +/**************************************************************************** + * Copyright (c) 2002 Free 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 2002 * + ****************************************************************************/ + +/* +** lib_get_wch.c +** +** The routine get_wch(). +** +*/ + +#include <curses.priv.h> + +MODULE_ID("$Id: lib_get_wch.c,v 1.3 2002/03/17 16:14:45 tom Exp $") + +NCURSES_EXPORT(int) +wget_wch(WINDOW *win, wint_t * result) +{ + int code; + char buffer[(MB_CUR_MAX * 9) + 1]; /* allow some redundant shifts */ + int status; + mbstate_t state; + size_t count = 0; + unsigned long value; + wchar_t wch; + + T((T_CALLED("wget_wch(%p)"), win)); + /* + * We can get a stream of single-byte characters and KEY_xxx codes from + * _nc_wgetch(), while we want to return a wide character or KEY_xxx code. + */ + for (;;) { + T(("reading %d of %d", count + 1, sizeof(buffer))); + code = _nc_wgetch(win, &value, TRUE); + if (code == ERR) { + break; + } else if (code == KEY_CODE_YES) { + /* + * If we were processing an incomplete multibyte character, return + * an error since we have a KEY_xxx code which interrupts it. For + * some cases, we could improve this by writing a new version of + * lib_getch.c(!), but it is not clear whether the improvement + * would be worth the effort. + */ + if (count != 0) { + ungetch(value); + code = ERR; + } + break; + } else if (count + 1 >= sizeof(buffer)) { + ungetch(value); + code = ERR; + break; + } else { + buffer[count++] = UChar(value); + memset(&state, 0, sizeof(state)); + status = mbrlen(buffer, count, &state); + if (status >= 0) { + memset(&state, 0, sizeof(state)); + if ((int) mbrtowc(&wch, buffer, count, &state) != status) { + code = ERR; /* the two calls should match */ + } + value = wch; + break; + } + } + } + *result = 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 new file mode 100644 index 0000000..426381c --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_get_wstr.c @@ -0,0 +1,205 @@ +/**************************************************************************** + * Copyright (c) 2002 Free 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 2002 * + ****************************************************************************/ + +/* +** lib_get_wstr.c +** +** The routine wgetn_wstr(). +** +*/ + +#include <curses.priv.h> +#include <term.h> + +MODULE_ID("$Id: lib_get_wstr.c,v 1.3 2002/05/11 22:29:43 tom Exp $") + +/* + * This wipes out the last character, no matter whether it was a tab, control + * or other character, and handles reverse wraparound. + */ +static wchar_t * +WipeOut(WINDOW *win, int y, int x, wchar_t * first, wchar_t * last, bool echoed) +{ + if (last > first) { + *--last = '\0'; + if (echoed) { + int y1 = win->_cury; + int x1 = win->_curx; + + wmove(win, y, x); + waddwstr(win, first); + getyx(win, y, x); + while (win->_cury < y1 + || (win->_cury == y1 && win->_curx < x1)) + waddch(win, (chtype) ' '); + + wmove(win, y, x); + } + } + return last; +} + +NCURSES_EXPORT(int) +wgetn_wstr(WINDOW *win, wint_t * str, int maxlen) +{ + TTY buf; + bool oldnl, oldecho, oldraw, oldcbreak; + wint_t erasec; + wint_t killc; + wchar_t *oldstr; + wchar_t *tmpstr; + wint_t ch; + int y, x, code; + + T((T_CALLED("wgetn_wstr(%p,%p, %d)"), win, str, maxlen)); + + if (!win) + returnCode(ERR); + + _nc_get_tty_mode(&buf); + + oldnl = SP->_nl; + oldecho = SP->_echo; + oldraw = SP->_raw; + oldcbreak = SP->_cbreak; + nl(); + noecho(); + noraw(); + cbreak(); + + erasec = erasechar(); + killc = killchar(); + + assert(sizeof(wchar_t) == sizeof(wint_t)); + oldstr = (wchar_t *) str; + tmpstr = (wchar_t *) str; + + getyx(win, y, x); + + if (is_wintouched(win) || (win->_flags & _HASMOVED)) + wrefresh(win); + + while ((code = wget_wch(win, &ch)) != ERR) { + if (code == KEY_CODE_YES) { + /* + * Some terminals (the Wyse-50 is the most common) generate a \n + * from the down-arrow key. With this logic, it's the user's + * choice whether to set kcud=\n for wget_wch(); terminating + * *getn_wstr() with \n should work either way. + */ + if (ch == '\n' + || ch == '\r' + || ch == KEY_DOWN + || ch == KEY_ENTER) { + if (oldecho == TRUE + && win->_cury == win->_maxy + && win->_scroll) + wechochar(win, (chtype) '\n'); + break; + } + if (ch == erasec || ch == KEY_LEFT || ch == KEY_BACKSPACE) { + if (tmpstr > oldstr) { + tmpstr = WipeOut(win, y, x, oldstr, tmpstr, oldecho); + } + } else if (ch == killc) { + while (tmpstr > oldstr) { + tmpstr = WipeOut(win, y, x, oldstr, tmpstr, oldecho); + } + } else { + beep(); + } + } else if (maxlen >= 0 && tmpstr - oldstr >= maxlen) { + beep(); + } else { + *tmpstr++ = ch; + if (oldecho == TRUE) { + int oldy = win->_cury; + cchar_t tmp; + + setcchar(&tmp, tmpstr - 1, A_NORMAL, 0, NULL); + if (wadd_wch(win, &tmp) == ERR) { + /* + * We can't really use the lower-right corner for input, + * since it'll mess up bookkeeping for erases. + */ + win->_flags &= ~_WRAPPED; + waddch(win, (chtype) ' '); + tmpstr = WipeOut(win, y, x, oldstr, tmpstr, oldecho); + continue; + } else if (win->_flags & _WRAPPED) { + /* + * If the last waddch forced a wrap & scroll, adjust our + * reference point for erasures. + */ + if (win->_scroll + && oldy == win->_maxy + && win->_cury == win->_maxy) { + if (--y <= 0) { + y = 0; + } + } + win->_flags &= ~_WRAPPED; + } + wrefresh(win); + } + } + } + + win->_curx = 0; + win->_flags &= ~_WRAPPED; + if (win->_cury < win->_maxy) + win->_cury++; + wrefresh(win); + + /* Restore with a single I/O call, to fix minor asymmetry between + * raw/noraw, etc. + */ + SP->_nl = oldnl; + SP->_echo = oldecho; + SP->_raw = oldraw; + SP->_cbreak = oldcbreak; + + _nc_set_tty_mode(&buf); + + *tmpstr = 0; + if (code == ERR) { + if (tmpstr == oldstr) { + *tmpstr++ = (wchar_t)WEOF; + *tmpstr = 0; + } + returnCode(ERR); + } + + T(("wgetn_wstr returns %s", _nc_viswbuf(oldstr))); + + returnCode(OK); +} diff --git a/contrib/ncurses/ncurses/widechar/lib_hline_set.c b/contrib/ncurses/ncurses/widechar/lib_hline_set.c new file mode 100644 index 0000000..43175de --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_hline_set.c @@ -0,0 +1,79 @@ +/**************************************************************************** + * Copyright (c) 2002 Free 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 Dickey 2002 * + ****************************************************************************/ + +/* +** lib_hline_set.c +** +** The routine whline_set(). +** +*/ + +#include <curses.priv.h> + +MODULE_ID("$Id: lib_hline_set.c,v 1.2 2002/03/23 21:35:34 tom Exp $") + +NCURSES_EXPORT(int) +whline_set(WINDOW *win, const cchar_t * ch, int n) +{ + int code = ERR; + NCURSES_SIZE_T start; + NCURSES_SIZE_T end; + + T((T_CALLED("whline_set(%p,%s,%d)"), win, _tracecchar_t(ch), n)); + + if (win) { + struct ldat *line = &(win->_line[win->_cury]); + NCURSES_CH_T wch; + + start = win->_curx; + end = start + n - 1; + if (end > win->_maxx) + end = win->_maxx; + + CHANGED_RANGE(line, start, end); + + if (ch == 0) + wch = *WACS_HLINE; + else + wch = *ch; + wch = _nc_render(win, wch); + + while (end >= start) { + line->text[end] = wch; + end--; + } + + _nc_synchook(win); + code = OK; + } + returnCode(code); +} diff --git a/contrib/ncurses/ncurses/widechar/lib_in_wch.c b/contrib/ncurses/ncurses/widechar/lib_in_wch.c new file mode 100644 index 0000000..562fa82 --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_in_wch.c @@ -0,0 +1,60 @@ +/**************************************************************************** + * Copyright (c) 2002 Free 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 Dickey 2002 * + ****************************************************************************/ + +/* +** lib_in_wch.c +** +** The routine win_wch(). +** +*/ + +#include <curses.priv.h> + +MODULE_ID("$Id: lib_in_wch.c,v 1.1 2002/03/10 20:22:00 tom Exp $") + +NCURSES_EXPORT(int) +win_wch(WINDOW *win, NCURSES_CONST cchar_t * wcval) +{ + int row, col; + int code = OK; + + TR(TRACE_CCALLS, (T_CALLED("win_wch(%p,%p)"), win, wcval)); + if (win != 0 + && wcval != 0) { + getyx(win, row, col); + + *wcval = win->_line[row].text[col]; + } else { + code = ERR; + } + returnCode(code); +} diff --git a/contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c b/contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c new file mode 100644 index 0000000..42268ec --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_in_wchnstr.c @@ -0,0 +1,62 @@ +/**************************************************************************** + * Copyright (c) 2002 Free 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 Dickey 2002 * + ****************************************************************************/ + +/* +** lib_in_wchnstr.c +** +** The routine win_wchnstr(). +** +*/ + +#include <curses.priv.h> + +MODULE_ID("$Id: lib_in_wchnstr.c,v 1.1 2002/04/13 19:33:57 tom Exp $") + +NCURSES_EXPORT(int) +win_wchnstr(WINDOW *win, NCURSES_CONST cchar_t * wchstr, int n) +{ + int code = OK; + + TR(TRACE_CCALLS, (T_CALLED("win_wchnstr(%p,%p,%d)"), win, wchstr, n)); + if (win != 0 + && wchstr != 0) { + + if (n < 0) { + n = getmaxx(win) + 1 - getcurx(win); + } + while (n-- > 0) + win_wch(win, wchstr++); + } else { + code = ERR; + } + returnCode(code); +} diff --git a/contrib/ncurses/ncurses/widechar/lib_ins_nwstr.c b/contrib/ncurses/ncurses/widechar/lib_ins_nwstr.c new file mode 100644 index 0000000..8302b8b --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_ins_nwstr.c @@ -0,0 +1,84 @@ +/**************************************************************************** + * Copyright (c) 2002 Free 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 Dickey 2002 * + ****************************************************************************/ + +/* +** lib_ins_nwstr.c +** +** The routine wins_nwstr(). +** +*/ + +#include <curses.priv.h> +#include <ctype.h> + +MODULE_ID("$Id: lib_ins_nwstr.c,v 1.2 2002/03/10 22:43:12 tom Exp $") + +NCURSES_EXPORT(int) +wins_nwstr(WINDOW *win, const wchar_t * wstr, int n) +{ + int code = ERR; + NCURSES_SIZE_T oy; + NCURSES_SIZE_T ox; + const wchar_t *cp; + + T((T_CALLED("wins_nwstr(%p,%s,%d)"), win, _nc_viswbuf(wstr), n)); + + if (win != 0 + && wstr != 0 + && wcwidth(*wstr) > 0) { + code = OK; + if (n < 1) + n = wcslen(wstr); + oy = win->_cury; + ox = win->_curx; + for (cp = wstr; *cp && ((cp - wstr) < n); cp++) { + NCURSES_CH_T wch; + SetChar2(wch, *cp); + if (*cp == '\n' || *cp == '\r' || *cp == '\t' || *cp == '\b') { + _nc_waddch_nosync(win, wch); + } else if (is7bits(*cp) && iscntrl(*cp)) { + winsch(win, ' ' + (chtype) (*cp)); + winsch(win, (chtype) '^'); + win->_curx += 2; + } else if (wins_wch(win, &wch) == ERR + || win->_curx > win->_maxx) { + break; + } + } + + win->_curx = ox; + win->_cury = oy; + _nc_synchook(win); + code = OK; + } + returnCode(code); +} diff --git a/contrib/ncurses/ncurses/widechar/lib_ins_wch.c b/contrib/ncurses/ncurses/widechar/lib_ins_wch.c new file mode 100644 index 0000000..0821ee5 --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_ins_wch.c @@ -0,0 +1,65 @@ +/**************************************************************************** + * Copyright (c) 2002 Free 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 Dickey 2002 * + ****************************************************************************/ + +/* +** lib_ins_wch.c +** +** The routine wins_wch(). +** +*/ + +#include <curses.priv.h> + +MODULE_ID("$Id: lib_ins_wch.c,v 1.1 2002/03/10 22:25:06 tom Exp $") + +NCURSES_EXPORT(int) +wins_wch(WINDOW *win, const cchar_t * wch) +{ + int code = ERR; + + T((T_CALLED("wins_wch(%p, %s)"), win, _tracecchar_t(wch))); + + if (win) { + 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 - 1; + + CHANGED_TO_EOL(line, win->_curx, win->_maxx); + while (temp1 > end) + *temp1-- = *temp2--; + + *temp1 = _nc_render(win, *wch); + code = OK; + } + returnCode(code); +} diff --git a/contrib/ncurses/ncurses/widechar/lib_inwstr.c b/contrib/ncurses/ncurses/widechar/lib_inwstr.c new file mode 100644 index 0000000..c3c46fa --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_inwstr.c @@ -0,0 +1,96 @@ +/**************************************************************************** + * Copyright (c) 2002 Free 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 Dickey 2002 * + ****************************************************************************/ + +/* +** lib_inwstr.c +** +** The routines winnwstr() and winwstr(). +** +*/ + +#include <curses.priv.h> + +MODULE_ID("$Id: lib_inwstr.c,v 1.1 2002/03/10 00:25:27 tom Exp $") + +NCURSES_EXPORT(int) +winnwstr(WINDOW *win, wchar_t * wstr, int n) +{ + int row, col, inx; + int count = 0; + int last = 0; + cchar_t *text; + wchar_t wch; + + TR(TRACE_CCALLS, (T_CALLED("winnwstr(%p,%p,%d)"), win, wstr, n)); + if (wstr != 0) { + if (win) { + getyx(win, row, col); + + text = win->_line[row].text; + while (count < n && count != ERR) { + for (inx = 0; (inx < CCHARW_MAX) + && ((wch = text[col].chars[inx]) != 0); + ++inx) { + if (count + 1 >= n) { + if ((count = last) == 0) { + count = ERR; /* error if we t store nothing */ + } + break; + } + wstr[count++] = wch; + } + last = count; + if (++col > win->_maxx) { + break; + } + } + } + if (count > 0) + wstr[count] = '\0'; + } + returnCode(count); +} + +/* + * X/Open says winwstr() returns OK if not ERR. If that is not a blunder, it + * must have a null termination on the string (see above). Unlike winnstr(), + * it does not define what happens for a negative count with winnwstr(). + */ +NCURSES_EXPORT(int) +winwstr(WINDOW *win, wchar_t * wstr) +{ + int result = OK; + TR(TRACE_CCALLS, (T_CALLED("winwstr(%p,%p)"), win, 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_unget_wch.c b/contrib/ncurses/ncurses/widechar/lib_unget_wch.c new file mode 100644 index 0000000..b4b3433 --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_unget_wch.c @@ -0,0 +1,76 @@ +/**************************************************************************** + * Copyright (c) 2002 Free 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 2002 * + ****************************************************************************/ + +/* +** lib_unget_wch.c +** +** The routine unget_wch(). +** +*/ + +#include <curses.priv.h> + +MODULE_ID("$Id: lib_unget_wch.c,v 1.2 2002/03/17 00:01:38 tom Exp $") + +NCURSES_EXPORT(int) +unget_wch(const wchar_t wch) +{ + int result = OK; + mbstate_t state; + size_t length; + int n; + + T((T_CALLED("unget_wch(%d)"), wch)); + + memset(&state, 0, sizeof(state)); + length = wcrtomb(0, wch, &state); + + if (length != (size_t) (-1) + && length != 0) { + char *string = malloc(length); + + memset(&state, 0, sizeof(state)); + wcrtomb(string, wch, &state); + + for (n = (int) (length - 1); n >= 0; --n) { + if (ungetch(string[n]) != OK) { + result = ERR; + break; + } + } + free(string); + } else { + result = ERR; + } + + returnCode(result); +} diff --git a/contrib/ncurses/ncurses/widechar/lib_vid_attr.c b/contrib/ncurses/ncurses/widechar/lib_vid_attr.c new file mode 100644 index 0000000..06e7880 --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_vid_attr.c @@ -0,0 +1,94 @@ +/**************************************************************************** + * Copyright (c) 2002 Free 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 2002 * + ****************************************************************************/ + +#include <curses.priv.h> +#include <term.h> + +MODULE_ID("$Id: lib_vid_attr.c,v 1.1 2002/05/11 20:55:26 tom Exp $") + +#define set_color(mode, pair) mode &= ~A_COLOR; mode |= COLOR_PAIR(pair) + +NCURSES_EXPORT(int) +vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int)) +{ + T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair)); + set_color(newmode, pair); + returnCode(vidputs(newmode, outc)); +} + +#undef vid_attr +NCURSES_EXPORT(int) +vid_attr(attr_t newmode, short pair, void *opts GCC_UNUSED) +{ + T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), pair)); + set_color(newmode, pair); + returnCode(vidputs(newmode, _nc_outch)); +} + +NCURSES_EXPORT(attr_t) +term_attrs(void) +{ + attr_t attrs = WA_NORMAL; + + T((T_CALLED("term_attrs()"))); + if (enter_alt_charset_mode) + attrs |= WA_ALTCHARSET; + + if (enter_blink_mode) + attrs |= WA_BLINK; + + if (enter_bold_mode) + attrs |= WA_BOLD; + + if (enter_dim_mode) + attrs |= WA_DIM; + + if (enter_reverse_mode) + attrs |= WA_REVERSE; + + if (enter_standout_mode) + attrs |= WA_STANDOUT; + + if (enter_protected_mode) + attrs |= WA_PROTECT; + + if (enter_secure_mode) + attrs |= WA_INVIS; + + if (enter_underline_mode) + attrs |= WA_UNDERLINE; + + if (SP->_coloron) + attrs |= A_COLOR; + + returnAttr(attrs); +} diff --git a/contrib/ncurses/ncurses/widechar/lib_vline_set.c b/contrib/ncurses/ncurses/widechar/lib_vline_set.c new file mode 100644 index 0000000..af42df1 --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_vline_set.c @@ -0,0 +1,78 @@ +/**************************************************************************** + * Copyright (c) 2002 Free 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 Dickey 2002 * + ****************************************************************************/ + +/* +** lib_vline_set.c +** +** The routine wvline_set(). +** +*/ + +#include <curses.priv.h> + +MODULE_ID("$Id: lib_vline_set.c,v 1.2 2002/03/23 21:36:01 tom Exp $") + +NCURSES_EXPORT(int) +wvline_set(WINDOW *win, const cchar_t * ch, int n) +{ + int code = ERR; + NCURSES_SIZE_T row, col; + NCURSES_SIZE_T end; + + T((T_CALLED("wvline(%p,%s,%d)"), win, _tracecchar_t(ch), n)); + + if (win) { + NCURSES_CH_T wch; + row = win->_cury; + col = win->_curx; + end = row + n - 1; + if (end > win->_maxy) + end = win->_maxy; + + if (ch == 0) + wch = *WACS_VLINE; + else + wch = *ch; + wch = _nc_render(win, wch); + + while (end >= row) { + struct ldat *line = &(win->_line[end]); + line->text[col] = wch; + CHANGED_CELL(line, col); + end--; + } + + _nc_synchook(win); + code = OK; + } + returnCode(code); +} diff --git a/contrib/ncurses/ncurses/widechar/lib_wacs.c b/contrib/ncurses/ncurses/widechar/lib_wacs.c new file mode 100644 index 0000000..05fa329 --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_wacs.c @@ -0,0 +1,120 @@ +/**************************************************************************** + * Copyright (c) 2002 Free 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 Dickey 2002 * + ****************************************************************************/ + +#include <curses.priv.h> +#include <term.h> + +MODULE_ID("$Id: lib_wacs.c,v 1.2 2002/02/17 00:02:15 tom Exp $") + +NCURSES_EXPORT_VAR(cchar_t) * _nc_wacs = 0; + +static int +_nc_unicode_locale(void) +{ + char *s; + if (((s = getenv("LC_ALL")) != 0 && *s != '\0') + || ((s = getenv("LC_ALL")) != 0 && *s != '\0') + || ((s = getenv("LC_ALL")) != 0 && *s != '\0')) { + if (strstr(s, ".UTF-8") != 0) + return 1; + } + return 0; +} + +NCURSES_EXPORT(void) +_nc_init_wacs(void) +{ + /* *INDENT-OFF* */ + static const struct { + int map; + int value[2]; + } table[] = { + /* VT100 symbols */ + { 'l', { '+', 0x250c }}, /* upper left corner */ + { 'm', { '+', 0x2514 }}, /* lower left corner */ + { 'k', { '+', 0x2510 }}, /* upper right corner */ + { 'j', { '+', 0x2518 }}, /* lower right corner */ + { 't', { '+', 0x251c }}, /* tee pointing left */ + { 'u', { '+', 0x2524 }}, /* tee pointing right */ + { 'v', { '+', 0x2534 }}, /* tee pointing up */ + { 'w', { '+', 0x252c }}, /* tee pointing down */ + { 'q', { '-', 0x2500 }}, /* horizontal line */ + { 'x', { '|', 0x2502 }}, /* vertical line */ + { 'n', { '+', 0x253c }}, /* large plus or crossover */ + { 'o', { '~', 0x23ba }}, /* scan line 1 */ + { 's', { '_', 0x23bd }}, /* scan line 9 */ + { '\'', { '+', 0x25c6 }}, /* diamond */ + { 'a', { ':', 0x2592 }}, /* checker board (stipple) */ + { 'f', { '\'', 0x00b0 }}, /* degree symbol */ + { 'g', { '#', 0x00b1 }}, /* plus/minus */ + { '~', { 'o', 0x00b7 }}, /* bullet */ + /* Teletype 5410v1 symbols */ + { ',', { '<', 0x2190 }}, /* arrow pointing left */ + { '+', { '>', 0x2192 }}, /* arrow pointing right */ + { '.', { 'v', 0x2193 }}, /* arrow pointing down */ + { '-', { '^', 0x2191 }}, /* arrow pointing up */ + { 'h', { '#', 0x2592 }}, /* board of squares */ + { 'i', { '#', 0x2603 }}, /* lantern symbol */ + { '0', { '#', 0x25ae }}, /* solid square block */ + /* these defaults were invented for ncurses */ + { 'p', { '-', 0x23bb }}, /* scan line 3 */ + { 'r', { '-', 0x23bc }}, /* scan line 7 */ + { 'y', { '<', 0x2264 }}, /* less-than-or-equal-to */ + { 'z', { '>', 0x2265 }}, /* greater-than-or-equal-to */ + { '{', { '*', 0x03c0 }}, /* greek pi */ + { '|', { '!', 0x2260 }}, /* not-equal */ + { '}', { 'f', 0x00a3 }}, /* pound-sterling symbol */ + }; + /* *INDENT-ON* */ + + unsigned n, m; + int active = _nc_unicode_locale(); + + T(("initializing WIDE-ACS map (Unicode is%s active)", + active ? "" : " not")); + + if (active) { + enter_alt_charset_mode = ""; + exit_alt_charset_mode = ""; + acs_chars = ""; + ena_acs = ""; + } + _nc_wacs = typeCalloc(cchar_t, ACS_LEN); + for (n = 0; n < SIZEOF(table); ++n) { + m = table[n].map; + SetChar(_nc_wacs[m], table[n].value[active], A_NORMAL); + T(("#%d, SetChar(%c, %#04x) = %s", + n, m, + table[n].value[active], + _tracecchar_t(&_nc_wacs[m]))); + } +} diff --git a/contrib/ncurses/ncurses/widechar/lib_wunctrl.c b/contrib/ncurses/ncurses/widechar/lib_wunctrl.c new file mode 100644 index 0000000..f4887d1 --- /dev/null +++ b/contrib/ncurses/ncurses/widechar/lib_wunctrl.c @@ -0,0 +1,56 @@ +/**************************************************************************** + * Copyright (c) 2001 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/* +** lib_wunctrl.c +** +** The routine wunctrl(). +** +*/ + +#include <curses.priv.h> + +#if USE_WIDEC_SUPPORT + +MODULE_ID("$Id: lib_wunctrl.c,v 1.6 2001/09/22 19:18:02 tom Exp $") + +NCURSES_EXPORT(wchar_t *) +wunctrl(cchar_t * wc) +{ + static wchar_t str[5], *sp; + + if (Charable(*wc)) { + const char *p; + for (p = unctrl(wctob(CharOf(*wc))), sp = str; *p;) + *sp++ = btowc(*p++); + return str; + } else + return wc->chars; +} + +#endif |