diff options
author | Peter Wemm <peter@FreeBSD.org> | 1999-08-24 01:06:48 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 1999-08-24 01:06:48 +0000 |
commit | 0e3d540892016a47f6a68ec9ba2879d35ce5f7c2 (patch) | |
tree | ad214c5b2c8142ad6dc6d2ce3a9c83e6317d7f77 | |
download | src-vendor/ncurses/5.0-19990821.tar.gz src-vendor/ncurses/5.0-19990821.zip |
Import unmodified (but trimmed) ncurses 5.0 prerelease 990821.vendor/ncurses/5.0-19990821
This contains the full eti (panel, form, menu) extensions.
bmake glue to follow.
Obtained from: ftp://ftp.clark.net/pub/dickey/ncurses
532 files changed, 150840 insertions, 0 deletions
diff --git a/contrib/ncurses/ANNOUNCE b/contrib/ncurses/ANNOUNCE new file mode 100644 index 000000000000..b5fd0a1c7e55 --- /dev/null +++ b/contrib/ncurses/ANNOUNCE @@ -0,0 +1,351 @@ + + Announcing ncurses 5.0 + + The ncurses (new curses) library is a free software emulation of + curses in System V Release 4.0, and more. It uses terminfo format, + supports pads and color and multiple highlights and forms characters + and function-key mapping, and has all the other SYSV-curses + enhancements over BSD curses. + + In mid-June 1995, the maintainer of 4.4BSD curses declared that he + 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. + + 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! + + The distribution includes the library and support utilities, including + a terminfo compiler tic(1), a decompiler infocmp(1), clear(1), + tput(1), tset(1), and a termcap conversion tool captoinfo(1). Full + manual pages are provided for the library and tools. + + The ncurses distribution is available via anonymous FTP at the GNU + distribution site [1]ftp://ftp.gnu.org/pub/gnu. It is also available + at [2]ftp://ftp.clark.net/pub/dickey/ncurses. + + Release Notes + + We decided to release ncurses as a new whole number release (5.0) + because it incorporates several interface changes, including some that + would invalidate existing shared libraries. These are the highlights + from the change-log since ncurses 4.2 release. + + Interface changes: + * The principal source of changes to the interface comes from the + release of X/Open Curses in 1997. Earlier versions of ncurses (4.0 + and before) were based on a draft version of the specification. + The release version adds parameters to some functions to support + the evolving internationalization of curses. These summarize the + impact: + + modified several prototypes to correspond with 1997 version + of X/Open Curses (affects ABI since developers have used + attr_get). + + corrected prototypes for slk_* functions, using chtype rather + than attr_t. + + the slk_attr_{set,off,on} functions need an additional void* + parameter according to XSI. + + correct macros for wattr_set, wattr_get, separate wattrset + macro from these to preserve behavior that allows attributes + to be combined with color pair numbers. + + reviewed/updated curses.h, term.h against X/Open Curses Issue + 4 Version 2. This includes making some parameters + NCURSES_CONST rather than const, e.g., in termcap.h. + + reviewed/corrected macros in curses.h as per XSI document. + + add set_a_attributes and set_pglen_inch to terminfo + structure, as per XSI and Solaris 2.5. + * The newest version of the X/Open Curses is implemented on Solaris + and other vendor's systems. It adds new features to the terminfo + descriptions: + + implement tparm %l format. + + implement tparm printf-style width and precision for %s, %d, + %x, %o as per XSI. + * We made additional changes to reduce impact by future interface + changes: + + change key_names[] array to static since it is not part of + the curses interface. + + move macro winch to a function, to hide details of struct + ldat + * modify configure script to embed ABI in shared libraries for HP-UX + 10.x (detailed request by Tim Mooney). + * modify configuration of shared libraries on Digital Unix so that + versioning is embedded in the library, rather than implied by + links (patch by Tim Mooney). + + New features: + * enable sigwinch handler by default. + * turn on hashmap scrolling code by default + * improved support for termcap applications + + modify tput to accept termcap names as an alternative to + terminfo names. + + provide support for termcap PC variable by copying it from + terminfo data and using it as the padding character in tputs. + + provide support for termcap ospeed variable by copying it + from the internal cur_term member, and using ospeed as the + baudrate reference for the delay_output and tputs functions. + + change name-comparisons in lib_termcap to compare no more + than 2 characters. + + add configure option --enable-tcap-names, which essentially + allows users to define new capabilities as in termcap. + * add mouse support to ncurses menus. + * add mouse and dll support for OS/2 EMX + * modify terminfo parsing to accept octal and hexadecimal constants + * add configure option --enable-no-padding, to allow environment + variable $NCURSES_NO_PADDING to eliminate non-mandatory padding, + thereby making terminal emulators (e.g., for vt100) a little more + efficient. + * modify lib_color.c to eliminate dependency on orig_colors and + orig_pair, since SVr4 curses does not require these either, but + uses them when they are available. + * add -f option to infocmp and tic, which formats the terminfo + if/then/else/endif so that they are readable (with newlines and + tabs). + * modify tic to compile into %'char' form in preference to + %{number}, since that is a little more efficient. + + Major bug fixes: + * modify lib_tstp.c to block SIGTTOU when handling SIGTSTP, fixes a + problem where ncurses applications which were run via a shell + script would hang when given a ^Z. Also, check if the terminal's + process group is consistent, i.e., a shell has not taken ownership + of it, before deciding to save the current terminal settings in + the SIGTSTP handler. + * suppress sc/rc capabilities from terminal description if they + appear in smcup/rmcup. This affects only scrolling optimization, + to fix a problem reported by several people with xterm's alternate + screen, though the problem is more general. + * modify relative_move and tputs to avoid an interaction with the + BSD-style padding. The relative_move function could produce a + string to replace on the screen which began with a numeric + character, which was then interpreted by tputs as padding. + * modify setupterm so that cancelled strings are treated the same as + absent strings, cancelled and absent booleans false (does not + affect tic, infocmp). + * modify lib_vidattr.c to allow for terminal types (e.g., + xterm-color) which may reset all attributes in the 'op' + capability, so that colors are set before turning on bold and + other attributes, but still after turning attributes off. + * use 'access()' to check if ncurses library should be permitted to + open or modify files with fopen/open/link/unlink/remove calls, in + case the calling application is running in setuid mode. + * correction to doupdate, for case where terminal does not support + insert/delete character. The logic did not check that there was a + difference in alignment of changes to old/new screens before + repainting the whole non-blank portion of the line. Modified to + fall through into logic that reduces by the portion which does not + differ. + + Features of Ncurses + + The ncurses package is fully compatible with SVr4 (System V Release 4) + curses: + + * All 257 of the SVr4 calls have been implemented (and are + documented). + * Full support for SVr4 curses features including keyboard mapping, + color, forms-drawing with ACS characters, and automatic + recognition of keypad and function keys. + * An emulation of the SVr4 panels library, supporting a stack of + windows with backing store, is included. + * An emulation of the SVr4 menus library, supporting a uniform but + flexible interface for menu programming, is included. + * An emulation of the SVr4 form library, supporting data collection + through on-screen forms, is included. + * Binary terminfo entries generated by the ncurses tic(1) + implementation are bit-for-bit-compatible with the entry format + SVr4 curses uses. + * The utilities have options to allow you to filter terminfo entries + for use with less capable curses/terminfo versions such as the + HP/UX and AIX ports. + + The ncurses package also has many useful extensions over SVr4: + + * The API is 8-bit clean and base-level conformant with the X/OPEN + curses specification, XSI curses (that is, it implements all BASE + level features, but not all EXTENDED features). Most + EXTENDED-level features not directly concerned with wide-character + support are implemented, including many function calls not + supported under SVr4 curses (but portability of all calls is + documented so you can use the SVr4 subset only). + * Unlike SVr4 curses, ncurses can write to the rightmost-bottommost + corner of the screen if your terminal has an insert-character + capability. + * Ada95 and C++ bindings. + * Support for mouse event reporting with X Window xterm and OS/2 + console windows. + * Extended mouse support via Alessandro Rubini's gpm package. + * The function wresize() allows you to resize windows, preserving + their data. + * The function use_default_colors() allows you to use the terminal's + default colors for the default color pair, achieving the effect of + transparent colors. + * The functions keyok() and define_key() allow you to better control + the use of function keys, e.g., disabling the ncurses KEY_MOUSE, + or by defining more than one control sequence to map to a given + key code. + * Support for 16-color terminals, such as aixterm and XFree86 xterm. + * Better cursor-movement optimization. The package now features a + cursor-local-movement computation more efficient than either BSD's + or System V's. + * Super hardware scrolling support. The screen-update code + incorporates a novel, simple, and cheap algorithm that enables it + to make optimal use of hardware scrolling, line-insertion, and + line-deletion for screen-line movements. This algorithm is more + powerful than the 4.4BSD curses quickch() routine. + * Real support for terminals with the magic-cookie glitch. The + screen-update code will refrain from drawing a highlight if the + magic- cookie unattributed spaces required just before the + beginning and after the end would step on a non-space character. + It will automatically shift highlight boundaries when doing so + would make it possible to draw the highlight without changing the + visual appearance of the screen. + * It is possible to generate the library with a list of pre-loaded + fallback entries linked to it so that it can serve those terminal + types even when no terminfo tree or termcap file is accessible + (this may be useful for support of screen-oriented programs that + must run in single-user mode). + * The tic(1)/captoinfo utility provided with ncurses has the ability + to translate many termcaps from the XENIX, IBM and AT&T extension + sets. + * A BSD-like tset(1) utility is provided. + * The ncurses library and utilities will automatically read terminfo + entries from $HOME/.terminfo if it exists, and compile to that + directory if it exists and the user has no write access to the + system directory. This feature makes it easier for users to have + personal terminfo entries without giving up access to the system + terminfo directory. + * You may specify a path of directories to search for compiled + descriptions with the environment variable TERMINFO_DIRS (this + generalizes the feature provided by TERMINFO under stock System + V.) + * In terminfo source files, use capabilities may refer not just to + other entries in the same source file (as in System V) but also to + compiled entries in either the system terminfo directory or the + user's $HOME/.terminfo directory. + * A script (capconvert) is provided to help BSD users transition + from termcap to terminfo. It gathers the information in a TERMCAP + environment variable and/or a ~/.termcap local entries file and + converts it to an equivalent local terminfo tree under + $HOME/.terminfo. + * Automatic fallback to the /etc/termcap file can be compiled in + when it is not possible to build a terminfo tree. This feature is + neither fast nor cheap, you don't want to use it unless you have + to, but it's there. + * The table-of-entries utility toe makes it easy for users to see + exactly what terminal types are available on the system. + * The library 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. + * An HTML "Introduction to Programming with NCURSES" document + provides a narrative introduction to the curses programming + interface. + + State of the Package + + Numerous bugs present in earlier versions have been fixed; the library + is far more reliable than it used to be. Bounds checking in many + `dangerous' entry points has been improved. The code is now type-safe + according to gcc -Wall. The library has been checked for malloc leaks + and arena corruption by the Purify memory-allocation tester. + + The ncurses code has been tested with a wide variety of applications + including (versions starting with those noted): + + ded + directory-editor [3]ftp://ftp.clark.net/pub/dickey/ded. + + dialog + the underlying application used in Slackware's setup, and the + basis for similar applications on GNU/Linux. + + lynx-2.7 + the character-screen WWW browser + + Midnight Commander 4.1 + file manager + + mutt 0.88 + mail utility + + ncftp 2.0 + file-transfer utility + + nvi + New vi versions 1.50 are able to use ncurses versions 1.9.7 and + later. + + taper + tape archive utility + + vh-1.6 + Volks-Hypertext browser for the Jargon File + + as well as some that use ncurses for the terminfo support alone: + + minicom-1.75 + terminal emulator + + tin-unoff + tin 1.4 newsreader, supporting color, MIME + [4]ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff. + + vile + vi-like-emacs [5]ftp://ftp.clark.net/pub/dickey/vile. + + The ncurses distribution includes a selection of test programs + (including a few games). + +Who's Who and What's What + + The original developers of ncurses are [6]Zeyd Ben-Halim and [7]Eric + S. Raymond. Ongoing work is being done by [8]Thomas Dickey and + [9]Jürgen Pfeifer. [10]Florian La Roche acts as the maintainer for the + Free Software Foundation, which holds the copyright on ncurses. + Contact the current maintainers at [11]bug-ncurses@gnu.org. + + To join the ncurses mailing list, please write email to + bug-ncurses-request@gnu.org containing the line: + subscribe <name>@<host.domain> + + This list is open to anyone interested in helping with the development + and testing of this package. + + Beta versions of ncurses and patches to the current release are made + available at [12]ftp://ftp.clark.net/pub/dickey/ncurses. + +Future Plans + + * Extended-level XPG4 conformance, with internationalization + support. + * Ports to more systems, including DOS and Windows. + + We need people to help with these projects. If you are interested in + working on them, please join the ncurses list. + +Other Related Resources + + The distribution includes and uses a version of the terminfo-format + terminal description file maintained by Eric Raymond. + [13]http://earthspace.net/~esr/terminfo. + + You can find lots of information on terminal-related topics not + covered in the terminfo file at [14]Richard Shuford's archive. + +References + + 1. ftp://ftp.gnu.org/pub/gnu + 2. ftp://ftp.clark.net/pub/dickey/ncurses + 3. ftp://ftp.clark.net/pub/dickey/ded + 4. ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff + 5. ftp://ftp.clark.net/pub/dickey/vile + 6. mailto:zmbenhal@netcom.com + 7. http://www.ccil.org/~esr/home.html + 8. mailto:dickey@clark.net + 9. mailto:juergen.pfeifer@gmx.net + 10. mailto:florian@gnu.org + 11. mailto:bug-ncurses@gnu.org + 12. ftp://ftp.clark.net/pub/dickey/ncurses + 13. http://earthspace.net/~esr/terminfo + 14. http://www.cs.utk.edu/~shuford/terminal_index.html diff --git a/contrib/ncurses/INSTALL b/contrib/ncurses/INSTALL new file mode 100644 index 000000000000..2ad50f6d9d73 --- /dev/null +++ b/contrib/ncurses/INSTALL @@ -0,0 +1,481 @@ +-- $Id: INSTALL,v 1.32 1999/07/24 21:06:24 tom Exp $ +--------------------------------------------------------------------- + How to install Ncurses/Terminfo on your system +--------------------------------------------------------------------- + ************************************************************ + * READ ALL OF THIS FILE BEFORE YOU TRY TO INSTALL NCURSES. * + ************************************************************ + +You should be reading the file INSTALL in a directory called ncurses-d.d, where +d.d is the current version number. There should be several subdirectories, +including `c++', `form', `man', `menu', 'misc', `ncurses', `panel', `progs', +and `test'. See the README file for a roadmap to the package. + +If you are a Linux or FreeBSD or NetBSD distribution integrator or packager, +please read and act on the section titled IF YOU ARE A SYSTEM INTEGRATOR +below. + +If you are converting from BSD curses and do not have root access, be sure +to read the BSD CONVERSION NOTES section below. + +If you are using a version of XFree86 xterm older than 3.1.2F, see the section +on RECENT XTERM VERSIONS below. + +If you are trying to build GNU Emacs using ncurses for terminal support, +read the USING NCURSES WITH EMACS section below. + +If you are trying to build applications using gpm with ncurses, +read the USING NCURSES WITH GPM section below. + +If you are trying to build Elvis using ncurses for terminal support, +read the USING NCURSES WITH ELVIS section below. + +If you are running over the Andrew File System see the note below on +USING NCURSES WITH AFS. + +If you want to build the Ada95 binding, go to the Ada95 directory and +follow the instructions there. The Ada95 binding is not covered below. + +If you are using anything but (a) Linux, or (b) one of the 4.4BSD-based +i386 Unixes, go read the Portability section in the TO-DO file before you +do anything else. + +REQUIREMENTS: + +You will need the following in order to build and install ncurses under UNIX: + + * ANSI C compiler (gcc is recommended) + * sh (bash will do) + * awk (mawk or gawk will do) + * sed + * BSD or System V style install (a script is enclosed) + +Ncurses has been also built in the OS/2 EMX environment. + +INSTALLATION PROCEDURE: + +1. First, decide whether you want ncurses to replace your existing library (in + which case you'll need super-user privileges) or be installed in parallel + with it. + + The --prefix option to configure changes the root directory for installing + ncurses. The default is in subdirectories of /usr/local. Use + --prefix=/usr to replace your default curses distribution. This is the + default for Linux and BSD/OS users. + + The package gets installed beneath the --prefix directory as follows: + + In $(prefix)/bin: tic, infocmp, captoinfo, tset, + reset, clear, tput, toe + In $(prefix)/lib: libncurses*.* libcurses.a + In $(prefix)/share/terminfo: compiled terminal descriptions + In $(prefix)/include: C header files + Under $(prefix)/man: the manual pages + + Note however that the configure script attempts to locate previous + installation of ncurses, and will set the default prefix according to where + it finds the ncurses headers. + +2. Type `./configure' in the top-level directory of the distribution to + configure ncurses for your operating system and create the Makefiles. + Besides --prefix, various configuration options are available to customize + the installation; use `./configure --help' to list the available options. + + If your operating system is not supported, read the PORTABILITY section in + the file ncurses/README for information on how to create a configuration + file for your system. + + The `configure' script generates makefile rules for one or more object + models and their associated libraries: + + libncurses.a (normal) + + libcurses.a (normal, a link to libncurses.a) + This gets left out if you configure with --disable-overwrite. + + libncurses.so (shared) + + libncurses_g.a (debug) + + libncurses_p.a (profile) + + If you do not specify any models, the normal and debug libraries will be + configured. Typing `configure' with no arguments is equivalent to: + + ./configure --with-normal --with-debug --enable-overwrite + + Typing + + ./configure --with-shared + + makes the shared libraries the default, resulting in + + ./configure --with-shared --with-normal --with-debug --enable-overwrite + + If you want only shared libraries, type + + ./configure --with-shared --without-normal --without-debug + + Rules for generating shared libraries are highly dependent upon the choice + of host system and compiler. We've been testing shared libraries on Linux + and SunOS with gcc, but more work needs to be done to make shared libraries + work on other systems. + + 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 + also interpret the contents of the TERM environment variable. See the + section BSD CONVERSION NOTES below. + +3. Type `make'. Ignore any warnings, no error messages should be produced. + This should compile the ncurses library, the terminfo compiler tic(1), + captoinfo(1), infocmp(1), toe(1), clear(1) tset(1), reset(1), and tput(1) + programs (see the man pages for explanation of what they do), some test + programs, and the panels, menus, and forms libraries. + +4. Run ncurses and several other test programs in the test directory to + verify that ncurses functions correctly before doing an install that + may overwrite system files. Read the file test/README for details on + the test programs. + + NOTE: You must have installed the terminfo database, or set the + environment variable $TERMINFO to point to a SVr4-compatible terminfo + database before running the test programs. Not all vendors' terminfo + databases are SVr4-compatible, but most seem to be. Exceptions include + DEC's Digital Unix (formerly known as OSF/1). + + The ncurses program is designed specifically to test the ncurses library. + You can use it to verify that the screen highlights work correctly, that + cursor addressing and window scrolling works OK, etc. + +5. Once you've tested, you can type `make install' to install libraries, + the programs, the terminfo database and the man pages. Alternately, you + can type `make install' in each directory you want to install. In the + top-level directory, you can do a partial install using these commands: + + 'make install.progs' installs tic, infocmp, etc... + 'make install.includes' installs the headers. + 'make install.libs' installs the libraries (and the headers). + 'make install.data' installs the terminfo data. (Note: `tic' must + be installed before the terminfo data can be + compiled). + 'make install.man' installs the man pages. + + ############################################################################ + # CAVEAT EMPTOR: `install.data' run as root will NUKE any existing # + # terminfo database. If you have any custom or unusual entries SAVE them # + # before you install ncurses. I have a file called terminfo.custom for # + # this purpose. Don't forget to run tic on the file once you're done. # + ############################################################################ + + The terminfo(5) manual page wants to 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 man page + to be sure. + + 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 + between it and ncurses. If ncurses is installed outside the standard + directories (/usr/include and /usr/lib) then all your users will need + to use the -I option to compile programs and -L to link them. + + If you have BSD curses installed in your system and you accidentally + compile using its curses.h you'll end up with a large number of + undefined symbols at link time. _waddbytes is one of them. + + IF YOU DO NOT HAVE ROOT: Change directory to the `progs' subdirectory + and run the `capconvert' script. This script will deduce various things + about your environment and use them to build you a private terminfo tree, + so you can use ncurses applications. + + If more than one user at your site does this, the space for the duplicate + trees is wasted. Try to get your site administrators to install a system- + wide terminfo tree instead. + + See the BSD CONVERSION NOTES section below for a few more details. + +6. The c++ directory has C++ classes that are built on top of ncurses and + panels. You need to have c++ (and its libraries) installed before you can + compile and run the demo. + + If you do not have C++, you must use the --without-cxx option to tell + the configure script to not attempt to build the C++ bindings. + +7. If you're running an older Linux, you must either (a) tell Linux that the + console terminal type is `linux' or (b) make a link to or copy of the + linux entry in the appropriate place under your terminfo directory, named + `console'. All 1.3 and many 1.2 distributions (including Yggdrasil and + Red Hat) already have the console type set to `linux'. + + The way to change the wired-in console type depends on the configuration + of your system. This may involve editing /etc/inittab, /etc/ttytype, + /etc/profile and other such files. + + Warning: this is not for the fainthearted, if you mess up your console + getty entries you can make your system unusable! However, if you are + a distribution maker, this is the right thing to do (see the note for + integrators near the end of this file). + + The easier way is to link or copy l/linux to c/console under your terminfo + directory. Note: this will go away next time you do `make install.data' + and you'll have to redo it. There is no need to have entries for all + possible screen sizes, ncurses will figure out the size automatically. + +IF YOU ARE A SYSTEM INTEGRATOR: + + Beginning with 1.9.9, the ncurses distribution includes both a tset + utility and /usr/share/tabset directory. If you are installing ncurses, + it is no longer either necessary or desirable to install tset-jv. + + Configuration and Installation: + + Configure with --prefix=/usr to make the install productions put + libraries and headers in the correct locations (overwriting any + previous curses libraries and headers). This will put the terminfo + hierarchy under /usr/share/terminfo; you may want to override this with + --datadir=/usr/share/misc; terminfo and tabset are installed under the + data directory. + + Please configure the ncurses library in a pure-terminfo mode; that + is, with the --disable-termcap option. This will make the ncurses + library smaller and faster. The ncurses library includes a termcap + emulation that queries the terminfo database, so even applications + that use raw termcap to query terminal characteristics will win + (providing you recompile and relink them!). + + If you must configure with termcap fallback enabled, you may also + wish to use the --enable-getcap option. This option speeds up + termcap-based startups, at the expense of not allowing personal + termcap entries to reference the terminfo tree. See the code in + ncurses/tinfo/read_termcap.c for details. + + Note that if you have $TERMCAP set, ncurses will use that value + to locate termcap data. In particular, running from xterm will + set $TERMCAP to the contents of the xterm's termcap entry. + If ncurses sees that, it will not examine /etc/termcap. + + Keyboard Mapping: + + The terminfo file assumes that Shift-Tab generates \E[Z (the ECMA-48 + reverse-tabulation sequence) rather than ^I. Here are the loadkeys -d + mappings that will set this up: + + keycode 15 = Tab Tab + alt keycode 15 = Meta_Tab + shift keycode 15 = F26 + string F26 ="\033[Z" + + Naming the Console Terminal + + In various Linuxes (and possibly elsewhere) there has been a practice + of designating the system console driver type as `console'. Please + do not do this any more! It complicates peoples' lives, because it + can mean that several different terminfo entries from different + operating systems all logically want to be called `console'. + + Please pick a name unique to your console driver and set that up + in the /etc/inittab table or local equivalent. Send the entry to the + terminfo maintainer (listed in the misc/terminfo file) to be included + in the terminfo file, if it's not already there. See the + term(7) manual page included with this distribution for more on + conventions for choosing type names. + + Here are some recommended primary console names: + + linux -- Linux console driver + freebsd -- FreeBSD + netbsd -- NetBSD + bsdos -- BSD/OS + + If you are responsible for integrating ncurses for one of these + distribution, please either use the recommended name or get back + to us explaining why you don't want to, so we can work out nomenclature + that will make users' lives easier rather than harder. + +RECENT XTERM VERSIONS + The terminfo database file included with this distribution assumes you + are running an XFree86 xterm based on X11R6 (i.e., xterm-r6). The + earlier X11R5 entry (xterm-r5) is provided as well. + + If you are running XFree86 version 3.2 (actually 3.1.2F and up), you + should consider using the xterm-xf86-v32 (or later, the most recent + version is always named "xterm-xfree86") entry, which adds ANSI color + and the VT220 capabilities which have been added in XFree86. If you + are running a mixed network, however, where this terminal description + may be used on an older xterm, you may have problems, since + applications that assume these capabilities will produce incorrect + output on the older xterm (e.g., highlighting is not cleared). + +CONFIGURING FALLBACK ENTRIES + In order to support operation of ncurses programs before the terminfo + tree is accessible (that is, in single-user mode or at OS installation + time) the ncurses library can be compiled to include an array of + pre-fetched fallback entries. + + These entries are checked by setupterm() only when the conventional + fetches from the terminfo tree and the termcap fallback (if configured) + have been tried and failed. Thus, the presence of a fallback will not + shadow modifications to the on-disk entry for the same type, when that + entry is accessible. + + By default, there are no entries on the fallback list. After you + have built the ncurses suite for the first time, you can change + the list (the process needs infocmp(1)). To do so, use the script + MKfallback.sh. A configure script option --with-fallbacks does this + (it accepts a comma-separated list of the names you wish, and does + not require a rebuild). + + If you wanted (say) to have linux, vt100, and xterm fallbacks, you + would use the commands + + cd ncurses; + MKfallback.sh linux vt100 xterm >fallback.c + + Then just rebuild and reinstall the library as you would normally. + You can restore the default empty fallback list with + + MKfallback.sh >fallback.c + + The overhead for an empty fallback list is one trivial stub function. + Any non-empty fallback list is const-ed and therefore lives in sharable + text space. You can look at the comment trailing each initializer in + the generated ncurses/fallback.c file to see the core cost of the + fallbacks. A good rule of thumb for modern vt100-like entries is that + each one will cost about 2.5K of text space. + +BSD CONVERSION NOTES: + If you need to support really ancient BSD programs, you probably + want to configure with the --enable-bsdpad option. What this does + is enable code in tputs() that recognizes a numeric prefix on a + capability as a request for that much trailing padding in milliseconds. + There are old BSD programs that do things like tputs("50"). + + (If you are distributing ncurses as a support-library component of + an application you probably want to put the remainder of this section + in the package README file.) + + The following note applies only if you have configured ncurses with + --enable-termcap. + +------------------------------- CUT HERE -------------------------------- + +If you are installing this application privately (either because you +have no root access or want to experiment with it before doing a root +installation), there are a couple of details you need to be aware of. +They have to do with the ncurses library, which uses terminfo rather +than termcap for describing terminal characteristics. + +Though the ncurses library is terminfo-based, it will interpret your +TERMCAP variable (if present), any local termcap files you reference +through it, and the system termcap file. However, in order to avoid +slowing down your application startup, it will only do this once per +terminal type! + +The first time you load a given terminal type from your termcap +database, the library initialization code will automatically write it +in terminfo format to a subdirectory under $HOME/.terminfo. After +that, the initialization code will find it there and do a (much +faster) terminfo fetch. + +Usually, all this means is that your home directory will silently grow +an invisible .terminfo subdirectory which will get filled in with +terminfo descriptions of terminal types as you invoke them. If anyone +ever installs a global terminfo tree on your system, this will quietly +stop happening and your $HOME/.terminfo will become redundant. + +The objective of all this logic is to make converting from BSD termcap +as painless as possible without slowing down your application (termcap +compilation is expensive). + +If you don't have a TERMCAP variable or custom personal termcap file, +you can skip the rest of this dissertation. + +If you *do* have a TERMCAP variable and/or a custom personal termcap file +that defines a terminal type, that definition will stop being visible +to this application after the first time you run it, because it will +instead see the terminfo entry that it wrote to $HOME/terminfo the +first time around. + +Subsequently, editing the TERMCAP variable or personal TERMCAP file +will have no effect unless you explicitly remove the terminfo entry +under $HOME/terminfo. If you do that, the entry will be recompiled +from your termcap resources the next time it is invoked. + +To avoid these complications, use infocmp(1) and tic(1) to edit the +terminfo directory directly. + +------------------------------- CUT HERE -------------------------------- + +USING NCURSES WITH AFS: + AFS treats each directory as a separate logical filesystem, you + can't hard-link across them. The --enable-symlinks option copes + with this by making tic use symbolic links. + +USING NCURSES WITH EMACS: + GNU Emacs has its own termcap support. By default, it uses a mixture + of those functions and code linked from the host system's libraries. + You need to foil this and shut out the GNU termcap library entirely. + + In order to do this, hack the Linux config file (s/linux.h) to contain + a #define TERMINFO and set the symbol LIBS_TERMCAP to "-lncurses". + + We have submitted such a change for the 19.30 release, so it may + already be applied in your sources -- check for the #define TERMINFO. + +USING NCURSES WITH GPM: + Ncurses 4.1 and up can be configured to use GPM (General Purpose Mouse) + which is used on Linux console. Be aware that GPM is commonly + installed as a shared library which contains a wrapper for the curses + wgetch() function (libcurses.o). Some integrators have simplified + linking applications by combining all of libcurses.so (the BSD curses) + into the libgpm.so file, producing symbol conflicts with ncurses. You + may be able to work around this problem by linking as follows: + + cc -o foo foo.o -lncurses -lgpm -lncurses + + but the linker may not cooperate, producing mysterious errors. + A patched version of gpm is available: + + ftp.clark.net:/pub/dickey/ncurses/gpm-1.10-970125.tgz + + This patch is incorporated in gpm 1.12; however some integrators + are slow to update this library. + +USING NCURSES WITH ELVIS: + To use ncurses as the screen-painting library for Elvis, apply the + following patch to the Elvis curses + +*** curses.c.orig Sun Jun 26 05:48:23 1994 +--- curses.c Sun Feb 11 16:50:41 1996 +*************** +*** 986,992 **** + { + if (has_IM) + do_IM(); +! do_IC(); + qaddch(ch); + if (has_EI) + do_EI(); +--- 986,995 ---- + { + if (has_IM) + do_IM(); +!#ifdef NCURSES_VERSION +! else /* ncurses does insertion in a slightly nonstandard way */ +!#endif +! do_IC(); + qaddch(ch); + if (has_EI) + do_EI(); + +This patch is for elvis-1.8pl4 but it can even be used for elvis-1.8pl3 with +an offset of -11 lines. + +BUGS: + Send any feedback to the ncurses mailing list at + bug-ncurses@gnu.org. To subscribe send mail to + bug-ncurses-request@gnu.org with body that reads: + subscribe ncurses <your-email-address-here> + + The Hacker's Guide in the misc directory includes some guidelines + on how to report bugs in ways that will get them fixed most quickly. diff --git a/contrib/ncurses/MANIFEST b/contrib/ncurses/MANIFEST new file mode 100644 index 000000000000..0340c7d14953 --- /dev/null +++ b/contrib/ncurses/MANIFEST @@ -0,0 +1,798 @@ +./ANNOUNCE +./Ada95/Makefile.in +./Ada95/README +./Ada95/TODO +./Ada95/gen/Makefile.in +./Ada95/gen/gen.c +./Ada95/gen/normal.m4 +./Ada95/gen/terminal_interface-curses-aux.ads.m4 +./Ada95/gen/terminal_interface-curses-forms-field_types.ads.m4 +./Ada95/gen/terminal_interface-curses-forms-field_user_data.ads.m4 +./Ada95/gen/terminal_interface-curses-forms-form_user_data.ads.m4 +./Ada95/gen/terminal_interface-curses-forms.ads.m4 +./Ada95/gen/terminal_interface-curses-menus-item_user_data.ads.m4 +./Ada95/gen/terminal_interface-curses-menus-menu_user_data.ads.m4 +./Ada95/gen/terminal_interface-curses-menus.ads.m4 +./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.ads.m4 +./Ada95/html/ada/files.htm +./Ada95/html/ada/files/T.htm +./Ada95/html/ada/funcs.htm +./Ada95/html/ada/funcs/A.htm +./Ada95/html/ada/funcs/C.htm +./Ada95/html/ada/funcs/E.htm +./Ada95/html/ada/funcs/F.htm +./Ada95/html/ada/funcs/G.htm +./Ada95/html/ada/funcs/I.htm +./Ada95/html/ada/funcs/L.htm +./Ada95/html/ada/funcs/M.htm +./Ada95/html/ada/funcs/N.htm +./Ada95/html/ada/funcs/P.htm +./Ada95/html/ada/funcs/R.htm +./Ada95/html/ada/funcs/S.htm +./Ada95/html/ada/funcs/T.htm +./Ada95/html/ada/funcs/U.htm +./Ada95/html/ada/funcs/V.htm +./Ada95/html/ada/index.htm +./Ada95/html/ada/main.htm +./Ada95/html/ada/terminal_interface-curses-forms-field_types-alpha__ads.htm +./Ada95/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__ads.htm +./Ada95/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm +./Ada95/html/ada/terminal_interface-curses-forms-field_types-enumeration__ads.htm +./Ada95/html/ada/terminal_interface-curses-forms-field_types-intfield__ads.htm +./Ada95/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__ads.htm +./Ada95/html/ada/terminal_interface-curses-forms-field_types-numeric__ads.htm +./Ada95/html/ada/terminal_interface-curses-forms-field_types-regexp__ads.htm +./Ada95/html/ada/terminal_interface-curses-forms-field_types-user-choice__ads.htm +./Ada95/html/ada/terminal_interface-curses-forms-field_types-user__ads.htm +./Ada95/html/ada/terminal_interface-curses-forms-field_types__ads.htm +./Ada95/html/ada/terminal_interface-curses-forms-field_user_data__ads.htm +./Ada95/html/ada/terminal_interface-curses-forms-form_user_data__ads.htm +./Ada95/html/ada/terminal_interface-curses-forms__ads.htm +./Ada95/html/ada/terminal_interface-curses-menus-item_user_data__ads.htm +./Ada95/html/ada/terminal_interface-curses-menus-menu_user_data__ads.htm +./Ada95/html/ada/terminal_interface-curses-menus__ads.htm +./Ada95/html/ada/terminal_interface-curses-mouse__ads.htm +./Ada95/html/ada/terminal_interface-curses-panels-user_data__ads.htm +./Ada95/html/ada/terminal_interface-curses-panels__ads.htm +./Ada95/html/ada/terminal_interface-curses-text_io-complex_io__ads.htm +./Ada95/html/ada/terminal_interface-curses-text_io-decimal_io__ads.htm +./Ada95/html/ada/terminal_interface-curses-text_io-enumeration_io__ads.htm +./Ada95/html/ada/terminal_interface-curses-text_io-fixed_io__ads.htm +./Ada95/html/ada/terminal_interface-curses-text_io-float_io__ads.htm +./Ada95/html/ada/terminal_interface-curses-text_io-integer_io__ads.htm +./Ada95/html/ada/terminal_interface-curses-text_io-modular_io__ads.htm +./Ada95/html/ada/terminal_interface-curses-text_io__ads.htm +./Ada95/html/ada/terminal_interface-curses__ads.htm +./Ada95/html/ada/terminal_interface__ads.htm +./Ada95/html/index.html +./Ada95/html/man/curs_addch.3x.html +./Ada95/html/man/curs_addchstr.3x.html +./Ada95/html/man/curs_addstr.3x.html +./Ada95/html/man/curs_attr.3x.html +./Ada95/html/man/curs_beep.3x.html +./Ada95/html/man/curs_bkgd.3x.html +./Ada95/html/man/curs_border.3x.html +./Ada95/html/man/curs_clear.3x.html +./Ada95/html/man/curs_color.3x.html +./Ada95/html/man/curs_delch.3x.html +./Ada95/html/man/curs_deleteln.3x.html +./Ada95/html/man/curs_getch.3x.html +./Ada95/html/man/curs_getstr.3x.html +./Ada95/html/man/curs_getyx.3x.html +./Ada95/html/man/curs_inch.3x.html +./Ada95/html/man/curs_inchstr.3x.html +./Ada95/html/man/curs_initscr.3x.html +./Ada95/html/man/curs_inopts.3x.html +./Ada95/html/man/curs_insch.3x.html +./Ada95/html/man/curs_insstr.3x.html +./Ada95/html/man/curs_instr.3x.html +./Ada95/html/man/curs_kernel.3x.html +./Ada95/html/man/curs_mouse.3x.html +./Ada95/html/man/curs_move.3x.html +./Ada95/html/man/curs_outopts.3x.html +./Ada95/html/man/curs_overlay.3x.html +./Ada95/html/man/curs_pad.3x.html +./Ada95/html/man/curs_print.3x.html +./Ada95/html/man/curs_printw.3x.html +./Ada95/html/man/curs_refresh.3x.html +./Ada95/html/man/curs_scanw.3x.html +./Ada95/html/man/curs_scr_dmp.3x.html +./Ada95/html/man/curs_scr_dump.3x.html +./Ada95/html/man/curs_scroll.3x.html +./Ada95/html/man/curs_slk.3x.html +./Ada95/html/man/curs_termattrs.3x.html +./Ada95/html/man/curs_termcap.3x.html +./Ada95/html/man/curs_terminfo.3x.html +./Ada95/html/man/curs_touch.3x.html +./Ada95/html/man/curs_util.3x.html +./Ada95/html/man/curs_window.3x.html +./Ada95/html/man/define_key.3x.html +./Ada95/html/man/dft_fgbg.3x.html +./Ada95/html/man/form.3x.html +./Ada95/html/man/form_cursor.3x.html +./Ada95/html/man/form_data.3x.html +./Ada95/html/man/form_driver.3x.html +./Ada95/html/man/form_field.3x.html +./Ada95/html/man/form_field_attributes.3x.html +./Ada95/html/man/form_field_buffer.3x.html +./Ada95/html/man/form_field_info.3x.html +./Ada95/html/man/form_field_just.3x.html +./Ada95/html/man/form_field_new.3x.html +./Ada95/html/man/form_field_opts.3x.html +./Ada95/html/man/form_field_userptr.3x.html +./Ada95/html/man/form_field_validation.3x.html +./Ada95/html/man/form_fieldtype.3x.html +./Ada95/html/man/form_hook.3x.html +./Ada95/html/man/form_new.3x.html +./Ada95/html/man/form_new_page.3x.html +./Ada95/html/man/form_opts.3x.html +./Ada95/html/man/form_page.3x.html +./Ada95/html/man/form_post.3x.html +./Ada95/html/man/form_requestname.3x.html +./Ada95/html/man/form_userptr.3x.html +./Ada95/html/man/form_win.3x.html +./Ada95/html/man/keyok.3x.html +./Ada95/html/man/menu.3x.html +./Ada95/html/man/menu_attribs.3x.html +./Ada95/html/man/menu_cursor.3x.html +./Ada95/html/man/menu_driver.3x.html +./Ada95/html/man/menu_format.3x.html +./Ada95/html/man/menu_hook.3x.html +./Ada95/html/man/menu_items.3x.html +./Ada95/html/man/menu_mark.3x.html +./Ada95/html/man/menu_new.3x.html +./Ada95/html/man/menu_opts.3x.html +./Ada95/html/man/menu_pattern.3x.html +./Ada95/html/man/menu_post.3x.html +./Ada95/html/man/menu_requestname.3x.html +./Ada95/html/man/menu_spacing.3x.html +./Ada95/html/man/menu_userptr.3x.html +./Ada95/html/man/menu_win.3x.html +./Ada95/html/man/mitem_current.3x.html +./Ada95/html/man/mitem_name.3x.html +./Ada95/html/man/mitem_new.3x.html +./Ada95/html/man/mitem_opts.3x.html +./Ada95/html/man/mitem_userptr.3x.html +./Ada95/html/man/mitem_value.3x.html +./Ada95/html/man/mitem_visible.3x.html +./Ada95/html/man/ncurses.3x.html +./Ada95/html/man/panel.3x.html +./Ada95/html/man/resizeterm.3x.html +./Ada95/html/man/wresize.3x.html +./Ada95/html/table.html +./Ada95/samples/Makefile.in +./Ada95/samples/README +./Ada95/samples/explain.txt +./Ada95/samples/rain.adb +./Ada95/samples/rain.ads +./Ada95/samples/sample-curses_demo-attributes.adb +./Ada95/samples/sample-curses_demo-attributes.ads +./Ada95/samples/sample-curses_demo-mouse.adb +./Ada95/samples/sample-curses_demo-mouse.ads +./Ada95/samples/sample-curses_demo.adb +./Ada95/samples/sample-curses_demo.ads +./Ada95/samples/sample-explanation.adb +./Ada95/samples/sample-explanation.ads +./Ada95/samples/sample-form_demo-aux.adb +./Ada95/samples/sample-form_demo-aux.ads +./Ada95/samples/sample-form_demo-handler.adb +./Ada95/samples/sample-form_demo-handler.ads +./Ada95/samples/sample-form_demo.adb +./Ada95/samples/sample-form_demo.ads +./Ada95/samples/sample-function_key_setting.adb +./Ada95/samples/sample-function_key_setting.ads +./Ada95/samples/sample-header_handler.adb +./Ada95/samples/sample-header_handler.ads +./Ada95/samples/sample-helpers.adb +./Ada95/samples/sample-helpers.ads +./Ada95/samples/sample-keyboard_handler.adb +./Ada95/samples/sample-keyboard_handler.ads +./Ada95/samples/sample-manifest.ads +./Ada95/samples/sample-menu_demo-aux.adb +./Ada95/samples/sample-menu_demo-aux.ads +./Ada95/samples/sample-menu_demo-handler.adb +./Ada95/samples/sample-menu_demo-handler.ads +./Ada95/samples/sample-menu_demo.adb +./Ada95/samples/sample-menu_demo.ads +./Ada95/samples/sample-my_field_type.adb +./Ada95/samples/sample-my_field_type.ads +./Ada95/samples/sample-text_io_demo.adb +./Ada95/samples/sample-text_io_demo.ads +./Ada95/samples/sample.adb +./Ada95/samples/sample.ads +./Ada95/samples/status.adb +./Ada95/samples/status.ads +./Ada95/samples/tour.adb +./Ada95/samples/tour.ads +./Ada95/src/Makefile.in +./Ada95/src/terminal_interface-curses-aux.adb +./Ada95/src/terminal_interface-curses-forms-field_types-alpha.adb +./Ada95/src/terminal_interface-curses-forms-field_types-alpha.ads +./Ada95/src/terminal_interface-curses-forms-field_types-alphanumeric.adb +./Ada95/src/terminal_interface-curses-forms-field_types-alphanumeric.ads +./Ada95/src/terminal_interface-curses-forms-field_types-enumeration-ada.adb +./Ada95/src/terminal_interface-curses-forms-field_types-enumeration-ada.ads +./Ada95/src/terminal_interface-curses-forms-field_types-enumeration.adb +./Ada95/src/terminal_interface-curses-forms-field_types-enumeration.ads +./Ada95/src/terminal_interface-curses-forms-field_types-intfield.adb +./Ada95/src/terminal_interface-curses-forms-field_types-intfield.ads +./Ada95/src/terminal_interface-curses-forms-field_types-ipv4_address.adb +./Ada95/src/terminal_interface-curses-forms-field_types-ipv4_address.ads +./Ada95/src/terminal_interface-curses-forms-field_types-numeric.adb +./Ada95/src/terminal_interface-curses-forms-field_types-numeric.ads +./Ada95/src/terminal_interface-curses-forms-field_types-regexp.adb +./Ada95/src/terminal_interface-curses-forms-field_types-regexp.ads +./Ada95/src/terminal_interface-curses-forms-field_types-user-choice.adb +./Ada95/src/terminal_interface-curses-forms-field_types-user-choice.ads +./Ada95/src/terminal_interface-curses-forms-field_types-user.adb +./Ada95/src/terminal_interface-curses-forms-field_types-user.ads +./Ada95/src/terminal_interface-curses-forms-field_types.adb +./Ada95/src/terminal_interface-curses-forms-field_user_data.adb +./Ada95/src/terminal_interface-curses-forms-form_user_data.adb +./Ada95/src/terminal_interface-curses-forms.adb +./Ada95/src/terminal_interface-curses-menus-item_user_data.adb +./Ada95/src/terminal_interface-curses-menus-menu_user_data.adb +./Ada95/src/terminal_interface-curses-menus.adb +./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-text_io-aux.adb +./Ada95/src/terminal_interface-curses-text_io-aux.ads +./Ada95/src/terminal_interface-curses-text_io-complex_io.adb +./Ada95/src/terminal_interface-curses-text_io-complex_io.ads +./Ada95/src/terminal_interface-curses-text_io-decimal_io.adb +./Ada95/src/terminal_interface-curses-text_io-decimal_io.ads +./Ada95/src/terminal_interface-curses-text_io-enumeration_io.adb +./Ada95/src/terminal_interface-curses-text_io-enumeration_io.ads +./Ada95/src/terminal_interface-curses-text_io-fixed_io.adb +./Ada95/src/terminal_interface-curses-text_io-fixed_io.ads +./Ada95/src/terminal_interface-curses-text_io-float_io.adb +./Ada95/src/terminal_interface-curses-text_io-float_io.ads +./Ada95/src/terminal_interface-curses-text_io-integer_io.adb +./Ada95/src/terminal_interface-curses-text_io-integer_io.ads +./Ada95/src/terminal_interface-curses-text_io-modular_io.adb +./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.adb +./Ada95/src/terminal_interface.ads +./INSTALL +./MANIFEST +./Makefile.glibc +./Makefile.in +./Makefile.os2 +./NEWS +./README +./README.emx +./README.glibc +./TO-DO +./aclocal.m4 +./announce.html +./announce.html.in +./c++/Makefile.in +./c++/NEWS +./c++/PROBLEMS +./c++/README-first +./c++/cursesapp.cc +./c++/cursesapp.h +./c++/cursesf.cc +./c++/cursesf.h +./c++/cursesm.cc +./c++/cursesm.h +./c++/cursesmain.cc +./c++/cursesp.cc +./c++/cursesp.h +./c++/cursespad.cc +./c++/cursesw.cc +./c++/cursesw.h +./c++/cursslk.cc +./c++/cursslk.h +./c++/demo.cc +./c++/edit_cfg.sh +./c++/etip.h.in +./c++/headers +./c++/internal.h +./c++/modules +./config.guess +./config.sub +./configure +./configure.in +./convert_configure.pl +./dist.mk +./form/Makefile.in +./form/READ.ME +./form/fld_arg.c +./form/fld_attr.c +./form/fld_current.c +./form/fld_def.c +./form/fld_dup.c +./form/fld_ftchoice.c +./form/fld_ftlink.c +./form/fld_info.c +./form/fld_just.c +./form/fld_link.c +./form/fld_max.c +./form/fld_move.c +./form/fld_newftyp.c +./form/fld_opts.c +./form/fld_pad.c +./form/fld_page.c +./form/fld_stat.c +./form/fld_type.c +./form/fld_user.c +./form/form.h +./form/form.priv.h +./form/frm_cursor.c +./form/frm_data.c +./form/frm_def.c +./form/frm_driver.c +./form/frm_hook.c +./form/frm_opts.c +./form/frm_page.c +./form/frm_post.c +./form/frm_req_name.c +./form/frm_scale.c +./form/frm_sub.c +./form/frm_user.c +./form/frm_win.c +./form/fty_alnum.c +./form/fty_alpha.c +./form/fty_enum.c +./form/fty_int.c +./form/fty_ipv4.c +./form/fty_num.c +./form/fty_regex.c +./form/headers +./form/llib-lform +./form/modules +./include/Caps +./include/MKhashsize.sh +./include/MKparametrized.sh +./include/MKterm.h.awk.in +./include/Makefile.in +./include/capdefaults.c +./include/curses.h.in +./include/edit_cfg.sh +./include/headers +./include/nc_alloc.h +./include/nc_panel.h +./include/ncurses_cfg.hin +./include/term_entry.h +./include/termcap.h.in +./include/tic.h +./include/unctrl.h.in +./install-sh +./man/MKterminfo.sh +./man/Makefile.in +./man/captoinfo.1m +./man/clear.1 +./man/curs_addch.3x +./man/curs_addchstr.3x +./man/curs_addstr.3x +./man/curs_attr.3x +./man/curs_beep.3x +./man/curs_bkgd.3x +./man/curs_border.3x +./man/curs_clear.3x +./man/curs_color.3x +./man/curs_delch.3x +./man/curs_deleteln.3x +./man/curs_getch.3x +./man/curs_getstr.3x +./man/curs_getyx.3x +./man/curs_inch.3x +./man/curs_inchstr.3x +./man/curs_initscr.3x +./man/curs_inopts.3x +./man/curs_insch.3x +./man/curs_insstr.3x +./man/curs_instr.3x +./man/curs_kernel.3x +./man/curs_mouse.3x +./man/curs_move.3x +./man/curs_outopts.3x +./man/curs_overlay.3x +./man/curs_pad.3x +./man/curs_print.3x +./man/curs_printw.3x +./man/curs_refresh.3x +./man/curs_scanw.3x +./man/curs_scr_dump.3x +./man/curs_scroll.3x +./man/curs_slk.3x +./man/curs_termattrs.3x +./man/curs_termcap.3x +./man/curs_terminfo.3x +./man/curs_touch.3x +./man/curs_util.3x +./man/curs_window.3x +./man/define_key.3x +./man/dft_fgbg.3x +./man/form.3x +./man/form_cursor.3x +./man/form_data.3x +./man/form_driver.3x +./man/form_field.3x +./man/form_field_attributes.3x +./man/form_field_buffer.3x +./man/form_field_info.3x +./man/form_field_just.3x +./man/form_field_new.3x +./man/form_field_opts.3x +./man/form_field_userptr.3x +./man/form_field_validation.3x +./man/form_fieldtype.3x +./man/form_hook.3x +./man/form_new.3x +./man/form_new_page.3x +./man/form_opts.3x +./man/form_page.3x +./man/form_post.3x +./man/form_requestname.3x +./man/form_userptr.3x +./man/form_win.3x +./man/infocmp.1m +./man/keybound.3x +./man/keyok.3x +./man/make_sed.sh +./man/man_db.renames +./man/menu.3x +./man/menu_attribs.3x +./man/menu_cursor.3x +./man/menu_driver.3x +./man/menu_format.3x +./man/menu_hook.3x +./man/menu_items.3x +./man/menu_mark.3x +./man/menu_new.3x +./man/menu_opts.3x +./man/menu_pattern.3x +./man/menu_post.3x +./man/menu_requestname.3x +./man/menu_spacing.3x +./man/menu_userptr.3x +./man/menu_win.3x +./man/mitem_current.3x +./man/mitem_name.3x +./man/mitem_new.3x +./man/mitem_opts.3x +./man/mitem_userptr.3x +./man/mitem_value.3x +./man/mitem_visible.3x +./man/ncurses.3x +./man/panel.3x +./man/resizeterm.3x +./man/term.5 +./man/term.7 +./man/terminfo.head +./man/terminfo.tail +./man/tic.1m +./man/toe.1m +./man/tput.1 +./man/tset.1 +./man/wresize.3x +./menu/Makefile.in +./menu/READ.ME +./menu/eti.h +./menu/headers +./menu/llib-lmenu +./menu/m_attribs.c +./menu/m_cursor.c +./menu/m_driver.c +./menu/m_format.c +./menu/m_global.c +./menu/m_hook.c +./menu/m_item_cur.c +./menu/m_item_nam.c +./menu/m_item_new.c +./menu/m_item_opt.c +./menu/m_item_top.c +./menu/m_item_use.c +./menu/m_item_val.c +./menu/m_item_vis.c +./menu/m_items.c +./menu/m_new.c +./menu/m_opts.c +./menu/m_pad.c +./menu/m_pattern.c +./menu/m_post.c +./menu/m_req_name.c +./menu/m_scale.c +./menu/m_spacing.c +./menu/m_sub.c +./menu/m_userptr.c +./menu/m_win.c +./menu/menu.h +./menu/menu.priv.h +./menu/mf_common.h +./menu/modules +./misc/Makefile.in +./misc/chkdef.cmd +./misc/cleantic.cmd +./misc/cmpdef.cmd +./misc/emx.src +./misc/form.def +./misc/form.ref +./misc/hackguide.doc +./misc/hackguide.html +./misc/makedef.cmd +./misc/makellib +./misc/menu.def +./misc/menu.ref +./misc/ncurses-intro.doc +./misc/ncurses-intro.html +./misc/ncurses.def +./misc/ncurses.ref +./misc/panel.def +./misc/panel.ref +./misc/run_tic.sh +./misc/shlib +./misc/tabset/std +./misc/tabset/stdcrt +./misc/tabset/vt100 +./misc/tabset/vt300 +./misc/tdlint +./misc/terminfo.src +./mk-0th.awk +./mk-1st.awk +./mk-2nd.awk +./mkinstalldirs +./ncurses/Makefile.in +./ncurses/README +./ncurses/SigAction.h +./ncurses/base/MKkeyname.awk +./ncurses/base/MKlib_gen.sh +./ncurses/base/MKunctrl.awk +./ncurses/base/README +./ncurses/base/define_key.c +./ncurses/base/keybound.c +./ncurses/base/keyok.c +./ncurses/base/lib_addch.c +./ncurses/base/lib_addstr.c +./ncurses/base/lib_beep.c +./ncurses/base/lib_bkgd.c +./ncurses/base/lib_box.c +./ncurses/base/lib_chgat.c +./ncurses/base/lib_clear.c +./ncurses/base/lib_clearok.c +./ncurses/base/lib_clrbot.c +./ncurses/base/lib_clreol.c +./ncurses/base/lib_color.c +./ncurses/base/lib_colorset.c +./ncurses/base/lib_delch.c +./ncurses/base/lib_delwin.c +./ncurses/base/lib_dft_fgbg.c +./ncurses/base/lib_echo.c +./ncurses/base/lib_endwin.c +./ncurses/base/lib_erase.c +./ncurses/base/lib_flash.c +./ncurses/base/lib_freeall.c +./ncurses/base/lib_getch.c +./ncurses/base/lib_getstr.c +./ncurses/base/lib_hline.c +./ncurses/base/lib_immedok.c +./ncurses/base/lib_inchstr.c +./ncurses/base/lib_initscr.c +./ncurses/base/lib_insch.c +./ncurses/base/lib_insdel.c +./ncurses/base/lib_insstr.c +./ncurses/base/lib_instr.c +./ncurses/base/lib_isendwin.c +./ncurses/base/lib_leaveok.c +./ncurses/base/lib_mouse.c +./ncurses/base/lib_move.c +./ncurses/base/lib_mvwin.c +./ncurses/base/lib_newterm.c +./ncurses/base/lib_newwin.c +./ncurses/base/lib_nl.c +./ncurses/base/lib_overlay.c +./ncurses/base/lib_pad.c +./ncurses/base/lib_printw.c +./ncurses/base/lib_redrawln.c +./ncurses/base/lib_refresh.c +./ncurses/base/lib_restart.c +./ncurses/base/lib_scanw.c +./ncurses/base/lib_screen.c +./ncurses/base/lib_scroll.c +./ncurses/base/lib_scrollok.c +./ncurses/base/lib_scrreg.c +./ncurses/base/lib_set_term.c +./ncurses/base/lib_slk.c +./ncurses/base/lib_slkatr_set.c +./ncurses/base/lib_slkatrof.c +./ncurses/base/lib_slkatron.c +./ncurses/base/lib_slkatrset.c +./ncurses/base/lib_slkattr.c +./ncurses/base/lib_slkclear.c +./ncurses/base/lib_slkcolor.c +./ncurses/base/lib_slkinit.c +./ncurses/base/lib_slklab.c +./ncurses/base/lib_slkrefr.c +./ncurses/base/lib_slkset.c +./ncurses/base/lib_slktouch.c +./ncurses/base/lib_touch.c +./ncurses/base/lib_ungetch.c +./ncurses/base/lib_vline.c +./ncurses/base/lib_wattroff.c +./ncurses/base/lib_wattron.c +./ncurses/base/lib_winch.c +./ncurses/base/lib_window.c +./ncurses/base/memmove.c +./ncurses/base/nc_panel.c +./ncurses/base/resizeterm.c +./ncurses/base/safe_sprintf.c +./ncurses/base/sigaction.c +./ncurses/base/tries.c +./ncurses/base/vsscanf.c +./ncurses/base/wresize.c +./ncurses/curses.priv.h +./ncurses/fifo_defs.h +./ncurses/llib-lncurses +./ncurses/modules +./ncurses/tinfo/MKcaptab.awk +./ncurses/tinfo/MKfallback.sh +./ncurses/tinfo/MKnames.awk +./ncurses/tinfo/README +./ncurses/tinfo/access.c +./ncurses/tinfo/add_tries.c +./ncurses/tinfo/alloc_entry.c +./ncurses/tinfo/alloc_ttype.c +./ncurses/tinfo/captoinfo.c +./ncurses/tinfo/comp_error.c +./ncurses/tinfo/comp_expand.c +./ncurses/tinfo/comp_hash.c +./ncurses/tinfo/comp_parse.c +./ncurses/tinfo/comp_scan.c +./ncurses/tinfo/doalloc.c +./ncurses/tinfo/free_ttype.c +./ncurses/tinfo/getenv_num.c +./ncurses/tinfo/home_terminfo.c +./ncurses/tinfo/init_keytry.c +./ncurses/tinfo/keys.list +./ncurses/tinfo/lib_acs.c +./ncurses/tinfo/lib_baudrate.c +./ncurses/tinfo/lib_cur_term.c +./ncurses/tinfo/lib_data.c +./ncurses/tinfo/lib_has_cap.c +./ncurses/tinfo/lib_kernel.c +./ncurses/tinfo/lib_longname.c +./ncurses/tinfo/lib_napms.c +./ncurses/tinfo/lib_options.c +./ncurses/tinfo/lib_print.c +./ncurses/tinfo/lib_raw.c +./ncurses/tinfo/lib_setup.c +./ncurses/tinfo/lib_termcap.c +./ncurses/tinfo/lib_termname.c +./ncurses/tinfo/lib_ti.c +./ncurses/tinfo/lib_tparm.c +./ncurses/tinfo/lib_tputs.c +./ncurses/tinfo/lib_ttyflags.c +./ncurses/tinfo/make_keys.c +./ncurses/tinfo/name_match.c +./ncurses/tinfo/parse_entry.c +./ncurses/tinfo/read_entry.c +./ncurses/tinfo/read_termcap.c +./ncurses/tinfo/setbuf.c +./ncurses/tinfo/write_entry.c +./ncurses/trace/README +./ncurses/trace/lib_trace.c +./ncurses/trace/lib_traceatr.c +./ncurses/trace/lib_tracebits.c +./ncurses/trace/lib_tracechr.c +./ncurses/trace/lib_tracedmp.c +./ncurses/trace/lib_tracemse.c +./ncurses/trace/trace_buf.c +./ncurses/trace/trace_tries.c +./ncurses/trace/trace_xnames.c +./ncurses/tty/MKexpanded.sh +./ncurses/tty/hardscroll.c +./ncurses/tty/hashmap.c +./ncurses/tty/lib_mvcur.c +./ncurses/tty/lib_tstp.c +./ncurses/tty/lib_twait.c +./ncurses/tty/lib_vidattr.c +./ncurses/tty/tty_display.h +./ncurses/tty/tty_input.h +./ncurses/tty/tty_update.c +./panel/Makefile.in +./panel/headers +./panel/llib-lpanel +./panel/modules +./panel/p_above.c +./panel/p_below.c +./panel/p_bottom.c +./panel/p_delete.c +./panel/p_hidden.c +./panel/p_hide.c +./panel/p_move.c +./panel/p_new.c +./panel/p_replace.c +./panel/p_show.c +./panel/p_top.c +./panel/p_update.c +./panel/p_user.c +./panel/p_win.c +./panel/panel.c +./panel/panel.h +./panel/panel.priv.h +./progs/MKtermsort.sh +./progs/Makefile.in +./progs/capconvert +./progs/clear.c +./progs/clear.sh +./progs/dump_entry.c +./progs/dump_entry.h +./progs/infocmp.c +./progs/modules +./progs/progs.priv.h +./progs/tic.c +./progs/toe.c +./progs/tput.c +./progs/tset.c +./shlib-versions +./sysdeps/unix/sysv/linux/Makefile +./sysdeps/unix/sysv/linux/alpha/configure +./sysdeps/unix/sysv/linux/configure +./sysdeps/unix/sysv/linux/edit_man.sed +./sysdeps/unix/sysv/linux/edit_man.sh +./sysdeps/unix/sysv/linux/run_tic.sh +./tack/COPYING +./tack/HISTORY +./tack/Makefile.in +./tack/README +./tack/ansi.c +./tack/charset.c +./tack/color.c +./tack/control.c +./tack/crum.c +./tack/edit.c +./tack/fun.c +./tack/init.c +./tack/menu.c +./tack/modes.c +./tack/modules +./tack/output.c +./tack/pad.c +./tack/scan.c +./tack/sync.c +./tack/sysdep.c +./tack/tack.1 +./tack/tack.c +./tack/tack.h +./tar-copy.sh +./test/Makefile.in +./test/README +./test/blue.c +./test/bs.6 +./test/bs.c +./test/cardfile.c +./test/cardfile.dat +./test/configure.in +./test/ditto.c +./test/filter.c +./test/firework.c +./test/firstlast.c +./test/gdc.6 +./test/gdc.c +./test/hanoi.c +./test/hashtest.c +./test/keynames.c +./test/knight.c +./test/lrtest.c +./test/modules +./test/ncurses.c +./test/ncurses_tst.hin +./test/newdemo.c +./test/rain.c +./test/tclock.c +./test/test.priv.h +./test/testaddch.c +./test/testcurs.c +./test/testscanw.c +./test/tracemunch +./test/view.c +./test/worm.c +./test/xmas.c diff --git a/contrib/ncurses/Makefile.glibc b/contrib/ncurses/Makefile.glibc new file mode 100644 index 000000000000..3af14ce2e629 --- /dev/null +++ b/contrib/ncurses/Makefile.glibc @@ -0,0 +1,400 @@ +# Copyright (C) 1997,1998 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. + +# You should have received a copy of the GNU Library General Public +# License along with the GNU C Library; see the file COPYING.LIB. If not, +# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# +# Makefile for ncurses part. +# +subdir := ncurses + +ncurses-version = 4.2 +form-version = $(ncurses-version) +menu-version = $(ncurses-version) +panel-version = $(ncurses-version) + +extras := form menu ncurses panel + +extra-libs = $(extras:%=lib%) +# These libraries will be built in the `others' pass rather than +# the `lib' pass, because they depend on libc.so being built already. +extra-libs-others = $(extra-libs) + +# The sources are found in the appropriate subdir. +subdir-dirs = $(extras) progs test +vpath %.c $(subdir-dirs) +vpath %.h $(subdir-dirs) + +libform-routines = \ + fld_arg \ + fld_attr \ + fld_current \ + fld_def \ + fld_dup \ + fld_ftchoice \ + fld_ftlink \ + fld_info \ + fld_just \ + fld_link \ + fld_max \ + fld_move \ + fld_newftyp \ + fld_opts \ + fld_pad \ + fld_page \ + fld_stat \ + fld_type \ + fld_user \ + frm_cursor \ + frm_data \ + frm_def \ + frm_driver \ + frm_hook \ + frm_opts \ + frm_page \ + frm_post \ + frm_req_name \ + frm_scale \ + frm_sub \ + frm_user \ + frm_win \ + fty_alnum \ + fty_alpha \ + fty_enum \ + fty_int \ + fty_ipv4 \ + fty_num \ + fty_regex + +libncurses-routines = \ + base/define_key \ + base/keybound \ + base/keyok \ + base/lib_addch \ + base/lib_addstr \ + base/lib_beep \ + base/lib_bkgd \ + base/lib_box \ + base/lib_chgat \ + base/lib_clear \ + base/lib_clearok \ + base/lib_clrbot \ + base/lib_clreol \ + base/lib_color \ + base/lib_colorset \ + base/lib_delch \ + base/lib_delwin \ + base/lib_dft_fgbg \ + base/lib_echo \ + base/lib_endwin \ + base/lib_erase \ + base/lib_flash \ + base/lib_freeall \ + base/lib_getch \ + base/lib_getstr \ + base/lib_hline \ + base/lib_immedok \ + base/lib_inchstr \ + base/lib_initscr \ + base/lib_insch \ + base/lib_insdel \ + base/lib_insstr \ + base/lib_instr \ + base/lib_isendwin \ + base/lib_leaveok \ + base/lib_mouse \ + base/lib_move \ + base/lib_mvwin \ + base/lib_newterm \ + base/lib_newwin \ + base/lib_nl \ + base/lib_overlay \ + base/lib_pad \ + base/lib_printw \ + base/lib_redrawln \ + base/lib_refresh \ + base/lib_restart \ + base/lib_scanw \ + base/lib_screen \ + base/lib_scroll \ + base/lib_scrollok \ + base/lib_scrreg \ + base/lib_set_term \ + base/lib_slk \ + base/lib_slkatr_set \ + base/lib_slkatrof \ + base/lib_slkatron \ + base/lib_slkatrset \ + base/lib_slkattr \ + base/lib_slkclear \ + base/lib_slkcolor \ + base/lib_slkinit \ + base/lib_slklab \ + base/lib_slkrefr \ + base/lib_slkset \ + base/lib_slktouch \ + base/lib_touch \ + base/lib_ungetch \ + base/lib_vline \ + base/lib_wattroff \ + base/lib_wattron \ + base/lib_winch \ + base/lib_window \ + base/memmove \ + base/nc_panel \ + base/resizeterm \ + base/safe_sprintf \ + base/sigaction \ + base/tries \ + base/vsscanf \ + base/wresize \ + codes \ + comp_captab \ + expanded \ + fallback \ + lib_gen \ + lib_keyname \ + names \ + tinfo/access \ + tinfo/add_tries \ + tinfo/alloc_entry \ + tinfo/alloc_ttype \ + tinfo/captoinfo \ + tinfo/comp_error \ + tinfo/comp_expand \ + tinfo/comp_hash \ + tinfo/comp_parse \ + tinfo/comp_scan \ + tinfo/doalloc \ + tinfo/free_ttype \ + tinfo/getenv_num \ + tinfo/home_terminfo \ + tinfo/init_keytry \ + tinfo/lib_acs \ + tinfo/lib_baudrate \ + tinfo/lib_cur_term \ + tinfo/lib_data \ + tinfo/lib_has_cap \ + tinfo/lib_kernel \ + tinfo/lib_longname \ + tinfo/lib_napms \ + tinfo/lib_options \ + tinfo/lib_print \ + tinfo/lib_raw \ + tinfo/lib_setup \ + tinfo/lib_termcap \ + tinfo/lib_termname \ + tinfo/lib_ti \ + tinfo/lib_tparm \ + tinfo/lib_tputs \ + tinfo/lib_ttyflags \ + tinfo/name_match \ + tinfo/parse_entry \ + tinfo/read_entry \ + tinfo/read_termcap \ + tinfo/setbuf \ + tinfo/write_entry \ + trace/lib_trace \ + trace/lib_traceatr \ + trace/lib_tracebits \ + trace/lib_tracechr \ + trace/lib_tracedmp \ + trace/lib_tracemse \ + trace/trace_buf \ + trace/trace_tries \ + trace/trace_xnames \ + tty/hardscroll \ + tty/hashmap \ + tty/lib_mvcur \ + tty/lib_tstp \ + tty/lib_vidattr \ + tty/lib_twait \ + tty/tty_update \ + unctrl + +libmenu-routines = \ + m_attribs \ + m_cursor \ + m_driver \ + m_format \ + m_global \ + m_hook \ + m_item_cur \ + m_item_nam \ + m_item_new \ + m_item_opt \ + m_item_top \ + m_item_use \ + m_item_val \ + m_item_vis \ + m_items \ + m_new \ + m_opts \ + m_pad \ + m_pattern \ + m_post \ + m_req_name \ + m_scale \ + m_spacing \ + m_sub \ + m_userptr \ + m_win + +libpanel-routines = \ + panel \ + p_above \ + p_below \ + p_bottom \ + p_delete \ + p_hide \ + p_hidden \ + p_move \ + p_new \ + p_replace \ + p_show \ + p_top \ + p_update \ + p_user \ + p_win + +headers = curses.h eti.h form.h menu.h panel.h term.h termcap.h \ + unctrl.h +others = clear infocmp tic toe tput tset +install-bin = $(others) + +clear-objs = clear.o +infocmp-objs = infocmp.o dump_entry.o +tic-objs = tic.o dump_entry.o +toe-objs = toe.o dump_entry.o +tput-objs = tput.o +tset-objs = tset.o dump_entry.o +extra-objs = $(tic-objs) $(toe-objs) $(infocmp-objs) $(clear-objs) \ + $(tput-objs) $(tset-objs) + +test-srcs = blue bs cardfile ditto firework firstlast gdc hanoi hashtest knight \ + lrtest ncurses newdemo rain tclock testaddch testcurs \ + testscanw view worm xmas + +include ../Rules + +ifndef tabsetdir +tabsetdir = $(datadir)/tabset +endif +ifndef inst_tabsetdir +inst_tabsetdir = $(install_root)/$(tabsetdir) +endif + +ifndef terminfodir +terminfodir = $(datadir)/terminfo +endif +ifndef inst_terminfodir +inst_terminfodir = $(install_root)/$(terminfodir) +endif + +ifndef mandir +mandir = $(prefix)/man +endif + +ifndef inst_mandir +inst_mandir = $(install_root)/$(mandir) +endif + +CPPFLAGS += -DTERMINFO='"$(terminfodir)"' -Iinclude -Iform -Incurses \ + -Imenu -Ipanel -Iprogs -Itest + +ifneq ($(strip $(objpfx)),) +CPPFLAGS += -I$(objpfx) +endif + +LDLIBS-tclock = math/libm + +tests: $(test-srcs:%=$(objpfx)%) + +$(objpfx)clear: $(addprefix $(objpfx),$(clear-objs)) +$(objpfx)infocmp: $(addprefix $(objpfx),$(infocmp-objs)) +$(objpfx)tic: $(addprefix $(objpfx),$(tic-objs)) +$(objpfx)toe: $(addprefix $(objpfx),$(toe-objs)) +$(objpfx)tput: $(addprefix $(objpfx),$(tput-objs)) +$(objpfx)tset: $(addprefix $(objpfx),$(tset-objs)) + +ifeq ($(build-shared),yes) +$(others:%=$(objpfx)%): $(objpfx)libncurses.so +else +$(others:%=$(objpfx)%): $(objpfx)libncurses.a +endif + +$(test-srcs:%=$(objpfx)%): $(objpfx)libform.a $(objpfx)libmenu.a \ + $(objpfx)libpanel.a $(objpfx)libncurses.a + +# Depend on libc.so so a DT_NEEDED is generated in the shared objects. +# This ensures they will load libc.so for needed symbols if loaded by +# a statically-linked program that hasn't already loaded it. +$(extras:%=$(objpfx)lib%.so): $(common-objpfx)libc.so + +subdir_install: $(inst_libdir)/libtermcap.a $(inst_libdir)/libcurses.a \ + $(inst_bindir)/reset $(inst_bindir)/captoinfo + +$(inst_libdir)/libtermcap.a $(inst_libdir)/libcurses.a: \ + $(inst_libdir)/libncurses.a + $(make-link) + +$(inst_bindir)/reset: $(inst_bindir)/tset + $(make-link) + +$(inst_bindir)/captoinfo: $(inst_bindir)/tic + $(make-link) + +ifeq (yes,$(build-shared)) +subdir_install: $(inst_libdir)/libtermcap.so $(inst_libdir)/libcurses.so + +$(inst_libdir)/libtermcap.so $(inst_libdir)/libcurses.so: \ + $(inst_libdir)/libncurses.so + $(make-link) +endif + +subdir_install: $(inst_mandir)/man5/terminfo.5 + +$(inst_mandir)/man5/terminfo.5: $(objpfx)terminfo.5 $(wildcard man/*.[0-9]*) + $(make-target-directory) + sh $(edit_man-sh) $(prefix) $(inst_mandir) $(edit_man-sed) $^ + +subdir_install: $(inst_tabsetdir)/std + +$(inst_tabsetdir)/std: \ + $(filter-out misc/tabset/CVS, $(wildcard misc/tabset/*)) + $(make-target-directory) + for f in $^; do \ + echo installing $$f; \ + $(INSTALL_DATA) $$f $(inst_tabsetdir); \ + done + + +ifeq (no,$(cross-compiling)) +subdir_install: $(inst_terminfodir)/v/vt100 + +$(inst_terminfodir)/v/vt100: misc/terminfo.src $(objpfx)tic + $(make-target-directory) + sh $(run_tic-sh) $(common-objpfx) misc $(terminfodir) \ + $(install_root) +endif + +subdir_distclean subdir_realclean: + -rm -f $(addprefix $(objpfx), MKterm.h.awk codes.c \ + comp_captab.c confdefs.h config.log curses.h \ + expanded.c fallback.c hashsize.h keys.tries \ + lib_gen.c lib_keyname.c names.c ncurses_cfg.h \ + nomacros.h parametrized.h term.h termcap.h \ + terminfo.5 termsort.c unctrl.c unctrl.h) diff --git a/contrib/ncurses/Makefile.in b/contrib/ncurses/Makefile.in new file mode 100644 index 000000000000..381ca9e7ed75 --- /dev/null +++ b/contrib/ncurses/Makefile.in @@ -0,0 +1,92 @@ +# $Id: Makefile.in,v 1.18 1998/08/22 23:45:00 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 +# +# Master Makefile for ncurses library. + +SHELL = /bin/sh + +INSTALL_PREFIX=@INSTALL_PREFIX@ +CF_MFLAGS = @cf_cv_makeflags@ INSTALL_PREFIX="$(INSTALL_PREFIX)" + +@SET_MAKE@ + +NCURSES_MAJOR = @NCURSES_MAJOR@ +NCURSES_MINOR = @NCURSES_MINOR@ +NCURSES_PATCH = @NCURSES_PATCH@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +datadir = @datadir@ +includedir = @includedir@ +libdir = @libdir@ +mandir = @mandir@ + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +DIRS_TO_MAKE = @DIRS_TO_MAKE@ + +all :: $(DIRS_TO_MAKE) + +$(DIRS_TO_MAKE) : + mkdir $@ + +preinstall : + @ echo '' + @ echo '** Configuration summary for NCURSES $(NCURSES_MAJOR).$(NCURSES_MINOR) $(NCURSES_PATCH):' + @ echo '' + @ echo ' bin directory: '$(bindir) + @ echo ' lib directory: '$(libdir) + @ echo ' include directory: '$(includedir) + @ echo ' man directory: '$(mandir) + @ echo ' terminfo directory: '$(datadir)/terminfo + @ echo '' + @ test "$(includedir)" = "$(prefix)/include" || \ + echo '** Include-directory is not in a standard location' + @ test ! -f $(includedir)/termcap.h || \ + fgrep NCURSES_VERSION $(includedir)/termcap.h >/dev/null || \ + echo '** Will overwrite non-ncurses termcap.h' + @ test ! -f $(includedir)/curses.h || \ + fgrep NCURSES_VERSION $(includedir)/curses.h >/dev/null || \ + echo '** Will overwrite non-ncurses curses.h' + +# Put the common rules here so that we can easily construct the list of +# directories to visit. +all \ +clean \ +distclean \ +mostlyclean \ +realclean \ +sources \ +uninstall \ +install :: diff --git a/contrib/ncurses/Makefile.os2 b/contrib/ncurses/Makefile.os2 new file mode 100644 index 000000000000..7a6f56dade13 --- /dev/null +++ b/contrib/ncurses/Makefile.os2 @@ -0,0 +1,235 @@ +################################################################################ +# Wrapper Makefile for ncurses library under OS/2. +################################################################################ +# $Id: Makefile.os2,v 1.8 1998/12/13 02:23:13 tom Exp $ +# +# Author: Juan Jose Garcia Ripoll <worm@arrakis.es>. +# Webpage: http://www.arrakis.es/~worm/ +################################################################################ +# +# Notes (from I Zakharevich) +# ~~~~~~~~~~~~~~~~~~~~~~~~~~ +# I could build the library with the following sequence of commands: +# +# touch Makefile +# make -f Makefile.os2 config +# make -f Makefile.os2 CC=gcc HOSTCC=gcc +# make -f Makefile.os2 CC=gcc HOSTCC=gcc +# +# Ignoring the following errors: +# Invalid configuration `os2'... +# ... ac_maketemp="make": not found +# ... syntax error: `done' unexpected +# No rule to make target `lib/ncurses4.dll' +# +# You may need to run +# +# rm make.defs +# make -f Makefile.os2 make.defs +# +# if the build of misc/panel.def fails. +# +# If you do not have perl, the configuration will fail. Use autoconf to +# generate the EMX-specific configure script (see README.emx), and run the +# configure script to generate the makefiles. Then, run +# +# make -f Makefile.os2 make.dlls +# +# Notes (from J J G Ripoll) +# ~~~~~~~~~~~~~~~~~~~~~~~~~ +# The `make.defs' rule creates the new '.def' files and outputs a diagnostic +# about symbols that disappear from one release to the other, as well as +# checks about the new '.def' consistency. If there were no problems, the +# maintainer is free to replace the `.ref' files with the newer ones using the +# `save.defs' rule. So, the only tough work is ensuring that the symbols that +# disappear are not essential. +# +# I first thought about killing '_nc_*' symbols, but it seems that some of +# them --_nc_panel_hook, _nc_ada*, etc-- are needed outside ncurses.dll. +# However, the whole size of the export table will not be larger than 1k or +# so. +# +# [installation] +# +# The way things are handled in misc/Makefile is not well suited for OS/2, +# where only emx.src is needed. Thus, I've written a few wrapper rules in +# Makefile.os2 that handle installation/deinstallation. +# +# [distribution] +# +# There's also a new rule that configures and builds a sort of binary +# distribution, much like the one I prepared for 1.9.9e. It's `os2dist'. +# +################################################################################ + +all :: config + +# This is for configuring + +# What is a useful value for this? +CONFIG_OPTS = --enable-termcap +WWWGET = lynx -source +MV_F = mv -f +DLL_LN_OPTS = -Zcrtdll -Zdll -Zomf -Zmt + +config: config.cache + +config.cache: configure.cmd configure + -$(MV_F) $@ $@.ref + configure.cmd $(CONFIG_OPTS) + +configure.cmd: configure convert_configure.pl + perl convert_configure.pl configure > $@ + +convert_configure.pl: + $(WWWGET) ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2/$@ > $@ + +install :: + echo *** + echo *** Do not use this command. Use install.os2 instead. + echo *** + exit 2 + +install.os2 : install.emxdata install.libs install.progs + +include ./Makefile + +all :: make.dlls + +# +# DLLs and that stuff +# + +LIBRARIES = ncurses form menu panel + +DLL_TAG = $(NCURSES_MAJOR) +LIB_TAG = _s + +DLL_ROOTS = $(addsuffix $(DLL_TAG), $(LIBRARIES)) +DLLS = $(addsuffix .dll, $(addprefix ./lib/, $(DLL_ROOTS))) + +LIB_ROOTS = $(addsuffix $(LIB_TAG), $(LIBRARIES)) +LIBS = $(addsuffix .lib, $(addprefix ./lib/, $(LIB_ROOTS))) + +LIBS_AOUT = $(addsuffix .a, $(addprefix ./lib/, $(LIB_ROOTS))) + +DEFS = $(addsuffix .def, $(addprefix ./misc/, $(LIBRARIES))) + +DLL_SIGNATURE = NCurses-$(NCURSES_MAJOR)-$(NCURSES_MINOR)-$(NCURSES_PATCH) + +./lib/%$(LIB_TAG).lib : ./misc/%.def + emximp -o $@ $< + +./lib/%$(LIB_TAG).a : ./misc/%.def + emximp -o $@ $< + +./lib/%$(DLL_TAG).dll : ./lib/%.a + emxomf -o ./lib/$*$(DLL_TAG).lib $< + if [ "$*" = "ncurses" ]; then \ + gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \ + ./misc/$*.def -o $@; \ + else \ + gcc $(LDFLAGS) $(DLL_LN_OPTS) ./lib/$*$(DLL_TAG).lib \ + ./lib/ncurses$(LIB_TAG).lib ./misc/$*.def -o $@; \ + fi + -rm -f ./lib/$*$(DLL_TAG).lib + +make.dlls : $(DEFS) $(LIBS) $(DLLS) $(LIBS_AOUT) + +$(DEFS) : make.defs + +LIBDIR = $(INSTALL_PREFIX)$(libdir) +$(LIBDIR) : + mkdir -p $@ + +install.libs :: $(LIBS) $(DLLS) $(LIBDIR) + @for i in $(DLL_ROOTS); do \ + echo installing ./lib/$$i.dll as $(LIBDIR)/$$i.dll; \ + $(INSTALL_DATA) ./lib/$$i.dll $(LIBDIR)/$$i.dll; done + @for i in $(LIB_ROOTS); do \ + echo installing ./lib/$$i.lib as $(LIBDIR)/$$i.lib; \ + $(INSTALL_DATA) ./lib/$$i.lib $(LIBDIR)/$$i.lib; done + +uninstall.libs :: + -@for i in $(DLL_ROOTS); do \ + echo uninstalling $(LIBDIR)/$$i.dll; \ + rm -f $(LIBDIR)/$$i.dll; done + -@for i in $(LIB_ROOTS); do \ + echo uninstalling $(LIBDIR)/$$i.lib; \ + rm -f $(LIBDIR)/$$i.lib; done + +make.defs : + for i in $(LIBRARIES); do \ + echo LIBRARY $${i}$(DLL_TAG) INITINSTANCE TERMINSTANCE > ./misc/$$i.def; \ + echo DESCRIPTION \"$(DLL_SIGNATURE), module $$i\" >> ./misc/$$i.def; \ + echo CODE LOADONCALL >> ./misc/$$i.def; \ + echo DATA LOADONCALL NONSHARED MULTIPLE >> ./misc/$$i.def; \ + echo EXPORTS >> ./misc/$$i.def; \ + echo Creating $$i.def; \ + (cmd /C ".\\misc\\makedef.cmd ./lib/$$i.a ./misc/$$i.ref >> ./misc/$$i.def" \ + && cmd /C ".\\misc\\chkdef.cmd ./misc/$$i.def") \ + || exit 1; \ + done + touch make.defs + +save.defs : + for i in $(LIBRARIES); do \ + test -f ./misc/$$i.def && cp ./misc/$$i.def ./misc/$$i.ref; \ + done + +clean \ +os2clean :: + -rm -f $(DLLS) $(LIBS) + +realclean :: + -rm -f $(addprefix ./misc/, $(addsuffix .def, $(LIBRARIES))) + +# +# This is a simplified version of misc/Makefile +# + +TICDIR = $(INSTALL_PREFIX)$(datadir)/terminfo +TABSETDIR = $(INSTALL_PREFIX)$(datadir)/tabset + +$(TICDIR) : + mkdir -p $@ + +install \ +install.emxdata :: $(TICDIR) + -@rm -fr $(TICDIR)/* + echo Building terminfo database, please wait... + set TERMINFO=$(TICDIR); ./progs/tic ./misc/emx.src + echo Installing the terminfo cleaner and the sources... + cp ./misc/emx.src ./misc/cleantic.cmd $(TICDIR) + ./misc/cleantic.cmd $(TICDIR) + +uninstall \ +uninstall.emxdata :: + -cd $(TICDIR) && rm -rf * + -cd $(TABSETDIR) && rm -rf * + +# +# This is for preparing binary distributions +# + +OS2NAME=ncurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-emx + +# +# FIXME: this assumes that we can rerun the configure script, changing only +# the install-prefix. That means we cannot provide "interesting" options +# when building. +# +os2dist : + $(MAKE) -f Makefile.os2 os2clean + ./configure --without-debug --with-install-prefix=`pwd|sed -e 's@^.:@@'`/$(OS2NAME) + $(MAKE) -f Makefile.os2 $(CF_MFLAGS) install.os2 + -rm -f $(OS2NAME).zip + echo NCurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-$(NCURSES_PATCH) for emx > $(OS2NAME)/FILE_ID.DIZ + echo Binary release. >> $(OS2NAME)/FILE_ID.DIZ + zip -r $(OS2NAME).zip ./$(OS2NAME) + +clean \ +os2clean :: + -rm -rf $(OS2NAME) + -rm -f $(OS2NAME).zip + diff --git a/contrib/ncurses/NEWS b/contrib/ncurses/NEWS new file mode 100644 index 000000000000..98ac40c59784 --- /dev/null +++ b/contrib/ncurses/NEWS @@ -0,0 +1,3572 @@ +-- $Id: NEWS,v 1.474 1999/08/22 00:12:43 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. + +Changes through 1.9.9e are recorded by Zeyd M. Ben-Halim. +Changes since 1.9.9e are recorded by Thomas Dickey. + +990821 pre-release + + updated configure macros CF_MAKEFLAGS, CF_CHECK_ERRNO + + minor corrections to beterm terminfo entry. + + modify lib_setup.c to reject values of $TERM which have a '/' in them. + + add ifdef's to guard against CS5, CS6, CS7, CS8 being zero, as more + than one is on BeOS. That would break a switch statement. + + add configure macro CF_LINK_FUNCS to detect and work around BeOS's + nonfunctional link(). + + improved configure macros CF_BOOL_DECL and CF_BOOL_SIZE to detect + BeOS's bool, which is declared as an unsigned char. + +990814 pre-release + + add ms-vt100 terminfo entry -TD + + minor fixes for misc/emx.src, based on testing with tack. + + minor fix for test/ncurses.c, test 'a', in case ncv is not set. + +990731 pre-release + + minor correction for 'screen' terminfo entry. + + clarify description of errret values for setupterm in manpage. + + modify tput to allow it to emit capabilities for hardcopy terminals + (patch by Goran Uddeborg <goeran@uddeborg.pp.se>). + + modify the 'o' (panel) test in ncurses.c to show the panels in color + or at least in bold, to test Juergen's change to wrefresh(). + > patches by Juergen Pfeifer: + + Fixes a problem using wbkgdset() with panels. It has actually + nothing to with panels but is a problem in the implementation of + wrefresh(). Whenever a window changes its background attribute to + something different than newscr's background attribute, the whole + window is touched to force a copy to newscr. This is an unwanted + side-effect of wrefresh() and it is actually not necessary. A changed + background attribute affects only further outputs of background it + doesn't mean anything to the current content of the window. So there + is no need to force a copy. (reported by Frank Heckenbach + <frank@g-n-u.de>). + + an upward compatible enhancement of the NCursesPad class in the C++ + binding. It allows one to add a "viewport" window to a pad and then + to use panning to view the pad through the viewport window. + +990724 pre-release + + suppress a call to def_prog_mode() in the SIGTSTP handler if the + signal was received while not in curses mode, e.g., endwin() was + called in preparation for spawning a shell command (reported by Frank + Heckenbach <frank@g-n-u.de>) + + corrected/enhanced xterm-r5, xterm+sl, xterm+sl-twm terminfo entries. + + change test for xterm mouse capability: it now checks only if the + user's $DISPLAY variable is set in conjunction with the kmous + capability being present in the terminfo. Before, it checked if any + of "xterm", "rxvt" or "kterm" were substrings of the terminal name. + However, some emulators which are incompatible with xterm in other + ways do support the xterm mouse capability. + + reviewed and made minor changes in ncurses to quiet g++ warnings + about shadowed or uninitialized variables. g++ incorrectly warns + about uninitialized variables because it does not take into account + short-circuit expression evaluation. + + change ncurses 'b' test to start in color pair 0 and to show in the + right margin those attributes which are suppressed by no_color_video, + i.e., "(NCV)". + + modify ifdef's in curses.h so that __attribute__ is not redefined + when compiling with g++, but instead disabled the macros derived for + __attribute__ since g++ does not consistently recognize the same + keywords as gcc (reported by Stephan K Zitz <zitz@erf.net>). + + update dependencies for term.h in ncurses/modules (reported by + Ilya Zakharevich). + +990710 pre-release + + modify the form demo in ncurses.c to illustrate how to manipulate the + field appearance, e.g, for highlighting or translating the field + contents. + + correct logic in write_entry from split-out of home_terminfo in + 980919, which prevented update of $HOME/.terminfo (reported by Philip + Spencer <pspencer@fields.utoronto.ca>). + +990703 pre-release + + modify linux terminfo description to make use of kernel 2.2.x mods + that support cursor style, e.g., to implement cvvis (patch by Frank + Heckenbach <frank@g-n-u.de>) + + add special-case in setupterm to retain previously-saved terminal + settings in cur_term, which happens when curses and termcap calls are + mixed (from report by Bjorn Helgaas <helgaas@dhc.net>). + + suppress initialization of key-tries in _nc_keypad() if we are only + disabling keypad mode, e.g., in endwin() called when keypad() was not. + + modify the Ada95 makefile to ensure that always the Ada files from + the development tree are used for building and not the eventually + installed ones (patch by Juergen Pfeifer). + +990626 pre-release + + use TTY definition in tack/sysdep.c rather than struct termios + (reported by Philippe De Muyter). + + add a fallback for strstr, used in lib_mvcur.c and tack/edit.c, + not present on sysV68 (reported by Philippe De Muyter). + + correct definition in comp_hash.c to build with configure + --with-rcs-ids option. + +990619 pre-release + + modified ifdef's for sigaction and sigvec to ensure we do not try to + handle SIGTSTP if neither is available (from report by Philippe De + Muyter). + > patch by Philippe De Muyter: + + in tic.c, use `unlink' if `remove' is not available. + + use only `unsigned' as fallback value for `speed_t'. Some files used + `short' instead. + +990616 pre-release + + fix some compiler warnings in tack. + + add a check for predefined bool type in CC, based on report that + BeOS predefines a bool type. + + correct logic for infocmp -e option (i.e., the configure + --with-fallbacks option), which I'd not updated when implementing + extended names (cf: 990301). The new implementation adds a -E + option to infocmp. + > patch by Juergen Pfeifer: + + introduce the private type Curses_Bool in the Ada95 binding + implementation. This is to clearly represent the use of "bool" also + in the binding. It should have no effect on the generated code. + + improve the man page for field_buffer() to tell the people, that the + whole buffer including leading/trailing spaces is returned. This is + a common source of confusion, so it's better to document it clearly. + +990614 pre-release + > patch by Juergen Pfeifer: + + use pragma PreElaborate in several places. + + change a few System.Address uses to more specific types. + + change interface version-number to 1.0 + + regenerate Ada95 HTML files. + +990612 pre-release + + modify lib_endwin.c to avoid calling reset_shell_mode(), return ERR + if it appears that curses was never initialized, e.g., by initscr(). + For instance, this guards against setting the terminal modes to + strange values if endwin() is called after setupterm(). In the same + context, Solaris curses will dump core. + + modify logic that avoids a conflict in lib_vidattr.c between sgr0 and + equivalent values in rmso or rmul by ensuring we do not modify the + data which would be returned by the terminfo or termcap interfaces + (reported by Brad Pepers <brad@linuxcanada.com>, cf: 960706). + + add a null-pointer check for SP in lib_vidattr.c to logic that checks + for magic cookies. + + improve fallback declaration of 'bool' when the --without-cxx option + is given, by using a 'char' on i386 and related hosts (from discussion + with Alexander Lukyanov). + +990605 pre-release + + include time.h in lib_napms.c if nanosleep is used (patch by + R Lindsay Todd <toddr@rpi.edu>). + + add an "#undef bool" to curses.h, in case someone tries to define it, + e.g., perl. + + add check to tparm to guard against divide by zero (reported by Aaron + Campbell <aaron@ug.cs.dal.ca>). + +990516 pre-release + + minor fix to build tack on CLIX (mismatched const). + > patch by Juergen Pfeifer: + + change Juergen's old email address with new one in the files where it + is referenced. The Ada95 HTML pages are regenerated. + + update MANIFEST to list the tack files. + +990509 pre-release + + minor fixes to make 'tack' build/link on NeXT (reported by Francisco + A. Tomei Torres). + +990417 pre-release + + add 'tack' program (which is GPL'd), updating it to work with the + modified TERMTYPE struct and making a fix to support setaf/setab + capabilities. Note that the tack program is not part of the + ncurses libraries, but an application which can be distributed with + ncurses. The configure script will ignore the directory if it is + omitted, however. + + modify gpm mouse support so that buttons 2 and 3 are used for + select/paste only when shift key is pressed, making them available + for use by an application (patch by Klaus Weide). + + add complete list of function keys to scoansi terminfo entry - TD + +990410 pre-release + + add a simple test program cardfile.c to illustrate how to read form + fields, and showing forms within panels. + + change shared-library versioning for the Hurd to be like Linux rather + than *BSD (patch by Mark Kettenis <kettenis@wins.uva.nl>). + + add linux-lat terminfo entry. + + back-out _nc_access check in read_termcap.c (both incorrect and + unnecessary, except to guard against a small window where the file's + ownership may change). + +990403 pre-release + + remove conflicting _nc_free_termtype() function from test module + lib_freeall.c + + use _nc_access check in read_termcap.c for termpaths[] array (noted + by Jeremy Buhler, indicating that Alan Cox made a similar patch). + > patch by Juergen Pfeifer: + + modify menu creation to not inherit status flag from the default menu + which says that the associated marker string has been allocated and + should be freed (bug reported by Marek Paliwoda" <paliwoda@kki.net.pl>) + +990327 pre-release (alpha.gnu.org:/gnu/ncurses-5.0-beta1.tar.gz) + + minor fixes to xterm-xfree86 terminfo entry - TD. + + split up an expression in configure script check for ldconfig to + workaround limitation of BSD/OS sh (reported by Jeff Haas + <jmh@mail.msen.com>). + + correct a typo in man/form_hook.3x (Todd Miller). + +990318 pre-release + + parenthesize and undef 'index' symbol in c++ binding and demo, to + accommodate its definition on NeXT (reported by Francisco A. Tomei + Torres). + + add sigismember() to base/sigaction.c compatibility to link on NeXT + (reported by Francisco A. Tomei Torres). + + further refinements to inequality in hashmap.c to cover a case with + ^U in nvi (patch by Alexander Lukyanov). + +990316 pre-release + + add fallback definition for getcwd, to link on NeXT. + + add a copy of cur_term to tic.c to make it link properly on NeXT + (reported by Francisco A. Tomei Torres). + + change inequality in hashmap.c which checks the distance traveled by + a chunk so that ^D command in nvi (scrolls 1/2 screen) will use + scrolling logic (patch by Alexander Lukyanov, reported by Jeffrey + Honig). + +990314 pre-release + + modify lib_color.c to handle a special case where the curscr + attributes have been made obsolete (patch by Alexander Lukyanov). + + update BSD/OS console terminfo entries to use klone+sgr and + klone+color (patch by Jeffrey Honig). + + update glibc addon configure script for extended capabilities. + + correct a couple of warnings in the --enable-const configuration. + + make comp_hash build properly with _nc_strdup(), on NeXT (reported by + Francisco A. Tomei Torres <francisco.tomei@cwix.com>). + +990313 pre-release + + correct typos in linux-c initc string - TD + + add 'crt' terminfo entry, update xterm-xfree86 entry - TD + + remove a spurious argument to tparm() in lib_sklrefr.c (patch by + Alexander Lukyanov). + +990307 pre-release + + back-out change to wgetch because it causes a problem with ^Z + handling in lynx (reported by Kim DeVaughn). + +990306 pre-release + + add -G option to tic and infocmp, to reverse the -g option. + + recode functions in name_match.c to avoid use of strncpy, which + caused a 4-fold slowdown in tic (cf: 980530). + + correct a few warnings about sign-extension in recent changes. + > patch by Juergen Pfeifer: + + fixes suggested by Jeff Bradbury <jibradbury@lucent.com>: + + improved parameter checking in new_fieldtype(). + + fixed a typo in wgetch() timeout handling. + + allow slk_init() to be called per newterm call. The internal SLK + state is stored in the SCREEN struct after every newterm() and then + reset for the next newterm. + + fix the problem that a slk_refresh() refreshes stdscr if the + terminal has true SLKs. + + update HTML documentation for Ada binding. + +990301 pre-release + + remove 'bool' casts from definitions of TRUE/FALSE so that statements + such as "#if TRUE" work. This was originally done to allow for a C++ + compiler which would warn of implicit conversions between enum and + int, but is not needed for g++ (reported by Kim DeVaughn). + + add use_extended_names() function to allow applications to suppress + read of the extended capabilities. + + add configure option --enable-tcap-names to support logic which + allows ncurses' tic to define new (i.e., extended) terminal + capabilities. This is activated by the tic -x switch. The infocmp + program automatically shows or compares extended capabilities. + Note: This changes the Strings and similar arrays in the TERMTYPE + struct so that applications which manipulate it must be recompiled. + + use macros typeMalloc, typeCalloc and typeRealloc consistently + throughout ncurses library. + + add _nc_strdup() to doalloc.c. + + modify define_key() to allow multiple strings to be bound to the + same keycode. + + correct logic error in _nc_remove_string, from 990220. + > patch by Juergen Pfeifer, for Ada95 binding: + + regenerate some of the html documentation + + minor cleanup in terminal_interface-curses.adb + +990220 pre-release + + resolve ambiguity of kend/kll/kslt and khome/kfnd/kich1 strings in + xterm and ncsa terminfo entries by removing the unneeded ones. Note + that some entries will return kend & khome versus kslt and kfnd, for + PC-style keyboards versus strict vt220 compatiblity - TD + + add function keybound(), which returns the definition associated with + a given keycode. + + modify define_key() to undefine the given string when no keycode is + given. + + modify keyok() so it works properly if there is more than one string + defined for a keycode. + + add check to tic to warn about terminfo descriptions that contain + more than one key assigned to the same string. This is shown only if + the verbose (-v) option is given. Moved related logic (tic -v) from + comp_parse.c into the tic program. + + add/use _nc_trace_tries() to show the function keys that will be + recognized. + + rename init_acs to _nc_init_acs (request by Alexander Lukyanov). + > patch by Juergen Pfeifer, for Ada95 binding: + + remove all the *_adabind.c from ncurses, menu and form projects. + Those little helper routines have all been implemented in Ada and are + no longer required. + + The option handling routines in menu and form have been made more + save. They now make sure that the unused bits in options are always + zero. + + modify configuration scripts to + + use gnatmake as default compiler name. This is a safer choice than + gcc, because some GNAT implementations use other names for the + compilerdriver to avoid conflicts. + + use new default installation locations for the Ada files according + to the proposed GNU Ada filesystem standard (for Linux). + + simplify the Makefiles for the Ada binding + + rename ada_include directory to src. + +990213 + + enable sigwinch handler by default. + + disable logic that allows setbuf to be turned off/on, because some + implementations will overrun the buffer after it has been disabled + once. + +990206 + + suppress sc/rc capabilities from terminal description if they appear + in smcup/rmcup. This affects only scrolling optimization, to fix a + problem reported by several people with xterm's alternate screen, + though the problem is more general. + > patch by Juergen Pfeifer, for Ada95 binding: + + removed all pragma Preelaborate() stuff, because the just released + gnat-3.11p complains on some constructs. + + fixed some upper/lower case notations because gnat-3.11p found + inconsistent use. + + used a new method to generate the HTML documentation of the Ada95 + binding. This invalidates nearly the whole ./Ada95/html subtree. + Nearly all current files in this subtree are removed + +990130 + + cache last result from _nc_baudrate, for performance (suggested by + Alexander Lukyanov). + + modify ClrUpdate() function to workaround a problem in nvi, which + uses redrawwin in SIGTSTP handling. Jeffrey Honig reported that + ncurses repainted the screen with nulls before resuming normal + operation (patch by Alexander Lukyanov). + + generalize is_xterm() function a little by letting xterm/rxvt/kterm + be any substring rather than the prefix. + + modify lib_data.c to initialize SP. Some linkers, e.g., IBM's, will + not link a module if the only symbols exported from the module are + uninitialized ones (patch by Ilya Zakharevich, who says that he has + seen messages claiming this behaviour conforms to the standard.) + + move call on _nc_signal_handler past _nc_initscr, to avoid a small + window where Nttyb hasn't yet been filled (reported by Klaus Weide). + + modify lib_tstp.c to block SIGTTOU when handling SIGTSTP, fixes a + problem where ncurses applications which were run via a shell script + would hang when given a ^Z. Also, check if the terminal's process + group is consistent, i.e., a shell has not taken ownership of it, + before deciding to save the current terminal settings in the SIGTSTP + handler (patch by Klaus Weide). + + correct spelling of ACS_ names in curs_border.3x (reported by Bob van + der Poel <bvdpoel@kootenay.com>). + + correct a couple of typos in the macros supporting the configure + --with-shlib-version option. + +990123 + + modify fty_regex.c to compile on HAVE_REGEXPR_H_FUNCS machine (patch + by Kimio Ishii <ishii@csl.sony.co.jp>). + + rename BSDI console terminfo entries: bsdos to bsdos-pc-nobold, and + bsdos-bold to bsdos-pc (patch by Jeffrey C Honig). + + modify tput to accept termcap names as an alternative to terminfo + names (patch by Jeffrey C Honig). + + correct a typo in term.7 (Todd Miller). + + add configure --with-shlib-version option to allow installing shared + libraries named according to release or ABI versions. This + parameterizes some existing logic in the configure script, and is + intended for compatiblity upgrades on Digital Unix, which used + versioned libraries in ncurses 4.2, but no longer does (cf: 980425). + + resync configure script against autoconf 2.13 + patches + + minor improvements for teraterm terminfo entry based on the program's + source distribution. + +990116 + + change default for configure --enable-big-core to assume machines do + have enough memory to resolve terminfo.src in-memory. + + correct name of ncurses library in TEST_ARGS when configuring with + debug library. + + minor fixes to compile ncurses library with broken-linker with g++. + + add --enable-broken-linker configure option, default to environment + variable $BROKEN_LINKER (request by Jeffrey C Honig). + + change key_names[] array to static since it is not part of the curses + interface (reported by Jeffrey C Honig <jch@bsdi.com>). + +990110 + + add Tera Term terminfo entry - TD + +990109 + + reviewed/corrected macros in curses.h as per XSI document. + + provide support for termcap PC variable by copying it from terminfo + data and using it as the padding character in tputs (reported by + Alexander Lukyanov). + + corrected iris-ansi and iris-ansi-ap terminfo entries for kent and + kf9-kf12 capabilities, as well as adding kcbt. + + document the mouse handling mechanism in menu_driver and make a small + change in menu_driver's return codes to provide more consistency + (patch by Juergen Pfeifer). + + add fallback definition for NCURSES_CONST to termcap.h.in (reported + by Uchiyama Yasushi <uch@nop.or.jp>). + + move lib_restart.c to ncurses/base, since it uses curses functions + directly, and therefore cannot be used in libtinfo.so + + rename micro_char_size to micro_col_size, adding #define to retain + old name. + + add set_a_attributes and set_pglen_inch to terminfo structure, as per + XSI and Solaris 2.5. + + minor makefile files to build ncurses test_progs + + update html files in misc directory to reflect changes since 4.2 + +990102 + + disable scroll hints when hashmap is enabled (patch by Alexander + Lukyanov). + + move logic for tic's verify of -e option versus -I and -C so that the + terminfo data is not processed if we cannot handle -e (reported by + Steven Schwartz <steves@unitrends.com>. + + add test-driver traces to terminfo and termcap functions. + + provide support for termcap ospeed variable by copying it from the + internal cur_term member, and using ospeed as the baudrate reference + for the delay_output and tputs functions. If an application does not + set ospeed, the library behaves as before, except that _nc_timed_wait + is no longer used, or needed, since ospeed always has a value. But + the application can modify ospeed to adjust the output of padding + characters (from a bug report for screen 3.7.6 and email from Michael + Schroeder <Michael.Schroeder@informatik.uni-erlangen.de>). + + removed some unused ifdef's as part of Alexander's restructuring. + + reviewed/updated curses.h, term.h against X/Open Curses Issue 4 + Version 2. This includes making some parameters NCURSES_CONST + rather than const, e.g., in termcap.h. + + change linux terminfo entry to use ncv#2, since underline does not + work with color + +981226 + + miscellaneous corrections for curses.h to match XSI. + + change --enable-no-padding configure option to be normally enabled. + + add section to ncurses manpage for environment variables. + + investigated Debian bug report that pertains to screen 3.7.4/3.7.6 + changes, found no sign of problems on Linux (or on SunOS, Solaris) + running screen built with ncurses. + + check if tmp_fp is opened in tic.c before closing it (patch by Pavel + Roskin <pavel_roskin@geocities.com>). + + correct several font specification typos in man-pages. + +981220 + + correct default value for BUILD_CC (reported by Larry Virden). + +981219 + + modify _nc_set_writedir() to set a flag in _nc_tic_dir() to prevent + it from changing the terminfo directory after chdir'ing to it. + Otherwise, a relative path in $TERMINFO would confuse tic (from a + Debian bug report). + + correct/update ncsa terminfo entry (report by Larry Virden). + + update xterm-xfree86 terminfo to current (patch 90), smcur/rmcur changes + + add Mathew Vernon's mach console entries to terminfo.src + + more changes, moving functions, as part of Alexander's restructuring. + + modify configure script for GNU/Hurd share-library support, introduce + BUILD_CC variable for cross compiling (patch by Uchiyama Yasushi + <uch@nop.or.jp>) + +981212 + + add environment variable NCURSES_NO_SETBUF to allow disabling the + setbuf feature, for testing purposes. + + correct ifdef's for termcap.h versus term.h that suppress redundant + declarations of prototypes (reported by H.J.Lu). + + modify Makefile.os2 to add linker flags which allow multiple copies + of an application to coexist (reported by Ilya Zakharevich). + + update Makefile.glibc and associated configure script so that ncurses + builds as a glibc add-on with the new directory configuration + (reported by H.J.Lu). + +981205 + + modify gen_reps() function in gen.c to work properly on SunOS + (sparc), which is a left-to-right architecture. + + modify relative_move and tputs to avoid an interaction with the + BSD-style padding. The relative_move function could produce a string + to replace on the screen which began with a numeric character, which + was then interpreted by tputs as padding. Now relative_move will not + generate a string with a leading digit in that case (overwrite). + Also, tputs will only interpret padding if the string begins with a + digit; as coded it permitted a string to begin with a decimal point + or asterisk (reported by Larry Virden). + > patches by Juergen Pfeifer: + + fix a typo in m_driver.c mouse handling and improves the error + handling. + + fix broken mouse handling in the Ada95 binding + + make the Ada95 sample application menus work with the new menu mouse + support + + improve the mouse handling introduced by Ilya; it now handles menus + with spacing. + + repair a minor bug in the menu_driver code discovered during this + rework. + + add new function wmouse_trafo() to hide implementation details of + _yoffset member of WINDOW struct needed for mouse coordinate + transformation. + +981128 + + modify Ada95/gen/gen.c to avoid using return-value of sprintf, since + some older implementations (e.g., SunOS 4.x) return the buffer + address rather than its length. + > patch by Rick Ohnemus: + + modify demo.cc to get it to compile with newer versions of egcs. + + trim a space that appears at the end of the table preprocessor lines + ('\" t). This space prevents some versions of man from displaying + the pages - changed to remove all trailing whitespace (TD) + + finally, 'make clean' does not remove panel objects. + > patches by Ilya Zakharevich: + + allow remapping of OS/2 mouse buttons using environment variable + MOUSE_BUTTONS_123 with the default value 132. + + add mouse support to ncurses menus. + +981121 + + modify misc/makedef.cmd to report old-style .def file symbols, and to + generate the .def files sorted by increasing names rather than the + reverse. + + add misc/*.ref which are J.J.G.Ripoll's dll definition files (renamed + from misc/*.old), and updated based on the entrypoint coding he used + for an older version of ncurses. + + add README.emx, to document how to build on OS/2 EMX. + + updates for config.guess, config.sub from Lynx + > patches by Ilya Zakharevich: + + minor fixes for mouse handling mode: + a) Do not initialize mouse if the request is to have no mouse; + b) Allow switching of OS/2 VIO mouse on and off. + + modify Makefile.os2 to support alternative means of generating + configure script, by translating Unix script with Perl. + > patches by Juergen Pfeifer: + + Updates MANIFEST to reflect changes in source structure + + Eliminates a problem introduced with my last patch for the C++ + binding in the panels code. It removes the update() call done in the + panel destructor. + + Changes in the Ada95 binding to better support systems where + sizeof(chtype)!=sizeof(int) (e.g. DEC Alpha). + +981114 + + modify install-script for manpages to skip over .orig and .rej files + (request by Larry Virden). + > patches/discussion by Alexander Lukyanov: + + move base-library sources into ncurses/base and tty (serial terminal) + sources into ncurses/tty, as part of Alexander Lukyanov's proposed + changes to ncurses library. + + copy _tracemouse() into ncurses.c so that lib_tracemse.c need not + be linked into the normal ncurses library. + + move macro winch to a function, to hide details of struct ldat + > patches by Juergen Pfeifer: + + fix a potential compile problem in cursesw.cc + + some Ada95 cosmetics + + fix a gen.c problem when compiling on 64-Bit machines + + fix Ada95/gen/Makefile.in "-L" linker switch + + modify Ada95 makefiles to use the INSTALL_PREFIX setting. + +981107 + + ifdef'd out lib_freeall.c when not configured. + + rename _tracebits() to _nc_tracebits(). + + move terminfo-library sources into ncurses/tinfo, and trace-support + functions into ncurses/trace as part of Alexander Lukyanov's proposed + changes to ncurses library. + + modify generated term.h to always specify its own definitions for + HAVE_TERMIOS_H, etc., to guard against inclusion by programs with + broken configure scripts. + +981031 + + modify terminfo parsing to accept octal and hexadecimal constants, + like Solaris. + + remove an autoconf 2.10 artifact from the configure script's check + for "-g" compiler options. (Though harmless, this confused someone + at Debian, who recently issued a patch that results in the opposite + effect). + + add configure option --with-ada-compiler to accommodate installations + that do not use gcc as the driver for GNAT (patch by Juergen + Pfeifer). + +981017 + + ensure ./man exists in configure script, needed when configuring + with --srcdir option. + + modify infocmp "-r" option to remove limit on formatted termcap + output, which makes it more like Solaris' version. + + modify captoinfo to treat no-argument case more like Solaris' version, + which uses the contents of $TERMCAP as the entry to format. + + modify mk-2nd.awk to handle subdirectories, e.g., ncurses/tty + (patch by Alexander V Lukyanov). + +981010 + + modify --with-terminfo-dirs option so that the default value is the + ${datadir} value, unless $TERMINFO_DIRS is already set. This gets + rid of a hardcoded list of candidate directories in the configure + script. + + add some error-checking to _nc_read_file_entry() to ensure that + strings are properly terminated (Todd Miller). + + rename manpage file curs_scr_dmp.3x to curs_scr_dump.3x, to + correspond with contents (reported by Neil Zanella + <nzanella@cs.mun.ca>). + + remove redundant configure check for C++ which did not work when $CXX + was specified with a full pathname (reported by Andreas Jaeger). + + corrected bcopy/memmove check; the macro was not standalone. + +981003 + + remove unnecessary portion of OS/2 EMX mouse change from + check_pending() (reported by Alexander V Lukyanov). + +980926 + + implement mouse support for OS/2 EMX (adapted from patch against + 4.2(?) by Ilya Zakharevich). + + add configure-check for bcopy/memmove, for 980919 changes to hashmap. + + merge Data General terminfo from Hasufin <hasufin@vidnet.net> - TD + + merge AIX 3.2.5 terminfo descriptions for IBM terminals, replaces + some older entries - TD + + modify tic to compile into %'char' form in preference to %{number}, + since that is a little more efficient. + + minor correction to infocmp to avoid displaying "difference" between + two capabilities that are rendered in equivalent forms. + + add -g option to tic/infocmp to force character constants to be + displayed in quoted form. Otherwise their decimal values are shown. + + modify setupterm so that cancelled strings are treated the same as + absent strings, cancelled and absent booleans false (does not affect + tic, infocmp). + + modify tic, infocmp to discard redundant i3, r3 strings when output + to termcap format. + > patch by Alexander V Lukyanov: + + improve performance of tparm, now it takes 19% instead of 25% when + profiling worm. + + rename maxlen/minlen to prec/width for better readability. + + use format string for printing strings. + + use len argument correctly in save_text, and pass it to save_number. + +980919 + + make test_progs compile (but hashmap does not function). + + correct NC_BUFFERED macro, used in lib_mvcur test-driver, modify + associated logic to avoid freeing the SP->_setbuf data. + + add modules home_terminfo and getenv_num to libtinfo. + + move write_entry to libtinfo, to work with termcap caching. + + minor fixes to blue.c to build with atac. + + remove softscroll.c module; no longer needed for testing. + > patches by Todd C Miller: + + use strtol(3) instead of atoi(3) when parsing env variables so we can + detect a bogus (non-numeric) value. + + check for terminal names > MAX_NAME_SIZE in a few more places when + dealing with env variables again. + + fix a MAX_NAME_SIZE that should be MAX_NAME_SIZE+1 + + use sizeof instead of strlen(3) on PRIVATE_INFO since it is a fixed + string #define (compile time vs runtime). + + when setting errno to ENOMEM, set it right before the return, not + before code that could, possibly, set errno to a different value. + > patches by Alexander V Lukyanov: + + use default background in update_cost_from_blank() + + disable scroll-hints when hashmap is configured. + + improve integration of hashmap scrolling code, by adding oldhash and + newhash data to SP struct. + + invoke del_curterm from delscreen. + + modify del_curterm to set cur_term to null if it matches the function's + parameter which is deleted. + + modify lib_doupdate to prefer parm_ich to the enter_insert_mode and + exit_insert_mode combination, adjusting InsCharCost to check + enter_insert_mode, exit_insert_mode and insert_padding. Add + insert_padding in insert mode after each char. This adds new costs + to the SP struct. + +980912 + + modify test-driver in lib_mvcur.s to use _nc_setbuffer, for consistent + treatment. + + modify ncurses to restore output to unbuffered on endwin, and resume + buffering in refresh (see lib_set_term.c and NC_BUFFERED macro). + + corrected HTML version numbers (according to the W3C validator, they + never were HTML 2.0-compliant, but are acceptable 3.0). + +980905 + + modify MKterminfo.sh to generate terminfo.5 with tables sorted by + capability name, as in SVr4. + + modified term.h, termcap.h headers to avoid redundant declarations. + + change 'u_int' type in tset.c to unsigned, making this compile on + Sequent PRX 4.1 (reported by Michael Sterrett <msterret@coat.com>). + +980829 + + corrections to mailing addresses, and moving the magic line that + causes the man program to invoke tbl to the first line of each + manpage (patch by Rick Ohnemus <rick@ecompcon.com>). + + add Makefile.os2 and supporting scripts to generate dll's on OS/2 EMX + (from J.J.G.Ripoll, with further integration by TD). + + correct a typo in icl6404 terminfo entry. + + add xtermm and xtermc terminfo entries. + > from esr's terminfo version: + + Added Francesco Potorti's tuned Wyse 99 entries. + + dtterm enacs correction from Alexander V Lukyanov. + + Add ncsa-ns, ncsa-m-ns and ncsa-m entries from esr version. + +980822 + + document AT&T acs characters in terminfo.5 manpage. + + use EMX _scrsize() function if terminfo and environment do not + declare the screen size (reported by Ilya Zakharevich + <ilya@math.ohio-state.edu>). + + remove spurious '\' characters from eterm and osborne terminfo + entries (prompted by an old Debian bug report). + + correct reversed malloc/realloc calls in _nc_doalloc (reported by + Hans-Joachim Widmaier <hjwidmai@foxboro.com>). + + correct misplaced parenthesis which caused file-descriptor from + opening termcap to be lost, from 980725 changes (reported by Andreas + Jaeger). + +980815 + + modify lib_setup.c to eliminate unneeded include of <sys/ioctl.h> when + termios is not used (patch by Todd C Miller). + + add function _nc_doalloc, to ensure that failed realloc calls do not + leak memory (reported by Todd C Miller). + + improved ncsa-telnet terminfo entry. + +980809 + + correct missing braces around a trace statement in read_entry.c, + from 980808 (reported by Kim DeVaughn <kimdv@best.com> and Liviu + Daia). + +980808 + + fix missing include <errno.h> in ditto.c (reported by Bernhard + Rosenkraenzer <bero@k5.sucks.eu.org>) + + add NCSA telnet terminfo entries from Francesco Potorti + <F.Potorti@cnuce.cnr.it>, from Debian bug reports. + + make handling of $LINES and $COLUMNS variables more compatible with + Solaris by allowing them to individually override the window size + as obtained via ioctl. + +980801 + + modify lib_vidattr.c to allow for terminal types (e.g., xterm-color) + which may reset all attributes in the 'op' capability, so that colors + are set before turning on bold and other attributes, but still after + turning attributes off. + + add 'ditto.c' to test directory to illustrate use of newterm for + initializing multiple screens. + + modify _nc_write_entry() to recover from failed attempt to link alias + for a terminfo on a filesystem which does not preserve character case + (reported by Peter L Jordan <PJordan@chla.usc.edu>). + +980725 + + updated versions of config.guess and config.sub based on automake 1.3 + + change name-comparisons in lib_termcap to compare no more than 2 + characters (gleaned from Debian distribution of 1.9.9g-8.8, verified + with Solaris curses). + + fix typo in curs_insstr.3x (patch by Todd C Miller) + + use 'access()' to check if ncurses library should be permitted to + open or modify files with fopen/open/link/unlink/remove calls, in + case the calling application is running in setuid mode (request by + Cristian Gafton <gafton@redhat.com>, responding to Duncan Simpson + <dps@io.stargate.co.uk>). + + arm100 terminfo entries from Dave Millen <dmill@globalnet.co.uk>). + + qnxt2 and minitel terminfo entries from esr's version. + +980718 + + use -R option with ldconfig on FreeBSD because otherwise it resets + the search path to /usr/lib (reported by Dan Nelson). + + add -soname option when building shared libraries on OpenBSD 2.x + (request by QingLong). + + add configure options --with-manpage-format and --with-manpage-renames + (request by QingLong). + + correct conversion of CANCELLED_NUMERIC in write_object(), which was + omitting the high-order byte, producing a 254 in the compiled + terminfo. + + modify return-values of tgetflag, tgetnum, tgetstr, tigetflag, + tigetnum and tigetstr to be compatible with Solaris (gleaned from + Debian distribution of 1.9.9g-8.8). + + modify _nc_syserr_abort to abort only when compiled for debugging, + otherwise simply exit with an error. + +980711 + + modify Ada95 'gen' program to use appropriate library suffix (e.g., + "_g" for a debug build). + + update Ada95 'make clean' rule to include generics .ali files + + add a configure test to ensure that if GNAT is found, that it can + compile/link working Ada95 program. + + flush output in beep and flash functions, fixing a problem with + getstr (patch by Alexander V Lukyanov) + + fix egcs 1.0.2 warning for etip.h (patch by Chris Johns). + + correct ifdef/brace nesting in lib_sprintf.c (patch by Bernhard + Rosenkraenzer <bero@Pool.Informatik.RWTH-Aachen.DE>). + + correct typo in wattr_get macro from 980509 fixes (patch by Dan + Nelson). + +980704 + + merge changes from current XFree86 xterm terminfo descriptions. + + add configure option '--without-ada'. + + add a smart-default for termcap 'ac' to terminfo 'acs_chars' which + corresponds to vt100. + + change translation for termcap 'rs' to terminfo 'rs2', which is + the documented equivalent, rather than 'rs1'. + +980627 + + slow 'worm' down a little, for very fast machines. + + corrected firstchar/lastchar computation in lib_hline.c + + simplify some expressions with CHANGED_CELL, CHANGED_RANGE and + CHANGED_TO_EOL macros. + + modify init_pair so that if a color-pair is reinitialized, we will + repaint the areas of the screen whose color changes, like SVr4 curses + (reported by Christian Maurer <maurer@inf.fu-berlin.de>). + + modify getsyx/setsyx macros to comply with SVr4 man-page which + says that leaveok() affects their behavior (report by Darryl Miles, + patch by Alexander V Lukyanov). + +980620 + + review terminfo.5 against Solaris 2.6 curses version, corrected + several minor errors/omissions. + + implement tparm %l format. + + implement tparm printf-style width and precision for %s, %d, %x, %o + as per XSI. + + implement tparm dynamic variables (reported by Xiaodan Tang). + +980613 + + update man-page for for wattr_set, wattr_get (cf: 980509) + + correct limits in hashtest, which would cause nonprinting characters + to be written to large screens. + + correct configure script, when --without-cxx was specified: the + wrong variable was used for cf_cv_type_of_bool. Compilers up to gcc + 2.8 tolerated the missing 'int'. + + remove the hardcoded name "gcc" for the GNU Ada compiler. The + compiler's name might be something like "egcs" (patch by Juergen + Pfeifer). + + correct curs_addch.3x, which implied that echochar could directly + display control characters (patch by Alexander V Lukyanov). + + fix typos in ncurses-intro.html (patch by Sidik Isani + <isani@cfht.hawaii.edu>) + +980606 + + add configure test for conflicting use of exception in math.h and + other headers. + + minor optimization to 'hash()' function in hashmap.c, reduces its + time by 10%. + + correct form of LD_SHARED_OPTS for HP-UX 10.x (patch by Tim Mooney). + + fix missing quotes for 'print' in MKunctrl.awk script (reported by + Mihai Budiu <mihaib@gs41.sp.cs.cmu.edu>). + > patch by Alexander V Lukyanov: + + correct problem on Solaris (with poll() function) where getch could + hang indefinitely even if timeout(x) was called. This turned out to + be because milliseconds was not updated before 'goto retry' in + _nc_timed_wait. + + simplified the function _nc_timed_wait and fixed another bug, which + was the assumption of !GOOD_SELECT && HAVE_GETTIMEOFDAY in *timeleft + assignment. + + removed the cycle on EINTR, as it seems to be useless. + +980530 + + add makefile-rule for test/keynames + + modify run_tic.sh and shlib to ensure that user's .profile does not + override the $PATH used to run tic (patch by Tim Mooney). + + restore LD_SHARED_OPTS to $(LD_SHARED_FLAGS) when linking programs, + needed for HP-UX shared-library path (recommended by Tim Mooney). + + remove special case of HP-UX -L options, use +b options to embed + $(libdir) in the shared libraries (recommended by Tim Mooney). + + add checks for some possible buffer overflows and unchecked + malloc/realloc/calloc/strdup return values (patch by Todd C Miller + <Todd.Miller@courtesan.com>) + +980523 + + correct maxx/maxy expression for num_columns/num_lines in derwin + (patch by Alexander V Lukyanov). + + add /usr/share/lib/terminfo and /usr/lib/terminfo as compatibilty + fallbacks to _nc_read_entry(), along with --with-terminfo-dirs + configure option (suggested by Mike Hopkirk). + + modify config.guess to recognize Unixware 2.1 and 7 (patch by Mike + Hopkirk <hops@sco.com>). + + suppress definition of CC_SHARED_OPTS in LDFLAGS_SHARED in c++ + Makefile.in, since this conflicts when g++ is used with HP-UX + compiler (reported by Tim Mooney). + + parenthesize 'strcpy' calls in c++ binding to workaround redefinition + in some C++ implementations (reported by several people running + egcs with glibc 2.0.93, analysis by Andreas Jaeger. + +980516 + + modify write_entry.c so that it will not attempt to link aliases + with embedded '/', but give only a warning. + + put -L$(libdir) first when linking programs, except for HP-UX. + + modify comp_scan.c to handle SVr4 terminfo description for att477, + which contains a colon in the description field. + + modify configure script to support SCO osr5.0.5 shared libraries + (from comp.unix.sco.programmer newsgroup item by Mike Hopkirk + <hops@sco.com>). + + eliminate extra GoTo call in lib_doupdate.c (patch by Alexander V. + Lukyanov). + + minor adjustments of const/NCURSES_CONST from IRIX compile. + + add updates based on esr's 980509 version of terminfo.src. + +980509 + + correct macros for wattr_set, wattr_get, separate wattrset macro from + these to preserve behavior that allows attributes to be combined with + color pair numbers. + + add configure option --enable-no-padding, to allow environment + variable $NCURSES_NO_PADDING to eliminate non-mandatory padding, + thereby making terminal emulators (e.g., for vt100) a little more + efficient (request by Daniel Eisenbud <eisenbud@cs.swarthmore.edu>). + + modify configure script to embed ABI in shared libraries for HP-UX + 10.x (detailed request by Tim Mooney). + + add test/example of the 'filter()' function. + + add nxterm and xterm-color terminfo description (request by Cristian + Gafton <gafton@redhat.com>). + + modify rxvt terminfo description to clear alternate screen before + switching back to normal screen, for compatibility with applications + which use xterm (reported by Manoj Kasichainula <manojk@io.com>). + + modify linux terminfo description to reset color palette (reported + by Telford Tendys <telford@eng.uts.edu.au>). + + correction to doupdate, for case where terminal does not support + insert/delete character. The logic did not check that there was a + difference in alignment of changes to old/new screens before + repainting the whole non-blank portion of the line. Modified to fall + through into logic that reduces by the portion which does not differ + (reported by Daniel Eisenbud <eisenbud@cs.swarthmore.edu>). + + minor performance improvement to wnoutrefresh by moving some + comparisons out of inner loop. + +980425 + + modify configure script to substitute NCURSES_CONST in curses.h + + updated terminfo entries for xterm-xf86-v40, xterm-16color, + xterm-8bit to correspond to XFree86 3.9Ag. + + remove restriction that forces ncurses to use setaf/setab if the + number of colors is greater than 8. (see 970524 for xterm-16color). + + change order of -L options (so that $(libdir) is searched first) when + linking tic and other programs, to workaround HP's linker. + Otherwise, the -L../lib is embedded when linking against shared + libraries and the installed program does not run (reported by Ralf + Hildebrandt). + + modify configuration of shared libraries on Digital Unix so that + versioning is embedded in the library, rather than implied by + links (patch by Tim Mooney). + +980418 + + modify etip.h to avoid conflict with math.h on HP-UX 9.03 with gcc + 2.8.1 which redefines 'exception' (reported by Ralf Hildebrandt + <R.Hildebrandt@tu-bs.de>). + + correct configure tests in CF_SHARED_OPTS which used $CC value to + check for gcc, rather than autoconf's $GCC value. This did not + work properly if the full pathname of the compiler were given + (reported by Michael Yount <yount@csf.Colorado.edu>). + + revise check for compiler options to force ANSI mode since repeating + an option such as -Aa causes HP's compiler to fail on its own headers + (reported by Clint Olsen <olsenc@ichips.intel.com>). + +980411 + + ifdef'd has_key() and mcprint() as extended functions. + + modified several prototypes to correspond with 1997 version of + X/Open Curses (affects ABI since developers have used attr_get). + + remove spurious trailing blanks in glibc addon-scripts (patch by + H.J.Lu). + + insert a few braces at locations where gcc-2.8.x asks to use them to + avoid ambigous else's, use -fpic rather than -fPIC for Linux (patch + by Juergen Pfeifer). + +980404 + + split SHLIB_LIST into SHLIB_DIRS/SHLIB_LIST to keep -L options + before -l to accommodate Solaris' linker (reported by Larry Virden). + +980328 + + modify lib_color.c to eliminate dependency on orig_colors and + orig_pair, since SVr4 curses does not require these either, but + uses them when they are available. + + add detailed usage-message to infocmp. + + correct a typo in att6386 entry (a "%?" which was "?"). + + add -f option to infocmp and tic, which formats the terminfo + if/then/else/endif so that they are readable (with newlines and + tabs). + + fixes for glibc addon scripts (patch by H.J.Lu). + +980321 + + revise configure macro CF_SPEED_TYPE so that termcap.h has speed_t + declared (from Adam J. Richter <adam@yggdrasil.com>) + + remove spurious curs_set() call from leaveok() (J.T.Conklin). + + corrected handling leaveok() in doupdate() (patch by Alexander V. + Lukyanov). + + improved version of wredrawln (patch by Alexander V. Lukyanov). + + correct c++/Makefile.in so install target do not have embedded ../lib + to confuse it (patch by Thomas Graf <graf@essi.fr>). + + add warning to preinstall rule which checks if the installer would + overwrite a curses.h or termcap.h that is not derived from ncurses. + (The recommended configuration for developers who need both is to + use --disable-overwrite). + + modify preinstall rule in top-level Makefile to avoid implicit + use of 'sh', to accommodate Ultrix 4.4 (reported by Joao Palhoto + Matos <jmatos@math.ist.utl.pt>, patch by Thomas Esser + <te@informatik.uni-hannover.de>) + + refine ifdef's for TRACE so that libncurses has fewer dependencies + on libtinfo when TRACE is disabled. + + modify configure script so that if the --with-termlib option is used + to generate a separate terminfo library, we chain it to the ncurses + library with a "-l" option (reported by Darryl Miles and Ian T. + Zimmerman). + +980314 + + correct limits and window in wredrawln function (reported/analysis by + Alexander V. Lukyanov). + + correct sed expression in configure script for --with-fallback + option (patch by Jesse Thilo). + + correct some places in configure script where $enableval was used + rather than $withval (patch by Darryl Miles <dlm@g7led.demon.co.uk>). + + modify some man-pages so no '.' or '..' falls between TH and SH + macros, to accommodate man_db program (reported by Ian T. Zimmerman + <itz@rahul.net>). + + terminfo.src 10.2.1 from Eric's webpage. + > several changes by Juergen Pfeifer: + + add copyright notices (and rcs id's) on remaining man-pages. + + corrected prototypes for slk_* functions, using chtype rather than + attr_t. + + implemented the wcolor_set() and slk_color() functions + + the slk_attr_{set,off,on} functions need an additional void* + parameter according to XSI. + + fix the C++ and Ada95 binding as well as the man pages to + reflect above enhancements. + +980307 + + use 'stat()' rather than 'access()' in toe.c to check for the + existence of $HOME/.terminfo, since it may be a file. + + suppress configure CF_CXX_LIBRARY check if we are not using g++ + 2.7.x, since this is not needed with g++ 2.8 or egcs (patch by + Juergen Pfeifer). + + turn on hashmap scrolling code by default, intend to remedy defects + by 4.3 release. + + minor corrections to terminfo.src changelog. + +980302 4.2 release for upload to prep.ai.mit.edu + + correct Florian's email address in ncurses-intro.html + + terminfo.src 10.2.0 from Eric. + +980228 pre-release + + add linux-koi8r replace linux-koi8, which is not KOI8 (patch by + QingLong <qinglong@Bolizm.ihep.su>). + + minor documentation fixes (patch by Juergen Pfeifer). + + add setlocale() call to ncurses.c (reported by Claes G. Lindblad + <claesg@algonet.se>). + + correct sign-extension in lib_insstr.c (reported by Sotiris + Vassilopoulos <svas@leon.nrcps.ariadne-t.gr>) + +980221 pre-release + + regenerated some documentation overlooked in 980214 patch + (ncurses-intro.doc, curs_outopts.3x.html) + + minor ifdef change to C++ binding to work with gcc 2.8.0 (patch by + Juergen Pfeifer). + + change maintainer's mailing address to florian@gnu.org, change + tentative mailing list address to bug-ncurses-request@gnu.org (patch + by Florian La Roche). + + add definition of $(REL_VERSION) to c++/Makefile.in (reported by Gran + Hasse <gh@raditex.se>). + + restore version numbers to Ada95 binding, accidentally deleted by + copyright patch (patch by Juergen Pfeifer). + +980214 pre-release + + remove ncurses.lsm from MANIFEST so that it won't be used in FSF + distributions, though it is retained in development. + + correct scaling of milliseconds to nanoseconds in lib_napms.c (patch + by Jeremy Buhler). + + update mailing-list information (bug-ncurses@gnu.org). + + update announcement for upcoming 4.2 release. + + modify -lm test to check for 'sin()' rather than 'floor()' + + remove spurious commas from terminfo.src descriptions. + + change copyright notices to Free Software Foundation + +980207 + + minor fixes for autoconf macros CF_ERRNO, CF_HELP_MESSAGE and + CF_SIZECHANGE + + modify Makefile.glibc so that $(objpfx) is defined (H.J.Lu). + + ifdef-out true-return from _nc_mouse_inline() which depends on + merge of QNX patch (pending 4.2 release). + > patch by J.T.Conklin, to split off seldom-used modules in ncurses + (reduces size by up to 2.6kb): + + move functionality of _nc_usleep into napms, add configuration case + for nanosleep(). + + moved wchgat() from lib_addch.c to lib_chgat.c + + moved clearok(), immedok(), leaveok(), and scrollok() from + lib_options.c to lib_clearok.c, lib_immedok.c, lib_leaveok.c and + lib_scrollok.c. + + moved napms() from lib_kernel.c to lib_napms.c + + moved echo() and noecho() from lib_raw.c to lib_echo.c + + moved nl() and nonl() from lib_raw.c to lib_nl.c + +980131 + + corrected conversion in tclock.c (cf: 971018). + + updates to Makefile.glibc and associated Linux configure script + (patch by H.J.Lu). + + workaround a quoting problem on SunOS with tar-copy.sh + + correct init_pair() calls in worm.c to work when use_default_colors() + is not available. + + include <sys/types.h> in CF_SYS_TIME_SELECT to work with FreeBSD 2.1.5 + + add ncv capability to FreeBSD console (cons25w), making reverse + work with color. + + correct sense of configure-test for sys/time.h inclusion with + sys/select.h + + fixes for Ada95/ada_include/Makefile.in to work with --srcdir option. + + remove unused/obsolete test-program rules from progs/Makefile.in + (the rules in ncurses/Makefile.in work). + + remove shared-library loader flags from test/Makefile.in, etc. + + simplify test/configure.in using new version of autoconf to create + test/ncurses_cfg.h + + suppress suffix rules in test/Makefile.in, provide explicit dependency + to work with --srcdir option and less capable 'make' programs. + > adapted from patch for QNX by Xiaodan Tang: + + initialize %P and %g variables set/used in tparm, and also ensure + that empty strings don't return a null result from tparam_internal + + add QNX-specific prototype for vsscanf() + + move initialization of SP->_keytry from init_keytry() to newterm() to + avoid resetting it via a keyok() call by mouse_activate(). + + reorganized some functions in lib_mouse() to use case-statements. + + remove sgr string from qnx terminfo entry since it is reported to + turn off attributes inconsistently. + +980124 + + add f/F/b/B commands to ncurses 'b' test to toggle colors, providing + test for no_color_video. + + adjusted emx.src to use no_color_video, now works with ncurses 'b' + and 'k' tests. + + implement no_color_video attribute, and as a special case, reverse + colors when the reverse attribute cannot be combined with color. + + check for empty string in $TERM variable (reported by Brett Michaels + <brett@xylan.com>). + > from reports by Fred Fish: + + add configure-test for isascii + + add configure-test for -lm library. + + modify CF_BOOL_SIZE to check if C++ bool types are unsigned. + > patches by J.J.G.Ripoll + + add configure/makefile variables to support .exe extension on + OS/2 EMX (requires additional autoconf patches). + + explicitly initialize variables in lib_data.c to appease OS/2 linker + > patches by Fred Fish <fnf@ninemoons.com> + + misc/Makefile.in (install.data): Avoid trying to install the CVS + directory. + + aclocal.m4 (install.includes): Remove files in the include directory + where we are going to install new ones, not the original source + files. + + misc/terminfo.src: Add entry for "beterm", derived from termcap + distributed with BeOS PR2 using captoinfo. + + aclocal.m4: Wrap $cf_cv_type_of_bool with quotes (contains space) + + aclocal.m4: Assume bool types are unsigned. + + progs/infocmp.c: workaround mwcc 32k function data limit + +980117 + + correct initialization of color-pair (from 970524) in xmas.c, which + was using only one color-pair for all colors (reported by + J.J.G.Ripoll). + + add multithread options for objects build on EMX, for compatibility + with XFree86. + + split up an expression in MKlib_gen.sh to work around a problem on + OS/2 EMX, with 'ash' (patch by J.J.G.Ripoll). + + change terminfo entries xterm (xterm-xf86-v40), xterm-8bit rs1 to use + hard reset. + + rename terminfo entry xterm-xf86-v39t to xterm-xf86-v40 + + remove bold/underline from sun console entries since they're not + implemented. + + correct _tracef calls in _tracedump(), which did not separate format + from parameters. + + correct getopt string for tic "-o" option, and add it to man-page + synopsis (reported by Darren Hiebert <darren@hmi.com>). + + correct typo in panel/Makefile.in, reversed if-statement in scrolling + optimization (Alexander V. Lukyanov). + + test for 'remove()', use 'unlink() if not found (patch by Philippe De + Muyter <phdm@macqel.be>). + > patches by Juergen Pfeifer: + + Improve a feature of the forms driver. For invisible fields + (O_VISIBLE off) only the contents but not the attributes are cleared. + We now clear both. (Reported by Javier Kohan + <jkohan@adan.fceia.unr.edu.ar>) + + The man page form_field_opts.3x makes now clear, that invisible + fields are also always inactive. + + adjust ifdef's to compile the C++ binding with the just released + gcc-2.8.0 c++ and the corresponding new C++ libraries. + +980110 + + correct "?" command in ncurses.c; it was performing non-screen writes + while the program was in screen mode. (It "worked" in 1.9.9e because + that version sets OPOST and OCRNL incorrectly). + + return error from functions in lib_kernel, lib_raw and lib_ti if + cur_term is null, or if underlying I/O fails. + + amend change to tputs() so that it does not return an error if + cur_term is null, since some applications depend on being able to use + tputs without initializing the terminal (reported by Christian J. + Robinson <infynity@cyberhighway.net>). + +980103 + + add a copy of emx.src from J.J.G.Ripoll's OS/2 EMX version of ncurses + 1.9.9e, together with fixes/additions for the "ansi" terminal type. + + add tic check for save/restore cursor if change_scroll_region is + defined (from O'Reilly book). + + modify read_termcap.c to handle EMX-style pathnames (reported by + J.J.G.Ripoll). + + modify lib_raw.c to use EMX's setmode (from J.J.G.Ripoll, who says + EMX's curses does this). + + modify _nc_tic_expand() to generate \0 rather than \200. + + move/revise 'expand()' from dump_entry.c to ncurses library as + _nc_tic_expand(), for use by tack. + + decode \a as \007 for terminfo, as per XSI. + + correct translation of terminfo "^@", to \200, like \0. + + modify next_char() to treat <cr><lf> the same as <newline>, for + cross-platform compatibility. + + use new version of autoconf (971230) to work around limited + environment on CLIX, due to the way autoconf builds --help message. + > patch by Juergen Pfeifer: + + check that the Ada95 binding runs against the correct version of + ncurses. + + insert constants about the library version into the main spec-file of + the Ada95 binding. + +971227 + + modify open/fopen calls to use binary mode, needed for EMX. + + modify configure script to work with autoconf 2.10 mods for OS/2 + EMX from J.J.G.Ripoll. + + generated ncurses_cfg.h with patch (971222) to autoconf 2.12 which + bypasses limited sed buffer length. + > several changes from Juan Jose Garcia Ripoll <worm@arrakis.es> + (J.J.G.Ripoll) to support OS/2 EMX: + + add a _scrolling flag to SP, to set when we encounter a terminal + that simply cannot scroll. + + corrected logic in _nc_add_to_try(), by ensuring that strings with + embedded \200 characters are matched. + + don't assume the host has 'link()' function, for linking terminfo + entries. + +971220 + + if there's no ioctl's to support sigwinch handler, disable it. + + add configure option --disable-ext-funcs to remove the extended + functions from the build. + + add configure option --with-termlib to generate the terminfo + functions as a separate library. + + add 'sources' rule to facilitate cross-compiling. + + review/fix order of mostlyclean/clean/distclean rules. + + modify install-rule for headers to first remove old header, in + case there was a symbolic link that confuses the install script. + + corrected substitution for NCURSES_CONST in term.h (cf: 971108) + + add null pointer checks in wnoutrefresh(), overlap() (patch by + Xiaodan Tang <xtang@qnx.com>) + + correct tputs(), which could dereference a null cur_term if invoked + before terminal is initialized (patch by Christopher Seawood + <cls@seawood.org>) + > patch by Juergen Pfeifer: + + makes better use of "pragma Inline" in the Ada95 binding + + resynchronizes the generated html manpages + +971213 + + additional fixes for man-pages section-references + + add (for debugging) a check for ich/ich1 conflict with smir/rmir + to tic, etc. + + remove hpa/vpa from rxvt terminal description because they are not + implemented correctly, added sgr0. + + change ncurses 's' to use raw mode, so ^Q works (reported by Rudolf + Leitgeb <leitgeb@leland.stanford.edu>) + +971206 + + modify protection when installing libraries to (normally) not + executable. HP-UX shared libraries are an exception. + + add configure check for 'tack'. + + implement script for renaming section-references in man-page install, + for Debian configuration. + + add validity-check for SP in trace code in baudrate() (reported by + Daniel Weaver). + > patch by Alexander V. Lukyanov (fixes to match sol25 curses) + + modify 'overlay()' so that copy applies target window background to + characters. + + correct 'mvwin()' so that it does not clear the previous locations. + + correct lib_acs.c so that 8-bit character is not sign expanded in + case of wide characters in chtype. + + correct control-char test in lib_addch.c for use with wide chars + + use attribute in the chtype when adding a control character in + lib_addch.c control char was added with current attribute + +971129 + + save/restore errno in _tracef() function + + change treatment of initialize_color to use a range of 0..1000 + (recommended by Daniel Weaver). + + set umask in mkinstalldirs, fixing problems reported by users who + have set root's umask to 077. + + correct bug in tic that caused capabilities to be reprinted at the + end of output when they had embedded comments. + + rewrote wredrawln to correspond to XSI, and split-out since it is + not often used (from report by Alexander V. Lukyanov, 970825) + + rewrote Dan Nelson's change to make it portable, as well as to + correct logic for handling backslashes. + + add code to _nc_tgetent() to make it work more like a real tgetent(). + It removes all empty fields, and removes all but the first in a group + of duplicate caps. The code was pulled from the BSD libtermcap code + in termcap.c (patch by Dan Nelson <dnelson@emsphone.com> + + don't include --enable-widec in the --with-develop configure option, + since it is not binary-compatible with 4.1 (noted by Alexander V. + Lukyanov) + > patch by Juergen Pfeifer: + + further improvements of the usage of elaboration pragmas in the Ada95 + binding + + enhanced Ada95 sample to use the user_data mechanism for panels. + + a fix for the configuration script to make gnat-3.10 the required + version. + + resync of the html version of the manpages + +971122 + > fixes/updates for terminfo.src: + + add vt220-js, pilot, rbcomm, datapoint entries from esr's 27-jun-97 + version. + + add hds200 description (Walter Skorski) + + add EMX 0.9b descriptions + + correct rmso/smso capabilities in wy30-mc and wy50-mc (Daniel Weaver) + + rename xhpterm back to hpterm. + > patch by Juergen Pfeifer: + + Improves the usage of elaboration pragmas for the Ada95 binding. + + Adds a translation of the test/rain.c into Ada95 to the samples. + This has been contributed to the project by Laurent Pautet + (pautet@gnat.com) + +971115 + + increase MAX_NAME_SIZE to 512 to handle extremely long alias list + in HP-UX terminfo. + + correction & simplification of delay computation in tputs, based on + comments from Daniel Weaver. + + replace test for SCO with more precise header tests. + + add configure test for unsigned literals, use in NCURSES_BITS macro. + + comment-out the -PIC, etc., flags from c++, progs and test makefiles + since they probably are not needed, and are less efficient (noted by. + Ju"rgen Fluk) + + add -L$(libdir) to loader options, after -L../lib so that loaders + that record this information will tend to do the right thing if + the programs are moved around after installing them (suggested by. + Ju"rgen Fluk). + + add -R option to loader options for programs for Solaris if the + --enable-rpath option is specified for the libraries. + +971112 + + correct installed filename for shared libraries on *BSD (reported by + Ju"rgen Fluk). + +971108 + + cleanup logic for deciding when tputs() should call delay_output(), + based on comments from Daniel Weaver. + + modified tputs() to avoid use of float. + + correct use of trailpad in tputs(), which used the wrong variable + in call to delay_output(). + + correct inverted expression for null-count in delay_output() + (analysis by Daniel Weaver). + + apply --enable-rpath option to Solaris (requested by Larry Virden). + + correct substitution of EXTRA_CFLAGS for gcc 2.6.3 + + correct check for error-return by _nc_tgetent(), which returns 0 + for success. + + add configure test for BSD 4.4 cgetent() function, modify + read_termcap.c to use the host's version of that if found, using the + terminal database on FreeBSD (reported by Peter Wemm). + + add u8, u9 strings to sun-il description for Daniel Weaver. + + use NCURSES_CONST in panel's user-pointer. + + modify edit_cfg.sh and MKterm.h.awk.in to substitute NCURSES_CONST + so that will work on NeXT. + + use _nc_set_screen() rather than assignments to SP to fix port to + NeXT (reported by Francisco A. Tomei Torres). + +971101 + + force mandatory padding in bell and flash_screen, as specified in XSI. + + don't allow padding_baud_rate to override mandatory delays (reported + by Daniel Weaver). + + modify delay_output() to use _nc_timed_wait() if no baudrate has been + defined, or if the cur_term pointer is not initialized. XSI treats + this as unspecified. (requested by Daniel Weaver). + + change getcap-cache ifdef's to eliminate unnecessary chdir/mkdir + when that feature is not configured. + + remove _nc_err_abort() calls when write_entry.c finds a directory but + cannot write to it, e.g., when translating part/all of /etc/termcap + (reported by Andreas Jaeger <aj@arthur.rhein-neckar.de>). + (this dates back to 951102, in 1.9.7a). + + minor ifdef fixes to compile with atac and glibc 2.0.5c + + add check for -lgen when configuring regexpr.h + + modify Solaris shared-library option "-d y" to "-dy" to workaround + incompatibility of gcc 2.7.2 vs vendor's tools. + +971026 + + correct ifdef's for struct winsize vs struct ttysize in lib_setup.c + to compile on SCO. + + remove dangling backslash in panel/Makefile.in + + modify MKkeyname.awk to work with SCO's nawk, which dumps core in the + length() function. + + correct length of allocation in _nc_add_to_try(), to allow for + trailing null. + + correct logic in _nc_remove_key(), which was discarding too many + nodes (patch by Alexander V. Lukyanov) + +971025 + + add definition for $(REL_VERSION) to test/Makefile.in, so *BSD + shared libraries link properly (see 970524). + + modify Linux shared-library generation to include library + dependencies (e.g., -lncurses and -lgpm) in the forms, menu and + panel libraries (suggested by Juergen Pfeifer). + + modify configure script to use config.guess and config.sub rather + than uname, which is unreliable on some systems. + + updated Makefile.glibc, test-built with glibc 2.0.5c + + modify keyname() to return values consistent with SVr4 curses (patch + by Ju"rgen Fluk). + > changes requested by Daniel Weaver: + + modify delay_output() so that it uses the same output function as + tputs() if called from that function. + + move _baudrate from SCREEN to TERMINAL so that low-level use of + tputs works when SP is not set. + > patch by Juergen Pfeifer: + + factor lib_menu and lib_form into smaller modules + + clean up the interface between panel and SCREEN + + minor changes to the Ada95 mouse support implemenation + + minor bugfix in C++ binding to ripoff windows + + fix a few Ada95 html documentation pages + +971018 + + split-out lib_ungetch.c, make runtime link to resizeterm() to + decouple those modules from lib_restart.c + + add xterm-xf86-v39t description to terminfo.src + + reset SP->_endwin in lib_tstp.c cleanup() function after calling + endwin() to avoid unnecessary repainting if the application has + established an atexit function, etc. Encountered this problem in + the c++ demo, whose destructors repaint the screen. + + combine _nc_get_screensize() and resizeterm() calls as new function + _nc_update_screensize(). + + minor fixes to allow compile with g++ (suggested by Nelson H. F. + Beebe). + + implement install-rules for Ada95 makefiles. + + use screen_lines or MAXLINES as needed where LINES was coded, + as well as screen_columns for COLS, in the ncurses library. + > patch by Alexander V. Lukyanov: + + modify logic for ripped-off lines to handle several SCREENs. + > patch by Juergen Pfeifer: + + factors lib_slk.c into some smaller modules + + factors panel.c into some smaller modules + + puts the static information about the current panel stack into the + SCREEN structure to allow different panel stacks on different + screens. + + preliminary fix for an error adjusting LINES to account for + ripped-off lines. + +971011 + + move _nc_max_click_interval and other mouse interface items to SCREEN + struct so that they are associated with a single terminal, and also + save memory when the application does not need a mouse (roughly 3k vs + 0.5k on Linux). + + modify mouseinterval() so that a negative parameter queries the + click-interval without modifying it. + + modify ncurses 'i' test to work with ncurses' apparent extension from + SVr4, i.e., allows nocbreak+noecho (analysis by Alexander V. + Lukyanov). + + add configure options --with-ada-includes and --with-ada-objects, + to drive Ada95 binding install (not yet implemented). + + install C++ binding as -lncurses++ and associated headers with the + other ncurses headers. + + fix header uninstall if configure --srcdir is used. + > minor interface changes (request by Daniel Weaver <danw@znyx.com>, + to support 'tack' program): + + export functions _nc_trans_string() and _nc_msec_cost(). + + add variable _nc_nulls_sent, to record the number of padding + characters output in delay_output(). + + move tests for generic_type and hard_copy terminals in setupterm() + to the end of that function so that the library will still be + initialized, though not generally useful for curses programs. + > patches by Alexander V. Lukyanov: + + modify ClrBottom() to avoid using clr_eos if there is only one line + to erase. + + typo in configure --help. + > patch by J.T.Conklin (with minor resync against Juergen's changes) + + split-out lib_flash.c from lib_beep.c + + split-out lib_hline.c and lib_vline.c from lib_box.c + + split-out lib_wattron.c, lib_wattroff.c from lib_addch.c + +971005 + > patch by Juergen Pfeifer: + + correct source/target of c++/edit_cfg.sh + +971004 + + add color, mouse support to kterm terminfo entry. + + modify lib_mouse.c to recognize rxvt, kterm, color_xterm also as + providing "xterm"-style mouse. + + updated rxvt's terminfo description to correspond to 2.21b, with + fixes for the acsc (the box1 capability is incorrect, ech1 does not + work). + + fix logic in parse_entry.c that discarded acsc when 'synthesizing' + an entry from equivalents in XENIX or AIX. This lets ncurses handle + the distribution copy of rxvt's terminfo. + + modify acsc capability for linux and linux-koi8 terminfo descriptions + (from Pavel Roskin <pavel@absolute.spb.su>). + + corrected definition in curses.h for ACS_LANTERN, which was 'I' + rather than 'i' (see 970802). + + updated terminfo.src with reformatted acsc entries, and repaired the + trashed entries with spurious '\' characters that this exposed. + + add logic to dump_entry.c to reformat acsc entries into canonical + form (sorted, unique mapping). + + add configure script to generate c++/etip.h + + add configure --with-develop option, to enable by default most of the + experimental options (requested by Alexander V. Lukyanov). + + rename 'deinstall' to 'uninstall', following GNU convention (suggested + by Alexander V. Lukyanov). + > patches by Alexander V. Lukyanov: + + modify tactics 2 and 5 in onscreen_mvcur(), to allow them on the last + line of the screen, since carriage return will not cause a newline. + + remove clause from PutCharLR() that would try to use + eat_newline_glitch since that apparently does not work on some + terminals (e.g., M$ telnet). + + correct a limit check in scroll_csr_backward() + > patches by Juergen Pfeifer: + + adds dummy implementations of methods above() and below() to the + NCursesPanel class. + + fixes missing returncode in NCursesWindow::ripoffline() + + fixes missing returncode in TestApplication::run() in demo.cc + + We should at least give a comment in etip.h why it is currently a + problem to install the C++ binding somewhere + + makes the WINDOW* argument of wenclose() a const. + + modifies several of the routines in lib_adabind.c to use a const + WINDOW* argument. + +970927 + + add 'deinstall' rules. + + use explicit assignments in configure --without-progs option to + work around autoconf bug which doesn't always set $withval. + + check for ldconfig, don't try to run it if not found. + + implement simple/unoptimized case in lib_doupdate.c to handle + display with magic cookie glitch, tested with ncurses.c program. + + correct missing _tracef in getmouse(), to balance the returnCode + macro. + + simplify show_attr() in ncurses.c using termattrs(). + > patches by Juergen Pfeifer: + + provides missing inlines for mvw[hv]line in cursesw.h of the C++ + binding + + fixes a typo in a comment of frm_driver.c + + Enhances Ada95 Makefiles to fulfill the requirement of GNAT-3.10 that + generics should be compiled. Proper fixes to the configuration + scripts are also provided. + +970920 + + several modifications to the configure script (requested by Ward + Horner): + + add configure options --without-progs, to suppress the build of the + utility programs, e.g., for cross-compiling. + + add $(HOSTCCFLAGS) and $(HOSTLDFLAGS) symbols to ncurses + Makefile.in, to simplify setup for cross compiling. + + add logic in configure script to recognize "--target=vxworks", and + generate load/install actions for VxWorks objects. + + move typedef for sigaction_t into SigAction.h to work around problem + generating lint library. + + modify fty_regex.c to reflect renaming of ifdef's for regular + expressions. + + simplify ifdef in lib_setup.c for TIOCGWINSZ since that symbol may + reside in <sys/ioctl.h>. + + merge testcurs.c with version from PDCurses 2.3, clarifying some of + the more obscure tests, which rely upon color. + + use macros getbegyx() and getmaxyx() in newdemo.c and testcurs.c + + modify ncurses.c to use getbegyx() and getmaxyx() macros to cover up + implementation difference wrt SVr4 curses, allow 's' test to work. + + add missing endwin() to testscanw.c program (reported by Fausto + Saporito <fausap@itb.it>). + + fixes/updates for Makefile.glibc and related files under sysdeps + (patch by H.J.Lu). + > patches by Juergen Pfeifer: + + add checks for null pointers, especially WINDOW's throughout the + ncurses library. + + solve a problem with wrong calculation of panel overlapping (reported + by Ward Horner): + + make sure that a panel's window isn't a pad. + + do more error checking in module lib_touch.c + + missing files for Ada95 binding from the last patch + + synch. of generated html pages (RCS-Id's were wrong in html files) + + support for Key_Resize in Ada binding + + changed documentation style in ./c++/cursesm.h + > patches by Alexander V. Lukyanov: + + undo attempt to do recursive inlining for PutChar(), noting that it + did not improve timing measurably, but inflated the size of + lib_doupdate.o + +970913 + + modify rain.c to use color. + + correct scroll_csr_backward() to match scroll_csr_forward(). + + minor adjustment to llib-lncurses, to work with Solaris 2.5.1 + + minor fixes to sysdeps/unix/sysv/linux/configure to reflect renaming + of configure cache variables in 970906. + + correct logic involving changes to O_VISIBLE option in + Synchronize_Options function in frm_driver.c (Tony Hoffmann + <Tony.Hoffmann@hia.nrc.ca>) + + add $(HOSTCC) symbol to ncurses Makefile.in, to simplify setup for + cross compiling (suggested by Chris Johns). + + modify ifdef in lib_setup.c to only include <sys/ioctl.h> if we can + use it to support screen-size calculation (reported by Chris Johns). + + #undef unctrl to avoid symbol conflict in port to RTEMS (reported by + Chris Johns <cjohns@plessey.com.au>) + > patches by Juergen Pfeifer: + + simplified, made minor corrections to Ada95 binding to form fieldtype. + + The C++ binding has been enhanced: + + Improve NCursesWindow class: added additional methods to cover + more ncurses functionality. Make refresh() and noutrefresh() + virtual members to allow different implementation in the + NCursesPanel class. + + CAUTION: changed order of parameters in vline() and hline() of + NCursesWindow class. + + Make refresh() in NCursesPanel non-static, it is now a + reimplementation of refresh() in the base class. Added + noutrefresh() to NCursesPanel. + + Added NCursesForm and related classes to support libform + functionality. + + Moved most of configuration related stuff from cursesw.h to etip.h + + Added NCursesApplication class to support easy configuration of + menu and forms related attributes as well as ripped of title lines + and Soft-Label-Keys for an application. + + Support of Auto-Cleanup for a menu's fieldlist. + + Change of return type for current_item() and operator[] for menus. + + Enhanced demo. + + Fixed a bug in form/fld_def.c: take into account that copyarg and + freearg for a fieldtype may be NULL, makearg must not be NULL + + Fixed a bug in form/fld_type.c: in set_fieldtype_arg() makearg must + not be NULL, copyarg and freearg may be NULL. + + Fixed a bug in form/frm_def.c: Allow Disconnect_Fields() if it is + already disconnected. + + Enhance form/frm_driver.c: Allow growth of dynamic fields also on + navigation requests. + + Fixed a bug in form/fty_enum.c: wrong position of postincrement in + case-insensitiva comparision routine. + + Enhanced form/lib_adabind.c with function _nc_get_field() to get a + forms field by index. + + Enhanced menu/m_adabind.c with function _nc_get_item() to get a menus + item by index. + + Fixed in curses.h.in: make chtype argument for pechochar() constant. + Mark wbkgdset() as implemented, remove wbkgdset macro, because it was + broken (didn't handle colors correctly). + + Enhanced lib_mouse.c: added _nc_has_mouse() function + + Added _nc_has_mouse() prototype to curses.priv.h + + Modified lib_bkgd.c: hopefully correct implementation of wbkgdset(); + streamlined implementation of wbkgd() + + Modified lib_mvwin.c: Disable move of a pad. Implement (costly) + move of subwindows. Fixed update behaviour of movements of regular + windows. + + Fixed lib_pad.c: make chtype argument of pechochar() const. + + Fixed lib_window.c: dupwin() is not(!) in every bit a really clone + of the original. Subwindows become regular windows by doing a + dupwin(). + + Improved manpage form_fieldtype.3x + > patches by Alexander V. Lukyanov: + + simplify the PutChar() handling of exit_am_mode, because we already + know that auto_right_margin is true. + + add a check in PutChar() for ability to insert to the case of + shifting character to LR corner. + + in terminal initialization by _nc_screen_resume(), make sure that + terminal right margin mode is known. + + move logic that invokes touchline(), or does the equivalent, into + _nc_scroll_window(). + + modify scrolling logic use of insert/delete line capability, assuming + that they affect the screen contents only within the current + scrolling region. + + modify rain.c to demonstrate SIGWINCH handler. + + remove logic from getch() that would return an ERR if the application + called getch() when the cursor was at the lower-right corner of the + physical screen, and the terminal does not have insert-character + ability. + + change view.c so that it breaks out of getch() loop if a KEY_RESIZE + is read, and modify logic in getch() so this fix will yield the + desired behavior, i.e., the screen is repainted automatically when + the terminal window is resized. + +970906 + + add configure option --enable-sigwinch + + modify view.c to test KEY_RESIZE logic, with "-r" option. + + modify testcurs.c to eliminate misleading display wrt cursor type + by testing if the terminal supports cnorm, civis, cvvis. + + several fixes for m68k/NeXT 4.0, to bring cur_term, _nc_curr_line and + _nc_curr_col variables into linked programs: move these variables, + making new modules lib_cur_term and trace_buf (reported by Francisco + Alberto Tomei Torres <fatomei@sandburg.unm.edu>). + > patches by Alexander V. Lukyanov: + + add pseudo-functionkey KEY_RESIZE which is returned by getch() when + the SIGWINCH handler has been called since the last call to + doupdate(). + + modify lib_twait.c to hide EINTR only if HIDE_EINTR is defined. + + add SIGWINCH handler to ncurses library which is used if there is no + application SIGWINCH handler in effect when the screen is + initialized. + + make linked list of all SCREEN structures. + + move curses.h include before definition of SCREEN to use types in + that structure. + + correction to ensure that wgetstr uses only a newline to force a + scroll (970831). + +970831 + + add experimental configure option --enable-safe-sprintf; the normal + mode now allocates a buffer as large as the screen for the + lib_printw.c functions. + + modify wgetch to refresh screen when reading ungetch'd characters, + since the application may require this - SVr4 does this. + + refine treatment of newline in wgetstr to echo only when this would + force the screen to scroll. + +970830 + + remove override in wgetstr() that forces keypad(), since SVr4 does + not do this. + + correct y-reference for erasure in wgetstr() when a wrap forces a + scroll. + + correct x-position in waddch() after a wrap forces a scroll. + + echo newline in wgetstr(), making testscanw.c scroll properly when + scanw is done. + + modify vwscanw() to avoid potential buffer overflow. + + rewrote lib_printw.c to eliminate fixed-buffer limits. + > patches by Alexander V. Lukyanov: + + correct an error in handling cooked mode in wgetch(); processing + was in the wrong order. + + simplified logic in wgetch() that handles backspace, etc., by using + wechochar(). + + correct wechochar() so that it interprets the output character as + in waddch(). + + modify pechochar() to use prefresh() rather than doupdate(), since + the latter does not guarantee immediate refresh of the pad. + + modify pechochar() so that if called with a non-pad WINDOW, will + invoke wechochar() instead. + + modify fifo indices to allow fifo to be longer than 127 bytes. + +970823 + + add xterm-8bit to terminfo.src + + moved logic for SP->_fifohold inside check_pending() to make it + work properly when we add calls to that function. + + ensure that bool functions return only TRUE or FALSE, and TRUE/FALSE + are assigned to bool values (patch by H.J.Lu). + > patches by Alexander V. Lukyanov: + + several fixes to getch: + 1. Separate cooked and raw keys in fifo + 2. Fix the case of ungetch'ed KEY_MOUSE + 3. wrap the code for hiding EINTR with ifdef HIDE_EINTR + 4. correctly handle input errors (i.e., EINTR) without loss of raw + keys + 5. recognize ESC KEY_LEFT and similar + 6. correctly handle the case of receiption of KEY_MOUSE from gpm + + correct off-by-one indexing error in _nc_mouse_parse(), that caused + single mouse events (press/release) to be ignored in favor of + composed events (click). Improves on a fix from integrating gpm + support in 961229. + + add another call to check_pending, before scrolling, for + line-breakout optimization + + improve hashmap.c by + 1. fixed loop condition in grow_hunks() + 2. not marking lines with offset 0 + 3. fixed condition of 'too far' criteria, thus one-line hunks are + ignored and two lines interchanged won't pass. + + rewrote/simplified _nc_scroll_optimize() by separating into two + passes, forward/backward, looking for chunks moving only in the given + direction. + + move logic that emits sgr0 when initializing the screen to + _nc_screen_init(), now invoked from newterm. + + move cursor-movement cleanup from endwin() into _nc_mvcur_wrap() + function and screen cleanup (i.e., color) into _nc_screen_wrap() + function. + + add new functions _nc_screen_init(), _nc_screen_resume() and + _nc_screen_wrap(). + + rename _nc_mvcur_scrolln() to _nc_scrolln(). + + add a copy of acs_map[] to the SCREEN structure, where it can be + stored/retrieved via set_term(). + + move variables _nc_idcok, _nc_idlok, _nc_windows into the SCREEN + structure. + +970816 + + implement experimental _nc_perform_scroll(). + + modify newterm (actually _nc_setupscreen()) to emit an sgr0 when + initializing the screen, as does SVr4 (reported by Alexander V. + Lukyanov). + + added test_progs rule to ncurses/Makefile. + + modify test/configure.in to check if initscr is already in $LIBS + before looking for (n)curses library. + + correct version-number in configure script for OSF1 shared-library + options (patch by Tim Mooney). + + add -DNDEBUG to CPPFLAGS for --enable-assertions (as Juergen + originally patched) since the c++ demo files do not necessarily + include ncurses_cfg.h + + supply default value for --enable-assertions option in configure + script (reported by Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>). + > patches by Alexander V. Lukyanov: + + correct/simplify logic of werase(), wclrtoeol() and wclrbot(). See + example firstlast.c + + optimize waddch_literal() and waddch_nosync() by factoring out + common subexpressions. + + correct sense of NDEBUG ifdef for CHECK_POSITION macro. + + corrections to render_char(), to make handling of colored blanks + match SVr4 curses, as well as to correct a bug that xor'd space + against the background character. + + replaced hash function with a faster one (timed it) + + rewrote the hashmap algorithm to be one-pass, this avoids multiple + cost_effective() calls on the same lines. + + modified cost_effective() so it is now slightly more precise. + > patches by H.J.Lu for glibc integration: + + add modules define_key, keyok, name_match, tries + + add makefile rules for some of the unit tests in ncurses (mvcur, + captoinfo, hardscroll, hashmap). + + update Linux configure-script for wide-character definitions. + +970809 + + modify _tracebits() to show the character size (e.g., CS8). + + modify tparm() to emit '\200' where the generated string would have a + null (reported by From: Ian Dall <Ian.Dall@dsto.defence.gov.au> for + terminal type ncr7900). + + modify install process so that ldconfig is not invoked if the + package is built with an install-prefix. + + correct test program for chtype size (reported by Tim Mooney). + + add configure option --disable-scroll-hints, using this to ifdef the + logic that computes indices for _nc_scroll_optimize(). + + add module ncurses/softscroll.c, to perform single-stage computation + of scroll indices used in _nc_scroll_optimize(). This is faster than + the existing scrolling algorithm, but tends to make too-small hunks. + + eliminate fixed buffer size in _nc_linedump(). + + minor fixes to lib_doupdate.c to add tradeoff between clr_eol (el) + and clr_bol (el1), refine logic in ClrUpdate() and ClrBottom() (patch + by Alexander V. Lukyanov). + + add test/testaddch.c, from a pending patch by Alexander V. Lukyanov. + + correct processing of "configure --enable-assertions" option (patch + by Juergen Pfeifer). + +970802 + + add '-s' (single-step) option too test/hashtest.c, correct an error + in loop limit for '-f' (footer option), toggle scrollok() when + writing footer to avoid wrap at lower-right corner. + + correct behavior of clrtoeol() immediately after wrapping cursor, + which was not clearing the line at the cursor position (reported by + Liviu Daia <daia@stoilow.imar.ro>). + + corrected mapping for ACS_LANTERN, which was 'I' rather than 'i' + (reported by Klaus Weide <kweide@tezcat.com>). + + many corrections to make progs/capconvert work, as well as make it + reasonably portable and integrated with ncurses 4.1 (reported by Dave + Furstenau <df@ravine.binary.net>). + +970726 + + add flag SP->_fifohold, corresponding logic to modify the behavior of + the line breakout logic so that if the application does not read + input, refreshes will not be stopped, but only slowed. + + generate slk_attr_off(), slk_attr_on(), slk_attr_set(), vid_attr(), + ifdef'd for wide-character support, since ncurses' WA_xxx attribute + masks are identical with the A_xxx masks. + + modify MKlib_gen.sh to generate ifdef'd functions to support optional + configuration of wide-characters. + + modify tset to behave more like SVr4's tset, which does not modify + the settings of intr, quit or erase unless they are given as command + options (reported by Nelson H. F. Beebe <beebe@math.utah.edu>). + + modify tset to look in /etc/ttys or /etc/ttytype if the configuration + does not have getttynam(). + + extend baudrate table in tset.c to match baudrate() function. + + add table entries for 230400 and 460800 bd to baudrate() function. + + improve breakout logic by allowing it before the first line updated, + which is what SVr4 curses does (patch by Alexander V. Lukyanov). + + correct initialization of vcost in relative_move(), for cursor-down + case (patch by Alexander V. Lukyanov). + > nits gleaned from Debian distribution of 1.9.9g-3: + + install symbolic link for intotocap. + + reference libc directly when making shared libraries. + + correct renaming of curs_scr_dmp.3x in man_db.renames. + + guard tgetflag() and other termcap functions against null cur_term + pointer. + +970719 + + corrected initial state of software echo (error in 970405, reported + by Alexander V. Lukyanov). + + reviewed/added messages to configure script, so that all non-test + options should be accompanied by a message. + + add configure check for long filenames, using this to determine if + it is safe to allow long aliases for terminal descriptions as does + SVr4. + + add configure options for widec (wide character), hashmap (both + experimental). + > patch by Alexander V. Lukyanov: + + hashmap.c - improved by heuristic, so that scroll test works much + better when csr is not available. + + hardscroll.c - patched so that it continues to scroll other chunks + after failure to scroll one. + + lib_doupdate.c - _nc_mvcur_scrolln extended to handle more cases; csr + is avoided as it is relative costly. Fixed wrong coordinates in one + case and wrong string in TRACE. + > patch by Juergen Pfeifer: + + modify C++ binding to compile on AIX 4.x with the IBM C-SET++ + compiler. + +970712 + + remove alternate character set from kterm terminfo entry; it uses the + shift-out control for a purpose incompatible with curses, i.e., font + switching. + + disentangle 'xterm' terminfo entry from some derived entries that + should be based on xterm-r6 instead. + + add cbt to xterm-xf86-xv32 terminfo entry; I added the emulation for + XFree86 3.1.2F, but overlooked its use in terminfo then - T.Dickey. + + correct logic in lib_mvcur.c that uses back_tab. + +970706 + + correct change from 970628 to ClrUpdate() in lib_doupdate.c so that + contents of curscr are saved in newscr before clearing the screen. + This is needed to make repainting work with the present logic of + TransformLine(). + + use napms() rather than sleep() in tset.c to avoid interrupting I/O. + +970705 + + add limit checks to _nc_read_file_entry() to guard against overflow + of buffer when reading incompatible terminfo format, e.g, from OSF/1. + + correct some loop-variable errors in xmc support in lib_doupdate.c + + modify ncurses 'b' test to add gaps, specified by user, to allow + investigation of interaction with xmc (magic cookie) code. + + correct typo in 970524 mods to xmas.c, had omitted empty parameter + list from has_colors(), which gcc ignores, but SVr4 does not + (reported by Larry Virden). + + correct rmso capability in wy50-mc description. + + add configure option "--enable-hard-tabs", renamed TABS_OK ifdef to + USE_HARD_TABS. + > patch by Juergen Pfeifer: + + Add bindings for keyok() and define_key() to the Ada95 packages. + + Improve man pages menu_post.3x and menu_format.3x + + Fix the HTML pages in the Ada95/html directory to reflect the above + changes. + +970628 + + modify change from 970101 to ClrUpdate() in lib_doupdate.c so that + pending changes to both curscr and newscr are flushed properly. + This fixes a case where the first scrolling operation in nvi would + cause the screen to be cleared unnecessarily and repainted before + doing the indexing, i.e., by repeatedly pressing 'j' (reported by + Juergen Pfeifer). + + correct error in trans_string() which added embedded newlines in a + terminfo description to the stored strings. + + remove spurious newlines from sgr in wyse50 (and several other) + terminfo descriptions. + + add configure option for experimental xmc (magic cookie) code, + "--enable-xmc-glitch". When disabled (the default), attributes that + would store a magic cookie are suppressed in vidputs(). The magic + cookie code is far from workable at this stage; the configuration + option is a stopgap. + + move _nc_initscr() from lib_initscr.c to lib_newterm.c + + correct path for invoking make_keys (a missing "./"). + +970621 + + correct sign-extension problem with "infocmp -e", which corrupted + acsc values computed for linux fallback data. + + correct dependency on ncurses/names.c (a missing "./"). + + modify configure script to use '&&' even for cd'ing to existing + directories to work around broken shell interpreters. + + correct a loop-limit in _nc_hash_map() (patch by Alexander V. + Lukyanov). + +970615 + + restore logic in _nc_scroll_optimize() which marks as touched the + lines in curscr that are shifted. + + add new utility 'make_keys' to compute keys.tries as a table rather + than a series of function calls. + + correct include-dependency for tic.h used by name_match + + removed buffer-allocation for name and description from m_item_new.c, + since this might result in incompatibilities with SVr4. Also fixed + the corresponding Ada95 binding module (patch by Juergen Pfeifer, + from report by Avery Pennarun <apenwarr@foxnet.net>) + + removed the mechanism to timestamp the generated Ada95 sources. This + resulted always in generating patches for the HTML doc, even when + nothing really changed (patch by Juergen Pfeifer). + + improve man page mitem_new.3x (patch by Juergen Pfeifer). + +970614 + + remove ech capability from rxvt description because it does not work. + + add missing case logic for infocmp -I option (reported by Lorenzo M. + Catucci <lorenzo@argon.roma2.infn.it>) + + correct old bug in pnoutrefresh() unmasked by fix in 970531; this + caused glitches in the ncurses 'p' test since the area outside the + pad was not compared when setting up indices for _nc_scroll_optimize. + + rewrote tracebits() to workaround misdefinition of TOSTOP on Ultrix + 4.4, as well as to eliminate fixed-size buffer (reported by Chris + Tanner <tannerc@aecl.ca>) + + correct prototype for termattrs() as per XPG4 version 2. + + add placeholder prototypes for color_set(), erasewchar(), + term_attrs(), wcolor_set() as per XPG4 version 2. + + correct attribution for progs/progs.priv.h and lib_twait.c + + improve line-breakout logic by checking based on changed lines rather + than total lines (patch by Alexander V. Lukyanov). + + correct loop limits for table-lookup of enumerated value in form + (patch by Juergen Pfeifer). + + improve threshhold computation for determining when to call ClrToEOL + (patch by Alexander V. Lukyanov). + +970531 + + add configure option --disable-database to force the library to + use only the fallback data. + + add configure option --with-fallbacks, to specify list of fallback + terminal descriptions. + + add a symbolic link for ncurses.h during install; too many programs + still assume there's an ncurses.h + + add new terminfo.src entry for xterm-xf86-v33. + + restore terminfo.src entry for emu to using setf/setb, since it is + not, after all, generating ANSI sequences. Corrected missing comma + that caused setf/setb entries to merge. + + modify mousemask() to use keyok() to enable/disable KEY_MOUSE, so + that applications can disable ncurses' mouse and supply their own + handler. + + add extensions keyok() and define_key(). These are designed to allow + the user's application better control over the use of function keys, + e.g., disabling the ncurses KEY_MOUSE. (The define_key idea was from + a mailing-list thread started by kjahds@kjahds.com Nov'1995). + + restore original behavior in ncurses 'g' test, i.e., explicitly + set the keypad mode rather than use the default, since it confuses + people. + + rewrote the newdemo banner so it's readable (reported by Hugh Daniel). + + tidy up exit from hashtest (reported by Hugh Daniel). + + restore check for ^Q in ncurses 'g' test broken in 970510 (reported + by Hugh Daniel) + + correct tput program, checking return-value of setupterm (patch by + Florian La Roche). + + correct logic in pnoutrefresh() and pechochar() functions (reported + by Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>). The computation + of 'wide' date to eric's #283 (1.9.9), and the pechochar bug to the + original implementation (1.9.6). + + correct typo in vt102-w terminfo.src entry (patch by Robert Wuest + <rwuest@sire.vt.com>) + + move calls of _nc_background() out of various loops, as its return + value will be the same for the whole window being operated on (patch + by J.T.Conklin). + + add macros getcur[xy] getbeg[xy] getpar[xy], which are defined in + SVr4 headers (patch by J.T.Conklin <jtc@NetBSD.ORG>) + + modify glibc addon-configure scripts (patch by H.J.Lu). + + correct a bug in hashmap.c: the size used for clearing the hashmap + table was incorrect, causing stack corruption for large values of + LINES, e.g., >MAXLINES/2 (patch by Alexander V. Lukyanov). + + eric's terminfo 9.13.23 & 9.13.24 changes: replaced minitel-2 entry, + added MGR, ansi-nt (note: the changes described for 9.13.24 have not + been applied). + > several changes by Juergen Pfeifer: + + correct a missing error-return in form_driver.c when wrapping of a + field is not possible. + + correct logic in form_driver.c for configurations that do not have + memccpy() (reported by Sidik Isani <isani@cfht.hawaii.edu>) + + change several c++ binding functions to inline. + + modify c++ menu binding to inherit from panels, for proper + initialization. + + correct freeing of menu items in c++ binding. + + modify c++ binding to reflect removal of const from user data pointer + in forms/menus libraries. + +970524 + + add description of xterm-16color. + + modify name of shared-library on *BSD to end with $(REL_VERSION) + rather than $(ABI_VERSION) to match actual convention on FreeBSD + (cf: 960713). + + add OpenBSD to shared-library case, same as NetBSD and FreeBSD + (reported by Hugh Daniel <hugh@rat.toad.com>). + + corrected include-dependency in menu/Makefile so that "make install" + works properly w/o first doing "make". + + add fallback definition for isascii, used in infocmp. + + modify xmas to use color, and to exit right away when a key is + pressed. + + modify gdc so that the scrolled digits function as described (there + was no time delay between the stages, and the digits overwrote the + bounding box without tidying up). + + modify lib_color.c to use setaf/setab only for the ANSI color codes + 0 through 7. Using 16 colors requires setf/setb. + + modify ncurses 'c' test to work with 16 colors, as well as the normal + 8 colors. + + remove const qualifier from user data pointer in forms and menus + libraries (patch by Juergen Pfeifer). + + rewrote 'waddchnstr()' to avoid using the _nc_waddch_nosync() + function, thereby not interpreting tabs, etc., as per spec (patch by + Alexander V. Lukyanov). + +970517 + + suppress check for pre-existing ncurses header if the --prefix + option is specified. + + add configure options "--with-system-type" and "--with-system-release" + to assist in checking the generated makefiles. + + add configure option "--enable-rpath" to allow installers to specify + that programs linked against shared libraries will have their library + path embedded, allowing installs into nonstandard locations. + + add flags to OSF1 shared-library options to specify version and + symbol file (patch by Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>) + + add missing definition for ABI_VERSION to c++/Makefile.in (reported + by Satoshi Adachi <adachi@wisdom.aa.ap.titech.ac.jp>). + + modify link flags to accommodate HP-UX linker which embeds absolute + pathnames in executables linked against shared libraries (reported by + Jason Evans <jasone@mrc.uidaho.edu>, solved by Alan Shutko + <ats@hubert.wustl.edu>). + + drop unnecessary check for attribute-change in onscreen_mvcur() since + mvcur() is the only caller within the library, and that check in turn + is exercised only from lib_doupdate.c (patch by Alexander V. + Lukyanov). + + add 'blank' parameter to _nc_scroll_window() so _nc_mvcur_scrolln() + can use the background of stdscr as a parameter to that function + (patch by Alexander V. Lukyanov). + + moved _nc_mvcur_scrolln() from lib_mvcur.c to lib_doupdate.c, to use + the latter's internal functions, as well as to eliminate unnecessary + cursor save/restore operations (patch by Alexander V. Lukyanov). + + omit parameter of ClrUpdate(), since it is called only for newscr, + further optimized/reduced by using ClearScreen() and TransformLine() + to get rid of duplicate code (patch by Alexander V. Lukyanov). + + modify scrolling algorithm in _nc_scroll_optimize() to reject hunks + that are smaller than the distance to be moved (patch by Alexander V. + Lukyanov). + + correct a place where the panel library was not ifdef'd in ncurses.c + (Juergen Pfeifer) + + documentation fixes (Juergen Pfeifer) + +970515 4.1 release for upload to prep.ai.mit.edu + + re-tag changes since 970505 as 4.1 release. + +970510 + + modify ncurses 'g' test to allow mouse input + + modify default xterm description to include mouse. + + modify configure script to add -Wwrite-strings if gcc warnings are + enabled while configuring --enable-const (and fixed related warnings). + + add toggle, status display for keypad mode to ncurses 'g' test to + verify that keypad and scrollok are not inherited from parent window + during a call to newwin. + + correction to MKexpanded.sh to make it work when configure --srcdir is + used (reported by H.J.Lu). + + revise test for bool-type, ensuring that it checks if builtin.h is + available before including it, adding test for sizeof(bool) equal + to sizeof(short), and warning user if the size cannot be determined + (reported by Alexander V. Lukyanov). + + add files to support configuration of ncurses as an add-on library + for GNU libc (patch by H.J.Lu <hjl@lucon.org>) + +970506 + + correct buffer overrun in lib_traceatr.c + + modify change to lib_vidattr.c to avoid redundant orig_pair. + + turn on 'echo()' in hanoi.c, since it is initially off. + + rename local 'errno' variable in etip.h to avoid conflict with global + (H.J.Lu). + + modify configure script to cache LD, AR, AR_OPTS (patch by H.J.Lu + <hjl@lucon.org>) + +970505 4.1 pre-release + + regenerate the misc directory html dumps without the link list, which + is not useful. + + correct dependency in form directory makefile which caused unnecessary + recompiles. + + correct substitution for ABI_VERSION in test-makefile + + modify install rules for shared-library targets to remove the target + before installing, since some install programs do not properly handle + overwrite of symbolic links. + + change order of top-level targets so that 'include' immediate + precedes the 'ncurses' directory, reducing the time between new + headers and new libraries (requested by Larry Virden). + + modify lib_vidattr.c so that colors are turned off only before + modifying other attributes, turned on after others. This makes the + hanoi.c program display correctly on FreeBSD console. + + modify debug code in panel library to print user-data addresses + rather than the strings which they (may) point to. + + add check to ensure that C++ binding and demo are not built with g++ + versions below 2.7, since the binding uses templates. + + modify c++ binding and demo to build and run with SGI's c++ compiler. + (It also compiles with the Sun SparcWorks compiler, but the demo does + not link, due to a vtbl problem). + + corrections to demo.cc, to fix out-of-scope variables (Juergen + Pfeifer). + +970503 + + correct memory leak in _nc_trace_buf(). + + add configure test for regexpr.h, for Unixware 1.x. + + correct missing "./" prefixing names of generated files in ncurses + directory. + + use single-quotes in configure scripts assignments for MK_SHARED_LIB + to workaround shell bug on FreeBSD 2.1.5 + + remove tabs from intermediate #define's for GCC_PRINTF, GCC_SCANF + that caused incorrect result in ncurses_cfg.h + + correct initialization in lib_trace.c, which omitted version info. + + remove ech, el1 attributes from cons25w description; they appear to + malfunction in FreeBSD 2.1.5 + + correct color attributes in terminfo.src and lib_color.c to match + SVr4 behavior by interchanging codes 1,4, 3,6 in the setf/setb + capabilities. + + use curs_set() rather than checks via tigetstr() for test programs + that hide the cursor: firework, rain, worm. + + ensure that if the terminal lacks change_scroll_region, parm_index + and parm_rindex are used only to scroll the whole screen (patch by + Peter Wemm). + + correct curs_set() logic, which did not return ERR if the requested + attributes did not exist, nor did it assume an unknown initial state + for the cursor (patch by Alexander V. Lukyanov). + + combine IDcTransformLine and NoIDcTransformLine to new TransformLine + function in lib_doupdate.c (patch by Alexander V. Lukyanov). + + correct hashmap.c, which did not update index information (patch by + Alexander V. Lukyanov). + + patch by Juergen Pfeifer for C++ binding and demo (see c++/NEWS) + + correct index in lib_instr.c (Juergen Pfeifer). + + correct typo in 970426 patch from Tom's cleanup of lib_overlay.c + (Juergen Pfeifer). + +970426 + + corrected cost computation in PutRange(), which was using + milliseconds compared to characters by adding two new members to the + SCREEN struct, _hpa_ch_cost and _cup_ch_cost. + + drop ncurses/lib_unctrl.c, add ncurses/MKunctrl.awk to generate a + const array of strings (suggested by Alexander V. Lukyanov, though + with a perl script 970118). + + rewrote ncurses 'b' test to better exercise magic-cookie (xmc), as + well as noting the attributes that are not supported by a terminal. + + trace the computation of cost values in lib_mvcur.c + + modify _nc_visbuf() to use octal rather than hex, corrected sign + extension bug in that function that caused buffer overflow. + + modify trace in lib_acs.c to use _nc_visbuf(). + + suppress trace within _traceattr2(). + + correct logic of _tracechtype2(), which did not account for repeats + or redefinition within an acsc string. + + modify debug-library version baudrate() to use environment variable + $BAUDRATE to override speed computation. This is needed for + regression testing. + + correct problems shown by "weblint -pedantic". + + update mailing-list information (now ncurses@bsdi.com). + +970419 + + Improve form_field_validation.3x manpage to better describe the + precision parameter for TYPE_NUMERIC and TYPE_INTEGER. Provide more + precise information how the range checking can be avoided. (patch by + Juergen Pfeifer, reported by Bryan Henderson) + + change type of min/max value of form types TYPE_INTEGER to long to + match SVr4 documentation. + + set the form window to stdscr in set_form_win() so that form_win() + won't return null (patch by Juergen Pfeifer, reported by Bryan + Henderson <bryanh@giraffe.netgate.net>). + +970412 + + corrected ifdef'ing of inline (from 970321) for TRACE vs C++. + + corrected toggle_attr_off() macro (patch by Andries.Brouwer). + + modify treatment of empty token in $MANPATH to /usr/man (reported by + <Andries.Brouwer@cwi.nl>) + + modify traces that record functions-called so that chtype and attr_t + values are expressed symbolically, to simplify reuse of generated + test-scripts on SVr4 regression testing. + + add new trace functions _traceattr2() and _tracechtype2() + +970405 + + add configure option --enable-const, to support the use of 'const' + where XSI should have, but did not, specify. This defines + NCURSES_CONST, which is an empty token otherwise, for strict + compatibility. + + make processing of configure options more verbose by echoing the + --enable/--with values. + + add configure option --enable-big-core + + set initial state of software echo off as per XSI. + + check for C++ builtin.h header + + correct computation of absolute-path for $INSTALL that dropped "-c" + parameter from the expression. + + rename config.h to ncurses_cfg.h to avoid naming-conflict when ncurses + is integrated into larger systems (from diffs by H.J.Lu for libc). + + correct inequality in lib_doupdate.c that caused a single-char to not + be updated when the char on the right-margin was not blank, idcok() + was true (patch by Alexander V. Lukyanov 970124, also reported by + Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu> 970329). + + modify 'clean' rule in include/Makefile so that files created by + configure script are removed in 'distclean' rule instead. + +970328 + + correct array limit in tparam_internal(), add case to interpret "%x" + (patch by Andreas Schwab) + + rewrote number-parsing in ncurses.c 'd' test; it did not reset the + value properly when non-numeric characters were given (reported by + Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>) + +970321 + + move definition of __INTERNAL_CAPS_VISIBLE before include for + progs.priv.h (patch by David MacKenzie). + + add configuration summary, reordered check for default include + directory to better accommodate a case where installer is configuring + a second copy of ncurses (reported by Klaus Weide + <kweide@tezcat.com>) + + moved the #define for 'inline' as an empty token from the + $(CFLAGS_DEBUG) symbol into config.h, to avoid redefinition warning + (reported by Ward Horner). + + modify test for bool builtin type to use 'unsigned' rather than + 'unknown' when cross-compiling (reported by Ward Horner). + +970315 + + add header dependencies so that "make install.libs" will succeed + even if "make all" is not done first. + + moved some macros from lib_doupdate.c to curses.priv.h to use in + expanded functions with ATAC. + + correct implementation of lib_instr.c; both XSI and SVr4 agree that + the winnstr functions can return more characters than will fit on one + line. + +970308 + + modify script that generates lib_gen.c to support traces of called & + return. + + add new configure option "--disable-macros", for testing calls within + lib_gen.c + + corrected logic that screens level-checking of called/return traces. + +970301 + + use new configure macro NC_SUBST to replace AC_PATH_PROG, better + addressing request by Ward Horner. + + check for cross-compiling before trying to invoke the autoconf + AC_FUNC_SETVBUF_REVERSED macro (reported by Ward Horner) + + correct/simplify loop in _nc_visbuf(), 970201 changes omitted + a pointer-increment. + + eliminate obsolete symbol SHARED_ABI from dist.mk (noted by + Florian La Roche). + +970215 + + add configure option --enable-expanded, together with code that + implements an expanded form of certain complex macros, for testing + with ATAC. + + disable CHECK_POSITION unless --with-assertions is configured + (Alexander Lukyanov pointed out that this is redundant). + + use keyname() to show traced chtype values where applicable rather + than _tracechar(), which truncates the value to 8-bits. + + minor fixes to TRACE_ICALLS, added T_CREATE, TRACE_CCALLS macros. + + modify makefiles in progs and test directories to avoid using C + preprocessor options on link commands (reported by Ward Horner) + + correct ifdef/include-order for nc_alloc.h vs lib_freeall.c (reported + by Ward Horner) + + modify ifdef's to use configure-defined symbols consistently + (reported by Ward Horner) + + add/use new makefile symbols AR, AR_OPTS and LD to assist in non-UNIX + ports (reported by Ward Horner <whorner@tsi-telsys.com>) + + rename struct try to struct tries, to avoid name conflict with C++ + (reported by Gary Johnson). + + modify worm.c to hide cursor while running. + + add -Wcast-qual to gcc warnings, fix accordingly. + + use PutChar rather than PutAttrChar in ClrToEOL to properly handle + wrapping (Alexander Lukyanov). + + correct spurious echoing of input in hanoi.c from eric's #291 & #292 + patches (reported by Vernon C. Hoxie <vern@zebra.alphacdc.com>). + + extend IRIX configuration to IRIX64 + + supply missing install.libs rule needed after restructuring + test/Makefile.in + +970208 + + modify "make mostlyclean" to leave automatically-generated source + in the ncurses directory, for use in cross-compiles. + + autogenerated object-dependencies for test directory + + add configure option --with-rcs-ids + + modify configuration scripts to generate major/minor/patch versions + (suggested by Alexander Lukyanov). + + supply missing va_end's in lib_scanw.c + + use stream I/O for trace-output, to eliminate fixed-size buffer + + add TRACE_ICALLS definition/support to lib_trace.c + + modify Ada95 binding to work with GNAT 3.09 (Juergen Pfeifer). + +970201 + + add/modify traces for called/return values to simplify extraction + for test scripts. + + changed _nc_visbuf to quote its result, and to dynamically allocate + the returned buffer. + + invoke ldconfig after installing shared library + + modify install so that overwrite applies to shared library -lcurses + in preference to static library (reported by Zeyd 960928). + + correct missing ';' in 961221 mod to overwrite option use of $(LN_S). + + fixes to allow "make install" to work without first doing a "make + all" (suggested by Larry Virden). + +970125 + + correct order of #ifdef for TABS_OK. + + instrumented toe.c to test memory-leaks. + + correct memory-deallocation in toe.c (patch by Jesse Thilo). + + include <sys/types.h> in configuration test for regex.h (patch by + Andreas Schwab) + + make infocmp recognize -I option, for SVr4 compatibility (reported by + Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>) + +970118 + + add extension 'use_default_colors()', modified test applications that + use default background (firework, gdc, hanoi, knight, worm) to + demonstrate. + + correct some limit checks in lib_doupdate.c exposed while running + worm. + + use typeCalloc macro for readability. + + add/use definition for CONST to accommodate testing with Solaris + (SVr4) curses, which doesn't use 'const' in its prototypes. + + modify ifdef's in test/hashtest.c and test/view.c to compile with + Solaris curses. + + modify _tracedump() to pad pad colors & attrs lines to match change + in 970101 showing first/last changes. + + corrected location of terminating null on dynamically allocated forms + fields (patch by Per Foreby). + +970111 + + added headers to make view.c compile on SCO with the resizeterm() + code (i.e., struct winsize) - though this compiles, I don't have a + suitable test configuration since SIGWINCH doesn't pass my network to + that machine - T.Dickey. + + update test/configure.in to supply some default substitutions. + + modify configure script to add -lncurses after -lgpm to fix problem + linking against static libraries. + + add a missing noraw() to test/ncurses.c (places noted by Jeremy + Buhler) + + add a missing wclear() to test/testcurs.c (patch by Jeremy Buhler + <jbuhler@cs.washington.edu>) + + modify headers to accommodate compilers that don't allow duplicate + "#define" lines for NCURSES_VERSION (reported by Larry W. Virden + <lvirden@cas.org>) + + fix formatting glitch in curs_getch.3x (patch by Jesse Thilo). + + modify lib_doupdate to make el, el1 and ed optimization use the + can_clear_with macro, and change EmitRange to allow leaving cursor at + the middle of interval, rather than always at the end (patch by + Alexander Lukyanov originally 960929, resync 970106). + +970104 + + workaround defect in autoconf 2.12 (which terminates configuration + if no C++ compiler is found) by adding an option --without-cxx. + + modify several man-pages to use tbl, where .nf/.fi was used (reported + by Jesse Thilo). + + correct font-codes in some man-pages (patch by Jesse Thilo + <Jesse.Thilo@pobox.com>) + + use configure script's knowledge of existence of g++ library for the + c++ Makefile (reported by Paul Jackson). + + correct misleading description of --datadir configuration option + (reported by Paul Jackson <pj@sam.engr.sgi.com>) + +970101 + + several corrections to _nc_mvcur_scrolln(), prompted by a bug report + from Peter Wemm: + > the logic for non_dest_scroll_region was interchanged between the + forward & reverse scrolling cases. + > multiple returns from the function allowed certain conditions to do + part of an operation before discovering that it couldn't be + completed, returning an error without restoring the cursor. + > some returns were ERR, where the function had completed the + operation, because the insert/delete line logic was improperly + tested (this was probably the case Peter saw). + > contrary to comments, some scrolling cases were tested after the + insert/delete line method. + + modify _tracedump() to show first/last changes. + + modify param of ClrUpdate() in lib_doupdate.c to 'newscr', fixes + refresh problem (reported by Peter Wemm) that caused nvi to not show + result of ":r !ls" until a ^L was typed. + +961229 (internal alpha) + + correct some of the writable-strings warnings (reported by Gary + Johnson <gjohnson@season.com>). Note that most of the remaining ones + are part of the XSI specification, and can't be "fixed". + + improve include-dependencies in form, menu, panel directories. + + correct logic of delay_output(), which would return early if + there is data on stdin. + + modify interface & logic of _nc_timed_wait() to support 2 file + descriptors, needed for GPM. + + integrate patch by Andrew Kuchling <amk@magnet.com> for GPM (mouse) + support, correcting logic in wgetch() and _nc_mouse_parse() which + prevented patch from working properly. + + improve performance of panel algorithm (Juergen Pfeifer 961203). + + strip RCS id's from generated .html files in Ada95 subtree. + + resync with generated .html files (Juergen Pfeifer 961223). + + terminfo.src 10.1.0 from Eric. + +961224 4.0 release + + release as 4.0 to accommodate Linux ld.so.1.8.5 + + correct syntax/spelling, regenerated .doc files from .html using + lynx 2.5 + + refined forms/menus makefiles (Juergen Pfeifer 961223). + +961221 - snapshot + + remove logic in read_entry.c that attempts to refine errno by using + 'access()' for the directory (from patch by Florian La Roche). + + correct configure test/substitution that inhibits generating + include-path to /usr/include if gcc is used (reported by Florian La + Roche). + + modify setupterm() to allocate new TERMINAL for each call, just as + solaris' curses does (Alexander Lukyanov 960829). + + corrected memory leaks in read_entry.c + + add configure options --with-dbmalloc, --with-dmalloc, and + --disable-leaks, tested by instrumenting infocmp, ncurses programs. + + move #include's for stdlib.h and string.h to *.priv.h to accommodate + use of dbmalloc. + + modify use of $(LN_S) to follow recommendation in autoconf 2.12, + i.e., set current directory before linking. + + split-out panel.priv.h, improve dependencies for forms, menus + (Juergen Pfeifer 961204). + + modify _nc_freewin() to reset globals curscr/newscr/stdscr when + freeing the corresponding WINDOW (Purify). + + modify delwin() to return ERR if the window to be deleted has + subwindows, needed as a side-effect of resizeterm() (Purify). Tested + and found that SVr4 curses behaves this way. + + implement logic for _nc_freeall(), bringing stub up to date. + +961215 + + modify wbkgd() so that it doesn't set nulls in the rendered text, + even if its argument doesn't specify a character (fixes test case by + Juergen Pfeifer for bug-report). + + set window-attributes in wbkgd(), to simplify comparison against + Solaris curses, which does this. + +961214 - snapshot + + replace most constants in ncurses 'o' test by expressions, making it + work with wider range of screen sizes. + + add options to ncurses.c to specify 'e' test softkey format, and the + number of header/footer lines to rip-off. + + add ^R (repaint after resize), ^L (refresh) commands to ncurses 'p' + test. + + add shell-out (!) command to ncurses 'p' test to allow test of + resize between endwin/refresh. + + correct line-wrap case in mvcur() by emitting carriage return, + overlooked in 960928, but needed due to SVr4 compatibility changes to + terminal modes in 960907. + + correct logic in wresize that causes new lines to be allocated, + broken for the special case of increasing rows only in 960907's fix + for subwindows. + + modify configure script to generate $(LDFLAGS) with -L and -l options + in preference to explicit library filenames. (NOTE: this may + require further amending, since I vaguely recall a dynamic loader + that did not work properly without the full names, but it should be + handled as an exception to the rule, since some linkers do bulk + inclusion of libraries when given the full name - T.Dickey). + + modify configure script to allow user-supplied $CFLAGS to set the + debug-option in all libraries (requested by lots of people). + + use return consistently from main(), rather than exit (reported by + Florian La Roche). + + add --enable-getcap-cache option to configure, normally disabled + (requested by Florian La Roche). + + make configure test for gettimeofday() and possibly -lbsd more + efficient (requested by Florian La Roche florian@knorke.saar.de) + + minor adjustments to Ada95 binding (patches by Juergen Pfeifer) + + correct attributes after emitting orig_pair in lib_vidattr.c (patch + by lav@yars.free.net). + +961208 + + corrected README wrt Ada95 (Juergen Pfeifer) + +961207 - snapshot + + integrate resizeterm() into doupdate(), so that if screen size + changes between endwin/refresh, ncurses will resize windows to fit + (this needs additional testing with pads and softkeys). + + add, for memory-leak testing, _nc_freeall() entrypoint to free all + data used in ncurses library. + + initialize _nc_idcok, _nc_idlok statically to resolve discrepancy + between initscr() and newwin() initialization (reported by + lav@yars.free.net). + + test built VERSION=4.0, SHARED_ABI=4 with Linux ld.so.1.8.5 + (set beta versions to those values -- NOTE that subsequent pre-4.0 + beta may not be interchangeable). + + modify configure script to work with autoconf 2.12 + +961130 1.9.9g release + + add copyright notices to configuration scripts (written by Thomas + Dickey). + +961127 + > patch by Juergen Pfeifer (mostly for panel): + + cosmetic improvement for a few routines in the ncurses core library + to avoid warning messages. + + the panel overlap detection was broken + + the panel_window() function was not fool-proof. + + Some inlining... + + Cosmetic changes (also to avoid warning messages when compiling with + -DTRACE). + +961126 + > patch by Juergen Pfeifer: + + eliminates warning messages for the compile of libform. + + inserts Per Foreby's new field type TYPE_IPV4 into libform. + + Updates man page and the Ada95 binding to reflect this. + + Improves inlining in libmenu and libform. + +961120 + + improve the use of the "const" qualifier in the + panel library (Juergen Pfeifer) + + change set_panel_userptr() and panel_userptr() to use void* + (Juergen Pfeifer) + +961119 + + change ABI to 3.4 + + package with 961119 version of Ada95 binding (fixes for gnat-3.07). + (Juergen Pfeifer) + + correct initialization of the stdscr pseudo panel in panel library + (Juergen Pfeifer) + + use MODULE_ID (rcs keywords) in forms and menus libraries (Juergen + Pfeifer). + > patch #324 by Eric. + + typo in curs_termcap man page (reported by Hendrik Reichel + <106065.2344@compuserve.com>) + + change default xterm entry to xterm-r6. + + add entry for color_xterm + +961116 - snapshot + + lint found several functions that had only #define implementations + (e.g., attr_off), modified curses.h.in to generate them as per XSI + Curses requirement that every macro be available as a function. + + add check in infocmp.c to guard against string compare of + CANCELLED_STRING values. + + modify firework.c, rain.c to hide cursor while running. + + correct missing va_end in lib_tparm.c + + modify hanoi.c to work on non-color terminals, and to use timing + delays when in autoplay mode. + + correct 'echochar()' to refresh immediately (reported by Adrian + Garside 94ajg2@eng.cam.ac.uk) + > patch #322 by eric: + + reorganize terminfo.src entries for xterm. + +961109 - snapshot + + corrected error in line-breakout logic (lib_doupdate.c) + + modified newdemo to use wgetch(win) rather than getch() to eliminate + a spurious clear-screen. + + corrected ifdef's for 'poll()' configuration. + + added modules to ncurses, form, menu for Ada95 binding (Juergen + Pfeifer). + + modify set_field_buffer() to allow assignment of string longer than + the initial buffer length, and to return the complete string rather + than only the initial size (Juergen Pfeifer and Per Foreby + <perf@efd.lth.se>). + +961102 - snapshot + + configure for 'poll()' in preference to 'select()', since older + systems are more likely to have a broken 'select()'. + + modified render_char() to avoid OR'ing colors. + + minor fixes to testcurs.c, newdemo.c test programs: ifdef'd out the + resize test, use wbkgd and corrected box() parameters. + + make flushinp() test work in ncurses.c by using napms() instead of + sleep(). + + undo Eric's changes to xterm-x11r6 (it no longer matched the X11R6.1 + distribution, as stated) + + terminfo 9.13.18 (resync by Eric) + + check for getenv("HOME") returning null (Eric). + + change buffer used to decode xterm-mouse commands to unsigned to + handle displays wider than 128 chars (Juergen Pfeifer). + + correct typo curs_outopts.3x (Juergen Pfeifer). + + correct limit-checking in wenclose() (Juergen Pfeifer). + + correction to Peter Wemm's newwin change (Thomas Fehr <fehr@suse.de>). + + corrections to logic that combines colors and attributes; they must + not be OR'd (Juergen Pfeifer, extending from report/patch by Rick + Marshall). + +961026 - snapshot + + reset flags in 'getwin()' that might cause refresh to attempt to + manipulate the non-existent parent of a window that is read from a + file (lib_screen.c). + + restructure _nc_timed_wait() to log more information, and to try to + recover from badly-behaved 'select()' calls (still testing this). + + move define for GOOD_SELECT into configure script. + + corrected extra '\' character inserted before ',' in comp_scan.c + + corrected expansion of %-format characters in dump_entry.c; some were + rendered as octal constants. + + modify dump_entry.c to make terminfo output more readable and like + SVr4, by using "\s" for spaces (leading/trailing only), "\," for + comma, "\^" and "\:" as well. + + corrected some memory leaks in ncurses.c, and a minor logic error + in the top-level command-parser. + + correction for label format 4 (PC style with info line), a + slk_clear(), slk_restore() sequence didn't redraw the info line + (Juergen Pfeifer). + + modified the slk window (if simulated) to inherit the background and + default character attributes from stdscr (Juergen Pfeifer). + + corrected limit-check in set_top_row (Juergen Pfeifer). + +961019 - snapshot + + correct loop-limit in wnoutrefresh(), bug exposed during pipe-testing + had '.lastchar' entry one beyond '._maxx'. + + modify ncurses test-program to work with data piped to it. + + corrected pathname computation in run_tic.sh, removing extra "../" + (reported by Tim Mooney). + + modified configure script to use previous install's location for + curses.h + + added NetBSD and FreeBSD to platforms that use --prefix=/usr as + a default. + +961013 + + revised xterm terminfo descriptions to reflect the several versions + that are available. + + corrected a pointer reference in dump_entry.c that didn't test if + the pointer was -1. + +961005 - snapshot + + correct _nc_mvcur_scrolln for terminals w/o scrolling region. + + add -x option to hashtest to control whether it allows writes to the + lower-right corner. + + ifdef'd (NCURSES_TEST) the logic for _nc_optimize_enable to make it + simpler to construct tests (for double-check of _nc_hash_map tests). + + correct ifdef's for c++ in curses.h + + change default xterm type to xterm-x11r6. + + correct quoting in configure that made man-pages installed with + $datadir instead of actual terminfo path. + + correct whitespace in include/Caps, which caused kf11, clr_eol and + clr_end to be omitted from terminfo.5 + + fix memory leaks in delscreen() (adapted from Alexander Lukyanov). + + improve appearance of marker in multi-selection menu (Juergen + Pfeifer) + + fix behaviour for forms with all fields inactive (Juergen + Pfeifer) + + document 'field_index()' (Juergen Pfeifer) + > patch #321 by eric: + + add some more XENIX keycap translations to include/Caps. + + modify newwin to set initial state of each line to 'touched' + (from patch by Peter Wemm <peter@spinner.dialix.com>) + + in SET_TTY, replace TCSANOW with TCSADRAIN (Alexander Lukyanov). + +960928 - snapshot + + ifdef'd out _nc_hash_map (still slower) + + add graphic characters to vt52 description. + + use PutAttrChar in ClrToEOL to ensure proper background, position. + + simplify/correct logic in 'mvcur()' that does wrapping; it was + updating the position w/o actually moving the cursor, which broke + relative moves. + + ensure that 'doupdate()' sets the .oldindex values back to a sane + state; this was causing a spurious refresh in ncurses 'r'. + + add logic to configure (from vile) to guard against builders who + don't remove config.cache & config.status when doing new builds. + + corrected logic for 'repeat_char' in EmitRange (from #317), which + did not follow the 2-parameter scheme specified in XSI. + + corrected logic of wrefresh, wnoutrefresh broken in #319, making + clearok work properly (from report by Michael Elkins). + + corrected problem with endwin introduced by #314 (removing the + scrolling-region reset) that broke ncurses.c tests. + + corrected order of args in AC_CHECK_LIB (from report by Ami Fischman + <fischman@math.ucla.edu>). + + corrected formatting of terminfo.5 tables (Juergen Ehling) + > patch 320 by eric: + + change ABI to 3.3 + + emit a carriage-return in 'endwin()' to workaround a kernel bug in + BSDI. (requested by Mike Karels <karels@redrock.bsdi.com>) + + reverse the default o configure --enable-termcap (consensus). + > patch 319 by eric: + + modified logic for clearok and related functions (from report by + Michael Elkins) - untested + > patch 318 by eric: + + correction to #317. + > patch 317 by eric: + + re-add _nc_hash_map + + modify EmitRange to maintain position as per original design. + + add hashtest.c, program to time the hashmap optimization. + > patch 316 by eric: + + add logic to deal with magic-cookie (how was this tested?) + (lib_doupdate.c). + + add ncurses.c driver for magic-cookie, some fixes to ncurses.c + > patch 315 by eric: + + merged A. Lukyanov's patch to use ech and rep - untested + (lib_doupdate.c). + + modified handling of interrupted system calls - untested + (lib_getch.c, lib_twait.c). + + new function _nc_mvcur_resume() + + fix return value for 'overlay()', 'overwrite()' + +960914 - snapshot + + implement subwindow-logic in wresize, minor fixes to ncurses 'g' + test. + + corrected bracketing of fallback.c (reported/suggested fix by Juergen + Ehling <eh@eclipse.aball.de>). + + update xterm-color to reflect XFree86 3.1.3G release. + + correct broken dtterm description from #314 patch (e.g., spurious + newline. The 'pairs' change might work, but no one's tested it + either ;-) + + clarify the documentation for the builtin form fieldtypes (Juergen + Pfeifer) + > patch 314 by eric: + + Enhancement suggested by A. Lukyanov -- reset scroll region on + startup rather than at wrapup time. + + Fix suggested by A. Lukyanov, make storage of palette tables + and their size counts per-screen for multi-terminal applications. + + Improved error reporting for infotocap translation errors. + + Update terminfo.src to 9.13.14. + +960907 - snapshot + + rewrote wgetstr to make it erase control chars and also fix bogus use + of _nc_outstr which caused the display to not wrap properly (display + problem reported by John M. Flinchbaugh <glynis@netrax.net>) + + modify ncurses 'f' test to accommodate terminal responses to C1 codes + (and split up this screen to accommodate non-ANSI terminals). + + test enter_insert_mode and exit_insert_mode in has_ic(). + + removed bogus logic in mvcur that assumes nl/nonl set output modes + (XSI says they are input modes; SVr4 implements this). + + added macros SET_TTY, GET_TTY to term.h + + correct getstr() logic that altered terminal modes w/o restoring. + + disable ICRNL, etc., during initialization to match SVr4, removing + the corresponding logic from raw, cbreak, etc. + + disable ONLCR during initialization, to match SVr4 (this is needed + for cursor optimization when the cursor-down is a newline). + + replaced Eric's imitation of wresize with my original (his didn't + work). + +960831 - snapshot + + memory leaks (Alexander V. Lukyanov). + + modified pnoutrefresh() to be more tolerant of too-large screen + size (reported by Michael Elkins). + + correct handling of terminfo files with no strings (Philippe De + Muyter) + + correct "tic -s" to take into account -I, -C options. + + modify ncurses 'f' test to not print codes 80 through 9F, since they + are considered control codes by ANSI terminals. + +960824 - snapshot + + correct speed variable-type in 'tgetent()' (reported by Peter Wemm) + + make "--enable-getcap" configuration-option work (reported by + Peter Wemm <peter@spinner.DIALix.COM>) + +960820 + + correct err in 960817 that changed return-value of tigetflag() + (reported by Alexander V. Lukyanov). + + modify infocmp to use library default search-path for terminfo + directory (Alexander V. Lukyanov). + +960817 - snapshot + + corrected an err in mvcur that broke resizing-behavior. + + correct fall-thru behavior of _nc_read_entry(), which was not finding + descriptions that existed in directories past the first one searched + (reported by Alexander V. Lukyanov) + + corrected typo in dtterm description. + > patch 313 by eric: + + add dtterm description + + clarify ncurses 'i' test (drop vscanf subtest) + +960810 - snapshot + + correct nl()/nonl() to work as per SVr4 & XSI. + + minor fixes to ncurses.c (use 'noraw()', mvscanw return-code) + + refine configure-test for -g option (Tim Mooney). + + correct interaction between O_BLANK and NEW_LINE request in form + library (Juergen Pfeifer) + +960804 + + revised fix to tparm; previous fix reversed parameter order. + > patch 312 by eric: + correct terminfo.src corrupted by #310 + > patch 311 by eric: + + fix idlok() and idcok() and the default of the idlok switch. + +960803 - snapshot + + corrected tparm to handle capability strings without explicit pop + (reported by William P Setzer) + + add fallback def for GCC_NORETURN, GCC_UNUSED for termcap users + (reported by Tim Mooney). + > patch 310 by eric: + + documentation and prototyping errors for has_color, immedok and idcok + (reported by William P Setzer <wsetzer@pams.ncsu.edu>) + + updated qnx terminfo entry (by Michael Hunter) + +960730 + + eliminate quoted includes in ncurses subdirectory, ensure config.h + is included first. + + newterm initializes terminal settings the same as initscr (reported + by Tim Mooney). + +960727 - snapshot + + call cbreak() in initscr(), as per XSI & SVr4. + + turn off hardware echo in initscr() as per XSI & SVr4 + > patch 309 by eric: + + terminfo changes (9.3.10), from BRL + + add more checks to terminfo parser. + + add more symbols to infocmp. + +960720 - snapshot + + save previous-attribute in lib_vidattr.c if SP is null (reported by + Ju"rgen Fluk <louis@dachau.marco.de>) + + corrected calls on _nc_render so that background character is set + as per XSI. + + corrected wbkgdset macro (XSI allows background character to be null), + and tests that use it. + + more corrections to terminfo (xterm & rxvt) + + undid change to mcprint prototype (cannot use size_t in curses.h + because not all systems declare it in the headers that we can safely + include therein). + + move the ifdefs for errno into curses.priv.h + > patch 308 by eric: + + terminfo changes (9.3.8) + + modified logic of error-reporting in terminfo parser + +960713 - snapshot + + always check for <sys/bsdtypes.h> since ISC needs it to declare + fd_set (Juergen Pfeifer) + + install shared-libraries on NetBSD/FreeBSD with ABI-version (reported + by several people: Juergen Pfeifer, Mike Long) + + add LOCAL_LDFLAGS2 symbol (Juergen Pfeifer) + + corrected prototype for delay_output() -- bump ABI to 3.2 + + terminfo patches #306/307 from Eric. + + moved logic that filters out rmul and rmso from setupterm to newterm + where it is less likely to interfere with termcap applications. + +960707 + + rollback Eric's #305 change to terminfo.src (it breaks existing + applications, e.g., 'less 290'). + + correct path of edit_man.sh, and fix typo that made all man-pages + preformatted. + + restore man/menu_requestname.3x omitted in Zeyd's resync (oops). + + auto-configure the GCC_PRINTFLIKE/GCC_SCANFLIKE macros (reported by + Philippe De Muyter). + +960706 - snapshot + + make lib_vidattr.c more readable using macros. + + filter out rmul, rmso that conflict with sgr0 when reading terminal + descriptions. + + added sanity-checking of various paired string attributes (Eric). + + work around autoconf bug, force $INSTALL to absolute path. + (reported by Zeyd). + + modify man-page install for BSDI to install preformatted .0 files + (reported by David MacKenzie). + + add/use gcc __attribute__ for printf and scanf in curses.h + + added SGR attributes test-case to ncurses + + revised ncurses 't' logic to show trace-disable effect in the menu. + + use getopt in ncurses program to process -s and -t options. + + make ncurses 'p' legend toggle with '?' + + disable scrollok during the ncurses 'p' test; if it is enabled the + stdscr will scroll when putting the box-corners in the lower-right + of the screen. + +960629 - snapshot + + check return code of _nc_mvcur_scrolln() in _nc_scroll_optimize() for + terminals with no scrolling-support (reported by Nikolay Shadrin + <queen@qh.mirea.ac.ru>) + + added ^S scrollok-toggle to ncurses 'g' test. + + added ^T trace-toggle to ncurses tests. + + modified ncurses test program to use ^Q or ESC consistently for + terminating tests (rather than ^D), and to use control keys rather + than function keys in 'g' test. + + corrected misplaced wclrtoeol calls in addch to accommodate wrapping + (reported by Philippe De Muyter). + + modify lib_doupdate.c to use effective costs to tradeoff between + delete-character/insert-character vs normal updating (reported by + David MacKenzie). + + compute effective costs for screen update operations (e.g., clr_eos, + delete_character). + + corrected error in knight.c exposed by wrap fixes in 960622; the + msgwin needed scrollok set. + + corrected last change to IDcTransformLine logic to avoid conflict + between PutRange and InsStr + + modified run_tic.sh to not use /usr/tmp (reported by David MacKenzie), + and further revised it and aclocal.m4 to use $TMPDIR if set. + + corrected off-by-one in RoomFor call in read_entry.c + +960622 - snapshot + + modified logic that wraps cursor in addch to follow the XSI spec, + (implemented in SVr4) which states that the cursor position is + updated when wrapping. Renamed _NEED_WRAP to _WRAPPED to reflect the + actual semantics. + + added -s option to tic, to provide better diagnostics in run_tic.sh + + improved error-recovery for tabset install. + + change ABI to 3.1 (dropped tparam, corrected getbkgd(), added + _yoffset to WINDOW). + + modified initialization of SP->_ofp so that init_acs() is called with + the "right" file pointer (reported by Rick Marshall <rjm@nlc.net.au> + + documentation fixes (Juergen Pfeifer). + + corrected, using new SCREEN and WINDOW members, the behavior of + ncurses if one uses ripoffline() to remove a line from the top of the + screen (Juergen Pfeifer). + + modified autoconf scripts to prepare for Ada95 (GNAT) binding to + ncurses (Juergen Pfeifer). + + incorrect buffer-size in _nc_read_entry, reported by Eric Raymond. + +960617 + + corrected two logic errors in read_entry.c, write_entry.c (called by + tic, the write/read of terminfo entries used inconsistent rules for + locating the entries; the $TERMINFO_DIRS code would find only the + first entry in a list). + + refined pathname computation in run_tic.sh and shlib. + + corrected initialization of $IP in misc/run_tic.sh + +960615 - snapshot + + ifdef'd out _nc_hash_map() call because it does not improve speed. + + display version of gcc if configure script identifies it. + + modify configure script to use /usr as Linux's default prefix. + + modify run_tic.sh to use shlib script, fixes some problems installing + with a shared-library configuration. + + adjusted configure script so that it doesn't run tests with the + warnings turned on, which makes config.log hard to read. + + added 'lint' rule to top-level Makefile. + + added configure option '--with-install-prefix' for use by system + builders to install into staging locations (from request by + charles@comm.polymtl.ca) + + corrected autoconfigure for Debian man program; it's not installed + as "man_db". + + set noecho in 'worm'; it was ifdef'd for debug only + + updated test/configure.in for timing-display in ncurses 'p' test + + corrected misspelled 'getbkgd()'. + + corrected wbkgdset to work like observed syvr4 (sets A_CHARTEXT part + to blank if no character given, copies attributes to window's + attributes). + + modified lib_doupdate.c to use lower-level SP's current_attr state + instead of curscr's state, since it is redundant. + + correction to IDcTransformLine logic which controls where InsStr is + invoked (refined by lav@yars.free.net). + > patches 303 by eric + + conditionally include Chris Torek's hash function _nc_hash_map(). + + better fix for nvi refresh-bug (Rick Marshall) + + fix for bug in handling of interrupted keystroke waits, + (Werner Fleck). + +960601 - snapshot + + auto-configure man-page compression-format and renames for Debian. + + corrected several typos in curses.h.in (i.e., the mvXXXX macros). + + re-order curses.priv.h for lint. + + added rules for lintlib, lint + + corrected ifdef for BROKEN_LINKER in MKnames.awk.in + + corrected missing INSTALL_DATA in misc/Makefile.in + + flush output when changing cursor-visibility (Rick Marshall) + + fix a minor bug in the _nc_ripoff() routine and improve error checking + when creating the label window (Juergen Pfeifer). + + enhancement to the control over the new PC-style soft key format. + allow caller now to select whether or not one wants to have + the index-line; see curs_slk.3x for documentation (Juergen Pfeifer). + + typos, don't use inline with -g (Philippe De Muyter) + + fixes for menus & wattr-, slk-functions (Juergen Pfeifer) + +960526 - snapshot + + removed --with-ticdir option altogether, maintain compatibility with + existing applications via symbolic link in run_tic.sh + + patch for termio.h, signal (Philippe De Muyter) + + auto-configure gcc warning options rather than infer from version. + + auto-configure __attribute__ for different gcc versions. + + corrected special use of clearok() in hardscroll.c by resetting flag + in wrefresh(). + + include stdlib.h before defs for EXIT_SUCCESS, for OSF/1. + + include sys/types.h in case stdlib.h does not declare size_t. + + fixes for makefile (Tim Mooney) + + fixes for menus & forms (Juergen.Pfeifer@T-Online.de) + +960518 - snapshot + + revised ncurses.c panner test, let pad abut all 4 sides of screen. + + refined case in lib_doupdate.c for ClrToEOL(). + + corrected prior change for PutRange (Alexander V. Lukyanov: + lav@yars.free.net). + + autoconf mods (Tim Mooney: mooney@dogbert.cc.ndsu.NoDak.edu). + + locale fix for forms (Philippe De Muyter: phdemuyt@ulb.ac.be) + + renamed "--with-datadir" option to "--with-ticdir" to avoid + confusion, and made this check for the /usr/lib/terminfo pre-existing + directory. + > patches 299-301 by eric: + + added hashmap.c + + mods to tracing, especially for ACS chars. + + corrected off-by-one in IDCtransform. + + corrected intermittent mouse bug by using return-value from read(). + + mods to parse_entry.c, for smarter defaults. + +960512 + + use getopt in 'tic'; added -L option and modified -e option to allow + list from a file. + +960511 + + don't use fixed buffer-size in tparm(). + + modified tic to create terminfo directory if it doesn't exist. + + added -T options to tic and infocmp (for testing/analysis) + + refined the length criteria for termcap and terminfo + + optimize lib_doupdate with memcpy, PutRange + > patches 297, 298 by eric + + implement TERMINFO_DIRS, and -o option of tic + + added TRACE_IEVENT + + removed boolean version of 'getm' + + added lib_print.c (for Rick Marshall) + + added has_key() + + added 't' to ncurses.c test. + + moved delay_output() to lib_tputs.c + + removed tparam(). + + misc cursor & optimization fixes. + +960504 - snapshot + + modified ncurses 'p' test to allow full-screen range for panner size. + + fixes for locale (phdm@labauto1.ulb.ac.be) + + don't use fixed buffer-size in fmt_entry(). + + added usage-message to 'infocmp'. + + modified install.includes rules to prepend subdirectory-name to + "#include" if needed. + +960430 + + protect wrefresh, wnoutrefresh from invocation with pad argument. + + corrected default CCFLAGS in test/Makefile. + +960428 - snapshot + + implemented logic to support terminals with background color erase + (e.g., rxvt and the newer color xterm). + + improved screen update logic (off-by-one logic error; use clr_eos if + possible) + +960426 - snapshot + + change ncurses 'a' test to run in raw mode. + + make TIOCGWINSZ configure test less stringent, in case user + configures via terminal that cannot get screen size. + > patches 295, 296 by eric: + + new "-e" option of tic. + + fix for "infocmp -e". + + restore working-directory in read_termcap.c + + split lib_kernel.c, lib_setup.c and names.c in order to reduce + overhead for programs that use only termcap features. + +960418 - snapshot + + use autoconf 2.9 + + fix for AIX 3.2.5 (must define _POSIX_SOURCE to get termios struct + definitions via <termios.h>, modified macros in lib_raw.c to avoid + K&R-style substitution) + > patches 293, 294 by eric: + + mods to wgetch() in cooked mode + + corrected askuser() logic in tset + + correct interaction of endwin() with mouse processing + + added trace support for TTY flags + +960406 + + fixes for NeXT, ISC and HPUX auto-configure + + autogenerate development header-dependencies (config.h, *.priv.h) + + corrected single-column formatting of "use=" (e.g., in tic) + + modify tic to read full terminfo-names + + corrected divide-by-zero that caused hang (or worse) when redirecting output + + modify tic to generate directories only as-needed (and corrected + instance of use of data from function that had already returned). + +### ncurses-1.9.8a -> 1.9.9e + +* fixed broken wsyncup()/wysncdown(), as a result wnoutrefresh() now has + copy-changed-lines behavior. +* added and documented wresize() function. +* more fixes to LOWER-RIGHT corner handling. +* changed the line-breakout optimization code to allow some lines to be + emitted before the first check. +* added option for tic to use symbolic instead of hard links (for AFS) +* fix to restore auto-wrap mode. +* trace level can be controlled by environment variable. +* better handling of NULs in terminal descriptions. +* improved compatibility with observed SVR4 behavior. +* the refresh behavior of over-lapping windows is now more efficient and + behaves like SVR4. +* use autoconf 2.7, which results in a working setup for SCO 5.0. +* support for ESCDELAY. +* small fixes for menu/form code. +* the test directory has its own configure. +* fixes to pads when optimizing scrolling. +* fixed several off-by-one bugs. +* fixes for termcap->terminfo translation; less restrictions more correct + behavior. + +### ncurses-1.9.7 -> 1.9.8a + +* teach infocmp -i to recognize ECMA highlight sequences +* infocmp now dumps all SVr4 termcaps (not just the SVr4 ones) on -C +* support infocmp -RBSD. +* satisfy XSI Curses requirement that every macro be available as a function. +* This represents the last big change to the public interface of ncurses. The + ABI_VERSION has now been set at 3.0 and should stay there barring any great + catastrophies or acts of God. +* The C++ has been cleaned up in reaction to the changes to satisfy XSI's + requirements. +* libncurses now gets linked to libcurses to help seamless emulation + (replacement) of a vendor's curses. --disable-overwrite turns this behavior + off. + +### ncurses-1.9.6 -> 1.9.7 + +* corrected return values of setupterm() +* Fixed some bugs in tput (it does padding now) +* fixed a bug in tic that made it do the wrong thing on entries with more than + one `use' capability. +* corrected the screen-size calculation at startup time to alter the + numeric capabilities as per SVr4, not just LINES and COLS. +* toe(1) introduced; does what infocmp -T used to. +* tic(1) can now translate AIX box1 and font[0123] capabilities. +* tic uses much less core, the dotic.sh kluge can go away now. +* fix read_entry() and write_entry() to pass through cancelled capabilities OK. +* Add $HOME/.terminfo as source/target directory for terminfo entries. +* termcap compilation now automatically dumps an entry to $HOME/.terminfo. +* added -h option to toe(1). +* added -R option to tic(1) and infocmp(1). +* added fallback-entry-list feature. +* added -i option to infocmp(1). +* do a better job at detecting if we're on SCO. + +### ncurses-1.9.5 -> 1.9.6 + +* handling of TERMCAP environment variables now works correctly. +* various changes to shorten termcap translations to less that 1024 chars. +* tset(1) added +* mouse support for xterm. +* most data tables are now const and accordingly live in shareable text space. +* Obey the XPG4/SVr4 practice that echo() is initally off. +* tic is much better at translating XENIX and AIX termcap entries now. +* tic can interpret ko capabilities now. +* integrated Juergen Pfeifer's forms library. +* taught write_entry() how not to write more than it needs to; this change + reduces the size of the terminfo tree by a full 26%! +* infocmp -T option added. +* better warnings about historical tic quirks from tic. + +### ncurses 1.9.4 -> 1.9.5 + +* menus library is now included with documentation. +* lib_mvcur has been carefully profiled and tuned. +* Fixed a ^Z-handling bug that was tanking lynx(1). +* HJ Lu's patches for ELF shared libraries under Linux +* terminfo.src 9.8.2 +* tweaks for compiling in seperate directories. +* Thomas Dickey's patches to support NeXT's brain-dead linker +* Eric Raymond's patches to fix problems with long termcap entries. +* more support for shared libraries under SunOS and IRIX. + +### ncurses 1.9.3 -> 1.9.4 + +* fixed an undefined-order-of-evaluation bug in lib_acs.c +* systematically gave non-API public functions and data an _nc_ prefix. +* integrated Juergen Pfeifer's menu code into the distribution. +* totally rewrote the knight test game's interface + +### ncurses 1.9.2c -> 1.9.3 + +* fixed the TERMCAP_FILE Support. +* fixed off-by-one errors in scrolling code +* added tracemunch to the test tools +* took steps to cut the running time of make install.data + +### ncurses 1.9.2c -> 1.9.2d + +* revised 'configure' script to produce libraries for normal, debug, + profile and shared object models. + +### ncurses 1.9.1 -> 1.9.2 + +* use 'autoconf' to implement 'configure' script. +* panels support added +* tic now checks for excessively long termcap entries when doing translation +* first cut at eliminating namespace pollution. + +### ncurses 1.8.9 -> 1.9 + +* cleanup gcc warnings for the following: use size_t where 'int' is not + appropriate, fixed some shadowed variables, change attr_t to compatible with + chtype, use attr_t in some places where it was confused with 'int'. +* use chtype/attr_t casts as appropriate to ensure portability of masking + operations. +* added-back waddchnstr() to lib_addstr.c (it had been deleted). +* supplied missing prototypes in curses.h +* include <termcap.h> in lib_termcap.c to ensure that the prototypes + are consistent (they weren't). +* corrected prototype of tputs in <termcap.h> +* rewrote varargs parsing in lib_tparm.c (to avoid referencing memory + that may be out of bounds on the stack) -- Purify found this. +* ensure that TRACE is defined in lib_trace.c (to solve prototype + warnings from gcc). +* corrected scrolling-region size in 'mvcur_wrap()' +* more spelling fixes +* use 'calloc()' to allocate WINDOW struct in lib_newwin.c (Purify). +* set default value for SP->_ofp in lib_set_term.c (otherwise SunOS dumps + core in init_acs()). +* include <errno.h> in write_entry.c (most "braindead" includes declare errno + in that file). + +### ncurses 1.8.8 -> 1.8.9 + +* compile (mostly) clean with gcc 2.5.8 -Wall -Wstrict-prototypes + -Wmissing-prototypes -Wconversion and using __attribute__ to flush out + non-portable use of "%x" for pointers, or for chtype data (which is declared + as a long). +* modified doupdate to ensure that typahead was turned on before attempting + select-call (otherwise, some implementations hang). +* added trace mask TRACE_FIFO, use this in lib_getch.c to allow finer + resolution of traces. +* improved bounds checking on several critical functions. +* the data directory has been replaced by the new master terminfo file. +* -F file-comparison option added to infocmp. +* compatibility with XSI Curses is now documented in the man bages. +* wsyncup/wsyncdown functions are reliable now; subwindow code in general + is much less flaky. +* capabilities ~msgr, tilde_glitch, insert_padding, generic_type, no_pad_char, + memory_above, memory_below, and hard_copy are now used properly. +* cursor-movement optimization has been completely rewritten. +* vertical-movement optimization now uses hardware scrolling, il, dl. + +### ncurses 1.8.7 -> 1.8.8 +* untic no longer exists, infocmp replaces it. +* tic can understand termcap now, especially if it is called captoinfo. +* The Linux Standard Console terminfo entry is called linux insead of console. + It also uses the kernel's new method of changing charsets. +* initscr() will EXIT upon error (as the docs say) This wil mostly happen if + you try to run on an undefined terminal. +* I can get things running on AIX but tic can't compile terminfo. I have to + compile entries on another machine. Volunteers to hunt this bug are welcome. +* wbkgd() and wbkgdset() can be used to set a windows background to color. + wclear()/werase() DO NOT use the current attribute to clear the screen. + This is the way SVR4 curses works. PDCurses 2.1 is broken in this respect, + though PDCurses 2.2 has been fixed. +* cleaned up the test/ directory. +* test/worm will segfault after quite a while. +* many spelling corrections courtesy of Thomas E. Dickey + +### ncurses 1.8.6 -> 1.8.7 +* cleaned up programs in test/ directory. +* fixed wbkgdset() macro. +* modified getstr() to stop it from advancing cursor in noecho mode. +* modified linux terminfo entry to work with the latest kernel to get + the correct alternate character set. +* also added a linux-mono entry for those running on monochrome screens. +* changed initscr() so that it behaves like the man page says it does. + this fixes the problem with programs in test/ crashing with SIGSEV if + a terminal is undefined. +* modified addch() to avoid using any term.h #define's +* removed duplicate tgoto() in lib_tparm.c +* modified dump_entry.c so that infocmp deals correctly with ',' in acsc +* modified delwin() to correctly handle deleting subwindows. +* fixed Makefile.dist to stop installing an empty curses.h +* fixed a couple of out-of-date notes in man pages. + +### ncurses 1.8.5 -> 1.8.6 +* Implemented wbkgd(), bkgd(), bkgdset(), and wbkgdset(). +* The handling of attributes has been improved and now does not turn off color + if other attributes are turned off. +* scrolling code is improved. Scrolling in subwindows is still broken. +* Fixes to several bugs that manifest them on platforms other than Linux. +* The default to meta now depends on the status of the terminal when ncurses + is started. +* The interface to the tracing facility has changed. Instead of the pair of + functions traceon() and traceoff(), there is just one function trace() which + takes a trace mask argument. The trace masks, defined in curses.h, are + as follows: + + #define TRACE_DISABLE 0x00 /* turn off tracing */ + #define TRACE_ORDINARY 0x01 /* ordinary trace mode */ + #define TRACE_CHARPUT 0x02 /* also trace all character outputs */ + #define TRACE_MAXIMUM 0x0f /* maximum trace level */ + + More trace masks may be added, or these may be changed, in future releases. +* The pad code has been improved and the pad test code in test/ncurses.c has + been improved. +* The prototype ansi entry has been changed to work with a wider variety + of emulators. +* Fix to the prototype ansi entry that enables it to work with PC emulators + that treat trailing ";m" in a highlight sequence as ";0m"; this doesn't + break operation with any emulators. +* There are now working infocmp, captoinfo, tput, and tclear utilities. +* tic can now compile entries in termcap syntax. +* Core-dump bug in pnoutrefresh fixed. +* We now recognize and compile all the nonstandard capabilities in Ross + Ridge's mytinfo package (rendering it obsolete). +* General cleanup and documentation improvements. +* Fixes and additions to the installation-documentation files. +* Take cursor to normal mode on endwin. + +### ncurses 1.8.4 -> 1.8.5 +* serious bugs in updating screen which caused erratic non-display, + fixed. +* fixed initialization for getch() related variable which cause + unpredictable results. +* fixed another doupdate bug which only appeared if you have + parm_char. +* implemented redrawln() and redrawwin(). +* implemented winsnstr() and related functions. +* cleaned up insertln() and deleteln() and implemented (w)insdeln(). +* changed Makefile.dist so that installation of man pages will + take note of the terminfo directory. +* fixed Configure (removed the mysterious 'X'). +* Eric S. Raymond fixed the script.* files so that they work with + stock awk. + +#### ncurses 1.8.3 -> 1.8.4 #### #### +* fixed bug in refreshing the screen after return from shell_mode. + There are still problems but they don't manifest themselves on + my machine (Linux 0.99.14f). +* added wgetnstr() and modified things accordingly. +* fixed the script.src script.test to work with awk not just gawk. +* Configure can now take an argument of the target system. +* added test/ncurses.c which replaces several other programs and + performs more testing. +[Thanks to Eric S Raymond for the last 4] +* more fixes to lib_overlay.c and added test/over.c to illustrate + how it works. +* fixed ungetch() to take int instead of ch. +* fixes to cure wgetch() if flushinp() is called. + +One note I forgot to mention in 1.8.3 is that tracing is off by +default starting in the version. If you want tracing output, put +traceon(); in your code and link with -ldcurses. + +#### ncurses 1.8.2 -> ncurses 1.8.3 #### #### +MAJOR CHANGES: +1) The order of capabilities has been changed in order to achieve +binary compatibility with SVR4 terminfo database. This has the +unfortunate effect of breaking application currently linked with +ncurses. To ensure correct behavior, recompile all such programs. +Most programs using color or newer capabilities will break, others +will probably continue to work ok. + +2) Pavel Curtis has renounced his copyright to the public domain. +This means that his original sources (posted to comp.sources.unix, +volume 1) are now in the public domain. The current sources are +NOT in the public domain, they are copyrighted by me. I'm +entertaining ideas on what the new terms ncurses is released under. + +3) Eric S. Raymond has supplied a complete set of man pages for +ncurses in ?roff format. They will eventually replace most of the +current docs. Both sets are included in this release. + +Other changes and notes from 1.8.2 include: +* SIGSEGV during scrolling no longer occurs. +* Other problems with scrolling and use of idl have been corrected. +* lib_getch.c has been re-written and should perform flawlessly. + please use test/getch.c and any other programs to test this. +* ripoffline() is implemented (Thanks to Eric) and slk_ functions + changed accordingly. +* I've added support for terminals that scroll if you write in the + bottom-right corner. +* fixed more bugs in pads code. If anybody has a program that uses + pads I'd love a copy. +* correct handling for terminal with back_color_erase capability + (such as Linux console, and most PC terminals) +* ^Z handling apparently didn't work (I should never trust code + sent me to me without extensive testing). It now seems to be + fixed. Let me know if you have problems. +* I've added support for Apollo and NeXT, but it may still be + incomplete, especially when dealing with the lack of POSIX + features. +* scrolling should be more efficient on terminals with idl + capabilities. Please see src/lib_scroll.c for more notes. +* The line drawing routines were offset by 1 at both ends. This + is now fixed. +* added a few missing prototypes and macros (e.g. setterm()) +* fixed code in src/lib_overlay.c which used to crash. +* added a few more programs in test/ The ones from the PDCurses + package are useful, especially if you have SVR4 proper. I'm + interested in the results you get on such a systems (Eric? ;-). + They already exposed certain bugs in ncurses. +* See src/README for porting notes. +* The C++ code should really replace ncurses.h instead of working + around it. It should avoid name-space clashes with nterm.h (use + rows instead of lines, etc.) +* The C++ should compile ok. I've added explicit rules to the + Makefile because no C++ defaults are documented on the suns. +* The docs say that echo() and nocbreak() are mutually exclusive. + At the moment ncurses will switch to cbreak() if the case above + occurs. Should it continue to do so? How about echo() and noraw()? +* PDCurses seem to assume that wclear() will use current attribute + when clearing the screen. According to Eric this is not the case + with SVR4. +* I have discovered, to my chagrin, SunOS 4.x (and probably other systems) + * doesn't have vsscanf and God knows what else! I've will do a vsscanf(). +* I've also found out that the src/script.* rely on gawk and will not + work with stock awk or even with nawk. Any changes are welcome. +* Linux is more tolerant of NULL dereferences than most systems. This + fact was exposed by hanoi. +* ncurses still seems inefficient in drawing the screen on a serial + link between Linux and suns. The padding may be the culprit. +* There seems to be one lingering problem with doupdate() after shelling + out. Despite the fact the it is sending out the correct information + to the terminal, nothing takes effect until you press ^L or another + refresh takes place. And yes, output does get flushed. + +#### ncurses 1.8.1 -> ncurses 1.8.2 #### Nov 28, 1993 #### + +* added support for SVR4 and BSDI's BSD/386. +* major update and fix to scrolling routine. +* MORE fixes to stuff in lib_getch.c. +* cleaned-up configuration options and can now generate + Config.* files through an awk script. +* changed setupterm() so it can be called more than once, + add added set_curterm(), del_curterm(). +* a few minor cleanups. +* added more prototypes in curses.h + +#### ncurses 1.8 -> ncurses 1.8.1 #### Nov 4, 1993 #### + +* added support for NeXTStep 3.0 +* added termcap emulation (not well tested). +* more complete C++ interface to ncurses. +* fixed overlay(), overwrite(), and added copywin(). +* a couple of bug fixes. +* a few code cleanups. + +#### ncurses 0.7.2/0.7.3 -> ncurses 1.8 #### Aug 31, 1993 #### + +* The annoying message "can't open file." was due to missing + terminfo entry for the used terminal. It has now been + replaced by a hopefully more helpful message. +* Problems with running on serial lines are now fixed. +* Added configuration files for SunOS, Linux, HP/UX, Ultrix, + 386bsd/BSDI (if you have others send'em to me) +* Cleaner Makefile. +* The documentation in manual.doc is now more uptodate. +* update optimization and support for hp terminals, and 386bsd + console driver(s). +* mvcur optimization for terminals without cursor addressing + (doesn't work on Linux) +* if cursor moved since last update, getch() will refresh the + screen before working. +* getch() & alarm() can now live together. in 0.7.3 a signal + interrupted getch() (bug or feature?) now the getch is + restarted. +* scanw() et all were sick, now fixed. +* support for 8-bit input (use meta()). +* added default screen size to all terminfos. +* added c++ Ncursesw class. +* several minor bug fixes. + +#### ncurses 0.7.2 -> ncurses 0.7.3 #### May 27, 1993 #### + +* Config file to cope with different platforms (386BSD, BSDI, Ultrix, SunOS) +* more fixes to lib_getch.c +* changes related to Config + +#### ncurses 0.7 -> ncurses 0.7.2 #### May 22, 1993 #### + +* docs updated slightly (color usage is now documented). +* yet another fix for getch(), this one fixes problems with ESC being swallowed + if another character is typed before the 1 second timeout. +* Hopefully, addstr() and addch() are 8-bit clean. +* fixed lib_tparm.c to use stdarg.h (should run on suns now) +* order of capabilities changed to reflect that specified in SYSV + this will allow for binary-compatibility with existing terminfo dbs. +* added halfdelay() +* fixed problems with asc_init() +* added A_PROTECT and A_INVIS +* cleaned up vidputs() +* general cleanup of the code +* more attention to portability to other systems +* added terminfos for hp70092 (wont work until changes to lib_update.c are + made) and 386BSD pcvt drivers. + +Thanks to Hellmuth Michaelis for his help. +optimization code is slated for the next major release, stay tuned! + +#### ncurses 0.6/0.61 -> ncurses 0.7 #### April 1, 1993 +Please note that the next release will be called 1.8. If you want to know about +the rationale drop me a line. + +Included are several test programs in test/. +I've split up the panels library, reversi, tetris, sokoban. They are now +available separately from netcom.com:pub/zmbenhal/ + +* color and ACS support is now fully compatible with SYSV at the terminfo + level. +* Capabilities now includes as many SYSV caps I could find. +* tigetflag,tigetnum,tigetstr functions added. +* boolnames, boolfnames, boolcodes numnames, numfnames, numcodes, + strnames, strfnames, strcodes arrays are now added. +* keyname() is added. +* All function keys can be defined in terminfo entries. +* fixed lin_tparm.c to behave properly. +* terminfo entries for vt* and xterm are included (improvements are welcome) +* more automation in handling caps and keys. +* included fixes from 0.6.1 +* added a few more missing functions. +* fixed a couple of minor bugs. +* updated docs JUST a little (still miles behind in documenting the newer + features). + +#### ncurses 0.6 -> ncurses 0.61 #### + +1) Included the missing data/console. + +2) allow attributes when drawing boxes. + +3) corrected usage of win->_delay value. + +4) fixed a bug in lib_getch.c. if it didn't recognize a sequence it would + simply return the last character in the sequence. The correct + behavior is to return the entire sequence one character at a time. + +#### ncurses0.5 -> ncurses0.6 #### March 1, 1993 #### +* removed _numchngd from struct _win_st and made appropriate changes. +* rewritten kgetch() to remove problems with interaction between alarm and + read(). It caused SIGSEGV every now and then. +* fixed a bug that miscounted the numbers of columns when updating. + (in lib_doupdate.c(ClrUpdate() -- iterate to columns not columns-1) +* fixed a bug that cause the lower-right corner to be incorrect. + (in lib_doupdate.c(putChar() -- check against columns not columns-1) +* made resize() and cleanup() static to lib_newterm.c +* added notimeout(). +* added timeout() define in curses.h +* added more function prototypes and fixed napms. +* added use_env(). +* moved screen size detection to lib_setup.c. +* fixed newterm() to confirm to prototype. +* removed SIGWINCH support as SYSV does not define its semantics. +* cleaned-up lib_touch.c +* added waddnstr() and relatives. +* added slk_* support. +* fixed a bug in wdeleteln(). +* added PANEL library. +* modified Makefile for smoother installation. +* terminfo.h is really term.h + +#### ncurses 0.4 -> ncurses 0.5 #### Feb 14, 1993 #### +* changed _win_st structure to allow support for missing functionality. +* Addition of terminfo support for all KEY_*. +* Support for nodelay(), timeout(), notimeout(). +* fixed a bug with the keypad char reading that did not return ESC until + another key is pressed. +* nl mapping no longer occur on output (as should be) + fixed bug '\n' no causing a LF. +* fixed bug that reset terminal colors regardless of whether we use color + or not. +* Better support for ACS (not quite complete). +* fixed bug in wvline(). +* added curs_set(). +* changed from signal() to sigaction(). +* re-included the contents of important.patch into source. + +#### ncurses 0.3 -> ncurses 0.4 #### Feb 3, 1993 #### +* Addition of more KEY_* definitions. +* Addition of function prototypes. +* Addition of several missing functions. +* No more crashes if screen size is undefined (use SIGWINCH handler). +* added a handler to cleanup after SIGSEGV (hopefully never needed). +* changed SRCDIR from /etc/term to /usr/lib/terminfo. +* renamed compile/dump to tic/untic. +* New scrolling code. +* fixed bug that reversed the sense of nl() and nonl(). + +#### ncurses 0.2 -> ncurses 0.3 #### Jan 20, 1993 #### +* more support for color and graphics see test/ for examples. +* fixed various files to allow correct update after shelling out. +* more fixes for updates. +* no more core dumps if you don't have a terminfo entry. +* support for LINES and COLUMNS environment variables. +* support for SIGWINCH signal. +* added a handler for SIGINT for clean exits. + +#### ncurses 0.1 -> ncurses 0.2 #### Aug 14, 1992 #### +* support for color. +* support for PC graphic characters. +* lib_trace.c updated to use stdarg.h and vprintf routines. +* added gdc.c (Great Digital Clock) as an example of using color. + +#### ncurses -> ncurses 0.1 #### Jul 31, 1992 #### +* replacing sgtty stuff by termios stuff. +* ANSIfication of some functions. +* Disabling cost analysis 'cause it's incorrect. +* A quick hack for a terminfo entry. diff --git a/contrib/ncurses/README b/contrib/ncurses/README new file mode 100644 index 000000000000..cf1ab656612f --- /dev/null +++ b/contrib/ncurses/README @@ -0,0 +1,175 @@ +-- $Id: README,v 1.17 1998/02/15 01:26:47 tom Exp $ +------------------------------------------------------------------------------- + README file for the ncurses package + +See the file ANNOUNCE for a summary of ncurses features and ports. +See the file INSTALL for instructions on how to build and install ncurses. +See the file NEWS for a release history and bug-fix notes. +See the file TO-DO for things that still need doing, including known bugs. + +Browse the file misc/ncurses-intro.html for narrative descriptions of how +to use ncurses and the panel, menu, and form libraries. + +Browse the file misc/hackguide.html for a tour of the package internals. + +ROADMAP AND PACKAGE OVERVIEW: + +You should be reading this file in a directory called: ncurses-d.d, where d.d +is the current version number (see the dist.mk file in this directory for +that). There should be a number of subdirectories, including `c++', `form', +`man', `menu', `misc', `ncurses', `panel', `progs', `test', 'tack' and `Ada95'. +(The 'tack' program is distributed separately). + +A full build/install of this package typically installs several libraries, a +handful of utilities, and a database hierarchy. Here is an inventory of the +pieces: + +The libraries are: + + libncurses.a (normal) + libncurses.so (shared) + libncurses_g.a (debug and trace code enabled) + libncurses_p.a (profiling enabled) + + libpanel.a (normal) + libpanel.so (shared) + libpanel_g.a (debug and trace code enabled) + + libmenu.a (normal) + libmenu.so (shared) + libmenu_g.a (debug enabled) + + libform.a (normal) + libform.so (shared) + libform_g.a (debug enabled) + +The ncurses libraries implement the curses API. The panel, menu and forms +libraries implement clones of the SVr4 panel, menu and forms APIs. The source +code for these lives in the `ncurses', `panel', `menu', and `form' directories +respectively. + +In the `c++' directory, you'll find code that defines an interface to the +curses, forms, menus and panels library packaged as C++ classes, and a demo program in C++ +to test it. These class definition modules are not installed by the 'make +install.libs' rule as libncurses++. + +In the `Ada95' directory, you'll find code and documentation for an +Ada95 binding of the curses API, to be used with the GNAT compiler. +This binding is built by a normal top-level `make' if configure detects +an usable version of GNAT (3.10 or above). It is not installed automatically. +See the Ada95 directory for more build and installation instructions and +for documentation of the binding. + +To do its job, the ncurses code needs your terminal type to be set in the +environment variable TERM (normally set by your OS; under UNIX, getty(1) +typically does this, but you can override it in your .profile); and, it needs a +database of terminal descriptions in which to look up your terminal type's +capabilities. + +In older (V7/BSD) versions of curses, the database was a flat text file, +/etc/termcap; in newer (USG/USL) versions, the database is a hierarchy of +fast-loading binary description blocks under /usr/lib/terminfo. These binary +blocks are compiled from an improved editable text representation called +`terminfo' format (documented in man/terminfo.5). The ncurses library can use +either /etc/termcap or the compiled binary terminfo blocks, but prefers the +second form. + +In the `misc' directory, there is a text file terminfo.src, in editable +terminfo format, which can be used to generate the terminfo binaries (that's +what make install.data does). If the package was built with the +--enable-termcap option enabled, and the ncurses library cannot find a terminfo +description for your terminal, it will fall back to the termcap file supplied +with your system (which the ncurses package installation leaves strictly +alone). + +The utilities are as follows: + + tic -- terminfo source to binary compiler + infocmp -- terminfo binary to source decompiler/comparator + clear -- emits clear-screen for current terminal + tput -- shell-script access to terminal capabilities. + toe -- table of entries utility + tset -- terminal-initialization utility + +The first two (tic and infocmp) are used for manipulating terminfo +descriptions; the next two (clear and tput) are for use in shell scripts. The +last (tset) is provided for 4.4BSD compatibility. The source code for all of +these lives in the `progs' directory. + +Detailed documentation for all libraries and utilities can be found in +the `man' directory. An HTML introduction to ncurses, panels, and +menus programming lives in the `misc' directory. Manpages in HTML format +are under `Ada95/html'. + +The `test' directory contains programs that can be used to verify or +demonstrate the functions of the ncurses libraries. See test/README for +descriptions of these programs. Notably, the `ncurses' utility is designed to +help you systematically exercise the library functions. + +AUTHORS: + +Pavel Curtis: + wrote the original ncurses + +Zeyd M. Ben-Halim: + port of original to Linux and many enhancements. + +Thomas Dickey (maintainer since 1.9.9e): + configuration scripts, porting, mods to adhere to XSI Curses in the + areas of background color, terminal modes. Also memory leak testing, + the wresize, default colors and key definition extensions and numerous + bug fixes (more than half of those enumerated in NEWS beginning with + the internal release 1.8.9). + +Florian La Roche (official maintainer for FSF's ncurses 4.2) + Beginning with release 4.2, ncurses is distributed under an MIT-style + license. + +Eric S. Raymond: + the man pages, infocmp(1), tput(1), clear(1), captoinfo(1), tset(1), + toe(1), most of tic(1), trace levels, the HTML intro, wgetnstr() and + many other entry points, the cursor-movement optimization, the + scroll-pack optimizer for vertical motions, the mouse interface and + xterm mouse support, and the ncurses test program. + +Juergen Pfeifer + The menu and form libraries, C++ bindings for ncurses, menus, forms and + panels, as well as the Ada95 binding. Ongoing support for panel. + +CONTRIBUTORS: + +Alexander V. Lukyanov + for numerous fixes and improvements to the optimization logic. + +David MacKenzie + for first-class bug-chasing and methodical testing. + +Ross Ridge + for the code that hacks termcap parameterized strings into terminfo. + +Warren Tucker and Gerhard Fuernkranz, + for writing and sending the panel library. + +Hellmuth Michaelis, + for many patches and testing the optimization code. + +Eric Newton, Ulrich Drepper, and Anatoly Ivasyuk: + the C++ code. + +Jonathan Ross, + for lessons in using sed. + +Keith Bostic (maintainer of 4.4BSD curses) + for help, criticism, comments, bug-finding, and being willing to + deep-six BSD curses for this one when it grew up. + +Richard Stallman, + for his commitment to making ncurses free software. + +Countless other people have contributed by reporting bugs, sending fixes, +suggesting improvements, and generally whining about ncurses :-) + +BUGS: + See the INSTALL file for bug and developer-list addresses. + The Hacker's Guide in the misc directory includes some guidelines + on how to report bugs in ways that will get them fixed most quickly. diff --git a/contrib/ncurses/README.emx b/contrib/ncurses/README.emx new file mode 100644 index 000000000000..4fa430abb643 --- /dev/null +++ b/contrib/ncurses/README.emx @@ -0,0 +1,48 @@ +-- $Id: README.emx,v 1.1 1998/11/21 20:13:05 tom Exp $ +-- Author: Thomas Dickey <dickey@clark.net> +------------------------------------------------------------------------------- + +You can build ncurses on OS/2 in the EMX environment. But you must build and +acquire tools. Not all of the tools distributed with EMX work properly, and +some additional ones are required. + +First, the configure script distributed with ncurses will not run as-is in EMX. +You can generate a new one if you have autoconf built for EMX. You will need +the EMX development tools, of course. Get these programs to start: + + GNU m4 program (version 1.4) + GNU autoconf (version 2.12). + GNU patch (version 2.5) + +Apply the autoconf patches from + + http://www.clark.net/pub/dickey/autoconf + ftp://ftp.clark.net/pub/dickey/autoconf + +These are ordered by date: + + autoconf-2.12-970309.patch + autoconf-2.12-970429.patch + autoconf-2.12-971222-emx.patch + autoconf-2.12-971222.patch + autoconf-2.12-971230.patch + +I built my development environment for ncurses using EMX 0.9c at the end of +1997. Much of the EMX patch for autoconf was done originally by J.J.G.Ripoll, +using a similar environment (he prefers using the 'ash' shell). Newer versions +may fix these problems: + + + The pdksh program distributed at Hobbes and Leo (with a 1996 date) is + defective. It does not process "here documents" correctly (which + renders it useless for running the autoconf script). I built my own + copy of pdksh 5.2.13, which does have the bug corrected (documented + in the change log for pdksh). + + + I also built from sources (because the distributed binaries did not + work) the cmp, diff programs. + + Other required utilities such as ar, cat, chmod, cp, gawk, grep, mv, + ls, rm, mkdir, sed, sort and tr worked. + +Once you have autoconf patched and installed, run 'autoconf' from the top-level +directory of ncurses to generate the EMX-specific configure script. diff --git a/contrib/ncurses/README.glibc b/contrib/ncurses/README.glibc new file mode 100644 index 000000000000..7d52269b9997 --- /dev/null +++ b/contrib/ncurses/README.glibc @@ -0,0 +1,5 @@ +To compile this as an add-on for glibc, unpack it in the glibc source +tree and put ncurses on the add-on list when you do configure. + +hjl@gnu.ai.mit.edu +03/21/1997 diff --git a/contrib/ncurses/TO-DO b/contrib/ncurses/TO-DO new file mode 100644 index 000000000000..21e8ee0ca9eb --- /dev/null +++ b/contrib/ncurses/TO-DO @@ -0,0 +1,251 @@ +-- $Id: TO-DO,v 1.39 1998/07/12 00:25:39 tom Exp $ + +SHORT-TERM TO-DO ITEMS: + +Known Problems: + +* GNAT does not put libraries in the correct order, so a build only links + properly if you use shared libraries since -lncurses is first. + +* XPG4 specifies that the enhanced features are not available unless the + _XOPEN_SOURCE_EXTENDED test macro is defined by the application. Ncurses uses + this macro (incorrectly) to address a dependency upon wchar_t. The functions + which use wchar_t are not implemented, so the effect of the test macro is + pointless. + +* The screen optimization has been tested only in an ad hoc manner. We should + develop a good set of regression tests to cover lib_doupdate.c and + lib_mvcur.c. + +* Magic cookie support does not work, since the logic does not take into account + refresh. Also, the initial optimize does not adjust the current location + when a cookie is emitted. + +* Scrolling optimization has holes: for example, it forces repaints of the + screen between calls to refresh(). + +* SVr4 uses slightly different rules for determining when softkeys are shown. + For example, they are initially displayed (before the ncurses 'e' test + activates them), and a touchwin can apparently also force them to be + displayed. + ++ The code departs from perfect 8-bit cleanness in one respect; you cannot + specify a character \200 as part of a capability string, because the terminfo + library interprets \200 as a request to embed NUL (\000) at that point. This + is a legacy terminfo property we can't mess with. + +* The window classes defined in the c++ subdirectory need documentation. + Some C++ programmer could earn a lot of good karma by doing this... + +Portability (or lack thereof): + +* Users of older System V UNIXes (but not Solaris, and probably not SVr4) + may trip over a known problem with the signal-handling code which causes + abrupt termination of ncurses applications following resume from a ^Z + suspend (this problem was first seen running lynx). You will not see + this problem if you are running Linux or one of the 4.4BSD derivatives + like FreeBSD, NetBSD, or BSDI. For details, see the analysis in the + header comment of ncurses/lib_tstp.c. + +* In theory, vwprintw and vwscanf are supposed to use the older varargs.h + interface for handling variadic argument lists. Linux doesn't have + varargs.h, it has the newer X/Open-standard stdargs.h equivalent. So + these functions use stdargs instead. This is unlikely to be a problem + unless you're building ncurses on a System V old enough to only have + varargs.h. (Solaris 2.5.1 uses the stdarg.h binding as well). + +* If you're using a BSD earlier than 4.4BSD, or a Linux old enough not to + have a native vsscanf(3) in its library, vwscanw() will not work. You lose. + (It should work on any System V, however). If you want to fix this, add + an implementation to ncurses/vsscanf.c. + +* The demo build for the c++ library craps out with many link errors under gcc + 2.6.3. We're told the C++ support in 2.6.3 is broken and that the right + fix is to upgrade to 2.7.0. This demo is also known to not build with + the Sun SPARCworks 4.1 C++ compiler, due to a problem resolving templates. + +* Under Ultrix, configure craps out (Ultrix sh is lame). Run it under ksh. + +* We've not tested the configure script with cross-compilers. The autoconf + tests are supposed to be able to support this (please report bugs). You will + have to configure and build in two steps. The first step must create the + automatically-generated sources (e.g., comp_captab.c) on your host machine. + Then, run "make mostlyclean", remove config.* from the top-level directory + and configure for the cross-compiler. + ++ terminfo.5 does not format with the SunOS (and most other platform's) tbl + utility because it relies on a diversion for each table entry. Get the groff + package. + +Untested features: + +* The code for the HP color model using set_color_pair is untested. + +* The code for handling soft labels on a terminal type with built-in support + for them (num_labels > 0, label_height, label_width, label_format, label_off, + label_on, plab_norm, lab_f*) has not been tested. The label_format and + lab_f* capabilities aren't presently used. + +LONGER-TERM TO-DO ITEMS: + +1. Extended COSE conformance + +There is an XPG4 standard recently released which describes a superset +of the SVr4 API. The library is BASE conformant with this standard. +We would like to make ncurses fully conformant at the EXTENDED level +supporting internationalization. + +Here are page references to all material involving wide or multi-byte +characters in Issue 4 of the XSI Curses standard, with notes on their +status in this implementation: + + Page 1 (1.1.2) New Features discussion of internationalization. + Page 12 (2.4): Definition of cchar_t, wchar_t. + Page 16 (3.3.2): Introduction of multi-column characters. + Page 17-18 (3.3.5): Description of non-spacing characters. + Page 19-21 (3.4.2): Basic character operations. + Page 34 (addnstr): These should now call underlying wide- +character functions, and do (through waddnstr) if _XOPEN_SOURCE_EXTENDED is on). + Page 35 (addnwstr): wide-character add-string functions. All macros +except waddnwstr() which is not yet defined. + Page 36 (add_wch): wide-character add-char functions. All macros +except wadd_wch() which is not yet defined. + Page 39 (attr_get): implemented -- we've just made the current- +attributes field of the window an attr_t. + Page 43 (bkgrnd): None of these are implemented. + Page 45 (border_set): Neither of these is implemented. + Page 47 (box_set): box_set implemented as macro, but the underlying +wborder_set() is not yet defined. + Page 78 (echo_wchar): echo_wchar() implemented as macro, underlying +wecho_wchar() not yet implemented. + Page 81 (erasechar): Neither entry point is implemented. + Page 87 (getbkgrnd): Not implemented. + Page 88 (getcchar): Not implemented. + Page 93 (getn_wstr): All implemented (as macros) except the +underlying wgetn_wstr(). + Page 97 (get_wch): All implemented (as macros) except the +underlying wget_wch(). + Page 99 (get_wstr): Xref to page 93. + Page 105 (hline_set): All implemented (as macros) except the +underlying whline_set(), wvline_set(). + Page 114 (innstr): Multi-byte character-completeness check is +not implemented. + Page 115 (innwstr): All implemented (as macros) except the +underlying winnw_str(). + Page 119 (insnstr): Implementation may not be correct for multi-byte +characters. + Page 120 (ins_nwstr): Not implemented. + Page 121 (insstr): Xref to page 119. + Page 122 (instr): Xref to page 119. + Page 123 (ins_wch): Not implemented. + Page 124 (ins_wstr): Xref to page 120. + Page 126 (in_wch): Not implemented. + Page 127 (in_wchnstr): Not implemented. + Page 128 (inwstr): Xref to page 115. + Page 133 (killwchar): killwchar not implemented. + Page 158 (pechochar): pecho_wchar() not implemented. + Page 176 (setcchar): Not implemented. + Page 181 (slk_attroff): slk_wset not implemented. + Page 200 (ungetch): unget_wch() not implemented. + Page 203 (vidattr): vid_attr() and vid_puts() not implemented. + Page 206 (vline_set): Xref to page 105. + Page 214 (wunctrl): Not implemented. + Page 216 (curses.h): cchar_t, wint_t, wchar_t references. + Page 220 (curses.h): KEY_CODE_YES + +Basically, the macro superstructure is there but the core is absent. We +need better multi-locale support guarantees from the OS to finish this. +If you are working on internationalization support, please contact us so +we can cooperate. + +2. DOS port + +Only 16 of the 55 files in the library depend on the terminfo format. +It should be possible to further kernelize the package, then rewrite +a small number of core files to produce a functionally-compatible +port that would do updates to a memory-mapped screen area. The first +result of this would be a DOS port. + +3. X port + +It would be nice if ncurses could recognize when it was running under X and +maintain its own window. With this feature, all ncurses programs would +automatically become X programs. The challenge is to handle resize events +properly. + +4. Unused capabilities + +The currently unused capabilities fall naturally into several groups: + +A. Status-line capabilities: + + Booleans: has_status_line, status_line_esc_ok. + Numerics: width_status_line. + Strings: dis_status_line, from_status_line, to_status_line. + +System V Release 1 curses made no use of these at all. SVr4's use, if +any, is unknown. From the AT&T termcap file it looks like curses, in general, +shouldn't use them; terminal variants with status lines have their line count +decremented by 1, suggesting that curses is supposed to leave the status line +alone. + +B. Printer capabilities: + + Boolean: col_addr_glitch, cr_cancels_micro_mode, has_print_wheel, + row_addr_glitch, semi_auto_right_margin, cpi_changes_res, + lpi_changes_res. + Numeric: buffer_capacity, dot_horz_spacing, dot_vert_spacing, + max_micro_address, max_micro_jump, micro_col_size, + micro_line_size, number_of_pins, output_res_char, + output_res_line, output_res_horz_inch, print_rate, + wide_char_size, bit_image_entwining, bit_image_type. + String: down_half_line, form_feed, up_half_line, set_left_margin, + set_right_margin, clear_margins, change_char_pitch + ... set_page_length (all the SVr4 printer caps), + +Curses doesn't use these. + +C. Printer-control capabilities: + + Boolean: prtr_silent. + Strings: print_screen, prtr_on, prtr_off, prtr_non. + +Curses doesn't use these. + +D. Dialer strings: + + Strings: hangup, dial_phone, quick_dial, tone, pulse, flash_hook, + fixed_pause, wait_tone. + +Curses doesn't use these. + +E. Window and virtual-terminal capabilities: + + Numerics: maximum_windows, virtual_terminal. + Strings: req_for_input, create_window, goto_window, set_window. + +These seem to be fossils from some AT&T experiments on character-based +window systems that never escaped the lab. The virtual_terminal cap had +something to do with building terminal emulations into tty line disciplines. + +F. Unused VDT capabilities: + + Booleans: erase_overstrike, has_meta_key, insert_null_glitch, + move_insert, dest_tabs_magic_smso, transparent_underline, + needs_xon_xoff, hard_cursor. + Numerics: lines_of_memory, buttons. + Strings: pkey_key, pkey_local, pkey_xmit, underline_char, + enter_xon_mode, exit_xon_mode, xon_character, xoff_character, + display_clock, remove_clock, user[0-5], display_pc_char, + enter_scancode_mode, exit_scancode_mode, pc_term_options, + scancode_escape, alt_scancode_esc. + +These are the potentially important ones for ncurses. Notes: + + i) ncurses doesn't need move_insert; it never uses cup/hpa/vpa while + insert_mode is on. + + ii) We probably don't care about dest_tabs_magic_smso; only + Telerays used it and they're all long obsolete. + + diff --git a/contrib/ncurses/aclocal.m4 b/contrib/ncurses/aclocal.m4 new file mode 100644 index 000000000000..b42625d46df4 --- /dev/null +++ b/contrib/ncurses/aclocal.m4 @@ -0,0 +1,2140 @@ +dnl*************************************************************************** +dnl Copyright (c) 1998 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 * +dnl "Software"), to deal in the Software without restriction, including * +dnl without limitation the rights to use, copy, modify, merge, publish, * +dnl distribute, distribute with modifications, sublicense, and/or sell * +dnl copies of the Software, and to permit persons to whom the Software is * +dnl furnished to do so, subject to the following conditions: * +dnl * +dnl The above copyright notice and this permission notice shall be included * +dnl in all copies or substantial portions of the Software. * +dnl * +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * +dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * +dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * +dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * +dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. * +dnl * +dnl Except as contained in this notice, the name(s) of the above copyright * +dnl holders shall not be used in advertising or otherwise to promote the * +dnl sale, use or other dealings in this Software without prior written * +dnl authorization. * +dnl*************************************************************************** +dnl +dnl Author: Thomas E. Dickey <dickey@clark.net> 1996,1997,1998 +dnl +dnl $Id: aclocal.m4,v 1.162 1999/08/22 00:13:21 tom Exp $ +dnl Macros used in NCURSES auto-configuration script. +dnl +dnl --------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------- +dnl Construct the list of include-options for the C programs in the Ada95 +dnl binding. +AC_DEFUN([CF_ADA_INCLUDE_DIRS], +[ +ACPPFLAGS="$ACPPFLAGS -I. -I../../include" +if test "$srcdir" != "."; then + ACPPFLAGS="$ACPPFLAGS -I\$(srcdir)/../../include" +fi +if test -z "$GCC"; then + ACPPFLAGS="$ACPPFLAGS -I\$(includedir)" +elif test "$includedir" != "/usr/include"; then + if test "$includedir" = '${prefix}/include' ; then + if test $prefix != /usr ; then + ACPPFLAGS="$ACPPFLAGS -I\$(includedir)" + fi + else + ACPPFLAGS="$ACPPFLAGS -I\$(includedir)" + fi +fi +AC_SUBST(ACPPFLAGS) +])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], +[ +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" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc +# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) +for cf_arg in "-DCC_HAS_PROTOS" \ + "" \ + -qlanglvl=ansi \ + -std1 \ + "-Aa -D_HPUX_SOURCE +e" \ + "-Aa -D_HPUX_SOURCE" \ + -Xc +do + CFLAGS="$cf_save_CFLAGS $cf_arg" + AC_TRY_COMPILE( +[ +#ifndef CC_HAS_PROTOS +#if !defined(__STDC__) || (__STDC__ != 1) +choke me +#endif +#endif +],[ + int test (int i, double x); + struct s1 {int (*f) (int a);}; + struct s2 {int (*f) (double a);};], + [cf_cv_ansi_cc="$cf_arg"; break]) +done +CFLAGS="$cf_save_CFLAGS" +]) +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" +else + AC_DEFINE(CC_HAS_PROTOS) +fi +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl For programs that must use an ANSI compiler, obtain compiler options that +dnl will make it recognize prototypes. We'll do preprocessor checks in other +dnl macros, since tools such as unproto can fake prototypes, but only part of +dnl the preprocessor. +AC_DEFUN([CF_ANSI_CC_REQD], +[AC_REQUIRE([CF_ANSI_CC_CHECK]) +if test "$cf_cv_ansi_cc" = "no"; then + AC_ERROR( +[Your compiler does not appear to recognize prototypes. +You have the following choices: + a. adjust your compiler options + b. get an up-to-date compiler + c. use a wrapper such as unproto]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some +dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc +dnl 2.6.3 does, in anticipation of the ANSI C++ standard. +dnl +dnl Treat the configuration-variable specially here, since we're directly +dnl substituting its value (i.e., 1/0). +AC_DEFUN([CF_BOOL_DECL], +[ +AC_MSG_CHECKING([for builtin ifelse(AC_LANG,[C],$CC,$CXX) bool type]) +AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[ + AC_TRY_COMPILE([ +#include <stdio.h> +#include <sys/types.h> +],[bool x = false], + [ifelse($1,,cf_cv_builtin_bool,[$1])=1], + [ifelse($1,,cf_cv_builtin_bool,[$1])=0]) + ]) +if test $ifelse($1,,cf_cv_builtin_bool,[$1]) = 1 +then AC_MSG_RESULT(yes) +else AC_MSG_RESULT(no) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type). +dnl Don't bother looking for bool.h, since it's been deprecated. +AC_DEFUN([CF_BOOL_SIZE], +[ +AC_MSG_CHECKING([for size of ifelse(AC_LANG,[C],$CC,$CXX) bool]) +AC_CACHE_VAL(cf_cv_type_of_bool,[ + rm -f cf_test.out + AC_TRY_RUN([ +#include <stdlib.h> +#include <stdio.h> +#if HAVE_BUILTIN_H +#include <builtin.h> +#endif +main() +{ + FILE *fp = fopen("cf_test.out", "w"); + if (fp != 0) { + bool x = true; + if ((bool)(-x) >= 0) + fputs("unsigned ", fp); + if (sizeof(x) == sizeof(int)) fputs("int", fp); + else if (sizeof(x) == sizeof(char)) fputs("char", fp); + else if (sizeof(x) == sizeof(short))fputs("short",fp); + else if (sizeof(x) == sizeof(long)) fputs("long", fp); + fclose(fp); + } + exit(0); +} + ], + [cf_cv_type_of_bool=`cat cf_test.out`], + [cf_cv_type_of_bool=unknown], + [cf_cv_type_of_bool=unknown]) + ]) + rm -f cf_test.out +AC_MSG_RESULT($cf_cv_type_of_bool) +if test "$cf_cv_type_of_bool" = unknown ; then + AC_MSG_WARN(Assuming unsigned for type of bool) + cf_cv_type_of_bool=unsigned +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Determine the default configuration into which we'll install ncurses. This +dnl can be overridden by the user's command-line options. There's two items to +dnl look for: +dnl 1. the prefix (e.g., /usr) +dnl 2. the header files (e.g., /usr/include/ncurses) +dnl We'll look for a previous installation of ncurses and use the same defaults. +dnl +dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and +dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's +dnl programs from a vendor's. +AC_DEFUN([CF_CFG_DEFAULTS], +[ +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*) + prefix=/usr + ;; + *) prefix=$ac_default_prefix + ;; + esac +fi +AC_MSG_RESULT($prefix) + +if test "x$prefix" = "xNONE" ; then +AC_MSG_CHECKING(for default include-directory) +test -n "$verbose" && echo 1>&AC_FD_MSG +for cf_symbol in \ + $includedir \ + $includedir/ncurses \ + $prefix/include \ + $prefix/include/ncurses \ + /usr/local/include \ + /usr/local/include/ncurses \ + /usr/include \ + /usr/include/ncurses +do + cf_dir=`eval echo $cf_symbol` + if test -f $cf_dir/curses.h ; then + if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then + includedir="$cf_symbol" + test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG + break + fi + fi + test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG +done +AC_MSG_RESULT($includedir) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Check if the terminal-capability database functions are available. If not, +dnl ncurses has a much-reduced version. +AC_DEFUN([CF_CGETENT],[ +AC_MSG_CHECKING(for terminal-capability database functions) +AC_CACHE_VAL(cf_cv_cgetent,[ +AC_TRY_LINK([ +#include <stdlib.h>],[ + char temp[128]; + char *buf = temp; + char *db_array = temp; + cgetent(&buf, /* int *, */ &db_array, "vt100"); + cgetcap(buf, "tc", '='); + cgetmatch(buf, "tc"); + ], + [cf_cv_cgetent=yes], + [cf_cv_cgetent=no]) +]) +AC_MSG_RESULT($cf_cv_cgetent) +test $cf_cv_cgetent = yes && AC_DEFINE(HAVE_BSD_CGETENT) +])dnl +dnl --------------------------------------------------------------------------- +dnl Check if we're accidentally using a cache from a different machine. +dnl Derive the system name, as a check for reusing the autoconf cache. +dnl +dnl If we've packaged config.guess and config.sub, run that (since it does a +dnl better job than uname). +AC_DEFUN([CF_CHECK_CACHE], +[ +if test -f $srcdir/config.guess ; then + AC_CANONICAL_HOST + system_name="$host_os" +else + system_name="`(uname -s -r) 2>/dev/null`" + if test -z "$system_name" ; then + system_name="`(hostname) 2>/dev/null`" + fi +fi +test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") +AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) + +test -z "$system_name" && system_name="$cf_cv_system_name" +test -n "$cf_cv_system_name" && AC_MSG_RESULT("Configuring for $cf_cv_system_name") + +if test ".$system_name" != ".$cf_cv_system_name" ; then + AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) + AC_ERROR("Please remove config.cache and try again.") +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g., +dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it +dnl ourselves. +dnl +dnl (I would use AC_CACHE_CHECK here, but it will not work when called in a +dnl loop from CF_SYS_ERRLIST). +dnl +dnl $1 = the name to check +AC_DEFUN([CF_CHECK_ERRNO], +[ +AC_MSG_CHECKING(if external $1 is declared) +AC_CACHE_VAL(cf_cv_dcl_$1,[ + AC_TRY_COMPILE([ +#if HAVE_STDLIB_H +#include <stdlib.h> +#endif +#include <stdio.h> +#include <sys/types.h> +#include <errno.h> ], + [long x = (long) $1], + [eval 'cf_cv_dcl_'$1'=yes'], + [eval 'cf_cv_dcl_'$1'=no]') +]) + +eval 'cf_result=$cf_cv_dcl_'$1 +AC_MSG_RESULT($cf_result) + +if test "$cf_result" = no ; then + eval 'cf_result=DECL_'$1 + CF_UPPER(cf_result,$cf_result) + AC_DEFINE_UNQUOTED($cf_result) +fi + +# It's possible (for near-UNIX clones) that the data doesn't exist +CF_CHECK_EXTERN_DATA($1,int) +])dnl +dnl --------------------------------------------------------------------------- +dnl Check for existence of external data in the current set of libraries. If +dnl we can modify it, it's real enough. +dnl $1 = the name to check +dnl $2 = its type +AC_DEFUN([CF_CHECK_EXTERN_DATA], +[ +AC_MSG_CHECKING(if external $1 exists) +AC_CACHE_VAL(cf_cv_have_$1,[ + AC_TRY_LINK([ +#undef $1 +extern $2 $1; +], + [$1 = 2], + [eval 'cf_cv_have_'$1'=yes'], + [eval 'cf_cv_have_'$1'=no'])]) + +eval 'cf_result=$cf_cv_have_'$1 +AC_MSG_RESULT($cf_result) + +if test "$cf_result" = yes ; then + eval 'cf_result=HAVE_'$1 + CF_UPPER(cf_result,$cf_result) + AC_DEFINE_UNQUOTED($cf_result) +fi + +])dnl +dnl --------------------------------------------------------------------------- +dnl If we're trying to use g++, test if libg++ is installed (a rather common +dnl problem :-). If we have the compiler but no library, we'll be able to +dnl configure, but won't be able to build the c++ demo program. +AC_DEFUN([CF_CXX_LIBRARY], +[ +cf_cxx_library=unknown +if test $ac_cv_prog_gxx = yes; then + AC_MSG_CHECKING([for libg++]) + cf_save="$LIBS" + LIBS="$LIBS -lg++ -lm" + AC_TRY_LINK([ +#include <builtin.h> + ], + [float foo=abs(1.0)], + [cf_cxx_library=yes + CXXLIBS="$CXXLIBS -lg++ -lm"], + [cf_cxx_library=no]) + LIBS="$cf_save" + AC_MSG_RESULT($cf_cxx_library) +fi +])dnl +dnl --------------------------------------------------------------------------- +AC_DEFUN([CF_DIRS_TO_MAKE], +[ +DIRS_TO_MAKE="lib" +for cf_item in $cf_list_models +do + CF_OBJ_SUBDIR($cf_item,cf_subdir) + DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir" +done +for cf_dir in $DIRS_TO_MAKE +do + test ! -d $cf_dir && mkdir $cf_dir +done +AC_SUBST(DIRS_TO_MAKE) +])dnl +dnl --------------------------------------------------------------------------- +dnl Check if 'errno' is declared in <errno.h> +AC_DEFUN([CF_ERRNO], +[ +CF_CHECK_ERRNO(errno) +])dnl +dnl --------------------------------------------------------------------------- +dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between +dnl math.h and builtin.h, only for ncurses +AC_DEFUN([CF_ETIP_DEFINES], +[ +AC_MSG_CHECKING(for special defines needed for etip.h) +cf_save_CXXFLAGS="$CXXFLAGS" +cf_result="none" +for cf_math in "" MATH_H +do +for cf_excp in "" MATH_EXCEPTION +do + CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu" + test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}" + test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}" +AC_TRY_COMPILE([ +#include <etip.h.in> +],[],[ + test -n "$cf_math" && AC_DEFINE(ETIP_NEEDS_${cf_math}) + test -n "$cf_excp" && AC_DEFINE(ETIP_NEEDS_${cf_excp}) + cf_result="$cf_math $cf_excp" + break +],[]) +done +done +AC_MSG_RESULT($cf_result) +CXXFLAGS="$cf_save_CXXFLAGS" +]) +dnl --------------------------------------------------------------------------- +dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither +dnl is found, add our own version of memmove to the list of objects. +AC_DEFUN([CF_FUNC_MEMMOVE], +[ +AC_CHECK_FUNC(memmove,,[ +AC_CHECK_FUNC(bcopy,[ + AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[ + AC_TRY_RUN([ +int main() { + static char data[] = "abcdefghijklmnopqrstuwwxyz"; + char temp[40]; + bcopy(data, temp, sizeof(data)); + bcopy(temp+10, temp, 15); + bcopy(temp+5, temp+15, 10); + exit (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz")); +} + ], + [cf_cv_good_bcopy=yes], + [cf_cv_good_bcopy=no], + [cf_cv_good_bcopy=unknown]) + ]) + ],[cf_cv_good_bcopy=no]) + if test $cf_cv_good_bcopy = yes ; then + AC_DEFINE(USE_OK_BCOPY) + else + AC_DEFINE(USE_MY_MEMMOVE) + fi +])])dnl +dnl --------------------------------------------------------------------------- +dnl Test for availability of useful gcc __attribute__ directives to quiet +dnl compiler warnings. Though useful, not all are supported -- and contrary +dnl to documentation, unrecognized directives cause older compilers to barf. +AC_DEFUN([CF_GCC_ATTRIBUTES], +[ +if test -n "$GCC" +then +cat > conftest.i <<EOF +#ifndef GCC_PRINTF +#define GCC_PRINTF 0 +#endif +#ifndef GCC_SCANF +#define GCC_SCANF 0 +#endif +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif +EOF +if test -n "$GCC" +then + AC_CHECKING([for gcc __attribute__ directives]) + changequote(,)dnl +cat > conftest.$ac_ext <<EOF +#line __oline__ "configure" +#include "confdefs.h" +#include "conftest.h" +#include "conftest.i" +#if GCC_PRINTF +#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) +#else +#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ +#endif +#if GCC_SCANF +#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) +#else +#define GCC_SCANFLIKE(fmt,var) /*nothing*/ +#endif +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; } +EOF + changequote([,])dnl + for cf_attribute in scanf printf unused noreturn + do + CF_UPPER(CF_ATTRIBUTE,$cf_attribute) + cf_directive="__attribute__(($cf_attribute))" + echo "checking for gcc $cf_directive" 1>&AC_FD_CC + case $cf_attribute in + scanf|printf) + cat >conftest.h <<EOF +#define GCC_$CF_ATTRIBUTE 1 +EOF + ;; + *) + cat >conftest.h <<EOF +#define GCC_$CF_ATTRIBUTE $cf_directive +EOF + ;; + esac + if AC_TRY_EVAL(ac_compile); then + test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) + cat conftest.h >>confdefs.h +# else +# sed -e 's/__attr.*/\/*nothing*\//' conftest.h >>confdefs.h + fi + done +else + fgrep define conftest.i >>confdefs.h +fi +rm -rf conftest* +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Check if the compiler supports useful warning options. There's a few that +dnl we don't use, simply because they're too noisy: +dnl +dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) +dnl -Wredundant-decls (system headers make this too noisy) +dnl -Wtraditional (combines too many unrelated messages, only a few useful) +dnl -Wwrite-strings (too noisy, but should review occasionally) +dnl -pedantic +dnl +AC_DEFUN([CF_GCC_WARNINGS], +[ +if test -n "$GCC" +then + changequote(,)dnl + cat > conftest.$ac_ext <<EOF +#line __oline__ "configure" +int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; } +EOF + changequote([,])dnl + AC_CHECKING([for gcc warning options]) + cf_save_CFLAGS="$CFLAGS" + EXTRA_CFLAGS="-W -Wall" + cf_warn_CONST="" + test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" + for cf_opt in \ + Wbad-function-cast \ + Wcast-align \ + Wcast-qual \ + Winline \ + Wmissing-declarations \ + Wmissing-prototypes \ + Wnested-externs \ + Wpointer-arith \ + Wshadow \ + Wstrict-prototypes $cf_warn_CONST + do + CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" + if AC_TRY_EVAL(ac_compile); then + test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) + EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" + test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES" + fi + done + rm -f conftest* + CFLAGS="$cf_save_CFLAGS" +fi +AC_SUBST(EXTRA_CFLAGS) +])dnl +dnl --------------------------------------------------------------------------- +dnl Verify that a test program compiles and runs with GNAT +dnl $cf_ada_make is set to the program that compiles/links +AC_DEFUN([CF_GNAT_TRY_RUN], +[ +rm -f conftest* +cat >>conftest.ads <<CF_EOF +$1 +CF_EOF +cat >>conftest.adb <<CF_EOF +$2 +CF_EOF +if ( $cf_ada_make conftest 1>&AC_FD_CC 2>&1 ) ; then + if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then +ifelse($3,, :,[ $3]) +ifelse($4,,,[ else + $4]) + fi +ifelse($4,,,[else + $4]) +fi +rm -f conftest* +])dnl +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>>;}'` +case $cf_cv_gnat_version in + 3.[1-9]*|[4-9].*) + cf_cv_prog_gnat_correct=yes + ;; + *) echo Unsupported GNAT version $cf_cv_gnat_version. Required is 3.10 or better. Disabling Ada95 binding. + cf_cv_prog_gnat_correct=no + ;; +esac +case $cf_cv_gnat_version in + 3.1*|[4-9].*) + cf_compile_generics=generics + cf_generic_objects="\$(GENOBJS)" + ;; + *) cf_compile_generics= + cf_generic_objects= + ;; +esac +changequote([, ])dnl +]) +dnl --------------------------------------------------------------------------- +dnl Insert text into the help-message, for readability, from AC_ARG_WITH. +AC_DEFUN([CF_HELP_MESSAGE], +[AC_DIVERT_HELP([$1])dnl +])dnl +dnl --------------------------------------------------------------------------- +dnl Construct the list of include-options according to whether we're building +dnl in the source directory or using '--srcdir=DIR' option. If we're building +dnl with gcc, don't append the includedir if it happens to be /usr/include, +dnl since that usually breaks gcc's shadow-includes. +AC_DEFUN([CF_INCLUDE_DIRS], +[ +CPPFLAGS="$CPPFLAGS -I. -I../include" +if test "$srcdir" != "."; then + CPPFLAGS="$CPPFLAGS -I\$(srcdir)/../include" +fi +if test -z "$GCC"; then + CPPFLAGS="$CPPFLAGS -I\$(includedir)" +elif test "$includedir" != "/usr/include"; then + if test "$includedir" = '${prefix}/include' ; then + if test $prefix != /usr ; then + CPPFLAGS="$CPPFLAGS -I\$(includedir)" + fi + else + CPPFLAGS="$CPPFLAGS -I\$(includedir)" + fi +fi +AC_SUBST(CPPFLAGS) +])dnl +dnl --------------------------------------------------------------------------- +dnl Check if we have either a function or macro for 'isascii()'. +AC_DEFUN([CF_ISASCII], +[ +AC_MSG_CHECKING(for isascii) +AC_CACHE_VAL(cf_cv_have_isascii,[ + AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')], + [cf_cv_have_isascii=yes], + [cf_cv_have_isascii=no]) +])dnl +AC_MSG_RESULT($cf_cv_have_isascii) +test $cf_cv_have_isascii = yes && AC_DEFINE(HAVE_ISASCII) +])dnl +dnl --------------------------------------------------------------------------- +dnl Compute the library-prefix for the given host system +dnl $1 = variable to set +AC_DEFUN([CF_LIB_PREFIX], +[ + case $cf_cv_system_name in + os2) $1='' ;; + *) $1='lib' ;; + esac +])dnl +dnl --------------------------------------------------------------------------- +dnl Append definitions and rules for the given models to the subdirectory +dnl Makefiles, and the recursion rule for the top-level Makefile. If the +dnl subdirectory is a library-source directory, modify the LIBRARIES list in +dnl the corresponding makefile to list the models that we'll generate. +dnl +dnl For shared libraries, make a list of symbolic links to construct when +dnl generating each library. The convention used for Linux is the simplest +dnl one: +dnl lib<name>.so -> +dnl lib<name>.so.<major> -> +dnl lib<name>.so.<maj>.<minor> +AC_DEFUN([CF_LIB_RULES], +[ +CF_LIB_PREFIX(cf_prefix) +AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) +for cf_dir in $SRC_SUBDIRS +do + if test -f $srcdir/$cf_dir/modules; then + + cf_libs_to_make= + for cf_item in $CF_LIST_MODELS + do + CF_LIB_SUFFIX($cf_item,cf_suffix) + cf_libs_to_make="$cf_libs_to_make ../lib/${cf_prefix}${cf_dir}${cf_suffix}" + done + + if test $cf_dir = ncurses ; then + case "$LIB_SUBSETS" in + termlib+*) #(vi + ;; + *) #(vi + cf_item=`echo $cf_libs_to_make |sed -e s/$LIB_NAME/$TINFO_NAME/g` + cf_libs_to_make="$cf_item $cf_libs_to_make" + ;; + esac + fi + + sed -e "s@\@LIBS_TO_MAKE\@@$cf_libs_to_make@" \ + $cf_dir/Makefile >$cf_dir/Makefile.out + mv $cf_dir/Makefile.out $cf_dir/Makefile + + $AWK -f $srcdir/mk-0th.awk \ + name=$cf_dir \ + $srcdir/$cf_dir/modules >>$cf_dir/Makefile + + for cf_item in $CF_LIST_MODELS + do + echo 'Appending rules for '$cf_item' model ('$cf_dir')' + CF_UPPER(CF_ITEM,$cf_item) + CF_LIB_SUFFIX($cf_item,cf_suffix) + CF_OBJ_SUBDIR($cf_item,cf_subdir) + + # These dependencies really are for development, not + # builds, but they are useful in porting, too. + cf_depend="../include/ncurses_cfg.h" + if test "$srcdir" = "."; then + cf_reldir="." + else + cf_reldir="\$(srcdir)" + fi + + if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then + cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h" + elif test -f $srcdir/$cf_dir/curses.priv.h; then + cf_depend="$cf_depend $cf_reldir/curses.priv.h" + fi + + for cf_subset in $LIB_SUBSETS + do + $AWK -f $srcdir/mk-1st.awk \ + name=$cf_dir \ + MODEL=$CF_ITEM \ + model=$cf_subdir \ + prefix=$cf_prefix \ + suffix=$cf_suffix \ + subset=$cf_subset \ + DoLinks=$cf_cv_do_symlinks \ + rmSoLocs=$cf_cv_rm_so_locs \ + ldconfig="$LDCONFIG" \ + overwrite=$WITH_OVERWRITE \ + depend="$cf_depend" \ + target="$target" \ + $srcdir/$cf_dir/modules >>$cf_dir/Makefile + test $cf_dir = ncurses && WITH_OVERWRITE=no + $AWK -f $srcdir/mk-2nd.awk \ + name=$cf_dir \ + MODEL=$CF_ITEM \ + model=$cf_subdir \ + subset=$cf_subset \ + srcdir=$srcdir \ + echo=$WITH_ECHO \ + $srcdir/$cf_dir/modules >>$cf_dir/Makefile + done + done + fi + + echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >>Makefile +done + +for cf_dir in $SRC_SUBDIRS +do + if test -f $cf_dir/Makefile ; then + case "$cf_dir" in + Ada95) #(vi + echo 'install.libs \' >> Makefile + echo 'uninstall.libs ::' >> Makefile + echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >> Makefile + ;; + esac + fi + + if test -f $srcdir/$cf_dir/modules; then + echo >> Makefile + if test -f $srcdir/$cf_dir/headers; then +cat >> Makefile <<CF_EOF +install.includes \\ +uninstall.includes \\ +CF_EOF + fi +if test "$cf_dir" != "c++" ; then +echo 'lint \' >> Makefile +fi +cat >> Makefile <<CF_EOF +lintlib \\ +install.libs \\ +uninstall.libs \\ +install.$cf_dir \\ +uninstall.$cf_dir :: + cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@ +CF_EOF + elif test -f $srcdir/$cf_dir/headers; then +cat >> Makefile <<CF_EOF + +install.libs \\ +uninstall.libs \\ +install.includes \\ +uninstall.includes :: + cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@ +CF_EOF +fi +done + +cat >> Makefile <<CF_EOF + +install.data :: + cd misc && \$(MAKE) \$(CF_MFLAGS) \[$]@ + +install.man :: + cd man && \$(MAKE) \$(CF_MFLAGS) \[$]@ + +distclean :: + rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h + rm -f headers.sh headers.sed + rm -rf \$(DIRS_TO_MAKE) +CF_EOF + +dnl If we're installing into a subdirectory of /usr/include, etc., we should +dnl prepend the subdirectory's name to the "#include" paths. It won't hurt +dnl anything, and will make it more standardized. It's awkward to decide this +dnl at configuration because of quoting, so we'll simply make all headers +dnl installed via a script that can do the right thing. + +rm -f headers.sed headers.sh + +dnl ( generating this script makes the makefiles a little tidier :-) +echo creating headers.sh +cat >headers.sh <<CF_EOF +#! /bin/sh +# This shell script is generated by the 'configure' script. It is invoked in a +# subdirectory of the build tree. It generates a sed-script in the parent +# directory that is used to adjust includes for header files that reside in a +# subdirectory of /usr/include, etc. +PRG="" +while test \[$]# != 3 +do +PRG="\$PRG \[$]1"; shift +done +DST=\[$]1 +REF=\[$]2 +SRC=\[$]3 +echo installing \$SRC in \$DST +case \$DST in +/*/include/*) + TMP=\${TMPDIR-/tmp}/\`basename \$SRC\` + if test ! -f ../headers.sed ; then + END=\`basename \$DST\` + for i in \`cat \$REF/../*/headers |fgrep -v "#"\` + do + NAME=\`basename \$i\` + echo "s/<\$NAME>/<\$END\/\$NAME>/" >> ../headers.sed + done + fi + rm -f \$TMP + sed -f ../headers.sed \$SRC > \$TMP + eval \$PRG \$TMP \$DST + rm -f \$TMP + ;; +*) + eval \$PRG \$SRC \$DST + ;; +esac +CF_EOF + +chmod 0755 headers.sh + +for cf_dir in $SRC_SUBDIRS +do + if test -f $srcdir/$cf_dir/headers; then + cat >>$cf_dir/Makefile <<CF_EOF +\$(INSTALL_PREFIX)\$(includedir) : + \$(srcdir)/../mkinstalldirs \[$]@ + +install \\ +install.libs \\ +install.includes :: \$(INSTALL_PREFIX)\$(includedir) \\ +CF_EOF + j="" + for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` + do + test -n "$j" && echo " $j \\" >>$cf_dir/Makefile + j=$i + done + echo " $j" >>$cf_dir/Makefile + for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` + do + echo " @ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(INSTALL_PREFIX)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile + test $i = curses.h && echo " @ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f ncurses.h && \$(LN_S) curses.h ncurses.h)" >>$cf_dir/Makefile + done + + cat >>$cf_dir/Makefile <<CF_EOF + +uninstall \\ +uninstall.libs \\ +uninstall.includes :: +CF_EOF + for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` + do + i=`basename $i` + echo " -@ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f $i)" >>$cf_dir/Makefile + test $i = curses.h && echo " -@ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f ncurses.h)" >>$cf_dir/Makefile + done + fi +done + +])dnl +dnl --------------------------------------------------------------------------- +dnl Compute the library-suffix from the given model name +dnl $1 = model name +dnl $2 = variable to set +AC_DEFUN([CF_LIB_SUFFIX], +[ + AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) + case $1 in + normal) $2='.a' ;; + debug) $2='_g.a' ;; + profile) $2='_p.a' ;; + shared) + case $cf_cv_system_name in + openbsd*|netbsd*|freebsd*) + $2='.so.$(REL_VERSION)' ;; + hpux*) $2='.sl' ;; + *) $2='.so' ;; + esac + esac +])dnl +dnl --------------------------------------------------------------------------- +dnl Compute the string to append to -library from the given model name +AC_DEFUN([CF_LIB_TYPE], +[ + case $1 in + normal) $2='' ;; + debug) $2='_g' ;; + profile) $2='_p' ;; + shared) $2='' ;; + esac +])dnl +dnl --------------------------------------------------------------------------- +dnl Some systems have a non-ANSI linker that doesn't pull in modules that have +dnl only data (i.e., no functions), for example NeXT. On those systems we'll +dnl have to provide wrappers for global tables to ensure they're linked +dnl properly. +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 }; +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() +{ +#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; +#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 + fi + rm -f conftest.$ac_ext func.o + ( eval $ac_cv_prog_RANLIB conftest.a ) 2>&5 >/dev/null + cf_saveLIBS="$LIBS" + LIBS="conftest.a $LIBS" + AC_TRY_RUN([ + int main() + { + extern int testfunc(); + exit (!testfunc()); + } + ], + [cf_cv_link_dataonly=yes], + [cf_cv_link_dataonly=no], + [cf_cv_link_dataonly=unknown]) + LIBS="$cf_saveLIBS" + ]) +AC_MSG_RESULT($cf_cv_link_dataonly) +test $cf_cv_link_dataonly = no && AC_DEFINE(BROKEN_LINKER) +])dnl +dnl --------------------------------------------------------------------------- +dnl Most Unix systems have both link and symlink, a few don't have symlink. +dnl A few non-Unix systems implement symlink, but not link. +dnl A few non-systems implement neither (or have nonfunctional versions). +AC_DEFUN([CF_LINK_FUNCS], +[ +AC_CHECK_FUNCS( \ + remove \ + unlink ) + +if test "$ac_cv_prog_cc_cross" = yes ; then + AC_CHECK_FUNCS( \ + link \ + symlink ) +else + AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[ + cf_cv_link_funcs= + for cf_func in link symlink ; do + AC_TRY_RUN([ +#include <sys/types.h> +#include <sys/stat.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +int main() +{ + int fail = 0; + char *src = "config.log"; + char *dst = "conftest.chk"; + struct stat src_sb; + struct stat dst_sb; + + stat(src, &src_sb); + fail = ($cf_func("config.log", "conftest.chk") < 0) + || (stat(dst, &dst_sb) < 0) + || (dst_sb.st_mtime != src_sb.st_mtime); +#ifdef HAVE_UNLINK + unlink(dst); +#else + remove(dst); +#endif + exit (fail); +} + ],[ + cf_cv_link_funcs="$cf_cv_link_funcs $cf_func" + eval 'ac_cv_func_'$cf_func'=yes'],[ + eval 'ac_cv_func_'$cf_func'=no'],[ + eval 'ac_cv_func_'$cf_func'=error']) + done + test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no + ]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Some 'make' programs support $(MAKEFLAGS), some $(MFLAGS), to pass 'make' +dnl options to lower-levels. It's very useful for "make -n" -- if we have it. +dnl (GNU 'make' does both, something POSIX 'make', which happens to make the +dnl $(MAKEFLAGS) variable incompatible because it adds the assignments :-) +AC_DEFUN([CF_MAKEFLAGS], +[ +AC_MSG_CHECKING([for makeflags variable]) +AC_CACHE_VAL(cf_cv_makeflags,[ + cf_cv_makeflags='' + for cf_option in '-$(MAKEFLAGS)' '$(MFLAGS)' + do + cat >cf_makeflags.tmp <<CF_EOF +all : + @ echo '.$cf_option' +CF_EOF + cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null` + case "$cf_result" in + .*k) + cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null` + case "$cf_result" in + .*CC=*) cf_cv_makeflags= + ;; + *) cf_cv_makeflags=$cf_option + ;; + esac + break + ;; + *) echo no match "$cf_result" + ;; + esac + done + rm -f cf_makeflags.tmp]) +AC_MSG_RESULT($cf_cv_makeflags) +AC_SUBST(cf_cv_makeflags) +])dnl +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_ARG_WITH(manpage-format, + [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and + optionally formatted, e.g., gzip,formatted], + [cf_manpage_form=$withval], + [cf_manpage_form=unknown]) + +case ".$cf_manpage_form" in +.gzip|.compress|.BSDI|.normal|.formatted) # (vi + ;; +.unknown|.) # (vi + if test -z "$MANPATH" ; then + 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}:" + 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 + do + cf_test=`echo $cf_name | sed -e 's/*//'` + if test "x$cf_test" = "x$cf_name" ; then + case "$cf_name" in + *.gz) cf_manpage_form=gzip;; + *.Z) cf_manpage_form=compress;; + *.0) cf_manpage_form=BSDI,formatted;; + *) cf_manpage_form=normal;; + esac + break + fi + done + if test "$cf_manpage_form" != "unknown" ; then + break + fi + done + IFS="$ac_save_ifs" + ;; +.*) # (vi + AC_MSG_WARN(Unexpected manpage-format) + ;; +esac + +AC_MSG_RESULT($cf_manpage_form) +])dnl +dnl --------------------------------------------------------------------------- +dnl The Debian people have their own naming convention for manpages. This +dnl option lets us override the name of the file containing renaming, or +dnl disable it altogether. +AC_DEFUN([CF_MANPAGE_RENAMES], +[ +AC_MSG_CHECKING(for manpage renaming) + +AC_ARG_WITH(manpage-renames, + [ --with-manpage-renames specify manpage-renaming], + [cf_manpage_renames=$withval], + [cf_manpage_renames=yes]) + +case ".$cf_manpage_renames" in #(vi +.no) #(vi + ;; +.|.yes) + # Debian 'man' program? + if test -f /etc/debian_version ; then + cf_manpage_renames=`cd $srcdir && pwd`/man/man_db.renames + else + cf_manpage_renames=no + fi + ;; +esac + +if test "$cf_manpage_renames" != no ; then + if test ! -f $cf_manpage_renames ; then + AC_MSG_ERROR(not a filename: $cf_manpage_renames) + fi + + test ! -d man && mkdir man + + # Construct a sed-script to perform renaming within man-pages + if test -n "$cf_manpage_renames" ; then + test ! -d man && mkdir man + $srcdir/man/make_sed.sh $cf_manpage_renames >man/edit_man.sed + fi +fi + +AC_MSG_RESULT($cf_manpage_renames) +])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. +AC_DEFUN([CF_MAN_PAGES], +[ +CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:) +CF_MANPAGE_FORMAT +CF_MANPAGE_RENAMES + + if test "$prefix" = "NONE" ; then + cf_prefix="$ac_default_prefix" + else + cf_prefix="$prefix" + fi + + case "$cf_manpage_form" in # (vi + *formatted*) # (vi + cf_subdir='$mandir/cat' + cf_format=yes + ;; + *) + cf_subdir='$mandir/man' + cf_format=no + ;; + esac + +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" +datadir="$datadir" +MKDIRS="`cd $srcdir && pwd`/mkinstalldirs" +INSTALL="$INSTALL" +INSTALL_DATA="$INSTALL_DATA" +TMP=\${TMPDIR-/tmp}/man\$\$ +trap "rm -f \$TMP" 0 1 2 5 15 + +verb=\{{$}}1 +shift + +mandir=\{{$}}1 +shift + +for i in \{{$}}* ; do +case \$i in #(vi +*.orig|*.rej) ;; #(vi +*.[0-9]*) + section=\`expr "\$i" : '.*\\.\\([0-9]\\)[xm]*'\`; + if test \$verb = installing ; then + if test ! -d $cf_subdir\${section} ; then + \$MKDIRS $cf_subdir\$section + fi + fi + source=\`basename \$i\` +CF_EOF +if test "$cf_manpage_renames" = no ; then +cat >>man/edit_man.sh <<CF_EOF + target=$cf_subdir\${section}/\$source + sed -e "s,@DATADIR@,\$datadir," < \$i >\$TMP +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" + test \$verb = installing && sed -e "s,@DATADIR@,\$datadir," < \$i | sed -f edit_man.sed >\$TMP +CF_EOF +fi +if test $cf_format = yes ; then +cat >>man/edit_man.sh <<CF_EOF + nroff -man \$TMP >\$TMP.out + mv \$TMP.out \$TMP +CF_EOF +fi +case "$cf_manpage_form" in #(vi +*compress*) #(vi +cat >>man/edit_man.sh <<CF_EOF + if test \$verb = installing ; then + if ( compress -f \$TMP ) + then + mv \$TMP.Z \$TMP + fi + fi + target="\$target.Z" +CF_EOF + ;; +*gzip*) #(vi +cat >>man/edit_man.sh <<CF_EOF + if test \$verb = installing ; then + if ( gzip -f \$TMP ) + then + mv \$TMP.gz \$TMP + fi + fi + target="\$target.gz" +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/'\`" +CF_EOF + ;; +esac +cat >>man/edit_man.sh <<CF_EOF + echo \$verb \$target + if test \$verb = installing ; then + \$INSTALL_DATA \$TMP \$target + else + rm -f \$target + fi + ;; +esac +done +CF_EOF +changequote([,])dnl +chmod 755 man/edit_man.sh + +])dnl +dnl --------------------------------------------------------------------------- +dnl Compute the object-directory name from the given model name +AC_DEFUN([CF_OBJ_SUBDIR], +[ + case $1 in + normal) $2='objects' ;; + debug) $2='obj_g' ;; + profile) $2='obj_p' ;; + shared) $2='obj_s' ;; + esac +])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 +dnl delayed evaluation of those symbols. +AC_DEFUN([CF_PATH_SYNTAX],[ +case ".[$]$1" in #(vi +./*) #(vi + ;; +.\[$]{*prefix}*) #(vi + eval $1="[$]$1" + case ".[$]$1" in #(vi + .NONE/*) + $1=`echo [$]$1 | sed -e s@NONE@$ac_default_prefix@` + ;; + esac + ;; #(vi +.NONE/*) + $1=`echo [$]$1 | sed -e s@NONE@$ac_default_prefix@` + ;; +*) + AC_ERROR(expected a pathname) + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. +AC_DEFUN([CF_PROG_EXT], +[ +AC_REQUIRE([CF_CHECK_CACHE]) +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__" + LDFLAGS=`echo "$LDFLAGS -Zmt -Zcrtdll" | sed "s/-Zexe//g"` + PROG_EXT=".exe" + ;; +esac +AC_SUBST(PROG_EXT) +])dnl +dnl --------------------------------------------------------------------------- +dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the +dnl misc/tabset install won't work properly. Usually this happens only when +dnl using the fallback mkinstalldirs script +AC_DEFUN([CF_PROG_INSTALL], +[AC_PROG_INSTALL +case $INSTALL in +/*) + ;; +*) +changequote({{,}})dnl + cf_dir=`echo $INSTALL|sed -e 's%/[^/]*$%%'` + test -z "$cf_dir" && cf_dir=. +changequote([,])dnl + INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's:^.*/::'` + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl Attempt to determine if we've got one of the flavors of regular-expression +dnl code that we can support. +AC_DEFUN([CF_REGEX], +[ +AC_MSG_CHECKING([for regular-expression headers]) +AC_CACHE_VAL(cf_cv_regex,[ +AC_TRY_LINK([#include <sys/types.h> +#include <regex.h>],[ + regex_t *p; + int x = regcomp(p, "", 0); + int y = regexec(p, "", 0, 0, 0); + regfree(p); + ],[cf_cv_regex="regex.h"],[ + AC_TRY_LINK([#include <regexp.h>],[ + char *p = compile("", "", "", 0); + int x = step("", ""); + ],[cf_cv_regex="regexp.h"],[ + cf_save_LIBS="$LIBS" + LIBS="-lgen $LIBS" + AC_TRY_LINK([#include <regexpr.h>],[ + char *p = compile("", "", ""); + int x = step("", ""); + ],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])]) +]) +AC_MSG_RESULT($cf_cv_regex) +case $cf_cv_regex in + regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;; + regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;; + regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl Attempt to determine the appropriate CC/LD options for creating a shared +dnl library. +dnl +dnl Note: $(LOCAL_LDFLAGS) is used to link executables that will run within the +dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib +dnl We avoid compiling-in a ../lib path for the shared library since that can +dnl lead to unexpected results at runtime. +dnl $(LOCAL_LDFLAGS2) has the same intention but assumes that the shared libraries +dnl are compiled in ../../lib +dnl +dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure +dnl to install symbolic links to the rel/abi versions of shared libraries. +dnl +dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi +dnl version when making symbolic links. +dnl +dnl Some loaders leave 'so_locations' lying around. It's nice to clean up. +AC_DEFUN([CF_SHARED_OPTS], +[ + AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) + LOCAL_LDFLAGS= + LOCAL_LDFLAGS2= + LD_SHARED_OPTS= + INSTALL_LIB="-m 644" + + cf_cv_do_symlinks=no + + AC_MSG_CHECKING(if release/abi version should be used for shared libs) + AC_ARG_WITH(shlib-version, + [ --with-shlib-version=X Specify rel or abi version for shared libs], + [test -z "$withval" && withval=auto + case $withval in #(vi + yes) #(vi + cf_cv_shlib_version=auto + ;; + rel|abi|auto|no) #(vi + cf_cv_shlib_version=$withval + ;; + *) + AC_ERROR([option value must be one of: rel, abi, auto or no]) + ;; + esac + ],[cf_cv_shlib_version=auto]) + AC_MSG_RESULT($cf_cv_shlib_version) + + cf_cv_rm_so_locs=no + + case $cf_cv_system_name in + hpux10.*) + # (tested with gcc 2.7.2 -- I don't have c89) + if test -n "$GCC"; then + CC_SHARED_OPTS='-fPIC' + LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)' + else + CC_SHARED_OPTS='+Z' + LD_SHARED_OPTS='-Wl,+b,$(libdir)' + fi + MK_SHARED_LIB='$(LD) +b $(libdir) -b +h `basename $[@]` -o $[@]' + # HP-UX shared libraries must be executable, and should be + # readonly to exploit a quirk in the memory manager. + INSTALL_LIB="-m 555" + cf_cv_do_symlinks=reverse + ;; + hpux*) + # (tested with gcc 2.7.2 -- I don't have c89) + if test -n "$GCC"; then + CC_SHARED_OPTS='-fPIC' + LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)' + else + CC_SHARED_OPTS='+Z' + LD_SHARED_OPTS='-Wl,+b,$(libdir)' + fi + MK_SHARED_LIB='$(LD) +b $(libdir) -b -o $[@]' + # HP-UX shared libraries must be executable, and should be + # readonly to exploit a quirk in the memory manager. + INSTALL_LIB="-m 555" + ;; + irix*) + # tested with IRIX 5.2 and 'cc'. + if test -n "$GCC"; then + CC_SHARED_OPTS='-fPIC' + else + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $[@]` -o $[@]' + cf_cv_rm_so_locs=yes + ;; + linux*|gnu*) + # tested with Linux 2.0.29 and gcc 2.7.2 (ELF) + CC_SHARED_OPTS='-fpic' + test $cf_cv_ld_rpath = yes && cf_ld_rpath_opt="-Wl,-rpath," + if test $DFT_LWR_MODEL = "shared" ; then + LOCAL_LDFLAGS='-Wl,-rpath,../lib' + LOCAL_LDFLAGS2='-Wl,-rpath,../../lib' + fi + test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel + if test $cf_cv_shlib_version = no ; then + MK_SHARED_LIB='gcc -shared -Wl,-stats,-lc -o $[@]' + else + MK_SHARED_LIB='gcc -shared -Wl,-soname,`basename $[@].$(ABI_VERSION)`,-stats,-lc -o $[@]' + fi + ;; + openbsd2*) + CC_SHARED_OPTS='-fpic -DPIC' + MK_SHARED_LIB='$(LD) -Bshareable -soname,`basename $[@].$(ABI_VERSION)` -o $[@]' + ;; + openbsd*|netbsd*|freebsd*) + CC_SHARED_OPTS='-fpic -DPIC' + MK_SHARED_LIB='$(LD) -Bshareable -o $[@]' + ;; + osf*|mls+*) + # tested with OSF/1 V3.2 and 'cc' + # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't + # link with shared libs). + CC_SHARED_OPTS='' + MK_SHARED_LIB='$(LD) -set_version $(REL_VERSION):$(ABI_VERSION) -expect_unresolved "*" -shared -soname `basename $[@]`' + test $cf_cv_ld_rpath = yes && cf_ld_rpath_opt="-rpath" + case $host_os in + osf4*) + MK_SHARED_LIB="${MK_SHARED_LIB} -msym" + ;; + esac + MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]' + if test $DFT_LWR_MODEL = "shared" ; then + LOCAL_LDFLAGS='-Wl,-rpath,../lib' + LOCAL_LDFLAGS2='-Wl,-rpath,../../lib' + fi + cf_cv_rm_so_locs=yes + ;; + sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98 + # tested with osr5.0.5 + if test $ac_cv_prog_gcc = yes; then + CC_SHARED_OPTS='-melf -fpic' + else + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='$(LD) -dy -G -h `basename [$]@.$(ABI_VERSION)` -o [$]@' + if test $cf_cv_ld_rpath = yes ; then + # only way is to set LD_RUN_PATH but no switch for it + RUN_PATH=$libdir + fi + test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel + LINK_PROGS='LD_RUN_PATH=$(libdir)' + LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib' + ;; + sunos4*) + # tested with SunOS 4.1.1 and gcc 2.7.0 + if test $ac_cv_prog_gcc = yes; then + CC_SHARED_OPTS='-fpic' + else + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='$(LD) -assert pure-text -o $[@]' + test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel + ;; + solaris2*) + # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2 + if test $ac_cv_prog_gcc = yes; then + CC_SHARED_OPTS='-fpic' + else + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@].$(ABI_VERSION)` -o $[@]' + if test $cf_cv_ld_rpath = yes ; then + cf_ld_rpath_opt="-R" + EXTRA_LDFLAGS="-R ../lib:\$(libdir) $EXTRA_LDFLAGS" + fi + test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel + ;; + unix_sv*) + # tested with UnixWare 1.1.2 + CC_SHARED_OPTS='-KPIC' + MK_SHARED_LIB='$(LD) -d y -G -o $[@]' + ;; + *) + CC_SHARED_OPTS='unknown' + MK_SHARED_LIB='echo unknown' + ;; + esac + + # This works if the last tokens in $MK_SHARED_LIB are the -o target. + case "$cf_cv_shlib_version" in #(vi + rel|abi) + case "$MK_SHARED_LIB" in #(vi + *'-o $[@]') + if test "$cf_cv_do_symlinks" = reverse ; then + AC_ERROR(cannot use --with-shlib-version with this platform) + fi + if test "$cf_cv_shlib_version" = rel ; then + MK_SHARED_LIB="$MK_SHARED_LIB"'.$(REL_VERSION)' + else + MK_SHARED_LIB="$MK_SHARED_LIB"'.$(ABI_VERSION)' + fi + cf_cv_do_symlinks=yes + ;; + *) + AC_MSG_WARN(ignored --with-shlib-version) + ;; + esac + ;; + esac + + if test -n "$cf_ld_rpath_opt" ; then + AC_MSG_CHECKING(if we need a space after rpath option) + cf_save_LIBS="$LIBS" + LIBS="$LIBS ${cf_ld_rpath_opt}/usr/lib" + AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) + LIBS="$cf_save_LIBS" + AC_MSG_RESULT($cf_rpath_space) + test $cf_rpath_space = yes && cf_ld_rpath_opt="$cf_ld_rpath_opt " + MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\$(libdir)" + fi + + AC_SUBST(CC_SHARED_OPTS) + AC_SUBST(LD_SHARED_OPTS) + AC_SUBST(MK_SHARED_LIB) + AC_SUBST(LINK_PROGS) + AC_SUBST(LINK_TESTS) + AC_SUBST(EXTRA_LDFLAGS) + AC_SUBST(LOCAL_LDFLAGS) + AC_SUBST(LOCAL_LDFLAGS2) + AC_SUBST(INSTALL_LIB) +])dnl +dnl --------------------------------------------------------------------------- +dnl Check for definitions & structures needed for window size-changing +dnl FIXME: check that this works with "snake" (HP-UX 10.x) +AC_DEFUN([CF_SIZECHANGE], +[ +AC_MSG_CHECKING([declaration of size-change]) +AC_CACHE_VAL(cf_cv_sizechange,[ + cf_cv_sizechange=unknown + cf_save_CFLAGS="$CFLAGS" + +for cf_opts in "" "NEED_PTEM_H" +do + + CFLAGS="$cf_save_CFLAGS" + test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts" + AC_TRY_COMPILE([#include <sys/types.h> +#if HAVE_TERMIOS_H +#include <termios.h> +#else +#if HAVE_TERMIO_H +#include <termio.h> +#endif +#endif +#if NEED_PTEM_H +/* This is a workaround for SCO: they neglected to define struct winsize in + * termios.h -- it's only in termio.h and ptem.h + */ +#include <sys/stream.h> +#include <sys/ptem.h> +#endif +#if !defined(sun) || !defined(HAVE_TERMIOS_H) +#include <sys/ioctl.h> +#endif +],[ +#ifdef TIOCGSIZE + struct ttysize win; /* FIXME: what system is this? */ + int y = win.ts_lines; + int x = win.ts_cols; +#else +#ifdef TIOCGWINSZ + struct winsize win; + int y = win.ws_row; + int x = win.ws_col; +#else + no TIOCGSIZE or TIOCGWINSZ +#endif /* TIOCGWINSZ */ +#endif /* TIOCGSIZE */ + ], + [cf_cv_sizechange=yes], + [cf_cv_sizechange=no]) + + CFLAGS="$cf_save_CFLAGS" + if test "$cf_cv_sizechange" = yes ; then + echo "size-change succeeded ($cf_opts)" >&AC_FD_CC + test -n "$cf_opts" && AC_DEFINE_UNQUOTED($cf_opts) + break + fi +done + ]) +AC_MSG_RESULT($cf_cv_sizechange) +test $cf_cv_sizechange != no && AC_DEFINE(HAVE_SIZECHANGE) +])dnl +dnl --------------------------------------------------------------------------- +dnl Check for datatype 'speed_t', which is normally declared via either +dnl sys/types.h or termios.h +AC_DEFUN([CF_SPEED_TYPE], +[ +AC_MSG_CHECKING(for speed_t) +OSPEED_INCLUDES= +AC_TRY_COMPILE([#include <sys/types.h>], + [speed_t some_variable = 0], + [OSPEED_TYPE=speed_t], + [OSPEED_TYPE=unsigned]) +AC_TRY_COMPILE([#include <termios.h>], + [speed_t some_variable = 0], + [OSPEED_TYPE=speed_t + OSPEED_INCLUDES="#include <termios.h>"],[]) +AC_SUBST(OSPEED_TYPE) +AC_SUBST(OSPEED_INCLUDES) +if test "$OSPEED_TYPE" = "unsigned" ; then + AC_MSG_RESULT(no) + AC_DEFINE(speed_t,unsigned) +else + AC_MSG_RESULT(yes) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl For each parameter, test if the source-directory exists, and if it contains +dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll +dnl use in CF_LIB_RULES. +dnl +dnl This uses the configured value to make the lists SRC_SUBDIRS and +dnl SUB_MAKEFILES which are used in the makefile-generation scheme. +AC_DEFUN([CF_SRC_MODULES], +[ +AC_MSG_CHECKING(for src modules) + +# dependencies and linker-arguments for test-programs +TEST_DEPS="${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS" +TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" + +# dependencies and linker-arguments for utility-programs +PROG_ARGS="$TEST_ARGS" + +cf_cv_src_modules= +for cf_dir in $1 +do + if test -f $srcdir/$cf_dir/modules; then + + # We may/may not have tack in the distribution, though the + # makefile is. + if test $cf_dir = tack ; then + if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then + continue + fi + fi + + if test -z "$cf_cv_src_modules"; then + cf_cv_src_modules=$cf_dir + else + cf_cv_src_modules="$cf_cv_src_modules $cf_dir" + fi + + # Make the ncurses_cfg.h file record the library interface files as + # well. These are header files that are the same name as their + # directory. Ncurses is the only library that does not follow + # that pattern. + if test $cf_dir = tack ; then + continue + elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then + CF_UPPER(cf_have_include,$cf_dir) + AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H) + AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include}) + TEST_DEPS="${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" + TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" + fi + fi +done +AC_MSG_RESULT($cf_cv_src_modules) +TEST_ARGS="-L${LIB_DIR} -L\$(libdir) $TEST_ARGS" +AC_SUBST(TEST_DEPS) +AC_SUBST(TEST_ARGS) + +PROG_ARGS="-L${LIB_DIR} -L\$(libdir) $PROG_ARGS" +AC_SUBST(PROG_ARGS) + +SRC_SUBDIRS="man include" +for cf_dir in $cf_cv_src_modules +do + SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir" +done +SRC_SUBDIRS="$SRC_SUBDIRS misc test" +test $cf_cxx_library != no && SRC_SUBDIRS="$SRC_SUBDIRS c++" + +ADA_SUBDIRS= +if test "$cf_cv_prog_gnat_correct" = yes && test -d $srcdir/Ada95; then + SRC_SUBDIRS="$SRC_SUBDIRS Ada95" + ADA_SUBDIRS="gen src samples" +fi + +SUB_MAKEFILES= +for cf_dir in $SRC_SUBDIRS +do + SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile" +done + +if test -n "$ADA_SUBDIRS"; then + for cf_dir in $ADA_SUBDIRS + do + SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile" + done + AC_SUBST(ADA_SUBDIRS) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Remove "-g" option from the compiler options +AC_DEFUN([CF_STRIP_G_OPT], +[$1=`echo ${$1} | sed -e 's/-g //' -e 's/-g$//'`])dnl +dnl --------------------------------------------------------------------------- +dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only +dnl do this if we've found the sigaction function. +dnl +dnl If needed, define SVR4_ACTION. +AC_DEFUN([CF_STRUCT_SIGACTION],[ +if test $ac_cv_func_sigaction = yes; then +AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE) +AC_TRY_COMPILE([ +#include <sys/types.h> +#include <signal.h>], + [struct sigaction act], + [sigact_bad=no], + [ +AC_TRY_COMPILE([ +#define _POSIX_SOURCE +#include <sys/types.h> +#include <signal.h>], + [struct sigaction act], + [sigact_bad=yes + AC_DEFINE(SVR4_ACTION)], + [sigact_bad=unknown])]) +AC_MSG_RESULT($sigact_bad) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Some machines require _POSIX_SOURCE to completely define struct termios. +dnl If so, define SVR4_TERMIO +AC_DEFUN([CF_STRUCT_TERMIOS],[ +if test $ac_cv_header_termios_h = yes ; then + case "$CFLAGS" in + *-D_POSIX_SOURCE*) + termios_bad=dunno ;; + *) termios_bad=maybe ;; + esac + if test $termios_bad = maybe ; then + AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE) + AC_TRY_COMPILE([#include <termios.h>], + [struct termios foo; int x = foo.c_iflag], + termios_bad=no, [ + AC_TRY_COMPILE([ +#define _POSIX_SOURCE +#include <termios.h>], + [struct termios foo; int x = foo.c_iflag], + termios_bad=unknown, + termios_bad=yes AC_DEFINE(SVR4_TERMIO)) + ]) + AC_MSG_RESULT($termios_bad) + fi +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Shorthand macro for substituting things that the user may override +dnl with an environment variable. +dnl +dnl $1 = long/descriptive name +dnl $2 = environment variable +dnl $3 = default value +AC_DEFUN([CF_SUBST], +[AC_CACHE_VAL(cf_cv_subst_$2,[ +AC_MSG_CHECKING(for $1 (symbol $2)) +test -z "[$]$2" && $2=$3 +AC_MSG_RESULT([$]$2) +AC_SUBST($2) +cf_cv_subst_$2=[$]$2]) +$2=${cf_cv_subst_$2} +])dnl +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 +cf_cv_abi_version=${NCURSES_MAJOR} +cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} +dnl Show the computed version, for logging +AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version (`date`)) +dnl We need these values in the generated headers +AC_SUBST(NCURSES_MAJOR) +AC_SUBST(NCURSES_MINOR) +AC_SUBST(NCURSES_PATCH) +dnl We need these values in the generated makefiles +AC_SUBST(cf_cv_rel_version) +AC_SUBST(cf_cv_abi_version) +AC_SUBST(cf_cv_cc_bool_type) +AC_SUBST(cf_cv_builtin_bool) +AC_SUBST(cf_cv_type_of_bool)dnl +])dnl +dnl --------------------------------------------------------------------------- +dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on +dnl older SCO configurations. +AC_DEFUN([CF_SYS_TIME_SELECT], +[ +AC_MSG_CHECKING(if sys/time.h works with sys/select.h) +AC_CACHE_VAL(cf_cv_sys_time_select,[ +AC_TRY_COMPILE([ +#include <sys/types.h> +#if HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +#if HAVE_SYS_SELECT_H +#include <sys/select.h> +#endif +],[],[cf_cv_sys_time_select=yes], + [cf_cv_sys_time_select=no]) + ]) +AC_MSG_RESULT($cf_cv_sys_time_select) +test $cf_cv_sys_time_select = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT) +])dnl +dnl --------------------------------------------------------------------------- +dnl Determine the type we should use for chtype (and attr_t, which is treated +dnl as the same thing). We want around 32 bits, so on most machines want a +dnl long, but on newer 64-bit machines, probably want an int. If we're using +dnl wide characters, we have to have a type compatible with that, as well. +AC_DEFUN([CF_TYPEOF_CHTYPE], +[ +AC_REQUIRE([CF_UNSIGNED_LITERALS]) +AC_MSG_CHECKING([for type of chtype]) +AC_CACHE_VAL(cf_cv_typeof_chtype,[ + AC_TRY_RUN([ +#if USE_WIDEC_SUPPORT +#include <stddef.h> /* we want wchar_t */ +#define WANT_BITS 39 +#else +#define WANT_BITS 31 +#endif +#include <stdio.h> +int main() +{ + FILE *fp = fopen("cf_test.out", "w"); + if (fp != 0) { + char *result = "long"; +#if USE_WIDEC_SUPPORT + /* + * If wchar_t is smaller than a long, it must be an int or a + * short. We prefer not to use a short anyway. + */ + if (sizeof(unsigned long) > sizeof(wchar_t)) + result = "int"; +#endif + if (sizeof(unsigned long) > sizeof(unsigned int)) { + int n; + unsigned int x; + for (n = 0; n < WANT_BITS; n++) { + unsigned int y = (x >> n); + if (y != 1 || x == 0) { + x = 0; + break; + } + } + /* + * If x is nonzero, an int is big enough for the bits + * that we want. + */ + result = (x != 0) ? "int" : "long"; + } + fputs(result, fp); + fclose(fp); + } + exit(0); +} + ], + [cf_cv_typeof_chtype=`cat cf_test.out`], + [cf_cv_typeof_chtype=long], + [cf_cv_typeof_chtype=long]) + rm -f cf_test.out + ]) +AC_MSG_RESULT($cf_cv_typeof_chtype) + +AC_SUBST(cf_cv_typeof_chtype) +AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype) + +cf_cv_1UL="1" +test "$cf_cv_unsigned_literals" = yes && cf_cv_1UL="${cf_cv_1UL}U" +test "$cf_cv_typeof_chtype" = long && cf_cv_1UL="${cf_cv_1UL}L" +AC_SUBST(cf_cv_1UL) + +])dnl +dnl --------------------------------------------------------------------------- +dnl +AC_DEFUN([CF_TYPE_SIGACTION], +[ +AC_MSG_CHECKING([for type sigaction_t]) +AC_CACHE_VAL(cf_cv_type_sigaction,[ + AC_TRY_COMPILE([ +#include <signal.h>], + [sigaction_t x], + [cf_cv_type_sigaction=yes], + [cf_cv_type_sigaction=no])]) +AC_MSG_RESULT($cf_cv_type_sigaction) +test $cf_cv_type_sigaction = yes && AC_DEFINE(HAVE_TYPE_SIGACTION) +])dnl +dnl --------------------------------------------------------------------------- +dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers +dnl won't, but they're still there. +AC_DEFUN([CF_UNSIGNED_LITERALS], +[ +AC_MSG_CHECKING([if unsigned literals are legal]) +AC_CACHE_VAL(cf_cv_unsigned_literals,[ + AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1], + [cf_cv_unsigned_literals=yes], + [cf_cv_unsigned_literals=no]) + ]) +AC_MSG_RESULT($cf_cv_unsigned_literals) +])dnl +dnl --------------------------------------------------------------------------- +dnl Make an uppercase version of a variable +dnl $1=uppercase($2) +AC_DEFUN([CF_UPPER], +[ +changequote(,)dnl +$1=`echo $2 | tr '[a-z]' '[A-Z]'` +changequote([,])dnl +])dnl +dnl --------------------------------------------------------------------------- +dnl Compute the shift-mask that we'll use for wide-character indices. We use +dnl all but the index portion of chtype for storing attributes. +AC_DEFUN([CF_WIDEC_SHIFT], +[ +AC_REQUIRE([CF_TYPEOF_CHTYPE]) +AC_MSG_CHECKING([for number of bits in chtype]) +AC_CACHE_VAL(cf_cv_shift_limit,[ + AC_TRY_RUN([ +#include <stdio.h> +int main() +{ + FILE *fp = fopen("cf_test.out", "w"); + if (fp != 0) { + int n; + unsigned TYPEOF_CHTYPE x = 1L; + for (n = 0; ; n++) { + unsigned long y = (x >> n); + if (y != 1 || x == 0) + break; + x <<= 1; + } + fprintf(fp, "%d", n); + fclose(fp); + } + exit(0); +} + ], + [cf_cv_shift_limit=`cat cf_test.out`], + [cf_cv_shift_limit=32], + [cf_cv_shift_limit=32]) + rm -f cf_test.out + ]) +AC_MSG_RESULT($cf_cv_shift_limit) +AC_SUBST(cf_cv_shift_limit) + +AC_MSG_CHECKING([for width of character-index]) +AC_CACHE_VAL(cf_cv_widec_shift,[ +if test ".$with_widec" = ".yes" ; then + cf_attrs_width=39 + if ( expr $cf_cv_shift_limit \> $cf_attrs_width >/dev/null ) + then + cf_cv_widec_shift=`expr 16 + $cf_cv_shift_limit - $cf_attrs_width` + else + cf_cv_widec_shift=16 + fi +else + cf_cv_widec_shift=8 +fi +]) +AC_MSG_RESULT($cf_cv_widec_shift) +AC_SUBST(cf_cv_widec_shift) +])dnl +dnl --------------------------------------------------------------------------- +dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just +dnl defaulting to yes/no. +dnl +dnl $1 = option name +dnl $2 = help-text +dnl $3 = environment variable to set +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_PATH], +[AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),, +ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl +CF_PATH_SYNTAX(withval) +eval $3="$withval" +AC_SUBST($3)dnl +])dnl +dnl --------------------------------------------------------------------------- +dnl Process an option specifying a list of colon-separated paths. +dnl +dnl $1 = option name +dnl $2 = help-text +dnl $3 = environment variable to set +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_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}:" +cf_dst_path= +for cf_src_path in $withval +do + CF_PATH_SYNTAX(cf_src_path) + test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:" + cf_dst_path="${cf_dst_path}${cf_src_path}" +done +IFS="$ac_save_ifs" + +eval $3="$cf_dst_path" +AC_SUBST($3)dnl +])dnl diff --git a/contrib/ncurses/announce.html b/contrib/ncurses/announce.html new file mode 100644 index 000000000000..aa05b002d32c --- /dev/null +++ b/contrib/ncurses/announce.html @@ -0,0 +1,387 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN"> +<!-- + $Id: announce.html,v 1.30 1999/05/16 17:01:39 juergen Exp $ +--> +<HTML> +<HEAD> +<TITLE>Announcing ncurses 5.0</TITLE> +<link rev=made href="mailto:bug-ncurses@gnu.org"> +</HEAD> +<BODY> + +<H1>Announcing ncurses 5.0</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, +supports pads and color +and multiple highlights and forms characters and function-key mapping, +and has all the other SYSV-curses enhancements over BSD curses.<P> + +In mid-June 1995, the maintainer of 4.4BSD curses declared that he +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 distribution includes the library and support utilities, including a +terminfo compiler tic(1), a decompiler infocmp(1), clear(1), tput(1), tset(1), +and a termcap conversion tool captoinfo(1). Full manual pages are provided for +the library and tools.<P> + +The ncurses distribution is available via anonymous FTP at +the GNU distribution site +<A HREF="ftp://ftp.gnu.org/pub/gnu">ftp://ftp.gnu.org/pub/gnu</A>. +It is also available at +<A HREF="ftp://ftp.clark.net/pub/dickey/ncurses">ftp://ftp.clark.net/pub/dickey/ncurses</A>. + +<H1>Release Notes</H1> + +We decided to release ncurses as a new whole number release (5.0) because it +incorporates several interface changes, including some that would invalidate +existing shared libraries. These are the highlights from the change-log +since ncurses 4.2 release. +<p> +Interface changes: +<ul> + <li>The principal source of changes to the interface comes from the + release of X/Open Curses in 1997. Earlier versions of ncurses (4.0 + and before) were based on a draft version of the specification. The + release version adds parameters to some functions to support the + evolving internationalization of curses. These summarize the impact: +<ul> + <li>modified several prototypes to correspond with 1997 version of + X/Open Curses (affects ABI since developers have used attr_get). + + <li>corrected prototypes for slk_* functions, using chtype rather than + attr_t. + + <li>the slk_attr_{set,off,on} functions need an additional void* + parameter according to XSI. + + <li>correct macros for wattr_set, wattr_get, separate wattrset macro from + these to preserve behavior that allows attributes to be combined with + color pair numbers. + + <li>reviewed/updated curses.h, term.h against X/Open Curses Issue 4 + Version 2. This includes making some parameters NCURSES_CONST + rather than const, e.g., in termcap.h. + + <li>reviewed/corrected macros in curses.h as per XSI document. + + <li>add set_a_attributes and set_pglen_inch to terminfo structure, as per + XSI and Solaris 2.5. +</ul> + <li>The newest version of the X/Open Curses is implemented on Solaris + and other vendor's systems. It adds new features to the terminfo + descriptions: +<ul> + <li>implement tparm %l format. + + <li>implement tparm printf-style width and precision for %s, %d, %x, %o + as per XSI. +</ul> + <li>We made additional changes to reduce impact by future interface + changes: +<ul> + <li>change key_names[] array to static since it is not part of the curses + interface. + + <li>move macro winch to a function, to hide details of struct ldat +</ul> + <li>modify configure script to embed ABI in shared libraries for HP-UX + 10.x (detailed request by Tim Mooney). + + <li>modify configuration of shared libraries on Digital Unix so that + versioning is embedded in the library, rather than implied by + links (patch by Tim Mooney). +</ul> +New features: +<ul> + <li>enable sigwinch handler by default. + + <li>turn on hashmap scrolling code by default + + <li>improved support for termcap applications +<ul> + <li>modify tput to accept termcap names as an alternative to terminfo + names. + + <li>provide support for termcap PC variable by copying it from terminfo + data and using it as the padding character in tputs. + + <li>provide support for termcap ospeed variable by copying it from the + internal cur_term member, and using ospeed as the baudrate + reference for the delay_output and tputs functions. + + <li>change name-comparisons in lib_termcap to compare no more than 2 + characters. + + <li>add configure option --enable-tcap-names, which essentially + allows users to define new capabilities as in termcap. +</ul> + <li>add mouse support to ncurses menus. + + <li>add mouse and dll support for OS/2 EMX + + <li>modify terminfo parsing to accept octal and hexadecimal constants + + <li>add configure option --enable-no-padding, to allow environment + variable $NCURSES_NO_PADDING to eliminate non-mandatory padding, + thereby making terminal emulators (e.g., for vt100) a little more + efficient. + + <li>modify lib_color.c to eliminate dependency on orig_colors and + orig_pair, since SVr4 curses does not require these either, but + uses them when they are available. + + <li>add -f option to infocmp and tic, which formats the terminfo + if/then/else/endif so that they are readable (with newlines and + tabs). + + <li>modify tic to compile into %'char' form in preference to %{number}, + since that is a little more efficient. +</ul> +Major bug fixes: +<ul> + <li>modify lib_tstp.c to block SIGTTOU when handling SIGTSTP, fixes a + problem where ncurses applications which were run via a shell script + would hang when given a ^Z. Also, check if the terminal's process + group is consistent, i.e., a shell has not taken ownership of it, + before deciding to save the current terminal settings in the SIGTSTP + handler. + + <li>suppress sc/rc capabilities from terminal description if they appear + in smcup/rmcup. This affects only scrolling optimization, to fix a + problem reported by several people with xterm's alternate screen, + though the problem is more general. + + <li>modify relative_move and tputs to avoid an interaction with the + BSD-style padding. The relative_move function could produce a string + to replace on the screen which began with a numeric character, which + was then interpreted by tputs as padding. + + <li>modify setupterm so that cancelled strings are treated the same as + absent strings, cancelled and absent booleans false (does not affect + tic, infocmp). + + <li>modify lib_vidattr.c to allow for terminal types (e.g., xterm-color) + which may reset all attributes in the 'op' capability, so that colors + are set before turning on bold and other attributes, but still after + turning attributes off. + + <li>use 'access()' to check if ncurses library should be permitted to + open or modify files with fopen/open/link/unlink/remove calls, in + case the calling application is running in setuid mode. + + <li>correction to doupdate, for case where terminal does not support + insert/delete character. The logic did not check that there was a + difference in alignment of changes to old/new screens before + repainting the whole non-blank portion of the line. Modified to fall + through into logic that reduces by the portion which does not differ. +</ul> + +<H1>Features of Ncurses</H1> + +The ncurses package is fully compatible with SVr4 (System V Release 4) curses:<P> + +<UL> +<LI>All 257 of the SVr4 calls have been implemented (and are documented). +<LI>Full support for SVr4 curses features including keyboard mapping, color, +forms-drawing with ACS characters, and automatic recognition of keypad +and function keys. +<LI>An emulation of the SVr4 panels library, supporting +a stack of windows with backing store, is included. +<LI>An emulation of the SVr4 menus library, supporting +a uniform but flexible interface for menu programming, is included. +<LI>An emulation of the SVr4 form library, supporting +data collection through on-screen forms, is included. +<LI>Binary terminfo entries generated by the ncurses tic(1) implementation +are bit-for-bit-compatible with the entry format SVr4 curses uses. +<LI>The utilities have options to allow you to filter terminfo +entries for use with less capable <STRONG>curses</STRONG>/<STRONG>terminfo</STRONG> +versions such as the HP/UX and AIX ports.</UL> + +The ncurses package also has many useful extensions over SVr4:<P> + +<UL> +<LI>The API is 8-bit clean and base-level conformant with the X/OPEN curses +specification, XSI curses (that is, it implements all BASE level features, +but not all EXTENDED features). Most EXTENDED-level features not directly +concerned with wide-character support are implemented, including many +function calls not supported under SVr4 curses (but portability of all +calls is documented so you can use the SVr4 subset only). +<LI>Unlike SVr4 curses, ncurses can write to the rightmost-bottommost corner +of the screen if your terminal has an insert-character capability. +<LI>Ada95 and C++ bindings. +<LI>Support for mouse event reporting with X Window xterm and OS/2 console windows. +<LI>Extended mouse support via Alessandro Rubini's gpm package. +<LI>The function <CODE>wresize()</CODE> allows you to resize windows, preserving +their data. +<LI>The function <CODE>use_default_colors()</CODE> allows you to +use the terminal's default colors for the default color pair, +achieving the effect of transparent colors. +<LI>The functions <CODE>keyok()</CODE> +and <CODE>define_key()</CODE> allow +you to better control the use of function keys, +e.g., disabling the ncurses KEY_MOUSE, +or by defining more than one control sequence to map to a given key code. +<LI>Support for 16-color terminals, such as aixterm and XFree86 xterm. +<LI>Better cursor-movement optimization. The package now features a +cursor-local-movement computation more efficient than either BSD's +or System V's. +<LI>Super hardware scrolling support. The screen-update code incorporates +a novel, simple, and cheap algorithm that enables it to make optimal +use of hardware scrolling, line-insertion, and line-deletion +for screen-line movements. This algorithm is more powerful than +the 4.4BSD curses quickch() routine. +<LI>Real support for terminals with the magic-cookie glitch. The +screen-update code will refrain from drawing a highlight if the magic- +cookie unattributed spaces required just before the beginning and +after the end would step on a non-space character. It will +automatically shift highlight boundaries when doing so would make it +possible to draw the highlight without changing the visual appearance +of the screen. +<LI>It is possible to generate the library with a list of pre-loaded +fallback entries linked to it so that it can serve those terminal types even +when no terminfo tree or termcap file is accessible (this may be useful +for support of screen-oriented programs that must run in single-user mode). +<LI>The tic(1)/captoinfo utility provided with ncurses has the +ability to translate many termcaps from the XENIX, IBM and +AT&T extension sets. +<LI>A BSD-like tset(1) utility is provided. +<LI>The ncurses library and utilities will automatically read terminfo +entries from $HOME/.terminfo if it exists, and compile to that directory +if it exists and the user has no write access to the system directory. +This feature makes it easier for users to have personal terminfo entries +without giving up access to the system terminfo directory. +<LI>You may specify a path of directories to search for compiled +descriptions with the environment variable TERMINFO_DIRS (this +generalizes the feature provided by TERMINFO under stock System V.) +<LI>In terminfo source files, use capabilities may refer not just to +other entries in the same source file (as in System V) but also to +compiled entries in either the system terminfo directory or the user's +$HOME/.terminfo directory. +<LI>A script (<STRONG>capconvert</STRONG>) is provided to help BSD users +transition from termcap to terminfo. It gathers the information in a +TERMCAP environment variable and/or a ~/.termcap local entries file +and converts it to an equivalent local terminfo tree under $HOME/.terminfo. +<LI>Automatic fallback to the /etc/termcap file can be compiled in +when it is not possible to build a terminfo tree. This feature is neither +fast nor cheap, you don't want to use it unless you have to, +but it's there. +<LI>The table-of-entries utility <STRONG>toe</STRONG> makes it easy for users to +see exactly what terminal types are available on the system. +<LI>The library 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 +<CODE>#undef</CODE>. +<LI>An HTML "Introduction to Programming with NCURSES" document provides +a narrative introduction to the curses programming interface. +</UL> + +<H1>State of the Package</H1> + +Numerous bugs present in earlier versions have been fixed; the +library is far more reliable than it used to be. Bounds checking in many +`dangerous' entry points has been improved. The code is now type-safe +according to gcc -Wall. The library has been checked for malloc leaks and +arena corruption by the Purify memory-allocation tester.<P> + +The ncurses code has been tested with a wide variety of applications +including (versions starting with those noted):<P> +<DL> +<DT> ded +<DD> directory-editor +<A HREF="ftp://ftp.clark.net/pub/dickey/ded">ftp://ftp.clark.net/pub/dickey/ded</A>. +<DT> dialog +<DD> the underlying application used in Slackware's setup, and the basis +for similar applications on GNU/Linux. +<DT> lynx-2.7 +<DD> the character-screen WWW browser +<DT> Midnight Commander 4.1 +<DD> file manager +<DT> mutt 0.88 +<DD> mail utility +<DT> ncftp 2.0 +<DD> file-transfer utility +<DT> nvi +<DD> New vi versions 1.50 are able to use ncurses versions 1.9.7 and later. +<DT> taper +<DD> tape archive utility +<DT> vh-1.6 +<DD> Volks-Hypertext browser for the Jargon File +</DL> +as well as some that use ncurses for the terminfo support alone: +<DL> +<DT> minicom-1.75 +<DD> terminal emulator +<DT> tin-unoff +<DD> tin 1.4 newsreader, supporting color, MIME +<A HREF="ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff">ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff</A>. +<DT> vile +<DD> vi-like-emacs +<A HREF="ftp://ftp.clark.net/pub/dickey/vile">ftp://ftp.clark.net/pub/dickey/vile</A>. +</DL> +<P> + +The ncurses distribution includes a selection of test programs (including +a few games). + +<H2>Who's Who and What's What</H2> + +The original developers of ncurses are <A +HREF="mailto:zmbenhal@netcom.com">Zeyd Ben-Halim</A> and +<A HREF="http://www.ccil.org/~esr/home.html">Eric S. Raymond</A>. +Ongoing work is being done by +<A HREF="mailto:dickey@clark.net">Thomas Dickey</A> +and +<A HREF="mailto:juergen.pfeifer@gmx.net">Jürgen Pfeifer</A>. +<A HREF="mailto:florian@gnu.org">Florian La Roche</A> +acts as the maintainer for the Free Software Foundation, which holds the +copyright on ncurses. +Contact the current maintainers at +<A HREF="mailto:bug-ncurses@gnu.org">bug-ncurses@gnu.org</A>. +<P> + +To join the ncurses mailing list, please write email to +<CODE>bug-ncurses-request@gnu.org</CODE> containing the line: +<PRE> + subscribe <name>@<host.domain> +</PRE> + +This list is open to anyone interested in helping with the development and +testing of this package.<P> + +Beta versions of ncurses and patches to the current release are made available at +<A HREF="ftp://ftp.clark.net/pub/dickey/ncurses">ftp://ftp.clark.net/pub/dickey/ncurses</A>. + +<H2>Future Plans</H2> +<UL> +<LI>Extended-level XPG4 conformance, with internationalization support. +<LI>Ports to more systems, including DOS and Windows. +</UL> +We need people to help with these projects. If you are interested in working +on them, please join the ncurses list. + +<H2>Other Related Resources</H2> + +The distribution includes and uses a version of the terminfo-format +terminal description file maintained by Eric Raymond. +<A HREF="http://earthspace.net/~esr/terminfo">http://earthspace.net/~esr/terminfo</A>.<P> + +You can find lots of information on terminal-related topics +not covered in the terminfo file at +<A HREF="http://www.cs.utk.edu/~shuford/terminal_index.html">Richard Shuford's +archive</A>. +</BODY> +</HTML> +<!-- +# The following sets edit modes for GNU EMACS +# Local Variables: +# mode:html +# case-fold-search:nil +# fill-column:70 +# End: +--> diff --git a/contrib/ncurses/announce.html.in b/contrib/ncurses/announce.html.in new file mode 100644 index 000000000000..ca3773fa4e01 --- /dev/null +++ b/contrib/ncurses/announce.html.in @@ -0,0 +1,387 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN"> +<!-- + $Id: announce.html.in,v 1.30 1999/05/16 17:01:39 juergen Exp $ +--> +<HTML> +<HEAD> +<TITLE>Announcing ncurses @VERSION@</TITLE> +<link rev=made href="mailto:bug-ncurses@gnu.org"> +</HEAD> +<BODY> + +<H1>Announcing ncurses @VERSION@</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, +supports pads and color +and multiple highlights and forms characters and function-key mapping, +and has all the other SYSV-curses enhancements over BSD curses.<P> + +In mid-June 1995, the maintainer of 4.4BSD curses declared that he +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 distribution includes the library and support utilities, including a +terminfo compiler tic(1), a decompiler infocmp(1), clear(1), tput(1), tset(1), +and a termcap conversion tool captoinfo(1). Full manual pages are provided for +the library and tools.<P> + +The ncurses distribution is available via anonymous FTP at +the GNU distribution site +<A HREF="ftp://ftp.gnu.org/pub/gnu">ftp://ftp.gnu.org/pub/gnu</A>. +It is also available at +<A HREF="ftp://ftp.clark.net/pub/dickey/ncurses">ftp://ftp.clark.net/pub/dickey/ncurses</A>. + +<H1>Release Notes</H1> + +We decided to release ncurses as a new whole number release (5.0) because it +incorporates several interface changes, including some that would invalidate +existing shared libraries. These are the highlights from the change-log +since ncurses 4.2 release. +<p> +Interface changes: +<ul> + <li>The principal source of changes to the interface comes from the + release of X/Open Curses in 1997. Earlier versions of ncurses (4.0 + and before) were based on a draft version of the specification. The + release version adds parameters to some functions to support the + evolving internationalization of curses. These summarize the impact: +<ul> + <li>modified several prototypes to correspond with 1997 version of + X/Open Curses (affects ABI since developers have used attr_get). + + <li>corrected prototypes for slk_* functions, using chtype rather than + attr_t. + + <li>the slk_attr_{set,off,on} functions need an additional void* + parameter according to XSI. + + <li>correct macros for wattr_set, wattr_get, separate wattrset macro from + these to preserve behavior that allows attributes to be combined with + color pair numbers. + + <li>reviewed/updated curses.h, term.h against X/Open Curses Issue 4 + Version 2. This includes making some parameters NCURSES_CONST + rather than const, e.g., in termcap.h. + + <li>reviewed/corrected macros in curses.h as per XSI document. + + <li>add set_a_attributes and set_pglen_inch to terminfo structure, as per + XSI and Solaris 2.5. +</ul> + <li>The newest version of the X/Open Curses is implemented on Solaris + and other vendor's systems. It adds new features to the terminfo + descriptions: +<ul> + <li>implement tparm %l format. + + <li>implement tparm printf-style width and precision for %s, %d, %x, %o + as per XSI. +</ul> + <li>We made additional changes to reduce impact by future interface + changes: +<ul> + <li>change key_names[] array to static since it is not part of the curses + interface. + + <li>move macro winch to a function, to hide details of struct ldat +</ul> + <li>modify configure script to embed ABI in shared libraries for HP-UX + 10.x (detailed request by Tim Mooney). + + <li>modify configuration of shared libraries on Digital Unix so that + versioning is embedded in the library, rather than implied by + links (patch by Tim Mooney). +</ul> +New features: +<ul> + <li>enable sigwinch handler by default. + + <li>turn on hashmap scrolling code by default + + <li>improved support for termcap applications +<ul> + <li>modify tput to accept termcap names as an alternative to terminfo + names. + + <li>provide support for termcap PC variable by copying it from terminfo + data and using it as the padding character in tputs. + + <li>provide support for termcap ospeed variable by copying it from the + internal cur_term member, and using ospeed as the baudrate + reference for the delay_output and tputs functions. + + <li>change name-comparisons in lib_termcap to compare no more than 2 + characters. + + <li>add configure option --enable-tcap-names, which essentially + allows users to define new capabilities as in termcap. +</ul> + <li>add mouse support to ncurses menus. + + <li>add mouse and dll support for OS/2 EMX + + <li>modify terminfo parsing to accept octal and hexadecimal constants + + <li>add configure option --enable-no-padding, to allow environment + variable $NCURSES_NO_PADDING to eliminate non-mandatory padding, + thereby making terminal emulators (e.g., for vt100) a little more + efficient. + + <li>modify lib_color.c to eliminate dependency on orig_colors and + orig_pair, since SVr4 curses does not require these either, but + uses them when they are available. + + <li>add -f option to infocmp and tic, which formats the terminfo + if/then/else/endif so that they are readable (with newlines and + tabs). + + <li>modify tic to compile into %'char' form in preference to %{number}, + since that is a little more efficient. +</ul> +Major bug fixes: +<ul> + <li>modify lib_tstp.c to block SIGTTOU when handling SIGTSTP, fixes a + problem where ncurses applications which were run via a shell script + would hang when given a ^Z. Also, check if the terminal's process + group is consistent, i.e., a shell has not taken ownership of it, + before deciding to save the current terminal settings in the SIGTSTP + handler. + + <li>suppress sc/rc capabilities from terminal description if they appear + in smcup/rmcup. This affects only scrolling optimization, to fix a + problem reported by several people with xterm's alternate screen, + though the problem is more general. + + <li>modify relative_move and tputs to avoid an interaction with the + BSD-style padding. The relative_move function could produce a string + to replace on the screen which began with a numeric character, which + was then interpreted by tputs as padding. + + <li>modify setupterm so that cancelled strings are treated the same as + absent strings, cancelled and absent booleans false (does not affect + tic, infocmp). + + <li>modify lib_vidattr.c to allow for terminal types (e.g., xterm-color) + which may reset all attributes in the 'op' capability, so that colors + are set before turning on bold and other attributes, but still after + turning attributes off. + + <li>use 'access()' to check if ncurses library should be permitted to + open or modify files with fopen/open/link/unlink/remove calls, in + case the calling application is running in setuid mode. + + <li>correction to doupdate, for case where terminal does not support + insert/delete character. The logic did not check that there was a + difference in alignment of changes to old/new screens before + repainting the whole non-blank portion of the line. Modified to fall + through into logic that reduces by the portion which does not differ. +</ul> + +<H1>Features of Ncurses</H1> + +The ncurses package is fully compatible with SVr4 (System V Release 4) curses:<P> + +<UL> +<LI>All 257 of the SVr4 calls have been implemented (and are documented). +<LI>Full support for SVr4 curses features including keyboard mapping, color, +forms-drawing with ACS characters, and automatic recognition of keypad +and function keys. +<LI>An emulation of the SVr4 panels library, supporting +a stack of windows with backing store, is included. +<LI>An emulation of the SVr4 menus library, supporting +a uniform but flexible interface for menu programming, is included. +<LI>An emulation of the SVr4 form library, supporting +data collection through on-screen forms, is included. +<LI>Binary terminfo entries generated by the ncurses tic(1) implementation +are bit-for-bit-compatible with the entry format SVr4 curses uses. +<LI>The utilities have options to allow you to filter terminfo +entries for use with less capable <STRONG>curses</STRONG>/<STRONG>terminfo</STRONG> +versions such as the HP/UX and AIX ports.</UL> + +The ncurses package also has many useful extensions over SVr4:<P> + +<UL> +<LI>The API is 8-bit clean and base-level conformant with the X/OPEN curses +specification, XSI curses (that is, it implements all BASE level features, +but not all EXTENDED features). Most EXTENDED-level features not directly +concerned with wide-character support are implemented, including many +function calls not supported under SVr4 curses (but portability of all +calls is documented so you can use the SVr4 subset only). +<LI>Unlike SVr4 curses, ncurses can write to the rightmost-bottommost corner +of the screen if your terminal has an insert-character capability. +<LI>Ada95 and C++ bindings. +<LI>Support for mouse event reporting with X Window xterm and OS/2 console windows. +<LI>Extended mouse support via Alessandro Rubini's gpm package. +<LI>The function <CODE>wresize()</CODE> allows you to resize windows, preserving +their data. +<LI>The function <CODE>use_default_colors()</CODE> allows you to +use the terminal's default colors for the default color pair, +achieving the effect of transparent colors. +<LI>The functions <CODE>keyok()</CODE> +and <CODE>define_key()</CODE> allow +you to better control the use of function keys, +e.g., disabling the ncurses KEY_MOUSE, +or by defining more than one control sequence to map to a given key code. +<LI>Support for 16-color terminals, such as aixterm and XFree86 xterm. +<LI>Better cursor-movement optimization. The package now features a +cursor-local-movement computation more efficient than either BSD's +or System V's. +<LI>Super hardware scrolling support. The screen-update code incorporates +a novel, simple, and cheap algorithm that enables it to make optimal +use of hardware scrolling, line-insertion, and line-deletion +for screen-line movements. This algorithm is more powerful than +the 4.4BSD curses quickch() routine. +<LI>Real support for terminals with the magic-cookie glitch. The +screen-update code will refrain from drawing a highlight if the magic- +cookie unattributed spaces required just before the beginning and +after the end would step on a non-space character. It will +automatically shift highlight boundaries when doing so would make it +possible to draw the highlight without changing the visual appearance +of the screen. +<LI>It is possible to generate the library with a list of pre-loaded +fallback entries linked to it so that it can serve those terminal types even +when no terminfo tree or termcap file is accessible (this may be useful +for support of screen-oriented programs that must run in single-user mode). +<LI>The tic(1)/captoinfo utility provided with ncurses has the +ability to translate many termcaps from the XENIX, IBM and +AT&T extension sets. +<LI>A BSD-like tset(1) utility is provided. +<LI>The ncurses library and utilities will automatically read terminfo +entries from $HOME/.terminfo if it exists, and compile to that directory +if it exists and the user has no write access to the system directory. +This feature makes it easier for users to have personal terminfo entries +without giving up access to the system terminfo directory. +<LI>You may specify a path of directories to search for compiled +descriptions with the environment variable TERMINFO_DIRS (this +generalizes the feature provided by TERMINFO under stock System V.) +<LI>In terminfo source files, use capabilities may refer not just to +other entries in the same source file (as in System V) but also to +compiled entries in either the system terminfo directory or the user's +$HOME/.terminfo directory. +<LI>A script (<STRONG>capconvert</STRONG>) is provided to help BSD users +transition from termcap to terminfo. It gathers the information in a +TERMCAP environment variable and/or a ~/.termcap local entries file +and converts it to an equivalent local terminfo tree under $HOME/.terminfo. +<LI>Automatic fallback to the /etc/termcap file can be compiled in +when it is not possible to build a terminfo tree. This feature is neither +fast nor cheap, you don't want to use it unless you have to, +but it's there. +<LI>The table-of-entries utility <STRONG>toe</STRONG> makes it easy for users to +see exactly what terminal types are available on the system. +<LI>The library 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 +<CODE>#undef</CODE>. +<LI>An HTML "Introduction to Programming with NCURSES" document provides +a narrative introduction to the curses programming interface. +</UL> + +<H1>State of the Package</H1> + +Numerous bugs present in earlier versions have been fixed; the +library is far more reliable than it used to be. Bounds checking in many +`dangerous' entry points has been improved. The code is now type-safe +according to gcc -Wall. The library has been checked for malloc leaks and +arena corruption by the Purify memory-allocation tester.<P> + +The ncurses code has been tested with a wide variety of applications +including (versions starting with those noted):<P> +<DL> +<DT> ded +<DD> directory-editor +<A HREF="ftp://ftp.clark.net/pub/dickey/ded">ftp://ftp.clark.net/pub/dickey/ded</A>. +<DT> dialog +<DD> the underlying application used in Slackware's setup, and the basis +for similar applications on GNU/Linux. +<DT> lynx-2.7 +<DD> the character-screen WWW browser +<DT> Midnight Commander 4.1 +<DD> file manager +<DT> mutt 0.88 +<DD> mail utility +<DT> ncftp 2.0 +<DD> file-transfer utility +<DT> nvi +<DD> New vi versions 1.50 are able to use ncurses versions 1.9.7 and later. +<DT> taper +<DD> tape archive utility +<DT> vh-1.6 +<DD> Volks-Hypertext browser for the Jargon File +</DL> +as well as some that use ncurses for the terminfo support alone: +<DL> +<DT> minicom-1.75 +<DD> terminal emulator +<DT> tin-unoff +<DD> tin 1.4 newsreader, supporting color, MIME +<A HREF="ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff">ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff</A>. +<DT> vile +<DD> vi-like-emacs +<A HREF="ftp://ftp.clark.net/pub/dickey/vile">ftp://ftp.clark.net/pub/dickey/vile</A>. +</DL> +<P> + +The ncurses distribution includes a selection of test programs (including +a few games). + +<H2>Who's Who and What's What</H2> + +The original developers of ncurses are <A +HREF="mailto:zmbenhal@netcom.com">Zeyd Ben-Halim</A> and +<A HREF="http://www.ccil.org/~esr/home.html">Eric S. Raymond</A>. +Ongoing work is being done by +<A HREF="mailto:dickey@clark.net">Thomas Dickey</A> +and +<A HREF="mailto:juergen.pfeifer@gmx.net">Jürgen Pfeifer</A>. +<A HREF="mailto:florian@gnu.org">Florian La Roche</A> +acts as the maintainer for the Free Software Foundation, which holds the +copyright on ncurses. +Contact the current maintainers at +<A HREF="mailto:bug-ncurses@gnu.org">bug-ncurses@gnu.org</A>. +<P> + +To join the ncurses mailing list, please write email to +<CODE>bug-ncurses-request@gnu.org</CODE> containing the line: +<PRE> + subscribe <name>@<host.domain> +</PRE> + +This list is open to anyone interested in helping with the development and +testing of this package.<P> + +Beta versions of ncurses and patches to the current release are made available at +<A HREF="ftp://ftp.clark.net/pub/dickey/ncurses">ftp://ftp.clark.net/pub/dickey/ncurses</A>. + +<H2>Future Plans</H2> +<UL> +<LI>Extended-level XPG4 conformance, with internationalization support. +<LI>Ports to more systems, including DOS and Windows. +</UL> +We need people to help with these projects. If you are interested in working +on them, please join the ncurses list. + +<H2>Other Related Resources</H2> + +The distribution includes and uses a version of the terminfo-format +terminal description file maintained by Eric Raymond. +<A HREF="http://earthspace.net/~esr/terminfo">http://earthspace.net/~esr/terminfo</A>.<P> + +You can find lots of information on terminal-related topics +not covered in the terminfo file at +<A HREF="http://www.cs.utk.edu/~shuford/terminal_index.html">Richard Shuford's +archive</A>. +</BODY> +</HTML> +<!-- +# The following sets edit modes for GNU EMACS +# Local Variables: +# mode:html +# case-fold-search:nil +# fill-column:70 +# End: +--> diff --git a/contrib/ncurses/c++/Makefile.in b/contrib/ncurses/c++/Makefile.in new file mode 100644 index 000000000000..38c5bd864323 --- /dev/null +++ b/contrib/ncurses/c++/Makefile.in @@ -0,0 +1,185 @@ +# $Id: Makefile.in,v 1.48 1999/07/31 09:47:11 juergen Exp $ +############################################################################## +# Copyright (c) 1998 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 +# +# Simple makefile for c++ window class demo + +# turn off _all_ suffix rules; we'll generate our own +.SUFFIXES: + +SHELL = /bin/sh + +MODEL = ../@DFT_OBJ_SUBDIR@ +INSTALL_PREFIX = @INSTALL_PREFIX@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +AR = @AR@ +AR_OPTS = @AR_OPTS@ +RANLIB = @RANLIB@ + +CXX = @CXX@ +CXXFLAGS = @CXXFLAGS@ +CXXLIBS = @CXXLIBS@ + +INCDIR = ../include +CPPFLAGS = -I../c++ -I$(INCDIR) -I$(srcdir) -DHAVE_CONFIG_H @CPPFLAGS@ + +CCFLAGS = $(CPPFLAGS) $(CXXFLAGS) + +CFLAGS_NORMAL = $(CCFLAGS) +CFLAGS_DEBUG = $(CCFLAGS) @CXX_G_OPT@ -DTRACE +CFLAGS_PROFILE = $(CCFLAGS) -pg +CFLAGS_SHARED = $(CCFLAGS) # @CC_SHARED_OPTS@ + +CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) + +REL_VERSION = @cf_cv_rel_version@ +ABI_VERSION = @cf_cv_abi_version@ + +LINK = @LINK_PROGS@ $(CXX) + +LIBROOT = ncurses++ +LIBNAME = lib$(LIBROOT).a + +LDFLAGS = @EXTRA_LDFLAGS@ -L../lib -L$(libdir) \ + -l$(LIBROOT) \ + @TEST_ARGS@ @LDFLAGS@ \ + @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ @LOCAL_LDFLAGS@ $(CXXLIBS) + +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@) + +AUTO_SRC = \ + etip.h + +all: $(AUTO_SRC) ../lib/$(LIBNAME) demo + +sources : $(AUTO_SRC) + +# Build a conventional library for installing, since a shared library would +# pull in all of the ncurses libraries (panel, menu, form, ncurses) as direct +# dependencies. +LIB_OBJS = \ + $(MODEL)/cursesf.o \ + $(MODEL)/cursesm.o \ + $(MODEL)/cursesw.o \ + $(MODEL)/cursespad.o \ + $(MODEL)/cursesp.o \ + $(MODEL)/cursslk.o \ + $(MODEL)/cursesapp.o \ + $(MODEL)/cursesmain.o + +../lib/$(LIBNAME) : $(LIB_OBJS) + $(AR) $(AR_OPTS) $@ $? + $(RANLIB) $@ + +OBJS_DEMO = $(MODEL)/demo.o + +$(MODEL)/demo.o : $(srcdir)/demo.cc \ + $(cursesf_h) $(cursesm_h) $(cursesapp_h) + +demo: $(OBJS_DEMO) \ + ../lib/$(LIBNAME) \ + @TEST_DEPS@ + @ECHO_LINK@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS_DEFAULT) + +etip.h: $(srcdir)/etip.h.in $(srcdir)/edit_cfg.sh + cp $(srcdir)/etip.h.in $@ + sh $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@ + +$(INSTALL_PREFIX)$(libdir) : + $(srcdir)/../mkinstalldirs $@ + +install \ +install.libs:: ../lib/$(LIBNAME) $(INSTALL_PREFIX)$(libdir) + $(INSTALL) ../lib/$(LIBNAME) $(INSTALL_PREFIX)$(libdir)/$(LIBNAME) + +uninstall \ +uninstall.libs:: + -rm -f $(INSTALL_PREFIX)$(libdir)/$(LIBNAME) + +mostlyclean :: + -rm -f core tags TAGS *~ *.ln *.atac trace + +clean :: mostlyclean + -rm -f demo $(AUTO_SRC) ../lib/$(LIBNAME) $(LIB_OBJS) $(OBJS_DEMO) + +distclean :: clean + -rm -f Makefile + +realclean :: distclean + +############################################################################### + +cursesw_h = $(srcdir)/cursesw.h \ + etip.h \ + $(INCDIR)/curses.h + +cursesp_h = $(srcdir)/cursesp.h \ + $(cursesw_h) \ + $(INCDIR)/panel.h + +cursesf_h = $(srcdir)/cursesf.h \ + $(cursesp_h) \ + $(INCDIR)/form.h + +cursesm_h = $(srcdir)/cursesm.h \ + $(cursesp_h) \ + $(INCDIR)/menu.h + +cursslk_h = $(srcdir)/cursslk.h \ + $(cursesw_h) + +cursesapp_h = $(srcdir)/cursesapp.h \ + $(cursslk_h) + +$(INCDIR)/form.h : + cd ../form && $(MAKE) $@ + +$(INCDIR)/menu.h : + cd ../menu && $(MAKE) $@ + +$(INCDIR)/panel.h : + cd ../panel && $(MAKE) $@ + +############################################################################### +# The remainder of this file is automatically generated during configuration +############################################################################### diff --git a/contrib/ncurses/c++/NEWS b/contrib/ncurses/c++/NEWS new file mode 100644 index 000000000000..299292d18a7e --- /dev/null +++ b/contrib/ncurses/c++/NEWS @@ -0,0 +1,42 @@ +This is a log of changes that the ncurses C++ binding has gone +through starting with the integration of menu and forms integration +into the binding. + +990731 + Improve support for pads. A viewport window may now be added to + a pad. It will then be possible to use a builtin panning mechanism + to view the pad. + +970908 + Improve NCursesWindow class: added additional methods to + cover more ncurses functionality. Make refresh() and + noutrefresh() virtual members to allow different implementation + in the NCursesPanel class. + + CAUTION: changed order of parameters in vline() and hline() of + NCursesWindow class. + + Make refresh() in NCursesPanel non-static, it is now a + reimplementation of refresh() in the base class. Added + noutrefresh() to NCursesPanel. + + Added NCursesForm and related classes to support libform + functionality. + + Moved most of configuration related stuff from cursesw.h to + etip.h + + Added NCursesApplication class to support easy configuration + of menu and forms related attributes as well as ripped of + title lines and Soft-Label-Keys for an application. + + Support of Auto-Cleanup for a menus fieldlist. + + Change of return type for current_item() and operator[] for + menus. + + Enhanced demo. +970502 + + Introduced the THROW and THROWS functions/macros to prepare + a smoother transition to real exception handling. + + Exception classes provided in etip.h + + Added the NCursesMenu class to support libmenu functionality. + + The inheritace relation between NCursesWindow and NCursesColorWindow + was kind of brain damage. Monochrome is a special case of colored, so + the relation should be just the opposite. This would allow all + derived classes like NCursesPanel, NCursesMenu or NCursesForm to + have colors. + To resolve that design flaw I put the color functionality into the + NCursesWindow class and it can be switched on by the static member + useColors(). NCursesColorWindow is still there for compatibility + reasons. diff --git a/contrib/ncurses/c++/PROBLEMS b/contrib/ncurses/c++/PROBLEMS new file mode 100644 index 000000000000..81c1ebaf8946 --- /dev/null +++ b/contrib/ncurses/c++/PROBLEMS @@ -0,0 +1,5 @@ +This is a list of open problems. This mainly lists known missing pieces +and design flaws. + +1. Testing!!! +2. Better demo program diff --git a/contrib/ncurses/c++/README-first b/contrib/ncurses/c++/README-first new file mode 100644 index 000000000000..eb37ac670247 --- /dev/null +++ b/contrib/ncurses/c++/README-first @@ -0,0 +1,58 @@ + C++ interface to ncurses routines +----------------------------------------------------------------------- + +This directory contains the source code for several C++ classes which +ease the use of writing ncurses-based programs. The code is derived +from the libg++ CursesWindow class but enhanced for ncurses. + +The classes simplify the use of window specific functions by +encapsulating them in the window object. Function overloading is +used in order to narrow the interface. E.g. you don't have the +distinction between `printw' and `mvprintw' anymore. + +A second benefit is the removal of all #defines which are included in +the curses.h file. This is a steady cause of trouble because many +common identifiers are used. Instead now all #defines are inline +functions which also allows strict type checking of arguments. + +The next enhancement is color support. It was originally provided by a +derived class. This caused some trouble if you think about Panels or +Menus and Forms with colors. We decided to put color support into the +base class so that any derived class may use color support also. +The implementation chosen here is directed to unrestricted use +of mixes of color and monochrome windows. The original NCursesColorWindow +class is maintained for compatibility reasons. + +The last point to mention is the support of other packages that are +distributed with the ncurses package: the panels library, the menu library +and the form library. This support is provided by the NCursesPanel class, +which is also derived from the NCursesWindow class and the NCursesMenu +and NCursesForm classes which are derived from NCursesPanel. This allows +building interfaces with windows. + +Please see the example program for a quick introduction. + +Note that at this point, there is no documentation for these classes. +Hopefully some will be written in the not too distant future. For now, +to find out how to use the classes, read the code and the example program. + +Suggestions for enhancements and contributions of code (and docs) are +welcome. Please let us know which functionality you miss. + + ATTENTION LINUX USERS: There is currently some discussion of + replacing the BSD curses in the Linux libc with ncurses. If + this is done we could perhaps include these classes in the Linux + libg++ replacing the original CursesWindow class (and renaming it + to CursesWindow). This could be done because NCursesWindow can + be made easily to a superset of the CursesWindow class. + + +Original author: + Eric Newton <newton@rocky.oswego.edu> for FSF's libg++ + +Authors of first ncurses based release (NCursesWindow, NCursesPanel): + Ulrich Drepper <drepper@ira.uka.de> + and Anatoly Ivasyuk <anatoly@nick.csh.rit.edu> + +Author of this release: + Juergen Pfeifer <juergen.pfeifer@gmx.net> diff --git a/contrib/ncurses/c++/cursesapp.cc b/contrib/ncurses/c++/cursesapp.cc new file mode 100644 index 000000000000..ae88b44e0a4c --- /dev/null +++ b/contrib/ncurses/c++/cursesapp.cc @@ -0,0 +1,146 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * + ****************************************************************************/ + +#include "cursesapp.h" +#include "internal.h" + +MODULE_ID("$Id: cursesapp.cc,v 1.4 1999/05/16 17:31:11 juergen Exp $") + +void +NCursesApplication::init(bool bColors) { + if (bColors) + NCursesWindow::useColors(); + + if (Root_Window->colors() > 1) { + b_Colors = TRUE; + Root_Window->setcolor(1); + Root_Window->setpalette(COLOR_YELLOW,COLOR_BLUE); + Root_Window->setcolor(2); + Root_Window->setpalette(COLOR_CYAN,COLOR_BLUE); + Root_Window->setcolor(3); + Root_Window->setpalette(COLOR_BLACK,COLOR_BLUE); + Root_Window->setcolor(4); + Root_Window->setpalette(COLOR_BLACK,COLOR_CYAN); + Root_Window->setcolor(5); + Root_Window->setpalette(COLOR_BLUE,COLOR_YELLOW); + Root_Window->setcolor(6); + Root_Window->setpalette(COLOR_BLACK,COLOR_GREEN); + } + else + b_Colors = FALSE; + + Root_Window->bkgd(' '|window_backgrounds()); +} + +NCursesApplication* NCursesApplication::theApp = 0; +NCursesWindow* NCursesApplication::titleWindow = 0; +NCursesApplication::SLK_Link* NCursesApplication::slk_stack = 0; + +NCursesApplication::~NCursesApplication() { + Soft_Label_Key_Set* S; + + delete titleWindow; + while( (S=top()) ) { + pop(); + delete S; + } + delete Root_Window; + ::endwin(); +} + +int NCursesApplication::rinit(NCursesWindow& w) { + titleWindow = &w; + return OK; +} + +void NCursesApplication::push(Soft_Label_Key_Set& S) { + SLK_Link* L = new SLK_Link; + assert(L); + L->prev = slk_stack; + L->SLKs = &S; + slk_stack = L; + if (Root_Window) + S.show(); +} + +bool NCursesApplication::pop() { + if (slk_stack) { + SLK_Link* L = slk_stack; + slk_stack = slk_stack->prev; + delete L; + if (Root_Window && top()) + top()->show(); + } + return (slk_stack ? FALSE : TRUE); +} + +Soft_Label_Key_Set* NCursesApplication::top() const { + if (slk_stack) + return slk_stack->SLKs; + else + return (Soft_Label_Key_Set*)0; +} + +int NCursesApplication::operator()(void) { + bool bColors = b_Colors; + Soft_Label_Key_Set* S; + + int ts = titlesize(); + if (ts>0) + NCursesWindow::ripoffline(ts,rinit); + Soft_Label_Key_Set::Label_Layout fmt = useSLKs(); + if (fmt!=Soft_Label_Key_Set::None) { + S = new Soft_Label_Key_Set(fmt); + assert(S); + init_labels(*S); + } + + Root_Window = new NCursesWindow(::stdscr); + init(bColors); + + if (ts>0) + title(); + if (fmt!=Soft_Label_Key_Set::None) { + push(*S); + } + + return run(); +} + +NCursesApplication::NCursesApplication(bool bColors) { + b_Colors = bColors; + if (theApp) + THROW(new NCursesException("Application object already created.")); + else + theApp = this; +} diff --git a/contrib/ncurses/c++/cursesapp.h b/contrib/ncurses/c++/cursesapp.h new file mode 100644 index 000000000000..f13fd1bdb457 --- /dev/null +++ b/contrib/ncurses/c++/cursesapp.h @@ -0,0 +1,163 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * + ****************************************************************************/ + +// $Id: cursesapp.h,v 1.5 1999/05/16 17:29:59 juergen Exp $ + +#ifndef _CURSESAPP_H +#define _CURSESAPP_H + +#include <cursslk.h> + +class NCursesApplication { +public: + typedef struct _slk_link { // This structure is used to maintain + struct _slk_link* prev; // a stack of SLKs + Soft_Label_Key_Set* SLKs; + } SLK_Link; +private: + static int rinit(NCursesWindow& w); // Internal Init function for title + static NCursesApplication* theApp; // Global ref. to the application + + static SLK_Link* slk_stack; + +protected: + static NCursesWindow* titleWindow; // The Title Window (if any) + + bool b_Colors; // Is this a color application? + NCursesWindow* Root_Window; // This is the stdscr equiv. + + // Initialization of attributes; + // Rewrite this in your derived class if you prefer other settings + virtual void init(bool bColors); + + // The number of lines for the title window. Default is no title window + // You may rewrite this in your derived class + virtual int titlesize() const { + return 0; + } + + // This method is called to put something into the title window initially + // You may rewrite this in your derived class + virtual void title() { + } + + // The layout used for the Soft Label Keys. Default is to have no SLKs. + // You may rewrite this in your derived class + virtual Soft_Label_Key_Set::Label_Layout useSLKs() const { + return Soft_Label_Key_Set::None; + } + + // This method is called to initialize the SLKs. Default is nothing. + // You may rewrite this in your derived class + virtual void init_labels(Soft_Label_Key_Set& S) const { + } + + // Your derived class must implement this method. The return value must + // be the exit value of your application. + virtual int run() = 0; + + + // The constructor is protected, so you may use it in your derived + // class constructor. The argument tells whether or not you want colors. + NCursesApplication(bool wantColors = FALSE); + +public: + virtual ~NCursesApplication(); + + // Get a pointer to the current application object + static NCursesApplication* getApplication() { + return theApp; + } + + // This method runs the application and returns its exit value + int operator()(void); + + // Process the commandline arguments. The default implementation simply + // ignores them. Your derived class may rewrite this. + virtual void handleArgs(int argc, char* argv[]) { + } + + // Does this application use colors? + inline bool useColors() const { + return b_Colors; + } + + // Push the Key Set S onto the SLK Stack. S then becomes the current set + // of Soft Labelled Keys. + void push(Soft_Label_Key_Set& S); + + // Throw away the current set of SLKs and make the previous one the + // new current set. + bool pop(); + + // Retrieve the current set of Soft Labelled Keys. + Soft_Label_Key_Set* top() const; + + // Attributes to use for menu and forms foregrounds + virtual chtype foregrounds() const { + return b_Colors ? COLOR_PAIR(1) : A_BOLD; + } + + // Attributes to use for menu and forms backgrounds + virtual chtype backgrounds() const { + return b_Colors ? COLOR_PAIR(2) : A_NORMAL; + } + + // Attributes to use for inactive (menu) elements + virtual chtype inactives() const { + return b_Colors ? (COLOR_PAIR(3)|A_DIM) : A_DIM; + } + + // Attributes to use for (form) labels and SLKs + virtual chtype labels() const { + return b_Colors ? COLOR_PAIR(4) : A_NORMAL; + } + + // Attributes to use for form backgrounds + virtual chtype dialog_backgrounds() const { + return b_Colors ? COLOR_PAIR(4) : A_NORMAL; + } + + // Attributes to use as default for (form) window backgrounds + virtual chtype window_backgrounds() const { + return b_Colors ? COLOR_PAIR(5) : A_NORMAL; + } + + // Attributes to use for the title window + virtual chtype screen_titles() const { + return b_Colors ? COLOR_PAIR(6) : A_BOLD; + } + +}; + +#endif // _CURSESAPP_H diff --git a/contrib/ncurses/c++/cursesf.cc b/contrib/ncurses/c++/cursesf.cc new file mode 100644 index 000000000000..12b9cd4fcce2 --- /dev/null +++ b/contrib/ncurses/c++/cursesf.cc @@ -0,0 +1,423 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * + ****************************************************************************/ + +#include "cursesf.h" +#include "cursesapp.h" +#include "internal.h" + +MODULE_ID("$Id: cursesf.cc,v 1.9 1999/05/16 17:29:36 juergen Exp $") + +NCursesFormField::~NCursesFormField () { + if (field) + OnError(::free_field (field)); +} + +/* Construct a FIELD* array from an array of NCursesFormField + * objects. + */ +FIELD** +NCursesForm::mapFields(NCursesFormField* nfields[]) { + int fieldCount = 0,lcv; + + assert(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) + delete[] ::form_fields(form); + return fields; +} + +void NCursesForm::setDefaultAttributes() { + NCursesApplication* S = NCursesApplication::getApplication(); + + int n = count(); + if (n > 0) { + for(int i=0; i<n; i++) { + NCursesFormField* f = (*this)[i]; + if ((f->options() & (O_EDIT|O_ACTIVE))==(O_EDIT|O_ACTIVE)) { + if (S) { + f->set_foreground(S->foregrounds()); + f->set_background(S->backgrounds()); + } + f->set_pad_character('_'); + } + else { + if (S) + f->set_background(S->labels()); + } + } + } + + if (S) { + bkgd(' '|S->dialog_backgrounds()); + if (sub) + sub->bkgd(' '|S->dialog_backgrounds()); + } +} + +void +NCursesForm::InitForm(NCursesFormField* nfields[], + bool with_frame, + bool autoDelete_Fields) { + int mrows, mcols; + + keypad(TRUE); + meta(TRUE); + + b_framed = with_frame; + b_autoDelete = autoDelete_Fields; + + form = (FORM*)0; + 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); + sub = new NCursesWindow(*this,mrows,mcols,1,1,'r'); + ::set_form_sub(form, sub->w); + b_sub_owner = TRUE; + } + else { + sub = (NCursesWindow*)0; + b_sub_owner = FALSE; + } + options_on(O_NL_OVERLOAD); + setDefaultAttributes(); +} + +NCursesForm::~NCursesForm() { + UserHook* hook = (UserHook*)::form_userptr(form); + delete hook; + if (b_sub_owner) { + delete sub; + ::set_form_sub(form,(WINDOW *)0); + } + if (form) { + FIELD** fields = ::form_fields(form); + int cnt = count(); + + OnError(::set_form_fields(form,(FIELD**)0)); + + if (b_autoDelete) { + if (cnt>0) { + for (int i=0; i <= cnt; i++) + delete my_fields[i]; + } + delete[] my_fields; + } + + ::free_form(form); + // It's essential to do this after free_form() + delete[] fields; + } +} + +void +NCursesForm::setSubWindow(NCursesWindow& nsub) { + if (!isDescendant(nsub)) + OnError(E_SYSTEM_ERROR); + else { + if (b_sub_owner) + delete sub; + sub = ⊄ + ::set_form_sub(form,sub->w); + } +} + +/* 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 + * implementing a virtual method in a derived class + */ +void +NCursesForm::frm_init(FORM *f) { + getHook(f)->On_Form_Init(); +} + +void +NCursesForm::frm_term(FORM *f) { + getHook(f)->On_Form_Termination(); +} + +void +NCursesForm::fld_init(FORM *f) { + NCursesForm* F = getHook(f); + F->On_Field_Init (*(F->current_field ())); +} + +void +NCursesForm::fld_term(FORM *f) { + NCursesForm* F = getHook(f); + F->On_Field_Termination (*(F->current_field ())); +} + +void +NCursesForm::On_Form_Init() { +} + +void +NCursesForm::On_Form_Termination() { +} + +void +NCursesForm::On_Field_Init(NCursesFormField& field) { +} + +void +NCursesForm::On_Field_Termination(NCursesFormField& field) { +} + +// call the form driver and do basic error checking. +int +NCursesForm::driver (int c) { + int res = ::form_driver (form, c); + switch (res) { + case E_OK: + case E_REQUEST_DENIED: + case E_INVALID_FIELD: + case E_UNKNOWN_COMMAND: + break; + default: + OnError (res); + } + return (res); +} + +void NCursesForm::On_Request_Denied(int c) const { + beep(); +} + +void NCursesForm::On_Invalid_Field(int c) const { + beep(); +} + +void NCursesForm::On_Unknown_Command(int c) const { + beep(); +} + +static const int CMD_QUIT = MAX_COMMAND + 1; + +NCursesFormField* +NCursesForm::operator()(void) { + int drvCmnd; + int err; + int c; + + post(); + show(); + refresh(); + + while (((drvCmnd = virtualize((c=getch()))) != CMD_QUIT)) { + switch((err=driver(drvCmnd))) { + case E_REQUEST_DENIED: + On_Request_Denied(c); + break; + case E_INVALID_FIELD: + On_Invalid_Field(c); + break; + case E_UNKNOWN_COMMAND: + On_Unknown_Command(c); + break; + case E_OK: + break; + default: + OnError(err); + } + } + + unpost(); + hide(); + refresh(); + return my_fields[::field_index (::current_field (form))]; +} + +// Provide a default key virtualization. Translate the keyboard +// code c into a form request code. +// The default implementation provides a hopefully straightforward +// mapping for the most common keystrokes and form requests. +int +NCursesForm::virtualize(int c) { + switch(c) { + + case KEY_HOME : return(REQ_FIRST_FIELD); + case KEY_END : return(REQ_LAST_FIELD); + + case KEY_DOWN : return(REQ_DOWN_CHAR); + case KEY_UP : return(REQ_UP_CHAR); + case KEY_LEFT : return(REQ_PREV_CHAR); + case KEY_RIGHT : return(REQ_NEXT_CHAR); + + case KEY_NPAGE : return(REQ_NEXT_PAGE); + case KEY_PPAGE : return(REQ_PREV_PAGE); + + case KEY_BACKSPACE : return(REQ_DEL_PREV); + case KEY_ENTER : return(REQ_NEW_LINE); + case KEY_CLEAR : return(REQ_CLR_FIELD); + + case CTRL('X') : return(CMD_QUIT); // eXit + + 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('R') : return(REQ_RIGHT_FIELD); // Right + case CTRL('U') : return(REQ_UP_FIELD); // Up + case CTRL('D') : return(REQ_DOWN_FIELD); // Down + + case CTRL('W') : return(REQ_NEXT_WORD); + case CTRL('T') : return(REQ_PREV_WORD); + + case CTRL('A') : return(REQ_BEG_FIELD); + case CTRL('E') : return(REQ_END_FIELD); + + case CTRL('I') : return(REQ_INS_CHAR); + case CTRL('M') : + case CTRL('J') : return(REQ_NEW_LINE); + case CTRL('O') : return(REQ_INS_LINE); + case CTRL('V') : return(REQ_DEL_CHAR); + case CTRL('H') : return(REQ_DEL_PREV); + case CTRL('Y') : return(REQ_DEL_LINE); + case CTRL('G') : return(REQ_DEL_WORD); + case CTRL('K') : return(REQ_CLR_EOF); + + case CTRL('N') : return(REQ_NEXT_CHOICE); + case CTRL('P') : return(REQ_PREV_CHOICE); + + default: + return(c); + } +} +// +// ------------------------------------------------------------------------- +// User Defined Fieldtypes +// ------------------------------------------------------------------------- +// +bool UserDefinedFieldType::fcheck(FIELD *f, const void *u) { + NCursesFormField* F = (NCursesFormField*)u; + assert(F); + UserDefinedFieldType* udf = (UserDefinedFieldType*)(F->fieldtype()); + assert(udf); + return udf->field_check(*F); +} + +bool UserDefinedFieldType::ccheck(int c, const void *u) { + NCursesFormField* F = (NCursesFormField*)u; + assert(F); + UserDefinedFieldType* udf = + (UserDefinedFieldType*)(F->fieldtype()); + assert(udf); + return udf->char_check(c); +} + +void* UserDefinedFieldType::makearg(va_list* va) { + return va_arg(*va,NCursesFormField*); +} + +FIELDTYPE* UserDefinedFieldType::generic_fieldtype = + ::new_fieldtype(UserDefinedFieldType::fcheck, + UserDefinedFieldType::ccheck); + +FIELDTYPE* UserDefinedFieldType_With_Choice::generic_fieldtype_with_choice = + ::new_fieldtype(UserDefinedFieldType::fcheck, + UserDefinedFieldType::ccheck); + +bool UserDefinedFieldType_With_Choice::next_choice(FIELD *f, const void *u) { + NCursesFormField* F = (NCursesFormField*)u; + assert(F); + UserDefinedFieldType_With_Choice* udf = + (UserDefinedFieldType_With_Choice*)(F->fieldtype()); + assert(udf); + return udf->next(*F); +} + +bool UserDefinedFieldType_With_Choice::prev_choice(FIELD *f, const void *u) { + NCursesFormField* F = (NCursesFormField*)u; + assert(F); + UserDefinedFieldType_With_Choice* udf = + (UserDefinedFieldType_With_Choice*)(F->fieldtype()); + assert(udf); + return udf->previous(*F); +} + +class UDF_Init { +private: + int code; + static UDF_Init* I; +public: + UDF_Init() { + code = ::set_fieldtype_arg(UserDefinedFieldType::generic_fieldtype, + UserDefinedFieldType::makearg, + NULL, + NULL); + if (code==E_OK) + code = ::set_fieldtype_arg + (UserDefinedFieldType_With_Choice::generic_fieldtype_with_choice, + UserDefinedFieldType::makearg, + NULL, + NULL); + if (code==E_OK) + code = ::set_fieldtype_choice + (UserDefinedFieldType_With_Choice::generic_fieldtype_with_choice, + UserDefinedFieldType_With_Choice::next_choice, + UserDefinedFieldType_With_Choice::prev_choice); + } +}; + +UDF_Init* UDF_Init::I = new UDF_Init(); + diff --git a/contrib/ncurses/c++/cursesf.h b/contrib/ncurses/c++/cursesf.h new file mode 100644 index 000000000000..1119f5cbc70a --- /dev/null +++ b/contrib/ncurses/c++/cursesf.h @@ -0,0 +1,823 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * + ****************************************************************************/ + +// $Id: cursesf.h,v 1.10 1999/05/16 17:31:42 juergen Exp $ + +#ifndef _CURSESF_H +#define _CURSESF_H + +#include <cursesp.h> + +extern "C" { +# include <form.h> +} +// +// ------------------------------------------------------------------------- +// The abstract base class for buitin and user defined Fieldtypes. +// ------------------------------------------------------------------------- +// +class NCursesFormField; // forward declaration + +// Class to represent builtin field types as well as C++ written new +// fieldtypes (see classes UserDefineFieldType... +class NCursesFieldType { + friend class NCursesFormField; + +protected: + FIELDTYPE* fieldtype; + + inline void OnError(int err) const THROWS(NCursesFormException) { + if (err!=E_OK) + THROW(new NCursesFormException (err)); + } + + NCursesFieldType(FIELDTYPE *f) : fieldtype(f) { + } + + virtual ~NCursesFieldType() {} + + // Set the fields f fieldtype to this one. + virtual void set(NCursesFormField& f) = 0; + +public: + NCursesFieldType() : fieldtype((FIELDTYPE*)0) { + } +}; + +// +// ------------------------------------------------------------------------- +// The class representing a forms field, wrapping the lowlevel FIELD struct +// ------------------------------------------------------------------------- +// +class NCursesFormField { + friend class NCursesForm; + +protected: + FIELD *field; // lowlevel structure + NCursesFieldType* ftype; // Associated field type + + // Error handler + inline void OnError (int err) const THROWS(NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException (err)); + } + +public: + // Create a 'Null' field. Can be used to delimit a field list + NCursesFormField() + : field((FIELD*)0), ftype((NCursesFieldType*)0) { + } + + // Create a new field + NCursesFormField (int rows, + int cols, + int first_row = 0, + int first_col = 0, + int offscreen_rows = 0, + int additional_buffers = 0) + : ftype((NCursesFieldType*)0) { + field = ::new_field(rows,cols,first_row,first_col, + offscreen_rows, additional_buffers); + if (!field) + OnError(errno); + } + + virtual ~NCursesFormField (); + + // Duplicate the field at a new position + inline NCursesFormField* dup(int first_row, int first_col) { + NCursesFormField* f = new NCursesFormField(); + if (!f) + OnError(E_SYSTEM_ERROR); + else { + f->ftype = ftype; + f->field = ::dup_field(field,first_row,first_col); + if (!f->field) + OnError(errno); + } + return f; + } + + // Link the field to a new location + inline NCursesFormField* link(int first_row, int first_col) { + NCursesFormField* f = new NCursesFormField(); + if (!f) + OnError(E_SYSTEM_ERROR); + else { + f->ftype = ftype; + f->field = ::link_field(field,first_row,first_col); + if (!f->field) + OnError(errno); + } + return f; + } + + // Get the lowlevel field representation + inline FIELD* get_field() const { + return field; + } + + // Retrieve info about the field + inline void info(int& rows, int& cols, + int& first_row, int& first_col, + int& offscreen_rows, int& additional_buffers) const { + OnError(::field_info(field, &rows, &cols, + &first_row, &first_col, + &offscreen_rows, &additional_buffers)); + } + + // Retrieve info about the fields dynamic properties. + inline void dynamic_info(int& dynamic_rows, int& dynamic_cols, + int& max_growth) const { + OnError(::dynamic_field_info(field, &dynamic_rows, &dynamic_cols, + &max_growth)); + } + + // For a dynamic field you may set the maximum growth limit. + // A zero means unlimited growth. + inline void set_maximum_growth(int growth = 0) { + OnError(::set_max_field(field,growth)); + } + + // Move the field to a new position + inline void move(int row, int col) { + OnError(::move_field(field,row,col)); + } + + // Mark the field to start a new page + inline void new_page(bool pageFlag = FALSE) { + OnError(::set_new_page(field,pageFlag)); + } + + // Retrieve whether or not the field starts a new page. + inline bool is_new_page() const { + return ::new_page(field); + } + + // Set the justification for the field + inline void set_justification(int just) { + OnError(::set_field_just(field,just)); + } + + // Retrieve the fields justification + inline int justification() const { + return ::field_just(field); + } + // Set the foreground attribute for the field + inline void set_foreground(chtype fore) { + OnError(::set_field_fore(field,fore)); + } + + // Retrieve the fields foreground attribute + inline chtype fore() const { + return ::field_fore(field); + } + + // Set the background attribute for the field + inline void set_background(chtype back) { + OnError(::set_field_back(field,back)); + } + + // Retrieve the fields background attribute + inline chtype back() const { + return ::field_back(field); + } + + // Set the padding character for the field + inline void set_pad_character(int pad) { + OnError(::set_field_pad(field,pad)); + } + + // Retrieve the fields padding character + inline int pad() const { + return ::field_pad(field); + } + + // Switch on the fields options + inline void options_on (Field_Options options) { + OnError (::field_opts_on (field, options)); + } + + // Switch off the fields options + inline void options_off (Field_Options options) { + OnError (::field_opts_off (field, options)); + } + + // Retrieve the fields options + inline Field_Options options () const { + return ::field_opts (field); + } + + // Set the fields options + inline void set_options (Field_Options options) { + OnError (::set_field_opts (field, options)); + } + + // Mark the field as changed + inline void set_changed(bool changeFlag = TRUE) { + OnError(::set_field_status(field,changeFlag)); + } + + // Test whether or not the field is marked as changed + inline bool changed() const { + return ::field_status(field); + } + + // Return the index of the field in the field array of a form + // or -1 if the field is not associated to a form + inline int (index)() const { + return ::field_index(field); + } + + // Store a value in a fields buffer. The default buffer is nr. 0 + inline void set_value(const char *val, int buffer = 0) { + OnError(::set_field_buffer(field,buffer,val)); + } + + // Retrieve the value of a fields buffer. The defaukt buffer is nr. 0 + inline char* value(int buffer = 0) const { + return ::field_buffer(field,buffer); + } + + // Set the validation type of the field. + inline void set_fieldtype(NCursesFieldType& f) { + ftype = &f; + f.set(*this); // A good friend may do that... + } + + // Retrieve the validation type of the field. + inline NCursesFieldType* fieldtype() const { + return ftype; + } + +}; + +// +// ------------------------------------------------------------------------- +// The class representing a form, wrapping the lowlevel FORM struct +// ------------------------------------------------------------------------- +// +class NCursesForm : public NCursesPanel { +protected: + FORM* form; // the lowlevel structure + +private: + NCursesWindow* sub; // the subwindow object + bool b_sub_owner; // is this our own subwindow? + bool b_framed; // has the form a border? + bool b_autoDelete; // Delete fields when deleting form? + + NCursesFormField** my_fields; // The array of fields for this form + + // This structure is used for the form's user data field to link the + // FORM* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesForm* m_back; // backward pointer to C++ object + const FORM* m_owner; + } UserHook; + + // Get the backward pointer to the C++ object from a FORM + static inline NCursesForm* getHook(const FORM *f) { + UserHook* hook = (UserHook*)::form_userptr(f); + assert(hook && hook->m_owner==f); + return (NCursesForm*)(hook->m_back); + } + + // This are the built-in hook functions in this C++ binding. In C++ we use + // virtual member functions (see below On_..._Init and On_..._Termination) + // to provide this functionality in an object oriented manner. + static void frm_init(FORM *); + static void frm_term(FORM *); + static void fld_init(FORM *); + static void fld_term(FORM *); + + // Calculate FIELD* array for the menu + FIELD** mapFields(NCursesFormField* nfields[]); + +protected: + // internal routines + inline void set_user(void *user) { + UserHook* uptr = (UserHook*)::form_userptr (form); + assert (uptr && uptr->m_back==this && uptr->m_owner==form); + uptr->m_user = user; + } + + inline void *get_user() { + UserHook* uptr = (UserHook*)::form_userptr (form); + assert (uptr && uptr->m_back==this && uptr->m_owner==form); + return uptr->m_user; + } + + void InitForm (NCursesFormField* Fields[], + bool with_frame, + bool autoDeleteFields); + + inline void OnError (int err) const THROWS(NCursesFormException) { + if (err != E_OK) + THROW(new NCursesFormException (err)); + } + + // this wraps the form_driver call. + virtual int driver (int c) ; + + // 'Internal' constructor, builds an object without association to a + // field array. + NCursesForm( int lines, + int cols, + int begin_y = 0, + int begin_x = 0) + : NCursesPanel(lines,cols,begin_y,begin_x), + form ((FORM*)0) { + } + +public: + // Create form for the default panel. + NCursesForm (NCursesFormField* Fields[], + bool with_frame=FALSE, // reserve space for a frame? + bool autoDelete_Fields=FALSE) // do automatic cleanup? + : NCursesPanel() { + InitForm(Fields, with_frame, autoDelete_Fields); + } + + // Create a form in a panel with the given position and size. + NCursesForm (NCursesFormField* Fields[], + int lines, + int cols, + int begin_y, + int begin_x, + bool with_frame=FALSE, // reserve space for a frame? + bool autoDelete_Fields=FALSE) // do automatic cleanup? + : NCursesPanel(lines, cols, begin_y, begin_x) { + InitForm(Fields, with_frame, autoDelete_Fields); + } + + virtual ~NCursesForm(); + + // Set the default attributes for the form + virtual void setDefaultAttributes(); + + // Retrieve current field of the form. + inline NCursesFormField* current_field() const { + return my_fields[::field_index(::current_field(form))]; + } + + // Set the forms subwindow + void setSubWindow(NCursesWindow& sub); + + // Set these fields for the form + inline void setFields(NCursesFormField* Fields[]) { + OnError(::set_form_fields(form,mapFields(Fields))); + } + + // Remove the form from the screen + inline void unpost (void) { + OnError (::unpost_form (form)); + } + + // Post the form to the screen if flag is true, unpost it otherwise + inline void post(bool flag = TRUE) { + OnError (flag ? ::post_form(form) : ::unpost_form (form)); + } + + // Decorations + inline void frame(const char *title=NULL, const char* btitle=NULL) { + if (b_framed) + NCursesPanel::frame(title,btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void boldframe(const char *title=NULL, const char* btitle=NULL) { + if (b_framed) + NCursesPanel::boldframe(title,btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void label(const char *topLabel, const char *bottomLabel) { + if (b_framed) + NCursesPanel::label(topLabel,bottomLabel); + else + OnError(E_SYSTEM_ERROR); + } + + // ----- + // Hooks + // ----- + + // Called after the form gets repositioned in its window. + // This is especially true if the form is posted. + virtual void On_Form_Init(); + + // Called before the form gets repositioned in its window. + // This is especially true if the form is unposted. + virtual void On_Form_Termination(); + + // Called after the field became the current field + virtual void On_Field_Init(NCursesFormField& field); + + // Called before this field is left as current field. + virtual void On_Field_Termination(NCursesFormField& field); + + // Calculate required window size for the form. + void scale(int& rows, int& cols) const { + OnError(::scale_form(form,&rows,&cols)); + } + + // Retrieve number of fields in the form. + int count() const { + return ::field_count(form); + } + + // Make the page the current page of the form. + void set_page(int page) { + OnError(::set_form_page(form,page)); + } + + // Retrieve current page number + int page() const { + return ::form_page(form); + } + + // Switch on the forms options + inline void options_on (Form_Options options) { + OnError (::form_opts_on (form, options)); + } + + // Switch off the forms options + inline void options_off (Form_Options options) { + OnError (::form_opts_off (form, options)); + } + + // Retrieve the forms options + inline Form_Options options () const { + return ::form_opts (form); + } + + // Set the forms options + inline void set_options (Form_Options options) { + OnError (::set_form_opts (form, options)); + } + + // Are there more data in the current field after the data shown + inline bool data_ahead() const { + return ::data_ahead(form); + } + + // Are there more data in the current field before the data shown + inline bool data_behind() const { + return ::data_behind(form); + } + + // Position the cursor to the current field + inline void position_cursor () { + OnError (::pos_form_cursor (form)); + } + // Set the current field + inline void set_current(NCursesFormField& F) { + OnError (::set_current_field(form, F.field)); + } + + // Provide a default key virtualization. Translate the keyboard + // code c into a form request code. + // The default implementation provides a hopefully straightforward + // mapping for the most common keystrokes and form requests. + virtual int virtualize(int c); + + // Operators + inline NCursesFormField* operator[](int i) const { + if ( (i < 0) || (i >= ::field_count (form)) ) + OnError (E_BAD_ARGUMENT); + return my_fields[i]; + } + + // Perform the menu's operation + // Return the field where you left the form. + virtual NCursesFormField* operator()(void); + + // Exception handlers. The default is a Beep. + virtual void On_Request_Denied(int c) const; + virtual void On_Invalid_Field(int c) const; + virtual void On_Unknown_Command(int c) const; + +}; + +// +// ------------------------------------------------------------------------- +// This is the typical C++ typesafe way to allow to attach +// user data to a field of a form. Its assumed that the user +// data belongs to some class T. Use T as template argument +// to create a UserField. +// ------------------------------------------------------------------------- +template<class T> class NCursesUserField : public NCursesFormField +{ +public: + NCursesUserField (int rows, + int cols, + int first_row = 0, + int first_col = 0, + const T* p_UserData = (T*)0, + int offscreen_rows = 0, + int additional_buffers = 0) + : NCursesFormField (rows, cols, + first_row, first_col, + offscreen_rows, additional_buffers) { + if (field) + OnError(::set_field_userptr(field,(void *)p_UserData)); + } + + virtual ~NCursesUserField() {}; + + inline const T* UserData (void) const { + return (const T*)::field_userptr (field); + } + + inline virtual void setUserData(const T* p_UserData) { + if (field) + OnError (::set_field_userptr (field, (void *)p_UserData)); + } +}; +// +// ------------------------------------------------------------------------- +// The same mechanism is used to attach user data to a form +// ------------------------------------------------------------------------- +// +template<class T> class NCursesUserForm : public NCursesForm +{ +protected: + // 'Internal' constructor, builds an object without association to a + // field array. + NCursesUserForm( int lines, + int cols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = (T*)0) + : NCursesForm(lines,cols,begin_y,begin_x) { + if (form) + set_user ((void *)p_UserData); + } + +public: + NCursesUserForm (NCursesFormField Fields[], + bool with_frame=FALSE, + bool autoDelete_Fields=FALSE) + : NCursesForm (Fields, with_frame, autoDelete_Fields) { + }; + + NCursesUserForm (NCursesFormField Fields[], + const T* p_UserData = (T*)0, + bool with_frame=FALSE, + bool autoDelete_Fields=FALSE) + : NCursesForm (Fields, with_frame, autoDelete_Fields) { + if (form) + set_user ((void *)p_UserData); + }; + + NCursesUserForm (NCursesFormField Fields[], + int lines, + int cols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = (T*)0, + bool with_frame=FALSE, + bool autoDelete_Fields=FALSE) + : NCursesForm (Fields, lines, cols, begin_y, begin_x, + with_frame, autoDelete_Fields) { + if (form) + set_user ((void *)p_UserData); + }; + + virtual ~NCursesUserForm() { + }; + + inline T* UserData (void) const { + return (T*)get_user (); + }; + + inline virtual void setUserData (const T* p_UserData) { + if (form) + set_user ((void *)p_UserData); + } + +}; +// +// ------------------------------------------------------------------------- +// Builtin Fieldtypes +// ------------------------------------------------------------------------- +// +class Alpha_Field : public NCursesFieldType { +private: + int min_field_width; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype,min_field_width)); + } + +public: + Alpha_Field(int width) + : NCursesFieldType(TYPE_ALPHA), + min_field_width(width) { + } +}; + +class Alphanumeric_Field : public NCursesFieldType { +private: + int min_field_width; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype,min_field_width)); + } + +public: + Alphanumeric_Field(int width) + : NCursesFieldType(TYPE_ALNUM), + min_field_width(width) { + } +}; + +class Integer_Field : public NCursesFieldType { +private: + int precision; + long lower_limit, upper_limit; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype, + precision,lower_limit,upper_limit)); + } + +public: + Integer_Field(int prec, long low=0L, long high=0L) + : NCursesFieldType(TYPE_INTEGER), + precision(prec), lower_limit(low), upper_limit(high) { + } +}; + +class Numeric_Field : public NCursesFieldType { +private: + int precision; + double lower_limit, upper_limit; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype, + precision,lower_limit,upper_limit)); + } + +public: + Numeric_Field(int prec, double low=0.0, double high=0.0) + : NCursesFieldType(TYPE_NUMERIC), + precision(prec), lower_limit(low), upper_limit(high) { + } +}; + +class Regular_Expression_Field : public NCursesFieldType { +private: + char* regex; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype,regex)); + } + +public: + Regular_Expression_Field(const char *expr) + : NCursesFieldType(TYPE_REGEXP) { + regex = new char[1+::strlen(expr)]; + (strcpy)(regex,expr); + } + + ~Regular_Expression_Field() { + delete[] regex; + } +}; + +class Enumeration_Field : public NCursesFieldType { +private: + char** list; + int case_sensitive; + int non_unique_matches; + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype, + list,case_sensitive,non_unique_matches)); + } +public: + Enumeration_Field(char* enums[], + bool case_sens=FALSE, + bool non_unique=FALSE) + : NCursesFieldType(TYPE_ENUM), + list(enums), + case_sensitive(case_sens?-1:0), + non_unique_matches(non_unique?-1:0) { + } +}; + +class IPV4_Address_Field : public NCursesFieldType { +private: + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype)); + } + +public: + IPV4_Address_Field() : NCursesFieldType(TYPE_IPV4) { + } +}; +// +// ------------------------------------------------------------------------- +// Abstract base class for User-Defined Fieldtypes +// ------------------------------------------------------------------------- +// +class 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 + // FIELDTYPE* element. + static FIELDTYPE* generic_fieldtype; + +protected: + // This are the functions required by the low level libforms functions + // to construct a fieldtype. + static bool fcheck(FIELD *, const void*); + static bool ccheck(int c, const void *); + static void* makearg(va_list*); + + void set(NCursesFormField& f) { + OnError(::set_field_type(f.get_field(),fieldtype,&f)); + } + +protected: + // Redefine this function to do a field validation. The argument + // is a reference to the field you should validate. + virtual bool field_check(NCursesFormField& f) = 0; + + // Redefine this function to do a character validation. The argument + // is the character to be validated. + virtual bool char_check (int c) = 0; + +public: + UserDefinedFieldType() : NCursesFieldType(generic_fieldtype) { + } +}; +// +// ------------------------------------------------------------------------- +// Abstract base class for User-Defined Fieldtypes with Choice functions +// ------------------------------------------------------------------------- +// +class 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 + // generic lowlevel FIELDTYPE* element. + static FIELDTYPE* generic_fieldtype_with_choice; + + // This are the functions required by the low level libforms functions + // to construct a fieldtype with choice functions. + static bool next_choice(FIELD*, const void *); + static bool prev_choice(FIELD*, const void *); + +protected: + // Redefine this function to do the retrieval of the next choice value. + // The argument is a reference to the field tobe examined. + virtual bool next (NCursesFormField& f) = 0; + + // Redefine this function to do the retrieval of the previous choice value. + // The argument is a reference to the field tobe examined. + virtual bool previous(NCursesFormField& f) = 0; + +public: + UserDefinedFieldType_With_Choice() { + fieldtype = generic_fieldtype_with_choice; + } +}; + +#endif // _CURSESF_H + diff --git a/contrib/ncurses/c++/cursesm.cc b/contrib/ncurses/c++/cursesm.cc new file mode 100644 index 000000000000..599b5f178885 --- /dev/null +++ b/contrib/ncurses/c++/cursesm.cc @@ -0,0 +1,383 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * + ****************************************************************************/ + +#include "cursesm.h" +#include "cursesapp.h" +#include "internal.h" + +MODULE_ID("$Id: cursesm.cc,v 1.11 1999/07/31 09:45:23 juergen Exp $") + +NCursesMenuItem::~NCursesMenuItem() { + if (item) + OnError(::free_item(item)); +} + +bool +NCursesMenuItem::action() { + return FALSE; +}; + +NCursesMenuCallbackItem::~NCursesMenuCallbackItem() { +} + +bool +NCursesMenuCallbackItem::action() { + if (p_fct) + return p_fct (*this); + else + return FALSE; +} + +/* 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 + * implementing a virtual method in a derived class + */ +void +NCursesMenu::mnu_init(MENU *m) { + getHook(m)->On_Menu_Init(); +} + +void +NCursesMenu::mnu_term(MENU *m) { + getHook(m)->On_Menu_Termination(); +} + +void +NCursesMenu::itm_init(MENU *m) { + NCursesMenu* M = getHook(m); + M->On_Item_Init (*(M->current_item ())); +} + +void +NCursesMenu::itm_term(MENU *m) { + NCursesMenu* M = getHook(m); + M->On_Item_Termination (*(M->current_item ())); +} + +/* Construct an ITEM* array from an array of NCursesMenuItem + * objects. + */ +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); + return items; +} + +void +NCursesMenu::InitMenu(NCursesMenuItem* nitems[], + bool with_frame, + bool autoDelete_Items) { + int mrows, mcols; + + keypad(TRUE); + meta(TRUE); + + b_framed = with_frame; + b_autoDelete = autoDelete_Items; + + menu = (MENU*)0; + 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); + sub = new NCursesWindow(*this,mrows,mcols,1,1,'r'); + ::set_menu_sub(menu, sub->w); + b_sub_owner = TRUE; + } + else { + sub = (NCursesWindow*)0; + b_sub_owner = FALSE; + } + setDefaultAttributes(); +} + +void +NCursesMenu::setDefaultAttributes() { + NCursesApplication* S = NCursesApplication::getApplication(); + if (S) { + ::set_menu_fore(menu, S->foregrounds()); + ::set_menu_back(menu, S->backgrounds()); + ::set_menu_grey(menu, S->inactives()); + } +} + +NCursesMenu::~NCursesMenu() { + UserHook* hook = (UserHook*)::menu_userptr(menu); + delete hook; + if (b_sub_owner) { + delete sub; + ::set_menu_sub(menu,(WINDOW *)0); + } + if (menu) { + ITEM** itms = ::menu_items(menu); + int cnt = count(); + + OnError(::set_menu_items(menu,(ITEM**)0)); + + if (b_autoDelete) { + if (cnt>0) { + for (int i=0; i <= cnt; i++) + delete my_items[i]; + } + delete[] my_items; + } + + ::free_menu(menu); + // It's essential to do this after free_menu() + delete[] itms; + } +} + +void +NCursesMenu::setSubWindow(NCursesWindow& nsub) { + if (!isDescendant(nsub)) + OnError(E_SYSTEM_ERROR); + else { + if (b_sub_owner) + delete sub; + sub = ⊄ + ::set_menu_sub(menu,sub->w); + } +} + +bool +NCursesMenu::set_pattern (const char *pat) { + int res = ::set_menu_pattern (menu, pat); + switch(res) { + case E_OK: + break; + case E_NO_MATCH: + return FALSE; + default: + OnError (res); + } + return TRUE; +} + +// call the menu driver and do basic error checking. +int +NCursesMenu::driver (int c) { + int res = ::menu_driver (menu, c); + switch (res) { + case E_OK: + case E_REQUEST_DENIED: + case E_NOT_SELECTABLE: + case E_UNKNOWN_COMMAND: + case E_NO_MATCH: + break; + default: + OnError (res); + } + return (res); +} + +static const int CMD_QUIT = MAX_COMMAND + 1; +static const int CMD_ACTION = MAX_COMMAND + 2; +// +// ------------------------------------------------------------------------- +// Provide a default key virtualization. Translate the keyboard +// code c into a menu request code. +// The default implementation provides a hopefully straightforward +// mapping for the most common keystrokes and menu requests. +// ------------------------------------------------------------------------- +int +NCursesMenu::virtualize(int c) { + switch(c) { + case CTRL('X') : return(CMD_QUIT); // eXit + + case KEY_DOWN : return(REQ_DOWN_ITEM); + case CTRL('N') : return(REQ_NEXT_ITEM); // Next + case KEY_UP : return(REQ_UP_ITEM); + case CTRL('P') : return(REQ_PREV_ITEM); // Previous + + case CTRL('U') : return(REQ_SCR_ULINE); // Up + case CTRL('D') : return(REQ_SCR_DLINE); // Down + case CTRL('F') : return(REQ_SCR_DPAGE); // Forward + case CTRL('B') : return(REQ_SCR_UPAGE); // Backward + + case CTRL('Y') : return(REQ_CLEAR_PATTERN); + case CTRL('H') : return(REQ_BACK_PATTERN); + case CTRL('A') : return(REQ_NEXT_MATCH); + case CTRL('E') : return(REQ_PREV_MATCH); + case CTRL('T') : return(REQ_TOGGLE_ITEM); + + case CTRL('J') : + case CTRL('M') : return(CMD_ACTION); + + case KEY_HOME : return(REQ_FIRST_ITEM); + case KEY_LEFT : return(REQ_LEFT_ITEM); + case KEY_RIGHT : return(REQ_RIGHT_ITEM); + case KEY_END : return(REQ_LAST_ITEM); + case KEY_BACKSPACE : return(REQ_BACK_PATTERN); + case KEY_NPAGE : return(REQ_SCR_DPAGE); + case KEY_PPAGE : return(REQ_SCR_UPAGE); + + default: + return(c); + } +} + +NCursesMenuItem* +NCursesMenu::operator()(void) { + int drvCmnd; + int err; + int c; + bool b_action = FALSE; + + post(); + show(); + refresh(); + + while (!b_action && ((drvCmnd = virtualize((c=getch()))) != CMD_QUIT)) { + + switch((err=driver(drvCmnd))) { + case E_REQUEST_DENIED: + On_Request_Denied(c); + break; + case E_NOT_SELECTABLE: + On_Not_Selectable(c); + break; + case E_UNKNOWN_COMMAND: + if (drvCmnd == CMD_ACTION) { + if (options() & O_ONEVALUE) { + NCursesMenuItem* itm = current_item(); + assert(itm); + if (itm->options() & O_SELECTABLE) + { + b_action = itm->action(); + refresh(); + } + else + On_Not_Selectable(c); + } + else { + int n = count(); + for(int i=0; i<n; i++) { + NCursesMenuItem* itm = my_items[i]; + if (itm->value()) { + b_action |= itm->action(); + refresh(); + } + } + } + } else + On_Unknown_Command(c); + break; + case E_NO_MATCH: + On_No_Match(c); + break; + case E_OK: + break; + default: + OnError(err); + } + } + + unpost(); + hide(); + refresh(); + if (options() & O_ONEVALUE) + return my_items[::item_index (::current_item (menu))]; + else + return NULL; +} + +void +NCursesMenu::On_Menu_Init() { +} + +void +NCursesMenu::On_Menu_Termination() { +} + +void +NCursesMenu::On_Item_Init(NCursesMenuItem& item) { +} + +void +NCursesMenu::On_Item_Termination(NCursesMenuItem& item) { +} + +void +NCursesMenu::On_Request_Denied(int c) const { + beep(); +} + +void +NCursesMenu::On_Not_Selectable(int c) const { + beep(); +} + +void +NCursesMenu::On_No_Match(int c) const { + beep(); +} + +void +NCursesMenu::On_Unknown_Command(int c) const { + beep(); +} + diff --git a/contrib/ncurses/c++/cursesm.h b/contrib/ncurses/c++/cursesm.h new file mode 100644 index 000000000000..5037ae23fb75 --- /dev/null +++ b/contrib/ncurses/c++/cursesm.h @@ -0,0 +1,592 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * + ****************************************************************************/ + +// $Id: cursesm.h,v 1.12 1999/05/16 17:30:27 juergen Exp $ + +#ifndef _CURSESM_H +#define _CURSESM_H + +#include <cursesp.h> + +extern "C" { +# include <menu.h> +} +// +// ------------------------------------------------------------------------- +// This wraps the ITEM type of <menu.h> +// ------------------------------------------------------------------------- +// +class NCursesMenuItem { + friend class NCursesMenu; + +protected: + ITEM *item; + + inline void OnError (int err) const THROWS(NCursesMenuException) { + if (err != E_OK) + THROW(new NCursesMenuException (err)); + } + +public: + NCursesMenuItem (const char* p_name = NULL, + const char* p_descript = NULL ) { + item = p_name ? ::new_item (p_name, p_descript) : (ITEM*)0; + if (p_name && !item) + OnError (E_SYSTEM_ERROR); + } + // Create an item. If you pass both parameters as NULL, a delimiting + // item is constructed which can be used to terminate a list of + // NCursesMenu objects. + + virtual ~NCursesMenuItem (); + // Release the items memory + + inline const char* name () const { + return ::item_name (item); + } + // Name of the item + + inline const char* description () const { + return ::item_description (item); + } + // Description of the item + + inline int (index) (void) const { + return ::item_index (item); + } + // Index of the item in an item array (or -1) + + inline void options_on (Item_Options options) { + OnError (::item_opts_on (item, options)); + } + // Switch on the items options + + inline void options_off (Item_Options options) { + OnError (::item_opts_off (item, options)); + } + // Switch off the item's option + + inline Item_Options options () const { + return ::item_opts (item); + } + // Retrieve the items options + + inline void set_options (Item_Options options) { + OnError (::set_item_opts (item, options)); + } + // Set the items options + + inline void set_value (bool f) { + OnError (::set_item_value (item,f)); + } + // Set/Reset the items selection state + + inline bool value () const { + return ::item_value (item); + } + // Retrieve the items selection state + + inline bool visible () const { + return ::item_visible (item); + } + // Retrieve visibility of the item + + virtual bool action(); + // Perform an action associated with this item; you may use this in an + // user supplied driver for a menu; you may derive from this class and + // overload action() to supply items with different actions. + // If an action returns true, the menu will be exited. The default action + // is to do nothing. +}; + +// Prototype for an items callback function. +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 { +private: + const ITEMCALLBACK* p_fct; + +public: + NCursesMenuCallbackItem(const ITEMCALLBACK* fct = NULL, + const char* p_name = NULL, + const char* p_descript = NULL ) + : NCursesMenuItem (p_name, p_descript), + p_fct (fct) { + } + + virtual ~NCursesMenuCallbackItem(); + + bool action(); +}; +// +// ------------------------------------------------------------------------- +// This wraps the MENU type of <menu.h> +// ------------------------------------------------------------------------- +// +class NCursesMenu : public NCursesPanel { +protected: + MENU *menu; + +private: + NCursesWindow* sub; // the subwindow object + bool b_sub_owner; // is this our own subwindow? + bool b_framed; // has the menu a border? + bool b_autoDelete; // Delete items when deleting menu? + + NCursesMenuItem** my_items; // The array of items for this menu + + // This structure is used for the menu's user data field to link the + // MENU* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesMenu* m_back; // backward pointer to C++ object + const MENU* m_owner; + } UserHook; + + // Get the backward pointer to the C++ object from a MENU + static inline NCursesMenu* getHook(const MENU *m) { + UserHook* hook = (UserHook*)::menu_userptr(m); + assert(hook && hook->m_owner==m); + return (NCursesMenu*)(hook->m_back); + } + + // This are the built-in hook functions in this C++ binding. In C++ we use + // virtual member functions (see below On_..._Init and On_..._Termination) + // to provide this functionality in an object oriented manner. + static void mnu_init(MENU *); + static void mnu_term(MENU *); + static void itm_init(MENU *); + static void itm_term(MENU *); + + // Calculate ITEM* array for the menu + ITEM** mapItems(NCursesMenuItem* nitems[]); + +protected: + // internal routines + inline void set_user(void *user) { + UserHook* uptr = (UserHook*)::menu_userptr (menu); + assert (uptr && uptr->m_back==this && uptr->m_owner==menu); + uptr->m_user = user; + } + + inline void *get_user() { + UserHook* uptr = (UserHook*)::menu_userptr (menu); + assert (uptr && uptr->m_back==this && uptr->m_owner==menu); + return uptr->m_user; + } + + void InitMenu (NCursesMenuItem* menu[], + bool with_frame, + bool autoDeleteItems); + + inline void OnError (int err) const THROWS(NCursesMenuException) { + if (err != E_OK) + THROW(new NCursesMenuException (this, err)); + } + + // this wraps the menu_driver call. + virtual int driver (int c) ; + + // 'Internal' constructor to create a menu without association to + // an array of items. + NCursesMenu( int lines, + int cols, + int begin_y = 0, + int begin_x = 0) + : NCursesPanel(lines,cols,begin_y,begin_x), + menu ((MENU*)0) { + } + +public: + // Make a full window size menu + NCursesMenu (NCursesMenuItem* Items[], + bool with_frame=FALSE, // Reserve space for a frame? + bool autoDelete_Items=FALSE) // Autocleanup of Items? + : NCursesPanel() { + InitMenu(Items, with_frame, autoDelete_Items); + } + + // Make a menu with a window of this size. + NCursesMenu (NCursesMenuItem* Items[], + int lines, + int cols, + int begin_y = 0, + int begin_x = 0, + bool with_frame=FALSE, // Reserve space for a frame? + bool autoDelete_Items=FALSE) // Autocleanup of Items? + : NCursesPanel(lines, cols, begin_y, begin_x) { + InitMenu(Items, with_frame, autoDelete_Items); + } + + virtual ~NCursesMenu (); + + // Retrieve the menus subwindow + inline NCursesWindow& subWindow() const { + assert(sub!=NULL); + return *sub; + } + + // Set the menus subwindow + void setSubWindow(NCursesWindow& sub); + + // Set these items for the menu + inline void setItems(NCursesMenuItem* Items[]) { + OnError(::set_menu_items(menu,mapItems(Items))); + } + + // Remove the menu from the screen + inline void unpost (void) { + OnError (::unpost_menu (menu)); + } + + // Post the menu to the screen if flag is true, unpost it otherwise + inline void post(bool flag = TRUE) { + flag ? OnError (::post_menu(menu)) : OnError (::unpost_menu (menu)); + } + + // Get the numer of rows and columns for this menu + inline void scale (int& mrows, int& mcols) const { + OnError (::scale_menu (menu, &mrows, &mcols)); + } + + // Set the format of this menu + inline void set_format(int mrows, int mcols) { + OnError (::set_menu_format(menu, mrows, mcols)); + } + + // Get the format of this menu + inline void menu_format(int& rows,int& cols) { + ::menu_format(menu,&rows,&cols); + } + + // Items of the menu + inline NCursesMenuItem* items() const { + return *my_items; + } + + // Get the number of items in this menu + inline int count() const { + return ::item_count(menu); + } + + // Get the current item (i.e. the one the cursor is located) + inline NCursesMenuItem* current_item() const { + return my_items[::item_index(::current_item(menu))]; + } + + // Get the marker string + inline const char* mark() const { + return ::menu_mark(menu); + } + + // Set the marker string + inline void set_mark(const char *mark) { + OnError (::set_menu_mark (menu, mark)); + } + + // Get the name of the request code c + inline static const char* request_name(int c) { + return ::menu_request_name(c); + } + + // Get the current pattern + inline char* pattern() const { + return ::menu_pattern(menu); + } + + // true if there is a pattern match, false otherwise. + bool set_pattern (const char *pat); + + // set the default attributes for the menu + // i.e. set fore, back and grey attribute + virtual void setDefaultAttributes(); + + // Get the menus background attributes + inline chtype back() const { + return ::menu_back(menu); + } + + // Get the menus foreground attributes + inline chtype fore() const { + return ::menu_fore(menu); + } + + // Get the menus grey attributes (used for unselectable items) + inline chtype grey() const { + return ::menu_grey(menu); + } + + // Set the menus background attributes + inline chtype set_background(chtype a) { + return ::set_menu_back(menu,a); + } + + // Set the menus foreground attributes + inline chtype set_foreground(chtype a) { + return ::set_menu_fore(menu,a); + } + + // Set the menus grey attributes (used for unselectable items) + inline chtype set_grey(chtype a) { + return ::set_menu_grey(menu,a); + } + + inline void options_on (Menu_Options opts) { + OnError (::menu_opts_on (menu,opts)); + } + + inline void options_off(Menu_Options opts) { + OnError (::menu_opts_off(menu,opts)); + } + + inline Menu_Options options() const { + return ::menu_opts(menu); + } + + inline void set_options (Menu_Options opts) { + OnError (::set_menu_opts (menu,opts)); + } + + inline int pad() const { + return ::menu_pad(menu); + } + + inline void set_pad (int padch) { + OnError (::set_menu_pad (menu, padch)); + } + + // Position the cursor to the current item + inline void position_cursor () const { + OnError (::pos_menu_cursor (menu)); + } + + // Set the current item + inline void set_current(NCursesMenuItem& I) { + OnError (::set_current_item(menu, I.item)); + } + + // Get the current top row of the menu + inline int top_row (void) const { + return ::top_row (menu); + } + + // Set the current top row of the menu + inline void set_top_row (int row) { + OnError (::set_top_row (menu, row)); + } + + // spacing control + // Set the spacing for the menu + inline void setSpacing(int spc_description, + int spc_rows, + int spc_columns) { + OnError(::set_menu_spacing(menu, + spc_description, + spc_rows, + spc_columns)); + } + + // Get the spacing info for the menu + inline void Spacing(int& spc_description, + int& spc_rows, + int& spc_columns) const { + OnError(::menu_spacing(menu, + &spc_description, + &spc_rows, + &spc_columns)); + } + + // Decorations + inline void frame(const char *title=NULL, const char* btitle=NULL) { + if (b_framed) + NCursesPanel::frame(title,btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void boldframe(const char *title=NULL, const char* btitle=NULL) { + if (b_framed) + NCursesPanel::boldframe(title,btitle); + else + OnError(E_SYSTEM_ERROR); + } + + inline void label(const char *topLabel, const char *bottomLabel) { + if (b_framed) + NCursesPanel::label(topLabel,bottomLabel); + else + OnError(E_SYSTEM_ERROR); + } + + // ----- + // Hooks + // ----- + + // Called after the menu gets repositioned in its window. + // This is especially true if the menu is posted. + virtual void On_Menu_Init(); + + // Called before the menu gets repositioned in its window. + // This is especially true if the menu is unposted. + virtual void On_Menu_Termination(); + + // Called after the item became the current item + virtual void On_Item_Init(NCursesMenuItem& item); + + // Called before this item is left as current item. + virtual void On_Item_Termination(NCursesMenuItem& item); + + // Provide a default key virtualization. Translate the keyboard + // code c into a menu request code. + // The default implementation provides a hopefully straightforward + // mapping for the most common keystrokes and menu requests. + virtual int virtualize(int c); + + + // Operators + inline NCursesMenuItem* operator[](int i) const { + if ( (i < 0) || (i >= ::item_count (menu)) ) + OnError (E_BAD_ARGUMENT); + return (my_items[i]); + } + + // Perform the menu's operation + // Return the item where you left the selection mark for a single + // selection menu, or NULL for a multivalued menu. + virtual NCursesMenuItem* operator()(void); + + // -------------------- + // Exception handlers + // Called by operator() + // -------------------- + + // Called if the request is denied + virtual void On_Request_Denied(int c) const; + + // Called if the item is not selectable + virtual void On_Not_Selectable(int c) const; + + // Called if pattern doesn't match + virtual void On_No_Match(int c) const; + + // Called if the command is unknown + virtual void On_Unknown_Command(int c) const; + +}; +// +// ------------------------------------------------------------------------- +// This is the typical C++ typesafe way to allow to attach +// user data to an item of a menu. Its assumed that the user +// data belongs to some class T. Use T as template argument +// to create a UserItem. +// ------------------------------------------------------------------------- +// +template<class T> class NCursesUserItem : public NCursesMenuItem +{ +public: + NCursesUserItem (const char* p_name, + const char* p_descript = NULL, + const T* p_UserData = (T*)0) + : NCursesMenuItem (p_name, p_descript) { + if (item) + OnError (::set_item_userptr (item, (void *)p_UserData)); + }; + + virtual ~NCursesUserItem() {}; + + inline const T* UserData (void) const { + return (const T*)::item_userptr (item); + }; + + inline virtual void setUserData(const T* p_UserData) { + if (item) + OnError (::set_item_userptr (item, (void *)p_UserData)); + } +}; +// +// ------------------------------------------------------------------------- +// The same mechanism is used to attach user data to a menu +// ------------------------------------------------------------------------- +// +template<class T> class NCursesUserMenu : public NCursesMenu +{ +protected: + NCursesUserMenu( int lines, + int cols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = (T*)0) + : NCursesMenu(lines,cols,begin_y,begin_x) { + if (menu) + set_user ((void *)p_UserData); + } + +public: + NCursesUserMenu (NCursesMenuItem Items[], + const T* p_UserData = (T*)0, + bool with_frame=FALSE, + bool autoDelete_Items=FALSE) + : NCursesMenu (Items, with_frame, autoDelete_Items) { + if (menu) + set_user ((void *)p_UserData); + }; + + NCursesUserMenu (NCursesMenuItem Items[], + int lines, + int cols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = (T*)0, + bool with_frame=FALSE) + : NCursesMenu (Items, lines, cols, begin_y, begin_x, with_frame) { + if (menu) + set_user ((void *)p_UserData); + }; + + virtual ~NCursesUserMenu() { + }; + + inline T* UserData (void) const { + return (T*)get_user (); + }; + + inline virtual void setUserData (const T* p_UserData) { + if (menu) + set_user ((void *)p_UserData); + } +}; + +#endif // _CURSESM_H diff --git a/contrib/ncurses/c++/cursesmain.cc b/contrib/ncurses/c++/cursesmain.cc new file mode 100644 index 000000000000..09400b8d690a --- /dev/null +++ b/contrib/ncurses/c++/cursesmain.cc @@ -0,0 +1,51 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * + ****************************************************************************/ + +#include "cursesapp.h" +#include "internal.h" + +MODULE_ID("$Id: cursesmain.cc,v 1.5 1999/05/16 17:31:22 juergen Exp $") + +/* This is the default implementation of main() for a NCursesApplication. + * You only have to instantiate a static NCursesApplication object in your + * main application source file and link this module with your application. + */ +int main(int argc, char* argv[]) +{ + NCursesApplication* A = NCursesApplication::getApplication(); + if (!A) + return(1); + A->handleArgs(argc,argv); + ::endwin(); + return((*A)()); +} diff --git a/contrib/ncurses/c++/cursesp.cc b/contrib/ncurses/c++/cursesp.cc new file mode 100644 index 000000000000..e0c17aea7eb4 --- /dev/null +++ b/contrib/ncurses/c++/cursesp.cc @@ -0,0 +1,123 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1993,1997 * + ****************************************************************************/ + +#include "cursesp.h" +#include "internal.h" + +MODULE_ID("$Id: cursesp.cc,v 1.14 1999/05/16 17:30:51 juergen Exp $") + +NCursesPanel* NCursesPanel::dummy = (NCursesPanel*)0; + +void NCursesPanel::init() { + p = ::new_panel(w); + if (!p) + OnError(ERR); + + UserHook* hook = new UserHook; + hook->m_user = NULL; + hook->m_back = this; + hook->m_owner = p; + ::set_panel_userptr(p, (void *)hook); +} + +NCursesPanel::~NCursesPanel() { + UserHook* hook = (UserHook*)::panel_userptr(p); + assert(hook && hook->m_back==this && hook->m_owner==p); + delete hook; + ::del_panel(p); + ::update_panels(); +} + +void +NCursesPanel::redraw() { + PANEL *pan; + + pan = ::panel_above(NULL); + while (pan) { + ::touchwin(panel_window(pan)); + pan = ::panel_above(pan); + } + ::update_panels(); + ::doupdate(); +} + +int +NCursesPanel::refresh() { + ::update_panels(); + return doupdate(); +} + +int +NCursesPanel::noutrefresh() { + ::update_panels(); + return OK; +} + +void +NCursesPanel::boldframe(const char *title, const char* btitle) { + standout(); + frame(title, btitle); + standend(); +} + +void +NCursesPanel::frame(const char *title,const char *btitle) { + int err = OK; + if (!title && !btitle) { + err = box(); + } + else { + err = box(); + if (err==OK) + label(title,btitle); + } + OnError(err); +} + +void +NCursesPanel::label(const char *tLabel, const char *bLabel) { + if (tLabel) + centertext(0,tLabel); + if (bLabel) + centertext(maxy(),bLabel); +} + +void +NCursesPanel::centertext(int row,const char *label) { + if (label) { + 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 new file mode 100644 index 000000000000..51cb4cdbf847 --- /dev/null +++ b/contrib/ncurses/c++/cursesp.h @@ -0,0 +1,186 @@ +// * This makes emacs happy -*-Mode: C++;-*- +#ifndef _CURSESP_H +#define _CURSESP_H + +// $Id: cursesp.h,v 1.11 1999/07/31 09:46:05 juergen Exp $ + +#include <cursesw.h> + +extern "C" { +# include <panel.h> +} + +class NCursesPanel : public NCursesWindow { +protected: + PANEL *p; + static NCursesPanel *dummy; + +private: + // This structure is used for the panel's user data field to link the + // PANEL* to the C++ object and to provide extra space for a user pointer. + typedef struct { + void* m_user; // the pointer for the user's data + const NCursesPanel* m_back; // backward pointer to C++ object + const PANEL* m_owner; // the panel itself + } UserHook; + + void init(); // Initialize the panel object + +protected: + void set_user(void *user) { + UserHook* uptr = (UserHook*)::panel_userptr (p); + assert (uptr && uptr->m_back==this && uptr->m_owner==p); + uptr->m_user = user; + } + // Set the user pointer of the panel. + + void *get_user() { + UserHook* uptr = (UserHook*)::panel_userptr (p); + assert (uptr && uptr->m_back==this && uptr->m_owner==p); + return uptr->m_user; + } + + void OnError (int err) const THROWS((NCursesPanelException)) { + if (err==ERR) + THROW(new NCursesPanelException (this, err)); + } + // If err is equal to the curses error indicator ERR, an error handler + // is called. + +public: + NCursesPanel(int lines, + int cols, + int begin_y = 0, + int begin_x = 0) + : NCursesWindow(lines,cols,begin_y,begin_x) { + init(); + } + // Create a panel with this size starting at the requested position. + + NCursesPanel() : NCursesWindow(::stdscr) { init(); } + // This constructor creates the default Panel associated with the + // ::stdscr window + + virtual ~NCursesPanel(); + + // basic manipulation + inline void hide() { + OnError (::hide_panel(p)); + } + // Hide the panel. It stays in the stack but becomes invisible. + + inline void show() { + OnError (::show_panel(p)); + } + // Show the panel, i.e. make it visible. + + inline void top() { + OnError (::top_panel(p)); + } + // Make this panel the top panel in the stack. + + inline void bottom() { + OnError (::bottom_panel(p)); + } + // Make this panel the bottom panel in the stack. + // N.B.: The panel associated with ::stdscr is always on the bottom. So + // actually bottom() makes the panel the first above ::stdscr. + + virtual int mvwin(int y, int x) { + OnError(::move_panel(p, y, x)); + return OK; + } + + inline bool hidden() const { + return (::panel_hidden (p) ? TRUE : FALSE); + } + // Return TRUE if the panel is hidden, FALSE otherwise. + +/* The functions panel_above() and panel_below() are not reflected in + the NCursesPanel class. The reason for this is, that we cannot + assume that a panel retrieved by those operations is one wrapped + by a C++ class. Although this situation might be handled, we also + need a reverse mapping from PANEL to NCursesPanel which needs some + redesign of the low level stuff. At the moment, we define them in the + interface but they will always produce an error. */ + inline NCursesPanel& above() const { + OnError(ERR); + return *dummy; + } + + inline NCursesPanel& below() const { + OnError(ERR); + return *dummy; + } + + // Those two are rewrites of the corresponding virtual members of + // NCursesWindow + virtual int refresh(); + // Propagate all panel changes to the virtual screen and update the + // physical screen. + + virtual int noutrefresh(); + // Propagate all panel changes to the virtual screen. + + static void redraw(); + // Redraw all panels. + + // decorations + virtual void frame(const char* title=NULL, + const char* btitle=NULL); + // Put a frame around the panel and put the title centered in the top line + // and btitle in the bottom line. + + virtual void boldframe(const char* title=NULL, + const char* btitle=NULL); + // Same as frame(), but use highlighted attributes. + + virtual void label(const char* topLabel, + const char* bottomLabel); + // Put the title centered in the top line and btitle in the bottom line. + + virtual void centertext(int row,const char* label); + // Put the label text centered in the specified row. +}; + +/* We use templates to provide a typesafe mechanism to associate + * user data with a panel. A NCursesUserPanel<T> is a panel + * associated with some user data of type T. + */ +template<class T> class NCursesUserPanel : public NCursesPanel +{ +public: + NCursesUserPanel (int lines, + int cols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = (T*)0) + : NCursesPanel (lines, cols, begin_y, begin_x) { + if (p) + set_user ((void *)p_UserData); + }; + // This creates an user panel of the requested size with associated + // user data pointed to by p_UserData. + + NCursesUserPanel(const T* p_UserData = (T*)0) : NCursesPanel() { + if (p) + set_user((void *)p_UserData); + }; + // This creates an user panel associated with the ::stdscr and user data + // pointed to by p_UserData. + + virtual ~NCursesUserPanel() {}; + + T* UserData (void) const { + return (T*)get_user (); + }; + // Retrieve the user data associated with the panel. + + virtual void setUserData (const T* p_UserData) { + if (p) + set_user ((void *)p_UserData); + } + // Associate the user panel with the user data pointed to by p_UserData. +}; + +#endif // _CURSESP_H diff --git a/contrib/ncurses/c++/cursespad.cc b/contrib/ncurses/c++/cursespad.cc new file mode 100644 index 000000000000..78af365e1451 --- /dev/null +++ b/contrib/ncurses/c++/cursespad.cc @@ -0,0 +1,270 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1999 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1999 * + ****************************************************************************/ + +#include "etip.h" +#include "cursesw.h" +#include "internal.h" + +MODULE_ID("$Id: cursespad.cc,v 1.1 1999/07/31 09:47:21 juergen Exp $") + +NCursesPad::NCursesPad(int lines, int cols) + : NCursesWindow(), + viewWin((NCursesWindow*)0), + viewSub((NCursesWindow*)0), + h_gridsize(0), v_gridsize(0), + min_row(0), min_col(0) +{ + w = ::newpad(lines,cols); + if ((WINDOW*)0==w) { + count--; + err_handler("Cannot construct window"); + } + alloced = TRUE; +} + + +int NCursesPad::driver (int key) { + // Default implementation + switch(key) { + case KEY_UP: + // ======= + return REQ_PAD_UP; + case KEY_DOWN: + // ========= + return REQ_PAD_DOWN; + case KEY_LEFT: + // ========= + return REQ_PAD_LEFT; + case KEY_RIGHT: + // ========== + return REQ_PAD_RIGHT; + case KEY_EXIT: + // ========= + case CTRL('X'): + // ========== + return REQ_PAD_EXIT; + + default: return(key); + } +} + + +void NCursesPad::operator()(void) { + NCursesWindow* W = Win(); + + if ((NCursesWindow*)0 != W) { + int Width = W->width(); + int Height = W->height(); + + int req = REQ_PAD_REFRESH; + + W->keypad(TRUE); + W->meta(TRUE); + refresh(); + + do { + bool changed = FALSE; + + switch (req) { + case REQ_PAD_REFRESH: + // ================ + changed = TRUE; + break; + case REQ_PAD_LEFT: + // ============= + if (min_col > 0) { + changed = TRUE; + if (min_col < h_gridsize) + min_col = 0; + else + min_col -= h_gridsize; + } + else + OnNavigationError(req); + break; + case REQ_PAD_RIGHT: + // ============== + if (min_col < (width() - Width - 1)) { + changed = TRUE; + if (min_col > (width() - Width - h_gridsize - 1)) + min_col = width() - Width - 1; + else + min_col += h_gridsize; + } + else + OnNavigationError(req); + break; + case REQ_PAD_UP: + // =========== + if (min_row > 0) { + changed = TRUE; + if (min_row < v_gridsize) + min_row = 0; + else + min_row -= v_gridsize; + } + else + OnNavigationError(req); + break; + case REQ_PAD_DOWN: + // ============= + if (min_row < (height() - Height - 1)) { + changed = TRUE; + if (min_row > (height() - Height - v_gridsize - 1)) + min_row = height() - Height - 1; + else + min_row += v_gridsize; + } + else + OnNavigationError(req); + break; + + default: + OnUnknownOperation(req); + } + + if (changed) { + noutrefresh(); + W->syncup(); + OnOperation(req); + viewWin->refresh(); + } + } while( (req=driver(W->getch())) != REQ_PAD_EXIT ); + } +} + + +int NCursesPad::refresh() { + int res = noutrefresh(); + if (res==OK && ((NCursesWindow*)0 != viewWin)) { + res = (viewWin->refresh()); + } + return(res); +} + +int NCursesPad::noutrefresh() { + int res = OK; + NCursesWindow* W = Win(); + if ((NCursesWindow*)0 != W) { + res = copywin(*W,min_row,min_col, + 0,0,W->maxy(),W->maxx(), + FALSE); + if (res==OK) { + W->syncup(); + res = viewWin->noutrefresh(); + } + } + return (res); +} + +void NCursesPad::setWindow(NCursesWindow& view, + int v_grid = 1, + int h_grid = 1) +{ + viewWin = &view; + min_row = min_col = 0; + if (h_grid <=0 || v_grid <= 0) + err_handler("Illegal Gridsize"); + else { + h_gridsize = h_grid; + v_gridsize = v_grid; + } +} + +void NCursesPad::setSubWindow(NCursesWindow& sub) +{ + if ((NCursesWindow*)0 == viewWin) + err_handler("Pad has no viewport"); + if (!viewWin->isDescendant(sub)) + THROW(new NCursesException("NCursesFramePad", E_SYSTEM_ERROR)); + viewSub = ⊂ +} + +void NCursesFramedPad::OnOperation(int pad_req) { + NCursesWindow* W = Win(); + NCursesWindow* Win = getWindow(); + + if (((NCursesWindow*)0 != W) && ((NCursesWindow*)0 != Win)) { + int Width = W->width(); + int Height = W->height(); + int i, row, col, h_len, v_len; + + h_len = (Width*Width + width() - 1)/width(); + if (h_len==0) + h_len = 1; + if (h_len > Width) + h_len = Width; + + v_len = (Height*Height + height() - 1)/height(); + if (v_len==0) + v_len = 1; + if (v_len > Height) + v_len = Height; + + col = (min_col * Width + width() - 1) / width(); + if (col + h_len > Width) + col = Width - h_len; + + row = (min_row * Height + height() - 1) / height(); + if (row + v_len > Height) + row = Height - v_len; + + Win->vline(1,Width+1,Height); + Win->attron(A_REVERSE); + if (v_len>=2) { + Win->addch(row+1,Width+1,ACS_UARROW); + for(i=2;i<v_len;i++) + Win->addch(row+i,Width+1,' '); + Win->addch(row+v_len,Width+1,ACS_DARROW); + } + else { + for(i=1;i<=v_len;i++) + Win->addch(row+i,Width+1,' '); + } + Win->attroff(A_REVERSE); + + Win->hline(Height+1,1,Width); + Win->attron(A_REVERSE); + if (h_len >= 2) { + Win->addch(Height+1,col+1,ACS_LARROW); + for(i=2;i<h_len;i++) + Win->addch(Height+1,col+i,' '); + Win->addch(Height+1,col+h_len,ACS_RARROW); + } + else { + for(i=1;i<=h_len;i++) + Win->addch(Height+1,col+i,' '); + } + Win->attroff(A_REVERSE); + } +} diff --git a/contrib/ncurses/c++/cursesw.cc b/contrib/ncurses/c++/cursesw.cc new file mode 100644 index 000000000000..4973e3a715a5 --- /dev/null +++ b/contrib/ncurses/c++/cursesw.cc @@ -0,0 +1,431 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- + +/* + Copyright (C) 1989 Free Software Foundation + written by Eric Newton (newton@rocky.oswego.edu) + + This file is part of the GNU C++ Library. This library is free + software; you can redistribute it and/or modify it under the terms of + the GNU Library General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your + option) any later version. This library is distributed in the hope + that it will be useful, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU Library General Public License for more details. + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free Software + Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + + modified by Ulrich Drepper (drepper@karlsruhe.gmd.de) + and Anatoly Ivasyuk (anatoly@nick.csh.rit.edu) + + modified by Juergen Pfeifer (juergen.pfeifer@gmx.net) +*/ + +#include "cursesw.h" +#include "internal.h" + +MODULE_ID("$Id: cursesw.cc,v 1.13 1999/07/31 09:46:30 juergen Exp $") + +#define COLORS_NEED_INITIALIZATION -1 +#define COLORS_NOT_INITIALIZED 0 +#define COLORS_MONOCHROME 1 +#define COLORS_ARE_REALLY_THERE 2 + +// declare static variables for the class +long NCursesWindow::count = 0L; +bool NCursesWindow::b_initialized = FALSE; + +#if defined(__GNUG__) +# ifndef _IO_va_list +# define _IO_va_list char * +# endif +#endif + +int +NCursesWindow::scanw(const char* fmt, ...) +{ +#if defined(__GNUG__) + va_list args; + va_start(args, fmt); + char buf[BUFSIZ]; + int result = wgetstr(w, buf); + if (result == OK) { + strstreambuf ss(buf, BUFSIZ); + result = ss.vscan(fmt, (_IO_va_list)args); + } + va_end(args); + return result; +#else + return ERR; +#endif +} + + +int +NCursesWindow::scanw(int y, int x, const char* fmt, ...) +{ +#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) { + strstreambuf ss(buf, BUFSIZ); + result = ss.vscan(fmt, (_IO_va_list)args); + } + } + va_end(args); + return result; +#else + return ERR; +#endif +} + + +int +NCursesWindow::printw(const char * fmt, ...) +{ + va_list args; + va_start(args, fmt); + char buf[BUFSIZ]; + vsprintf(buf, fmt, args); + va_end(args); + return waddstr(w, buf); +} + + +int +NCursesWindow::printw(int y, int x, const char * fmt, ...) +{ + va_list args; + va_start(args, fmt); + int result = wmove(w, y, x); + if (result == OK) { + char buf[BUFSIZ]; + vsprintf(buf, fmt, args); + result = waddstr(w, buf); + } + va_end(args); + return result; +} + + +void +NCursesWindow::init(void) +{ + leaveok(0); + keypad(1); + meta(1); +} + +void +NCursesWindow::err_handler(const char *msg) const THROWS(NCursesException) +{ + THROW(new NCursesException(msg)); +} + +void +NCursesWindow::initialize() { + if (!b_initialized) { + ::initscr(); + b_initialized = TRUE; + if (colorInitialized==COLORS_NEED_INITIALIZATION) { + colorInitialized=COLORS_NOT_INITIALIZED; + useColors(); + } + ::noecho(); + ::cbreak(); + } +} + +NCursesWindow::NCursesWindow() { + if (!b_initialized) + initialize(); + + w = (WINDOW *)0; + init(); + alloced = FALSE; + subwins = par = sib = 0; + count++; +} + +NCursesWindow::NCursesWindow(int lines, int cols, int begin_y, int begin_x) +{ + if (!b_initialized) + initialize(); + + w = ::newwin(lines, cols, begin_y, begin_x); + if (w == 0) { + err_handler("Cannot construct window"); + } + init(); + + alloced = TRUE; + subwins = par = sib = 0; + count++; +} + +NCursesWindow::NCursesWindow(WINDOW* &window) +{ + if (!b_initialized) + initialize(); + + w = window; + init(); + alloced = FALSE; + subwins = par = sib = 0; + count++; +} + +NCursesWindow::NCursesWindow(NCursesWindow& win, int l, int c, + int begin_y, int begin_x, char absrel) +{ + if (absrel == 'a') { // absolute origin + begin_y -= win.begy(); + begin_x -= win.begx(); + } + + // Even though we treat subwindows as a tree, the standard curses + // library needs the `subwin' call to link to the parent in + // order to correctly perform refreshes, etc. + // Friendly enough, this also works for pads. + w = ::derwin(win.w, l, c, begin_y, begin_x); + if (w == 0) { + err_handler("Cannot construct subwindow"); + } + + par = &win; + sib = win.subwins; + win.subwins = this; + subwins = 0; + alloced = TRUE; + count++; +} + +NCursesWindow::NCursesWindow(NCursesWindow& win, bool do_box = TRUE) +{ + w = :: derwin(win.w,win.height()-2,win.width()-2,1,1); + if (w == 0) { + err_handler("Cannot construct subwindow"); + } + + par = &win; + sib = win.subwins; + win.subwins = this; + subwins = 0; + alloced = TRUE; + count++; + + if (do_box) { + win.box(); + win.touchwin(); + } +} + +NCursesWindow NCursesWindow::Clone() { + WINDOW *d = ::dupwin(w); + NCursesWindow W(d); + W.subwins = subwins; + W.sib = sib; + W.par = par; + W.alloced = alloced; + return W; +} + +typedef int (*RIPOFFINIT)(NCursesWindow&); +static RIPOFFINIT R_INIT[5]; // There can't be more +static int r_init_idx = 0; +static RIPOFFINIT* prip = R_INIT; + +extern "C" int _nc_ripoffline(int,int (*init)(WINDOW*,int)); + +NCursesWindow::NCursesWindow(WINDOW *win, int cols) { + w = win; + assert((w->_maxx+1)==cols); + alloced = FALSE; + subwins = par = sib = 0; +} + +int NCursesWindow::ripoff_init(WINDOW *w, int cols) +{ + int res = ERR; + + RIPOFFINIT init = *prip++; + if (init) { + NCursesWindow* W = new NCursesWindow(w,cols); + res = init(*W); + } + return res; +} + +int NCursesWindow::ripoffline(int ripoff_lines, + int (*init)(NCursesWindow& win)) { + int code = ::_nc_ripoffline(ripoff_lines,ripoff_init); + if (code==OK && init && ripoff_lines) { + R_INIT[r_init_idx++] = init; + } + return code; +} + +bool +NCursesWindow::isDescendant(NCursesWindow& win) { + for (NCursesWindow* p = subwins; p != NULL; p = p->sib) { + if (p==&win) + return TRUE; + else { + if (p->isDescendant(win)) + return TRUE; + } + } + return FALSE; +} + +void +NCursesWindow::kill_subwindows() +{ + for (NCursesWindow* p = subwins; p != 0; p = p->sib) { + p->kill_subwindows(); + if (p->alloced) { + if (p->w != 0) + ::delwin(p->w); + p->alloced = FALSE; + } + p->w = 0; // cause a run-time error if anyone attempts to use... + } +} + + +NCursesWindow::~NCursesWindow() +{ + kill_subwindows(); + + if (par != 0) { // Snip us from the parent's list of subwindows. + NCursesWindow * win = par->subwins; + NCursesWindow * trail = 0; + for (;;) { + if (win == 0) + break; + else if (win == this) { + if (trail != 0) + trail->sib = win->sib; + else + par->subwins = win->sib; + break; + } else { + trail = win; + win = win->sib; + } + } + } + + if (alloced && w != 0) + delwin(w); + + if (alloced) { + --count; + if (count == 0) { + ::endwin(); + } + else if (count < 0) { // cannot happen! + err_handler("Too many windows destroyed"); + } + } +} + +// --------------------------------------------------------------------- +// Color stuff +// +int NCursesWindow::colorInitialized = COLORS_NOT_INITIALIZED; + +void +NCursesWindow::useColors(void) +{ + if (colorInitialized == COLORS_NOT_INITIALIZED) { + if (b_initialized) { + if (::has_colors()) { + ::start_color(); + colorInitialized = COLORS_ARE_REALLY_THERE; + } + else + colorInitialized = COLORS_MONOCHROME; + } + else + colorInitialized = COLORS_NEED_INITIALIZATION; + } +} + +short +NCursesWindow::getcolor(int getback) const +{ + short fore, back; + + if (colorInitialized==COLORS_ARE_REALLY_THERE) { + if (pair_content(PAIR_NUMBER(w->_attrs), &fore, &back)) + err_handler("Can't get color pair"); + } + else { + // Monochrome means white on black + back = COLOR_BLACK; + fore = COLOR_WHITE; + } + return getback ? back : fore; +} + +int NCursesWindow::NumberOfColors() +{ + if (colorInitialized==COLORS_ARE_REALLY_THERE) + return COLORS; + else + return 1; // monochrome (actually there are two ;-) +} + +short +NCursesWindow::getcolor() const +{ + if (colorInitialized==COLORS_ARE_REALLY_THERE) + return PAIR_NUMBER(w->_attrs); + else + return 0; // we only have pair zero +} + +int +NCursesWindow::setpalette(short fore, short back, short pair) +{ + if (colorInitialized==COLORS_ARE_REALLY_THERE) + return init_pair(pair, fore, back); + else + return OK; +} + +int +NCursesWindow::setpalette(short fore, short back) +{ + if (colorInitialized==COLORS_ARE_REALLY_THERE) + return setpalette(fore, back, PAIR_NUMBER(w->_attrs)); + else + return OK; +} + + +int +NCursesWindow::setcolor(short pair) +{ + if (colorInitialized==COLORS_ARE_REALLY_THERE) { + if ((pair < 1) || (pair > COLOR_PAIRS)) + err_handler("Can't set color pair"); + + attroff(A_COLOR); + attrset(COLOR_PAIR(pair)); + } + return OK; +} + +extern "C" int _nc_has_mouse(void); + +bool NCursesWindow::has_mouse() const { + return ((::has_key(KEY_MOUSE) || ::_nc_has_mouse()) + ? TRUE : FALSE); +} diff --git a/contrib/ncurses/c++/cursesw.h b/contrib/ncurses/c++/cursesw.h new file mode 100644 index 000000000000..0d2665e30f5e --- /dev/null +++ b/contrib/ncurses/c++/cursesw.h @@ -0,0 +1,1375 @@ +// * This makes emacs happy -*-Mode: C++;-*- +#ifndef _CURSESW_H +#define _CURSESW_H + +// $Id: cursesw.h,v 1.16 1999/07/31 09:46:43 juergen 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 +#include <strstream.h> +#endif + +extern "C" { +# include <curses.h> +} + +/* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro. + Undefine it here, because NCursesWindow uses lines as a method. */ +#undef lines + +/* "Convert" macros to inlines. We'll define it as another symbol to avoid + * conflict with library symbols. + */ +#undef UNDEF +#define UNDEF(name) CUR_ ##name + +#ifdef addch +inline int UNDEF(addch)(chtype ch) { return addch(ch); } +#undef addch +#define addch UNDEF(addch) +#endif + +#ifdef echochar +inline int UNDEF(echochar)(chtype ch) { return echochar(ch); } +#undef echochar +#define echochar UNDEF(echochar) +#endif + +#ifdef insdelln +inline int UNDEF(insdelln)(int n) { return insdelln(n); } +#undef insdelln +#define insdelln UNDEF(insdelln) +#endif + +#ifdef addstr +/* The (char*) cast is to hack around missing const's */ +inline int UNDEF(addstr)(const char * str) { return addstr((char*)str); } +#undef addstr +#define addstr UNDEF(addstr) +#endif + +#ifdef attron +inline int UNDEF(attron)(chtype at) { return attron(at); } +#undef attron +#define attron UNDEF(attron) +#endif + +#ifdef attroff +inline int UNDEF(attroff)(chtype at) { return attroff(at); } +#undef attroff +#define attroff UNDEF(attroff) +#endif + +#ifdef attrset +inline chtype UNDEF(attrset)(chtype at) { return attrset(at); } +#undef attrset +#define attrset UNDEF(attrset) +#endif + +#ifdef color_set +inline chtype UNDEF(color_set)(short p,void* opts) { return color_set(p,opts); } +#undef color_set +#define color_set UNDEF(color_set) +#endif + +#ifdef border +inline int UNDEF(border)(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br) +{ return border(ls,rs,ts,bs,tl,tr,bl,br); } +#undef border +#define border UNDEF(border) +#endif + +#ifdef box +inline int UNDEF(box)(WINDOW *win, int v, int h) { return box(win, v, h); } +#undef box +#define box UNDEF(box) +#endif + +#ifdef mvwhline +inline int UNDEF(mvwhline)(WINDOW *win,int y,int x,chtype c,int n) { + return mvwhline(win,y,x,c,n); } +#undef mvwhline +#define mvwhline UNDEF(mvwhline) +#endif + +#ifdef mvwvline +inline int UNDEF(mvwvline)(WINDOW *win,int y,int x,chtype c,int n) { + return mvwvline(win,y,x,c,n); } +#undef mvwvline +#define mvwvline UNDEF(mvwvline) +#endif + +#ifdef clear +inline int UNDEF(clear)() { return clear(); } +#undef clear +#define clear UNDEF(clear) +#endif + +#ifdef clearok +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); +#endif + +#ifdef clrtobot +inline int UNDEF(clrtobot)() { return clrtobot(); } +#undef clrtobot +#define clrtobot UNDEF(clrtobot) +#endif + +#ifdef clrtoeol +inline int UNDEF(clrtoeol)() { return clrtoeol(); } +#undef clrtoeol +#define clrtoeol UNDEF(clrtoeol) +#endif + +#ifdef delch +inline int UNDEF(delch)() { return delch(); } +#undef delch +#define delch UNDEF(delch) +#endif + +#ifdef deleteln +inline int UNDEF(deleteln)() { return deleteln(); } +#undef deleteln +#define deleteln UNDEF(deleteln) +#endif + +#ifdef erase +inline int UNDEF(erase)() { return erase(); } +#undef erase +#define erase UNDEF(erase) +#endif + +#ifdef flushok +inline int UNDEF(flushok)(WINDOW* _win, bool _bf) { + return flushok(_win, _bf); } +#undef flushok +#define flushok UNDEF(flushok) +#else +#define _no_flushok +#endif + +#ifdef getch +inline int UNDEF(getch)() { return getch(); } +#undef getch +#define getch UNDEF(getch) +#endif + +#ifdef getstr +inline int UNDEF(getstr)(char *_str) { return getstr(_str); } +#undef getstr +#define getstr UNDEF(getstr) +#endif + +#ifdef instr +inline int UNDEF(instr)(char *_str) { return instr(_str); } +#undef instr +#define instr UNDEF(instr) +#endif + +#ifdef innstr +inline int UNDEF(innstr)(char *_str, int n) { return innstr(_str,n); } +#undef innstr +#define innstr UNDEF(innstr) +#endif + +#ifdef mvwinnstr +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) { + return mvinnstr(y,x,_str,n); } +#undef mvinnstr +#define mvinnstr UNDEF(mvinnstr) +#endif + +#ifdef winsstr +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) { + return mvwinsstr(w,y,x,_str); } +#undef mvwinsstr +#define mvwinsstr UNDEF(mvwinsstr) +#endif + +#ifdef insstr +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) { + return mvinsstr(y,x,_str); } +#undef mvinsstr +#define mvinsstr UNDEF(mvinsstr) +#endif + +#ifdef insnstr +inline int UNDEF(insnstr)(const char *_str, int n) { + return insnstr(_str,n); } +#undef insnstr +#define insnstr UNDEF(insnstr) +#endif + +#ifdef mvwinsnstr +inline int UNDEF(mvwinsnstr)(WINDOW *w, int y, int x,const char *_str, int n) { + return mvwinsnstr(w,y,x,_str,n); } +#undef mvwinsnstr +#define mvwinsnstr UNDEF(mvwinsnstr) +#endif + +#ifdef mvinsnstr +inline int UNDEF(mvinsnstr)(int y, int x,const char *_str, int n) { + return mvinsnstr(y,x,_str,n); } +#undef mvinsnstr +#define mvinsnstr UNDEF(mvinsnstr) +#endif + +#ifdef getnstr +inline int UNDEF(getnstr)(char *_str, int n) { return getnstr(_str,n); } +#undef getnstr +#define getnstr UNDEF(getnstr) +#endif + +#ifdef getyx +inline void UNDEF(getyx)(const WINDOW* win, int& y, int& x) { + getyx(win, y, x); } +#undef getyx +#define getyx UNDEF(getyx) +#endif + +#ifdef getbegyx +inline void UNDEF(getbegyx)(WINDOW* win, int& y, int& x) { getbegyx(win, y, x); } +#undef getbegyx +#define getbegyx UNDEF(getbegyx) +#endif + +#ifdef getmaxyx +inline void UNDEF(getmaxyx)(WINDOW* win, int& y, int& x) { getmaxyx(win, y, x); } +#undef getmaxyx +#define getmaxyx UNDEF(getmaxyx) +#endif + +#ifdef hline +inline int UNDEF(hline)(chtype ch, int n) { return hline(ch, n); } +#undef hline +#define hline UNDEF(hline) +#endif + +#ifdef inch +inline chtype UNDEF(inch)() { return inch(); } +#undef inch +#define inch UNDEF(inch) +#endif + +#ifdef insch +inline int UNDEF(insch)(char c) { return insch(c); } +#undef insch +#define insch UNDEF(insch) +#endif + +#ifdef insertln +inline int UNDEF(insertln)() { return insertln(); } +#undef insertln +#define insertln UNDEF(insertln) +#endif + +#ifdef leaveok +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); +#endif + +#ifdef move +inline int UNDEF(move)(int x, int y) { return move(x, y); } +#undef move +#define move UNDEF(move) +#endif + +#ifdef refresh +inline int UNDEF(refresh)() { return refresh(); } +#undef refresh +#define refresh UNDEF(refresh) +#endif + +#ifdef redrawwin +inline int UNDEF(redrawwin)(WINDOW *win) { return redrawwin(win); } +#undef redrawwin +#define redrawwin UNDEF(redrawwin) +#endif + +#ifdef scrl +inline int UNDEF(scrl)(int l) { return scrl(l); } +#undef scrl +#define scrl UNDEF(scrl) +#endif + +#ifdef scroll +inline int UNDEF(scroll)(WINDOW *win) { return scroll(win); } +#undef scroll +#define scroll UNDEF(scroll) +#endif + +#ifdef scrollok +inline int UNDEF(scrollok)(WINDOW* win, bool bf) { return scrollok(win, bf); } +#undef scrollok +#define scrollok UNDEF(scrollok) +#else +#if defined(__NCURSES_H) +extern "C" int scrollok(WINDOW*, bool); +#else +extern "C" int scrollok(WINDOW*, char); +#endif +#endif + +#ifdef setscrreg +inline int UNDEF(setscrreg)(int t, int b) { return setscrreg(t, b); } +#undef setscrreg +#define setscrreg UNDEF(setscrreg) +#endif + +#ifdef standend +inline int UNDEF(standend)() { return standend(); } +#undef standend +#define standend UNDEF(standend) +#endif + +#ifdef standout +inline int UNDEF(standout)() { return standout(); } +#undef standout +#define standout UNDEF(standout) +#endif + +#ifdef subpad +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) +#endif + +#ifdef timeout +inline void UNDEF(timeout)(int delay) { timeout(delay); } +#undef timeout +#define timeout UNDEF(timeout) +#endif + +#ifdef touchline +inline int UNDEF(touchline)(WINDOW *win, int s, int c) +{ return touchline(win,s,c); } +#undef touchline +#define touchline UNDEF(touchline) +#endif + +#ifdef touchwin +inline int UNDEF(touchwin)(WINDOW *win) { return touchwin(win); } +#undef touchwin +#define touchwin UNDEF(touchwin) +#endif + +#ifdef untouchwin +inline int UNDEF(untouchwin)(WINDOW *win) { return untouchwin(win); } +#undef untouchwin +#define untouchwin UNDEF(untouchwin) +#endif + +#ifdef vline +inline int UNDEF(vline)(chtype ch, int n) { return vline(ch, n); } +#undef vline +#define vline UNDEF(vline) +#endif + +#ifdef waddstr +inline int UNDEF(waddstr)(WINDOW *win, char *str) { return waddstr(win, str); } +#undef waddstr +#define waddstr UNDEF(waddstr) +#endif + +#ifdef waddchstr +inline int UNDEF(waddchstr)(WINDOW *win, chtype *at) { return waddchstr(win, at); } +#undef waddchstr +#define waddchstr UNDEF(waddchstr) +#endif + +#ifdef wstandend +inline int UNDEF(wstandend)(WINDOW *win) { return wstandend(win); } +#undef wstandend +#define wstandend UNDEF(wstandend) +#endif + +#ifdef wstandout +inline int UNDEF(wstandout)(WINDOW *win) { return wstandout(win); } +#undef wstandout +#define wstandout UNDEF(wstandout) +#endif + + +#ifdef wattroff +inline int UNDEF(wattroff)(WINDOW *win, int att) { return wattroff(win, att); } +#undef wattroff +#define wattroff UNDEF(wattroff) +#endif + +#ifdef chgat +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) +#endif + +#ifdef mvchgat +inline int UNDEF(mvchgat)(int y, int x, int n, + attr_t attr, short color, const void *opts) { + return mvchgat(y,x,n,attr,color,opts); } +#undef mvchgat +#define mvchgat UNDEF(mvchgat) +#endif + +#ifdef mvwchgat +inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n, + attr_t attr, short color, const void *opts) { + return mvwchgat(win,y,x,n,attr,color,opts); } +#undef mvwchgat +#define mvwchgat UNDEF(mvwchgat) +#endif + +#ifdef wattrset +inline int UNDEF(wattrset)(WINDOW *win, int att) { return wattrset(win, att); } +#undef wattrset +#define wattrset UNDEF(wattrset) +#endif + +#ifdef winch +inline chtype UNDEF(winch)(const WINDOW* win) { return winch(win); } +#undef winch +#define winch UNDEF(winch) +#endif + +#ifdef mvwaddch +inline int UNDEF(mvwaddch)(WINDOW *win, int y, int x, const chtype ch) +{ return mvwaddch(win, y, x, ch); } +#undef mvwaddch +#define mvwaddch UNDEF(mvwaddch) +#endif + +#ifdef mvwaddchnstr +inline int UNDEF(mvwaddchnstr)(WINDOW *win, int y, int x, chtype *str, int n) +{ return mvwaddchnstr(win, y, x, str, n); } +#undef mvwaddchnstr +#define mvwaddchnstr UNDEF(mvwaddchnstr) +#endif + +#ifdef mvwaddchstr +inline int UNDEF(mvwaddchstr)(WINDOW *win, int y, int x, chtype *str) +{ return mvwaddchstr(win, y, x, str); } +#undef mvwaddchstr +#define mvwaddchstr UNDEF(mvwaddchstr) +#endif + +#ifdef addnstr +inline int UNDEF(addnstr)(const char *str, int n) +{ return addnstr((char*)str, n); } +#undef addnstr +#define addnstr UNDEF(addnstr) +#endif + +#ifdef mvwaddnstr +inline int UNDEF(mvwaddnstr)(WINDOW *win, int y, int x, const char *str, int n) +{ return mvwaddnstr(win, y, x, (char*)str, n); } +#undef mvwaddnstr +#define mvwaddnstr UNDEF(mvwaddnstr) +#endif + +#ifdef mvwaddstr +inline int UNDEF(mvwaddstr)(WINDOW *win, int y, int x, const char * str) +{ return mvwaddstr(win, y, x, (char*)str); } +#undef mvwaddstr +#define mvwaddstr UNDEF(mvwaddstr) +#endif + +#ifdef mvwdelch +inline int UNDEF(mvwdelch)(WINDOW *win, int y, int x) +{ return mvwdelch(win, y, x); } +#undef mvwdelch +#define mvwdelch UNDEF(mvwdelch) +#endif + +#ifdef mvwgetch +inline int UNDEF(mvwgetch)(WINDOW *win, int y, int x) { return mvwgetch(win, y, x);} +#undef mvwgetch +#define mvwgetch UNDEF(mvwgetch) +#endif + +#ifdef mvwgetstr +inline int UNDEF(mvwgetstr)(WINDOW *win, int y, int x, char *str) +{return mvwgetstr(win,y,x, str);} +#undef mvwgetstr +#define mvwgetstr UNDEF(mvwgetstr) +#endif + +#ifdef mvwgetnstr +inline int UNDEF(mvwgetnstr)(WINDOW *win, int y, int x, char *str, int n) +{return mvwgetnstr(win,y,x, str,n);} +#undef mvwgetnstr +#define mvwgetnstr UNDEF(mvwgetnstr) +#endif + +#ifdef mvwinch +inline chtype UNDEF(mvwinch)(WINDOW *win, int y, int x) { + return mvwinch(win, y, x);} +#undef mvwinch +#define mvwinch UNDEF(mvwinch) +#endif + +#ifdef mvwinsch +inline int UNDEF(mvwinsch)(WINDOW *win, int y, int x, char c) +{ return mvwinsch(win, y, x, c); } +#undef mvwinsch +#define mvwinsch UNDEF(mvwinsch) +#endif + +#ifdef mvaddch +inline int UNDEF(mvaddch)(int y, int x, chtype ch) +{ return mvaddch(y, x, ch); } +#undef mvaddch +#define mvaddch UNDEF(mvaddch) +#endif + +#ifdef mvaddnstr +inline int UNDEF(mvaddnstr)(int y, int x, const char *str, int n) +{ return mvaddnstr(y, x, (char*)str, n); } +#undef mvaddnstr +#define mvaddnstr UNDEF(mvaddnstr) +#endif + +#ifdef mvaddstr +inline int UNDEF(mvaddstr)(int y, int x, const char * str) +{ return mvaddstr(y, x, (char*)str); } +#undef mvaddstr +#define mvaddstr UNDEF(mvaddstr) +#endif + +#ifdef mvdelch +inline int UNDEF(mvdelch)(int y, int x) { return mvdelch(y, x);} +#undef mvdelch +#define mvdelch UNDEF(mvdelch) +#endif + +#ifdef mvgetch +inline int UNDEF(mvgetch)(int y, int x) { return mvgetch(y, x);} +#undef mvgetch +#define mvgetch UNDEF(mvgetch) +#endif + +#ifdef mvgetstr +inline int UNDEF(mvgetstr)(int y, int x, char *str) {return mvgetstr(y, x, str);} +#undef mvgetstr +#define mvgetstr UNDEF(mvgetstr) +#endif + +#ifdef mvgetnstr +inline int UNDEF(mvgetnstr)(int y, int x, char *str, int n) { + return mvgetnstr(y, x, str,n);} +#undef mvgetnstr +#define mvgetnstr UNDEF(mvgetnstr) +#endif + +#ifdef mvinch +inline chtype UNDEF(mvinch)(int y, int x) { return mvinch(y, x);} +#undef mvinch +#define mvinch UNDEF(mvinch) +#endif + +#ifdef mvinsch +inline int UNDEF(mvinsch)(int y, int x, char c) +{ return mvinsch(y, x, c); } +#undef mvinsch +#define mvinsch UNDEF(mvinsch) +#endif + +#ifdef napms +inline void UNDEF(napms)(unsigned long x) { napms(x); } +#undef napms +#define napms UNDEF(napms) +#endif + +#ifdef fixterm +inline int UNDEF(fixterm)(void) { return fixterm(); } +#undef fixterm +#define fixterm UNDEF(fixterm) +#endif + +#ifdef resetterm +inline int UNDEF(resetterm)(void) { return resetterm(); } +#undef resetterm +#define resetterm UNDEF(resetterm) +#endif + +#ifdef saveterm +inline int UNDEF(saveterm)(void) { return saveterm(); } +#undef saveterm +#define saveterm UNDEF(saveterm) +#endif + +#ifdef crmode +inline int UNDEF(crmode)(void) { return crmode(); } +#undef crmode +#define crmode UNDEF(crmode) +#endif + +#ifdef nocrmode +inline int UNDEF(nocrmode)(void) { return nocrmode(); } +#undef nocrmode +#define nocrmode UNDEF(nocrmode) +#endif + +#ifdef getbkgd +inline chtype UNDEF(getbkgd)(const WINDOW *win) { return getbkgd(win); } +#undef getbkgd +#define getbkgd UNDEF(getbkgd) +#endif + +#ifdef bkgd +inline int UNDEF(bkgd)(chtype ch) { return bkgd(ch); } +#undef bkgd +#define bkgd UNDEF(bkgd) +#endif + +#ifdef bkgdset +inline void UNDEF(bkgdset)(chtype ch) { bkgdset(ch); } +#undef bkgdset +#define bkgdset UNDEF(bkgdset) +#endif + +/* + * + * C++ class for windows. + * + * + */ + +class NCursesWindow +{ + friend class NCursesMenu; + friend class NCursesForm; + +private: + static bool b_initialized; + static void initialize(); + static int ripoff_init(WINDOW *,int); + + void init(); + + short getcolor(int getback) const; + + static int setpalette(short fore, short back, short pair); + static int colorInitialized; + + // This private constructor is only used during the initialization + // of windows generated by ripoffline() calls. + NCursesWindow(WINDOW* win, int cols); + +protected: + void err_handler(const char *) const THROWS(NCursesException); + // Signal an error with the given message text. + + static long count; // count of all active windows: + // 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. + + /* Only for use by derived classes. They are then in charge to + fill the member variables correctly. */ + NCursesWindow(); + +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 + int begin_y, // absolute or relative + int begin_x, // origins: + char absrel = 'a');// if `a', by & bx are + // absolute screen pos, else if `r', they are relative to par origin + + NCursesWindow(NCursesWindow& par,// parent window + bool do_box = TRUE); + // this is the very common case that we want to create the subwindow that + // is two lines and two columns smaller and begins at (1,1). + // We may automatically request the box around it. + + virtual ~NCursesWindow(); + + NCursesWindow Clone(); + // Make an exact copy of the window. + + // Initialization. + static void useColors(void); + // Call this routine very early if you want to have colors. + + static int ripoffline(int ripoff_lines, + 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. + // 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. + + // ------------------------------------------------------------------------- + // terminal status + // ------------------------------------------------------------------------- + int lines() const { return LINES; } + // Number of lines on terminal, *not* window + + int cols() const { return COLS; } + // Number of cols on terminal, *not* window + + int tabsize() const { return TABSIZE; } + // Size of a tab on terminal, *not* window + + static int NumberOfColors(); + // Number of available colors + + int colors() const { return NumberOfColors(); } + // Number of available colors + + // ------------------------------------------------------------------------- + // window status + // ------------------------------------------------------------------------- + int height() const { return maxy() + 1; } + // Number of lines in this window + + int width() const { return maxx() + 1; } + // Number of columns in this window + + int begx() const { return w->_begx; } + // Column of top left corner relative to stdscr + + int begy() const { return w->_begy; } + // Line of top left corner relative to stdscr + + int maxx() const { return w->_maxx; } + // Largest x coord in window + + int maxy() const { return w->_maxy; } + // Largest y coord in window + + short getcolor() const; + // Actual color pair + + short foreground() const { return getcolor(0); } + // Actual foreground color + + short background() const { return getcolor(1); } + // Actual background color + + int setpalette(short fore, short back); + // Set color palette entry + + int setcolor(short pair); + // Set actually used palette entry + + // ------------------------------------------------------------------------- + // window positioning + // ------------------------------------------------------------------------- + virtual int mvwin(int begin_y, int begin_x) { + return ::mvwin(w,begin_y,begin_x); } + // Move window to new position with the new position as top left corner. + // This is virtual because it is redefined in NCursesPanel. + + // ------------------------------------------------------------------------- + // coordinate positioning + // ------------------------------------------------------------------------- + int move(int y, int x) { return ::wmove(w, y, x); } + // Move cursor the this position + + void getyx(int& y, int& x) const { ::getyx(w, y, x); } + // Get current position of the cursor + + 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 + // ------------------------------------------------------------------------- + int getch() { return ::wgetch(w); } + // Get a keystroke from the window. + + 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) { + 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) { + return ::mvwgetnstr(w,y,x,str,n); } + // Move the cursor to the requested position and then perform the getstr() + // as described above. + + int instr(char *s, int n=-1) { return ::winnstr(w,s,n); } + // Get a string of characters from the window into the buffer s. Retrieve + // at most n characters, if n is negative retrieve all characters up to the + // end of the current line. Attributes are stripped from the characters. + + int instr(int y, int x, char *s, int n=-1) { + return ::mvwinnstr(w,y,x,s,n); } + // Move the cursor to the requested position and then perform the instr() + // as described above. + + int scanw(const char* fmt, ...) + // Perform a scanw function from the window. This only works if you're + // using the GNU C++ compiler. +#if __GNUG__ >= 2 + __attribute__ ((format (scanf, 2, 3))); +#else + ; +#endif + + int scanw(int y, int x, const char* fmt, ...) + // Move the cursor to the requested position and then perform a scanw + // from the window. This nly works if you're using the GNU C++ compiler. +#if __GNUG__ >= 2 + __attribute__ ((format (scanf, 4, 5))); +#else + ; +#endif + + // ------------------------------------------------------------------------- + // output + // ------------------------------------------------------------------------- + int addch(const chtype ch) { return ::waddch(w, ch); } + // Put attributed character to the window. + + int addch(int y, int x, const chtype ch) { + return ::mvwaddch(w,y,x,ch); } + // Move cursor to the requested position and then put attributed character + // to the window. + + 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) { + 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. + + int addstr(int y, int x, const char * str, int n=-1) { + return ::mvwaddnstr(w,y,x,(char*)str,n); } + // Move the cursor to the requested position and then perform the addstr + // as described above. + + int printw(const char* fmt, ...) + // Do a formatted print to the window. +#if __GNUG__ >= 2 + __attribute__ ((format (printf, 2, 3))); +#else + ; +#endif + + int printw(int y, int x, const char * fmt, ...) + // Move the cursor and then do a formatted print to the window. +#if __GNUG__ >= 2 + __attribute__ ((format (printf, 4, 5))); +#else + ; +#endif + + chtype inch() const { return ::winch(w); } + // Retrieve attributed character under the current cursor position. + + chtype inch(int y, int x) { return ::mvwinch(w,y,x); } + // Move cursor to requested position and then retrieve attributed character + // at this position. + + int insch(chtype ch) { return ::winsch(w, ch); } + // Insert attributed character into the window before current cursor + // position. + + int insch(int y, int x, chtype ch) { + return ::mvwinsch(w,y,x,ch); } + // Move cursor to requested position and then insert the attributed + // character before that position. + + 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. + + int insstr(const char *s, int n=-1) { + return ::winsnstr(w,s,n); } + // 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() + // as described above. + + int attron (chtype at) { return ::wattron (w, at); } + // Switch on the window attributes; + + int attroff(chtype at) { return ::wattroff(w, at); } + // Switch off the window attributes; + + int attrset(chtype at) { return ::wattrset(w, at); } + // Set the window attributes; + + int color_set(short color_pair_number, void* opts=NULL) { + return ::wcolor_set(w, color_pair_number, opts); } + // Set the window color attribute; + + int chgat(int n,attr_t attr, short color, const void *opts=NULL) { + return ::wchgat(w,n,attr,color,opts); } + // Change the attributes of the next n characters in the current line. If + // n is negative or greater than the number of remaining characters in the + // line, the attributes will be changed up to the end of the line. + + int chgat(int y, int x, + int n,attr_t attr, short color, const void *opts=NULL) { + return ::mvwchgat(w,y,x,n,attr,color,opts); } + // Move the cursor to the requested position and then perform chgat() as + // described above. + + // ------------------------------------------------------------------------- + // background + // ------------------------------------------------------------------------- + chtype getbkgd() const { return ::getbkgd(w); } + // Get current background setting. + + int bkgd(const chtype ch) { return ::wbkgd(w,ch); } + // Set the background property and apply it to the window. + + void bkgdset(chtype ch) { ::wbkgdset(w,ch); } + // Set the background property. + + // ------------------------------------------------------------------------- + // borders + // ------------------------------------------------------------------------- + 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 + // to find a "nice" character. + + int border(chtype left=0, chtype right=0, + chtype top =0, chtype bottom=0, + chtype top_left =0, chtype top_right=0, + chtype bottom_left =0, chtype bottom_right=0) { + return ::wborder(w,left,right,top,bottom,top_left,top_right, + bottom_left,bottom_right); } + // Draw a border around the window with the given characters for the + // various parts of the border. If you pass zero for a character, curses + // will try to find "nice" characters. + + // ------------------------------------------------------------------------- + // lines and boxes + // ------------------------------------------------------------------------- + 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. + + int hline(int y, int x, int len, chtype ch=0) { + return ::mvwhline(w,y,x,ch,len); } + // Move the cursor to the requested position and then draw a horizontal line. + + int vline(int len, chtype ch=0) { return ::wvline(w, ch, len); } + // Draw a vertical line of len characters with the given character. If + // you pass zero for the character, curses will try to find a "nice" one. + + 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 + // ------------------------------------------------------------------------- + int erase() { return ::werase(w); } + // Erase the window. + + int clear() { return ::wclear(w); } + // Clear the window. + + int clearok(bool bf) { return ::clearok(w, bf); } + // Set/Reset the clear flag. If set, the next refresh() will clear the + // screen. + + int clrtobot() { return ::wclrtobot(w); } + // Clear to the end of the window. + + int clrtoeol() { return ::wclrtoeol(w); } + // Clear to the end of the line. + + int delch() { return ::wdelch(w); } + // 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 + // cursor. + + int deleteln() { return ::winsdelln(w,-1); } + // Delete the current line. + + // ------------------------------------------------------------------------- + // screen control + // ------------------------------------------------------------------------- + int scroll(int amount=1) { return ::wscrl(w,amount); } + // Scroll amount lines. If amount is positive, scroll up, otherwise + // scroll down. + + int scrollok(bool bf) { return ::scrollok(w, bf); } + // If bf is TRUE, window scrolls if cursor is moved off the bottom + // edge of the window or a scrolling region, otherwise the cursor is left + // at the bottom line. + + int setscrreg(int from, int to) { + return ::wsetscrreg(w,from,to); } + // Define a soft scrolling region. + + int idlok(bool bf) { return ::idlok(w, bf); } + // If bf is TRUE, use insert/delete line hardware support if possible. + // Otherwise do it in software. + + + void idcok(bool bf) { ::idcok(w, bf); } + // If bf is TRUE, use insert/delete character hardware support if possible. + // Otherwise do it in software. + + int touchwin() { return ::wtouchln(w,0,height(),1); } + // Mark the whole window as modified. + + int untouchwin() { return ::wtouchln(w,0,height(),0); } + // Mark the whole window as unmodified. + + 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 { + return (::is_linetouched(w,line) ? TRUE:FALSE); } + // Return TRUE if line is marked as changed, FALSE otherwise + + bool is_wintouched() const { + return (::is_wintouched(w) ? TRUE:FALSE); } + // 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 + // it is after the update. + + int redrawln(int from, int n) { return ::wredrawln(w,from,n); } + // Redraw n lines starting from the requested line + + int redrawwin() { return ::wredrawln(w,0,height()); } + // Redraw the whole window + + int doupdate() { return ::doupdate(); } + // Do all outputs to make the physical screen looking like the virtual one + + void syncdown() { ::wsyncdown(w); } + // Propagate the changes down to all descendant windows + + void syncup() { ::wsyncup(w); } + // Propagate the changes up in the hierarchy + + void cursyncup() { ::wcursyncup(w); } + // Position the cursor in all ancestor windows corresponding to our setting + + int syncok(bool bf) { return ::syncok(w,bf); } + // If called with bf=TRUE, syncup() is called whenever the window is changed + +#ifndef _no_flushok + int flushok(bool bf) { return ::flushok(w, bf); } +#endif + + void immedok(bool bf) { ::immedok(w,bf); } + // If called with bf=TRUE, any change in the window will cause an + // automatic immediate refresh() + + int keypad(bool bf) { return ::keypad(w, bf); } + // If called with bf=TRUE, the application will interpret function keys. + + 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. + + int standout() { return ::wstandout(w); } + // Enable "standout" attributes + + int standend() { return ::wstandend(w); } + // Disable "standout" attributes + + // ------------------------------------------------------------------------- + // The next two are virtual, because we redefine them in the + // NCursesPanel class. + // ------------------------------------------------------------------------- + virtual int refresh() { return ::wrefresh(w); } + // Propagate the changes in this window to the virtual screen and call + // doupdate(). This is redefined in NCursesPanel. + + virtual int noutrefresh() { return ::wnoutrefresh(w); } + // Propagate the changes in this window to the virtual screen. This is + // redefined in NCursesPanel. + + // ------------------------------------------------------------------------- + // multiple window control + // ------------------------------------------------------------------------- + int overlay(NCursesWindow& win) { + return ::overlay(w, win.w); } + // Overlay this window over win. + + int overwrite(NCursesWindow& win) { + return ::overwrite(w, win.w); } + // Overwrite win with this window. + + int copywin(NCursesWindow& win, + int sminrow, int smincol, + int dminrow, int dmincol, + int dmaxrow, int dmaxcol, bool overlay=TRUE) { + return ::copywin(w,win.w,sminrow,smincol,dminrow,dmincol, + dmaxrow,dmaxcol,(int)(overlay?1:0)); } + // Overlay or overwrite the rectangle in win given by dminrow,dmincol, + // dmaxrow,dmaxcol with the rectangle in this window beginning at + // sminrow,smincol. + + // ------------------------------------------------------------------------- + // Mouse related + // ------------------------------------------------------------------------- + bool has_mouse() const; + // Return TRUE if terminal supports a mouse, FALSE otherwise + + // ------------------------------------------------------------------------- + // traversal support + // ------------------------------------------------------------------------- + NCursesWindow* child() { return subwins; } + // Get the first child window. + + NCursesWindow* sibling() { return sib; } + // Get the next child of my parent. + + NCursesWindow* parent() { return par; } + // Get my parent. + + bool isDescendant(NCursesWindow& win); + // Return TRUE if win is a descendant of this. +}; + +// ------------------------------------------------------------------------- +// We leave this here for compatibility reasons. +// ------------------------------------------------------------------------- +class NCursesColorWindow : public NCursesWindow { +public: + NCursesColorWindow(WINDOW* &window) // useful only for stdscr + : NCursesWindow(window) { + useColors(); } + + NCursesColorWindow(int lines, // number of lines + int cols, // number of columns + int begin_y, // line origin + int begin_x) // col origin + : NCursesWindow(lines,cols,begin_y,begin_x) { + useColors(); } + + NCursesColorWindow(NCursesWindow& par,// parent window + int lines, // number of lines + int cols, // number of columns + int begin_y, // absolute or relative + int begin_x, // origins: + 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(); } +}; + +// ------------------------------------------------------------------------- +// Pad Support. We allow an association of a pad with a "real" window +// through which the pad may be viewed. +// ------------------------------------------------------------------------- +class NCursesPad : public NCursesWindow { +private: + NCursesWindow* viewWin; // the "viewport" window + NCursesWindow* viewSub; // the "viewport" subwindow + + int h_gridsize, v_gridsize; + +protected: + int min_row, min_col; // top left row/col of the pads display area + + NCursesWindow* Win(void) const { + // Get the window into which the pad should be copied (if any) + return (viewSub?viewSub:(viewWin?viewWin:NULL)); + } + + typedef enum { + REQ_PAD_REFRESH = KEY_MAX + 1, + REQ_PAD_UP, + REQ_PAD_DOWN, + REQ_PAD_LEFT, + REQ_PAD_RIGHT, + REQ_PAD_EXIT + } Pad_Request; + + static const Pad_Request PAD_LOW = REQ_PAD_REFRESH; // lowest op-code + static const Pad_Request PAD_HIGH = REQ_PAD_EXIT; // highest op-code + + NCursesWindow* getWindow(void) const { + return viewWin; + } + + NCursesWindow* getSubWindow(void) const { + return viewSub; + } + + virtual int driver (int key); // Virtualize keystroke key + // The driver translates the keystroke c into an Pad_Request + + virtual void OnUnknownOperation(int pad_req) { + ::beep(); + } + // This is called if the driver returns an unknown op-code + + virtual void OnNavigationError(int pad_req) { + ::beep(); + } + // This is called if a navigation request couldn't be satisfied + + virtual void OnOperation(int pad_req) { + }; + // OnOperation is called if a Pad_Operation was executed and just before + // the refresh() operation is done. + +public: + NCursesPad(int lines, int cols); + // create a pad with the given size + + virtual ~NCursesPad() {} + + 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. + + int refresh(int pminrow, int pmincol, + int sminrow, int smincol, + int smaxrow, int smaxcol) { + return ::prefresh(w,pminrow,pmincol, + sminrow,smincol,smaxrow,smaxcol); + } + // The coordinates sminrow,smincol,smaxrow,smaxcol describe a rectangle + // on the screen. <b>refresh</b> copies a rectangle of this size beginning + // with top left corner pminrow,pmincol onto the screen and calls doupdate(). + + int noutrefresh(); + // If a viewport is defined the pad is displayed in this window, otherwise + // this is a noop. + + int noutrefresh(int pminrow, int pmincol, + int sminrow, int smincol, + int smaxrow, int smaxcol) { + return ::pnoutrefresh(w,pminrow,pmincol, + sminrow,smincol,smaxrow,smaxcol); + } + // Does the same like 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. + + virtual void setSubWindow(NCursesWindow& sub); + // Use the subwindow "sub" of the viewport window for the actual viewing. + // The full viewport window is usually used to provide some decorations + // like frames, titles etc. + + virtual void operator() (void); + // Perform Pad's operation +}; + +// 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 { +private: + static const char* const msg = "Operation not allowed"; + +protected: + virtual void OnOperation(int pad_req); + +public: + NCursesFramedPad(NCursesWindow& win, int lines, int cols, + int v_grid = 1, int h_grid = 1) + : NCursesPad(lines,cols) { + NCursesPad::setWindow(win,v_grid,h_grid); + NCursesPad::setSubWindow(*(new NCursesWindow(win))); + } + // Construct the FramedPad with the given Window win as viewport. + + virtual ~NCursesFramedPad() { + delete getSubWindow(); + } + + void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) { + err_handler(msg); + } + // Disable this call; the viewport is already defined + + void setSubWindow(NCursesWindow& sub) { + err_handler(msg); + } + // Disable this call; the viewport subwindow is already defined + +}; + +#endif // _CURSESW_H diff --git a/contrib/ncurses/c++/cursslk.cc b/contrib/ncurses/c++/cursslk.cc new file mode 100644 index 000000000000..82ff83e11954 --- /dev/null +++ b/contrib/ncurses/c++/cursslk.cc @@ -0,0 +1,121 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * + ****************************************************************************/ + +#include "cursslk.h" +#include "cursesapp.h" +#include "internal.h" + +MODULE_ID("$Id: cursslk.cc,v 1.5 1999/05/16 17:31:01 juergen Exp $") + +void Soft_Label_Key_Set::Soft_Label_Key::operator=(char *text) { + delete[] label; + label = new char[1 + ::strlen(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::format = None; + +void Soft_Label_Key_Set::init() { + slk_array = new Soft_Label_Key[num_labels]; + for(int i=0; i < num_labels; i++) { + slk_array[i].num = i+1; + } + b_attrInit = FALSE; +} + +Soft_Label_Key_Set::Soft_Label_Key_Set() { + if (format==None) + Error("No default SLK layout"); + init(); +} + +Soft_Label_Key_Set::Soft_Label_Key_Set(Soft_Label_Key_Set::Label_Layout fmt) { + if (fmt==None) + Error("Invalid SLK Layout"); + if (count++==0) { + format = fmt; + if (ERR == ::slk_init((int)fmt)) + Error("slk_init"); + num_labels = (fmt>=PC_Style?12:8); + } + else if (fmt!=format) + Error("All SLKs must have same layout"); + init(); +} + +Soft_Label_Key_Set::~Soft_Label_Key_Set() { + if (!::isendwin()) + clear(); + delete[] slk_array; + count--; +} + +Soft_Label_Key_Set::Soft_Label_Key& Soft_Label_Key_Set::operator[](int i) { + if (i<1 || i>num_labels) + Error("Invalid Label index"); + return slk_array[i-1]; +} + +void Soft_Label_Key_Set::activate_label(int i, bool bf) { + if (!b_attrInit) { + NCursesApplication* A = NCursesApplication::getApplication(); + if (A) attrset(A->labels()); + b_attrInit = TRUE; + } + Soft_Label_Key& K = (*this)[i]; + if (ERR==::slk_set(K.num,bf?K.label:"",K.format)) + Error("slk_set"); + noutrefresh(); +} + +void Soft_Label_Key_Set::activate_labels(bool bf) { + if (!b_attrInit) { + NCursesApplication* A = NCursesApplication::getApplication(); + if (A) attrset(A->labels()); + b_attrInit = TRUE; + } + for(int i=1; i <= num_labels; i++) { + Soft_Label_Key& K = (*this)[i]; + if (ERR==::slk_set(K.num,bf?K.label:"",K.format)) + Error("slk_set"); + } + if (bf) + restore(); + else + clear(); + noutrefresh(); +} diff --git a/contrib/ncurses/c++/cursslk.h b/contrib/ncurses/c++/cursslk.h new file mode 100644 index 000000000000..1598b0634bab --- /dev/null +++ b/contrib/ncurses/c++/cursslk.h @@ -0,0 +1,205 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * + ****************************************************************************/ + +// $Id: cursslk.h,v 1.5 1999/05/16 17:30:08 juergen Exp $ + +#ifndef _CURSSLK_H +#define _CURSSLK_H + +#include <cursesw.h> + +class Soft_Label_Key_Set { +public: + // This inner class represents the attributes of a Soft Label Key (SLK) + class Soft_Label_Key { + friend class Soft_Label_Key_Set; + public: + typedef enum { Left=0, Center=1, Right=2 } Justification; + + private: + char *label; // The Text of the Label + Justification format; // The Justification + int num; // The number of the Label + + Soft_Label_Key() : label((char*)0),format(Left),num(-1) { + } + + virtual ~Soft_Label_Key() { + delete[] label; + }; + + public: + // Set the text of the Label + void operator=(char *text); + + // Set the Justification of the Label + inline void operator=(Justification just) { + format = just; + } + + // Retrieve the text of the label + inline char* operator()(void) const { + return label; + } + }; + +public: + typedef enum { + None = -1, + Three_Two_Three = 0, + Four_Four = 1, + PC_Style = 2, + PC_Style_With_Index = 3 + } 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 + + Soft_Label_Key *slk_array; // The array of SLK's + + // Init the Key Set + void init(); + + // Activate or Deactivate Label# i, Label counting starts with 1! + void activate_label(int i, bool bf=TRUE); + + // Activate of Deactivate all Labels + void activate_labels(bool bf); + +protected: + inline void Error (const char* msg) const THROWS(NCursesException) { + THROW(new NCursesException (msg)); + } + + // Remove SLK's from screen + void clear() { + if (ERR==::slk_clear()) + Error("slk_clear"); + } + + // Restore them + void restore() { + if (ERR==::slk_restore()) + Error("slk_restore"); + } + +public: + + // Construct a Key Set, use the most comfortable layout as default. + // You must create a Soft_Label_Key_Set before you create any object of + // the NCursesWindow, NCursesPanel or derived classes. (Actually before + // ::initscr() is called). + Soft_Label_Key_Set(Label_Layout fmt); + + // 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(); + + virtual ~Soft_Label_Key_Set(); + + // Get Label# i. Label counting starts with 1! + Soft_Label_Key& operator[](int i); + + // Retrieve number of Labels + inline int labels() const { return num_labels; } + + // Refresh the SLK portion of the screen + inline void refresh() { + if (ERR==::slk_refresh()) + Error("slk_refresh"); + } + + // Mark the SLK portion of the screen for refresh, defer actual refresh + // until next update call. + inline void noutrefresh() { + if (ERR==::slk_noutrefresh()) + Error("slk_noutrefresh"); + } + + // Mark the whole SLK portion of the screen as modified + inline void touch() { + if (ERR==::slk_touch()) + Error("slk_touch"); + } + + // Activate Label# i + inline void show(int i) { + activate_label(i,FALSE); + activate_label(i,TRUE); + } + + // Hide Label# i + inline void hide(int i) { + activate_label(i,FALSE); + } + + // Show all Labels + inline void show() { + activate_labels(FALSE); + activate_labels(TRUE); + } + + // Hide all Labels + inline void hide() { + activate_labels(FALSE); + } + + inline void attron(attr_t attrs) { + if (ERR==::slk_attron(attrs)) + Error("slk_attron"); + } + + inline void attroff(attr_t attrs) { + if (ERR==::slk_attroff(attrs)) + Error("slk_attroff"); + } + + inline void attrset(attr_t attrs) { + if (ERR==::slk_attrset(attrs)) + Error("slk_attrset"); + } + + inline void color(short color_pair_number) { + if (ERR==::slk_color(color_pair_number)) + Error("slk_color"); + } + + inline attr_t attr() const { + return ::slk_attr(); + } +}; + +#endif // _CURSSLK_H diff --git a/contrib/ncurses/c++/demo.cc b/contrib/ncurses/c++/demo.cc new file mode 100644 index 000000000000..6ac4650fb54c --- /dev/null +++ b/contrib/ncurses/c++/demo.cc @@ -0,0 +1,449 @@ +/* + * Silly demo program for the NCursesPanel class. + * + * written by Anatoly Ivasyuk (anatoly@nick.csh.rit.edu) + * + * Demo code for NCursesMenu and NCursesForm written by + * Juergen Pfeifer <juergen.pfeifer@gmx.net> + * + * $Id: demo.cc,v 1.17 1999/07/31 09:47:17 juergen Exp $ + */ + +#include "cursesapp.h" +#include "cursesm.h" +#include "cursesf.h" + +#if HAVE_LIBC_H +# include <libc.h> +#endif + +extern "C" unsigned int sleep(unsigned int); + +#undef index // needed for NeXT + +// +// ------------------------------------------------------------------------- +// +class SillyDemo +{ + public: + void run(int sleeptime) { + + NCursesPanel *std = new NCursesPanel(); + + // Make a few small demo panels + + NCursesPanel *u = new NCursesPanel(8,20,12,4); + NCursesPanel *v = new NCursesPanel(8,20,10,6); + NCursesPanel *w = new NCursesPanel(8,20,8,8); + NCursesPanel *x = new NCursesPanel(8,20,6,10); + NCursesPanel *y = new NCursesPanel(8,20,4,12); + NCursesPanel *z = new NCursesPanel(8,30,2,14); + + // Draw something on the main screen, so we can see what happens + // when panels get moved or deleted. + + std->box(); + std->move(std->height()/2,1); + std->hline(std->width()-2); + std->move(1,std->width()/2); + std->vline(std->height()-2); + std->addch(0,std->width()/2,ACS_TTEE); + std->addch(std->height()-1,std->width()/2,ACS_BTEE); + std->addch(std->height()/2,0,ACS_LTEE); + std->addch(std->height()/2,std->width()-1,ACS_RTEE); + std->addch(std->height()/2,std->width()/2,ACS_PLUS); + + // Draw frames with titles around panels so that we can see where + // the panels are located. + u->boldframe("Win U"); + v->frame("Win V"); + w->boldframe("Win W"); + x->frame("Win X"); + y->boldframe("Win Y"); + z->frame("Win Z"); + if (NCursesApplication::getApplication()->useColors()) { + u->bkgd(' '|COLOR_PAIR(1)); + w->bkgd(' '|COLOR_PAIR(1)); + y->bkgd(' '|COLOR_PAIR(1)); + v->bkgd(' '|COLOR_PAIR(2)); + x->bkgd(' '|COLOR_PAIR(2)); + z->bkgd(' '|COLOR_PAIR(2)); + } + + // A refresh to any valid panel updates all panels and refreshes + // the screen. Using std is just convenient - We know it's always + // valid until the end of the program. + + std->refresh(); + sleep(sleeptime); + + // Show what happens when panels are deleted and moved. + + sleep(sleeptime); + delete u; + std->refresh(); + + sleep(sleeptime); + delete z; + std->refresh(); + + sleep(sleeptime); + delete v; + std->refresh(); + + // show how it looks when a panel moves + sleep(sleeptime); + y->mvwin(5,30); + std->refresh(); + + sleep(sleeptime); + delete y; + std->refresh(); + + // show how it looks when you raise a panel + sleep(sleeptime); + w->top(); + std->refresh(); + + sleep(sleeptime); + delete w; + std->refresh(); + + sleep(sleeptime); + delete x; + + std->clear(); + std->refresh(); + + // Don't forget to clean up the main screen. Since this is the + // last thing using NCursesWindow, this has the effect of + // shutting down ncurses and restoring the terminal state. + + sleep(sleeptime); + delete std; + } +}; + +class UserData +{ +private: + int u; +public: + UserData(int x) : u(x) {} + int sleeptime() const { return u; } +}; +// +// ------------------------------------------------------------------------- +// +template<class T> class MyAction : public NCursesUserItem<T> +{ +public: + MyAction (const char* p_name, + const T* p_UserData) + : NCursesUserItem<T>(p_name, (const char*)0, p_UserData) + {}; + + ~MyAction() {} + + bool action() { + SillyDemo a; + a.run(NCursesUserItem<T>::UserData()->sleeptime()); + return FALSE; + } +}; + +class QuitItem : public NCursesMenuItem +{ +public: + QuitItem() : NCursesMenuItem("Quit") { + } + + bool action() { + return TRUE; + } +}; +// +// ------------------------------------------------------------------------- +// +class Label : public NCursesFormField +{ +public: + Label(const char* title, + int row, int col) + : NCursesFormField(1,(int)::strlen(title),row,col) { + set_value(title); + options_off(O_EDIT|O_ACTIVE); + } +}; +// +// ------------------------------------------------------------------------- +// +class MyFieldType : public UserDefinedFieldType { +private: + int chk; +protected: + bool field_check(NCursesFormField& f) { + return TRUE; + } + bool char_check(int c) { + return (c==chk?TRUE:FALSE); + } +public: + MyFieldType(int x) : chk(x) { + } +}; +// +// ------------------------------------------------------------------------- +// +class TestForm : public NCursesForm +{ +private: + NCursesFormField** F; + MyFieldType* mft; + Integer_Field *ift; + Enumeration_Field *eft; + + static char *weekdays[]; + +public: + TestForm() : NCursesForm(13,51,(lines()-15)/2,(cols()-53)/2) { + + F = new NCursesFormField*[10]; + mft = new MyFieldType('X'); + ift = new Integer_Field(0,1,10); + eft = new Enumeration_Field(weekdays); + + F[0] = new Label("Demo Entry Form",0,16); + F[1] = new Label("Weekday Enum",2,1); + F[2] = new Label("Number(1-10)",2,21); + F[3] = new Label("Only 'X'",2,35); + F[4] = new Label("Multiline Field (Dynamic and Scrollable)",5,1); + F[5] = new NCursesFormField(1,18,3,1); + F[6] = new NCursesFormField(1,12,3,21); + F[7] = new NCursesFormField(1,12,3,35); + F[8] = new NCursesFormField(4,46,6,1,2); + F[9] = new NCursesFormField(); + + InitForm(F,TRUE,TRUE); + boldframe(); + + F[5]->set_fieldtype(*eft); + F[6]->set_fieldtype(*ift); + + F[7]->set_fieldtype(*mft); + F[7]->set_maximum_growth(20); // max. 20 characters + F[7]->options_off(O_STATIC); // make field dynamic + + F[8]->set_maximum_growth(10); // max. 10 lines + F[8]->options_off(O_STATIC); // make field dynamic + } + + ~TestForm() { + delete mft; + delete ift; + delete eft; + } +}; + +char* TestForm::weekdays[] = { + "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", + "Friday", "Saturday", (char *)0 }; +// +// ------------------------------------------------------------------------- +// +class FormAction : public NCursesMenuItem +{ +public: + FormAction(const char *s) : NCursesMenuItem(s) { + } + + bool action() { + TestForm F; + Soft_Label_Key_Set* S = new Soft_Label_Key_Set; + for(int i=1; i <= S->labels(); i++) { + char buf[5]; + ::sprintf(buf,"Frm%02d",i); + (*S)[i] = buf; // Text + (*S)[i] = Soft_Label_Key_Set::Soft_Label_Key::Left; // Justification + } + NCursesApplication::getApplication()->push(*S); + F(); + NCursesApplication::getApplication()->pop(); + return FALSE; + } +}; +// +// ------------------------------------------------------------------------- +// +class PadAction : public NCursesMenuItem +{ +public: + PadAction(const char* s) : NCursesMenuItem(s) { + } + + bool action() { + const int GRIDSIZE = 3; + const int PADSIZE = 200; + unsigned gridcount = 0; + + NCursesPanel std; + NCursesPanel P(std.lines()-2,std.cols()-2,1,1); + NCursesFramedPad FP(P,PADSIZE,PADSIZE); + + for (int i=0; i < PADSIZE; i++) { + for (int j=0; j < PADSIZE; j++) { + if (i % GRIDSIZE == 0 && j % GRIDSIZE == 0) { + if (i==0 || j==0) + FP.addch('+'); + else + FP.addch((chtype)('A' + (gridcount++ % 26))); + } + else if (i % GRIDSIZE == 0) + FP.addch('-'); + else if (j % GRIDSIZE == 0) + FP.addch('|'); + else + FP.addch(' '); + } + } + + P.label("Pad Demo",NULL); + FP(); + P.clear(); + return FALSE; + } +}; + +// +// ------------------------------------------------------------------------- +// +class PassiveItem : public NCursesMenuItem { +public: + PassiveItem(const char* text) : NCursesMenuItem(text) { + options_off(O_SELECTABLE); + } +}; +// +// ------------------------------------------------------------------------- +// +class MyMenu : public NCursesMenu +{ +private: + NCursesPanel* P; + NCursesMenuItem** I; + UserData *u; + static const int n_items = 7; + +public: + MyMenu () + : NCursesMenu (n_items+2, 8, (lines()-10)/2, (cols()-10)/2) + { + u = new UserData(1); + I = new NCursesMenuItem*[1+n_items]; + I[0] = new PassiveItem("One"); + I[1] = new PassiveItem("Two"); + I[2] = new MyAction<UserData> ("Silly", u); + I[3] = new FormAction("Form"); + I[4] = new PadAction("Pad"); + I[5] = new PassiveItem("Six"); + I[6] = new QuitItem(); + I[7] = new NCursesMenuItem(); // Terminating empty item + + InitMenu(I,TRUE,TRUE); + + P = new NCursesPanel(1,n_items,LINES-1,1); + boldframe("Demo","Silly"); + P->show(); + } + + ~MyMenu() + { + P->hide(); + delete P; + delete u; + } + + virtual void On_Menu_Init() + { + NCursesWindow W(::stdscr); + P->move(0,0); + P->clrtoeol(); + for(int i=1; i<=count(); i++) + P->addch('0' + i); + P->bkgd(W.getbkgd()); + refresh(); + } + + virtual void On_Menu_Termination() + { + P->move(0,0); + P->clrtoeol(); + refresh(); + } + + virtual void On_Item_Init(NCursesMenuItem& item) + { + P->move(0,item.index()); + P->attron(A_REVERSE); + P->printw("%1d",1+item.index()); + P->attroff(A_REVERSE); + refresh(); + } + + virtual void On_Item_Termination(NCursesMenuItem& item) + { + P->move(0,item.index()); + P->attroff(A_REVERSE); + P->printw("%1d",1+item.index()); + refresh(); + } +}; +// +// ------------------------------------------------------------------------- +// +class TestApplication : public NCursesApplication { +protected: + int titlesize() const { return 1; } + void title(); + Soft_Label_Key_Set::Label_Layout useSLKs() const { + return Soft_Label_Key_Set::PC_Style_With_Index; + } + void init_labels(Soft_Label_Key_Set& S) const; + +public: + TestApplication() : NCursesApplication(TRUE) { + } + + int run(); +}; + +void TestApplication::init_labels(Soft_Label_Key_Set& S) const { + for(int i=1; i <= S.labels(); i++) { + char buf[5]; + ::sprintf(buf,"Key%02d",i); + S[i] = buf; // Text + S[i] = Soft_Label_Key_Set::Soft_Label_Key::Left; // Justification + } +} + +void TestApplication::title() { + const char * const title = "Simple C++ Binding Demo"; + const int len = ::strlen(title); + + titleWindow->bkgd(screen_titles()); + titleWindow->addstr(0,(titleWindow->cols()-len)/2,title); + titleWindow->noutrefresh(); +} + + +int TestApplication::run() { + MyMenu M; + M(); + return 0; +} + +// +// ------------------------------------------------------------------------- +// +static TestApplication Demo; diff --git a/contrib/ncurses/c++/edit_cfg.sh b/contrib/ncurses/c++/edit_cfg.sh new file mode 100755 index 000000000000..04f4e2225dca --- /dev/null +++ b/contrib/ncurses/c++/edit_cfg.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# $Id: edit_cfg.sh,v 1.4 1998/02/11 12:13:41 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1997 +# +# Edit the default value of the etip.h file based on the autoconf-generated +# values: +# +# $1 = ncurses_cfg.h +# $2 = etip.h +# +for name in \ + HAVE_BUILTIN_H \ + HAVE_TYPEINFO \ + HAVE_VALUES_H +do + mv $2 $2.bak + if ( grep "[ ]$name[ ]1" $1 2>&1 >/dev/null) + then + sed -e 's/define '$name'.*$/ define '$name' 1/' $2.bak >$2 + else + sed -e 's/define '$name'.*$/ define '$name' 0/' $2.bak >$2 + fi + if (cmp -s $2 $2.bak) + then + echo '** same: '$name + mv $2.bak $2 + else + echo '** edit: '$name + rm -f $2.bak + fi +done diff --git a/contrib/ncurses/c++/etip.h.in b/contrib/ncurses/c++/etip.h.in new file mode 100644 index 000000000000..0f7ae823b3cb --- /dev/null +++ b/contrib/ncurses/c++/etip.h.in @@ -0,0 +1,248 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * + ****************************************************************************/ + +// $Id: etip.h.in,v 1.10 1999/05/16 17:29:47 juergen Exp $ + +#ifndef _ETIP_H +#define _ETIP_H + +// These are substituted at configure/build time +#ifndef HAVE_BUILTIN_H +#define HAVE_BUILTIN_H 0 +#endif + +#ifndef HAVE_TYPEINFO +#define HAVE_TYPEINFO 0 +#endif + +#ifndef HAVE_VALUES_H +#define HAVE_VALUES_H 0 +#endif + +#ifndef ETIP_NEEDS_MATH_H +#define ETIP_NEEDS_MATH_H 0 +#endif + +#ifndef ETIP_NEEDS_MATH_EXCEPTION +#define ETIP_NEEDS_MATH_EXCEPTION 0 +#endif + +#ifdef __GNUG__ +# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) +# if HAVE_TYPEINFO +# include <typeinfo> +# endif +# endif +#endif + +#if defined(__GNUG__) +# if HAVE_BUILTIN_H +# if ETIP_NEEDS_MATH_H +# if ETIP_NEEDS_MATH_EXCEPTION +# undef exception +# define exception math_exception +# endif +# include <math.h> +# endif +# undef exception +# define exception builtin_exception +# include <builtin.h> +# undef exception +# endif +#elif defined (__SUNPRO_CC) +# include <generic.h> +# include <string.h> +#else +# include <string.h> +#endif + +extern "C" { +#if HAVE_VALUES_H +# include <values.h> +#endif + +#include <assert.h> +#include <eti.h> +#include <errno.h> +} + +// Forward Declarations +class NCursesPanel; +class NCursesMenu; +class NCursesForm; + +class NCursesException +{ +public: + const char *message; + int errorno; + + NCursesException (const char* msg, int err) + : message(msg), errorno (err) + {}; + + NCursesException (const char* msg) + : message(msg), errorno (E_SYSTEM_ERROR) + {}; + + virtual const char *classname() const { + return "NCursesWindow"; + } +}; + +class NCursesPanelException : public NCursesException +{ +public: + const NCursesPanel* p; + + NCursesPanelException (const char *msg, int err) : + NCursesException (msg, err), + p ((NCursesPanel*)0) + {}; + + NCursesPanelException (const NCursesPanel* panel, + const char *msg, + int err) : + NCursesException (msg, err), + p (panel) + {}; + + NCursesPanelException (int err) : + NCursesException ("panel library error", err), + p ((NCursesPanel*)0) + {}; + + NCursesPanelException (const NCursesPanel* panel, + int err) : + NCursesException ("panel library error", err), + p (panel) + {}; + + virtual const char *classname() const { + return "NCursesPanel"; + } + +}; + +class NCursesMenuException : public NCursesException +{ +public: + const NCursesMenu* m; + + NCursesMenuException (const char *msg, int err) : + NCursesException (msg, err), + m ((NCursesMenu *)0) + {}; + + NCursesMenuException (const NCursesMenu* menu, + const char *msg, + int err) : + NCursesException (msg, err), + m (menu) + {}; + + NCursesMenuException (int err) : + NCursesException ("menu library error", err), + m ((NCursesMenu *)0) + {}; + + NCursesMenuException (const NCursesMenu* menu, + int err) : + NCursesException ("menu library error", err), + m (menu) + {}; + + virtual const char *classname() const { + return "NCursesMenu"; + } + +}; + +class NCursesFormException : public NCursesException +{ +public: + const NCursesForm* f; + + NCursesFormException (const char *msg, int err) : + NCursesException (msg, err), + f ((NCursesForm*)0) + {}; + + NCursesFormException (const NCursesForm* form, + const char *msg, + int err) : + NCursesException (msg, err), + f (form) + {}; + + NCursesFormException (int err) : + NCursesException ("form library error", err), + f ((NCursesForm*)0) + {}; + + NCursesFormException (const NCursesForm* form, + int err) : + NCursesException ("form library error", err), + f (form) + {}; + + virtual const char *classname() const { + return "NCursesForm"; + } + +}; + +#if !(defined(__GNUG__)||defined(__SUNPRO_CC)) +# include <iostream.h> + extern "C" void exit(int); +#endif + +inline void THROW(const NCursesException *e) { +#if defined(__GNUG__) +# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) + (*lib_error_handler)(e?e->classname():"",e?e->message:""); +#else + throw *e; +#endif +#elif defined(__SUNPRO_CC) + genericerror(1, ((e != 0) ? (char *)(e->message) : "")); +#else + if (e) + cerr << e->message << endl; + exit(0); +#endif +} + +#define THROWS(s) + +#endif // _ETIP_H diff --git a/contrib/ncurses/c++/headers b/contrib/ncurses/c++/headers new file mode 100644 index 000000000000..3470386adf02 --- /dev/null +++ b/contrib/ncurses/c++/headers @@ -0,0 +1,39 @@ +# C++ headers +# $Id: headers,v 1.2 1998/02/11 12:13:40 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1997 +# +$(srcdir)/cursesapp.h +$(srcdir)/cursesf.h +$(srcdir)/cursesm.h +$(srcdir)/cursesp.h +$(srcdir)/cursesw.h +$(srcdir)/cursslk.h +etip.h diff --git a/contrib/ncurses/c++/internal.h b/contrib/ncurses/c++/internal.h new file mode 100644 index 000000000000..cdf256cbd71e --- /dev/null +++ b/contrib/ncurses/c++/internal.h @@ -0,0 +1,47 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 * + ****************************************************************************/ + +// $Id: internal.h,v 1.5 1999/05/16 17:29:25 juergen Exp $ + +#ifndef _CPLUS_INTERNAL_H +#define _CPLUS_INTERNAL_H 1 + +#ifdef USE_RCS_IDS +#define MODULE_ID(id) static const char Ident[] = id; +#else +#define MODULE_ID(id) /*nothing*/ +#endif + +#define CTRL(x) ((x) & 0x1f) + +#endif diff --git a/contrib/ncurses/c++/modules b/contrib/ncurses/c++/modules new file mode 100644 index 000000000000..0709805847d2 --- /dev/null +++ b/contrib/ncurses/c++/modules @@ -0,0 +1,43 @@ +# Program modules +# $Id: modules,v 1.6 1999/07/31 09:46:54 juergen Exp $ +############################################################################## +# Copyright (c) 1998 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1995,1997 +# + +@ base +cursesf c++ $(srcdir) $(cursesf_h) $(cursesapp_h) +cursesm c++ $(srcdir) $(cursesm_h) $(cursesapp_h) +cursesp c++ $(srcdir) $(cursesp_h) +cursesw c++ $(srcdir) $(cursesw_h) +cursespad c++ $(srcdir) $(cursesw_h) +cursslk c++ $(srcdir) $(cursslk_h) $(cursesapp_h) +cursesapp c++ $(srcdir) $(cursesapp_h) +cursesmain c++ $(srcdir) $(cursesapp_h) +demo c++ $(srcdir) $(cursesf_h) $(cursesm_h) $(cursesapp_h) diff --git a/contrib/ncurses/config.guess b/contrib/ncurses/config.guess new file mode 100755 index 000000000000..729d6cfef518 --- /dev/null +++ b/contrib/ncurses/config.guess @@ -0,0 +1,969 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner <bothner@cygnus.com>. +# The master version of this file is at the FSF in /home/gd/gnu/lib. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# 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). +# + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +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_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +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 + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <<EOF >dummy.s + .globl main + .ent main +main: + .frame \$30,0,\$26,0 + .prologue 0 + .long 0x47e03d80 # implver $0 + lda \$2,259 + .long 0x47e20c21 # amask $2,$1 + srl \$1,8,\$2 + sll \$2,2,\$2 + sll \$0,3,\$0 + addl \$1,\$0,\$0 + addl \$2,\$0,\$0 + ret \$31,(\$26),1 + .end main +EOF + ${CC-cc} dummy.s -o dummy 2>/dev/null + if test "$?" = 0 ; then + ./dummy + case "$?" in + 7) + UNAME_MACHINE="alpha" + ;; + 15) + UNAME_MACHINE="alphaev5" + ;; + 14) + UNAME_MACHINE="alphaev56" + ;; + 10) + UNAME_MACHINE="alphapca56" + ;; + 16) + UNAME_MACHINE="alphaev6" + ;; + esac + fi + rm -f dummy.s dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-cbm-sysv4 + exit 0;; + amiga:NetBSD:*:*) + echo m68k-cbm-netbsd${UNAME_RELEASE} + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + arm32:NetBSD:*:*) + echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + SR2?01:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:NetBSD:*:*) + echo m68k-atari-netbsd${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:NetBSD:*:*) + echo m68k-sun-netbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:NetBSD:*:*) + echo m68k-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + macppc:NetBSD:*:*) + echo powerpc-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >dummy.c + int main (argc, argv) int argc; char **argv; { + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + ${CC-cc} 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 + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ + -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *: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. + 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 ;; + *:MVS:*:* | *:OS390:*:*|*:OS/390:*:*) + # uname -m gives a processor model number /* S/390 -- gil -- 1389 */ + echo s390-ibm-os390 # on R1 and R2, uname -s reports OS390 + exit 0 ;; # on R3, uname -s reports OS/390 + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm 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 + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:4) + 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 + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/6?? | 9000/7?? | 9000/80[024] | 9000/8?[13679] | 9000/892 ) + sed 's/^ //' << EOF >dummy.c + #include <stdlib.h> + #include <unistd.h> + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy` + rm -f dummy.c dummy + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F300:UNIX_System_V:*:*) + FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + F301:UNIX_System_V:*:*) + echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` + exit 0 ;; + hp3[0-9][05]:NetBSD:*:*) + echo m68k-hp-netbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:NetBSD:*:*) + echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + # uname on the ARM produces all sorts of strangeness, and we need to + # filter it out. + case "$UNAME_MACHINE" in + arm* | sa110*) UNAME_MACHINE="arm" ;; + esac + + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. + ld_help_string=`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 + i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; 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 ;; + m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; + elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; + esac + + if test "${UNAME_MACHINE}" = "alpha" ; then + sed 's/^ //' <<EOF >dummy.s + .globl main + .ent main + main: + .frame \$30,0,\$26,0 + .prologue 0 + .long 0x47e03d80 # implver $0 + lda \$2,259 + .long 0x47e20c21 # amask $2,$1 + srl \$1,8,\$2 + sll \$2,2,\$2 + sll \$0,3,\$0 + addl \$1,\$0,\$0 + addl \$2,\$0,\$0 + ret \$31,(\$26),1 + .end main +EOF + LIBC="" + ${CC-cc} dummy.s -o dummy 2>/dev/null + if test "$?" = 0 ; then + ./dummy + case "$?" in + 7) + UNAME_MACHINE="alpha" + ;; + 15) + UNAME_MACHINE="alphaev5" + ;; + 14) + UNAME_MACHINE="alphaev56" + ;; + 10) + UNAME_MACHINE="alphapca56" + ;; + 16) + UNAME_MACHINE="alphaev6" + ;; + 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 +main(argc, argv) + int argc; + char *argv[]; +{ +#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-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + 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 +#include <features.h> +main(argc, argv) + int argc; + char *argv[]; +{ +#ifdef __ELF__ +# ifdef __GLIBC__ +# if (__GLIBC__ >= 2) + printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + fi ;; +# 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*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i?86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + # SysVr5/Unixware7 + i?86:*:5*:* | i?86:SYSTEM_V:5*:*) + if uname -a | grep SCO >/dev/null 2>/dev/null ; then + (/bin/uname -s|egrep UnixWare >/dev/null) && UNAME_VER=uw${UNAME_VERSION} + if /bin/uname -X 2>/dev/null >/dev/null ; then + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + fi + echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}${UNAME_VER} + else + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv4.2uw${UNAME_VERSION} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i?86:UnixWare:*:*) + if /bin/uname -X 2>/dev/null >/dev/null ; then + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + fi + echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION} + exit 0 ;; + pc:*:*:*) + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + 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) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:*:6*) + echo mips-sony-newsos6 + exit 0 ;; + R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +#if !defined (ultrix) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 +rm -f dummy.c dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/contrib/ncurses/config.sub b/contrib/ncurses/config.sub new file mode 100755 index 000000000000..9c47333ac991 --- /dev/null +++ b/contrib/ncurses/config.sub @@ -0,0 +1,967 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +if [ x$1 = x ] +then + echo Configuration name missing. 1>&2 + echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 + echo "or $0 ALIAS" 1>&2 + echo where ALIAS is a recognized configuration type. 1>&2 + exit 1 +fi + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + linux-gnu*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) + os= + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ + | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w \ + | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ + | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ + | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ + | mipstx39 | mipstx39el \ + | sparc | sparclet | sparclite | sparc64 | v850) + basic_machine=$basic_machine-unknown + ;; + # 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[34567]86) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ + | xmp-* | ymp-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ + | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \ + | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ + | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mipstx39-* | mipstx39el-* \ + | f301-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigaos | amigados) + basic_machine=m68k-cbm + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [ctj]90-cray) + basic_machine=c90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + os=-mvs + ;; + s390 | s390-ibm*) +# OS/390 support after: +# Linkname: Mortice Kern Systems (MKS) Inc. - OS/390 OpenEdition -- GNU Utilities Downloads +# URL: http://www.mks.com/s390/gnu/download.htm#autoconf + basic_machine=s390-ibm # /* S/390 -- gil -- 1419 */ + os=-os390 + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[34567]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[34567]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[34567]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[34567]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + np1) + basic_machine=np1-gould + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | nexen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | k6 | 6x86) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | nexen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | k6-* | 6x86-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=rs6000-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* | -os390* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -xenix) + os=-xenix + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-semi) + os=-aout + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + s390-ibm) + os=-os390 # /* S/390 -- gil -- 1451 */ + ;; + *-ibm) + os=-aix + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f301-fujitsu) + os=-uxpv + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -hpux*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/contrib/ncurses/configure b/contrib/ncurses/configure new file mode 100755 index 000000000000..466b08103835 --- /dev/null +++ b/contrib/ncurses/configure @@ -0,0 +1,7085 @@ +#! /bin/sh + +# From configure.in Revision: 1.169 + + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13.19990117 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF +cat <<EOF +--enable and --with options recognized: + --with-system-type=XXX test: override derived host system-type + --enable-add-ons=DIR... used to check if we are a glibc add-on. + --without-cxx suppress check for C++, don't build demo + --without-ada suppress check for Ada95, don't build demo + --without-progs suppress build with programs (e.g., tic) + --with-install-prefix prefixes actual install-location +Options to Specify How Manpages are Installed: + --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and + optionally formatted, e.g., gzip,formatted + --with-manpage-renames specify manpage-renaming +Options to Specify the Libraries Built/Used: + --with-shared generate shared-libraries + --with-normal generate normal-libraries (default) + --with-debug generate debug-libraries (default) +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 + --enable-rpath use rpath option when generating shared libraries + --with-shlib-version=X Specify rel or abi version for shared libs +Fine-Tuning Your Configuration: + --disable-overwrite leave out the link to -lcurses + --disable-database use only built-in data + --disable-ext-funcs disable function-extensions + --with-fallbacks=XXX specify list of fallback terminal descriptions +EOF +cat <<EOF + --with-terminfo-dirs=XXX specify list of terminfo directories (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-bsdpad recognize BSD-style prefix padding + --enable-const compile with extra/non-standard const + --with-rcs-ids compile-in RCS identifiers +Experimental Code: + --with-develop enable all experimental options for testing + --enable-broken_linker compile with broken-linker support code +EOF +cat <<EOF + --enable-hard-tabs compile with experimental hard-tabs code + --enable-hashmap compile with experimental hashmap code + --enable-no-padding compile with experimental no-padding code + --enable-safe-sprintf compile with experimental safe-sprintf code + --disable-scroll-hints compile hashmap without scroll-hints code + --enable-tcap-names compile with experimental definable-name code + --enable-sigwinch compile with experimental SIGWINCH handler + --enable-widec compile with experimental wide-char code + --enable-xmc-glitch compile with experimental xmc code +Testing/development Options: + --enable-echo build: display "compiling" commands (default) + --enable-warnings build: turn on GCC compiler warnings +EOF +cat <<EOF + --enable-assertions test: turn on generation of assertion code + --disable-leaks test: suppress permanent memory-leaks + --enable-expanded test: generate functions for certain macros + --disable-macros test: use functions rather than macros +Ada95 Binding Options: + --with-ada-compiler=CMD Specify Ada95 compiler command (default gnatmake) + --with-ada-include=DIR Ada includes are in DIR (default: PREFIX/lib/gnu-Ada/adainclude) + --with-ada-objects=DIR Ada objects are in DIR (default: PREFIX/lib/gnu-Ada/adalib) +EOF + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13.19990117" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=ncurses/base/lib_initscr.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + + + +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} +echo "$ac_t""Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version (`date`)" 1>&6 + + + + + + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +if test -f $srcdir/config.guess ; then + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +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:639: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + + system_name="$host_os" +else + system_name="`(uname -s -r) 2>/dev/null`" + if test -z "$system_name" ; then + system_name="`(hostname) 2>/dev/null`" + fi +fi +test -n "$system_name" && cat >> confdefs.h <<EOF +#define SYSTEM_NAME "$system_name" +EOF + +if eval "test \"`echo '$''{'cf_cv_system_name'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cf_cv_system_name="$system_name" +fi + + +test -z "$system_name" && system_name="$cf_cv_system_name" +test -n "$cf_cv_system_name" && echo "$ac_t"""Configuring for $cf_cv_system_name"" 1>&6 + +if test ".$system_name" != ".$cf_cv_system_name" ; then + echo "$ac_t""Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" 1>&6 + { echo "configure: error: "Please remove config.cache and try again."" 1>&2; exit 1; } +fi + + +# Check whether --with-system-type or --without-system-type was given. +if test "${with_system_type+set}" = set; then + withval="$with_system_type" + echo "configure: warning: overriding system type to $withval" 1>&2 + cf_cv_system_name=$withval +fi + + +# We need a configure script only when compiling as part of GNU C library. +# Here we have to generate one of the files we need while compiling. +# +# The only problem is that users of the package might think they have to +# run configure themself and find it irritating when nothing happens. +# +# So we try here to find out whether we are called from the glibc configure +# or by a user. +# + +# Check whether --enable-add-ons or --disable-add-ons was given. +if test "${enable_add_ons+set}" = set; then + enableval="$enable_add_ons" + glibc_add_on=yes +else + glibc_add_on= +fi + + +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[ ]*=.*$\" \ + $srcdir/Makefile | sed -e \ + 's/^[ ]*ncurses-version[ ]*=[ ]*\([^ ^ ]*\)[ ]*$/\1/'`" > $srcdir/Banner + exit 0 +fi + +### Save the given $CFLAGS to allow user-override. +cf_user_CFLAGS="$CFLAGS" + +### Default install-location + +echo $ac_n "checking for prefix""... $ac_c" 1>&6 +echo "configure:730: 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*) + prefix=/usr + ;; + *) prefix=$ac_default_prefix + ;; + esac +fi +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:745: checking for default include-directory" >&5 +test -n "$verbose" && echo 1>&6 +for cf_symbol in \ + $includedir \ + $includedir/ncurses \ + $prefix/include \ + $prefix/include/ncurses \ + /usr/local/include \ + /usr/local/include/ncurses \ + /usr/include \ + /usr/include/ncurses +do + cf_dir=`eval echo $cf_symbol` + if test -f $cf_dir/curses.h ; then + if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then + includedir="$cf_symbol" + test -n "$verbose" && echo $ac_n " found " 1>&6 + break + fi + fi + test -n "$verbose" && echo " tested $cf_dir" 1>&6 +done +echo "$ac_t""$includedir" 1>&6 +fi + + +### Checks for programs. +# 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:775: 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 + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +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:805: 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 + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # 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:856: 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 + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:888: 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. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 899 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:904: \"$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 + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +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:930: 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:935: 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 + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:944: \"$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 +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +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:963: 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 + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +if test -n "$GCC" ; then +echo $ac_n "checking version of gcc""... $ac_c" 1>&6 +echo "configure:996: checking version of gcc" >&5 +eval "$CC --version" +fi +if test $host != $build; then + for ac_prog in $CC gcc cc +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:1005: 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 + if test -n "$BUILD_CC"; then + ac_cv_prog_BUILD_CC="$BUILD_CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_BUILD_CC="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +BUILD_CC="$ac_cv_prog_BUILD_CC" +if test -n "$BUILD_CC"; then + echo "$ac_t""$BUILD_CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$BUILD_CC" && break +done + +fi +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1036: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext <<EOF +#line 1051 "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:1057: \"$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 + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext <<EOF +#line 1068 "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:1074: \"$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 + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext <<EOF +#line 1085 "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:1091: \"$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 + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +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:1117: 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 1123 "configure" +#include "confdefs.h" +#include <sgtty.h> +Autoconf TIOCGETP +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_prog_gcc_traditional=yes +else + rm -rf conftest* + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat > conftest.$ac_ext <<EOF +#line 1141 "configure" +#include "confdefs.h" +#include <termio.h> +Autoconf TCGETA +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi + +echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + +echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 +echo "configure:1163: 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 + echo "$ac_t""yes" 1>&6 + ISC=yes # If later tests want to check for ISC. + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + if test "$GCC" = yes; then + CC="$CC -posix" + else + CC="$CC -Xp" + fi +else + echo "$ac_t""no" 1>&6 + ISC= +fi + + +echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 +echo "configure:1185: 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" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc +# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) +for cf_arg in "-DCC_HAS_PROTOS" \ + "" \ + -qlanglvl=ansi \ + -std1 \ + "-Aa -D_HPUX_SOURCE +e" \ + "-Aa -D_HPUX_SOURCE" \ + -Xc +do + CFLAGS="$cf_save_CFLAGS $cf_arg" + cat > conftest.$ac_ext <<EOF +#line 1209 "configure" +#include "confdefs.h" + +#ifndef CC_HAS_PROTOS +#if !defined(__STDC__) || (__STDC__ != 1) +choke me +#endif +#endif + +int main() { + + int test (int i, double x); + struct s1 {int (*f) (int a);}; + struct s2 {int (*f) (double a);}; +; return 0; } +EOF +if { (eval echo configure:1225: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_ansi_cc="$cf_arg"; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done +CFLAGS="$cf_save_CFLAGS" + +fi + +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" +else + cat >> confdefs.h <<\EOF +#define CC_HAS_PROTOS 1 +EOF + +fi +fi + + +if test "$cf_cv_ansi_cc" = "no"; then + { echo "configure: error: Your compiler does not appear to recognize prototypes. +You have the following choices: + a. adjust your compiler options + b. get an up-to-date compiler + c. use a wrapper such as unproto" 1>&2; exit 1; } +fi + + + +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__" + LDFLAGS=`echo "$LDFLAGS -Zmt -Zcrtdll" | sed "s/-Zexe//g"` + PROG_EXT=".exe" + ;; +esac + + + +case "$cf_cv_system_name" in +freebsd*) #(vi + test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R" + ;; +*) LDPATH=$PATH:/sbin:/usr/sbin + # 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:1282: 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 + case "$LDCONFIG" in + /*) + ac_cv_path_LDCONFIG="$LDCONFIG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_LDCONFIG="$LDCONFIG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$LDPATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_LDCONFIG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +LDCONFIG="$ac_cv_path_LDCONFIG" +if test -n "$LDCONFIG"; then + echo "$ac_t""$LDCONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + ;; +esac + + +echo $ac_n "checking if you want to build with C++""... $ac_c" 1>&6 +echo "configure:1319: checking if you want to build with C++" >&5 + +# Check whether --with-cxx or --without-cxx was given. +if test "${with_cxx+set}" = set; then + withval="$with_cxx" + cf_with_cxx=$withval +else + cf_with_cxx=yes +fi + +echo "$ac_t""$cf_with_cxx" 1>&6 +if test "X$cf_with_cxx" != Xno ; then +for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl +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:1336: 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 + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CXX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX="$ac_cv_prog_CXX" +if test -n "$CXX"; then + echo "$ac_t""$CXX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$CXX" && break +done +test -n "$CXX" || CXX="gcc" + + +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1368: 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. +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 + +cat > conftest.$ac_ext << EOF + +#line 1379 "configure" +#include "confdefs.h" + +int main(){return(0);} +EOF +if { (eval echo configure:1384: \"$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 + ac_cv_prog_cxx_cross=no + else + ac_cv_prog_cxx_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cxx_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 +if test $ac_cv_prog_cxx_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 ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1410: 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:1415: 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 + cat > conftest.C <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1424: \"$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 +fi +fi + +echo "$ac_t""$ac_cv_prog_gxx" 1>&6 + +if test $ac_cv_prog_gxx = yes; then + GXX=yes +else + GXX= +fi + +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:1443: 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 + echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_cxx_g=yes +else + ac_cv_prog_cxx_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS="$ac_save_CXXFLAGS" +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi + +fi +if test -n "$GXX" ; then case "`${CXX-g++} --version`" in 1*|2.[0-6]*) GXX=""; CXX=""; ac_cv_prog_gxx=no; cf_cxx_library=no ; echo No: templates do not work;; esac; fi + +echo $ac_n "checking if you want to build with Ada95""... $ac_c" 1>&6 +echo "configure:1478: 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 + withval="$with_ada" + cf_with_ada=$withval +else + cf_with_ada=yes +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:1491: 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 + withval="$with_progs" + cf_with_progs=$withval +else + cf_with_progs=yes +fi + +echo "$ac_t""$cf_with_progs" 1>&6 + +modules_to_build="ncurses" +if test "X$cf_with_progs" != Xno ; then +modules_to_build="$modules_to_build progs tack" +fi +modules_to_build="$modules_to_build panel menu form" + +for ac_prog in mawk gawk nawk awk +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:1514: 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 + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AWK="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AWK="$ac_cv_prog_AWK" +if test -n "$AWK"; then + echo "$ac_t""$AWK" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$AWK" && break +done + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:1544: 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 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# 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:1582: 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 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +case $INSTALL in +/*) + ;; +*) + 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:1645: 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 + ac_cv_sys_long_file_names=yes +# Test for long file names in all the places we know might matter: +# . the current directory, where building will happen +# $prefix/lib where we will be installing things +# $exec_prefix/lib likewise +# eval it to expand exec_prefix. +# $TMPDIR if set, where it might want to write temporary files +# if $TMPDIR is not set: +# /tmp where it might want to write temporary files +# /var/tmp likewise +# /usr/tmp likewise +if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then + ac_tmpdirs="$TMPDIR" +else + ac_tmpdirs='/tmp /var/tmp /usr/tmp' +fi +for ac_dir in . $ac_tmpdirs `eval echo $prefix/lib $exec_prefix/lib` ; do + test -d $ac_dir || continue + test -w $ac_dir || continue # It is less confusing to not echo anything here. + (echo 1 > $ac_dir/conftest9012345) 2>/dev/null + (echo 2 > $ac_dir/conftest9012346) 2>/dev/null + val=`cat $ac_dir/conftest9012345 2>/dev/null` + if test ! -f $ac_dir/conftest9012345 || test "$val" != 1; then + ac_cv_sys_long_file_names=no + rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null + break + fi + rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null +done +fi + +echo "$ac_t""$ac_cv_sys_long_file_names" 1>&6 +if test $ac_cv_sys_long_file_names = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_LONG_FILE_NAMES 1 +EOF + +fi + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:1689: 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 + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +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:1712: 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 + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +for ac_prog in tdlint lint alint +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:1744: 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 + if test -n "$LINT"; then + ac_cv_prog_LINT="$LINT" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_LINT="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +LINT="$ac_cv_prog_LINT" +if test -n "$LINT"; then + echo "$ac_t""$LINT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$LINT" && break +done + +for ac_prog in man man_db +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:1778: 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 + if test -n "$MAN"; then + ac_cv_prog_MAN="$MAN" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_MAN="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +MAN="$ac_cv_prog_MAN" +if test -n "$MAN"; then + echo "$ac_t""$MAN" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$MAN" && break +done + + + +if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6 +echo "configure:1814: checking for loader (symbol LD)" >&5 +test -z "$LD" && LD=ld +echo "$ac_t""$LD" 1>&6 + +cf_cv_subst_LD=$LD +fi + +LD=${cf_cv_subst_LD} + +if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6 +echo "configure:1828: checking for archiver (symbol AR)" >&5 +test -z "$AR" && AR=ar +echo "$ac_t""$AR" 1>&6 + +cf_cv_subst_AR=$AR +fi + +AR=${cf_cv_subst_AR} + +if eval "test \"`echo '$''{'cf_cv_subst_AR_OPTS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +echo $ac_n "checking for archiver options (symbol AR_OPTS)""... $ac_c" 1>&6 +echo "configure:1842: checking for archiver options (symbol AR_OPTS)" >&5 +test -z "$AR_OPTS" && AR_OPTS=rv +echo "$ac_t""$AR_OPTS" 1>&6 + +cf_cv_subst_AR_OPTS=$AR_OPTS +fi + +AR_OPTS=${cf_cv_subst_AR_OPTS} + + + +echo $ac_n "checking for makeflags variable""... $ac_c" 1>&6 +echo "configure:1854: checking for makeflags variable" >&5 +if eval "test \"`echo '$''{'cf_cv_makeflags'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cf_cv_makeflags='' + for cf_option in '-$(MAKEFLAGS)' '$(MFLAGS)' + do + cat >cf_makeflags.tmp <<CF_EOF +all : + @ echo '.$cf_option' +CF_EOF + cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null` + case "$cf_result" in + .*k) + cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null` + case "$cf_result" in + .*CC=*) cf_cv_makeflags= + ;; + *) cf_cv_makeflags=$cf_option + ;; + esac + break + ;; + *) echo no match "$cf_result" + ;; + esac + done + rm -f cf_makeflags.tmp +fi + +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:1890: 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 + withval="$with_install_prefix" + case "$withval" in #(vi + yes|no) #(vi + ;; + *) INSTALL_PREFIX="$withval" + ;; + esac +fi + +echo "$ac_t""$INSTALL_PREFIX" 1>&6 + + +############################################################################### + + + echo $ac_n "checking format of man-pages""... $ac_c" 1>&6 +echo "configure:1910: checking format of man-pages" >&5 + + +# Check whether --with-manpage-format or --without-manpage-format was given. +if test "${with_manpage_format+set}" = set; then + withval="$with_manpage_format" + cf_manpage_form=$withval +else + cf_manpage_form=unknown +fi + + +case ".$cf_manpage_form" in +.gzip|.compress|.BSDI|.normal|.formatted) # (vi + ;; +.unknown|.) # (vi + if test -z "$MANPATH" ; then + 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}:" + cf_manpage_form=unknown + for cf_dir in $MANPATH; do + test -z "$cf_dir" && cf_dir=/usr/man + 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 + case "$cf_name" in + *.gz) cf_manpage_form=gzip;; + *.Z) cf_manpage_form=compress;; + *.0) cf_manpage_form=BSDI,formatted;; + *) cf_manpage_form=normal;; + esac + break + fi + done + if test "$cf_manpage_form" != "unknown" ; then + break + fi + done + IFS="$ac_save_ifs" + ;; +.*) # (vi + echo "configure: warning: Unexpected manpage-format" 1>&2 + ;; +esac + +echo "$ac_t""$cf_manpage_form" 1>&6 + + +echo $ac_n "checking for manpage renaming""... $ac_c" 1>&6 +echo "configure:1962: checking for manpage renaming" >&5 + + +# Check whether --with-manpage-renames or --without-manpage-renames was given. +if test "${with_manpage_renames+set}" = set; then + withval="$with_manpage_renames" + cf_manpage_renames=$withval +else + cf_manpage_renames=yes +fi + + +case ".$cf_manpage_renames" in #(vi +.no) #(vi + ;; +.|.yes) + # Debian 'man' program? + if test -f /etc/debian_version ; then + cf_manpage_renames=`cd $srcdir && pwd`/man/man_db.renames + else + cf_manpage_renames=no + fi + ;; +esac + +if test "$cf_manpage_renames" != no ; then + if test ! -f $cf_manpage_renames ; then + { echo "configure: error: not a filename: $cf_manpage_renames" 1>&2; exit 1; } + fi + + test ! -d man && mkdir man + + # Construct a sed-script to perform renaming within man-pages + if test -n "$cf_manpage_renames" ; then + test ! -d man && mkdir man + $srcdir/man/make_sed.sh $cf_manpage_renames >man/edit_man.sed + fi +fi + +echo "$ac_t""$cf_manpage_renames" 1>&6 + + + if test "$prefix" = "NONE" ; then + cf_prefix="$ac_default_prefix" + else + cf_prefix="$prefix" + fi + + case "$cf_manpage_form" in # (vi + *formatted*) # (vi + cf_subdir='$mandir/cat' + cf_format=yes + ;; + *) + cf_subdir='$mandir/man' + cf_format=no + ;; + esac + +test ! -d man && mkdir man +cat >man/edit_man.sh <<CF_EOF +#! /bin/sh +# this script is generated by the configure-script +prefix="$cf_prefix" +datadir="$datadir" +MKDIRS="`cd $srcdir && pwd`/mkinstalldirs" +INSTALL="$INSTALL" +INSTALL_DATA="$INSTALL_DATA" +TMP=\${TMPDIR-/tmp}/man\$\$ +trap "rm -f \$TMP" 0 1 2 5 15 + +verb=\$1 +shift + +mandir=\$1 +shift + +for i in \$* ; do +case \$i in #(vi +*.orig|*.rej) ;; #(vi +*.[0-9]*) + section=\`expr "\$i" : '.*\\.\\([0-9]\\)[xm]*'\`; + if test \$verb = installing ; then + if test ! -d $cf_subdir\${section} ; then + \$MKDIRS $cf_subdir\$section + fi + fi + source=\`basename \$i\` +CF_EOF +if test "$cf_manpage_renames" = no ; then +cat >>man/edit_man.sh <<CF_EOF + target=$cf_subdir\${section}/\$source + sed -e "s,@DATADIR@,\$datadir," < \$i >\$TMP +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" + test \$verb = installing && sed -e "s,@DATADIR@,\$datadir," < \$i | sed -f edit_man.sed >\$TMP +CF_EOF +fi +if test $cf_format = yes ; then +cat >>man/edit_man.sh <<CF_EOF + nroff -man \$TMP >\$TMP.out + mv \$TMP.out \$TMP +CF_EOF +fi +case "$cf_manpage_form" in #(vi +*compress*) #(vi +cat >>man/edit_man.sh <<CF_EOF + if test \$verb = installing ; then + if ( compress -f \$TMP ) + then + mv \$TMP.Z \$TMP + fi + fi + target="\$target.Z" +CF_EOF + ;; +*gzip*) #(vi +cat >>man/edit_man.sh <<CF_EOF + if test \$verb = installing ; then + if ( gzip -f \$TMP ) + then + mv \$TMP.gz \$TMP + fi + fi + target="\$target.gz" +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/'\`" +CF_EOF + ;; +esac +cat >>man/edit_man.sh <<CF_EOF + echo \$verb \$target + if test \$verb = installing ; then + \$INSTALL_DATA \$TMP \$target + else + rm -f \$target + fi + ;; +esac +done +CF_EOF +chmod 755 man/edit_man.sh + + + +############################################################################### + + +### Options to allow the user to specify the set of libraries which are used. +### Use "--without-normal --with-shared" to allow the default model to be +### shared, for example. +cf_list_models="" + +echo $ac_n "checking if you want to build shared libraries""... $ac_c" 1>&6 +echo "configure:2127: 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 + withval="$with_shared" + with_shared=$withval +else + with_shared=no +fi + +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:2141: 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 + withval="$with_normal" + with_normal=$withval +else + with_normal=yes +fi + +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:2155: 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 + withval="$with_debug" + with_debug=$withval +else + with_debug=yes +fi + +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:2169: 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 + withval="$with_profile" + with_profile=$withval +else + with_profile=no +fi + +echo "$ac_t""$with_profile" 1>&6 +test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile" + +echo $ac_n "checking if you want to build a separate terminfo library""... $ac_c" 1>&6 +echo "configure:2183: 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 + withval="$with_termlib" + with_termlib=$withval +else + with_termlib=no +fi + +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:2197: 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 + withval="$with_dbmalloc" + with_dbmalloc=$withval +else + with_dbmalloc=no +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:2210: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-ldbmalloc $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2218 "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 + builtin and then its argument prototype would still apply. */ +char debug_malloc(); + +int main() { +debug_malloc() +; return 0; } +EOF +if { (eval echo configure:2229: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo dbmalloc | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-ldbmalloc $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + +fi + +echo $ac_n "checking if you want to link with dmalloc for testing""... $ac_c" 1>&6 +echo "configure:2259: 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 + withval="$with_dmalloc" + with_dmalloc=$withval +else + with_dmalloc=no +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:2272: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-ldmalloc $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2280 "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 + builtin and then its argument prototype would still apply. */ +char dmalloc_debug(); + +int main() { +dmalloc_debug() +; return 0; } +EOF +if { (eval echo configure:2291: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo dmalloc | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-ldmalloc $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + +fi + +SHLIB_LIST="" +echo $ac_n "checking if you want to link with the gpm mouse library""... $ac_c" 1>&6 +echo "configure:2322: 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 + withval="$with_gpm" + with_gpm=$withval +else + with_gpm=no +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:2335: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-lgpm -lcurses -ltermcap $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2343 "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 + builtin and then its argument prototype would still apply. */ +char Gpm_Open(); + +int main() { +Gpm_Open() +; return 0; } +EOF +if { (eval echo configure:2354: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + + EXTRA_LIBS="-lgpm -lncurses $EXTRA_LIBS" + SHLIB_LIST="-lgpm $SHLIB_LIST" + cat >> confdefs.h <<\EOF +#define HAVE_LIBGPM 1 +EOF + + for ac_hdr in gpm.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2380: 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 2385 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2390: \"$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 + + +else + echo "$ac_t""no" 1>&6 +fi + +fi + +TINFO_LIST="$SHLIB_LIST" +test $with_termlib = yes && SHLIB_LIST="$SHLIB_LIST -ltinfo" + + + + + +echo $ac_n "checking for specified models""... $ac_c" 1>&6 +echo "configure:2431: checking for specified models" >&5 +test -z "$cf_list_models" && cf_list_models=normal +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. +DFT_LWR_MODEL=`echo $cf_list_models | $AWK '{print $1}'` + +DFT_UPR_MODEL=`echo $DFT_LWR_MODEL | tr '[a-z]' '[A-Z]'` + + + case $DFT_LWR_MODEL in + normal) DFT_DEP_SUFFIX='.a' ;; + debug) DFT_DEP_SUFFIX='_g.a' ;; + profile) DFT_DEP_SUFFIX='_p.a' ;; + shared) + case $cf_cv_system_name in + openbsd*|netbsd*|freebsd*) + DFT_DEP_SUFFIX='.so.$(REL_VERSION)' ;; + hpux*) DFT_DEP_SUFFIX='.sl' ;; + *) DFT_DEP_SUFFIX='.so' ;; + esac + esac + + case $DFT_LWR_MODEL in + normal) DFT_ARG_SUFFIX='' ;; + debug) DFT_ARG_SUFFIX='_g' ;; + profile) DFT_ARG_SUFFIX='_p' ;; + shared) DFT_ARG_SUFFIX='' ;; + esac + + case $DFT_LWR_MODEL in + normal) DFT_OBJ_SUBDIR='objects' ;; + debug) DFT_OBJ_SUBDIR='obj_g' ;; + profile) DFT_OBJ_SUBDIR='obj_p' ;; + shared) DFT_OBJ_SUBDIR='obj_s' ;; + esac + +TINFO_NAME=tinfo + + +LIB_NAME=ncurses + + +LIB_DIR=../lib + + case $cf_cv_system_name in + os2) cf_prefix='' ;; + *) cf_prefix='lib' ;; + esac + +LIB_PREFIX=$LIB_DIR/$cf_prefix + + + +if test X"$CC_G_OPT" = X"" ; then + CC_G_OPT='-g' + test -n "$GCC" && test "${ac_cv_prog_cc_g}" != yes && CC_G_OPT='' +fi + + +if test X"$CXX_G_OPT" = X"" ; then + CXX_G_OPT='-g' + test -n "$GXX" && test "${ac_cv_prog_cxx_g}" != yes && CXX_G_OPT='' +fi + + +case $DFT_LWR_MODEL in +normal) LD_MODEL='' ;; +debug) LD_MODEL=$CC_G_OPT ;; +profile) LD_MODEL='-pg';; +shared) LD_MODEL='' ;; +esac + +echo $ac_n "checking if rpath option should be used""... $ac_c" 1>&6 +echo "configure:2506: checking if rpath option should be used" >&5 + +# Check whether --enable-rpath or --disable-rpath was given. +if test "${enable_rpath+set}" = set; then + enableval="$enable_rpath" + cf_cv_ld_rpath=$enableval +else + cf_cv_ld_rpath=no +fi + +echo "$ac_t""$cf_cv_ld_rpath" 1>&6 + + + + LOCAL_LDFLAGS= + LOCAL_LDFLAGS2= + LD_SHARED_OPTS= + INSTALL_LIB="-m 644" + + 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:2528: 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 + withval="$with_shlib_version" + test -z "$withval" && withval=auto + case $withval in #(vi + yes) #(vi + cf_cv_shlib_version=auto + ;; + rel|abi|auto|no) #(vi + cf_cv_shlib_version=$withval + ;; + *) + { echo "configure: error: option value must be one of: rel, abi, auto or no" 1>&2; exit 1; } + ;; + esac + +else + cf_cv_shlib_version=auto +fi + + echo "$ac_t""$cf_cv_shlib_version" 1>&6 + + cf_cv_rm_so_locs=no + + case $cf_cv_system_name in + hpux10.*) + # (tested with gcc 2.7.2 -- I don't have c89) + if test -n "$GCC"; then + CC_SHARED_OPTS='-fPIC' + LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)' + else + CC_SHARED_OPTS='+Z' + LD_SHARED_OPTS='-Wl,+b,$(libdir)' + fi + MK_SHARED_LIB='$(LD) +b $(libdir) -b +h `basename $@` -o $@' + # HP-UX shared libraries must be executable, and should be + # readonly to exploit a quirk in the memory manager. + INSTALL_LIB="-m 555" + cf_cv_do_symlinks=reverse + ;; + hpux*) + # (tested with gcc 2.7.2 -- I don't have c89) + if test -n "$GCC"; then + CC_SHARED_OPTS='-fPIC' + LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)' + else + CC_SHARED_OPTS='+Z' + LD_SHARED_OPTS='-Wl,+b,$(libdir)' + fi + MK_SHARED_LIB='$(LD) +b $(libdir) -b -o $@' + # HP-UX shared libraries must be executable, and should be + # readonly to exploit a quirk in the memory manager. + INSTALL_LIB="-m 555" + ;; + irix*) + # tested with IRIX 5.2 and 'cc'. + if test -n "$GCC"; then + CC_SHARED_OPTS='-fPIC' + else + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $@` -o $@' + cf_cv_rm_so_locs=yes + ;; + linux*|gnu*) + # tested with Linux 2.0.29 and gcc 2.7.2 (ELF) + CC_SHARED_OPTS='-fpic' + test $cf_cv_ld_rpath = yes && cf_ld_rpath_opt="-Wl,-rpath," + if test $DFT_LWR_MODEL = "shared" ; then + LOCAL_LDFLAGS='-Wl,-rpath,../lib' + LOCAL_LDFLAGS2='-Wl,-rpath,../../lib' + fi + test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel + if test $cf_cv_shlib_version = no ; then + MK_SHARED_LIB='gcc -shared -Wl,-stats,-lc -o $@' + else + MK_SHARED_LIB='gcc -shared -Wl,-soname,`basename $@.$(ABI_VERSION)`,-stats,-lc -o $@' + fi + ;; + openbsd2*) + CC_SHARED_OPTS='-fpic -DPIC' + MK_SHARED_LIB='$(LD) -Bshareable -soname,`basename $@.$(ABI_VERSION)` -o $@' + ;; + openbsd*|netbsd*|freebsd*) + CC_SHARED_OPTS='-fpic -DPIC' + MK_SHARED_LIB='$(LD) -Bshareable -o $@' + ;; + osf*|mls+*) + # tested with OSF/1 V3.2 and 'cc' + # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't + # link with shared libs). + CC_SHARED_OPTS='' + MK_SHARED_LIB='$(LD) -set_version $(REL_VERSION):$(ABI_VERSION) -expect_unresolved "*" -shared -soname `basename $@`' + test $cf_cv_ld_rpath = yes && cf_ld_rpath_opt="-rpath" + case $host_os in + osf4*) + MK_SHARED_LIB="${MK_SHARED_LIB} -msym" + ;; + esac + MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $@' + if test $DFT_LWR_MODEL = "shared" ; then + LOCAL_LDFLAGS='-Wl,-rpath,../lib' + LOCAL_LDFLAGS2='-Wl,-rpath,../../lib' + fi + cf_cv_rm_so_locs=yes + ;; + sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98 + # tested with osr5.0.5 + if test $ac_cv_prog_gcc = yes; then + CC_SHARED_OPTS='-melf -fpic' + else + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='$(LD) -dy -G -h `basename $@.$(ABI_VERSION)` -o $@' + if test $cf_cv_ld_rpath = yes ; then + # only way is to set LD_RUN_PATH but no switch for it + RUN_PATH=$libdir + fi + test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel + LINK_PROGS='LD_RUN_PATH=$(libdir)' + LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib' + ;; + sunos4*) + # tested with SunOS 4.1.1 and gcc 2.7.0 + if test $ac_cv_prog_gcc = yes; then + CC_SHARED_OPTS='-fpic' + else + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='$(LD) -assert pure-text -o $@' + test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel + ;; + solaris2*) + # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2 + if test $ac_cv_prog_gcc = yes; then + CC_SHARED_OPTS='-fpic' + else + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='$(LD) -dy -G -h `basename $@.$(ABI_VERSION)` -o $@' + if test $cf_cv_ld_rpath = yes ; then + cf_ld_rpath_opt="-R" + EXTRA_LDFLAGS="-R ../lib:\$(libdir) $EXTRA_LDFLAGS" + fi + test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel + ;; + unix_sv*) + # tested with UnixWare 1.1.2 + CC_SHARED_OPTS='-KPIC' + MK_SHARED_LIB='$(LD) -d y -G -o $@' + ;; + *) + CC_SHARED_OPTS='unknown' + MK_SHARED_LIB='echo unknown' + ;; + esac + + # This works if the last tokens in $MK_SHARED_LIB are the -o target. + case "$cf_cv_shlib_version" in #(vi + rel|abi) + case "$MK_SHARED_LIB" in #(vi + *'-o $@') + if test "$cf_cv_do_symlinks" = reverse ; then + { echo "configure: error: cannot use --with-shlib-version with this platform" 1>&2; exit 1; } + fi + if test "$cf_cv_shlib_version" = rel ; then + MK_SHARED_LIB="$MK_SHARED_LIB"'.$(REL_VERSION)' + else + MK_SHARED_LIB="$MK_SHARED_LIB"'.$(ABI_VERSION)' + fi + cf_cv_do_symlinks=yes + ;; + *) + echo "configure: warning: ignored --with-shlib-version" 1>&2 + ;; + esac + ;; + esac + + 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:2711: checking if we need a space after rpath option" >&5 + cf_save_LIBS="$LIBS" + LIBS="$LIBS ${cf_ld_rpath_opt}/usr/lib" + cat > conftest.$ac_ext <<EOF +#line 2715 "configure" +#include "confdefs.h" + +int main() { + +; return 0; } +EOF +if { (eval echo configure:2722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + cf_rpath_space=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_rpath_space=yes +fi +rm -f conftest* + LIBS="$cf_save_LIBS" + echo "$ac_t""$cf_rpath_space" 1>&6 + test $cf_rpath_space = yes && cf_ld_rpath_opt="$cf_ld_rpath_opt " + MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\$(libdir)" + fi + + + + + + + + + + + + +if test "$CC_SHARED_OPTS" = "unknown"; then + for model in $cf_list_models; do + if test "$model" = "shared"; then + { echo "configure: error: Shared libraries are not supported in this version" 1>&2; exit 1; } + fi + done +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:2762: 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 + test "$with_overwrite" = no && \ + test "x$includedir" = 'x${prefix}/include' && \ + includedir='$(prefix)/include/ncurses' + +else + with_overwrite=yes +fi + +echo "$ac_t""$with_overwrite" 1>&6 +echo $ac_n "checking where we will install curses.h""... $ac_c" 1>&6 +echo "configure:2778: checking where we will install curses.h" >&5 +echo "$ac_t""$includedir" 1>&6 + +echo $ac_n "checking if external terminfo-database is used""... $ac_c" 1>&6 +echo "configure:2782: checking if external terminfo-database is used" >&5 + +# Check whether --enable-database or --disable-database was given. +if test "${enable_database+set}" = set; then + enableval="$enable_database" + with_database=$enableval +else + with_database=yes +fi + +echo "$ac_t""$with_database" 1>&6 +test $with_database != no && cat >> confdefs.h <<\EOF +#define USE_DATABASE 1 +EOF + + +echo $ac_n "checking if you want to build with function extensions""... $ac_c" 1>&6 +echo "configure:2799: 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 + enableval="$enable_ext_funcs" + with_ext_funcs=$enableval +else + with_ext_funcs=yes +fi + +echo "$ac_t""$with_ext_funcs" 1>&6 +test "$with_ext_funcs" = yes && cat >> confdefs.h <<\EOF +#define NCURSES_EXT_FUNCS 1 +EOF + + +echo $ac_n "checking for list of fallback descriptions""... $ac_c" 1>&6 +echo "configure:2816: checking for list of fallback descriptions" >&5 + +# Check whether --with-fallbacks or --without-fallbacks was given. +if test "${with_fallbacks+set}" = set; then + withval="$with_fallbacks" + with_fallback=$withval +else + with_fallback= +fi + +echo "$ac_t""$with_fallback" 1>&6 +FALLBACK_LIST=`echo $with_fallback|sed -e 's/,/ /g'` + + +echo $ac_n "checking for list of terminfo directories""... $ac_c" 1>&6 +echo "configure:2831: checking for list of terminfo directories" >&5 + + +# Check whether --with-terminfo-dirs or --without-terminfo-dirs was given. +if test "${with_terminfo_dirs+set}" = set; then + withval="$with_terminfo_dirs" + : +else + withval="${TERMINFO_DIRS-${datadir}/terminfo}" +fi + +IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" +cf_dst_path= +for cf_src_path in $withval +do + +case ".$cf_src_path" in #(vi +./*) #(vi + ;; +.\${*prefix}*) #(vi + eval cf_src_path="$cf_src_path" + case ".$cf_src_path" in #(vi + .NONE/*) + cf_src_path=`echo $cf_src_path | sed -e s@NONE@$ac_default_prefix@` + ;; + esac + ;; #(vi +.NONE/*) + cf_src_path=`echo $cf_src_path | sed -e s@NONE@$ac_default_prefix@` + ;; +*) + { echo "configure: error: expected a pathname" 1>&2; exit 1; } + ;; +esac + + test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:" + cf_dst_path="${cf_dst_path}${cf_src_path}" +done +IFS="$ac_save_ifs" + +eval TERMINFO_DIRS="$cf_dst_path" + +echo "$ac_t""$TERMINFO_DIRS" 1>&6 +test -n "$TERMINFO_DIRS" && cat >> confdefs.h <<EOF +#define TERMINFO_DIRS "$TERMINFO_DIRS" +EOF + + +if test $with_database = no ; then + if test -z $with_fallback ; then + { echo "configure: error: You have disabled the database w/o specifying fallbacks" 1>&2; exit 1; } + fi +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:2888: 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 + enableval="$enable_big_core" + with_big_core=$enableval +else + if test "$cross_compiling" = yes; then + with_big_core=no +else + cat > conftest.$ac_ext <<EOF +#line 2899 "configure" +#include "confdefs.h" + +#include <stdlib.h> +#include <string.h> +int main() { exit(malloc(6000000L) == 0); } +EOF +if { (eval echo configure:2906: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + with_big_core=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$with_big_core" 1>&6 +test "$with_big_core" = "yes" && cat >> confdefs.h <<\EOF +#define HAVE_BIG_CORE 1 +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:2928: checking if you want termcap-fallback support" >&5 + +# Check whether --enable-termcap or --disable-termcap was given. +if test "${enable_termcap+set}" = set; then + enableval="$enable_termcap" + with_termcap=$enableval +else + with_termcap=no +fi + +echo "$ac_t""$with_termcap" 1>&6 + +if test "$with_termcap" != "yes" ; then + cat >> confdefs.h <<\EOF +#define PURE_TERMINFO 1 +EOF + +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:2949: checking if fast termcap-loader is needed" >&5 + +# Check whether --enable-getcap or --disable-getcap was given. +if test "${enable_getcap+set}" = set; then + enableval="$enable_getcap" + with_getcap=$enableval +else + with_getcap=no +fi + +echo "$ac_t""$with_getcap" 1>&6 +test "$with_getcap" = "yes" && cat >> confdefs.h <<\EOF +#define USE_GETCAP 1 +EOF + + +echo $ac_n "checking if translated termcaps will be cached in ~/.terminfo""... $ac_c" 1>&6 +echo "configure:2966: 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 + enableval="$enable_getcap_cache" + with_getcap_cache=$enableval +else + with_getcap_cache=no +fi + +echo "$ac_t""$with_getcap_cache" 1>&6 +test "$with_getcap_cache" = "yes" && cat >> confdefs.h <<\EOF +#define USE_GETCAP_CACHE 1 +EOF + + +fi + +### Use option --enable-symlinks to make tic use symlinks, not hard links +### to reduce storage requirements for the terminfo database. + +for ac_func in \ + remove \ + unlink +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2992: 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 2997 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3020: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +if test "$ac_cv_prog_cc_cross" = yes ; then + for ac_func in \ + link \ + symlink +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3051: 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 3056 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3079: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +else + echo $ac_n "checking if link/symlink functions work""... $ac_c" 1>&6 +echo "configure:3105: 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 + + cf_cv_link_funcs= + for cf_func in link symlink ; do + if test "$cross_compiling" = yes; then + + eval 'ac_cv_func_'$cf_func'=error' +else + cat > conftest.$ac_ext <<EOF +#line 3117 "configure" +#include "confdefs.h" + +#include <sys/types.h> +#include <sys/stat.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +int main() +{ + int fail = 0; + char *src = "config.log"; + char *dst = "conftest.chk"; + struct stat src_sb; + struct stat dst_sb; + + stat(src, &src_sb); + fail = ($cf_func("config.log", "conftest.chk") < 0) + || (stat(dst, &dst_sb) < 0) + || (dst_sb.st_mtime != src_sb.st_mtime); +#ifdef HAVE_UNLINK + unlink(dst); +#else + remove(dst); +#endif + exit (fail); +} + +EOF +if { (eval echo configure:3146: \"$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" + eval 'ac_cv_func_'$cf_func'=yes' +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + + eval 'ac_cv_func_'$cf_func'=no' +fi +rm -fr conftest* +fi + + done + test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no + +fi + +echo "$ac_t""$cf_cv_link_funcs" 1>&6 +fi + + +with_links=no +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:3175: checking if tic should use symbolic links" >&5 + if test "$ac_cv_func_symlink" = yes ; then + with_symlinks=yes + else + with_symlinks=no + fi + 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:3184: checking if tic should use hard links" >&5 + if test "$ac_cv_func_link" = yes ; then + with_links=yes + else + with_links=no + fi + echo "$ac_t""$with_links" 1>&6 +else + echo $ac_n "checking if tic should use symbolic links""... $ac_c" 1>&6 +echo "configure:3193: checking if tic should use symbolic links" >&5 + +# Check whether --enable-symlinks or --disable-symlinks was given. +if test "${enable_symlinks+set}" = set; then + enableval="$enable_symlinks" + with_symlinks=$enableval +else + with_symlinks=no +fi + + echo "$ac_t""$with_symlinks" 1>&6 +fi + +test "$with_links" = yes && cat >> confdefs.h <<\EOF +#define USE_LINKS 1 +EOF + +test "$with_symlinks" = yes && cat >> confdefs.h <<\EOF +#define USE_SYMLINKS 1 +EOF + + +### 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:3217: 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 + enableval="$enable_bsdpad" + with_bsdpad=$enableval +else + with_bsdpad=no +fi + +echo "$ac_t""$with_bsdpad" 1>&6 +test "$with_bsdpad" = yes && cat >> confdefs.h <<\EOF +#define BSD_TPUTS 1 +EOF + + +### 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:3235: checking for extended use of const keyword" >&5 + +# Check whether --enable-const or --disable-const was given. +if test "${enable_const+set}" = set; then + enableval="$enable_const" + with_ext_const=$enableval +else + with_ext_const=no +fi + +echo "$ac_t""$with_ext_const" 1>&6 +NCURSES_CONST="" +if test "$with_ext_const" = yes ; then + cat >> confdefs.h <<\EOF +#define NCURSES_CONST const +EOF + + NCURSES_CONST=const +fi + + +### Enable compiling-in rcs id's +echo $ac_n "checking if RCS identifiers should be compiled-in""... $ac_c" 1>&6 +echo "configure:3258: 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 + withval="$with_rcs_ids" + with_rcs_ids=$withval +else + with_rcs_ids=no +fi + +echo "$ac_t""$with_rcs_ids" 1>&6 +test "$with_rcs_ids" = yes && cat >> confdefs.h <<\EOF +#define USE_RCS_IDS 1 +EOF + + +############################################################################### + +echo $ac_n "checking if you want all experimental code""... $ac_c" 1>&6 +echo "configure:3277: checking if you want all experimental code" >&5 + +# Check whether --with-develop or --without-develop was given. +if test "${with_develop+set}" = set; then + withval="$with_develop" + with_develop=$withval +else + with_develop=no +fi + +echo "$ac_t""$with_develop" 1>&6 + +### 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:3291: 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 + enableval="$enable_broken_linker" + with_broken_linker=$enableval +else + with_broken_linker=$BROKEN_LINKER +fi + +echo "$ac_t""$with_broken_linker" 1>&6 +test "$with_broken_linker" = yes && cat >> confdefs.h <<\EOF +#define BROKEN_LINKER 1 +EOF + + +### use option --enable-hard-tabs to turn on use of hard-tabs optimize +echo $ac_n "checking if you want experimental hard-tabs code""... $ac_c" 1>&6 +echo "configure:3309: checking if you want experimental hard-tabs code" >&5 + +# Check whether --enable-hard-tabs or --disable-hard-tabs was given. +if test "${enable_hard_tabs+set}" = set; then + enableval="$enable_hard_tabs" + with_hardtabs=$enableval +else + with_hardtabs=$with_develop +fi + +echo "$ac_t""$with_hardtabs" 1>&6 +test "$with_hardtabs" = yes && cat >> confdefs.h <<\EOF +#define USE_HARD_TABS 1 +EOF + + +### use option --enable-hashmap to turn on use of hashmap scrolling logic +echo $ac_n "checking if you want experimental hashmap code""... $ac_c" 1>&6 +echo "configure:3327: checking if you want experimental hashmap code" >&5 + +# Check whether --enable-hashmap or --disable-hashmap was given. +if test "${enable_hashmap+set}" = set; then + enableval="$enable_hashmap" + with_hashmap=$enableval +else + with_hashmap=yes +fi + +echo "$ac_t""$with_hashmap" 1>&6 +test "$with_hashmap" = yes && cat >> confdefs.h <<\EOF +#define USE_HASHMAP 1 +EOF + + +echo $ac_n "checking if you want experimental no-padding code""... $ac_c" 1>&6 +echo "configure:3344: checking if you want experimental no-padding code" >&5 + +# Check whether --enable-no-padding or --disable-no-padding was given. +if test "${enable_no_padding+set}" = set; then + enableval="$enable_no_padding" + with_no_padding=$enableval +else + with_no_padding=yes +fi + +echo "$ac_t""$with_no_padding" 1>&6 +test "$with_no_padding" = yes && cat >> confdefs.h <<\EOF +#define NCURSES_NO_PADDING 1 +EOF + + +echo $ac_n "checking if you want experimental safe-sprintf code""... $ac_c" 1>&6 +echo "configure:3361: 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 + enableval="$enable_safe_sprintf" + with_safe_sprintf=$enableval +else + with_safe_sprintf=no +fi + +echo "$ac_t""$with_safe_sprintf" 1>&6 +test "$with_safe_sprintf" = yes && cat >> confdefs.h <<\EOF +#define USE_SAFE_SPRINTF 1 +EOF + + +### use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic +echo $ac_n "checking if you want to experiment without scrolling-hints code""... $ac_c" 1>&6 +echo "configure:3379: 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 + enableval="$enable_scroll_hints" + with_scroll_hints=$enableval +else + with_scroll_hints=yes; + # when hashmap is used scroll hints are useless + test $with_hashmap = yes && with_scroll_hints=no +fi + +echo "$ac_t""$with_scroll_hints" 1>&6 +test "$with_scroll_hints" = yes && cat >> confdefs.h <<\EOF +#define USE_SCROLL_HINTS 1 +EOF + + +### use option --enable-tcap-names to allow user to define new capabilities +echo $ac_n "checking if you want experimental definable names like termcap""... $ac_c" 1>&6 +echo "configure:3399: checking if you want experimental definable names like termcap" >&5 + +# Check whether --enable-tcap-names or --disable-tcap-names was given. +if test "${enable_tcap_names+set}" = set; then + enableval="$enable_tcap_names" + with_tcap_names=$enableval +else + with_tcap_names=$with_develop +fi + +echo "$ac_t""$with_tcap_names" 1>&6 +NCURSES_XNAMES=0 +test "$with_tcap_names" = yes && NCURSES_XNAMES=1 + + +### use option --enable-sigwinch to turn on use of SIGWINCH logic +echo $ac_n "checking if you want experimental SIGWINCH handler""... $ac_c" 1>&6 +echo "configure:3416: checking if you want experimental SIGWINCH handler" >&5 + +# Check whether --enable-sigwinch or --disable-sigwinch was given. +if test "${enable_sigwinch+set}" = set; then + enableval="$enable_sigwinch" + with_sigwinch=$enableval +else + with_sigwinch=yes +fi + +echo "$ac_t""$with_sigwinch" 1>&6 +test "$with_sigwinch" = yes && cat >> confdefs.h <<\EOF +#define USE_SIGWINCH 1 +EOF + + +### 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:3434: 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 + enableval="$enable_widec" + with_widec=$enableval +else + with_widec=no +fi + +echo "$ac_t""$with_widec" 1>&6 +test "$with_widec" = yes && cat >> confdefs.h <<\EOF +#define USE_WIDEC_SUPPORT 1 +EOF + + +### use option --enable-xmc-glitch to turn on use of magic-cookie optimize +echo $ac_n "checking if you want experimental xmc code""... $ac_c" 1>&6 +echo "configure:3452: checking if you want experimental xmc code" >&5 + +# Check whether --enable-xmc-glitch or --disable-xmc-glitch was given. +if test "${enable_xmc_glitch+set}" = set; then + enableval="$enable_xmc_glitch" + with_xmc_glitch=$enableval +else + with_xmc_glitch=$with_develop +fi + +echo "$ac_t""$with_xmc_glitch" 1>&6 +test "$with_xmc_glitch" = yes && cat >> confdefs.h <<\EOF +#define USE_XMC_SUPPORT 1 +EOF + + +############################################################################### + + +### use option --disable-echo to suppress full display compiling commands + +# Check whether --enable-echo or --disable-echo was given. +if test "${enable_echo+set}" = set; then + enableval="$enable_echo" + with_echo=$enableval +else + with_echo=yes +fi + +if test "$with_echo" = yes; then + ECHO_LINK= +else + ECHO_LINK='@ echo linking $@ ... ;' +fi + + +### use option --enable-warnings to turn on all gcc warnings + +# Check whether --enable-warnings or --disable-warnings was given. +if test "${enable_warnings+set}" = set; then + enableval="$enable_warnings" + with_warnings=$enableval +fi + +if test -n "$with_warnings"; then + ADAFLAGS="$ADAFLAGS -gnatg" + +if test -n "$GCC" +then + cat > conftest.$ac_ext <<EOF +#line 3502 "configure" +int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; } +EOF + echo "checking for gcc warning options" 1>&6 +echo "configure:3506: checking for gcc warning options" >&5 + cf_save_CFLAGS="$CFLAGS" + EXTRA_CFLAGS="-W -Wall" + cf_warn_CONST="" + test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" + for cf_opt in \ + Wbad-function-cast \ + Wcast-align \ + Wcast-qual \ + Winline \ + Wmissing-declarations \ + Wmissing-prototypes \ + Wnested-externs \ + Wpointer-arith \ + Wshadow \ + Wstrict-prototypes $cf_warn_CONST + do + CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" + if { (eval echo configure:3524: \"$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" + fi + done + rm -f conftest* + CFLAGS="$cf_save_CFLAGS" +fi + + +fi + +if test -n "$GCC" +then +cat > conftest.i <<EOF +#ifndef GCC_PRINTF +#define GCC_PRINTF 0 +#endif +#ifndef GCC_SCANF +#define GCC_SCANF 0 +#endif +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif +EOF +if test -n "$GCC" +then + echo "checking for gcc __attribute__ directives" 1>&6 +echo "configure:3556: checking for gcc __attribute__ directives" >&5 + cat > conftest.$ac_ext <<EOF +#line 3558 "configure" +#include "confdefs.h" +#include "conftest.h" +#include "conftest.i" +#if GCC_PRINTF +#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) +#else +#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ +#endif +#if GCC_SCANF +#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) +#else +#define GCC_SCANFLIKE(fmt,var) /*nothing*/ +#endif +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; } +EOF + for cf_attribute in scanf printf unused noreturn + do + +CF_ATTRIBUTE=`echo $cf_attribute | tr '[a-z]' '[A-Z]'` + + cf_directive="__attribute__(($cf_attribute))" + echo "checking for gcc $cf_directive" 1>&5 + case $cf_attribute in + scanf|printf) + cat >conftest.h <<EOF +#define GCC_$CF_ATTRIBUTE 1 +EOF + ;; + *) + cat >conftest.h <<EOF +#define GCC_$CF_ATTRIBUTE $cf_directive +EOF + ;; + esac + if { (eval echo configure:3596: \"$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 +# sed -e 's/__attr.*/\/*nothing*\//' conftest.h >>confdefs.h + fi + done +else + fgrep define conftest.i >>confdefs.h +fi +rm -rf conftest* +fi + + +### use option --enable-assertions to turn on generation of assertion code + +# Check whether --enable-assertions or --disable-assertions was given. +if test "${enable_assertions+set}" = set; then + enableval="$enable_assertions" + with_assertions=$enableval +else + with_assertions=no +fi + +if test -n "$GCC" +then + if test $with_assertions = no + then + cat >> confdefs.h <<\EOF +#define NDEBUG 1 +EOF + + CPPFLAGS="$CPPFLAGS -DNDEBUG" + else + ADAFLAGS="$ADAFLAGS -gnata" + fi +fi + +### use option --disable-leaks to suppress "permanent" leaks, for testing + +# Check whether --enable-leaks or --disable-leaks was given. +if test "${enable_leaks+set}" = set; then + enableval="$enable_leaks" + test $enableval = no && cat >> confdefs.h <<\EOF +#define NO_LEAKS 1 +EOF + +fi + +cat >> confdefs.h <<\EOF +#define HAVE_NC_ALLOC_H 1 +EOF + + +### use option --enable-expanded to generate certain macros as functions + +# Check whether --enable-expanded or --disable-expanded was given. +if test "${enable_expanded+set}" = set; then + enableval="$enable_expanded" + test $enableval = yes && cat >> confdefs.h <<\EOF +#define NCURSES_EXPANDED 1 +EOF + +fi + + +### use option --disable-macros to suppress macros in favor of functions + +# Check whether --enable-macros or --disable-macros was given. +if test "${enable_macros+set}" = set; then + enableval="$enable_macros" + test $enableval = no && cat >> confdefs.h <<\EOF +#define NCURSES_NOMACROS 1 +EOF + +fi + + +### Checks for libraries. +echo $ac_n "checking for gettimeofday""... $ac_c" 1>&6 +echo "configure:3676: 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 3681 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gettimeofday(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gettimeofday(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gettimeofday) || defined (__stub___gettimeofday) +choke me +#else +gettimeofday(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3704: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_gettimeofday=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'gettimeofday`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_GETTIMEOFDAY 1 +EOF + +else + echo "$ac_t""no" 1>&6 + + +echo $ac_n "checking for gettimeofday in -lbsd""... $ac_c" 1>&6 +echo "configure:3727: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-lbsd $LIBS" +cat > conftest.$ac_ext <<EOF +#line 3735 "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 + builtin and then its argument prototype would still apply. */ +char gettimeofday(); + +int main() { +gettimeofday() +; return 0; } +EOF +if { (eval echo configure:3746: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_GETTIMEOFDAY 1 +EOF + + LIBS="$LIBS -lbsd" +else + echo "$ac_t""no" 1>&6 +fi + +fi + +MATH_LIB="" +echo $ac_n "checking for sin""... $ac_c" 1>&6 +echo "configure:3774: checking for sin" >&5 +if eval "test \"`echo '$''{'ac_cv_func_sin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3779 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char sin(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sin(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_sin) || defined (__stub___sin) +choke me +#else +sin(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_sin=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_sin=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'sin`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6 +echo "configure:3820: checking for sin in -lm" >&5 +ac_lib_var=`echo m'_'sin | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lm $LIBS" +cat > conftest.$ac_ext <<EOF +#line 3828 "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 + builtin and then its argument prototype would still apply. */ +char sin(); + +int main() { +sin() +; return 0; } +EOF +if { (eval echo configure:3839: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + MATH_LIB="-lm" +else + echo "$ac_t""no" 1>&6 +fi + +fi + + + +### Checks for header files. +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:3865: 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 3870 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3878: \"$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* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +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 3895 "configure" +#include "confdefs.h" +#include <string.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +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 3913 "configure" +#include "confdefs.h" +#include <stdlib.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext <<EOF +#line 3934 "configure" +#include "confdefs.h" +#include <ctype.h> +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:3945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +ac_header_dirent=no +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:3973: 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 3978 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <$ac_hdr> +int main() { +DIR *dirp = 0; +; return 0; } +EOF +if { (eval echo configure:3986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_dirent_'$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 + ac_header_dirent=$ac_hdr; break +else + echo "$ac_t""no" 1>&6 +fi +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:4011: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-ldir $LIBS" +cat > conftest.$ac_ext <<EOF +#line 4019 "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 + builtin and then its argument prototype would still apply. */ +char opendir(); + +int main() { +opendir() +; return 0; } +EOF +if { (eval echo configure:4030: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -ldir" +else + echo "$ac_t""no" 1>&6 +fi + +else +echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 +echo "configure:4052: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-lx $LIBS" +cat > conftest.$ac_ext <<EOF +#line 4060 "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 + builtin and then its argument prototype would still apply. */ +char opendir(); + +int main() { +opendir() +; return 0; } +EOF +if { (eval echo configure:4071: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lx" +else + echo "$ac_t""no" 1>&6 +fi + +fi + + +echo $ac_n "checking for regular-expression headers""... $ac_c" 1>&6 +echo "configure:4095: 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 4101 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <regex.h> +int main() { + + regex_t *p; + int x = regcomp(p, "", 0); + int y = regexec(p, "", 0, 0, 0); + regfree(p); + +; return 0; } +EOF +if { (eval echo configure:4114: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + cf_cv_regex="regex.h" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + cat > conftest.$ac_ext <<EOF +#line 4123 "configure" +#include "confdefs.h" +#include <regexp.h> +int main() { + + char *p = compile("", "", "", 0); + int x = step("", ""); + +; return 0; } +EOF +if { (eval echo configure:4133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + cf_cv_regex="regexp.h" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + cf_save_LIBS="$LIBS" + LIBS="-lgen $LIBS" + cat > conftest.$ac_ext <<EOF +#line 4144 "configure" +#include "confdefs.h" +#include <regexpr.h> +int main() { + + char *p = compile("", "", ""); + int x = step("", ""); + +; return 0; } +EOF +if { (eval echo configure:4154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + cf_cv_regex="regexpr.h" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + LIBS="$cf_save_LIBS" +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + +fi + +echo "$ac_t""$cf_cv_regex" 1>&6 +case $cf_cv_regex in + regex.h) cat >> confdefs.h <<\EOF +#define HAVE_REGEX_H_FUNCS 1 +EOF + ;; + regexp.h) cat >> confdefs.h <<\EOF +#define HAVE_REGEXP_H_FUNCS 1 +EOF + ;; + regexpr.h) cat >> confdefs.h <<\EOF +#define HAVE_REGEXPR_H_FUNCS 1 +EOF + ;; +esac + + +for ac_hdr in \ +fcntl.h \ +getopt.h \ +libc.h \ +limits.h \ +locale.h \ +sys/bsdtypes.h \ +sys/ioctl.h \ +sys/param.h \ +poll.h \ +sys/select.h \ +sys/stropts.h \ +sys/time.h \ +sys/times.h \ +termio.h \ +termios.h \ +ttyent.h \ +unistd.h \ +values.h \ + +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:4211: 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 4216 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:4221: \"$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 + + +# check for ISC (this may also define _POSIX_SOURCE) +# 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:4252: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-lcposix $LIBS" +cat > conftest.$ac_ext <<EOF +#line 4260 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:4267: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo cposix | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lcposix $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + + echo $ac_n "checking for bzero in -linet""... $ac_c" 1>&6 +echo "configure:4295: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-linet $LIBS" +cat > conftest.$ac_ext <<EOF +#line 4303 "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 + builtin and then its argument prototype would still apply. */ +char bzero(); + +int main() { +bzero() +; return 0; } +EOF +if { (eval echo configure:4314: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -linet" +else + echo "$ac_t""no" 1>&6 +fi + for ac_hdr in sys/termio.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:4337: 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 4342 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:4347: \"$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 + +fi + + +echo $ac_n "checking if sys/time.h works with sys/select.h""... $ac_c" 1>&6 +echo "configure:4377: 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 4383 "configure" +#include "confdefs.h" + +#include <sys/types.h> +#if HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +#if HAVE_SYS_SELECT_H +#include <sys/select.h> +#endif + +int main() { + +; return 0; } +EOF +if { (eval echo configure:4398: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_sys_time_select=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_sys_time_select=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$cf_cv_sys_time_select" 1>&6 +test $cf_cv_sys_time_select = yes && cat >> confdefs.h <<\EOF +#define HAVE_SYS_TIME_SELECT 1 +EOF + + + +### checks for compiler characteristics +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:4427: 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 4432 "configure" +#include "confdefs.h" + +int main() { + +/* Ultrix mips cc rejects this. */ +typedef int charset[2]; const charset x; +/* SunOS 4.1.1 cc rejects this. */ +char const *const *ccp; +char **p; +/* NEC SVR4.0.2 mips cc rejects this. */ +struct point {int x, y;}; +static struct point const zero = {0,0}; +/* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in an arm + of an if-expression whose if-part is not a constant expression */ +const char *g = "string"; +ccp = &g + (g ? g-g : 0); +/* HPUX 7.0 cc rejects these. */ +++ccp; +p = (char**) ccp; +ccp = (char const *const *) p; +{ /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; +} +{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; +} +{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; +} +{ /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:4481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for inline""... $ac_c" 1>&6 +echo "configure:4502: 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 4509 "configure" +#include "confdefs.h" + +int main() { +} $ac_kw foo() { +; return 0; } +EOF +if { (eval echo configure:4516: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_inline=$ac_kw; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done + +fi + +echo "$ac_t""$ac_cv_c_inline" 1>&6 +case "$ac_cv_c_inline" in + inline | yes) ;; + no) cat >> confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >> confdefs.h <<EOF +#define inline $ac_cv_c_inline +EOF + ;; +esac + +test $ac_cv_c_inline != no && cat >> confdefs.h <<\EOF +#define CC_HAS_INLINE_FUNCS 1 +EOF + + + +echo $ac_n "checking if unsigned literals are legal""... $ac_c" 1>&6 +echo "configure:4548: 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 4554 "configure" +#include "confdefs.h" + +int main() { +long x = 1L + 1UL + 1U + 1 +; return 0; } +EOF +if { (eval echo configure:4561: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_unsigned_literals=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_unsigned_literals=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$cf_cv_unsigned_literals" 1>&6 + + + +echo $ac_n "checking for type of chtype""... $ac_c" 1>&6 +echo "configure:4579: 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 + + if test "$cross_compiling" = yes; then + cf_cv_typeof_chtype=long +else + cat > conftest.$ac_ext <<EOF +#line 4588 "configure" +#include "confdefs.h" + +#if USE_WIDEC_SUPPORT +#include <stddef.h> /* we want wchar_t */ +#define WANT_BITS 39 +#else +#define WANT_BITS 31 +#endif +#include <stdio.h> +int main() +{ + FILE *fp = fopen("cf_test.out", "w"); + if (fp != 0) { + char *result = "long"; +#if USE_WIDEC_SUPPORT + /* + * If wchar_t is smaller than a long, it must be an int or a + * short. We prefer not to use a short anyway. + */ + if (sizeof(unsigned long) > sizeof(wchar_t)) + result = "int"; +#endif + if (sizeof(unsigned long) > sizeof(unsigned int)) { + int n; + unsigned int x; + for (n = 0; n < WANT_BITS; n++) { + unsigned int y = (x >> n); + if (y != 1 || x == 0) { + x = 0; + break; + } + } + /* + * If x is nonzero, an int is big enough for the bits + * that we want. + */ + result = (x != 0) ? "int" : "long"; + } + fputs(result, fp); + fclose(fp); + } + exit(0); +} + +EOF +if { (eval echo configure:4634: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + cf_cv_typeof_chtype=long +fi +rm -fr conftest* +fi + + rm -f cf_test.out + +fi + +echo "$ac_t""$cf_cv_typeof_chtype" 1>&6 + + +cat >> confdefs.h <<EOF +#define TYPEOF_CHTYPE $cf_cv_typeof_chtype +EOF + + +cf_cv_1UL="1" +test "$cf_cv_unsigned_literals" = yes && cf_cv_1UL="${cf_cv_1UL}U" +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:4667: 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 + + if test "$cross_compiling" = yes; then + cf_cv_shift_limit=32 +else + cat > conftest.$ac_ext <<EOF +#line 4676 "configure" +#include "confdefs.h" + +#include <stdio.h> +int main() +{ + FILE *fp = fopen("cf_test.out", "w"); + if (fp != 0) { + int n; + unsigned TYPEOF_CHTYPE x = 1L; + for (n = 0; ; n++) { + unsigned long y = (x >> n); + if (y != 1 || x == 0) + break; + x <<= 1; + } + fprintf(fp, "%d", n); + fclose(fp); + } + exit(0); +} + +EOF +if { (eval echo configure:4699: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + cf_cv_shift_limit=32 +fi +rm -fr conftest* +fi + + rm -f cf_test.out + +fi + +echo "$ac_t""$cf_cv_shift_limit" 1>&6 + + +echo $ac_n "checking for width of character-index""... $ac_c" 1>&6 +echo "configure:4719: 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 + +if test ".$with_widec" = ".yes" ; then + cf_attrs_width=39 + if ( expr $cf_cv_shift_limit \> $cf_attrs_width >/dev/null ) + then + cf_cv_widec_shift=`expr 16 + $cf_cv_shift_limit - $cf_attrs_width` + else + cf_cv_widec_shift=16 + fi +else + cf_cv_widec_shift=8 +fi + +fi + +echo "$ac_t""$cf_cv_widec_shift" 1>&6 + + + +### Checks for external-data + + +echo $ac_n "checking if external errno is declared""... $ac_c" 1>&6 +echo "configure:4746: 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 4752 "configure" +#include "confdefs.h" + +#if HAVE_STDLIB_H +#include <stdlib.h> +#endif +#include <stdio.h> +#include <sys/types.h> +#include <errno.h> +int main() { +long x = (long) errno +; return 0; } +EOF +if { (eval echo configure:4765: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + eval 'cf_cv_dcl_'errno'=yes' +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval 'cf_cv_dcl_'errno'=no' +fi +rm -f conftest* + +fi + + +eval 'cf_result=$cf_cv_dcl_'errno +echo "$ac_t""$cf_result" 1>&6 + +if test "$cf_result" = no ; then + eval 'cf_result=DECL_'errno + +cf_result=`echo $cf_result | tr '[a-z]' '[A-Z]'` + + cat >> confdefs.h <<EOF +#define $cf_result 1 +EOF + +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:4796: 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 4802 "configure" +#include "confdefs.h" + +#undef errno +extern int errno; + +int main() { +errno = 2 +; return 0; } +EOF +if { (eval echo configure:4812: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval 'cf_cv_have_'errno'=no' +fi +rm -f conftest* +fi + + +eval 'cf_result=$cf_cv_have_'errno +echo "$ac_t""$cf_result" 1>&6 + +if test "$cf_result" = yes ; then + eval 'cf_result=HAVE_'errno + +cf_result=`echo $cf_result | tr '[a-z]' '[A-Z]'` + + cat >> confdefs.h <<EOF +#define $cf_result 1 +EOF + +fi + + + + + +echo $ac_n "checking if data-only library module links""... $ac_c" 1>&6 +echo "configure:4844: 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 4851 "configure" +int testdata[3] = { 123, 456, 789 }; +EOF + if { (eval echo configure:4854: \"$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 4860 "configure" +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; +#endif +} +EOF + if { (eval echo configure:4873: \"$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 + rm -f conftest.$ac_ext func.o + ( eval $ac_cv_prog_RANLIB conftest.a ) 2>&5 >/dev/null + cf_saveLIBS="$LIBS" + LIBS="conftest.a $LIBS" + if test "$cross_compiling" = yes; then + cf_cv_link_dataonly=unknown +else + cat > conftest.$ac_ext <<EOF +#line 4885 "configure" +#include "confdefs.h" + + int main() + { + extern int testfunc(); + exit (!testfunc()); + } + +EOF +if { (eval echo configure:4895: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + cf_cv_link_dataonly=no +fi +rm -fr conftest* +fi + + LIBS="$cf_saveLIBS" + +fi + +echo "$ac_t""$cf_cv_link_dataonly" 1>&6 +test $cf_cv_link_dataonly = no && cat >> confdefs.h <<\EOF +#define BROKEN_LINKER 1 +EOF + + + +echo $ac_n "checking for speed_t""... $ac_c" 1>&6 +echo "configure:4919: checking for speed_t" >&5 +OSPEED_INCLUDES= +cat > conftest.$ac_ext <<EOF +#line 4922 "configure" +#include "confdefs.h" +#include <sys/types.h> +int main() { +speed_t some_variable = 0 +; return 0; } +EOF +if { (eval echo configure:4929: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + OSPEED_TYPE=speed_t +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + OSPEED_TYPE=unsigned +fi +rm -f conftest* +cat > conftest.$ac_ext <<EOF +#line 4940 "configure" +#include "confdefs.h" +#include <termios.h> +int main() { +speed_t some_variable = 0 +; return 0; } +EOF +if { (eval echo configure:4947: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + OSPEED_TYPE=speed_t + OSPEED_INCLUDES="#include <termios.h>" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + + +if test "$OSPEED_TYPE" = "unsigned" ; then + echo "$ac_t""no" 1>&6 + cat >> confdefs.h <<\EOF +#define speed_t unsigned +EOF + +else + echo "$ac_t""yes" 1>&6 +fi + + +### Checks for library functions. +for ac_func in getcwd \ +getttynam \ +memccpy \ +nanosleep \ +poll \ +remove \ +select \ +setbuf \ +setbuffer \ +setvbuf \ +sigaction \ +sigvec \ +strdup \ +strstr \ +tcgetattr \ +tcgetpgrp \ +times \ +usleep \ +vfscanf \ +vsnprintf \ +vsscanf \ + +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:4994: 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 4999 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:5022: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +if test "$with_getcap" = "yes" ; then + +echo $ac_n "checking for terminal-capability database functions""... $ac_c" 1>&6 +echo "configure:5050: 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 5056 "configure" +#include "confdefs.h" + +#include <stdlib.h> +int main() { + + char temp[128]; + char *buf = temp; + char *db_array = temp; + cgetent(&buf, /* int *, */ &db_array, "vt100"); + cgetcap(buf, "tc", '='); + cgetmatch(buf, "tc"); + +; return 0; } +EOF +if { (eval echo configure:5071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + cf_cv_cgetent=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_cgetent=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$cf_cv_cgetent" 1>&6 +test $cf_cv_cgetent = yes && cat >> confdefs.h <<\EOF +#define HAVE_BSD_CGETENT 1 +EOF + + +fi + + +echo $ac_n "checking for isascii""... $ac_c" 1>&6 +echo "configure:5094: 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 5100 "configure" +#include "confdefs.h" +#include <ctype.h> +int main() { +int x = isascii(' ') +; return 0; } +EOF +if { (eval echo configure:5107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + cf_cv_have_isascii=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_have_isascii=no +fi +rm -f conftest* + +fi +echo "$ac_t""$cf_cv_have_isascii" 1>&6 +test $cf_cv_have_isascii = yes && cat >> confdefs.h <<\EOF +#define HAVE_ISASCII 1 +EOF + + + +if test $ac_cv_func_sigaction = yes; then +echo $ac_n "checking whether sigaction needs _POSIX_SOURCE""... $ac_c" 1>&6 +echo "configure:5128: checking whether sigaction needs _POSIX_SOURCE" >&5 +cat > conftest.$ac_ext <<EOF +#line 5130 "configure" +#include "confdefs.h" + +#include <sys/types.h> +#include <signal.h> +int main() { +struct sigaction act +; return 0; } +EOF +if { (eval echo configure:5139: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + sigact_bad=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + +cat > conftest.$ac_ext <<EOF +#line 5148 "configure" +#include "confdefs.h" + +#define _POSIX_SOURCE +#include <sys/types.h> +#include <signal.h> +int main() { +struct sigaction act +; return 0; } +EOF +if { (eval echo configure:5158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + sigact_bad=yes + cat >> confdefs.h <<\EOF +#define SVR4_ACTION 1 +EOF + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + sigact_bad=unknown +fi +rm -f conftest* +fi +rm -f conftest* +echo "$ac_t""$sigact_bad" 1>&6 +fi + + +if test $ac_cv_header_termios_h = yes ; then + case "$CFLAGS" 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:5186: checking whether termios.h needs _POSIX_SOURCE" >&5 + cat > conftest.$ac_ext <<EOF +#line 5188 "configure" +#include "confdefs.h" +#include <termios.h> +int main() { +struct termios foo; int x = foo.c_iflag +; return 0; } +EOF +if { (eval echo configure:5195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + termios_bad=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + cat > conftest.$ac_ext <<EOF +#line 5204 "configure" +#include "confdefs.h" + +#define _POSIX_SOURCE +#include <termios.h> +int main() { +struct termios foo; int x = foo.c_iflag +; return 0; } +EOF +if { (eval echo configure:5213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + termios_bad=unknown +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + termios_bad=yes cat >> confdefs.h <<\EOF +#define SVR4_TERMIO 1 +EOF + +fi +rm -f conftest* + +fi +rm -f conftest* + echo "$ac_t""$termios_bad" 1>&6 + fi +fi + + +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:5238: 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 + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 5246 "configure" +#include "confdefs.h" +#include <stdio.h> +/* If setvbuf has the reversed format, exit 0. */ +main () { + /* This call has the arguments reversed. + A reversed system may check and see that the address of main + is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */ + if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0) + exit(1); + putc('\r', stdout); + exit(0); /* Non-reversed systems segv here. */ +} +EOF +if { (eval echo configure:5260: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_setvbuf_reversed=no +fi +rm -fr conftest* +fi + +rm -f core core.* *.core +fi + +echo "$ac_t""$ac_cv_func_setvbuf_reversed" 1>&6 +if test $ac_cv_func_setvbuf_reversed = yes; then + cat >> confdefs.h <<\EOF +#define SETVBUF_REVERSED 1 +EOF + +fi + +fi +echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +echo "configure:5285: 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 5290 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <signal.h> +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int main() { +int i; +; return 0; } +EOF +if { (eval echo configure:5307: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_signal=void +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_signal=int +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <<EOF +#define RETSIGTYPE $ac_cv_type_signal +EOF + + + +echo $ac_n "checking for type sigaction_t""... $ac_c" 1>&6 +echo "configure:5327: 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 5333 "configure" +#include "confdefs.h" + +#include <signal.h> +int main() { +sigaction_t x +; return 0; } +EOF +if { (eval echo configure:5341: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_type_sigaction=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_type_sigaction=no +fi +rm -f conftest* +fi + +echo "$ac_t""$cf_cv_type_sigaction" 1>&6 +test $cf_cv_type_sigaction = yes && cat >> confdefs.h <<\EOF +#define HAVE_TYPE_SIGACTION 1 +EOF + + + +echo $ac_n "checking declaration of size-change""... $ac_c" 1>&6 +echo "configure:5361: 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" + +for cf_opts in "" "NEED_PTEM_H" +do + + CFLAGS="$cf_save_CFLAGS" + test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts" + cat > conftest.$ac_ext <<EOF +#line 5375 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if HAVE_TERMIOS_H +#include <termios.h> +#else +#if HAVE_TERMIO_H +#include <termio.h> +#endif +#endif +#if NEED_PTEM_H +/* This is a workaround for SCO: they neglected to define struct winsize in + * termios.h -- it's only in termio.h and ptem.h + */ +#include <sys/stream.h> +#include <sys/ptem.h> +#endif +#if !defined(sun) || !defined(HAVE_TERMIOS_H) +#include <sys/ioctl.h> +#endif + +int main() { + +#ifdef TIOCGSIZE + struct ttysize win; /* FIXME: what system is this? */ + int y = win.ts_lines; + int x = win.ts_cols; +#else +#ifdef TIOCGWINSZ + struct winsize win; + int y = win.ws_row; + int x = win.ws_col; +#else + no TIOCGSIZE or TIOCGWINSZ +#endif /* TIOCGWINSZ */ +#endif /* TIOCGSIZE */ + +; return 0; } +EOF +if { (eval echo configure:5414: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_sizechange=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_sizechange=no +fi +rm -f conftest* + + CFLAGS="$cf_save_CFLAGS" + if test "$cf_cv_sizechange" = yes ; then + echo "size-change succeeded ($cf_opts)" >&5 + test -n "$cf_opts" && cat >> confdefs.h <<EOF +#define $cf_opts 1 +EOF + + break + fi +done + +fi + +echo "$ac_t""$cf_cv_sizechange" 1>&6 +test $cf_cv_sizechange != no && cat >> confdefs.h <<\EOF +#define HAVE_SIZECHANGE 1 +EOF + + + +echo $ac_n "checking for memmove""... $ac_c" 1>&6 +echo "configure:5446: 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 5451 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char memmove(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char memmove(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_memmove) || defined (__stub___memmove) +choke me +#else +memmove(); +#endif + +; return 0; } +EOF +if { (eval echo configure:5474: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_memmove=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'memmove`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 + +echo $ac_n "checking for bcopy""... $ac_c" 1>&6 +echo "configure:5493: 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 5498 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char bcopy(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char bcopy(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_bcopy) || defined (__stub___bcopy) +choke me +#else +bcopy(); +#endif + +; return 0; } +EOF +if { (eval echo configure:5521: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_bcopy=no" +fi +rm -f conftest* +fi + +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:5537: 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 + + if test "$cross_compiling" = yes; then + cf_cv_good_bcopy=unknown +else + cat > conftest.$ac_ext <<EOF +#line 5546 "configure" +#include "confdefs.h" + +int main() { + static char data[] = "abcdefghijklmnopqrstuwwxyz"; + char temp[40]; + bcopy(data, temp, sizeof(data)); + bcopy(temp+10, temp, 15); + bcopy(temp+5, temp+15, 10); + exit (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz")); +} + +EOF +if { (eval echo configure:5559: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + cf_cv_good_bcopy=no +fi +rm -fr conftest* +fi + + +fi + +echo "$ac_t""$cf_cv_good_bcopy" 1>&6 + +else + echo "$ac_t""no" 1>&6 +cf_cv_good_bcopy=no +fi + + if test $cf_cv_good_bcopy = yes ; then + cat >> confdefs.h <<\EOF +#define USE_OK_BCOPY 1 +EOF + + else + cat >> confdefs.h <<\EOF +#define USE_MY_MEMMOVE 1 +EOF + + fi + +fi + + +if test -z "$cf_user_CFLAGS" ; then + CFLAGS=`echo ${CFLAGS} | sed -e 's/-g //' -e 's/-g$//'` + CXXFLAGS=`echo ${CXXFLAGS} | sed -e 's/-g //' -e 's/-g$//'` +fi + + +echo $ac_n "checking for builtin $CC bool type""... $ac_c" 1>&6 +echo "configure:5603: checking for builtin $CC 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 5609 "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <sys/types.h> + +int main() { +bool x = false +; return 0; } +EOF +if { (eval echo configure:5619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_cc_bool_type=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_cc_bool_type=0 +fi +rm -f conftest* + +fi + +if test $cf_cv_cc_bool_type = 1 +then echo "$ac_t""yes" 1>&6 +else echo "$ac_t""no" 1>&6 +fi + +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 + + case "`${CXX-g++} --version`" in + 2.7*) + +cf_cxx_library=unknown +if test $ac_cv_prog_gxx = yes; then + echo $ac_n "checking for libg++""... $ac_c" 1>&6 +echo "configure:5651: checking for libg++" >&5 + cf_save="$LIBS" + LIBS="$LIBS -lg++ -lm" + cat > conftest.$ac_ext <<EOF +#line 5655 "configure" +#include "confdefs.h" + +#include <builtin.h> + +int main() { +float foo=abs(1.0) +; return 0; } +EOF +if { (eval echo configure:5664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + cf_cxx_library=yes + CXXLIBS="$CXXLIBS -lg++ -lm" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cxx_library=no +fi +rm -f conftest* + LIBS="$cf_save" + echo "$ac_t""$cf_cxx_library" 1>&6 +fi + + ;; + *) + cf_cxx_library=yes + ;; + esac + echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 +echo "configure:5685: 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 +else + 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 + CXXCPP="${CXX-g++} -E" + cat > conftest.$ac_ext <<EOF +#line 5698 "configure" +#include "confdefs.h" +#include <stdlib.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:5703: \"$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 + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CXXCPP=/lib/cpp +fi +rm -f conftest* + ac_cv_prog_CXXCPP="$CXXCPP" +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 +fi +CXXCPP="$ac_cv_prog_CXXCPP" +echo "$ac_t""$CXXCPP" 1>&6 + +for ac_hdr in builtin.h typeinfo +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:5731: 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 5736 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:5741: \"$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 for builtin $CXX bool type""... $ac_c" 1>&6 +echo "configure:5769: checking for builtin $CXX 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 5775 "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <sys/types.h> + +int main() { +bool x = false +; return 0; } +EOF +if { (eval echo configure:5785: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_builtin_bool=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_builtin_bool=0 +fi +rm -f conftest* + +fi + +if test $cf_cv_builtin_bool = 1 +then echo "$ac_t""yes" 1>&6 +else echo "$ac_t""no" 1>&6 +fi + + +echo $ac_n "checking for size of $CXX bool""... $ac_c" 1>&6 +echo "configure:5805: checking for size of $CXX bool" >&5 +if eval "test \"`echo '$''{'cf_cv_type_of_bool'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + rm -f cf_test.out + if test "$cross_compiling" = yes; then + cf_cv_type_of_bool=unknown +else + cat > conftest.$ac_ext <<EOF +#line 5815 "configure" +#include "confdefs.h" +#ifdef __cplusplus +extern "C" void exit(int); +#endif + +#include <stdlib.h> +#include <stdio.h> +#if HAVE_BUILTIN_H +#include <builtin.h> +#endif +main() +{ + FILE *fp = fopen("cf_test.out", "w"); + if (fp != 0) { + bool x = true; + if ((bool)(-x) >= 0) + fputs("unsigned ", fp); + if (sizeof(x) == sizeof(int)) fputs("int", fp); + else if (sizeof(x) == sizeof(char)) fputs("char", fp); + else if (sizeof(x) == sizeof(short))fputs("short",fp); + else if (sizeof(x) == sizeof(long)) fputs("long", fp); + fclose(fp); + } + exit(0); +} + +EOF +if { (eval echo configure:5843: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + cf_cv_type_of_bool=unknown +fi +rm -fr conftest* +fi + + +fi + + rm -f cf_test.out +echo "$ac_t""$cf_cv_type_of_bool" 1>&6 +if test "$cf_cv_type_of_bool" = unknown ; then + echo "configure: warning: Assuming unsigned for type of bool" 1>&2 + cf_cv_type_of_bool=unsigned +fi + + +echo $ac_n "checking for special defines needed for etip.h""... $ac_c" 1>&6 +echo "configure:5867: checking for special defines needed for etip.h" >&5 +cf_save_CXXFLAGS="$CXXFLAGS" +cf_result="none" +for cf_math in "" MATH_H +do +for cf_excp in "" MATH_EXCEPTION +do + CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu" + 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 5878 "configure" +#include "confdefs.h" + +#include <etip.h.in> + +int main() { + +; return 0; } +EOF +if { (eval echo configure:5887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + test -n "$cf_math" && cat >> confdefs.h <<\EOF +#define ETIP_NEEDS_${cf_math} 1 +EOF + + test -n "$cf_excp" && cat >> confdefs.h <<\EOF +#define ETIP_NEEDS_${cf_excp} 1 +EOF + + cf_result="$cf_math $cf_excp" + break + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done +done +echo "$ac_t""$cf_result" 1>&6 +CXXFLAGS="$cf_save_CXXFLAGS" + +else + cf_cxx_library=no + cf_cv_builtin_bool=0 + + # Just because we are not configuring against C++ right now does not + # mean that a user will not want to use C++. Some distributors disable + # the C++ portion of this configuration as a shortcut (or just to avoid + # compiling the demo in the c++ directory). So we need a reasonable + # default for the 'bool' type. + # + # Caveat: since the storage of the bool type is not standardized, it + # may change. + + echo $ac_n "checking for fallback type of bool""... $ac_c" 1>&6 +echo "configure:5925: 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 ;; + esac + echo "$ac_t""$cf_cv_type_of_bool" 1>&6 +fi + + + + +if test "$cf_with_ada" != "no" ; then +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:5941: 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 + if test -n "$gnat_exists"; then + ac_cv_prog_gnat_exists="$gnat_exists" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_gnat_exists="yes" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_gnat_exists" && ac_cv_prog_gnat_exists="no" +fi +fi +gnat_exists="$ac_cv_prog_gnat_exists" +if test -n "$gnat_exists"; then + echo "$ac_t""$gnat_exists" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test "$ac_cv_prog_gnat_exists" = no; then + cf_ada_make= +else + +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-9]*|[4-9].*) + cf_cv_prog_gnat_correct=yes + ;; + *) echo Unsupported GNAT version $cf_cv_gnat_version. Required is 3.10 or better. Disabling Ada95 binding. + cf_cv_prog_gnat_correct=no + ;; +esac +case $cf_cv_gnat_version in + 3.1*|[4-9].*) + cf_compile_generics=generics + cf_generic_objects="\$(GENOBJS)" + ;; + *) cf_compile_generics= + cf_generic_objects= + ;; +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:5995: 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 + if test -n "$m4_exists"; then + ac_cv_prog_m4_exists="$m4_exists" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_m4_exists="yes" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_m4_exists" && ac_cv_prog_m4_exists="no" +fi +fi +m4_exists="$ac_cv_prog_m4_exists" +if test -n "$m4_exists"; then + echo "$ac_t""$m4_exists" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$ac_cv_prog_m4_exists" = no; then + cf_cv_prog_gnat_correct=no + echo Ada95 binding required program m4 not found. Ada95 binding disabled. + fi + if test "$cf_cv_prog_gnat_correct" = yes; then + echo $ac_n "checking if GNAT works""... $ac_c" 1>&6 +echo "configure:6028: checking if GNAT works" >&5 + +rm -f conftest* +cat >>conftest.ads <<CF_EOF +procedure conftest; +CF_EOF +cat >>conftest.adb <<CF_EOF +with Text_IO; +with GNAT.OS_Lib; +procedure conftest is +begin + Text_IO.Put ("Hello World"); + Text_IO.New_Line; + GNAT.OS_Lib.OS_Exit (0); +end conftest; +CF_EOF +if ( $cf_ada_make conftest 1>&5 2>&1 ) ; then + if ( ./conftest 1>&5 2>&1 ) ; then + cf_cv_prog_gnat_correct=yes + else + cf_cv_prog_gnat_correct=no + fi +else + cf_cv_prog_gnat_correct=no +fi +rm -f conftest* + + echo "$ac_t""$cf_cv_prog_gnat_correct" 1>&6 + fi +fi +if test "$cf_cv_prog_gnat_correct" = yes; then + ADAFLAGS="-O3 -gnatpn $ADAFLAGS" + + +# Check whether --with-ada-compiler or --without-ada-compiler was given. +if test "${with_ada_compiler+set}" = set; then + withval="$with_ada_compiler" + cf_ada_compiler=$withval +else + cf_ada_compiler=gnatmake +fi + + + cf_ada_package=terminal_interface + + + + + + + + + +# Check whether --with-ada-include or --without-ada-include was given. +if test "${with_ada_include+set}" = set; then + withval="$with_ada_include" + : +else + withval="${ADA_INCLUDE-$prefix/lib/gnu-Ada/adainclude}" +fi + +case ".$withval" in #(vi +./*) #(vi + ;; +.\${*prefix}*) #(vi + eval withval="$withval" + case ".$withval" in #(vi + .NONE/*) + withval=`echo $withval | sed -e s@NONE@$ac_default_prefix@` + ;; + esac + ;; #(vi +.NONE/*) + withval=`echo $withval | sed -e s@NONE@$ac_default_prefix@` + ;; +*) + { echo "configure: error: expected a pathname" 1>&2; exit 1; } + ;; +esac + +eval ADA_INCLUDE="$withval" + + + + +# Check whether --with-ada-objects or --without-ada-objects was given. +if test "${with_ada_objects+set}" = set; then + withval="$with_ada_objects" + : +else + withval="${ADA_OBJECTS-$prefix/lib/gnu-Ada/adalib}" +fi + +case ".$withval" in #(vi +./*) #(vi + ;; +.\${*prefix}*) #(vi + eval withval="$withval" + case ".$withval" in #(vi + .NONE/*) + withval=`echo $withval | sed -e s@NONE@$ac_default_prefix@` + ;; + esac + ;; #(vi +.NONE/*) + withval=`echo $withval | sed -e s@NONE@$ac_default_prefix@` + ;; +*) + { echo "configure: error: expected a pathname" 1>&2; exit 1; } + ;; +esac + +eval ADA_OBJECTS="$withval" + + + + if test $with_shared = no + then + echo "configure: warning: Ada95 applications will not link properly with static libraries" 1>&2 + fi +fi +fi + +### It's not possible to appease gcc 2.6.3's conversion-warnings if we're +### using a 'char' for bools. gcc 2.7.0's conversion-warnings are broken too +### badly to consider using for development purposes, but 2.5.8 is okay. +if test -n "$with_warnings"; then + if test -n "$GCC"; then + case "`$CC --version`" in + 2.6.3) + if test "$cf_cv_type_of_bool" != "char"; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wconversion" + fi + ;; + 2.5*) + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wconversion" + ;; + esac + fi +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:6172: checking for library subsets" >&5 +if test "$with_termlib" = yes ; then + LIB_SUBSETS="termlib " +else + LIB_SUBSETS="termlib+" +fi +LIB_SUBSETS="${LIB_SUBSETS}base" +test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs" +echo "$ac_t""$LIB_SUBSETS" 1>&6 + +### Construct the list of include-directories to be generated + +CPPFLAGS="$CPPFLAGS -I. -I../include" +if test "$srcdir" != "."; then + CPPFLAGS="$CPPFLAGS -I\$(srcdir)/../include" +fi +if test -z "$GCC"; then + CPPFLAGS="$CPPFLAGS -I\$(includedir)" +elif test "$includedir" != "/usr/include"; then + if test "$includedir" = '${prefix}/include' ; then + if test $prefix != /usr ; then + CPPFLAGS="$CPPFLAGS -I\$(includedir)" + fi + else + CPPFLAGS="$CPPFLAGS -I\$(includedir)" + fi +fi + + + +ACPPFLAGS="$ACPPFLAGS -I. -I../../include" +if test "$srcdir" != "."; then + ACPPFLAGS="$ACPPFLAGS -I\$(srcdir)/../../include" +fi +if test -z "$GCC"; then + ACPPFLAGS="$ACPPFLAGS -I\$(includedir)" +elif test "$includedir" != "/usr/include"; then + if test "$includedir" = '${prefix}/include' ; then + if test $prefix != /usr ; then + ACPPFLAGS="$ACPPFLAGS -I\$(includedir)" + fi + else + ACPPFLAGS="$ACPPFLAGS -I\$(includedir)" + fi +fi + + + +### Set up low-level terminfo dependencies for makefiles. Note that we +### could override this. +if test "$with_termlib" = yes ; then + TEST_DEPS="${LIB_PREFIX}${TINFO_NAME}${DFT_DEP_SUFFIX}" + TEST_ARGS="-l${TINFO_NAME}${DFT_ARG_SUFFIX}" +fi +PROG_DEPS="$TEST_DEPS" +PROG_ARGS="$TEST_ARGS" + +### Construct the list of subdirectories for which we'll customize makefiles +### with the appropriate compile-rules. + + +echo $ac_n "checking for src modules""... $ac_c" 1>&6 +echo "configure:6234: checking for src modules" >&5 + +# dependencies and linker-arguments for test-programs +TEST_DEPS="${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS" +TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" + +# dependencies and linker-arguments for utility-programs +PROG_ARGS="$TEST_ARGS" + +cf_cv_src_modules= +for cf_dir in $modules_to_build +do + if test -f $srcdir/$cf_dir/modules; then + + # We may/may not have tack in the distribution, though the + # makefile is. + if test $cf_dir = tack ; then + if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then + continue + fi + fi + + if test -z "$cf_cv_src_modules"; then + cf_cv_src_modules=$cf_dir + else + cf_cv_src_modules="$cf_cv_src_modules $cf_dir" + fi + + # Make the ncurses_cfg.h file record the library interface files as + # well. These are header files that are the same name as their + # directory. Ncurses is the only library that does not follow + # that pattern. + if test $cf_dir = tack ; then + continue + elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then + +cf_have_include=`echo $cf_dir | tr '[a-z]' '[A-Z]'` + + cat >> confdefs.h <<EOF +#define HAVE_${cf_have_include}_H 1 +EOF + + cat >> confdefs.h <<EOF +#define HAVE_LIB${cf_have_include} 1 +EOF + + TEST_DEPS="${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" + TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" + fi + fi +done +echo "$ac_t""$cf_cv_src_modules" 1>&6 +TEST_ARGS="-L${LIB_DIR} -L\$(libdir) $TEST_ARGS" + + + +PROG_ARGS="-L${LIB_DIR} -L\$(libdir) $PROG_ARGS" + + +SRC_SUBDIRS="man include" +for cf_dir in $cf_cv_src_modules +do + SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir" +done +SRC_SUBDIRS="$SRC_SUBDIRS misc test" +test $cf_cxx_library != no && SRC_SUBDIRS="$SRC_SUBDIRS c++" + +ADA_SUBDIRS= +if test "$cf_cv_prog_gnat_correct" = yes && test -d $srcdir/Ada95; then + SRC_SUBDIRS="$SRC_SUBDIRS Ada95" + ADA_SUBDIRS="gen src samples" +fi + +SUB_MAKEFILES= +for cf_dir in $SRC_SUBDIRS +do + SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile" +done + +if test -n "$ADA_SUBDIRS"; then + for cf_dir in $ADA_SUBDIRS + do + SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile" + done + +fi + + +DIRS_TO_MAKE="lib" +for cf_item in $cf_list_models +do + + case $cf_item in + normal) cf_subdir='objects' ;; + debug) cf_subdir='obj_g' ;; + profile) cf_subdir='obj_p' ;; + shared) cf_subdir='obj_s' ;; + esac + + DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir" +done +for cf_dir in $DIRS_TO_MAKE +do + test ! -d $cf_dir && mkdir $cf_dir +done + + + +### Now that we're done running tests, add the compiler-warnings, if any +CFLAGS="$CFLAGS $EXTRA_CFLAGS" + +################################################################################ +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + 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" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "\ + include/MKterm.h.awk \ + include/curses.h \ + include/termcap.h \ + include/unctrl.h \ + $SUB_MAKEFILES \ + Makefile include/ncurses_cfg.h:include/ncurses_cfg.hin" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@NCURSES_MAJOR@%$NCURSES_MAJOR%g +s%@NCURSES_MINOR@%$NCURSES_MINOR%g +s%@NCURSES_PATCH@%$NCURSES_PATCH%g +s%@cf_cv_rel_version@%$cf_cv_rel_version%g +s%@cf_cv_abi_version@%$cf_cv_abi_version%g +s%@cf_cv_cc_bool_type@%$cf_cv_cc_bool_type%g +s%@cf_cv_builtin_bool@%$cf_cv_builtin_bool%g +s%@cf_cv_type_of_bool@%$cf_cv_type_of_bool%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@CC@%$CC%g +s%@BUILD_CC@%$BUILD_CC%g +s%@CPP@%$CPP%g +s%@PROG_EXT@%$PROG_EXT%g +s%@LDCONFIG@%$LDCONFIG%g +s%@CXX@%$CXX%g +s%@AWK@%$AWK%g +s%@SET_MAKE@%$SET_MAKE%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@LN_S@%$LN_S%g +s%@RANLIB@%$RANLIB%g +s%@LINT@%$LINT%g +s%@MAN@%$MAN%g +s%@LINT_OPTS@%$LINT_OPTS%g +s%@LD@%$LD%g +s%@AR@%$AR%g +s%@AR_OPTS@%$AR_OPTS%g +s%@cf_cv_makeflags@%$cf_cv_makeflags%g +s%@INSTALL_PREFIX@%$INSTALL_PREFIX%g +s%@EXTRA_LIBS@%$EXTRA_LIBS%g +s%@TINFO_LIST@%$TINFO_LIST%g +s%@SHLIB_LIST@%$SHLIB_LIST%g +s%@DFT_OBJ_SUBDIR@%$DFT_OBJ_SUBDIR%g +s%@DFT_LWR_MODEL@%$DFT_LWR_MODEL%g +s%@DFT_UPR_MODEL@%$DFT_UPR_MODEL%g +s%@DFT_DEP_SUFFIX@%$DFT_DEP_SUFFIX%g +s%@DFT_ARG_SUFFIX@%$DFT_ARG_SUFFIX%g +s%@cf_list_models@%$cf_list_models%g +s%@TINFO_NAME@%$TINFO_NAME%g +s%@LIB_NAME@%$LIB_NAME%g +s%@LIB_PREFIX@%$LIB_PREFIX%g +s%@CC_G_OPT@%$CC_G_OPT%g +s%@CXX_G_OPT@%$CXX_G_OPT%g +s%@LD_MODEL@%$LD_MODEL%g +s%@CC_SHARED_OPTS@%$CC_SHARED_OPTS%g +s%@LD_SHARED_OPTS@%$LD_SHARED_OPTS%g +s%@MK_SHARED_LIB@%$MK_SHARED_LIB%g +s%@LINK_PROGS@%$LINK_PROGS%g +s%@LINK_TESTS@%$LINK_TESTS%g +s%@EXTRA_LDFLAGS@%$EXTRA_LDFLAGS%g +s%@LOCAL_LDFLAGS@%$LOCAL_LDFLAGS%g +s%@LOCAL_LDFLAGS2@%$LOCAL_LDFLAGS2%g +s%@INSTALL_LIB@%$INSTALL_LIB%g +s%@FALLBACK_LIST@%$FALLBACK_LIST%g +s%@TERMINFO_DIRS@%$TERMINFO_DIRS%g +s%@NCURSES_CONST@%$NCURSES_CONST%g +s%@NCURSES_XNAMES@%$NCURSES_XNAMES%g +s%@ECHO_LINK@%$ECHO_LINK%g +s%@EXTRA_CFLAGS@%$EXTRA_CFLAGS%g +s%@MATH_LIB@%$MATH_LIB%g +s%@cf_cv_typeof_chtype@%$cf_cv_typeof_chtype%g +s%@cf_cv_1UL@%$cf_cv_1UL%g +s%@cf_cv_shift_limit@%$cf_cv_shift_limit%g +s%@cf_cv_widec_shift@%$cf_cv_widec_shift%g +s%@OSPEED_TYPE@%$OSPEED_TYPE%g +s%@OSPEED_INCLUDES@%$OSPEED_INCLUDES%g +s%@CXXCPP@%$CXXCPP%g +s%@CXXLIBS@%$CXXLIBS%g +s%@gnat_exists@%$gnat_exists%g +s%@m4_exists@%$m4_exists%g +s%@cf_ada_make@%$cf_ada_make%g +s%@cf_ada_compiler@%$cf_ada_compiler%g +s%@cf_ada_package@%$cf_ada_package%g +s%@ADAFLAGS@%$ADAFLAGS%g +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%@ACPPFLAGS@%$ACPPFLAGS%g +s%@TEST_DEPS@%$TEST_DEPS%g +s%@TEST_ARGS@%$TEST_ARGS%g +s%@PROG_ARGS@%$PROG_ARGS%g +s%@ADA_SUBDIRS@%$ADA_SUBDIRS%g +s%@DIRS_TO_MAKE@%$DIRS_TO_MAKE%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"\ + include/MKterm.h.awk \ + include/curses.h \ + include/termcap.h \ + include/unctrl.h \ + $SUB_MAKEFILES \ + Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <<EOF + CONFIG_HEADERS="include/ncurses_cfg.h:include/ncurses_cfg.hin" +EOF +cat >> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + + +# Transform confdefs.h into a list of #define's. We won't use it as a sed +# script, but as data to insert where we see @DEFS@. We expect AC_SAVE_DEFS to +# be either 'cat' or 'sort'. +sort confdefs.h >conftest.vals + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +echo ' rm -f conftest.frag' >> $CONFIG_STATUS +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write chunks of a limited-size here document to conftest.frag. + echo ' cat >> conftest.frag <<CEOF' >> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +# Run sed to substitute the contents of conftest.frag into conftest.in at the +# marker @DEFS@. +echo ' cat >> conftest.edit <<CEOF +/@DEFS@/r conftest.frag +/@DEFS@/d +CEOF +sed -f conftest.edit conftest.in > conftest.out +rm -f conftest.in +mv conftest.out conftest.in +rm -f conftest.edit conftest.frag +' >> $CONFIG_STATUS + + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <<EOF +# Extra initialization commands, if any + +### Special initialization commands, used to pass information from the +### configuration-run into config.status + +AWK="$AWK" +CF_LIST_MODELS="$cf_list_models" +DFT_LWR_MODEL="$DFT_LWR_MODEL" +LDCONFIG="$LDCONFIG" +LIB_NAME="$LIB_NAME" +LIB_SUBSETS="$LIB_SUBSETS" +SRC_SUBDIRS="$SRC_SUBDIRS" +TINFO_NAME="$TINFO_NAME" +WITH_ECHO="$with_echo" +WITH_OVERWRITE="$with_overwrite" +cf_cv_abi_version="$cf_cv_abi_version" +cf_cv_do_symlinks="$cf_cv_do_symlinks" +cf_cv_rel_version="$cf_cv_rel_version" +cf_cv_rm_so_locs="$cf_cv_rm_so_locs" +cf_cv_system_name="$cf_cv_system_name" +cf_cxx_library="$cf_cxx_library" +target="$target" + + +EOF +cat >> $CONFIG_STATUS <<\EOF +# Extra commands, if any + + + + case $cf_cv_system_name in + os2) cf_prefix='' ;; + *) cf_prefix='lib' ;; + esac + + +for cf_dir in $SRC_SUBDIRS +do + if test -f $srcdir/$cf_dir/modules; then + + cf_libs_to_make= + for cf_item in $CF_LIST_MODELS + do + + + case $cf_item in + normal) cf_suffix='.a' ;; + debug) cf_suffix='_g.a' ;; + profile) cf_suffix='_p.a' ;; + shared) + case $cf_cv_system_name in + openbsd*|netbsd*|freebsd*) + cf_suffix='.so.$(REL_VERSION)' ;; + hpux*) cf_suffix='.sl' ;; + *) cf_suffix='.so' ;; + esac + esac + + cf_libs_to_make="$cf_libs_to_make ../lib/${cf_prefix}${cf_dir}${cf_suffix}" + done + + if test $cf_dir = ncurses ; then + case "$LIB_SUBSETS" in + termlib+*) #(vi + ;; + *) #(vi + cf_item=`echo $cf_libs_to_make |sed -e s/$LIB_NAME/$TINFO_NAME/g` + cf_libs_to_make="$cf_item $cf_libs_to_make" + ;; + esac + fi + + sed -e "s@\@LIBS_TO_MAKE\@@$cf_libs_to_make@" \ + $cf_dir/Makefile >$cf_dir/Makefile.out + mv $cf_dir/Makefile.out $cf_dir/Makefile + + $AWK -f $srcdir/mk-0th.awk \ + name=$cf_dir \ + $srcdir/$cf_dir/modules >>$cf_dir/Makefile + + for cf_item in $CF_LIST_MODELS + do + echo 'Appending rules for '$cf_item' model ('$cf_dir')' + +CF_ITEM=`echo $cf_item | tr '[a-z]' '[A-Z]'` + + + + case $cf_item in + normal) cf_suffix='.a' ;; + debug) cf_suffix='_g.a' ;; + profile) cf_suffix='_p.a' ;; + shared) + case $cf_cv_system_name in + openbsd*|netbsd*|freebsd*) + cf_suffix='.so.$(REL_VERSION)' ;; + hpux*) cf_suffix='.sl' ;; + *) cf_suffix='.so' ;; + esac + esac + + + case $cf_item in + normal) cf_subdir='objects' ;; + debug) cf_subdir='obj_g' ;; + profile) cf_subdir='obj_p' ;; + shared) cf_subdir='obj_s' ;; + esac + + + # These dependencies really are for development, not + # builds, but they are useful in porting, too. + cf_depend="../include/ncurses_cfg.h" + if test "$srcdir" = "."; then + cf_reldir="." + else + cf_reldir="\$(srcdir)" + fi + + if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then + cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h" + elif test -f $srcdir/$cf_dir/curses.priv.h; then + cf_depend="$cf_depend $cf_reldir/curses.priv.h" + fi + + for cf_subset in $LIB_SUBSETS + do + $AWK -f $srcdir/mk-1st.awk \ + name=$cf_dir \ + MODEL=$CF_ITEM \ + model=$cf_subdir \ + prefix=$cf_prefix \ + suffix=$cf_suffix \ + subset=$cf_subset \ + DoLinks=$cf_cv_do_symlinks \ + rmSoLocs=$cf_cv_rm_so_locs \ + ldconfig="$LDCONFIG" \ + overwrite=$WITH_OVERWRITE \ + depend="$cf_depend" \ + target="$target" \ + $srcdir/$cf_dir/modules >>$cf_dir/Makefile + test $cf_dir = ncurses && WITH_OVERWRITE=no + $AWK -f $srcdir/mk-2nd.awk \ + name=$cf_dir \ + MODEL=$CF_ITEM \ + model=$cf_subdir \ + subset=$cf_subset \ + srcdir=$srcdir \ + echo=$WITH_ECHO \ + $srcdir/$cf_dir/modules >>$cf_dir/Makefile + done + done + fi + + echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) $@' >>Makefile +done + +for cf_dir in $SRC_SUBDIRS +do + if test -f $cf_dir/Makefile ; then + case "$cf_dir" in + Ada95) #(vi + echo 'install.libs \' >> Makefile + echo 'uninstall.libs ::' >> Makefile + echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) $@' >> Makefile + ;; + esac + fi + + if test -f $srcdir/$cf_dir/modules; then + echo >> Makefile + if test -f $srcdir/$cf_dir/headers; then +cat >> Makefile <<CF_EOF +install.includes \\ +uninstall.includes \\ +CF_EOF + fi +if test "$cf_dir" != "c++" ; then +echo 'lint \' >> Makefile +fi +cat >> Makefile <<CF_EOF +lintlib \\ +install.libs \\ +uninstall.libs \\ +install.$cf_dir \\ +uninstall.$cf_dir :: + cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \$@ +CF_EOF + elif test -f $srcdir/$cf_dir/headers; then +cat >> Makefile <<CF_EOF + +install.libs \\ +uninstall.libs \\ +install.includes \\ +uninstall.includes :: + cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \$@ +CF_EOF +fi +done + +cat >> Makefile <<CF_EOF + +install.data :: + cd misc && \$(MAKE) \$(CF_MFLAGS) \$@ + +install.man :: + cd man && \$(MAKE) \$(CF_MFLAGS) \$@ + +distclean :: + rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h + rm -f headers.sh headers.sed + rm -rf \$(DIRS_TO_MAKE) +CF_EOF + + +rm -f headers.sed headers.sh + +echo creating headers.sh +cat >headers.sh <<CF_EOF +#! /bin/sh +# This shell script is generated by the 'configure' script. It is invoked in a +# subdirectory of the build tree. It generates a sed-script in the parent +# directory that is used to adjust includes for header files that reside in a +# subdirectory of /usr/include, etc. +PRG="" +while test \$# != 3 +do +PRG="\$PRG \$1"; shift +done +DST=\$1 +REF=\$2 +SRC=\$3 +echo installing \$SRC in \$DST +case \$DST in +/*/include/*) + TMP=\${TMPDIR-/tmp}/\`basename \$SRC\` + if test ! -f ../headers.sed ; then + END=\`basename \$DST\` + for i in \`cat \$REF/../*/headers |fgrep -v "#"\` + do + NAME=\`basename \$i\` + echo "s/<\$NAME>/<\$END\/\$NAME>/" >> ../headers.sed + done + fi + rm -f \$TMP + sed -f ../headers.sed \$SRC > \$TMP + eval \$PRG \$TMP \$DST + rm -f \$TMP + ;; +*) + eval \$PRG \$SRC \$DST + ;; +esac +CF_EOF + +chmod 0755 headers.sh + +for cf_dir in $SRC_SUBDIRS +do + if test -f $srcdir/$cf_dir/headers; then + cat >>$cf_dir/Makefile <<CF_EOF +\$(INSTALL_PREFIX)\$(includedir) : + \$(srcdir)/../mkinstalldirs \$@ + +install \\ +install.libs \\ +install.includes :: \$(INSTALL_PREFIX)\$(includedir) \\ +CF_EOF + j="" + for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` + do + test -n "$j" && echo " $j \\" >>$cf_dir/Makefile + j=$i + done + echo " $j" >>$cf_dir/Makefile + for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` + do + echo " @ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(INSTALL_PREFIX)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile + test $i = curses.h && echo " @ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f ncurses.h && \$(LN_S) curses.h ncurses.h)" >>$cf_dir/Makefile + done + + cat >>$cf_dir/Makefile <<CF_EOF + +uninstall \\ +uninstall.libs \\ +uninstall.includes :: +CF_EOF + for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` + do + i=`basename $i` + echo " -@ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f $i)" >>$cf_dir/Makefile + test $i = curses.h && echo " -@ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f ncurses.h)" >>$cf_dir/Makefile + done + fi +done + + + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +${MAKE-make} preinstall diff --git a/contrib/ncurses/configure.in b/contrib/ncurses/configure.in new file mode 100644 index 000000000000..028bcf37fe09 --- /dev/null +++ b/contrib/ncurses/configure.in @@ -0,0 +1,968 @@ +dnl*************************************************************************** +dnl Copyright (c) 1998,1999 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 * +dnl "Software"), to deal in the Software without restriction, including * +dnl without limitation the rights to use, copy, modify, merge, publish, * +dnl distribute, distribute with modifications, sublicense, and/or sell * +dnl copies of the Software, and to permit persons to whom the Software is * +dnl furnished to do so, subject to the following conditions: * +dnl * +dnl The above copyright notice and this permission notice shall be included * +dnl in all copies or substantial portions of the Software. * +dnl * +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * +dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * +dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * +dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * +dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. * +dnl * +dnl Except as contained in this notice, the name(s) of the above copyright * +dnl holders shall not be used in advertising or otherwise to promote the * +dnl sale, use or other dealings in this Software without prior written * +dnl authorization. * +dnl*************************************************************************** +dnl +dnl Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 +dnl +dnl $Id: configure.in,v 1.169 1999/08/21 20:33:10 tom Exp $ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.12.971222) +AC_REVISION($Revision: 1.169 $) +AC_INIT(ncurses/base/lib_initscr.c) +AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin) + +CF_SUBST_NCURSES_VERSION +CF_CHECK_CACHE +AC_ARG_WITH(system-type, +[ --with-system-type=XXX test: override derived host system-type], +[AC_MSG_WARN(overriding system type to $withval) + cf_cv_system_name=$withval]) + +# We need a configure script only when compiling as part of GNU C library. +# Here we have to generate one of the files we need while compiling. +# +# The only problem is that users of the package might think they have to +# run configure themself and find it irritating when nothing happens. +# +# So we try here to find out whether we are called from the glibc configure +# or by a user. +# +dnl Check if we are a drop-in addition to glibc. +AC_ARG_ENABLE(add-ons, dnl +[ --enable-add-ons=DIR... used to check if we are a glibc add-on.], + [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[ ]*=.*$\" \ + $srcdir/Makefile | sed -e \ + 's/^[ ]*ncurses-version[ ]*=[ ]*\([^ ^ ]*\)[ ]*$/\1/'`" > $srcdir/Banner + exit 0 +fi +changequote([,])dnl + +### Save the given $CFLAGS to allow user-override. +cf_user_CFLAGS="$CFLAGS" + +### Default install-location +CF_CFG_DEFAULTS + +### Checks for programs. +AC_PROG_CC +if test -n "$GCC" ; then +AC_MSG_CHECKING(version of gcc) +eval "$CC --version" +fi +if test $host != $build; then + AC_CHECK_PROGS(BUILD_CC, $CC gcc cc) +fi +AC_PROG_CPP +AC_PROG_GCC_TRADITIONAL +AC_ISC_POSIX +CF_ANSI_CC_REQD +CF_PROG_EXT + +case "$cf_cv_system_name" in +freebsd*) #(vi + test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R" + ;; +*) LDPATH=$PATH:/sbin:/usr/sbin + AC_PATH_PROG(LDCONFIG,ldconfig,,$LDPATH) + ;; +esac +AC_SUBST(LDCONFIG) + +dnl DEFECT in autoconf 2.12: an attempt to set policy, this breaks the +dnl configure script by not letting us test if C++ +dnl is present, making this option necessary. +AC_MSG_CHECKING(if you want to build with C++) +AC_ARG_WITH(cxx, + [ --without-cxx suppress check for C++, don't build demo], + [cf_with_cxx=$withval], + [cf_with_cxx=yes]) +AC_MSG_RESULT($cf_with_cxx) +if test "X$cf_with_cxx" != Xno ; then +AC_PROG_CXX +fi +changequote(,)dnl +if test -n "$GXX" ; then case "`${CXX-g++} --version`" in 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 with Ada95) +AC_ARG_WITH(ada, + [ --without-ada suppress check for Ada95, don't build demo], + [cf_with_ada=$withval], + [cf_with_ada=yes]) +AC_MSG_RESULT($cf_with_ada) + +AC_MSG_CHECKING(if you want to build programs such as tic) +AC_ARG_WITH(progs, + [ --without-progs suppress build with programs (e.g., tic)], + [cf_with_progs=$withval], + [cf_with_progs=yes]) +AC_MSG_RESULT($cf_with_progs) + +modules_to_build="ncurses" +if test "X$cf_with_progs" != Xno ; then +modules_to_build="$modules_to_build progs tack" +fi +modules_to_build="$modules_to_build panel menu form" + +AC_PROG_AWK +AC_PROG_MAKE_SET +CF_PROG_INSTALL +AC_SYS_LONG_FILE_NAMES +AC_PROG_LN_S +AC_PROG_RANLIB +AC_CHECK_PROGS(LINT, tdlint lint alint) +AC_CHECK_PROGS(MAN, man man_db) +AC_SUBST(LINT_OPTS) + +dnl These are standard among *NIX systems, but not when cross-compiling +CF_SUBST(loader,LD,ld) +CF_SUBST(archiver,AR,ar) +CF_SUBST(archiver options,AR_OPTS,rv) + +CF_MAKEFLAGS + +dnl Special option for use by system-builders: the install-prefix is used to +dnl adjust the location into which the actual install is done, so that an +dnl archive can be built without modifying the host system's configuration. +AC_MSG_CHECKING(if you have specified an install-prefix) +AC_ARG_WITH(install-prefix, + [ --with-install-prefix prefixes actual install-location], + [case "$withval" in #(vi + yes|no) #(vi + ;; + *) INSTALL_PREFIX="$withval" + ;; + esac]) +AC_MSG_RESULT($INSTALL_PREFIX) +AC_SUBST(INSTALL_PREFIX) + +############################################################################### +CF_MAN_PAGES + +############################################################################### +CF_HELP_MESSAGE(Options to Specify the Libraries Built/Used:) + +### Options to allow the user to specify the set of libraries which are used. +### Use "--without-normal --with-shared" to allow the default model to be +### shared, for example. +cf_list_models="" + +AC_MSG_CHECKING(if you want to build shared libraries) +AC_ARG_WITH(shared, + [ --with-shared generate shared-libraries], + [with_shared=$withval], + [with_shared=no]) +AC_MSG_RESULT($with_shared) +test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared" + +AC_MSG_CHECKING(if you want to build static libraries) +AC_ARG_WITH(normal, + [ --with-normal generate normal-libraries (default)], + [with_normal=$withval], + [with_normal=yes]) +AC_MSG_RESULT($with_normal) +test "$with_normal" = "yes" && cf_list_models="$cf_list_models normal" + +AC_MSG_CHECKING(if you want to build debug libraries) +AC_ARG_WITH(debug, + [ --with-debug generate debug-libraries (default)], + [with_debug=$withval], + [with_debug=yes]) +AC_MSG_RESULT($with_debug) +test "$with_debug" = "yes" && cf_list_models="$cf_list_models debug" + +AC_MSG_CHECKING(if you want to build profiling libraries) +AC_ARG_WITH(profile, + [ --with-profile generate profile-libraries], + [with_profile=$withval], + [with_profile=no]) +AC_MSG_RESULT($with_profile) +test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile" + +AC_MSG_CHECKING(if you want to build a separate terminfo library) +AC_ARG_WITH(termlib, + [ --with-termlib generate separate terminfo library], + [with_termlib=$withval], + [with_termlib=no]) +AC_MSG_RESULT($with_termlib) + +### Checks for special libraries, must be done up-front. +AC_MSG_CHECKING(if you want to link with dbmalloc for testing) +AC_ARG_WITH(dbmalloc, + [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], + [with_dbmalloc=$withval], + [with_dbmalloc=no]) +AC_MSG_RESULT($with_dbmalloc) +if test $with_dbmalloc = yes ; then + AC_CHECK_LIB(dbmalloc,debug_malloc) +fi + +AC_MSG_CHECKING(if you want to link with dmalloc for testing) +AC_ARG_WITH(dmalloc, + [ --with-dmalloc test: use Gray Watson's dmalloc library], + [with_dmalloc=$withval], + [with_dmalloc=no]) +AC_MSG_RESULT($with_dmalloc) +if test $with_dmalloc = yes ; then + AC_CHECK_LIB(dmalloc,dmalloc_debug) +fi + +SHLIB_LIST="" +AC_MSG_CHECKING(if you want to link with the gpm mouse library) +AC_ARG_WITH(gpm, + [ --with-gpm use Alessandro Rubini's GPM library], + [with_gpm=$withval], + [with_gpm=no]) +AC_MSG_RESULT($with_gpm) +if test $with_gpm = yes ; then + AC_CHECK_LIB(gpm,Gpm_Open,[ + EXTRA_LIBS="-lgpm -lncurses $EXTRA_LIBS" + SHLIB_LIST="-lgpm $SHLIB_LIST" + AC_DEFINE(HAVE_LIBGPM) + AC_CHECK_HEADERS(gpm.h) + ],,-lcurses -ltermcap) +fi + +TINFO_LIST="$SHLIB_LIST" +test $with_termlib = yes && SHLIB_LIST="$SHLIB_LIST -ltinfo" + +AC_SUBST(EXTRA_LIBS) +AC_SUBST(TINFO_LIST) +AC_SUBST(SHLIB_LIST) + +AC_MSG_CHECKING(for specified models) +test -z "$cf_list_models" && cf_list_models=normal +AC_MSG_RESULT($cf_list_models) + +### Use the first model as the default, and save its suffix for use in building +### up test-applications. +DFT_LWR_MODEL=`echo $cf_list_models | $AWK '{print $1}'` +CF_UPPER(DFT_UPR_MODEL,$DFT_LWR_MODEL)dnl +CF_LIB_SUFFIX($DFT_LWR_MODEL,DFT_DEP_SUFFIX)dnl +CF_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl +CF_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl +AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj") +AC_SUBST(DFT_LWR_MODEL)dnl the default model ("normal") +AC_SUBST(DFT_UPR_MODEL)dnl the default model ("NORMAL") +AC_SUBST(DFT_DEP_SUFFIX)dnl the corresponding library-suffix (".a") +AC_SUBST(DFT_ARG_SUFFIX)dnl the string to append to "-lncurses" ("") +AC_SUBST(cf_list_models)dnl the complete list of models ("normal debug") + +TINFO_NAME=tinfo +AC_SUBST(TINFO_NAME) + +LIB_NAME=ncurses +AC_SUBST(LIB_NAME) + +LIB_DIR=../lib +CF_LIB_PREFIX(cf_prefix) +LIB_PREFIX=$LIB_DIR/$cf_prefix +AC_SUBST(LIB_PREFIX) + +dnl Not all ports of gcc support the -g option +dnl autoconf 2.12 uses different symbol for -g option than autoconf 2.10, etc. + +if test X"$CC_G_OPT" = X"" ; then + CC_G_OPT='-g' + test -n "$GCC" && test "${ac_cv_prog_cc_g}" != yes && CC_G_OPT='' +fi +AC_SUBST(CC_G_OPT) + +if test X"$CXX_G_OPT" = X"" ; then + CXX_G_OPT='-g' + test -n "$GXX" && test "${ac_cv_prog_cxx_g}" != yes && CXX_G_OPT='' +fi +AC_SUBST(CXX_G_OPT) + +case $DFT_LWR_MODEL in +normal) LD_MODEL='' ;; +debug) LD_MODEL=$CC_G_OPT ;; +profile) LD_MODEL='-pg';; +shared) LD_MODEL='' ;; +esac +AC_SUBST(LD_MODEL)dnl the type of link (e.g., -g or -pg) + +AC_MSG_CHECKING(if rpath option should be used) +AC_ARG_ENABLE(rpath, +[ --enable-rpath use rpath option when generating shared libraries], +[cf_cv_ld_rpath=$enableval], +[cf_cv_ld_rpath=no]) +AC_MSG_RESULT($cf_cv_ld_rpath) + +CF_SHARED_OPTS + +if test "$CC_SHARED_OPTS" = "unknown"; then + for model in $cf_list_models; do + if test "$model" = "shared"; then + AC_ERROR(Shared libraries are not supported in this version) + fi + done +fi + +############################################################################### +CF_HELP_MESSAGE(Fine-Tuning Your Configuration:) + +### use option --disable-overwrite to leave out the link to -lcurses +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 + test "$with_overwrite" = no && \ + test "x$includedir" = 'x${prefix}/include' && \ + includedir='$(prefix)/include/ncurses' + ], + [with_overwrite=yes]) +AC_MSG_RESULT($with_overwrite) +AC_MSG_CHECKING(where we will install curses.h) +AC_MSG_RESULT($includedir) + +AC_MSG_CHECKING(if external terminfo-database is used) +AC_ARG_ENABLE(database, + [ --disable-database use only built-in data], + [with_database=$enableval], + [with_database=yes]) +AC_MSG_RESULT($with_database) +test $with_database != no && AC_DEFINE(USE_DATABASE) + +AC_MSG_CHECKING(if you want to build with function extensions) +AC_ARG_ENABLE(ext-funcs, + [ --disable-ext-funcs disable function-extensions], + [with_ext_funcs=$enableval], + [with_ext_funcs=yes]) +AC_MSG_RESULT($with_ext_funcs) +test "$with_ext_funcs" = yes && AC_DEFINE(NCURSES_EXT_FUNCS) + +AC_MSG_CHECKING(for list of fallback descriptions) +AC_ARG_WITH(fallbacks, + [ --with-fallbacks=XXX specify list of fallback terminal descriptions], + [with_fallback=$withval], + [with_fallback=]) +AC_MSG_RESULT($with_fallback) +FALLBACK_LIST=`echo $with_fallback|sed -e 's/,/ /g'` +AC_SUBST(FALLBACK_LIST) + +AC_MSG_CHECKING(for list of terminfo directories) +CF_WITH_PATHLIST(terminfo-dirs, + [ --with-terminfo-dirs=XXX specify list of terminfo directories], + TERMINFO_DIRS, + DATADIR/terminfo, + ${datadir}/terminfo) +AC_MSG_RESULT($TERMINFO_DIRS) +test -n "$TERMINFO_DIRS" && AC_DEFINE_UNQUOTED(TERMINFO_DIRS,"$TERMINFO_DIRS") + +if test $with_database = no ; then + if test -z $with_fallback ; then + AC_ERROR(You have disabled the database w/o specifying fallbacks) + fi +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. +AC_MSG_CHECKING(if big-core option selected) +AC_ARG_ENABLE(big-core, + [ --disable-big-core assume machine has little memory], + [with_big_core=$enableval], + [AC_TRY_RUN([ +#include <stdlib.h> +#include <string.h> +int main() { exit(malloc(6000000L) == 0); }], + [with_big_core=yes], + [with_big_core=no], + [with_big_core=no])]) +AC_MSG_RESULT($with_big_core) +test "$with_big_core" = "yes" && AC_DEFINE(HAVE_BIG_CORE) + +### use option --enable-termcap to compile in the termcap fallback support +AC_MSG_CHECKING(if you want termcap-fallback support) +AC_ARG_ENABLE(termcap, + [ --enable-termcap compile in termcap fallback support], + [with_termcap=$enableval], + [with_termcap=no]) +AC_MSG_RESULT($with_termcap) + +if test "$with_termcap" != "yes" ; then + AC_DEFINE(PURE_TERMINFO) +else + +### use option --enable-getcap to use a hacked getcap for reading termcaps +AC_MSG_CHECKING(if fast termcap-loader is needed) +AC_ARG_ENABLE(getcap, + [ --enable-getcap fast termcap load, no xrefs to terminfo], + [with_getcap=$enableval], + [with_getcap=no]) +AC_MSG_RESULT($with_getcap) +test "$with_getcap" = "yes" && AC_DEFINE(USE_GETCAP) + +AC_MSG_CHECKING(if translated termcaps will be cached in ~/.terminfo) +AC_ARG_ENABLE(getcap-cache, + [ --enable-getcap-cache cache translated termcaps in ~/.terminfo], + [with_getcap_cache=$enableval], + [with_getcap_cache=no]) +AC_MSG_RESULT($with_getcap_cache) +test "$with_getcap_cache" = "yes" && AC_DEFINE(USE_GETCAP_CACHE) + +fi + +### Use option --enable-symlinks to make tic use symlinks, not hard links +### to reduce storage requirements for the terminfo database. +CF_LINK_FUNCS + +with_links=no +with_symlinks=no + +if test "$ac_cv_func_link" != yes ; then + AC_MSG_CHECKING(if tic should use symbolic links) + if test "$ac_cv_func_symlink" = yes ; then + with_symlinks=yes + else + with_symlinks=no + fi + AC_MSG_RESULT($with_symlinks) +elif test "$ac_cv_func_symlink" != yes ; then + AC_MSG_CHECKING(if tic should use hard links) + if test "$ac_cv_func_link" = yes ; then + with_links=yes + else + with_links=no + fi + AC_MSG_RESULT($with_links) +else + AC_MSG_CHECKING(if tic should use symbolic links) + AC_ARG_ENABLE(symlinks, + [ --enable-symlinks make tic use symbolic links not hard links], + [with_symlinks=$enableval], + [with_symlinks=no]) + AC_MSG_RESULT($with_symlinks) +fi + +test "$with_links" = yes && AC_DEFINE(USE_LINKS) +test "$with_symlinks" = yes && AC_DEFINE(USE_SYMLINKS) + +### use option --enable-bsdpad to have tputs process BSD-style prefix padding +AC_MSG_CHECKING(if tputs should process BSD-style prefix padding) +AC_ARG_ENABLE(bsdpad, + [ --enable-bsdpad recognize BSD-style prefix padding], + [with_bsdpad=$enableval], + [with_bsdpad=no]) +AC_MSG_RESULT($with_bsdpad) +test "$with_bsdpad" = yes && AC_DEFINE(BSD_TPUTS) + +### use option --enable-const to turn on use of const beyond that in XSI. +AC_MSG_CHECKING(for extended use of const keyword) +AC_ARG_ENABLE(const, + [ --enable-const compile with extra/non-standard const], + [with_ext_const=$enableval], + [with_ext_const=no]) +AC_MSG_RESULT($with_ext_const) +NCURSES_CONST="" +if test "$with_ext_const" = yes ; then + AC_DEFINE(NCURSES_CONST,const) + NCURSES_CONST=const +fi +AC_SUBST(NCURSES_CONST) + +### Enable compiling-in rcs id's +AC_MSG_CHECKING(if RCS identifiers should be compiled-in) +AC_ARG_WITH(rcs-ids, + [ --with-rcs-ids compile-in RCS identifiers], + [with_rcs_ids=$withval], + [with_rcs_ids=no]) +AC_MSG_RESULT($with_rcs_ids) +test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS) + +############################################################################### +CF_HELP_MESSAGE(Experimental Code:) +AC_MSG_CHECKING(if you want all experimental code) +AC_ARG_WITH(develop, + [ --with-develop enable all experimental options for testing], + [with_develop=$withval], + [with_develop=no]) +AC_MSG_RESULT($with_develop) + +### use option --enable-broken-linker to force on use of broken-linker support +AC_MSG_CHECKING(if you want broken-linker support code) +AC_ARG_ENABLE(broken_linker, + [ --enable-broken_linker compile with broken-linker support code], + [with_broken_linker=$enableval], + [with_broken_linker=$BROKEN_LINKER]) +AC_MSG_RESULT($with_broken_linker) +test "$with_broken_linker" = yes && AC_DEFINE(BROKEN_LINKER) + +### use option --enable-hard-tabs to turn on use of hard-tabs optimize +AC_MSG_CHECKING(if you want experimental hard-tabs code) +AC_ARG_ENABLE(hard-tabs, + [ --enable-hard-tabs compile with experimental hard-tabs code], + [with_hardtabs=$enableval], + [with_hardtabs=$with_develop]) +AC_MSG_RESULT($with_hardtabs) +test "$with_hardtabs" = yes && AC_DEFINE(USE_HARD_TABS) + +### use option --enable-hashmap to turn on use of hashmap scrolling logic +AC_MSG_CHECKING(if you want experimental hashmap code) +AC_ARG_ENABLE(hashmap, + [ --enable-hashmap compile with experimental hashmap code], + [with_hashmap=$enableval], + [with_hashmap=yes]) +AC_MSG_RESULT($with_hashmap) +test "$with_hashmap" = yes && AC_DEFINE(USE_HASHMAP) + +AC_MSG_CHECKING(if you want experimental no-padding code) +AC_ARG_ENABLE(no-padding, + [ --enable-no-padding compile with experimental no-padding code], + [with_no_padding=$enableval], + [with_no_padding=yes]) +AC_MSG_RESULT($with_no_padding) +test "$with_no_padding" = yes && AC_DEFINE(NCURSES_NO_PADDING) + +AC_MSG_CHECKING(if you want experimental safe-sprintf code) +AC_ARG_ENABLE(safe-sprintf, + [ --enable-safe-sprintf compile with experimental safe-sprintf code], + [with_safe_sprintf=$enableval], + [with_safe_sprintf=no]) +AC_MSG_RESULT($with_safe_sprintf) +test "$with_safe_sprintf" = yes && AC_DEFINE(USE_SAFE_SPRINTF) + +### use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic +AC_MSG_CHECKING(if you want to experiment without scrolling-hints code) +AC_ARG_ENABLE(scroll-hints, + [ --disable-scroll-hints compile hashmap without scroll-hints code], + [with_scroll_hints=$enableval], + [with_scroll_hints=yes; + # when hashmap is used scroll hints are useless + test $with_hashmap = yes && with_scroll_hints=no]) +AC_MSG_RESULT($with_scroll_hints) +test "$with_scroll_hints" = yes && AC_DEFINE(USE_SCROLL_HINTS) + +### use option --enable-tcap-names to allow user to define new capabilities +AC_MSG_CHECKING(if you want experimental definable names like termcap) +AC_ARG_ENABLE(tcap-names, + [ --enable-tcap-names compile with experimental definable-name code], + [with_tcap_names=$enableval], + [with_tcap_names=$with_develop]) +AC_MSG_RESULT($with_tcap_names) +NCURSES_XNAMES=0 +test "$with_tcap_names" = yes && NCURSES_XNAMES=1 +AC_SUBST(NCURSES_XNAMES) + +### use option --enable-sigwinch to turn on use of SIGWINCH logic +AC_MSG_CHECKING(if you want experimental SIGWINCH handler) +AC_ARG_ENABLE(sigwinch, + [ --enable-sigwinch compile with experimental SIGWINCH handler], + [with_sigwinch=$enableval], + [with_sigwinch=yes]) +AC_MSG_RESULT($with_sigwinch) +test "$with_sigwinch" = yes && AC_DEFINE(USE_SIGWINCH) + +### use option --enable-widec to turn on use of wide-character support +AC_MSG_CHECKING(if you want experimental wide-character code) +AC_ARG_ENABLE(widec, + [ --enable-widec compile with experimental wide-char code], + [with_widec=$enableval], + [with_widec=no]) +AC_MSG_RESULT($with_widec) +test "$with_widec" = yes && AC_DEFINE(USE_WIDEC_SUPPORT) + +### use option --enable-xmc-glitch to turn on use of magic-cookie optimize +AC_MSG_CHECKING(if you want experimental xmc code) +AC_ARG_ENABLE(xmc-glitch, + [ --enable-xmc-glitch compile with experimental xmc code], + [with_xmc_glitch=$enableval], + [with_xmc_glitch=$with_develop]) +AC_MSG_RESULT($with_xmc_glitch) +test "$with_xmc_glitch" = yes && AC_DEFINE(USE_XMC_SUPPORT) + +############################################################################### +CF_HELP_MESSAGE(Testing/development Options:) + +### use option --disable-echo to suppress full display compiling commands +AC_ARG_ENABLE(echo, + [ --enable-echo build: display "compiling" commands (default)], + [with_echo=$enableval], + [with_echo=yes]) +if test "$with_echo" = yes; then + ECHO_LINK= +else + ECHO_LINK='@ echo linking $@ ... ;' +fi +AC_SUBST(ECHO_LINK) + +### use option --enable-warnings to turn on all gcc warnings +AC_ARG_ENABLE(warnings, + [ --enable-warnings build: turn on GCC compiler warnings], + [with_warnings=$enableval]) +if test -n "$with_warnings"; then + ADAFLAGS="$ADAFLAGS -gnatg" + CF_GCC_WARNINGS +fi +CF_GCC_ATTRIBUTES + +### use option --enable-assertions to turn on generation of assertion code +AC_ARG_ENABLE(assertions, + [ --enable-assertions test: turn on generation of assertion code], + [with_assertions=$enableval], + [with_assertions=no]) +if test -n "$GCC" +then + if test $with_assertions = no + then + AC_DEFINE(NDEBUG) + CPPFLAGS="$CPPFLAGS -DNDEBUG" + else + ADAFLAGS="$ADAFLAGS -gnata" + fi +fi + +### use option --disable-leaks to suppress "permanent" leaks, for testing +AC_ARG_ENABLE(leaks, + [ --disable-leaks test: suppress permanent memory-leaks], + [test $enableval = no && AC_DEFINE(NO_LEAKS)]) +AC_DEFINE(HAVE_NC_ALLOC_H) + +### use option --enable-expanded to generate certain macros as functions +AC_ARG_ENABLE(expanded, + [ --enable-expanded test: generate functions for certain macros], + [test $enableval = yes && AC_DEFINE(NCURSES_EXPANDED)]) + +### use option --disable-macros to suppress macros in favor of functions +AC_ARG_ENABLE(macros, + [ --disable-macros test: use functions rather than macros], + [test $enableval = no && AC_DEFINE(NCURSES_NOMACROS)]) + +### Checks for libraries. +AC_CHECK_FUNC(gettimeofday, + AC_DEFINE(HAVE_GETTIMEOFDAY),[ + +AC_CHECK_LIB(bsd, gettimeofday, + AC_DEFINE(HAVE_GETTIMEOFDAY) + LIBS="$LIBS -lbsd")])dnl CLIX: bzero, select, gettimeofday + +MATH_LIB="" +AC_CHECK_FUNC(sin,, + AC_CHECK_LIB(m, sin,[MATH_LIB="-lm"])) +AC_SUBST(MATH_LIB) + +### Checks for header files. +AC_STDC_HEADERS +AC_HEADER_DIRENT +CF_REGEX + +dnl These are some other potentially nonportable headers. +AC_CHECK_HEADERS( \ +fcntl.h \ +getopt.h \ +libc.h \ +limits.h \ +locale.h \ +sys/bsdtypes.h \ +sys/ioctl.h \ +sys/param.h \ +poll.h \ +sys/select.h \ +sys/stropts.h \ +sys/time.h \ +sys/times.h \ +termio.h \ +termios.h \ +ttyent.h \ +unistd.h \ +values.h \ +) + +# check for ISC (this may also define _POSIX_SOURCE) +# Note: even non-Posix ISC needs <sys/bsdtypes.h> to declare fd_set +if test "$ISC" = yes ; then + AC_CHECK_LIB(cposix,main) + AC_CHECK_LIB(inet,bzero,LIBS="$LIBS -linet")dnl also 'select()' + AC_CHECK_HEADERS( sys/termio.h ) +fi + +CF_SYS_TIME_SELECT + +### checks for compiler characteristics +AC_LANG_C +AC_C_CONST +AC_C_INLINE +test $ac_cv_c_inline != no && AC_DEFINE(CC_HAS_INLINE_FUNCS) + +CF_TYPEOF_CHTYPE +CF_WIDEC_SHIFT + +### Checks for external-data +CF_ERRNO +CF_LINK_DATAONLY +CF_SPEED_TYPE + +### Checks for library functions. +AC_CHECK_FUNCS( getcwd \ +getttynam \ +memccpy \ +nanosleep \ +poll \ +remove \ +select \ +setbuf \ +setbuffer \ +setvbuf \ +sigaction \ +sigvec \ +strdup \ +strstr \ +tcgetattr \ +tcgetpgrp \ +times \ +usleep \ +vfscanf \ +vsnprintf \ +vsscanf \ +) + +if test "$with_getcap" = "yes" ; then + CF_CGETENT +fi + +CF_ISASCII +CF_STRUCT_SIGACTION +CF_STRUCT_TERMIOS + +dnl FIXME (may need this) AC_SYS_RESTARTABLE_SYSCALLS +if test "$cross_compiling" = yes ; then + AC_MSG_WARN(cross compiling: assume setvbuf params not reversed) +else + AC_FUNC_SETVBUF_REVERSED +fi +AC_TYPE_SIGNAL +CF_TYPE_SIGACTION +CF_SIZECHANGE +CF_FUNC_MEMMOVE + +dnl We'll do our own -g libraries, unless the user's overridden via $CFLAGS +if test -z "$cf_user_CFLAGS" ; then + CF_STRIP_G_OPT(CFLAGS) + CF_STRIP_G_OPT(CXXFLAGS) +fi + +dnl Check for C++ compiler characteristics (and ensure that it's there!) +CF_BOOL_DECL(cf_cv_cc_bool_type) +if test -n "$CXX" ; then + AC_LANG_CPLUSPLUS + case "`${CXX-g++} --version`" in + 2.7*) + CF_CXX_LIBRARY + ;; + *) + cf_cxx_library=yes + ;; + esac + AC_CHECK_HEADERS(builtin.h typeinfo) + CF_BOOL_DECL + CF_BOOL_SIZE + CF_ETIP_DEFINES +else + cf_cxx_library=no + cf_cv_builtin_bool=0 + + # Just because we are not configuring against C++ right now does not + # mean that a user will not want to use C++. Some distributors disable + # the C++ portion of this configuration as a shortcut (or just to avoid + # compiling the demo in the c++ directory). So we need a reasonable + # default for the 'bool' type. + # + # Caveat: since the storage of the bool type is not standardized, it + # may change. + + AC_MSG_CHECKING(for fallback type of bool) + case "$host_cpu" in #(vi + i?86) cf_cv_type_of_bool=char ;; #(vi + *) cf_cv_type_of_bool=int ;; + esac + AC_MSG_RESULT($cf_cv_type_of_bool) +fi +AC_SUBST(CXXLIBS) + +CF_HELP_MESSAGE(Ada95 Binding Options:) + +dnl Check for availability of GNU Ada Translator (GNAT). +dnl At the moment we support no other Ada95 compiler. +if test "$cf_with_ada" != "no" ; then +cf_ada_make=gnatmake +AC_CHECK_PROG(gnat_exists, $cf_ada_make, yes, no) +if test "$ac_cv_prog_gnat_exists" = no; then + cf_ada_make= +else + CF_GNAT_VERSION + AC_CHECK_PROG(m4_exists, m4, yes, no) + if test "$ac_cv_prog_m4_exists" = no; then + cf_cv_prog_gnat_correct=no + echo Ada95 binding required program m4 not found. Ada95 binding disabled. + fi + if test "$cf_cv_prog_gnat_correct" = yes; then + AC_MSG_CHECKING(if GNAT works) + CF_GNAT_TRY_RUN([procedure conftest;], +[with Text_IO; +with GNAT.OS_Lib; +procedure conftest is +begin + Text_IO.Put ("Hello World"); + Text_IO.New_Line; + GNAT.OS_Lib.OS_Exit (0); +end conftest;],[cf_cv_prog_gnat_correct=yes],[cf_cv_prog_gnat_correct=no]) + AC_MSG_RESULT($cf_cv_prog_gnat_correct) + fi +fi +if test "$cf_cv_prog_gnat_correct" = yes; then + ADAFLAGS="-O3 -gnatpn $ADAFLAGS" + + AC_ARG_WITH(ada-compiler, + [ --with-ada-compiler=CMD Specify Ada95 compiler command (default gnatmake)], + [cf_ada_compiler=$withval], + [cf_ada_compiler=gnatmake]) + + cf_ada_package=terminal_interface + + AC_SUBST(cf_ada_make) + AC_SUBST(cf_ada_compiler) + AC_SUBST(cf_ada_package) + AC_SUBST(ADAFLAGS) + AC_SUBST(cf_compile_generics) + AC_SUBST(cf_generic_objects) + + CF_WITH_PATH(ada-include, + [ --with-ada-include=DIR Ada includes are in DIR], + ADA_INCLUDE, + PREFIX/lib/gnu-Ada/adainclude, + [$]prefix/lib/gnu-Ada/adainclude) + AC_SUBST(ADA_INCLUDE) + + CF_WITH_PATH(ada-objects, + [ --with-ada-objects=DIR Ada objects are in DIR], + ADA_OBJECTS, + PREFIX/lib/gnu-Ada/adalib, + [$]prefix/lib/gnu-Ada/adalib) + AC_SUBST(ADA_OBJECTS) + + if test $with_shared = no + then + AC_MSG_WARN(Ada95 applications will not link properly with static libraries) + fi +fi +fi + +### It's not possible to appease gcc 2.6.3's conversion-warnings if we're +### using a 'char' for bools. gcc 2.7.0's conversion-warnings are broken too +### badly to consider using for development purposes, but 2.5.8 is okay. +if test -n "$with_warnings"; then + if test -n "$GCC"; then + case "`$CC --version`" in + 2.6.3) + if test "$cf_cv_type_of_bool" != "char"; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wconversion" + fi + ;; + 2.5*) + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wconversion" + ;; + esac + fi +fi + +### Construct the library-subsets, if any, from this set of keywords: +### none, base, ext_funcs, termlib. +AC_MSG_CHECKING(for library subsets) +if test "$with_termlib" = yes ; then + LIB_SUBSETS="termlib " +else + LIB_SUBSETS="termlib+" +fi +LIB_SUBSETS="${LIB_SUBSETS}base" +test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs" +AC_MSG_RESULT($LIB_SUBSETS) + +### Construct the list of include-directories to be generated +CF_INCLUDE_DIRS +CF_ADA_INCLUDE_DIRS + +### Set up low-level terminfo dependencies for makefiles. Note that we +### could override this. +if test "$with_termlib" = yes ; then + TEST_DEPS="${LIB_PREFIX}${TINFO_NAME}${DFT_DEP_SUFFIX}" + TEST_ARGS="-l${TINFO_NAME}${DFT_ARG_SUFFIX}" +fi +PROG_DEPS="$TEST_DEPS" +PROG_ARGS="$TEST_ARGS" + +### Construct the list of subdirectories for which we'll customize makefiles +### with the appropriate compile-rules. + +CF_SRC_MODULES($modules_to_build) +CF_DIRS_TO_MAKE + +### Now that we're done running tests, add the compiler-warnings, if any +CFLAGS="$CFLAGS $EXTRA_CFLAGS" + +################################################################################ +AC_OUTPUT( \ + include/MKterm.h.awk \ + include/curses.h \ + include/termcap.h \ + include/unctrl.h \ + $SUB_MAKEFILES \ + Makefile,[ +CF_LIB_RULES +],[ +### Special initialization commands, used to pass information from the +### configuration-run into config.status + +AWK="$AWK" +CF_LIST_MODELS="$cf_list_models" +DFT_LWR_MODEL="$DFT_LWR_MODEL" +LDCONFIG="$LDCONFIG" +LIB_NAME="$LIB_NAME" +LIB_SUBSETS="$LIB_SUBSETS" +SRC_SUBDIRS="$SRC_SUBDIRS" +TINFO_NAME="$TINFO_NAME" +WITH_ECHO="$with_echo" +WITH_OVERWRITE="$with_overwrite" +cf_cv_abi_version="$cf_cv_abi_version" +cf_cv_do_symlinks="$cf_cv_do_symlinks" +cf_cv_rel_version="$cf_cv_rel_version" +cf_cv_rm_so_locs="$cf_cv_rm_so_locs" +cf_cv_system_name="$cf_cv_system_name" +cf_cxx_library="$cf_cxx_library" +target="$target" + +],sort)dnl +${MAKE-make} preinstall diff --git a/contrib/ncurses/convert_configure.pl b/contrib/ncurses/convert_configure.pl new file mode 100644 index 000000000000..9d1026d16878 --- /dev/null +++ b/contrib/ncurses/convert_configure.pl @@ -0,0 +1,54 @@ +extproc perl -S -w + +# The converted script is written to stdout, so run this script as +# convert_configure configure > configure.cmd +# +# When the converted script runs, it expects that /tmp dir is +# available (so we create it). +# +# run the result like this: +# .\configure +; + +mkdir '/tmp', 0777 unless -d '/tmp'; + +print <<EOF; +extproc sh + +# Make sensible defaults: +CC="gcc -Zexe" +export CC +#GCCOPT="$GCCOPT -Zexe" +#export GCCOPT +CONFIG_SHELL=sh + +EOF + +$checking_path = 0; + +while (<>) { + if (/for\s+(\w+)\s+in\s*\$PATH\s*;/) { + $checking_path = 1; + $varname = $1; + $subst= <<EOS +$varname="`echo -E \\"\$$varname\\" | tr \\\\\\\\\\\\\\\\ / `" +EOS + } + $checking_path = 0 if /^\s*done\s*$/; + # We want to create an extra line like this one: +# ac_dir="`echo -E \"$ac_dir\" | tr \\\\\\\\ / `" + s{^((\s*)if\s+test)\s*-f\s*(\$$varname/\S+)\s*;} + {$2$subst$1 -f $3 -o -f $3.exe ;} + if $checking_path; # Checking for executables + s/^host=NONE$/host=os2/; # Make default host + s/"\$\{IFS}:"$/"\${IFS};"/; # Fix IFS line + s/\btest\s+-s\s+conftest\b/test -f conftest/g; # Fix exe test + # This one is needed for curses: + s/host=`\$ac_config_sub \$host_alias`/$&\nif test -z "$host"; then host=\$host_alias; fi/; + s,/bin/sh(?![/\w]),sh,g; + print; +} + +__END__ + +Changes: 98/11 : support check for executables in ncurses. diff --git a/contrib/ncurses/dist.mk b/contrib/ncurses/dist.mk new file mode 100644 index 000000000000..70168a531fee --- /dev/null +++ b/contrib/ncurses/dist.mk @@ -0,0 +1,62 @@ +# $Id: dist.mk,v 1.162 1999/08/21 23:40:17 tom Exp $ +# Makefile for creating ncurses distributions. +# +# This only needs to be used directly as a makefile by developers, but +# configure mines the current version number out of here. To move +# to a new version number, just edit this file and run configure. +# +SHELL = /bin/sh + +# These define the major/minor/patch versions of ncurses. +NCURSES_MAJOR = 5 +NCURSES_MINOR = 0 +NCURSES_PATCH = 990821 + +# We don't append the patch to the version, since this only applies to releases +VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) + +DUMP = lynx -dump +DUMP2 = $(DUMP) -nolist + +ALL = ANNOUNCE announce.html misc/ncurses-intro.doc misc/hackguide.doc + +all : $(ALL) + +dist: $(ALL) + (cd ..; tar cvf ncurses-$(VERSION).tar `sed <ncurses-$(VERSION)/MANIFEST 's/^./ncurses-$(VERSION)/'`; gzip ncurses-$(VERSION).tar) + +distclean: + rm -f $(ALL) + +# Don't mess with announce.html.in unless you have lynx available! +announce.html: announce.html.in + sed 's,@VERSION@,$(VERSION),' <announce.html.in >announce.html + +ANNOUNCE : announce.html + $(DUMP) announce.html >ANNOUNCE + +misc/ncurses-intro.doc: misc/ncurses-intro.html + $(DUMP2) misc/ncurses-intro.html > misc/ncurses-intro.doc +misc/hackguide.doc: misc/hackguide.html + $(DUMP2) misc/hackguide.html > misc/hackguide.doc + +# Prepare distribution for version control +vcprepare: + find . -type d -exec mkdir {}/RCS \; + +# Write-lock almost all files not under version control. +ADA_EXCEPTIONS=$(shell eval 'a="\\\\\|";for x in Ada95/gen/terminal*.m4; do echo -n $${a}Ada95/ada_include/`basename $${x} .m4`; done') +EXCEPTIONS = 'announce.html$\\|ANNOUNCE\\|misc/.*\\.doc\\|man/terminfo.5\\|lib_gen.c'$(ADA_EXCEPTIONS) +writelock: + for x in `grep -v $(EXCEPTIONS) MANIFEST`; do if [ ! -f `dirname $$x`/RCS/`basename $$x`,v ]; then chmod a-w $${x}; fi; done + +# This only works on a clean source tree, of course. +MANIFEST: + -rm -f $@ + touch $@ + find . -type f -print |sort | fgrep -v .lsm |fgrep -v .spec >$@ + +TAGS: + etags */*.[ch] + +# Makefile ends here diff --git a/contrib/ncurses/form/Makefile.in b/contrib/ncurses/form/Makefile.in new file mode 100644 index 000000000000..798053058a0f --- /dev/null +++ b/contrib/ncurses/form/Makefile.in @@ -0,0 +1,148 @@ +# $Id: Makefile.in,v 1.25 1998/04/04 00:49:55 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 +# +# Makefile for form source code. +# +# This makes the following: +# libraries (normal/debug/profile/shared) +# +# The variable 'srcdir' refers to the source-distribution, and can be set with +# the configure script by "--srcdir=DIR". +# +# The rules are organized to produce the libraries for the configured models, + +# turn off _all_ suffix rules; we'll generate our own +.SUFFIXES: + +SHELL = /bin/sh +THIS = Makefile + +MODEL = @DFT_LWR_MODEL@ +INSTALL_PREFIX = @INSTALL_PREFIX@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ + +INSTALL = @INSTALL@ +INSTALL_LIB = @INSTALL@ @INSTALL_LIB@ +INSTALL_DATA = @INSTALL_DATA@ + +AR = @AR@ +AR_OPTS = @AR_OPTS@ +AWK = @AWK@ +LD = @LD@ +LN_S = @LN_S@ + +CC = @CC@ +CFLAGS = @CFLAGS@ + +CPPFLAGS = @CPPFLAGS@ \ + -DHAVE_CONFIG_H + +CCFLAGS = $(CPPFLAGS) $(CFLAGS) + +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) +LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ + +SHLIB_DIRS = -L../lib -L$(libdir) +SHLIB_LIST = $(SHLIB_DIRS) -lncurses @SHLIB_LIST@ + +MK_SHARED_LIB = @MK_SHARED_LIB@ + +REL_VERSION = @cf_cv_rel_version@ +ABI_VERSION = @cf_cv_abi_version@ + +RANLIB = @RANLIB@ + +LIBRARIES = @LIBS_TO_MAKE@ + +LINT = @LINT@ +LINT_OPTS = @LINT_OPTS@ +LINT_LIBS = -lform -lncurses @LIBS@ + +AUTO_SRC = \ + ../include/form.h + +################################################################################ +all \ +install :: $(AUTO_SRC) $(LIBRARIES) + +sources : $(AUTO_SRC) + +$(INSTALL_PREFIX)$(libdir) : + $(srcdir)/../mkinstalldirs $@ + +# make copies to simplify include-paths while still keeping form's include +# file in this directory. +../include/form.h : $(srcdir)/form.h + -rm -f $@ + cp $(srcdir)/form.h $@ + +FORM_PRIV_H = \ + $(srcdir)/form.priv.h \ + $(srcdir)/form.h \ + ../include/mf_common.h \ + ../include/curses.h \ + ../include/eti.h + +tags: + ctags *.[ch] + +TAGS: + etags *.[ch] + +mostlyclean :: + -rm -f core tags TAGS *~ *.ln *.atac trace + +clean :: mostlyclean + -rm -f $(AUTO_SRC) + +distclean :: clean + -rm -f Makefile + +realclean :: distclean + +../include/mf_common.h \ +../include/eti.h : + cd ../menu && $(MAKE) $@ + +############################################################################### +# The remainder of this file is automatically generated during configuration +############################################################################### diff --git a/contrib/ncurses/form/READ.ME b/contrib/ncurses/form/READ.ME new file mode 100644 index 000000000000..dd91693f6b36 --- /dev/null +++ b/contrib/ncurses/form/READ.ME @@ -0,0 +1,15 @@ +This is a clone of the form library that is available with typical +System V curses implementations (ETI). + +It is modelled after the documentation that comes for this library with +a 386 based SVR4 implementation (ESIX). + +The development environment was and is an ELF based Linux system. + +For things that still need doing, see the TO-DO file in the top-level +directory. + +Juergen Pfeifer + +eMail: juergen.pfeifer@gmx.net + diff --git a/contrib/ncurses/form/fld_arg.c b/contrib/ncurses/form/fld_arg.c new file mode 100644 index 000000000000..bc816e9efd0f --- /dev/null +++ b/contrib/ncurses/form/fld_arg.c @@ -0,0 +1,91 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_arg.c,v 1.4 1999/05/16 17:16:04 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_fieldtype_arg( +| FIELDTYPE *typ, +| void * (* const make_arg)(va_list *), +| void * (* const copy_arg)(const void *), +| void (* const free_arg)(void *) ) +| +| Description : Connects to the type additional arguments necessary +| for a set_field_type call. The various function pointer +| arguments are: +| make_arg : allocates a structure for the field +| specific parameters. +| copy_arg : duplicate the structure created by +| make_arg +| free_arg : Release the memory allocated by make_arg +| or copy_arg +| +| At least make_arg must be non-NULL. +| You may pass NULL for copy_arg and free_arg if your +| make_arg function doesn't allocate memory and your +| arg fits into the storage for a (void*). +| +| 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 *)) +{ + if ( !typ || !make_arg ) + RETURN(E_BAD_ARGUMENT); + + typ->status |= _HAS_ARGS; + typ->makearg = make_arg; + typ->copyarg = copy_arg; + typ->freearg = free_arg; + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : void *field_arg(const FIELD *field) +| +| Description : Retrieve pointer to the fields argument structure. +| +| Return Values : Pointer to structure or NULL if none is defined. ++--------------------------------------------------------------------------*/ +void *field_arg(const FIELD * field) +{ + return Normalize_Field(field)->arg; +} + +/* fld_arg.c ends here */ diff --git a/contrib/ncurses/form/fld_attr.c b/contrib/ncurses/form/fld_attr.c new file mode 100644 index 000000000000..3c7d8e353c0e --- /dev/null +++ b/contrib/ncurses/form/fld_attr.c @@ -0,0 +1,111 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: fld_attr.c,v 1.4 1999/05/16 17:16:30 juergen 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)\ +{\ + int res = E_BAD_ARGUMENT;\ + if ( attr==A_NORMAL || ((attr & A_ATTRIBUTES)==attr) )\ + {\ + Normalize_Field( field );\ + if ((field -> name) != attr)\ + {\ + field -> name = attr;\ + res = _nc_Synchronize_Attributes( field );\ + }\ + else\ + res = E_OK;\ + }\ + RETURN(res);\ +} + +/* "Template" macro to generate a function to get a fields attribute */ +#define GEN_FIELD_ATTR_GET_FCT( name ) \ +chtype field_ ## name (const FIELD * field)\ +{\ + return ( A_ATTRIBUTES & (Normalize_Field( field ) -> name) );\ +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_fore(FIELD *field, chtype attr) +| +| Description : Sets the foreground of the field used to display the +| field contents. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid attributes +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +GEN_FIELD_ATTR_SET_FCT( fore ) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : chtype field_fore(const FIELD *) +| +| Description : Retrieve fields foreground attribute +| +| Return Values : The foreground attribute ++--------------------------------------------------------------------------*/ +GEN_FIELD_ATTR_GET_FCT( fore ) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_back(FIELD *field, chtype attr) +| +| Description : Sets the background of the field used to display the +| fields extend. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid attributes +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +GEN_FIELD_ATTR_SET_FCT( back ) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : chtype field_back(const +| +| Description : Retrieve fields background attribute +| +| Return Values : The background attribute ++--------------------------------------------------------------------------*/ +GEN_FIELD_ATTR_GET_FCT( back ) + +/* fld_attr.c ends here */ diff --git a/contrib/ncurses/form/fld_current.c b/contrib/ncurses/form/fld_current.c new file mode 100644 index 000000000000..2bf8163a43f7 --- /dev/null +++ b/contrib/ncurses/form/fld_current.c @@ -0,0 +1,124 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: fld_current.c,v 1.4 1999/05/16 17:16:46 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_current_field(FORM * form,FIELD * field) +| +| Description : Set the current field of the form to the specified one. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid form or field pointer +| E_REQUEST_DENIED - field not selectable +| E_BAD_STATE - called from a hook routine +| E_INVALID_FIELD - current field can't be left +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int set_current_field(FORM * form, FIELD * field) +{ + int err = E_OK; + + if ( !form || !field ) + RETURN(E_BAD_ARGUMENT); + + if ( (form != field->form) || Field_Is_Not_Selectable(field) ) + RETURN(E_REQUEST_DENIED); + + if (!(form->status & _POSTED)) + { + form->current = field; + form->curpage = field->page; + } + else + { + if (form->status & _IN_DRIVER) + err = E_BAD_STATE; + else + { + if (form->current != field) + { + if (!_nc_Internal_Validation(form)) + err = E_INVALID_FIELD; + else + { + Call_Hook(form,fieldterm); + if (field->page != form->curpage) + { + Call_Hook(form,formterm); + err = _nc_Set_Form_Page(form,field->page,field); + Call_Hook(form,forminit); + } + else + { + err = _nc_Set_Current_Field(form,field); + } + Call_Hook(form,fieldinit); + _nc_Refresh_Current_Field(form); + } + } + } + } + RETURN(err); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : FIELD *current_field(const FORM * form) +| +| Description : Return the current field. +| +| Return Values : Pointer to the current field. ++--------------------------------------------------------------------------*/ +FIELD *current_field(const FORM * form) +{ + return Normalize_Form(form)->current; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int field_index(const FIELD * field) +| +| Description : Return the index of the field in the field-array of +| the form. +| +| Return Values : >= 0 : field index +| -1 : fieldpointer invalid or field not connected ++--------------------------------------------------------------------------*/ +int field_index(const FIELD * field) +{ + return ( (field && field->form) ? field->index : -1 ); +} + +/* fld_current.c ends here */ diff --git a/contrib/ncurses/form/fld_def.c b/contrib/ncurses/form/fld_def.c new file mode 100644 index 000000000000..dd3de804688b --- /dev/null +++ b/contrib/ncurses/form/fld_def.c @@ -0,0 +1,346 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_def.c,v 1.12 1999/05/16 17:37:48 juergen Exp $") + +/* this can't be readonly */ +static FIELD default_field = { + 0, /* status */ + 0, /* rows */ + 0, /* cols */ + 0, /* frow */ + 0, /* fcol */ + 0, /* drows */ + 0, /* dcols */ + 0, /* maxgrow*/ + 0, /* nrow */ + 0, /* nbuf */ + NO_JUSTIFICATION, /* just */ + 0, /* page */ + 0, /* index */ + (int)' ', /* pad */ + A_NORMAL, /* fore */ + A_NORMAL, /* back */ + ALL_FIELD_OPTS, /* opts */ + (FIELD *)0, /* snext */ + (FIELD *)0, /* sprev */ + (FIELD *)0, /* link */ + (FORM *)0, /* form */ + (FIELDTYPE *)0, /* type */ + (char *)0, /* arg */ + (char *)0, /* buf */ + (char *)0 /* usrptr */ +}; + +FIELD *_nc_Default_Field = &default_field; + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : TypeArgument *_nc_Make_Argument( +| const FIELDTYPE *typ, +| va_list *ap, +| int *err ) +| +| Description : Create an argument structure for the specified type. +| Use the type-dependant argument list to construct +| it. +| +| 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) +{ + TypeArgument *res = (TypeArgument *)0; + TypeArgument *p; + + if (typ && (typ->status & _HAS_ARGS)) + { + assert(err && ap); + if (typ->status & _LINKED_TYPE) + { + p = (TypeArgument *)malloc(sizeof(TypeArgument)); + if (p) + { + p->left = _nc_Make_Argument(typ->left ,ap,err); + p->right = _nc_Make_Argument(typ->right,ap,err); + return p; + } + else + *err += 1; + } else + { + assert(typ->makearg); + if ( !(res=(TypeArgument *)typ->makearg(ap)) ) + *err += 1; + } + } + return res; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : TypeArgument *_nc_Copy_Argument(const FIELDTYPE *typ, +| const TypeArgument *argp, +| int *err ) +| +| Description : Create a copy of an argument structure for the specified +| type. +| +| 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) +{ + TypeArgument *res = (TypeArgument *)0; + TypeArgument *p; + + if ( typ && (typ->status & _HAS_ARGS) ) + { + assert(err && argp); + if (typ->status & _LINKED_TYPE) + { + p = (TypeArgument *)malloc(sizeof(TypeArgument)); + if (p) + { + p->left = _nc_Copy_Argument(typ,argp->left ,err); + p->right = _nc_Copy_Argument(typ,argp->right,err); + return p; + } + *err += 1; + } + else + { + if (typ->copyarg) + { + if (!(res = (TypeArgument *)(typ->copyarg((const void *)argp)))) + *err += 1; + } + else + res = (TypeArgument *)argp; + } + } + return res; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : void _nc_Free_Argument(const FIELDTYPE *typ, +| TypeArgument * argp ) +| +| Description : Release memory associated with the argument structure +| for the given fieldtype. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +void +_nc_Free_Argument(const FIELDTYPE * typ, TypeArgument * argp) +{ + if (!typ || !(typ->status & _HAS_ARGS)) + return; + + if (typ->status & _LINKED_TYPE) + { + assert(argp); + _nc_Free_Argument(typ->left ,argp->left ); + _nc_Free_Argument(typ->right,argp->right); + free(argp); + } + else + { + if (typ->freearg) + typ->freearg((void *)argp); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : bool _nc_Copy_Type( FIELD *dst, FIELD const *src ) +| +| Description : Copy argument structure of field src to field dst +| +| Return Values : TRUE - copy worked +| FALSE - error occured ++--------------------------------------------------------------------------*/ +bool +_nc_Copy_Type(FIELD *dst, FIELD const *src) +{ + int err = 0; + + assert(dst && src); + + dst->type = src->type; + dst->arg = (void *)_nc_Copy_Argument(src->type,(TypeArgument *)(src->arg),&err); + + if (err) + { + _nc_Free_Argument(dst->type,(TypeArgument *)(dst->arg)); + dst->type = (FIELDTYPE *)0; + dst->arg = (void *)0; + return FALSE; + } + else + { + if (dst->type) + dst->type->ref++; + return TRUE; + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : void _nc_Free_Type( FIELD *field ) +| +| Description : Release Argument structure for this field +| +| Return Values : - ++--------------------------------------------------------------------------*/ +void +_nc_Free_Type(FIELD *field) +{ + assert(field); + if (field->type) + field->type->ref--; + _nc_Free_Argument(field->type,(TypeArgument *)(field->arg)); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : FIELD *new_field( int rows, int cols, +| int frow, int fcol, +| int nrow, int nbuf ) +| +| Description : Create a new field with this many 'rows' and 'cols', +| starting at 'frow/fcol' in the subwindow of the form. +| Allocate 'nrow' off-screen rows and 'nbuf' additional +| buffers. If an error occurs, errno is set to +| +| E_BAD_ARGUMENT - invalid argument +| E_SYSTEM_ERROR - system error +| +| 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) +{ + FIELD *New_Field = (FIELD *)0; + int err = E_BAD_ARGUMENT; + + if (rows>0 && + cols>0 && + frow>=0 && + fcol>=0 && + nrow>=0 && + nbuf>=0 && + ((err = E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */ + (New_Field=(FIELD *)malloc(sizeof(FIELD))) ) + { + *New_Field = default_field; + New_Field->rows = rows; + New_Field->cols = cols; + New_Field->drows = rows + nrow; + New_Field->dcols = cols; + New_Field->frow = frow; + New_Field->fcol = fcol; + New_Field->nrow = nrow; + New_Field->nbuf = nbuf; + New_Field->link = New_Field; + + if (_nc_Copy_Type(New_Field,&default_field)) + { + size_t len; + + len = Total_Buffer_Size(New_Field); + if ((New_Field->buf = (char *)malloc(len))) + { + /* Prefill buffers with blanks and insert terminating zeroes + between buffers */ + int i; + + memset(New_Field->buf,' ',len); + for(i=0;i<=New_Field->nbuf;i++) + { + New_Field->buf[(New_Field->drows*New_Field->cols+1)*(i+1)-1] + = '\0'; + } + return New_Field; + } + } + } + + if (New_Field) + free_field(New_Field); + + SET_ERROR( err ); + return (FIELD *)0; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int free_field( FIELD *field ) +| +| Description : Frees the storage allocated for the field. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid field pointer +| E_CONNECTED - field is connected ++--------------------------------------------------------------------------*/ +int free_field(FIELD * field) +{ + if (!field) + RETURN(E_BAD_ARGUMENT); + + if (field->form) + RETURN(E_CONNECTED); + + if (field == field->link) + { + if (field->buf) + free(field->buf); + } + else + { + FIELD *f; + + for(f=field;f->link != field;f = f->link) + {} + f->link = field->link; + } + _nc_Free_Type(field); + free(field); + RETURN(E_OK); +} + +/* fld_def.c ends here */ diff --git a/contrib/ncurses/form/fld_dup.c b/contrib/ncurses/form/fld_dup.c new file mode 100644 index 000000000000..d265f958f218 --- /dev/null +++ b/contrib/ncurses/form/fld_dup.c @@ -0,0 +1,97 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_dup.c,v 1.4 1999/05/16 17:17:08 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : FIELD *dup_field(FIELD *field, int frow, int fcol) +| +| Description : Duplicates the field at the specified position. All +| field attributes and the buffers are copied. +| If an error occurs, errno is set to +| +| E_BAD_ARGUMENT - invalid argument +| E_SYSTEM_ERROR - system error +| +| Return Values : Pointer to the new field or NULL if failure ++--------------------------------------------------------------------------*/ +FIELD *dup_field(FIELD * field, int frow, int fcol) +{ + FIELD *New_Field = (FIELD *)0; + int err = E_BAD_ARGUMENT; + + if (field && (frow>=0) && (fcol>=0) && + ((err=E_SYSTEM_ERROR) != 0) && /* trick : this resets the default error */ + (New_Field=(FIELD *)malloc(sizeof(FIELD))) ) + { + *New_Field = *_nc_Default_Field; + New_Field->frow = frow; + New_Field->fcol = fcol; + New_Field->link = New_Field; + New_Field->rows = field->rows; + New_Field->cols = field->cols; + New_Field->nrow = field->nrow; + New_Field->drows = field->drows; + New_Field->dcols = field->dcols; + New_Field->maxgrow = field->maxgrow; + New_Field->nbuf = field->nbuf; + New_Field->just = field->just; + New_Field->fore = field->fore; + New_Field->back = field->back; + New_Field->pad = field->pad; + New_Field->opts = field->opts; + New_Field->usrptr = field->usrptr; + + if (_nc_Copy_Type(New_Field,field)) + { + size_t len; + + len = Total_Buffer_Size(New_Field); + if ( (New_Field->buf=(char *)malloc(len)) ) + { + memcpy(New_Field->buf,field->buf,len); + return New_Field; + } + } + } + + if (New_Field) + free_field(New_Field); + + SET_ERROR(err); + return (FIELD *)0; +} + +/* fld_dup.c ends here */ diff --git a/contrib/ncurses/form/fld_ftchoice.c b/contrib/ncurses/form/fld_ftchoice.c new file mode 100644 index 000000000000..8e7d2a9683f1 --- /dev/null +++ b/contrib/ncurses/form/fld_ftchoice.c @@ -0,0 +1,62 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_ftchoice.c,v 1.4 1999/05/16 17:17:21 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_fieldtype_choice( +| FIELDTYPE *typ, +| bool (* const next_choice)(FIELD *,const void *), +| bool (* const prev_choice)(FIELD *,const void *)) +| +| Description : Define implementation of enumeration requests. +| +| 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 *)) +{ + if ( !typ || !next_choice || !prev_choice ) + RETURN(E_BAD_ARGUMENT); + + typ->status |= _HAS_CHOICE; + typ->next = next_choice; + typ->prev = prev_choice; + RETURN(E_OK); +} + +/* fld_ftchoice.c ends here */ diff --git a/contrib/ncurses/form/fld_ftlink.c b/contrib/ncurses/form/fld_ftlink.c new file mode 100644 index 000000000000..1c30cab244a4 --- /dev/null +++ b/contrib/ncurses/form/fld_ftlink.c @@ -0,0 +1,83 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_ftlink.c,v 1.4 1999/05/16 17:17:33 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : FIELDTYPE *link_fieldtype( +| FIELDTYPE *type1, +| FIELDTYPE *type2) +| +| Description : Create a new fieldtype built from the two given types. +| They are connected by an logical 'OR'. +| If an error occurs, errno is set to +| E_BAD_ARGUMENT - invalid arguments +| E_SYSTEM_ERROR - system error (no memory) +| +| Return Values : Fieldtype pointer or NULL if error occured. ++--------------------------------------------------------------------------*/ +FIELDTYPE *link_fieldtype(FIELDTYPE * type1, FIELDTYPE * type2) +{ + FIELDTYPE *nftyp = (FIELDTYPE *)0; + + if ( type1 && type2 ) + { + nftyp = (FIELDTYPE *)malloc(sizeof(FIELDTYPE)); + if (nftyp) + { + *nftyp = *_nc_Default_FieldType; + nftyp->status |= _LINKED_TYPE; + if ((type1->status & _HAS_ARGS) || (type2->status & _HAS_ARGS) ) + nftyp->status |= _HAS_ARGS; + if ((type1->status & _HAS_CHOICE) || (type2->status & _HAS_CHOICE) ) + nftyp->status |= _HAS_CHOICE; + nftyp->left = type1; + nftyp->right = type2; + type1->ref++; + type2->ref++; + } + else + { + SET_ERROR( E_SYSTEM_ERROR ); + } + } + else + { + SET_ERROR( E_BAD_ARGUMENT ); + } + return nftyp; +} + +/* fld_ftlink.c ends here */ diff --git a/contrib/ncurses/form/fld_info.c b/contrib/ncurses/form/fld_info.c new file mode 100644 index 000000000000..98100a4f40a2 --- /dev/null +++ b/contrib/ncurses/form/fld_info.c @@ -0,0 +1,91 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_info.c,v 1.4 1999/05/16 17:17:52 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int field_info(const FIELD *field, +| int *rows, int *cols, +| int *frow, int *fcol, +| int *nrow, int *nbuf) +| +| Description : Retrieve infos about the fields creation parameters. +| +| 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) +{ + if (!field) + RETURN(E_BAD_ARGUMENT); + + if (rows) *rows = field->rows; + if (cols) *cols = field->cols; + if (frow) *frow = field->frow; + if (fcol) *fcol = field->fcol; + if (nrow) *nrow = field->nrow; + if (nbuf) *nbuf = field->nbuf; + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int dynamic_field_info(const FIELD *field, +| int *drows, int *dcols, +| int *maxgrow) +| +| Description : Retrieve informations about a dynamic fields current +| dynamic parameters. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid argument ++--------------------------------------------------------------------------*/ +int dynamic_field_info(const FIELD *field, + int *drows, int *dcols, int *maxgrow) +{ + if (!field) + RETURN(E_BAD_ARGUMENT); + + if (drows) *drows = field->drows; + if (dcols) *dcols = field->dcols; + if (maxgrow) *maxgrow = field->maxgrow; + + RETURN(E_OK); +} + +/* fld_info.c ends here */ diff --git a/contrib/ncurses/form/fld_just.c b/contrib/ncurses/form/fld_just.c new file mode 100644 index 000000000000..2a6dd38ec390 --- /dev/null +++ b/contrib/ncurses/form/fld_just.c @@ -0,0 +1,81 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_just.c,v 1.5 1999/05/16 17:18:06 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_just(FIELD *field, int just) +| +| Description : Set the fields type of justification. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - one of the arguments was incorrect +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int set_field_just(FIELD * field, int just) +{ + int res = E_BAD_ARGUMENT; + + if ((just==NO_JUSTIFICATION) || + (just==JUSTIFY_LEFT) || + (just==JUSTIFY_CENTER) || + (just==JUSTIFY_RIGHT) ) + { + Normalize_Field( field ); + if (field->just != just) + { + field->just = just; + res = _nc_Synchronize_Attributes( field ); + } + else + res = E_OK; + } + RETURN(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int field_just( const FIELD *field ) +| +| Description : Retrieve the fields type of justification +| +| Return Values : The justification type. ++--------------------------------------------------------------------------*/ +int field_just(const FIELD * field) +{ + return Normalize_Field( field )->just; +} + +/* fld_just.c ends here */ diff --git a/contrib/ncurses/form/fld_link.c b/contrib/ncurses/form/fld_link.c new file mode 100644 index 000000000000..4352d6abf083 --- /dev/null +++ b/contrib/ncurses/form/fld_link.c @@ -0,0 +1,90 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_link.c,v 1.4 1999/05/16 17:18:18 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : FIELD *link_field(FIELD *field, int frow, int fcol) +| +| Description : Duplicates the field at the specified position. The +| new field shares its buffers with the original one, +| the attributes are independent. +| If an error occurs, errno is set to +| +| E_BAD_ARGUMENT - invalid argument +| E_SYSTEM_ERROR - system error +| +| Return Values : Pointer to the new field or NULL if failure ++--------------------------------------------------------------------------*/ +FIELD *link_field(FIELD * field, int frow, int fcol) +{ + FIELD *New_Field = (FIELD *)0; + int err = E_BAD_ARGUMENT; + + if (field && (frow>=0) && (fcol>=0) && + ((err=E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */ + (New_Field = (FIELD *)malloc(sizeof(FIELD))) ) + { + *New_Field = *_nc_Default_Field; + New_Field->frow = frow; + New_Field->fcol = fcol; + New_Field->link = field->link; + field->link = New_Field; + New_Field->buf = field->buf; + New_Field->rows = field->rows; + New_Field->cols = field->cols; + New_Field->nrow = field->nrow; + New_Field->nbuf = field->nbuf; + New_Field->drows = field->drows; + New_Field->dcols = field->dcols; + New_Field->maxgrow= field->maxgrow; + New_Field->just = field->just; + New_Field->fore = field->fore; + New_Field->back = field->back; + New_Field->pad = field->pad; + New_Field->opts = field->opts; + New_Field->usrptr = field->usrptr; + if (_nc_Copy_Type(New_Field,field)) + return New_Field; + } + + if (New_Field) + free_field(New_Field); + + SET_ERROR( err ); + return (FIELD *)0; +} + +/* fld_link.c ends here */ diff --git a/contrib/ncurses/form/fld_max.c b/contrib/ncurses/form/fld_max.c new file mode 100644 index 000000000000..f17bcec5a478 --- /dev/null +++ b/contrib/ncurses/form/fld_max.c @@ -0,0 +1,74 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_max.c,v 1.4 1999/05/16 17:18:34 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_max_field(FIELD *field, int maxgrow) +| +| Description : Set the maximum growth for a dynamic field. If maxgrow=0 +| the field may grow to any possible size. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid argument ++--------------------------------------------------------------------------*/ +int set_max_field(FIELD *field, int maxgrow) +{ + if (!field || (maxgrow<0)) + RETURN(E_BAD_ARGUMENT); + else + { + bool single_line_field = Single_Line_Field(field); + + if (maxgrow>0) + { + if (( single_line_field && (maxgrow < field->dcols)) || + (!single_line_field && (maxgrow < field->drows))) + RETURN(E_BAD_ARGUMENT); + } + field->maxgrow = maxgrow; + field->status &= ~_MAY_GROW; + if (!(field->opts & O_STATIC)) + { + if ((maxgrow==0) || + ( single_line_field && (field->dcols < maxgrow)) || + (!single_line_field && (field->drows < maxgrow))) + field->status |= _MAY_GROW; + } + } + RETURN(E_OK); +} + +/* fld_max.c ends here */ diff --git a/contrib/ncurses/form/fld_move.c b/contrib/ncurses/form/fld_move.c new file mode 100644 index 000000000000..7965d5afbea8 --- /dev/null +++ b/contrib/ncurses/form/fld_move.c @@ -0,0 +1,62 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_move.c,v 1.4 1999/05/16 17:38:51 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int move_field(FIELD *field,int frow, int fcol) +| +| Description : Moves the disconnected field to the new location in +| the forms subwindow. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid argument passed +| E_CONNECTED - field is connected ++--------------------------------------------------------------------------*/ +int move_field(FIELD *field, int frow, int fcol) +{ + if ( !field || (frow<0) || (fcol<0) ) + RETURN(E_BAD_ARGUMENT); + + if (field->form) + RETURN(E_CONNECTED); + + field->frow = frow; + field->fcol = fcol; + RETURN(E_OK); +} + +/* fld_move.c ends here */ + diff --git a/contrib/ncurses/form/fld_newftyp.c b/contrib/ncurses/form/fld_newftyp.c new file mode 100644 index 000000000000..68b1692a2ab8 --- /dev/null +++ b/contrib/ncurses/form/fld_newftyp.c @@ -0,0 +1,125 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_newftyp.c,v 1.5 1999/05/16 17:18:54 juergen Exp $") + +static FIELDTYPE const default_fieldtype = { + 0, /* status */ + 0L, /* reference count */ + (FIELDTYPE *)0, /* pointer to left operand */ + (FIELDTYPE *)0, /* pointer to right operand */ + NULL, /* makearg function */ + NULL, /* copyarg function */ + NULL, /* freearg function */ + NULL, /* field validation function */ + NULL, /* Character check function */ + NULL, /* enumerate next function */ + NULL /* enumerate previous function */ +}; + +const FIELDTYPE* _nc_Default_FieldType = &default_fieldtype; + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : FIELDTYPE *new_fieldtype( +| bool (* const field_check)(FIELD *,const void *), +| bool (* const char_check) (int, const void *) ) +| +| Description : Create a new fieldtype. The application programmer must +| write a field_check and a char_check function and give +| them as input to this call. +| If an error occurs, errno is set to +| E_BAD_ARGUMENT - invalid arguments +| E_SYSTEM_ERROR - system error (no memory) +| +| Return Values : Fieldtype pointer or NULL if error occured ++--------------------------------------------------------------------------*/ +FIELDTYPE *new_fieldtype( + bool (* const field_check)(FIELD *,const void *), + bool (* const char_check) (int,const void *) ) +{ + FIELDTYPE *nftyp = (FIELDTYPE *)0; + + if ( (field_check) || (char_check) ) + { + nftyp = (FIELDTYPE *)malloc(sizeof(FIELDTYPE)); + if (nftyp) + { + *nftyp = default_fieldtype; + nftyp->fcheck = field_check; + nftyp->ccheck = char_check; + } + else + { + SET_ERROR( E_SYSTEM_ERROR ); + } + } + else + { + SET_ERROR( E_BAD_ARGUMENT ); + } + return nftyp; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int free_fieldtype(FIELDTYPE *typ) +| +| Description : Release the memory associated with this fieldtype. +| +| Return Values : E_OK - success +| E_CONNECTED - there are fields referencing the type +| E_BAD_ARGUMENT - invalid fieldtype pointer ++--------------------------------------------------------------------------*/ +int free_fieldtype(FIELDTYPE *typ) +{ + if (!typ) + RETURN(E_BAD_ARGUMENT); + + if (typ->ref!=0) + RETURN(E_CONNECTED); + + if (typ->status & _RESIDENT) + RETURN(E_CONNECTED); + + if (typ->status & _LINKED_TYPE) + { + if (typ->left ) typ->left->ref--; + if (typ->right) typ->right->ref--; + } + free(typ); + RETURN(E_OK); +} + +/* fld_newftyp.c ends here */ diff --git a/contrib/ncurses/form/fld_opts.c b/contrib/ncurses/form/fld_opts.c new file mode 100644 index 000000000000..e5cd996d06b5 --- /dev/null +++ b/contrib/ncurses/form/fld_opts.c @@ -0,0 +1,124 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: fld_opts.c,v 1.6 1999/05/16 17:19:06 juergen Exp $") + +/*---------------------------------------------------------------------------- + Field-Options manipulation routines + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_opts(FIELD *field, Field_Options opts) +| +| Description : Turns on the named options for this field and turns +| off all the remaining options. +| +| Return Values : E_OK - success +| E_CURRENT - the field is the current field +| E_BAD_ARGUMENT - invalid options +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int set_field_opts(FIELD * field, Field_Options opts) +{ + int res = E_BAD_ARGUMENT; + opts &= ALL_FIELD_OPTS; + if (!(opts & ~ALL_FIELD_OPTS)) + res = _nc_Synchronize_Options( Normalize_Field(field), opts ); + RETURN(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : Field_Options field_opts(const FIELD *field) +| +| Description : Retrieve the fields options. +| +| Return Values : The options. ++--------------------------------------------------------------------------*/ +Field_Options field_opts(const FIELD * field) +{ + return ALL_FIELD_OPTS & Normalize_Field( field )->opts; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int field_opts_on(FIELD *field, Field_Options opts) +| +| Description : Turns on the named options for this field and all the +| remaining options are unchanged. +| +| Return Values : E_OK - success +| E_CURRENT - the field is the current field +| E_BAD_ARGUMENT - invalid options +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int field_opts_on(FIELD * field, Field_Options opts) +{ + int res = E_BAD_ARGUMENT; + + opts &= ALL_FIELD_OPTS; + if (!(opts & ~ALL_FIELD_OPTS)) + { + Normalize_Field( field ); + res = _nc_Synchronize_Options( field, field->opts | opts ); + } + RETURN(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int field_opts_off(FIELD *field, Field_Options opts) +| +| Description : Turns off the named options for this field and all the +| remaining options are unchanged. +| +| Return Values : E_OK - success +| E_CURRENT - the field is the current field +| E_BAD_ARGUMENT - invalid options +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int field_opts_off(FIELD * field, Field_Options opts) +{ + int res = E_BAD_ARGUMENT; + + opts &= ALL_FIELD_OPTS; + if (!(opts & ~ALL_FIELD_OPTS)) + { + Normalize_Field( field ); + res = _nc_Synchronize_Options( field, field->opts & ~opts ); + } + RETURN(res); +} + +/* fld_opts.c ends here */ diff --git a/contrib/ncurses/form/fld_pad.c b/contrib/ncurses/form/fld_pad.c new file mode 100644 index 000000000000..527e151198b7 --- /dev/null +++ b/contrib/ncurses/form/fld_pad.c @@ -0,0 +1,78 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: fld_pad.c,v 1.4 1999/05/16 17:38:58 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_pad(FIELD *field, int ch) +| +| Description : Set the pad character used to fill the field. This must +| be a printable character. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid field pointer or pad character +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int set_field_pad(FIELD * field, int ch) +{ + int res = E_BAD_ARGUMENT; + + Normalize_Field( field ); + if (isprint((unsigned char)ch)) + { + if (field->pad != ch) + { + field->pad = ch; + res = _nc_Synchronize_Attributes( field ); + } + else + res = E_OK; + } + RETURN(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int field_pad(const FIELD *field) +| +| Description : Retrieve the fields pad character. +| +| Return Values : The pad character. ++--------------------------------------------------------------------------*/ +int field_pad(const FIELD * field) +{ + return Normalize_Field( field )->pad; +} + +/* fld_pad.c ends here */ diff --git a/contrib/ncurses/form/fld_page.c b/contrib/ncurses/form/fld_page.c new file mode 100644 index 000000000000..452a507cca78 --- /dev/null +++ b/contrib/ncurses/form/fld_page.c @@ -0,0 +1,76 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_page.c,v 1.4 1999/05/16 17:19:37 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_new_page(FIELD *field, bool new_page_flag) +| +| Description : Marks the field as the beginning of a new page of +| the form. +| +| Return Values : E_OK - success +| E_CONNECTED - field is connected ++--------------------------------------------------------------------------*/ +int set_new_page(FIELD * field, bool new_page_flag) +{ + Normalize_Field(field); + if (field->form) + RETURN(E_CONNECTED); + + if (new_page_flag) + field->status |= _NEWPAGE; + else + field->status &= ~_NEWPAGE; + + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : bool new_page(const FIELD *field) +| +| Description : Retrieve the info whether or not the field starts a +| new page on the form. +| +| Return Values : TRUE - field starts a new page +| FALSE - field doesn't start a new page ++--------------------------------------------------------------------------*/ +bool new_page(const FIELD * field) +{ + return (Normalize_Field(field)->status & _NEWPAGE) ? TRUE : FALSE; +} + +/* fld_page.c ends here */ diff --git a/contrib/ncurses/form/fld_stat.c b/contrib/ncurses/form/fld_stat.c new file mode 100644 index 000000000000..98144bf2f1c4 --- /dev/null +++ b/contrib/ncurses/form/fld_stat.c @@ -0,0 +1,73 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_stat.c,v 1.6 1999/05/16 17:19:48 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_status(FIELD *field, bool status) +| +| Description : Set or clear the 'changed' indication flag for that +| fields primary buffer. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +int set_field_status(FIELD * field, bool status) +{ + Normalize_Field( field ); + + if (status) + field->status |= _CHANGED; + else + field->status &= ~_CHANGED; + + return(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : bool field_status(const FIELD *field) +| +| Description : Retrieve the value of the 'changed' indication flag +| for that fields primary buffer. +| +| Return Values : TRUE - buffer has been changed +| FALSE - buffer has not been changed ++--------------------------------------------------------------------------*/ +bool field_status(const FIELD * field) +{ + return ((Normalize_Field(field)->status & _CHANGED) ? TRUE : FALSE); +} + +/* fld_stat.c ends here */ diff --git a/contrib/ncurses/form/fld_type.c b/contrib/ncurses/form/fld_type.c new file mode 100644 index 000000000000..238b54747809 --- /dev/null +++ b/contrib/ncurses/form/fld_type.c @@ -0,0 +1,92 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_type.c,v 1.9 1999/05/16 17:19:59 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_type(FIELD *field, FIELDTYPE *type,...) +| +| Description : Associate the specified fieldtype with the field. +| Certain field types take additional arguments. Look +| at the spec of the field types ! +| +| Return Values : E_OK - success +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int set_field_type(FIELD *field,FIELDTYPE *type, ...) +{ + va_list ap; + int res = E_SYSTEM_ERROR; + int err = 0; + + va_start(ap,type); + + Normalize_Field(field); + _nc_Free_Type(field); + + field->type = type; + field->arg = (void *)_nc_Make_Argument(field->type,&ap,&err); + + if (err) + { + _nc_Free_Argument(field->type,(TypeArgument *)(field->arg)); + field->type = (FIELDTYPE *)0; + field->arg = (void *)0; + } + else + { + res = E_OK; + if (field->type) + field->type->ref++; + } + + va_end(ap); + RETURN(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : FIELDTYPE *field_type(const FIELD *field) +| +| Description : Retrieve the associated fieldtype for this field. +| +| Return Values : Pointer to fieldtype of NULL if none is defined. ++--------------------------------------------------------------------------*/ +FIELDTYPE *field_type(const FIELD * field) +{ + return Normalize_Field(field)->type; +} + +/* fld_type.c ends here */ diff --git a/contrib/ncurses/form/fld_user.c b/contrib/ncurses/form/fld_user.c new file mode 100644 index 000000000000..cf5b4c291048 --- /dev/null +++ b/contrib/ncurses/form/fld_user.c @@ -0,0 +1,67 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_user.c,v 1.8 1999/05/16 17:20:09 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_userptr(FIELD *field, void *usrptr) +| +| Description : Set the pointer that is reserved in any field to store +| application relevant informations +| +| Return Values : E_OK - on success ++--------------------------------------------------------------------------*/ +int set_field_userptr(FIELD * field, void *usrptr) +{ + Normalize_Field( field )->usrptr = usrptr; + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : void *field_userptr(const FIELD *field) +| +| Description : Return the pointer that is reserved in any field to +| store application relevant informations. +| +| Return Values : Value of pointer. If no such pointer has been set, +| NULL is returned ++--------------------------------------------------------------------------*/ +void *field_userptr(const FIELD *field) +{ + return Normalize_Field( field )->usrptr; +} + +/* fld_user.c ends here */ diff --git a/contrib/ncurses/form/form.h b/contrib/ncurses/form/form.h new file mode 100644 index 000000000000..40ae0a35f02f --- /dev/null +++ b/contrib/ncurses/form/form.h @@ -0,0 +1,388 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#ifndef FORM_H +#define FORM_H + +#include <curses.h> +#include <eti.h> + +#ifdef __cplusplus + extern "C" { +#endif + +typedef int Form_Options; +typedef int Field_Options; + + /********** + * _PAGE * + **********/ + +typedef struct { + short pmin; /* index of first field on page */ + short pmax; /* index of last field on page */ + short smin; /* index of top leftmost field on page */ + short smax; /* index of bottom rightmost field on page */ +} _PAGE; + + /********** + * FIELD * + **********/ + +typedef struct fieldnode { + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + short frow; /* first row */ + short fcol; /* first col */ + int drows; /* dynamic rows */ + int dcols; /* dynamic cols */ + int maxgrow; /* maximum field growth */ + int nrow; /* offscreen rows */ + short nbuf; /* additional buffers */ + short just; /* justification */ + short page; /* page on form */ + short index; /* into form -> field */ + int pad; /* pad character */ + chtype fore; /* foreground attribute */ + chtype back; /* background attribute */ + Field_Options opts; /* options */ + struct fieldnode * snext; /* sorted order pointer */ + struct fieldnode * sprev; /* sorted order pointer */ + struct fieldnode * link; /* linked field chain */ + struct formnode * form; /* containing form */ + struct typenode * type; /* field type */ + void * arg; /* argument for type */ + char * buf; /* field buffers */ + void * usrptr; /* user pointer */ +} FIELD; + + /************** + * FIELDTYPE * + **************/ + +typedef struct typenode { + unsigned short status; /* flags */ + long ref; /* reference count */ + struct typenode * left; /* ptr to operand for | */ + struct typenode * right; /* ptr to operand for | */ + + void* (*makearg)(va_list *); /* make fieldtype arg */ + void* (*copyarg)(const void *); /* copy fieldtype arg */ + void (*freearg)(void *); /* free fieldtype arg */ + + bool (*fcheck)(FIELD *,const void *); /* field validation */ + bool (*ccheck)(int,const void *); /* character validation */ + + bool (*next)(FIELD *,const void *); /* enumerate next value */ + bool (*prev)(FIELD *,const void *); /* enumerate prev value */ + +} FIELDTYPE; + + /********* + * FORM * + *********/ + +typedef struct formnode { + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + int currow; /* current row in field window*/ + int curcol; /* current col in field window*/ + int toprow; /* in scrollable field window */ + int begincol; /* in horiz. scrollable field */ + short maxfield; /* number of fields */ + short maxpage; /* number of pages */ + short curpage; /* index into page */ + Form_Options opts; /* options */ + WINDOW * win; /* window */ + WINDOW * sub; /* subwindow */ + WINDOW * w; /* window for current field */ + FIELD ** field; /* field [maxfield] */ + FIELD * current; /* current field */ + _PAGE * page; /* page [maxpage] */ + void * usrptr; /* user pointer */ + + void (*forminit)(struct formnode *); + void (*formterm)(struct formnode *); + void (*fieldinit)(struct formnode *); + void (*fieldterm)(struct formnode *); + +} FORM; + +typedef void (*Form_Hook)(FORM *); + + /*************************** + * miscellaneous #defines * + ***************************/ + +/* field justification */ +#define NO_JUSTIFICATION (0) +#define JUSTIFY_LEFT (1) +#define JUSTIFY_CENTER (2) +#define JUSTIFY_RIGHT (3) + +/* field options */ +#define O_VISIBLE (0x0001) +#define O_ACTIVE (0x0002) +#define O_PUBLIC (0x0004) +#define O_EDIT (0x0008) +#define O_WRAP (0x0010) +#define O_BLANK (0x0020) +#define O_AUTOSKIP (0x0040) +#define O_NULLOK (0x0080) +#define O_PASSOK (0x0100) +#define O_STATIC (0x0200) + +/* form options */ +#define O_NL_OVERLOAD (0x0001) +#define O_BS_OVERLOAD (0x0002) + +/* form driver commands */ +#define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */ +#define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */ +#define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */ +#define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */ + +#define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */ +#define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */ +#define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */ +#define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */ +#define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */ +#define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */ +#define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */ +#define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */ +#define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */ +#define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */ +#define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */ +#define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */ + +#define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */ +#define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */ +#define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */ +#define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */ +#define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */ +#define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */ +#define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */ +#define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */ +#define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */ +#define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */ +#define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */ +#define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */ +#define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */ +#define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */ + +#define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */ +#define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */ +#define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */ +#define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */ +#define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */ +#define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */ +#define REQ_DEL_WORD (KEY_MAX + 37) /* delete line at cursor */ +#define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */ +#define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */ +#define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */ +#define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */ +#define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */ +#define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */ +#define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */ +#define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */ +#define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */ +#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */ +#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */ +#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */ +#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */ +#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */ +#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */ +#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */ +#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */ + +#define REQ_VALIDATION (KEY_MAX + 55) /* validate field */ +#define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */ +#define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */ + +#define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */ +#define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */ + +#if defined(MAX_COMMAND) +# if (MAX_FORM_COMMAND > MAX_COMMAND) +# error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND +# elif (MAX_COMMAND != (KEY_MAX + 128)) +# error Something is wrong -- MAX_COMMAND is already inconsistently defined. +# endif +#else +# define MAX_COMMAND (KEY_MAX + 128) +#endif + + /************************* + * standard field types * + *************************/ +extern FIELDTYPE *TYPE_ALPHA, + *TYPE_ALNUM, + *TYPE_ENUM, + *TYPE_INTEGER, + *TYPE_NUMERIC, + *TYPE_REGEXP; + + /************************************ + * built-in additional field types * + * They are not defined in SVr4 * + ************************************/ +extern FIELDTYPE *TYPE_IPV4; /* Internet IP Version 4 address */ + + /*********************** + * Default objects * + ***********************/ +extern FORM *_nc_Default_Form; +extern FIELD *_nc_Default_Field; + + + /*********************** + * FIELDTYPE routines * + ***********************/ +extern 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 *, + void * (* const make_arg)(va_list *), + void * (* const copy_arg)(const void *), + void (* const free_arg)(void *)), + 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 *); + + /****************** + * 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 *); + +#ifdef __cplusplus + } +#endif + +#endif /* FORM_H */ diff --git a/contrib/ncurses/form/form.priv.h b/contrib/ncurses/form/form.priv.h new file mode 100644 index 000000000000..886121c94cd8 --- /dev/null +++ b/contrib/ncurses/form/form.priv.h @@ -0,0 +1,128 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "mf_common.h" +#include "form.h" + +/* form status values */ +#define _OVLMODE (0x04) /* Form is in overlay mode */ +#define _WINDOW_MODIFIED (0x10) /* Current field window has been modified */ +#define _FCHECK_REQUIRED (0x20) /* Current field needs validation */ + +/* field status values */ +#define _CHANGED (0x01) /* Field has been changed */ +#define _NEWTOP (0x02) /* Vertical scrolling occured */ +#define _NEWPAGE (0x04) /* field begins new page of form */ +#define _MAY_GROW (0x08) /* dynamic field may still grow */ + +/* fieldtype status values */ +#define _LINKED_TYPE (0x01) /* Type is a linked type */ +#define _HAS_ARGS (0x02) /* Type has arguments */ +#define _HAS_CHOICE (0x04) /* Type has choice methods */ +#define _RESIDENT (0x08) /* Type is builtin */ + +/* This are the field options required to be a selectable field in field + navigation requests */ +#define O_SELECTABLE (O_ACTIVE | O_VISIBLE) + +/* If form is NULL replace form argument by default-form */ +#define Normalize_Form(form) ((form)=(form)?(form):_nc_Default_Form) + +/* If field is NULL replace field argument by default-field */ +#define Normalize_Field(field) ((field)=(field)?(field):_nc_Default_Field) + +/* Retrieve forms window */ +#define Get_Form_Window(form) \ + ((form)->sub?(form)->sub:((form)->win?(form)->win:stdscr)) + +/* Calculate the size for a single buffer for this field */ +#define Buffer_Length(field) ((field)->drows * (field)->dcols) + +/* Calculate the total size of all buffers for this field */ +#define Total_Buffer_Size(field) \ + ( (Buffer_Length(field) + 1) * (1+(field)->nbuf) ) + +/* Logic to determine whether or not a field is single lined */ +#define Single_Line_Field(field) \ + (((field)->rows + (field)->nrow) == 1) + +/* Logic to determine whether or not a field is selectable */ +#define Field_Is_Selectable(f) (((f)->opts & O_SELECTABLE)==O_SELECTABLE) +#define Field_Is_Not_Selectable(f) (((f)->opts & O_SELECTABLE)!=O_SELECTABLE) + +typedef struct typearg { + struct typearg *left; + struct typearg *right; +} TypeArgument; + +/* This is a dummy request code (normally invalid) to be used internally + with the form_driver() routine to position to the first active field + on the form +*/ +#define FIRST_ACTIVE_MAGIC (-291056) + +#define ALL_FORM_OPTS ( \ + O_NL_OVERLOAD |\ + O_BS_OVERLOAD ) + +#define ALL_FIELD_OPTS ( \ + O_VISIBLE |\ + O_ACTIVE |\ + O_PUBLIC |\ + O_EDIT |\ + O_WRAP |\ + O_BLANK |\ + O_AUTOSKIP|\ + O_NULLOK |\ + O_PASSOK |\ + O_STATIC ) + + +#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*); diff --git a/contrib/ncurses/form/frm_cursor.c b/contrib/ncurses/form/frm_cursor.c new file mode 100644 index 000000000000..96ad2d60693e --- /dev/null +++ b/contrib/ncurses/form/frm_cursor.c @@ -0,0 +1,66 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: frm_cursor.c,v 1.4 1999/05/16 17:20:19 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int pos_form_cursor(FORM * form) +| +| Description : Moves the form window cursor to the location required +| by the form driver to resume form processing. This may +| be needed after the application calls a curses library +| I/O routine that modifies the cursor position. +| +| Return Values : E_OK - Success +| E_SYSTEM_ERROR - System error. +| E_BAD_ARGUMENT - Invalid form pointer +| E_NOT_POSTED - Form is not posted ++--------------------------------------------------------------------------*/ +int pos_form_cursor(FORM * form) +{ + int res; + + if (!form) + res = E_BAD_ARGUMENT; + else + { + if (!(form->status & _POSTED)) + res = E_NOT_POSTED; + else + res = _nc_Position_Form_Cursor(form); + } + RETURN(res); +} + +/* frm_cursor.c ends here */ diff --git a/contrib/ncurses/form/frm_data.c b/contrib/ncurses/form/frm_data.c new file mode 100644 index 000000000000..e90f5a17ec4d --- /dev/null +++ b/contrib/ncurses/form/frm_data.c @@ -0,0 +1,181 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_data.c,v 1.6 1999/05/16 17:20:29 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : bool data_behind(const FORM *form) +| +| Description : Check for off-screen data behind. This is nearly trivial +| becose the begin of a field is fixed. +| +| Return Values : TRUE - there are off-screen data behind +| FALSE - there are no off-screen data behind ++--------------------------------------------------------------------------*/ +bool data_behind(const FORM *form) +{ + bool result = FALSE; + + if (form && (form->status & _POSTED) && form->current) + { + FIELD *field; + + field = form->current; + if (!Single_Line_Field(field)) + { + result = (form->toprow==0) ? FALSE : TRUE; + } + else + { + result = (form->begincol==0) ? FALSE : TRUE; + } + } + return(result); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static char * After_Last_Non_Pad_Position( +| char *buffer, +| int len, +| int pad) +| +| Description : Find the last position in the buffer that doesn't +| contain a padding character. +| +| Return Values : The pointer to this position ++--------------------------------------------------------------------------*/ +INLINE +static char * After_Last_Non_Pad_Position(char *buffer, int len, int pad) +{ + char *end = buffer + len; + + assert(buffer && len>=0); + while ( (buffer < end) && (*(end-1)==pad) ) + end--; + + return end; +} + +#define SMALL_BUFFER_SIZE (80) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : bool data_ahead(const FORM *form) +| +| Description : Check for off-screen data ahead. This is more difficult +| because a dynamic field has a variable end. +| +| Return Values : TRUE - there are off-screen data ahead +| FALSE - there are no off-screen data ahead ++--------------------------------------------------------------------------*/ +bool data_ahead(const FORM *form) +{ + bool result = FALSE; + + if (form && (form->status & _POSTED) && form->current) + { + static char buffer[SMALL_BUFFER_SIZE + 1]; + FIELD *field; + bool large_buffer; + bool cursor_moved = FALSE; + char *bp; + char *found_content; + int pos; + + field = form->current; + assert(form->w); + + large_buffer = (field->cols > SMALL_BUFFER_SIZE); + if (large_buffer) + bp = (char *)malloc((size_t)(field->cols) + 1); + else + bp = buffer; + + assert(bp); + + if (Single_Line_Field(field)) + { + int check_len; + + pos = form->begincol + field->cols; + while (pos < field->dcols) + { + check_len = field->dcols - pos; + if ( check_len >= field->cols ) + check_len = field->cols; + cursor_moved = TRUE; + wmove(form->w,0,pos); + winnstr(form->w,bp,check_len); + found_content = + After_Last_Non_Pad_Position(bp,check_len,field->pad); + if (found_content==bp) + pos += field->cols; + else + { + result = TRUE; + break; + } + } + } + else + { + pos = form->toprow + field->rows; + while (pos < field->drows) + { + cursor_moved = TRUE; + wmove(form->w,pos,0); + pos++; + winnstr(form->w,bp,field->cols); + found_content = + After_Last_Non_Pad_Position(bp,field->cols,field->pad); + if (found_content!=bp) + { + result = TRUE; + break; + } + } + } + + if (large_buffer) + free(bp); + + if (cursor_moved) + wmove(form->w,form->currow,form->curcol); + } + return(result); +} + +/* frm_data.c ends here */ diff --git a/contrib/ncurses/form/frm_def.c b/contrib/ncurses/form/frm_def.c new file mode 100644 index 000000000000..34be5fe7ca9c --- /dev/null +++ b/contrib/ncurses/form/frm_def.c @@ -0,0 +1,376 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_def.c,v 1.9 1999/05/16 17:20:43 juergen Exp $") + +/* this can't be readonly */ +static FORM default_form = { + 0, /* status */ + 0, /* rows */ + 0, /* cols */ + 0, /* currow */ + 0, /* curcol */ + 0, /* toprow */ + 0, /* begincol */ + -1, /* maxfield */ + -1, /* maxpage */ + -1, /* curpage */ + ALL_FORM_OPTS, /* opts */ + (WINDOW *)0, /* win */ + (WINDOW *)0, /* sub */ + (WINDOW *)0, /* w */ + (FIELD **)0, /* field */ + (FIELD *)0, /* current */ + (_PAGE *)0, /* page */ + (char *)0, /* usrptr */ + NULL, /* forminit */ + NULL, /* formterm */ + NULL, /* fieldinit */ + NULL /* fieldterm */ +}; + +FORM *_nc_Default_Form = &default_form; + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static FIELD *Insert_Field_By_Position( +| FIELD *new_field, +| FIELD *head ) +| +| Description : Insert new_field into sorted fieldlist with head "head" +| and return new head of sorted fieldlist. Sorting +| criteria is (row,column). This is a circular list. +| +| Return Values : New head of sorted fieldlist ++--------------------------------------------------------------------------*/ +static FIELD *Insert_Field_By_Position(FIELD *newfield, FIELD *head) +{ + FIELD *current, *newhead; + + assert(newfield); + + if (!head) + { /* empty list is trivial */ + newhead = newfield->snext = newfield->sprev = newfield; + } + else + { + newhead = current = head; + while((current->frow < newfield->frow) || + ((current->frow==newfield->frow) && + (current->fcol < newfield->fcol)) ) + { + current = current->snext; + if (current==head) + { /* We cycled through. Reset head to indicate that */ + head = (FIELD *)0; + break; + } + } + /* we leave the loop with current pointing to the field after newfield*/ + newfield->snext = current; + newfield->sprev = current->sprev; + newfield->snext->sprev = newfield; + newfield->sprev->snext = newfield; + if (current==head) + newhead = newfield; + } + return(newhead); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Disconnect_Fields(FORM *form) +| +| Description : Break association between form and array of fields. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +static void Disconnect_Fields( FORM * form ) +{ + if (form->field) + { + FIELD **fields; + + for(fields=form->field;*fields;fields++) + { + if (form == (*fields)->form) + (*fields)->form = (FORM *)0; + } + + form->rows = form->cols = 0; + form->maxfield = form->maxpage = -1; + form->field = (FIELD **)0; + if (form->page) + free(form->page); + form->page = (_PAGE *)0; + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Connect_Fields(FORM *form, FIELD **fields) +| +| Description : Set association between form and array of fields. +| +| Return Values : E_OK - no error +| E_CONNECTED - a field is already connected +| E_BAD_ARGUMENT - Invalid form pointer or field array +| E_SYSTEM_ERROR - not enough memory ++--------------------------------------------------------------------------*/ +static int Connect_Fields(FORM * form, FIELD ** fields) +{ + int field_cnt, j; + int page_nr; + int maximum_row_in_field, maximum_col_in_field; + _PAGE *pg; + + assert(form); + + form->field = fields; + form->maxfield = 0; + form->maxpage = 0; + + if (!fields) + RETURN(E_OK); + + page_nr = 0; + /* store formpointer in fields and count pages */ + for(field_cnt=0;fields[field_cnt];field_cnt++) + { + if (fields[field_cnt]->form) + RETURN(E_CONNECTED); + if ( field_cnt==0 || + (fields[field_cnt]->status & _NEWPAGE)) + page_nr++; + fields[field_cnt]->form = form; + } + if (field_cnt==0) + RETURN(E_BAD_ARGUMENT); + + /* allocate page structures */ + if ( (pg = (_PAGE *)malloc(page_nr * sizeof(_PAGE))) != (_PAGE *)0 ) + { + form->page = pg; + } + else + RETURN(E_SYSTEM_ERROR); + + /* Cycle through fields and calculate page boundaries as well as + size of the form */ + for(j=0;j<field_cnt;j++) + { + if (j==0) + pg->pmin = j; + else + { + if (fields[j]->status & _NEWPAGE) + { + pg->pmax = j-1; + pg++; + pg->pmin = j; + } + } + + maximum_row_in_field = fields[j]->frow + fields[j]->rows; + maximum_col_in_field = fields[j]->fcol + fields[j]->cols; + + if (form->rows < maximum_row_in_field) + form->rows = maximum_row_in_field; + if (form->cols < maximum_col_in_field) + form->cols = maximum_col_in_field; + } + + pg->pmax = field_cnt-1; + form->maxfield = field_cnt; + form->maxpage = page_nr; + + /* Sort fields on form pages */ + for(page_nr = 0;page_nr < form->maxpage; page_nr++) + { + FIELD *fld = (FIELD *)0; + for(j = form->page[page_nr].pmin;j <= form->page[page_nr].pmax;j++) + { + fields[j]->index = j; + fields[j]->page = page_nr; + fld = Insert_Field_By_Position(fields[j],fld); + } + form->page[page_nr].smin = fld->index; + form->page[page_nr].smax = fld->sprev->index; + } + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Associate_Fields(FORM *form, FIELD **fields) +| +| Description : Set association between form and array of fields. +| If there are fields, position to first active field. +| +| Return Values : E_OK - success +| any other - error occured ++--------------------------------------------------------------------------*/ +INLINE static int Associate_Fields(FORM *form, FIELD **fields) +{ + int res = Connect_Fields(form,fields); + if (res == E_OK) + { + if (form->maxpage>0) + { + form->curpage = 0; + form_driver(form,FIRST_ACTIVE_MAGIC); + } + else + { + form->curpage = -1; + form->current = (FIELD *)0; + } + } + return(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : FORM *new_form( FIELD **fields ) +| +| Description : Create new form with given array of fields. +| +| Return Values : Pointer to form. NULL if error occured. ++--------------------------------------------------------------------------*/ +FORM *new_form(FIELD ** fields) +{ + int err = E_SYSTEM_ERROR; + + FORM *form = (FORM *)malloc(sizeof(FORM)); + + if (form) + { + *form = *_nc_Default_Form; + if ((err=Associate_Fields(form,fields))!=E_OK) + { + free_form(form); + form = (FORM *)0; + } + } + + if (!form) + SET_ERROR(err); + + return(form); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int free_form( FORM *form ) +| +| Description : Release internal memory associated with form. +| +| Return Values : E_OK - no error +| E_BAD_ARGUMENT - invalid form pointer +| E_POSTED - form is posted ++--------------------------------------------------------------------------*/ +int free_form(FORM * form) +{ + if ( !form ) + RETURN(E_BAD_ARGUMENT); + + if ( form->status & _POSTED) + RETURN(E_POSTED); + + Disconnect_Fields( form ); + if (form->page) + free(form->page); + free(form); + + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_form_fields( FORM *form, FIELD **fields ) +| +| Description : Set a new association of an array of fields to a form +| +| Return Values : E_OK - no error +| E_BAD_ARGUMENT - invalid form pointer +| E_POSTED - form is posted ++--------------------------------------------------------------------------*/ +int set_form_fields(FORM * form, FIELD ** fields) +{ + FIELD **old; + int res; + + if ( !form ) + RETURN(E_BAD_ARGUMENT); + + if ( form->status & _POSTED ) + RETURN(E_POSTED); + + old = form->field; + Disconnect_Fields( form ); + + if( (res = Associate_Fields( form, fields )) != E_OK ) + Connect_Fields( form, old ); + + RETURN(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : FIELD **form_fields( const FORM *form ) +| +| Description : Retrieve array of fields +| +| Return Values : Pointer to field array ++--------------------------------------------------------------------------*/ +FIELD **form_fields(const FORM * form) +{ + return (Normalize_Form( form )->field); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int field_count( const FORM *form ) +| +| Description : Retrieve number of fields +| +| Return Values : Number of fields, -1 if none are defined ++--------------------------------------------------------------------------*/ +int field_count(const FORM * form) +{ + return (Normalize_Form( form )->maxfield); +} + +/* frm_def.c ends here */ diff --git a/contrib/ncurses/form/frm_driver.c b/contrib/ncurses/form/frm_driver.c new file mode 100644 index 000000000000..e609e191de2a --- /dev/null +++ b/contrib/ncurses/form/frm_driver.c @@ -0,0 +1,3843 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: frm_driver.c,v 1.35 1999/05/16 17:20:52 juergen Exp $") + +/*---------------------------------------------------------------------------- + This is the core module of the form library. It contains the majority + of the driver routines as well as the form_driver function. + + Essentially this module is nearly the whole library. This is because + all the functions in this module depends on some others in the module, + so it makes no sense to split them into separate files because they + will always be linked together. The only acceptable concern is turnaround + time for this module, but now we have all Pentiums or Riscs, so what! + + The driver routines are grouped into nine generic categories: + + a) Page Navigation ( all functions prefixed by PN_ ) + The current page of the form is left and some new page is + entered. + b) Inter-Field Navigation ( all functions prefixed by FN_ ) + The current field of the form is left and some new field is + entered. + c) Intra-Field Navigation ( all functions prefixed by IFN_ ) + The current position in the current field is changed. + d) Vertical Scrolling ( all functions prefixed by VSC_ ) + Esseantially this is a specialization of Intra-Field navigation. + It has to check for a multi-line field. + e) Horizontal Scrolling ( all functions prefixed by HSC_ ) + Esseantially this is a specialization of Intra-Field navigation. + It has to check for a single-line field. + f) Field Editing ( all functions prefixed by FE_ ) + The content of the current field is changed + g) Edit Mode requests ( all functions prefixed by EM_ ) + Switching between insert and overlay mode + h) Field-Validation requests ( all functions prefixed by FV_ ) + Perform verifications of the field. + i) Choice requests ( all functions prefixed by CR_ ) + Requests to enumerate possible field values + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Some remarks on the placements of assert() macros : + I use them only on "strategic" places, i.e. top level entries where + I want to make sure that things are set correctly. Throughout subordinate + routines I omit them mostly. + --------------------------------------------------------------------------*/ + +/* +Some options that may effect compatibility in behavior to SVr4 forms, +but they are here to allow a more intuitive and user friendly behaviour of +our form implementation. This doesn't affect the API, so we feel it is +uncritical. + +The initial implementation tries to stay very close with the behaviour +of the original SVr4 implementation, although in some areas it is quite +clear that this isn't the most appropriate way. As far as possible this +sources will allow you to build a forms lib that behaves quite similar +to SVr4, but now and in the future we will give you better options. +Perhaps at some time we will make this configurable at runtime. +*/ + +/* Implement a more user-friendly previous/next word behaviour */ +#define FRIENDLY_PREV_NEXT_WORD (1) +/* Fix the wrong behaviour for forms with all fields inactive */ +#define FIX_FORM_INACTIVE_BUG (1) +/* Allow dynamic field growth also when navigating past the end */ +#define GROW_IF_NAVIGATE (1) + +/*---------------------------------------------------------------------------- + Forward references to some internally used static functions + --------------------------------------------------------------------------*/ +static int Inter_Field_Navigation ( int (* const fct) (FORM *), FORM * form ); +static int FN_Next_Field (FORM * form); +static int FN_Previous_Field (FORM * form); +static int FE_New_Line(FORM *); +static int FE_Delete_Previous(FORM *); + +/*---------------------------------------------------------------------------- + Macro Definitions. + + Some Remarks on that: I use the convention to use UPPERCASE for constants + defined by Macros. If I provide a macro as a kind of inline routine to + provide some logic, I use my Upper_Lower case style. + --------------------------------------------------------------------------*/ + +/* Calculate the position of a single row in a field buffer */ +#define Position_Of_Row_In_Buffer(field,row) ((row)*(field)->dcols) + +/* Calculate start address for the fields buffer# N */ +#define Address_Of_Nth_Buffer(field,N) \ + ((field)->buf + (N)*(1+Buffer_Length(field))) + +/* Calculate the start address of the row in the fields specified buffer# N */ +#define Address_Of_Row_In_Nth_Buffer(field,N,row) \ + (Address_Of_Nth_Buffer(field,N) + Position_Of_Row_In_Buffer(field,row)) + +/* Calculate the start address of the row in the fields primary buffer */ +#define Address_Of_Row_In_Buffer(field,row) \ + Address_Of_Row_In_Nth_Buffer(field,0,row) + +/* Calculate the start address of the row in the forms current field + buffer# N */ +#define Address_Of_Current_Row_In_Nth_Buffer(form,N) \ + Address_Of_Row_In_Nth_Buffer((form)->current,N,(form)->currow) + +/* Calculate the start address of the row in the forms current field + primary buffer */ +#define Address_Of_Current_Row_In_Buffer(form) \ + Address_Of_Current_Row_In_Nth_Buffer(form,0) + +/* Calculate the address of the cursor in the forms current field + primary buffer */ +#define Address_Of_Current_Position_In_Nth_Buffer(form,N) \ + (Address_Of_Current_Row_In_Nth_Buffer(form,N) + (form)->curcol) + +/* Calculate the address of the cursor in the forms current field + buffer# N */ +#define Address_Of_Current_Position_In_Buffer(form) \ + Address_Of_Current_Position_In_Nth_Buffer(form,0) + +/* Logic to decide wether or not a field is actually a field with + vertical or horizontal scrolling */ +#define Is_Scroll_Field(field) \ + (((field)->drows > (field)->rows) || \ + ((field)->dcols > (field)->cols)) + +/* Logic to decide whether or not a field needs to have an individual window + instead of a derived window because it contains invisible parts. + This is true for non-public fields and for scrollable fields. */ +#define Has_Invisible_Parts(field) \ + (!((field)->opts & O_PUBLIC) || \ + Is_Scroll_Field(field)) + +/* Logic to decide whether or not a field needs justification */ +#define Justification_Allowed(field) \ + (((field)->just != NO_JUSTIFICATION) && \ + (Single_Line_Field(field)) && \ + (((field)->dcols == (field)->cols) && \ + ((field)->opts & O_STATIC)) ) + +/* Logic to determine whether or not a dynamic field may still grow */ +#define Growable(field) ((field)->status & _MAY_GROW) + +/* Macro to set the attributes for a fields window */ +#define Set_Field_Window_Attributes(field,win) \ +( wbkgdset((win),(chtype)((field)->pad | (field)->back)), \ + wattrset((win),(field)->fore) ) + +/* Logic to decide whether or not a field really appears on the form */ +#define Field_Really_Appears(field) \ + ((field->form) &&\ + (field->form->status & _POSTED) &&\ + (field->opts & O_VISIBLE) &&\ + (field->page == field->form->curpage)) + +/* Logic to determine whether or not we are on the first position in the + current field */ +#define First_Position_In_Current_Field(form) \ + (((form)->currow==0) && ((form)->curcol==0)) + + +#define Minimum(a,b) (((a)<=(b)) ? (a) : (b)) +#define Maximum(a,b) (((a)>=(b)) ? (a) : (b)) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static char *Get_Start_Of_Data(char * buf, int blen) +| +| Description : Return pointer to first non-blank position in buffer. +| If buffer is empty return pointer to buffer itself. +| +| Return Values : Pointer to first non-blank position in buffer ++--------------------------------------------------------------------------*/ +INLINE static char *Get_Start_Of_Data(char * buf, int blen) +{ + char *p = buf; + char *end = &buf[blen]; + + assert(buf && blen>=0); + while( (p < end) && is_blank(*p) ) + p++; + return( (p==end) ? buf : p ); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static char *After_End_Of_Data(char * buf, int blen) +| +| Description : Return pointer after last non-blank position in buffer. +| If buffer is empty, return pointer to buffer itself. +| +| Return Values : Pointer to position after last non-blank position in +| buffer. ++--------------------------------------------------------------------------*/ +INLINE static char *After_End_Of_Data(char * buf,int blen) +{ + char *p = &buf[blen]; + + assert(buf && blen>=0); + while( (p>buf) && is_blank(p[-1]) ) + p--; + return( p ); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static char *Get_First_Whitespace_Character( +| char * buf, int blen) +| +| Description : Position to the first whitespace character. +| +| Return Values : Pointer to first whitespace character in buffer. ++--------------------------------------------------------------------------*/ +INLINE static char *Get_First_Whitespace_Character(char * buf, int blen) +{ + char *p = buf; + char *end = &p[blen]; + + assert(buf && blen>=0); + while( (p < end) && !is_blank(*p)) + p++; + return( (p==end) ? buf : p ); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static char *After_Last_Whitespace_Character( +| char * buf, int blen) +| +| Description : Get the position after the last whitespace character. +| +| Return Values : Pointer to position after last whitespace character in +| buffer. ++--------------------------------------------------------------------------*/ +INLINE static char *After_Last_Whitespace_Character(char * buf, int blen) +{ + char *p = &buf[blen]; + + assert(buf && blen>=0); + while( (p>buf) && !is_blank(p[-1]) ) + p--; + return( p ); +} + +/* Set this to 1 to use the div_t version. This is a good idea if your + compiler has an intrinsic div() support. Unfortunately GNU-C has it + not yet. + N.B.: This only works if form->curcol follows immediately form->currow + and both are of type int. +*/ +#define USE_DIV_T (0) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Adjust_Cursor_Position( +| FORM * form, const char * pos) +| +| Description : Set current row and column of the form to values +| corresponding to the buffer position. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +INLINE static void Adjust_Cursor_Position(FORM * form, const char * pos) +{ + FIELD *field; + int idx; + + field = form->current; + assert( pos >= field->buf && field->dcols > 0); + idx = (int)( pos - field->buf ); +#if USE_DIV_T + *((div_t *)&(form->currow)) = div(idx,field->dcols); +#else + form->currow = idx / field->dcols; + form->curcol = idx - field->cols * form->currow; +#endif + if ( field->drows < form->currow ) + form->currow = 0; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Buffer_To_Window( +| const FIELD * field, +| WINDOW * win) +| +| Description : Copy the buffer to the window. If its a multiline +| field, the buffer is split to the lines of the +| window without any editing. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +static void Buffer_To_Window(const FIELD * field, WINDOW * win) +{ + int width, height; + int len; + int row; + char *pBuffer; + + assert(win && field); + + width = getmaxx(win); + height = getmaxy(win); + + for(row=0, pBuffer=field->buf; + row < height; + row++, pBuffer += width ) + { + if ((len = (int)( After_End_Of_Data( pBuffer, width ) - pBuffer )) > 0) + { + wmove( win, row, 0 ); + waddnstr( win, pBuffer, len ); + } + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Window_To_Buffer( +| WINDOW * win, +| FIELD * field) +| +| Description : Copy the content of the window into the buffer. +| The multiple lines of a window are simply +| concatenated into the buffer. Pad characters in +| the window will be replaced by blanks in the buffer. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +static void Window_To_Buffer(WINDOW * win, FIELD * field) +{ + int pad; + int len = 0; + char *p; + int row, height; + + assert(win && field && field->buf ); + + pad = field->pad; + p = field->buf; + height = getmaxy(win); + + for(row=0; (row < height) && (row < field->drows); row++ ) + { + wmove( win, row, 0 ); + len += winnstr( win, p+len, field->dcols ); + } + p[len] = '\0'; + + /* replace visual padding character by blanks in buffer */ + if (pad != C_BLANK) + { + int i; + for(i=0; i<len; i++, p++) + { + if (*p==pad) + *p = C_BLANK; + } + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Synchronize_Buffer(FORM * form) +| +| Description : If there was a change, copy the content of the +| window into the buffer, so the buffer is synchronized +| with the windows content. We have to indicate that the +| buffer needs validation due to the change. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +INLINE static void Synchronize_Buffer(FORM * form) +{ + if (form->status & _WINDOW_MODIFIED) + { + form->status &= ~_WINDOW_MODIFIED; + form->status |= _FCHECK_REQUIRED; + Window_To_Buffer(form->w,form->current); + wmove(form->w,form->currow,form->curcol); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Field_Grown( FIELD *field, int amount) +| +| Description : This function is called for growable dynamic fields +| only. It has to increase the buffers and to allocate +| a new window for this field. +| This function has the side effect to set a new +| field-buffer pointer, the dcols and drows values +| as well as a new current Window for the field. +| +| Return Values : TRUE - field successfully increased +| FALSE - there was some error ++--------------------------------------------------------------------------*/ +static bool Field_Grown(FIELD * field, int amount) +{ + bool result = FALSE; + + if (field && Growable(field)) + { + bool single_line_field = Single_Line_Field(field); + int old_buflen = Buffer_Length(field); + int new_buflen; + int old_dcols = field->dcols; + int old_drows = field->drows; + char *oldbuf = field->buf; + char *newbuf; + + int growth; + FORM *form = field->form; + bool need_visual_update = ((form != (FORM *)0) && + (form->status & _POSTED) && + (form->current==field)); + + if (need_visual_update) + Synchronize_Buffer(form); + + if (single_line_field) + { + growth = field->cols * amount; + if (field->maxgrow) + growth = Minimum(field->maxgrow - field->dcols,growth); + field->dcols += growth; + if (field->dcols == field->maxgrow) + field->status &= ~_MAY_GROW; + } + else + { + growth = (field->rows + field->nrow) * amount; + if (field->maxgrow) + growth = Minimum(field->maxgrow - field->drows,growth); + field->drows += growth; + if (field->drows == field->maxgrow) + field->status &= ~_MAY_GROW; + } + /* drows, dcols changed, so we get really the new buffer length */ + new_buflen = Buffer_Length(field); + newbuf=(char *)malloc((size_t)Total_Buffer_Size(field)); + if (!newbuf) + { /* restore to previous state */ + field->dcols = old_dcols; + field->drows = old_drows; + if (( single_line_field && (field->dcols!=field->maxgrow)) || + (!single_line_field && (field->drows!=field->maxgrow))) + field->status |= _MAY_GROW; + return FALSE; + } + else + { /* Copy all the buffers. This is the reason why we can't + just use realloc(). + */ + int i; + char *old_bp; + char *new_bp; + + field->buf = newbuf; + for(i=0;i<=field->nbuf;i++) + { + new_bp = Address_Of_Nth_Buffer(field,i); + old_bp = oldbuf + i*(1+old_buflen); + memcpy(new_bp,old_bp,(size_t)old_buflen); + if (new_buflen > old_buflen) + memset(new_bp + old_buflen,C_BLANK, + (size_t)(new_buflen - old_buflen)); + *(new_bp + new_buflen) = '\0'; + } + + if (need_visual_update) + { + WINDOW *new_window = newpad(field->drows,field->dcols); + if (!new_window) + { /* restore old state */ + field->dcols = old_dcols; + field->drows = old_drows; + field->buf = oldbuf; + if (( single_line_field && + (field->dcols!=field->maxgrow)) || + (!single_line_field && + (field->drows!=field->maxgrow))) + field->status |= _MAY_GROW; + free( newbuf ); + return FALSE; + } + assert(form!=(FORM *)0); + delwin(form->w); + form->w = new_window; + Set_Field_Window_Attributes(field,form->w); + werase(form->w); + Buffer_To_Window(field,form->w); + untouchwin(form->w); + wmove(form->w,form->currow,form->curcol); + } + + free(oldbuf); + /* reflect changes in linked fields */ + if (field != field->link) + { + FIELD *linked_field; + for(linked_field = field->link; + linked_field!= field; + linked_field = linked_field->link) + { + linked_field->buf = field->buf; + linked_field->drows = field->drows; + linked_field->dcols = field->dcols; + } + } + result = TRUE; + } + } + return(result); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int _nc_Position_Form_Cursor(FORM * form) +| +| Description : Position the cursor in the window for the current +| field to be in sync. with the currow and curcol +| values. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid form pointer +| E_SYSTEM_ERROR - form has no current field or +| field-window ++--------------------------------------------------------------------------*/ +int +_nc_Position_Form_Cursor(FORM * form) +{ + FIELD *field; + WINDOW *formwin; + + if (!form) + return(E_BAD_ARGUMENT); + + if (!form->w || !form->current) + return(E_SYSTEM_ERROR); + + field = form->current; + formwin = Get_Form_Window(form); + + wmove( form->w, form->currow, form->curcol ); + if ( Has_Invisible_Parts(field) ) + { + /* in this case fieldwin isn't derived from formwin, so we have + to move the cursor in formwin by hand... */ + wmove(formwin, + field->frow + form->currow - form->toprow, + field->fcol + form->curcol - form->begincol); + wcursyncup(formwin); + } + else + wcursyncup(form->w); + return(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int _nc_Refresh_Current_Field(FORM * form) +| +| Description : Propagate the changes in the fields window to the +| window of the form. +| +| Return Values : E_OK - on success +| E_BAD_ARGUMENT - invalid form pointer +| E_SYSTEM_ERROR - general error ++--------------------------------------------------------------------------*/ +int +_nc_Refresh_Current_Field(FORM * form) +{ + WINDOW *formwin; + FIELD *field; + + if (!form) + RETURN(E_BAD_ARGUMENT); + + if (!form->w || !form->current) + RETURN(E_SYSTEM_ERROR); + + field = form->current; + formwin = Get_Form_Window(form); + + if (field->opts & O_PUBLIC) + { + if (Is_Scroll_Field(field)) + { + /* Again, in this case the fieldwin isn't derived from formwin, + so we have to perform a copy operation. */ + if (Single_Line_Field(field)) + { /* horizontal scrolling */ + if (form->curcol < form->begincol) + form->begincol = form->curcol; + else + { + if (form->curcol >= (form->begincol + field->cols)) + form->begincol = form->curcol - field->cols + 1; + } + copywin(form->w, + formwin, + 0, + form->begincol, + field->frow, + field->fcol, + field->frow, + field->cols + field->fcol - 1, + 0); + } + else + { /* A multiline, i.e. vertical scrolling field */ + int row_after_bottom,first_modified_row,first_unmodified_row; + + if (field->drows > field->rows) + { + row_after_bottom = form->toprow + field->rows; + if (form->currow < form->toprow) + { + form->toprow = form->currow; + field->status |= _NEWTOP; + } + if (form->currow >= row_after_bottom) + { + form->toprow = form->currow - field->rows + 1; + field->status |= _NEWTOP; + } + if (field->status & _NEWTOP) + { /* means we have to copy whole range */ + first_modified_row = form->toprow; + first_unmodified_row = first_modified_row + field->rows; + field->status &= ~_NEWTOP; + } + else + { /* we try to optimize : finding the range of touched + lines */ + first_modified_row = form->toprow; + while(first_modified_row < row_after_bottom) + { + if (is_linetouched(form->w,first_modified_row)) + break; + first_modified_row++; + } + first_unmodified_row = first_modified_row; + while(first_unmodified_row < row_after_bottom) + { + if (!is_linetouched(form->w,first_unmodified_row)) + break; + first_unmodified_row++; + } + } + } + else + { + first_modified_row = form->toprow; + first_unmodified_row = first_modified_row + field->rows; + } + if (first_unmodified_row != first_modified_row) + copywin(form->w, + formwin, + first_modified_row, + 0, + field->frow + first_modified_row - form->toprow, + field->fcol, + field->frow + first_unmodified_row - form->toprow - 1, + field->cols + field->fcol - 1, + 0); + } + wsyncup(formwin); + } + else + { /* if the field-window is simply a derived window, i.e. contains + no invisible parts, the whole thing is trivial + */ + wsyncup(form->w); + } + } + untouchwin(form->w); + return _nc_Position_Form_Cursor(form); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Perform_Justification( +| FIELD * field, +| WINDOW * win) +| +| Description : Output field with requested justification +| +| Return Values : - ++--------------------------------------------------------------------------*/ +static void Perform_Justification(FIELD * field, WINDOW * win) +{ + char *bp; + int len; + int col = 0; + + bp = Get_Start_Of_Data(field->buf,Buffer_Length(field)); + len = (int)(After_End_Of_Data(field->buf,Buffer_Length(field)) - bp); + + if (len>0) + { + assert(win && (field->drows == 1) && (field->dcols == field->cols)); + + switch(field->just) + { + case JUSTIFY_LEFT: + break; + case JUSTIFY_CENTER: + col = (field->cols - len)/2; + break; + case JUSTIFY_RIGHT: + col = field->cols - len; + break; + default: + break; + } + + wmove(win,0,col); + waddnstr(win,bp,len); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Undo_Justification( +| FIELD * field, +| WINDOW * win) +| +| Description : Display field without any justification, i.e. +| left justified +| +| Return Values : - ++--------------------------------------------------------------------------*/ +static void Undo_Justification(FIELD * field, WINDOW * win) +{ + char *bp; + int len; + + bp = Get_Start_Of_Data(field->buf,Buffer_Length(field)); + len = (int)(After_End_Of_Data(field->buf,Buffer_Length(field))-bp); + + if (len>0) + { + assert(win); + wmove(win,0,0); + waddnstr(win,bp,len); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Check_Char( +| FIELDTYPE * typ, +| int ch, +| TypeArgument *argp) +| +| Description : Perform a single character check for character ch +| according to the fieldtype instance. +| +| Return Values : TRUE - Character is valid +| FALSE - Character is invalid ++--------------------------------------------------------------------------*/ +static bool Check_Char(FIELDTYPE * typ, int ch, TypeArgument *argp) +{ + if (typ) + { + if (typ->status & _LINKED_TYPE) + { + assert(argp); + return( + Check_Char(typ->left ,ch,argp->left ) || + Check_Char(typ->right,ch,argp->right) ); + } + else + { + if (typ->ccheck) + return typ->ccheck(ch,(void *)argp); + } + } + return (isprint((unsigned char)ch) ? TRUE : FALSE); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Display_Or_Erase_Field( +| FIELD * field, +| bool bEraseFlag) +| +| Description : Create a subwindow for the field and display the +| buffer contents (apply justification if required) +| or simply erase the field. +| +| Return Values : E_OK - on success +| E_SYSTEM_ERROR - some error (typical no memory) ++--------------------------------------------------------------------------*/ +static int Display_Or_Erase_Field(FIELD * field, bool bEraseFlag) +{ + WINDOW *win; + WINDOW *fwin; + + if (!field) + return E_SYSTEM_ERROR; + + fwin = Get_Form_Window(field->form); + win = derwin(fwin, + field->rows,field->cols,field->frow,field->fcol); + + if (!win) + return E_SYSTEM_ERROR; + else + { + if (field->opts & O_VISIBLE) + Set_Field_Window_Attributes(field,win); + else + wattrset(win,getattrs(fwin)); + werase(win); + } + + if (!bEraseFlag) + { + if (field->opts & O_PUBLIC) + { + if (Justification_Allowed(field)) + Perform_Justification(field,win); + else + Buffer_To_Window(field,win); + } + field->status &= ~_NEWTOP; + } + wsyncup(win); + delwin(win); + return E_OK; +} + +/* Macros to preset the bEraseFlag */ +#define Display_Field(field) Display_Or_Erase_Field(field,FALSE) +#define Erase_Field(field) Display_Or_Erase_Field(field,TRUE) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Synchronize_Field(FIELD * field) +| +| Description : Synchronize the windows content with the value in +| the buffer. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid field pointer +| E_SYSTEM_ERROR - some severe basic error ++--------------------------------------------------------------------------*/ +static int Synchronize_Field(FIELD * field) +{ + FORM *form; + int res = E_OK; + + if (!field) + return(E_BAD_ARGUMENT); + + if (((form=field->form) != (FORM *)0) + && Field_Really_Appears(field)) + { + if (field == form->current) + { + form->currow = form->curcol = form->toprow = form->begincol = 0; + werase(form->w); + + if ( (field->opts & O_PUBLIC) && Justification_Allowed(field) ) + Undo_Justification( field, form->w ); + else + Buffer_To_Window( field, form->w ); + + field->status |= _NEWTOP; + res = _nc_Refresh_Current_Field( form ); + } + else + res = Display_Field( field ); + } + field->status |= _CHANGED; + return(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Synchronize_Linked_Fields(FIELD * field) +| +| Description : Propagate the Synchronize_Field function to all linked +| fields. The first error that occurs in the sequence +| of updates is the returnvalue. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid field pointer +| E_SYSTEM_ERROR - some severe basic error ++--------------------------------------------------------------------------*/ +static int Synchronize_Linked_Fields(FIELD * field) +{ + FIELD *linked_field; + int res = E_OK; + int syncres; + + if (!field) + return(E_BAD_ARGUMENT); + + if (!field->link) + return(E_SYSTEM_ERROR); + + for(linked_field = field->link; + linked_field!= field; + linked_field = linked_field->link ) + { + if (((syncres=Synchronize_Field(linked_field)) != E_OK) && + (res==E_OK)) + res = syncres; + } + return(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int _nc_Synchronize_Attributes(FIELD * field) +| +| Description : If a fields visual attributes have changed, this +| routine is called to propagate those changes to the +| screen. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid field pointer +| E_SYSTEM_ERROR - some severe basic error ++--------------------------------------------------------------------------*/ +int _nc_Synchronize_Attributes(FIELD * field) +{ + FORM *form; + int res = E_OK; + WINDOW *formwin; + + if (!field) + return(E_BAD_ARGUMENT); + + if (((form=field->form) != (FORM *)0) + && Field_Really_Appears(field)) + { + if (form->current==field) + { + Synchronize_Buffer(form); + Set_Field_Window_Attributes(field,form->w); + werase(form->w); + if (field->opts & O_PUBLIC) + { + if (Justification_Allowed(field)) + Undo_Justification(field,form->w); + else + Buffer_To_Window(field,form->w); + } + else + { + formwin = Get_Form_Window(form); + copywin(form->w,formwin, + 0,0, + field->frow,field->fcol, + field->rows-1,field->cols-1,0); + wsyncup(formwin); + Buffer_To_Window(field,form->w); + field->status |= _NEWTOP; /* fake refresh to paint all */ + _nc_Refresh_Current_Field(form); + } + } + else + { + res = Display_Field(field); + } + } + return(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int _nc_Synchronize_Options(FIELD * field, +| Field_Options newopts) +| +| Description : If a fields options have changed, this routine is +| called to propagate these changes to the screen and +| to really change the behaviour of the field. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid field pointer +| E_SYSTEM_ERROR - some severe basic error ++--------------------------------------------------------------------------*/ +int +_nc_Synchronize_Options(FIELD *field, Field_Options newopts) +{ + Field_Options oldopts; + Field_Options changed_opts; + FORM *form; + int res = E_OK; + + if (!field) + return(E_BAD_ARGUMENT); + + oldopts = field->opts; + changed_opts = oldopts ^ newopts; + field->opts = newopts; + form = field->form; + + if (form) + { + if (form->current == field) + { + field->opts = oldopts; + return(E_CURRENT); + } + + if (form->status & _POSTED) + { + if ((form->curpage == field->page)) + { + if (changed_opts & O_VISIBLE) + { + if (newopts & O_VISIBLE) + res = Display_Field(field); + else + res = Erase_Field(field); + } + else + { + if ((changed_opts & O_PUBLIC) && + (newopts & O_VISIBLE)) + res = Display_Field(field); + } + } + } + } + + if (changed_opts & O_STATIC) + { + bool single_line_field = Single_Line_Field(field); + int res2 = E_OK; + + if (newopts & O_STATIC) + { /* the field becomes now static */ + field->status &= ~_MAY_GROW; + /* if actually we have no hidden columns, justification may + occur again */ + if (single_line_field && + (field->cols == field->dcols) && + (field->just != NO_JUSTIFICATION) && + Field_Really_Appears(field)) + { + res2 = Display_Field(field); + } + } + else + { /* field is no longer static */ + if ((field->maxgrow==0) || + ( single_line_field && (field->dcols < field->maxgrow)) || + (!single_line_field && (field->drows < field->maxgrow))) + { + field->status |= _MAY_GROW; + /* a field with justification now changes its behaviour, + so we must redisplay it */ + if (single_line_field && + (field->just != NO_JUSTIFICATION) && + Field_Really_Appears(field)) + { + res2 = Display_Field(field); + } + } + } + if (res2 != E_OK) + res = res2; + } + + return(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int _nc_Set_Current_Field(FORM * form, +| FIELD * newfield) +| +| Description : Make the newfield the new current field. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid form or field pointer +| E_SYSTEM_ERROR - some severe basic error ++--------------------------------------------------------------------------*/ +int +_nc_Set_Current_Field(FORM *form, FIELD *newfield) +{ + FIELD *field; + WINDOW *new_window; + + if (!form || !newfield || !form->current || (newfield->form!=form)) + return(E_BAD_ARGUMENT); + + if ( (form->status & _IN_DRIVER) ) + return(E_BAD_STATE); + + if (!(form->field)) + return(E_NOT_CONNECTED); + + field = form->current; + + if ((field!=newfield) || + !(form->status & _POSTED)) + { + if ((form->w) && + (field->opts & O_VISIBLE) && + (field->form->curpage == field->page)) + { + _nc_Refresh_Current_Field(form); + if (field->opts & O_PUBLIC) + { + if (field->drows > field->rows) + { + if (form->toprow==0) + field->status &= ~_NEWTOP; + else + field->status |= _NEWTOP; + } + else + { + if (Justification_Allowed(field)) + { + Window_To_Buffer(form->w,field); + werase(form->w); + Perform_Justification(field,form->w); + wsyncup(form->w); + } + } + } + delwin(form->w); + } + + field = newfield; + + if (Has_Invisible_Parts(field)) + new_window = newpad(field->drows,field->dcols); + else + new_window = derwin(Get_Form_Window(form), + field->rows,field->cols,field->frow,field->fcol); + + if (!new_window) + return(E_SYSTEM_ERROR); + + form->current = field; + form->w = new_window; + form->status &= ~_WINDOW_MODIFIED; + Set_Field_Window_Attributes(field,form->w); + + if (Has_Invisible_Parts(field)) + { + werase(form->w); + Buffer_To_Window(field,form->w); + } + else + { + if (Justification_Allowed(field)) + { + werase(form->w); + Undo_Justification(field,form->w); + wsyncup(form->w); + } + } + + untouchwin(form->w); + } + + form->currow = form->curcol = form->toprow = form->begincol = 0; + return(E_OK); +} + +/*---------------------------------------------------------------------------- + Intra-Field Navigation routines + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int IFN_Next_Character(FORM * form) +| +| Description : Move to the next character in the field. In a multiline +| field this wraps at the end of the line. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - at the rightmost position ++--------------------------------------------------------------------------*/ +static int IFN_Next_Character(FORM * form) +{ + FIELD *field = form->current; + + if ((++(form->curcol))==field->dcols) + { + if ((++(form->currow))==field->drows) + { +#if GROW_IF_NAVIGATE + if (!Single_Line_Field(field) && Field_Grown(field,1)) { + form->curcol = 0; + return(E_OK); + } +#endif + form->currow--; +#if GROW_IF_NAVIGATE + if (Single_Line_Field(field) && Field_Grown(field,1)) + return(E_OK); +#endif + form->curcol--; + return(E_REQUEST_DENIED); + } + form->curcol = 0; + } + return(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int IFN_Previous_Character(FORM * form) +| +| Description : Move to the previous character in the field. In a +| multiline field this wraps and the beginning of the +| line. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - at the leftmost position ++--------------------------------------------------------------------------*/ +static int IFN_Previous_Character(FORM * form) +{ + if ((--(form->curcol))<0) + { + if ((--(form->currow))<0) + { + form->currow++; + form->curcol++; + return(E_REQUEST_DENIED); + } + form->curcol = form->current->dcols - 1; + } + return(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int IFN_Next_Line(FORM * form) +| +| Description : Move to the beginning of the next line in the field +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - at the last line ++--------------------------------------------------------------------------*/ +static int IFN_Next_Line(FORM * form) +{ + FIELD *field = form->current; + + if ((++(form->currow))==field->drows) + { +#if GROW_IF_NAVIGATE + if (!Single_Line_Field(field) && Field_Grown(field,1)) + return(E_OK); +#endif + form->currow--; + return(E_REQUEST_DENIED); + } + form->curcol = 0; + return(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int IFN_Previous_Line(FORM * form) +| +| Description : Move to the beginning of the previous line in the field +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - at the first line ++--------------------------------------------------------------------------*/ +static int IFN_Previous_Line(FORM * form) +{ + if ( (--(form->currow)) < 0 ) + { + form->currow++; + return(E_REQUEST_DENIED); + } + form->curcol = 0; + return(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int IFN_Next_Word(FORM * form) +| +| Description : Move to the beginning of the next word in the field. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - there is no next word ++--------------------------------------------------------------------------*/ +static int IFN_Next_Word(FORM * form) +{ + FIELD *field = form->current; + char *bp = Address_Of_Current_Position_In_Buffer(form); + char *s; + char *t; + + /* We really need access to the data, so we have to synchronize */ + Synchronize_Buffer(form); + + /* Go to the first whitespace after the current position (including + current position). This is then the startpoint to look for the + next non-blank data */ + s = Get_First_Whitespace_Character(bp,Buffer_Length(field) - + (int)(bp - field->buf)); + + /* Find the start of the next word */ + t = Get_Start_Of_Data(s,Buffer_Length(field) - + (int)(s - field->buf)); +#if !FRIENDLY_PREV_NEXT_WORD + if (s==t) + return(E_REQUEST_DENIED); + else +#endif + { + Adjust_Cursor_Position(form,t); + return(E_OK); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int IFN_Previous_Word(FORM * form) +| +| Description : Move to the beginning of the previous word in the field. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - there is no previous word ++--------------------------------------------------------------------------*/ +static int IFN_Previous_Word(FORM * form) +{ + FIELD *field = form->current; + char *bp = Address_Of_Current_Position_In_Buffer(form); + char *s; + char *t; + bool again = FALSE; + + /* We really need access to the data, so we have to synchronize */ + Synchronize_Buffer(form); + + s = After_End_Of_Data(field->buf,(int)(bp-field->buf)); + /* s points now right after the last non-blank in the buffer before bp. + If bp was in a word, s equals bp. In this case we must find the last + whitespace in the buffer before bp and repeat the game to really find + the previous word! */ + if (s==bp) + again = TRUE; + + /* And next call now goes backward to look for the last whitespace + before that, pointing right after this, so it points to the begin + of the previous word. + */ + t = After_Last_Whitespace_Character(field->buf,(int)(s - field->buf)); +#if !FRIENDLY_PREV_NEXT_WORD + if (s==t) + return(E_REQUEST_DENIED); +#endif + if (again) + { /* and do it again, replacing bp by t */ + s = After_End_Of_Data(field->buf,(int)(t - field->buf)); + t = After_Last_Whitespace_Character(field->buf,(int)(s - field->buf)); +#if !FRIENDLY_PREV_NEXT_WORD + if (s==t) + return(E_REQUEST_DENIED); +#endif + } + Adjust_Cursor_Position(form,t); + return(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int IFN_Beginning_Of_Field(FORM * form) +| +| Description : Place the cursor at the first non-pad character in +| the field. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +static int IFN_Beginning_Of_Field(FORM * form) +{ + FIELD *field = form->current; + + Synchronize_Buffer(form); + Adjust_Cursor_Position(form, + Get_Start_Of_Data(field->buf,Buffer_Length(field))); + return(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int IFN_End_Of_Field(FORM * form) +| +| Description : Place the cursor after the last non-pad character in +| the field. If the field occupies the last position in +| the buffer, the cursos is positioned on the last +| character. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +static int IFN_End_Of_Field(FORM * form) +{ + FIELD *field = form->current; + char *pos; + + Synchronize_Buffer(form); + pos = After_End_Of_Data(field->buf,Buffer_Length(field)); + if (pos==(field->buf + Buffer_Length(field))) + pos--; + Adjust_Cursor_Position(form,pos); + return(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int IFN_Beginning_Of_Line(FORM * form) +| +| Description : Place the cursor on the first non-pad character in +| the current line of the field. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +static int IFN_Beginning_Of_Line(FORM * form) +{ + FIELD *field = form->current; + + Synchronize_Buffer(form); + Adjust_Cursor_Position(form, + Get_Start_Of_Data(Address_Of_Current_Row_In_Buffer(form), + field->dcols)); + return(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int IFN_End_Of_Line(FORM * form) +| +| Description : Place the cursor after the last non-pad character in the +| current line of the field. If the field occupies the +| last column in the line, the cursor is positioned on the +| last character of the line. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +static int IFN_End_Of_Line(FORM * form) +{ + FIELD *field = form->current; + char *pos; + char *bp; + + Synchronize_Buffer(form); + bp = Address_Of_Current_Row_In_Buffer(form); + pos = After_End_Of_Data(bp,field->dcols); + if (pos == (bp + field->dcols)) + pos--; + Adjust_Cursor_Position(form,pos); + return(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int IFN_Left_Character(FORM * form) +| +| Description : Move one character to the left in the current line. +| This doesn't cycle. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - already in first column ++--------------------------------------------------------------------------*/ +static int IFN_Left_Character(FORM * form) +{ + if ( (--(form->curcol)) < 0 ) + { + form->curcol++; + return(E_REQUEST_DENIED); + } + return(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int IFN_Right_Character(FORM * form) +| +| Description : Move one character to the right in the current line. +| This doesn't cycle. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - already in last column ++--------------------------------------------------------------------------*/ +static int IFN_Right_Character(FORM * form) +{ + if ( (++(form->curcol)) == form->current->dcols ) + { +#if GROW_IF_NAVIGATE + FIELD *field = form->current; + if (Single_Line_Field(field) && Field_Grown(field,1)) + return(E_OK); +#endif + --(form->curcol); + return(E_REQUEST_DENIED); + } + return(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int IFN_Up_Character(FORM * form) +| +| Description : Move one line up. This doesn't cycle through the lines +| of the field. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - already in last column ++--------------------------------------------------------------------------*/ +static int IFN_Up_Character(FORM * form) +{ + if ( (--(form->currow)) < 0 ) + { + form->currow++; + return(E_REQUEST_DENIED); + } + return(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int IFN_Down_Character(FORM * form) +| +| Description : Move one line down. This doesn't cycle through the +| lines of the field. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - already in last column ++--------------------------------------------------------------------------*/ +static int IFN_Down_Character(FORM * form) +{ + FIELD *field = form->current; + + if ( (++(form->currow)) == field->drows ) + { +#if GROW_IF_NAVIGATE + if (!Single_Line_Field(field) && Field_Grown(field,1)) + return(E_OK); +#endif + --(form->currow); + return(E_REQUEST_DENIED); + } + return(E_OK); +} +/*---------------------------------------------------------------------------- + END of Intra-Field Navigation routines + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Vertical scrolling helper routines + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int VSC_Generic(FORM *form, int lines) +| +| Description : Scroll multi-line field forward (lines>0) or +| backward (lines<0) this many lines. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - can't scroll ++--------------------------------------------------------------------------*/ +static int VSC_Generic(FORM *form, int lines) +{ + FIELD *field = form->current; + int res = E_REQUEST_DENIED; + int rows_to_go = (lines > 0 ? lines : -lines); + + if (lines > 0) + { + if ( (rows_to_go + form->toprow) > (field->drows - field->rows) ) + rows_to_go = (field->drows - field->rows - form->toprow); + + if (rows_to_go > 0) + { + form->currow += rows_to_go; + form->toprow += rows_to_go; + res = E_OK; + } + } + else + { + if (rows_to_go > form->toprow) + rows_to_go = form->toprow; + + if (rows_to_go > 0) + { + form->currow -= rows_to_go; + form->toprow -= rows_to_go; + res = E_OK; + } + } + return(res); +} +/*---------------------------------------------------------------------------- + End of Vertical scrolling helper routines + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Vertical scrolling routines + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Vertical_Scrolling( +| int (* const fct) (FORM *), +| FORM * form) +| +| Description : Performs the generic vertical scrolling routines. +| This has to check for a multi-line field and to set +| the _NEWTOP flag if scrolling really occured. +| +| Return Values : Propagated error code from low-level driver calls ++--------------------------------------------------------------------------*/ +static int Vertical_Scrolling(int (* const fct) (FORM *), FORM * form) +{ + int res = E_REQUEST_DENIED; + + if (!Single_Line_Field(form->current)) + { + res = fct(form); + if (res == E_OK) + form->current->status |= _NEWTOP; + } + return(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int VSC_Scroll_Line_Forward(FORM * form) +| +| Description : Scroll multi-line field forward a line +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - no data ahead ++--------------------------------------------------------------------------*/ +static int VSC_Scroll_Line_Forward(FORM * form) +{ + return VSC_Generic(form,1); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int VSC_Scroll_Line_Backward(FORM * form) +| +| Description : Scroll multi-line field backward a line +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - no data behind ++--------------------------------------------------------------------------*/ +static int VSC_Scroll_Line_Backward(FORM * form) +{ + return VSC_Generic(form,-1); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int VSC_Scroll_Page_Forward(FORM * form) +| +| Description : Scroll a multi-line field forward a page +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - no data ahead ++--------------------------------------------------------------------------*/ +static int VSC_Scroll_Page_Forward(FORM * form) +{ + return VSC_Generic(form,form->current->rows); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int VSC_Scroll_Half_Page_Forward(FORM * form) +| +| Description : Scroll a multi-line field forward half a page +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - no data ahead ++--------------------------------------------------------------------------*/ +static int VSC_Scroll_Half_Page_Forward(FORM * form) +{ + return VSC_Generic(form,(form->current->rows + 1)/2); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int VSC_Scroll_Page_Backward(FORM * form) +| +| Description : Scroll a multi-line field backward a page +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - no data behind ++--------------------------------------------------------------------------*/ +static int VSC_Scroll_Page_Backward(FORM * form) +{ + return VSC_Generic(form, -(form->current->rows)); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int VSC_Scroll_Half_Page_Backward(FORM * form) +| +| Description : Scroll a multi-line field backward half a page +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - no data behind ++--------------------------------------------------------------------------*/ +static int VSC_Scroll_Half_Page_Backward(FORM * form) +{ + return VSC_Generic(form, -((form->current->rows + 1)/2)); +} +/*---------------------------------------------------------------------------- + End of Vertical scrolling routines + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Horizontal scrolling helper routines + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int HSC_Generic(FORM *form, int columns) +| +| Description : Scroll single-line field forward (columns>0) or +| backward (columns<0) this many columns. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - can't scroll ++--------------------------------------------------------------------------*/ +static int HSC_Generic(FORM *form, int columns) +{ + FIELD *field = form->current; + int res = E_REQUEST_DENIED; + int cols_to_go = (columns > 0 ? columns : -columns); + + if (columns > 0) + { + if ((cols_to_go + form->begincol) > (field->dcols - field->cols)) + cols_to_go = field->dcols - field->cols - form->begincol; + + if (cols_to_go > 0) + { + form->curcol += cols_to_go; + form->begincol += cols_to_go; + res = E_OK; + } + } + else + { + if ( cols_to_go > form->begincol ) + cols_to_go = form->begincol; + + if (cols_to_go > 0) + { + form->curcol -= cols_to_go; + form->begincol -= cols_to_go; + res = E_OK; + } + } + return(res); +} +/*---------------------------------------------------------------------------- + End of Horizontal scrolling helper routines + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Horizontal scrolling routines + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Horizontal_Scrolling( +| int (* const fct) (FORM *), +| FORM * form) +| +| Description : Performs the generic horizontal scrolling routines. +| This has to check for a single-line field. +| +| Return Values : Propagated error code from low-level driver calls ++--------------------------------------------------------------------------*/ +static int Horizontal_Scrolling(int (* const fct) (FORM *), FORM * form) +{ + if (Single_Line_Field(form->current)) + return fct(form); + else + return(E_REQUEST_DENIED); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int HSC_Scroll_Char_Forward(FORM * form) +| +| Description : Scroll single-line field forward a character +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - no data ahead ++--------------------------------------------------------------------------*/ +static int HSC_Scroll_Char_Forward(FORM *form) +{ + return HSC_Generic(form,1); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int HSC_Scroll_Char_Backward(FORM * form) +| +| Description : Scroll single-line field backward a character +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - no data behind ++--------------------------------------------------------------------------*/ +static int HSC_Scroll_Char_Backward(FORM *form) +{ + return HSC_Generic(form,-1); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int HSC_Horizontal_Line_Forward(FORM* form) +| +| Description : Scroll single-line field forward a line +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - no data ahead ++--------------------------------------------------------------------------*/ +static int HSC_Horizontal_Line_Forward(FORM * form) +{ + return HSC_Generic(form,form->current->cols); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int HSC_Horizontal_Half_Line_Forward(FORM* form) +| +| Description : Scroll single-line field forward half a line +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - no data ahead ++--------------------------------------------------------------------------*/ +static int HSC_Horizontal_Half_Line_Forward(FORM * form) +{ + return HSC_Generic(form,(form->current->cols + 1)/2); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int HSC_Horizontal_Line_Backward(FORM* form) +| +| Description : Scroll single-line field backward a line +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - no data behind ++--------------------------------------------------------------------------*/ +static int HSC_Horizontal_Line_Backward(FORM * form) +{ + return HSC_Generic(form,-(form->current->cols)); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int HSC_Horizontal_Half_Line_Backward(FORM* form) +| +| Description : Scroll single-line field backward half a line +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - no data behind ++--------------------------------------------------------------------------*/ +static int HSC_Horizontal_Half_Line_Backward(FORM * form) +{ + return HSC_Generic(form,-((form->current->cols + 1)/2)); +} + +/*---------------------------------------------------------------------------- + End of Horizontal scrolling routines + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Helper routines for Field Editing + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Is_There_Room_For_A_Line(FORM * form) +| +| Description : Check whether or not there is enough room in the +| buffer to enter a whole line. +| +| Return Values : TRUE - there is enough space +| FALSE - there is not enough space ++--------------------------------------------------------------------------*/ +INLINE static bool Is_There_Room_For_A_Line(FORM * form) +{ + FIELD *field = form->current; + char *begin_of_last_line, *s; + + Synchronize_Buffer(form); + begin_of_last_line = Address_Of_Row_In_Buffer(field,(field->drows-1)); + s = After_End_Of_Data(begin_of_last_line,field->dcols); + return ((s==begin_of_last_line) ? TRUE : FALSE); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Is_There_Room_For_A_Char_In_Line(FORM * form) +| +| Description : Checks whether or not there is room for a new character +| in the current line. +| +| Return Values : TRUE - there is room +| FALSE - there is not enough room (line full) ++--------------------------------------------------------------------------*/ +INLINE static bool Is_There_Room_For_A_Char_In_Line(FORM * form) +{ + int last_char_in_line; + + wmove(form->w,form->currow,form->current->dcols-1); + last_char_in_line = (int)(winch(form->w) & A_CHARTEXT); + wmove(form->w,form->currow,form->curcol); + return (((last_char_in_line == form->current->pad) || + is_blank(last_char_in_line)) ? TRUE : FALSE); +} + +#define There_Is_No_Room_For_A_Char_In_Line(f) \ + !Is_There_Room_For_A_Char_In_Line(f) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Insert_String( +| FORM * form, +| int row, +| char *txt, +| int len ) +| +| Description : Insert the 'len' characters beginning at pointer 'txt' +| into the 'row' of the 'form'. The insertion occurs +| on the beginning of the row, all other characters are +| moved to the right. After the text a pad character will +| be inserted to separate the text from the rest. If +| necessary the insertion moves characters on the next +| line to make place for the requested insertion string. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +static int Insert_String(FORM *form, int row, char *txt, int len) +{ + FIELD *field = form->current; + char *bp = Address_Of_Row_In_Buffer(field,row); + int datalen = (int)(After_End_Of_Data(bp,field->dcols) - bp); + int freelen = field->dcols - datalen; + int requiredlen = len+1; + char *split; + int result = E_REQUEST_DENIED; + const char *Space = " "; + + if (freelen >= requiredlen) + { + wmove(form->w,row,0); + winsnstr(form->w,txt,len); + wmove(form->w,row,len); + winsnstr(form->w,Space,1); + return E_OK; + } + else + { /* we have to move characters on the next line. If we are on the + last line this may work, if the field is growable */ + if ((row == (field->drows - 1)) && Growable(field)) + { + if (!Field_Grown(field,1)) + return(E_SYSTEM_ERROR); + /* !!!Side-Effect : might be changed due to growth!!! */ + bp = Address_Of_Row_In_Buffer(field,row); + } + + if (row < (field->drows - 1)) + { + split = After_Last_Whitespace_Character(bp, + (int)(Get_Start_Of_Data(bp + field->dcols - requiredlen , + requiredlen) - bp)); + /* split points now to the first character of the portion of the + line that must be moved to the next line */ + datalen = (int)(split-bp); /* + freelen has to stay on this line */ + freelen = field->dcols - (datalen + freelen); /* for the next line */ + + if ((result=Insert_String(form,row+1,split,freelen))==E_OK) + { + wmove(form->w,row,datalen); + wclrtoeol(form->w); + wmove(form->w,row,0); + winsnstr(form->w,txt,len); + wmove(form->w,row,len); + winsnstr(form->w,Space,1); + return E_OK; + } + } + return(result); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Wrapping_Not_Necessary_Or_Wrapping_Ok( +| FORM * form) +| +| Description : If a character has been entered into a field, it may +| be that wrapping has to occur. This routine checks +| whether or not wrapping is required and if so, performs +| the wrapping. +| +| Return Values : E_OK - no wrapping required or wrapping +| was successfull +| E_REQUEST_DENIED - +| E_SYSTEM_ERROR - some system error ++--------------------------------------------------------------------------*/ +static int Wrapping_Not_Necessary_Or_Wrapping_Ok(FORM * form) +{ + FIELD *field = form->current; + int result = E_REQUEST_DENIED; + bool Last_Row = ((field->drows - 1) == form->currow); + + if ( (field->opts & O_WRAP) && /* wrapping wanted */ + (!Single_Line_Field(field)) && /* must be multi-line */ + (There_Is_No_Room_For_A_Char_In_Line(form)) && /* line is full */ + (!Last_Row || Growable(field)) ) /* there are more lines*/ + { + char *bp; + char *split; + int chars_to_be_wrapped; + int chars_to_remain_on_line; + if (Last_Row) + { /* the above logic already ensures, that in this case the field + is growable */ + if (!Field_Grown(field,1)) + return E_SYSTEM_ERROR; + } + bp = Address_Of_Current_Row_In_Buffer(form); + Window_To_Buffer(form->w,field); + split = After_Last_Whitespace_Character(bp,field->dcols); + /* split points to the first character of the sequence to be brought + on the next line */ + chars_to_remain_on_line = (int)(split - bp); + chars_to_be_wrapped = field->dcols - chars_to_remain_on_line; + if (chars_to_remain_on_line > 0) + { + if ((result=Insert_String(form,form->currow+1,split, + chars_to_be_wrapped)) == E_OK) + { + wmove(form->w,form->currow,chars_to_remain_on_line); + wclrtoeol(form->w); + if (form->curcol >= chars_to_remain_on_line) + { + form->currow++; + form->curcol -= chars_to_remain_on_line; + } + return E_OK; + } + } + else + return E_OK; + if (result!=E_OK) + { + wmove(form->w,form->currow,form->curcol); + wdelch(form->w); + Window_To_Buffer(form->w,field); + result = E_REQUEST_DENIED; + } + } + else + result = E_OK; /* wrapping was not necessary */ + return(result); +} + +/*---------------------------------------------------------------------------- + Field Editing routines + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Field_Editing( +| int (* const fct) (FORM *), +| FORM * form) +| +| Description : Generic routine for field editing requests. The driver +| routines are only called for editable fields, the +| _WINDOW_MODIFIED flag is set if editing occured. +| This is somewhat special due to the overload semantics +| of the NEW_LINE and DEL_PREV requests. +| +| Return Values : Error code from low level drivers. ++--------------------------------------------------------------------------*/ +static int Field_Editing(int (* const fct) (FORM *), FORM * form) +{ + int res = E_REQUEST_DENIED; + + /* We have to deal here with the specific case of the overloaded + behaviour of New_Line and Delete_Previous requests. + They may end up in navigational requests if we are on the first + character in a field. But navigation is also allowed on non- + editable fields. + */ + if ((fct==FE_Delete_Previous) && + (form->opts & O_BS_OVERLOAD) && + First_Position_In_Current_Field(form) ) + { + res = Inter_Field_Navigation(FN_Previous_Field,form); + } + else + { + if (fct==FE_New_Line) + { + if ((form->opts & O_NL_OVERLOAD) && + First_Position_In_Current_Field(form)) + { + res = Inter_Field_Navigation(FN_Next_Field,form); + } + else + /* FE_New_Line deals itself with the _WINDOW_MODIFIED flag */ + res = fct(form); + } + else + { + /* From now on, everything must be editable */ + if (form->current->opts & O_EDIT) + { + res = fct(form); + if (res==E_OK) + form->status |= _WINDOW_MODIFIED; + } + } + } + return res; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FE_New_Line(FORM * form) +| +| Description : Perform a new line request. This is rather complex +| compared to other routines in this code due to the +| rather difficult to understand description in the +| manuals. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - new line not allowed +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +static int FE_New_Line(FORM * form) +{ + FIELD *field = form->current; + char *bp, *t; + bool Last_Row = ((field->drows - 1)==form->currow); + + if (form->status & _OVLMODE) + { + if (Last_Row && + (!(Growable(field) && !Single_Line_Field(field)))) + { + if (!(form->opts & O_NL_OVERLOAD)) + return(E_REQUEST_DENIED); + wclrtoeol(form->w); + /* we have to set this here, although it is also + handled in the generic routine. The reason is, + that FN_Next_Field may fail, but the form is + definitively changed */ + form->status |= _WINDOW_MODIFIED; + return Inter_Field_Navigation(FN_Next_Field,form); + } + else + { + if (Last_Row && !Field_Grown(field,1)) + { /* N.B.: due to the logic in the 'if', LastRow==TRUE + means here that the field is growable and not + a single-line field */ + return(E_SYSTEM_ERROR); + } + wclrtoeol(form->w); + form->currow++; + form->curcol = 0; + form->status |= _WINDOW_MODIFIED; + return(E_OK); + } + } + else + { /* Insert Mode */ + if (Last_Row && + !(Growable(field) && !Single_Line_Field(field))) + { + if (!(form->opts & O_NL_OVERLOAD)) + return(E_REQUEST_DENIED); + return Inter_Field_Navigation(FN_Next_Field,form); + } + else + { + bool May_Do_It = !Last_Row && Is_There_Room_For_A_Line(form); + + if (!(May_Do_It || Growable(field))) + return(E_REQUEST_DENIED); + if (!May_Do_It && !Field_Grown(field,1)) + return(E_SYSTEM_ERROR); + + bp= Address_Of_Current_Position_In_Buffer(form); + t = After_End_Of_Data(bp,field->dcols - form->curcol); + wclrtoeol(form->w); + form->currow++; + form->curcol=0; + wmove(form->w,form->currow,form->curcol); + winsertln(form->w); + waddnstr(form->w,bp,(int)(t-bp)); + form->status |= _WINDOW_MODIFIED; + return E_OK; + } + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FE_Insert_Character(FORM * form) +| +| Description : Insert blank character at the cursor position +| +| Return Values : E_OK +| E_REQUEST_DENIED ++--------------------------------------------------------------------------*/ +static int FE_Insert_Character(FORM * form) +{ + FIELD *field = form->current; + int result = E_REQUEST_DENIED; + + if (Check_Char(field->type,(int)C_BLANK,(TypeArgument *)(field->arg))) + { + bool There_Is_Room = Is_There_Room_For_A_Char_In_Line(form); + + if (There_Is_Room || + ((Single_Line_Field(field) && Growable(field)))) + { + if (!There_Is_Room && !Field_Grown(field,1)) + result = E_SYSTEM_ERROR; + else + { + winsch(form->w,(chtype)C_BLANK); + result = Wrapping_Not_Necessary_Or_Wrapping_Ok(form); + } + } + } + return result; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FE_Insert_Line(FORM * form) +| +| Description : Insert a blank line at the cursor position +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - line can not be inserted ++--------------------------------------------------------------------------*/ +static int FE_Insert_Line(FORM * form) +{ + FIELD *field = form->current; + int result = E_REQUEST_DENIED; + + if (Check_Char(field->type,(int)C_BLANK,(TypeArgument *)(field->arg))) + { + bool Maybe_Done = (form->currow!=(field->drows-1)) && + Is_There_Room_For_A_Line(form); + + if (!Single_Line_Field(field) && + (Maybe_Done || Growable(field))) + { + if (!Maybe_Done && !Field_Grown(field,1)) + result = E_SYSTEM_ERROR; + else + { + form->curcol = 0; + winsertln(form->w); + result = E_OK; + } + } + } + return result; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FE_Delete_Character(FORM * form) +| +| Description : Delete character at the cursor position +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +static int FE_Delete_Character(FORM * form) +{ + wdelch(form->w); + return E_OK; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FE_Delete_Previous(FORM * form) +| +| Description : Delete character before cursor. Again this is a rather +| difficult piece compared to others due to the overloading +| semantics of backspace. +| N.B.: The case of overloaded BS on first field position +| is already handled in the generic routine. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - Character can't be deleted ++--------------------------------------------------------------------------*/ +static int FE_Delete_Previous(FORM * form) +{ + FIELD *field = form->current; + + if (First_Position_In_Current_Field(form)) + return E_REQUEST_DENIED; + + if ( (--(form->curcol))<0 ) + { + char *this_line, *prev_line, *prev_end, *this_end; + + form->curcol++; + if (form->status & _OVLMODE) + return E_REQUEST_DENIED; + + prev_line = Address_Of_Row_In_Buffer(field,(form->currow-1)); + this_line = Address_Of_Row_In_Buffer(field,(form->currow)); + Synchronize_Buffer(form); + prev_end = After_End_Of_Data(prev_line,field->dcols); + this_end = After_End_Of_Data(this_line,field->dcols); + if ((int)(this_end-this_line) > + (field->cols-(int)(prev_end-prev_line))) + return E_REQUEST_DENIED; + wdeleteln(form->w); + Adjust_Cursor_Position(form,prev_end); + wmove(form->w,form->currow,form->curcol); + waddnstr(form->w,this_line,(int)(this_end-this_line)); + } + else + { + wmove(form->w,form->currow,form->curcol); + wdelch(form->w); + } + return E_OK; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FE_Delete_Line(FORM * form) +| +| Description : Delete line at cursor position. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +static int FE_Delete_Line(FORM * form) +{ + form->curcol = 0; + wdeleteln(form->w); + return E_OK; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FE_Delete_Word(FORM * form) +| +| Description : Delete word at cursor position +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - failure ++--------------------------------------------------------------------------*/ +static int FE_Delete_Word(FORM * form) +{ + FIELD *field = form->current; + char *bp = Address_Of_Current_Row_In_Buffer(form); + char *ep = bp + field->dcols; + char *cp = bp + form->curcol; + char *s; + + Synchronize_Buffer(form); + if (is_blank(*cp)) + return E_REQUEST_DENIED; /* not in word */ + + /* move cursor to begin of word and erase to end of screen-line */ + Adjust_Cursor_Position(form, + After_Last_Whitespace_Character(bp,form->curcol)); + wmove(form->w,form->currow,form->curcol); + wclrtoeol(form->w); + + /* skip over word in buffer */ + s = Get_First_Whitespace_Character(cp,(int)(ep-cp)); + /* to begin of next word */ + s = Get_Start_Of_Data(s,(int)(ep - s)); + if ( (s!=cp) && !is_blank(*s)) + { + /* copy remaining line to window */ + waddnstr(form->w,s,(int)(s - After_End_Of_Data(s,(int)(ep - s)))); + } + return E_OK; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FE_Clear_To_End_Of_Line(FORM * form) +| +| Description : Clear to end of current line. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +static int FE_Clear_To_End_Of_Line(FORM * form) +{ + wclrtoeol(form->w); + return E_OK; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FE_Clear_To_End_Of_Form(FORM * form) +| +| Description : Clear to end of form. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +static int FE_Clear_To_End_Of_Form(FORM * form) +{ + wclrtobot(form->w); + return E_OK; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FE_Clear_Field(FORM * form) +| +| Description : Clear entire field. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +static int FE_Clear_Field(FORM * form) +{ + form->currow = form->curcol = 0; + werase(form->w); + return E_OK; +} +/*---------------------------------------------------------------------------- + END of Field Editing routines + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Edit Mode routines + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int EM_Overlay_Mode(FORM * form) +| +| Description : Switch to overlay mode. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +static int EM_Overlay_Mode(FORM * form) +{ + form->status |= _OVLMODE; + return E_OK; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int EM_Insert_Mode(FORM * form) +| +| Description : Switch to insert mode +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +static int EM_Insert_Mode(FORM * form) +{ + form->status &= ~_OVLMODE; + return E_OK; +} + +/*---------------------------------------------------------------------------- + END of Edit Mode routines + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Helper routines for Choice Requests + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Next_Choice( +| FIELDTYPE * typ, +| FIELD * field, +| TypeArgument *argp) +| +| Description : Get the next field choice. For linked types this is +| done recursively. +| +| Return Values : TRUE - next choice successfully retrieved +| FALSE - couldn't retrieve next choice ++--------------------------------------------------------------------------*/ +static bool Next_Choice(FIELDTYPE * typ, FIELD *field, TypeArgument *argp) +{ + if (!typ || !(typ->status & _HAS_CHOICE)) + return FALSE; + + if (typ->status & _LINKED_TYPE) + { + assert(argp); + return( + Next_Choice(typ->left ,field,argp->left) || + Next_Choice(typ->right,field,argp->right) ); + } + else + { + assert(typ->next); + return typ->next(field,(void *)argp); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Previous_Choice( +| FIELDTYPE * typ, +| FIELD * field, +| TypeArgument *argp) +| +| Description : Get the previous field choice. For linked types this +| is done recursively. +| +| Return Values : TRUE - previous choice successfully retrieved +| FALSE - couldn't retrieve previous choice ++--------------------------------------------------------------------------*/ +static bool Previous_Choice(FIELDTYPE *typ, FIELD *field, TypeArgument *argp) +{ + if (!typ || !(typ->status & _HAS_CHOICE)) + return FALSE; + + if (typ->status & _LINKED_TYPE) + { + assert(argp); + return( + Previous_Choice(typ->left ,field,argp->left) || + Previous_Choice(typ->right,field,argp->right)); + } + else + { + assert(typ->prev); + return typ->prev(field,(void *)argp); + } +} +/*---------------------------------------------------------------------------- + End of Helper routines for Choice Requests + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Routines for Choice Requests + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int CR_Next_Choice(FORM * form) +| +| Description : Get the next field choice. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - next choice couldn't be retrieved ++--------------------------------------------------------------------------*/ +static int CR_Next_Choice(FORM * form) +{ + FIELD *field = form->current; + Synchronize_Buffer(form); + return ((Next_Choice(field->type,field,(TypeArgument *)(field->arg))) ? + E_OK : E_REQUEST_DENIED); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int CR_Previous_Choice(FORM * form) +| +| Description : Get the previous field choice. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - prev. choice couldn't be retrieved ++--------------------------------------------------------------------------*/ +static int CR_Previous_Choice(FORM * form) +{ + FIELD *field = form->current; + Synchronize_Buffer(form); + return ((Previous_Choice(field->type,field,(TypeArgument *)(field->arg))) ? + E_OK : E_REQUEST_DENIED); +} +/*---------------------------------------------------------------------------- + End of Routines for Choice Requests + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Helper routines for Field Validations. + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Check_Field( +| FIELDTYPE * typ, +| FIELD * field, +| TypeArgument * argp) +| +| Description : Check the field according to its fieldtype and its +| actual arguments. For linked fieldtypes this is done +| recursively. +| +| Return Values : TRUE - field is valid +| FALSE - field is invalid. ++--------------------------------------------------------------------------*/ +static bool Check_Field(FIELDTYPE *typ, FIELD *field, TypeArgument *argp) +{ + if (typ) + { + if (field->opts & O_NULLOK) + { + char *bp = field->buf; + assert(bp); + while(is_blank(*bp)) + { bp++; } + if (*bp == '\0') + return TRUE; + } + + if (typ->status & _LINKED_TYPE) + { + assert(argp); + return( + Check_Field(typ->left ,field,argp->left ) || + Check_Field(typ->right,field,argp->right) ); + } + else + { + if (typ->fcheck) + return typ->fcheck(field,(void *)argp); + } + } + return TRUE; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : bool _nc_Internal_Validation(FORM * form ) +| +| Description : Validate the current field of the form. +| +| Return Values : TRUE - field is valid +| FALSE - field is invalid ++--------------------------------------------------------------------------*/ +bool +_nc_Internal_Validation(FORM *form) +{ + FIELD *field; + + field = form->current; + + Synchronize_Buffer(form); + if ((form->status & _FCHECK_REQUIRED) || + (!(field->opts & O_PASSOK))) + { + if (!Check_Field(field->type,field,(TypeArgument *)(field->arg))) + return FALSE; + form->status &= ~_FCHECK_REQUIRED; + field->status |= _CHANGED; + Synchronize_Linked_Fields(field); + } + return TRUE; +} +/*---------------------------------------------------------------------------- + End of Helper routines for Field Validations. + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Routines for Field Validation. + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FV_Validation(FORM * form) +| +| Description : Validate the current field of the form. +| +| Return Values : E_OK - field valid +| E_INVALID_FIELD - field not valid ++--------------------------------------------------------------------------*/ +static int FV_Validation(FORM * form) +{ + if (_nc_Internal_Validation(form)) + return E_OK; + else + return E_INVALID_FIELD; +} +/*---------------------------------------------------------------------------- + End of routines for Field Validation. + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Helper routines for Inter-Field Navigation + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static FIELD *Next_Field_On_Page(FIELD * field) +| +| Description : Get the next field after the given field on the current +| page. The order of fields is the one defined by the +| fields array. Only visible and active fields are +| counted. +| +| Return Values : Pointer to the next field. ++--------------------------------------------------------------------------*/ +INLINE static FIELD *Next_Field_On_Page(FIELD * field) +{ + FORM *form = field->form; + FIELD **field_on_page = &form->field[field->index]; + FIELD **first_on_page = &form->field[form->page[form->curpage].pmin]; + FIELD **last_on_page = &form->field[form->page[form->curpage].pmax]; + + do + { + field_on_page = + (field_on_page==last_on_page) ? first_on_page : field_on_page + 1; + if (Field_Is_Selectable(*field_on_page)) + break; + } while(field!=(*field_on_page)); + return(*field_on_page); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : FIELD* _nc_First_Active_Field(FORM * form) +| +| Description : Get the first active field on the current page, +| if there are such. If there are none, get the first +| visible field on the page. If there are also none, +| we return the first field on page and hope the best. +| +| Return Values : Pointer to calculated field. ++--------------------------------------------------------------------------*/ +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); + + if (proposed == *last_on_page) + { /* there might be the special situation, where there is no + active and visible field on the current page. We then select + the first visible field on this readonly page + */ + if (Field_Is_Not_Selectable(proposed)) + { + FIELD **field = &form->field[proposed->index]; + FIELD **first = &form->field[form->page[form->curpage].pmin]; + + do + { + field = (field==last_on_page) ? first : field + 1; + if (((*field)->opts & O_VISIBLE)) + break; + } while(proposed!=(*field)); + + proposed = *field; + + if ((proposed == *last_on_page) && !(proposed->opts&O_VISIBLE)) + { /* This means, there is also no visible field on the page. + So we propose the first one and hope the very best... + Some very clever user has designed a readonly and invisible + page on this form. + */ + proposed = *first; + } + } + } + return(proposed); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static FIELD *Previous_Field_On_Page(FIELD * field) +| +| Description : Get the previous field before the given field on the +| current page. The order of fields is the one defined by +| the fields array. Only visible and active fields are +| counted. +| +| Return Values : Pointer to the previous field. ++--------------------------------------------------------------------------*/ +INLINE static FIELD *Previous_Field_On_Page(FIELD * field) +{ + FORM *form = field->form; + FIELD **field_on_page = &form->field[field->index]; + FIELD **first_on_page = &form->field[form->page[form->curpage].pmin]; + FIELD **last_on_page = &form->field[form->page[form->curpage].pmax]; + + do + { + field_on_page = + (field_on_page==first_on_page) ? last_on_page : field_on_page - 1; + if (Field_Is_Selectable(*field_on_page)) + break; + } while(field!=(*field_on_page)); + + return (*field_on_page); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static FIELD *Sorted_Next_Field(FIELD * field) +| +| Description : Get the next field after the given field on the current +| page. The order of fields is the one defined by the +| (row,column) geometry, rows are major. +| +| Return Values : Pointer to the next field. ++--------------------------------------------------------------------------*/ +INLINE static FIELD *Sorted_Next_Field(FIELD * field) +{ + FIELD *field_on_page = field; + + do + { + field_on_page = field_on_page->snext; + if (Field_Is_Selectable(field_on_page)) + break; + } while(field_on_page!=field); + + return (field_on_page); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static FIELD *Sorted_Previous_Field(FIELD * field) +| +| Description : Get the previous field before the given field on the +| current page. The order of fields is the one defined +| by the (row,column) geometry, rows are major. +| +| Return Values : Pointer to the previous field. ++--------------------------------------------------------------------------*/ +INLINE static FIELD *Sorted_Previous_Field(FIELD * field) +{ + FIELD *field_on_page = field; + + do + { + field_on_page = field_on_page->sprev; + if (Field_Is_Selectable(field_on_page)) + break; + } while(field_on_page!=field); + + return (field_on_page); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static FIELD *Left_Neighbour_Field(FIELD * field) +| +| Description : Get the left neighbour of the field on the same line +| and the same page. Cycles through the line. +| +| Return Values : Pointer to left neighbour field. ++--------------------------------------------------------------------------*/ +INLINE static FIELD *Left_Neighbour_Field(FIELD * field) +{ + FIELD *field_on_page = field; + + /* For a field that has really a left neighbour, the while clause + immediately fails and the loop is left, positioned at the right + neighbour. Otherwise we cycle backwards through the sorted fieldlist + until we enter the same line (from the right end). + */ + do + { + field_on_page = Sorted_Previous_Field(field_on_page); + } while(field_on_page->frow != field->frow); + + return (field_on_page); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static FIELD *Right_Neighbour_Field(FIELD * field) +| +| Description : Get the right neighbour of the field on the same line +| and the same page. +| +| Return Values : Pointer to right neighbour field. ++--------------------------------------------------------------------------*/ +INLINE static FIELD *Right_Neighbour_Field(FIELD * field) +{ + FIELD *field_on_page = field; + + /* See the comments on Left_Neighbour_Field to understand how it works */ + do + { + field_on_page = Sorted_Next_Field(field_on_page); + } while(field_on_page->frow != field->frow); + + return (field_on_page); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static FIELD *Upper_Neighbour_Field(FIELD * field) +| +| Description : Because of the row-major nature of sorting the fields, +| its more difficult to define whats the upper neighbour +| field really means. We define that it must be on a +| 'previous' line (cyclic order!) and is the rightmost +| field laying on the left side of the given field. If +| this set is empty, we take the first field on the line. +| +| Return Values : Pointer to the upper neighbour field. ++--------------------------------------------------------------------------*/ +static FIELD *Upper_Neighbour_Field(FIELD * field) +{ + FIELD *field_on_page = field; + int frow = field->frow; + int fcol = field->fcol; + + /* Walk back to the 'previous' line. The second term in the while clause + just guarantees that we stop if we cycled through the line because + there might be no 'previous' line if the page has just one line. + */ + do + { + field_on_page = Sorted_Previous_Field(field_on_page); + } while(field_on_page->frow==frow && field_on_page->fcol!=fcol); + + if (field_on_page->frow!=frow) + { /* We really found a 'previous' line. We are positioned at the + rightmost field on this line */ + frow = field_on_page->frow; + + /* We walk to the left as long as we are really right of the + field. */ + while(field_on_page->frow==frow && field_on_page->fcol>fcol) + field_on_page = Sorted_Previous_Field(field_on_page); + + /* If we wrapped, just go to the right which is the first field on + the row */ + if (field_on_page->frow!=frow) + field_on_page = Sorted_Next_Field(field_on_page); + } + + return (field_on_page); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static FIELD *Down_Neighbour_Field(FIELD * field) +| +| Description : Because of the row-major nature of sorting the fields, +| its more difficult to define whats the down neighbour +| field really means. We define that it must be on a +| 'next' line (cyclic order!) and is the leftmost +| field laying on the right side of the given field. If +| this set is empty, we take the last field on the line. +| +| Return Values : Pointer to the upper neighbour field. ++--------------------------------------------------------------------------*/ +static FIELD *Down_Neighbour_Field(FIELD * field) +{ + FIELD *field_on_page = field; + int frow = field->frow; + int fcol = field->fcol; + + /* Walk forward to the 'next' line. The second term in the while clause + just guarantees that we stop if we cycled through the line because + there might be no 'next' line if the page has just one line. + */ + do + { + field_on_page = Sorted_Next_Field(field_on_page); + } while(field_on_page->frow==frow && field_on_page->fcol!=fcol); + + if (field_on_page->frow!=frow) + { /* We really found a 'next' line. We are positioned at the rightmost + field on this line */ + frow = field_on_page->frow; + + /* We walk to the right as long as we are really left of the + field. */ + while(field_on_page->frow==frow && field_on_page->fcol<fcol) + field_on_page = Sorted_Next_Field(field_on_page); + + /* If we wrapped, just go to the left which is the last field on + the row */ + if (field_on_page->frow!=frow) + field_on_page = Sorted_Previous_Field(field_on_page); + } + + return(field_on_page); +} + +/*---------------------------------------------------------------------------- + Inter-Field Navigation routines + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Inter_Field_Navigation( +| int (* const fct) (FORM *), +| FORM * form) +| +| Description : Generic behaviour for changing the current field, the +| field is left and a new field is entered. So the field +| must be validated and the field init/term hooks must +| be called. +| +| Return Values : E_OK - success +| E_INVALID_FIELD - field is invalid +| some other - error from subordinate call ++--------------------------------------------------------------------------*/ +static int Inter_Field_Navigation(int (* const fct) (FORM *),FORM *form) +{ + int res; + + if (!_nc_Internal_Validation(form)) + res = E_INVALID_FIELD; + else + { + Call_Hook(form,fieldterm); + res = fct(form); + Call_Hook(form,fieldinit); + } + return res; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FN_Next_Field(FORM * form) +| +| Description : Move to the next field on the current page of the form +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int FN_Next_Field(FORM * form) +{ + return _nc_Set_Current_Field(form, + Next_Field_On_Page(form->current)); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FN_Previous_Field(FORM * form) +| +| Description : Move to the previous field on the current page of the +| form +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int FN_Previous_Field(FORM * form) +{ + return _nc_Set_Current_Field(form, + Previous_Field_On_Page(form->current)); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FN_First_Field(FORM * form) +| +| Description : Move to the first field on the current page of the form +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int FN_First_Field(FORM * form) +{ + return _nc_Set_Current_Field(form, + Next_Field_On_Page(form->field[form->page[form->curpage].pmax])); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FN_Last_Field(FORM * form) +| +| Description : Move to the last field on the current page of the form +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int FN_Last_Field(FORM * form) +{ + return + _nc_Set_Current_Field(form, + Previous_Field_On_Page(form->field[form->page[form->curpage].pmin])); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FN_Sorted_Next_Field(FORM * form) +| +| Description : Move to the sorted next field on the current page +| of the form. +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int FN_Sorted_Next_Field(FORM * form) +{ + return _nc_Set_Current_Field(form, + Sorted_Next_Field(form->current)); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FN_Sorted_Previous_Field(FORM * form) +| +| Description : Move to the sorted previous field on the current page +| of the form. +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int FN_Sorted_Previous_Field(FORM * form) +{ + return _nc_Set_Current_Field(form, + Sorted_Previous_Field(form->current)); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FN_Sorted_First_Field(FORM * form) +| +| Description : Move to the sorted first field on the current page +| of the form. +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int FN_Sorted_First_Field(FORM * form) +{ + return _nc_Set_Current_Field(form, + Sorted_Next_Field(form->field[form->page[form->curpage].smax])); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FN_Sorted_Last_Field(FORM * form) +| +| Description : Move to the sorted last field on the current page +| of the form. +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int FN_Sorted_Last_Field(FORM * form) +{ + return _nc_Set_Current_Field(form, + Sorted_Previous_Field(form->field[form->page[form->curpage].smin])); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FN_Left_Field(FORM * form) +| +| Description : Get the field on the left of the current field on the +| same line and the same page. Cycles through the line. +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int FN_Left_Field(FORM * form) +{ + return _nc_Set_Current_Field(form, + Left_Neighbour_Field(form->current)); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FN_Right_Field(FORM * form) +| +| Description : Get the field on the right of the current field on the +| same line and the same page. Cycles through the line. +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int FN_Right_Field(FORM * form) +{ + return _nc_Set_Current_Field(form, + Right_Neighbour_Field(form->current)); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FN_Up_Field(FORM * form) +| +| Description : Get the upper neighbour of the current field. This +| cycles through the page. See the comments of the +| Upper_Neighbour_Field function to understand how +| 'upper' is defined. +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int FN_Up_Field(FORM * form) +{ + return _nc_Set_Current_Field(form, + Upper_Neighbour_Field(form->current)); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int FN_Down_Field(FORM * form) +| +| Description : Get the down neighbour of the current field. This +| cycles through the page. See the comments of the +| Down_Neighbour_Field function to understand how +| 'down' is defined. +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int FN_Down_Field(FORM * form) +{ + return _nc_Set_Current_Field(form, + Down_Neighbour_Field(form->current)); +} +/*---------------------------------------------------------------------------- + END of Field Navigation routines + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Helper routines for Page Navigation + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int _nc_Set_Form_Page(FORM * form, +| int page, +| FIELD * field) +| +| Description : Make the given page nr. the current page and make +| the given field the current field on the page. If +| for the field NULL is given, make the first field on +| the page the current field. The routine acts only +| if the requested page is not the current page. +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +int +_nc_Set_Form_Page(FORM * form, int page, FIELD * field) +{ + int res = E_OK; + + if ((form->curpage!=page)) + { + FIELD *last_field, *field_on_page; + + werase(Get_Form_Window(form)); + form->curpage = page; + last_field = field_on_page = form->field[form->page[page].smin]; + do + { + if (field_on_page->opts & O_VISIBLE) + if ((res=Display_Field(field_on_page))!=E_OK) + return(res); + field_on_page = field_on_page->snext; + } while(field_on_page != last_field); + + if (field) + res = _nc_Set_Current_Field(form,field); + else + /* N.B.: we don't encapsulate this by Inter_Field_Navigation(), + because this is already executed in a page navigation + context that contains field navigation + */ + res = FN_First_Field(form); + } + return(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Next_Page_Number(const FORM * form) +| +| Description : Calculate the page number following the current page +| number. This cycles if the highest page number is +| reached. +| +| Return Values : The next page number ++--------------------------------------------------------------------------*/ +INLINE static int Next_Page_Number(const FORM * form) +{ + return (form->curpage + 1) % form->maxpage; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Previous_Page_Number(const FORM * form) +| +| Description : Calculate the page number before the current page +| number. This cycles if the first page number is +| reached. +| +| Return Values : The previous page number ++--------------------------------------------------------------------------*/ +INLINE static int Previous_Page_Number(const FORM * form) +{ + return (form->curpage!=0 ? form->curpage - 1 : form->maxpage - 1); +} + +/*---------------------------------------------------------------------------- + Page Navigation routines + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Page_Navigation( +| int (* const fct) (FORM *), +| FORM * form) +| +| Description : Generic behaviour for changing a page. This means +| that the field is left and a new field is entered. +| So the field must be validated and the field init/term +| hooks must be called. Because also the page is changed, +| the forms init/term hooks must be called also. +| +| Return Values : E_OK - success +| E_INVALID_FIELD - field is invalid +| some other - error from subordinate call ++--------------------------------------------------------------------------*/ +static int Page_Navigation(int (* const fct) (FORM *), FORM * form) +{ + int res; + + if (!_nc_Internal_Validation(form)) + res = E_INVALID_FIELD; + else + { + Call_Hook(form,fieldterm); + Call_Hook(form,formterm); + res = fct(form); + Call_Hook(form,forminit); + Call_Hook(form,fieldinit); + } + return res; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int PN_Next_Page(FORM * form) +| +| Description : Move to the next page of the form +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int PN_Next_Page(FORM * form) +{ + return _nc_Set_Form_Page(form,Next_Page_Number(form),(FIELD *)0); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int PN_Previous_Page(FORM * form) +| +| Description : Move to the previous page of the form +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int PN_Previous_Page(FORM * form) +{ + return _nc_Set_Form_Page(form,Previous_Page_Number(form),(FIELD *)0); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int PN_First_Page(FORM * form) +| +| Description : Move to the first page of the form +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int PN_First_Page(FORM * form) +{ + return _nc_Set_Form_Page(form,0,(FIELD *)0); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int PN_Last_Page(FORM * form) +| +| Description : Move to the last page of the form +| +| Return Values : E_OK - success +| != E_OK - error from subordinate call ++--------------------------------------------------------------------------*/ +static int PN_Last_Page(FORM * form) +{ + return _nc_Set_Form_Page(form,form->maxpage-1,(FIELD *)0); +} +/*---------------------------------------------------------------------------- + END of Field Navigation routines + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Helper routines for the core form driver. + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Data_Entry(FORM * form,int c) +| +| Description : Enter character c into at the current position of the +| current field of the form. +| +| Return Values : E_OK - +| E_REQUEST_DENIED - +| E_SYSTEM_ERROR - ++--------------------------------------------------------------------------*/ +static int Data_Entry(FORM * form, int c) +{ + FIELD *field = form->current; + int result = E_REQUEST_DENIED; + + if ( (field->opts & O_EDIT) +#if FIX_FORM_INACTIVE_BUG + && (field->opts & O_ACTIVE) +#endif + ) + { + if ( (field->opts & O_BLANK) && + First_Position_In_Current_Field(form) && + !(form->status & _FCHECK_REQUIRED) && + !(form->status & _WINDOW_MODIFIED) ) + werase(form->w); + + if (form->status & _OVLMODE) + { + waddch(form->w,(chtype)c); + } + else /* no _OVLMODE */ + { + bool There_Is_Room = Is_There_Room_For_A_Char_In_Line(form); + + if (!(There_Is_Room || + ((Single_Line_Field(field) && Growable(field))))) + return E_REQUEST_DENIED; + + if (!There_Is_Room && !Field_Grown(field,1)) + return E_SYSTEM_ERROR; + + winsch(form->w,(chtype)c); + } + + if ((result=Wrapping_Not_Necessary_Or_Wrapping_Ok(form))==E_OK) + { + bool End_Of_Field= (((field->drows-1)==form->currow) && + ((field->dcols-1)==form->curcol)); + form->status |= _WINDOW_MODIFIED; + if (End_Of_Field && !Growable(field) && (field->opts & O_AUTOSKIP)) + result = Inter_Field_Navigation(FN_Next_Field,form); + else + { + if (End_Of_Field && Growable(field) && !Field_Grown(field,1)) + result = E_SYSTEM_ERROR; + else + { + IFN_Next_Character(form); + result = E_OK; + } + } + } + } + return result; +} + +/* Structure to describe the binding of a request code to a function. + The member keycode codes the request value as well as the generic + routine to use for the request. The code for the generic routine + is coded in the upper 16 Bits while the request code is coded in + the lower 16 bits. + + In terms of C++ you might think of a request as a class with a + virtual method "perform". The different types of request are + derived from this base class and overload (or not) the base class + implementation of perform. +*/ +typedef struct { + int keycode; /* must be at least 32 bit: hi:mode, lo: key */ + int (*cmd)(FORM *); /* low level driver routine for this key */ +} Binding_Info; + +/* You may see this is the class-id of the request type class */ +#define ID_PN (0x00000000) /* Page navigation */ +#define ID_FN (0x00010000) /* Inter-Field navigation */ +#define ID_IFN (0x00020000) /* Intra-Field navigation */ +#define ID_VSC (0x00030000) /* Vertical Scrolling */ +#define ID_HSC (0x00040000) /* Horizontal Scrolling */ +#define ID_FE (0x00050000) /* Field Editing */ +#define ID_EM (0x00060000) /* Edit Mode */ +#define ID_FV (0x00070000) /* Field Validation */ +#define ID_CH (0x00080000) /* Choice */ +#define ID_Mask (0xffff0000) +#define Key_Mask (0x0000ffff) +#define ID_Shft (16) + +/* This array holds all the Binding Infos */ +static const Binding_Info bindings[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] = +{ + { REQ_NEXT_PAGE |ID_PN ,PN_Next_Page}, + { REQ_PREV_PAGE |ID_PN ,PN_Previous_Page}, + { REQ_FIRST_PAGE |ID_PN ,PN_First_Page}, + { REQ_LAST_PAGE |ID_PN ,PN_Last_Page}, + + { REQ_NEXT_FIELD |ID_FN ,FN_Next_Field}, + { REQ_PREV_FIELD |ID_FN ,FN_Previous_Field}, + { REQ_FIRST_FIELD |ID_FN ,FN_First_Field}, + { REQ_LAST_FIELD |ID_FN ,FN_Last_Field}, + { REQ_SNEXT_FIELD |ID_FN ,FN_Sorted_Next_Field}, + { REQ_SPREV_FIELD |ID_FN ,FN_Sorted_Previous_Field}, + { REQ_SFIRST_FIELD |ID_FN ,FN_Sorted_First_Field}, + { REQ_SLAST_FIELD |ID_FN ,FN_Sorted_Last_Field}, + { REQ_LEFT_FIELD |ID_FN ,FN_Left_Field}, + { REQ_RIGHT_FIELD |ID_FN ,FN_Right_Field}, + { REQ_UP_FIELD |ID_FN ,FN_Up_Field}, + { REQ_DOWN_FIELD |ID_FN ,FN_Down_Field}, + + { REQ_NEXT_CHAR |ID_IFN ,IFN_Next_Character}, + { REQ_PREV_CHAR |ID_IFN ,IFN_Previous_Character}, + { REQ_NEXT_LINE |ID_IFN ,IFN_Next_Line}, + { REQ_PREV_LINE |ID_IFN ,IFN_Previous_Line}, + { REQ_NEXT_WORD |ID_IFN ,IFN_Next_Word}, + { REQ_PREV_WORD |ID_IFN ,IFN_Previous_Word}, + { REQ_BEG_FIELD |ID_IFN ,IFN_Beginning_Of_Field}, + { REQ_END_FIELD |ID_IFN ,IFN_End_Of_Field}, + { REQ_BEG_LINE |ID_IFN ,IFN_Beginning_Of_Line}, + { REQ_END_LINE |ID_IFN ,IFN_End_Of_Line}, + { REQ_LEFT_CHAR |ID_IFN ,IFN_Left_Character}, + { REQ_RIGHT_CHAR |ID_IFN ,IFN_Right_Character}, + { REQ_UP_CHAR |ID_IFN ,IFN_Up_Character}, + { REQ_DOWN_CHAR |ID_IFN ,IFN_Down_Character}, + + { REQ_NEW_LINE |ID_FE ,FE_New_Line}, + { REQ_INS_CHAR |ID_FE ,FE_Insert_Character}, + { REQ_INS_LINE |ID_FE ,FE_Insert_Line}, + { REQ_DEL_CHAR |ID_FE ,FE_Delete_Character}, + { REQ_DEL_PREV |ID_FE ,FE_Delete_Previous}, + { REQ_DEL_LINE |ID_FE ,FE_Delete_Line}, + { REQ_DEL_WORD |ID_FE ,FE_Delete_Word}, + { REQ_CLR_EOL |ID_FE ,FE_Clear_To_End_Of_Line}, + { REQ_CLR_EOF |ID_FE ,FE_Clear_To_End_Of_Form}, + { REQ_CLR_FIELD |ID_FE ,FE_Clear_Field}, + + { REQ_OVL_MODE |ID_EM ,EM_Overlay_Mode}, + { REQ_INS_MODE |ID_EM ,EM_Insert_Mode}, + + { REQ_SCR_FLINE |ID_VSC ,VSC_Scroll_Line_Forward}, + { REQ_SCR_BLINE |ID_VSC ,VSC_Scroll_Line_Backward}, + { REQ_SCR_FPAGE |ID_VSC ,VSC_Scroll_Page_Forward}, + { REQ_SCR_BPAGE |ID_VSC ,VSC_Scroll_Page_Backward}, + { REQ_SCR_FHPAGE |ID_VSC ,VSC_Scroll_Half_Page_Forward}, + { REQ_SCR_BHPAGE |ID_VSC ,VSC_Scroll_Half_Page_Backward}, + + { REQ_SCR_FCHAR |ID_HSC ,HSC_Scroll_Char_Forward}, + { REQ_SCR_BCHAR |ID_HSC ,HSC_Scroll_Char_Backward}, + { REQ_SCR_HFLINE |ID_HSC ,HSC_Horizontal_Line_Forward}, + { REQ_SCR_HBLINE |ID_HSC ,HSC_Horizontal_Line_Backward}, + { REQ_SCR_HFHALF |ID_HSC ,HSC_Horizontal_Half_Line_Forward}, + { REQ_SCR_HBHALF |ID_HSC ,HSC_Horizontal_Half_Line_Backward}, + + { REQ_VALIDATION |ID_FV ,FV_Validation}, + + { REQ_NEXT_CHOICE |ID_CH ,CR_Next_Choice}, + { REQ_PREV_CHOICE |ID_CH ,CR_Previous_Choice} +}; + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int form_driver(FORM * form,int c) +| +| Description : This is the workhorse of the forms system. It checks +| to determine whether the character c is a request or +| data. If it is a request, the form driver executes +| the request and returns the result. If it is data +| (printable character), it enters the data into the +| current position in the current field. If it is not +| recognized, the form driver assumes it is an application +| defined command and returns E_UNKNOWN_COMMAND. +| Application defined command should be defined relative +| to MAX_FORM_COMMAND, the maximum value of a request. +| +| Return Values : E_OK - success +| E_SYSTEM_ERROR - system error +| E_BAD_ARGUMENT - an argument is incorrect +| E_NOT_POSTED - form is not posted +| E_INVALID_FIELD - field contents are invalid +| E_BAD_STATE - called from inside a hook routine +| E_REQUEST_DENIED - request failed +| E_UNKNOWN_COMMAND - command not known ++--------------------------------------------------------------------------*/ +int form_driver(FORM * form, int c) +{ + const Binding_Info* BI = (Binding_Info *)0; + int res = E_UNKNOWN_COMMAND; + + if (!form) + RETURN(E_BAD_ARGUMENT); + + if (!(form->field)) + RETURN(E_NOT_CONNECTED); + + assert(form->page); + + if (c==FIRST_ACTIVE_MAGIC) + { + form->current = _nc_First_Active_Field(form); + return E_OK; + } + + assert(form->current && + form->current->buf && + (form->current->form == form) + ); + + if ( form->status & _IN_DRIVER ) + RETURN(E_BAD_STATE); + + if ( !( form->status & _POSTED ) ) + RETURN(E_NOT_POSTED); + + if ((c>=MIN_FORM_COMMAND && c<=MAX_FORM_COMMAND) && + ((bindings[c-MIN_FORM_COMMAND].keycode & Key_Mask) == c)) + BI = &(bindings[c-MIN_FORM_COMMAND]); + + if (BI) + { + typedef int (*Generic_Method)(int (* const)(FORM *),FORM *); + static const Generic_Method Generic_Methods[] = + { + Page_Navigation, /* overloaded to call field&form hooks */ + Inter_Field_Navigation, /* overloaded to call field hooks */ + NULL, /* Intra-Field is generic */ + Vertical_Scrolling, /* Overloaded to check multi-line */ + Horizontal_Scrolling, /* Overloaded to check single-line */ + Field_Editing, /* Overloaded to mark modification */ + NULL, /* Edit Mode is generic */ + NULL, /* Field Validation is generic */ + NULL /* Choice Request is generic */ + }; + size_t nMethods = (sizeof(Generic_Methods)/sizeof(Generic_Methods[0])); + size_t method = ((BI->keycode & ID_Mask) >> ID_Shft) & 0xffff; + + if ( (method >= nMethods) || !(BI->cmd) ) + res = E_SYSTEM_ERROR; + else + { + Generic_Method fct = Generic_Methods[method]; + if (fct) + res = fct(BI->cmd,form); + else + res = (BI->cmd)(form); + } + } + else + { + if (!(c & (~(int)MAX_REGULAR_CHARACTER)) && + isprint((unsigned char)c) && + Check_Char(form->current->type,c, + (TypeArgument *)(form->current->arg))) + res = Data_Entry(form,c); + } + _nc_Refresh_Current_Field(form); + RETURN(res); +} + +/*---------------------------------------------------------------------------- + Field-Buffer manipulation routines. + The effects of setting a buffer is tightly coupled to the core of the form + driver logic. This is especially true in the case of growable fields. + So I don't separate this into an own module. + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_buffer(FIELD *field, +| int buffer, char *value) +| +| Description : Set the given buffer of the field to the given value. +| Buffer 0 stores the displayed content of the field. +| For dynamic fields this may grow the fieldbuffers if +| the length of the value exceeds the current buffer +| length. For buffer 0 only printable values are allowed. +| For static fields, the value needs not to be zero ter- +| minated. It is copied up to the length of the buffer. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid argument +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int set_field_buffer(FIELD * field, int buffer, const char * value) +{ + char *s, *p; + int res = E_OK; + unsigned int len; + + if ( !field || !value || ((buffer < 0)||(buffer > field->nbuf)) ) + RETURN(E_BAD_ARGUMENT); + + len = Buffer_Length(field); + + if (buffer==0) + { + const char *v; + unsigned int i = 0; + + for(v=value; *v && (i<len); v++,i++) + { + if (!isprint((unsigned char)*v)) + RETURN(E_BAD_ARGUMENT); + } + } + + if (Growable(field)) + { + /* for a growable field we must assume zero terminated strings, because + somehow we have to detect the length of what should be copied. + */ + unsigned int vlen = strlen(value); + if (vlen > len) + { + if (!Field_Grown(field, + (int)(1 + (vlen-len)/((field->rows+field->nrow)*field->cols)))) + RETURN(E_SYSTEM_ERROR); + + /* in this case we also have to check, wether or not the remaining + characters in value are also printable for buffer 0. */ + if (buffer==0) + { + unsigned int i; + + for(i=len; i<vlen; i++) + if (!isprint(value[i])) + RETURN(E_BAD_ARGUMENT); + } + len = vlen; + } + } + + p = Address_Of_Nth_Buffer(field,buffer); + +#if HAVE_MEMCCPY + s = memccpy(p,value,0,len); +#else + for(s=(char *)value; *s && (s < (value+len)); s++) + p[s-value] = *s; + if (s < (value+len)) + { + p[s-value] = *s++; + s = p + (s-value); + } + else + s=(char *)0; +#endif + + if (s) + { /* this means, value was null terminated and not greater than the + buffer. We have to pad with blanks. Please note that due to memccpy + logic s points after the terminating null. */ + s--; /* now we point to the terminator. */ + assert(len >= (unsigned int)(s-p)); + if (len > (unsigned int)(s-p)) + memset(s,C_BLANK,len-(unsigned int)(s-p)); + } + + if (buffer==0) + { + int syncres; + if (((syncres=Synchronize_Field( field ))!=E_OK) && + (res==E_OK)) + res = syncres; + if (((syncres=Synchronize_Linked_Fields(field ))!=E_OK) && + (res==E_OK)) + res = syncres; + } + RETURN(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : char *field_buffer(const FIELD *field,int buffer) +| +| Description : Return the address of the buffer for the field. +| +| Return Values : Pointer to buffer or NULL if arguments were invalid. ++--------------------------------------------------------------------------*/ +char *field_buffer(const FIELD * field, int buffer) +{ + if (field && (buffer >= 0) && (buffer <= field->nbuf)) + return Address_Of_Nth_Buffer(field,buffer); + else + return (char *)0; +} + +/* frm_driver.c ends here */ diff --git a/contrib/ncurses/form/frm_hook.c b/contrib/ncurses/form/frm_hook.c new file mode 100644 index 000000000000..5a5ec29376b2 --- /dev/null +++ b/contrib/ncurses/form/frm_hook.c @@ -0,0 +1,140 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_hook.c,v 1.8 1999/05/16 17:21:04 juergen 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)\ +{\ + (Normalize_Form( form ) -> typ ## name) = func ;\ + RETURN(E_OK);\ +} + +/* "Template" macro to generate function to get application specific hook */ +#define GEN_HOOK_GET_FUNCTION( typ, name ) \ +Form_Hook typ ## _ ## name ( const FORM *form )\ +{\ + return ( Normalize_Form( form ) -> typ ## name );\ +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_init(FORM *form, Form_Hook f) +| +| Description : Assigns an application defined initialization function +| to be called when the form is posted and just after +| the current field changes. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +GEN_HOOK_SET_FUNCTION(field,init) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : Form_Hook field_init(const FORM *form) +| +| Description : Retrieve field initialization routine address. +| +| Return Values : The address or NULL if no hook defined. ++--------------------------------------------------------------------------*/ +GEN_HOOK_GET_FUNCTION(field,init) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_field_term(FORM *form, Form_Hook f) +| +| Description : Assigns an application defined finalization function +| to be called when the form is unposted and just before +| the current field changes. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +GEN_HOOK_SET_FUNCTION(field,term) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : Form_Hook field_term(const FORM *form) +| +| Description : Retrieve field finalization routine address. +| +| Return Values : The address or NULL if no hook defined. ++--------------------------------------------------------------------------*/ +GEN_HOOK_GET_FUNCTION(field,term) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_form_init(FORM *form, Form_Hook f) +| +| Description : Assigns an application defined initialization function +| to be called when the form is posted and just after +| a page change. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +GEN_HOOK_SET_FUNCTION(form,init) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : Form_Hook form_init(const FORM *form) +| +| Description : Retrieve form initialization routine address. +| +| Return Values : The address or NULL if no hook defined. ++--------------------------------------------------------------------------*/ +GEN_HOOK_GET_FUNCTION(form,init) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_form_term(FORM *form, Form_Hook f) +| +| Description : Assigns an application defined finalization function +| to be called when the form is unposted and just before +| a page change. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +GEN_HOOK_SET_FUNCTION(form,term) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : Form_Hook form_term(const FORM *form) +| +| Description : Retrieve form finalization routine address. +| +| Return Values : The address or NULL if no hook defined. ++--------------------------------------------------------------------------*/ +GEN_HOOK_GET_FUNCTION(form,term) + +/* frm_hook.c ends here */ diff --git a/contrib/ncurses/form/frm_opts.c b/contrib/ncurses/form/frm_opts.c new file mode 100644 index 000000000000..009c189741ba --- /dev/null +++ b/contrib/ncurses/form/frm_opts.c @@ -0,0 +1,116 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_opts.c,v 1.8 1999/05/16 17:38:05 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_form_opts(FORM *form, Form_Options opts) +| +| Description : Turns on the named options and turns off all the +| remaining options for that form. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid options ++--------------------------------------------------------------------------*/ +int set_form_opts(FORM * form, Form_Options opts) +{ + opts &= ALL_FORM_OPTS; + if (opts & ~ALL_FORM_OPTS) + RETURN(E_BAD_ARGUMENT); + else + { + Normalize_Form( form )->opts = opts; + RETURN(E_OK); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : Form_Options form_opts(const FORM *) +| +| Description : Retrieves the current form options. +| +| Return Values : The option flags. ++--------------------------------------------------------------------------*/ +Form_Options form_opts(const FORM * form) +{ + return (Normalize_Form(form)->opts & ALL_FORM_OPTS); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int form_opts_on(FORM *form, Form_Options opts) +| +| Description : Turns on the named options; no other options are +| changed. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid options ++--------------------------------------------------------------------------*/ +int form_opts_on(FORM * form, Form_Options opts) +{ + opts &= ALL_FORM_OPTS; + if (opts & ~ALL_FORM_OPTS) + RETURN(E_BAD_ARGUMENT); + else + { + Normalize_Form( form )->opts |= opts; + RETURN(E_OK); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int form_opts_off(FORM *form, Form_Options opts) +| +| Description : Turns off the named options; no other options are +| changed. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid options ++--------------------------------------------------------------------------*/ +int form_opts_off(FORM * form, Form_Options opts) +{ + opts &= ALL_FORM_OPTS; + if (opts & ~ALL_FORM_OPTS) + RETURN(E_BAD_ARGUMENT); + else + { + Normalize_Form(form)->opts &= ~opts; + RETURN(E_OK); + } +} + +/* frm_opts.c ends here */ diff --git a/contrib/ncurses/form/frm_page.c b/contrib/ncurses/form/frm_page.c new file mode 100644 index 000000000000..5136542e8459 --- /dev/null +++ b/contrib/ncurses/form/frm_page.c @@ -0,0 +1,100 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_page.c,v 1.5 1999/05/16 17:21:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_form_page(FORM * form,int page) +| +| Description : Set the page number of the form. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid form pointer or page number +| E_BAD_STATE - called from a hook routine +| E_INVALID_FIELD - current field can't be left +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int set_form_page(FORM * form, int page) +{ + int err = E_OK; + + if ( !form || (page<0) || (page>=form->maxpage) ) + RETURN(E_BAD_ARGUMENT); + + if (!(form->status & _POSTED)) + { + form->curpage = page; + form->current = _nc_First_Active_Field(form); + } + else + { + if (form->status & _IN_DRIVER) + err = E_BAD_STATE; + else + { + if (form->curpage != page) + { + if (!_nc_Internal_Validation(form)) + err = E_INVALID_FIELD; + else + { + Call_Hook(form,fieldterm); + Call_Hook(form,formterm); + err = _nc_Set_Form_Page(form,page,(FIELD *)0); + Call_Hook(form,forminit); + Call_Hook(form,fieldinit); + _nc_Refresh_Current_Field(form); + } + } + } + } + RETURN(err); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int form_page(const FORM * form) +| +| Description : Return the current page of the form. +| +| Return Values : >= 0 : current page number +| -1 : invalid form pointer ++--------------------------------------------------------------------------*/ +int form_page(const FORM * form) +{ + return Normalize_Form(form)->curpage; +} + +/* frm_page.c ends here */ diff --git a/contrib/ncurses/form/frm_post.c b/contrib/ncurses/form/frm_post.c new file mode 100644 index 000000000000..3fdb57a09b8f --- /dev/null +++ b/contrib/ncurses/form/frm_post.c @@ -0,0 +1,117 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: frm_post.c,v 1.4 1999/05/16 17:21:39 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int post_form(FORM * form) +| +| Description : Writes the form into its associated subwindow. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid form pointer +| E_POSTED - form already posted +| E_NOT_CONNECTED - no fields connected to form +| E_NO_ROOM - form doesn't fit into subwindow +| E_SYSTEM_ERROR - system error ++--------------------------------------------------------------------------*/ +int post_form(FORM * form) +{ + WINDOW *formwin; + int err; + int page; + + if (!form) + RETURN(E_BAD_ARGUMENT); + + if (form->status & _POSTED) + RETURN(E_POSTED); + + if (!(form->field)) + RETURN(E_NOT_CONNECTED); + + formwin = Get_Form_Window(form); + if ((form->cols > getmaxx(formwin)) || (form->rows > getmaxy(formwin))) + RETURN(E_NO_ROOM); + + /* reset form->curpage to an invald value. This forces Set_Form_Page + to do the page initialization which is required by post_form. + */ + page = form->curpage; + form->curpage = -1; + if ((err = _nc_Set_Form_Page(form,page,form->current))!=E_OK) + RETURN(err); + + form->status |= _POSTED; + + Call_Hook(form,forminit); + Call_Hook(form,fieldinit); + + _nc_Refresh_Current_Field(form); + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int unpost_form(FORM * form) +| +| Description : Erase form from its associated subwindow. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid form pointer +| E_NOT_POSTED - form isn't posted +| E_BAD_STATE - called from a hook routine ++--------------------------------------------------------------------------*/ +int unpost_form(FORM * form) +{ + if (!form) + RETURN(E_BAD_ARGUMENT); + + if (!(form->status & _POSTED)) + RETURN(E_NOT_POSTED); + + if (form->status & _IN_DRIVER) + RETURN(E_BAD_STATE); + + Call_Hook(form,fieldterm); + Call_Hook(form,formterm); + + werase(Get_Form_Window(form)); + delwin(form->w); + form->w = (WINDOW *)0; + form->status &= ~_POSTED; + RETURN(E_OK); +} + +/* frm_post.c ends here */ diff --git a/contrib/ncurses/form/frm_req_name.c b/contrib/ncurses/form/frm_req_name.c new file mode 100644 index 000000000000..63006517ee85 --- /dev/null +++ b/contrib/ncurses/form/frm_req_name.c @@ -0,0 +1,163 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +/*************************************************************************** +* Module form_request_name * +* Routines to handle external names of menu requests * +***************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_req_name.c,v 1.7 1999/05/16 17:21:53 juergen Exp $") + +static const char *request_names[ MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1 ] = { + "NEXT_PAGE" , + "PREV_PAGE" , + "FIRST_PAGE" , + "LAST_PAGE" , + + "NEXT_FIELD" , + "PREV_FIELD" , + "FIRST_FIELD" , + "LAST_FIELD" , + "SNEXT_FIELD" , + "SPREV_FIELD" , + "SFIRST_FIELD" , + "SLAST_FIELD" , + "LEFT_FIELD" , + "RIGHT_FIELD" , + "UP_FIELD" , + "DOWN_FIELD" , + + "NEXT_CHAR" , + "PREV_CHAR" , + "NEXT_LINE" , + "PREV_LINE" , + "NEXT_WORD" , + "PREV_WORD" , + "BEG_FIELD" , + "END_FIELD" , + "BEG_LINE" , + "END_LINE" , + "LEFT_CHAR" , + "RIGHT_CHAR" , + "UP_CHAR" , + "DOWN_CHAR" , + + "NEW_LINE" , + "INS_CHAR" , + "INS_LINE" , + "DEL_CHAR" , + "DEL_PREV" , + "DEL_LINE" , + "DEL_WORD" , + "CLR_EOL" , + "CLR_EOF" , + "CLR_FIELD" , + "OVL_MODE" , + "INS_MODE" , + "SCR_FLINE" , + "SCR_BLINE" , + "SCR_FPAGE" , + "SCR_BPAGE" , + "SCR_FHPAGE" , + "SCR_BHPAGE" , + "SCR_FCHAR" , + "SCR_BCHAR" , + "SCR_HFLINE" , + "SCR_HBLINE" , + "SCR_HFHALF" , + "SCR_HBHALF" , + + "VALIDATION" , + "NEXT_CHOICE" , + "PREV_CHOICE" +}; +#define A_SIZE (sizeof(request_names)/sizeof(request_names[0])) + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : const char * form_request_name (int request); +| +| Description : Get the external name of a form request. +| +| Return Values : Pointer to name - on success +| NULL - on invalid request code ++--------------------------------------------------------------------------*/ +const char *form_request_name( int request ) +{ + if ( (request < MIN_FORM_COMMAND) || (request > MAX_FORM_COMMAND) ) + { + SET_ERROR (E_BAD_ARGUMENT); + return (const char *)0; + } + else + return request_names[ request - MIN_FORM_COMMAND ]; +} + + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int form_request_by_name (const char *str); +| +| Description : Search for a request with this name. +| +| Return Values : Request Id - on success +| E_NO_MATCH - request not found ++--------------------------------------------------------------------------*/ +int form_request_by_name( const char *str ) +{ + /* because the table is so small, it doesn't really hurt + to run sequentially through it. + */ + unsigned int i = 0; + char buf[16]; + + if (str) + { + strncpy(buf,str,sizeof(buf)); + while( (i<sizeof(buf)) && (buf[i] != '\0') ) + { + buf[i] = toupper(buf[i]); + i++; + } + + for (i=0; i < A_SIZE; i++) + { + if (strncmp(request_names[i],buf,sizeof(buf))==0) + return MIN_FORM_COMMAND + i; + } + } + RETURN(E_NO_MATCH); +} + +/* frm_req_name.c ends here */ diff --git a/contrib/ncurses/form/frm_scale.c b/contrib/ncurses/form/frm_scale.c new file mode 100644 index 000000000000..bb1971770987 --- /dev/null +++ b/contrib/ncurses/form/frm_scale.c @@ -0,0 +1,63 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_scale.c,v 1.4 1999/05/16 17:22:02 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int scale_form( const FORM *form, int *rows, int *cols ) +| +| Description : Retrieve size of form +| +| Return Values : E_OK - no error +| E_BAD_ARGUMENT - invalid form pointer +| E_NOT_CONNECTED - no fields connected to form ++--------------------------------------------------------------------------*/ +int scale_form(const FORM * form, int * rows, int * cols) +{ + if ( !form ) + RETURN(E_BAD_ARGUMENT); + + if ( !(form->field) ) + RETURN(E_NOT_CONNECTED); + + if (rows) + *rows = form->rows; + if (cols) + *cols = form->cols; + + RETURN(E_OK); +} + +/* frm_scale.c ends here */ diff --git a/contrib/ncurses/form/frm_sub.c b/contrib/ncurses/form/frm_sub.c new file mode 100644 index 000000000000..849f9cb0c3b2 --- /dev/null +++ b/contrib/ncurses/form/frm_sub.c @@ -0,0 +1,69 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_sub.c,v 1.4 1999/05/16 17:22:11 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_form_sub(FORM *form, WINDOW *win) +| +| Description : Set the subwindow of the form to win. +| +| Return Values : E_OK - success +| E_POSTED - form is posted ++--------------------------------------------------------------------------*/ +int set_form_sub(FORM * form, WINDOW * win) +{ + if (form && (form->status & _POSTED)) + RETURN(E_POSTED); + + Normalize_Form( form )->sub = win; + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : WINDOW *form_sub(const FORM *) +| +| Description : Retrieve the window of the form. +| +| Return Values : The pointer to the Subwindow. ++--------------------------------------------------------------------------*/ +WINDOW *form_sub(const FORM * form) +{ + const FORM* f = Normalize_Form( form ); + return Get_Form_Window(f); +} + +/* frm_sub.c ends here */ diff --git a/contrib/ncurses/form/frm_user.c b/contrib/ncurses/form/frm_user.c new file mode 100644 index 000000000000..853904f05413 --- /dev/null +++ b/contrib/ncurses/form/frm_user.c @@ -0,0 +1,67 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_user.c,v 1.8 1999/05/16 17:22:21 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_form_userptr(FORM *form, void *usrptr) +| +| Description : Set the pointer that is reserved in any form to store +| application relevant informations +| +| Return Values : E_OK - on success ++--------------------------------------------------------------------------*/ +int set_form_userptr(FORM * form, void *usrptr) +{ + Normalize_Form(form)->usrptr = usrptr; + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : void *form_userptr(const FORM *form) +| +| Description : Return the pointer that is reserved in any form to +| store application relevant informations. +| +| Return Values : Value of pointer. If no such pointer has been set, +| NULL is returned ++--------------------------------------------------------------------------*/ +void *form_userptr(const FORM * form) +{ + return Normalize_Form(form)->usrptr; +} + +/* frm_user.c ends here */ diff --git a/contrib/ncurses/form/frm_win.c b/contrib/ncurses/form/frm_win.c new file mode 100644 index 000000000000..b705d03314ba --- /dev/null +++ b/contrib/ncurses/form/frm_win.c @@ -0,0 +1,70 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_win.c,v 1.8 1999/05/16 17:22:32 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : int set_form_win(FORM *form,WINDOW *win) +| +| Description : Set the window of the form to win. +| +| Return Values : E_OK - success +| E_POSTED - form is posted ++--------------------------------------------------------------------------*/ +int set_form_win(FORM * form, WINDOW * win) +{ + if (form && (form->status & _POSTED)) + RETURN(E_POSTED); + + Normalize_Form( form )->win = win; + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : WINDOW *form_win(const FORM *) +| +| Description : Retrieve the window of the form. +| +| Return Values : The pointer to the Window or stdscr if there is none. ++--------------------------------------------------------------------------*/ +WINDOW *form_win(const FORM * form) +{ + const FORM* f = Normalize_Form( form ); + return (f->win ? f->win : stdscr); +} + +/* frm_win.c ends here */ + diff --git a/contrib/ncurses/form/fty_alnum.c b/contrib/ncurses/form/fty_alnum.c new file mode 100644 index 000000000000..cb3909d7b1c7 --- /dev/null +++ b/contrib/ncurses/form/fty_alnum.c @@ -0,0 +1,137 @@ + +/* + * THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT. + * You may freely copy it for use as a template for your own field types. + * If you develop a field type that might be of general use, please send + * it back to the ncurses maintainers for inclusion in the next version. + */ +/*************************************************************************** +* * +* Author : Juergen Pfeifer, juergen.pfeifer@gmx.net * +* * +***************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fty_alnum.c,v 1.9 1999/05/16 17:22:49 juergen Exp $") + +typedef struct { + int width; +} alnumARG; + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void *Make_AlphaNumeric_Type(va_list *ap) +| +| Description : Allocate structure for alphanumeric type argument. +| +| Return Values : Pointer to argument structure or NULL on error ++--------------------------------------------------------------------------*/ +static void *Make_AlphaNumeric_Type(va_list * ap) +{ + alnumARG *argp = (alnumARG *)malloc(sizeof(alnumARG)); + + if (argp) + argp->width = va_arg(*ap,int); + + return ((void *)argp); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void *Copy_AlphaNumericType(const void *argp) +| +| Description : Copy structure for alphanumeric type argument. +| +| Return Values : Pointer to argument structure or NULL on error. ++--------------------------------------------------------------------------*/ +static void *Copy_AlphaNumeric_Type(const void *argp) +{ + const alnumARG *ap = (const alnumARG *)argp; + alnumARG *result = (alnumARG *)malloc(sizeof(alnumARG)); + + if (result) + *result = *ap; + + return ((void *)result); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Free_AlphaNumeric_Type(void *argp) +| +| Description : Free structure for alphanumeric type argument. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +static void Free_AlphaNumeric_Type(void * argp) +{ + if (argp) + free(argp); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Check_AlphaNumeric_Field( +| FIELD *field, +| const void *argp) +| +| Description : Validate buffer content to be a valid alphanumeric value +| +| Return Values : TRUE - field is valid +| FALSE - field is invalid ++--------------------------------------------------------------------------*/ +static bool Check_AlphaNumeric_Field(FIELD * field, const void * argp) +{ + int width = ((const alnumARG *)argp)->width; + unsigned char *bp = (unsigned char *)field_buffer(field,0); + int l = -1; + unsigned char *s; + + while(*bp && *bp==' ') + bp++; + if (*bp) + { + s = bp; + while(*bp && isalnum(*bp)) + bp++; + l = (int)(bp-s); + while(*bp && *bp==' ') + bp++; + } + return ((*bp || (l < width)) ? FALSE : TRUE); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Check_AlphaNumeric_Character( +| int c, +| const void *argp ) +| +| Description : Check a character for the alphanumeric type. +| +| Return Values : TRUE - character is valid +| FALSE - character is invalid ++--------------------------------------------------------------------------*/ +static bool Check_AlphaNumeric_Character(int c, const void * argp GCC_UNUSED) +{ + return (isalnum(c) ? TRUE : FALSE); +} + +static FIELDTYPE typeALNUM = { + _HAS_ARGS | _RESIDENT, + 1, /* this is mutable, so we can't be const */ + (FIELDTYPE *)0, + (FIELDTYPE *)0, + Make_AlphaNumeric_Type, + Copy_AlphaNumeric_Type, + Free_AlphaNumeric_Type, + Check_AlphaNumeric_Field, + Check_AlphaNumeric_Character, + NULL, + NULL +}; + +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 new file mode 100644 index 000000000000..3dd8f2cb142e --- /dev/null +++ b/contrib/ncurses/form/fty_alpha.c @@ -0,0 +1,138 @@ + +/* + * THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT. + * You may freely copy it for use as a template for your own field types. + * If you develop a field type that might be of general use, please send + * it back to the ncurses maintainers for inclusion in the next version. + */ +/*************************************************************************** +* * +* Author : Juergen Pfeifer, juergen.pfeifer@gmx.net * +* * +***************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fty_alpha.c,v 1.9 1999/05/16 17:22:58 juergen Exp $") + +typedef struct { + int width; +} alphaARG; + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void *Make_Alpha_Type(va_list *ap) +| +| Description : Allocate structure for alpha type argument. +| +| Return Values : Pointer to argument structure or NULL on error ++--------------------------------------------------------------------------*/ +static void *Make_Alpha_Type(va_list * ap) +{ + alphaARG *argp = (alphaARG *)malloc(sizeof(alphaARG)); + if (argp) + { + argp->width = va_arg(*ap,int); + } + return ((void *)argp); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void *Copy_Alpha_Type(const void * argp) +| +| Description : Copy structure for alpha type argument. +| +| Return Values : Pointer to argument structure or NULL on error. ++--------------------------------------------------------------------------*/ +static void *Copy_Alpha_Type(const void * argp) +{ + const alphaARG *ap = (const alphaARG *)argp; + alphaARG *result = (alphaARG *)malloc(sizeof(alphaARG)); + + if (result) + { + *result = *ap; + } + return ((void *)result); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Free_Alpha_Type( void * argp ) +| +| Description : Free structure for alpha type argument. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +static void Free_Alpha_Type(void * argp) +{ + if (argp) + free(argp); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Check_Alpha_Field( +| FIELD * field, +| const void * argp) +| +| Description : Validate buffer content to be a valid alpha value +| +| Return Values : TRUE - field is valid +| FALSE - field is invalid ++--------------------------------------------------------------------------*/ +static bool Check_Alpha_Field(FIELD * field, const void * argp) +{ + int width = ((const alphaARG *)argp)->width; + unsigned char *bp = (unsigned char *)field_buffer(field,0); + int l = -1; + unsigned char *s; + + while(*bp && *bp==' ') + bp++; + if (*bp) + { + s = bp; + while(*bp && isalpha(*bp)) + bp++; + l = (int)(bp-s); + while(*bp && *bp==' ') + bp++; + } + return ((*bp || (l < width)) ? FALSE : TRUE); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Check_Alpha_Character( +| int c, +| const void * argp) +| +| Description : Check a character for the alpha type. +| +| Return Values : TRUE - character is valid +| FALSE - character is invalid ++--------------------------------------------------------------------------*/ +static bool Check_Alpha_Character(int c, const void * argp GCC_UNUSED) +{ + return (isalpha(c) ? TRUE : FALSE); +} + +static FIELDTYPE typeALPHA = { + _HAS_ARGS | _RESIDENT, + 1, /* this is mutable, so we can't be const */ + (FIELDTYPE *)0, + (FIELDTYPE *)0, + Make_Alpha_Type, + Copy_Alpha_Type, + Free_Alpha_Type, + Check_Alpha_Field, + Check_Alpha_Character, + NULL, + NULL +}; + +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 new file mode 100644 index 000000000000..9716159b384f --- /dev/null +++ b/contrib/ncurses/form/fty_enum.c @@ -0,0 +1,289 @@ + +/* + * THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT. + * You may freely copy it for use as a template for your own field types. + * If you develop a field type that might be of general use, please send + * it back to the ncurses maintainers for inclusion in the next version. + */ +/*************************************************************************** +* * +* Author : Juergen Pfeifer, juergen.pfeifer@gmx.net * +* * +***************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fty_enum.c,v 1.10 1999/05/16 17:23:14 juergen Exp $") + +typedef struct { + char **kwds; + int count; + bool checkcase; + bool checkunique; +} enumARG; + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void *Make_Enum_Type( va_list * ap ) +| +| Description : Allocate structure for enumeration type argument. +| +| Return Values : Pointer to argument structure or NULL on error ++--------------------------------------------------------------------------*/ +static void *Make_Enum_Type(va_list * ap) +{ + enumARG *argp = (enumARG *)malloc(sizeof(enumARG)); + char **kp; + int cnt=0; + + if (argp) + { + int ccase, cunique; + argp->kwds = va_arg(*ap,char **); + ccase = va_arg(*ap,int); + cunique = va_arg(*ap,int); + argp->checkcase = ccase ? TRUE : FALSE; + argp->checkunique = cunique ? TRUE : FALSE; + + kp = argp->kwds; + while( (*kp++) ) cnt++; + argp->count = cnt; + } + return (void *)argp; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void *Copy_Enum_Type( const void * argp ) +| +| Description : Copy structure for enumeration type argument. +| +| Return Values : Pointer to argument structure or NULL on error. ++--------------------------------------------------------------------------*/ +static void *Copy_Enum_Type(const void * argp) +{ + const enumARG *ap = (const enumARG *)argp; + enumARG *result = (enumARG *)0; + + if (argp) + { + result = (enumARG *)malloc(sizeof(enumARG)); + if (result) + *result = *ap; + } + return (void *)result; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Free_Enum_Type( void * argp ) +| +| Description : Free structure for enumeration type argument. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +static void Free_Enum_Type(void * argp) +{ + if (argp) + free(argp); +} + +#define SKIP_SPACE(x) while(((*(x))!='\0') && (is_blank(*(x)))) (x)++ +#define NOMATCH 0 +#define PARTIAL 1 +#define EXACT 2 + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int Compare(const unsigned char * s, +| const unsigned char * buf, +| bool ccase ) +| +| Description : Check wether or not the text in 'buf' matches the +| text in 's', at least partial. +| +| Return Values : NOMATCH - buffer doesn't match +| PARTIAL - buffer matches partially +| EXACT - buffer matches exactly ++--------------------------------------------------------------------------*/ +static int Compare(const unsigned char *s, const unsigned char *buf, + bool ccase) +{ + SKIP_SPACE(buf); /* Skip leading spaces in both texts */ + SKIP_SPACE(s); + + if (*buf=='\0') + { + return (((*s)!='\0') ? NOMATCH : EXACT); + } + else + { + if (ccase) + { + while(*s++ == *buf) + { + if (*buf++=='\0') return EXACT; + } + } + else + { + while(toupper(*s++)==toupper(*buf)) + { + if (*buf++=='\0') return EXACT; + } + } + } + /* At this location buf points to the first character where it no longer + matches with s. So if only blanks are following, we have a partial + match otherwise there is no match */ + SKIP_SPACE(buf); + if (*buf) + return NOMATCH; + + /* If it happens that the reference buffer is at its end, the partial + match is actually an exact match. */ + return ((s[-1]!='\0') ? PARTIAL : EXACT); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Check_Enum_Field( +| FIELD * field, +| const void * argp) +| +| Description : Validate buffer content to be a valid enumeration value +| +| Return Values : TRUE - field is valid +| FALSE - field is invalid ++--------------------------------------------------------------------------*/ +static bool Check_Enum_Field(FIELD * field, const void * argp) +{ + char **kwds = ((const enumARG *)argp)->kwds; + bool ccase = ((const enumARG *)argp)->checkcase; + bool unique = ((const enumARG *)argp)->checkunique; + unsigned char *bp = (unsigned char *)field_buffer(field,0); + char *s, *t, *p; + int res; + + while( (s=(*kwds++)) ) + { + if ((res=Compare((unsigned char *)s,bp,ccase))!=NOMATCH) + { + p=t=s; /* t is at least a partial match */ + if ((unique && res!=EXACT)) + { + while( (p = *kwds++) ) + { + if ((res=Compare((unsigned char *)p,bp,ccase))!=NOMATCH) + { + if (res==EXACT) + { + t = p; + break; + } + else + t = (char *)0; + } + } + } + if (t) + { + set_field_buffer(field,0,t); + return TRUE; + } + if (!p) + break; + } + } + return FALSE; +} + +static const char *dummy[] = { (char *)0 }; + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Next_Enum(FIELD * field, +| const void * argp) +| +| Description : Check for the next enumeration value +| +| Return Values : TRUE - next value found and loaded +| FALSE - no next value loaded ++--------------------------------------------------------------------------*/ +static bool Next_Enum(FIELD * field, const void * argp) +{ + const enumARG *args = (const enumARG *)argp; + char **kwds = args->kwds; + bool ccase = args->checkcase; + int cnt = args->count; + unsigned char *bp = (unsigned char *)field_buffer(field,0); + + while(cnt--) + { + if (Compare((unsigned char *)(*kwds++),bp,ccase)==EXACT) + break; + } + if (cnt<=0) + kwds = args->kwds; + if ((cnt>=0) || (Compare((unsigned char *)dummy,bp,ccase)==EXACT)) + { + set_field_buffer(field,0,*kwds); + return TRUE; + } + return FALSE; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Previous_Enum( +| FIELD * field, +| const void * argp) +| +| Description : Check for the previous enumeration value +| +| Return Values : TRUE - previous value found and loaded +| FALSE - no previous value loaded ++--------------------------------------------------------------------------*/ +static bool Previous_Enum(FIELD * field, const void * argp) +{ + const enumARG *args = (const enumARG *)argp; + int cnt = args->count; + char **kwds = &args->kwds[cnt-1]; + bool ccase = args->checkcase; + unsigned char *bp = (unsigned char *)field_buffer(field,0); + + while(cnt--) + { + if (Compare((unsigned char *)(*kwds--),bp,ccase)==EXACT) + break; + } + + if (cnt<=0) + kwds = &args->kwds[args->count-1]; + + if ((cnt>=0) || (Compare((unsigned char *)dummy,bp,ccase)==EXACT)) + { + set_field_buffer(field,0,*kwds); + return TRUE; + } + return FALSE; +} + + +static FIELDTYPE typeENUM = { + _HAS_ARGS | _HAS_CHOICE | _RESIDENT, + 1, /* this is mutable, so we can't be const */ + (FIELDTYPE *)0, + (FIELDTYPE *)0, + Make_Enum_Type, + Copy_Enum_Type, + Free_Enum_Type, + Check_Enum_Field, + NULL, + Next_Enum, + Previous_Enum +}; + +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 new file mode 100644 index 000000000000..cb690bdaf03d --- /dev/null +++ b/contrib/ncurses/form/fty_int.c @@ -0,0 +1,160 @@ + +/* + * THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT. + * You may freely copy it for use as a template for your own field types. + * If you develop a field type that might be of general use, please send + * it back to the ncurses maintainers for inclusion in the next version. + */ +/*************************************************************************** +* * +* Author : Juergen Pfeifer, juergen.pfeifer@gmx.net * +* * +***************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fty_int.c,v 1.10 1999/05/16 17:23:22 juergen Exp $") + +typedef struct { + int precision; + long low; + long high; +} integerARG; + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void *Make_Integer_Type( va_list * ap ) +| +| Description : Allocate structure for integer type argument. +| +| Return Values : Pointer to argument structure or NULL on error ++--------------------------------------------------------------------------*/ +static void *Make_Integer_Type(va_list * ap) +{ + integerARG *argp = (integerARG *)malloc(sizeof(integerARG)); + + if (argp) + { + argp->precision = va_arg(*ap,int); + argp->low = va_arg(*ap,long); + argp->high = va_arg(*ap,long); + } + return (void *)argp; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void *Copy_Integer_Type(const void * argp) +| +| Description : Copy structure for integer type argument. +| +| Return Values : Pointer to argument structure or NULL on error. ++--------------------------------------------------------------------------*/ +static void *Copy_Integer_Type(const void * argp) +{ + const integerARG *ap = (const integerARG *)argp; + integerARG *result = (integerARG *)0; + + if (argp) + { + result = (integerARG *)malloc(sizeof(integerARG)); + if (result) + *result = *ap; + } + return (void *)result; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Free_Integer_Type(void * argp) +| +| Description : Free structure for integer type argument. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +static void Free_Integer_Type(void * argp) +{ + if (argp) + free(argp); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Check_Integer_Field( +| FIELD * field, +| const void * argp) +| +| Description : Validate buffer content to be a valid integer value +| +| Return Values : TRUE - field is valid +| FALSE - field is invalid ++--------------------------------------------------------------------------*/ +static bool Check_Integer_Field(FIELD * field, const void * argp) +{ + const integerARG *argi = (const integerARG *)argp; + long low = argi->low; + long high = argi->high; + int prec = argi->precision; + unsigned char *bp = (unsigned char *)field_buffer(field,0); + char *s = (char *)bp; + long val; + char buf[100]; + + while( *bp && *bp==' ') bp++; + if (*bp) + { + if (*bp=='-') bp++; + while (*bp) + { + if (!isdigit(*bp)) break; + bp++; + } + while(*bp && *bp==' ') bp++; + if (*bp=='\0') + { + val = atol(s); + if (low<high) + { + if (val<low || val>high) return FALSE; + } + sprintf(buf,"%.*ld",(prec>0?prec:0),val); + set_field_buffer(field,0,buf); + return TRUE; + } + } + return FALSE; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Check_Integer_Character( +| int c, +| const void * argp) +| +| Description : Check a character for the integer type. +| +| Return Values : TRUE - character is valid +| FALSE - character is invalid ++--------------------------------------------------------------------------*/ +static bool Check_Integer_Character(int c, const void * argp GCC_UNUSED) +{ + return ((isdigit(c) || (c=='-')) ? TRUE : FALSE); +} + +static FIELDTYPE typeINTEGER = { + _HAS_ARGS | _RESIDENT, + 1, /* this is mutable, so we can't be const */ + (FIELDTYPE *)0, + (FIELDTYPE *)0, + Make_Integer_Type, + Copy_Integer_Type, + Free_Integer_Type, + Check_Integer_Field, + Check_Integer_Character, + NULL, + NULL +}; + +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 new file mode 100644 index 000000000000..064c02c8fa78 --- /dev/null +++ b/contrib/ncurses/form/fty_ipv4.c @@ -0,0 +1,81 @@ + +/* + * THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT. + * You may freely copy it for use as a template for your own field types. + * If you develop a field type that might be of general use, please send + * it back to the ncurses maintainers for inclusion in the next version. + */ +/*************************************************************************** +* * +* Author : Per Foreby, perf@efd.lth.se * +* * +***************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fty_ipv4.c,v 1.2 1997/04/26 22:06:00 tom Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Check_IPV4_Field( +| FIELD * field, +| const void * argp) +| +| Description : Validate buffer content to be a valid IP number (Ver. 4) +| +| Return Values : TRUE - field is valid +| FALSE - field is invalid ++--------------------------------------------------------------------------*/ +static bool Check_IPV4_Field(FIELD * field, const void * argp GCC_UNUSED) +{ + char *bp = field_buffer(field,0); + int num = 0, len; + unsigned int d1, d2, d3, d4; + + if(isdigit(*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)) + bp++; /* Allow trailing whitespace */ + } + } + return ((num != 4 || *bp || d1 > 255 || d2 > 255 + || d3 > 255 || d4 > 255) ? FALSE : TRUE); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Check_IPV4_Character( +| int c, +| const void *argp ) +| +| Description : Check a character for unsigned type or period. +| +| Return Values : TRUE - character is valid +| FALSE - character is invalid ++--------------------------------------------------------------------------*/ +static bool Check_IPV4_Character(int c, const void * argp GCC_UNUSED) +{ + return ((isdigit(c) || (c=='.')) ? TRUE : FALSE); +} + +static FIELDTYPE typeIPV4 = { + _RESIDENT, + 1, /* this is mutable, so we can't be const */ + (FIELDTYPE *)0, + (FIELDTYPE *)0, + NULL, + NULL, + NULL, + Check_IPV4_Field, + Check_IPV4_Character, + NULL, + NULL +}; + +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 new file mode 100644 index 000000000000..ca0fbe01e00f --- /dev/null +++ b/contrib/ncurses/form/fty_num.c @@ -0,0 +1,195 @@ + +/* + * THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT. + * You may freely copy it for use as a template for your own field types. + * If you develop a field type that might be of general use, please send + * it back to the ncurses maintainers for inclusion in the next version. + */ +/*************************************************************************** +* * +* Author : Juergen Pfeifer, juergen.pfeifer@gmx.net * +* * +***************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fty_num.c,v 1.13 1999/05/16 17:23:30 juergen Exp $") + +#if HAVE_LOCALE_H +#include <locale.h> +#endif + +typedef struct { + int precision; + double low; + double high; + struct lconv* L; +} numericARG; + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void *Make_Numeric_Type(va_list * ap) +| +| Description : Allocate structure for numeric type argument. +| +| Return Values : Pointer to argument structure or NULL on error ++--------------------------------------------------------------------------*/ +static void *Make_Numeric_Type(va_list * ap) +{ + numericARG *argn = (numericARG *)malloc(sizeof(numericARG)); + + if (argn) + { + argn->precision = va_arg(*ap,int); + argn->low = va_arg(*ap,double); + argn->high = va_arg(*ap,double); +#if HAVE_LOCALE_H + argn->L = localeconv(); +#else + argn->L = NULL; +#endif + } + return (void *)argn; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void *Copy_Numeric_Type(const void * argp) +| +| Description : Copy structure for numeric type argument. +| +| Return Values : Pointer to argument structure or NULL on error. ++--------------------------------------------------------------------------*/ +static void *Copy_Numeric_Type(const void * argp) +{ + const numericARG *ap = (const numericARG *)argp; + numericARG *result = (numericARG *)0; + + if (argp) + { + result = (numericARG *)malloc(sizeof(numericARG)); + if (result) + *result = *ap; + } + return (void *)result; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Free_Numeric_Type(void * argp) +| +| Description : Free structure for numeric type argument. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +static void Free_Numeric_Type(void * argp) +{ + if (argp) + free(argp); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Check_Numeric_Field(FIELD * field, +| const void * argp) +| +| Description : Validate buffer content to be a valid numeric value +| +| Return Values : TRUE - field is valid +| FALSE - field is invalid ++--------------------------------------------------------------------------*/ +static bool Check_Numeric_Field(FIELD * field, const void * argp) +{ + const numericARG *argn = (const numericARG *)argp; + double low = argn->low; + double high = argn->high; + int prec = argn->precision; + unsigned char *bp = (unsigned char *)field_buffer(field,0); + char *s = (char *)bp; + double val = 0.0; + struct lconv* L = argn->L; + char buf[64]; + + while(*bp && *bp==' ') bp++; + if (*bp) + { + if (*bp=='-' || *bp=='+') + bp++; + while(*bp) + { + if (!isdigit(*bp)) break; + bp++; + } + if (*bp==( +#if HAVE_LOCALE_H + (L && L->decimal_point) ? *(L->decimal_point) : +#endif + '.')) + { + bp++; + while(*bp) + { + if (!isdigit(*bp)) break; + bp++; + } + } + while(*bp && *bp==' ') bp++; + if (*bp=='\0') + { + val = atof(s); + if (low<high) + { + if (val<low || val>high) return FALSE; + } + sprintf(buf,"%.*f",(prec>0?prec:0),val); + set_field_buffer(field,0,buf); + return TRUE; + } + } + return FALSE; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Check_Numeric_Character( +| int c, +| const void * argp) +| +| Description : Check a character for the numeric type. +| +| Return Values : TRUE - character is valid +| FALSE - character is invalid ++--------------------------------------------------------------------------*/ +static bool Check_Numeric_Character(int c, const void * argp) +{ + const numericARG *argn = (const numericARG *)argp; + struct lconv* L = argn->L; + + return (isdigit(c) || + c == '+' || + c == '-' || + c == ( +#if HAVE_LOCALE_H + (L && L->decimal_point) ? *(L->decimal_point) : +#endif + '.') + ) ? TRUE : FALSE; +} + +static FIELDTYPE typeNUMERIC = { + _HAS_ARGS | _RESIDENT, + 1, /* this is mutable, so we can't be const */ + (FIELDTYPE *)0, + (FIELDTYPE *)0, + Make_Numeric_Type, + Copy_Numeric_Type, + Free_Numeric_Type, + Check_Numeric_Field, + Check_Numeric_Character, + NULL, + NULL +}; + +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 new file mode 100644 index 000000000000..7a928125d4ad --- /dev/null +++ b/contrib/ncurses/form/fty_regex.c @@ -0,0 +1,257 @@ + +/* + * THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT. + * You may freely copy it for use as a template for your own field types. + * If you develop a field type that might be of general use, please send + * it back to the ncurses maintainers for inclusion in the next version. + */ +/*************************************************************************** +* * +* Author : Juergen Pfeifer, juergen.pfeifer@gmx.net * +* * +***************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fty_regex.c,v 1.14 1999/05/16 17:23:38 juergen Exp $") + +#if HAVE_REGEX_H_FUNCS /* We prefer POSIX regex */ +#include <regex.h> + +typedef struct +{ + regex_t *pRegExp; + unsigned long *refCount; +} RegExp_Arg; + +#elif HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS +#undef RETURN +static int reg_errno; + +static char *RegEx_Init(char *instring) +{ + reg_errno = 0; + return instring; +} + +static char *RegEx_Error(int code) +{ + reg_errno = code; + return 0; +} + +#define INIT register char *sp = RegEx_Init(instring); +#define GETC() (*sp++) +#define PEEKC() (*sp) +#define UNGETC(c) (--sp) +#define RETURN(c) return(c) +#define ERROR(c) return RegEx_Error(c) + +#if HAVE_REGEXP_H_FUNCS +#include <regexp.h> +#else +#include <regexpr.h> +#endif + +typedef struct +{ + char *compiled_expression; + unsigned long *refCount; +} RegExp_Arg; + +/* Maximum Length we allow for a compiled regular expression */ +#define MAX_RX_LEN (2048) +#define RX_INCREMENT (256) + +#endif + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void *Make_RegularExpression_Type(va_list * ap) +| +| Description : Allocate structure for regex type argument. +| +| Return Values : Pointer to argument structure or NULL on error ++--------------------------------------------------------------------------*/ +static void *Make_RegularExpression_Type(va_list * ap) +{ +#if HAVE_REGEX_H_FUNCS + char *rx = va_arg(*ap,char *); + RegExp_Arg *preg; + + preg = (RegExp_Arg*)malloc(sizeof(RegExp_Arg)); + if (preg) + { + if (((preg->pRegExp = (regex_t*)malloc(sizeof(regex_t))) != (regex_t*)0) + && !regcomp(preg->pRegExp,rx, + (REG_EXTENDED | REG_NOSUB | REG_NEWLINE) )) + { + preg->refCount = (unsigned long *)malloc(sizeof(unsigned long)); + *(preg->refCount) = 1; + } + else + { + if (preg->pRegExp) + free(preg->pRegExp); + free(preg); + preg = (RegExp_Arg*)0; + } + } + return((void *)preg); +#elif HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS + char *rx = va_arg(*ap,char *); + RegExp_Arg *pArg; + + pArg = (RegExp_Arg *)malloc(sizeof(RegExp_Arg)); + + if (pArg) + { + int blen = RX_INCREMENT; + pArg->compiled_expression = NULL; + pArg->refCount = (unsigned long *)malloc(sizeof(unsigned long)); + *(pArg->refCount) = 1; + + do { + char *buf = (char *)malloc(blen); + if (buf) + { +#if HAVE_REGEXP_H_FUNCS + char *last_pos = compile (rx, buf, &buf[blen], '\0'); +#else /* HAVE_REGEXPR_H_FUNCS */ + char *last_pos = compile (rx, buf, &buf[blen]); +#endif + if (reg_errno) + { + free(buf); + if (reg_errno==50) + blen += RX_INCREMENT; + else + { + free(pArg); + pArg = NULL; + break; + } + } + else + { + pArg->compiled_expression = buf; + break; + } + } + } while( blen <= MAX_RX_LEN ); + } + if (pArg && !pArg->compiled_expression) + { + free(pArg); + pArg = NULL; + } + return (void *)pArg; +#else + return 0; +#endif +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void *Copy_RegularExpression_Type( +| const void * argp) +| +| Description : Copy structure for regex type argument. +| +| Return Values : Pointer to argument structure or NULL on error. ++--------------------------------------------------------------------------*/ +static void *Copy_RegularExpression_Type(const void * argp) +{ +#if (HAVE_REGEX_H_FUNCS | HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS) + const RegExp_Arg *ap = (const RegExp_Arg *)argp; + const RegExp_Arg *result = (const RegExp_Arg *)0; + + if (ap) + { + *(ap->refCount) += 1; + result = ap; + } + return (void *)result; +#else + return 0; +#endif +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Free_RegularExpression_Type(void * argp) +| +| Description : Free structure for regex type argument. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +static void Free_RegularExpression_Type(void * argp) +{ +#if HAVE_REGEX_H_FUNCS | HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS + RegExp_Arg *ap = (RegExp_Arg *)argp; + if (ap) + { + if (--(*(ap->refCount)) == 0) + { +#if HAVE_REGEX_H_FUNCS + if (ap->pRegExp) + { + free(ap->refCount); + regfree(ap->pRegExp); + } +#elif HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS + if (ap->compiled_expression) + { + free(ap->refCount); + free(ap->compiled_expression); + } +#endif + free(ap); + } + } +#endif +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Check_RegularExpression_Field( +| FIELD * field, +| const void * argp) +| +| Description : Validate buffer content to be a valid regular expression +| +| Return Values : TRUE - field is valid +| FALSE - field is invalid ++--------------------------------------------------------------------------*/ +static bool Check_RegularExpression_Field(FIELD * field, const void * argp) +{ + bool match = FALSE; +#if HAVE_REGEX_H_FUNCS + const RegExp_Arg *ap = (const RegExp_Arg*)argp; + if (ap && ap->pRegExp) + match = (regexec(ap->pRegExp,field_buffer(field,0),0,NULL,0) ? FALSE:TRUE); +#elif HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS + RegExp_Arg *ap = (RegExp_Arg *)argp; + if (ap && ap->compiled_expression) + match = (step(field_buffer(field,0),ap->compiled_expression) ? TRUE:FALSE); +#endif + return match; +} + +static FIELDTYPE typeREGEXP = { + _HAS_ARGS | _RESIDENT, + 1, /* this is mutable, so we can't be const */ + (FIELDTYPE *)0, + (FIELDTYPE *)0, + Make_RegularExpression_Type, + Copy_RegularExpression_Type, + Free_RegularExpression_Type, + Check_RegularExpression_Field, + NULL, + NULL, + NULL +}; + +FIELDTYPE* TYPE_REGEXP = &typeREGEXP; + +/* fty_regex.c ends here */ diff --git a/contrib/ncurses/form/headers b/contrib/ncurses/form/headers new file mode 100644 index 000000000000..f2267c8722c1 --- /dev/null +++ b/contrib/ncurses/form/headers @@ -0,0 +1,31 @@ +############################################################################## +# Copyright (c) 1998 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1996 +# +$(srcdir)/form.h diff --git a/contrib/ncurses/form/llib-lform b/contrib/ncurses/form/llib-lform new file mode 100644 index 000000000000..ac2ba436d666 --- /dev/null +++ b/contrib/ncurses/form/llib-lform @@ -0,0 +1,694 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 * + ****************************************************************************/ +/* LINTLIBRARY */ + +/* ./fld_arg.c */ + +#include "form.priv.h" + +#undef set_fieldtype_arg +int set_fieldtype_arg( + FIELDTYPE *typ, + void *(*const make_arg)( + va_list *p1), + void *(*const copy_arg)( + const void *p1), + void (*const free_arg)( + void *p1)) + { return(*(int *)0); } + +#undef field_arg +void *field_arg( + const FIELD *field) + { return(*(void **)0); } + +/* ./fld_attr.c */ + +#undef set_field_fore +int set_field_fore( + FIELD *field, + chtype attr) + { return(*(int *)0); } + +#undef field_fore +chtype field_fore( + const FIELD *field) + { return(*(chtype *)0); } + +#undef set_field_back +int set_field_back( + FIELD *field, + chtype attr) + { return(*(int *)0); } + +#undef field_back +chtype field_back( + const FIELD *field) + { return(*(chtype *)0); } + +/* ./fld_current.c */ + +#undef set_current_field +int set_current_field( + FORM *form, + FIELD *field) + { return(*(int *)0); } + +#undef current_field +FIELD *current_field( + const FORM *form) + { return(*(FIELD **)0); } + +#undef field_index +int field_index( + const FIELD *field) + { return(*(int *)0); } + +/* ./fld_def.c */ + +#undef _nc_Default_Field +FIELD *_nc_Default_Field; + +#undef _nc_Make_Argument +TypeArgument *_nc_Make_Argument( + const FIELDTYPE *typ, + va_list *ap, + int *err) + { return(*(TypeArgument **)0); } + +#undef _nc_Copy_Argument +TypeArgument *_nc_Copy_Argument( + const FIELDTYPE *typ, + const TypeArgument *argp, + int *err) + { return(*(TypeArgument **)0); } + +#undef _nc_Free_Argument +void _nc_Free_Argument( + const FIELDTYPE *typ, + TypeArgument *argp) + { /* void */ } + +#undef _nc_Copy_Type +bool _nc_Copy_Type( + FIELD *dst, + FIELD const *src) + { return(*(bool *)0); } + +#undef _nc_Free_Type +void _nc_Free_Type( + FIELD *field) + { /* void */ } + +#undef new_field +FIELD *new_field( + int rows, + int cols, + int frow, + int fcol, + int nrow, + int nbuf) + { return(*(FIELD **)0); } + +#undef free_field +int free_field( + FIELD *field) + { return(*(int *)0); } + +/* ./fld_dup.c */ + +#undef dup_field +FIELD *dup_field( + FIELD *field, + int frow, + int fcol) + { return(*(FIELD **)0); } + +/* ./fld_ftchoice.c */ + +#undef set_fieldtype_choice +int set_fieldtype_choice( + FIELDTYPE *typ, + bool (*const next_choice)( + FIELD *p1, + const void *p2), + bool (*const prev_choice)( + FIELD *p1, + const void *p2)) + { return(*(int *)0); } + +/* ./fld_ftlink.c */ + +#undef link_fieldtype +FIELDTYPE *link_fieldtype( + FIELDTYPE *type1, + FIELDTYPE *type2) + { return(*(FIELDTYPE **)0); } + +/* ./fld_info.c */ + +#undef field_info +int field_info( + const FIELD *field, + int *rows, + int *cols, + int *frow, + int *fcol, + int *nrow, + int *nbuf) + { return(*(int *)0); } + +#undef dynamic_field_info +int dynamic_field_info( + const FIELD *field, + int *drows, + int *dcols, + int *maxgrow) + { return(*(int *)0); } + +/* ./fld_just.c */ + +#undef set_field_just +int set_field_just( + FIELD *field, + int just) + { return(*(int *)0); } + +#undef field_just +int field_just( + const FIELD *field) + { return(*(int *)0); } + +/* ./fld_link.c */ + +#undef link_field +FIELD *link_field( + FIELD *field, + int frow, + int fcol) + { return(*(FIELD **)0); } + +/* ./fld_max.c */ + +#undef set_max_field +int set_max_field( + FIELD *field, + int maxgrow) + { return(*(int *)0); } + +/* ./fld_move.c */ + +#undef move_field +int move_field( + FIELD *field, + int frow, + int fcol) + { return(*(int *)0); } + +/* ./fld_newftyp.c */ + +#undef _nc_Default_FieldType +const FIELDTYPE *_nc_Default_FieldType = {0}; + +#undef new_fieldtype +FIELDTYPE *new_fieldtype( + bool (*const field_check)( + FIELD *p1, + const void *p2), + bool (*const char_check)( + int p1, + const void *p2)) + { return(*(FIELDTYPE **)0); } + +#undef free_fieldtype +int free_fieldtype( + FIELDTYPE *typ) + { return(*(int *)0); } + +/* ./fld_opts.c */ + +#undef set_field_opts +int set_field_opts( + FIELD *field, + Field_Options opts) + { return(*(int *)0); } + +#undef field_opts +Field_Options field_opts( + const FIELD *field) + { return(*(Field_Options *)0); } + +#undef field_opts_on +int field_opts_on( + FIELD *field, + Field_Options opts) + { return(*(int *)0); } + +#undef field_opts_off +int field_opts_off( + FIELD *field, + Field_Options opts) + { return(*(int *)0); } + +/* ./fld_pad.c */ + +#undef set_field_pad +int set_field_pad( + FIELD *field, + int ch) + { return(*(int *)0); } + +#undef field_pad +int field_pad( + const FIELD *field) + { return(*(int *)0); } + +/* ./fld_page.c */ + +#undef set_new_page +int set_new_page( + FIELD *field, + bool new_page_flag) + { return(*(int *)0); } + +#undef new_page +bool new_page( + const FIELD *field) + { return(*(bool *)0); } + +/* ./fld_stat.c */ + +#undef set_field_status +int set_field_status( + FIELD *field, + bool status) + { return(*(int *)0); } + +#undef field_status +bool field_status( + const FIELD *field) + { return(*(bool *)0); } + +/* ./fld_type.c */ + +#undef set_field_type +int set_field_type( + FIELD *field, + FIELDTYPE *type, + ...) + { return(*(int *)0); } + +#undef field_type +FIELDTYPE *field_type( + const FIELD *field) + { return(*(FIELDTYPE **)0); } + +/* ./fld_user.c */ + +#undef set_field_userptr +int set_field_userptr( + FIELD *field, + void *usrptr) + { return(*(int *)0); } + +#undef field_userptr +void *field_userptr( + const FIELD *field) + { return(*(void **)0); } + +/* ./frm_cursor.c */ + +#undef pos_form_cursor +int pos_form_cursor( + FORM *form) + { return(*(int *)0); } + +/* ./frm_data.c */ + +#undef data_behind +bool data_behind( + const FORM *form) + { return(*(bool *)0); } + +#undef data_ahead +bool data_ahead( + const FORM *form) + { return(*(bool *)0); } + +/* ./frm_def.c */ + +#undef _nc_Default_Form +FORM *_nc_Default_Form; + +#undef new_form +FORM *new_form( + FIELD **fields) + { return(*(FORM **)0); } + +#undef free_form +int free_form( + FORM *form) + { return(*(int *)0); } + +#undef set_form_fields +int set_form_fields( + FORM *form, + FIELD **fields) + { return(*(int *)0); } + +#undef form_fields +FIELD **form_fields( + const FORM *form) + { return(*(FIELD ***)0); } + +#undef field_count +int field_count( + const FORM *form) + { return(*(int *)0); } + +/* ./frm_driver.c */ + +#undef _nc_Position_Form_Cursor +int _nc_Position_Form_Cursor( + FORM *form) + { return(*(int *)0); } + +#undef _nc_Refresh_Current_Field +int _nc_Refresh_Current_Field( + FORM *form) + { return(*(int *)0); } + +#undef _nc_Synchronize_Attributes +int _nc_Synchronize_Attributes( + FIELD *field) + { return(*(int *)0); } + +#undef _nc_Synchronize_Options +int _nc_Synchronize_Options( + FIELD *field, + Field_Options newopts) + { return(*(int *)0); } + +#undef _nc_Set_Current_Field +int _nc_Set_Current_Field( + FORM *form, + FIELD *newfield) + { return(*(int *)0); } + +#undef _nc_Internal_Validation +bool _nc_Internal_Validation( + FORM *form) + { return(*(bool *)0); } + +#undef _nc_First_Active_Field +FIELD *_nc_First_Active_Field( + FORM *form) + { return(*(FIELD **)0); } + +#undef _nc_Set_Form_Page +int _nc_Set_Form_Page( + FORM *form, + int page, + FIELD *field) + { return(*(int *)0); } + +typedef struct { + int keycode; + int (*cmd)(FORM *); +} Binding_Info; + +#undef form_driver +int form_driver( + FORM *form, + int c) + { return(*(int *)0); } + +#undef set_field_buffer +int set_field_buffer( + FIELD *field, + int buffer, + const char *value) + { return(*(int *)0); } + +#undef field_buffer +char *field_buffer( + const FIELD *field, + int buffer) + { return(*(char **)0); } + +/* ./frm_hook.c */ + +#undef set_field_init +int set_field_init( + FORM *form, + Form_Hook func) + { return(*(int *)0); } + +#undef field_init +Form_Hook field_init( + const FORM *form) + { return(*(Form_Hook *)0); } + +#undef set_field_term +int set_field_term( + FORM *form, + Form_Hook func) + { return(*(int *)0); } + +#undef field_term +Form_Hook field_term( + const FORM *form) + { return(*(Form_Hook *)0); } + +#undef set_form_init +int set_form_init( + FORM *form, + Form_Hook func) + { return(*(int *)0); } + +#undef form_init +Form_Hook form_init( + const FORM *form) + { return(*(Form_Hook *)0); } + +#undef set_form_term +int set_form_term( + FORM *form, + Form_Hook func) + { return(*(int *)0); } + +#undef form_term +Form_Hook form_term( + const FORM *form) + { return(*(Form_Hook *)0); } + +/* ./frm_opts.c */ + +#undef set_form_opts +int set_form_opts( + FORM *form, + Form_Options opts) + { return(*(int *)0); } + +#undef form_opts +Form_Options form_opts( + const FORM *form) + { return(*(Form_Options *)0); } + +#undef form_opts_on +int form_opts_on( + FORM *form, + Form_Options opts) + { return(*(int *)0); } + +#undef form_opts_off +int form_opts_off( + FORM *form, + Form_Options opts) + { return(*(int *)0); } + +/* ./frm_page.c */ + +#undef set_form_page +int set_form_page( + FORM *form, + int page) + { return(*(int *)0); } + +#undef form_page +int form_page( + const FORM *form) + { return(*(int *)0); } + +/* ./frm_post.c */ + +#undef post_form +int post_form( + FORM *form) + { return(*(int *)0); } + +#undef unpost_form +int unpost_form( + FORM *form) + { return(*(int *)0); } + +/* ./frm_req_name.c */ + +#undef form_request_name +const char *form_request_name( + int request) + { return(*(const char **)0); } + +#undef form_request_by_name +int form_request_by_name( + const char *str) + { return(*(int *)0); } + +/* ./frm_scale.c */ + +#undef scale_form +int scale_form( + const FORM *form, + int *rows, + int *cols) + { return(*(int *)0); } + +/* ./frm_sub.c */ + +#undef set_form_sub +int set_form_sub( + FORM *form, + WINDOW *win) + { return(*(int *)0); } + +#undef form_sub +WINDOW *form_sub( + const FORM *form) + { return(*(WINDOW **)0); } + +/* ./frm_user.c */ + +#undef set_form_userptr +int set_form_userptr( + FORM *form, + void *usrptr) + { return(*(int *)0); } + +#undef form_userptr +void *form_userptr( + const FORM *form) + { return(*(void **)0); } + +/* ./frm_win.c */ + +#undef set_form_win +int set_form_win( + FORM *form, + WINDOW *win) + { return(*(int *)0); } + +#undef form_win +WINDOW *form_win( + const FORM *form) + { return(*(WINDOW **)0); } + +/* ./fty_alnum.c */ + +typedef struct { + int width; +} alnumARG; + +#undef TYPE_ALNUM +FIELDTYPE *TYPE_ALNUM; + +/* ./fty_alpha.c */ + +typedef struct { + int width; +} alphaARG; + +#undef TYPE_ALPHA +FIELDTYPE *TYPE_ALPHA; + +/* ./fty_enum.c */ + +typedef struct { + char **kwds; + int count; + bool checkcase; + bool checkunique; +} enumARG; + +#undef TYPE_ENUM +FIELDTYPE *TYPE_ENUM; + +/* ./fty_int.c */ + +typedef struct { + int precision; + long low; + long high; +} integerARG; + +#undef TYPE_INTEGER +FIELDTYPE *TYPE_INTEGER; + +/* ./fty_ipv4.c */ +#undef TYPE_IPV4 +FIELDTYPE *TYPE_IPV4; + +/* ./fty_num.c */ + +#include <locale.h> + +typedef struct { + int precision; + double low; + double high; + struct lconv* L; +} numericARG; + +#undef TYPE_NUMERIC +FIELDTYPE *TYPE_NUMERIC; + +/* ./fty_regex.c */ + +#include <regex.h> + +typedef struct +{ + regex_t *pRegExp; + unsigned long *refCount; +} RegExp_Arg; + +#undef TYPE_REGEXP +FIELDTYPE *TYPE_REGEXP; diff --git a/contrib/ncurses/form/modules b/contrib/ncurses/form/modules new file mode 100644 index 000000000000..4125e93e5a33 --- /dev/null +++ b/contrib/ncurses/form/modules @@ -0,0 +1,73 @@ +# $Id: modules,v 1.13 1999/02/19 00:27:47 juergen Exp $ +############################################################################## +# Copyright (c) 1998 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 +# + +@ base +# Library objects +fld_arg lib $(srcdir) $(FORM_PRIV_H) +fld_attr lib $(srcdir) $(FORM_PRIV_H) +fld_current lib $(srcdir) $(FORM_PRIV_H) +fld_def lib $(srcdir) $(FORM_PRIV_H) +fld_dup lib $(srcdir) $(FORM_PRIV_H) +fld_ftchoice lib $(srcdir) $(FORM_PRIV_H) +fld_ftlink lib $(srcdir) $(FORM_PRIV_H) +fld_info lib $(srcdir) $(FORM_PRIV_H) +fld_just lib $(srcdir) $(FORM_PRIV_H) +fld_link lib $(srcdir) $(FORM_PRIV_H) +fld_max lib $(srcdir) $(FORM_PRIV_H) +fld_move lib $(srcdir) $(FORM_PRIV_H) +fld_newftyp lib $(srcdir) $(FORM_PRIV_H) +fld_opts lib $(srcdir) $(FORM_PRIV_H) +fld_pad lib $(srcdir) $(FORM_PRIV_H) +fld_page lib $(srcdir) $(FORM_PRIV_H) +fld_stat lib $(srcdir) $(FORM_PRIV_H) +fld_type lib $(srcdir) $(FORM_PRIV_H) +fld_user lib $(srcdir) $(FORM_PRIV_H) +frm_cursor lib $(srcdir) $(FORM_PRIV_H) +frm_data lib $(srcdir) $(FORM_PRIV_H) +frm_def lib $(srcdir) $(FORM_PRIV_H) +frm_driver lib $(srcdir) $(FORM_PRIV_H) +frm_hook lib $(srcdir) $(FORM_PRIV_H) +frm_opts lib $(srcdir) $(FORM_PRIV_H) +frm_page lib $(srcdir) $(FORM_PRIV_H) +frm_post lib $(srcdir) $(FORM_PRIV_H) +frm_req_name lib $(srcdir) $(FORM_PRIV_H) +frm_scale lib $(srcdir) $(FORM_PRIV_H) +frm_sub lib $(srcdir) $(FORM_PRIV_H) +frm_user lib $(srcdir) $(FORM_PRIV_H) +frm_win lib $(srcdir) $(FORM_PRIV_H) +fty_alnum lib $(srcdir) $(FORM_PRIV_H) +fty_alpha lib $(srcdir) $(FORM_PRIV_H) +fty_enum lib $(srcdir) $(FORM_PRIV_H) +fty_int lib $(srcdir) $(FORM_PRIV_H) +fty_ipv4 lib $(srcdir) $(FORM_PRIV_H) +fty_num lib $(srcdir) $(FORM_PRIV_H) +fty_regex lib $(srcdir) $(FORM_PRIV_H) diff --git a/contrib/ncurses/include/Caps b/contrib/ncurses/include/Caps new file mode 100644 index 000000000000..7c10212827cb --- /dev/null +++ b/contrib/ncurses/include/Caps @@ -0,0 +1,1314 @@ +############################################################################## +# Copyright (c) 1998 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 +# and: Eric S. Raymond <esr@snark.thyrsus.com> +# +# $Id: Caps,v 1.24 1999/01/17 02:01:44 tom Exp $ +# +# This is the master termcap/terminfo capability table. +# +# This table is used to generate initializers for tables that drive tic, +# infocmp, and the library compilation code used to support the termcap +# compatibility hack. It is also used to generate the tabular portion of the +# terminfo(5) man page; lines beginning with `#%' are passed through to become +# the terminfo table. +# +# This file has three major sections; a standard-capabilities table, two +# extension-capability tables, and a section of aliases declarations. +# The first two have the same format, as follows: +# +# FILE FORMAT +# +# Column 1: terminfo variable name +# Column 2: terminfo capability name +# Column 3: capability type (boolean, numeric, or string) +# Column 4: termcap capability name +# Column 5: Lead with `Y' if capability should be emitted in termcap +# translations, `-' otherwise +# Column 6: capability description +# +# The codes following [Y-] in column 5 describe the versions of termcap which +# use the given capability. This information is not used by the curses library +# proper; rather, it's there to help the terminfo maintainer avoid emitting +# termcap entry translations that are more than 1023 bytes long (and tank a +# lot of old termcap-using programs). The codes read as follows: +# B = mentioned in the BSD man page for 4.4BSD curses +# C = used by the 4.4BSD curses library +# G = mentioned in the documentation for GNU termcap +# E = used by GNU Emacs +# K = remove this terminfo capability when translating to standard format +# The important codes are C and E. A cap with C or E should be preserved in +# translation if possible. The problem is that preserving all such caps may +# lead to some termcap translations being too long. The termcap maintainer +# has a bit of a juggling act to do...potential problem cases are marked with +# a * or **. +# +# The aliases section has the following format: +# +# Column 1: either `capalias' or `infoalias' +# Column 2: name to be aliased +# Column 3: what name it should translate to. The name IGNORE means it +# should be discarded with a warning message. +# Column 4: name of the extension set (used for compiler warning messages) +# Column 5: capability description (usually an associated terminfo variable) +# +# HANDLING TERMCAP AND TERMINFO EXTENSIONS +# +# There are basically five different ways to handle termcap and terminfo +# extensions: +# +# 1. Don't list the capname here, or list it but comment it out (the latter +# is preferable; someone might want to handle it in the future). If you do +# this, the capability will be treated as unknown and raise a warning from +# the compiler. +# +# 2. Alias it. This is appropriate if the capability has the same meaning +# as an already-supported one. The compiler will handle aliasing, emitting +# an appropriate informational message whenever an alias fires. +# +# 3. List it in the standard table. You almost certainly do *not* want +# to do this -- the capabilities in that one, and their order, have been +# carefully chosen to be SVr4-binary-compatible when they're written out +# as a terminfo object, and breaking this would be bad. It's up the ncurses +# library what to do with the terminfo data after it's read in. +# +# 4. List it in the aliases table with an IGNORE target field. If you +# do this, the capability will be ignored on input (though the user will +# get a warning message about it). +# +# 5. List it in the extensions table. If you do this, the compiler will +# silently accept the capability, but the curses library proper will never +# see it (because it won't be written out as part of the terminfo object +# format). It's up to you what you have the compiler do with it. +# +# There are two opposite reasons to choose option 5. One is when you want +# to eat the capability silently and discard it when doing translations +# to terminfo with tic -I. Some very old obsolete BSD caps like :kn: are +# in this class. Nothing will ever use them again. +# +# More usually, you want the compiler to try to deduce something from the +# capability value that it can use to translate it into your output format. +# You'll need to write custom code, probably in postprocess_termcap() or +# postprocess_terminfo(), to handle the translation. +# +# CONTROLLING ENTRY LENGTH +# +# Notes on specific elisions made to fit translations within 1023 bytes: +# +# Machines with IBM PC-like keyboards want to be able to define the following +# keys: key_npage, key_ppage, key_home, key_ll (which is used for in termcap- +# only environments for End or Home-Down), key_dc, and key_ic. This is also +# the set of keys the `joe' editor will be upset if it can't see. So don't +# trim those out of the set to be translated to termcap, or various users of +# the termcap file will become irate. +# +# It might look tempting to leave those long init strings out of translations. +# We can't do it (yet); 4.4BSD tput and tset use them. +# +# We retain the sgr capability in translation in spite of the fact that neither +# 4.4BSD nor GNU Emacs uses it, because (a) some entry naming distinctions are +# hard to understand without it, and (b) the entries in which it is long tend +# to be older types that don't use up a lot of string space on function keys. +# The tic(1) translation code will complain and elide it if it makes a critical +# difference (there is special code in tic to recognize this situation). +# +# Yes, BSD tset(1) uses hpa. We elide hpa/vpa anyway because the motion +# optimizer in BSD curses didn't use them. This omission seems to be the +# single most effective one, it shortened the resolved length of all thirteen +# problem entries in the 9.9.0 version of the terminfo master below critical. +# +# It would be nice to keep f11 and f12 for Emacs use, but a couple of termcap +# translations go back over critical if we do this. As 4.4BSD curses fades +# into history and GNU termcap's application base shrinks towards being GNU +# Emacs only, we'll probably elide out some BSD-only capabilities in order +# to buy space for non-essentials Emacs is still using. Capabilities high +# on that hit list: rc, sc, uc. +# +############################################################################# +# +# STANDARD CAPABILITIES +# +#%The following is a complete table of the capabilities included in a +#%terminfo description block and available to terminfo-using code. In each +#%line of the table, +#% +#%The \fBvariable\fR is the name by which the programmer (at the terminfo level) +#%accesses the capability. +#% +#%The \fBcapname\fR is the short name used in the text of the database, +#%and is used by a person updating the database. +#%Whenever possible, capnames are chosen to be the same as or similar to +#%the ANSI X3.64-1979 standard (now superseded by ECMA-48, which uses +#%identical or very similar names). Semantics are also intended to match +#%those of the specification. +#% +#%The termcap code is the old +#%.B termcap +#%capability name (some capabilities are new, and have names which termcap +#%did not originate). +#%.P +#%Capability names have no hard length limit, but an informal limit of 5 +#%characters has been adopted to keep them short and to allow the tabs in +#%the source file +#%.B Caps +#%to line up nicely. +#% +#%Finally, the description field attempts to convey the semantics of the +#%capability. You may find some codes in the description field: +#%.TP +#%(P) +#%indicates that padding may be specified +#%.TP +#%#[1-9] +#%in the description field indicates that the string is passed through tparm with +#%parms as given (#\fIi\fP). +#%.TP +#%(P*) +#%indicates that padding may vary in proportion to the number of +#%lines affected +#%.TP +#%(#\d\fIi\fP\u) +#%indicates the \fIi\fP\uth\d parameter. +#% +#%.PP +#% These are the boolean capabilities: +#% +#%.na +#%.TS H +#%center expand; +#%c l l c +#%c l l c +#%lw25 lw6 lw2 lw20. +#%\fBVariable Cap- TCap Description\fR +#%\fBBooleans name Code\fR +auto_left_margin bw bool bw YB-G- cub1 wraps from column 0 to last column +auto_right_margin am bool am YBCGE terminal has automatic margins +no_esc_ctlc xsb bool xb YBCG- beehive (f1=escape, f2=ctrl C) +ceol_standout_glitch xhp bool xs YBCGE standout not erased by overwriting (hp) +eat_newline_glitch xenl bool xn YBCGE newline ignored after 80 cols (concept) +erase_overstrike eo bool eo YBCG- can erase overstrikes with a blank +generic_type gn bool gn YB-G- generic line type +hard_copy hc bool hc YBCG- hardcopy terminal +has_meta_key km bool km YB-GE Has a meta key (shift, sets parity bit) +has_status_line hs bool hs YB-G- has extra status line +insert_null_glitch in bool in YBCGE insert mode distinguishes nulls +memory_above da bool da YBCG- display may be retained above the screen +memory_below db bool db YB-GE display may be retained below the screen +move_insert_mode mir bool mi YBCGE safe to move while in insert mode +move_standout_mode msgr bool ms YBCGE safe to move while in standout mode +over_strike os bool os YBCG- terminal can overstrike +status_line_esc_ok eslok bool es YB-G- escape can be used on the status line +dest_tabs_magic_smso xt bool xt YBCGE tabs destructive, magic so char (t1061) +tilde_glitch hz bool hz YB-GE can't print ~'s (hazeltine) +transparent_underline ul bool ul YBCGE underline character overstrikes +xon_xoff xon bool xo YB--- terminal uses xon/xoff handshaking +needs_xon_xoff nxon bool nx ----- padding won't work, xon/xoff required +prtr_silent mc5i bool 5i ----- printer won't echo on screen +hard_cursor chts bool HC ----- cursor is hard to see +non_rev_rmcup nrrmc bool NR ----- smcup does not reverse rmcup +no_pad_char npc bool NP ----- pad character does not exist +non_dest_scroll_region ndscr bool ND ----- scrolling region is non-destructive +can_change ccc bool cc ----- terminal can re-define existing colors +back_color_erase bce bool ut ----- screen erased with background color +hue_lightness_saturation hls bool hl ----- terminal uses only HLS color notation (Tektronix) +col_addr_glitch xhpa bool YA ----- only positive motion for hpa/mhpa caps +cr_cancels_micro_mode crxm bool YB ----- using cr turns off micro mode +has_print_wheel daisy bool YC ----- printer needs operator to change character set +row_addr_glitch xvpa bool YD ----- only positive motion for vpa/mvpa caps +semi_auto_right_margin sam bool YE ----- printing in last column causes cr +cpi_changes_res cpix bool YF ----- changing character pitch changes resolution +lpi_changes_res lpix bool YG ----- changing line pitch changes resolution +#%.TE +#%.ad +#% +#%These are the numeric capabilities: +#% +#%.na +#%.TS H +#%center expand; +#%c l l c +#%c l l c +#%lw25 lw6 lw2 lw20. +#%\fBVariable Cap- TCap Description\fR +#%\fBNumeric name Code\fR +columns cols num co YBCGE number of columns in a line +init_tabs it num it YB-G- tabs initially every # spaces +lines lines num li YBCGE number of lines on screen or page +lines_of_memory lm num lm YB-G- lines of memory if > line. 0 means varies +magic_cookie_glitch xmc num sg YBCGE number of blank characters left by smso or rmso +padding_baud_rate pb num pb YB-GE lowest baud rate where padding needed +virtual_terminal vt num vt YB--- virtual terminal number (CB/unix) +width_status_line wsl num ws YB-G- number of columns in status line +num_labels nlab num Nl ----- number of labels on screen +label_height lh num lh ----- rows in each label +label_width lw num lw ----- columns in each label +max_attributes ma num ma YBC-- maximum combined attributes terminal can handle +maximum_windows wnum num MW ----- maximum number of defineable windows +# These came in with SVr4's color support +max_colors colors num Co ----- maximum number of colors on screen +max_pairs pairs num pa ----- maximum number of color-pairs on the screen +no_color_video ncv num NC ----- video attributes that can't be used with colors +#%.TE +#%.ad +#% +#%The following numeric capabilities are present in the SVr4.0 term structure, +#%but are not yet documented in the man page. They came in with SVr4's +#%printer support. +#% +#%.na +#%.TS H +#%center expand; +#%c l l c +#%c l l c +#%lw25 lw6 lw2 lw20. +#%\fBVariable Cap- TCap Description\fR +#%\fBNumeric name Code\fR +buffer_capacity bufsz num Ya ----- numbers of bytes buffered before printing +dot_vert_spacing spinv num Yb ----- spacing of pins vertically in pins per inch +dot_horz_spacing spinh num Yc ----- spacing of dots horizontally in dots per inch +max_micro_address maddr num Yd ----- maximum value in micro_..._address +max_micro_jump mjump num Ye ----- maximum value in parm_..._micro +micro_col_size mcs num Yf ----- character step size when in micro mode +micro_line_size mls num Yg ----- line step size when in micro mode +number_of_pins npins num Yh ----- numbers of pins in print-head +output_res_char orc num Yi ----- horizontal resolution in units per line +output_res_line orl num Yj ----- vertical resolution in units per line +output_res_horz_inch orhi num Yk ----- horizontal resolution in units per inch +output_res_vert_inch orvi num Yl ----- vertical resolution in units per inch +print_rate cps num Ym ----- print rate in characters per second +wide_char_size widcs num Yn ----- character step size when in double wide mode +buttons btns num BT ----- number of buttons on mouse +bit_image_entwining bitwin num Yo ----- number of passes for each bit-image row +bit_image_type bitype num Yp ----- type of bit-image device +#%.TE +#%.ad +#% +#%These are the string capabilities: +#% +#%.na +#%.TS H +#%center expand; +#%c l l c +#%c l l c +#%lw25 lw6 lw2 lw20. +#%\fBVariable Cap- TCap Description\fR +#%\fBString name Code\fR +back_tab cbt str bt YBCGE back tab (P) +bell bel str bl YB-GE audible signal (bell) (P) +carriage_return cr str cr YBCGE carriage return (P*) (P*) +change_scroll_region csr str cs YBCGE change region to line #1 to line #2 (P) +clear_all_tabs tbc str ct YB-G- clear all tab stops (P) +clear_screen clear str cl YBCGE clear screen and home cursor (P*) +clr_eol el str ce YBCGE clear to end of line (P) +clr_eos ed str cd YBCGE clear to end of screen (P*) +column_address hpa str ch -B-GE** horizontal position #1, absolute (P) +command_character cmdch str CC YB-G- terminal settable cmd character in prototype !? +cursor_address cup str cm YBCGE move to row #1 columns #2 +cursor_down cud1 str do YBCGE down one line +cursor_home home str ho YBCGE home cursor (if no cup) +cursor_invisible civis str vi YB-G- make cursor invisible +cursor_left cub1 str le YBCGE move left one space +cursor_mem_address mrcup str CM YB-G- memory relative cursor addressing +cursor_normal cnorm str ve YBCGE make cursor appear normal (undo civis/cvvis) +cursor_right cuf1 str nd YBCGE non-destructive space (move right one space) +cursor_to_ll ll str ll YBCGE last line, first column (if no cup) +cursor_up cuu1 str up YBCGE up one line +cursor_visible cvvis str vs YBCGE make cursor very visible +delete_character dch1 str dc YBCGE delete character (P*) +delete_line dl1 str dl YBCGE delete line (P*) +dis_status_line dsl str ds YB-G- disable status line +down_half_line hd str hd YB-G- half a line down +enter_alt_charset_mode smacs str as YB-G- start alternate character set (P) +enter_blink_mode blink str mb YB-G- turn on blinking +enter_bold_mode bold str md YB-G- turn on bold (extra bright) mode +enter_ca_mode smcup str ti YBCGE string to start programs using cup +enter_delete_mode smdc str dm YBCGE enter delete mode +enter_dim_mode dim str mh YB-G- turn on half-bright mode +enter_insert_mode smir str im YBCGE enter insert mode +enter_secure_mode invis str mk -B-G-* turn on blank mode (characters invisible) +enter_protected_mode prot str mp -B-G-* turn on protected mode +enter_reverse_mode rev str mr YB-G- turn on reverse video mode +enter_standout_mode smso str so YBCGE begin standout mode +enter_underline_mode smul str us YBCGE begin underline mode +erase_chars ech str ec YB-G- erase #1 characters (P) +exit_alt_charset_mode rmacs str ae YB-G- end alternate character set (P) +exit_attribute_mode sgr0 str me YB-GE turn off all attributes +exit_ca_mode rmcup str te YBCGE strings to end programs using cup +exit_delete_mode rmdc str ed YBCGE end delete mode +exit_insert_mode rmir str ei YBCGE exit insert mode +exit_standout_mode rmso str se YBCGE exit standout mode +exit_underline_mode rmul str ue YBCGE exit underline mode +flash_screen flash str vb YBCGE visible bell (may not move cursor) +form_feed ff str ff YB-G- hardcopy terminal page eject (P*) +from_status_line fsl str fs YB-G- return from status line +init_1string is1 str i1 YB-G- initialization string +init_2string is2 str is YB-G- initialization string +init_3string is3 str i3 YB-G- initialization string +init_file if str if YB-G- name of initialization file +insert_character ich1 str ic YBCGE insert character (P) +insert_line il1 str al YBCGE insert line (P*) +insert_padding ip str ip YBCGE insert padding after inserted character +key_backspace kbs str kb YB-G- backspace key +key_catab ktbc str ka -B-G-* clear-all-tabs key +key_clear kclr str kC -B-G-* clear-screen or erase key +key_ctab kctab str kt -B-G-* clear-tab key +key_dc kdch1 str kD YB-G- delete-character key +key_dl kdl1 str kL -B-G-* delete-line key +key_down kcud1 str kd YBCGE down-arrow key +key_eic krmir str kM -B-G-* sent by rmir or smir in insert mode +key_eol kel str kE -B-G-* clear-to-end-of-line key +key_eos ked str kS -B-G-* clear-to-end-of-screen key +key_f0 kf0 str k0 YBCGE F0 function key +key_f1 kf1 str k1 YBCGE F1 function key +key_f10 kf10 str k; ----E F10 function key +key_f2 kf2 str k2 YBCGE F2 function key +key_f3 kf3 str k3 YBCGE F3 function key +key_f4 kf4 str k4 YBCGE F4 function key +key_f5 kf5 str k5 YBCGE F5 function key +key_f6 kf6 str k6 YBCGE F6 function key +key_f7 kf7 str k7 YBCGE F7 function key +key_f8 kf8 str k8 YBCGE F8 function key +key_f9 kf9 str k9 YBCGE F9 function key +key_home khome str kh YBCGE home key +key_ic kich1 str kI YB-GE insert-character key +key_il kil1 str kA -B-G-* insert-line key +key_left kcub1 str kl YBCGE left-arrow key +key_ll kll str kH YB-G- lower-left key (home down) +key_npage knp str kN YB-GE next-page key +key_ppage kpp str kP YB-GE previous-page key +key_right kcuf1 str kr YBCGE right-arrow key +key_sf kind str kF -B-G-* scroll-forward key +key_sr kri str kR -B-G-* scroll-backward key +key_stab khts str kT -B-G-* set-tab key +key_up kcuu1 str ku YBCGE up-arrow key +keypad_local rmkx str ke YBCGE leave 'keyboard_transmit' mode +keypad_xmit smkx str ks YBCGE enter 'keyboard_transmit' mode +lab_f0 lf0 str l0 -B-G-* label on function key f0 if not f0 +lab_f1 lf1 str l1 -B-G-* label on function key f1 if not f1 +lab_f10 lf10 str la ----- label on function key f10 if not f10 +lab_f2 lf2 str l2 -B-G-* label on function key f2 if not f2 +lab_f3 lf3 str l3 -B-G-* label on function key f3 if not f3 +lab_f4 lf4 str l4 -B-G-* label on function key f4 if not f4 +lab_f5 lf5 str l5 -B-G-* label on function key f5 if not f5 +lab_f6 lf6 str l6 -B-G-* label on function key f6 if not f6 +lab_f7 lf7 str l7 -B-G-* label on function key f7 if not f7 +lab_f8 lf8 str l8 -B-G-* label on function key f8 if not f8 +lab_f9 lf9 str l9 -B-G-* label on function key f9 if not f9 +meta_off rmm str mo YB-G-* turn off meta mode +meta_on smm str mm YB-G-* turn on meta mode (8th-bit on) +newline nel str nw YB-G-* newline (behave like cr followed by lf) +pad_char pad str pc YBCGE padding char (instead of null) +parm_dch dch str DC YB-GE delete #1 characters (P*) +parm_delete_line dl str DL YBCGE delete #1 lines (P*) +parm_down_cursor cud str DO YBCGE down #1 lines (P*) +parm_ich ich str IC YB-GE insert #1 characters (P*) +parm_index indn str SF YBCG- scroll forward #1 lines (P) +parm_insert_line il str AL YBCGE insert #1 lines (P*) +parm_left_cursor cub str LE YBCGE move #1 characters to the left (P) +parm_right_cursor cuf str RI YBCGE move #1 characters to the right (P*) +parm_rindex rin str SR YBCG- scroll back #1 lines (P) +parm_up_cursor cuu str UP YBCGE up #1 lines (P*) +pkey_key pfkey str pk -B--- program function key #1 to type string #2 +pkey_local pfloc str pl -B--- program function key #1 to execute string #2 +pkey_xmit pfx str px -B--- program function key #1 to transmit string #2 +print_screen mc0 str ps -B-G-* print contents of screen +prtr_off mc4 str pf -B-G-* turn off printer +prtr_on mc5 str po -B-G-* turn on printer +repeat_char rep str rp YB-GE repeat char #1 #2 times (P*) +reset_1string rs1 str r1 -B--- reset string +reset_2string rs2 str r2 -B--- reset string +reset_3string rs3 str r3 -B--- reset string +reset_file rf str rf -B--- name of reset file +restore_cursor rc str rc YBCG- restore cursor to position of last save_cursor +row_address vpa str cv -B-GE** vertical position #1 absolute (P) +save_cursor sc str sc YBCG- save current cursor position (P) +scroll_forward ind str sf YBCGE scroll text up (P) +scroll_reverse ri str sr YBCGE scroll text down (P) +set_attributes sgr str sa YB-G- define video attributes #1-#9 (PG9) +set_tab hts str st YB-G- set a tab in every row, current columns +set_window wind str wi -B-GE current window is lines #1-#2 cols #3-#4 +tab ht str ta YBCGE tab to next 8-space hardware tab stop +to_status_line tsl str ts YB-G- move to status line +underline_char uc str uc YBCG- underline char and move past it +up_half_line hu str hu YB-G- half a line up +init_prog iprog str iP -B--- path name of program for initialization +key_a1 ka1 str K1 YB-GE upper left of keypad +key_a3 ka3 str K3 YB-GE upper right of keypad +key_b2 kb2 str K2 YB-GE center of keypad +key_c1 kc1 str K4 YB-GE lower left of keypad +key_c3 kc3 str K5 YB-GE lower right of keypad +prtr_non mc5p str pO -B-G-* turn on printer for #1 bytes +# +# SVr1 capabilities stop here. IBM's version of terminfo is the same as +# SVr4 up to this point, but has a different set afterwards. +# +char_padding rmp str rP ----- like ip but when in insert mode +acs_chars acsc str ac ----- graphics charset pairs, based on vt100 +plab_norm pln str pn ----- program label #1 to show string #2 +key_btab kcbt str kB ----- back-tab key +enter_xon_mode smxon str SX ----- turn on xon/xoff handshaking +exit_xon_mode rmxon str RX ----- turn off xon/xoff handshaking +enter_am_mode smam str SA ----- turn on automatic margins +exit_am_mode rmam str RA ----- turn off automatic margins +xon_character xonc str XN ----- XON character +xoff_character xoffc str XF ----- XOFF character +ena_acs enacs str eA ----- enable alternate char set +label_on smln str LO ----- turn on soft labels +label_off rmln str LF ----- turn off soft labels +key_beg kbeg str @1 ----- begin key +key_cancel kcan str @2 ----- cancel key +key_close kclo str @3 ----- close key +key_command kcmd str @4 ----- command key +key_copy kcpy str @5 ----- copy key +key_create kcrt str @6 ----- create key +key_end kend str @7 ----- end key +key_enter kent str @8 ----- enter/send key +key_exit kext str @9 ----- exit key +key_find kfnd str @0 ----- find key +key_help khlp str %1 ----- help key +key_mark kmrk str %2 ----- mark key +key_message kmsg str %3 ----- message key +key_move kmov str %4 ----- move key +key_next knxt str %5 ----- next key +key_open kopn str %6 ----- open key +key_options kopt str %7 ----- options key +key_previous kprv str %8 ----- previous key +key_print kprt str %9 ----- print key +key_redo krdo str %0 ----- redo key +key_reference kref str &1 ----- reference key +key_refresh krfr str &2 ----- refresh key +key_replace krpl str &3 ----- replace key +key_restart krst str &4 ----- restart key +key_resume kres str &5 ----- resume key +key_save ksav str &6 ----- save key +key_suspend kspd str &7 ----- suspend key +key_undo kund str &8 ----- undo key +key_sbeg kBEG str &9 ----- shifted begin key +key_scancel kCAN str &0 ----- shifted cancel key +key_scommand kCMD str *1 ----- shifted command key +key_scopy kCPY str *2 ----- shifted copy key +key_screate kCRT str *3 ----- shifted create key +key_sdc kDC str *4 ----- shifted delete-character key +key_sdl kDL str *5 ----- shifted delete-line key +key_select kslt str *6 ----- select key +key_send kEND str *7 ----- shifted end key +key_seol kEOL str *8 ----- shifted clear-to-end-of-line key +key_sexit kEXT str *9 ----- shifted exit key +key_sfind kFND str *0 ----- shifted find key +key_shelp kHLP str #1 ----- shifted help key +key_shome kHOM str #2 ----- shifted home key +key_sic kIC str #3 ----- shifted insert-character key +key_sleft kLFT str #4 ----- shifted left-arrow key +key_smessage kMSG str %a ----- shifted message key +key_smove kMOV str %b ----- shifted move key +key_snext kNXT str %c ----- shifted next key +key_soptions kOPT str %d ----- shifted options key +key_sprevious kPRV str %e ----- shifted previous key +key_sprint kPRT str %f ----- shifted print key +key_sredo kRDO str %g ----- shifted redo key +key_sreplace kRPL str %h ----- shifted replace key +key_sright kRIT str %i ----- shifted right-arrow key +key_srsume kRES str %j ----- shifted resume key +key_ssave kSAV str !1 ----- shifted save key +key_ssuspend kSPD str !2 ----- shifted suspend key +key_sundo kUND str !3 ----- shifted undo key +req_for_input rfi str RF ----- send next input char (for ptys) +key_f11 kf11 str F1 ----E F11 function key +key_f12 kf12 str F2 ----E F12 function key +key_f13 kf13 str F3 ----E F13 function key +key_f14 kf14 str F4 ----E F14 function key +key_f15 kf15 str F5 ----E F15 function key +key_f16 kf16 str F6 ----E F16 function key +key_f17 kf17 str F7 ----E F17 function key +key_f18 kf18 str F8 ----E F18 function key +key_f19 kf19 str F9 ----E F19 function key +key_f20 kf20 str FA ----E F20 function key +key_f21 kf21 str FB ----E F21 function key +key_f22 kf22 str FC ----E F22 function key +key_f23 kf23 str FD ----E F23 function key +key_f24 kf24 str FE ----E F24 function key +key_f25 kf25 str FF ----E F25 function key +key_f26 kf26 str FG ----E F26 function key +key_f27 kf27 str FH ----E F27 function key +key_f28 kf28 str FI ----E F28 function key +key_f29 kf29 str FJ ----E F29 function key +key_f30 kf30 str FK ----E F30 function key +key_f31 kf31 str FL ----E F31 function key +key_f32 kf32 str FM ----E F32 function key +key_f33 kf33 str FN ----E F33 function key +key_f34 kf34 str FO ----E F34 function key +key_f35 kf35 str FP ----E F35 function key +key_f36 kf36 str FQ ----E F36 function key +key_f37 kf37 str FR ----E F37 function key +key_f38 kf38 str FS ----E F38 function key +key_f39 kf39 str FT ----E F39 function key +key_f40 kf40 str FU ----E F40 function key +key_f41 kf41 str FV ----E F41 function key +key_f42 kf42 str FW ----E F42 function key +key_f43 kf43 str FX ----E F43 function key +key_f44 kf44 str FY ----E F44 function key +key_f45 kf45 str FZ ----E F45 function key +key_f46 kf46 str Fa ----E F46 function key +key_f47 kf47 str Fb ----E F47 function key +key_f48 kf48 str Fc ----E F48 function key +key_f49 kf49 str Fd ----E F49 function key +key_f50 kf50 str Fe ----E F50 function key +key_f51 kf51 str Ff ----E F51 function key +key_f52 kf52 str Fg ----E F52 function key +key_f53 kf53 str Fh ----E F53 function key +key_f54 kf54 str Fi ----E F54 function key +key_f55 kf55 str Fj ----E F55 function key +key_f56 kf56 str Fk ----E F56 function key +key_f57 kf57 str Fl ----E F57 function key +key_f58 kf58 str Fm ----E F58 function key +key_f59 kf59 str Fn ----E F59 function key +key_f60 kf60 str Fo ----E F60 function key +key_f61 kf61 str Fp ----E F61 function key +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_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) +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 +hangup hup str HU ----- hang-up phone +dial_phone dial str DI ----- dial number #1 +quick_dial qdial str QD ----- dial number #1 without checking +tone tone str TO ----- select touch tone dialing +pulse pulse str PU ----- select pulse dialing +flash_hook hook str fh ----- flash switch hook +fixed_pause pause str PA ----- pause for 2-3 seconds +wait_tone wait str WA ----- wait for dial-tone +user0 u0 str u0 ----- User string #0 +user1 u1 str u1 ----- User string #1 +user2 u2 str u2 ----- User string #2 +user3 u3 str u3 ----- User string #3 +user4 u4 str u4 ----- User string #4 +user5 u5 str u5 ----- User string #5 +user6 u6 str u6 ----- User string #6 +user7 u7 str u7 ----- User string #7 +user8 u8 str u8 ----- User string #8 +user9 u9 str u9 ----- User string #9 +# +# SVr4 added these capabilities to support color +# +orig_pair op str op ----- Set default pair to its original value +orig_colors oc str oc ----- Set all color pairs to the original ones +initialize_color initc str Ic ----- initialize color #1 to (#2,#3,#4) +initialize_pair initp str Ip ----- Initialize color pair #1 to fg=(#2,#3,#4), bg=(#5,#6,#7) +set_color_pair scp str sp ----- Set current color pair to #1 +set_foreground setf str Sf ----- Set foreground color #1 +set_background setb str Sb ----- Set background color #1 +# +# SVr4 added these capabilities to support printers +# +change_char_pitch cpi str ZA ----- Change number of characters per inch +change_line_pitch lpi str ZB ----- Change number of lines per inch +change_res_horz chr str ZC ----- Change horizontal resolution +change_res_vert cvr str ZD ----- Change vertical resolution +define_char defc str ZE ----- Define a character +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 +enter_leftward_mode slm str ZI ----- Start leftward carriage motion +enter_micro_mode smicm str ZJ ----- Start micro-motion mode +enter_near_letter_quality snlq str ZK ----- Enter NLQ mode +enter_normal_quality snrmq str ZL ----- Enter normal-quality mode +enter_shadow_mode sshm str ZM ----- Enter shadow-print mode +enter_subscript_mode ssubm str ZN ----- Enter subscript mode +enter_superscript_mode ssupm str ZO ----- Enter superscript mode +enter_upward_mode sum str ZP ----- Start upward carriage motion +exit_doublewide_mode rwidm str ZQ ----- End double-wide mode +exit_italics_mode ritm str ZR ----- End italic mode +exit_leftward_mode rlm str ZS ----- End left-motion mode +exit_micro_mode rmicm str ZT ----- End micro-motion mode +exit_shadow_mode rshm str ZU ----- End shadow-print mode +exit_subscript_mode rsubm str ZV ----- End subscript mode +exit_superscript_mode rsupm str ZW ----- End superscript mode +exit_upward_mode rum str ZX ----- End reverse character motion +micro_column_address mhpa str ZY ----- Like column_address in micro mode +micro_down mcud1 str ZZ ----- Like cursor_down in micro mode +micro_left mcub1 str Za ----- Like cursor_left in micro mode +micro_right mcuf1 str Zb ----- Like cursor_right in micro mode +micro_row_address mvpa str Zc ----- Like row_address in micro mode +micro_up mcuu1 str Zd ----- Like cursor_up in micro mode +order_of_pins porder str Ze ----- Match software bits to print-head pins +parm_down_micro mcud str Zf ----- Like parm_down_cursor in micro mode +parm_left_micro mcub str Zg ----- Like parm_left_cursor in micro mode +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 +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_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) +start_bit_image sbim str Zq ----- Start printing bit image graphics +start_char_set_def scsd str Zr ----- Start character set definition +stop_bit_image rbim str Zs ----- Stop printing bit image graphics +stop_char_set_def rcsd str Zt ----- End definition of character set +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 +zero_motion zerom str Zx ----- No motion for subsequent character +#%.TE +#%.ad +#% +#%The following string capabilities are present in the SVr4.0 term structure, +#%but were originally not documented in the man page. +#% +#%.na +#%.TS H +#%center expand; +#%c l l c +#%c l l c +#%lw25 lw6 lw2 lw18. +#%\fBVariable Cap- TCap Description\fR +#%\fBString name Code\fR +char_set_names csnm str Zy ----- 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 +get_mouse getm str Gm ----- Curses should get button events +set_a_foreground setaf str AF ----- Set foreground color using ANSI escape +set_a_background setab str AB ----- Set background color using ANSI escape +pkey_plab pfxl str xl ----- Program function key #1 to type string #2 and show string #3 +device_type devt str dv ----- Indicate language/codeset support +code_set_init csin str ci ----- Init sequence for multiple codesets +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_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 +bit_image_carriage_return bicr str Yv ----- Move to beginning of same row +color_names colornm str Yw ----- Give name for color #1 +define_bit_image_region defbi str Yx ----- Define rectangualar bit image region +end_bit_image_region endbi str Yy ----- End a bit-image region +set_color_band setcolor str Yz ----- Change to ribbon color #1 +set_page_length slines str YZ ----- Set page length to #1 lines +# +# SVr4 added these capabilities for direct PC-clone support +# +display_pc_char dispc str S1 ----- Display PC character +enter_pc_charset_mode smpch str S2 ----- Enter PC character display mode +exit_pc_charset_mode rmpch str S3 ----- Exit PC character display mode +enter_scancode_mode smsc str S4 ----- Enter PC scancode mode +exit_scancode_mode rmsc str S5 ----- Exit PC scancode mode +pc_term_options pctrm str S6 ----- PC terminal options +scancode_escape scesc str S7 ----- Escape for scancode emulation +alt_scancode_esc scesa str S8 ----- Alternate escape for scancode emulation +#%.TE +#%.ad +#% +#%.in .8i +#%The XSI Curses standard added these. They are some post-4.1 +#%versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x. +#%The \fBncurses\fR termcap names for them are invented; according to the +#%XSI Curses standard, they have no termcap names. If your compiled terminfo +#%entries use these, they may not be binary-compatible with System V terminfo +#%entries after SVr4.1; beware! +#% +#%.na +#%.TS H +#%center expand; +#%c l l c +#%c l l c +#%lw25 lw6 lw2 lw20. +#%\fBVariable Cap- TCap Description\fR +#%\fBString name Code\fR +enter_horizontal_hl_mode ehhlm str Xh ----- Enter horizontal highlight mode +enter_left_hl_mode elhlm str Xl ----- Enter left highlight mode +enter_low_hl_mode elohlm str Xo ----- Enter low highlight mode +enter_right_hl_mode erhlm str Xr ----- Enter right highlight mode +enter_top_hl_mode ethlm str Xt ----- Enter top highlight mode +enter_vertical_hl_mode evhlm str Xv ----- Enter vertical highlight mode +set_a_attributes sgr1 str sA ----- Define second set of video attributes #1-#6 +set_pglen_inch slength str sL ----- YI Set page length to #1 hundredth of an inch +#%.TE +#%.ad +# +# The magic token below tells the tic compiler-generator code that all the caps +# past it should be ignored (not written out) when dumping terminfo objects. It +# also tells the man page table generator not to pass through following lines +# This means we can have obsolete capabilities and pseudo-capabilities that are +# recognized for termcap or terminfo compilation, but not output. +# +# %%-STOP-HERE-%% +# +# Don't move this casually! In fact, don't move it at all unless you're +# either doing it to add System V or XPG4 extensions, or have decided you +# don't care about SVr4 binary compatibility. +# +############################################################################# +# +# TERMCAP EXTENSION CAPABILITIES +# +# The capabilities below are either obsolete or extensions on certain systems. +# They are not used by SVR4 terminfo. Some are used by captoinfo to translate +# termcap sources; the rest are listed for completeness, and in case somebody +# cares about them enough to hack in code that will translate them into +# terminfo capabilities. +# +# The first part of the list is from Ross Ridge's `mytinfo' package +# (comp.sources.unix, volume 26); the variable names and terminfo names (as +# well as the termcap codes) match his list. +# +# This group of codes is not marked obsolete in 4.4BSD, but have no direct +# terminfo equivalents. The rs capability is specially translated to terminfo +# r2, and vice versa, if an entry does not already have an r2. Similarly, +# i2 is translated to r3 if there is no r3 (because SV terminfo maps is to i2). +# The ug capability is thrown away, but assumed to be whatever sg is if the +# latter is nonzero and we're dumping in termcap format. +# +termcap_init2 OTi2 str i2 YB--- secondary initialization string +termcap_reset OTrs str rs YB-G- terminal reset string +magic_cookie_glitch_ul OTug num ug YBCGE number of blanks left by ul +# +# Obsolete termcap capabilities. Some are used for termcap translation. The +# code uses the 'OT' prefix we put on obsolete capabilities to suppress +# printing them in terminfo source dumps of compiled entries. +# +backspaces_with_bs OTbs bool bs YBCGE uses ^H to move left +crt_no_scrolling OTns bool ns YBCG- crt cannot scroll +no_correctly_working_cr OTnc bool nc YBCG- no way to go to start of line +carriage_return_delay OTdC num dC YB-G- pad needed for CR +new_line_delay OTdN num dN YB-G- pad needed for LF +linefeed_if_not_lf OTnl str nl YBCGE use to move down +backspace_if_not_bs OTbc str bc YBCGE move left, if not ^H +# +# GNU termcap library extensions. The GNU termcap file distributed with +# Emacs no longer uses these, but MT showed up in pre-9.0 versions of the +# BSD termcap file. The name clash with terminfo MT is resolved by type +# info; MT is converted to km. +# +gnu_has_meta_key OTMT bool MT ----E has meta key +# gnu_tab_width OTtw num tw ----E tab width in spaces +# +# GNU termcap *does* include the following extended capability, Only the +# now-obsolete Ann Arbor terminals used it. +# +# gnu_change_scroll_region OTcS str cS ---GE alternate set scrolling region +# +# The following comments describe capnames so ancient that I believe no +# software uses them any longer. Some of these have to go because they +# clash with terminfo names in ways that cannot be resolved by type +# information. +# +# These mytinfo codes are not used in the 4.4BSD curses code. They are +# marked obsolete in the 4.4BSD manual pages. +# +# There is one conflict with terminfo; ma is in both. This conflict is +# resolved by type information. +# +# The `ko' capability is translated by special code. It should contain a +# comma-separated list of capabilities for which there are corresponding keys. +# The `kn' code is accepted but ignored. +# +# The `ma' capability seems to have been designed to map between the rogue(2) +# motion keys (including jkhl) and characters emitted by arrow keys on some +# primitive pre-ANSI terminals. It's so obsolete it's fossilized... +# +# Here is a description of memory_lock_above and memory_unlock: +# "You can 'freeze' data on the screen by turning on Memory Lock in a line of +# text. All lines above the cursor's current line become locked in place on +# the screen. Then enter data normally. When the screen fills up, any +# further data entered forces the first line of unfrozen line text to scroll +# under the frozen data. Lines scrolled off the screen are inserted into +# memory immediately preceding the first frozen line." (from the HP 700/96 +# User's manual). VT100/ANSI memory lock set is \E[>2h, reset is \E[>2l. +# +# Applications that use terminfo are supposed to behave as though xr is +# always true. +# +linefeed_is_newline OTNL bool NL YB--- move down with \n +# even_parity OTEP bool EP -B--- terminal requires even parity +# odd_parity OTOP bool OP -B--- terminal requires odd parity +# half_duplex OTHD bool HD -B--- terminal is half-duplex +# lower_case_only OTLC bool LC -B--- terminal has only lower case +# upper_case_only OTUC bool UC -B--- terminal has only upper case +backspace_delay OTdB num dB YB-G- padding required for ^H +# form_feed_delay OTdF num dF -B-G- padding required for ^L +horizontal_tab_delay OTdT num dT YB-G- padding required for ^I +# vertical_tab_delay OTdV num dV -B--- padding required for ^V +number_of_function_keys OTkn num kn -B-G- count of function keys +other_non_function_keys OTko str ko -B-G- list of self-mapped keycaps +arrow_key_map OTma str ma YBC-- map arrow keys rogue(1) motion keys +# memory_lock_above OTml str ml -B--- lock visible screen memory above the current line +# memory_unlock OTmu str mu -B--- unlock visible screen memory above the current line +has_hardware_tabs OTpt bool pt YB--- has 8-char tabs invoked with ^I +return_does_clr_eol OTxr bool xr YB--- return clears the line +# tek_4025_insert_line OTxx bool xx -BC-- Tektronix 4025 insert-line glitch +# +# mytinfo described this as a termcap capability, but it's not listed in the +# 4.4BSD man pages, and not found in the 4.4BSD termcap file. The ncurses +# package, like System V, behaves as though it is always true. +# +# rind_only_at_top OTxq bool xq ----- reverse index only works from top line +# +# University of Waterloo termcap extensions (as described in mytinfo). +# The `xl' termcap file clashes with a terminfo name; this ambiguity cannot +# be resolved by a type check. The descriptions are guesses from what was +# in the mytinfo tables. +# +# key_interrupt_char OTki str ki ----- string set by interrupt key (?) +# key_kill_char OTkk str kk ----- string set by kill key (?) +# key_suspend_char OTkz str kz ----- string set by suspend key (?) +# initialization_messy OTxc bool xc ----- initialization leaves garbage on the screen (?) +# ind_at_bottom_does_cr OTxl bool xl ----- index does a carriage return +# +# Nonstandard capabilities unique to Ross Ridge's `mytinfo' package. +# SR clashes with a terminfo name; this ambiguity cannot be resolved by a type +# check. +# +# scroll_left OTsl1 str Sl ----- scroll screen leftward +# scroll_right OTsr1 str Sr ----- scroll screen rightward +# parm_scroll_left OTsl str SL ----- scroll screen leftward #1 characters +# parm_scroll_right OTsr str SR ----- scroll screen rightward #1 characters +# +# The mytinfo capabilities end here. +# +# XENIX extensions: +# +# Xenix defined its own set of forms-drawing capabilities: +# +# cap IBM ASCII description ACS ASCII +# --- ----------- -------------------- ------------- ------ +# G1 191 \277 M-? single upper right ACS_URCORNER +# G2 218 \332 M-Z single upper left ACS_ULCORNER +# G3 192 \300 M-@ single lower left ACS_LLCORNER +# G4 217 \331 M-Y single lower right ACS_LRCORNER +# G5 187 \273 M-; double upper right +# G6 201 \311 M-I double upper left +# G7 200 \310 M-H double lower left +# G8 188 \274 M-< double lower right +# GC 197 \305 M-E single intersection ACS_PLUS _ _ +# GD 194 \302 M-B single down-tick ACS_TTEE | +# GH 196 \304 M-D single horizontal line ACS_HLINE +# GL 180 \264 M-4 single left tick ACS_RTEE -| +# GR 195 \303 M-C single right tick ACS_LTEE |- +# GU 193 \301 M-A single up tick ACS_BTEE _|_ +# GV 179 \263 M-3 single vertical line ACS_VLINE +# Gc 206 \316 M-N double intersection +# Gd 203 \313 M-K double down tick +# Gh 205 \315 M-M double horizontal line +# Gl 204 \204 M-L double left tick +# Gr 185 \271 M-9 double right tick +# Gu 202 \312 M-J double up tick +# Gv 186 \272 M-: double vertical line +# +# The compiler will translate the single-line caps and discard the others +# (via IGNORE aliases further down). We don't want to do normal pad +# translation on these, they're often single-character printable ASCII +# strings that happen to be numerics. There's awk code in parametrized.sh +# that detects the acs_ prefix and uses it to suppress pad translation. +# These terminfo names are invented. +# +acs_ulcorner OTG2 str G2 ----- single upper left +acs_llcorner OTG3 str G3 ----- single lower left +acs_urcorner OTG1 str G1 ----- single upper right +acs_lrcorner OTG4 str G4 ----- single lower right +acs_ltee OTGR str GR ----- tee pointing right +acs_rtee OTGL str GL ----- tee pointing left +acs_btee OTGU str GU ----- tee pointing up +acs_ttee OTGD str GD ----- tee pointing down +acs_hline OTGH str GH ----- single horizontal line +acs_vline OTGV str GV ----- single vertical line +acs_plus OTGC str GC ----- single intersection +# +############################################################################# +# +# TERMINFO EXTENSION CAPABILITIES +# +# This section is almost all comments. What it's mainly for is to describe +# what capabilities need to be squeezed out to get down to the XSI Curses +# standard set. They are flagged with K. +# +# HP extensions +# +# These extensions follow ptr_non (replacing everything after it) in HP +# terminfo files. Except for memory_lock and memory_unlock, they are +# functionally identical to SVr4 extensions, but they make the binary format +# different. Grrr.... +# +memory_lock meml str ml ----K memory lock above +memory_unlock memu str mu ----K memory unlock +#plab_norm pln str pn ----- program label #1 to show string #2 +#label_on smln str LO ----- turn on soft labels +#label_off rmln str LF ----- turn off soft labels +#key_f11 kf11 str F1 ----- F11 function key +#key_f12 kf12 str F2 ----- F12 function key +#key_f13 kf13 str F3 ----- F13 function key +#key_f14 kf14 str F4 ----- F14 function key +#key_f15 kf15 str F5 ----- F15 function key +#key_f16 kf16 str F6 ----- F16 function key +#key_f17 kf17 str F7 ----- F17 function key +#key_f18 kf18 str F8 ----- F18 function key +#key_f19 kf19 str F9 ----- F19 function key +#key_f20 kf20 str FA ----- F20 function key +#key_f21 kf21 str FB ----- F21 function key +#key_f22 kf22 str FC ----- F22 function key +#key_f23 kf23 str FD ----- F23 function key +#key_f24 kf24 str FE ----- F24 function key +#key_f25 kf25 str FF ----- F25 function key +#key_f26 kf26 str FG ----- F26 function key +#key_f27 kf27 str FH ----- F27 function key +#key_f28 kf28 str FI ----- F28 function key +#key_f29 kf29 str FJ ----- F29 function key +#key_f30 kf30 str FK ----- F30 function key +#key_f31 kf31 str FL ----- F31 function key +#key_f32 kf32 str FM ----- F32 function key +#key_f33 kf33 str FN ----- F33 function key +#key_f34 kf34 str FO ----- F34 function key +#key_f35 kf35 str FP ----- F35 function key +#key_f36 kf36 str FQ ----- F36 function key +#key_f37 kf37 str FR ----- F37 function key +#key_f38 kf38 str FS ----- F38 function key +#key_f39 kf39 str FT ----- F39 function key +#key_f40 kf40 str FU ----- F40 function key +#key_f41 kf41 str FV ----- F41 function key +#key_f42 kf42 str FW ----- F42 function key +#key_f43 kf43 str FX ----- F43 function key +#key_f44 kf44 str FY ----- F44 function key +#key_f45 kf45 str FZ ----- F45 function key +#key_f46 kf46 str Fa ----- F46 function key +#key_f47 kf47 str Fb ----- F47 function key +#key_f48 kf48 str Fc ----- F48 function key +#key_f49 kf49 str Fd ----- F49 function key +#key_f50 kf50 str Fe ----- F50 function key +#key_f51 kf51 str Ff ----- F51 function key +#key_f52 kf52 str Fg ----- F52 function key +#key_f53 kf53 str Fh ----- F53 function key +#key_f54 kf54 str Fi ----- F54 function key +#key_f55 kf55 str Fj ----- F55 function key +#key_f56 kf56 str Fk ----- F56 function key +#key_f57 kf57 str Fl ----- F57 function key +#key_f58 kf58 str Fm ----- F58 function key +#key_f59 kf59 str Fn ----- F59 function key +#key_f60 kf60 str Fo ----- F60 function key +#key_f61 kf61 str Fp ----- F61 function key +#key_f62 kf62 str Fq ----- F62 function key +#key_f63 kf63 str Fr ----- F63 function key +# +# IBM extensions +# +# These extensions follow ptr_non (replacing everything after it) in IBM +# terminfo files. +# +# The places in the box[12] capabilities correspond to acsc characters, here is +# the mapping: +# +# box1[0] = ACS_ULCORNER +# box1[1] = ACS_HLINE +# box1[2] = ACS_URCORNER +# box1[3] = ACS_VLINE +# box1[4] = ACS_LRCORNER +# box1[5] = ACS_LLCORNER +# box1[6] = ACS_TTEE +# box1[7] = ACS_RTEE +# box1[8] = ACS_BTEE +# box1[9] = ACS_LTEE +# box1[10] = ACS_PLUS +# +# The box2 characters are the double-line versions of these forms graphics. +# +box_chars_1 box1 str bx ----K box characters primary set +#box_chars_2 box2 str by ----K box characters secondary set +#box_attr_1 batt1 str Bx ----K attributes for box1 +#box_attr_2 batt2 str By ----K attributes for box2 +#color_bg_0 colb0 str d0 ----K background color 0 +#color_bg_1 colb1 str d1 ----K background color 1 +#color_bg_2 colb2 str d2 ----K background color 2 +#color_bg_3 colb3 str d3 ----K background color 3 +#color_bg_4 colb4 str d4 ----K background color 4 +#color_bg_5 colb5 str d5 ----K background color 5 +#color_bg_6 colb6 str d6 ----K background color 6 +#color_bg_7 colb7 str d7 ----K background color 7 +#color_fg_0 colf0 str c0 ----K foreground color 0 +#color_fg_1 colf1 str c1 ----K foreground color 1 +#color_fg_2 colf2 str c2 ----K foreground color 2 +#color_fg_3 colf3 str c3 ----K foreground color 3 +#color_fg_4 colf4 str c4 ----K foreground color 4 +#color_fg_5 colf5 str c5 ----K foreground color 5 +#color_fg_6 colf6 str c6 ----K foreground color 6 +#color_fg_7 colf7 str c7 ----K foreground color 7 +#font_0 font0 str f0 ----- select font 0 +#font_1 font1 str f1 ----- select font 1 +#font_2 font2 str f2 ----- select font 2 +#font_3 font3 str f3 ----- select font 3 +#font_4 font4 str f4 ----K select font 4 +#font_5 font5 str f5 ----K select font 5 +#font_6 font6 str f6 ----K select font 6 +#font_7 font7 str f7 ----K select font 7 +#key_back_tab kbtab str k0 ----- backtab key +#key_do kdo str ki ----K do request key +#key_command kcmd str kd ----K command-request key +#key_command_pane kcpn str kW ----K command-pane key +#key_end kend str kw ----- end key +#key_help khlp str kq ----- help key +#key_newline knl str nl ----K newline key +#key_next_pane knpn str kv ----K next-pane key +#key_prev_cmd kppn str kp ----K previous-command key +#key_prev_pane kppn str kV ----K previous-pane key +#key_quit kquit str kQ ----K quit key +#key_select ksel str kU ----- select key +#key_scroll_left kscl str kz ----K scroll left +#key_scroll_right kscr str kZ ----K scroll right +#key_tab ktab str ko ----K tab key +#key_smap_in1 kmpf1 str Kv ----K special mapped key 1 input +#key_smap_out1 kmpt1 str KV ----K special mapped key 1 output +#key_smap_in2 kmpf2 str Kw ----K special mapped key 2 input +#key_smap_out2 kmpt2 str KW ----K special mapped key 2 output +#key_smap_in3 kmpf3 str Kx ----K special mapped key 3 input +#key_smap_out3 kmpt3 str KX ----K special mapped key 3 output +#key_smap_in4 kmpf4 str Ky ----K special mapped key 4 input +#key_smap_out4 kmpt4 str KY ----K special mapped key 4 output +#key_smap_in5 kmpf5 str Kz ----K special mapped key 5 input +#key_smap_out5 kmpt5 str KZ ----K special mapped key 5 output +#appl_defined_str apstr str za ----K application-defined string +# The key_smap_in[6789] and key_smap_out[6789] 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 almost certainly wrong. +#key_smap_in6 kmpf6 str k! ----K special mapped key 6 input +#key_smap_out6 kmpt6 str K@ ----K special mapped key 6 output +#key_smap_in7 kmpf7 str k# ----K special mapped key 7 input +#key_smap_out7 kmpt7 str K$ ----K special mapped key 7 output +#key_smap_in8 kmpf8 str k% ----K special mapped key 8 input +#key_smap_out8 kmpt8 str K^ ----K special mapped key 8 output +#key_smap_in9 kmpf9 str k& ----K special mapped key 9 input +#key_smap_out9 kmpt9 str K* ----K special mapped key 9 output +# Undocumented capabilities end here +#key_sf1 ksf1 str S1 ----K special function key 1 +#key_sf2 ksf2 str S2 ----K special function key 2 +#key_sf3 ksf3 str S3 ----K special function key 3 +#key_sf4 ksf4 str S4 ----K special function key 4 +#key_sf5 ksf5 str S5 ----K special function key 5 +#key_sf6 ksf6 str S6 ----K special function key 6 +#key_sf7 ksf7 str S7 ----K special function key 7 +#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 +#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 +# valid only for aixterm descriptions. +#enter_topline_mode topl str tp ----K start top-line mode +#enter_bottom_mode btml str bm ----K start bottom-line mode +#enter_rvert_mode rvert str rv ----K start right-vertical mode +#enter_lvert_mode lvert str lv ----K start left-vertical mode +# +############################################################################# +# +# ALIAS DECLARATIONS +# +# Here we set up aliases for translating extensions into standard terminfo. +# +#---------------------------------- Termcap aliases ------------------------- +# +# BSD aliases: +# +# This is a common error in many termcap files. We'll get notified during +# translation when this (or any other alias) fires. +# +capalias sb sr BSD scroll text down +# +# AT&T extensions: +# +# The old AT&T 5410, 5420, 5425, pc6300plus, 610, and s4 entries used a set of +# nonstandard capabilities. Its signature is the KM capability, used to name +# some sort of keymap file. EE, BO, CI, CV, XS, DS, FL and FE are in this +# set. Comments in the original, and a little cross-checking with other AT&T +# documentation, seem to establish the following mappings: +# +capalias BO mr AT&T enter_reverse_mode +capalias CI vi AT&T cursor_invisible +capalias CV ve AT&T cursor_normal +capalias DS mh AT&T enter_dim_mode +#capalias EE me AT&T exit_attribute_mode +capalias FE LF AT&T label_on +capalias FL LO AT&T label_off +capalias XS mk AT&T enter_secure_mode +# +# We comment out EE because the conflicting XENIX EE is more common in +# old entries. +# +# XENIX extensions: +# +# These are the ones we know how to translate directly: +# +capalias EE mh XENIX exit_attribute_mode +capalias GE ae XENIX exit_alt_charset_mode +capalias GS as XENIX enter_alt_charset_mode +capalias CF vi XENIX cursor_invis +capalias CO ve XENIX cursor_normal +capalias EN @7 XENIX key_end +capalias HM kh XENIX key_home +capalias LD kL XENIX key_dl +capalias PD kN XENIX key_npage +capalias PN po XENIX prtr_off +capalias PS pf XENIX prtr_on +capalias PU kP XENIX key_ppage +capalias RT @8 XENIX kent +capalias UP ku XENIX kcuu1 +capalias G6 IGNORE XENIX double-ACS_ULCORNER +capalias G7 IGNORE XENIX double-ACS_LLCORNER +capalias G5 IGNORE XENIX double-ACS_URCORNER +capalias G8 IGNORE XENIX double-ACS_LRCORNER +capalias Gr IGNORE XENIX double-ACS_LTEE +capalias Gr IGNORE XENIX double-ACS_RTEE +capalias Gu IGNORE XENIX double-ACS_BTEE +capalias Gd IGNORE XENIX double ACS_TTEE +capalias Gh IGNORE XENIX double-ACS_HLINE +capalias Gv IGNORE XENIX double-ACS_VLINE +capalias Gc IGNORE XENIX double-ACS_PLUS +capalias GG IGNORE XENIX acs-glitch +# +# IBM extensions: +# +capalias kq %1 IBM key_help +# +# Iris extensions: +# +capalias HS mh IRIS enter_dim_mode +# +# Tektronix extensions: +# +capalias KA k; Tek key_f10 +capalias KB F1 Tek key_f11 +capalias KC F2 Tek key_f12 +capalias KD F3 Tek key_f13 +capalias KE F4 Tek key_f14 +capalias KF F5 Tek key_f15 +capalias BC Sb Tek set_background +capalias FC Sf Tek set_foreground +# +# There are also the following: +# +# XENIX XENIX variable name name clash with terminfo? +# ----- ------------------- ------------------------- +# CL key_char_left +# CR key_char_right +# CW key_change_window +# HP ?? +# LF key_linefeed label_off +# NU key_next_unlocked_cell +# PL ?? +# PR ?? +# RC key_recalc remove_clock +# RF key_toggle_ref req_for_input +# WL key_word_left +# WR key_word_right +# +# If you know what any of the question-marked ones mean, please tell us. +# +#--------------------------------- Terminfo aliases ------------------------ +# +# IBM extensions: +# +infoalias font0 s0ds IBM set0_des_seq +infoalias font1 s1ds IBM set1_des_seq +infoalias font2 s2ds IBM set2_des_seq +infoalias font3 s3ds IBM set3_des_seq +infoalias kbtab kcbt IBM key_backtab +infoalias ksel kslt IBM key_select +# +# Some others are identical to SVr4/XPG4 capabilities, in particular: +# kcmd, kend, khlp, and kf11...kf63. +# +############################################################################# +# +# The following sets edit modes for GNU EMACS +# Local Variables: +# case-fold-search:nil +# truncate-lines:t +# End: diff --git a/contrib/ncurses/include/MKhashsize.sh b/contrib/ncurses/include/MKhashsize.sh new file mode 100755 index 000000000000..d11d7bf23c8a --- /dev/null +++ b/contrib/ncurses/include/MKhashsize.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# +# MKhashsize.sh --- generate size include for hash functions +# +echo "/*" +echo " * hashsize.h -- hash and token table constants" +echo " */" + +CAPS="${1-Caps}" +TABSIZE=`grep -v '^[ #]' $CAPS | grep -v "^$" | grep -v "^capalias"| grep -v "^infoalias" | wc -l` + +echo "" +echo "#define CAPTABSIZE ${TABSIZE}" +echo "#define HASHTABSIZE (${TABSIZE} * 2)" diff --git a/contrib/ncurses/include/MKparametrized.sh b/contrib/ncurses/include/MKparametrized.sh new file mode 100755 index 000000000000..cbbc3e0d62eb --- /dev/null +++ b/contrib/ncurses/include/MKparametrized.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# +# MKparametrized.sh -- generate indirection vectors for various sort methods +# +# The output of this script is C source for an array specifying whether +# termcap strings should undergo parameter and padding translation. +# +CAPS="${1-Caps}" +cat <<EOF +/* + * parametrized.h --- is a termcap capability parametrized? + * + * Note: this file is generated using parametrized.sh, do not edit by hand. + * A value of -1 in the table means suppress both pad and % translations. + * A value of 0 in the table means do pad but not % translations. + * A value of 1 in the table means do both pad and % translations. + */ + +static short const parametrized[] = { +EOF + +# We detect whether % translations should be done by looking for #[0-9] in the +# description field. We presently suppress padding translation only for the +# XENIX acs_* capabilities. Maybe someday we'll dedicate a flag field for +# this, that would be cleaner.... + +${AWK-awk} <$CAPS ' +$3 != "str" {next;} +$1 ~ /^acs_/ {print "-1,\t/* ", $2, " */"; count++; next;} +$0 ~ /#[0-9]/ {print "1,\t/* ", $2, " */"; count++; next;} + {print "0,\t/* ", $2, " */"; count++;} +END {printf("} /* %d entries */;\n\n", count);} +' + diff --git a/contrib/ncurses/include/MKterm.h.awk.in b/contrib/ncurses/include/MKterm.h.awk.in new file mode 100644 index 000000000000..8e913a77f0fa --- /dev/null +++ b/contrib/ncurses/include/MKterm.h.awk.in @@ -0,0 +1,310 @@ + +BEGIN { + print "/****************************************************************************" + print " * Copyright (c) 1998 Free Software Foundation, Inc. *" + print " * *" + print " * Permission is hereby granted, free of charge, to any person obtaining a *" + print " * copy of this software and associated documentation files (the *" + print " * "Software"), to deal in the Software without restriction, including *" + print " * without limitation the rights to use, copy, modify, merge, publish, *" + print " * distribute, distribute with modifications, sublicense, and/or sell *" + print " * copies of the Software, and to permit persons to whom the Software is *" + print " * furnished to do so, subject to the following conditions: *" + print " * *" + print " * The above copyright notice and this permission notice shall be included *" + print " * in all copies or substantial portions of the Software. *" + print " * *" + print " * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *" + print " * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *" + print " * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *" + print " * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *" + print " * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *" + print " * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *" + print " * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *" + print " * *" + print " * Except as contained in this notice, the name(s) of the above copyright *" + print " * holders shall not be used in advertising or otherwise to promote the *" + print " * sale, use or other dealings in this Software without prior written *" + print " * authorization. *" + print " ****************************************************************************/" + print "" + print "/****************************************************************************/" + print "/* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 */" + print "/* and: Eric S. Raymond <esr@snark.thyrsus.com> */" + print "/****************************************************************************/" + print "" + print "/* $Id: MKterm.h.awk.in,v 1.35 1999/02/24 01:04:55 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 "" + print "#undef NCURSES_VERSION" + print "#define NCURSES_VERSION \"@NCURSES_MAJOR@.@NCURSES_MINOR@\"" + print "" + print "#ifdef __cplusplus" + print "extern \"C\" {" + print "#endif" + print "" + print "/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H" + print " * and BROKEN_LINKER definition (based on the system for which this was" + print " * configured)." + print " */" + print "" + print "#undef HAVE_TERMIOS_H" + print "#define HAVE_TERMIOS_H 1/*default*/" + print "" + print "#undef HAVE_TERMIO_H" + print "#define HAVE_TERMIO_H 0/*default*/" + print "" + print "#undef HAVE_TCGETATTR" + print "#define HAVE_TCGETATTR 1/*default*/" + print "" + print "#undef BROKEN_LINKER" + print "#define BROKEN_LINKER 0/*default*/" + print "" + print "#undef NCURSES_CONST" + print "#define NCURSES_CONST @NCURSES_CONST@" + print "" + print "#undef NCURSES_XNAMES" + print "#define NCURSES_XNAMES @NCURSES_XNAMES@" + print "" + print "/* We will use these symbols to hide differences between" + print " * termios/termio/sgttyb interfaces." + print " */" + print "#undef TTY" + print "#undef SET_TTY" + print "#undef GET_TTY" + print "" + print "/* Assume Posix termio if we have the header and function */" + print "#if HAVE_TERMIOS_H && HAVE_TCGETATTR" + print "" + print "#undef TERMIOS" + print "#define TERMIOS 1" + print "" + print "#include <termios.h>" + print "#define TTY struct termios" + print "" + print "#else /* !HAVE_TERMIOS_H */" + print "" + print "#if HAVE_TERMIO_H" + print "" + print "#undef TERMIOS" + print "#define TERMIOS 1" + print "" + print "#include <termio.h>" + print "#define TTY struct termio" + print "" + print "/* Add definitions to make termio look like termios." + print " * But ifdef it, since there are some implementations" + print " * that try to do this for us in a fake <termio.h>." + print " */" + print "#ifndef TCSANOW" + print "#define TCSANOW TCSETA" + print "#endif" + print "#ifndef TCSADRAIN" + print "#define TCSADRAIN TCSETAW" + print "#endif" + print "#ifndef TCSAFLUSH" + print "#define TCSAFLUSH TCSETAF" + print "#endif" + print "#ifndef tcsetattr" + print "#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)" + print "#endif" + print "#ifndef tcgetattr" + print "#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)" + print "#endif" + print "#ifndef cfgetospeed" + print "#define cfgetospeed(t) ((t)->c_cflag & CBAUD)" + print "#endif" + print "#ifndef TCIFLUSH " + print "#define TCIFLUSH 0" + print "#endif" + print "#ifndef TCOFLUSH " + print "#define TCOFLUSH 1" + print "#endif" + print "#ifndef TCIOFLUSH " + print "#define TCIOFLUSH 2" + print "#endif" + print "#ifndef tcflush" + print "#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)" + print "#endif" + print "" + print "#else /* !HAVE_TERMIO_H */" + print "" + print "#undef TERMIOS" + print "#include <sgtty.h>" + print "#include <sys/ioctl.h>" + print "#define TTY struct sgttyb" + print "" + print "#endif /* HAVE_TERMIO_H */" + print "" + print "#endif /* HAVE_TERMIOS_H */" + print "" + print "#ifdef TERMIOS" + print "#define GET_TTY(fd, buf) tcgetattr(fd, buf)" + print "#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)" + print "#else" + print "#define GET_TTY(fd, buf) gtty(fd, buf)" + print "#define SET_TTY(fd, buf) stty(fd, buf)" + print "#endif" + print "" + print "#define NAMESIZE 256" + print "" + print "#define CUR cur_term->type." + print "" + } + +$2 == "%%-STOP-HERE-%%" { + print "" + printf "#define BOOLWRITE %d\n", BoolCount + printf "#define NUMWRITE %d\n", NumberCount + printf "#define STRWRITE %d\n", StringCount + print "" + print "/* older synonyms for some capabilities */" + print "#define beehive_glitch no_esc_ctlc" + print "#define teleray_glitch dest_tabs_magic_smso" + print "#define micro_char_size micro_col_size" + print "" + print "#ifdef __INTERNAL_CAPS_VISIBLE" + } + +/^#/ {next;} + +$3 == "bool" { + printf "#define %-30s CUR Booleans[%d]\n", $1, BoolCount++ + } + +$3 == "num" { + printf "#define %-30s CUR Numbers[%d]\n", $1, NumberCount++ + } + +$3 == "str" { + printf "#define %-30s CUR Strings[%d]\n", $1, StringCount++ + } + +END { + print "#endif /* __INTERNAL_CAPS_VISIBLE */" + print "" + print "" + print "/*" + print " * Predefined terminfo array sizes" + print " */" + printf "#define BOOLCOUNT %d\n", BoolCount + printf "#define NUMCOUNT %d\n", NumberCount + printf "#define STRCOUNT %d\n", StringCount + print "" + print "typedef struct termtype { /* in-core form of terminfo data */" + print " char *term_names; /* str_table offset of term names */" + print " char *str_table; /* pointer to string table */" + print " char *Booleans; /* array of boolean values */" + print " short *Numbers; /* array of integer values */" + print " char **Strings; /* array of string offsets */" + print "" + print "#if NCURSES_XNAMES" + print " char *ext_str_table; /* pointer to extended string table */" + print " char **ext_Names; /* corresponding names */" + print "" + print " unsigned short num_Booleans;/* count total Booleans */" + print " unsigned short num_Numbers; /* count total Numbers */" + print " unsigned short num_Strings; /* count total Strings */" + print "" + print " unsigned short ext_Booleans;/* count extensions to Booleans */" + print " unsigned short ext_Numbers; /* count extensions to Numbers */" + print " unsigned short ext_Strings; /* count extensions to Strings */" + print "#endif /* NCURSES_XNAMES */" + print "" + print "} TERMTYPE;" + print "" + print "typedef struct term { /* describe an actual terminal */" + print " TERMTYPE type; /* terminal type description */" + print " short Filedes; /* file description being written to */" + print " TTY Ottyb, /* original state of the terminal */" + print " Nttyb; /* current state of the terminal */" + print " int _baudrate; /* used to compute padding */" + print "} TERMINAL;" + print "" + print "extern TERMINAL *cur_term;" + print "" + print "#if BROKEN_LINKER" + print "#define boolnames _nc_boolnames()" + print "#define boolcodes _nc_boolcodes()" + print "#define boolfnames _nc_boolfnames()" + print "#define numnames _nc_numnames()" + print "#define numcodes _nc_numcodes()" + print "#define numfnames _nc_numfnames()" + print "#define strnames _nc_strnames()" + 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 "" + 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 "" + 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 "" + print "/* entry points */" + print "extern TERMINAL *set_curterm(TERMINAL *);" + print "extern 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 "" + 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 "#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 "" + print "#ifdef __cplusplus" + print "}" + print "#endif" + print "" + print "#endif /* _NCU_TERM_H */" + } diff --git a/contrib/ncurses/include/Makefile.in b/contrib/ncurses/include/Makefile.in new file mode 100644 index 000000000000..724be6d5a744 --- /dev/null +++ b/contrib/ncurses/include/Makefile.in @@ -0,0 +1,106 @@ +# $Id: Makefile.in,v 1.22 1998/02/11 12:13:46 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 +# +# Makefile for ncurses source code. +# +# This makes/installs ncurses include-files +# +# The variable 'srcdir' refers to the source-distribution, and can be set with +# the configure script by "--srcdir=DIR". + +# turn off _all_ suffix rules; we'll generate our own +.SUFFIXES: + +SHELL = /bin/sh +THIS = Makefile + +INSTALL_PREFIX = @INSTALL_PREFIX@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +includedir = @includedir@ + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +AWK = @AWK@ +LN_S = @LN_S@ + +VERSION = @cf_cv_rel_version@ + +# These files are generated by the configure script +CONFIG_SRC = \ + MKterm.h.awk \ + curses.h \ + termcap.h \ + unctrl.h + +# These files are generated by this makefile +AUTO_SRC = \ + hashsize.h \ + parametrized.h \ + term.h + +################################################################################ +all \ +sources \ +install :: $(AUTO_SRC) + +term.h: $(srcdir)/Caps MKterm.h.awk + $(AWK) -f MKterm.h.awk $(srcdir)/Caps > $@ + sh $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@ + +hashsize.h: $(srcdir)/Caps $(srcdir)/MKhashsize.sh + sh $(srcdir)/MKhashsize.sh $(srcdir)/Caps >$@ + +parametrized.h: $(srcdir)/Caps $(srcdir)/MKparametrized.sh + AWK=$(AWK) sh $(srcdir)/MKparametrized.sh $(srcdir)/Caps >$@ + +tags: + ctags *.[ch] + +TAGS: + etags *.[ch] + +mostlyclean :: + -rm -f core tags TAGS *~ *.ln *.atac trace + +clean :: mostlyclean + -rm -f $(AUTO_SRC) + +distclean :: clean + -rm -f Makefile $(CONFIG_SRC) + +realclean :: distclean + +############################################################################### +# The remainder of this file is automatically generated during configuration +############################################################################### diff --git a/contrib/ncurses/include/capdefaults.c b/contrib/ncurses/include/capdefaults.c new file mode 100644 index 000000000000..af1193cc4981 --- /dev/null +++ b/contrib/ncurses/include/capdefaults.c @@ -0,0 +1,87 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* $Id: capdefaults.c,v 1.8 1998/07/04 22:31:04 tom Exp $ */ + + /* + * Compute obsolete capabilities. The reason this is an include file + * is that the two places where it's needed want the macros to + * generate offsets to different structures. See the file Caps for + * explanations of these conversions. + * + * Note: This code is the functional inverse of the first part + * of postprocess_entry(). + */ + { + char *sp; + int capval; + +#define EXTRACT_DELAY(str) (sp = strchr(str, '*'), sp ? atoi(sp+1) : 0) + + /* current (4.4BSD) capabilities marked obsolete */ + if (VALID_STRING(carriage_return) + && (capval = EXTRACT_DELAY(carriage_return))) + carriage_return_delay = capval; + if (VALID_STRING(newline) && (capval = EXTRACT_DELAY(newline))) + new_line_delay = capval; + + /* current (4.4BSD) capabilities not obsolete */ + if (!VALID_STRING(termcap_init2) && VALID_STRING(init_3string)) + { + termcap_init2 = init_3string; + init_3string = (char *)0; + } + if (VALID_STRING(reset_1string) + && !VALID_STRING(reset_2string) + && VALID_STRING(reset_3string)) + { + termcap_reset = reset_2string; + reset_2string = (char *)0; + } +#if USE_XMC_SUPPORT + if (magic_cookie_glitch_ul < 0 && magic_cookie_glitch && VALID_STRING(enter_underline_mode)) + magic_cookie_glitch_ul = magic_cookie_glitch; +#else + magic_cookie_glitch_ul = -1; +#endif + + /* totally obsolete capabilities */ + linefeed_is_newline = VALID_STRING(newline) + && (strcmp("\n", newline) == 0); + if (VALID_STRING(cursor_left) + && (capval = EXTRACT_DELAY(cursor_left))) + backspace_delay = capval; + if (VALID_STRING(tab) && (capval = EXTRACT_DELAY(tab))) + horizontal_tab_delay = capval; +#undef EXTRACT_DELAY + } diff --git a/contrib/ncurses/include/curses.h.in b/contrib/ncurses/include/curses.h.in new file mode 100644 index 000000000000..1ed87e596027 --- /dev/null +++ b/contrib/ncurses/include/curses.h.in @@ -0,0 +1,1346 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* $Id: curses.h.in,v 1.84 1999/07/24 20:15:42 tom Exp $ */ + +#ifndef __NCURSES_H +#define __NCURSES_H + +#define CURSES 1 +#define CURSES_H 1 + +/* This should be defined for the enhanced functionality to be visible. + * However, none of the wide-character (enhanced) functionality is implemented. + * So we do not define it (yet). +#define _XOPEN_CURSES 1 + */ + +/* These are defined only in curses.h, and are used for conditional compiles */ +#define NCURSES_VERSION_MAJOR @NCURSES_MAJOR@ +#define NCURSES_VERSION_MINOR @NCURSES_MINOR@ +#define NCURSES_VERSION_PATCH @NCURSES_PATCH@ + +/* This is defined in more than one ncurses header, for identification */ +#undef NCURSES_VERSION +#define NCURSES_VERSION "@NCURSES_MAJOR@.@NCURSES_MINOR@" + +#ifdef NCURSES_NOMACROS +#define NCURSES_ATTR_T attr_t +#endif + +#ifndef NCURSES_ATTR_T +#define NCURSES_ATTR_T int +#endif + +#undef NCURSES_CONST +#define NCURSES_CONST @NCURSES_CONST@ + +typedef unsigned @cf_cv_typeof_chtype@ chtype; + +#include <stdio.h> +#include <unctrl.h> +#include <stdarg.h> /* we need va_list */ +#ifdef _XOPEN_SOURCE_EXTENDED +#include <stddef.h> /* we want wchar_t */ +#endif /* _XOPEN_SOURCE_EXTENDED */ + +/* XSI and SVr4 specify that curses implements 'bool'. However, C++ may also + * implement it. If so, we must use the C++ compiler's type to avoid conflict + * with other interfaces. + */ + +#undef TRUE +#define TRUE 1 + +#undef FALSE +#define FALSE 0 + +#if (!defined(__cplusplus) || !@cf_cv_builtin_bool@) && (!@cf_cv_cc_bool_type@) +#undef bool +typedef @cf_cv_type_of_bool@ bool; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XSI attributes. In the ncurses implementation, they are identical to the + * A_ attributes. + */ +#define WA_ATTRIBUTES A_ATTRIBUTES +#define WA_NORMAL A_NORMAL +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE +#define WA_REVERSE A_REVERSE +#define WA_BLINK A_BLINK +#define WA_DIM A_DIM +#define WA_BOLD A_BOLD +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_INVIS A_INVIS +#define WA_PROTECT A_PROTECT +#define WA_HORIZONTAL A_HORIZONTAL +#define WA_LEFT A_LEFT +#define WA_LOW A_LOW +#define WA_RIGHT A_RIGHT +#define WA_TOP A_TOP +#define WA_VERTICAL A_VERTICAL + +/* colors */ +extern int COLORS; +extern int COLOR_PAIRS; + +#define COLOR_BLACK 0 +#define COLOR_RED 1 +#define COLOR_GREEN 2 +#define COLOR_YELLOW 3 +#define COLOR_BLUE 4 +#define COLOR_MAGENTA 5 +#define COLOR_CYAN 6 +#define COLOR_WHITE 7 + +/* line graphics */ + +extern chtype acs_map[]; + +/* VT100 symbols begin here */ +#define ACS_ULCORNER (acs_map['l']) /* upper left corner */ +#define ACS_LLCORNER (acs_map['m']) /* lower left corner */ +#define ACS_URCORNER (acs_map['k']) /* upper right corner */ +#define ACS_LRCORNER (acs_map['j']) /* lower right corner */ +#define ACS_LTEE (acs_map['t']) /* tee pointing right */ +#define ACS_RTEE (acs_map['u']) /* tee pointing left */ +#define ACS_BTEE (acs_map['v']) /* tee pointing up */ +#define ACS_TTEE (acs_map['w']) /* tee pointing down */ +#define ACS_HLINE (acs_map['q']) /* horizontal line */ +#define ACS_VLINE (acs_map['x']) /* vertical line */ +#define ACS_PLUS (acs_map['n']) /* large plus or crossover */ +#define ACS_S1 (acs_map['o']) /* scan line 1 */ +#define ACS_S9 (acs_map['s']) /* scan line 9 */ +#define ACS_DIAMOND (acs_map['`']) /* diamond */ +#define ACS_CKBOARD (acs_map['a']) /* checker board (stipple) */ +#define ACS_DEGREE (acs_map['f']) /* degree symbol */ +#define ACS_PLMINUS (acs_map['g']) /* plus/minus */ +#define ACS_BULLET (acs_map['~']) /* bullet */ +/* Teletype 5410v1 symbols begin here */ +#define ACS_LARROW (acs_map[',']) /* arrow pointing left */ +#define ACS_RARROW (acs_map['+']) /* arrow pointing right */ +#define ACS_DARROW (acs_map['.']) /* arrow pointing down */ +#define ACS_UARROW (acs_map['-']) /* arrow pointing up */ +#define ACS_BOARD (acs_map['h']) /* board of squares */ +#define ACS_LANTERN (acs_map['i']) /* lantern symbol */ +#define ACS_BLOCK (acs_map['0']) /* solid square block */ +/* + * These aren't documented, but a lot of System Vs have them anyway + * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). + * The ACS_names may not match AT&T's, our source didn't know them. + */ +#define ACS_S3 (acs_map['p']) /* scan line 3 */ +#define ACS_S7 (acs_map['r']) /* scan line 7 */ +#define ACS_LEQUAL (acs_map['y']) /* less/equal */ +#define ACS_GEQUAL (acs_map['z']) /* greater/equal */ +#define ACS_PI (acs_map['{']) /* Pi */ +#define ACS_NEQUAL (acs_map['|']) /* not equal */ +#define ACS_STERLING (acs_map['}']) /* UK pound sign */ + +/* + * Line drawing ACS names are of the form ACS_trbl, where t is the top, r + * is the right, b is the bottom, and l is the left. t, r, b, and l might + * be B (blank), S (single), D (double), or T (thick). The subset defined + * here only uses B and S. + */ +#define ACS_BSSB ACS_ULCORNER +#define ACS_SSBB ACS_LLCORNER +#define ACS_BBSS ACS_URCORNER +#define ACS_SBBS ACS_LRCORNER +#define ACS_SBSS ACS_RTEE +#define ACS_SSSB ACS_LTEE +#define ACS_SSBS ACS_BTEE +#define ACS_BSSS ACS_TTEE +#define ACS_BSBS ACS_HLINE +#define ACS_SBSB ACS_VLINE +#define ACS_SSSS ACS_PLUS + +#if !defined(ERR) || ((ERR) != -1) +#define ERR (-1) +#endif + +#if !defined(OK) || ((OK) != 0) +#define OK (0) +#endif + +/* values for the _flags member */ +#define _SUBWIN 0x01 /* is this a sub-window? */ +#define _ENDLINE 0x02 /* is the window flush right? */ +#define _FULLWIN 0x04 /* is the window full-screen? */ +#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */ +#define _ISPAD 0x10 /* is this window a pad? */ +#define _HASMOVED 0x20 /* has cursor moved since last refresh? */ +#define _WRAPPED 0x40 /* cursor was just wrappped */ + +/* + * this value is used in the firstchar and lastchar fields to mark + * unchanged lines + */ +#define _NOCHANGE -1 + +/* + * this value is used in the oldindex field to mark lines created by insertions + * and scrolls. + */ +#define _NEWINDEX -1 + +typedef struct screen SCREEN; +typedef struct _win_st WINDOW; + +typedef chtype attr_t; /* ...must be at least as wide as chtype */ + +#ifdef _XOPEN_SOURCE_EXTENDED +#ifndef _WCHAR_T +typedef unsigned long wchar_t; +#endif /* _WCHAR_T */ +#ifndef _WINT_T +typedef long int wint_t; +#endif /* _WINT_T */ + +#define CCHARW_MAX 5 +typedef struct +{ + attr_t attr; + wchar_t chars[CCHARW_MAX]; +} +cchar_t; +#endif /* _XOPEN_SOURCE_EXTENDED */ + +struct ldat +{ + chtype *text; /* text of the line */ + short firstchar; /* first changed character in the line */ + short lastchar; /* last changed character in the line */ + short oldindex; /* index of the line at last update */ +}; + +struct _win_st +{ + short _cury, _curx; /* current cursor position */ + + /* window location and size */ + short _maxy, _maxx; /* maximums of x and y, NOT window size */ + short _begy, _begx; /* screen coords of upper-left-hand corner */ + + short _flags; /* window state flags */ + + /* attribute tracking */ + attr_t _attrs; /* current attribute for non-space character */ + chtype _bkgd; /* current background char/attribute pair */ + + /* option values set by user */ + bool _notimeout; /* no time out on function-key entry? */ + bool _clear; /* consider all data in the window invalid? */ + bool _leaveok; /* OK to not reset cursor on exit? */ + bool _scroll; /* OK to scroll this window? */ + bool _idlok; /* OK to use insert/delete line? */ + bool _idcok; /* OK to use insert/delete char? */ + bool _immed; /* window in immed mode? (not yet used) */ + bool _sync; /* window in sync mode? */ + bool _use_keypad; /* process function keys into KEY_ symbols? */ + int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ + + struct ldat *_line; /* the actual line data */ + + /* global screen state */ + short _regtop; /* top line of scrolling region */ + short _regbottom; /* bottom line of scrolling region */ + + /* these are used only if this is a sub-window */ + int _parx; /* x coordinate of this window in parent */ + int _pary; /* y coordinate of this window in parent */ + WINDOW *_parent; /* pointer to parent if a sub-window */ + + /* these are used only if this is a pad */ + struct pdat + { + short _pad_y, _pad_x; + short _pad_top, _pad_left; + short _pad_bottom, _pad_right; + } _pad; + + short _yoffset; /* real begy is _begy + _yoffset */ +}; + +extern WINDOW *stdscr; +extern WINDOW *curscr; +extern WINDOW *newscr; + +extern int LINES; +extern int COLS; +extern int TABSIZE; + +/* + * This global was an undocumented feature under AIX curses. + */ +extern int ESCDELAY; /* ESC expire time in milliseconds */ + +extern char *keybound (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 char ttytype[]; /* needed for backward compatibility */ + +/* + * GCC (and some other compilers) define '__attribute__'; we're using this + * macro to alert the compiler to flag inconsistencies in printf/scanf-like + * function calls. Just in case '__attribute__' isn't defined, make a dummy. + * G++ doesn't accept it anyway. + */ +#if !defined(__GNUC__) && !defined(__attribute__) +#define __attribute__(p) /* nothing */ +#endif + +/* + * For g++, turn off our macros that use __attribute__ (g++ recognizes some + * of them, but not at the same version levels as gcc). + */ +#ifdef __cplusplus +#undef GCC_NORETURN +#undef GCC_PRINTF +#undef GCC_SCANF +#undef GCC_UNUSED +#endif + +/* + * We cannot define these in ncurses_cfg.h, since they require parameters to be + * passed (that's non-portable). + */ +#if GCC_PRINTF +#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) +#else +#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ +#endif + +#if GCC_SCANF +#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) +#else +#define GCC_SCANFLIKE(fmt,var) /*nothing*/ +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + +/* + * Function prototypes. This is the complete XSI Curses list of required + * functions. Those marked `generated' will have sources generated from the + * macro definitions later in this file, in order to satisfy XPG4.2 + * 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 */ +#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 */ +#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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern void bkgrndset(const cchar_t *); /* missing */ +extern int bkgrnd(const cchar_t *); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern 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 */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int box(WINDOW *, chtype, chtype); /* generated */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int echo_wchar(const cchar_t *); /* missing */ +extern 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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int getbkgrnd(cchar_t *); /* missing */ +extern 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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int getn_wstr(wint_t *, int); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int getstr(char *); /* generated */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int get_wch(wint_t *); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern WINDOW *getwin(FILE *); /* implemented */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#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 */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern 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 */ +#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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern char *key_name(wchar_t); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int keypad(WINDOW *,bool); /* implemented */ +extern char killchar(void); /* implemented */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#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 */ +#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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int mvgetn_wstr(int, int, wint_t *, int); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int mvgetstr(int, int, char *); /* generated */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int mvhline(int, int, chtype, int); /* generated */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#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 */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int mvprintw(int,int, NCURSES_CONST char *,...) /* implemented */ + GCC_PRINTFLIKE(3,4); +extern int mvscanw(int,int, NCURSES_CONST char *,...) /* implemented */ + GCC_SCANFLIKE(3,4); +extern int mvvline(int, int, chtype, int); /* generated */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#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 */ +#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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int);/* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int mvwgetstr(WINDOW *, int, int, char *); /* generated */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int mvwhline(WINDOW *, int, int, chtype, int); /* generated */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#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 */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int mvwprintw(WINDOW*,int,int, NCURSES_CONST char *,...) /* implemented */ + GCC_PRINTFLIKE(4,5); +extern int mvwscanw(WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */ + GCC_SCANFLIKE(4,5); +extern int mvwvline(WINDOW *,int, int, chtype, int); /* generated */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ + 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 */ + 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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 char *tparm(NCURSES_CONST char *, ...); /* implemented */ +extern int typeahead(int); /* implemented */ +extern int ungetch(int); /* implemented */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int vid_puts(attr_t, short, void *, int (*)(int)); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int vline(chtype, int); /* generated */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#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 */ +#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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern void wbkgrndset(WINDOW *,const cchar_t *); /* missing */ +extern int wbkgrnd(WINDOW *,const cchar_t *); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern 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 */ +#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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int wecho_wchar(WINDOW *, const cchar_t *); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int werase(WINDOW *); /* implemented */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int wgetbkgrnd(WINDOW *, cchar_t *); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int wgetch(WINDOW *); /* implemented */ +extern int wgetnstr(WINDOW *,char *,int); /* implemented */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int wgetn_wstr(WINDOW *,wint_t *, int); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern 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 */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int whline(WINDOW *, chtype, int); /* implemented */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern 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 */ +#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 */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int wmove(WINDOW *,int,int); /* implemented */ +extern int wnoutrefresh(WINDOW *); /* implemented */ +extern 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 */ + 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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern wchar_t *wunctrl(cchar_t *); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int wvline(WINDOW *,chtype,int); /* implemented */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int wvline_set(WINDOW *, const cchar_t *, int); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ + +extern bool mouse_trafo(int*, int*, bool); /* generated */ + +/* attributes */ + +#define NCURSES_BITS(mask,shift) ((mask) << ((shift) + @cf_cv_widec_shift@)) + +#define A_NORMAL 0L +#define A_ATTRIBUTES NCURSES_BITS(~(@cf_cv_1UL@ - @cf_cv_1UL@),0) +#define A_CHARTEXT (NCURSES_BITS(@cf_cv_1UL@,0) - @cf_cv_1UL@) +#define A_COLOR NCURSES_BITS(((@cf_cv_1UL@) << 8) - @cf_cv_1UL@,0) +#define A_STANDOUT NCURSES_BITS(@cf_cv_1UL@,8) +#define A_UNDERLINE NCURSES_BITS(@cf_cv_1UL@,9) +#define A_REVERSE NCURSES_BITS(@cf_cv_1UL@,10) +#define A_BLINK NCURSES_BITS(@cf_cv_1UL@,11) +#define A_DIM NCURSES_BITS(@cf_cv_1UL@,12) +#define A_BOLD NCURSES_BITS(@cf_cv_1UL@,13) +#define A_ALTCHARSET NCURSES_BITS(@cf_cv_1UL@,14) +#define A_INVIS NCURSES_BITS(@cf_cv_1UL@,15) + +/* Tradeoff on 32-bit machines ('protect' vs widec). The others (e.g., left + * highlight are not implemented in any terminal descriptions, anyway. + */ +#if ((16 + @cf_cv_widec_shift@) < @cf_cv_shift_limit@) +#define A_PROTECT NCURSES_BITS(@cf_cv_1UL@,16) +#define A_HORIZONTAL NCURSES_BITS(@cf_cv_1UL@,17) +#define A_LEFT NCURSES_BITS(@cf_cv_1UL@,18) +#define A_LOW NCURSES_BITS(@cf_cv_1UL@,19) +#define A_RIGHT NCURSES_BITS(@cf_cv_1UL@,20) +#define A_TOP NCURSES_BITS(@cf_cv_1UL@,21) +#define A_VERTICAL NCURSES_BITS(@cf_cv_1UL@,22) +#else +#define A_PROTECT 0L +#define A_HORIZONTAL 0L +#define A_LEFT 0L +#define A_LOW 0L +#define A_RIGHT 0L +#define A_TOP 0L +#define A_VERTICAL 0L +#endif + +#define COLOR_PAIR(n) NCURSES_BITS(n, 0) +#define PAIR_NUMBER(a) (((a) & A_COLOR) >> @cf_cv_widec_shift@) + +/* + * pseudo functions + */ +#define wgetstr(w, s) wgetnstr(w, s, -1) +#define getnstr(s, n) wgetnstr(stdscr, s, n) + +#define setterm(term) setupterm(term, 1, (int *)0) + +#define fixterm() reset_prog_mode() +#define resetterm() reset_shell_mode() +#define saveterm() def_prog_mode() +#define crmode() cbreak() +#define nocrmode() nocbreak() +#define gettmode() + +#define getyx(win,y,x) (y = (win)?(win)->_cury:ERR, x = (win)?(win)->_curx:ERR) +#define getbegyx(win,y,x) (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR) +#define getmaxyx(win,y,x) (y = (win)?((win)->_maxy + 1):ERR, x = (win)?((win)->_maxx + 1):ERR) +#define getparyx(win,y,x) (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR) +#define getsyx(y,x) do { if(newscr->_leaveok) (y)=(x)=-1; \ + else getyx(newscr,(y),(x)); \ + } while(0) +#define setsyx(y,x) do { if((y)==-1 && (x)==-1) newscr->_leaveok=TRUE; \ + else {newscr->_leaveok=FALSE;wmove(newscr,(y),(x));} \ + } while(0) + +/* It seems older SYSV curses versions define these */ +#define getattrs(win) ((win)?(win)->_attrs:A_NORMAL) +#define getcurx(win) ((win)?(win)->_curx:ERR) +#define getcury(win) ((win)?(win)->_cury:ERR) +#define getbegx(win) ((win)?(win)->_begx:ERR) +#define getbegy(win) ((win)?(win)->_begy:ERR) +#define getmaxx(win) ((win)?((win)->_maxx + 1):ERR) +#define getmaxy(win) ((win)?((win)->_maxy + 1):ERR) +#define getparx(win) ((win)?(win)->_parx:ERR) +#define getpary(win) ((win)?(win)->_pary:ERR) + +#define wstandout(win) (wattrset(win,A_STANDOUT)) +#define wstandend(win) (wattrset(win,A_NORMAL)) +#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK) + +#define wattron(win,at) wattr_on(win, at, (void *)0) +#define wattroff(win,at) wattr_off(win, at, (void *)0) +#define wattrset(win,at) ((win)->_attrs = (at)) + +#define scroll(win) wscrl(win,1) + +#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) +#define touchline(win, s, c) wtouchln((win), s, c, 1) +#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) + +#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) +#define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) +#define hline(ch, n) whline(stdscr, ch, n) +#define vline(ch, n) wvline(stdscr, ch, n) + +#define winstr(w, s) winnstr(w, s, -1) +#define winchstr(w, s) winchnstr(w, s, -1) +#define winsstr(w, s) winsnstr(w, s, -1) + +#define redrawwin(w) wredrawln(w, 0, w->_maxy+1) +#define waddstr(win,str) waddnstr(win,str,-1) +#define waddchstr(win,str) waddchnstr(win,str,-1) + +/* + * pseudo functions for standard screen + */ + +#define addch(ch) waddch(stdscr,ch) +#define addchnstr(str,n) waddchnstr(stdscr,str,n) +#define addchstr(str) waddchstr(stdscr,str) +#define addnstr(str,n) waddnstr(stdscr,str,n) +#define addstr(str) waddnstr(stdscr,str,-1) +#define attroff(at) wattroff(stdscr,at) +#define attron(at) wattron(stdscr,at) +#define attrset(at) wattrset(stdscr,at) +#define bkgd(ch) wbkgd(stdscr,ch) +#define bkgdset(ch) wbkgdset(stdscr,ch) +#define clear() wclear(stdscr) +#define clrtobot() wclrtobot(stdscr) +#define clrtoeol() wclrtoeol(stdscr) +#define color_set(c,o) wcolor_set(stdscr,c,o) +#define delch() wdelch(stdscr) +#define deleteln() winsdelln(stdscr,-1) +#define echochar(c) wechochar(stdscr,c) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getstr(str) wgetstr(stdscr,str) +#define inch() winch(stdscr) +#define inchnstr(s,n) winchnstr(stdscr,s,n) +#define inchstr(s) winchstr(stdscr,s) +#define innstr(s,n) winnstr(stdscr,s,n) +#define insch(c) winsch(stdscr,c) +#define insdelln(n) winsdelln(stdscr,n) +#define insertln() winsdelln(stdscr,1) +#define insnstr(s,n) winsnstr(stdscr,s,n) +#define insstr(s) winsstr(stdscr,s) +#define instr(s) winstr(stdscr,s) +#define move(y,x) wmove(stdscr,y,x) +#define refresh() wrefresh(stdscr) +#define scrl(n) wscrl(stdscr,n) +#define setscrreg(t,b) wsetscrreg(stdscr,t,b) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define timeout(delay) wtimeout(stdscr,delay) +#define wdeleteln(win) winsdelln(win,-1) +#define winsertln(win) winsdelln(win,1) + +/* + * mv functions + */ + +#define mvwaddch(win,y,x,ch) (wmove(win,y,x) == ERR ? ERR : waddch(win,ch)) +#define mvwaddchnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n)) +#define mvwaddchstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1)) +#define mvwaddnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n)) +#define mvwaddstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1)) +#define mvwdelch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wdelch(win)) +#define mvwgetch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wgetch(win)) +#define mvwgetnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n)) +#define mvwgetstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : wgetstr(win,str)) +#define mvwhline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline(win,c,n)) +#define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? (chtype)ERR : winch(win)) +#define mvwinchnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n)) +#define mvwinchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winchstr(win,s)) +#define mvwinnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n)) +#define mvwinsch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winsch(win,c)) +#define mvwinsnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n)) +#define mvwinsstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winsstr(win,s)) +#define mvwinstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winstr(win,s)) +#define mvwvline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline(win,c,n)) + +#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch) +#define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,y,x,str,n) +#define mvaddchstr(y,x,str) mvwaddchstr(stdscr,y,x,str) +#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,y,x,str,n) +#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str) +#define mvdelch(y,x) mvwdelch(stdscr,y,x) +#define mvgetch(y,x) mvwgetch(stdscr,y,x) +#define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,y,x,str,n) +#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str) +#define mvhline(y,x,c,n) mvwhline(stdscr,y,x,c,n) +#define mvinch(y,x) mvwinch(stdscr,y,x) +#define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,y,x,s,n) +#define mvinchstr(y,x,s) mvwinchstr(stdscr,y,x,s) +#define mvinnstr(y,x,s,n) mvwinnstr(stdscr,y,x,s,n) +#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c) +#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,y,x,s,n) +#define mvinsstr(y,x,s) mvwinsstr(stdscr,y,x,s) +#define mvinstr(y,x,s) mvwinstr(stdscr,y,x,s) +#define mvvline(y,x,c,n) mvwvline(stdscr,y,x,c,n) + +/* + * XSI curses macros for XPG4 conformance. + * The underlying functions needed to make these work are: + * waddnwstr(), waddchnwstr(), wadd_wch(), wborder_set(), wchgat(), + * wecho_wchar(), wgetn_wstr(), wget_wch(), whline_set(), vhline_set(), + * winnwstr(), wins_nwstr(), wins_wch(), win_wch(), win_wchnstr(). + * Except for wchgat(), these are not yet implemented. They will be someday. + */ +#define add_wch(c) wadd_wch(stdscr,c) +#define addnwstr(wstr,n) waddnwstr(stdscr,wstr,n) +#define addwstr(wstr,n) waddnwstr(stdscr,wstr,-1) +#define attr_get(a,pair,opts) wattr_get(stdscr,a,pair,opts) +#define attr_off(a,opts) wattr_off(stdscr,a,opts) +#define attr_on(a,opts) wattr_on(stdscr,a,opts) +#define attr_set(a,pair,opts) wattr_set(stdscr,a,pair,opts) +#define box_set(w,v,h) wborder_set(w,v,v,h,h,0,0,0,0) +#define chgat(n,a,c,o) wchgat(stdscr,n,a,c,o) +#define echo_wchar(c) wecho_wchar(stdscr,c) +#define getbkgd(win) ((win)->_bkgd) +#define get_wch(c) wget_wch(stdscr,c) +#define get_wstr(t) wgetn_wstr(stdscr,t,-1) +#define getn_wstr(t,n) wgetn_wstr(stdscr,t,n) +#define hline_set(c,n) whline_set(stdscr,c,n) +#define in_wch(c) win_wch(stdscr,c) +#define in_wchnstr(c,n) win_wchnstr(stdscr,c,n) +#define in_wchstr(c) win_wchnstr(stdscr,c,-1) +#define innwstr(c,n) winnwstr(stdscr,c,n) +#define ins_nwstr(t,n) wins_nwstr(stdscr,t,n) +#define ins_wch(c) wins_wch(stdscr,c) +#define ins_wstr(t) wins_nwstr(stdscr,t,-1) +#define inwstr(c) winnwstr(stdscr,c,-1) + +#define mvadd_wch(y,x,c) mvwadd_wch(stdscr,y,x,c) +#define mvaddnwstr(y,x,wstr,n) mvwaddnwstr(stdscr,y,x,wstr,n) +#define mvaddwstr(y,x,wstr,n) mvwaddnwstr(stdscr,y,x,wstr,-1) +#define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,y,x,n,a,c,o) +#define mvget_wch(y,x,c) mvwget_wch(stdscr,y,x,c) +#define mvget_wstr(y,x,t) mvwgetn_wstr(stdscr,y,x,t,-1) +#define mvgetn_wstr(y,x,t,n) mvwgetn_wstr(stdscr,y,x,t,n) +#define mvhline_set(y,x,c,n) mvwhline_set(stdscr,y,x,c,n) +#define mvin_wch(y,x,c) mvwin_wch(stdscr,y,x,c) +#define mvin_wchnstr(y,x,c,n) mvwin_wchnstr(stdscr,y,x,c,n) +#define mvin_wchstr(y,x,c) mvwin_wchnstr(stdscr,y,x,c,-1) +#define mvinnwstr(y,x,c,n) mvwinnwstr(stdscr,y,x,c,n) +#define mvins_nwstr(y,x,t,n) mvwins_nwstr(stdscr,y,x,t,n) +#define mvins_wch(y,x,c) mvwins_wch(stdscr,y,x,c) +#define mvins_wstr(y,x,t) mvwins_nwstr(stdscr,y,x,t,-1) +#define mvinwstr(y,x,c) mvwinnwstr(stdscr,y,x,c,-1) +#define mvvline_set(y,x,c,n) mvwvline_set(stdscr,y,x,c,n) + +#define mvwadd_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : wadd_wch(stdscr,c)) +#define mvwaddnwstr(win,y,x,wstr,n) (wmove(win,y,x) == ERR ? ERR : waddnwstr(stdscr,wstr,n)) +#define mvwaddwstr(win,y,x,wstr,n) (wmove(win,y,x) == ERR ? ERR : waddnwstr(stdscr,wstr,-1)) +#define mvwchgat(win,y,x,n,a,c,o) (wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o)) +#define mvwget_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : wget_wch(win,c)) +#define mvwget_wstr(win,y,x,t) (wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,-1)) +#define mvwgetn_wstr(win,y,x,t,n) (wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,n)) +#define mvwhline_set(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline_set(win,c,n)) +#define mvwin_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : win_wch(win,c)) +#define mvwin_wchnstr(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : win_wchnstr(stdscr,c,n)) +#define mvwin_wchstr(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : win_wchnstr(stdscr,c,-1)) +#define mvwinnwstr(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : winnwstr(stdscr,c,n)) +#define mvwins_nwstr(win,y,x,t,n) (wmove(win,y,x) == ERR ? ERR : wins_nwstr(stdscr,t,n)) +#define mvwins_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : wins_wch(stdscr,c)) +#define mvwins_wstr(win,y,x,t) (wmove(win,y,x) == ERR ? ERR : wins_nwstr(stdscr,t,-1)) +#define mvwinwstr(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winnwstr(stdscr,c,-1)) +#define mvwvline_set(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline_set(win,c,n)) + +#define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a)) +#define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a)) + +#define vid_attr(a,pair,opts) vidattr(a) +#define vline_set(c,n) wvline_set(stdscr,c,n) +#define waddwstr(win,wstr,n) waddnwstr(win,wstr,-1) +#define wattr_get(win,a,p,opts) ((void)((a) != 0 && (*(a) = (win)->_attrs)), \ + (void)((p) != 0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \ + OK) +#define wget_wstr(w,t) wgetn_wstr(w,t,-1) +#define win_wchstr(w,c) win_wchnstr(w,c,-1) +#define wins_wstr(w,t) wins_nwstr(w,t,-1) +#define winwstr(w,c) winnwstr(w,c,-1) + + +/* + * XSI curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use + * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to + * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already + * use stdarg.h, so... + */ +#define vw_printw vwprintw +#define vw_scanw vwscanw + +/* + * Pseudo-character tokens outside ASCII range. The curses wgetch() function + * will return any given one of these only if the corresponding k- capability + * is defined in your terminal's terminfo entry. + */ +#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */ +#define KEY_MIN 0401 /* Minimum curses key */ +#define KEY_BREAK 0401 /* Break key (unreliable) */ +#define KEY_DOWN 0402 /* Down-arrow */ +#define KEY_UP 0403 /* Up-arrow */ +#define KEY_LEFT 0404 /* Left-arrow */ +#define KEY_RIGHT 0405 /* Right-arrow */ +#define KEY_HOME 0406 /* Home key (upward+left arrow) */ +#define KEY_BACKSPACE 0407 /* Backspace (unreliable) */ +#define KEY_F0 0410 /* Function keys. Space for 64 */ +#define KEY_F(n) (KEY_F0+(n)) /* Value of function key n */ +#define KEY_DL 0510 /* Delete line */ +#define KEY_IL 0511 /* Insert line */ +#define KEY_DC 0512 /* Delete character */ +#define KEY_IC 0513 /* Insert char or enter insert mode */ +#define KEY_EIC 0514 /* Exit insert char mode */ +#define KEY_CLEAR 0515 /* Clear screen */ +#define KEY_EOS 0516 /* Clear to end of screen */ +#define KEY_EOL 0517 /* Clear to end of line */ +#define KEY_SF 0520 /* Scroll 1 line forward */ +#define KEY_SR 0521 /* Scroll 1 line backward (reverse) */ +#define KEY_NPAGE 0522 /* Next page */ +#define KEY_PPAGE 0523 /* Previous page */ +#define KEY_STAB 0524 /* Set tab */ +#define KEY_CTAB 0525 /* Clear tab */ +#define KEY_CATAB 0526 /* Clear all tabs */ +#define KEY_ENTER 0527 /* Enter or send (unreliable) */ +#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ +#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ +#define KEY_PRINT 0532 /* Print */ +#define KEY_LL 0533 /* Home down or bottom (lower left) */ + +/* The keypad is arranged like this: */ +/* a1 up a3 */ +/* left b2 right */ +/* c1 down c3 */ + +#define KEY_A1 0534 /* Upper left of keypad */ +#define KEY_A3 0535 /* Upper right of keypad */ +#define KEY_B2 0536 /* Center of keypad */ +#define KEY_C1 0537 /* Lower left of keypad */ +#define KEY_C3 0540 /* Lower right of keypad */ +#define KEY_BTAB 0541 /* Back tab */ +#define KEY_BEG 0542 /* Beg (beginning) */ +#define KEY_CANCEL 0543 /* Cancel */ +#define KEY_CLOSE 0544 /* Close */ +#define KEY_COMMAND 0545 /* Cmd (command) */ +#define KEY_COPY 0546 /* Copy */ +#define KEY_CREATE 0547 /* Create */ +#define KEY_END 0550 /* End */ +#define KEY_EXIT 0551 /* Exit */ +#define KEY_FIND 0552 /* Find */ +#define KEY_HELP 0553 /* Help */ +#define KEY_MARK 0554 /* Mark */ +#define KEY_MESSAGE 0555 /* Message */ +#define KEY_MOVE 0556 /* Move */ +#define KEY_NEXT 0557 /* Next */ +#define KEY_OPEN 0560 /* Open */ +#define KEY_OPTIONS 0561 /* Options */ +#define KEY_PREVIOUS 0562 /* Prev (previous) */ +#define KEY_REDO 0563 /* Redo */ +#define KEY_REFERENCE 0564 /* Ref (reference) */ +#define KEY_REFRESH 0565 /* Refresh */ +#define KEY_REPLACE 0566 /* Replace */ +#define KEY_RESTART 0567 /* Restart */ +#define KEY_RESUME 0570 /* Resume */ +#define KEY_SAVE 0571 /* Save */ +#define KEY_SBEG 0572 /* Shifted Beg (beginning) */ +#define KEY_SCANCEL 0573 /* Shifted Cancel */ +#define KEY_SCOMMAND 0574 /* Shifted Command */ +#define KEY_SCOPY 0575 /* Shifted Copy */ +#define KEY_SCREATE 0576 /* Shifted Create */ +#define KEY_SDC 0577 /* Shifted Delete char */ +#define KEY_SDL 0600 /* Shifted Delete line */ +#define KEY_SELECT 0601 /* Select */ +#define KEY_SEND 0602 /* Shifted End */ +#define KEY_SEOL 0603 /* Shifted Clear line */ +#define KEY_SEXIT 0604 /* Shifted Dxit */ +#define KEY_SFIND 0605 /* Shifted Find */ +#define KEY_SHELP 0606 /* Shifted Help */ +#define KEY_SHOME 0607 /* Shifted Home */ +#define KEY_SIC 0610 /* Shifted Input */ +#define KEY_SLEFT 0611 /* Shifted Left arrow */ +#define KEY_SMESSAGE 0612 /* Shifted Message */ +#define KEY_SMOVE 0613 /* Shifted Move */ +#define KEY_SNEXT 0614 /* Shifted Next */ +#define KEY_SOPTIONS 0615 /* Shifted Options */ +#define KEY_SPREVIOUS 0616 /* Shifted Prev */ +#define KEY_SPRINT 0617 /* Shifted Print */ +#define KEY_SREDO 0620 /* Shifted Redo */ +#define KEY_SREPLACE 0621 /* Shifted Replace */ +#define KEY_SRIGHT 0622 /* Shifted Right arrow */ +#define KEY_SRSUME 0623 /* Shifted Resume */ +#define KEY_SSAVE 0624 /* Shifted Save */ +#define KEY_SSUSPEND 0625 /* Shifted Suspend */ +#define KEY_SUNDO 0626 /* Shifted Undo */ +#define KEY_SUSPEND 0627 /* Suspend */ +#define KEY_UNDO 0630 /* Undo */ +#define KEY_MOUSE 0631 /* Mouse event has occurred */ +#define KEY_RESIZE 0632 /* Terminal resize event */ +#define KEY_MAX 0777 /* Maximum key value */ + +/* mouse interface */ +#define NCURSES_MOUSE_VERSION 1 + +/* event masks */ +#define BUTTON1_RELEASED 000000000001L +#define BUTTON1_PRESSED 000000000002L +#define BUTTON1_CLICKED 000000000004L +#define BUTTON1_DOUBLE_CLICKED 000000000010L +#define BUTTON1_TRIPLE_CLICKED 000000000020L +#define BUTTON1_RESERVED_EVENT 000000000040L +#define BUTTON2_RELEASED 000000000100L +#define BUTTON2_PRESSED 000000000200L +#define BUTTON2_CLICKED 000000000400L +#define BUTTON2_DOUBLE_CLICKED 000000001000L +#define BUTTON2_TRIPLE_CLICKED 000000002000L +#define BUTTON2_RESERVED_EVENT 000000004000L +#define BUTTON3_RELEASED 000000010000L +#define BUTTON3_PRESSED 000000020000L +#define BUTTON3_CLICKED 000000040000L +#define BUTTON3_DOUBLE_CLICKED 000000100000L +#define BUTTON3_TRIPLE_CLICKED 000000200000L +#define BUTTON3_RESERVED_EVENT 000000400000L +#define BUTTON4_RELEASED 000001000000L +#define BUTTON4_PRESSED 000002000000L +#define BUTTON4_CLICKED 000004000000L +#define BUTTON4_DOUBLE_CLICKED 000010000000L +#define BUTTON4_TRIPLE_CLICKED 000020000000L +#define BUTTON4_RESERVED_EVENT 000040000000L +#define BUTTON_CTRL 000100000000L +#define BUTTON_SHIFT 000200000000L +#define BUTTON_ALT 000400000000L +#define ALL_MOUSE_EVENTS 000777777777L +#define REPORT_MOUSE_POSITION 001000000000L + +/* macros to extract single event-bits from masks */ +#define BUTTON_RELEASE(e, x) ((e) & (001 << (6 * ((x) - 1)))) +#define BUTTON_PRESS(e, x) ((e) & (002 << (6 * ((x) - 1)))) +#define BUTTON_CLICK(e, x) ((e) & (004 << (6 * ((x) - 1)))) +#define BUTTON_DOUBLE_CLICK(e, x) ((e) & (010 << (6 * ((x) - 1)))) +#define BUTTON_TRIPLE_CLICK(e, x) ((e) & (020 << (6 * ((x) - 1)))) +#define BUTTON_RESERVED_EVENT(e, x) ((e) & (040 << (6 * ((x) - 1)))) + +typedef unsigned long mmask_t; + +typedef struct +{ + short id; /* ID to distinguish multiple devices */ + int x, y, z; /* event coordinates (character-cell) */ + mmask_t bstate; /* button state bits */ +} +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); + +#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? */ + +/* 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); + +/* trace masks */ +#define TRACE_DISABLE 0x0000 /* turn off tracing */ +#define TRACE_TIMES 0x0001 /* trace user and system times of updates */ +#define TRACE_TPUTS 0x0002 /* trace tputs calls */ +#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ +#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ +#define TRACE_CHARPUT 0x0010 /* trace all character outputs */ +#define TRACE_ORDINARY 0x001F /* trace all update actions */ +#define TRACE_CALLS 0x0020 /* trace all curses calls */ +#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ +#define TRACE_IEVENT 0x0080 /* trace low-level input processing */ +#define TRACE_BITS 0x0100 /* trace state of TTY control bits */ +#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ +#define TRACE_CCALLS 0x0400 /* trace per-character calls */ +#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 *); +#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ +#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ +#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ +#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __NCURSES_H */ diff --git a/contrib/ncurses/include/edit_cfg.sh b/contrib/ncurses/include/edit_cfg.sh new file mode 100755 index 000000000000..baa31f687d1e --- /dev/null +++ b/contrib/ncurses/include/edit_cfg.sh @@ -0,0 +1,66 @@ +#!/bin/sh +# $Id: edit_cfg.sh,v 1.9 1998/02/11 12:13:46 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 +# +# Edit the default value of the term.h file based on the autoconf-generated +# values: +# +# $1 = ncurses_cfg.h +# $2 = term.h +# +BAK=save$$ +TMP=edit$$ +trap "rm -f $BAK $TMP" 0 1 2 5 15 +for name in \ + HAVE_TCGETATTR \ + HAVE_TERMIOS_H \ + HAVE_TERMIO_H \ + NCURSES_CONST \ + BROKEN_LINKER +do + mv $2 $BAK + if ( grep "[ ]$name[ ]" $1 2>&1 >$TMP ) + then + sed -e 's@#define '$name'.*$@'"`cat $TMP`@" $BAK >$2 + elif test "$name" = "NCURSES_CONST" ; then + sed -e 's/define '$name'.*$/define '$name' \/\*nothing\*\//' $BAK >$2 + else + sed -e 's/define '$name'.*$/define '$name' 0/' $BAK >$2 + fi + if (cmp -s $2 $BAK) + then + echo '** same: '$name + mv $BAK $2 + else + echo '** edit: '$name + rm -f $BAK + fi +done diff --git a/contrib/ncurses/include/headers b/contrib/ncurses/include/headers new file mode 100644 index 000000000000..2a185c21627d --- /dev/null +++ b/contrib/ncurses/include/headers @@ -0,0 +1,34 @@ +############################################################################## +# Copyright (c) 1998 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1996 +# +term.h +curses.h +unctrl.h +termcap.h diff --git a/contrib/ncurses/include/nc_alloc.h b/contrib/ncurses/include/nc_alloc.h new file mode 100644 index 000000000000..1e23a97720e0 --- /dev/null +++ b/contrib/ncurses/include/nc_alloc.h @@ -0,0 +1,72 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 * + ****************************************************************************/ +/* $Id: nc_alloc.h,v 1.7 1999/04/03 23:15:13 tom Exp $ */ + +#ifndef NC_ALLOC_included +#define NC_ALLOC_included 1 + +#if HAVE_LIBDMALLOC +#include <dmalloc.h> /* Gray Watson's library */ +#else +#undef HAVE_LIBDMALLOC +#define HAVE_LIBDMALLOC 0 +#endif + +#if HAVE_LIBDBMALLOC +#include <dbmalloc.h> /* Conor Cahill's library */ +#else +#undef HAVE_LIBDBMALLOC +#define HAVE_LIBDBMALLOC 0 +#endif + +#ifndef NO_LEAKS +#define NO_LEAKS 0 +#endif + +#if HAVE_LIBDBMALLOC || HAVE_LIBDMALLOC || NO_LEAKS +#define HAVE_NC_FREEALL 1 +struct termtype; +extern void _nc_free_and_exit(int) GCC_NORETURN; +extern void _nc_free_tparm(void); +extern void _nc_leaks_dump_entry(void); +#define ExitProgram(code) _nc_free_and_exit(code) +#endif + +#ifndef HAVE_NC_FREEALL +#define HAVE_NC_FREEALL 0 +#endif + +#ifndef ExitProgram +#define ExitProgram(code) return code +#endif + +#endif /* NC_ALLOC_included */ diff --git a/contrib/ncurses/include/nc_panel.h b/contrib/ncurses/include/nc_panel.h new file mode 100644 index 000000000000..dbb20fa184d1 --- /dev/null +++ b/contrib/ncurses/include/nc_panel.h @@ -0,0 +1,66 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + + +/* + * $Id: nc_panel.h,v 1.2 1998/02/11 12:13:45 tom Exp $ + * + * nc_panel.h + * + * Headerfile to provide an interface for the panel layer into + * the SCREEN structure of the ncurses core. + */ + +#ifndef NC_PANEL_H +#define NC_PANEL_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +struct panel; /* Forward Declaration */ + +struct panelhook { + struct panel* top_panel; + struct panel* bottom_panel; + struct panel* stdscr_pseudo_panel; +}; + +/* Retrieve the panelhook of the current screen */ +extern struct panelhook* _nc_panelhook(void); + +#ifdef __cplusplus +} +#endif + +#endif /* NC_PANEL_H */ diff --git a/contrib/ncurses/include/ncurses_cfg.hin b/contrib/ncurses/include/ncurses_cfg.hin new file mode 100644 index 000000000000..f80fb83f0cd1 --- /dev/null +++ b/contrib/ncurses/include/ncurses_cfg.hin @@ -0,0 +1,56 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Thomas E. Dickey <dickey@clark.net> 1997 * + ****************************************************************************/ +/* + * $Id: ncurses_cfg.hin,v 1.2 1998/02/11 12:13:46 tom Exp $ + * + * This is a template-file used to generate the "ncurses_cfg.h" file. + * + * Rather than list every definition, the configuration script substitutes + * the definitions that it finds using 'sed'. You need a patch (971222) + * to autoconf 2.12 to do this. + */ +#ifndef NC_CONFIG_H +#define NC_CONFIG_H +@DEFS@ + + /* The C compiler may not treat these properly but C++ has to */ +#ifdef __cplusplus +#undef const +#undef inline +#else +#if defined(lint) || defined(TRACE) +#undef inline +#define inline /* nothing */ +#endif +#endif + +#endif /* NC_CONFIG_H */ diff --git a/contrib/ncurses/include/term_entry.h b/contrib/ncurses/include/term_entry.h new file mode 100644 index 000000000000..a19b6010af76 --- /dev/null +++ b/contrib/ncurses/include/term_entry.h @@ -0,0 +1,155 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + + +/* + * term_entry.h -- interface to entry-manipulation code + */ + +#ifndef _TERM_ENTRY_H +#define _TERM_ENTRY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <term.h> + +#define MAX_USES 32 + +typedef struct entry { + TERMTYPE tterm; + int nuses; + struct + { + void *parent; /* (char *) or (ENTRY *) */ + long line; + } + uses[MAX_USES]; + long cstart, cend; + long startline; + struct entry *next; + struct entry *last; +} +ENTRY; + +#if NCURSES_XNAMES +#define NUM_BOOLEANS(tp) (tp)->num_Booleans +#define NUM_NUMBERS(tp) (tp)->num_Numbers +#define NUM_STRINGS(tp) (tp)->num_Strings +#define EXT_NAMES(tp,i,limit,index,table) (i >= limit) ? tp->ext_Names[index] : table[i] +#else +#define NUM_BOOLEANS(tp) BOOLCOUNT +#define NUM_NUMBERS(tp) NUMCOUNT +#define NUM_STRINGS(tp) STRCOUNT +#define EXT_NAMES(tp,i,limit,index,table) table[i] +#endif + +#define NUM_EXT_NAMES(tp) ((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings) + +#define for_each_boolean(n,tp) for(n = 0; n < NUM_BOOLEANS(tp); n++) +#define for_each_number(n,tp) for(n = 0; n < NUM_NUMBERS(tp); n++) +#define for_each_string(n,tp) for(n = 0; n < NUM_STRINGS(tp); n++) + +#define ExtBoolname(tp,i,names) EXT_NAMES(tp, i, BOOLCOUNT, (i - (tp->num_Booleans - tp->ext_Booleans)), names) +#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; +#define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next) + +#define MAX_LINE 132 + +#define NULLHOOK (bool(*)(ENTRY *))0 + +/* + * Note that WANTED and PRESENT are not simple inverses! If a capability + * has been explicitly cancelled, it's not considered WANTED. + */ +#define WANTED(s) ((s) == ABSENT_STRING) +#define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING)) + +#define ANDMISSING(p,q) \ + {if (PRESENT(p) && !PRESENT(q)) _nc_warning(#p " but no " #q);} + +#define PAIRED(p,q) \ + { \ + if (PRESENT(q) && !PRESENT(p)) \ + _nc_warning(#q " but no " #p); \ + if (PRESENT(p) && !PRESENT(q)) \ + _nc_warning(#p " but no " #q); \ + } + +/* 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); + +/* alloc_ttype.c: elementary allocation code */ +extern void _nc_align_termtype(TERMTYPE *, TERMTYPE *); +extern void _nc_copy_termtype(TERMTYPE *, TERMTYPE *); + +/* free_ttype.c: elementary allocation code */ +extern void _nc_free_termtype(TERMTYPE *); + +/* lib_acs.c */ +extern void _nc_init_acs(void); /* corresponds to traditional 'init_acs()' */ + +/* parse_entry.c: entry-parsing code */ +#if NCURSES_XNAMES +extern bool _nc_user_definable; +#endif +extern int _nc_parse_entry(ENTRY *, int, bool); +extern 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); + +/* 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(void); +extern void _nc_free_entries(ENTRY *); +extern void (*_nc_check_termtype)(TERMTYPE *); + +/* trace_xnames.c */ +extern void _nc_trace_xnames(TERMTYPE *); + +#ifdef __cplusplus +} +#endif + +#endif /* _TERM_ENTRY_H */ diff --git a/contrib/ncurses/include/termcap.h.in b/contrib/ncurses/include/termcap.h.in new file mode 100644 index 000000000000..5c6c07a8e8d0 --- /dev/null +++ b/contrib/ncurses/include/termcap.h.in @@ -0,0 +1,71 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* $Id: termcap.h.in,v 1.10 1999/01/09 22:38:04 Uchiyama.Yasushi Exp $ */ + +#ifndef _NCU_TERMCAP_H +#define _NCU_TERMCAP_H 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "@NCURSES_MAJOR@.@NCURSES_MINOR@" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include <sys/types.h> +@OSPEED_INCLUDES@ + +#undef NCURSES_CONST +#define NCURSES_CONST @NCURSES_CONST@ + +extern char PC; +extern char *UP; +extern char *BC; +extern @OSPEED_TYPE@ 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)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _NCU_TERMCAP_H */ diff --git a/contrib/ncurses/include/tic.h b/contrib/ncurses/include/tic.h new file mode 100644 index 000000000000..58bc27faae0b --- /dev/null +++ b/contrib/ncurses/include/tic.h @@ -0,0 +1,274 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* + * tic.h - Global variables and structures for the terminfo + * compiler. + * + */ + +#ifndef __TIC_H +#define __TIC_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <curses.h> /* for the _tracef() prototype, ERR/OK, bool defs */ + +/* +** The format of compiled terminfo files is as follows: +** +** Header (12 bytes), containing information given below +** Names Section, containing the names of the terminal +** Boolean Section, containing the values of all of the +** boolean capabilities +** A null byte may be inserted here to make +** sure that the Number Section begins on an +** even word boundary. +** Number Section, containing the values of all of the numeric +** capabilities, each as a short integer +** String Section, containing short integer offsets into the +** String Table, one per string capability +** String Table, containing the actual characters of the string +** capabilities. +** +** NOTE that all short integers in the file are stored using VAX/PDP-style +** byte-order, i.e., least-significant byte first. +** +** There is no structure definition here because it would only confuse +** matters. Terminfo format is a raw byte layout, not a structure +** dump. If you happen to be on a little-endian machine with 16-bit +** shorts that requires no padding between short members in a struct, +** then there is a natural C structure that captures the header, but +** not very helpfully. +*/ + +#define MAGIC 0432 /* first two bytes of a compiled entry */ + +/* + * The "maximum" here is misleading; XSI guarantees minimum values, which a + * given implementation may exceed. + */ +#define MAX_NAME_SIZE 512 /* maximum legal name field size (XSI:127) */ +#define MAX_ENTRY_SIZE 4096 /* maximum legal entry size */ + +/* The maximum size of individual name or alias is guaranteed in XSI to + * be 14, since that corresponds to the older filename lengths. Newer + * systems allow longer aliases, though not many terminal descriptions + * are written to use them. + */ +#if HAVE_LONG_FILE_NAMES +#define MAX_ALIAS 32 /* POSIX minimum for PATH_MAX */ +#else +#define MAX_ALIAS 14 /* SVr3 filename length */ +#endif + +/* location of user's personal info directory */ +#define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */ + +#ifdef TRACE +#define DEBUG(n, a) if (_nc_tracing & (1 << (n - 1))) _tracef a +#else +#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 *); + +/* + * These are the types of tokens returned by the scanner. The first + * three are also used in the hash table of capability names. The scanner + * returns one of these values after loading the specifics into the global + * structure curr_token. + */ + +#define BOOLEAN 0 /* Boolean capability */ +#define NUMBER 1 /* Numeric capability */ +#define STRING 2 /* String-valued capability */ +#define CANCEL 3 /* Capability to be cancelled in following tc's */ +#define NAMES 4 /* The names for a terminal type */ +#define UNDEF 5 /* Undefined */ + +#define NO_PUSHBACK -1 /* used in pushtype to indicate no pushback */ + + /* + * The global structure in which the specific parts of a + * scanned token are returned. + * + */ + +struct token +{ + char *tk_name; /* name of capability */ + int tk_valnumber; /* value of capability (if a number) */ + char *tk_valstring; /* value of capability (if a string) */ +}; + +extern struct token _nc_curr_token; + + /* + * List of keynames with their corresponding code. + */ +struct kn { + const char *name; + int code; +}; + +extern const struct kn _nc_key_names[]; + + /* + * Offsets to string capabilities, with the corresponding functionkey + * codes. + */ +struct tinfo_fkeys { + unsigned offset; + chtype code; + }; + +extern struct tinfo_fkeys _nc_tinfo_fkeys[]; + + /* + * The file comp_captab.c contains an array of these structures, one + * per possible capability. These are indexed by a hash table array of + * pointers to the same structures for use by the parser. + */ + +struct name_table_entry +{ + const char *nte_name; /* name to hash on */ + int nte_type; /* BOOLEAN, NUMBER or STRING */ + short nte_index; /* index of associated variable in its array */ + short nte_link; /* index in table of next hash, or -1 */ +}; + +struct alias +{ + const char *from; + const char *to; + 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 const struct alias _nc_capalias_table[]; +extern const struct alias _nc_infoalias_table[]; + +extern const struct name_table_entry *_nc_get_table(bool); +extern const struct name_table_entry * const *_nc_get_hash_table(bool); + +#define NOTFOUND ((struct name_table_entry *) 0) + +/* out-of-band values for representing absent capabilities */ +#define ABSENT_BOOLEAN -1 +#define ABSENT_NUMERIC -1 +#define ABSENT_STRING (char *)0 + +/* out-of-band values for representing cancels */ +#define CANCELLED_BOOLEAN (char)(-2) +#define CANCELLED_NUMERIC -2 +#define CANCELLED_STRING (char *)-1 + +#define VALID_BOOLEAN(s) ((s) >= 0) +#define VALID_NUMERIC(s) ((s) >= 0) +#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING) + +/* termcap entries longer than this may break old binaries */ +#define MAX_TERMCAP_LENGTH 1023 + +/* this is a documented limitation of terminfo */ +#define MAX_TERMINFO_LENGTH 4096 + +#ifndef TERMINFO +#define TERMINFO "/usr/share/terminfo" +#endif + +/* 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 *); + +/* 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; +#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; + +/* comp_expand.c: expand string into readable form */ +extern char *_nc_tic_expand(const char *, bool, int); + +/* comp_scan.c: decode string from readable form */ +extern char _nc_trans_string(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); + +/* lib_tputs.c */ +extern int _nc_nulls_sent; /* Add one for every null sent */ + +/* comp_main.c: compiler main */ +extern const char *_nc_progname; + +/* read_entry.c */ +extern const char *_nc_tic_dir(const char *); + +/* write_entry.c */ +extern int _nc_tic_written(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __TIC_H */ diff --git a/contrib/ncurses/include/unctrl.h.in b/contrib/ncurses/include/unctrl.h.in new file mode 100644 index 000000000000..cc10079f11c7 --- /dev/null +++ b/contrib/ncurses/include/unctrl.h.in @@ -0,0 +1,63 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* + * unctrl.h + * + * Display a printable version of a control character. + * Control characters are displayed in caret notation (^x), DELETE is displayed + * as ^?. Printable characters are displayed as is. + */ + +/* $Id: unctrl.h.in,v 1.8 1998/02/11 12:13:45 tom Exp $ */ + +#ifndef _UNCTRL_H +#define _UNCTRL_H 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "@NCURSES_MAJOR@.@NCURSES_MINOR@" + +#ifdef __cplusplus +extern "C" { +#endif + +#include <curses.h> + +#undef unctrl +extern NCURSES_CONST char *unctrl(chtype); + +#ifdef __cplusplus +} +#endif + +#endif /* _UNCTRL_H */ diff --git a/contrib/ncurses/install-sh b/contrib/ncurses/install-sh new file mode 100755 index 000000000000..89fc9b098b8c --- /dev/null +++ b/contrib/ncurses/install-sh @@ -0,0 +1,238 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +tranformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/contrib/ncurses/man/MKterminfo.sh b/contrib/ncurses/man/MKterminfo.sh new file mode 100755 index 000000000000..a6f765a4f00c --- /dev/null +++ b/contrib/ncurses/man/MKterminfo.sh @@ -0,0 +1,99 @@ +#!/bin/sh +#*************************************************************************** +# Copyright (c) 1998 Free 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. * +#*************************************************************************** +# +# $Id: MKterminfo.sh,v 1.5 1998/09/06 00:20:01 tom Exp $ +# +# MKterminfo.sh -- generate terminfo.5 from Caps tabular data +# +# This script takes terminfo.head and terminfo.tail and splices in between +# them a table derived from the Caps data file. Besides avoiding having +# the docs fall out of sync with the table, this also lets us set up tbl +# commands for better formatting of the table. +# +# NOTE: The s in this script really are control characters. It translates +# to \n because I couldn't get used to inserting linefeeds directly. There +# had better be no s in the table source text. +# +head=$1 +caps=$2 +tail=$3 +cat <<'EOF' +'\" t +.\" DO NOT EDIT THIS FILE BY HAND! +.\" It is generated from terminfo.head, Caps, and terminfo.tail. +.\" +.\" Note: this must be run through tbl before nroff. +.\" The magic cookie on the first line triggers this under some man programs. +EOF +cat $head + +temp=temp$$ +sorted=sorted$$ +unsorted=unsorted$$ +trap "rm -f $sorted $temp $unsorted; exit 99" 1 2 5 15 + +sed -n <$caps "\ +/%%-STOP-HERE-%%/q +/^#%/s///p +/^#/d +s/$/T}/ +s/ [Y\-][B\-][C\-][G\-][E\-]\** / T{/ +s/ bool / /p +s/ num / /p +s/ str / /p +" |sed -e 's/^$/../' | tr "\134" "\006" >$unsorted + +rm -f $sorted +rm -f $temp +saved=no +while true +do + read data + test -z "$data" && break + case "$data" in #(vi + **) #(vi + echo "$data" >>$temp + saved=yes + ;; + *) + if test $saved = yes ; then + saved=no + sort $temp >>$sorted + rm -f $temp + fi + echo "$data" >>$sorted + ;; + esac +done <$unsorted +test $saved = yes && sort $temp >>$sorted + +sed -e 's/^\.\.$//' $sorted | tr "\005\006" "\012\134" +cat $tail + +rm -f $sorted $temp $unsorted diff --git a/contrib/ncurses/man/Makefile.in b/contrib/ncurses/man/Makefile.in new file mode 100644 index 000000000000..f0607f566293 --- /dev/null +++ b/contrib/ncurses/man/Makefile.in @@ -0,0 +1,75 @@ +# $Id: Makefile.in,v 1.25 1998/02/11 12:13:49 tom Exp $ +############################################################################## +# Copyright (c) 1998 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 +# +# Makefile for ncurses manual pages. +# +# NOTE: When you add or rename a man page, make sure you update both +# the top-level MANIFEST and any man/*.renames files! + +SHELL = /bin/sh + +INSTALL_PREFIX = @INSTALL_PREFIX@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datadir = @datadir@ +mandir = @mandir@ + +ticdir = $(datadir)/terminfo + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +all \ +sources: terminfo.5 + +$(INSTALL_PREFIX)$(mandir) : + $(srcdir)/../mkinstalldirs $@ + +install install.man : terminfo.5 $(INSTALL_PREFIX)$(mandir) + sh ./edit_man.sh installing $(INSTALL_PREFIX)$(mandir) terminfo.5 $(srcdir)/*.[0-9]* + +uninstall uninstall.man : + -sh ./edit_man.sh removing $(INSTALL_PREFIX)$(mandir) terminfo.5 $(srcdir)/*.[0-9]* + +# We compose terminfo.5 from the real sources... +CAPLIST=$(srcdir)/../include/Caps +terminfo.5: $(srcdir)/terminfo.head $(CAPLIST) $(srcdir)/terminfo.tail Makefile $(srcdir)/MKterminfo.sh + sh $(srcdir)/MKterminfo.sh $(srcdir)/terminfo.head $(CAPLIST) $(srcdir)/terminfo.tail >terminfo.5 + +mostlyclean : + -rm -f core tags TAGS *~ *.ln *.atac trace + +clean: mostlyclean + rm -f terminfo.5 + +distclean realclean: clean + rm -f Makefile edit_man.* diff --git a/contrib/ncurses/man/captoinfo.1m b/contrib/ncurses/man/captoinfo.1m new file mode 100644 index 000000000000..70e278cbf6f3 --- /dev/null +++ b/contrib/ncurses/man/captoinfo.1m @@ -0,0 +1,188 @@ +'\" t +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: captoinfo.1m,v 1.13 1998/12/26 19:57:11 tom Exp $ +.TH captoinfo 1M "" +.ds n 5 +.ds d @DATADIR@/terminfo +.SH NAME +\fBcaptoinfo\fR - convert a \fItermcap\fR description into a \fIterminfo\fR description +.SH SYNOPSIS +\fBcaptoinfo\fR [\fB-v\fR\fIn\fR \fIwidth\fR] [\fB-V\fR] [\fB-1\fR] [\fB-w\fR \fIwidth\fR] \fIfile\fR . . . +.SH DESCRIPTION +\fBcaptoinfo\fR looks in \fIfile\fR for \fBtermcap\fR descriptions. For each +one found, an equivalent \fBterminfo\fR description is written to standard +output. Termcap \fBtc\fR capabilities are translated directly to terminfo +\fBuse\fR capabilities. + +If no \fIfile\fR is given, then the environment variable \fBTERMCAP\fR is used +for the filename or entry. If \fBTERMCAP\fR is a full pathname to a file, only +the terminal whose name is specified in the environment variable \fBTERM\fR is +extracted from that file. If the environment variable \fBTERMCAP\fR is not +set, then the file \fB\*d\fR is read. +.TP 5 +\fB-v\fR +print out tracing information on standard error as the program runs. +.TP 5 +\fB-V\fR +print out the version of the program in use on standard error and exit. +.TP 5 +\fB-1\fR +cause the fields to print out one to a line. Otherwise, the fields +will be printed several to a line to a maximum width of 60 +characters. +.TP 5 +\fB-w\fR +change the output to \fIwidth\fR characters. +.SH FILES +.TP 20 +\*d +Compiled terminal description database. +.SH TRANSLATIONS FROM NONSTANDARD CAPABILITIES +.PP +Some obsolete nonstandard capabilities will automatically be translated +into standard (SVr4/XSI Curses) terminfo capabilities by \fBcaptoinfo\fR. +Whenever one of these automatic translations is done, the program +will issue an notification to stderr, inviting the user to check that +it has not mistakenly translated a completely unknown and random +capability and/or syntax error. +.PP +.TS H +c c c c +c c c c +l l l l. +Nonstd Std From Terminfo +name name capability +_ +BO mr AT&T enter_reverse_mode +CI vi AT&T cursor_invisible +CV ve AT&T cursor_normal +DS mh AT&T enter_dim_mode +EE me AT&T exit_attribute_mode +FE LF AT&T label_on +FL LO AT&T label_off +XS mk AT&T enter_secure_mode +EN @7 XENIX key_end +GE ae XENIX exit_alt_charset_mode +GS as XENIX enter_alt_charset_mode +HM kh XENIX key_home +LD kL XENIX key_dl +PD kN XENIX key_npage +PN po XENIX prtr_off +PS pf XENIX prtr_on +PU kP XENIX key_ppage +RT @8 XENIX kent +UP ku XENIX kcuu1 +KA k; Tek key_f10 +KB F1 Tek key_f11 +KC F2 Tek key_f12 +KD F3 Tek key_f13 +KE F4 Tek key_f14 +KF F5 Tek key_f15 +BC Sb Tek set_background +FC Sf Tek set_foreground +HS mh Iris enter_dim_mode +.TE +.PP +XENIX termcap also used to have a set of extension capabilities +for forms drawing, designed to take advantage of the IBM PC +high-half graphics. They were as follows: +.PP +.TS H +c c +l l. +Cap Graphic +_ +G2 upper left +G3 lower left +G1 upper right +G4 lower right +GR pointing right +GL pointing left +GU pointing up +GD pointing down +GH horizontal line +GV vertical line +GC intersection +G6 upper left +G7 lower left +G5 upper right +G8 lower right +Gr tee pointing right +Gr tee pointing left +Gu tee pointing up +Gd tee pointing down +Gh horizontal line +Gv vertical line +Gc intersection +GG acs magic cookie count +.TE +.PP +If the single-line capabilities occur in an entry, they will automatically +be composed into an \fBacsc\fR string. The double-line capabilities and +\fBGG\fR are discarded with a warning message. +.PP +IBM's AIX has a terminfo facility descended from SVr1 terminfo but incompatible +with the SVr4 format. The following AIX extensions are automatically +translated: +.PP +.TS +c c +l l. +IBM XSI +_ +ksel kslt +kbtab kcbt +font0 s0ds +font1 s1ds +font2 s2ds +font3 s3ds +.TE +.PP +Additionally, the AIX \fBbox1\fR capability will be automatically translated to +an \fBacsc\fR string. +.PP +Hewlett-Packard's terminfo library supports two nonstandard terminfo +capabilities \fBmeml\fR (memory lock) and \fBmemu\fR (memory unlock). +These will be discarded with a warning message. +.SH NOTES +This utility is actually a link to \fItic\fR(1M), running in \fI-I\fR mode. + +The trace option isn't identical to SVr4's. Under SVr4, instead of following +the -v with a trace level n, you repeat it n times. +.SH SEE ALSO +\fBcurses\fR(3X), \fBinfocmp\fR(1M), \fBterminfo\fR(\*n) +.SH AUTHOR +Eric S. Raymond <esr@snark.thyrsus.com> +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/clear.1 b/contrib/ncurses/man/clear.1 new file mode 100644 index 000000000000..71d2883b747e --- /dev/null +++ b/contrib/ncurses/man/clear.1 @@ -0,0 +1,48 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: clear.1,v 1.2 1998/03/11 21:12:53 juergen Exp $ +.TH clear 1 "" +.ds n 5 +.SH NAME +\fBclear\fR - clear the terminal screen +.SH SYNOPSIS +\fBclear\fR +.br +.SH DESCRIPTION +\fBclear\fR clears your screen if this is possible. It looks in the +environment for the terminal type and then in the \fBterminfo\fR database to +figure out how to clear the screen. +.SH SEE ALSO +\fBtput\fR(1), \fBterminfo\fR(\*n) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_addch.3x b/contrib/ncurses/man/curs_addch.3x new file mode 100644 index 000000000000..7cdfd7835355 --- /dev/null +++ b/contrib/ncurses/man/curs_addch.3x @@ -0,0 +1,163 @@ +'\" t +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_addch.3x,v 1.16 1999/02/07 03:47:42 tom Exp $ +.TH curs_addch 3X "" +.SH NAME +\fBaddch\fR, \fBwaddch\fR, \fBmvaddch\fR, \fBmvwaddch\fR, +\fBechochar\fR, \fBwechochar\fR - add a character (with attributes) to a +\fBcurses\fR window, then advance the cursor +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBint addch(chtype ch);\fR +.br +\fBint waddch(WINDOW *win, chtype ch);\fR +.br +\fBint mvaddch(int y, int x, chtype ch);\fR +.br +\fBint mvwaddch(WINDOW *win, int y, int x, chtype ch);\fR +.br +\fBint echochar(chtype ch);\fR +.br +\fBint wechochar(WINDOW *win, chtype ch);\fR +.br +.SH DESCRIPTION +The \fBaddch\fR, \fBwaddch\fR, \fBmvaddch\fR and \fBmvwaddch\fR routines put +the character \fIch\fR into the given window at its current window position, +which is then advanced. They are analogous to \fBputchar\fR in \fBstdio\fR(3). +If the advance is at the right margin, the cursor automatically wraps to the +beginning of the next line. At the bottom of the current scrolling region, if +\fBscrollok\fR is enabled, the scrolling region is scrolled up one line. + +If \fIch\fR is a tab, newline, or backspace, the cursor is moved appropriately +within the window. Backspace moves the cursor one character left; at the left +edge of a window it does nothing. Newline does a \fBclrtoeol\fR, then moves +the cursor to the window left margin on the next line, scrolling the window if +on the last line). Tabs are considered to be at every eighth column. + +If \fIch\fR is any control character other than tab, newline, or backspace, it +is drawn in \fB^\fR\fIX\fR notation. Calling \fBwinch\fR after adding a +control character does not return the character itself, but instead returns +the ^-representation of the control character. + +Video attributes can be combined with a character argument passed to +\fBaddch\fR or related functions by logical-ORing them into the character. +(Thus, text, including attributes, can be copied from one place to another +using \fBinch\fR and \fBaddch\fR.). See the \fBcurs_attr\fR(3X) page for +values of predefined video attribute constants that can be usefully OR'ed +into characters. + +The \fBechochar\fR and \fBwechochar\fR routines are equivalent to a call to +\fBaddch\fR followed by a call to \fBrefresh\fR, or a call to \fBwaddch\fR +followed by a call to \fBwrefresh\fR. The knowledge that only a single +character is being output is used and, for non-control characters, a +considerable performance gain may be seen by using these routines instead of +their equivalents. +.SS Line Graphics +The following variables may be used to add line drawing characters to the +screen with routines of the \fBaddch\fR family. The default character listed +below is used if the \fBacsc\fR capability doesn't define a terminal-specific +replacement for it (but see the EXTENSIONS section below). The names are +taken from VT100 nomenclature. + +.TS +l l l +_ _ _ +l l l. +\fIName\fR \fIDefault\fR \fIDescription\fR +ACS_BLOCK # solid square block +ACS_BOARD # board of squares +ACS_BTEE + bottom tee +ACS_BULLET o bullet +ACS_CKBOARD : checker board (stipple) +ACS_DARROW v arrow pointing down +ACS_DEGREE ' degree symbol +ACS_DIAMOND + diamond +ACS_GEQUAL > greater-than-or-equal-to +ACS_HLINE - horizontal line +ACS_LANTERN # lantern symbol +ACS_LARROW < arrow pointing left +ACS_LEQUAL < less-than-or-equal-to +ACS_LLCORNER + lower left-hand corner +ACS_LRCORNER + lower right-hand corner +ACS_LTEE + left tee +ACS_NEQUAL ! not-equal +ACS_PI * greek pi +ACS_PLMINUS # plus/minus +ACS_PLUS + plus +ACS_RARROW > arrow pointing right +ACS_RTEE + right tee +ACS_S1 - scan line 1 +ACS_S3 - scan line 3 +ACS_S7 - scan line 7 +ACS_S9 \&_ scan line 9 +ACS_STERLING f pound-sterling symbol +ACS_TTEE + top tee +ACS_UARROW ^ arrow pointing up +ACS_ULCORNER + upper left-hand corner +ACS_URCORNER + upper right-hand corner +ACS_VLINE | vertical line +.TE + +.SH RETURN VALUE +All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success +(the SVr4 manuals specify only "an integer value other than \fBERR\fR") upon +successful completion, unless otherwise noted in the preceding routine +descriptions. +.SH NOTES +Note that \fBaddch\fR, \fBmvaddch\fR, \fBmvwaddch\fR, and +\fBechochar\fR may be macros. +.SH PORTABILITY +All these functions are described in the XSI Curses standard, Issue 4. +The defaults specified for forms-drawing characters apply in the POSIX locale. + +Some ACS symbols +(ACS_S3, +ACS_S7, +ACS_LEQUAL, +ACS_GEQUAL, +ACS_PI, +ACS_NEQUAL, +ACS_STERLING) +were not documented in +any publicly released System V. However, many publicly available terminfos +include \fBacsc\fR strings in which their key characters (pryz{|}) are +embedded, and a second-hand list of their character descriptions has come +to light. The ACS-prefixed names for them were invented for \fBncurses\fR(3X). +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_attr\fR(3X), \fBcurs_clear\fR(3X), +\fBcurs_inch\fR(3X), \fBcurs_outopts\fR(3X), \fBcurs_refresh\fR(3X), +\fBputc\fR(3S). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_addchstr.3x b/contrib/ncurses/man/curs_addchstr.3x new file mode 100644 index 000000000000..f552a3b0f5e8 --- /dev/null +++ b/contrib/ncurses/man/curs_addchstr.3x @@ -0,0 +1,84 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_addchstr.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $ +.TH curs_addchstr 3X "" +.SH NAME +\fBaddchstr\fR, \fBaddchnstr\fR, \fBwaddchstr\fR, +\fBwaddchnstr\fR, \fBmvaddchstr\fR, \fBmvaddchnstr\fR, \fBmvwaddchstr\fR, +\fBmvwaddchnstr\fR - add a string of characters (and attributes) to a +\fBcurses\fR window +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBint addchstr(const chtype *chstr);\fR +.br +\fBint addchnstr(const chtype *chstr, int n);\fR +.br +\fBint waddchstr(WINDOW *win, const chtype *chstr);\fR +.br +\fBint waddchnstr(WINDOW *win, const chtype *chstr, int n);\fR +.br +\fBint mvaddchstr(int y, int x, const chtype *chstr);\fR +.br +\fBint mvaddchnstr(int y, int x, const chtype *chstr, int n);\fR +.br +\fBint mvwaddchstr(WINDOW *win, int y, int x, const chtype *chstr);\fR +.br +\fBint mvwaddchnstr(WINDOW *win, int y, int x, const chtype *chstr, int n);\fR +.SH DESCRIPTION +These routines copy \fIchstr\fR into the window image structure at and after +the current cursor position. The four routines with \fIn\fR as the last +argument copy at most \fIn\fR elements, but no more than will fit on the line. +If \fBn\fR=\fB-1\fR then the whole string is copied, to the maximum number of +characters that will fit on the line. + +The window cursor is \fInot\fR advanced, and these routines work faster than +\fBwaddnstr\fR. On the other hand, they don't perform any kind of checking +(such as for the newline, backspace, or carriage return characters), they don't +advance the current cursor position, they don't expand other control characters +to ^-escapes, and they truncate the string if it crosses the right margin, +rather then wrapping it around to the new line. + +.SH RETURN VALUES +All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success +(the SVr4 manuals specify only "an integer value other than \fBERR\fR") upon +successful completion, unless otherwise noted in the preceding routine +descriptions. +.SH NOTES +Note that all routines except \fBwaddchnstr\fR may be macros. +.SH PORTABILITY +All these entry points are described in the XSI Curses standard, Issue 4. +.SH SEE ALSO +\fBcurses\fR(3X). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_addstr.3x b/contrib/ncurses/man/curs_addstr.3x new file mode 100644 index 000000000000..fee3f8145e35 --- /dev/null +++ b/contrib/ncurses/man/curs_addstr.3x @@ -0,0 +1,77 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_addstr.3x,v 1.8 1998/03/11 21:12:53 juergen Exp $ +.TH curs_addstr 3X "" +.SH NAME +\fBaddstr\fR, \fBaddnstr\fR, \fBwaddstr\fR, \fBwaddnstr\fR, +\fBmvaddstr\fR, \fBmvaddnstr\fR, \fBmvwaddstr\fR, \fBmvwaddnstr\fR - add a +string of characters to a \fBcurses\fR window and advance cursor +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBint addstr(const char *str);\fR +.br +\fBint addnstr(const char *str, int n);\fR +.br +\fBint waddstr(WINDOW *win, const char *str);\fR +.br +\fBint waddnstr(WINDOW *win, const char *str, int n);\fR +.br +\fBint mvaddstr(int y, int x, const char *str);\fR +.br +\fBint mvaddnstr(int y, int x, const char *str, int n);\fR +.br +\fBint mvwaddstr(WINDOW *win, int y, int x, const char *str);\fR +.br +\fBint mvwaddnstr(WINDOW *win, int y, int x, const char *str, int n);\fR +.SH DESCRIPTION +These routines write the characters of the (null-terminated) character string +\fIstr\fR on the given window. It is similar to calling \fBwaddch\fR once for +each character in the string. The four routines with \fIn\fR as the last +argument write at most \fIn\fR characters. If \fIn\fR is -1, then the +entire string will be added. +.SH RETURN VALUE +All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success +(the SVr4 manuals specify only "an integer value other than \fBERR\fR") upon +successful completion. +.SH NOTES +Note that all of these routines except \fBwaddstr\fR and \fBwaddnstr\fR may be +macros. +.SH PORTABILITY +All these entry points are described in the XSI Curses standard, Issue 4. The +XSI errors EILSEQ and EOVERFLOW, associated with extended-level conformance, +are not yet detected. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_addch\fR(3X). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_attr.3x b/contrib/ncurses/man/curs_attr.3x new file mode 100644 index 000000000000..d6ad62471acf --- /dev/null +++ b/contrib/ncurses/man/curs_attr.3x @@ -0,0 +1,215 @@ +'\" t +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_attr.3x,v 1.19 1998/12/26 19:25:35 tom Exp $ +.TH curs_attr 3X "" +.SH NAME +\fBattroff\fR, \fBwattroff\fR, \fBattron\fR, \fBwattron\fR, +\fBattrset\fR, \fBwattrset\fR, \fBcolor_set\fR, \fBwcolor_set\fR, +\fBstandend\fR, \fBwstandend\fR, \fBstandout\fR, +\fBwstandout\fR - \fBcurses\fR character and window attribute control routines +.SH SYNOPSIS +\fB#include <curses.h>\fR +.br +\fBint attroff(int attrs);\fR +.br +\fBint wattroff(WINDOW *win, int attrs);\fR +.br +\fBint attron(int attrs);\fR +.br +\fBint wattron(WINDOW *win, int attrs);\fR +.br +\fBint attrset(int attrs);\fR +.br +\fBint wattrset(WINDOW *win, int attrs);\fR +.br +\fBint color_set(short color_pair_number, void* opts);\fR +.br +\fBint wcolor_set(WINDOW *win, short color_pair_number,\fR + \fBvoid* opts);\fR +.br +\fBint standend(void);\fR +.br +\fBint wstandend(WINDOW *win);\fR +.br +\fBint standout(void);\fR +.br +\fBint wstandout(WINDOW *win);\fR +.br +\fBint attr_get(attr_t *attrs, short *pair, void *opts);\fR +.br +\fBint wattr_get(WINDOW *win, attr_t *attrs, short *pair,\fR + \fBvoid *opts);\fR +.br +\fBint attr_off(attr_t attrs, void *opts);\fR +.br +\fBint wattr_off(WINDOW *win, attr_t attrs, void *opts);\fR +.br +\fBint attr_on(attr_t attrs, void *opts);\fR +.br +\fBint wattr_on(WINDOW *win, attr_t attrs, void *opts);\fR +.br +\fBint attr_set(attr_t attrs, void *opts);\fR +.br +\fBint wattr_set(WINDOW *win, attr_t attrs, void *opts);\fR +.br +\fBint chgat(int n, attr_t attr, short color,\fR + \fBconst void *opts)\fR +.br +\fBint wchgat(WINDOW *win, int n, attr_t attr,\fR + \fBshort color, const void *opts)\fR +.br +\fBint mvchgat(int y, int x, int n, attr_t attr,\fR + \fBshort color, const void *opts)\fR +.br +\fBint mvwchgat(WINDOW *win, int y, int x, int n,\fR + \fBattr_t attr, short color, const void *opts)\fR +.br +.SH DESCRIPTION +These routines manipulate the current attributes of the named window. The +current attributes of a window apply to all characters that are written into +the window with \fBwaddch\fR, \fBwaddstr\fR and \fBwprintw\fR. Attributes are +a property of the character, and move with the character through any scrolling +and insert/delete line/character operations. To the extent possible, they are +displayed as appropriate modifications to the graphic rendition of characters +put on the screen. + +The routine \fBattrset\fR sets the current attributes of the given window to +\fIattrs\fR. The routine \fBattroff\fR turns off the named attributes without +turning any other attributes on or off. The routine \fBattron\fR turns on the +named attributes without affecting any others. The routine \fBstandout\fR is +the same as \fBattron(A_STANDOUT)\fR. The routine \fBstandend\fR is the same +as \fBattrset(A_NORMAL)\fR or \fBattrset(0)\fR, that is, it turns off all +attributes. + +The routine \fBcolor_set\fR sets the current color of the given window to the +foreground/background combination described by the color_pair_number. The +parameter opts is reserved for future use, applications must supply a null +pointer. + +The routine \fBwattr_get\fR returns the current attribute and color pair for +the given window; \fBattr_get\fR returns the current attribute and color pair +for \fBstdscr\fR. +The remaining \fBattr_\fR* functions operate exactly like the corresponding +\fBattr\fR* functions, except that they take arguments of type \fBattr_t\fR +rather than \fBint\fR. + +The routine \fBchgat\fR changes the attributes of a given number of characters +starting at the current cursor location of \fBstdscr\fR. It does not update +the cursor and does not perform wrapping. A character count of -1 or greater +than the remaining window width means to change attributes all the way to the +end of the current line. The \fBwchgat\fR function generalizes this to any +window; the \fBmvwchgat\fR function does a cursor move before acting. In these +functions, the color argument is a color-pair index (as in the first argument +of \fIinit_pair\fR, see \fBcurs_color\fR(3X)). The \fBopts\fR argument is not +presently used, but is reserved for the future (leave it \fBNULL\fR). +.SS Attributes +The following video attributes, defined in \fB<curses.h>\fR, can be passed to +the routines \fBattron\fR, \fBattroff\fR, and \fBattrset\fR, or OR'ed with the +characters passed to \fBaddch\fR. + +.TS +center ; +l l . +\fBA_NORMAL\fR Normal display (no highlight) +\fBA_STANDOUT\fR Best highlighting mode of the terminal. +\fBA_UNDERLINE\fR Underlining +\fBA_REVERSE\fR Reverse video +\fBA_BLINK\fR Blinking +\fBA_DIM\fR Half bright +\fBA_BOLD\fR Extra bright or bold +\fBA_PROTECT\fR Protected mode +\fBA_INVIS\fR Invisible or blank mode +\fBA_ALTCHARSET\fR Alternate character set +\fBA_CHARTEXT\fR Bit-mask to extract a character +\fBCOLOR_PAIR(\fR\fIn\fR\fB)\fR Color-pair number \fIn\fR +.TE + +The following macro is the reverse of \fBCOLOR_PAIR(\fR\fIn\fR\fB)\fR: + +.DS C +\fBPAIR_NUMBER(\fR\fIattrs\fR) Returns the pair number associated + with the \fBCOLOR_PAIR(\fR\fIn\fR\fB)\fR attribute. +.DE + +The return values of many of these routines are not meaningful (they are +implemented as macro-expanded assignments and simply return their argument). +The SVr4 manual page claims (falsely) that these routines always return \fB1\fR. + +.SH NOTES +Note that \fBattroff\fR, \fBwattroff\fR, \fBattron\fR, \fBwattron\fR, +\fBattrset\fR, \fBwattrset\fR, \fBstandend\fR and \fBstandout\fR may be macros. +.SH PORTABILITY +All these functions are supported in the XSI Curses standard, Issue 4. The +standard defined the dedicated type for highlights, \fBattr_t\fR, which is not +defined in SVr4 curses. The functions taking \fBattr_t\fR arguments are +not supported under SVr4. + +The XSI Curses standard states that whether the traditional functions +\fBattron\fR/\fBattroff\fR/\fBattrset\fR can manipulate attributes other than +\fBA_BLINK\fR, \fBA_BOLD\fR, \fBA_DIM\fR, \fBA_REVERSE\fR, \fBA_STANDOUT\fR, or +\fBA_UNDERLINE\fR is "unspecified". Under this implementation as well as +SVr4 curses, these functions correctly manipulate all other highlights +(specifically, \fBA_ALTCHARSET\fR, \fBA_PROTECT\fR, and \fBA_INVIS\fR). + +XSI Curses added the new entry points, \fBattr_get\fR, \fBattr_on\fR, +\fBattr_off\fR, \fBattr_set\fR, \fBwattr_on\fR, \fBwattr_off\fR, +\fBwattr_get\fR, \fBwattr_set\fR. These are intended to work with +a new series of highlight macros prefixed with \fBWA_\fR. + +.TS +center ; +l l . +\fBWA_NORMAL\fR Normal display (no highlight) +\fBWA_STANDOUT\fR Best highlighting mode of the terminal. +\fBWA_UNDERLINE\fR Underlining +\fBWA_REVERSE\fR Reverse video +\fBWA_BLINK\fR Blinking +\fBWA_DIM\fR Half bright +\fBWA_BOLD\fR Extra bright or bold +\fBWA_ALTCHARSET\fR Alternate character set +.TE + +The XSI curses standard specifies that each pair of corresponding \fBA_\fR +and \fBWA_\fR-using functions operates on the same current-highlight +information. + +The XSI standard extended conformance level adds new highlights +\fBA_HORIZONTAL\fR, \fBA_LEFT\fR, \fBA_LOW\fR, \fBA_RIGHT\fR, \fBA_TOP\fR, +\fBA_VERTICAL\fR (and corresponding \fBWA_\fR macros for each) which this +curses does not yet support. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_addch\fR(3X), \fBcurs_addstr\fR(3X), +\fBcurs_printw\fR(3X) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_beep.3x b/contrib/ncurses/man/curs_beep.3x new file mode 100644 index 000000000000..b9caaa804f76 --- /dev/null +++ b/contrib/ncurses/man/curs_beep.3x @@ -0,0 +1,63 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_beep.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $ +.TH curs_beep 3X "" +.SH NAME +\fBbeep\fR, \fBflash\fR - \fBcurses\fR bell and screen flash routines +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBint beep(void);\fR +.br +\fBint flash(void);\fR +.br +.SH DESCRIPTION +The \fBbeep\fR and \fBflash\fR routines are used to alert the terminal user. +The routine \fBbeep\fR sounds an audible alarm on the terminal, if possible; +otherwise it flashes the screen (visible bell). The routine \fBflash\fR +flashes the screen, and if that is not possible, sounds the alert. If neither +alert is possible, nothing happens. Nearly all terminals have an audible alert +(bell or beep), but only some can flash the screen. +.SH RETURN VALUE +These routines return \fBOK\fR if they succeed in beeping or flashing, +\fBERR\fR otherwise. +.SH EXTENSIONS +SVr4's beep and flash routines always returned \fBOK\fR, so it was not +possible to tell when the beep or flash failed. +.SH PORTABILITY +These functions are defined in the XSI Curses standard, Issue 4. Like SVr4, it +specifies that they always return \fBOK\fR. +.SH SEE ALSO +\fBcurses\fR(3X) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_bkgd.3x b/contrib/ncurses/man/curs_bkgd.3x new file mode 100644 index 000000000000..a25699976561 --- /dev/null +++ b/contrib/ncurses/man/curs_bkgd.3x @@ -0,0 +1,101 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_bkgd.3x,v 1.12 1998/03/14 23:43:31 tom Exp $ +.TH curs_bkgd 3X "" +.SH NAME +\fBbkgdset\fR, \fBwbkgdset\fR, \fBbkgd\fR, +\fBwbkgd\fR - \fBcurses\fR window background manipulation routines +.. +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBvoid bkgdset(const chtype ch);\fR +.br +\fBvoid wbkgdset(WINDOW *win, const chtype ch);\fR +.br +\fBint bkgd(const chtype ch);\fR +.br +\fBint wbkgd(WINDOW *win, const chtype ch);\fR +.br +\fBchtype getbkgd(WINDOW *win);\fR +.br +.. +.SH DESCRIPTION +The \fBbkgdset\fR and \fBwbkgdset\fR routines manipulate the +background of the named window. +The window background is a \fBchtype\fR consisting of +any combination of attributes (i.e., rendition) and a character. +The attribute part of the background is combined (OR'ed) with all non-blank +characters that are written into the window with \fBwaddch\fR. Both +the character and attribute parts of the background are combined with +the blank characters. The background becomes a property of the +character and moves with the character through any scrolling and +insert/delete line/character operations. + +To the extent possible on a +particular terminal, the attribute part of the background is displayed +as the graphic rendition of the character put on the screen. + +The \fBbkgd\fR and \fBwbkgd\fR functions +set the background property of the current or specified window +and then apply this setting to every character position in that window: + +.RS +The rendition of every character on the screen is changed to +the new background rendition. + +Wherever the former background character +appears, it is changed to the new background character. +.RE + +The \fBgetbkgd\fR function returns the given window's current background +character/attribute pair. +.. +.SH RETURN VALUE +The routines \fBbkgd\fR and \fBwbkgd\fR return the integer \fBOK\fR. +The SVr4.0 manual says "or a non-negative integer if \fBimmedok\fR is set", +but this appears to be an error. +.. +.SH NOTES +Note that \fBbkgdset\fR and \fBbkgd\fR may be macros. +.. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4. The draft +does not include \fBconst\fR qualifiers on the arguments. The standard +specifies that \fBbkgd\fR and \fBwbkgd\fR return \fBERR\fR, on failure. but +gives no failure conditions. +.. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_addch\fR(3X), \fBcurs_outopts\fR(3X) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_border.3x b/contrib/ncurses/man/curs_border.3x new file mode 100644 index 000000000000..45200eb15cb8 --- /dev/null +++ b/contrib/ncurses/man/curs_border.3x @@ -0,0 +1,108 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_border.3x,v 1.11 1999/01/30 23:11:47 tom Exp $ +.TH curs_border 3X "" +.SH NAME +\fBborder\fR, \fBwborder\fR, \fBbox\fR, +\fBhline\fR, \fBwhline\fR, \fBvline\fR, \fBwvline\fR - create +\fBcurses\fR borders, horizontal and vertical lines +.SH SYNOPSIS +\fB#include <curses.h>\fR +.br +\fBint border(chtype ls, chtype rs, chtype ts, chtype bs,\fR + \fBchtype tl, chtype tr, chtype bl, chtype br);\fR +.br +\fBint wborder(WINDOW *win, chtype ls, chtype rs,\fR + \fBchtype ts, chtype bs, chtype tl, chtype tr,\fR + \fBchtype bl, chtype br);\fR +.br +\fBint box(WINDOW *win, chtype verch, chtype horch);\fR +.br +\fBint hline(chtype ch, int n);\fR +.br +\fBint whline(WINDOW *win, chtype ch, int n);\fR +.br +\fBint vline(chtype ch, int n);\fR +.br +\fBint wvline(WINDOW *win, chtype ch, int n);\fR +.br +\fBmvhline(int y, int x, chtype ch, int n);\fR +.br +\fBmvwhline(WINDOW *, int y, int x, chtype ch, int n);\fR +.br +\fBint mvvline(int y, int x, chtype ch, int n);\fR +.br +\fBint mvwvline(WINDOW *, int y, int x, chtype ch, int n);\fR +.br +.SH DESCRIPTION +The \fBborder\fR, \fBwborder\fR and \fBbox\fR routines draw a box around the +edges of a window. The argument \fIls\fR is a character and attributes used +for the left side of the border, \fIrs\fR - right side, \fIts\fR - top side, +\fIbs\fR - bottom side, \fItl\fR - top left-hand corner, \fItr\fR - top +right-hand corner, \fIbl\fR - bottom left-hand corner, and \fIbr\fR - bottom +right-hand corner. If any of these arguments is zero, then the following +default values (defined in \fBcurses.h\fR) are used instead: \fBACS_VLINE\fR, +\fBACS_VLINE\fR, \fBACS_HLINE\fR, \fBACS_HLINE\fR, \fB\fBACS_ULCORNER\fR, +\fBACS_URCORNER\fR, \fBACS_LLCORNER\fR, \fBACS_LRCORNER\fR. + +\fBbox(\fR\fIwin\fR\fB, \fR\fIverch\fR\fB, \fR\fIhorch\fR\fB)\fR is a shorthand +for the following call: \fBwborder(\fR\fIwin\fR\fB,\fR \fIverch\fR\fB,\fR +\fIverch\fR\fB,\fR \fIhorch\fR\fB,\fR \fIhorch\fR\fB, 0, 0, 0, 0)\fR. + +The \fBhline\fR and \fBwhline\fR functions draw a horizontal (left to right) +line using \fIch\fR starting at the current cursor position in the window. The +current cursor position is not changed. The line is at most \fIn\fR characters +long, or as many as fit into the window. + +The \fBvline\fR and \fBwvline\fR functions draw a vertical (top to bottom) line +using \fIch\fR starting at the current cursor position in the window. The +current cursor position is not changed. The line is at most \fIn\fR characters +long, or as many as fit into the window. +.SH RETURN VALUE +All routines return the integer \fBOK\fR. The SVr4.0 manual says "or a +non-negative integer if \fBimmedok\fR is set", but this appears to be an error. +.SH NOTES +The borders generated by these functions are \fIinside\fR borders (this +is also true of SVr4 curses, though the fact is not documented). + +Note that \fBborder\fR and \fBbox\fR may be macros. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4. Additional +functions \fBmvhline\fR, \fBmvvline\fR, \fBmvwhline\fR, and \fBmvwvline\fR are +described there which this implementation does not yet support. The standard +specifies that they return \fBERR\fR on failure, but specifies no error +conditions. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_outopts\fR(3X). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_clear.3x b/contrib/ncurses/man/curs_clear.3x new file mode 100644 index 000000000000..d08e852a27b1 --- /dev/null +++ b/contrib/ncurses/man/curs_clear.3x @@ -0,0 +1,94 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_clear.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $ +.TH curs_clear 3X "" +.SH NAME +\fBerase\fR, \fBwerase\fR, \fBclear\fR, +\fBwclear\fR, \fBclrtobot\fR, \fBwclrtobot\fR, \fBclrtoeol\fR, +\fBwclrtoeol\fR - clear all or part of a \fBcurses\fR window +.SH SYNOPSIS +\fB# include <curses.h>\fR + +\fBint erase(void);\fR +.br +\fBint werase(WINDOW *win);\fR +.br +\fBint clear(void);\fR +.br +\fBint wclear(WINDOW *win);\fR +.br +\fBint clrtobot(void);\fR +.br +\fBint wclrtobot(WINDOW *win);\fR +.br +\fBint clrtoeol(void);\fR +.br +\fBint wclrtoeol(WINDOW *win);\fR +.br +.SH DESCRIPTION +The \fBerase\fR and \fBwerase\fR routines copy blanks to every +position in the window, clearing the screen. + +The \fBclear\fR and \fBwclear\fR routines are like \fBerase\fR and +\fBwerase\fR, but they also call \fBclearok\fR, so that the screen is +cleared completely on the next call to \fBwrefresh\fR for that window +and repainted from scratch. + +The \fBclrtobot\fR and \fBwclrtobot\fR routines erase from the cursor to the +end of screen. That is, they erase all lines below the cursor in the window. +Also, the current line to the right of the cursor, inclusive, is erased. + +The \fBclrtoeol\fR and \fBwclrtoeol\fR routines erase the current line +to the right of the cursor, inclusive, to the end of the current line. + +Blanks created by erasure have the current background rendition (as set +by \fBwbkgdset\fR) merged into them. +.SH RETURN VALUE +All routines return the integer \fBOK\fR. The SVr4.0 manual says "or a +non-negative integer if \fBimmedok\fR is set", but this appears to be an error. +.SH NOTES +Note that \fBerase\fR, \fBwerase\fR, \fBclear\fR, \fBwclear\fR, +\fBclrtobot\fR, and \fBclrtoeol\fR may be macros. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4. The +standard specifies that they return \fBERR\fR on failure, but specifies no +error conditions. + +Some historic curses implementations had, as an undocumented feature, the +ability to do the equivalent of \fBclearok(..., 1)\fR by saying +\fBtouchwin(stdscr)\fR or \fBclear(stdscr)\fR. This will not work under +ncurses. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_outopts\fR(3X), \fBcurs_refresh\fR(3X) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_color.3x b/contrib/ncurses/man/curs_color.3x new file mode 100644 index 000000000000..03cbba6349e6 --- /dev/null +++ b/contrib/ncurses/man/curs_color.3x @@ -0,0 +1,190 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_color.3x,v 1.10 1998/03/11 21:12:53 juergen Exp $ +.TH curs_color 3X "" +.SH NAME +\fBstart_color\fR, \fBinit_pair\fR, +\fBinit_color\fR, \fBhas_colors\fR, \fBcan_change_color\fR, +\fBcolor_content\fR, \fBpair_content\fR - \fBcurses\fR color +manipulation routines +.SH SYNOPSIS +\fB# include <curses.h>\fR +.br +\fBint start_color(void);\fR +.br +\fBint init_pair(short pair, short f, short b);\fR +.br +\fBint init_color(short color, short r, short g, short b);\fR +.br +\fBbool has_colors(void);\fR +.br +\fBbool can_change_color(void);\fR +.br +\fBint color_content(short color, short *r, short *g, short *b);\fR +.br +\fBint pair_content(short pair, short *f, short *b);\fR +.br +.SH DESCRIPTION +.SS Overview +\fBcurses\fR support color attributes on terminals with that capability. To +use these routines \fBstart_color\fR must be called, usually right after +\fBinitscr\fR. Colors are always used in pairs (referred to as color-pairs). +A color-pair consists of a foreground color (for characters) and a background +color (for the blank field on which the characters are displayed). A +programmer initializes a color-pair with the routine \fBinit_pair\fR. After it +has been initialized, \fBCOLOR_PAIR\fR(\fIn\fR), a macro defined in +\fB<curses.h>\fR, can be used as a new video attribute. + +If a terminal is capable of redefining colors, the programmer can use the +routine \fBinit_color\fR to change the definition of a color. The routines +\fBhas_colors\fR and \fBcan_change_color\fR return \fBTRUE\fR or \fBFALSE\fR, +depending on whether the terminal has color capabilities and whether the +programmer can change the colors. The routine \fBcolor_content\fR allows a +programmer to extract the amounts of red, green, and blue components in an +initialized color. The routine \fBpair_content\fR allows a programmer to find +out how a given color-pair is currently defined. +.SS Routine Descriptions +The \fBstart_color\fR routine requires no arguments. It must be +called if the programmer wants to use colors, and before any other +color manipulation routine is called. It is good practice to call +this routine right after \fBinitscr\fR. \fBstart_color\fR initializes +eight basic colors (black, red, green, yellow, blue, magenta, cyan, +and white), and two global variables, \fBCOLORS\fR and +\fBCOLOR_PAIRS\fR (respectively defining the maximum number of colors +and color-pairs the terminal can support). It also restores the +colors on the terminal to the values they had when the terminal was +just turned on. + +The \fBinit_pair\fR routine changes the definition of a color-pair. It takes +three arguments: the number of the color-pair to be changed, the foreground +color number, and the background color number. The value of the first argument +must be between \fB1\fR and \fBCOLOR_PAIRS-1\fR. The value of the second and +third arguments must be between 0 and \fBCOLORS\fR (the 0 color pair is wired +to white on black and cannot be changed). If the color-pair was previously +initialized, the screen is refreshed and all occurrences of that color-pair is +changed to the new definition. + +The \fBinit_color\fR routine changes the definition of a color. It takes four +arguments: the number of the color to be changed followed by three RGB values +(for the amounts of red, green, and blue components). The value of the first +argument must be between \fB0\fR and \fBCOLORS\fR. (See the section +\fBColors\fR for the default color index.) Each of the last three arguments +must be a value between 0 and 1000. When \fBinit_color\fR is used, all +occurrences of that color on the screen immediately change to the new +definition. + +The \fBhas_colors\fR routine requires no arguments. It returns \fBTRUE\fR if +the terminal can manipulate colors; otherwise, it returns \fBFALSE\fR. This +routine facilitates writing terminal-independent programs. For example, a +programmer can use it to decide whether to use color or some other video +attribute. + +The \fBcan_change_color\fR routine requires no arguments. It returns +\fBTRUE\fR if the terminal supports colors and can change their definitions; +other, it returns \fBFALSE\fR. This routine facilitates writing +terminal-independent programs. + +The \fBcolor_content\fR routine gives programmers a way to find the intensity +of the red, green, and blue (RGB) components in a color. It requires four +arguments: the color number, and three addresses of \fBshort\fRs for storing +the information about the amounts of red, green, and blue components in the +given color. The value of the first argument must be between 0 and +\fBCOLORS\fR. The values that are stored at the addresses pointed to by the +last three arguments are between 0 (no component) and 1000 (maximum amount of +component). + +The \fBpair_content\fR routine allows programmers to find out what colors a +given color-pair consists of. It requires three arguments: the color-pair +number, and two addresses of \fBshort\fRs for storing the foreground and the +background color numbers. The value of the first argument must be between 1 +and \fBCOLOR_PAIRS-1\fR. The values that are stored at the addresses pointed +to by the second and third arguments are between 0 and \fBCOLORS\fR. +.SS Colors +In \fB<curses.h>\fR the following macros are defined. These are the default +colors. \fBcurses\fR also assumes that \fBCOLOR_BLACK\fR is the default +background color for all terminals. + +.nf + \fBCOLOR_BLACK\fR + \fBCOLOR_RED\fR + \fBCOLOR_GREEN\fR + \fBCOLOR_YELLOW\fR + \fBCOLOR_BLUE\fR + \fBCOLOR_MAGENTA\fR + \fBCOLOR_CYAN\fR + \fBCOLOR_WHITE\fR +.fi +.SH RETURN VALUE +The routines \fBcan_change_color()\fR and \fBhas_colors()\fR return \fBTRUE\fR +or \fBFALSE\fR. + +All other routines return the integer \fBERR\fR upon failure and an \fBOK\fR +(SVr4 specifies only "an integer value other than \fBERR\fR") upon successful +completion. +.SH NOTES +In the \fIncurses\fR implementation, there is a separate color activation flag, +color palette, color pairs table, and associated COLORS and COLOR_PAIRS counts +for each screen; the \fBstart_color\fR function only affects the current +screen. The SVr4/XSI interface is not really designed with this in mind, and +historical implementations may use a single shared color palette. + +Note that setting an implicit background color via a color pair affects only +character cells that a character write operation explicitly touches. To change +the background color used when parts of a window are blanked by erasing or +scrolling operations, see \fBcurs_bkgd\fR(3X). + +Several caveats apply on 386 and 486 machines with VGA-compatible graphics: + +COLOR_YELLOW is actually brown. To get yellow, use COLOR_YELLOW combined with +the \fBA_BOLD\fR attribute. + +The A_BLINK attribute should in theory cause the background to go bright. This +often fails to work, and even some cards for which it mostly works (such as the +Paradise and compatibles) do the wrong thing when you try to set a bright +"yellow" background (you get a blinking yellow foreground instead). + +Color RGB values are not settable. +.SH PORTABILITY +This implementation satisfies XSI Curses's minimum maximums +for \fBCOLORS\fR and \fBCOLOR_PAIRS\fR. +.PP +The \fBinit_pair\fP routine accepts negative values of foreground +and background color to support the \fBuse_default_colors\fP extension, +but only if that routine has been first invoked. +.SH SEE ALSO +\fBcurses\fR(3X), +\fBcurs_initscr\fR(3X), +\fBcurs_attr\fR(3X), +\fBdft_fgbg\fR(3X) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_delch.3x b/contrib/ncurses/man/curs_delch.3x new file mode 100644 index 000000000000..d63d6020e3a9 --- /dev/null +++ b/contrib/ncurses/man/curs_delch.3x @@ -0,0 +1,68 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_delch.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $ +.TH curs_delch 3X "" +.SH NAME +\fBdelch\fR, \fBwdelch\fR, \fBmvdelch\fR, \fBmvwdelch\fR - +delete character under the cursor in a \fBcurses\fR window +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBint delch(void);\fR +.br +\fBint wdelch(WINDOW *win);\fR +.br +\fBint mvdelch(int y, int x);\fR +.br +\fBint mvwdelch(WINDOW *win, int y, int x);\fR +.br +.SH DESCRIPTION +These routines delete the character under the cursor; all characters to the +right of the cursor on the same line are moved to the left one position and the +last character on the line is filled with a blank. The cursor position does +not change (after moving to \fIy\fR, \fIx\fR, if specified). (This does not +imply use of the hardware delete character feature.) +.SH RETURN VALUE +All routines return the integer \fBERR\fR upon failure and an \fBOK\fR (SVr4 +specifies only "an integer value other than \fBERR\fR") upon successful +completion. +.SH NOTES +Note that \fBdelch\fR, \fBmvdelch\fR, and \fBmvwdelch\fR may be macros. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4. The +standard specifies that they return \fBERR\fR on failure, but specifies no +error conditions. +.SH SEE ALSO +\fBcurses\fR(3X) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_deleteln.3x b/contrib/ncurses/man/curs_deleteln.3x new file mode 100644 index 000000000000..54bf331ba59e --- /dev/null +++ b/contrib/ncurses/man/curs_deleteln.3x @@ -0,0 +1,84 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_deleteln.3x,v 1.5 1999/02/07 03:58:20 tom Exp $ +.TH curs_deleteln 3X "" +.SH NAME +\fBdeleteln\fR, \fBwdeleteln\fR, \fBinsdelln\fR, +\fBwinsdelln\fR, \fBinsertln\fR, \fBwinsertln\fR - delete and insert +lines in a \fBcurses\fR window +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBint deleteln(void);\fR +.br +\fBint wdeleteln(WINDOW *win);\fR +.br +\fBint insdelln(int n);\fR +.br +\fBint winsdelln(WINDOW *win, int n);\fR +.br +\fBint insertln(void);\fR +.br +\fBint winsertln(WINDOW *win);\fR +.br +.SH DESCRIPTION +The \fBdeleteln\fR and \fBwdeleteln\fR routines delete the line under the +cursor in the window; all lines below the current line are moved up one line. +The bottom line of the window is cleared. The cursor position does not change. + +The \fBinsdelln\fR and \fBwinsdelln\fR routines, for positive \fIn\fR, insert +\fIn\fR lines into the specified window above the current line. The \fIn\fR +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 +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 +specifies only "an integer value other than \fBERR\fR") upon successful +completion. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4. The +standard specifies that they return \fBERR\fR on failure, but specifies no +error conditions. +.SH NOTES +Note that all but \fBwinsdelln\fR may be macros. + +These routines do not require a hardware line delete or insert feature in the +terminal. In fact, they won't use hardware line delete/insert unless +\fBidlok(..., TRUE)\fR has been set on the current window. +.SH SEE ALSO +\fBcurses\fR(3X) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_getch.3x b/contrib/ncurses/man/curs_getch.3x new file mode 100644 index 000000000000..0e4424618bcd --- /dev/null +++ b/contrib/ncurses/man/curs_getch.3x @@ -0,0 +1,274 @@ +'\" t +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_getch.3x,v 1.15 1998/11/29 01:04:26 Rick.Ohnemus Exp $ +.TH curs_getch 3X "" +.SH NAME +\fBgetch\fR, \fBwgetch\fR, \fBmvgetch\fR, +\fBmvwgetch\fR, \fBungetch\fR - get (or push back) characters from +\fBcurses\fR terminal keyboard +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBint getch(void);\fR +.br +\fBint wgetch(WINDOW *win);\fR +.br +\fBint mvgetch(int y, int x);\fR +.br +\fBint mvwgetch(WINDOW *win, int y, int x);\fR +.br +\fBint ungetch(int ch);\fR +.br +\fBint has_key(int ch);\fR +.br +.SH DESCRIPTION +The \fBgetch\fR, \fBwgetch\fR, \fBmvgetch\fR and \fBmvwgetch\fR, routines read +a character from the window. In no-delay mode, if no input is waiting, the +value \fBERR\fR is returned. In delay mode, the program waits until the system +passes text through to the program. Depending on the setting of \fBcbreak\fR, +this is after one character (cbreak mode), or after the first newline (nocbreak +mode). In half-delay mode, the program waits until a character is typed or the +specified timeout has been reached. + +If \fBnoecho\fR has been set, then the character will also be echoed into the +designated window according to the following rules: +If the character is the current erase character, left arrow, or backspace, +the cursor is moved one space to the left and that screen position is erased +as if \fBdelch\fR had been called. +If the character value is any other \fBKEY_\fR define, the user is alerted +with a \fBbeep\fR call. +Otherwise the character is simply output to the screen. + +If the window is not a pad, and it has been moved or modified since the last +call to \fBwrefresh\fR, \fBwrefresh\fR will be called before another character +is read. + +If \fBkeypad\fR is \fBTRUE\fR, and a function key is pressed, the token for +that function key is returned instead of the raw characters. Possible function +keys are defined in \fB<curses.h>\fR as macros with values outside the range +of 8-bit characters whose names begin with \fBKEY_.\fR Thus, a variable +intended to hold the return value of a function key must be of short size or +larger. + +When a character that could be the beginning of a function key is received +(which, on modern terminals, means an escape character), \fBcurses\fR sets a +timer. If the remainder of the sequence does not come in within the designated +time, the character is passed through; otherwise, the function key value is +returned. For this reason, many terminals experience a delay between the time +a user presses the escape key and the escape is returned to the program. + +The \fBungetch\fR routine places \fIch\fR back onto the input queue to be +returned by the next call to \fBwgetch\fR. Note that there is, in effect, +just one input queue for all windows. + +.SS Function Keys +The following function keys, defined in \fB<curses.h>\fR, might be returned by +\fBgetch\fR if \fBkeypad\fR has been enabled. Note that not all of these are +necessarily supported on any particular terminal. +.sp +.TS +center tab(/) ; +l l +l l . +\fIName\fR/\fIKey\fR \fIname\fR + +KEY_BREAK/Break key +KEY_DOWN/The four arrow keys ... +KEY_UP +KEY_LEFT +KEY_RIGHT +KEY_HOME/Home key (upward+left arrow) +KEY_BACKSPACE/Backspace +KEY_F0/T{ +Function keys; space for 64 keys is reserved. +T} +KEY_F(\fIn\fR)/T{ +For 0 \(<= \fIn\fR \(<= 63 +T} +KEY_DL/Delete line +KEY_IL/Insert line +KEY_DC/Delete character +KEY_IC/Insert char or enter insert mode +KEY_EIC/Exit insert char mode +KEY_CLEAR/Clear screen +KEY_EOS/Clear to end of screen +KEY_EOL/Clear to end of line +KEY_SF/Scroll 1 line forward +KEY_SR/Scroll 1 line backward (reverse) +KEY_NPAGE/Next page +KEY_PPAGE/Previous page +KEY_STAB/Set tab +KEY_CTAB/Clear tab +KEY_CATAB/Clear all tabs +KEY_ENTER/Enter or send +KEY_SRESET/Soft (partial) reset +KEY_RESET/Reset or hard reset +KEY_PRINT/Print or copy +KEY_LL/Home down or bottom (lower left). +KEY_A1/Upper left of keypad +KEY_A3/Upper right of keypad +KEY_B2/Center of keypad +KEY_C1/Lower left of keypad +KEY_C3/Lower right of keypad +KEY_BTAB/Back tab key +KEY_BEG/Beg(inning) key +KEY_CANCEL/Cancel key +KEY_CLOSE/Close key +KEY_COMMAND/Cmd (command) key +KEY_COPY/Copy key +KEY_CREATE/Create key +KEY_END/End key +KEY_EXIT/Exit key +KEY_FIND/Find key +KEY_HELP/Help key +KEY_MARK/Mark key +KEY_MESSAGE/Message key +KEY_MOUSE/Mouse event read +KEY_MOVE/Move key +KEY_NEXT/Next object key +KEY_OPEN/Open key +KEY_OPTIONS/Options key +KEY_PREVIOUS/Previous object key +KEY_REDO/Redo key +KEY_REFERENCE/Ref(erence) key +KEY_REFRESH/Refresh key +KEY_REPLACE/Replace key +KEY_RESIZE/Screen resized +KEY_RESTART/Restart key +KEY_RESUME/Resume key +KEY_SAVE/Save key +KEY_SBEG/Shifted beginning key +KEY_SCANCEL/Shifted cancel key +KEY_SCOMMAND/Shifted command key +KEY_SCOPY/Shifted copy key +KEY_SCREATE/Shifted create key +KEY_SDC/Shifted delete char key +KEY_SDL/Shifted delete line key +KEY_SELECT/Select key +KEY_SEND/Shifted end key +KEY_SEOL/Shifted clear line key +KEY_SEXIT/Shifted exit key +KEY_SFIND/Shifted find key +KEY_SHELP/Shifted help key +KEY_SHOME/Shifted home key +KEY_SIC/Shifted input key +KEY_SLEFT/Shifted left arrow key +KEY_SMESSAGE/Shifted message key +KEY_SMOVE/Shifted move key +KEY_SNEXT/Shifted next key +KEY_SOPTIONS/Shifted options key +KEY_SPREVIOUS/Shifted prev key +KEY_SPRINT/Shifted print key +KEY_SREDO/Shifted redo key +KEY_SREPLACE/Shifted replace key +KEY_SRIGHT/Shifted right arrow +KEY_SRSUME/Shifted resume key +KEY_SSAVE/Shifted save key +KEY_SSUSPEND/Shifted suspend key +KEY_SUNDO/Shifted undo key +KEY_SUSPEND/Suspend key +KEY_UNDO/Undo key +.TE + +Keypad is arranged like this: +.sp +.TS +center allbox tab(/) ; +c c c . +\fBA1\fR/\fBup\fR/\fBA3\fR +\fBleft\fR/\fBB2\fR/\fBright\fR +\fBC1\fR/\fBdown\fR/\fBC3\fR +.TE +.sp +The \fBhas_key\fR routine takes a key value from the above list, and +returns TRUE or FALSE according as the current terminal type recognizes +a key with that value. + +.SH RETURN VALUE +All routines return the integer \fBERR\fR upon failure and an integer value +other than \fBERR\fR (\fBOK\fR in the case of ungetch()) upon successful +completion. +.SH NOTES +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. + +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 +state of the tty driver when each character is typed, the program may +produce undesirable results. + +Note that \fBgetch\fR, \fBmvgetch\fR, and \fBmvwgetch\fR may be macros. + +Historically, the set of keypad macros was largely defined by the extremely +function-key-rich keyboard of the AT&T 7300, aka 3B1, aka Safari 4. Modern +personal computers usually have only a small subset of these. IBM PC-style +consoles typically support little more than \fBKEY_UP\fR, \fBKEY_DOWN\fR, +\fBKEY_LEFT\fR, \fBKEY_RIGHT\fR, \fBKEY_HOME\fR, \fBKEY_END\fR, +\fBKEY_NPAGE\fR, \fBKEY_PPAGE\fR, and function keys 1 through 12. The Ins key +is usually mapped to \fBKEY_IC\fR. +.SH PORTABILITY +The *get* functions are described in the XSI Curses standard, Issue 4. They +read single-byte characters only. The standard specifies that they return +\fBERR\fR on failure, but specifies no error conditions. + +The echo behavior of these functions on input of \fBKEY_\fR or backspace +characters was not specified in the SVr4 documentation. This description is +adopted from the XSI Curses standard. + +The behavior of \fBgetch\fR and friends in the presence of handled signals is +unspecified in the SVr4 and XSI Curses documentation. Under historical curses +implementations, it varied depending on whether the operating system's +implementation of handled signal receipt interrupts a \fBread\fR(2) call in +progress or not, and also (in some implementations) depending on whether an +input timeout or non-blocking mode hsd been set. + +Programmers concerned about portability should be prepared for either of two +cases: (a) signal receipt does not interrupt \fBgetch\fR; (b) signal receipt +interrupts \fBgetch\fR and causes it to return ERR with \fBerrno\fR set to +\fBEINTR\fR. Under the \fBncurses\fR implementation, handled signals never +interrupt \fBgetch\fR. + +The \fBhas_key\fR function is unique to \fBncurses\fR. We recommend that +any code using it be conditionalized on the \fBNCURSES_VERSION\fR feature macro. +.SH SEE ALSO +\fBcurses\fR(3X), +\fBcurs_inopts\fR(3X), +\fBcurs_mouse\fR(3X), +\fBcurs_move\fR(3X), +\fBcurs_refresh\fR(3X). +\fBresizeterm\fR(3X). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_getstr.3x b/contrib/ncurses/man/curs_getstr.3x new file mode 100644 index 000000000000..b3678e0a2b5a --- /dev/null +++ b/contrib/ncurses/man/curs_getstr.3x @@ -0,0 +1,102 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_getstr.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $ +.TH curs_getstr 3X "" +.SH NAME +\fBgetstr\fR, \fBwgetstr\fR, \fBmvgetstr\fR, +\fBmvwgetstr\fR, \fBwgetnstr\fR - accept character strings from +\fBcurses\fR terminal keyboard +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBint getstr(char *str);\fR +.br +\fBint getnstr(char *str, int n);\fR +.br +\fBint wgetstr(WINDOW *win, char *str);\fR +.br +\fBint mvgetstr(int y, int x, char *str);\fR +.br +\fBint mvwgetstr(WINDOW *win, int y, int x, char *str);\fR +.br +\fBint mvgetnstr(int y, int x, char *str, int n);\fR +.br +\fBint mvwgetnstr(WINDOW *, int y, int x, char *str, int n);\fR +.br +\fBint wgetnstr(WINDOW *win, char *str, int n);\fR +.br +.SH DESCRIPTION +The function \fBgetstr\fR is equivalent to a series of calls to \fBgetch\fR, +until a newline or carriage return is received (the terminating character is +not included in the returned string). The resulting value is placed in the +area pointed to by the character pointer \fIstr\fR. + +\fBwgetnstr\fR reads at most \fIn\fR characters, thus preventing a possible +overflow of the input buffer. Any attempt to enter more characters (other +than the terminating newline or carriage return) causes a beep. Function +keys also cause a beep and are ignored. The \fBgetnstr\fR function reads +from the \fIstdscr\fR default window. + +The user's erase and kill characters are interpreted. If keypad +mode is on for the window, \fBKEY_LEFT\fR and \fBKEY_BACKSPACE\fR +are both considered equivalent to the user's kill character. + +Characters input are echoed only if \fBecho\fR is currently on. In that case, +backspace is echoed as deletion of the previous character (typically a left +motion). +.SH RETURN VALUE +All routines return the integer \fBERR\fR upon failure and an \fBOK\fR (SVr4 +specifies only "an integer value other than \fBERR\fR") upon successful +completion. +.SH NOTES +Note that \fBgetstr\fR, \fBmvgetstr\fR, and \fBmvwgetstr\fR may be macros. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4. They read +single-byte characters only. The standard specifies that they return \fBERR\fR +on failure, but the single error condition \fBEOVERFLOW\fR associated with +extended-level conformance is not yet returned (the XSI curses support for +multi-byte characters is not yet present). + +SVr3 and early SVr4 curses implementations did not reject function keys; +the SVr4.0 documentation claimed that "special keys" (such as function +keys, "home" key, "clear" key, \fIetc\fR.) are interpreted" without +giving details. It lied. In fact, the `character' value appended to the +string by those implementations was predictable but not useful +(being, in fact, the low-order eight bits of the key's KEY_ value). + +The functions \fBgetnstr\fR, \fBmvgetnstr\fR, and \fBmvwgetnstr\fR were +present but not documented in SVr4. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_getch\fR(3X). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_getyx.3x b/contrib/ncurses/man/curs_getyx.3x new file mode 100644 index 000000000000..820bf99c5327 --- /dev/null +++ b/contrib/ncurses/man/curs_getyx.3x @@ -0,0 +1,72 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_getyx.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $ +.TH curs_getyx 3X "" +.SH NAME +\fBgetyx\fR, \fBgetparyx\fR, \fBgetbegyx\fR, +\fBgetmaxyx\fR - get \fBcurses\fR cursor and window coordinates +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBvoid getyx(WINDOW *win, int y, int x);\fR +.br +\fBvoid getparyx(WINDOW *win, int y, int x);\fR +.br +\fBvoid getbegyx(WINDOW *win, int y, int x);\fR +.br +\fBvoid getmaxyx(WINDOW *win, int y, int x);\fR +.br +.SH DESCRIPTION +The \fBgetyx\fR macro places the current cursor position of the given window in +the two integer variables \fIy\fR and \fIx\fR. + +If \fIwin\fR is a subwindow, the \fBgetparyx\fR macro places the beginning +coordinates of the subwindow relative to the parent window into two integer +variables \fIy\fR and \fIx\fR. Otherwise, \fB-1\fR is placed into \fIy\fR and +\fIx\fR. + +Like \fBgetyx\fR, the \fBgetbegyx\fR and \fBgetmaxyx\fR macros store +the current beginning coordinates and size of the specified window. +.SH RETURN VALUE +The return values of these macros are undefined (\fIi\fR.\fIe\fR., +they should not be used as the right-hand side of assignment +statements). +.SH NOTES +All of these interfaces are macros and that "\fB&\fR" is not +necessary before the variables \fIy\fR and \fIx\fR. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4. +.SH SEE ALSO +\fBcurses\fR(3X) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_inch.3x b/contrib/ncurses/man/curs_inch.3x new file mode 100644 index 000000000000..bcc8d6f85c60 --- /dev/null +++ b/contrib/ncurses/man/curs_inch.3x @@ -0,0 +1,73 @@ +'\" t +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_inch.3x,v 1.11 1998/11/29 01:04:34 Rick.Ohnemus Exp $ +.TH curs_inch 3X "" +.SH NAME +\fBinch\fR, \fBwinch\fR, \fBmvinch\fR, \fBmvwinch\fR +- get a character and attributes from a \fBcurses\fR window +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBchtype inch(void);\fR +.br +\fBchtype winch(WINDOW *win);\fR +.br +\fBchtype mvinch(int y, int x);\fR +.br +\fBchtype mvwinch(WINDOW *win, int y, int x);\fR +.br +.SH DESCRIPTION +These routines return the character, of type \fBchtype\fR, at the current +position in the named window. If any attributes are set for that position, +their values are OR'ed into the value returned. Constants defined in +\fB<curses.h>\fR can be used with the \fB&\fR (logical AND) operator to +extract the character or attributes alone. + +.SS Attributes +The following bit-masks may be AND-ed with characters returned by \fBwinch\fR. + +.TS +l l . +\fBA_CHARTEXT\fR Bit-mask to extract character +\fBA_ATTRIBUTES\fR Bit-mask to extract attributes +\fBA_COLOR\fR Bit-mask to extract color-pair field information +.TE +.SH NOTES +Note that all of these routines may be macros. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4. +.SH SEE ALSO +\fBcurses\fR(3X). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_inchstr.3x b/contrib/ncurses/man/curs_inchstr.3x new file mode 100644 index 000000000000..dfe7bf48191a --- /dev/null +++ b/contrib/ncurses/man/curs_inchstr.3x @@ -0,0 +1,84 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_inchstr.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $ +.TH curs_inchstr 3X "" +.SH NAME +\fBinchstr\fR, \fBinchnstr\fR, \fBwinchstr\fR, +\fBwinchnstr\fR, \fBmvinchstr\fR, \fBmvinchnstr\fR, \fBmvwinchstr\fR, +\fBmvwinchnstr\fR - get a string of characters (and attributes) from a +\fBcurses\fR window +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBint inchstr(chtype *chstr);\fR +.br +\fBint inchnstr(chtype *chstr, int n);\fR +.br +\fBint winchstr(WINDOW *win, chtype *chstr);\fR +.br +\fBint winchnstr(WINDOW *win, chtype *chstr, int n);\fR +.br +\fBint mvinchstr(int y, int x, chtype *chstr);\fR +.br +\fBint mvinchnstr(int y, int x, chtype *chstr, int n);\fR +.br +\fBint mvwinchstr(WINDOW *win, int y, int x, chtype *chstr);\fR +.br +\fBint mvwinchnstr(WINDOW *win, int y, int x, chtype *chstr, int n);\fR +.br +.SH DESCRIPTION +These routines return a NULL-terminated array of \fBchtype\fR quantities, +starting at the current cursor position in the named window and ending at the +right margin of the window. The four functions with \fIn\fR as +the last argument, return a leading substring at most \fIn\fR characters long +(exclusive of the trailing (chtype)0). +Constants defined in \fB<curses.h>\fR can be used with the \fB&\fR (logical +AND) operator to extract the character or the attribute alone from any position +in the \fIchstr\fR [see \fBcurs_inch\fR(3X)]. +.SH RETURN VALUE +All routines return the integer \fBERR\fR upon failure and an integer value +other than \fBERR\fR upon successful completion (the number of characters +retrieved, exclusive of the trailing 0). +.SH NOTES +Note that all routines except \fBwinchnstr\fR may be macros. SVr4 does not +document whether the result string is 0-terminated; it does not document +whether a length limit argument includes any trailing 0; and it does not +document the meaning of the return value. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4. It is no +more specific than the SVr4 documentation on the trailing 0. It does specify +that the successful return of the functions is \fBOK\fR. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_inch\fR(3X). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_initscr.3x b/contrib/ncurses/man/curs_initscr.3x new file mode 100644 index 000000000000..a8651fde5d2e --- /dev/null +++ b/contrib/ncurses/man/curs_initscr.3x @@ -0,0 +1,116 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_initscr.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $ +.TH curs_initscr 3X "" +.SH NAME +\fBinitscr\fR, \fBnewterm\fR, \fBendwin\fR, +\fBisendwin\fR, \fBset_term\fR, \fBdelscreen\fR - \fBcurses\fR screen +initialization and manipulation routines +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBWINDOW *initscr(void);\fR +.br +\fBint endwin(void);\fR +.br +\fBint isendwin(void);\fR +.br +\fBSCREEN *newterm(const char *type, FILE *outfd, FILE *infd);\fR +.br +\fBSCREEN *set_term(SCREEN *new);\fR +.br +\fBvoid delscreen(SCREEN* sp);\fR +.br +.SH DESCRIPTION +\fBinitscr\fR is normally the first \fBcurses\fR routine to call when +initializing a program. A few special routines sometimes need to be +called before it; these are \fBslk_init\fR, \fBfilter\fR, \fBripoffline\fR, +\fBuse_env\fR. For multiple-terminal applications, \fBnewterm\fR may be +called before \fBinitscr\fR. + +The initscr code determines the terminal type and initializes all \fBcurses\fR +data structures. \fBinitscr\fR also causes the first call to \fBrefresh\fR to +clear the screen. If errors occur, \fBinitscr\fR writes an appropriate error +message to standard error and exits; otherwise, a pointer is returned to +\fBstdscr\fR. + +A program that outputs to more than one terminal should use the \fBnewterm\fR +routine for each terminal instead of \fBinitscr\fR. A program that needs to +inspect capabilities, so it can continue to run in a line-oriented mode if the +terminal cannot support a screen-oriented program, would also use +\fBnewterm\fR. The routine \fBnewterm\fR should be called once for each +terminal. It returns a variable of type \fBSCREEN *\fR which should be saved +as a reference to that terminal. The arguments are the \fItype\fR of the +terminal to be used in place of \fB$TERM\fR, a file pointer for output to the +terminal, and another file pointer for input from the terminal (if \fItype\fR +is \fBNULL\fR, \fB$TERM\fR will be used). The program must also call +\fBendwin\fR for each terminal being used before exiting from \fBcurses\fR. +If \fBnewterm\fR is called more than once for the same terminal, the first +terminal referred to must be the last one for which \fBendwin\fR is called. + +A program should always call \fBendwin\fR before exiting or escaping from +\fBcurses\fR mode temporarily. This routine restores tty modes, moves the +cursor to the lower left-hand corner of the screen and resets the terminal into +the proper non-visual mode. Calling \fBrefresh\fR or \fBdoupdate\fR after a +temporary escape causes the program to resume visual mode. + +The \fBisendwin\fR routine returns \fBTRUE\fR if \fBendwin\fR has been +called without any subsequent calls to \fBwrefresh\fR, and \fBFALSE\fR +otherwise. + +The \fBset_term\fR routine is used to switch between different +terminals. The screen reference \fBnew\fR becomes the new current +terminal. The previous terminal is returned by the routine. This is +the only routine which manipulates \fBSCREEN\fR pointers; all other +routines affect only the current terminal. + +The \fBdelscreen\fR routine frees storage associated with the +\fBSCREEN\fR data structure. The \fBendwin\fR routine does not do +this, so \fBdelscreen\fR should be called after \fBendwin\fR if a +particular \fBSCREEN\fR is no longer needed. +.SH RETURN VALUE +\fBendwin\fR returns the integer \fBERR\fR upon failure and \fBOK\fR +upon successful completion. + +Routines that return pointers always return \fBNULL\fR on error. +.SH NOTES +Note that \fBinitscr\fR and \fBnewterm\fR may be macros. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4. It +specifies that portable applications must not call \fBinitscr\fR more than +once. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_kernel\fR(3X), \fBcurs_refresh\fR(3X), +\fBcurs_slk\fR(3X), \fBcurs_util\fR(3X) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_inopts.3x b/contrib/ncurses/man/curs_inopts.3x new file mode 100644 index 000000000000..1fc6a820a603 --- /dev/null +++ b/contrib/ncurses/man/curs_inopts.3x @@ -0,0 +1,214 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_inopts.3x,v 1.8 1998/03/11 21:12:53 juergen Exp $ +.TH curs_inopts 3X "" +.SH NAME +\fBcbreak\fR, \fBnocbreak\fR, \fBecho\fR, +\fBnoecho\fR, \fBhalfdelay\fR, \fBintrflush\fR, \fBkeypad\fR, +\fBmeta\fR, \fBnodelay\fR, \fBnotimeout\fR, \fBraw\fR, \fBnoraw\fR, +\fBnoqiflush\fR, \fBqiflush\fR, \fBtimeout\fR, \fBwtimeout\fR, +\fBtypeahead\fR - \fBcurses\fR input options +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBint cbreak(void);\fR +.br +\fBint nocbreak(void);\fR +.br +\fBint echo(void);\fR +.br +\fBint noecho(void);\fR +.br +\fBint halfdelay(int tenths);\fR +.br +\fBint intrflush(WINDOW *win, bool bf);\fR +.br +\fBint keypad(WINDOW *win, bool bf);\fR +.br +\fBint meta(WINDOW *win, bool bf);\fR +.br +\fBint nodelay(WINDOW *win, bool bf);\fR +.br +\fBint raw(void);\fR +.br +\fBint noraw(void);\fR +.br +\fBvoid noqiflush(void);\fR +.br +\fBvoid qiflush(void);\fR +.br +\fBint notimeout(WINDOW *win, bool bf);\fR +.br +\fBvoid timeout(int delay);\fR +.br +\fBvoid wtimeout(WINDOW *win, int delay);\fR +.br +\fBint typeahead(int fd);\fR +.br +.SH DESCRIPTION +Normally, the tty driver buffers typed characters until a newline or carriage +return is typed. The \fBcbreak\fR routine disables line buffering and +erase/kill character-processing (interrupt and flow control characters are +unaffected), making characters typed by the user immediately available to the +program. The \fBnocbreak\fR routine returns the terminal to normal (cooked) +mode. + +Initially the terminal may or may not be in \fBcbreak\fR mode, as the mode is +inherited; therefore, a program should call \fBcbreak\fR or \fBnocbreak\fR +explicitly. Most interactive programs using \fBcurses\fR set the \fBcbreak\fR +mode. Note that \fBcbreak\fR overrides \fBraw\fR. +[See \fBcurs_getch\fR(3X) for a +discussion of how these routines interact with \fBecho\fR and \fBnoecho\fR.] + +The \fBecho\fR and \fBnoecho\fR routines control whether characters typed by +the user are echoed by \fBgetch\fR as they are typed. Echoing by the tty +driver is always disabled, but initially \fBgetch\fR is in echo mode, so +characters typed are echoed. Authors of most interactive programs prefer to do +their own echoing in a controlled area of the screen, or not to echo at all, so +they disable echoing by calling \fBnoecho\fR. +[See \fBcurs_getch\fR(3X) for a +discussion of how these routines interact with \fBcbreak\fR and +\fBnocbreak\fR.] + +The \fBhalfdelay\fR routine is used for half-delay mode, which is similar to +\fBcbreak\fR mode in that characters typed by the user are immediately +available to the program. However, after blocking for \fItenths\fR tenths of +seconds, ERR is returned if nothing has been typed. The value of \fBtenths\fR +must be a number between 1 and 255. Use \fBnocbreak\fR to leave half-delay +mode. + +If the \fBintrflush\fR option is enabled, (\fIbf\fR is \fBTRUE\fR), when an +interrupt key is pressed on the keyboard (interrupt, break, quit) all output in +the tty driver queue will be flushed, giving the effect of faster response to +the interrupt, but causing \fBcurses\fR to have the wrong idea of what is on +the screen. Disabling (\fIbf\fR is \fBFALSE\fR), the option prevents the +flush. The default for the option is inherited from the tty driver settings. +The window argument is ignored. + +The \fBkeypad\fR option enables the keypad of the user's terminal. If +enabled (\fIbf\fR is \fBTRUE\fR), the user can press a function key +(such as an arrow key) and \fBwgetch\fR returns a single value +representing the function key, as in \fBKEY_LEFT\fR. If disabled +(\fIbf\fR is \fBFALSE\fR), \fBcurses\fR does not treat function keys +specially and the program has to interpret the escape sequences +itself. If the keypad in the terminal can be turned on (made to +transmit) and off (made to work locally), turning on this option +causes the terminal keypad to be turned on when \fBwgetch\fR is +called. The default value for keypad is false. + +Initially, whether the terminal returns 7 or 8 significant bits on +input depends on the control mode of the tty driver [see termio(7)]. +To force 8 bits to be returned, invoke \fBmeta\fR(\fIwin\fR, +\fBTRUE\fR); this is equivalent, under POSIX, to setting the CS8 flag +on the terminal. To force 7 bits to be returned, invoke +\fBmeta\fR(\fIwin\fR, \fBFALSE\fR); this is equivalent, under POSIX, +to setting the CS8 flag on the terminal. The window argument, +\fIwin\fR, is always ignored. If the terminfo capabilities \fBsmm\fR +(meta_on) and \fBrmm\fR (meta_off) are defined for the terminal, +\fBsmm\fR is sent to the terminal when \fBmeta\fR(\fIwin\fR, +\fBTRUE\fR) is called and \fBrmm\fR is sent when \fBmeta\fR(\fIwin\fR, +\fBFALSE\fR) is called. + +The \fBnodelay\fR option causes \fBgetch\fR to be a non-blocking call. +If no input is ready, \fBgetch\fR returns \fBERR\fR. If disabled +(\fIbf\fR is \fBFALSE\fR), \fBgetch\fR waits until a key is pressed. + +While interpreting an input escape sequence, \fBwgetch\fR sets a timer +while waiting for the next character. If \fBnotimeout(\fR\fIwin\fR, +\fBTRUE\fR) is called, then \fBwgetch\fR does not set a timer. The +purpose of the timeout is to differentiate between sequences received +from a function key and those typed by a user. + +The \fBraw\fR and \fBnoraw\fR routines place the terminal into or out of raw +mode. Raw mode is similar to \fBcbreak\fR mode, in that characters typed are +immediately passed through to the user program. The differences are that in +raw mode, the interrupt, quit, suspend, and flow control characters are all +passed through uninterpreted, instead of generating a signal. The behavior of +the BREAK key depends on other bits in the tty driver that are not set by +\fBcurses\fR. + +When the \fBnoqiflush\fR routine is used, normal flush of input and +output queues associated with the \fBINTR\fR, \fBQUIT\fR and +\fBSUSP\fR characters will not be done [see termio(7)]. When +\fBqiflush\fR is called, the queues will be flushed when these control +characters are read. You may want to call \fBnoqiflush()\fR in a signal +handler if you want output to continue as though the interrupt +had not occurred, after the handler exits. + +The \fBtimeout\fR and \fBwtimeout\fR routines set blocking or +non-blocking read for a given window. If \fIdelay\fR is negative, +blocking read is used (\fIi\fR.\fIe\fR., waits indefinitely for +input). If \fIdelay\fR is zero, then non-blocking read is used +(\fIi\fR.\fIe\fR., read returns \fBERR\fR if no input is waiting). If +\fIdelay\fR is positive, then read blocks for \fIdelay\fR +milliseconds, and returns \fBERR\fR if there is still no input. +Hence, these routines provide the same functionality as \fBnodelay\fR, +plus the additional capability of being able to block for only +\fIdelay\fR milliseconds (where \fIdelay\fR is positive). + +The \fBcurses\fR library does ``line-breakout optimization'' by looking for +typeahead periodically while updating the screen. If input is found, +and it is coming from a tty, the current update is postponed until +\fBrefresh\fR or \fBdoupdate\fR is called again. This allows faster +response to commands typed in advance. Normally, the input FILE +pointer passed to \fBnewterm\fR, or \fBstdin\fR in the case that +\fBinitscr\fR was used, will be used to do this typeahead checking. +The \fBtypeahead\fR routine specifies that the file descriptor +\fIfd\fR is to be used to check for typeahead instead. If \fIfd\fR is +-1, then no typeahead checking is done. +.SH RETURN VALUE +All routines that return an integer return \fBERR\fR upon failure and OK (SVr4 +specifies only "an integer value other than \fBERR\fR") upon successful +completion, unless otherwise noted in the preceding routine descriptions. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4. + +The ncurses library obeys the XPG4 standard and the historical practice of the +AT&T curses implementations, in that the echo bit is cleared when curses +initializes the terminal state. BSD curses differed from this slightly; it +left the echo bit on at initialization, but the BSD \fBraw\fR call turned it +off as a side-effect. For best portability, set echo or noecho explicitly +just after initialization, even if your program remains in cooked mode. +.SH NOTES +Note that \fBecho\fR, \fBnoecho\fR, \fBhalfdelay\fR, \fBintrflush\fR, +\fBmeta\fR, \fBnodelay\fR, \fBnotimeout\fR, \fBnoqiflush\fR, +\fBqiflush\fR, \fBtimeout\fR, and \fBwtimeout\fR may be macros. + +The \fBnoraw\fR and \fBnocbreak\fR calls follow historical practice in that +they attempt to restore to normal (`cooked') mode from raw and cbreak modes +respectively. Mixing raw/noraw and cbreak/nocbreak calls leads to tty driver +control states that are hard to predict or understand; it is not recommended. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_getch\fR(3X), \fBcurs_initscr\fR(3X), \fBtermio\fR(7) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_insch.3x b/contrib/ncurses/man/curs_insch.3x new file mode 100644 index 000000000000..5c3c3410465e --- /dev/null +++ b/contrib/ncurses/man/curs_insch.3x @@ -0,0 +1,68 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_insch.3x,v 1.6 1998/03/11 21:12:53 juergen Exp $ +.TH curs_insch 3X "" +.SH NAME +\fBinsch\fR, \fBwinsch\fR, \fBmvinsch\fR, \fBmvwinsch\fR - +insert a character before cursor in a \fBcurses\fR window +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBint insch(chtype ch);\fR +.br +\fBint winsch(WINDOW *win, chtype ch);\fR +.br +\fBint mvinsch(int y, int x, chtype ch);\fR +.br +\fBint mvwinsch(WINDOW *win, int y, int x, chtype ch);\fR +.br +.SH DESCRIPTION +These routines, insert the character \fIch\fR before the character under the +cursor. All characters to the right of the cursor are moved one space to the +right, with the possibility of the rightmost character on the line being lost. +The insertion operation does not change the cursor position. +.SH RETURN VALUE +All routines that return an integer return \fBERR\fR upon failure and OK (SVr4 +specifies only "an integer value other than \fBERR\fR") upon successful +completion, unless otherwise noted in the preceding routine descriptions. +.SH NOTES +These routines do not necessarily imply use of a hardware insert character +feature. + +Note that \fBinsch\fR, \fBmvinsch\fR, and \fBmvwinsch\fR may be macros. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4. +.SH SEE ALSO +\fBcurses\fR(3X). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_insstr.3x b/contrib/ncurses/man/curs_insstr.3x new file mode 100644 index 000000000000..955ac8df6397 --- /dev/null +++ b/contrib/ncurses/man/curs_insstr.3x @@ -0,0 +1,90 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_insstr.3x,v 1.10 1998/07/25 20:32:57 Todd.Miller Exp $ +.TH curs_insstr 3X "" +.SH NAME +\fBinsstr\fR, \fBinsnstr\fR, \fBwinsstr\fR, \fBwinsnstr\fR, +\fBmvinsstr\fR, \fBmvinsnstr\fR, \fBmvwinsstr\fR, \fBmvwinsnstr\fR - insert +string before cursor in a \fBcurses\fR window +.SH SYNOPSIS +\fB#include <curses.h>\fR +.br +\fBint insstr(const char *str);\fR +.br +\fBint insnstr(const char *str, int n);\fR +.br +\fBint winsstr(WINDOW *win, const char *str);\fR +.br +\fBint winsnstr(WINDOW *win, const char *str, int n);\fR +.br +\fBint mvinsstr(int y, int x, const char *str);\fR +.br +\fBint mvinsnstr(int y, int x, const char *str, int n);\fR +.br +\fBint mvwinsstr(WINDOW *win, int y, int x, const char *str);\fR +.br +\fBint mvwinsnstr(WINDOW *win, int y, int x, const char *str, int n);\fR +.br +.SH DESCRIPTION +These routines insert a character string (as many characters as will fit on the +line) before the character under the cursor. All characters to the right of +the cursor are shifted right, with the possibility of the rightmost characters +on the line being lost. The cursor position does not change (after moving to +\fIy\fR, \fIx\fR, if specified). The four routines with \fIn\fR as the last +argument insert a leading substring of at most \fIn\fR characters. If +\fIn\fR<=0, then the entire string is inserted. + +If a character in \fIstr\fR is a tab, newline, carriage return or +backspace, the cursor is moved appropriately within the window. A +newline also does a \fBclrtoeol\fR before moving. Tabs are considered +to be at every eighth column. If a character in \fIstr\fR is another +control character, it is drawn in the \fB^\fR\fIX\fR notation. +Calling \fBwinch\fR after adding a control character (and moving to +it, if necessary) does not return the control character, but instead +returns a character in the ^-representation of the control character. +.SH RETURN VALUE +All routines that return an integer return \fBERR\fR upon failure and OK (SVr4 +specifies only "an integer value other than \fBERR\fR") upon successful +completion, unless otherwise noted in the preceding routine descriptions. +.SH NOTES +Note that all but \fBwinsnstr\fR may be macros. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4, which adds +const qualifiers to the arguments. The XSI Curses error conditions +\fBEILSEQ\fR and \fBEILOVERFLOW\fR associated with extended-level conformance +are not yet detected (this implementation does not yet support XPG4 multi-byte +characters). +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_clear\fR(3X), \fBcurs_inch\fR(3X). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/contrib/ncurses/man/curs_instr.3x b/contrib/ncurses/man/curs_instr.3x new file mode 100644 index 000000000000..d3a7e6f7d085 --- /dev/null +++ b/contrib/ncurses/man/curs_instr.3x @@ -0,0 +1,84 @@ +.\"*************************************************************************** +.\" Copyright (c) 1998 Free 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_instr.3x,v 1.8 1998/03/11 21:12:53 juergen Exp $ +.TH curs_instr 3X "" +.SH NAME +\fBinstr\fR, \fBinnstr\fR, \fBwinstr\fR, \fBwinnstr\fR, +\fBmvinstr\fR, \fBmvinnstr\fR, \fBmvwinstr\fR, \fBmvwinnstr\fR - get a string +of characters from a \fBcurses\fR window +.SH SYNOPSIS +\fB#include <curses.h>\fR + +\fBint instr(char *str);\fR +.br +\fBint innstr(char *str, int n);\fR +.br +\fBint winstr(WINDOW *win, char *str);\fR |