From ed262ffa724293508a427a68b191daed286e846c Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 25 Jan 1998 02:31:23 -0500 Subject: [PATCH] snapshot of project "ncurses", label v4_1_980124 --- Ada95/samples/Makefile.in | 4 +- NEWS | 115 ++++++++++++++++++++++++-------------- aclocal.m4 | 31 +++++++--- c++/cursesw.h | 10 +++- configure.in | 58 ++++++++++++++++--- dist.mk | 4 +- misc/Makefile.in | 4 +- misc/emx.src | 7 ++- misc/terminfo.src | 46 ++++++++++++++- ncurses/Makefile.in | 28 +++++----- ncurses/curses.priv.h | 4 +- ncurses/lib_color.c | 12 +++- ncurses/lib_data.c | 12 +++- ncurses/lib_doupdate.c | 8 ++- ncurses/lib_initscr.c | 8 ++- ncurses/lib_mvcur.c | 11 ++-- ncurses/lib_setup.c | 4 +- ncurses/lib_traceatr.c | 4 +- ncurses/lib_twait.c | 8 ++- ncurses/lib_vidattr.c | 60 +++++++++++++++++--- progs/Makefile.in | 69 ++++++++++++----------- progs/infocmp.c | 6 +- progs/progs.priv.h | 19 ++++--- test/Makefile.in | 109 ++++++++++++++++++------------------ test/configure.in | 6 +- test/ncurses.c | 58 ++++++++++++++++--- 26 files changed, 490 insertions(+), 215 deletions(-) diff --git a/Ada95/samples/Makefile.in b/Ada95/samples/Makefile.in index d6134395..7948903c 100644 --- a/Ada95/samples/Makefile.in +++ b/Ada95/samples/Makefile.in @@ -19,7 +19,7 @@ # This binding comes AS IS with no warranty, implied or expressed. -- #---------------------------------------------------------------------------- # Version Control -# $Revision: 1.13 $ +# $Revision: 1.14 $ # .SUFFIXES: @@ -66,7 +66,7 @@ ada_objdir=../ada_objects LD_FLAGS = @LD_MODEL@ $(LOCAL_LIBS) @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS) ADA = @cf_ada_compiler@ -ADAFLAGS = @ADAFLAGS@ -gnatn -I$(srcdir) +ADAFLAGS = @ADAFLAGS@ -I$(srcdir) ADAMAKE = @cf_ada_make@ ADAMAKEFLAGS = -aI$(srcdir) -aI$(ada_srcdir) -aI$(srcdir)/$(ada_srcdir) -aO$(ada_objdir) diff --git a/NEWS b/NEWS index ff873e0f..98aa4479 100644 --- a/NEWS +++ b/NEWS @@ -1,31 +1,64 @@ --- $Id: NEWS,v 1.299 1998/01/18 01:42:49 tom Exp $ +-- $Id: NEWS,v 1.302 1998/01/25 02:30:26 tom Exp $ -This is a log of changes that ncurses has gone through since Zeyd -started working with Pavel Curtis' original work, pcurses, in 1992: +This is a log of changes that ncurses has gone through since Zeyd started +working with Pavel Curtis' original work, pcurses, in 1992. + +Changes through 1.9.9e are recorded by Zeyd M. Ben-Halim. +Changes since 1.9.9e are recorded by Thomas Dickey. + +980124 + + add f/F/b/B commands to ncurses 'b' test to toggle colors, providing + test for no_color_video. + + adjusted emx.src to use no_color_video, now works with ncurses 'b' + and 'k' tests. + + implement no_color_video attribute, and as a special case, reverse + colors when the reverse attribute cannot be combined with color. + + check for empty string in $TERM variable (reported by Brett Michaels + ). + > from reports by Fred Fish: + + add configure-test for isascii + + add configure-test for -lm library. + + modify CF_BOOL_SIZE to check if C++ bool types are unsigned. + > patches by J.J.G.Ripoll + + add configure/makefile variables to support .exe extension on + OS/2 EMX (requires additional autoconf patches). + + explicitly initialize variables in lib_data.c to appease OS/2 linker + > patches by Fred Fish + + misc/Makefile.in (install.data): Avoid trying to install the CVS + directory. + + aclocal.m4 (install.includes): Remove files in the include directory + where we are going to install new ones, not the original source + files. + + misc/terminfo.src: Add entry for "beterm", derived from termcap + distributed with BeOS PR2 using captoinfo. + + aclocal.m4: Wrap $cf_cv_type_of_bool with quotes (contains space) + + aclocal.m4: Assume bool types are unsigned. + + progs/infocmp.c: workaround mwcc 32k function data limit 980117 - + correct initialization of color-pair (from 970524) in xmas.c, - which was using only one color-pair for all colors. + + correct initialization of color-pair (from 970524) in xmas.c, which + was using only one color-pair for all colors (reported by + J.J.G.Ripoll). + add multithread options for objects build on EMX, for compatibility with XFree86. + split up an expression in MKlib_gen.sh to work around a problem on - OS/2 EMX, with 'ash' (Juan Jose Garcia Ripoll). - + change terminfo entries xterm (xterm-xf86-v40), xterm-8bit rs1 to - use hard reset. + OS/2 EMX, with 'ash' (patch by J.J.G.Ripoll). + + change terminfo entries xterm (xterm-xf86-v40), xterm-8bit rs1 to use + hard reset. + rename terminfo entry xterm-xf86-v39t to xterm-xf86-v40 + remove bold/underline from sun console entries since they're not implemented. - + correct _tracef calls in _tracedump(), which did not separate - format from parameters. + + correct _tracef calls in _tracedump(), which did not separate format + from parameters. + correct getopt string for tic "-o" option, and add it to man-page synopsis (reported by Darren Hiebert ). - + correct typo in panel/Makefile.in, reversed if-statement in - scrolling optimization (Alexander V. Lukyanov). - + test for 'remove()', use 'unlink() if not found (patch by Philippe - De Muyter ). + + correct typo in panel/Makefile.in, reversed if-statement in scrolling + optimization (Alexander V. Lukyanov). + + test for 'remove()', use 'unlink() if not found (patch by Philippe De + Muyter ). > patches by Juergen Pfeifer: + Improve a feature of the forms driver. For invisible fields - (O_VISIBLE off) only the contents but not the attributes are cleared. + (O_VISIBLE off) only the contents but not the attributes are cleared. We now clear both. (Reported by Javier Kohan ) + The man page form_field_opts.3x makes now clear, that invisible @@ -41,18 +74,18 @@ started working with Pavel Curtis' original work, pcurses, in 1992: cur_term is null, or if underlying I/O fails. + amend change to tputs() so that it does not return an error if cur_term is null, since some applications depend on being able to use - tputs without initializing the terminal (reported by Christian J. + tputs without initializing the terminal (reported by Christian J. Robinson ). 980103 - + add a copy of emx.src from Ripoll's OS/2 EMX version of ncurses + + add a copy of emx.src from J.J.G.Ripoll's OS/2 EMX version of ncurses 1.9.9e, together with fixes/additions for the "ansi" terminal type. + add tic check for save/restore cursor if change_scroll_region is defined (from O'Reilly book). + modify read_termcap.c to handle EMX-style pathnames (reported by - Juan Jose Garcia Ripoll). - + modify lib_raw.c to use EMX's setmode (from Juan Jose Garcia Ripoll, - who says EMX's curses does this). + J.J.G.Ripoll). + + modify lib_raw.c to use EMX's setmode (from J.J.G.Ripoll, who says + EMX's curses does this). + modify _nc_tic_expand() to generate \0 rather than \200. + move/revise 'expand()' from dump_entry.c to ncurses library as _nc_tic_expand(), for use by tack. @@ -71,11 +104,11 @@ started working with Pavel Curtis' original work, pcurses, in 1992: 971227 + modify open/fopen calls to use binary mode, needed for EMX. + modify configure script to work with autoconf 2.10 mods for OS/2 - EMX from Juan Jose Garcia Ripoll. + EMX from J.J.G.Ripoll. + generated ncurses_cfg.h with patch (971222) to autoconf 2.12 which bypasses limited sed buffer length. - > several changes from Juan Jose Garcia Ripoll to - support OS/2 EMX: + > several changes from Juan Jose Garcia Ripoll + (J.J.G.Ripoll) to support OS/2 EMX: + add a _scrolling flag to SP, to set when we encounter a terminal that simply cannot scroll. + corrected logic in _nc_add_to_try(), by ensuring that strings with @@ -142,12 +175,12 @@ started working with Pavel Curtis' original work, pcurses, in 1992: not often used (from report by Alexander V. Lukyanov, 970825) + rewrote Dan Nelson's change to make it portable, as well as to correct logic for handling backslashes. - + add code to _nc_tgetent() to make it work more like a real tgetent(). + + add code to _nc_tgetent() to make it work more like a real tgetent(). It removes all empty fields, and removes all but the first in a group of duplicate caps. The code was pulled from the BSD libtermcap code in termcap.c (patch by Dan Nelson + don't include --enable-widec in the --with-develop configure option, - since it is not binary-compatible with 4.1 (noted by Alexander V. + since it is not binary-compatible with 4.1 (noted by Alexander V. Lukyanov) > patch by Juergen Pfeifer: + further improvements of the usage of elaboration pragmas in the Ada95 @@ -167,10 +200,10 @@ started working with Pavel Curtis' original work, pcurses, in 1992: + rename xhpterm back to hpterm. > patch by Juergen Pfeifer: + Improves the usage of elaboration pragmas for the Ada95 binding. - + Adds a translation of the test/rain.c into Ada95 to the samples. + + Adds a translation of the test/rain.c into Ada95 to the samples. This has been contributed to the project by Laurent Pautet (pautet@gnat.com) - + 971115 + increase MAX_NAME_SIZE to 512 to handle extremely long alias list in HP-UX terminfo. @@ -300,7 +333,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: + modify mouseinterval() so that a negative parameter queries the click-interval without modifying it. + modify ncurses 'i' test to work with ncurses' apparent extension from - SVr4, i.e., allows nocbreak+noecho (analysis by Alexander V. + SVr4, i.e., allows nocbreak+noecho (analysis by Alexander V. Lukyanov). + add configure options --with-ada-includes and --with-ada-objects, to drive Ada95 binding install (not yet implemented). @@ -353,7 +386,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: by Alexander V. Lukyanov). > patches by Alexander V. Lukyanov: + modify tactics 2 and 5 in onscreen_mvcur(), to allow them on the last - line of the screen, since carriage return will not cause a newline. + line of the screen, since carriage return will not cause a newline. + remove clause from PutCharLR() that would try to use eat_newline_glitch since that apparently does not work on some terminals (e.g., M$ telnet). @@ -426,7 +459,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: + undo attempt to do recursive inlining for PutChar(), noting that it did not improve timing measurably, but inflated the size of lib_doupdate.o - + 970913 + modify rain.c to use color. + correct scroll_csr_backward() to match scroll_csr_forward(). @@ -477,7 +510,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: forms field by index. + Enhanced menu/m_adabind.c with function _nc_get_item() to get a menus item by index. - + Fixed in curses.h.in: make chtype argument for pechochar() constant. + + Fixed in curses.h.in: make chtype argument for pechochar() constant. Mark wbkgdset() as implemented, remove wbkgdset macro, because it was broken (didn't handle colors correctly). + Enhanced lib_mouse.c: added _nc_has_mouse() function @@ -486,7 +519,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: streamlined implementation of wbkgd() + Modified lib_mvwin.c: Disable move of a pad. Implement (costly) move of subwindows. Fixed update behaviour of movements of regular - windows. + windows. + Fixed lib_pad.c: make chtype argument of pechochar() const. + Fixed lib_window.c: dupwin() is not(!) in every bit a really clone of the original. Subwindows become regular windows by doing a @@ -614,7 +647,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: 970816 + implement experimental _nc_perform_scroll(). + modify newterm (actually _nc_setupscreen()) to emit an sgr0 when - initializing the screen, as does SVr4 (reported by Alexander V. + initializing the screen, as does SVr4 (reported by Alexander V. Lukyanov). + added test_progs rule to ncurses/Makefile. + modify test/configure.in to check if initscr is already in $LIBS @@ -642,7 +675,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: > patches by H.J.Lu for glibc integration: + add modules define_key, keyok, name_match, tries + add makefile rules for some of the unit tests in ncurses (mvcur, - captoinfo, hardscroll, hashmap). + captoinfo, hardscroll, hashmap). + update Linux configure-script for wide-character definitions. 970809 @@ -694,7 +727,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: + modify tset to look in /etc/ttys or /etc/ttytype if the configuration does not have getttynam(). + extend baudrate table in tset.c to match baudrate() function. - + add table entries for 230400 and 460800 bd to baudrate() function. + + add table entries for 230400 and 460800 bd to baudrate() function. + improve breakout logic by allowing it before the first line updated, which is what SVr4 curses does (patch by Alexander V. Lukyanov). + correct initialization of vcost in relative_move(), for cursor-down @@ -740,14 +773,14 @@ started working with Pavel Curtis' original work, pcurses, in 1992: 970706 + correct change from 970628 to ClrUpdate() in lib_doupdate.c so that - contents of curscr are saved in newscr before clearing the screen. + contents of curscr are saved in newscr before clearing the screen. This is needed to make repainting work with the present logic of TransformLine(). + use napms() rather than sleep() in tset.c to avoid interrupting I/O. 970705 + add limit checks to _nc_read_file_entry() to guard against overflow - of buffer when reading incompatible terminfo format, e.g, from OSF/1. + of buffer when reading incompatible terminfo format, e.g, from OSF/1. + correct some loop-variable errors in xmc support in lib_doupdate.c + modify ncurses 'b' test to add gaps, specified by user, to allow investigation of interaction with xmc (magic cookie) code. @@ -927,7 +960,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: ). + drop unnecessary check for attribute-change in onscreen_mvcur() since mvcur() is the only caller within the library, and that check in turn - is exercised only from lib_doupdate.c (patch by Alexander V. + is exercised only from lib_doupdate.c (patch by Alexander V. Lukyanov). + add 'blank' parameter to _nc_scroll_window() so _nc_mvcur_scrolln() can use the background of stdscr as a parameter to that function @@ -939,7 +972,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: further optimized/reduced by using ClearScreen() and TransformLine() to get rid of duplicate code (patch by Alexander V. Lukyanov). + modify scrolling algorithm in _nc_scroll_optimize() to reject hunks - that are smaller than the distance to be moved (patch by Alexander V. + that are smaller than the distance to be moved (patch by Alexander V. Lukyanov). + correct a place where the panel library was not ifdef'd in ncurses.c (Juergen Pfeifer) @@ -993,7 +1026,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: rather than the strings which they (may) point to. + add check to ensure that C++ binding and demo are not built with g++ versions below 2.7, since the binding uses templates. - + modify c++ binding and demo to build and run with SGI's c++ compiler. + + modify c++ binding and demo to build and run with SGI's c++ compiler. (It also compiles with the Sun SparcWorks compiler, but the demo does not link, due to a vtbl problem). + corrections to demo.cc, to fix out-of-scope variables (Juergen @@ -1119,7 +1152,7 @@ started working with Pavel Curtis' original work, pcurses, in 1992: + add header dependencies so that "make install.libs" will succeed even if "make all" is not done first. + moved some macros from lib_doupdate.c to curses.priv.h to use in - expanded functions with ATAC. + expanded functions with ATAC. + correct implementation of lib_instr.c; both XSI and SVr4 agree that the winnstr functions can return more characters than will fit on one line. diff --git a/aclocal.m4 b/aclocal.m4 index e6644694..a8bfd160 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,5 +1,5 @@ dnl***************************************************************************** -dnl Copyright 1996,1997 by Thomas E. Dickey * +dnl Copyright 1996,1997,1998 by Thomas E. Dickey * dnl All Rights Reserved. * dnl * dnl Permission to use, copy, modify, and distribute this software and its * @@ -17,7 +17,7 @@ dnl RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * dnl CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * dnl CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * dnl***************************************************************************** -dnl $Id: aclocal.m4,v 1.116 1997/12/30 00:07:55 tom Exp $ +dnl $Id: aclocal.m4,v 1.118 1998/01/24 19:03:11 tom Exp $ dnl Macros used in NCURSES auto-configuration script. dnl dnl --------------------------------------------------------------------------- @@ -81,7 +81,9 @@ main() { FILE *fp = fopen("cf_test.out", "w"); if (fp != 0) { - bool x = false; + bool x = true; + if ((-x) >= 0) + fputs("unsigned ", fp); if (sizeof(x) == sizeof(int)) fputs("int", fp); else if (sizeof(x) == sizeof(char)) fputs("char", fp); else if (sizeof(x) == sizeof(short))fputs("short",fp); @@ -97,7 +99,7 @@ main() ]) rm -f cf_test.out AC_MSG_RESULT($cf_cv_type_of_bool) -if test $cf_cv_type_of_bool = unknown ; then +if test "$cf_cv_type_of_bool" = unknown ; then AC_MSG_WARN(Assuming unsigned for type of bool) cf_cv_type_of_bool=unsigned fi @@ -130,7 +132,7 @@ AC_MSG_RESULT($prefix) if test "x$prefix" = "xNONE" ; then AC_MSG_CHECKING(for default include-directory) -test -n "$verbose" && echo 1>&6 +test -n "$verbose" && echo 1>&AC_FD_MSG for cf_symbol in \ $includedir \ $includedir/ncurses \ @@ -145,11 +147,11 @@ do if test -f $cf_dir/curses.h ; then if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then includedir="$cf_symbol" - test -n "$verbose" && echo $ac_n " found " 1>&6 + test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG break fi fi - test -n "$verbose" && echo " tested $cf_dir" 1>&6 + test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG done AC_MSG_RESULT($includedir) fi @@ -434,6 +436,19 @@ fi AC_SUBST(CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- +dnl Check if we have either a function or macro for 'isascii()'. +AC_DEFUN([CF_ISASCII], +[ +AC_MSG_CHECKING(for isascii) +AC_CACHE_VAL(cf_cv_have_isascii,[ + AC_TRY_LINK([#include ],[int x = isascii(' ')], + [cf_cv_have_isascii=yes], + [cf_cv_have_isascii=no]) +])dnl +AC_MSG_RESULT($cf_cv_have_isascii) +test $cf_cv_have_isascii = yes && AC_DEFINE(HAVE_ISASCII) +])dnl +dnl --------------------------------------------------------------------------- dnl Append definitions and rules for the given models to the subdirectory dnl Makefiles, and the recursion rule for the top-level Makefile. If the dnl subdirectory is a library-source directory, modify the LIBRARIES list in @@ -649,7 +664,7 @@ CF_EOF echo " $j" >>$cf_dir/Makefile for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` do - echo " @ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f $i) ; ../headers.sh \$(INSTALL_DATA) \$(INSTALL_PREFIX)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile + echo " @ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(INSTALL_PREFIX)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile test $i = curses.h && echo " @ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f ncurses.h && \$(LN_S) curses.h ncurses.h)" >>$cf_dir/Makefile done diff --git a/c++/cursesw.h b/c++/cursesw.h index d92895bb..0e8e7d4d 100644 --- a/c++/cursesw.h +++ b/c++/cursesw.h @@ -2,12 +2,20 @@ #ifndef _CURSESW_H #define _CURSESW_H -// $Id: cursesw.h,v 1.12 1997/10/11 18:49:39 tom Exp $ +// $Id: cursesw.h,v 1.13 1998/01/20 16:53:50 Fred.Fish Exp $ #include #include #include +#ifdef __MWERKS__ +/* This is a bogus check, stringstream is actually ANSI C++ standard, + * but old compilers like GCC don't have it, and new compilers like Metrowerks + * don't have strstream + */ +#include +#else #include +#endif extern "C" { # include diff --git a/configure.in b/configure.in index f301f93a..a43eaa80 100644 --- a/configure.in +++ b/configure.in @@ -17,10 +17,10 @@ dnl RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * dnl CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * dnl CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * dnl***************************************************************************** -dnl $Id: configure.in,v 1.117 1998/01/17 22:33:43 tom Exp $ +dnl $Id: configure.in,v 1.121 1998/01/25 00:20:10 tom Exp $ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.12.971222) -AC_REVISION($Revision: 1.117 $) +AC_REVISION($Revision: 1.121 $) AC_INIT(ncurses/lib_initscr.c) AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin) @@ -382,13 +382,46 @@ test "$with_getcap_cache" = "yes" && AC_DEFINE(USE_GETCAP_CACHE) fi -### use option --enable-symlinks to make tic use symlinks, not hard links -AC_MSG_CHECKING(if tic should use symbolic links) -AC_ARG_ENABLE(symlinks, +### Use option --enable-symlinks to make tic use symlinks, not hard links +### to reduce storage requirements for the terminfo database. +### +### Most Unix systems have both link and symlink, a few don't have symlink. +### A few non-Unix systems implement symlink, but not link. +### A few non-systems implement neither. + +AC_CHECK_FUNCS( \ + link \ + symlink ) + +with_links=no +with_symlinks=no + +if test "$ac_cv_func_link" != yes ; then + AC_MSG_CHECKING(if tic should use symbolic links) + if test "$ac_cv_func_symlink" = yes ; then + with_symlinks=yes + else + with_symlinks=no + fi + AC_MSG_RESULT($with_symlinks) +elif test "$ac_cv_func_symlink" != yes ; then + AC_MSG_CHECKING(if tic should use hard links) + if test "$ac_cv_func_link" = yes ; then + with_links=yes + else + with_links=no + fi + AC_MSG_RESULT($with_links) +else + AC_MSG_CHECKING(if tic should use symbolic links) + AC_ARG_ENABLE(symlinks, [ --enable-symlinks make tic use symbolic links not hard links], [with_symlinks=$enableval], [with_symlinks=no]) -AC_MSG_RESULT($with_symlinks) + AC_MSG_RESULT($with_symlinks) +fi + +test "$with_links" = yes && AC_DEFINE(USE_LINKS) test "$with_symlinks" = yes && AC_DEFINE(USE_SYMLINKS) ### use option --enable-bsdpad to have tputs process BSD-style prefix padding @@ -549,10 +582,16 @@ AC_ARG_ENABLE(macros, ### Checks for libraries. AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY),[ + AC_CHECK_LIB(bsd, gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY) LIBS="$LIBS -lbsd")])dnl CLIX: bzero, select, gettimeofday +MATH_LIB="" +AC_CHECK_FUNC(floor,, + AC_CHECK_LIB(m, floor,[MATH_LIB="-lm"])) +AC_SUBST(MATH_LIB) + ### Checks for header files. AC_STDC_HEADERS AC_HEADER_DIRENT @@ -580,6 +619,7 @@ unistd.h \ values.h \ ) +PROG_EXT= case $cf_cv_system_name in hpux*) # check for HPUX's ANSI compiler @@ -597,9 +637,13 @@ hpux*) fi ;; os2*) + # We make sure -Zexe is not used -- it would interfere with @PROG_EXT@ CFLAGS="$CFLAGS -Zmt -D__ST_MT_ERRNO__" +# LDFLAGS=`echo "$LDFLAGS -Zmt -Zcrtdll" | sed "s/-Zexe//g"` +# PROG_EXT=".exe" ;; esac +AC_SUBST(PROG_EXT) # check for ISC (this may also define _POSIX_SOURCE) # Note: even non-Posix ISC needs to declare fd_set @@ -628,7 +672,6 @@ CF_SPEED_TYPE ### Checks for library functions. AC_CHECK_FUNCS( \ getttynam \ -link \ memccpy \ poll \ remove \ @@ -651,6 +694,7 @@ if test "$with_getcap" = "yes" ; then CF_CGETENT fi +CF_ISASCII CF_STRUCT_SIGACTION CF_STRUCT_TERMIOS diff --git a/dist.mk b/dist.mk index 5423f884..30f3f991 100644 --- a/dist.mk +++ b/dist.mk @@ -1,4 +1,4 @@ -# $Id: dist.mk,v 1.74 1998/01/17 13:59:58 tom Exp $ +# $Id: dist.mk,v 1.75 1998/01/24 14:16:09 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -10,7 +10,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 4 NCURSES_MINOR = 1 -NCURSES_PATCH = 980117 +NCURSES_PATCH = 980124 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/misc/Makefile.in b/misc/Makefile.in index b56dc74a..37e00358 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.17 1997/12/20 14:46:11 tom Exp $ +# $Id: Makefile.in,v 1.19 1998/01/24 18:09:54 tom Exp $ ################################################################################ # Copyright 1996,1997 by Thomas E. Dickey # # All Rights Reserved. # @@ -63,7 +63,7 @@ install.data: $(INSTALL_PREFIX)$(libdir) \ $(INSTALL_PREFIX)$(tabsetdir) sh $(srcdir)/run_tic.sh $(bindir) $(srcdir) $(ticdir) $(INSTALL_PREFIX) @cd $(srcdir)/tabset && \ - sh -c 'for i in *; do \ + sh -c 'for i in `echo * | fgrep -v CVS | fgrep -v RCS`; do \ echo installing $$i; \ $(INSTALL_DATA) $$i $(INSTALL_PREFIX)$(tabsetdir); done' diff --git a/misc/emx.src b/misc/emx.src index 894098e5..693c7eb8 100644 --- a/misc/emx.src +++ b/misc/emx.src @@ -1,4 +1,4 @@ -# $Id: emx.src,v 1.2 1998/01/04 00:39:44 tom Exp $ +# $Id: emx.src,v 1.3 1998/01/25 02:21:55 tom Exp $ # This is a reformatted copy of the terminfo source for OS/2 EMX from # Juan Jose Garcia Ripoll . # http://www.arrakis.es/~worm/ @@ -204,7 +204,12 @@ ansi.sys|ANSI.SYS 3.1 and later versions, # alt f-keys: F37-F48 # The shift/control/alt keys do not modify each other, but alt overrides both, # and control overrides shift. +# +# Also (possibly only EMX, so we don't put it in ansi.sys, etc): set the +# no_color_video to inform the application that standout(1), underline(2) +# reverse(4) and invisible(64) don't work with color. emx-base|DOS special keys, + ncv#71, ka1=\0G, ka3=\0I, kb2=\0L, diff --git a/misc/terminfo.src b/misc/terminfo.src index c8c2b45a..c20471ab 100644 --- a/misc/terminfo.src +++ b/misc/terminfo.src @@ -1,6 +1,6 @@ ######## TERMINAL TYPE DESCRIPTIONS SOURCE FILE # -# Version 10.1.19 +# Version 10.1.20 # terminfo syntax # # Eric S. Raymond (current maintainer) @@ -523,6 +523,31 @@ nansi.sysk|nansisysk|PC-DOS Public Domain NANSI.SYS with keypad redefined for vi #### ANSI console types # +#### BeOS entry for Terminal program. Seems to be almost ANSI +# +beterm|BeOS Terminal, + am, eo, mir, msgr, xenl, xon, + colors#8, cols#80, it#8, lines#25, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, + dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, flash=\E[?5h\E[?5l$<200/>, home=\E[H, + hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=^J, invis=\E[8m, kb2=\E[G, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kend=\E[4~, kf1=\E[11~, kf10=\E[20~, kf11=\E[21~, + kf12=\E[22~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[16~, kf7=\E[17~, kf8=\E[18~, kf9=\E[19~, + khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kspd=^Z, + nel=^M^J, op=\E[m, rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, + rmso=\E[m, rmul=\E[24m, rs1=\Ec, sc=\E7, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, setb=\E[%p1%'('%+%cm, + setf=\E[%p1%{30}%+%cm, sgr0=\E[0;10m, smir=\E[4h, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, u6=\E[%i%p1%d;%p2%dR, + u7=\E[6n, u8=\E[?6c, u9=\E[c, vpa=\E[%i%p1%dd, + # This entry is good for the 1.2.13 version of the Linux console driver. # # Note: there are numerous broken linux entries out there, which didn't screw @@ -556,7 +581,7 @@ nansi.sysk|nansisysk|PC-DOS Public Domain NANSI.SYS with keypad redefined for vi # From: Eric S. Raymond 15 Dec 1995 linux|linux console, am, bce, eo, mir, msgr, xenl, xon, - it#8, + it#8, ncv@, acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, bel=^G, civis=\E[?25l, clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, @@ -844,6 +869,17 @@ iris-ansi-ap|IRIS ANSI in application-keypad mode, kf12=\E[012q, rmkx=\E>, smkx=\E=, use=iris-ansi, +# From the man-page, this is a quasi-vt100 emulator that runs on SGI's IRIX +# (T.Dickey 98/1/24) +iris-color|xwsh|IRIX ANSI with color, + ncv#33, + csr=\E[%i%p1%d;%p2%dr, dch=\E[%p1%dP, dim=\E[2m, + ech=\E[%p1%dX, ich=\E[%p1%d@, rc=\E8, ritm=\E[23m, + rmul=\E[24m, rs1=\Ec, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sitm=\E[3m, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, + use=klone+color, use=iris-ansi-ap, + # The following is a version of the ibm-pc entry distributed with PC/IX, # (Interactive Systems' System 3 for the Big Blue), modified by Richard # McIntosh at UCB/CSM. The :pt: and :uc: have been removed from the original, @@ -2126,7 +2162,7 @@ color_xterm|cx|cx100|color_xterm color terminal emulator for X, smul=\E[4m, # From: Thomas Dickey 04 Oct 1997 -# Updated: Özgür Kesim 02 Nov 1997 +# Updated: Oezguer Kesim 02 Nov 1997 # Notes: # rxvt 2.21b uses # smacs=\E(B\E)U^N, rmacs=\E(B\E)0^O, @@ -14685,6 +14721,10 @@ v3220|LANPAR Vision II model 3220/3221/3222, # * rename xterm-xf86-v39t to xterm-xf86-v40 # * remove bold/underline from sun console entries since they're not # implemented. +# 10.1.20 (Sat Jan 24 11:02:51 EST 1998) +# * add beterm entry (Fred Fish) +# * add irix-color/xwsh entry. +# * turn ncv off for linux. # # The following sets edit modes for GNU EMACS # Local Variables: diff --git a/ncurses/Makefile.in b/ncurses/Makefile.in index 9be0b272..b044df3d 100644 --- a/ncurses/Makefile.in +++ b/ncurses/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.44 1997/12/20 14:46:11 tom Exp $ +# $Id: Makefile.in,v 1.45 1998/01/20 23:26:14 J.J.G.Ripoll Exp $ ################################################################################ # Copyright 1996,1997 by Thomas E. Dickey # # All Rights Reserved. # @@ -37,6 +37,8 @@ SHELL = /bin/sh THIS = Makefile +x = @PROG_EXT@ + CF_MFLAGS = @cf_cv_makeflags@ @SET_MAKE@ @@ -117,10 +119,10 @@ TEST_ARGS = -L../lib -lncurses TEST_LDFLAGS = @LD_MODEL@ $(TEST_ARGS) @LIBS@ @EXTRA_LIBS@ @LOCAL_LDFLAGS@ @LDFLAGS@ TEST_PROGS = \ - captoinfo \ - hardscroll \ - hashmap \ - lib_mvcur + captoinfo$x \ + hardscroll$x \ + hashmap$x \ + lib_mvcur$x ################################################################################ all :: $(AUTO_SRC) ../lib $(LIBRARIES) @@ -142,15 +144,15 @@ $(INSTALL_PREFIX)$(libdir) : sh $(srcdir)/MKlib_gen.sh "$(CPP)" "$(AWK)" <../include/curses.h | \ fgrep undef >$@ -keys.tries: make_keys $(srcdir)/keys.list +keys.tries: make_keys$x $(srcdir)/keys.list ./make_keys $(srcdir)/keys.list > keys.tries -make_keys : \ +make_keys$x : \ $(srcdir)/make_keys.c \ ./names.c $(HOSTCC) -o $@ $(HOSTCCFLAGS) $(srcdir)/make_keys.c $(HOSTLDFLAGS) -make_hash : \ +make_hash$x : \ $(srcdir)/comp_hash.c \ ../include/hashsize.h $(HOSTCC) -o $@ $(HOSTCCFLAGS) -DMAIN_PROGRAM $(srcdir)/comp_hash.c $(HOSTLDFLAGS) @@ -159,7 +161,7 @@ make_hash : \ sh $(srcdir)/MKexpanded.sh "$(CPP)" $(CPPFLAGS) ./comp_captab.c: \ - make_hash \ + make_hash$x \ ../include/hashsize.h \ $(srcdir)/MKcaptab.awk sh $(srcdir)/MKcaptab.awk $(AWK) $(srcdir)/../include/Caps > $@ @@ -205,16 +207,16 @@ realclean :: distclean # These rules build test-programs for the modules that have test-drivers test_progs : $(TEST_PROGS) -captoinfo : $(srcdir)/captoinfo.c $(TEST_DEPS) +captoinfo$x : $(srcdir)/captoinfo.c $(TEST_DEPS) @ECHO_LINK@ $(CC) -o $@ $(CCFLAGS) -DMAIN $(srcdir)/captoinfo.c $(TEST_LDFLAGS) -hardscroll : $(srcdir)/hardscroll.c $(TEST_DEPS) +hardscroll$x : $(srcdir)/hardscroll.c $(TEST_DEPS) @ECHO_LINK@ $(CC) -o $@ $(CCFLAGS) -DSCROLLDEBUG $(srcdir)/hardscroll.c $(TEST_LDFLAGS) -hashmap : $(srcdir)/hashmap.c $(TEST_DEPS) +hashmap$x : $(srcdir)/hashmap.c $(TEST_DEPS) @ECHO_LINK@ $(CC) -o $@ $(CCFLAGS) -DHASHDEBUG $(srcdir)/hashmap.c $(TEST_LDFLAGS) -lib_mvcur : $(srcdir)/lib_mvcur.c $(TEST_DEPS) \ +lib_mvcur$x : $(srcdir)/lib_mvcur.c $(TEST_DEPS) \ ../@DFT_OBJ_SUBDIR@/dump_entry.o @ECHO_LINK@ $(CC) -o $@ $(CCFLAGS) -DNCURSES_TEST -I$(srcdir)/../progs $(srcdir)/lib_mvcur.c ../@DFT_OBJ_SUBDIR@/dump_entry.o $(TEST_LDFLAGS) diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index 18223e62..05ce3245 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -21,7 +21,7 @@ /* - * $Id: curses.priv.h,v 1.97 1998/01/03 19:57:54 tom Exp $ + * $Id: curses.priv.h,v 1.98 1998/01/24 20:04:43 tom Exp $ * * curses.priv.h * @@ -605,7 +605,7 @@ extern int _nc_outch(int); extern int _nc_setupscreen(short, short const, FILE *); extern int _nc_timed_wait(int, int, int *); extern int _nc_waddch_nosync(WINDOW *, const chtype); -extern void _nc_do_color(int, int (*)(int)); +extern void _nc_do_color(int, bool, int (*)(int)); extern void _nc_free_and_exit(int); extern void _nc_freeall(void); extern void _nc_freewin(WINDOW *win); diff --git a/ncurses/lib_color.c b/ncurses/lib_color.c index 3465bceb..1d4ad96f 100644 --- a/ncurses/lib_color.c +++ b/ncurses/lib_color.c @@ -29,7 +29,7 @@ #include -MODULE_ID("$Id: lib_color.c,v 1.21 1997/11/30 00:19:33 tom Exp $") +MODULE_ID("$Id: lib_color.c,v 1.23 1998/01/25 02:02:09 tom Exp $") /* * Only 8 ANSI colors are defined; the ISO 6429 control sequences work only @@ -319,10 +319,13 @@ static int toggled_colors(int c) return c; } -void _nc_do_color(int pair, int (*outc)(int)) +void _nc_do_color(int pair, bool reverse, int (*outc)(int)) { short fg, bg; + if (reverse) + pair = -pair; + if (pair == 0) { if (orig_pair) @@ -341,6 +344,11 @@ void _nc_do_color(int pair, int (*outc)(int)) else { pair_content(pair, &fg, &bg); + if (reverse) { + short xx = fg; + fg = bg; + bg = xx; + } T(("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg)); diff --git a/ncurses/lib_data.c b/ncurses/lib_data.c index 2c431151..8691b08f 100644 --- a/ncurses/lib_data.c +++ b/ncurses/lib_data.c @@ -28,11 +28,17 @@ #include -MODULE_ID("$Id: lib_data.c,v 1.10 1997/09/03 15:27:09 Alexander.V.Lukyanov Exp $") +MODULE_ID("$Id: lib_data.c,v 1.12 1998/01/24 19:28:31 tom Exp $") -WINDOW *stdscr, *curscr, *newscr; +/* + * OS/2's native linker complains if we don't initialize public data when + * constructing a dll (reported by J.J.G.Ripoll). + */ +WINDOW *stdscr = 0; +WINDOW *curscr = 0; +WINDOW *newscr = 0; -SCREEN *_nc_screen_chain; +SCREEN *_nc_screen_chain = 0; /* * The variable 'SP' will be defined as a function on systems that cannot link diff --git a/ncurses/lib_doupdate.c b/ncurses/lib_doupdate.c index d8808455..fbe49b24 100644 --- a/ncurses/lib_doupdate.c +++ b/ncurses/lib_doupdate.c @@ -54,9 +54,15 @@ #endif #endif +#ifdef __BEOS__ +/* BeOS select() only works on sockets. Use the tty hack instead */ +#include +#define select check_select +#endif + #include -MODULE_ID("$Id: lib_doupdate.c,v 1.96 1998/01/11 23:49:03 Alexander.V.Lukyanov Exp $") +MODULE_ID("$Id: lib_doupdate.c,v 1.97 1998/01/20 16:53:50 Fred.Fish Exp $") /* * This define controls the line-breakout optimization. Every once in a diff --git a/ncurses/lib_initscr.c b/ncurses/lib_initscr.c index 32b32aa0..7c1569f5 100644 --- a/ncurses/lib_initscr.c +++ b/ncurses/lib_initscr.c @@ -27,12 +27,13 @@ */ #include +#include /* for MAX_ALIAS */ #if HAVE_SYS_TERMIO_H #include /* needed for ISC */ #endif -MODULE_ID("$Id: lib_initscr.c,v 1.19 1997/06/28 17:41:12 tom Exp $") +MODULE_ID("$Id: lib_initscr.c,v 1.20 1998/01/24 20:48:26 tom Exp $") WINDOW *initscr(void) { @@ -44,7 +45,8 @@ const char *name; if (!initialized) { initialized = TRUE; - if ((name = getenv("TERM")) == 0) + if ((name = getenv("TERM")) == 0 + || *name == '\0') name = "unknown"; if (newterm(name, stdout, stdin) == 0) { fprintf(stderr, "Error opening terminal: %s.\n", name); @@ -64,7 +66,7 @@ const char *name; char *termname(void) { char *term = getenv("TERM"); -static char ret[15]; +static char ret[MAX_ALIAS]; T(("termname() called")); diff --git a/ncurses/lib_mvcur.c b/ncurses/lib_mvcur.c index ced26b3d..d2608d9b 100644 --- a/ncurses/lib_mvcur.c +++ b/ncurses/lib_mvcur.c @@ -141,7 +141,7 @@ #include #include -MODULE_ID("$Id: lib_mvcur.c,v 1.48 1997/10/25 23:34:11 tom Exp $") +MODULE_ID("$Id: lib_mvcur.c,v 1.49 1998/01/24 19:45:23 tom Exp $") #define STRLEN(s) (s != 0) ? strlen(s) : 0 @@ -913,7 +913,7 @@ int _nc_outch(int ch) return OK; } -static char tname[BUFSIZ]; +static char tname[MAX_ALIAS]; static void load_term(void) { @@ -932,7 +932,7 @@ static int roll(int n) int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { - (void) strcpy(tname, getenv("TERM")); + (void) strcpy(tname, termname()); load_term(); _nc_setupscreen(lines, columns, stdout); baudrate(); @@ -968,8 +968,7 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) (void) puts("? -- display this help message"); (void) puts("fy fx ty tx -- (4 numbers) display (fy,fx)->(ty,tx) move"); (void) puts("s[croll] n t b m -- display scrolling sequence"); -(void) printf("r[eload] -- reload terminal info for %s\n", - getenv("TERM")); +(void) printf("r[eload] -- reload terminal info for %s\n", termname()); (void) puts("l[oad] -- load terminal info for type "); (void) puts("d[elete] -- delete named capability"); (void) puts("i[nspect] -- display terminal capabilities"); @@ -1006,7 +1005,7 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) } else if (buf[0] == 'r') { - (void) strcpy(tname, getenv("TERM")); + (void) strcpy(tname, termname()); load_term(); } else if (sscanf(buf, "l %s", tname) == 1) diff --git a/ncurses/lib_setup.c b/ncurses/lib_setup.c index bb83c8b5..a3be5e74 100644 --- a/ncurses/lib_setup.c +++ b/ncurses/lib_setup.c @@ -35,7 +35,7 @@ #include /* lines, columns, cur_term */ -MODULE_ID("$Id: lib_setup.c,v 1.35 1997/12/20 22:23:13 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.36 1998/01/24 19:46:03 tom Exp $") /**************************************************************************** * @@ -250,7 +250,7 @@ int status; if (tname == 0) { tname = getenv("TERM"); - if (tname == 0) + if (tname == 0 || *tname == '\0') ret_error0(-1, "TERM environment variable not set.\n"); } diff --git a/ncurses/lib_traceatr.c b/ncurses/lib_traceatr.c index 1a9472df..3b8e07f3 100644 --- a/ncurses/lib_traceatr.c +++ b/ncurses/lib_traceatr.c @@ -32,7 +32,7 @@ #include #include /* acs_chars */ -MODULE_ID("$Id: lib_traceatr.c,v 1.23 1997/10/18 18:21:32 tom Exp $") +MODULE_ID("$Id: lib_traceatr.c,v 1.24 1998/01/24 20:07:00 tom Exp $") #define COLOR_OF(c) (c < 0 || c > 7 ? "default" : colors[c].name) @@ -73,7 +73,7 @@ unsigned save_nc_tracing = _nc_tracing; strcpy(tmp++, "{"); - for (n = 0; n < sizeof(names)/sizeof(names[0]); n++) { + for (n = 0; n < SIZEOF(names); n++) { if ((newmode & names[n].val) != 0) { if (buf[1] != '\0') strcat(tmp, "|"); diff --git a/ncurses/lib_twait.c b/ncurses/lib_twait.c index 0f22b3f7..ec7177f7 100644 --- a/ncurses/lib_twait.c +++ b/ncurses/lib_twait.c @@ -45,7 +45,13 @@ #endif #endif -MODULE_ID("$Id: lib_twait.c,v 1.26 1997/11/30 01:09:23 tom Exp $") +#ifdef __BEOS__ +/* BeOS select() only works on sockets. Use the tty hack instead */ +#include +#define select check_select +#endif + +MODULE_ID("$Id: lib_twait.c,v 1.27 1998/01/20 16:53:50 Fred.Fish Exp $") /* * We want to define GOOD_SELECT if the last argument of select(2) is diff --git a/ncurses/lib_vidattr.c b/ncurses/lib_vidattr.c index b060114c..1297babc 100644 --- a/ncurses/lib_vidattr.c +++ b/ncurses/lib_vidattr.c @@ -52,7 +52,7 @@ #include #include -MODULE_ID("$Id: lib_vidattr.c,v 1.17 1997/09/28 00:23:21 tom Exp $") +MODULE_ID("$Id: lib_vidattr.c,v 1.19 1998/01/25 02:31:23 tom Exp $") #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) @@ -67,6 +67,8 @@ int vidputs(attr_t newmode, int (*outc)(int)) static attr_t previous_attr = A_NORMAL; attr_t turn_on, turn_off; int pair, current_pair; +bool reverse = FALSE; +bool used_ncv = FALSE; T((T_CALLED("vidputs(%s)"), _traceattr(newmode))); @@ -80,20 +82,61 @@ int pair, current_pair; if (magic_cookie_glitch > 0) newmode &= ~(SP->_xmc_suppress); #endif + + /* + * If we have a terminal that cannot combine color with video + * attributes, use the colors in preference. + */ + if ((newmode & A_COLOR) + && (no_color_video > 0)) { + static const struct { + attr_t video; + unsigned bit; + } table[] = { + { A_STANDOUT, 1 }, + { A_UNDERLINE, 2 }, + { A_REVERSE, 4 }, + { A_BLINK, 8 }, + { A_DIM, 16 }, + { A_BOLD, 32 }, + { A_INVIS, 64 }, + { A_PROTECT, 128 }, + { A_ALTCHARSET, 256 }, + }; + size_t n; + for (n = 0; n < SIZEOF(table); n++) { + if ((table[n].bit & no_color_video) + && (table[n].video & newmode)) { + used_ncv = TRUE; + if (table[n].video == A_REVERSE) + reverse = TRUE; + else + newmode &= ~table[n].video; + } + } + } + if (newmode == previous_attr) returnCode(OK); - turn_off = (~newmode & previous_attr) & ALL_BUT_COLOR; - turn_on = (newmode & ~previous_attr) & ALL_BUT_COLOR; - pair = PAIR_NUMBER(newmode); current_pair = PAIR_NUMBER(previous_attr); + if (reverse) { + newmode &= ~A_REVERSE; + pair = -pair; + } + if (previous_attr & A_REVERSE) + current_pair = -current_pair; + + turn_off = (~newmode & previous_attr) & ALL_BUT_COLOR; + turn_on = (newmode & ~previous_attr) & ALL_BUT_COLOR; + /* if there is no current screen, assume we *can* do color */ if ((!SP || SP->_coloron) && pair == 0) { T(("old pair = %d -- new pair = %d", current_pair, pair)); if (pair != current_pair) { - _nc_do_color(pair, outc); + _nc_do_color(pair, reverse, outc); previous_attr &= ~A_COLOR; } } @@ -108,7 +151,7 @@ int pair, current_pair; previous_attr &= ~A_COLOR; } - } else if (set_attributes) { + } else if (set_attributes && !used_ncv) { if (turn_on || turn_off) { TPUTS_TRACE("set_attributes"); tputs(tparm(set_attributes, @@ -161,10 +204,13 @@ int pair, current_pair; current_pair = PAIR_NUMBER(previous_attr); T(("old pair = %d -- new pair = %d", current_pair, pair)); if (pair != current_pair) { - _nc_do_color(pair, outc); + _nc_do_color(pair, reverse, outc); } } + if (reverse) + newmode |= A_REVERSE; + if (SP) SP->_current_attr = newmode; else diff --git a/progs/Makefile.in b/progs/Makefile.in index 9789fda2..23cabd15 100644 --- a/progs/Makefile.in +++ b/progs/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.31 1997/12/20 20:47:19 tom Exp $ +# $Id: Makefile.in,v 1.32 1998/01/20 23:26:14 J.J.G.Ripoll Exp $ ################################################################################ # Copyright 1996,1997 by Thomas E. Dickey # # All Rights Reserved. # @@ -36,6 +36,7 @@ THIS = Makefile CF_MFLAGS = @cf_cv_makeflags@ @SET_MAKE@ +x = @PROG_EXT@ MODEL = ../@DFT_OBJ_SUBDIR@ INSTALL_PREFIX = @INSTALL_PREFIX@ @@ -90,9 +91,9 @@ LINT_LIBS = -lncurses @LIBS@ AUTO_SRC = \ termsort.c -PROGS = tic toe infocmp clear tput tset +PROGS = tic$x toe$x infocmp$x clear$x tput$x tset$x -TESTPROGS = mvcur tctest hardscroll hashmap +TESTPROGS = mvcur$x tctest$x hardscroll$x hashmap$x # Default library, for linking applications DEPS_CURSES = ../lib/libncurses@DFT_DEP_SUFFIX@ @@ -110,32 +111,32 @@ install.libs: uninstall.libs: install.progs: $(PROGS) $(INSTALL_PREFIX)$(bindir) - $(INSTALL_PROGRAM) tic $(INSTALL_PREFIX)$(bindir)/tic - $(INSTALL_PROGRAM) toe $(INSTALL_PREFIX)$(bindir)/toe - $(INSTALL_PROGRAM) infocmp $(INSTALL_PREFIX)$(bindir)/infocmp - $(INSTALL_PROGRAM) clear $(INSTALL_PREFIX)$(bindir)/clear - $(INSTALL_PROGRAM) tput $(INSTALL_PREFIX)$(bindir)/tput - $(INSTALL_PROGRAM) tset $(INSTALL_PREFIX)$(bindir)/tset + $(INSTALL_PROGRAM) tic$x $(INSTALL_PREFIX)$(bindir)/tic$x + $(INSTALL_PROGRAM) toe$x $(INSTALL_PREFIX)$(bindir)/toe$x + $(INSTALL_PROGRAM) infocmp$x $(INSTALL_PREFIX)$(bindir)/infocmp$x + $(INSTALL_PROGRAM) clear$x $(INSTALL_PREFIX)$(bindir)/clear$x + $(INSTALL_PROGRAM) tput$x $(INSTALL_PREFIX)$(bindir)/tput$x + $(INSTALL_PROGRAM) tset$x $(INSTALL_PREFIX)$(bindir)/tset$x @echo "linking captoinfo to tic" - -@rm -f $(INSTALL_PREFIX)$(bindir)/captoinfo - (cd $(INSTALL_PREFIX)$(bindir) && $(LN_S) tic captoinfo) + -@rm -f $(INSTALL_PREFIX)$(bindir)/captoinfo$x + (cd $(INSTALL_PREFIX)$(bindir) && $(LN_S) tic$x captoinfo$x) @echo "linking infotocap to tic" - -@rm -f $(INSTALL_PREFIX)$(bindir)/infotocap - (cd $(INSTALL_PREFIX)$(bindir) && $(LN_S) tic infotocap) + -@rm -f $(INSTALL_PREFIX)$(bindir)/infotocap$x + (cd $(INSTALL_PREFIX)$(bindir) && $(LN_S) tic$x infotocap$x) @echo "linking reset to tset" - -@rm -f $(INSTALL_PREFIX)$(bindir)/reset - (cd $(INSTALL_PREFIX)$(bindir) && $(LN_S) tset reset) + -@rm -f $(INSTALL_PREFIX)$(bindir)/reset$x + (cd $(INSTALL_PREFIX)$(bindir) && $(LN_S) tset$x reset$x) uninstall.progs: - -@rm -f $(INSTALL_PREFIX)$(bindir)/tic - -@rm -f $(INSTALL_PREFIX)$(bindir)/toe - -@rm -f $(INSTALL_PREFIX)$(bindir)/infocmp - -@rm -f $(INSTALL_PREFIX)$(bindir)/clear - -@rm -f $(INSTALL_PREFIX)$(bindir)/tput - -@rm -f $(INSTALL_PREFIX)$(bindir)/tset - -@rm -f $(INSTALL_PREFIX)$(bindir)/captoinfo - -@rm -f $(INSTALL_PREFIX)$(bindir)/infotocap - -@rm -f $(INSTALL_PREFIX)$(bindir)/reset + -@rm -f $(INSTALL_PREFIX)$(bindir)/tic$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/toe$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/infocmp$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/clear$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/tput$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/tset$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/captoinfo$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/infotocap$x + -@rm -f $(INSTALL_PREFIX)$(bindir)/reset$x $(INSTALL_PREFIX)$(bindir) : $(srcdir)/../mkinstalldirs $@ @@ -148,40 +149,40 @@ DEPS_TIC = \ $(MODEL)/tic.o \ $(MODEL)/dump_entry.o -tic: $(DEPS_TIC) $(DEPS_CURSES) +tic$x: $(DEPS_TIC) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(DEPS_TIC) $(LDFLAGS_DEFAULT) -o $@ DEPS_TOE = \ $(MODEL)/toe.o \ $(MODEL)/dump_entry.o -toe: $(DEPS_TOE) $(DEPS_CURSES) +toe$x: $(DEPS_TOE) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(DEPS_TOE) $(LDFLAGS_DEFAULT) -o $@ DEPS_CLEAR = \ $(MODEL)/clear.o -clear: $(DEPS_CLEAR) $(DEPS_CURSES) +clear$x: $(DEPS_CLEAR) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(DEPS_CLEAR) $(LDFLAGS_DEFAULT) -o $@ DEPS_TPUT = \ $(MODEL)/tput.o -tput: $(DEPS_TPUT) $(DEPS_CURSES) +tput$x: $(DEPS_TPUT) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(DEPS_TPUT) $(LDFLAGS_DEFAULT) -o $@ DEPS_INFOCMP = \ $(MODEL)/infocmp.o \ $(MODEL)/dump_entry.o -infocmp: $(DEPS_INFOCMP) $(DEPS_CURSES) +infocmp$x: $(DEPS_INFOCMP) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(DEPS_INFOCMP) $(LDFLAGS_DEFAULT) -o $@ DEPS_TSET = \ $(MODEL)/tset.o \ $(MODEL)/dump_entry.o -tset: $(DEPS_TSET) $(DEPS_CURSES) +tset$x: $(DEPS_TSET) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(DEPS_TSET) $(LDFLAGS_DEFAULT) -o $@ termsort.c: $(srcdir)/MKtermsort.sh @@ -198,21 +199,21 @@ DEPS_MVCUR = \ $(srcdir)/../ncurses/lib_mvcur.c \ $(MODEL)/dump_entry.o -mvcur: $(DEPS_MVCUR) $(DEPS_CURSES) +mvcur$x: $(DEPS_MVCUR) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(CCFLAGS) -DTRACE -DMAIN $(MVFLAGS) $(DEPS_MVCUR) $(LDFLAGS_DEFAULT) -o $@ # Termcap-conversion tester DEPS_TCTEST = \ $(srcdir)/../ncurses/captoinfo.c -tctest: $(DEPS_TCTEST) $(DEPS_CURSES) +tctest$x: $(DEPS_TCTEST) $(DEPS_CURSES) @ECHO_LINK@ $(LINK) $(CCFLAGS) -DTRACE -DMAIN $(DEPS_TCTEST) $(LDFLAGS_DEFAULT) -o $@ # Demonstrator/tester for hardware-scrolling algorithm. DEPS_HARDSCROLL = \ $(srcdir)/../ncurses/hardscroll.c \ $(MODEL)/lib_trace.o -hardscroll: +hardscroll$x: @ECHO_LINK@ $(LINK) $(CCFLAGS) -I$(srcdir)/../ncurses -DTRACE -DSCROLLDEBUG $(DEPS_HARDSCROLL) $(LDFLAGS_DEFAULT) -o $@ # Demonstrator-tester for enhanced hardware-scrolling code with hash mapping @@ -220,7 +221,7 @@ DEPS_HASHMAP = \ $(srcdir)/../ncurses/hashmap.c \ $(srcdir)/../ncurses/hardscroll.c \ $(MODEL)/lib_trace.o -hashmap: $(DEPS_HASHMAP) +hashmap$x: $(DEPS_HASHMAP) @ECHO_LINK@ $(LINK) $(CCFLAGS) -I$(srcdir)/../ncurses -DTRACE -DHASHDEBUG $(DEPS_HASHMAP) -o $@ # diff --git a/progs/infocmp.c b/progs/infocmp.c index debab25b..622d9290 100644 --- a/progs/infocmp.c +++ b/progs/infocmp.c @@ -30,7 +30,7 @@ #include #include -MODULE_ID("$Id: infocmp.c,v 1.32 1998/01/03 18:54:34 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.33 1998/01/20 16:53:50 Fred.Fish Exp $") #define L_CURL "{" #define R_CURL "}" @@ -780,7 +780,9 @@ static void usage(void) int main(int argc, char *argv[]) { char *terminal, *firstdir, *restdir; - path tfile[MAXTERMS]; + /* Avoid "local data >32k" error with mwcc */ + /* Also avoid overflowing smaller stacks on systems like AmigaOS */ + path *tfile = malloc(sizeof(path)*MAXTERMS); int c, i, len; bool filecompare = FALSE; bool initdump = FALSE; diff --git a/progs/progs.priv.h b/progs/progs.priv.h index 5d73ec83..ec7314b3 100644 --- a/progs/progs.priv.h +++ b/progs/progs.priv.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright 1997 by Thomas E. Dickey * + * Copyright 1997,1998 by Thomas E. Dickey * * All Rights Reserved. * * * * Permission to use, copy, modify, and distribute this software and its * @@ -18,15 +18,11 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ******************************************************************************/ /* - * $Id: progs.priv.h,v 1.13 1997/09/07 00:15:47 tom Exp $ + * $Id: progs.priv.h,v 1.15 1998/01/24 20:53:02 tom Exp $ * * progs.priv.h * * Header file for curses utility programs - * - * Note: This file was originally marked with the ncurses collective copyright, - * which was misleading, because it was not written by the original ncurses - * maintainers. */ #include @@ -138,6 +134,13 @@ extern int optind; #define STDERR_FILENO 2 #endif -#ifndef isascii -#define isascii(c) (((c) & 0xff) <= 127) +/* We use isascii only to guard against use of 7-bit ctype tables in the + * isprint test in infocmp. + */ +#ifndef HAVE_ISASCII +# if ('z'-'a' == 25) && ('z' < 127) && ('Z'-'A' == 25) && ('Z' < 127) && ('9' < 127) +# define isascii(c) (((c) & 0xff) <= 127) +# else +# define isascii(c) 1 /* not really ascii anyway */ +# endif #endif diff --git a/test/Makefile.in b/test/Makefile.in index 9a310945..432e7338 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.40 1997/12/20 16:00:10 tom Exp $ +# $Id: Makefile.in,v 1.42 1998/01/24 19:40:05 J.J.G.Ripoll Exp $ ################################################################################ -# Copyright 1996,1997 by Thomas E. Dickey # +# Copyright 1996,1997,1998 by Thomas E. Dickey # # All Rights Reserved. # # # # Permission to use, copy, modify, and distribute this software and its # @@ -22,6 +22,8 @@ SHELL = /bin/sh +x = @PROG_EXT@ + MODEL = ../@DFT_OBJ_SUBDIR@ srcdir = @srcdir@ prefix = @prefix@ @@ -46,6 +48,7 @@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) REL_VERSION = @cf_cv_rel_version@ ABI_VERSION = @cf_cv_abi_version@ LOCAL_LIBS = @TEST_DEPS@ +MATH_LIB = @MATH_LIB@ LD = @LD@ LINK = $(CC) @@ -64,67 +67,67 @@ LINT_OPTS = @LINT_OPTS@ LINT_LIBS = -lform -lmenu -lpanel -lncurses @LIBS@ TESTS = \ - blue \ - bs \ - firework \ - firstlast \ - gdc \ - hanoi \ - hashtest \ - knight \ - lrtest \ - ncurses \ - newdemo \ - rain \ - tclock \ - testaddch \ - testcurs \ - testscanw \ - view \ - worm \ - xmas + blue$x \ + bs$x \ + firework$x \ + firstlast$x \ + gdc$x \ + hanoi$x \ + hashtest$x \ + knight$x \ + lrtest$x \ + ncurses$x \ + newdemo$x \ + rain$x \ + tclock$x \ + testaddch$x \ + testcurs$x \ + testscanw$x \ + view$x \ + worm$x \ + xmas$x all: $(TESTS) sources: -blue: $(MODEL)/blue.o $(LOCAL_LIBS) +blue$x: $(MODEL)/blue.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $< $(LDFLAGS_DEFAULT) +bs$x: $(MODEL)/bs.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $< $(LDFLAGS_DEFAULT) +firework$x: $(MODEL)/firework.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $< $(LDFLAGS_DEFAULT) +firstlast$x: $(MODEL)/firstlast.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $< $(LDFLAGS_DEFAULT) +gdc$x: $(MODEL)/gdc.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $< $(LDFLAGS_DEFAULT) +hanoi$x: $(MODEL)/hanoi.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $< $(LDFLAGS_DEFAULT) +hashtest$x: $(MODEL)/hashtest.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $< $(LDFLAGS_DEFAULT) +knight$x: $(MODEL)/knight.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $< $(LDFLAGS_DEFAULT) +lrtest$x: $(MODEL)/lrtest.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $< $(LDFLAGS_DEFAULT) +ncurses$x: $(MODEL)/ncurses.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $< $(LDFLAGS_DEFAULT) +newdemo$x: $(MODEL)/newdemo.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $< $(LDFLAGS_DEFAULT) +rain$x: $(MODEL)/rain.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $< $(LDFLAGS_DEFAULT) +tclock$x: $(MODEL)/tclock.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $< $(LDFLAGS_DEFAULT) $(MATH_LIB) +testaddch$x: $(MODEL)/testaddch.o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -bs: $(MODEL)/bs.o $(LOCAL_LIBS) +testcurs$x: $(MODEL)/testcurs.o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -firework: $(MODEL)/firework.o $(LOCAL_LIBS) +testscanw$x: $(MODEL)/testscanw.o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -firstlast: $(MODEL)/firstlast.o $(LOCAL_LIBS) +view$x: $(MODEL)/view.o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -gdc: $(MODEL)/gdc.o $(LOCAL_LIBS) +worm$x: $(MODEL)/worm.o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -hanoi: $(MODEL)/hanoi.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -hashtest: $(MODEL)/hashtest.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -knight: $(MODEL)/knight.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -lrtest: $(MODEL)/lrtest.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -ncurses: $(MODEL)/ncurses.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -newdemo: $(MODEL)/newdemo.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -rain: $(MODEL)/rain.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -tclock: $(MODEL)/tclock.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -lm -testaddch: $(MODEL)/testaddch.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -testcurs: $(MODEL)/testcurs.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -testscanw: $(MODEL)/testscanw.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -view: $(MODEL)/view.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -worm: $(MODEL)/worm.o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -xmas: $(MODEL)/xmas.o $(LOCAL_LIBS) +xmas$x: $(MODEL)/xmas.o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) install: diff --git a/test/configure.in b/test/configure.in index 91f158fa..f2b917cf 100644 --- a/test/configure.in +++ b/test/configure.in @@ -1,5 +1,5 @@ dnl***************************************************************************** -dnl Copyright 1996,1997 by Thomas E. Dickey * +dnl Copyright 1996,1997,1998 by Thomas E. Dickey * dnl All Rights Reserved. * dnl * dnl Permission to use, copy, modify, and distribute this software and its * @@ -17,7 +17,7 @@ dnl RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * dnl CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * dnl CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * dnl***************************************************************************** -dnl $Id: configure.in,v 1.19 1998/01/10 17:12:26 tom Exp $ +dnl $Id: configure.in,v 1.21 1998/01/24 21:33:51 tom Exp $ dnl This is a simple configuration-script for the ncurses test programs that dnl allows the test-directory to be separately configured against a reference dnl system (i.e., sysvr4 curses) @@ -40,6 +40,8 @@ EXTRA_LIBS="" AC_SUBST(EXTRA_LIBS) LIB_NAME=curses AC_SUBST(LIB_NAME) LINT=lint AC_SUBST(LINT) LINT_OPTS="" AC_SUBST(LINT_OPTS) +MATH_LIB="-lm" AC_SUBST(MATH_LIB) +PROG_EXT="" AC_SUBST(PROG_EXT) TEST_ARGS="" AC_SUBST(TEST_ARGS) dnl SunOS 4.x diff --git a/test/ncurses.c b/test/ncurses.c index 32c14dde..373f7098 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -14,7 +14,7 @@ AUTHOR It is issued with ncurses under the same terms and conditions as the ncurses library source. -$Id: ncurses.c,v 1.105 1998/01/10 20:45:12 tom Exp $ +$Id: ncurses.c,v 1.106 1998/01/24 22:04:11 tom Exp $ ***************************************************************************/ @@ -292,11 +292,44 @@ static int show_attr(int row, int skip, chtype attr, const char *name, bool once return row + 2; } +static bool attr_getc(int *skip, int *fg, int *bg) +{ + int ch = Getchar(); + + if (isdigit(ch)) { + *skip = (ch - '0'); + return TRUE; + } else if (ch == CTRL('L')) { + touchwin(stdscr); + touchwin(curscr); + return TRUE; + } else if (has_colors()) { + switch (ch) { + case 'f': *fg = (*fg + 1); break; + case 'F': *fg = (*fg - 1); break; + case 'b': *bg = (*bg + 1); break; + case 'B': *bg = (*bg - 1); break; + default: + return FALSE; + } + if (*fg >= COLORS) *fg = 0; + if (*fg < 0) *fg = COLORS - 1; + if (*bg >= COLORS) *bg = 0; + if (*bg < 0) *bg = COLORS - 1; + return TRUE; + } + return FALSE; +} + static void attr_test(void) /* test text attributes */ { int n; int skip = tigetnum("xmc"); + int fg = COLOR_WHITE; + int bg = COLOR_BLACK; + bool *pairs = (bool *)calloc(COLOR_PAIRS, sizeof(bool)); + pairs[0] = TRUE; if (skip < 0) skip = 0; @@ -305,12 +338,18 @@ static void attr_test(void) do { int row = 2; + int normal = A_NORMAL | BLANK; - /* If we're looping, the screen contents may be trashed */ + if (has_colors()) { + int pair = (fg * COLORS) + bg; + if (!pairs[pair]) { + init_pair(pair, fg, bg); + pairs[pair] = TRUE; + } + normal |= COLOR_PAIR(pair); + } + bkgdset(normal); erase(); - refresh(); - touchwin(stdscr); - touchwin(curscr); mvaddstr(0, 20, "Character attribute test display"); @@ -329,10 +368,15 @@ static void attr_test(void) tigetnum("xmc") > -1 ? "" : "not "); mvprintw(row+1, 8, "Enter a digit to set gaps on each side of displayed attributes"); + mvprintw(row+2, 8, + "^L = repaint"); + if (has_colors()) + printw(". f/F/b/F toggle colors (now %d/%d)", fg, bg); - refresh(); - } while ((n = (Getchar() - '0')) >= 0 && n <= 9); + refresh(); + } while (attr_getc(&n, &fg, &bg)); + bkgdset(A_NORMAL | BLANK); erase(); endwin(); }