diff options
author | peter <peter@FreeBSD.org> | 2001-05-17 08:21:06 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2001-05-17 08:21:06 +0000 |
commit | b7ada7f2444f41b672faef4f93e446bdf8584cf9 (patch) | |
tree | e83b2ef47811e687a6c54035c9af6d4a2b7f14e1 /contrib/ncurses/ncurses | |
parent | a81407a537bfd1ab9e48c69007eb6b30e66d271b (diff) | |
download | FreeBSD-src-b7ada7f2444f41b672faef4f93e446bdf8584cf9.zip FreeBSD-src-b7ada7f2444f41b672faef4f93e446bdf8584cf9.tar.gz |
Import ncurses-5.2-20010512 onto the vendor branch
Obtained from: ftp://dickey.his.com/ncurses/
Diffstat (limited to 'contrib/ncurses/ncurses')
154 files changed, 4175 insertions, 3900 deletions
diff --git a/contrib/ncurses/ncurses/Makefile.in b/contrib/ncurses/ncurses/Makefile.in index 10b3ca5..0061f82 100644 --- a/contrib/ncurses/ncurses/Makefile.in +++ b/contrib/ncurses/ncurses/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.69 2000/08/26 21:51:30 tom Exp $ +# $Id: Makefile.in,v 1.72 2001/03/24 19:53:31 tom Exp $ ############################################################################## -# 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 "Software"), # @@ -62,6 +62,8 @@ libdir = @libdir@ includedir = @includedir@ datadir = @datadir@ +LIBTOOL = @LIBTOOL@ + INSTALL = @INSTALL@ INSTALL_LIB = @INSTALL@ @INSTALL_LIB@ INSTALL_DATA = @INSTALL_DATA@ @@ -86,6 +88,7 @@ HOSTCC = @BUILD_CC@ HOSTCCFLAGS = @CFLAGS@ $(CPPFLAGS) HOSTLDFLAGS = @LDFLAGS@ @LIBS@ +CFLAGS_LIBTOOL = $(CCFLAGS) CFLAGS_NORMAL = $(CCFLAGS) CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE CFLAGS_PROFILE = $(CCFLAGS) -pg @@ -93,7 +96,7 @@ CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) -LINK = $(CC) +LINK = $(LIBTOOL) $(CC) LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ SHLIB_DIRS = -L../lib -L$(libdir) @@ -102,6 +105,8 @@ TINFO_LIST = $(SHLIB_DIRS) @TINFO_LIST@ MK_SHARED_LIB = @MK_SHARED_LIB@ +NCURSES_MAJOR = @NCURSES_MAJOR@ +NCURSES_MINOR = @NCURSES_MINOR@ REL_VERSION = @cf_cv_rel_version@ ABI_VERSION = @cf_cv_abi_version@ @@ -204,13 +209,14 @@ tags: @MAKE_UPPER_TAGS@ etags *.[ch] mostlyclean :: - -rm -f core tags TAGS *~ *.ln *.atac trace + -rm -f core tags TAGS *~ *.i *.ln *.atac trace -rm -f $(TEST_PROGS) clean :: mostlyclean -rm -f $(AUTO_SRC) -rm -f make_keys$x -rm -f make_hash$x + -rm -rf .libs distclean :: clean -rm -f Makefile diff --git a/contrib/ncurses/ncurses/README b/contrib/ncurses/ncurses/README index aade721..20c94d3 100644 --- a/contrib/ncurses/ncurses/README +++ b/contrib/ncurses/ncurses/README @@ -1,2 +1,2 @@ -For discussion of the package internals, see hackguide.html in the misc +For discussion of the package internals, see hackguide.html in the doc/html directory. diff --git a/contrib/ncurses/ncurses/SigAction.h b/contrib/ncurses/ncurses/SigAction.h index 9b5a31a..53d12bf 100644 --- a/contrib/ncurses/ncurses/SigAction.h +++ b/contrib/ncurses/ncurses/SigAction.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ ****************************************************************************/ /* - * $Id: SigAction.h,v 1.5 1999/06/19 23:00:54 tom Exp $ + * $Id: SigAction.h,v 1.6 2000/12/10 02:36:10 tom Exp $ * * This file exists to handle non-POSIX systems which don't have <unistd.h>, * and usually no sigaction() nor <termios.h> @@ -105,12 +105,12 @@ typedef unsigned long sigset_t; #undef sigaddset #define sigaddset _nc_sigaddset -extern int sigaction (int sig, sigaction_t * sigact, sigaction_t * osigact); -extern int sigprocmask (int how, sigset_t *mask, sigset_t *omask); -extern int sigemptyset (sigset_t *mask); -extern int sigsuspend (sigset_t *mask); -extern int sigdelset (sigset_t *mask, int sig); -extern int sigaddset (sigset_t *mask, int sig); +extern NCURSES_EXPORT(int) sigaction (int sig, sigaction_t * sigact, sigaction_t * osigact); +extern NCURSES_EXPORT(int) sigprocmask (int how, sigset_t *mask, sigset_t *omask); +extern NCURSES_EXPORT(int) sigemptyset (sigset_t *mask); +extern NCURSES_EXPORT(int) sigsuspend (sigset_t *mask); +extern NCURSES_EXPORT(int) sigdelset (sigset_t *mask, int sig); +extern NCURSES_EXPORT(int) sigaddset (sigset_t *mask, int sig); #endif /* HAVE_SIGVEC */ #endif /* HAVE_SIGACTION */ diff --git a/contrib/ncurses/ncurses/base/MKkeyname.awk b/contrib/ncurses/ncurses/base/MKkeyname.awk index aaeb474..c067733 100644 --- a/contrib/ncurses/ncurses/base/MKkeyname.awk +++ b/contrib/ncurses/ncurses/base/MKkeyname.awk @@ -1,6 +1,6 @@ -# $Id: MKkeyname.awk,v 1.17 1999/02/18 11:18:06 tom Exp $ +# $Id: MKkeyname.awk,v 1.18 2000/12/10 02:25:23 tom Exp $ ############################################################################## -# Copyright (c) 1999 Free Software Foundation, Inc. # +# Copyright (c) 1999,2000 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -45,7 +45,7 @@ BEGIN { END { printf "\t{ 0, 0 }};\n" print "" - print "NCURSES_CONST char *keyname(int c)" + print "NCURSES_EXPORT(NCURSES_CONST char *) keyname (int c)" print "{" print "int i;" print "static char name[20];" diff --git a/contrib/ncurses/ncurses/base/MKlib_gen.sh b/contrib/ncurses/ncurses/base/MKlib_gen.sh index 3377940..4de2a5a 100755 --- a/contrib/ncurses/ncurses/base/MKlib_gen.sh +++ b/contrib/ncurses/ncurses/base/MKlib_gen.sh @@ -2,7 +2,7 @@ # # MKlib_gen.sh -- generate sources from curses.h macro definitions # -# ($Id: MKlib_gen.sh,v 1.12 2000/07/29 16:30:11 tom Exp $) +# ($Id: MKlib_gen.sh,v 1.13 2000/12/10 00:30:25 tom Exp $) # # The XSI Curses standard requires all curses entry points to exist as # functions, even though many definitions would normally be shadowed @@ -226,7 +226,9 @@ BEGIN { } EOF1 -sed -n -f $ED1 | sed -f $ED2 \ +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 @@ -255,5 +257,7 @@ BEGIN { | sed -f $ED3 \ | sed \ -e 's/^.*T_CALLED.*returnCode( \([a-z].*) \));/ return \1;/' \ - -e 's/^.*T_CALLED.*returnCode( \((wmove.*) \));/ return \1;/' + -e 's/^.*T_CALLED.*returnCode( \((wmove.*) \));/ return \1;/' \ +| sed \ + -e 's/^\(.*\) \(.*\) (\(.*\))$/NCURSES_EXPORT(\1) \2 (\3)/' diff --git a/contrib/ncurses/ncurses/base/MKunctrl.awk b/contrib/ncurses/ncurses/base/MKunctrl.awk index 3d5b256..d9d5da5 100644 --- a/contrib/ncurses/ncurses/base/MKunctrl.awk +++ b/contrib/ncurses/ncurses/base/MKunctrl.awk @@ -1,6 +1,6 @@ -# $Id: MKunctrl.awk,v 1.7 2000/04/01 19:49:26 tom Exp $ +# $Id: MKunctrl.awk,v 1.8 2000/12/10 02:25:37 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998,2000 Free 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"), # @@ -39,7 +39,7 @@ BEGIN { print "" } END { - print "NCURSES_CONST char *unctrl(register chtype ch)" + print "NCURSES_EXPORT(NCURSES_CONST char *) unctrl (register chtype ch)" print "{" printf "static const char* const table[] = {" for ( ch = 0; ch < 256; ch++ ) { diff --git a/contrib/ncurses/ncurses/base/define_key.c b/contrib/ncurses/ncurses/base/define_key.c index 52dc692..7fc885f 100644 --- a/contrib/ncurses/ncurses/base/define_key.c +++ b/contrib/ncurses/ncurses/base/define_key.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,28 +32,29 @@ #include <curses.priv.h> -MODULE_ID("$Id: define_key.c,v 1.4 1999/02/21 13:03:55 tom Exp $") +MODULE_ID("$Id: define_key.c,v 1.6 2000/12/10 02:43:26 tom Exp $") -int -define_key(char *str, int keycode) +NCURSES_EXPORT(int) +define_key +(char *str, int keycode) { - int code = ERR; + int code = ERR; - T((T_CALLED("define_key(%s,%d)"), _nc_visbuf(str), keycode)); - if (keycode > 0) { - if (str != 0) { - define_key(str, 0); - } else if (has_key(keycode)) { - while (_nc_remove_key(&(SP->_keytry), keycode)) - code = OK; - } - if (str != 0) { - (void) _nc_add_to_try(&(SP->_keytry), str, keycode); - code = OK; - } - } else { - while (_nc_remove_string(&(SP->_keytry), str)) - code = OK; + T((T_CALLED("define_key(%s,%d)"), _nc_visbuf(str), keycode)); + if (keycode > 0) { + if (str != 0) { + define_key(str, 0); + } else if (has_key(keycode)) { + while (_nc_remove_key(&(SP->_keytry), keycode)) + code = OK; } - returnCode(code); + if (str != 0) { + (void) _nc_add_to_try(&(SP->_keytry), str, keycode); + code = OK; + } + } else { + while (_nc_remove_string(&(SP->_keytry), str)) + code = OK; + } + returnCode(code); } diff --git a/contrib/ncurses/ncurses/base/keybound.c b/contrib/ncurses/ncurses/base/keybound.c index c9aa022..c8ca285 100644 --- a/contrib/ncurses/ncurses/base/keybound.c +++ b/contrib/ncurses/ncurses/base/keybound.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,14 +32,15 @@ #include <curses.priv.h> -MODULE_ID("$Id: keybound.c,v 1.1 1999/02/19 11:55:56 tom Exp $") +MODULE_ID("$Id: keybound.c,v 1.3 2000/12/10 02:43:26 tom Exp $") /* * Returns the count'th string definition which is associated with the * given keycode. The result is malloc'd, must be freed by the caller. */ -char *keybound(int code, int count) +NCURSES_EXPORT(char *) +keybound(int code, int count) { - return _nc_expand_try(SP->_key_ok, code, &count, 0); + return _nc_expand_try(SP->_key_ok, code, &count, 0); } diff --git a/contrib/ncurses/ncurses/base/keyok.c b/contrib/ncurses/ncurses/base/keyok.c index a138576..e3b4be2 100644 --- a/contrib/ncurses/ncurses/base/keyok.c +++ b/contrib/ncurses/ncurses/base/keyok.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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: keyok.c,v 1.3 1999/02/19 11:29:48 tom Exp $") +MODULE_ID("$Id: keyok.c,v 1.5 2000/12/10 02:43:26 tom Exp $") /* * Enable (or disable) ncurses' interpretation of a keycode by adding (or @@ -44,29 +44,30 @@ MODULE_ID("$Id: keyok.c,v 1.3 1999/02/19 11:29:48 tom Exp $") * corresponding tree. */ -int keyok(int c, bool flag) +NCURSES_EXPORT(int) +keyok(int c, bool flag) { - int code = ERR; - int count = 0; - char *s; + int code = ERR; + int count = 0; + char *s; - T((T_CALLED("keyok(%d,%d)"), c, flag)); - if (flag) { - while ((s = _nc_expand_try(SP->_key_ok, c, &count, 0)) != 0 - && _nc_remove_key(&(SP->_key_ok), c)) { - _nc_add_to_try(&(SP->_keytry), s, c); - free(s); - code = OK; - count = 0; - } - } else { - while ((s = _nc_expand_try(SP->_keytry, c, &count, 0)) != 0 - && _nc_remove_key(&(SP->_keytry), c)) { - _nc_add_to_try(&(SP->_key_ok), s, c); - free(s); - code = OK; - count = 0; - } + T((T_CALLED("keyok(%d,%d)"), c, flag)); + if (flag) { + while ((s = _nc_expand_try(SP->_key_ok, c, &count, 0)) != 0 + && _nc_remove_key(&(SP->_key_ok), c)) { + _nc_add_to_try(&(SP->_keytry), s, c); + free(s); + code = OK; + count = 0; } - returnCode(code); + } else { + while ((s = _nc_expand_try(SP->_keytry, c, &count, 0)) != 0 + && _nc_remove_key(&(SP->_keytry), c)) { + _nc_add_to_try(&(SP->_key_ok), s, c); + free(s); + code = OK; + count = 0; + } + } + returnCode(code); } diff --git a/contrib/ncurses/ncurses/base/lib_addch.c b/contrib/ncurses/ncurses/base/lib_addch.c index 69c17c3..799fbf6 100644 --- a/contrib/ncurses/ncurses/base/lib_addch.c +++ b/contrib/ncurses/ncurses/base/lib_addch.c @@ -41,7 +41,7 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$Id: lib_addch.c,v 1.44 2000/05/20 21:13:11 tom Exp $") +MODULE_ID("$Id: lib_addch.c,v 1.47 2000/12/10 02:43:26 tom Exp $") /* * Ugly microtweaking alert. Everything from here to end of module is @@ -73,20 +73,22 @@ render_char(WINDOW *win, chtype ch) } TR(TRACE_VIRTPUT, ("bkg = %lx, attrs = %lx -> ch = %lx", win->_bkgd, - win->_attrs, ch)); + win->_attrs, ch)); return (ch); } -chtype -_nc_background(WINDOW *win) +NCURSES_EXPORT(chtype) +_nc_background +(WINDOW *win) /* make render_char() visible while still allowing us to inline it below */ { return (win->_bkgd); } -chtype -_nc_render(WINDOW *win, chtype ch) +NCURSES_EXPORT(chtype) +_nc_render +(WINDOW *win, chtype ch) /* make render_char() visible while still allowing us to inline it below */ { return render_char(win, ch); @@ -122,7 +124,7 @@ waddch_literal(WINDOW *win, chtype ch) * If we're trying to add a character at the lower-right corner more * than once, fail. (Moving the cursor will clear the flag). */ -#if 0 /* Solaris 2.6 allows updating the corner more than once */ +#if 0 /* Solaris 2.6 allows updating the corner more than once */ if (win->_flags & _WRAPPED) { if (x >= win->_maxx) return (ERR); @@ -171,7 +173,7 @@ waddch_nosync(WINDOW *win, const chtype ch) /* the workhorse function -- add a character to the given window */ { int x, y; - int t = 0; + chtype t = 0; const char *s = 0; if ((ch & A_ALTCHARSET) @@ -246,8 +248,9 @@ waddch_nosync(WINDOW *win, const chtype ch) return (OK); } -int -_nc_waddch_nosync(WINDOW *win, const chtype c) +NCURSES_EXPORT(int) +_nc_waddch_nosync +(WINDOW *win, const chtype c) /* export copy of waddch_nosync() so the string-put functions can use it */ { return (waddch_nosync(win, c)); @@ -261,13 +264,14 @@ _nc_waddch_nosync(WINDOW *win, const chtype c) /* These are actual entry points */ -int -waddch(WINDOW *win, const chtype ch) +NCURSES_EXPORT(int) +waddch +(WINDOW *win, const chtype ch) { int code = ERR; TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("waddch(%p, %s)"), win, - _tracechtype(ch))); + _tracechtype(ch))); if (win && (waddch_nosync(win, ch) != ERR)) { _nc_synchook(win); @@ -278,13 +282,14 @@ waddch(WINDOW *win, const chtype ch) return (code); } -int -wechochar(WINDOW *win, const chtype ch) +NCURSES_EXPORT(int) +wechochar +(WINDOW *win, const chtype ch) { int code = ERR; TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"), win, - _tracechtype(ch))); + _tracechtype(ch))); if (win && (waddch_nosync(win, ch) != ERR)) { bool save_immed = win->_immed; diff --git a/contrib/ncurses/ncurses/base/lib_addstr.c b/contrib/ncurses/ncurses/base/lib_addstr.c index 59a3bae..60bf944 100644 --- a/contrib/ncurses/ncurses/base/lib_addstr.c +++ b/contrib/ncurses/ncurses/base/lib_addstr.c @@ -40,10 +40,11 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_addstr.c,v 1.18 2000/07/29 16:42:41 tom Exp $") +MODULE_ID("$Id: lib_addstr.c,v 1.19 2000/12/10 01:24:50 tom Exp $") -int -waddnstr(WINDOW *win, const char *const astr, int n) +NCURSES_EXPORT(int) +waddnstr +(WINDOW *win, const char *const astr, int n) { unsigned const char *str = (unsigned const char *) astr; int code = ERR; @@ -70,8 +71,9 @@ waddnstr(WINDOW *win, const char *const astr, int n) returnCode(code); } -int -waddchnstr(WINDOW *win, const chtype * const astr, int n) +NCURSES_EXPORT(int) +waddchnstr +(WINDOW *win, const chtype * const astr, int n) { NCURSES_SIZE_T y = win->_cury; NCURSES_SIZE_T x = win->_curx; diff --git a/contrib/ncurses/ncurses/base/lib_beep.c b/contrib/ncurses/ncurses/base/lib_beep.c index 3428aaf..c23d0a1 100644 --- a/contrib/ncurses/ncurses/base/lib_beep.c +++ b/contrib/ncurses/ncurses/base/lib_beep.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * beep.c * @@ -40,9 +39,9 @@ */ #include <curses.priv.h> -#include <term.h> /* beep, flash */ +#include <term.h> /* beep, flash */ -MODULE_ID("$Id: lib_beep.c,v 1.7 1999/10/22 21:39:09 tom Exp $") +MODULE_ID("$Id: lib_beep.c,v 1.9 2000/12/10 02:43:26 tom Exp $") /* * beep() @@ -52,22 +51,23 @@ MODULE_ID("$Id: lib_beep.c,v 1.7 1999/10/22 21:39:09 tom Exp $") * */ -int beep(void) +NCURSES_EXPORT(int) +beep(void) { - int res = ERR; + int res = ERR; - T((T_CALLED("beep()"))); + T((T_CALLED("beep()"))); - /* FIXME: should make sure that we are not in altchar mode */ - if (bell) { - TPUTS_TRACE("bell"); - res = putp(bell); - _nc_flush(); - } else if (flash_screen) { - TPUTS_TRACE("flash_screen"); - res = putp(flash_screen); - _nc_flush(); - } + /* FIXME: should make sure that we are not in altchar mode */ + if (bell) { + TPUTS_TRACE("bell"); + res = putp(bell); + _nc_flush(); + } else if (flash_screen) { + TPUTS_TRACE("flash_screen"); + res = putp(flash_screen); + _nc_flush(); + } - returnCode(res); + returnCode(res); } diff --git a/contrib/ncurses/ncurses/base/lib_bkgd.c b/contrib/ncurses/ncurses/base/lib_bkgd.c index 410ee05..071924c 100644 --- a/contrib/ncurses/ncurses/base/lib_bkgd.c +++ b/contrib/ncurses/ncurses/base/lib_bkgd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,54 +33,56 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_bkgd.c,v 1.12 1998/02/11 12:13:54 tom Exp $") +MODULE_ID("$Id: lib_bkgd.c,v 1.14 2000/12/10 02:43:26 tom Exp $") -void wbkgdset(WINDOW *win, chtype ch) +NCURSES_EXPORT(void) +wbkgdset(WINDOW *win, chtype ch) { - T((T_CALLED("wbkgdset(%p,%s)"), win, _tracechtype(ch))); - - if (win) { - chtype off = AttrOf(win->_bkgd); - chtype on = AttrOf(ch); - - toggle_attr_off(win->_attrs,off); - toggle_attr_on (win->_attrs,on); - - if (TextOf(ch)==0) - ch |= BLANK; - win->_bkgd = ch; - } - returnVoid; + T((T_CALLED("wbkgdset(%p,%s)"), win, _tracechtype(ch))); + + if (win) { + chtype off = AttrOf(win->_bkgd); + chtype on = AttrOf(ch); + + toggle_attr_off(win->_attrs, off); + toggle_attr_on(win->_attrs, on); + + if (TextOf(ch) == 0) + ch |= BLANK; + win->_bkgd = ch; + } + returnVoid; } -int wbkgd(WINDOW *win, const chtype ch) +NCURSES_EXPORT(int) +wbkgd(WINDOW *win, const chtype ch) { - int code = ERR; - int x, y; - chtype new_bkgd = ch; + int code = ERR; + int x, y; + chtype new_bkgd = ch; + + T((T_CALLED("wbkgd(%p,%s)"), win, _tracechtype(new_bkgd))); - T((T_CALLED("wbkgd(%p,%s)"), win, _tracechtype(new_bkgd))); + if (win) { + chtype old_bkgd = getbkgd(win); - if (win) { - chtype old_bkgd = getbkgd(win); + wbkgdset(win, new_bkgd); + wattrset(win, AttrOf(win->_bkgd)); - wbkgdset(win, new_bkgd); - wattrset(win, AttrOf(win->_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])); - } + 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])); + } + } + touchwin(win); + _nc_synchook(win); + code = OK; } - touchwin(win); - _nc_synchook(win); - code = OK; - } - returnCode(code); + returnCode(code); } diff --git a/contrib/ncurses/ncurses/base/lib_box.c b/contrib/ncurses/ncurses/base/lib_box.c index 8a68258..d018fd89 100644 --- a/contrib/ncurses/ncurses/base/lib_box.c +++ b/contrib/ncurses/ncurses/base/lib_box.c @@ -40,26 +40,27 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_box.c,v 1.11 2000/04/29 21:12:37 tom Exp $") +MODULE_ID("$Id: lib_box.c,v 1.13 2000/12/10 02:43:26 tom Exp $") -int -wborder(WINDOW *win, - chtype ls, chtype rs, chtype ts, chtype bs, - chtype tl, chtype tr, chtype bl, chtype br) +NCURSES_EXPORT(int) +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; T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"), - win, - _tracechtype2(1, ls), - _tracechtype2(2, rs), - _tracechtype2(3, ts), - _tracechtype2(4, bs), - _tracechtype2(5, tl), - _tracechtype2(6, tr), - _tracechtype2(7, bl), - _tracechtype2(8, br))); + win, + _tracechtype2(1, ls), + _tracechtype2(2, rs), + _tracechtype2(3, ts), + _tracechtype2(4, bs), + _tracechtype2(5, tl), + _tracechtype2(6, tr), + _tracechtype2(7, bl), + _tracechtype2(8, br))); if (!win) returnCode(ERR); @@ -91,7 +92,7 @@ wborder(WINDOW *win, br = _nc_render(win, br); T(("using %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx", - ls, rs, ts, bs, tl, tr, bl, br)); + ls, rs, ts, bs, tl, tr, bl, br)); endx = win->_maxx; endy = win->_maxy; diff --git a/contrib/ncurses/ncurses/base/lib_chgat.c b/contrib/ncurses/ncurses/base/lib_chgat.c index 7690ae4..66c6a09 100644 --- a/contrib/ncurses/ncurses/base/lib_chgat.c +++ b/contrib/ncurses/ncurses/base/lib_chgat.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,23 +40,24 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_chgat.c,v 1.2 1998/02/11 12:14:00 tom Exp $") +MODULE_ID("$Id: lib_chgat.c,v 1.4 2000/12/10 02:43:26 tom Exp $") -int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED) +NCURSES_EXPORT(int) +wchgat +(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED) { - int i; + int i; T((T_CALLED("wchgat(%p,%d,%s,%d)"), win, n, _traceattr(attr), color)); if (win) { - toggle_attr_on(attr,COLOR_PAIR(color)); + 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; + 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; - returnCode(OK); - } - else - returnCode(ERR); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/base/lib_clear.c b/contrib/ncurses/ncurses/base/lib_clear.c index 9c07cf0..e0b4edf 100644 --- a/contrib/ncurses/ncurses/base/lib_clear.c +++ b/contrib/ncurses/ncurses/base/lib_clear.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,17 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_clear.c,v 1.5 1998/02/11 12:13:53 tom Exp $") +MODULE_ID("$Id: lib_clear.c,v 1.7 2000/12/10 02:43:26 tom Exp $") -int wclear(WINDOW *win) +NCURSES_EXPORT(int) +wclear(WINDOW *win) { -int code = ERR; + int code = ERR; - T((T_CALLED("wclear(%p)"), win)); + T((T_CALLED("wclear(%p)"), win)); - if ((code = werase(win))!=ERR) - win->_clear = TRUE; - - returnCode(code); + if ((code = werase(win)) != ERR) + win->_clear = TRUE; + + returnCode(code); } diff --git a/contrib/ncurses/ncurses/base/lib_clearok.c b/contrib/ncurses/ncurses/base/lib_clearok.c index cc904b1..9b56bd1 100644 --- a/contrib/ncurses/ncurses/base/lib_clearok.c +++ b/contrib/ncurses/ncurses/base/lib_clearok.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_clearok.c ** @@ -41,16 +40,16 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_clearok.c,v 1.2 1998/02/11 12:14:00 tom Exp $") +MODULE_ID("$Id: lib_clearok.c,v 1.4 2000/12/10 02:43:26 tom Exp $") -int clearok(WINDOW *win, bool flag) +NCURSES_EXPORT(int) +clearok(WINDOW *win, bool flag) { - T((T_CALLED("clearok(%p,%d)"), win, flag)); + T((T_CALLED("clearok(%p,%d)"), win, flag)); - if (win) { - win->_clear = flag; - returnCode(OK); - } - else - returnCode(ERR); + if (win) { + win->_clear = flag; + returnCode(OK); + } else + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/base/lib_clrbot.c b/contrib/ncurses/ncurses/base/lib_clrbot.c index d1e243f..805e7c2 100644 --- a/contrib/ncurses/ncurses/base/lib_clrbot.c +++ b/contrib/ncurses/ncurses/base/lib_clrbot.c @@ -40,9 +40,9 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_clrbot.c,v 1.15 2000/04/29 21:15:26 tom Exp $") +MODULE_ID("$Id: lib_clrbot.c,v 1.17 2000/12/10 02:43:26 tom Exp $") -int +NCURSES_EXPORT(int) wclrtobot(WINDOW *win) { int code = ERR; @@ -55,7 +55,7 @@ wclrtobot(WINDOW *win) chtype blank = _nc_background(win); T(("clearing from y = %d to y = %d with maxx = %d", - win->_cury, win->_maxy, win->_maxx)); + win->_cury, win->_maxy, win->_maxx)); for (y = win->_cury; y <= win->_maxy; y++) { struct ldat *line = &(win->_line[y]); diff --git a/contrib/ncurses/ncurses/base/lib_clreol.c b/contrib/ncurses/ncurses/base/lib_clreol.c index a5d067c..fa0afe4 100644 --- a/contrib/ncurses/ncurses/base/lib_clreol.c +++ b/contrib/ncurses/ncurses/base/lib_clreol.c @@ -40,9 +40,9 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_clreol.c,v 1.16 2000/04/29 21:14:54 tom Exp $") +MODULE_ID("$Id: lib_clreol.c,v 1.19 2000/12/10 02:43:26 tom Exp $") -int +NCURSES_EXPORT(int) wclrtoeol(WINDOW *win) { int code = ERR; @@ -60,7 +60,7 @@ wclrtoeol(WINDOW *win) * If we have just wrapped the cursor, the clear applies to the * new line, unless we are at the lower right corner. */ - if (win->_flags & _WRAPPED + if ((win->_flags & _WRAPPED) != 0 && y < win->_maxy) { win->_flags &= ~_WRAPPED; } @@ -69,7 +69,7 @@ wclrtoeol(WINDOW *win) * There's no point in clearing if we're not on a legal * position, either. */ - if (win->_flags & _WRAPPED + if ((win->_flags & _WRAPPED) != 0 || y > win->_maxy || x > win->_maxx) returnCode(ERR); diff --git a/contrib/ncurses/ncurses/base/lib_color.c b/contrib/ncurses/ncurses/base/lib_color.c index 492194b..1fa5732 100644 --- a/contrib/ncurses/ncurses/base/lib_color.c +++ b/contrib/ncurses/ncurses/base/lib_color.c @@ -41,15 +41,17 @@ #include <term.h> #include <tic.h> -MODULE_ID("$Id: lib_color.c,v 1.53 2000/09/02 18:02:15 tom Exp $") +MODULE_ID("$Id: lib_color.c,v 1.55 2000/12/10 02:43:27 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. */ -int COLOR_PAIRS = 0; -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 @@ -90,8 +92,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; } @@ -111,13 +113,13 @@ 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[] = {0, 4, 2, 6, 1, 5, 3, 7, - 8, 12, 10, 14, 9, 13, 11, 15}; + 8, 12, 10, 14, 9, 13, 11, 15}; c = table[c]; } return c; @@ -162,7 +164,7 @@ set_original_colors(void) return FALSE; } -int +NCURSES_EXPORT(int) start_color(void) { int n; @@ -256,8 +258,9 @@ rgb2hls(short r, short g, short b, short *h, short *l, short *s) * Extension (1997/1/18) - Allow negative f/b values to set default color * values. */ -int -init_pair(short pair, short f, short b) +NCURSES_EXPORT(int) +init_pair +(short pair, short f, short b) { unsigned result; @@ -319,24 +322,25 @@ init_pair(short pair, short f, short b) const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette; T(("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)", - pair, - tp[f].red, tp[f].green, tp[f].blue, - tp[b].red, tp[b].green, tp[b].blue)); + pair, + tp[f].red, tp[f].green, tp[f].blue, + tp[b].red, tp[b].green, tp[b].blue)); if (initialize_pair) { TPUTS_TRACE("initialize_pair"); putp(tparm(initialize_pair, - pair, - tp[f].red, tp[f].green, tp[f].blue, - tp[b].red, tp[b].green, tp[b].blue)); + pair, + tp[f].red, tp[f].green, tp[f].blue, + tp[b].red, tp[b].green, tp[b].blue)); } } returnCode(OK); } -int -init_color(short color, short r, short g, short b) +NCURSES_EXPORT(int) +init_color +(short color, short r, short g, short b) { T((T_CALLED("init_color(%d,%d,%d,%d)"), color, r, g, b)); @@ -350,9 +354,9 @@ init_color(short color, short r, short g, short b) if (hue_lightness_saturation) rgb2hls(r, g, b, - &SP->_color_table[color].red, - &SP->_color_table[color].green, - &SP->_color_table[color].blue); + &SP->_color_table[color].red, + &SP->_color_table[color].green, + &SP->_color_table[color].blue); else { SP->_color_table[color].red = r; SP->_color_table[color].green = g; @@ -366,27 +370,28 @@ init_color(short color, short r, short g, short b) returnCode(OK); } -bool +NCURSES_EXPORT(bool) can_change_color(void) { T((T_CALLED("can_change_color()"))); returnCode((can_change != 0) ? TRUE : FALSE); } -bool +NCURSES_EXPORT(bool) has_colors(void) { T((T_CALLED("has_colors()"))); returnCode((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs) - && (((set_foreground != NULL) - && (set_background != NULL)) - || ((set_a_foreground != NULL) - && (set_a_background != NULL)) - || set_color_pair)) ? TRUE : FALSE); + && (((set_foreground != NULL) + && (set_background != NULL)) + || ((set_a_foreground != NULL) + && (set_a_background != NULL)) + || set_color_pair)) ? TRUE : FALSE); } -int -color_content(short color, short *r, short *g, short *b) +NCURSES_EXPORT(int) +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) @@ -401,8 +406,9 @@ color_content(short color, short *r, short *g, short *b) returnCode(OK); } -int -pair_content(short pair, short *f, short *b) +NCURSES_EXPORT(int) +pair_content +(short pair, short *f, short *b) { T((T_CALLED("pair_content(%d,%p,%p)"), pair, f, b)); @@ -416,8 +422,9 @@ pair_content(short pair, short *f, short *b) returnCode(OK); } -void -_nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) +NCURSES_EXPORT(void) +_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; @@ -471,7 +478,8 @@ _nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) bg = xx; } - TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg)); + TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair, + fg, bg)); if (fg != C_MASK) { set_foreground_color(fg, outc); diff --git a/contrib/ncurses/ncurses/base/lib_colorset.c b/contrib/ncurses/ncurses/base/lib_colorset.c index 3870e87..b496c78 100644 --- a/contrib/ncurses/ncurses/base/lib_colorset.c +++ b/contrib/ncurses/ncurses/base/lib_colorset.c @@ -40,10 +40,11 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$Id: lib_colorset.c,v 1.6 2000/07/29 16:37:19 tom Exp $") +MODULE_ID("$Id: lib_colorset.c,v 1.7 2000/12/10 01:24:50 tom Exp $") -int -wcolor_set(WINDOW *win, short color_pair_number, void *opts) +NCURSES_EXPORT(int) +wcolor_set +(WINDOW *win, short color_pair_number, void *opts) { T((T_CALLED("wcolor_set(%p,%d)"), win, color_pair_number)); if (win diff --git a/contrib/ncurses/ncurses/base/lib_delch.c b/contrib/ncurses/ncurses/base/lib_delch.c index 0169d31..918e225 100644 --- a/contrib/ncurses/ncurses/base/lib_delch.c +++ b/contrib/ncurses/ncurses/base/lib_delch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,29 +40,30 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_delch.c,v 1.8 1998/06/28 00:28:17 tom Exp $") +MODULE_ID("$Id: lib_delch.c,v 1.10 2000/12/10 02:43:27 tom Exp $") -int wdelch(WINDOW *win) +NCURSES_EXPORT(int) +wdelch(WINDOW *win) { -int code = ERR; + int code = ERR; - T((T_CALLED("wdelch(%p)"), win)); + T((T_CALLED("wdelch(%p)"), win)); - if (win) { - chtype blank = _nc_background(win); - struct ldat *line = &(win->_line[win->_cury]); - chtype *end = &(line->text[win->_maxx]); - chtype *temp2 = &(line->text[win->_curx + 1]); - chtype *temp1 = temp2 - 1; + if (win) { + chtype blank = _nc_background(win); + struct ldat *line = &(win->_line[win->_cury]); + chtype *end = &(line->text[win->_maxx]); + chtype *temp2 = &(line->text[win->_curx + 1]); + chtype *temp1 = temp2 - 1; - CHANGED_TO_EOL(line, win->_curx, win->_maxx); - while (temp1 < end) - *temp1++ = *temp2++; + CHANGED_TO_EOL(line, win->_curx, win->_maxx); + while (temp1 < end) + *temp1++ = *temp2++; - *temp1 = blank; + *temp1 = blank; - _nc_synchook(win); - code = OK; - } - returnCode(code); + _nc_synchook(win); + code = OK; + } + returnCode(code); } diff --git a/contrib/ncurses/ncurses/base/lib_delwin.c b/contrib/ncurses/ncurses/base/lib_delwin.c index 7bab0c7..7c56869 100644 --- a/contrib/ncurses/ncurses/base/lib_delwin.c +++ b/contrib/ncurses/ncurses/base/lib_delwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,33 +40,39 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_delwin.c,v 1.9 1998/02/11 12:13:53 tom Exp $") +MODULE_ID("$Id: lib_delwin.c,v 1.12 2000/12/10 02:43:27 tom Exp $") -static bool have_children(WINDOW *win) +static bool +cannot_delete(WINDOW *win) { - WINDOWLIST *p; - for (p = _nc_windows; p != 0; p = p->next) { - if (p->win->_flags & _SUBWIN - && p->win->_parent == win) - return TRUE; + WINDOWLIST *p; + bool result = TRUE; + + for (p = _nc_windows; p != 0; p = p->next) { + if (p->win == win) { + result = FALSE; + } else if ((p->win->_flags & _SUBWIN) != 0 + && p->win->_parent == win) { + result = TRUE; + break; } - return FALSE; + } + return result; } -int delwin(WINDOW *win) +NCURSES_EXPORT(int) +delwin(WINDOW *win) { - T((T_CALLED("delwin(%p)"), win)); - - if (win == 0 - || have_children(win)) - returnCode(ERR); + T((T_CALLED("delwin(%p)"), win)); - if (win->_flags & _SUBWIN) - touchwin(win->_parent); - else if (curscr != 0) - touchwin(curscr); + if (win == 0 + || cannot_delete(win)) + returnCode(ERR); - _nc_freewin(win); + if (win->_flags & _SUBWIN) + touchwin(win->_parent); + else if (curscr != 0) + touchwin(curscr); - returnCode(OK); + returnCode(_nc_freewin(win)); } diff --git a/contrib/ncurses/ncurses/base/lib_dft_fgbg.c b/contrib/ncurses/ncurses/base/lib_dft_fgbg.c index 7c09024..24705c9 100644 --- a/contrib/ncurses/ncurses/base/lib_dft_fgbg.c +++ b/contrib/ncurses/ncurses/base/lib_dft_fgbg.c @@ -33,13 +33,13 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$Id: lib_dft_fgbg.c,v 1.13 2000/07/07 16:50:27 tom Exp $") +MODULE_ID("$Id: lib_dft_fgbg.c,v 1.15 2000/12/10 02:43:27 tom Exp $") /* * Modify the behavior of color-pair 0 so that the library doesn't assume that * it is white on black. This is an extension to XSI curses. */ -int +NCURSES_EXPORT(int) use_default_colors(void) { T((T_CALLED("use_default_colors()"))); @@ -50,7 +50,7 @@ use_default_colors(void) * Modify the behavior of color-pair 0 so that the library assumes that it * is something specific, possibly not white on black. */ -int +NCURSES_EXPORT(int) assume_default_colors(int fg, int bg) { T((T_CALLED("assume_default_colors(%d,%d)"), fg, bg)); diff --git a/contrib/ncurses/ncurses/base/lib_echo.c b/contrib/ncurses/ncurses/base/lib_echo.c index 4ccf97f..df44713 100644 --- a/contrib/ncurses/ncurses/base/lib_echo.c +++ b/contrib/ncurses/ncurses/base/lib_echo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * echo.c * @@ -43,18 +42,20 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_echo.c,v 1.3 1998/10/12 13:15:33 Alexander.V.Lukyanov Exp $") +MODULE_ID("$Id: lib_echo.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int echo(void) +NCURSES_EXPORT(int) +echo(void) { - T((T_CALLED("echo()"))); - SP->_echo = TRUE; - returnCode(OK); + T((T_CALLED("echo()"))); + SP->_echo = TRUE; + returnCode(OK); } -int noecho(void) +NCURSES_EXPORT(int) +noecho(void) { - T((T_CALLED("noecho()"))); - SP->_echo = FALSE; - returnCode(OK); + T((T_CALLED("noecho()"))); + SP->_echo = FALSE; + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_endwin.c b/contrib/ncurses/ncurses/base/lib_endwin.c index 31b6e51..6666287 100644 --- a/contrib/ncurses/ncurses/base/lib_endwin.c +++ b/contrib/ncurses/ncurses/base/lib_endwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_endwin.c ** @@ -42,20 +41,20 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$Id: lib_endwin.c,v 1.17 1999/06/12 23:01:46 tom Exp $") +MODULE_ID("$Id: lib_endwin.c,v 1.19 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) endwin(void) { - T((T_CALLED("endwin()"))); + T((T_CALLED("endwin()"))); - if (SP) { - SP->_endwin = TRUE; - SP->_mouse_wrap(SP); - _nc_screen_wrap(); - _nc_mvcur_wrap(); /* wrap up cursor addressing */ - returnCode(reset_shell_mode()); - } + if (SP) { + SP->_endwin = TRUE; + SP->_mouse_wrap(SP); + _nc_screen_wrap(); + _nc_mvcur_wrap(); /* wrap up cursor addressing */ + returnCode(reset_shell_mode()); + } - returnCode(ERR); + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/base/lib_erase.c b/contrib/ncurses/ncurses/base/lib_erase.c index 1e4237b..87673b7 100644 --- a/contrib/ncurses/ncurses/base/lib_erase.c +++ b/contrib/ncurses/ncurses/base/lib_erase.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_erase.c ** @@ -41,33 +40,34 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_erase.c,v 1.11 1998/02/11 12:13:54 tom Exp $") +MODULE_ID("$Id: lib_erase.c,v 1.13 2000/12/10 02:43:27 tom Exp $") -int werase(WINDOW *win) +NCURSES_EXPORT(int) +werase(WINDOW *win) { -int code = ERR; -int y; -chtype blank; -chtype *sp, *end, *start; + int code = ERR; + int y; + chtype blank; + chtype *sp, *end, *start; - T((T_CALLED("werase(%p)"), win)); + T((T_CALLED("werase(%p)"), win)); - if (win) { - blank = _nc_background(win); - for (y = 0; y <= win->_maxy; y++) { + if (win) { + blank = _nc_background(win); + for (y = 0; y <= win->_maxy; y++) { start = win->_line[y].text; end = &start[win->_maxx]; - + for (sp = start; sp <= end; sp++) - *sp = blank; - + *sp = blank; + win->_line[y].firstchar = 0; win->_line[y].lastchar = win->_maxx; - } - win->_curx = win->_cury = 0; - win->_flags &= ~_WRAPPED; - _nc_synchook(win); - code = OK; } - returnCode(code); + win->_curx = win->_cury = 0; + win->_flags &= ~_WRAPPED; + _nc_synchook(win); + code = OK; + } + returnCode(code); } diff --git a/contrib/ncurses/ncurses/base/lib_flash.c b/contrib/ncurses/ncurses/base/lib_flash.c index d0d607f..a6b022a 100644 --- a/contrib/ncurses/ncurses/base/lib_flash.c +++ b/contrib/ncurses/ncurses/base/lib_flash.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * flash.c * @@ -40,9 +39,9 @@ */ #include <curses.priv.h> -#include <term.h> /* beep, flash */ +#include <term.h> /* beep, flash */ -MODULE_ID("$Id: lib_flash.c,v 1.4 1999/10/22 21:39:06 tom Exp $") +MODULE_ID("$Id: lib_flash.c,v 1.6 2000/12/10 02:43:27 tom Exp $") /* * flash() @@ -52,22 +51,23 @@ MODULE_ID("$Id: lib_flash.c,v 1.4 1999/10/22 21:39:06 tom Exp $") * */ -int flash(void) +NCURSES_EXPORT(int) +flash(void) { - int res = ERR; + int res = ERR; - T((T_CALLED("flash()"))); + T((T_CALLED("flash()"))); - /* FIXME: should make sure that we are not in altchar mode */ - if (flash_screen) { - TPUTS_TRACE("flash_screen"); - res = putp(flash_screen); - _nc_flush(); - } else if (bell) { - TPUTS_TRACE("bell"); - res = putp(bell); - _nc_flush(); - } + /* FIXME: should make sure that we are not in altchar mode */ + if (flash_screen) { + TPUTS_TRACE("flash_screen"); + res = putp(flash_screen); + _nc_flush(); + } else if (bell) { + TPUTS_TRACE("bell"); + res = putp(bell); + _nc_flush(); + } - returnCode(res); + returnCode(res); } diff --git a/contrib/ncurses/ncurses/base/lib_freeall.c b/contrib/ncurses/ncurses/base/lib_freeall.c index 28f0e5f..bbd8c0e 100644 --- a/contrib/ncurses/ncurses/base/lib_freeall.c +++ b/contrib/ncurses/ncurses/base/lib_freeall.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -39,10 +39,10 @@ extern int malloc_errfd; /* FIXME */ #endif -MODULE_ID("$Id: lib_freeall.c,v 1.16 1999/11/28 01:34:11 tom Exp $") +MODULE_ID("$Id: lib_freeall.c,v 1.18 2000/12/10 02:43:27 tom Exp $") static void -free_slk(SLK *p) +free_slk(SLK * p) { if (p != 0) { FreeIfNeeded(p->ent); @@ -69,7 +69,7 @@ free_tries(struct tries *p) * Free all ncurses data. This is used for testing only (there's no practical * use for it as an extension). */ -void +NCURSES_EXPORT(void) _nc_freeall(void) { WINDOWLIST *p, *q; @@ -124,7 +124,7 @@ _nc_freeall(void) #endif } -void +NCURSES_EXPORT(void) _nc_free_and_exit(int code) { _nc_freeall(); @@ -132,7 +132,7 @@ _nc_free_and_exit(int code) } #else -void +NCURSES_EXPORT(void) _nc_freeall(void) { } diff --git a/contrib/ncurses/ncurses/base/lib_getch.c b/contrib/ncurses/ncurses/base/lib_getch.c index f67bf9a..9deafec 100644 --- a/contrib/ncurses/ncurses/base/lib_getch.c +++ b/contrib/ncurses/ncurses/base/lib_getch.c @@ -40,14 +40,15 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_getch.c,v 1.50 2000/10/09 23:53:57 Ilya.Zakharevich Exp $") +MODULE_ID("$Id: lib_getch.c,v 1.54 2000/12/10 02:43:27 tom Exp $") #include <fifo_defs.h> -int ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */ +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)); @@ -80,7 +81,7 @@ static inline int fifo_push(void) { int n; - unsigned int ch; + int ch; if (tail == -1) return ERR; @@ -101,7 +102,7 @@ fifo_push(void) { unsigned char c2 = 0; n = read(SP->_ifd, &c2, 1); - ch = c2 & 0xff; + ch = CharOf(c2); } #ifdef HIDE_EINTR @@ -153,7 +154,7 @@ static int kgetch(WINDOW *); (is_wintouched(win) || (win->_flags & _HASMOVED)) \ && !(win->_flags & _ISPAD)) -int +NCURSES_EXPORT(int) wgetch(WINDOW *win) { int ch; @@ -235,8 +236,8 @@ wgetch(WINDOW *win) } } while (ch == KEY_MOUSE - && (_nc_timed_wait(3, SP->_maxclick, (int *) 0) - || !SP->_mouse_parse(runcount))); + && (_nc_timed_wait(3, SP->_maxclick, (int *) 0) + || !SP->_mouse_parse(runcount))); if (runcount > 0 && ch != KEY_MOUSE) { /* mouse event sequence ended by keystroke, push it */ ungetch(ch); @@ -357,7 +358,7 @@ kgetch(WINDOW *win GCC_UNUSED) TR(TRACE_IEVENT, ("ptr is null")); } else TR(TRACE_IEVENT, ("ptr=%p, ch=%d, value=%d", - ptr, ptr->ch, ptr->value)); + ptr, ptr->ch, ptr->value)); #endif /* TRACE */ if (ptr == NULL) diff --git a/contrib/ncurses/ncurses/base/lib_getstr.c b/contrib/ncurses/ncurses/base/lib_getstr.c index 485c6e3..cd58f18 100644 --- a/contrib/ncurses/ncurses/base/lib_getstr.c +++ b/contrib/ncurses/ncurses/base/lib_getstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_getstr.c ** @@ -42,151 +41,153 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$Id: lib_getstr.c,v 1.20 1998/12/20 00:16:01 tom Exp $") +MODULE_ID("$Id: lib_getstr.c,v 1.23 2000/12/10 02:43:27 tom Exp $") /* * This wipes out the last character, no matter whether it was a tab, control * or other character, and handles reverse wraparound. */ -static char *WipeOut(WINDOW *win, int y, int x, char *first, char *last, bool echoed) +static char * +WipeOut(WINDOW *win, int y, int x, char *first, char *last, bool echoed) { - if (last > first) { - *--last = '\0'; - if (echoed) { - int y1 = win->_cury; - int x1 = win->_curx; - - wmove(win, y, x); - waddstr(win, first); - getyx(win, y, x); - while (win->_cury < y1 - || (win->_cury == y1 && win->_curx < x1)) - waddch(win, ' '); - - wmove(win, y, x); - } + if (last > first) { + *--last = '\0'; + if (echoed) { + int y1 = win->_cury; + int x1 = win->_curx; + + wmove(win, y, x); + waddstr(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; + } + return last; } -int wgetnstr(WINDOW *win, char *str, int maxlen) +NCURSES_EXPORT(int) +wgetnstr(WINDOW *win, char *str, int maxlen) { -TTY buf; -bool oldnl, oldecho, oldraw, oldcbreak; -char erasec; -char killc; -char *oldstr; -int ch; -int y, x; + TTY buf; + bool oldnl, oldecho, oldraw, oldcbreak; + char erasec; + char killc; + char *oldstr; + int ch; + int y, x; - T((T_CALLED("wgetnstr(%p,%p, %d)"), win, str, maxlen)); + T((T_CALLED("wgetnstr(%p,%p, %d)"), win, str, maxlen)); - if (!win) - returnCode(ERR); + if (!win) + returnCode(ERR); - _nc_get_tty_mode(&buf); + _nc_get_tty_mode(&buf); - oldnl = SP->_nl; - oldecho = SP->_echo; - oldraw = SP->_raw; - oldcbreak = SP->_cbreak; - nl(); - noecho(); - noraw(); - cbreak(); + oldnl = SP->_nl; + oldecho = SP->_echo; + oldraw = SP->_raw; + oldcbreak = SP->_cbreak; + nl(); + noecho(); + noraw(); + cbreak(); - erasec = erasechar(); - killc = killchar(); + erasec = erasechar(); + killc = killchar(); - oldstr = str; - getyx(win, y, x); + oldstr = str; + getyx(win, y, x); - if (is_wintouched(win) || (win->_flags & _HASMOVED)) - wrefresh(win); + if (is_wintouched(win) || (win->_flags & _HASMOVED)) + wrefresh(win); - while ((ch = wgetch(win)) != ERR) { - /* - * 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 wgetch(); - * terminating *getstr() 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, '\n'); - break; - } - if (ch == erasec || ch == KEY_LEFT || ch == KEY_BACKSPACE) { - if (str > oldstr) { - str = WipeOut(win, y, x, oldstr, str, oldecho); - } - } else if (ch == killc) { - while (str > oldstr) { - str = WipeOut(win, y, x, oldstr, str, oldecho); - } - } else if (ch >= KEY_MIN - || (maxlen >= 0 && str - oldstr >= maxlen)) { - beep(); - } else { - *str++ = ch; - if (oldecho == TRUE) { - int oldy = win->_cury; - if (waddch(win, ch) == 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, ' '); - str = WipeOut(win, y, x, oldstr, str, 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); + while ((ch = wgetch(win)) != ERR) { + /* + * 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 wgetch(); + * terminating *getstr() 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 (str > oldstr) { + str = WipeOut(win, y, x, oldstr, str, oldecho); + } + } else if (ch == killc) { + while (str > oldstr) { + str = WipeOut(win, y, x, oldstr, str, oldecho); + } + } else if (ch >= KEY_MIN + || (maxlen >= 0 && str - oldstr >= maxlen)) { + beep(); + } else { + *str++ = ch; + if (oldecho == TRUE) { + int oldy = win->_cury; + if (waddch(win, (chtype) ch) == 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) ' '); + str = WipeOut(win, y, x, oldstr, str, 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); + 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; + /* 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); + _nc_set_tty_mode(&buf); - *str = '\0'; - if (ch == ERR) - returnCode(ERR); + *str = '\0'; + if (ch == ERR) + returnCode(ERR); - T(("wgetnstr returns %s", _nc_visbuf(oldstr))); + T(("wgetnstr returns %s", _nc_visbuf(oldstr))); - returnCode(OK); + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_hline.c b/contrib/ncurses/ncurses/base/lib_hline.c index fd32d35..72d1ddb 100644 --- a/contrib/ncurses/ncurses/base/lib_hline.c +++ b/contrib/ncurses/ncurses/base/lib_hline.c @@ -40,9 +40,9 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_hline.c,v 1.6 2000/07/04 14:08:09 Philippe.Blain Exp $") +MODULE_ID("$Id: lib_hline.c,v 1.8 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) whline(WINDOW *win, chtype ch, int n) { int code = ERR; diff --git a/contrib/ncurses/ncurses/base/lib_immedok.c b/contrib/ncurses/ncurses/base/lib_immedok.c index 5590ec9..87988b6 100644 --- a/contrib/ncurses/ncurses/base/lib_immedok.c +++ b/contrib/ncurses/ncurses/base/lib_immedok.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_immedok.c ** @@ -41,14 +40,15 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_immedok.c,v 1.2 1998/02/11 12:14:01 tom Exp $") +MODULE_ID("$Id: lib_immedok.c,v 1.4 2000/12/10 02:43:27 tom Exp $") -void immedok(WINDOW *win, bool flag) +NCURSES_EXPORT(void) +immedok(WINDOW *win, bool flag) { - T((T_CALLED("immedok(%p,%d)"), win, flag)); + T((T_CALLED("immedok(%p,%d)"), win, flag)); - if (win) - win->_immed = flag; + if (win) + win->_immed = flag; - returnVoid; + returnVoid; } diff --git a/contrib/ncurses/ncurses/base/lib_inchstr.c b/contrib/ncurses/ncurses/base/lib_inchstr.c index 4779ae0..31625bb 100644 --- a/contrib/ncurses/ncurses/base/lib_inchstr.c +++ b/contrib/ncurses/ncurses/base/lib_inchstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_inchstr.c ** @@ -41,22 +40,23 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_inchstr.c,v 1.7 1998/02/11 12:13:55 tom Exp $") +MODULE_ID("$Id: lib_inchstr.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -int winchnstr(WINDOW *win, chtype *str, int n) +NCURSES_EXPORT(int) +winchnstr(WINDOW *win, chtype * str, int n) { - int i = 0; + int i = 0; - T((T_CALLED("winchnstr(%p,%p,%d)"), win, str, n)); + T((T_CALLED("winchnstr(%p,%p,%d)"), win, str, n)); - if (!str) - returnCode(0); + if (!str) + returnCode(0); - if (win) { - for (; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++) + 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] = (chtype)0; + } + str[i] = (chtype) 0; - returnCode(i); + returnCode(i); } diff --git a/contrib/ncurses/ncurses/base/lib_initscr.c b/contrib/ncurses/ncurses/base/lib_initscr.c index 9a89a07..b6e34ef 100644 --- a/contrib/ncurses/ncurses/base/lib_initscr.c +++ b/contrib/ncurses/ncurses/base/lib_initscr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,40 +39,41 @@ */ #include <curses.priv.h> -#include <tic.h> /* for MAX_ALIAS */ +#include <tic.h> /* for MAX_ALIAS */ #if HAVE_SYS_TERMIO_H -#include <sys/termio.h> /* needed for ISC */ +#include <sys/termio.h> /* needed for ISC */ #endif -MODULE_ID("$Id: lib_initscr.c,v 1.26 1998/12/19 23:10:09 tom Exp $") +MODULE_ID("$Id: lib_initscr.c,v 1.28 2000/12/10 02:43:27 tom Exp $") -WINDOW *initscr(void) +NCURSES_EXPORT(WINDOW *) +initscr(void) { -static bool initialized = FALSE; -NCURSES_CONST char *name; -int value; + static bool initialized = FALSE; + NCURSES_CONST char *name; + int value; - T((T_CALLED("initscr()"))); - /* Portable applications must not call initscr() more than once */ - if (!initialized) { - initialized = TRUE; + T((T_CALLED("initscr()"))); + /* Portable applications must not call initscr() more than once */ + if (!initialized) { + initialized = TRUE; - if ((name = getenv("TERM")) == 0 - || *name == '\0') - name = "unknown"; - if (newterm(name, stdout, stdin) == 0) { - fprintf(stderr, "Error opening terminal: %s.\n", name); - exit(EXIT_FAILURE); - } - - /* allow user to set maximum escape delay from the environment */ - if ((value = _nc_getenv_num("ESCDELAY")) >= 0) { - ESCDELAY = value; - } + if ((name = getenv("TERM")) == 0 + || *name == '\0') + name = "unknown"; + if (newterm(name, stdout, stdin) == 0) { + fprintf(stderr, "Error opening terminal: %s.\n", name); + exit(EXIT_FAILURE); + } - /* def_shell_mode - done in newterm/_nc_setupscreen */ - def_prog_mode(); + /* allow user to set maximum escape delay from the environment */ + if ((value = _nc_getenv_num("ESCDELAY")) >= 0) { + ESCDELAY = value; } - returnWin(stdscr); + + /* def_shell_mode - done in newterm/_nc_setupscreen */ + def_prog_mode(); + } + returnWin(stdscr); } diff --git a/contrib/ncurses/ncurses/base/lib_insch.c b/contrib/ncurses/ncurses/base/lib_insch.c index ccc5ff5..8d495f5 100644 --- a/contrib/ncurses/ncurses/base/lib_insch.c +++ b/contrib/ncurses/ncurses/base/lib_insch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_insch.c ** @@ -42,26 +40,27 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_insch.c,v 1.10 1998/06/28 00:26:52 tom Exp $") +MODULE_ID("$Id: lib_insch.c,v 1.12 2000/12/10 02:43:27 tom Exp $") -int winsch(WINDOW *win, chtype c) +NCURSES_EXPORT(int) +winsch(WINDOW *win, chtype c) { -int code = ERR; + int code = ERR; - T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(c))); + T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(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; + 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; - CHANGED_TO_EOL(line, win->_curx, win->_maxx); - while (temp1 > end) - *temp1-- = *temp2--; + CHANGED_TO_EOL(line, win->_curx, win->_maxx); + while (temp1 > end) + *temp1-- = *temp2--; - *temp1 = _nc_render(win, c); - code = OK; - } - returnCode(code); + *temp1 = _nc_render(win, c); + code = OK; + } + returnCode(code); } diff --git a/contrib/ncurses/ncurses/base/lib_insdel.c b/contrib/ncurses/ncurses/base/lib_insdel.c index 48e108d..1a23a86 100644 --- a/contrib/ncurses/ncurses/base/lib_insdel.c +++ b/contrib/ncurses/ncurses/base/lib_insdel.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -42,21 +42,22 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_insdel.c,v 1.8 1998/02/11 12:13:55 tom Exp $") +MODULE_ID("$Id: lib_insdel.c,v 1.10 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) winsdelln(WINDOW *win, int n) { -int code = ERR; + int code = ERR; - T((T_CALLED("winsdel(%p,%d)"), win, n)); + T((T_CALLED("winsdel(%p,%d)"), win, n)); - if (win) { - if (n != 0) { - _nc_scroll_window(win, -n, win->_cury, win->_maxy, _nc_background(win)); + if (win) { + if (n != 0) { + _nc_scroll_window(win, -n, win->_cury, win->_maxy, + _nc_background(win)); _nc_synchook(win); - } - code = OK; } - returnCode(code); + code = OK; + } + returnCode(code); } diff --git a/contrib/ncurses/ncurses/base/lib_insstr.c b/contrib/ncurses/ncurses/base/lib_insstr.c index a2275f9..f4c215d 100644 --- a/contrib/ncurses/ncurses/base/lib_insstr.c +++ b/contrib/ncurses/ncurses/base/lib_insstr.c @@ -41,9 +41,9 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$Id: lib_insstr.c,v 1.14 2000/04/29 21:16:41 tom Exp $") +MODULE_ID("$Id: lib_insstr.c,v 1.17 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) winsnstr(WINDOW *win, const char *s, int n) { int code = ERR; @@ -62,7 +62,7 @@ winsnstr(WINDOW *win, const char *s, int n) _nc_waddch_nosync(win, (chtype) (*cp)); else if (is7bits(*cp) && iscntrl(*cp)) { winsch(win, ' ' + (chtype) (*cp)); - winsch(win, '^'); + winsch(win, (chtype) '^'); win->_curx += 2; } else { winsch(win, (chtype) (*cp)); diff --git a/contrib/ncurses/ncurses/base/lib_instr.c b/contrib/ncurses/ncurses/base/lib_instr.c index b3e1d03..588f6c4 100644 --- a/contrib/ncurses/ncurses/base/lib_instr.c +++ b/contrib/ncurses/ncurses/base/lib_instr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_instr.c ** @@ -41,33 +40,33 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_instr.c,v 1.8 1998/02/11 12:13:54 tom Exp $") +MODULE_ID("$Id: lib_instr.c,v 1.10 2000/12/10 02:43:27 tom Exp $") -int winnstr(WINDOW *win, char *str, int n) +NCURSES_EXPORT(int) +winnstr(WINDOW *win, char *str, int n) { - int i=0, row, col; + int i = 0, row, col; + + T((T_CALLED("winnstr(%p,%p,%d)"), win, str, n)); - T((T_CALLED("winnstr(%p,%p,%d)"), win, str, n)); + if (!str) + returnCode(0); - if (!str) - returnCode(0); - - if (win) { - getyx(win, row, col); + if (win) { + getyx(win, row, col); - if (n < 0) + if (n < 0) n = win->_maxx - win->_curx + 1; - for (; i < n;) { + for (; i < n;) { str[i++] = TextOf(win->_line[row].text[col]); if (++col > win->_maxx) { - col = 0; - if (++row > win->_maxy) - break; + col = 0; + if (++row > win->_maxy) + break; } - } } - str[i] = '\0'; /* SVr4 does not seem to count the null */ - returnCode(i); + } + str[i] = '\0'; /* SVr4 does not seem to count the null */ + returnCode(i); } - diff --git a/contrib/ncurses/ncurses/base/lib_isendwin.c b/contrib/ncurses/ncurses/base/lib_isendwin.c index 60015fc..b337d97 100644 --- a/contrib/ncurses/ncurses/base/lib_isendwin.c +++ b/contrib/ncurses/ncurses/base/lib_isendwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_endwin.c ** @@ -41,11 +40,12 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_isendwin.c,v 1.4 1998/04/11 22:52:32 tom Exp $") +MODULE_ID("$Id: lib_isendwin.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -bool isendwin(void) +NCURSES_EXPORT(bool) +isendwin(void) { - if (SP == NULL) - return FALSE; - return SP->_endwin; + if (SP == NULL) + return FALSE; + return SP->_endwin; } diff --git a/contrib/ncurses/ncurses/base/lib_leaveok.c b/contrib/ncurses/ncurses/base/lib_leaveok.c index e83285d..17d095d 100644 --- a/contrib/ncurses/ncurses/base/lib_leaveok.c +++ b/contrib/ncurses/ncurses/base/lib_leaveok.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_leaveok.c ** @@ -41,16 +40,16 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_leaveok.c,v 1.3 1998/03/21 22:54:20 jtc Exp $") +MODULE_ID("$Id: lib_leaveok.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int leaveok(WINDOW *win, bool flag) +NCURSES_EXPORT(int) +leaveok(WINDOW *win, bool flag) { - T((T_CALLED("leaveok(%p,%d)"), win, flag)); + T((T_CALLED("leaveok(%p,%d)"), win, flag)); - if (win) { - win->_leaveok = flag; - returnCode(OK); - } - else - returnCode(ERR); + if (win) { + win->_leaveok = flag; + returnCode(OK); + } else + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/base/lib_mouse.c b/contrib/ncurses/ncurses/base/lib_mouse.c index 3b85635..01d3057 100644 --- a/contrib/ncurses/ncurses/base/lib_mouse.c +++ b/contrib/ncurses/ncurses/base/lib_mouse.c @@ -84,7 +84,7 @@ #endif #endif -MODULE_ID("$Id: lib_mouse.c,v 1.55 2000/10/10 00:07:28 Ilya.Zakharevich Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.57 2000/12/10 02:43:27 tom Exp $") #define MY_TRACE TRACE_ICALLS|TRACE_IEVENT @@ -863,7 +863,7 @@ _nc_mouse_resume(SCREEN * sp GCC_UNUSED) * **************************************************************************/ -int +NCURSES_EXPORT(int) getmouse(MEVENT * aevent) /* grab a copy of the current mouse event */ { @@ -886,7 +886,7 @@ getmouse(MEVENT * aevent) returnCode(ERR); } -int +NCURSES_EXPORT(int) ungetmouse(MEVENT * aevent) /* enqueue a synthesized mouse event to be seen by the next wgetch() */ { @@ -900,7 +900,7 @@ ungetmouse(MEVENT * aevent) return ungetch(KEY_MOUSE); } -mmask_t +NCURSES_EXPORT(mmask_t) mousemask(mmask_t newmask, mmask_t * oldmask) /* set the mouse event mask */ { @@ -933,7 +933,7 @@ mousemask(mmask_t newmask, mmask_t * oldmask) returnCode(result); } -bool +NCURSES_EXPORT(bool) wenclose(const WINDOW *win, int y, int x) /* check to see if given window encloses given screen location */ { @@ -947,7 +947,7 @@ wenclose(const WINDOW *win, int y, int x) return FALSE; } -int +NCURSES_EXPORT(int) mouseinterval(int maxclick) /* set the maximum mouse interval within which to recognize a click */ { @@ -966,14 +966,15 @@ mouseinterval(int maxclick) /* This may be used by other routines to ask for the existence of mouse support */ -int +NCURSES_EXPORT(int) _nc_has_mouse(void) { return (mousetype == M_NONE ? 0 : 1); } -bool -wmouse_trafo(const WINDOW *win, int *pY, int *pX, bool to_screen) +NCURSES_EXPORT(bool) +wmouse_trafo +(const WINDOW *win, int *pY, int *pX, bool to_screen) { bool result = FALSE; diff --git a/contrib/ncurses/ncurses/base/lib_move.c b/contrib/ncurses/ncurses/base/lib_move.c index 68415d6..e917eb7 100644 --- a/contrib/ncurses/ncurses/base/lib_move.c +++ b/contrib/ncurses/ncurses/base/lib_move.c @@ -40,9 +40,9 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_move.c,v 1.9 2000/04/29 21:11:19 tom Exp $") +MODULE_ID("$Id: lib_move.c,v 1.11 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) wmove(WINDOW *win, int y, int x) { T((T_CALLED("wmove(%p,%d,%d)"), win, y, x)); diff --git a/contrib/ncurses/ncurses/base/lib_mvwin.c b/contrib/ncurses/ncurses/base/lib_mvwin.c index 9774d9f..28b78f8 100644 --- a/contrib/ncurses/ncurses/base/lib_mvwin.c +++ b/contrib/ncurses/ncurses/base/lib_mvwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_mvwin.c ** @@ -42,68 +40,68 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_mvwin.c,v 1.7 1998/02/11 12:13:55 tom Exp $") +MODULE_ID("$Id: lib_mvwin.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -int mvwin(WINDOW *win, int by, int bx) +NCURSES_EXPORT(int) +mvwin(WINDOW *win, int by, int bx) { - T((T_CALLED("mvwin(%p,%d,%d)"), win, by, bx)); + T((T_CALLED("mvwin(%p,%d,%d)"), win, by, bx)); - if (!win || (win->_flags & _ISPAD)) - returnCode(ERR); + if (!win || (win->_flags & _ISPAD)) + returnCode(ERR); - /* Copying subwindows is allowed, but it is expensive... */ - if (win->_flags & _SUBWIN) { - int err = ERR; - WINDOW *parent = win->_parent; - if (parent) - { /* Now comes the complicated and costly part, you should really - * try to avoid to move subwindows. Because a subwindow shares - * the text buffers with its parent, one can't do a simple - * memmove of the text buffers. One has to create a copy, then - * to relocate the subwindow and then to do a copy. - */ - if ((by - parent->_begy == win->_pary) && - (bx - parent->_begx == win->_parx)) - err=OK; /* we don't actually move */ - else { - WINDOW* clone = dupwin(win); + /* Copying subwindows is allowed, but it is expensive... */ + if (win->_flags & _SUBWIN) { + int err = ERR; + WINDOW *parent = win->_parent; + if (parent) { /* Now comes the complicated and costly part, you should really + * try to avoid to move subwindows. Because a subwindow shares + * the text buffers with its parent, one can't do a simple + * memmove of the text buffers. One has to create a copy, then + * to relocate the subwindow and then to do a copy. + */ + if ((by - parent->_begy == win->_pary) && + (bx - parent->_begx == win->_parx)) + err = OK; /* we don't actually move */ + else { + WINDOW *clone = dupwin(win); if (clone) { - /* now we have the clone, so relocate win */ - - werase(win); /* Erase the original place */ - wbkgd(win,parent->_bkgd);/* fill with parents background */ - wsyncup(win); /* Tell the parent(s) */ - - err = mvderwin(win, - by - parent->_begy, - bx - parent->_begx); - if (err!=ERR) { - err = copywin(clone,win, - 0, 0, 0, 0, win->_maxy, win->_maxx, 0); - if (ERR!=err) - wsyncup(win); - } - if (ERR==delwin(clone)) - err=ERR; + /* now we have the clone, so relocate win */ + + werase(win); /* Erase the original place */ + wbkgd(win, parent->_bkgd); /* fill with parents background */ + wsyncup(win); /* Tell the parent(s) */ + + err = mvderwin(win, + by - parent->_begy, + bx - parent->_begx); + if (err != ERR) { + err = copywin(clone, win, + 0, 0, 0, 0, win->_maxy, win->_maxx, 0); + if (ERR != err) + wsyncup(win); + } + if (ERR == delwin(clone)) + err = ERR; } - } } - returnCode(err); } + returnCode(err); + } - if (by + win->_maxy > screen_lines - 1 - || bx + win->_maxx > screen_columns - 1 - || by < 0 - || bx < 0) - returnCode(ERR); + if (by + win->_maxy > screen_lines - 1 + || bx + win->_maxx > screen_columns - 1 + || by < 0 + || bx < 0) + returnCode(ERR); - /* - * Whether or not the window is moved, touch the window's contents so - * that a following call to 'wrefresh()' will paint the window at the - * new location. This ensures that if the caller has refreshed another - * window at the same location, that this one will be displayed. - */ - win->_begy = by; - win->_begx = bx; - returnCode(touchwin(win)); + /* + * Whether or not the window is moved, touch the window's contents so + * that a following call to 'wrefresh()' will paint the window at the + * new location. This ensures that if the caller has refreshed another + * window at the same location, that this one will be displayed. + */ + win->_begy = by; + win->_begx = bx; + returnCode(touchwin(win)); } diff --git a/contrib/ncurses/ncurses/base/lib_newterm.c b/contrib/ncurses/ncurses/base/lib_newterm.c index 7da4069..02f6ff5 100644 --- a/contrib/ncurses/ncurses/base/lib_newterm.c +++ b/contrib/ncurses/ncurses/base/lib_newterm.c @@ -47,7 +47,7 @@ #include <term.h> /* clear_screen, cup & friends, cur_term */ #include <tic.h> -MODULE_ID("$Id: lib_newterm.c,v 1.48 2000/09/02 18:11:42 tom Exp $") +MODULE_ID("$Id: lib_newterm.c,v 1.50 2000/12/10 02:43:27 tom Exp $") #ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */ #define ONLCR 0 @@ -86,14 +86,15 @@ _nc_initscr(void) */ static int filter_mode = FALSE; -void +NCURSES_EXPORT(void) filter(void) { filter_mode = TRUE; } -SCREEN * -newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) +NCURSES_EXPORT(SCREEN *) +newterm +(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) { int errret; int slk_format = _nc_slk_format; @@ -138,7 +139,7 @@ newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) if (num_labels <= 0 || !SLK_STDFMT(slk_format)) if (slk_format) { if (ERR == _nc_ripoffline(-SLK_LINES(slk_format), - _nc_slk_initialize)) + _nc_slk_initialize)) return 0; } /* this actually allocates the screen structure, and saves the @@ -160,7 +161,7 @@ newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) typeahead(fileno(ifp)); #ifdef TERMIOS SP->_use_meta = ((cur_term->Ottyb.c_cflag & CSIZE) == CS8 && - !(cur_term->Ottyb.c_iflag & ISTRIP)); + !(cur_term->Ottyb.c_iflag & ISTRIP)); #else SP->_use_meta = FALSE; #endif @@ -171,8 +172,8 @@ newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) * will be useless. */ SP->_scrolling = ((scroll_forward && scroll_reverse) || - ((parm_rindex || parm_insert_line || insert_line) && - (parm_index || parm_delete_line || delete_line))); + ((parm_rindex || parm_insert_line || insert_line) && + (parm_index || parm_delete_line || delete_line))); baudrate(); /* sets a field in the SP structure */ diff --git a/contrib/ncurses/ncurses/base/lib_newwin.c b/contrib/ncurses/ncurses/base/lib_newwin.c index ececa58..08921f2 100644 --- a/contrib/ncurses/ncurses/base/lib_newwin.c +++ b/contrib/ncurses/ncurses/base/lib_newwin.c @@ -40,13 +40,14 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_newwin.c,v 1.24 2000/04/29 18:49:51 tom Exp $") +MODULE_ID("$Id: lib_newwin.c,v 1.27 2000/12/10 02:43:27 tom Exp $") -void +NCURSES_EXPORT(int) _nc_freewin(WINDOW *win) { WINDOWLIST *p, *q; int i; + int result = ERR; if (win != 0) { for (p = _nc_windows, q = 0; p != 0; q = p, p = p->next) { @@ -71,15 +72,18 @@ _nc_freewin(WINDOW *win) if (win == newscr) newscr = 0; + result = OK; T(("...deleted win=%p", win)); break; } } } + return result; } -WINDOW * -newwin(int num_lines, int num_columns, int begy, int begx) +NCURSES_EXPORT(WINDOW *) +newwin +(int num_lines, int num_columns, int begy, int begx) { WINDOW *win; chtype *ptr; @@ -104,11 +108,11 @@ newwin(int num_lines, int num_columns, int begy, int begx) for (i = 0; i < num_lines; i++) { win->_line[i].text = typeCalloc(chtype, (unsigned) num_columns); if (win->_line[i].text == 0) { - _nc_freewin(win); + (void) _nc_freewin(win); returnWin(0); } for (ptr = win->_line[i].text; ptr < win->_line[i].text + - num_columns;) + num_columns;) *ptr++ = ' '; } @@ -117,15 +121,16 @@ newwin(int num_lines, int num_columns, int begy, int begx) returnWin(win); } -WINDOW * -derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) +NCURSES_EXPORT(WINDOW *) +derwin +(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) { WINDOW *win; int i; int flags = _SUBWIN; T((T_CALLED("derwin(%p,%d,%d,%d,%d)"), orig, num_lines, num_columns, - begy, begx)); + begy, begx)); /* ** make sure window fits inside the original one @@ -146,7 +151,7 @@ derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) flags |= _ISPAD; if ((win = _nc_makenew(num_lines, num_columns, orig->_begy + begy, - orig->_begx + begx, flags)) == 0) + orig->_begx + begx, flags)) == 0) returnWin(0); win->_pary = begy; @@ -164,8 +169,9 @@ derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) returnWin(win); } -WINDOW * -subwin(WINDOW *w, int l, int c, int y, int x) +NCURSES_EXPORT(WINDOW *) +subwin +(WINDOW *w, int l, int c, int y, int x) { T((T_CALLED("subwin(%p, %d, %d, %d, %d)"), w, l, c, y, x)); T(("parent has begy = %d, begx = %d", w->_begy, w->_begx)); @@ -180,8 +186,9 @@ dimension_limit(int value) return (test == value && value > 0); } -WINDOW * -_nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags) +NCURSES_EXPORT(WINDOW *) +_nc_makenew +(int num_lines, int num_columns, int begy, int begx, int flags) { int i; WINDOWLIST *wp; @@ -216,8 +223,8 @@ _nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags) win->_attrs = A_NORMAL; win->_bkgd = BLANK; - win->_clear = is_pad ? FALSE : (num_lines == screen_lines && num_columns - == screen_columns); + win->_clear = is_pad ? FALSE : (num_lines == screen_lines + && num_columns == screen_columns); win->_idlok = FALSE; win->_idcok = TRUE; win->_scroll = FALSE; diff --git a/contrib/ncurses/ncurses/base/lib_nl.c b/contrib/ncurses/ncurses/base/lib_nl.c index bfaffde..32515da 100644 --- a/contrib/ncurses/ncurses/base/lib_nl.c +++ b/contrib/ncurses/ncurses/base/lib_nl.c @@ -42,13 +42,13 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_nl.c,v 1.6 2000/02/13 00:59:39 tom Exp $") +MODULE_ID("$Id: lib_nl.c,v 1.8 2000/12/10 02:43:27 tom Exp $") #ifdef __EMX__ #include <io.h> #endif -int +NCURSES_EXPORT(int) nl(void) { T((T_CALLED("nl()"))); @@ -63,7 +63,7 @@ nl(void) returnCode(OK); } -int +NCURSES_EXPORT(int) nonl(void) { T((T_CALLED("nonl()"))); diff --git a/contrib/ncurses/ncurses/base/lib_overlay.c b/contrib/ncurses/ncurses/base/lib_overlay.c index db2dce1..592e7ad 100644 --- a/contrib/ncurses/ncurses/base/lib_overlay.c +++ b/contrib/ncurses/ncurses/base/lib_overlay.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_overlay.c ** @@ -41,29 +40,30 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_overlay.c,v 1.12 1998/02/11 12:13:59 tom Exp $") +MODULE_ID("$Id: lib_overlay.c,v 1.14 2000/12/10 02:43:27 tom Exp $") -static int overlap(const WINDOW *const s, WINDOW *const d, int const flag) +static int +overlap(const WINDOW *const s, WINDOW *const d, int const flag) { -int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol; - - T(("overlap : sby %d, sbx %d, smy %d, smx %d, dby %d, dbx %d, dmy %d, dmx %d", - s->_begy, s->_begx, s->_maxy, s->_maxx, - d->_begy, d->_begx, d->_maxy, d->_maxx)); - - if (!s || !d) - returnCode(ERR); - - sminrow = max(s->_begy, d->_begy) - s->_begy; - smincol = max(s->_begx, d->_begx) - s->_begx; - dminrow = max(s->_begy, d->_begy) - d->_begy; - dmincol = max(s->_begx, d->_begx) - d->_begx; - dmaxrow = min(s->_maxy+s->_begy, d->_maxy+d->_begy) - d->_begy; - dmaxcol = min(s->_maxx+s->_begx, d->_maxx+d->_begx) - d->_begx; - - return(copywin(s, d, - sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, - flag)); + int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol; + + T(("overlap : sby %d, sbx %d, smy %d, smx %d, dby %d, dbx %d, dmy %d, dmx %d", + s->_begy, s->_begx, s->_maxy, s->_maxx, + d->_begy, d->_begx, d->_maxy, d->_maxx)); + + if (!s || !d) + returnCode(ERR); + + sminrow = max(s->_begy, d->_begy) - s->_begy; + smincol = max(s->_begx, d->_begx) - s->_begx; + dminrow = max(s->_begy, d->_begy) - d->_begy; + dmincol = max(s->_begx, d->_begx) - d->_begx; + dmaxrow = min(s->_maxy + s->_begy, d->_maxy + d->_begy) - d->_begy; + dmaxcol = min(s->_maxx + s->_begx, d->_maxx + d->_begx) - d->_begx; + + return (copywin(s, d, + sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, + flag)); } /* @@ -76,10 +76,11 @@ int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol; ** **/ -int overlay(const WINDOW *win1, WINDOW *win2) +NCURSES_EXPORT(int) +overlay(const WINDOW *win1, WINDOW *win2) { - T((T_CALLED("overlay(%p,%p)"), win1, win2)); - returnCode(overlap(win1, win2, TRUE)); + T((T_CALLED("overlay(%p,%p)"), win1, win2)); + returnCode(overlap(win1, win2, TRUE)); } /* @@ -92,70 +93,67 @@ int overlay(const WINDOW *win1, WINDOW *win2) ** **/ -int overwrite(const WINDOW *win1, WINDOW *win2) +NCURSES_EXPORT(int) +overwrite(const WINDOW *win1, WINDOW *win2) { - T((T_CALLED("overwrite(%p,%p)"), win1, win2)); - returnCode(overlap(win1, win2, FALSE)); + T((T_CALLED("overwrite(%p,%p)"), win1, win2)); + returnCode(overlap(win1, win2, FALSE)); } -int copywin(const WINDOW *src, WINDOW *dst, - int sminrow, int smincol, - int dminrow, int dmincol, int dmaxrow, int dmaxcol, - int over) +NCURSES_EXPORT(int) +copywin +(const WINDOW *src, WINDOW *dst, + int sminrow, int smincol, + int dminrow, int dmincol, int dmaxrow, int dmaxcol, + int over) { -int sx, sy, dx, dy; -bool touched; -chtype bk = AttrOf(dst->_bkgd); -chtype mask = ~(chtype)((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)); - - if (!src || !dst) - returnCode(ERR); - - /* make sure rectangle exists in source */ - if ((sminrow + dmaxrow - dminrow) > (src->_maxy + 1) || - (smincol + dmaxcol - dmincol) > (src->_maxx + 1)) { - returnCode(ERR); - } - - T(("rectangle exists in source")); - - /* make sure rectangle fits in destination */ - if (dmaxrow > dst->_maxy || dmaxcol > dst->_maxx) { - returnCode(ERR); + int sx, sy, dx, dy; + bool touched; + chtype bk = AttrOf(dst->_bkgd); + chtype mask = ~(chtype) ((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)); + + if (!src || !dst) + returnCode(ERR); + + /* make sure rectangle exists in source */ + if ((sminrow + dmaxrow - dminrow) > (src->_maxy + 1) || + (smincol + dmaxcol - dmincol) > (src->_maxx + 1)) { + returnCode(ERR); + } + + T(("rectangle exists in source")); + + /* make sure rectangle fits in destination */ + if (dmaxrow > dst->_maxy || dmaxcol > dst->_maxx) { + returnCode(ERR); + } + + T(("rectangle fits in destination")); + + for (dy = dminrow, sy = sminrow; dy <= dmaxrow; sy++, dy++) { + 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; + touched = TRUE; + } + } else { + if (dst->_line[dy].text[dx] != src->_line[sy].text[sx]) { + dst->_line[dy].text[dx] = src->_line[sy].text[sx]; + touched = TRUE; + } + } } - - T(("rectangle fits in destination")); - - for (dy = dminrow, sy = sminrow; dy <= dmaxrow; sy++, dy++) { - 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; - touched = TRUE; - } - } - else { - if (dst->_line[dy].text[dx] != src->_line[sy].text[sx]) - { - dst->_line[dy].text[dx] = src->_line[sy].text[sx]; - touched = TRUE; - } - } - } - if (touched) - { - touchline(dst,0,getmaxy(dst)); - } + if (touched) { + touchline(dst, 0, getmaxy(dst)); } - T(("finished copywin")); - returnCode(OK); + } + T(("finished copywin")); + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_pad.c b/contrib/ncurses/ncurses/base/lib_pad.c index af7dd3b..8a9dae8 100644 --- a/contrib/ncurses/ncurses/base/lib_pad.c +++ b/contrib/ncurses/ncurses/base/lib_pad.c @@ -40,9 +40,9 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_pad.c,v 1.29 2000/04/29 21:19:44 tom Exp $") +MODULE_ID("$Id: lib_pad.c,v 1.32 2000/12/10 02:43:27 tom Exp $") -WINDOW * +NCURSES_EXPORT(WINDOW *) newpad(int l, int c) { WINDOW *win; @@ -60,7 +60,7 @@ 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) { - _nc_freewin(win); + (void) _nc_freewin(win); returnWin(0); } for (ptr = win->_line[i].text; ptr < win->_line[i].text + c;) @@ -70,8 +70,9 @@ newpad(int l, int c) returnWin(win); } -WINDOW * -subpad(WINDOW *orig, int l, int c, int begy, int begx) +NCURSES_EXPORT(WINDOW *) +subpad +(WINDOW *orig, int l, int c, int begy, int begx) { WINDOW *win = (WINDOW *) 0; @@ -85,33 +86,38 @@ subpad(WINDOW *orig, int l, int c, int begy, int begx) returnWin(win); } -int -prefresh(WINDOW *win, int pminrow, int pmincol, - int sminrow, int smincol, int smaxrow, int smaxcol) +NCURSES_EXPORT(int) +prefresh +(WINDOW *win, int pminrow, int pmincol, + int sminrow, int smincol, int smaxrow, int smaxcol) { T((T_CALLED("prefresh()"))); if (pnoutrefresh(win, pminrow, pmincol, sminrow, smincol, smaxrow, - smaxcol) != ERR + smaxcol) != ERR && doupdate() != ERR) { returnCode(OK); } returnCode(ERR); } -int -pnoutrefresh(WINDOW *win, int pminrow, int pmincol, - int sminrow, int smincol, int smaxrow, int smaxcol) +NCURSES_EXPORT(int) +pnoutrefresh +(WINDOW *win, int pminrow, int pmincol, + int sminrow, int smincol, int smaxrow, int smaxcol) { - const int my_len = 2; /* parameterize the threshold for hardscroll */ NCURSES_SIZE_T i, j; NCURSES_SIZE_T m, n; NCURSES_SIZE_T pmaxrow; NCURSES_SIZE_T pmaxcol; + +#if USE_SCROLL_HINTS + const int my_len = 2; /* parameterize the threshold for hardscroll */ NCURSES_SIZE_T displaced; bool wide; +#endif T((T_CALLED("pnoutrefresh(%p, %d, %d, %d, %d, %d, %d)"), - win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)); + win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)); if (win == 0) returnCode(ERR); @@ -155,12 +161,14 @@ pnoutrefresh(WINDOW *win, int pminrow, int pmincol, T(("pad being refreshed")); +#if USE_SCROLL_HINTS if (win->_pad._pad_y >= 0) { displaced = pminrow - win->_pad._pad_y - (sminrow - win->_pad._pad_top); T(("pad being shifted by %d line(s)", displaced)); } else displaced = 0; +#endif /* * For pure efficiency, we'd want to transfer scrolling information @@ -176,11 +184,13 @@ pnoutrefresh(WINDOW *win, int pminrow, int pmincol, * windows). Note that changing this formula will not break any code, * merely change the costs of various update cases. */ +#if USE_SCROLL_HINTS wide = (smincol < my_len && smaxcol > (newscr->_maxx - my_len)); +#endif for (i = pminrow, m = sminrow + win->_yoffset; - i <= pmaxrow && m <= newscr->_maxy; - i++, m++) { + i <= pmaxrow && m <= newscr->_maxy; + i++, m++) { register struct ldat *nline = &newscr->_line[m]; register struct ldat *oline = &win->_line[i]; @@ -227,7 +237,7 @@ pnoutrefresh(WINDOW *win, int pminrow, int pmincol, for (i = pminrow - 1; (i >= 0) && (win->_line[i].oldindex >= 0); i--) win->_line[i].oldindex = _NEWINDEX; for (i = pmaxrow + 1; (i <= win->_maxy) - && (win->_line[i].oldindex >= 0); i++) + && (win->_line[i].oldindex >= 0); i++) win->_line[i].oldindex = _NEWINDEX; #endif @@ -269,7 +279,7 @@ pnoutrefresh(WINDOW *win, int pminrow, int pmincol, returnCode(OK); } -int +NCURSES_EXPORT(int) pechochar(WINDOW *pad, const chtype ch) { T((T_CALLED("pechochar(%p, %s)"), pad, _tracechtype(ch))); @@ -282,11 +292,11 @@ pechochar(WINDOW *pad, const chtype ch) waddch(pad, ch); prefresh(pad, pad->_pad._pad_y, - pad->_pad._pad_x, - pad->_pad._pad_top, - pad->_pad._pad_left, - pad->_pad._pad_bottom, - pad->_pad._pad_right); + pad->_pad._pad_x, + pad->_pad._pad_top, + pad->_pad._pad_left, + pad->_pad._pad_bottom, + pad->_pad._pad_right); returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_printw.c b/contrib/ncurses/ncurses/base/lib_printw.c index 8d28f28..f6b7036 100644 --- a/contrib/ncurses/ncurses/base/lib_printw.c +++ b/contrib/ncurses/ncurses/base/lib_printw.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,72 +39,79 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_printw.c,v 1.7 1998/04/11 22:53:44 tom Exp $") +MODULE_ID("$Id: lib_printw.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -int printw(NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +printw(NCURSES_CONST char *fmt,...) { - va_list argp; - int code; + va_list argp; + int code; - T(("printw(%s,...) called", _nc_visbuf(fmt))); + T(("printw(%s,...) called", _nc_visbuf(fmt))); - va_start(argp, fmt); - code = vwprintw(stdscr, fmt, argp); - va_end(argp); + va_start(argp, fmt); + code = vwprintw(stdscr, fmt, argp); + va_end(argp); - return code; + return code; } -int wprintw(WINDOW *win, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +wprintw(WINDOW *win, NCURSES_CONST char *fmt,...) { - va_list argp; - int code; + va_list argp; + int code; - T(("wprintw(%p,%s,...) called", win, _nc_visbuf(fmt))); + T(("wprintw(%p,%s,...) called", win, _nc_visbuf(fmt))); - va_start(argp, fmt); - code = vwprintw(win, fmt, argp); - va_end(argp); + va_start(argp, fmt); + code = vwprintw(win, fmt, argp); + va_end(argp); - return code; + return code; } -int mvprintw(int y, int x, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +mvprintw(int y, int x, NCURSES_CONST char *fmt,...) { - va_list argp; - int code = move(y, x); - - if (code != ERR) { - va_start(argp, fmt); - code = vwprintw(stdscr, fmt, argp); - va_end(argp); - } - return code; + va_list argp; + int code = move(y, x); + + if (code != ERR) { + va_start(argp, fmt); + code = vwprintw(stdscr, fmt, argp); + va_end(argp); + } + return code; } -int mvwprintw(WINDOW *win, int y, int x, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +mvwprintw +(WINDOW *win, int y, int x, NCURSES_CONST char *fmt,...) { - va_list argp; - int code = wmove(win, y, x); - - if (code != ERR) { - va_start(argp, fmt); - code = vwprintw(win, fmt, argp); - va_end(argp); - } - return code; + va_list argp; + int code = wmove(win, y, x); + + if (code != ERR) { + va_start(argp, fmt); + code = vwprintw(win, fmt, argp); + va_end(argp); + } + return code; } -int vwprintw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) +NCURSES_EXPORT(int) +vwprintw +(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) { - char *buf = _nc_printf_string(fmt, argp); - int code = ERR; + char *buf = _nc_printf_string(fmt, argp); + int code = ERR; - if (buf != 0) { - code = waddstr(win, buf); + if (buf != 0) { + code = waddstr(win, buf); #if USE_SAFE_SPRINTF - free(buf); + free(buf); #endif - } - return code; + } + return code; } diff --git a/contrib/ncurses/ncurses/base/lib_redrawln.c b/contrib/ncurses/ncurses/base/lib_redrawln.c index 10fda91..dd0a51e 100644 --- a/contrib/ncurses/ncurses/base/lib_redrawln.c +++ b/contrib/ncurses/ncurses/base/lib_redrawln.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,31 +39,31 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_redrawln.c,v 1.7 1998/09/19 20:09:50 Alexander.V.Lukyanov Exp $") +MODULE_ID("$Id: lib_redrawln.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -int wredrawln(WINDOW *win, int beg, int num) +NCURSES_EXPORT(int) +wredrawln(WINDOW *win, int beg, int num) { - int i; - int end; - size_t len = (win->_maxx + 1) * sizeof(chtype); + int i; + int end; + size_t len = (win->_maxx + 1) * sizeof(chtype); - T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num)); + T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num)); - if (beg < 0) - beg = 0; + if (beg < 0) + beg = 0; - if (touchline (win, beg, num) == ERR) - returnCode(ERR); + if (touchline(win, beg, num) == ERR) + returnCode(ERR); - end = beg + num; - if (end > win->_maxy + 1) - end = win->_maxy + 1; + end = beg + num; + if (end > win->_maxy + 1) + end = win->_maxy + 1; - for (i = beg; i < end; i++) - { - memset (curscr->_line[i+win->_begy].text+win->_begx, 0, len); - _nc_make_oldhash(i+win->_begy); - } + for (i = beg; i < end; i++) { + memset(curscr->_line[i + win->_begy].text + win->_begx, 0, len); + _nc_make_oldhash(i + win->_begy); + } - returnCode(OK); + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_refresh.c b/contrib/ncurses/ncurses/base/lib_refresh.c index 910664b..bd03ce7 100644 --- a/contrib/ncurses/ncurses/base/lib_refresh.c +++ b/contrib/ncurses/ncurses/base/lib_refresh.c @@ -40,9 +40,9 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_refresh.c,v 1.25 2000/04/29 21:17:08 tom Exp $") +MODULE_ID("$Id: lib_refresh.c,v 1.28 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) wrefresh(WINDOW *win) { int code; @@ -67,7 +67,7 @@ wrefresh(WINDOW *win) returnCode(code); } -int +NCURSES_EXPORT(int) wnoutrefresh(WINDOW *win) { NCURSES_SIZE_T limit_x; @@ -75,7 +75,9 @@ wnoutrefresh(WINDOW *win) NCURSES_SIZE_T begx; NCURSES_SIZE_T begy; NCURSES_SIZE_T m, n; +#if USE_SCROLL_HINTS bool wide; +#endif T((T_CALLED("wnoutrefresh(%p)"), win)); #ifdef TRACE @@ -100,6 +102,7 @@ wnoutrefresh(WINDOW *win) /* merge in change information from all subwindows of this window */ wsyncdown(win); +#if USE_SCROLL_HINTS /* * For pure efficiency, we'd want to transfer scrolling information * from the window to newscr whenever the window is wide enough that @@ -115,6 +118,7 @@ wnoutrefresh(WINDOW *win) * merely change the costs of various update cases. */ wide = (begx <= 1 && win->_maxx >= (newscr->_maxx - 1)); +#endif win->_flags &= ~_HASMOVED; @@ -132,8 +136,8 @@ wnoutrefresh(WINDOW *win) limit_x = win->_maxx; for (i = 0, m = begy + win->_yoffset; - i <= win->_maxy && m <= newscr->_maxy; - i++, m++) { + i <= win->_maxy && m <= newscr->_maxy; + i++, m++) { register struct ldat *nline = &newscr->_line[m]; register struct ldat *oline = &win->_line[i]; diff --git a/contrib/ncurses/ncurses/base/lib_restart.c b/contrib/ncurses/ncurses/base/lib_restart.c index 831e325..0068554 100644 --- a/contrib/ncurses/ncurses/base/lib_restart.c +++ b/contrib/ncurses/ncurses/base/lib_restart.c @@ -47,10 +47,11 @@ #include <term.h> /* lines, columns, cur_term */ -MODULE_ID("$Id: lib_restart.c,v 1.3 2000/09/02 18:09:44 tom Exp $") +MODULE_ID("$Id: lib_restart.c,v 1.4 2000/12/10 01:26:52 tom Exp $") -int -restartterm(NCURSES_CONST char *termp, int filenum, int *errret) +NCURSES_EXPORT(int) +restartterm +(NCURSES_CONST char *termp, int filenum, int *errret) { int saveecho = SP->_echo; int savecbreak = SP->_cbreak; diff --git a/contrib/ncurses/ncurses/base/lib_scanw.c b/contrib/ncurses/ncurses/base/lib_scanw.c index cc66613..3e1c9d0 100644 --- a/contrib/ncurses/ncurses/base/lib_scanw.c +++ b/contrib/ncurses/ncurses/base/lib_scanw.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** lib_scanw.c ** @@ -42,70 +40,75 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_scanw.c,v 1.8 1998/04/11 22:54:18 tom Exp $") +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, ...); +extern int vsscanf(const char *str, const char *format,...); #endif #endif -int vwscanw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) +NCURSES_EXPORT(int) +vwscanw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp) { -char buf[BUFSIZ]; + char buf[BUFSIZ]; - if (wgetnstr(win, buf, sizeof(buf)-1) == ERR) - return(ERR); + if (wgetnstr(win, buf, sizeof(buf) - 1) == ERR) + return (ERR); - return(vsscanf(buf, fmt, argp)); + return (vsscanf(buf, fmt, argp)); } -int scanw(NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +scanw(NCURSES_CONST char *fmt,...) { -int code; -va_list ap; + int code; + va_list ap; - T(("scanw(\"%s\",...) called", fmt)); + T(("scanw(\"%s\",...) called", fmt)); - va_start(ap, fmt); - code = vwscanw(stdscr, fmt, ap); - va_end(ap); - return (code); + va_start(ap, fmt); + code = vwscanw(stdscr, fmt, ap); + va_end(ap); + return (code); } -int wscanw(WINDOW *win, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +wscanw(WINDOW *win, NCURSES_CONST char *fmt,...) { -int code; -va_list ap; + int code; + va_list ap; - T(("wscanw(%p,\"%s\",...) called", win, fmt)); + T(("wscanw(%p,\"%s\",...) called", win, fmt)); - va_start(ap, fmt); - code = vwscanw(win, fmt, ap); - va_end(ap); - return (code); + va_start(ap, fmt); + code = vwscanw(win, fmt, ap); + va_end(ap); + return (code); } -int mvscanw(int y, int x, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +mvscanw(int y, int x, NCURSES_CONST char *fmt,...) { -int code; -va_list ap; + int code; + va_list ap; - va_start(ap, fmt); - code = (move(y, x) == OK) ? vwscanw(stdscr, fmt, ap) : ERR; - va_end(ap); - return (code); + va_start(ap, fmt); + code = (move(y, x) == OK) ? vwscanw(stdscr, fmt, ap) : ERR; + va_end(ap); + return (code); } -int mvwscanw(WINDOW *win, int y, int x, NCURSES_CONST char *fmt, ...) +NCURSES_EXPORT(int) +mvwscanw(WINDOW *win, int y, int x, NCURSES_CONST char *fmt,...) { -int code; -va_list ap; + int code; + va_list ap; - va_start(ap, fmt); - code = (wmove(win, y, x) == OK) ? vwscanw(win, fmt, ap) : ERR; - va_end(ap); - return (code); + va_start(ap, fmt); + code = (wmove(win, y, x) == OK) ? vwscanw(win, fmt, ap) : ERR; + va_end(ap); + return (code); } diff --git a/contrib/ncurses/ncurses/base/lib_screen.c b/contrib/ncurses/ncurses/base/lib_screen.c index 3038393..5e674b3 100644 --- a/contrib/ncurses/ncurses/base/lib_screen.c +++ b/contrib/ncurses/ncurses/base/lib_screen.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,166 +31,164 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - #include <curses.priv.h> #include <sys/stat.h> #include <time.h> -#include <term.h> /* exit_ca_mode, non_rev_rmcup */ +#include <term.h> /* exit_ca_mode, non_rev_rmcup */ -MODULE_ID("$Id: lib_screen.c,v 1.15 1999/07/24 20:05:29 tom Exp $") +MODULE_ID("$Id: lib_screen.c,v 1.17 2000/12/10 02:43:27 tom Exp $") -static time_t dumptime; +static time_t dumptime; -WINDOW *getwin(FILE *filep) +NCURSES_EXPORT(WINDOW *) +getwin(FILE * filep) { - WINDOW tmp, *nwin; - int n; - - T((T_CALLED("getwin(%p)"), filep)); - - (void) fread(&tmp, sizeof(WINDOW), 1, filep); - if (ferror(filep)) - returnWin(0); - - if ((nwin = newwin(tmp._maxy+1, tmp._maxx+1, 0, 0)) == 0) - returnWin(0); - - /* - * We deliberately do not restore the _parx, _pary, or _parent - * fields, because the window hierarchy within which they - * made sense is probably gone. - */ - nwin->_curx = tmp._curx; - nwin->_cury = tmp._cury; - nwin->_maxy = tmp._maxy; - nwin->_maxx = tmp._maxx; - nwin->_begy = tmp._begy; - nwin->_begx = tmp._begx; - nwin->_yoffset = tmp._yoffset; - nwin->_flags = tmp._flags & ~(_SUBWIN|_ISPAD); - - nwin->_attrs = tmp._attrs; - nwin->_bkgd = tmp._bkgd; - - nwin->_clear = tmp._clear; - nwin->_scroll = tmp._scroll; - nwin->_leaveok = tmp._leaveok; - nwin->_use_keypad = tmp._use_keypad; - nwin->_delay = tmp._delay; - nwin->_immed = tmp._immed; - nwin->_sync = tmp._sync; - - nwin->_regtop = tmp._regtop; - nwin->_regbottom = tmp._regbottom; - - for (n = 0; n < nwin->_maxy + 1; n++) - { - (void) fread(nwin->_line[n].text, - sizeof(chtype), (size_t)(nwin->_maxx + 1), filep); - if (ferror(filep)) - { - delwin(nwin); - returnWin(0); - } + WINDOW tmp, *nwin; + int n; + + T((T_CALLED("getwin(%p)"), filep)); + + (void) fread(&tmp, sizeof(WINDOW), 1, filep); + if (ferror(filep)) + returnWin(0); + + if ((nwin = newwin(tmp._maxy + 1, tmp._maxx + 1, 0, 0)) == 0) + returnWin(0); + + /* + * We deliberately do not restore the _parx, _pary, or _parent + * fields, because the window hierarchy within which they + * made sense is probably gone. + */ + nwin->_curx = tmp._curx; + nwin->_cury = tmp._cury; + nwin->_maxy = tmp._maxy; + nwin->_maxx = tmp._maxx; + nwin->_begy = tmp._begy; + nwin->_begx = tmp._begx; + nwin->_yoffset = tmp._yoffset; + nwin->_flags = tmp._flags & ~(_SUBWIN | _ISPAD); + + nwin->_attrs = tmp._attrs; + nwin->_bkgd = tmp._bkgd; + + nwin->_clear = tmp._clear; + nwin->_scroll = tmp._scroll; + nwin->_leaveok = tmp._leaveok; + nwin->_use_keypad = tmp._use_keypad; + nwin->_delay = tmp._delay; + nwin->_immed = tmp._immed; + nwin->_sync = tmp._sync; + + nwin->_regtop = tmp._regtop; + nwin->_regbottom = tmp._regbottom; + + for (n = 0; n < nwin->_maxy + 1; n++) { + (void) fread(nwin->_line[n].text, + sizeof(chtype), (size_t) (nwin->_maxx + 1), filep); + if (ferror(filep)) { + delwin(nwin); + returnWin(0); } - touchwin(nwin); + } + touchwin(nwin); - returnWin(nwin); + returnWin(nwin); } -int putwin(WINDOW *win, FILE *filep) +NCURSES_EXPORT(int) +putwin(WINDOW *win, FILE * filep) { - int code = ERR; - int n; + int code = ERR; + int n; - T((T_CALLED("putwin(%p,%p)"), win, filep)); + T((T_CALLED("putwin(%p,%p)"), win, filep)); - if (win) { - (void) fwrite(win, sizeof(WINDOW), 1, filep); - if (ferror(filep)) + if (win) { + (void) fwrite(win, sizeof(WINDOW), 1, filep); + if (ferror(filep)) returnCode(code); - for (n = 0; n < win->_maxy + 1; n++) - { - (void) fwrite(win->_line[n].text, - sizeof(chtype), (size_t)(win->_maxx + 1), filep); - if (ferror(filep)) + for (n = 0; n < win->_maxy + 1; n++) { + (void) fwrite(win->_line[n].text, + sizeof(chtype), (size_t) (win->_maxx + 1), filep); + if (ferror(filep)) returnCode(code); - } - code = OK; } - returnCode(code); + code = OK; + } + returnCode(code); } -int scr_restore(const char *file) +NCURSES_EXPORT(int) +scr_restore(const char *file) { - FILE *fp = 0; - - T((T_CALLED("scr_restore(%s)"), _nc_visbuf(file))); - - if (_nc_access(file, R_OK) < 0 - || (fp = fopen(file, "rb")) == 0) - returnCode(ERR); - else - { - delwin(newscr); - newscr = getwin(fp); - (void) fclose(fp); - returnCode(OK); - } + FILE *fp = 0; + + T((T_CALLED("scr_restore(%s)"), _nc_visbuf(file))); + + if (_nc_access(file, R_OK) < 0 + || (fp = fopen(file, "rb")) == 0) + returnCode(ERR); + else { + delwin(newscr); + newscr = getwin(fp); + (void) fclose(fp); + returnCode(OK); + } } -int scr_dump(const char *file) +NCURSES_EXPORT(int) +scr_dump(const char *file) { - FILE *fp = 0; - - T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file))); - - if (_nc_access(file, W_OK) < 0 - || (fp = fopen(file, "wb")) == 0) - returnCode(ERR); - else - { - (void) putwin(newscr, fp); - (void) fclose(fp); - dumptime = time((time_t *)0); - returnCode(OK); - } + FILE *fp = 0; + + T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file))); + + if (_nc_access(file, W_OK) < 0 + || (fp = fopen(file, "wb")) == 0) + returnCode(ERR); + else { + (void) putwin(newscr, fp); + (void) fclose(fp); + dumptime = time((time_t *) 0); + returnCode(OK); + } } -int scr_init(const char *file) +NCURSES_EXPORT(int) +scr_init(const char *file) { - FILE *fp = 0; - struct stat stb; - - T((T_CALLED("scr_init(%s)"), _nc_visbuf(file))); - - if (exit_ca_mode && non_rev_rmcup) - returnCode(ERR); - - if (_nc_access(file, R_OK) < 0 - || (fp = fopen(file, "rb")) == 0) - returnCode(ERR); - else if (fstat(STDOUT_FILENO, &stb) || stb.st_mtime > dumptime) - returnCode(ERR); - else - { - delwin(curscr); - curscr = getwin(fp); - (void) fclose(fp); - returnCode(OK); - } + FILE *fp = 0; + struct stat stb; + + T((T_CALLED("scr_init(%s)"), _nc_visbuf(file))); + + if (exit_ca_mode && non_rev_rmcup) + returnCode(ERR); + + if (_nc_access(file, R_OK) < 0 + || (fp = fopen(file, "rb")) == 0) + returnCode(ERR); + else if (fstat(STDOUT_FILENO, &stb) || stb.st_mtime > dumptime) + returnCode(ERR); + else { + delwin(curscr); + curscr = getwin(fp); + (void) fclose(fp); + returnCode(OK); + } } -int scr_set(const char *file) +NCURSES_EXPORT(int) +scr_set(const char *file) { T((T_CALLED("scr_set(%s)"), _nc_visbuf(file))); if (scr_init(file) == ERR) returnCode(ERR); - else - { + else { delwin(newscr); newscr = dupwin(curscr); returnCode(OK); diff --git a/contrib/ncurses/ncurses/base/lib_scroll.c b/contrib/ncurses/ncurses/base/lib_scroll.c index c2e3831..dcde0fc 100644 --- a/contrib/ncurses/ncurses/base/lib_scroll.c +++ b/contrib/ncurses/ncurses/base/lib_scroll.c @@ -42,11 +42,12 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_scroll.c,v 1.17 2000/04/29 21:10:51 tom Exp $") +MODULE_ID("$Id: lib_scroll.c,v 1.20 2000/12/10 02:54:03 tom Exp $") -void -_nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, - NCURSES_SIZE_T const bottom, chtype blank) +NCURSES_EXPORT(void) +_nc_scroll_window +(WINDOW *win, int const n, NCURSES_SIZE_T const top, + NCURSES_SIZE_T const bottom, chtype blank) { int line, j; size_t to_copy = (size_t) (sizeof(chtype) * (win->_maxx + 1)); @@ -68,10 +69,11 @@ _nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, 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); + win->_line[line + n].text, + to_copy); + if_USE_SCROLL_HINTS( + win->_line[line].oldindex = + win->_line[line + n].oldindex); } for (line = top; line < top - n; line++) { for (j = 0; j <= win->_maxx; j++) @@ -84,10 +86,10 @@ _nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, 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); + win->_line[line + n].text, + to_copy); + if_USE_SCROLL_HINTS(win->_line[line].oldindex = + win->_line[line + n].oldindex); } for (line = bottom; line > bottom - n; line--) { for (j = 0; j <= win->_maxx; j++) @@ -98,7 +100,7 @@ _nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, touchline(win, top, bottom - top + 1); } -int +NCURSES_EXPORT(int) wscrl(WINDOW *win, int n) { T((T_CALLED("wscrl(%p,%d)"), win, n)); diff --git a/contrib/ncurses/ncurses/base/lib_scrollok.c b/contrib/ncurses/ncurses/base/lib_scrollok.c index f24eb8e..f6b3025 100644 --- a/contrib/ncurses/ncurses/base/lib_scrollok.c +++ b/contrib/ncurses/ncurses/base/lib_scrollok.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_scrollok.c ** @@ -41,16 +40,16 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_scrollok.c,v 1.2 1998/02/11 12:14:01 tom Exp $") +MODULE_ID("$Id: lib_scrollok.c,v 1.4 2000/12/10 02:43:27 tom Exp $") -int scrollok(WINDOW *win, bool flag) +NCURSES_EXPORT(int) +scrollok(WINDOW *win, bool flag) { - T((T_CALLED("scrollok(%p,%d)"), win, flag)); + T((T_CALLED("scrollok(%p,%d)"), win, flag)); - if (win) { - win->_scroll = flag; - returnCode(OK); - } - else - returnCode(ERR); + if (win) { + win->_scroll = flag; + returnCode(OK); + } else + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/base/lib_scrreg.c b/contrib/ncurses/ncurses/base/lib_scrreg.c index b47c047..c85d60f 100644 --- a/contrib/ncurses/ncurses/base/lib_scrreg.c +++ b/contrib/ncurses/ncurses/base/lib_scrreg.c @@ -40,9 +40,9 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_scrreg.c,v 1.8 2000/04/29 21:13:04 tom Exp $") +MODULE_ID("$Id: lib_scrreg.c,v 1.10 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) wsetscrreg(WINDOW *win, int top, int bottom) { T((T_CALLED("wsetscrreg(%p,%d,%d)"), win, top, bottom)); diff --git a/contrib/ncurses/ncurses/base/lib_set_term.c b/contrib/ncurses/ncurses/base/lib_set_term.c index 15dd6d3..e2afbec 100644 --- a/contrib/ncurses/ncurses/base/lib_set_term.c +++ b/contrib/ncurses/ncurses/base/lib_set_term.c @@ -43,9 +43,9 @@ #include <term.h> /* cur_term */ #include <tic.h> -MODULE_ID("$Id: lib_set_term.c,v 1.58 2000/10/04 22:05:48 tom Exp $") +MODULE_ID("$Id: lib_set_term.c,v 1.61 2000/12/10 02:43:27 tom Exp $") -SCREEN * +NCURSES_EXPORT(SCREEN *) set_term(SCREEN * screenp) { SCREEN *oldSP; @@ -80,7 +80,7 @@ _nc_free_keytry(struct tries *kt) /* * Free the storage associated with the given SCREEN sp. */ -void +NCURSES_EXPORT(void) delscreen(SCREEN * sp) { SCREEN **scan = &_nc_screen_chain; @@ -95,9 +95,9 @@ delscreen(SCREEN * sp) scan = &(*scan)->_next_screen; } - _nc_freewin(sp->_curscr); - _nc_freewin(sp->_newscr); - _nc_freewin(sp->_stdscr); + (void) _nc_freewin(sp->_curscr); + (void) _nc_freewin(sp->_newscr); + (void) _nc_freewin(sp->_stdscr); _nc_free_keytry(sp->_keytry); _nc_free_keytry(sp->_key_ok); @@ -191,8 +191,9 @@ extract_fgbg(char *src, int *result) } #endif -int -_nc_setupscreen(short slines, short const scolumns, FILE * output) +NCURSES_EXPORT(int) +_nc_setupscreen +(short slines, short const scolumns, FILE * output) /* OS-independent screen initializations */ { int bottom_stolen = 0; @@ -224,7 +225,7 @@ _nc_setupscreen(short slines, short const scolumns, FILE * output) #if NCURSES_NO_PADDING SP->_no_padding = getenv("NCURSES_NO_PADDING") != 0; TR(TRACE_CHARPUT | TRACE_MOVE, ("padding will%s be used", - SP->_no_padding ? " not" : "")); + SP->_no_padding ? " not" : "")); #endif #if NCURSES_EXT_FUNCS @@ -295,12 +296,12 @@ _nc_setupscreen(short slines, short const scolumns, FILE * output) if (magic_cookie_glitch > 0) { SP->_xmc_triggers = termattrs() & ( - A_ALTCHARSET | - A_BLINK | - A_BOLD | - A_REVERSE | - A_STANDOUT | - A_UNDERLINE + A_ALTCHARSET | + A_BLINK | + A_BOLD | + A_REVERSE | + A_STANDOUT | + A_UNDERLINE ); SP->_xmc_suppress = SP->_xmc_triggers & (chtype) ~ (A_BOLD); @@ -390,7 +391,7 @@ _nc_setupscreen(short slines, short const scolumns, FILE * output) /* The internal implementation interprets line as the number of lines to rip off from the top or bottom. */ -int +NCURSES_EXPORT(int) _nc_ripoffline(int line, int (*init) (WINDOW *, int)) { if (line == 0) @@ -407,7 +408,7 @@ _nc_ripoffline(int line, int (*init) (WINDOW *, int)) return (OK); } -int +NCURSES_EXPORT(int) ripoffline(int line, int (*init) (WINDOW *, int)) { T((T_CALLED("ripoffline(%d,%p)"), line, init)); diff --git a/contrib/ncurses/ncurses/base/lib_slk.c b/contrib/ncurses/ncurses/base/lib_slk.c index 21eae68..0204493 100644 --- a/contrib/ncurses/ncurses/base/lib_slk.c +++ b/contrib/ncurses/ncurses/base/lib_slk.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free 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,43 +39,41 @@ #include <curses.priv.h> #include <ctype.h> -#include <term.h> /* num_labels, label_*, plab_norm */ +#include <term.h> /* num_labels, label_*, plab_norm */ -MODULE_ID("$Id: lib_slk.c,v 1.17 1999/10/30 23:00:16 tom Exp $") +MODULE_ID("$Id: lib_slk.c,v 1.20 2000/12/10 02:43:27 tom Exp $") /* * We'd like to move these into the screen context structure, but cannot, * because slk_init() is called before initscr()/newterm(). */ -int _nc_slk_format = 0; /* one more than format specified in slk_init() */ +NCURSES_EXPORT_VAR(int) +_nc_slk_format = 0; /* one more than format specified in slk_init() */ /* * Paint the info line for the PC style SLK emulation. * */ -static void -slk_paint_info(WINDOW *win) + static void + slk_paint_info(WINDOW *win) { - if (win && SP->slk_format==4) - { - int i; - - mvwhline (win,0,0,0,getmaxx(win)); - wmove (win,0,0); - - for (i = 0; i < SP->_slk->maxlab; i++) { - if (win && SP->slk_format==4) - { - mvwaddch(win,0,SP->_slk->ent[i].x,'F'); - if (i<9) - waddch(win,'1'+i); - else - { - waddch(win,'1'); - waddch(win,'0' + (i-9)); - } - } - } + if (win && SP->slk_format == 4) { + int i; + + mvwhline(win, 0, 0, 0, getmaxx(win)); + wmove(win, 0, 0); + + for (i = 0; i < SP->_slk->maxlab; i++) { + if (win && SP->slk_format == 4) { + mvwaddch(win, 0, SP->_slk->ent[i].x, (chtype) 'F'); + if (i < 9) + waddch(win, (chtype) '1' + i); + else { + waddch(win, (chtype) '1'); + waddch(win, (chtype) '0' + (i - 9)); + } + } + } } } @@ -83,132 +81,122 @@ slk_paint_info(WINDOW *win) * Initialize soft labels. * Called from newterm() */ -int +NCURSES_EXPORT(int) _nc_slk_initialize(WINDOW *stwin, int cols) { -int i, x; -int res = OK; -char *p; - - T(("slk_initialize()")); - - if (SP->_slk) - { /* we did this already, so simply return */ - return(OK); - } - else - if ((SP->_slk = typeCalloc(SLK, 1)) == 0) - return(ERR); - - SP->_slk->ent = NULL; - SP->_slk->buffer = NULL; - SP->_slk->attr = A_STANDOUT; - - SP->_slk->maxlab = (num_labels > 0) ? - num_labels : MAX_SKEY(_nc_slk_format); - SP->_slk->maxlen = (num_labels > 0) ? - label_width * label_height : MAX_SKEY_LEN(_nc_slk_format); - SP->_slk->labcnt = (SP->_slk->maxlab < MAX_SKEY(_nc_slk_format)) ? - MAX_SKEY(_nc_slk_format) : SP->_slk->maxlab; - - SP->_slk->ent = typeCalloc(slk_ent, SP->_slk->labcnt); - if (SP->_slk->ent == NULL) - goto exception; - - p = SP->_slk->buffer = (char*) calloc(2*SP->_slk->labcnt,(1+SP->_slk->maxlen)); - if (SP->_slk->buffer == NULL) - goto exception; - - for (i = 0; i < SP->_slk->labcnt; i++) { - SP->_slk->ent[i].text = p; - p += (1 + SP->_slk->maxlen); - SP->_slk->ent[i].form_text = p; - p += (1 + SP->_slk->maxlen); - memset(SP->_slk->ent[i].form_text, ' ', (unsigned)(SP->_slk->maxlen)); - SP->_slk->ent[i].visible = (i < SP->_slk->maxlab); - } - if (_nc_slk_format >= 3) /* PC style */ - { - int gap = (cols - 3 * (3 + 4*SP->_slk->maxlen))/2; + int i, x; + int res = OK; + char *p; + + T(("slk_initialize()")); + + if (SP->_slk) { /* we did this already, so simply return */ + return (OK); + } else if ((SP->_slk = typeCalloc(SLK, 1)) == 0) + return (ERR); + + SP->_slk->ent = NULL; + SP->_slk->buffer = NULL; + SP->_slk->attr = A_STANDOUT; + + SP->_slk->maxlab = (num_labels > 0) ? + num_labels : MAX_SKEY(_nc_slk_format); + SP->_slk->maxlen = (num_labels > 0) ? + label_width * label_height : MAX_SKEY_LEN(_nc_slk_format); + SP->_slk->labcnt = (SP->_slk->maxlab < MAX_SKEY(_nc_slk_format)) ? + MAX_SKEY(_nc_slk_format) : SP->_slk->maxlab; + + SP->_slk->ent = typeCalloc(slk_ent, SP->_slk->labcnt); + if (SP->_slk->ent == NULL) + goto exception; + + p = SP->_slk->buffer = (char *) calloc(2 * SP->_slk->labcnt, (1 + SP->_slk->maxlen)); + if (SP->_slk->buffer == NULL) + goto exception; + + for (i = 0; i < SP->_slk->labcnt; i++) { + SP->_slk->ent[i].text = p; + p += (1 + SP->_slk->maxlen); + SP->_slk->ent[i].form_text = p; + p += (1 + SP->_slk->maxlen); + memset(SP->_slk->ent[i].form_text, ' ', (unsigned) (SP->_slk->maxlen)); + SP->_slk->ent[i].visible = (i < SP->_slk->maxlab); + } + if (_nc_slk_format >= 3) { /* PC style */ + int gap = (cols - 3 * (3 + 4 * SP->_slk->maxlen)) / 2; - if (gap < 1) - gap = 1; + if (gap < 1) + gap = 1; - for (i = x = 0; i < SP->_slk->maxlab; i++) { - SP->_slk->ent[i].x = x; - x += SP->_slk->maxlen; - x += (i==3 || i==7) ? gap : 1; - } - if (_nc_slk_format == 4) - slk_paint_info (stwin); - } - else { - if (_nc_slk_format == 2) { /* 4-4 */ + for (i = x = 0; i < SP->_slk->maxlab; i++) { + SP->_slk->ent[i].x = x; + x += SP->_slk->maxlen; + x += (i == 3 || i == 7) ? gap : 1; + } + if (_nc_slk_format == 4) + slk_paint_info(stwin); + } else { + if (_nc_slk_format == 2) { /* 4-4 */ int gap = cols - (SP->_slk->maxlab * SP->_slk->maxlen) - 6; if (gap < 1) - gap = 1; + gap = 1; for (i = x = 0; i < SP->_slk->maxlab; i++) { - SP->_slk->ent[i].x = x; - x += SP->_slk->maxlen; - x += (i == 3) ? gap : 1; + SP->_slk->ent[i].x = x; + x += SP->_slk->maxlen; + x += (i == 3) ? gap : 1; } - } - else - { - if (_nc_slk_format == 1) { /* 1 -> 3-2-3 */ - int gap = (cols - (SP->_slk->maxlab * SP->_slk->maxlen) - 5) / 2; + } else { + if (_nc_slk_format == 1) { /* 1 -> 3-2-3 */ + int gap = (cols - (SP->_slk->maxlab * SP->_slk->maxlen) - 5) + / 2; if (gap < 1) - gap = 1; + gap = 1; for (i = x = 0; i < SP->_slk->maxlab; i++) { - SP->_slk->ent[i].x = x; - x += SP->_slk->maxlen; - x += (i == 2 || i == 4) ? gap : 1; + SP->_slk->ent[i].x = x; + x += SP->_slk->maxlen; + x += (i == 2 || i == 4) ? gap : 1; } - } - else + } else goto exception; - } } - SP->_slk->dirty = TRUE; - if ((SP->_slk->win = stwin) == NULL) - { - exception: - if (SP->_slk) - { - FreeIfNeeded(SP->_slk->buffer); - FreeIfNeeded(SP->_slk->ent); - free(SP->_slk); - SP->_slk = (SLK*)0; - res = (ERR); - } + } + SP->_slk->dirty = TRUE; + if ((SP->_slk->win = stwin) == NULL) { + exception: + if (SP->_slk) { + FreeIfNeeded(SP->_slk->buffer); + FreeIfNeeded(SP->_slk->ent); + free(SP->_slk); + SP->_slk = (SLK *) 0; + res = (ERR); } + } - /* We now reset the format so that the next newterm has again - * per default no SLK keys and may call slk_init again to - * define a new layout. (juergen 03-Mar-1999) - */ - SP->slk_format = _nc_slk_format; - _nc_slk_format = 0; - return(res); + /* We now reset the format so that the next newterm has again + * per default no SLK keys and may call slk_init again to + * define a new layout. (juergen 03-Mar-1999) + */ + SP->slk_format = _nc_slk_format; + _nc_slk_format = 0; + return (res); } - /* * Restore the soft labels on the screen. */ -int +NCURSES_EXPORT(int) slk_restore(void) { - T((T_CALLED("slk_restore()"))); + T((T_CALLED("slk_restore()"))); - if (SP->_slk == NULL) - return(ERR); - SP->_slk->hidden = FALSE; - SP->_slk->dirty = TRUE; - /* we have to repaint info line eventually */ - slk_paint_info(SP->_slk->win); + if (SP->_slk == NULL) + return (ERR); + SP->_slk->hidden = FALSE; + SP->_slk->dirty = TRUE; + /* we have to repaint info line eventually */ + slk_paint_info(SP->_slk->win); - returnCode(slk_refresh()); + returnCode(slk_refresh()); } diff --git a/contrib/ncurses/ncurses/base/lib_slkatr_set.c b/contrib/ncurses/ncurses/base/lib_slkatr_set.c index 0695d18..5df314c 100644 --- a/contrib/ncurses/ncurses/base/lib_slkatr_set.c +++ b/contrib/ncurses/ncurses/base/lib_slkatr_set.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,20 +37,19 @@ */ #include <curses.priv.h> -MODULE_ID("$Id: lib_slkatr_set.c,v 1.3 1999/05/16 17:13:59 juergen Exp $") +MODULE_ID("$Id: lib_slkatr_set.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int -slk_attr_set(const attr_t attr, short color_pair_number, void* opts) +NCURSES_EXPORT(int) +slk_attr_set +(const attr_t attr, short color_pair_number, void *opts) { - T((T_CALLED("slk_attr_set(%s,%d)"), _traceattr(attr), color_pair_number)); + T((T_CALLED("slk_attr_set(%s,%d)"), _traceattr(attr), color_pair_number)); - if (SP!=0 && SP->_slk!=0 && !opts && - color_pair_number>=0 && color_pair_number<COLOR_PAIRS) - { - SP->_slk->attr = attr; - toggle_attr_on(SP->_slk->attr,COLOR_PAIR(color_pair_number)); - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0 && !opts && + color_pair_number >= 0 && color_pair_number < COLOR_PAIRS) { + SP->_slk->attr = attr; + toggle_attr_on(SP->_slk->attr, COLOR_PAIR(color_pair_number)); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/base/lib_slkatrof.c b/contrib/ncurses/ncurses/base/lib_slkatrof.c index 5e4f5f5..c271c34 100644 --- a/contrib/ncurses/ncurses/base/lib_slkatrof.c +++ b/contrib/ncurses/ncurses/base/lib_slkatrof.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,18 +38,16 @@ */ #include <curses.priv.h> -MODULE_ID("$Id: lib_slkatrof.c,v 1.4 1998/03/11 19:26:07 juergen Exp $") +MODULE_ID("$Id: lib_slkatrof.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_attroff(const chtype attr) { - T((T_CALLED("slk_attroff(%s)"), _traceattr(attr))); + T((T_CALLED("slk_attroff(%s)"), _traceattr(attr))); - if (SP!=0 && SP->_slk!=0) - { - toggle_attr_off(SP->_slk->attr,attr); - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0) { + toggle_attr_off(SP->_slk->attr, attr); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/base/lib_slkatron.c b/contrib/ncurses/ncurses/base/lib_slkatron.c index a248865..d174b03 100644 --- a/contrib/ncurses/ncurses/base/lib_slkatron.c +++ b/contrib/ncurses/ncurses/base/lib_slkatron.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,18 +38,16 @@ */ #include <curses.priv.h> -MODULE_ID("$Id: lib_slkatron.c,v 1.4 1998/03/11 19:26:07 juergen Exp $") +MODULE_ID("$Id: lib_slkatron.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_attron(const chtype attr) { - T((T_CALLED("slk_attron(%s)"), _traceattr(attr))); + T((T_CALLED("slk_attron(%s)"), _traceattr(attr))); - if (SP!=0 && SP->_slk!=0) - { - toggle_attr_on(SP->_slk->attr,attr); - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0) { + toggle_attr_on(SP->_slk->attr, attr); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/base/lib_slkatrset.c b/contrib/ncurses/ncurses/base/lib_slkatrset.c index 391c7ff..cda74ca 100644 --- a/contrib/ncurses/ncurses/base/lib_slkatrset.c +++ b/contrib/ncurses/ncurses/base/lib_slkatrset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,18 +38,16 @@ */ #include <curses.priv.h> -MODULE_ID("$Id: lib_slkatrset.c,v 1.4 1998/03/11 19:26:01 juergen Exp $") +MODULE_ID("$Id: lib_slkatrset.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_attrset(const chtype attr) { - T((T_CALLED("slk_attrset(%s)"), _traceattr(attr))); + T((T_CALLED("slk_attrset(%s)"), _traceattr(attr))); - if (SP!=0 && SP->_slk!=0) - { - SP->_slk->attr = attr; - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0) { + SP->_slk->attr = attr; + returnCode(OK); + } else + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/base/lib_slkattr.c b/contrib/ncurses/ncurses/base/lib_slkattr.c index a132403..5044a08 100644 --- a/contrib/ncurses/ncurses/base/lib_slkattr.c +++ b/contrib/ncurses/ncurses/base/lib_slkattr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,17 +38,15 @@ */ #include <curses.priv.h> -MODULE_ID("$Id: lib_slkattr.c,v 1.3 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$Id: lib_slkattr.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -attr_t +NCURSES_EXPORT(attr_t) slk_attr(void) { - T((T_CALLED("slk_attr()"))); + T((T_CALLED("slk_attr()"))); - if (SP!=0 && SP->_slk!=0) - { - returnAttr(SP->_slk->attr); - } - else - returnAttr(0); + if (SP != 0 && SP->_slk != 0) { + returnAttr(SP->_slk->attr); + } else + returnAttr(0); } diff --git a/contrib/ncurses/ncurses/base/lib_slkclear.c b/contrib/ncurses/ncurses/base/lib_slkclear.c index ac6e414..47e5245 100644 --- a/contrib/ncurses/ncurses/base/lib_slkclear.c +++ b/contrib/ncurses/ncurses/base/lib_slkclear.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,25 +38,24 @@ */ #include <curses.priv.h> -MODULE_ID("$Id: lib_slkclear.c,v 1.4 1999/03/03 23:44:22 juergen Exp $") +MODULE_ID("$Id: lib_slkclear.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_clear(void) { - T((T_CALLED("slk_clear()"))); + T((T_CALLED("slk_clear()"))); - if (SP == NULL || SP->_slk == NULL) - returnCode(ERR); - 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->_attrs = stdscr->_attrs; - if (SP->_slk->win == stdscr) { - returnCode(OK); - } - else { - werase(SP->_slk->win); - returnCode(wrefresh(SP->_slk->win)); - } + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + 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->_attrs = stdscr->_attrs; + if (SP->_slk->win == stdscr) { + returnCode(OK); + } else { + werase(SP->_slk->win); + returnCode(wrefresh(SP->_slk->win)); + } } diff --git a/contrib/ncurses/ncurses/base/lib_slkcolor.c b/contrib/ncurses/ncurses/base/lib_slkcolor.c index 3728808..3e878e0 100644 --- a/contrib/ncurses/ncurses/base/lib_slkcolor.c +++ b/contrib/ncurses/ncurses/base/lib_slkcolor.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,20 +35,18 @@ */ #include <curses.priv.h> -MODULE_ID("$Id: lib_slkcolor.c,v 1.5 1999/05/16 17:14:13 juergen Exp $") +MODULE_ID("$Id: lib_slkcolor.c,v 1.7 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_color(short color_pair_number) { - T((T_CALLED("slk_color(%d)"), color_pair_number)); + T((T_CALLED("slk_color(%d)"), color_pair_number)); - if (SP!=0 && SP->_slk!=0 && - color_pair_number>=0 && color_pair_number<COLOR_PAIRS) - { - T(("... current %ld", (long) PAIR_NUMBER(SP->_slk->attr))); - toggle_attr_on(SP->_slk->attr,COLOR_PAIR(color_pair_number)); - returnCode(OK); - } - else - returnCode(ERR); + if (SP != 0 && SP->_slk != 0 && + color_pair_number >= 0 && color_pair_number < COLOR_PAIRS) { + T(("... current %ld", (long) PAIR_NUMBER(SP->_slk->attr))); + toggle_attr_on(SP->_slk->attr, COLOR_PAIR(color_pair_number)); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/base/lib_slkinit.c b/contrib/ncurses/ncurses/base/lib_slkinit.c index 7084426..f003b5f 100644 --- a/contrib/ncurses/ncurses/base/lib_slkinit.c +++ b/contrib/ncurses/ncurses/base/lib_slkinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -38,14 +38,14 @@ */ #include <curses.priv.h> -MODULE_ID("$Id: lib_slkinit.c,v 1.3 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$Id: lib_slkinit.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_init(int format) { - T((T_CALLED("slk_init(%d)"), format)); - if (format < 0 || format > 3) - returnCode(ERR); - _nc_slk_format = 1 + format; - returnCode(OK); + T((T_CALLED("slk_init(%d)"), format)); + if (format < 0 || format > 3) + returnCode(ERR); + _nc_slk_format = 1 + format; + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_slklab.c b/contrib/ncurses/ncurses/base/lib_slklab.c index 03039ad..0224e9b 100644 --- a/contrib/ncurses/ncurses/base/lib_slklab.c +++ b/contrib/ncurses/ncurses/base/lib_slklab.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -38,14 +38,14 @@ */ #include <curses.priv.h> -MODULE_ID("$Id: lib_slklab.c,v 1.4 1998/02/11 12:13:54 tom Exp $") +MODULE_ID("$Id: lib_slklab.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -char* +NCURSES_EXPORT(char *) slk_label(int n) { - T((T_CALLED("slk_label(%d)"), n)); + T((T_CALLED("slk_label(%d)"), n)); - if (SP == NULL || SP->_slk == NULL || n < 1 || n > SP->_slk->labcnt) - returnPtr(0); - returnPtr(SP->_slk->ent[n-1].text); + if (SP == NULL || SP->_slk == NULL || n < 1 || n > SP->_slk->labcnt) + returnPtr(0); + returnPtr(SP->_slk->ent[n - 1].text); } diff --git a/contrib/ncurses/ncurses/base/lib_slkrefr.c b/contrib/ncurses/ncurses/base/lib_slkrefr.c index ee3c91d..18e5b0c 100644 --- a/contrib/ncurses/ncurses/base/lib_slkrefr.c +++ b/contrib/ncurses/ncurses/base/lib_slkrefr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,91 +36,85 @@ * Write SLK window to the (virtual) screen. */ #include <curses.priv.h> -#include <term.h> /* num_labels, label_*, plab_norm */ +#include <term.h> /* num_labels, label_*, plab_norm */ -MODULE_ID("$Id: lib_slkrefr.c,v 1.8 1999/03/14 00:10:27 Alexander.V.Lukyanov Exp $") +MODULE_ID("$Id: lib_slkrefr.c,v 1.10 2000/12/10 02:43:27 tom Exp $") /* * Write the soft labels to the soft-key window. */ static void -slk_intern_refresh(SLK *slk) +slk_intern_refresh(SLK * slk) { -int i; -int fmt = SP->slk_format; + int i; + int fmt = SP->slk_format; - for (i = 0; i < slk->labcnt; i++) { - if (slk->dirty || slk->ent[i].dirty) { - if (slk->ent[i].visible) { - if (num_labels > 0 && SLK_STDFMT(fmt)) - { - if (i < num_labels) { - TPUTS_TRACE("plab_norm"); - putp(tparm(plab_norm, i+1, slk->ent[i].form_text)); - } - } - else - { - wmove(slk->win,SLK_LINES(fmt)-1,slk->ent[i].x); - if (SP && SP->_slk) - wattrset(slk->win,SP->_slk->attr); - waddnstr(slk->win,slk->ent[i].form_text, - MAX_SKEY_LEN(fmt)); - /* if we simulate SLK's, it's looking much more - natural to use the current ATTRIBUTE also - for the label window */ - wattrset(slk->win,stdscr->_attrs); - } - } - slk->ent[i].dirty = FALSE; + for (i = 0; i < slk->labcnt; i++) { + if (slk->dirty || slk->ent[i].dirty) { + if (slk->ent[i].visible) { + if (num_labels > 0 && SLK_STDFMT(fmt)) { + if (i < num_labels) { + TPUTS_TRACE("plab_norm"); + putp(tparm(plab_norm, i + 1, slk->ent[i].form_text)); + } + } else { + wmove(slk->win, SLK_LINES(fmt) - 1, slk->ent[i].x); + if (SP && SP->_slk) + wattrset(slk->win, SP->_slk->attr); + waddnstr(slk->win, slk->ent[i].form_text, + MAX_SKEY_LEN(fmt)); + /* if we simulate SLK's, it's looking much more + natural to use the current ATTRIBUTE also + for the label window */ + wattrset(slk->win, stdscr->_attrs); } + } + slk->ent[i].dirty = FALSE; } - slk->dirty = FALSE; + } + slk->dirty = FALSE; - if (num_labels > 0) { - if (slk->hidden) - { - TPUTS_TRACE("label_off"); - putp(label_off); - } - else - { - TPUTS_TRACE("label_on"); - putp(label_on); - } + if (num_labels > 0) { + if (slk->hidden) { + TPUTS_TRACE("label_off"); + putp(label_off); + } else { + TPUTS_TRACE("label_on"); + putp(label_on); } + } } /* * Refresh the soft labels. */ -int +NCURSES_EXPORT(int) slk_noutrefresh(void) { - T((T_CALLED("slk_noutrefresh()"))); + T((T_CALLED("slk_noutrefresh()"))); - if (SP == NULL || SP->_slk == NULL) - returnCode(ERR); - if (SP->_slk->hidden) - returnCode(OK); - slk_intern_refresh(SP->_slk); + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + if (SP->_slk->hidden) + returnCode(OK); + slk_intern_refresh(SP->_slk); - returnCode(wnoutrefresh(SP->_slk->win)); + returnCode(wnoutrefresh(SP->_slk->win)); } /* * Refresh the soft labels. */ -int +NCURSES_EXPORT(int) slk_refresh(void) { - T((T_CALLED("slk_refresh()"))); + T((T_CALLED("slk_refresh()"))); - if (SP == NULL || SP->_slk == NULL) - returnCode(ERR); - if (SP->_slk->hidden) - returnCode(OK); - slk_intern_refresh(SP->_slk); + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + if (SP->_slk->hidden) + returnCode(OK); + slk_intern_refresh(SP->_slk); - returnCode(wrefresh(SP->_slk->win)); + returnCode(wrefresh(SP->_slk->win)); } diff --git a/contrib/ncurses/ncurses/base/lib_slkset.c b/contrib/ncurses/ncurses/base/lib_slkset.c index 27471ad..c3fb1a1 100644 --- a/contrib/ncurses/ncurses/base/lib_slkset.c +++ b/contrib/ncurses/ncurses/base/lib_slkset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,58 +38,60 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$Id: lib_slkset.c,v 1.3 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$Id: lib_slkset.c,v 1.6 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_set(int i, const char *astr, int format) { -SLK *slk = SP->_slk; -size_t len; -const char *str = astr; -const char *p; + SLK *slk = SP->_slk; + size_t len; + const char *str = astr; + const char *p; - T((T_CALLED("slk_set(%d, \"%s\", %d)"), i, str, format)); + T((T_CALLED("slk_set(%d, \"%s\", %d)"), i, str, format)); - if (slk == NULL || i < 1 || i > slk->labcnt || format < 0 || format > 2) - returnCode(ERR); - if (str == NULL) - str = ""; + if (slk == NULL || i < 1 || i > slk->labcnt || format < 0 || format > 2) + returnCode(ERR); + if (str == NULL) + str = ""; - while (isspace(*str)) str++; /* skip over leading spaces */ - p = str; - while (isprint(*p)) p++; /* The first non-print stops */ + while (isspace(CharOf(*str))) + str++; /* skip over leading spaces */ + p = str; + while (isprint(CharOf(*p))) + p++; /* The first non-print stops */ - --i; /* Adjust numbering of labels */ + --i; /* Adjust numbering of labels */ - len = (size_t)(p - str); - if (len > (unsigned)slk->maxlen) - len = slk->maxlen; - if (len==0) - slk->ent[i].text[0] = 0; - else - (void) strncpy(slk->ent[i].text, str, len); - memset(slk->ent[i].form_text,' ', (unsigned)slk->maxlen); - slk->ent[i].text[slk->maxlen] = 0; - /* len = strlen(slk->ent[i].text); */ + len = (size_t) (p - str); + if (len > (unsigned) slk->maxlen) + len = slk->maxlen; + if (len == 0) + slk->ent[i].text[0] = 0; + else + (void) strncpy(slk->ent[i].text, str, len); + memset(slk->ent[i].form_text, ' ', (unsigned) slk->maxlen); + slk->ent[i].text[slk->maxlen] = 0; + /* len = strlen(slk->ent[i].text); */ - switch(format) { - case 0: /* left-justified */ - memcpy(slk->ent[i].form_text, - slk->ent[i].text, - len); - break; - case 1: /* centered */ - memcpy(slk->ent[i].form_text+(slk->maxlen - len)/2, - slk->ent[i].text, - len); - break; - case 2: /* right-justified */ - memcpy(slk->ent[i].form_text+ slk->maxlen - len, - slk->ent[i].text, - len); - break; - } - slk->ent[i].form_text[slk->maxlen] = 0; - slk->ent[i].dirty = TRUE; - returnCode(OK); + switch (format) { + case 0: /* left-justified */ + memcpy(slk->ent[i].form_text, + slk->ent[i].text, + len); + break; + case 1: /* centered */ + memcpy(slk->ent[i].form_text + (slk->maxlen - len) / 2, + slk->ent[i].text, + len); + break; + case 2: /* right-justified */ + memcpy(slk->ent[i].form_text + slk->maxlen - len, + slk->ent[i].text, + len); + break; + } + slk->ent[i].form_text[slk->maxlen] = 0; + slk->ent[i].dirty = TRUE; + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_slktouch.c b/contrib/ncurses/ncurses/base/lib_slktouch.c index c2829ae..5eb5df3 100644 --- a/contrib/ncurses/ncurses/base/lib_slktouch.c +++ b/contrib/ncurses/ncurses/base/lib_slktouch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -38,16 +38,16 @@ */ #include <curses.priv.h> -MODULE_ID("$Id: lib_slktouch.c,v 1.3 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$Id: lib_slktouch.c,v 1.5 2000/12/10 02:43:27 tom Exp $") -int +NCURSES_EXPORT(int) slk_touch(void) { - T((T_CALLED("slk_touch()"))); + T((T_CALLED("slk_touch()"))); - if (SP == NULL || SP->_slk == NULL) - returnCode(ERR); - SP->_slk->dirty = TRUE; + if (SP == NULL || SP->_slk == NULL) + returnCode(ERR); + SP->_slk->dirty = TRUE; - returnCode(OK); + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_touch.c b/contrib/ncurses/ncurses/base/lib_touch.c index 7ce863d..2ac21f2 100644 --- a/contrib/ncurses/ncurses/base/lib_touch.c +++ b/contrib/ncurses/ncurses/base/lib_touch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,45 +43,49 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_touch.c,v 1.6 1998/04/11 22:55:02 tom Exp $") +MODULE_ID("$Id: lib_touch.c,v 1.9 2000/12/10 02:43:27 tom Exp $") -bool is_linetouched(WINDOW *win, int line) +NCURSES_EXPORT(bool) +is_linetouched(WINDOW *win, int line) { - T((T_CALLED("is_linetouched(%p,%d)"), win, line)); + T((T_CALLED("is_linetouched(%p,%d)"), win, line)); - /* XSI doesn't define any error */ - if (!win || (line > win->_maxy) || (line < 0)) - returnCode(ERR); + /* XSI doesn't define any error */ + if (!win || (line > win->_maxy) || (line < 0)) + returnCode((bool) ERR); - returnCode(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE); + returnCode(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE); } -bool is_wintouched(WINDOW *win) +NCURSES_EXPORT(bool) +is_wintouched(WINDOW *win) { -int i; + int i; - T((T_CALLED("is_wintouched(%p)"), win)); + T((T_CALLED("is_wintouched(%p)"), win)); - if (win) - for (i = 0; i <= win->_maxy; i++) - if (win->_line[i].firstchar != _NOCHANGE) - returnCode(TRUE); - returnCode(FALSE); + if (win) + for (i = 0; i <= win->_maxy; i++) + if (win->_line[i].firstchar != _NOCHANGE) + returnCode(TRUE); + returnCode(FALSE); } -int wtouchln(WINDOW *win, int y, int n, int changed) +NCURSES_EXPORT(int) +wtouchln(WINDOW *win, int y, int n, int changed) { -int i; + int i; - T((T_CALLED("wtouchln(%p,%d,%d,%d)"), win, y, n, changed)); + T((T_CALLED("wtouchln(%p,%d,%d,%d)"), win, y, n, changed)); - if (!win || (n<0) || (y<0) || (y>win->_maxy)) - returnCode(ERR); + if (!win || (n < 0) || (y < 0) || (y > win->_maxy)) + returnCode(ERR); - for (i = y; i < y+n; i++) { - if (i>win->_maxy) break; - win->_line[i].firstchar = changed ? 0 : _NOCHANGE; - win->_line[i].lastchar = changed ? win->_maxx : _NOCHANGE; - } - returnCode(OK); + for (i = y; i < y + n; i++) { + if (i > win->_maxy) + break; + win->_line[i].firstchar = changed ? 0 : _NOCHANGE; + win->_line[i].lastchar = changed ? win->_maxx : _NOCHANGE; + } + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/lib_ungetch.c b/contrib/ncurses/ncurses/base/lib_ungetch.c index 5fdfb47..d28d3de 100644 --- a/contrib/ncurses/ncurses/base/lib_ungetch.c +++ b/contrib/ncurses/ncurses/base/lib_ungetch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,35 +40,38 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_ungetch.c,v 1.2 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$Id: lib_ungetch.c,v 1.4 2000/12/10 02:43:27 tom Exp $") #include <fifo_defs.h> #ifdef TRACE -void _nc_fifo_dump(void) +NCURSES_EXPORT(void) +_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]))); + 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]))); } #endif /* TRACE */ -int ungetch(int ch) +NCURSES_EXPORT(int) +ungetch(int ch) { - if (tail == -1) - return ERR; - if (head == -1) { - head = 0; - t_inc() - peek = tail; /* no raw keys */ - } else - h_dec(); + if (tail == -1) + return ERR; + if (head == -1) { + head = 0; + t_inc() + peek = tail; /* no raw keys */ + } else + h_dec(); - SP->_fifo[head] = ch; - T(("ungetch %#x ok", ch)); + SP->_fifo[head] = ch; + T(("ungetch %#x ok", ch)); #ifdef TRACE - if (_nc_tracing & TRACE_IEVENT) _nc_fifo_dump(); + if (_nc_tracing & TRACE_IEVENT) + _nc_fifo_dump(); #endif - return OK; + return OK; } diff --git a/contrib/ncurses/ncurses/base/lib_vline.c b/contrib/ncurses/ncurses/base/lib_vline.c index e48b864..0174baa 100644 --- a/contrib/ncurses/ncurses/base/lib_vline.c +++ b/contrib/ncurses/ncurses/base/lib_vline.c @@ -40,9 +40,9 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_vline.c,v 1.5 2000/04/29 21:14:11 tom Exp $") +MODULE_ID("$Id: lib_vline.c,v 1.7 2000/12/10 02:43:28 tom Exp $") -int +NCURSES_EXPORT(int) wvline(WINDOW *win, chtype ch, int n) { int code = ERR; diff --git a/contrib/ncurses/ncurses/base/lib_wattroff.c b/contrib/ncurses/ncurses/base/lib_wattroff.c index a6c9f0f1..fa29b1a 100644 --- a/contrib/ncurses/ncurses/base/lib_wattroff.c +++ b/contrib/ncurses/ncurses/base/lib_wattroff.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -41,15 +41,17 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$Id: lib_wattroff.c,v 1.4 1998/05/10 12:02:11 tom Exp $") +MODULE_ID("$Id: lib_wattroff.c,v 1.6 2000/12/10 02:43:28 tom Exp $") -int wattr_off(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED) +NCURSES_EXPORT(int) +wattr_off +(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED) { - T((T_CALLED("wattr_off(%p,%s)"), win, _traceattr(at))); - if (win) { - T(("... current %s", _traceattr(win->_attrs))); - toggle_attr_off(win->_attrs,at); - returnCode(OK); - } else - returnCode(ERR); + T((T_CALLED("wattr_off(%p,%s)"), win, _traceattr(at))); + if (win) { + T(("... current %s", _traceattr(win->_attrs))); + toggle_attr_off(win->_attrs, at); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/base/lib_wattron.c b/contrib/ncurses/ncurses/base/lib_wattron.c index a951c57..7bbc555 100644 --- a/contrib/ncurses/ncurses/base/lib_wattron.c +++ b/contrib/ncurses/ncurses/base/lib_wattron.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -41,15 +41,17 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$Id: lib_wattron.c,v 1.4 1998/05/10 12:02:28 tom Exp $") +MODULE_ID("$Id: lib_wattron.c,v 1.6 2000/12/10 02:43:28 tom Exp $") -int wattr_on(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED) +NCURSES_EXPORT(int) +wattr_on +(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED) { - T((T_CALLED("wattr_on(%p,%s)"), win, _traceattr(at))); - if (win) { - T(("... current %s", _traceattr(win->_attrs))); - toggle_attr_on(win->_attrs,at); - returnCode(OK); - } else - returnCode(ERR); + T((T_CALLED("wattr_on(%p,%s)"), win, _traceattr(at))); + if (win) { + T(("... current %s", _traceattr(win->_attrs))); + toggle_attr_on(win->_attrs, at); + returnCode(OK); + } else + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/base/lib_winch.c b/contrib/ncurses/ncurses/base/lib_winch.c index 7652207..236b11a 100644 --- a/contrib/ncurses/ncurses/base/lib_winch.c +++ b/contrib/ncurses/ncurses/base/lib_winch.c @@ -39,9 +39,9 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_winch.c,v 1.2 2000/07/29 16:41:44 tom Exp $") +MODULE_ID("$Id: lib_winch.c,v 1.4 2000/12/10 02:43:28 tom Exp $") -chtype +NCURSES_EXPORT(chtype) winch(WINDOW *win) { T((T_CALLED("winch(%p)"), win)); diff --git a/contrib/ncurses/ncurses/base/lib_window.c b/contrib/ncurses/ncurses/base/lib_window.c index 5eae9b1..9cef79c 100644 --- a/contrib/ncurses/ncurses/base/lib_window.c +++ b/contrib/ncurses/ncurses/base/lib_window.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,183 +39,185 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_window.c,v 1.13 1998/06/28 00:10:59 tom Exp $") +MODULE_ID("$Id: lib_window.c,v 1.15 2000/12/10 02:43:28 tom Exp $") -void _nc_synchook(WINDOW *win) +NCURSES_EXPORT(void) +_nc_synchook(WINDOW *win) /* hook to be called after each window change */ { - if (win->_immed) wrefresh(win); - if (win->_sync) wsyncup(win); + if (win->_immed) + wrefresh(win); + if (win->_sync) + wsyncup(win); } -int mvderwin(WINDOW *win, int y, int x) +NCURSES_EXPORT(int) +mvderwin(WINDOW *win, int y, int x) /* move a derived window */ { - WINDOW *orig; - int i; - - T((T_CALLED("mvderwin(%p,%d,%d)"), win, y, x)); - - if (win && (orig = win->_parent)) - { - if (win->_parx==x && win->_pary==y) - returnCode(OK); - if (x<0 || y<0) + WINDOW *orig; + int i; + + T((T_CALLED("mvderwin(%p,%d,%d)"), win, y, x)); + + if (win && (orig = win->_parent)) { + if (win->_parx == x && win->_pary == y) + returnCode(OK); + if (x < 0 || y < 0) + returnCode(ERR); + if ((x + getmaxx(win) > getmaxx(orig)) || + (y + getmaxy(win) > getmaxy(orig))) + returnCode(ERR); + } else returnCode(ERR); - if ( (x+getmaxx(win) > getmaxx(orig)) || - (y+getmaxy(win) > getmaxy(orig)) ) - returnCode(ERR); - } - else - returnCode(ERR); - wsyncup(win); - win->_parx = x; - win->_pary = y; - for(i=0;i<getmaxy(win);i++) - win->_line[i].text = &(orig->_line[y++].text[x]); - returnCode(OK); + wsyncup(win); + win->_parx = x; + win->_pary = y; + for (i = 0; i < getmaxy(win); i++) + win->_line[i].text = &(orig->_line[y++].text[x]); + returnCode(OK); } -int syncok(WINDOW *win, bool bf) +NCURSES_EXPORT(int) +syncok(WINDOW *win, bool bf) /* enable/disable automatic wsyncup() on each change to window */ { - T((T_CALLED("syncok(%p,%d)"), win, bf)); + T((T_CALLED("syncok(%p,%d)"), win, bf)); - if (win) { - win->_sync = bf; - returnCode(OK); - } else - returnCode(ERR); + if (win) { + win->_sync = bf; + returnCode(OK); + } else + returnCode(ERR); } -void wsyncup(WINDOW *win) +NCURSES_EXPORT(void) +wsyncup(WINDOW *win) /* mark changed every cell in win's ancestors that is changed in win */ /* Rewritten by J. Pfeifer, 1-Apr-96 (don't even think that...) */ { - WINDOW *wp; - - if (win && win->_parent) - for (wp = win; wp->_parent; wp = wp->_parent) - { - int y; - WINDOW *pp = wp->_parent; - - assert((wp->_pary <= pp->_maxy) && - ((wp->_pary+wp->_maxy) <= pp->_maxy)); - - for (y = 0; y <= wp->_maxy; y++) - { - int left = wp->_line[y].firstchar; - if (left >= 0) /* line is touched */ - { - struct ldat *line = &(pp->_line[wp->_pary + y]); - /* left & right character in parent window coordinates */ - int right = wp->_line[y].lastchar + wp->_parx; - left += wp->_parx; - - CHANGED_RANGE(line, left, right); - } - } - } + WINDOW *wp; + + if (win && win->_parent) + for (wp = win; wp->_parent; wp = wp->_parent) { + int y; + WINDOW *pp = wp->_parent; + + assert((wp->_pary <= pp->_maxy) && + ((wp->_pary + wp->_maxy) <= pp->_maxy)); + + for (y = 0; y <= wp->_maxy; y++) { + int left = wp->_line[y].firstchar; + if (left >= 0) { /* line is touched */ + struct ldat *line = &(pp->_line[wp->_pary + y]); + /* left & right character in parent window coordinates */ + int right = wp->_line[y].lastchar + wp->_parx; + left += wp->_parx; + + CHANGED_RANGE(line, left, right); + } + } + } } -void wsyncdown(WINDOW *win) +NCURSES_EXPORT(void) +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...) */ { - if (win && win->_parent) - { - WINDOW *pp = win->_parent; - int y; - - /* This recursion guarantees, that the changes are propagated down- - wards from the root to our direct parent. */ - wsyncdown(pp); - - /* and now we only have to propagate the changes from our direct - parent, if there are any. */ - assert((win->_pary <= pp->_maxy) && - ((win->_pary + win->_maxy) <= pp->_maxy)); - - for (y = 0; y <= win->_maxy; y++) - { - if (pp->_line[win->_pary + y].firstchar >= 0) /* parent changed */ - { - struct ldat *line = &(win->_line[y]); - /* left and right character in child coordinates */ - int left = pp->_line[win->_pary + y].firstchar - win->_parx; - int right = pp->_line[win->_pary + y].lastchar - win->_parx; - /* The change maybe outside the childs range */ - if (left<0) - left = 0; - if (right > win->_maxx) - right = win->_maxx; - CHANGED_RANGE(line, left, right); + if (win && win->_parent) { + WINDOW *pp = win->_parent; + int y; + + /* This recursion guarantees, that the changes are propagated down- + wards from the root to our direct parent. */ + wsyncdown(pp); + + /* and now we only have to propagate the changes from our direct + parent, if there are any. */ + assert((win->_pary <= pp->_maxy) && + ((win->_pary + win->_maxy) <= pp->_maxy)); + + for (y = 0; y <= win->_maxy; y++) { + if (pp->_line[win->_pary + y].firstchar >= 0) { /* parent changed */ + struct ldat *line = &(win->_line[y]); + /* left and right character in child coordinates */ + int left = pp->_line[win->_pary + y].firstchar - win->_parx; + int right = pp->_line[win->_pary + y].lastchar - win->_parx; + /* The change maybe outside the childs range */ + if (left < 0) + left = 0; + if (right > win->_maxx) + right = win->_maxx; + CHANGED_RANGE(line, left, right); } } } } -void wcursyncup(WINDOW *win) +NCURSES_EXPORT(void) +wcursyncup(WINDOW *win) /* sync the cursor in all derived windows to its value in the base window */ { - WINDOW *wp; - for( wp = win; wp && wp->_parent; wp = wp->_parent ) { - wmove( wp->_parent, wp->_pary + wp->_cury, wp->_parx + wp->_curx ); - } + WINDOW *wp; + for (wp = win; wp && wp->_parent; wp = wp->_parent) { + wmove(wp->_parent, wp->_pary + wp->_cury, wp->_parx + wp->_curx); + } } -WINDOW *dupwin(WINDOW *win) +NCURSES_EXPORT(WINDOW *) +dupwin(WINDOW *win) /* make an exact duplicate of the given window */ { -WINDOW *nwin; -size_t linesize; -int i; - - T((T_CALLED("dupwin(%p)"), win)); - - if ((win==NULL) || - ((nwin = newwin(win->_maxy + 1, win->_maxx + 1, win->_begy, win->_begx)) == NULL)) - returnWin(0); - - nwin->_curx = win->_curx; - nwin->_cury = win->_cury; - nwin->_maxy = win->_maxy; - nwin->_maxx = win->_maxx; - nwin->_begy = win->_begy; - nwin->_begx = win->_begx; - nwin->_yoffset = win->_yoffset; - - nwin->_flags = win->_flags & ~_SUBWIN; - /* Due to the use of newwin(), the clone is not a subwindow. - * The text is really copied into the clone. - */ - - nwin->_attrs = win->_attrs; - nwin->_bkgd = win->_bkgd; - - nwin->_clear = win->_clear; - nwin->_scroll = win->_scroll; - nwin->_leaveok = win->_leaveok; - nwin->_use_keypad = win->_use_keypad; - nwin->_delay = win->_delay; - nwin->_immed = win->_immed; - nwin->_sync = win->_sync; - - nwin->_parx = 0; - nwin->_pary = 0; - nwin->_parent = (WINDOW*)0; - /* See above: the clone isn't a subwindow! */ - - nwin->_regtop = win->_regtop; - nwin->_regbottom = win->_regbottom; - - linesize = (win->_maxx + 1) * sizeof(chtype); - for (i = 0; i <= nwin->_maxy; i++) { - memcpy(nwin->_line[i].text, win->_line[i].text, linesize); - nwin->_line[i].firstchar = win->_line[i].firstchar; - nwin->_line[i].lastchar = win->_line[i].lastchar; - } + WINDOW *nwin; + size_t linesize; + int i; + + T((T_CALLED("dupwin(%p)"), win)); + + if ((win == NULL) || + ((nwin = newwin(win->_maxy + 1, win->_maxx + 1, win->_begy, + win->_begx)) == NULL)) + returnWin(0); + + nwin->_curx = win->_curx; + nwin->_cury = win->_cury; + nwin->_maxy = win->_maxy; + nwin->_maxx = win->_maxx; + nwin->_begy = win->_begy; + nwin->_begx = win->_begx; + nwin->_yoffset = win->_yoffset; + + nwin->_flags = win->_flags & ~_SUBWIN; + /* Due to the use of newwin(), the clone is not a subwindow. + * The text is really copied into the clone. + */ + + nwin->_attrs = win->_attrs; + nwin->_bkgd = win->_bkgd; + + nwin->_clear = win->_clear; + nwin->_scroll = win->_scroll; + nwin->_leaveok = win->_leaveok; + nwin->_use_keypad = win->_use_keypad; + nwin->_delay = win->_delay; + nwin->_immed = win->_immed; + nwin->_sync = win->_sync; + + nwin->_parx = 0; + nwin->_pary = 0; + nwin->_parent = (WINDOW *) 0; + /* See above: the clone isn't a subwindow! */ + + nwin->_regtop = win->_regtop; + nwin->_regbottom = win->_regbottom; + + linesize = (win->_maxx + 1) * sizeof(chtype); + for (i = 0; i <= nwin->_maxy; i++) { + memcpy(nwin->_line[i].text, win->_line[i].text, linesize); + nwin->_line[i].firstchar = win->_line[i].firstchar; + nwin->_line[i].lastchar = win->_line[i].lastchar; + } - returnWin(nwin); + returnWin(nwin); } diff --git a/contrib/ncurses/ncurses/base/memmove.c b/contrib/ncurses/ncurses/base/memmove.c index 55a4106..4fafc4c 100644 --- a/contrib/ncurses/ncurses/base/memmove.c +++ b/contrib/ncurses/ncurses/base/memmove.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -28,7 +28,7 @@ #include <curses.priv.h> -MODULE_ID("$Id: memmove.c,v 1.2 1999/02/27 19:55:57 tom Exp $") +MODULE_ID("$Id: memmove.c,v 1.4 2000/12/10 02:43:28 tom Exp $") /**************************************************************************** * Author: Thomas E. Dickey <dickey@clark.net> 1998 * @@ -37,27 +37,33 @@ MODULE_ID("$Id: memmove.c,v 1.2 1999/02/27 19:55:57 tom Exp $") #if USE_MY_MEMMOVE #define DST ((char *)s1) #define SRC ((const char *)s2) -void * _nc_memmove(void * s1, const void * s2, size_t n) +NCURSES_EXPORT(void *) +_nc_memmove(void *s1, const void *s2, size_t n) { - if (n != 0) { - if ((DST+n > SRC) && (SRC+n > DST)) { - static char *bfr; - static size_t length; - register size_t j; - if (length < n) { - length = (n * 3) / 2; - bfr = typeRealloc(char,length,bfr); - } - for (j = 0; j < n; j++) - bfr[j] = SRC[j]; - SRC = bfr; - } - while (n-- != 0) - DST[n] = SRC[n]; + if (n != 0) { + if ((DST + n > SRC) && (SRC + n > DST)) { + static char *bfr; + static size_t length; + register size_t j; + if (length < n) { + length = (n * 3) / 2; + bfr = typeRealloc(char, length, bfr); + } + for (j = 0; j < n; j++) + bfr[j] = SRC[j]; + SRC = bfr; } - return s1; + while (n-- != 0) + DST[n] = SRC[n]; + } + return s1; } #else -extern void _nc_memmove(void); /* quiet's gcc warning */ -void _nc_memmove(void) { } /* nonempty for strict ANSI compilers */ +extern +NCURSES_EXPORT(void) +_nc_memmove(void); /* quiet's gcc warning */ +NCURSES_EXPORT(void) +_nc_memmove(void) +{ +} /* nonempty for strict ANSI compilers */ #endif /* USE_MY_MEMMOVE */ diff --git a/contrib/ncurses/ncurses/base/nc_panel.c b/contrib/ncurses/ncurses/base/nc_panel.c index 536aab3..59bfbbe 100644 --- a/contrib/ncurses/ncurses/base/nc_panel.c +++ b/contrib/ncurses/ncurses/base/nc_panel.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,10 +32,10 @@ #include <curses.priv.h> -MODULE_ID("$Id: nc_panel.c,v 1.2 1998/02/11 12:13:56 tom Exp $") +MODULE_ID("$Id: nc_panel.c,v 1.4 2000/12/10 02:43:28 tom Exp $") -struct panelhook* +NCURSES_EXPORT(struct panelhook *) _nc_panelhook(void) { - return (SP ? &(SP->_panelHook) : NULL); + return (SP ? &(SP->_panelHook) : NULL); } diff --git a/contrib/ncurses/ncurses/base/resizeterm.c b/contrib/ncurses/ncurses/base/resizeterm.c index 8603550..303aa5e 100644 --- a/contrib/ncurses/ncurses/base/resizeterm.c +++ b/contrib/ncurses/ncurses/base/resizeterm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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 <term.h> -MODULE_ID("$Id: resizeterm.c,v 1.7 1998/09/19 19:27:43 Alexander.V.Lukyanov Exp $") +MODULE_ID("$Id: resizeterm.c,v 1.9 2000/12/10 02:43:28 tom Exp $") /* * This function reallocates NCURSES window structures. It is invoked in @@ -51,71 +51,74 @@ MODULE_ID("$Id: resizeterm.c,v 1.7 1998/09/19 19:27:43 Alexander.V.Lukyanov Exp * Because this performs memory allocation, it should not (in general) be * invoked directly from the signal handler. */ -int +NCURSES_EXPORT(int) resizeterm(int ToLines, int ToCols) { - int stolen = screen_lines - SP->_lines_avail; - int bottom = screen_lines + SP->_topstolen - stolen; + int stolen = screen_lines - SP->_lines_avail; + int bottom = screen_lines + SP->_topstolen - stolen; - T((T_CALLED("resizeterm(%d,%d) old(%d,%d)"), - ToLines, ToCols, - screen_lines, screen_columns)); + T((T_CALLED("resizeterm(%d,%d) old(%d,%d)"), + ToLines, ToCols, + screen_lines, screen_columns)); - SP->_sig_winch = FALSE; + SP->_sig_winch = FALSE; - if (ToLines != screen_lines - || ToCols != screen_columns) { - WINDOWLIST *wp; + if (ToLines != screen_lines + || ToCols != screen_columns) { + WINDOWLIST *wp; #if USE_SIGWINCH - ungetch(KEY_RESIZE); /* so application can know this */ - clearok(curscr, TRUE); /* screen contents are unknown */ + ungetch(KEY_RESIZE); /* so application can know this */ + clearok(curscr, TRUE); /* screen contents are unknown */ #endif - for (wp = _nc_windows; wp != 0; wp = wp->next) { - WINDOW *win = wp->win; - int myLines = win->_maxy + 1; - int myCols = win->_maxx + 1; - - /* pads aren't treated this way */ - if (win->_flags & _ISPAD) - continue; - - if (win->_begy >= bottom) { - win->_begy += (ToLines - screen_lines); - } else { - if (myLines == screen_lines - stolen - && ToLines != screen_lines) - myLines = ToLines - stolen; - else - if (myLines == screen_lines - && ToLines != screen_lines) - myLines = ToLines; - } - - if (myCols == screen_columns - && ToCols != screen_columns) - myCols = ToCols; - - if (wresize(win, myLines, myCols) != OK) - returnCode(ERR); - } - - screen_lines = lines = ToLines; - screen_columns = columns = ToCols; - - SP->_lines_avail = lines - stolen; - - if (SP->oldhash) { FreeAndNull(SP->oldhash); } - if (SP->newhash) { FreeAndNull(SP->newhash); } + for (wp = _nc_windows; wp != 0; wp = wp->next) { + WINDOW *win = wp->win; + int myLines = win->_maxy + 1; + int myCols = win->_maxx + 1; + + /* pads aren't treated this way */ + if (win->_flags & _ISPAD) + continue; + + if (win->_begy >= bottom) { + win->_begy += (ToLines - screen_lines); + } else { + if (myLines == screen_lines - stolen + && ToLines != screen_lines) + myLines = ToLines - stolen; + else if (myLines == screen_lines + && ToLines != screen_lines) + myLines = ToLines; + } + + if (myCols == screen_columns + && ToCols != screen_columns) + myCols = ToCols; + + if (wresize(win, myLines, myCols) != OK) + returnCode(ERR); } - /* - * Always update LINES, to allow for call from lib_doupdate.c which - * needs to have the count adjusted by the stolen (ripped off) lines. - */ - LINES = ToLines - stolen; - COLS = ToCols; + screen_lines = lines = ToLines; + screen_columns = columns = ToCols; - returnCode(OK); + SP->_lines_avail = lines - stolen; + + if (SP->oldhash) { + FreeAndNull(SP->oldhash); + } + if (SP->newhash) { + FreeAndNull(SP->newhash); + } + } + + /* + * Always update LINES, to allow for call from lib_doupdate.c which + * needs to have the count adjusted by the stolen (ripped off) lines. + */ + LINES = ToLines - stolen; + COLS = ToCols; + + returnCode(OK); } diff --git a/contrib/ncurses/ncurses/base/safe_sprintf.c b/contrib/ncurses/ncurses/base/safe_sprintf.c index e4d5252..e534776 100644 --- a/contrib/ncurses/ncurses/base/safe_sprintf.c +++ b/contrib/ncurses/ncurses/base/safe_sprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free 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,11 +33,13 @@ #include <curses.priv.h> #include <ctype.h> -MODULE_ID("$Id: safe_sprintf.c,v 1.11 1999/09/11 18:03:27 tom Exp $") +MODULE_ID("$Id: safe_sprintf.c,v 1.13 2000/12/10 02:43:28 tom Exp $") #if USE_SAFE_SPRINTF -typedef enum { Flags, Width, Prec, Type, Format } PRINTF; +typedef enum { + Flags, Width, Prec, Type, Format +} PRINTF; #define VA_INTGR(type) ival = va_arg(ap, type) #define VA_FLOAT(type) fval = va_arg(ap, type) @@ -50,190 +52,193 @@ typedef enum { Flags, Width, Prec, Type, Format } PRINTF; static int _nc_printf_length(const char *fmt, va_list ap) { - size_t length = BUFSIZ; - char *buffer; - char *format; - int len = 0; - - if (fmt == 0 || *fmt == '\0') - return -1; - if ((format = typeMalloc(char, strlen(fmt)+1)) == 0) - return -1; - if ((buffer = typeMalloc(char, length)) == 0) { - free(format); - return -1; - } - - while (*fmt != '\0') { - if (*fmt == '%') { - static char dummy[] = ""; - PRINTF state = Flags; - char *pval = dummy; /* avoid const-cast */ - double fval = 0.0; - int done = FALSE; - int ival = 0; - int prec = -1; - int type = 0; - int used = 0; - int width = -1; - size_t f = 0; - - format[f++] = *fmt; - while (*++fmt != '\0' && len >= 0 && !done) { - format[f++] = *fmt; - - if (isdigit(*fmt)) { - int num = *fmt - '0'; - if (state == Flags && num != 0) - state = Width; - if (state == Width) { - if (width < 0) - width = 0; - width = (width * 10) + num; - } else if (state == Prec) { - if (prec < 0) - prec = 0; - prec = (prec * 10) + num; - } - } else if (*fmt == '*') { - VA_INTGR(int); - if (state == Flags) - state = Width; - if (state == Width) { - width = ival; - } else if (state == Prec) { - prec = ival; - } - sprintf(&format[--f], "%d", ival); - f = strlen(format); - } else if (isalpha(*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_INTGR(long); - else if (type == 'Z') - VA_INTGR(size_t); - else - VA_INTGR(int); - used = 'i'; - break; - case 'f': /* FALLTHRU */ - case 'e': /* FALLTHRU */ - case 'E': /* FALLTHRU */ - case 'g': /* FALLTHRU */ - case 'G': /* FALLTHRU */ - VA_FLOAT(double); - used = 'f'; - break; - case 'c': - VA_INTGR(int); - used = 'i'; - break; - case 's': - VA_POINT(char *); - if (prec < 0) - prec = strlen(pval); - if (prec > (int)length) { - length = length + prec; - buffer = typeRealloc(char, length, buffer); - if (buffer == 0) { - free(format); - return -1; - } - } - used = 'p'; - break; - case 'p': - VA_POINT(void *); - used = 'p'; - break; - case 'n': - VA_POINT(int *); - used = 0; - break; - default: - break; - } - } else if (*fmt == '.') { - state = Prec; - } else if (*fmt == '%') { - done = TRUE; - used = 'p'; - } - } - format[f] = '\0'; - switch (used) { - case 'i': - sprintf(buffer, format, ival); - break; - case 'f': - sprintf(buffer, format, fval); - break; - default: - sprintf(buffer, format, pval); - break; + size_t length = BUFSIZ; + char *buffer; + char *format; + int len = 0; + + if (fmt == 0 || *fmt == '\0') + return -1; + if ((format = typeMalloc(char, strlen(fmt) + 1)) == 0) + return -1; + if ((buffer = typeMalloc(char, length)) == 0) { + free(format); + return -1; + } + + while (*fmt != '\0') { + if (*fmt == '%') { + static char dummy[] = ""; + PRINTF state = Flags; + char *pval = dummy; /* avoid const-cast */ + double fval = 0.0; + int done = FALSE; + int ival = 0; + int prec = -1; + int type = 0; + int used = 0; + int width = -1; + size_t f = 0; + + format[f++] = *fmt; + while (*++fmt != '\0' && len >= 0 && !done) { + format[f++] = *fmt; + + if (isdigit(*fmt)) { + int num = *fmt - '0'; + if (state == Flags && num != 0) + state = Width; + if (state == Width) { + if (width < 0) + width = 0; + width = (width * 10) + num; + } else if (state == Prec) { + if (prec < 0) + prec = 0; + prec = (prec * 10) + num; + } + } else if (*fmt == '*') { + VA_INTGR(int); + if (state == Flags) + state = Width; + if (state == Width) { + width = ival; + } else if (state == Prec) { + prec = ival; + } + sprintf(&format[--f], "%d", ival); + f = strlen(format); + } else if (isalpha(*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_INTGR(long); + else if (type == 'Z') + VA_INTGR(size_t); + else + VA_INTGR(int); + used = 'i'; + break; + case 'f': /* FALLTHRU */ + case 'e': /* FALLTHRU */ + case 'E': /* FALLTHRU */ + case 'g': /* FALLTHRU */ + case 'G': /* FALLTHRU */ + VA_FLOAT(double); + used = 'f'; + break; + case 'c': + VA_INTGR(int); + used = 'i'; + break; + case 's': + VA_POINT(char *); + if (prec < 0) + prec = strlen(pval); + if (prec > (int) length) { + length = length + prec; + buffer = typeRealloc(char, length, buffer); + if (buffer == 0) { + free(format); + return -1; + } } - len += (int)strlen(buffer); - } else { - fmt++; - len++; + used = 'p'; + break; + case 'p': + VA_POINT(void *); + used = 'p'; + break; + case 'n': + VA_POINT(int *); + used = 0; + break; + default: + break; + } + } else if (*fmt == '.') { + state = Prec; + } else if (*fmt == '%') { + done = TRUE; + used = 'p'; } + } + format[f] = '\0'; + switch (used) { + case 'i': + sprintf(buffer, format, ival); + break; + case 'f': + sprintf(buffer, format, fval); + break; + default: + sprintf(buffer, format, pval); + break; + } + len += (int) strlen(buffer); + } else { + fmt++; + len++; } + } - free(buffer); - free(format); - return len; + free(buffer); + free(format); + return len; } #endif /* * Wrapper for vsprintf that allocates a buffer big enough to hold the result. */ -char * -_nc_printf_string(const char *fmt, va_list ap) +NCURSES_EXPORT(char *) +_nc_printf_string +(const char *fmt, va_list ap) { #if USE_SAFE_SPRINTF - char *buf = 0; - int len = _nc_printf_length(fmt, ap); - - if (len > 0) { - if ((buf = typeMalloc(char, len+1)) == 0) - return(0); - vsprintf(buf, fmt, ap); - } + char *buf = 0; + int len = _nc_printf_length(fmt, ap); + + if (len > 0) { + if ((buf = typeMalloc(char, len + 1)) == 0) + return (0); + vsprintf(buf, fmt, ap); + } #else - static int rows, cols; - static char *buf; - static size_t len; - - if (screen_lines > rows || screen_columns > cols) { - if (screen_lines > rows) rows = screen_lines; - if (screen_columns > cols) cols = screen_columns; - len = (rows * (cols + 1)) + 1; - buf = typeRealloc(char, len, buf); - if (buf == 0) { - return(0); - } + static int rows, cols; + static char *buf; + static size_t len; + + if (screen_lines > rows || screen_columns > cols) { + if (screen_lines > rows) + rows = screen_lines; + if (screen_columns > cols) + cols = screen_columns; + len = (rows * (cols + 1)) + 1; + buf = typeRealloc(char, len, buf); + if (buf == 0) { + return (0); } + } - if (buf != 0) { + if (buf != 0) { # if HAVE_VSNPRINTF - vsnprintf(buf, len, fmt, ap); /* GNU extension */ + vsnprintf(buf, len, fmt, ap); /* GNU extension */ # else - vsprintf(buf, fmt, ap); /* ANSI */ + vsprintf(buf, fmt, ap); /* ANSI */ # endif - } + } #endif - return buf; + return buf; } diff --git a/contrib/ncurses/ncurses/base/sigaction.c b/contrib/ncurses/ncurses/base/sigaction.c index ab1e569..8819638 100644 --- a/contrib/ncurses/ncurses/base/sigaction.c +++ b/contrib/ncurses/ncurses/base/sigaction.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,66 +41,78 @@ #if !HAVE_SIGACTION && HAVE_SIGVEC -MODULE_ID("$Id: sigaction.c,v 1.9 1999/06/19 23:05:16 tom Exp $") +MODULE_ID("$Id: sigaction.c,v 1.11 2000/12/10 02:43:28 tom Exp $") -int -sigaction (int sig, sigaction_t * sigact, sigaction_t * osigact) +NCURSES_EXPORT(int) +sigaction +(int sig, sigaction_t * sigact, sigaction_t * osigact) { - return sigvec(sig, sigact, osigact); + return sigvec(sig, sigact, osigact); } -int -sigemptyset (sigset_t * mask) +NCURSES_EXPORT(int) +sigemptyset +(sigset_t * mask) { - *mask = 0; - return 0; + *mask = 0; + return 0; } -int -sigprocmask (int mode, sigset_t * mask, sigset_t * omask) +NCURSES_EXPORT(int) +sigprocmask +(int mode, sigset_t * mask, sigset_t * omask) { - sigset_t current = sigsetmask(0); + sigset_t current = sigsetmask(0); - if (omask) *omask = current; + if (omask) + *omask = current; - if (mode==SIG_BLOCK) - current |= *mask; - else if (mode==SIG_UNBLOCK) - current &= ~*mask; - else if (mode==SIG_SETMASK) - current = *mask; + if (mode == SIG_BLOCK) + current |= *mask; + else if (mode == SIG_UNBLOCK) + current &= ~*mask; + else if (mode == SIG_SETMASK) + current = *mask; - sigsetmask(current); - return 0; + sigsetmask(current); + return 0; } -int -sigsuspend (sigset_t * mask) +NCURSES_EXPORT(int) +sigsuspend(sigset_t * mask) { - return sigpause (*mask); + return sigpause(*mask); } -int -sigdelset (sigset_t * mask, int sig) +NCURSES_EXPORT(int) +sigdelset +(sigset_t * mask, int sig) { - *mask &= ~sigmask (sig); - return 0; + *mask &= ~sigmask(sig); + return 0; } -int -sigaddset (sigset_t * mask, int sig) +NCURSES_EXPORT(int) +sigaddset +(sigset_t * mask, int sig) { - *mask |= sigmask (sig); - return 0; + *mask |= sigmask(sig); + return 0; } -int -sigismember (sigset_t * mask, int sig) +NCURSES_EXPORT(int) +sigismember +(sigset_t * mask, int sig) { - return (*mask & sigmask (sig)) != 0; + return (*mask & sigmask(sig)) != 0; } #else -extern void _nc_sigaction(void); /* quiet's gcc warning */ -void _nc_sigaction(void) { } /* nonempty for strict ANSI compilers */ +extern +NCURSES_EXPORT(void) +_nc_sigaction(void); /* quiet's gcc warning */ +NCURSES_EXPORT(void) +_nc_sigaction(void) +{ +} /* nonempty for strict ANSI compilers */ #endif diff --git a/contrib/ncurses/ncurses/base/tries.c b/contrib/ncurses/ncurses/base/tries.c index 3c39652..04f8b91 100644 --- a/contrib/ncurses/ncurses/base/tries.c +++ b/contrib/ncurses/ncurses/base/tries.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,100 +39,106 @@ #include <curses.priv.h> -MODULE_ID("$Id: tries.c,v 1.12 1999/03/01 23:23:59 tom Exp $") +MODULE_ID("$Id: tries.c,v 1.14 2000/12/10 02:43:28 tom Exp $") /* * Expand a keycode into the string that it corresponds to, returning null if * no match was found, otherwise allocating a string of the result. */ -char *_nc_expand_try(struct tries *tree, unsigned short code, int *count, size_t len) +NCURSES_EXPORT(char *) +_nc_expand_try +(struct tries *tree, unsigned short code, int *count, size_t len) { - struct tries *ptr = tree; - char *result = 0; + struct tries *ptr = tree; + char *result = 0; - if (code != 0) { - while (ptr != 0) { - if ((result = _nc_expand_try(ptr->child, code, count, len + 1)) != 0) { - break; - } - if (ptr->value == code) { - *count -= 1; - if (*count == -1) { - result = typeCalloc(char, len+2); - break; - } - } - ptr = ptr->sibling; + if (code != 0) { + while (ptr != 0) { + if ((result = _nc_expand_try(ptr->child, code, count, len + 1)) + != 0) { + break; + } + if (ptr->value == code) { + *count -= 1; + if (*count == -1) { + result = typeCalloc(char, len + 2); + break; } + } + ptr = ptr->sibling; } - if (result != 0) { - if ((result[len] = ptr->ch) == 0) - *((unsigned char *)(result+len)) = 128; + } + if (result != 0) { + if ((result[len] = ptr->ch) == 0) + *((unsigned char *) (result + len)) = 128; #ifdef TRACE - if (len == 0) - _tracef("expand_key %s %s", _trace_key(code), _nc_visbuf(result)); + if (len == 0) + _tracef("expand_key %s %s", _trace_key(code), _nc_visbuf(result)); #endif - } - return result; + } + return result; } /* * Remove a code from the specified tree, freeing the unused nodes. Returns * true if the code was found/removed. */ -int _nc_remove_key(struct tries **tree, unsigned short code) +NCURSES_EXPORT(int) +_nc_remove_key +(struct tries **tree, unsigned short code) { - T((T_CALLED("_nc_remove_key(%p,%d)"), tree, code)); + T((T_CALLED("_nc_remove_key(%p,%d)"), tree, code)); - if (code == 0) - returnCode(FALSE); - - while (*tree != 0) { - if (_nc_remove_key(&(*tree)->child, code)) { - returnCode(TRUE); - } - if ((*tree)->value == code) { - if((*tree)->child) { - /* don't cut the whole sub-tree */ - (*tree)->value = 0; - } else { - struct tries *to_free = *tree; - *tree = (*tree)->sibling; - free(to_free); - } - returnCode(TRUE); - } - tree = &(*tree)->sibling; - } + if (code == 0) returnCode(FALSE); + + while (*tree != 0) { + if (_nc_remove_key(&(*tree)->child, code)) { + returnCode(TRUE); + } + if ((*tree)->value == code) { + if ((*tree)->child) { + /* don't cut the whole sub-tree */ + (*tree)->value = 0; + } else { + struct tries *to_free = *tree; + *tree = (*tree)->sibling; + free(to_free); + } + returnCode(TRUE); + } + tree = &(*tree)->sibling; + } + returnCode(FALSE); } /* * Remove a string from the specified tree, freeing the unused nodes. Returns * true if the string was found/removed. */ -int _nc_remove_string(struct tries **tree, char *string) +NCURSES_EXPORT(int) +_nc_remove_string(struct tries **tree, char *string) { - T((T_CALLED("_nc_remove_string(%p,%s)"), tree, _nc_visbuf(string))); + T((T_CALLED("_nc_remove_string(%p,%s)"), tree, _nc_visbuf(string))); - if (string == 0 || *string == 0) - returnCode(FALSE); - - while (*tree != 0) { - if ((unsigned char)(*tree)->ch == (unsigned char)*string) { - if (string[1] != 0) - returnCode(_nc_remove_string(&(*tree)->child, string+1)); - if((*tree)->child) { - /* don't cut the whole sub-tree */ - (*tree)->value = 0; - } else { - struct tries *to_free = *tree; - *tree = (*tree)->sibling; - free(to_free); - } - returnCode(TRUE); - } - tree = &(*tree)->sibling; - } + if (string == 0 || *string == 0) returnCode(FALSE); + + while (*tree != 0) { + if ((unsigned char) (*tree)->ch == (unsigned char) *string) { + if (string[1] != 0) + returnCode(_nc_remove_string(&(*tree)->child, string + 1)); + if ((*tree)->child) { + /* don't cut the whole sub-tree */ + (*tree)->value = 0; + } else { + struct tries *to_free = *tree; + *tree = (*tree)->sibling; + free(to_free); + } + returnCode(TRUE); + } + tree = &(*tree)->sibling; + } + returnCode(FALSE); } diff --git a/contrib/ncurses/ncurses/base/version.c b/contrib/ncurses/ncurses/base/version.c index a2fe4d8..b78c99d 100644 --- a/contrib/ncurses/ncurses/base/version.c +++ b/contrib/ncurses/ncurses/base/version.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 Free 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,16 +32,16 @@ #include <curses.priv.h> -MODULE_ID("$Id: version.c,v 1.2 1999/12/04 21:27:23 tom Exp $") +MODULE_ID("$Id: version.c,v 1.4 2000/12/10 02:43:28 tom Exp $") -const char * +NCURSES_EXPORT(const char *) curses_version(void) { static char my_version[80]; T((T_CALLED("curses_version()"))); sprintf(my_version, "ncurses %s.%d", - NCURSES_VERSION, - NCURSES_VERSION_PATCH); + NCURSES_VERSION, + NCURSES_VERSION_PATCH); returnPtr(my_version); } diff --git a/contrib/ncurses/ncurses/base/vsscanf.c b/contrib/ncurses/ncurses/base/vsscanf.c index ac2bf9f..70d0517 100644 --- a/contrib/ncurses/ncurses/base/vsscanf.c +++ b/contrib/ncurses/ncurses/base/vsscanf.c @@ -6,42 +6,51 @@ #if !HAVE_VSSCANF -MODULE_ID("$Id: vsscanf.c,v 1.10 1996/12/21 14:24:06 tom Exp $") +MODULE_ID("$Id: vsscanf.c,v 1.12 2000/12/10 02:43:28 tom Exp $") #if defined(_IOREAD) && defined(_NFILE) /*VARARGS2*/ -int vsscanf(const char *str, const char *format, va_list ap) +NCURSES_EXPORT(int) +vsscanf +(const char *str, const char *format, va_list ap) { - /* - * This code should work on anything descended from AT&T SVr1. - */ - FILE strbuf; + /* + * This code should work on anything descended from AT&T SVr1. + */ + FILE strbuf; - strbuf._flag = _IOREAD; - strbuf._ptr = strbuf._base = (unsigned char*)str; - strbuf._cnt = strlen(str); - strbuf._file = _NFILE; + strbuf._flag = _IOREAD; + strbuf._ptr = strbuf._base = (unsigned char *) str; + strbuf._cnt = strlen(str); + strbuf._file = _NFILE; #if HAVE_VFSCANF - return(vfscanf(&strbuf, format, ap)); + return (vfscanf(&strbuf, format, ap)); #else - return(_doscan(&strbuf, format, ap)); + return (_doscan(&strbuf, format, ap)); #endif } #else /*VARARGS2*/ -int vsscanf(const char *str, const char *format, va_list ap) +NCURSES_EXPORT(int) +vsscanf +(const char *str, const char *format, va_list ap) { - /* - * 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. - */ - return -1; /* not implemented */ + /* + * 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. + */ + return -1; /* not implemented */ } #endif #else -extern void _nc_vsscanf(void); /* quiet's gcc warning */ -void _nc_vsscanf(void) { } /* nonempty for strict ANSI compilers */ +extern +NCURSES_EXPORT(void) +_nc_vsscanf(void); /* quiet's gcc warning */ +NCURSES_EXPORT(void) +_nc_vsscanf(void) +{ +} /* nonempty for strict ANSI compilers */ #endif /* !HAVE_VSSCANF */ diff --git a/contrib/ncurses/ncurses/base/wresize.c b/contrib/ncurses/ncurses/base/wresize.c index 8121ff1..4889ee0 100644 --- a/contrib/ncurses/ncurses/base/wresize.c +++ b/contrib/ncurses/ncurses/base/wresize.c @@ -32,7 +32,7 @@ #include <curses.priv.h> -MODULE_ID("$Id: wresize.c,v 1.16 2000/03/05 00:14:35 tom Exp $") +MODULE_ID("$Id: wresize.c,v 1.18 2000/12/10 02:43:28 tom Exp $") /* * Reallocate a curses WINDOW struct to either shrink or grow to the specified @@ -44,7 +44,7 @@ MODULE_ID("$Id: wresize.c,v 1.16 2000/03/05 00:14:35 tom Exp $") #define ld_ALLOC(p,n) DOALLOC(p,struct ldat,n) #define c_ALLOC(p,n) DOALLOC(p,chtype,n) -int +NCURSES_EXPORT(int) wresize(WINDOW *win, int ToLines, int ToCols) { register int row; @@ -56,9 +56,9 @@ wresize(WINDOW *win, int ToLines, int ToCols) T((T_CALLED("wresize(%p,%d,%d)"), win, ToLines, ToCols)); if (win) { TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)", - win->_begy, win->_begx, - win->_maxy, win->_maxx, - win->_regtop, win->_regbottom)); + win->_begy, win->_begx, + win->_maxy, win->_maxx, + win->_regtop, win->_regbottom)); if (_nc_tracing & TRACE_UPDATE) _tracedump("...before", win); } @@ -169,9 +169,9 @@ wresize(WINDOW *win, int ToLines, int ToCols) #ifdef TRACE TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)", - win->_begy, win->_begx, - win->_maxy, win->_maxx, - win->_regtop, win->_regbottom)); + win->_begy, win->_begx, + win->_maxy, win->_maxx, + win->_regtop, win->_regbottom)); if (_nc_tracing & TRACE_UPDATE) _tracedump("...after:", win); #endif diff --git a/contrib/ncurses/ncurses/curses.priv.h b/contrib/ncurses/ncurses/curses.priv.h index d82e3aa..042fdd1 100644 --- a/contrib/ncurses/ncurses/curses.priv.h +++ b/contrib/ncurses/ncurses/curses.priv.h @@ -33,7 +33,7 @@ /* - * $Id: curses.priv.h,v 1.168 2000/10/08 01:24:59 tom Exp $ + * $Id: curses.priv.h,v 1.171 2000/12/10 00:13:52 tom Exp $ * * curses.priv.h * @@ -45,6 +45,8 @@ #ifndef CURSES_PRIV_H #define CURSES_PRIV_H 1 +#include <ncurses_dll.h> + #ifdef __cplusplus extern "C" { #endif @@ -152,7 +154,7 @@ extern int errno; #define use_terminfo_vars() 1 #else #define use_terminfo_vars() _nc_env_access() -extern int _nc_env_access(void); +extern NCURSES_EXPORT(int) _nc_env_access (void); #endif /* @@ -163,7 +165,7 @@ extern int _nc_env_access(void); #define memmove(d,s,n) bcopy(s,d,n) #elif USE_MY_MEMMOVE #define memmove(d,s,n) _nc_memmove(d,s,n) -extern void * _nc_memmove(void *, const void *, size_t); +extern NCURSES_EXPORT(void *) _nc_memmove (void *, const void *, size_t); #endif /* @@ -414,7 +416,7 @@ struct screen { int (*_outch)(int); /* output handler if not putc */ }; -extern SCREEN *_nc_screen_chain; +extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain; #if NCURSES_NOMACROS #include <nomacros.h> @@ -484,6 +486,7 @@ 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) @@ -544,14 +547,14 @@ typedef struct { #define returnPtr(code) TRACE_RETURN(code,ptr) #define returnVoid T((T_RETURN(""))); return #define returnWin(code) TRACE_RETURN(code,win) -extern WINDOW * _nc_retrace_win(WINDOW *); -extern attr_t _nc_retrace_attr_t(attr_t); -extern attr_t _nc_retrace_chtype(chtype); -extern char *_nc_retrace_ptr(char *); -extern const char *_nc_tputs_trace; -extern int _nc_retrace_int(int); -extern long _nc_outchars; -extern void _nc_fifo_dump(void); +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(int) _nc_retrace_int (int); +extern NCURSES_EXPORT_VAR(long) _nc_outchars; +extern NCURSES_EXPORT(void) _nc_fifo_dump (void); #else #define T(a) #define TR(n, a) @@ -564,8 +567,8 @@ extern void _nc_fifo_dump(void); #define returnWin(code) return code #endif -extern unsigned _nc_tracing; -extern const char *_nc_visbuf2(int, const char *); +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; +extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *); #define _trace_key(ch) ((ch > KEY_MIN) ? keyname(ch) : _tracechar((unsigned char)ch)) @@ -636,27 +639,27 @@ extern const char *_nc_visbuf2(int, const char *); #undef toggle_attr_on #define toggle_attr_on(S,at) _nc_toggle_attr_on(&(S), at) -extern void _nc_toggle_attr_on(attr_t *, attr_t); +extern NCURSES_EXPORT(void) _nc_toggle_attr_on (attr_t *, attr_t); #undef toggle_attr_off #define toggle_attr_off(S,at) _nc_toggle_attr_off(&(S), at) -extern void _nc_toggle_attr_off(attr_t *, attr_t); +extern NCURSES_EXPORT(void) _nc_toggle_attr_off (attr_t *, attr_t); #undef DelCharCost #define DelCharCost(count) _nc_DelCharCost(count) -extern int _nc_DelCharCost(int); +extern NCURSES_EXPORT(int) _nc_DelCharCost (int); #undef InsCharCost #define InsCharCost(count) _nc_InsCharCost(count) -extern int _nc_InsCharCost(int); +extern NCURSES_EXPORT(int) _nc_InsCharCost (int); #undef UpdateAttrs #define UpdateAttrs(c) _nc_UpdateAttrs(c) -extern void _nc_UpdateAttrs(chtype); +extern NCURSES_EXPORT(void) _nc_UpdateAttrs (chtype); #else -extern void _nc_expanded(void); +extern NCURSES_EXPORT(void) _nc_expanded (void); #endif @@ -666,33 +669,33 @@ extern void _nc_expanded(void); /* doupdate.c */ #if USE_XMC_SUPPORT -extern void _nc_do_xmc_glitch(attr_t); +extern NCURSES_EXPORT(void) _nc_do_xmc_glitch (attr_t); #endif /* hardscroll.c */ #if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG) -extern void _nc_linedump(void); +extern NCURSES_EXPORT(void) _nc_linedump (void); #endif /* lib_acs.c */ -extern void _nc_init_acs(void); /* corresponds to traditional 'init_acs()' */ -extern int _nc_msec_cost(const char *const, int); /* used by 'tack' program */ +extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */ +extern NCURSES_EXPORT(int) _nc_msec_cost (const char *const, int); /* used by 'tack' program */ /* lib_mvcur.c */ #define INFINITY 1000000 /* cost: too high to use */ -extern void _nc_mvcur_init(void); -extern void _nc_mvcur_resume(void); -extern void _nc_mvcur_wrap(void); +extern NCURSES_EXPORT(void) _nc_mvcur_init (void); +extern NCURSES_EXPORT(void) _nc_mvcur_resume (void); +extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void); -extern int _nc_scrolln(int, int, int, int); +extern NCURSES_EXPORT(int) _nc_scrolln (int, int, int, int); -extern void _nc_screen_init(void); -extern void _nc_screen_resume(void); -extern void _nc_screen_wrap(void); +extern NCURSES_EXPORT(void) _nc_screen_init (void); +extern NCURSES_EXPORT(void) _nc_screen_resume (void); +extern NCURSES_EXPORT(void) _nc_screen_wrap (void); /* lib_mouse.c */ -extern int _nc_has_mouse(void); +extern NCURSES_EXPORT(int) _nc_has_mouse (void); /* lib_mvcur.c */ #define INFINITY 1000000 /* cost: too high to use */ @@ -704,78 +707,78 @@ typedef struct { } string_desc; /* strings.c */ -extern string_desc *_nc_str_init(string_desc * dst, char *src, size_t len); -extern string_desc *_nc_str_null(string_desc * dst, size_t len); -extern string_desc *_nc_str_copy(string_desc * dst, string_desc * src); -extern bool _nc_safe_strcat(string_desc * dst, const char *src); -extern bool _nc_safe_strcpy(string_desc * dst, const char *src); +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 void _nc_mvcur_init(void); -extern void _nc_mvcur_resume(void); -extern void _nc_mvcur_wrap(void); +extern NCURSES_EXPORT(void) _nc_mvcur_init (void); +extern NCURSES_EXPORT(void) _nc_mvcur_resume (void); +extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void); -extern int _nc_scrolln(int, int, int, int); +extern NCURSES_EXPORT(int) _nc_scrolln (int, int, int, int); -extern void _nc_screen_init(void); -extern void _nc_screen_resume(void); -extern void _nc_screen_wrap(void); +extern NCURSES_EXPORT(void) _nc_screen_init (void); +extern NCURSES_EXPORT(void) _nc_screen_resume (void); +extern NCURSES_EXPORT(void) _nc_screen_wrap (void); #if !HAVE_STRSTR #define strstr _nc_strstr -extern char *_nc_strstr(const char *, const char *); +extern NCURSES_EXPORT(char *) _nc_strstr (const char *, const char *); #endif /* safe_sprintf.c */ -extern char * _nc_printf_string(const char *fmt, va_list ap); +extern NCURSES_EXPORT(char *) _nc_printf_string (const char *fmt, va_list ap); /* tries.c */ -extern void _nc_add_to_try(struct tries **tree, const char *str, unsigned short code); -extern char *_nc_expand_try(struct tries *tree, unsigned short code, int *count, size_t len); -extern int _nc_remove_key(struct tries **tree, unsigned short code); -extern int _nc_remove_string(struct tries **tree, char *string); +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); /* elsewhere ... */ -extern WINDOW *_nc_makenew(int, int, int, int, int); -extern char *_nc_home_terminfo(void); -extern char *_nc_trace_buf(int, size_t); -extern chtype _nc_background(WINDOW *); -extern chtype _nc_render(WINDOW *, chtype); -extern int _nc_access(const char *, int); -extern int _nc_baudrate(int); -extern int _nc_getenv_num(const char *); -extern int _nc_keypad(bool); -extern int _nc_ospeed(int); -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, bool, int (*)(int)); -extern void _nc_freeall(void); -extern void _nc_freewin(WINDOW *win); -extern void _nc_hash_map(void); -extern void _nc_init_keytry(void); -extern void _nc_keep_tic_dir(const char *); -extern void _nc_make_oldhash(int i); -extern void _nc_flush(void); -extern void _nc_outstr(const char *str); -extern void _nc_scroll_oldhash(int n, int top, int bot); -extern void _nc_scroll_optimize(void); -extern void _nc_scroll_window(WINDOW *, int const, short const, short const, chtype); -extern void _nc_set_buffer(FILE *, bool); -extern void _nc_signal_handler(bool); -extern void _nc_synchook(WINDOW *win); -extern void _nc_trace_tries(struct tries *tree); +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(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_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(void) _nc_do_color (int, int, bool, int (*)(int)); +extern NCURSES_EXPORT(void) _nc_flush (void); +extern NCURSES_EXPORT(void) _nc_freeall (void); +extern NCURSES_EXPORT(void) _nc_hash_map (void); +extern NCURSES_EXPORT(void) _nc_init_keytry (void); +extern NCURSES_EXPORT(void) _nc_keep_tic_dir (const char *); +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_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); #if USE_SIZECHANGE -extern void _nc_update_screensize(void); +extern NCURSES_EXPORT(void) _nc_update_screensize (void); #endif #if USE_WIDEC_SUPPORT -extern int _nc_utf8_outch(int); +extern NCURSES_EXPORT(int) _nc_utf8_outch (int); #endif /* scroll indices */ -extern int *_nc_oldnums; +extern NCURSES_EXPORT_VAR(int *) _nc_oldnums; #define USE_SETBUF_0 0 @@ -791,12 +794,12 @@ extern int *_nc_oldnums; */ #if BROKEN_LINKER #define SP _nc_screen() -extern SCREEN *_nc_screen(void); -extern int _nc_alloc_screen(void); -extern void _nc_set_screen(SCREEN *); +extern NCURSES_EXPORT(SCREEN *) _nc_screen (void); +extern NCURSES_EXPORT(int) _nc_alloc_screen (void); +extern NCURSES_EXPORT(void) _nc_set_screen (SCREEN *); #else /* current screen is private data; avoid possible linking conflicts too */ -extern SCREEN *SP; +extern NCURSES_EXPORT_VAR(SCREEN *) SP; #define _nc_alloc_screen() ((SP = typeCalloc(SCREEN, 1)) != 0) #define _nc_set_screen(sp) SP = sp #endif @@ -810,8 +813,8 @@ extern SCREEN *SP; #define screen_lines SP->_lines #define screen_columns SP->_columns -extern int _nc_slk_format; /* != 0 if slk_init() called */ -extern int _nc_slk_initialize(WINDOW *, int); +extern NCURSES_EXPORT_VAR(int) _nc_slk_format; /* != 0 if slk_init() called */ +extern NCURSES_EXPORT(int) _nc_slk_initialize (WINDOW *, int); /* * Some constants related to SLK's @@ -829,7 +832,7 @@ extern int _nc_slk_initialize(WINDOW *, int); #define MAX_SKEY(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_OLD : MAX_SKEY_PC) #define MAX_SKEY_LEN(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_LEN_OLD : MAX_SKEY_LEN_PC) -extern int _nc_ripoffline(int line, int (*init)(WINDOW *,int)); +extern NCURSES_EXPORT(int) _nc_ripoffline (int line, int (*init)(WINDOW *,int)); #ifdef __cplusplus } diff --git a/contrib/ncurses/ncurses/llib-lncurses b/contrib/ncurses/ncurses/llib-lncurses index 280325a..8ea89d1 100644 --- a/contrib/ncurses/ncurses/llib-lncurses +++ b/contrib/ncurses/ncurses/llib-lncurses @@ -50,13 +50,11 @@ void _nc_linedump(void) #include <term.h> -typedef struct -{ - unsigned long hashval; - int oldcount, newcount; - int oldindex, newindex; -} - sym; +typedef struct { + unsigned long hashval; + int oldcount, newcount; + int oldindex, newindex; +} sym; #undef _nc_hash_map void _nc_hash_map(void) @@ -1241,9 +1239,9 @@ SCREEN *newterm( /* ./base/lib_newwin.c */ #undef _nc_freewin -void _nc_freewin( +int _nc_freewin( WINDOW *win) - { /* void */ } + { return(*(int *)0); } #undef newwin WINDOW *newwin( @@ -2110,7 +2108,8 @@ char *_nc_save_str( #undef _nc_wrap_entry void _nc_wrap_entry( - ENTRY *const ep) + ENTRY *const ep, + bool copy_strings) { /* void */ } #undef _nc_merge_entry @@ -2137,15 +2136,15 @@ void _nc_copy_termtype( #undef _nc_captoinfo char *_nc_captoinfo( - const char *cap, - const char *s, + const char *cap, + const char *s, int const parametrized) { return(*(char **)0); } #undef _nc_infotocap char *_nc_infotocap( - const char *cap, - const char *str, + const char *cap, + const char *str, int const parametrized) { return(*(char **)0); } @@ -2303,7 +2302,8 @@ struct token _nc_curr_token; bool _nc_disable_period; #undef _nc_get_token -int _nc_get_token(void) +int _nc_get_token( + bool silent) { return(*(int *)0); } #undef _nc_trans_string @@ -2400,8 +2400,8 @@ void _nc_init_acs(void) #include <termcap.h> struct speed { - int s; - int sp; + int s; + int sp; }; #undef _nc_baudrate @@ -2716,7 +2716,7 @@ char *tparm( #undef PC char PC; #undef ospeed -short ospeed; +NCURSES_OSPEED ospeed; #undef _nc_nulls_sent int _nc_nulls_sent; @@ -2936,6 +2936,12 @@ int _nc_read_entry( void _nc_read_termcap(void) { /* void */ } +#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 @@ -2980,8 +2986,8 @@ bool _nc_safe_strcpy( /* ./trace/trace_buf.c */ typedef struct { - char *text; - size_t size; + char *text; + size_t size; } LIST; #undef _nc_trace_buf diff --git a/contrib/ncurses/ncurses/tinfo/MKcaptab.awk b/contrib/ncurses/ncurses/tinfo/MKcaptab.awk index 910af94..ff9601b 100644 --- a/contrib/ncurses/ncurses/tinfo/MKcaptab.awk +++ b/contrib/ncurses/ncurses/tinfo/MKcaptab.awk @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: MKcaptab.awk,v 1.11 1999/01/24 02:46:42 Jeffrey.C.Honig Exp $ +# $Id: MKcaptab.awk,v 1.12 2000/12/10 00:14:12 tom Exp $ AWK=${1-awk} DATA=${2-../include/Caps} @@ -11,6 +11,7 @@ cat <<'EOF' */ #include <ncurses_cfg.h> +#include <curses.priv.h> #include <tic.h> #include <term.h> @@ -58,12 +59,12 @@ cat <<'EOF' {(char *)NULL, (char *)NULL, (char *)NULL} }; -const struct name_table_entry *_nc_get_table(bool termcap) +NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool termcap) { return termcap ? _nc_cap_table: _nc_info_table ; } -const struct name_table_entry * const * _nc_get_hash_table(bool termcap) +NCURSES_EXPORT(const struct name_table_entry * const *) _nc_get_hash_table (bool termcap) { return termcap ? _nc_cap_hash_table: _nc_info_hash_table ; } diff --git a/contrib/ncurses/ncurses/tinfo/MKfallback.sh b/contrib/ncurses/ncurses/tinfo/MKfallback.sh index 2a76f62..de3e23a 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.9 1999/06/15 22:57:45 tom Exp $ +# $Id: MKfallback.sh,v 1.10 2000/12/10 00:14:39 tom Exp $ # # MKfallback.sh -- create fallback table for entry reads # @@ -50,7 +50,7 @@ EOF fi cat <<EOF -const TERMTYPE *_nc_fallback(const char *name GCC_UNUSED) +NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *name GCC_UNUSED) { EOF diff --git a/contrib/ncurses/ncurses/tinfo/MKnames.awk b/contrib/ncurses/ncurses/tinfo/MKnames.awk index b97eccc..455efc0 100644 --- a/contrib/ncurses/ncurses/tinfo/MKnames.awk +++ b/contrib/ncurses/ncurses/tinfo/MKnames.awk @@ -1,4 +1,4 @@ -# $Id: MKnames.awk,v 1.10 1999/01/16 23:36:34 tom Exp $ +# $Id: MKnames.awk,v 1.11 2000/12/09 23:46:13 tom Exp $ BEGIN { print "/* This file was generated by MKnames.awk */" > "namehdr" print "" > "namehdr" @@ -10,7 +10,7 @@ BEGIN { print "#include <term.h>" > "namehdr" print "#define DCL(it) static IT data##it[]" > "namehdr" print "#else" > "namehdr" - print "#define DCL(it) IT it[]" > "namehdr" + print "#define DCL(it) NCURSES_EXPORT_VAR(IT) it[]" > "namehdr" print "#endif" > "namehdr" print "" > "namehdr" print "/*" > "boolnames" @@ -80,7 +80,7 @@ END { print "};" > "strcodes" print "" > "strcodes" print "#if BROKEN_LINKER" > "nameftr" - print "#define FIX(it) IT *_nc_##it(void) { return data##it; }" > "nameftr" + print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }" > "nameftr" print "FIX(boolnames)" > "nameftr" print "FIX(boolfnames)" > "nameftr" print "FIX(numnames)" > "nameftr" @@ -90,7 +90,7 @@ END { print "#endif /* BROKEN_LINKER */" > "nameftr" print "" > "codeftr" print "#if BROKEN_LINKER" > "codeftr" - print "#define FIX(it) IT *_nc_##it(void) { return data##it; }" > "codeftr" + print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }" > "codeftr" print "FIX(boolcodes)" > "codeftr" print "FIX(numcodes)" > "codeftr" print "FIX(strcodes)" > "codeftr" diff --git a/contrib/ncurses/ncurses/tinfo/access.c b/contrib/ncurses/ncurses/tinfo/access.c index 6fbe921..c8071d8 100644 --- a/contrib/ncurses/ncurses/tinfo/access.c +++ b/contrib/ncurses/ncurses/tinfo/access.c @@ -33,9 +33,9 @@ #include <curses.priv.h> #include <tic.h> -MODULE_ID("$Id: access.c,v 1.4 2000/10/08 01:25:06 tom Exp $") +MODULE_ID("$Id: access.c,v 1.7 2000/12/10 02:55:07 tom Exp $") -char * +NCURSES_EXPORT(char *) _nc_basename(char *path) { char *result = strrchr(path, '/'); @@ -50,7 +50,7 @@ _nc_basename(char *path) return result; } -int +NCURSES_EXPORT(int) _nc_access(const char *path, int mode) { if (access(path, mode) < 0) { @@ -78,7 +78,7 @@ _nc_access(const char *path, int mode) * Returns true if we allow application to use environment variables that are * used for searching lists of directories, etc. */ -int +NCURSES_EXPORT(int) _nc_env_access(void) { #if HAVE_ISSETUGID @@ -86,9 +86,9 @@ _nc_env_access(void) return FALSE; #elif HAVE_GETEUID && HAVE_GETEGID if (getuid() != geteuid() - || getgid() != getegid()) + || getgid() != getegid()) return FALSE; #endif - return getuid() != 0; /* ...finally, disallow root */ + return getuid() != 0 && geteuid() != 0; /* ...finally, disallow root */ } #endif diff --git a/contrib/ncurses/ncurses/tinfo/add_tries.c b/contrib/ncurses/ncurses/tinfo/add_tries.c index 601fb66..f83249c 100644 --- a/contrib/ncurses/ncurses/tinfo/add_tries.c +++ b/contrib/ncurses/ncurses/tinfo/add_tries.c @@ -39,12 +39,12 @@ #include <curses.priv.h> -MODULE_ID("$Id: add_tries.c,v 1.2 2000/03/18 22:23:56 tom Exp $") +MODULE_ID("$Id: add_tries.c,v 1.4 2000/12/10 02:55:07 tom Exp $") #define SET_TRY(dst,src) if ((dst->ch = *src++) == 128) dst->ch = '\0' #define CMP_TRY(a,b) ((a)? (a == b) : (b == 128)) -void +NCURSES_EXPORT(void) _nc_add_to_try(struct tries **tree, const char *str, unsigned short code) { static bool out_of_memory = FALSE; @@ -61,7 +61,7 @@ _nc_add_to_try(struct tries **tree, const char *str, unsigned short code) unsigned char cmp = *txt; while (!CMP_TRY(ptr->ch, cmp) - && ptr->sibling != 0) + && ptr->sibling != 0) ptr = ptr->sibling; if (CMP_TRY(ptr->ch, cmp)) { diff --git a/contrib/ncurses/ncurses/tinfo/alloc_entry.c b/contrib/ncurses/ncurses/tinfo/alloc_entry.c index 1748937..e668e36 100644 --- a/contrib/ncurses/ncurses/tinfo/alloc_entry.c +++ b/contrib/ncurses/ncurses/tinfo/alloc_entry.c @@ -47,7 +47,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$Id: alloc_entry.c,v 1.32 2000/03/12 00:16:31 tom Exp $") +MODULE_ID("$Id: alloc_entry.c,v 1.35 2001/01/13 22:40:17 tom Exp $") #define ABSENT_OFFSET -1 #define CANCELLED_OFFSET -2 @@ -57,7 +57,7 @@ MODULE_ID("$Id: alloc_entry.c,v 1.32 2000/03/12 00:16:31 tom Exp $") static char stringbuf[MAX_STRTAB]; /* buffer for string capabilities */ static size_t next_free; /* next free character in stringbuf */ -void +NCURSES_EXPORT(void) _nc_init_entry(TERMTYPE * const tp) /* initialize a terminal type data block */ { @@ -90,7 +90,7 @@ _nc_init_entry(TERMTYPE * const tp) next_free = 0; } -ENTRY * +NCURSES_EXPORT(ENTRY *) _nc_copy_entry(ENTRY * oldp) { ENTRY *newp = typeCalloc(ENTRY, 1); @@ -102,7 +102,7 @@ _nc_copy_entry(ENTRY * oldp) return newp; } -char * +NCURSES_EXPORT(char *) _nc_save_str(const char *const string) /* save a copy of string in the string buffer */ { @@ -118,14 +118,35 @@ _nc_save_str(const char *const string) return (stringbuf + old_next_free); } -void -_nc_wrap_entry(ENTRY * const ep) +NCURSES_EXPORT(void) +_nc_wrap_entry(ENTRY * const ep, bool copy_strings) /* copy the string parts to allocated storage, preserving pointers to it */ { int offsets[MAX_ENTRY_SIZE / 2], useoffsets[MAX_USES]; int i, n; TERMTYPE *tp = &(ep->tterm); + if (copy_strings) { + next_free = 0; /* clear static storage */ + + /* copy term_names, Strings, uses */ + tp->term_names = _nc_save_str(tp->term_names); + for_each_string(i, tp) { + if (tp->Strings[i] != ABSENT_STRING && + tp->Strings[i] != CANCELLED_STRING) { + tp->Strings[i] = _nc_save_str(tp->Strings[i]); + } + } + + for (i = 0; i < ep->nuses; i++) { + if (ep->uses[i].name == 0) { + ep->uses[i].name = _nc_save_str(ep->uses[i].name); + } + } + + free(tp->str_table); + } + n = tp->term_names - stringbuf; for_each_string(i, &(ep->tterm)) { if (tp->Strings[i] == ABSENT_STRING) @@ -158,18 +179,20 @@ _nc_wrap_entry(ENTRY * const ep) } #if NCURSES_XNAMES - if ((n = NUM_EXT_NAMES(tp)) != 0) { - unsigned length = 0; - for (i = 0; i < n; i++) { - length += strlen(tp->ext_Names[i]) + 1; - offsets[i] = tp->ext_Names[i] - stringbuf; - } - if ((tp->ext_str_table = typeMalloc(char, length)) == 0) - _nc_err_abort("Out of memory"); - for (i = 0, length = 0; i < n; i++) { - tp->ext_Names[i] = tp->ext_str_table + length; - strcpy(tp->ext_Names[i], stringbuf + offsets[i]); - length += strlen(tp->ext_Names[i]) + 1; + if (!copy_strings) { + if ((n = NUM_EXT_NAMES(tp)) != 0) { + unsigned length = 0; + for (i = 0; i < n; i++) { + length += strlen(tp->ext_Names[i]) + 1; + offsets[i] = tp->ext_Names[i] - stringbuf; + } + if ((tp->ext_str_table = typeMalloc(char, length)) == 0) + _nc_err_abort("Out of memory"); + for (i = 0, length = 0; i < n; i++) { + tp->ext_Names[i] = tp->ext_str_table + length; + strcpy(tp->ext_Names[i], stringbuf + offsets[i]); + length += strlen(tp->ext_Names[i]) + 1; + } } } #endif @@ -182,8 +205,9 @@ _nc_wrap_entry(ENTRY * const ep) } } -void -_nc_merge_entry(TERMTYPE * const to, TERMTYPE * const from) +NCURSES_EXPORT(void) +_nc_merge_entry +(TERMTYPE * const to, TERMTYPE * const from) /* merge capabilities from `from' entry into `to' entry */ { int i; diff --git a/contrib/ncurses/ncurses/tinfo/alloc_ttype.c b/contrib/ncurses/ncurses/tinfo/alloc_ttype.c index eac7c80..c13c5d6 100644 --- a/contrib/ncurses/ncurses/tinfo/alloc_ttype.c +++ b/contrib/ncurses/ncurses/tinfo/alloc_ttype.c @@ -43,7 +43,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$Id: alloc_ttype.c,v 1.10 2000/08/12 21:56:24 tom Exp $") +MODULE_ID("$Id: alloc_ttype.c,v 1.12 2000/12/10 02:55:07 tom Exp $") #if NCURSES_XNAMES /* @@ -370,8 +370,9 @@ adjust_cancels(TERMTYPE * to, TERMTYPE * from) } } -void -_nc_align_termtype(TERMTYPE * to, TERMTYPE * from) +NCURSES_EXPORT(void) +_nc_align_termtype +(TERMTYPE * to, TERMTYPE * from) { int na = NUM_EXT_NAMES(to); int nb = NUM_EXT_NAMES(from); @@ -455,8 +456,9 @@ _nc_align_termtype(TERMTYPE * to, TERMTYPE * from) } #endif -void -_nc_copy_termtype(TERMTYPE * dst, TERMTYPE * src) +NCURSES_EXPORT(void) +_nc_copy_termtype +(TERMTYPE * dst, TERMTYPE * src) { int i; diff --git a/contrib/ncurses/ncurses/tinfo/captoinfo.c b/contrib/ncurses/ncurses/tinfo/captoinfo.c index da13826..9b68cd2 100644 --- a/contrib/ncurses/ncurses/tinfo/captoinfo.c +++ b/contrib/ncurses/ncurses/tinfo/captoinfo.c @@ -39,7 +39,7 @@ * * There is just one entry point: * - * char *captoinfo(n, s, parametrized) + * char *_nc_captoinfo(n, s, parametrized) * * Convert value s for termcap string capability named n into terminfo * format. @@ -92,7 +92,7 @@ #include <ctype.h> #include <tic.h> -MODULE_ID("$Id: captoinfo.c,v 1.37 2000/04/01 20:07:34 tom Exp $") +MODULE_ID("$Id: captoinfo.c,v 1.40 2000/11/05 00:22:36 tom 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(*sp)) { + while (isdigit(CharOf(*sp))) { c = 8 * c + (*sp++ - '0'); len++; } @@ -268,13 +268,16 @@ getparm(int parm, int n) } } +/* + * Convert a termcap string to terminfo format. + * 'cap' is the relevant terminfo capability index. + * 's' is the string value of the capability. + * 'parametrized' tells what type of translations to do: + * % translations if 1 + * pad translations if >=0 + */ char * -_nc_captoinfo( -/* convert a termcap string to terminfo format */ - register const char *cap, /* relevant terminfo capability index */ - register const char *s, /* string value of the capability */ - int const parametrized /* do % translations if 1, pad translations if >=0 */ -) +_nc_captoinfo(const char *cap, const char *s, int const parametrized) { const char *capstart; @@ -291,9 +294,9 @@ _nc_captoinfo( capstart = 0; if (s == 0) s = ""; - if (parametrized >= 0 && isdigit(*s)) + if (parametrized >= 0 && isdigit(CharOf(*s))) for (capstart = s;; s++) - if (!(isdigit(*s) || *s == '*' || *s == '.')) + if (!(isdigit(CharOf(*s)) || *s == '*' || *s == '.')) break; while (*s != '\0') { @@ -349,7 +352,7 @@ _nc_captoinfo( break; case 'a': if ((*s == '=' || *s == '+' || *s == '-' - || *s == '*' || *s == '/') + || *s == '*' || *s == '/') && (s[1] == 'p' || s[1] == 'c') && s[2] != '\0') { int l; @@ -461,7 +464,7 @@ _nc_captoinfo( dp = save_char(dp, '%'); s--; _nc_warning("unknown %% code %s (%#x) in %s", - unctrl(*s), (*s) & 0xff, cap); + unctrl((chtype) * s), CharOf(*s), cap); break; } break; @@ -542,7 +545,7 @@ _nc_captoinfo( if (capstart) { dp = save_string(dp, "$<"); for (s = capstart;; s++) - if (isdigit(*s) || *s == '*' || *s == '.') + if (isdigit(CharOf(*s)) || *s == '*' || *s == '.') dp = save_char(dp, *s); else break; @@ -566,8 +569,8 @@ bcd_expression(const char *str) char ch1, ch2; if (sscanf(str, fmt, &ch1, &ch2) == 2 - && isdigit(ch1) - && isdigit(ch2) + && isdigit(CharOf(ch1)) + && isdigit(CharOf(ch2)) && (ch1 == ch2)) { len = 28; #ifndef NDEBUG @@ -594,7 +597,7 @@ save_tc_char(char *bufptr, int c1) bufptr = save_char(bufptr, c1); } else { if (c1 == (c1 & 0x1f)) /* iscntrl() returns T on 255 */ - (void) strcpy(temp, unctrl(c1)); + (void) strcpy(temp, unctrl((chtype) c1)); else (void) sprintf(temp, "\\%03o", c1); bufptr = save_string(bufptr, temp); @@ -629,13 +632,12 @@ save_tc_inequality(char *bufptr, int c1, int c2) * %m exclusive-or all parameters with 0177 (not in 4.4BSD) */ +/* + * Convert a terminfo string to termcap format. Parameters are as in + * _nc_captoinfo(). + */ char * -_nc_infotocap( -/* convert a terminfo string to termcap format */ - register const char *cap GCC_UNUSED, /* relevant termcap capability index */ - register const char *str, /* string value of the capability */ - int const parametrized /* do % translations if 1, pad translations if >=0 */ -) +_nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parametrized) { int seenone = 0, seentwo = 0, saw_m = 0, saw_n = 0; const char *padding; @@ -649,13 +651,13 @@ _nc_infotocap( padding = str + strlen(str) - 1; if (*padding == '>' && *--padding == '/') { --padding; - while (isdigit(*padding) || *padding == '.' || *padding == '*') + while (isdigit(CharOf(*padding)) || *padding == '.' || *padding == '*') padding--; if (*padding == '<' && *--padding == '$') trimmed = padding; padding += 2; - while (isdigit(*padding) || *padding == '.' || *padding == '*') + while (isdigit(CharOf(*padding)) || *padding == '.' || *padding == '*') bufptr = save_char(bufptr, *padding++); } @@ -667,8 +669,11 @@ _nc_infotocap( bufptr = save_char(bufptr, *++str); } else if (str[0] == '$' && str[1] == '<') { /* discard padding */ str += 2; - while (isdigit(*str) || *str == '.' || *str == '*' || *str == - '/' || *str == '>') + while (isdigit(CharOf(*str)) + || *str == '.' + || *str == '*' + || *str == '/' + || *str == '>') str++; --str; } else if (str[0] == '%' && str[1] == '%') { /* escaped '%' */ @@ -692,7 +697,7 @@ _nc_infotocap( bufptr = save_string(bufptr, "%B"); } else if ((sscanf(str, "%%{%d}%%+%%c", &c1) == 1 || sscanf(str, "%%'%c'%%+%%c", &ch1) == 1) - && (cp = strchr(str, '+'))) { + && (cp = strchr(str, '+'))) { str = cp + 2; bufptr = save_string(bufptr, "%+"); @@ -732,7 +737,7 @@ _nc_infotocap( case '8': case '9': bufptr = save_char(bufptr, '%'); - while (isdigit(*str)) + while (isdigit(CharOf(*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 3767063..a39de81 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 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * comp_error.c -- Error message routines * @@ -41,92 +40,98 @@ #include <tic.h> -MODULE_ID("$Id: comp_error.c,v 1.17 1999/10/30 23:00:16 tom Exp $") +MODULE_ID("$Id: comp_error.c,v 1.21 2000/12/10 02:55:07 tom Exp $") -bool _nc_suppress_warnings = FALSE; -int _nc_curr_line = 0; /* current line # in input */ -int _nc_curr_col = 0; /* current column # in input */ +NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings = FALSE; +NCURSES_EXPORT_VAR(int) +_nc_curr_line = 0; /* current line # in input */ +NCURSES_EXPORT_VAR(int) +_nc_curr_col = 0; /* current column # in input */ -static const char *sourcename; -static char termtype[MAX_NAME_SIZE+1]; + static const char *sourcename; + static char termtype[MAX_NAME_SIZE + 1]; -void _nc_set_source(const char *const name) +NCURSES_EXPORT(void) +_nc_set_source(const char *const name) { - sourcename = name; + sourcename = name; } -void _nc_set_type(const char *const name) +NCURSES_EXPORT(void) +_nc_set_type(const char *const name) { - if (name) - strncpy( termtype, name, MAX_NAME_SIZE ); - else - termtype[0] = '\0'; + termtype[0] = '\0'; + if (name) + strncat(termtype, name, sizeof(termtype) - 1); } -void _nc_get_type(char *name) +NCURSES_EXPORT(void) +_nc_get_type(char *name) { - strcpy( name, termtype ); + strcpy(name, termtype); } -static inline void where_is_problem(void) +static inline void +where_is_problem(void) { - fprintf (stderr, "\"%s\"", sourcename); - if (_nc_curr_line >= 0) - fprintf (stderr, ", line %d", _nc_curr_line); - if (_nc_curr_col >= 0) - fprintf (stderr, ", col %d", _nc_curr_col); - if (termtype[0]) - fprintf (stderr, ", terminal '%s'", termtype); - fputc(':', stderr); - fputc(' ', stderr); + fprintf(stderr, "\"%s\"", sourcename); + if (_nc_curr_line >= 0) + fprintf(stderr, ", line %d", _nc_curr_line); + if (_nc_curr_col >= 0) + fprintf(stderr, ", col %d", _nc_curr_col); + if (termtype[0]) + fprintf(stderr, ", terminal '%s'", termtype); + fputc(':', stderr); + fputc(' ', stderr); } -void _nc_warning(const char *const fmt, ...) +NCURSES_EXPORT(void) +_nc_warning(const char *const fmt,...) { -va_list argp; + va_list argp; - if (_nc_suppress_warnings) - return; + if (_nc_suppress_warnings) + return; - where_is_problem(); - va_start(argp,fmt); - vfprintf (stderr, fmt, argp); - fprintf (stderr, "\n"); - va_end(argp); + where_is_problem(); + va_start(argp, fmt); + vfprintf(stderr, fmt, argp); + fprintf(stderr, "\n"); + va_end(argp); } - -void _nc_err_abort(const char *const fmt, ...) +NCURSES_EXPORT(void) +_nc_err_abort(const char *const fmt,...) { -va_list argp; - - where_is_problem(); - va_start(argp,fmt); - vfprintf (stderr, fmt, argp); - fprintf (stderr, "\n"); - va_end(argp); - exit(EXIT_FAILURE); + va_list argp; + + where_is_problem(); + va_start(argp, fmt); + vfprintf(stderr, fmt, argp); + fprintf(stderr, "\n"); + va_end(argp); + exit(EXIT_FAILURE); } - -void _nc_syserr_abort(const char *const fmt, ...) +NCURSES_EXPORT(void) +_nc_syserr_abort(const char *const fmt,...) { -va_list argp; + va_list argp; - where_is_problem(); - va_start(argp,fmt); - vfprintf (stderr, fmt, argp); - fprintf (stderr, "\n"); - va_end(argp); + where_is_problem(); + va_start(argp, fmt); + vfprintf(stderr, fmt, argp); + fprintf(stderr, "\n"); + va_end(argp); - /* If we're debugging, try to show where the problem occurred - this - * will dump core. - */ + /* If we're debugging, try to show where the problem occurred - this + * will dump core. + */ #if defined(TRACE) || !defined(NDEBUG) - abort(); + abort(); #else - /* Dumping core in production code is not a good idea. - */ - exit(EXIT_FAILURE); + /* Dumping core in production code is not a good idea. + */ + exit(EXIT_FAILURE); #endif } diff --git a/contrib/ncurses/ncurses/tinfo/comp_expand.c b/contrib/ncurses/ncurses/tinfo/comp_expand.c index eb552fa..cf6339d 100644 --- a/contrib/ncurses/ncurses/tinfo/comp_expand.c +++ b/contrib/ncurses/ncurses/tinfo/comp_expand.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,13 +35,14 @@ #include <ctype.h> #include <tic.h> -MODULE_ID("$Id: comp_expand.c,v 1.11 1999/03/07 00:51:07 tom Exp $") +MODULE_ID("$Id: comp_expand.c,v 1.15 2000/12/10 01:30:10 tom Exp $") -static int trailing_spaces(const char *src) +static int +trailing_spaces(const char *src) { - while (*src == ' ') - src++; - return *src == 0; + while (*src == ' ') + src++; + return *src == 0; } /* this deals with differences over whether 0x7f and 0x80..0x9f are controls */ @@ -49,141 +50,136 @@ static int trailing_spaces(const char *src) #define REALCTL(s) (CHAR_OF(s) < 127 && iscntrl(CHAR_OF(s))) #define REALPRINT(s) (CHAR_OF(s) < 127 && isprint(CHAR_OF(s))) -char *_nc_tic_expand(const char *srcp, bool tic_format, int numbers) +NCURSES_EXPORT(char *) +_nc_tic_expand +(const char *srcp, bool tic_format, int numbers) { -static char * buffer; -static size_t length; + static char *buffer; + static size_t length; -int bufp; -const char *ptr, *str = VALID_STRING(srcp) ? srcp : ""; -bool islong = (strlen(str) > 3); -size_t need = (2 + strlen(str)) * 4; -int ch; + int bufp; + const char *str = VALID_STRING(srcp) ? srcp : ""; + bool islong = (strlen(str) > 3); + size_t need = (2 + strlen(str)) * 4; + int ch; - if (buffer == 0 || need > length) { - if ((buffer = typeRealloc(char, length = need, buffer)) == 0) - return 0; - } + if (buffer == 0 || need > length) { + if ((buffer = typeRealloc(char, length = need, buffer)) == 0) + return 0; + } - bufp = 0; - ptr = str; - while ((ch = (*str & 0xff)) != 0) { - if (ch == '%' && REALPRINT(str+1)) { - buffer[bufp++] = *str++; - /* - * Though the character literals are more compact, most - * terminal descriptions use numbers and are not easy - * to read in character-literal form. - */ - switch (numbers) { - case -1: - if (str[0] == S_QUOTE - && str[1] != '\\' - && REALPRINT(str+1) - && str[2] == S_QUOTE) { - sprintf(buffer+bufp, "{%d}", str[1]); - bufp += strlen(buffer+bufp); - str += 2; - } else { - buffer[bufp++] = *str; - } - break; - /* - * If we have a "%{number}", try to translate it into - * a "%'char'" form, since that will run a little faster - * when we're interpreting it. Also, having one form - * for the constant makes it simpler to compare terminal - * descriptions. - */ - case 1: - if (str[0] == L_BRACE - && isdigit(str[1])) { - char *dst = 0; - long value = strtol(str+1, &dst, 0); - if (dst != 0 - && *dst == R_BRACE - && value < 127 - && value != '\\' /* FIXME */ - && isprint((int)value)) { - ch = (int)value; - buffer[bufp++] = S_QUOTE; - if (ch == '\\' - || ch == S_QUOTE) - buffer[bufp++] = '\\'; - buffer[bufp++] = ch; - buffer[bufp++] = S_QUOTE; - str = dst; - } else { - buffer[bufp++] = *str; - } - } else { - buffer[bufp++] = *str; - } - break; - default: - buffer[bufp++] = *str; - break; - } - } - else if (ch == 128) { - buffer[bufp++] = '\\'; - buffer[bufp++] = '0'; - } - else if (ch == '\033') { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'E'; - } - else if (ch == '\\' && tic_format && (str == srcp || str[-1] != '^')) { - buffer[bufp++] = '\\'; - buffer[bufp++] = '\\'; - } - else if (ch == ' ' && tic_format && (str == srcp || trailing_spaces(str))) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 's'; + bufp = 0; + while ((ch = CharOf(*str)) != 0) { + if (ch == '%' && REALPRINT(str + 1)) { + buffer[bufp++] = *str++; + /* + * Though the character literals are more compact, most + * terminal descriptions use numbers and are not easy + * to read in character-literal form. + */ + switch (numbers) { + case -1: + if (str[0] == S_QUOTE + && str[1] != '\\' + && REALPRINT(str + 1) + && str[2] == S_QUOTE) { + sprintf(buffer + bufp, "{%d}", str[1]); + bufp += strlen(buffer + bufp); + str += 2; + } else { + buffer[bufp++] = *str; } - else if ((ch == ',' || ch == ':' || ch == '^') && tic_format) { - buffer[bufp++] = '\\'; + break; + /* + * If we have a "%{number}", try to translate it into + * a "%'char'" form, since that will run a little faster + * when we're interpreting it. Also, having one form + * for the constant makes it simpler to compare terminal + * descriptions. + */ + case 1: + if (str[0] == L_BRACE + && isdigit(CharOf(str[1]))) { + char *dst = 0; + long value = strtol(str + 1, &dst, 0); + if (dst != 0 + && *dst == R_BRACE + && value < 127 + && value != '\\' /* FIXME */ + && isprint((int) value)) { + ch = (int) value; + buffer[bufp++] = S_QUOTE; + if (ch == '\\' + || ch == S_QUOTE) + buffer[bufp++] = '\\'; buffer[bufp++] = ch; + buffer[bufp++] = S_QUOTE; + str = dst; + } else { + buffer[bufp++] = *str; + } + } else { + buffer[bufp++] = *str; } - else if (REALPRINT(str) && (ch != ',' && ch != ':' && !(ch == '!' && !tic_format) && ch != '^')) - buffer[bufp++] = ch; -#if 0 /* FIXME: this would be more readable (in fact the whole 'islong' logic should be removed) */ - else if (ch == '\b') { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'b'; - } - else if (ch == '\f') { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'f'; - } - else if (ch == '\t' && islong) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 't'; - } + break; + default: + buffer[bufp++] = *str; + break; + } + } else if (ch == 128) { + buffer[bufp++] = '\\'; + buffer[bufp++] = '0'; + } else if (ch == '\033') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'E'; + } else if (ch == '\\' && tic_format && (str == srcp || str[-1] != '^')) { + buffer[bufp++] = '\\'; + buffer[bufp++] = '\\'; + } else if (ch == ' ' && tic_format && (str == srcp || + trailing_spaces(str))) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 's'; + } else if ((ch == ',' || ch == ':' || ch == '^') && tic_format) { + buffer[bufp++] = '\\'; + buffer[bufp++] = ch; + } else if (REALPRINT(str) + && (ch != ',' + && ch != ':' + && !(ch == '!' && !tic_format) + && ch != '^')) + buffer[bufp++] = ch; +#if 0 /* FIXME: this would be more readable (in fact the whole 'islong' logic should be removed) */ + else if (ch == '\b') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'b'; + } else if (ch == '\f') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'f'; + } else if (ch == '\t' && islong) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 't'; + } #endif - else if (ch == '\r' && (islong || (strlen(srcp) > 2 && str[1] == '\0'))) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'r'; - } - else if (ch == '\n' && islong) { - buffer[bufp++] = '\\'; - buffer[bufp++] = 'n'; - } + else if (ch == '\r' && (islong || (strlen(srcp) > 2 && str[1] == '\0'))) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'r'; + } else if (ch == '\n' && islong) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'n'; + } #define UnCtl(c) ((c) + '@') - else if (REALCTL(str) && ch != '\\' && (!islong || isdigit(str[1]))) - { - (void) sprintf(&buffer[bufp], "^%c", UnCtl(ch)); - bufp += 2; - } - else - { - (void) sprintf(&buffer[bufp], "\\%03o", ch); - bufp += 4; - } - - str++; + else if (REALCTL(str) && ch != '\\' + && (!islong || isdigit(CharOf(str[1])))) { + (void) sprintf(&buffer[bufp], "^%c", UnCtl(ch)); + bufp += 2; + } else { + (void) sprintf(&buffer[bufp], "\\%03o", ch); + bufp += 4; } - buffer[bufp] = '\0'; - return(buffer); + str++; + } + + buffer[bufp] = '\0'; + return (buffer); } diff --git a/contrib/ncurses/ncurses/tinfo/comp_hash.c b/contrib/ncurses/ncurses/tinfo/comp_hash.c index 7e0bdd0..fb18e3a 100644 --- a/contrib/ncurses/ncurses/tinfo/comp_hash.c +++ b/contrib/ncurses/ncurses/tinfo/comp_hash.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * comp_hash.c --- Routines to deal with the hashtable of capability * names. @@ -46,12 +45,12 @@ #ifdef MAIN_PROGRAM #include <ctype.h> #undef DEBUG -#define DEBUG(level, params) /*nothing*/ +#define DEBUG(level, params) /*nothing */ #endif -MODULE_ID("$Id: comp_hash.c,v 1.21 1999/06/26 21:25:11 tom Exp $") +MODULE_ID("$Id: comp_hash.c,v 1.24 2000/12/10 02:55:07 tom Exp $") -static int hash_function(const char *); +static int hash_function(const char *); /* * _nc_make_hash_table() @@ -65,32 +64,33 @@ static int hash_function(const char *); #ifdef MAIN_PROGRAM #undef MODULE_ID -#define MODULE_ID(id) /*nothing*/ +#define MODULE_ID(id) /*nothing */ #include <tinfo/doalloc.c> -static void _nc_make_hash_table(struct name_table_entry *table, - struct name_table_entry **hash_table) +static void +_nc_make_hash_table(struct name_table_entry *table, + struct name_table_entry **hash_table) { -int i; -int hashvalue; -int collisions = 0; + int i; + int hashvalue; + int collisions = 0; - for (i = 0; i < CAPTABSIZE; i++) { - hashvalue = hash_function(table[i].nte_name); + for (i = 0; i < CAPTABSIZE; i++) { + hashvalue = hash_function(table[i].nte_name); - if (hash_table[hashvalue] != (struct name_table_entry *) 0) - collisions++; + if (hash_table[hashvalue] != (struct name_table_entry *) 0) + collisions++; - if (hash_table[hashvalue] != 0) - table[i].nte_link = (short)(hash_table[hashvalue] - table); - hash_table[hashvalue] = &table[i]; - } + if (hash_table[hashvalue] != 0) + table[i].nte_link = (short) (hash_table[hashvalue] - table); + hash_table[hashvalue] = &table[i]; + } - DEBUG(4, ("Hash table complete: %d collisions out of %d entries", collisions, CAPTABSIZE)); + DEBUG(4, ("Hash table complete: %d collisions out of %d entries", + collisions, CAPTABSIZE)); } #endif - /* * int hash_function(string) * @@ -105,19 +105,18 @@ static int hash_function(const char *string) { -long sum = 0; + long sum = 0; - DEBUG(9, ("hashing %s", string)); - while (*string) { - sum += (long)(*string + (*(string + 1) << 8)); - string++; - } + DEBUG(9, ("hashing %s", string)); + while (*string) { + sum += (long) (*string + (*(string + 1) << 8)); + string++; + } - DEBUG(9, ("sum is %ld", sum)); - return (int)(sum % HASHTABSIZE); + DEBUG(9, ("sum is %ld", sum)); + return (int) (sum % HASHTABSIZE); } - /* * struct name_table_entry * * find_entry(string) @@ -128,23 +127,24 @@ long sum = 0; */ #ifndef MAIN_PROGRAM -struct name_table_entry const * -_nc_find_entry(const char *string, const struct name_table_entry *const *hash_table) +NCURSES_EXPORT(struct name_table_entry const *) +_nc_find_entry +(const char *string, const struct name_table_entry *const *hash_table) { -int hashvalue; -struct name_table_entry const *ptr; + int hashvalue; + struct name_table_entry const *ptr; - hashvalue = hash_function(string); + hashvalue = hash_function(string); - if ((ptr = hash_table[hashvalue]) != 0) { - while (strcmp(ptr->nte_name, string) != 0) { - if (ptr->nte_link < 0) - return 0; - ptr = ptr->nte_link + hash_table[HASHTABSIZE]; - } + if ((ptr = hash_table[hashvalue]) != 0) { + while (strcmp(ptr->nte_name, string) != 0) { + if (ptr->nte_link < 0) + return 0; + ptr = ptr->nte_link + hash_table[HASHTABSIZE]; } + } - return (ptr); + return (ptr); } /* @@ -158,19 +158,20 @@ struct name_table_entry const *ptr; * in the table or 0 if not found. */ -struct name_table_entry const * -_nc_find_type_entry(const char *string, - int type, - const struct name_table_entry *table) +NCURSES_EXPORT(struct name_table_entry const *) +_nc_find_type_entry +(const char *string, + int type, + const struct name_table_entry *table) { -struct name_table_entry const *ptr; + struct name_table_entry const *ptr; - for (ptr = table; ptr < table + CAPTABSIZE; ptr++) { - if (ptr->nte_type == type && strcmp(string, ptr->nte_name) == 0) - return(ptr); - } + for (ptr = table; ptr < table + CAPTABSIZE; ptr++) { + if (ptr->nte_type == type && strcmp(string, ptr->nte_name) == 0) + return (ptr); + } - return ((struct name_table_entry *)NULL); + return ((struct name_table_entry *) NULL); } #endif @@ -187,139 +188,144 @@ struct name_table_entry const *ptr; #define MAX_COLUMNS BUFSIZ /* this _has_ to be worst-case */ -static char **parse_columns(char *buffer) +static char ** +parse_columns(char *buffer) { - static char **list; - - int col = 0; - - if (list == 0 && (list = typeCalloc(char *, MAX_COLUMNS)) == 0) - return(0); - - if (*buffer != '#') { - while (*buffer != '\0') { - char *s; - for (s = buffer; (*s != '\0') && !isspace(*s); s++) - /*EMPTY*/; - if (s != buffer) { - char mark = *s; - *s = '\0'; - if ((s - buffer) > 1 - && (*buffer == '"') - && (s[-1] == '"')) { /* strip the quotes */ - buffer++; - s[-1] = '\0'; - } - list[col] = buffer; - col++; - if (mark == '\0') - break; - while (*++s && isspace(*s)) - /*EMPTY*/; - buffer = s; - } else - break; + static char **list; + + int col = 0; + + if (list == 0 && (list = typeCalloc(char *, MAX_COLUMNS)) == 0) + return (0); + + if (*buffer != '#') { + while (*buffer != '\0') { + char *s; + for (s = buffer; (*s != '\0') && !isspace(CharOf(*s)); s++) + /*EMPTY */ ; + if (s != buffer) { + char mark = *s; + *s = '\0'; + if ((s - buffer) > 1 + && (*buffer == '"') + && (s[-1] == '"')) { /* strip the quotes */ + buffer++; + s[-1] = '\0'; } + list[col] = buffer; + col++; + if (mark == '\0') + break; + while (*++s && isspace(CharOf(*s))) + /*EMPTY */ ; + buffer = s; + } else + break; } - return col ? list : 0; + } + return col ? list : 0; } -int main(int argc, char **argv) +int +main(int argc, char **argv) { - struct name_table_entry *name_table = typeCalloc(struct name_table_entry, CAPTABSIZE); - struct name_table_entry **hash_table = typeCalloc(struct name_table_entry *, HASHTABSIZE); - const char *root_name = ""; - int column = 0; - int n; - char buffer[BUFSIZ]; - - static const char * typenames[] = { "BOOLEAN", "NUMBER", "STRING" }; - - short BoolCount = 0; - short NumCount = 0; - short StrCount = 0; - - /* The first argument is the column-number (starting with 0). - * The second is the root name of the tables to generate. - */ - if (argc <= 2 - || (column = atoi(argv[1])) <= 0 - || (column >= MAX_COLUMNS) - || *(root_name = argv[2]) == 0) { - fprintf(stderr, "usage: make_hash column root_name\n"); - exit(EXIT_FAILURE); + struct name_table_entry *name_table = typeCalloc(struct + name_table_entry, CAPTABSIZE); + struct name_table_entry **hash_table = typeCalloc(struct name_table_entry + *, HASHTABSIZE); + const char *root_name = ""; + int column = 0; + int n; + char buffer[BUFSIZ]; + + static const char *typenames[] = + {"BOOLEAN", "NUMBER", "STRING"}; + + short BoolCount = 0; + short NumCount = 0; + short StrCount = 0; + + /* The first argument is the column-number (starting with 0). + * The second is the root name of the tables to generate. + */ + if (argc <= 2 + || (column = atoi(argv[1])) <= 0 + || (column >= MAX_COLUMNS) + || *(root_name = argv[2]) == 0) { + fprintf(stderr, "usage: make_hash column root_name\n"); + exit(EXIT_FAILURE); + } + + /* + * Read the table into our arrays. + */ + for (n = 0; (n < CAPTABSIZE) && fgets(buffer, BUFSIZ, stdin);) { + char **list, *nlp = strchr(buffer, '\n'); + if (nlp) + *nlp = '\0'; + list = parse_columns(buffer); + if (list == 0) /* blank or comment */ + continue; + name_table[n].nte_link = -1; /* end-of-hash */ + name_table[n].nte_name = strdup(list[column]); + if (!strcmp(list[2], "bool")) { + name_table[n].nte_type = BOOLEAN; + name_table[n].nte_index = BoolCount++; + } else if (!strcmp(list[2], "num")) { + name_table[n].nte_type = NUMBER; + name_table[n].nte_index = NumCount++; + } else if (!strcmp(list[2], "str")) { + name_table[n].nte_type = STRING; + name_table[n].nte_index = StrCount++; + } else { + fprintf(stderr, "Unknown type: %s\n", list[2]); + exit(EXIT_FAILURE); } - - /* - * Read the table into our arrays. - */ - for (n = 0; (n < CAPTABSIZE) && fgets(buffer, BUFSIZ, stdin); ) { - char **list, *nlp = strchr(buffer, '\n'); - if (nlp) - *nlp = '\0'; - list = parse_columns(buffer); - if (list == 0) /* blank or comment */ - continue; - name_table[n].nte_link = -1; /* end-of-hash */ - name_table[n].nte_name = strdup(list[column]); - if (!strcmp(list[2], "bool")) { - name_table[n].nte_type = BOOLEAN; - name_table[n].nte_index = BoolCount++; - } else if (!strcmp(list[2], "num")) { - name_table[n].nte_type = NUMBER; - name_table[n].nte_index = NumCount++; - } else if (!strcmp(list[2], "str")) { - name_table[n].nte_type = STRING; - name_table[n].nte_index = StrCount++; - } else { - fprintf(stderr, "Unknown type: %s\n", list[2]); - exit(EXIT_FAILURE); - } - n++; + n++; + } + _nc_make_hash_table(name_table, hash_table); + + /* + * Write the compiled tables to standard output + */ + printf("static struct name_table_entry const _nc_%s_table[] =\n", + root_name); + printf("{\n"); + for (n = 0; n < CAPTABSIZE; n++) { + sprintf(buffer, "\"%s\"", + name_table[n].nte_name); + printf("\t{ %15s,\t%10s,\t%3d, %3d }%c\n", + buffer, + typenames[name_table[n].nte_type], + name_table[n].nte_index, + name_table[n].nte_link, + n < CAPTABSIZE - 1 ? ',' : ' '); + } + printf("};\n\n"); + + printf("const struct name_table_entry * const _nc_%s_hash_table[%d] =\n", + root_name, + HASHTABSIZE + 1); + printf("{\n"); + for (n = 0; n < HASHTABSIZE; n++) { + if (hash_table[n] != 0) { + sprintf(buffer, "_nc_%s_table + %3ld", + root_name, + (long) (hash_table[n] - name_table)); + } else { + strcpy(buffer, "0"); } - _nc_make_hash_table(name_table, hash_table); - - /* - * Write the compiled tables to standard output - */ - printf("static struct name_table_entry const _nc_%s_table[] =\n", - root_name); - printf("{\n"); - for (n = 0; n < CAPTABSIZE; n++) { - sprintf(buffer, "\"%s\"", - name_table[n].nte_name); - printf("\t{ %15s,\t%10s,\t%3d, %3d }%c\n", - buffer, - typenames[name_table[n].nte_type], - name_table[n].nte_index, - name_table[n].nte_link, - n < CAPTABSIZE - 1 ? ',' : ' '); - } - printf("};\n\n"); - - printf("const struct name_table_entry * const _nc_%s_hash_table[%d] =\n", - root_name, - HASHTABSIZE+1); - printf("{\n"); - for (n = 0; n < HASHTABSIZE; n++) { - if (hash_table[n] != 0) { - sprintf(buffer, "_nc_%s_table + %3ld", - root_name, - (long) (hash_table[n] - name_table)); - } else { - strcpy(buffer, "0"); - } - printf("\t%s,\n", buffer); - } - printf("\t_nc_%s_table\t/* base-of-table */\n", root_name); - printf("};\n\n"); - - printf("#if (BOOLCOUNT!=%d)||(NUMCOUNT!=%d)||(STRCOUNT!=%d)\n", - BoolCount, NumCount, StrCount); - printf("#error\t--> term.h and comp_captab.c disagree about the <--\n"); - printf("#error\t--> numbers of booleans, numbers and/or strings <--\n"); - printf("#endif\n\n"); - - return EXIT_SUCCESS; + printf("\t%s,\n", buffer); + } + printf("\t_nc_%s_table\t/* base-of-table */\n", root_name); + printf("};\n\n"); + + printf("#if (BOOLCOUNT!=%d)||(NUMCOUNT!=%d)||(STRCOUNT!=%d)\n", + BoolCount, NumCount, StrCount); + printf("#error\t--> term.h and comp_captab.c disagree about the <--\n"); + printf("#error\t--> numbers of booleans, numbers and/or strings <--\n"); + printf("#endif\n\n"); + + return EXIT_SUCCESS; } #endif diff --git a/contrib/ncurses/ncurses/tinfo/comp_parse.c b/contrib/ncurses/ncurses/tinfo/comp_parse.c index c408387..917f95c 100644 --- a/contrib/ncurses/ncurses/tinfo/comp_parse.c +++ b/contrib/ncurses/ncurses/tinfo/comp_parse.c @@ -52,10 +52,10 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$Id: comp_parse.c,v 1.41 2000/10/03 09:53:49 tom Exp $") +MODULE_ID("$Id: comp_parse.c,v 1.48 2001/01/15 00:44:51 tom Exp $") static void sanity_check(TERMTYPE *); -void (*_nc_check_termtype) (TERMTYPE *) = sanity_check; +NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype) (TERMTYPE *) = sanity_check; /**************************************************************************** * @@ -78,10 +78,11 @@ void (*_nc_check_termtype) (TERMTYPE *) = sanity_check; * _nc_head _nc_tail */ -ENTRY *_nc_head = 0, *_nc_tail = 0; +NCURSES_EXPORT_VAR(ENTRY *) _nc_head = 0; +NCURSES_EXPORT_VAR(ENTRY *) _nc_tail = 0; -static void -enqueue(ENTRY * ep) + static void + enqueue(ENTRY * ep) /* add an entry to the in-core list */ { ENTRY *newp = _nc_copy_entry(ep); @@ -97,7 +98,7 @@ enqueue(ENTRY * ep) newp->last->next = newp; } -void +NCURSES_EXPORT(void) _nc_free_entries(ENTRY * headp) /* free the allocated storage consumed by list entries */ { @@ -127,7 +128,7 @@ force_bar(char *dst, char *src) { if (strchr(src, '|') == 0) { size_t len = strlen(src); - if (len >= MAX_NAME_SIZE) + if (len > MAX_NAME_SIZE) len = MAX_NAME_SIZE; (void) strncpy(dst, src, len); (void) strcpy(dst + len, "|"); @@ -136,7 +137,7 @@ force_bar(char *dst, char *src) return src; } -bool +NCURSES_EXPORT(bool) _nc_entry_match(char *n1, char *n2) /* do any of the aliases in a pair of terminal names match? */ { @@ -161,10 +162,10 @@ _nc_entry_match(char *n1, char *n2) * ****************************************************************************/ -void +NCURSES_EXPORT(void) _nc_read_entry_source(FILE * fp, char *buf, - int literal, bool silent, - bool(*hook) (ENTRY *)) + int literal, bool silent, + bool(*hook) (ENTRY *)) /* slurp all entries in the given file into core */ { ENTRY thisentry; @@ -179,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(thisentry.tterm.term_names[0])) + if (!isalnum(CharOf(thisentry.tterm.term_names[0]))) _nc_err_abort("terminal names must start with letter or digit"); /* @@ -209,7 +210,7 @@ _nc_read_entry_source(FILE * fp, char *buf, _nc_suppress_warnings = oldsuppress; } -int +NCURSES_EXPORT(int) _nc_resolve_uses(bool fullresolve) /* try to resolve all use capabilities */ { @@ -226,17 +227,18 @@ _nc_resolve_uses(bool fullresolve) for_entry_list(qp) { int matchcount = 0; - for_entry_list(rp) + for_entry_list(rp) { if (qp > rp - && _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) { - matchcount++; - if (matchcount == 1) { - (void) fprintf(stderr, "Name collision between %s", - _nc_first_name(qp->tterm.term_names)); - multiples++; + && _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) { + matchcount++; + if (matchcount == 1) { + (void) fprintf(stderr, "Name collision between %s", + _nc_first_name(qp->tterm.term_names)); + multiples++; + } + if (matchcount >= 1) + (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names)); } - if (matchcount >= 1) - (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names)); } if (matchcount >= 1) (void) putc('\n', stderr); @@ -264,14 +266,15 @@ _nc_resolve_uses(bool fullresolve) _nc_set_type(child); /* first, try to resolve from in-core records */ - for_entry_list(rp) + for_entry_list(rp) { if (rp != qp - && _nc_name_match(rp->tterm.term_names, lookfor, "|")) { - DEBUG(2, ("%s: resolving use=%s (in core)", - child, lookfor)); + && _nc_name_match(rp->tterm.term_names, lookfor, "|")) { + DEBUG(2, ("%s: resolving use=%s (in core)", + child, lookfor)); - qp->uses[i].link = rp; - foundit = TRUE; + qp->uses[i].link = rp; + foundit = TRUE; + } } /* if that didn't work, try to merge in a compiled entry */ @@ -282,7 +285,7 @@ _nc_resolve_uses(bool fullresolve) memset(&thisterm, 0, sizeof(thisterm)); if (_nc_read_entry(lookfor, filename, &thisterm) == 1) { DEBUG(2, ("%s: resolving use=%s (compiled)", - child, lookfor)); + child, lookfor)); rp = typeMalloc(ENTRY, 1); if (rp == 0) @@ -330,7 +333,7 @@ _nc_resolve_uses(bool fullresolve) for_entry_list(qp) { if (qp->nuses > 0) { DEBUG(2, ("%s: attempting merge", - _nc_first_name(qp->tterm.term_names))); + _nc_first_name(qp->tterm.term_names))); /* * If any of the use entries we're looking for is * incomplete, punt. We'll catch this entry on a @@ -339,7 +342,7 @@ _nc_resolve_uses(bool fullresolve) for (i = 0; i < qp->nuses; i++) if (qp->uses[i].link->nuses) { DEBUG(2, ("%s: use entry %d unresolved", - _nc_first_name(qp->tterm.term_names), i)); + _nc_first_name(qp->tterm.term_names), i)); goto incomplete; } @@ -357,7 +360,7 @@ _nc_resolve_uses(bool fullresolve) */ for (; qp->nuses; qp->nuses--) _nc_merge_entry(&merged, - &qp->uses[qp->nuses - 1].link->tterm); + &qp->uses[qp->nuses - 1].link->tterm); /* * Now merge in the original entry. @@ -371,6 +374,7 @@ _nc_resolve_uses(bool fullresolve) FreeIfNeeded(qp->tterm.Numbers); FreeIfNeeded(qp->tterm.Strings); qp->tterm = merged; + _nc_wrap_entry(qp, TRUE); /* * We know every entry is resolvable because name resolution @@ -392,15 +396,18 @@ _nc_resolve_uses(bool fullresolve) * entry there should be no cancellation markers. */ for_entry_list(qp) { - for_each_boolean(j, &(qp->tterm)) - if (qp->tterm.Booleans[j] == CANCELLED_BOOLEAN) - qp->tterm.Booleans[j] = ABSENT_BOOLEAN; - for_each_number(j, &(qp->tterm)) + for_each_boolean(j, &(qp->tterm)) { + if ((int) qp->tterm.Booleans[j] == CANCELLED_BOOLEAN) + qp->tterm.Booleans[j] = ABSENT_BOOLEAN; + } + for_each_number(j, &(qp->tterm)) { if (qp->tterm.Numbers[j] == CANCELLED_NUMERIC) - qp->tterm.Numbers[j] = ABSENT_NUMERIC; - for_each_string(j, &(qp->tterm)) + qp->tterm.Numbers[j] = ABSENT_NUMERIC; + } + for_each_string(j, &(qp->tterm)) { if (qp->tterm.Strings[j] == CANCELLED_STRING) - qp->tterm.Strings[j] = ABSENT_STRING; + qp->tterm.Strings[j] = ABSENT_STRING; + } } } @@ -444,14 +451,14 @@ sanity_check(TERMTYPE * tp) bool terminal_entry = !strchr(tp->term_names, '+'); if (terminal_entry && (PRESENT(set_attributes) - || PRESENT(enter_standout_mode) - || PRESENT(enter_underline_mode) - || PRESENT(enter_blink_mode) - || PRESENT(enter_bold_mode) - || PRESENT(enter_dim_mode) - || PRESENT(enter_secure_mode) - || PRESENT(enter_protected_mode) - || PRESENT(enter_reverse_mode))) + || PRESENT(enter_standout_mode) + || PRESENT(enter_underline_mode) + || PRESENT(enter_blink_mode) + || PRESENT(enter_bold_mode) + || PRESENT(enter_dim_mode) + || PRESENT(enter_secure_mode) + || PRESENT(enter_protected_mode) + || PRESENT(enter_reverse_mode))) _nc_warning("no exit_attribute_mode"); #endif /* __UNUSED__ */ PAIRED(enter_standout_mode, exit_standout_mode) diff --git a/contrib/ncurses/ncurses/tinfo/comp_scan.c b/contrib/ncurses/ncurses/tinfo/comp_scan.c index e1118f6..a6ad55f 100644 --- a/contrib/ncurses/ncurses/tinfo/comp_scan.c +++ b/contrib/ncurses/ncurses/tinfo/comp_scan.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 * @@ -50,7 +50,7 @@ #include <term_entry.h> #include <tic.h> -MODULE_ID("$Id: comp_scan.c,v 1.47 2000/09/24 01:15:17 tom Exp $") +MODULE_ID("$Id: comp_scan.c,v 1.56 2001/04/21 18:53:34 tom Exp $") /* * Maximum length of string capability we'll accept before raising an error. @@ -60,14 +60,22 @@ MODULE_ID("$Id: comp_scan.c,v 1.47 2000/09/24 01:15:17 tom Exp $") #define iswhite(ch) (ch == ' ' || ch == '\t') -int _nc_syntax = 0; /* termcap or terminfo? */ -long _nc_curr_file_pos = 0; /* file offset of current line */ -long _nc_comment_start = 0; /* start of comment range before name */ -long _nc_comment_end = 0; /* end of comment range before name */ -long _nc_start_line = 0; /* start line of current entry */ - -struct token _nc_curr_token = -{0, 0, 0}; +NCURSES_EXPORT_VAR(int) +_nc_syntax = 0; /* termcap or terminfo? */ +NCURSES_EXPORT_VAR(long) +_nc_curr_file_pos = 0; /* file offset of current line */ +NCURSES_EXPORT_VAR(long) +_nc_comment_start = 0; /* start of comment range before name */ +NCURSES_EXPORT_VAR(long) +_nc_comment_end = 0; /* end of comment range before name */ +NCURSES_EXPORT_VAR(long) +_nc_start_line = 0; /* start line of current entry */ + +NCURSES_EXPORT_VAR(struct token) +_nc_curr_token = +{ + 0, 0, 0 +}; /***************************************************************************** * @@ -81,7 +89,8 @@ static int pushtype; /* type of pushback token */ static char pushname[MAX_NAME_SIZE + 1]; #if NCURSES_EXT_FUNCS -bool _nc_disable_period = FALSE; /* used by tic -a option */ +NCURSES_EXPORT_VAR(bool) +_nc_disable_period = FALSE; /* used by tic -a option */ #endif static int last_char(void); @@ -133,8 +142,8 @@ eat_escaped_newline(int ch) * */ -int -_nc_get_token(void) +NCURSES_EXPORT(int) +_nc_get_token(bool silent) { static const char terminfo_punct[] = "@%&*!#"; long number; @@ -202,8 +211,9 @@ _nc_get_token(void) && !(ch == '.' && _nc_disable_period) #endif && !strchr(terminfo_punct, (char) ch)) { - _nc_warning("Illegal character (expected alphanumeric or %s) - %s", - terminfo_punct, unctrl(ch)); + if (!silent) + _nc_warning("Illegal character (expected alphanumeric or %s) - %s", + terminfo_punct, unctrl((chtype) ch)); _nc_panic_mode(separator); goto start_token; } @@ -230,13 +240,11 @@ _nc_get_token(void) _nc_syntax = SYN_TERMINFO; separator = ','; /* - * Fall-through here is not an accident. - * The idea is that if we see a comma, we - * figure this is terminfo unless we - * subsequently run into a colon -- but - * we don't stop looking for that colon until - * hitting a newline. This allows commas to - * be embedded in description fields of + * Fall-through here is not an accident. The idea is that + * if we see a comma, we figure this is terminfo unless we + * subsequently run into a colon -- but we don't stop + * looking for that colon until hitting a newline. This + * allows commas to be embedded in description fields of * either syntax. */ /* FALLTHRU */ @@ -248,11 +256,10 @@ _nc_get_token(void) ptr[0] = '\0'; if (_nc_syntax == ERR) { /* - * Grrr...what we ought to do here is barf, - * complaining that the entry is malformed. - * But because a couple of name fields in the - * 8.2 termcap file end with |\, we just have - * to assume it's termcap syntax. + * Grrr...what we ought to do here is barf, complaining that + * the entry is malformed. But because a couple of name fields + * in the 8.2 termcap file end with |\, we just have to assume + * it's termcap syntax. */ _nc_syntax = SYN_TERMCAP; separator = ':'; @@ -264,8 +271,8 @@ _nc_get_token(void) } /* - * This is the soonest we have the terminal name - * fetched. Set up for following warning messages. + * This is the soonest we have the terminal name fetched. Set up + * for following warning messages. */ ptr = strchr(buffer, '|'); if (ptr == (char *) NULL) @@ -276,11 +283,11 @@ _nc_get_token(void) *ptr = ch; /* - * Compute the boundary between the aliases and the - * description field for syntax-checking purposes. + * Compute the boundary between the aliases and the description + * field for syntax-checking purposes. */ desc = strrchr(buffer, '|'); - if (desc) { + if (!silent && desc) { if (*desc == '\0') _nc_warning("empty longname field"); else if (strchr(desc, ' ') == (char *) NULL) @@ -290,20 +297,22 @@ _nc_get_token(void) desc = buffer + strlen(buffer); /* - * Whitespace in a name field other than the long name - * can confuse rdist and some termcap tools. Slashes - * are a no-no. Other special characters can be - * dangerous due to shell expansion. + * Whitespace in a name field other than the long name can confuse + * rdist and some termcap tools. Slashes are a no-no. Other + * special characters can be dangerous due to shell expansion. */ for (ptr = buffer; ptr < desc; ptr++) { - if (isspace(*ptr)) { - _nc_warning("whitespace in name or alias field"); + if (isspace(CharOf(*ptr))) { + if (!silent) + _nc_warning("whitespace in name or alias field"); break; } else if (*ptr == '/') { - _nc_warning("slashes aren't allowed in names or aliases"); + if (!silent) + _nc_warning("slashes aren't allowed in names or aliases"); break; } else if (strchr("$[]!*?", *ptr)) { - _nc_warning("dubious character `%c' in name or alias field", *ptr); + if (!silent) + _nc_warning("dubious character `%c' in name or alias field", *ptr); break; } } @@ -336,9 +345,9 @@ _nc_get_token(void) type = BOOLEAN; break; case '@': - if ((ch = next_char()) != separator) + if ((ch = next_char()) != separator && !silent) _nc_warning("Missing separator after `%s', have %s", - buffer, unctrl(ch)); + buffer, unctrl((chtype) ch)); _nc_curr_token.tk_name = buffer; type = CANCEL; break; @@ -352,10 +361,12 @@ _nc_get_token(void) } numbuf[found] = '\0'; number = strtol(numbuf, &numchk, 0); - if (numchk == numbuf) - _nc_warning("no value given for `%s'", buffer); - if ((*numchk != '\0') || (ch != separator)) - _nc_warning("Missing separator"); + if (!silent) { + if (numchk == numbuf) + _nc_warning("no value given for `%s'", buffer); + if ((*numchk != '\0') || (ch != separator)) + _nc_warning("Missing separator"); + } _nc_curr_token.tk_name = buffer; _nc_curr_token.tk_valnumber = number; type = NUMBER; @@ -363,7 +374,7 @@ _nc_get_token(void) case '=': ch = _nc_trans_string(ptr, buffer + sizeof(buffer)); - if (ch != separator) + if (!silent && ch != separator) _nc_warning("Missing separator"); _nc_curr_token.tk_name = buffer; _nc_curr_token.tk_valstring = ptr; @@ -376,7 +387,8 @@ _nc_get_token(void) default: /* just to get rid of the compiler warning */ type = UNDEF; - _nc_warning("Illegal character - %s", unctrl(ch)); + if (!silent) + _nc_warning("Illegal character - %s", unctrl((chtype) ch)); } } /* end else (first_column == FALSE) */ } /* end else (ch != EOF) */ @@ -428,9 +440,12 @@ _nc_get_token(void) #endif if (dot_flag == TRUE) /* if commented out, use the next one */ - type = _nc_get_token(); + type = _nc_get_token(silent); - DEBUG(3, ("token: `%s', class %d", _nc_curr_token.tk_name, type)); + DEBUG(3, ("token: `%s', class %d", + _nc_curr_token.tk_name != 0 ? _nc_curr_token.tk_name : + "<null>", + type)); return (type); } @@ -454,11 +469,11 @@ _nc_get_token(void) * */ -char +NCURSES_EXPORT(char) _nc_trans_string(char *ptr, char *last) { int count = 0; - int number; + int number = 0; int i, c; chtype ch, last_ch = '\0'; bool ignored = FALSE; @@ -608,14 +623,14 @@ _nc_trans_string(char *ptr, char *last) * get_token() call. */ -void +NCURSES_EXPORT(void) _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. + * 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. */ pushtype = tokclass; _nc_get_type(pushname); @@ -627,7 +642,7 @@ _nc_push_token(int tokclass) /* * Panic mode error recovery - skip everything until a "ch" is found. */ -void +NCURSES_EXPORT(void) _nc_panic_mode(char ch) { int c; @@ -661,7 +676,7 @@ static FILE *yyin; /* scanner's input file descriptor */ * non-null. */ -void +NCURSES_EXPORT(void) _nc_reset_input(FILE * fp, char *buf) { pushtype = NO_PUSHBACK; @@ -684,7 +699,7 @@ last_char(void) { size_t len = strlen(bufptr); while (len--) { - if (!isspace(bufptr[len])) + if (!isspace(CharOf(bufptr[len]))) return bufptr[len]; } return 0; @@ -708,6 +723,10 @@ static int next_char(void) { if (!yyin) { + /* + * An string with an embedded null will truncate the input. This is + * intentional (we don't read binary files here). + */ if (*bufptr == '\0') return (EOF); if (*bufptr == '\n') { @@ -716,52 +735,61 @@ next_char(void) } } else if (!bufptr || !*bufptr) { /* - * In theory this could be recoded to do its I/O one - * character at a time, saving the buffer space. In - * practice, this turns out to be quite hard to get - * completely right. Try it and see. If you succeed, - * don't forget to hack push_back() correspondingly. + * In theory this could be recoded to do its I/O one character at a + * time, saving the buffer space. In practice, this turns out to be + * quite hard to get completely right. Try it and see. If you + * succeed, don't forget to hack push_back() correspondingly. */ - static char line[LEXBUFSIZ]; + static char *result; + static size_t allocated; + size_t used; size_t len; do { - _nc_curr_file_pos = ftell(yyin); - - if ((bufstart = fgets(line, LEXBUFSIZ, yyin)) != NULL) { - _nc_curr_line++; - _nc_curr_col = 0; - } - bufptr = bufstart; - } while - (bufstart != NULL && line[0] == '#'); - - if (bufstart == NULL || *bufstart == 0) - return (EOF); - - while (iswhite(*bufptr)) - bufptr++; - - /* - * Treat a trailing <cr><lf> the same as a <newline> so we can read - * files on OS/2, etc. - */ - if ((len = strlen(bufptr)) > 1) { - if (bufptr[len - 1] == '\n' - && bufptr[len - 2] == '\r') { - len--; - bufptr[len - 1] = '\n'; - bufptr[len] = '\0'; - } - } + bufstart = 0; + used = 0; + do { + if (used + (LEXBUFSIZ / 4) >= allocated) { + allocated += (allocated + LEXBUFSIZ); + result = _nc_doalloc(result, allocated); + if (result == 0) + return (EOF); + } + if (used == 0) + _nc_curr_file_pos = ftell(yyin); + + if (fgets(result + used, allocated - used, yyin) != NULL) { + bufstart = result; + if (used == 0) { + _nc_curr_line++; + _nc_curr_col = 0; + } + } else { + if (used != 0) + strcat(result, "\n"); + } + if ((bufptr = bufstart) != 0) { + used = strlen(bufptr); + while (iswhite(*bufptr)) + bufptr++; - /* - * If we don't have a trailing newline, it's because the line is simply - * too long. Give up. (FIXME: We could instead reallocate the line - * buffer and allow arbitrary-length lines). - */ - if (len == 0 || (bufptr[len - 1] != '\n')) - return (EOF); + /* + * Treat a trailing <cr><lf> the same as a <newline> so we + * can read files on OS/2, etc. + */ + if ((len = strlen(bufptr)) > 1) { + if (bufptr[len - 1] == '\n' + && bufptr[len - 2] == '\r') { + len--; + bufptr[len - 1] = '\n'; + bufptr[len] = '\0'; + } + } + } else { + return (EOF); + } + } while (bufptr[len - 1] != '\n'); /* complete a line */ + } while (result[0] == '#'); /* ignore comments */ } first_column = (bufptr == bufstart); @@ -793,5 +821,3 @@ end_of_stream(void) return ((yyin ? feof(yyin) : (bufptr && *bufptr == '\0')) ? TRUE : FALSE); } - -/* comp_scan.c ends here */ diff --git a/contrib/ncurses/ncurses/tinfo/doalloc.c b/contrib/ncurses/ncurses/tinfo/doalloc.c index 84471fb..634469c 100644 --- a/contrib/ncurses/ncurses/tinfo/doalloc.c +++ b/contrib/ncurses/ncurses/tinfo/doalloc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,7 +30,6 @@ * Author: Thomas E. Dickey <dickey@clark.net> 1998 * ****************************************************************************/ - /* * Wrapper for malloc/realloc. Standard implementations allow realloc with * a null pointer, but older libraries may not (e.g., SunOS). @@ -40,31 +39,33 @@ #include <curses.priv.h> -MODULE_ID("$Id: doalloc.c,v 1.5 1999/03/14 12:25:27 tom Exp $") +MODULE_ID("$Id: doalloc.c,v 1.7 2000/12/10 02:55:07 tom Exp $") -void *_nc_doalloc(void *oldp, size_t amount) +NCURSES_EXPORT(void *) +_nc_doalloc(void *oldp, size_t amount) { - void *newp; + void *newp; - if (oldp != 0) { - if ((newp = realloc(oldp, amount)) == 0) { - free(oldp); - errno = ENOMEM; /* just in case 'free' reset */ - } - } else { - newp = typeMalloc(char, amount); + if (oldp != 0) { + if ((newp = realloc(oldp, amount)) == 0) { + free(oldp); + errno = ENOMEM; /* just in case 'free' reset */ } - return newp; + } else { + newp = typeMalloc(char, amount); + } + return newp; } #if !HAVE_STRDUP -char *_nc_strdup(const char *src) +NCURSES_EXPORT(char *) +_nc_strdup(const char *src) { char *dst; if (src != 0) { dst = typeMalloc(char, strlen(src) + 1); if (dst != 0) { - (void)strcpy(dst, src); + (void) strcpy(dst, src); } } else { dst = 0; diff --git a/contrib/ncurses/ncurses/tinfo/free_ttype.c b/contrib/ncurses/ncurses/tinfo/free_ttype.c index aba1aeb..df604e4 100644 --- a/contrib/ncurses/ncurses/tinfo/free_ttype.c +++ b/contrib/ncurses/ncurses/tinfo/free_ttype.c @@ -30,7 +30,6 @@ * Author: Thomas E. Dickey <dickey@clark.net> 1999 * ****************************************************************************/ - /* * free_ttype.c -- allocation functions for TERMTYPE * @@ -44,9 +43,10 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$Id: free_ttype.c,v 1.5 2000/07/08 00:43:58 tom Exp $") +MODULE_ID("$Id: free_ttype.c,v 1.7 2000/12/10 02:55:07 tom Exp $") -void _nc_free_termtype(TERMTYPE *ptr) +NCURSES_EXPORT(void) +_nc_free_termtype(TERMTYPE * ptr) { FreeIfNeeded(ptr->str_table); FreeIfNeeded(ptr->term_names); @@ -61,9 +61,10 @@ void _nc_free_termtype(TERMTYPE *ptr) } #if NCURSES_XNAMES -bool _nc_user_definable = TRUE; +NCURSES_EXPORT_VAR(bool) _nc_user_definable = TRUE; -int use_extended_names(bool flag) +NCURSES_EXPORT(int) +use_extended_names(bool flag) { int oldflag = _nc_user_definable; _nc_user_definable = flag; diff --git a/contrib/ncurses/ncurses/tinfo/getenv_num.c b/contrib/ncurses/ncurses/tinfo/getenv_num.c index 6294404..a90cc08 100644 --- a/contrib/ncurses/ncurses/tinfo/getenv_num.c +++ b/contrib/ncurses/ncurses/tinfo/getenv_num.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,21 +36,21 @@ #include <curses.priv.h> -MODULE_ID("$Id: getenv_num.c,v 1.1 1998/09/19 21:30:23 tom Exp $") +MODULE_ID("$Id: getenv_num.c,v 1.3 2000/12/10 02:55:07 tom Exp $") -int +NCURSES_EXPORT(int) _nc_getenv_num(const char *name) { - char *dst = 0; - char *src = getenv(name); - long value; + char *dst = 0; + char *src = getenv(name); + long value; - if ((src == 0) - || (value = strtol(src, &dst, 0)) < 0 - || (dst == src) - || (*dst != '\0') - || (int)value < value) - value = -1; + if ((src == 0) + || (value = strtol(src, &dst, 0)) < 0 + || (dst == src) + || (*dst != '\0') + || (int) value < value) + value = -1; - return (int) value; + return (int) value; } diff --git a/contrib/ncurses/ncurses/tinfo/home_terminfo.c b/contrib/ncurses/ncurses/tinfo/home_terminfo.c index 69b8a96..47b3e38 100644 --- a/contrib/ncurses/ncurses/tinfo/home_terminfo.c +++ b/contrib/ncurses/ncurses/tinfo/home_terminfo.c @@ -37,13 +37,13 @@ #include <curses.priv.h> #include <tic.h> -MODULE_ID("$Id: home_terminfo.c,v 1.3 2000/10/04 02:31:53 tom Exp $"); +MODULE_ID("$Id: home_terminfo.c,v 1.6 2000/12/10 02:55:07 tom Exp $") #define my_length (strlen(home) + sizeof(PRIVATE_INFO)) /* ncurses extension...fall back on user's private directory */ -char * +NCURSES_EXPORT(char *) _nc_home_terminfo(void) { char *home; diff --git a/contrib/ncurses/ncurses/tinfo/init_keytry.c b/contrib/ncurses/ncurses/tinfo/init_keytry.c index 1134480..cf840e8 100644 --- a/contrib/ncurses/ncurses/tinfo/init_keytry.c +++ b/contrib/ncurses/ncurses/tinfo/init_keytry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -28,11 +28,11 @@ #include <curses.priv.h> -#include <term.h> /* keypad_xmit, keypad_local, meta_on, meta_off */ +#include <term.h> /* keypad_xmit, keypad_local, meta_on, meta_off */ /* cursor_visible,cursor_normal,cursor_invisible */ -#include <tic.h> /* struct tinfo_fkeys */ +#include <tic.h> /* struct tinfo_fkeys */ -MODULE_ID("$Id: init_keytry.c,v 1.3 2000/03/12 02:55:50 Todd.C.Miller Exp $") +MODULE_ID("$Id: init_keytry.c,v 1.5 2000/12/10 02:55:07 tom Exp $") /* ** _nc_init_keytry() @@ -52,27 +52,29 @@ MODULE_ID("$Id: init_keytry.c,v 1.3 2000/03/12 02:55:50 Todd.C.Miller Exp $") #endif*/ #if BROKEN_LINKER -struct tinfo_fkeys *_nc_tinfo_fkeysf(void) +struct tinfo_fkeys * +_nc_tinfo_fkeysf(void) { - return _nc_tinfo_fkeys; + return _nc_tinfo_fkeys; } #endif -void _nc_init_keytry(void) +NCURSES_EXPORT(void) +_nc_init_keytry(void) { - size_t n; + size_t n; - /* The SP->_keytry value is initialized in newterm(), where the SP - * structure is created, because we can not tell where keypad() or - * mouse_activate() (which will call keyok()) are first called. - */ + /* The SP->_keytry value is initialized in newterm(), where the SP + * structure is created, because we can not tell where keypad() or + * mouse_activate() (which will call keyok()) are first called. + */ - for (n = 0; _nc_tinfo_fkeys[n].code; n++) - if (_nc_tinfo_fkeys[n].offset < STRCOUNT) - _nc_add_to_try(&(SP->_keytry), - CUR Strings[_nc_tinfo_fkeys[n].offset], - _nc_tinfo_fkeys[n].code); + for (n = 0; _nc_tinfo_fkeys[n].code; n++) + if (_nc_tinfo_fkeys[n].offset < STRCOUNT) + _nc_add_to_try(&(SP->_keytry), + CUR Strings[_nc_tinfo_fkeys[n].offset], + _nc_tinfo_fkeys[n].code); #ifdef TRACE - _nc_trace_tries(SP->_keytry); + _nc_trace_tries(SP->_keytry); #endif } diff --git a/contrib/ncurses/ncurses/tinfo/lib_acs.c b/contrib/ncurses/ncurses/tinfo/lib_acs.c index 6f07791..54554a8 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 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,109 +31,133 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - #include <curses.priv.h> -#include <term.h> /* ena_acs, acs_chars */ - -MODULE_ID("$Id: lib_acs.c,v 1.16 1999/10/30 23:00:16 tom Exp $") +#include <term.h> /* ena_acs, acs_chars */ -chtype acs_map[ACS_LEN] = { 0 }; +MODULE_ID("$Id: lib_acs.c,v 1.18 2000/12/10 02:55:07 tom Exp $") -void _nc_init_acs(void) +NCURSES_EXPORT_VAR(chtype) acs_map[ACS_LEN] = { - T(("initializing ACS map")); + 0 +}; - /* - * Initializations for a UNIX-like multi-terminal environment. Use - * ASCII chars and count on the terminfo description to do better. - */ - ACS_ULCORNER = '+'; /* should be upper left corner */ - ACS_LLCORNER = '+'; /* should be lower left corner */ - ACS_URCORNER = '+'; /* should be upper right corner */ - ACS_LRCORNER = '+'; /* should be lower right corner */ - ACS_RTEE = '+'; /* should be tee pointing left */ - ACS_LTEE = '+'; /* should be tee pointing right */ - ACS_BTEE = '+'; /* should be tee pointing up */ - ACS_TTEE = '+'; /* should be tee pointing down */ - ACS_HLINE = '-'; /* should be horizontal line */ - ACS_VLINE = '|'; /* should be vertical line */ - ACS_PLUS = '+'; /* should be large plus or crossover */ - ACS_S1 = '~'; /* should be scan line 1 */ - ACS_S9 = '_'; /* should be scan line 9 */ - ACS_DIAMOND = '+'; /* should be diamond */ - ACS_CKBOARD = ':'; /* should be checker board (stipple) */ - ACS_DEGREE = '\''; /* should be degree symbol */ - ACS_PLMINUS = '#'; /* should be plus/minus */ - ACS_BULLET = 'o'; /* should be bullet */ - ACS_LARROW = '<'; /* should be arrow pointing left */ - ACS_RARROW = '>'; /* should be arrow pointing right */ - ACS_DARROW = 'v'; /* should be arrow pointing down */ - ACS_UARROW = '^'; /* should be arrow pointing up */ - ACS_BOARD = '#'; /* should be board of squares */ - ACS_LANTERN = '#'; /* should be lantern symbol */ - ACS_BLOCK = '#'; /* should be solid square block */ - /* these defaults were invented for ncurses */ - ACS_S3 = '-'; /* should be scan line 3 */ - ACS_S7 = '-'; /* should be scan line 7 */ - ACS_LEQUAL = '<'; /* should be less-than-or-equal-to */ - ACS_GEQUAL = '>'; /* should be greater-than-or-equal-to */ - ACS_PI = '*'; /* should be greek pi */ - ACS_NEQUAL = '!'; /* should be not-equal */ - ACS_STERLING = 'f'; /* should be pound-sterling symbol */ +NCURSES_EXPORT(void) +_nc_init_acs(void) +{ + T(("initializing ACS map")); - if (ena_acs != NULL) - { - TPUTS_TRACE("ena_acs"); - putp(ena_acs); - } + /* + * Initializations for a UNIX-like multi-terminal environment. Use + * ASCII chars and count on the terminfo description to do better. + */ + ACS_ULCORNER = '+'; /* should be upper left corner */ + ACS_LLCORNER = '+'; /* should be lower left corner */ + ACS_URCORNER = '+'; /* should be upper right corner */ + ACS_LRCORNER = '+'; /* should be lower right corner */ + ACS_RTEE = '+'; /* should be tee pointing left */ + ACS_LTEE = '+'; /* should be tee pointing right */ + ACS_BTEE = '+'; /* should be tee pointing up */ + ACS_TTEE = '+'; /* should be tee pointing down */ + ACS_HLINE = '-'; /* should be horizontal line */ + ACS_VLINE = '|'; /* should be vertical line */ + ACS_PLUS = '+'; /* should be large plus or crossover */ + ACS_S1 = '~'; /* should be scan line 1 */ + ACS_S9 = '_'; /* should be scan line 9 */ + ACS_DIAMOND = '+'; /* should be diamond */ + ACS_CKBOARD = ':'; /* should be checker board (stipple) */ + ACS_DEGREE = '\''; /* should be degree symbol */ + ACS_PLMINUS = '#'; /* should be plus/minus */ + ACS_BULLET = 'o'; /* should be bullet */ + ACS_LARROW = '<'; /* should be arrow pointing left */ + ACS_RARROW = '>'; /* should be arrow pointing right */ + ACS_DARROW = 'v'; /* should be arrow pointing down */ + ACS_UARROW = '^'; /* should be arrow pointing up */ + ACS_BOARD = '#'; /* should be board of squares */ + ACS_LANTERN = '#'; /* should be lantern symbol */ + ACS_BLOCK = '#'; /* should be solid square block */ + /* these defaults were invented for ncurses */ + ACS_S3 = '-'; /* should be scan line 3 */ + ACS_S7 = '-'; /* should be scan line 7 */ + ACS_LEQUAL = '<'; /* should be less-than-or-equal-to */ + ACS_GEQUAL = '>'; /* should be greater-than-or-equal-to */ + ACS_PI = '*'; /* should be greek pi */ + ACS_NEQUAL = '!'; /* should be not-equal */ + ACS_STERLING = 'f'; /* should be pound-sterling symbol */ + if (ena_acs != NULL) { + TPUTS_TRACE("ena_acs"); + putp(ena_acs); + } #define ALTCHAR(c) ((chtype)(((unsigned char)(c)) | A_ALTCHARSET)) - if (acs_chars != NULL) { - size_t i = 0; - size_t length = strlen(acs_chars); + if (acs_chars != NULL) { + size_t i = 0; + size_t length = strlen(acs_chars); - while (i < length) - switch (acs_chars[i]) { - case 'l':case 'm':case 'k':case 'j': - case 'u':case 't':case 'v':case 'w': - case 'q':case 'x':case 'n':case 'o': - case 's':case '`':case 'a':case 'f': - case 'g':case '~':case ',':case '+': - case '.':case '-':case 'h':case 'i': - case '0':case 'p':case 'r':case 'y': - case 'z':case '{':case '|':case '}': - acs_map[(unsigned int)acs_chars[i]] = - ALTCHAR(acs_chars[i+1]); - i++; - /* FALLTHRU */ - default: - i++; - break; - } - } + while (i < length) + switch (acs_chars[i]) { + case 'l': + case 'm': + case 'k': + case 'j': + case 'u': + case 't': + case 'v': + case 'w': + case 'q': + case 'x': + case 'n': + case 'o': + case 's': + case '`': + case 'a': + case 'f': + case 'g': + case '~': + case ',': + case '+': + case '.': + case '-': + case 'h': + case 'i': + case '0': + case 'p': + case 'r': + case 'y': + case 'z': + case '{': + case '|': + case '}': + acs_map[(unsigned int) acs_chars[i]] = + ALTCHAR(acs_chars[i + 1]); + i++; + /* FALLTHRU */ + default: + i++; + break; + } + } #ifdef TRACE - /* Show the equivalent mapping, noting if it does not match the - * given attribute, whether by re-ordering or duplication. - */ - 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++) { - if (acs_map[n] != 0) { - show[m++] = (char)n; - show[m++] = TextOf(acs_map[n]); - } - } - show[m] = 0; - _tracef("%s acs_chars %s", - (acs_chars == NULL) - ? "NULL" - : (strcmp(acs_chars, show) - ? "DIFF" - : "SAME"), - _nc_visbuf(show)); + /* Show the equivalent mapping, noting if it does not match the + * given attribute, whether by re-ordering or duplication. + */ + 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++) { + if (acs_map[n] != 0) { + show[m++] = (char) n; + show[m++] = TextOf(acs_map[n]); + } } + show[m] = 0; + _tracef("%s acs_chars %s", + (acs_chars == NULL) + ? "NULL" + : (strcmp(acs_chars, show) + ? "DIFF" + : "SAME"), + _nc_visbuf(show)); + } #endif /* TRACE */ } diff --git a/contrib/ncurses/ncurses/tinfo/lib_baudrate.c b/contrib/ncurses/ncurses/tinfo/lib_baudrate.c index 0d7fa27..ff3455a 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_baudrate.c +++ b/contrib/ncurses/ncurses/tinfo/lib_baudrate.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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 <term.h> /* cur_term, pad_char */ #include <termcap.h> /* ospeed */ -MODULE_ID("$Id: lib_baudrate.c,v 1.17 2000/10/08 00:59:08 tom Exp $") +MODULE_ID("$Id: lib_baudrate.c,v 1.19 2000/12/10 02:55:07 tom Exp $") /* * int @@ -51,8 +51,8 @@ MODULE_ID("$Id: lib_baudrate.c,v 1.17 2000/10/08 00:59:08 tom Exp $") */ struct speed { - int s; /* value for 'ospeed' is an index */ - int sp; /* the actual speed */ + int s; /* value for 'ospeed' is an index */ + int sp; /* the actual speed */ }; static struct speed const speeds[] = @@ -99,7 +99,7 @@ static struct speed const speeds[] = #endif }; -int +NCURSES_EXPORT(int) _nc_baudrate(int OSpeed) { static int last_OSpeed; @@ -125,7 +125,7 @@ _nc_baudrate(int OSpeed) return (result); } -int +NCURSES_EXPORT(int) _nc_ospeed(int BaudRate) { int result = 1; @@ -142,7 +142,7 @@ _nc_ospeed(int BaudRate) return (result); } -int +NCURSES_EXPORT(int) baudrate(void) { int result; diff --git a/contrib/ncurses/ncurses/tinfo/lib_cur_term.c b/contrib/ncurses/ncurses/tinfo/lib_cur_term.c index 7d0aa12..8f269e5 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_cur_term.c +++ b/contrib/ncurses/ncurses/tinfo/lib_cur_term.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free 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,34 +37,36 @@ */ #include <curses.priv.h> -#include <term_entry.h> /* TTY, cur_term */ -#include <termcap.h> /* ospeed */ +#include <term_entry.h> /* TTY, cur_term */ +#include <termcap.h> /* ospeed */ -MODULE_ID("$Id: lib_cur_term.c,v 1.9 1999/10/30 23:00:16 tom Exp $") +MODULE_ID("$Id: lib_cur_term.c,v 1.11 2000/12/10 02:55:07 tom Exp $") -TERMINAL *cur_term = 0; +NCURSES_EXPORT_VAR(TERMINAL *) cur_term = 0; -TERMINAL *set_curterm(TERMINAL *termp) +NCURSES_EXPORT(TERMINAL *) +set_curterm(TERMINAL * termp) { - TERMINAL *oldterm = cur_term; + TERMINAL *oldterm = cur_term; - if ((cur_term = termp) != 0) { - ospeed = _nc_ospeed(cur_term->_baudrate); - PC = (pad_char != NULL) ? pad_char[0] : 0; - } - return oldterm; + if ((cur_term = termp) != 0) { + ospeed = _nc_ospeed(cur_term->_baudrate); + PC = (pad_char != NULL) ? pad_char[0] : 0; + } + return oldterm; } -int del_curterm(TERMINAL *termp) +NCURSES_EXPORT(int) +del_curterm(TERMINAL * termp) { - T((T_CALLED("del_curterm(%p)"), termp)); + T((T_CALLED("del_curterm(%p)"), termp)); - if (termp != 0) { - _nc_free_termtype(&(termp->type)); - free(termp); - if (termp == cur_term) - cur_term = 0; - returnCode(OK); - } - returnCode(ERR); + if (termp != 0) { + _nc_free_termtype(&(termp->type)); + free(termp); + if (termp == cur_term) + cur_term = 0; + returnCode(OK); + } + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_data.c b/contrib/ncurses/ncurses/tinfo/lib_data.c index d2d0d3f..87d60ed 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_data.c +++ b/contrib/ncurses/ncurses/tinfo/lib_data.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,2000 Free 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,17 +40,20 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_data.c,v 1.14 1999/01/31 01:34:33 Ilya.Zakharevich Exp $") +MODULE_ID("$Id: lib_data.c,v 1.16 2000/12/10 02:55:07 tom Exp $") /* * OS/2's native linker complains if we don't initialize public data when * constructing a dll (reported by J.J.G.Ripoll). */ -WINDOW *stdscr = 0; -WINDOW *curscr = 0; -WINDOW *newscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) +stdscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) +curscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) +newscr = 0; -SCREEN *_nc_screen_chain = 0; +NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain = 0; /* * The variable 'SP' will be defined as a function on systems that cannot link @@ -63,22 +66,26 @@ SCREEN *_nc_screen_chain = 0; * module coupling that increases the size of the executable. */ #if BROKEN_LINKER -static SCREEN *my_screen; + static SCREEN *my_screen; -SCREEN *_nc_screen(void) +NCURSES_EXPORT(SCREEN *) +_nc_screen(void) { - return my_screen; + return my_screen; } -int _nc_alloc_screen(void) +NCURSES_EXPORT(int) +_nc_alloc_screen(void) { - return ((my_screen = typeCalloc(SCREEN, 1)) != 0); + return ((my_screen = typeCalloc(SCREEN, 1)) != 0); } -void _nc_set_screen(SCREEN *sp) +NCURSES_EXPORT(void) +_nc_set_screen(SCREEN * sp) { - my_screen = sp; + my_screen = sp; } + #else -SCREEN *SP = NULL; /* Some linkers require initialized data... */ +NCURSES_EXPORT_VAR(SCREEN *) SP = NULL; /* Some linkers require initialized data... */ #endif diff --git a/contrib/ncurses/ncurses/tinfo/lib_has_cap.c b/contrib/ncurses/ncurses/tinfo/lib_has_cap.c index 7121fc7..6fb7b3a 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_has_cap.c +++ b/contrib/ncurses/ncurses/tinfo/lib_has_cap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_has_cap.c ** @@ -43,21 +42,23 @@ #include <term.h> -MODULE_ID("$Id: lib_has_cap.c,v 1.1 1998/10/23 15:32:21 tom Exp $") +MODULE_ID("$Id: lib_has_cap.c,v 1.3 2000/12/10 02:55:07 tom Exp $") -bool has_ic(void) +NCURSES_EXPORT(bool) +has_ic(void) { - T((T_CALLED("has_ic()"))); - returnCode(cur_term && - (insert_character || parm_ich - || (enter_insert_mode && exit_insert_mode)) - && (delete_character || parm_dch)); + T((T_CALLED("has_ic()"))); + returnCode(cur_term && + (insert_character || parm_ich + || (enter_insert_mode && exit_insert_mode)) + && (delete_character || parm_dch)); } -bool has_il(void) +NCURSES_EXPORT(bool) +has_il(void) { - T((T_CALLED("has_il()"))); - returnCode(cur_term - && (insert_line || parm_insert_line) - && (delete_line || parm_delete_line)); + T((T_CALLED("has_il()"))); + returnCode(cur_term + && (insert_line || parm_insert_line) + && (delete_line || parm_delete_line)); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_kernel.c b/contrib/ncurses/ncurses/tinfo/lib_kernel.c index 3c8c88e..ab8e4db 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_kernel.c +++ b/contrib/ncurses/ncurses/tinfo/lib_kernel.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* * lib_kernel.c * @@ -46,9 +45,9 @@ */ #include <curses.priv.h> -#include <term.h> /* cur_term */ +#include <term.h> /* cur_term */ -MODULE_ID("$Id: lib_kernel.c,v 1.19 1998/12/20 00:18:45 tom Exp $") +MODULE_ID("$Id: lib_kernel.c,v 1.21 2000/12/10 02:55:07 tom Exp $") /* * erasechar() @@ -57,23 +56,21 @@ MODULE_ID("$Id: lib_kernel.c,v 1.19 1998/12/20 00:18:45 tom Exp $") * */ -char +NCURSES_EXPORT(char) erasechar(void) { - T((T_CALLED("erasechar()"))); + T((T_CALLED("erasechar()"))); - if (cur_term != 0) { + if (cur_term != 0) { #ifdef TERMIOS - returnCode(cur_term->Ottyb.c_cc[VERASE]); + returnCode(cur_term->Ottyb.c_cc[VERASE]); #else - returnCode(cur_term->Ottyb.sg_erase); + returnCode(cur_term->Ottyb.sg_erase); #endif - } - returnCode(ERR); + } + returnCode(ERR); } - - /* * killchar() * @@ -81,23 +78,21 @@ erasechar(void) * */ -char +NCURSES_EXPORT(char) killchar(void) { - T((T_CALLED("killchar()"))); + T((T_CALLED("killchar()"))); - if (cur_term != 0) { + if (cur_term != 0) { #ifdef TERMIOS - returnCode(cur_term->Ottyb.c_cc[VKILL]); + returnCode(cur_term->Ottyb.c_cc[VKILL]); #else - returnCode(cur_term->Ottyb.sg_kill); + returnCode(cur_term->Ottyb.sg_kill); #endif - } - returnCode(ERR); + } + returnCode(ERR); } - - /* * flushinp() * @@ -105,26 +100,27 @@ killchar(void) * */ -int flushinp(void) +NCURSES_EXPORT(int) +flushinp(void) { - T((T_CALLED("flushinp()"))); + T((T_CALLED("flushinp()"))); - if (cur_term != 0) { + if (cur_term != 0) { #ifdef TERMIOS - tcflush(cur_term->Filedes, TCIFLUSH); + tcflush(cur_term->Filedes, TCIFLUSH); #else - errno = 0; - do { - ioctl(cur_term->Filedes, TIOCFLUSH, 0); - } while - (errno == EINTR); + errno = 0; + do { + ioctl(cur_term->Filedes, TIOCFLUSH, 0); + } while + (errno == EINTR); #endif - if (SP) { - SP->_fifohead = -1; - SP->_fifotail = 0; - SP->_fifopeek = 0; - } - returnCode(OK); + if (SP) { + SP->_fifohead = -1; + SP->_fifotail = 0; + SP->_fifopeek = 0; } - returnCode(ERR); + returnCode(OK); + } + returnCode(ERR); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_longname.c b/contrib/ncurses/ncurses/tinfo/lib_longname.c index 766e56c..1301ee5 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_longname.c +++ b/contrib/ncurses/ncurses/tinfo/lib_longname.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /* ** lib_longname.c ** @@ -41,18 +40,18 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_longname.c,v 1.7 1999/01/03 01:47:45 tom Exp $") +MODULE_ID("$Id: lib_longname.c,v 1.9 2000/12/10 02:55:07 tom Exp $") -char * +NCURSES_EXPORT(char *) longname(void) { -char *ptr; + char *ptr; - T((T_CALLED("longname()"))); + T((T_CALLED("longname()"))); - for (ptr = ttytype + strlen(ttytype); ptr > ttytype; ptr--) - if (*ptr == '|') - returnPtr(ptr + 1); + for (ptr = ttytype + strlen(ttytype); ptr > ttytype; ptr--) + if (*ptr == '|') + returnPtr(ptr + 1); - returnPtr(ttytype); + returnPtr(ttytype); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_napms.c b/contrib/ncurses/ncurses/tinfo/lib_napms.c index 1bd5c64..df1c2e4 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_napms.c +++ b/contrib/ncurses/ncurses/tinfo/lib_napms.c @@ -58,9 +58,9 @@ #endif #endif -MODULE_ID("$Id: lib_napms.c,v 1.9 2000/04/29 23:42:56 tom Exp $") +MODULE_ID("$Id: lib_napms.c,v 1.11 2000/12/10 02:55:07 tom Exp $") -int +NCURSES_EXPORT(int) napms(int ms) { T((T_CALLED("napms(%d)"), ms)); diff --git a/contrib/ncurses/ncurses/tinfo/lib_options.c b/contrib/ncurses/ncurses/tinfo/lib_options.c index fc3dc42..581357d 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_options.c +++ b/contrib/ncurses/ncurses/tinfo/lib_options.c @@ -42,9 +42,9 @@ #include <term.h> -MODULE_ID("$Id: lib_options.c,v 1.40 2000/09/02 18:02:05 tom Exp $") +MODULE_ID("$Id: lib_options.c,v 1.42 2000/12/10 02:55:07 tom Exp $") -int +NCURSES_EXPORT(int) idlok(WINDOW *win, bool flag) { T((T_CALLED("idlok(%p,%d)"), win, flag)); @@ -56,7 +56,7 @@ idlok(WINDOW *win, bool flag) returnCode(ERR); } -void +NCURSES_EXPORT(void) idcok(WINDOW *win, bool flag) { T((T_CALLED("idcok(%p,%d)"), win, flag)); @@ -67,7 +67,7 @@ idcok(WINDOW *win, bool flag) returnVoid; } -int +NCURSES_EXPORT(int) halfdelay(int t) { T((T_CALLED("halfdelay(%d)"), t)); @@ -80,7 +80,7 @@ halfdelay(int t) returnCode(OK); } -int +NCURSES_EXPORT(int) nodelay(WINDOW *win, bool flag) { T((T_CALLED("nodelay(%p,%d)"), win, flag)); @@ -95,7 +95,7 @@ nodelay(WINDOW *win, bool flag) returnCode(ERR); } -int +NCURSES_EXPORT(int) notimeout(WINDOW *win, bool f) { T((T_CALLED("notimout(%p,%d)"), win, f)); @@ -107,7 +107,7 @@ notimeout(WINDOW *win, bool f) returnCode(ERR); } -void +NCURSES_EXPORT(void) wtimeout(WINDOW *win, int delay) { T((T_CALLED("wtimeout(%p,%d)"), win, delay)); @@ -117,7 +117,7 @@ wtimeout(WINDOW *win, int delay) } } -int +NCURSES_EXPORT(int) keypad(WINDOW *win, bool flag) { T((T_CALLED("keypad(%p,%d)"), win, flag)); @@ -129,7 +129,7 @@ keypad(WINDOW *win, bool flag) returnCode(ERR); } -int +NCURSES_EXPORT(int) meta(WINDOW *win GCC_UNUSED, bool flag) { /* Ok, we stay relaxed and don't signal an error if win is NULL */ @@ -149,7 +149,7 @@ meta(WINDOW *win GCC_UNUSED, bool flag) /* curs_set() moved here to narrow the kernel interface */ -int +NCURSES_EXPORT(int) curs_set(int vis) { int cursor = SP->_cursor; @@ -191,7 +191,7 @@ curs_set(int vis) returnCode(cursor == -1 ? 1 : cursor); } -int +NCURSES_EXPORT(int) typeahead(int fd) { T((T_CALLED("typeahead(%d)"), fd)); @@ -216,10 +216,10 @@ has_key_internal(int keycode, struct tries *tp) return (TRUE); else return (has_key_internal(keycode, tp->child) - || has_key_internal(keycode, tp->sibling)); + || has_key_internal(keycode, tp->sibling)); } -int +NCURSES_EXPORT(int) has_key(int keycode) { T((T_CALLED("has_key(%d)"), keycode)); @@ -234,7 +234,7 @@ has_key(int keycode) * flush, then the next wgetch may get the escape sequence that corresponds to * the terminal state _before_ switching modes. */ -int +NCURSES_EXPORT(int) _nc_keypad(bool flag) { if (flag && keypad_xmit) { diff --git a/contrib/ncurses/ncurses/tinfo/lib_print.c b/contrib/ncurses/ncurses/tinfo/lib_print.c index 63ac648..291e84c 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_print.c +++ b/contrib/ncurses/ncurses/tinfo/lib_print.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,49 +31,44 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - #include <curses.priv.h> #include <term.h> -MODULE_ID("$Id: lib_print.c,v 1.11 1999/02/27 19:59:05 tom Exp $") +MODULE_ID("$Id: lib_print.c,v 1.13 2000/12/10 02:55:07 tom Exp $") -int mcprint(char *data, int len) +NCURSES_EXPORT(int) +mcprint(char *data, int len) /* ship binary character data to the printer via mc4/mc5/mc5p */ { - char *mybuf, *switchon; - size_t onsize, offsize, res; + char *mybuf, *switchon; + size_t onsize, offsize, res; errno = 0; - if (!cur_term || (!prtr_non && (!prtr_on || !prtr_off))) - { + if (!cur_term || (!prtr_non && (!prtr_on || !prtr_off))) { errno = ENODEV; - return(ERR); + return (ERR); } - if (prtr_non) - { + if (prtr_non) { switchon = tparm(prtr_non, len); onsize = strlen(switchon); offsize = 0; - } - else - { + } else { switchon = prtr_on; onsize = strlen(prtr_on); offsize = strlen(prtr_off); } - if ((mybuf = typeMalloc(char, onsize + len + offsize + 1)) == (char *)0) - { + if ((mybuf = typeMalloc(char, onsize + len + offsize + 1)) == (char *) 0) { errno = ENOMEM; - return(ERR); + return (ERR); } (void) strcpy(mybuf, switchon); memcpy(mybuf + onsize, data, len); if (offsize) - (void) strcpy(mybuf + onsize + len, prtr_off); + (void) strcpy(mybuf + onsize + len, prtr_off); /* * We're relying on the atomicity of UNIX writes here. The @@ -92,5 +87,5 @@ int mcprint(char *data, int len) (void) sleep(0); free(mybuf); - return(res); + return (res); } diff --git a/contrib/ncurses/ncurses/tinfo/lib_raw.c b/contrib/ncurses/ncurses/tinfo/lib_raw.c index 6df95714..0a65b8f 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_raw.c +++ b/contrib/ncurses/ncurses/tinfo/lib_raw.c @@ -48,7 +48,7 @@ #include <curses.priv.h> #include <term.h> /* cur_term */ -MODULE_ID("$Id: lib_raw.c,v 1.8 2000/09/02 18:08:48 tom Exp $") +MODULE_ID("$Id: lib_raw.c,v 1.10 2000/12/10 02:55:07 tom Exp $") #if SVR4_TERMIO && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE @@ -72,7 +72,7 @@ MODULE_ID("$Id: lib_raw.c,v 1.8 2000/09/02 18:08:48 tom Exp $") #define AFTER(s) #endif /* TRACE */ -int +NCURSES_EXPORT(int) raw(void) { T((T_CALLED("raw()"))); @@ -100,7 +100,7 @@ raw(void) returnCode(ERR); } -int +NCURSES_EXPORT(int) cbreak(void) { T((T_CALLED("cbreak()"))); @@ -125,7 +125,7 @@ cbreak(void) returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); } -void +NCURSES_EXPORT(void) qiflush(void) { T((T_CALLED("qiflush()"))); @@ -144,7 +144,7 @@ qiflush(void) #endif } -int +NCURSES_EXPORT(int) noraw(void) { T((T_CALLED("noraw()"))); @@ -168,7 +168,7 @@ noraw(void) returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); } -int +NCURSES_EXPORT(int) nocbreak(void) { T((T_CALLED("nocbreak()"))); @@ -190,7 +190,7 @@ nocbreak(void) returnCode(_nc_set_tty_mode(&cur_term->Nttyb)); } -void +NCURSES_EXPORT(void) noqiflush(void) { T((T_CALLED("noqiflush()"))); @@ -209,7 +209,7 @@ noqiflush(void) #endif } -int +NCURSES_EXPORT(int) intrflush(WINDOW *win GCC_UNUSED, bool flag) { T((T_CALLED("intrflush(%d)"), flag)); diff --git a/contrib/ncurses/ncurses/tinfo/lib_setup.c b/contrib/ncurses/ncurses/tinfo/lib_setup.c index 1fd0d48..e73e7e0 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_setup.c +++ b/contrib/ncurses/ncurses/tinfo/lib_setup.c @@ -48,7 +48,7 @@ #include <term.h> /* lines, columns, cur_term */ -MODULE_ID("$Id: lib_setup.c,v 1.60 2000/09/02 18:13:12 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.64 2000/12/10 02:55:07 tom Exp $") /**************************************************************************** * @@ -94,16 +94,21 @@ static int _use_env = TRUE; static void do_prototype(void); -void +NCURSES_EXPORT(void) use_env(bool f) { _use_env = f; } -int LINES = 0, COLS = 0, 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 */ @@ -133,7 +138,7 @@ _nc_get_screensize(int *linep, int *colp) *colp = screendata[0]; *linep = screendata[1]; T(("EMX screen size: environment LINES = %d COLUMNS = %d", - *linep, *colp)); + *linep, *colp)); } #endif #if HAVE_SIZECHANGE @@ -165,11 +170,12 @@ _nc_get_screensize(int *linep, int *colp) #endif /* HAVE_SIZECHANGE */ /* if we can't get dynamic info about the size, use static */ - if (*linep <= 0 || *colp <= 0) - if (lines > 0 && columns > 0) { - *linep = (int) lines; - *colp = (int) columns; - } + if (*linep <= 0) { + *linep = (int) lines; + } + if (*colp <= 0) { + *colp = (int) columns; + } /* the ultimate fallback, assume fixed 24x80 size */ if (*linep <= 0 || *colp <= 0) { @@ -196,7 +202,7 @@ _nc_get_screensize(int *linep, int *colp) } #if USE_SIZECHANGE -void +NCURSES_EXPORT(void) _nc_update_screensize(void) { int my_lines, my_cols; @@ -265,18 +271,20 @@ grab_entry(const char *const tn, TERMTYPE * const tp) */ if (status == 1) { int n; - for_each_boolean(n, tp) + for_each_boolean(n, tp) { if (!VALID_BOOLEAN(tp->Booleans[n])) - tp->Booleans[n] = FALSE; - for_each_string(n, tp) + tp->Booleans[n] = FALSE; + } + for_each_string(n, tp) { if (tp->Strings[n] == CANCELLED_STRING) - tp->Strings[n] = ABSENT_STRING; + tp->Strings[n] = ABSENT_STRING; + } } return (status); } #endif -char ttytype[NAMESIZE] = ""; +NCURSES_EXPORT_VAR(char) ttytype[NAMESIZE] = ""; /* * setupterm(termname, Filedes, errret) @@ -286,8 +294,9 @@ char ttytype[NAMESIZE] = ""; * */ -int -setupterm(NCURSES_CONST char *tname, int Filedes, int *errret) +NCURSES_EXPORT(int) +setupterm +(NCURSES_CONST char *tname, int Filedes, int *errret) { struct term *term_ptr; int status; @@ -302,7 +311,7 @@ setupterm(NCURSES_CONST char *tname, int Filedes, int *errret) } if (strlen(tname) > MAX_NAME_SIZE) { ret_error(-1, "TERM environment must be <= %d characters.\n", - MAX_NAME_SIZE); + MAX_NAME_SIZE); } T(("your terminal name is %s", tname)); diff --git a/contrib/ncurses/ncurses/tinfo/lib_termcap.c b/contrib/ncurses/ncurses/tinfo/lib_termcap.c index ecec286..c88887b 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_termcap.c +++ b/contrib/ncurses/ncurses/tinfo/lib_termcap.c @@ -39,15 +39,17 @@ #define __INTERNAL_CAPS_VISIBLE #include <term_entry.h> -MODULE_ID("$Id: lib_termcap.c,v 1.37 2000/09/16 20:30:16 tom Exp $") +MODULE_ID("$Id: lib_termcap.c,v 1.39 2000/12/10 02:56:30 tom Exp $") /* some of the code in here was contributed by: Magnus Bengtsson, d6mbeng@dtek.chalmers.se */ -char *UP = 0; -char *BC = 0; +NCURSES_EXPORT_VAR(char *) +UP = 0; +NCURSES_EXPORT_VAR(char *) +BC = 0; /*************************************************************************** * @@ -64,8 +66,9 @@ char *BC = 0; * ***************************************************************************/ -int -tgetent(char *bufp GCC_UNUSED, const char *name) +NCURSES_EXPORT(int) +tgetent +(char *bufp GCC_UNUSED, const char *name) { int errcode; @@ -108,7 +111,7 @@ tgetent(char *bufp GCC_UNUSED, const char *name) * ***************************************************************************/ -int +NCURSES_EXPORT(int) tgetflag(NCURSES_CONST char *id) { int i; @@ -136,7 +139,7 @@ tgetflag(NCURSES_CONST char *id) * ***************************************************************************/ -int +NCURSES_EXPORT(int) tgetnum(NCURSES_CONST char *id) { int i; @@ -165,8 +168,9 @@ tgetnum(NCURSES_CONST char *id) * ***************************************************************************/ -char * -tgetstr(NCURSES_CONST char *id, char **area) +NCURSES_EXPORT(char *) +tgetstr +(NCURSES_CONST char *id, char **area) { int i; @@ -176,7 +180,7 @@ tgetstr(NCURSES_CONST char *id, char **area) 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]))); + TR(TRACE_DATABASE, ("found match : %s", _nc_visbuf(tp->Strings[i]))); /* setupterm forces canceled strings to null */ if (area != 0 && *area != 0 diff --git a/contrib/ncurses/ncurses/tinfo/lib_termname.c b/contrib/ncurses/ncurses/tinfo/lib_termname.c index e705738..6b287e0 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_termname.c +++ b/contrib/ncurses/ncurses/tinfo/lib_termname.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,20 +27,22 @@ ****************************************************************************/ #include <curses.priv.h> -#include <tic.h> /* for MAX_ALIAS */ +#include <tic.h> /* for MAX_ALIAS */ -MODULE_ID("$Id: lib_termname.c,v 1.2 1999/07/24 21:02:40 tom Exp $") +MODULE_ID("$Id: lib_termname.c,v 1.6 2000/12/10 02:55:08 tom Exp $") -char *termname(void) +NCURSES_EXPORT(char *) +termname(void) { -char *name = getenv("TERM"); -static char ret[MAX_ALIAS+1]; + char *name = getenv("TERM"); + static char ret[MAX_ALIAS + 1]; - T(("termname() called")); + T(("termname() called")); - if (name != 0) { - (void) strncpy(ret, name, sizeof(ret) - 1); - name = ret; - } - return name; + if (name != 0) { + ret[0] = '\0'; + (void) strncat(ret, name, sizeof(ret) - 1); + name = ret; + } + return name; } diff --git a/contrib/ncurses/ncurses/tinfo/lib_tgoto.c b/contrib/ncurses/ncurses/tinfo/lib_tgoto.c index 73557eb..19edb4f 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_tgoto.c +++ b/contrib/ncurses/ncurses/tinfo/lib_tgoto.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2000 Free Software Foundation, Inc. * + * Copyright (c) 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 <termcap.h> -MODULE_ID("$Id: lib_tgoto.c,v 1.2 2000/09/24 00:19:14 tom Exp $") +MODULE_ID("$Id: lib_tgoto.c,v 1.7 2001/03/24 22:25:55 tom Exp $") #if !PURE_TERMINFO static bool @@ -43,20 +43,24 @@ is_termcap(const char *string) { bool result = TRUE; - while ((*string != '\0') && result) { - if (*string == '%') { - switch (*++string) { - case 'p': + if (string == 0 || *string == '\0') { + result = FALSE; /* tparm() handles empty strings */ + } else { + while ((*string != '\0') && result) { + if (*string == '%') { + switch (*++string) { + case 'p': + result = FALSE; + break; + case '\0': + string--; + break; + } + } else if (string[0] == '$' && string[1] == '<') { result = FALSE; - break; - case '\0': - string--; - break; } - } else if (string[0] == '$' && string[1] == '<') { - result = FALSE; + string++; } - string++; } return result; } @@ -90,7 +94,7 @@ tgoto_internal(const char *string, int x, int y) } } if (*string == '%') { - char *fmt = 0; + const char *fmt = 0; switch (*++string) { case '\0': @@ -108,7 +112,7 @@ tgoto_internal(const char *string, int x, int y) *value %= 1000; break; case '+': - *value += (*++string & 0xff); + *value += CharOf(*++string); /* FALLTHRU */ case '.': /* @@ -181,8 +185,9 @@ tgoto_internal(const char *string, int x, int y) * Retained solely for upward compatibility. Note the intentional reversing of * the last two arguments when invoking tparm(). */ -char * -tgoto(const char *string, int x, int y) +NCURSES_EXPORT(char *) +tgoto +(const char *string, int x, int y) { char *result; diff --git a/contrib/ncurses/ncurses/tinfo/lib_ti.c b/contrib/ncurses/ncurses/tinfo/lib_ti.c index def5ba6d..8ef8665 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_ti.c +++ b/contrib/ncurses/ncurses/tinfo/lib_ti.c @@ -36,9 +36,9 @@ #include <term_entry.h> #include <tic.h> -MODULE_ID("$Id: lib_ti.c,v 1.20 2000/02/13 01:01:26 tom Exp $") +MODULE_ID("$Id: lib_ti.c,v 1.22 2000/12/10 02:55:08 tom Exp $") -int +NCURSES_EXPORT(int) tigetflag(NCURSES_CONST char *str) { int i; @@ -59,7 +59,7 @@ tigetflag(NCURSES_CONST char *str) returnCode(ABSENT_BOOLEAN); } -int +NCURSES_EXPORT(int) tigetnum(NCURSES_CONST char *str) { int i; @@ -81,7 +81,7 @@ tigetnum(NCURSES_CONST char *str) returnCode(CANCELLED_NUMERIC); /* Solaris returns a -1 instead */ } -char * +NCURSES_EXPORT(char *) tigetstr(NCURSES_CONST char *str) { int i; diff --git a/contrib/ncurses/ncurses/tinfo/lib_tparm.c b/contrib/ncurses/ncurses/tinfo/lib_tparm.c index 6a8ca1f..e62b824 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_tparm.c +++ b/contrib/ncurses/ncurses/tinfo/lib_tparm.c @@ -42,7 +42,7 @@ #include <term.h> #include <tic.h> -MODULE_ID("$Id: lib_tparm.c,v 1.47 2000/10/04 00:57:13 tom Exp $") +MODULE_ID("$Id: lib_tparm.c,v 1.52 2001/03/11 15:12:48 tom Exp $") /* * char * @@ -114,8 +114,11 @@ typedef struct { bool num_type; } stack_frame; +NCURSES_EXPORT_VAR(int) _nc_tparm_err = 0; + static stack_frame stack[STACKSIZE]; static int stack_ptr; +static const char *tparam_base = ""; #ifdef TRACE static const char *tname; @@ -126,7 +129,7 @@ static size_t out_size; static size_t out_used; #if NO_LEAKS -void +NCURSES_EXPORT(void) _nc_free_tparm(void) { if (out_buff != 0) { @@ -195,6 +198,9 @@ npush(int x) stack[stack_ptr].num_type = TRUE; stack[stack_ptr].data.num = x; stack_ptr++; + } else { + DEBUG(2, ("npush: stack overflow: %s", _nc_visbuf(tparam_base))); + _nc_tparm_err++; } } @@ -206,6 +212,9 @@ npop(void) stack_ptr--; if (stack[stack_ptr].num_type) result = stack[stack_ptr].data.num; + } else { + DEBUG(2, ("npop: stack underflow: %s", _nc_visbuf(tparam_base))); + _nc_tparm_err++; } return result; } @@ -217,6 +226,9 @@ spush(char *x) stack[stack_ptr].num_type = FALSE; stack[stack_ptr].data.str = x; stack_ptr++; + } else { + DEBUG(2, ("spush: stack overflow: %s", _nc_visbuf(tparam_base))); + _nc_tparm_err++; } } @@ -229,6 +241,9 @@ spop(void) stack_ptr--; if (!stack[stack_ptr].num_type && stack[stack_ptr].data.str != 0) result = stack[stack_ptr].data.str; + } else { + DEBUG(2, ("spop: stack underflow: %s", _nc_visbuf(tparam_base))); + _nc_tparm_err++; } return result; } @@ -286,7 +301,7 @@ parse_format(const char *s, char *format, int *len) } break; default: - if (isdigit(*s)) { + if (isdigit(CharOf(*s))) { value = (value * 10) + (*s - '0'); if (value > 10000) err = TRUE; @@ -501,7 +516,7 @@ tparam_internal(const char *string, va_list ap) if (*string != '%') { save_char(*string); } else { - string++; + tparam_base = string++; string = parse_format(string, format, &len); switch (*string) { default: @@ -717,20 +732,21 @@ tparam_internal(const char *string, va_list ap) string++; } /* endwhile (*string) */ - if (out_buff == 0 && (out_buff = typeCalloc(char, 1)) == NULL) - return (NULL); + get_space(1); out_buff[out_used] = '\0'; T((T_RETURN("%s"), _nc_visbuf(out_buff))); return (out_buff); } -char * -tparm(NCURSES_CONST char *string,...) +NCURSES_EXPORT(char *) +tparm +(NCURSES_CONST char *string,...) { va_list ap; char *result; + _nc_tparm_err = 0; va_start(ap, string); #ifdef TRACE tname = "tparm"; diff --git a/contrib/ncurses/ncurses/tinfo/lib_tputs.c b/contrib/ncurses/ncurses/tinfo/lib_tputs.c index 93eebf8..63dbbd9 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_tputs.c +++ b/contrib/ncurses/ncurses/tinfo/lib_tputs.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,16 +45,18 @@ #include <termcap.h> /* ospeed */ #include <tic.h> -MODULE_ID("$Id: lib_tputs.c,v 1.51 2000/10/08 00:22:24 tom Exp $") +MODULE_ID("$Id: lib_tputs.c,v 1.56 2001/04/21 18:53:53 tom Exp $") -char PC = 0; /* used by termcap library */ -short ospeed = 0; /* used by termcap library */ +NCURSES_EXPORT_VAR(char) +PC = 0; /* used by termcap library */ +NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */ -int _nc_nulls_sent = 0; /* used by 'tack' program */ +NCURSES_EXPORT_VAR(int) +_nc_nulls_sent = 0; /* used by 'tack' program */ -static int (*my_outch) (int c) = _nc_outch; + static int (*my_outch) (int c) = _nc_outch; -int +NCURSES_EXPORT(int) delay_output(int ms) { T((T_CALLED("delay_output(%d)"), ms)); @@ -75,13 +77,13 @@ delay_output(int ms) returnCode(OK); } -void +NCURSES_EXPORT(void) _nc_flush(void) { (void) fflush(NC_OUTPUT); } -int +NCURSES_EXPORT(int) _nc_outch(int ch) { #ifdef TRACE @@ -109,7 +111,7 @@ _nc_outch(int ch) * No surrogates supported (we're storing only one 16-bit Unicode value per * cell). */ -int +NCURSES_EXPORT(int) _nc_utf8_outch(int ch) { static const unsigned byteMask = 0xBF; @@ -168,14 +170,15 @@ _nc_utf8_outch(int ch) } #endif -int +NCURSES_EXPORT(int) putp(const char *string) { return tputs(string, 1, _nc_outch); } -int -tputs(const char *string, int affcnt, int (*outc) (int)) +NCURSES_EXPORT(int) +tputs +(const char *string, int affcnt, int (*outc) (int)) { bool always_delay; bool normal_delay; @@ -262,25 +265,26 @@ tputs(const char *string, int affcnt, int (*outc) (int)) bool mandatory; string++; - if ((!isdigit(*string) && *string != '.') || !strchr(string, '>')) { + if ((!isdigit(CharOf(*string)) && *string != '.') + || !strchr(string, '>')) { (*outc) ('$'); (*outc) ('<'); continue; } number = 0; - while (isdigit(*string)) { + while (isdigit(CharOf(*string))) { number = number * 10 + (*string - '0'); string++; } number *= 10; if (*string == '.') { string++; - if (isdigit(*string)) { + if (isdigit(CharOf(*string))) { number += (*string - '0'); string++; } - while (isdigit(*string)) + while (isdigit(CharOf(*string))) string++; } diff --git a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c index 0e57c51..d72df2d 100644 --- a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c +++ b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,9 +36,9 @@ */ #include <curses.priv.h> -#include <term.h> /* cur_term */ +#include <term.h> /* cur_term */ -MODULE_ID("$Id: lib_ttyflags.c,v 1.3 1999/10/22 21:38:55 tom Exp $") +MODULE_ID("$Id: lib_ttyflags.c,v 1.5 2000/12/10 02:55:08 tom Exp $") #undef tabs @@ -56,89 +56,94 @@ MODULE_ID("$Id: lib_ttyflags.c,v 1.3 1999/10/22 21:38:55 tom Exp $") # endif #endif -int _nc_get_tty_mode(TTY *buf) +NCURSES_EXPORT(int) +_nc_get_tty_mode(TTY * buf) { - if (cur_term == 0 - || GET_TTY(cur_term->Filedes, buf) != 0) - return(ERR); - TR(TRACE_BITS,("_nc_get_tty_mode: %s", _nc_tracebits())); - return (OK); + if (cur_term == 0 + || GET_TTY(cur_term->Filedes, buf) != 0) + return (ERR); + TR(TRACE_BITS, ("_nc_get_tty_mode: %s", _nc_tracebits())); + return (OK); } -int _nc_set_tty_mode(TTY *buf) +NCURSES_EXPORT(int) +_nc_set_tty_mode(TTY * buf) { - if (cur_term == 0 - || SET_TTY(cur_term->Filedes, buf) != 0) - return(ERR); - TR(TRACE_BITS,("_nc_set_tty_mode: %s", _nc_tracebits())); - return (OK); + if (cur_term == 0 + || SET_TTY(cur_term->Filedes, buf) != 0) + return (ERR); + TR(TRACE_BITS, ("_nc_set_tty_mode: %s", _nc_tracebits())); + return (OK); } -int def_shell_mode(void) +NCURSES_EXPORT(int) +def_shell_mode(void) { - T((T_CALLED("def_shell_mode()"))); + T((T_CALLED("def_shell_mode()"))); - /* - * Turn off the XTABS bit in the tty structure if it was on. If XTABS - * was on, remove the tab and backtab capabilities. - */ + /* + * Turn off the XTABS bit in the tty structure if it was on. If XTABS + * was on, remove the tab and backtab capabilities. + */ - if (_nc_get_tty_mode(&cur_term->Ottyb) != OK) - returnCode(ERR); + if (_nc_get_tty_mode(&cur_term->Ottyb) != OK) + returnCode(ERR); #ifdef TERMIOS - if (cur_term->Ottyb.c_oflag & tabs) - tab = back_tab = NULL; + if (cur_term->Ottyb.c_oflag & tabs) + tab = back_tab = NULL; #else - if (cur_term->Ottyb.sg_flags & XTABS) - tab = back_tab = NULL; + if (cur_term->Ottyb.sg_flags & XTABS) + tab = back_tab = NULL; #endif - returnCode(OK); + returnCode(OK); } -int def_prog_mode(void) +NCURSES_EXPORT(int) +def_prog_mode(void) { - T((T_CALLED("def_prog_mode()"))); + T((T_CALLED("def_prog_mode()"))); - if (_nc_get_tty_mode(&cur_term->Nttyb) != OK) - returnCode(ERR); + if (_nc_get_tty_mode(&cur_term->Nttyb) != OK) + returnCode(ERR); #ifdef TERMIOS - cur_term->Nttyb.c_oflag &= ~tabs; + cur_term->Nttyb.c_oflag &= ~tabs; #else - cur_term->Nttyb.sg_flags &= ~XTABS; + cur_term->Nttyb.sg_flags &= ~XTABS; #endif - returnCode(OK); + returnCode(OK); } -int reset_prog_mode(void) +NCURSES_EXPORT(int) +reset_prog_mode(void) { - T((T_CALLED("reset_prog_mode()"))); - - if (cur_term != 0) { - _nc_set_tty_mode(&cur_term->Nttyb); - if (SP) { - if (stdscr && stdscr->_use_keypad) - _nc_keypad(TRUE); - NC_BUFFERED(TRUE); - } - returnCode(OK); + T((T_CALLED("reset_prog_mode()"))); + + if (cur_term != 0) { + _nc_set_tty_mode(&cur_term->Nttyb); + if (SP) { + if (stdscr && stdscr->_use_keypad) + _nc_keypad(TRUE); + NC_BUFFERED(TRUE); } - returnCode(ERR); + returnCode(OK); + } + returnCode(ERR); } -int reset_shell_mode(void) +NCURSES_EXPORT(int) +reset_shell_mode(void) { - T((T_CALLED("reset_shell_mode()"))); - - if (cur_term != 0) { - if (SP) - { - _nc_keypad(FALSE); - _nc_flush(); - NC_BUFFERED(FALSE); - } - returnCode(_nc_set_tty_mode(&cur_term->Ottyb)); + T((T_CALLED("reset_shell_mode()"))); + + if (cur_term != 0) { + if (SP) { + _nc_keypad(FALSE); + _nc_flush(); + NC_BUFFERED(FALSE); } - returnCode(ERR); + returnCode(_nc_set_tty_mode(&cur_term->Ottyb)); + } + returnCode(ERR); } /* @@ -146,18 +151,20 @@ int reset_shell_mode(void) ** */ -static TTY buf; +static TTY buf; -int savetty(void) +NCURSES_EXPORT(int) +savetty(void) { - T((T_CALLED("savetty()"))); + T((T_CALLED("savetty()"))); - returnCode(_nc_get_tty_mode(&buf)); + returnCode(_nc_get_tty_mode(&buf)); } -int resetty(void) +NCURSES_EXPORT(int) +resetty(void) { - T((T_CALLED("resetty()"))); + T((T_CALLED("resetty()"))); - returnCode(_nc_set_tty_mode(&buf)); + returnCode(_nc_set_tty_mode(&buf)); } diff --git a/contrib/ncurses/ncurses/tinfo/make_keys.c b/contrib/ncurses/ncurses/tinfo/make_keys.c index 703ca5d..3c98da2 100644 --- a/contrib/ncurses/ncurses/tinfo/make_keys.c +++ b/contrib/ncurses/ncurses/tinfo/make_keys.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,98 +37,104 @@ */ #include <curses.priv.h> -MODULE_ID("$Id: make_keys.c,v 1.8 2000/03/12 02:55:50 Todd.C.Miller Exp $") +MODULE_ID("$Id: make_keys.c,v 1.10 2000/12/10 02:55:08 tom Exp $") #include <names.c> #define UNKNOWN (SIZEOF(strnames) + SIZEOF(strfnames)) -static size_t lookup(const char *name) +static size_t +lookup(const char *name) { - size_t n; - bool found = FALSE; - for (n = 0; strnames[n] != 0; n++) { - if (!strcmp(name, strnames[n])) { - found = TRUE; - break; - } + size_t n; + bool found = FALSE; + for (n = 0; strnames[n] != 0; n++) { + if (!strcmp(name, strnames[n])) { + found = TRUE; + break; } - if (!found) { - for (n = 0; strfnames[n] != 0; n++) { - if (!strcmp(name, strfnames[n])) { - found = TRUE; - break; - } - } + } + if (!found) { + for (n = 0; strfnames[n] != 0; n++) { + if (!strcmp(name, strfnames[n])) { + found = TRUE; + break; + } } - return found ? n : UNKNOWN; + } + return found ? n : UNKNOWN; } -static void make_keys(FILE *ifp, FILE *ofp) +static void +make_keys(FILE * ifp, FILE * ofp) { - char buffer[BUFSIZ]; - char from[BUFSIZ]; - char to[BUFSIZ]; - int maxlen = 16; + char buffer[BUFSIZ]; + char from[BUFSIZ]; + char to[BUFSIZ]; + int maxlen = 16; - while (fgets(buffer, sizeof(buffer), ifp) != 0) { - if (*buffer == '#') - continue; - if (sscanf(buffer, "%s %s", to, from) == 2) { - int code = lookup(from); - if (code == UNKNOWN) - continue; - if ((int)strlen(from) > maxlen) - maxlen = strlen(from); - fprintf(ofp, "\t{ %4d, %-*.*s },\t/* %s */\n", - code, - maxlen, maxlen, - to, - from); - } + while (fgets(buffer, sizeof(buffer), ifp) != 0) { + if (*buffer == '#') + continue; + if (sscanf(buffer, "%s %s", to, from) == 2) { + int code = lookup(from); + if (code == UNKNOWN) + continue; + if ((int) strlen(from) > maxlen) + maxlen = strlen(from); + fprintf(ofp, "\t{ %4d, %-*.*s },\t/* %s */\n", + code, + maxlen, maxlen, + to, + from); } + } } -static void write_list(FILE *ofp, const char **list) +static void +write_list(FILE * ofp, const char **list) { - while (*list != 0) - fprintf(ofp, "%s\n", *list++); + while (*list != 0) + fprintf(ofp, "%s\n", *list++); } -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { - static const char *prefix[] = { - "#ifndef NCU_KEYS_H", - "#define NCU_KEYS_H 1", - "", - "/* This file was generated by MAKE_KEYS */", - "", - "#if BROKEN_LINKER", - "static", - "#endif", - "struct tinfo_fkeys _nc_tinfo_fkeys[] = {", - 0 - }; - static const char *suffix[] = { - "\t{ 0, 0} };", - "", - "#endif /* NCU_KEYS_H */", - 0 - }; + static const char *prefix[] = + { + "#ifndef NCU_KEYS_H", + "#define NCU_KEYS_H 1", + "", + "/* This file was generated by MAKE_KEYS */", + "", + "#if BROKEN_LINKER", + "static", + "#endif", + "struct tinfo_fkeys _nc_tinfo_fkeys[] = {", + 0 + }; + static const char *suffix[] = + { + "\t{ 0, 0} };", + "", + "#endif /* NCU_KEYS_H */", + 0 + }; - write_list(stdout, prefix); - if (argc > 1) { - int n; - for (n = 1; n < argc; n++) { - FILE *fp = fopen(argv[n], "r"); - if (fp != 0) { - make_keys(fp, stdout); - fclose(fp); - } - } - } else { - make_keys(stdin, stdout); + write_list(stdout, prefix); + if (argc > 1) { + int n; + for (n = 1; n < argc; n++) { + FILE *fp = fopen(argv[n], "r"); + if (fp != 0) { + make_keys(fp, stdout); + fclose(fp); + } } - write_list(stdout, suffix); - return EXIT_SUCCESS; + } else { + make_keys(stdin, stdout); + } + write_list(stdout, suffix); + return EXIT_SUCCESS; } diff --git a/contrib/ncurses/ncurses/tinfo/name_match.c b/contrib/ncurses/ncurses/tinfo/name_match.c index a9e8396..934b24a 100644 --- a/contrib/ncurses/ncurses/tinfo/name_match.c +++ b/contrib/ncurses/ncurses/tinfo/name_match.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 Free 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.8 1999/03/07 01:58:36 tom Exp $") +MODULE_ID("$Id: name_match.c,v 1.10 2000/12/10 02:55:08 tom Exp $") /* * _nc_first_name(char *names) @@ -42,19 +42,20 @@ MODULE_ID("$Id: name_match.c,v 1.8 1999/03/07 01:58:36 tom Exp $") * Extract the primary name from a compiled entry. */ -char *_nc_first_name(const char *const sp) +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]; - register unsigned n; + static char buf[MAX_NAME_SIZE + 1]; + register unsigned n; - for (n = 0; n < sizeof(buf)-1; n++) { - if ((buf[n] = sp[n]) == '\0' - || (buf[n] == '|')) - break; - } - buf[n] = '\0'; - return(buf); + for (n = 0; n < sizeof(buf) - 1; n++) { + if ((buf[n] = sp[n]) == '\0' + || (buf[n] == '|')) + break; + } + buf[n] = '\0'; + return (buf); } /* @@ -63,34 +64,36 @@ char *_nc_first_name(const char *const sp) * Is the given name matched in namelist? */ -int _nc_name_match(const char *const namelst, const char *const name, const char *const delim) +NCURSES_EXPORT(int) +_nc_name_match +(const char *const namelst, const char *const name, const char *const delim) { - const char *s, *d, *t; - int code, found; + const char *s, *d, *t; + int code, found; - if ((s = namelst) != 0) { - while (*s != '\0') { - for (d = name; *d != '\0'; d++) { - if (*s != *d) - break; - s++; - } - found = FALSE; - for (code = TRUE; *s != '\0'; code = FALSE, s++) { - for (t = delim; *t != '\0'; t++) { - if (*s == *t) { - found = TRUE; - break; - } - } - if (found) - break; - } - if (code && *d == '\0') - return code; - if (*s++ == 0) - break; + if ((s = namelst) != 0) { + while (*s != '\0') { + for (d = name; *d != '\0'; d++) { + if (*s != *d) + break; + s++; + } + found = FALSE; + for (code = TRUE; *s != '\0'; code = FALSE, s++) { + for (t = delim; *t != '\0'; t++) { + if (*s == *t) { + found = TRUE; + break; + } } + if (found) + break; + } + if (code && *d == '\0') + return code; + if (*s++ == 0) + break; } - return FALSE; + } + return FALSE; } diff --git a/contrib/ncurses/ncurses/tinfo/parse_entry.c b/contrib/ncurses/ncurses/tinfo/parse_entry.c index 24bf3c3..ef66b30 100644 --- a/contrib/ncurses/ncurses/tinfo/parse_entry.c +++ b/contrib/ncurses/ncurses/tinfo/parse_entry.c @@ -47,7 +47,7 @@ #define __INTERNAL_CAPS_VISIBLE #include <term_entry.h> -MODULE_ID("$Id: parse_entry.c,v 1.48 2000/10/03 09:38:48 tom Exp $") +MODULE_ID("$Id: parse_entry.c,v 1.53 2001/03/03 21:13:09 Todd.C.Miller Exp $") #ifdef LINT static short const parametrized[] = @@ -195,14 +195,15 @@ _nc_extend_names(ENTRY * entryp, char *name, int token_type) * push back token */ -int -_nc_parse_entry(struct entry *entryp, int literal, bool silent) +NCURSES_EXPORT(int) +_nc_parse_entry +(struct entry *entryp, int literal, bool silent) { int token_type; struct name_table_entry const *entry_ptr; char *ptr, *base; - token_type = _nc_get_token(); + token_type = _nc_get_token(silent); if (token_type == EOF) return (EOF); @@ -248,9 +249,9 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent) entryp->nuses = 0; - for (token_type = _nc_get_token(); + for (token_type = _nc_get_token(silent); token_type != EOF && token_type != NAMES; - token_type = _nc_get_token()) { + token_type = _nc_get_token(silent)) { if (strcmp(_nc_curr_token.tk_name, "use") == 0 || strcmp(_nc_curr_token.tk_name, "tc") == 0) { entryp->uses[entryp->nuses].name = _nc_save_str(_nc_curr_token.tk_valstring); @@ -464,12 +465,12 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent) } else postprocess_terminfo(&entryp->tterm); } - _nc_wrap_entry(entryp); + _nc_wrap_entry(entryp, FALSE); return (OK); } -int +NCURSES_EXPORT(int) _nc_capcmp(const char *s, const char *t) /* compare two string capabilities, stripping out padding */ { @@ -481,15 +482,21 @@ _nc_capcmp(const char *s, const char *t) for (;;) { if (s[0] == '$' && s[1] == '<') { for (s += 2;; s++) - if (!(isdigit(*s) || *s == '.' || *s == '*' || *s == '/' || - *s == '>')) + if (!(isdigit(CharOf(*s)) + || *s == '.' + || *s == '*' + || *s == '/' + || *s == '>')) break; } if (t[0] == '$' && t[1] == '<') { for (t += 2;; t++) - if (!(isdigit(*t) || *t == '.' || *t == '*' || *t == '/' || - *t == '>')) + if (!(isdigit(CharOf(*t)) + || *t == '.' + || *t == '*' + || *t == '/' + || *t == '>')) break; } @@ -507,7 +514,7 @@ _nc_capcmp(const char *s, const char *t) } static void -append_acs0(string_desc *dst, int code, int src) +append_acs0(string_desc * dst, int code, int src) { if (src != 0) { char temp[3]; @@ -519,7 +526,7 @@ append_acs0(string_desc *dst, int code, int src) } static void -append_acs(string_desc *dst, int code, char *src) +append_acs(string_desc * dst, int code, char *src) { if (src != 0 && strlen(src) == 1) { append_acs0(dst, code, *src); @@ -657,12 +664,12 @@ postprocess_termcap(TERMTYPE * tp, bool has_base) } else if (PRESENT(carriage_return) && PRESENT(scroll_forward)) { _nc_str_init(&result, buf, sizeof(buf)); if (_nc_safe_strcat(&result, carriage_return) - && _nc_safe_strcat(&result, scroll_forward)) + && _nc_safe_strcat(&result, scroll_forward)) newline = _nc_save_str(buf); } else if (PRESENT(carriage_return) && PRESENT(cursor_down)) { _nc_str_init(&result, buf, sizeof(buf)); if (_nc_safe_strcat(&result, carriage_return) - && _nc_safe_strcat(&result, cursor_down)) + && _nc_safe_strcat(&result, cursor_down)) newline = _nc_save_str(buf); } } @@ -813,13 +820,15 @@ postprocess_termcap(TERMTYPE * tp, bool has_base) } } - if (!hard_copy) { - if (WANTED(key_backspace)) - key_backspace = _nc_save_str(C_BS); - if (WANTED(key_left)) - key_left = _nc_save_str(C_BS); - if (WANTED(key_down)) - key_down = _nc_save_str(C_LF); + if (!has_base) { + if (!hard_copy) { + if (WANTED(key_backspace)) + key_backspace = _nc_save_str(C_BS); + if (WANTED(key_left)) + key_left = _nc_save_str(C_BS); + if (WANTED(key_down)) + key_down = _nc_save_str(C_LF); + } } /* @@ -841,17 +850,17 @@ postprocess_termcap(TERMTYPE * tp, bool has_base) _nc_str_init(&result, buf2, sizeof(buf2)); _nc_safe_strcat(&result, acs_chars); - append_acs (&result, 'j', acs_lrcorner); - append_acs (&result, 'k', acs_urcorner); - append_acs (&result, 'l', acs_ulcorner); - append_acs (&result, 'm', acs_llcorner); - append_acs (&result, 'n', acs_plus); - append_acs (&result, 'q', acs_hline); - append_acs (&result, 't', acs_ltee); - append_acs (&result, 'u', acs_rtee); - append_acs (&result, 'v', acs_btee); - append_acs (&result, 'w', acs_ttee); - append_acs (&result, 'x', acs_vline); + append_acs(&result, 'j', acs_lrcorner); + append_acs(&result, 'k', acs_urcorner); + append_acs(&result, 'l', acs_ulcorner); + append_acs(&result, 'm', acs_llcorner); + append_acs(&result, 'n', acs_plus); + append_acs(&result, 'q', acs_hline); + append_acs(&result, 't', acs_ltee); + append_acs(&result, 'u', acs_rtee); + append_acs(&result, 'v', acs_btee); + append_acs(&result, 'w', acs_ttee); + append_acs(&result, 'x', acs_vline); if (buf2[0]) { acs_chars = _nc_save_str(buf2); @@ -883,17 +892,17 @@ postprocess_terminfo(TERMTYPE * tp) _nc_str_init(&result, buf2, sizeof(buf2)); _nc_safe_strcat(&result, acs_chars); - append_acs0 (&result, 'l', box_chars_1[0]); /* ACS_ULCORNER */ - append_acs0 (&result, 'q', box_chars_1[1]); /* ACS_HLINE */ - append_acs0 (&result, 'k', box_chars_1[2]); /* ACS_URCORNER */ - append_acs0 (&result, 'x', box_chars_1[3]); /* ACS_VLINE */ - append_acs0 (&result, 'j', box_chars_1[4]); /* ACS_LRCORNER */ - append_acs0 (&result, 'm', box_chars_1[5]); /* ACS_LLCORNER */ - append_acs0 (&result, 'w', box_chars_1[6]); /* ACS_TTEE */ - append_acs0 (&result, 'u', box_chars_1[7]); /* ACS_RTEE */ - append_acs0 (&result, 'v', box_chars_1[8]); /* ACS_BTEE */ - append_acs0 (&result, 't', box_chars_1[9]); /* ACS_LTEE */ - append_acs0 (&result, 'n', box_chars_1[10]); /* ACS_PLUS */ + append_acs0(&result, 'l', box_chars_1[0]); /* ACS_ULCORNER */ + append_acs0(&result, 'q', box_chars_1[1]); /* ACS_HLINE */ + append_acs0(&result, 'k', box_chars_1[2]); /* ACS_URCORNER */ + append_acs0(&result, 'x', box_chars_1[3]); /* ACS_VLINE */ + append_acs0(&result, 'j', box_chars_1[4]); /* ACS_LRCORNER */ + append_acs0(&result, 'm', box_chars_1[5]); /* ACS_LLCORNER */ + append_acs0(&result, 'w', box_chars_1[6]); /* ACS_TTEE */ + append_acs0(&result, 'u', box_chars_1[7]); /* ACS_RTEE */ + append_acs0(&result, 'v', box_chars_1[8]); /* ACS_BTEE */ + append_acs0(&result, 't', box_chars_1[9]); /* ACS_LTEE */ + append_acs0(&result, 'n', box_chars_1[10]); /* ACS_PLUS */ if (buf2[0]) { acs_chars = _nc_save_str(buf2); diff --git a/contrib/ncurses/ncurses/tinfo/read_entry.c b/contrib/ncurses/ncurses/tinfo/read_entry.c index deef498..006e56c 100644 --- a/contrib/ncurses/ncurses/tinfo/read_entry.c +++ b/contrib/ncurses/ncurses/tinfo/read_entry.c @@ -41,7 +41,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$Id: read_entry.c,v 1.69 2000/10/10 00:57:40 Todd.Miller Exp $") +MODULE_ID("$Id: read_entry.c,v 1.72 2000/12/10 02:55:08 tom Exp $") #if !HAVE_TELL #define tell(fd) 0 /* lseek() is POSIX, but not tell() - odd... */ @@ -70,7 +70,7 @@ static bool keep_tic_directory = FALSE; * Record the "official" location of the terminfo directory, according to * the place where we're writing to, or the normal default, if not. */ -const char * +NCURSES_EXPORT(const char *) _nc_tic_dir(const char *path) { static const char *result = TERMINFO; @@ -93,7 +93,7 @@ _nc_tic_dir(const char *path) * has chdir'd to it. If we let it be changed, then if $TERMINFO has a * relative path, we'll lose track of the actual directory. */ -void +NCURSES_EXPORT(void) _nc_keep_tic_dir(const char *path) { _nc_tic_dir(path); @@ -373,8 +373,9 @@ read_termtype(int fd, TERMTYPE * ptr) return (1); } -int -_nc_read_file_entry(const char *const filename, TERMTYPE * ptr) +NCURSES_EXPORT(int) +_nc_read_file_entry +(const char *const filename, TERMTYPE * ptr) /* return 1 if read, 0 if not found or garbled */ { int code, fd = -1; @@ -428,7 +429,7 @@ _nc_read_terminfo_dirs(const char *dirs, char *const filename, const char *const for (;;) { int c = *a; - if (c == 0 || c == ':') { + if (c == 0 || c == NCURSES_PATHSEP) { *a = 0; if ((b + 1) >= a) b = TERMINFO; @@ -456,8 +457,9 @@ _nc_read_terminfo_dirs(const char *dirs, char *const filename, const char *const * overrun the file buffer. */ -int -_nc_read_entry(const char *const tn, char *const filename, TERMTYPE * const tp) +NCURSES_EXPORT(int) +_nc_read_entry +(const char *const tn, char *const filename, TERMTYPE * const tp) { char *envp; char ttn[MAX_ALIAS + 3]; diff --git a/contrib/ncurses/ncurses/tinfo/read_termcap.c b/contrib/ncurses/ncurses/tinfo/read_termcap.c index f74c5a1..da88f0b 100644 --- a/contrib/ncurses/ncurses/tinfo/read_termcap.c +++ b/contrib/ncurses/ncurses/tinfo/read_termcap.c @@ -55,7 +55,7 @@ #include <tic.h> #include <term_entry.h> -MODULE_ID("$Id: read_termcap.c,v 1.50 2000/10/10 00:56:46 Todd.Miller Exp $") +MODULE_ID("$Id: read_termcap.c,v 1.55 2000/12/10 02:55:08 tom Exp $") #if !PURE_TERMINFO @@ -770,7 +770,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) register char *p; register char *cp; - char *dummy; + char *dummy = NULL; char **fname; char *home; int i; @@ -784,7 +784,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) pvec = pathvec; tbuf = bp; p = pathbuf; - cp = use_terminfo_vars() ? getenv("TERMCAP") : NULL; + cp = use_terminfo_vars()? getenv("TERMCAP") : NULL; /* * TERMCAP can have one of two things in it. It can be the name of a file @@ -821,10 +821,10 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) *fname++ = pathbuf; /* tokenize path into vector of names */ while (*++p) { - if (*p == ' ' || *p == ':') { + if (*p == ' ' || *p == NCURSES_PATHSEP) { *p = '\0'; while (*++p) - if (*p != ' ' && *p != ':') + if (*p != ' ' && *p != NCURSES_PATHSEP) break; if (*p == '\0') break; @@ -917,8 +917,9 @@ add_tc(char *termpaths[], char *path, int count) #define ADD_TC(path, count) filecount = add_tc(termpaths, path, count) #endif /* !USE_GETCAP */ -int -_nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) +NCURSES_EXPORT(int) +_nc_read_termcap_entry +(const char *const tn, TERMTYPE * const tp) { int found = FALSE; ENTRY *ep; @@ -990,7 +991,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) char *cp; for (cp = tc; *cp; cp++) { - if (*cp == ':') + if (*cp == NCURSES_PATHSEP) *cp = '\0'; else if (cp == tc || cp[-1] == '\0') { ADD_TC(cp, filecount); @@ -1013,7 +1014,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) #define PRIVATE_CAP "%s/.termcap" - if ((h = getenv("HOME")) != NULL && *h != '\0' + if (use_terminfo_vars() && (h = getenv("HOME")) != NULL && *h != '\0' && (strlen(h) + sizeof(PRIVATE_CAP)) < PATH_MAX) { /* user's .termcap, if any, should override it */ (void) strcpy(envhome, h); @@ -1103,8 +1104,10 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) return (found); } #else -extern void _nc_read_termcap(void); -void +extern +NCURSES_EXPORT(void) +_nc_read_termcap(void); +NCURSES_EXPORT(void) _nc_read_termcap(void) { } diff --git a/contrib/ncurses/ncurses/tinfo/setbuf.c b/contrib/ncurses/ncurses/tinfo/setbuf.c index c0e7356..6d0201b 100644 --- a/contrib/ncurses/ncurses/tinfo/setbuf.c +++ b/contrib/ncurses/ncurses/tinfo/setbuf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,8 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* ** setbuf.c ** @@ -42,7 +40,7 @@ #include <curses.priv.h> -MODULE_ID("$Id: setbuf.c,v 1.5 1999/02/27 20:00:15 tom Exp $") +MODULE_ID("$Id: setbuf.c,v 1.7 2000/12/10 02:55:08 tom Exp $") /* * If the output file descriptor is connected to a tty (the typical case) it @@ -99,45 +97,47 @@ MODULE_ID("$Id: setbuf.c,v 1.5 1999/02/27 20:00:15 tom Exp $") * do indeed get confused by changing setbuf on/off, and will overrun the * buffer. So we disable this by default (there may yet be a workaround). */ -void _nc_set_buffer(FILE *ofp, bool buffered) +NCURSES_EXPORT(void) +_nc_set_buffer(FILE * ofp, bool buffered) { - /* optional optimization hack -- do before any output to ofp */ + /* optional optimization hack -- do before any output to ofp */ #if HAVE_SETVBUF || HAVE_SETBUFFER - unsigned buf_len; - char *buf_ptr; + unsigned buf_len; + char *buf_ptr; - if (getenv("NCURSES_NO_SETBUF") != 0) - return; + if (getenv("NCURSES_NO_SETBUF") != 0) + return; - fflush(ofp); - if ((SP->_buffered = buffered) != 0) { - buf_len = min(LINES * (COLS + 6), 2800); - if ((buf_ptr = SP->_setbuf) == 0) { - if ((buf_ptr = typeMalloc(char, buf_len)) == NULL) - return; - SP->_setbuf = buf_ptr; - /* Don't try to free this! */ - } + fflush(ofp); + if ((SP->_buffered = buffered) != 0) { + buf_len = min(LINES * (COLS + 6), 2800); + if ((buf_ptr = SP->_setbuf) == 0) { + if ((buf_ptr = typeMalloc(char, buf_len)) == NULL) + return; + SP->_setbuf = buf_ptr; + /* Don't try to free this! */ + } #if !USE_SETBUF_0 - else return; + else + return; #endif - } else { + } else { #if !USE_SETBUF_0 - return; + return; #else - buf_len = 0; - buf_ptr = 0; + buf_len = 0; + buf_ptr = 0; #endif - } + } #if HAVE_SETVBUF -#ifdef SETVBUF_REVERSED /* pre-svr3? */ - (void) setvbuf(ofp, buf_ptr, buf_len, buf_len ? _IOFBF : _IOLBF); +#ifdef SETVBUF_REVERSED /* pre-svr3? */ + (void) setvbuf(ofp, buf_ptr, buf_len, buf_len ? _IOFBF : _IOLBF); #else - (void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IOLBF, buf_len); + (void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IOLBF, buf_len); #endif #elif HAVE_SETBUFFER - (void) setbuffer(ofp, buf_ptr, (int)buf_len); + (void) setbuffer(ofp, buf_ptr, (int) buf_len); #endif #endif /* HAVE_SETVBUF || HAVE_SETBUFFER */ diff --git a/contrib/ncurses/ncurses/tinfo/strings.c b/contrib/ncurses/ncurses/tinfo/strings.c index 8198ec4..5fa68ca 100644 --- a/contrib/ncurses/ncurses/tinfo/strings.c +++ b/contrib/ncurses/ncurses/tinfo/strings.c @@ -36,15 +36,16 @@ #include <curses.priv.h> -MODULE_ID("$Id") +MODULE_ID("$Id: strings.c,v 1.3 2000/12/10 02:55:08 tom Exp $") /**************************************************************************** * Useful string functions (especially for mvcur) ****************************************************************************/ #if !HAVE_STRSTR -char * -_nc_strstr(const char *haystack, const char *needle) +NCURSES_EXPORT(char *) +_nc_strstr +(const char *haystack, const char *needle) { size_t len1 = strlen(haystack); size_t len2 = strlen(needle); @@ -64,8 +65,9 @@ _nc_strstr(const char *haystack, const char *needle) /* * Initialize the descriptor so we can append to it. */ -string_desc * -_nc_str_init(string_desc * dst, char *src, size_t len) +NCURSES_EXPORT(string_desc *) +_nc_str_init +(string_desc * dst, char *src, size_t len) { if (dst != 0) { dst->s_head = src; @@ -80,8 +82,9 @@ _nc_str_init(string_desc * dst, char *src, size_t len) /* * Initialize the descriptor for only tracking the amount of memory used. */ -string_desc * -_nc_str_null(string_desc * dst, size_t len) +NCURSES_EXPORT(string_desc *) +_nc_str_null +(string_desc * dst, size_t len) { return _nc_str_init(dst, 0, len); } @@ -89,8 +92,9 @@ _nc_str_null(string_desc * dst, size_t len) /* * Copy a descriptor */ -string_desc * -_nc_str_copy(string_desc * dst, string_desc * src) +NCURSES_EXPORT(string_desc *) +_nc_str_copy +(string_desc * dst, string_desc * src) { *dst = *src; return dst; @@ -99,7 +103,7 @@ _nc_str_copy(string_desc * dst, string_desc * src) /* * Replaces strcat into a fixed buffer, returning false on failure. */ -bool +NCURSES_EXPORT(bool) _nc_safe_strcat(string_desc * dst, const char *src) { if (src != 0) { @@ -120,7 +124,7 @@ _nc_safe_strcat(string_desc * dst, const char *src) /* * Replaces strcpy into a fixed buffer, returning false on failure. */ -bool +NCURSES_EXPORT(bool) _nc_safe_strcpy(string_desc * dst, const char *src) { if (src != 0) { diff --git a/contrib/ncurses/ncurses/tinfo/write_entry.c b/contrib/ncurses/ncurses/tinfo/write_entry.c index af4b4fd..ffcf402 100644 --- a/contrib/ncurses/ncurses/tinfo/write_entry.c +++ b/contrib/ncurses/ncurses/tinfo/write_entry.c @@ -52,7 +52,7 @@ #define TRACE_OUT(p) /*nothing */ #endif -MODULE_ID("$Id: write_entry.c,v 1.53 2000/10/04 02:32:14 tom Exp $") +MODULE_ID("$Id: write_entry.c,v 1.56 2000/12/10 02:55:08 tom Exp $") static int total_written; @@ -109,7 +109,7 @@ make_directory(const char *path) return rc; } -void +NCURSES_EXPORT(void) _nc_set_writedir(char *dir) /* set the write directory for compiled entries */ { @@ -117,7 +117,7 @@ _nc_set_writedir(char *dir) char actual[PATH_MAX]; if (dir == 0 - && use_terminfo_vars()) + && use_terminfo_vars()) dir = getenv("TERMINFO"); if (dir != 0) @@ -131,7 +131,7 @@ _nc_set_writedir(char *dir) destination = home; if (make_directory(destination) < 0) _nc_err_abort("%s: permission denied (errno %d)", - destination, errno); + destination, errno); } } @@ -164,7 +164,7 @@ check_writeable(int code) static bool verified[sizeof(dirnames)]; char dir[2]; - char *s; + char *s = 0; if (code == 0 || (s = strchr(dirnames, code)) == 0) _nc_err_abort("Illegal terminfo subdirectory \"%c\"", code); @@ -275,7 +275,7 @@ _nc_write_entry(TERMTYPE * const tp) if (stat(filename, &statbuf) < 0 || (start_time = statbuf.st_mtime) == 0) { _nc_syserr_abort("error obtaining time from %s/%s", - _nc_tic_dir(0), filename); + _nc_tic_dir(0), filename); } } while (*other_names != '\0') { @@ -301,7 +301,7 @@ _nc_write_entry(TERMTYPE * const tp) if (strcmp(filename, linkname) == 0) { _nc_warning("self-synonym ignored"); } else if (stat(linkname, &statbuf) >= 0 && - statbuf.st_mtime < start_time) { + statbuf.st_mtime < start_time) { _nc_warning("alias %s multiply defined.", ptr); } else if (_nc_access(linkname, W_OK) == 0) #if HAVE_LINK @@ -333,10 +333,16 @@ _nc_write_entry(TERMTYPE * const tp) */ if (code == 0 && errno == EEXIST) _nc_warning("can't link %s to %s", filename, linkname); - else if (code == 0 && errno == EPERM) + else if (code == 0 && (errno == EPERM || errno == ENOENT)) write_file(linkname, tp); - else + else { +#if MIXEDCASE_FILENAMES _nc_syserr_abort("can't link %s to %s", filename, linkname); +#else + _nc_warning("can't link %s to %s (errno=%d)", filename, + linkname, errno); +#endif + } } else { DEBUG(1, ("Linked %s", linkname)); } @@ -520,7 +526,7 @@ write_object(FILE * fp, TERMTYPE * tp) TRACE_OUT(("WRITE %d booleans @%ld", tp->ext_Booleans, ftell(fp))); if (tp->ext_Booleans && fwrite(tp->Booleans + BOOLCOUNT, sizeof(char), - tp->ext_Booleans, fp) != tp->ext_Booleans) + tp->ext_Booleans, fp) != tp->ext_Booleans) return (ERR); if (even_boundary(tp->ext_Booleans)) @@ -549,7 +555,7 @@ write_object(FILE * fp, TERMTYPE * tp) for (i = 0; i < tp->ext_Strings; i++) { if (VALID_STRING(tp->Strings[i + STRCOUNT])) { TRACE_OUT(("WRITE ext_Strings[%d]=%s", i, - _nc_visbuf(tp->Strings[i + STRCOUNT]))); + _nc_visbuf(tp->Strings[i + STRCOUNT]))); if (!WRITE_STRING(tp->Strings[i + STRCOUNT])) return (ERR); } @@ -574,7 +580,7 @@ write_object(FILE * fp, TERMTYPE * tp) /* * Returns the total number of entries written by this process */ -int +NCURSES_EXPORT(int) _nc_tic_written(void) { return total_written; diff --git a/contrib/ncurses/ncurses/trace/lib_trace.c b/contrib/ncurses/ncurses/trace/lib_trace.c index 51260ae..08790bb 100644 --- a/contrib/ncurses/ncurses/trace/lib_trace.c +++ b/contrib/ncurses/ncurses/trace/lib_trace.c @@ -40,17 +40,20 @@ #include <ctype.h> -MODULE_ID("$Id: lib_trace.c,v 1.34 2000/04/01 20:25:47 tom Exp $") +MODULE_ID("$Id: lib_trace.c,v 1.38 2000/12/10 03:02:45 tom Exp $") -unsigned _nc_tracing = 0; /* always define this */ +NCURSES_EXPORT_VAR(unsigned) +_nc_tracing = 0; /* always define this */ #ifdef TRACE -const char *_nc_tputs_trace = ""; -long _nc_outchars = 0; +NCURSES_EXPORT_VAR(const char *) +_nc_tputs_trace = ""; +NCURSES_EXPORT_VAR(long) +_nc_outchars = 0; -static FILE *tracefp; /* default to writing to stderr */ + static FILE *tracefp; /* default to writing to stderr */ -void +NCURSES_EXPORT(void) trace(const unsigned int tracelevel GCC_UNUSED) { static bool been_here = FALSE; @@ -61,7 +64,7 @@ trace(const unsigned int tracelevel GCC_UNUSED) been_here = TRUE; if (_nc_access(my_name, W_OK) < 0 - || (tracefp = fopen(my_name, "w")) == 0) { + || (tracefp = fopen(my_name, "wb")) == 0) { perror("curses: Can't open 'trace' file: "); exit(EXIT_FAILURE); } @@ -74,13 +77,12 @@ trace(const unsigned int tracelevel GCC_UNUSED) #elif HAVE_SETBUF /* POSIX */ (void) setbuffer(tracefp, (char *) 0); #endif - _tracef("TRACING NCURSES version %s (%d)", - NCURSES_VERSION, NCURSES_VERSION_PATCH); + _tracef("TRACING NCURSES version %s", curses_version()); } } #endif -const char * +NCURSES_EXPORT(const char *) _nc_visbuf2(int bufnum, const char *buf) /* visibilize a given string */ { @@ -97,9 +99,9 @@ _nc_visbuf2(int bufnum, const char *buf) 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]; + static char *mybuf[2]; + mybuf[bufnum] = _nc_doalloc(mybuf[bufnum], (strlen(buf) * 4) + 5); + tp = vbuf = mybuf[bufnum]; } #endif *tp++ = '"'; @@ -126,7 +128,7 @@ _nc_visbuf2(int bufnum, const char *buf) *tp++ = '^'; *tp++ = '@' + c; } else { - sprintf(tp, "\\%03o", c & 0xff); + sprintf(tp, "\\%03o", CharOf(c)); tp += strlen(tp); } } @@ -135,14 +137,14 @@ _nc_visbuf2(int bufnum, const char *buf) return (vbuf); } -const char * +NCURSES_EXPORT(const char *) _nc_visbuf(const char *buf) { return _nc_visbuf2(0, buf); } #ifdef TRACE -void +NCURSES_EXPORT(void) _tracef(const char *fmt,...) { static const char Called[] = T_CALLED(""); @@ -191,7 +193,7 @@ _tracef(const char *fmt,...) } /* Trace 'int' return-values */ -int +NCURSES_EXPORT(int) _nc_retrace_int(int code) { T((T_RETURN("%d"), code)); @@ -199,7 +201,7 @@ _nc_retrace_int(int code) } /* Trace 'char*' return-values */ -char * +NCURSES_EXPORT(char *) _nc_retrace_ptr(char *code) { T((T_RETURN("%s"), _nc_visbuf(code))); @@ -207,7 +209,7 @@ _nc_retrace_ptr(char *code) } /* Trace 'WINDOW *' return-values */ -WINDOW * +NCURSES_EXPORT(WINDOW *) _nc_retrace_win(WINDOW *code) { T((T_RETURN("%p"), code)); diff --git a/contrib/ncurses/ncurses/trace/lib_traceatr.c b/contrib/ncurses/ncurses/trace/lib_traceatr.c index c65c584..3584b6e 100644 --- a/contrib/ncurses/ncurses/trace/lib_traceatr.c +++ b/contrib/ncurses/ncurses/trace/lib_traceatr.c @@ -38,12 +38,12 @@ #include <curses.priv.h> #include <term.h> /* acs_chars */ -MODULE_ID("$Id: lib_traceatr.c,v 1.30 2000/07/29 18:06:09 tom Exp $") +MODULE_ID("$Id: lib_traceatr.c,v 1.32 2000/12/10 03:02:45 tom Exp $") #define COLOR_OF(c) (c < 0 || c > 7 ? "default" : colors[c].name) #ifdef TRACE -char * +NCURSES_EXPORT(char *) _traceattr2(int bufnum, attr_t newmode) { char *buf = _nc_trace_buf(bufnum, BUFSIZ); @@ -122,21 +122,21 @@ _traceattr2(int bufnum, attr_t newmode) return (strcat(buf, "}")); } -char * +NCURSES_EXPORT(char *) _traceattr(attr_t newmode) { return _traceattr2(0, newmode); } /* Trace 'int' return-values */ -attr_t +NCURSES_EXPORT(attr_t) _nc_retrace_attr_t(attr_t code) { T((T_RETURN("%s"), _traceattr(code))); return code; } -char * +NCURSES_EXPORT(char *) _tracechtype2(int bufnum, chtype ch) { char *buf = _nc_trace_buf(bufnum, BUFSIZ); @@ -217,24 +217,23 @@ _tracechtype2(int bufnum, chtype ch) return (buf); } -char * -_tracechtype(chtype ch) +NCURSES_EXPORT(char *) +_tracechtype (chtype ch) { return _tracechtype2(0, ch); } /* Trace 'chtype' return-values */ -attr_t -_nc_retrace_chtype(attr_t code) +NCURSES_EXPORT(attr_t) +_nc_retrace_chtype (attr_t code) { T((T_RETURN("%s"), _tracechtype(code))); return code; } #else -extern void _nc_lib_traceatr(void); -void -_nc_lib_traceatr(void) +extern NCURSES_EXPORT(void) _nc_lib_traceatr (void); +NCURSES_EXPORT(void) _nc_lib_traceatr (void) { } #endif /* TRACE */ diff --git a/contrib/ncurses/ncurses/trace/lib_tracebits.c b/contrib/ncurses/ncurses/trace/lib_tracebits.c index a8cb343..21a3b92 100644 --- a/contrib/ncurses/ncurses/trace/lib_tracebits.c +++ b/contrib/ncurses/ncurses/trace/lib_tracebits.c @@ -34,7 +34,7 @@ #include <curses.priv.h> #include <term.h> /* cur_term */ -MODULE_ID("$Id: lib_tracebits.c,v 1.7 2000/09/02 18:08:37 tom Exp $") +MODULE_ID("$Id: lib_tracebits.c,v 1.10 2001/03/24 21:58:23 tom Exp $") #if SVR4_TERMIO && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE @@ -81,7 +81,7 @@ lookup_bits(char *buf, const BITNAMES * table, const char *label, unsigned int v (void) strcat(buf, "} "); } -char * +NCURSES_EXPORT(char *) _nc_tracebits(void) /* describe the state of the terminal control bits exactly */ { @@ -137,11 +137,11 @@ _nc_tracebits(void) }; buf = _nc_trace_buf(0, - 8 + sizeof(iflags) + - 8 + sizeof(oflags) + - 8 + sizeof(cflags) + - 8 + sizeof(lflags) + - 8); + 8 + sizeof(iflags) + + 8 + sizeof(oflags) + + 8 + sizeof(cflags) + + 8 + sizeof(lflags) + + 8); if (cur_term->Nttyb.c_iflag & ALLIN) lookup_bits(buf, iflags, "iflags", cur_term->Nttyb.c_iflag); @@ -155,7 +155,7 @@ _nc_tracebits(void) #if defined(CS5) && defined(CS8) { static struct { - char *name; + const char *name; int value; } csizes[] = { { @@ -175,7 +175,7 @@ _nc_tracebits(void) "CS8 ", CS8 }, }; - char *result = "CSIZE? "; + const char *result = "CSIZE? "; int value = (cur_term->Nttyb.c_cflag & CSIZE); unsigned n; @@ -229,7 +229,7 @@ _nc_tracebits(void) }; buf = _nc_trace_buf(0, - 8 + sizeof(cflags)); + 8 + sizeof(cflags)); if (cur_term->Nttyb.sg_flags & ALLCTRL) { lookup_bits(buf, cflags, "cflags", cur_term->Nttyb.sg_flags); @@ -238,7 +238,7 @@ _nc_tracebits(void) return (buf); } #else -char * +NCURSES_EXPORT(char *) _nc_tracebits(void) { static char tmp[] = ""; diff --git a/contrib/ncurses/ncurses/trace/lib_tracechr.c b/contrib/ncurses/ncurses/trace/lib_tracechr.c index bf004f3..a019969 100644 --- a/contrib/ncurses/ncurses/trace/lib_tracechr.c +++ b/contrib/ncurses/ncurses/trace/lib_tracechr.c @@ -36,16 +36,22 @@ */ #include <curses.priv.h> -MODULE_ID("$Id: lib_tracechr.c,v 1.2 2000/04/01 20:17:26 tom Exp $") +MODULE_ID("$Id: lib_tracechr.c,v 1.4 2000/12/10 03:02:45 tom Exp $") #ifdef TRACE -char *_tracechar(const unsigned char ch) +NCURSES_EXPORT(char *) +_tracechar(const unsigned char ch) { static char crep[20]; - (void) sprintf(crep, "'%s' = 0x%02x", unctrl(ch), (unsigned)ch); - return(crep); + (void) sprintf(crep, "'%s' = 0x%02x", unctrl(ch), (unsigned) ch); + return (crep); } #else -extern void _nc_lib_tracechr(void); - void _nc_lib_tracechr(void) { } +extern +NCURSES_EXPORT(void) +_nc_lib_tracechr(void); +NCURSES_EXPORT(void) +_nc_lib_tracechr(void) +{ +} #endif diff --git a/contrib/ncurses/ncurses/trace/lib_tracedmp.c b/contrib/ncurses/ncurses/trace/lib_tracedmp.c index a67a37e..22304ce 100644 --- a/contrib/ncurses/ncurses/trace/lib_tracedmp.c +++ b/contrib/ncurses/ncurses/trace/lib_tracedmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,92 +37,93 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_tracedmp.c,v 1.13 1998/03/21 18:39:44 tom Exp $") +MODULE_ID("$Id: lib_tracedmp.c,v 1.16 2000/12/10 03:02:45 tom Exp $") #ifdef TRACE -void _tracedump(const char *name, WINDOW *win) +NCURSES_EXPORT(void) +_tracedump(const char *name, WINDOW *win) { - int i, j, n, width; + 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] != ' ') - n = j; + if (win->_line[i].text[j] != ' ') + n = j; if (n > width) - width = n; + width = n; } if (width < win->_maxx) - ++width; + ++width; - for (n = 0; n <= win->_maxy; n++) - { - char buf[BUFSIZ], *ep; + for (n = 0; n <= win->_maxy; n++) { + char buf[BUFSIZ], *ep; bool haveattrs, havecolors; /* dump A_CHARTEXT part */ (void) sprintf(buf, "%s[%2d] %3d%3d ='", - name, n, - win->_line[n].firstchar, - win->_line[n].lastchar); + 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] = '.'; + ep[j] = '.'; } ep[j] = '\''; - ep[j+1] = '\0'; + ep[j + 1] = '\0'; _tracef("%s", buf); /* 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) - { + if (win->_line[n].text[j] & A_COLOR) { havecolors = TRUE; break; } - if (havecolors) - { - (void) sprintf(buf, "%*s[%2d]%*s='", (int)strlen(name), "colors", n, 8, " "); + 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] = ((win->_line[n].text[j] >> 8) & 0xff) + ' '; + ep[j] = CharOf(win->_line[n].text[j] >> 8) + ' '; ep[j] = '\''; - ep[j+1] = '\0'; + ep[j + 1] = '\0'; _tracef("%s", buf); } - for (i = 0; i < 4; i++) - { - const char *hex = " 123456789ABCDEF"; - chtype mask = (0xf << ((i + 4) * 4)); + for (i = 0; i < 4; i++) { + const char *hex = " 123456789ABCDEF"; + chtype mask = (0xf << ((i + 4) * 4)); haveattrs = FALSE; for (j = 0; j <= width; j++) - if (win->_line[n].text[j] & mask) - { + if (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, " "); + 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'; + ep[j + 1] = '\0'; _tracef("%s", buf); } } } } #else -extern void _nc_lib_tracedmp(void); - void _nc_lib_tracedmp(void) { } +extern +NCURSES_EXPORT(void) +_nc_lib_tracedmp(void); +NCURSES_EXPORT(void) +_nc_lib_tracedmp(void) +{ +} #endif /* TRACE */ diff --git a/contrib/ncurses/ncurses/trace/lib_tracemse.c b/contrib/ncurses/ncurses/trace/lib_tracemse.c index fbdd2c0..38dd57e 100644 --- a/contrib/ncurses/ncurses/trace/lib_tracemse.c +++ b/contrib/ncurses/ncurses/trace/lib_tracemse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,65 +31,68 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* * lib_tracemse.c - Tracing/Debugging routines (mouse events) */ #include <curses.priv.h> -MODULE_ID("$Id: lib_tracemse.c,v 1.6 1998/11/16 14:28:17 Alexander.V.Lukyanov Exp $") +MODULE_ID("$Id: lib_tracemse.c,v 1.8 2000/12/10 03:02:45 tom Exp $") #ifdef TRACE -char *_tracemouse(MEVENT const *ep) +NCURSES_EXPORT(char *) +_tracemouse(MEVENT const *ep) { - static char buf[80]; + static char buf[80]; - (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {", - ep->id, ep->x, ep->y, ep->z, ep->bstate); + (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") + 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] == ' ') - buf[strlen(buf)-2] = '\0'; - (void) strcat(buf, "}"); - return(buf); + if (buf[strlen(buf) - 1] == ' ') + buf[strlen(buf) - 2] = '\0'; + (void) strcat(buf, "}"); + return (buf); } #else /* !TRACE */ /* don't make empty module */ -void _nc_lib_tracemouse(void); -void _nc_lib_tracemouse(void) {} +NCURSES_EXPORT(void) +_nc_lib_tracemouse(void); +NCURSES_EXPORT(void) +_nc_lib_tracemouse(void) +{ +} #endif diff --git a/contrib/ncurses/ncurses/trace/trace_buf.c b/contrib/ncurses/ncurses/trace/trace_buf.c index 48f93d4..15748d4 100644 --- a/contrib/ncurses/ncurses/trace/trace_buf.c +++ b/contrib/ncurses/ncurses/trace/trace_buf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 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,46 +35,48 @@ #include <curses.priv.h> -MODULE_ID("$Id: trace_buf.c,v 1.7 1999/02/27 19:50:58 tom Exp $") +MODULE_ID("$Id: trace_buf.c,v 1.10 2001/04/21 21:19:18 tom Exp $") typedef struct { - char *text; - size_t size; + char *text; + size_t size; } LIST; -char * _nc_trace_buf(int bufnum, size_t want) +NCURSES_EXPORT(char *) +_nc_trace_buf(int bufnum, size_t want) { - static LIST *list; - static size_t have; + static LIST *list; + static size_t have; #if NO_LEAKS - if (bufnum < 0) { - if (have) { - while (have--) { - free(list[have].text); - } - free(list); - } - return 0; + if (bufnum < 0) { + if (have) { + while (have--) { + if (list[have].text != 0) + free(list[have].text); + } + free(list); } + return 0; + } #endif - if ((size_t)(bufnum+1) > have) { - size_t need = (bufnum + 1) * 2; - if ((list = typeRealloc(LIST, need, list)) == 0) - return(0); - while (need > have) - list[have++].text = 0; - } + if ((size_t) (bufnum + 1) > have) { + size_t need = (bufnum + 1) * 2; + if ((list = typeRealloc(LIST, need, list)) == 0) + return (0); + while (need > have) + list[have++].text = 0; + } - if (list[bufnum].text == 0 - || want > list[bufnum].size) - { - if ((list[bufnum].text = typeRealloc(char, want, list[bufnum].text)) != 0) - list[bufnum].size = want; - } + if (list[bufnum].text == 0 + || want > list[bufnum].size) { + if ((list[bufnum].text = typeRealloc(char, want, list[bufnum].text)) + != 0) + list[bufnum].size = want; + } - if (list[bufnum].text != 0) - *(list[bufnum].text) = '\0'; - return list[bufnum].text; + if (list[bufnum].text != 0) + *(list[bufnum].text) = '\0'; + return list[bufnum].text; } diff --git a/contrib/ncurses/ncurses/trace/trace_tries.c b/contrib/ncurses/ncurses/trace/trace_tries.c index abd5db4..fdf3a09 100644 --- a/contrib/ncurses/ncurses/trace/trace_tries.c +++ b/contrib/ncurses/ncurses/trace/trace_tries.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 Free 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,40 +35,45 @@ #include <curses.priv.h> -MODULE_ID("$Id: trace_tries.c,v 1.6 1999/03/06 22:51:07 tom Exp $") +MODULE_ID("$Id: trace_tries.c,v 1.8 2000/12/10 03:03:51 tom Exp $") #ifdef TRACE static unsigned char *buffer; static unsigned len; -static void recur_tries(struct tries *tree, unsigned level) +static void +recur_tries(struct tries *tree, unsigned level) { - if (level > len) - buffer = (unsigned char *)realloc(buffer, len = (level + 1) * 4); + if (level > len) + buffer = (unsigned char *) realloc(buffer, len = (level + 1) * 4); - while (tree != 0) { - if ((buffer[level] = tree->ch) == 0) - buffer[level] = 128; - buffer[level+1] = 0; - if (tree->value != 0) { - _tracef("%5d: %s (%s)", tree->value, _nc_visbuf((char *)buffer), keyname(tree->value)); - } - if (tree->child) - recur_tries(tree->child, level+1); - tree = tree->sibling; + while (tree != 0) { + if ((buffer[level] = tree->ch) == 0) + buffer[level] = 128; + buffer[level + 1] = 0; + if (tree->value != 0) { + _tracef("%5d: %s (%s)", tree->value, + _nc_visbuf((char *) buffer), keyname(tree->value)); } + if (tree->child) + recur_tries(tree->child, level + 1); + tree = tree->sibling; + } } -void _nc_trace_tries(struct tries *tree) +NCURSES_EXPORT(void) +_nc_trace_tries(struct tries *tree) { - buffer = typeMalloc(unsigned char, len = 80); - _tracef("BEGIN tries %p", tree); - recur_tries(tree, 0); - _tracef(". . . tries %p", tree); - free(buffer); + buffer = typeMalloc(unsigned char, len = 80); + _tracef("BEGIN tries %p", tree); + recur_tries(tree, 0); + _tracef(". . . tries %p", tree); + free(buffer); } + #else -void _nc_trace_tries(struct tries *tree GCC_UNUSED) +NCURSES_EXPORT(void) +_nc_trace_tries(struct tries *tree GCC_UNUSED) { } #endif diff --git a/contrib/ncurses/ncurses/trace/trace_xnames.c b/contrib/ncurses/ncurses/trace/trace_xnames.c index 6287fc8..9b0b592 100644 --- a/contrib/ncurses/ncurses/trace/trace_xnames.c +++ b/contrib/ncurses/ncurses/trace/trace_xnames.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,9 +36,10 @@ #include <curses.priv.h> #include <term_entry.h> -MODULE_ID("$Id: trace_xnames.c,v 1.3 1999/03/02 01:20:38 tom Exp $") +MODULE_ID("$Id: trace_xnames.c,v 1.5 2000/12/10 03:02:45 tom Exp $") -void _nc_trace_xnames(TERMTYPE *tp GCC_UNUSED) +NCURSES_EXPORT(void) +_nc_trace_xnames(TERMTYPE * tp GCC_UNUSED) { #ifdef TRACE #if NCURSES_XNAMES @@ -56,16 +57,16 @@ void _nc_trace_xnames(TERMTYPE *tp GCC_UNUSED) for (n = 0; n < limit; n++) { if ((m = n - begin_str) >= 0) { _tracef("[%d] %s = %s", n, - tp->ext_Names[n], - _nc_visbuf(tp->Strings[tp->num_Strings + m - tp->ext_Strings])); + tp->ext_Names[n], + _nc_visbuf(tp->Strings[tp->num_Strings + m - tp->ext_Strings])); } else if ((m = n - begin_num) >= 0) { _tracef("[%d] %s = %d (num)", n, - tp->ext_Names[n], - tp->Numbers[tp->num_Numbers + m - tp->ext_Numbers]); + tp->ext_Names[n], + tp->Numbers[tp->num_Numbers + m - tp->ext_Numbers]); } else { _tracef("[%d] %s = %d (bool)", n, - tp->ext_Names[n], - tp->Booleans[tp->num_Booleans + n - tp->ext_Booleans]); + tp->ext_Names[n], + tp->Booleans[tp->num_Booleans + n - tp->ext_Booleans]); } } } diff --git a/contrib/ncurses/ncurses/tty/MKexpanded.sh b/contrib/ncurses/ncurses/tty/MKexpanded.sh index e44f583..8e4a6c6 100755 --- a/contrib/ncurses/ncurses/tty/MKexpanded.sh +++ b/contrib/ncurses/ncurses/tty/MKexpanded.sh @@ -29,7 +29,7 @@ # # Author: Thomas E. Dickey <dickey@clark.net> 1997 # -# $Id: MKexpanded.sh,v 1.9 2000/09/02 22:55:21 tom Exp $ +# $Id: MKexpanded.sh,v 1.10 2000/12/10 00:24:33 tom Exp $ # # Script to generate 'expanded.c', a dummy source that contains functions # corresponding to complex macros used in this library. By making functions, @@ -68,23 +68,23 @@ cat >$TMP <<EOF #undef FALSE /* this is a marker */ IGNORE -void _nc_toggle_attr_on(attr_t *S, attr_t at) +NCURSES_EXPORT(void) _nc_toggle_attr_on (attr_t *S, attr_t at) { toggle_attr_on(*S,at); } -void _nc_toggle_attr_off(attr_t *S, attr_t at) +NCURSES_EXPORT(void) _nc_toggle_attr_off (attr_t *S, attr_t at) { toggle_attr_off(*S,at); } -int _nc_DelCharCost(int count) +NCURSES_EXPORT(int) _nc_DelCharCost (int count) { return DelCharCost(count); } -int _nc_InsCharCost(int count) +NCURSES_EXPORT(int) _nc_InsCharCost (int count) { return InsCharCost(count); } -void _nc_UpdateAttrs(chtype c) +NCURSES_EXPORT(void) _nc_UpdateAttrs (chtype c) { UpdateAttrs(c); } @@ -94,6 +94,6 @@ $preprocessor $TMP 2>/dev/null | sed -e '1,/^IGNORE$/d' cat <<EOF #else /* ! NCURSES_EXPANDED */ -void _nc_expanded(void) { } +NCURSES_EXPORT(void) _nc_expanded (void) { } #endif /* NCURSES_EXPANDED */ EOF diff --git a/contrib/ncurses/ncurses/tty/hardscroll.c b/contrib/ncurses/ncurses/tty/hardscroll.c index b80d08a..7815db7 100644 --- a/contrib/ncurses/ncurses/tty/hardscroll.c +++ b/contrib/ncurses/ncurses/tty/hardscroll.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,6 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - /****************************************************************************** NAME @@ -146,13 +145,14 @@ AUTHOR #include <curses.priv.h> -MODULE_ID("$Id: hardscroll.c,v 1.33 1999/02/27 20:01:29 tom Exp $") +MODULE_ID("$Id: hardscroll.c,v 1.36 2001/01/14 00:17:28 tom Exp $") #if defined(SCROLLDEBUG) || defined(HASHDEBUG) # undef screen_lines # define screen_lines MAXLINES -int oldnums[MAXLINES]; +NCURSES_EXPORT_VAR(int) +oldnums[MAXLINES]; # define OLDNUM(n) oldnums[n] # define _tracef printf # undef TR @@ -163,19 +163,21 @@ int oldnums[MAXLINES]; /* OLDNUM(n) indicates which line will be shifted to the position n. if OLDNUM(n) == _NEWINDEX, then the line n in new, not shifted from somewhere. */ +NCURSES_EXPORT_VAR(int *) +_nc_oldnums = 0; + # if USE_HASHMAP -int *_nc_oldnums = 0; -static int oldnums_allocated = 0; + static int oldnums_allocated = 0; # define oldnums _nc_oldnums # define OLDNUM(n) oldnums[n] -# else /* !USE_HASHMAP */ +# else /* !USE_HASHMAP */ # define OLDNUM(n) newscr->_line[n].oldindex -# endif /* !USE_HASHMAP */ +# endif /* !USE_HASHMAP */ #endif /* defined(SCROLLDEBUG) || defined(HASHDEBUG) */ - -void _nc_scroll_optimize(void) +NCURSES_EXPORT(void) +_nc_scroll_optimize(void) /* scroll optimization to transform curscr to newscr */ { int i; @@ -186,8 +188,7 @@ void _nc_scroll_optimize(void) #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) #if USE_HASHMAP /* get enough storage */ - if (oldnums_allocated < screen_lines) - { + if (oldnums_allocated < screen_lines) { int *new_oldnums = typeRealloc(int, screen_lines, oldnums); if (!new_oldnums) return; @@ -205,25 +206,24 @@ void _nc_scroll_optimize(void) #endif /* TRACE */ /* pass 1 - from top to bottom scrolling up */ - for (i = 0; i < screen_lines; ) - { + for (i = 0; i < screen_lines;) { while (i < screen_lines && (OLDNUM(i) == _NEWINDEX || OLDNUM(i) <= i)) i++; if (i >= screen_lines) break; - shift = OLDNUM(i) - i; /* shift > 0 */ + shift = OLDNUM(i) - i; /* shift > 0 */ start = i; i++; - while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) + while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i + == shift) i++; - end = i-1 + shift; + end = i - 1 + shift; TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", start, end, shift)); #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) - if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) - { + if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) { TR(TRACE_UPDATE | TRACE_MOVE, ("unable to scroll")); continue; } @@ -231,25 +231,23 @@ void _nc_scroll_optimize(void) } /* pass 2 - from bottom to top scrolling down */ - for (i = screen_lines-1; i >= 0; ) - { + for (i = screen_lines - 1; i >= 0;) { while (i >= 0 && (OLDNUM(i) == _NEWINDEX || OLDNUM(i) >= i)) i--; if (i < 0) break; - shift = OLDNUM(i) - i; /* shift < 0 */ + shift = OLDNUM(i) - i; /* shift < 0 */ end = i; i--; while (i >= 0 && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) i--; - start = i+1 - (-shift); + start = i + 1 - (-shift); TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", start, end, shift)); #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) - if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) - { + if (_nc_scrolln(shift, start, end, screen_lines - 1) == ERR) { TR(TRACE_UPDATE | TRACE_MOVE, ("unable to scroll")); continue; } @@ -258,14 +256,15 @@ void _nc_scroll_optimize(void) } #if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG) -void _nc_linedump(void) +NCURSES_EXPORT(void) +_nc_linedump(void) /* dump the state of the real and virtual oldnum fields */ { static size_t have; static char *buf; - int n; - size_t want = (screen_lines + 1) * 4; + int n; + size_t want = (screen_lines + 1) * 4; if (have < want) buf = typeMalloc(char, have = want); @@ -284,28 +283,26 @@ void _nc_linedump(void) #ifdef SCROLLDEBUG int -main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - char line[BUFSIZ], *st; + char line[BUFSIZ], *st; #ifdef TRACE _nc_tracing = TRACE_MOVE; #endif - for (;;) - { - int n; + for (;;) { + int n; for (n = 0; n < screen_lines; n++) oldnums[n] = _NEWINDEX; /* grab the test vector */ - if (fgets(line, sizeof(line), stdin) == (char *)NULL) + if (fgets(line, sizeof(line), stdin) == (char *) NULL) exit(EXIT_SUCCESS); /* parse it */ n = 0; - if (line[0] == '#') - { + if (line[0] == '#') { (void) fputs(line, stderr); continue; } @@ -313,7 +310,7 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) do { oldnums[n++] = atoi(st); } while - ((st = strtok((char *)NULL, " ")) != 0); + ((st = strtok((char *) NULL, " ")) != 0); /* display it */ (void) fputs("Initial input:\n", stderr); diff --git a/contrib/ncurses/ncurses/tty/hashmap.c b/contrib/ncurses/ncurses/tty/hashmap.c index 300ac9a..6d3d61d 100644 --- a/contrib/ncurses/ncurses/tty/hashmap.c +++ b/contrib/ncurses/ncurses/tty/hashmap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -68,9 +68,9 @@ AUTHOR *****************************************************************************/ #include <curses.priv.h> -#include <term.h> /* for back_color_erase */ +#include <term.h> /* for back_color_erase */ -MODULE_ID("$Id: hashmap.c,v 1.34 1999/11/28 00:10:57 tom Exp $") +MODULE_ID("$Id: hashmap.c,v 1.36 2000/12/10 03:04:30 tom Exp $") #ifdef HASHDEBUG @@ -100,41 +100,43 @@ static chtype oldtext[MAXLINES][TEXTWIDTH], newtext[MAXLINES][TEXTWIDTH]; #define oldhash (SP->oldhash) #define newhash (SP->newhash) -static inline unsigned long hash(chtype *text) +static inline unsigned long +hash(chtype * text) { int i; chtype ch; unsigned long result = 0; - for (i = TEXTWIDTH; i>0; i--) - { + for (i = TEXTWIDTH; i > 0; i--) { ch = *text++; - result += (result<<5) + ch; + result += (result << 5) + ch; } return result; } /* approximate update cost */ -static int update_cost(chtype *from,chtype *to) +static int +update_cost(chtype * from, chtype * to) { - int cost=0; + int cost = 0; int i; - for (i=TEXTWIDTH; i>0; i--) + for (i = TEXTWIDTH; i > 0; i--) if (*from++ != *to++) cost++; return cost; } -static int update_cost_from_blank(chtype *to) +static int +update_cost_from_blank(chtype * to) { - int cost=0; + int cost = 0; int i; chtype blank = BLANK; if (back_color_erase) blank |= (stdscr->_bkgd & A_COLOR); - for (i=TEXTWIDTH; i>0; i--) + for (i = TEXTWIDTH; i > 0; i--) if (blank != *to++) cost++; @@ -145,7 +147,8 @@ static int update_cost_from_blank(chtype *to) * Returns true when moving line 'from' to line 'to' seems to be cost * effective. 'blank' indicates whether the line 'to' would become blank. */ -static inline bool cost_effective(const int from, const int to, const bool blank) +static inline bool +cost_effective(const int from, const int to, const bool blank) { int new_from; @@ -161,30 +164,28 @@ static inline bool cost_effective(const int from, const int to, const bool blank * on the right side -- cost after moving. */ return (((blank ? update_cost_from_blank(NEWTEXT(to)) - : update_cost(OLDTEXT(to),NEWTEXT(to))) - + update_cost(OLDTEXT(new_from),NEWTEXT(from))) - >= ((new_from==from ? update_cost_from_blank(NEWTEXT(from)) - : update_cost(OLDTEXT(new_from),NEWTEXT(from))) - + update_cost(OLDTEXT(from),NEWTEXT(to)))) ? TRUE : FALSE; + : update_cost(OLDTEXT(to), NEWTEXT(to))) + + update_cost(OLDTEXT(new_from), NEWTEXT(from))) + >= ((new_from == from ? update_cost_from_blank(NEWTEXT(from)) + : update_cost(OLDTEXT(new_from), NEWTEXT(from))) + + update_cost(OLDTEXT(from), NEWTEXT(to)))) ? TRUE : FALSE; } +typedef struct { + unsigned long hashval; + int oldcount, newcount; + int oldindex, newindex; +} sym; -typedef struct -{ - unsigned long hashval; - int oldcount, newcount; - int oldindex, newindex; -} - sym; - -static sym *hashtab=0; -static int lines_alloc=0; +static sym *hashtab = 0; +static int lines_alloc = 0; -static void grow_hunks(void) +static void +grow_hunks(void) { int start, end, shift; - int back_limit, forward_limit; /* limits for cells to fill */ - int back_ref_limit, forward_ref_limit; /* limits for refrences */ + int back_limit, forward_limit; /* limits for cells to fill */ + int back_ref_limit, forward_ref_limit; /* limits for refrences */ int i; int next_hunk; @@ -198,14 +199,14 @@ static void grow_hunks(void) i = 0; while (i < screen_lines && OLDNUM(i) == _NEWINDEX) i++; - for ( ; i < screen_lines; i=next_hunk) - { + for (; i < screen_lines; i = next_hunk) { start = i; shift = OLDNUM(i) - i; /* get forward limit */ - i = start+1; - while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) + i = start + 1; + while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i + == shift) i++; end = i; while (i < screen_lines && OLDNUM(i) == _NEWINDEX) @@ -217,25 +218,21 @@ static void grow_hunks(void) else forward_ref_limit = OLDNUM(i); - i = start-1; + i = start - 1; /* grow back */ if (shift < 0) back_limit = back_ref_limit + (-shift); - while (i >= back_limit) - { - if(newhash[i] == oldhash[i+shift] - || cost_effective(i+shift, i, shift<0)) - { - OLDNUM(i) = i+shift; + while (i >= back_limit) { + if (newhash[i] == oldhash[i + shift] + || cost_effective(i + shift, i, shift < 0)) { + OLDNUM(i) = i + shift; TR(TRACE_UPDATE | TRACE_MOVE, ("connected new line %d to old line %d (backward continuation)", - i, i+shift)); - } - else - { + i, i + shift)); + } else { TR(TRACE_UPDATE | TRACE_MOVE, ("not connecting new line %d to old line %d (backward continuation)", - i, i+shift)); + i, i + shift)); break; } i--; @@ -245,21 +242,17 @@ static void grow_hunks(void) /* grow forward */ if (shift > 0) forward_limit = forward_ref_limit - shift; - while (i < forward_limit) - { - if(newhash[i] == oldhash[i+shift] - || cost_effective(i+shift, i, shift>0)) - { - OLDNUM(i) = i+shift; + while (i < forward_limit) { + if (newhash[i] == oldhash[i + shift] + || cost_effective(i + shift, i, shift > 0)) { + OLDNUM(i) = i + shift; TR(TRACE_UPDATE | TRACE_MOVE, ("connected new line %d to old line %d (forward continuation)", - i, i+shift)); - } - else - { + i, i + shift)); + } else { TR(TRACE_UPDATE | TRACE_MOVE, ("not connecting new line %d to old line %d (forward continuation)", - i, i+shift)); + i, i + shift)); break; } i++; @@ -271,22 +264,19 @@ static void grow_hunks(void) } } -void _nc_hash_map(void) +NCURSES_EXPORT(void) +_nc_hash_map(void) { sym *sp; register int i; int start, shift, size; - - if (screen_lines > lines_alloc) - { + if (screen_lines > lines_alloc) { if (hashtab) - free (hashtab); - hashtab = typeMalloc(sym, (screen_lines+1)*2); - if (!hashtab) - { - if (oldhash) - { + free(hashtab); + hashtab = typeMalloc(sym, (screen_lines + 1) * 2); + if (!hashtab) { + if (oldhash) { FreeAndNull(oldhash); } lines_alloc = 0; @@ -295,47 +285,40 @@ void _nc_hash_map(void) lines_alloc = screen_lines; } - if (oldhash && newhash) - { + if (oldhash && newhash) { /* re-hash only changed lines */ - for (i = 0; i < screen_lines; i++) - { + for (i = 0; i < screen_lines; i++) { if (PENDING(i)) newhash[i] = hash(NEWTEXT(i)); } - } - else - { + } else { /* re-hash all */ if (oldhash == 0) - oldhash = typeCalloc (unsigned long, screen_lines); + oldhash = typeCalloc(unsigned long, screen_lines); if (newhash == 0) - newhash = typeCalloc (unsigned long, screen_lines); + newhash = typeCalloc(unsigned long, screen_lines); if (!oldhash || !newhash) - return; /* malloc failure */ - for (i = 0; i < screen_lines; i++) - { + return; /* malloc failure */ + for (i = 0; i < screen_lines; i++) { newhash[i] = hash(NEWTEXT(i)); oldhash[i] = hash(OLDTEXT(i)); } } #ifdef HASH_VERIFY - for (i = 0; i < screen_lines; i++) - { - if(newhash[i] != hash(NEWTEXT(i))) - fprintf(stderr,"error in newhash[%d]\n",i); - if(oldhash[i] != hash(OLDTEXT(i))) - fprintf(stderr,"error in oldhash[%d]\n",i); + for (i = 0; i < screen_lines; i++) { + if (newhash[i] != hash(NEWTEXT(i))) + fprintf(stderr, "error in newhash[%d]\n", i); + if (oldhash[i] != hash(OLDTEXT(i))) + fprintf(stderr, "error in oldhash[%d]\n", i); } #endif /* * Set up and count line-hash values. */ - memset(hashtab, '\0', sizeof(*hashtab)*(screen_lines+1)*2); - for (i = 0; i < screen_lines; i++) - { + memset(hashtab, '\0', sizeof(*hashtab) * (screen_lines + 1) * 2); + for (i = 0; i < screen_lines; i++) { unsigned long hashval = oldhash[i]; for (sp = hashtab; sp->hashval; sp++) @@ -345,8 +328,7 @@ void _nc_hash_map(void) sp->oldcount++; sp->oldindex = i; } - for (i = 0; i < screen_lines; i++) - { + for (i = 0; i < screen_lines; i++) { unsigned long hashval = newhash[i]; for (sp = hashtab; sp->hashval; sp++) @@ -368,11 +350,10 @@ void _nc_hash_map(void) */ for (sp = hashtab; sp->hashval; sp++) if (sp->oldcount == 1 && sp->newcount == 1 - && sp->oldindex != sp->newindex) - { + && sp->oldindex != sp->newindex) { TR(TRACE_UPDATE | TRACE_MOVE, ("new line %d is hash-identical to old line %d (unique)", - sp->newindex, sp->oldindex)); + sp->newindex, sp->oldindex)); OLDNUM(sp->newindex) = sp->oldindex; } @@ -384,8 +365,7 @@ void _nc_hash_map(void) * those which are to be moved too far, they are likely to destroy * more than carry. */ - for (i = 0; i < screen_lines; ) - { + for (i = 0; i < screen_lines;) { while (i < screen_lines && OLDNUM(i) == _NEWINDEX) i++; if (i >= screen_lines) @@ -393,13 +373,12 @@ void _nc_hash_map(void) start = i; shift = OLDNUM(i) - i; i++; - while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i == shift) + while (i < screen_lines && OLDNUM(i) != _NEWINDEX && OLDNUM(i) - i + == shift) i++; size = i - start; - if (size < 3 || size+min(size/8,2) < abs(shift)) - { - while (start < i) - { + if (size < 3 || size + min(size / 8, 2) < abs(shift)) { + while (start < i) { OLDNUM(start) = _NEWINDEX; start++; } @@ -415,13 +394,15 @@ void _nc_hash_map(void) #endif } -void _nc_make_oldhash(int i) +NCURSES_EXPORT(void) +_nc_make_oldhash(int i) { if (oldhash) oldhash[i] = hash(OLDTEXT(i)); } -void _nc_scroll_oldhash(int n, int top, int bot) +NCURSES_EXPORT(void) +_nc_scroll_oldhash(int n, int top, int bot) { int size; int i; @@ -429,27 +410,24 @@ void _nc_scroll_oldhash(int n, int top, int bot) if (!oldhash) return; - size = sizeof(*oldhash) * (bot-top+1-abs(n)); - if (n > 0) - { - memmove (oldhash+top, oldhash+top+n, size); - for (i = bot; i > bot-n; i--) + size = sizeof(*oldhash) * (bot - top + 1 - abs(n)); + if (n > 0) { + memmove(oldhash + top, oldhash + top + n, size); + for (i = bot; i > bot - n; i--) oldhash[i] = hash(OLDTEXT(i)); - } - else - { - memmove (oldhash+top-n, oldhash+top, size); - for (i = top; i < top-n; i++) + } else { + memmove(oldhash + top - n, oldhash + top, size); + for (i = top; i < top - n; i++) oldhash[i] = hash(OLDTEXT(i)); } } - #ifdef HASHDEBUG static void usage(void) { - static const char *table[] = { + static const char *table[] = + { "hashmap test-driver", "", "# comment", @@ -461,19 +439,18 @@ usage(void) "? this message" }; size_t n; - for (n = 0; n < sizeof(table)/sizeof(table[0]); n++) + for (n = 0; n < sizeof(table) / sizeof(table[0]); n++) fprintf(stderr, "%s\n", table[n]); } int -main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - char line[BUFSIZ], *st; - int n; + char line[BUFSIZ], *st; + int n; - SP = typeCalloc(SCREEN,1); - for (n = 0; n < screen_lines; n++) - { + SP = typeCalloc(SCREEN, 1); + for (n = 0; n < screen_lines; n++) { reallines[n] = n; oldnums[n] = _NEWINDEX; oldtext[n][0] = newtext[n][0] = '.'; @@ -485,21 +462,18 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) #ifdef TRACE _nc_tracing = TRACE_MOVE; #endif - for (;;) - { + for (;;) { /* grab a test command */ - if (fgets(line, sizeof(line), stdin) == (char *)NULL) + if (fgets(line, sizeof(line), stdin) == (char *) NULL) exit(EXIT_SUCCESS); - switch(line[0]) - { - case '#': /* comment */ + switch (line[0]) { + case '#': /* comment */ (void) fputs(line, stderr); break; - case 'l': /* get initial line number vector */ - for (n = 0; n < screen_lines; n++) - { + case 'l': /* get initial line number vector */ + for (n = 0; n < screen_lines; n++) { reallines[n] = n; oldnums[n] = _NEWINDEX; } @@ -508,30 +482,30 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) do { oldnums[n++] = atoi(st); } while - ((st = strtok((char *)NULL, " ")) != 0); + ((st = strtok((char *) NULL, " ")) != 0); break; - case 'n': /* use following letters as text of new lines */ + case 'n': /* use following letters as text of new lines */ for (n = 0; n < screen_lines; n++) newtext[n][0] = '.'; for (n = 0; n < screen_lines; n++) - if (line[n+1] == '\n') + if (line[n + 1] == '\n') break; else - newtext[n][0] = line[n+1]; + newtext[n][0] = line[n + 1]; break; - case 'o': /* use following letters as text of old lines */ + case 'o': /* use following letters as text of old lines */ for (n = 0; n < screen_lines; n++) oldtext[n][0] = '.'; for (n = 0; n < screen_lines; n++) - if (line[n+1] == '\n') + if (line[n + 1] == '\n') break; else - oldtext[n][0] = line[n+1]; + oldtext[n][0] = line[n + 1]; break; - case 'd': /* dump state of test arrays */ + case 'd': /* dump state of test arrays */ #ifdef TRACE _nc_linedump(); #endif @@ -547,7 +521,7 @@ main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) putchar('\n'); break; - case 'h': /* apply hash mapper and see scroll optimization */ + case 'h': /* apply hash mapper and see scroll optimization */ _nc_hash_map(); (void) fputs("Result:\n", stderr); #ifdef TRACE diff --git a/contrib/ncurses/ncurses/tty/lib_mvcur.c b/contrib/ncurses/ncurses/tty/lib_mvcur.c index 03abaff..cb7a5ce 100644 --- a/contrib/ncurses/ncurses/tty/lib_mvcur.c +++ b/contrib/ncurses/ncurses/tty/lib_mvcur.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 * @@ -152,7 +152,7 @@ #include <term.h> #include <ctype.h> -MODULE_ID("$Id: lib_mvcur.c,v 1.72 2000/10/08 00:58:25 tom Exp $") +MODULE_ID("$Id: lib_mvcur.c,v 1.78 2001/04/14 22:26:14 tom Exp $") #define CURRENT_ROW SP->_cursrow /* phys cursor row */ #define CURRENT_COLUMN SP->_curscol /* phys cursor column */ @@ -206,8 +206,9 @@ trace_normalized_cost(const char *capname, const char *cap, int affcnt) #endif -int -_nc_msec_cost(const char *const cap, int affcnt) +NCURSES_EXPORT(int) +_nc_msec_cost +(const char *const cap, int affcnt) /* compute the cost of a given operation */ { if (cap == 0) @@ -222,11 +223,11 @@ _nc_msec_cost(const char *const cap, int affcnt) float number = 0.0; for (cp += 2; *cp != '>'; cp++) { - if (isdigit(*cp)) + if (isdigit(CharOf(*cp))) number = number * 10 + (*cp - '0'); else if (*cp == '*') number *= affcnt; - else if (*cp == '.' && (*++cp != '>') && isdigit(*cp)) + else if (*cp == '.' && (*++cp != '>') && isdigit(CharOf(*cp))) number += (*cp - '0') / 10.0; } @@ -262,7 +263,7 @@ reset_scroll_region(void) } } -void +NCURSES_EXPORT(void) _nc_mvcur_resume(void) /* what to do at initialization time and after each shellout */ { @@ -292,7 +293,7 @@ _nc_mvcur_resume(void) } } -void +NCURSES_EXPORT(void) _nc_mvcur_init(void) /* initialize the cost structure */ { @@ -406,7 +407,7 @@ _nc_mvcur_init(void) _nc_mvcur_resume(); } -void +NCURSES_EXPORT(void) _nc_mvcur_wrap(void) /* wrap up cursor-addressing mode */ { @@ -569,6 +570,8 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int #endif /* USE_HARD_TABS */ #if defined(REAL_ATTR) && defined(WANT_CHAR) + if (n <= 0 || n >= (int) check.s_size) + ovw = FALSE; #if BSD_TPUTS /* * If we're allowing BSD-style padding in tputs, don't generate @@ -595,11 +598,18 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int if (ovw) { int i; - for (i = 0; i < n; i++) - if ((WANT_CHAR(to_y, from_x + i) & A_ATTRIBUTES) != CURRENT_ATTR) { + for (i = 0; i < n; i++) { + chtype ch = WANT_CHAR(to_y, from_x + i); + if ((ch & A_ATTRIBUTES) != CURRENT_ATTR +#if USE_WIDEC_SUPPORT + || (TextOf(ch) >= 0x80 + && SP->_outch == _nc_utf8_outch) +#endif + ) { ovw = FALSE; break; } + } } if (ovw) { int i; @@ -826,8 +836,9 @@ onscreen_mvcur(int yold, int xold, int ynew, int xnew, bool ovw) return (ERR); } -int -mvcur(int yold, int xold, int ynew, int xnew) +NCURSES_EXPORT(int) +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)); @@ -881,7 +892,7 @@ mvcur(int yold, int xold, int ynew, int xnew) } #if defined(TRACE) || defined(NCURSES_TEST) -int _nc_optimize_enable = OPTIMIZE_ALL; +NCURSES_EXPORT_VAR(int) _nc_optimize_enable = OPTIMIZE_ALL; #endif #if defined(MAIN) || defined(NCURSES_TEST) @@ -894,13 +905,15 @@ int _nc_optimize_enable = OPTIMIZE_ALL; #include <tic.h> #include <dump_entry.h> -const char *_nc_progname = "mvcur"; +NCURSES_EXPORT_VAR(const char *) +_nc_progname = "mvcur"; -static unsigned long xmits; + static unsigned long xmits; /* these override lib_tputs.c */ -int -tputs(const char *string, int affcnt GCC_UNUSED, int (*outc) (int) GCC_UNUSED) +NCURSES_EXPORT(int) +tputs +(const char *string, int affcnt GCC_UNUSED, int (*outc) (int) GCC_UNUSED) /* stub tputs() that dumps sequences in a visible form */ { if (profiling) @@ -910,24 +923,25 @@ tputs(const char *string, int affcnt GCC_UNUSED, int (*outc) (int) GCC_UNUSED) return (OK); } -int +NCURSES_EXPORT(int) putp(const char *string) { return (tputs(string, 1, _nc_outch)); } -int +NCURSES_EXPORT(int) _nc_outch(int ch) { putc(ch, stdout); return OK; } -char PC = 0; /* used by termcap library */ -short ospeed = 0; /* used by termcap library */ -int _nc_nulls_sent = 0; /* used by 'tack' program */ +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 */ -int +NCURSES_EXPORT(int) delay_output(int ms GCC_UNUSED) { return OK; diff --git a/contrib/ncurses/ncurses/tty/lib_tstp.c b/contrib/ncurses/ncurses/tty/lib_tstp.c index 512de68..ba146a0 100644 --- a/contrib/ncurses/ncurses/tty/lib_tstp.c +++ b/contrib/ncurses/ncurses/tty/lib_tstp.c @@ -47,7 +47,7 @@ #define _POSIX_SOURCE #endif -MODULE_ID("$Id: lib_tstp.c,v 1.22 2000/09/02 18:33:17 tom Exp $") +MODULE_ID("$Id: lib_tstp.c,v 1.24 2000/12/10 03:04:30 tom Exp $") #if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC) #define USE_SIGTSTP 1 @@ -304,7 +304,7 @@ CatchIfDefault(int sig, RETSIGTYPE(*handler) (int)) * The XSI document implies that we shouldn't keep the SIGTSTP handler if * the caller later changes its mind, but that doesn't seem correct. */ -void +NCURSES_EXPORT(void) _nc_signal_handler(bool enable) { #if USE_SIGTSTP /* Xenix 2.x doesn't have SIGTSTP, for example */ diff --git a/contrib/ncurses/ncurses/tty/lib_twait.c b/contrib/ncurses/ncurses/tty/lib_twait.c index 6d24d8d..2dfcb10 100644 --- a/contrib/ncurses/ncurses/tty/lib_twait.c +++ b/contrib/ncurses/ncurses/tty/lib_twait.c @@ -59,7 +59,7 @@ # endif #endif -MODULE_ID("$Id: lib_twait.c,v 1.39 2000/08/26 19:34:15 tom Exp $") +MODULE_ID("$Id: lib_twait.c,v 1.41 2000/12/10 03:04:30 tom Exp $") static long _nc_gettime(bool first) @@ -102,8 +102,9 @@ _nc_gettime(bool first) * If the milliseconds given are -1, the wait blocks until activity on the * descriptors. */ -int -_nc_timed_wait(int mode, int milliseconds, int *timeleft) +NCURSES_EXPORT(int) +_nc_timed_wait +(int mode, int milliseconds, int *timeleft) { int fd; int count; diff --git a/contrib/ncurses/ncurses/tty/lib_vidattr.c b/contrib/ncurses/ncurses/tty/lib_vidattr.c index 5022cbd..464973d 100644 --- a/contrib/ncurses/ncurses/tty/lib_vidattr.c +++ b/contrib/ncurses/ncurses/tty/lib_vidattr.c @@ -64,7 +64,7 @@ #include <curses.priv.h> #include <term.h> -MODULE_ID("$Id: lib_vidattr.c,v 1.33 2000/10/09 22:45:29 tom Exp $") +MODULE_ID("$Id: lib_vidattr.c,v 1.36 2000/12/10 03:05:48 tom Exp $") #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) @@ -86,8 +86,9 @@ MODULE_ID("$Id: lib_vidattr.c,v 1.33 2000/10/09 22:45:29 tom Exp $") } \ } -int -vidputs(attr_t newmode, int (*outc) (int)) +NCURSES_EXPORT(int) +vidputs +(attr_t newmode, int (*outc) (int)) { static attr_t previous_attr = A_NORMAL; attr_t turn_on, turn_off; @@ -134,11 +135,13 @@ vidputs(attr_t newmode, int (*outc) (int)) * A_ALTCHARSET (256) down 2 to line up. We use the NCURSES_BITS * macro so this will work properly for the wide-character layout. */ - attr_t mask = NCURSES_BITS((no_color_video & 63) - | ((no_color_video & 192) << 1) - | ((no_color_video & 256) >> 2), 8); + unsigned value = no_color_video; + attr_t mask = NCURSES_BITS((value & 63) + | ((value & 192) << 1) + | ((value & 256) >> 2), 8); - if (mask & A_REVERSE && newmode & A_REVERSE) { + if ((mask & A_REVERSE) != 0 + && (newmode & A_REVERSE) != 0) { reverse = TRUE; mask &= ~A_REVERSE; } @@ -248,7 +251,7 @@ vidputs(attr_t newmode, int (*outc) (int)) returnCode(OK); } -int +NCURSES_EXPORT(int) vidattr(attr_t newmode) { T((T_CALLED("vidattr(%s)"), _traceattr(newmode))); @@ -256,7 +259,7 @@ vidattr(attr_t newmode) returnCode(vidputs(newmode, _nc_outch)); } -chtype +NCURSES_EXPORT(chtype) termattrs(void) { chtype attrs = A_NORMAL; diff --git a/contrib/ncurses/ncurses/tty/tty_display.h b/contrib/ncurses/ncurses/tty/tty_display.h index e7b447d..8382c82 100644 --- a/contrib/ncurses/ncurses/tty/tty_display.h +++ b/contrib/ncurses/ncurses/tty/tty_display.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,20 +29,20 @@ #ifndef TTY_DISPLAY_H #define TTY_DISPLAY_H 1 -extern bool _nc_tty_beep(void); -extern bool _nc_tty_check_resize(void); -extern bool _nc_tty_cursor(int); -extern bool _nc_tty_flash(void); -extern bool _nc_tty_init_color(int,int,int,int); -extern bool _nc_tty_init_pair(int,int,int); -extern bool _nc_tty_slk_hide(bool); -extern bool _nc_tty_slk_update(int,const char *); -extern bool _nc_tty_start_color(void); -extern void _nc_tty_display_resume(void); -extern void _nc_tty_display_suspend(void); -extern void _nc_tty_dispose(void); /* frees SP->_term */ -extern void _nc_tty_switch_to(void); -extern void _nc_tty_update(void); +extern NCURSES_EXPORT(bool) _nc_tty_beep (void); +extern NCURSES_EXPORT(bool) _nc_tty_check_resize (void); +extern NCURSES_EXPORT(bool) _nc_tty_cursor (int); +extern NCURSES_EXPORT(bool) _nc_tty_flash (void); +extern NCURSES_EXPORT(bool) _nc_tty_init_color (int,int,int,int); +extern NCURSES_EXPORT(bool) _nc_tty_init_pair (int,int,int); +extern NCURSES_EXPORT(bool) _nc_tty_slk_hide (bool); +extern NCURSES_EXPORT(bool) _nc_tty_slk_update (int,const char *); +extern NCURSES_EXPORT(bool) _nc_tty_start_color (void); +extern NCURSES_EXPORT(void) _nc_tty_display_resume (void); +extern NCURSES_EXPORT(void) _nc_tty_display_suspend (void); +extern NCURSES_EXPORT(void) _nc_tty_dispose (void); /* frees SP->_term */ +extern NCURSES_EXPORT(void) _nc_tty_switch_to (void); +extern NCURSES_EXPORT(void) _nc_tty_update (void); struct tty_display_data { int _fifohold; /* set if breakout marked */ diff --git a/contrib/ncurses/ncurses/tty/tty_input.h b/contrib/ncurses/ncurses/tty/tty_input.h index 41c2283..e520793 100644 --- a/contrib/ncurses/ncurses/tty/tty_input.h +++ b/contrib/ncurses/ncurses/tty/tty_input.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free 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,19 +27,19 @@ ****************************************************************************/ /* - * $Id: tty_input.h,v 1.1 1998/12/19 22:42:57 tom Exp $ + * $Id: tty_input.h,v 1.2 2000/12/10 02:26:51 tom Exp $ */ #ifndef TTY_INPUT_H #define TTY_INPUT_H 1 -extern bool _nc_tty_mouse_mask(mmask_t); -extern bool _nc_tty_pending(void); -extern int _nc_tty_next_event(int); -extern void _nc_tty_flags_changed(void); -extern void _nc_tty_flush(void); -extern void _nc_tty_input_resume(void); -extern void _nc_tty_input_suspend(void); +extern NCURSES_EXPORT(bool) _nc_tty_mouse_mask (mmask_t); +extern NCURSES_EXPORT(bool) _nc_tty_pending (void); +extern NCURSES_EXPORT(int) _nc_tty_next_event (int); +extern NCURSES_EXPORT(void) _nc_tty_flags_changed (void); +extern NCURSES_EXPORT(void) _nc_tty_flush (void); +extern NCURSES_EXPORT(void) _nc_tty_input_resume (void); +extern NCURSES_EXPORT(void) _nc_tty_input_suspend (void); struct tty_input_data { int _ifd; /* input file ptr for screen */ diff --git a/contrib/ncurses/ncurses/tty/tty_update.c b/contrib/ncurses/ncurses/tty/tty_update.c index 298c11e..d292ad3 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 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 * @@ -70,7 +70,7 @@ #include <term.h> -MODULE_ID("$Id: tty_update.c,v 1.146 2000/10/07 01:11:44 tom Exp $") +MODULE_ID("$Id: tty_update.c,v 1.151 2001/02/03 23:41:55 tom Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -274,18 +274,6 @@ check_pending(void) return FALSE; } -/* - * No one supports recursive inline functions. However, gcc is quieter if we - * instantiate the recursive part separately. - */ -#if CC_HAS_INLINE_FUNCS -static void callPutChar(chtype const); -#else -#define callPutChar(ch) PutChar(ch) -#endif - -static inline void PutChar(chtype const ch); /* forward declaration */ - /* put char at lower right corner */ static void PutCharLR(chtype const ch) @@ -307,7 +295,7 @@ PutCharLR(chtype const ch) } else if ((enter_insert_mode && exit_insert_mode) || insert_character || parm_ich) { GoTo(screen_lines - 1, screen_columns - 2); - callPutChar(ch); + PutAttrChar(ch); GoTo(screen_lines - 1, screen_columns - 2); InsStr(newscr->_line[screen_lines - 1].text + screen_columns - 2, 1); } @@ -508,21 +496,13 @@ PutRange( return EmitRange(ntext + first, last - first + 1); } -#if CC_HAS_INLINE_FUNCS -static void -callPutChar(chtype const ch) -{ - PutChar(ch); -} -#endif - /* leave unbracketed here so 'indent' works */ #define MARK_NOCHANGE(win,row) \ win->_line[row].firstchar = _NOCHANGE; \ win->_line[row].lastchar = _NOCHANGE; \ if_USE_SCROLL_HINTS(win->_line[row].oldindex = row) -int +NCURSES_EXPORT(int) doupdate(void) { int i; @@ -764,20 +744,20 @@ doupdate(void) /* mark line changed successfully */ if (i <= newscr->_maxy) { - MARK_NOCHANGE(newscr, i) + MARK_NOCHANGE(newscr, i); } if (i <= curscr->_maxy) { - MARK_NOCHANGE(curscr, i) + MARK_NOCHANGE(curscr, i); } } } /* put everything back in sync */ for (i = nonempty; i <= newscr->_maxy; i++) { - MARK_NOCHANGE(newscr, i) + MARK_NOCHANGE(newscr, i); } for (i = nonempty; i <= curscr->_maxy; i++) { - MARK_NOCHANGE(curscr, i) + MARK_NOCHANGE(curscr, i); } if (!newscr->_leaveok) { @@ -1279,7 +1259,7 @@ ClearScreen(chtype blank) #if NCURSES_EXT_FUNCS if (SP->_coloron && !SP->_default_color) { - _nc_do_color(COLOR_PAIR(SP->_current_attr), 0, FALSE, _nc_outch); + _nc_do_color((int) COLOR_PAIR(SP->_current_attr), 0, FALSE, _nc_outch); if (!back_color_erase) { fast_clear = FALSE; } @@ -1414,7 +1394,7 @@ DelChar(int count) ** Emit a string without waiting for update. */ -void +NCURSES_EXPORT(void) _nc_outstr(const char *str) { (void) putp(str); @@ -1607,8 +1587,9 @@ scroll_idl(int n, int del, int ins, chtype blank) return OK; } -int -_nc_scrolln(int n, int top, int bot, int maxy) +NCURSES_EXPORT(int) +_nc_scrolln +(int n, int top, int bot, int maxy) /* scroll region from top to bot by n lines */ { chtype blank = ClrBlank(stdscr); @@ -1729,7 +1710,7 @@ _nc_scrolln(int n, int top, int bot, int maxy) return (OK); } -void +NCURSES_EXPORT(void) _nc_screen_resume(void) { /* make sure terminal is in a sane known state */ @@ -1755,14 +1736,14 @@ _nc_screen_resume(void) putp(auto_right_margin ? enter_am_mode : exit_am_mode); } -void +NCURSES_EXPORT(void) _nc_screen_init(void) { _nc_screen_resume(); } /* wrap up screen handling */ -void +NCURSES_EXPORT(void) _nc_screen_wrap(void) { UpdateAttrs(A_NORMAL); @@ -1783,7 +1764,7 @@ _nc_screen_wrap(void) } #if USE_XMC_SUPPORT -void +NCURSES_EXPORT(void) _nc_do_xmc_glitch(attr_t previous) { attr_t chg = XMC_CHANGES(previous ^ SP->_current_attr); |