diff options
author | Peter Wemm <peter@FreeBSD.org> | 2001-05-17 08:21:06 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 2001-05-17 08:21:06 +0000 |
commit | 7a69bbfb278952228c9aa1eca241e65fcdef425e (patch) | |
tree | e83b2ef47811e687a6c54035c9af6d4a2b7f14e1 | |
parent | 18259542b2f8fa7e3f76f4bb0dd37995dfd424aa (diff) | |
download | src-test2-7a69bbfb278952228c9aa1eca241e65fcdef425e.tar.gz src-test2-7a69bbfb278952228c9aa1eca241e65fcdef425e.zip |
Notes
335 files changed, 13793 insertions, 7982 deletions
diff --git a/contrib/ncurses/ANNOUNCE b/contrib/ncurses/ANNOUNCE index 5ef8f3c2f963..7b5f4efa69ae 100644 --- a/contrib/ncurses/ANNOUNCE +++ b/contrib/ncurses/ANNOUNCE @@ -1,5 +1,5 @@ - Announcing ncurses 5.1 + Announcing ncurses 5.2 The ncurses (new curses) library is a free software emulation of curses in System V Release 4.0, and more. It uses terminfo format, @@ -27,102 +27,224 @@ Release Notes - This release is designed to be upward compatible from ncurses 5.0; - very few applications will require recompilation, depending on the - platform. These are the highlights from the change-log since ncurses - 5.0 release. + This release is designed to be upward compatible from ncurses 5.0 and + 5.1; very few applications will require recompilation, depending on + the platform. These are the highlights from the change-log since + ncurses 5.1 release. Interface changes: - * made the extended terminal capabilities - (configure --enable-tcap-names) a standard feature (though the - configure script can disable it, it is built by default). - * removed the trace() function and related trace support from the - production library. This is the only interface change that may - cause problems with existing applications linked to shared - libraries, since not all platforms use the minor version number. - * explicitly initialized to zero several data items which were - implicitly initialized, e.g., cur_term. If not explicitly - initialized, their storage type is C (common), and causes problems - linking on some platforms. - * modified curses.h.in, undef'ing some symbols to avoid conflict - with C++ STL. - - New features: - * added a new extension, assume_default_colors() to provide better - control over the use of default colors. This is the principal - visible difference between ncurses 5.1 and preceding versions. The - new extension allows an application to specify what colors pair 0 - uses. - NOTE: Pair 0 defaults to white on black unless you have invoked - use_default_colors() or set it via assume_default_colors(). An - application that calls start_colors() without setting the - background color will consistently have a black background no - matter what color your terminal's background actually is. - * made several fixes to the terminfo-to-termcap conversion, and have - been using the generated termcaps without further hand-tuning. - This builds on the extension use_extended_names() by adding - "obsolete" termcap strings to terminfo.src - + modified tic so that if extended names (i.e., - configure --enable-tcap-names) are active, then tic -x will - also write "obsolete" capabilities that are present in the - terminfo source. - + added screen's AX capability (for ECMA SGR 39 and 49) to - applicable terminfo entries, use presence of this as a check - for a small improvement in setting default colors. - + add -a option to tic and infocmp, which retains commented-out - capabilities during source translation/comparison, e.g., - captoinfo and infotocap. - * implemented limited support for UTF-8, useful with XFree86 xterm: - + if the configure --enable-widec option is given, append 'w' - to names of the generated libraries (e.g., libncursesw.so) to - avoid conflict with existing ncurses libraries. - + add a simple UTF-8 output driver to the experimental - wide-character support. If any of the environment variables - LC_ALL, LC_CTYPE or LANG contain the string "UTF-8", this - driver will be used to translate the output to UTF-8. - + modified view.c to make a rudimentary viewer of UTF-8 text. - * modify raw() and noraw() to clear/restore IEXTEN flag which - affects stty lnext on systems such as FreeBSD - * reordered tests during mouse initialization to allow for gpm to - run in xterm, or for xterm to be used under OS/2 EMX. Also dropped - test for $DISPLAY in favor of the terminfo capability kmous=\E[M - or if $TERM environment variable contains "xterm". - * added configure option --with-manpage-symlinks, which provides for - fully indexing manpage entries by making symbolic links for the - aliases. - * changed unctrl() to render C1 characters (128-159) as ~@, ~A, etc. - * add experimental configure option --enable-colorfgbg to check for - $COLORTERM variable as set by rxvt/aterm/Eterm. - * made the infocmp -F option less verbose. - * dropped support for gnat 3.10 (gnat 3.12 is current). + * change type of ospeed variable back to short to match its use in + legacy applications. It was altered after ncurses 4.2 to speed_t + to repair a type mismatch which was introduced after 1.9.4 in + 1995. The principal users of termcap continued to use short, which + is not the same size. + NOTE: A few applications will have to be recompiled (about 1% of + the programs in a typical Linux distribution, 10% of the programs + that use ncurses). These are easy to identify with nm or strings. + * remove a private function _nc_can_clear_with(), which was built + with the configure --enable-expanded option but not used. + * add several private functions (prefixed with "_nc_") for tracing + chtype values in the debug library, and for better access and + buffer limit checking. + + New features and improvements: + * rewrote tgoto() to make it better support existing termcap + applications which use hardcoded strings rather than obtain all of + their information from the termcap file. If the string does not + appear to be a terminfo string (i.e., does not refer to a "%p" + parameter, or terminfo-style padding), and termcap support is + configured, tgoto() will interpret it as termcap. Otherwise, as + before, it will use tparm(). + * to ensure that the tgoto() changes work properly, added checks to + tic which report capabilities that do not reference the expected + number of parameters. + * new configure script options: + + option --disable-root-environ adds runtime checks which tell + ncurses to disregard $TERMINFO and similar environment + variables if the current user is root, or running + setuid/setgid. + + option --disable-assumed-color allows you to use the pre-5.1 + convention of default colors used for color-pair 0 to be + configured (see assume_default_colors()). + + implement configure script options that transform installed + program names, e.g., --program-prefix, including the manpage + names and cross references. + + option --with-database allows you to specify a different + terminfo source-file to install. On OS/2 EMX, the default is + misc/emx.src, otherwise misc/terminfo.src + + option --with-default-terminfo-dir allows you to specify the + default terminfo database directory. + + option --with-libtool allows you to build with libtool. + NOTE: libtool uses a different notation for numbering shared + library versions from the existing ncurses configuration. + + option --with-manpage-tbl causes the manpages to be + preprocessed by tbl(1) prior to installation, + + option --without-curses-h causes the installation process to + install curses.h as ncurses.h and make appropriate changes to + headers and manpages. + * modified configure script options: + + change symbol used by the --install-prefix configure option + from INSTALL_PREFIX to DESTDIR (the latter has become common + usage although the name is misleading). + + modify ld -rpath options (e.g., Linux, and Solaris) to use an + absolute pathname for the build tree's lib directory, + avoiding confusion with directories relative to the current + one with the installed programs. + + modified misc/run_tic.in to use tic -o, to eliminate + dependency on $TERMINFO variable for installs. + * terminfo database: + + updated xterm terminfo entries to match XFree86 xterm patch + #146. + + added amiga-vnc, Matrix Orbital, and QNX qansi to + misc/terminfo.src. + + added os2 entry to misc/emx.src. + + add S0 and E0 extensions to screen's terminfo entry since + otherwise the FreeBSD port makes it pass termcap equivalents + to tgoto, which would be misinterpreted by older versions of + ncurses. + * improvements to program usability: + + modify programs to use curses_version() string to report the + version of ncurses with which they are compiled rather than + the NCURSES_VERSION string. The function returns the patch + level in addition to the major and minor version numbers. + + modify tput program so it can be renamed or invoked via a + link as 'reset' or 'init', producing the same effect as + tput reset or tput init. + + add error checking to infocmp's -v and -m options to ensure + that the option value is indeed a number. + * improved performance: + + replace a lookup table in lib_vidattr.c used to decode + no_color_video with a logic expression which is faster. Major bug fixes: - * modified infocmp -e, -E options to ensure that generated - fallback.c type for Booleans agrees with term.h - * documented a special case of incompatiblity between ncurses 4.2 - and 5.0, added a section for this in INSTALL. - * corrected tests for file-descriptors in OS/2 EMX mouse support. A - negative value could be used by FD_SET, causing the select() call - to wait indefinitely. - * made 'tput flash' work properly for xterm by flushing output in - delay_output() when using napms(), and modifying xterm's terminfo - to specify no padding character. Otherwise, xterm's reported baud - rate could mislead ncurses into producing too few padding - characters. - * modified lib_addch.c to allow repeated update to the lower-right - corner, rather than displaying only the first character written - until the cursor is moved. Recent versions of SVr4 curses can - update the lower-right corner, and behave this way. - * modified echo() behavior of getch() to match Solaris curses for - carriage return and backspace (reported by Neil Zanella). - * corrected offsets used for subwindows in wresize() - * modified configure script so AC_MSG_ERROR is temporarily defined - to a warning in AC_PROG_CXX to make it recover from a missing C++ - compiler without requiring user to add --without-cxx option - * corrected logic in lib_twait.c as used by lib_mouse.c for GPM - mouse support when poll() is used rather than select(). - * made several fixes for buffer overflows, unchecked recursion, - improvements in performance, etc. See the NEWS file for details. + * correct manlinks.sed script introduced in ncurses 5.1 to avoid + using ERE "\+", which is not understood by standard versions of + sed. This happens to work with GNU sed, but is not portable, and + was the initial motivation for this release. + * remove "hpux10.*" case from CF_SHARED_OPTS configure script macro. + This differed from the "hpux*" case by using reversed symbolic + links, which made the 5.1 version not match the configuration of + 5.0 shared libraries. + * guard against corrupt terminfo data: + + modify tparm() to disallow arithmetic on strings, analyze the + varargs list to read strings as strings and numbers as + numbers. + + modify tparm()'s internal function spop() to treat a null + pointer as an empty string. + + modify parse_format() in lib_tparm.c to ignore precision if + it is longer than 10000. + + rewrote limit checks in lib_mvcur.c using new functions + _nc_safe_strcat(), etc. Made other related changes to check + lengths used for strcat() and strcpy(). + * corrections to screen optimization: + + added special case in lib_vidattr.c to reset underline and + standout for devices that have no sgr0 defined. + + change handling of non_dest_scroll_region in tty_update.c to + clear text after it is shifted in rather than before shifting + out. Also correct row computation. + + modify rs2 capability in xterm-r6 and similar entries where + cursor save/restore bracketed the sequence for resetting + video attributes. The cursor restore would undo that. + * UTF-8 support: + + when checking LC_ALL, LC_CTYPE, and LANG environment + variables for UTF-8 locale, ignore those which are set to an + empty value, as per SUSV2. + + encode 0xFFFD in UTF-8 with 3 bytes, not 2. + + modify _nc_utf8_outch() to avoid sign-extension when checking + for out-of-range value. + * other library fixes: + + added checks for an empty $HOME environment variable, to + avoid retrieving terminfo descriptions from ./.terminfo . + + change functions _nc_parse_entry() and postprocess_termcap() + to avoid using strtok(), because it is non-reentrant. + + initialize fds[] array to 0's in _nc_timed_wait(); apparently + poll() only sets the revents members of that array when there + is activity corresponding to the related file. + + add a check for null pointer in Make_Enum_Type(). + + fix a heap problem with the c++ binding. + + correct missing includes for <string.h> in several places, + including the C++ binding. This is not noted by gcc unless we + use the -fno-builtin option. + * several fixes for tic: + + add a check for empty buffers returned by fgets() in + comp_scan.c next_char() function, in case tic is run on a + non-text file (fixes a core dump). + + modify tic to verify that its inputs are really files, in + case someone tries to read a directory (or /dev/zero). + + correct an uninitialized parameter to open_tempfile() in + tic.c which made "tic -I" give an ambiguous error message + about tmpnam. + + correct logic in adjust_cancels(), which did not check both + alternatives when reclassifying an extended name between + boolean, number and string, causing an infinite loop in tic. + * using new checks in tic for parameter counts in capability + strings, found/fixed several errors both in the terminfo database + and in the include/Caps file. + + modified several terminfo capability strings, including the + definitions for setaf, setab, in include/Caps to indicate + that the entries are parameterized. This information is used + to tell which strings are translated when converting to + termcap. This fixes a problem where the generated termcap + would contain a spurious "%p1" for the terminfo "%p1%d". + + correct parameter counts in include/Caps for dclk as well as + some printer-specific capabilities: csnm, defc, scs, scsd, + smgtp, smglp. + * various fixes for install scripts used to support configure + --srcdir and --with-install-prefix. + * correct several mismatches between manpage filename and ".TH" + directives, renaming dft_fgbg.3x to default_colors.3x and + menu_attribs.3x to menu_attributes.3x. + + Portability: + * configure script: + + newer config.guess, config.sub, including changes to support + OS/2 EMX. The configure script for OS/2 EMX still relies on a + patch since there is no (working) support for that platform + in the main autoconf distribution. + + make configure script checks on variables $GCC and $GXX + consistently compare against 'yes' rather than test if they + are nonnull, since either may be set to the corresponding + name of the C or C++ compiler. + + change configure script to use AC_CANONICAL_SYSTEM rather + than AC_CANONICAL_HOST, which means that configure --target + will set a default program-prefix. + + modify the check for big-core to force a couple of memory + accesses, which may work as needed for older/less-capable + machines (if not, there's still the explicit configure + option). + + modify configure test for tcgetattr() to allow for old + implementations, e.g., on BeOS, which only defined it as a + macro. + + add configure check for filesystems (such as OS/2 EMX) which + do not distinguish between upper/lowercase filenames, use + this to fix tags rules in makefiles. + + add MKncurses_def.sh to generate fallback definitions for + ncurses_cfg.h, to quiet gcc -Wundef warnings, modified + ifdef's in code to consistently use "#if" rather than + "#ifdef". + + change most remaining unquoted parameters of test in + configure script to use quotes, for instance fixing a problem + in the --disable-database option. + + modify scripts so that "make install.data" works on OS/2 EMX. + + modify scripts and makefiles so the Ada95 directory builds on + OS/2 EMX. + * library: + + replaced case-statement in _nc_tracebits() for CSIZE with a + table to simplify working around implementations that define + random combinations of the related macros to zero. + + improved OS/2 mouse support by retrying as a 2-button mouse + if code fails to set up a 3-button mouse. + + added private entrypoint _nc_basename(), used to consolidate + related code in progs, as well as accommodating OS/2 EMX + pathnames. + + alter definition of NCURSES_CONST to make it non-empty. + + redefine 'TEXT' in menu.h for AMIGA, since it is reported to + have an (unspecified) symbol conflict. + * programs: + + modified progs/tset.c and tack/sysdep.c to build with sgttyb + interface if neither termio or termios is available. Tested + this with FreeBSD 2.1.5 (which does have termios - but the + sgttyb does work). Features of Ncurses @@ -344,7 +466,7 @@ References 5. http://dickey.his.com/ded/ded.html 6. http://dickey.his.com/dialog/dialog.html 7. http://lynx.isc.org/release/ - 8. file://localhost/usr/build/ncurses/ncurses-5.1-20000704/doc/html/www.gnome.org/mc/ + 8. file://localhost/usr/build/ncurses/ncurses-5.2-20001021/doc/html/www.gnome.org/mc/ 9. http://www.mutt.org/ 10. http://www.ncftp.com/ 11. http://www.bostic.com/vi/ diff --git a/contrib/ncurses/INSTALL b/contrib/ncurses/INSTALL index ab2dc74c56c1..591738bf64e9 100644 --- a/contrib/ncurses/INSTALL +++ b/contrib/ncurses/INSTALL @@ -1,4 +1,4 @@ --- $Id: INSTALL,v 1.45 2000/10/08 02:17:57 tom Exp $ +-- $Id: INSTALL,v 1.47 2000/11/05 01:57:24 tom Exp $ --------------------------------------------------------------------- How to install Ncurses/Terminfo on your system --------------------------------------------------------------------- @@ -104,6 +104,8 @@ INSTALLATION PROCEDURE: libncurses_p.a (profile) + libncurses.la (libtool) + If you do not specify any models, the normal and debug libraries will be configured. Typing `configure' with no arguments is equivalent to: @@ -126,6 +128,13 @@ INSTALLATION PROCEDURE: and SunOS with gcc, but more work needs to be done to make shared libraries work on other systems. + If you have libtool installed, you can type + + ./configure --with-libtool + + to generate the appropriate static and/or shared libraries for your + platform using libtool. + You can make curses and terminfo fall back to an existing file of termcap definitions by configuring with --enable-termcap. If you do this, the library will search /etc/termcap before the terminfo database, and will @@ -176,7 +185,8 @@ INSTALLATION PROCEDURE: The terminfo(5) manual page must be preprocessed with tbl(1) before being formatted by nroff(1). Modern man(1) implementations tend to do this by default, but you may want to look at your version's manual page - to be sure. + to be sure. You may also install the manual pages after preprocessing + with tbl(1) by specifying the configure option --with-manpage-tbl. If the system already has a curses library that you need to keep using for some bizarre binary-compatibility reason, you'll need to distinguish @@ -494,6 +504,10 @@ SUMMARY OF CONFIGURE OPTIONS: NOTE: a few systems build shared libraries with fixed pathnames; this option probably will not work for those configurations. + --with-libtool + Generate libraries with libtool. If this option is selected, then + it overrides all other library model specifications. + --with-manpage-format=XXX Tell the configure script how you would like to install man-pages. The option value must be one of these: gzip, compress, BSDI, normal, @@ -513,6 +527,24 @@ SUMMARY OF CONFIGURE OPTIONS: this on systems that do not support symbolic links will result in copying the man-page for each alias. + --with-manpage-tbl + Tell the configure script that you with to preprocess the manpages + by running them through tbl to generate tables understandable by + nroff. + + --with-ospeed=TYPE + Override type of ospeed variable, which is part of the termcap + compatibility interface. In termcap, this is a 'short', which works + for a wide range of baudrates because ospeed is not the actual speed + but the encoded value, e.g., B9600 would be a small number such as 13. + However the encoding scheme originally allowed for values "only" up to + 38400bd. A newer set of definitions past 38400bd is not encoded as + compactly, and is not guaranteed to fit into a short (see the function + cfgetospeed(), which returns a speed_t for this reason). In practice, + applications that required knowledge of the ospeed variable, i.e., + those using termcap, do not use the higher speeds. Your application + (or system, in general) may or may not. + --with-normal Generate normal (i.e., static) libraries (default). @@ -558,6 +590,11 @@ SUMMARY OF CONFIGURE OPTIONS: Suppress the configure script's check for Ada95, do not build the Ada95 binding and related demo. + --without-curses-h + Don't install the ncurses header with the name "curses.h". Rather, + install as "ncurses.h" and modify the installed headers and manpages + accordingly. + --without-cxx XSI curses declares "bool" as part of the interface. C++ also declares "bool". Neither specifies the size and type of booleans, but both @@ -592,6 +629,12 @@ COMPATIBILITY WITH OLDER VERSIONS OF NCURSES: you may encounter when building a system with different versions of ncurses: + 5.2 (October 21, 2000) + Interface changes: + + + revert termcap ospeed variable to 'short' (see discussion of the + --with-ospeed configure option). + 5.1 (July 8, 2000) Interface changes: diff --git a/contrib/ncurses/MANIFEST b/contrib/ncurses/MANIFEST index 6e2118596c59..f958ac420e74 100644 --- a/contrib/ncurses/MANIFEST +++ b/contrib/ncurses/MANIFEST @@ -18,10 +18,52 @@ ./Ada95/gen/terminal_interface-curses-mouse.ads.m4 ./Ada95/gen/terminal_interface-curses-panels-user_data.ads.m4 ./Ada95/gen/terminal_interface-curses-panels.ads.m4 +./Ada95/gen/terminal_interface-curses-trace.ads.m4 ./Ada95/gen/terminal_interface-curses.ads.m4 ./Ada95/samples/Makefile.in ./Ada95/samples/README ./Ada95/samples/explain.txt +./Ada95/samples/ncurses.adb +./Ada95/samples/ncurses2-acs_and_scroll.adb +./Ada95/samples/ncurses2-acs_and_scroll.ads +./Ada95/samples/ncurses2-acs_display.adb +./Ada95/samples/ncurses2-acs_display.ads +./Ada95/samples/ncurses2-attr_test.adb +./Ada95/samples/ncurses2-attr_test.ads +./Ada95/samples/ncurses2-color_edit.adb +./Ada95/samples/ncurses2-color_edit.ads +./Ada95/samples/ncurses2-color_test.adb +./Ada95/samples/ncurses2-color_test.ads +./Ada95/samples/ncurses2-demo_forms.adb +./Ada95/samples/ncurses2-demo_forms.ads +./Ada95/samples/ncurses2-demo_pad.adb +./Ada95/samples/ncurses2-demo_pad.ads +./Ada95/samples/ncurses2-demo_panels.adb +./Ada95/samples/ncurses2-demo_panels.ads +./Ada95/samples/ncurses2-flushinp_test.adb +./Ada95/samples/ncurses2-flushinp_test.ads +./Ada95/samples/ncurses2-genericputs.adb +./Ada95/samples/ncurses2-genericputs.ads +./Ada95/samples/ncurses2-getch.ads +./Ada95/samples/ncurses2-getch_test.adb +./Ada95/samples/ncurses2-getch_test.ads +./Ada95/samples/ncurses2-getopt.adb +./Ada95/samples/ncurses2-getopt.ads +./Ada95/samples/ncurses2-m.adb +./Ada95/samples/ncurses2-m.ads +./Ada95/samples/ncurses2-menu_test.adb +./Ada95/samples/ncurses2-menu_test.ads +./Ada95/samples/ncurses2-overlap_test.adb +./Ada95/samples/ncurses2-overlap_test.ads +./Ada95/samples/ncurses2-slk_test.adb +./Ada95/samples/ncurses2-slk_test.ads +./Ada95/samples/ncurses2-test_sgr_attributes.adb +./Ada95/samples/ncurses2-test_sgr_attributes.ads +./Ada95/samples/ncurses2-trace_set.adb +./Ada95/samples/ncurses2-trace_set.ads +./Ada95/samples/ncurses2-util.adb +./Ada95/samples/ncurses2-util.ads +./Ada95/samples/ncurses2.ads ./Ada95/samples/rain.adb ./Ada95/samples/rain.ads ./Ada95/samples/sample-curses_demo-attributes.adb @@ -95,6 +137,12 @@ ./Ada95/src/terminal_interface-curses-mouse.adb ./Ada95/src/terminal_interface-curses-panels-user_data.adb ./Ada95/src/terminal_interface-curses-panels.adb +./Ada95/src/terminal_interface-curses-putwin.adb +./Ada95/src/terminal_interface-curses-putwin.ads +./Ada95/src/terminal_interface-curses-termcap.adb +./Ada95/src/terminal_interface-curses-termcap.ads +./Ada95/src/terminal_interface-curses-terminfo.adb +./Ada95/src/terminal_interface-curses-terminfo.ads ./Ada95/src/terminal_interface-curses-text_io-aux.adb ./Ada95/src/terminal_interface-curses-text_io-aux.ads ./Ada95/src/terminal_interface-curses-text_io-complex_io.adb @@ -113,6 +161,7 @@ ./Ada95/src/terminal_interface-curses-text_io-modular_io.ads ./Ada95/src/terminal_interface-curses-text_io.adb ./Ada95/src/terminal_interface-curses-text_io.ads +./Ada95/src/terminal_interface-curses-trace.adb_p ./Ada95/src/terminal_interface-curses.adb ./Ada95/src/terminal_interface.ads ./INSTALL @@ -229,6 +278,12 @@ ./doc/html/ada/terminal_interface-curses-panels-user_data__ads.htm ./doc/html/ada/terminal_interface-curses-panels__adb.htm ./doc/html/ada/terminal_interface-curses-panels__ads.htm +./doc/html/ada/terminal_interface-curses-putwin__adb.htm +./doc/html/ada/terminal_interface-curses-putwin__ads.htm +./doc/html/ada/terminal_interface-curses-termcap__adb.htm +./doc/html/ada/terminal_interface-curses-termcap__ads.htm +./doc/html/ada/terminal_interface-curses-terminfo__adb.htm +./doc/html/ada/terminal_interface-curses-terminfo__ads.htm ./doc/html/ada/terminal_interface-curses-text_io-aux__adb.htm ./doc/html/ada/terminal_interface-curses-text_io-aux__ads.htm ./doc/html/ada/terminal_interface-curses-text_io-complex_io__adb.htm @@ -247,6 +302,8 @@ ./doc/html/ada/terminal_interface-curses-text_io-modular_io__ads.htm ./doc/html/ada/terminal_interface-curses-text_io__adb.htm ./doc/html/ada/terminal_interface-curses-text_io__ads.htm +./doc/html/ada/terminal_interface-curses-trace__adb.htm +./doc/html/ada/terminal_interface-curses-trace__ads.htm ./doc/html/ada/terminal_interface-curses__adb.htm ./doc/html/ada/terminal_interface-curses__ads.htm ./doc/html/ada/terminal_interface__ads.htm @@ -297,8 +354,8 @@ ./doc/html/man/curs_trace.3x.html ./doc/html/man/curs_util.3x.html ./doc/html/man/curs_window.3x.html +./doc/html/man/default_colors.3x.html ./doc/html/man/define_key.3x.html -./doc/html/man/dft_fgbg.3x.html ./doc/html/man/form.3x.html ./doc/html/man/form_cursor.3x.html ./doc/html/man/form_data.3x.html @@ -327,7 +384,7 @@ ./doc/html/man/keybound.3x.html ./doc/html/man/keyok.3x.html ./doc/html/man/menu.3x.html -./doc/html/man/menu_attribs.3x.html +./doc/html/man/menu_attributes.3x.html ./doc/html/man/menu_cursor.3x.html ./doc/html/man/menu_driver.3x.html ./doc/html/man/menu_format.3x.html @@ -422,6 +479,7 @@ ./include/nc_panel.h ./include/ncurses_cfg.hin ./include/ncurses_defs +./include/ncurses_dll.h ./include/term_entry.h ./include/termcap.h.in ./include/tic.h diff --git a/contrib/ncurses/NEWS b/contrib/ncurses/NEWS index 7b7022ca097a..099c5a7f07d5 100644 --- a/contrib/ncurses/NEWS +++ b/contrib/ncurses/NEWS @@ -1,4 +1,4 @@ --- $Id: NEWS,v 1.599 2000/10/10 01:02:11 tom Exp $ +-- $Id: NEWS,v 1.626 2001/05/13 00:11:58 tom Exp $ This is a log of changes that ncurses has gone through since Zeyd started working with Pavel Curtis' original work, pcurses, in 1992. @@ -6,6 +6,296 @@ working with Pavel Curtis' original work, pcurses, in 1992. Changes through 1.9.9e are recorded by Zeyd M. Ben-Halim. Changes since 1.9.9e are recorded by Thomas Dickey. +20010512 + + modify test/ncurses.c to work with xterm-256color, which has fewer + color pairs than colors*colors (report by David Ellement + <ellement@sdd.hp.com>). + +20010505 + + corrected screen.xterm-xfree86 entry. + + update comment in Caps regarding IBM (AIX) function-key definitions. + +20010421 + + modify c++/Makefile.in to link with libncurses++w.a when configured + for wide-characters (patch by Sven Verdoolaege). + + add check in _nc_trace_buf() to refrain from freeing a null pointer. + + improve CF_PROG_INSTALL macro using CF_DIRNAME. + + update config.guess, config.sub from autoconf 2.49e (alpha). + +20010414 + + add secondary check in tic.c, similar_sgr() to see if the reason + for mismatch was that the individual capabilities used a time-delay + while sgr did not. Used this to cleanup mismatches, e.g., in vt100, + and remove time-delay from Apple_Terminal entries. + + add Apple_Terminal terminfo entries (Benjamin C W Sittler + <bsittler@iname.com>). + + correct definitions of shifted editing keys for xterm-xfree86 -TD + + fix a bug in test/bs.c from 20010407 (patch by Erik Sigra). + + prevent relative_move() from doing an overwrite if it detects 8-bit + characters when configured for UTF-8 (reported by Sven Verdoolaege + <skimo@kotnet.org>). + +20010407 + + add configure checks for strstream.h vscan function, and similar + stdio-based function which may be used in C++ binding for gcc 3.0 + (reports by George Goffe, Lars Hecking, Mike Castle). + + rewrite parts of configure.in which used changequote(). That feature + is broken in the latest autoconf alphas (e.g., 2.49d). + + add a missing pathname for ncurses_dll.h, needed when building in + a directory outside the source tree (patch by Sven Verdoolaege + <skimo@kotnet.org>). + > fix 2 bugs in test/bs.c (patch by Erik Sigra <sigra@home.se>): + + no ships were ever placed in the last row or in the last column. + This made the game very easy to win, because you never had to waste + any shots there, but the computer did. + + the squares around a sunken ship that belonged to the player were not + displayed as already hit by the computer, like it does for the + player. + +20010331 + + add some examples of customizing screen's terminfo: + screen.xterm-xfree86, screen.xterm-r6, screen.teraterm -TD + + modify screen's terminfo entry to match the khome/kend in screen + 3.09.08 (Debian bug report #92215). + + correct a memory leak in forms library (report by Stefan Vogtner + <stefan@vogtner.de>, patch by Juergen Pfeifer). + +20010324 + + change symbols used to guard against repeated includes to begin + consistently with "NCURSES_" rather than a leading underscore. There + are other symbols defined in the header files which begin with a + leading underscore, but they are part of the legacy interface. + + reorder includes in c++ binding so that rcs identifiers can be + compiled-in. + + add .cc.ii rule to c++ makefile, to get preprocessor output for + debugging. + + correct configure script handling of @keyword@ substitutions when the + --with-manpage-renames option is given (cf: 20000715, fixes Debian + bug #89939). + + report stack underflow/overflow in tparm() when tic -cv option is + given. + + remove spurious "%|" operator from xterm-xfree86 terminfo entry, + (reported by Adam Costello <amc@cs.berkeley.edu>, Debian bug #89222). + +20010310 + + cleanup of newdemo.c, fixing some ambiguous expressions noted by gcc + 2.95.2, and correcting some conflicting color pair initializations. + + add missing copyright notice for cursesw.h + + review, make minor fixes for use of '::' for referring to C-language + interface from C++ binding. + + modify configure check for g++ library slightly to accommodate + nonstandard version number, e.g., <vendor>-2.7 (report by Ronald Ho + <rho@mipos2.intel.com>). + + add configure check for c++ <sstream> header, replace hardcoded + ifdef. + + workaround for pre-release of gcc 3.0 libstdc++, which has dropped + vscan from strstreambuf to follow standard, use wrapper for C vscanf + instead (report by George Goffe <grgoffe@excite.com> and Matt Taggart + <taggart@carmen.fc.hp.com>, fixes Debian . + +20010303 + + modify interface of _nc_get_token() to pass 'silent' parameter to it, + to make quieter loading of /etc/termcap (patch by Todd C Miller). + + correct a few typos in curs_slk.3x and curs_outopts.3x manpages + (patch by Todd C Miller). + +20010224 + + compiler-warning fixes (reported by Nelson Beebe). + +20010210 + + modify screen terminfo entry to use new 3.9.8 feature allowing xterm + mouse controls -TD + +20010203 + + broaden patterns used to match OS/2 EMX in configure script to cover + variant used in newer config.guess/config.sub + + remove changequote() calls from configure script, since this feature + is broken in the autoconf 2.49c alpha, maintainers decline to fix. + + remove macro callPutChar() from tty_update.c, since this is no longer + needed (reported by Philippe Blain). + + add a null-pointer check in tic.c to handle the case when the input + file is really empty. Modify the next_char() function in comp_scan.c + to allow arbitrarily long lines, and incidentally supply a newline to + files that do not end in a newline. These changes improve tic's + recovery from attempts to read binary files, e.g., its output from + the terminfo database (reported by Bernhard Rosenkraenzer). + +20010127 + + revert change to c++/demo.cc from 20001209, which changed definition + of main() apparently to accommodate cygwin linker, but broke the demo + program. + + workaround for broken egcs 2.91.66 which calls member functions + (i.e., lines() and colors() of NCursesWindow before calling its + constructor. Add calls to initialize() in a few constructors which + did not do this already. + + use the GNAT preprocessor to make the necessary switch between TRACE + and NO_TRACE configurations (patch by Juergen Pfeifer). + > patches by Bernhard Rosenkraenzer: + + modify kterm terminfo entry to use SCS sequence to support alternate + character set (it does not work with SI/SO). + + --with-ospeed=something didn't work. configure.in checked for a + $enableval where it should check for $withval. Also, + ncurses/llib-lncurses still had a hardcoded short. + +20010114 + + correction to my merge of Tom Riddle's patch that broke tic in some + conditions (reported by Enoch Wexler <enoch@wexler.co.il>) -TD + +20010113 + + modify view.c to test halfdelay(). Like other tests, this recognizes + the 's' and space commands for stopping/starting polled input, shows + a freerunning clock in the header. If given a parameter to 's', that + makes view.c use halfdelay() with that parameter rather than + nodelay(). + + fix to allow compile with the experimental configure option + --disable-hashmap. + + modify postprocess_termcap() to avoid overwriting key_backspace, + key_left, key_down when processing a non-base entry (report/patch by + Tom Riddle). + + modify _nc_wrap_entry(), adding option to reallocate the string + table, needed in _nc_merge_entry() when merging termcap entries. + (adapted from report/patch by Tom Riddle <ftr@oracom.com>). + + modify a few configure script macros to keep $CFLAGS used only for + compiler options, preprocessor options in $CPPFLAGS. + +20001230 + + correct marker positions in lrtest.c after receiving a sigwinch. + + fix ifdef's in ncurses.c to build against pre-5.2 for testing. + + fixes to tclock for resizing behavior, redundant computation (report + and patch by A M Kuchling <akuchlin@mems-exchange.org>). + +20001216 + + improved scoansi terminfo entry -TD + + modify configure script and makefile in Ada95/src to compile a stub + for the trace functions when ncurses does not provide those. + +20001209 + + add ncurses_dll.h and related definitions to support generating DLL's + with cygwin (adapted from a patch by Charles Wilson + <cwilson@ece.gatech.edu>, changed NCURSES_EXPORT macro to make it + work with 'indent'). + +20001202 + + correct prototypes for some functions in curs_termcap.3x, matching + termcap.h, which matches X/Open. + > patch by Juergen Pfeifer: + + a revised version of the Ada enhancements sent in by "H. + Nanosecond", aka Eugene V. Melaragno <aldomel@ix.netcom.com>. This + patch includes + - small fixes to the existing ncurses binding + - addition of some more low-level functions to the binding, including + termcap and terminfo functions + - An Ada implementation of the "ncurses" test application originally + written in C. + +20001125 + + modify logic in lib_setup.c to allow either lines or columns value + from terminfo to be used if the screen size cannot be determined + dynamically rather than requiring both (patch by Ehud Karni + <ehud@unix.simonwiesel.co.il>). + + add check in lib_tgoto.c's is_termcap() function to reject null or + empty strings (reported by Valentin Nechayev <netch@netch.kiev.ua> to + freebsd-bugs). + + add definition from configure script that denotes the path-separator, + which is normally a colon. The path-separator is a semicolon on + OS/2 EMX and similar systems which may use a colon within pathnames. + + alter logic to set default for --disable-overwrite option to set it + to 'yes' if the --prefix/$prefix value is not /usr/local, thereby + accommodating the most common cause of problems: gcc's nonstandard + search rules. Other locations such as /usr/local/ncurses will default + to overwriting (report by Lars Hecking <lhecking@nmrc.ie>). + +20001118 + + modify default for --disable-overwrite configure option to disable + if the --prefix or $prefix value is not /usr. + + add cygwin to systems for which ncurses is installed by default into + /usr rather than /usr/local. + +20001111 + + minor optimization in comp_error.c and lib_termname.c, using + strncat() to replace strncpy() (patch by Solar Designer). + + add a use_terminfo_vars() check for $HOME/.termcap, and check for + geteuid() to use_terminfo_vars() (patch by Solar Designer + <solar@false.com>). + + improved cygwin terminfo entry, based on patch by + <ernie_boyd@yahoo.com>. + + modify _nc_write_entry() to allow for the possibility that linking + aliases on a filesystem that ignores case would not succeed because + the source and destination differ only by case, e.g., NCR260VT300WPP0 + on cygwin (report by Neil Zanella). + + fix a typo in the curs_deleteln.3x man page (patch by Bernhard + Rosenkraenzer <bero@redhat.de>). + +20001104 + + add configure option --with-ospeed to assist packagers in transition + to 5.3 change to ospeed type. + + add/use CharOf() macro to suppress sign-extension of char type on + platforms where this is a problem in ctype macros, e.g., Solaris. + + change trace output to binary format. + + correct a missing quote adjustment in CF_PATH_SYNTAX autoconf + macro, for OS/2 EMX configuration. + + rearrange a few configure macros, moving preprocessor options to + $CPPFLAGS (a now-obsolete version of autoconf did not consistently + use $CPPFLAGS in both the compile and preprocessor checks). + + add a check in relative_move() to guard against buffer overflow in + the overwrite logic. + +20001028 + + add message to configure script showing g++ version. + + resync config.guess, config.sub + + modify lib_delwin.c, making it return ERR if the window did not exist + (suggested by Neil Zanella). + + add cases for FreeBSD 3.1 to tdlint and makellib scripts, used this + to test/review ncurses library. (Would use lclint, but it doesn't + work). + + reorganized knight.c to avoid forward references. Correct screen + updates when backtracking, especially to the first cell. Add F/B/a + commands. + +20001021 5.2 release for upload to ftp.gnu.org + + update generated html files from manpages. + + modify dist.mk to use edit_man.sh to substitute autoconf'd variables + in html manpages. + + fix an uninitialized pointer in read_termcap.c (report by Todd C + Miller, from report/patch by Philip Guenther <guenther@gac.edu>). + + correct help-message and array limit in knight.c (patch by Brian + Raiter <breadbox@muppetlabs.com>). + > patch by Juergen Pfeifer: + + fix to avoid warning by GNAT-3.13p about use of inconsistent casing + for some identifiers defined in the standard package. + + cosmetic change to forms/fty_enum.c + +20001014 + + correct an off-by-one position in test/railroad.c which could cause + wrapping at the right margin. + + test/repair some issues with libtool configuration. Make + --disable-echo force libtool --silent. (Libtool does not work for + OS/2 EMX, works partly for SCO - libtool is still very specific to + gcc). + + change default of --with-manpage-tbl to "no", since for most of the + platforms which do have tbl installed, the system "man" program + understands how to run tbl automatically. + + minor improvement to force_bar() in comp_parse.c (Bernhard + Rosenkraenzer <bero@redhat.de>). + + modify lib_tparm.c to use get_space() before writing terminating + null character, both for consistency as well as to ensure that if + save_char() was called immediately before, that the allocated memory + is enough (patch by Sergei Ivanov). + + add note about termcap ML capability which is duplicated between two + different capabilities: smgl and smglr (reported by Sergei Ivanov + <svivanov@pdmi.ras.ru>). + + correct parameter counts in include/Caps for dclk as well as some + printer-specific capabilities: csnm, defc, scs, scsd, smgtp, smglp. + > patch by Johnny C Lam <lamj@stat.cmu.edu>: + + add support for building with libtool (apparently version 1.3.5, + since old versions do not handle -L../lib), using new configure + option --with-libtool. + + add configure option --with-manpage-tbl, which causes the manpages to + be preprocessed by tbl(1) prior to installation, + + add configure option --without-curses-h, which causes the + installation process to install curses.h as ncurses.h and make + appropriate changes to headers and manpages. + 20001009 + correct order of options/parameters in run_tic.in invocation of tic, which did not work with standard getopt() (reported by Ethan @@ -38,7 +328,7 @@ Changes since 1.9.9e are recorded by Thomas Dickey. (see assume_default_colors()). + rename configure option --enable-hashmap --disable-hashmap, and reorder the configure options, splitting the experimental and - development + development + add configure option --disable-root-environ, which tells ncurses to disregard $TERMINFO and similar environment variables if the current user is root, or running setuid/setgid (based on discussion with @@ -74,7 +364,7 @@ Changes since 1.9.9e are recorded by Thomas Dickey. 20000923 + modify rs2 capability in xterm-r6 and similar where cursor - save/restore bracketed the sequence for resetting video attributes. + save/restore bracketed the sequence for resetting video attributes. The cursor restore would undo that (from a NetBSD bug report by John Hawkinson <jhawk@MIT.EDU>). + using parameter check added to tic, corrected 27 typos in @@ -117,7 +407,7 @@ Changes since 1.9.9e are recorded by Thomas Dickey. which had the effect of ignoring p9 in set_attributes (sgr), breaking alternate character set (reported by Piotr Majka <charvel@link.pl>). + correct ifdef'ing for GCC_PRINTF, GCC_SCANF which would not compile - with Sun WorkShop compilers since these tokens were empty (cf: + with Sun WorkShop compilers since these tokens were empty (cf: 20000902, reported by Albert Chin-A-Young). 20000909 @@ -417,7 +707,7 @@ Changes since 1.9.9e are recorded by Thomas Dickey. 20000513 + the tack program knows how to use smcup and rmcup but the "show caps that can be tested" feature did not reflect this knowledge. Correct - the display in the menu tack/test/edit/c (patch by Daniel Weaver). + the display in the menu tack/test/edit/c (patch by Daniel Weaver). + xterm-16color does allow bold+colors, removed ncv#32 from that terminfo entry. diff --git a/contrib/ncurses/aclocal.m4 b/contrib/ncurses/aclocal.m4 index d03851395e89..382aa10629e9 100644 --- a/contrib/ncurses/aclocal.m4 +++ b/contrib/ncurses/aclocal.m4 @@ -28,7 +28,7 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey 1996,1997,1998,1999,2000 dnl -dnl $Id: aclocal.m4,v 1.235 2000/10/08 01:01:40 tom Exp $ +dnl $Id: aclocal.m4,v 1.248 2001/04/21 19:40:04 tom Exp $ dnl Macros used in NCURSES auto-configuration script. dnl dnl See http://dickey.his.com/autoconf/ for additional information. @@ -57,6 +57,28 @@ fi AC_SUBST(ACPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- +dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS +AC_DEFUN([CF_ADD_CFLAGS], +[ +for cf_add_cflags in $1 +do + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case "$CPPFLAGS" in + *$cf_add_cflags) + ;; + *) + CPPFLAGS="$CPPFLAGS $cf_add_cflags" + ;; + esac + ;; + *) + CFLAGS="$CFLAGS $cf_add_cflags" + ;; + esac +done +])dnl +dnl --------------------------------------------------------------------------- dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES' dnl in the sharutils 4.2 distribution. AC_DEFUN([CF_ANSI_CC_CHECK], @@ -65,6 +87,7 @@ AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) AC_CACHE_VAL(cf_cv_ansi_cc,[ cf_cv_ansi_cc=no cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi @@ -80,7 +103,7 @@ for cf_arg in "-DCC_HAS_PROTOS" \ "-Aa -D_HPUX_SOURCE" \ -Xc do - CFLAGS="$cf_save_CFLAGS $cf_arg" + CF_ADD_CFLAGS($cf_arg) AC_TRY_COMPILE( [ #ifndef CC_HAS_PROTOS @@ -95,12 +118,13 @@ choke me [cf_cv_ansi_cc="$cf_arg"; break]) done CFLAGS="$cf_save_CFLAGS" +CPPFLAGS="$cf_save_CPPFLAGS" ]) AC_MSG_RESULT($cf_cv_ansi_cc) if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then - CFLAGS="$CFLAGS $cf_cv_ansi_cc" + CF_ADD_CFLAGS($cf_cv_ansi_cc) else AC_DEFINE(CC_HAS_PROTOS) fi @@ -207,7 +231,7 @@ AC_MSG_CHECKING(for prefix) if test "x$prefix" = "xNONE" ; then case "$cf_cv_system_name" in # non-vendor systems don't have a conflict - openbsd*|netbsd*|freebsd*|linux*) + openbsd*|netbsd*|freebsd*|linux*|cygwin*) prefix=/usr ;; *) prefix=$ac_default_prefix @@ -363,8 +387,9 @@ dnl is a late feature for the standard and is not in some recent compilers dnl (1999/9/11). AC_DEFUN([CF_CPP_PARAM_INIT], [ -if test "$CXX" = yes ; then +if test -n "$CXX"; then AC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[ + AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_RUN([ class TEST { @@ -384,11 +409,86 @@ void main() { } [cf_cv_cpp_param_init=yes], [cf_cv_cpp_param_init=no], [cf_cv_cpp_param_init=unknown]) + AC_LANG_RESTORE ]) fi test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT) ])dnl dnl --------------------------------------------------------------------------- +dnl Check if the g++ compiler supports vscan function (not a standard feature). +AC_DEFUN([CF_CPP_VSCAN_FUNC], +[ +if test -n "$CXX"; then + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_CHECK_HEADERS(strstream.h) + +AC_CACHE_CHECK(if $CXX supports vscan function,cf_cv_cpp_vscan_func,[ + for cf_vscan_func in strstream stdio + do + case $cf_vscan_func in #(vi + stdio) cf_vscan_defs=USE_STDIO_VSCAN ;; #(vi + strstream) cf_vscan_defs=USE_STRSTREAM_VSCAN ;; + esac + AC_TRY_LINK([ +#include <stdio.h> +#include <stdarg.h> +#define $cf_vscan_defs 1 +#if defined(USE_STDIO_VSCAN) +#elif defined(HAVE_STRSTREAM_H) && defined(USE_STRSTREAM_VSCAN) +#include <strstream.h> +#endif + +int scanw(const char* fmt, ...) +{ + int result = -1; +#if defined(__GNUG__) + char buf[BUFSIZ]; + + va_list args; + va_start(args, fmt); +#if defined(USE_STDIO_VSCAN) + if (::vscanf(fmt, args) != -1) + result = 0; +#elif defined(USE_STRSTREAM_VSCAN) + strstreambuf ss(buf, sizeof(buf)); + if (ss.vscan(fmt, (_IO_va_list)args) != -1) + result = 0; +#else +#error case $cf_vscan_func failed +#endif + va_end(args); +#else +#error sorry, we only know about the GNU compiler case +#endif + return result; +} +],[int tmp, foo = scanw("%d", &tmp)], + [cf_cv_cpp_vscan_func=$cf_vscan_func; break], + [cf_cv_cpp_vscan_func=no]) + test "$cf_cv_cpp_vscan_func" != no && break + done +]) + +AC_LANG_RESTORE +fi + +case $cf_cv_cpp_vscan_func in #(vi +stdio) #(vi + AC_DEFINE(CPP_HAS_VSCAN_FUNC) + AC_DEFINE(USE_STDIO_VSCAN) + ;; +strstream) + AC_DEFINE(CPP_HAS_VSCAN_FUNC) + AC_DEFINE(USE_STRSTREAM_VSCAN) + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl "dirname" is not portable, so we fake it with a shell script. +AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's:/[[^/]]*$::'`])dnl +dnl --------------------------------------------------------------------------- AC_DEFUN([CF_DIRS_TO_MAKE], [ DIRS_TO_MAKE="lib" @@ -545,7 +645,6 @@ EOF if test "$GCC" = yes then AC_CHECKING([for $CC __attribute__ directives]) - changequote(,)dnl cat > conftest.$ac_ext <<EOF #line __oline__ "configure" #include "confdefs.h" @@ -564,9 +663,8 @@ cat > conftest.$ac_ext <<EOF extern void wow(char *,...) GCC_SCANFLIKE(1,2); extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; extern void foo(void) GCC_NORETURN; -int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; } +int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; } EOF - changequote([,])dnl for cf_attribute in scanf printf unused noreturn do CF_UPPER(CF_ATTRIBUTE,$cf_attribute) @@ -611,12 +709,10 @@ AC_DEFUN([CF_GCC_WARNINGS], [ if test "$GCC" = yes then - changequote(,)dnl cat > conftest.$ac_ext <<EOF #line __oline__ "configure" -int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; } +int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } EOF - changequote([,])dnl AC_CHECKING([for $CC warning options]) cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-W -Wall" @@ -673,11 +769,10 @@ dnl --------------------------------------------------------------------------- dnl Verify Version of GNAT. AC_DEFUN([CF_GNAT_VERSION], [ -changequote(<<, >>)dnl -cf_cv_gnat_version=`$cf_ada_make -v 2>&1 | grep '[0-9].[0-9][0-9]*' |\ - sed -e 's/[^0-9 \.]//g' | $AWK '{print $<<1>>;}'` +cf_cv_gnat_version=`$cf_ada_make -v 2>&1 | grep '[[0-9]].[[0-9]][[0-9]]*' |\ + sed -e 's/[[^0-9 \.]]//g' | $AWK '{print $[1];}'` case $cf_cv_gnat_version in - 3.1[1-9]*|3.[2-9]*|[4-9].*) + 3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*) cf_cv_prog_gnat_correct=yes ;; *) echo Unsupported GNAT version $cf_cv_gnat_version. Required is 3.11 or better. Disabling Ada95 binding. @@ -685,7 +780,7 @@ case $cf_cv_gnat_version in ;; esac case $cf_cv_gnat_version in - 3.1*|[4-9].*) + 3.1*|[[4-9]].*) cf_compile_generics=generics cf_generic_objects="\$(GENOBJS)" ;; @@ -693,7 +788,6 @@ case $cf_cv_gnat_version in cf_generic_objects= ;; esac -changequote([, ])dnl ]) dnl --------------------------------------------------------------------------- dnl If we're trying to use g++, test if libg++ is installed (a rather common @@ -785,7 +879,8 @@ dnl $1 = variable to set AC_DEFUN([CF_LIB_PREFIX], [ case $cf_cv_system_name in - os2) LIB_PREFIX='' ;; + OS/2*) LIB_PREFIX='' ;; + os2*) LIB_PREFIX='' ;; *) LIB_PREFIX='lib' ;; esac ifelse($1,,,[$1=$LIB_PREFIX]) @@ -1000,27 +1095,62 @@ done DST=\[$]1 REF=\[$]2 SRC=\[$]3 +TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$ +TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$ echo installing \$SRC in \$DST +CF_EOF +if test $WITH_CURSES_H = yes; then + cat >>headers.sh <<CF_EOF case \$DST in /*/include/*) - TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$ - TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$ END=\`basename \$DST\` for i in \`cat \$REF/../*/headers |fgrep -v "#"\` do NAME=\`basename \$i\` echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED done - rm -f \$TMPSRC - sed -f \$TMPSED \$SRC > \$TMPSRC - eval \$PRG \$TMPSRC \$DST/\`basename \$SRC\` - rm -f \$TMPSRC \$TMPSED ;; *) - eval \$PRG \$SRC \$DST + echo "" >> \$TMPSED ;; esac CF_EOF +else + cat >>headers.sh <<CF_EOF +case \$DST in +/*/include/*) + END=\`basename \$DST\` + for i in \`cat \$REF/../*/headers |fgrep -v "#"\` + do + NAME=\`basename \$i\` + if test "\$NAME" = "curses.h" + then + echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED + NAME=ncurses.h + fi + echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED + done + ;; +*) + echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED + ;; +esac +CF_EOF +fi +cat >>headers.sh <<CF_EOF +rm -f \$TMPSRC +sed -f \$TMPSED \$SRC > \$TMPSRC +NAME=\`basename \$SRC\` +CF_EOF +if test $WITH_CURSES_H != yes; then + cat >>headers.sh <<CF_EOF +test "\$NAME" = "curses.h" && NAME=ncurses.h +CF_EOF +fi +cat >>headers.sh <<CF_EOF +eval \$PRG \$TMPSRC \$DST/\$NAME +rm -f \$TMPSRC \$TMPSED +CF_EOF chmod 0755 headers.sh @@ -1045,7 +1175,7 @@ CF_EOF for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` do echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(DESTDIR)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile - test $i = curses.h && echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f ncurses.h && \$(LN_S) curses.h ncurses.h)" >>$cf_dir/Makefile + test $i = curses.h && test $WITH_CURSES_H = yes && echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f ncurses.h && \$(LN_S) curses.h ncurses.h)" >>$cf_dir/Makefile done cat >>$cf_dir/Makefile <<CF_EOF @@ -1073,6 +1203,7 @@ AC_DEFUN([CF_LIB_SUFFIX], [ AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) case $1 in + libtool) $2='.la' ;; normal) $2='.a' ;; debug) $2='_g.a' ;; profile) $2='_p.a' ;; @@ -1092,6 +1223,7 @@ dnl The variable $LIB_SUFFIX, if set, prepends the variable to set. AC_DEFUN([CF_LIB_TYPE], [ case $1 in + libtool) $2='' ;; normal) $2='' ;; debug) $2='_g' ;; profile) $2='_p' ;; @@ -1109,18 +1241,15 @@ AC_DEFUN([CF_LINK_DATAONLY], AC_MSG_CHECKING([if data-only library module links]) AC_CACHE_VAL(cf_cv_link_dataonly,[ rm -f conftest.a - changequote(,)dnl cat >conftest.$ac_ext <<EOF #line __oline__ "configure" -int testdata[3] = { 123, 456, 789 }; +int testdata[[3]] = { 123, 456, 789 }; EOF - changequote([,])dnl if AC_TRY_EVAL(ac_compile) ; then mv conftest.o data.o && \ ( $AR $AR_OPTS conftest.a data.o ) 2>&5 1>/dev/null fi rm -f conftest.$ac_ext data.o - changequote(,)dnl cat >conftest.$ac_ext <<EOF #line __oline__ "configure" int testfunc() @@ -1128,14 +1257,13 @@ int testfunc() #if defined(NeXT) exit(1); /* I'm told this linker is broken */ #else - extern int testdata[3]; - return testdata[0] == 123 - && testdata[1] == 456 - && testdata[2] == 789; + extern int testdata[[3]]; + return testdata[[0]] == 123 + && testdata[[1]] == 456 + && testdata[[2]] == 789; #endif } EOF - changequote([,])dnl if AC_TRY_EVAL(ac_compile); then mv conftest.o func.o && \ ( $AR $AR_OPTS conftest.a func.o ) 2>&5 1>/dev/null @@ -1281,7 +1409,9 @@ dnl --------------------------------------------------------------------------- dnl Option to allow user to override automatic configuration of manpage format. dnl There are several special cases. AC_DEFUN([CF_MANPAGE_FORMAT], -[ AC_MSG_CHECKING(format of man-pages) +[ +AC_REQUIRE([CF_PATHSEP]) +AC_MSG_CHECKING(format of man-pages) AC_ARG_WITH(manpage-format, [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and @@ -1297,13 +1427,11 @@ case ".$cf_manpage_form" in MANPATH="/usr/man:/usr/share/man" fi # look for the 'date' man-page (it's most likely to be installed!) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}" cf_manpage_form=unknown for cf_dir in $MANPATH; do test -z "$cf_dir" && cf_dir=/usr/man -changequote({{,}})dnl - for cf_name in $cf_dir/*/date.[01]* $cf_dir/*/date -changequote([,])dnl + for cf_name in $cf_dir/*/date.[[01]]* $cf_dir/*/date do cf_test=`echo $cf_name | sed -e 's/*//'` if test "x$cf_test" = "x$cf_name" ; then @@ -1387,6 +1515,20 @@ AC_ARG_WITH(manpage-symlinks, AC_MSG_RESULT($cf_manpage_symlinks) ])dnl dnl --------------------------------------------------------------------------- +dnl This option causes manpages to be run through tbl(1) to generate tables +dnl correctly. +AC_DEFUN([CF_MANPAGE_TBL], +[ +AC_MSG_CHECKING(for manpage tbl) + +AC_ARG_WITH(manpage-tbl, + [ --with-manpage-tbl specify manpage processing with tbl], + [cf_manpage_tbl=$withval], + [cf_manpage_tbl=no]) + +AC_MSG_RESULT($cf_manpage_tbl) +])dnl +dnl --------------------------------------------------------------------------- dnl Try to determine if the man-pages on the system are compressed, and if dnl so, what format is used. Use this information to construct a script that dnl will install man-pages. @@ -1396,6 +1538,7 @@ CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:) CF_MANPAGE_FORMAT CF_MANPAGE_RENAMES CF_MANPAGE_SYMLINKS +CF_MANPAGE_TBL if test "$prefix" = "NONE" ; then cf_prefix="$ac_default_prefix" @@ -1416,7 +1559,6 @@ CF_MANPAGE_SYMLINKS test ! -d man && mkdir man cat >man/edit_man.sh <<CF_EOF -changequote({{,}})dnl #! /bin/sh # this script is generated by the configure-script prefix="$cf_prefix" @@ -1430,20 +1572,20 @@ transform="$program_transform_name" TMP=\${TMPDIR-/tmp}/man\$\$ trap "rm -f \$TMP" 0 1 2 5 15 -verb=\{{$}}1 +verb=\[$]1 shift -mandir=\{{$}}1 +mandir=\[$]1 shift -srcdir=\{{$}}1 +srcdir=\[$]1 shift -for i in \{{$}}* ; do +for i in \[$]* ; do case \$i in #(vi *.orig|*.rej) ;; #(vi -*.[0-9]*) - section=\`expr "\$i" : '.*\\.\\([0-9]\\)[xm]*'\`; +*.[[0-9]]*) + section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`; if test \$verb = installing ; then if test ! -d $cf_subdir\${section} ; then \$MKDIRS $cf_subdir\$section @@ -1463,6 +1605,7 @@ cat >>man/edit_man.sh <<CF_EOF aliases=\`sed -f \$srcdir/manlinks.sed \$inalias | sort -u\` CF_EOF fi + if test "$cf_manpage_renames" = no ; then cat >>man/edit_man.sh <<CF_EOF # perform program transformations for section 1 man pages @@ -1471,22 +1614,32 @@ cat >>man/edit_man.sh <<CF_EOF else target=$cf_subdir\${section}/\$source fi +CF_EOF +else +cat >>man/edit_man.sh <<CF_EOF + target=\`grep "^\$source" $cf_manpage_renames | $AWK '{print \[$]2}'\` + if test -z "\$target" ; then + echo '? missing rename for '\$source + target="\$source" + fi + target="$cf_subdir\${section}/\${target}" +CF_EOF +fi # replace variables in man page -CF_EOF - ifelse($1,,,{{ + ifelse($1,,,[ for cf_name in $1 do cat >>man/edit_man.sh <<CF_EOF prog_$cf_name=\`echo $cf_name|sed "\${transform}"\` CF_EOF done - }}) + ]) cat >>man/edit_man.sh <<CF_EOF sed -e "s,@DATADIR@,\$datadir," \\ -e "s,@TERMINFO@,\$TERMINFO," \\ CF_EOF - ifelse($1,,,{{ + ifelse($1,,,[ for cf_name in $1 do cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` @@ -1494,19 +1647,20 @@ cat >>man/edit_man.sh <<CF_EOF -e "s,@$cf_NAME@,\$prog_$cf_name," \\ CF_EOF done - }}) + ]) cat >>man/edit_man.sh <<CF_EOF < \$i >\$TMP CF_EOF -else +if test $cf_manpage_tbl = yes ; then cat >>man/edit_man.sh <<CF_EOF - target=\`grep "^\$source" $cf_manpage_renames | $AWK '{print \{{$}}2}'\` - if test -z "\$target" ; then - echo '? missing rename for '\$source - target="\$source" - fi - target="$cf_subdir\$section/\$target" - test \$verb = installing && sed -e "s,@DATADIR@,\$datadir," < \$i | sed -f edit_man.sed >\$TMP + tbl \$TMP >\$TMP.out + mv \$TMP.out \$TMP +CF_EOF +fi +if test $with_curses_h != yes ; then +cat >>man/edit_man.sh <<CF_EOF + sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out + mv \$TMP.out \$TMP CF_EOF fi if test $cf_format = yes ; then @@ -1541,14 +1695,14 @@ CF_EOF *BSDI*) cat >>man/edit_man.sh <<CF_EOF # BSDI installs only .0 suffixes in the cat directories - target="\`echo \$target|sed -e 's/\.[1-9]\+.\?/.0/'\`" + target="\`echo \$target|sed -e 's/\.[[1-9]]\+.\?/.0/'\`" CF_EOF ;; esac cat >>man/edit_man.sh <<CF_EOF - echo \$verb \$target - suffix=\`basename \$target | sed -e 's/^[^.]*//'\` + suffix=\`basename \$target | sed -e 's/^[[^.]]*//'\` if test \$verb = installing ; then + echo \$verb \$target \$INSTALL_DATA \$TMP \$target test -n "\$aliases" && ( cd $cf_subdir\${section} && ( @@ -1576,7 +1730,8 @@ cat >>man/edit_man.sh <<CF_EOF done ) ) - else + elif test \$verb = removing ; then + echo \$verb \$target rm -f \$target test -n "\$aliases" && ( cd $cf_subdir\${section} && ( @@ -1591,13 +1746,15 @@ cat >>man/edit_man.sh <<CF_EOF done ) ) + else +# echo ".hy 0" + cat \$TMP fi ;; esac done exit 0 CF_EOF -changequote([,])dnl chmod 755 man/edit_man.sh ])dnl @@ -1645,6 +1802,7 @@ dnl Compute the object-directory name from the given model name AC_DEFUN([CF_OBJ_SUBDIR], [ case $1 in + libtool) $2='obj_lo' ;; normal) $2='objects' ;; debug) $2='obj_g' ;; profile) $2='obj_p' ;; @@ -1652,6 +1810,17 @@ AC_DEFUN([CF_OBJ_SUBDIR], esac ])dnl dnl --------------------------------------------------------------------------- +dnl Provide a value for the $PATH and similar separator +AC_DEFUN([CF_PATHSEP], +[ + case $cf_cv_system_name in + os2*) PATHSEP=';' ;; + *) PATHSEP=':' ;; + esac +ifelse($1,,,[$1=$PATHSEP]) + AC_SUBST(PATHSEP) +])dnl +dnl --------------------------------------------------------------------------- dnl Check the argument to see that it looks like a pathname. Rewrite it if it dnl begins with one of the prefix/exec_prefix variables, and then again if the dnl result begins with 'NONE'. This is necessary to workaround autoconf's @@ -1660,7 +1829,7 @@ AC_DEFUN([CF_PATH_SYNTAX],[ case ".[$]$1" in #(vi ./*) #(vi ;; -.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX +.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX ;; .\[$]{*prefix}*) #(vi eval $1="[$]$1" @@ -1674,7 +1843,7 @@ case ".[$]$1" in #(vi $1=`echo [$]$1 | sed -e s@NONE@$ac_default_prefix@` ;; *) - AC_ERROR(expected a pathname) + AC_ERROR(expected a pathname, not "[$]$1") ;; esac ])dnl @@ -1687,8 +1856,9 @@ PROG_EXT= case $cf_cv_system_name in os2*) # We make sure -Zexe is not used -- it would interfere with @PROG_EXT@ - CFLAGS="$CFLAGS -Zmt -D__ST_MT_ERRNO__" - CXXFLAGS="$CXXFLAGS -Zmt -D__ST_MT_ERRNO__" + CFLAGS="$CFLAGS -Zmt" + CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" + CXXFLAGS="$CXXFLAGS -Zmt" LDFLAGS=`echo "$LDFLAGS -Zmt -Zcrtdll" | sed "s/-Zexe//g"` PROG_EXT=".exe" ;; @@ -1708,10 +1878,8 @@ case $INSTALL in /*) ;; *) -changequote({{,}})dnl - cf_dir=`echo $INSTALL|sed -e 's%/[^/]*$%%'` + CF_DIRNAME(cf_dir,$INSTALL) test -z "$cf_dir" && cf_dir=. -changequote([,])dnl INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's:^.*/::'` ;; esac @@ -1993,13 +2161,13 @@ AC_DEFUN([CF_SIZECHANGE], AC_REQUIRE([CF_STRUCT_TERMIOS]) AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[ cf_cv_sizechange=unknown - cf_save_CFLAGS="$CFLAGS" + cf_save_CPPFLAGS="$CPPFLAGS" for cf_opts in "" "NEED_PTEM_H" do - CFLAGS="$cf_save_CFLAGS" - test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts" + CPPFLAGS="$cf_save_CPPFLAGS" + test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts" AC_TRY_COMPILE([#include <sys/types.h> #ifdef HAVE_TERMIOS_H #include <termios.h> @@ -2036,7 +2204,7 @@ do [cf_cv_sizechange=yes], [cf_cv_sizechange=no]) - CFLAGS="$cf_save_CFLAGS" + CPPFLAGS="$cf_save_CPPFLAGS" if test "$cf_cv_sizechange" = yes ; then echo "size-change succeeded ($cf_opts)" >&AC_FD_CC test -n "$cf_opts" && cf_cv_sizechange="$cf_opts" @@ -2066,7 +2234,11 @@ AC_MSG_CHECKING(for src modules) # dependencies and linker-arguments for test-programs TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS" -TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" +if test "$DFT_LWR_MODEL" = "libtool"; then + TEST_ARGS="${TEST_DEPS}" +else + TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" +fi # dependencies and linker-arguments for utility-programs PROG_ARGS="$TEST_ARGS" @@ -2101,7 +2273,11 @@ do AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H) AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include}) TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" - TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" + if test "$DFT_LWR_MODEL" = "libtool"; then + TEST_ARGS="${TEST_DEPS}" + else + TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" + fi fi fi done @@ -2211,7 +2387,7 @@ if test "$ISC" = yes ; then AC_CHECK_HEADERS( sys/termio.h ) fi if test "$ac_cv_header_termios_h" = yes ; then - case "$CFLAGS" in + case "$CFLAGS $CPPFLAGS" in *-D_POSIX_SOURCE*) termios_bad=dunno ;; *) termios_bad=maybe ;; @@ -2252,11 +2428,9 @@ dnl --------------------------------------------------------------------------- dnl Get the version-number for use in shared-library naming, etc. AC_DEFUN([CF_SUBST_NCURSES_VERSION], [ -changequote(,)dnl -NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" -NCURSES_MINOR="`egrep '^NCURSES_MINOR[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" -NCURSES_PATCH="`egrep '^NCURSES_PATCH[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" -changequote([,])dnl +NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`" +NCURSES_MINOR="`egrep '^NCURSES_MINOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`" +NCURSES_PATCH="`egrep '^NCURSES_PATCH[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`" cf_cv_abi_version=${NCURSES_MAJOR} cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} dnl Show the computed version, for logging @@ -2394,9 +2568,7 @@ dnl Make an uppercase version of a variable dnl $1=uppercase($2) AC_DEFUN([CF_UPPER], [ -changequote(,)dnl $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -changequote([,])dnl ])dnl dnl --------------------------------------------------------------------------- dnl Compute the shift-mask that we'll use for wide-character indices. We use @@ -2478,10 +2650,11 @@ dnl $4 = default value, shown in the help-message, must be a constant dnl $5 = default value, if it's an expression & cannot be in the help-message dnl AC_DEFUN([CF_WITH_PATHLIST],[ +AC_REQUIRE([CF_PATHSEP]) AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),, ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl -IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" +IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}" cf_dst_path= for cf_src_path in $withval do diff --git a/contrib/ncurses/announce.html.in b/contrib/ncurses/announce.html.in index 936b2053d588..e62db47cb32a 100644 --- a/contrib/ncurses/announce.html.in +++ b/contrib/ncurses/announce.html.in @@ -1,6 +1,6 @@ <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN"> <!-- - $Id: announce.html.in,v 1.39 2000/07/04 21:59:36 tom Exp $ + $Id: announce.html.in,v 1.41 2000/10/28 21:43:25 tom Exp $ --> <HTML> <HEAD> @@ -22,8 +22,11 @@ considered 4.4BSD curses obsolete, and is encouraging the keepers of Unix releases such as BSD/OS, freeBSD and netBSD to switch over to ncurses.<P> -The ncurses code was developed under GNU/Linux. It should port easily to -any ANSI/POSIX-conforming UNIX. It has even been ported to OS/2 Warp!<P> +The ncurses code was developed under GNU/Linux. +It has been in use for some time with OpenBSD as the system curses library, +and on FreeBSD and NetBSD as an external package. +It should port easily to any ANSI/POSIX-conforming UNIX. +It has even been ported to OS/2 Warp!<P> The distribution includes the library and support utilities, including a terminfo compiler tic(1), a decompiler infocmp(1), clear(1), tput(1), tset(1), @@ -38,136 +41,327 @@ the GNU distribution site <H1>Release Notes</H1> -This release is designed to be upward compatible from ncurses 5.0; very few -applications will require recompilation, depending on the platform. -These are the highlights from the change-log since ncurses 5.0 release. +This release is designed to be upward compatible from ncurses 5.0 and 5.1; +very few applications will require recompilation, depending on the platform. +These are the highlights from the change-log since ncurses 5.1 release. <p> Interface changes: <ul> - <li>made the extended terminal capabilities - (<code>configure --enable-tcap-names</code>) - a standard feature (though the configure script can disable it, - it is built by default). - - <li>removed the <code>trace()</code> function and related trace support - from the production library. This is the only interface change that - may cause problems with existing applications linked to shared - libraries, since not all platforms use the minor version number. - - <li>explicitly initialized to zero several data items which were - implicitly initialized, e.g., cur_term. If not explicitly - initialized, their storage type is C (common), and causes problems - linking on some platforms. - - <li>modified curses.h.in, undef'ing some symbols to avoid conflict with - C++ STL. + <li>change type of <code>ospeed</code> variable back to + <code>short</code> to match its use in legacy applications. It was + altered after ncurses 4.2 to <code>speed_t</code> to repair a type + mismatch which was introduced after 1.9.4 in 1995. The principal + users of termcap continued to use <code>short</code>, which is + not the same size. + <p> + <em>NOTE</em>: A few applications will have to be recompiled + (about 1% of the programs in a typical Linux distribution, + 10% of the programs that use ncurses). These are easy to + identify with <code>nm</code> or <code>strings</code>. + + <li>remove a private function <code>_nc_can_clear_with()</code>, which + was built with the configure --enable-expanded option but not used. + + <li>add several private functions (prefixed with "_nc_") for tracing + <code>chtype</code> values in the debug library, and for better + access and buffer limit checking. </ul> -New features: +New features and improvements: <ul> - <li>added a new extension, <code>assume_default_colors()</code> to - provide better control over the use of default colors. This is - the principal visible difference between ncurses 5.1 and preceding - versions. The new extension allows an application to specify what - colors pair 0 uses. - <p> - <em>NOTE</em>: Pair 0 defaults to white on black unless - you have invoked <code>use_default_colors()</code> or set it via - <code>assume_default_colors()</code>. An application that calls - <code>start_colors()</code> without setting the background color - will consistently have a black background no matter what color your - terminal's background actually is. - - <li>made several fixes to the terminfo-to-termcap conversion, and - have been using the generated termcaps without further hand-tuning. - This builds on the extension <code>use_extended_names()</code> by - adding "obsolete" termcap strings to terminfo.src + <li>rewrote <code>tgoto()</code> to make it better support existing + termcap applications which use hardcoded strings rather than obtain + all of their information from the termcap file. If the string does + not appear to be a terminfo string (i.e., does not refer to a "%p" + parameter, or terminfo-style padding), and termcap support is configured, <code>tgoto()</code> + will interpret it as termcap. Otherwise, as before, it will use + <code>tparm()</code>. + + <li>to ensure that the <code>tgoto()</code> changes work properly, + added checks to <code>tic</code> which report capabilities that do + not reference the expected number of parameters. + + <li>new configure script options: <ul> - <li>modified <code>tic</code> so that if extended names (i.e., - configure --enable-tcap-names) are active, then <code>tic -x</code> - will also write "obsolete" capabilities that are present in the - terminfo source. - - <li>added screen's AX capability (for ECMA SGR 39 and 49) to applicable - terminfo entries, use presence of this as a check for a small - improvement in setting default colors. - - <li>add -a option to tic and infocmp, which retains commented-out - capabilities during source translation/comparison, e.g., captoinfo - and infotocap. + <li>option <code>--disable-root-environ</code> adds runtime checks + which tell ncurses to disregard $TERMINFO and similar environment + variables if the current user is root, or running setuid/setgid. + + <li>option <code>--disable-assumed-color</code> allows you to use the + pre-5.1 convention of default colors used for color-pair 0 to be + configured (see assume_default_colors()). + + <li>implement configure script options that transform installed + program names, e.g., <code>--program-prefix</code>, including the + manpage names and cross references. + + <li>option <code>--with-database</code> allows you to specify a + different terminfo source-file to install. On OS/2 EMX, the + default is misc/emx.src, otherwise misc/terminfo.src + + <li>option <code>--with-default-terminfo-dir</code> allows you to + specify the default terminfo database directory. + + <li>option <code>--with-libtool</code> allows you to build with + <code>libtool</code>. <p> <em>NOTE</em>: <code>libtool</code> + uses a different notation for numbering shared library versions + from the existing ncurses configuration. + + <li>option <code>--with-manpage-tbl</code> causes the manpages to be + preprocessed by tbl(1) prior to installation, + + <li>option <code>--without-curses-h</code> causes the installation + process to install curses.h as ncurses.h and make appropriate + changes to headers and manpages. </ul> - <li>implemented limited support for UTF-8, useful with XFree86 xterm: + <li>modified configure script options: <ul> - <li>if the <code>configure --enable-widec</code> option is - given, append 'w' to names of the generated libraries (e.g., - libncursesw.so) to avoid conflict with existing ncurses libraries. - <li>add a simple UTF-8 output driver to the experimental - wide-character support. If any of the environment variables - LC_ALL, LC_CTYPE or LANG contain the string "UTF-8", this driver - will be used to translate the output to UTF-8. - <li>modified view.c to make a rudimentary viewer of UTF-8 text. + <li>change symbol used by the <code>--install-prefix</code> configure + option from <code>INSTALL_PREFIX</code> to <code>DESTDIR</code> + (the latter has become common usage although the name is + misleading). + + <li>modify <code>ld -rpath</code> options (e.g., Linux, and Solaris) + to use an absolute pathname for the build tree's lib directory, + avoiding confusion with directories relative to the current one + with the installed programs. + + <li>modified <code>misc/run_tic.in</code> to use + <code>tic -o</code>, to eliminate dependency on + <code>$TERMINFO</code> variable for installs. </ul> - <li>modify <code>raw()</code> and <code>noraw()</code> to clear/restore - IEXTEN flag which affects <code>stty lnext</code> on systems such as FreeBSD + <li>terminfo database: + <ul> + <li>updated xterm terminfo entries to match XFree86 xterm patch #146. - <li>reordered tests during mouse initialization to allow for gpm to run - in xterm, or for xterm to be used under OS/2 EMX. Also dropped test - for <code>$DISPLAY</code> in favor of the terminfo capability - <code>kmous=\E[M</code> or - if <code>$TERM</code> environment variable contains "xterm". + <li>added amiga-vnc, + Matrix Orbital, and + QNX qansi to misc/terminfo.src. - <li>added configure option <code>--with-manpage-symlinks</code>, which - provides for fully indexing manpage entries by making symbolic links - for the aliases. + <li>added os2 entry to misc/emx.src. - <li>changed <code>unctrl()</code> to render C1 characters (128-159) as - <code>~@</code>, <code>~A</code>, etc. + <li>add S0 and E0 extensions to <code>screen</code>'s terminfo entry + since otherwise the FreeBSD port makes it pass termcap equivalents + to <code>tgoto</code>, which would be misinterpreted by older + versions of ncurses. + </ul> + + <li>improvements to program usability: + <ul> + <li>modify programs to use <code>curses_version()</code> string to + report the version of ncurses with which they are compiled rather + than the NCURSES_VERSION string. The function returns the patch + level in addition to the major and minor version numbers. - <li>add experimental configure option --enable-colorfgbg to check for - $COLORTERM variable as set by rxvt/aterm/Eterm. + <li>modify <code>tput</code> program so it can be renamed or invoked via a link as + 'reset' or 'init', producing the same effect as <code>tput reset</code> or <code>tput init</code>. - <li>made the <code>infocmp -F</code> option less verbose. + <li>add error checking to infocmp's -v and -m options to ensure that + the option value is indeed a number. + </ul> - <li>dropped support for gnat 3.10 (gnat 3.12 is current). + <li>improved performance: + <ul> + <li>replace a lookup table in lib_vidattr.c used to decode + <code>no_color_video</code> with a logic expression which is faster. + </ul> </ul> Major bug fixes: <ul> - <li>modified infocmp -e, -E options to ensure that generated fallback.c - type for Booleans agrees with term.h + <li>correct <code>manlinks.sed</code> script introduced in ncurses 5.1 + to avoid using ERE "\+", which is not understood by standard versions + of <code>sed</code>. This happens to work with GNU <code>sed</code>, + but is not portable, and was the initial motivation for this release. + + <li>remove "hpux10.*" case from CF_SHARED_OPTS configure script macro. + This differed from the "hpux*" case by using reversed symbolic + links, which made the 5.1 version not match the configuration of + 5.0 shared libraries. + + <li>guard against corrupt terminfo data: + <ul> + <li>modify <code>tparm()</code> to disallow arithmetic on strings, + analyze the varargs list to read strings as strings and numbers as + numbers. + + <li>modify <code>tparm()</code>'s internal function + <code>spop()</code> to treat a null pointer as an empty string. + + <li>modify <code>parse_format()</code> in lib_tparm.c to ignore + precision if it is longer than 10000. + + <li>rewrote limit checks in lib_mvcur.c using new functions + <code>_nc_safe_strcat()</code>, etc. Made other related changes to + check lengths used for <code>strcat()</code> and + <code>strcpy()</code>. + </ul> + + <li>corrections to screen optimization: + <ul> + <li>added special case in lib_vidattr.c to reset underline and + standout for devices that have no sgr0 defined. + + <li>change handling of <code>non_dest_scroll_region</code> in + tty_update.c to clear text after it is shifted in rather than before + shifting out. Also correct row computation. + + <li>modify <code>rs2</code> capability in xterm-r6 and similar entries + where cursor save/restore bracketed the sequence for resetting video + attributes. The cursor restore would undo that. + </ul> + + <li>UTF-8 support: + <ul> + <li>when checking LC_ALL, LC_CTYPE, and LANG environment variables + for UTF-8 locale, ignore those which are set to an empty value, as + per SUSV2. - <li>documented a special case of incompatiblity between ncurses 4.2 and - 5.0, added a section for this in INSTALL. + <li>encode 0xFFFD in UTF-8 with 3 bytes, not 2. - <li>corrected tests for file-descriptors in OS/2 EMX mouse support. A - negative value could be used by FD_SET, causing the select() call to - wait indefinitely. + <li>modify <code>_nc_utf8_outch()</code> to avoid sign-extension when + checking for out-of-range value. + </ul> - <li>made 'tput flash' work properly for xterm by flushing output in - delay_output() when using napms(), and modifying xterm's terminfo to - specify no padding character. Otherwise, xterm's reported baud rate - could mislead ncurses into producing too few padding characters. + <li>other library fixes: + <ul> + <li>added checks for an empty <code>$HOME</code> environment + variable, to avoid retrieving terminfo descriptions from + <code>./.terminfo</code> . - <li>modified lib_addch.c to allow repeated update to the lower-right - corner, rather than displaying only the first character written until - the cursor is moved. Recent versions of SVr4 curses can update the - lower-right corner, and behave this way. + <li>change functions <code>_nc_parse_entry()</code> and + <code>postprocess_termcap()</code> to avoid using + <code>strtok()</code>, because it is non-reentrant. - <li>modified echo() behavior of getch() to match Solaris curses for - carriage return and backspace (reported by Neil Zanella). + <li>initialize <code>fds[]</code> array to 0's in + <code>_nc_timed_wait()</code>; apparently <code>poll()</code> only + sets the <code>revents</code> members of that array when there is + activity corresponding to the related file. - <li>corrected offsets used for subwindows in <code>wresize()</code> + <li>add a check for null pointer in <code>Make_Enum_Type()</code>. - <li>modified configure script so AC_MSG_ERROR is temporarily defined to - a warning in AC_PROG_CXX to make it recover from a missing C++ - compiler without requiring user to add --without-cxx option + <li>fix a heap problem with the c++ binding. - <li>corrected logic in lib_twait.c as used by lib_mouse.c for GPM mouse - support when poll() is used rather than select(). + <li>correct missing includes for <string.h> in several places, + including the C++ binding. This is not noted by gcc unless we use + the <code>-fno-builtin</code> option. + </ul> + + <li>several fixes for tic: + <ul> + <li>add a check for empty buffers returned by <code>fgets()</code> in + comp_scan.c <code>next_char()</code> function, in case + <code>tic</code> is run on a non-text file (fixes a core dump). + + <li>modify <code>tic</code> to verify that its inputs are really files, + in case someone tries to read a directory (or + <code>/dev/zero</code>). + + <li>correct an uninitialized parameter to <code>open_tempfile()</code> + in tic.c which made "tic -I" give an ambiguous error message about + <code>tmpnam</code>. + + <li>correct logic in <code>adjust_cancels()</code>, which did not check + both alternatives when reclassifying an extended name between + boolean, number and string, causing an infinite loop in + <code>tic</code>. + </ul> + + <li>using new checks in <code>tic</code> for parameter counts in + capability strings, found/fixed several errors both in the + terminfo database and in the include/Caps file. + <ul> + <li>modified several terminfo capability strings, including the + definitions for setaf, setab, in include/Caps to indicate that the + entries are parameterized. This information is used to tell which + strings are translated when converting to termcap. This fixes a + problem where the generated termcap would contain a spurious "%p1" + for the terminfo "%p1%d". + + <li>correct parameter counts in include/Caps for dclk as well as some + printer-specific capabilities: csnm, defc, scs, scsd, smgtp, smglp. + </ul> + + <li>various fixes for install scripts used to support configure + <code>--srcdir</code> and <code>--with-install-prefix</code>. + + <li>correct several mismatches between manpage filename and ".TH" + directives, renaming dft_fgbg.3x to default_colors.3x and + menu_attribs.3x to menu_attributes.3x. +</ul> + +Portability: +<ul> + <li>configure script: + <ul> + <li>newer config.guess, config.sub, including changes to support OS/2 + EMX. The configure script for OS/2 EMX still relies on a patch + since there is no (working) support for that platform in the main + autoconf distribution. + + <li>make configure script checks on variables <code>$GCC</code> and + <code>$GXX</code> consistently compare against 'yes' rather than + test if they are nonnull, since either may be set to the + corresponding name of the C or C++ compiler. + + <li>change configure script to use AC_CANONICAL_SYSTEM rather than + AC_CANONICAL_HOST, which means that <code>configure --target</code> + will set a default program-prefix. + + <li>modify the check for big-core to force a couple of memory + accesses, which may work as needed for older/less-capable machines + (if not, there's still the explicit configure option). + + <li>modify configure test for <code>tcgetattr()</code> to allow for + old implementations, e.g., on BeOS, which only defined it as a + macro. + + <li>add configure check for filesystems (such as OS/2 EMX) which do + not distinguish between upper/lowercase filenames, use this to fix + tags rules in makefiles. + + <li>add MKncurses_def.sh to generate fallback definitions for + ncurses_cfg.h, to quiet gcc -Wundef warnings, modified ifdef's in + code to consistently use "#if" rather than "#ifdef". + + <li>change most remaining unquoted parameters of <code>test</code> in + configure script to use quotes, for instance fixing a problem in the + <code>--disable-database</code> option. + + <li>modify scripts so that "make install.data" works on OS/2 EMX. + + <li>modify scripts and makefiles so the Ada95 directory builds on + OS/2 EMX. + </ul> + + <li>library: + <ul> + <li>replaced case-statement in <code>_nc_tracebits()</code> for CSIZE + with a table to simplify working around implementations that define + random combinations of the related macros to zero. + + <li>improved OS/2 mouse support by retrying as a 2-button mouse if code + fails to set up a 3-button mouse. + + <li>added private entrypoint <code>_nc_basename()</code>, used to + consolidate related code in progs, as well as accommodating OS/2 EMX + pathnames. + + <li>alter definition of NCURSES_CONST to make it non-empty. + + <li>redefine 'TEXT' in menu.h for AMIGA, since it is reported to have + an (unspecified) symbol conflict. + </ul> + + <li>programs: + <ul> + <li>modified progs/tset.c and tack/sysdep.c to build with sgttyb + interface if neither termio or termios is available. Tested this + with FreeBSD 2.1.5 (which does have termios - but the sgttyb does + work). + </ul> - <li>made several fixes for buffer overflows, unchecked recursion, - improvements in performance, etc. See the NEWS file for details. </ul> <H1>Features of Ncurses</H1> diff --git a/contrib/ncurses/c++/Makefile.in b/contrib/ncurses/c++/Makefile.in index 78b86db364db..96f338fbb152 100644 --- a/contrib/ncurses/c++/Makefile.in +++ b/contrib/ncurses/c++/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.53 2000/08/19 19:12:32 tom Exp $ +# $Id: Makefile.in,v 1.58 2001/04/21 21:31:08 tom Exp $ ############################################################################## -# Copyright (c) 1998,1999 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"), # @@ -48,6 +48,8 @@ exec_prefix = @exec_prefix@ libdir = @libdir@ includedir = @includedir@ +LIBTOOL = @LIBTOOL@ + INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -56,6 +58,7 @@ AR_OPTS = @AR_OPTS@ RANLIB = @RANLIB@ CXX = @CXX@ +CPP = @CPP@ CXXFLAGS = @CXXFLAGS@ CXXLIBS = @CXXLIBS@ @@ -64,6 +67,7 @@ CPPFLAGS = -I../c++ -I$(INCDIR) -I$(srcdir) -DHAVE_CONFIG_H @CPPFLAGS@ CCFLAGS = $(CPPFLAGS) $(CXXFLAGS) +CFLAGS_LIBTOOL = $(CCFLAGS) CFLAGS_NORMAL = $(CCFLAGS) CFLAGS_DEBUG = $(CCFLAGS) @CXX_G_OPT@ -DTRACE CFLAGS_PROFILE = $(CCFLAGS) -pg @@ -71,25 +75,37 @@ CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) +NCURSES_MAJOR = @NCURSES_MAJOR@ +NCURSES_MINOR = @NCURSES_MINOR@ REL_VERSION = @cf_cv_rel_version@ ABI_VERSION = @cf_cv_abi_version@ -LINK = @LINK_PROGS@ $(CXX) @CXXLDFLAGS@ +LINK = @LINK_PROGS@ $(LIBTOOL) $(CXX) @CXXLDFLAGS@ + +LIBROOT = ncurses++ + +LIBNAME_LIBTOOL = @LIB_PREFIX@$(LIBROOT)@LIB_SUFFIX@.la +LIBNAME_NORMAL = @LIB_PREFIX@$(LIBROOT)@LIB_SUFFIX@.a +LIBNAME = @LIB_PREFIX@$(LIBROOT)@CXX_LIB_SUFFIX@ -LIBROOT = ncurses++@LIB_SUFFIX@ -LIBNAME = @LIB_PREFIX@$(LIBROOT).a +LINK_FLAGS = @EXTRA_LDFLAGS@ -L../lib -L$(libdir) -l$(LIBROOT)@LIB_SUFFIX@ -LDFLAGS = @EXTRA_LDFLAGS@ -L../lib -L$(libdir) \ - -l$(LIBROOT) \ - @TEST_ARGS@ @LDFLAGS@ \ +LINK_LIBTOOL = @EXTRA_LDFLAGS@ -L../lib -L$(libdir) ../lib/$(LIBNAME) +LINK_NORMAL = $(LINK_FLAGS) +LINK_DEBUG = $(LINK_FLAGS) +LINK_PROFILE = $(LINK_FLAGS) +LINK_SHARED = $(LINK_FLAGS) + +LDFLAGS = @TEST_ARGS@ @LDFLAGS@ \ @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ @LOCAL_LDFLAGS@ $(CXXLIBS) +LDFLAGS_LIBTOOL = $(LDFLAGS) LDFLAGS_NORMAL = $(LDFLAGS) LDFLAGS_DEBUG = $(LDFLAGS) @CC_G_OPT@ LDFLAGS_PROFILE = $(LDFLAGS) -pg LDFLAGS_SHARED = $(LDFLAGS) @LD_SHARED_OPTS@ -LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) +LDFLAGS_DEFAULT = $(LINK_@DFT_UPR_MODEL@) $(LDFLAGS_@DFT_UPR_MODEL@) AUTO_SRC = \ etip.h @@ -114,10 +130,15 @@ LIB_OBJS = \ $(MODEL)/cursesapp.o \ $(MODEL)/cursesmain.o -../lib/$(LIBNAME) : $(LIB_OBJS) +../lib/$(LIBNAME_NORMAL) : $(LIB_OBJS) $(AR) $(AR_OPTS) $@ $? $(RANLIB) $@ +../lib/$(LIBNAME_LIBTOOL) : $(LIB_OBJS) + cd ../lib && $(LIBTOOL) $(CXX) -o $(LIBNAME) $(LIB_OBJS:.o=.lo) \ + -rpath $(INSTALL_PREFIX)$(libdir) \ + -version-info $(NCURSES_MAJOR):$(NCURSES_MINOR) + OBJS_DEMO = $(MODEL)/demo.o $(MODEL)/demo.o : $(srcdir)/demo.cc \ @@ -137,17 +158,18 @@ $(DESTDIR)$(libdir) : install \ install.libs:: ../lib/$(LIBNAME) $(DESTDIR)$(libdir) - $(INSTALL) ../lib/$(LIBNAME) $(DESTDIR)$(libdir)/$(LIBNAME) + $(LIBTOOL) $(INSTALL) ../lib/$(LIBNAME) $(DESTDIR)$(libdir)/$(LIBNAME) uninstall \ uninstall.libs:: - -rm -f $(DESTDIR)$(libdir)/$(LIBNAME) + -$(LIBTOOL) rm -f $(DESTDIR)$(libdir)/$(LIBNAME) mostlyclean :: - -rm -f core tags TAGS *~ *.ln *.atac trace + -rm -f core tags TAGS *~ *.i *.ii *.ln *.atac trace clean :: mostlyclean - -rm -f demo$x $(AUTO_SRC) ../lib/$(LIBNAME) $(LIB_OBJS) $(OBJS_DEMO) + -$(LIBTOOL) rm -f demo$x $(AUTO_SRC) ../lib/$(LIBNAME) $(LIB_OBJS) $(LIB_OBJS:.o=.lo) $(OBJS_DEMO) + -rm -rf .libs distclean :: clean -rm -f Makefile diff --git a/contrib/ncurses/c++/cursesapp.cc b/contrib/ncurses/c++/cursesapp.cc index eaaadc7eebdd..46cc271db644 100644 --- a/contrib/ncurses/c++/cursesapp.cc +++ b/contrib/ncurses/c++/cursesapp.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,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 * @@ -31,10 +31,10 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -#include "cursesapp.h" #include "internal.h" +#include "cursesapp.h" -MODULE_ID("$Id: cursesapp.cc,v 1.6 1999/10/30 23:59:37 tom Exp $") +MODULE_ID("$Id: cursesapp.cc,v 1.8 2001/03/24 21:25:36 tom Exp $") void NCursesApplication::init(bool bColors) { diff --git a/contrib/ncurses/c++/cursesapp.h b/contrib/ncurses/c++/cursesapp.h index f13fd1bdb457..c897a07dc20d 100644 --- a/contrib/ncurses/c++/cursesapp.h +++ b/contrib/ncurses/c++/cursesapp.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * 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,14 +31,14 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $Id: cursesapp.h,v 1.5 1999/05/16 17:29:59 juergen Exp $ +// $Id: cursesapp.h,v 1.7 2001/03/24 21:41:18 tom Exp $ -#ifndef _CURSESAPP_H -#define _CURSESAPP_H +#ifndef NCURSES_CURSESAPP_H_incl +#define NCURSES_CURSESAPP_H_incl #include <cursslk.h> -class NCursesApplication { +class NCURSES_IMPEXP NCursesApplication { public: typedef struct _slk_link { // This structure is used to maintain struct _slk_link* prev; // a stack of SLKs @@ -160,4 +160,4 @@ public: }; -#endif // _CURSESAPP_H +#endif // NCURSES_CURSESAPP_H_incl diff --git a/contrib/ncurses/c++/cursesf.cc b/contrib/ncurses/c++/cursesf.cc index a3b066cb51ef..35e01ee9ea6c 100644 --- a/contrib/ncurses/c++/cursesf.cc +++ b/contrib/ncurses/c++/cursesf.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,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 * @@ -31,12 +31,12 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ +#include "internal.h" #include "cursesf.h" #include "cursesapp.h" -#include "internal.h" -MODULE_ID("$Id: cursesf.cc,v 1.11 2000/06/09 16:15:40 juergen Exp $") - +MODULE_ID("$Id: cursesf.cc,v 1.13 2001/03/24 20:03:51 tom Exp $") + NCursesFormField::~NCursesFormField () { if (field) OnError(::free_field (field)); @@ -54,16 +54,16 @@ NCursesForm::mapFields(NCursesFormField* nfields[]) { for (lcv=0; nfields[lcv]->field; ++lcv) ++fieldCount; - + FIELD** fields = new FIELD*[fieldCount + 1]; - + for (lcv=0;nfields[lcv]->field;++lcv) { fields[lcv] = nfields[lcv]->field; } fields[lcv] = NULL; - + my_fields = nfields; - + if (form && (old_fields = ::form_fields(form))) { ::set_form_fields(form,(FIELD**)0); delete[] old_fields; @@ -104,7 +104,7 @@ NCursesForm::InitForm(NCursesFormField* nfields[], bool with_frame, bool autoDelete_Fields) { int mrows, mcols; - + keypad(TRUE); meta(TRUE); @@ -115,24 +115,24 @@ NCursesForm::InitForm(NCursesFormField* nfields[], form = ::new_form(mapFields(nfields)); if (!form) OnError (E_SYSTEM_ERROR); - + UserHook* hook = new UserHook; hook->m_user = NULL; hook->m_back = this; hook->m_owner = form; ::set_form_userptr(form,(void*)hook); - + ::set_form_init (form, NCursesForm::frm_init); ::set_form_term (form, NCursesForm::frm_term); ::set_field_init (form, NCursesForm::fld_init); ::set_field_term (form, NCursesForm::fld_term); - + scale(mrows, mcols); ::set_form_win(form, w); - + if (with_frame) { if ((mrows > height()-2) || (mcols > width()-2)) - OnError(E_NO_ROOM); + OnError(E_NO_ROOM); sub = new NCursesWindow(*this,mrows,mcols,1,1,'r'); ::set_form_sub(form, sub->w); b_sub_owner = TRUE; @@ -161,14 +161,14 @@ NCursesForm::~NCursesForm() { if (b_autoDelete) { if (cnt>0) { for (int i=0; i <= cnt; i++) - delete my_fields[i]; + delete my_fields[i]; } delete[] my_fields; } ::free_form(form); // It's essential to do this after free_form() - delete[] fields; + delete[] fields; } } @@ -186,7 +186,7 @@ NCursesForm::setSubWindow(NCursesWindow& nsub) { /* Internal hook functions. They will route the hook * calls to virtual methods of the NCursesForm class, - * so in C++ providing a hook is done simply by + * so in C++ providing a hook is done simply by * implementing a virtual method in a derived class */ void @@ -228,7 +228,7 @@ NCursesForm::On_Field_Termination(NCursesFormField& field) { } // call the form driver and do basic error checking. -int +int NCursesForm::driver (int c) { int res = ::form_driver (form, c); switch (res) { @@ -244,15 +244,15 @@ NCursesForm::driver (int c) { } void NCursesForm::On_Request_Denied(int c) const { - beep(); + ::beep(); } void NCursesForm::On_Invalid_Field(int c) const { - beep(); + ::beep(); } void NCursesForm::On_Unknown_Command(int c) const { - beep(); + ::beep(); } static const int CMD_QUIT = MAX_COMMAND + 1; @@ -266,7 +266,7 @@ NCursesForm::operator()(void) { post(); show(); refresh(); - + while (((drvCmnd = virtualize((c=getch()))) != CMD_QUIT)) { switch((err=driver(drvCmnd))) { case E_REQUEST_DENIED: @@ -295,7 +295,7 @@ NCursesForm::operator()(void) { // code c into a form request code. // The default implementation provides a hopefully straightforward // mapping for the most common keystrokes and form requests. -int +int NCursesForm::virtualize(int c) { switch(c) { @@ -318,7 +318,7 @@ NCursesForm::virtualize(int c) { case CTRL('F') : return(REQ_NEXT_FIELD); // Forward case CTRL('B') : return(REQ_PREV_FIELD); // Backward - case CTRL('L') : return(REQ_LEFT_FIELD); // Left + case CTRL('L') : return(REQ_LEFT_FIELD); // Left case CTRL('R') : return(REQ_RIGHT_FIELD); // Right case CTRL('U') : return(REQ_UP_FIELD); // Up case CTRL('D') : return(REQ_DOWN_FIELD); // Down @@ -341,7 +341,7 @@ NCursesForm::virtualize(int c) { case CTRL('N') : return(REQ_NEXT_CHOICE); case CTRL('P') : return(REQ_PREV_CHOICE); - + default: return(c); } @@ -362,7 +362,7 @@ bool UserDefinedFieldType::fcheck(FIELD *f, const void *u) { bool UserDefinedFieldType::ccheck(int c, const void *u) { NCursesFormField* F = (NCursesFormField*)u; assert(F != 0); - UserDefinedFieldType* udf = + UserDefinedFieldType* udf = (UserDefinedFieldType*)(F->fieldtype()); assert(udf != 0); return udf->char_check(c); @@ -383,7 +383,7 @@ FIELDTYPE* UserDefinedFieldType_With_Choice::generic_fieldtype_with_choice = bool UserDefinedFieldType_With_Choice::next_choice(FIELD *f, const void *u) { NCursesFormField* F = (NCursesFormField*)u; assert(F != 0); - UserDefinedFieldType_With_Choice* udf = + UserDefinedFieldType_With_Choice* udf = (UserDefinedFieldType_With_Choice*)(F->fieldtype()); assert(udf != 0); return udf->next(*F); @@ -392,7 +392,7 @@ bool UserDefinedFieldType_With_Choice::next_choice(FIELD *f, const void *u) { bool UserDefinedFieldType_With_Choice::prev_choice(FIELD *f, const void *u) { NCursesFormField* F = (NCursesFormField*)u; assert(F != 0); - UserDefinedFieldType_With_Choice* udf = + UserDefinedFieldType_With_Choice* udf = (UserDefinedFieldType_With_Choice*)(F->fieldtype()); assert(udf != 0); return udf->previous(*F); @@ -408,7 +408,7 @@ public: UserDefinedFieldType::makearg, NULL, NULL); - if (code==E_OK) + if (code==E_OK) code = ::set_fieldtype_arg (UserDefinedFieldType_With_Choice::generic_fieldtype_with_choice, UserDefinedFieldType::makearg, diff --git a/contrib/ncurses/c++/cursesf.h b/contrib/ncurses/c++/cursesf.h index 40f4146172c3..3dc2e9557c0f 100644 --- a/contrib/ncurses/c++/cursesf.h +++ b/contrib/ncurses/c++/cursesf.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * 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 * @@ -31,10 +31,10 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $Id: cursesf.h,v 1.12 2000/07/15 21:08:25 tom Exp $ +// $Id: cursesf.h,v 1.15 2001/03/24 21:41:23 tom Exp $ -#ifndef _CURSESF_H -#define _CURSESF_H +#ifndef NCURSES_CURSESF_H_incl +#define NCURSES_CURSESF_H_incl 1 #include <cursesp.h> #include <string.h> @@ -47,11 +47,11 @@ extern "C" { // The abstract base class for buitin and user defined Fieldtypes. // ------------------------------------------------------------------------- // -class NCursesFormField; // forward declaration +class NCURSES_IMPEXP NCursesFormField; // forward declaration // Class to represent builtin field types as well as C++ written new // fieldtypes (see classes UserDefineFieldType... -class NCursesFieldType { +class NCURSES_IMPEXP NCursesFieldType { friend class NCursesFormField; protected: @@ -80,7 +80,7 @@ public: // The class representing a forms field, wrapping the lowlevel FIELD struct // ------------------------------------------------------------------------- // -class NCursesFormField { +class NCURSES_IMPEXP NCursesFormField { friend class NCursesForm; protected: @@ -288,7 +288,7 @@ public: // The class representing a form, wrapping the lowlevel FORM struct // ------------------------------------------------------------------------- // -class NCursesForm : public NCursesPanel { +class NCURSES_IMPEXP NCursesForm : public NCursesPanel { protected: FORM* form; // the lowlevel structure @@ -541,7 +541,7 @@ public: // data belongs to some class T. Use T as template argument // to create a UserField. // ------------------------------------------------------------------------- -template<class T> class NCursesUserField : public NCursesFormField +template<class T> class NCURSES_IMPEXP NCursesUserField : public NCursesFormField { public: NCursesUserField (int rows, @@ -574,7 +574,7 @@ public: // The same mechanism is used to attach user data to a form // ------------------------------------------------------------------------- // -template<class T> class NCursesUserForm : public NCursesForm +template<class T> class NCURSES_IMPEXP NCursesUserForm : public NCursesForm { protected: // 'Internal' constructor, builds an object without association to a @@ -637,7 +637,7 @@ public: // Builtin Fieldtypes // ------------------------------------------------------------------------- // -class Alpha_Field : public NCursesFieldType { +class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType { private: int min_field_width; @@ -652,7 +652,7 @@ public: } }; -class Alphanumeric_Field : public NCursesFieldType { +class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType { private: int min_field_width; @@ -667,7 +667,7 @@ public: } }; -class Integer_Field : public NCursesFieldType { +class NCURSES_IMPEXP Integer_Field : public NCursesFieldType { private: int precision; long lower_limit, upper_limit; @@ -684,7 +684,7 @@ public: } }; -class Numeric_Field : public NCursesFieldType { +class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType { private: int precision; double lower_limit, upper_limit; @@ -701,7 +701,7 @@ public: } }; -class Regular_Expression_Field : public NCursesFieldType { +class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType { private: char* regex; @@ -712,8 +712,8 @@ private: public: Regular_Expression_Field(const char *expr) : NCursesFieldType(TYPE_REGEXP) { - regex = new char[1+::strlen(expr)]; - (strcpy)(regex,expr); + regex = new char[1 + ::strlen(expr)]; + (::strcpy)(regex,expr); } ~Regular_Expression_Field() { @@ -721,7 +721,7 @@ public: } }; -class Enumeration_Field : public NCursesFieldType { +class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType { private: char** list; int case_sensitive; @@ -742,7 +742,7 @@ public: } }; -class IPV4_Address_Field : public NCursesFieldType { +class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType { private: void set(NCursesFormField& f) { OnError(::set_field_type(f.get_field(),fieldtype)); @@ -757,7 +757,7 @@ public: // Abstract base class for User-Defined Fieldtypes // ------------------------------------------------------------------------- // -class UserDefinedFieldType : public NCursesFieldType { +class NCURSES_IMPEXP UserDefinedFieldType : public NCursesFieldType { friend class UDF_Init; // Internal helper to set up statics private: // For all C++ defined fieldtypes we need only one generic lowlevel @@ -793,7 +793,7 @@ public: // Abstract base class for User-Defined Fieldtypes with Choice functions // ------------------------------------------------------------------------- // -class UserDefinedFieldType_With_Choice : public UserDefinedFieldType { +class NCURSES_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType { friend class UDF_Init; // Internal helper to set up statics private: // For all C++ defined fieldtypes with choice functions we need only one @@ -820,5 +820,5 @@ public: } }; -#endif // _CURSESF_H +#endif // NCURSES_CURSESF_H_incl diff --git a/contrib/ncurses/c++/cursesm.cc b/contrib/ncurses/c++/cursesm.cc index 3b4dbd58bef1..410cdbc892db 100644 --- a/contrib/ncurses/c++/cursesm.cc +++ b/contrib/ncurses/c++/cursesm.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999,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 * @@ -31,18 +31,18 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ +#include "internal.h" #include "cursesm.h" #include "cursesapp.h" -#include "internal.h" -MODULE_ID("$Id: cursesm.cc,v 1.12 1999/10/30 23:59:37 tom Exp $") - +MODULE_ID("$Id: cursesm.cc,v 1.15 2001/03/24 20:03:56 tom Exp $") + NCursesMenuItem::~NCursesMenuItem() { if (item) OnError(::free_item(item)); } -bool +bool NCursesMenuItem::action() { return FALSE; }; @@ -50,7 +50,7 @@ NCursesMenuItem::action() { NCursesMenuCallbackItem::~NCursesMenuCallbackItem() { } -bool +bool NCursesMenuCallbackItem::action() { if (p_fct) return p_fct (*this); @@ -60,7 +60,7 @@ NCursesMenuCallbackItem::action() { /* Internal hook functions. They will route the hook * calls to virtual methods of the NCursesMenu class, - * so in C++ providing a hook is done simply by + * so in C++ providing a hook is done simply by * implementing a virtual method in a derived class */ void @@ -91,21 +91,21 @@ NCursesMenu::itm_term(MENU *m) { ITEM** NCursesMenu::mapItems(NCursesMenuItem* nitems[]) { int itemCount = 0,lcv; - + for (lcv=0; nitems[lcv]->item; ++lcv) ++itemCount; - + ITEM** items = new ITEM*[itemCount + 1]; - + for (lcv=0;nitems[lcv]->item;++lcv) { items[lcv] = nitems[lcv]->item; } items[lcv] = NULL; - + my_items = nitems; - + if (menu) - delete[] ::menu_items(menu); + delete[] ::menu_items(menu); return items; } @@ -114,7 +114,7 @@ NCursesMenu::InitMenu(NCursesMenuItem* nitems[], bool with_frame, bool autoDelete_Items) { int mrows, mcols; - + keypad(TRUE); meta(TRUE); @@ -125,24 +125,24 @@ NCursesMenu::InitMenu(NCursesMenuItem* nitems[], menu = ::new_menu(mapItems(nitems)); if (!menu) OnError (E_SYSTEM_ERROR); - + UserHook* hook = new UserHook; hook->m_user = NULL; hook->m_back = this; hook->m_owner = menu; ::set_menu_userptr(menu,(void*)hook); - + ::set_menu_init (menu, NCursesMenu::mnu_init); ::set_menu_term (menu, NCursesMenu::mnu_term); ::set_item_init (menu, NCursesMenu::itm_init); ::set_item_term (menu, NCursesMenu::itm_term); - + scale(mrows, mcols); ::set_menu_win(menu, w); - + if (with_frame) { if ((mrows > height()-2) || (mcols > width()-2)) - OnError(E_NO_ROOM); + OnError(E_NO_ROOM); sub = new NCursesWindow(*this,mrows,mcols,1,1,'r'); ::set_menu_sub(menu, sub->w); b_sub_owner = TRUE; @@ -180,14 +180,14 @@ NCursesMenu::~NCursesMenu() { if (b_autoDelete) { if (cnt>0) { for (int i=0; i <= cnt; i++) - delete my_items[i]; + delete my_items[i]; } delete[] my_items; } ::free_menu(menu); // It's essential to do this after free_menu() - delete[] itms; + delete[] itms; } } @@ -218,7 +218,7 @@ NCursesMenu::set_pattern (const char *pat) { } // call the menu driver and do basic error checking. -int +int NCursesMenu::driver (int c) { int res = ::menu_driver (menu, c); switch (res) { @@ -243,7 +243,7 @@ static const int CMD_ACTION = MAX_COMMAND + 2; // The default implementation provides a hopefully straightforward // mapping for the most common keystrokes and menu requests. // ------------------------------------------------------------------------- -int +int NCursesMenu::virtualize(int c) { switch(c) { case CTRL('X') : return(CMD_QUIT); // eXit @@ -290,7 +290,7 @@ NCursesMenu::operator()(void) { post(); show(); refresh(); - + while (!b_action && ((drvCmnd = virtualize((c=getch()))) != CMD_QUIT)) { switch((err=driver(drvCmnd))) { @@ -363,21 +363,20 @@ NCursesMenu::On_Item_Termination(NCursesMenuItem& item) { void NCursesMenu::On_Request_Denied(int c) const { - beep(); + ::beep(); } void NCursesMenu::On_Not_Selectable(int c) const { - beep(); + ::beep(); } void NCursesMenu::On_No_Match(int c) const { - beep(); + ::beep(); } void NCursesMenu::On_Unknown_Command(int c) const { - beep(); + ::beep(); } - diff --git a/contrib/ncurses/c++/cursesm.h b/contrib/ncurses/c++/cursesm.h index 26e0b4ce2b02..541ba038795b 100644 --- a/contrib/ncurses/c++/cursesm.h +++ b/contrib/ncurses/c++/cursesm.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * 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,10 +31,10 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $Id: cursesm.h,v 1.13 1999/10/30 23:59:37 tom Exp $ +// $Id: cursesm.h,v 1.15 2001/03/24 21:41:28 tom Exp $ -#ifndef _CURSESM_H -#define _CURSESM_H +#ifndef NCURSES_CURSESM_H_incl +#define NCURSES_CURSESM_H_incl 1 #include <cursesp.h> @@ -46,7 +46,7 @@ extern "C" { // This wraps the ITEM type of <menu.h> // ------------------------------------------------------------------------- // -class NCursesMenuItem { +class NCURSES_IMPEXP NCursesMenuItem { friend class NCursesMenu; protected: @@ -135,7 +135,7 @@ typedef bool ITEMCALLBACK(NCursesMenuItem&); // If you don't like to create a child class for individual items to // overload action(), you may use this class and provide a callback // function pointer for items. -class NCursesMenuCallbackItem : public NCursesMenuItem { +class NCURSES_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem { private: ITEMCALLBACK* p_fct; @@ -156,7 +156,7 @@ public: // This wraps the MENU type of <menu.h> // ------------------------------------------------------------------------- // -class NCursesMenu : public NCursesPanel { +class NCURSES_IMPEXP NCursesMenu : public NCursesPanel { protected: MENU *menu; @@ -514,7 +514,7 @@ public: // to create a UserItem. // ------------------------------------------------------------------------- // -template<class T> class NCursesUserItem : public NCursesMenuItem +template<class T> class NCURSES_IMPEXP NCursesUserItem : public NCursesMenuItem { public: NCursesUserItem (const char* p_name, @@ -541,7 +541,7 @@ public: // The same mechanism is used to attach user data to a menu // ------------------------------------------------------------------------- // -template<class T> class NCursesUserMenu : public NCursesMenu +template<class T> class NCURSES_IMPEXP NCursesUserMenu : public NCursesMenu { protected: NCursesUserMenu( int lines, @@ -589,4 +589,4 @@ public: } }; -#endif // _CURSESM_H +#endif // NCURSES_CURSESM_H_incl diff --git a/contrib/ncurses/c++/cursesmain.cc b/contrib/ncurses/c++/cursesmain.cc index 09400b8d690a..03f61bc3da68 100644 --- a/contrib/ncurses/c++/cursesmain.cc +++ b/contrib/ncurses/c++/cursesmain.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,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 * @@ -31,10 +31,10 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -#include "cursesapp.h" #include "internal.h" +#include "cursesapp.h" -MODULE_ID("$Id: cursesmain.cc,v 1.5 1999/05/16 17:31:22 juergen Exp $") +MODULE_ID("$Id: cursesmain.cc,v 1.7 2001/03/24 21:25:47 tom Exp $") /* This is the default implementation of main() for a NCursesApplication. * You only have to instantiate a static NCursesApplication object in your diff --git a/contrib/ncurses/c++/cursesp.cc b/contrib/ncurses/c++/cursesp.cc index 50095d3d2144..bfd4d9f4dda3 100644 --- a/contrib/ncurses/c++/cursesp.cc +++ b/contrib/ncurses/c++/cursesp.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * 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 * @@ -31,11 +31,11 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1993,1997 * ****************************************************************************/ -#include "cursesp.h" #include "internal.h" +#include "cursesp.h" #include <string.h> -MODULE_ID("$Id: cursesp.cc,v 1.16 2000/07/15 21:08:13 tom Exp $") +MODULE_ID("$Id: cursesp.cc,v 1.18 2001/03/24 20:04:04 tom Exp $") NCursesPanel* NCursesPanel::dummy = (NCursesPanel*)0; @@ -75,7 +75,7 @@ NCursesPanel::redraw() { int NCursesPanel::refresh() { ::update_panels(); - return doupdate(); + return ::doupdate(); } int @@ -116,7 +116,7 @@ NCursesPanel::label(const char *tLabel, const char *bLabel) { void NCursesPanel::centertext(int row,const char *label) { if (label) { - int x = (maxx() - strlen(label)) / 2; + int x = (maxx() - ::strlen(label)) / 2; if (x<0) x=0; OnError(addstr(row, x, label, width())); diff --git a/contrib/ncurses/c++/cursesp.h b/contrib/ncurses/c++/cursesp.h index 6293dd102e87..b56580a6376f 100644 --- a/contrib/ncurses/c++/cursesp.h +++ b/contrib/ncurses/c++/cursesp.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * 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,10 +31,10 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -#ifndef _CURSESP_H -#define _CURSESP_H +#ifndef NCURSES_CURSESP_H_incl +#define NCURSES_CURSESP_H_incl 1 -// $Id: cursesp.h,v 1.12 1999/10/31 00:00:02 tom Exp $ +// $Id: cursesp.h,v 1.14 2001/03/24 21:41:35 tom Exp $ #include <cursesw.h> @@ -42,7 +42,7 @@ extern "C" { # include <panel.h> } -class NCursesPanel : public NCursesWindow { +class NCURSES_IMPEXP NCursesPanel : public NCursesWindow { protected: PANEL *p; static NCursesPanel *dummy; @@ -215,4 +215,4 @@ public: // Associate the user panel with the user data pointed to by p_UserData. }; -#endif // _CURSESP_H +#endif // NCURSES_CURSESP_H_incl diff --git a/contrib/ncurses/c++/cursespad.cc b/contrib/ncurses/c++/cursespad.cc index b82d39399b45..64795120ebb7 100644 --- a/contrib/ncurses/c++/cursespad.cc +++ b/contrib/ncurses/c++/cursespad.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1999 Free Software Foundation, Inc. * + * Copyright (c) 1999,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 * @@ -31,11 +31,11 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1999 * ****************************************************************************/ +#include "internal.h" #include "etip.h" #include "cursesw.h" -#include "internal.h" -MODULE_ID("$Id: cursespad.cc,v 1.2 1999/09/11 23:25:54 tom Exp $") +MODULE_ID("$Id: cursespad.cc,v 1.4 2001/03/24 21:25:57 tom Exp $") NCursesPad::NCursesPad(int lines, int cols) : NCursesWindow(), diff --git a/contrib/ncurses/c++/cursesw.cc b/contrib/ncurses/c++/cursesw.cc index b61a7056af15..463554b404e6 100644 --- a/contrib/ncurses/c++/cursesw.cc +++ b/contrib/ncurses/c++/cursesw.cc @@ -22,10 +22,10 @@ modified by Juergen Pfeifer (juergen.pfeifer@gmx.net) */ -#include "cursesw.h" #include "internal.h" +#include "cursesw.h" -MODULE_ID("$Id: cursesw.cc,v 1.17 2000/09/02 18:55:31 tom Exp $") +MODULE_ID("$Id: cursesw.cc,v 1.21 2001/04/07 22:11:39 tom Exp $") #define COLORS_NEED_INITIALIZATION -1 #define COLORS_NOT_INITIALIZED 0 @@ -45,43 +45,52 @@ bool NCursesWindow::b_initialized = FALSE; int NCursesWindow::scanw(const char* fmt, ...) { + int result = ERR; #if defined(__GNUG__) - va_list args; - va_start(args, fmt); char buf[BUFSIZ]; - int result = wgetstr(w, buf); - if (result == OK) { + + if (::wgetnstr(w, buf, sizeof(buf)) != ERR) { + va_list args; + va_start(args, fmt); +#if USE_STDIO_VSCAN + if (::vscanf(fmt, args) != -1) + result = OK; +#elif USE_STRSTREAM_VSCAN /* pre-gcc 3.0 */ strstreambuf ss(buf, sizeof(buf)); - result = ss.vscan(fmt, (_IO_va_list)args); + if (ss.vscan(fmt, (_IO_va_list)args) != -1) + result = OK; +#endif + va_end(args); } - va_end(args); - return result; -#else - return ERR; #endif + return result; } int NCursesWindow::scanw(int y, int x, const char* fmt, ...) { + int result = ERR; #if defined(__GNUG__) - va_list args; - va_start(args, fmt); char buf[BUFSIZ]; - int result = wmove(w, y, x); - if (result == OK) { - result = wgetstr(w, buf); - if (result == OK) { + + if (::wmove(w, y, x) != ERR) { + if (::wgetnstr(w, buf, sizeof(buf)) != ERR) { + va_list args; + va_start(args, fmt); +#if USE_STDIO_VSCAN + if (::vscanf(fmt, args) != -1) + result = OK; +#elif USE_STRSTREAM_VSCAN /* pre-gcc 3.0 */ strstreambuf ss(buf, sizeof(buf)); - result = ss.vscan(fmt, (_IO_va_list)args); + if (ss.vscan(fmt, (_IO_va_list)args) != -1) + result = OK; +#endif + va_end(args); } } - va_end(args); - return result; -#else - return ERR; #endif + return result; } @@ -91,7 +100,7 @@ NCursesWindow::printw(const char * fmt, ...) va_list args; va_start(args, fmt); char buf[BUFSIZ]; - vsprintf(buf, fmt, args); + ::vsprintf(buf, fmt, args); va_end(args); return waddstr(w, buf); } @@ -102,10 +111,10 @@ NCursesWindow::printw(int y, int x, const char * fmt, ...) { va_list args; va_start(args, fmt); - int result = wmove(w, y, x); + int result = ::wmove(w, y, x); if (result == OK) { char buf[BUFSIZ]; - vsprintf(buf, fmt, args); + ::vsprintf(buf, fmt, args); result = waddstr(w, buf); } va_end(args); @@ -142,8 +151,7 @@ NCursesWindow::initialize() { } NCursesWindow::NCursesWindow() { - if (!b_initialized) - initialize(); + initialize(); w = (WINDOW *)0; init(); @@ -154,8 +162,7 @@ NCursesWindow::NCursesWindow() { NCursesWindow::NCursesWindow(int lines, int cols, int begin_y, int begin_x) { - if (!b_initialized) - initialize(); + initialize(); w = ::newwin(lines, cols, begin_y, begin_x); if (w == 0) { @@ -170,8 +177,7 @@ NCursesWindow::NCursesWindow(int lines, int cols, int begin_y, int begin_x) NCursesWindow::NCursesWindow(WINDOW* &window) { - if (!b_initialized) - initialize(); + initialize(); w = window; init(); @@ -183,6 +189,7 @@ NCursesWindow::NCursesWindow(WINDOW* &window) NCursesWindow::NCursesWindow(NCursesWindow& win, int l, int c, int begin_y, int begin_x, char absrel) { + initialize(); if (absrel == 'a') { // absolute origin begin_y -= win.begy(); begin_x -= win.begx(); @@ -208,6 +215,7 @@ NCursesWindow::NCursesWindow(NCursesWindow& win, int l, int c, NCursesWindow::NCursesWindow(NCursesWindow& win, bool do_box NCURSES_PARAM_INIT(TRUE)) { + initialize(); w = :: derwin(win.w,win.height()-2,win.width()-2,1,1); if (w == 0) { err_handler("Cannot construct subwindow"); @@ -244,6 +252,7 @@ static RIPOFFINIT* prip = R_INIT; extern "C" int _nc_ripoffline(int,int (*init)(WINDOW*,int)); NCursesWindow::NCursesWindow(WINDOW *win, int cols) { + initialize(); w = win; assert((w->_maxx+1)==cols); alloced = FALSE; @@ -323,7 +332,7 @@ NCursesWindow::~NCursesWindow() } if (alloced && w != 0) - delwin(w); + ::delwin(w); if (alloced) { --count; @@ -364,7 +373,7 @@ NCursesWindow::getcolor(int getback) const short fore, back; if (colorInitialized==COLORS_ARE_REALLY_THERE) { - if (pair_content((short)PAIR_NUMBER(w->_attrs), &fore, &back)) + if (::pair_content((short)PAIR_NUMBER(w->_attrs), &fore, &back)) err_handler("Can't get color pair"); } else { @@ -396,7 +405,7 @@ int NCursesWindow::setpalette(short fore, short back, short pair) { if (colorInitialized==COLORS_ARE_REALLY_THERE) - return init_pair(pair, fore, back); + return ::init_pair(pair, fore, back); else return OK; } diff --git a/contrib/ncurses/c++/cursesw.h b/contrib/ncurses/c++/cursesw.h index 8091194cbc5e..dcaadd9b3098 100644 --- a/contrib/ncurses/c++/cursesw.h +++ b/contrib/ncurses/c++/cursesw.h @@ -1,19 +1,42 @@ // * This makes emacs happy -*-Mode: C++;-*- -#ifndef _CURSESW_H -#define _CURSESW_H - -// $Id: cursesw.h,v 1.18 1999/10/23 15:16:53 tom Exp $ +/**************************************************************************** + * 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +#ifndef NCURSES_CURSESW_H_incl +#define NCURSES_CURSESW_H_incl 1 + +// $Id: cursesw.h,v 1.25 2001/04/07 22:44:07 tom Exp $ #include <etip.h> #include <stdio.h> #include <stdarg.h> -#ifdef __MWERKS__ -/* This is a bogus check, stringstream is actually ANSI C++ standard, - * but old compilers like GCC don't have it, and new compilers like Metrowerks - * don't have strstream - */ -#include <sstream> -#else + +#if HAVE_STRSTREAM_H && USE_STRSTREAM_VSCAN #include <strstream.h> #endif @@ -118,7 +141,7 @@ inline int UNDEF(clearok)(WINDOW* win, bool bf) { return clearok(win, bf); } #undef clearok #define clearok UNDEF(clearok) #else -extern "C" int clearok(WINDOW*, bool); +extern "C" NCURSES_IMPEXP int NCURSES_API clearok(WINDOW*, bool); #endif #ifdef clrtobot @@ -152,7 +175,7 @@ inline int UNDEF(erase)() { return erase(); } #endif #ifdef flushok -inline int UNDEF(flushok)(WINDOW* _win, bool _bf) { +inline int UNDEF(flushok)(WINDOW* _win, bool _bf) { return flushok(_win, _bf); } #undef flushok #define flushok UNDEF(flushok) @@ -185,49 +208,49 @@ inline int UNDEF(innstr)(char *_str, int n) { return innstr(_str,n); } #endif #ifdef mvwinnstr -inline int UNDEF(mvwinnstr)(WINDOW *win, int y, int x, char *_str, int n) { +inline int UNDEF(mvwinnstr)(WINDOW *win, int y, int x, char *_str, int n) { return mvwinnstr(win,y,x,_str,n); } #undef mvwinnstr #define mvwinnstr UNDEF(mvwinnstr) #endif #ifdef mvinnstr -inline int UNDEF(mvinnstr)(int y, int x, char *_str, int n) { +inline int UNDEF(mvinnstr)(int y, int x, char *_str, int n) { return mvinnstr(y,x,_str,n); } #undef mvinnstr #define mvinnstr UNDEF(mvinnstr) #endif #ifdef winsstr -inline int UNDEF(winsstr)(WINDOW *w, const char *_str) { +inline int UNDEF(winsstr)(WINDOW *w, const char *_str) { return winsstr(w,_str); } #undef winsstr #define winsstr UNDEF(winsstr) #endif #ifdef mvwinsstr -inline int UNDEF(mvwinsstr)(WINDOW *w, int y, int x, const char *_str) { +inline int UNDEF(mvwinsstr)(WINDOW *w, int y, int x, const char *_str) { return mvwinsstr(w,y,x,_str); } #undef mvwinsstr #define mvwinsstr UNDEF(mvwinsstr) #endif #ifdef insstr -inline int UNDEF(insstr)(const char *_str) { +inline int UNDEF(insstr)(const char *_str) { return insstr(_str); } #undef insstr #define insstr UNDEF(insstr) #endif #ifdef mvinsstr -inline int UNDEF(mvinsstr)(int y, int x,const char *_str) { +inline int UNDEF(mvinsstr)(int y, int x,const char *_str) { return mvinsstr(y,x,_str); } #undef mvinsstr #define mvinsstr UNDEF(mvinsstr) #endif #ifdef insnstr -inline int UNDEF(insnstr)(const char *_str, int n) { +inline int UNDEF(insnstr)(const char *_str, int n) { return insnstr(_str,n); } #undef insnstr #define insnstr UNDEF(insnstr) @@ -254,7 +277,7 @@ inline int UNDEF(getnstr)(char *_str, int n) { return getnstr(_str,n); } #endif #ifdef getyx -inline void UNDEF(getyx)(const WINDOW* win, int& y, int& x) { +inline void UNDEF(getyx)(const WINDOW* win, int& y, int& x) { getyx(win, y, x); } #undef getyx #define getyx UNDEF(getyx) @@ -301,7 +324,7 @@ inline int UNDEF(leaveok)(WINDOW* win, bool bf) { return leaveok(win, bf); } #undef leaveok #define leaveok UNDEF(leaveok) #else -extern "C" int leaveok(WINDOW* win, bool bf); +extern "C" NCURSES_IMPEXP int NCURSES_API leaveok(WINDOW* win, bool bf); #endif #ifdef move @@ -340,9 +363,9 @@ inline int UNDEF(scrollok)(WINDOW* win, bool bf) { return scrollok(win, bf); } #define scrollok UNDEF(scrollok) #else #if defined(__NCURSES_H) -extern "C" int scrollok(WINDOW*, bool); +extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, bool); #else -extern "C" int scrollok(WINDOW*, char); +extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, char); #endif #endif @@ -365,7 +388,7 @@ inline int UNDEF(standout)() { return standout(); } #endif #ifdef subpad -inline WINDOW *UNDEF(subpad)(WINDOW *p, int l, int c, int y, int x) +inline WINDOW *UNDEF(subpad)(WINDOW *p, int l, int c, int y, int x) { return derwin(p,l,c,y,x); } #undef subpad #define subpad UNDEF(subpad) @@ -434,7 +457,7 @@ inline int UNDEF(wattroff)(WINDOW *win, int att) { return wattroff(win, att); } #endif #ifdef chgat -inline int UNDEF(chgat)(int n,attr_t attr, short color, const void *opts) { +inline int UNDEF(chgat)(int n,attr_t attr, short color, const void *opts) { return chgat(n,attr,color,opts); } #undef chgat #define chgat UNDEF(chgat) @@ -442,7 +465,7 @@ inline int UNDEF(chgat)(int n,attr_t attr, short color, const void *opts) { #ifdef mvchgat inline int UNDEF(mvchgat)(int y, int x, int n, - attr_t attr, short color, const void *opts) { + attr_t attr, short color, const void *opts) { return mvchgat(y,x,n,attr,color,opts); } #undef mvchgat #define mvchgat UNDEF(mvchgat) @@ -450,7 +473,7 @@ inline int UNDEF(mvchgat)(int y, int x, int n, #ifdef mvwchgat inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n, - attr_t attr, short color, const void *opts) { + attr_t attr, short color, const void *opts) { return mvwchgat(win,y,x,n,attr,color,opts); } #undef mvwchgat #define mvwchgat UNDEF(mvwchgat) @@ -538,7 +561,7 @@ inline int UNDEF(mvwgetnstr)(WINDOW *win, int y, int x, char *str, int n) #endif #ifdef mvwinch -inline chtype UNDEF(mvwinch)(WINDOW *win, int y, int x) { +inline chtype UNDEF(mvwinch)(WINDOW *win, int y, int x) { return mvwinch(win, y, x);} #undef mvwinch #define mvwinch UNDEF(mvwinch) @@ -671,18 +694,18 @@ inline void UNDEF(bkgdset)(chtype ch) { bkgdset(ch); } * */ -class NCursesWindow +class NCURSES_IMPEXP NCursesWindow { friend class NCursesMenu; friend class NCursesForm; - + private: static bool b_initialized; static void initialize(); static int ripoff_init(WINDOW *,int); - void init(); - + void init(); + short getcolor(int getback) const; static int setpalette(short fore, short back, short pair); @@ -700,15 +723,15 @@ protected: // We rely on the c++ promise that // all otherwise uninitialized // static class vars are set to 0 - + WINDOW* w; // the curses WINDOW - + bool alloced; // TRUE if we own the WINDOW - + NCursesWindow* par; // parent, if subwindow NCursesWindow* subwins; // head of subwindows list NCursesWindow* sib; // next subwindow of parent - + void kill_subwindows(); // disable all subwindows // Destroy all subwindows. @@ -718,12 +741,12 @@ protected: public: NCursesWindow(WINDOW* &window); // useful only for stdscr - + NCursesWindow(int lines, // number of lines int cols, // number of columns int begin_y, // line origin int begin_x); // col origin - + NCursesWindow(NCursesWindow& par,// parent window int lines, // number of lines int cols, // number of columns @@ -751,9 +774,9 @@ public: int (*init)(NCursesWindow& win)); // This function is used to generate a window of ripped-of lines. // If the argument is positive, lines are removed from the top, if it - // is negative lines are removed from the bottom. This enhances the - // lowlevel ripoffline() function because it uses the internal - // implementation that allows to remove more than just a single line. + // is negative lines are removed from the bottom. This enhances the + // lowlevel ripoffline() function because it uses the internal + // implementation that allows to remove more than just a single line. // This function must be called before any other ncurses function. The // creation of the window is defered until ncurses gets initialized. // The initialization function is then called. @@ -761,13 +784,13 @@ public: // ------------------------------------------------------------------------- // terminal status // ------------------------------------------------------------------------- - int lines() const { return LINES; } + int lines() const { initialize(); return LINES; } // Number of lines on terminal, *not* window - int cols() const { return COLS; } + int cols() const { initialize(); return COLS; } // Number of cols on terminal, *not* window - int tabsize() const { return TABSIZE; } + int tabsize() const { initialize(); return TABSIZE; } // Size of a tab on terminal, *not* window static int NumberOfColors(); @@ -775,7 +798,7 @@ public: int colors() const { return NumberOfColors(); } // Number of available colors - + // ------------------------------------------------------------------------- // window status // ------------------------------------------------------------------------- @@ -811,7 +834,7 @@ public: int setcolor(short pair); // Set actually used palette entry - + // ------------------------------------------------------------------------- // window positioning // ------------------------------------------------------------------------- @@ -827,12 +850,12 @@ public: // Move cursor the this position void getyx(int& y, int& x) const { ::getyx(w, y, x); } - // Get current position of the cursor + // Get current position of the cursor - int mvcur(int oldrow, int oldcol, int newrow, int newcol) const { + int mvcur(int oldrow, int oldcol, int newrow, int newcol) const { return ::mvcur(oldrow, oldcol, newrow, newcol); } // Perform lowlevel cursor motion that takes effect immediately. - + // ------------------------------------------------------------------------- // input // ------------------------------------------------------------------------- @@ -842,13 +865,13 @@ public: int getch(int y, int x) { return ::mvwgetch(w,y,x); } // Move cursor to position and get a keystroke from the window - int getstr(char* str, int n=-1) { + int getstr(char* str, int n=-1) { return ::wgetnstr(w, str,n); } // Read a series of characters into str until a newline or carriage return // is received. Read at most n characters. If n is negative, the limit is // ignored. - int getstr(int y, int x, char* str, int n=-1) { + int getstr(int y, int x, char* str, int n=-1) { return ::mvwgetnstr(w,y,x,str,n); } // Move the cursor to the requested position and then perform the getstr() // as described above. @@ -880,12 +903,12 @@ public: #else ; #endif - + // ------------------------------------------------------------------------- // output // ------------------------------------------------------------------------- int addch(const chtype ch) { return ::waddch(w, ch); } - // Put attributed character to the window. + // Put attributed character to the window. int addch(int y, int x, const chtype ch) { return ::mvwaddch(w,y,x,ch); } @@ -895,10 +918,10 @@ public: int echochar(const chtype ch) { return ::wechochar(w,ch); } // Put attributed character to the window and refresh it immediately. - int addstr(const char* str, int n=-1) { + int addstr(const char* str, int n=-1) { return ::waddnstr(w, (char*)str,n); } // Write the string str to the window, stop writing if the terminating - // NUL or the limit n is reached. If n is negative, it is ignored. + // NUL or the limit n is reached. If n is negative, it is ignored. int addstr(int y, int x, const char * str, int n=-1) { return ::mvwaddnstr(w,y,x,(char*)str,n); } @@ -939,7 +962,7 @@ public: int insertln() { return ::winsdelln(w,1); } // Insert an empty line above the current line. - + int insdelln(int n=1) { return ::winsdelln(w,n); } // If n>0 insert that many lines above the current line. If n<0 delete // that many lines beginning with the current line. @@ -949,7 +972,7 @@ public: // Insert the string into the window before the current cursor position. // Insert stops at end of string or when the limit n is reached. If n is // negative, it is ignored. - + int insstr(int y, int x, const char *s, int n=-1) { return ::mvwinsnstr(w,y,x,s,n); } // Move the cursor to the requested position and then perform the insstr() @@ -957,7 +980,7 @@ public: int attron (chtype at) { return ::wattron (w, at); } // Switch on the window attributes; - + int attroff(chtype at) { return ::wattroff(w, (int) at); } // Switch off the window attributes; @@ -995,7 +1018,7 @@ public: // ------------------------------------------------------------------------- // borders // ------------------------------------------------------------------------- - int box(chtype vert=0, chtype hor=0) { + int box(chtype vert=0, chtype hor=0) { return ::wborder(w, vert, vert, hor, hor, 0, 0 ,0, 0); } // Draw a box around the window with the given vertical and horizontal // drawing characters. If you specifiy a zero as character, curses will try @@ -1016,7 +1039,7 @@ public: // ------------------------------------------------------------------------- int hline(int len, chtype ch=0) { return ::whline(w, ch, len); } // Draw a horizontal line of len characters with the given character. If - // you pass zero for the character, curses will try to find a "nice" one. + // you pass zero for the character, curses will try to find a "nice" one. int hline(int y, int x, int len, chtype ch=0) { return ::mvwhline(w,y,x,ch,len); } @@ -1029,7 +1052,7 @@ public: int vline(int y, int x, int len, chtype ch=0) { return ::mvwvline(w,y,x,ch,len); } // Move the cursor to the requested position and then draw a vertical line. - + // ------------------------------------------------------------------------- // erasure // ------------------------------------------------------------------------- @@ -1050,7 +1073,7 @@ public: // Clear to the end of the line. int delch() { return ::wdelch(w); } - // Delete character under the cursor. + // Delete character under the cursor. int delch(int y, int x) { return ::mvwdelch(w,y,x); } // Move cursor to requested position and delete the character under the @@ -1090,18 +1113,18 @@ public: int untouchwin() { return ::wtouchln(w,0,height(),0); } // Mark the whole window as unmodified. - int touchln(int s, int cnt, bool changed=TRUE) { + int touchln(int s, int cnt, bool changed=TRUE) { return ::wtouchln(w,s,cnt,(int)(changed?1:0)); } // Mark cnt lines beginning from line s as changed or unchanged, depending // on the value of the changed flag. - bool is_linetouched(int line) const { + bool is_linetouched(int line) const { return (::is_linetouched(w,line) ? TRUE:FALSE); } - // Return TRUE if line is marked as changed, FALSE otherwise + // Return TRUE if line is marked as changed, FALSE otherwise - bool is_wintouched() const { + bool is_wintouched() const { return (::is_wintouched(w) ? TRUE:FALSE); } - // Return TRUE if window is marked as changed, FALSE otherwise + // Return TRUE if window is marked as changed, FALSE otherwise int leaveok(bool bf) { return ::leaveok(w, bf); } // If bf is TRUE, curses will leave the cursor after an update whereever @@ -1141,7 +1164,7 @@ public: int meta(bool bf) { return ::meta(w,bf); } // If called with bf=TRUE, keys may generate 8-Bit characters. Otherwise - // 7-Bit characters are generated. + // 7-Bit characters are generated. int standout() { return ::wstandout(w); } // Enable "standout" attributes @@ -1158,9 +1181,9 @@ public: // doupdate(). This is redefined in NCursesPanel. virtual int noutrefresh() { return ::wnoutrefresh(w); } - // Propagate the changes in this window to the virtual screen. This is + // Propagate the changes in this window to the virtual screen. This is // redefined in NCursesPanel. - + // ------------------------------------------------------------------------- // multiple window control // ------------------------------------------------------------------------- @@ -1207,7 +1230,7 @@ public: // ------------------------------------------------------------------------- // We leave this here for compatibility reasons. // ------------------------------------------------------------------------- -class NCursesColorWindow : public NCursesWindow { +class NCURSES_IMPEXP NCursesColorWindow : public NCursesWindow { public: NCursesColorWindow(WINDOW* &window) // useful only for stdscr : NCursesWindow(window) { @@ -1228,8 +1251,8 @@ public: char absrel = 'a') // if `a', by & bx are : NCursesWindow(par,lines,cols, // absolute screen pos, begin_y,begin_x, // else if `r', they are - absrel ) { // relative to par origin - useColors(); } + absrel ) { // relative to par origin + useColors(); } }; // These enum definitions really belong inside the NCursesPad class, but only @@ -1251,7 +1274,7 @@ public: // Pad Support. We allow an association of a pad with a "real" window // through which the pad may be viewed. // ------------------------------------------------------------------------- -class NCursesPad : public NCursesWindow { +class NCURSES_IMPEXP NCursesPad : public NCursesWindow { private: NCursesWindow* viewWin; // the "viewport" window NCursesWindow* viewSub; // the "viewport" subwindow @@ -1301,7 +1324,7 @@ public: int echochar(const chtype ch) { return ::pechochar(w,ch); } // Put the attributed character onto the pad and immediately do a // prefresh(). - + int refresh(); // If a viewport is defined the pad is displayed in this window, otherwise // this is a noop. @@ -1326,7 +1349,7 @@ public: return ::pnoutrefresh(w,pminrow,pmincol, sminrow,smincol,smaxrow,smaxcol); } - // Does the same like refresh() but without calling doupdate(). + // Does the same as refresh() but without calling doupdate(). virtual void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1); // Add the window "view" as viewing window to the pad. @@ -1343,7 +1366,7 @@ public: // A FramedPad is constructed always with a viewport window. This viewport // will be framed (by a box() command) and the interior of the box is the // viewport subwindow. On the frame we display scrollbar sliders. -class NCursesFramedPad : public NCursesPad { +class NCURSES_IMPEXP NCursesFramedPad : public NCursesPad { protected: virtual void OnOperation(int pad_req); @@ -1372,4 +1395,4 @@ public: }; -#endif // _CURSESW_H +#endif // NCURSES_CURSESW_H_incl diff --git a/contrib/ncurses/c++/cursslk.cc b/contrib/ncurses/c++/cursslk.cc index 236d3a55b3dd..c0c372b04939 100644 --- a/contrib/ncurses/c++/cursslk.cc +++ b/contrib/ncurses/c++/cursslk.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,23 +31,23 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ +#include "internal.h" #include "cursslk.h" #include "cursesapp.h" -#include "internal.h" #include <string.h> -MODULE_ID("$Id: cursslk.cc,v 1.6 2000/07/15 21:07:50 tom Exp $") +MODULE_ID("$Id: cursslk.cc,v 1.9 2001/03/24 20:04:15 tom Exp $") void Soft_Label_Key_Set::Soft_Label_Key::operator=(char *text) { delete[] label; label = new char[1 + ::strlen(text)]; - (strcpy)(label,text); + (::strcpy)(label,text); } long Soft_Label_Key_Set::count = 0L; int Soft_Label_Key_Set::num_labels = 0; -Soft_Label_Key_Set::Label_Layout +Soft_Label_Key_Set::Label_Layout Soft_Label_Key_Set::format = None; void Soft_Label_Key_Set::init() { diff --git a/contrib/ncurses/c++/cursslk.h b/contrib/ncurses/c++/cursslk.h index 1598b0634bab..79fa9936fa94 100644 --- a/contrib/ncurses/c++/cursslk.h +++ b/contrib/ncurses/c++/cursslk.h @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * 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,17 +31,17 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $Id: cursslk.h,v 1.5 1999/05/16 17:30:08 juergen Exp $ +// $Id: cursslk.h,v 1.7 2001/03/24 21:41:47 tom Exp $ -#ifndef _CURSSLK_H -#define _CURSSLK_H +#ifndef NCURSES_CURSSLK_H_incl +#define NCURSES_CURSSLK_H_incl #include <cursesw.h> -class Soft_Label_Key_Set { +class NCURSES_IMPEXP Soft_Label_Key_Set { public: // This inner class represents the attributes of a Soft Label Key (SLK) - class Soft_Label_Key { + class NCURSES_IMPEXP Soft_Label_Key { friend class Soft_Label_Key_Set; public: typedef enum { Left=0, Center=1, Right=2 } Justification; @@ -83,10 +83,10 @@ public: } Label_Layout; private: - static long count; // Number of Key Sets - static Label_Layout format; // Layout of the Key Sets - static int num_labels; // Number Of Labels in Key Sets - bool b_attrInit; // Are attributes initialized + static long NCURSES_IMPEXP count; // Number of Key Sets + static Label_Layout NCURSES_IMPEXP format; // Layout of the Key Sets + static int NCURSES_IMPEXP num_labels; // Number Of Labels in Key Sets + bool NCURSES_IMPEXP b_attrInit; // Are attributes initialized Soft_Label_Key *slk_array; // The array of SLK's @@ -126,12 +126,12 @@ public: // This constructor assumes, that you already constructed a Key Set // with a layout by the constructor above. This layout will be reused. - Soft_Label_Key_Set(); + NCURSES_IMPEXP Soft_Label_Key_Set(); virtual ~Soft_Label_Key_Set(); // Get Label# i. Label counting starts with 1! - Soft_Label_Key& operator[](int i); + NCURSES_IMPEXP Soft_Label_Key& operator[](int i); // Retrieve number of Labels inline int labels() const { return num_labels; } @@ -202,4 +202,4 @@ public: } }; -#endif // _CURSSLK_H +#endif // NCURSES_CURSSLK_H_incl diff --git a/contrib/ncurses/c++/demo.cc b/contrib/ncurses/c++/demo.cc index 088dc2fbc86d..8db700019b56 100644 --- a/contrib/ncurses/c++/demo.cc +++ b/contrib/ncurses/c++/demo.cc @@ -6,7 +6,7 @@ * Demo code for NCursesMenu and NCursesForm written by * Juergen Pfeifer <juergen.pfeifer@gmx.net> * - * $Id: demo.cc,v 1.18 1999/09/11 18:57:54 tom Exp $ + * $Id: demo.cc,v 1.20 2001/01/28 02:26:27 tom Exp $ */ #include "cursesapp.h" diff --git a/contrib/ncurses/c++/edit_cfg.sh b/contrib/ncurses/c++/edit_cfg.sh index efea83323b11..e2f828a86134 100755 --- a/contrib/ncurses/c++/edit_cfg.sh +++ b/contrib/ncurses/c++/edit_cfg.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: edit_cfg.sh,v 1.8 2000/07/01 16:07:37 tom Exp $ +# $Id: edit_cfg.sh,v 1.10 2001/04/07 22:45:11 tom Exp $ ############################################################################## # Copyright (c) 1998,2000 Free Software Foundation, Inc. # # # @@ -42,10 +42,13 @@ for name in \ ETIP_NEEDS_MATH_EXCEPTION \ ETIP_NEEDS_MATH_H \ HAVE_BUILTIN_H \ - HAVE_GXX_BUILTIN_H \ HAVE_GPP_BUILTIN_H \ + HAVE_GXX_BUILTIN_H \ + HAVE_STRSTREAM_H \ HAVE_TYPEINFO \ - HAVE_VALUES_H + HAVE_VALUES_H \ + USE_STDIO_VSCAN \ + USE_STRSTREAM_VSCAN do mv $2 $2.bak if ( grep "[ ]$name[ ]1" $1 2>&1 >/dev/null) diff --git a/contrib/ncurses/c++/etip.h.in b/contrib/ncurses/c++/etip.h.in index 985cd1eb6a06..d3421d2c5f06 100644 --- a/contrib/ncurses/c++/etip.h.in +++ b/contrib/ncurses/c++/etip.h.in @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * 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,10 +31,10 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $Id: etip.h.in,v 1.13 1999/09/12 02:01:59 tom Exp $ +// $Id: etip.h.in,v 1.18 2001/04/07 22:45:04 tom Exp $ -#ifndef _ETIP_H -#define _ETIP_H +#ifndef NCURSES_ETIP_H_incl +#define NCURSES_ETIP_H_incl 1 // These are substituted at configure/build time #ifndef HAVE_BUILTIN_H @@ -49,6 +49,10 @@ #define HAVE_GPP_BUILTIN_H 0 #endif +#ifndef HAVE_STRSTREAM_H +#define HAVE_STRSTREAM_H 0 +#endif + #ifndef HAVE_TYPEINFO #define HAVE_TYPEINFO 0 #endif @@ -69,6 +73,14 @@ #define CPP_HAS_PARAM_INIT 0 #endif +#ifndef USE_STDIO_VSCAN +#define USE_STDIO_VSCAN 0 +#endif + +#ifndef USE_STRSTREAM_VSCAN +#define USE_STRSTREAM_VSCAN 0 +#endif + #ifdef __GNUG__ # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) # if HAVE_TYPEINFO @@ -104,6 +116,8 @@ # include <string.h> #endif +#include <ncurses_dll.h> + extern "C" { #if HAVE_VALUES_H # include <values.h> @@ -122,11 +136,11 @@ extern "C" { #endif // Forward Declarations -class NCursesPanel; -class NCursesMenu; -class NCursesForm; +class NCURSES_IMPEXP NCursesPanel; +class NCURSES_IMPEXP NCursesMenu; +class NCURSES_IMPEXP NCursesForm; -class NCursesException +class NCURSES_IMPEXP NCursesException { public: const char *message; @@ -145,30 +159,30 @@ public: } }; -class NCursesPanelException : public NCursesException +class NCURSES_IMPEXP NCursesPanelException : public NCursesException { public: const NCursesPanel* p; - NCursesPanelException (const char *msg, int err) : + NCursesPanelException (const char *msg, int err) : NCursesException (msg, err), p ((NCursesPanel*)0) {}; NCursesPanelException (const NCursesPanel* panel, const char *msg, - int err) : + int err) : NCursesException (msg, err), p (panel) {}; - NCursesPanelException (int err) : + NCursesPanelException (int err) : NCursesException ("panel library error", err), p ((NCursesPanel*)0) {}; NCursesPanelException (const NCursesPanel* panel, - int err) : + int err) : NCursesException ("panel library error", err), p (panel) {}; @@ -179,30 +193,30 @@ public: }; -class NCursesMenuException : public NCursesException +class NCURSES_IMPEXP NCursesMenuException : public NCursesException { public: const NCursesMenu* m; - NCursesMenuException (const char *msg, int err) : + NCursesMenuException (const char *msg, int err) : NCursesException (msg, err), m ((NCursesMenu *)0) {}; NCursesMenuException (const NCursesMenu* menu, const char *msg, - int err) : + int err) : NCursesException (msg, err), m (menu) {}; - NCursesMenuException (int err) : + NCursesMenuException (int err) : NCursesException ("menu library error", err), m ((NCursesMenu *)0) {}; NCursesMenuException (const NCursesMenu* menu, - int err) : + int err) : NCursesException ("menu library error", err), m (menu) {}; @@ -213,30 +227,30 @@ public: }; -class NCursesFormException : public NCursesException +class NCURSES_IMPEXP NCursesFormException : public NCursesException { public: const NCursesForm* f; - NCursesFormException (const char *msg, int err) : + NCursesFormException (const char *msg, int err) : NCursesException (msg, err), f ((NCursesForm*)0) {}; NCursesFormException (const NCursesForm* form, const char *msg, - int err) : + int err) : NCursesException (msg, err), f (form) {}; - NCursesFormException (int err) : + NCursesFormException (int err) : NCursesException ("form library error", err), f ((NCursesForm*)0) {}; NCursesFormException (const NCursesForm* form, - int err) : + int err) : NCursesException ("form library error", err), f (form) {}; @@ -265,9 +279,9 @@ inline void THROW(const NCursesException *e) { if (e) cerr << e->message << endl; exit(0); -#endif +#endif } #define THROWS(s) -#endif // _ETIP_H +#endif // NCURSES_ETIP_H_incl diff --git a/contrib/ncurses/c++/internal.h b/contrib/ncurses/c++/internal.h index 67bc3ff2469e..6009027c929a 100644 --- a/contrib/ncurses/c++/internal.h +++ b/contrib/ncurses/c++/internal.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,10 +31,12 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * ****************************************************************************/ -// $Id: internal.h,v 1.6 2000/09/02 18:22:23 tom Exp $ +// $Id: internal.h,v 1.8 2001/03/24 21:36:17 tom Exp $ -#ifndef _CPLUS_INTERNAL_H -#define _CPLUS_INTERNAL_H 1 +#ifndef NCURSES_CPLUS_INTERNAL_H +#define NCURSES_CPLUS_INTERNAL_H 1 + +#include <ncurses_cfg.h> #if USE_RCS_IDS #define MODULE_ID(id) static const char Ident[] = id; @@ -44,4 +46,4 @@ #define CTRL(x) ((x) & 0x1f) -#endif +#endif // NCURSES_CPLUS_INTERNAL_H diff --git a/contrib/ncurses/config.guess b/contrib/ncurses/config.guess index b100dbe1a331..71de137a6b6c 100755 --- a/contrib/ncurses/config.guess +++ b/contrib/ncurses/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. -version='2000-06-13' +timestamp='2001-03-16' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -32,30 +32,41 @@ version='2000-06-13' # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# +# don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] -Output the configuration name of this system. +Output the configuration name of the system \`$me' is run on. Operation modes: - -h, --help print this help, then exit - -V, --version print version number, then exit" + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do - case "$1" in - --version | --vers* | -V ) + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; @@ -64,9 +75,7 @@ while test $# -gt 0 ; do - ) # Use stdin as input. break ;; -* ) - exec >&2 - echo "$me: invalid option $1" - echo "$help" + echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; @@ -78,19 +87,30 @@ if test $# != 0; then exit 1 fi -# Use $HOST_CC if defined. $CC may point to a cross-compiler -if test x"$CC_FOR_BUILD" = x; then - if test x"$HOST_CC" != x; then - CC_FOR_BUILD="$HOST_CC" - else - if test x"$CC" != x; then - CC_FOR_BUILD="$CC" - else - CC_FOR_BUILD=cc - fi - fi -fi +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break + fi + done + rm -f $dummy.c $dummy.o $dummy.rel + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 8/24/94.) @@ -100,18 +120,12 @@ fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - i?86:OS/2:*:*) - echo "i386-unknown-os2" - exit 0;; *:NetBSD:*:*) # Netbsd (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -122,7 +136,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # object file format. # Determine the machine/vendor (is the vendor relevant). case "${UNAME_MACHINE}" in - amiga) machine=m68k-cbm ;; + amiga) machine=m68k-unknown ;; arm32) machine=arm-unknown ;; atari*) machine=m68k-atari ;; sun3*) machine=m68k-sun ;; @@ -132,16 +146,24 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ibmrt|romp-ibm) machine=romp-ibm ;; *) machine=${UNAME_MACHINE}-unknown ;; esac - # The Operating System including object format. - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: @@ -218,7 +240,7 @@ EOF echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-cbm-sysv4 + echo m68k-unknown-sysv4 exit 0;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} @@ -250,7 +272,7 @@ EOF arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; - SR2?01:HI-UX/MPP:*:*) + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) @@ -386,7 +408,7 @@ EOF EOF $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm $dummy.c $dummy && exit 0 + && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; @@ -434,12 +456,20 @@ EOF *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i?86:AIX:*:*) echo i386-ibm-aix exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then sed 's/^ //' << EOF >$dummy.c @@ -453,7 +483,7 @@ EOF exit(0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then @@ -462,9 +492,9 @@ EOF echo rs6000-ibm-aix3.2 fi exit 0 ;; - *:AIX:*:4) + *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` - if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc @@ -472,7 +502,7 @@ EOF if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=4.${UNAME_RELEASE} + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; @@ -498,10 +528,28 @@ EOF echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE @@ -536,11 +584,16 @@ EOF } EOF (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy + fi ;; esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; 3050*:HI-UX:*:*) sed 's/^ //' << EOF >$dummy.c #include <unistd.h> @@ -567,7 +620,7 @@ EOF exit (0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; @@ -631,23 +684,24 @@ EOF CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; - CRAY*T3E:*:*:*) + CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; - F300:UNIX_System_V:*:*) + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -672,6 +726,9 @@ EOF i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we @@ -693,58 +750,38 @@ EOF i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; - *:Linux:*:*) - - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - ld_help_string=`cd /; ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | sed -ne '/supported emulations:/!d - s/[ ][ ]*/ /g - s/.*supported emulations: *// - s/ .*// - p'` - case "$ld_supported_emulations" in - *ia64) - echo "${UNAME_MACHINE}-unknown-linux" - exit 0 - ;; - i?86linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 - ;; - elf_i?86) - echo "${UNAME_MACHINE}-pc-linux" - exit 0 - ;; - i?86coff) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 - ;; - sparclinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - armlinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - elf32arm*) - echo "${UNAME_MACHINE}-unknown-linux-gnuoldld" - exit 0 - ;; - armelf_linux*) - echo "${UNAME_MACHINE}-unknown-linux-gnu" - exit 0 - ;; - m68klinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - elf32ppc | elf32ppclinux) - # Determine Lib Version - cat >$dummy.c <<EOF + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + cat >$dummy.c <<EOF +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ +int main (int argc, char *argv[]) { +#else +int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __MIPSEB__ + printf ("%s-unknown-linux-gnu\n", argv[1]); +#endif +#ifdef __MIPSEL__ + printf ("%sel-unknown-linux-gnu\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + ;; + ppc:Linux:*:*) + # Determine Lib Version + cat >$dummy.c <<EOF #include <features.h> #if defined(__GLIBC__) extern char __libc_version[]; @@ -757,127 +794,127 @@ main(argc, argv) #if defined(__GLIBC__) printf("%s %s\n", __libc_version, __libc_release); #else - printf("unkown\n"); + printf("unknown\n"); #endif return 0; } EOF - LIBC="" - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then LIBC="libc1" ; fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} + exit 0 ;; + alpha:Linux:*:*) + cat <<EOF >$dummy.s + .data + \$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + .text + .globl main + .align 4 + .ent main + main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + LIBC="" + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) UNAME_MACHINE="alpha" ;; + 1-0) UNAME_MACHINE="alphaev5" ;; + 1-1) UNAME_MACHINE="alphaev56" ;; + 1-101) UNAME_MACHINE="alphapca56" ;; + 2-303) UNAME_MACHINE="alphaev6" ;; + 2-307) UNAME_MACHINE="alphaev67" ;; + esac + objdump --private-headers $dummy | \ + grep ld.so.1 > /dev/null if test "$?" = 0 ; then - ./$dummy | grep 1\.99 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi + LIBC="libc1" fi - rm -f $dummy.c $dummy - echo powerpc-unknown-linux-gnu${LIBC} + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i?86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_supported_emulations=`cd /; ld --help 2>&1 \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + i?86linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; - shelf_linux) - echo "${UNAME_MACHINE}-unknown-linux-gnu" + elf_i?86) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + i?86coff) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - cat <<EOF >$dummy.s - .data - \$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main - main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - LIBC="" - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `./$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; - esac - - objdump --private-headers $dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >$dummy.c <<EOF -#ifdef __cplusplus -#include <stdio.h> /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __MIPSEB__ - printf ("%s-unknown-linux-gnu\n", argv[1]); -#endif -#ifdef __MIPSEL__ - printf ("%sel-unknown-linux-gnu\n", argv[1]); -#endif - return 0; -} -EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - elif test "${UNAME_MACHINE}" = "s390"; then - echo s390-ibm-linux && exit 0 - else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac - # Determine whether the default compiler is a.out or elf - cat >$dummy.c <<EOF + # Either a pre-BFD a.out linker (linux-gnuoldld) + # or one that does not give us useful --help. + # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. + # If ld does not provide *any* "supported emulations:" + # that means it is gnuoldld. + test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + case "${UNAME_MACHINE}" in + i?86) + VENDOR=pc; + ;; + *) + VENDOR=unknown; + ;; + esac + # Determine whether the default compiler is a.out or elf + cat >$dummy.c <<EOF #include <features.h> #ifdef __cplusplus #include <stdio.h> /* for printf() prototype */ @@ -901,9 +938,10 @@ EOF return 0; } EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - fi ;; + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions # are messed up and put the nodename in both sysname and nodename. i?86:DYNIX/ptx:4*:*) @@ -980,7 +1018,7 @@ EOF exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -1003,9 +1041,12 @@ EOF TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; @@ -1039,7 +1080,7 @@ EOF mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; - news*:NEWS-OS:*:6*) + news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) @@ -1082,15 +1123,52 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; - NSR-W:NONSTOP_KERNEL:*:*) + NSR-[KW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i?86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1182,11 +1260,24 @@ main () #endif #if defined (vax) -#if !defined (ultrix) - printf ("vax-dec-bsd\n"); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif +# if !defined (ultrix) +# include <sys/param.h> +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif #endif #if defined (alliant) && defined (i860) @@ -1197,7 +1288,7 @@ main () } EOF -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. @@ -1233,8 +1324,9 @@ fi cat >&2 <<EOF $0: unable to guess system type -The $version version of this script cannot recognize your system type. -Please download the most up to date version of the config scripts: +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from ftp://ftp.gnu.org/pub/gnu/config/ @@ -1243,7 +1335,7 @@ send the following data and any information you think might be pertinent to <config-patches@gnu.org> in order to provide the needed information to handle your system. -config.guess version = $version +config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` @@ -1270,7 +1362,7 @@ exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "version='" +# time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: diff --git a/contrib/ncurses/config.sub b/contrib/ncurses/config.sub index f8ec622e95b0..9df4e53f8092 100755 --- a/contrib/ncurses/config.sub +++ b/contrib/ncurses/config.sub @@ -1,9 +1,9 @@ #! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. -version='2000-07-06' +timestamp='2001-03-09' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -60,16 +60,30 @@ Usage: $0 [OPTION] CPU-MFR-OPSYS Canonicalize a configuration name. Operation modes: - -h, --help print this help, then exit - -V, --version print version number, then exit" + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do - case "$1" in - --version | --vers* | -V ) + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; @@ -78,9 +92,7 @@ while test $# -gt 0 ; do - ) # Use stdin as input. break ;; -* ) - exec >&2 - echo "$me: invalid option $1" - echo "$help" + echo "$me: invalid option $1$help" exit 1 ;; *local*) @@ -105,7 +117,7 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu*) + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -122,9 +134,6 @@ esac ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in - -os2) - basic_machine=`echo $1 | sed -e 's/86-.*/86/'` - ;; -sun*os*) # Prevent following clause from handling this invalid input. ;; @@ -206,22 +215,24 @@ esac case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ + | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ + | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 \ - | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ | hppa64 \ | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ | alphaev6[78] \ | we32k | ns16k | clipper | i370 | sh | sh[34] \ | powerpc | powerpcle \ - | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ + | 1750a | dsp16xx | pdp10 | pdp11 \ + | mips16 | mips64 | mipsel | mips64el \ | mips64orion | mips64orionel | mipstx39 | mipstx39el \ | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ - | mips64vr5000 | miprs64vr5000el | mcore \ + | mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \ | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ - | thumb | d10v | d30v | fr30 | avr) + | thumb | d10v | d30v | fr30 | avr | openrisc) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) @@ -235,7 +246,7 @@ case $basic_machine in # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. - i[234567]86) + i[234567]86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. @@ -246,26 +257,28 @@ case $basic_machine in # Recognize the basic CPU types with company name. # FIXME: clean up the formatting here. vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ + | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ | xmp-* | ymp-* \ - | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ | hppa2.0n-* | hppa64-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ | alphaev6[78]-* \ | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ | mips64el-* | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ | mipstx39-* | mipstx39el-* | mcore-* \ - | f301-* | armv*-* | s390-* | sv1-* | t3e-* \ + | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ + | [cjt]90-* \ | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ - | bs2000-* | tic54x-* | c54x-*) + | bs2000-* | tic54x-* | c54x-* | x86_64-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -302,14 +315,14 @@ case $basic_machine in os=-sysv ;; amiga | amiga-*) - basic_machine=m68k-cbm + basic_machine=m68k-unknown ;; amigaos | amigados) - basic_machine=m68k-cbm + basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) - basic_machine=m68k-cbm + basic_machine=m68k-unknown os=-sysv4 ;; apollo68) @@ -356,8 +369,8 @@ case $basic_machine in basic_machine=cray2-cray os=-unicos ;; - [ctj]90-cray) - basic_machine=c90-cray + [cjt]90) + basic_machine=${basic_machine}-cray os=-unicos ;; crds | unos) @@ -413,6 +426,10 @@ case $basic_machine in basic_machine=tron-gmicro os=-sysv ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -512,14 +529,6 @@ case $basic_machine in basic_machine=i386-unknown os=-vsta ;; - i386-go32 | go32) - basic_machine=i386-unknown - os=-go32 - ;; - i386-mingw32 | mingw32) - basic_machine=i386-unknown - os=-mingw32 - ;; iris | iris4d) basic_machine=mips-sgi case $os in @@ -545,6 +554,10 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; miniframe) basic_machine=m68000-convergent ;; @@ -575,7 +588,7 @@ case $basic_machine in os=-coff ;; msdos) - basic_machine=i386-unknown + basic_machine=i386-pc os=-msdos ;; mvs) @@ -639,6 +652,10 @@ case $basic_machine in basic_machine=i960-intel os=-mon960 ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; np1) basic_machine=np1-gould ;; @@ -674,28 +691,28 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; - pentium | p5 | k5 | k6 | nexen) + pentium | p5 | k5 | k6 | nexgen) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) - basic_machine=i786-pc + basic_machine=i686-pc ;; - pentium-* | p5-* | k5-* | k6-* | nexen-*) + pentium-* | p5-* | k5-* | k6-* | nexgen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; - power) basic_machine=rs6000-ibm + power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; @@ -710,6 +727,10 @@ case $basic_machine in ps2) basic_machine=i386-ibm ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -900,6 +921,10 @@ case $basic_machine in vax) basic_machine=vax-dec ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; pdp11) basic_machine=pdp11-dec ;; @@ -907,7 +932,7 @@ case $basic_machine in basic_machine=we32k-att ;; sh3 | sh4) - base_machine=sh-unknown + basic_machine=sh-unknown ;; sparc | sparcv9) basic_machine=sparc-sun @@ -990,7 +1015,8 @@ case $os in | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit*) + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1006,7 +1032,6 @@ case $os in os=-nto-qnx ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -os2 \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; @@ -1052,7 +1077,7 @@ case $os in -ns2 ) os=-nextstep2 ;; - -nsk) + -nsk*) os=-nsk ;; # Preserve the version number of sinix5. @@ -1089,7 +1114,7 @@ case $os in -xenix) os=-xenix ;; - -*mint | -*MiNT) + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) @@ -1123,6 +1148,9 @@ case $basic_machine in arm*-semi) os=-aout ;; + pdp10-*) + os=-tops20 + ;; pdp11-*) os=-none ;; @@ -1231,7 +1259,7 @@ case $basic_machine in *-masscomp) os=-rtu ;; - f301-fujitsu) + f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) @@ -1309,7 +1337,7 @@ case $basic_machine in -mpw* | -macos*) vendor=apple ;; - -*mint | -*MiNT) + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; esac @@ -1322,7 +1350,7 @@ exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "version='" +# time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: diff --git a/contrib/ncurses/configure b/contrib/ncurses/configure index 7b8164df2eef..d8e599b277fa 100755 --- a/contrib/ncurses/configure +++ b/contrib/ncurses/configure @@ -1,6 +1,6 @@ #! /bin/sh -# From configure.in Revision: 1.217 +# From configure.in Revision: 1.233 @@ -193,15 +193,17 @@ cat <<EOF --without-cxx-binding do not build C++ binding and demo --without-ada suppress check for Ada95, don't build demo --without-progs suppress build with programs (e.g., tic) + --without-curses-h install curses.h as ncurses.h only --with-install-prefix prefixes actual install-location Options to Specify the Libraries Built/Used: + --with-libtool generate libraries with libtool --with-shared generate shared-libraries --with-normal generate normal-libraries (default) --with-debug generate debug-libraries (default) - --with-profile generate profile-libraries - --with-termlib generate separate terminfo library EOF cat <<EOF + --with-profile generate profile-libraries + --with-termlib generate separate terminfo library --with-dbmalloc test: use Conor Cahill's dbmalloc library --with-dmalloc test: use Gray Watson's dmalloc library --with-gpm use Alessandro Rubini's GPM library @@ -212,25 +214,27 @@ Fine-Tuning Your Configuration: --disable-database use only built-in data --with-database=XXX specify terminfo source to install --with-fallbacks=XXX specify list of fallback terminal descriptions - --with-terminfo-dirs=XXX specify list of terminfo directories (default: DATADIR/terminfo) - --with-default-terminfo-dir=DIR default terminfo directory (default: DATADIR/terminfo) EOF cat <<EOF + --with-terminfo-dirs=XXX specify list of terminfo directories (default: DATADIR/terminfo) + --with-default-terminfo-dir=DIR default terminfo directory (default: DATADIR/terminfo) --disable-big-core assume machine has little memory --enable-termcap compile in termcap fallback support --enable-getcap fast termcap load, no xrefs to terminfo --enable-getcap-cache cache translated termcaps in ~/.terminfo --enable-symlinks make tic use symbolic links not hard links --enable-broken_linker compile with broken-linker support code + --with-ospeed=TYPE override type of ospeed variable --enable-bsdpad recognize BSD-style prefix padding --with-rcs-ids compile-in RCS identifiers Options to Specify How Manpages are Installed: +EOF +cat <<EOF --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and optionally formatted, e.g., gzip,formatted --with-manpage-renames specify manpage-renaming --with-manpage-symlinks specify manpage-symlinks -EOF -cat <<EOF + --with-manpage-tbl specify manpage processing with tbl Extensions: --disable-ext-funcs disable function-extensions --enable-const compile with extra/non-standard const @@ -239,12 +243,12 @@ Extensions: --enable-tcap-names compile with user-definable terminal capabilities Development Code: --with-develop enable all development options +EOF +cat <<EOF --enable-colorfgbg compile with \$COLORFGBG code --enable-hard-tabs compile with hard-tabs code --disable-root-environ limit environment when running as root --enable-xmc-glitch compile with limited support for xmc -EOF -cat <<EOF Experimental Code: --disable-assumed-color do not assume anything about default-colors --disable-hashmap compile without hashmap scrolling-optimization @@ -253,12 +257,12 @@ Experimental Code: --enable-widec compile with experimental wide-char/UTF-8 code Testing/development Options: --enable-echo build: display "compiling" commands (default) +EOF +cat <<EOF --enable-warnings build: turn on GCC compiler warnings --enable-assertions test: turn on generation of assertion code --disable-leaks test: suppress permanent memory-leaks --enable-expanded test: generate functions for certain macros -EOF -cat <<EOF --disable-macros test: use functions rather than macros Ada95 Binding Options: --with-ada-compiler=CMD specify Ada95 compiler command (default gnatmake) @@ -668,7 +672,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:672: checking host system type" >&5 +echo "configure:676: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -689,7 +693,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:693: checking target system type" >&5 +echo "configure:697: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -707,7 +711,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:711: checking build system type" >&5 +echo "configure:715: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -800,11 +804,11 @@ cf_user_CFLAGS="$CFLAGS" ### Default install-location echo $ac_n "checking for prefix""... $ac_c" 1>&6 -echo "configure:804: checking for prefix" >&5 +echo "configure:808: checking for prefix" >&5 if test "x$prefix" = "xNONE" ; then case "$cf_cv_system_name" in # non-vendor systems don't have a conflict - openbsd*|netbsd*|freebsd*|linux*) + openbsd*|netbsd*|freebsd*|linux*|cygwin*) prefix=/usr ;; *) prefix=$ac_default_prefix @@ -815,7 +819,7 @@ echo "$ac_t""$prefix" 1>&6 if test "x$prefix" = "xNONE" ; then echo $ac_n "checking for default include-directory""... $ac_c" 1>&6 -echo "configure:819: checking for default include-directory" >&5 +echo "configure:823: checking for default include-directory" >&5 test -n "$verbose" && echo 1>&6 for cf_symbol in \ $includedir \ @@ -845,7 +849,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:849: checking for $ac_word" >&5 +echo "configure:853: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -875,7 +879,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:879: checking for $ac_word" >&5 +echo "configure:883: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -926,7 +930,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:930: checking for $ac_word" >&5 +echo "configure:934: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -958,7 +962,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:962: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:966: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -969,12 +973,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 973 "configure" +#line 977 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1000,12 +1004,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1004: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1008: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1009: checking whether we are using GNU C" >&5 +echo "configure:1013: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1014,7 +1018,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1018: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1022: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1033,7 +1037,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1037: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1041: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1066,7 +1070,7 @@ fi if test "$GCC" = yes ; then echo $ac_n "checking version of gcc""... $ac_c" 1>&6 -echo "configure:1070: checking version of gcc" >&5 +echo "configure:1074: checking version of gcc" >&5 eval "$CC --version" fi if test "$host" != $build; then @@ -1075,7 +1079,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1079: checking for $ac_word" >&5 +echo "configure:1083: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_BUILD_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1109,7 +1113,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1113: checking how to run the C preprocessor" >&5 +echo "configure:1117: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1124,13 +1128,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 1128 "configure" +#line 1132 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1134: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1138: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1141,13 +1145,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1145 "configure" +#line 1149 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1151: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1158,13 +1162,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 1162 "configure" +#line 1166 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1190,13 +1194,13 @@ echo "$ac_t""$CPP" 1>&6 if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1194: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:1198: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext <<EOF -#line 1200 "configure" +#line 1204 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -1214,7 +1218,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 1218 "configure" +#line 1222 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -1236,7 +1240,7 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:1240: checking for POSIXized ISC" >&5 +echo "configure:1244: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -1258,13 +1262,14 @@ fi echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 -echo "configure:1262: checking for ${CC-cc} option to accept ANSI C" >&5 +echo "configure:1266: checking for ${CC-cc} option to accept ANSI C" >&5 if eval "test \"`echo '$''{'cf_cv_ansi_cc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_cv_ansi_cc=no cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi @@ -1280,9 +1285,27 @@ for cf_arg in "-DCC_HAS_PROTOS" \ "-Aa -D_HPUX_SOURCE" \ -Xc do - CFLAGS="$cf_save_CFLAGS $cf_arg" + +for cf_add_cflags in $cf_arg +do + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case "$CPPFLAGS" in + *$cf_add_cflags) + ;; + *) + CPPFLAGS="$CPPFLAGS $cf_add_cflags" + ;; + esac + ;; + *) + CFLAGS="$CFLAGS $cf_add_cflags" + ;; + esac +done + cat > conftest.$ac_ext <<EOF -#line 1286 "configure" +#line 1309 "configure" #include "confdefs.h" #ifndef CC_HAS_PROTOS @@ -1298,7 +1321,7 @@ int main() { struct s2 {int (*f) (double a);}; ; return 0; } EOF -if { (eval echo configure:1302: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1325: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ansi_cc="$cf_arg"; break else @@ -1308,6 +1331,7 @@ fi rm -f conftest* done CFLAGS="$cf_save_CFLAGS" +CPPFLAGS="$cf_save_CPPFLAGS" fi @@ -1315,7 +1339,25 @@ echo "$ac_t""$cf_cv_ansi_cc" 1>&6 if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then - CFLAGS="$CFLAGS $cf_cv_ansi_cc" + +for cf_add_cflags in $cf_cv_ansi_cc +do + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case "$CPPFLAGS" in + *$cf_add_cflags) + ;; + *) + CPPFLAGS="$CPPFLAGS $cf_add_cflags" + ;; + esac + ;; + *) + CFLAGS="$CFLAGS $cf_add_cflags" + ;; + esac +done + else cat >> confdefs.h <<\EOF #define CC_HAS_PROTOS 1 @@ -1339,8 +1381,9 @@ PROG_EXT= case $cf_cv_system_name in os2*) # We make sure -Zexe is not used -- it would interfere with @PROG_EXT@ - CFLAGS="$CFLAGS -Zmt -D__ST_MT_ERRNO__" - CXXFLAGS="$CXXFLAGS -Zmt -D__ST_MT_ERRNO__" + CFLAGS="$CFLAGS -Zmt" + CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" + CXXFLAGS="$CXXFLAGS -Zmt" LDFLAGS=`echo "$LDFLAGS -Zmt -Zcrtdll" | sed "s/-Zexe//g"` PROG_EXT=".exe" ;; @@ -1359,7 +1402,7 @@ freebsd*) #(vi # Extract the first word of "ldconfig", so it can be a program name with args. set dummy ldconfig; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1363: checking for $ac_word" >&5 +echo "configure:1406: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LDCONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1396,7 +1439,7 @@ esac echo $ac_n "checking if you want to ensure bool is consistent with C++""... $ac_c" 1>&6 -echo "configure:1400: checking if you want to ensure bool is consistent with C++" >&5 +echo "configure:1443: checking if you want to ensure bool is consistent with C++" >&5 # Check whether --with-cxx or --without-cxx was given. if test "${with_cxx+set}" = set; then @@ -1416,7 +1459,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1420: checking for $ac_word" >&5 +echo "configure:1463: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1448,7 +1491,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1452: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:1495: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1459,12 +1502,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 1463 "configure" +#line 1506 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:1468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1490,12 +1533,12 @@ if test $ac_cv_prog_cxx_works = no; then echo "$ac_t""You don't have any C++ compiler, too bad" 1>&6; cf_with_cxx=no; CXX=""; GXX=""; fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1494: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1537: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:1499: checking whether we are using GNU C++" >&5 +echo "configure:1542: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1504,7 +1547,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1508: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1551: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -1523,7 +1566,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:1527: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:1570: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1567,7 +1610,7 @@ if test "$GXX" = yes; then fi echo $ac_n "checking if you want to build C++ binding and demo""... $ac_c" 1>&6 -echo "configure:1571: checking if you want to build C++ binding and demo" >&5 +echo "configure:1614: checking if you want to build C++ binding and demo" >&5 # Check whether --with-cxx-binding or --without-cxx-binding was given. if test "${with_cxx_binding+set}" = set; then @@ -1580,7 +1623,7 @@ fi echo "$ac_t""$cf_with_cxx_binding" 1>&6 echo $ac_n "checking if you want to build with Ada95""... $ac_c" 1>&6 -echo "configure:1584: checking if you want to build with Ada95" >&5 +echo "configure:1627: checking if you want to build with Ada95" >&5 # Check whether --with-ada or --without-ada was given. if test "${with_ada+set}" = set; then @@ -1593,7 +1636,7 @@ fi echo "$ac_t""$cf_with_ada" 1>&6 echo $ac_n "checking if you want to build programs such as tic""... $ac_c" 1>&6 -echo "configure:1597: checking if you want to build programs such as tic" >&5 +echo "configure:1640: checking if you want to build programs such as tic" >&5 # Check whether --with-progs or --without-progs was given. if test "${with_progs+set}" = set; then @@ -1605,6 +1648,19 @@ fi echo "$ac_t""$cf_with_progs" 1>&6 +echo $ac_n "checking if you wish to install curses.h""... $ac_c" 1>&6 +echo "configure:1653: checking if you wish to install curses.h" >&5 + +# Check whether --with-curses-h or --without-curses-h was given. +if test "${with_curses_h+set}" = set; then + withval="$with_curses_h" + with_curses_h=$withval +else + with_curses_h=yes +fi + +echo "$ac_t""$with_curses_h" 1>&6 + modules_to_build="ncurses" if test "X$cf_with_progs" != Xno ; then modules_to_build="$modules_to_build progs tack" @@ -1635,7 +1691,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1639: checking for $ac_word" >&5 +echo "configure:1695: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1665,7 +1721,7 @@ test -n "$AWK" && break done echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1669: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1725: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1703,7 +1759,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1707: checking for a BSD compatible install" >&5 +echo "configure:1763: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1759,14 +1815,14 @@ case $INSTALL in /*) ;; *) - cf_dir=`echo $INSTALL|sed -e 's%/[^/]*$%%'` + cf_dir=`echo $INSTALL | sed -e 's:/[^/]*$::'` test -z "$cf_dir" && cf_dir=. INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's:^.*/::'` ;; esac echo $ac_n "checking for long file names""... $ac_c" 1>&6 -echo "configure:1770: checking for long file names" >&5 +echo "configure:1826: checking for long file names" >&5 if eval "test \"`echo '$''{'ac_cv_sys_long_file_names'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1811,7 +1867,7 @@ fi echo $ac_n "checking if filesystem supports mixed-case filenames""... $ac_c" 1>&6 -echo "configure:1815: checking if filesystem supports mixed-case filenames" >&5 +echo "configure:1871: checking if filesystem supports mixed-case filenames" >&5 if eval "test \"`echo '$''{'cf_cv_mixedcase'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1834,7 +1890,7 @@ EOF echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1838: checking whether ln -s works" >&5 +echo "configure:1894: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1857,7 +1913,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1861: checking for $ac_word" >&5 +echo "configure:1917: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1889,7 +1945,7 @@ fi # Extract the first word of "ctags", so it can be a program name with args. set dummy ctags; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1893: checking for $ac_word" >&5 +echo "configure:1949: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKE_LOWER_TAGS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1921,7 +1977,7 @@ if test "$cf_cv_mixedcase" = yes ; then # Extract the first word of "etags", so it can be a program name with args. set dummy etags; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1925: checking for $ac_word" >&5 +echo "configure:1981: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKE_UPPER_TAGS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1971,7 +2027,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1975: checking for $ac_word" >&5 +echo "configure:2031: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LINT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2005,7 +2061,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2009: checking for $ac_word" >&5 +echo "configure:2065: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2041,7 +2097,7 @@ if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then else echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6 -echo "configure:2045: checking for loader (symbol LD)" >&5 +echo "configure:2101: checking for loader (symbol LD)" >&5 test -z "$LD" && LD=ld echo "$ac_t""$LD" 1>&6 @@ -2055,7 +2111,7 @@ if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then else echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6 -echo "configure:2059: checking for archiver (symbol AR)" >&5 +echo "configure:2115: checking for archiver (symbol AR)" >&5 test -z "$AR" && AR=ar echo "$ac_t""$AR" 1>&6 @@ -2069,7 +2125,7 @@ if eval "test \"`echo '$''{'cf_cv_subst_AR_OPTS'+set}'`\" = set"; then else echo $ac_n "checking for archiver options (symbol AR_OPTS)""... $ac_c" 1>&6 -echo "configure:2073: checking for archiver options (symbol AR_OPTS)" >&5 +echo "configure:2129: checking for archiver options (symbol AR_OPTS)" >&5 test -z "$AR_OPTS" && AR_OPTS=rv echo "$ac_t""$AR_OPTS" 1>&6 @@ -2081,7 +2137,7 @@ AR_OPTS=${cf_cv_subst_AR_OPTS} echo $ac_n "checking for makeflags variable""... $ac_c" 1>&6 -echo "configure:2085: checking for makeflags variable" >&5 +echo "configure:2141: checking for makeflags variable" >&5 if eval "test \"`echo '$''{'cf_cv_makeflags'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2117,7 +2173,7 @@ echo "$ac_t""$cf_cv_makeflags" 1>&6 echo $ac_n "checking if you have specified an install-prefix""... $ac_c" 1>&6 -echo "configure:2121: checking if you have specified an install-prefix" >&5 +echo "configure:2177: checking if you have specified an install-prefix" >&5 # Check whether --with-install-prefix or --without-install-prefix was given. if test "${with_install_prefix+set}" = set; then @@ -2141,8 +2197,28 @@ echo "$ac_t""$DESTDIR" 1>&6 ### shared, for example. cf_list_models="" +echo $ac_n "checking if you want to build libraries with libtool""... $ac_c" 1>&6 +echo "configure:2202: checking if you want to build libraries with libtool" >&5 + +# Check whether --with-libtool or --without-libtool was given. +if test "${with_libtool+set}" = set; then + withval="$with_libtool" + with_libtool=$withval +else + with_libtool=no +fi + +echo "$ac_t""$with_libtool" 1>&6 +if test "$with_libtool" = "yes"; then + cf_list_models="$cf_list_models libtool" + test -z "$LIBTOOL" && LIBTOOL=libtool +else + LIBTOOL="" +fi + + echo $ac_n "checking if you want to build shared libraries""... $ac_c" 1>&6 -echo "configure:2146: checking if you want to build shared libraries" >&5 +echo "configure:2222: checking if you want to build shared libraries" >&5 # Check whether --with-shared or --without-shared was given. if test "${with_shared+set}" = set; then @@ -2156,7 +2232,7 @@ echo "$ac_t""$with_shared" 1>&6 test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared" echo $ac_n "checking if you want to build static libraries""... $ac_c" 1>&6 -echo "configure:2160: checking if you want to build static libraries" >&5 +echo "configure:2236: checking if you want to build static libraries" >&5 # Check whether --with-normal or --without-normal was given. if test "${with_normal+set}" = set; then @@ -2170,7 +2246,7 @@ echo "$ac_t""$with_normal" 1>&6 test "$with_normal" = "yes" && cf_list_models="$cf_list_models normal" echo $ac_n "checking if you want to build debug libraries""... $ac_c" 1>&6 -echo "configure:2174: checking if you want to build debug libraries" >&5 +echo "configure:2250: checking if you want to build debug libraries" >&5 # Check whether --with-debug or --without-debug was given. if test "${with_debug+set}" = set; then @@ -2184,7 +2260,7 @@ echo "$ac_t""$with_debug" 1>&6 test "$with_debug" = "yes" && cf_list_models="$cf_list_models debug" echo $ac_n "checking if you want to build profiling libraries""... $ac_c" 1>&6 -echo "configure:2188: checking if you want to build profiling libraries" >&5 +echo "configure:2264: checking if you want to build profiling libraries" >&5 # Check whether --with-profile or --without-profile was given. if test "${with_profile+set}" = set; then @@ -2200,14 +2276,15 @@ test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile" ############################################################################### echo $ac_n "checking for specified models""... $ac_c" 1>&6 -echo "configure:2204: checking for specified models" >&5 +echo "configure:2280: checking for specified models" >&5 test -z "$cf_list_models" && cf_list_models=normal +test "$with_libtool" = "yes" && cf_list_models=libtool echo "$ac_t""$cf_list_models" 1>&6 ### Use the first model as the default, and save its suffix for use in building ### up test-applications. echo $ac_n "checking for default model""... $ac_c" 1>&6 -echo "configure:2211: checking for default model" >&5 +echo "configure:2288: checking for default model" >&5 DFT_LWR_MODEL=`echo $cf_list_models | $AWK '{print $1}'` echo "$ac_t""$DFT_LWR_MODEL" 1>&6 @@ -2224,7 +2301,8 @@ LIB_NAME=ncurses LIB_DIR=../lib case $cf_cv_system_name in - os2) LIB_PREFIX='' ;; + OS/2*) LIB_PREFIX='' ;; + os2*) LIB_PREFIX='' ;; *) LIB_PREFIX='lib' ;; esac cf_prefix=$LIB_PREFIX @@ -2239,7 +2317,7 @@ LIB_SUFFIX= ############################################################################### echo $ac_n "checking if you want to build a separate terminfo library""... $ac_c" 1>&6 -echo "configure:2243: checking if you want to build a separate terminfo library" >&5 +echo "configure:2321: checking if you want to build a separate terminfo library" >&5 # Check whether --with-termlib or --without-termlib was given. if test "${with_termlib+set}" = set; then @@ -2253,7 +2331,7 @@ echo "$ac_t""$with_termlib" 1>&6 ### Checks for special libraries, must be done up-front. echo $ac_n "checking if you want to link with dbmalloc for testing""... $ac_c" 1>&6 -echo "configure:2257: checking if you want to link with dbmalloc for testing" >&5 +echo "configure:2335: checking if you want to link with dbmalloc for testing" >&5 # Check whether --with-dbmalloc or --without-dbmalloc was given. if test "${with_dbmalloc+set}" = set; then @@ -2266,7 +2344,7 @@ fi echo "$ac_t""$with_dbmalloc" 1>&6 if test "$with_dbmalloc" = yes ; then echo $ac_n "checking for debug_malloc in -ldbmalloc""... $ac_c" 1>&6 -echo "configure:2270: checking for debug_malloc in -ldbmalloc" >&5 +echo "configure:2348: checking for debug_malloc in -ldbmalloc" >&5 ac_lib_var=`echo dbmalloc'_'debug_malloc | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2274,7 +2352,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldbmalloc $LIBS" cat > conftest.$ac_ext <<EOF -#line 2278 "configure" +#line 2356 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2285,7 +2363,7 @@ int main() { debug_malloc() ; return 0; } EOF -if { (eval echo configure:2289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2315,7 +2393,7 @@ fi fi echo $ac_n "checking if you want to link with dmalloc for testing""... $ac_c" 1>&6 -echo "configure:2319: checking if you want to link with dmalloc for testing" >&5 +echo "configure:2397: checking if you want to link with dmalloc for testing" >&5 # Check whether --with-dmalloc or --without-dmalloc was given. if test "${with_dmalloc+set}" = set; then @@ -2328,7 +2406,7 @@ fi echo "$ac_t""$with_dmalloc" 1>&6 if test "$with_dmalloc" = yes ; then echo $ac_n "checking for dmalloc_debug in -ldmalloc""... $ac_c" 1>&6 -echo "configure:2332: checking for dmalloc_debug in -ldmalloc" >&5 +echo "configure:2410: checking for dmalloc_debug in -ldmalloc" >&5 ac_lib_var=`echo dmalloc'_'dmalloc_debug | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2336,7 +2414,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldmalloc $LIBS" cat > conftest.$ac_ext <<EOF -#line 2340 "configure" +#line 2418 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2347,7 +2425,7 @@ int main() { dmalloc_debug() ; return 0; } EOF -if { (eval echo configure:2351: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2378,7 +2456,7 @@ fi SHLIB_LIST="" echo $ac_n "checking if you want to link with the gpm mouse library""... $ac_c" 1>&6 -echo "configure:2382: checking if you want to link with the gpm mouse library" >&5 +echo "configure:2460: checking if you want to link with the gpm mouse library" >&5 # Check whether --with-gpm or --without-gpm was given. if test "${with_gpm+set}" = set; then @@ -2391,7 +2469,7 @@ fi echo "$ac_t""$with_gpm" 1>&6 if test "$with_gpm" = yes ; then echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6 -echo "configure:2395: checking for Gpm_Open in -lgpm" >&5 +echo "configure:2473: checking for Gpm_Open in -lgpm" >&5 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2399,7 +2477,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgpm $LIBS" cat > conftest.$ac_ext <<EOF -#line 2403 "configure" +#line 2481 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2410,7 +2488,7 @@ int main() { Gpm_Open() ; return 0; } EOF -if { (eval echo configure:2414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2492: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2436,17 +2514,17 @@ EOF do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2440: checking for $ac_hdr" >&5 +echo "configure:2518: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2445 "configure" +#line 2523 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2450: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2528: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2494,8 +2572,9 @@ fi echo $ac_n "checking for default loader flags""... $ac_c" 1>&6 -echo "configure:2498: checking for default loader flags" >&5 +echo "configure:2576: checking for default loader flags" >&5 case $DFT_LWR_MODEL in +libtool) LD_MODEL='' ;; normal) LD_MODEL='' ;; debug) LD_MODEL=$CC_G_OPT ;; profile) LD_MODEL='-pg';; @@ -2504,7 +2583,7 @@ esac echo "$ac_t""$LD_MODEL" 1>&6 echo $ac_n "checking if rpath option should be used""... $ac_c" 1>&6 -echo "configure:2508: checking if rpath option should be used" >&5 +echo "configure:2587: checking if rpath option should be used" >&5 # Check whether --enable-rpath or --disable-rpath was given. if test "${enable_rpath+set}" = set; then @@ -2526,7 +2605,7 @@ echo "$ac_t""$cf_cv_ld_rpath" 1>&6 cf_cv_do_symlinks=no echo $ac_n "checking if release/abi version should be used for shared libs""... $ac_c" 1>&6 -echo "configure:2530: checking if release/abi version should be used for shared libs" >&5 +echo "configure:2609: checking if release/abi version should be used for shared libs" >&5 # Check whether --with-shlib-version or --without-shlib-version was given. if test "${with_shlib_version+set}" = set; then @@ -2557,20 +2636,20 @@ fi if test "$GCC" = yes then echo $ac_n "checking which $CC option to use""... $ac_c" 1>&6 -echo "configure:2561: checking which $CC option to use" >&5 +echo "configure:2640: checking which $CC option to use" >&5 cf_save_CFLAGS="$CFLAGS" for CC_SHARED_OPTS in -fPIC -fpic '' do CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS" cat > conftest.$ac_ext <<EOF -#line 2567 "configure" +#line 2646 "configure" #include "confdefs.h" #include <stdio.h> int main() { int x = 1 ; return 0; } EOF -if { (eval echo configure:2574: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2653: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* break else @@ -2738,18 +2817,18 @@ rm -f conftest* if test -n "$cf_ld_rpath_opt" ; then echo $ac_n "checking if we need a space after rpath option""... $ac_c" 1>&6 -echo "configure:2742: checking if we need a space after rpath option" >&5 +echo "configure:2821: checking if we need a space after rpath option" >&5 cf_save_LIBS="$LIBS" LIBS="$LIBS ${cf_ld_rpath_opt}$libdir" cat > conftest.$ac_ext <<EOF -#line 2746 "configure" +#line 2825 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:2753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_rpath_space=no else @@ -2788,20 +2867,20 @@ fi ### use option --disable-overwrite to leave out the link to -lcurses echo $ac_n "checking if you wish to install ncurses overwriting curses""... $ac_c" 1>&6 -echo "configure:2792: checking if you wish to install ncurses overwriting curses" >&5 +echo "configure:2871: checking if you wish to install ncurses overwriting curses" >&5 # Check whether --enable-overwrite or --disable-overwrite was given. if test "${enable_overwrite+set}" = set; then enableval="$enable_overwrite" with_overwrite=$enableval else - with_overwrite=yes + if test "$prefix" != "/usr/local" ; then with_overwrite=yes; else with_overwrite=no; fi fi echo "$ac_t""$with_overwrite" 1>&6 echo $ac_n "checking if external terminfo-database is used""... $ac_c" 1>&6 -echo "configure:2805: checking if external terminfo-database is used" >&5 +echo "configure:2884: checking if external terminfo-database is used" >&5 # Check whether --enable-database or --disable-database was given. if test "${enable_database+set}" = set; then @@ -2829,7 +2908,7 @@ if test "$use_database" != no ; then EOF echo $ac_n "checking which terminfo source-file will be installed""... $ac_c" 1>&6 -echo "configure:2833: checking which terminfo source-file will be installed" >&5 +echo "configure:2912: checking which terminfo source-file will be installed" >&5 # Check whether --enable-database or --disable-database was given. if test "${enable_database+set}" = set; then @@ -2841,7 +2920,7 @@ fi fi echo $ac_n "checking for list of fallback descriptions""... $ac_c" 1>&6 -echo "configure:2845: checking for list of fallback descriptions" >&5 +echo "configure:2924: checking for list of fallback descriptions" >&5 # Check whether --with-fallbacks or --without-fallbacks was given. if test "${with_fallbacks+set}" = set; then @@ -2863,7 +2942,16 @@ if test "$use_database" = no ; then else echo $ac_n "checking for list of terminfo directories""... $ac_c" 1>&6 -echo "configure:2867: checking for list of terminfo directories" >&5 +echo "configure:2946: checking for list of terminfo directories" >&5 + + case $cf_cv_system_name in + os2*) PATHSEP=';' ;; + *) PATHSEP=':' ;; + esac + + + + # Check whether --with-terminfo-dirs or --without-terminfo-dirs was given. @@ -2874,7 +2962,7 @@ else withval="${TERMINFO_DIRS-${datadir}/terminfo}" fi -IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" +IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}" cf_dst_path= for cf_src_path in $withval do @@ -2882,7 +2970,7 @@ do case ".$cf_src_path" in #(vi ./*) #(vi ;; -.a-zA-Z:\\/*) #(vi OS/2 EMX +.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX ;; .\${*prefix}*) #(vi eval cf_src_path="$cf_src_path" @@ -2914,7 +3002,7 @@ EOF echo $ac_n "checking for default terminfo directory""... $ac_c" 1>&6 -echo "configure:2918: checking for default terminfo directory" >&5 +echo "configure:3006: checking for default terminfo directory" >&5 # Check whether --with-default-terminfo-dir or --without-default-terminfo-dir was given. if test "${with_default_terminfo_dir+set}" = set; then @@ -2927,7 +3015,7 @@ fi case ".$withval" in #(vi ./*) #(vi ;; -.a-zA-Z:\\/*) #(vi OS/2 EMX +.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX ;; .\${*prefix}*) #(vi eval withval="$withval" @@ -2960,7 +3048,7 @@ fi ### use option --disable-big-core to make tic run on small machines ### We need 4Mb, check if we can allocate 50% more than that. echo $ac_n "checking if big-core option selected""... $ac_c" 1>&6 -echo "configure:2964: checking if big-core option selected" >&5 +echo "configure:3052: checking if big-core option selected" >&5 # Check whether --enable-big-core or --disable-big-core was given. if test "${enable_big_core+set}" = set; then @@ -2971,7 +3059,7 @@ else with_big_core=no else cat > conftest.$ac_ext <<EOF -#line 2975 "configure" +#line 3063 "configure" #include "confdefs.h" #include <stdlib.h> @@ -2984,7 +3072,7 @@ int main() { exit(s == 0); } EOF -if { (eval echo configure:2988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then with_big_core=yes else @@ -3006,7 +3094,7 @@ EOF ### use option --enable-termcap to compile in the termcap fallback support echo $ac_n "checking if you want termcap-fallback support""... $ac_c" 1>&6 -echo "configure:3010: checking if you want termcap-fallback support" >&5 +echo "configure:3098: checking if you want termcap-fallback support" >&5 # Check whether --enable-termcap or --disable-termcap was given. if test "${enable_termcap+set}" = set; then @@ -3027,7 +3115,7 @@ else ### use option --enable-getcap to use a hacked getcap for reading termcaps echo $ac_n "checking if fast termcap-loader is needed""... $ac_c" 1>&6 -echo "configure:3031: checking if fast termcap-loader is needed" >&5 +echo "configure:3119: checking if fast termcap-loader is needed" >&5 # Check whether --enable-getcap or --disable-getcap was given. if test "${enable_getcap+set}" = set; then @@ -3044,7 +3132,7 @@ EOF echo $ac_n "checking if translated termcaps will be cached in ~/.terminfo""... $ac_c" 1>&6 -echo "configure:3048: checking if translated termcaps will be cached in ~/.terminfo" >&5 +echo "configure:3136: checking if translated termcaps will be cached in ~/.terminfo" >&5 # Check whether --enable-getcap-cache or --disable-getcap-cache was given. if test "${enable_getcap_cache+set}" = set; then @@ -3070,12 +3158,12 @@ for ac_func in \ unlink do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3074: checking for $ac_func" >&5 +echo "configure:3162: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3079 "configure" +#line 3167 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3098,7 +3186,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3129,12 +3217,12 @@ if test "$ac_cv_prog_cc_cross" = yes ; then symlink do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3133: checking for $ac_func" >&5 +echo "configure:3221: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3138 "configure" +#line 3226 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3157,7 +3245,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3183,7 +3271,7 @@ done else echo $ac_n "checking if link/symlink functions work""... $ac_c" 1>&6 -echo "configure:3187: checking if link/symlink functions work" >&5 +echo "configure:3275: checking if link/symlink functions work" >&5 if eval "test \"`echo '$''{'cf_cv_link_funcs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3195,7 +3283,7 @@ else eval 'ac_cv_func_'$cf_func'=error' else cat > conftest.$ac_ext <<EOF -#line 3199 "configure" +#line 3287 "configure" #include "confdefs.h" #include <sys/types.h> @@ -3224,7 +3312,7 @@ int main() } EOF -if { (eval echo configure:3228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_link_funcs="$cf_cv_link_funcs $cf_func" @@ -3261,7 +3349,7 @@ with_symlinks=no if test "$ac_cv_func_link" != yes ; then echo $ac_n "checking if tic should use symbolic links""... $ac_c" 1>&6 -echo "configure:3265: checking if tic should use symbolic links" >&5 +echo "configure:3353: checking if tic should use symbolic links" >&5 if test "$ac_cv_func_symlink" = yes ; then with_symlinks=yes else @@ -3270,7 +3358,7 @@ echo "configure:3265: checking if tic should use symbolic links" >&5 echo "$ac_t""$with_symlinks" 1>&6 elif test "$ac_cv_func_symlink" != yes ; then echo $ac_n "checking if tic should use hard links""... $ac_c" 1>&6 -echo "configure:3274: checking if tic should use hard links" >&5 +echo "configure:3362: checking if tic should use hard links" >&5 if test "$ac_cv_func_link" = yes ; then with_links=yes else @@ -3279,7 +3367,7 @@ echo "configure:3274: checking if tic should use hard links" >&5 echo "$ac_t""$with_links" 1>&6 else echo $ac_n "checking if tic should use symbolic links""... $ac_c" 1>&6 -echo "configure:3283: checking if tic should use symbolic links" >&5 +echo "configure:3371: checking if tic should use symbolic links" >&5 # Check whether --enable-symlinks or --disable-symlinks was given. if test "${enable_symlinks+set}" = set; then @@ -3303,7 +3391,7 @@ EOF ### use option --enable-broken-linker to force on use of broken-linker support echo $ac_n "checking if you want broken-linker support code""... $ac_c" 1>&6 -echo "configure:3307: checking if you want broken-linker support code" >&5 +echo "configure:3395: checking if you want broken-linker support code" >&5 # Check whether --enable-broken_linker or --disable-broken_linker was given. if test "${enable_broken_linker+set}" = set; then @@ -3319,9 +3407,24 @@ test "$with_broken_linker" = yes && cat >> confdefs.h <<\EOF EOF +### use option --with-ospeed to override ospeed's type +echo $ac_n "checking for type of ospeed""... $ac_c" 1>&6 +echo "configure:3413: checking for type of ospeed" >&5 + +# Check whether --with-ospeed or --without-ospeed was given. +if test "${with_ospeed+set}" = set; then + withval="$with_ospeed" + NCURSES_OSPEED=$withval +else + NCURSES_OSPEED=short +fi + +echo "$ac_t""$NCURSES_OSPEED" 1>&6 + + ### use option --enable-bsdpad to have tputs process BSD-style prefix padding echo $ac_n "checking if tputs should process BSD-style prefix padding""... $ac_c" 1>&6 -echo "configure:3325: checking if tputs should process BSD-style prefix padding" >&5 +echo "configure:3428: checking if tputs should process BSD-style prefix padding" >&5 # Check whether --enable-bsdpad or --disable-bsdpad was given. if test "${enable_bsdpad+set}" = set; then @@ -3339,7 +3442,7 @@ EOF ### Enable compiling-in rcs id's echo $ac_n "checking if RCS identifiers should be compiled-in""... $ac_c" 1>&6 -echo "configure:3343: checking if RCS identifiers should be compiled-in" >&5 +echo "configure:3446: checking if RCS identifiers should be compiled-in" >&5 # Check whether --with-rcs-ids or --without-rcs-ids was given. if test "${with_rcs_ids+set}" = set; then @@ -3358,8 +3461,10 @@ EOF ############################################################################### - echo $ac_n "checking format of man-pages""... $ac_c" 1>&6 -echo "configure:3363: checking format of man-pages" >&5 + + +echo $ac_n "checking format of man-pages""... $ac_c" 1>&6 +echo "configure:3468: checking format of man-pages" >&5 # Check whether --with-manpage-format or --without-manpage-format was given. @@ -3379,7 +3484,7 @@ case ".$cf_manpage_form" in MANPATH="/usr/man:/usr/share/man" fi # look for the 'date' man-page (it's most likely to be installed!) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}" cf_manpage_form=unknown for cf_dir in $MANPATH; do test -z "$cf_dir" && cf_dir=/usr/man @@ -3411,7 +3516,7 @@ echo "$ac_t""$cf_manpage_form" 1>&6 echo $ac_n "checking for manpage renaming""... $ac_c" 1>&6 -echo "configure:3415: checking for manpage renaming" >&5 +echo "configure:3520: checking for manpage renaming" >&5 # Check whether --with-manpage-renames or --without-manpage-renames was given. @@ -3454,7 +3559,7 @@ echo "$ac_t""$cf_manpage_renames" 1>&6 echo $ac_n "checking for manpage symlinks""... $ac_c" 1>&6 -echo "configure:3458: checking for manpage symlinks" >&5 +echo "configure:3563: checking for manpage symlinks" >&5 # Check whether --with-manpage-symlinks or --without-manpage-symlinks was given. @@ -3469,6 +3574,22 @@ fi echo "$ac_t""$cf_manpage_symlinks" 1>&6 +echo $ac_n "checking for manpage tbl""... $ac_c" 1>&6 +echo "configure:3579: checking for manpage tbl" >&5 + + +# Check whether --with-manpage-tbl or --without-manpage-tbl was given. +if test "${with_manpage_tbl+set}" = set; then + withval="$with_manpage_tbl" + cf_manpage_tbl=$withval +else + cf_manpage_tbl=no +fi + + +echo "$ac_t""$cf_manpage_tbl" 1>&6 + + if test "$prefix" = "NONE" ; then cf_prefix="$ac_default_prefix" else @@ -3534,6 +3655,7 @@ cat >>man/edit_man.sh <<CF_EOF aliases=\`sed -f \$srcdir/manlinks.sed \$inalias | sort -u\` CF_EOF fi + if test "$cf_manpage_renames" = no ; then cat >>man/edit_man.sh <<CF_EOF # perform program transformations for section 1 man pages @@ -3542,9 +3664,19 @@ cat >>man/edit_man.sh <<CF_EOF else target=$cf_subdir\${section}/\$source fi +CF_EOF +else +cat >>man/edit_man.sh <<CF_EOF + target=\`grep "^\$source" $cf_manpage_renames | $AWK '{print \$2}'\` + if test -z "\$target" ; then + echo '? missing rename for '\$source + target="\$source" + fi + target="$cf_subdir\${section}/\${target}" +CF_EOF +fi # replace variables in man page -CF_EOF for cf_name in captoinfo clear infocmp infotocap tic toe tput do @@ -3569,15 +3701,16 @@ CF_EOF cat >>man/edit_man.sh <<CF_EOF < \$i >\$TMP CF_EOF -else +if test $cf_manpage_tbl = yes ; then cat >>man/edit_man.sh <<CF_EOF - target=\`grep "^\$source" $cf_manpage_renames | $AWK '{print \$2}'\` - if test -z "\$target" ; then - echo '? missing rename for '\$source - target="\$source" - fi - target="$cf_subdir\$section/\$target" - test \$verb = installing && sed -e "s,@DATADIR@,\$datadir," < \$i | sed -f edit_man.sed >\$TMP + tbl \$TMP >\$TMP.out + mv \$TMP.out \$TMP +CF_EOF +fi +if test $with_curses_h != yes ; then +cat >>man/edit_man.sh <<CF_EOF + sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out + mv \$TMP.out \$TMP CF_EOF fi if test $cf_format = yes ; then @@ -3617,9 +3750,9 @@ CF_EOF ;; esac cat >>man/edit_man.sh <<CF_EOF - echo \$verb \$target suffix=\`basename \$target | sed -e 's/^[^.]*//'\` if test \$verb = installing ; then + echo \$verb \$target \$INSTALL_DATA \$TMP \$target test -n "\$aliases" && ( cd $cf_subdir\${section} && ( @@ -3647,7 +3780,8 @@ cat >>man/edit_man.sh <<CF_EOF done ) ) - else + elif test \$verb = removing ; then + echo \$verb \$target rm -f \$target test -n "\$aliases" && ( cd $cf_subdir\${section} && ( @@ -3662,6 +3796,9 @@ cat >>man/edit_man.sh <<CF_EOF done ) ) + else +# echo ".hy 0" + cat \$TMP fi ;; esac @@ -3677,7 +3814,7 @@ chmod 755 man/edit_man.sh ### Note that some functions (such as const) are normally disabled anyway. echo $ac_n "checking if you want to build with function extensions""... $ac_c" 1>&6 -echo "configure:3681: checking if you want to build with function extensions" >&5 +echo "configure:3818: checking if you want to build with function extensions" >&5 # Check whether --enable-ext-funcs or --disable-ext-funcs was given. if test "${enable_ext_funcs+set}" = set; then @@ -3717,7 +3854,7 @@ fi ### use option --enable-const to turn on use of const beyond that in XSI. echo $ac_n "checking for extended use of const keyword""... $ac_c" 1>&6 -echo "configure:3721: checking for extended use of const keyword" >&5 +echo "configure:3858: checking for extended use of const keyword" >&5 # Check whether --enable-const or --disable-const was given. if test "${enable_const+set}" = set; then @@ -3735,7 +3872,7 @@ fi echo $ac_n "checking if you want \$NCURSES_NO_PADDING code""... $ac_c" 1>&6 -echo "configure:3739: checking if you want \$NCURSES_NO_PADDING code" >&5 +echo "configure:3876: checking if you want \$NCURSES_NO_PADDING code" >&5 # Check whether --enable-no-padding or --disable-no-padding was given. if test "${enable_no_padding+set}" = set; then @@ -3753,7 +3890,7 @@ EOF ### use option --enable-sigwinch to turn on use of SIGWINCH logic echo $ac_n "checking if you want SIGWINCH handler""... $ac_c" 1>&6 -echo "configure:3757: checking if you want SIGWINCH handler" >&5 +echo "configure:3894: checking if you want SIGWINCH handler" >&5 # Check whether --enable-sigwinch or --disable-sigwinch was given. if test "${enable_sigwinch+set}" = set; then @@ -3771,7 +3908,7 @@ EOF ### use option --enable-tcap-names to allow user to define new capabilities echo $ac_n "checking if you want user-definable terminal capabilities like termcap""... $ac_c" 1>&6 -echo "configure:3775: checking if you want user-definable terminal capabilities like termcap" >&5 +echo "configure:3912: checking if you want user-definable terminal capabilities like termcap" >&5 # Check whether --enable-tcap-names or --disable-tcap-names was given. if test "${enable_tcap_names+set}" = set; then @@ -3790,7 +3927,7 @@ test "$with_tcap_names" = yes && NCURSES_XNAMES=1 # These options are relatively safe to experiment with. echo $ac_n "checking if you want all development code""... $ac_c" 1>&6 -echo "configure:3794: checking if you want all development code" >&5 +echo "configure:3931: checking if you want all development code" >&5 # Check whether --with-develop or --without-develop was given. if test "${with_develop+set}" = set; then @@ -3804,7 +3941,7 @@ echo "$ac_t""$with_develop" 1>&6 ### use option --enable-colorfgbg to turn on use of $COLORFGBG environment echo $ac_n "checking if you want colorfgbg code""... $ac_c" 1>&6 -echo "configure:3808: checking if you want colorfgbg code" >&5 +echo "configure:3945: checking if you want colorfgbg code" >&5 # Check whether --enable-hard-tabs or --disable-hard-tabs was given. if test "${enable_hard_tabs+set}" = set; then @@ -3822,7 +3959,7 @@ EOF ### use option --enable-hard-tabs to turn on use of hard-tabs optimize echo $ac_n "checking if you want hard-tabs code""... $ac_c" 1>&6 -echo "configure:3826: checking if you want hard-tabs code" >&5 +echo "configure:3963: checking if you want hard-tabs code" >&5 # Check whether --enable-hard-tabs or --disable-hard-tabs was given. if test "${enable_hard_tabs+set}" = set; then @@ -3839,7 +3976,7 @@ EOF echo $ac_n "checking if you want to use restrict environment when running as root""... $ac_c" 1>&6 -echo "configure:3843: checking if you want to use restrict environment when running as root" >&5 +echo "configure:3980: checking if you want to use restrict environment when running as root" >&5 # Check whether --enable-root-environ or --disable-root-environ was given. if test "${enable_root_environ+set}" = set; then @@ -3857,7 +3994,7 @@ EOF ### use option --enable-xmc-glitch to turn on use of magic-cookie optimize echo $ac_n "checking if you want limited support for xmc""... $ac_c" 1>&6 -echo "configure:3861: checking if you want limited support for xmc" >&5 +echo "configure:3998: checking if you want limited support for xmc" >&5 # Check whether --enable-xmc-glitch or --disable-xmc-glitch was given. if test "${enable_xmc_glitch+set}" = set; then @@ -3878,7 +4015,7 @@ EOF echo $ac_n "checking if you do not want to assume colors are white-on-black""... $ac_c" 1>&6 -echo "configure:3882: checking if you do not want to assume colors are white-on-black" >&5 +echo "configure:4019: checking if you do not want to assume colors are white-on-black" >&5 # Check whether --enable-assumed-color or --disable-assumed-color was given. if test "${enable_assumed_color+set}" = set; then @@ -3896,7 +4033,7 @@ EOF ### use option --enable-hashmap to turn on use of hashmap scrolling logic echo $ac_n "checking if you want hashmap scrolling-optimization code""... $ac_c" 1>&6 -echo "configure:3900: checking if you want hashmap scrolling-optimization code" >&5 +echo "configure:4037: checking if you want hashmap scrolling-optimization code" >&5 # Check whether --enable-hashmap or --disable-hashmap was given. if test "${enable_hashmap+set}" = set; then @@ -3913,7 +4050,7 @@ EOF echo $ac_n "checking if you want experimental safe-sprintf code""... $ac_c" 1>&6 -echo "configure:3917: checking if you want experimental safe-sprintf code" >&5 +echo "configure:4054: checking if you want experimental safe-sprintf code" >&5 # Check whether --enable-safe-sprintf or --disable-safe-sprintf was given. if test "${enable_safe_sprintf+set}" = set; then @@ -3933,7 +4070,7 @@ EOF # when hashmap is used scroll hints are useless if test "$with_hashmap" = no ; then echo $ac_n "checking if you want to experiment without scrolling-hints code""... $ac_c" 1>&6 -echo "configure:3937: checking if you want to experiment without scrolling-hints code" >&5 +echo "configure:4074: checking if you want to experiment without scrolling-hints code" >&5 # Check whether --enable-scroll-hints or --disable-scroll-hints was given. if test "${enable_scroll_hints+set}" = set; then @@ -3952,7 +4089,7 @@ fi ### use option --enable-widec to turn on use of wide-character support echo $ac_n "checking if you want experimental wide-character code""... $ac_c" 1>&6 -echo "configure:3956: checking if you want experimental wide-character code" >&5 +echo "configure:4093: checking if you want experimental wide-character code" >&5 # Check whether --enable-widec or --disable-widec was given. if test "${enable_widec+set}" = set; then @@ -3976,7 +4113,7 @@ fi ### use option --disable-echo to suppress full display compiling commands echo $ac_n "checking if you want to display full commands during build""... $ac_c" 1>&6 -echo "configure:3980: checking if you want to display full commands during build" >&5 +echo "configure:4117: checking if you want to display full commands during build" >&5 # Check whether --enable-echo or --disable-echo was given. if test "${enable_echo+set}" = set; then @@ -3990,13 +4127,14 @@ if test "$with_echo" = yes; then ECHO_LINK= else ECHO_LINK='@ echo linking $@ ... ;' + test -n "$LIBTOOL" && LIBTOOL="$LIBTOOL --silent" fi echo "$ac_t""$with_echo" 1>&6 ### use option --enable-warnings to turn on all gcc warnings echo $ac_n "checking if you want to see compiler warnings""... $ac_c" 1>&6 -echo "configure:4000: checking if you want to see compiler warnings" >&5 +echo "configure:4138: checking if you want to see compiler warnings" >&5 # Check whether --enable-warnings or --disable-warnings was given. if test "${enable_warnings+set}" = set; then @@ -4004,17 +4142,19 @@ if test "${enable_warnings+set}" = set; then with_warnings=$enableval fi +echo "$ac_t""$with_warnings" 1>&6 + if test -n "$with_warnings"; then ADAFLAGS="$ADAFLAGS -gnatg" if test "$GCC" = yes then - cat > conftest.$ac_ext <<EOF -#line 4014 "configure" + cat > conftest.$ac_ext <<EOF +#line 4154 "configure" int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; } EOF - echo "checking for $CC warning options" 1>&6 -echo "configure:4018: checking for $CC warning options" >&5 + echo "checking for $CC warning options" 1>&6 +echo "configure:4158: checking for $CC warning options" >&5 cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-W -Wall" cf_warn_CONST="" @@ -4032,7 +4172,7 @@ echo "configure:4018: checking for $CC warning options" >&5 Wstrict-prototypes $cf_warn_CONST do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo configure:4036: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:4176: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES" @@ -4044,7 +4184,6 @@ fi fi -echo "$ac_t""$with_warnings" 1>&6 if test "$GCC" = yes then @@ -4065,9 +4204,9 @@ EOF if test "$GCC" = yes then echo "checking for $CC __attribute__ directives" 1>&6 -echo "configure:4069: checking for $CC __attribute__ directives" >&5 - cat > conftest.$ac_ext <<EOF -#line 4071 "configure" +echo "configure:4208: checking for $CC __attribute__ directives" >&5 +cat > conftest.$ac_ext <<EOF +#line 4210 "configure" #include "confdefs.h" #include "conftest.h" #include "conftest.i" @@ -4086,7 +4225,7 @@ extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; extern void foo(void) GCC_NORETURN; int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; } EOF - for cf_attribute in scanf printf unused noreturn + for cf_attribute in scanf printf unused noreturn do CF_ATTRIBUTE=`echo "$cf_attribute" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` @@ -4105,7 +4244,7 @@ EOF EOF ;; esac - if { (eval echo configure:4109: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:4248: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then test -n "$verbose" && echo "$ac_t""... $cf_attribute" 1>&6 cat conftest.h >>confdefs.h # else @@ -4121,7 +4260,7 @@ fi ### use option --enable-assertions to turn on generation of assertion code echo $ac_n "checking if you want to enable runtime assertions""... $ac_c" 1>&6 -echo "configure:4125: checking if you want to enable runtime assertions" >&5 +echo "configure:4264: checking if you want to enable runtime assertions" >&5 # Check whether --enable-assertions or --disable-assertions was given. if test "${enable_assertions+set}" = set; then @@ -4188,12 +4327,12 @@ fi ### Checks for libraries. echo $ac_n "checking for gettimeofday""... $ac_c" 1>&6 -echo "configure:4192: checking for gettimeofday" >&5 +echo "configure:4331: checking for gettimeofday" >&5 if eval "test \"`echo '$''{'ac_cv_func_gettimeofday'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4197 "configure" +#line 4336 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gettimeofday(); below. */ @@ -4216,7 +4355,7 @@ gettimeofday(); ; return 0; } EOF -if { (eval echo configure:4220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gettimeofday=yes" else @@ -4239,7 +4378,7 @@ else echo $ac_n "checking for gettimeofday in -lbsd""... $ac_c" 1>&6 -echo "configure:4243: checking for gettimeofday in -lbsd" >&5 +echo "configure:4382: checking for gettimeofday in -lbsd" >&5 ac_lib_var=`echo bsd'_'gettimeofday | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4247,7 +4386,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lbsd $LIBS" cat > conftest.$ac_ext <<EOF -#line 4251 "configure" +#line 4390 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4258,7 +4397,7 @@ int main() { gettimeofday() ; return 0; } EOF -if { (eval echo configure:4262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4286,13 +4425,13 @@ fi echo $ac_n "checking if -lm needed for math functions""... $ac_c" 1>&6 -echo "configure:4290: checking if -lm needed for math functions" >&5 +echo "configure:4429: checking if -lm needed for math functions" >&5 if eval "test \"`echo '$''{'cf_cv_need_libm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4296 "configure" +#line 4435 "configure" #include "confdefs.h" #include <stdio.h> @@ -4302,7 +4441,7 @@ int main() { double x = rand(); printf("result = %g\n", sin(x)) ; return 0; } EOF -if { (eval echo configure:4306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_need_libm=no else @@ -4324,12 +4463,12 @@ fi ### Checks for header files. echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:4328: checking for ANSI C header files" >&5 +echo "configure:4467: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4333 "configure" +#line 4472 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -4337,7 +4476,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4341: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4480: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4354,7 +4493,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 4358 "configure" +#line 4497 "configure" #include "confdefs.h" #include <string.h> EOF @@ -4372,7 +4511,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 4376 "configure" +#line 4515 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -4393,7 +4532,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 4397 "configure" +#line 4536 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -4404,7 +4543,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:4408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -4432,12 +4571,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:4436: checking for $ac_hdr that defines DIR" >&5 +echo "configure:4575: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4441 "configure" +#line 4580 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -4445,7 +4584,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:4449: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4588: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -4470,7 +4609,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:4474: checking for opendir in -ldir" >&5 +echo "configure:4613: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4478,7 +4617,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 4482 "configure" +#line 4621 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4489,7 +4628,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4511,7 +4650,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:4515: checking for opendir in -lx" >&5 +echo "configure:4654: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4519,7 +4658,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 4523 "configure" +#line 4662 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4530,7 +4669,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4554,13 +4693,13 @@ fi echo $ac_n "checking for regular-expression headers""... $ac_c" 1>&6 -echo "configure:4558: checking for regular-expression headers" >&5 +echo "configure:4697: checking for regular-expression headers" >&5 if eval "test \"`echo '$''{'cf_cv_regex'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4564 "configure" +#line 4703 "configure" #include "confdefs.h" #include <sys/types.h> #include <regex.h> @@ -4573,7 +4712,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4577: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_regex="regex.h" else @@ -4582,7 +4721,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 4586 "configure" +#line 4725 "configure" #include "confdefs.h" #include <regexp.h> int main() { @@ -4592,7 +4731,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_regex="regexp.h" else @@ -4603,7 +4742,7 @@ else cf_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat > conftest.$ac_ext <<EOF -#line 4607 "configure" +#line 4746 "configure" #include "confdefs.h" #include <regexpr.h> int main() { @@ -4613,7 +4752,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_regex="regexpr.h" else @@ -4667,17 +4806,17 @@ unistd.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4671: checking for $ac_hdr" >&5 +echo "configure:4810: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4676 "configure" +#line 4815 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4681: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4820: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4708,7 +4847,7 @@ done # Note: even non-Posix ISC needs <sys/bsdtypes.h> to declare fd_set if test "$ISC" = yes ; then echo $ac_n "checking for main in -lcposix""... $ac_c" 1>&6 -echo "configure:4712: checking for main in -lcposix" >&5 +echo "configure:4851: checking for main in -lcposix" >&5 ac_lib_var=`echo cposix'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4716,14 +4855,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lcposix $LIBS" cat > conftest.$ac_ext <<EOF -#line 4720 "configure" +#line 4859 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:4727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4751,7 +4890,7 @@ else fi echo $ac_n "checking for bzero in -linet""... $ac_c" 1>&6 -echo "configure:4755: checking for bzero in -linet" >&5 +echo "configure:4894: checking for bzero in -linet" >&5 ac_lib_var=`echo inet'_'bzero | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4759,7 +4898,7 @@ else ac_save_LIBS="$LIBS" LIBS="-linet $LIBS" cat > conftest.$ac_ext <<EOF -#line 4763 "configure" +#line 4902 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4770,7 +4909,7 @@ int main() { bzero() ; return 0; } EOF -if { (eval echo configure:4774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4793,13 +4932,13 @@ fi echo $ac_n "checking if sys/time.h works with sys/select.h""... $ac_c" 1>&6 -echo "configure:4797: checking if sys/time.h works with sys/select.h" >&5 +echo "configure:4936: checking if sys/time.h works with sys/select.h" >&5 if eval "test \"`echo '$''{'cf_cv_sys_time_select'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4803 "configure" +#line 4942 "configure" #include "confdefs.h" #include <sys/types.h> @@ -4814,7 +4953,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4818: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4957: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_sys_time_select=yes else @@ -4843,12 +4982,12 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:4847: checking for working const" >&5 +echo "configure:4986: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4852 "configure" +#line 4991 "configure" #include "confdefs.h" int main() { @@ -4897,7 +5036,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:4901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5040: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -4918,21 +5057,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:4922: checking for inline" >&5 +echo "configure:5061: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 4929 "configure" +#line 5068 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:4936: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5075: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -4964,20 +5103,20 @@ EOF echo $ac_n "checking if unsigned literals are legal""... $ac_c" 1>&6 -echo "configure:4968: checking if unsigned literals are legal" >&5 +echo "configure:5107: checking if unsigned literals are legal" >&5 if eval "test \"`echo '$''{'cf_cv_unsigned_literals'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4974 "configure" +#line 5113 "configure" #include "confdefs.h" int main() { long x = 1L + 1UL + 1U + 1 ; return 0; } EOF -if { (eval echo configure:4981: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_unsigned_literals=yes else @@ -4995,7 +5134,7 @@ echo "$ac_t""$cf_cv_unsigned_literals" 1>&6 echo $ac_n "checking for type of chtype""... $ac_c" 1>&6 -echo "configure:4999: checking for type of chtype" >&5 +echo "configure:5138: checking for type of chtype" >&5 if eval "test \"`echo '$''{'cf_cv_typeof_chtype'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5004,7 +5143,7 @@ else cf_cv_typeof_chtype=long else cat > conftest.$ac_ext <<EOF -#line 5008 "configure" +#line 5147 "configure" #include "confdefs.h" #ifdef USE_WIDEC_SUPPORT @@ -5050,7 +5189,7 @@ int main() } EOF -if { (eval echo configure:5054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_typeof_chtype=`cat cf_test.out` else @@ -5083,7 +5222,7 @@ test "$cf_cv_typeof_chtype" = long && cf_cv_1UL="${cf_cv_1UL}L" echo $ac_n "checking for number of bits in chtype""... $ac_c" 1>&6 -echo "configure:5087: checking for number of bits in chtype" >&5 +echo "configure:5226: checking for number of bits in chtype" >&5 if eval "test \"`echo '$''{'cf_cv_shift_limit'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5092,7 +5231,7 @@ else cf_cv_shift_limit=32 else cat > conftest.$ac_ext <<EOF -#line 5096 "configure" +#line 5235 "configure" #include "confdefs.h" #include <stdio.h> @@ -5115,7 +5254,7 @@ int main() } EOF -if { (eval echo configure:5119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_shift_limit=`cat cf_test.out` else @@ -5135,7 +5274,7 @@ echo "$ac_t""$cf_cv_shift_limit" 1>&6 echo $ac_n "checking for width of character-index""... $ac_c" 1>&6 -echo "configure:5139: checking for width of character-index" >&5 +echo "configure:5278: checking for width of character-index" >&5 if eval "test \"`echo '$''{'cf_cv_widec_shift'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5162,13 +5301,13 @@ echo "$ac_t""$cf_cv_widec_shift" 1>&6 echo $ac_n "checking if external errno is declared""... $ac_c" 1>&6 -echo "configure:5166: checking if external errno is declared" >&5 +echo "configure:5305: checking if external errno is declared" >&5 if eval "test \"`echo '$''{'cf_cv_dcl_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5172 "configure" +#line 5311 "configure" #include "confdefs.h" #ifdef HAVE_STDLIB_H @@ -5181,7 +5320,7 @@ int main() { long x = (long) errno ; return 0; } EOF -if { (eval echo configure:5185: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval 'cf_cv_dcl_'errno'=yes' else @@ -5212,13 +5351,13 @@ fi # It's possible (for near-UNIX clones) that the data doesn't exist echo $ac_n "checking if external errno exists""... $ac_c" 1>&6 -echo "configure:5216: checking if external errno exists" >&5 +echo "configure:5355: checking if external errno exists" >&5 if eval "test \"`echo '$''{'cf_cv_have_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5222 "configure" +#line 5361 "configure" #include "confdefs.h" #undef errno @@ -5228,7 +5367,7 @@ int main() { errno = 2 ; return 0; } EOF -if { (eval echo configure:5232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval 'cf_cv_have_'errno'=yes' else @@ -5260,23 +5399,23 @@ fi echo $ac_n "checking if data-only library module links""... $ac_c" 1>&6 -echo "configure:5264: checking if data-only library module links" >&5 +echo "configure:5403: checking if data-only library module links" >&5 if eval "test \"`echo '$''{'cf_cv_link_dataonly'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest.a - cat >conftest.$ac_ext <<EOF -#line 5271 "configure" + cat >conftest.$ac_ext <<EOF +#line 5410 "configure" int testdata[3] = { 123, 456, 789 }; EOF - if { (eval echo configure:5274: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } ; then + if { (eval echo configure:5413: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } ; then mv conftest.o data.o && \ ( $AR $AR_OPTS conftest.a data.o ) 2>&5 1>/dev/null fi rm -f conftest.$ac_ext data.o - cat >conftest.$ac_ext <<EOF -#line 5280 "configure" + cat >conftest.$ac_ext <<EOF +#line 5419 "configure" int testfunc() { #if defined(NeXT) @@ -5289,7 +5428,7 @@ int testfunc() #endif } EOF - if { (eval echo configure:5293: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:5432: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then mv conftest.o func.o && \ ( $AR $AR_OPTS conftest.a func.o ) 2>&5 1>/dev/null fi @@ -5301,7 +5440,7 @@ EOF cf_cv_link_dataonly=unknown else cat > conftest.$ac_ext <<EOF -#line 5305 "configure" +#line 5444 "configure" #include "confdefs.h" int main() @@ -5311,7 +5450,7 @@ else } EOF -if { (eval echo configure:5315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_link_dataonly=yes else @@ -5362,12 +5501,12 @@ vsscanf \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5366: checking for $ac_func" >&5 +echo "configure:5505: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5371 "configure" +#line 5510 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5390,7 +5529,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5417,13 +5556,13 @@ done if test "$with_getcap" = "yes" ; then echo $ac_n "checking for terminal-capability database functions""... $ac_c" 1>&6 -echo "configure:5421: checking for terminal-capability database functions" >&5 +echo "configure:5560: checking for terminal-capability database functions" >&5 if eval "test \"`echo '$''{'cf_cv_cgetent'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5427 "configure" +#line 5566 "configure" #include "confdefs.h" #include <stdlib.h> @@ -5438,7 +5577,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_cgetent=yes else @@ -5461,20 +5600,20 @@ fi echo $ac_n "checking for isascii""... $ac_c" 1>&6 -echo "configure:5465: checking for isascii" >&5 +echo "configure:5604: checking for isascii" >&5 if eval "test \"`echo '$''{'cf_cv_have_isascii'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5471 "configure" +#line 5610 "configure" #include "confdefs.h" #include <ctype.h> int main() { int x = isascii(' ') ; return 0; } EOF -if { (eval echo configure:5478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_have_isascii=yes else @@ -5495,9 +5634,9 @@ EOF if test "$ac_cv_func_sigaction" = yes; then echo $ac_n "checking whether sigaction needs _POSIX_SOURCE""... $ac_c" 1>&6 -echo "configure:5499: checking whether sigaction needs _POSIX_SOURCE" >&5 +echo "configure:5638: checking whether sigaction needs _POSIX_SOURCE" >&5 cat > conftest.$ac_ext <<EOF -#line 5501 "configure" +#line 5640 "configure" #include "confdefs.h" #include <sys/types.h> @@ -5506,7 +5645,7 @@ int main() { struct sigaction act ; return 0; } EOF -if { (eval echo configure:5510: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5649: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* sigact_bad=no else @@ -5515,7 +5654,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 5519 "configure" +#line 5658 "configure" #include "confdefs.h" #define _POSIX_SOURCE @@ -5525,7 +5664,7 @@ int main() { struct sigaction act ; return 0; } EOF -if { (eval echo configure:5529: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5668: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* sigact_bad=yes cat >> confdefs.h <<\EOF @@ -5553,17 +5692,17 @@ unistd.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5557: checking for $ac_hdr" >&5 +echo "configure:5696: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5562 "configure" +#line 5701 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5567: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5706: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5594,17 +5733,17 @@ if test "$ISC" = yes ; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5598: checking for $ac_hdr" >&5 +echo "configure:5737: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5603 "configure" +#line 5742 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5608: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5632,23 +5771,23 @@ done fi if test "$ac_cv_header_termios_h" = yes ; then - case "$CFLAGS" in + case "$CFLAGS $CPPFLAGS" in *-D_POSIX_SOURCE*) termios_bad=dunno ;; *) termios_bad=maybe ;; esac if test "$termios_bad" = maybe ; then echo $ac_n "checking whether termios.h needs _POSIX_SOURCE""... $ac_c" 1>&6 -echo "configure:5643: checking whether termios.h needs _POSIX_SOURCE" >&5 +echo "configure:5782: checking whether termios.h needs _POSIX_SOURCE" >&5 cat > conftest.$ac_ext <<EOF -#line 5645 "configure" +#line 5784 "configure" #include "confdefs.h" #include <termios.h> int main() { struct termios foo; int x = foo.c_iflag ; return 0; } EOF -if { (eval echo configure:5652: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5791: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* termios_bad=no else @@ -5657,7 +5796,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 5661 "configure" +#line 5800 "configure" #include "confdefs.h" #define _POSIX_SOURCE @@ -5666,7 +5805,7 @@ int main() { struct termios foo; int x = foo.c_iflag ; return 0; } EOF -if { (eval echo configure:5670: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5809: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* termios_bad=unknown else @@ -5689,13 +5828,13 @@ fi echo $ac_n "checking for tcgetattr""... $ac_c" 1>&6 -echo "configure:5693: checking for tcgetattr" >&5 +echo "configure:5832: checking for tcgetattr" >&5 if eval "test \"`echo '$''{'cf_cv_have_tcgetattr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5699 "configure" +#line 5838 "configure" #include "confdefs.h" #include <sys/types.h> @@ -5718,7 +5857,7 @@ TTY foo; tcgetattr(1, &foo); ; return 0; } EOF -if { (eval echo configure:5722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_have_tcgetattr=yes else @@ -5741,7 +5880,7 @@ if test "$cross_compiling" = yes ; then echo "configure: warning: cross compiling: assume setvbuf params not reversed" 1>&2 else echo $ac_n "checking whether setvbuf arguments are reversed""... $ac_c" 1>&6 -echo "configure:5745: checking whether setvbuf arguments are reversed" >&5 +echo "configure:5884: checking whether setvbuf arguments are reversed" >&5 if eval "test \"`echo '$''{'ac_cv_func_setvbuf_reversed'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5749,7 +5888,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 5753 "configure" +#line 5892 "configure" #include "confdefs.h" #include <stdio.h> /* If setvbuf has the reversed format, exit 0. */ @@ -5763,7 +5902,7 @@ main () { exit(0); /* Non-reversed systems segv here. */ } EOF -if { (eval echo configure:5767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setvbuf_reversed=yes else @@ -5788,12 +5927,12 @@ fi fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:5792: checking return type of signal handlers" >&5 +echo "configure:5931: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5797 "configure" +#line 5936 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -5810,7 +5949,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:5814: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -5830,13 +5969,13 @@ EOF echo $ac_n "checking for type sigaction_t""... $ac_c" 1>&6 -echo "configure:5834: checking for type sigaction_t" >&5 +echo "configure:5973: checking for type sigaction_t" >&5 if eval "test \"`echo '$''{'cf_cv_type_sigaction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5840 "configure" +#line 5979 "configure" #include "confdefs.h" #include <signal.h> @@ -5844,7 +5983,7 @@ int main() { sigaction_t x ; return 0; } EOF -if { (eval echo configure:5848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5987: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_type_sigaction=yes else @@ -5865,21 +6004,21 @@ EOF echo $ac_n "checking declaration of size-change""... $ac_c" 1>&6 -echo "configure:5869: checking declaration of size-change" >&5 +echo "configure:6008: checking declaration of size-change" >&5 if eval "test \"`echo '$''{'cf_cv_sizechange'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_cv_sizechange=unknown - cf_save_CFLAGS="$CFLAGS" + cf_save_CPPFLAGS="$CPPFLAGS" for cf_opts in "" "NEED_PTEM_H" do - CFLAGS="$cf_save_CFLAGS" - test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts" + CPPFLAGS="$cf_save_CPPFLAGS" + test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts" cat > conftest.$ac_ext <<EOF -#line 5883 "configure" +#line 6022 "configure" #include "confdefs.h" #include <sys/types.h> #ifdef HAVE_TERMIOS_H @@ -5918,7 +6057,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5922: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6061: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_sizechange=yes else @@ -5929,7 +6068,7 @@ else fi rm -f conftest* - CFLAGS="$cf_save_CFLAGS" + CPPFLAGS="$cf_save_CPPFLAGS" if test "$cf_cv_sizechange" = yes ; then echo "size-change succeeded ($cf_opts)" >&5 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts" @@ -5957,12 +6096,12 @@ fi echo $ac_n "checking for memmove""... $ac_c" 1>&6 -echo "configure:5961: checking for memmove" >&5 +echo "configure:6100: checking for memmove" >&5 if eval "test \"`echo '$''{'ac_cv_func_memmove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5966 "configure" +#line 6105 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char memmove(); below. */ @@ -5985,7 +6124,7 @@ memmove(); ; return 0; } EOF -if { (eval echo configure:5989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_memmove=yes" else @@ -6004,12 +6143,12 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for bcopy""... $ac_c" 1>&6 -echo "configure:6008: checking for bcopy" >&5 +echo "configure:6147: checking for bcopy" >&5 if eval "test \"`echo '$''{'ac_cv_func_bcopy'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6013 "configure" +#line 6152 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char bcopy(); below. */ @@ -6032,7 +6171,7 @@ bcopy(); ; return 0; } EOF -if { (eval echo configure:6036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6175: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_bcopy=yes" else @@ -6048,7 +6187,7 @@ if eval "test \"`echo '$ac_cv_func_'bcopy`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking if bcopy does overlapping moves""... $ac_c" 1>&6 -echo "configure:6052: checking if bcopy does overlapping moves" >&5 +echo "configure:6191: checking if bcopy does overlapping moves" >&5 if eval "test \"`echo '$''{'cf_cv_good_bcopy'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6057,7 +6196,7 @@ else cf_cv_good_bcopy=unknown else cat > conftest.$ac_ext <<EOF -#line 6061 "configure" +#line 6200 "configure" #include "confdefs.h" int main() { @@ -6070,7 +6209,7 @@ int main() { } EOF -if { (eval echo configure:6074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_good_bcopy=yes else @@ -6108,7 +6247,7 @@ fi echo $ac_n "checking if poll really works""... $ac_c" 1>&6 -echo "configure:6112: checking if poll really works" >&5 +echo "configure:6251: checking if poll really works" >&5 if eval "test \"`echo '$''{'cf_cv_working_poll'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6117,7 +6256,7 @@ if test "$cross_compiling" = yes; then cf_cv_working_poll=unknown else cat > conftest.$ac_ext <<EOF -#line 6121 "configure" +#line 6260 "configure" #include "confdefs.h" #include <stdio.h> @@ -6137,7 +6276,7 @@ int main() { exit(ret != 0); } EOF -if { (eval echo configure:6141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_working_poll=yes else @@ -6165,13 +6304,13 @@ fi echo $ac_n "checking for builtin bool type""... $ac_c" 1>&6 -echo "configure:6169: checking for builtin bool type" >&5 +echo "configure:6308: checking for builtin bool type" >&5 if eval "test \"`echo '$''{'cf_cv_cc_bool_type'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6175 "configure" +#line 6314 "configure" #include "confdefs.h" #include <stdio.h> @@ -6181,7 +6320,7 @@ int main() { bool x = false ; return 0; } EOF -if { (eval echo configure:6185: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_cc_bool_type=1 else @@ -6218,7 +6357,7 @@ os2*) #(vi ;; esac echo $ac_n "checking for library $cf_stdcpp_libname""... $ac_c" 1>&6 -echo "configure:6222: checking for library $cf_stdcpp_libname" >&5 +echo "configure:6361: checking for library $cf_stdcpp_libname" >&5 if eval "test \"`echo '$''{'cf_cv_libstdcpp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6226,7 +6365,7 @@ else cf_save="$LIBS" LIBS="$LIBS -l$cf_stdcpp_libname" cat > conftest.$ac_ext <<EOF -#line 6230 "configure" +#line 6369 "configure" #include "confdefs.h" #include <strstream.h> @@ -6237,7 +6376,7 @@ strstreambuf foo(buf, sizeof(buf)) ; return 0; } EOF -if { (eval echo configure:6241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_libstdcpp=yes else @@ -6255,12 +6394,16 @@ echo "$ac_t""$cf_cv_libstdcpp" 1>&6 test "$cf_cv_libstdcpp" = yes && CXXLIBS="$CXXLIBS -l$cf_stdcpp_libname" fi + if test "$GXX" = yes; then + echo $ac_n "checking version of ${CXX-g++}""... $ac_c" 1>&6 +echo "configure:6401: checking version of ${CXX-g++}" >&5 + eval "${CXX-g++} --version" case "`${CXX-g++} --version`" in 1*|2.0-6*) cf_cxx_library=yes ;; - 2.7*) + *-2.7*|2.7*) cf_cxx_library=unknown case $cf_cv_system_name in #(vi @@ -6273,11 +6416,11 @@ os2*) #(vi esac if test "$ac_cv_prog_gxx" = yes; then echo $ac_n "checking for lib$cf_gpp_libname""... $ac_c" 1>&6 -echo "configure:6277: checking for lib$cf_gpp_libname" >&5 +echo "configure:6420: checking for lib$cf_gpp_libname" >&5 cf_save="$LIBS" LIBS="$LIBS -l$cf_gpp_libname" cat > conftest.$ac_ext <<EOF -#line 6281 "configure" +#line 6424 "configure" #include "confdefs.h" #include <$cf_gpp_libname/builtin.h> @@ -6286,7 +6429,7 @@ int main() { two_arg_error_handler_t foo2 = lib_error_handler ; return 0; } EOF -if { (eval echo configure:6290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cxx_library=yes CXXLIBS="$CXXLIBS -l$cf_gpp_libname" @@ -6306,7 +6449,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 6310 "configure" +#line 6453 "configure" #include "confdefs.h" #include <builtin.h> @@ -6315,7 +6458,7 @@ int main() { two_arg_error_handler_t foo2 = lib_error_handler ; return 0; } EOF -if { (eval echo configure:6319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cxx_library=yes CXXLIBS="$CXXLIBS -l$cf_gpp_libname" @@ -6344,8 +6487,9 @@ fi else cf_cxx_library=no fi + echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 -echo "configure:6349: checking how to run the C++ preprocessor" >&5 +echo "configure:6493: checking how to run the C++ preprocessor" >&5 if test -z "$CXXCPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6358,12 +6502,12 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross CXXCPP="${CXX-g++} -E" cat > conftest.$ac_ext <<EOF -#line 6362 "configure" +#line 6506 "configure" #include "confdefs.h" #include <stdlib.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6367: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6511: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -6391,17 +6535,17 @@ for ac_hdr in typeinfo do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6395: checking for $ac_hdr" >&5 +echo "configure:6539: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6400 "configure" +#line 6544 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6405: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6549: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6427,15 +6571,16 @@ else fi done + echo $ac_n "checking for builtin bool type""... $ac_c" 1>&6 -echo "configure:6433: checking for builtin bool type" >&5 +echo "configure:6578: checking for builtin bool type" >&5 if eval "test \"`echo '$''{'cf_cv_builtin_bool'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6439 "configure" +#line 6584 "configure" #include "confdefs.h" #include <stdio.h> @@ -6445,7 +6590,7 @@ int main() { bool x = false ; return 0; } EOF -if { (eval echo configure:6449: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6594: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_builtin_bool=1 else @@ -6465,7 +6610,7 @@ fi echo $ac_n "checking for size of bool""... $ac_c" 1>&6 -echo "configure:6469: checking for size of bool" >&5 +echo "configure:6614: checking for size of bool" >&5 if eval "test \"`echo '$''{'cf_cv_type_of_bool'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6475,7 +6620,7 @@ else cf_cv_type_of_bool=unknown else cat > conftest.$ac_ext <<EOF -#line 6479 "configure" +#line 6624 "configure" #include "confdefs.h" #ifdef __cplusplus extern "C" void exit(int); @@ -6507,7 +6652,7 @@ main() } EOF -if { (eval echo configure:6511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_type_of_bool=`cat cf_test.out` else @@ -6531,7 +6676,7 @@ fi echo $ac_n "checking for special defines needed for etip.h""... $ac_c" 1>&6 -echo "configure:6535: checking for special defines needed for etip.h" >&5 +echo "configure:6680: checking for special defines needed for etip.h" >&5 cf_save_CXXFLAGS="$CXXFLAGS" cf_result="none" for cf_math in "" MATH_H @@ -6542,7 +6687,7 @@ do test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}" test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}" cat > conftest.$ac_ext <<EOF -#line 6546 "configure" +#line 6691 "configure" #include "confdefs.h" #include <etip.h.in> @@ -6551,7 +6696,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6555: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6700: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* test -n "$cf_math" && cat >> confdefs.h <<EOF @@ -6576,13 +6721,14 @@ echo "$ac_t""$cf_result" 1>&6 CXXFLAGS="$cf_save_CXXFLAGS" -if test "$CXX" = yes ; then +if test -n "$CXX"; then echo $ac_n "checking if $CXX accepts parameter initialization""... $ac_c" 1>&6 -echo "configure:6582: checking if $CXX accepts parameter initialization" >&5 +echo "configure:6727: checking if $CXX accepts parameter initialization" >&5 if eval "test \"`echo '$''{'cf_cv_cpp_param_init'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else + ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CXXCPP $CPPFLAGS' @@ -6594,7 +6740,7 @@ cross_compiling=$ac_cv_prog_cxx_cross cf_cv_cpp_param_init=unknown else cat > conftest.$ac_ext <<EOF -#line 6598 "configure" +#line 6744 "configure" #include "confdefs.h" #ifdef __cplusplus extern "C" void exit(int); @@ -6615,7 +6761,7 @@ TEST::TEST(int x = 1) // some compilers do not like second initializer void main() { } EOF -if { (eval echo configure:6619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_cpp_param_init=yes else @@ -6627,6 +6773,13 @@ fi rm -fr conftest* fi + ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + fi @@ -6637,6 +6790,161 @@ test "$cf_cv_cpp_param_init" = yes && cat >> confdefs.h <<\EOF EOF + +if test -n "$CXX"; then + + +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +for ac_hdr in strstream.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:6809: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 6814 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:6819: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +echo $ac_n "checking if $CXX supports vscan function""... $ac_c" 1>&6 +echo "configure:6847: checking if $CXX supports vscan function" >&5 +if eval "test \"`echo '$''{'cf_cv_cpp_vscan_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + for cf_vscan_func in strstream stdio + do + case $cf_vscan_func in #(vi + stdio) cf_vscan_defs=USE_STDIO_VSCAN ;; #(vi + strstream) cf_vscan_defs=USE_STRSTREAM_VSCAN ;; + esac + cat > conftest.$ac_ext <<EOF +#line 6859 "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <stdarg.h> +#define $cf_vscan_defs 1 +#if defined(USE_STDIO_VSCAN) +#elif defined(HAVE_STRSTREAM_H) && defined(USE_STRSTREAM_VSCAN) +#include <strstream.h> +#endif + +int scanw(const char* fmt, ...) +{ + int result = -1; +#if defined(__GNUG__) + char buf[BUFSIZ]; + + va_list args; + va_start(args, fmt); +#if defined(USE_STDIO_VSCAN) + if (::vscanf(fmt, args) != -1) + result = 0; +#elif defined(USE_STRSTREAM_VSCAN) + strstreambuf ss(buf, sizeof(buf)); + if (ss.vscan(fmt, (_IO_va_list)args) != -1) + result = 0; +#else +#error case $cf_vscan_func failed +#endif + va_end(args); +#else +#error sorry, we only know about the GNU compiler case +#endif + return result; +} + +int main() { +int tmp, foo = scanw("%d", &tmp) +; return 0; } +EOF +if { (eval echo configure:6899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + cf_cv_cpp_vscan_func=$cf_vscan_func; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_cpp_vscan_func=no +fi +rm -f conftest* + test "$cf_cv_cpp_vscan_func" != no && break + done + +fi + +echo "$ac_t""$cf_cv_cpp_vscan_func" 1>&6 + +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +fi + +case $cf_cv_cpp_vscan_func in #(vi +stdio) #(vi + cat >> confdefs.h <<\EOF +#define CPP_HAS_VSCAN_FUNC 1 +EOF + + cat >> confdefs.h <<\EOF +#define USE_STDIO_VSCAN 1 +EOF + + ;; +strstream) + cat >> confdefs.h <<\EOF +#define CPP_HAS_VSCAN_FUNC 1 +EOF + + cat >> confdefs.h <<\EOF +#define USE_STRSTREAM_VSCAN 1 +EOF + + ;; +esac + + case $cf_cv_system_name in #(vi sco3.2v5*) CXXLDFLAGS="-u main" @@ -6657,7 +6965,7 @@ else # may change. echo $ac_n "checking for fallback type of bool""... $ac_c" 1>&6 -echo "configure:6661: checking for fallback type of bool" >&5 +echo "configure:6969: checking for fallback type of bool" >&5 case "$host_cpu" in #(vi i?86) cf_cv_type_of_bool=char ;; #(vi *) cf_cv_type_of_bool=int ;; @@ -6673,7 +6981,7 @@ cf_ada_make=gnatmake # Extract the first word of "$cf_ada_make", so it can be a program name with args. set dummy $cf_ada_make; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6677: checking for $ac_word" >&5 +echo "configure:6985: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gnat_exists'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6727,7 +7035,7 @@ esac # Extract the first word of "m4", so it can be a program name with args. set dummy m4; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6731: checking for $ac_word" >&5 +echo "configure:7039: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_M4_exists'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6760,7 +7068,7 @@ fi fi if test "$cf_cv_prog_gnat_correct" = yes; then echo $ac_n "checking if GNAT works""... $ac_c" 1>&6 -echo "configure:6764: checking if GNAT works" >&5 +echo "configure:7072: checking if GNAT works" >&5 rm -f conftest* cat >>conftest.ads <<CF_EOF @@ -6824,7 +7132,7 @@ fi case ".$withval" in #(vi ./*) #(vi ;; -.a-zA-Z:\\/*) #(vi OS/2 EMX +.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX ;; .\${*prefix}*) #(vi eval withval="$withval" @@ -6858,7 +7166,7 @@ fi case ".$withval" in #(vi ./*) #(vi ;; -.a-zA-Z:\\/*) #(vi OS/2 EMX +.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX ;; .\${*prefix}*) #(vi eval withval="$withval" @@ -6904,7 +7212,7 @@ fi ### Construct the library-subsets, if any, from this set of keywords: ### none, base, ext_funcs, termlib. echo $ac_n "checking for library subsets""... $ac_c" 1>&6 -echo "configure:6908: checking for library subsets" >&5 +echo "configure:7216: checking for library subsets" >&5 if test "$with_termlib" = yes ; then LIB_SUBSETS="termlib " else @@ -6915,12 +7223,15 @@ test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs" echo "$ac_t""$LIB_SUBSETS" 1>&6 LIB_TRACING=DEBUG -case "$CFLAGS" in +ADA_TRACE=FALSE +case "$CFLAGS $CPPFLAGS" in *-DTRACE*) LIB_TRACING=all + ADA_TRACE=TRUE ;; esac + ### Construct the list of include-directories to be generated CPPFLAGS="$CPPFLAGS -I. -I../include" @@ -6961,9 +7272,10 @@ fi ### Build up pieces for makefile rules echo $ac_n "checking default library suffix""... $ac_c" 1>&6 -echo "configure:6965: checking default library suffix" >&5 +echo "configure:7276: checking default library suffix" >&5 case $DFT_LWR_MODEL in + libtool) DFT_ARG_SUFFIX='' ;; normal) DFT_ARG_SUFFIX='' ;; debug) DFT_ARG_SUFFIX='_g' ;; profile) DFT_ARG_SUFFIX='_p' ;; @@ -6973,10 +7285,11 @@ echo "configure:6965: checking default library suffix" >&5 echo "$ac_t""$DFT_ARG_SUFFIX" 1>&6 echo $ac_n "checking default library-dependency suffix""... $ac_c" 1>&6 -echo "configure:6977: checking default library-dependency suffix" >&5 +echo "configure:7289: checking default library-dependency suffix" >&5 case $DFT_LWR_MODEL in + libtool) DFT_DEP_SUFFIX='.la' ;; normal) DFT_DEP_SUFFIX='.a' ;; debug) DFT_DEP_SUFFIX='_g.a' ;; profile) DFT_DEP_SUFFIX='_p.a' ;; @@ -6990,9 +7303,10 @@ echo "configure:6977: checking default library-dependency suffix" >&5 echo "$ac_t""$DFT_DEP_SUFFIX" 1>&6 echo $ac_n "checking default object directory""... $ac_c" 1>&6 -echo "configure:6994: checking default object directory" >&5 +echo "configure:7307: checking default object directory" >&5 case $DFT_LWR_MODEL in + libtool) DFT_OBJ_SUBDIR='obj_lo' ;; normal) DFT_OBJ_SUBDIR='objects' ;; debug) DFT_OBJ_SUBDIR='obj_g' ;; profile) DFT_OBJ_SUBDIR='obj_p' ;; @@ -7000,11 +7314,35 @@ echo "configure:6994: checking default object directory" >&5 esac echo "$ac_t""$DFT_OBJ_SUBDIR" 1>&6 +# libtool thinks it can make c++ shared libraries (perhaps only g++) +echo $ac_n "checking c++ library-dependency suffix""... $ac_c" 1>&6 +echo "configure:7320: checking c++ library-dependency suffix" >&5 +if test "$with_libtool" = "yes"; then + CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX +else + + + case normal in + libtool) CXX_LIB_SUFFIX='.la' ;; + normal) CXX_LIB_SUFFIX='.a' ;; + debug) CXX_LIB_SUFFIX='_g.a' ;; + profile) CXX_LIB_SUFFIX='_p.a' ;; + shared) + case $cf_cv_system_name in + hpux*) CXX_LIB_SUFFIX='.sl' ;; + *) CXX_LIB_SUFFIX='.so' ;; + esac + esac + test -n "$LIB_SUFFIX" && CXX_LIB_SUFFIX="${LIB_SUFFIX}${CXX_LIB_SUFFIX}" +fi +echo "$ac_t""$CXX_LIB_SUFFIX" 1>&6 + + TINFO_LIST="$SHLIB_LIST" test "$with_termlib" = yes && SHLIB_LIST="$SHLIB_LIST -ltinfo${LIB_SUFFIX}" echo $ac_n "checking where we will install curses.h""... $ac_c" 1>&6 -echo "configure:7008: checking where we will install curses.h" >&5 +echo "configure:7346: checking where we will install curses.h" >&5 test "$with_overwrite" = no && \ test "x$includedir" = 'x${prefix}/include' && \ includedir='$(prefix)/include/ncurses'${LIB_SUFFIX} @@ -7018,7 +7356,11 @@ echo "$ac_t""$includedir" 1>&6 ### could override this. if test "$with_termlib" = yes ; then TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_NAME}${DFT_DEP_SUFFIX}" - TEST_ARGS="-l${TINFO_NAME}${DFT_ARG_SUFFIX}" + if test "$DFT_LWR_MODEL" = "libtool"; then + TEST_ARGS="${TEST_DEPS}" + else + TEST_ARGS="-l${TINFO_NAME}${DFT_ARG_SUFFIX}" + fi fi PROG_DEPS="$TEST_DEPS" PROG_ARGS="$TEST_ARGS" @@ -7028,11 +7370,15 @@ PROG_ARGS="$TEST_ARGS" echo $ac_n "checking for src modules""... $ac_c" 1>&6 -echo "configure:7032: checking for src modules" >&5 +echo "configure:7374: checking for src modules" >&5 # dependencies and linker-arguments for test-programs TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS" -TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" +if test "$DFT_LWR_MODEL" = "libtool"; then + TEST_ARGS="${TEST_DEPS}" +else + TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" +fi # dependencies and linker-arguments for utility-programs PROG_ARGS="$TEST_ARGS" @@ -7075,7 +7421,11 @@ EOF EOF TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" - TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" + if test "$DFT_LWR_MODEL" = "libtool"; then + TEST_ARGS="${TEST_DEPS}" + else + TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" + fi fi fi done @@ -7121,6 +7471,7 @@ for cf_item in $cf_list_models do case $cf_item in + libtool) cf_subdir='obj_lo' ;; normal) cf_subdir='objects' ;; debug) cf_subdir='obj_g' ;; profile) cf_subdir='obj_p' ;; @@ -7136,6 +7487,11 @@ done +cat >> confdefs.h <<EOF +#define NCURSES_PATHSEP '$PATHSEP' +EOF + + ### Now that we're done running tests, add the compiler-warnings, if any CFLAGS="$CFLAGS $EXTRA_CFLAGS" @@ -7327,6 +7683,7 @@ s%@AR_OPTS@%$AR_OPTS%g s%@cf_cv_makeflags@%$cf_cv_makeflags%g s%@DESTDIR@%$DESTDIR%g s%@cf_list_models@%$cf_list_models%g +s%@LIBTOOL@%$LIBTOOL%g s%@DFT_LWR_MODEL@%$DFT_LWR_MODEL%g s%@DFT_UPR_MODEL@%$DFT_UPR_MODEL%g s%@TINFO_NAME@%$TINFO_NAME%g @@ -7347,8 +7704,10 @@ s%@LOCAL_LDFLAGS2@%$LOCAL_LDFLAGS2%g s%@INSTALL_LIB@%$INSTALL_LIB%g s%@TERMINFO_SRC@%$TERMINFO_SRC%g s%@FALLBACK_LIST@%$FALLBACK_LIST%g +s%@PATHSEP@%$PATHSEP%g s%@TERMINFO_DIRS@%$TERMINFO_DIRS%g s%@TERMINFO@%$TERMINFO%g +s%@NCURSES_OSPEED@%$NCURSES_OSPEED%g s%@NCURSES_CONST@%$NCURSES_CONST%g s%@NCURSES_XNAMES@%$NCURSES_XNAMES%g s%@ECHO_LINK@%$ECHO_LINK%g @@ -7371,10 +7730,12 @@ s%@cf_compile_generics@%$cf_compile_generics%g s%@cf_generic_objects@%$cf_generic_objects%g s%@ADA_INCLUDE@%$ADA_INCLUDE%g s%@ADA_OBJECTS@%$ADA_OBJECTS%g +s%@ADA_TRACE@%$ADA_TRACE%g s%@ACPPFLAGS@%$ACPPFLAGS%g s%@DFT_ARG_SUFFIX@%$DFT_ARG_SUFFIX%g s%@DFT_DEP_SUFFIX@%$DFT_DEP_SUFFIX%g s%@DFT_OBJ_SUBDIR@%$DFT_OBJ_SUBDIR%g +s%@CXX_LIB_SUFFIX@%$CXX_LIB_SUFFIX%g s%@EXTRA_LIBS@%$EXTRA_LIBS%g s%@TINFO_LIST@%$TINFO_LIST%g s%@SHLIB_LIST@%$SHLIB_LIST%g @@ -7611,6 +7972,7 @@ TERMINFO="$TERMINFO" TINFO_NAME="$TINFO_NAME" WITH_ECHO="$with_echo" WITH_OVERWRITE="$with_overwrite" +WITH_CURSES_H="$with_curses_h" cf_cv_abi_version="$cf_cv_abi_version" cf_cv_do_symlinks="$cf_cv_do_symlinks" cf_cv_rel_version="$cf_cv_rel_version" @@ -7628,7 +7990,8 @@ cat >> $CONFIG_STATUS <<\EOF case $cf_cv_system_name in - os2) LIB_PREFIX='' ;; + OS/2*) LIB_PREFIX='' ;; + os2*) LIB_PREFIX='' ;; *) LIB_PREFIX='lib' ;; esac cf_prefix=$LIB_PREFIX @@ -7645,6 +8008,7 @@ do case $cf_item in + libtool) cf_suffix='.la' ;; normal) cf_suffix='.a' ;; debug) cf_suffix='_g.a' ;; profile) cf_suffix='_p.a' ;; @@ -7695,6 +8059,7 @@ CF_ITEM=`echo "$cf_item" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQ case $cf_item in + libtool) cf_suffix='.la' ;; normal) cf_suffix='.a' ;; debug) cf_suffix='_g.a' ;; profile) cf_suffix='_p.a' ;; @@ -7708,6 +8073,7 @@ CF_ITEM=`echo "$cf_item" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQ case $cf_item in + libtool) cf_subdir='obj_lo' ;; normal) cf_subdir='objects' ;; debug) cf_subdir='obj_g' ;; profile) cf_subdir='obj_p' ;; @@ -7857,27 +8223,62 @@ done DST=\$1 REF=\$2 SRC=\$3 +TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$ +TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$ echo installing \$SRC in \$DST +CF_EOF +if test $WITH_CURSES_H = yes; then + cat >>headers.sh <<CF_EOF +case \$DST in +/*/include/*) + END=\`basename \$DST\` + for i in \`cat \$REF/../*/headers |fgrep -v "#"\` + do + NAME=\`basename \$i\` + echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED + done + ;; +*) + echo "" >> \$TMPSED + ;; +esac +CF_EOF +else + cat >>headers.sh <<CF_EOF case \$DST in /*/include/*) - TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$ - TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$ END=\`basename \$DST\` for i in \`cat \$REF/../*/headers |fgrep -v "#"\` do NAME=\`basename \$i\` + if test "\$NAME" = "curses.h" + then + echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED + NAME=ncurses.h + fi echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED done - rm -f \$TMPSRC - sed -f \$TMPSED \$SRC > \$TMPSRC - eval \$PRG \$TMPSRC \$DST/\`basename \$SRC\` - rm -f \$TMPSRC \$TMPSED ;; *) - eval \$PRG \$SRC \$DST + echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED ;; esac CF_EOF +fi +cat >>headers.sh <<CF_EOF +rm -f \$TMPSRC +sed -f \$TMPSED \$SRC > \$TMPSRC +NAME=\`basename \$SRC\` +CF_EOF +if test $WITH_CURSES_H != yes; then + cat >>headers.sh <<CF_EOF +test "\$NAME" = "curses.h" && NAME=ncurses.h +CF_EOF +fi +cat >>headers.sh <<CF_EOF +eval \$PRG \$TMPSRC \$DST/\$NAME +rm -f \$TMPSRC \$TMPSED +CF_EOF chmod 0755 headers.sh @@ -7902,7 +8303,7 @@ CF_EOF for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` do echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(DESTDIR)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile - test $i = curses.h && echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f ncurses.h && \$(LN_S) curses.h ncurses.h)" >>$cf_dir/Makefile + test $i = curses.h && test $WITH_CURSES_H = yes && echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f ncurses.h && \$(LN_S) curses.h ncurses.h)" >>$cf_dir/Makefile done cat >>$cf_dir/Makefile <<CF_EOF diff --git a/contrib/ncurses/configure.in b/contrib/ncurses/configure.in index aa1993b69ff3..62e9e829c2a7 100644 --- a/contrib/ncurses/configure.in +++ b/contrib/ncurses/configure.in @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * +dnl Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. * dnl * dnl Permission is hereby granted, free of charge, to any person obtaining a * dnl copy of this software and associated documentation files (the * @@ -28,14 +28,14 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 dnl -dnl $Id: configure.in,v 1.217 2000/10/08 01:02:43 tom Exp $ +dnl $Id: configure.in,v 1.233 2001/04/07 22:09:57 tom Exp $ dnl Process this file with autoconf to produce a configure script. dnl dnl See http://dickey.his.com/autoconf/ for additional information. dnl dnl --------------------------------------------------------------------------- AC_PREREQ(2.13.20000819) -AC_REVISION($Revision: 1.217 $) +AC_REVISION($Revision: 1.233 $) AC_INIT(ncurses/base/lib_initscr.c) AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin) @@ -61,19 +61,16 @@ AC_ARG_ENABLE(add-ons, dnl [glibc_add_on=yes], [glibc_add_on=]) -dnl We need to use [ and ] for other purposes for a while now. -changequote(,)dnl if test x"$glibc_add_on" = "xyes" ; then rm -f $srcdir/Banner # We are in glibc. rm -f $srcdir/Makefile cp $srcdir/Makefile.glibc $srcdir/Makefile - echo "ncurses `grep \"^[ ]*ncurses-version[ ]*=.*$\" \ + echo "ncurses `grep \"^[[ ]]*ncurses-version[[ ]]*=.*$\" \ $srcdir/Makefile | sed -e \ - 's/^[ ]*ncurses-version[ ]*=[ ]*\([^ ^ ]*\)[ ]*$/\1/'`" > $srcdir/Banner + 's/^[[ ]]*ncurses-version[[ ]]*=[[ ]]*\([[^ ^ ]]*\)[[ ]]*$/\1/'`" > $srcdir/Banner exit 0 fi -changequote([,])dnl ### Save the given $CFLAGS to allow user-override. cf_user_CFLAGS="$CFLAGS" @@ -129,17 +126,15 @@ else popdef([AC_MSG_ERROR])dnl fi -changequote(,)dnl if test "$GXX" = yes; then case "`${CXX-g++} --version`" in - 1*|2.[0-6]*) + 1*|2.[[0-6]]*) GXX=""; CXX=""; ac_cv_prog_gxx=no cf_cxx_library=no echo No: templates do not work ;; esac fi -changequote([,])dnl AC_MSG_CHECKING(if you want to build C++ binding and demo) AC_ARG_WITH(cxx-binding, @@ -162,6 +157,13 @@ AC_ARG_WITH(progs, [cf_with_progs=yes]) AC_MSG_RESULT($cf_with_progs) +AC_MSG_CHECKING(if you wish to install curses.h) +AC_ARG_WITH(curses-h, + [ --without-curses-h install curses.h as ncurses.h only], + [with_curses_h=$withval], + [with_curses_h=yes]) +AC_MSG_RESULT($with_curses_h) + modules_to_build="ncurses" if test "X$cf_with_progs" != Xno ; then modules_to_build="$modules_to_build progs tack" @@ -212,6 +214,20 @@ CF_HELP_MESSAGE(Options to Specify the Libraries Built/Used:) cf_list_models="" AC_SUBST(cf_list_models)dnl the complete list of models ("normal debug") +AC_MSG_CHECKING(if you want to build libraries with libtool) +AC_ARG_WITH(libtool, + [ --with-libtool generate libraries with libtool], + [with_libtool=$withval], + [with_libtool=no]) +AC_MSG_RESULT($with_libtool) +if test "$with_libtool" = "yes"; then + cf_list_models="$cf_list_models libtool" + test -z "$LIBTOOL" && LIBTOOL=libtool +else + LIBTOOL="" +fi +AC_SUBST(LIBTOOL) + AC_MSG_CHECKING(if you want to build shared libraries) AC_ARG_WITH(shared, [ --with-shared generate shared-libraries], @@ -248,6 +264,9 @@ test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile" AC_MSG_CHECKING(for specified models) test -z "$cf_list_models" && cf_list_models=normal +dnl If we use libtool to generate libraries, then it must be the only +dnl specified model. +test "$with_libtool" = "yes" && cf_list_models=libtool AC_MSG_RESULT($cf_list_models) ### Use the first model as the default, and save its suffix for use in building @@ -337,6 +356,7 @@ AC_SUBST(CXX_G_OPT) AC_MSG_CHECKING(for default loader flags) case $DFT_LWR_MODEL in +libtool) LD_MODEL='' ;; normal) LD_MODEL='' ;; debug) LD_MODEL=$CC_G_OPT ;; profile) LD_MODEL='-pg';; @@ -369,7 +389,7 @@ AC_MSG_CHECKING(if you wish to install ncurses overwriting curses) AC_ARG_ENABLE(overwrite, [ --disable-overwrite leave out the link to -lcurses], [with_overwrite=$enableval], - [with_overwrite=yes]) + [if test "$prefix" != "/usr/local" ; then with_overwrite=yes; else with_overwrite=no; fi]) AC_MSG_RESULT($with_overwrite) AC_MSG_CHECKING(if external terminfo-database is used) @@ -533,6 +553,15 @@ AC_ARG_ENABLE(broken_linker, AC_MSG_RESULT($with_broken_linker) test "$with_broken_linker" = yes && AC_DEFINE(BROKEN_LINKER) +### use option --with-ospeed to override ospeed's type +AC_MSG_CHECKING(for type of ospeed) +AC_ARG_WITH(ospeed, + [ --with-ospeed=TYPE override type of ospeed variable], + [NCURSES_OSPEED=$withval], + [NCURSES_OSPEED=short]) +AC_MSG_RESULT($NCURSES_OSPEED) +AC_SUBST(NCURSES_OSPEED) + ### use option --enable-bsdpad to have tputs process BSD-style prefix padding AC_MSG_CHECKING(if tputs should process BSD-style prefix padding) AC_ARG_ENABLE(bsdpad, @@ -725,6 +754,7 @@ if test "$with_echo" = yes; then ECHO_LINK= else ECHO_LINK='@ echo linking $@ ... ;' + test -n "$LIBTOOL" && LIBTOOL="$LIBTOOL --silent" fi AC_MSG_RESULT($with_echo) AC_SUBST(ECHO_LINK) @@ -734,11 +764,12 @@ AC_MSG_CHECKING(if you want to see compiler warnings) AC_ARG_ENABLE(warnings, [ --enable-warnings build: turn on GCC compiler warnings], [with_warnings=$enableval]) +AC_MSG_RESULT($with_warnings) + if test -n "$with_warnings"; then ADAFLAGS="$ADAFLAGS -gnatg" CF_GCC_WARNINGS fi -AC_MSG_RESULT($with_warnings) CF_GCC_ATTRIBUTES ### use option --enable-assertions to turn on generation of assertion code @@ -889,12 +920,15 @@ CF_BOOL_DECL(cf_cv_cc_bool_type) if test -n "$CXX" ; then AC_LANG_CPLUSPLUS CF_STDCPP_LIBRARY + if test "$GXX" = yes; then + AC_MSG_CHECKING(version of ${CXX-g++}) + eval "${CXX-g++} --version" case "`${CXX-g++} --version`" in 1*|2.[0-6]*) cf_cxx_library=yes ;; - 2.7*) + *-2.7*|2.7*) CF_GPP_LIBRARY ;; *) @@ -904,11 +938,15 @@ if test -n "$CXX" ; then else cf_cxx_library=no fi + AC_CHECK_HEADERS(typeinfo) + CF_BOOL_DECL CF_BOOL_SIZE CF_ETIP_DEFINES CF_CPP_PARAM_INIT + CF_CPP_VSCAN_FUNC + case $cf_cv_system_name in #(vi sco3.2v5*) CXXLDFLAGS="-u main" @@ -1032,11 +1070,14 @@ test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs" AC_MSG_RESULT($LIB_SUBSETS) LIB_TRACING=DEBUG -case "$CFLAGS" in +ADA_TRACE=FALSE +case "$CFLAGS $CPPFLAGS" in *-DTRACE*) LIB_TRACING=all + ADA_TRACE=TRUE ;; esac +AC_SUBST(ADA_TRACE) ### Construct the list of include-directories to be generated CF_INCLUDE_DIRS @@ -1058,6 +1099,16 @@ CF_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj") AC_MSG_RESULT($DFT_OBJ_SUBDIR) +# libtool thinks it can make c++ shared libraries (perhaps only g++) +AC_MSG_CHECKING(c++ library-dependency suffix) +if test "$with_libtool" = "yes"; then + CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX +else + CF_LIB_SUFFIX(normal,CXX_LIB_SUFFIX)dnl we normally make a static library +fi +AC_MSG_RESULT($CXX_LIB_SUFFIX) +AC_SUBST(CXX_LIB_SUFFIX) + TINFO_LIST="$SHLIB_LIST" test "$with_termlib" = yes && SHLIB_LIST="$SHLIB_LIST -ltinfo${LIB_SUFFIX}" @@ -1075,7 +1126,11 @@ AC_SUBST(SHLIB_LIST) ### could override this. if test "$with_termlib" = yes ; then TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_NAME}${DFT_DEP_SUFFIX}" - TEST_ARGS="-l${TINFO_NAME}${DFT_ARG_SUFFIX}" + if test "$DFT_LWR_MODEL" = "libtool"; then + TEST_ARGS="${TEST_DEPS}" + else + TEST_ARGS="-l${TINFO_NAME}${DFT_ARG_SUFFIX}" + fi fi PROG_DEPS="$TEST_DEPS" PROG_ARGS="$TEST_ARGS" @@ -1086,6 +1141,8 @@ PROG_ARGS="$TEST_ARGS" CF_SRC_MODULES($modules_to_build) CF_DIRS_TO_MAKE +AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATHSEP') + ### Now that we're done running tests, add the compiler-warnings, if any CFLAGS="$CFLAGS $EXTRA_CFLAGS" @@ -1116,6 +1173,7 @@ TERMINFO="$TERMINFO" TINFO_NAME="$TINFO_NAME" WITH_ECHO="$with_echo" WITH_OVERWRITE="$with_overwrite" +WITH_CURSES_H="$with_curses_h" cf_cv_abi_version="$cf_cv_abi_version" cf_cv_do_symlinks="$cf_cv_do_symlinks" cf_cv_rel_version="$cf_cv_rel_version" diff --git a/contrib/ncurses/dist.mk b/contrib/ncurses/dist.mk index 8d60a1742cc3..08cb199f0c21 100644 --- a/contrib/ncurses/dist.mk +++ b/contrib/ncurses/dist.mk @@ -1,4 +1,4 @@ -# $Id: dist.mk,v 1.224 2000/10/09 22:47:15 tom Exp $ +# $Id: dist.mk,v 1.247 2001/05/12 18:18:37 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -9,8 +9,8 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 5 -NCURSES_MINOR = 1 -NCURSES_PATCH = 20001009 +NCURSES_MINOR = 2 +NCURSES_PATCH = 20010512 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) @@ -49,8 +49,8 @@ doc/ncurses-intro.doc: doc/html/ncurses-intro.html doc/hackguide.doc: doc/html/hackguide.html $(DUMP2) doc/html/hackguide.html > $@ -# Note that this rule assumes the manpages were installed - it does not use -# the copies in the build tree except to get the list of names. +MANPROG = tbl | nroff -man + manhtml: MANIFEST @rm -f doc/html/man/*.html @mkdir -p doc/html/man @@ -70,7 +70,7 @@ manhtml: MANIFEST g=$${m}.html ;\ if [ -f doc/html/$$g ]; then chmod +w doc/html/$$g; fi;\ echo "Converting $$m to HTML" ;\ - man $$f | tr '\255' '-' | $(MAN2HTML) | \ + man/edit_man.sh editing /usr/man man $$f | $(MANPROG) | tr '\255' '-' | $(MAN2HTML) | \ sed -f subst.sed |\ sed -e 's/"curses.3x.html"/"ncurses.3x.html"/g' \ > doc/html/man/$$g ;\ diff --git a/contrib/ncurses/doc/hackguide.doc b/contrib/ncurses/doc/hackguide.doc new file mode 100644 index 000000000000..e9828d2919fa --- /dev/null +++ b/contrib/ncurses/doc/hackguide.doc @@ -0,0 +1,687 @@ + + A Hacker's Guide to NCURSES + + Contents + + * Abstract + * Objective of the Package + + Why System V Curses? + + How to Design Extensions + * Portability and Configuration + * Documentation Conventions + * How to Report Bugs + * A Tour of the Ncurses Library + + Library Overview + + The Engine Room + + Keyboard Input + + Mouse Events + + Output and Screen Updating + * The Forms and Menu Libraries + * A Tour of the Terminfo Compiler + + Translation of Non-use Capabilities + + Use Capability Resolution + + Source-Form Translation + * Other Utilities + * Style Tips for Developers + * Porting Hints + + Abstract + + This document is a hacker's tour of the ncurses library and utilities. + It discusses design philosophy, implementation methods, and the + conventions used for coding and documentation. It is recommended + reading for anyone who is interested in porting, extending or + improving the package. + + Objective of the Package + + The objective of the ncurses package is to provide a free software API + for character-cell terminals and terminal emulators with the following + characteristics: + * Source-compatible with historical curses implementations + (including the original BSD curses and System V curses. + * Conformant with the XSI Curses standard issued as part of XPG4 by + X/Open. + * High-quality -- stable and reliable code, wide portability, good + packaging, superior documentation. + * Featureful -- should eliminate as much of the drudgery of C + interface programming as possible, freeing programmers to think at + a higher level of design. + + These objectives are in priority order. So, for example, source + compatibility with older version must trump featurefulness -- we + cannot add features if it means breaking the portion of the API + corresponding to historical curses versions. + +Why System V Curses? + + We used System V curses as a model, reverse-engineering their API, in + order to fulfill the first two objectives. + + System V curses implementations can support BSD curses programs with + just a recompilation, so by capturing the System V API we also capture + BSD's. + + More importantly for the future, the XSI Curses standard issued by + X/Open is explicitly and closely modeled on System V. So conformance + with System V took us most of the way to base-level XSI conformance. + +How to Design Extensions + + The third objective (standards conformance) requires that it be easy + to condition source code using ncurses so that the absence of + nonstandard extensions does not break the code. + + Accordingly, we have a policy of associating with each nonstandard + extension a feature macro, so that ncurses client code can use this + macro to condition in or out the code that requires the ncurses + extension. + + For example, there is a macro NCURSES_MOUSE_VERSION which XSI Curses + does not define, but which is defined in the ncurses library header. + You can use this to condition the calls to the mouse API calls. + + Portability and Configuration + + Code written for ncurses may assume an ANSI-standard C compiler and + POSIX-compatible OS interface. It may also assume the presence of a + System-V-compatible select(2) call. + + We encourage (but do not require) developers to make the code friendly + to less-capable UNIX environments wherever possible. + + We encourage developers to support OS-specific optimizations and + methods not available under POSIX/ANSI, provided only that: + * All such code is properly conditioned so the build process does + not attempt to compile it under a plain ANSI/POSIX environment. + * Adding such implementation methods does not introduce + incompatibilities in the ncurses API between platforms. + + We use GNU autoconf(1) as a tool to deal with portability issues. The + right way to leverage an OS-specific feature is to modify the autoconf + specification files (configure.in and aclocal.m4) to set up a new + feature macro, which you then use to condition your code. + + Documentation Conventions + + There are three kinds of documentation associated with this package. + Each has a different preferred format: + * Package-internal files (README, INSTALL, TO-DO etc.) + * Manual pages. + * Everything else (i.e., narrative documentation). + + Our conventions are simple: + 1. Maintain package-internal files in plain text. The expected viewer + for them more(1) or an editor window; there's no point in + elaborate mark-up. + 2. Mark up manual pages in the man macros. These have to be viewable + through traditional man(1) programs. + 3. Write everything else in HTML. + + When in doubt, HTMLize a master and use lynx(1) to generate plain + ASCII (as we do for the announcement document). + + The reason for choosing HTML is that it's (a) well-adapted for on-line + browsing through viewers that are everywhere; (b) more easily readable + as plain text than most other mark-ups, if you don't have a viewer; + and (c) carries enough information that you can generate a + nice-looking printed version from it. Also, of course, it make + exporting things like the announcement document to WWW pretty trivial. + + How to Report Bugs + + The reporting address for bugs is bug-ncurses@gnu.org. This is a + majordomo list; to join, write to bug-ncurses-request@gnu.org with a + message containing the line: + subscribe <name>@<host.domain> + + The ncurses code is maintained by a small group of volunteers. While + we try our best to fix bugs promptly, we simply don't have a lot of + hours to spend on elementary hand-holding. We rely on intelligent + cooperation from our users. If you think you have found a bug in + ncurses, there are some steps you can take before contacting us that + will help get the bug fixed quickly. + + In order to use our bug-fixing time efficiently, we put people who + show us they've taken these steps at the head of our queue. This means + that if you don't, you'll probably end up at the tail end and have to + wait a while. + 1. Develop a recipe to reproduce the bug. + Bugs we can reproduce are likely to be fixed very quickly, often + within days. The most effective single thing you can do to get a + quick fix is develop a way we can duplicate the bad behavior -- + ideally, by giving us source for a small, portable test program + that breaks the library. (Even better is a keystroke recipe using + one of the test programs provided with the distribution.) + 2. Try to reproduce the bug on a different terminal type. + In our experience, most of the behaviors people report as library + bugs are actually due to subtle problems in terminal descriptions. + This is especially likely to be true if you're using a traditional + asynchronous terminal or PC-based terminal emulator, rather than + xterm or a UNIX console entry. + It's therefore extremely helpful if you can tell us whether or not + your problem reproduces on other terminal types. Usually you'll + have both a console type and xterm available; please tell us + whether or not your bug reproduces on both. + If you have xterm available, it is also good to collect xterm + reports for different window sizes. This is especially true if you + normally use an unusual xterm window size -- a surprising number + of the bugs we've seen are either triggered or masked by these. + 3. Generate and examine a trace file for the broken behavior. + Recompile your program with the debugging versions of the + libraries. Insert a trace() call with the argument set to + TRACE_UPDATE. (See "Writing Programs with NCURSES" for details on + trace levels.) Reproduce your bug, then look at the trace file to + see what the library was actually doing. + Another frequent cause of apparent bugs is application coding + errors that cause the wrong things to be put on the virtual + screen. Looking at the virtual-screen dumps in the trace file will + tell you immediately if this is happening, and save you from the + possible embarrassment of being told that the bug is in your code + and is your problem rather than ours. + If the virtual-screen dumps look correct but the bug persists, + it's possible to crank up the trace level to give more and more + information about the library's update actions and the control + sequences it issues to perform them. The test directory of the + distribution contains a tool for digesting these logs to make them + less tedious to wade through. + Often you'll find terminfo problems at this stage by noticing that + the escape sequences put out for various capabilities are wrong. + If not, you're likely to learn enough to be able to characterize + any bug in the screen-update logic quite exactly. + 4. Report details and symptoms, not just interpretations. + If you do the preceding two steps, it is very likely that you'll + discover the nature of the problem yourself and be able to send us + a fix. This will create happy feelings all around and earn you + good karma for the first time you run into a bug you really can't + characterize and fix yourself. + If you're still stuck, at least you'll know what to tell us. + Remember, we need details. If you guess about what is safe to + leave out, you are too likely to be wrong. + If your bug produces a bad update, include a trace file. Try to + make the trace at the least voluminous level that pins down the + bug. Logs that have been through tracemunch are OK, it doesn't + throw away any information (actually they're better than + un-munched ones because they're easier to read). + If your bug produces a core-dump, please include a symbolic stack + trace generated by gdb(1) or your local equivalent. + Tell us about every terminal on which you've reproduced the bug -- + and every terminal on which you can't. Ideally, sent us terminfo + sources for all of these (yours might differ from ours). + Include your ncurses version and your OS/machine type, of course! + You can find your ncurses version in the curses.h file. + + If your problem smells like a logic error or in cursor movement or + scrolling or a bad capability, there are a couple of tiny test frames + for the library algorithms in the progs directory that may help you + isolate it. These are not part of the normal build, but do have their + own make productions. + + The most important of these is mvcur, a test frame for the + cursor-movement optimization code. With this program, you can see + directly what control sequences will be emitted for any given cursor + movement or scroll/insert/delete operations. If you think you've got a + bad capability identified, you can disable it and test again. The + program is command-driven and has on-line help. + + If you think the vertical-scroll optimization is broken, or just want + to understand how it works better, build hashmap and read the header + comments of hardscroll.c and hashmap.c; then try it out. You can also + test the hardware-scrolling optimization separately with hardscroll. + + There's one other interactive tester, tctest, that exercises + translation between termcap and terminfo formats. If you have a + serious need to run this, you probably belong on our development team! + + A Tour of the Ncurses Library + +Library Overview + + Most of the library is superstructure -- fairly trivial convenience + interfaces to a small set of basic functions and data structures used + to manipulate the virtual screen (in particular, none of this code + does any I/O except through calls to more fundamental modules + described below). The files + + lib_addch.c lib_bkgd.c lib_box.c lib_chgat.c lib_clear.c + lib_clearok.c lib_clrbot.c lib_clreol.c lib_colorset.c lib_data.c + lib_delch.c lib_delwin.c lib_echo.c lib_erase.c lib_gen.c + lib_getstr.c lib_hline.c lib_immedok.c lib_inchstr.c lib_insch.c + lib_insdel.c lib_insstr.c lib_instr.c lib_isendwin.c lib_keyname.c + lib_leaveok.c lib_move.c lib_mvwin.c lib_overlay.c lib_pad.c + lib_printw.c lib_redrawln.c lib_scanw.c lib_screen.c lib_scroll.c + lib_scrollok.c lib_scrreg.c lib_set_term.c lib_slk.c + lib_slkatr_set.c lib_slkatrof.c lib_slkatron.c lib_slkatrset.c + lib_slkattr.c lib_slkclear.c lib_slkcolor.c lib_slkinit.c + lib_slklab.c lib_slkrefr.c lib_slkset.c lib_slktouch.c lib_touch.c + lib_unctrl.c lib_vline.c lib_wattroff.c lib_wattron.c lib_window.c + + are all in this category. They are very unlikely to need change, + barring bugs or some fundamental reorganization in the underlying data + structures. + + These files are used only for debugging support: + + lib_trace.c lib_traceatr.c lib_tracebits.c lib_tracechr.c + lib_tracedmp.c lib_tracemse.c trace_buf.c + + It is rather unlikely you will ever need to change these, unless you + want to introduce a new debug trace level for some reasoon. + + There is another group of files that do direct I/O via tputs(), + computations on the terminal capabilities, or queries to the OS + environment, but nevertheless have only fairly low complexity. These + include: + + lib_acs.c lib_beep.c lib_color.c lib_endwin.c lib_initscr.c + lib_longname.c lib_newterm.c lib_options.c lib_termcap.c lib_ti.c + lib_tparm.c lib_tputs.c lib_vidattr.c read_entry.c. + + They are likely to need revision only if ncurses is being ported to an + environment without an underlying terminfo capability representation. + + These files have serious hooks into the tty driver and signal + facilities: + + lib_kernel.c lib_baudrate.c lib_raw.c lib_tstp.c lib_twait.c + + If you run into porting snafus moving the package to another UNIX, the + problem is likely to be in one of these files. The file lib_print.c + uses sleep(2) and also falls in this category. + + Almost all of the real work is done in the files + + hardscroll.c hashmap.c lib_addch.c lib_doupdate.c lib_getch.c + lib_mouse.c lib_mvcur.c lib_refresh.c lib_setup.c lib_vidattr.c + + Most of the algorithmic complexity in the library lives in these + files. If there is a real bug in ncurses itself, it's probably here. + We'll tour some of these files in detail below (see The Engine Room). + + Finally, there is a group of files that is actually most of the + terminfo compiler. The reason this code lives in the ncurses library + is to support fallback to /etc/termcap. These files include + + alloc_entry.c captoinfo.c comp_captab.c comp_error.c comp_hash.c + comp_parse.c comp_scan.c parse_entry.c read_termcap.c write_entry.c + + We'll discuss these in the compiler tour. + +The Engine Room + + Keyboard Input + + All ncurses input funnels through the function wgetch(), defined in + lib_getch.c. This function is tricky; it has to poll for keyboard and + mouse events and do a running match of incoming input against the set + of defined special keys. + + The central data structure in this module is a FIFO queue, used to + match multiple-character input sequences against special-key + capabilities; also to implement pushback via ungetch(). + + The wgetch() code distinguishes between function key sequences and the + same sequences typed manually by doing a timed wait after each input + character that could lead a function key sequence. If the entire + sequence takes less than 1 second, it is assumed to have been + generated by a function key press. + + Hackers bruised by previous encounters with variant select(2) calls + may find the code in lib_twait.c interesting. It deals with the + problem that some BSD selects don't return a reliable time-left value. + The function timed_wait() effectively simulates a System V select. + + Mouse Events + + If the mouse interface is active, wgetch() polls for mouse events each + call, before it goes to the keyboard for input. It is up to + lib_mouse.c how the polling is accomplished; it may vary for different + devices. + + Under xterm, however, mouse event notifications come in via the + keyboard input stream. They are recognized by having the kmous + capability as a prefix. This is kind of klugey, but trying to wire in + recognition of a mouse key prefix without going through the + function-key machinery would be just too painful, and this turns out + to imply having the prefix somewhere in the function-key capabilities + at terminal-type initialization. + + This kluge only works because kmous isn't actually used by any + historic terminal type or curses implementation we know of. Best guess + is it's a relic of some forgotten experiment in-house at Bell Labs + that didn't leave any traces in the publicly-distributed System V + terminfo files. If System V or XPG4 ever gets serious about using it + again, this kluge may have to change. + + Here are some more details about mouse event handling: + + The lib_mouse()code is logically split into a lower level that accepts + event reports in a device-dependent format and an upper level that + parses mouse gestures and filters events. The mediating data structure + is a circular queue of event structures. + + Functionally, the lower level's job is to pick up primitive events and + put them on the circular queue. This can happen in one of two ways: + either (a) _nc_mouse_event() detects a series of incoming mouse + reports and queues them, or (b) code in lib_getch.c detects the kmous + prefix in the keyboard input stream and calls _nc_mouse_inline to + queue up a series of adjacent mouse reports. + + In either case, _nc_mouse_parse() should be called after the series is + accepted to parse the digested mouse reports (low-level events) into a + gesture (a high-level or composite event). + + Output and Screen Updating + + With the single exception of character echoes during a wgetnstr() call + (which simulates cooked-mode line editing in an ncurses window), the + library normally does all its output at refresh time. + + The main job is to go from the current state of the screen (as + represented in the curscr window structure) to the desired new state + (as represented in the newscr window structure), while doing as little + I/O as possible. + + The brains of this operation are the modules hashmap.c, hardscroll.c + and lib_doupdate.c; the latter two use lib_mvcur.c. Essentially, what + happens looks like this: + + The hashmap.c module tries to detect vertical motion changes between + the real and virtual screens. This information is represented by the + oldindex members in the newscr structure. These are modified by + vertical-motion and clear operations, and both are re-initialized + after each update. To this change-journalling information, the hashmap + code adds deductions made using a modified Heckel algorithm on hash + values generated from the line contents. + + The hardscroll.c module computes an optimum set of scroll, insertion, + and deletion operations to make the indices match. It calls + _nc_mvcur_scrolln() in lib_mvcur.c to do those motions. + + Then lib_doupdate.c goes to work. Its job is to do line-by-line + transformations of curscr lines to newscr lines. Its main tool is the + routine mvcur() in lib_mvcur.c. This routine does cursor-movement + optimization, attempting to get from given screen location A to given + location B in the fewest output characters posible. + + If you want to work on screen optimizations, you should use the fact + that (in the trace-enabled version of the library) enabling the + TRACE_TIMES trace level causes a report to be emitted after each + screen update giving the elapsed time and a count of characters + emitted during the update. You can use this to tell when an update + optimization improves efficiency. + + In the trace-enabled version of the library, it is also possible to + disable and re-enable various optimizations at runtime by tweaking the + variable _nc_optimize_enable. See the file include/curses.h.in for + mask values, near the end. + + The Forms and Menu Libraries + + The forms and menu libraries should work reliably in any environment + you can port ncurses to. The only portability issue anywhere in them + is what flavor of regular expressions the built-in form field type + TYPE_REGEXP will recognize. + + The configuration code prefers the POSIX regex facility, modeled on + System V's, but will settle for BSD regexps if the former isn't + available. + + Historical note: the panels code was written primarily to assist in + porting u386mon 2.0 (comp.sources.misc v14i001-4) to systems lacking + panels support; u386mon 2.10 and beyond use it. This version has been + slightly cleaned up for ncurses. + + A Tour of the Terminfo Compiler + + The ncurses implementation of tic is rather complex internally; it has + to do a trying combination of missions. This starts with the fact + that, in addition to its normal duty of compiling terminfo sources + into loadable terminfo binaries, it has to be able to handle termcap + syntax and compile that too into terminfo entries. + + The implementation therefore starts with a table-driven, dual-mode + lexical analyzer (in comp_scan.c). The lexer chooses its mode (termcap + or terminfo) based on the first `,' or `:' it finds in each entry. The + lexer does all the work of recognizing capability names and values; + the grammar above it is trivial, just "parse entries till you run out + of file". + +Translation of Non-use Capabilities + + Translation of most things besides use capabilities is pretty + straightforward. The lexical analyzer's tokenizer hands each + capability name to a hash function, which drives a table lookup. The + table entry yields an index which is used to look up the token type in + another table, and controls interpretation of the value. + + One possibly interesting aspect of the implementation is the way the + compiler tables are initialized. All the tables are generated by + various awk/sed/sh scripts from a master table include/Caps; these + scripts actually write C initializers which are linked to the + compiler. Furthermore, the hash table is generated in the same way, so + it doesn't have to be generated at compiler startup time (another + benefit of this organization is that the hash table can be in + shareable text space). + + Thus, adding a new capability is usually pretty trivial, just a matter + of adding one line to the include/Caps file. We'll have more to say + about this in the section on Source-Form Translation. + +Use Capability Resolution + + The background problem that makes tic tricky isn't the capability + translation itself, it's the resolution of use capabilities. Older + versions would not handle forward use references for this reason (that + is, a using terminal always had to follow its use target in the source + file). By doing this, they got away with a simple implementation + tactic; compile everything as it blows by, then resolve uses from + compiled entries. + + This won't do for ncurses. The problem is that that the whole + compilation process has to be embeddable in the ncurses library so + that it can be called by the startup code to translate termcap entries + on the fly. The embedded version can't go promiscuously writing + everything it translates out to disk -- for one thing, it will + typically be running with non-root permissions. + + So our tic is designed to parse an entire terminfo file into a + doubly-linked circular list of entry structures in-core, and then do + use resolution in-memory before writing everything out. This design + has other advantages: it makes forward and back use-references equally + easy (so we get the latter for free), and it makes checking for name + collisions before they're written out easy to do. + + And this is exactly how the embedded version works. But the + stand-alone user-accessible version of tic partly reverts to the + historical strategy; it writes to disk (not keeping in core) any entry + with no use references. + + This is strictly a core-economy kluge, implemented because the + terminfo master file is large enough that some core-poor systems swap + like crazy when you compile it all in memory...there have been reports + of this process taking three hours, rather than the twenty seconds or + less typical on the author's development box. + + So. The executable tic passes the entry-parser a hook that immediately + writes out the referenced entry if it has no use capabilities. The + compiler main loop refrains from adding the entry to the in-core list + when this hook fires. If some other entry later needs to reference an + entry that got written immediately, that's OK; the resolution code + will fetch it off disk when it can't find it in core. + + Name collisions will still be detected, just not as cleanly. The + write_entry() code complains before overwriting an entry that + postdates the time of tic's first call to write_entry(), Thus it will + complain about overwriting entries newly made during the tic run, but + not about overwriting ones that predate it. + +Source-Form Translation + + Another use of tic is to do source translation between various termcap + and terminfo formats. There are more variants out there than you might + think; the ones we know about are described in the captoinfo(1) manual + page. + + The translation output code (dump_entry() in ncurses/dump_entry.c) is + shared with the infocmp(1) utility. It takes the same internal + representation used to generate the binary form and dumps it to + standard output in a specified format. + + The include/Caps file has a header comment describing ways you can + specify source translations for nonstandard capabilities just by + altering the master table. It's possible to set up capability aliasing + or tell the compiler to plain ignore a given capability without + writing any C code at all. + + For circumstances where you need to do algorithmic translation, there + are functions in parse_entry.c called after the parse of each entry + that are specifically intended to encapsulate such translations. This, + for example, is where the AIX box1 capability get translated to an + acsc string. + + Other Utilities + + The infocmp utility is just a wrapper around the same entry-dumping + code used by tic for source translation. Perhaps the one interesting + aspect of the code is the use of a predicate function passed in to + dump_entry() to control which capabilities are dumped. This is + necessary in order to handle both the ordinary De-compilation case and + entry difference reporting. + + The tput and clear utilities just do an entry load followed by a + tputs() of a selected capability. + + Style Tips for Developers + + See the TO-DO file in the top-level directory of the source + distribution for additions that would be particularly useful. + + The prefix _nc_ should be used on library public functions that are + not part of the curses API in order to prevent pollution of the + application namespace. If you have to add to or modify the function + prototypes in curses.h.in, read ncurses/MKlib_gen.sh first so you can + avoid breaking XSI conformance. Please join the ncurses mailing list. + See the INSTALL file in the top level of the distribution for details + on the list. + + Look for the string FIXME in source files to tag minor bugs and + potential problems that could use fixing. + + Don't try to auto-detect OS features in the main body of the C code. + That's the job of the configuration system. + + To hold down complexity, do make your code data-driven. Especially, if + you can drive logic from a table filtered out of include/Caps, do it. + If you find you need to augment the data in that file in order to + generate the proper table, that's still preferable to ad-hoc code -- + that's why the fifth field (flags) is there. + + Have fun! + + Porting Hints + + The following notes are intended to be a first step towards DOS and + Macintosh ports of the ncurses libraries. + + The following library modules are `pure curses'; they operate only on + the curses internal structures, do all output through other curses + calls (not including tputs() and putp()) and do not call any other + UNIX routines such as signal(2) or the stdio library. Thus, they + should not need to be modified for single-terminal ports. + + lib_addch.c lib_addstr.c lib_bkgd.c lib_box.c lib_clear.c + lib_clrbot.c lib_clreol.c lib_delch.c lib_delwin.c lib_erase.c + lib_inchstr.c lib_insch.c lib_insdel.c lib_insstr.c lib_keyname.c + lib_move.c lib_mvwin.c lib_newwin.c lib_overlay.c lib_pad.c + lib_printw.c lib_refresh.c lib_scanw.c lib_scroll.c lib_scrreg.c + lib_set_term.c lib_touch.c lib_tparm.c lib_tputs.c lib_unctrl.c + lib_window.c panel.c + + This module is pure curses, but calls outstr(): + + lib_getstr.c + + These modules are pure curses, except that they use tputs() and + putp(): + + lib_beep.c lib_color.c lib_endwin.c lib_options.c lib_slk.c + lib_vidattr.c + + This modules assist in POSIX emulation on non-POSIX systems: + + sigaction.c + signal calls + + The following source files will not be needed for a + single-terminal-type port. + + alloc_entry.c captoinfo.c clear.c comp_captab.c comp_error.c + comp_hash.c comp_main.c comp_parse.c comp_scan.c dump_entry.c + infocmp.c parse_entry.c read_entry.c tput.c write_entry.c + + The following modules will use open()/read()/write()/close()/lseek() + on files, but no other OS calls. + + lib_screen.c + used to read/write screen dumps + + lib_trace.c + used to write trace data to the logfile + + Modules that would have to be modified for a port start here: + + The following modules are `pure curses' but contain assumptions + inappropriate for a memory-mapped port. + + lib_longname.c + assumes there may be multiple terminals + + lib_acs.c + assumes acs_map as a double indirection + + lib_mvcur.c + assumes cursor moves have variable cost + + lib_termcap.c + assumes there may be multiple terminals + + lib_ti.c + assumes there may be multiple terminals + + The following modules use UNIX-specific calls: + + lib_doupdate.c + input checking + + lib_getch.c + read() + + lib_initscr.c + getenv() + + lib_newterm.c + lib_baudrate.c + lib_kernel.c + various tty-manipulation and system calls + + lib_raw.c + various tty-manipulation calls + + lib_setup.c + various tty-manipulation calls + + lib_restart.c + various tty-manipulation calls + + lib_tstp.c + signal-manipulation calls + + lib_twait.c + gettimeofday(), select(). + _________________________________________________________________ + + + Eric S. Raymond <esr@snark.thyrsus.com> + + (Note: This is not the bug address!) diff --git a/contrib/ncurses/doc/html/announce.html b/contrib/ncurses/doc/html/announce.html index e7a79d6c899d..3005e49d5889 100644 --- a/contrib/ncurses/doc/html/announce.html +++ b/contrib/ncurses/doc/html/announce.html @@ -1,15 +1,15 @@ <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN"> <!-- - $Id: announce.html,v 1.38 2000/07/04 22:41:38 tom Exp $ + $Id: announce.html,v 1.39 2000/10/20 10:47:16 tom Exp $ --> <HTML> <HEAD> -<TITLE>Announcing ncurses 5.1</TITLE> +<TITLE>Announcing ncurses 5.2</TITLE> <link rev=made href="mailto:bug-ncurses@gnu.org"> </HEAD> <BODY> -<H1>Announcing ncurses 5.1</H1> +<H1>Announcing ncurses 5.2</H1> The ncurses (new curses) library is a free software emulation of curses in System V Release 4.0, and more. It uses terminfo format, @@ -38,136 +38,327 @@ the GNU distribution site <H1>Release Notes</H1> -This release is designed to be upward compatible from ncurses 5.0; very few -applications will require recompilation, depending on the platform. -These are the highlights from the change-log since ncurses 5.0 release. +This release is designed to be upward compatible from ncurses 5.0 and 5.1; +very few applications will require recompilation, depending on the platform. +These are the highlights from the change-log since ncurses 5.1 release. <p> Interface changes: <ul> - <li>made the extended terminal capabilities - (<code>configure --enable-tcap-names</code>) - a standard feature (though the configure script can disable it, - it is built by default). - - <li>removed the <code>trace()</code> function and related trace support - from the production library. This is the only interface change that - may cause problems with existing applications linked to shared - libraries, since not all platforms use the minor version number. - - <li>explicitly initialized to zero several data items which were - implicitly initialized, e.g., cur_term. If not explicitly - initialized, their storage type is C (common), and causes problems - linking on some platforms. - - <li>modified curses.h.in, undef'ing some symbols to avoid conflict with - C++ STL. + <li>change type of <code>ospeed</code> variable back to + <code>short</code> to match its use in legacy applications. It was + altered after ncurses 4.2 to <code>speed_t</code> to repair a type + mismatch which was introduced after 1.9.4 in 1995. The principal + users of termcap continued to use <code>short</code>, which is + not the same size. + <p> + <em>NOTE</em>: A few applications will have to be recompiled + (about 1% of the programs in a typical Linux distribution, + 10% of the programs that use ncurses). These are easy to + identify with <code>nm</code> or <code>strings</code>. + + <li>remove a private function <code>_nc_can_clear_with()</code>, which + was built with the configure --enable-expanded option but not used. + + <li>add several private functions (prefixed with "_nc_") for tracing + <code>chtype</code> values in the debug library, and for better + access and buffer limit checking. </ul> -New features: +New features and improvements: <ul> - <li>added a new extension, <code>assume_default_colors()</code> to - provide better control over the use of default colors. This is - the principal visible difference between ncurses 5.1 and preceding - versions. The new extension allows an application to specify what - colors pair 0 uses. - <p> - <em>NOTE</em>: Pair 0 defaults to white on black unless - you have invoked <code>use_default_colors()</code> or set it via - <code>assume_default_colors()</code>. An application that calls - <code>start_colors()</code> without setting the background color - will consistently have a black background no matter what color your - terminal's background actually is. - - <li>made several fixes to the terminfo-to-termcap conversion, and - have been using the generated termcaps without further hand-tuning. - This builds on the extension <code>use_extended_names()</code> by - adding "obsolete" termcap strings to terminfo.src + <li>rewrote <code>tgoto()</code> to make it better support existing + termcap applications which use hardcoded strings rather than obtain + all of their information from the termcap file. If the string does + not appear to be a terminfo string (i.e., does not refer to a "%p" + parameter, or terminfo-style padding), and termcap support is configured, <code>tgoto()</code> + will interpret it as termcap. Otherwise, as before, it will use + <code>tparm()</code>. + + <li>to ensure that the <code>tgoto()</code> changes work properly, + added checks to <code>tic</code> which report capabilities that do + not reference the expected number of parameters. + + <li>new configure script options: <ul> - <li>modified <code>tic</code> so that if extended names (i.e., - configure --enable-tcap-names) are active, then <code>tic -x</code> - will also write "obsolete" capabilities that are present in the - terminfo source. - - <li>added screen's AX capability (for ECMA SGR 39 and 49) to applicable - terminfo entries, use presence of this as a check for a small - improvement in setting default colors. - - <li>add -a option to tic and infocmp, which retains commented-out - capabilities during source translation/comparison, e.g., captoinfo - and infotocap. + <li>option <code>--disable-root-environ</code> adds runtime checks + which tell ncurses to disregard $TERMINFO and similar environment + variables if the current user is root, or running setuid/setgid. + + <li>option <code>--disable-assumed-color</code> allows you to use the + pre-5.1 convention of default colors used for color-pair 0 to be + configured (see assume_default_colors()). + + <li>implement configure script options that transform installed + program names, e.g., <code>--program-prefix</code>, including the + manpage names and cross references. + + <li>option <code>--with-database</code> allows you to specify a + different terminfo source-file to install. On OS/2 EMX, the + default is misc/emx.src, otherwise misc/terminfo.src + + <li>option <code>--with-default-terminfo-dir</code> allows you to + specify the default terminfo database directory. + + <li>option <code>--with-libtool</code> allows you to build with + <code>libtool</code>. <p> <em>NOTE</em>: <code>libtool</code> + uses a different notation for numbering shared library versions + from the existing ncurses configuration. + + <li>option <code>--with-manpage-tbl</code> causes the manpages to be + preprocessed by tbl(1) prior to installation, + + <li>option <code>--without-curses-h</code> causes the installation + process to install curses.h as ncurses.h and make appropriate + changes to headers and manpages. </ul> - <li>implemented limited support for UTF-8, useful with XFree86 xterm: + <li>modified configure script options: <ul> - <li>if the <code>configure --enable-widec</code> option is - given, append 'w' to names of the generated libraries (e.g., - libncursesw.so) to avoid conflict with existing ncurses libraries. - <li>add a simple UTF-8 output driver to the experimental - wide-character support. If any of the environment variables - LC_ALL, LC_CTYPE or LANG contain the string "UTF-8", this driver - will be used to translate the output to UTF-8. - <li>modified view.c to make a rudimentary viewer of UTF-8 text. + <li>change symbol used by the <code>--install-prefix</code> configure + option from <code>INSTALL_PREFIX</code> to <code>DESTDIR</code> + (the latter has become common usage although the name is + misleading). + + <li>modify <code>ld -rpath</code> options (e.g., Linux, and Solaris) + to use an absolute pathname for the build tree's lib directory, + avoiding confusion with directories relative to the current one + with the installed programs. + + <li>modified <code>misc/run_tic.in</code> to use + <code>tic -o</code>, to eliminate dependency on + <code>$TERMINFO</code> variable for installs. </ul> - <li>modify <code>raw()</code> and <code>noraw()</code> to clear/restore - IEXTEN flag which affects <code>stty lnext</code> on systems such as FreeBSD + <li>terminfo database: + <ul> + <li>updated xterm terminfo entries to match XFree86 xterm patch #146. - <li>reordered tests during mouse initialization to allow for gpm to run - in xterm, or for xterm to be used under OS/2 EMX. Also dropped test - for <code>$DISPLAY</code> in favor of the terminfo capability - <code>kmous=\E[M</code> or - if <code>$TERM</code> environment variable contains "xterm". + <li>added amiga-vnc, + Matrix Orbital, and + QNX qansi to misc/terminfo.src. - <li>added configure option <code>--with-manpage-symlinks</code>, which - provides for fully indexing manpage entries by making symbolic links - for the aliases. + <li>added os2 entry to misc/emx.src. - <li>changed <code>unctrl()</code> to render C1 characters (128-159) as - <code>~@</code>, <code>~A</code>, etc. + <li>add S0 and E0 extensions to <code>screen</code>'s terminfo entry + since otherwise the FreeBSD port makes it pass termcap equivalents + to <code>tgoto</code>, which would be misinterpreted by older + versions of ncurses. + </ul> + + <li>improvements to program usability: + <ul> + <li>modify programs to use <code>curses_version()</code> string to + report the version of ncurses with which they are compiled rather + than the NCURSES_VERSION string. The function returns the patch + level in addition to the major and minor version numbers. - <li>add experimental configure option --enable-colorfgbg to check for - $COLORTERM variable as set by rxvt/aterm/Eterm. + <li>modify <code>tput</code> program so it can be renamed or invoked via a link as + 'reset' or 'init', producing the same effect as <code>tput reset</code> or <code>tput init</code>. - <li>made the <code>infocmp -F</code> option less verbose. + <li>add error checking to infocmp's -v and -m options to ensure that + the option value is indeed a number. + </ul> - <li>dropped support for gnat 3.10 (gnat 3.12 is current). + <li>improved performance: + <ul> + <li>replace a lookup table in lib_vidattr.c used to decode + <code>no_color_video</code> with a logic expression which is faster. + </ul> </ul> Major bug fixes: <ul> - <li>modified infocmp -e, -E options to ensure that generated fallback.c - type for Booleans agrees with term.h + <li>correct <code>manlinks.sed</code> script introduced in ncurses 5.1 + to avoid using ERE "\+", which is not understood by standard versions + of <code>sed</code>. This happens to work with GNU <code>sed</code>, + but is not portable, and was the initial motivation for this release. + + <li>remove "hpux10.*" case from CF_SHARED_OPTS configure script macro. + This differed from the "hpux*" case by using reversed symbolic + links, which made the 5.1 version not match the configuration of + 5.0 shared libraries. + + <li>guard against corrupt terminfo data: + <ul> + <li>modify <code>tparm()</code> to disallow arithmetic on strings, + analyze the varargs list to read strings as strings and numbers as + numbers. + + <li>modify <code>tparm()</code>'s internal function + <code>spop()</code> to treat a null pointer as an empty string. + + <li>modify <code>parse_format()</code> in lib_tparm.c to ignore + precision if it is longer than 10000. + + <li>rewrote limit checks in lib_mvcur.c using new functions + <code>_nc_safe_strcat()</code>, etc. Made other related changes to + check lengths used for <code>strcat()</code> and + <code>strcpy()</code>. + </ul> + + <li>corrections to screen optimization: + <ul> + <li>added special case in lib_vidattr.c to reset underline and + standout for devices that have no sgr0 defined. + + <li>change handling of <code>non_dest_scroll_region</code> in + tty_update.c to clear text after it is shifted in rather than before + shifting out. Also correct row computation. + + <li>modify <code>rs2</code> capability in xterm-r6 and similar entries + where cursor save/restore bracketed the sequence for resetting video + attributes. The cursor restore would undo that. + </ul> + + <li>UTF-8 support: + <ul> + <li>when checking LC_ALL, LC_CTYPE, and LANG environment variables + for UTF-8 locale, ignore those which are set to an empty value, as + per SUSV2. - <li>documented a special case of incompatiblity between ncurses 4.2 and - 5.0, added a section for this in INSTALL. + <li>encode 0xFFFD in UTF-8 with 3 bytes, not 2. - <li>corrected tests for file-descriptors in OS/2 EMX mouse support. A - negative value could be used by FD_SET, causing the select() call to - wait indefinitely. + <li>modify <code>_nc_utf8_outch()</code> to avoid sign-extension when + checking for out-of-range value. + </ul> - <li>made 'tput flash' work properly for xterm by flushing output in - delay_output() when using napms(), and modifying xterm's terminfo to - specify no padding character. Otherwise, xterm's reported baud rate - could mislead ncurses into producing too few padding characters. + <li>other library fixes: + <ul> + <li>added checks for an empty <code>$HOME</code> environment + variable, to avoid retrieving terminfo descriptions from + <code>./.terminfo</code> . - <li>modified lib_addch.c to allow repeated update to the lower-right - corner, rather than displaying only the first character written until - the cursor is moved. Recent versions of SVr4 curses can update the - lower-right corner, and behave this way. + <li>change functions <code>_nc_parse_entry()</code> and + <code>postprocess_termcap()</code> to avoid using + <code>strtok()</code>, because it is non-reentrant. - <li>modified echo() behavior of getch() to match Solaris curses for - carriage return and backspace (reported by Neil Zanella). + <li>initialize <code>fds[]</code> array to 0's in + <code>_nc_timed_wait()</code>; apparently <code>poll()</code> only + sets the <code>revents</code> members of that array when there is + activity corresponding to the related file. - <li>corrected offsets used for subwindows in <code>wresize()</code> + <li>add a check for null pointer in <code>Make_Enum_Type()</code>. - <li>modified configure script so AC_MSG_ERROR is temporarily defined to - a warning in AC_PROG_CXX to make it recover from a missing C++ - compiler without requiring user to add --without-cxx option + <li>fix a heap problem with the c++ binding. - <li>corrected logic in lib_twait.c as used by lib_mouse.c for GPM mouse - support when poll() is used rather than select(). + <li>correct missing includes for <string.h> in several places, + including the C++ binding. This is not noted by gcc unless we use + the <code>-fno-builtin</code> option. + </ul> + + <li>several fixes for tic: + <ul> + <li>add a check for empty buffers returned by <code>fgets()</code> in + comp_scan.c <code>next_char()</code> function, in case + <code>tic</code> is run on a non-text file (fixes a core dump). + + <li>modify <code>tic</code> to verify that its inputs are really files, + in case someone tries to read a directory (or + <code>/dev/zero</code>). + + <li>correct an uninitialized parameter to <code>open_tempfile()</code> + in tic.c which made "tic -I" give an ambiguous error message about + <code>tmpnam</code>. + + <li>correct logic in <code>adjust_cancels()</code>, which did not check + both alternatives when reclassifying an extended name between + boolean, number and string, causing an infinite loop in + <code>tic</code>. + </ul> + + <li>using new checks in <code>tic</code> for parameter counts in + capability strings, found/fixed several errors both in the + terminfo database and in the include/Caps file. + <ul> + <li>modified several terminfo capability strings, including the + definitions for setaf, setab, in include/Caps to indicate that the + entries are parameterized. This information is used to tell which + strings are translated when converting to termcap. This fixes a + problem where the generated termcap would contain a spurious "%p1" + for the terminfo "%p1%d". + + <li>correct parameter counts in include/Caps for dclk as well as some + printer-specific capabilities: csnm, defc, scs, scsd, smgtp, smglp. + </ul> + + <li>various fixes for install scripts used to support configure + <code>--srcdir</code> and <code>--with-install-prefix</code>. + + <li>correct several mismatches between manpage filename and ".TH" + directives, renaming dft_fgbg.3x to default_colors.3x and + menu_attribs.3x to menu_attributes.3x. +</ul> + +Portability: +<ul> + <li>configure script: + <ul> + <li>newer config.guess, config.sub, including changes to support OS/2 + EMX. The configure script for OS/2 EMX still relies on a patch + since there is no (working) support for that platform in the main + autoconf distribution. + + <li>make configure script checks on variables <code>$GCC</code> and + <code>$GXX</code> consistently compare against 'yes' rather than + test if they are nonnull, since either may be set to the + corresponding name of the C or C++ compiler. + + <li>change configure script to use AC_CANONICAL_SYSTEM rather than + AC_CANONICAL_HOST, which means that <code>configure --target</code> + will set a default program-prefix. + + <li>modify the check for big-core to force a couple of memory + accesses, which may work as needed for older/less-capable machines + (if not, there's still the explicit configure option). + + <li>modify configure test for <code>tcgetattr()</code> to allow for + old implementations, e.g., on BeOS, which only defined it as a + macro. + + <li>add configure check for filesystems (such as OS/2 EMX) which do + not distinguish between upper/lowercase filenames, use this to fix + tags rules in makefiles. + + <li>add MKncurses_def.sh to generate fallback definitions for + ncurses_cfg.h, to quiet gcc -Wundef warnings, modified ifdef's in + code to consistently use "#if" rather than "#ifdef". + + <li>change most remaining unquoted parameters of <code>test</code> in + configure script to use quotes, for instance fixing a problem in the + <code>--disable-database</code> option. + + <li>modify scripts so that "make install.data" works on OS/2 EMX. + + <li>modify scripts and makefiles so the Ada95 directory builds on + OS/2 EMX. + </ul> + + <li>library: + <ul> + <li>replaced case-statement in <code>_nc_tracebits()</code> for CSIZE + with a table to simplify working around implementations that define + random combinations of the related macros to zero. + + <li>improved OS/2 mouse support by retrying as a 2-button mouse if code + fails to set up a 3-button mouse. + + <li>added private entrypoint <code>_nc_basename()</code>, used to + consolidate related code in progs, as well as accommodating OS/2 EMX + pathnames. + + <li>alter definition of NCURSES_CONST to make it non-empty. + + <li>redefine 'TEXT' in menu.h for AMIGA, since it is reported to have + an (unspecified) symbol conflict. + </ul> + + <li>programs: + <ul> + <li>modified progs/tset.c and tack/sysdep.c to build with sgttyb + interface if neither termio or termios is available. Tested this + with FreeBSD 2.1.5 (which does have termios - but the sgttyb does + work). + </ul> - <li>made several fixes for buffer overflows, unchecked recursion, - improvements in performance, etc. See the NEWS file for details. </ul> <H1>Features of Ncurses</H1> diff --git a/contrib/ncurses/doc/ncurses-intro.doc b/contrib/ncurses/doc/ncurses-intro.doc new file mode 100644 index 000000000000..669b0b391705 --- /dev/null +++ b/contrib/ncurses/doc/ncurses-intro.doc @@ -0,0 +1,2502 @@ + + Writing Programs with NCURSES + + by Eric S. Raymond and Zeyd M. Ben-Halim + updates since release 1.9.9e by Thomas Dickey + + Contents + + * Introduction + + A Brief History of Curses + + Scope of This Document + + Terminology + * The Curses Library + + An Overview of Curses + o Compiling Programs using Curses + o Updating the Screen + o Standard Windows and Function Naming Conventions + o Variables + + Using the Library + o Starting up + o Output + o Input + o Using Forms Characters + o Character Attributes and Color + o Mouse Interfacing + o Finishing Up + + Function Descriptions + o Initialization and Wrapup + o Causing Output to the Terminal + o Low-Level Capability Access + o Debugging + + Hints, Tips, and Tricks + o Some Notes of Caution + o Temporarily Leaving ncurses Mode + o Using ncurses under xterm + o Handling Multiple Terminal Screens + o Testing for Terminal Capabilities + o Tuning for Speed + o Special Features of ncurses + + Compatibility with Older Versions + o Refresh of Overlapping Windows + o Background Erase + + XSI Curses Conformance + * The Panels Library + + Compiling With the Panels Library + + Overview of Panels + + Panels, Input, and the Standard Screen + + Hiding Panels + + Miscellaneous Other Facilities + * The Menu Library + + Compiling with the menu Library + + Overview of Menus + + Selecting items + + Menu Display + + Menu Windows + + Processing Menu Input + + Miscellaneous Other Features + * The Forms Library + + Compiling with the forms Library + + Overview of Forms + + Creating and Freeing Fields and Forms + + Fetching and Changing Field Attributes + o Fetching Size and Location Data + o Changing the Field Location + o The Justification Attribute + o Field Display Attributes + o Field Option Bits + o Field Status + o Field User Pointer + + Variable-Sized Fields + + Field Validation + o TYPE_ALPHA + o TYPE_ALNUM + o TYPE_ENUM + o TYPE_INTEGER + o TYPE_NUMERIC + o TYPE_REGEXP + + Direct Field Buffer Manipulation + + Attributes of Forms + + Control of Form Display + + Input Processing in the Forms Driver + o Page Navigation Requests + o Inter-Field Navigation Requests + o Intra-Field Navigation Requests + o Scrolling Requests + o Field Editing Requests + o Order Requests + o Application Commands + + Field Change Hooks + + Field Change Commands + + Form Options + + Custom Validation Types + o Union Types + o New Field Types + o Validation Function Arguments + o Order Functions For Custom Types + o Avoiding Problems + _________________________________________________________________ + + Introduction + + This document is an introduction to programming with curses. It is not + an exhaustive reference for the curses Application Programming + Interface (API); that role is filled by the curses manual pages. + Rather, it is intended to help C programmers ease into using the + package. + + This document is aimed at C applications programmers not yet + specifically familiar with ncurses. If you are already an experienced + curses programmer, you should nevertheless read the sections on Mouse + Interfacing, Debugging, Compatibility with Older Versions, and Hints, + Tips, and Tricks. These will bring you up to speed on the special + features and quirks of the ncurses implementation. If you are not so + experienced, keep reading. + + The curses package is a subroutine library for terminal-independent + screen-painting and input-event handling which presents a high level + screen model to the programmer, hiding differences between terminal + types and doing automatic optimization of output to change one screen + full of text into another. Curses uses terminfo, which is a database + format that can describe the capabilities of thousands of different + terminals. + + The curses API may seem something of an archaism on UNIX desktops + increasingly dominated by X, Motif, and Tcl/Tk. Nevertheless, UNIX + still supports tty lines and X supports xterm(1); the curses API has + the advantage of (a) back-portability to character-cell terminals, and + (b) simplicity. For an application that does not require bit-mapped + graphics and multiple fonts, an interface implementation using curses + will typically be a great deal simpler and less expensive than one + using an X toolkit. + +A Brief History of Curses + + Historically, the first ancestor of curses was the routines written to + provide screen-handling for the game rogue; these used the + already-existing termcap database facility for describing terminal + capabilities. These routines were abstracted into a documented library + and first released with the early BSD UNIX versions. + + System III UNIX from Bell Labs featured a rewritten and much-improved + curses library. It introduced the terminfo format. Terminfo is based + on Berkeley's termcap database, but contains a number of improvements + and extensions. Parameterized capabilities strings were introduced, + making it possible to describe multiple video attributes, and colors + and to handle far more unusual terminals than possible with termcap. + In the later AT&T System V releases, curses evolved to use more + facilities and offer more capabilities, going far beyond BSD curses in + power and flexibility. + +Scope of This Document + + This document describes ncurses, a free implementation of the System V + curses API with some clearly marked extensions. It includes the + following System V curses features: + * Support for multiple screen highlights (BSD curses could only + handle one `standout' highlight, usually reverse-video). + * Support for line- and box-drawing using forms characters. + * Recognition of function keys on input. + * Color support. + * Support for pads (windows of larger than screen size on which the + screen or a subwindow defines a viewport). + + Also, this package makes use of the insert and delete line and + character features of terminals so equipped, and determines how to + optimally use these features with no help from the programmer. It + allows arbitrary combinations of video attributes to be displayed, + even on terminals that leave ``magic cookies'' on the screen to mark + changes in attributes. + + The ncurses package can also capture and use event reports from a + mouse in some environments (notably, xterm under the X window system). + This document includes tips for using the mouse. + + The ncurses package was originated by Pavel Curtis. The original + maintainer of this package is Zeyd Ben-Halim <zmbenhal@netcom.com>. + Eric S. Raymond <esr@snark.thyrsus.com> wrote many of the new features + in versions after 1.8.1 and wrote most of this introduction. Jürgen + Pfeifer wrote all of the menu and forms code as well as the Ada95 + binding. Ongoing work is being done by Thomas Dickey and Jürgen + Pfeifer. Florian La Roche acts as the maintainer for the Free Software + Foundation, which holds the copyright on ncurses. Contact the current + maintainers at bug-ncurses@gnu.org. + + This document also describes the panels extension library, similarly + modeled on the SVr4 panels facility. This library allows you to + associate backing store with each of a stack or deck of overlapping + windows, and provides operations for moving windows around in the + stack that change their visibility in the natural way (handling window + overlaps). + + Finally, this document describes in detail the menus and forms + extension libraries, also cloned from System V, which support easy + construction and sequences of menus and fill-in forms. + +Terminology + + In this document, the following terminology is used with reasonable + consistency: + + window + A data structure describing a sub-rectangle of the screen + (possibly the entire screen). You can write to a window as + though it were a miniature screen, scrolling independently of + other windows on the physical screen. + + screens + A subset of windows which are as large as the terminal screen, + i.e., they start at the upper left hand corner and encompass + the lower right hand corner. One of these, stdscr, is + automatically provided for the programmer. + + terminal screen + The package's idea of what the terminal display currently looks + like, i.e., what the user sees now. This is a special screen. + + The Curses Library + +An Overview of Curses + + Compiling Programs using Curses + + In order to use the library, it is necessary to have certain types and + variables defined. Therefore, the programmer must have a line: + #include <curses.h> + + at the top of the program source. The screen package uses the Standard + I/O library, so <curses.h> includes <stdio.h>. <curses.h> also + includes <termios.h>, <termio.h>, or <sgtty.h> depending on your + system. It is redundant (but harmless) for the programmer to do these + includes, too. In linking with curses you need to have -lncurses in + your LDFLAGS or on the command line. There is no need for any other + libraries. + + Updating the Screen + + In order to update the screen optimally, it is necessary for the + routines to know what the screen currently looks like and what the + programmer wants it to look like next. For this purpose, a data type + (structure) named WINDOW is defined which describes a window image to + the routines, including its starting position on the screen (the (y, + x) coordinates of the upper left hand corner) and its size. One of + these (called curscr, for current screen) is a screen image of what + the terminal currently looks like. Another screen (called stdscr, for + standard screen) is provided by default to make changes on. + + A window is a purely internal representation. It is used to build and + store a potential image of a portion of the terminal. It doesn't bear + any necessary relation to what is really on the terminal screen; it's + more like a scratchpad or write buffer. + + To make the section of physical screen corresponding to a window + reflect the contents of the window structure, the routine refresh() + (or wrefresh() if the window is not stdscr) is called. + + A given physical screen section may be within the scope of any number + of overlapping windows. Also, changes can be made to windows in any + order, without regard to motion efficiency. Then, at will, the + programmer can effectively say ``make it look like this,'' and let the + package implementation determine the most efficient way to repaint the + screen. + + Standard Windows and Function Naming Conventions + + As hinted above, the routines can use several windows, but two are + automatically given: curscr, which knows what the terminal looks like, + and stdscr, which is what the programmer wants the terminal to look + like next. The user should never actually access curscr directly. + Changes should be made to through the API, and then the routine + refresh() (or wrefresh()) called. + + Many functions are defined to use stdscr as a default screen. For + example, to add a character to stdscr, one calls addch() with the + desired character as argument. To write to a different window. use the + routine waddch() (for `w'indow-specific addch()) is provided. This + convention of prepending function names with a `w' when they are to be + applied to specific windows is consistent. The only routines which do + not follow it are those for which a window must always be specified. + + In order to move the current (y, x) coordinates from one point to + another, the routines move() and wmove() are provided. However, it is + often desirable to first move and then perform some I/O operation. In + order to avoid clumsiness, most I/O routines can be preceded by the + prefix 'mv' and the desired (y, x) coordinates prepended to the + arguments to the function. For example, the calls + move(y, x); + addch(ch); + + can be replaced by + mvaddch(y, x, ch); + + and + wmove(win, y, x); + waddch(win, ch); + + can be replaced by + mvwaddch(win, y, x, ch); + + Note that the window description pointer (win) comes before the added + (y, x) coordinates. If a function requires a window pointer, it is + always the first parameter passed. + + Variables + + The curses library sets some variables describing the terminal + capabilities. + type name description + ------------------------------------------------------------------ + int LINES number of lines on the terminal + int COLS number of columns on the terminal + + The curses.h also introduces some #define constants and types of + general usefulness: + + bool + boolean type, actually a `char' (e.g., bool doneit;) + + TRUE + boolean `true' flag (1). + + FALSE + boolean `false' flag (0). + + ERR + error flag returned by routines on a failure (-1). + + OK + error flag returned by routines when things go right. + +Using the Library + + Now we describe how to actually use the screen package. In it, we + assume all updating, reading, etc. is applied to stdscr. These + instructions will work on any window, providing you change the + function names and parameters as mentioned above. + + Here is a sample program to motivate the discussion: +#include <curses.h> +#include <signal.h> + +static void finish(int sig); + +int +main(int argc, char *argv[]) +{ + int num = 0; + + /* initialize your non-curses data structures here */ + + (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ + + (void) initscr(); /* initialize the curses library */ + keypad(stdscr, TRUE); /* enable keyboard mapping */ + (void) nonl(); /* tell curses not to do NL->CR/NL on output */ + (void) cbreak(); /* take input chars one at a time, no wait for \n */ + (void) echo(); /* echo input - in color */ + + if (has_colors()) + { + start_color(); + + /* + * Simple color assignment, often all we need. Color pair 0 cannot + * be redefined. This example uses the same value for the color + * pair as for the foreground color, though of course that is not + * necessary: + */ + init_pair(1, COLOR_RED, COLOR_BLACK); + init_pair(2, COLOR_GREEN, COLOR_BLACK); + init_pair(3, COLOR_YELLOW, COLOR_BLACK); + init_pair(4, COLOR_BLUE, COLOR_BLACK); + init_pair(5, COLOR_CYAN, COLOR_BLACK); + init_pair(6, COLOR_MAGENTA, COLOR_BLACK); + init_pair(7, COLOR_WHITE, COLOR_BLACK); + } + + for (;;) + { + int c = getch(); /* refresh, accept single keystroke of input */ + attrset(COLOR_PAIR(num % 8)); + num++; + + /* process the command keystroke */ + } + + finish(0); /* we're done */ +} + +static void finish(int sig) +{ + endwin(); + + /* do your non-curses wrapup here */ + + exit(0); +} + + Starting up + + In order to use the screen package, the routines must know about + terminal characteristics, and the space for curscr and stdscr must be + allocated. These function initscr() does both these things. Since it + must allocate space for the windows, it can overflow memory when + attempting to do so. On the rare occasions this happens, initscr() + will terminate the program with an error message. initscr() must + always be called before any of the routines which affect windows are + used. If it is not, the program will core dump as soon as either + curscr or stdscr are referenced. However, it is usually best to wait + to call it until after you are sure you will need it, like after + checking for startup errors. Terminal status changing routines like + nl() and cbreak() should be called after initscr(). + + Once the screen windows have been allocated, you can set them up for + your program. If you want to, say, allow a screen to scroll, use + scrollok(). If you want the cursor to be left in place after the last + change, use leaveok(). If this isn't done, refresh() will move the + cursor to the window's current (y, x) coordinates after updating it. + + You can create new windows of your own using the functions newwin(), + derwin(), and subwin(). The routine delwin() will allow you to get rid + of old windows. All the options described above can be applied to any + window. + + Output + + Now that we have set things up, we will want to actually update the + terminal. The basic functions used to change what will go on a window + are addch() and move(). addch() adds a character at the current (y, x) + coordinates. move() changes the current (y, x) coordinates to whatever + you want them to be. It returns ERR if you try to move off the window. + As mentioned above, you can combine the two into mvaddch() to do both + things at once. + + The other output functions, such as addstr() and printw(), all call + addch() to add characters to the window. + + After you have put on the window what you want there, when you want + the portion of the terminal covered by the window to be made to look + like it, you must call refresh(). In order to optimize finding + changes, refresh() assumes that any part of the window not changed + since the last refresh() of that window has not been changed on the + terminal, i.e., that you have not refreshed a portion of the terminal + with an overlapping window. If this is not the case, the routine + touchwin() is provided to make it look like the entire window has been + changed, thus making refresh() check the whole subsection of the + terminal for changes. + + If you call wrefresh() with curscr as its argument, it will make the + screen look like curscr thinks it looks like. This is useful for + implementing a command which would redraw the screen in case it get + messed up. + + Input + + The complementary function to addch() is getch() which, if echo is + set, will call addch() to echo the character. Since the screen package + needs to know what is on the terminal at all times, if characters are + to be echoed, the tty must be in raw or cbreak mode. Since initially + the terminal has echoing enabled and is in ordinary ``cooked'' mode, + one or the other has to changed before calling getch(); otherwise, the + program's output will be unpredictable. + + When you need to accept line-oriented input in a window, the functions + wgetstr() and friends are available. There is even a wscanw() function + that can do scanf()(3)-style multi-field parsing on window input. + These pseudo-line-oriented functions turn on echoing while they + execute. + + The example code above uses the call keypad(stdscr, TRUE) to enable + support for function-key mapping. With this feature, the getch() code + watches the input stream for character sequences that correspond to + arrow and function keys. These sequences are returned as + pseudo-character values. The #define values returned are listed in the + curses.h The mapping from sequences to #define values is determined by + key_ capabilities in the terminal's terminfo entry. + + Using Forms Characters + + The addch() function (and some others, including box() and border()) + can accept some pseudo-character arguments which are specially defined + by ncurses. These are #define values set up in the curses.h header; + see there for a complete list (look for the prefix ACS_). + + The most useful of the ACS defines are the forms-drawing characters. + You can use these to draw boxes and simple graphs on the screen. If + the terminal does not have such characters, curses.h will map them to + a recognizable (though ugly) set of ASCII defaults. + + Character Attributes and Color + + The ncurses package supports screen highlights including standout, + reverse-video, underline, and blink. It also supports color, which is + treated as another kind of highlight. + + Highlights are encoded, internally, as high bits of the + pseudo-character type (chtype) that curses.h uses to represent the + contents of a screen cell. See the curses.h header file for a complete + list of highlight mask values (look for the prefix A_). + + There are two ways to make highlights. One is to logical-or the value + of the highlights you want into the character argument of an addch() + call, or any other output call that takes a chtype argument. + + The other is to set the current-highlight value. This is logical-or'ed + with any highlight you specify the first way. You do this with the + functions attron(), attroff(), and attrset(); see the manual pages for + details. Color is a special kind of highlight. The package actually + thinks in terms of color pairs, combinations of foreground and + background colors. The sample code above sets up eight color pairs, + all of the guaranteed-available colors on black. Note that each color + pair is, in effect, given the name of its foreground color. Any other + range of eight non-conflicting values could have been used as the + first arguments of the init_pair() values. + + Once you've done an init_pair() that creates color-pair N, you can use + COLOR_PAIR(N) as a highlight that invokes that particular color + combination. Note that COLOR_PAIR(N), for constant N, is itself a + compile-time constant and can be used in initializers. + + Mouse Interfacing + + The ncurses library also provides a mouse interface. + + NOTE: this facility is specific to ncurses, it is not part of + either the XSI Curses standard, nor of System V Release 4, nor BSD + curses. System V Release 4 curses contains code with similar + interface definitions, however it is not documented. Other than by + disassembling the library, we have no way to determine exactly how + that mouse code works. Thus, we recommend that you wrap + mouse-related code in an #ifdef using the feature macro + NCURSES_MOUSE_VERSION so it will not be compiled and linked on + non-ncurses systems. + + Presently, mouse event reporting works in the following environments: + * xterm and similar programs such as rxvt. + * Linux console, when configured with gpm(1), Alessandro Rubini's + mouse server. + * OS/2 EMX + + The mouse interface is very simple. To activate it, you use the + function mousemask(), passing it as first argument a bit-mask that + specifies what kinds of events you want your program to be able to + see. It will return the bit-mask of events that actually become + visible, which may differ from the argument if the mouse device is not + capable of reporting some of the event types you specify. + + Once the mouse is active, your application's command loop should watch + for a return value of KEY_MOUSE from wgetch(). When you see this, a + mouse event report has been queued. To pick it off the queue, use the + function getmouse() (you must do this before the next wgetch(), + otherwise another mouse event might come in and make the first one + inaccessible). + + Each call to getmouse() fills a structure (the address of which you'll + pass it) with mouse event data. The event data includes zero-origin, + screen-relative character-cell coordinates of the mouse pointer. It + also includes an event mask. Bits in this mask will be set, + corresponding to the event type being reported. + + The mouse structure contains two additional fields which may be + significant in the future as ncurses interfaces to new kinds of + pointing device. In addition to x and y coordinates, there is a slot + for a z coordinate; this might be useful with touch-screens that can + return a pressure or duration parameter. There is also a device ID + field, which could be used to distinguish between multiple pointing + devices. + + The class of visible events may be changed at any time via + mousemask(). Events that can be reported include presses, releases, + single-, double- and triple-clicks (you can set the maximum + button-down time for clicks). If you don't make clicks visible, they + will be reported as press-release pairs. In some environments, the + event mask may include bits reporting the state of shift, alt, and + ctrl keys on the keyboard during the event. + + A function to check whether a mouse event fell within a given window + is also supplied. You can use this to see whether a given window + should consider a mouse event relevant to it. + + Because mouse event reporting will not be available in all + environments, it would be unwise to build ncurses applications that + require the use of a mouse. Rather, you should use the mouse as a + shortcut for point-and-shoot commands your application would normally + accept from the keyboard. Two of the test games in the ncurses + distribution (bs and knight) contain code that illustrates how this + can be done. + + See the manual page curs_mouse(3X) for full details of the + mouse-interface functions. + + Finishing Up + + In order to clean up after the ncurses routines, the routine endwin() + is provided. It restores tty modes to what they were when initscr() + was first called, and moves the cursor down to the lower-left corner. + Thus, anytime after the call to initscr, endwin() should be called + before exiting. + +Function Descriptions + + We describe the detailed behavior of some important curses functions + here, as a supplement to the manual page descriptions. + + Initialization and Wrapup + + initscr() + The first function called should almost always be initscr(). + This will determine the terminal type and initialize curses + data structures. initscr() also arranges that the first call to + refresh() will clear the screen. If an error occurs a message + is written to standard error and the program exits. Otherwise + it returns a pointer to stdscr. A few functions may be called + before initscr (slk_init(), filter(), ripofflines(), use_env(), + and, if you are using multiple terminals, newterm().) + + endwin() + Your program should always call endwin() before exiting or + shelling out of the program. This function will restore tty + modes, move the cursor to the lower left corner of the screen, + reset the terminal into the proper non-visual mode. Calling + refresh() or doupdate() after a temporary escape from the + program will restore the ncurses screen from before the escape. + + newterm(type, ofp, ifp) + A program which outputs to more than one terminal should use + newterm() instead of initscr(). newterm() should be called once + for each terminal. It returns a variable of type SCREEN * which + should be saved as a reference to that terminal. The arguments + are the type of the terminal (a string) and FILE pointers for + the output and input of the terminal. If type is NULL then the + environment variable $TERM is used. endwin() should called once + at wrapup time for each terminal opened using this function. + + set_term(new) + This function is used to switch to a different terminal + previously opened by newterm(). The screen reference for the + new terminal is passed as the parameter. The previous terminal + is returned by the function. All other calls affect only the + current terminal. + + delscreen(sp) + The inverse of newterm(); deallocates the data structures + associated with a given SCREEN reference. + + Causing Output to the Terminal + + refresh() and wrefresh(win) + These functions must be called to actually get any output on + the terminal, as other routines merely manipulate data + structures. wrefresh() copies the named window to the physical + terminal screen, taking into account what is already there in + order to do optimizations. refresh() does a refresh of + stdscr(). Unless leaveok() has been enabled, the physical + cursor of the terminal is left at the location of the window's + cursor. + + doupdate() and wnoutrefresh(win) + These two functions allow multiple updates with more efficiency + than wrefresh. To use them, it is important to understand how + curses works. In addition to all the window structures, curses + keeps two data structures representing the terminal screen: a + physical screen, describing what is actually on the screen, and + a virtual screen, describing what the programmer wants to have + on the screen. wrefresh works by first copying the named window + to the virtual screen (wnoutrefresh()), and then calling the + routine to update the screen (doupdate()). If the programmer + wishes to output several windows at once, a series of calls to + wrefresh will result in alternating calls to wnoutrefresh() and + doupdate(), causing several bursts of output to the screen. By + calling wnoutrefresh() for each window, it is then possible to + call doupdate() once, resulting in only one burst of output, + with fewer total characters transmitted (this also avoids a + visually annoying flicker at each update). + + Low-Level Capability Access + + setupterm(term, filenum, errret) + This routine is called to initialize a terminal's description, + without setting up the curses screen structures or changing the + tty-driver mode bits. term is the character string representing + the name of the terminal being used. filenum is the UNIX file + descriptor of the terminal to be used for output. errret is a + pointer to an integer, in which a success or failure indication + is returned. The values returned can be 1 (all is well), 0 (no + such terminal), or -1 (some problem locating the terminfo + database). + + The value of term can be given as NULL, which will cause the + value of TERM in the environment to be used. The errret pointer + can also be given as NULL, meaning no error code is wanted. If + errret is defaulted, and something goes wrong, setupterm() will + print an appropriate error message and exit, rather than + returning. Thus, a simple program can call setupterm(0, 1, 0) + and not worry about initialization errors. + + After the call to setupterm(), the global variable cur_term is + set to point to the current structure of terminal capabilities. + By calling setupterm() for each terminal, and saving and + restoring cur_term, it is possible for a program to use two or + more terminals at once. Setupterm() also stores the names + section of the terminal description in the global character + array ttytype[]. Subsequent calls to setupterm() will overwrite + this array, so you'll have to save it yourself if need be. + + Debugging + + NOTE: These functions are not part of the standard curses API! + + trace() + This function can be used to explicitly set a trace level. If + the trace level is nonzero, execution of your program will + generate a file called `trace' in the current working directory + containing a report on the library's actions. Higher trace + levels enable more detailed (and verbose) reporting -- see + comments attached to TRACE_ defines in the curses.h file for + details. (It is also possible to set a trace level by assigning + a trace level value to the environment variable NCURSES_TRACE). + + _tracef() + This function can be used to output your own debugging + information. It is only available only if you link with + -lncurses_g. It can be used the same way as printf(), only it + outputs a newline after the end of arguments. The output goes + to a file called trace in the current directory. + + Trace logs can be difficult to interpret due to the sheer volume of + data dumped in them. There is a script called tracemunch included with + the ncurses distribution that can alleviate this problem somewhat; it + compacts long sequences of similar operations into more succinct + single-line pseudo-operations. These pseudo-ops can be distinguished + by the fact that they are named in capital letters. + +Hints, Tips, and Tricks + + The ncurses manual pages are a complete reference for this library. In + the remainder of this document, we discuss various useful methods that + may not be obvious from the manual page descriptions. + + Some Notes of Caution + + If you find yourself thinking you need to use noraw() or nocbreak(), + think again and move carefully. It's probably better design to use + getstr() or one of its relatives to simulate cooked mode. The noraw() + and nocbreak() functions try to restore cooked mode, but they may end + up clobbering some control bits set before you started your + application. Also, they have always been poorly documented, and are + likely to hurt your application's usability with other curses + libraries. + + Bear in mind that refresh() is a synonym for wrefresh(stdscr). Don't + try to mix use of stdscr with use of windows declared by newwin(); a + refresh() call will blow them off the screen. The right way to handle + this is to use subwin(), or not touch stdscr at all and tile your + screen with declared windows which you then wnoutrefresh() somewhere + in your program event loop, with a single doupdate() call to trigger + actual repainting. + + You are much less likely to run into problems if you design your + screen layouts to use tiled rather than overlapping windows. + Historically, curses support for overlapping windows has been weak, + fragile, and poorly documented. The ncurses library is not yet an + exception to this rule. + + There is a panels library included in the ncurses distribution that + does a pretty good job of strengthening the overlapping-windows + facilities. + + Try to avoid using the global variables LINES and COLS. Use getmaxyx() + on the stdscr context instead. Reason: your code may be ported to run + in an environment with window resizes, in which case several screens + could be open with different sizes. + + Temporarily Leaving NCURSES Mode + + Sometimes you will want to write a program that spends most of its + time in screen mode, but occasionally returns to ordinary `cooked' + mode. A common reason for this is to support shell-out. This behavior + is simple to arrange in ncurses. + + To leave ncurses mode, call endwin() as you would if you were + intending to terminate the program. This will take the screen back to + cooked mode; you can do your shell-out. When you want to return to + ncurses mode, simply call refresh() or doupdate(). This will repaint + the screen. + + There is a boolean function, isendwin(), which code can use to test + whether ncurses screen mode is active. It returns TRUE in the interval + between an endwin() call and the following refresh(), FALSE otherwise. + + Here is some sample code for shellout: + addstr("Shelling out..."); + def_prog_mode(); /* save current tty modes */ + endwin(); /* restore original tty modes */ + system("sh"); /* run shell */ + addstr("returned.\n"); /* prepare return message */ + refresh(); /* restore save modes, repaint screen */ + + Using NCURSES under XTERM + + A resize operation in X sends SIGWINCH to the application running + under xterm. The ncurses library provides an experimental signal + handler, but in general does not catch this signal, because it cannot + know how you want the screen re-painted. You will usually have to + write the SIGWINCH handler yourself. Ncurses can give you some help. + + The easiest way to code your SIGWINCH handler is to have it do an + endwin, followed by an refresh and a screen repaint you code yourself. + The refresh will pick up the new screen size from the xterm's + environment. + + That is the standard way, of course (it even works with some vendor's + curses implementations). Its drawback is that it clears the screen to + reinitialize the display, and does not resize subwindows which must be + shrunk. Ncurses provides an extension which works better, the + resizeterm function. That function ensures that all windows are + limited to the new screen dimensions, and pads stdscr with blanks if + the screen is larger. + + Finally, ncurses can be configured to provide its own SIGWINCH + handler, based on resizeterm. + + Handling Multiple Terminal Screens + + The initscr() function actually calls a function named newterm() to do + most of its work. If you are writing a program that opens multiple + terminals, use newterm() directly. + + For each call, you will have to specify a terminal type and a pair of + file pointers; each call will return a screen reference, and stdscr + will be set to the last one allocated. You will switch between screens + with the set_term call. Note that you will also have to call + def_shell_mode and def_prog_mode on each tty yourself. + + Testing for Terminal Capabilities + + Sometimes you may want to write programs that test for the presence of + various capabilities before deciding whether to go into ncurses mode. + An easy way to do this is to call setupterm(), then use the functions + tigetflag(), tigetnum(), and tigetstr() to do your testing. + + A particularly useful case of this often comes up when you want to + test whether a given terminal type should be treated as `smart' + (cursor-addressable) or `stupid'. The right way to test this is to see + if the return value of tigetstr("cup") is non-NULL. Alternatively, you + can include the term.h file and test the value of the macro + cursor_address. + + Tuning for Speed + + Use the addchstr() family of functions for fast screen-painting of + text when you know the text doesn't contain any control characters. + Try to make attribute changes infrequent on your screens. Don't use + the immedok() option! + + Special Features of NCURSES + + The wresize() function allows you to resize a window in place. The + associated resizeterm() function simplifies the construction of + SIGWINCH handlers, for resizing all windows. + + The define_key() function allows you to define at runtime function-key + control sequences which are not in the terminal description. The + keyok() function allows you to temporarily enable or disable + interpretation of any function-key control sequence. + + The use_default_colors() function allows you to construct applications + which can use the terminal's default foreground and background colors + as an additional "default" color. Several terminal emulators support + this feature, which is based on ISO 6429. + + Ncurses supports up 16 colors, unlike SVr4 curses which defines only + 8. While most terminals which provide color allow only 8 colors, about + a quarter (including XFree86 xterm) support 16 colors. + +Compatibility with Older Versions + + Despite our best efforts, there are some differences between ncurses + and the (undocumented!) behavior of older curses implementations. + These arise from ambiguities or omissions in the documentation of the + API. + + Refresh of Overlapping Windows + + If you define two windows A and B that overlap, and then alternately + scribble on and refresh them, the changes made to the overlapping + region under historic curses versions were often not documented + precisely. + + To understand why this is a problem, remember that screen updates are + calculated between two representations of the entire display. The + documentation says that when you refresh a window, it is first copied + to to the virtual screen, and then changes are calculated to update + the physical screen (and applied to the terminal). But "copied to" is + not very specific, and subtle differences in how copying works can + produce different behaviors in the case where two overlapping windows + are each being refreshed at unpredictable intervals. + + What happens to the overlapping region depends on what wnoutrefresh() + does with its argument -- what portions of the argument window it + copies to the virtual screen. Some implementations do "change copy", + copying down only locations in the window that have changed (or been + marked changed with wtouchln() and friends). Some implementations do + "entire copy", copying all window locations to the virtual screen + whether or not they have changed. + + The ncurses library itself has not always been consistent on this + score. Due to a bug, versions 1.8.7 to 1.9.8a did entire copy. + Versions 1.8.6 and older, and versions 1.9.9 and newer, do change + copy. + + For most commercial curses implementations, it is not documented and + not known for sure (at least not to the ncurses maintainers) whether + they do change copy or entire copy. We know that System V release 3 + curses has logic in it that looks like an attempt to do change copy, + but the surrounding logic and data representations are sufficiently + complex, and our knowledge sufficiently indirect, that it's hard to + know whether this is reliable. It is not clear what the SVr4 + documentation and XSI standard intend. The XSI Curses standard barely + mentions wnoutrefresh(); the SVr4 documents seem to be describing + entire-copy, but it is possible with some effort and straining to read + them the other way. + + It might therefore be unwise to rely on either behavior in programs + that might have to be linked with other curses implementations. + Instead, you can do an explicit touchwin() before the wnoutrefresh() + call to guarantee an entire-contents copy anywhere. + + The really clean way to handle this is to use the panels library. If, + when you want a screen update, you do update_panels(), it will do all + the necessary wnoutrfresh() calls for whatever panel stacking order + you have defined. Then you can do one doupdate() and there will be a + single burst of physical I/O that will do all your updates. + + Background Erase + + If you have been using a very old versions of ncurses (1.8.7 or older) + you may be surprised by the behavior of the erase functions. In older + versions, erased areas of a window were filled with a blank modified + by the window's current attribute (as set by wattrset(), wattron(), + wattroff() and friends). + + In newer versions, this is not so. Instead, the attribute of erased + blanks is normal unless and until it is modified by the functions + bkgdset() or wbkgdset(). + + This change in behavior conforms ncurses to System V Release 4 and the + XSI Curses standard. + +XSI Curses Conformance + + The ncurses library is intended to be base-level conformant with the + XSI Curses standard from X/Open. Many extended-level features (in + fact, almost all features not directly concerned with wide characters + and internationalization) are also supported. + + One effect of XSI conformance is the change in behavior described + under "Background Erase -- Compatibility with Old Versions". + + Also, ncurses meets the XSI requirement that every macro entry point + have a corresponding function which may be linked (and will be + prototype-checked) if the macro definition is disabled with #undef. + + The Panels Library + + The ncurses library by itself provides good support for screen + displays in which the windows are tiled (non-overlapping). In the more + general case that windows may overlap, you have to use a series of + wnoutrefresh() calls followed by a doupdate(), and be careful about + the order you do the window refreshes in. It has to be bottom-upwards, + otherwise parts of windows that should be obscured will show through. + + When your interface design is such that windows may dive deeper into + the visibility stack or pop to the top at runtime, the resulting + book-keeping can be tedious and difficult to get right. Hence the + panels library. + + The panel library first appeared in AT&T System V. The version + documented here is the panel code distributed with ncurses. + +Compiling With the Panels Library + + Your panels-using modules must import the panels library declarations + with + #include <panel.h> + + and must be linked explicitly with the panels library using an -lpanel + argument. Note that they must also link the ncurses library with + -lncurses. Many linkers are two-pass and will accept either order, but + it is still good practice to put -lpanel first and -lncurses second. + +Overview of Panels + + A panel object is a window that is implicitly treated as part of a + deck including all other panel objects. The deck has an implicit + bottom-to-top visibility order. The panels library includes an update + function (analogous to refresh()) that displays all panels in the deck + in the proper order to resolve overlaps. The standard window, stdscr, + is considered below all panels. + + Details on the panels functions are available in the man pages. We'll + just hit the highlights here. + + You create a panel from a window by calling new_panel() on a window + pointer. It then becomes the top of the deck. The panel's window is + available as the value of panel_window() called with the panel pointer + as argument. + + You can delete a panel (removing it from the deck) with del_panel. + This will not deallocate the associated window; you have to do that + yourself. You can replace a panel's window with a different window by + calling replace_window. The new window may be of different size; the + panel code will re-compute all overlaps. This operation doesn't change + the panel's position in the deck. + + To move a panel's window, use move_panel(). The mvwin() function on + the panel's window isn't sufficient because it doesn't update the + panels library's representation of where the windows are. This + operation leaves the panel's depth, contents, and size unchanged. + + Two functions (top_panel(), bottom_panel()) are provided for + rearranging the deck. The first pops its argument window to the top of + the deck; the second sends it to the bottom. Either operation leaves + the panel's screen location, contents, and size unchanged. + + The function update_panels() does all the wnoutrefresh() calls needed + to prepare for doupdate() (which you must call yourself, afterwards). + + Typically, you will want to call update_panels() and doupdate() just + before accepting command input, once in each cycle of interaction with + the user. If you call update_panels() after each and every panel + write, you'll generate a lot of unnecessary refresh activity and + screen flicker. + +Panels, Input, and the Standard Screen + + You shouldn't mix wnoutrefresh() or wrefresh() operations with panels + code; this will work only if the argument window is either in the top + panel or unobscured by any other panels. + + The stsdcr window is a special case. It is considered below all + panels. Because changes to panels may obscure parts of stdscr, though, + you should call update_panels() before doupdate() even when you only + change stdscr. + + Note that wgetch automatically calls wrefresh. Therefore, before + requesting input from a panel window, you need to be sure that the + panel is totally unobscured. + + There is presently no way to display changes to one obscured panel + without repainting all panels. + +Hiding Panels + + It's possible to remove a panel from the deck temporarily; use + hide_panel for this. Use show_panel() to render it visible again. The + predicate function panel_hidden tests whether or not a panel is + hidden. + + The panel_update code ignores hidden panels. You cannot do top_panel() + or bottom_panel on a hidden panel(). Other panels operations are + applicable. + +Miscellaneous Other Facilities + + It's possible to navigate the deck using the functions panel_above() + and panel_below. Handed a panel pointer, they return the panel above + or below that panel. Handed NULL, they return the bottom-most or + top-most panel. + + Every panel has an associated user pointer, not used by the panel + code, to which you can attach application data. See the man page + documentation of set_panel_userptr() and panel_userptr for details. + + The Menu Library + + A menu is a screen display that assists the user to choose some subset + of a given set of items. The menu library is a curses extension that + supports easy programming of menu hierarchies with a uniform but + flexible interface. + + The menu library first appeared in AT&T System V. The version + documented here is the menu code distributed with ncurses. + +Compiling With the menu Library + + Your menu-using modules must import the menu library declarations with + #include <menu.h> + + and must be linked explicitly with the menus library using an -lmenu + argument. Note that they must also link the ncurses library with + -lncurses. Many linkers are two-pass and will accept either order, but + it is still good practice to put -lmenu first and -lncurses second. + +Overview of Menus + + The menus created by this library consist of collections of items + including a name string part and a description string part. To make + menus, you create groups of these items and connect them with menu + frame objects. + + The menu can then by posted, that is written to an associated window. + Actually, each menu has two associated windows; a containing window in + which the programmer can scribble titles or borders, and a subwindow + in which the menu items proper are displayed. If this subwindow is too + small to display all the items, it will be a scrollable viewport on + the collection of items. + + A menu may also be unposted (that is, undisplayed), and finally freed + to make the storage associated with it and its items available for + re-use. + + The general flow of control of a menu program looks like this: + 1. Initialize curses. + 2. Create the menu items, using new_item(). + 3. Create the menu using new_menu(). + 4. Post the menu using menu_post(). + 5. Refresh the screen. + 6. Process user requests via an input loop. + 7. Unpost the menu using menu_unpost(). + 8. Free the menu, using free_menu(). + 9. Free the items using free_item(). + 10. Terminate curses. + +Selecting items + + Menus may be multi-valued or (the default) single-valued (see the + manual page menu_opts(3x) to see how to change the default). Both + types always have a current item. + + From a single-valued menu you can read the selected value simply by + looking at the current item. From a multi-valued menu, you get the + selected set by looping through the items applying the item_value() + predicate function. Your menu-processing code can use the function + set_item_value() to flag the items in the select set. + + Menu items can be made unselectable using set_item_opts() or + item_opts_off() with the O_SELECTABLE argument. This is the only + option so far defined for menus, but it is good practice to code as + though other option bits might be on. + +Menu Display + + The menu library calculates a minimum display size for your window, + based on the following variables: + * The number and maximum length of the menu items + * Whether the O_ROWMAJOR option is enabled + * Whether display of descriptions is enabled + * Whatever menu format may have been set by the programmer + * The length of the menu mark string used for highlighting selected + items + + The function set_menu_format() allows you to set the maximum size of + the viewport or menu page that will be used to display menu items. You + can retrieve any format associated with a menu with menu_format(). The + default format is rows=16, columns=1. + + The actual menu page may be smaller than the format size. This depends + on the item number and size and whether O_ROWMAJOR is on. This option + (on by default) causes menu items to be displayed in a `raster-scan' + pattern, so that if more than one item will fit horizontally the first + couple of items are side-by-side in the top row. The alternative is + column-major display, which tries to put the first several items in + the first column. + + As mentioned above, a menu format not large enough to allow all items + to fit on-screen will result in a menu display that is vertically + scrollable. + + You can scroll it with requests to the menu driver, which will be + described in the section on menu input handling. + + Each menu has a mark string used to visually tag selected items; see + the menu_mark(3x) manual page for details. The mark string length also + influences the menu page size. + + The function scale_menu() returns the minimum display size that the + menu code computes from all these factors. There are other menu + display attributes including a select attribute, an attribute for + selectable items, an attribute for unselectable items, and a pad + character used to separate item name text from description text. These + have reasonable defaults which the library allows you to change (see + the menu_attribs(3x) manual page. + +Menu Windows + + Each menu has, as mentioned previously, a pair of associated windows. + Both these windows are painted when the menu is posted and erased when + the menu is unposted. + + The outer or frame window is not otherwise touched by the menu + routines. It exists so the programmer can associate a title, a border, + or perhaps help text with the menu and have it properly refreshed or + erased at post/unpost time. The inner window or subwindow is where the + current menu page is displayed. + + By default, both windows are stdscr. You can set them with the + functions in menu_win(3x). + + When you call menu_post(), you write the menu to its subwindow. When + you call menu_unpost(), you erase the subwindow, However, neither of + these actually modifies the screen. To do that, call wrefresh() or + some equivalent. + +Processing Menu Input + + The main loop of your menu-processing code should call menu_driver() + repeatedly. The first argument of this routine is a menu pointer; the + second is a menu command code. You should write an input-fetching + routine that maps input characters to menu command codes, and pass its + output to menu_driver(). The menu command codes are fully documented + in menu_driver(3x). + + The simplest group of command codes is REQ_NEXT_ITEM, REQ_PREV_ITEM, + REQ_FIRST_ITEM, REQ_LAST_ITEM, REQ_UP_ITEM, REQ_DOWN_ITEM, + REQ_LEFT_ITEM, REQ_RIGHT_ITEM. These change the currently selected + item. These requests may cause scrolling of the menu page if it only + partially displayed. + + There are explicit requests for scrolling which also change the + current item (because the select location does not change, but the + item there does). These are REQ_SCR_DLINE, REQ_SCR_ULINE, + REQ_SCR_DPAGE, and REQ_SCR_UPAGE. + + The REQ_TOGGLE_ITEM selects or deselects the current item. It is for + use in multi-valued menus; if you use it with O_ONEVALUE on, you'll + get an error return (E_REQUEST_DENIED). + + Each menu has an associated pattern buffer. The menu_driver() logic + tries to accumulate printable ASCII characters passed in in that + buffer; when it matches a prefix of an item name, that item (or the + next matching item) is selected. If appending a character yields no + new match, that character is deleted from the pattern buffer, and + menu_driver() returns E_NO_MATCH. + + Some requests change the pattern buffer directly: REQ_CLEAR_PATTERN, + REQ_BACK_PATTERN, REQ_NEXT_MATCH, REQ_PREV_MATCH. The latter two are + useful when pattern buffer input matches more than one item in a + multi-valued menu. + + Each successful scroll or item navigation request clears the pattern + buffer. It is also possible to set the pattern buffer explicitly with + set_menu_pattern(). + + Finally, menu driver requests above the constant MAX_COMMAND are + considered application-specific commands. The menu_driver() code + ignores them and returns E_UNKNOWN_COMMAND. + +Miscellaneous Other Features + + Various menu options can affect the processing and visual appearance + and input processing of menus. See menu_opts(3x) for details. + + It is possible to change the current item from application code; this + is useful if you want to write your own navigation requests. It is + also possible to explicitly set the top row of the menu display. See + mitem_current(3x). If your application needs to change the menu + subwindow cursor for any reason, pos_menu_cursor() will restore it to + the correct location for continuing menu driver processing. + + It is possible to set hooks to be called at menu initialization and + wrapup time, and whenever the selected item changes. See + menu_hook(3x). + + Each item, and each menu, has an associated user pointer on which you + can hang application data. See mitem_userptr(3x) and menu_userptr(3x). + + The Forms Library + + The form library is a curses extension that supports easy programming + of on-screen forms for data entry and program control. + + The form library first appeared in AT&T System V. The version + documented here is the form code distributed with ncurses. + +Compiling With the form Library + + Your form-using modules must import the form library declarations with + #include <form.h> + + and must be linked explicitly with the forms library using an -lform + argument. Note that they must also link the ncurses library with + -lncurses. Many linkers are two-pass and will accept either order, but + it is still good practice to put -lform first and -lncurses second. + +Overview of Forms + + A form is a collection of fields; each field may be either a label + (explanatory text) or a data-entry location. Long forms may be + segmented into pages; each entry to a new page clears the screen. + + To make forms, you create groups of fields and connect them with form + frame objects; the form library makes this relatively simple. + + Once defined, a form can be posted, that is written to an associated + window. Actually, each form has two associated windows; a containing + window in which the programmer can scribble titles or borders, and a + subwindow in which the form fields proper are displayed. + + As the form user fills out the posted form, navigation and editing + keys support movement between fields, editing keys support modifying + field, and plain text adds to or changes data in a current field. The + form library allows you (the forms designer) to bind each navigation + and editing key to any keystroke accepted by curses Fields may have + validation conditions on them, so that they check input data for type + and value. The form library supplies a rich set of pre-defined field + types, and makes it relatively easy to define new ones. + + Once its transaction is completed (or aborted), a form may be unposted + (that is, undisplayed), and finally freed to make the storage + associated with it and its items available for re-use. + + The general flow of control of a form program looks like this: + 1. Initialize curses. + 2. Create the form fields, using new_field(). + 3. Create the form using new_form(). + 4. Post the form using form_post(). + 5. Refresh the screen. + 6. Process user requests via an input loop. + 7. Unpost the form using form_unpost(). + 8. Free the form, using free_form(). + 9. Free the fields using free_field(). + 10. Terminate curses. + + Note that this looks much like a menu program; the form library + handles tasks which are in many ways similar, and its interface was + obviously designed to resemble that of the menu library wherever + possible. + + In forms programs, however, the `process user requests' is somewhat + more complicated than for menus. Besides menu-like navigation + operations, the menu driver loop has to support field editing and data + validation. + +Creating and Freeing Fields and Forms + + The basic function for creating fields is new_field(): +FIELD *new_field(int height, int width, /* new field size */ + int top, int left, /* upper left corner */ + int offscreen, /* number of offscreen rows */ + int nbuf); /* number of working buffers */ + + Menu items always occupy a single row, but forms fields may have + multiple rows. So new_field() requires you to specify a width and + height (the first two arguments, which mist both be greater than + zero). + + You must also specify the location of the field's upper left corner on + the screen (the third and fourth arguments, which must be zero or + greater). Note that these coordinates are relative to the form + subwindow, which will coincide with stdscr by default but need not be + stdscr if you've done an explicit set_form_window() call. + + The fifth argument allows you to specify a number of off-screen rows. + If this is zero, the entire field will always be displayed. If it is + nonzero, the form will be scrollable, with only one screen-full + (initially the top part) displayed at any given time. If you make a + field dynamic and grow it so it will no longer fit on the screen, the + form will become scrollable even if the offscreen argument was + initially zero. + + The forms library allocates one working buffer per field; the size of + each buffer is ((height + offscreen)*width + 1, one character for each + position in the field plus a NUL terminator. The sixth argument is the + number of additional data buffers to allocate for the field; your + application can use them for its own purposes. +FIELD *dup_field(FIELD *field, /* field to copy */ + int top, int left); /* location of new copy */ + + The function dup_field() duplicates an existing field at a new + location. Size and buffering information are copied; some attribute + flags and status bits are not (see the form_field_new(3X) for + details). +FIELD *link_field(FIELD *field, /* field to copy */ + int top, int left); /* location of new copy */ + + The function link_field() also duplicates an existing field at a new + location. The difference from dup_field() is that it arranges for the + new field's buffer to be shared with the old one. + + Besides the obvious use in making a field editable from two different + form pages, linked fields give you a way to hack in dynamic labels. If + you declare several fields linked to an original, and then make them + inactive, changes from the original will still be propagated to the + linked fields. + + As with duplicated fields, linked fields have attribute bits separate + from the original. + + As you might guess, all these field-allocations return NULL if the + field allocation is not possible due to an out-of-memory error or + out-of-bounds arguments. + + To connect fields to a form, use +FORM *new_form(FIELD **fields); + + This function expects to see a NULL-terminated array of field + pointers. Said fields are connected to a newly-allocated form object; + its address is returned (or else NULL if the allocation fails). + + Note that new_field() does not copy the pointer array into private + storage; if you modify the contents of the pointer array during forms + processing, all manner of bizarre things might happen. Also note that + any given field may only be connected to one form. + + The functions free_field() and free_form are available to free field + and form objects. It is an error to attempt to free a field connected + to a form, but not vice-versa; thus, you will generally free your form + objects first. + +Fetching and Changing Field Attributes + + Each form field has a number of location and size attributes + associated with it. There are other field attributes used to control + display and editing of the field. Some (for example, the O_STATIC bit) + involve sufficient complications to be covered in sections of their + own later on. We cover the functions used to get and set several basic + attributes here. + + When a field is created, the attributes not specified by the new_field + function are copied from an invisible system default field. In + attribute-setting and -fetching functions, the argument NULL is taken + to mean this field. Changes to it persist as defaults until your forms + application terminates. + + Fetching Size and Location Data + + You can retrieve field sizes and locations through: +int field_info(FIELD *field, /* field from which to fetch */ + int *height, *int width, /* field size */ + int *top, int *left, /* upper left corner */ + int *offscreen, /* number of offscreen rows */ + int *nbuf); /* number of working buffers */ + + This function is a sort of inverse of new_field(); instead of setting + size and location attributes of a new field, it fetches them from an + existing one. + + Changing the Field Location + + It is possible to move a field's location on the screen: +int move_field(FIELD *field, /* field to alter */ + int top, int left); /* new upper-left corner */ + + You can, of course. query the current location through field_info(). + + The Justification Attribute + + One-line fields may be unjustified, justified right, justified left, + or centered. Here is how you manipulate this attribute: +int set_field_just(FIELD *field, /* field to alter */ + int justmode); /* mode to set */ + +int field_just(FIELD *field); /* fetch mode of field */ + + The mode values accepted and returned by this functions are + preprocessor macros NO_JUSTIFICATION, JUSTIFY_RIGHT, JUSTIFY_LEFT, or + JUSTIFY_CENTER. + + Field Display Attributes + + For each field, you can set a foreground attribute for entered + characters, a background attribute for the entire field, and a pad + character for the unfilled portion of the field. You can also control + pagination of the form. + + This group of four field attributes controls the visual appearance of + the field on the screen, without affecting in any way the data in the + field buffer. +int set_field_fore(FIELD *field, /* field to alter */ + chtype attr); /* attribute to set */ + +chtype field_fore(FIELD *field); /* field to query */ + +int set_field_back(FIELD *field, /* field to alter */ + chtype attr); /* attribute to set */ + +chtype field_back(FIELD *field); /* field to query */ + +int set_field_pad(FIELD *field, /* field to alter */ + int pad); /* pad character to set */ + +chtype field_pad(FIELD *field); + +int set_new_page(FIELD *field, /* field to alter */ + int flag); /* TRUE to force new page */ + +chtype new_page(FIELD *field); /* field to query */ + + The attributes set and returned by the first four functions are normal + curses(3x) display attribute values (A_STANDOUT, A_BOLD, A_REVERSE + etc). The page bit of a field controls whether it is displayed at the + start of a new form screen. + + Field Option Bits + + There is also a large collection of field option bits you can set to + control various aspects of forms processing. You can manipulate them + with these functions: +int set_field_opts(FIELD *field, /* field to alter */ + int attr); /* attribute to set */ + +int field_opts_on(FIELD *field, /* field to alter */ + int attr); /* attributes to turn on */ + +int field_opts_off(FIELD *field, /* field to alter */ + int attr); /* attributes to turn off */ + +int field_opts(FIELD *field); /* field to query */ + + By default, all options are on. Here are the available option bits: + + O_VISIBLE + Controls whether the field is visible on the screen. Can be + used during form processing to hide or pop up fields depending + on the value of parent fields. + + O_ACTIVE + Controls whether the field is active during forms processing + (i.e. visited by form navigation keys). Can be used to make + labels or derived fields with buffer values alterable by the + forms application, not the user. + + O_PUBLIC + Controls whether data is displayed during field entry. If this + option is turned off on a field, the library will accept and + edit data in that field, but it will not be displayed and the + visible field cursor will not move. You can turn off the + O_PUBLIC bit to define password fields. + + O_EDIT + Controls whether the field's data can be modified. When this + option is off, all editing requests except REQ_PREV_CHOICE and + REQ_NEXT_CHOICE will fail. Such read-only fields may be useful + for help messages. + + O_WRAP + Controls word-wrapping in multi-line fields. Normally, when any + character of a (blank-separated) word reaches the end of the + current line, the entire word is wrapped to the next line + (assuming there is one). When this option is off, the word will + be split across the line break. + + O_BLANK + Controls field blanking. When this option is on, entering a + character at the first field position erases the entire field + (except for the just-entered character). + + O_AUTOSKIP + Controls automatic skip to next field when this one fills. + Normally, when the forms user tries to type more data into a + field than will fit, the editing location jumps to next field. + When this option is off, the user's cursor will hang at the end + of the field. This option is ignored in dynamic fields that + have not reached their size limit. + + O_NULLOK + Controls whether validation is applied to blank fields. + Normally, it is not; the user can leave a field blank without + invoking the usual validation check on exit. If this option is + off on a field, exit from it will invoke a validation check. + + O_PASSOK + Controls whether validation occurs on every exit, or only after + the field is modified. Normally the latter is true. Setting + O_PASSOK may be useful if your field's validation function may + change during forms processing. + + O_STATIC + Controls whether the field is fixed to its initial dimensions. + If you turn this off, the field becomes dynamic and will + stretch to fit entered data. + + A field's options cannot be changed while the field is currently + selected. However, options may be changed on posted fields that are + not current. + + The option values are bit-masks and can be composed with logical-or in + the obvious way. + +Field Status + + Every field has a status flag, which is set to FALSE when the field is + created and TRUE when the value in field buffer 0 changes. This flag + can be queried and set directly: +int set_field_status(FIELD *field, /* field to alter */ + int status); /* mode to set */ + +int field_status(FIELD *field); /* fetch mode of field */ + + Setting this flag under program control can be useful if you use the + same form repeatedly, looking for modified fields each time. + + Calling field_status() on a field not currently selected for input + will return a correct value. Calling field_status() on a field that is + currently selected for input may not necessarily give a correct field + status value, because entered data isn't necessarily copied to buffer + zero before the exit validation check. To guarantee that the returned + status value reflects reality, call field_status() either (1) in the + field's exit validation check routine, (2) from the field's or form's + initialization or termination hooks, or (3) just after a + REQ_VALIDATION request has been processed by the forms driver. + +Field User Pointer + + Each field structure contains one character pointer slot that is not + used by the forms library. It is intended to be used by applications + to store private per-field data. You can manipulate it with: +int set_field_userptr(FIELD *field, /* field to alter */ + char *userptr); /* mode to set */ + +char *field_userptr(FIELD *field); /* fetch mode of field */ + + (Properly, this user pointer field ought to have (void *) type. The + (char *) type is retained for System V compatibility.) + + It is valid to set the user pointer of the default field (with a + set_field_userptr() call passed a NULL field pointer.) When a new + field is created, the default-field user pointer is copied to + initialize the new field's user pointer. + +Variable-Sized Fields + + Normally, a field is fixed at the size specified for it at creation + time. If, however, you turn off its O_STATIC bit, it becomes dynamic + and will automatically resize itself to accommodate data as it is + entered. If the field has extra buffers associated with it, they will + grow right along with the main input buffer. + + A one-line dynamic field will have a fixed height (1) but variable + width, scrolling horizontally to display data within the field area as + originally dimensioned and located. A multi-line dynamic field will + have a fixed width, but variable height (number of rows), scrolling + vertically to display data within the field area as originally + dimensioned and located. + + Normally, a dynamic field is allowed to grow without limit. But it is + possible to set an upper limit on the size of a dynamic field. You do + it with this function: +int set_max_field(FIELD *field, /* field to alter (may not be NULL) */ + int max_size); /* upper limit on field size */ + + If the field is one-line, max_size is taken to be a column size limit; + if it is multi-line, it is taken to be a line size limit. To disable + any limit, use an argument of zero. The growth limit can be changed + whether or not the O_STATIC bit is on, but has no effect until it is. + + The following properties of a field change when it becomes dynamic: + * If there is no growth limit, there is no final position of the + field; therefore O_AUTOSKIP and O_NL_OVERLOAD are ignored. + * Field justification will be ignored (though whatever justification + is set up will be retained internally and can be queried). + * The dup_field() and link_field() calls copy dynamic-buffer sizes. + If the O_STATIC option is set on one of a collection of links, + buffer resizing will occur only when the field is edited through + that link. + * The call field_info() will retrieve the original static size of + the field; use dynamic_field_info() to get the actual dynamic + size. + +Field Validation + + By default, a field will accept any data that will fit in its input + buffer. However, it is possible to attach a validation type to a + field. If you do this, any attempt to leave the field while it + contains data that doesn't match the validation type will fail. Some + validation types also have a character-validity check for each time a + character is entered in the field. + + A field's validation check (if any) is not called when + set_field_buffer() modifies the input buffer, nor when that buffer is + changed through a linked field. + + The form library provides a rich set of pre-defined validation types, + and gives you the capability to define custom ones of your own. You + can examine and change field validation attributes with the following + functions: +int set_field_type(FIELD *field, /* field to alter */ + FIELDTYPE *ftype, /* type to associate */ + ...); /* additional arguments*/ + +FIELDTYPE *field_type(FIELD *field); /* field to query */ + + The validation type of a field is considered an attribute of the + field. As with other field attributes, Also, doing set_field_type() + with a NULL field default will change the system default for + validation of newly-created fields. + + Here are the pre-defined validation types: + + TYPE_ALPHA + + This field type accepts alphabetic data; no blanks, no digits, no + special characters (this is checked at character-entry time). It is + set up with: +int set_field_type(FIELD *field, /* field to alter */ + TYPE_ALPHA, /* type to associate */ + int width); /* maximum width of field */ + + The width argument sets a minimum width of data. Typically you'll want + to set this to the field width; if it's greater than the field width, + the validation check will always fail. A minimum width of zero makes + field completion optional. + + TYPE_ALNUM + + This field type accepts alphabetic data and digits; no blanks, no + special characters (this is checked at character-entry time). It is + set up with: +int set_field_type(FIELD *field, /* field to alter */ + TYPE_ALNUM, /* type to associate */ + int width); /* maximum width of field */ + + The width argument sets a minimum width of data. As with TYPE_ALPHA, + typically you'll want to set this to the field width; if it's greater + than the field width, the validation check will always fail. A minimum + width of zero makes field completion optional. + + TYPE_ENUM + + This type allows you to restrict a field's values to be among a + specified set of string values (for example, the two-letter postal + codes for U.S. states). It is set up with: +int set_field_type(FIELD *field, /* field to alter */ + TYPE_ENUM, /* type to associate */ + char **valuelist; /* list of possible values */ + int checkcase; /* case-sensitive? */ + int checkunique); /* must specify uniquely? */ + + The valuelist parameter must point at a NULL-terminated list of valid + strings. The checkcase argument, if true, makes comparison with the + string case-sensitive. + + When the user exits a TYPE_ENUM field, the validation procedure tries + to complete the data in the buffer to a valid entry. If a complete + choice string has been entered, it is of course valid. But it is also + possible to enter a prefix of a valid string and have it completed for + you. + + By default, if you enter such a prefix and it matches more than one + value in the string list, the prefix will be completed to the first + matching value. But the checkunique argument, if true, requires prefix + matches to be unique in order to be valid. + + The REQ_NEXT_CHOICE and REQ_PREV_CHOICE input requests can be + particularly useful with these fields. + + TYPE_INTEGER + + This field type accepts an integer. It is set up as follows: +int set_field_type(FIELD *field, /* field to alter */ + TYPE_INTEGER, /* type to associate */ + int padding, /* # places to zero-pad to */ + int vmin, int vmax); /* valid range */ + + Valid characters consist of an optional leading minus and digits. The + range check is performed on exit. If the range maximum is less than or + equal to the minimum, the range is ignored. + + If the value passes its range check, it is padded with as many leading + zero digits as necessary to meet the padding argument. + + A TYPE_INTEGER value buffer can conveniently be interpreted with the C + library function atoi(3). + + TYPE_NUMERIC + + This field type accepts a decimal number. It is set up as follows: +int set_field_type(FIELD *field, /* field to alter */ + TYPE_NUMERIC, /* type to associate */ + int padding, /* # places of precision */ + double vmin, double vmax); /* valid range */ + + Valid characters consist of an optional leading minus and digits. + possibly including a decimal point. If your system supports locale's, + the decimal point character used must be the one defined by your + locale. The range check is performed on exit. If the range maximum is + less than or equal to the minimum, the range is ignored. + + If the value passes its range check, it is padded with as many + trailing zero digits as necessary to meet the padding argument. + + A TYPE_NUMERIC value buffer can conveniently be interpreted with the C + library function atof(3). + + TYPE_REGEXP + + This field type accepts data matching a regular expression. It is set + up as follows: +int set_field_type(FIELD *field, /* field to alter */ + TYPE_REGEXP, /* type to associate */ + char *regexp); /* expression to match */ + + The syntax for regular expressions is that of regcomp(3). The check + for regular-expression match is performed on exit. + +Direct Field Buffer Manipulation + + The chief attribute of a field is its buffer contents. When a form has + been completed, your application usually needs to know the state of + each field buffer. You can find this out with: +char *field_buffer(FIELD *field, /* field to query */ + int bufindex); /* number of buffer to query */ + + Normally, the state of the zero-numbered buffer for each field is set + by the user's editing actions on that field. It's sometimes useful to + be able to set the value of the zero-numbered (or some other) buffer + from your application: +int set_field_buffer(FIELD *field, /* field to alter */ + int bufindex, /* number of buffer to alter */ + char *value); /* string value to set */ + + If the field is not large enough and cannot be resized to a + sufficiently large size to contain the specified value, the value will + be truncated to fit. + + Calling field_buffer() with a null field pointer will raise an error. + Calling field_buffer() on a field not currently selected for input + will return a correct value. Calling field_buffer() on a field that is + currently selected for input may not necessarily give a correct field + buffer value, because entered data isn't necessarily copied to buffer + zero before the exit validation check. To guarantee that the returned + buffer value reflects on-screen reality, call field_buffer() either + (1) in the field's exit validation check routine, (2) from the field's + or form's initialization or termination hooks, or (3) just after a + REQ_VALIDATION request has been processed by the forms driver. + +Attributes of Forms + + As with field attributes, form attributes inherit a default from a + system default form structure. These defaults can be queried or set by + of these functions using a form-pointer argument of NULL. + + The principal attribute of a form is its field list. You can query and + change this list with: +int set_form_fields(FORM *form, /* form to alter */ + FIELD **fields); /* fields to connect */ + +char *form_fields(FORM *form); /* fetch fields of form */ + +int field_count(FORM *form); /* count connect fields */ + + The second argument of set_form_fields() may be a NULL-terminated + field pointer array like the one required by new_form(). In that case, + the old fields of the form are disconnected but not freed (and + eligible to be connected to other forms), then the new fields are + connected. + + It may also be null, in which case the old fields are disconnected + (and not freed) but no new ones are connected. + + The field_count() function simply counts the number of fields + connected to a given from. It returns -1 if the form-pointer argument + is NULL. + +Control of Form Display + + In the overview section, you saw that to display a form you normally + start by defining its size (and fields), posting it, and refreshing + the screen. There is an hidden step before posting, which is the + association of the form with a frame window (actually, a pair of + windows) within which it will be displayed. By default, the forms + library associates every form with the full-screen window stdscr. + + By making this step explicit, you can associate a form with a declared + frame window on your screen display. This can be useful if you want to + adapt the form display to different screen sizes, dynamically tile + forms on the screen, or use a form as part of an interface layout + managed by panels. + + The two windows associated with each form have the same functions as + their analogues in the menu library. Both these windows are painted + when the form is posted and erased when the form is unposted. + + The outer or frame window is not otherwise touched by the form + routines. It exists so the programmer can associate a title, a border, + or perhaps help text with the form and have it properly refreshed or + erased at post/unpost time. The inner window or subwindow is where the + current form page is actually displayed. + + In order to declare your own frame window for a form, you'll need to + know the size of the form's bounding rectangle. You can get this + information with: +int scale_form(FORM *form, /* form to query */ + int *rows, /* form rows */ + int *cols); /* form cols */ + + The form dimensions are passed back in the locations pointed to by the + arguments. Once you have this information, you can use it to declare + of windows, then use one of these functions: +int set_form_win(FORM *form, /* form to alter */ + WINDOW *win); /* frame window to connect */ + +WINDOW *form_win(FORM *form); /* fetch frame window of form */ + +int set_form_sub(FORM *form, /* form to alter */ + WINDOW *win); /* form subwindow to connect */ + +WINDOW *form_sub(FORM *form); /* fetch form subwindow of form */ + + Note that curses operations, including refresh(), on the form, should + be done on the frame window, not the form subwindow. + + It is possible to check from your application whether all of a + scrollable field is actually displayed within the menu subwindow. Use + these functions: +int data_ahead(FORM *form); /* form to be queried */ + +int data_behind(FORM *form); /* form to be queried */ + + The function data_ahead() returns TRUE if (a) the current field is + one-line and has undisplayed data off to the right, (b) the current + field is multi-line and there is data off-screen below it. + + The function data_behind() returns TRUE if the first (upper left hand) + character position is off-screen (not being displayed). + + Finally, there is a function to restore the form window's cursor to + the value expected by the forms driver: +int pos_form_cursor(FORM *) /* form to be queried */ + + If your application changes the form window cursor, call this function + before handing control back to the forms driver in order to + re-synchronize it. + +Input Processing in the Forms Driver + + The function form_driver() handles virtualized input requests for form + navigation, editing, and validation requests, just as menu_driver does + for menus (see the section on menu input handling). +int form_driver(FORM *form, /* form to pass input to */ + int request); /* form request code */ + + Your input virtualization function needs to take input and then + convert it to either an alphanumeric character (which is treated as + data to be entered in the currently-selected field), or a forms + processing request. + + The forms driver provides hooks (through input-validation and + field-termination functions) with which your application code can + check that the input taken by the driver matched what was expected. + + Page Navigation Requests + + These requests cause page-level moves through the form, triggering + display of a new form screen. + + REQ_NEXT_PAGE + Move to the next form page. + + REQ_PREV_PAGE + Move to the previous form page. + + REQ_FIRST_PAGE + Move to the first form page. + + REQ_LAST_PAGE + Move to the last form page. + + These requests treat the list as cyclic; that is, REQ_NEXT_PAGE from + the last page goes to the first, and REQ_PREV_PAGE from the first page + goes to the last. + + Inter-Field Navigation Requests + + These requests handle navigation between fields on the same page. + + REQ_NEXT_FIELD + Move to next field. + + REQ_PREV_FIELD + Move to previous field. + + REQ_FIRST_FIELD + Move to the first field. + + REQ_LAST_FIELD + Move to the last field. + + REQ_SNEXT_FIELD + Move to sorted next field. + + REQ_SPREV_FIELD + Move to sorted previous field. + + REQ_SFIRST_FIELD + Move to the sorted first field. + + REQ_SLAST_FIELD + Move to the sorted last field. + + REQ_LEFT_FIELD + Move left to field. + + REQ_RIGHT_FIELD + Move right to field. + + REQ_UP_FIELD + Move up to field. + + REQ_DOWN_FIELD + Move down to field. + + These requests treat the list of fields on a page as cyclic; that is, + REQ_NEXT_FIELD from the last field goes to the first, and + REQ_PREV_FIELD from the first field goes to the last. The order of the + fields for these (and the REQ_FIRST_FIELD and REQ_LAST_FIELD requests) + is simply the order of the field pointers in the form array (as set up + by new_form() or set_form_fields() + + It is also possible to traverse the fields as if they had been sorted + in screen-position order, so the sequence goes left-to-right and + top-to-bottom. To do this, use the second group of four + sorted-movement requests. + + Finally, it is possible to move between fields using visual directions + up, down, right, and left. To accomplish this, use the third group of + four requests. Note, however, that the position of a form for purposes + of these requests is its upper-left corner. + + For example, suppose you have a multi-line field B, and two + single-line fields A and C on the same line with B, with A to the left + of B and C to the right of B. A REQ_MOVE_RIGHT from A will go to B + only if A, B, and C all share the same first line; otherwise it will + skip over B to C. + + Intra-Field Navigation Requests + + These requests drive movement of the edit cursor within the currently + selected field. + + REQ_NEXT_CHAR + Move to next character. + + REQ_PREV_CHAR + Move to previous character. + + REQ_NEXT_LINE + Move to next line. + + REQ_PREV_LINE + Move to previous line. + + REQ_NEXT_WORD + Move to next word. + + REQ_PREV_WORD + Move to previous word. + + REQ_BEG_FIELD + Move to beginning of field. + + REQ_END_FIELD + Move to end of field. + + REQ_BEG_LINE + Move to beginning of line. + + REQ_END_LINE + Move to end of line. + + REQ_LEFT_CHAR + Move left in field. + + REQ_RIGHT_CHAR + Move right in field. + + REQ_UP_CHAR + Move up in field. + + REQ_DOWN_CHAR + Move down in field. + + Each word is separated from the previous and next characters by + whitespace. The commands to move to beginning and end of line or field + look for the first or last non-pad character in their ranges. + + Scrolling Requests + + Fields that are dynamic and have grown and fields explicitly created + with offscreen rows are scrollable. One-line fields scroll + horizontally; multi-line fields scroll vertically. Most scrolling is + triggered by editing and intra-field movement (the library scrolls the + field to keep the cursor visible). It is possible to explicitly + request scrolling with the following requests: + + REQ_SCR_FLINE + Scroll vertically forward a line. + + REQ_SCR_BLINE + Scroll vertically backward a line. + + REQ_SCR_FPAGE + Scroll vertically forward a page. + + REQ_SCR_BPAGE + Scroll vertically backward a page. + + REQ_SCR_FHPAGE + Scroll vertically forward half a page. + + REQ_SCR_BHPAGE + Scroll vertically backward half a page. + + REQ_SCR_FCHAR + Scroll horizontally forward a character. + + REQ_SCR_BCHAR + Scroll horizontally backward a character. + + REQ_SCR_HFLINE + Scroll horizontally one field width forward. + + REQ_SCR_HBLINE + Scroll horizontally one field width backward. + + REQ_SCR_HFHALF + Scroll horizontally one half field width forward. + + REQ_SCR_HBHALF + Scroll horizontally one half field width backward. + + For scrolling purposes, a page of a field is the height of its visible + part. + + Editing Requests + + When you pass the forms driver an ASCII character, it is treated as a + request to add the character to the field's data buffer. Whether this + is an insertion or a replacement depends on the field's edit mode + (insertion is the default. + + The following requests support editing the field and changing the edit + mode: + + REQ_INS_MODE + Set insertion mode. + + REQ_OVL_MODE + Set overlay mode. + + REQ_NEW_LINE + New line request (see below for explanation). + + REQ_INS_CHAR + Insert space at character location. + + REQ_INS_LINE + Insert blank line at character location. + + REQ_DEL_CHAR + Delete character at cursor. + + REQ_DEL_PREV + Delete previous word at cursor. + + REQ_DEL_LINE + Delete line at cursor. + + REQ_DEL_WORD + Delete word at cursor. + + REQ_CLR_EOL + Clear to end of line. + + REQ_CLR_EOF + Clear to end of field. + + REQ_CLEAR_FIELD + Clear entire field. + + The behavior of the REQ_NEW_LINE and REQ_DEL_PREV requests is + complicated and partly controlled by a pair of forms options. The + special cases are triggered when the cursor is at the beginning of a + field, or on the last line of the field. + + First, we consider REQ_NEW_LINE: + + The normal behavior of REQ_NEW_LINE in insert mode is to break the + current line at the position of the edit cursor, inserting the portion + of the current line after the cursor as a new line following the + current and moving the cursor to the beginning of that new line (you + may think of this as inserting a newline in the field buffer). + + The normal behavior of REQ_NEW_LINE in overlay mode is to clear the + current line from the position of the edit cursor to end of line. The + cursor is then moved to the beginning of the next line. + + However, REQ_NEW_LINE at the beginning of a field, or on the last line + of a field, instead does a REQ_NEXT_FIELD. O_NL_OVERLOAD option is + off, this special action is disabled. + + Now, let us consider REQ_DEL_PREV: + + The normal behavior of REQ_DEL_PREV is to delete the previous + character. If insert mode is on, and the cursor is at the start of a + line, and the text on that line will fit on the previous one, it + instead appends the contents of the current line to the previous one + and deletes the current line (you may think of this as deleting a + newline from the field buffer). + + However, REQ_DEL_PREV at the beginning of a field is instead treated + as a REQ_PREV_FIELD. + + If the O_BS_OVERLOAD option is off, this special action is disabled + and the forms driver just returns E_REQUEST_DENIED. + + See Form Options for discussion of how to set and clear the overload + options. + + Order Requests + + If the type of your field is ordered, and has associated functions for + getting the next and previous values of the type from a given value, + there are requests that can fetch that value into the field buffer: + + REQ_NEXT_CHOICE + Place the successor value of the current value in the buffer. + + REQ_PREV_CHOICE + Place the predecessor value of the current value in the buffer. + + Of the built-in field types, only TYPE_ENUM has built-in successor and + predecessor functions. When you define a field type of your own (see + Custom Validation Types), you can associate our own ordering + functions. + + Application Commands + + Form requests are represented as integers above the curses value + greater than KEY_MAX and less than or equal to the constant + MAX_COMMAND. If your input-virtualization routine returns a value + above MAX_COMMAND, the forms driver will ignore it. + +Field Change Hooks + + It is possible to set function hooks to be executed whenever the + current field or form changes. Here are the functions that support + this: +typedef void (*HOOK)(); /* pointer to function returning void */ + +int set_form_init(FORM *form, /* form to alter */ + HOOK hook); /* initialization hook */ + +HOOK form_init(FORM *form); /* form to query */ + +int set_form_term(FORM *form, /* form to alter */ + HOOK hook); /* termination hook */ + +HOOK form_term(FORM *form); /* form to query */ + +int set_field_init(FORM *form, /* form to alter */ + HOOK hook); /* initialization hook */ + +HOOK field_init(FORM *form); /* form to query */ + +int set_field_term(FORM *form, /* form to alter */ + HOOK hook); /* termination hook */ + +HOOK field_term(FORM *form); /* form to query */ + + These functions allow you to either set or query four different hooks. + In each of the set functions, the second argument should be the + address of a hook function. These functions differ only in the timing + of the hook call. + + form_init + This hook is called when the form is posted; also, just after + each page change operation. + + field_init + This hook is called when the form is posted; also, just after + each field change + + field_term + This hook is called just after field validation; that is, just + before the field is altered. It is also called when the form is + unposted. + + form_term + This hook is called when the form is unposted; also, just + before each page change operation. + + Calls to these hooks may be triggered + 1. When user editing requests are processed by the forms driver + 2. When the current page is changed by set_current_field() call + 3. When the current field is changed by a set_form_page() call + + See Field Change Commands for discussion of the latter two cases. + + You can set a default hook for all fields by passing one of the set + functions a NULL first argument. + + You can disable any of these hooks by (re)setting them to NULL, the + default value. + +Field Change Commands + + Normally, navigation through the form will be driven by the user's + input requests. But sometimes it is useful to be able to move the + focus for editing and viewing under control of your application, or + ask which field it currently is in. The following functions help you + accomplish this: +int set_current_field(FORM *form, /* form to alter */ + FIELD *field); /* field to shift to */ + +FIELD *current_field(FORM *form); /* form to query */ + +int field_index(FORM *form, /* form to query */ + FIELD *field); /* field to get index of */ + + The function field_index() returns the index of the given field in the + given form's field array (the array passed to new_form() or + set_form_fields()). + + The initial current field of a form is the first active field on the + first page. The function set_form_fields() resets this. + + It is also possible to move around by pages. +int set_form_page(FORM *form, /* form to alter */ + int page); /* page to go to (0-origin) */ + +int form_page(FORM *form); /* return form's current page */ + + The initial page of a newly-created form is 0. The function + set_form_fields() resets this. + +Form Options + + Like fields, forms may have control option bits. They can be changed + or queried with these functions: +int set_form_opts(FORM *form, /* form to alter */ + int attr); /* attribute to set */ + +int form_opts_on(FORM *form, /* form to alter */ + int attr); /* attributes to turn on */ + +int form_opts_off(FORM *form, /* form to alter */ + int attr); /* attributes to turn off */ + +int form_opts(FORM *form); /* form to query */ + + By default, all options are on. Here are the available option bits: + + O_NL_OVERLOAD + Enable overloading of REQ_NEW_LINE as described in Editing + Requests. The value of this option is ignored on dynamic fields + that have not reached their size limit; these have no last + line, so the circumstances for triggering a REQ_NEXT_FIELD + never arise. + + O_BS_OVERLOAD + Enable overloading of REQ_DEL_PREV as described in Editing + Requests. + + The option values are bit-masks and can be composed with logical-or in + the obvious way. + +Custom Validation Types + + The form library gives you the capability to define custom validation + types of your own. Further, the optional additional arguments of + set_field_type effectively allow you to parameterize validation types. + Most of the complications in the validation-type interface have to do + with the handling of the additional arguments within custom validation + functions. + + Union Types + + The simplest way to create a custom data type is to compose it from + two preexisting ones: +FIELD *link_fieldtype(FIELDTYPE *type1, + FIELDTYPE *type2); + + This function creates a field type that will accept any of the values + legal for either of its argument field types (which may be either + predefined or programmer-defined). If a set_field_type() call later + requires arguments, the new composite type expects all arguments for + the first type, than all arguments for the second. Order functions + (see Order Requests) associated with the component types will work on + the composite; what it does is check the validation function for the + first type, then for the second, to figure what type the buffer + contents should be treated as. + + New Field Types + + To create a field type from scratch, you need to specify one or both + of the following things: + * A character-validation function, to check each character as it is + entered. + * A field-validation function to be applied on exit from the field. + + Here's how you do that: +typedef int (*HOOK)(); /* pointer to function returning int */ + +FIELDTYPE *new_fieldtype(HOOK f_validate, /* field validator */ + HOOK c_validate) /* character validator */ + + +int free_fieldtype(FIELDTYPE *ftype); /* type to free */ + + At least one of the arguments of new_fieldtype() must be non-NULL. The + forms driver will automatically call the new type's validation + functions at appropriate points in processing a field of the new type. + + The function free_fieldtype() deallocates the argument fieldtype, + freeing all storage associated with it. + + Normally, a field validator is called when the user attempts to leave + the field. Its first argument is a field pointer, from which it can + get to field buffer 0 and test it. If the function returns TRUE, the + operation succeeds; if it returns FALSE, the edit cursor stays in the + field. + + A character validator gets the character passed in as a first + argument. It too should return TRUE if the character is valid, FALSE + otherwise. + + Validation Function Arguments + + Your field- and character- validation functions will be passed a + second argument as well. This second argument is the address of a + structure (which we'll call a pile) built from any of the + field-type-specific arguments passed to set_field_type(). If no such + arguments are defined for the field type, this pile pointer argument + will be NULL. + + In order to arrange for such arguments to be passed to your validation + functions, you must associate a small set of storage-management + functions with the type. The forms driver will use these to synthesize + a pile from the trailing arguments of each set_field_type() argument, + and a pointer to the pile will be passed to the validation functions. + + Here is how you make the association: +typedef char *(*PTRHOOK)(); /* pointer to function returning (char *) */ +typedef void (*VOIDHOOK)(); /* pointer to function returning void */ + +int set_fieldtype_arg(FIELDTYPE *type, /* type to alter */ + PTRHOOK make_str, /* make structure from args */ + PTRHOOK copy_str, /* make copy of structure */ + VOIDHOOK free_str); /* free structure storage */ + + Here is how the storage-management hooks are used: + + make_str + This function is called by set_field_type(). It gets one + argument, a va_list of the type-specific arguments passed to + set_field_type(). It is expected to return a pile pointer to a + data structure that encapsulates those arguments. + + copy_str + This function is called by form library functions that allocate + new field instances. It is expected to take a pile pointer, + copy the pile to allocated storage, and return the address of + the pile copy. + + free_str + This function is called by field- and type-deallocation + routines in the library. It takes a pile pointer argument, and + is expected to free the storage of that pile. + + The make_str and copy_str functions may return NULL to signal + allocation failure. The library routines will that call them will + return error indication when this happens. Thus, your validation + functions should never see a NULL file pointer and need not check + specially for it. + + Order Functions For Custom Types + + Some custom field types are simply ordered in the same well-defined + way that TYPE_ENUM is. For such types, it is possible to define + successor and predecessor functions to support the REQ_NEXT_CHOICE and + REQ_PREV_CHOICE requests. Here's how: +typedef int (*INTHOOK)(); /* pointer to function returning int */ + +int set_fieldtype_arg(FIELDTYPE *type, /* type to alter */ + INTHOOK succ, /* get successor value */ + INTHOOK pred); /* get predecessor value */ + + The successor and predecessor arguments will each be passed two + arguments; a field pointer, and a pile pointer (as for the validation + functions). They are expected to use the function field_buffer() to + read the current value, and set_field_buffer() on buffer 0 to set the + next or previous value. Either hook may return TRUE to indicate + success (a legal next or previous value was set) or FALSE to indicate + failure. + + Avoiding Problems + + The interface for defining custom types is complicated and tricky. + Rather than attempting to create a custom type entirely from scratch, + you should start by studying the library source code for whichever of + the pre-defined types seems to be closest to what you want. + + Use that code as a model, and evolve it towards what you really want. + You will avoid many problems and annoyances that way. The code in the + ncurses library has been specifically exempted from the package + copyright to support this. + + If your custom type defines order functions, have do something + intuitive with a blank field. A useful convention is to make the + successor of a blank field the types minimum value, and its + predecessor the maximum. diff --git a/contrib/ncurses/form/Makefile.in b/contrib/ncurses/form/Makefile.in index 9c40f8aade58..8f3f2976e407 100644 --- a/contrib/ncurses/form/Makefile.in +++ b/contrib/ncurses/form/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.30 2000/08/26 21:51:44 tom Exp $ +# $Id: Makefile.in,v 1.32 2001/03/24 19:53:31 tom Exp $ ############################################################################## -# Copyright (c) 1998-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"), # @@ -53,6 +53,8 @@ exec_prefix = @exec_prefix@ libdir = @libdir@ includedir = @includedir@ +LIBTOOL = @LIBTOOL@ + INSTALL = @INSTALL@ INSTALL_LIB = @INSTALL@ @INSTALL_LIB@ INSTALL_DATA = @INSTALL_DATA@ @@ -72,6 +74,7 @@ CPPFLAGS = @CPPFLAGS@ \ CCFLAGS = $(CPPFLAGS) $(CFLAGS) +CFLAGS_LIBTOOL = $(CCFLAGS) CFLAGS_NORMAL = $(CCFLAGS) CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE CFLAGS_PROFILE = $(CCFLAGS) -pg @@ -79,7 +82,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) @@ -87,6 +90,8 @@ SHLIB_LIST = $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_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@ @@ -131,7 +136,7 @@ tags: @MAKE_UPPER_TAGS@ etags *.[ch] mostlyclean :: - -rm -f core tags TAGS *~ *.ln *.atac trace + -rm -f core tags TAGS *~ *.i *.ln *.atac trace clean :: mostlyclean -rm -f $(AUTO_SRC) diff --git a/contrib/ncurses/form/fld_arg.c b/contrib/ncurses/form/fld_arg.c index bc816e9efd0f..dcbae596035e 100644 --- a/contrib/ncurses/form/fld_arg.c +++ b/contrib/ncurses/form/fld_arg.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 "form.priv.h" -MODULE_ID("$Id: fld_arg.c,v 1.4 1999/05/16 17:16:04 juergen Exp $") +MODULE_ID("$Id: fld_arg.c,v 1.5 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -60,10 +60,12 @@ MODULE_ID("$Id: fld_arg.c,v 1.4 1999/05/16 17:16:04 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid argument +--------------------------------------------------------------------------*/ -int set_fieldtype_arg(FIELDTYPE * typ, - void * (* const make_arg)(va_list *), - void * (* const copy_arg)(const void *), - void (* const free_arg)(void *)) +NCURSES_EXPORT(int) +set_fieldtype_arg + (FIELDTYPE * typ, + void * (* const make_arg)(va_list *), + void * (* const copy_arg)(const void *), + void (* const free_arg)(void *)) { if ( !typ || !make_arg ) RETURN(E_BAD_ARGUMENT); @@ -83,7 +85,8 @@ int set_fieldtype_arg(FIELDTYPE * typ, | | Return Values : Pointer to structure or NULL if none is defined. +--------------------------------------------------------------------------*/ -void *field_arg(const FIELD * field) +NCURSES_EXPORT(void *) +field_arg (const FIELD * field) { return Normalize_Field(field)->arg; } diff --git a/contrib/ncurses/form/fld_attr.c b/contrib/ncurses/form/fld_attr.c index 3c7d8e353c0e..cd584d048427 100644 --- a/contrib/ncurses/form/fld_attr.c +++ b/contrib/ncurses/form/fld_attr.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,14 +31,14 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: fld_attr.c,v 1.4 1999/05/16 17:16:30 juergen Exp $") +MODULE_ID("$Id: fld_attr.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*---------------------------------------------------------------------------- Field-Attribute manipulation routines --------------------------------------------------------------------------*/ /* "Template" macro to generate a function to set a fields attribute */ #define GEN_FIELD_ATTR_SET_FCT( name ) \ -int set_field_ ## name (FIELD * field, chtype attr)\ +NCURSES_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\ {\ int res = E_BAD_ARGUMENT;\ if ( attr==A_NORMAL || ((attr & A_ATTRIBUTES)==attr) )\ @@ -57,7 +57,7 @@ int set_field_ ## name (FIELD * field, chtype attr)\ /* "Template" macro to generate a function to get a fields attribute */ #define GEN_FIELD_ATTR_GET_FCT( name ) \ -chtype field_ ## name (const FIELD * field)\ +NCURSES_IMPEXP chtype NCURSES_API field_ ## name (const FIELD * field)\ {\ return ( A_ATTRIBUTES & (Normalize_Field( field ) -> name) );\ } diff --git a/contrib/ncurses/form/fld_current.c b/contrib/ncurses/form/fld_current.c index 2bf8163a43f7..b23d21ca1dc1 100644 --- a/contrib/ncurses/form/fld_current.c +++ b/contrib/ncurses/form/fld_current.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,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: fld_current.c,v 1.4 1999/05/16 17:16:46 juergen Exp $") +MODULE_ID("$Id: fld_current.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,7 +46,8 @@ MODULE_ID("$Id: fld_current.c,v 1.4 1999/05/16 17:16:46 juergen Exp $") | E_INVALID_FIELD - current field can't be left | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int set_current_field(FORM * form, FIELD * field) +NCURSES_EXPORT(int) +set_current_field (FORM * form, FIELD * field) { int err = E_OK; @@ -101,7 +102,8 @@ int set_current_field(FORM * form, FIELD * field) | | Return Values : Pointer to the current field. +--------------------------------------------------------------------------*/ -FIELD *current_field(const FORM * form) +NCURSES_EXPORT(FIELD *) +current_field (const FORM * form) { return Normalize_Form(form)->current; } @@ -116,7 +118,8 @@ FIELD *current_field(const FORM * form) | Return Values : >= 0 : field index | -1 : fieldpointer invalid or field not connected +--------------------------------------------------------------------------*/ -int field_index(const FIELD * field) +NCURSES_EXPORT(int) +field_index (const FIELD * field) { return ( (field && field->form) ? field->index : -1 ); } diff --git a/contrib/ncurses/form/fld_def.c b/contrib/ncurses/form/fld_def.c index dd3de804688b..e12179e35d55 100644 --- a/contrib/ncurses/form/fld_def.c +++ b/contrib/ncurses/form/fld_def.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 "form.priv.h" -MODULE_ID("$Id: fld_def.c,v 1.12 1999/05/16 17:37:48 juergen Exp $") +MODULE_ID("$Id: fld_def.c,v 1.13 2000/12/10 02:09:38 tom Exp $") /* this can't be readonly */ static FIELD default_field = { @@ -63,7 +63,7 @@ static FIELD default_field = { (char *)0 /* usrptr */ }; -FIELD *_nc_Default_Field = &default_field; +NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field; /*--------------------------------------------------------------------------- | Facility : libnform @@ -79,8 +79,9 @@ FIELD *_nc_Default_Field = &default_field; | Return Values : Pointer to argument structure. Maybe NULL. | In case of an error in *err an errorcounter is increased. +--------------------------------------------------------------------------*/ -TypeArgument* -_nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err) +NCURSES_EXPORT(TypeArgument*) +_nc_Make_Argument +(const FIELDTYPE *typ, va_list *ap, int *err) { TypeArgument *res = (TypeArgument *)0; TypeArgument *p; @@ -121,9 +122,10 @@ _nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err) | Return Values : Pointer to argument structure. Maybe NULL. | In case of an error in *err an errorcounter is increased. +--------------------------------------------------------------------------*/ -TypeArgument* -_nc_Copy_Argument(const FIELDTYPE *typ, - const TypeArgument *argp, int *err) +NCURSES_EXPORT(TypeArgument*) +_nc_Copy_Argument + (const FIELDTYPE *typ, + const TypeArgument *argp, int *err) { TypeArgument *res = (TypeArgument *)0; TypeArgument *p; @@ -166,8 +168,9 @@ _nc_Copy_Argument(const FIELDTYPE *typ, | | Return Values : - +--------------------------------------------------------------------------*/ -void -_nc_Free_Argument(const FIELDTYPE * typ, TypeArgument * argp) +NCURSES_EXPORT(void) +_nc_Free_Argument +(const FIELDTYPE * typ, TypeArgument * argp) { if (!typ || !(typ->status & _HAS_ARGS)) return; @@ -195,8 +198,9 @@ _nc_Free_Argument(const FIELDTYPE * typ, TypeArgument * argp) | Return Values : TRUE - copy worked | FALSE - error occured +--------------------------------------------------------------------------*/ -bool -_nc_Copy_Type(FIELD *dst, FIELD const *src) +NCURSES_EXPORT(bool) +_nc_Copy_Type +(FIELD *dst, FIELD const *src) { int err = 0; @@ -228,8 +232,8 @@ _nc_Copy_Type(FIELD *dst, FIELD const *src) | | Return Values : - +--------------------------------------------------------------------------*/ -void -_nc_Free_Type(FIELD *field) +NCURSES_EXPORT(void) +_nc_Free_Type (FIELD *field) { assert(field); if (field->type) @@ -253,7 +257,9 @@ _nc_Free_Type(FIELD *field) | | Return Values : Pointer to the new field or NULL if failure. +--------------------------------------------------------------------------*/ -FIELD *new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) +NCURSES_EXPORT(FIELD *) +new_field +(int rows, int cols, int frow, int fcol, int nrow, int nbuf) { FIELD *New_Field = (FIELD *)0; int err = E_BAD_ARGUMENT; @@ -317,7 +323,8 @@ FIELD *new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) | E_BAD_ARGUMENT - invalid field pointer | E_CONNECTED - field is connected +--------------------------------------------------------------------------*/ -int free_field(FIELD * field) +NCURSES_EXPORT(int) +free_field (FIELD * field) { if (!field) RETURN(E_BAD_ARGUMENT); diff --git a/contrib/ncurses/form/fld_dup.c b/contrib/ncurses/form/fld_dup.c index d265f958f218..4aed77292d64 100644 --- a/contrib/ncurses/form/fld_dup.c +++ b/contrib/ncurses/form/fld_dup.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 "form.priv.h" -MODULE_ID("$Id: fld_dup.c,v 1.4 1999/05/16 17:17:08 juergen Exp $") +MODULE_ID("$Id: fld_dup.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -47,7 +47,8 @@ MODULE_ID("$Id: fld_dup.c,v 1.4 1999/05/16 17:17:08 juergen Exp $") | | Return Values : Pointer to the new field or NULL if failure +--------------------------------------------------------------------------*/ -FIELD *dup_field(FIELD * field, int frow, int fcol) +NCURSES_EXPORT(FIELD *) +dup_field (FIELD * field, int frow, int fcol) { FIELD *New_Field = (FIELD *)0; int err = E_BAD_ARGUMENT; diff --git a/contrib/ncurses/form/fld_ftchoice.c b/contrib/ncurses/form/fld_ftchoice.c index 8e7d2a9683f1..377f9abdb923 100644 --- a/contrib/ncurses/form/fld_ftchoice.c +++ b/contrib/ncurses/form/fld_ftchoice.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 "form.priv.h" -MODULE_ID("$Id: fld_ftchoice.c,v 1.4 1999/05/16 17:17:21 juergen Exp $") +MODULE_ID("$Id: fld_ftchoice.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,9 +46,11 @@ MODULE_ID("$Id: fld_ftchoice.c,v 1.4 1999/05/16 17:17:21 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid arguments +--------------------------------------------------------------------------*/ -int set_fieldtype_choice(FIELDTYPE * typ, - bool (* const next_choice) (FIELD *,const void *), - bool (* const prev_choice) (FIELD *,const void *)) +NCURSES_EXPORT(int) +set_fieldtype_choice + (FIELDTYPE * typ, + bool (* const next_choice) (FIELD *,const void *), + bool (* const prev_choice) (FIELD *,const void *)) { if ( !typ || !next_choice || !prev_choice ) RETURN(E_BAD_ARGUMENT); diff --git a/contrib/ncurses/form/fld_ftlink.c b/contrib/ncurses/form/fld_ftlink.c index 1c30cab244a4..87aa661a8069 100644 --- a/contrib/ncurses/form/fld_ftlink.c +++ b/contrib/ncurses/form/fld_ftlink.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 "form.priv.h" -MODULE_ID("$Id: fld_ftlink.c,v 1.4 1999/05/16 17:17:33 juergen Exp $") +MODULE_ID("$Id: fld_ftlink.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -48,7 +48,9 @@ MODULE_ID("$Id: fld_ftlink.c,v 1.4 1999/05/16 17:17:33 juergen Exp $") | | Return Values : Fieldtype pointer or NULL if error occured. +--------------------------------------------------------------------------*/ -FIELDTYPE *link_fieldtype(FIELDTYPE * type1, FIELDTYPE * type2) +NCURSES_EXPORT(FIELDTYPE *) +link_fieldtype +(FIELDTYPE * type1, FIELDTYPE * type2) { FIELDTYPE *nftyp = (FIELDTYPE *)0; diff --git a/contrib/ncurses/form/fld_info.c b/contrib/ncurses/form/fld_info.c index 98100a4f40a2..be4fd0645973 100644 --- a/contrib/ncurses/form/fld_info.c +++ b/contrib/ncurses/form/fld_info.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 "form.priv.h" -MODULE_ID("$Id: fld_info.c,v 1.4 1999/05/16 17:17:52 juergen Exp $") +MODULE_ID("$Id: fld_info.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,10 +46,12 @@ MODULE_ID("$Id: fld_info.c,v 1.4 1999/05/16 17:17:52 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid field pointer +--------------------------------------------------------------------------*/ -int field_info(const FIELD *field, - int *rows, int *cols, - int *frow, int *fcol, - int *nrow, int *nbuf) +NCURSES_EXPORT(int) +field_info + (const FIELD *field, + int *rows, int *cols, + int *frow, int *fcol, + int *nrow, int *nbuf) { if (!field) RETURN(E_BAD_ARGUMENT); @@ -75,8 +77,9 @@ int field_info(const FIELD *field, | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid argument +--------------------------------------------------------------------------*/ -int dynamic_field_info(const FIELD *field, - int *drows, int *dcols, int *maxgrow) +NCURSES_EXPORT(int) +dynamic_field_info +(const FIELD *field, int *drows, int *dcols, int *maxgrow) { if (!field) RETURN(E_BAD_ARGUMENT); diff --git a/contrib/ncurses/form/fld_just.c b/contrib/ncurses/form/fld_just.c index 2a6dd38ec390..a30f2f9d0c02 100644 --- a/contrib/ncurses/form/fld_just.c +++ b/contrib/ncurses/form/fld_just.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 "form.priv.h" -MODULE_ID("$Id: fld_just.c,v 1.5 1999/05/16 17:18:06 juergen Exp $") +MODULE_ID("$Id: fld_just.c,v 1.6 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -44,7 +44,8 @@ MODULE_ID("$Id: fld_just.c,v 1.5 1999/05/16 17:18:06 juergen Exp $") | E_BAD_ARGUMENT - one of the arguments was incorrect | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int set_field_just(FIELD * field, int just) +NCURSES_EXPORT(int) +set_field_just (FIELD * field, int just) { int res = E_BAD_ARGUMENT; @@ -73,7 +74,8 @@ int set_field_just(FIELD * field, int just) | | Return Values : The justification type. +--------------------------------------------------------------------------*/ -int field_just(const FIELD * field) +NCURSES_EXPORT(int) +field_just (const FIELD * field) { return Normalize_Field( field )->just; } diff --git a/contrib/ncurses/form/fld_link.c b/contrib/ncurses/form/fld_link.c index 4352d6abf083..0b0a033068f2 100644 --- a/contrib/ncurses/form/fld_link.c +++ b/contrib/ncurses/form/fld_link.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 "form.priv.h" -MODULE_ID("$Id: fld_link.c,v 1.4 1999/05/16 17:18:18 juergen Exp $") +MODULE_ID("$Id: fld_link.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -48,7 +48,8 @@ MODULE_ID("$Id: fld_link.c,v 1.4 1999/05/16 17:18:18 juergen Exp $") | | Return Values : Pointer to the new field or NULL if failure +--------------------------------------------------------------------------*/ -FIELD *link_field(FIELD * field, int frow, int fcol) +NCURSES_EXPORT(FIELD *) +link_field (FIELD * field, int frow, int fcol) { FIELD *New_Field = (FIELD *)0; int err = E_BAD_ARGUMENT; diff --git a/contrib/ncurses/form/fld_max.c b/contrib/ncurses/form/fld_max.c index f17bcec5a478..2e5e2389b32b 100644 --- a/contrib/ncurses/form/fld_max.c +++ b/contrib/ncurses/form/fld_max.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 "form.priv.h" -MODULE_ID("$Id: fld_max.c,v 1.4 1999/05/16 17:18:34 juergen Exp $") +MODULE_ID("$Id: fld_max.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -44,7 +44,8 @@ MODULE_ID("$Id: fld_max.c,v 1.4 1999/05/16 17:18:34 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid argument +--------------------------------------------------------------------------*/ -int set_max_field(FIELD *field, int maxgrow) +NCURSES_EXPORT(int) +set_max_field (FIELD *field, int maxgrow) { if (!field || (maxgrow<0)) RETURN(E_BAD_ARGUMENT); diff --git a/contrib/ncurses/form/fld_move.c b/contrib/ncurses/form/fld_move.c index 7965d5afbea8..fc3715685cad 100644 --- a/contrib/ncurses/form/fld_move.c +++ b/contrib/ncurses/form/fld_move.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 "form.priv.h" -MODULE_ID("$Id: fld_move.c,v 1.4 1999/05/16 17:38:51 juergen Exp $") +MODULE_ID("$Id: fld_move.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -45,7 +45,8 @@ MODULE_ID("$Id: fld_move.c,v 1.4 1999/05/16 17:38:51 juergen Exp $") | E_BAD_ARGUMENT - invalid argument passed | E_CONNECTED - field is connected +--------------------------------------------------------------------------*/ -int move_field(FIELD *field, int frow, int fcol) +NCURSES_EXPORT(int) +move_field (FIELD *field, int frow, int fcol) { if ( !field || (frow<0) || (fcol<0) ) RETURN(E_BAD_ARGUMENT); diff --git a/contrib/ncurses/form/fld_newftyp.c b/contrib/ncurses/form/fld_newftyp.c index 68b1692a2ab8..e0c8b33114c3 100644 --- a/contrib/ncurses/form/fld_newftyp.c +++ b/contrib/ncurses/form/fld_newftyp.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 "form.priv.h" -MODULE_ID("$Id: fld_newftyp.c,v 1.5 1999/05/16 17:18:54 juergen Exp $") +MODULE_ID("$Id: fld_newftyp.c,v 1.6 2000/12/10 02:09:38 tom Exp $") static FIELDTYPE const default_fieldtype = { 0, /* status */ @@ -48,7 +48,7 @@ static FIELDTYPE const default_fieldtype = { NULL /* enumerate previous function */ }; -const FIELDTYPE* _nc_Default_FieldType = &default_fieldtype; +NCURSES_EXPORT_VAR(const FIELDTYPE*) _nc_Default_FieldType = &default_fieldtype; /*--------------------------------------------------------------------------- | Facility : libnform @@ -65,7 +65,8 @@ const FIELDTYPE* _nc_Default_FieldType = &default_fieldtype; | | Return Values : Fieldtype pointer or NULL if error occured +--------------------------------------------------------------------------*/ -FIELDTYPE *new_fieldtype( +NCURSES_EXPORT(FIELDTYPE *) +new_fieldtype ( bool (* const field_check)(FIELD *,const void *), bool (* const char_check) (int,const void *) ) { @@ -102,7 +103,8 @@ FIELDTYPE *new_fieldtype( | E_CONNECTED - there are fields referencing the type | E_BAD_ARGUMENT - invalid fieldtype pointer +--------------------------------------------------------------------------*/ -int free_fieldtype(FIELDTYPE *typ) +NCURSES_EXPORT(int) +free_fieldtype (FIELDTYPE *typ) { if (!typ) RETURN(E_BAD_ARGUMENT); diff --git a/contrib/ncurses/form/fld_opts.c b/contrib/ncurses/form/fld_opts.c index e5cd996d06b5..19b3642af6d4 100644 --- a/contrib/ncurses/form/fld_opts.c +++ b/contrib/ncurses/form/fld_opts.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,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: fld_opts.c,v 1.6 1999/05/16 17:19:06 juergen Exp $") +MODULE_ID("$Id: fld_opts.c,v 1.7 2000/12/10 02:09:38 tom Exp $") /*---------------------------------------------------------------------------- Field-Options manipulation routines @@ -49,7 +49,8 @@ MODULE_ID("$Id: fld_opts.c,v 1.6 1999/05/16 17:19:06 juergen Exp $") | E_BAD_ARGUMENT - invalid options | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int set_field_opts(FIELD * field, Field_Options opts) +NCURSES_EXPORT(int) +set_field_opts (FIELD * field, Field_Options opts) { int res = E_BAD_ARGUMENT; opts &= ALL_FIELD_OPTS; @@ -66,7 +67,8 @@ int set_field_opts(FIELD * field, Field_Options opts) | | Return Values : The options. +--------------------------------------------------------------------------*/ -Field_Options field_opts(const FIELD * field) +NCURSES_EXPORT(Field_Options) +field_opts (const FIELD * field) { return ALL_FIELD_OPTS & Normalize_Field( field )->opts; } @@ -83,7 +85,8 @@ Field_Options field_opts(const FIELD * field) | E_BAD_ARGUMENT - invalid options | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int field_opts_on(FIELD * field, Field_Options opts) +NCURSES_EXPORT(int) +field_opts_on (FIELD * field, Field_Options opts) { int res = E_BAD_ARGUMENT; @@ -108,7 +111,8 @@ int field_opts_on(FIELD * field, Field_Options opts) | E_BAD_ARGUMENT - invalid options | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int field_opts_off(FIELD * field, Field_Options opts) +NCURSES_EXPORT(int) +field_opts_off (FIELD * field, Field_Options opts) { int res = E_BAD_ARGUMENT; diff --git a/contrib/ncurses/form/fld_pad.c b/contrib/ncurses/form/fld_pad.c index 527e151198b7..f4556b2a7130 100644 --- a/contrib/ncurses/form/fld_pad.c +++ b/contrib/ncurses/form/fld_pad.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,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: fld_pad.c,v 1.4 1999/05/16 17:38:58 juergen Exp $") +MODULE_ID("$Id: fld_pad.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -44,7 +44,8 @@ MODULE_ID("$Id: fld_pad.c,v 1.4 1999/05/16 17:38:58 juergen Exp $") | E_BAD_ARGUMENT - invalid field pointer or pad character | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int set_field_pad(FIELD * field, int ch) +NCURSES_EXPORT(int) +set_field_pad (FIELD * field, int ch) { int res = E_BAD_ARGUMENT; @@ -70,7 +71,8 @@ int set_field_pad(FIELD * field, int ch) | | Return Values : The pad character. +--------------------------------------------------------------------------*/ -int field_pad(const FIELD * field) +NCURSES_EXPORT(int) +field_pad (const FIELD * field) { return Normalize_Field( field )->pad; } diff --git a/contrib/ncurses/form/fld_page.c b/contrib/ncurses/form/fld_page.c index 452a507cca78..b6ddbc7b73f2 100644 --- a/contrib/ncurses/form/fld_page.c +++ b/contrib/ncurses/form/fld_page.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 "form.priv.h" -MODULE_ID("$Id: fld_page.c,v 1.4 1999/05/16 17:19:37 juergen Exp $") +MODULE_ID("$Id: fld_page.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -44,7 +44,8 @@ MODULE_ID("$Id: fld_page.c,v 1.4 1999/05/16 17:19:37 juergen Exp $") | Return Values : E_OK - success | E_CONNECTED - field is connected +--------------------------------------------------------------------------*/ -int set_new_page(FIELD * field, bool new_page_flag) +NCURSES_EXPORT(int) +set_new_page (FIELD * field, bool new_page_flag) { Normalize_Field(field); if (field->form) @@ -68,7 +69,8 @@ int set_new_page(FIELD * field, bool new_page_flag) | Return Values : TRUE - field starts a new page | FALSE - field doesn't start a new page +--------------------------------------------------------------------------*/ -bool new_page(const FIELD * field) +NCURSES_EXPORT(bool) +new_page (const FIELD * field) { return (Normalize_Field(field)->status & _NEWPAGE) ? TRUE : FALSE; } diff --git a/contrib/ncurses/form/fld_stat.c b/contrib/ncurses/form/fld_stat.c index 98144bf2f1c4..df5181be008d 100644 --- a/contrib/ncurses/form/fld_stat.c +++ b/contrib/ncurses/form/fld_stat.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 "form.priv.h" -MODULE_ID("$Id: fld_stat.c,v 1.6 1999/05/16 17:19:48 juergen Exp $") +MODULE_ID("$Id: fld_stat.c,v 1.7 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -43,7 +43,8 @@ MODULE_ID("$Id: fld_stat.c,v 1.6 1999/05/16 17:19:48 juergen Exp $") | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -int set_field_status(FIELD * field, bool status) +NCURSES_EXPORT(int) +set_field_status (FIELD * field, bool status) { Normalize_Field( field ); @@ -65,7 +66,8 @@ int set_field_status(FIELD * field, bool status) | Return Values : TRUE - buffer has been changed | FALSE - buffer has not been changed +--------------------------------------------------------------------------*/ -bool field_status(const FIELD * field) +NCURSES_EXPORT(bool) +field_status (const FIELD * field) { return ((Normalize_Field(field)->status & _CHANGED) ? TRUE : FALSE); } diff --git a/contrib/ncurses/form/fld_type.c b/contrib/ncurses/form/fld_type.c index 238b54747809..831c7852c3e1 100644 --- a/contrib/ncurses/form/fld_type.c +++ b/contrib/ncurses/form/fld_type.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 "form.priv.h" -MODULE_ID("$Id: fld_type.c,v 1.9 1999/05/16 17:19:59 juergen Exp $") +MODULE_ID("$Id: fld_type.c,v 1.10 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -45,7 +45,8 @@ MODULE_ID("$Id: fld_type.c,v 1.9 1999/05/16 17:19:59 juergen Exp $") | Return Values : E_OK - success | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int set_field_type(FIELD *field,FIELDTYPE *type, ...) +NCURSES_EXPORT(int) +set_field_type (FIELD *field,FIELDTYPE *type, ...) { va_list ap; int res = E_SYSTEM_ERROR; @@ -84,7 +85,8 @@ int set_field_type(FIELD *field,FIELDTYPE *type, ...) | | Return Values : Pointer to fieldtype of NULL if none is defined. +--------------------------------------------------------------------------*/ -FIELDTYPE *field_type(const FIELD * field) +NCURSES_EXPORT(FIELDTYPE *) +field_type (const FIELD * field) { return Normalize_Field(field)->type; } diff --git a/contrib/ncurses/form/fld_user.c b/contrib/ncurses/form/fld_user.c index cf5b4c291048..5e668b4e556b 100644 --- a/contrib/ncurses/form/fld_user.c +++ b/contrib/ncurses/form/fld_user.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 "form.priv.h" -MODULE_ID("$Id: fld_user.c,v 1.8 1999/05/16 17:20:09 juergen Exp $") +MODULE_ID("$Id: fld_user.c,v 1.9 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -43,7 +43,8 @@ MODULE_ID("$Id: fld_user.c,v 1.8 1999/05/16 17:20:09 juergen Exp $") | | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ -int set_field_userptr(FIELD * field, void *usrptr) +NCURSES_EXPORT(int) +set_field_userptr (FIELD * field, void *usrptr) { Normalize_Field( field )->usrptr = usrptr; RETURN(E_OK); @@ -59,7 +60,8 @@ int set_field_userptr(FIELD * field, void *usrptr) | Return Values : Value of pointer. If no such pointer has been set, | NULL is returned +--------------------------------------------------------------------------*/ -void *field_userptr(const FIELD *field) +NCURSES_EXPORT(void *) +field_userptr (const FIELD *field) { return Normalize_Field( field )->usrptr; } diff --git a/contrib/ncurses/form/form.h b/contrib/ncurses/form/form.h index 40ae0a35f02f..70b7a3ba4e9a 100644 --- a/contrib/ncurses/form/form.h +++ b/contrib/ncurses/form/form.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 * @@ -246,140 +246,135 @@ typedef void (*Form_Hook)(FORM *); /************************* * standard field types * *************************/ -extern FIELDTYPE *TYPE_ALPHA, - *TYPE_ALNUM, - *TYPE_ENUM, - *TYPE_INTEGER, - *TYPE_NUMERIC, - *TYPE_REGEXP; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP; /************************************ * built-in additional field types * * They are not defined in SVr4 * ************************************/ -extern FIELDTYPE *TYPE_IPV4; /* Internet IP Version 4 address */ +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */ /*********************** * Default objects * ***********************/ -extern FORM *_nc_Default_Form; -extern FIELD *_nc_Default_Field; +extern NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form; +extern NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field; /*********************** * FIELDTYPE routines * ***********************/ -extern FIELDTYPE - *new_fieldtype( +extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype ( bool (* const field_check)(FIELD *,const void *), bool (* const char_check)(int,const void *)), *link_fieldtype(FIELDTYPE *,FIELDTYPE *); -extern int free_fieldtype(FIELDTYPE *), - set_fieldtype_arg(FIELDTYPE *, +extern NCURSES_EXPORT(int) free_fieldtype (FIELDTYPE *); +extern NCURSES_EXPORT(int) set_fieldtype_arg (FIELDTYPE *, void * (* const make_arg)(va_list *), void * (* const copy_arg)(const void *), - void (* const free_arg)(void *)), - set_fieldtype_choice (FIELDTYPE *, + void (* const free_arg)(void *)); +extern NCURSES_EXPORT(int) set_fieldtype_choice (FIELDTYPE *, bool (* const next_choice)(FIELD *,const void *), bool (* const prev_choice)(FIELD *,const void *)); /******************* * FIELD routines * *******************/ -extern FIELD *new_field(int,int,int,int,int,int), - *dup_field(FIELD *,int,int), - *link_field(FIELD *,int,int); - -extern int free_field(FIELD *), - field_info(const FIELD *,int *,int *,int *,int *,int *,int *), - dynamic_field_info(const FIELD *,int *,int *,int *), - set_max_field( FIELD *,int), - move_field(FIELD *,int,int), - set_field_type(FIELD *,FIELDTYPE *,...), - set_new_page(FIELD *,bool), - set_field_just(FIELD *,int), - field_just(const FIELD *), - set_field_fore(FIELD *,chtype), - set_field_back(FIELD *,chtype), - set_field_pad(FIELD *,int), - field_pad(const FIELD *), - set_field_buffer(FIELD *,int,const char *), - set_field_status(FIELD *,bool), - set_field_userptr(FIELD *, void *), - set_field_opts(FIELD *,Field_Options), - field_opts_on(FIELD *,Field_Options), - field_opts_off(FIELD *,Field_Options); - -extern chtype field_fore(const FIELD *), - field_back(const FIELD *); - -extern bool new_page(const FIELD *), - field_status(const FIELD *); - -extern void *field_arg(const FIELD *); - -extern void *field_userptr(const FIELD *); - -extern FIELDTYPE - *field_type(const FIELD *); - -extern char* field_buffer(const FIELD *,int); - -extern Field_Options - field_opts(const FIELD *); +extern NCURSES_EXPORT(FIELD *) new_field (int,int,int,int,int,int); +extern NCURSES_EXPORT(FIELD *) dup_field (FIELD *,int,int); +extern NCURSES_EXPORT(FIELD *) link_field (FIELD *,int,int); + +extern NCURSES_EXPORT(int) free_field (FIELD *); +extern NCURSES_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *); +extern NCURSES_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *); +extern NCURSES_EXPORT(int) set_max_field ( FIELD *,int); +extern NCURSES_EXPORT(int) move_field (FIELD *,int,int); +extern NCURSES_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...); +extern NCURSES_EXPORT(int) set_new_page (FIELD *,bool); +extern NCURSES_EXPORT(int) set_field_just (FIELD *,int); +extern NCURSES_EXPORT(int) field_just (const FIELD *); +extern NCURSES_EXPORT(int) set_field_fore (FIELD *,chtype); +extern NCURSES_EXPORT(int) set_field_back (FIELD *,chtype); +extern NCURSES_EXPORT(int) set_field_pad (FIELD *,int); +extern NCURSES_EXPORT(int) field_pad (const FIELD *); +extern NCURSES_EXPORT(int) set_field_buffer (FIELD *,int,const char *); +extern NCURSES_EXPORT(int) set_field_status (FIELD *,bool); +extern NCURSES_EXPORT(int) set_field_userptr (FIELD *, void *); +extern NCURSES_EXPORT(int) set_field_opts (FIELD *,Field_Options); +extern NCURSES_EXPORT(int) field_opts_on (FIELD *,Field_Options); +extern NCURSES_EXPORT(int) field_opts_off (FIELD *,Field_Options); + +extern NCURSES_EXPORT(chtype) field_fore (const FIELD *); +extern NCURSES_EXPORT(chtype) field_back (const FIELD *); + +extern NCURSES_EXPORT(bool) new_page (const FIELD *); +extern NCURSES_EXPORT(bool) field_status (const FIELD *); + +extern NCURSES_EXPORT(void *) field_arg (const FIELD *); + +extern NCURSES_EXPORT(void *) field_userptr (const FIELD *); + +extern NCURSES_EXPORT(FIELDTYPE *) field_type (const FIELD *); + +extern NCURSES_EXPORT(char *) field_buffer (const FIELD *,int); + +extern NCURSES_EXPORT(Field_Options) field_opts (const FIELD *); /****************** * FORM routines * ******************/ -extern FORM *new_form(FIELD **); - -extern FIELD **form_fields(const FORM *), - *current_field(const FORM *); - -extern WINDOW *form_win(const FORM *), - *form_sub(const FORM *); - -extern Form_Hook - form_init(const FORM *), - form_term(const FORM *), - field_init(const FORM *), - field_term(const FORM *); - -extern int free_form(FORM *), - set_form_fields(FORM *,FIELD **), - field_count(const FORM *), - set_form_win(FORM *,WINDOW *), - set_form_sub(FORM *,WINDOW *), - set_current_field(FORM *,FIELD *), - field_index(const FIELD *), - set_form_page(FORM *,int), - form_page(const FORM *), - scale_form(const FORM *,int *,int *), - set_form_init(FORM *,Form_Hook), - set_form_term(FORM *,Form_Hook), - set_field_init(FORM *,Form_Hook), - set_field_term(FORM *,Form_Hook), - post_form(FORM *), - unpost_form(FORM *), - pos_form_cursor(FORM *), - form_driver(FORM *,int), - set_form_userptr(FORM *,void *), - set_form_opts(FORM *,Form_Options), - form_opts_on(FORM *,Form_Options), - form_opts_off(FORM *,Form_Options), - form_request_by_name(const char *); - -extern const char - *form_request_name(int); - -extern void *form_userptr(const FORM *); - -extern Form_Options - form_opts(const FORM *); - -extern bool data_ahead(const FORM *), - data_behind(const FORM *); + +extern NCURSES_EXPORT(FORM *) new_form (FIELD **); + +extern NCURSES_EXPORT(FIELD **)form_fields (const FORM *); +extern NCURSES_EXPORT(FIELD *) current_field (const FORM *); + +extern NCURSES_EXPORT(WINDOW *) form_win (const FORM *); +extern NCURSES_EXPORT(WINDOW *) form_sub (const FORM *); + +extern NCURSES_EXPORT(Form_Hook) form_init (const FORM *); +extern NCURSES_EXPORT(Form_Hook) form_term (const FORM *); +extern NCURSES_EXPORT(Form_Hook) field_init (const FORM *); +extern NCURSES_EXPORT(Form_Hook) field_term (const FORM *); + +extern NCURSES_EXPORT(int) free_form (FORM *); +extern NCURSES_EXPORT(int) set_form_fields (FORM *,FIELD **); +extern NCURSES_EXPORT(int) field_count (const FORM *); +extern NCURSES_EXPORT(int) set_form_win (FORM *,WINDOW *); +extern NCURSES_EXPORT(int) set_form_sub (FORM *,WINDOW *); +extern NCURSES_EXPORT(int) set_current_field (FORM *,FIELD *); +extern NCURSES_EXPORT(int) field_index (const FIELD *); +extern NCURSES_EXPORT(int) set_form_page (FORM *,int); +extern NCURSES_EXPORT(int) form_page (const FORM *); +extern NCURSES_EXPORT(int) scale_form (const FORM *,int *,int *); +extern NCURSES_EXPORT(int) set_form_init (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) set_form_term (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) set_field_init (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) set_field_term (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) post_form (FORM *); +extern NCURSES_EXPORT(int) unpost_form (FORM *); +extern NCURSES_EXPORT(int) pos_form_cursor (FORM *); +extern NCURSES_EXPORT(int) form_driver (FORM *,int); +extern NCURSES_EXPORT(int) set_form_userptr (FORM *,void *); +extern NCURSES_EXPORT(int) set_form_opts (FORM *,Form_Options); +extern NCURSES_EXPORT(int) form_opts_on (FORM *,Form_Options); +extern NCURSES_EXPORT(int) form_opts_off (FORM *,Form_Options); +extern NCURSES_EXPORT(int) form_request_by_name (const char *); + +extern NCURSES_EXPORT(const char *) form_request_name (int); + +extern NCURSES_EXPORT(void *) form_userptr (const FORM *); + +extern NCURSES_EXPORT(Form_Options) form_opts (const FORM *); + +extern NCURSES_EXPORT(bool) data_ahead (const FORM *); +extern NCURSES_EXPORT(bool) data_behind (const FORM *); #ifdef __cplusplus } diff --git a/contrib/ncurses/form/form.priv.h b/contrib/ncurses/form/form.priv.h index 886121c94cd8..73c5e9a052e5 100644 --- a/contrib/ncurses/form/form.priv.h +++ b/contrib/ncurses/form/form.priv.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 * @@ -110,19 +110,19 @@ typedef struct typearg { #define C_BLANK ' ' #define is_blank(c) ((c)==C_BLANK) -extern const FIELDTYPE* _nc_Default_FieldType; - -extern TypeArgument* _nc_Make_Argument(const FIELDTYPE*,va_list*,int*); -extern TypeArgument *_nc_Copy_Argument(const FIELDTYPE*,const TypeArgument*, int*); -extern void _nc_Free_Argument(const FIELDTYPE*,TypeArgument*); -extern bool _nc_Copy_Type(FIELD*, FIELD const *); -extern void _nc_Free_Type(FIELD *); - -extern int _nc_Synchronize_Attributes(FIELD*); -extern int _nc_Synchronize_Options(FIELD*,Field_Options); -extern int _nc_Set_Form_Page(FORM*,int,FIELD*); -extern int _nc_Refresh_Current_Field(FORM*); -extern FIELD* _nc_First_Active_Field(FORM*); -extern bool _nc_Internal_Validation(FORM*); -extern int _nc_Set_Current_Field(FORM*,FIELD*); -extern int _nc_Position_Form_Cursor(FORM*); +extern NCURSES_EXPORT_VAR(const FIELDTYPE *) _nc_Default_FieldType; + +extern NCURSES_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*,va_list*,int*); +extern NCURSES_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*,const TypeArgument*, int*); +extern NCURSES_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*,TypeArgument*); +extern NCURSES_EXPORT(bool) _nc_Copy_Type (FIELD*, FIELD const *); +extern NCURSES_EXPORT(void) _nc_Free_Type (FIELD *); + +extern NCURSES_EXPORT(int) _nc_Synchronize_Attributes (FIELD*); +extern NCURSES_EXPORT(int) _nc_Synchronize_Options (FIELD*,Field_Options); +extern NCURSES_EXPORT(int) _nc_Set_Form_Page (FORM*,int,FIELD*); +extern NCURSES_EXPORT(int) _nc_Refresh_Current_Field (FORM*); +extern NCURSES_EXPORT(FIELD *) _nc_First_Active_Field (FORM*); +extern NCURSES_EXPORT(bool) _nc_Internal_Validation (FORM*); +extern NCURSES_EXPORT(int) _nc_Set_Current_Field (FORM*,FIELD*); +extern NCURSES_EXPORT(int) _nc_Position_Form_Cursor (FORM*); diff --git a/contrib/ncurses/form/frm_cursor.c b/contrib/ncurses/form/frm_cursor.c index 96ad2d60693e..930908f7fdd7 100644 --- a/contrib/ncurses/form/frm_cursor.c +++ b/contrib/ncurses/form/frm_cursor.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,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: frm_cursor.c,v 1.4 1999/05/16 17:20:19 juergen Exp $") +MODULE_ID("$Id: frm_cursor.c,v 1.5 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -47,7 +47,8 @@ MODULE_ID("$Id: frm_cursor.c,v 1.4 1999/05/16 17:20:19 juergen Exp $") | E_BAD_ARGUMENT - Invalid form pointer | E_NOT_POSTED - Form is not posted +--------------------------------------------------------------------------*/ -int pos_form_cursor(FORM * form) +NCURSES_EXPORT(int) +pos_form_cursor (FORM * form) { int res; diff --git a/contrib/ncurses/form/frm_data.c b/contrib/ncurses/form/frm_data.c index e90f5a17ec4d..8d87353e5a7c 100644 --- a/contrib/ncurses/form/frm_data.c +++ b/contrib/ncurses/form/frm_data.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 "form.priv.h" -MODULE_ID("$Id: frm_data.c,v 1.6 1999/05/16 17:20:29 juergen Exp $") +MODULE_ID("$Id: frm_data.c,v 1.7 2000/12/10 02:09:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -44,7 +44,8 @@ MODULE_ID("$Id: frm_data.c,v 1.6 1999/05/16 17:20:29 juergen Exp $") | Return Values : TRUE - there are off-screen data behind | FALSE - there are no off-screen data behind +--------------------------------------------------------------------------*/ -bool data_behind(const FORM *form) +NCURSES_EXPORT(bool) +data_behind (const FORM *form) { bool result = FALSE; @@ -101,7 +102,8 @@ static char * After_Last_Non_Pad_Position(char *buffer, int len, int pad) | Return Values : TRUE - there are off-screen data ahead | FALSE - there are no off-screen data ahead +--------------------------------------------------------------------------*/ -bool data_ahead(const FORM *form) +NCURSES_EXPORT(bool) +data_ahead (const FORM *form) { bool result = FALSE; diff --git a/contrib/ncurses/form/frm_def.c b/contrib/ncurses/form/frm_def.c index 34be5fe7ca9c..0802e49a4114 100644 --- a/contrib/ncurses/form/frm_def.c +++ b/contrib/ncurses/form/frm_def.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 "form.priv.h" -MODULE_ID("$Id: frm_def.c,v 1.9 1999/05/16 17:20:43 juergen Exp $") +MODULE_ID("$Id: frm_def.c,v 1.10 2000/12/10 02:09:38 tom Exp $") /* this can't be readonly */ static FORM default_form = { @@ -60,7 +60,7 @@ static FORM default_form = { NULL /* fieldterm */ }; -FORM *_nc_Default_Form = &default_form; +NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form; /*--------------------------------------------------------------------------- | Facility : libnform @@ -269,7 +269,8 @@ INLINE static int Associate_Fields(FORM *form, FIELD **fields) | | Return Values : Pointer to form. NULL if error occured. +--------------------------------------------------------------------------*/ -FORM *new_form(FIELD ** fields) +NCURSES_EXPORT(FORM *) +new_form (FIELD ** fields) { int err = E_SYSTEM_ERROR; @@ -301,7 +302,8 @@ FORM *new_form(FIELD ** fields) | E_BAD_ARGUMENT - invalid form pointer | E_POSTED - form is posted +--------------------------------------------------------------------------*/ -int free_form(FORM * form) +NCURSES_EXPORT(int) +free_form (FORM * form) { if ( !form ) RETURN(E_BAD_ARGUMENT); @@ -327,7 +329,8 @@ int free_form(FORM * form) | E_BAD_ARGUMENT - invalid form pointer | E_POSTED - form is posted +--------------------------------------------------------------------------*/ -int set_form_fields(FORM * form, FIELD ** fields) +NCURSES_EXPORT(int) +set_form_fields (FORM * form, FIELD ** fields) { FIELD **old; int res; @@ -355,7 +358,8 @@ int set_form_fields(FORM * form, FIELD ** fields) | | Return Values : Pointer to field array +--------------------------------------------------------------------------*/ -FIELD **form_fields(const FORM * form) +NCURSES_EXPORT(FIELD **) +form_fields (const FORM * form) { return (Normalize_Form( form )->field); } @@ -368,7 +372,8 @@ FIELD **form_fields(const FORM * form) | | Return Values : Number of fields, -1 if none are defined +--------------------------------------------------------------------------*/ -int field_count(const FORM * form) +NCURSES_EXPORT(int) +field_count (const FORM * form) { return (Normalize_Form( form )->maxfield); } diff --git a/contrib/ncurses/form/frm_driver.c b/contrib/ncurses/form/frm_driver.c index e609e191de2a..3a02a5daafbb 100644 --- a/contrib/ncurses/form/frm_driver.c +++ b/contrib/ncurses/form/frm_driver.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,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: frm_driver.c,v 1.35 1999/05/16 17:20:52 juergen Exp $") +MODULE_ID("$Id: frm_driver.c,v 1.38 2001/03/25 02:07:50 juergen Exp $") /*---------------------------------------------------------------------------- This is the core module of the form library. It contains the majority @@ -516,7 +516,8 @@ static bool Field_Grown(FIELD * field, int amount) return FALSE; } assert(form!=(FORM *)0); - delwin(form->w); + if (form->w) + delwin(form->w); form->w = new_window; Set_Field_Window_Attributes(field,form->w); werase(form->w); @@ -558,8 +559,8 @@ static bool Field_Grown(FIELD * field, int amount) | E_SYSTEM_ERROR - form has no current field or | field-window +--------------------------------------------------------------------------*/ -int -_nc_Position_Form_Cursor(FORM * form) +NCURSES_EXPORT(int) +_nc_Position_Form_Cursor (FORM * form) { FIELD *field; WINDOW *formwin; @@ -599,8 +600,8 @@ _nc_Position_Form_Cursor(FORM * form) | E_BAD_ARGUMENT - invalid form pointer | E_SYSTEM_ERROR - general error +--------------------------------------------------------------------------*/ -int -_nc_Refresh_Current_Field(FORM * form) +NCURSES_EXPORT(int) +_nc_Refresh_Current_Field (FORM * form) { WINDOW *formwin; FIELD *field; @@ -957,7 +958,8 @@ static int Synchronize_Linked_Fields(FIELD * field) | E_BAD_ARGUMENT - invalid field pointer | E_SYSTEM_ERROR - some severe basic error +--------------------------------------------------------------------------*/ -int _nc_Synchronize_Attributes(FIELD * field) +NCURSES_EXPORT(int) +_nc_Synchronize_Attributes (FIELD * field) { FORM *form; int res = E_OK; @@ -1015,8 +1017,9 @@ int _nc_Synchronize_Attributes(FIELD * field) | E_BAD_ARGUMENT - invalid field pointer | E_SYSTEM_ERROR - some severe basic error +--------------------------------------------------------------------------*/ -int -_nc_Synchronize_Options(FIELD *field, Field_Options newopts) +NCURSES_EXPORT(int) +_nc_Synchronize_Options +(FIELD *field, Field_Options newopts) { Field_Options oldopts; Field_Options changed_opts; @@ -1113,8 +1116,9 @@ _nc_Synchronize_Options(FIELD *field, Field_Options newopts) | E_BAD_ARGUMENT - invalid form or field pointer | E_SYSTEM_ERROR - some severe basic error +--------------------------------------------------------------------------*/ -int -_nc_Set_Current_Field(FORM *form, FIELD *newfield) +NCURSES_EXPORT(int) +_nc_Set_Current_Field +(FORM *form, FIELD *newfield) { FIELD *field; WINDOW *new_window; @@ -1159,6 +1163,7 @@ _nc_Set_Current_Field(FORM *form, FIELD *newfield) } } delwin(form->w); + form->w = (WINDOW *)0; } field = newfield; @@ -1173,7 +1178,11 @@ _nc_Set_Current_Field(FORM *form, FIELD *newfield) return(E_SYSTEM_ERROR); form->current = field; + + if (form->w) + delwin(form->w); form->w = new_window; + form->status &= ~_WINDOW_MODIFIED; Set_Field_Window_Attributes(field,form->w); @@ -2686,8 +2695,8 @@ static bool Check_Field(FIELDTYPE *typ, FIELD *field, TypeArgument *argp) | Return Values : TRUE - field is valid | FALSE - field is invalid +--------------------------------------------------------------------------*/ -bool -_nc_Internal_Validation(FORM *form) +NCURSES_EXPORT(bool) +_nc_Internal_Validation (FORM *form) { FIELD *field; @@ -2776,8 +2785,8 @@ INLINE static FIELD *Next_Field_On_Page(FIELD * field) | | Return Values : Pointer to calculated field. +--------------------------------------------------------------------------*/ -FIELD* -_nc_First_Active_Field(FORM * form) +NCURSES_EXPORT(FIELD*) +_nc_First_Active_Field (FORM * form) { FIELD **last_on_page = &form->field[form->page[form->curpage].pmax]; FIELD *proposed = Next_Field_On_Page(*last_on_page); @@ -3283,8 +3292,9 @@ static int FN_Down_Field(FORM * form) | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -int -_nc_Set_Form_Page(FORM * form, int page, FIELD * field) +NCURSES_EXPORT(int) +_nc_Set_Form_Page +(FORM * form, int page, FIELD * field) { int res = E_OK; @@ -3637,7 +3647,8 @@ static const Binding_Info bindings[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] = | E_REQUEST_DENIED - request failed | E_UNKNOWN_COMMAND - command not known +--------------------------------------------------------------------------*/ -int form_driver(FORM * form, int c) +NCURSES_EXPORT(int) +form_driver (FORM * form, int c) { const Binding_Info* BI = (Binding_Info *)0; int res = E_UNKNOWN_COMMAND; @@ -3736,7 +3747,9 @@ int form_driver(FORM * form, int c) | E_BAD_ARGUMENT - invalid argument | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int set_field_buffer(FIELD * field, int buffer, const char * value) +NCURSES_EXPORT(int) +set_field_buffer +(FIELD * field, int buffer, const char * value) { char *s, *p; int res = E_OK; @@ -3778,7 +3791,7 @@ int set_field_buffer(FIELD * field, int buffer, const char * value) unsigned int i; for(i=len; i<vlen; i++) - if (!isprint(value[i])) + if (!isprint((unsigned char)value[i])) RETURN(E_BAD_ARGUMENT); } len = vlen; @@ -3832,7 +3845,8 @@ int set_field_buffer(FIELD * field, int buffer, const char * value) | | Return Values : Pointer to buffer or NULL if arguments were invalid. +--------------------------------------------------------------------------*/ -char *field_buffer(const FIELD * field, int buffer) +NCURSES_EXPORT(char *) +field_buffer (const FIELD * field, int buffer) { if (field && (buffer >= 0) && (buffer <= field->nbuf)) return Address_Of_Nth_Buffer(field,buffer); diff --git a/contrib/ncurses/form/frm_hook.c b/contrib/ncurses/form/frm_hook.c index 5a5ec29376b2..8296712fc1c0 100644 --- a/contrib/ncurses/form/frm_hook.c +++ b/contrib/ncurses/form/frm_hook.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,11 +32,11 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_hook.c,v 1.8 1999/05/16 17:21:04 juergen Exp $") +MODULE_ID("$Id: frm_hook.c,v 1.9 2000/12/10 02:09:37 tom Exp $") /* "Template" macro to generate function to set application specific hook */ #define GEN_HOOK_SET_FUNCTION( typ, name ) \ -int set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ +NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ {\ (Normalize_Form( form ) -> typ ## name) = func ;\ RETURN(E_OK);\ @@ -44,7 +44,7 @@ int set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ /* "Template" macro to generate function to get application specific hook */ #define GEN_HOOK_GET_FUNCTION( typ, name ) \ -Form_Hook typ ## _ ## name ( const FORM *form )\ +NCURSES_IMPEXP Form_Hook NCURSES_API typ ## _ ## name ( const FORM *form )\ {\ return ( Normalize_Form( form ) -> typ ## name );\ } diff --git a/contrib/ncurses/form/frm_opts.c b/contrib/ncurses/form/frm_opts.c index 009c189741ba..fe2354119712 100644 --- a/contrib/ncurses/form/frm_opts.c +++ b/contrib/ncurses/form/frm_opts.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 "form.priv.h" -MODULE_ID("$Id: frm_opts.c,v 1.8 1999/05/16 17:38:05 juergen Exp $") +MODULE_ID("$Id: frm_opts.c,v 1.9 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -44,7 +44,8 @@ MODULE_ID("$Id: frm_opts.c,v 1.8 1999/05/16 17:38:05 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ -int set_form_opts(FORM * form, Form_Options opts) +NCURSES_EXPORT(int) +set_form_opts (FORM * form, Form_Options opts) { opts &= ALL_FORM_OPTS; if (opts & ~ALL_FORM_OPTS) @@ -64,7 +65,8 @@ int set_form_opts(FORM * form, Form_Options opts) | | Return Values : The option flags. +--------------------------------------------------------------------------*/ -Form_Options form_opts(const FORM * form) +NCURSES_EXPORT(Form_Options) +form_opts (const FORM * form) { return (Normalize_Form(form)->opts & ALL_FORM_OPTS); } @@ -79,7 +81,8 @@ Form_Options form_opts(const FORM * form) | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ -int form_opts_on(FORM * form, Form_Options opts) +NCURSES_EXPORT(int) +form_opts_on (FORM * form, Form_Options opts) { opts &= ALL_FORM_OPTS; if (opts & ~ALL_FORM_OPTS) @@ -101,7 +104,8 @@ int form_opts_on(FORM * form, Form_Options opts) | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ -int form_opts_off(FORM * form, Form_Options opts) +NCURSES_EXPORT(int) +form_opts_off (FORM * form, Form_Options opts) { opts &= ALL_FORM_OPTS; if (opts & ~ALL_FORM_OPTS) diff --git a/contrib/ncurses/form/frm_page.c b/contrib/ncurses/form/frm_page.c index 5136542e8459..84467f848bb5 100644 --- a/contrib/ncurses/form/frm_page.c +++ b/contrib/ncurses/form/frm_page.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 "form.priv.h" -MODULE_ID("$Id: frm_page.c,v 1.5 1999/05/16 17:21:26 juergen Exp $") +MODULE_ID("$Id: frm_page.c,v 1.6 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,7 +46,8 @@ MODULE_ID("$Id: frm_page.c,v 1.5 1999/05/16 17:21:26 juergen Exp $") | E_INVALID_FIELD - current field can't be left | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int set_form_page(FORM * form, int page) +NCURSES_EXPORT(int) +set_form_page (FORM * form, int page) { int err = E_OK; @@ -92,7 +93,8 @@ int set_form_page(FORM * form, int page) | Return Values : >= 0 : current page number | -1 : invalid form pointer +--------------------------------------------------------------------------*/ -int form_page(const FORM * form) +NCURSES_EXPORT(int) +form_page (const FORM * form) { return Normalize_Form(form)->curpage; } diff --git a/contrib/ncurses/form/frm_post.c b/contrib/ncurses/form/frm_post.c index 3fdb57a09b8f..96df4c4656e1 100644 --- a/contrib/ncurses/form/frm_post.c +++ b/contrib/ncurses/form/frm_post.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,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: frm_post.c,v 1.4 1999/05/16 17:21:39 juergen Exp $") +MODULE_ID("$Id: frm_post.c,v 1.5 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,7 +46,8 @@ MODULE_ID("$Id: frm_post.c,v 1.4 1999/05/16 17:21:39 juergen Exp $") | E_NO_ROOM - form doesn't fit into subwindow | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -int post_form(FORM * form) +NCURSES_EXPORT(int) +post_form (FORM * form) { WINDOW *formwin; int err; @@ -93,7 +94,8 @@ int post_form(FORM * form) | E_NOT_POSTED - form isn't posted | E_BAD_STATE - called from a hook routine +--------------------------------------------------------------------------*/ -int unpost_form(FORM * form) +NCURSES_EXPORT(int) +unpost_form (FORM * form) { if (!form) RETURN(E_BAD_ARGUMENT); diff --git a/contrib/ncurses/form/frm_req_name.c b/contrib/ncurses/form/frm_req_name.c index 63006517ee85..e5ff9149ab3d 100644 --- a/contrib/ncurses/form/frm_req_name.c +++ b/contrib/ncurses/form/frm_req_name.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,7 +37,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_req_name.c,v 1.7 1999/05/16 17:21:53 juergen Exp $") +MODULE_ID("$Id: frm_req_name.c,v 1.8 2000/12/10 02:09:37 tom Exp $") static const char *request_names[ MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1 ] = { "NEXT_PAGE" , @@ -113,7 +113,8 @@ static const char *request_names[ MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1 ] = { | Return Values : Pointer to name - on success | NULL - on invalid request code +--------------------------------------------------------------------------*/ -const char *form_request_name( int request ) +NCURSES_EXPORT(const char *) +form_request_name ( int request ) { if ( (request < MIN_FORM_COMMAND) || (request > MAX_FORM_COMMAND) ) { @@ -134,7 +135,8 @@ const char *form_request_name( int request ) | Return Values : Request Id - on success | E_NO_MATCH - request not found +--------------------------------------------------------------------------*/ -int form_request_by_name( const char *str ) +NCURSES_EXPORT(int) +form_request_by_name ( const char *str ) { /* because the table is so small, it doesn't really hurt to run sequentially through it. diff --git a/contrib/ncurses/form/frm_scale.c b/contrib/ncurses/form/frm_scale.c index bb1971770987..77bd00abf325 100644 --- a/contrib/ncurses/form/frm_scale.c +++ b/contrib/ncurses/form/frm_scale.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 "form.priv.h" -MODULE_ID("$Id: frm_scale.c,v 1.4 1999/05/16 17:22:02 juergen Exp $") +MODULE_ID("$Id: frm_scale.c,v 1.5 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -44,7 +44,8 @@ MODULE_ID("$Id: frm_scale.c,v 1.4 1999/05/16 17:22:02 juergen Exp $") | E_BAD_ARGUMENT - invalid form pointer | E_NOT_CONNECTED - no fields connected to form +--------------------------------------------------------------------------*/ -int scale_form(const FORM * form, int * rows, int * cols) +NCURSES_EXPORT(int) +scale_form (const FORM * form, int * rows, int * cols) { if ( !form ) RETURN(E_BAD_ARGUMENT); diff --git a/contrib/ncurses/form/frm_sub.c b/contrib/ncurses/form/frm_sub.c index 849f9cb0c3b2..a413153e40c7 100644 --- a/contrib/ncurses/form/frm_sub.c +++ b/contrib/ncurses/form/frm_sub.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 "form.priv.h" -MODULE_ID("$Id: frm_sub.c,v 1.4 1999/05/16 17:22:11 juergen Exp $") +MODULE_ID("$Id: frm_sub.c,v 1.5 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -43,7 +43,8 @@ MODULE_ID("$Id: frm_sub.c,v 1.4 1999/05/16 17:22:11 juergen Exp $") | Return Values : E_OK - success | E_POSTED - form is posted +--------------------------------------------------------------------------*/ -int set_form_sub(FORM * form, WINDOW * win) +NCURSES_EXPORT(int) +set_form_sub (FORM * form, WINDOW * win) { if (form && (form->status & _POSTED)) RETURN(E_POSTED); @@ -60,7 +61,8 @@ int set_form_sub(FORM * form, WINDOW * win) | | Return Values : The pointer to the Subwindow. +--------------------------------------------------------------------------*/ -WINDOW *form_sub(const FORM * form) +NCURSES_EXPORT(WINDOW *) +form_sub (const FORM * form) { const FORM* f = Normalize_Form( form ); return Get_Form_Window(f); diff --git a/contrib/ncurses/form/frm_user.c b/contrib/ncurses/form/frm_user.c index 853904f05413..3b04e53bbb30 100644 --- a/contrib/ncurses/form/frm_user.c +++ b/contrib/ncurses/form/frm_user.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 "form.priv.h" -MODULE_ID("$Id: frm_user.c,v 1.8 1999/05/16 17:22:21 juergen Exp $") +MODULE_ID("$Id: frm_user.c,v 1.9 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -43,7 +43,8 @@ MODULE_ID("$Id: frm_user.c,v 1.8 1999/05/16 17:22:21 juergen Exp $") | | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ -int set_form_userptr(FORM * form, void *usrptr) +NCURSES_EXPORT(int) +set_form_userptr (FORM * form, void *usrptr) { Normalize_Form(form)->usrptr = usrptr; RETURN(E_OK); @@ -59,7 +60,8 @@ int set_form_userptr(FORM * form, void *usrptr) | Return Values : Value of pointer. If no such pointer has been set, | NULL is returned +--------------------------------------------------------------------------*/ -void *form_userptr(const FORM * form) +NCURSES_EXPORT(void *) +form_userptr (const FORM * form) { return Normalize_Form(form)->usrptr; } diff --git a/contrib/ncurses/form/frm_win.c b/contrib/ncurses/form/frm_win.c index b705d03314ba..1b69fc548491 100644 --- a/contrib/ncurses/form/frm_win.c +++ b/contrib/ncurses/form/frm_win.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 "form.priv.h" -MODULE_ID("$Id: frm_win.c,v 1.8 1999/05/16 17:22:32 juergen Exp $") +MODULE_ID("$Id: frm_win.c,v 1.9 2000/12/10 02:09:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -43,7 +43,8 @@ MODULE_ID("$Id: frm_win.c,v 1.8 1999/05/16 17:22:32 juergen Exp $") | Return Values : E_OK - success | E_POSTED - form is posted +--------------------------------------------------------------------------*/ -int set_form_win(FORM * form, WINDOW * win) +NCURSES_EXPORT(int) +set_form_win (FORM * form, WINDOW * win) { if (form && (form->status & _POSTED)) RETURN(E_POSTED); @@ -60,7 +61,8 @@ int set_form_win(FORM * form, WINDOW * win) | | Return Values : The pointer to the Window or stdscr if there is none. +--------------------------------------------------------------------------*/ -WINDOW *form_win(const FORM * form) +NCURSES_EXPORT(WINDOW *) +form_win (const FORM * form) { const FORM* f = Normalize_Form( form ); return (f->win ? f->win : stdscr); diff --git a/contrib/ncurses/form/fty_alnum.c b/contrib/ncurses/form/fty_alnum.c index cb3909d7b1c7..cbeef17d4eb3 100644 --- a/contrib/ncurses/form/fty_alnum.c +++ b/contrib/ncurses/form/fty_alnum.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_alnum.c,v 1.9 1999/05/16 17:22:49 juergen Exp $") +MODULE_ID("$Id: fty_alnum.c,v 1.10 2000/12/09 23:46:12 tom Exp $") typedef struct { int width; @@ -132,6 +132,6 @@ static FIELDTYPE typeALNUM = { NULL }; -FIELDTYPE* TYPE_ALNUM = &typeALNUM; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALNUM = &typeALNUM; /* fty_alnum.c ends here */ diff --git a/contrib/ncurses/form/fty_alpha.c b/contrib/ncurses/form/fty_alpha.c index 3dd8f2cb142e..ddb295d3f0dc 100644 --- a/contrib/ncurses/form/fty_alpha.c +++ b/contrib/ncurses/form/fty_alpha.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_alpha.c,v 1.9 1999/05/16 17:22:58 juergen Exp $") +MODULE_ID("$Id: fty_alpha.c,v 1.10 2000/12/09 23:46:12 tom Exp $") typedef struct { int width; @@ -133,6 +133,6 @@ static FIELDTYPE typeALPHA = { NULL }; -FIELDTYPE* TYPE_ALPHA = &typeALPHA; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALPHA = &typeALPHA; /* fty_alpha.c ends here */ diff --git a/contrib/ncurses/form/fty_enum.c b/contrib/ncurses/form/fty_enum.c index 490bf261842b..4f52caf9db9f 100644 --- a/contrib/ncurses/form/fty_enum.c +++ b/contrib/ncurses/form/fty_enum.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_enum.c,v 1.13 2000/09/10 00:55:26 juergen Exp $") +MODULE_ID("$Id: fty_enum.c,v 1.15 2000/12/09 23:46:12 tom Exp $") typedef struct { char **kwds; @@ -47,7 +47,7 @@ static void *Make_Enum_Type(va_list * ap) argp->checkunique = cunique ? TRUE : FALSE; kp = argp->kwds; - while( (kp && *kp++) ) cnt++; + while( kp && (*kp++) ) cnt++; argp->count = cnt; } return (void *)argp; @@ -290,6 +290,6 @@ static FIELDTYPE typeENUM = { Previous_Enum }; -FIELDTYPE* TYPE_ENUM = &typeENUM; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ENUM = &typeENUM; /* fty_enum.c ends here */ diff --git a/contrib/ncurses/form/fty_int.c b/contrib/ncurses/form/fty_int.c index cb690bdaf03d..85348d737f25 100644 --- a/contrib/ncurses/form/fty_int.c +++ b/contrib/ncurses/form/fty_int.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_int.c,v 1.10 1999/05/16 17:23:22 juergen Exp $") +MODULE_ID("$Id: fty_int.c,v 1.11 2000/12/09 23:46:12 tom Exp $") typedef struct { int precision; @@ -155,6 +155,6 @@ static FIELDTYPE typeINTEGER = { NULL }; -FIELDTYPE* TYPE_INTEGER = &typeINTEGER; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_INTEGER = &typeINTEGER; /* fty_int.c ends here */ diff --git a/contrib/ncurses/form/fty_ipv4.c b/contrib/ncurses/form/fty_ipv4.c index 064c02c8fa78..f49dcdb19567 100644 --- a/contrib/ncurses/form/fty_ipv4.c +++ b/contrib/ncurses/form/fty_ipv4.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_ipv4.c,v 1.2 1997/04/26 22:06:00 tom Exp $") +MODULE_ID("$Id: fty_ipv4.c,v 1.4 2000/12/09 23:46:12 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -32,13 +32,13 @@ static bool Check_IPV4_Field(FIELD * field, const void * argp GCC_UNUSED) int num = 0, len; unsigned int d1, d2, d3, d4; - if(isdigit(*bp)) /* Must start with digit */ + if(isdigit((unsigned char)*bp)) /* Must start with digit */ { num = sscanf(bp, "%u.%u.%u.%u%n", &d1, &d2, &d3, &d4, &len); if (num == 4) { bp += len; /* Make bp point to what sscanf() left */ - while (*bp && isspace(*bp)) + while (*bp && isspace((unsigned char)*bp)) bp++; /* Allow trailing whitespace */ } } @@ -76,6 +76,6 @@ static FIELDTYPE typeIPV4 = { NULL }; -FIELDTYPE* TYPE_IPV4 = &typeIPV4; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_IPV4 = &typeIPV4; /* fty_ipv4.c ends here */ diff --git a/contrib/ncurses/form/fty_num.c b/contrib/ncurses/form/fty_num.c index ca0fbe01e00f..39659d1d9d2c 100644 --- a/contrib/ncurses/form/fty_num.c +++ b/contrib/ncurses/form/fty_num.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_num.c,v 1.13 1999/05/16 17:23:30 juergen Exp $") +MODULE_ID("$Id: fty_num.c,v 1.14 2000/12/09 23:46:12 tom Exp $") #if HAVE_LOCALE_H #include <locale.h> @@ -190,6 +190,6 @@ static FIELDTYPE typeNUMERIC = { NULL }; -FIELDTYPE* TYPE_NUMERIC = &typeNUMERIC; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_NUMERIC = &typeNUMERIC; /* fty_num.c ends here */ diff --git a/contrib/ncurses/form/fty_regex.c b/contrib/ncurses/form/fty_regex.c index 7a928125d4ad..b575487173a9 100644 --- a/contrib/ncurses/form/fty_regex.c +++ b/contrib/ncurses/form/fty_regex.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_regex.c,v 1.14 1999/05/16 17:23:38 juergen Exp $") +MODULE_ID("$Id: fty_regex.c,v 1.15 2000/12/09 23:46:12 tom Exp $") #if HAVE_REGEX_H_FUNCS /* We prefer POSIX regex */ #include <regex.h> @@ -252,6 +252,6 @@ static FIELDTYPE typeREGEXP = { NULL }; -FIELDTYPE* TYPE_REGEXP = &typeREGEXP; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_REGEXP = &typeREGEXP; /* fty_regex.c ends here */ diff --git a/contrib/ncurses/include/Caps b/contrib/ncurses/include/Caps index 62054fe8d085..0e485082a0e6 100644 --- a/contrib/ncurses/include/Caps +++ b/contrib/ncurses/include/Caps @@ -29,7 +29,7 @@ # Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 # and: Eric S. Raymond <esr@snark.thyrsus.com> # -# $Id: Caps,v 1.28 2000/10/01 02:07:36 tom Exp $ +# $Id: Caps,v 1.31 2001/05/05 21:01:27 tom Exp $ # # This is the master termcap/terminfo capability table. # @@ -594,11 +594,11 @@ key_f62 kf62 str Fq ----E F62 function key key_f63 kf63 str Fr ----E F63 function key clr_bol el1 str cb ----- Clear to beginning of line clear_margins mgc str MC ----- clear right and left soft margins -set_left_margin smgl str ML ----- set left soft margin at current column +set_left_margin smgl str ML ----- set left soft margin at current column. See smgl. (ML is not in BSD termcap). set_right_margin smgr str MR ----- set right soft margin at current column label_format fln str Lf ----- label format set_clock sclk str SC ----- set clock, #1 hrs #2 mins #3 secs -display_clock dclk str DK ----- display clock at (#1,#2) +display_clock dclk str DK ----- display clock remove_clock rmclk str RC ----- remove clock create_window cwin str CW ----- define a window #1 from #2,#3 to #4,#5 goto_window wingo str WG ----- go to window #1 @@ -637,7 +637,7 @@ change_char_pitch cpi str ZA ----- Change number of characters per inch to #1 change_line_pitch lpi str ZB ----- Change number of lines per inch to #1 change_res_horz chr str ZC ----- Change horizontal resolution to #1 change_res_vert cvr str ZD ----- Change vertical resolution to #1 -define_char defc str ZE ----- Define a character +define_char defc str ZE ----- Define a character #1, #2 dots wide, descender #3 enter_doublewide_mode swidm str ZF ----- Enter double-wide mode enter_draft_quality sdrfq str ZG ----- Enter draft-quality mode enter_italics_mode sitm str ZH ----- Enter italic mode @@ -670,15 +670,15 @@ parm_right_micro mcuf str Zh ----- Like parm_right_cursor in micro mode parm_up_micro mcuu str Zi ----- Like parm_up_cursor in micro mode select_char_set scs str Zj ----- Select character set, #1 set_bottom_margin smgb str Zk ----- Set bottom margin at current line -set_bottom_margin_parm smgbp str Zl ----- Set bottom margin at line #1 or #2 lines from bottom -set_left_margin_parm smglp str Zm ----- Set left (right) margin at column #1 (#2) +set_bottom_margin_parm smgbp str Zl ----- Set bottom margin at line #1 or (if smgtp is not given) #2 lines from bottom +set_left_margin_parm smglp str Zm ----- Set left (right) margin at column #1 set_right_margin_parm smgrp str Zn ----- Set right margin at column #1 set_top_margin smgt str Zo ----- Set top margin at current line -set_top_margin_parm smgtp str Zp ----- Set top (bottom) margin at row #1 (#2) +set_top_margin_parm smgtp str Zp ----- Set top (bottom) margin at row #1 start_bit_image sbim str Zq ----- Start printing bit image graphics -start_char_set_def scsd str Zr ----- Start character set definition +start_char_set_def scsd str Zr ----- Start character set definition #1, with #2 characters in the set stop_bit_image rbim str Zs ----- Stop printing bit image graphics -stop_char_set_def rcsd str Zt ----- End definition of character set +stop_char_set_def rcsd str Zt ----- End definition of character set #1 subscript_characters subcs str Zu ----- List of subscriptable characters superscript_characters supcs str Zv ----- List of superscriptable characters these_cause_cr docr str Zw ----- Printing any of these characters causes CR @@ -697,7 +697,7 @@ zero_motion zerom str Zx ----- No motion for subsequent character #%lw25 lw6 lw2 lw18. #%\fBVariable Cap- TCap Description\fR #%\fBString name Code\fR -char_set_names csnm str Zy ----- List of character set names +char_set_names csnm str Zy ----- Produce #1'th item from list of character set names key_mouse kmous str Km ----- Mouse event has occurred mouse_info minfo str Mi ----- Mouse status information req_mouse_pos reqmp str RQ ----- Request mouse position @@ -711,7 +711,7 @@ set0_des_seq s0ds str s0 ----- Shift to code set 0 (EUC set 0, ASCII) set1_des_seq s1ds str s1 ----- Shift to code set 1 set2_des_seq s2ds str s2 ----- Shift to code set 2 set3_des_seq s3ds str s3 ----- Shift to code set 3 -set_lr_margin smglr str ML ----- Set both left and right margins to #1, #2 +set_lr_margin smglr str ML ----- Set both left and right margins to #1, #2. (ML is not in BSD termcap). set_tb_margin smgtb str MT ----- Sets both top and bottom margins to #1, #2 bit_image_repeat birep str Xy ----- Repeat bit image cell #1 #2 times bit_image_newline binel str Zz ----- Move to next row of the bit image @@ -1122,62 +1122,10 @@ box_chars_1 box1 str bx ----K box characters primary set #key_sf8 ksf8 str S8 ----K special function key 8 #key_sf9 ksf9 str S9 ----K special function key 9 #key_sf10 ksf10 str SA ----K special function key 10 +# AIX version 3 documents different codes for F11, F12 and does not mention +# F13-F64. AIX version 4 uses the same naming for F0-F63 as above. #key_f11 kf11 str k< ----- function key 11 #key_f12 kf12 str k> ----- function key 12 -# The key_f13 through key_f64 capabilities aren't described in -# the IBM manual pages, so the cap name strings are guesses. The terminfo -# names are almost certainly right, the termcap ones certainly wrong. -#key_f13 kf13 str k+ ----- function key 13 -#key_f14 kf14 str k+ ----- function key 14 -#key_f15 kf15 str k+ ----- function key 15 -#key_f16 kf16 str k+ ----- function key 16 -#key_f17 kf17 str k+ ----- function key 17 -#key_f18 kf18 str k+ ----- function key 18 -#key_f19 kf19 str k+ ----- function key 19 -#key_f20 kf20 str k+ ----- function key 20 -#key_f21 kf21 str k+ ----- function key 21 -#key_f22 kf22 str k+ ----- function key 22 -#key_f23 kf23 str k+ ----- function key 23 -#key_f24 kf24 str k+ ----- function key 24 -#key_f25 kf25 str k+ ----- function key 25 -#key_f26 kf26 str k+ ----- function key 26 -#key_f27 kf26 str k+ ----- function key 26 -#key_f28 kf28 str k+ ----- function key 28 -#key_f29 kf29 str k+ ----- function key 29 -#key_f30 kf30 str k+ ----- function key 30 -#key_f31 kf31 str k+ ----- function key 31 -#key_f32 kf31 str k+ ----- function key 32 -#key_f33 kf33 str k+ ----- function key 33 -#key_f34 kf34 str k+ ----- function key 34 -#key_f35 kf35 str k+ ----- function key 35 -#key_f36 kf36 str k+ ----- function key 36 -#key_f37 kf37 str k+ ----- function key 37 -#key_f38 kf38 str k+ ----- function key 38 -#key_f39 kf39 str k+ ----- function key 39 -#key_f40 kf40 str k+ ----- function key 40 -#key_f41 kf41 str k+ ----- function key 41 -#key_f42 kf42 str k+ ----- function key 42 -#key_f43 kf43 str k+ ----- function key 43 -#key_f44 kf44 str k+ ----- function key 44 -#key_f45 kf45 str k+ ----- function key 45 -#key_f46 kf46 str k+ ----- function key 46 -#key_f47 kf47 str k+ ----- function key 47 -#key_f48 kf48 str k+ ----- function key 48 -#key_f49 kf49 str k+ ----- function key 49 -#key_f50 kf50 str k+ ----- function key 50 -#key_f51 kf51 str k+ ----- function key 51 -#key_f52 kf52 str k+ ----- function key 52 -#key_f53 kf53 str k+ ----- function key 53 -#key_f54 kf54 str k+ ----- function key 54 -#key_f55 kf55 str k+ ----- function key 55 -#key_f56 kf56 str k+ ----- function key 56 -#key_f57 kf57 str k+ ----- function key 57 -#key_f58 kf58 str k+ ----- function key 58 -#key_f59 kf59 str k+ ----- function key 59 -#key_f60 kf60 str k+ ----- function key 60 -#key_f61 kf61 str k+ ----- function key 61 -#key_f62 kf62 str k+ ----- function key 62 -#key_f63 kf63 str k+ ----- function key 63 # Undocumented capabilities end here. #key_action kact str kJ ----K sent by action key # The IBM docs say these capabilities are for table-drawing, and are diff --git a/contrib/ncurses/include/MKterm.h.awk.in b/contrib/ncurses/include/MKterm.h.awk.in index e839cf4ac6a0..efca636fb32e 100644 --- a/contrib/ncurses/include/MKterm.h.awk.in +++ b/contrib/ncurses/include/MKterm.h.awk.in @@ -33,18 +33,20 @@ BEGIN { print "/* and: Eric S. Raymond <esr@snark.thyrsus.com> */" print "/****************************************************************************/" print "" - print "/* $Id: MKterm.h.awk.in,v 1.37 2000/03/12 02:40:07 tom Exp $ */" + print "/* $Id: MKterm.h.awk.in,v 1.39 2001/03/24 21:53:32 tom Exp $ */" print "" print "/*" print "** term.h -- Definition of struct term" print "*/" print "" - print "#ifndef _NCU_TERM_H" - print "#define _NCU_TERM_H 1" + print "#ifndef NCURSES_TERM_H_incl" + print "#define NCURSES_TERM_H_incl 1" print "" print "#undef NCURSES_VERSION" print "#define NCURSES_VERSION \"@NCURSES_MAJOR@.@NCURSES_MINOR@\"" print "" + print "#include <ncurses_dll.h>" + print "" print "#ifdef __cplusplus" print "extern \"C\" {" print "#endif" @@ -232,7 +234,7 @@ END { print " int _baudrate; /* used to compute padding */" print "} TERMINAL;" print "" - print "extern TERMINAL *cur_term;" + print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;" print "" print "#if BROKEN_LINKER" print "#define boolnames _nc_boolnames()" @@ -245,71 +247,71 @@ END { print "#define strcodes _nc_strcodes()" print "#define strfnames _nc_strfnames()" print "" - print "extern NCURSES_CONST char * const *_nc_boolnames(void);" - print "extern NCURSES_CONST char * const *_nc_boolcodes(void);" - print "extern NCURSES_CONST char * const *_nc_boolfnames(void);" - print "extern NCURSES_CONST char * const *_nc_numnames(void);" - print "extern NCURSES_CONST char * const *_nc_numcodes(void);" - print "extern NCURSES_CONST char * const *_nc_numfnames(void);" - print "extern NCURSES_CONST char * const *_nc_strnames(void);" - print "extern NCURSES_CONST char * const *_nc_strcodes(void);" - print "extern NCURSES_CONST char * const *_nc_strfnames(void);" + print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolnames (void);" + print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolcodes (void);" + print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolfnames (void);" + print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numnames (void);" + print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numcodes (void);" + print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numfnames (void);" + print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strnames (void);" + print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strcodes (void);" + print "extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strfnames (void);" print "" print "#else" print "" - print "extern NCURSES_CONST char *const boolnames[];" - print "extern NCURSES_CONST char *const boolcodes[];" - print "extern NCURSES_CONST char *const boolfnames[];" - print "extern NCURSES_CONST char *const numnames[];" - print "extern NCURSES_CONST char *const numcodes[];" - print "extern NCURSES_CONST char *const numfnames[];" - print "extern NCURSES_CONST char *const strnames[];" - print "extern NCURSES_CONST char *const strcodes[];" - print "extern NCURSES_CONST char *const strfnames[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];" + print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];" print "" print "#endif" print "" print "/* internals */" - print "extern int _nc_set_tty_mode(TTY *buf);" - print "extern int _nc_get_tty_mode(TTY *buf);" - print "extern int _nc_read_entry(const char * const, char * const, TERMTYPE *const);" - print "extern int _nc_read_file_entry(const char *const, TERMTYPE *);" - print "extern char *_nc_first_name(const char *const);" - print "extern int _nc_name_match(const char *const, const char *const, const char *const);" - print "extern int _nc_read_termcap_entry(const char *const, TERMTYPE *const);" - print "extern const TERMTYPE *_nc_fallback(const char *);" + print "extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);" + print "extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf);" + print "extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);" + print "extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);" + print "extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);" + print "extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);" + print "extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const);" + print "extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);" print "" print "/* entry points */" - print "extern TERMINAL *set_curterm(TERMINAL *);" - print "extern int del_curterm(TERMINAL *);" + print "extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);" + print "extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);" print "" print "/* miscellaneous entry points */" - print "extern int restartterm(NCURSES_CONST char *, int, int *);" - print "extern int setupterm(NCURSES_CONST char *,int,int *);" + print "extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);" + print "extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);" print "" print "/* terminfo entry points, also declared in curses.h */" print "#if !defined(__NCURSES_H)" - print "extern char *tigetstr(NCURSES_CONST char *);" - print "extern char *tparm(NCURSES_CONST char *, ...);" - print "extern char ttytype[];" - print "extern int putp(const char *);" - print "extern int tigetflag(NCURSES_CONST char *);" - print "extern int tigetnum(NCURSES_CONST char *);" + print "extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);" + print "extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);" + print "extern NCURSES_EXPORT_VAR(char) ttytype[];" + print "extern NCURSES_EXPORT(int) putp (const char *);" + print "extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);" + print "extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);" print "#endif /* __NCURSES_H */" print "" print "/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */" - print "#if !defined(_NCU_TERMCAP_H)" - print "extern char *tgetstr(NCURSES_CONST char *, char **);" - print "extern char *tgoto(const char *, int, int);" - print "extern int tgetent(char *, const char *);" - print "extern int tgetflag(NCURSES_CONST char *);" - print "extern int tgetnum(NCURSES_CONST char *);" - print "extern int tputs(const char *, int, int (*)(int));" - print "#endif /* _NCU_TERMCAP_H */" + print "#if !defined(NCURSES_TERMCAP_H_incl)" + print "extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);" + print "extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);" + print "extern NCURSES_EXPORT(int) tgetent (char *, const char *);" + print "extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);" + print "extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);" + print "extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));" + print "#endif /* NCURSES_TERMCAP_H_incl */" print "" print "#ifdef __cplusplus" print "}" print "#endif" print "" - print "#endif /* _NCU_TERM_H */" + print "#endif /* NCURSES_TERM_H_incl */" } diff --git a/contrib/ncurses/include/Makefile.in b/contrib/ncurses/include/Makefile.in index 49190916d681..32f14217c897 100644 --- a/contrib/ncurses/include/Makefile.in +++ b/contrib/ncurses/include/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.26 2000/09/02 17:53:40 tom Exp $ +# $Id: Makefile.in,v 1.27 2001/03/24 19:53:31 tom Exp $ ############################################################################## -# 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 "Software"), # @@ -96,7 +96,7 @@ tags: @MAKE_UPPER_TAGS@ etags *.[ch] mostlyclean :: - -rm -f core tags TAGS *~ *.ln *.atac trace + -rm -f core tags TAGS *~ *.i *.ln *.atac trace clean :: mostlyclean -rm -f $(AUTO_SRC) diff --git a/contrib/ncurses/include/curses.h.in b/contrib/ncurses/include/curses.h.in index 5b9e19be266d..b73d44f22c90 100644 --- a/contrib/ncurses/include/curses.h.in +++ b/contrib/ncurses/include/curses.h.in @@ -31,7 +31,7 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ -/* $Id: curses.h.in,v 1.96 2000/09/16 16:11:01 tom Exp $ */ +/* $Id: curses.h.in,v 1.97 2000/12/10 02:00:24 tom Exp $ */ #ifndef __NCURSES_H #define __NCURSES_H @@ -54,6 +54,8 @@ #undef NCURSES_VERSION #define NCURSES_VERSION "@NCURSES_MAJOR@.@NCURSES_MINOR@" +#include <ncurses_dll.h> + #ifdef NCURSES_NOMACROS #define NCURSES_ATTR_T attr_t #endif @@ -123,8 +125,8 @@ extern "C" { #define WA_VERTICAL A_VERTICAL /* colors */ -extern int COLORS; -extern int COLOR_PAIRS; +extern NCURSES_EXPORT_VAR(int) COLORS; +extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; #define COLOR_BLACK 0 #define COLOR_RED 1 @@ -137,7 +139,7 @@ extern int COLOR_PAIRS; /* line graphics */ -extern chtype acs_map[]; +extern NCURSES_EXPORT_VAR(chtype) acs_map[]; /* VT100 symbols begin here */ #define ACS_ULCORNER (acs_map['l']) /* upper left corner */ @@ -304,33 +306,33 @@ struct _win_st NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ }; -extern WINDOW *stdscr; -extern WINDOW *curscr; -extern WINDOW *newscr; +extern NCURSES_EXPORT_VAR(WINDOW *) stdscr; +extern NCURSES_EXPORT_VAR(WINDOW *) curscr; +extern NCURSES_EXPORT_VAR(WINDOW *) newscr; -extern int LINES; -extern int COLS; -extern int TABSIZE; +extern NCURSES_EXPORT_VAR(int) LINES; +extern NCURSES_EXPORT_VAR(int) COLS; +extern NCURSES_EXPORT_VAR(int) TABSIZE; /* * This global was an undocumented feature under AIX curses. */ -extern int ESCDELAY; /* ESC expire time in milliseconds */ +extern NCURSES_EXPORT_VAR(int) ESCDELAY; /* ESC expire time in milliseconds */ -extern char ttytype[]; /* needed for backward compatibility */ +extern NCURSES_EXPORT_VAR(char) ttytype[]; /* needed for backward compatibility */ /* * These functions are extensions - not in XSI Curses. */ -extern char *keybound (int, int); -extern const char *curses_version (void); -extern int assume_default_colors (int, int); -extern int define_key (char *, int); -extern int keyok (int, bool); -extern int resizeterm (int, int); -extern int use_default_colors (void); -extern int use_extended_names (bool); -extern int wresize (WINDOW *, int, int); +extern NCURSES_EXPORT(char *) keybound (int, int); +extern NCURSES_EXPORT(const char *) curses_version (void); +extern NCURSES_EXPORT(int) assume_default_colors (int, int); +extern NCURSES_EXPORT(int) define_key (char *, int); +extern NCURSES_EXPORT(int) keyok (int, bool); +extern NCURSES_EXPORT(int) resizeterm (int, int); +extern NCURSES_EXPORT(int) use_default_colors (void); +extern NCURSES_EXPORT(int) use_extended_names (bool); +extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int); /* * GCC (and some other compilers) define '__attribute__'; we're using this @@ -384,478 +386,478 @@ extern int wresize (WINDOW *, int, int); * requirements. */ -extern int addch(const chtype); /* generated */ -extern int addchnstr(const chtype *, int); /* generated */ -extern int addchstr(const chtype *); /* generated */ -extern int addnstr(const char *, int); /* generated */ -extern int addstr(const char *); /* generated */ +extern NCURSES_EXPORT(int) addch (const chtype); /* generated */ +extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */ +extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) addstr (const char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int addnwstr(const wchar_t *, int); /* missing */ -extern int addwstr(const wchar_t *); /* missing */ -extern int add_wch(const cchar_t *); /* missing */ -extern int add_wchnstr(const cchar_t *, int); /* missing */ -extern int add_wchstr(const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) addnwstr (const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) addwstr (const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) add_wch (const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) add_wchnstr (const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) add_wchstr (const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int attroff(NCURSES_ATTR_T); /* generated */ -extern int attron(NCURSES_ATTR_T); /* generated */ -extern int attrset(NCURSES_ATTR_T); /* generated */ -extern int attr_get(attr_t *, short *, void *); /* generated */ -extern int attr_off(attr_t, void *); /* generated */ -extern int attr_on(attr_t, void *); /* generated */ -extern int attr_set(attr_t, short, void *); /* generated */ -extern int baudrate(void); /* implemented */ -extern int beep(void); /* implemented */ -extern int bkgd(chtype); /* generated */ -extern void bkgdset(chtype); /* generated */ +extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *); /* generated */ +extern NCURSES_EXPORT(int) baudrate (void); /* implemented */ +extern NCURSES_EXPORT(int) beep (void); /* implemented */ +extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */ +extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern void bkgrndset(const cchar_t *); /* missing */ -extern int bkgrnd(const cchar_t *); /* missing */ +extern NCURSES_EXPORT(void) bkgrndset (const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) bkgrnd (const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int border(chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */ +extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int border_set(const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* missing */ +extern NCURSES_EXPORT(int) border_set (const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int box(WINDOW *, chtype, chtype); /* generated */ +extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int box_set(WINDOW *, const cchar_t *, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) box_set (WINDOW *, const cchar_t *, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern bool can_change_color(void); /* implemented */ -extern int cbreak(void); /* implemented */ -extern int chgat(int, attr_t, short, const void *); /* generated */ -extern int clear(void); /* generated */ -extern int clearok(WINDOW *,bool); /* implemented */ -extern int clrtobot(void); /* generated */ -extern int clrtoeol(void); /* generated */ -extern int color_content(short,short*,short*,short*); /* implemented */ -extern int color_set(short,void*); /* generated */ -extern int COLOR_PAIR(int); /* generated */ -extern int copywin(const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ -extern int curs_set(int); /* implemented */ -extern int def_prog_mode(void); /* implemented */ -extern int def_shell_mode(void); /* implemented */ -extern int delay_output(int); /* implemented */ -extern int delch(void); /* generated */ -extern void delscreen(SCREEN *); /* implemented */ -extern int delwin(WINDOW *); /* implemented */ -extern int deleteln(void); /* generated */ -extern WINDOW *derwin(WINDOW *,int,int,int,int); /* implemented */ -extern int doupdate(void); /* implemented */ -extern WINDOW *dupwin(WINDOW *); /* implemented */ -extern int echo(void); /* implemented */ -extern int echochar(const chtype); /* generated */ -extern int erase(void); /* generated */ +extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */ +extern NCURSES_EXPORT(int) cbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *); /* generated */ +extern NCURSES_EXPORT(int) clear (void); /* generated */ +extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) clrtobot (void); /* generated */ +extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */ +extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*); /* implemented */ +extern NCURSES_EXPORT(int) color_set (short,void*); /* generated */ +extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */ +extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) curs_set (int); /* implemented */ +extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) delay_output (int); /* implemented */ +extern NCURSES_EXPORT(int) delch (void); /* generated */ +extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) deleteln (void); /* generated */ +extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) doupdate (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) echo (void); /* implemented */ +extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */ +extern NCURSES_EXPORT(int) erase (void); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int echo_wchar(const cchar_t *); /* missing */ -extern int erasewchar(wchar_t*); /* missing */ +extern NCURSES_EXPORT(int) echo_wchar (const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) erasewchar (wchar_t*); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int endwin(void); /* implemented */ -extern char erasechar(void); /* implemented */ -extern void filter(void); /* implemented */ -extern int flash(void); /* implemented */ -extern int flushinp(void); /* implemented */ -extern chtype getbkgd(WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) endwin (void); /* implemented */ +extern NCURSES_EXPORT(char) erasechar (void); /* implemented */ +extern NCURSES_EXPORT(void) filter (void); /* implemented */ +extern NCURSES_EXPORT(int) flash (void); /* implemented */ +extern NCURSES_EXPORT(int) flushinp (void); /* implemented */ +extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int getbkgrnd(cchar_t *); /* missing */ -extern int getcchar(const cchar_t *, wchar_t*, attr_t*, short*, void*); /* missing */ +extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, short*, void*); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int getch(void); /* generated */ -extern int getnstr(char *, int); /* generated */ +extern NCURSES_EXPORT(int) getch (void); /* generated */ +extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int getn_wstr(wint_t *, int); /* missing */ +extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int getstr(char *); /* generated */ +extern NCURSES_EXPORT(int) getstr (char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int get_wch(wint_t *); /* missing */ +extern NCURSES_EXPORT(int) get_wch (wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern WINDOW *getwin(FILE *); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int get_wstr(wint_t *); /* missing */ +extern NCURSES_EXPORT(int) get_wstr (wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int halfdelay(int); /* implemented */ -extern bool has_colors(void); /* implemented */ -extern bool has_ic(void); /* implemented */ -extern bool has_il(void); /* implemented */ -extern int hline(chtype, int); /* generated */ +extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */ +extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_il (void); /* implemented */ +extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int hline_set(const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern void idcok(WINDOW *, bool); /* implemented */ -extern int idlok(WINDOW *, bool); /* implemented */ -extern void immedok(WINDOW *, bool); /* implemented */ -extern chtype inch(void); /* generated */ -extern int inchnstr(chtype *, int); /* generated */ -extern int inchstr(chtype *); /* generated */ -extern WINDOW *initscr(void); /* implemented */ -extern int init_color(short,short,short,short); /* implemented */ -extern int init_pair(short,short,short); /* implemented */ -extern int innstr(char *, int); /* generated */ +extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) inch (void); /* generated */ +extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */ +extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */ +extern NCURSES_EXPORT(int) init_color (short,short,short,short); /* implemented */ +extern NCURSES_EXPORT(int) init_pair (short,short,short); /* implemented */ +extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int innwstr(wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) innwstr (wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int insch(chtype); /* generated */ -extern int insdelln(int); /* generated */ -extern int insertln(void); /* generated */ -extern int insnstr(const char *, int); /* generated */ -extern int insstr(const char *); /* generated */ -extern int instr(char *); /* generated */ +extern NCURSES_EXPORT(int) insch (chtype); /* generated */ +extern NCURSES_EXPORT(int) insdelln (int); /* generated */ +extern NCURSES_EXPORT(int) insertln (void); /* generated */ +extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) insstr (const char *); /* generated */ +extern NCURSES_EXPORT(int) instr (char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int ins_nwstr(const wchar_t *, int); /* missing */ -extern int ins_wch(const cchar_t *); /* missing */ -extern int ins_wstr(const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) ins_nwstr (const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) ins_wch (const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) ins_wstr (const wchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int intrflush(WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int inwstr(wchar_t *); /* missing */ -extern int in_wch(NCURSES_CONST cchar_t *); /* missing */ -extern int in_wchstr(NCURSES_CONST cchar_t *); /* missing */ -extern int in_wchnstr(NCURSES_CONST cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) inwstr (wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) in_wch (NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) in_wchstr (NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) in_wchnstr (NCURSES_CONST cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern bool isendwin(void); /* implemented */ -extern bool is_linetouched(WINDOW *,int); /* implemented */ -extern bool is_wintouched(WINDOW *); /* implemented */ -extern NCURSES_CONST char *keyname(int); /* implemented */ +extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */ +extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern char *key_name(wchar_t); /* missing */ +extern NCURSES_EXPORT(char *) key_name (wchar_t); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int keypad(WINDOW *,bool); /* implemented */ -extern char killchar(void); /* implemented */ +extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char) killchar (void); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int killwchar(wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) killwchar (wchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int leaveok(WINDOW *,bool); /* implemented */ -extern char *longname(void); /* implemented */ -extern int meta(WINDOW *,bool); /* implemented */ -extern int move(int, int); /* generated */ -extern int mvaddch(int, int, const chtype); /* generated */ -extern int mvaddchnstr(int, int, const chtype *, int); /* generated */ -extern int mvaddchstr(int, int, const chtype *); /* generated */ -extern int mvaddnstr(int, int, const char *, int); /* generated */ -extern int mvaddstr(int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char *) longname (void); /* implemented */ +extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) move (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvaddnwstr(int, int, const wchar_t *, int); /* missing */ -extern int mvaddwstr(int, int, const wchar_t *); /* missing */ -extern int mvadd_wch(int, int, const cchar_t *); /* missing */ -extern int mvadd_wchnstr(int, int, const cchar_t *, int);/* missing */ -extern int mvadd_wchstr(int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvaddnwstr (int, int, const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvaddwstr (int, int, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvadd_wch (int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvadd_wchnstr (int, int, const cchar_t *, int);/* missing */ +extern NCURSES_EXPORT(int) mvadd_wchstr (int, int, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvchgat(int, int, int, attr_t, short, const void *); /* generated */ -extern int mvcur(int,int,int,int); /* implemented */ -extern int mvdelch(int, int); /* generated */ -extern int mvderwin(WINDOW *, int, int); /* implemented */ -extern int mvgetch(int, int); /* generated */ -extern int mvgetnstr(int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *); /* generated */ +extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvgetn_wstr(int, int, wint_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvgetn_wstr (int, int, wint_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvgetstr(int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvget_wch(int, int, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) mvget_wch (int, int, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvget_wstr(int, int, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) mvget_wstr (int, int, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvhline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvhline_set(int, int, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvhline_set (int, int, const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern chtype mvinch(int, int); /* generated */ -extern int mvinchnstr(int, int, chtype *, int); /* generated */ -extern int mvinchstr(int, int, chtype *); /* generated */ -extern int mvinnstr(int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvinnwstr(int, int, wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvinnwstr (int, int, wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvinsch(int, int, chtype); /* generated */ -extern int mvinsnstr(int, int, const char *, int); /* generated */ -extern int mvinsstr(int, int, const char *); /* generated */ -extern int mvinstr(int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvins_nwstr(int, int, const wchar_t *, int); /* missing */ -extern int mvins_wch(int, int, const cchar_t *); /* missing */ -extern int mvins_wstr(int, int, const wchar_t *); /* missing */ -extern int mvinwstr(int, int, wchar_t *); /* missing */ -extern int mvin_wch(int, int, NCURSES_CONST cchar_t *); /* missing */ -extern int mvin_wchstr(int, int, NCURSES_CONST cchar_t *); /* missing */ -extern int mvin_wchnstr(int, int, NCURSES_CONST cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvins_nwstr (int, int, const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvins_wch (int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvins_wstr (int, int, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvinwstr (int, int, wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvin_wch (int, int, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvin_wchstr (int, int, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvin_wchnstr (int, int, NCURSES_CONST cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvprintw(int,int, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) mvprintw (int,int, NCURSES_CONST char *,...) /* implemented */ GCC_PRINTFLIKE(3,4); -extern int mvscanw(int,int, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(3,4); -extern int mvvline(int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvvline_set(int, int, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvvline_set (int, int, const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwaddch(WINDOW *, int, int, const chtype); /* generated */ -extern int mvwaddchnstr(WINDOW *, int, int, const chtype *, int);/* generated */ -extern int mvwaddchstr(WINDOW *, int, int, const chtype *); /* generated */ -extern int mvwaddnstr(WINDOW *, int, int, const char *, int); /* generated */ -extern int mvwaddstr(WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */ +extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);/* missing */ -extern int mvwaddwstr(WINDOW *, int, int, const wchar_t *); /* missing */ -extern int mvwadd_wch(WINDOW *, int, int, const cchar_t *); /* missing */ -extern int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int); /* missing */ -extern int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwaddnwstr (WINDOW *, int, int, const wchar_t *, int);/* missing */ +extern NCURSES_EXPORT(int) mvwaddwstr (WINDOW *, int, int, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwadd_wch (WINDOW *, int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwadd_wchnstr (WINDOW *, int, int, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvwadd_wchstr (WINDOW *, int, int, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);/* generated */ -extern int mvwdelch(WINDOW *, int, int); /* generated */ -extern int mvwgetch(WINDOW *, int, int); /* generated */ -extern int mvwgetnstr(WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */ +extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int);/* missing */ +extern NCURSES_EXPORT(int) mvwgetn_wstr (WINDOW *, int, int, wint_t *, int);/* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwgetstr(WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwget_wch(WINDOW *, int, int, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwget_wch (WINDOW *, int, int, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwget_wstr(WINDOW *, int, int, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwget_wstr (WINDOW *, int, int, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwhline(WINDOW *, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwhline_set(WINDOW *, int, int, const cchar_t *, int);/* missing */ +extern NCURSES_EXPORT(int) mvwhline_set (WINDOW *, int, int, const cchar_t *, int);/* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwin(WINDOW *,int,int); /* implemented */ -extern chtype mvwinch(WINDOW *, int, int); /* generated */ -extern int mvwinchnstr(WINDOW *, int, int, chtype *, int); /* generated */ -extern int mvwinchstr(WINDOW *, int, int, chtype *); /* generated */ -extern int mvwinnstr(WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwinnwstr(WINDOW *, int, int, wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) mvwinnwstr (WINDOW *, int, int, wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwinsch(WINDOW *, int, int, chtype); /* generated */ -extern int mvwinsnstr(WINDOW *, int, int, const char *, int); /* generated */ -extern int mvwinsstr(WINDOW *, int, int, const char *); /* generated */ -extern int mvwinstr(WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwins_nwstr(WINDOW *, int,int, const wchar_t *,int); /* missing */ -extern int mvwins_wch(WINDOW *, int, int, const cchar_t *); /* missing */ -extern int mvwins_wstr(WINDOW *, int, int, const wchar_t *); /* missing */ -extern int mvwinwstr(WINDOW *, int, int, wchar_t *); /* missing */ -extern int mvwin_wch(WINDOW *, int, int, NCURSES_CONST cchar_t *); /* missing */ -extern int mvwin_wchnstr(WINDOW *, int,int, NCURSES_CONST cchar_t *,int); /* missing */ -extern int mvwin_wchstr(WINDOW *, int, int, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwins_nwstr (WINDOW *, int,int, const wchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) mvwins_wch (WINDOW *, int, int, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwins_wstr (WINDOW *, int, int, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwin_wch (WINDOW *, int, int, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) mvwin_wchnstr (WINDOW *, int,int, NCURSES_CONST cchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) mvwin_wchstr (WINDOW *, int, int, NCURSES_CONST cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int mvwprintw(WINDOW*,int,int, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, NCURSES_CONST char *,...) /* implemented */ GCC_PRINTFLIKE(4,5); -extern int mvwscanw(WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(4,5); -extern int mvwvline(WINDOW *,int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int mvwvline_set(WINDOW *, int,int, const cchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int napms(int); /* implemented */ -extern WINDOW *newpad(int,int); /* implemented */ -extern SCREEN *newterm(NCURSES_CONST char *,FILE *,FILE *); /* implemented */ -extern WINDOW *newwin(int,int,int,int); /* implemented */ -extern int nl(void); /* implemented */ -extern int nocbreak(void); /* implemented */ -extern int nodelay(WINDOW *,bool); /* implemented */ -extern int noecho(void); /* implemented */ -extern int nonl(void); /* implemented */ -extern void noqiflush(void); /* implemented */ -extern int noraw(void); /* implemented */ -extern int notimeout(WINDOW *,bool); /* implemented */ -extern int overlay(const WINDOW*,WINDOW *); /* implemented */ -extern int overwrite(const WINDOW*,WINDOW *); /* implemented */ -extern int pair_content(short,short*,short*); /* implemented */ -extern int PAIR_NUMBER(int); /* generated */ -extern int pechochar(WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) napms (int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newpad (int,int); /* implemented */ +extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) nl (void); /* implemented */ +extern NCURSES_EXPORT(int) nocbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) noecho (void); /* implemented */ +extern NCURSES_EXPORT(int) nonl (void); /* implemented */ +extern NCURSES_EXPORT(void) noqiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) noraw (void); /* implemented */ +extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) pair_content (short,short*,short*); /* implemented */ +extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */ +extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int pecho_wchar(WINDOW *, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int pnoutrefresh(WINDOW*,int,int,int,int,int,int);/* implemented */ -extern int prefresh(WINDOW *,int,int,int,int,int,int); /* implemented */ -extern int printw(NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */ +extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) printw (NCURSES_CONST char *,...) /* implemented */ GCC_PRINTFLIKE(1,2); -extern int putp(const char *); /* implemented */ -extern int putwin(WINDOW *, FILE *); /* implemented */ -extern void qiflush(void); /* implemented */ -extern int raw(void); /* implemented */ -extern int redrawwin(WINDOW *); /* generated */ -extern int refresh(void); /* generated */ -extern int resetty(void); /* implemented */ -extern int reset_prog_mode(void); /* implemented */ -extern int reset_shell_mode(void); /* implemented */ -extern int ripoffline(int, int (*init)(WINDOW *, int)); /* implemented */ -extern int savetty(void); /* implemented */ -extern int scanw(NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) putp (const char *); /* implemented */ +extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *); /* implemented */ +extern NCURSES_EXPORT(void) qiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) raw (void); /* implemented */ +extern NCURSES_EXPORT(int) redrawwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) refresh (void); /* generated */ +extern NCURSES_EXPORT(int) resetty (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) ripoffline (int, int (*init)(WINDOW *, int)); /* implemented */ +extern NCURSES_EXPORT(int) savetty (void); /* implemented */ +extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(1,2); -extern int scr_dump(const char *); /* implemented */ -extern int scr_init(const char *); /* implemented */ -extern int scrl(int); /* generated */ -extern int scroll(WINDOW *); /* generated */ -extern int scrollok(WINDOW *,bool); /* implemented */ -extern int scr_restore(const char *); /* implemented */ -extern int scr_set(const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_dump (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_init (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scrl (int); /* generated */ +extern NCURSES_EXPORT(int) scroll (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) scr_restore (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_set (const char *); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int setcchar(cchar_t *, const wchar_t *, const attr_t, short, const void *); /* missing */ +extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, short, const void *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int setscrreg(int,int); /* generated */ -extern SCREEN *set_term(SCREEN *); /* implemented */ -extern int slk_attroff(const chtype); /* implemented */ -extern int slk_attr_off(const attr_t, void *); /* generated:WIDEC */ -extern int slk_attron(const chtype); /* implemented */ -extern int slk_attr_on(attr_t,void*); /* generated:WIDEC */ -extern int slk_attrset(const chtype); /* implemented */ -extern attr_t slk_attr(void); /* implemented */ -extern int slk_attr_set(const attr_t,short,void*); /* implemented */ -extern int slk_clear(void); /* implemented */ -extern int slk_color(short); /* implemented */ -extern int slk_init(int); /* implemented */ -extern char *slk_label(int); /* implemented */ -extern int slk_noutrefresh(void); /* implemented */ -extern int slk_refresh(void); /* implemented */ -extern int slk_restore(void); /* implemented */ -extern int slk_set(int,const char *,int); /* implemented */ -extern int slk_touch(void); /* implemented */ +extern NCURSES_EXPORT(int) setscrreg (int,int); /* generated */ +extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) slk_attroff (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */ +extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_color (short); /* implemented */ +extern NCURSES_EXPORT(int) slk_init (int); /* implemented */ +extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */ +extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_refresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_restore (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_set (int,const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) slk_touch (void); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int slk_wset(int, const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int standout(void); /* generated */ -extern int standend(void); /* generated */ -extern int start_color(void); /* implemented */ -extern WINDOW *subpad(WINDOW *, int, int, int, int); /* implemented */ -extern WINDOW *subwin(WINDOW *,int,int,int,int); /* implemented */ -extern int syncok(WINDOW *, bool); /* implemented */ -extern chtype termattrs(void); /* implemented */ -extern attr_t term_attrs(void); /* missing */ -extern char *termname(void); /* implemented */ -extern int tigetflag(NCURSES_CONST char *); /* implemented */ -extern int tigetnum(NCURSES_CONST char *); /* implemented */ -extern char *tigetstr(NCURSES_CONST char *); /* implemented */ -extern void timeout(int); /* generated */ -extern int touchline(WINDOW *, int, int); /* generated */ -extern int touchwin(WINDOW *); /* generated */ -extern char *tparm(NCURSES_CONST char *, ...); /* implemented */ -extern int typeahead(int); /* implemented */ -extern int ungetch(int); /* implemented */ +extern NCURSES_EXPORT(int) standout (void); /* generated */ +extern NCURSES_EXPORT(int) standend (void); /* generated */ +extern NCURSES_EXPORT(int) start_color (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) syncok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) termattrs (void); /* implemented */ +extern NCURSES_EXPORT(attr_t) term_attrs (void); /* missing */ +extern NCURSES_EXPORT(char *) termname (void); /* implemented */ +extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(void) timeout (int); /* generated */ +extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) touchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* implemented */ +extern NCURSES_EXPORT(int) typeahead (int); /* implemented */ +extern NCURSES_EXPORT(int) ungetch (int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int unget_wch(const wchar_t); /* missing */ +extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int untouchwin(WINDOW *); /* generated */ -extern void use_env(bool); /* implemented */ -extern int vidattr(chtype); /* implemented */ -extern int vid_attr(attr_t, short, void *); /* generated:WIDEC */ -extern int vidputs(chtype, int (*)(int)); /* implemented */ +extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) use_env (bool); /* implemented */ +extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */ +extern NCURSES_EXPORT(int) vid_attr (attr_t, short, void *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) vidputs (chtype, int (*)(int)); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int vid_puts(attr_t, short, void *, int (*)(int)); /* missing */ +extern NCURSES_EXPORT(int) vid_puts (attr_t, short, void *, int (*)(int)); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int vline(chtype, int); /* generated */ +extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int vline_set(const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int vwprintw(WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ -extern int vw_printw(WINDOW *, NCURSES_CONST char *,va_list); /* generated */ -extern int vwscanw(WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ -extern int vw_scanw(WINDOW *, NCURSES_CONST char *,va_list); /* generated */ -extern int waddch(WINDOW *, const chtype); /* implemented */ -extern int waddchnstr(WINDOW *,const chtype *const,int); /* implemented */ -extern int waddchstr(WINDOW *,const chtype *); /* generated */ -extern int waddnstr(WINDOW *,const char *const,int); /* implemented */ -extern int waddstr(WINDOW *,const char *); /* generated */ +extern NCURSES_EXPORT(int) vwprintw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ +extern NCURSES_EXPORT(int) vw_printw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */ +extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ +extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */ +extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *const,int); /* implemented */ +extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *); /* generated */ +extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *const,int); /* implemented */ +extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int waddwstr(WINDOW *,const wchar_t *); /* missing */ -extern int waddnwstr(WINDOW *,const wchar_t *,int); /* missing */ -extern int wadd_wch(WINDOW *,const cchar_t *); /* missing */ -extern int wadd_wchnstr(WINDOW *,const cchar_t *,int); /* missing */ -extern int wadd_wchstr(WINDOW *,const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) waddwstr (WINDOW *,const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) waddnwstr (WINDOW *,const wchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* missing */ +extern NCURSES_EXPORT(int) wadd_wchstr (WINDOW *,const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wattron(WINDOW *, int); /* generated */ -extern int wattroff(WINDOW *, int); /* generated */ -extern int wattrset(WINDOW *, int); /* generated */ -extern int wattr_get(WINDOW *, attr_t *, short *, void *); /* generated */ -extern int wattr_on(WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ -extern int wattr_off(WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ -extern int wattr_set(WINDOW *, attr_t, short, void *); /* generated */ -extern int wbkgd(WINDOW *,const chtype); /* implemented */ -extern void wbkgdset(WINDOW *,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *); /* generated */ +extern NCURSES_EXPORT(int) wattr_on (WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_off (WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *); /* generated */ +extern NCURSES_EXPORT(int) wbkgd (WINDOW *,const chtype); /* implemented */ +extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern void wbkgrndset(WINDOW *,const cchar_t *); /* missing */ -extern int wbkgrnd(WINDOW *,const cchar_t *); /* missing */ +extern NCURSES_EXPORT(void) wbkgrndset (WINDOW *,const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wbkgrnd (WINDOW *,const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wborder(WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wborder_set(WINDOW *,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* missing */ +extern NCURSES_EXPORT(int) wborder_set (WINDOW *,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*,const cchar_t*); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wchgat(WINDOW *, int, attr_t, short, const void *);/* implemented */ -extern int wclear(WINDOW *); /* implemented */ -extern int wclrtobot(WINDOW *); /* implemented */ -extern int wclrtoeol(WINDOW *); /* implemented */ -extern int wcolor_set(WINDOW*,short,void*); /* implemented */ -extern void wcursyncup(WINDOW *); /* implemented */ -extern int wdelch(WINDOW *); /* implemented */ -extern int wdeleteln(WINDOW *); /* generated */ -extern int wechochar(WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */ +extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*); /* implemented */ +extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wecho_wchar(WINDOW *, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wecho_wchar (WINDOW *, const cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int werase(WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) werase (WINDOW *); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wgetbkgrnd(WINDOW *, cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wgetbkgrnd (WINDOW *, cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wgetch(WINDOW *); /* implemented */ -extern int wgetnstr(WINDOW *,char *,int); /* implemented */ +extern NCURSES_EXPORT(int) wgetch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wgetn_wstr(WINDOW *,wint_t *, int); /* missing */ +extern NCURSES_EXPORT(int) wgetn_wstr (WINDOW *,wint_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wgetstr(WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wget_wch(WINDOW *, wint_t *); /* missing */ -extern int wget_wstr(WINDOW *, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) wget_wch (WINDOW *, wint_t *); /* missing */ +extern NCURSES_EXPORT(int) wget_wstr (WINDOW *, wint_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int whline(WINDOW *, chtype, int); /* implemented */ +extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int whline_set(WINDOW *, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) whline_set (WINDOW *, const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern chtype winch(WINDOW *); /* implemented */ -extern int winchnstr(WINDOW *, chtype *, int); /* implemented */ -extern int winchstr(WINDOW *, chtype *); /* generated */ -extern int winnstr(WINDOW *, char *, int); /* implemented */ +extern NCURSES_EXPORT(chtype) winch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int); /* implemented */ +extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *); /* generated */ +extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int winnwstr(WINDOW *, wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) winnwstr (WINDOW *, wchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int winsch(WINDOW *, chtype); /* implemented */ -extern int winsdelln(WINDOW *,int); /* implemented */ -extern int winsertln(WINDOW *); /* generated */ -extern int winsnstr(WINDOW *, const char *,int); /* implemented */ -extern int winsstr(WINDOW *, const char *); /* generated */ -extern int winstr(WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype); /* implemented */ +extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsertln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *); /* generated */ +extern NCURSES_EXPORT(int) winstr (WINDOW *, char *); /* generated */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wins_nwstr(WINDOW *, const wchar_t *, int); /* missing */ -extern int wins_wch(WINDOW *, const cchar_t *); /* missing */ -extern int wins_wstr(WINDOW *, const wchar_t *); /* missing */ -extern int winwstr(WINDOW *, wchar_t *); /* missing */ -extern int win_wch(WINDOW *, NCURSES_CONST cchar_t *); /* missing */ -extern int win_wchnstr(WINDOW *, NCURSES_CONST cchar_t *, int); /* missing */ -extern int win_wchstr(WINDOW *, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wins_nwstr (WINDOW *, const wchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) wins_wch (WINDOW *, const cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) wins_wstr (WINDOW *, const wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *); /* missing */ +extern NCURSES_EXPORT(int) win_wch (WINDOW *, NCURSES_CONST cchar_t *); /* missing */ +extern NCURSES_EXPORT(int) win_wchnstr (WINDOW *, NCURSES_CONST cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) win_wchstr (WINDOW *, NCURSES_CONST cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wmove(WINDOW *,int,int); /* implemented */ -extern int wnoutrefresh(WINDOW *); /* implemented */ -extern int wprintw(WINDOW *, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wprintw (WINDOW *, NCURSES_CONST char *,...) /* implemented */ GCC_PRINTFLIKE(2,3); -extern int wredrawln(WINDOW *,int,int); /* implemented */ -extern int wrefresh(WINDOW *); /* implemented */ -extern int wscanw(WINDOW *, NCURSES_CONST char *,...) /* implemented */ +extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...) /* implemented */ GCC_SCANFLIKE(2,3); -extern int wscrl(WINDOW *,int); /* implemented */ -extern int wsetscrreg(WINDOW *,int,int); /* implemented */ -extern int wstandout(WINDOW *); /* generated */ -extern int wstandend(WINDOW *); /* generated */ -extern void wsyncdown(WINDOW *); /* implemented */ -extern void wsyncup(WINDOW *); /* implemented */ -extern void wtimeout(WINDOW *,int); /* implemented */ -extern int wtouchln(WINDOW *,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wscrl (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wstandout (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern wchar_t *wunctrl(cchar_t *); /* missing */ +extern NCURSES_EXPORT(wchar_t *) wunctrl (cchar_t *); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern int wvline(WINDOW *,chtype,int); /* implemented */ +extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ #ifdef _XOPEN_SOURCE_EXTENDED -extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */ +extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* missing */ #endif /* _XOPEN_SOURCE_EXTENDED */ -extern bool mouse_trafo(int*, int*, bool); /* generated */ +extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */ /* attributes */ @@ -1301,32 +1303,32 @@ typedef struct } MEVENT; -extern int getmouse(MEVENT *); -extern int ungetmouse(MEVENT *); -extern mmask_t mousemask(mmask_t, mmask_t *); -extern bool wenclose(const WINDOW *, int, int); -extern int mouseinterval(int); -extern bool wmouse_trafo(const WINDOW* win,int* y, int* x, bool to_screen); +extern NCURSES_EXPORT(int) getmouse (MEVENT *); +extern NCURSES_EXPORT(int) ungetmouse (MEVENT *); +extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *); +extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int); +extern NCURSES_EXPORT(int) mouseinterval (int); +extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW* win,int* y, int* x, bool to_screen); #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) /* other non-XSI functions */ -extern int mcprint(char *, int); /* direct data to printer */ -extern int has_key(int); /* do we have given key? */ +extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */ /* Debugging : use with libncurses_g.a */ -extern void _tracef(const char *, ...) GCC_PRINTFLIKE(1,2); -extern void _tracedump(const char *, WINDOW *); -extern char *_traceattr(attr_t); -extern char *_traceattr2(int, chtype); -extern char *_nc_tracebits(void); -extern char *_tracechar(const unsigned char); -extern char *_tracechtype(chtype); -extern char *_tracechtype2(int, chtype); -extern char *_tracemouse(const MEVENT *); -extern void trace(const unsigned int); +extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *); +extern NCURSES_EXPORT(char *) _traceattr (attr_t); +extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype); +extern NCURSES_EXPORT(char *) _nc_tracebits (void); +extern NCURSES_EXPORT(char *) _tracechar (const unsigned char); +extern NCURSES_EXPORT(char *) _tracechtype (chtype); +extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype); +extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *); +extern NCURSES_EXPORT(void) trace (const unsigned int); /* trace masks */ #define TRACE_DISABLE 0x0000 /* turn off tracing */ @@ -1347,8 +1349,8 @@ extern void trace(const unsigned int); #define TRACE_MAXIMUM 0xffff /* maximum trace level */ #if defined(TRACE) || defined(NCURSES_TEST) -extern int _nc_optimize_enable; /* enable optimizations */ -extern const char *_nc_visbuf(const char *); +extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ +extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); #define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ #define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ #define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ diff --git a/contrib/ncurses/include/headers b/contrib/ncurses/include/headers index 2a185c21627d..da3738db1e24 100644 --- a/contrib/ncurses/include/headers +++ b/contrib/ncurses/include/headers @@ -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 "Software"), # @@ -32,3 +32,4 @@ term.h curses.h unctrl.h termcap.h +$(srcdir)/ncurses_dll.h diff --git a/contrib/ncurses/include/nc_panel.h b/contrib/ncurses/include/nc_panel.h index dbb20fa184d1..bb1f6745ac0c 100644 --- a/contrib/ncurses/include/nc_panel.h +++ b/contrib/ncurses/include/nc_panel.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 * @@ -33,7 +33,7 @@ /* - * $Id: nc_panel.h,v 1.2 1998/02/11 12:13:45 tom Exp $ + * $Id: nc_panel.h,v 1.3 2000/12/10 02:04:35 tom Exp $ * * nc_panel.h * @@ -57,7 +57,7 @@ struct panelhook { }; /* Retrieve the panelhook of the current screen */ -extern struct panelhook* _nc_panelhook(void); +extern NCURSES_EXPORT(struct panelhook*) _nc_panelhook (void); #ifdef __cplusplus } diff --git a/contrib/ncurses/include/ncurses_defs b/contrib/ncurses/include/ncurses_defs index e4a391f1fd67..76bfcae52f1e 100644 --- a/contrib/ncurses/include/ncurses_defs +++ b/contrib/ncurses/include/ncurses_defs @@ -1,4 +1,4 @@ -# $Id: ncurses_defs,v 1.4 2000/10/08 01:04:00 tom Exp $ +# $Id: ncurses_defs,v 1.7 2001/04/07 22:53:10 tom Exp $ ############################################################################## # Copyright (c) 2000 Free Software Foundation, Inc. # # # @@ -36,6 +36,7 @@ BSD_TPUTS CC_HAS_INLINE_FUNCS CC_HAS_PROTOS CPP_HAS_PARAM_INIT +CPP_HAS_VSCAN_FUNC DECL_ERRNO ETIP_NEEDS_MATH_H GCC_NORETURN /* nothing */ @@ -146,6 +147,8 @@ USE_RCS_IDS USE_SAFE_SPRINTF USE_SCROLL_HINTS USE_SIGWINCH +USE_STDIO_VSCAN +USE_STRSTREAM_VSCAN USE_SYMLINKS USE_WIDEC_SUPPORT USE_XMC_SUPPORT diff --git a/contrib/ncurses/include/ncurses_dll.h b/contrib/ncurses/include/ncurses_dll.h new file mode 100644 index 000000000000..723d21e001bc --- /dev/null +++ b/contrib/ncurses/include/ncurses_dll.h @@ -0,0 +1,41 @@ +/* $Id: ncurses_dll.h,v 1.1 2000/12/10 00:05:35 tom Exp $ */ + + +#if defined(__CYGWIN__) +# if defined(NCURSES_DLL) +# if defined(NCURSES_STATIC) +# undef NCURSES_STATIC +# endif +# endif +# undef NCURSES_IMPEXP +# undef NCURSES_API +# undef NCURSES_EXPORT(type) +# undef NCURSES_EXPORT_VAR(type) +# if defined(NCURSES_DLL) +/* building a DLL */ +# define NCURSES_IMPEXP __declspec(dllexport) +# elif defined(NCURSES_STATIC) +/* building or linking to a static library */ +# define NCURSES_IMPEXP /* nothing */ +# else +/* linking to the DLL */ +# define NCURSES_IMPEXP __declspec(dllimport) +# endif +# define NCURSES_API __cdecl +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + +/* Take care of non-cygwin platforms */ +#if !defined(NCURSES_IMPEXP) +# define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +# define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif diff --git a/contrib/ncurses/include/term_entry.h b/contrib/ncurses/include/term_entry.h index 7d9f77b4befc..a066be9948d1 100644 --- a/contrib/ncurses/include/term_entry.h +++ b/contrib/ncurses/include/term_entry.h @@ -31,14 +31,14 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ -/* $Id: term_entry.h,v 1.29 2000/03/19 02:04:15 tom Exp $ */ +/* $Id: term_entry.h,v 1.32 2001/03/24 21:53:10 tom Exp $ */ /* * term_entry.h -- interface to entry-manipulation code */ -#ifndef _TERM_ENTRY_H -#define _TERM_ENTRY_H +#ifndef NCURSES_TERM_ENTRY_H_incl +#define NCURSES_TERM_ENTRY_H_incl 1 #ifdef __cplusplus extern "C" { @@ -90,7 +90,8 @@ ENTRY; #define ExtNumname(tp,i,names) EXT_NAMES(tp, i, NUMCOUNT, (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, names) #define ExtStrname(tp,i,names) EXT_NAMES(tp, i, STRCOUNT, (i - (tp->num_Strings - tp->ext_Strings)) + (tp->ext_Numbers + tp->ext_Booleans), names) -extern ENTRY *_nc_head, *_nc_tail; +extern NCURSES_EXPORT_VAR(ENTRY *) _nc_head; +extern NCURSES_EXPORT_VAR(ENTRY *) _nc_tail; #define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next) #define MAX_LINE 132 @@ -116,46 +117,46 @@ extern ENTRY *_nc_head, *_nc_tail; } /* alloc_entry.c: elementary allocation code */ -extern ENTRY *_nc_copy_entry(ENTRY *oldp); -extern char *_nc_save_str(const char *const); -extern void _nc_init_entry(TERMTYPE *const); -extern void _nc_merge_entry(TERMTYPE *const, TERMTYPE *const); -extern void _nc_wrap_entry(ENTRY *const); +extern NCURSES_EXPORT(ENTRY *) _nc_copy_entry (ENTRY *oldp); +extern NCURSES_EXPORT(char *) _nc_save_str (const char *const); +extern NCURSES_EXPORT(void) _nc_init_entry (TERMTYPE *const); +extern NCURSES_EXPORT(void) _nc_merge_entry (TERMTYPE *const, TERMTYPE *const); +extern NCURSES_EXPORT(void) _nc_wrap_entry (ENTRY *const, bool); /* alloc_ttype.c: elementary allocation code */ -extern void _nc_align_termtype(TERMTYPE *, TERMTYPE *); -extern void _nc_copy_termtype(TERMTYPE *, TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE *, TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, TERMTYPE *); /* free_ttype.c: elementary allocation code */ -extern void _nc_free_termtype(TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *); /* lib_acs.c */ -extern void _nc_init_acs(void); /* corresponds to traditional 'init_acs()' */ +extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */ /* parse_entry.c: entry-parsing code */ #if NCURSES_XNAMES -extern bool _nc_user_definable; -extern bool _nc_disable_period; +extern NCURSES_EXPORT_VAR(bool) _nc_user_definable; +extern NCURSES_EXPORT_VAR(bool) _nc_disable_period; #endif -extern int _nc_parse_entry(ENTRY *, int, bool); -extern int _nc_capcmp(const char *, const char *); +extern NCURSES_EXPORT(int) _nc_parse_entry (ENTRY *, int, bool); +extern NCURSES_EXPORT(int) _nc_capcmp (const char *, const char *); /* write_entry.c: writing an entry to the file system */ -extern void _nc_set_writedir(char *); -extern void _nc_write_entry(TERMTYPE *const); +extern NCURSES_EXPORT(void) _nc_set_writedir (char *); +extern NCURSES_EXPORT(void) _nc_write_entry (TERMTYPE *const); /* comp_parse.c: entry list handling */ -extern void _nc_read_entry_source(FILE*, char*, int, bool, bool (*)(ENTRY*)); -extern bool _nc_entry_match(char *, char *); -extern int _nc_resolve_uses(bool); -extern void _nc_free_entries(ENTRY *); -extern void (*_nc_check_termtype)(TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_read_entry_source (FILE*, char*, int, bool, bool (*)(ENTRY*)); +extern NCURSES_EXPORT(bool) _nc_entry_match (char *, char *); +extern NCURSES_EXPORT(int) _nc_resolve_uses (bool); +extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *); +extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)(TERMTYPE *); /* trace_xnames.c */ -extern void _nc_trace_xnames(TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *); #ifdef __cplusplus } #endif -#endif /* _TERM_ENTRY_H */ +#endif /* NCURSES_TERM_ENTRY_H_incl */ diff --git a/contrib/ncurses/include/termcap.h.in b/contrib/ncurses/include/termcap.h.in index 21c62398e0bd..6adc31222064 100644 --- a/contrib/ncurses/include/termcap.h.in +++ b/contrib/ncurses/include/termcap.h.in @@ -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,14 +31,16 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ -/* $Id: termcap.h.in,v 1.12 2000/10/08 01:06:37 tom Exp $ */ +/* $Id: termcap.h.in,v 1.16 2001/03/24 21:53:27 tom Exp $ */ -#ifndef _NCU_TERMCAP_H -#define _NCU_TERMCAP_H 1 +#ifndef NCURSES_TERMCAP_H_incl +#define NCURSES_TERMCAP_H_incl 1 #undef NCURSES_VERSION #define NCURSES_VERSION "@NCURSES_MAJOR@.@NCURSES_MINOR@" +#include <ncurses_dll.h> + #ifdef __cplusplus extern "C" { @@ -49,22 +51,25 @@ extern "C" #undef NCURSES_CONST #define NCURSES_CONST @NCURSES_CONST@ -extern char PC; -extern char *UP; -extern char *BC; -extern short ospeed; +#undef NCURSES_OSPEED +#define NCURSES_OSPEED @NCURSES_OSPEED@ + +extern NCURSES_EXPORT_VAR(char) PC; +extern NCURSES_EXPORT_VAR(char *) UP; +extern NCURSES_EXPORT_VAR(char *) BC; +extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; -#if !defined(_NCU_TERM_H) -extern char *tgetstr(NCURSES_CONST char *, char **); -extern char *tgoto(const char *, int, int); -extern int tgetent(char *, const char *); -extern int tgetflag(NCURSES_CONST char *); -extern int tgetnum(NCURSES_CONST char *); -extern int tputs(const char *, int, int (*)(int)); +#if !defined(NCURSES_TERM_H_incl) +extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); #endif #ifdef __cplusplus } #endif -#endif /* _NCU_TERMCAP_H */ +#endif /* NCURSES_TERMCAP_H_incl */ diff --git a/contrib/ncurses/include/tic.h b/contrib/ncurses/include/tic.h index bba0c0ffbff4..ff35c0426197 100644 --- a/contrib/ncurses/include/tic.h +++ b/contrib/ncurses/include/tic.h @@ -32,7 +32,7 @@ ****************************************************************************/ /* - * $Id: tic.h,v 1.35 2000/09/09 19:47:16 tom Exp $ + * $Id: tic.h,v 1.38 2001/03/11 15:12:08 tom Exp $ * tic.h - Global variables and structures for the terminfo * compiler. */ @@ -116,9 +116,9 @@ extern "C" { #define DEBUG(n, a) /*nothing*/ #endif -extern unsigned _nc_tracing; -extern void _nc_tracef(char *, ...) GCC_PRINTFLIKE(1,2); -extern const char *_nc_visbuf(const char *); +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; +extern NCURSES_EXPORT(void) _nc_tracef (char *, ...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); /* * These are the types of tokens returned by the scanner. The first @@ -149,7 +149,7 @@ struct token char *tk_valstring; /* value of capability (if a string) */ }; -extern struct token _nc_curr_token; +extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token; /* * List of keynames with their corresponding code. @@ -159,7 +159,7 @@ struct kn { int code; }; -extern const struct kn _nc_key_names[]; +extern NCURSES_EXPORT_VAR(const struct kn) _nc_key_names[]; /* * Offsets to string capabilities, with the corresponding functionkey @@ -173,11 +173,11 @@ struct tinfo_fkeys { #if BROKEN_LINKER #define _nc_tinfo_fkeys _nc_tinfo_fkeysf() -extern struct tinfo_fkeys *_nc_tinfo_fkeysf(void); +extern NCURSES_EXPORT(struct tinfo_fkeys *) _nc_tinfo_fkeysf (void); #else -extern struct tinfo_fkeys _nc_tinfo_fkeys[]; +extern NCURSES_EXPORT_VAR(struct tinfo_fkeys) _nc_tinfo_fkeys[]; #endif @@ -202,14 +202,16 @@ struct alias const char *source; }; -extern const struct name_table_entry * const _nc_info_hash_table[]; -extern const struct name_table_entry * const _nc_cap_hash_table[]; +extern NCURSES_EXPORT_VAR(int) _nc_tparm_err; -extern const struct alias _nc_capalias_table[]; -extern const struct alias _nc_infoalias_table[]; +extern NCURSES_EXPORT_VAR(const struct name_table_entry * const) _nc_info_hash_table[]; +extern NCURSES_EXPORT_VAR(const struct name_table_entry * const) _nc_cap_hash_table[]; -extern const struct name_table_entry *_nc_get_table(bool); -extern const struct name_table_entry * const *_nc_get_hash_table(bool); +extern NCURSES_EXPORT_VAR(const struct alias) _nc_capalias_table[]; +extern NCURSES_EXPORT_VAR(const struct alias) _nc_infoalias_table[]; + +extern NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool); +extern NCURSES_EXPORT(const struct name_table_entry * const *) _nc_get_hash_table (bool); #define NOTFOUND ((struct name_table_entry *) 0) @@ -238,59 +240,59 @@ extern const struct name_table_entry * const *_nc_get_hash_table(bool); #endif /* access.c */ -extern char *_nc_basename(char *); +extern NCURSES_EXPORT(char *) _nc_basename (char *); /* comp_hash.c: name lookup */ -struct name_table_entry const *_nc_find_entry(const char *, - const struct name_table_entry *const *); -struct name_table_entry const *_nc_find_type_entry(const char *, - int, - const struct name_table_entry *); +extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_entry + (const char *, const struct name_table_entry *const *); +extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_type_entry + (const char *, int, const struct name_table_entry *); /* comp_scan.c: lexical analysis */ -extern int _nc_get_token(void); -extern void _nc_push_token(int); -extern void _nc_reset_input(FILE *, char *); -extern void _nc_panic_mode(char); -extern int _nc_curr_line; -extern int _nc_curr_col; -extern long _nc_curr_file_pos; -extern long _nc_comment_start, _nc_comment_end; -extern int _nc_syntax; -extern long _nc_start_line; +extern NCURSES_EXPORT(int) _nc_get_token (bool); +extern NCURSES_EXPORT(void) _nc_panic_mode (char); +extern NCURSES_EXPORT(void) _nc_push_token (int); +extern NCURSES_EXPORT(void) _nc_reset_input (FILE *, char *); +extern NCURSES_EXPORT_VAR(int) _nc_curr_col; +extern NCURSES_EXPORT_VAR(int) _nc_curr_line; +extern NCURSES_EXPORT_VAR(int) _nc_syntax; +extern NCURSES_EXPORT_VAR(long) _nc_comment_end; +extern NCURSES_EXPORT_VAR(long) _nc_comment_start; +extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos; +extern NCURSES_EXPORT_VAR(long) _nc_start_line; #define SYN_TERMINFO 0 #define SYN_TERMCAP 1 /* comp_error.c: warning & abort messages */ -extern void _nc_set_source(const char *const name); -extern void _nc_get_type(char *name); -extern void _nc_set_type(const char *const name); -extern void _nc_syserr_abort(const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; -extern void _nc_err_abort(const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; -extern void _nc_warning(const char *const,...) GCC_PRINTFLIKE(1,2); -extern bool _nc_suppress_warnings; +extern NCURSES_EXPORT(void) _nc_set_source (const char *const name); +extern NCURSES_EXPORT(void) _nc_get_type (char *name); +extern NCURSES_EXPORT(void) _nc_set_type (const char *const name); +extern NCURSES_EXPORT(void) _nc_syserr_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_warning (const char *const,...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings; /* comp_expand.c: expand string into readable form */ -extern char *_nc_tic_expand(const char *, bool, int); +extern NCURSES_EXPORT(char *) _nc_tic_expand (const char *, bool, int); /* comp_scan.c: decode string from readable form */ -extern char _nc_trans_string(char *, char *); +extern NCURSES_EXPORT(char) _nc_trans_string (char *, char *); /* captoinfo.c: capability conversion */ -extern char *_nc_captoinfo(const char *, const char *, int const); -extern char *_nc_infotocap(const char *, const char *, int const); +extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const); +extern NCURSES_EXPORT(char *) _nc_infotocap (const char *, const char *, int const); /* lib_tputs.c */ -extern int _nc_nulls_sent; /* Add one for every null sent */ +extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */ /* comp_main.c: compiler main */ -extern const char *_nc_progname; +extern const char * _nc_progname; /* read_entry.c */ -extern const char *_nc_tic_dir(const char *); +extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *); /* write_entry.c */ -extern int _nc_tic_written(void); +extern NCURSES_EXPORT(int) _nc_tic_written (void); #ifdef __cplusplus } diff --git a/contrib/ncurses/include/unctrl.h.in b/contrib/ncurses/include/unctrl.h.in index cc10079f11c7..70d74b7714b1 100644 --- a/contrib/ncurses/include/unctrl.h.in +++ b/contrib/ncurses/include/unctrl.h.in @@ -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,10 +39,10 @@ * as ^?. Printable characters are displayed as is. */ -/* $Id: unctrl.h.in,v 1.8 1998/02/11 12:13:45 tom Exp $ */ +/* $Id: unctrl.h.in,v 1.10 2001/03/24 21:53:25 tom Exp $ */ -#ifndef _UNCTRL_H -#define _UNCTRL_H 1 +#ifndef NCURSES_UNCTRL_H_incl +#define NCURSES_UNCTRL_H_incl 1 #undef NCURSES_VERSION #define NCURSES_VERSION "@NCURSES_MAJOR@.@NCURSES_MINOR@" @@ -54,10 +54,10 @@ extern "C" { #include <curses.h> #undef unctrl -extern NCURSES_CONST char *unctrl(chtype); +NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype); #ifdef __cplusplus } #endif -#endif /* _UNCTRL_H */ +#endif /* NCURSES_UNCTRL_H_incl */ diff --git a/contrib/ncurses/man/curs_deleteln.3x b/contrib/ncurses/man/curs_deleteln.3x index 8e48384af2eb..8b39402d1968 100644 --- a/contrib/ncurses/man/curs_deleteln.3x +++ b/contrib/ncurses/man/curs_deleteln.3x @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_deleteln.3x,v 1.6 2000/07/01 19:56:12 tom Exp $ +.\" $Id: curs_deleteln.3x,v 1.7 2000/11/11 20:43:20 Bernhard.Rosenkraenzer Exp $ .TH curs_deleteln 3X "" .SH NAME \fBdeleteln\fR, @@ -61,7 +61,7 @@ bottom lines are lost. For negative \fIn\fR, delete \fIn\fR lines (starting with the one under the cursor), and move the remaining lines up. The bottom \fIn\fR lines are cleared. The current cursor position remains the same. -The \fBinsertln\fR and \fBinsertln\fR routines, insert a blank line above the +The \fBinsertln\fR and \fBwinsertln\fR routines, insert a blank line above the current line and the bottom line is lost. .SH RETURN VALUE All routines return the integer \fBERR\fR upon failure and an \fBOK\fR (SVr4 diff --git a/contrib/ncurses/man/curs_getch.3x b/contrib/ncurses/man/curs_getch.3x index b2b20ef4da15..56028f8f1352 100644 --- a/contrib/ncurses/man/curs_getch.3x +++ b/contrib/ncurses/man/curs_getch.3x @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_getch.3x,v 1.17 2000/07/01 16:45:36 tom Exp $ +.\" $Id: curs_getch.3x,v 1.18 2001/02/25 00:20:30 tom Exp $ .TH curs_getch 3X "" .SH NAME \fBgetch\fR, @@ -223,6 +223,15 @@ Use of the escape key by a programmer for a single character function is discouraged, as it will cause a delay of up to one second while the keypad code looks for a following function-key sequence. +Note that some keys may be the same as commonly used control +keys, e.g., KEY_ENTER versus control/M, KEY_BACKSPACE versus control/H. +Some curses implementations may differ according to whether they +treat these control keys specially (and ignore the terminfo), or +use the terminfo definitions. +\fBNcurses\fR uses the terminfo definition. +If it says that KEY_ENTER is control/M, \fBgetch\fR, will return KEY_ENTER +when you press control/M. + When using \fBgetch\fR, \fBwgetch\fR, \fBmvgetch\fR, or \fBmvwgetch\fR, nocbreak mode (\fBnocbreak\fR) and echo mode (\fBecho\fR) should not be used at the same time. Depending on the diff --git a/contrib/ncurses/man/curs_outopts.3x b/contrib/ncurses/man/curs_outopts.3x index 4c5bf1f456a8..3ba7cf531cd4 100644 --- a/contrib/ncurses/man/curs_outopts.3x +++ b/contrib/ncurses/man/curs_outopts.3x @@ -26,10 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_outopts.3x,v 1.14 2000/02/27 01:41:58 tom Exp $ +.\" $Id: curs_outopts.3x,v 1.16 2001/03/31 23:47:31 tom Exp $ .TH curs_outopts 3X "" .SH NAME -\fBclearok\fR, \fBidlok\fR, \fBidcok immedok\fR, +\fBclearok\fR, \fBidlok\fR, \fBidcok\fR, \fBimmedok\fR, \fBleaveok\fR, \fBsetscrreg\fR, \fBwsetscrreg\fR, \fBscrollok\fR, \fBnl\fR, \fBnonl\fR - \fBcurses\fR output options .SH SYNOPSIS @@ -92,8 +92,7 @@ It is disabled by default. Normally, the hardware cursor is left at the location of the window cursor being refreshed. The \fBleaveok\fR option allows the cursor to be left wherever the update happens to leave it. It is useful for applications where -the cursor is not used, since it reduces the need for cursor motions. If -possible, the cursor is made invisible when this option is enabled. +the cursor is not used, since it reduces the need for cursor motions. The \fBsetscrreg\fR and \fBwsetscrreg\fR routines allow the application programmer to set a software scrolling region in a window. \fItop\fR and diff --git a/contrib/ncurses/man/curs_slk.3x b/contrib/ncurses/man/curs_slk.3x index c52a70556f01..8f1ae8a0d9bf 100644 --- a/contrib/ncurses/man/curs_slk.3x +++ b/contrib/ncurses/man/curs_slk.3x @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_slk.3x,v 1.10 2000/07/01 17:52:44 tom Exp $ +.\" $Id: curs_slk.3x,v 1.11 2001/03/03 21:05:41 Todd.C.Miller Exp $ .TH curs_slk 3X "" .SH NAME \fBslk_init\fR, \fBslk_set\fR, \fBslk_refresh\fR, @@ -34,7 +34,7 @@ \fBslk_clear\fR, \fBslk_restore\fR, \fBslk_touch\fR, \fBslk_attron\fR, \fBslk_attrset\fR, \fBslk_attroff\fR, \fBslk_attr_on\fR, \fBslk_attr_set\fR, \fBslk_attr_off\fR, -\fBslk_attr\fR \fBslk_color\fR - \fBcurses\fR soft label routines +\fBslk_attr\fR, \fBslk_color\fR - \fBcurses\fR soft label routines .SH SYNOPSIS \fB#include <curses.h>\fR diff --git a/contrib/ncurses/man/curs_termcap.3x b/contrib/ncurses/man/curs_termcap.3x index 01395bfe1d3d..c7bd81ac3ac7 100644 --- a/contrib/ncurses/man/curs_termcap.3x +++ b/contrib/ncurses/man/curs_termcap.3x @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_termcap.3x,v 1.13 2000/07/01 20:10:57 tom Exp $ +.\" $Id: curs_termcap.3x,v 1.14 2000/12/02 22:47:14 tom Exp $ .TH curs_termcap 3X "" .ds n 5 .SH NAME @@ -41,13 +41,13 @@ .br \fB#include <term.h>\fR .br -\fBint tgetent(const char *bp, char *name);\fR +\fBint tgetent(char *bp, const char *name);\fR .br -\fBint tgetflag(const char *id);\fR +\fBint tgetflag(char *id);\fR .br -\fBint tgetnum(const char *id);\fR +\fBint tgetnum(char *id);\fR .br -\fBchar *tgetstr(const char *id, char **area);\fR +\fBchar *tgetstr(char *id, char **area);\fR .br \fBchar *tgoto(const char *cap, int col, int row);\fR .br @@ -78,6 +78,11 @@ The return value will also be copied to the buffer pointed to by \fIarea\fR, and the \fIarea\fR value will be updated to point past the null ending this value. +Only the first two characters of the \fBid\fR parameter of +\fBtgetflag\fR, +\fBtgetnum\fR and +\fBtgetstr\fR are compared in lookups. + The \fBtgoto\fR routine instantiates the parameters into the given capability. The output from this routine is to be passed to \fBtputs\fR. @@ -96,7 +101,11 @@ If you call \fBtgetstr\fR to fetch \fBca\fR or any other parameterized string, be aware that it will be returned in terminfo notation, not the older and not-quite-compatible termcap notation. This won't cause problems if all you do with it is call \fBtgoto\fR or \fBtparm\fR, which both expand -terminfo-style. +terminfo-style strings as terminfo. +(The \fBtgoto\fR function, if configured to support termcap, will check +if the string is indeed terminfo-style by looking for "%p" parameters or +"$<..>" delays, and invoke a termcap-style parser if the string does not +appear to be terminfo). Because terminfo conventions for representing padding in string capabilities differ from termcap's, \fBtputs("50");\fR will put out a literal "50" rather diff --git a/contrib/ncurses/man/curs_terminfo.3x b/contrib/ncurses/man/curs_terminfo.3x index bb5c8ca6cfa3..d55fa24ce10a 100644 --- a/contrib/ncurses/man/curs_terminfo.3x +++ b/contrib/ncurses/man/curs_terminfo.3x @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_terminfo.3x,v 1.13 2000/07/01 20:07:34 tom Exp $ +.\" $Id: curs_terminfo.3x,v 1.14 2000/12/03 00:07:23 tom Exp $ .TH curs_terminfo 3X "" .ds n 5 .SH NAME @@ -253,6 +253,10 @@ In System V Release 4, the third argument of \fBtputs\fR has the type The XSI Curses standard prototypes \fBtparm\fR with a fixed number of parameters, rather than a variable argument list. +That prototype assumes that none of the parameters are strings +(or if so, that a long is big enough to hold a pointer). +The variable argument list implemented in ncurses does not rely on +that assumption. XSI notes that after calling \fBmvcur\fR, the curses state may not match the actual terminal state, and that an application should touch and refresh diff --git a/contrib/ncurses/man/ncurses.3x b/contrib/ncurses/man/ncurses.3x index 3b36fa9a6df1..6ce50d87ac4f 100644 --- a/contrib/ncurses/man/ncurses.3x +++ b/contrib/ncurses/man/ncurses.3x @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: ncurses.3x,v 1.44 2000/10/08 01:39:26 tom Exp $ +.\" $Id: ncurses.3x,v 1.46 2000/11/25 21:58:45 tom Exp $ .hy 0 .TH ncurses 3X "" .ds n 5 @@ -699,14 +699,14 @@ ncurses library, e.g., .TP 5 TERMINFO_DIRS Specifies a list of directories to search for terminal descriptions. -The list is separated by colons (i.e., ":"). +The list is separated by colons (i.e., ":") on Unix, semicolons on OS/2 EMX. All of the terminal descriptions are in terminfo form, which makes a subdirectory named for the first letter of the terminal names therein. .TP 5 TERMPATH If TERMCAP does not hold a file name then \fBncurses\fR checks the TERMPATH symbol. -This is a list of filenames separated by colons (i.e., ":"). +This is a list of filenames separated by spaces or colons (i.e., ":") on Unix, semicolons on OS/2 EMX. If the TERMPATH symbol is not set, \fBncurses\fR looks in the files /etc/termcap, /usr/share/misc/termcap and $HOME/.termcap, in that order. .PP diff --git a/contrib/ncurses/man/terminfo.tail b/contrib/ncurses/man/terminfo.tail index 65a83c990cf2..e39230f83863 100644 --- a/contrib/ncurses/man/terminfo.tail +++ b/contrib/ncurses/man/terminfo.tail @@ -1,4 +1,4 @@ -.\" $Id: terminfo.tail,v 1.32 2000/04/15 20:04:58 tom Exp $ +.\" $Id: terminfo.tail,v 1.33 2000/10/14 14:06:50 tom Exp $ .\" Beginning of terminfo.tail file .ps +1 .PP @@ -912,7 +912,8 @@ output .BR is2 ; set the margins using .BR mgc , -.BR smgl and +.BR smgl +and .BR smgr ; set tabs using .B tbc diff --git a/contrib/ncurses/menu/Makefile.in b/contrib/ncurses/menu/Makefile.in index 322e94e6f670..b27651c20039 100644 --- a/contrib/ncurses/menu/Makefile.in +++ b/contrib/ncurses/menu/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.30 2000/08/26 21:51:35 tom Exp $ +# $Id: Makefile.in,v 1.32 2001/03/24 19:53:31 tom Exp $ ############################################################################## -# Copyright (c) 1998-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"), # @@ -53,6 +53,8 @@ exec_prefix = @exec_prefix@ libdir = @libdir@ includedir = @includedir@ +LIBTOOL = @LIBTOOL@ + INSTALL = @INSTALL@ INSTALL_LIB = @INSTALL@ @INSTALL_LIB@ INSTALL_DATA = @INSTALL_DATA@ @@ -72,15 +74,15 @@ CPPFLAGS = @CPPFLAGS@ \ CCFLAGS = $(CPPFLAGS) $(CFLAGS) +CFLAGS_LIBTOOL = $(CCFLAGS) CFLAGS_NORMAL = $(CCFLAGS) CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE CFLAGS_PROFILE = $(CCFLAGS) -pg - 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) @@ -88,6 +90,8 @@ SHLIB_LIST = $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_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@ @@ -138,7 +142,7 @@ tags: @MAKE_UPPER_TAGS@ etags *.[ch] mostlyclean :: - -rm -f core tags TAGS *~ *.ln *.atac trace + -rm -f core tags TAGS *~ *.i *.ln *.atac trace clean :: mostlyclean -rm -f $(AUTO_SRC) diff --git a/contrib/ncurses/menu/eti.h b/contrib/ncurses/menu/eti.h index cc1c8308a948..4561fa441df3 100644 --- a/contrib/ncurses/menu/eti.h +++ b/contrib/ncurses/menu/eti.h @@ -30,8 +30,8 @@ * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * ****************************************************************************/ -#ifndef _ETI_ERRNO_H_ -#define _ETI_ERRNO_H_ +#ifndef NCURSES_ETI_H_incl +#define NCURSES_ETI_H_incl 1 #define E_OK (0) #define E_SYSTEM_ERROR (-1) diff --git a/contrib/ncurses/menu/m_attribs.c b/contrib/ncurses/menu/m_attribs.c index 3cf2a1189bf3..4c87a94ce026 100644 --- a/contrib/ncurses/menu/m_attribs.c +++ b/contrib/ncurses/menu/m_attribs.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_attribs.c,v 1.8 1999/05/16 17:24:24 juergen Exp $") +MODULE_ID("$Id: m_attribs.c,v 1.9 2000/12/10 02:16:48 tom Exp $") /* Macro to redraw menu if it is posted and changed */ #define Refresh_Menu(menu) \ @@ -49,7 +49,7 @@ MODULE_ID("$Id: m_attribs.c,v 1.8 1999/05/16 17:24:24 juergen Exp $") /* "Template" macro to generate a function to set a menus attribute */ #define GEN_MENU_ATTR_SET_FCT( name ) \ -int set_menu_ ## name (MENU * menu, chtype attr)\ +NCURSES_IMPEXP int NCURSES_API set_menu_ ## name (MENU * menu, chtype attr)\ {\ if (!(attr==A_NORMAL || (attr & A_ATTRIBUTES)==attr))\ RETURN(E_BAD_ARGUMENT);\ @@ -64,7 +64,7 @@ int set_menu_ ## name (MENU * menu, chtype attr)\ /* "Template" macro to generate a function to get a menus attribute */ #define GEN_MENU_ATTR_GET_FCT( name ) \ -chtype menu_ ## name (const MENU * menu)\ +NCURSES_IMPEXP chtype NCURSES_API menu_ ## name (const MENU * menu)\ {\ return (Normalize_Menu( menu ) -> name);\ } diff --git a/contrib/ncurses/menu/m_cursor.c b/contrib/ncurses/menu/m_cursor.c index a46308954e96..ccca36cea233 100644 --- a/contrib/ncurses/menu/m_cursor.c +++ b/contrib/ncurses/menu/m_cursor.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_cursor.c,v 1.13 1999/05/16 17:24:43 juergen Exp $") +MODULE_ID("$Id: m_cursor.c,v 1.14 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -49,9 +49,9 @@ MODULE_ID("$Id: m_cursor.c,v 1.13 1999/05/16 17:24:43 juergen Exp $") | E_BAD_ARGUMENT - invalid menu | E_NOT_POSTED - Menu is not posted +--------------------------------------------------------------------------*/ -int _nc_menu_cursor_pos(const MENU* menu, - const ITEM* item, - int* pY, int* pX) +NCURSES_EXPORT(int) +_nc_menu_cursor_pos +(const MENU* menu, const ITEM* item, int* pY, int* pX) { if (!menu || !pX || !pY) return(E_BAD_ARGUMENT); @@ -80,7 +80,8 @@ int _nc_menu_cursor_pos(const MENU* menu, | E_BAD_ARGUMENT - invalid menu | E_NOT_POSTED - Menu is not posted +--------------------------------------------------------------------------*/ -int pos_menu_cursor(const MENU * menu) +NCURSES_EXPORT(int) +pos_menu_cursor (const MENU * menu) { WINDOW *win, *sub; int x, y; diff --git a/contrib/ncurses/menu/m_driver.c b/contrib/ncurses/menu/m_driver.c index fef3e8ea7147..69115cf64811 100644 --- a/contrib/ncurses/menu/m_driver.c +++ b/contrib/ncurses/menu/m_driver.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_driver.c,v 1.17 1999/05/16 17:24:55 juergen Exp $") +MODULE_ID("$Id: m_driver.c,v 1.18 2000/12/10 02:16:48 tom Exp $") /* Macros */ @@ -111,7 +111,9 @@ static bool Is_Sub_String( | Return Values : E_OK - an item matching the pattern was found | E_NO_MATCH - nothing found +--------------------------------------------------------------------------*/ -int _nc_Match_Next_Character_In_Item_Name(MENU *menu, int ch, ITEM **item) +NCURSES_EXPORT(int) +_nc_Match_Next_Character_In_Item_Name +(MENU *menu, int ch, ITEM **item) { bool found = FALSE, passed = FALSE; int idx, last; @@ -198,7 +200,8 @@ int _nc_Match_Next_Character_In_Item_Name(MENU *menu, int ch, ITEM **item) | E_BAD_STATE - menu is in user hook routine | E_NOT_POSTED - menu is not posted +--------------------------------------------------------------------------*/ -int menu_driver(MENU * menu, int c) +NCURSES_EXPORT(int) +menu_driver (MENU * menu, int c) { #define NAVIGATE(dir) \ if (!item->dir)\ diff --git a/contrib/ncurses/menu/m_format.c b/contrib/ncurses/menu/m_format.c index 829fbe8caf6f..ffd8e701e3ee 100644 --- a/contrib/ncurses/menu/m_format.c +++ b/contrib/ncurses/menu/m_format.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_format.c,v 1.9 1999/05/16 17:25:04 juergen Exp $") +MODULE_ID("$Id: m_format.c,v 1.10 2000/12/10 02:16:48 tom Exp $") #define minimum(a,b) ((a)<(b) ? (a): (b)) @@ -55,7 +55,8 @@ MODULE_ID("$Id: m_format.c,v 1.9 1999/05/16 17:25:04 juergen Exp $") | E_NOT_CONNECTED - there are no items connected | E_POSTED - the menu is already posted +--------------------------------------------------------------------------*/ -int set_menu_format(MENU *menu, int rows, int cols) +NCURSES_EXPORT(int) +set_menu_format (MENU *menu, int rows, int cols) { int total_rows, total_cols; @@ -114,7 +115,8 @@ int set_menu_format(MENU *menu, int rows, int cols) | | Return Values : - +--------------------------------------------------------------------------*/ -void menu_format(const MENU *menu, int *rows, int *cols) +NCURSES_EXPORT(void) +menu_format (const MENU *menu, int *rows, int *cols) { if (rows) *rows = Normalize_Menu(menu)->frows; diff --git a/contrib/ncurses/menu/m_global.c b/contrib/ncurses/menu/m_global.c index 3633e55b9cc2..0100618e423a 100644 --- a/contrib/ncurses/menu/m_global.c +++ b/contrib/ncurses/menu/m_global.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,9 +37,9 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_global.c,v 1.11 1999/05/16 17:25:14 juergen Exp $") +MODULE_ID("$Id: m_global.c,v 1.12 2000/12/10 02:16:48 tom Exp $") -MENU _nc_Default_Menu = { +NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu = { 16, /* Nr. of chars high */ 1, /* Nr. of chars wide */ 16, /* Nr. of items high */ @@ -78,7 +78,7 @@ MENU _nc_Default_Menu = { 0 /* status */ }; -ITEM _nc_Default_Item = { +NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item = { { (char *)0, 0 }, /* name */ { (char *)0, 0 }, /* description */ (MENU *)0, /* Pointer to parent menu */ @@ -161,7 +161,8 @@ INLINE static void ResetConnectionInfo(MENU *menu, ITEM **items) | Return Values : TRUE - successfull connection | FALSE - connection failed +--------------------------------------------------------------------------*/ -bool _nc_Connect_Items(MENU *menu, ITEM **items) +NCURSES_EXPORT(bool) +_nc_Connect_Items (MENU *menu, ITEM **items) { ITEM **item; unsigned int ItemCount = 0; @@ -222,7 +223,8 @@ bool _nc_Connect_Items(MENU *menu, ITEM **items) | | Return Values : - +--------------------------------------------------------------------------*/ -void _nc_Disconnect_Items(MENU * menu) +NCURSES_EXPORT(void) +_nc_Disconnect_Items (MENU * menu) { if (menu && menu->items) ResetConnectionInfo( menu, menu->items ); @@ -237,7 +239,8 @@ void _nc_Disconnect_Items(MENU * menu) | | Return Values : - +--------------------------------------------------------------------------*/ -void _nc_Calculate_Item_Length_and_Width(MENU * menu) +NCURSES_EXPORT(void) +_nc_Calculate_Item_Length_and_Width (MENU * menu) { int l; @@ -265,7 +268,8 @@ void _nc_Calculate_Item_Length_and_Width(MENU * menu) | | Return Values : - +--------------------------------------------------------------------------*/ -void _nc_Link_Items(MENU * menu) +NCURSES_EXPORT(void) +_nc_Link_Items (MENU * menu) { if (menu && menu->items && *(menu->items)) { @@ -391,7 +395,8 @@ void _nc_Link_Items(MENU * menu) | | Return Values : - +--------------------------------------------------------------------------*/ -void _nc_Show_Menu(const MENU *menu) +NCURSES_EXPORT(void) +_nc_Show_Menu (const MENU *menu) { WINDOW *win; int maxy, maxx; @@ -430,8 +435,9 @@ void _nc_Show_Menu(const MENU *menu) | | Return Values : - +--------------------------------------------------------------------------*/ -void _nc_New_TopRow_and_CurrentItem(MENU *menu, int new_toprow, - ITEM *new_current_item) +NCURSES_EXPORT(void) +_nc_New_TopRow_and_CurrentItem +(MENU *menu, int new_toprow, ITEM *new_current_item) { ITEM *cur_item; bool mterm_called = FALSE; diff --git a/contrib/ncurses/menu/m_hook.c b/contrib/ncurses/menu/m_hook.c index e031d37e4fc3..783ec007ba7b 100644 --- a/contrib/ncurses/menu/m_hook.c +++ b/contrib/ncurses/menu/m_hook.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,11 +37,11 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_hook.c,v 1.8 1999/05/16 17:25:24 juergen Exp $") +MODULE_ID("$Id: m_hook.c,v 1.9 2000/12/10 02:16:48 tom Exp $") /* "Template" macro to generate function to set application specific hook */ #define GEN_HOOK_SET_FUNCTION( typ, name ) \ -int set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\ +NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\ {\ (Normalize_Menu(menu) -> typ ## name = func );\ RETURN(E_OK);\ @@ -49,7 +49,7 @@ int set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\ /* "Template" macro to generate function to get application specific hook */ #define GEN_HOOK_GET_FUNCTION( typ, name ) \ -Menu_Hook typ ## _ ## name ( const MENU *menu )\ +NCURSES_IMPEXP Menu_Hook NCURSES_API typ ## _ ## name ( const MENU *menu )\ {\ return (Normalize_Menu(menu) -> typ ## name);\ } diff --git a/contrib/ncurses/menu/m_item_cur.c b/contrib/ncurses/menu/m_item_cur.c index 7ac9f33daf10..a2b82ddb468a 100644 --- a/contrib/ncurses/menu/m_item_cur.c +++ b/contrib/ncurses/menu/m_item_cur.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_cur.c,v 1.11 1999/05/16 17:25:34 juergen Exp $") +MODULE_ID("$Id: m_item_cur.c,v 1.12 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -47,7 +47,8 @@ MODULE_ID("$Id: m_item_cur.c,v 1.11 1999/05/16 17:25:34 juergen Exp $") | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -int set_current_item(MENU * menu, ITEM * item) +NCURSES_EXPORT(int) +set_current_item (MENU * menu, ITEM * item) { if (menu && item && (item->imenu==menu)) { @@ -85,7 +86,8 @@ int set_current_item(MENU * menu, ITEM * item) | | Return Values : Item pointer or NULL if failure +--------------------------------------------------------------------------*/ -ITEM *current_item(const MENU * menu) +NCURSES_EXPORT(ITEM *) +current_item (const MENU * menu) { return (menu && menu->items) ? menu->curitem : (ITEM *)0; } @@ -98,7 +100,8 @@ ITEM *current_item(const MENU * menu) | | Return Values : The index or ERR if this is an invalid item pointer +--------------------------------------------------------------------------*/ -int item_index(const ITEM *item) +NCURSES_EXPORT(int) +item_index (const ITEM *item) { return (item && item->imenu) ? item->index : ERR; } diff --git a/contrib/ncurses/menu/m_item_nam.c b/contrib/ncurses/menu/m_item_nam.c index 1be8a6da86fb..0fa8e59d6876 100644 --- a/contrib/ncurses/menu/m_item_nam.c +++ b/contrib/ncurses/menu/m_item_nam.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_nam.c,v 1.9 1999/05/16 17:25:43 juergen Exp $") +MODULE_ID("$Id: m_item_nam.c,v 1.10 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -47,7 +47,8 @@ MODULE_ID("$Id: m_item_nam.c,v 1.9 1999/05/16 17:25:43 juergen Exp $") | | Return Values : See above; returns NULL if item is invalid +--------------------------------------------------------------------------*/ -const char *item_name(const ITEM * item) +NCURSES_EXPORT(const char *) +item_name (const ITEM * item) { return ((item) ? item->name.str : (char *)0); } @@ -60,7 +61,8 @@ const char *item_name(const ITEM * item) | | Return Values : See above; Returns NULL if item is invalid +--------------------------------------------------------------------------*/ -const char *item_description(const ITEM * item) +NCURSES_EXPORT(const char *) +item_description (const ITEM * item) { return ((item) ? item->description.str : (char *)0); } diff --git a/contrib/ncurses/menu/m_item_new.c b/contrib/ncurses/menu/m_item_new.c index a7b50adaebb0..89e4469b8aa3 100644 --- a/contrib/ncurses/menu/m_item_new.c +++ b/contrib/ncurses/menu/m_item_new.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,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_new.c,v 1.11 1999/05/16 17:28:49 juergen Exp $") +MODULE_ID("$Id: m_item_new.c,v 1.12 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -72,7 +72,8 @@ static bool Is_Printable_String(const char *s) | | Return Values : The item pointer or NULL if creation failed. +--------------------------------------------------------------------------*/ -ITEM *new_item(const char *name, const char *description) +NCURSES_EXPORT(ITEM *) +new_item (const char *name, const char *description) { ITEM *item; @@ -120,7 +121,8 @@ ITEM *new_item(const char *name, const char *description) | E_BAD_ARGUMENT - invalid value has been passed | E_CONNECTED - item is still connected to a menu +--------------------------------------------------------------------------*/ -int free_item(ITEM * item) +NCURSES_EXPORT(int) +free_item (ITEM * item) { if (!item) RETURN( E_BAD_ARGUMENT ); @@ -150,7 +152,8 @@ int free_item(ITEM * item) | E_BAD_ARGUMENT - an invalid value has been passed | E_SYSTEM_ERROR - no memory to store mark +--------------------------------------------------------------------------*/ -int set_menu_mark(MENU * menu, const char * mark) +NCURSES_EXPORT(int) +set_menu_mark (MENU * menu, const char * mark) { int l; @@ -219,7 +222,8 @@ int set_menu_mark(MENU * menu, const char * mark) | | Return Values : The marker string pointer or NULL if no marker defined +--------------------------------------------------------------------------*/ -const char *menu_mark(const MENU * menu) +NCURSES_EXPORT(const char *) +menu_mark (const MENU * menu) { return Normalize_Menu( menu )->mark; } diff --git a/contrib/ncurses/menu/m_item_opt.c b/contrib/ncurses/menu/m_item_opt.c index a37fadcbf901..c31ee49172d0 100644 --- a/contrib/ncurses/menu/m_item_opt.c +++ b/contrib/ncurses/menu/m_item_opt.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_opt.c,v 1.10 1999/05/16 17:25:52 juergen Exp $") +MODULE_ID("$Id: m_item_opt.c,v 1.11 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -50,7 +50,8 @@ MODULE_ID("$Id: m_item_opt.c,v 1.10 1999/05/16 17:25:52 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid item options +--------------------------------------------------------------------------*/ -int set_item_opts(ITEM *item, Item_Options opts) +NCURSES_EXPORT(int) +set_item_opts (ITEM *item, Item_Options opts) { opts &= ALL_ITEM_OPTS; @@ -90,7 +91,8 @@ int set_item_opts(ITEM *item, Item_Options opts) | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ -int item_opts_off(ITEM *item, Item_Options opts) +NCURSES_EXPORT(int) +item_opts_off (ITEM *item, Item_Options opts) { ITEM *citem = item; /* use a copy because set_item_opts must detect NULL item itself to adjust its behaviour */ @@ -114,7 +116,8 @@ int item_opts_off(ITEM *item, Item_Options opts) | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ -int item_opts_on(ITEM *item, Item_Options opts) +NCURSES_EXPORT(int) +item_opts_on (ITEM *item, Item_Options opts) { ITEM *citem = item; /* use a copy because set_item_opts must detect NULL item itself to adjust its behaviour */ @@ -138,7 +141,8 @@ int item_opts_on(ITEM *item, Item_Options opts) | | Return Values : Items options +--------------------------------------------------------------------------*/ -Item_Options item_opts(const ITEM * item) +NCURSES_EXPORT(Item_Options) +item_opts (const ITEM * item) { return (ALL_ITEM_OPTS & Normalize_Item(item)->opt); } diff --git a/contrib/ncurses/menu/m_item_top.c b/contrib/ncurses/menu/m_item_top.c index cbe092afbbc1..1d751d94d8cb 100644 --- a/contrib/ncurses/menu/m_item_top.c +++ b/contrib/ncurses/menu/m_item_top.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_top.c,v 1.4 1999/05/16 17:26:01 juergen Exp $") +MODULE_ID("$Id: m_item_top.c,v 1.5 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -49,7 +49,8 @@ MODULE_ID("$Id: m_item_top.c,v 1.4 1999/05/16 17:26:01 juergen Exp $") | E_BAD_ARGUMENT - not a menu pointer or invalid row | E_NOT_CONNECTED - there are no items for the menu +--------------------------------------------------------------------------*/ -int set_top_row(MENU * menu, int row) +NCURSES_EXPORT(int) +set_top_row (MENU * menu, int row) { ITEM *item; @@ -88,7 +89,8 @@ int set_top_row(MENU * menu, int row) | | Return Values : The row number or ERR if there is no row +--------------------------------------------------------------------------*/ -int top_row(const MENU * menu) +NCURSES_EXPORT(int) +top_row (const MENU * menu) { if (menu && menu->items && *(menu->items)) { diff --git a/contrib/ncurses/menu/m_item_use.c b/contrib/ncurses/menu/m_item_use.c index 2659f4b3f386..1217735e4703 100644 --- a/contrib/ncurses/menu/m_item_use.c +++ b/contrib/ncurses/menu/m_item_use.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_use.c,v 1.10 1999/05/16 17:26:11 juergen Exp $") +MODULE_ID("$Id: m_item_use.c,v 1.11 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -48,7 +48,8 @@ MODULE_ID("$Id: m_item_use.c,v 1.10 1999/05/16 17:26:11 juergen Exp $") | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -int set_item_userptr(ITEM * item, void * userptr) +NCURSES_EXPORT(int) +set_item_userptr (ITEM * item, void * userptr) { Normalize_Item(item)->userptr = userptr; RETURN( E_OK ); @@ -64,7 +65,8 @@ int set_item_userptr(ITEM * item, void * userptr) | Return Values : Value of the pointer. If no such pointer has been set, | NULL is returned. +--------------------------------------------------------------------------*/ -void *item_userptr(const ITEM * item) +NCURSES_EXPORT(void *) +item_userptr (const ITEM * item) { return Normalize_Item(item)->userptr; } diff --git a/contrib/ncurses/menu/m_item_val.c b/contrib/ncurses/menu/m_item_val.c index cf52d1dd668a..48bde3ae4eba 100644 --- a/contrib/ncurses/menu/m_item_val.c +++ b/contrib/ncurses/menu/m_item_val.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_val.c,v 1.8 1999/05/16 17:26:20 juergen Exp $") +MODULE_ID("$Id: m_item_val.c,v 1.9 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -52,7 +52,8 @@ MODULE_ID("$Id: m_item_val.c,v 1.8 1999/05/16 17:26:20 juergen Exp $") | Return Values : E_OK - success | E_REQUEST_DENIED - not selectable or single valued menu +--------------------------------------------------------------------------*/ -int set_item_value(ITEM *item, bool value) +NCURSES_EXPORT(int) +set_item_value (ITEM *item, bool value) { MENU *menu; @@ -92,7 +93,8 @@ int set_item_value(ITEM *item, bool value) | Return Values : TRUE - if item is selected | FALSE - if item is not selected +--------------------------------------------------------------------------*/ -bool item_value(const ITEM *item) +NCURSES_EXPORT(bool) +item_value (const ITEM *item) { return ((Normalize_Item(item)->value) ? TRUE : FALSE); } diff --git a/contrib/ncurses/menu/m_item_vis.c b/contrib/ncurses/menu/m_item_vis.c index dab5ecb38e38..9a2255e24331 100644 --- a/contrib/ncurses/menu/m_item_vis.c +++ b/contrib/ncurses/menu/m_item_vis.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_vis.c,v 1.10 1999/05/16 17:26:34 juergen Exp $") +MODULE_ID("$Id: m_item_vis.c,v 1.11 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -49,7 +49,8 @@ MODULE_ID("$Id: m_item_vis.c,v 1.10 1999/05/16 17:26:34 juergen Exp $") | Return Values : TRUE if visible | FALSE if invisible +--------------------------------------------------------------------------*/ -bool item_visible(const ITEM * item) +NCURSES_EXPORT(bool) +item_visible (const ITEM * item) { MENU *menu; diff --git a/contrib/ncurses/menu/m_items.c b/contrib/ncurses/menu/m_items.c index 1bda088a2f9e..3e21d2d15ef5 100644 --- a/contrib/ncurses/menu/m_items.c +++ b/contrib/ncurses/menu/m_items.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_items.c,v 1.8 1999/05/16 17:26:50 juergen Exp $") +MODULE_ID("$Id: m_items.c,v 1.9 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -52,7 +52,8 @@ MODULE_ID("$Id: m_items.c,v 1.8 1999/05/16 17:26:50 juergen Exp $") | E_BAD_ARGUMENT - An incorrect menu or item array was | passed to the function +--------------------------------------------------------------------------*/ -int set_menu_items(MENU * menu, ITEM ** items) +NCURSES_EXPORT(int) +set_menu_items (MENU * menu, ITEM ** items) { if (!menu || (items && !(*items))) RETURN(E_BAD_ARGUMENT); @@ -81,7 +82,8 @@ int set_menu_items(MENU * menu, ITEM ** items) | | Return Values : NULL on error +--------------------------------------------------------------------------*/ -ITEM **menu_items(const MENU *menu) +NCURSES_EXPORT(ITEM **) +menu_items (const MENU *menu) { return(menu ? menu->items : (ITEM **)0); } @@ -95,7 +97,8 @@ ITEM **menu_items(const MENU *menu) | | Return Values : Number of items or -1 to indicate error. +--------------------------------------------------------------------------*/ -int item_count(const MENU *menu) +NCURSES_EXPORT(int) +item_count (const MENU *menu) { return(menu ? menu->nitems : -1); } diff --git a/contrib/ncurses/menu/m_new.c b/contrib/ncurses/menu/m_new.c index ba2b90cffe19..fc2642a7ce74 100644 --- a/contrib/ncurses/menu/m_new.c +++ b/contrib/ncurses/menu/m_new.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_new.c,v 1.10 1999/05/16 17:26:59 juergen Exp $") +MODULE_ID("$Id: m_new.c,v 1.11 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -50,7 +50,8 @@ MODULE_ID("$Id: m_new.c,v 1.10 1999/05/16 17:26:59 juergen Exp $") | | Return Values : NULL on error +--------------------------------------------------------------------------*/ -MENU *new_menu(ITEM ** items) +NCURSES_EXPORT(MENU *) +new_menu (ITEM ** items) { MENU *menu = (MENU *)calloc(1,sizeof(MENU)); @@ -87,7 +88,8 @@ MENU *new_menu(ITEM ** items) | E_BAD_ARGUMENT - Invalid menu pointer passed | E_POSTED - Menu is already posted +--------------------------------------------------------------------------*/ -int free_menu(MENU * menu) +NCURSES_EXPORT(int) +free_menu (MENU * menu) { if (!menu) RETURN(E_BAD_ARGUMENT); diff --git a/contrib/ncurses/menu/m_opts.c b/contrib/ncurses/menu/m_opts.c index 1875f418755b..96a5320f0248 100644 --- a/contrib/ncurses/menu/m_opts.c +++ b/contrib/ncurses/menu/m_opts.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_opts.c,v 1.12 1999/05/16 17:27:08 juergen Exp $") +MODULE_ID("$Id: m_opts.c,v 1.13 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -52,7 +52,8 @@ MODULE_ID("$Id: m_opts.c,v 1.12 1999/05/16 17:27:08 juergen Exp $") | E_BAD_ARGUMENT - invalid menu options | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ -int set_menu_opts(MENU * menu, Menu_Options opts) +NCURSES_EXPORT(int) +set_menu_opts (MENU * menu, Menu_Options opts) { opts &= ALL_MENU_OPTS; @@ -109,7 +110,8 @@ int set_menu_opts(MENU * menu, Menu_Options opts) | E_BAD_ARGUMENT - invalid options | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ -int menu_opts_off(MENU *menu, Menu_Options opts) +NCURSES_EXPORT(int) +menu_opts_off (MENU *menu, Menu_Options opts) { MENU *cmenu = menu; /* use a copy because set_menu_opts must detect NULL menu itself to adjust its behaviour */ @@ -138,7 +140,8 @@ int menu_opts_off(MENU *menu, Menu_Options opts) | E_BAD_ARGUMENT - invalid menu options | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ -int menu_opts_on(MENU * menu, Menu_Options opts) +NCURSES_EXPORT(int) +menu_opts_on (MENU * menu, Menu_Options opts) { MENU *cmenu = menu; /* use a copy because set_menu_opts must detect NULL menu itself to adjust its behaviour */ @@ -162,7 +165,8 @@ int menu_opts_on(MENU * menu, Menu_Options opts) | | Return Values : Menu options +--------------------------------------------------------------------------*/ -Menu_Options menu_opts(const MENU *menu) +NCURSES_EXPORT(Menu_Options) +menu_opts (const MENU *menu) { return (ALL_MENU_OPTS & Normalize_Menu( menu )->opt); } diff --git a/contrib/ncurses/menu/m_pad.c b/contrib/ncurses/menu/m_pad.c index 180228329dd2..d7161e289a1e 100644 --- a/contrib/ncurses/menu/m_pad.c +++ b/contrib/ncurses/menu/m_pad.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_pad.c,v 1.4 1999/05/16 17:27:17 juergen Exp $") +MODULE_ID("$Id: m_pad.c,v 1.5 2000/12/10 02:16:48 tom Exp $") /* Macro to redraw menu if it is posted and changed */ #define Refresh_Menu(menu) \ @@ -58,7 +58,8 @@ MODULE_ID("$Id: m_pad.c,v 1.4 1999/05/16 17:27:17 juergen Exp $") | Return Values : E_OK - success | E_BAD_ARGUMENT - an invalid value has been passed +--------------------------------------------------------------------------*/ -int set_menu_pad(MENU *menu, int pad) +NCURSES_EXPORT(int) +set_menu_pad (MENU *menu, int pad) { bool do_refresh = (menu != (MENU*)0); @@ -82,7 +83,8 @@ int set_menu_pad(MENU *menu, int pad) | | Return Values : The pad character +--------------------------------------------------------------------------*/ -int menu_pad(const MENU * menu) +NCURSES_EXPORT(int) +menu_pad (const MENU * menu) { return (Normalize_Menu( menu ) -> pad); } diff --git a/contrib/ncurses/menu/m_pattern.c b/contrib/ncurses/menu/m_pattern.c index 7187c2245880..3e0590038c8f 100644 --- a/contrib/ncurses/menu/m_pattern.c +++ b/contrib/ncurses/menu/m_pattern.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_pattern.c,v 1.4 1999/05/16 17:27:28 juergen Exp $") +MODULE_ID("$Id: m_pattern.c,v 1.6 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -50,7 +50,8 @@ MODULE_ID("$Id: m_pattern.c,v 1.4 1999/05/16 17:27:28 juergen Exp $") | pattern is stored | PatternString - as expected +--------------------------------------------------------------------------*/ -char *menu_pattern(const MENU * menu) +NCURSES_EXPORT(char *) +menu_pattern (const MENU * menu) { return (menu ? (menu->pattern ? menu->pattern : "") : (char *)0); } @@ -68,7 +69,8 @@ char *menu_pattern(const MENU * menu) | E_BAD_STATE - menu in user hook routine | E_NO_MATCH - no item matches pattern +--------------------------------------------------------------------------*/ -int set_menu_pattern(MENU *menu, const char *p) +NCURSES_EXPORT(int) +set_menu_pattern (MENU *menu, const char *p) { ITEM *matchitem; int matchpos; @@ -99,7 +101,7 @@ int set_menu_pattern(MENU *menu, const char *p) while(*p) { - if ( !isprint(*p) || + if ( !isprint((unsigned char)(*p)) || (_nc_Match_Next_Character_In_Item_Name(menu,*p,&matchitem) != E_OK) ) { Reset_Pattern(menu); diff --git a/contrib/ncurses/menu/m_post.c b/contrib/ncurses/menu/m_post.c index 8825f3e57918..0d24cc00618a 100644 --- a/contrib/ncurses/menu/m_post.c +++ b/contrib/ncurses/menu/m_post.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_post.c,v 1.16 1999/05/16 17:27:38 juergen Exp $") +MODULE_ID("$Id: m_post.c,v 1.17 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -48,7 +48,8 @@ MODULE_ID("$Id: m_post.c,v 1.16 1999/05/16 17:27:38 juergen Exp $") | | Return Values : - +--------------------------------------------------------------------------*/ -void _nc_Post_Item(const MENU * menu, const ITEM * item) +NCURSES_EXPORT(void) +_nc_Post_Item (const MENU * menu, const ITEM * item) { int i; chtype ch; @@ -189,7 +190,8 @@ void _nc_Post_Item(const MENU * menu, const ITEM * item) | | Return Values : - +--------------------------------------------------------------------------*/ -void _nc_Draw_Menu(const MENU * menu) +NCURSES_EXPORT(void) +_nc_Draw_Menu (const MENU * menu) { ITEM *item = menu->items[0]; ITEM *lasthor, *lastvert; @@ -257,7 +259,8 @@ void _nc_Draw_Menu(const MENU * menu) | E_BAD_STATE - Menu in userexit routine | E_POSTED - Menu already posted +--------------------------------------------------------------------------*/ -int post_menu(MENU * menu) +NCURSES_EXPORT(int) +post_menu (MENU * menu) { if (!menu) RETURN(E_BAD_ARGUMENT); @@ -330,7 +333,8 @@ int post_menu(MENU * menu) | E_BAD_STATE - menu in userexit routine | E_NOT_POSTED - menu is not posted +--------------------------------------------------------------------------*/ -int unpost_menu(MENU * menu) +NCURSES_EXPORT(int) +unpost_menu (MENU * menu) { WINDOW *win; diff --git a/contrib/ncurses/menu/m_req_name.c b/contrib/ncurses/menu/m_req_name.c index d90d0afc4750..130bd6f6e0a0 100644 --- a/contrib/ncurses/menu/m_req_name.c +++ b/contrib/ncurses/menu/m_req_name.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_req_name.c,v 1.12 1999/05/16 17:27:47 juergen Exp $") +MODULE_ID("$Id: m_req_name.c,v 1.13 2000/12/10 02:16:48 tom Exp $") static const char *request_names[ MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1 ] = { "LEFT_ITEM" , @@ -69,7 +69,8 @@ static const char *request_names[ MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1 ] = { | Return Values : Pointer to name - on success | NULL - on invalid request code +--------------------------------------------------------------------------*/ -const char *menu_request_name( int request ) +NCURSES_EXPORT(const char *) +menu_request_name ( int request ) { if ( (request < MIN_MENU_COMMAND) || (request > MAX_MENU_COMMAND) ) { @@ -90,7 +91,8 @@ const char *menu_request_name( int request ) | Return Values : Request Id - on success | E_NO_MATCH - request not found +--------------------------------------------------------------------------*/ -int menu_request_by_name( const char *str ) +NCURSES_EXPORT(int) +menu_request_by_name ( const char *str ) { /* because the table is so small, it doesn't really hurt to run sequentially through it. diff --git a/contrib/ncurses/menu/m_scale.c b/contrib/ncurses/menu/m_scale.c index d6f964bff662..e5c1101547b5 100644 --- a/contrib/ncurses/menu/m_scale.c +++ b/contrib/ncurses/menu/m_scale.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_scale.c,v 1.4 1999/05/16 17:28:00 juergen Exp $") +MODULE_ID("$Id: m_scale.c,v 1.5 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -50,7 +50,8 @@ MODULE_ID("$Id: m_scale.c,v 1.4 1999/05/16 17:28:00 juergen Exp $") | E_BAD_ARGUMENT - invalid menu pointer | E_NOT_CONNECTED - no items are connected to menu +--------------------------------------------------------------------------*/ -int scale_menu(const MENU *menu, int *rows, int *cols) +NCURSES_EXPORT(int) +scale_menu (const MENU *menu, int *rows, int *cols) { if (!menu) RETURN( E_BAD_ARGUMENT ); diff --git a/contrib/ncurses/menu/m_spacing.c b/contrib/ncurses/menu/m_spacing.c index 1d035ab052d9..b384ef3ccaf8 100644 --- a/contrib/ncurses/menu/m_spacing.c +++ b/contrib/ncurses/menu/m_spacing.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_spacing.c,v 1.11 1999/05/16 17:28:09 juergen Exp $") +MODULE_ID("$Id: m_spacing.c,v 1.12 2000/12/10 02:16:48 tom Exp $") #define MAX_SPC_DESC ((TABSIZE) ? (TABSIZE) : 8) #define MAX_SPC_COLS ((TABSIZE) ? (TABSIZE) : 8) @@ -51,7 +51,9 @@ MODULE_ID("$Id: m_spacing.c,v 1.11 1999/05/16 17:28:09 juergen Exp $") | | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ -int set_menu_spacing(MENU *menu, int s_desc, int s_row, int s_col ) +NCURSES_EXPORT(int) +set_menu_spacing +(MENU *menu, int s_desc, int s_row, int s_col ) { MENU *m; /* split for ATAC workaround */ m = Normalize_Menu(menu); @@ -82,7 +84,8 @@ int set_menu_spacing(MENU *menu, int s_desc, int s_row, int s_col ) | | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ -int menu_spacing( const MENU *menu, int* s_desc, int* s_row, int* s_col) +NCURSES_EXPORT(int) +menu_spacing ( const MENU *menu, int* s_desc, int* s_row, int* s_col) { const MENU *m; /* split for ATAC workaround */ m = Normalize_Menu(menu); diff --git a/contrib/ncurses/menu/m_sub.c b/contrib/ncurses/menu/m_sub.c index 35a361e687e2..43d8521445f4 100644 --- a/contrib/ncurses/menu/m_sub.c +++ b/contrib/ncurses/menu/m_sub.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_sub.c,v 1.4 1999/05/16 17:28:20 juergen Exp $") +MODULE_ID("$Id: m_sub.c,v 1.5 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -48,7 +48,8 @@ MODULE_ID("$Id: m_sub.c,v 1.4 1999/05/16 17:28:20 juergen Exp $") | Return Values : E_OK - success | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ -int set_menu_sub(MENU *menu, WINDOW *win) +NCURSES_EXPORT(int) +set_menu_sub (MENU *menu, WINDOW *win) { if (menu) { @@ -71,7 +72,8 @@ int set_menu_sub(MENU *menu, WINDOW *win) | | Return Values : NULL on error, otherwise a pointer to the window +--------------------------------------------------------------------------*/ -WINDOW *menu_sub(const MENU * menu) +NCURSES_EXPORT(WINDOW *) +menu_sub (const MENU * menu) { const MENU* m = Normalize_Menu(menu); return Get_Menu_Window(m); diff --git a/contrib/ncurses/menu/m_userptr.c b/contrib/ncurses/menu/m_userptr.c index 45818a3e78fb..cab4d3c3d9b5 100644 --- a/contrib/ncurses/menu/m_userptr.c +++ b/contrib/ncurses/menu/m_userptr.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_userptr.c,v 1.10 1999/05/16 17:28:29 juergen Exp $") +MODULE_ID("$Id: m_userptr.c,v 1.11 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -48,7 +48,8 @@ MODULE_ID("$Id: m_userptr.c,v 1.10 1999/05/16 17:28:29 juergen Exp $") | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -int set_menu_userptr(MENU * menu, void * userptr) +NCURSES_EXPORT(int) +set_menu_userptr (MENU * menu, void * userptr) { Normalize_Menu(menu)->userptr = userptr; RETURN( E_OK ); @@ -64,7 +65,8 @@ int set_menu_userptr(MENU * menu, void * userptr) | Return Values : Value of the pointer. If no such pointer has been set, | NULL is returned +--------------------------------------------------------------------------*/ -void *menu_userptr(const MENU * menu) +NCURSES_EXPORT(void *) +menu_userptr (const MENU * menu) { return( Normalize_Menu(menu)->userptr); } diff --git a/contrib/ncurses/menu/m_win.c b/contrib/ncurses/menu/m_win.c index 73f34b5cc629..85bb06f032af 100644 --- a/contrib/ncurses/menu/m_win.c +++ b/contrib/ncurses/menu/m_win.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,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_win.c,v 1.9 1999/05/16 17:28:37 juergen Exp $") +MODULE_ID("$Id: m_win.c,v 1.10 2000/12/10 02:16:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -48,7 +48,8 @@ MODULE_ID("$Id: m_win.c,v 1.9 1999/05/16 17:28:37 juergen Exp $") | Return Values : E_OK - success | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ -int set_menu_win(MENU *menu, WINDOW *win) +NCURSES_EXPORT(int) +set_menu_win (MENU *menu, WINDOW *win) { if (menu) { @@ -71,7 +72,8 @@ int set_menu_win(MENU *menu, WINDOW *win) | | Return Values : NULL on error, otherwise pointer to window +--------------------------------------------------------------------------*/ -WINDOW *menu_win(const MENU *menu) +NCURSES_EXPORT(WINDOW *) +menu_win (const MENU *menu) { const MENU* m = Normalize_Menu(menu); return (m->userwin ? m->userwin : stdscr); diff --git a/contrib/ncurses/menu/menu.h b/contrib/ncurses/menu/menu.h index 5be728b1c5df..8c12894fdda4 100644 --- a/contrib/ncurses/menu/menu.h +++ b/contrib/ncurses/menu/menu.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 * @@ -170,82 +170,82 @@ typedef struct tagMENU /* --------- prototypes for libmenu functions ----------------------------- */ -extern ITEM **menu_items(const MENU *), - *current_item(const MENU *), - *new_item(const char *,const char *); - -extern MENU *new_menu(ITEM **); - -extern Item_Options item_opts(const ITEM *); -extern Menu_Options menu_opts(const MENU *); - -Menu_Hook item_init(const MENU *), - item_term(const MENU *), - menu_init(const MENU *), - menu_term(const MENU *); - -extern WINDOW *menu_sub(const MENU *), - *menu_win(const MENU *); - -extern const char *item_description(const ITEM *), - *item_name(const ITEM *), - *menu_mark(const MENU *), - *menu_request_name(int); - -extern char *menu_pattern(const MENU *); - -extern void *menu_userptr(const MENU *), - *item_userptr(const ITEM *); - -extern chtype menu_back(const MENU *), - menu_fore(const MENU *), - menu_grey(const MENU *); - -extern int free_item(ITEM *), - free_menu(MENU *), - item_count(const MENU *), - item_index(const ITEM *), - item_opts_off(ITEM *,Item_Options), - item_opts_on(ITEM *,Item_Options), - menu_driver(MENU *,int), - menu_opts_off(MENU *,Menu_Options), - menu_opts_on(MENU *,Menu_Options), - menu_pad(const MENU *), - pos_menu_cursor(const MENU *), - post_menu(MENU *), - scale_menu(const MENU *,int *,int *), - set_current_item(MENU *menu,ITEM *item), - set_item_init(MENU *,void(*)(MENU *)), - set_item_opts(ITEM *,Item_Options), - set_item_term(MENU *,void(*)(MENU *)), - set_item_userptr(ITEM *, void *), - set_item_value(ITEM *,bool), - set_menu_back(MENU *,chtype), - set_menu_fore(MENU *,chtype), - set_menu_format(MENU *,int,int), - set_menu_grey(MENU *,chtype), - set_menu_init(MENU *,void(*)(MENU *)), - set_menu_items(MENU *,ITEM **), - set_menu_mark(MENU *, const char *), - set_menu_opts(MENU *,Menu_Options), - set_menu_pad(MENU *,int), - set_menu_pattern(MENU *,const char *), - set_menu_sub(MENU *,WINDOW *), - set_menu_term(MENU *,void(*)(MENU *)), - set_menu_userptr(MENU *,void *), - set_menu_win(MENU *,WINDOW *), - set_top_row(MENU *,int), - top_row(const MENU *), - unpost_menu(MENU *), - menu_request_by_name(const char *), - set_menu_spacing(MENU *,int,int,int), - menu_spacing(const MENU *,int *,int *,int *); - - -extern bool item_value(const ITEM *), - item_visible(const ITEM *); - -void menu_format(const MENU *,int *,int *); +extern NCURSES_EXPORT(ITEM **) menu_items (const MENU *); +extern NCURSES_EXPORT(ITEM *) current_item (const MENU *); +extern NCURSES_EXPORT(ITEM *) new_item (const char *,const char *); + +extern NCURSES_EXPORT(MENU *) new_menu (ITEM **); + +extern NCURSES_EXPORT(Item_Options) item_opts (const ITEM *); +extern NCURSES_EXPORT(Menu_Options) menu_opts (const MENU *); + +extern NCURSES_EXPORT(Menu_Hook) item_init (const MENU *); +extern NCURSES_EXPORT(Menu_Hook) item_term (const MENU *); +extern NCURSES_EXPORT(Menu_Hook) menu_init (const MENU *); +extern NCURSES_EXPORT(Menu_Hook) menu_term (const MENU *); + +extern NCURSES_EXPORT(WINDOW *) menu_sub (const MENU *); +extern NCURSES_EXPORT(WINDOW *) menu_win (const MENU *); + +extern NCURSES_EXPORT(const char *) item_description (const ITEM *); +extern NCURSES_EXPORT(const char *) item_name (const ITEM *); +extern NCURSES_EXPORT(const char *) menu_mark (const MENU *); +extern NCURSES_EXPORT(const char *) menu_request_name (int); + +extern NCURSES_EXPORT(char *) menu_pattern (const MENU *); + +extern NCURSES_EXPORT(void *) menu_userptr (const MENU *); +extern NCURSES_EXPORT(void *) item_userptr (const ITEM *); + +extern NCURSES_EXPORT(chtype) menu_back (const MENU *); +extern NCURSES_EXPORT(chtype) menu_fore (const MENU *); +extern NCURSES_EXPORT(chtype) menu_grey (const MENU *); + +extern NCURSES_EXPORT(int) free_item (ITEM *); +extern NCURSES_EXPORT(int) free_menu (MENU *); +extern NCURSES_EXPORT(int) item_count (const MENU *); +extern NCURSES_EXPORT(int) item_index (const ITEM *); +extern NCURSES_EXPORT(int) item_opts_off (ITEM *,Item_Options); +extern NCURSES_EXPORT(int) item_opts_on (ITEM *,Item_Options); +extern NCURSES_EXPORT(int) menu_driver (MENU *,int); +extern NCURSES_EXPORT(int) menu_opts_off (MENU *,Menu_Options); +extern NCURSES_EXPORT(int) menu_opts_on (MENU *,Menu_Options); +extern NCURSES_EXPORT(int) menu_pad (const MENU *); +extern NCURSES_EXPORT(int) pos_menu_cursor (const MENU *); +extern NCURSES_EXPORT(int) post_menu (MENU *); +extern NCURSES_EXPORT(int) scale_menu (const MENU *,int *,int *); +extern NCURSES_EXPORT(int) set_current_item (MENU *menu,ITEM *item); +extern NCURSES_EXPORT(int) set_item_init (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_item_opts (ITEM *,Item_Options); +extern NCURSES_EXPORT(int) set_item_term (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_item_userptr (ITEM *, void *); +extern NCURSES_EXPORT(int) set_item_value (ITEM *,bool); +extern NCURSES_EXPORT(int) set_menu_back (MENU *,chtype); +extern NCURSES_EXPORT(int) set_menu_fore (MENU *,chtype); +extern NCURSES_EXPORT(int) set_menu_format (MENU *,int,int); +extern NCURSES_EXPORT(int) set_menu_grey (MENU *,chtype); +extern NCURSES_EXPORT(int) set_menu_init (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_menu_items (MENU *,ITEM **); +extern NCURSES_EXPORT(int) set_menu_mark (MENU *, const char *); +extern NCURSES_EXPORT(int) set_menu_opts (MENU *,Menu_Options); +extern NCURSES_EXPORT(int) set_menu_pad (MENU *,int); +extern NCURSES_EXPORT(int) set_menu_pattern (MENU *,const char *); +extern NCURSES_EXPORT(int) set_menu_sub (MENU *,WINDOW *); +extern NCURSES_EXPORT(int) set_menu_term (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_menu_userptr (MENU *,void *); +extern NCURSES_EXPORT(int) set_menu_win (MENU *,WINDOW *); +extern NCURSES_EXPORT(int) set_top_row (MENU *,int); +extern NCURSES_EXPORT(int) top_row (const MENU *); +extern NCURSES_EXPORT(int) unpost_menu (MENU *); +extern NCURSES_EXPORT(int) menu_request_by_name (const char *); +extern NCURSES_EXPORT(int) set_menu_spacing (MENU *,int,int,int); +extern NCURSES_EXPORT(int) menu_spacing (const MENU *,int *,int *,int *); + + +extern NCURSES_EXPORT(bool) item_value (const ITEM *); +extern NCURSES_EXPORT(bool) item_visible (const ITEM *); + +extern NCURSES_EXPORT(void) menu_format (const MENU *,int *,int *); #ifdef __cplusplus } diff --git a/contrib/ncurses/menu/menu.priv.h b/contrib/ncurses/menu/menu.priv.h index 4c2a22d1ff8e..e9c27d136e2a 100644 --- a/contrib/ncurses/menu/menu.priv.h +++ b/contrib/ncurses/menu/menu.priv.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 * @@ -41,8 +41,8 @@ /* Backspace code */ #define BS (8) -extern ITEM _nc_Default_Item; -extern MENU _nc_Default_Menu; +extern NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item; +extern NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu; /* Normalize item to default if none was given */ #define Normalize_Item( item ) ((item)=(item)?(item):&_nc_Default_Item) @@ -101,14 +101,14 @@ extern MENU _nc_Default_Menu; (menu)->pattern[0] = '\0'; } /* Internal functions. */ -extern void _nc_Draw_Menu(const MENU *); -extern void _nc_Show_Menu(const MENU *); -extern void _nc_Calculate_Item_Length_and_Width(MENU *); -extern void _nc_Post_Item(const MENU *, const ITEM *); -extern bool _nc_Connect_Items(MENU *, ITEM **); -extern void _nc_Disconnect_Items(MENU *); -extern void _nc_New_TopRow_and_CurrentItem(MENU *,int, ITEM *); -extern void _nc_Link_Items(MENU *); -extern int _nc_Match_Next_Character_In_Item_Name(MENU*,int,ITEM**); -extern int _nc_menu_cursor_pos(const MENU* menu, const ITEM* item, +extern NCURSES_EXPORT(void) _nc_Draw_Menu (const MENU *); +extern NCURSES_EXPORT(void) _nc_Show_Menu (const MENU *); +extern NCURSES_EXPORT(void) _nc_Calculate_Item_Length_and_Width (MENU *); +extern NCURSES_EXPORT(void) _nc_Post_Item (const MENU *, const ITEM *); +extern NCURSES_EXPORT(bool) _nc_Connect_Items (MENU *, ITEM **); +extern NCURSES_EXPORT(void) _nc_Disconnect_Items (MENU *); +extern NCURSES_EXPORT(void) _nc_New_TopRow_and_CurrentItem (MENU *,int, ITEM *); +extern NCURSES_EXPORT(void) _nc_Link_Items (MENU *); +extern NCURSES_EXPORT(int) _nc_Match_Next_Character_In_Item_Name (MENU*,int,ITEM**); +extern NCURSES_EXPORT(int) _nc_menu_cursor_pos (const MENU* menu, const ITEM* item, int* pY, int* pX); diff --git a/contrib/ncurses/misc/makellib b/contrib/ncurses/misc/makellib index fe9f99f18517..046040734bca 100755 --- a/contrib/ncurses/misc/makellib +++ b/contrib/ncurses/misc/makellib @@ -1,6 +1,6 @@ #!/bin/sh ############################################################################## -# 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"), # @@ -27,9 +27,9 @@ # authorization. # ############################################################################## # -# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 +# Author: Thomas E. Dickey 1996,1997,2000 # -# $Id: makellib,v 1.7 1998/02/11 12:13:50 tom Exp $ +# $Id: makellib,v 1.8 2000/10/28 21:37:10 tom Exp $ # System-dependent wrapper for 'lint' that creates a lint-library via the # following method (XXX is the name of the library): # a. If the file llib-lXXX doesn't exist, create it using the make-rule @@ -116,6 +116,11 @@ Solaris) TARGET=$llib.c ln $llib $TARGET ;; +FreeBSD) + CREATE="-g -z -C$LLIB" + TARGET=$llib.c + ln $llib $TARGET + ;; CLIX) CREATE="-DLINTLIBRARY -vxo$LLIB" TARGET=$llib.c diff --git a/contrib/ncurses/misc/tdlint b/contrib/ncurses/misc/tdlint index 869a34bf9222..c0e652b6f44f 100755 --- a/contrib/ncurses/misc/tdlint +++ b/contrib/ncurses/misc/tdlint @@ -29,7 +29,7 @@ # # Author: Thomas E. Dickey <dickey@clark.net> 1996 # -# $Id: tdlint,v 1.4 1998/02/11 12:13:50 tom Exp $ +# $Id: tdlint,v 1.5 2000/10/28 20:53:36 tom Exp $ # # Lint-script that allows user's own lint libraries, in addition to the ones # installed in the system. @@ -48,6 +48,8 @@ else ;; IRIX) set - $* -n -lc ;; + FreeBSD) set - $* -g -p -u -v -z + ;; SunOS) case `uname -r` in 5.*) ARCH=Solaris diff --git a/contrib/ncurses/misc/terminfo.src b/contrib/ncurses/misc/terminfo.src index 9e58d167e191..124b023f3c30 100644 --- a/contrib/ncurses/misc/terminfo.src +++ b/contrib/ncurses/misc/terminfo.src @@ -5,7 +5,7 @@ # bug-ncurses@gnu.org # # Version 10.2.1 -# $Date: 2000/09/24 02:29:16 $ +# $Date: 2001/05/05 23:09:00 $ # terminfo syntax # # Eric S. Raymond (current maintainer) @@ -329,11 +329,11 @@ ansi+sgrul|ansi underline only, rmul=\E[m, smul=\E[4m, ansi+sgrbold|ansi graphic renditions; assuming terminal has bold; not dim, bold=\E[1m, - sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m, use=ansi+sgr, use=ansi+sgrso, use=ansi+sgrul, ansi+sgrdim|ansi graphic renditions; assuming terminal has dim; not bold, dim=\E[2m, - sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p5%t2;%;m, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p5%t2;%;%?%p7%t8;%;m, use=ansi+sgr, use=ansi+sgrso, use=ansi+sgrul, ansi+pp|ansi printer port, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, @@ -804,30 +804,44 @@ pmcons|pmconsole|PMAX console, # F13-F24 are shifted F1-F12 # F25-F36 are control F1-F12 # F37-F48 are shift+control F1-F12 +# +# hpa/vpa work in the console, but not in scoterm: +# hpa=\E[%p1%dG, +# vpa=\E[%p1%dd, +# +# SCO's terminfo uses +# kLFT=\E[d, +# kRIT=\E[c, +# which do not work (console or scoterm). +# +# Console documents only 3 attributes can be set with SGR (so we don't use sgr). scoansi|SCO Extended ANSI standard crt, - OTbs, am, eo, xon, + OTbs, am, bce, eo, xon, colors#8, cols#80, it#8, lines#25, pairs#64, acsc=0[5566778899\:\:;;<<==>>FFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXX`ja0fxgqh2jYk?lZm@nEqDtCu4vAwBx3~y, - blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[2J, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + civis=\E[=14;12C, clear=\E[2J\E[H, cnorm=\E[=10;12C, cub1=\E[D, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, - cuu1=\E[A, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, - ht=^I, ich1=\E[@, il1=\E[L, ind=\E[S, invis=\E[8m, kbeg=\E[E, - kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, - kcuu1=\E[A, kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, - kf12=\E[X, kf13=\E[Y, kf15=\E[a, kf16=\E[b, kf17=\E[c, - kf18=\E[d, kf19=\E[e, kf2=\E[N, kf20=\E[f, kf21=\E[g, - kf22=\E[h, kf23=\E[i, kf24=\E[j, kf25=\E[k, kf26=\E[l, - kf27=\E[m, kf28=\E[n, kf29=\E[o, kf3=\E[O, kf30=\E[p, - kf31=\E[q, kf32=\E[r, kf33=\E[s, kf34=\E[t, kf35=\E[u, - kf36=\E[v, kf37=\E[w, kf38=\E[x, kf39=\E[y, kf4=\E[P, - kf40=\E[z, kf41=\E[@, kf42=\E[[, kf43=\E[\\, kf44=\E[], - kf45=\E[\^, kf46=\E[_, kf47=\E[`, kf48=\E[{, kf5=\E[Q, - kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, - kich1=\E[L, knp=\E[G, kpp=\E[I, op=\E[37;40m, rev=\E[7m, - ri=\E[T, rmacs=\E[10m, rmso=\E[m, rmul=\E[m, - setab=\E[4%p1%dm, setaf=\E[3%p1%dm, - sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%;m, - sgr0=\E[0;10m, smacs=\E[12m, smso=\E[7m, smul=\E[4m, + cuu1=\E[A, cvvis=\E[=0;12C, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[m\E[J, el=\E[m\E[K, home=\E[H, ht=^I, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, + indn=\E[%p1%dS, invis=\E[8m, kbeg=\E[E, kbs=^H, kcbt=\E[Z, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=^_, + kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, kf12=\E[X, + kf13=\E[Y, kf15=\E[a, kf16=\E[b, kf17=\E[c, kf18=\E[d, + kf19=\E[e, kf2=\E[N, kf20=\E[f, kf21=\E[g, kf22=\E[h, + kf23=\E[i, kf24=\E[j, kf25=\E[k, kf26=\E[l, kf27=\E[m, + kf28=\E[n, kf29=\E[o, kf3=\E[O, kf30=\E[p, kf31=\E[q, + kf32=\E[r, kf33=\E[s, kf34=\E[t, kf35=\E[u, kf36=\E[v, + kf37=\E[w, kf38=\E[x, kf39=\E[y, kf4=\E[P, kf40=\E[z, + kf41=\E[@, kf42=\E[[, kf43=\E[\\, kf44=\E[], kf45=\E[\^, + kf46=\E[_, kf47=\E[`, kf48=\E[{, kf5=\E[Q, kf6=\E[R, + kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, kich1=\E[L, + knp=\E[G, kpp=\E[I, op=\E[37;40m, rev=\E[7m, ri=\E[T, + rin=\E[%p1%dT, rmacs=\E[10m, rmam=\E[?7l, rmso=\E[m, + rmul=\E[m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr0=\E[0;10m, smacs=\E[12m, smam=\E[?7h, smso=\E[7m, + smul=\E[4m, # This actually describes the generic SVr4 display driver for Intel boxes. # The <dim=\E[2m> isn't documented and therefore may not be reliable. @@ -1263,7 +1277,7 @@ qansi-g|QNX ANSI, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, - sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;9%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smso=\E[7m, smul=\E[4m, tbc=\E[2g, tsl=\E7\E1;24r\E[?6l\E[25;%i%p1%dH, @@ -1385,11 +1399,11 @@ arm100|arm100-am|Arm(RiscPC) ncurses compatible (for 640x480), kc1=\E[p, kc3=\E[n, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kent=\E[M, kf0=\E[y, kf1=\E[P, kf10=\E[x, kf2=\E[Q, kf3=\E[R, kf4=\E[S, kf5=\E[t, kf6=\E[u, kf7=\E[v, - kf8=\E[l, kf9=\E[w, rc=\E8, rev=\E[6m$<2>, ri=\EM$<5>, + kf8=\E[l, kf9=\E[w, rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, - sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<2>, sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, use=ecma+sgr, use=klone+color, @@ -1802,7 +1816,7 @@ vt100|vt100-am|dec vt100 (w/advanced video), rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, - sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>, sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, vt100nam|vt100-nam|vt100 no automargins, @@ -1925,7 +1939,7 @@ vt220-old|vt200-old|DEC VT220 in vt100 emulation mode, ri=\EM$<14/>, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, - sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, smso=\E[7m, smul=\E[4m, @@ -2219,7 +2233,7 @@ vt420|DEC VT420, rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, rmso=\E[m, rmul=\E[m, rs3=\E[?67h\E[64;1"p, sc=\E7, - sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, @@ -2317,7 +2331,7 @@ vt520|DEC VT520, ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, rmso=\E[m, rmul=\E[m, rs3=\E[?67h\E[64;1"p, sc=\E7, - sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, smso=\E[7m, smul=\E[4m, @@ -2344,7 +2358,7 @@ vt525|DEC VT525, ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, rmso=\E[m, rmul=\E[m, rs3=\E[?67h\E[64;1"p, sc=\E7, - sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, smso=\E[7m, smul=\E[4m, @@ -2617,13 +2631,13 @@ xterm-xf86-v40|xterm terminal emulator (XFree86 4.0 Window System), kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, khome=\EOH, rmcup=\E[?1049l, - sgr=\E[0%?%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, smcup=\E[?1049h, use=xterm-xf86-v333, xterm-xfree86|xterm-new|xterm terminal emulator (XFree86 4.0 Window System), npc, - kDC=\E[3;5~, kEND=\EO5F, kHOM=\EO5H, kIC=\E[2;5~, - kLFT=\EO5D, kNXT=\E[6;5~, kPRV=\E[5;5~, kRIT=\EO5C, + kDC=\E[3;2~, kEND=\EO2F, kHOM=\EO2H, kIC=\E[2;2~, + kLFT=\EO2D, kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\EO2C, kb2=\EOE, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\EO2P, kf14=\EO2Q, @@ -2664,7 +2678,7 @@ xterm-basic|xterm terminal emulator - common (XFree86), setaf=\E[3%p1%dm, setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, - sgr=\E[0%?%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[?1049h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, @@ -2737,7 +2751,7 @@ xterm-8bit|xterm terminal emulator 8-bit controls (X Window System), sc=\E7, setab=\2334%p1%dm, setaf=\2333%p1%dm, setb=\2334%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, setf=\2333%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, - sgr=\2330%?%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\233m^O, smacs=^N, smam=\233?7h, smcup=\233?1049h, smir=\2334h, smkx=\233?1h\E=, smso=\2337m, smul=\2334m, tbc=\2333g, u6=\233[%i%d;%dR, u7=\E[6n, u8=\233[?1;2c, @@ -2822,10 +2836,13 @@ xterm-bold|xterm terminal emulator (X11R6 Window System) standout w/bold, # (kterm: this had extension capabilities ":KJ:TY=ascii:" -- esr) # (kterm should not invoke DEC Graphics as the alternate character set # -- Kenji Rikitake) +# (proper setting of enacs, smacs, rmacs makes kterm to use DEC Graphics +# -- MATSUMOTO Shoji) kterm|kterm kanji terminal emulator (X window system), eslok, hs, - acsc@, csr=\E[%i%p1%d;%p2%dr, dsl=\E[?H, enacs@, fsl=\E[?F, - kmous=\E[M, rc=\E8, rmacs@, sc=\E7, smacs@, + acsc=++\,\,--..00II``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + csr=\E[%i%p1%d;%p2%dr, dsl=\E[?H, enacs=, fsl=\E[?F, + kmous=\E[M, rc=\E8, rmacs=\E(B, sc=\E7, smacs=\E(0, tsl=\E[?E\E[?%i%dT, use=xterm-r6, use=ecma+color, kterm-color|kterm-co|kterm with ANSI colors, ncv@, use=kterm, use=ecma+color, @@ -2996,7 +3013,7 @@ xtermm|xterm terminal emulator (monocrome), OTbs, am, km, mir, msgr, xenl, btns#3, cols#80, it#8, lines#24, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, blink=@, bold=\E[1m, clear=\E[H\E[2J, cr=^M, + bel=^G, blink@, bold=\E[1m, clear=\E[H\E[2J, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[1D, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, @@ -3189,6 +3206,8 @@ eterm|gnu emacs term.el terminal emulation, # (\E[39m / \E[49m). # S0 (str) Switch charset 'G0' to the specified charset. # E0 (str) Switch charset 'G0' back to standard charset. +# +# tested with screen 3.09.08 screen|VT 100/ANSI X3.64 virtual terminal, OTbs, OTpt, am, km, mir, msgr, xenl, G0, colors#8, cols#80, it#8, lines#24, pairs#64, @@ -3202,15 +3221,55 @@ screen|VT 100/ANSI X3.64 virtual terminal, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, flash=\Eg, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E)0, kbs=^H, kcub1=\EOD, - kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kf1=\EOP, - kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, - kf4=\EOS, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, - kf9=\E[20~, khome=\E[1~, kich1=\E[2~, kll=\E[4~, knp=\E[6~, - kpp=\E[5~, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, - rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m, rmul=\E[24m, - rs2=\Ec, sc=\E7, sgr0=\E[m, smacs=^N, smir=\E[4h, - smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g, E0=\E(B, - S0=\E(%p1%c, use=ecma+color, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, + kend=\E[4~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[15~, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[23m, rmul=\E[24m, rs2=\Ec, sc=\E7, + sgr0=\E[m, smacs=^N, smir=\E[4h, smkx=\E[?1h\E=, + smso=\E[3m, smul=\E[4m, tbc=\E[3g, E0=\E(B, S0=\E(%p1%c, + use=ecma+color, + +# Read the fine manpage: +# When screen tries to figure out a terminal name for +# itself, it first looks for an entry named "screen.<term>", +# where <term> is the contents of your $TERM variable. If +# no such entry exists, screen tries "screen" (or "screen-w" +# if the terminal is wide (132 cols or more)). If even this +# entry cannot be found, "vt100" is used as a substitute. +# +# Here are a few customized entries which are useful -TD +# +# Notes: +# (a) screen does not support invis. +# (b) screen's implementation of bw is incorrect according to tack. +# (c) screen appears to hardcode the strings for khome/kend, making it +# necessary to override the "use=" clause's values. +# (d) screen sets $TERMCAP to a termcap-formatted copy of the 'screen' entry, +# which is NOT the same as the terminfo screen.<term>. +# (e) when screen finds one of these customized entries, it sets $TERM to +# match. Hence, no "screen.xterm" entry is provided, since that would +# create heartburn for people running remote xterm's. +# +# xterm (-xfree86 or -r6) does not normally support kIC, kNXT and kPRV +# since the default translations override the built-in keycode +# translation. They are suppressed here to show what is tested by tack. +screen.xterm-xfree86|screen customized for XFree86 xterm, + bce@, bw, + invis@, kIC@, kNXT@, kPRV@, kend=\E[4~, khome=\E[1~, meml@, + memu@, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + use=xterm-xfree86, +# xterm-r6 does not really support khome/kend unless it is propped up by +# the translations resource. +screen.xterm-r6|screen customized for X11R6 xterm, + bw, use=xterm-r6, +# Color applications running in screen and TeraTerm do not play well together +# on Solaris. +screen.teraterm|disable ncv in teraterm, + ncv#127, use=screen, screen-w|VT 100/ANSI X3.64 virtual terminal with 132 cols, cols#132, use=screen, @@ -3763,7 +3822,7 @@ mono-emx|stupid monochrome ansi terminal with only one kind of emphasis, # Use this for cygwin32 (tested with beta 19.1) # underline is colored bright magenta # shifted kf1-kf12 are kf11-kf22 -cygwin|ansi emulation for cygwin32, +cygwinB19|ansi emulation for cygwin32, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, @@ -3773,6 +3832,36 @@ cygwin|ansi emulation for cygwin32, khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, rmam@, smam@, use=ansi.sys, +# Use this for cygwin (tested with version 1.1.0). +# I've combined pcansi and linux. Some values of course were different and +# I've indicated which of these were and which I used. +# Cheers, earnie_boyd@yahoo.com +# several changes based on running with tack and comparing with older entry -TD +cygwin|ansi emulation for Cygwin, + am, eo, in, msgr, xon, + colors#8, cols#80, it#8, lines#25, ncv#3, pairs#64, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, + bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, cub1=^H, + cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, el1=\E[1K, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, + hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, + ind=^J, invis=\E[8m, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, + kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, + knp=\E[6~, kpp=\E[5~, kspd=^Z, nel=^M^J, op=\E[39;49m, + rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, rmpch=\E[10m, + rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]R, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, + sgr0=\E[0;10m, smir=\E[4h, smpch=\E[11m, smso=\E[7m, + smul=\E[4m, u6=\E[%i%d;%dR, u7=\E[6n, u9=\E[c, + vpa=\E[%i%p1%dd, + # This entry fits the Windows NT console when the _POSIX_TERM environment # variable is set to 'on'. While the Windows NT POSIX console is seldom used, # the Telnet client supplied with both the Windows for WorkGroup 3.11 TCP/IP @@ -5034,7 +5123,7 @@ qvt103|qume qvt 103, rev=\E[7m$<2>, ri=\EM$<5>, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, - sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m$<2>, sgr0=\E[m$<2>, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, qvt103-w|qume qvt103 132 cols, @@ -7615,7 +7704,7 @@ v5410|att5410 in terms of a vt100, rmacs=^O, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, - sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>, sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, @@ -11018,7 +11107,7 @@ ts100|ts100-sp|falco ts100-sp, rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, - sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>, sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, ts100-ctxt|falco ts-100 saving context, @@ -13637,7 +13726,7 @@ tek4105-30|4015 emulating 30 line vt100, rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, - sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>, sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, @@ -13739,7 +13828,7 @@ tek4107|tek4109|tektronix terminals 4107 4109, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, rev=\E%!1\E[7m$<2>\E%0, ri=\EI, rmso=\E%!1\E[m$<2>\E%!0, rmul=\E%!1\E[m$<2>\E%!0, - sgr=\E%%!1\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m\E%%!0, + sgr=\E%%!1\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m$<2>\E%%!0, sgr0=\E%!1\E[m$<2>\E%!0, smso=\E%!1\E[7;5m$<2>\E%!0, smul=\E%!1\E[4m$<2>\E%!0, # Tektronix 4207 with sysline. In the ancestral termcap file this was 4107-s; @@ -14327,6 +14416,70 @@ mac|macintosh|Macintosh with MacTerminal, mac-w|macterminal-w|Apple Macintosh with Macterminal in 132 column mode, cols#132, use=mac, +# Apple's MacOS X includes a Terminal.app derived from the old NeXT +# Terminal.app. It is a partial VT100 emulation with some extensions. +# +# There are no function keys, at least not in version 41. +# +# It supports mouse pointer position reporting using xterm-like +# sequences (not used in these entries.) When using emacs, the cursor +# can be positioned using option-click. +# +# It provides partial ANSI color support (background colors interact +# badly with bold, though.) The monochrome (-m) entries are useful if +# you've disabled color support. +# +# The configurable titlebar is set using xterm-compatible sequences; +# it is used as a status bar in these entries. +# +# The MacRoman character encoding is used for some of the alternate +# characters in the "MacRoman" entries; the "ASCII" (-ascii) entries +# rely instead on Terminal.app's own buggy VT100 graphics emulation, +# which seems to think the character encoding is the old NeXT charset +# instead of MacRoman. +# +# Terminal.app reports "vt100" as the terminal type, but exports +# several environment variables which may aid detection in a shell +# profile: +# +# TERM=vt100 +# TERM_PROGRAM=Apple_Terminal +# TERM_PROGRAM_VERSION=41 + +Apple_Terminal-ascii-m|Apple MacOS X Terminal.app v41 w/ASCII charset (monochrome), + am, bw, hs, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, wsl#40, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dl=\E[%p1%dM, dl1=\E[M, dsl=\E]2;\007, ed=\E[J, el=\E[K, + el1=\E[1K, enacs=\E(B\E)0, fsl=^G, home=\E[H, ht=^I, hts=\EH, + il=\E[%p1%dL, il1=\E[L, ind=^J, ka1=\EOq, ka3=\EOs, kb2=\EOr, + kbs=\177, kc1=\EOp, kc3=\EOn, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, + rmul=\E[m, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, tsl=\E]2;, u8=\E[?1;2c, + u9=\E[c, + +Apple_Terminal-ascii|Apple MacOS X Terminal.app v41 w/ASCII charset (color), + colors#8, ncv#37, pairs#64, + op=\E[37;40m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + use=Apple_Terminal-ascii-m, + +Apple_Terminal-m|Apple MacOS X Terminal.app v41 w/MacRoman charset (monochrome), + acsc=0#`\327a*f\241g\261h#i\360jjkkllmmnno\370p\370q\321rrssttuuvvwwxxy\262z\263{\271|\255}\243~\245+\335-\366\,\334.\377, + use=Apple_Terminal-ascii-m, + +Apple_Terminal|Apple MacOS X Terminal.app v41 w/MacRoman charset (color), + acsc=0#`\327a*f\241g\261h#i\360jjkkllmmnno\370p\370q\321rrssttuuvvwwxxy\262z\263{\271|\255}\243~\245+\335-\366\,\334.\377, + use=Apple_Terminal-ascii, + #### Radio Shack/Tandy # @@ -17058,7 +17211,7 @@ dwk|dwk-vt|dwk terminal, env230|envision230|envision 230 graphics terminal, xenl@, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, - sgr=\E[%?%p1%t;1%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, + sgr=\E[%?%p1%t;1%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m$<2>, use=vt100, # These execuports were impact-printer ttys with a 30- or maybe 15-cps acoustic # coupler attached, the whole rig fitting in a suitcase and more or less @@ -18597,6 +18750,36 @@ v3220|LANPAR Vision II model 3220/3221/3222, # bracketing sequences that reset video attributes (\E8 would restore # them) -TD # +# 2000-11-11 +# * rename cygwin to cygwinB19, adapt newer entry from Earnie Boyd -TD +# +# 2000-12-16 +# * improved scoansi, based on SCO man-page, and testing console, +# scoterm with tack -TD +# +# 2001-01-27 +# * modify kterm to use acsc via SCS controls. +# +# 2001-02-10 +# * screen 3.9.8 allows xterm mouse controls to pass-through +# +# 2001-03-11 +# * remove spurious "%|" from some xterm entries. +# +# 2001-03-31 +# * modify 'screen' khome/kend to match screen 3.09.08 +# * add examples of 'screen' customization (screen.xterm-xfree86, +# screen.xterm-r6, screen.teraterm) -TD +# +# 2001-04-14 +# * correct definitions of shifted editing keys for xterm-xfree86 -TD +# * add "Apple_Terminal" entries -Benjamin Sittler +# * remove time-delays from "Apple_Terminal" entries -TD +# * make sgr entries time-delays consistent with individual caps -TD +# +# 2001-05-05 +# * corrected/updated screen.xterm-xfree86 +# # The following sets edit modes for GNU EMACS. # Local Variables: # fill-prefix:"\t" diff --git a/contrib/ncurses/mk-0th.awk b/contrib/ncurses/mk-0th.awk index 5173269e440a..61a636c38ed0 100644 --- a/contrib/ncurses/mk-0th.awk +++ b/contrib/ncurses/mk-0th.awk @@ -1,4 +1,4 @@ -# $Id: mk-0th.awk,v 1.8 2000/01/09 00:29:10 tom Exp $ +# $Id: mk-0th.awk,v 1.9 2001/03/24 19:31:22 tom Exp $ ############################################################################## # Copyright (c) 1998-2000 Free Software Foundation, Inc. # # # @@ -38,9 +38,11 @@ BEGIN { print "" print "# generated by mk-0th.awk" print "" - print ".SUFFIXES: .c .h .i" + print ".SUFFIXES: .c .cc .h .i .ii" print ".c.i :" printf "\t$(CPP) $(CPPFLAGS) $< >$@\n" + print ".cc.ii :" + printf "\t$(CPP) $(CPPFLAGS) $< >$@\n" print ".h.i :" printf "\t$(CPP) $(CPPFLAGS) $< >$@\n" print "" diff --git a/contrib/ncurses/mk-1st.awk b/contrib/ncurses/mk-1st.awk index 92c51d7b4f7e..c14219cd529a 100644 --- a/contrib/ncurses/mk-1st.awk +++ b/contrib/ncurses/mk-1st.awk @@ -1,4 +1,4 @@ -# $Id: mk-1st.awk,v 1.45 2000/08/19 19:13:19 tom Exp $ +# $Id: mk-1st.awk,v 1.46 2000/10/14 17:57:02 Johnny.C.Lam Exp $ ############################################################################## # Copyright (c) 1998,2000 Free Software Foundation, Inc. # # # @@ -215,6 +215,29 @@ END { printf "\t-@rm -f so_locations\n" } } + else if ( MODEL == "LIBTOOL" ) + { + if ( $2 == "c++" ) { + compile="CXX" + } else { + compile="CC" + } + end_name = lib_name; + printf "../lib/%s : $(%s_OBJS)\n", lib_name, OBJS + printf "\tcd ../lib && $(LIBTOOL) $(%s) -o %s $(%s_OBJS:.o=.lo) -rpath $(DESTDIR)$(libdir) -version-info $(NCURSES_MAJOR):$(NCURSES_MINOR)\n", compile, lib_name, OBJS + print "" + print "install \\" + print "install.libs \\" + printf "install.%s :: $(DESTDIR)$(libdir) ../lib/%s\n", name, lib_name + printf "\t@echo installing ../lib/%s as $(DESTDIR)$(libdir)/%s\n", lib_name, lib_name + printf "\tcd ../lib; $(LIBTOOL) $(INSTALL_DATA) %s $(DESTDIR)$(libdir)\n", lib_name + print "" + print "uninstall \\" + print "uninstall.libs \\" + printf "uninstall.%s ::\n", name + printf "\t@echo uninstalling $(DESTDIR)$(libdir)/%s\n", lib_name + printf "\t-@$(LIBTOOL) rm -f $(DESTDIR)$(libdir)/%s\n", lib_name + } else { end_name = lib_name; @@ -266,14 +289,23 @@ END { print "" print "mostlyclean::" printf "\t-rm -f $(%s_OBJS)\n", OBJS + if ( MODEL == "LIBTOOL" ) { + printf "\t-rm -f $(%s_OBJS:.o=.lo)\n", OBJS + } } else if ( found == 2 ) { print "" print "mostlyclean::" printf "\t-rm -f $(%s_OBJS)\n", OBJS + if ( MODEL == "LIBTOOL" ) { + printf "\t-rm -f $(%s_OBJS:.o=.lo)\n", OBJS + } print "" print "clean ::" printf "\t-rm -f $(%s_OBJS)\n", OBJS + if ( MODEL == "LIBTOOL" ) { + printf "\t-rm -f $(%s_OBJS:.o=.lo)\n", OBJS + } } } diff --git a/contrib/ncurses/mk-2nd.awk b/contrib/ncurses/mk-2nd.awk index e90f16d03882..45def01202e3 100644 --- a/contrib/ncurses/mk-2nd.awk +++ b/contrib/ncurses/mk-2nd.awk @@ -1,4 +1,4 @@ -# $Id: mk-2nd.awk,v 1.12 2000/04/01 20:50:36 tom Exp $ +# $Id: mk-2nd.awk,v 1.13 2000/10/14 17:57:02 Johnny.C.Lam Exp $ ############################################################################## # Copyright (c) 1998 Free Software Foundation, Inc. # # # @@ -100,9 +100,9 @@ BEGIN { dir = $3 "/" sub("^\\$\\(srcdir\\)/","",dir); sub("^\\./","",dir); - printf "\t%scd ../%s; $(%s) $(CFLAGS_%s) -c ../%s/%s%s%s", atsign, model, compile, MODEL, name, dir, $1, suffix + printf "\t%scd ../%s; $(LIBTOOL) $(%s) $(CFLAGS_%s) -c ../%s/%s%s%s", atsign, model, compile, MODEL, name, dir, $1, suffix } else - printf "\t%scd ../%s; $(%s) $(CFLAGS_%s) -c %s/%s%s", atsign, model, compile, MODEL, $3, $1, suffix + printf "\t%scd ../%s; $(LIBTOOL) $(%s) $(CFLAGS_%s) -c %s/%s%s", atsign, model, compile, MODEL, $3, $1, suffix } else { printf "%s", $1 for (n = 2; n <= NF; n++) printf " %s", $n diff --git a/contrib/ncurses/ncurses/Makefile.in b/contrib/ncurses/ncurses/Makefile.in index 10b3ca5d87d6..0061f829280f 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 aade721a2e6e..20c94d3c2895 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 9b5a31a85a2f..53d12bfd42bc 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 aaeb4743cdfe..c06773350cc6 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 337794007035..4de2a5a466bf 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 3d5b25637d75..d9d5da59433f 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 52dc6927bd55..7fc885f8d9b3 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 c9aa02292118..c8ca2856bb97 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 a1385769781f..e3b4be297c17 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 69c17c34709b..799fbf61523c 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 59a3bae81c8c..60bf944a44ed 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 3428aaf69e16..c23d0a1d2ff1 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 410ee0580433..071924c56f1e 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 8a682585b560..d018fd89b09a 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 7690ae4a2af3..66c6a09b63f9 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 9c07cf0890e4..e0b4edf9e224 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 cc904b1d7dc7..9b56bd1ec63a 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 d1e243f37ffd..805e7c29093d 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 a5d067cbfd5f..fa0afe4ec502 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 492194babbfb..1fa573271ab9 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 3870e875f322..b496c78c9e39 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 0169d31ac6d5..918e22534f0d 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 7bab0c77b02b..7c5686952319 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 7c090244f291..24705c9615e9 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 4ccf97ff64c0..df44713d1a11 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 31b6e516cc1d..66662871962b 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 1e4237bf8056..87673b7a81f4 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 d0d607f6b0f8..a6b022a8e816 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 28f0e5f9f425..bbd8c0ed7cb2 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 f67bf9a35f77..9deafec57a43 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 485c6e35c8ff..cd58f1821a7f 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 fd32d35a38e7..72d1ddba90fd 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 5590ec9f5406..87988b66f1a3 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 4779ae09d75b..31625bbf4cdf 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 9a89a077cd44..b6e34ef91a26 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 ccc5ff5d024d..8d495f5bc4e8 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 48e108de8d9b..1a23a86b1e4c 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 a2275f9457b6..f4c215d7103d 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 b3e1d030a4b6..588f6c47d2b8 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 60015fca55b9..b337d97a94c3 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 e83285d714f4..17d095d0f8c8 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 3b8563503979..01d3057f03ab 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 68415d6e620d..e917eb780525 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 9774d9f58dfe..28b78f86842c 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 7da4069b5b85..02f6ff5b449a 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 ececa58a314d..08921f256f02 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 bfaffdefda5a..32515da0be81 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 db2dce1b79f6..592e7add9239 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 af7dd3b50194..8a9dae8ab745 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 8d28f288d3c1..f6b7036fe367 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 10fda917984e..dd0a51e6ae5a 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 910664b0187a..bd03ce712f95 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 831e3255d842..0068554cecb1 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 cc66613ff52f..3e1c9d0a36c0 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 3038393c2266..5e674b35cb2f 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 c2e3831da255..dcde0fc3f7e4 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 f24eb8ebb0c6..f6b30259be73 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 b47c047f4623..c85d60f1164d 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 15dd6d3f505d..e2afbecdb42d 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 21eae687c67f..020449383e6c 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 0695d186bb5d..5df314c6dca8 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 5e4f5f5593a3..c271c342101a 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 a24886522cde..d174b0394926 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 391c7ffe8cb7..cda74cad42d0 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 a13240324e51..5044a08d727a 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 ac6e414beaa2..47e52456c204 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 3728808f9b6c..3e878e0024b2 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 708442604d91..f003b5f033f0 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 03039ad696ca..0224e9b0c863 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 ee3c91dbee67..18e5b0c1c2f7 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 27471add77fa..c3fb1a12cd16 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 c2829aed0e18..5eb5df385b82 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 7ce863d06f10..2ac21f2e0d1f 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 5fdfb47d490f..d28d3de8bff8 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 e48b864f497d..0174baabbb88 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 a6c9f0f1804e..fa29b1a759a6 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 a951c576fa44..7bbc555e2c52 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 765220799a50..236b11a6d7c7 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 5eae9b1a57fb..9cef79c71650 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 55a410632f98..4fafc4cda9d8 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 536aab385dfd..59bfbbe86ef6 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 860355024cc3..303aa5e5be49 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 e4d525272627..e534776f4790 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 ab1e569fae6a..8819638bef88 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 3c396529d654..04f8b919f5a6 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 a2fe4d86d650..b78c99d00e05 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 ac2bf9f2e783..70d0517a6f0e 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 8121ff154dd5..4889ee098f02 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 d82e3aad752a..042fdd106361 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 280325ace2c5..8ea89d11e061 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 910af94b7a48..ff9601ba62c5 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 2a76f6239b2b..de3e23a877c2 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 b97eccc15e38..455efc01dea3 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 6fbe92176045..c8071d81dbe0 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 601fb663b7b6..f83249ccf01a 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 17489372e464..e668e364f178 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 eac7c80f0328..c13c5d6c29ed 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 da1382683942..9b68cd2d25c3 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 3767063da0a6..a39de8114de2 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 eb552fadabda..cf6339dcadec 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 7e0bdd0524fe..fb18e3ad4aec 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 c4083877ebca..917f95cdd1ca 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 e1118f6f9ea9..a6ad55f4e269 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 84471fb6b20c..634469cdf4ac 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 aba1aeb9d82f..df604e41a681 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 62944048175a..a90cc08d297c 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 69b8a96ffcff..47b3e382ef7e 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 1134480f8def..cf840e8e93b3 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 6f0779157413..54554a8edd7c 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 0d7fa27bcc3d..ff3455a7ec31 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 7d0aa127d9db..8f269e591d0c 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 d2d0d3ff6d8e..87d60edf6ed9 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 7121fc758f4f..6fb7b3a9c8c0 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 3c8c88ee2aab..ab8e4db7d283 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 766e56c091e6..1301ee516944 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 1bd5c647f029..df1c2e459c41 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 fc3dc42bca41..581357df9944 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 63ac648b5439..291e84cf34b0 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 6df95714a9b1..0a65b8f46464 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 1fd0d48f3cc8..e73e7e0300aa 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 ecec2865fbae..c88887b45426 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 e7057383c565..6b287e06c890 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 73557eb7cc25..19edb4f31a11 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 def5ba6d5ea3..8ef866588197 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 6a8ca1f0419a..e62b824e5bc6 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 93eebf88691f..63dbbd9a736b 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 0e57c512b20f..d72df2d4dff3 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 703ca5de0fea..3c98da23e019 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 a9e8396959d1..934b24a29dde 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 24bf3c37f584..ef66b30ecb4e 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 deef49859a3e..006e56c3ddb1 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 f74c5a1eb760..da88f0b149ab 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 c0e735656907..6d0201bfb2aa 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 8198ec4050ad..5fa68caf7534 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 af4b4fda2a3a..ffcf4027f055 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 51260aec6b17..08790bb25ce2 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 c65c584f8600..3584b6e76c52 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 a8cb343be59f..21a3b923bf85 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 bf004f35294e..a019969a4711 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 a67a37ef7edd..22304ce73187 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 fbdd2c006de0..38dd57ec0bff 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 48f93d43d1ef..15748d423d9e 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 abd5db47a818..fdf3a09de0b1 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 6287fc85c0a6..9b0b5920d814 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 e44f58343a5d..8e4a6c6c5f03 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 b80d08aa5467..7815db75ae37 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 300ac9a3232a..6d3d61d1f290 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 03abaffb4d84..cb7a5cec60f7 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 512de68dc5ff..ba146a01aa69 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 6d24d8ddc6cb..2dfcb103237e 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 5022cbdde78a..464973de32c3 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 e7b447d8045d..8382c823f06a 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 41c228338990..e520793eea64 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 298c11ed0a21..d292ad35b975 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); diff --git a/contrib/ncurses/panel/Makefile.in b/contrib/ncurses/panel/Makefile.in index 9b8092d22ac9..6780007e31bd 100644 --- a/contrib/ncurses/panel/Makefile.in +++ b/contrib/ncurses/panel/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.34 2000/08/26 21:51:28 tom Exp $ +# $Id: Makefile.in,v 1.36 2001/03/24 19:53:31 tom Exp $ ############################################################################## -# Copyright (c) 1998-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"), # @@ -54,6 +54,8 @@ libdir = @libdir@ includedir = @includedir@ datadir = @datadir@ +LIBTOOL = @LIBTOOL@ + INSTALL = @INSTALL@ INSTALL_LIB = @INSTALL@ @INSTALL_LIB@ INSTALL_DATA = @INSTALL_DATA@ @@ -73,6 +75,7 @@ CPPFLAGS = @CPPFLAGS@ \ CCFLAGS = $(CPPFLAGS) $(CFLAGS) +CFLAGS_LIBTOOL = $(CCFLAGS) CFLAGS_NORMAL = $(CCFLAGS) CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE CFLAGS_PROFILE = $(CCFLAGS) -pg @@ -80,7 +83,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) @@ -88,6 +91,8 @@ SHLIB_LIST = $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_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@ @@ -129,7 +134,7 @@ tags: @MAKE_UPPER_TAGS@ etags *.[ch] mostlyclean :: - -rm -f core tags TAGS *~ *.ln *.atac trace + -rm -f core tags TAGS *~ *.i *.ln *.atac trace clean :: mostlyclean -rm -f $(AUTO_SRC) diff --git a/contrib/ncurses/panel/p_above.c b/contrib/ncurses/panel/p_above.c index fa32196db42b..36e67d2b43df 100644 --- a/contrib/ncurses/panel/p_above.c +++ b/contrib/ncurses/panel/p_above.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,10 +35,10 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_above.c,v 1.3 1999/09/18 11:03:28 juergen Exp $") +MODULE_ID("$Id: p_above.c,v 1.4 2000/12/10 02:20:44 tom Exp $") -PANEL* -panel_above(const PANEL *pan) +NCURSES_EXPORT(PANEL *) +panel_above (const PANEL *pan) { if(!pan) { diff --git a/contrib/ncurses/panel/p_below.c b/contrib/ncurses/panel/p_below.c index a7eb4705789e..5420ff9eeb66 100644 --- a/contrib/ncurses/panel/p_below.c +++ b/contrib/ncurses/panel/p_below.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,10 +35,10 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_below.c,v 1.3 1999/09/18 11:03:33 juergen Exp $") +MODULE_ID("$Id: p_below.c,v 1.4 2000/12/10 02:20:44 tom Exp $") -PANEL* -panel_below(const PANEL *pan) +NCURSES_EXPORT(PANEL*) +panel_below (const PANEL *pan) { if(!pan) { diff --git a/contrib/ncurses/panel/p_bottom.c b/contrib/ncurses/panel/p_bottom.c index f671864231db..0928e77eb828 100644 --- a/contrib/ncurses/panel/p_bottom.c +++ b/contrib/ncurses/panel/p_bottom.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,10 +36,10 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_bottom.c,v 1.7 1999/11/25 13:49:26 juergen Exp $") +MODULE_ID("$Id: p_bottom.c,v 1.9 2001/02/24 23:46:33 tom Exp $") -int -bottom_panel(PANEL *pan) +NCURSES_EXPORT(int) +bottom_panel (PANEL *pan) { int err = OK; @@ -49,7 +49,7 @@ bottom_panel(PANEL *pan) dBug(("--> bottom_panel %s", USER_PTR(pan->user))); - HIDE_PANEL(pan,err,FALSE); + HIDE_PANEL(pan,err,OK); assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); dStack("<lb%d>",1,pan); diff --git a/contrib/ncurses/panel/p_delete.c b/contrib/ncurses/panel/p_delete.c index 3f975d3b3e89..1d4670effc06 100644 --- a/contrib/ncurses/panel/p_delete.c +++ b/contrib/ncurses/panel/p_delete.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,16 +36,16 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_delete.c,v 1.4 1999/11/25 13:49:26 juergen Exp $") +MODULE_ID("$Id: p_delete.c,v 1.6 2001/02/24 23:46:41 tom Exp $") -int -del_panel(PANEL *pan) +NCURSES_EXPORT(int) +del_panel (PANEL *pan) { int err = OK; if(pan) { dBug(("--> del_panel %s", USER_PTR(pan->user))); - HIDE_PANEL(pan,err,FALSE); + HIDE_PANEL(pan,err,OK); free((void *)pan); } else diff --git a/contrib/ncurses/panel/p_hidden.c b/contrib/ncurses/panel/p_hidden.c index 7a13ec4335df..d5d13f37a5ef 100644 --- a/contrib/ncurses/panel/p_hidden.c +++ b/contrib/ncurses/panel/p_hidden.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,10 +36,10 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_hidden.c,v 1.4 1999/11/22 18:02:41 juergen Exp $") +MODULE_ID("$Id: p_hidden.c,v 1.5 2000/12/10 02:20:44 tom Exp $") -int -panel_hidden(const PANEL *pan) +NCURSES_EXPORT(int) +panel_hidden (const PANEL *pan) { if(!pan) return(ERR); diff --git a/contrib/ncurses/panel/p_hide.c b/contrib/ncurses/panel/p_hide.c index ecc9eed2226f..755997374136 100644 --- a/contrib/ncurses/panel/p_hide.c +++ b/contrib/ncurses/panel/p_hide.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,10 +36,10 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_hide.c,v 1.5 1999/11/25 13:49:26 juergen Exp $") +MODULE_ID("$Id: p_hide.c,v 1.7 2001/02/24 23:46:45 tom Exp $") -int -hide_panel(register PANEL *pan) +NCURSES_EXPORT(int) +hide_panel (register PANEL *pan) { int err = OK; @@ -49,7 +49,7 @@ hide_panel(register PANEL *pan) dBug(("--> hide_panel %s", USER_PTR(pan->user))); dStack("<u%d>",1,pan); - HIDE_PANEL(pan,err,TRUE); + HIDE_PANEL(pan,err,ERR); dStack("<u%d>",9,pan); diff --git a/contrib/ncurses/panel/p_move.c b/contrib/ncurses/panel/p_move.c index d34b4fb84e56..d7dbd2eafc3f 100644 --- a/contrib/ncurses/panel/p_move.c +++ b/contrib/ncurses/panel/p_move.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,16 +36,18 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_move.c,v 1.5 1999/11/25 13:49:26 juergen Exp $") +MODULE_ID("$Id: p_move.c,v 1.7 2001/02/24 23:41:35 tom Exp $") -int -move_panel(PANEL *pan, int starty, int startx) +NCURSES_EXPORT(int) +move_panel (PANEL *pan, int starty, int startx) { if(!pan) return(ERR); - if (IS_LINKED(pan)) - PANEL_UPDATE(pan,(PANEL*)0, TRUE); + if (IS_LINKED(pan)) { + Touchpan(pan); + PANEL_UPDATE(pan,(PANEL*)0); + } if (mvwin(pan->win,starty,startx)) return(ERR); diff --git a/contrib/ncurses/panel/p_new.c b/contrib/ncurses/panel/p_new.c index 43542fea2154..3dfd80691704 100644 --- a/contrib/ncurses/panel/p_new.c +++ b/contrib/ncurses/panel/p_new.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,7 +36,7 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_new.c,v 1.5 1999/11/22 18:02:41 juergen Exp $") +MODULE_ID("$Id: p_new.c,v 1.6 2000/12/10 02:20:44 tom Exp $") #ifdef TRACE static char* stdscr_id; @@ -74,8 +74,8 @@ root_panel(void) return _nc_stdscr_pseudo_panel; } -PANEL * -new_panel(WINDOW *win) +NCURSES_EXPORT(PANEL *) +new_panel (WINDOW *win) { PANEL *pan = (PANEL*)0; diff --git a/contrib/ncurses/panel/p_replace.c b/contrib/ncurses/panel/p_replace.c index b7d51746610f..a3b88cbfa88e 100644 --- a/contrib/ncurses/panel/p_replace.c +++ b/contrib/ncurses/panel/p_replace.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,16 +36,18 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_replace.c,v 1.5 1999/11/25 13:49:26 juergen Exp $") +MODULE_ID("$Id: p_replace.c,v 1.7 2001/02/24 23:41:38 tom Exp $") -int -replace_panel(PANEL *pan, WINDOW *win) +NCURSES_EXPORT(int) +replace_panel (PANEL *pan, WINDOW *win) { if(!pan) return(ERR); - if (IS_LINKED(pan)) - PANEL_UPDATE(pan,(PANEL*)0, TRUE); + if (IS_LINKED(pan)) { + Touchpan(pan); + PANEL_UPDATE(pan,(PANEL*)0); + } pan->win = win; diff --git a/contrib/ncurses/panel/p_show.c b/contrib/ncurses/panel/p_show.c index 4fc7b1dbcba1..0e1968fdea58 100644 --- a/contrib/ncurses/panel/p_show.c +++ b/contrib/ncurses/panel/p_show.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,10 +36,10 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_show.c,v 1.7 1999/11/25 13:49:26 juergen Exp $") +MODULE_ID("$Id: p_show.c,v 1.9 2001/02/24 23:46:50 tom Exp $") -int -show_panel(PANEL *pan) +NCURSES_EXPORT(int) +show_panel (PANEL *pan) { int err = OK; @@ -51,7 +51,7 @@ show_panel(PANEL *pan) dBug(("--> show_panel %s", USER_PTR(pan->user))); - HIDE_PANEL(pan,err,FALSE); + HIDE_PANEL(pan,err,OK); dStack("<lt%d>",1,pan); assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); diff --git a/contrib/ncurses/panel/p_top.c b/contrib/ncurses/panel/p_top.c index 2ce5bb3e6695..aa7d9d420e5e 100644 --- a/contrib/ncurses/panel/p_top.c +++ b/contrib/ncurses/panel/p_top.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,10 +36,10 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_top.c,v 1.2 1998/02/11 12:14:01 tom Exp $") +MODULE_ID("$Id: p_top.c,v 1.3 2000/12/10 02:20:44 tom Exp $") -int -top_panel(PANEL *pan) +NCURSES_EXPORT(int) +top_panel (PANEL *pan) { return(show_panel(pan)); } diff --git a/contrib/ncurses/panel/p_update.c b/contrib/ncurses/panel/p_update.c index 983d0b607288..1a03739d14af 100644 --- a/contrib/ncurses/panel/p_update.c +++ b/contrib/ncurses/panel/p_update.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,10 +36,10 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_update.c,v 1.5 1999/11/25 13:49:26 juergen Exp $") +MODULE_ID("$Id: p_update.c,v 1.7 2001/02/24 23:41:42 tom Exp $") -void -update_panels(void) +NCURSES_EXPORT(void) +update_panels (void) { PANEL *pan; @@ -47,7 +47,7 @@ update_panels(void) pan = _nc_bottom_panel; while(pan && pan->above) { - PANEL_UPDATE(pan,pan->above, FALSE); + PANEL_UPDATE(pan,pan->above); pan = pan->above; } diff --git a/contrib/ncurses/panel/p_user.c b/contrib/ncurses/panel/p_user.c index 28b6526bb41c..de1ec7dd84c2 100644 --- a/contrib/ncurses/panel/p_user.c +++ b/contrib/ncurses/panel/p_user.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,10 +36,11 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_user.c,v 1.3 1998/02/11 12:14:01 tom Exp $") +MODULE_ID("$Id: p_user.c,v 1.4 2000/12/10 02:20:44 tom Exp $") -int -set_panel_userptr(PANEL *pan, NCURSES_CONST void *uptr) +NCURSES_EXPORT(int) +set_panel_userptr +(PANEL *pan, NCURSES_CONST void *uptr) { if(!pan) return(ERR); @@ -47,8 +48,8 @@ set_panel_userptr(PANEL *pan, NCURSES_CONST void *uptr) return(OK); } -NCURSES_CONST void* -panel_userptr(const PANEL *pan) +NCURSES_EXPORT(NCURSES_CONST void*) +panel_userptr (const PANEL *pan) { return(pan ? pan->user : (NCURSES_CONST void *)0); } diff --git a/contrib/ncurses/panel/p_win.c b/contrib/ncurses/panel/p_win.c index 9c5a313de36f..2b9f5b0c8297 100644 --- a/contrib/ncurses/panel/p_win.c +++ b/contrib/ncurses/panel/p_win.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,10 +36,10 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_win.c,v 1.2 1998/02/11 12:14:01 tom Exp $") +MODULE_ID("$Id: p_win.c,v 1.3 2000/12/10 02:20:43 tom Exp $") -WINDOW* -panel_window(const PANEL *pan) +NCURSES_EXPORT(WINDOW *) +panel_window (const PANEL *pan) { return(pan ? pan->win : (WINDOW *)0); } diff --git a/contrib/ncurses/panel/panel.c b/contrib/ncurses/panel/panel.c index 1b79b77f147e..a56d57ef5ea8 100644 --- a/contrib/ncurses/panel/panel.c +++ b/contrib/ncurses/panel/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 * @@ -34,11 +34,12 @@ /* panel.c -- implementation of panels library, some core routines */ #include "panel.priv.h" -MODULE_ID("$Id: panel.c,v 1.18 1999/09/29 15:22:32 juergen Exp $") +MODULE_ID("$Id: panel.c,v 1.20 2001/02/24 23:17:26 tom Exp $") #ifdef TRACE #ifndef TRACE_TXT -const char *_nc_my_visbuf(const void *ptr) +NCURSES_EXPORT(const char *) +_nc_my_visbuf (const void *ptr) { char temp[32]; if (ptr != 0) @@ -55,8 +56,9 @@ const char *_nc_my_visbuf(const void *ptr) dPanel(text,pan) --------------------------------------------------------------------------*/ #ifdef TRACE -void -_nc_dPanel(const char *text, const PANEL *pan) +NCURSES_EXPORT(void) +_nc_dPanel +(const char *text, const PANEL *pan) { _tracef("%s id=%s b=%s a=%s y=%d x=%d", text, USER_PTR(pan->user), @@ -70,8 +72,9 @@ _nc_dPanel(const char *text, const PANEL *pan) dStack(fmt,num,pan) --------------------------------------------------------------------------*/ #ifdef TRACE -void -_nc_dStack(const char *fmt, int num, const PANEL *pan) +NCURSES_EXPORT(void) +_nc_dStack +(const char *fmt, int num, const PANEL *pan) { char s80[80]; @@ -94,8 +97,8 @@ _nc_dStack(const char *fmt, int num, const PANEL *pan) Wnoutrefresh(pan) - debugging hook for wnoutrefresh --------------------------------------------------------------------------*/ #ifdef TRACE -void -_nc_Wnoutrefresh(const PANEL *pan) +NCURSES_EXPORT(void) +_nc_Wnoutrefresh (const PANEL *pan) { dPanel("wnoutrefresh",pan); wnoutrefresh(pan->win); @@ -106,8 +109,8 @@ _nc_Wnoutrefresh(const PANEL *pan) Touchpan(pan) --------------------------------------------------------------------------*/ #ifdef TRACE -void -_nc_Touchpan(const PANEL *pan) +NCURSES_EXPORT(void) +_nc_Touchpan (const PANEL *pan) { dPanel("Touchpan",pan); touchwin(pan->win); @@ -118,8 +121,9 @@ _nc_Touchpan(const PANEL *pan) Touchline(pan,start,count) --------------------------------------------------------------------------*/ #ifdef TRACE -void -_nc_Touchline(const PANEL *pan, int start, int count) +NCURSES_EXPORT(void) +_nc_Touchline +(const PANEL *pan, int start, int count) { char s80[80]; sprintf(s80,"Touchline s=%d c=%d",start,count); @@ -131,6 +135,6 @@ _nc_Touchline(const PANEL *pan, int start, int count) #ifndef TRACE # ifndef __GNUC__ /* Some C compilers need something defined in a source file */ - static char GCC_UNUSED dummy; + void _nc_dummy_panel(void) { } # endif #endif diff --git a/contrib/ncurses/panel/panel.h b/contrib/ncurses/panel/panel.h index dc33071ba175..3b8542a7adce 100644 --- a/contrib/ncurses/panel/panel.h +++ b/contrib/ncurses/panel/panel.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 * @@ -33,8 +33,8 @@ /* panel.h -- interface file for panels library */ -#ifndef _PANEL_H -#define _PANEL_H +#ifndef NCURSES_PANEL_H_incl +#define NCURSES_PANEL_H_incl 1 #include <curses.h> @@ -50,26 +50,26 @@ typedef struct panel extern "C" { #endif -extern WINDOW* panel_window(const PANEL *); -extern void update_panels(void); -extern int hide_panel(PANEL *); -extern int show_panel(PANEL *); -extern int del_panel(PANEL *); -extern int top_panel(PANEL *); -extern int bottom_panel(PANEL *); -extern PANEL* new_panel(WINDOW *); -extern PANEL* panel_above(const PANEL *); -extern PANEL* panel_below(const PANEL *); -extern int set_panel_userptr(PANEL *, NCURSES_CONST void *); -extern NCURSES_CONST void* panel_userptr(const PANEL *); -extern int move_panel(PANEL *, int, int); -extern int replace_panel(PANEL *,WINDOW *); -extern int panel_hidden(const PANEL *); +extern NCURSES_EXPORT(WINDOW*) panel_window (const PANEL *); +extern NCURSES_EXPORT(void) update_panels (void); +extern NCURSES_EXPORT(int) hide_panel (PANEL *); +extern NCURSES_EXPORT(int) show_panel (PANEL *); +extern NCURSES_EXPORT(int) del_panel (PANEL *); +extern NCURSES_EXPORT(int) top_panel (PANEL *); +extern NCURSES_EXPORT(int) bottom_panel (PANEL *); +extern NCURSES_EXPORT(PANEL*) new_panel (WINDOW *); +extern NCURSES_EXPORT(PANEL*) panel_above (const PANEL *); +extern NCURSES_EXPORT(PANEL*) panel_below (const PANEL *); +extern NCURSES_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *); +extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *); +extern NCURSES_EXPORT(int) move_panel (PANEL *, int, int); +extern NCURSES_EXPORT(int) replace_panel (PANEL *,WINDOW *); +extern NCURSES_EXPORT(int) panel_hidden (const PANEL *); #if defined(__cplusplus) } #endif -#endif /* _PANEL_H */ +#endif /* NCURSES_PANEL_H_incl */ /* end of panel.h */ diff --git a/contrib/ncurses/panel/panel.priv.h b/contrib/ncurses/panel/panel.priv.h index f5a4798f0e0f..d029b1212c83 100644 --- a/contrib/ncurses/panel/panel.priv.h +++ b/contrib/ncurses/panel/panel.priv.h @@ -26,10 +26,10 @@ * authorization. * ****************************************************************************/ -/* $Id: panel.priv.h,v 1.14 2000/09/02 18:22:23 tom Exp $ */ +/* $Id: panel.priv.h,v 1.18 2001/03/24 21:38:45 tom Exp $ */ -#ifndef _PANEL_PRIV_H -#define _PANEL_PRIV_H +#ifndef NCURSES_PANEL_PRIV_H +#define NCURSES_PANEL_PRIV_H 1 #if HAVE_CONFIG_H # include <ncurses_cfg.h> @@ -47,8 +47,8 @@ # include <dbmalloc.h> /* Conor Cahill's library */ #endif -#include <nc_panel.h> #include "panel.h" +#include <nc_panel.h> #if ( CC_HAS_INLINE_FUNCS && !defined(TRACE) ) # define INLINE inline @@ -64,18 +64,18 @@ #ifdef TRACE - extern const char *_nc_my_visbuf(const void *); + extern NCURSES_EXPORT(const char *) _nc_my_visbuf (const void *); # ifdef TRACE_TXT # define USER_PTR(ptr) _nc_visbuf((const char *)ptr) # else # define USER_PTR(ptr) _nc_my_visbuf((const char *)ptr) # endif - extern void _nc_dPanel(const char*, const PANEL*); - extern void _nc_dStack(const char*, int, const PANEL*); - extern void _nc_Wnoutrefresh(const PANEL*); - extern void _nc_Touchpan(const PANEL*); - extern void _nc_Touchline(const PANEL*, int, int); + extern NCURSES_EXPORT(void) _nc_dPanel (const char*, const PANEL*); + extern NCURSES_EXPORT(void) _nc_dStack (const char*, int, const PANEL*); + extern NCURSES_EXPORT(void) _nc_Wnoutrefresh (const PANEL*); + extern NCURSES_EXPORT(void) _nc_Touchpan (const PANEL*); + extern NCURSES_EXPORT(void) _nc_Touchline (const PANEL*, int, int); # define dBug(x) _tracef x # define dPanel(text,pan) _nc_dPanel(text,pan) @@ -150,10 +150,8 @@ If the "touch" flag is set, the panel gets touched before it is updated. ---------------------------------------------------------------------------*/ -#define PANEL_UPDATE(pan,panstart,touch)\ +#define PANEL_UPDATE(pan,panstart)\ { PANEL* pan2 = ((panstart) ? (panstart) : _nc_bottom_panel);\ - if (touch)\ - Touchpan(pan);\ while(pan2) {\ if ((pan2 != pan) && PANELS_OVERLAPPED(pan,pan2)) {\ int y,ix1,ix2,iy1,iy2;\ @@ -192,12 +190,12 @@ #define HIDE_PANEL(pan,err,err_if_unlinked)\ if (IS_LINKED(pan)) {\ - PANEL_UPDATE(pan,(PANEL*)0,TRUE);\ + Touchpan(pan);\ + PANEL_UPDATE(pan,(PANEL*)0);\ PANEL_UNLINK(pan,err);\ } \ else {\ - if (err_if_unlinked)\ - err = ERR;\ + err = err_if_unlinked;\ } -#endif /* _PANEL_PRIV_H */ +#endif /* NCURSES_PANEL_PRIV_H */ diff --git a/contrib/ncurses/progs/Makefile.in b/contrib/ncurses/progs/Makefile.in index 8898c149f36f..f0d772ad3494 100644 --- a/contrib/ncurses/progs/Makefile.in +++ b/contrib/ncurses/progs/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.49 2000/09/30 23:08:58 tom Exp $ +# $Id: Makefile.in,v 1.52 2001/03/24 19:53:31 tom Exp $ ############################################################################## -# Copyright (c) 1998-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"), # @@ -59,6 +59,8 @@ libdir = @libdir@ includedir = @includedir@ datadir = @datadir@ +LIBTOOL = @LIBTOOL@ + INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ transform = @program_transform_name@ @@ -76,6 +78,7 @@ CPPFLAGS = -I../progs -I$(srcdir) @CPPFLAGS@ \ CCFLAGS = $(CPPFLAGS) $(CFLAGS) +CFLAGS_LIBTOOL = $(CCFLAGS) CFLAGS_NORMAL = $(CCFLAGS) CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE CFLAGS_PROFILE = $(CCFLAGS) -pg @@ -84,10 +87,11 @@ CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) LD = @LD@ -LINK = @LINK_PROGS@ $(CC) +LINK = @LINK_PROGS@ $(LIBTOOL) $(CC) LDFLAGS = @EXTRA_LDFLAGS@ \ @PROG_ARGS@ @LDFLAGS@ @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ +LDFLAGS_LIBTOOL = $(LDFLAGS) LDFLAGS_NORMAL = $(LDFLAGS) LDFLAGS_DEBUG = $(LDFLAGS) @CC_G_OPT@ LDFLAGS_PROFILE = $(LDFLAGS) -pg @@ -143,12 +147,12 @@ transform.h : echo "#define PROG_INIT \"$(actual_init)\"" >>$@ install.progs: $(AUTO_SRC) $(PROGS) $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) tic$x $(DESTDIR)$(bindir)/$(actual_tic) - $(INSTALL_PROGRAM) toe$x $(DESTDIR)$(bindir)/$(actual_toe) - $(INSTALL_PROGRAM) infocmp$x $(DESTDIR)$(bindir)/$(actual_infocmp) - $(INSTALL_PROGRAM) clear$x $(DESTDIR)$(bindir)/$(actual_clear) - $(INSTALL_PROGRAM) tput$x $(DESTDIR)$(bindir)/$(actual_tput) - $(INSTALL_PROGRAM) tset$x $(DESTDIR)$(bindir)/$(actual_tset) + $(LIBTOOL) $(INSTALL_PROGRAM) tic$x $(DESTDIR)$(bindir)/$(actual_tic) + $(LIBTOOL) $(INSTALL_PROGRAM) toe$x $(DESTDIR)$(bindir)/$(actual_toe) + $(LIBTOOL) $(INSTALL_PROGRAM) infocmp$x $(DESTDIR)$(bindir)/$(actual_infocmp) + $(LIBTOOL) $(INSTALL_PROGRAM) clear$x $(DESTDIR)$(bindir)/$(actual_clear) + $(LIBTOOL) $(INSTALL_PROGRAM) tput$x $(DESTDIR)$(bindir)/$(actual_tput) + $(LIBTOOL) $(INSTALL_PROGRAM) tset$x $(DESTDIR)$(bindir)/$(actual_tset) @echo "linking $(actual_captoinfo) to $(actual_tic)" -@rm -f $(DESTDIR)$(bindir)/$(actual_captoinfo) (cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_captoinfo)) @@ -160,12 +164,12 @@ install.progs: $(AUTO_SRC) $(PROGS) $(DESTDIR)$(bindir) (cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tset) $(actual_reset)) uninstall.progs: - -@rm -f $(DESTDIR)$(bindir)/$(actual_tic) - -@rm -f $(DESTDIR)$(bindir)/$(actual_toe) - -@rm -f $(DESTDIR)$(bindir)/$(actual_infocmp) - -@rm -f $(DESTDIR)$(bindir)/$(actual_clear) - -@rm -f $(DESTDIR)$(bindir)/$(actual_tput) - -@rm -f $(DESTDIR)$(bindir)/$(actual_tset) + -@$(LIBTOOL) rm -f $(DESTDIR)$(bindir)/$(actual_tic) + -@$(LIBTOOL) rm -f $(DESTDIR)$(bindir)/$(actual_toe) + -@$(LIBTOOL) rm -f $(DESTDIR)$(bindir)/$(actual_infocmp) + -@$(LIBTOOL) rm -f $(DESTDIR)$(bindir)/$(actual_clear) + -@$(LIBTOOL) rm -f $(DESTDIR)$(bindir)/$(actual_tput) + -@$(LIBTOOL) rm -f $(DESTDIR)$(bindir)/$(actual_tset) -@rm -f $(DESTDIR)$(bindir)/$(actual_captoinfo) -@rm -f $(DESTDIR)$(bindir)/$(actual_infotocap) -@rm -f $(DESTDIR)$(bindir)/$(actual_reset) @@ -231,12 +235,13 @@ 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 $(TESTPROGS) clean :: mostlyclean -rm -f $(AUTO_SRC) -rm -f $(PROGS) + -rm -rf .libs distclean :: clean -rm -f Makefile diff --git a/contrib/ncurses/progs/dump_entry.c b/contrib/ncurses/progs/dump_entry.c index 60c88d3f9cab..4320c09b6de0 100644 --- a/contrib/ncurses/progs/dump_entry.c +++ b/contrib/ncurses/progs/dump_entry.c @@ -38,7 +38,7 @@ #include "termsort.c" /* this C file is generated */ #include <parametrized.h> /* so is this */ -MODULE_ID("$Id: dump_entry.c,v 1.54 2000/10/01 01:34:06 tom Exp $") +MODULE_ID("$Id: dump_entry.c,v 1.55 2001/03/10 19:45:51 tom Exp $") #define INDENT 8 #define DISCARD(string) string = ABSENT_STRING @@ -773,7 +773,7 @@ fmt_entry(TERMTYPE * tterm, * It gives an idea of which entries are deadly to even *scan past*, * as opposed to *use*. */ - return (infodump ? len : termcap_length(outbuf.text)); + return (infodump ? len : (int) termcap_length(outbuf.text)); } int diff --git a/contrib/ncurses/progs/infocmp.c b/contrib/ncurses/progs/infocmp.c index bf7ff1c54b07..5d1a11113493 100644 --- a/contrib/ncurses/progs/infocmp.c +++ b/contrib/ncurses/progs/infocmp.c @@ -41,7 +41,7 @@ #include <term_entry.h> #include <dump_entry.h> -MODULE_ID("$Id: infocmp.c,v 1.57 2000/10/01 01:26:25 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.60 2001/02/24 22:03:12 tom Exp $") #define L_CURL "{" #define R_CURL "}" @@ -710,7 +710,6 @@ file_comparison(int argc, char *argv[]) /* someday we may allow comparisons on more files */ int filecount = 0; ENTRY *heads[MAXCOMPARE]; - ENTRY *tails[MAXCOMPARE]; ENTRY *qp, *rp; int i, n; @@ -744,7 +743,6 @@ file_comparison(int argc, char *argv[]) } heads[filecount] = _nc_head; - tails[filecount] = _nc_tail; filecount++; } @@ -949,7 +947,7 @@ name_initializer(const char *type) (void) sprintf(initializer, "%s_data_%s", type, entries->tterm.term_names); for (s = initializer; *s != 0 && *s != '|'; s++) { - if (!isalnum(*s)) + if (!isalnum(CharOf(*s))) *s = '_'; } *s = 0; @@ -1029,10 +1027,13 @@ dump_initializers(TERMTYPE * term) for (sp = term->Strings[n]; *sp != 0 && (tp - buf) < MAX_STRING - 6; sp++) { - if (isascii(*sp) && isprint(*sp) && *sp != '\\' && *sp != '"') + if (isascii(CharOf(*sp)) + && isprint(CharOf(*sp)) + && *sp != '\\' + && *sp != '"') *tp++ = *sp; else { - (void) sprintf(tp, "\\%03o", *sp & 0xff); + (void) sprintf(tp, "\\%03o", CharOf(*sp)); tp += 4; } } diff --git a/contrib/ncurses/progs/progs.priv.h b/contrib/ncurses/progs/progs.priv.h index d704c0989b33..18262759f3c3 100644 --- a/contrib/ncurses/progs/progs.priv.h +++ b/contrib/ncurses/progs/progs.priv.h @@ -30,7 +30,7 @@ * Author: Thomas E. Dickey <dickey@clark.net> 1997,1998 * ****************************************************************************/ /* - * $Id: progs.priv.h,v 1.24 2000/10/01 01:33:34 tom Exp $ + * $Id: progs.priv.h,v 1.26 2000/11/05 00:22:05 tom Exp $ * * progs.priv.h * @@ -165,10 +165,12 @@ extern int optind; #if !HAVE_ISASCII # undef isascii # if ('z'-'a' == 25) && ('z' < 127) && ('Z'-'A' == 25) && ('Z' < 127) && ('9' < 127) -# define isascii(c) (((c) & 0xff) <= 127) +# define isascii(c) (CharOf(c) <= 127) # else # define isascii(c) 1 /* not really ascii anyway */ # endif #endif +#define CharOf(c) ((unsigned char)(c)) + #define SIZEOF(v) (sizeof(v)/sizeof(v[0])) diff --git a/contrib/ncurses/progs/tic.c b/contrib/ncurses/progs/tic.c index 9ab0f10776d0..c74afc36ab89 100644 --- a/contrib/ncurses/progs/tic.c +++ b/contrib/ncurses/progs/tic.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 * @@ -44,7 +44,7 @@ #include <term_entry.h> #include <transform.h> -MODULE_ID("$Id: tic.c,v 1.82 2000/10/01 02:11:39 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.90 2001/04/15 00:21:31 tom Exp $") const char *_nc_progname = "tic"; @@ -52,6 +52,7 @@ static FILE *log_fp; static FILE *tmp_fp; static bool showsummary = FALSE; static const char *to_remove; +static int tparm_errs; static void (*save_check_termtype) (TERMTYPE *); static void check_termtype(TERMTYPE * tt); @@ -292,12 +293,12 @@ put_translate(int c) static char * stripped(char *src) { - while (isspace(*src)) + while (isspace(CharOf(*src))) src++; if (*src != '\0') { char *dst = strcpy(malloc(strlen(src) + 1), src); size_t len = strlen(dst); - while (--len != 0 && isspace(dst[len])) + while (--len != 0 && isspace(CharOf(dst[len]))) dst[len] = '\0'; return dst; } @@ -705,7 +706,7 @@ main(int argc, char *argv[]) printf("# length=%d\n", len); } } - if (!namelst) { + if (!namelst && _nc_tail) { int c, oldc = '\0'; bool in_comment = FALSE; bool trailing_comment = FALSE; @@ -761,27 +762,29 @@ TERMINAL *cur_term; /* tweak to avoid linking lib_cur_term.c */ * Returns the expected number of parameters for the given capability. */ static int -expected_params(char *name) +expected_params(const char *name) { /* *INDENT-OFF* */ static const struct { const char *name; int count; } table[] = { + { "S0", 1 }, /* 'screen' extension */ { "birep", 2 }, { "chr", 1 }, { "colornm", 1 }, { "cpi", 1 }, + { "csnm", 1 }, { "csr", 2 }, { "cub", 1 }, { "cud", 1 }, { "cuf", 1 }, { "cup", 2 }, - { "cvr", 1 }, { "cuu", 1 }, + { "cvr", 1 }, { "cwin", 5 }, { "dch", 1 }, - { "dclk", 2 }, + { "defc", 3 }, { "dial", 1 }, { "dispc", 1 }, { "dl", 1 }, @@ -803,11 +806,13 @@ expected_params(char *name) { "pfxl", 3 }, { "pln", 2 }, { "qdial", 1 }, + { "rcsd", 1 }, { "rep", 2 }, { "rin", 1 }, { "sclk", 3 }, { "scp", 1 }, { "scs", 1 }, + { "scsd", 2 }, { "setab", 1 }, { "setaf", 1 }, { "setb", 1 }, @@ -822,7 +827,7 @@ expected_params(char *name) { "smglr", 2 }, { "smgrp", 1 }, { "smgtb", 2 }, - { "smgtp", 2 }, + { "smgtp", 1 }, { "tsl", 1 }, { "u6", -1 }, { "vpa", 1 }, @@ -850,7 +855,7 @@ expected_params(char *name) * markers. */ static void -check_params(TERMTYPE * tp, char *name, char *value) +check_params(TERMTYPE * tp, const char *name, char *value) { int expected = expected_params(name); int actual = 0; @@ -907,8 +912,15 @@ similar_sgr(char *a, char *b) { while (*b != 0) { while (*a != *b) { - if (*a == 0) + if (*a == 0) { + if (b[0] == '$' + && b[1] == '<') { + _nc_warning("Did not find delay %s", _nc_visbuf(b)); + } else { + _nc_warning("Unmatched portion %s", _nc_visbuf(b)); + } return FALSE; + } a++; } a++; @@ -930,6 +942,7 @@ check_sgr(TERMTYPE * tp, char *zero, int num, char *cap, const char *name) num == 7, num == 8, num == 9); + tparm_errs += _nc_tparm_err; if (test != 0) { if (PRESENT(cap)) { if (!similar_sgr(test, cap)) { @@ -1030,6 +1043,7 @@ check_termtype(TERMTYPE * tp) ANDMISSING(change_scroll_region, save_cursor); ANDMISSING(change_scroll_region, restore_cursor); + tparm_errs = 0; if (PRESENT(set_attributes)) { char *zero = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, 0); @@ -1044,6 +1058,8 @@ check_termtype(TERMTYPE * tp) CHECK_SGR(8, enter_protected_mode); CHECK_SGR(9, enter_alt_charset_mode); free(zero); + if (tparm_errs) + _nc_warning("stack error in sgr string"); } /* diff --git a/contrib/ncurses/progs/tput.c b/contrib/ncurses/progs/tput.c index a72a2e892fdf..7aab90908a40 100644 --- a/contrib/ncurses/progs/tput.c +++ b/contrib/ncurses/progs/tput.c @@ -45,7 +45,7 @@ #endif #include <transform.h> -MODULE_ID("$Id: tput.c,v 1.24 2000/10/05 00:05:04 tom Exp $") +MODULE_ID("$Id: tput.c,v 1.26 2001/03/24 21:59:48 tom Exp $") #define PUTS(s) fputs(s, stdout) #define PUTCHAR(c) putchar(c) @@ -96,7 +96,7 @@ check_aliases(const char *name) * in tparm() to decide how to parse the varargs list. */ static TParams -tparm_type(char *name) +tparm_type(const char *name) { #define TD(code, longname, ti, tc) {code,longname},{code,ti},{code,tc} TParams result = Numbers; @@ -376,7 +376,7 @@ main(int argc, char **argv) /* crack the argument list into a dope vector */ for (cp = buf; *cp; cp++) { - if (isspace(*cp)) + if (isspace(CharOf(*cp))) *cp = '\0'; else if (cp == buf || cp[-1] == 0) argvec[argnum++] = cp; diff --git a/contrib/ncurses/progs/tset.c b/contrib/ncurses/progs/tset.c index d8dbda4974f5..f6e02dbb2f99 100644 --- a/contrib/ncurses/progs/tset.c +++ b/contrib/ncurses/progs/tset.c @@ -103,7 +103,7 @@ char *ttyname(int fd); #include <dump_entry.h> #include <transform.h> -MODULE_ID("$Id: tset.c,v 0.47 2000/10/08 01:01:08 tom Exp $") +MODULE_ID("$Id: tset.c,v 0.49 2001/02/24 23:29:33 tom Exp $") extern char **environ; @@ -120,7 +120,7 @@ static int intrchar = -1; /* new interrupt character */ static int tkillchar = -1; /* new kill character */ static int tlines, tcolumns; /* window size */ -#define LOWERCASE(c) ((isalpha(c) && isupper(c)) ? tolower(c) : (c)) +#define LOWERCASE(c) ((isalpha(CharOf(c)) && isupper(CharOf(c))) ? tolower(CharOf(c)) : (c)) static int CaselessCmp(const char *a, const char *b) @@ -159,14 +159,14 @@ failed(const char *msg) static void cat(char *file) { - register int fd, nr, nw; + register int fd, nr; char buf[BUFSIZ]; if ((fd = open(file, O_RDONLY, 0)) < 0) failed(file); while ((nr = read(fd, buf, sizeof(buf))) > 0) - if ((nw = write(STDERR_FILENO, buf, (size_t) nr)) == -1) + if (write(STDERR_FILENO, buf, (size_t) nr) == -1) failed("write to stderr"); if (nr != 0) failed(file); @@ -495,7 +495,7 @@ mapped(const char *type) static const char * get_termcap_entry(char *userarg) { - int rval, errret; + int errret; char *p; const char *ttype; #if HAVE_GETTTYNAM @@ -534,7 +534,7 @@ get_termcap_entry(char *userarg) while (fgets(buffer, sizeof(buffer) - 1, fp) != 0) { for (s = buffer, t = d = 0; *s; s++) { - if (isspace(*s)) + if (isspace(CharOf(*s))) *s = '\0'; else if (t == 0) t = s; @@ -588,8 +588,8 @@ get_termcap_entry(char *userarg) ttype = askuser(0); } /* Find the terminfo entry. If it doesn't exist, ask the user. */ - while ((rval = setupterm((NCURSES_CONST char *) ttype, STDOUT_FILENO, - &errret)) != OK) { + while (setupterm((NCURSES_CONST char *) ttype, STDOUT_FILENO, &errret) + != OK) { if (errret == 0) { (void) fprintf(stderr, "tset: unknown terminal type %s\n", ttype); diff --git a/contrib/ncurses/tack/Makefile.in b/contrib/ncurses/tack/Makefile.in index f3f3c21b6d61..be0e90d5c69c 100644 --- a/contrib/ncurses/tack/Makefile.in +++ b/contrib/ncurses/tack/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.22 2000/08/26 21:51:23 tom Exp $ +# $Id: Makefile.in,v 1.25 2001/03/24 19:49:06 tom Exp $ # Makefile for tack # # The variable 'srcdir' refers to the source-distribution, and can be set with @@ -28,6 +28,8 @@ mandir = @mandir@/man1 includedir = @includedir@ datadir = @datadir@ +LIBTOOL = @LIBTOOL@ + INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ @@ -44,6 +46,7 @@ CPPFLAGS = -DHAVE_CONFIG_H -I../tack -I$(srcdir) @CPPFLAGS@ CCFLAGS = $(CPPFLAGS) $(CFLAGS) +CFLAGS_LIBTOOL = $(CCFLAGS) CFLAGS_NORMAL = $(CCFLAGS) CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE CFLAGS_PROFILE = $(CCFLAGS) -pg @@ -52,10 +55,11 @@ CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) LD = @LD@ -LINK = @LINK_PROGS@ $(CC) +LINK = @LINK_PROGS@ $(LIBTOOL) $(CC) LDFLAGS = @EXTRA_LDFLAGS@ \ @PROG_ARGS@ @LDFLAGS@ @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ +LDFLAGS_LIBTOOL = $(LDFLAGS) LDFLAGS_NORMAL = $(LDFLAGS) LDFLAGS_DEBUG = $(LDFLAGS) @CC_G_OPT@ LDFLAGS_PROFILE = $(LDFLAGS) -pg @@ -88,11 +92,11 @@ uninstall.libs: install.tack: $(PROGS) \ $(DESTDIR)$(bindir) \ $(DESTDIR)$(mandir) - $(INSTALL_PROGRAM) tack$x $(DESTDIR)$(bindir)/tack$x + $(LIBTOOL) $(INSTALL_PROGRAM) tack$x $(DESTDIR)$(bindir)/tack$x $(INSTALL_DATA) $(srcdir)/tack.1 $(DESTDIR)$(mandir)/tack.1 uninstall.tack: - -@rm -f $(DESTDIR)$(bindir)/tack$x + -@$(LIBTOOL) rm -f $(DESTDIR)$(bindir)/tack$x -@rm -f $(DESTDIR)$(mandir)/tack.1 $(DESTDIR)$(bindir) \ @@ -134,15 +138,16 @@ tags: @MAKE_UPPER_TAGS@TAGS: @MAKE_UPPER_TAGS@ etags *.[ch] -clean :: - -rm -f tags TAGS do.tic *~ +mostlyclean :: + -rm -f tags TAGS *.i do.tic *~ + +clean :: mostlyclean -rm -f $(PROGS) + -rm -rf .libs distclean :: clean -rm -f Makefile -mostlyclean :: clean - realclean :: distclean tack.tar: Makefile.in modules *.[ch] tack.1 HISTORY COPYING diff --git a/contrib/ncurses/tack/ansi.c b/contrib/ncurses/tack/ansi.c index df7b39f31e2b..4e81f223954e 100644 --- a/contrib/ncurses/tack/ansi.c +++ b/contrib/ncurses/tack/ansi.c @@ -21,7 +21,7 @@ #include <tack.h> -MODULE_ID("$Id: ansi.c,v 1.5 2000/04/22 21:06:57 tom Exp $") +MODULE_ID("$Id: ansi.c,v 1.8 2001/03/24 22:00:27 tom Exp $") /* * Standalone tests for ANSI terminals. Three entry points: @@ -135,7 +135,7 @@ read_ansi(void) int ch, i, j, last_escape; fflush(stdout); - read_key(ansi_buf, sizeof(ansi_buf)); + read_key((char *)ansi_buf, sizeof(ansi_buf)); /* Throw away control characters inside CSI sequences. Convert two character 7-bit sequences into 8-bit sequences. */ for (i = j = last_escape = 0; (ch = ansi_buf[i]) != 0; i++) { @@ -174,13 +174,13 @@ read_ansi(void) static int valid_mode(int expected) { - char *s; + unsigned char *s; int ch, terminator; read_ansi(); ape = 0; - ch = pack_buf[0] & 0xff; + ch = CharOf(pack_buf[0]); ansi_value[0] = 0; if (ch != A_CSI && ch != A_DCS) return FALSE; @@ -216,6 +216,7 @@ read_reports(void) { int i, j, k, tc, vcr, lc; char *s; + const char *t; lc = 5; terminal_class = tc = 0; @@ -254,15 +255,15 @@ read_reports(void) vcr = TRUE; break; } - j = pack_buf[0] & 0xff; + j = CharOf(pack_buf[0]); if (j != A_CSI && j != A_DCS) { put_crlf(); - s = "*** The above request gives illegal response ***"; - ptext(s); - for (j = strlen(s); j < 49; j++) + t = "*** The above request gives illegal response ***"; + ptext(t); + for (j = strlen(t); j < 49; j++) putchp(' '); } - s = expand(ansi_buf); + s = expand((const char *)ansi_buf); if (char_count + expand_chars >= columns) { put_str("\r\n "); lc++; @@ -322,14 +323,14 @@ request_cfss(void) putchp(' '); for (j = 0; ansi_buf[j]; j++) { if (ansi_buf[j] == 'r') { - for (k = j++; (ch = (ansi_buf[k] & 0xff)); k++) + for (k = j++; (ch = CharOf(ansi_buf[k])) != 0; k++) if (ch == A_ESC) { break; } else if (ch == A_ST) { break; } ansi_buf[k] = '\0'; - s = expand(&ansi_buf[j]); + s = expand((const char *)&ansi_buf[j]); if (char_count + expand_chars >= columns) put_str("\r\n "); put_str(s); @@ -432,7 +433,7 @@ terminal_state(void) tc_putp(temp); if (!valid_mode(('$' << 8) | 'y')) { /* not valid, save terminating value */ - s = expand(ansi_buf); + s = expand((const char *)ansi_buf); sprintf(tms, "%s%s%d %s ", tms, puc[i], j, s); break; diff --git a/contrib/ncurses/tack/charset.c b/contrib/ncurses/tack/charset.c index ca0ac6ff20d6..a5cac9423daa 100644 --- a/contrib/ncurses/tack/charset.c +++ b/contrib/ncurses/tack/charset.c @@ -21,7 +21,7 @@ #include <tack.h> -MODULE_ID("$Id: charset.c,v 1.4 2000/03/04 20:30:52 tom Exp $") +MODULE_ID("$Id: charset.c,v 1.6 2000/11/05 00:22:00 tom Exp $") /* Menu definitions for alternate character set and SGR tests. @@ -433,12 +433,12 @@ test_acs( break; } if (glyph[j].name[0] == '\0') { - if (isgraph(acs_chars[i])) { + if (isgraph(CharOf(acs_chars[i]))) { sprintf(temp, " %c", acs_chars[i]); } else { sprintf(temp, " 0x%02x", - (acs_chars[i] & 0xff)); + CharOf(acs_chars[i])); } strcpy(&temp[5], " *** has no mapping ***"); putln(temp); diff --git a/contrib/ncurses/tack/edit.c b/contrib/ncurses/tack/edit.c index a62810367d45..f6574fbda10e 100644 --- a/contrib/ncurses/tack/edit.c +++ b/contrib/ncurses/tack/edit.c @@ -23,7 +23,7 @@ #include <time.h> #include <tic.h> -MODULE_ID("$Id: edit.c,v 1.5 2000/03/25 17:26:12 tom Exp $") +MODULE_ID("$Id: edit.c,v 1.7 2001/02/24 22:10:40 tom Exp $") /* * Terminfo edit features @@ -563,11 +563,11 @@ can_test( const char *s, int flags) { - int ch, i, j; + int ch, j; char name[32]; if (s) { - for (i = j = 0; (name[j] = ch = *s); s++) { + for (j = 0; (name[j] = ch = *s); s++) { if (ch == ' ' || ch == ')' || ch == '(') { if (j) { name[j] = '\0'; @@ -597,11 +597,11 @@ cap_index( int *inx) { struct name_table_entry const *nt; - int ch, i, j; + int ch, j; char name[32]; if (s) { - for (i = j = 0; ; s++) { + for (j = 0; ; s++) { name[j] = ch = *s; if (ch == ' ' || ch == ')' || ch == '(' || ch == 0) { if (j) { @@ -876,7 +876,7 @@ change_one_entry( putln(buf); ptextln("Enter new pad. 0 for no pad. CR for no change."); read_string(buf, 32); - if (buf[0] == '\0' || (buf[1] == '\0' && isalpha(buf[0]))) { + if (buf[0] == '\0' || (buf[1] == '\0' && isalpha(CharOf(buf[0])))) { *chp = buf[0]; return; } diff --git a/contrib/ncurses/tack/output.c b/contrib/ncurses/tack/output.c index fac566e3b8a0..e1e4b4f7b28c 100644 --- a/contrib/ncurses/tack/output.c +++ b/contrib/ncurses/tack/output.c @@ -23,7 +23,7 @@ #include <tack.h> #include <time.h> -MODULE_ID("$Id: output.c,v 1.5 2000/03/04 21:06:57 tom Exp $") +MODULE_ID("$Id: output.c,v 1.6 2000/11/05 00:21:58 tom Exp $") /* globals */ long char_sent; /* number of characters sent */ @@ -122,7 +122,7 @@ tc_putch(int c) } if (log_fp) { /* terminal output logging */ - c &= 0xff; + c = CharOf(c); if (c < 32) { fprintf(log_fp, "<%s>", c0[c]); log_count += 5; @@ -561,7 +561,7 @@ hex_expand_to(char *s, int l) char *t; for (t = buf; *s; s++) { - sprintf(t, "%02X ", *s & 0xff); + sprintf(t, "%02X ", CharOf(*s)); t += 3; if (t - buf > (int) sizeof(buf) - 4) { break; @@ -584,13 +584,13 @@ expand_command(const char *c) char *s; s = buf; - for (i = FALSE; (ch = (*c & 0xff)); c++) { + for (i = FALSE; (ch = CharOf(*c)) != 0; c++) { if (i) { *s++ = ' '; } i = TRUE; if (ch < 32) { - j = c[1] & 0xff; + j = CharOf(c[1]); if (ch == '\033' && j >= '@' && j <= '_') { ch = j - '@'; c++; @@ -599,7 +599,7 @@ expand_command(const char *c) for (j = 0; (*s = c0[ch][j++]); s++); } else { *s++ = ch; - j = c[1] & 0xff; + j = CharOf(c[1]); if (ch >= '0' && ch <= '9' && j >= '0' && j <= '9') { i = FALSE; diff --git a/contrib/ncurses/tack/tack.h b/contrib/ncurses/tack/tack.h index 52464d3e2a34..3a81b4d978f7 100644 --- a/contrib/ncurses/tack/tack.h +++ b/contrib/ncurses/tack/tack.h @@ -19,10 +19,10 @@ ** Boston, MA 02111-1307, USA. */ -/* $Id: tack.h,v 1.6 2000/03/04 21:10:07 tom Exp $ */ +/* $Id: tack.h,v 1.8 2001/03/24 21:53:35 tom Exp $ */ -#ifndef _TACK_H -#define _TACK_H 1 +#ifndef NCURSES_TACK_H_incl +#define NCURSES_TACK_H_incl 1 /* terminfo action checker include file */ @@ -60,6 +60,8 @@ extern char *_nc_strstr(const char *, const char *); #define strstr(h,n) _nc_strstr(h,n) #endif +#define CharOf(c) ((unsigned char)(c)) + extern FILE *log_fp; extern FILE *debug_fp; extern int debug_level; @@ -400,4 +402,4 @@ extern void menu_clear_screen(struct test_list *, int *, int *); extern void menu_reset_init(struct test_list *, int *, int *); extern int subtest_menu(struct test_list *, int *, int *); -#endif /* _TACK_H */ +#endif /* NCURSES_TACK_H_incl */ diff --git a/contrib/ncurses/test/Makefile.in b/contrib/ncurses/test/Makefile.in index 9f573ba0d0b6..b99957b77c34 100644 --- a/contrib/ncurses/test/Makefile.in +++ b/contrib/ncurses/test/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.58 2000/05/28 01:28:39 tom Exp $ +# $Id: Makefile.in,v 1.61 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"), # @@ -45,6 +45,8 @@ exec_prefix = @exec_prefix@ libdir = @libdir@ includedir = @includedir@ +LIBTOOL = @LIBTOOL@ + CC = @CC@ CPP = @CPP@ @@ -53,6 +55,7 @@ CPPFLAGS = -I../test -I$(srcdir) @CPPFLAGS@ -DHAVE_CONFIG_H CCFLAGS = $(CPPFLAGS) $(CFLAGS) +CFLAGS_LIBTOOL = $(CCFLAGS) CFLAGS_NORMAL = $(CCFLAGS) CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE CFLAGS_PROFILE = $(CCFLAGS) -pg @@ -66,10 +69,11 @@ LOCAL_LIBS = @TEST_DEPS@ MATH_LIB = @MATH_LIB@ LD = @LD@ -LINK = @LINK_TESTS@ $(CC) +LINK = @LINK_TESTS@ $(LIBTOOL) $(CC) LDFLAGS = @LD_MODEL@ @TEST_ARGS@ @LIBS@ @EXTRA_LIBS@ @LOCAL_LDFLAGS@ @LDFLAGS@ +LDFLAGS_LIBTOOL = $(LDFLAGS) LDFLAGS_NORMAL = $(LDFLAGS) LDFLAGS_DEBUG = $(LDFLAGS) @CC_G_OPT@ LDFLAGS_PROFILE = $(LDFLAGS) -pg @@ -197,10 +201,10 @@ uninstall.libs: uninstall.test: mostlyclean :: - -rm -f core tags TAGS *~ *.ln *.atac trace + -rm -f core tags TAGS *~ *.i *.ln *.atac trace clean :: mostlyclean - -rm -rf *.o screendump *.lis $(TESTS) + -rm -rf *.o screendump *.lis $(TESTS) .libs distclean :: clean -rm -f Makefile ncurses_cfg.h config.* diff --git a/contrib/ncurses/test/bs.c b/contrib/ncurses/test/bs.c index 368abcd8f28d..3a22c1dfdb33 100644 --- a/contrib/ncurses/test/bs.c +++ b/contrib/ncurses/test/bs.c @@ -7,7 +7,7 @@ * v2.0 featuring strict ANSI/POSIX conformance, November 1993. * v2.1 with ncurses mouse support, September 1995 * - * $Id: bs.c,v 1.24 1999/08/21 23:14:38 tom Exp $ + * $Id: bs.c,v 1.29 2001/04/14 22:36:05 Erik.Sigra Exp $ */ #include <test.priv.h> @@ -22,7 +22,7 @@ #define SIGIOT SIGABRT #endif -#ifndef A_UNDERLINE /* BSD curses */ +#ifndef A_UNDERLINE /* BSD curses */ #define beep() write(1,"\007",1); #define cbreak crmode #define saveterm savetty @@ -57,7 +57,7 @@ static int getcoord(int); /* display symbols */ #define SHOWHIT '*' #define SHOWSPLASH ' ' -#define IS_SHIP(c) (isupper(c) ? TRUE : FALSE) +#define IS_SHIP(c) (isupper(CharOf(c)) ? TRUE : FALSE) /* how to position us on player board */ #define PYBASE 3 @@ -79,12 +79,12 @@ static int getcoord(int); /* other board locations */ #define COLWIDTH 80 -#define PROMPTLINE 21 /* prompt line */ +#define PROMPTLINE 21 /* prompt line */ #define SYBASE CYBASE + BDEPTH + 3 /* move key diagram */ #define SXBASE 63 -#define MYBASE SYBASE - 1 /* diagram caption */ +#define MYBASE SYBASE - 1 /* diagram caption */ #define MXBASE 64 -#define HYBASE SYBASE - 1 /* help area */ +#define HYBASE SYBASE - 1 /* help area */ #define HXBASE 0 /* this will need to be changed if BWIDTH changes */ @@ -108,15 +108,16 @@ static char dftname[] = "stranger"; #define NW 5 #define N 6 #define NE 7 -static int xincr[8] = {1, 1, 0, -1, -1, -1, 0, 1}; -static int yincr[8] = {0, 1, 1, 1, 0, -1, -1, -1}; +static int xincr[8] = +{1, 1, 0, -1, -1, -1, 0, 1}; +static int yincr[8] = +{0, 1, 1, 1, 0, -1, -1, -1}; /* current ship position and direction */ static int curx = (BWIDTH / 2); static int cury = (BDEPTH / 2); -typedef struct -{ +typedef struct { char *name; /* name of the ship type */ int hits; /* how many times has this ship been hit? */ char symbol; /* symbol for game purposes */ @@ -124,60 +125,60 @@ typedef struct char x, y; /* coordinates of ship start point */ unsigned char dir; /* direction of `bow' */ bool placed; /* has it been placed on the board? */ -} -ship_t; +} ship_t; -static bool checkplace(int b, ship_t *ss, int vis); +static bool checkplace(int b, ship_t * ss, int vis); #define SHIPIT(name, symbol, length) { name, 0, symbol, length, 0,0, 0, FALSE } static ship_t plyship[SHIPTYPES] = { - SHIPIT(carrier, 'A', 5), - SHIPIT(battle, 'B', 4), - SHIPIT(destroy, 'D', 3), - SHIPIT(sub, 'S', 3), - SHIPIT(ptboat, 'P', 2), + SHIPIT(carrier, 'A', 5), + SHIPIT(battle, 'B', 4), + SHIPIT(destroy, 'D', 3), + SHIPIT(sub, 'S', 3), + SHIPIT(ptboat, 'P', 2), }; static ship_t cpuship[SHIPTYPES] = { - SHIPIT(carrier, 'A', 5), - SHIPIT(battle, 'B', 4), - SHIPIT(destroy, 'D', 3), - SHIPIT(sub, 'S', 3), - SHIPIT(ptboat, 'P', 2), + SHIPIT(carrier, 'A', 5), + SHIPIT(battle, 'B', 4), + SHIPIT(destroy, 'D', 3), + SHIPIT(sub, 'S', 3), + SHIPIT(ptboat, 'P', 2), }; /* "Hits" board, and main board. */ static char hits[2][BWIDTH][BDEPTH]; static char board[2][BWIDTH][BDEPTH]; -static int turn; /* 0=player, 1=computer */ -static int plywon=0, cpuwon=0; /* How many games has each won? */ +static int turn; /* 0=player, 1=computer */ +static int plywon = 0, cpuwon = 0; /* How many games has each won? */ static int salvo, blitz, closepack; #define PR (void)addstr -static RETSIGTYPE uninitgame(int sig) GCC_NORETURN; +static RETSIGTYPE +uninitgame(int sig) GCC_NORETURN; -static RETSIGTYPE uninitgame(int sig GCC_UNUSED) + static RETSIGTYPE uninitgame(int sig GCC_UNUSED) /* end the game, either normally or due to signal */ { clear(); - (void)refresh(); - (void)resetterm(); - (void)echo(); - (void)endwin(); + (void) refresh(); + (void) resetterm(); + (void) echo(); + (void) endwin(); exit(EXIT_FAILURE); } -static void announceopts(void) +static void +announceopts(void) /* announce which game options are enabled */ { - if (salvo || blitz || closepack) - { + if (salvo || blitz || closepack) { (void) printw("Playing optional game ("); if (salvo) (void) printw("salvo, "); @@ -191,45 +192,43 @@ static void announceopts(void) (void) printw("closepack)"); else (void) printw("noclosepack)"); - } - else + } else (void) printw( - "Playing standard game (noblitz, nosalvo, noclosepack)"); + "Playing standard game (noblitz, nosalvo, noclosepack)"); } -static void intro(void) +static void +intro(void) { char *tmpname; - srand((unsigned)(time(0L)+getpid())); /* Kick the random number generator */ + srand((unsigned) (time(0L) + getpid())); /* Kick the random number generator */ - (void) signal(SIGINT,uninitgame); - (void) signal(SIGINT,uninitgame); - (void) signal(SIGIOT,uninitgame); /* for assert(3) */ - if(signal(SIGQUIT,SIG_IGN) != SIG_IGN) - (void)signal(SIGQUIT,uninitgame); + (void) signal(SIGINT, uninitgame); + (void) signal(SIGINT, uninitgame); + (void) signal(SIGIOT, uninitgame); /* for assert(3) */ + if (signal(SIGQUIT, SIG_IGN) != SIG_IGN) + (void) signal(SIGQUIT, uninitgame); - if((tmpname = getlogin()) != 0) - { - (void)strcpy(name,tmpname); + if ((tmpname = getlogin()) != 0) { + (void) strcpy(name, tmpname); name[0] = toupper(name[0]); - } - else - (void)strcpy(name,dftname); + } else + (void) strcpy(name, dftname); - (void)initscr(); + (void) initscr(); #ifdef KEY_MIN keypad(stdscr, TRUE); #endif /* KEY_MIN */ - (void)saveterm(); - (void)nonl(); - (void)cbreak(); - (void)noecho(); + (void) saveterm(); + (void) nonl(); + (void) cbreak(); + (void) noecho(); #ifdef PENGUIN - (void)clear(); - (void)mvaddstr(4,29,"Welcome to Battleship!"); - (void)move(8,0); + (void) clear(); + (void) mvaddstr(4, 29, "Welcome to Battleship!"); + (void) move(8, 0); PR(" \\\n"); PR(" \\ \\ \\\n"); PR(" \\ \\ \\ \\ \\_____________\n"); @@ -241,7 +240,8 @@ static void intro(void) PR(" \\ /\n"); PR(" \\___________________________________________________/\n"); - (void) mvaddstr(22,27,"Hit any key to continue..."); (void)refresh(); + (void) mvaddstr(22, 27, "Hit any key to continue..."); + (void) refresh(); (void) getch(); #endif /* PENGUIN */ @@ -259,12 +259,13 @@ static void intro(void) #endif /* A_COLOR */ #ifdef NCURSES_MOUSE_VERSION - (void) mousemask(BUTTON1_CLICKED, (mmask_t *)NULL); -#endif /* NCURSES_MOUSE_VERSION*/ -} + (void) mousemask(BUTTON1_CLICKED, (mmask_t *) NULL); +#endif /* NCURSES_MOUSE_VERSION */ +} /* VARARGS1 */ -static void prompt(int n, NCURSES_CONST char *f, const char *s) +static void +prompt(int n, NCURSES_CONST char *f, const char *s) /* print a message at the prompt line */ { (void) move(PROMPTLINE + n, 0); @@ -273,92 +274,90 @@ static void prompt(int n, NCURSES_CONST char *f, const char *s) (void) refresh(); } -static void error(NCURSES_CONST char *s) +static void +error(NCURSES_CONST char *s) { (void) move(PROMPTLINE + 2, 0); (void) clrtoeol(); - if (s) - { + if (s) { (void) addstr(s); (void) beep(); } } -static void placeship(int b, ship_t *ss, int vis) +static void +placeship(int b, ship_t * ss, int vis) { int l; - for(l = 0; l < ss->length; ++l) - { + for (l = 0; l < ss->length; ++l) { int newx = ss->x + l * xincr[ss->dir]; int newy = ss->y + l * yincr[ss->dir]; board[b][newx][newy] = ss->symbol; - if (vis) - { + if (vis) { pgoto(newy, newx); - (void) addch((chtype)ss->symbol); + (void) addch((chtype) ss->symbol); } } ss->hits = 0; } -static int rnd(int n) +static int +rnd(int n) { - return(((rand() & 0x7FFF) % n)); + return (((rand() & 0x7FFF) % n)); } -static void randomplace(int b, ship_t *ss) +static void +randomplace(int b, ship_t * ss) /* generate a valid random ship placement into px,py */ { - register int bwidth = BWIDTH - ss->length; - register int bdepth = BDEPTH - ss->length; do { - ss->y = rnd(bdepth); - ss->x = rnd(bwidth); ss->dir = rnd(2) ? E : S; + ss->x = rnd(BWIDTH - (ss->dir == E ? ss->length : 0)); + ss->y = rnd(BDEPTH - (ss->dir == S ? ss->length : 0)); } while (!checkplace(b, ss, FALSE)); } -static void initgame(void) +static void +initgame(void) { int i, j, unplaced; ship_t *ss; (void) clear(); - (void) mvaddstr(0,35,"BATTLESHIPS"); + (void) mvaddstr(0, 35, "BATTLESHIPS"); (void) move(PROMPTLINE + 2, 0); announceopts(); memset(board, 0, sizeof(char) * BWIDTH * BDEPTH * 2); - memset(hits, 0, sizeof(char) * BWIDTH * BDEPTH * 2); - for (i = 0; i < SHIPTYPES; i++) - { + memset(hits, 0, sizeof(char) * BWIDTH * BDEPTH * 2); + for (i = 0; i < SHIPTYPES; i++) { ss = cpuship + i; ss->x = - ss->y = - ss->dir = - ss->hits = 0; + ss->y = + ss->dir = + ss->hits = 0; ss->placed = FALSE; ss = plyship + i; ss->x = - ss->y = - ss->dir = - ss->hits = 0; + ss->y = + ss->dir = + ss->hits = 0; ss->placed = FALSE; } /* draw empty boards */ (void) mvaddstr(PYBASE - 2, PXBASE + 5, "Main Board"); - (void) mvaddstr(PYBASE - 1, PXBASE - 3,numbers); - for(i=0; i < BDEPTH; ++i) - { - (void) mvaddch(PYBASE + i, PXBASE - 3, (chtype)(i + 'A')); + (void) mvaddstr(PYBASE - 1, PXBASE - 3, numbers); + for (i = 0; i < BDEPTH; ++i) { + (void) mvaddch(PYBASE + i, PXBASE - 3, (chtype) (i + 'A')); #ifdef A_COLOR if (has_colors()) attron(COLOR_PAIR(COLOR_BLUE)); @@ -370,14 +369,13 @@ static void initgame(void) attrset(0); #endif /* A_COLOR */ (void) addch(' '); - (void) addch((chtype)(i + 'A')); + (void) addch((chtype) (i + 'A')); } - (void) mvaddstr(PYBASE + BDEPTH, PXBASE - 3,numbers); - (void) mvaddstr(CYBASE - 2, CXBASE + 7,"Hit/Miss Board"); + (void) mvaddstr(PYBASE + BDEPTH, PXBASE - 3, numbers); + (void) mvaddstr(CYBASE - 2, CXBASE + 7, "Hit/Miss Board"); (void) mvaddstr(CYBASE - 1, CXBASE - 3, numbers); - for(i=0; i < BDEPTH; ++i) - { - (void) mvaddch(CYBASE + i, CXBASE - 3, (chtype)(i + 'A')); + for (i = 0; i < BDEPTH; ++i) { + (void) mvaddch(CYBASE + i, CXBASE - 3, (chtype) (i + 'A')); #ifdef A_COLOR if (has_colors()) attron(COLOR_PAIR(COLOR_BLUE)); @@ -389,39 +387,38 @@ static void initgame(void) attrset(0); #endif /* A_COLOR */ (void) addch(' '); - (void) addch((chtype)(i + 'A')); + (void) addch((chtype) (i + 'A')); } - (void) mvaddstr(CYBASE + BDEPTH,CXBASE - 3,numbers); + (void) mvaddstr(CYBASE + BDEPTH, CXBASE - 3, numbers); - (void) mvprintw(HYBASE, HXBASE, + (void) mvprintw(HYBASE, HXBASE, "To position your ships: move the cursor to a spot, then"); - (void) mvprintw(HYBASE+1,HXBASE, + (void) mvprintw(HYBASE + 1, HXBASE, "type the first letter of a ship type to select it, then"); - (void) mvprintw(HYBASE+2,HXBASE, + (void) mvprintw(HYBASE + 2, HXBASE, "type a direction ([hjkl] or [4862]), indicating how the"); - (void) mvprintw(HYBASE+3,HXBASE, + (void) mvprintw(HYBASE + 3, HXBASE, "ship should be pointed. You may also type a ship letter"); - (void) mvprintw(HYBASE+4,HXBASE, + (void) mvprintw(HYBASE + 4, HXBASE, "followed by `r' to position it randomly, or type `R' to"); - (void) mvprintw(HYBASE+5,HXBASE, + (void) mvprintw(HYBASE + 5, HXBASE, "place all remaining ships randomly."); - (void) mvaddstr(MYBASE, MXBASE, "Aiming keys:"); - (void) mvaddstr(SYBASE, SXBASE, "y k u 7 8 9"); - (void) mvaddstr(SYBASE+1, SXBASE, " \\|/ \\|/ "); - (void) mvaddstr(SYBASE+2, SXBASE, "h-+-l 4-+-6"); - (void) mvaddstr(SYBASE+3, SXBASE, " /|\\ /|\\ "); - (void) mvaddstr(SYBASE+4, SXBASE, "b j n 1 2 3"); + (void) mvaddstr(MYBASE, MXBASE, "Aiming keys:"); + (void) mvaddstr(SYBASE, SXBASE, "y k u 7 8 9"); + (void) mvaddstr(SYBASE + 1, SXBASE, " \\|/ \\|/ "); + (void) mvaddstr(SYBASE + 2, SXBASE, "h-+-l 4-+-6"); + (void) mvaddstr(SYBASE + 3, SXBASE, " /|\\ /|\\ "); + (void) mvaddstr(SYBASE + 4, SXBASE, "b j n 1 2 3"); /* have the computer place ships */ - for(ss = cpuship; ss < cpuship + SHIPTYPES; ss++) - { + for (ss = cpuship; ss < cpuship + SHIPTYPES; ss++) { randomplace(COMPUTER, ss); placeship(COMPUTER, ss, FALSE); } - ss = (ship_t *)NULL; + ss = (ship_t *) NULL; do { char c, docked[SHIPTYPES + 2], *cp = docked; @@ -433,7 +430,7 @@ static void initgame(void) *cp = '\0'; /* get a command letter */ - prompt(1, "Type one of [%s] to pick a ship.", docked+1); + prompt(1, "Type one of [%s] to pick a ship.", docked + 1); do { c = getcoord(PLAYER); } while @@ -441,8 +438,7 @@ static void initgame(void) if (c == 'R') (void) ungetch('R'); - else - { + else { /* map that into the corresponding symbol */ for (ss = plyship; ss < plyship + SHIPTYPES; ss++) if (ss->symbol == c) @@ -457,48 +453,50 @@ static void initgame(void) } while (!strchr("hjklrR", c) || c == FF); - if (c == FF) - { - (void)clearok(stdscr, TRUE); - (void)refresh(); - } - else if (c == 'r') - { + if (c == FF) { + (void) clearok(stdscr, TRUE); + (void) refresh(); + } else if (c == 'r') { prompt(1, "Random-placing your %s", ss->name); randomplace(PLAYER, ss); placeship(PLAYER, ss, TRUE); - error((char *)NULL); + error((char *) NULL); ss->placed = TRUE; - } - else if (c == 'R') - { + } else if (c == 'R') { prompt(1, "Placing the rest of your fleet at random...", ""); for (ss = plyship; ss < plyship + SHIPTYPES; ss++) - if (!ss->placed) - { + if (!ss->placed) { randomplace(PLAYER, ss); placeship(PLAYER, ss, TRUE); ss->placed = TRUE; } - error((char *)NULL); - } - else if (strchr("hjkl8462", c)) - { + error((char *) NULL); + } else if (strchr("hjkl8462", c)) { ss->x = curx; ss->y = cury; - switch(c) - { - case 'k': case '8': ss->dir = N; break; - case 'j': case '2': ss->dir = S; break; - case 'h': case '4': ss->dir = W; break; - case 'l': case '6': ss->dir = E; break; - } + switch (c) { + case 'k': + case '8': + ss->dir = N; + break; + case 'j': + case '2': + ss->dir = S; + break; + case 'h': + case '4': + ss->dir = W; + break; + case 'l': + case '6': + ss->dir = E; + break; + } - if (checkplace(PLAYER, ss, TRUE)) - { + if (checkplace(PLAYER, ss, TRUE)) { placeship(PLAYER, ss, TRUE); - error((char *)NULL); + error((char *) NULL); ss->placed = TRUE; } } @@ -510,116 +508,128 @@ static void initgame(void) turn = rnd(2); - (void) mvprintw(HYBASE, HXBASE, + (void) mvprintw(HYBASE, HXBASE, "To fire, move the cursor to your chosen aiming point "); - (void) mvprintw(HYBASE+1, HXBASE, + (void) mvprintw(HYBASE + 1, HXBASE, "and strike any key other than a motion key. "); - (void) mvprintw(HYBASE+2, HXBASE, + (void) mvprintw(HYBASE + 2, HXBASE, " "); - (void) mvprintw(HYBASE+3, HXBASE, + (void) mvprintw(HYBASE + 3, HXBASE, " "); - (void) mvprintw(HYBASE+4, HXBASE, + (void) mvprintw(HYBASE + 4, HXBASE, " "); - (void) mvprintw(HYBASE+5, HXBASE, + (void) mvprintw(HYBASE + 5, HXBASE, " "); (void) prompt(0, "Press any key to start...", ""); (void) getch(); } -static int getcoord(int atcpu) +static int +getcoord(int atcpu) { int ny, nx, c; if (atcpu) - cgoto(cury,curx); + cgoto(cury, curx); else pgoto(cury, curx); - (void)refresh(); - for (;;) - { - if (atcpu) - { - (void) mvprintw(CYBASE + BDEPTH+1, CXBASE+11, "(%d, %c)", curx, 'A'+cury); + (void) refresh(); + for (;;) { + if (atcpu) { + (void) mvprintw(CYBASE + BDEPTH + 1, CXBASE + 11, "(%d, %c)", + curx, 'A' + cury); cgoto(cury, curx); - } - else - { - (void) mvprintw(PYBASE + BDEPTH+1, PXBASE+11, "(%d, %c)", curx, 'A'+cury); + } else { + (void) mvprintw(PYBASE + BDEPTH + 1, PXBASE + 11, "(%d, %c)", + curx, 'A' + cury); pgoto(cury, curx); } - switch(c = getch()) - { - case 'k': case '8': + switch (c = getch()) { + case 'k': + case '8': #ifdef KEY_MIN case KEY_UP: #endif /* KEY_MIN */ - ny = cury+BDEPTH-1; nx = curx; + ny = cury + BDEPTH - 1; + nx = curx; break; - case 'j': case '2': + case 'j': + case '2': #ifdef KEY_MIN case KEY_DOWN: #endif /* KEY_MIN */ - ny = cury+1; nx = curx; + ny = cury + 1; + nx = curx; break; - case 'h': case '4': + case 'h': + case '4': #ifdef KEY_MIN case KEY_LEFT: #endif /* KEY_MIN */ - ny = cury; nx = curx+BWIDTH-1; + ny = cury; + nx = curx + BWIDTH - 1; break; - case 'l': case '6': + case 'l': + case '6': #ifdef KEY_MIN case KEY_RIGHT: #endif /* KEY_MIN */ - ny = cury; nx = curx+1; + ny = cury; + nx = curx + 1; break; - case 'y': case '7': + case 'y': + case '7': #ifdef KEY_MIN case KEY_A1: #endif /* KEY_MIN */ - ny = cury+BDEPTH-1; nx = curx+BWIDTH-1; + ny = cury + BDEPTH - 1; + nx = curx + BWIDTH - 1; break; - case 'b': case '1': + case 'b': + case '1': #ifdef KEY_MIN case KEY_C1: #endif /* KEY_MIN */ - ny = cury+1; nx = curx+BWIDTH-1; + ny = cury + 1; + nx = curx + BWIDTH - 1; break; - case 'u': case '9': + case 'u': + case '9': #ifdef KEY_MIN case KEY_A3: #endif /* KEY_MIN */ - ny = cury+BDEPTH-1; nx = curx+1; + ny = cury + BDEPTH - 1; + nx = curx + 1; break; - case 'n': case '3': + case 'n': + case '3': #ifdef KEY_MIN case KEY_C3: #endif /* KEY_MIN */ - ny = cury+1; nx = curx+1; + ny = cury + 1; + nx = curx + 1; break; case FF: - nx = curx; ny = cury; - (void)clearok(stdscr, TRUE); - (void)refresh(); + nx = curx; + ny = cury; + (void) clearok(stdscr, TRUE); + (void) refresh(); break; #ifdef NCURSES_MOUSE_VERSION case KEY_MOUSE: { - MEVENT myevent; + MEVENT myevent; getmouse(&myevent); if (atcpu - && myevent.y >= CY(0) && myevent.y <= CY(BDEPTH) - && myevent.x >= CX(0) && myevent.x <= CX(BDEPTH)) - { + && myevent.y >= CY(0) && myevent.y <= CY(BDEPTH) + && myevent.x >= CX(0) && myevent.x <= CX(BDEPTH)) { curx = CXINV(myevent.x); cury = CYINV(myevent.y); - return(' '); - } - else - { + return (' '); + } else { beep(); continue; } @@ -632,7 +642,7 @@ static int getcoord(int atcpu) (void) mvaddstr(CYBASE + BDEPTH + 1, CXBASE + 11, " "); else (void) mvaddstr(PYBASE + BDEPTH + 1, PXBASE + 11, " "); - return(c); + return (c); } curx = nx % BWIDTH; @@ -640,48 +650,46 @@ static int getcoord(int atcpu) } } -static bool collidecheck(int b, int y, int x) +static bool +collidecheck(int b, int y, int x) /* is this location on the selected zboard adjacent to a ship? */ { bool collide; /* anything on the square */ if ((collide = IS_SHIP(board[b][x][y])) != FALSE) - return(collide); + return (collide); /* anything on the neighbors */ - if (!closepack) - { + if (!closepack) { int i; - for (i = 0; i < 8; i++) - { + for (i = 0; i < 8; i++) { int xend, yend; yend = y + yincr[i]; xend = x + xincr[i]; if (ONBOARD(xend, yend) - && IS_SHIP(board[b][xend][yend])) { + && IS_SHIP(board[b][xend][yend])) { collide = TRUE; break; } } } - return(collide); + return (collide); } -static bool checkplace(int b, ship_t *ss, int vis) +static bool +checkplace(int b, ship_t * ss, int vis) { int l, xend, yend; /* first, check for board edges */ - xend = ss->x + ss->length * xincr[ss->dir]; - yend = ss->y + ss->length * yincr[ss->dir]; - if (!ONBOARD(xend, yend)) - { + xend = ss->x + (ss->length - 1) * xincr[ss->dir]; + yend = ss->y + (ss->length - 1) * yincr[ss->dir]; + if (!ONBOARD(xend, yend)) { if (vis) - switch(rnd(3)) - { + switch (rnd(3)) { case 0: error("Ship is hanging from the edge of the world"); break; @@ -692,50 +700,48 @@ static bool checkplace(int b, ship_t *ss, int vis) error("Figure I won't find it if you put it there?"); break; } - return(FALSE); + return (FALSE); } - for(l = 0; l < ss->length; ++l) - { - if(collidecheck(b, ss->y+l*yincr[ss->dir], ss->x+l*xincr[ss->dir])) - { + for (l = 0; l < ss->length; ++l) { + if (collidecheck(b, ss->y + l * yincr[ss->dir], ss->x + l * xincr[ss->dir])) { if (vis) - switch(rnd(3)) - { - case 0: - error("There's already a ship there"); - break; - case 1: - error("Collision alert! Aaaaaagh!"); - break; - case 2: - error("Er, Admiral, what about the other ship?"); - break; - } - return(FALSE); - } + switch (rnd(3)) { + case 0: + error("There's already a ship there"); + break; + case 1: + error("Collision alert! Aaaaaagh!"); + break; + case 2: + error("Er, Admiral, what about the other ship?"); + break; + } + return (FALSE); } - return(TRUE); + } + return (TRUE); } -static int awinna(void) +static int +awinna(void) { int i, j; ship_t *ss; - for(i=0; i<2; ++i) - { + for (i = 0; i < 2; ++i) { ss = (i) ? cpuship : plyship; - for(j=0; j < SHIPTYPES; ++j, ++ss) - if(ss->length > ss->hits) + for (j = 0; j < SHIPTYPES; ++j, ++ss) + if (ss->length > ss->hits) break; if (j == SHIPTYPES) - return(OTHER); + return (OTHER); } - return(-1); + return (-1); } -static ship_t *hitship(int x, int y) +static ship_t * +hitship(int x, int y) /* register a hit on the targeted ship */ { ship_t *sb, *ss; @@ -744,85 +750,88 @@ static ship_t *hitship(int x, int y) getyx(stdscr, oldy, oldx); sb = (turn) ? plyship : cpuship; - if((sym = board[OTHER][x][y]) == 0) - return((ship_t *)NULL); - for(ss = sb; ss < sb + SHIPTYPES; ++ss) - if(ss->symbol == sym) - { + if ((sym = board[OTHER][x][y]) == 0) + return ((ship_t *) NULL); + for (ss = sb; ss < sb + SHIPTYPES; ++ss) + if (ss->symbol == sym) { if (++ss->hits < ss->length) /* still afloat? */ - return((ship_t *)NULL); - else /* sunk! */ - { + return ((ship_t *) NULL); + else { /* sunk! */ int i, j; if (!closepack) - for (j = -1; j <= 1; j++) - { + for (j = -1; j <= 1; j++) { int bx = ss->x + j * xincr[(ss->dir + 2) % 8]; int by = ss->y + j * yincr[(ss->dir + 2) % 8]; - for (i = -1; i <= ss->length; ++i) - { + for (i = -1; i <= ss->length; ++i) { int x1, y1; - + x1 = bx + i * xincr[ss->dir]; y1 = by + i * yincr[ss->dir]; - if (ONBOARD(x1, y1)) - { + if (ONBOARD(x1, y1)) { hits[turn][x1][y1] = MARK_MISS; - if (turn % 2 == PLAYER) - { + if (turn % 2 == PLAYER) { cgoto(y1, x1); #ifdef A_COLOR if (has_colors()) attron(COLOR_PAIR(COLOR_GREEN)); #endif /* A_COLOR */ - (void)addch(MARK_MISS); + (void) addch(MARK_MISS); #ifdef A_COLOR attrset(0); #endif /* A_COLOR */ + } else { + pgoto(y1, x1); + (void) addch(SHOWSPLASH); } } } } - for (i = 0; i < ss->length; ++i) - { + for (i = 0; i < ss->length; ++i) { int x1 = ss->x + i * xincr[ss->dir]; int y1 = ss->y + i * yincr[ss->dir]; hits[turn][x1][y1] = ss->symbol; - if (turn % 2 == PLAYER) - { + if (turn % 2 == PLAYER) { cgoto(y1, x1); - (void) addch((chtype)(ss->symbol)); + (void) addch((chtype) (ss->symbol)); + } else { + pgoto(y1, x1); +#ifdef A_COLOR + if (has_colors()) + attron(COLOR_PAIR(COLOR_RED)); +#endif /* A_COLOR */ + (void) addch(SHOWHIT); +#ifdef A_COLOR + attrset(0); +#endif /* A_COLOR */ } } (void) move(oldy, oldx); - return(ss); + return (ss); } } (void) move(oldy, oldx); - return((ship_t *)NULL); + return ((ship_t *) NULL); } -static int plyturn(void) +static bool +plyturn(void) { ship_t *ss; bool hit; NCURSES_CONST char *m = NULL; prompt(1, "Where do you want to shoot? ", ""); - for (;;) - { + for (;;) { (void) getcoord(COMPUTER); - if (hits[PLAYER][curx][cury]) - { + if (hits[PLAYER][curx][cury]) { prompt(1, "You shelled this spot already! Try again.", ""); beep(); - } - else + } else break; } hit = IS_SHIP(board[COMPUTER][curx][cury]); @@ -836,16 +845,14 @@ static int plyturn(void) attron(COLOR_PAIR(COLOR_GREEN)); } #endif /* A_COLOR */ - (void) addch((chtype)hits[PLAYER][curx][cury]); + (void) addch((chtype) hits[PLAYER][curx][cury]); #ifdef A_COLOR attrset(0); #endif /* A_COLOR */ prompt(1, "You %s.", hit ? "scored a hit" : "missed"); - if(hit && (ss = hitship(curx, cury))) - { - switch(rnd(5)) - { + if (hit && (ss = hitship(curx, cury))) { + switch (rnd(5)) { case 0: m = " You sank my %s!"; break; @@ -862,44 +869,43 @@ static int plyturn(void) m = " You'll pick up survivors from my %s, I hope...!"; break; } - (void)printw(m, ss->name); - (void)beep(); - return(awinna() == -1); + (void) printw(m, ss->name); + (void) beep(); + return (awinna() == -1); } return (hit); } -static int sgetc(const char *s) +static int +sgetc(const char *s) { const char *s1; int ch; - (void)refresh(); - for(;;) - { + (void) refresh(); + for (;;) { ch = getch(); if (islower(ch)) ch = toupper(ch); if (ch == CTRLC) uninitgame(0); - for (s1=s; *s1 && ch != *s1; ++s1) + for (s1 = s; *s1 && ch != *s1; ++s1) continue; - if (*s1) - { - (void) addch((chtype)ch); - (void)refresh(); - return(ch); - } + if (*s1) { + (void) addch((chtype) ch); + (void) refresh(); + return (ch); } + } } - -static void randomfire(int *px, int *py) +static void +randomfire(int *px, int *py) /* random-fire routine -- implements simple diagonal-striping strategy */ { static int turncount = 0; static int srchstep = BEGINSTEP; - static int huntoffs; /* Offset on search strategy */ + static int huntoffs; /* Offset on search strategy */ int ypossible[BWIDTH * BDEPTH], xpossible[BWIDTH * BDEPTH], nposs; int ypreferred[BWIDTH * BDEPTH], xpreferred[BWIDTH * BDEPTH], npref; int x, y, i; @@ -911,28 +917,23 @@ static void randomfire(int *px, int *py) nposs = npref = 0; for (x = 0; x < BWIDTH; x++) for (y = 0; y < BDEPTH; y++) - if (!hits[COMPUTER][x][y]) - { + if (!hits[COMPUTER][x][y]) { xpossible[nposs] = x; ypossible[nposs] = y; nposs++; - if (((x+huntoffs) % srchstep) != (y % srchstep)) - { + if (((x + huntoffs) % srchstep) != (y % srchstep)) { xpreferred[npref] = x; ypreferred[npref] = y; npref++; } } - if (npref) - { + if (npref) { i = rnd(npref); *px = xpreferred[i]; *py = ypreferred[i]; - } - else if (nposs) - { + } else if (nposs) { i = rnd(nposs); *px = xpossible[i]; @@ -940,12 +941,10 @@ static void randomfire(int *px, int *py) if (srchstep > 1) --srchstep; - } - else - { + } else { error("No moves possible?? Help!"); exit(EXIT_FAILURE); - /*NOTREACHED*/ + /*NOTREACHED */ } } @@ -953,7 +952,8 @@ static void randomfire(int *px, int *py) #define S_HIT 1 #define S_SUNK -1 -static int cpufire(int x, int y) +static int +cpufire(int x, int y) /* fire away at given location */ { bool hit, sunk; @@ -961,10 +961,11 @@ static int cpufire(int x, int y) hits[COMPUTER][x][y] = (hit = (board[PLAYER][x][y])) ? MARK_HIT : MARK_MISS; (void) mvprintw(PROMPTLINE, 0, - "I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" : "miss"); + "I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" : + "miss"); if ((sunk = (hit && (ss = hitship(x, y)))) != 0) (void) printw(" I've sunk your %s", ss->name); - (void)clrtoeol(); + (void) clrtoeol(); pgoto(y, x); #ifdef A_COLOR @@ -975,7 +976,7 @@ static int cpufire(int x, int y) attron(COLOR_PAIR(COLOR_GREEN)); } #endif /* A_COLOR */ - (void)addch((chtype)(hit ? SHOWHIT : SHOWSPLASH)); + (void) addch((chtype) (hit ? SHOWHIT : SHOWSPLASH)); #ifdef A_COLOR attrset(0); #endif /* A_COLOR */ @@ -988,7 +989,8 @@ static int cpufire(int x, int y) * unstructuredness below. The five labels are states which need to be held * between computer turns. */ -static bool cputurn(void) +static bool +cputurn(void) { #define POSSIBLE(x, y) (ONBOARD(x, y) && !hits[COMPUTER][x][y]) #define RANDOM_FIRE 0 @@ -1003,29 +1005,28 @@ static bool cputurn(void) int navail, x, y, d, n; int hit = S_MISS; - switch(next) - { - case RANDOM_FIRE: /* last shot was random and missed */ - refire: + switch (next) { + case RANDOM_FIRE: /* last shot was random and missed */ + refire: randomfire(&x, &y); if (!(hit = cpufire(x, y))) next = RANDOM_FIRE; - else - { - ts.x = x; ts.y = y; + else { + ts.x = x; + ts.y = y; ts.hits = 1; next = (hit == S_SUNK) ? RANDOM_FIRE : RANDOM_HIT; } break; - case RANDOM_HIT: /* last shot was random and hit */ - used[E/2] = used[S/2] = used[W/2] = used[N/2] = FALSE; + case RANDOM_HIT: /* last shot was random and hit */ + used[E / 2] = used[S / 2] = used[W / 2] = used[N / 2] = FALSE; /* FALLTHROUGH */ - case HUNT_DIRECT: /* last shot hit, we're looking for ship's long axis */ - for (d = navail = 0; d < 4; d++) - { - x = ts.x + xincr[d*2]; y = ts.y + yincr[d*2]; + case HUNT_DIRECT: /* last shot hit, we're looking for ship's long axis */ + for (d = navail = 0; d < 4; d++) { + x = ts.x + xincr[d * 2]; + y = ts.y + yincr[d * 2]; if (!used[d] && POSSIBLE(x, y)) navail++; else @@ -1033,8 +1034,7 @@ static bool cputurn(void) } if (navail == 0) /* no valid places for shots adjacent... */ goto refire; /* ...so we must random-fire */ - else - { + else { for (d = 0, n = rnd(navail) + 1; n; n--) while (used[d]) d++; @@ -1042,68 +1042,70 @@ static bool cputurn(void) assert(d <= 4); used[d] = FALSE; - x = ts.x + xincr[d*2]; - y = ts.y + yincr[d*2]; + x = ts.x + xincr[d * 2]; + y = ts.y + yincr[d * 2]; assert(POSSIBLE(x, y)); if (!(hit = cpufire(x, y))) next = HUNT_DIRECT; - else - { - ts.x = x; ts.y = y; ts.dir = d*2; ts.hits++; + else { + ts.x = x; + ts.y = y; + ts.dir = d * 2; + ts.hits++; next = (hit == S_SUNK) ? RANDOM_FIRE : FIRST_PASS; } } break; - case FIRST_PASS: /* we have a start and a direction now */ + case FIRST_PASS: /* we have a start and a direction now */ x = ts.x + xincr[ts.dir]; y = ts.y + yincr[ts.dir]; - if (POSSIBLE(x, y) && (hit = cpufire(x, y))) - { - ts.x = x; ts.y = y; ts.hits++; + if (POSSIBLE(x, y) && (hit = cpufire(x, y))) { + ts.x = x; + ts.y = y; + ts.hits++; next = (hit == S_SUNK) ? RANDOM_FIRE : FIRST_PASS; - } - else + } else next = REVERSE_JUMP; break; - case REVERSE_JUMP: /* nail down the ship's other end */ + case REVERSE_JUMP: /* nail down the ship's other end */ d = ts.dir + 4; x = ts.x + ts.hits * xincr[d]; y = ts.y + ts.hits * yincr[d]; - if (POSSIBLE(x, y) && (hit = cpufire(x, y))) - { - ts.x = x; ts.y = y; ts.dir = d; ts.hits++; + if (POSSIBLE(x, y) && (hit = cpufire(x, y))) { + ts.x = x; + ts.y = y; + ts.dir = d; + ts.hits++; next = (hit == S_SUNK) ? RANDOM_FIRE : SECOND_PASS; - } - else + } else next = RANDOM_FIRE; break; - case SECOND_PASS: /* kill squares not caught on first pass */ + case SECOND_PASS: /* kill squares not caught on first pass */ x = ts.x + xincr[ts.dir]; y = ts.y + yincr[ts.dir]; - if (POSSIBLE(x, y) && (hit = cpufire(x, y))) - { - ts.x = x; ts.y = y; ts.hits++; - next = (hit == S_SUNK) ? RANDOM_FIRE: SECOND_PASS; + if (POSSIBLE(x, y) && (hit = cpufire(x, y))) { + ts.x = x; + ts.y = y; + ts.hits++; + next = (hit == S_SUNK) ? RANDOM_FIRE : SECOND_PASS; break; - } - else + } else next = RANDOM_FIRE; break; } /* check for continuation and/or winner */ - if (salvo) - { - (void)refresh(); - (void)sleep(1); + if (salvo) { + (void) refresh(); + (void) sleep(1); } if (awinna() != -1) - return(FALSE); + return (FALSE); #ifdef DEBUG (void) mvprintw(PROMPTLINE + 2, 0, @@ -1113,46 +1115,43 @@ static bool cputurn(void) return ((hit) ? TRUE : FALSE); } -static -int playagain(void) +static int +playagain(void) { int j; ship_t *ss; for (ss = cpuship; ss < cpuship + SHIPTYPES; ss++) - for(j = 0; j < ss->length; j++) - { + for (j = 0; j < ss->length; j++) { cgoto(ss->y + j * yincr[ss->dir], ss->x + j * xincr[ss->dir]); - (void)addch((chtype)ss->symbol); + (void) addch((chtype) ss->symbol); } - if(awinna()) + if (awinna()) ++cpuwon; else ++plywon; j = 18 + strlen(name); - if(plywon >= 10) + if (plywon >= 10) ++j; - if(cpuwon >= 10) + if (cpuwon >= 10) ++j; - (void) mvprintw(1,(COLWIDTH-j)/2, - "%s: %d Computer: %d",name,plywon,cpuwon); + (void) mvprintw(1, (COLWIDTH - j) / 2, + "%s: %d Computer: %d", name, plywon, cpuwon); - prompt(2, (awinna()) ? "Want to be humiliated again, %s [yn]? " - : "Going to give me a chance for revenge, %s [yn]? ",name); - return(sgetc("YN") == 'Y'); + prompt(2, (awinna())? "Want to be humiliated again, %s [yn]? " + : "Going to give me a chance for revenge, %s [yn]? ", name); + return (sgetc("YN") == 'Y'); } -static void do_options(int c, char *op[]) +static void +do_options(int c, char *op[]) { register int i; - if (c > 1) - { - for (i=1; i<c; i++) - { - switch(op[i][0]) - { + if (c > 1) { + for (i = 1; i < c; i++) { + switch (op[i][0]) { default: case '?': (void) fprintf(stderr, "Usage: battle [-s | -b] [-c]\n"); @@ -1163,23 +1162,20 @@ static void do_options(int c, char *op[]) exit(EXIT_FAILURE); break; case '-': - switch(op[i][1]) - { + switch (op[i][1]) { case 'b': blitz = 1; - if (salvo == 1) - { + if (salvo == 1) { (void) fprintf(stderr, - "Bad Arg: -b and -s are mutually exclusive\n"); + "Bad Arg: -b and -s are mutually exclusive\n"); exit(EXIT_FAILURE); } break; case 's': salvo = 1; - if (blitz == 1) - { + if (blitz == 1) { (void) fprintf(stderr, - "Bad Arg: -s and -b are mutually exclusive\n"); + "Bad Arg: -s and -b are mutually exclusive\n"); exit(EXIT_FAILURE); } break; @@ -1188,7 +1184,8 @@ static void do_options(int c, char *op[]) break; default: (void) fprintf(stderr, - "Bad arg: type \"%s ?\" for usage message\n", op[0]); + "Bad arg: type \"%s ?\" for usage message\n", + op[0]); exit(EXIT_FAILURE); } } @@ -1196,73 +1193,64 @@ static void do_options(int c, char *op[]) } } -static int scount(int who) +static int +scount(int who) { register int i, shots; register ship_t *sp; if (who) - sp = cpuship; /* count cpu shots */ + sp = cpuship; /* count cpu shots */ else - sp = plyship; /* count player shots */ + sp = plyship; /* count player shots */ - for (i=0, shots = 0; i < SHIPTYPES; i++, sp++) - { + for (i = 0, shots = 0; i < SHIPTYPES; i++, sp++) { if (sp->hits >= sp->length) continue; /* dead ship */ else shots++; } - return(shots); + return (shots); } -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { do_options(argc, argv); intro(); do { initgame(); - while(awinna() == -1) - { - if (!blitz) - { - if (!salvo) - { - if(turn) + while (awinna() == -1) { + if (!blitz) { + if (!salvo) { + if (turn) (void) cputurn(); else (void) plyturn(); - } - else - { + } else { register int i; i = scount(turn); - while (i--) - { - if (turn) - { + while (i--) { + if (turn) { if (cputurn() && awinna() != -1) i = 0; - } - else - { + } else { if (plyturn() && awinna() != -1) i = 0; } } - } - } - else - while(turn ? cputurn() : plyturn()) + } + } else + while (turn ? cputurn() : plyturn()) continue; turn = OTHER; } } while (playagain()); uninitgame(0); - /*NOTREACHED*/ + /*NOTREACHED */ } /* bs.c ends here */ diff --git a/contrib/ncurses/test/cardfile.c b/contrib/ncurses/test/cardfile.c index 75d207764a93..a705d9d9eb62 100644 --- a/contrib/ncurses/test/cardfile.c +++ b/contrib/ncurses/test/cardfile.c @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey <dickey@clark.net> 1999 * - * $Id: cardfile.c,v 1.5 2000/09/09 19:08:32 tom Exp $ + * $Id: cardfile.c,v 1.6 2000/11/04 23:14:28 tom Exp $ * * File format: text beginning in column 1 is a title; other text forms the content. */ @@ -75,7 +75,7 @@ strdup(char *s) static const char * skip(const char *buffer) { - while (isspace(*buffer)) + while (isspace(CharOf(*buffer))) buffer++; return buffer; } @@ -84,7 +84,7 @@ static void trim(char *buffer) { unsigned n = strlen(buffer); - while (n-- && isspace(buffer[n])) + while (n-- && isspace(CharOf(buffer[n]))) buffer[n] = 0; } @@ -166,7 +166,7 @@ read_data(char *fname) if ((fp = fopen(fname, "r")) != 0) { while (fgets(buffer, sizeof(buffer), fp)) { trim(buffer); - if (isspace(*buffer)) { + if (isspace(CharOf(*buffer))) { if (card == 0) card = add_title(""); add_content(card, buffer); diff --git a/contrib/ncurses/test/configure b/contrib/ncurses/test/configure index e27f5ef57faf..de1cf77f931f 100755 --- a/contrib/ncurses/test/configure +++ b/contrib/ncurses/test/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13.19990117 +# Generated automatically using autoconf version 2.13.20000819 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -335,7 +335,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13.19990117" + echo "configure generated by autoconf version 2.13.20000819" exit 0 ;; -with-* | --with-*) @@ -760,6 +760,7 @@ LD="ld" LDFLAGS_SHARED="" LD_MODEL="" LD_SHARED_OPTS="" +LIBTOOL="" LIB_NAME=curses LIB_PREFIX="-l" LINK_TESTS="" @@ -787,12 +788,12 @@ fi if test "${with_ncurses+set}" = set; then withval="$with_ncurses" echo $ac_n "checking for initscr""... $ac_c" 1>&6 -echo "configure:791: checking for initscr" >&5 +echo "configure:792: checking for initscr" >&5 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 796 "configure" +#line 797 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char initscr(); below. */ @@ -815,7 +816,7 @@ initscr(); ; return 0; } EOF -if { (eval echo configure:819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_initscr=yes" else @@ -834,7 +835,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6 -echo "configure:838: checking for Gpm_Open in -lgpm" >&5 +echo "configure:839: checking for Gpm_Open in -lgpm" >&5 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -842,7 +843,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgpm $LIBS" cat > conftest.$ac_ext <<EOF -#line 846 "configure" +#line 847 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -853,7 +854,7 @@ int main() { Gpm_Open() ; return 0; } EOF -if { (eval echo configure:857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -908,12 +909,12 @@ fi echo $ac_n "checking for initscr""... $ac_c" 1>&6 -echo "configure:912: checking for initscr" >&5 +echo "configure:913: checking for initscr" >&5 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 917 "configure" +#line 918 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char initscr(); below. */ @@ -936,7 +937,7 @@ initscr(); ; return 0; } EOF -if { (eval echo configure:940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_initscr=yes" else @@ -955,7 +956,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for initscr in -l$LIB_NAME""... $ac_c" 1>&6 -echo "configure:959: checking for initscr in -l$LIB_NAME" >&5 +echo "configure:960: checking for initscr in -l$LIB_NAME" >&5 ac_lib_var=`echo $LIB_NAME'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -963,7 +964,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$LIB_NAME $LIBS" cat > conftest.$ac_ext <<EOF -#line 967 "configure" +#line 968 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -974,7 +975,7 @@ int main() { initscr() ; return 0; } EOF -if { (eval echo configure:978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1004,7 +1005,7 @@ fi fi echo $ac_n "checking for form_driver in -lform""... $ac_c" 1>&6 -echo "configure:1008: checking for form_driver in -lform" >&5 +echo "configure:1009: checking for form_driver in -lform" >&5 ac_lib_var=`echo form'_'form_driver | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1012,7 +1013,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lform $LIBS" cat > conftest.$ac_ext <<EOF -#line 1016 "configure" +#line 1017 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1023,7 +1024,7 @@ int main() { form_driver() ; return 0; } EOF -if { (eval echo configure:1027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1051,7 +1052,7 @@ else fi echo $ac_n "checking for menu_driver in -lmenu""... $ac_c" 1>&6 -echo "configure:1055: checking for menu_driver in -lmenu" >&5 +echo "configure:1056: checking for menu_driver in -lmenu" >&5 ac_lib_var=`echo menu'_'menu_driver | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1059,7 +1060,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmenu $LIBS" cat > conftest.$ac_ext <<EOF -#line 1063 "configure" +#line 1064 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1070,7 +1071,7 @@ int main() { menu_driver() ; return 0; } EOF -if { (eval echo configure:1074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1098,7 +1099,7 @@ else fi echo $ac_n "checking for new_panel in -lpanel""... $ac_c" 1>&6 -echo "configure:1102: checking for new_panel in -lpanel" >&5 +echo "configure:1103: checking for new_panel in -lpanel" >&5 ac_lib_var=`echo panel'_'new_panel | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1106,7 +1107,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpanel $LIBS" cat > conftest.$ac_ext <<EOF -#line 1110 "configure" +#line 1111 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1117,7 +1118,7 @@ int main() { new_panel() ; return 0; } EOF -if { (eval echo configure:1121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1146,12 +1147,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1150: checking return type of signal handlers" >&5 +echo "configure:1151: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1155 "configure" +#line 1156 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -1168,7 +1169,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1172: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1188,7 +1189,7 @@ EOF echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1192: checking how to run the C preprocessor" >&5 +echo "configure:1193: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1203,13 +1204,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 1207 "configure" +#line 1208 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1213: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1214: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1220,13 +1221,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1224 "configure" +#line 1225 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1230: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1231: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1237,13 +1238,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 1241 "configure" +#line 1242 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1247: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1268,12 +1269,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1272: checking for ANSI C header files" >&5 +echo "configure:1273: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1277 "configure" +#line 1278 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1281,7 +1282,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1285: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1286: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1298,7 +1299,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1302 "configure" +#line 1303 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1316,7 +1317,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1320 "configure" +#line 1321 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1337,7 +1338,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1341 "configure" +#line 1342 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1348,7 +1349,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1372,12 +1373,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1376: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1377: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1381 "configure" +#line 1382 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -1386,7 +1387,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1391: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1421,17 +1422,17 @@ unistd.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1425: checking for $ac_hdr" >&5 +echo "configure:1426: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1430 "configure" +#line 1431 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1435: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1436: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1469,12 +1470,12 @@ wresize \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1473: checking for $ac_func" >&5 +echo "configure:1474: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1478 "configure" +#line 1479 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1497,7 +1498,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1523,7 +1524,7 @@ done echo $ac_n "checking for function curses_version""... $ac_c" 1>&6 -echo "configure:1527: checking for function curses_version" >&5 +echo "configure:1528: checking for function curses_version" >&5 if eval "test \"`echo '$''{'cf_cv_func_curses_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1532,7 +1533,7 @@ if test "$cross_compiling" = yes; then cf_cv_func_curses_version=unknown else cat > conftest.$ac_ext <<EOF -#line 1536 "configure" +#line 1537 "configure" #include "confdefs.h" #include <curses.h> @@ -1544,7 +1545,7 @@ int main() } EOF -if { (eval echo configure:1548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_func_curses_version=yes @@ -1568,13 +1569,13 @@ EOF echo $ac_n "checking if sys/time.h conflicts with sys/select.h""... $ac_c" 1>&6 -echo "configure:1572: checking if sys/time.h conflicts with sys/select.h" >&5 +echo "configure:1573: checking if sys/time.h conflicts with sys/select.h" >&5 if eval "test \"`echo '$''{'cf_cv_sys_time_select'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1578 "configure" +#line 1579 "configure" #include "confdefs.h" #if HAVE_SYS_TIME_H @@ -1588,7 +1589,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1592: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_sys_time_select=yes else @@ -1697,7 +1698,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13.19990117" + echo "$CONFIG_STATUS generated by autoconf version 2.13.20000819" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -1751,6 +1752,7 @@ s%@LD@%$LD%g s%@LDFLAGS_SHARED@%$LDFLAGS_SHARED%g s%@LD_MODEL@%$LD_MODEL%g s%@LD_SHARED_OPTS@%$LD_SHARED_OPTS%g +s%@LIBTOOL@%$LIBTOOL%g s%@LIB_NAME@%$LIB_NAME%g s%@LIB_PREFIX@%$LIB_PREFIX%g s%@LINK_TESTS@%$LINK_TESTS%g diff --git a/contrib/ncurses/test/configure.in b/contrib/ncurses/test/configure.in index 3399932c3622..d61d477d691c 100644 --- a/contrib/ncurses/test/configure.in +++ b/contrib/ncurses/test/configure.in @@ -28,7 +28,7 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey 1996,1997,1998,2000 dnl -dnl $Id: configure.in,v 1.30 2000/08/12 22:43:08 tom Exp $ +dnl $Id: configure.in,v 1.31 2000/10/15 18:46:17 tom Exp $ dnl This is a simple configuration-script for the ncurses test programs that dnl allows the test-directory to be separately configured against a reference dnl system (i.e., sysvr4 curses) @@ -36,8 +36,9 @@ dnl dnl If you're configuring ncurses, you shouldn't need to use this script. dnl It's only for testing purposes. dnl -dnl dickey@herndon4.his.com (Thomas Dickey) -AC_PREREQ(2.12) +dnl See http://dickey.his.com/autoconf/ for additional information. +dnl --------------------------------------------------------------------------- +AC_PREREQ(2.13.20000819) AC_INIT(ncurses.c) AC_CONFIG_HEADER(ncurses_cfg.h:ncurses_tst.hin) @@ -56,6 +57,7 @@ LD="ld" AC_SUBST(LD) LDFLAGS_SHARED="" AC_SUBST(LDFLAGS_SHARED) LD_MODEL="" AC_SUBST(LD_MODEL) LD_SHARED_OPTS="" AC_SUBST(LD_SHARED_OPTS) +LIBTOOL="" AC_SUBST(LIBTOOL) LIB_NAME=curses AC_SUBST(LIB_NAME) LIB_PREFIX="-l" AC_SUBST(LIB_PREFIX) LINK_TESTS="" AC_SUBST(LINK_TESTS) diff --git a/contrib/ncurses/test/filter.c b/contrib/ncurses/test/filter.c index 272f3722b7c7..6ccaffd106bf 100644 --- a/contrib/ncurses/test/filter.c +++ b/contrib/ncurses/test/filter.c @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey <dickey@clark.net> 1998 * - * $Id: filter.c,v 1.4 2000/09/02 18:50:38 tom Exp $ + * $Id: filter.c,v 1.5 2001/02/24 22:11:58 tom Exp $ */ #include <test.priv.h> @@ -69,12 +69,11 @@ new_command(char *buffer, int length, attr_t underline) int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - SCREEN *sp; char buffer[80]; attr_t underline; filter(); - sp = newterm((char *) 0, stdout, stdin); + (void) newterm((char *) 0, stdout, stdin); cbreak(); keypad(stdscr, TRUE); diff --git a/contrib/ncurses/test/gdc.c b/contrib/ncurses/test/gdc.c index df9a0c3fdf5c..c2158745c1a1 100644 --- a/contrib/ncurses/test/gdc.c +++ b/contrib/ncurses/test/gdc.c @@ -6,7 +6,7 @@ * modified 10-18-89 for curses (jrl) * 10-18-89 added signal handling * - * $Id: gdc.c,v 1.15 2000/09/02 18:40:39 tom Exp $ + * $Id: gdc.c,v 1.16 2001/02/24 23:27:22 tom Exp $ */ #include <test.priv.h> @@ -97,7 +97,7 @@ set(int t, int n) m = 7 << n; for (i = 0; i < 5; i++) { - next[i] |= ((disp[t] >> (4 - i) * 3) & 07) << n; + next[i] |= ((disp[t] >> ((4 - i) * 3)) & 07) << n; mask |= (next[i] ^ older[i]) & m; } if (mask & m) @@ -306,6 +306,7 @@ main(int argc, char *argv[]) fprintf(stderr, "gdc terminated by signal %d\n", sigtermed); return EXIT_FAILURE; } + /* FALLTHRU */ default: continue; } diff --git a/contrib/ncurses/test/hashtest.c b/contrib/ncurses/test/hashtest.c index 52e5c2166224..682368d04d81 100644 --- a/contrib/ncurses/test/hashtest.c +++ b/contrib/ncurses/test/hashtest.c @@ -3,14 +3,14 @@ * * Generate timing statistics for vertical-motion optimization. * - * $Id: hashtest.c,v 1.15 2000/09/02 19:23:33 tom Exp $ + * $Id: hashtest.c,v 1.17 2001/03/10 19:47:22 tom Exp $ */ #ifdef TRACE #define Trace(p) _tracef p #define USE_TRACE 1 #else -#define Trace(p) /* nothing */ +#define Trace(p) /* nothing */ #define USE_TRACE 0 #endif @@ -30,191 +30,199 @@ static bool extend_corner = FALSE; static int foot_lines = 0; static int head_lines = 0; -static void cleanup(void) +static void +cleanup(void) { - move(LINES-1,0); - clrtoeol(); - refresh(); - endwin(); + move(LINES - 1, 0); + clrtoeol(); + refresh(); + endwin(); } -static RETSIGTYPE finish(int sig GCC_UNUSED) +static RETSIGTYPE +finish(int sig GCC_UNUSED) { - cleanup(); - exit(EXIT_FAILURE); + cleanup(); + exit(EXIT_FAILURE); } -static void genlines(int base) +static void +genlines(int base) { - int i, j; + int i, j; #if USE_TRACE - if (base == 'a') - Trace(("Resetting screen")); - else - Trace(("Painting `%c' screen", base)); + if (base == 'a') + Trace(("Resetting screen")); + else + Trace(("Painting `%c' screen", base)); #endif - /* Do this so writes to lower-right corner don't cause a spurious - * scrolling operation. This _shouldn't_ break the scrolling - * optimization, since that's computed in the refresh() call. - */ - scrollok(stdscr, FALSE); - - move(0,0); - for (i = 0; i < head_lines; i++) - for (j = 0; j < COLS; j++) - addch((j % 8 == 0) ? ('A' + j/8) : '-'); - - move(head_lines, 0); - for (i = head_lines; i < LINES - foot_lines; i++) { - int c = (base - LO_CHAR + i) % (HI_CHAR - LO_CHAR + 1) + LO_CHAR; - int hi = (extend_corner || (i < LINES - 1)) ? COLS : COLS - 1; - for (j = 0; j < hi; j++) - addch(c); - } - - for (i = LINES - foot_lines; i < LINES; i++) { - move(i, 0); - for (j = 0; j < (extend_corner ? COLS : COLS - 1); j++) - addch((j % 8 == 0) ? ('A' + j/8) : '-'); - } - - scrollok(stdscr, TRUE); - if (single_step) { - move(LINES-1, 0); - getch(); - } else - refresh(); + /* Do this so writes to lower-right corner don't cause a spurious + * scrolling operation. This _shouldn't_ break the scrolling + * optimization, since that's computed in the refresh() call. + */ + scrollok(stdscr, FALSE); + + move(0, 0); + for (i = 0; i < head_lines; i++) + for (j = 0; j < COLS; j++) + addch((j % 8 == 0) ? ('A' + j / 8) : '-'); + + move(head_lines, 0); + for (i = head_lines; i < LINES - foot_lines; i++) { + int c = (base - LO_CHAR + i) % (HI_CHAR - LO_CHAR + 1) + LO_CHAR; + int hi = (extend_corner || (i < LINES - 1)) ? COLS : COLS - 1; + for (j = 0; j < hi; j++) + addch(c); + } + + for (i = LINES - foot_lines; i < LINES; i++) { + move(i, 0); + for (j = 0; j < (extend_corner ? COLS : COLS - 1); j++) + addch((j % 8 == 0) ? ('A' + j / 8) : '-'); + } + + scrollok(stdscr, TRUE); + if (single_step) { + move(LINES - 1, 0); + getch(); + } else + refresh(); } -static void one_cycle(int ch) +static void +one_cycle(int ch) { - if (continuous) { - genlines(ch); - } else if (ch != 'a') { - genlines('a'); - genlines(ch); - } + if (continuous) { + genlines(ch); + } else if (ch != 'a') { + genlines('a'); + genlines(ch); + } } -static void run_test(bool optimized) +static void +run_test(bool optimized GCC_UNUSED) { - char ch; - int lo = continuous ? LO_CHAR : 'a' - LINES; - int hi = continuous ? HI_CHAR : 'a' + LINES; + char ch; + int lo = continuous ? LO_CHAR : 'a' - LINES; + int hi = continuous ? HI_CHAR : 'a' + LINES; - if (lo < LO_CHAR) - lo = LO_CHAR; - if (hi > HI_CHAR) - hi = HI_CHAR; + if (lo < LO_CHAR) + lo = LO_CHAR; + if (hi > HI_CHAR) + hi = HI_CHAR; #if defined(TRACE) || defined(NCURSES_TEST) - if (optimized) { - Trace(("With hash mapping")); - _nc_optimize_enable |= OPTIMIZE_HASHMAP; - } else { - Trace(("Without hash mapping")); - _nc_optimize_enable &= ~OPTIMIZE_HASHMAP; - } + if (optimized) { + Trace(("With hash mapping")); + _nc_optimize_enable |= OPTIMIZE_HASHMAP; + } else { + Trace(("Without hash mapping")); + _nc_optimize_enable &= ~OPTIMIZE_HASHMAP; + } #endif - if (reverse_loops) - for (ch = hi; ch >= lo; ch--) - one_cycle(ch); - else - for (ch = lo; ch <= hi; ch++) - one_cycle(ch); + if (reverse_loops) + for (ch = hi; ch >= lo; ch--) + one_cycle(ch); + else + for (ch = lo; ch <= hi; ch++) + one_cycle(ch); } -static void usage(void) +static void +usage(void) { - static const char *const tbl[] = { - "Usage: hashtest [options]" - ,"" - ,"Options:" - ," -c continuous (don't reset between refresh's)" - ," -f num leave 'num' lines constant for footer" - ," -h num leave 'num' lines constant for header" - ," -l num repeat test 'num' times" - ," -n test the normal optimizer" - ," -o test the hashed optimizer" - ," -r reverse the loops" - ," -s single-step" - ," -x assume lower-right corner extension" - }; - size_t n; - - for (n = 0; n < sizeof(tbl)/sizeof(tbl[0]); n++) - fprintf(stderr, "%s\n", tbl[n]); - exit(EXIT_FAILURE); + static const char *const tbl[] = + { + "Usage: hashtest [options]" + ,"" + ,"Options:" + ," -c continuous (don't reset between refresh's)" + ," -f num leave 'num' lines constant for footer" + ," -h num leave 'num' lines constant for header" + ," -l num repeat test 'num' times" + ," -n test the normal optimizer" + ," -o test the hashed optimizer" + ," -r reverse the loops" + ," -s single-step" + ," -x assume lower-right corner extension" + }; + size_t n; + + for (n = 0; n < SIZEOF(tbl); n++) + fprintf(stderr, "%s\n", tbl[n]); + exit(EXIT_FAILURE); } -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { - int c; - int test_loops = 1; - int test_normal = FALSE; - int test_optimize = FALSE; - - while ((c = getopt(argc, argv, "cf:h:l:norsx")) != EOF) { - switch (c) { - case 'c': - continuous = TRUE; - break; - case 'f': - foot_lines = atoi(optarg); - break; - case 'h': - head_lines = atoi(optarg); - break; - case 'l': - test_loops = atoi(optarg); - break; - case 'n': - test_normal = TRUE; - break; - case 'o': - test_optimize = TRUE; - break; - case 'r': - reverse_loops = TRUE; - break; - case 's': - single_step = TRUE; - break; - case 'x': - extend_corner = TRUE; - break; - default: - usage(); - } - } - if (!test_normal && !test_optimize) { - test_normal = TRUE; - test_optimize = TRUE; + int c; + int test_loops = 1; + int test_normal = FALSE; + int test_optimize = FALSE; + + while ((c = getopt(argc, argv, "cf:h:l:norsx")) != EOF) { + switch (c) { + case 'c': + continuous = TRUE; + break; + case 'f': + foot_lines = atoi(optarg); + break; + case 'h': + head_lines = atoi(optarg); + break; + case 'l': + test_loops = atoi(optarg); + break; + case 'n': + test_normal = TRUE; + break; + case 'o': + test_optimize = TRUE; + break; + case 'r': + reverse_loops = TRUE; + break; + case 's': + single_step = TRUE; + break; + case 'x': + extend_corner = TRUE; + break; + default: + usage(); } + } + if (!test_normal && !test_optimize) { + test_normal = TRUE; + test_optimize = TRUE; + } #if USE_TRACE - trace(TRACE_TIMES); + trace(TRACE_TIMES); #endif - (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ + (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ - (void) initscr(); /* initialize the curses library */ - keypad(stdscr, TRUE); /* enable keyboard mapping */ - (void) nonl(); /* tell curses not to do NL->CR/NL on output */ - (void) cbreak(); /* take input chars one at a time, no wait for \n */ - (void) noecho(); /* don't echo input */ - scrollok(stdscr, TRUE); + (void) initscr(); /* initialize the curses library */ + keypad(stdscr, TRUE); /* enable keyboard mapping */ + (void) nonl(); /* tell curses not to do NL->CR/NL on output */ + (void) cbreak(); /* take input chars one at a time, no wait for \n */ + (void) noecho(); /* don't echo input */ + scrollok(stdscr, TRUE); - while (test_loops-- > 0) { - if (test_normal) - run_test(FALSE); - if (test_optimize) - run_test(TRUE); - } + while (test_loops-- > 0) { + if (test_normal) + run_test(FALSE); + if (test_optimize) + run_test(TRUE); + } - cleanup(); /* we're done */ - return(EXIT_SUCCESS); + cleanup(); /* we're done */ + return (EXIT_SUCCESS); } /* hashtest.c ends here */ diff --git a/contrib/ncurses/test/knight.c b/contrib/ncurses/test/knight.c index 0729d494388f..b92237127637 100644 --- a/contrib/ncurses/test/knight.c +++ b/contrib/ncurses/test/knight.c @@ -6,7 +6,7 @@ * Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995. Mouse support * added September 20th 1995. * - * $Id: knight.c,v 1.17 2000/09/02 18:48:19 tom Exp $ + * $Id: knight.c,v 1.20 2000/10/29 00:51:51 tom Exp $ */ #include <test.priv.h> @@ -35,8 +35,8 @@ #define PLUS_COLOR 2 #define MINUS_COLOR 3 -#define CX(x) (2 + 4 * (x)) -#define CY(y) (1 + 2 * (y)) +#define CX(x) (2 + 4 * (x)) +#define CY(y) (1 + 2 * (y)) #define cellmove(y, x) wmove(boardwin, CY(y), CX(x)) #define CXINV(x) (((x) - 1) / 4) #define CYINV(y) (((y) - 2) / 2) @@ -45,41 +45,35 @@ typedef struct { short x, y; } cell; -static short board[BDEPTH][BWIDTH]; /* the squares */ -static int rw, col; /* current row and column */ -static int lastrow, lastcol; /* last location visited */ -static cell history[BDEPTH * BWIDTH]; /* choice history */ -static int movecount; /* count of moves so far */ static WINDOW *boardwin; /* the board window */ static WINDOW *helpwin; /* the help window */ static WINDOW *msgwin; /* the message window */ -static chtype trail = '#'; /* trail character */ -static chtype plus = '+'; /* cursor hot-spot character */ +static cell history[BDEPTH * BWIDTH + 1]; /* choice history */ static chtype minus = '-'; /* possible-move character */ static chtype oldch; - -static void init(void); -static void play(void); -static void dosquares(void); -static void drawmove(char, int, int, int, int); -static bool evalmove(int, int); -static bool chkmoves(void); -static bool chksqr(int, int); -static int iabs(int); - -int -main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) -{ - init(); - - play(); - - endwin(); - return EXIT_SUCCESS; -} +static chtype plus = '+'; /* cursor hot-spot character */ +static chtype trail = '#'; /* trail character */ +static int movecount; /* count of moves so far */ +static int trialcount; /* count of trials so far */ +static short board[BDEPTH][BWIDTH]; /* the squares */ +/* *INDENT-OFF* */ +static const struct { + int y; + int x; +} offsets[] = { + { 2, 1 }, + { 1, 2 }, + { -1, 2 }, + { -2, 1 }, + { -2, -1 }, + { -1, -2 }, + { 1, -2 }, + { 2, -1 }, +}; +/* *INDENT-ON* */ static void -init(void) +init_program(void) { srand((unsigned) getpid()); initscr(); @@ -154,25 +148,289 @@ help2(void) (void) waddstr(helpwin, "x,q -- exit y k u 7 8 9\n"); (void) waddstr(helpwin, "r -- redraw screen \\|/ \\|/ \n"); - (void) waddstr(helpwin, "u -- undo move h-+-l 4-+-6\n"); - (void) waddstr(helpwin, " /|\\ /|\\ \n"); + (void) waddstr(helpwin, "bksp -- undo move h-+-l 4-+-6\n"); + (void) waddstr(helpwin, "a -- autojump /|\\ /|\\ \n"); (void) waddstr(helpwin, " b j n 1 2 3\n"); (void) waddstr(helpwin, "\nYou can place your knight on the selected\n"); (void) waddstr(helpwin, "square with spacebar, Enter, or the keypad\n"); - (void) waddstr(helpwin, "center key. You can quit with `x' or `q'.\n"); + (void) waddstr(helpwin, "center key. Use F/B to review the path.\n"); (void) mvwaddstr(helpwin, NOTIFYY - INSTRY, 0, "Press `?' to go to game explanation"); } static void +show_help(bool * keyhelp) +{ + werase(helpwin); + if (*keyhelp) { + help1(); + *keyhelp = FALSE; + } else { + help2(); + *keyhelp = TRUE; + } + wrefresh(helpwin); +} + +static bool +chksqr(int r1, int c1) +{ + if ((r1 < 0) || (r1 > BDEPTH - 1)) + return (FALSE); + if ((c1 < 0) || (c1 > BWIDTH - 1)) + return (FALSE); + return ((!board[r1][c1]) ? TRUE : FALSE); +} + +static bool +chkmoves(int rw, int col) +/* check to see if valid moves are available */ +{ + unsigned n; + + for (n = 0; n < SIZEOF(offsets); n++) + if (chksqr(rw + offsets[n].y, col + offsets[n].x)) + return (TRUE); + return (FALSE); +} + +static void +dosquares(void) +{ + int i, j; + + mvaddstr(0, 20, "KNIGHT'S MOVE -- a logical solitaire"); + + move(BOARDY, BOARDX); + waddch(boardwin, ACS_ULCORNER); + for (j = 0; j < 7; j++) { + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_TTEE); + } + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_URCORNER); + + for (i = 1; i < BDEPTH; i++) { + move(BOARDY + i * 2 - 1, BOARDX); + waddch(boardwin, ACS_VLINE); + for (j = 0; j < BWIDTH; j++) { + waddch(boardwin, ' '); + waddch(boardwin, ' '); + waddch(boardwin, ' '); + waddch(boardwin, ACS_VLINE); + } + move(BOARDY + i * 2, BOARDX); + waddch(boardwin, ACS_LTEE); + for (j = 0; j < BWIDTH - 1; j++) { + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_PLUS); + } + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_RTEE); + } + + move(BOARDY + i * 2 - 1, BOARDX); + waddch(boardwin, ACS_VLINE); + for (j = 0; j < BWIDTH; j++) { + waddch(boardwin, ' '); + waddch(boardwin, ' '); + waddch(boardwin, ' '); + waddch(boardwin, ACS_VLINE); + } + + move(BOARDY + i * 2, BOARDX); + waddch(boardwin, ACS_LLCORNER); + for (j = 0; j < BWIDTH - 1; j++) { + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_BTEE); + } + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_LRCORNER); +} + +static void +mark_possibles(int prow, int pcol, chtype mark) +{ + unsigned n; + + for (n = 0; n < SIZEOF(offsets); n++) { + if (chksqr(prow + offsets[n].y, pcol + offsets[n].x)) { + cellmove(prow + offsets[n].y, pcol + offsets[n].x); + waddch(boardwin, mark); + } + } +} + +static void +find_next_move(int *y, int *x) +{ + unsigned j, k; + int found = -1; + int first = -1; + int next = 0; + int oldy, oldx; + int newy, newx; + + if (movecount > 1) { + oldy = history[movecount - 1].y; + oldx = history[movecount - 1].x; + for (j = 0; j < SIZEOF(offsets) * 2; j++) { + k = j % SIZEOF(offsets); + newy = oldy + offsets[k].y; + newx = oldx + offsets[k].x; + if (chksqr(newy, newx)) { + if (first < 0) + first = k; + if (newy == *y + && newx == *x) { + found = k; + } else if (found >= 0) { + next = k; + break; + } + } + } + if (found < 0) + next = first; + if (next >= 0) { + *y = oldy + offsets[next].y; + *x = oldx + offsets[next].x; + } + } else { + beep(); + } +} + +static void +unmarkcell(int row, int column) +{ + cellmove(row, column); + waddch(boardwin, '\b'); + waddch(boardwin, ' '); + waddch(boardwin, minus); + waddch(boardwin, ' '); +} + +static void +markcell(chtype tchar, int row, int column) +{ + cellmove(row, column); + waddch(boardwin, '\b'); + waddch(boardwin, tchar); + waddch(boardwin, tchar); + waddch(boardwin, tchar); +} + +static void +drawmove(chtype tchar, int oldy, int oldx, int row, int column) +/* place the stars, update board & currents */ +{ + if (movecount <= 1) { + int i, j; + + for (i = 0; i < BDEPTH; i++) { + for (j = 0; j < BWIDTH; j++) { + if (movecount == 0) { + unmarkcell(i, j); + } else { + cellmove(i, j); + if (winch(boardwin) == minus) + waddch(boardwin, movecount ? ' ' : minus); + } + } + } + } else { + markcell(tchar, oldy, oldx); + mark_possibles(oldy, oldx, ' '); + } + + if (row != -1 && column != -1) { + markcell(trail, row, column); + mark_possibles(row, column, minus); + board[row][column] = TRUE; + } + + wprintw(msgwin, "\nMove %d", movecount); + if (trialcount != movecount) + wprintw(msgwin, " (%d tries)", trialcount); + wclrtoeol(msgwin); +} + +static int +iabs(int num) +{ + if (num < 0) + return (-num); + else + return (num); +} + +static bool +evalmove(int row, int column) +/* evaluate move */ +{ + if (movecount == 1) + return (TRUE); + else if (board[row][column] == TRUE) { + waddstr(msgwin, "\nYou've already been there."); + return (FALSE); + } else { + int rdif = iabs(row - history[movecount - 1].y); + int cdif = iabs(column - history[movecount - 1].x); + + if (!((rdif == 1) && (cdif == 2)) && !((rdif == 2) && (cdif == 1))) { + waddstr(msgwin, "\nThat's not a legal knight's move."); + return (FALSE); + } + } + + return (TRUE); +} + +static int +completed(void) +{ + int i, j, count = 0; + + for (i = 0; i < BDEPTH; i++) + for (j = 0; j < BWIDTH; j++) + if (board[i][j] != 0) + count += 1; + return (count == (BWIDTH * BDEPTH) ? -1 : count); +} + +static void +no_previous_move(void) +{ + waddstr(msgwin, "\nNo previous move."); + beep(); +} + +static void play(void) /* play the game */ { bool keyhelp; /* TRUE if keystroke help is up */ - int c, ny = 0, nx = 0; int i, j, count; + int lastcol = 0; /* last location visited */ + int lastrow = 0; + int ny = 0, nx = 0; + int review = 0; /* review history */ + int rw = 0, col = 0; /* current row and column */ do { /* clear screen and draw board */ @@ -187,17 +445,21 @@ play(void) wnoutrefresh(boardwin); doupdate(); - for (i = 0; i < BDEPTH; i++) + movecount = 0; + for (i = 0; i < BDEPTH; i++) { for (j = 0; j < BWIDTH; j++) { board[i][j] = FALSE; - cellmove(i, j); - waddch(boardwin, minus); + unmarkcell(i, j); } - memset(history, '\0', sizeof(history)); + } + memset(history, 0, sizeof(history)); history[0].y = history[0].x = -1; + history[1].y = history[1].x = -1; lastrow = lastcol = -2; movecount = 1; + trialcount = 1; keyhelp = FALSE; + show_help(&keyhelp); for (;;) { if (rw != lastrow || col != lastcol) { @@ -221,11 +483,7 @@ play(void) wrefresh(msgwin); - c = wgetch(boardwin); - - werase(msgwin); - - switch (c) { + switch (wgetch(boardwin)) { case 'k': case '8': case KEY_UP: @@ -297,48 +555,67 @@ play(void) case KEY_B2: case '\n': case ' ': + review = 0; if (evalmove(rw, col)) { drawmove(trail, - history[movecount - 1].y, history[movecount - - 1].x, + history[movecount - 1].y, + history[movecount - 1].x, rw, col); history[movecount].y = rw; history[movecount].x = col; movecount++; - - if (!chkmoves()) - goto dropout; - } else + trialcount++; + + if (!chkmoves(rw, col)) { + if (completed() < 0) { + waddstr(msgwin, "\nYou won."); + } else { + waddstr(msgwin, + "\nNo further moves are possible."); + } + } + } else { beep(); - break; - - case KEY_REDO: - case '\f': - case 'r': - clearok(curscr, TRUE); - wnoutrefresh(stdscr); - wnoutrefresh(boardwin); - wnoutrefresh(msgwin); - wnoutrefresh(helpwin); - doupdate(); + } break; case KEY_UNDO: case KEY_BACKSPACE: case '\b': - if (movecount == 1) { - ny = lastrow; - nx = lastcol; - waddstr(msgwin, "\nNo previous move."); - beep(); + review = 0; + if (movecount <= 0) { + no_previous_move(); + } else if (movecount <= 1) { + ny = history[movecount].y; + nx = history[movecount].x; + if (nx < 0 || ny < 0) { + ny = lastrow; + nx = lastcol; + } + movecount = 0; + board[ny][nx] = FALSE; + oldch = minus; + drawmove(' ', ny, nx, -1, -1); + movecount = 1; + trialcount = 1; + no_previous_move(); } else { int oldy = history[movecount - 1].y; int oldx = history[movecount - 1].x; + if (!board[rw][col]) { + cellmove(rw, col); + waddch(boardwin, ' '); + } + board[oldy][oldx] = FALSE; --movecount; ny = history[movecount - 1].y; nx = history[movecount - 1].x; + if (nx < 0 || ny < 0) { + ny = oldy; + nx = oldx; + } drawmove(' ', oldy, oldx, ny, nx); /* avoid problems if we just changed the current cell */ @@ -347,20 +624,49 @@ play(void) } break; + case 'a': + nx = col; + ny = rw; + find_next_move(&ny, &nx); + break; + + case 'F': + if (review > 0) { + review--; + ny = history[movecount - review - 1].y; + nx = history[movecount - review - 1].x; + } else { + beep(); + } + break; + + case 'B': + if (review < movecount - 2) { + review++; + ny = history[movecount - review - 1].y; + nx = history[movecount - review - 1].x; + } else { + beep(); + } + break; + + case KEY_REDO: + case '\f': + case 'r': + clearok(curscr, TRUE); + wnoutrefresh(stdscr); + wnoutrefresh(boardwin); + wnoutrefresh(msgwin); + wnoutrefresh(helpwin); + doupdate(); + break; + case 'q': case 'x': goto dropout; case '?': - werase(helpwin); - if (keyhelp) { - help1(); - keyhelp = FALSE; - } else { - help2(); - keyhelp = TRUE; - } - wrefresh(helpwin); + show_help(&keyhelp); break; default: @@ -373,219 +679,24 @@ play(void) } dropout: - count = 0; - for (i = 0; i < BDEPTH; i++) - for (j = 0; j < BWIDTH; j++) - if (board[i][j] != 0) - count += 1; - if (count == (BWIDTH * BDEPTH)) + if ((count = completed()) < 0) wprintw(msgwin, "\nYou won. Care to try again? "); else wprintw(msgwin, "\n%d squares filled. Try again? ", count); + wclrtoeol(msgwin); } while (tolower(wgetch(msgwin)) == 'y'); } -static void -dosquares(void) -{ - int i, j; - - mvaddstr(0, 20, "KNIGHT'S MOVE -- a logical solitaire"); - - move(BOARDY, BOARDX); - waddch(boardwin, ACS_ULCORNER); - for (j = 0; j < 7; j++) { - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_TTEE); - } - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_URCORNER); - - for (i = 1; i < BDEPTH; i++) { - move(BOARDY + i * 2 - 1, BOARDX); - waddch(boardwin, ACS_VLINE); - for (j = 0; j < BWIDTH; j++) { - waddch(boardwin, ' '); - waddch(boardwin, ' '); - waddch(boardwin, ' '); - waddch(boardwin, ACS_VLINE); - } - move(BOARDY + i * 2, BOARDX); - waddch(boardwin, ACS_LTEE); - for (j = 0; j < BWIDTH - 1; j++) { - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_PLUS); - } - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_RTEE); - } - - move(BOARDY + i * 2 - 1, BOARDX); - waddch(boardwin, ACS_VLINE); - for (j = 0; j < BWIDTH; j++) { - waddch(boardwin, ' '); - waddch(boardwin, ' '); - waddch(boardwin, ' '); - waddch(boardwin, ACS_VLINE); - } - - move(BOARDY + i * 2, BOARDX); - waddch(boardwin, ACS_LLCORNER); - for (j = 0; j < BWIDTH - 1; j++) { - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_BTEE); - } - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_HLINE); - waddch(boardwin, ACS_LRCORNER); -} - -static void -mark_possibles(int prow, int pcol, chtype mark) -{ - if (chksqr(prow + 2, pcol + 1)) { - cellmove(prow + 2, pcol + 1); - waddch(boardwin, mark); - }; - if (chksqr(prow + 2, pcol - 1)) { - cellmove(prow + 2, pcol - 1); - waddch(boardwin, mark); - }; - if (chksqr(prow - 2, pcol + 1)) { - cellmove(prow - 2, pcol + 1); - waddch(boardwin, mark); - }; - if (chksqr(prow - 2, pcol - 1)) { - cellmove(prow - 2, pcol - 1); - waddch(boardwin, mark); - }; - if (chksqr(prow + 1, pcol + 2)) { - cellmove(prow + 1, pcol + 2); - waddch(boardwin, mark); - }; - if (chksqr(prow + 1, pcol - 2)) { - cellmove(prow + 1, pcol - 2); - waddch(boardwin, mark); - }; - if (chksqr(prow - 1, pcol + 2)) { - cellmove(prow - 1, pcol + 2); - waddch(boardwin, mark); - }; - if (chksqr(prow - 1, pcol - 2)) { - cellmove(prow - 1, pcol - 2); - waddch(boardwin, mark); - }; -} - -static void -drawmove(char tchar, int oldy, int oldx, int row, int column) -/* place the stars, update board & currents */ -{ - if (movecount <= 1) { - int i, j; - - for (i = 0; i < BDEPTH; i++) - for (j = 0; j < BWIDTH; j++) { - cellmove(i, j); - if (winch(boardwin) == minus) - waddch(boardwin, movecount ? ' ' : minus); - } - } else { - cellmove(oldy, oldx); - waddch(boardwin, '\b'); - waddch(boardwin, tchar); - waddch(boardwin, tchar); - waddch(boardwin, tchar); - mark_possibles(oldy, oldx, ' '); - } - - if (row != -1 && column != -1) { - cellmove(row, column); - waddch(boardwin, '\b'); - waddch(boardwin, trail); - waddch(boardwin, trail); - waddch(boardwin, trail); - mark_possibles(row, column, minus); - board[row][column] = TRUE; - } - - wprintw(msgwin, "\nMove %d", movecount); -} - -static bool -evalmove(int row, int column) -/* evaluate move */ -{ - if (movecount == 1) - return (TRUE); - else if (board[row][column] == TRUE) { - waddstr(msgwin, "\nYou've already been there."); - return (FALSE); - } else { - int rdif = iabs(row - history[movecount - 1].y); - int cdif = iabs(column - history[movecount - 1].x); - - if (!((rdif == 1) && (cdif == 2)) && !((rdif == 2) && (cdif == 1))) { - waddstr(msgwin, "\nThat's not a legal knight's move."); - return (FALSE); - } - } - - return (TRUE); -} - -static bool -chkmoves(void) -/* check to see if valid moves are available */ +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - if (chksqr(rw + 2, col + 1)) - return (TRUE); - if (chksqr(rw + 2, col - 1)) - return (TRUE); - if (chksqr(rw - 2, col + 1)) - return (TRUE); - if (chksqr(rw - 2, col - 1)) - return (TRUE); - if (chksqr(rw + 1, col + 2)) - return (TRUE); - if (chksqr(rw + 1, col - 2)) - return (TRUE); - if (chksqr(rw - 1, col + 2)) - return (TRUE); - if (chksqr(rw - 1, col - 2)) - return (TRUE); - return (FALSE); -} + init_program(); -static int -iabs(int num) -{ - if (num < 0) - return (-num); - else - return (num); -} + play(); -static bool -chksqr(int r1, int c1) -{ - if ((r1 < 0) || (r1 > BDEPTH - 1)) - return (FALSE); - if ((c1 < 0) || (c1 > BWIDTH - 1)) - return (FALSE); - return ((!board[r1][c1]) ? TRUE : FALSE); + endwin(); + return EXIT_SUCCESS; } /* knight.c ends here */ diff --git a/contrib/ncurses/test/lrtest.c b/contrib/ncurses/test/lrtest.c index fb99641117ce..f2fc9d2c552d 100644 --- a/contrib/ncurses/test/lrtest.c +++ b/contrib/ncurses/test/lrtest.c @@ -1,12 +1,13 @@ /* * Test lower-right-hand corner access * - * by Eric S. Raymond <esr@thyrsus.com> + * originally by Eric S. Raymond <esr@thyrsus.com>, written for animation + * and resizing -TD * * This can't be part of the ncurses test-program, because ncurses rips off the * bottom line to do labels. * - * $Id: lrtest.c,v 0.14 1999/10/23 19:44:35 tom Exp $ + * $Id: lrtest.c,v 0.15 2000/12/31 02:09:42 tom Exp $ */ #include <test.priv.h> @@ -56,8 +57,8 @@ show(MARK * m) int main( - int argc GCC_UNUSED, - char *argv[]GCC_UNUSED) + int argc GCC_UNUSED, + char *argv[]GCC_UNUSED) { static MARK marks[] = { @@ -83,8 +84,8 @@ main( move(LINES / 2 - 1, 4); if (!(has_ic() /* see PutCharLR() */ - || auto_right_margin - || (enter_am_mode && exit_am_mode))) { + || auto_right_margin + || (enter_am_mode && exit_am_mode))) { addstr("Your terminal lacks the capabilities needed to address the\n"); move(LINES / 2, 4); addstr("lower-right-hand corner of the screen.\n"); @@ -103,7 +104,7 @@ main( unsigned n; box(stdscr, 0, 0); - for (n = 0; n < sizeof(marks) / sizeof(marks[0]); n++) { + for (n = 0; n < SIZEOF(marks); n++) { show(&marks[n]); } @@ -116,12 +117,24 @@ main( nodelay(stdscr, TRUE); #ifdef KEY_RESIZE else if (ch == KEY_RESIZE) { + for (n = 0; n < SIZEOF(marks); n++) { + if (marks[n].mode == 0) { /* moving along x-direction */ + if (marks[n].y) + marks[n].y = LINES - 1; + } else { + if (marks[n].x) + marks[n].x = COLS - 1; + } + } + flash(); erase(); + wrefresh(curscr); goto restart; } #endif } napms(50); + refresh(); } curs_set(1); diff --git a/contrib/ncurses/test/ncurses.c b/contrib/ncurses/test/ncurses.c index ad1aa01c5cef..8bbf023fdb8b 100644 --- a/contrib/ncurses/test/ncurses.c +++ b/contrib/ncurses/test/ncurses.c @@ -39,7 +39,7 @@ DESCRIPTION AUTHOR Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993 -$Id: ncurses.c,v 1.138 2000/09/17 01:24:00 tom Exp $ +$Id: ncurses.c,v 1.143 2001/05/12 23:49:04 tom Exp $ ***************************************************************************/ @@ -119,6 +119,9 @@ extern int _nc_tracing; #define ESCAPE CTRL('[') #define BLANK ' ' /* this is the background character */ +static int max_colors; /* the actual number of colors we'll use */ +static int max_pairs; /* ...and the number of color pairs */ + /* The behavior of mvhline, mvvline for negative/zero length is unspecified, * though we can rely on negative x/y values to stop the macro. */ @@ -253,7 +256,7 @@ getch_test(void) int c; int incount = 0, firsttime = 0; bool blocking = TRUE; - int y, x; + int y; refresh(); @@ -267,7 +270,7 @@ getch_test(void) noecho(); nonl(); - if (isdigit(buf[0])) { + if (isdigit(CharOf(buf[0]))) { timeout(atoi(buf) * 100); blocking = FALSE; } @@ -301,7 +304,7 @@ getch_test(void) else (void) printw("%s (ASCII control character)\n", unctrl(c)); } - getyx(stdscr, y, x); + y = getcury(stdscr); if (y >= LINES - 1) move(0, 0); clrtoeol(); @@ -405,7 +408,7 @@ show_attr(int row, int skip, chtype attr, const char *name) }; unsigned n; bool found = FALSE; - for (n = 0; n < sizeof(table) / sizeof(table[0]); n++) { + for (n = 0; n < SIZEOF(table); n++) { if ((table[n] & attr) != 0 && ((1 << n) & ncv) != 0) { found = TRUE; @@ -426,11 +429,9 @@ attr_getc(int *skip, int *fg, int *bg, int *ac) if (isdigit(ch)) { *skip = (ch - '0'); - return TRUE; } else if (ch == CTRL('L')) { touchwin(stdscr); touchwin(curscr); - return TRUE; } else if (has_colors()) { switch (ch) { case 'a': @@ -454,15 +455,14 @@ attr_getc(int *skip, int *fg, int *bg, int *ac) default: return FALSE; } - if (*fg >= COLORS) + if (*fg >= max_colors) *fg = 0; if (*fg < 0) - *fg = COLORS - 1; - if (*bg >= COLORS) + *fg = max_colors - 1; + if (*bg >= max_colors) *bg = 0; if (*bg < 0) - *bg = COLORS - 1; - return TRUE; + *bg = max_colors - 1; } else { switch (ch) { case 'a': @@ -474,9 +474,8 @@ attr_getc(int *skip, int *fg, int *bg, int *ac) default: return FALSE; } - return TRUE; } - return FALSE; + return TRUE; } static void @@ -488,7 +487,7 @@ attr_test(void) int fg = COLOR_BLACK; /* color pair 0 is special */ int bg = COLOR_BLACK; int ac = 0; - bool *pairs = (bool *) calloc(COLOR_PAIRS, sizeof(bool)); + bool *pairs = (bool *) calloc(max_pairs, sizeof(bool)); pairs[0] = TRUE; if (skip < 0) @@ -501,7 +500,7 @@ attr_test(void) int normal = A_NORMAL | BLANK; if (has_colors()) { - int pair = (fg * COLORS) + bg; + int pair = (fg * max_colors) + bg; if (!pairs[pair]) { init_pair(pair, fg, bg); pairs[pair] = TRUE; @@ -574,7 +573,7 @@ static NCURSES_CONST char *color_names[] = static void show_color_name(int y, int x, int color) { - if (COLORS > 8) + if (max_colors > 8) mvprintw(y, x, "%02d ", color); else mvaddstr(y, x, color_names[color]); @@ -591,29 +590,30 @@ color_test(void) refresh(); (void) printw("There are %d color pairs\n", COLOR_PAIRS); - width = (COLORS > 8) ? 4 : 8; - hello = (COLORS > 8) ? "Test" : "Hello"; + width = (max_colors > 8) ? 4 : 8; + hello = (max_colors > 8) ? "Test" : "Hello"; for (base = 0; base < 2; base++) { - top = (COLORS > 8) ? 0 : base * (COLORS + 3); + top = (max_colors > 8) ? 0 : base * (max_colors + 3); clrtobot(); (void) mvprintw(top + 1, 0, "%dx%d matrix of foreground/background colors, bright *%s*\n", - COLORS, COLORS, + max_colors, max_colors, base ? "on" : "off"); - for (i = 0; i < COLORS; i++) + for (i = 0; i < max_colors; i++) show_color_name(top + 2, (i + 1) * width, i); - for (i = 0; i < COLORS; i++) + for (i = 0; i < max_colors; i++) show_color_name(top + 3 + i, 0, i); - for (i = 1; i < COLOR_PAIRS; i++) { - init_pair(i, i % COLORS, i / COLORS); + for (i = 1; i < max_pairs; i++) { + init_pair(i, i % max_colors, i / max_colors); attron((attr_t) COLOR_PAIR(i)); if (base) attron((attr_t) A_BOLD); - mvaddstr(top + 3 + (i / COLORS), (i % COLORS + 1) * width, hello); + mvaddstr(top + 3 + (i / max_colors), (i % max_colors + 1) * + width, hello); attrset(A_NORMAL); } - if ((COLORS > 8) || base) + if ((max_colors > 8) || base) Pause(); } @@ -653,7 +653,6 @@ color_edit(void) { int i, this_c = 0, value = 0, current = 0, field = 0; int last_c; - int max_colors = COLORS > 16 ? 16 : COLORS; refresh(); @@ -1200,7 +1199,7 @@ newwin_legend(FRAME * curp) } }; size_t n; - int y, x; + int x; bool do_keypad = HaveKeypad(curp); bool do_scroll = HaveScroll(curp); char buf[BUFSIZ]; @@ -1221,7 +1220,7 @@ newwin_legend(FRAME * curp) sprintf(buf, legend[n].msg, do_keypad ? "/ESC" : ""); break; } - getyx(stdscr, y, x); + x = getcurx(stdscr); addstr((COLS < (x + 3 + (int) strlen(buf))) ? "\n" : (n ? ", " : "")); addstr(buf); } @@ -2297,7 +2296,7 @@ padgetch(WINDOW *win) switch (c = wGetchar(win)) { case '!': ShellOut(FALSE); - c = KEY_REFRESH; + /* FALLTHRU */ case CTRL('r'): endwin(); refresh(); @@ -3022,7 +3021,7 @@ form_virtualize(FORM * f, WINDOW *w) mode = REQ_INS_MODE; c = mode; } else { - for (n = 0; n < sizeof(lookup) / sizeof(lookup[0]); n++) { + for (n = 0; n < SIZEOF(lookup); n++) { if (lookup[n].code == c) { c = lookup[n].result; break; @@ -3366,7 +3365,7 @@ usage(void) #endif }; size_t n; - for (n = 0; n < sizeof(tbl) / sizeof(tbl[0]); n++) + for (n = 0; n < SIZEOF(tbl); n++) fprintf(stderr, "%s\n", tbl[n]); exit(EXIT_FAILURE); } @@ -3504,12 +3503,20 @@ main(int argc, char *argv[]) /* tests, in general, will want these modes */ if (has_colors()) { start_color(); -#ifdef NCURSES_VERSION +#ifdef NCURSES_VERSION_PATCH + max_colors = COLORS > 16 ? 16 : COLORS; if (default_colors) use_default_colors(); +#if NCURSES_VERSION_PATCH >= 20000708 else if (assumed_colors) assume_default_colors(default_fg, default_bg); #endif +#else /* normal SVr4 curses */ + max_colors = COLORS > 8 ? 8 : COLORS; +#endif + max_pairs = (max_colors * max_colors); + if (max_pairs < COLOR_PAIRS) + max_pairs = COLOR_PAIRS; } set_terminal_modes(); def_prog_mode(); @@ -3574,7 +3581,7 @@ main(int argc, char *argv[]) if (command == 0) command = 'q'; break; - } else if (command == 0 && !isspace(ch)) { + } else if (command == 0 && !isspace(CharOf(ch))) { command = ch; } else if (ch == '\n' || ch == '\r') { if (command != 0) diff --git a/contrib/ncurses/test/newdemo.c b/contrib/ncurses/test/newdemo.c index d47d275e35a2..c0042e2c8cfd 100644 --- a/contrib/ncurses/test/newdemo.c +++ b/contrib/ncurses/test/newdemo.c @@ -2,7 +2,7 @@ * newdemo.c - A demo program using PDCurses. The program illustrate * the use of colours for text output. * - * $Id: newdemo.c,v 1.17 1997/09/20 15:11:26 tom Exp $ + * $Id: newdemo.c,v 1.18 2001/03/10 22:27:17 tom Exp $ */ #include <test.priv.h> @@ -11,11 +11,6 @@ #include <time.h> #include <string.h> -static int SubWinTest(WINDOW *win); -static int WaitForUser(WINDOW *win); -static int BouncingBalls(WINDOW *win); -static RETSIGTYPE trap(int); - #define delay_output(x) napms(x) /* @@ -54,157 +49,59 @@ NCURSES_CONST char *messages[] = }; /* - * Main driver + * Trap interrupt */ -int -main( - int argc GCC_UNUSED, - char *argv[] GCC_UNUSED) +static RETSIGTYPE +trap(int sig GCC_UNUSED) { -WINDOW *win; -int w, x, y, i, j, k; -char buffer[200]; -const char *message; -int width, height; -chtype save[80]; -chtype c; + endwin(); + exit(EXIT_FAILURE); +} - initscr(); - start_color(); - cbreak(); - signal(SIGINT, trap); - width = 48; - height = 14; /* Create a drawing window */ - win = newwin(height, width, (LINES-height)/2, (COLS-width)/2); - if(win == NULL) - { endwin(); - return 1; +/* + * Wait for user + */ +static int +WaitForUser(WINDOW *win) +{ + time_t t; + chtype key; + + nodelay(win, TRUE); + t = time((time_t *) 0); + while (1) { + if ((int) (key = wgetch(win)) != ERR) { + if (key == 'q' || key == 'Q') + return 1; + else + return 0; + } + if (time((time_t *) 0) - t > 5) + return 0; } +} - while(1) - { init_pair(1,COLOR_WHITE,COLOR_BLUE); - wattrset(win, COLOR_PAIR(1)); - werase(win); - - init_pair(2,COLOR_RED,COLOR_RED); - wattrset(win, COLOR_PAIR(2)); - box(win, ACS_VLINE, ACS_HLINE); - wrefresh(win); - /* Do ramdom output of a character */ - wattrset(win, COLOR_PAIR(1)); - c = 'a'; - for(i=0; i < 5000; ++i) - { x = rand() % (width-2) + 1; - y = rand() % (height-2) + 1; - mvwaddch(win, y, x, c); - wrefresh(win); - nodelay(win,TRUE); - if (wgetch(win) != ERR) - break; - if(i == 2000) - { c = 'b'; - init_pair(3,COLOR_CYAN,COLOR_YELLOW); - wattron(win, COLOR_PAIR(3)); - } - } - - SubWinTest(win); - /* Erase and draw green window */ - init_pair(4,COLOR_YELLOW,COLOR_GREEN); - wbkgd(win, COLOR_PAIR(4) | A_BOLD); - wattrset(win, COLOR_PAIR(4) | A_BOLD); - werase(win); - wrefresh(win); - /* Draw RED bounding box */ - wattrset(win, COLOR_PAIR(2)); - box(win, ' ', ' '); - wrefresh(win); - /* Display Australia map */ - wattrset(win, COLOR_PAIR(4) | A_BOLD); - i = 0; - while(*AusMap[i]) - { mvwaddstr(win, i+1, 8, AusMap[i]); - wrefresh(win); - delay_output(50); - ++i; - } - - init_pair(5,COLOR_BLUE,COLOR_WHITE); - wattrset(win, COLOR_PAIR(5) | A_BLINK); - mvwaddstr(win, height-2, 6, " PDCurses 2.1 for DOS, OS/2 and Unix"); - wrefresh(win); - - /* Draw running messages */ - init_pair(6,COLOR_YELLOW,COLOR_WHITE); - wattrset(win, COLOR_PAIR(6)); - message = messages[j = 0]; - i = 1; - w = width-2; - strcpy(buffer, message); - while(j < NMESSAGES) { - while ((int)strlen(buffer) < w) { - strcat(buffer, " ... "); - strcat(buffer, messages[++j % NMESSAGES]); - } - - if (i < w) - mvwaddnstr(win, height/2, w - i, buffer, i); - else - mvwaddnstr(win, height/2, 1, buffer, w); - - wrefresh(win); - nodelay(win,TRUE); - if (wgetch(win) != ERR) - { flushinp(); - break; - } - if (i++ >= w) { - for (k = 0; (buffer[k] = buffer[k+1]) != '\0'; k++) - ; - } - delay_output(100); - } - - j = 0; - /* Draw running As across in RED */ - init_pair(7,COLOR_RED,COLOR_GREEN); - wattron(win, COLOR_PAIR(7)); - for(i=2; i < width - 4; ++i) - { - k = mvwinch(win, 4, i); - if (k == ERR) - break; - save[j++] = c = k; - c &= A_CHARTEXT; - mvwaddch(win, 4, i, c); - } - wrefresh(win); - - /* Put a message up wait for a key */ - i = height-2; - wattrset(win, COLOR_PAIR(5)); - mvwaddstr(win, i, 5, " Type a key to continue or 'Q' to quit "); - wrefresh(win); - - if(WaitForUser(win) == 1) - break; - - j = 0; /* Restore the old line */ - for(i=2; i < width - 4; ++i) - mvwaddch(win, 4, i, save[j++]); - wrefresh(win); +static void +set_colors(WINDOW *win, int pair, int foreground, int background) +{ + if (has_colors()) { + if (pair > COLOR_PAIRS) + pair = COLOR_PAIRS; + init_pair(pair, foreground, background); + wattrset(win, COLOR_PAIR(pair)); + } +} - BouncingBalls(win); - /* Put a message up wait for a key */ - i = height-2; - wattrset(win, COLOR_PAIR(5)); - mvwaddstr(win, i, 5, " Type a key to continue or 'Q' to quit "); - wrefresh(win); - if(WaitForUser(win) == 1) - break; +static int +use_colors(WINDOW *win, int pair, int attrs) +{ + if (has_colors()) { + if (pair > COLOR_PAIRS) + pair = COLOR_PAIRS; + attrs |= COLOR_PAIR(pair); } - endwin(); - return 0; + wattrset(win, attrs); + return attrs; } /* @@ -213,34 +110,31 @@ chtype c; static int SubWinTest(WINDOW *win) { -int w, h, sw, sh, bx, by; -WINDOW *swin1, *swin2, *swin3; + int w, h, sw, sh, bx, by; + WINDOW *swin1, *swin2, *swin3; - getmaxyx(win, h, w); + getmaxyx(win, h, w); getbegyx(win, by, bx); sw = w / 3; sh = h / 3; - if((swin1 = subwin(win, sh, sw, by+3, bx+5)) == NULL) - return 1; - if((swin2 = subwin(win, sh, sw, by+4, bx+8)) == NULL) - return 1; - if((swin3 = subwin(win, sh, sw, by+5, bx+11)) == NULL) - return 1; - - init_pair(8,COLOR_RED,COLOR_BLUE); - wattrset(swin1, COLOR_PAIR(8)); + if ((swin1 = subwin(win, sh, sw, by + 3, bx + 5)) == NULL) + return 1; + if ((swin2 = subwin(win, sh, sw, by + 4, bx + 8)) == NULL) + return 1; + if ((swin3 = subwin(win, sh, sw, by + 5, bx + 11)) == NULL) + return 1; + + set_colors(swin1, 8, COLOR_RED, COLOR_BLUE); werase(swin1); mvwaddstr(swin1, 0, 3, "Sub-window 1"); wrefresh(swin1); - init_pair(8,COLOR_CYAN,COLOR_MAGENTA); - wattrset(swin2, COLOR_PAIR(8)); + set_colors(swin2, 9, COLOR_CYAN, COLOR_MAGENTA); werase(swin2); mvwaddstr(swin2, 0, 3, "Sub-window 2"); wrefresh(swin2); - init_pair(8,COLOR_YELLOW,COLOR_GREEN); - wattrset(swin3, COLOR_PAIR(8)); + set_colors(swin3, 10, COLOR_YELLOW, COLOR_GREEN); werase(swin3); mvwaddstr(swin3, 0, 3, "Sub-window 3"); wrefresh(swin3); @@ -249,7 +143,19 @@ WINDOW *swin1, *swin2, *swin3; delwin(swin2); delwin(swin3); WaitForUser(win); - return 0; + return 0; +} + +static int +bounce(int n, int *dir, int len) +{ + if (*dir > 0) + ++n; + else + --n; + if (n <= 1 || n >= len - 2) + *dir = *dir ? 0 : 1; + return n; } /* @@ -258,91 +164,195 @@ WINDOW *swin1, *swin2, *swin3; static int BouncingBalls(WINDOW *win) { -int w, h; -int x1, y1, xd1, yd1; -int x2, y2, xd2, yd2; -int x3, y3, xd3, yd3; + int w, h; + int x1, y1, xd1, yd1; + int x2, y2, xd2, yd2; + int x3, y3, xd3, yd3; getmaxyx(win, h, w); - x1 = 2 + rand() % (w - 4); - y1 = 2 + rand() % (h - 4); - x2 = 2 + rand() % (w - 4); - y2 = 2 + rand() % (h - 4); - x3 = 2 + rand() % (w - 4); - y3 = 2 + rand() % (h - 4); - xd1 = 1; yd1 = 1; - xd2 = 1; yd2 = 0; - xd3 = 0; yd3 = 1; - nodelay(win,TRUE); - while(wgetch(win) == ERR) - { x1 = xd1 > 0 ? ++x1 : --x1; - if(x1 <= 1 || x1 >= w - 2) - xd1 = xd1 ? 0 : 1; - y1 = yd1 > 0 ? ++y1 : --y1; - if(y1 <= 1 || y1 >= h - 2) - yd1 = yd1 ? 0 : 1; - - x2 = xd2 > 0 ? ++x2 : --x2; - if(x2 <= 1 || x2 >= w - 2) - xd2 = xd2 ? 0 : 1; - y2 = yd2 > 0 ? ++y2 : --y2; - if(y2 <= 1 || y2 >= h - 2) - yd2 = yd2 ? 0 : 1; - - x3 = xd3 > 0 ? ++x3 : --x3; - if(x3 <= 1 || x3 >= w - 2) - xd3 = xd3 ? 0 : 1; - y3 = yd3 > 0 ? ++y3 : --y3; - if(y3 <= 1 || y3 >= h - 2) - yd3 = yd3 ? 0 : 1; - - init_pair(8,COLOR_RED,COLOR_BLUE); - wattrset(win, COLOR_PAIR(8)); + + x1 = 2 + rand() % (w - 4); + y1 = 2 + rand() % (h - 4); + x2 = 2 + rand() % (w - 4); + y2 = 2 + rand() % (h - 4); + x3 = 2 + rand() % (w - 4); + y3 = 2 + rand() % (h - 4); + + xd1 = 1; + yd1 = 1; + xd2 = 1; + yd2 = 0; + xd3 = 0; + yd3 = 1; + + nodelay(win, TRUE); + + while (wgetch(win) == ERR) { + x1 = bounce(x1, &xd1, w); + y1 = bounce(y1, &yd1, h); + x2 = bounce(x2, &xd2, w); + y2 = bounce(y2, &yd2, h); + x3 = bounce(x3, &xd3, w); + y3 = bounce(y3, &yd3, h); + + set_colors(win, 11, COLOR_RED, COLOR_BLUE); mvwaddch(win, y1, x1, 'O'); - init_pair(8,COLOR_BLUE,COLOR_RED); - wattrset(win, COLOR_PAIR(8)); - mvwaddch(win, y2, x2, '*'); - init_pair(8,COLOR_YELLOW,COLOR_WHITE); - wattrset(win, COLOR_PAIR(8)); - mvwaddch(win, y3, x3, '@'); - wmove(win, 0, 0); - wrefresh(win); + + set_colors(win, 12, COLOR_BLUE, COLOR_RED); + mvwaddch(win, y2, x2, '*'); + + set_colors(win, 13, COLOR_YELLOW, COLOR_WHITE); + mvwaddch(win, y3, x3, '@'); + + wmove(win, 0, 0); + wrefresh(win); delay_output(100); } return 0; } /* - * Wait for user + * Main driver */ -static int WaitForUser(WINDOW *win) +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - time_t t; - chtype key; - - nodelay(win,TRUE); - t = time((time_t *)0); - while(1) - { - if ((int)(key = wgetch(win)) != ERR) - { - if (key == 'q' || key == 'Q') - return 1; - else - return 0; - } - if (time((time_t *)0) - t > 5) - return 0; - } -} + WINDOW *win; + int w, x, y, i, j, k; + char buffer[200]; + const char *message; + int width, height; + chtype save[80]; + chtype c; -/* - * Trap interrupt - */ -static RETSIGTYPE trap(int sig GCC_UNUSED) -{ + initscr(); + if (has_colors()) + start_color(); + cbreak(); + curs_set(0); + signal(SIGINT, trap); + width = 48; + height = 14; /* Create a drawing window */ + win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2); + if (win == NULL) { + endwin(); + return 1; + } + + while (1) { + set_colors(win, 1, COLOR_WHITE, COLOR_BLUE); + werase(win); + + set_colors(win, 2, COLOR_RED, COLOR_RED); + box(win, ACS_VLINE, ACS_HLINE); + wrefresh(win); + /* Do ramdom output of a character */ + use_colors(win, 1, A_NORMAL); + c = 'a'; + for (i = 0; i < 5000; ++i) { + x = rand() % (width - 2) + 1; + y = rand() % (height - 2) + 1; + mvwaddch(win, y, x, c); + wrefresh(win); + nodelay(win, TRUE); + if (wgetch(win) != ERR) + break; + if (i == 2000) { + c = 'b'; + set_colors(win, 3, COLOR_CYAN, COLOR_YELLOW); + } + } + + SubWinTest(win); + /* Erase and draw green window */ + set_colors(win, 4, COLOR_YELLOW, COLOR_GREEN); + wbkgd(win, use_colors(win, 4, A_BOLD)); + werase(win); + wrefresh(win); + /* Draw RED bounding box */ + use_colors(win, 2, A_NORMAL); + box(win, ' ', ' '); + wrefresh(win); + /* Display Australia map */ + use_colors(win, 4, A_BOLD); + i = 0; + while (*AusMap[i]) { + mvwaddstr(win, i + 1, 8, AusMap[i]); + wrefresh(win); + delay_output(50); + ++i; + } + + set_colors(win, 5, COLOR_BLUE, COLOR_WHITE); + use_colors(win, 5, A_BLINK); + mvwaddstr(win, height - 2, 6, " PDCurses 2.1 for DOS, OS/2 and Unix"); + wrefresh(win); + + /* Draw running messages */ + set_colors(win, 6, COLOR_YELLOW, COLOR_WHITE); + message = messages[j = 0]; + i = 1; + w = width - 2; + strcpy(buffer, message); + while (j < NMESSAGES) { + while ((int) strlen(buffer) < w) { + strcat(buffer, " ... "); + strcat(buffer, messages[++j % NMESSAGES]); + } + + if (i < w) + mvwaddnstr(win, height / 2, w - i, buffer, i); + else + mvwaddnstr(win, height / 2, 1, buffer, w); + + wrefresh(win); + nodelay(win, TRUE); + if (wgetch(win) != ERR) { + flushinp(); + break; + } + if (i++ >= w) { + for (k = 0; (buffer[k] = buffer[k + 1]) != '\0'; k++) ; + } + delay_output(100); + } + + j = 0; + /* Draw running As across in RED */ + set_colors(win, 7, COLOR_RED, COLOR_GREEN); + for (i = 2; i < width - 4; ++i) { + k = mvwinch(win, 4, i); + if (k == ERR) + break; + save[j++] = c = k; + c &= A_CHARTEXT; + mvwaddch(win, 4, i, c); + } + wrefresh(win); + + /* Put a message up wait for a key */ + i = height - 2; + use_colors(win, 5, A_NORMAL); + mvwaddstr(win, i, 5, " Type a key to continue or 'Q' to quit "); + wrefresh(win); + + if (WaitForUser(win) == 1) + break; + + j = 0; /* Restore the old line */ + for (i = 2; i < width - 4; ++i) + mvwaddch(win, 4, i, save[j++]); + wrefresh(win); + + BouncingBalls(win); + /* Put a message up wait for a key */ + i = height - 2; + use_colors(win, 5, A_NORMAL); + mvwaddstr(win, i, 5, " Type a key to continue or 'Q' to quit "); + wrefresh(win); + if (WaitForUser(win) == 1) + break; + } endwin(); - exit(EXIT_FAILURE); + return 0; } - -/* End of DEMO.C */ diff --git a/contrib/ncurses/test/railroad.c b/contrib/ncurses/test/railroad.c index a9aa30674b47..6d5cd2581537 100644 --- a/contrib/ncurses/test/railroad.c +++ b/contrib/ncurses/test/railroad.c @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey <dickey@clark.net> 2000 * - * $Id: railroad.c,v 1.3 2000/09/24 00:20:33 tom Exp $ + * $Id: railroad.c,v 1.5 2001/03/24 22:01:42 tom Exp $ * * A simple demo of the termcap interface. */ @@ -120,7 +120,7 @@ ShowSign(char *string) while (*string != 0) { ch = *string; if (moveit != 0) { - for (first = length - 1; first > (string - base); first--) { + for (first = length - 2; first >= (string - base); first--) { if (first < length - 1) { tputs(tgoto(moveit, first + 1, height - 1), 1, outc); PutChar(' '); @@ -233,8 +233,9 @@ main(int argc, char *argv[]) if (argc > 1) { railroad(argv + 1); } else { + static char world[] = "Hello World"; static char *hello[] = - {"Hello World", 0}; + {world, 0}; railroad(hello); } return EXIT_SUCCESS; diff --git a/contrib/ncurses/test/tclock.c b/contrib/ncurses/test/tclock.c index 9f846554285b..319b0d4e7329 100644 --- a/contrib/ncurses/test/tclock.c +++ b/contrib/ncurses/test/tclock.c @@ -104,11 +104,11 @@ dline(int pair, int from_x, int from_y, int x2, int y2, char ch) int main( - int argc GCC_UNUSED, - char *argv[]GCC_UNUSED) + int argc GCC_UNUSED, + char *argv[]GCC_UNUSED) { int i, cx, cy; - double mradius, hradius, mangle, hangle; + double cr, mradius, hradius, mangle, hangle; double sangle, sradius, hours; int hdx, hdy; int mdx, mdy; @@ -142,14 +142,16 @@ main( #endif cx = (COLS - 1) / 2; /* 39 */ cy = LINES / 2; /* 12 */ - ch = (cx > cy) ? cy : cx; /* usually cy */ - mradius = (3 * cy) / 4; /* 9 */ - hradius = cy / 2; /* 6 */ - sradius = (2 * cy) / 3; /* 8 */ + if (cx / ASPECT < cy) + cr = cx / ASPECT; + else + cr = cy; + sradius = (5 * cr) / 6; /* 10 */ + mradius = (3 * cr) / 4; /* 9 */ + hradius = cr / 2; /* 6 */ for (i = 0; i < 12; i++) { sangle = (i + 1) * (2.0 * PI) / 12.0; - sradius = (5 * cy) / 6; /* 10 */ sdx = A2X(sangle, sradius); sdy = A2Y(sangle, sradius); sprintf(szChar, "%d", i + 1); @@ -159,9 +161,9 @@ main( mvaddstr(0, 0, "ASCII Clock by Howard Jones (ha.jones@ic.ac.uk),1994"); - sradius = 8; + sradius = (4 * sradius) / 5; for (;;) { - napms(1000); + napms(100); tim = time(0); t = localtime(&tim); @@ -199,7 +201,7 @@ main( mvaddstr(LINES - 2, 0, ctime(&tim)); refresh(); if ((t->tm_sec % 5) == 0 - && t->tm_sec != lastbeep) { + && t->tm_sec != lastbeep) { lastbeep = t->tm_sec; beep(); } @@ -207,7 +209,9 @@ main( if ((ch = getch()) != ERR) { #ifdef KEY_RESIZE if (ch == KEY_RESIZE) { + flash(); erase(); + wrefresh(curscr); goto restart; } #endif diff --git a/contrib/ncurses/test/test.priv.h b/contrib/ncurses/test/test.priv.h index 58bbd162386f..f5ecf02c541c 100644 --- a/contrib/ncurses/test/test.priv.h +++ b/contrib/ncurses/test/test.priv.h @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Thomas E. Dickey <dickey@clark.net> 1996 * ****************************************************************************/ -/* $Id: test.priv.h,v 1.19 2000/09/02 19:31:58 tom Exp $ */ +/* $Id: test.priv.h,v 1.20 2000/11/04 22:56:50 tom Exp $ */ #if HAVE_CONFIG_H #include <ncurses_cfg.h> @@ -87,6 +87,8 @@ extern int optind; #define GCC_UNUSED /* nothing */ #endif +#define CharOf(c) ((unsigned char)(c)) + #define SIZEOF(table) (sizeof(table)/sizeof(table[0])) #if defined(NCURSES_VERSION) && HAVE_NC_ALLOC_H diff --git a/contrib/ncurses/test/testcurs.c b/contrib/ncurses/test/testcurs.c index 5fa054a943a5..efcd39faac43 100644 --- a/contrib/ncurses/test/testcurs.c +++ b/contrib/ncurses/test/testcurs.c @@ -7,7 +7,7 @@ * wrs(5/28/93) -- modified to be consistent (perform identically) with either * PDCurses or under Unix System V, R4 * - * $Id: testcurs.c,v 1.22 2000/06/17 23:23:34 tom Exp $ + * $Id: testcurs.c,v 1.24 2001/02/24 22:13:23 tom Exp $ */ #include <test.priv.h> @@ -45,7 +45,7 @@ const COMMAND command[] = {"Input Test", inputTest}, {"Output Test", outputTest} }; -#define MAX_OPTIONS ((sizeof(command)/sizeof(command[0]))) +#define MAX_OPTIONS SIZEOF(command) int width, height; @@ -197,11 +197,11 @@ scrollTest(WINDOW *win) { int i; int half; - int OldX, OldY; + int OldY; NCURSES_CONST char *Message = "The window will now scroll slowly"; wclear(win); - getmaxyx(win, OldY, OldX); + OldY = getmaxy(win); half = OldY / 2; mvwprintw(win, OldY - 2, 1, Message); wrefresh(win); diff --git a/contrib/ncurses/test/testscanw.c b/contrib/ncurses/test/testscanw.c index 8420ea0fc55a..c9a16232f3c4 100644 --- a/contrib/ncurses/test/testscanw.c +++ b/contrib/ncurses/test/testscanw.c @@ -2,37 +2,38 @@ * Date: 1997/03/17 * From: bayern@morpheus.cis.yale.edu * - * $Id: testscanw.c,v 1.5 1997/09/20 14:16:20 tom Exp $ + * $Id: testscanw.c,v 1.6 2000/11/04 23:32:56 tom Exp $ */ #include <test.priv.h> #include <ctype.h> -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { - long badanswer = 1; - long *response = &badanswer; + long badanswer = 1; + long *response = &badanswer; - initscr(); - scrollok(stdscr, TRUE); - idlok(stdscr, TRUE); - echo(); + initscr(); + scrollok(stdscr, TRUE); + idlok(stdscr, TRUE); + echo(); #if 0 - trace(TRACE_UPDATE|TRACE_CALLS); + trace(TRACE_UPDATE | TRACE_CALLS); #endif - while (argc > 1) { - if (isdigit(*argv[1])) - move(atoi(argv[1]), 0); - else if (!strcmp(argv[1], "-k")) - keypad(stdscr, TRUE); - argc--, argv++; - } + while (argc > 1) { + if (isdigit(CharOf(*argv[1]))) + move(atoi(argv[1]), 0); + else if (!strcmp(argv[1], "-k")) + keypad(stdscr, TRUE); + argc--, argv++; + } - while (badanswer) { - printw("Enter a number (0 to quit):\n"); - printw("--> "); - scanw("%20ld", response); /* yes, it's a pointer */ - } - endwin(); - return EXIT_SUCCESS; + while (badanswer) { + printw("Enter a number (0 to quit):\n"); + printw("--> "); + scanw("%20ld", response); /* yes, it's a pointer */ + } + endwin(); + return EXIT_SUCCESS; } diff --git a/contrib/ncurses/test/view.c b/contrib/ncurses/test/view.c index 4c1344cb5d37..ee60f279e128 100644 --- a/contrib/ncurses/test/view.c +++ b/contrib/ncurses/test/view.c @@ -23,7 +23,7 @@ * scroll operation worked, and the refresh() code only had to do a * partial repaint. * - * $Id: view.c,v 1.31 2000/09/02 18:14:52 tom Exp $ + * $Id: view.c,v 1.35 2001/01/14 01:39:24 tom Exp $ */ #include <test.priv.h> @@ -31,6 +31,7 @@ #include <string.h> #include <ctype.h> #include <signal.h> +#include <time.h> #if HAVE_TERMIOS_H # include <termios.h> @@ -122,7 +123,7 @@ ch_dup(char *src) for (j = k = 0; j < len; j++) { if (utf8_mode) { - unsigned c = src[j] & 0xff; + unsigned c = CharOf(src[j]); /* Combine UTF-8 into Unicode */ if (c < 0x80) { /* We received an ASCII character */ @@ -191,9 +192,12 @@ main(int argc, char *argv[]) FILE *fp; char buf[BUFSIZ]; int i; + int my_delay = 0; chtype **olptr; - int done = FALSE; int length = 0; + int value = 0; + bool done = FALSE; + bool got_number = FALSE; #if CAN_RESIZE bool use_resize = TRUE; #endif @@ -259,11 +263,11 @@ main(int argc, char *argv[]) col = (col | 7) + 1; while ((d - temp) != col) *d++ = ' '; - } else if (isprint(*d) || utf8_mode) { + } else if (isprint(CharOf(*d)) || utf8_mode) { col++; d++; } else { - sprintf(d, "\\%03o", *s & 0xff); + sprintf(d, "\\%03o", CharOf(*s)); d += strlen(d); col = (d - temp); } @@ -278,16 +282,16 @@ main(int argc, char *argv[]) (void) nonl(); /* tell curses not to do NL->CR/NL on output */ (void) cbreak(); /* take input chars one at a time, no wait for \n */ (void) noecho(); /* don't echo input */ + nodelay(stdscr, TRUE); idlok(stdscr, TRUE); /* allow use of insert/delete line */ lptr = lines; while (!done) { int n, c; - bool got_number; - show_all(); + if (!got_number) + show_all(); - got_number = FALSE; n = 0; for (;;) { #if CAN_RESIZE @@ -303,13 +307,16 @@ main(int argc, char *argv[]) clrtoeol(); } addch(c); - n = 10 * n + (c - '0'); + value = 10 * value + (c - '0'); got_number = TRUE; } else break; } - if (!got_number && n == 0) + if (got_number && value) { + n = value; + } else { n = 1; + } switch (c) { case KEY_DOWN: @@ -368,12 +375,29 @@ main(int argc, char *argv[]) case KEY_RESIZE: /* ignore this; ncurses will repaint */ break; #endif -#if CAN_RESIZE + case 's': + if (got_number) { + halfdelay(my_delay = n); + } else { + nodelay(stdscr, FALSE); + my_delay = -1; + } + break; + case ' ': + nodelay(stdscr, TRUE); + my_delay = 0; + break; case ERR: + if (!my_delay) + napms(50); break; -#endif default: beep(); + break; + } + if (c >= KEY_MIN || (c > 0 && !isdigit(c))) { + got_number = FALSE; + value = 0; } } @@ -418,6 +442,7 @@ show_all(void) int i; char temp[BUFSIZ]; chtype *s; + time_t this_time; #if CAN_RESIZE sprintf(temp, "(%3dx%3d) col %d ", LINES, COLS, shift); @@ -429,6 +454,13 @@ show_all(void) move(0, 0); printw("%.*s", COLS, temp); clrtoeol(); + this_time = time((time_t *) 0); + strcpy(temp, ctime(&this_time)); + if ((i = strlen(temp)) != 0) { + temp[--i] = 0; + if (move(0, COLS - i - 2) != ERR) + printw(" %s", temp); + } scrollok(stdscr, FALSE); /* prevent screen from moving */ for (i = 1; i < LINES; i++) { diff --git a/contrib/ncurses/test/worm.c b/contrib/ncurses/test/worm.c index 142982aef221..02d9e1f5b6f3 100644 --- a/contrib/ncurses/test/worm.c +++ b/contrib/ncurses/test/worm.c @@ -34,7 +34,7 @@ Options: traces will be dumped. The program stops and waits for one character of input at the beginning and end of the interval. - $Id: worm.c,v 1.31 2000/09/02 18:41:01 tom Exp $ + $Id: worm.c,v 1.32 2000/12/31 01:54:07 tom Exp $ */ #include <test.priv.h> @@ -45,7 +45,6 @@ static chtype flavor[] = { 'O', '*', '#', '$', '%', '0', '@', }; -#define MAXWORMS (sizeof(flavor)/sizeof(chtype)) static const short xinc[] = { 1, 1, 1, 0, -1, -1, -1, 0 @@ -378,7 +377,7 @@ main(int argc, char *argv[]) for (n = 0, w = &worm[0]; n < number; n++, w++) { if ((x = w->xpos[h = w->head]) < 0) { move(y = w->ypos[h] = bottom, x = w->xpos[h] = 0); - addch(flavor[n % MAXWORMS]); + addch(flavor[n % SIZEOF(flavor)]); ref[y][x]++; } else { y = w->ypos[h]; @@ -419,7 +418,7 @@ main(int argc, char *argv[]) if (y < 0) y = 0; - addch(flavor[n % MAXWORMS]); + addch(flavor[n % SIZEOF(flavor)]); ref[w->ypos[h] = y][w->xpos[h] = x]++; } napms(10); |