From: Thomas E. Dickey Date: Thu, 15 May 1997 04:00:00 +0000 (-0500) Subject: ncurses 4.1 X-Git-Tag: v4.1 X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=3a9b6a3bf0269231bef7de74757a910dedd04e0c;ds=sidebyside ncurses 4.1 --- 3a9b6a3bf0269231bef7de74757a910dedd04e0c diff --git a/ANNOUNCE b/ANNOUNCE new file mode 100644 index 00000000..95ae5be2 --- /dev/null +++ b/ANNOUNCE @@ -0,0 +1,231 @@ + + Announcing ncurses 4.1 + + The ncurses (new curses) library is a freeware emulation of System V + Release 4.0 curses. 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 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: + [1]ftp://ftp.clark.net/pub/dickey/ncurses. and + [2]ftp://ftp.netcom.com/pub/zm/zmbenhal/ncurses. It is also carried on + the GNU distribution site at [3]ftp://prep.ai.mit.edu/pub/gnu. + + Features of ncurses + + The ncurses package is fully compatible with SVr4 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 System V Release 4 panels library, supporting + a stack of windows with backing store, is included. + * An emulation of the System V Release 4 menus library, supporting a + uniform but flexible interface for menu programming, is included. + * An emulation of the System V Release 4 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. + * (PC-clone boxes only) Support for access to the IBM PC ROM + characters 0-32 through the highlight A_ALTCHARSET. + * Support for mouse event reporting under xterm. + * The function wresize() allows you to resize windows, preserving + their data. + * 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: + + ded + directory-editor [4]ftp://ftp.clark.net/pub/dickey/ded. + + dialog + the underlying application used in Slackware's setup, and the + basis for similar applications on Linux. + + lynx-2.7 + the character-screen WWW browser + + 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 (unofficial) newsreader, supporting color, MIME + [5]ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff. + + vile + vi-like-emacs [6]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 maintainer of ncurses is [7]Zeyd Ben-Halim. + Unfortunately, he can only work on the package part time. As a result, + since 1.8.1, much of the enhancement work and documentation has been + done by [8]Eric S. Raymond. The current primary maintainers are + [9]Thomas Dickey and [10]Juergen Pfeifer. + + There is an ncurses mailing list. It is a majordomo list; to join, + write to ncurses-request@mailgate.bsdi.com with a message containing + the line: + + subscribe @ + + 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 [11]ftp://ftp.clark.net/pub/dickey/ncurses. + +Future Plans + + * Extended mouse support via Alessandro Rubini's gpm package. + * 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. + +The terminfo/termcap Database + + The distribution includes and uses a copy of the terminfo-format + terminal description file maintained by Eric Raymond. You can download + either the [12]termcap or [13]terminfo versions of the terminal-type + database from Eric's ncurses page, + [14]http://www.ccil.org/~esr/ncurses.html. + +Other Related Resources + + You can find lots of information on terminal-related topics not + covered in the terminfo file at [15]Richard Shuford's archive. + +References + + 1. ftp://ftp.clark.net/pub/dickey/ncurses + 2. ftp://ftp.netcom.com/pub/zm/zmbenhal/ncurses + 3. ftp://prep.ai.mit.edu/pub/gnu + 4. ftp://ftp.clark.net/pub/dickey/ded + 5. ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff + 6. ftp://ftp.clark.net/pub/dickey/vile + 7. mailto:zmbenhal@netcom.com + 8. http://www.ccil.org/~esr/home.html + 9. mailto:dickey@clark.net + 10. mailto:Juergen.Pfeifer@T-Online.de + 11. ftp://ftp.clark.net/pub/dickey/ncurses + 12. http://www.ccil.org/~esr/terminfo/termtypes.tc.gz + 13. http://www.ccil.org/~esr/terminfo/termtypes.ti.gz + 14. http://www.ccil.org/~esr/ncurses.html + 15. http://www.cs.utk.edu/~shuford/terminal_index.html diff --git a/Ada95/Makefile.in b/Ada95/Makefile.in new file mode 100644 index 00000000..f4f6a816 --- /dev/null +++ b/Ada95/Makefile.in @@ -0,0 +1,56 @@ +#---------------------------------------------------------------------------- +# -- +# GNAT ncurses Binding -- +# Makefile -- +# -- +# Version 00.92 -- +# -- +# The ncurses Ada95 binding is copyrighted 1996 by -- +# Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +# -- +# Permission is hereby granted to reproduce and distribute this -- +# binding by any means and for any fee, whether alone or as part -- +# of a larger distribution, in source or in binary form, PROVIDED -- +# this notice is included with any such distribution, and is not -- +# removed from any of its header files. Mention of ncurses and the -- +# author of this binding in any applications linked with it is -- +# highly appreciated. -- +# -- +# This binding comes AS IS with no warranty, implied or expressed. -- +#---------------------------------------------------------------------------- +# Version Control +# $Revision: 1.3 $ +# +SHELL = /bin/sh +THIS = Makefile + +SUBDIRS = @ADA_SUBDIRS@ + +all :: + for d in $(SUBDIRS); do \ + (cd $$d ; $(MAKE) $@) ;\ + done + +clean :: + for d in $(SUBDIRS); do \ + (cd $$d ; $(MAKE) $@) ;\ + done + +distclean :: + for d in $(SUBDIRS); do \ + (cd $$d ; $(MAKE) $@) ;\ + done + rm -f Makefile + +realclean :: + for d in $(SUBDIRS); do \ + (cd $$d ; $(MAKE) $@) ;\ + done + rm -f Makefile + +mostlyclean :: + for d in $(SUBDIRS); do \ + (cd $$d ; $(MAKE) $@) ;\ + done + +install :: diff --git a/Ada95/README b/Ada95/README new file mode 100644 index 00000000..6a5362df --- /dev/null +++ b/Ada95/README @@ -0,0 +1,29 @@ +The ncurses Ada95 binding is copyrighted 1996 by Juergen Pfeifer +Email: Juergen.Pfeifer@T-Online.de + +Permission is hereby granted to reproduce and distribute this +binding by any means and for any fee, whether alone or as part +of a larger distribution, in source or in binary form, PROVIDED +this notice is included with any such distribution, and is not +removed from any of its header files. Mention of ncurses and the +author of this binding in any applications linked with it is +highly appreciated. + +This binding comes AS IS with no warranty, implied or expressed. +---------------------------------------------------------------------- +Caveats: + + This is the first delivery of this binding. It has not been + extensively tested. So I declare this as BETA level software, + although it is delivered with an official release of ncurses. + + You should install the ncurses distribution around this binding + first before you try to run the sample. + + This Binding is currently strictly for the GNAT compiler, because + in one place I use a GNAT specfic runtime module (see doc.) + + +The documentation is provided in HTML format in the ./html +subdirectory. The main document is named index.html + diff --git a/Ada95/TODO b/Ada95/TODO new file mode 100644 index 00000000..8516d227 --- /dev/null +++ b/Ada95/TODO @@ -0,0 +1,25 @@ +-- Intensive testing + Perhaps the delivery of the Beta will help a bit. + +-- Documentation + Like most WEB pages: under continous construction + +-- Style cleanup + +-- Alternate functions for procedures with out params + Comfort purpose + +-- Sample program + Under continous construction (and it's not a WEB page!!!) + +-- Make the binding objects a shared libray + They are rather large, so it would make sense, otherwise Ada95 + would look too large, although the generated code is as compact + as C or C++. I'll wait a bit until the GNAT people provide some + better support to construct shared libraries. + +-- Think about more inlining + +-- Check for memory leaks. + Oh I would like it so much if the GNAT guys would put an optional + GC into their system. diff --git a/Ada95/ada_include/Makefile.in b/Ada95/ada_include/Makefile.in new file mode 100644 index 00000000..7cb92304 --- /dev/null +++ b/Ada95/ada_include/Makefile.in @@ -0,0 +1,207 @@ +#---------------------------------------------------------------------------- +# -- +# GNAT ncurses Binding -- +# src/Makefile -- +# -- +# Version 00.92 -- +# -- +# The ncurses Ada95 binding is copyrighted 1996 by -- +# Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +# -- +# Permission is hereby granted to reproduce and distribute this -- +# binding by any means and for any fee, whether alone or as part -- +# of a larger distribution, in source or in binary form, PROVIDED -- +# this notice is included with any such distribution, and is not -- +# removed from any of its header files. Mention of ncurses and the -- +# author of this binding in any applications linked with it is -- +# highly appreciated. -- +# -- +# This binding comes AS IS with no warranty, implied or expressed. -- +#---------------------------------------------------------------------------- +# Version Control +# $Revision: 1.6 $ +# +.SUFFIXES: + +SHELL = /bin/sh +THIS = Makefile + +MODEL = ../../@DFT_OBJ_SUBDIR@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ +datadir = @datadir@ +ticdir = $(datadir)/terminfo + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +AWK = @AWK@ +LN_S = @LN_S@ + +CC = @CC@ +CFLAGS = @CFLAGS@ + +CPPFLAGS = @ACPPFLAGS@ \ + -DHAVE_CONFIG_H -I$(srcdir) + +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@ + +RANLIB = @RANLIB@ +################################################################################ +ADA = @nc_ada_compiler@ +ADAFLAGS = @ADAFLAGS@ -I. -I$(srcdir) + +ADAMAKE = @nc_ada_make@ +ADAMAKEFLAGS = + +CARGS = -cargs $(ADAFLAGS) +LARGS = + +ALIB = @nc_ada_package@ +ABASE = $(ALIB)-curses + +ADA_OBJDIR = ../ada_objects +OBJDIR = ../objects + +LIBALIS=$(ADA_OBJDIR)/$(ALIB).ali \ + $(ADA_OBJDIR)/$(ABASE)-aux.ali \ + $(ADA_OBJDIR)/$(ABASE).ali \ + $(ADA_OBJDIR)/$(ABASE)-mouse.ali \ + $(ADA_OBJDIR)/$(ABASE)-panels.ali \ + $(ADA_OBJDIR)/$(ABASE)-menus.ali \ + $(ADA_OBJDIR)/$(ABASE)-forms.ali \ + $(ADA_OBJDIR)/$(ABASE)-text_io.ali \ + $(ADA_OBJDIR)/$(ABASE)-text_io-aux.ali + +LIBOBJS=$(ADA_OBJDIR)/$(ALIB).o \ + $(ADA_OBJDIR)/$(ABASE)-aux.o \ + $(ADA_OBJDIR)/$(ABASE).o \ + $(ADA_OBJDIR)/$(ABASE)-mouse.o \ + $(ADA_OBJDIR)/$(ABASE)-panels.o \ + $(ADA_OBJDIR)/$(ABASE)-menus.o \ + $(ADA_OBJDIR)/$(ABASE)-forms.o \ + $(ADA_OBJDIR)/$(ABASE)-text_io.o \ + $(ADA_OBJDIR)/$(ABASE)-text_io-aux.o + + +all :: $(LIBALIS) + @echo done + +clean :: + rm -f *.o *.ali b_t*.* *.s $(PROGS) a.out core b_*_test.c *.xr[bs] *.a + +mostlyclean :: clean + rm -f $(LIBALIS) $(LIBOBJS) + +distclean :: mostlyclean + rm -f Makefile + +realclean :: distclean + +BASEDEPS=$(ABASE).ads $(srcdir)/$(ABASE)-aux.ads + +$(ADA_OBJDIR)/$(ALIB).o: $(srcdir)/$(ALIB).ads + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ALIB).ads + +$(ADA_OBJDIR)/$(ALIB).ali: $(ADA_OBJDIR)/$(ALIB).o + if [ -f $(ALIB).ali ]; then \ + ln -f $(ALIB).ali $@ ;\ + rm -f $(ALIB).ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-aux.o: $(srcdir)/$(ABASE)-aux.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-aux.adb + +$(ADA_OBJDIR)/$(ABASE)-aux.ali: $(ADA_OBJDIR)/$(ABASE)-aux.o + if [ -f $(ABASE)-aux.ali ]; then \ + ln -f $(ABASE)-aux.ali $@ ;\ + rm -f $(ABASE)-aux.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE).o: $(srcdir)/$(ABASE).adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE).adb + +$(ADA_OBJDIR)/$(ABASE).ali: $(ADA_OBJDIR)/$(ABASE).o + if [ -f $(ABASE).ali ]; then \ + ln -f $(ABASE).ali $@ ;\ + rm -f $(ABASE).ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-mouse.o: \ + $(ABASE)-mouse.ads \ + $(srcdir)/$(ABASE)-mouse.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-mouse.adb + +$(ADA_OBJDIR)/$(ABASE)-mouse.ali: $(ADA_OBJDIR)/$(ABASE)-mouse.o + if [ -f $(ABASE)-mouse.ali ]; then \ + ln -f $(ABASE)-mouse.ali $@ ;\ + rm -f $(ABASE)-mouse.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-panels.o: \ + $(ABASE)-panels.ads \ + $(srcdir)/$(ABASE)-panels.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-panels.adb + +$(ADA_OBJDIR)/$(ABASE)-panels.ali: $(ADA_OBJDIR)/$(ABASE)-panels.o + if [ -f $(ABASE)-panels.ali ]; then \ + ln -f $(ABASE)-panels.ali $@ ;\ + rm -f $(ABASE)-panels.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-menus.o: \ + $(ABASE)-menus.ads \ + $(srcdir)/$(ABASE)-menus.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-menus.adb + +$(ADA_OBJDIR)/$(ABASE)-menus.ali: $(ADA_OBJDIR)/$(ABASE)-menus.o + if [ -f $(ABASE)-menus.ali ]; then \ + ln -f $(ABASE)-menus.ali $@ ;\ + rm -f $(ABASE)-menus.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-forms.o: \ + $(ABASE)-forms.ads \ + $(srcdir)/$(ABASE)-forms.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-forms.adb + +$(ADA_OBJDIR)/$(ABASE)-forms.ali: $(ADA_OBJDIR)/$(ABASE)-forms.o + if [ -f $(ABASE)-forms.ali ]; then \ + ln -f $(ABASE)-forms.ali $@ ;\ + rm -f $(ABASE)-forms.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-text_io.o: \ + $(srcdir)/$(ABASE)-text_io.ads \ + $(srcdir)/$(ABASE)-text_io.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io.adb + +$(ADA_OBJDIR)/$(ABASE)-text_io.ali: $(ADA_OBJDIR)/$(ABASE)-text_io.o + if [ -f $(ABASE)-text_io.ali ]; then \ + ln -f $(ABASE)-text_io.ali $@ ;\ + rm -f $(ABASE)-text_io.ali ;\ + fi + +$(ADA_OBJDIR)/$(ABASE)-text_io-aux.o: \ + $(srcdir)/$(ABASE)-text_io-aux.ads \ + $(srcdir)/$(ABASE)-text_io-aux.adb $(BASEDEPS) + $(ADA) $(ADAFLAGS) -c -o $@ $(srcdir)/$(ABASE)-text_io-aux.adb + +$(ADA_OBJDIR)/$(ABASE)-text_io-aux.ali: $(ADA_OBJDIR)/$(ABASE)-text_io-aux.o + if [ -f $(ABASE)-text_io-aux.ali ]; then \ + ln -f $(ABASE)-text_io-aux.ali $@ ;\ + rm -f $(ABASE)-text_io-aux.ali ;\ + fi diff --git a/Ada95/ada_include/terminal_interface-curses-aux.adb b/Ada95/ada_include/terminal_interface-curses-aux.adb new file mode 100644 index 00000000..e6fac3b9 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-aux.adb @@ -0,0 +1,81 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Aux -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +package body Terminal_Interface.Curses.Aux is + -- + -- Some helpers + procedure Fill_String (Cp : in chars_ptr; + Str : out String) + is + -- Fill the string with the characters referenced by the + -- chars_ptr. + -- + Len : Natural; + begin + if Cp /= Null_Ptr then + Len := Natural (Strlen (Cp)); + if Str'Length < Len then + raise Constraint_Error; + end if; + declare + S : String (1 .. Len); + begin + S := Value (Cp); + Str (Str'First .. (Str'First + Len - 1)) := S (S'Range); + end; + else + Len := 0; + end if; + + if Len < Str'Length then + Str ((Str'First + Len) .. Str'Last) := (others => ' '); + end if; + + end Fill_String; + + procedure Eti_Exception (Code : Eti_Error) + is + begin + case Code is + when E_Ok => null; + when E_System_Error => raise Eti_System_Error; + when E_Bad_Argument => raise Eti_Bad_Argument; + when E_Posted => raise Eti_Posted; + when E_Connected => raise Eti_Connected; + when E_Bad_State => raise Eti_Bad_State; + when E_No_Room => raise Eti_No_Room; + when E_Not_Posted => raise Eti_Not_Posted; + when E_Unknown_Command => raise Eti_Unknown_Command; + when E_No_Match => raise Eti_No_Match; + when E_Not_Selectable => raise Eti_Not_Selectable; + when E_Not_Connected => raise Eti_Not_Connected; + when E_Request_Denied => raise Eti_Request_Denied; + when E_Invalid_Field => raise Eti_Invalid_Field; + when E_Current => raise Eti_Current; + end case; + end Eti_Exception; + +end Terminal_Interface.Curses.Aux; diff --git a/Ada95/ada_include/terminal_interface-curses-aux.ads b/Ada95/ada_include/terminal_interface-curses-aux.ads new file mode 100644 index 00000000..834ad7dc --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-aux.ads @@ -0,0 +1,90 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Aux -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +with System; +with Interfaces.C; +with Interfaces.C.Strings; use Interfaces.C.Strings; +with Unchecked_Conversion; + +package Terminal_Interface.Curses.Aux is + + use type Interfaces.C.Int; + + subtype C_Int is Interfaces.C.Int; + subtype C_Short is Interfaces.C.Short; + subtype C_Long_Int is Interfaces.C.Long; + subtype C_Size_T is Interfaces.C.Size_T; + subtype C_Char_Ptr is Interfaces.C.Strings.Chars_Ptr; + type C_Void_Ptr is new System.Address; + + -- This is how those constants are defined in ncurses. I see them also + -- exactly like this in all ETI implementations I ever tested. So it + -- could be that this is quite general, but please check with your curses. + -- This is critical, because curses sometime mixes boolean returns with + -- returning an error status. + Curses_Ok : constant C_Int := 0; + Curses_Err : constant C_Int := -1; + + Curses_True : constant C_Int := 1; + Curses_False : constant C_Int := 0; + + subtype Eti_Error is C_Int range -14 .. 0; + -- Type for error codes returned by the menu and forms subsystem + + E_Ok : constant Eti_Error := 0; + E_System_Error : constant Eti_Error := -1; + E_Bad_Argument : constant Eti_Error := -2; + E_Posted : constant Eti_Error := -3; + E_Connected : constant Eti_Error := -4; + E_Bad_State : constant Eti_Error := -5; + E_No_Room : constant Eti_Error := -6; + E_Not_Posted : constant Eti_Error := -7; + E_Unknown_Command : constant Eti_Error := -8; + E_No_Match : constant Eti_Error := -9; + E_Not_Selectable : constant Eti_Error := -10; + E_Not_Connected : constant Eti_Error := -11; + E_Request_Denied : constant Eti_Error := -12; + E_Invalid_Field : constant Eti_Error := -13; + E_Current : constant Eti_Error := -14; + + procedure Eti_Exception (Code : Eti_Error); + -- Dispatch the error code and raise the appropriate exception + -- + -- + -- Some helpers + function CInt_To_Chtype is new + Unchecked_Conversion (Source => C_Int, + Target => Attributed_Character); + function Chtype_To_CInt is new + Unchecked_Conversion (Source => Attributed_Character, + Target => C_Int); + + procedure Fill_String (Cp : in chars_ptr; + Str : out String); + -- Fill the Str parameter with the string denoted by the chars_ptr + -- C-Style string. + +end Terminal_Interface.Curses.Aux; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.adb b/Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.adb new file mode 100644 index 00000000..396287ec --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.adb @@ -0,0 +1,88 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Choice_Field_Types -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.5 $ +------------------------------------------------------------------------------ +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Terminal_Interface.Curses.Forms.Field_Types; + +-- | +-- |===================================================================== +-- | man page form_fieldtype.3x +-- |===================================================================== +-- | +package body Terminal_Interface.Curses.Forms.Choice_Field_Types is + + use type Interfaces.C.int; + + package Ft is new Terminal_Interface.Curses.Forms.Field_Types + (User, User_Access, Field_Check, Character_Check); + + type N_Check is access + function (Fld : Field; Info : User_Access) return Boolean; + pragma Convention (C, N_Check); + + type P_Check is access + function (Fld : Field; Info : User_Access) return Boolean; + pragma Convention (C, P_Check); + + function Nc (Fld : Field; Info : User_Access) return Boolean; + pragma Convention (C, Nc); + + function Pc (Fld : Field; Info : User_Access) return Boolean; + pragma Convention (C, Pc); + + function Nc (Fld : Field; Info : User_Access) return Boolean + is + begin + return Next_Choice (Fld, Info); + end Nc; + + function Pc (Fld : Field; Info : User_Access) return Boolean + is + begin + return Prev_Choice (Fld, Info); + end Pc; + -- | + -- | + -- | + function Set_Choice (Ft : C_Field_Type; + Nc : N_Check; + Pc : P_Check) return C_Int; + pragma Import (C, Set_Choice, "set_fieldtype_choice"); + + procedure Define_Choices + is + R : Eti_Error; + begin + R := Set_Choice (Search_Type (User'Tag), Nc'Access, Pc'Access); + if (R /= E_OK) then + Eti_Exception (R); + end if; + end Define_Choices; + +begin + Define_Choices; +end Terminal_Interface.Curses.Forms.Choice_Field_Types; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.ads b/Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.ads new file mode 100644 index 00000000..24a9375f --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.ads @@ -0,0 +1,46 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Choice_Field_Types -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.6 $ +------------------------------------------------------------------------------ +-- You must instantiate this package for any user defined field type +-- to make it visible to the runtime. +-- +generic + type User is new Ada_Defined_Field_Type with private; + type User_Access is access User; + with function Field_Check (Fld : Field; + Info : User_Access) return Boolean; + with function Character_Check (Ch : Character; + Info : User_Access) return Boolean; + with function Next_Choice (Fld : Field; + Info : User_Access) return Boolean; + with function Prev_Choice (Fld : Field; + Info : User_Access) return Boolean; +package Terminal_Interface.Curses.Forms.Choice_Field_Types is +-- +-- Nothing public. +-- But we need the body. + pragma Elaborate_Body; +end Terminal_Interface.Curses.Forms.Choice_Field_Types; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types.adb b/Ada95/ada_include/terminal_interface-curses-forms-field_types.adb new file mode 100644 index 00000000..13d2885f --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types.adb @@ -0,0 +1,182 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Unchecked_Deallocation; + +-- | +-- |===================================================================== +-- | man page form_fieldtype.3x +-- |===================================================================== +-- | +package body Terminal_Interface.Curses.Forms.Field_Types is + + use type Interfaces.C.int; + + type F_Check is access + function (Fld : Field; Info : User_Access) return C_Int; + pragma Convention (C, F_Check); + + type C_Check is access + function (Ch : Character; Info : User_Access) return C_Int; + pragma Convention (C, C_Check); + + procedure Free is new + Unchecked_Deallocation (User, User_Access); + + -- Forward decls. + procedure Register_Field_Type; + procedure Unregister_Field_Type; + + procedure Initialize (Obj : in out Tracker) + is + begin + Register_Field_Type; + end Initialize; + + procedure Finalize (Obj : in out Tracker) + is + begin + Unregister_Field_Type; + end Finalize; + + function Fc (Fld : Field; Info : User_Access) return C_Int; + pragma Convention (C, Fc); + + function Cc (Ch : Character; Info : User_Access) return C_Int; + pragma Convention (C, Cc); + + function Make_Arg (U : User_Access) return User_Access; + pragma Convention (C, Make_Arg); + + function Copy_Arg (U : User_Access) return User_Access; + pragma Convention (C, Copy_Arg); + + procedure Free_Arg (U : User_Access); + pragma Convention (C, Free_Arg); + + function New_Fieldtype (Fc : F_Check; + Cc : C_Check) return C_Field_Type; + pragma Import (C, New_Fieldtype, "new_fieldtype"); + + function Fc (Fld : Field; Info : User_Access) return C_Int + is + begin + return C_Int (Boolean'Pos (Field_Check (Fld, Info))); + end Fc; + + function Cc (Ch : Character; Info : User_Access) return C_Int + is + begin + return C_Int (Boolean'Pos (Character_Check (Ch, Info))); + end Cc; + + function Make_Arg (U : User_Access) return User_Access + is + function Fixme (U : User_Access) return User_Access; + pragma Import (C, Fixme, "_nc_ada_getvarg"); + V : constant User_Access := Fixme (U); + I : constant User_Access := new User'(V.all); + begin + return I; + end Make_Arg; + + function Copy_Arg (U : User_Access) return User_Access + is + I : constant User_Access := new User'(U.all); + begin + return I; + end Copy_Arg; + + procedure Free_Arg (U : User_Access) + is + begin + null; + end Free_Arg; + + type M_Arg is access function (U : User_Access) return User_Access; + pragma Convention (C, M_Arg); + + type C_Arg is access function (U : User_Access) return User_Access; + pragma Convention (C, C_Arg); + + type F_Arg is access procedure (U : User_Access); + pragma Convention (C, F_Arg); + + function Set_Fieldtype_Arg (Typ : C_Field_Type; + Ma : M_Arg; + Ca : C_Arg; + Fa : F_Arg) return C_Int; + pragma Import (C, Set_Fieldtype_Arg, "set_fieldtype_arg"); + -- | + -- | + -- | + + procedure Register_Field_Type + is + Res : Eti_Error; + Cft : C_Field_Type; + P : User_Access := new User; + -- we need an instance to call + -- the Register_Type procedure + begin + Cft := New_Fieldtype (Fc'Access, + Cc'Access); + if Cft = Null_Field_Type then + raise Form_Exception; + end if; + Res := Set_Fieldtype_Arg (Cft, + Make_Arg'Access, + Copy_Arg'Access, + Free_Arg'Access); + if Res /= E_Ok then + Eti_Exception (Res); + end if; + + Register_Type (P.all, Cft); + Free (P); + end Register_Field_Type; + -- | + -- | + -- | + procedure Unregister_Field_Type + is + P : User_Access := new User; + -- we need an instance to call + -- the Unregister_Type procedure + begin + Unregister_Type (P.all); + Free (P); + end Unregister_Field_Type; + + Hook : Tracker; +end Terminal_Interface.Curses.Forms.Field_Types; + + + + + diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_types.ads b/Ada95/ada_include/terminal_interface-curses-forms-field_types.ads new file mode 100644 index 00000000..70589948 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_types.ads @@ -0,0 +1,50 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_Types -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Ada.Finalization; use Ada.Finalization; + +-- You must instantiate this package for any user defined field type +-- to make it visible to the runtime. +-- +generic + type User is new Ada_Defined_Field_Type with private; + type User_Access is access User; + with function Field_Check (Fld : Field; + Info : User_Access) return Boolean; + with function Character_Check (Ch : Character; + Info : User_Access) return Boolean; +package Terminal_Interface.Curses.Forms.Field_Types is +-- +-- Nothing public. All happens magically. +-- +private + type Tracker is new Limited_Controlled with null record; + + procedure Initialize (Obj : in out Tracker); + procedure Finalize (Obj : in out Tracker); + +end Terminal_Interface.Curses.Forms.Field_Types; + diff --git a/Ada95/ada_include/terminal_interface-curses-forms-field_user_data.adb b/Ada95/ada_include/terminal_interface-curses-forms-field_user_data.adb new file mode 100644 index 00000000..dd8aba56 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-field_user_data.adb @@ -0,0 +1,81 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_User_Data -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Unchecked_Conversion; +with Terminal_Interface.Curses.Aux; +use Terminal_Interface.Curses.Aux; + +-- | +-- |===================================================================== +-- | man page form_field_userptr.3x +-- |===================================================================== +-- | +package body Terminal_Interface.Curses.Forms.Field_User_Data is + + function To_Address is new Unchecked_Conversion (User_Access, + System.Address); + function To_Pointer is new Unchecked_Conversion (System.Address, + User_Access); + -- | + -- | + -- | + procedure Set_User_Data (Fld : in Field; + Data : in User_Access) + is + A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); + B : Field_User_Wrapper_Access; + R : C_Int; + begin + if A = null then + raise Form_Exception; + else + if A.N > 1 then + B := new Field_User_Wrapper'(T => A.T, + N => 1, + U => To_Address (Data)); + R := Set_Field_Userptr (Fld, B); + A.N := A.N - 1; + else + A.U := To_Address (Data); + end if; + end if; + end Set_User_Data; + -- | + -- | + -- | + procedure Get_User_Data (Fld : in Field; + Data : out User_Access) + is + A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); + begin + if A = null then + raise Form_Exception; + else + Data := To_Pointer (A.U); + end if; + end Get_User_Data; + +end Terminal_Interface.Curses.Forms.Field_User_Data; diff --git a/Ada95/ada_include/terminal_interface-curses-forms-form_user_data.adb b/Ada95/ada_include/terminal_interface-curses-forms-form_user_data.adb new file mode 100644 index 00000000..9022a044 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms-form_user_data.adb @@ -0,0 +1,68 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Form_User_Data -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Unchecked_Conversion; +-- | +-- |===================================================================== +-- | man page form__userptr.3x +-- |===================================================================== +-- | +package body Terminal_Interface.Curses.Forms.Form_User_Data is + + function To_Address is new Unchecked_Conversion (User_Access, + System.Address); + function To_Pointer is new Unchecked_Conversion (System.Address, + User_Access); + -- | + -- | + -- | + procedure Set_User_Data (Frm : in Form; + Data : in User_Access) + is + A : constant Form_User_Wrapper_Access := Form_Userptr (Frm); + begin + if A = null then + raise Form_Exception; + else + A.U := To_Address (Data); + end if; + end Set_User_Data; + -- | + -- | + -- | + procedure Get_User_Data (Frm : in Form; + Data : out User_Access) + is + A : constant Form_User_Wrapper_Access := Form_Userptr (Frm); + begin + if A = null then + raise Form_Exception; + else + Data := To_Pointer (A.U); + end if; + end Get_User_Data; + +end Terminal_Interface.Curses.Forms.Form_User_Data; diff --git a/Ada95/ada_include/terminal_interface-curses-forms.adb b/Ada95/ada_include/terminal_interface-curses-forms.adb new file mode 100644 index 00000000..059ae238 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-forms.adb @@ -0,0 +1,1693 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.9 $ +------------------------------------------------------------------------------ +with Ada.Tags; use Ada.Tags; +with Ada.Unchecked_Deallocation; +with Unchecked_Conversion; + +with Interfaces.C; use Interfaces.C; +with Interfaces.C.Strings; use Interfaces.C.Strings; + +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with GNAT.Htable; + +package body Terminal_Interface.Curses.Forms is + +------------------------------------------------------------------------------ + -- | + -- | + -- | + -- subtype chars_ptr is Interfaces.C.Strings.chars_ptr; + + function FOS_2_CInt is new + Unchecked_Conversion (Field_Option_Set, + C_Int); + + function CInt_2_FOS is new + Unchecked_Conversion (C_Int, + Field_Option_Set); + + function FrmOS_2_CInt is new + Unchecked_Conversion (Form_Option_Set, + C_Int); + + function CInt_2_FrmOS is new + Unchecked_Conversion (C_Int, + Form_Option_Set); + + procedure Request_Name (Key : in Form_Request_Code; + Name : out String) + is + function Form_Request_Name (Key : C_Int) return chars_ptr; + pragma Import (C, Form_Request_Name, "form_request_name"); + begin + Fill_String (Form_Request_Name (C_Int (Key)), Name); + end Request_Name; +------------------------------------------------------------------------------ + procedure Free_Field_User_Wrapper is + new Ada.Unchecked_Deallocation (Field_User_Wrapper, + Field_User_Wrapper_Access); + + procedure Release_User_Wrapper (A : in out Field_User_Wrapper_Access); + procedure Dup_User_Wrapper (A : in out Field_User_Wrapper_Access); + + procedure Release_User_Wrapper (A : in out Field_User_Wrapper_Access) + is + begin + A.N := A.N - 1; + if A.N = 0 then + Free_Field_User_Wrapper (A); + end if; + end Release_User_Wrapper; + pragma Inline (Release_User_Wrapper); + + procedure Dup_User_Wrapper (A : in out Field_User_Wrapper_Access) + is + begin + A.N := A.N + 1; + end Dup_User_Wrapper; + pragma Inline (Dup_User_Wrapper); +------------------------------------------------------------------------------ + procedure Free_Form_User_Wrapper is + new Ada.Unchecked_Deallocation (Form_User_Wrapper, + Form_User_Wrapper_Access); + -- | + -- | + -- | + -- | + -- |===================================================================== + -- | man page form_field_new.3x + -- |===================================================================== + -- | + -- | + -- | + function Create (Height : Line_Count; + Width : Column_Count; + Top : Line_Position; + Left : Column_Position; + Off_Screen : Natural := 0; + More_Buffers : Buffer_Number := Buffer_Number'First) + return Field + is + function Newfield (H, W, T, L, O, M : C_Int) return Field; + pragma Import (C, Newfield, "new_field"); + Fld : constant Field := Newfield (C_Int (Height), C_Int (Width), + C_Int (Top), C_Int (Left), + C_Int (Off_Screen), + C_Int (More_Buffers)); + + A : Field_User_Wrapper_Access; + Res : Eti_Error; + begin + if Fld = Null_Field then + raise Form_Exception; + else + A := new Field_User_Wrapper'(U => System.Null_Address, + T => null, + N => 1); + Res := Set_Field_Userptr (Fld, A); + if Res /= E_Ok then + Free_Field_User_Wrapper (A); + Eti_Exception (Res); + end if; + end if; + return Fld; + end Create; +-- | +-- | +-- | + procedure Delete (Fld : in out Field) + is + function Free_Field (Fld : Field) return C_Int; + pragma Import (C, Free_Field, "free_field"); + procedure Free_Field_Type is + new Ada.Unchecked_Deallocation (Field_Type'Class, + Field_Type_Access); + + A : Field_User_Wrapper_Access := Field_Userptr (Fld); + Res : Eti_Error; + begin + if A /= null then + if A.T /= null then + Free_Field_Type (A.T); + end if; + Release_User_Wrapper (A); + end if; + Res := Free_Field (Fld); + if Res /= E_Ok then + Eti_Exception (Res); + end if; + Fld := Null_Field; + end Delete; + -- | + -- | + -- | + function Duplicate (Fld : Field; + Top : Line_Position; + Left : Column_Position) return Field + is + function Dup_Field (Fld : Field; + Top : C_Int; + Left : C_Int) return Field; + pragma Import (C, Dup_Field, "dup_field"); + + A : Field_User_Wrapper_Access := Field_Userptr (Fld); + F : constant Field := Dup_Field (Fld, + C_Int (Top), + C_Int (Left)); + begin + if F = Null_Field then + raise Form_Exception; + else + Dup_User_Wrapper (A); + end if; + return F; + end Duplicate; + -- | + -- | + -- | + function Link (Fld : Field; + Top : Line_Position; + Left : Column_Position) return Field + is + function Lnk_Field (Fld : Field; + Top : C_Int; + Left : C_Int) return Field; + pragma Import (C, Lnk_Field, "link_field"); + + A : Field_User_Wrapper_Access := Field_Userptr (Fld); + F : constant Field := Lnk_Field (Fld, + C_Int (Top), + C_Int (Left)); + begin + if F = Null_Field then + raise Form_Exception; + else + Dup_User_Wrapper (A); + end if; + return F; + end Link; + -- | + -- |===================================================================== + -- | man page form_field_just.3x + -- |===================================================================== + -- | + -- | + -- | + procedure Set_Justification (Fld : in Field; + Just : in Field_Justification := None) + is + function Set_Field_Just (Fld : Field; + Just : C_Int) return C_Int; + pragma Import (C, Set_Field_Just, "set_field_just"); + + Res : constant Eti_Error := + Set_Field_Just (Fld, + C_Int (Field_Justification'Pos (Just))); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Justification; + -- | + -- | + -- | + function Get_Justification (Fld : Field) return Field_Justification + is + function Field_Just (Fld : Field) return C_Int; + pragma Import (C, Field_Just, "field_just"); + begin + return Field_Justification'Val (Field_Just (Fld)); + end Get_Justification; + -- | + -- |===================================================================== + -- | man page form_field_buffer.3x + -- |===================================================================== + -- | + -- | + -- | + procedure Set_Buffer + (Fld : in Field; + Buffer : in Buffer_Number := Buffer_Number'First; + Str : in String) + is + type Char_Ptr is access all Interfaces.C.Char; + function Set_Fld_Buffer (Fld : Field; + Bufnum : C_Int; + S : Char_Ptr) + return C_Int; + pragma Import (C, Set_Fld_Buffer, "set_field_buffer"); + + Txt : char_array (0 .. Str'Length); + Len : size_t; + Res : Eti_Error; + begin + To_C (Str, Txt, Len); + Res := Set_Fld_Buffer (Fld, C_Int (Buffer), Txt (Txt'First)'Access); + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Buffer; + -- | + -- | + -- | + procedure Get_Buffer + (Fld : in Field; + Buffer : in Buffer_Number := Buffer_Number'First; + Str : out String) + is + function Field_Buffer (Fld : Field; + B : C_Int) return chars_ptr; + pragma Import (C, Field_Buffer, "field_buffer"); + begin + Fill_String (Field_Buffer (Fld, C_Int (Buffer)), Str); + end Get_Buffer; + -- | + -- | + -- | + procedure Set_Status (Fld : in Field; + Status : in Boolean := True) + is + function Set_Fld_Status (Fld : Field; + St : C_Int) return C_Int; + pragma Import (C, Set_Fld_Status, "set_field_status"); + + Res : constant Eti_Error := Set_Fld_Status (Fld, Boolean'Pos (Status)); + begin + if Res /= E_Ok then + raise Form_Exception; + end if; + end Set_Status; + -- | + -- | + -- | + function Changed (Fld : Field) return Boolean + is + function Field_Status (Fld : Field) return C_Int; + pragma Import (C, Field_Status, "field_status"); + + Res : constant C_Int := Field_Status (Fld); + begin + if Res = Curses_False then + return False; + else + return True; + end if; + end Changed; + -- | + -- | + -- | + procedure Set_Maximum_Size (Fld : in Field; + Max : in Natural := 0) + is + function Set_Field_Max (Fld : Field; + M : C_Int) return C_Int; + pragma Import (C, Set_Field_Max, "set_max_field"); + + Res : constant Eti_Error := Set_Field_Max (Fld, C_Int (Max)); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Maximum_Size; + -- | + -- |===================================================================== + -- | man page form_field_opts.3x + -- |===================================================================== + -- | + -- | + -- | + procedure Normalize_Field_Options (Options : in out C_Int); + pragma Import (C, Normalize_Field_Options, "_nc_ada_normalize_field_opts"); + + procedure Set_Options (Fld : in Field; + Options : in Field_Option_Set) + is + function Set_Field_Opts (Fld : Field; + Opt : C_Int) return C_Int; + pragma Import (C, Set_Field_Opts, "set_field_opts"); + + Opt : C_Int := FOS_2_CInt (Options); + Res : Eti_Error; + begin + Normalize_Field_Options (Opt); + Res := Set_Field_Opts (Fld, Opt); + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Options; + -- | + -- | + -- | + procedure Switch_Options (Fld : in Field; + Options : in Field_Option_Set; + On : Boolean := True) + is + function Field_Opts_On (Fld : Field; + Opt : C_Int) return C_Int; + pragma Import (C, Field_Opts_On, "field_opts_on"); + function Field_Opts_Off (Fld : Field; + Opt : C_Int) return C_Int; + pragma Import (C, Field_Opts_Off, "field_opts_off"); + + Err : Eti_Error; + Opt : C_Int := FOS_2_CInt (Options); + begin + Normalize_Field_Options (Opt); + if On then + Err := Field_Opts_On (Fld, Opt); + else + Err := Field_Opts_Off (Fld, Opt); + end if; + if Err /= E_Ok then + Eti_Exception (Err); + end if; + end Switch_Options; + -- | + -- | + -- | + procedure Get_Options (Fld : in Field; + Options : out Field_Option_Set) + is + function Field_Opts (Fld : Field) return C_Int; + pragma Import (C, Field_Opts, "field_opts"); + + Res : C_Int := Field_Opts (Fld); + begin + Normalize_Field_Options (Res); + Options := CInt_2_FOS (Res); + end Get_Options; + -- | + -- | + -- | + function Get_Options (Fld : Field := Null_Field) + return Field_Option_Set + is + Fos : Field_Option_Set; + begin + Get_Options (Fld, Fos); + return Fos; + end Get_Options; + -- | + -- |===================================================================== + -- | man page form_field_attributes.3x + -- |===================================================================== + -- | + -- | + -- | + procedure Set_Foreground + (Fld : in Field; + Fore : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) + is + function Set_Field_Fore (Fld : Field; + Attr : C_Int) return C_Int; + pragma Import (C, Set_Field_Fore, "set_field_fore"); + + Ch : constant Attributed_Character := (Ch => Character'First, + Color => Color, + Attr => Fore); + Res : constant Eti_Error := Set_Field_Fore (Fld, Chtype_To_CInt (Ch)); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Foreground; + -- | + -- | + -- | + procedure Foreground (Fld : in Field; + Fore : out Character_Attribute_Set) + is + function Field_Fore (Fld : Field) return C_Int; + pragma Import (C, Field_Fore, "field_fore"); + begin + Fore := CInt_To_Chtype (Field_Fore (Fld)).Attr; + end Foreground; + + procedure Foreground (Fld : in Field; + Fore : out Character_Attribute_Set; + Color : out Color_Pair) + is + function Field_Fore (Fld : Field) return C_Int; + pragma Import (C, Field_Fore, "field_fore"); + begin + Fore := CInt_To_Chtype (Field_Fore (Fld)).Attr; + Color := CInt_To_Chtype (Field_Fore (Fld)).Color; + end Foreground; + -- | + -- | + -- | + procedure Set_Background + (Fld : in Field; + Back : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) + is + function Set_Field_Back (Fld : Field; + Attr : C_Int) return C_Int; + pragma Import (C, Set_Field_Back, "set_field_back"); + + Ch : constant Attributed_Character := (Ch => Character'First, + Color => Color, + Attr => Back); + Res : constant Eti_Error := Set_Field_Back (Fld, Chtype_To_CInt (Ch)); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Background; + -- | + -- | + -- | + procedure Background (Fld : in Field; + Back : out Character_Attribute_Set) + is + function Field_Back (Fld : Field) return C_Int; + pragma Import (C, Field_Back, "field_back"); + begin + Back := CInt_To_Chtype (Field_Back (Fld)).Attr; + end Background; + + procedure Background (Fld : in Field; + Back : out Character_Attribute_Set; + Color : out Color_Pair) + is + function Field_Back (Fld : Field) return C_Int; + pragma Import (C, Field_Back, "field_back"); + begin + Back := CInt_To_Chtype (Field_Back (Fld)).Attr; + Color := CInt_To_Chtype (Field_Back (Fld)).Color; + end Background; + -- | + -- | + -- | + procedure Set_Pad_Character (Fld : in Field; + Pad : in Character := Space) + is + function Set_Field_Pad (Fld : Field; + Ch : C_Int) return C_Int; + pragma Import (C, Set_Field_Pad, "set_field_pad"); + + Res : constant Eti_Error := Set_Field_Pad (Fld, + C_Int (Character'Pos (Pad))); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Pad_Character; + -- | + -- | + -- | + procedure Pad_Character (Fld : in Field; + Pad : out Character) + is + function Field_Pad (Fld : Field) return C_Int; + pragma Import (C, Field_Pad, "field_pad"); + begin + Pad := Character'Val (Field_Pad (Fld)); + end Pad_Character; + -- | + -- |===================================================================== + -- | man page form_field_info.3x + -- |===================================================================== + -- | + -- | + -- | + procedure Info (Fld : in Field; + Lines : out Line_Count; + Columns : out Column_Count; + First_Row : out Line_Position; + First_Column : out Column_Position; + Off_Screen : out Natural; + Additional_Buffers : out Buffer_Number) + is + type C_Int_Access is access all C_Int; + function Fld_Info (Fld : Field; + L, C, Fr, Fc, Os, Ab : C_Int_Access) + return C_Int; + pragma Import (C, Fld_Info, "field_info"); + + L, C, Fr, Fc, Os, Ab : aliased C_Int; + Res : constant Eti_Error := Fld_Info (Fld, + L'Access, C'Access, + Fr'Access, Fc'Access, + Os'Access, Ab'Access); + begin + if Res /= E_Ok then + Eti_Exception (Res); + else + Lines := Line_Count (L); + Columns := Column_Count (C); + First_Row := Line_Position (Fr); + First_Column := Column_Position (Fc); + Off_Screen := Natural (Os); + Additional_Buffers := Buffer_Number (Ab); + end if; + end Info; +-- | +-- | +-- | + procedure Dynamic_Info (Fld : in Field; + Lines : out Line_Count; + Columns : out Column_Count; + Max : out Natural) + is + type C_Int_Access is access all C_Int; + function Dyn_Info (Fld : Field; L, C, M : C_Int_Access) return C_Int; + pragma Import (C, Dyn_Info, "dynamic_field_info"); + + L, C, M : aliased C_Int; + Res : constant Eti_Error := Dyn_Info (Fld, + L'Access, C'Access, + M'Access); + begin + if Res /= E_Ok then + Eti_Exception (Res); + else + Lines := Line_Count (L); + Columns := Column_Count (C); + Max := Natural (M); + end if; + end Dynamic_Info; + -- | + -- |===================================================================== + -- | man page form_win.3x + -- |===================================================================== + -- | + -- | + -- | + procedure Set_Window (Frm : in Form; + Win : in Window) + is + function Set_Form_Win (Frm : Form; + Win : Window) return C_Int; + pragma Import (C, Set_Form_Win, "set_form_win"); + + Res : constant Eti_Error := Set_Form_Win (Frm, Win); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Window; + -- | + -- | + -- | + function Get_Window (Frm : Form) return Window + is + function Form_Win (Frm : Form) return Window; + pragma Import (C, Form_Win, "form_win"); + + W : constant Window := Form_Win (Frm); + begin + return W; + end Get_Window; + -- | + -- | + -- | + procedure Set_Sub_Window (Frm : in Form; + Win : in Window) + is + function Set_Form_Sub (Frm : Form; + Win : Window) return C_Int; + pragma Import (C, Set_Form_Sub, "set_form_sub"); + + Res : constant Eti_Error := Set_Form_Sub (Frm, Win); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Sub_Window; + -- | + -- | + -- | + function Get_Sub_Window (Frm : Form) return Window + is + function Form_Sub (Frm : Form) return Window; + pragma Import (C, Form_Sub, "form_sub"); + + W : constant Window := Form_Sub (Frm); + begin + return W; + end Get_Sub_Window; + -- | + -- | + -- | + procedure Scale (Frm : in Form; + Lines : out Line_Count; + Columns : out Column_Count) + is + type C_Int_Access is access all C_Int; + function M_Scale (Frm : Form; Yp, Xp : C_Int_Access) return C_Int; + pragma Import (C, M_Scale, "scale_form"); + + X, Y : aliased C_Int; + Res : constant Eti_Error := M_Scale (Frm, Y'Access, X'Access); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + Lines := Line_Count (Y); + Columns := Column_Count (X); + end Scale; + -- | + -- |===================================================================== + -- | man page menu_hook.3x + -- |===================================================================== + -- | + -- | + -- | + procedure Set_Field_Init_Hook (Frm : in Form; + Proc : in Form_Hook_Function) + is + function Set_Field_Init (Frm : Form; + Proc : Form_Hook_Function) return C_Int; + pragma Import (C, Set_Field_Init, "set_field_init"); + + Res : constant Eti_Error := Set_Field_Init (Frm, Proc); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Field_Init_Hook; + -- | + -- | + -- | + procedure Set_Field_Term_Hook (Frm : in Form; + Proc : in Form_Hook_Function) + is + function Set_Field_Term (Frm : Form; + Proc : Form_Hook_Function) return C_Int; + pragma Import (C, Set_Field_Term, "set_field_term"); + + Res : constant Eti_Error := Set_Field_Term (Frm, Proc); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Field_Term_Hook; + -- | + -- | + -- | + procedure Set_Form_Init_Hook (Frm : in Form; + Proc : in Form_Hook_Function) + is + function Set_Form_Init (Frm : Form; + Proc : Form_Hook_Function) return C_Int; + pragma Import (C, Set_Form_Init, "set_form_init"); + + Res : constant Eti_Error := Set_Form_Init (Frm, Proc); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Form_Init_Hook; + -- | + -- | + -- | + procedure Set_Form_Term_Hook (Frm : in Form; + Proc : in Form_Hook_Function) + is + function Set_Form_Term (Frm : Form; + Proc : Form_Hook_Function) return C_Int; + pragma Import (C, Set_Form_Term, "set_form_term"); + + Res : constant Eti_Error := Set_Form_Term (Frm, Proc); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Form_Term_Hook; + -- | + -- |===================================================================== + -- | man page form_fields.3x + -- |===================================================================== + -- | + -- | + -- | + procedure Free_Allocated_Fields is + new Ada.Unchecked_Deallocation (Field_Array, Field_Array_Access); + -- | + -- | + -- | + -- This is a bit delicate if we want to manipulate an Ada created form + -- from C routines or vice versa. + -- In Ada created forms we use the low level user pointer to maintain + -- binding internal additional informations about the form. This + -- internal information contains a hook for the Ada provided user pointer. + -- Unless you understand this implementation, the safest way in mixed + -- language programs to deal with user pointers is, that only the language + -- that created the form should also manipulate the user pointer for that + -- form. + procedure Redefine (Frm : in Form; + Flds : in Field_Array) + is + function Set_Frm_Fields (Frm : Form; + Items : Field_Array) return C_Int; + pragma Import (C, Set_Frm_Fields, "set_form_fields"); + + A : constant Form_User_Wrapper_Access := Form_Userptr (Frm); + I : Field_Array_Access; + Res : Eti_Error; + begin + if A = null or else A.I = null then raise Form_Exception; + else + I := new Field_Array (1 .. (Flds'Length + 1)); + I.all (1 .. Flds'Length) := Flds (Flds'First .. Flds'Last); + I.all (Flds'Length + 1) := Null_Field; + Res := Set_Frm_Fields (Frm, I.all); + if Res /= E_Ok then + Free_Allocated_Fields (I); + Eti_Exception (Res); + else + Free_Allocated_Fields (A.I); + A.I := I; + end if; + end if; + end Redefine; + -- | + -- | + -- | + function Fields (Frm : Form) return Field_Array_Access + is + A : constant Form_User_Wrapper_Access := Form_Userptr (Frm); + begin + if A = null or else A.I = null then + raise Form_Exception; + else + return A.I; + end if; + end Fields; + -- | + -- | + -- | + function Field_Count (Frm : Form) return Natural + is + function Count (Frm : Form) return C_Int; + pragma Import (C, Count, "field_count"); + begin + return Natural (Count (Frm)); + end Field_Count; + -- | + -- | + -- | + procedure Move (Fld : in Field; + Line : in Line_Position; + Column : in Column_Position) + is + function Move (Fld : Field; L, C : C_Int) return C_Int; + pragma Import (C, Move, "move_field"); + + Res : constant Eti_Error := Move (Fld, C_Int (Line), C_Int (Column)); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Move; + -- | + -- |===================================================================== + -- | man page form_new.3x + -- |===================================================================== + -- | + -- | + -- | + function Create (Fields : Field_Array) return Form + is + function NewForm (Fields : Field_Array) return Form; + pragma Import (C, NewForm, "new_form"); + + M : Form; + I : Field_Array_Access; + U : Form_User_Wrapper_Access; + Res : Eti_Error; + begin + I := new Field_Array (1 .. (Fields'Length + 1)); + I.all (1 .. Fields'Length) := Fields (Fields'First .. Fields'Last); + I.all (Fields'Length + 1) := Null_Field; + M := NewForm (I.all); + if M = Null_Form then + Free_Allocated_Fields (I); + raise Form_Exception; + end if; + U := new Form_User_Wrapper'(U => System.Null_Address, I => I); + Res := Set_Form_Userptr (M, U); + if Res /= E_Ok then + Free_Allocated_Fields (I); + Free_Form_User_Wrapper (U); + Eti_Exception (Res); + end if; + return M; + end Create; + -- | + -- | + -- | + procedure Delete (Frm : in out Form) + is + function Free (Frm : Form) return C_Int; + pragma Import (C, Free, "free_form"); + + U : Form_User_Wrapper_Access := Form_Userptr (Frm); + Res : constant Eti_Error := Free (Frm); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + if U = null or else U.I = null then + raise Form_Exception; + end if; + Free_Allocated_Fields (U.I); + Free_Form_User_Wrapper (U); + Frm := Null_Form; + end Delete; + -- | + -- |===================================================================== + -- | man page form_opts.3x + -- |===================================================================== + -- | + -- | + -- | + procedure Normalize_Form_Options (Options : in out C_Int); + pragma Import (C, Normalize_Form_Options, "_nc_ada_normalize_form_opts"); + + procedure Set_Options (Frm : in Form; + Options : in Form_Option_Set) + is + function Set_Form_Opts (Frm : Form; + Opt : C_Int) return C_Int; + pragma Import (C, Set_Form_Opts, "set_form_opts"); + + Opt : C_Int := FrmOS_2_CInt (Options); + Res : Eti_Error; + begin + Normalize_Form_Options (Opt); + Res := Set_Form_Opts (Frm, Opt); + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Options; + -- | + -- | + -- | + procedure Switch_Options (Frm : in Form; + Options : in Form_Option_Set; + On : Boolean := True) + is + function Form_Opts_On (Frm : Form; + Opt : C_Int) return C_Int; + pragma Import (C, Form_Opts_On, "form_opts_on"); + function Form_Opts_Off (Frm : Form; + Opt : C_Int) return C_Int; + pragma Import (C, Form_Opts_Off, "form_opts_off"); + + Err : Eti_Error; + Opt : C_Int := FrmOS_2_CInt (Options); + begin + Normalize_Form_Options (Opt); + if On then + Err := Form_Opts_On (Frm, Opt); + else + Err := Form_Opts_Off (Frm, Opt); + end if; + if Err /= E_Ok then + Eti_Exception (Err); + end if; + end Switch_Options; + -- | + -- | + -- | + procedure Get_Options (Frm : in Form; + Options : out Form_Option_Set) + is + function Form_Opts (Frm : Form) return C_Int; + pragma Import (C, Form_Opts, "form_opts"); + + Res : C_Int := Form_Opts (Frm); + begin + Normalize_Form_Options (Res); + Options := CInt_2_FrmOS (Res); + end Get_Options; + -- | + -- | + -- | + function Get_Options (Frm : Form := Null_Form) return Form_Option_Set + is + Fos : Form_Option_Set; + begin + Get_Options (Frm, Fos); + return Fos; + end Get_Options; + -- | + -- |===================================================================== + -- | man page form_post.3x + -- |===================================================================== + -- | + -- | + -- | + procedure Post (Frm : in Form; + Post : in Boolean := True) + is + function M_Post (Frm : Form) return C_Int; + pragma Import (C, M_Post, "post_form"); + function M_Unpost (Frm : Form) return C_Int; + pragma Import (C, M_Unpost, "unpost_form"); + + Res : Eti_Error; + begin + if Post then + Res := M_Post (Frm); + else + Res := M_Unpost (Frm); + end if; + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Post; + -- | + -- |===================================================================== + -- | man page form_cursor.3x + -- |===================================================================== + -- | + -- | + -- | + procedure Position_Cursor (Frm : Form) + is + function Pos_Form_Cursor (Frm : Form) return C_Int; + pragma Import (C, Pos_Form_Cursor, "pos_form_cursor"); + + Res : constant Eti_Error := Pos_Form_Cursor (Frm); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Position_Cursor; + -- | + -- |===================================================================== + -- | man page form_data.3x + -- |===================================================================== + -- | + -- | + -- | + function Data_Ahead (Frm : Form) return Boolean + is + function Ahead (Frm : Form) return C_Int; + pragma Import (C, Ahead, "data_ahead"); + + Res : constant C_Int := Ahead (Frm); + begin + if Res = Curses_False then + return False; + else + return True; + end if; + end Data_Ahead; + -- | + -- | + -- | + function Data_Behind (Frm : Form) return Boolean + is + function Behind (Frm : Form) return C_Int; + pragma Import (C, Behind, "data_behind"); + + Res : constant C_Int := Behind (Frm); + begin + if Res = Curses_False then + return False; + else + return True; + end if; + end Data_Behind; + -- | + -- |===================================================================== + -- | man page form_driver.3x + -- |===================================================================== + -- | + -- | + -- | + function Driver (Frm : Form; + Key : Key_Code) return Driver_Result + is + function Frm_Driver (Frm : Form; Key : C_Int) return C_Int; + pragma Import (C, Frm_Driver, "form_driver"); + + R : Eti_Error := Frm_Driver (Frm, C_Int (Key)); + begin + if R /= E_Ok then + if R = E_Unknown_Command then + return Unknown_Request; + elsif R = E_Invalid_Field then + return Invalid_Field; + elsif R = E_Request_Denied then + return Request_Denied; + else + Eti_Exception (R); + return Form_Ok; + end if; + else + return Form_Ok; + end if; + end Driver; + -- | + -- |===================================================================== + -- | man page form_page.3x + -- |===================================================================== + -- | + -- | + -- | + procedure Set_Current (Frm : in Form; + Fld : in Field) + is + function Set_Current_Fld (Frm : Form; Fld : Field) return C_Int; + pragma Import (C, Set_Current_Fld, "set_current_field"); + + Res : constant Eti_Error := Set_Current_Fld (Frm, Fld); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Current; + -- | + -- | + -- | + function Current (Frm : in Form) return Field + is + function Current_Fld (Frm : Form) return Field; + pragma Import (C, Current_Fld, "current_field"); + + Fld : constant Field := Current_Fld (Frm); + begin + if Fld = Null_Field then + raise Form_Exception; + end if; + return Fld; + end Current; + -- | + -- | + -- | + procedure Set_Page (Frm : in Form; + Page : in Page_Number := Page_Number'First) + is + function Set_Frm_Page (Frm : Form; Pg : C_Int) return C_Int; + pragma Import (C, Set_Frm_Page, "set_form_page"); + + Res : constant Eti_Error := Set_Frm_Page (Frm, C_Int (Page)); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Page; + -- | + -- | + -- | + function Page (Frm : Form) return Page_Number + is + function Get_Page (Frm : Form) return C_Int; + pragma Import (C, Get_Page, "form_page"); + + P : constant C_Int := Get_Page (Frm); + begin + if P < 0 then + raise Form_Exception; + else + return Page_Number (P); + end if; + end Page; + + function Get_Index (Fld : Field) return Positive + is + function Get_Fieldindex (Fld : Field) return C_Int; + pragma Import (C, Get_Fieldindex, "field_index"); + + Res : constant C_Int := Get_Fieldindex (Fld); + begin + if Res = Curses_Err then + raise Form_Exception; + end if; + return Positive (Natural (Res) + Positive'First); + end Get_Index; + + -- | + -- |===================================================================== + -- | man page form_new_page.3x + -- |===================================================================== + -- | + -- | + -- | + procedure Set_New_Page (Fld : in Field; + New_Page : in Boolean := True) + is + function Set_Page (Fld : Field; Flg : C_Int) return C_Int; + pragma Import (C, Set_Page, "set_new_page"); + + Res : constant Eti_Error := Set_Page (Fld, Boolean'Pos (New_Page)); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_New_Page; + -- | + -- | + -- | + function Is_New_Page (Fld : Field) return Boolean + is + function Is_New (Fld : Field) return C_Int; + pragma Import (C, Is_New, "new_page"); + + Res : constant C_Int := Is_New (Fld); + begin + if Res = Curses_False then + return False; + else + return True; + end if; + end Is_New_Page; + +------------------------------------------------------------------------------ + -- We use a GNAT internal hash table mechanism to create an association + -- between an Ada_Defined_Field_Type and it's low level C_Field_Type + -- peer. + -- It shouldn´t be too complicated to reimplent this hashing mechanism + -- for other compilers. + -- + type Tag_Type_Pair; + type Tag_Pair_Access is access all Tag_Type_Pair; + pragma Controlled (Tag_Pair_Access); + + Null_Tag_Pair : constant Tag_Pair_Access := Tag_Pair_Access'(null); + + type Tag_Type_Pair is + record + Ada_Tag : Tag; + Cft : C_Field_Type; + Next : Tag_Pair_Access; + end record; + + type Htable_Headers is range 1 .. 31; + procedure Free_Tag_Type_Pair is + new Ada.Unchecked_Deallocation (Tag_Type_Pair, Tag_Pair_Access); + + procedure Set_Pair_Link (T : Tag_Pair_Access; Next : Tag_Pair_Access); + function Get_Pair_Link (T : Tag_Pair_Access) return Tag_Pair_Access; + function Get_Pair_Tag (T : Tag_Pair_Access) return Tag; + + function Hash (T : Tag) return Htable_Headers; + function Equal (A, B : Tag) return Boolean; + + package External_Pair_Htable is new GNAT.Htable.Static_Htable + (Header_Num => Htable_Headers, + Element => Tag_Type_Pair, + Elmt_Ptr => Tag_Pair_Access, + Null_Ptr => Null_Tag_Pair, + Set_Next => Set_Pair_Link, + Next => Get_Pair_Link, + Key => Tag, + Get_Key => Get_Pair_Tag, + Hash => Hash, + Equal => Equal); + + procedure Set_Pair_Link (T : Tag_Pair_Access; Next : Tag_Pair_Access) + is + begin + T.all.Next := Next; + end Set_Pair_Link; + + function Get_Pair_Link (T : Tag_Pair_Access) return Tag_Pair_Access + is + begin + return T.all.Next; + end Get_Pair_Link; + + function Get_Pair_Tag (T : Tag_Pair_Access) return Tag + is + begin + return T.all.Ada_Tag; + end Get_Pair_Tag; + + function Equal (A, B : Tag) return Boolean + is + begin + return A = B; + end Equal; + + function Hash (T : Tag) return Htable_Headers + is + function H is new GNAT.Htable.Hash (Htable_Headers); + begin + return H (External_Tag (T)); + end Hash; + + function Search_Type (T : Ada_Defined_Field_Type'Class) + return C_Field_Type + is + P : Tag_Pair_Access := External_Pair_Htable.Get (T'Tag); + begin + if P /= null then + return P.Cft; + else + return Null_Field_Type; + end if; + end Search_Type; + + -- Register an Ada_Defined_Field_Type given by its Tag + -- with it's associated C_Field_Type. + procedure Register_Type (T : in Ada_Defined_Field_Type'Class; + Cft : in C_Field_Type) + is + C : C_Field_Type := Search_Type (T); + P : Tag_Pair_Access; + begin + if C /= Null_Field_Type then + raise Form_Exception; + else + P := new Tag_Type_Pair'(T'Tag, Cft, null); + External_Pair_Htable.Set (P); + end if; + end Register_Type; + + -- Unregister an Ada_Defined_Field_Type given by it's tag + procedure Unregister_Type (T : in Ada_Defined_Field_Type'Class) + is + function Free_Fieldtype (Ft : C_Field_Type) return C_Int; + pragma Import (C, Free_Fieldtype, "free_fieldtype"); + + P : Tag_Pair_Access := External_Pair_Htable.Get (T'Tag); + Ft : C_Field_Type; + Res : C_Int; + begin + if P = null then + raise Form_Exception; + else + Ft := P.Cft; + External_Pair_Htable.Remove (T'Tag); + Free_Tag_Type_Pair (P); + Res := Free_Fieldtype (Ft); + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end if; + end Unregister_Type; + +---------------------------------------------------------------------------- + -- | + -- | + -- | + procedure Set_Type (Fld : Field; + Fld_Type : Ada_Defined_Field_Type) + is + function Set_Fld_Type (F : Field := Fld; + Ct : C_Field_Type; + Arg1 : Ada_Defined_Field_Type'Class) + return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); + function Field_Userptr (Fld : Field) + return Field_User_Wrapper_Access; + pragma Import (C, Field_Userptr, "field_userptr"); + + Res : Eti_Error; + C : constant C_Field_Type := Search_Type (Fld_Type); + begin + if C = Null_Field_Type then + raise Form_Exception; + else + Res := Set_Fld_Type (Fld, C, Fld_Type); + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end if; + end Set_Type; + -- | + -- | + -- | + function Native_Type (Ftype : Ada_Defined_Field_Type) + return C_Field_Type + is + C : constant C_Field_Type := Search_Type (Ftype); + begin + if C = Null_Field_Type then + raise Form_Exception; + else + return C; + end if; + end Native_Type; + -- | + -- | + -- | + function Native_Type (Ftype : Alpha_Field) + return C_Field_Type + is + C_Alpha_Field_Type : C_Field_Type; + pragma Import (C, C_Alpha_Field_Type, "TYPE_ALPHA"); + begin + return C_Alpha_Field_Type; + end Native_Type; + pragma Inline (Native_Type); + -- | + -- | + -- | + procedure Set_Type (Fld : in Field; + Fld_Type : in Alpha_Field) + is + function Set_Fld_Type (F : Field := Fld; + Cft : C_Field_Type := Native_Type (Fld_Type); + Arg1 : C_Int) return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); + function Field_Userptr (Fld : Field) + return Field_User_Wrapper_Access; + pragma Import (C, Field_Userptr, "field_userptr"); + + A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); + Res : Eti_Error; + begin + Res := Set_Fld_Type (Arg1 => C_Int (Fld_Type.Minimum_Field_Width)); + if Res /= E_Ok then + Eti_Exception (Res); + else + A.T := new Alpha_Field'(Fld_Type); + end if; + end Set_Type; + -- | + -- | + -- | + function Native_Type (Ftype : Alpha_Numeric_Field) + return C_Field_Type + is + C_Alpha_Numeric_Field_Type : C_Field_Type; + pragma Import (C, C_Alpha_Numeric_Field_Type, "TYPE_ALNUM"); + begin + return C_Alpha_Numeric_Field_Type; + end Native_Type; + pragma Inline (Native_Type); + -- | + -- | + -- | + procedure Set_Type (Fld : in Field; + Fld_Type : in Alpha_Numeric_Field) + is + function Set_Fld_Type (F : Field := Fld; + Cft : C_Field_Type := Native_Type (Fld_Type); + Arg1 : C_Int) return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); + function Field_Userptr (Fld : Field) + return Field_User_Wrapper_Access; + pragma Import (C, Field_Userptr, "field_userptr"); + + A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); + Res : Eti_Error; + begin + Res := Set_Fld_Type (Arg1 => C_Int (Fld_Type.Minimum_Field_Width)); + if Res /= E_Ok then + Eti_Exception (Res); + else + A.T := new Alpha_Numeric_Field'(Fld_Type); + end if; + end Set_Type; + -- | + -- | + -- | + function Native_Type (Ftype : Integer_Field) + return C_Field_Type + is + C_Integer_Field_Type : C_Field_Type; + pragma Import (C, C_Integer_Field_Type, "TYPE_INTEGER"); + begin + return C_Integer_Field_Type; + end Native_Type; + pragma Inline (Native_Type); + -- | + -- | + -- | + procedure Set_Type (Fld : in Field; + Fld_Type : in Integer_Field) + is + function Set_Fld_Type (F : Field := Fld; + Cft : C_Field_Type := Native_Type (Fld_Type); + Arg1 : C_Int; + Arg2 : C_Long_Int; + Arg3 : C_Long_Int) return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); + function Field_Userptr (Fld : Field) + return Field_User_Wrapper_Access; + pragma Import (C, Field_Userptr, "field_userptr"); + + A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); + Res : Eti_Error; + begin + Res := Set_Fld_Type (Arg1 => C_Int (Fld_Type.Precision), + Arg2 => C_Long_Int (Fld_Type.Lower_Limit), + Arg3 => C_Long_Int (Fld_Type.Upper_Limit)); + if Res /= E_Ok then + Eti_Exception (Res); + else + A.T := new Integer_Field'(Fld_Type); + end if; + end Set_Type; + -- | + -- | + -- | + function Native_Type (Ftype : Numeric_Field) + return C_Field_Type + is + C_Numeric_Field_Type : C_Field_Type; + pragma Import (C, C_Numeric_Field_Type, "TYPE_NUMERIC"); + begin + return C_Numeric_Field_Type; + end Native_Type; + pragma Inline (Native_Type); + -- | + -- | + -- | + procedure Set_Type (Fld : in Field; + Fld_Type : in Numeric_Field) + is + type Double is new Interfaces.C.double; + + function Set_Fld_Type (F : Field := Fld; + Cft : C_Field_Type := Native_Type (Fld_Type); + Arg1 : Double; + Arg2 : Double; + Arg3 : Double) return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); + function Field_Userptr (Fld : Field) + return Field_User_Wrapper_Access; + pragma Import (C, Field_Userptr, "field_userptr"); + + A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); + Res : Eti_Error; + begin + Res := Set_Fld_Type (Arg1 => Double (Fld_Type.Precision), + Arg2 => Double (Fld_Type.Lower_Limit), + Arg3 => Double (Fld_Type.Upper_Limit)); + if Res /= E_Ok then + Eti_Exception (Res); + else + A.T := new Numeric_Field'(Fld_Type); + end if; + end Set_Type; + -- | + -- | + -- | + function Native_Type (Ftype : Regular_Expression_Field) + return C_Field_Type + is + C_Regexp_Field_Type : C_Field_Type; + pragma Import (C, C_Regexp_Field_Type, "TYPE_REGEXP"); + begin + return C_Regexp_Field_Type; + end Native_Type; + pragma Inline (Native_Type); + -- | + -- | + -- | + procedure Set_Type (Fld : in Field; + Fld_Type : in Regular_Expression_Field) + is + type Char_Ptr is access all Interfaces.C.Char; + function Set_Fld_Type (F : Field := Fld; + Cft : C_Field_Type := Native_Type (Fld_Type); + Arg1 : Char_Ptr) return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); + function Field_Userptr (Fld : Field) + return Field_User_Wrapper_Access; + pragma Import (C, Field_Userptr, "field_userptr"); + + A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); + Txt : char_array (0 .. Fld_Type.Regular_Expression.all'Length); + Len : size_t; + Res : Eti_Error; + begin + To_C (Fld_Type.Regular_Expression.all, Txt, Len); + Res := Set_Fld_Type (Arg1 => Txt (Txt'First)'Access); + if Res /= E_Ok then + Eti_Exception (Res); + else + A.T := new Regular_Expression_Field'(Fld_Type); + end if; + end Set_Type; + -- | + -- | + -- | + function Native_Type (Ftype : Enumeration_Field) + return C_Field_Type + is + C_Enum_Type : C_Field_Type; + pragma Import (C, C_Enum_Type, "TYPE_ENUM"); + begin + return C_Enum_Type; + end Native_Type; + pragma Inline (Native_Type); + -- | + -- | + -- | + function Create (Info : Enumeration_Info; + Auto_Release_Names : Boolean := False) + return Enumeration_Field + is + procedure Release_String is + new Ada.Unchecked_Deallocation (String, + String_Access); + E : Enumeration_Field; + L : constant size_t := 1 + size_t (Info.C); + S : String_Access; + begin + E.Case_Sensitive := Info.Case_Sensitive; + E.Match_Must_Be_Unique := Info.Match_Must_Be_Unique; + E.Arr := new chars_ptr_array (size_t (1) .. L); + for I in 1 .. Positive (L - 1) loop + if Info.Names (I) = null then + raise Form_Exception; + end if; + E.Arr (size_t (I)) := New_String (Info.Names (I).all); + if Auto_Release_Names then + S := Info.Names (I); + Release_String (S); + end if; + end loop; + E.Arr (L) := Null_Ptr; + return E; + end Create; + + procedure Release (Enum : in out Enumeration_Field) + is + I : size_t := 0; + P : chars_ptr; + begin + loop + P := Enum.Arr (I); + exit when P = Null_Ptr; + Free (P); + Enum.Arr (I) := Null_Ptr; + I := I + 1; + end loop; + Enum.Arr := null; + end Release; + + procedure Set_Type (Fld : in Field; + Fld_Type : in Enumeration_Field) + is + function Set_Fld_Type (F : Field := Fld; + Cft : C_Field_Type := Native_Type (Fld_Type); + Arg1 : chars_ptr_array; + Arg2 : C_Int; -- case + Arg3 : C_Int) return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); + function Field_Userptr (Fld : Field) + return Field_User_Wrapper_Access; + pragma Import (C, Field_Userptr, "field_userptr"); + + A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); + Res : Eti_Error; + begin + if Fld_Type.Arr = null then + raise Form_Exception; + end if; + Res := Set_Fld_Type (Arg1 => Fld_Type.Arr.all, + Arg2 => C_Int (Boolean'Pos + (Fld_Type.Case_Sensitive)), + Arg3 => + C_Int (Boolean'Pos + (Fld_Type.Match_Must_Be_Unique))); + if Res /= E_Ok then + Eti_Exception (Res); + else + A.T := new Enumeration_Field'(Fld_Type); + end if; + end Set_Type; + + + function Native_Type (Ftype : Internet_V4_Address_Field) + return C_Field_Type + is + C_IPV4_Field_Type : C_Field_Type; + pragma Import (C, C_IPV4_Field_Type, "TYPE_IPV4"); + begin + return C_IPV4_Field_Type; + end Native_Type; + pragma Inline (Native_Type); + -- | + -- | + -- | + procedure Set_Type (Fld : in Field; + Fld_Type : in Internet_V4_Address_Field) + is + function Set_Fld_Type (F : Field := Fld; + Cft : C_Field_Type := Native_Type (Fld_Type)) + return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); + function Field_Userptr (Fld : Field) + return Field_User_Wrapper_Access; + pragma Import (C, Field_Userptr, "field_userptr"); + + A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); + Res : Eti_Error; + begin + Res := Set_Fld_Type; + if Res /= E_Ok then + Eti_Exception (Res); + else + A.T := new Internet_V4_Address_Field'(Fld_Type); + end if; + end Set_Type; + + -- | + -- |===================================================================== + -- | man page form_field_validation.3x + -- |===================================================================== + -- | + -- | + -- | + function Get_Type (Fld : in Field) return Field_Type_Access + is + A : constant Field_User_Wrapper_Access := Field_Userptr (Fld); + begin + if A = null then + return null; + else + return A.T; + end if; + end Get_Type; + +begin + Default_Field_Options := Get_Options (Null_Field); + Default_Form_Options := Get_Options (Null_Form); +end Terminal_Interface.Curses.Forms; diff --git a/Ada95/ada_include/terminal_interface-curses-menus-item_user_data.adb b/Ada95/ada_include/terminal_interface-curses-menus-item_user_data.adb new file mode 100644 index 00000000..9e56187d --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-menus-item_user_data.adb @@ -0,0 +1,57 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Menus.Item_User_Data -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; + +package body Terminal_Interface.Curses.Menus.Item_User_Data is + + use type Interfaces.C.int; + + procedure Set_User_Data (Itm : in Item; + Data : in User_Access) + is + function Set_Item_Userptr (Itm : Item; + Addr : User_Access) return C_Int; + pragma Import (C, Set_Item_Userptr, "set_item_userptr"); + + Res : constant Eti_Error := Set_Item_Userptr (Itm, Data); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_User_Data; + + procedure Get_User_Data (Itm : in Item; + Data : out User_Access) + is + function Item_Userptr (Itm : Item) return User_Access; + pragma Import (C, Item_Userptr, "item_userptr"); + begin + Data := Item_Userptr (Itm); + end Get_User_Data; + +end Terminal_Interface.Curses.Menus.Item_User_Data; diff --git a/Ada95/ada_include/terminal_interface-curses-menus-menu_user_data.adb b/Ada95/ada_include/terminal_interface-curses-menus-menu_user_data.adb new file mode 100644 index 00000000..98dc039d --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-menus-menu_user_data.adb @@ -0,0 +1,67 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Menus.Menu_User_Data -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Unchecked_Conversion; + +package body Terminal_Interface.Curses.Menus.Menu_User_Data is + + function To_Address is new + Unchecked_Conversion (User_Access, + System.Address); + function To_Pointer is new + Unchecked_Conversion (System.Address, + User_Access); + + procedure Set_User_Data (Men : in Menu; + Data : in User_Access) + is + function Menu_Userptr (Men : Menu) return Ada_User_Wrapper_Access; + pragma Import (C, Menu_Userptr, "menu_userptr"); + + U : Ada_User_Wrapper_Access := Menu_Userptr (Men); + begin + if U = null or else U.I = null then + raise Menu_Exception; + end if; + U.U := To_Address (Data); + end Set_User_Data; + + procedure Get_User_Data (Men : in Menu; + Data : out User_Access) + is + function Menu_Userptr (Men : Menu) return Ada_User_Wrapper_Access; + pragma Import (C, Menu_Userptr, "menu_userptr"); + + U : Ada_User_Wrapper_Access := Menu_Userptr (Men); + begin + if U = null then + raise Menu_Exception; + else + Data := To_Pointer (U.U); + end if; + end Get_User_Data; + +end Terminal_Interface.Curses.Menus.Menu_User_Data; diff --git a/Ada95/ada_include/terminal_interface-curses-menus.adb b/Ada95/ada_include/terminal_interface-curses-menus.adb new file mode 100644 index 00000000..33f06603 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-menus.adb @@ -0,0 +1,984 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Menus -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.7 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; + +with Interfaces.C; use Interfaces.C; +with Interfaces.C.Strings; +with Terminal_Interface.Curses; + +with Ada.Unchecked_Deallocation; +with Unchecked_Conversion; + +package body Terminal_Interface.Curses.Menus is + + use type System.Bit_Order; + subtype chars_ptr is Interfaces.C.Strings.chars_ptr; + + function MOS_2_CInt is new + Unchecked_Conversion (Menu_Option_Set, + C_Int); + + function CInt_2_MOS is new + Unchecked_Conversion (C_Int, + Menu_Option_Set); + + function IOS_2_CInt is new + Unchecked_Conversion (Item_Option_Set, + C_Int); + + function CInt_2_IOS is new + Unchecked_Conversion (C_Int, + Item_Option_Set); + +------------------------------------------------------------------------------ + procedure Free_Allocated_Items is + new Ada.Unchecked_Deallocation (Item_Array, Item_Array_Access); + + procedure Free_User_Wrapper is + new Ada.Unchecked_Deallocation (Ada_User_Wrapper, + Ada_User_Wrapper_Access); + +------------------------------------------------------------------------------ + procedure Request_Name (Key : in Menu_Request_Code; + Name : out String) + is + function Request_Name (Key : C_Int) return chars_ptr; + pragma Import (C, Request_Name, "menu_request_name"); + begin + Fill_String (Request_Name (C_Int (Key)), Name); + end Request_Name; + + -- !!! W A R N I N G !!! + -- If you want to port this binding to a non ncurses version of the + -- ETI, this must be rewritten. In ncurses the menu items and + -- descriptions may be automatic variables, because ncurses copies + -- the parameters into private allocated internal structures. + -- Other implementations don't do that usually, so depending on + -- scopes you may see unexpected results. + function Create (Name : String; + Description : String := "") return Item + is + type Char_Ptr is access all Interfaces.C.Char; + function Newitem (Name, Desc : Char_Ptr) return Item; + pragma Import (C, Newitem, "new_item"); + + Name_Str : char_array (0 .. Name'Length); + Desc_Str : char_array (0 .. Description'Length); + Name_Len, Desc_Len : size_t; + Result : Item; + begin + To_C (Name, Name_Str, Name_Len); + To_C (Description, Desc_Str, Desc_Len); + Result := Newitem (Name_Str (Name_Str'First)'Access, + Desc_Str (Desc_Str'First)'Access); + if Result = Null_Item then + raise Eti_System_Error; + end if; + return Result; + end Create; + + procedure Delete (Itm : in out Item) + is + function Freeitem (Itm : Item) return C_Int; + pragma Import (C, Freeitem, "free_item"); + + Res : constant Eti_Error := Freeitem (Itm); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + Itm := Null_Item; + end Delete; +------------------------------------------------------------------------------- + procedure Set_Value (Itm : in Item; + Value : in Boolean := True) + is + function Set_Item_Val (Itm : Item; + Val : C_Int) return C_Int; + pragma Import (C, Set_Item_Val, "set_item_value"); + + Res : constant Eti_Error := Set_Item_Val (Itm, Boolean'Pos (Value)); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Value; + + function Value (Itm : Item) return Boolean + is + function Item_Val (Itm : Item) return C_Int; + pragma Import (C, Item_Val, "item_value"); + begin + if Item_Val (Itm) = Curses_False then + return False; + else + return True; + end if; + end Value; + +------------------------------------------------------------------------------- + function Visible (Itm : Item) return Boolean + is + function Item_Vis (Itm : Item) return C_Int; + pragma Import (C, Item_Vis, "item_visible"); + begin + if Item_Vis (Itm) = Curses_False then + return False; + else + return True; + end if; + end Visible; +------------------------------------------------------------------------------- + procedure Normalize_Item_Options (Options : in out C_Int); + pragma Import (C, Normalize_Item_Options, "_nc_ada_normalize_item_opts"); + + procedure Set_Options (Itm : in Item; + Options : in Item_Option_Set) + is + function Set_Item_Opts (Itm : Item; + Opt : C_Int) return C_Int; + pragma Import (C, Set_Item_Opts, "set_item_opts"); + + Opt : C_Int := IOS_2_CInt (Options); + Res : Eti_Error; + begin + Normalize_Item_Options (Opt); + Res := Set_Item_Opts (Itm, Opt); + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Options; + + procedure Switch_Options (Itm : in Item; + Options : in Item_Option_Set; + On : Boolean := True) + is + function Item_Opts_On (Itm : Item; + Opt : C_Int) return C_Int; + pragma Import (C, Item_Opts_On, "item_opts_on"); + function Item_Opts_Off (Itm : Item; + Opt : C_Int) return C_Int; + pragma Import (C, Item_Opts_Off, "item_opts_off"); + + Opt : C_Int := IOS_2_CInt (Options); + Err : Eti_Error; + begin + Normalize_Item_Options (Opt); + if On then + Err := Item_Opts_On (Itm, Opt); + else + Err := Item_Opts_Off (Itm, Opt); + end if; + if Err /= E_Ok then + Eti_Exception (Err); + end if; + end Switch_Options; + + procedure Get_Options (Itm : in Item; + Options : out Item_Option_Set) + is + function Item_Opts (Itm : Item) return C_Int; + pragma Import (C, Item_Opts, "item_opts"); + + Res : C_Int := Item_Opts (Itm); + begin + Normalize_Item_Options (Res); + Options := CInt_2_IOS (Res); + end Get_Options; + + function Get_Options (Itm : Item := Null_Item) return Item_Option_Set + is + Ios : Item_Option_Set; + begin + Get_Options (Itm, Ios); + return Ios; + end Get_Options; +------------------------------------------------------------------------------- + procedure Name (Itm : in Item; + Name : out String) + is + function Itemname (Itm : Item) return chars_ptr; + pragma Import (C, Itemname, "item_name"); + begin + Fill_String (Itemname (Itm), Name); + end Name; + + procedure Description (Itm : in Item; + Description : out String) + is + function Descname (Itm : Item) return chars_ptr; + pragma Import (C, Descname, "item_description"); + begin + Fill_String (Descname (Itm), Description); + end Description; +------------------------------------------------------------------------------- + procedure Set_Current (Men : in Menu; + Itm : in Item) + is + function Set_Curr_Item (Men : Menu; + Itm : Item) return C_Int; + pragma Import (C, Set_Curr_Item, "set_current_item"); + + Res : constant Eti_Error := Set_Curr_Item (Men, Itm); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Current; + + function Current (Men : Menu) return Item + is + function Curr_Item (Men : Menu) return Item; + pragma Import (C, Curr_Item, "current_item"); + + Res : constant Item := Curr_Item (Men); + begin + if Res = Null_Item then + raise Menu_Exception; + end if; + return Res; + end Current; + + procedure Set_Top_Row (Men : in Menu; + Line : in Line_Position) + is + function Set_Toprow (Men : Menu; + Line : C_Int) return C_Int; + pragma Import (C, Set_Toprow, "set_top_row"); + + Res : constant Eti_Error := Set_Toprow (Men, C_Int (Line)); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Top_Row; + + function Top_Row (Men : Menu) return Line_Position + is + function Toprow (Men : Menu) return C_Int; + pragma Import (C, Toprow, "top_row"); + + Res : constant C_Int := Toprow (Men); + begin + if Res = Curses_Err then + raise Menu_Exception; + end if; + return Line_Position (Res); + end Top_Row; + + function Get_Index (Itm : Item) return Positive + is + function Get_Itemindex (Itm : Item) return C_Int; + pragma Import (C, Get_Itemindex, "item_index"); + + Res : constant C_Int := Get_Itemindex (Itm); + begin + if Res = Curses_Err then + raise Menu_Exception; + end if; + return Positive (Natural (Res) + Positive'First); + end Get_Index; +------------------------------------------------------------------------------- + procedure Post (Men : in Menu; + Post : in Boolean := True) + is + function M_Post (Men : Menu) return C_Int; + pragma Import (C, M_Post, "post_menu"); + function M_Unpost (Men : Menu) return C_Int; + pragma Import (C, M_Unpost, "unpost_menu"); + + Res : Eti_Error; + begin + if Post then + Res := M_Post (Men); + else + Res := M_Unpost (Men); + end if; + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Post; +------------------------------------------------------------------------------- + procedure Normalize_Menu_Options (Options : in out C_Int); + pragma Import (C, Normalize_Menu_Options, "_nc_ada_normalize_menu_opts"); + + procedure Set_Options (Men : in Menu; + Options : in Menu_Option_Set) + is + function Set_Menu_Opts (Men : Menu; + Opt : C_Int) return C_Int; + pragma Import (C, Set_Menu_Opts, "set_menu_opts"); + + Opt : C_Int := MOS_2_CInt (Options); + Res : Eti_Error; + begin + Normalize_Menu_Options (Opt); + Res := Set_Menu_Opts (Men, Opt); + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Options; + + procedure Switch_Options (Men : in Menu; + Options : in Menu_Option_Set; + On : in Boolean := True) + is + function Menu_Opts_On (Men : Menu; + Opt : C_Int) return C_Int; + pragma Import (C, Menu_Opts_On, "menu_opts_on"); + function Menu_Opts_Off (Men : Menu; + Opt : C_Int) return C_Int; + pragma Import (C, Menu_Opts_Off, "menu_opts_off"); + + Opt : C_Int := MOS_2_CInt (Options); + Err : Eti_Error; + begin + Normalize_Menu_Options (Opt); + if On then + Err := Menu_Opts_On (Men, Opt); + else + Err := Menu_Opts_Off (Men, Opt); + end if; + if Err /= E_Ok then + Eti_Exception (Err); + end if; + end Switch_Options; + + procedure Get_Options (Men : in Menu; + Options : out Menu_Option_Set) + is + function Menu_Opts (Men : Menu) return C_Int; + pragma Import (C, Menu_Opts, "menu_opts"); + + Res : C_Int := Menu_Opts (Men); + begin + Normalize_Menu_Options (Res); + Options := CInt_2_MOS (Res); + end Get_Options; + + function Get_Options (Men : Menu := Null_Menu) return Menu_Option_Set + is + Mos : Menu_Option_Set; + begin + Get_Options (Men, Mos); + return Mos; + end Get_Options; +------------------------------------------------------------------------------- + procedure Set_Window (Men : in Menu; + Win : in Window) + is + function Set_Menu_Win (Men : Menu; + Win : Window) return C_Int; + pragma Import (C, Set_Menu_Win, "set_menu_win"); + + Res : constant Eti_Error := Set_Menu_Win (Men, Win); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Window; + + function Get_Window (Men : Menu) return Window + is + function Menu_Win (Men : Menu) return Window; + pragma Import (C, Menu_Win, "menu_win"); + + W : constant Window := Menu_Win (Men); + begin + return W; + end Get_Window; + + procedure Set_Sub_Window (Men : in Menu; + Win : in Window) + is + function Set_Menu_Sub (Men : Menu; + Win : Window) return C_Int; + pragma Import (C, Set_Menu_Sub, "set_menu_sub"); + + Res : constant Eti_Error := Set_Menu_Sub (Men, Win); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Sub_Window; + + function Get_Sub_Window (Men : Menu) return Window + is + function Menu_Sub (Men : Menu) return Window; + pragma Import (C, Menu_Sub, "menu_sub"); + + W : constant Window := Menu_Sub (Men); + begin + return W; + end Get_Sub_Window; + + procedure Scale (Men : in Menu; + Lines : out Line_Count; + Columns : out Column_Count) + is + type C_Int_Access is access all C_Int; + function M_Scale (Men : Menu; + Yp, Xp : C_Int_Access) return C_Int; + pragma Import (C, M_Scale, "scale_menu"); + + X, Y : aliased C_Int; + Res : constant Eti_Error := M_Scale (Men, Y'Access, X'Access); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + Lines := Line_Count (Y); + Columns := Column_Count (X); + end Scale; +------------------------------------------------------------------------------- + procedure Position_Cursor (Men : Menu) + is + function Pos_Menu_Cursor (Men : Menu) return C_Int; + pragma Import (C, Pos_Menu_Cursor, "pos_menu_cursor"); + + Res : constant Eti_Error := Pos_Menu_Cursor (Men); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Position_Cursor; + +------------------------------------------------------------------------------- + procedure Set_Mark (Men : in Menu; + Mark : in String) + is + type Char_Ptr is access all Interfaces.C.Char; + function Set_Mark (Men : Menu; + Mark : Char_Ptr) return C_Int; + pragma Import (C, Set_Mark, "set_menu_mark"); + + Txt : char_array (0 .. Mark'Length); + Len : size_t; + Res : Eti_Error; + begin + To_C (Mark, Txt, Len); + Res := Set_Mark (Men, Txt (Txt'First)'Access); + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Mark; + + procedure Mark (Men : in Menu; + Mark : out String) + is + function Get_Menu_Mark (Men : Menu) return chars_ptr; + pragma Import (C, Get_Menu_Mark, "menu_mark"); + begin + Fill_String (Get_Menu_Mark (Men), Mark); + end Mark; + +------------------------------------------------------------------------------- + procedure Set_Foreground + (Men : in Menu; + Fore : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) + is + function Set_Menu_Fore (Men : Menu; + Attr : C_Int) return C_Int; + pragma Import (C, Set_Menu_Fore, "set_menu_fore"); + + Ch : constant Attributed_Character := (Ch => Character'First, + Color => Color, + Attr => Fore); + Res : constant Eti_Error := Set_Menu_Fore (Men, Chtype_To_CInt (Ch)); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Foreground; + + procedure Foreground (Men : in Menu; + Fore : out Character_Attribute_Set) + is + function Menu_Fore (Men : Menu) return C_Int; + pragma Import (C, Menu_Fore, "menu_fore"); + begin + Fore := CInt_To_Chtype (Menu_Fore (Men)).Attr; + end Foreground; + + procedure Foreground (Men : in Menu; + Fore : out Character_Attribute_Set; + Color : out Color_Pair) + is + function Menu_Fore (Men : Menu) return C_Int; + pragma Import (C, Menu_Fore, "menu_fore"); + begin + Fore := CInt_To_Chtype (Menu_Fore (Men)).Attr; + Color := CInt_To_Chtype (Menu_Fore (Men)).Color; + end Foreground; + + procedure Set_Background + (Men : in Menu; + Back : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) + is + function Set_Menu_Back (Men : Menu; + Attr : C_Int) return C_Int; + pragma Import (C, Set_Menu_Back, "set_menu_back"); + + Ch : constant Attributed_Character := (Ch => Character'First, + Color => Color, + Attr => Back); + Res : constant Eti_Error := Set_Menu_Back (Men, Chtype_To_CInt (Ch)); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Background; + + procedure Background (Men : in Menu; + Back : out Character_Attribute_Set) + is + function Menu_Back (Men : Menu) return C_Int; + pragma Import (C, Menu_Back, "menu_back"); + begin + Back := CInt_To_Chtype (Menu_Back (Men)).Attr; + end Background; + + procedure Background (Men : in Menu; + Back : out Character_Attribute_Set; + Color : out Color_Pair) + is + function Menu_Back (Men : Menu) return C_Int; + pragma Import (C, Menu_Back, "menu_back"); + begin + Back := CInt_To_Chtype (Menu_Back (Men)).Attr; + Color := CInt_To_Chtype (Menu_Back (Men)).Color; + end Background; + + procedure Set_Grey (Men : in Menu; + Grey : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) + is + function Set_Menu_Grey (Men : Menu; + Attr : C_Int) return C_Int; + pragma Import (C, Set_Menu_Grey, "set_menu_grey"); + + Ch : constant Attributed_Character := (Ch => Character'First, + Color => Color, + Attr => Grey); + + Res : constant Eti_Error := Set_Menu_Grey (Men, Chtype_To_CInt (Ch)); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Grey; + + procedure Grey (Men : in Menu; + Grey : out Character_Attribute_Set) + is + function Menu_Grey (Men : Menu) return C_Int; + pragma Import (C, Menu_Grey, "menu_grey"); + begin + Grey := CInt_To_Chtype (Menu_Grey (Men)).Attr; + end Grey; + + procedure Grey (Men : in Menu; + Grey : out Character_Attribute_Set; + Color : out Color_Pair) + is + function Menu_Grey (Men : Menu) return C_Int; + pragma Import (C, Menu_Grey, "menu_grey"); + begin + Grey := CInt_To_Chtype (Menu_Grey (Men)).Attr; + Color := CInt_To_Chtype (Menu_Grey (Men)).Color; + end Grey; + + procedure Set_Pad_Character (Men : in Menu; + Pad : in Character := Space) + is + function Set_Menu_Pad (Men : Menu; + Ch : C_Int) return C_Int; + pragma Import (C, Set_Menu_Pad, "set_menu_pad"); + + Res : constant Eti_Error := Set_Menu_Pad (Men, + C_Int (Character'Pos (Pad))); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Pad_Character; + + procedure Pad_Character (Men : in Menu; + Pad : out Character) + is + function Menu_Pad (Men : Menu) return C_Int; + pragma Import (C, Menu_Pad, "menu_pad"); + begin + Pad := Character'Val (Menu_Pad (Men)); + end Pad_Character; +------------------------------------------------------------------------------- + procedure Set_Spacing (Men : in Menu; + Descr : in Column_Position := 0; + Row : in Line_Position := 0; + Col : in Column_Position := 0) + is + function Set_Spacing (Men : Menu; + D, R, C : C_Int) return C_Int; + pragma Import (C, Set_Spacing, "set_menu_spacing"); + + Res : constant Eti_Error := Set_Spacing (Men, + C_Int (Descr), + C_Int (Row), + C_Int (Col)); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Spacing; + + procedure Spacing (Men : in Menu; + Descr : out Column_Position; + Row : out Line_Position; + Col : out Column_Position) + is + type C_Int_Access is access all C_Int; + function Get_Spacing (Men : Menu; + D, R, C : C_Int_Access) return C_Int; + pragma Import (C, Get_Spacing, "menu_spacing"); + + D, R, C : aliased C_Int; + Res : constant Eti_Error := Get_Spacing (Men, + D'Access, + R'Access, + C'Access); + begin + if Res /= E_Ok then + Eti_Exception (Res); + else + Descr := Column_Position (D); + Row := Line_Position (R); + Col := Column_Position (C); + end if; + end Spacing; +------------------------------------------------------------------------------- + function Set_Pattern (Men : Menu; + Text : String) return Boolean + is + type Char_Ptr is access all Interfaces.C.Char; + function Set_Pattern (Men : Menu; + Pattern : Char_Ptr) return C_Int; + pragma Import (C, Set_Pattern, "set_menu_pattern"); + + S : char_array (0 .. Text'Length); + L : size_t; + Res : Eti_Error; + begin + To_C (Text, S, L); + Res := Set_Pattern (Men, S (S'First)'Access); + case Res is + when E_No_Match => return False; + when E_Ok => return True; + when others => + Eti_Exception (Res); + return False; + end case; + end Set_Pattern; + + procedure Pattern (Men : in Menu; + Text : out String) + is + function Get_Pattern (Men : Menu) return chars_ptr; + pragma Import (C, Get_Pattern, "menu_pattern"); + begin + Fill_String (Get_Pattern (Men), Text); + end Pattern; +------------------------------------------------------------------------------- + procedure Set_Format (Men : in Menu; + Lines : in Line_Count; + Columns : in Column_Count) + is + function Set_Menu_Fmt (Men : Menu; + Lin : C_Int; + Col : C_Int) return C_Int; + pragma Import (C, Set_Menu_Fmt, "set_menu_format"); + + Res : constant Eti_Error := Set_Menu_Fmt (Men, + C_Int (Lines), + C_Int (Columns)); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Format; + + procedure Format (Men : in Menu; + Lines : out Line_Count; + Columns : out Column_Count) + is + type C_Int_Access is access all C_Int; + function Menu_Fmt (Men : Menu; + Y, X : C_Int_Access) return C_Int; + pragma Import (C, Menu_Fmt, "menu_format"); + + L, C : aliased C_Int; + Res : constant Eti_Error := Menu_Fmt (Men, L'Access, C'Access); + begin + if Res /= E_Ok then + Eti_Exception (Res); + else + Lines := Line_Count (L); + Columns := Column_Count (C); + end if; + end Format; +------------------------------------------------------------------------------- + procedure Set_Item_Init_Hook (Men : in Menu; + Proc : in Menu_Hook_Function) + is + function Set_Item_Init (Men : Menu; + Proc : Menu_Hook_Function) return C_Int; + pragma Import (C, Set_Item_Init, "set_item_init"); + + Res : constant Eti_Error := Set_Item_Init (Men, Proc); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Item_Init_Hook; + + procedure Set_Item_Term_Hook (Men : in Menu; + Proc : in Menu_Hook_Function) + is + function Set_Item_Term (Men : Menu; + Proc : Menu_Hook_Function) return C_Int; + pragma Import (C, Set_Item_Term, "set_item_term"); + + Res : constant Eti_Error := Set_Item_Term (Men, Proc); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Item_Term_Hook; + + procedure Set_Menu_Init_Hook (Men : in Menu; + Proc : in Menu_Hook_Function) + is + function Set_Menu_Init (Men : Menu; + Proc : Menu_Hook_Function) return C_Int; + pragma Import (C, Set_Menu_Init, "set_menu_init"); + + Res : constant Eti_Error := Set_Menu_Init (Men, Proc); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Menu_Init_Hook; + + procedure Set_Menu_Term_Hook (Men : in Menu; + Proc : in Menu_Hook_Function) + is + function Set_Menu_Term (Men : Menu; + Proc : Menu_Hook_Function) return C_Int; + pragma Import (C, Set_Menu_Term, "set_menu_term"); + + Res : constant Eti_Error := Set_Menu_Term (Men, Proc); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + end Set_Menu_Term_Hook; + + function Get_Item_Init_Hook (Men : Menu) return Menu_Hook_Function + is + function Item_Init (Men : Menu) return Menu_Hook_Function; + pragma Import (C, Item_Init, "item_init"); + begin + return Item_Init (Men); + end Get_Item_Init_Hook; + + function Get_Item_Term_Hook (Men : Menu) return Menu_Hook_Function + is + function Item_Term (Men : Menu) return Menu_Hook_Function; + pragma Import (C, Item_Term, "item_term"); + begin + return Item_Term (Men); + end Get_Item_Term_Hook; + + function Get_Menu_Init_Hook (Men : Menu) return Menu_Hook_Function + is + function Menu_Init (Men : Menu) return Menu_Hook_Function; + pragma Import (C, Menu_Init, "menu_init"); + begin + return Menu_Init (Men); + end Get_Menu_Init_Hook; + + function Get_Menu_Term_Hook (Men : Menu) return Menu_Hook_Function + is + function Menu_Term (Men : Menu) return Menu_Hook_Function; + pragma Import (C, Menu_Term, "menu_term"); + begin + return Menu_Term (Men); + end Get_Menu_Term_Hook; +------------------------------------------------------------------------------- + -- This is a bit delicate if we want to manipulate an Ada created menu + -- from C routines or vice versa. + -- In Ada created menus we use the low level user pointer to maintain + -- binding internal additional informations about the menu. This + -- internal information contains a hook for the Ada provided user pointer. + -- Unless you understand this implementation, the safest way in mixed + -- language programs to deal with user pointers is, that only the language + -- that created the menu should also manipulate the user pointer for that + -- menu. + procedure Redefine (Men : in Menu; + Items : in Item_Array) + is + function Set_Items (Men : Menu; + Items : Item_Array_Access) return C_Int; + pragma Import (C, Set_Items, "set_menu_items"); + + function Menu_Userptr (Men : Menu) return Ada_User_Wrapper_Access; + pragma Import (C, Menu_Userptr, "menu_userptr"); + + U : Ada_User_Wrapper_Access := Menu_Userptr (Men); + I : Item_Array_Access; + Res : Eti_Error; + begin + if U = null or else U.I = null then raise Menu_Exception; + else + -- create internally an array of items that contains an + -- additional place for the terminating null item. + I := new Item_Array (1 .. (Items'Length + 1)); + I.all (1 .. Items'Length) := Items (Items'First .. Items'Last); + I.all (Items'Length + 1) := Null_Item; + Res := Set_Items (Men, I); + if Res /= E_Ok then + Free_Allocated_Items (I); + Eti_Exception (Res); + else + Free_Allocated_Items (U.I); + U.I := I; + end if; + end if; + end Redefine; + + function Item_Count (Men : Menu) return Natural + is + function Count (Men : Menu) return C_Int; + pragma Import (C, Count, "item_count"); + begin + return Natural (Count (Men)); + end Item_Count; + + function Items (Men : Menu) return Item_Array_Access + is + function M_Items (Men : Menu) return Item_Array_Access; + pragma Import (C, M_Items, "menu_items"); + begin + return M_Items (Men); + end Items; + +------------------------------------------------------------------------------- + function Create (Items : Item_Array) return Menu + is + function Newmenu (Items : Item_Array_Access) return Menu; + pragma Import (C, Newmenu, "new_menu"); + + function Set_Menu_Userptr (Men : Menu; + Addr : Ada_User_Wrapper_Access) return C_Int; + pragma Import (C, Set_Menu_Userptr, "set_menu_userptr"); + + M : Menu; + I : Item_Array_Access; + U : Ada_User_Wrapper_Access; + Res : Eti_Error; + begin + I := new Item_Array (1 .. (Items'Length + 1)); + I.all (1 .. Items'Length) := Items (Items'First .. Items'Last); + I.all (Items'Length + 1) := Null_Item; + M := Newmenu (I); + if M = Null_Menu then + Free_Allocated_Items (I); + raise Menu_Exception; + end if; + U := new Ada_User_Wrapper' (System.Null_Address, I); + Res := Set_Menu_Userptr (M, U); + if Res /= E_Ok then + Free_Allocated_Items (I); + Free_User_Wrapper (U); + Eti_Exception (Res); + end if; + return M; + end Create; + + procedure Delete (Men : in out Menu) + is + function Free (Men : Menu) return C_Int; + pragma Import (C, Free, "free_menu"); + function Menu_Userptr (Men : Menu) return Ada_User_Wrapper_Access; + pragma Import (C, Menu_Userptr, "menu_userptr"); + + U : Ada_User_Wrapper_Access := Menu_Userptr (Men); + Res : constant Eti_Error := Free (Men); + begin + if Res /= E_Ok then + Eti_Exception (Res); + end if; + if U = null or else U.I = null then + raise Menu_Exception; + end if; + Free_Allocated_Items (U.I); + Free_User_Wrapper (U); + Men := Null_Menu; + end Delete; + +------------------------------------------------------------------------------ + function Driver (Men : Menu; + Key : Key_Code) return Driver_Result + is + function Driver (Men : Menu; + Key : C_Int) return C_Int; + pragma Import (C, Driver, "menu_driver"); + + R : Eti_Error := Driver (Men, C_Int (Key)); + begin + if R /= E_Ok then + case R is + when E_Unknown_Command => return Unknown_Request; + when E_No_Match => return No_Match; + when E_Request_Denied | + E_Not_Selectable => return Request_Denied; + when others => + Eti_Exception (R); + end case; + end if; + return Menu_Ok; + end Driver; +------------------------------------------------------------------------------- +begin + if Generation_Bit_Order /= System.Default_Bit_Order then + raise Constraint_Error; + end if; + + Default_Menu_Options := Get_Options (Null_Menu); + Default_Item_Options := Get_Options (Null_Item); +end Terminal_Interface.Curses.Menus; diff --git a/Ada95/ada_include/terminal_interface-curses-mouse.adb b/Ada95/ada_include/terminal_interface-curses-mouse.adb new file mode 100644 index 00000000..67aa6495 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-mouse.adb @@ -0,0 +1,152 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Mouse -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with System; + +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces; +with Interfaces.C; +with Unchecked_Conversion; + +package body Terminal_Interface.Curses.Mouse is + + use type System.Bit_Order; + use type Interfaces.C.int; + + function CInt_To_Mask is new + Unchecked_Conversion (Source => C_Int, + Target => Event_Mask); + + function Mask_To_CInt is new + Unchecked_Conversion (Source => Event_Mask, + Target => C_Int); + + function Get_Mouse return Mouse_Event + is + type Event_Access is access all Mouse_Event; + + function Getmouse (Ev : Event_Access) return C_Int; + pragma Import (C, Getmouse, "getmouse"); + + Event : aliased Mouse_Event; + begin + if Getmouse (Event'Access) = Curses_Err then + raise Curses_Exception; + end if; + return Event; + end Get_Mouse; + + procedure Register_Reportable_Event (B : in Mouse_Button; + S : in Button_State; + Mask : in out Event_Mask) + is + type Evt_Access is access all Event_Mask; + function Register (B : C_Int; + S : C_Int; + M : Evt_Access) return C_Int; + pragma Import (C, Register, "_nc_ada_mouse_mask"); + + T : aliased Event_Mask := Mask; + M : Evt_Access := T'Access; + R : constant C_Int := Register (C_Int (Mouse_Button'Pos (B)), + C_Int (Button_State'Pos (S)), + M); + begin + if R = Curses_Err then + raise Curses_Exception; + end if; + Mask := T; + end Register_Reportable_Event; + + function Start_Mouse (Mask : Event_Mask := All_Events) + return Event_Mask + is + type Int_Access is access all C_Int; + function MMask (M : C_Int; O : Int_Access := null) return C_Int; + pragma Import (C, MMask, "mousemask"); + R : C_Int; + begin + R := MMask (Mask_To_CInt (Mask)); + return CInt_To_Mask (R); + end Start_Mouse; + + procedure Get_Event (Event : in Mouse_Event; + Y : out Line_Position; + X : out Column_Position; + Button : out Mouse_Button; + State : out Button_State) + is + procedure Dispatch_Event (M : in C_Int; + B : out C_Int; + S : out C_Int); + pragma Import (C, Dispatch_Event, "_nc_ada_mouse_event"); + + Mask : constant Interfaces.C.int := Mask_To_CInt (Event.Bstate); + B, S : C_Int; + begin + X := Column_Position (Event.X); + Y := Line_Position (Event.Y); + Dispatch_Event (Mask, B, S); + Button := Mouse_Button'Val (B); + State := Button_State'Val (S); + end Get_Event; + + procedure Unget_Mouse (Event : in Mouse_Event) + is + function Ungetmouse (Ev : Mouse_Event) return C_Int; + pragma Import (C, Ungetmouse, "ungetmouse"); + begin + if Ungetmouse (Event) = Curses_Err then + raise Curses_Exception; + end if; + end Unget_Mouse; + + function Enclosed_In_Window (Win : Window := Standard_Window; + Event : Mouse_Event) return Boolean + is + function Wenclose (Win : Window; Y : C_Int; X : C_Int) return C_Int; + pragma Import (C, Wenclose, "wenclose"); + begin + if Wenclose (Win, C_Int (Event.Y), C_Int (Event.X)) = Curses_False then + return False; + else + return True; + end if; + end Enclosed_In_Window; + + function Mouse_Interval (Msec : Natural := 200) return Natural + is + function Mouseinterval (Msec : C_Int) return C_Int; + pragma Import (C, Mouseinterval, "mouseinterval"); + begin + return Natural (Mouseinterval (C_Int (Msec))); + end Mouse_Interval; + +begin + if Generation_Bit_Order /= System.Default_Bit_Order then + raise Constraint_Error; + end if; +end Terminal_Interface.Curses.Mouse; diff --git a/Ada95/ada_include/terminal_interface-curses-panels-user_data.adb b/Ada95/ada_include/terminal_interface-curses-panels-user_data.adb new file mode 100644 index 00000000..5d1c7e94 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-panels-user_data.adb @@ -0,0 +1,58 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Panels.User_Data -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Interfaces.C; +with Terminal_Interface.Curses.Aux; +use Terminal_Interface.Curses.Aux; +with Terminal_Interface.Curses.Panels; +use Terminal_Interface.Curses.Panels; + +package body Terminal_Interface.Curses.Panels.User_Data is + + use type Interfaces.C.int; + + procedure Set_User_Data (Pan : in Panel; + Data : in User_Access) + is + function Set_Panel_Userptr (Pan : Panel; + Addr : User_Access) return C_Int; + pragma Import (C, Set_Panel_Userptr, "set_panel_userptr"); + begin + if Set_Panel_Userptr (Pan, Data) = Curses_Err then + raise Panel_Exception; + end if; + end Set_User_Data; + + procedure Get_User_Data (Pan : in Panel; + Data : out User_Access) + is + function Panel_Userptr (Pan : Panel) return User_Access; + pragma Import (C, Panel_Userptr, "panel_userptr"); + begin + Data := Panel_Userptr (Pan); + end Get_User_Data; + +end Terminal_Interface.Curses.Panels.User_Data; diff --git a/Ada95/ada_include/terminal_interface-curses-panels.adb b/Ada95/ada_include/terminal_interface-curses-panels.adb new file mode 100644 index 00000000..74f7c1bd --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-panels.adb @@ -0,0 +1,150 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Panels -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; + +package body Terminal_Interface.Curses.Panels is + + use type Interfaces.C.int; + + function Create (Win : Window) return Panel + is + function Newpanel (Win : Window) return Panel; + pragma Import (C, Newpanel, "new_panel"); + + Pan : Panel; + begin + Pan := Newpanel (Win); + if Pan = Null_Panel then + raise Panel_Exception; + end if; + return Pan; + end Create; + + procedure Bottom (Pan : in Panel) + is + function Bottompanel (Pan : Panel) return C_Int; + pragma Import (C, Bottompanel, "bottom_panel"); + begin + if Bottompanel (Pan) = Curses_Err then + raise Panel_Exception; + end if; + end Bottom; + + procedure Top (Pan : in Panel) + is + function Toppanel (Pan : Panel) return C_Int; + pragma Import (C, Toppanel, "top_panel"); + begin + if Toppanel (Pan) = Curses_Err then + raise Panel_Exception; + end if; + end Top; + + procedure Show (Pan : in Panel) + is + function Showpanel (Pan : Panel) return C_Int; + pragma Import (C, Showpanel, "show_panel"); + begin + if Showpanel (Pan) = Curses_Err then + raise Panel_Exception; + end if; + end Show; + + procedure Hide (Pan : in Panel) + is + function Hidepanel (Pan : Panel) return C_Int; + pragma Import (C, Hidepanel, "hide_panel"); + begin + if Hidepanel (Pan) = Curses_Err then + raise Panel_Exception; + end if; + end Hide; + + function Get_Window (Pan : Panel) return Window + is + function Panel_Win (Pan : Panel) return Window; + pragma Import (C, Panel_Win, "panel_window"); + + Win : Window := Panel_Win (Pan); + begin + if Win = Null_Window then + raise Panel_Exception; + end if; + return Win; + end Get_Window; + + procedure Replace (Pan : in Panel; + Win : in Window) + is + function Replace_Pan (Pan : Panel; + Win : Window) return C_Int; + pragma Import (C, Replace_Pan, "replace_panel"); + begin + if Replace_Pan (Pan, Win) = Curses_Err then + raise Panel_Exception; + end if; + end Replace; + + procedure Move (Pan : in Panel; + Line : in Line_Position; + Column : in Column_Position) + is + function Move (Pan : Panel; + Line : C_Int; + Column : C_Int) return C_Int; + pragma Import (C, Move, "move_panel"); + begin + if Move (Pan, C_Int (Line), C_Int (Column)) = Curses_Err then + raise Panel_Exception; + end if; + end Move; + + function Is_Hidden (Pan : Panel) return Boolean + is + function Panel_Hidden (Pan : Panel) return C_Int; + pragma Import (C, Panel_Hidden, "panel_hidden"); + begin + if Panel_Hidden (Pan) = Curses_False then + return False; + else + return True; + end if; + end Is_Hidden; + + procedure Delete (Pan : in out Panel) + is + function Del_Panel (Pan : Panel) return C_Int; + pragma Import (C, Del_Panel, "del_panel"); + begin + if Del_Panel (Pan) = Curses_Err then + raise Panel_Exception; + end if; + Pan := Null_Panel; + end Delete; + +end Terminal_Interface.Curses.Panels; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-aux.adb b/Ada95/ada_include/terminal_interface-curses-text_io-aux.adb new file mode 100644 index 00000000..8be84489 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-aux.adb @@ -0,0 +1,114 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Aux -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +package body Terminal_Interface.Curses.Text_IO.Aux is + + procedure Put_Buf + (Win : in Window; + Buf : in String; + Width : in Field; + Signal : in Boolean := True; + Ljust : in Boolean := False) + is + L : Field; + Len : Field; + W : Field := Width; + LC : Line_Count; + CC : Column_Count; + Y : Line_Position; + X : Column_Position; + + procedure Output (From, To : Field); + + procedure Output (From, To : Field) + is + begin + if Len > 0 then + if W = 0 then + W := Len; + end if; + if Len > W then + -- LRM A10.6 (7) says this + W := Len; + end if; + + pragma Assert (Len <= W); + Get_Size (Win, LC, CC); + if Column_Count (Len) > CC then + if Signal then + raise Layout_Error; + else + return; + end if; + else + if Len < W and then not Ljust then + declare + Filler : constant String (1 .. (W - Len)) + := (others => ' '); + begin + Put (Win, Filler); + end; + end if; + Get_Cursor_Position (Win, Y, X); + if (X + Column_Position (Len)) > CC then + New_Line (Win); + end if; + Put (Win, Buf (From .. To)); + if Len < W and then Ljust then + declare + Filler : constant String (1 .. (W - Len)) + := (others => ' '); + begin + Put (Win, Filler); + end; + end if; + end if; + end if; + end Output; + + begin + pragma Assert (Win /= Null_Window); + if Ljust then + L := 1; + for I in 1 .. Buf'Length loop + exit when Buf (L) = ' '; + L := L + 1; + end loop; + Len := L - 1; + Output (1, Len); + else -- input buffer is not left justified + L := Buf'Length; + for I in 1 .. Buf'Length loop + exit when Buf (L) = ' '; + L := L - 1; + end loop; + Len := Buf'Length - L; + Output (L + 1, Buf'Length); + end if; + end Put_Buf; + +end Terminal_Interface.Curses.Text_IO.Aux; + diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-aux.ads b/Ada95/ada_include/terminal_interface-curses-text_io-aux.ads new file mode 100644 index 00000000..1582e6b0 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-aux.ads @@ -0,0 +1,40 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Aux -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +private package Terminal_Interface.Curses.Text_IO.Aux is + + -- This routine is called from the Text_IO output routines for numeric + -- and enumeration types. + -- + procedure Put_Buf + (Win : in Window; -- The output window + Buf : in String; -- The buffer containing the text + Width : in Field; -- The width of the output field + Signal : in Boolean := True; -- If true, we raise Layout_Error + Ljust : in Boolean := False); -- The Buf is left justified + +end Terminal_Interface.Curses.Text_IO.Aux; + diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-complex_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io-complex_io.adb new file mode 100644 index 00000000..a71ca20c --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-complex_io.adb @@ -0,0 +1,59 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Complex_IO -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses.Text_IO.Float_IO; + +package body Terminal_Interface.Curses.Text_IO.Complex_IO is + + package FIO is new + Terminal_Interface.Curses.Text_IO.Float_IO (Complex_Types.Real'Base); + + procedure Put + (Win : in Window; + Item : in Complex; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) + is + begin + Put (Win, '('); + FIO.Put (Win, Item.Re, Fore, Aft, Exp); + Put (Win, ','); + FIO.Put (Win, Item.Im, Fore, Aft, Exp); + Put (Win, ')'); + end Put; + + procedure Put + (Item : in Complex; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) + is + begin + Put (Get_Window, Item, Fore, Aft, Exp); + end Put; + +end Terminal_Interface.Curses.Text_IO.Complex_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-complex_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io-complex_io.ads new file mode 100644 index 00000000..dd895e97 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-complex_io.ads @@ -0,0 +1,56 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Complex_IO -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Ada.Numerics.Generic_Complex_Types; + +generic + with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (<>); + +package Terminal_Interface.Curses.Text_IO.Complex_IO is + + use Complex_Types; + + Default_Fore : Field := 2; + Default_Aft : Field := Real'Digits - 1; + Default_Exp : Field := 3; + + procedure Put + (Win : in Window; + Item : in Complex; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); + + procedure Put + (Item : in Complex; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); + +private + pragma Inline (Put); + +end Terminal_Interface.Curses.Text_IO.Complex_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.adb new file mode 100644 index 00000000..40596004 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.adb @@ -0,0 +1,61 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Decimal_IO -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Ada.Text_IO; +with Terminal_Interface.Curses.Text_IO.Aux; + +package body Terminal_Interface.Curses.Text_IO.Decimal_IO is + + package Aux renames Terminal_Interface.Curses.Text_IO.Aux; + package DIO is new Ada.Text_IO.Decimal_IO (Num); + + procedure Put + (Win : in Window; + Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) + is + Buf : String (1 .. Field'Last); + Len : Field := Fore + 1 + Aft; + begin + if Exp > 0 then + Len := Len + 1 + Exp; + end if; + DIO.Put (Buf, Item, Aft, Exp); + Aux.Put_Buf (Win, Buf, Len, False); + end Put; + + procedure Put + (Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) is + begin + Put (Get_Window, Item, Fore, Aft, Exp); + end Put; + +end Terminal_Interface.Curses.Text_IO.Decimal_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.ads new file mode 100644 index 00000000..d1e92453 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.ads @@ -0,0 +1,52 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Decimal_IO -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +generic + type Num is delta <> digits <>; + +package Terminal_Interface.Curses.Text_IO.Decimal_IO is + + Default_Fore : Field := Num'Fore; + Default_Aft : Field := Num'Aft; + Default_Exp : Field := 0; + + procedure Put + (Win : in Window; + Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); + + procedure Put + (Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); + +private + pragma Inline (Put); + +end Terminal_Interface.Curses.Text_IO.Decimal_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.adb new file mode 100644 index 00000000..633c1d87 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.adb @@ -0,0 +1,66 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Enumeration_IO -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Ada.Text_IO; +with Ada.Characters.Handling; use Ada.Characters.Handling; +with Terminal_Interface.Curses.Text_IO.Aux; + +package body Terminal_Interface.Curses.Text_IO.Enumeration_IO is + + package Aux renames Terminal_Interface.Curses.Text_IO.Aux; + package EIO is new Ada.Text_IO.Enumeration_IO (Enum); + + procedure Put + (Win : in Window; + Item : in Enum; + Width : in Field := Default_Width; + Set : in Type_Set := Default_Setting) + is + Buf : String (1 .. Field'Last); + Tset : Ada.Text_IO.Type_Set; + begin + if Set /= Mixed_Case then + Tset := Ada.Text_IO.Type_Set'Val (Type_Set'Pos (Set)); + else + Tset := Ada.Text_IO.Lower_Case; + end if; + EIO.Put (Buf, Item, Tset); + if Set = Mixed_Case then + Buf (Buf'First) := To_Upper (Buf (Buf'First)); + end if; + Aux.Put_Buf (Win, Buf, Width, True, True); + end Put; + + procedure Put + (Item : in Enum; + Width : in Field := Default_Width; + Set : in Type_Set := Default_Setting) + is + begin + Put (Get_Window, Item, Width, Set); + end Put; + +end Terminal_Interface.Curses.Text_IO.Enumeration_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.ads new file mode 100644 index 00000000..d715517c --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.ads @@ -0,0 +1,49 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Enumeration_IO -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +generic + type Enum is (<>); + +package Terminal_Interface.Curses.Text_IO.Enumeration_IO is + + Default_Width : Field := 0; + Default_Setting : Type_Set := Mixed_Case; + + procedure Put + (Win : in Window; + Item : in Enum; + Width : in Field := Default_Width; + Set : in Type_Set := Default_Setting); + + procedure Put + (Item : in Enum; + Width : in Field := Default_Width; + Set : in Type_Set := Default_Setting); + +private + pragma Inline (Put); + +end Terminal_Interface.Curses.Text_IO.Enumeration_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.adb new file mode 100644 index 00000000..76703f34 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.adb @@ -0,0 +1,61 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Fixed_IO -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Ada.Text_IO; +with Terminal_Interface.Curses.Text_IO.Aux; + +package body Terminal_Interface.Curses.Text_IO.Fixed_IO is + + package Aux renames Terminal_Interface.Curses.Text_IO.Aux; + package FIXIO is new Ada.Text_IO.Fixed_IO (Num); + + procedure Put + (Win : in Window; + Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) + is + Buf : String (1 .. Field'Last); + Len : Field := Fore + 1 + Aft; + begin + if Exp > 0 then + Len := Len + 1 + Exp; + end if; + FIXIO.Put (Buf, Item, Aft, Exp); + Aux.Put_Buf (Win, Buf, Len, False); + end Put; + + procedure Put + (Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) is + begin + Put (Get_Window, Item, Fore, Aft, Exp); + end Put; + +end Terminal_Interface.Curses.Text_IO.Fixed_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.ads new file mode 100644 index 00000000..f3c12647 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.ads @@ -0,0 +1,52 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Fixed_IO -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +generic + type Num is delta <>; + +package Terminal_Interface.Curses.Text_IO.Fixed_IO is + + Default_Fore : Field := Num'Fore; + Default_Aft : Field := Num'Aft; + Default_Exp : Field := 0; + + procedure Put + (Win : in Window; + Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); + + procedure Put + (Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); + +private + pragma Inline (Put); + +end Terminal_Interface.Curses.Text_IO.Fixed_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-float_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io-float_io.adb new file mode 100644 index 00000000..a6403743 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-float_io.adb @@ -0,0 +1,62 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Float_IO -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Ada.Text_IO; +with Terminal_Interface.Curses.Text_IO.Aux; + +package body Terminal_Interface.Curses.Text_IO.Float_IO is + + package Aux renames Terminal_Interface.Curses.Text_IO.Aux; + package FIO is new Ada.Text_IO.Float_IO (Num); + + procedure Put + (Win : in Window; + Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) + is + Buf : String (1 .. Field'Last); + Len : Field := Fore + 1 + Aft; + begin + if Exp > 0 then + Len := Len + 1 + Exp; + end if; + FIO.Put (Buf, Item, Aft, Exp); + Aux.Put_Buf (Win, Buf, Len, False); + end Put; + + procedure Put + (Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) + is + begin + Put (Get_Window, Item, Fore, Aft, Exp); + end Put; + +end Terminal_Interface.Curses.Text_IO.Float_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-float_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io-float_io.ads new file mode 100644 index 00000000..670407a5 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-float_io.ads @@ -0,0 +1,52 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Float_IO -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +generic + type Num is digits <>; + +package Terminal_Interface.Curses.Text_IO.Float_IO is + + Default_Fore : Field := 2; + Default_Aft : Field := Num'Digits - 1; + Default_Exp : Field := 3; + + procedure Put + (Win : in Window; + Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); + + procedure Put + (Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); + +private + pragma Inline (Put); + +end Terminal_Interface.Curses.Text_IO.Float_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-integer_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io-integer_io.adb new file mode 100644 index 00000000..6f4ab6ee --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-integer_io.adb @@ -0,0 +1,56 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Integer_IO -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Ada.Text_IO; +with Terminal_Interface.Curses.Text_IO.Aux; + +package body Terminal_Interface.Curses.Text_IO.Integer_IO is + + package Aux renames Terminal_Interface.Curses.Text_IO.Aux; + package IIO is new Ada.Text_IO.Integer_IO (Num); + + procedure Put + (Win : in Window; + Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base) + is + Buf : String (1 .. Field'Last); + begin + IIO.Put (Buf, Item, Base); + Aux.Put_Buf (Win, Buf, Width); + end Put; + + procedure Put + (Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base) + is + begin + Put (Get_Window, Item, Width, Base); + end Put; + +end Terminal_Interface.Curses.Text_IO.Integer_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-integer_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io-integer_io.ads new file mode 100644 index 00000000..69e9661f --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-integer_io.ads @@ -0,0 +1,49 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Integer_IO -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +generic + type Num is range <>; + +package Terminal_Interface.Curses.Text_IO.Integer_IO is + + Default_Width : Field := Num'Width; + Default_Base : Number_Base := 10; + + procedure Put + (Win : in Window; + Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base); + + procedure Put + (Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base); + +private + pragma Inline (Put); + +end Terminal_Interface.Curses.Text_IO.Integer_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-modular_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io-modular_io.adb new file mode 100644 index 00000000..d4399c4b --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-modular_io.adb @@ -0,0 +1,56 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Modular_IO -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Ada.Text_IO; +with Terminal_Interface.Curses.Text_IO.Aux; + +package body Terminal_Interface.Curses.Text_IO.Modular_IO is + + package Aux renames Terminal_Interface.Curses.Text_IO.Aux; + package MIO is new Ada.Text_IO.Modular_IO (Num); + + procedure Put + (Win : in Window; + Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base) + is + Buf : String (1 .. Field'Last); + begin + MIO.Put (Buf, Item, Base); + Aux.Put_Buf (Win, Buf, Width); + end Put; + + procedure Put + (Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base) + is + begin + Put (Get_Window, Item, Width, Base); + end Put; + +end Terminal_Interface.Curses.Text_IO.Modular_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io-modular_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io-modular_io.ads new file mode 100644 index 00000000..1f0b3467 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io-modular_io.ads @@ -0,0 +1,49 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO.Modular_IO -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +generic + type Num is mod <>; + +package Terminal_Interface.Curses.Text_IO.Modular_IO is + + Default_Width : Field := Num'Width; + Default_Base : Number_Base := 10; + + procedure Put + (Win : in Window; + Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base); + + procedure Put + (Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base); + +private + pragma Inline (Put); + +end Terminal_Interface.Curses.Text_IO.Modular_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io.adb b/Ada95/ada_include/terminal_interface-curses-text_io.adb new file mode 100644 index 00000000..794d6830 --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io.adb @@ -0,0 +1,327 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +with System; + +package body Terminal_Interface.Curses.Text_IO is + + Default_Window : Window; + + procedure Set_Window (Win : in Window) + is + begin + Default_Window := Win; + end Set_Window; + + function Get_Window return Window + is + begin + if Default_Window = Null_Window then + return Standard_Window; + else + return Default_Window; + end if; + end Get_Window; + pragma Inline (Get_Window); + + procedure Flush (Win : in Window) + is + begin + Refresh (Win); + end Flush; + + procedure Flush + is + begin + Flush (Get_Window); + end Flush; + + -------------------------------------------- + -- Specification of line and page lengths -- + -------------------------------------------- + + -- There are no set routines in this package. I assume, that you allocate + -- the window with an appropriate size. + -- A scroll-window is interpreted as an page with unbounded page length, + -- i.e. it returns the conventional 0 as page length. + + function Line_Length (Win : in Window) return Count + is + N_Lines : Line_Count; + N_Cols : Column_Count; + begin + Get_Size (Win, N_Lines, N_Cols); + if Natural (N_Cols) > Natural (Count'Last) then + raise Layout_Error; + end if; + return Count (N_Cols); + end Line_Length; + + function Line_Length return Count + is + begin + return Line_Length (Get_Window); + end Line_Length; + + function Page_Length (Win : in Window) return Count + is + N_Lines : Line_Count; + N_Cols : Column_Count; + begin + if Scrolling_Allowed (Win) then + return 0; + else + Get_Size (Win, N_Lines, N_Cols); + if Natural (N_Lines) > Natural (Count'Last) then + raise Layout_Error; + end if; + return Count (N_Lines); + end if; + end Page_Length; + + function Page_Length return Count + is + begin + return Page_Length (Get_Window); + end Page_Length; + + ------------------------------------ + -- Column, Line, and Page Control -- + ------------------------------------ + procedure New_Line (Win : in Window; Spacing : in Positive_Count := 1) + is + P_Size : constant Count := Page_Length (Win); + begin + if Spacing not in Positive_Count then + raise Constraint_Error; + end if; + + for I in 1 .. Spacing loop + if P_Size > 0 and then Line (Win) >= P_Size then + New_Page (Win); + else + Add (Win, Ascii.LF); + end if; + end loop; + end New_Line; + + procedure New_Line (Spacing : in Positive_Count := 1) + is + begin + New_Line (Get_Window, Spacing); + end New_Line; + + procedure New_Page (Win : in Window) + is + begin + Clear (Win); + end New_Page; + + procedure New_Page + is + begin + New_Page (Get_Window); + end New_Page; + + procedure Set_Col (Win : in Window; To : in Positive_Count) + is + Y : Line_Position; + X1 : Column_Position; + X2 : Column_Position; + N : Natural; + begin + if To not in Positive_Count then + raise Constraint_Error; + end if; + + Get_Cursor_Position (Win, Y, X1); + N := Natural (To); N := N - 1; + X2 := Column_Position (N); + if X1 > X2 then + New_Line (Win, 1); + X1 := 0; + end if; + if X1 < X2 then + declare + Filler : constant String (Integer (X1) .. (Integer (X2) - 1)) + := (others => ' '); + begin + Put (Win, Filler); + end; + end if; + end Set_Col; + + procedure Set_Col (To : in Positive_Count) + is + begin + Set_Col (Get_Window, To); + end Set_Col; + + procedure Set_Line (Win : in Window; To : in Positive_Count) + is + Y1 : Line_Position; + Y2 : Line_Position; + X : Column_Position; + N : Natural; + begin + if To not in Positive_Count then + raise Constraint_Error; + end if; + + Get_Cursor_Position (Win, Y1, X); + N := Natural (To); N := N - 1; + Y2 := Line_Position (N); + if Y2 < Y1 then + New_Page (Win); + Y1 := 0; + end if; + if Y1 < Y2 then + New_Line (Win, Positive_Count (Y2 - Y1)); + end if; + end Set_Line; + + procedure Set_Line (To : in Positive_Count) + is + begin + Set_Line (Get_Window, To); + end Set_Line; + + function Col (Win : in Window) return Positive_Count + is + Y : Line_Position; + X : Column_Position; + N : Natural; + begin + Get_Cursor_Position (Win, Y, X); + N := Natural (X); N := N + 1; + if N > Natural (Count'Last) then + raise Layout_Error; + end if; + return Positive_Count (N); + end Col; + + function Col return Positive_Count + is + begin + return Col (Get_Window); + end Col; + + function Line (Win : in Window) return Positive_Count + is + Y : Line_Position; + X : Column_Position; + N : Natural; + begin + Get_Cursor_Position (Win, Y, X); + N := Natural (Y); N := N + 1; + if N > Natural (Count'Last) then + raise Layout_Error; + end if; + return Positive_Count (N); + end Line; + + function Line return Positive_Count + is + begin + return Line (Get_Window); + end Line; + + ----------------------- + -- Characters Output -- + ----------------------- + + procedure Put (Win : in Window; Item : in Character) + is + P_Size : constant Count := Page_Length (Win); + Y : Line_Position; + X : Column_Position; + L : Line_Count; + C : Column_Count; + begin + if P_Size > 0 then + Get_Cursor_Position (Win, Y, X); + Get_Size (Win, L, C); + if (Y + 1) = L and then (X + 1) = C then + New_Page (Win); + end if; + end if; + Add (Win, Item); + end Put; + + procedure Put (Item : in Character) + is + begin + Put (Get_Window, Item); + end Put; + + -------------------- + -- Strings-Output -- + -------------------- + + procedure Put (Win : in Window; Item : in String) + is + P_Size : constant Count := Page_Length (Win); + Y : Line_Position; + X : Column_Position; + L : Line_Count; + C : Column_Count; + begin + if P_Size > 0 then + Get_Cursor_Position (Win, Y, X); + Get_Size (Win, L, C); + if (Y + 1) = L and then (X + 1 + Item'Length) >= C then + New_Page (Win); + end if; + end if; + Add (Win, Item); + end Put; + + procedure Put (Item : in String) + is + begin + Put (Get_Window, Item); + end Put; + + procedure Put_Line + (Win : in Window; + Item : in String) + is + begin + Put (Win, Item); + New_Line (Win, 1); + end Put_Line; + + procedure Put_Line + (Item : in String) + is + begin + Put_Line (Get_Window, Item); + end Put_Line; + +begin + Default_Window := Null_Window; + +end Terminal_Interface.Curses.Text_IO; diff --git a/Ada95/ada_include/terminal_interface-curses-text_io.ads b/Ada95/ada_include/terminal_interface-curses-text_io.ads new file mode 100644 index 00000000..7b057aaf --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses-text_io.ads @@ -0,0 +1,124 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Text_IO -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.5 $ +------------------------------------------------------------------------------ +with System; +with System.Parameters; +with Ada.Text_IO; +with Ada.IO_Exceptions; + +package Terminal_Interface.Curses.Text_IO is + + use type Ada.Text_IO.Count; + subtype Count is Ada.Text_IO.Count; + subtype Positive_Count is Count range 1 .. Count'Last; + + subtype Field is Integer range 0 .. System.Parameters.Field_Max; + subtype Number_Base is Integer range 2 .. 16; + + type Type_Set is (Lower_Case, Upper_Case, Mixed_Case); + + -- For most of the routines you will see a version without a Window + -- type parameter. They will operate on a default window, which can + -- be set by the user. It is initially equal to Standard_Window. + + procedure Set_Window (Win : in Window); + -- Set Win as the default window + + function Get_Window return Window; + -- Get the current default window + + procedure Flush (Win : in Window); + procedure Flush; + + -------------------------------------------- + -- Specification of line and page lengths -- + -------------------------------------------- + + -- There are no set routines in this package. I assume, that you allocate + -- the window with an appropriate size. + -- A scroll-window is interpreted as an page with unbounded page length, + -- i.e. it returns the conventional 0 as page length. + + function Line_Length (Win : in Window) return Count; + function Line_Length return Count; + + function Page_Length (Win : in Window) return Count; + function Page_Length return Count; + + ------------------------------------ + -- Column, Line, and Page Control -- + ------------------------------------ + procedure New_Line (Win : in Window; Spacing : in Positive_Count := 1); + procedure New_Line (Spacing : in Positive_Count := 1); + + procedure New_Page (Win : in Window); + procedure New_Page; + + procedure Set_Col (Win : in Window; To : in Positive_Count); + procedure Set_Col (To : in Positive_Count); + + procedure Set_Line (Win : in Window; To : in Positive_Count); + procedure Set_Line (To : in Positive_Count); + + function Col (Win : in Window) return Positive_Count; + function Col return Positive_Count; + + function Line (Win : in Window) return Positive_Count; + function Line return Positive_Count; + + ----------------------- + -- Characters-Output -- + ----------------------- + + procedure Put (Win : in Window; Item : in Character); + procedure Put (Item : in Character); + + -------------------- + -- Strings-Output -- + -------------------- + + procedure Put (Win : in Window; Item : in String); + procedure Put (Item : in String); + + procedure Put_Line + (Win : in Window; + Item : in String); + + procedure Put_Line + (Item : in String); + + -- Exceptions + + Status_Error : exception renames Ada.IO_Exceptions.Status_Error; + Mode_Error : exception renames Ada.IO_Exceptions.Mode_Error; + Name_Error : exception renames Ada.IO_Exceptions.Name_Error; + Use_Error : exception renames Ada.IO_Exceptions.Use_Error; + Device_Error : exception renames Ada.IO_Exceptions.Device_Error; + End_Error : exception renames Ada.IO_Exceptions.End_Error; + Data_Error : exception renames Ada.IO_Exceptions.Data_Error; + Layout_Error : exception renames Ada.IO_Exceptions.Layout_Error; + +end Terminal_Interface.Curses.Text_IO; diff --git a/Ada95/ada_include/terminal_interface-curses.adb b/Ada95/ada_include/terminal_interface-curses.adb new file mode 100644 index 00000000..f5d2478b --- /dev/null +++ b/Ada95/ada_include/terminal_interface-curses.adb @@ -0,0 +1,2271 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.7 $ +------------------------------------------------------------------------------ +with System; + +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; use Interfaces.C; +with Interfaces.C.Strings; use Interfaces.C.Strings; +with Ada.Characters.Handling; use Ada.Characters.Handling; +with Unchecked_Conversion; + +package body Terminal_Interface.Curses is + + use type System.Bit_Order; + + type chtype_array is array (size_t range <>) + of aliased Attributed_Character; + pragma Pack (chtype_array); + pragma Convention (C, chtype_array); + +------------------------------------------------------------------------------ + procedure Key_Name (Key : in Real_Key_Code; + Name : out String) + is + function Keyname (K : C_Int) return chars_ptr; + pragma Import (C, Keyname, "keyname"); + + Ch : Character; + begin + if Key <= Character'Pos (Character'Last) then + Ch := Character'Val (Key); + if Is_Control (Ch) then + Un_Control (Attributed_Character'(Ch => Ch, + Color => Color_Pair'First, + Attr => Normal_Video), + Name); + elsif Is_Graphic (Ch) then + Fill_String (Null_Ptr, Name); + Name (Name'First) := Ch; + else + Fill_String (Null_Ptr, Name); + end if; + else + Fill_String (Keyname (C_Int (Key)), Name); + end if; + end Key_Name; +------------------------------------------------------------------------------ + procedure Init_Screen + is + function Initscr return Window; + pragma Import (C, Initscr, "initscr"); + + W : Window; + begin + W := Initscr; + if W = Null_Window then + raise Curses_Exception; + end if; + end Init_Screen; + + procedure End_Windows + is + function Endwin return C_Int; + pragma Import (C, Endwin, "endwin"); + begin + if Endwin = Curses_Err then + raise Curses_Exception; + end if; + end End_Windows; + + function Is_End_Window return Boolean + is + function Isendwin return C_Int; + pragma Import (C, Isendwin, "isendwin"); + begin + if Isendwin = Curses_False then + return False; + else + return True; + end if; + end Is_End_Window; +------------------------------------------------------------------------------ + procedure Move_Cursor (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position) + is + function Wmove (Win : Window; + Line : C_Int; + Column : C_Int + ) return C_Int; + pragma Import (C, Wmove, "wmove"); + begin + if Wmove (Win, C_Int (Line), C_Int (Column)) = Curses_Err then + raise Curses_Exception; + end if; + end Move_Cursor; +------------------------------------------------------------------------------ + procedure Add (Win : in Window := Standard_Window; + Ch : in Attributed_Character) + is + function Waddch (W : Window; + Ch : C_Int) return C_Int; + pragma Import (C, Waddch, "waddch"); + begin + if Waddch (Win, Chtype_To_Cint (Ch)) = Curses_Err then + raise Curses_Exception; + end if; + end Add; + + procedure Add (Win : in Window := Standard_Window; + Ch : in Character) + is + begin + Add (Win, + Attributed_Character'(Ch => Ch, + Color => Color_Pair'First, + Attr => Normal_Video)); + end Add; + + procedure Add + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Ch : in Attributed_Character) + is + function mvwaddch (W : Window; + Y : C_Int; + X : C_Int; + Ch : C_Int) return C_Int; + pragma Import (C, mvwaddch, "mvwaddch"); + begin + if mvwaddch (Win, C_Int (Line), + C_Int (Column), + Chtype_To_CInt (Ch)) = Curses_Err then + raise Curses_Exception; + end if; + end Add; + + procedure Add + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Ch : in Character) + is + begin + Add (Win, + Line, + Column, + Attributed_Character'(Ch => Ch, + Color => Color_Pair'First, + Attr => Normal_Video)); + end Add; + + procedure Add_With_Immediate_Echo + (Win : in Window := Standard_Window; + Ch : in Attributed_Character) + is + function Wechochar (W : Window; + Ch : C_Int) return C_Int; + pragma Import (C, Wechochar, "wechochar"); + begin + if Wechochar (Win, Chtype_To_CInt (Ch)) = Curses_Err then + raise Curses_Exception; + end if; + end Add_With_Immediate_Echo; + + procedure Add_With_Immediate_Echo + (Win : in Window := Standard_Window; + Ch : in Character) + is + begin + Add_With_Immediate_Echo + (Win, + Attributed_Character'(Ch => Ch, + Color => Color_Pair'First, + Attr => Normal_Video)); + end Add_With_Immediate_Echo; +------------------------------------------------------------------------------ + function Create (Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; + First_Column_Position : Column_Position) return Window + is + function Newwin (Number_Of_Lines : C_Int; + Number_Of_Columns : C_Int; + First_Line_Position : C_Int; + First_Column_Position : C_Int) return Window; + pragma Import (C, Newwin, "newwin"); + + W : Window; + begin + W := Newwin (C_Int (Number_Of_Lines), + C_Int (Number_Of_Columns), + C_Int (First_Line_Position), + C_Int (First_Column_Position)); + if W = Null_Window then + raise Curses_Exception; + end if; + return W; + end Create; + + procedure Delete (Win : in out Window) + is + function Wdelwin (W : Window) return C_Int; + pragma Import (C, Wdelwin, "delwin"); + begin + if Wdelwin (Win) = Curses_Err then + raise Curses_Exception; + end if; + Win := Null_Window; + end Delete; + + function Sub_Window + (Win : Window := Standard_Window; + Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; + First_Column_Position : Column_Position) return Window + is + function Subwin + (Win : Window; + Number_Of_Lines : C_Int; + Number_Of_Columns : C_Int; + First_Line_Position : C_Int; + First_Column_Position : C_Int) return Window; + pragma Import (C, Subwin, "subwin"); + + W : Window; + begin + W := Subwin (Win, + C_Int (Number_Of_Lines), + C_Int (Number_Of_Columns), + C_Int (First_Line_Position), + C_Int (First_Column_Position)); + if W = Null_Window then + raise Curses_Exception; + end if; + return W; + end Sub_Window; + + function Derived_Window + (Win : Window := Standard_Window; + Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; + First_Column_Position : Column_Position) return Window + is + function Derwin + (Win : Window; + Number_Of_Lines : C_Int; + Number_Of_Columns : C_Int; + First_Line_Position : C_Int; + First_Column_Position : C_Int) return Window; + pragma Import (C, Derwin, "derwin"); + + W : Window; + begin + W := Derwin (Win, + C_Int (Number_Of_Lines), + C_Int (Number_Of_Columns), + C_Int (First_Line_Position), + C_Int (First_Column_Position)); + if W = Null_Window then + raise Curses_Exception; + end if; + return W; + end Derived_Window; + + function Duplicate (Win : Window) return Window + is + function Dupwin (Win : Window) return Window; + pragma Import (C, Dupwin, "dupwin"); + + W : Window := Dupwin (Win); + begin + if W = Null_Window then + raise Curses_Exception; + end if; + return W; + end Duplicate; + + procedure Move_Window (Win : in Window; + Line : in Line_Position; + Column : in Column_Position) + is + function Mvwin (Win : Window; + Line : C_Int; + Column : C_Int) return C_Int; + pragma Import (C, Mvwin, "mvwin"); + begin + if Mvwin (Win, C_Int (Line), C_Int (Column)) = Curses_Err then + raise Curses_Exception; + end if; + end Move_Window; + + procedure Move_Derived_Window (Win : in Window; + Line : in Line_Position; + Column : in Column_Position) + is + function Mvderwin (Win : Window; + Line : C_Int; + Column : C_Int) return C_Int; + pragma Import (C, Mvderwin, "mvderwin"); + begin + if Mvderwin (Win, C_Int (Line), C_Int (Column)) = Curses_Err then + raise Curses_Exception; + end if; + end Move_Derived_Window; + + procedure Set_Synch_Mode (Win : in Window := Standard_Window; + Mode : in Boolean := False) + is + function Syncok (Win : Window; + Mode : C_Int) return C_Int; + pragma Import (C, Syncok, "syncok"); + begin + if Syncok (Win, Boolean'Pos (Mode)) = Curses_Err then + raise Curses_Exception; + end if; + end Set_Synch_Mode; +------------------------------------------------------------------------------ + procedure Add (Win : in Window := Standard_Window; + Str : in String; + Len : in Integer := -1) + is + type Char_Ptr is access all Interfaces.C.Char; + function Waddnstr (Win : Window; + Str : Char_Ptr; + Len : Integer := -1) return C_Int; + pragma Import (C, Waddnstr, "waddnstr"); + + Txt : char_array (0 .. Str'Length); + Length : size_t; + begin + To_C (Str, Txt, Length); + if Waddnstr (Win, Txt (Txt'First)'Access, Len) = Curses_Err then + raise Curses_Exception; + end if; + end Add; + + procedure Add + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : in String; + Len : in Integer := -1) + is + begin + Move_Cursor (Win, Line, Column); + Add (Win, Str, Len); + end Add; +------------------------------------------------------------------------------ + procedure Add + (Win : in Window := Standard_Window; + Str : in Attributed_String; + Len : in Integer := -1) + is + type Chtype_Ptr is access all Attributed_Character; + function Waddchnstr (Win : Window; + Str : Chtype_Ptr; + Len : Integer := -1) return C_Int; + pragma Import (C, Waddchnstr, "waddchnstr"); + + Txt : chtype_array (0 .. Str'Length); + begin + for Length in 1 .. size_t (Str'Length) loop + Txt (Length - 1) := Str (Natural (Length)); + end loop; + Txt (Str'Length) := Default_Character; + if Waddchnstr (Win, Txt (Txt'First)'Access, Len) = Curses_Err then + raise Curses_Exception; + end if; + end Add; + + procedure Add + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : in Attributed_String; + Len : in Integer := -1) + is + begin + Move_Cursor (Win, Line, Column); + Add (Win, Str, Len); + end Add; +------------------------------------------------------------------------------ + procedure Border + (Win : in Window := Standard_Window; + Left_Side_Symbol : in Attributed_Character := Default_Character; + Right_Side_Symbol : in Attributed_Character := Default_Character; + Top_Side_Symbol : in Attributed_Character := Default_Character; + Bottom_Side_Symbol : in Attributed_Character := Default_Character; + Upper_Left_Corner_Symbol : in Attributed_Character := Default_Character; + Upper_Right_Corner_Symbol : in Attributed_Character := Default_Character; + Lower_Left_Corner_Symbol : in Attributed_Character := Default_Character; + Lower_Right_Corner_Symbol : in Attributed_Character := Default_Character) + is + function Wborder (W : Window; + LS : C_Int; + RS : C_Int; + TS : C_Int; + BS : C_Int; + ULC : C_Int; + URC : C_Int; + LLC : C_Int; + LRC : C_Int) return C_Int; + pragma Import (C, Wborder, "wborder"); + begin + if Wborder (Win, + Chtype_To_CInt (Left_Side_Symbol), + Chtype_To_CInt (Right_Side_Symbol), + Chtype_To_CInt (Top_Side_Symbol), + Chtype_To_CInt (Bottom_Side_Symbol), + Chtype_To_CInt (Upper_Left_Corner_Symbol), + Chtype_To_CInt (Upper_Right_Corner_Symbol), + Chtype_To_CInt (Lower_Left_Corner_Symbol), + Chtype_To_CInt (Lower_Right_Corner_Symbol) + ) = Curses_Err + then + raise Curses_Exception; + end if; + end Border; + + procedure Box + (Win : in Window := Standard_Window; + Vertical_Symbol : in Attributed_Character := Default_Character; + Horizontal_Symbol : in Attributed_Character := Default_Character) + is + begin + Border (Win, + Vertical_Symbol, Vertical_Symbol, + Horizontal_Symbol, Horizontal_Symbol); + end Box; + + procedure Horizontal_Line + (Win : in Window := Standard_Window; + Line_Size : in Natural; + Line_Symbol : in Attributed_Character := Default_Character) + is + function Whline (W : Window; + Ch : C_Int; + Len : C_Int) return C_Int; + pragma Import (C, Whline, "whline"); + begin + if Whline (Win, + Chtype_To_CInt (Line_Symbol), + C_Int (Line_Size)) = Curses_Err then + raise Curses_Exception; + end if; + end Horizontal_Line; + + procedure Vertical_Line + (Win : in Window := Standard_Window; + Line_Size : in Natural; + Line_Symbol : in Attributed_Character := Default_Character) + is + function Wvline (W : Window; + Ch : C_Int; + Len : C_Int) return C_Int; + pragma Import (C, Wvline, "wvline"); + begin + if Wvline (Win, + Chtype_To_CInt (Line_Symbol), + C_Int (Line_Size)) = Curses_Err then + raise Curses_Exception; + end if; + end Vertical_Line; + +------------------------------------------------------------------------------ + function Get_Keystroke (Win : Window := Standard_Window) + return Real_Key_Code + is + function Wgetch (W : Window) return C_Int; + pragma Import (C, Wgetch, "wgetch"); + + C : constant C_Int := Wgetch (Win); + begin + if C = Curses_Err then + return Key_None; + else + return Real_Key_Code (C); + end if; + end Get_Keystroke; + + procedure Undo_Keystroke (Key : in Real_Key_Code) + is + function Ungetch (Ch : C_Int) return C_Int; + pragma Import (C, Ungetch, "ungetch"); + begin + if Ungetch (C_Int (Key)) = Curses_Err then + raise Curses_Exception; + end if; + end Undo_Keystroke; + + function Has_Key (Key : Special_Key_Code) return Boolean + is + function Haskey (Key : C_Int) return C_Int; + pragma Import (C, Haskey, "has_key"); + begin + if Haskey (C_Int (Key)) = Curses_False then + return False; + else + return True; + end if; + end Has_Key; + + function Is_Function_Key (Key : Special_Key_Code) return Boolean + is + L : constant Special_Key_Code := Special_Key_Code (Natural (Key_F0) + + Natural (Function_Key_Number'Last)); + begin + if (Key >= Key_F0) and then (Key <= L) then + return True; + else + return False; + end if; + end Is_Function_Key; + + function Function_Key (Key : Real_Key_Code) + return Function_Key_Number + is + begin + if Is_Function_Key (Key) then + return Function_Key_Number (Key - Key_F0); + else + raise Constraint_Error; + end if; + end Function_Key; + + function Function_Key_Code (Key : Function_Key_Number) return Real_Key_Code + is + begin + return Real_Key_Code (Natural (Key_F0) + Natural (Key)); + end Function_Key_Code; +------------------------------------------------------------------------------ + procedure Switch_Character_Attribute + (Win : in Window := Standard_Window; + Attr : in Character_Attribute_Set := Normal_Video; + On : in Boolean := True) + is + function Wattron (Win : Window; + C_Attr : C_Int) return C_Int; + pragma Import (C, Wattron, "wattr_on"); + function Wattroff (Win : Window; + C_Attr : C_Int) return C_Int; + pragma Import (C, Wattroff, "wattr_off"); + -- In Ada we use the On Boolean to control whether or not we want to + -- switch on or off the attributes in the set. + Err : C_Int; + AC : constant Attributed_Character := (Ch => Character'First, + Color => Color_Pair'First, + Attr => Attr); + begin + if On then + Err := Wattron (Win, Chtype_To_CInt (AC)); + else + Err := Wattroff (Win, Chtype_To_CInt (AC)); + end if; + if Err = Curses_Err then + raise Curses_Exception; + end if; + end Switch_Character_Attribute; + + procedure Set_Character_Attributes + (Win : in Window := Standard_Window; + Attr : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) + is + function Wattrset (Win : Window; + C_Attr : C_Int) return C_Int; + pragma Import (C, Wattrset, "wattrset"); -- ??? wattr_set + begin + if Wattrset (Win, + Chtype_To_CInt (Attributed_Character' + (Ch => Character'First, + Color => Color, + Attr => Attr))) = Curses_Err then + raise Curses_Exception; + end if; + end Set_Character_Attributes; + + function Get_Character_Attribute (Win : Window := Standard_Window) + return Character_Attribute_Set + is + function Wattrget (Win : Window) return C_Int; + pragma Import (C, Wattrget, "wattr_get"); + + Ch : Attributed_Character := CInt_To_Chtype (Wattrget (Win)); + begin + return Ch.Attr; + end Get_Character_Attribute; + + function Get_Character_Attribute (Win : Window := Standard_Window) + return Color_Pair + is + function Wattrget (Win : Window) return C_Int; + pragma Import (C, Wattrget, "wattr_get"); + + Ch : Attributed_Character := CInt_To_Chtype (Wattrget (Win)); + begin + return Ch.Color; + end Get_Character_Attribute; + + procedure Change_Attributes + (Win : in Window := Standard_Window; + Count : in Integer := -1; + Attr : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) + is + function Wchgat (Win : Window; + Cnt : C_Int; + Attr : C_Int; + Color : C_Short; + Opts : System.Address := System.Null_Address) + return C_Int; + pragma Import (C, Wchgat, "wchgat"); + + Ch : constant Attributed_Character := + (Ch => Character'First, Color => Color_Pair'First, Attr => Attr); + begin + if Wchgat (Win, C_Int (Count), Chtype_To_CInt (Ch), + C_Short (Color)) = Curses_Err then + raise Curses_Exception; + end if; + end Change_Attributes; + + procedure Change_Attributes + (Win : in Window := Standard_Window; + Line : in Line_Position := Line_Position'First; + Column : in Column_Position := Column_Position'First; + Count : in Integer := -1; + Attr : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) + is + begin + Move_Cursor (Win, Line, Column); + Change_Attributes (Win, Count, Attr, Color); + end Change_Attributes; +------------------------------------------------------------------------------ + procedure Beep + is + function Beeper return C_Int; + pragma Import (C, Beeper, "beep"); + begin + if Beeper = Curses_Err then + raise Curses_Exception; + end if; + end Beep; + + procedure Flash_Screen + is + function Flash return C_Int; + pragma Import (C, Flash, "flash"); + begin + if Flash = Curses_Err then + raise Curses_Exception; + end if; + end Flash_Screen; +------------------------------------------------------------------------------ + procedure Set_Cbreak_Mode (SwitchOn : in Boolean := True) + is + function Cbreak return C_Int; + pragma Import (C, Cbreak, "cbreak"); + function NoCbreak return C_Int; + pragma Import (C, NoCbreak, "nocbreak"); + + Err : C_Int; + begin + if SwitchOn then + Err := Cbreak; + else + Err := NoCbreak; + end if; + if Err = Curses_Err then + raise Curses_Exception; + end if; + end Set_Cbreak_Mode; + + procedure Set_Raw_Mode (SwitchOn : in Boolean := True) + is + function Raw return C_Int; + pragma Import (C, Raw, "raw"); + function NoRaw return C_Int; + pragma Import (C, NoRaw, "noraw"); + + Err : C_Int; + begin + if SwitchOn then + Err := Raw; + else + Err := NoRaw; + end if; + if Err = Curses_Err then + raise Curses_Exception; + end if; + end Set_Raw_Mode; + + procedure Set_Echo_Mode (SwitchOn : in Boolean := True) + is + function Echo return C_Int; + pragma Import (C, Echo, "echo"); + function NoEcho return C_Int; + pragma Import (C, NoEcho, "noecho"); + + Err : C_Int; + begin + if SwitchOn then + Err := Echo; + else + Err := NoEcho; + end if; + if Err = Curses_Err then + raise Curses_Exception; + end if; + end Set_Echo_Mode; + + procedure Set_Meta_Mode (Win : in Window := Standard_Window; + SwitchOn : in Boolean := True) + is + function Meta (W : Window; Mode : C_Int) return C_Int; + pragma Import (C, Meta, "meta"); + begin + if Meta (Win, Boolean'Pos (SwitchOn)) = Curses_Err then + raise Curses_Exception; + end if; + end Set_Meta_Mode; + + procedure Set_KeyPad_Mode (Win : in Window := Standard_Window; + SwitchOn : in Boolean := True) + is + function Keypad (W : Window; Mode : C_Int) return C_Int; + pragma Import (C, Keypad, "keypad"); + begin + if Keypad (Win, Boolean'Pos (SwitchOn)) = Curses_Err then + raise Curses_Exception; + end if; + end Set_KeyPad_Mode; + + procedure Half_Delay (Amount : in Half_Delay_Amount) + is + function Halfdelay (Amount : C_Int) return C_Int; + pragma Import (C, Halfdelay, "halfdelay"); + begin + if Halfdelay (C_Int (Amount)) = Curses_Err then + raise Curses_Exception; + end if; + end Half_Delay; + + procedure Set_Flush_On_Interrupt_Mode + (Win : in Window := Standard_Window; + Mode : in Boolean := True) + is + function Intrflush (Win : Window; Mode : C_Int) return C_Int; + pragma Import (C, Intrflush, "intrflush"); + begin + if Intrflush (Win, Boolean'Pos (Mode)) = Curses_Err then + raise Curses_Exception; + end if; + end Set_Flush_On_Interrupt_Mode; + + procedure Set_Queue_Interrupt_Mode + (Win : in Window := Standard_Window; + Flush : in Boolean := True) + is + procedure Qiflush; + pragma Import (C, Qiflush, "qiflush"); + procedure No_Qiflush; + pragma Import (C, No_Qiflush, "noqiflush"); + begin + if Flush then + Qiflush; + else + No_Qiflush; + end if; + end Set_Queue_Interrupt_Mode; + + procedure Set_NoDelay_Mode + (Win : in Window := Standard_Window; + Mode : in Boolean := False) + is + function Nodelay (Win : Window; Mode : C_Int) return C_Int; + pragma Import (C, Nodelay, "nodelay"); + begin + if Nodelay (Win, Boolean'Pos (Mode)) = Curses_Err then + raise Curses_Exception; + end if; + end Set_NoDelay_Mode; + + procedure Set_Timeout_Mode (Win : in Window := Standard_Window; + Mode : in Timeout_Mode; + Amount : in Natural) + is + function Wtimeout (Win : Window; Amount : C_Int) return C_Int; + pragma Import (C, Wtimeout, "wtimeout"); + + Time : C_Int; + begin + case Mode is + when Blocking => Time := -1; + when Non_Blocking => Time := 0; + when Delayed => + if Amount = 0 then + raise CONSTRAINT_ERROR; + end if; + Time := C_Int (Amount); + end case; + if Wtimeout (Win, Time) = Curses_Err then + raise Curses_Exception; + end if; + end Set_Timeout_Mode; + + procedure Set_Escape_Timer_Mode + (Win : in Window := Standard_Window; + Timer_Off : in Boolean := False) + is + function Notimeout (Win : Window; Mode : C_Int) return C_Int; + pragma Import (C, Notimeout, "notimeout"); + begin + if Notimeout (Win, Boolean'Pos (Timer_Off)) = Curses_Err then + raise Curses_Exception; + end if; + end Set_Escape_Timer_Mode; + +------------------------------------------------------------------------------ + procedure Set_NL_Mode (SwitchOn : in Boolean := True) + is + function NL return C_Int; + pragma Import (C, NL, "nl"); + function NoNL return C_Int; + pragma Import (C, NoNL, "nonl"); + + Err : C_Int; + begin + if SwitchOn then + Err := NL; + else + Err := NoNL; + end if; + if Err = Curses_Err then + raise Curses_Exception; + end if; + end Set_NL_Mode; + + procedure Clear_On_Next_Update + (Win : in Window := Standard_Window; + Do_Clear : in Boolean := True) + is + function Clear_Ok (W : Window; Flag : C_Int) return C_Int; + pragma Import (C, Clear_Ok, "clearok"); + begin + if Clear_Ok (Win, Boolean'Pos (Do_Clear)) = Curses_Err then + raise Curses_Exception; + end if; + end Clear_On_Next_Update; + + procedure Use_Insert_Delete_Line + (Win : in Window := Standard_Window; + Do_Idl : in Boolean := True) + is + function IDL_Ok (W : Window; Flag : C_Int) return C_Int; + pragma Import (C, IDL_Ok, "idlok"); + begin + if IDL_Ok (Win, Boolean'Pos (Do_Idl)) = Curses_Err then + raise Curses_Exception; + end if; + end Use_Insert_Delete_Line; + + procedure Use_Insert_Delete_Character + (Win : in Window := Standard_Window; + Do_Idc : in Boolean := True) + is + function IDC_Ok (W : Window; Flag : C_Int) return C_Int; + pragma Import (C, IDC_Ok, "idcok"); + begin + if IDC_Ok (Win, Boolean'Pos (Do_Idc)) = Curses_Err then + raise Curses_Exception; + end if; + end Use_Insert_Delete_Character; + + procedure Leave_Cursor_After_Update + (Win : in Window := Standard_Window; + Do_Leave : in Boolean := True) + is + function Leave_Ok (W : Window; Flag : C_Int) return C_Int; + pragma Import (C, Leave_Ok, "leaveok"); + begin + if Leave_Ok (Win, Boolean'Pos (Do_Leave)) = Curses_Err then + raise Curses_Exception; + end if; + end Leave_Cursor_After_Update; + + procedure Immediate_Update_Mode + (Win : in Window := Standard_Window; + Mode : in Boolean := False) + is + function Immedok (Win : Window; Mode : C_Int) return C_Int; + pragma Import (C, Immedok, "immedok"); + begin + if Immedok (Win, Boolean'Pos (Mode)) = Curses_Err then + raise Curses_Exception; + end if; + end Immediate_Update_Mode; + + procedure Allow_Scrolling + (Win : in Window := Standard_Window; + Mode : in Boolean := False) + is + function Scrollok (Win : Window; Mode : C_Int) return C_Int; + pragma Import (C, Scrollok, "scrollok"); + begin + if Scrollok (Win, Boolean'Pos (Mode)) = Curses_Err then + raise Curses_Exception; + end if; + end Allow_Scrolling; + + function Scrolling_Allowed (Win : Window := Standard_Window) return Boolean + is + function Is_Scroll (Win : Window) return C_Int; + pragma Import (C, Is_Scroll, "_nc_ada_isscroll"); + + Res : constant C_Int := Is_Scroll (Win); + begin + case Res is + when Curses_True => return True; + when Curses_False => return False; + when others => raise Curses_Exception; + end case; + end Scrolling_Allowed; + + procedure Set_Scroll_Region + (Win : in Window := Standard_Window; + Top_Line : in Line_Position; + Bottom_Line : in Line_Position) + is + function Wsetscrreg (Win : Window; + Lin : C_Int; + Col : C_Int) return C_Int; + pragma Import (C, Wsetscrreg, "wsetscrreg"); + begin + if Wsetscrreg (Win, C_Int (Top_Line), C_Int (Bottom_Line)) + = Curses_Err then + raise Curses_Exception; + end if; + end Set_Scroll_Region; +------------------------------------------------------------------------------ + procedure Update_Screen + is + function Do_Update return C_Int; + pragma Import (C, Do_Update, "doupdate"); + begin + if Do_Update = Curses_Err then + raise Curses_Exception; + end if; + end Update_Screen; + + procedure Refresh (Win : in Window := Standard_Window) + is + function Wrefresh (W : Window) return C_Int; + pragma Import (C, Wrefresh, "wrefresh"); + begin + if Wrefresh (Win) = Curses_Err then + raise Curses_Exception; + end if; + end Refresh; + + procedure Refresh_Without_Update + (Win : in Window := Standard_Window) + is + function Wnoutrefresh (W : Window) return C_Int; + pragma Import (C, Wnoutrefresh, "wnoutrefresh"); + begin + if Wnoutrefresh (Win) = Curses_Err then + raise Curses_Exception; + end if; + end Refresh_Without_Update; + + procedure Redraw (Win : in Window := Standard_Window) + is + function Redrawwin (Win : Window) return C_Int; + pragma Import (C, Redrawwin, "redrawwin"); + begin + if Redrawwin (Win) = Curses_Err then + raise Curses_Exception; + end if; + end Redraw; + + procedure Redraw + (Win : in Window := Standard_Window; + Begin_Line : in Line_Position; + Line_Count : in Positive) + is + function Wredrawln (Win : Window; First : C_Int; Cnt : C_Int) + return C_Int; + pragma Import (C, Wredrawln, "wredrawln"); + begin + if Wredrawln (Win, + C_Int (Begin_Line), + C_Int (Line_Count)) = Curses_Err then + raise Curses_Exception; + end if; + end Redraw; + +------------------------------------------------------------------------------ + procedure Erase (Win : in Window := Standard_Window) + is + function Werase (W : Window) return C_Int; + pragma Import (C, Werase, "werase"); + begin + if Werase (Win) = Curses_Err then + raise Curses_Exception; + end if; + end Erase; + + procedure Clear (Win : in Window := Standard_Window) + is + function Wclear (W : Window) return C_Int; + pragma Import (C, Wclear, "wclear"); + begin + if Wclear (Win) = Curses_Err then + raise Curses_Exception; + end if; + end Clear; + + procedure Clear_To_End_Of_Screen (Win : in Window := Standard_Window) + is + function Wclearbot (W : Window) return C_Int; + pragma Import (C, Wclearbot, "wclrtobot"); + begin + if Wclearbot (Win) = Curses_Err then + raise Curses_Exception; + end if; + end Clear_To_End_Of_Screen; + + procedure Clear_To_End_Of_Line (Win : in Window := Standard_Window) + is + function Wcleareol (W : Window) return C_Int; + pragma Import (C, Wcleareol, "wclrtoeol"); + begin + if Wcleareol (Win) = Curses_Err then + raise Curses_Exception; + end if; + end Clear_To_End_Of_Line; +------------------------------------------------------------------------------ + procedure Set_Background + (Win : in Window := Standard_Window; + Ch : in Attributed_Character) + is + procedure WBackground (W : in Window; Ch : in C_Int); + pragma Import (C, WBackground, "wbkgdset"); + begin + WBackground (Win, Chtype_To_CInt (Ch)); + end Set_Background; + + procedure Change_Background + (Win : in Window := Standard_Window; + Ch : in Attributed_Character) + is + function WChangeBkgd (W : Window; Ch : C_Int) + return C_Int; + pragma Import (C, WChangeBkgd, "wbkgd"); + begin + if WChangeBkgd (Win, Chtype_To_CInt (Ch)) = Curses_Err then + raise Curses_Exception; + end if; + end Change_Background; + + function Get_Background (Win : Window := Standard_Window) + return Attributed_Character + is + function Wgetbkgd (Win : Window) return C_Int; + pragma Import (C, Wgetbkgd, "getbkgd"); + begin + return CInt_To_Chtype (Wgetbkgd (Win)); + end Get_Background; +------------------------------------------------------------------------------ + procedure Change_Lines_Status (Win : in Window := Standard_Window; + Start : in Line_Position; + Count : in Positive; + State : in Boolean) + is + function Wtouchln (Win : Window; + Sta : C_Int; + Cnt : C_Int; + Chg : C_Int) return C_Int; + pragma Import (C, Wtouchln, "wtouchln"); + begin + if Wtouchln (Win, C_Int (Start), C_Int (Count), + C_Int (Boolean'Pos (State))) = Curses_Err then + raise Curses_Exception; + end if; + end Change_Lines_Status; + + procedure Touch (Win : in Window := Standard_Window) + is + Y : Line_Position; + X : Column_Position; + begin + Get_Size (Win, Y, X); + Change_Lines_Status (Win, 0, Positive (Y), True); + end Touch; + + procedure Untouch (Win : in Window := Standard_Window) + is + Y : Line_Position; + X : Column_Position; + begin + Get_Size (Win, Y, X); + Change_Lines_Status (Win, 0, Positive (Y), False); + end Untouch; + + procedure Touch (Win : in Window := Standard_Window; + Start : in Line_Position; + Count : in Positive) + is + begin + Change_Lines_Status (Win, Start, Count, True); + end Touch; + + function Is_Touched + (Win : Window := Standard_Window; + Line : Line_Position) return Boolean + is + function WLineTouched (W : Window; L : C_Int) return C_Int; + pragma Import (C, WLineTouched, "is_linetouched"); + begin + if WLineTouched (Win, C_Int (Line)) = Curses_False then + return False; + else + return True; + end if; + end Is_Touched; + + function Is_Touched + (Win : Window := Standard_Window) return Boolean + is + function WWinTouched (W : Window) return C_Int; + pragma Import (C, WWinTouched, "is_wintouched"); + begin + if WWinTouched (Win) = Curses_False then + return False; + else + return True; + end if; + end Is_Touched; +------------------------------------------------------------------------------ + procedure Copy + (Source_Window : in Window; + Destination_Window : in Window; + Source_Top_Row : in Line_Position; + Source_Left_Column : in Column_Position; + Destination_Top_Row : in Line_Position; + Destination_Left_Column : in Column_Position; + Destination_Bottom_Row : in Line_Position; + Destination_Right_Column : in Column_Position; + Non_Destructive_Mode : in Boolean := True) + is + function Copywin (Src : Window; + Dst : Window; + Str : C_Int; + Slc : C_Int; + Dtr : C_Int; + Dlc : C_Int; + Dbr : C_Int; + Drc : C_Int; + Ndm : C_Int) return C_Int; + pragma Import (C, Copywin, "copywin"); + begin + if Copywin (Source_Window, + Destination_Window, + C_Int (Source_Top_Row), + C_Int (Source_Left_Column), + C_Int (Destination_Top_Row), + C_Int (Destination_Left_Column), + C_Int (Destination_Bottom_Row), + C_Int (Destination_Right_Column), + Boolean'Pos (Non_Destructive_Mode) + ) = Curses_Err then + raise Curses_Exception; + end if; + end Copy; + + procedure Overwrite + (Source_Window : in Window; + Destination_Window : in Window) + is + function Overwrite (Src : Window; Dst : Window) return C_Int; + pragma Import (C, Overwrite, "overwrite"); + begin + if Overwrite (Source_Window, Destination_Window) = Curses_Err then + raise Curses_Exception; + end if; + end Overwrite; + + procedure Overlay + (Source_Window : in Window; + Destination_Window : in Window) + is + function Overlay (Src : Window; Dst : Window) return C_Int; + pragma Import (C, Overlay, "overlay"); + begin + if Overlay (Source_Window, Destination_Window) = Curses_Err then + raise Curses_Exception; + end if; + end Overlay; + +------------------------------------------------------------------------------ + procedure Insert_Delete_Lines + (Win : in Window := Standard_Window; + Lines : in Integer := 1) -- default is to insert one line above + is + function Winsdelln (W : Window; N : C_Int) return C_Int; + pragma Import (C, Winsdelln, "winsdelln"); + begin + if Winsdelln (Win, C_Int (Lines)) = Curses_Err then + raise Curses_Exception; + end if; + end Insert_Delete_Lines; + + procedure Delete_Line (Win : in Window := Standard_Window) + is + begin + Insert_Delete_Lines (Win, -1); + end Delete_Line; + + procedure Insert_Line (Win : in Window := Standard_Window) + is + begin + Insert_Delete_Lines (Win, 1); + end Insert_Line; +------------------------------------------------------------------------------ + procedure Get_Size + (Win : in Window := Standard_Window; + Number_Of_Lines : out Line_Count; + Number_Of_Columns : out Column_Count) + is + type Int_Access is access all C_Int; + function Getmaxyx (W : Window; Y, X : Int_Access) return C_Int; + pragma Import (C, Getmaxyx, "_nc_ada_getmaxyx"); + + Y, X : aliased C_Int; + Err : constant C_Int := Getmaxyx (Win, Y'Access, X'Access); + begin + if Err = Curses_Err then + raise Curses_Exception; + else + Number_Of_Lines := Line_Count (Y); + Number_Of_Columns := Column_Count (X); + end if; + end Get_Size; + + procedure Get_Window_Position + (Win : in Window := Standard_Window; + Top_Left_Line : out Line_Position; + Top_Left_Column : out Column_Position) + is + type Int_Access is access all C_Int; + function Getbegyx (W : Window; Y, X : Int_Access) return C_Int; + pragma Import (C, Getbegyx, "_nc_ada_getbegyx"); + + Y, X : aliased C_Int; + Err : constant C_Int := Getbegyx (Win, Y'Access, X'Access); + begin + if Err = Curses_Err then + raise Curses_Exception; + else + Top_Left_Line := Line_Position (Y); + Top_Left_Column := Column_Position (X); + end if; + end Get_Window_Position; + + procedure Get_Cursor_Position + (Win : in Window := Standard_Window; + Line : out Line_Position; + Column : out Column_Position) + is + type Int_Access is access all C_Int; + function Getyx (W : Window; Y, X : Int_Access) return C_Int; + pragma Import (C, Getyx, "_nc_ada_getyx"); + + Y, X : aliased C_Int; + Err : constant C_Int := Getyx (Win, Y'Access, X'Access); + begin + if Err = Curses_Err then + raise Curses_Exception; + else + Line := Line_Position (Y); + Column := Column_Position (X); + end if; + end Get_Cursor_Position; + + procedure Get_Origin_Relative_To_Parent + (Win : in Window; + Top_Left_Line : out Line_Position; + Top_Left_Column : out Column_Position; + Is_Not_A_Subwindow : out Boolean) + is + type Int_Access is access all C_Int; + function Getparyx (W : Window; Y, X : Int_Access) return C_Int; + pragma Import (C, Getparyx, "_nc_ada_getparyx"); + + Y, X : aliased C_Int; + Err : constant C_Int := Getparyx (Win, Y'Access, X'Access); + begin + if Err = Curses_Err then + raise Curses_Exception; + else + if Y = -1 then + Top_Left_Line := Line_Position'Last; + Top_Left_Column := Column_Position'Last; + Is_Not_A_Subwindow := True; + else + Top_Left_Line := Line_Position (Y); + Top_Left_Column := Column_Position (X); + Is_Not_A_Subwindow := False; + end if; + end if; + end Get_Origin_Relative_To_Parent; +------------------------------------------------------------------------------ + function New_Pad (Lines : Line_Count; + Columns : Column_Count) return Window + is + function Newpad (Lines : C_Int; Columns : C_Int) return Window; + pragma Import (C, Newpad, "newpad"); + + W : Window; + begin + W := Newpad (C_Int (Lines), C_Int (Columns)); + if W = Null_Window then + raise Curses_Exception; + end if; + return W; + end New_Pad; + + function Sub_Pad + (Pad : Window; + Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; + First_Column_Position : Column_Position) return Window + is + function Subpad + (Pad : Window; + Number_Of_Lines : C_Int; + Number_Of_Columns : C_Int; + First_Line_Position : C_Int; + First_Column_Position : C_Int) return Window; + pragma Import (C, Subpad, "subpad"); + + W : Window; + begin + W := Subpad (Pad, + C_Int (Number_Of_Lines), + C_Int (Number_Of_Columns), + C_Int (First_Line_Position), + C_Int (First_Column_Position)); + if W = Null_Window then + raise Curses_Exception; + end if; + return W; + end Sub_Pad; + + procedure Refresh + (Pad : in Window; + Source_Top_Row : in Line_Position; + Source_Left_Column : in Column_Position; + Destination_Top_Row : in Line_Position; + Destination_Left_Column : in Column_Position; + Destination_Bottom_Row : in Line_Position; + Destination_Right_Column : in Column_Position) + is + function Prefresh + (Pad : Window; + Source_Top_Row : C_Int; + Source_Left_Column : C_Int; + Destination_Top_Row : C_Int; + Destination_Left_Column : C_Int; + Destination_Bottom_Row : C_Int; + Destination_Right_Column : C_Int) return C_Int; + pragma Import (C, Prefresh, "prefresh"); + begin + if Prefresh (Pad, + C_Int (Source_Top_Row), + C_Int (Source_Left_Column), + C_Int (Destination_Top_Row), + C_Int (Destination_Left_Column), + C_Int (Destination_Bottom_Row), + C_Int (Destination_Right_Column)) = Curses_Err then + raise Curses_Exception; + end if; + end Refresh; + + procedure Refresh_Without_Update + (Pad : in Window; + Source_Top_Row : in Line_Position; + Source_Left_Column : in Column_Position; + Destination_Top_Row : in Line_Position; + Destination_Left_Column : in Column_Position; + Destination_Bottom_Row : in Line_Position; + Destination_Right_Column : in Column_Position) + is + function Pnoutrefresh + (Pad : Window; + Source_Top_Row : C_Int; + Source_Left_Column : C_Int; + Destination_Top_Row : C_Int; + Destination_Left_Column : C_Int; + Destination_Bottom_Row : C_Int; + Destination_Right_Column : C_Int) return C_Int; + pragma Import (C, Pnoutrefresh, "pnoutrefresh"); + begin + if Pnoutrefresh (Pad, + C_Int (Source_Top_Row), + C_Int (Source_Left_Column), + C_Int (Destination_Top_Row), + C_Int (Destination_Left_Column), + C_Int (Destination_Bottom_Row), + C_Int (Destination_Right_Column)) = Curses_Err then + raise Curses_Exception; + end if; + end Refresh_Without_Update; + + procedure Add_Character_To_Pad_And_Echo_It + (Pad : in Window; + Ch : in Attributed_Character) + is + function Pechochar (Pad : Window; Ch : C_Int) + return C_Int; + pragma Import (C, Pechochar, "pechochar"); + begin + if Pechochar (Pad, Chtype_To_CInt (Ch)) = Curses_Err then + raise Curses_Exception; + end if; + end Add_Character_To_Pad_And_Echo_It; + + procedure Add_Character_To_Pad_And_Echo_It + (Pad : in Window; + Ch : in Character) + is + begin + Add_Character_To_Pad_And_Echo_It + (Pad, + Attributed_Character'(Ch => Ch, + Color => Color_Pair'First, + Attr => Normal_Video)); + end Add_Character_To_Pad_And_Echo_It; +------------------------------------------------------------------------------ + procedure Scroll (Win : in Window := Standard_Window; + Amount : in Integer := 1) + is + function Wscrl (Win : Window; N : C_Int) return C_Int; + pragma Import (C, Wscrl, "wscrl"); + + begin + if Wscrl (Win, C_Int (Amount)) = Curses_Err then + raise Curses_Exception; + end if; + end Scroll; + +------------------------------------------------------------------------------ + procedure Delete_Character (Win : in Window := Standard_Window) + is + function Wdelch (Win : Window) return C_Int; + pragma Import (C, Wdelch, "wdelch"); + begin + if Wdelch (Win) = Curses_Err then + raise Curses_Exception; + end if; + end Delete_Character; + + procedure Delete_Character + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position) + is + function Mvwdelch (Win : Window; + Lin : C_Int; + Col : C_Int) return C_Int; + pragma Import (C, Mvwdelch, "mvwdelch"); + begin + if Mvwdelch (Win, C_Int (Line), C_Int (Column)) = Curses_Err then + raise Curses_Exception; + end if; + end Delete_Character; +------------------------------------------------------------------------------ + function Peek (Win : Window := Standard_Window) + return Attributed_Character + is + function Winch (Win : Window) return C_Int; + pragma Import (C, Winch, "winch"); + begin + return CInt_To_Chtype (Winch (Win)); + end Peek; + + function Peek + (Win : Window := Standard_Window; + Line : Line_Position; + Column : Column_Position) return Attributed_Character + is + function Mvwinch (Win : Window; + Lin : C_Int; + Col : C_Int) return C_Int; + pragma Import (C, Mvwinch, "mvwinch"); + begin + return CInt_To_Chtype (Mvwinch (Win, C_Int (Line), C_Int (Column))); + end Peek; +------------------------------------------------------------------------------ + procedure Insert (Win : in Window := Standard_Window; + Ch : in Attributed_Character) + is + function Winsch (Win : Window; Ch : C_Int) return C_Int; + pragma Import (C, Winsch, "winsch"); + begin + if Winsch (Win, Chtype_To_CInt (Ch)) = Curses_Err then + raise Curses_Exception; + end if; + end Insert; + + procedure Insert + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Ch : in Attributed_Character) + is + function Mvwinsch (Win : Window; + Lin : C_Int; + Col : C_Int; + Ch : C_Int) return C_Int; + pragma Import (C, Mvwinsch, "mvwinsch"); + begin + if Mvwinsch (Win, + C_Int (Line), + C_Int (Column), + Chtype_To_CInt (Ch)) = Curses_Err then + raise Curses_Exception; + end if; + end Insert; +------------------------------------------------------------------------------ + procedure Insert (Win : in Window := Standard_Window; + Str : in String; + Len : in Integer := -1) + is + type Char_Ptr is access all Interfaces.C.Char; + function Winsnstr (Win : Window; + Str : Char_Ptr; + Len : Integer := -1) return C_Int; + pragma Import (C, Winsnstr, "winsnstr"); + + Txt : char_array (0 .. Str'Length); + Length : size_t; + begin + To_C (Str, Txt, Length); + if Winsnstr (Win, Txt (Txt'First)'Access, Len) = Curses_Err then + raise Curses_Exception; + end if; + end Insert; + + procedure Insert + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : in String; + Len : in Integer := -1) + is + type Char_Ptr is access all Interfaces.C.Char; + function Mvwinsnstr (Win : Window; + Line : C_Int; + Column : C_Int; + Str : Char_Ptr; + Len : C_Int) return C_Int; + pragma Import (C, Mvwinsnstr, "mvwinsnstr"); + + Txt : char_array (0 .. Str'Length); + Length : size_t; + begin + To_C (Str, Txt, Length); + if Mvwinsnstr (Win, C_Int (Line), C_Int (Column), + Txt (Txt'First)'Access, C_Int (Len)) + = Curses_Err then + raise Curses_Exception; + end if; + end Insert; +------------------------------------------------------------------------------ + procedure Peek (Win : in Window := Standard_Window; + Str : out String; + Len : in Integer := -1) + is + function Winnstr (Win : Window; + Str : char_array; + Len : C_Int) return C_Int; + pragma Import (C, Winnstr, "winnstr"); + + N : Integer := Len; + Txt : char_array (0 .. Str'Length); + Cnt : Natural; + begin + if N < 0 then + N := Str'Length; + end if; + if N > Str'Length then + raise Constraint_Error; + end if; + Txt (0) := Interfaces.C.char'First; + if Winnstr (Win, Txt, C_Int (N)) = Curses_Err then + raise Curses_Exception; + end if; + To_Ada (Txt, Str, Cnt, True); + if Cnt < Str'Length then + Str ((Str'First + Cnt) .. Str'Last) := (others => ' '); + end if; + end Peek; + + procedure Peek + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : out String; + Len : in Integer := -1) + is + begin + Move_Cursor (Win, Line, Column); + Peek (Win, Str, Len); + end Peek; +------------------------------------------------------------------------------ + procedure Peek + (Win : in Window := Standard_Window; + Str : out Attributed_String; + Len : in Integer := -1) + is + type Chtype_Ptr is access all Attributed_Character; + function Winchnstr (Win : Window; + Str : Chtype_Ptr; + Len : C_Int) return C_Int; + pragma Import (C, Winchnstr, "winchnstr"); + + N : Integer := Len; + Txt : chtype_array (0 .. Str'Length); + Cnt : Natural := 0; + begin + if N < 0 then + N := Str'Length; + end if; + if N > Str'Length then + raise Constraint_Error; + end if; + if Winchnstr (Win, Txt (Txt'First)'Access, C_Int (N)) = Curses_Err then + raise Curses_Exception; + end if; + for To in Str'Range loop + exit when Txt (size_t (Cnt)) = Default_Character; + Str (To) := Txt (size_t (Cnt)); + Cnt := Cnt + 1; + end loop; + if Cnt < Str'Length then + Str ((Str'First + Cnt) .. Str'Last) := + (others => (Ch => ' ', + Color => Color_Pair'First, + Attr => Normal_Video)); + end if; + end Peek; + + procedure Peek + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : out Attributed_String; + Len : in Integer := -1) + is + begin + Move_Cursor (Win, Line, Column); + Peek (Win, Str, Len); + end Peek; +------------------------------------------------------------------------------ + procedure Get (Win : in Window := Standard_Window; + Str : out String; + Len : in Integer := -1) + is + function Wgetnstr (Win : Window; + Str : char_array; + Len : C_Int) return C_Int; + pragma Import (C, Wgetnstr, "wgetnstr"); + + N : Integer := Len; + Txt : char_array (0 .. Str'Length); + Cnt : Natural; + begin + if N < 0 then + N := Str'Length; + end if; + if N > Str'Length then + raise Constraint_Error; + end if; + Txt (0) := Interfaces.C.char'First; + if Wgetnstr (Win, Txt, C_Int (N)) = Curses_Err then + raise Curses_Exception; + end if; + To_Ada (Txt, Str, Cnt, True); + if Cnt < Str'Length then + Str ((Str'First + Cnt) .. Str'Last) := (others => ' '); + end if; + end Get; + + procedure Get + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : out String; + Len : in Integer := -1) + is + begin + Move_Cursor (Win, Line, Column); + Get (Win, Str, Len); + end Get; +------------------------------------------------------------------------------ + procedure Init_Soft_Label_Keys + (Format : in Soft_Label_Key_Format := Three_Two_Three) + is + function Slk_Init (Fmt : C_Int) return C_Int; + pragma Import (C, Slk_Init, "slk_init"); + begin + if Slk_Init (Soft_Label_Key_Format'Pos (Format)) = Curses_Err then + raise Curses_Exception; + end if; + end Init_Soft_Label_Keys; + + procedure Set_Soft_Label_Key (Label : in Label_Number; + Text : in String; + Fmt : in Label_Justification := Left) + is + type Char_Ptr is access all Interfaces.C.Char; + function Slk_Set (Label : C_Int; + Txt : Char_Ptr; + Fmt : C_Int) return C_Int; + pragma Import (C, Slk_Set, "slk_set"); + + Txt : char_array (0 .. Text'Length); + Len : size_t; + begin + To_C (Text, Txt, Len); + if Slk_Set (C_Int (Label), + Txt (Txt'First)'Access, + C_Int (Label_Justification'Pos (Fmt))) + = Curses_Err then + raise Curses_Exception; + end if; + end Set_Soft_Label_Key; + + procedure Refresh_Soft_Label_Keys + is + function Slk_Refresh return C_Int; + pragma Import (C, Slk_Refresh, "slk_refresh"); + begin + if Slk_Refresh = Curses_Err then + raise Curses_Exception; + end if; + end Refresh_Soft_Label_Keys; + + procedure Refresh_Soft_Label_Keys_Without_Update + is + function Slk_Noutrefresh return C_Int; + pragma Import (C, Slk_Noutrefresh, "slk_noutrefresh"); + begin + if Slk_Noutrefresh = Curses_Err then + raise Curses_Exception; + end if; + end Refresh_Soft_Label_Keys_Without_Update; + + procedure Get_Soft_Label_Key (Label : in Label_Number; + Text : out String) + is + function Slk_Label (Label : C_Int) return chars_ptr; + pragma Import (C, Slk_Label, "slk_label"); + begin + Fill_String (Slk_Label (C_Int (Label)), Text); + end Get_Soft_Label_Key; + + procedure Clear_Soft_Label_Keys + is + function Slk_Clear return C_Int; + pragma Import (C, Slk_Clear, "slk_clear"); + begin + if Slk_Clear = Curses_Err then + raise Curses_Exception; + end if; + end Clear_Soft_Label_Keys; + + procedure Restore_Soft_Label_Keys + is + function Slk_Restore return C_Int; + pragma Import (C, Slk_Restore, "slk_restore"); + begin + if Slk_Restore = Curses_Err then + raise Curses_Exception; + end if; + end Restore_Soft_Label_Keys; + + procedure Touch_Soft_Label_Keys + is + function Slk_Touch return C_Int; + pragma Import (C, Slk_Touch, "slk_touch"); + begin + if Slk_Touch = Curses_Err then + raise Curses_Exception; + end if; + end Touch_Soft_Label_Keys; + + procedure Switch_Soft_Label_Key_Attributes + (Attr : in Character_Attribute_Set; + On : in Boolean := True) + is + function Slk_Attron (Ch : C_Int) return C_Int; + pragma Import (C, Slk_Attron, "slk_attron"); + function Slk_Attroff (Ch : C_Int) return C_Int; + pragma Import (C, Slk_Attroff, "slk_attroff"); + + Err : C_Int; + Ch : constant Attributed_Character := (Ch => Character'First, + Attr => Attr, + Color => Color_Pair'First); + begin + if On then + Err := Slk_Attron (Chtype_To_CInt (Ch)); + else + Err := Slk_Attroff (Chtype_To_CInt (Ch)); + end if; + if Err = Curses_Err then + raise Curses_Exception; + end if; + end Switch_Soft_Label_Key_Attributes; + + procedure Set_Soft_Label_Key_Attributes + (Attr : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) + is + function Slk_Attrset (Ch : C_Int) return C_Int; + pragma Import (C, Slk_Attrset, "slk_attrset"); + + Ch : constant Attributed_Character := (Ch => Character'First, + Attr => Attr, + Color => Color); + begin + if Slk_Attrset (Chtype_To_CInt (Ch)) = Curses_Err then + raise Curses_Exception; + end if; + end Set_Soft_Label_Key_Attributes; + + function Get_Soft_Label_Key_Attributes return Character_Attribute_Set + is + function Slk_Attr return C_Int; + pragma Import (C, Slk_Attr, "slk_attr"); + + Attr : constant C_Int := Slk_Attr; + begin + return CInt_To_Chtype (Attr).Attr; + end Get_Soft_Label_Key_Attributes; + + function Get_Soft_Label_Key_Attributes return Color_Pair + is + function Slk_Attr return C_Int; + pragma Import (C, Slk_Attr, "slk_attr"); + + Attr : constant C_Int := Slk_Attr; + begin + return CInt_To_Chtype (Attr).Color; + end Get_Soft_Label_Key_Attributes; +------------------------------------------------------------------------------ + procedure Un_Control (Ch : in Attributed_Character; + Str : out String) + is + function Unctrl (Ch : C_Int) return chars_ptr; + pragma Import (C, Unctrl, "unctrl"); + begin + Fill_String (Unctrl (Chtype_To_CInt (Ch)), Str); + end Un_Control; + + procedure Delay_Output (Msecs : in Natural) + is + function Delayoutput (Msecs : C_Int) return C_Int; + pragma Import (C, Delayoutput, "delay_output"); + begin + if Delayoutput (C_Int (Msecs)) = Curses_Err then + raise Curses_Exception; + end if; + end Delay_Output; + + procedure Flush_Input + is + function Flushinp return C_Int; + pragma Import (C, Flushinp, "flushinp"); + begin + if Flushinp = Curses_Err then -- docu says that never happens, but... + raise Curses_Exception; + end if; + end Flush_Input; +------------------------------------------------------------------------------ + function Baudrate return Natural + is + function Baud return C_Int; + pragma Import (C, Baud, "baudrate"); + begin + return Natural (Baud); + end Baudrate; + + function Erase_Character return Character + is + function Erasechar return C_Int; + pragma Import (C, Erasechar, "erasechar"); + begin + return Character'Val (Erasechar); + end Erase_Character; + + function Kill_Character return Character + is + function Killchar return C_Int; + pragma Import (C, Killchar, "killchar"); + begin + return Character'Val (Killchar); + end Kill_Character; + + function Has_Insert_Character return Boolean + is + function Has_Ic return C_Int; + pragma Import (C, Has_Ic, "has_ic"); + begin + if Has_Ic = Curses_False then + return False; + else + return True; + end if; + end Has_Insert_Character; + + function Has_Insert_Line return Boolean + is + function Has_Il return C_Int; + pragma Import (C, Has_Il, "has_il"); + begin + if Has_Il = Curses_False then + return False; + else + return True; + end if; + end Has_Insert_Line; + + function Supported_Attributes return Character_Attribute_Set + is + function Termattrs return C_Int; + pragma Import (C, Termattrs, "termattrs"); + + Ch : constant Attributed_Character := CInt_To_Chtype (Termattrs); + begin + return Ch.Attr; + end Supported_Attributes; + + procedure Long_Name (Name : out String) + is + function Longname return chars_ptr; + pragma Import (C, Longname, "longname"); + begin + Fill_String (Longname, Name); + end Long_Name; + + procedure Terminal_Name (Name : out String) + is + function Termname return chars_ptr; + pragma Import (C, Termname, "termname"); + begin + Fill_String (Termname, Name); + end Terminal_Name; +------------------------------------------------------------------------------ + procedure Init_Pair (Pair : in Redefinable_Color_Pair; + Fore : in Color_Number; + Back : in Color_Number) + is + function Initpair (Pair : C_Short; + Fore : C_Short; + Back : C_Short) return C_Int; + pragma Import (C, Initpair, "init_pair"); + begin + if Integer (Pair) >= Number_Of_Color_Pairs then + raise Constraint_Error; + end if; + if Integer (Fore) >= Number_Of_Colors or else + Integer (Back) >= Number_Of_Colors then raise Constraint_Error; + end if; + if Initpair (C_Short (Pair), C_Short (Fore), C_Short (Back)) + = Curses_Err then + raise Curses_Exception; + end if; + end Init_Pair; + + procedure Pair_Content (Pair : in Color_Pair; + Fore : out Color_Number; + Back : out Color_Number) + is + type C_Short_Access is access all C_Short; + function Paircontent (Pair : C_Short; + Fp : C_Short_Access; + Bp : C_Short_Access) return C_Int; + pragma Import (C, Paircontent, "pair_content"); + + F, B : aliased C_Short; + begin + if Paircontent (C_Short (Pair), F'Access, B'Access) = Curses_Err then + raise Curses_Exception; + else + Fore := Color_Number (F); + Back := Color_Number (B); + end if; + end Pair_Content; + + function Has_Colors return Boolean + is + function Hascolors return C_Int; + pragma Import (C, Hascolors, "has_colors"); + begin + if Hascolors = Curses_False then + return False; + else + return True; + end if; + end Has_Colors; + + procedure Init_Color (Color : in Color_Number; + Red : in RGB_Value; + Green : in RGB_Value; + Blue : in RGB_Value) + is + function Initcolor (Col : C_Short; + Red : C_Short; + Green : C_Short; + Blue : C_Short) return C_Int; + pragma Import (C, Initcolor, "init_color"); + begin + if Initcolor (C_Short (Color), C_Short (Red), C_Short (Green), + C_Short (Blue)) = Curses_Err then + raise Curses_Exception; + end if; + end Init_Color; + + function Can_Change_Color return Boolean + is + function Canchangecolor return C_Int; + pragma Import (C, Canchangecolor, "can_change_color"); + begin + if Canchangecolor = Curses_False then + return False; + else + return True; + end if; + end Can_Change_Color; + + procedure Color_Content (Color : in Color_Number; + Red : out RGB_Value; + Green : out RGB_Value; + Blue : out RGB_Value) + is + type C_Short_Access is access all C_Short; + + function Colorcontent (Color : C_Short; R, G, B : C_Short_Access) + return C_Int; + pragma Import (C, Colorcontent, "color_content"); + + R, G, B : aliased C_Short; + begin + if Colorcontent (C_Short (Color), R'Access, G'Access, B'Access) = + Curses_Err then + raise Curses_Exception; + else + Red := RGB_Value (R); + Green := RGB_Value (G); + Blue := RGB_Value (B); + end if; + end Color_Content; + +------------------------------------------------------------------------------ + procedure Save_Curses_Mode (Mode : in Curses_Mode) + is + function Def_Prog_Mode return C_Int; + pragma Import (C, Def_Prog_Mode, "def_prog_mode"); + function Def_Shell_Mode return C_Int; + pragma Import (C, Def_Shell_Mode, "def_shell_mode"); + + Err : C_Int; + begin + case Mode is + when Curses => Err := Def_Prog_Mode; + when Shell => Err := Def_Shell_Mode; + end case; + if Err = Curses_Err then + raise Curses_Exception; + end if; + end Save_Curses_Mode; + + procedure Reset_Curses_Mode (Mode : in Curses_Mode) + is + function Reset_Prog_Mode return C_Int; + pragma Import (C, Reset_Prog_Mode, "reset_prog_mode"); + function Reset_Shell_Mode return C_Int; + pragma Import (C, Reset_Shell_Mode, "reset_shell_mode"); + + Err : C_Int; + begin + case Mode is + when Curses => Err := Reset_Prog_Mode; + when Shell => Err := Reset_Shell_Mode; + end case; + if Err = Curses_Err then + raise Curses_Exception; + end if; + end Reset_Curses_Mode; + + procedure Save_Terminal_State + is + function Savetty return C_Int; + pragma Import (C, Savetty, "savetty"); + begin + if Savetty = Curses_Err then + raise Curses_Exception; + end if; + end Save_Terminal_State; + + procedure Reset_Terminal_State + is + function Resetty return C_Int; + pragma Import (C, Resetty, "resetty"); + begin + if Resetty = Curses_Err then + raise Curses_Exception; + end if; + end Reset_Terminal_State; + + procedure Rip_Off_Lines (Lines : in Integer; + Proc : in Stdscr_Init_Proc) + is + function Ripoffline (Lines : C_Int; + Proc : Stdscr_Init_Proc) return C_Int; + pragma Import (C, Ripoffline, "_nc_ripoffline"); + begin + if Ripoffline (C_Int (Lines), Proc) = Curses_Err then + raise Curses_Exception; + end if; + end Rip_Off_Lines; + + procedure Set_Cursor_Visibility (Visibility : in out Cursor_Visibility) + is + function Curs_Set (Curs : C_Int) return C_Int; + pragma Import (C, Curs_Set, "curs_set"); + + Res : C_Int; + begin + Res := Curs_Set (Cursor_Visibility'Pos (Visibility)); + if Res /= Curses_Err then + Visibility := Cursor_Visibility'Val (Res); + end if; + end Set_Cursor_Visibility; + + procedure Nap_Milli_Seconds (Ms : in Natural) + is + function Napms (Ms : C_Int) return C_Int; + pragma Import (C, Napms, "napms"); + begin + if Napms (C_Int (Ms)) = Curses_Err then + raise Curses_Exception; + end if; + end Nap_Milli_Seconds; +------------------------------------------------------------------------------ + + function Standard_Window return Window + is + Stdscr : Window; + pragma Import (C, Stdscr, "stdscr"); + begin + return Stdscr; + end Standard_Window; + + function Lines return Line_Count + is + C_Lines : C_Int; + pragma Import (C, C_Lines, "LINES"); + begin + return Line_Count (C_Lines); + end Lines; + + function Columns return Column_Count + is + C_Columns : C_Int; + pragma Import (C, C_Columns, "COLS"); + begin + return Column_Count (C_Columns); + end Columns; + + function Tab_Size return Natural + is + C_Tab_Size : C_Int; + pragma Import (C, C_Tab_Size, "TABSIZE"); + begin + return Natural (C_Tab_Size); + end Tab_Size; + + function Number_Of_Colors return Natural + is + C_Number_Of_Colors : C_Int; + pragma Import (C, C_Number_Of_Colors, "COLORS"); + begin + return Natural (C_Number_Of_Colors); + end Number_Of_Colors; + + function Number_Of_Color_Pairs return Natural + is + C_Number_Of_Color_Pairs : C_Int; + pragma Import (C, C_Number_Of_Color_Pairs, "COLOR_PAIRS"); + begin + return Natural (C_Number_Of_Color_Pairs); + end Number_Of_Color_Pairs; +------------------------------------------------------------------------------ + procedure Transform_Coordinates + (W : in Window := Standard_Window; + Line : in out Line_Position; + Column : in out Column_Position; + Dir : in Transform_Direction := From_Screen) + is + type Int_Access is access all C_Int; + function Transform (W : Window; + Y, X : Int_Access; + Dir : C_Int) return C_Int; + pragma Import (C, Transform, "_nc_ada_coord_transform"); + + X : aliased C_Int := C_Int (Column); + Y : aliased C_Int := C_Int (Line); + D : C_Int := 0; + R : C_Int; + begin + if Dir = To_Screen then + D := 1; + end if; + R := Transform (W, Y'Access, X'Access, D); + if R = Curses_False then + raise Curses_Exception; + else + Line := Line_Position (Y); + Column := Column_Position (X); + end if; + end Transform_Coordinates; + +begin + if Generation_Bit_Order /= System.Default_Bit_Order then + raise Constraint_Error; + end if; +end Terminal_Interface.Curses; diff --git a/Ada95/ada_include/terminal_interface.ads b/Ada95/ada_include/terminal_interface.ads new file mode 100644 index 00000000..dabec0ba --- /dev/null +++ b/Ada95/ada_include/terminal_interface.ads @@ -0,0 +1,31 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +package Terminal_Interface is +-- +-- Everything is in the child units +-- +end Terminal_Interface; diff --git a/Ada95/gen/Makefile.in b/Ada95/gen/Makefile.in new file mode 100644 index 00000000..775c344f --- /dev/null +++ b/Ada95/gen/Makefile.in @@ -0,0 +1,285 @@ +#---------------------------------------------------------------------------- +# -- +# GNAT ncurses Binding -- +# gen/Makefile -- +# -- +# Version 00.92 -- +# -- +# The ncurses Ada95 binding is copyrighted 1996 by -- +# Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +# -- +# Permission is hereby granted to reproduce and distribute this -- +# binding by any means and for any fee, whether alone or as part -- +# of a larger distribution, in source or in binary form, PROVIDED -- +# this notice is included with any such distribution, and is not -- +# removed from any of its header files. Mention of ncurses and the -- +# author of this binding in any applications linked with it is -- +# highly appreciated. -- +# -- +# This binding comes AS IS with no warranty, implied or expressed. -- +#---------------------------------------------------------------------------- +# Version Control +# $Revision: 1.8 $ +# +.SUFFIXES: + +SHELL = /bin/sh +THIS = Makefile + +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ +datadir = @datadir@ +ticdir = $(datadir)/terminfo + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +AWK = @AWK@ +LN_S = @LN_S@ + +CC = @CC@ +CFLAGS = @CFLAGS@ + +CPPFLAGS = @ACPPFLAGS@ \ + -DHAVE_CONFIG_H -I$(srcdir) + +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) +LD_FLAGS = @LD_MODEL@ $(LOCAL_LIBS) @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS) + +RANLIB = @RANLIB@ + +LIB_CURSES = -L ../../lib -lncurses + +M4 = m4 +M4FLAGS = + +DEL_ADAMODE = sed -e '/^\-\-\ \ \-\*\-\ ada\ \-\*\-.*/d' + +################################################################################ +ALIB = @nc_ada_package@ +ABASE = $(ALIB)-curses + +ADA_SRCDIR = ../ada_include +ADA_OBJDIR = ../ada_objects +OBJDIR = ../objects + +GEN_FILES0 = Base_Defs + +GEN_FILES1 = Key_Definitions \ + Old_Keys \ + Character_Attribute_Set_Rep \ + AC_Rep \ + Color_Defs \ + ACS_Map \ + Linker_Options \ + Base_Defs + +GEN_FILES2 = Menu_Opt_Rep \ + Menu_Base_Defs \ + Menu_Linker_Options \ + Item_Rep + +GEN_FILES3 = Form_Opt_Rep \ + Form_Base_Defs \ + Form_Linker_Options \ + Field_Rep + +GEN_FILES4 = Mouse_Base_Defs \ + Mouse_Event_Rep \ + Panel_Linker_Options + +GEN_TARGETS = $(ADA_SRCDIR)/$(ABASE).ads \ + $(ADA_SRCDIR)/$(ABASE)-menus.ads \ + $(ADA_SRCDIR)/$(ABASE)-forms.ads \ + $(ADA_SRCDIR)/$(ABASE)-mouse.ads \ + $(ADA_SRCDIR)/$(ABASE)-panels.ads \ + $(ADA_SRCDIR)/$(ABASE)-menus-menu_user_data.ads \ + $(ADA_SRCDIR)/$(ABASE)-menus-item_user_data.ads \ + $(ADA_SRCDIR)/$(ABASE)-forms-form_user_data.ads \ + $(ADA_SRCDIR)/$(ABASE)-forms-field_user_data.ads \ + $(ADA_SRCDIR)/$(ABASE)-panels-user_data.ads + +GEN_SRC = $(srcdir)/$(ABASE).ads.m4 \ + $(srcdir)/$(ABASE)-menus.ads.m4 \ + $(srcdir)/$(ABASE)-forms.ads.m4 \ + $(srcdir)/$(ABASE)-mouse.ads.m4 \ + $(srcdir)/$(ABASE)-panels.ads.m4 \ + $(srcdir)/$(ABASE)-menus-menu_user_data.ads.m4 \ + $(srcdir)/$(ABASE)-menus-item_user_data.ads.m4 \ + $(srcdir)/$(ABASE)-forms-form_user_data.ads.m4 \ + $(srcdir)/$(ABASE)-forms-field_user_data.ads.m4 \ + $(srcdir)/$(ABASE)-panels-user_data.ads.m4 + + +all: $(GEN_TARGETS) dirs + @ + +dirs: + @-mkdir $(OBJDIR) $(ADA_OBJDIR) + +gen: gen.o + @ECHO_LINK@ $(LINK) $(CFLAGS_NORMAL) gen.o $(LD_FLAGS) -o $@ $(LIB_CURSES) + +gen.o: $(srcdir)/gen.c + $(CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/gen.c + +Character_Attribute_Set_Rep: gen + ./gen B A >$@ + +Base_Defs: gen + ./gen B B >$@ + +Color_Defs: gen + ./gen B C >$@ + +Key_Definitions: gen + ./gen B K >$@ + +Old_Keys: gen + ./gen B O >$@ + +ACS_Map: gen + ./gen B M >$@ + +AC_Rep: gen + ./gen B R >$@ + +Linker_Options: gen + ./gen B L >$@ + +Menu_Opt_Rep: gen + ./gen M R >$@ + +Menu_Base_Defs: gen + ./gen M B >$@ + +Menu_Linker_Options: gen + ./gen M L >$@ + +Item_Rep: gen + ./gen M I >$@ + +Form_Opt_Rep: gen + ./gen F R >$@ + +Form_Base_Defs: gen + ./gen F B >$@ + +Form_Linker_Options: gen + ./gen F L >$@ + +Field_Rep: gen + ./gen F I >$@ + +Mouse_Base_Defs: gen + ./gen P B >$@ + +Mouse_Event_Rep: gen + ./gen P M >$@ + +Panel_Linker_Options: gen + ./gen P L >$@ + +$(ADA_SRCDIR)/$(ABASE).ads: $(srcdir)/$(ABASE).ads.m4 \ + $(GEN_FILES1) $(srcdir)/normal.m4 + $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \ + $(srcdir)/$(ABASE).ads.m4 |\ + $(DEL_ADAMODE) >$@ + +$(ADA_SRCDIR)/$(ABASE)-menus.ads: $(srcdir)/$(ABASE)-menus.ads.m4 \ + $(GEN_FILES2) $(srcdir)/normal.m4 + $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \ + $(srcdir)/$(ABASE)-menus.ads.m4 |\ + $(DEL_ADAMODE) >$@ + +$(ADA_SRCDIR)/$(ABASE)-forms.ads: $(srcdir)/$(ABASE)-forms.ads.m4 \ + $(GEN_FILES3) $(srcdir)/normal.m4 + $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \ + $(srcdir)/$(ABASE)-forms.ads.m4 |\ + $(DEL_ADAMODE) >$@ + +$(ADA_SRCDIR)/$(ABASE)-mouse.ads: $(srcdir)/$(ABASE)-mouse.ads.m4 \ + $(GEN_FILES4) $(srcdir)/normal.m4 + $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \ + $(srcdir)/$(ABASE)-mouse.ads.m4 |\ + $(DEL_ADAMODE) >$@ + +$(ADA_SRCDIR)/$(ABASE)-panels.ads: $(srcdir)/$(ABASE)-panels.ads.m4 \ + $(srcdir)/normal.m4 + $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \ + $(srcdir)/$(ABASE)-panels.ads.m4 |\ + $(DEL_ADAMODE) >$@ + +$(ADA_SRCDIR)/$(ABASE)-menus-menu_user_data.ads: \ + $(srcdir)/$(ABASE)-menus-menu_user_data.ads.m4 \ + $(srcdir)/normal.m4 + $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \ + $(srcdir)/$(ABASE)-menus-menu_user_data.ads.m4 |\ + $(DEL_ADAMODE) >$@ + +$(ADA_SRCDIR)/$(ABASE)-menus-item_user_data.ads: \ + $(srcdir)/$(ABASE)-menus-item_user_data.ads.m4 \ + $(srcdir)/normal.m4 + $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \ + $(srcdir)/$(ABASE)-menus-item_user_data.ads.m4 |\ + $(DEL_ADAMODE) >$@ + +$(ADA_SRCDIR)/$(ABASE)-forms-form_user_data.ads: \ + $(srcdir)/$(ABASE)-forms-form_user_data.ads.m4 \ + $(srcdir)/normal.m4 + $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \ + $(srcdir)/$(ABASE)-forms-form_user_data.ads.m4 |\ + $(DEL_ADAMODE) >$@ + +$(ADA_SRCDIR)/$(ABASE)-forms-field_user_data.ads: \ + $(srcdir)/$(ABASE)-forms-field_user_data.ads.m4 \ + $(srcdir)/normal.m4 + $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \ + $(srcdir)/$(ABASE)-forms-field_user_data.ads.m4 |\ + $(DEL_ADAMODE) >$@ + +$(ADA_SRCDIR)/$(ABASE)-panels-user_data.ads: \ + $(srcdir)/$(ABASE)-panels-user_data.ads.m4 \ + $(srcdir)/normal.m4 + $(M4) $(M4FLAGS) -DM4MACRO=$(srcdir)/normal.m4 \ + $(srcdir)/$(ABASE)-panels-user_data.ads.m4 |\ + $(DEL_ADAMODE) >$@ + +install :: + +install.libs :: + +install.progs :: + +tags: + ctags *.[ch] + +TAGS: + etags *.[ch] + +clean :: + rm -f a.out core gen *.o $(GEN_FILES1) $(GEN_FILES2) $(GEN_FILES3) \ + $(GEN_FILES4) $(GEN_TARGETS) + +mostlyclean :: clean + +distclean :: mostlyclean + rm -f Makefile + +realclean :: distclean + +############################################################################### +# The remainder of this file is automatically generated during configuration +############################################################################### diff --git a/Ada95/gen/gen.c b/Ada95/gen/gen.c new file mode 100644 index 00000000..3a1426f4 --- /dev/null +++ b/Ada95/gen/gen.c @@ -0,0 +1,977 @@ +/*---------------------------------------------------------------------------- +// -- +// GNAT ncurses Binding -- +// -- +// gen.c -- +// -- +// B O D Y -- +// -- +// Version 00.92 -- +// -- +// The ncurses Ada95 binding is copyrighted 1996 by -- +// Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +// -- +// Permission is hereby granted to reproduce and distribute this -- +// binding by any means and for any fee, whether alone or as part -- +// of a larger distribution, in source or in binary form, PROVIDED -- +// this notice is included with any such distribution, and is not -- +// removed from any of its header files. Mention of ncurses and the -- +// author of this binding in any applications linked with it is -- +// highly appreciated. -- +// -- +// This binding comes AS IS with no warranty, implied or expressed. -- +//---------------------------------------------------------------------------- + Version Control + $Revision: 1.8 $ + --------------------------------------------------------------------------*/ +/* + This program generates various record structures and constants from the + ncurses header file for the Ada95 packages. Essentially it produces + Ada95 source on stdout, which is then merged using m4 into a template + to produce the real source. + */ + +#include +#include +#include +#include + +#include +#include + +#define RES_NAME "Reserved" + +static int little_endian = 0; + +typedef struct { + const char *name; + unsigned int attr; +} name_attribute_pair; + +static int find_pos (char *s, unsigned len, int *low, int *high) +{ + unsigned int i,j; + int l = 0; + + *high = -1; + *low = 8*len; + + for(i=0; i < len; i++,s++) + { + if (*s) + { + for(j=0;j<8*sizeof(char);j++) + { + if ((( little_endian && ((*s)&0x01)) || + (!little_endian && ((*s)&0x80))) ) + { + if (l > *high) + *high = l; + if (l < *low) + *low = l; + } + l++; + if (little_endian) + *s >>= 1; + else + *s <<= 1; + } + } + else + l += 8; + } + return (*high >= 0 && (*low <= *high)) ? *low : -1; +} + +static void gen_reps ( const name_attribute_pair *nap, + const char *name, + int len) +{ + int i,l,cnt = 0,low,high; + int width = strlen(RES_NAME); + int bias = 0; + unsigned int a; + unsigned int mask = 0; + char *suffix; + + assert (nap); + + if (len == sizeof(int)/2) + { + bias = little_endian ? 8 * len : 0; + suffix = " / 2"; + } + else + { + assert(len==sizeof(int)); + suffix = ""; + } + + for (i=0; nap[i].name != (char *)0; i++) + { + cnt++; + l = strlen(nap[i].name); + if (l>width) + width = l; + } + assert (width > 0); + + printf(" type %s is\n",name); + printf(" record\n"); + for (i=0; nap[i].name != (char *)0; i++) + { + printf(" %-*s : Boolean;\n",width,nap[i].name); + } + if (cnt != 8*len) + { + printf(" %-*s : Boolean;\n",width,RES_NAME); + } + printf(" end record;\n"); + printf(" pragma Pack (%s);\n",name); + printf(" pragma Convention (C, %s);\n\n",name); + + printf(" for %s use\n",name); + printf(" record\n"); + + for (i=0; nap[i].name != (char *)0; i++) + { + a = nap[i].attr; + mask |= a; + l = find_pos( (char *)&a,sizeof(a),&low,&high ); + if (l>=0) + printf(" %-*s at 0 range %2d .. %2d;\n",width,nap[i].name,low-bias,high-bias); + } + if (cnt != 8*len) + { + mask = ~mask; + assert(mask); + if (little_endian) + l = 8*len - 1; + else + l = 0; + printf(" %-*s at 0 range %2d .. %2d;\n",width,RES_NAME,l,l); + } + printf(" end record;\n"); + printf(" for %s'Size use Interfaces.C.int'Size%s;\n", name, suffix); + printf(" -- Please note: this rep. clause is generated and may be\n"); + printf(" -- different on your system."); +} + + +static void chtype_rep (const char *name, int mask) +{ + int x = -1; + int t = x & mask; + int low, high; + int l = find_pos ((char *)&t, sizeof(t), &low, &high); + if (l>=0) + printf(" %-5s at 0 range %2d .. %2d;\n",name,low,high); +} + +static void gen_chtype_rep(const char *name) +{ + printf(" for %s use\n record\n",name); + chtype_rep("Ch",A_CHARTEXT); + chtype_rep("Color",A_COLOR); + chtype_rep("Attr",(A_ATTRIBUTES&~A_COLOR)); + printf(" end record;\n for %s'Size use Interfaces.C.int'Size;\n",name); + printf(" -- Please note: this rep. clause is generated and may be\n"); + printf(" -- different on your system.\n"); +} + + +static void mrep_rep (const char *name, void *rec) +{ + int low, high; + int l = find_pos((char *)rec, sizeof(MEVENT), &low, &high); + if (l>=0) + printf(" %-7s at 0 range %3d .. %3d;\n",name,low,high); +} + + +static void gen_mrep_rep(const char *name) +{ + MEVENT x; + + printf(" for %s use\n record\n",name); + + memset(&x,0,sizeof(x)); + x.id = -1; + mrep_rep("Id",&x); + + memset(&x,0,sizeof(x)); + x.x = -1; + mrep_rep("X",&x); + + memset(&x,0,sizeof(x)); + x.y = -1; + mrep_rep("Y",&x); + + memset(&x,0,sizeof(x)); + x.z = -1; + mrep_rep("Z",&x); + + memset(&x,0,sizeof(x)); + x.bstate = -1; + mrep_rep("Bstate",&x); + + printf(" end record;\n"); + printf(" -- Please note: this rep. clause is generated and may be\n"); + printf(" -- different on your system.\n"); +} + +static void gen_attr_set( const char *name ) +{ + static const name_attribute_pair nap[] = { +#ifdef A_STANDOUT + {"Stand_Out", A_STANDOUT}, +#endif +#ifdef A_UNDERLINE + {"Under_Line", A_UNDERLINE}, +#endif +#ifdef A_REVERSE + {"Reverse_Video", A_REVERSE}, +#endif +#ifdef A_BLINK + {"Blink", A_BLINK}, +#endif +#ifdef A_DIM + {"Dim_Character", A_DIM}, +#endif +#ifdef A_BOLD + {"Bold_Character", A_BOLD}, +#endif +#ifdef A_ALTCHARSET + {"Alternate_Character_Set", A_ALTCHARSET}, +#endif +#ifdef A_INVIS + {"Invisible_Character", A_INVIS}, +#endif +#ifdef A_PROTECT + {"Protected_Character", A_PROTECT}, +#endif +#ifdef A_HORIZONTAL + {"Horizontal", A_HORIZONTAL}, +#endif +#ifdef A_LEFT + {"Left", A_LEFT}, +#endif +#ifdef A_LOW + {"Low", A_LOW}, +#endif +#ifdef A_RIGHT + {"Right", A_RIGHT}, +#endif +#ifdef A_TOP + {"Top", A_TOP}, +#endif +#ifdef A_VERTICAL + {"Vertical", A_VERTICAL}, +#endif + {(char *)0, 0} + }; + gen_reps (nap, name, sizeof(int)/2); +} + +static void gen_menu_opt_rep(const char *name) +{ + static const name_attribute_pair nap[] = { +#ifdef O_ONEVALUE + {"One_Valued", O_ONEVALUE}, +#endif +#ifdef O_SHOWDESC + {"Show_Descriptions", O_SHOWDESC}, +#endif +#ifdef O_ROWMAJOR + {"Row_Major_Order", O_ROWMAJOR}, +#endif +#ifdef O_IGNORECASE + {"Ignore_Case", O_IGNORECASE}, +#endif +#ifdef O_SHOWMATCH + {"Show_Matches", O_SHOWMATCH}, +#endif +#ifdef O_NONCYCLIC + {"Non_Cyclic", O_NONCYCLIC}, +#endif + {(char *)0, 0} + }; + gen_reps (nap, name, sizeof(int)); +} + +static void gen_item_opt_rep(const char *name) +{ + static const name_attribute_pair nap[] = { +#ifdef O_SELECTABLE + {"Selectable", O_SELECTABLE}, +#endif + {(char *)0 , 0} + }; + gen_reps (nap, name, sizeof(int)); +} + +static void gen_form_opt_rep(const char *name) +{ + static const name_attribute_pair nap[] = { +#ifdef O_NL_OVERLOAD + {"NL_Overload", O_NL_OVERLOAD}, +#endif +#ifdef O_BS_OVERLOAD + {"BS_Overload", O_BS_OVERLOAD}, +#endif + {(char *)0 , 0} + }; + gen_reps (nap, name, sizeof(int)); +} + +static void gen_field_opt_rep(const char *name) +{ + static const name_attribute_pair nap[] = { +#ifdef O_VISIBLE + {"Visible",O_VISIBLE}, +#endif +#ifdef O_ACTIVE + {"Active",O_ACTIVE}, +#endif +#ifdef O_PUBLIC + {"Public",O_PUBLIC}, +#endif +#ifdef O_EDIT + {"Edit",O_EDIT}, +#endif +#ifdef O_WRAP + {"Wrap",O_WRAP}, +#endif +#ifdef O_BLANK + {"Blank",O_BLANK}, +#endif +#ifdef O_AUTOSKIP + {"Auto_Skip",O_AUTOSKIP}, +#endif +#ifdef O_NULLOK + {"Null_Ok",O_NULLOK}, +#endif +#ifdef O_PASSOK + {"Pass_Ok",O_PASSOK}, +#endif +#ifdef O_STATIC + {"Static",O_STATIC}, +#endif + {(char *)0, 0} + }; + gen_reps (nap, name, sizeof(int)); +} + +static void keydef(const char *name, const char *old_name, int value, int mode) +{ + if (mode==0) + printf(" %-30s : constant Special_Key_Code := 8#%3o#;\n",name,value); + else + { + const char *s = old_name; const char *t = name; + while ( *s && *t && (toupper(*s++) == toupper(*t++))); + if (*s || *t) + printf(" %-16s : Special_Key_Code renames %s;\n",old_name,name); + } +} + +static void gen_keydefs (int mode) +{ + char buf[16]; + char obuf[16]; + int i; + +#ifdef KEY_CODE_YES + keydef("Key_Code_Yes","KEY_CODE_YES",KEY_CODE_YES,mode); +#endif +#ifdef KEY_MIN + keydef("Key_Min","KEY_MIN",KEY_MIN,mode); +#endif +#ifdef KEY_BREAK + keydef("Key_Break","KEY_BREAK",KEY_BREAK,mode); +#endif +#ifdef KEY_DOWN + keydef("Key_Cursor_Down","KEY_DOWN",KEY_DOWN,mode); +#endif +#ifdef KEY_UP + keydef("Key_Cursor_Up","KEY_UP",KEY_UP,mode); +#endif +#ifdef KEY_LEFT + keydef("Key_Cursor_Left","KEY_LEFT",KEY_LEFT,mode); +#endif +#ifdef KEY_RIGHT + keydef("Key_Cursor_Right","KEY_RIGHT",KEY_RIGHT,mode); +#endif +#ifdef KEY_HOME + keydef("Key_Home","KEY_HOME",KEY_HOME,mode); +#endif +#ifdef KEY_BACKSPACE + keydef("Key_Backspace","KEY_BACKSPACE",KEY_BACKSPACE,mode); +#endif +#ifdef KEY_F0 + keydef("Key_F0","KEY_F0",KEY_F0,mode); +#endif +#ifdef KEY_F + for(i=1;i<=24;i++) + { + sprintf(buf ,"Key_F%d",i); + sprintf(obuf,"KEY_F%d",i); + keydef(buf,obuf,KEY_F(i),mode); + } +#endif +#ifdef KEY_DL + keydef("Key_Delete_Line","KEY_DL",KEY_DL,mode); +#endif +#ifdef KEY_IL + keydef("Key_Insert_Line","KEY_IL",KEY_IL,mode); +#endif +#ifdef KEY_DC + keydef("Key_Delete_Char","KEY_DC",KEY_DC,mode); +#endif +#ifdef KEY_IC + keydef("Key_Insert_Char","KEY_IC",KEY_IC,mode); +#endif +#ifdef KEY_EIC + keydef("Key_Exit_Insert_Mode","KEY_EIC",KEY_EIC,mode); +#endif +#ifdef KEY_CLEAR + keydef("Key_Clear_Screen","KEY_CLEAR",KEY_CLEAR,mode); +#endif +#ifdef KEY_EOS + keydef("Key_Clear_End_Of_Screen","KEY_EOS",KEY_EOS,mode); +#endif +#ifdef KEY_EOL + keydef("Key_Clear_End_Of_Line","KEY_EOL",KEY_EOL,mode); +#endif +#ifdef KEY_SF + keydef("Key_Scroll_1_Forward","KEY_SF",KEY_SF,mode); +#endif +#ifdef KEY_SR + keydef("Key_Scroll_1_Backward","KEY_SR",KEY_SR,mode); +#endif +#ifdef KEY_NPAGE + keydef("Key_Next_Page","KEY_NPAGE",KEY_NPAGE,mode); +#endif +#ifdef KEY_PPAGE + keydef("Key_Previous_Page","KEY_PPAGE",KEY_PPAGE,mode); +#endif +#ifdef KEY_STAB + keydef("Key_Set_Tab","KEY_STAB",KEY_STAB,mode); +#endif +#ifdef KEY_CTAB + keydef("Key_Clear_Tab","KEY_CTAB",KEY_CTAB,mode); +#endif +#ifdef KEY_CATAB + keydef("Key_Clear_All_Tabs","KEY_CATAB",KEY_CATAB,mode); +#endif +#ifdef KEY_ENTER + keydef("Key_Enter_Or_Send","KEY_ENTER",KEY_ENTER,mode); +#endif +#ifdef KEY_SRESET + keydef("Key_Soft_Reset","KEY_SRESET",KEY_SRESET,mode); +#endif +#ifdef KEY_RESET + keydef("Key_Reset","KEY_RESET",KEY_RESET,mode); +#endif +#ifdef KEY_PRINT + keydef("Key_Print","KEY_PRINT",KEY_PRINT,mode); +#endif +#ifdef KEY_LL + keydef("Key_Bottom","KEY_LL",KEY_LL,mode); +#endif +#ifdef KEY_A1 + keydef("Key_Upper_Left_Of_Keypad","KEY_A1",KEY_A1,mode); +#endif +#ifdef KEY_A3 + keydef("Key_Upper_Right_Of_Keypad","KEY_A3",KEY_A3,mode); +#endif +#ifdef KEY_B2 + keydef("Key_Center_Of_Keypad","KEY_B2",KEY_B2,mode); +#endif +#ifdef KEY_C1 + keydef("Key_Lower_Left_Of_Keypad","KEY_C1",KEY_C1,mode); +#endif +#ifdef KEY_C3 + keydef("Key_Lower_Right_Of_Keypad","KEY_C3",KEY_C3,mode); +#endif +#ifdef KEY_BTAB + keydef("Key_Back_Tab","KEY_BTAB",KEY_BTAB,mode); +#endif +#ifdef KEY_BEG + keydef("Key_Beginning","KEY_BEG",KEY_BEG,mode); +#endif +#ifdef KEY_CANCEL + keydef("Key_Cancel","KEY_CANCEL",KEY_CANCEL,mode); +#endif +#ifdef KEY_CLOSE + keydef("Key_Close","KEY_CLOSE",KEY_CLOSE,mode); +#endif +#ifdef KEY_COMMAND + keydef("Key_Command","KEY_COMMAND",KEY_COMMAND,mode); +#endif +#ifdef KEY_COPY + keydef("Key_Copy","KEY_COPY",KEY_COPY,mode); +#endif +#ifdef KEY_CREATE + keydef("Key_Create","KEY_CREATE",KEY_CREATE,mode); +#endif +#ifdef KEY_END + keydef("Key_End","KEY_END",KEY_END,mode); +#endif +#ifdef KEY_EXIT + keydef("Key_Exit","KEY_EXIT",KEY_EXIT,mode); +#endif +#ifdef KEY_FIND + keydef("Key_Find","KEY_FIND",KEY_FIND,mode); +#endif +#ifdef KEY_HELP + keydef("Key_Help","KEY_HELP",KEY_HELP,mode); +#endif +#ifdef KEY_MARK + keydef("Key_Mark","KEY_MARK",KEY_MARK,mode); +#endif +#ifdef KEY_MESSAGE + keydef("Key_Message","KEY_MESSAGE",KEY_MESSAGE,mode); +#endif +#ifdef KEY_MOVE + keydef("Key_Move","KEY_MOVE",KEY_MOVE,mode); +#endif +#ifdef KEY_NEXT + keydef("Key_Next","KEY_NEXT",KEY_NEXT,mode); +#endif +#ifdef KEY_OPEN + keydef("Key_Open","KEY_OPEN",KEY_OPEN,mode); +#endif +#ifdef KEY_OPTIONS + keydef("Key_Options","KEY_OPTIONS",KEY_OPTIONS,mode); +#endif +#ifdef KEY_PREVIOUS + keydef("Key_Previous","KEY_PREVIOUS",KEY_PREVIOUS,mode); +#endif +#ifdef KEY_REDO + keydef("Key_Redo","KEY_REDO",KEY_REDO,mode); +#endif +#ifdef KEY_REFERENCE + keydef("Key_Reference","KEY_REFERENCE",KEY_REFERENCE,mode); +#endif +#ifdef KEY_REFRESH + keydef("Key_Refresh","KEY_REFRESH",KEY_REFRESH,mode); +#endif +#ifdef KEY_REPLACE + keydef("Key_Replace","KEY_REPLACE",KEY_REPLACE,mode); +#endif +#ifdef KEY_RESTART + keydef("Key_Restart","KEY_RESTART",KEY_RESTART,mode); +#endif +#ifdef KEY_RESUME + keydef("Key_Resume","KEY_RESUME",KEY_RESUME,mode); +#endif +#ifdef KEY_SAVE + keydef("Key_Save","KEY_SAVE",KEY_SAVE,mode); +#endif +#ifdef KEY_SBEG + keydef("Key_Shift_Begin","KEY_SBEG",KEY_SBEG,mode); +#endif +#ifdef KEY_SCANCEL + keydef("Key_Shift_Cancel","KEY_SCANCEL",KEY_SCANCEL,mode); +#endif +#ifdef KEY_SCOMMAND + keydef("Key_Shift_Command","KEY_SCOMMAND",KEY_SCOMMAND,mode); +#endif +#ifdef KEY_SCOPY + keydef("Key_Shift_Copy","KEY_SCOPY",KEY_SCOPY,mode); +#endif +#ifdef KEY_SCREATE + keydef("Key_Shift_Create","KEY_SCREATE",KEY_SCREATE,mode); +#endif +#ifdef KEY_SDC + keydef("Key_Shift_Delete_Char","KEY_SDC",KEY_SDC,mode); +#endif +#ifdef KEY_SDL + keydef("Key_Shift_Delete_Line","KEY_SDL",KEY_SDL,mode); +#endif +#ifdef KEY_SELECT + keydef("Key_Select","KEY_SELECT",KEY_SELECT,mode); +#endif +#ifdef KEY_SEND + keydef("Key_Shift_End","KEY_SEND",KEY_SEND,mode); +#endif +#ifdef KEY_SEOL + keydef("Key_Shift_Clear_End_Of_Line","KEY_SEOL",KEY_SEOL,mode); +#endif +#ifdef KEY_SEXIT + keydef("Key_Shift_Exit","KEY_SEXIT",KEY_SEXIT,mode); +#endif +#ifdef KEY_SFIND + keydef("Key_Shift_Find","KEY_SFIND",KEY_SFIND,mode); +#endif +#ifdef KEY_SHELP + keydef("Key_Shift_Help","KEY_SHELP",KEY_SHELP,mode); +#endif +#ifdef KEY_SHOME + keydef("Key_Shift_Home","KEY_SHOME",KEY_SHOME,mode); +#endif +#ifdef KEY_SIC + keydef("Key_Shift_Insert_Char","KEY_SIC",KEY_SIC,mode); +#endif +#ifdef KEY_SLEFT + keydef("Key_Shift_Cursor_Left","KEY_SLEFT",KEY_SLEFT,mode); +#endif +#ifdef KEY_SMESSAGE + keydef("Key_Shift_Message","KEY_SMESSAGE",KEY_SMESSAGE,mode); +#endif +#ifdef KEY_SMOVE + keydef("Key_Shift_Move","KEY_SMOVE",KEY_SMOVE,mode); +#endif +#ifdef KEY_SNEXT + keydef("Key_Shift_Next_Page","KEY_SNEXT",KEY_SNEXT,mode); +#endif +#ifdef KEY_SOPTIONS + keydef("Key_Shift_Options","KEY_SOPTIONS",KEY_SOPTIONS,mode); +#endif +#ifdef KEY_SPREVIOUS + keydef("Key_Shift_Previous_Page","KEY_SPREVIOUS",KEY_SPREVIOUS,mode); +#endif +#ifdef KEY_SPRINT + keydef("Key_Shift_Print","KEY_SPRINT",KEY_SPRINT,mode); +#endif +#ifdef KEY_SREDO + keydef("Key_Shift_Redo","KEY_SREDO",KEY_SREDO,mode); +#endif +#ifdef KEY_SREPLACE + keydef("Key_Shift_Replace","KEY_SREPLACE",KEY_SREPLACE,mode); +#endif +#ifdef KEY_SRIGHT + keydef("Key_Shift_Cursor_Right","KEY_SRIGHT",KEY_SRIGHT,mode); +#endif +#ifdef KEY_SRSUME + keydef("Key_Shift_Resume","KEY_SRSUME",KEY_SRSUME,mode); +#endif +#ifdef KEY_SSAVE + keydef("Key_Shift_Save","KEY_SSAVE",KEY_SSAVE,mode); +#endif +#ifdef KEY_SSUSPEND + keydef("Key_Shift_Suspend","KEY_SSUSPEND",KEY_SSUSPEND,mode); +#endif +#ifdef KEY_SUNDO + keydef("Key_Shift_Undo","KEY_SUNDO",KEY_SUNDO,mode); +#endif +#ifdef KEY_SUSPEND + keydef("Key_Suspend","KEY_SUSPEND",KEY_SUSPEND,mode); +#endif +#ifdef KEY_UNDO + keydef("Key_Undo","KEY_UNDO",KEY_UNDO,mode); +#endif +#ifdef KEY_MOUSE + keydef("Key_Mouse","KEY_MOUSE",KEY_MOUSE,mode); +#endif +} + +static void acs_def (const char *name, chtype *a) +{ + int c = a - &acs_map[0]; + printf(" %-24s : constant Character := ",name); + if (isprint(c) && (c!='`')) + printf("'%c';\n",c); + else + printf("Character'Val (%d);\n",c); +} + + +static void gen_acs (void) +{ +#ifdef ACS_ULCORNER + acs_def("ACS_Upper_Left_Corner",&ACS_ULCORNER); +#endif +#ifdef ACS_LLCORNER + acs_def("ACS_Lower_Left_Corner",&ACS_LLCORNER); +#endif +#ifdef ACS_URCORNER + acs_def("ACS_Upper_Right_Corner",&ACS_URCORNER); +#endif +#ifdef ACS_LRCORNER + acs_def("ACS_Lower_Right_Corner",&ACS_LRCORNER); +#endif +#ifdef ACS_LTEE + acs_def("ACS_Left_Tee",&ACS_LTEE); +#endif +#ifdef ACS_RTEE + acs_def("ACS_Right_Tee",&ACS_RTEE); +#endif +#ifdef ACS_BTEE + acs_def("ACS_Bottom_Tee",&ACS_BTEE); +#endif +#ifdef ACS_TTEE + acs_def("ACS_Top_Tee",&ACS_TTEE); +#endif +#ifdef ACS_HLINE + acs_def("ACS_Horizontal_Line",&ACS_HLINE); +#endif +#ifdef ACS_VLINE + acs_def("ACS_Vertical_Line",&ACS_VLINE); +#endif +#ifdef ACS_PLUS + acs_def("ACS_Plus_Symbol",&ACS_PLUS); +#endif +#ifdef ACS_S1 + acs_def("ACS_Scan_Line_1",&ACS_S1); +#endif +#ifdef ACS_S9 + acs_def("ACS_Scan_Line_9",&ACS_S9); +#endif +#ifdef ACS_DIAMOND + acs_def("ACS_Diamond",&ACS_DIAMOND); +#endif +#ifdef ACS_CKBOARD + acs_def("ACS_Checker_Board",&ACS_CKBOARD); +#endif +#ifdef ACS_DEGREE + acs_def("ACS_Degree",&ACS_DEGREE); +#endif +#ifdef ACS_PLMINUS + acs_def("ACS_Plus_Minus",&ACS_PLMINUS); +#endif +#ifdef ACS_BULLET + acs_def("ACS_Bullet",&ACS_BULLET); +#endif +#ifdef ACS_LARROW + acs_def("ACS_Left_Arrow",&ACS_LARROW); +#endif +#ifdef ACS_RARROW + acs_def("ACS_Right_Arrow",&ACS_RARROW); +#endif +#ifdef ACS_DARROW + acs_def("ACS_Down_Arrow",&ACS_DARROW); +#endif +#ifdef ACS_UARROW + acs_def("ACS_Up_Arrow",&ACS_UARROW); +#endif +#ifdef ACS_BOARD + acs_def("ACS_Board_Of_Squares",&ACS_BOARD); +#endif +#ifdef ACS_LANTERN + acs_def("ACS_Lantern",&ACS_LANTERN); +#endif +#ifdef ACS_BLOCK + acs_def("ACS_Solid_Block",&ACS_BLOCK); +#endif +#ifdef ACS_S3 + acs_def("ACS_Scan_Line_3",&ACS_S3); +#endif +#ifdef ACS_S7 + acs_def("ACS_Scan_Line_7",&ACS_S7); +#endif +#ifdef ACS_LEQUAL + acs_def("ACS_Less_Or_Equal",&ACS_LEQUAL); +#endif +#ifdef ACS_GEQUAL + acs_def("ACS_Greater_Or_Equal",&ACS_GEQUAL); +#endif +#ifdef ACS_PI + acs_def("ACS_PI",&ACS_PI); +#endif +#ifdef ACS_NEQUAL + acs_def("ACS_Not_Equal",&ACS_NEQUAL); +#endif +#ifdef ACS_STERLING + acs_def("ACS_Sterling",&ACS_STERLING); +#endif +} + +static void prologue(const char *name) +{ + time_t t = time(NULL); + printf("-- %s binding, generated at %s",name,ctime(&t)); + printf("-- This module is generated. Please don't change it manually!\n"); + printf("-- Run the generator instead.\n-- |"); + + printf("define(`M4_BIT_ORDER',`%s_Order_First')",little_endian ? "Low":"High"); +} + +static void basedefs (void) +{ + prologue("curses"); +#ifndef KEY_MAX +# define KEY_MAX 0777 +#endif + printf("define(`M4_KEY_MAX',`8#%o#')",KEY_MAX); +#ifndef KEY_MIN +# define KEY_MIN 0401 +#endif + if (KEY_MIN == 256) + abort(); + printf("define(`M4_SPECIAL_FIRST',`8#%o#')",KEY_MIN - 1); +} + +static void menu_basedefs (void) +{ + prologue("menu"); +} + +static void form_basedefs (void) +{ + prologue("form"); +} + +static void mouse_basedefs(void) +{ + prologue("mouse"); +} + +static void color_def (const char *name, int value) +{ + printf(" %-8s : constant Color_Number := %d;\n",name,value); +} + +static void gen_color (void) +{ +#ifdef COLOR_BLACK + color_def ("Black",COLOR_BLACK); +#endif +#ifdef COLOR_RED + color_def ("Red",COLOR_RED); +#endif +#ifdef COLOR_GREEN + color_def ("Green",COLOR_GREEN); +#endif +#ifdef COLOR_YELLOW + color_def ("Yellow",COLOR_YELLOW); +#endif +#ifdef COLOR_BLUE + color_def ("Blue",COLOR_BLUE); +#endif +#ifdef COLOR_MAGENTA + color_def ("Magenta",COLOR_MAGENTA); +#endif +#ifdef COLOR_CYAN + color_def ("Cyan",COLOR_CYAN); +#endif +#ifdef COLOR_WHITE + color_def ("White",COLOR_WHITE); +#endif +} + +static void gen_linkopts (void) +{ + printf(" pragma Linker_Options (\"-lncurses\");\n"); +} + +static void gen_menu_linkopts (void) +{ + printf(" pragma Linker_Options (\"-lmenu\");\n"); +} + +static void gen_form_linkopts (void) +{ + printf(" pragma Linker_Options (\"-lform\");\n"); +} + +static void gen_panel_linkopts (void) +{ + printf(" pragma Linker_Options (\"-lpanel\");\n"); +} + + +int main(int argc, char *argv[]) +{ + int x = 0x12345678; + char *s = (char *)&x; + + if (*s == 0x78) + little_endian = 1; + + if (argc!=3) + exit(1); + + switch(argv[1][0]) + { + case 'B': + switch(argv[2][0]) + { + case 'A': + gen_attr_set("Character_Attribute_Set"); + break; + case 'K': + gen_keydefs(0); + break; + case 'B': + basedefs(); + break; + case 'C': + gen_color(); + break; + case 'M': + gen_acs(); + break; + case 'L': + gen_linkopts(); + break; + case 'O': + gen_keydefs(1); + break; + case 'R': + gen_chtype_rep("Attributed_Character"); + break; + default: + break; + } + break; + case 'M': + switch(argv[2][0]) + { + case 'R': + gen_menu_opt_rep("Menu_Option_Set"); + break; + case 'B': + menu_basedefs(); + break; + case 'L': + gen_menu_linkopts(); + break; + case 'I': + gen_item_opt_rep("Item_Option_Set"); + break; + default: + break; + } + break; + case 'F': + switch(argv[2][0]) + { + case 'R': + gen_form_opt_rep("Form_Option_Set"); + break; + case 'B': + form_basedefs(); + break; + case 'L': + gen_form_linkopts(); + break; + case 'I': + gen_field_opt_rep("Field_Option_Set"); + break; + default: + break; + } + break; + case 'P': + switch(argv[2][0]) + { + case 'B': + mouse_basedefs(); + break; + case 'M': + gen_mrep_rep("Mouse_Event"); + break; + case 'L': + gen_panel_linkopts(); + break; + default: + break; + } + break; + default: + break; + } + return 0; +} diff --git a/Ada95/gen/normal.m4 b/Ada95/gen/normal.m4 new file mode 100644 index 00000000..f884c465 --- /dev/null +++ b/Ada95/gen/normal.m4 @@ -0,0 +1,8 @@ +define(`MANPAGE',`define(`MANPG',$1)dnl +|===================================================================== + -- | Man page MANPG + -- |=====================================================================')dnl +define(`ANCHOR',`define(`CFUNAME',`$1')define(`AFUNAME',`$2')'dnl +|)dnl +define(`AKA',``AKA': CFUNAME')dnl +define(`ALIAS',``AKA': $1')dnl diff --git a/Ada95/gen/terminal_interface-curses-forms-field_user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-forms-field_user_data.ads.m4 new file mode 100644 index 00000000..3fdeecb1 --- /dev/null +++ b/Ada95/gen/terminal_interface-curses-forms-field_user_data.ads.m4 @@ -0,0 +1,59 @@ +-- -*- ada -*- +define(`HTMLNAME',`terminal_interface-curses-forms-field_user_data_s.html')dnl +include(M4MACRO)dnl +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Field_User_Data -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ + +generic + type User is limited private; + type User_Access is access User; +package Terminal_Interface.Curses.Forms.Field_User_Data is + + -- The binding uses the C level user pointer already for its own + -- internal purposes. So you can´t easily manipulate the user pointer + -- with the low level C routines for this field without taking care of + -- this special situation. If you want to read or write with C routines + -- the user pointer of this field, you should get first the low level + -- user pointer. This points to a record, that always has as its first + -- member the Ada95 user pointer for this field. You should never change + -- the low level user pointer of an Ada created field. + -- + -- MANPAGE(`form_field_userptr.3x') + + -- ANCHOR(`set_field_userptr',`Set_User_Data') + procedure Set_User_Data (Fld : in Field; + Data : in User_Access); + -- AKA + pragma Convention (C, Set_User_Data); + + -- ANCHOR(`field_userptr',`Get_User_Data') + procedure Get_User_Data (Fld : in Field; + Data : out User_Access); + -- AKA + pragma Convention (C, Get_User_Data); + +end Terminal_Interface.Curses.Forms.Field_User_Data; diff --git a/Ada95/gen/terminal_interface-curses-forms-form_user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-forms-form_user_data.ads.m4 new file mode 100644 index 00000000..da9b0c5f --- /dev/null +++ b/Ada95/gen/terminal_interface-curses-forms-form_user_data.ads.m4 @@ -0,0 +1,60 @@ +-- -*- ada -*- +define(`HTMLNAME',`terminal_interface-curses-forms-form_user_data_s.html')dnl +include(M4MACRO)dnl +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Forms.Form_User_Data -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ + +generic + type User is limited private; + type User_Access is access User; +package Terminal_Interface.Curses.Forms.Form_User_Data is + + -- The binding uses the C level user pointer already for its own + -- internal purposes. So you can´t easily manipulate the user pointer + -- with the low level C routines for this form without taking care of + -- this special situation. If you want to read or write with C routines + -- the user pointer of this form, you should get first the low level + -- user pointer. This points to a record, that always has as its first + -- member the Ada95 user pointer for this form. You should never change + -- the low level user pointer of an Ada created form. + -- + -- MANPAGE(`form_userptr.3x') + + -- ANCHOR(`set_form_userptr',`Set_User_Data') + procedure Set_User_Data (Frm : in Form; + Data : in User_Access); + -- AKA + pragma Convention (C, Set_User_Data); + + -- ANCHOR(`form_userptr',`Get_User_Data') + procedure Get_User_Data (Frm : in Form; + Data : out User_Access); + -- AKA + pragma Convention (C, Get_User_Data); + +end Terminal_Interface.Curses.Forms.Form_User_Data; + diff --git a/Ada95/gen/terminal_interface-curses-forms.ads.m4 b/Ada95/gen/terminal_interface-curses-forms.ads.m4 new file mode 100644 index 00000000..998fdba1 --- /dev/null +++ b/Ada95/gen/terminal_interface-curses-forms.ads.m4 @@ -0,0 +1,812 @@ +-- -*- ada -*- +define(`HTMLNAME',`terminal_interface-curses-forms_s.html')dnl +include(M4MACRO)dnl +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Form -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.9 $ +------------------------------------------------------------------------------ +include(`Form_Base_Defs') +with System; +with Ada.Tags; use Ada.Tags; +with Ada.Characters.Latin_1; +with Interfaces.C; +with Interfaces.C.Strings; + +package Terminal_Interface.Curses.Forms is + +include(`Form_Linker_Options') + + Space : Character renames Ada.Characters.Latin_1.Space; + + type Field is private; + type Form is private; + type C_Field_Type is private; + + Null_Field : constant Field; + Null_Form : constant Form; + Null_Field_Type : constant C_Field_Type; + + + type Field_Justification is (None, + Left, + Center, + Right); + +include(`Field_Rep') + + Default_Field_Options : Field_Option_Set; + -- The initial defaults for the field options. + +include(`Form_Opt_Rep') + + Default_Form_Options : Form_Option_Set; + -- The initial defaults for the form options. + + type Buffer_Number is new Natural; + + type Field_Array is array (Positive range <>) of aliased Field; + pragma Convention (C, Field_Array); + + type Field_Array_Access is access all Field_Array; + + subtype Form_Request_Code is Key_Code range (Key_Max + 1) .. (Key_Max + 57); + + -- The prefix F_ stands for "Form Request" + F_Next_Page : constant Form_Request_Code := Key_Max + 1; + F_Previous_Page : constant Form_Request_Code := Key_Max + 2; + F_First_Page : constant Form_Request_Code := Key_Max + 3; + F_Last_Page : constant Form_Request_Code := Key_Max + 4; + + F_Next_Field : constant Form_Request_Code := Key_Max + 5; + F_Previous_Field : constant Form_Request_Code := Key_Max + 6; + F_First_Field : constant Form_Request_Code := Key_Max + 7; + F_Last_Field : constant Form_Request_Code := Key_Max + 8; + F_Sorted_Next_Field : constant Form_Request_Code := Key_Max + 9; + F_Sorted_Previous_Field : constant Form_Request_Code := Key_Max + 10; + F_Sorted_First_Field : constant Form_Request_Code := Key_Max + 11; + F_Sorted_Last_Field : constant Form_Request_Code := Key_Max + 12; + F_Left_Field : constant Form_Request_Code := Key_Max + 13; + F_Right_Field : constant Form_Request_Code := Key_Max + 14; + F_Up_Field : constant Form_Request_Code := Key_Max + 15; + F_Down_Field : constant Form_Request_Code := Key_Max + 16; + + F_Next_Char : constant Form_Request_Code := Key_Max + 17; + F_Previous_Char : constant Form_Request_Code := Key_Max + 18; + F_Next_Line : constant Form_Request_Code := Key_Max + 19; + F_Previous_Line : constant Form_Request_Code := Key_Max + 20; + F_Next_Word : constant Form_Request_Code := Key_Max + 21; + F_Previous_Word : constant Form_Request_Code := Key_Max + 22; + F_Begin_Field : constant Form_Request_Code := Key_Max + 23; + F_End_Field : constant Form_Request_Code := Key_Max + 24; + F_Begin_Line : constant Form_Request_Code := Key_Max + 25; + F_End_Line : constant Form_Request_Code := Key_Max + 26; + F_Left_Char : constant Form_Request_Code := Key_Max + 27; + F_Right_Char : constant Form_Request_Code := Key_Max + 28; + F_Up_Char : constant Form_Request_Code := Key_Max + 29; + F_Down_Char : constant Form_Request_Code := Key_Max + 30; + + F_New_Line : constant Form_Request_Code := Key_Max + 31; + F_Insert_Char : constant Form_Request_Code := Key_Max + 32; + F_Insert_Line : constant Form_Request_Code := Key_Max + 33; + F_Delete_Char : constant Form_Request_Code := Key_Max + 34; + F_Delete_Previous : constant Form_Request_Code := Key_Max + 35; + F_Delete_Line : constant Form_Request_Code := Key_Max + 36; + F_Delete_Word : constant Form_Request_Code := Key_Max + 37; + F_Clear_EOL : constant Form_Request_Code := Key_Max + 38; + F_Clear_EOF : constant Form_Request_Code := Key_Max + 39; + F_Clear_Field : constant Form_Request_Code := Key_Max + 40; + F_Overlay_Mode : constant Form_Request_Code := Key_Max + 41; + F_Insert_Mode : constant Form_Request_Code := Key_Max + 42; + + -- Vertical Scrolling + F_ScrollForward_Line : constant Form_Request_Code := Key_Max + 43; + F_ScrollBackward_Line : constant Form_Request_Code := Key_Max + 44; + F_ScrollForward_Page : constant Form_Request_Code := Key_Max + 45; + F_ScrollBackward_Page : constant Form_Request_Code := Key_Max + 46; + F_ScrollForward_HalfPage : constant Form_Request_Code := Key_Max + 47; + F_ScrollBackward_HalfPage : constant Form_Request_Code := Key_Max + 48; + + -- Horizontal Scrolling + F_HScrollForward_Char : constant Form_Request_Code := Key_Max + 49; + F_HScrollBackward_Char : constant Form_Request_Code := Key_Max + 50; + F_HScrollForward_Line : constant Form_Request_Code := Key_Max + 51; + F_HScrollBackward_Line : constant Form_Request_Code := Key_Max + 52; + F_HScrollForward_HalfLine : constant Form_Request_Code := Key_Max + 53; + F_HScrollBackward_HalfLine : constant Form_Request_Code := Key_Max + 54; + + F_Validate_Field : constant Form_Request_Code := Key_Max + 55; + F_Next_Choice : constant Form_Request_Code := Key_Max + 56; + F_Previous_Choice : constant Form_Request_Code := Key_Max + 57; + + -- For those who like the old 'C' style request names + REQ_NEXT_PAGE : Form_Request_Code renames F_Next_Page; + REQ_PREV_PAGE : Form_Request_Code renames F_Previous_Page; + REQ_FIRST_PAGE : Form_Request_Code renames F_First_Page; + REQ_LAST_PAGE : Form_Request_Code renames F_Last_Page; + + REQ_NEXT_FIELD : Form_Request_Code renames F_Next_Field; + REQ_PREV_FIELD : Form_Request_Code renames F_Previous_Field; + REQ_FIRST_FIELD : Form_Request_Code renames F_First_Field; + REQ_LAST_FIELD : Form_Request_Code renames F_Last_Field; + REQ_SNEXT_FIELD : Form_Request_Code renames F_Sorted_Next_Field; + REQ_SPREV_FIELD : Form_Request_Code renames F_Sorted_Previous_Field; + REQ_SFIRST_FIELD : Form_Request_Code renames F_Sorted_First_Field; + REQ_SLAST_FIELD : Form_Request_Code renames F_Sorted_Last_Field; + REQ_LEFT_FIELD : Form_Request_Code renames F_Left_Field; + REQ_RIGHT_FIELD : Form_Request_Code renames F_Right_Field; + REQ_UP_FIELD : Form_Request_Code renames F_Up_Field; + REQ_DOWN_FIELD : Form_Request_Code renames F_Down_Field; + + REQ_NEXT_CHAR : Form_Request_Code renames F_Next_Char; + REQ_PREV_CHAR : Form_Request_Code renames F_Previous_Char; + REQ_NEXT_LINE : Form_Request_Code renames F_Next_Line; + REQ_PREV_LINE : Form_Request_Code renames F_Previous_Line; + REQ_NEXT_WORD : Form_Request_Code renames F_Next_Word; + REQ_PREV_WORD : Form_Request_Code renames F_Previous_Word; + REQ_BEG_FIELD : Form_Request_Code renames F_Begin_Field; + REQ_END_FIELD : Form_Request_Code renames F_End_Field; + REQ_BEG_LINE : Form_Request_Code renames F_Begin_Line; + REQ_END_LINE : Form_Request_Code renames F_End_Line; + REQ_LEFT_CHAR : Form_Request_Code renames F_Left_Char; + REQ_RIGHT_CHAR : Form_Request_Code renames F_Right_Char; + REQ_UP_CHAR : Form_Request_Code renames F_Up_Char; + REQ_DOWN_CHAR : Form_Request_Code renames F_Down_Char; + + REQ_NEW_LINE : Form_Request_Code renames F_New_Line; + REQ_INS_CHAR : Form_Request_Code renames F_Insert_Char; + REQ_INS_LINE : Form_Request_Code renames F_Insert_Line; + REQ_DEL_CHAR : Form_Request_Code renames F_Delete_Char; + REQ_DEL_PREV : Form_Request_Code renames F_Delete_Previous; + REQ_DEL_LINE : Form_Request_Code renames F_Delete_Line; + REQ_DEL_WORD : Form_Request_Code renames F_Delete_Word; + REQ_CLR_EOL : Form_Request_Code renames F_Clear_EOL; + REQ_CLR_EOF : Form_Request_Code renames F_Clear_EOF; + REQ_CLR_FIELD : Form_Request_Code renames F_Clear_Field; + REQ_OVL_MODE : Form_Request_Code renames F_Overlay_Mode; + REQ_INS_MODE : Form_Request_Code renames F_Insert_Mode; + + REQ_SCR_FLINE : Form_Request_Code renames F_ScrollForward_Line; + REQ_SCR_BLINE : Form_Request_Code renames F_ScrollBackward_Line; + REQ_SCR_FPAGE : Form_Request_Code renames F_ScrollForward_Page; + REQ_SCR_BPAGE : Form_Request_Code renames F_ScrollBackward_Page; + REQ_SCR_FHPAGE : Form_Request_Code renames F_ScrollForward_HalfPage; + REQ_SCR_BHPAGE : Form_Request_Code renames F_ScrollBackward_HalfPage; + + REQ_SCR_FCHAR : Form_Request_Code renames F_HScrollForward_Char; + REQ_SCR_BCHAR : Form_Request_Code renames F_HScrollBackward_Char; + REQ_SCR_HFLINE : Form_Request_Code renames F_HScrollForward_Line; + REQ_SCR_HBLINE : Form_Request_Code renames F_HScrollBackward_Line; + REQ_SCR_HFHALF : Form_Request_Code renames F_HScrollForward_HalfLine; + REQ_SCR_HBHALF : Form_Request_Code renames F_HScrollBackward_HalfLine; + + REQ_VALIDATION : Form_Request_Code renames F_Validate_Field; + REQ_NEXT_CHOICE : Form_Request_Code renames F_Next_Choice; + REQ_PREV_CHOICE : Form_Request_Code renames F_Previous_Choice; + + + procedure Request_Name (Key : in Form_Request_Code; + Name : out String); + + ------------------ + -- Exceptions -- + ------------------ + Form_Exception : exception; + + -- MANPAGE(`form_field_new.3x') + + -- ANCHOR(`new_field()',`Create') + function Create (Height : Line_Count; + Width : Column_Count; + Top : Line_Position; + Left : Column_Position; + Off_Screen : Natural := 0; + More_Buffers : Buffer_Number := Buffer_Number'First) + return Field; + -- AKA + + -- ANCHOR(`new_field()',`New_Field') + function New_Field (Height : Line_Count; + Width : Column_Count; + Top : Line_Position; + Left : Column_Position; + Off_Screen : Natural := 0; + More_Buffers : Buffer_Number := Buffer_Number'First) + return Field renames Create; + -- AKA + + -- ANCHOR(`free_field()',`Delete') + procedure Delete (Fld : in out Field); + -- AKA + -- Reset Fld to Null_Field + + -- ANCHOR(`dup_field()',`Duplicate') + function Duplicate (Fld : Field; + Top : Line_Position; + Left : Column_Position) return Field; + -- AKA + + -- ANCHOR(`link_field()',`Link') + function Link (Fld : Field; + Top : Line_Position; + Left : Column_Position) return Field; + -- AKA + + -- MANPAGE(`form_field_just.3x') + + -- ANCHOR(`set_field_just()',`Set_Justification') + procedure Set_Justification (Fld : in Field; + Just : in Field_Justification := None); + -- AKA + + -- ANCHOR(`field_just()',`Get_Justification') + function Get_Justification (Fld : Field) return Field_Justification; + -- AKA + + -- MANPAGE(`form_field_buffer.3x') + + -- ANCHOR(`set_field_buffer()',`Set_Buffer') + procedure Set_Buffer + (Fld : in Field; + Buffer : in Buffer_Number := Buffer_Number'First; + Str : in String); + -- AKA + + -- ANCHOR(`field_buffer()',`Get_Buffer') + procedure Get_Buffer + (Fld : in Field; + Buffer : in Buffer_Number := Buffer_Number'First; + Str : out String); + -- AKA + + -- ANCHOR(`set_field_status()',`Set_Status') + procedure Set_Status (Fld : in Field; + Status : in Boolean := True); + -- AKA + + -- ANCHOR(`field_status()',`Changed') + function Changed (Fld : Field) return Boolean; + -- AKA + + -- ANCHOR(`set_field_max()',`Set_Maximum_Size') + procedure Set_Maximum_Size (Fld : in Field; + Max : in Natural := 0); + -- AKA + + -- MANPAGE(`form_field_opts.3x') + + -- ANCHOR(`set_field_opts()',`Set_Options') + procedure Set_Options (Fld : in Field; + Options : in Field_Option_Set); + -- AKA + + -- ANCHOR(`field_opts_on()',`Switch_Options') + procedure Switch_Options (Fld : in Field; + Options : in Field_Option_Set; + On : Boolean := True); + -- AKA + -- ALIAS(`field_opts_off()') + + -- ANCHOR(`field_opts()',`Get_Options') + procedure Get_Options (Fld : in Field; + Options : out Field_Option_Set); + -- AKA + + -- ANCHOR(`field_opts()',`Get_Options') + function Get_Options (Fld : Field := Null_Field) + return Field_Option_Set; + -- AKA + + -- MANPAGE(`form_field_attributes.3x') + + -- ANCHOR(`set_field_fore()',`Set_Foreground') + procedure Set_Foreground + (Fld : in Field; + Fore : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First); + -- AKA + + -- ANCHOR(`field_fore()',`Foreground') + procedure Foreground (Fld : in Field; + Fore : out Character_Attribute_Set); + -- AKA + + -- ANCHOR(`field_fore()',`Foreground') + procedure Foreground (Fld : in Field; + Fore : out Character_Attribute_Set; + Color : out Color_Pair); + -- AKA + + -- ANCHOR(`set_field_back()',`Set_Background') + procedure Set_Background + (Fld : in Field; + Back : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First); + -- AKA + + -- ANCHOR(`field_back()',`Background') + procedure Background (Fld : in Field; + Back : out Character_Attribute_Set); + -- AKA + + -- ANCHOR(`field_back()',`Background') + procedure Background (Fld : in Field; + Back : out Character_Attribute_Set; + Color : out Color_Pair); + -- AKA + + -- ANCHOR(`set_field_pad()',`Set_Pad_Character') + procedure Set_Pad_Character (Fld : in Field; + Pad : in Character := Space); + -- AKA + + -- ANCHOR(`field_pad()',`Pad_Character') + procedure Pad_Character (Fld : in Field; + Pad : out Character); + -- AKA + + -- MANPAGE(`form_field_info.3x') + + -- ANCHOR(`field_info()',`Info') + procedure Info (Fld : in Field; + Lines : out Line_Count; + Columns : out Column_Count; + First_Row : out Line_Position; + First_Column : out Column_Position; + Off_Screen : out Natural; + Additional_Buffers : out Buffer_Number); + -- AKA + + -- ANCHOR(`dynamic_field_info()',`Dynamic_Info') + procedure Dynamic_Info (Fld : in Field; + Lines : out Line_Count; + Columns : out Column_Count; + Max : out Natural); + -- AKA + + -- MANPAGE(`form_win.3x') + + -- ANCHOR(`set_form_win()',`Set_Window') + procedure Set_Window (Frm : in Form; + Win : in Window); + -- AKA + + -- ANCHOR(`form_win()',`Get_Window') + function Get_Window (Frm : Form) return Window; + -- AKA + + -- ANCHOR(`set_form_sub()',`Set_Sub_Window') + procedure Set_Sub_Window (Frm : in Form; + Win : in Window); + -- AKA + + -- ANCHOR(`form_sub()',`Get_Sub_Window') + function Get_Sub_Window (Frm : Form) return Window; + -- AKA + + -- ANCHOR(`scale_form()',`Scale') + procedure Scale (Frm : in Form; + Lines : out Line_Count; + Columns : out Column_Count); + -- AKA + + -- MANPAGE(`form_hook.3x') + + type Form_Hook_Function is access procedure (Frm : in Form); + pragma Convention (C, Form_Hook_Function); + + -- ANCHOR(`set_field_init()',`Set_Field_Init_Hook') + procedure Set_Field_Init_Hook (Frm : in Form; + Proc : in Form_Hook_Function); + -- AKA + + -- ANCHOR(`set_field_term()',`Set_Field_Term_Hook') + procedure Set_Field_Term_Hook (Frm : in Form; + Proc : in Form_Hook_Function); + -- AKA + + -- ANCHOR(`set_form_init()',`Set_Form_Init_Hook') + procedure Set_Form_Init_Hook (Frm : in Form; + Proc : in Form_Hook_Function); + -- AKA + + -- ANCHOR(`set_form_term()',`Set_Form_Term_Hook') + procedure Set_Form_Term_Hook (Frm : in Form; + Proc : in Form_Hook_Function); + -- AKA + + -- ANCHOR(`field_init()',`Get_Field_Init_Hook') + function Get_Field_Init_Hook (Frm : Form) return Form_Hook_Function; + -- AKA + pragma Import (C, Get_Field_Init_Hook, "field_init"); + + -- ANCHOR(`field_term()',`Get_Field_Term_Hook') + function Get_Field_Term_Hook (Frm : Form) return Form_Hook_Function; + -- AKA + pragma Import (C, Get_Field_Term_Hook, "field_term"); + + -- ANCHOR(`form_init()',`Get_Form_Init_Hook') + function Get_Form_Init_Hook (Frm : Form) return Form_Hook_Function; + -- AKA + pragma Import (C, Get_Form_Init_Hook, "form_init"); + + -- ANCHOR(`form_term()',`Get_Form_Term_Hook') + function Get_Form_Term_Hook (Frm : Form) return Form_Hook_Function; + -- AKA + pragma Import (C, Get_Form_Term_Hook, "form_term"); + + -- MANPAGE(`form_field.3x') + + -- ANCHOR(`set_form_fields()',`Redefine') + procedure Redefine (Frm : in Form; + Flds : in Field_Array); + -- AKA + -- With a bit more comfort. You don´t need to terminate the Field_Array + -- with a null entry. This is handled internally in the binding. + + -- ANCHOR(`set_form_fields()',`Set_Fields') + procedure Set_Fields (Frm : in Form; + Flds : in Field_Array) renames Redefine; + -- AKA + + -- ANCHOR(`form_fields()',`Fields') + function Fields (Frm : Form) return Field_Array_Access; + -- AKA + + -- ANCHOR(`field_count()',`Field_Count') + function Field_Count (Frm : Form) return Natural; + -- AKA + + -- ANCHOR(`move_field()',`Move') + procedure Move (Fld : in Field; + Line : in Line_Position; + Column : in Column_Position); + -- AKA + + -- MANPAGE(`form_new.3x') + + -- ANCHOR(`new_form()',`Create') + function Create (Fields : Field_Array) return Form; + -- AKA + + -- ANCHOR(`new_form()',`New_Form') + function New_Form (Fields : Field_Array) return Form renames Create; + -- AKA + + -- ANCHOR(`free_form()',`Delete') + procedure Delete (Frm : in out Form); + -- AKA + -- Reset Frm to Null_Form + + -- MANPAGE(`form_opts.3x') + + -- ANCHOR(`set_form_opts()',`Set_Options') + procedure Set_Options (Frm : in Form; + Options : in Form_Option_Set); + -- AKA + + -- ANCHOR(`form_opts_on()',`Switch_Options') + procedure Switch_Options (Frm : in Form; + Options : in Form_Option_Set; + On : Boolean := True); + -- AKA + -- ALIAS(`form_opts_off()') + + -- ANCHOR(`form_opts()',`Get_Options') + procedure Get_Options (Frm : in Form; + Options : out Form_Option_Set); + -- AKA + + -- ANCHOR(`form_opts()',`Get_Options') + function Get_Options (Frm : Form := Null_Form) return Form_Option_Set; + -- AKA + + -- MANPAGE(`form_post.3x') + + -- ANCHOR(`post_form()',`Post') + procedure Post (Frm : in Form; + Post : in Boolean := True); + -- AKA + -- ALIAS(`unpost_form()') + + -- MANPAGE(`form_cursor.3x') + + -- ANCHOR(`pos_form_cursor()',`Position_Cursor') + procedure Position_Cursor (Frm : Form); + -- AKA + + -- MANPAGE(`form_data.3x') + + -- ANCHOR(`data_ahead()',`Data_Ahead') + function Data_Ahead (Frm : Form) return Boolean; + -- AKA + + -- ANCHOR(`data_behind()',`Data_Behind') + function Data_Behind (Frm : Form) return Boolean; + -- AKA + + -- MANPAGE(`form_driver.3x') + + type Driver_Result is (Form_Ok, + Request_Denied, + Unknown_Request, + Invalid_Field); + + -- ANCHOR(`form_driver()',`Driver') + function Driver (Frm : Form; + Key : Key_Code) return Driver_Result; + -- AKA + + -- MANPAGE(`form_page.3x') + + type Page_Number is new Natural; + + -- ANCHOR(`set_current_field()',`Set_Current') + procedure Set_Current (Frm : in Form; + Fld : in Field); + -- AKA + + -- ANCHOR(`current_field()',`Current') + function Current (Frm : in Form) return Field; + -- AKA + + -- ANCHOR(`set_form_page()',`Set_Page') + procedure Set_Page (Frm : in Form; + Page : in Page_Number := Page_Number'First); + -- AKA + + -- ANCHOR(`form_page()',`Page') + function Page (Frm : Form) return Page_Number; + -- AKA + + -- ANCHOR(`field_index()',`Get_Index') + function Get_Index (Fld : Field) return Positive; + -- AKA + -- Please note that in this binding we start the numbering of fields + -- with 1. So this is number is one more than you get from the low + -- level call. + + -- MANPAGE(`form_new_page.3x') + + -- ANCHOR(`set_new_page()',`Set_New_Page') + procedure Set_New_Page (Fld : in Field; + New_Page : in Boolean := True); + -- AKA + + -- ANCHOR(`new_page()',`Is_New_Page') + function Is_New_Page (Fld : Field) return Boolean; + -- AKA + + -- MANPAGE(`form_fieldtype.3x') + + type Field_Type is abstract tagged null record; + type Field_Type_Access is access all Field_Type'Class; + + function Native_Type (Ftype : Field_Type) + return C_Field_Type is abstract; + -- This function returns the C libraries handle to the field type. + -- May be you need this if you want to interface to lower level + -- routines in the form library. + + -- ANCHOR(`set_field_type()',`Set_Type') + procedure Set_Type (Fld : in Field; + Fld_Type : in Field_Type) is abstract; + -- AKA + -- But: we hide the vararg mechanism of the C interface. You always + -- have to pass a single Field_Type parameter. + + type C_Defined_Field_Type is abstract new Field_Type with null record; + -- This is the root of all field typed defined in C, i.e. this are + -- the predefined field types in the form library. + + type Alpha_Field is new C_Defined_Field_Type + with record + Minimum_Field_Width : Natural := 0; + end record; + procedure Set_Type (Fld : in Field; + Fld_Type : in Alpha_Field); + function Native_Type (Ftype : Alpha_Field) + return C_Field_Type; + + type Alpha_Numeric_Field is new C_Defined_Field_Type with + record + Minimum_Field_Width : Natural := 0; + end record; + procedure Set_Type (Fld : in Field; + Fld_Type : in Alpha_Numeric_Field); + function Native_Type (Ftype : Alpha_Numeric_Field) + return C_Field_Type; + + type Integer_Field is new C_Defined_Field_Type with + record + Precision : Natural; + Lower_Limit : Integer; + Upper_Limit : Integer; + end record; + procedure Set_Type (Fld : in Field; + Fld_Type : in Integer_Field); + function Native_Type (Ftype : Integer_Field) + return C_Field_Type; + + type Numeric_Field is new C_Defined_Field_Type with + record + Precision : Natural; + Lower_Limit : Float; + Upper_Limit : Float; + end record; + procedure Set_Type (Fld : in Field; + Fld_Type : in Numeric_Field); + function Native_Type (Ftype : Numeric_Field) + return C_Field_Type; + + type String_Access is access String; + + type Regular_Expression_Field is new C_Defined_Field_Type with + record + Regular_Expression : String_Access; + end record; + procedure Set_Type (Fld : in Field; + Fld_Type : in Regular_Expression_Field); + function Native_Type (Ftype : Regular_Expression_Field) + return C_Field_Type; + + type Enum_Array is array (Positive range <>) + of String_Access; + + type Enumeration_Info (C : Positive) is + record + Names : Enum_Array (1 .. C); + Case_Sensitive : Boolean := False; + Match_Must_Be_Unique : Boolean := False; + end record; + + type Enumeration_Field is new C_Defined_Field_Type with private; + + function Create (Info : Enumeration_Info; + Auto_Release_Names : Boolean := False) + return Enumeration_Field; + -- Make an fieldtype from the info. Enumerations are special, because + -- they normally don't copy the enum values into a private store, so + -- we have to care for the lifetime of the info we provide. + -- The Auto_Release_Names flag may be used to automatically releases + -- the strings in the Names array of the Enumeration_Info. + + function Make_Enumeration_Type (Info : Enumeration_Info; + Auto_Release_Names : Boolean := False) + return Enumeration_Field renames Create; + + procedure Release (Enum : in out Enumeration_Field); + -- But we may want to release the field to release the memory allocated + -- by it internally. After that the Enumeration field is no longer usable. + + procedure Set_Type (Fld : in Field; + Fld_Type : in Enumeration_Field); + function Native_Type (Ftype : Enumeration_Field) + return C_Field_Type; + + -- The next type defintions are all ncurses extensions. They are typically + -- not available in other curses implementations. + + type Internet_V4_Address_Field is new C_Defined_Field_Type + with null record; + procedure Set_Type (Fld : in Field; + Fld_Type : in Internet_V4_Address_Field); + function Native_Type (Ftype : Internet_V4_Address_Field) + return C_Field_Type; + + + type Ada_Defined_Field_Type is abstract new Field_Type with null record; + -- This is the root of the mechanism we use to create field types in + -- Ada95. You don't have to redefine the Set_Field_Type and + -- Native_Field_Type methods, because they work generically on this + -- class. + + procedure Set_Type (Fld : Field; + Fld_Type : Ada_Defined_Field_Type); + + function Native_Type (Ftype : Ada_Defined_Field_Type) + return C_Field_Type; + + -- MANPAGE(`form_field_validation.3x') + + -- ANCHOR(`field_type()',`Get_Type') + function Get_Type (Fld : in Field) return Field_Type_Access; + -- AKA + -- ALIAS(`field_arg()') + -- In Ada95 we can combine these + +------------------------------------------------------------------------------ +private + + type Field is new System.Address; + type Form is new System.Address; + type C_Field_Type is new System.Address; + + Null_Field : constant Field := Field (System.Null_Address); + Null_Form : constant Form := Form (System.Null_Address); + Null_Field_Type : constant C_Field_Type := + C_Field_Type (System.Null_Address); + + type CPA_Access is access Interfaces.C.Strings.chars_ptr_array; + + type Enumeration_Field is new C_Defined_Field_Type with + record + Case_Sensitive : Boolean := False; + Match_Must_Be_Unique : Boolean := False; + Arr : CPA_Access := null; + end record; + + -- In our binding we use the fields user pointer as hook to maintain + -- our own info structure about the field type. To be able to still + -- provide a user pointer, we use this wrapper. + -- + type Field_User_Wrapper is + record + U : System.Address; -- the hook we provide for the user + T : Field_Type_Access; -- may be null + N : Natural; -- use counter + end record; + pragma Convention (C, Field_User_Wrapper); + type Field_User_Wrapper_Access is access all Field_User_Wrapper; + pragma Controlled (Field_User_Wrapper_Access); + + function Set_Field_Userptr (Fld : Field; + Wrp : Field_User_Wrapper_Access) + return Interfaces.C.int; + pragma Import (C, Set_Field_Userptr, "set_field_userptr"); + + function Field_Userptr (Fld : Field) return Field_User_Wrapper_Access; + pragma Import (C, Field_Userptr, "field_userptr"); + + -- In our binding we use the forms user pointer as hook to maintain + -- our own info structure about the field association. To be able to still + -- provide a user pointer, we use this wrapper. + -- + type Form_User_Wrapper is + record + U : System.Address; -- the hook we provide for the user + I : Field_Array_Access; + end record; + pragma Convention (C, Form_User_Wrapper); + type Form_User_Wrapper_Access is access all Form_User_Wrapper; + pragma Controlled (Form_User_Wrapper_Access); + + function Set_Form_Userptr (Frm : Form; + Wrp : Form_User_Wrapper_Access) + return Interfaces.C.int; + pragma Import (C, Set_Form_Userptr, "set_form_userptr"); + + function Form_Userptr (Frm : Form) return Form_User_Wrapper_Access; + pragma Import (C, Form_Userptr, "form_userptr"); + + procedure Register_Type (T : in Ada_Defined_Field_Type'Class; + Cft : in C_Field_Type); + procedure Unregister_Type (T : in Ada_Defined_Field_Type'Class); + function Search_Type (T : Ada_Defined_Field_Type'Class) + return C_Field_Type; + + Generation_Bit_Order : constant System.Bit_Order := System.M4_BIT_ORDER; + -- This constant may be different on your system. + +end Terminal_Interface.Curses.Forms; diff --git a/Ada95/gen/terminal_interface-curses-menus-item_user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-menus-item_user_data.ads.m4 new file mode 100644 index 00000000..c32e764a --- /dev/null +++ b/Ada95/gen/terminal_interface-curses-menus-item_user_data.ads.m4 @@ -0,0 +1,54 @@ +-- -*- ada -*- +define(`HTMLNAME',`terminal_interface-curses-menus-item_user_data_s.html')dnl +include(M4MACRO)dnl +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Menus.Item_User_Data -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ + +generic + type User is limited private; + type User_Access is access User; +package Terminal_Interface.Curses.Menus.Item_User_Data is + + -- The binding uses the same user pointer for menu items + -- as the low level C implementation. So you can safely + -- read or write the user pointer also with the C routines + -- + -- MANPAGE(`mitem_userptr.3x') + + -- ANCHOR(`set_item_userptr',`Set_User_Data') + procedure Set_User_Data (Itm : in Item; + Data : in User_Access); + -- AKA + pragma Convention (C, Set_User_Data); + + -- ANCHOR(`item_userptr',`Get_User_Data') + procedure Get_User_Data (Itm : in Item; + Data : out User_Access); + -- AKA + pragma Convention (C, Get_User_Data); + +end Terminal_Interface.Curses.Menus.Item_User_Data; diff --git a/Ada95/gen/terminal_interface-curses-menus-menu_user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-menus-menu_user_data.ads.m4 new file mode 100644 index 00000000..79a702b0 --- /dev/null +++ b/Ada95/gen/terminal_interface-curses-menus-menu_user_data.ads.m4 @@ -0,0 +1,59 @@ +-- -*- ada -*- +define(`HTMLNAME',`terminal_interface-curses-menus-menu_user_data_s.html')dnl +include(M4MACRO)dnl +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Menus.Menu_User_Data -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ + +generic + type User is limited private; + type User_Access is access User; +package Terminal_Interface.Curses.Menus.Menu_User_Data is + + -- The binding uses the C level user pointer already for its own + -- internal purposes. So you can´t easily manipulate the user pointer + -- with the low level C routines for this menu without taking care of + -- this special situation. If you want to read or write with C routines + -- the user pointer of this menu, you should get first the low level + -- user pointer. This points to a record, that always has as its first + -- member the Ada95 user pointer for this menu. You should never change + -- the low level user pointer of an Ada created menu. + -- + -- MANPAGE(`menu_userptr.3x') + + -- ANCHOR(`set_menu_userptr',`Set_User_Data') + procedure Set_User_Data (Men : in Menu; + Data : in User_Access); + -- AKA + pragma Convention (C, Set_User_Data); + + -- ANCHOR(`menu_userptr',`Get_User_Data') + procedure Get_User_Data (Men : in Menu; + Data : out User_Access); + -- AKA + pragma Convention (C, Get_User_Data); + +end Terminal_Interface.Curses.Menus.Menu_User_Data; diff --git a/Ada95/gen/terminal_interface-curses-menus.ads.m4 b/Ada95/gen/terminal_interface-curses-menus.ads.m4 new file mode 100644 index 00000000..2c1c42f1 --- /dev/null +++ b/Ada95/gen/terminal_interface-curses-menus.ads.m4 @@ -0,0 +1,519 @@ +-- -*- ada -*- +define(`HTMLNAME',`terminal_interface-curses-menus_s.html')dnl +include(M4MACRO)dnl +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Menu -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.7 $ +------------------------------------------------------------------------------ +include(`Menu_Base_Defs') +with System; +with Interfaces.C; +with Ada.Characters.Latin_1; + +package Terminal_Interface.Curses.Menus is + +include(`Menu_Linker_Options') + + + Space : Character renames Ada.Characters.Latin_1.Space; + + type Item is private; + type Menu is private; + + --------------------------- + -- Interface constants -- + --------------------------- + Null_Item : constant Item; + Null_Menu : constant Menu; + + subtype Menu_Request_Code is Key_Code + range (Key_Max + 1) .. (Key_Max + 17); + + -- The prefix M_ stands for "Menu Request" + M_Left_Item : constant Menu_Request_Code := Key_Max + 1; + M_Right_Item : constant Menu_Request_Code := Key_Max + 2; + M_Up_Item : constant Menu_Request_Code := Key_Max + 3; + M_Down_Item : constant Menu_Request_Code := Key_Max + 4; + M_ScrollUp_Line : constant Menu_Request_Code := Key_Max + 5; + M_ScrollDown_Line : constant Menu_Request_Code := Key_Max + 6; + M_ScrollDown_Page : constant Menu_Request_Code := Key_Max + 7; + M_ScrollUp_Page : constant Menu_Request_Code := Key_Max + 8; + M_First_Item : constant Menu_Request_Code := Key_Max + 9; + M_Last_Item : constant Menu_Request_Code := Key_Max + 10; + M_Next_Item : constant Menu_Request_Code := Key_Max + 11; + M_Previous_Item : constant Menu_Request_Code := Key_Max + 12; + M_Toggle_Item : constant Menu_Request_Code := Key_Max + 13; + M_Clear_Pattern : constant Menu_Request_Code := Key_Max + 14; + M_Back_Pattern : constant Menu_Request_Code := Key_Max + 15; + M_Next_Match : constant Menu_Request_Code := Key_Max + 16; + M_Previous_Match : constant Menu_Request_Code := Key_Max + 17; + + -- For those who like the old 'C' names for the request codes + REQ_LEFT_ITEM : Menu_Request_Code renames M_Left_Item; + REQ_RIGHT_ITEM : Menu_Request_Code renames M_Right_Item; + REQ_UP_ITEM : Menu_Request_Code renames M_Up_Item; + REQ_DOWN_ITEM : Menu_Request_Code renames M_Down_Item; + REQ_SCR_ULINE : Menu_Request_Code renames M_ScrollUp_Line; + REQ_SCR_DLINE : Menu_Request_Code renames M_ScrollDown_Line; + REQ_SCR_DPAGE : Menu_Request_Code renames M_ScrollDown_Page; + REQ_SCR_UPAGE : Menu_Request_Code renames M_ScrollUp_Page; + REQ_FIRST_ITEM : Menu_Request_Code renames M_First_Item; + REQ_LAST_ITEM : Menu_Request_Code renames M_Last_Item; + REQ_NEXT_ITEM : Menu_Request_Code renames M_Next_Item; + REQ_PREV_ITEM : Menu_Request_Code renames M_Previous_Item; + REQ_TOGGLE_ITEM : Menu_Request_Code renames M_Toggle_Item; + REQ_CLEAR_PATTERN : Menu_Request_Code renames M_Clear_Pattern; + REQ_BACK_PATTERN : Menu_Request_Code renames M_Back_Pattern; + REQ_NEXT_MATCH : Menu_Request_Code renames M_Next_Match; + REQ_PREV_MATCH : Menu_Request_Code renames M_Previous_Match; + + procedure Request_Name (Key : in Menu_Request_Code; + Name : out String); + + ------------------ + -- Exceptions -- + ------------------ + + Menu_Exception : exception; + -- + -- Menu options + -- + +include(`Menu_Opt_Rep') + + Default_Menu_Options : Menu_Option_Set; + -- Initial default options for a menu. + + -- + -- Item options + -- +include(`Item_Rep') + + Default_Item_Options : Item_Option_Set; + -- Initial default options for an item. + + -- + -- Item Array + -- + type Item_Array is array (Positive range <>) of aliased Item; + pragma Convention (C, Item_Array); + + type Item_Array_Access is access all Item_Array; + + -- MANPAGE(`mitem_new.3x') + + -- ANCHOR(`new_item()',`Create') + function Create (Name : String; + Description : String := "") return Item; + -- AKA + + -- ANCHOR(`new_item()',`New_Item') + function New_Item (Name : String; + Description : String := "") return Item + renames Create; + -- AKA + + -- ANCHOR(`free_item()',`Delete') + procedure Delete (Itm : in out Item); + -- AKA + -- Resets Itm to Null_Item + + -- MANPAGE(`mitem_value.3x') + + -- ANCHOR(`set_item_value()',`Set_Value') + procedure Set_Value (Itm : in Item; + Value : in Boolean := True); + -- AKA + + -- ANCHOR(`item_value()',`Value') + function Value (Itm : Item) return Boolean; + -- AKA + + -- MANPAGE(`mitem_visible.3x') + + -- ANCHOR(`item_visible()',`Visible') + function Visible (Itm : Item) return Boolean; + -- AKA + + -- MANPAGE(`mitem_opts.3x') + + -- ANCHOR(`set_item_opts()',`Set_Options') + procedure Set_Options (Itm : in Item; + Options : in Item_Option_Set); + -- AKA + + -- ANCHOR(`item_opts_on()',`Switch_Options') + procedure Switch_Options (Itm : in Item; + Options : in Item_Option_Set; + On : Boolean := True); + -- AKA + -- ALIAS(`item_opts_off()') + + -- ANCHOR(`item_opts()',`Get_Options') + procedure Get_Options (Itm : in Item; + Options : out Item_Option_Set); + -- AKA + + -- ANCHOR(`item_opts()',`Get_Options') + function Get_Options (Itm : Item := Null_Item) return Item_Option_Set; + -- AKA + + -- MANPAGE(`mitem_name.3x') + + -- ANCHOR(`item_name()',`Name') + procedure Name (Itm : in Item; + Name : out String); + -- AKA + + -- ANCHOR(`item_description();',`Description') + procedure Description (Itm : in Item; + Description : out String); + -- AKA + + -- MANPAGE(`mitem_current.3x') + + -- ANCHOR(`set_current_item()',`Set_Current') + procedure Set_Current (Men : in Menu; + Itm : in Item); + -- AKA + + -- ANCHOR(`current_item()',`Current') + function Current (Men : Menu) return Item; + -- AKA + + -- ANCHOR(`set_top_row()',`Set_Top_Row') + procedure Set_Top_Row (Men : in Menu; + Line : in Line_Position); + -- AKA + + -- ANCHOR(`top_row()',`Top_Row') + function Top_Row (Men : Menu) return Line_Position; + -- AKA + + -- ANCHOR(`item_index()',`Get_Index') + function Get_Index (Itm : Item) return Positive; + -- AKA + -- Please note that in this binding we start the numbering of items + -- with 1. So this is number is one more than you get from the low + -- level call. + + -- MANPAGE(`menu_post.3x') + + -- ANCHOR(`post_menu()',`Post') + procedure Post (Men : in Menu; + Post : in Boolean := True); + -- AKA + -- ALIAS(`unpost_menu()') + + -- MANPAGE(`menu_opts.3x') + + -- ANCHOR(`set_menu_opts()',`Set_Options') + procedure Set_Options (Men : in Menu; + Options : in Menu_Option_Set); + -- AKA + + -- ANCHOR(`menu_opts_on()',`Switch_Options') + procedure Switch_Options (Men : in Menu; + Options : in Menu_Option_Set; + On : Boolean := True); + -- AKA + -- ALIAS(`menu_opts_off()') + + -- ANCHOR(`menu_opts()',`Get_Options') + procedure Get_Options (Men : in Menu; + Options : out Menu_Option_Set); + -- AKA + + -- ANCHOR(`menu_opts()',`Get_Options') + function Get_Options (Men : Menu := Null_Menu) return Menu_Option_Set; + -- AKA + + -- MANPAGE(`menu_win.3x') + + -- ANCHOR(`set_menu_win()',`Set_Window') + procedure Set_Window (Men : in Menu; + Win : in Window); + -- AKA + + -- ANCHOR(`menu_win()',`Get_Window') + function Get_Window (Men : Menu) return Window; + -- AKA + + -- ANCHOR(`set_menu_sub()',`Set_Sub_Window') + procedure Set_Sub_Window (Men : in Menu; + Win : in Window); + -- AKA + + -- ANCHOR(`menu_sub()',`Get_Sub_Window') + function Get_Sub_Window (Men : Menu) return Window; + -- AKA + + -- ANCHOR(`scale_menu()',`Scale') + procedure Scale (Men : in Menu; + Lines : out Line_Count; + Columns : out Column_Count); + -- AKA + + -- MANPAGE(`menu_cursor.3x') + + -- ANCHOR(`pos_menu_cursor()',`Position_Cursor') + procedure Position_Cursor (Men : Menu); + -- AKA + + -- MANPAGE(`menu_mark.3x') + + -- ANCHOR(`set_menu_mark()',`Set_Mark') + procedure Set_Mark (Men : in Menu; + Mark : in String); + -- AKA + + -- ANCHOR(`menu_mark()',`Mark') + procedure Mark (Men : in Menu; + Mark : out String); + -- AKA + + -- MANPAGE(`menu_attribs.3x') + + -- ANCHOR(`set_menu_fore()',`Set_Foreground') + procedure Set_Foreground + (Men : in Menu; + Fore : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First); + -- AKA + + -- ANCHOR(`menu_fore()',`Foreground') + procedure Foreground (Men : in Menu; + Fore : out Character_Attribute_Set); + -- AKA + + -- ANCHOR(`menu_fore()',`Foreground') + procedure Foreground (Men : in Menu; + Fore : out Character_Attribute_Set; + Color : out Color_Pair); + -- AKA + + -- ANCHOR(`set_menu_back()',`Set_Background') + procedure Set_Background + (Men : in Menu; + Back : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First); + -- AKA + + -- ANCHOR(`menu_back()',`Background') + procedure Background (Men : in Menu; + Back : out Character_Attribute_Set); + -- AKA + -- ANCHOR(`menu_back()',`Background') + + procedure Background (Men : in Menu; + Back : out Character_Attribute_Set; + Color : out Color_Pair); + -- AKA + + -- ANCHOR(`set_menu_grey()',`Set_Grey') + procedure Set_Grey + (Men : in Menu; + Grey : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First); + -- AKA + + -- ANCHOR(`menu_grey()',`Grey') + procedure Grey (Men : in Menu; + Grey : out Character_Attribute_Set); + -- AKA + + -- ANCHOR(`menu_grey()',`Grey') + procedure Grey + (Men : in Menu; + Grey : out Character_Attribute_Set; + Color : out Color_Pair); + -- AKA + + -- ANCHOR(`set_menu_pad()',`Set_Pad_Character') + procedure Set_Pad_Character (Men : in Menu; + Pad : in Character := Space); + -- AKA + + -- ANCHOR(`menu_pad()',`Pad_Character') + procedure Pad_Character (Men : in Menu; + Pad : out Character); + -- AKA + + -- MANPAGE(`menu_spacing.3x') + + -- ANCHOR(`set_menu_spacing()',`Set_Spacing') + procedure Set_Spacing (Men : in Menu; + Descr : in Column_Position := 0; + Row : in Line_Position := 0; + Col : in Column_Position := 0); + -- AKA + + -- ANCHOR(`menu_spacing()',`Spacing') + procedure Spacing (Men : in Menu; + Descr : out Column_Position; + Row : out Line_Position; + Col : out Column_Position); + -- AKA + + -- MANPAGE(`menu_pattern.3x') + + -- ANCHOR(`set_menu_pattern()',`Set_Pattern') + function Set_Pattern (Men : Menu; + Text : String) return Boolean; + -- AKA + -- Return TRUE if the pattern matches, FALSE otherwise + + -- ANCHOR(`menu_pattern()',`Pattern') + procedure Pattern (Men : in Menu; + Text : out String); + -- AKA + + -- MANPAGE(`menu_format.3x') + + -- ANCHOR(`set_menu_format()',`Set_Format') + procedure Set_Format (Men : in Menu; + Lines : in Line_Count; + Columns : in Column_Count); + -- AKA + + -- ANCHOR(`menu_format()',`Format') + procedure Format (Men : in Menu; + Lines : out Line_Count; + Columns : out Column_Count); + -- AKA + + -- MANPAGE(`menu_hook.3x') + + type Menu_Hook_Function is access procedure (Men : in Menu); + pragma Convention (C, Menu_Hook_Function); + + -- ANCHOR(`set_item_init()',`Set_Item_Init_Hook') + procedure Set_Item_Init_Hook (Men : in Menu; + Proc : in Menu_Hook_Function); + -- AKA + + -- ANCHOR(`set_item_term()',`Set_Item_Term_Hook') + procedure Set_Item_Term_Hook (Men : in Menu; + Proc : in Menu_Hook_Function); + -- AKA + + -- ANCHOR(`set_menu_init()',`Set_Menu_Init_Hook') + procedure Set_Menu_Init_Hook (Men : in Menu; + Proc : in Menu_Hook_Function); + -- AKA + + -- ANCHOR(`set_menu_term()',`Set_Menu_Term_Hook') + procedure Set_Menu_Term_Hook (Men : in Menu; + Proc : in Menu_Hook_Function); + -- AKA + + -- ANCHOR(`item_init()',`Get_Item_Init_Hook') + function Get_Item_Init_Hook (Men : Menu) return Menu_Hook_Function; + -- AKA + + -- ANCHOR(`item_term()',`Get_Item_Term_Hook') + function Get_Item_Term_Hook (Men : Menu) return Menu_Hook_Function; + -- AKA + + -- ANCHOR(`menu_init()',`Get_Menu_Init_Hook') + function Get_Menu_Init_Hook (Men : Menu) return Menu_Hook_Function; + -- AKA + + -- ANCHOR(`menu_term()',`Get_Menu_Term_Hook') + function Get_Menu_Term_Hook (Men : Menu) return Menu_Hook_Function; + -- AKA + + -- MANPAGE(`menu_items.3x') + + -- ANCHOR(`set_menu_items()',`Redefine') + procedure Redefine (Men : in Menu; + Items : in Item_Array); + -- AKA + -- With a bit more comfort. You don´t need to terminate the Item_Array + -- with a null entry. This is handled internally in the binding. + + procedure Set_Items (Men : in Menu; + Items : in Item_Array) renames Redefine; + + -- ANCHOR(`menu_items()',`Items') + function Items (Men : Menu) return Item_Array_Access; + -- AKA + + -- ANCHOR(`item_count()',`Item_Count') + function Item_Count (Men : Menu) return Natural; + -- AKA + + -- MANPAGE(`menu_new.3x') + + -- ANCHOR(`new_menu()',`Create') + function Create (Items : Item_Array) return Menu; + -- AKA + + function New_Menu (Items : Item_Array) return Menu renames Create; + + -- ANCHOR(`free_menu()',`Delete') + procedure Delete (Men : in out Menu); + -- AKA + -- Reset Men to Null_Menu + + -- MANPAGE(`menu_new.3x') + + type Driver_Result is (Menu_Ok, + Request_Denied, + Unknown_Request, + No_Match); + + -- ANCHOR(`menu_driver()',`Driver') + function Driver (Men : Menu; + Key : Key_Code) return Driver_Result; + -- AKA + +------------------------------------------------------------------------------- +private + type Item is new System.Address; + type Menu is new System.Address; + + Null_Item : constant Item := Item (System.Null_Address); + Null_Menu : constant Menu := Menu (System.Null_Address); + + -- This binding uses the original user pointer mechanism of a menu to store + -- specific informations about a menu. This wrapper record carries this + -- specifics and contains a field to maintain a new user pointer. Please + -- note that you must take this into account if you wan't to use the user + -- pointer mechanism of a menu created with this binding in low-level C + -- routines. + type Ada_User_Wrapper is + record + U : System.Address; + I : Item_Array_Access; + end record; + pragma Convention (C, Ada_User_Wrapper); + type Ada_User_Wrapper_Access is access all Ada_User_Wrapper; + pragma Controlled (Ada_User_Wrapper_Access); + + Generation_Bit_Order : constant System.Bit_Order := System.M4_BIT_ORDER; + -- This constant may be different on your system. + +end Terminal_Interface.Curses.Menus; diff --git a/Ada95/gen/terminal_interface-curses-mouse.ads.m4 b/Ada95/gen/terminal_interface-curses-mouse.ads.m4 new file mode 100644 index 00000000..f4a5928f --- /dev/null +++ b/Ada95/gen/terminal_interface-curses-mouse.ads.m4 @@ -0,0 +1,125 @@ +-- -*- ada -*- +define(`HTMLNAME',`terminal_interface-curses-mouse_s.html')dnl +include(M4MACRO)dnl +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Mouse -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.6 $ +------------------------------------------------------------------------------ +include(`Mouse_Base_Defs') +with System; + +package Terminal_Interface.Curses.Mouse is + + -- MANPAGE(`curs_mouse.3x') + -- Please note, that in ncurses-1.9.9e documentation mouse support + -- is still marked as experimental. So also this binding will change + -- if the ncurses methods change. + -- + type Event_Mask is private; + No_Events : constant Event_Mask; + All_Events : constant Event_Mask; + + type Mouse_Button is (Left, -- aka: Button 1 + Middle, -- aka: Button 2 + Right, -- aka: Button 3 + Button4, -- aka: Button 4 + Control, -- Control Key + Shift, -- Shift Key + Alt); -- ALT Key + + type Button_State is (Released, + Pressed, + Clicked, + Double_Clicked, + Triple_Clicked); + + type Mouse_Event is private; + + -- MANPAGE(`curs_mouse.3x') + + procedure Register_Reportable_Event + (B : in Mouse_Button; + S : in Button_State; + Mask : in out Event_Mask); + -- Stores the event described by the button and the state in the mask. + -- Before you call this the first time, you should init the mask + -- with the Empty_Mask constant + + -- ANCHOR(`mousemask()',`Start_Mouse') + function Start_Mouse (Mask : Event_Mask := All_Events) + return Event_Mask; + -- AKA + + procedure End_Mouse; + pragma Import (C, End_Mouse, "_nc_ada_unregister_mouse"); + -- Terminates the mouse + + -- ANCHOR(`getmouse()',`Get_Mouse') + function Get_Mouse return Mouse_Event; + -- AKA + + procedure Get_Event (Event : in Mouse_Event; + Y : out Line_Position; + X : out Column_Position; + Button : out Mouse_Button; + State : out Button_State); + -- !!! Warning: X and Y are screen coordinates. Due to ripped of lines they + -- may not be identical to window coordinates. + + -- ANCHOR(`ungetmouse()',`Unget_Mouse') + procedure Unget_Mouse (Event : in Mouse_Event); + -- AKA + + -- ANCHOR(`wenclose()',`Enclosed_In_Window') + function Enclosed_In_Window (Win : Window := Standard_Window; + Event : Mouse_Event) return Boolean; + -- AKA + -- But : use event instead of screen coordinates. + + -- ANCHOR(`mouseinterval()',`Mouse_Interval') + function Mouse_Interval (Msec : Natural := 200) return Natural; + -- AKA + +private + type Event_Mask is new Interfaces.C.int; + No_Events : constant Event_Mask := 0; + All_Events : constant Event_Mask := -1; + + type Mouse_Event is + record + Id : Integer range Integer (Interfaces.C.short'First) .. + Integer (Interfaces.C.Short'Last); + X, Y, Z : Integer range Integer (Interfaces.C.int'First) .. + Integer (Interfaces.C.int'Last); + Bstate : Event_Mask; + end record; + pragma Convention (C, Mouse_Event); + pragma Pack (Mouse_Event); + +include(`Mouse_Event_Rep') + Generation_Bit_Order : constant System.Bit_Order := System.M4_BIT_ORDER; + -- This constant may be different on your system. + +end Terminal_Interface.Curses.Mouse; diff --git a/Ada95/gen/terminal_interface-curses-panels-user_data.ads.m4 b/Ada95/gen/terminal_interface-curses-panels-user_data.ads.m4 new file mode 100644 index 00000000..6d68cc23 --- /dev/null +++ b/Ada95/gen/terminal_interface-curses-panels-user_data.ads.m4 @@ -0,0 +1,50 @@ +-- -*- ada -*- +define(`HTMLNAME',`terminal_interface-curses-panels-user_data_s.html')dnl +include(M4MACRO)dnl +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Panels.User_Data -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ + +generic + type User is limited private; + type User_Access is access all User; +package Terminal_Interface.Curses.Panels.User_Data is + + -- MANPAGE(`panel.3x') + + -- ANCHOR(`set_panel_userptr',`Set_User_Data') + procedure Set_User_Data (Pan : in Panel; + Data : in User_Access); + -- AKA + pragma Convention (C, Set_User_Data); + + -- ANCHOR(`panel_userptr',`Get_User_Data') + procedure Get_User_Data (Pan : in Panel; + Data : out User_Access); + -- AKA + pragma Convention (C, Get_User_Data); + +end Terminal_Interface.Curses.Panels.User_Data; diff --git a/Ada95/gen/terminal_interface-curses-panels.ads.m4 b/Ada95/gen/terminal_interface-curses-panels.ads.m4 new file mode 100644 index 00000000..c2503b1a --- /dev/null +++ b/Ada95/gen/terminal_interface-curses-panels.ads.m4 @@ -0,0 +1,120 @@ +-- -*- ada -*- +define(`HTMLNAME',`terminal_interface-curses-panels_s.html')dnl +include(M4MACRO)dnl +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses.Panels -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with System; + +package Terminal_Interface.Curses.Panels is + +include(`Panel_Linker_Options') + + type Panel is private; + + --------------------------- + -- Interface constants -- + --------------------------- + Null_Panel : constant Panel; + + ------------------- + -- Exceptions -- + ------------------- + + Panel_Exception : exception; + + -- MANPAGE(`panel.3x') + + -- ANCHOR(`new_panel()',`Create') + function Create (Win : Window) return Panel; + -- AKA + + -- ANCHOR(`new_panel()',`New_Panel') + function New_Panel (Win : Window) return Panel renames Create; + -- AKA + + -- ANCHOR(`bottom_panel()',`Bottom') + procedure Bottom (Pan : in Panel); + -- AKA + + -- ANCHOR(`top_panel()',`Top') + procedure Top (Pan : in Panel); + -- AKA + + -- ANCHOR(`show_panel()',`Show') + procedure Show (Pan : in Panel); + -- AKA + + -- ANCHOR(`update_panels()',`Update_Panels') + procedure Update_Panels; + -- AKA + pragma Import (C, Update_Panels, "update_panels"); + + -- ANCHOR(`hide_panel()',`Hide') + procedure Hide (Pan : in Panel); + -- AKA + + -- ANCHOR(`panel_window()',`Get_Window') + function Get_Window (Pan : Panel) return Window; + -- AKA + + -- ANCHOR(`panel_window()',`Panel_Window') + function Panel_Window (Pan : Panel) return Window renames Get_Window; + + -- ANCHOR(`replace_panel()',`Replace') + procedure Replace (Pan : in Panel; + Win : in Window); + -- AKA + + -- ANCHOR(`move_panel()',`Move') + procedure Move (Pan : in Panel; + Line : in Line_Position; + Column : in Column_Position); + -- AKA + + -- ANCHOR(`panel_hidden()',`Is_Hidden') + function Is_Hidden (Pan : Panel) return Boolean; + -- AKA + + -- ANCHOR(`panel_above()',`Above') + function Above (Pan : Panel) return Panel; + -- AKA + pragma Import (C, Above, "panel_above"); + + -- ANCHOR(`panel_below()',`Below') + function Below (Pan : Panel) return Panel; + -- AKA + pragma Import (C, Below, "panel_below"); + + -- ANCHOR(`del_panel()',`Delete') + procedure Delete (Pan : in out Panel); + -- AKA + + private + type Panel is new System.Address; + Null_Panel : constant Panel := Panel (System.Null_Address); + +end Terminal_Interface.Curses.Panels; diff --git a/Ada95/gen/terminal_interface-curses.ads.m4 b/Ada95/gen/terminal_interface-curses.ads.m4 new file mode 100644 index 00000000..e4f7ce9d --- /dev/null +++ b/Ada95/gen/terminal_interface-curses.ads.m4 @@ -0,0 +1,1187 @@ +-- -*- ada -*- +define(`HTMLNAME',`terminal_interface-curses_s.html')dnl +include(M4MACRO)------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding -- +-- -- +-- Terminal_Interface.Curses -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control: +-- $Revision: 1.7 $ +------------------------------------------------------------------------------ +include(`Base_Defs') +with System; +with Interfaces.C; -- We need this for some assertions. + +package Terminal_Interface.Curses is + +include(`Linker_Options') + type Window is private; + Null_Window : constant Window; + + type Line_Position is new Natural; -- line coordinate + type Column_Position is new Natural; -- column coordinate + + subtype Line_Count is Line_Position range 1 .. Line_Position'Last; + -- Type to count lines. We do not allow null windows, so must be positive + subtype Column_Count is Column_Position range 1 .. Column_Position'Last; + -- Type to count columns. We do not allow null windows, so must be positive + + type Key_Code is new Natural; + -- That is anything including real characters, special keys and logical + -- request codes. + + subtype Real_Key_Code is Key_Code range 0 .. M4_KEY_MAX; + -- This are the codes that potentially represent a real keystroke. + -- Not all codes may be possible on a specific terminal. To check the + -- availability of a special key, the Has_Key function is provided. + + subtype Special_Key_Code is Real_Key_Code + range M4_SPECIAL_FIRST .. Real_Key_Code'Last; + -- Type for a function- or special key number + + subtype Normal_Key_Code is Real_Key_Code range + Character'Pos (Character'First) .. Character'Pos (Character'Last); + -- This are the codes for regular (incl. non-graphical) characters. + + -- Constants for function- and special keys + -- + Key_None : constant Special_Key_Code := M4_SPECIAL_FIRST; +include(`Key_Definitions') + Key_Max : constant Special_Key_Code + := Special_Key_Code'Last; + + subtype User_Key_Code is Key_Code + range (Key_Max + 129) .. Key_Code'Last; + -- This is reserved for user defined key codes. The range between Key_Max + -- and the first user code is reserved for subsystems like menu and forms. + + -- For those who like to use the original key names we produce them were + -- they differ from the original. Please note that they may differ in + -- lower/upper case. +include(`Old_Keys') + +------------------------------------------------------------------------------ + + type Color_Number is range 0 .. Integer (Interfaces.C.short'Last); + for Color_Number'Size use Interfaces.C.short'Size; + -- (n)curses uses a short for the color index + -- The model is, that a Color_Number is an index into an array of + -- (potentially) definable colors. Some of those indices are + -- predefined (see below), although they may not really exist. + +include(`Color_Defs') + type RGB_Value is range 0 .. Integer (Interfaces.C.Short'Last); + for RGB_Value'Size use Interfaces.C.short'Size; + -- Some system may allow to redefine a color by setting RGB values. + + type Color_Pair is range 0 .. 255; + for Color_Pair'Size use 8; + subtype Redefinable_Color_Pair is Color_Pair range 1 .. 255; + -- (n)curses reserves 1 Byte for the color-pair number. Color Pair 0 + -- is fixed (Black & White). A color pair is simply a combination of + -- two colors described by Color_Numbers, one for the foreground and + -- the other for the background + +include(`Character_Attribute_Set_Rep') + -- (n)curses uses half of an integer for attributes. + + Normal_Video : constant Character_Attribute_Set := (others => False); + + type Attributed_Character is + record + Attr : Character_Attribute_Set := Normal_Video; + Color : Color_Pair := 0; + Ch : Character := ' '; + end record; + pragma Convention (C, Attributed_Character); + -- This is the counterpart for the chtype in C. + +include(`AC_Rep') + Default_Character : constant Attributed_Character + := (Ch => Character'First, + Color => Color_Pair'First, + Attr => Normal_Video); + + type Attributed_String is array (Positive range <>) of Attributed_Character; + pragma Pack (Attributed_String); + -- In this binding we allow strings of attributed characters. + + ------------------ + -- Exceptions -- + ------------------ + Curses_Exception : exception; + + -- Those exceptions are raised by the ETI (Extended Terminal Interface) + -- subpackets for Menu and Forms handling. + -- + Eti_System_Error : exception; + Eti_Bad_Argument : exception; + Eti_Posted : exception; + Eti_Connected : exception; + Eti_Bad_State : exception; + Eti_No_Room : exception; + Eti_Not_Posted : exception; + Eti_Unknown_Command : exception; + Eti_No_Match : exception; + Eti_Not_Selectable : exception; + Eti_Not_Connected : exception; + Eti_Request_Denied : exception; + Eti_Invalid_Field : exception; + Eti_Current : exception; + + -------------------------------------------------------------------------- + -- External C variables + -- Conceptually even in C this are kind of constants, but they are + -- initialized and sometimes changed by the library routines at runtime + -- depending on the type of terminal. I believe the best way to model + -- this is to use functions. + -------------------------------------------------------------------------- + + function Lines return Line_Count; + pragma Inline (Lines); + + function Columns return Column_Count; + pragma Inline (Columns); + + function Tab_Size return Natural; + pragma Inline (Tab_Size); + + function Number_Of_Colors return Natural; + pragma Inline (Number_Of_Colors); + + function Number_Of_Color_Pairs return Natural; + pragma Inline (Number_Of_Color_Pairs); + + ACS_Map : array (Character'Val (0) .. Character'Val (127)) of + Attributed_Character; + pragma Import (C, ACS_Map, "acs_map"); + -- + -- + -- Constants for several symbols from the Alternate Character Set + -- You must use this constants as indices into the ACS_Map array + -- to get the corresponding attributed character at runtime. + -- +include(`ACS_Map') + + -- MANPAGE(`curs_initscr.3x') + -- | Not implemented: newterm, set_term, delscreen + + -- ANCHOR(`stdscr',`Standard_Window') + function Standard_Window return Window; + -- AKA + pragma Inline (Standard_Window); + + -- ANCHOR(`initscr()',`Init_Screen') + procedure Init_Screen; + + -- ANCHOR(`initscr()',`Init_Windows') + procedure Init_Windows renames Init_Screen; + -- AKA + + -- ANCHOR(`endwin()',`End_Windows') + procedure End_Windows; + -- AKA + procedure End_Screen renames End_Windows; + + -- ANCHOR(`isendwin()',`Is_End_Window') + function Is_End_Window return Boolean; + -- AKA + + -- MANPAGE(`curs_move.3x') + + -- ANCHOR(`wmove()',`Move_Cursor') + procedure Move_Cursor (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position); + -- AKA + + -- MANPAGE(`curs_addch.3x') + + -- ANCHOR(`waddch()',`Add') + procedure Add (Win : in Window := Standard_Window; + Ch : in Attributed_Character); + -- AKA + + procedure Add (Win : in Window := Standard_Window; + Ch : in Character); + -- Add a single character at the current logical cursor position to + -- the window. Use the current windows attributes. + + -- ANCHOR(`mvwaddch()',`Add') + procedure Add + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Ch : in Attributed_Character); + -- AKA + + procedure Add + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Ch : in Character); + -- Move to the position and add a single character into the window + + -- ANCHOR(`wechochar()',`Add_With_Immediate_Echo') + procedure Add_With_Immediate_Echo + (Win : in Window := Standard_Window; + Ch : in Attributed_Character); + -- AKA + + procedure Add_With_Immediate_Echo + (Win : in Window := Standard_Window; + Ch : in Character); + -- Add a character and do an immediate resfresh of the screen. + + -- MANPAGE(`curs_window.3x') + + -- ANCHOR(`newwin()',`Create') + function Create + (Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; + First_Column_Position : Column_Position) return Window; + -- AKA + + function New_Window + (Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; + First_Column_Position : Column_Position) return Window + renames Create; + + -- ANCHOR(`delwin()',`Delete') + procedure Delete (Win : in out Window); + -- AKA + -- Reset Win to Null_Window + + -- ANCHOR(`subwin()',`Sub_Window') + function Sub_Window + (Win : Window := Standard_Window; + Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; + First_Column_Position : Column_Position) return Window; + -- AKA + + -- ANCHOR(`derwin()',`Derived_Window') + function Derived_Window + (Win : Window := Standard_Window; + Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; + First_Column_Position : Column_Position) return Window; + -- AKA + + -- ANCHOR(`dupwin()',`Duplicate') + function Duplicate (Win : Window) return Window; + -- AKA + + -- ANCHOR(`mvwin()',`Move_Window') + procedure Move_Window (Win : in Window; + Line : in Line_Position; + Column : in Column_Position); + -- AKA + + -- ANCHOR(`mvderwin()',`Move_Derived_Window') + procedure Move_Derived_Window (Win : in Window; + Line : in Line_Position; + Column : in Column_Position); + -- AKA + + -- ANCHOR(`wsyncup()',`Synchronize_Upwards') + procedure Synchronize_Upwards (Win : in Window); + -- AKA + pragma Import (C, Synchronize_Upwards, "wsyncup"); + + -- ANCHOR(`wsyncdown()',`Synchronize_Downwards') + procedure Synchronize_Downwards (Win : in Window); + -- AKA + pragma Import (C, Synchronize_Downwards, "wsyncdown"); + + -- ANCHOR(`syncok()',`Set_Synch_Mode') + procedure Set_Synch_Mode (Win : in Window := Standard_Window; + Mode : in Boolean := False); + -- AKA + + -- MANPAGE(`curs_addstr.3x') + + -- ANCHOR(`waddnstr()',`Add') + procedure Add (Win : in Window := Standard_Window; + Str : in String; + Len : in Integer := -1); + -- AKA + -- ALIAS(`waddstr()') + + -- ANCHOR(`mvwaddnstr()',`Add') + procedure Add (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : in String; + Len : in Integer := -1); + -- AKA + -- ALIAS(`mvwaddstr()') + + -- MANPAGE(`curs_addchstr.3x') + + -- ANCHOR(`waddchnstr()',`Add') + procedure Add (Win : in Window := Standard_Window; + Str : in Attributed_String; + Len : in Integer := -1); + -- AKA + -- ALIAS(`waddchstr()') + + -- ANCHOR(`mvwaddchnstr()',`Add') + procedure Add (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : in Attributed_String; + Len : in Integer := -1); + -- AKA + -- ALIAS(`mvwaddchstr()') + + -- MANPAGE(`curs_border.3x') + + -- ANCHOR(`wborder()',`Border') + procedure Border + (Win : in Window := Standard_Window; + Left_Side_Symbol : in Attributed_Character := Default_Character; + Right_Side_Symbol : in Attributed_Character := Default_Character; + Top_Side_Symbol : in Attributed_Character := Default_Character; + Bottom_Side_Symbol : in Attributed_Character := Default_Character; + Upper_Left_Corner_Symbol : in Attributed_Character := Default_Character; + Upper_Right_Corner_Symbol : in Attributed_Character := Default_Character; + Lower_Left_Corner_Symbol : in Attributed_Character := Default_Character; + Lower_Right_Corner_Symbol : in Attributed_Character := Default_Character + ); + -- AKA + + -- ANCHOR(`box()',`Box') + procedure Box + (Win : in Window := Standard_Window; + Vertical_Symbol : in Attributed_Character := Default_Character; + Horizontal_Symbol : in Attributed_Character := Default_Character); + -- AKA + + -- ANCHOR(`whline()',`Horizontal_Line') + procedure Horizontal_Line + (Win : in Window := Standard_Window; + Line_Size : in Natural; + Line_Symbol : in Attributed_Character := Default_Character); + -- AKA + + -- ANCHOR(`wvline()',`Vertical_Line') + procedure Vertical_Line + (Win : in Window := Standard_Window; + Line_Size : in Natural; + Line_Symbol : in Attributed_Character := Default_Character); + -- AKA + + -- MANPAGE(`curs_getch.3x') + + -- ANCHOR(`wgetch()',`Get_Keystroke') + function Get_Keystroke (Win : Window := Standard_Window) + return Real_Key_Code; + -- AKA + -- Get a character from the keyboard and echo it - if enabled - to the + -- window. + -- If for any reason (i.e. a timeout) we couldn't get a character the + -- returned keycode is Key_None. + + -- ANCHOR(`ungetch()',`Undo_Keystroke') + procedure Undo_Keystroke (Key : in Real_Key_Code); + -- AKA + + -- ANCHOR(`has_key()',`Has_Key') + function Has_Key (Key : Special_Key_Code) return Boolean; + -- AKA + -- | + -- | Some helper functions + -- | + function Is_Function_Key (Key : Special_Key_Code) return Boolean; + -- Return True if the Key is a function key (i.e. one of F0 .. F63) + + subtype Function_Key_Number is Integer range 0 .. 63; + -- (n)curses allows for 64 function keys. + + function Function_Key (Key : Real_Key_Code) return Function_Key_Number; + -- Return the number of the function key. If the code is not a + -- function key, a CONSTRAINT_ERROR will be raised. + + function Function_Key_Code (Key : Function_Key_Number) return Real_Key_Code; + -- Return the key code for a given functionkey number. + + -- MANPAGE(`curs_attr.3x') + + -- ANCHOR(`wattron()',`Switch_Character_Attribute') + procedure Switch_Character_Attribute + (Win : in Window := Standard_Window; + Attr : in Character_Attribute_Set := Normal_Video; + On : in Boolean := True); -- if False we switch Off. + -- AKA + -- ALIAS(`wattroff()') + + -- ANCHOR(`wattrset()',`Set_Character_Attributes') + procedure Set_Character_Attributes + (Win : in Window := Standard_Window; + Attr : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First); + -- AKA + + -- ANCHOR(`wattr_get()',`Get_Character_Attribute') + function Get_Character_Attribute + (Win : in Window := Standard_Window) return Character_Attribute_Set; + -- AKA + + -- ANCHOR(`wattr_get()',`Get_Character_Attribute') + function Get_Character_Attribute + (Win : in Window := Standard_Window) return Color_Pair; + -- AKA + + -- ANCHOR(`wchgat()',`Change_Attributes') + procedure Change_Attributes + (Win : in Window := Standard_Window; + Count : in Integer := -1; + Attr : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First); + -- AKA + + -- ANCHOR(`mvwchgat()',`Change_Attributes') + procedure Change_Attributes + (Win : in Window := Standard_Window; + Line : in Line_Position := Line_Position'First; + Column : in Column_Position := Column_Position'First; + Count : in Integer := -1; + Attr : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First); + -- AKA + + -- MANPAGE(`curs_beep.3x') + + -- ANCHOR(`beep()',`Beep') + procedure Beep; + -- AKA + + -- ANCHOR(`flash()',`Flash_Screen') + procedure Flash_Screen; + -- AKA + + -- MANPAGE(`curs_inopts.3x') + + -- | Not implemented : typeahead + -- + -- ANCHOR(`cbreak()',`Set_Cbreak_Mode') + procedure Set_Cbreak_Mode (SwitchOn : in Boolean := True); + -- AKA + -- ALIAS(`nocbreak()') + + -- ANCHOR(`raw()',`Set_Raw_Mode') + procedure Set_Raw_Mode (SwitchOn : in Boolean := True); + -- AKA + -- ALIAS(`noraw()') + + -- ANCHOR(`echo()',`Set_Echo_Mode') + procedure Set_Echo_Mode (SwitchOn : in Boolean := True); + -- AKA + -- ALIAS(`noecho()') + + -- ANCHOR(`meta()',`Set_Meta_Mode') + procedure Set_Meta_Mode (Win : in Window := Standard_Window; + SwitchOn : in Boolean := True); + -- AKA + + -- ANCHOR(`keypad()',`Set_KeyPad_Mode') + procedure Set_KeyPad_Mode (Win : in Window := Standard_Window; + SwitchOn : in Boolean := True); + -- AKA + + type Half_Delay_Amount is range 1 .. 255; + + -- ANCHOR(`halfdelay()',`Half_Delay') + procedure Half_Delay (Amount : in Half_Delay_Amount); + -- AKA + + -- ANCHOR(`intrflush()',`Set_Flush_On_Interrupt_Mode') + procedure Set_Flush_On_Interrupt_Mode + (Win : in Window := Standard_Window; + Mode : in Boolean := True); + -- AKA + + -- ANCHOR(`qiflush()',`Set_Queue_Interrupt_Mode') + procedure Set_Queue_Interrupt_Mode + (Win : in Window := Standard_Window; + Flush : in Boolean := True); + -- AKA + -- ALIAS(`noqiflush()') + + -- ANCHOR(`nodelay()',`Set_NoDelay_Mode') + procedure Set_NoDelay_Mode + (Win : in Window := Standard_Window; + Mode : in Boolean := False); + -- AKA + + type Timeout_Mode is (Blocking, Non_Blocking, Delayed); + + -- ANCHOR(`wtimeout()',`Set_Timeout_Mode') + procedure Set_Timeout_Mode (Win : in Window := Standard_Window; + Mode : in Timeout_Mode; + Amount : in Natural); -- in Miliseconds + -- AKA + -- Instead of overloading the semantic of the sign of amount, we + -- introduce the Timeout_Mode parameter. This should improve + -- readability. For Blocking and Non_Blocking, the Amount is not + -- evaluated. + + -- ANCHOR(`notimeout()',`Set_Escape_Time_Mode') + procedure Set_Escape_Timer_Mode + (Win : in Window := Standard_Window; + Timer_Off : in Boolean := False); + -- AKA + + -- MANPAGE(`curs_outopts.3x') + + -- ANCHOR(`nl()',`Set_NL_Mode') + procedure Set_NL_Mode (SwitchOn : in Boolean := True); + -- AKA + -- ALIAS(`nonl()') + + -- ANCHOR(`clearok()',`Clear_On_Next_Update') + procedure Clear_On_Next_Update + (Win : in Window := Standard_Window; + Do_Clear : in Boolean := True); + -- AKA + + -- ANCHOR(`idlok()',`Use_Insert_Delete_Line') + procedure Use_Insert_Delete_Line + (Win : in Window := Standard_Window; + Do_Idl : in Boolean := True); + -- AKA + + -- ANCHOR(`idcok()',`Use_Insert_Delete_Character') + procedure Use_Insert_Delete_Character + (Win : in Window := Standard_Window; + Do_Idc : in Boolean := True); + -- AKA + + -- ANCHOR(`leaveok()',`Leave_Cursor_After_Update') + procedure Leave_Cursor_After_Update + (Win : in Window := Standard_Window; + Do_Leave : in Boolean := True); + -- AKA + + -- ANCHOR(`immedok()',`Immediate_Update_Mode') + procedure Immediate_Update_Mode + (Win : in Window := Standard_Window; + Mode : in Boolean := False); + -- AKA + + -- ANCHOR(`scrollok()',`Allow_Scrolling') + procedure Allow_Scrolling + (Win : in Window := Standard_Window; + Mode : in Boolean := False); + -- AKA + + function Scrolling_Allowed (Win : Window := Standard_Window) return Boolean; + -- There is no such function in the C interface. + + -- ANCHOR(`wsetscrreg()',`Set_Scroll_Region') + procedure Set_Scroll_Region + (Win : in Window := Standard_Window; + Top_Line : in Line_Position; + Bottom_Line : in Line_Position); + -- AKA + + -- MANPAGE(`curs_refresh.3x') + + -- ANCHOR(`doupdate()',`Update_Screen') + procedure Update_Screen; + -- AKA + + -- ANCHOR(`wrefresh()',`Refresh') + procedure Refresh (Win : in Window := Standard_Window); + -- AKA + + -- ANCHOR(`wnoutrefresh()',`Refresh_Without_Update') + procedure Refresh_Without_Update + (Win : in Window := Standard_Window); + -- AKA + + -- ANCHOR(`redrawwin()',`Redraw') + procedure Redraw (Win : in Window := Standard_Window); + -- AKA + + -- ANCHOR(`wredrawln()',`Redraw') + procedure Redraw (Win : in Window := Standard_Window; + Begin_Line : in Line_Position; + Line_Count : in Positive); + -- AKA + + -- MANPAGE(`curs_clear.3x') + + -- ANCHOR(`werase()',`Erase') + procedure Erase (Win : in Window := Standard_Window); + -- AKA + + -- ANCHOR(`wclear()',`Clear') + procedure Clear + (Win : in Window := Standard_Window); + -- AKA + + -- ANCHOR(`wclrtobot()',`Clear_To_End_Of_Screen') + procedure Clear_To_End_Of_Screen + (Win : in Window := Standard_Window); + -- AKA + + -- ANCHOR(`wclrtoeol()',`Clear_To_End_Of_Line') + procedure Clear_To_End_Of_Line + (Win : in Window := Standard_Window); + -- AKA + + -- MANPAGE(`curs_bkgd.3x') + + -- ANCHOR(`wbkgdset()',`Set_Background') + procedure Set_Background + (Win : in Window := Standard_Window; + Ch : in Attributed_Character); + -- AKA + + -- ANCHOR(`wbkgd()',`Change_Background') + procedure Change_Background + (Win : in Window := Standard_Window; + Ch : in Attributed_Character); + -- AKA + + -- ANCHOR(`wbkgdget()',`Get_Background') + function Get_Background (Win : Window := Standard_Window) + return Attributed_Character; + -- AKA + + -- MANPAGE(`curs_touch.3x') + + -- ANCHOR(`touchwin()',`Touch') + procedure Touch (Win : in Window := Standard_Window); + -- AKA + + -- ANCHOR(`untouchwin()',`Untouch') + procedure Untouch (Win : in Window := Standard_Window); + -- AKA + + -- ANCHOR(`touchline()',`Touch') + procedure Touch (Win : in Window := Standard_Window; + Start : in Line_Position; + Count : in Positive); + -- AKA + + -- ANCHOR(`wtouchln()',`Change_Line_Status') + procedure Change_Lines_Status (Win : in Window := Standard_Window; + Start : in Line_Position; + Count : in Positive; + State : in Boolean); + -- AKA + + -- ANCHOR(`is_linetouched()',`Is_Touched') + function Is_Touched (Win : Window := Standard_Window; + Line : Line_Position) return Boolean; + -- AKA + + -- ANCHOR(`is_wintouched()',`Is_Touched') + function Is_Touched (Win : Window := Standard_Window) return Boolean; + -- AKA + + -- MANPAGE(`curs_overlay.3x') + + -- ANCHOR(`copywin()',`Copy') + procedure Copy + (Source_Window : in Window; + Destination_Window : in Window; + Source_Top_Row : in Line_Position; + Source_Left_Column : in Column_Position; + Destination_Top_Row : in Line_Position; + Destination_Left_Column : in Column_Position; + Destination_Bottom_Row : in Line_Position; + Destination_Right_Column : in Column_Position; + Non_Destructive_Mode : in Boolean := True); + -- AKA + + -- ANCHOR(`overwrite()',`Overwrite') + procedure Overwrite (Source_Window : in Window; + Destination_Window : in Window); + -- AKA + + -- ANCHOR(`overlay()',`Overlay') + procedure Overlay (Source_Window : in Window; + Destination_Window : in Window); + -- AKA + + -- MANPAGE(`curs_deleteln.3x') + + -- ANCHOR(`winsdelln()',`Insert_Delete_Lines') + procedure Insert_Delete_Lines + (Win : in Window := Standard_Window; + Lines : in Integer := 1); -- default is to insert one line above + -- AKA + + -- ANCHOR(`wdeleteln()',`Delete_Line') + procedure Delete_Line (Win : in Window := Standard_Window); + -- AKA + + -- ANCHOR(`winsertln()',`Insert_Line') + procedure Insert_Line (Win : in Window := Standard_Window); + -- AKA + + -- MANPAGE(`curs_getyx.3x') + + -- ANCHOR(`getmaxyx()',`Get_Size') + procedure Get_Size + (Win : in Window := Standard_Window; + Number_Of_Lines : out Line_Count; + Number_Of_Columns : out Column_Count); + -- AKA + + -- ANCHOR(`getbegyx()',`Get_Window_Position') + procedure Get_Window_Position + (Win : in Window := Standard_Window; + Top_Left_Line : out Line_Position; + Top_Left_Column : out Column_Position); + -- AKA + + -- ANCHOR(`getyx()',`Get_Cursor_Position') + procedure Get_Cursor_Position + (Win : in Window := Standard_Window; + Line : out Line_Position; + Column : out Column_Position); + -- AKA + + -- ANCHOR(`getparyx()',`Get_Origin_Relative_To_Parent') + procedure Get_Origin_Relative_To_Parent + (Win : in Window; + Top_Left_Line : out Line_Position; + Top_Left_Column : out Column_Position; + Is_Not_A_Subwindow : out Boolean); + -- AKA + -- Instead of placing -1 in the coordinates as return, we use a boolean + -- to return the info that the window has no parent. + + -- MANPAGE(`curs_pad.3x') + + -- ANCHOR(`newpad()',`New_Pad') + function New_Pad (Lines : Line_Count; + Columns : Column_Count) return Window; + -- AKA + + -- ANCHOR(`subpad()',`Sub_Pad') + function Sub_Pad + (Pad : Window; + Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; + First_Column_Position : Column_Position) return Window; + -- AKA + + -- ANCHOR(`prefresh()',`Refresh') + procedure Refresh + (Pad : in Window; + Source_Top_Row : in Line_Position; + Source_Left_Column : in Column_Position; + Destination_Top_Row : in Line_Position; + Destination_Left_Column : in Column_Position; + Destination_Bottom_Row : in Line_Position; + Destination_Right_Column : in Column_Position); + -- AKA + + -- ANCHOR(`pnoutrefresh()',`Refresh_Without_Update') + procedure Refresh_Without_Update + (Pad : in Window; + Source_Top_Row : in Line_Position; + Source_Left_Column : in Column_Position; + Destination_Top_Row : in Line_Position; + Destination_Left_Column : in Column_Position; + Destination_Bottom_Row : in Line_Position; + Destination_Right_Column : in Column_Position); + -- AKA + + -- ANCHOR(`pechochar()',`Add_Character_To_Pad_And_Echo_It') + procedure Add_Character_To_Pad_And_Echo_It + (Pad : in Window; + Ch : in Attributed_Character); + -- AKA + + procedure Add_Character_To_Pad_And_Echo_It + (Pad : in Window; + Ch : in Character); + + -- MANPAGE(`curs_scroll.3x') + + -- ANCHOR(`wscrl()',`Scroll') + procedure Scroll (Win : in Window := Standard_Window; + Amount : in Integer := 1); + -- AKA + + -- MANPAGE(`curs_delch.3x') + + -- ANCHOR(`wdelch()',`Delete_Character') + procedure Delete_Character (Win : in Window := Standard_Window); + -- AKA + + -- ANCHOR(`mvwdelch()',`Delete_Character') + procedure Delete_Character + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position); + -- AKA + + -- MANPAGE(`curs_inch.3x') + + -- ANCHOR(`winch()',`Peek') + function Peek (Win : Window := Standard_Window) + return Attributed_Character; + -- AKA + + -- ANCHOR(`mvwinch()',`Peek') + function Peek + (Win : Window := Standard_Window; + Line : Line_Position; + Column : Column_Position) return Attributed_Character; + -- AKA + + -- MANPAGE(`curs_winch.3x') + + -- ANCHOR(`winsch()',`Insert') + procedure Insert (Win : in Window := Standard_Window; + Ch : in Attributed_Character); + -- AKA + + -- ANCHOR(`mvwinsch()',`Insert') + procedure Insert (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Ch : in Attributed_Character); + -- AKA + + -- MANPAGE(`curs_winch.3x') + + -- ANCHOR(`winsnstr()',`Insert') + procedure Insert (Win : in Window := Standard_Window; + Str : in String; + Len : in Integer := -1); + -- AKA + -- ALIAS(`winsstr()') + + -- ANCHOR(`mvwinsnstr()',`Insert') + procedure Insert (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : in String; + Len : in Integer := -1); + -- AKA + -- ALIAS(`mvwinsstr()') + + -- MANPAGE(`curs_instr.3x') + + -- ANCHOR(`winnstr()',`Peek') + procedure Peek (Win : in Window := Standard_Window; + Str : out String; + Len : in Integer := -1); + -- AKA + -- ALIAS(`winstr()') + + -- ANCHOR(`mvwinnstr()',`Peek') + procedure Peek (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : out String; + Len : in Integer := -1); + -- AKA + -- ALIAS(`mvwinstr()') + + -- MANPAGE(`curs_inchstr.3x') + + -- ANCHOR(`winchnstr()',`Peek') + procedure Peek (Win : in Window := Standard_Window; + Str : out Attributed_String; + Len : in Integer := -1); + -- AKA + -- ALIAS(`winchstr()') + + -- ANCHOR(`mvwinchnstr()',`Peek') + procedure Peek (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : out Attributed_String; + Len : in Integer := -1); + -- AKA + -- ALIAS(`mvwinchstr()') + + -- MANPAGE(`curs_getstr.3x') + + -- ANCHOR(`wgetnstr()',`Get') + procedure Get (Win : in Window := Standard_Window; + Str : out String; + Len : in Integer := -1); + -- AKA + -- ALIAS(`wgetstr()') + + procedure Get (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : out String; + Len : in Integer := -1); + -- AKA: not specified in ncurses, should be: mvwgetnstr() + -- and mvwgetstr() (which exists) + + -- MANPAGE(`curs_slk.3x') + + type Soft_Label_Key_Format is (Three_Two_Three, + Four_Four, + PC_Style, -- ncurses specific + PC_Style_With_Index); -- " + type Label_Number is new Positive range 1 .. 12; + type Label_Justification is (Left, Centered, Right); + + -- ANCHOR(`slk_init()',`Init_Soft_Label_Keys') + procedure Init_Soft_Label_Keys + (Format : in Soft_Label_Key_Format := Three_Two_Three); + -- AKA + + -- ANCHOR(`slk_set()',`Set_Soft_Label_Key') + procedure Set_Soft_Label_Key (Label : in Label_Number; + Text : in String; + Fmt : in Label_Justification := Left); + -- AKA + + -- ANCHOR(`slk_refresh()',`Refresh_Soft_Label_Key') + procedure Refresh_Soft_Label_Keys; + -- AKA + + -- ANCHOR(`slk_noutrefresh()',`Refresh_Soft_Label_Keys_Without_Update') + procedure Refresh_Soft_Label_Keys_Without_Update; + -- AKA + + -- ANCHOR(`slk_label()',`Get_Soft_Label_Key') + procedure Get_Soft_Label_Key (Label : in Label_Number; + Text : out String); + -- AKA + + -- ANCHOR(`slk_clear()',`Clear_Soft_Label_Keys') + procedure Clear_Soft_Label_Keys; + -- AKA + + -- ANCHOR(`slk_restore()',`Restore_Soft_Label_Keys') + procedure Restore_Soft_Label_Keys; + -- AKA + + -- ANCHOR(`slk_touch()',`Touch_Soft_Label_Keys') + procedure Touch_Soft_Label_Keys; + -- AKA + + -- ANCHOR(`slk_attron()',`Switch_Soft_Label_Key_Attributes') + procedure Switch_Soft_Label_Key_Attributes + (Attr : in Character_Attribute_Set; + On : in Boolean := True); + -- AKA + -- ALIAS(`slk_attroff()') + + -- ANCHOR(`slk_attrset()',`Set_Soft_Label_Key_Attributes') + procedure Set_Soft_Label_Key_Attributes + (Attr : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First); + -- AKA + + -- ANCHOR(`slk_attr()',`Get_Soft_Label_Key_Attributes') + function Get_Soft_Label_Key_Attributes return Character_Attribute_Set; + -- AKA + + -- ANCHOR(`slk_attr()',`Get_Soft_Label_Key_Attributes') + function Get_Soft_Label_Key_Attributes return Color_Pair; + -- AKA + + -- MANPAGE(`curs_util.3x') + + -- | Not implemented : filter, use_env, putwin, getwin + -- + -- ANCHOR(`keyname()',`Key_Name') + procedure Key_Name (Key : in Real_Key_Code; + Name : out String); + -- AKA + -- The external name for a real keystroke. + + -- ANCHOR(`unctrl()',`Un_Control') + procedure Un_Control (Ch : in Attributed_Character; + Str : out String); + -- AKA + + -- ANCHOR(`delay_output()',`Delay_Output') + procedure Delay_Output (Msecs : in Natural); + -- AKA + + -- ANCHOR(`flushinp()',`Flush_Input') + procedure Flush_Input; + -- AKA + + -- MANPAGE(`curs_termattrs.3x') + + -- ANCHOR(`baudrate()',`Baudrate') + function Baudrate return Natural; + -- AKA + + -- ANCHOR(`erasechar()',`Erase_Character') + function Erase_Character return Character; + -- AKA + + -- ANCHOR(`killchar()',`Kill_Character') + function Kill_Character return Character; + -- AKA + + -- ANCHOR(`has_ic()',`Has_Insert_Character') + function Has_Insert_Character return Boolean; + -- AKA + + -- ANCHOR(`has_il()',`Has_Insert_Line') + function Has_Insert_Line return Boolean; + -- AKA + + -- ANCHOR(`termattrs()',`Supported_Attributes') + function Supported_Attributes return Character_Attribute_Set; + -- AKA + + -- ANCHOR(`longname()',`Long_Name') + procedure Long_Name (Name : out String); + -- AKA + + -- ANCHOR(`termname()',`Terminal_Name') + procedure Terminal_Name (Name : out String); + -- AKA + + -- MANPAGE(`curs_color.3x') + + -- ANCHOR(`start_clolor()',`Start_Color') + procedure Start_Color; + -- AKA + pragma Import (C, Start_Color, "start_color"); + + -- ANCHOR(`init_pair()',`Init_Pair') + procedure Init_Pair (Pair : in Redefinable_Color_Pair; + Fore : in Color_Number; + Back : in Color_Number); + -- AKA + + -- ANCHOR(`pair_content()',`Pair_Content') + procedure Pair_Content (Pair : in Color_Pair; + Fore : out Color_Number; + Back : out Color_Number); + -- AKA + + -- ANCHOR(`has_colors()',`Has_Colors') + function Has_Colors return Boolean; + -- AKA + + -- ANCHOR(`init_color()',`Init_Color') + procedure Init_Color (Color : in Color_Number; + Red : in RGB_Value; + Green : in RGB_Value; + Blue : in RGB_Value); + -- AKA + + -- ANCHOR(`can_change_color()',`Can_Change_Color') + function Can_Change_Color return Boolean; + -- AKA + + -- ANCHOR(`color_content()',`Color_Content') + procedure Color_Content (Color : in Color_Number; + Red : out RGB_Value; + Green : out RGB_Value; + Blue : out RGB_Value); + -- AKA + + -- MANPAGE(`curs_kernel.3x') + + -- | Not implemented: getsyx, setsyx + -- + type Curses_Mode is (Curses, Shell); + + -- ANCHOR(`def_prog_mode()',`Save_Curses_Mode') + procedure Save_Curses_Mode (Mode : in Curses_Mode); + -- AKA + -- ALIAS(`def_shell_mode()') + + -- ANCHOR(`reset_prog_mode()',`Reset_Curses_Mode') + procedure Reset_Curses_Mode (Mode : in Curses_Mode); + -- AKA + -- ALIAS(`reset_shell_mode()') + + -- ANCHOR(`savetty()',`Save_Terminal_State') + procedure Save_Terminal_State; + -- AKA + + -- ANCHOR(`resetty();',`Reset_Terminal_State') + procedure Reset_Terminal_State; + -- AKA + + type Stdscr_Init_Proc is access + function (Win : Window; + Columns : Column_Count) return Integer; + pragma Convention (C, Stdscr_Init_Proc); + -- N.B.: the return value is actually ignored, but it seems to be + -- a good practice to return 0 if you think all went fine + -- and -1 otherwise. + + -- ANCHOR(`ripoffline()',`Rip_Off_Lines') + procedure Rip_Off_Lines (Lines : in Integer; + Proc : in Stdscr_Init_Proc); + -- AKA + -- N.B.: to be more precise, this uses a ncurses specific enhancement of + -- ripoffline(), in which the Lines argument absolute value is the + -- number of lines to be ripped of. The official ripoffline() only + -- uses the sign of Lines to rip of a single line from bottom or top. + + type Cursor_Visibility is (Invisible, Normal, Very_Visible); + + -- ANCHOR(`curs_set()',`Set_Cursor_Visibility') + procedure Set_Cursor_Visibility (Visibility : in out Cursor_Visibility); + -- AKA + + -- ANCHOR(`napms()',`Nap_Milli_Seconds') + procedure Nap_Milli_Seconds (Ms : in Natural); + -- AKA + + -- |===================================================================== + -- | Some usefull helpers. + -- |===================================================================== + type Transform_Direction is (From_Screen, To_Screen); + procedure Transform_Coordinates + (W : in Window := Standard_Window; + Line : in out Line_Position; + Column : in out Column_Position; + Dir : in Transform_Direction := From_Screen); + -- This procedure transforms screen coordinates into coordinates relative + -- to the window and vice versa, depending on the Dir parmeter. + -- Screen coordinates are the position informations on the physical device. + -- An Curses_Exception will be raised if Line and Column are not in the + -- Window or if you pass the Null_Window as argument. + +private + type Window is new System.Address; + Null_Window : constant Window := Window (System.Null_Address); + + Generation_Bit_Order : constant System.Bit_Order := System.M4_BIT_ORDER; + -- This constant may be different on your system. + +end Terminal_Interface.Curses; diff --git a/Ada95/html/Makefile b/Ada95/html/Makefile new file mode 100644 index 00000000..caf46e35 --- /dev/null +++ b/Ada95/html/Makefile @@ -0,0 +1,19 @@ +# Nothing to do in this directory + +all:: + @ + +clean:: + @ + +distclean:: clean + @ + +realclean:: clean + @ + +mostlyclean:: clean + @ + +install:: + @ diff --git a/Ada95/html/curs_addch.3x.html b/Ada95/html/curs_addch.3x.html new file mode 100644 index 00000000..e739fc42 --- /dev/null +++ b/Ada95/html/curs_addch.3x.html @@ -0,0 +1,176 @@ + + +
+       addch,  waddch,  mvaddch,  mvwaddch, echochar, wechochar -
+       add a character (with attributes) to a curses window, then
+       advance the cursor
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int addch(chtype ch);
+       int waddch(WINDOW *win, chtype ch);
+       int mvaddch(int y, int x, chtype ch);
+       int mvwaddch(WINDOW *win, int y, int x, chtype ch);
+       int echochar(chtype ch);
+       int wechochar(WINDOW *win, chtype ch);
+
+
+
+

DESCRIPTION

+       The  addch,  waddch, mvaddch and mvwaddch routines put the
+       character ch into the given window at its  current  window
+       position,  which  is then advanced.  They are analogous to
+       putchar in stdio(3).  If the advance is at the right  mar-
+       gin,  the  cursor  automatically wraps to the beginning of
+       the next line.  At the bottom  of  the  current  scrolling
+       region,  if  scrollok  is enabled, the scrolling region is
+       scrolled up one line.
+
+       If ch is a tab, newline, or backspace, the cursor is moved
+       appropriately within the window.  Backspace moves the cur-
+       sor one character left; at the left edge of  a  window  it
+       does  nothing.   Newline  does  a clrtoeol, then moves the
+       cursor to  the  window  left  margin  on  the  next  line,
+       scrolling  the window if on the last line).  Tabs are con-
+       sidered to be at every eighth column.
+
+       If ch is any control character other than tab, newline, or
+       backspace,  it  is  drawn  in  ^X notation.  Calling winch
+       after adding a control character does not return the char-
+       acter  itself, but instead returns the ^-representation of
+       the control character.  (To emit control characters liter-
+       ally, use echochar.)
+
+       Video attributes can be combined with a character argument
+       passed to addch or related functions by logical-ORing them
+       into  the  character.   (Thus, text, including attributes,
+       can be copied from one place to  another  using  inch  and
+       addch.).   See the curs_attr(3X) page for values of prede-
+       fined video attribute constants that can be usefully OR'ed
+       into characters.
+
+       The  echochar  and  wechochar routines are equivalent to a
+       call to addch followed by a call to refresh, or a call  to
+       waddch followed by a call to wrefresh.  The knowledge that
+       only a single character is being output is used  and,  for
+       non-control  characters,  a  considerable performance gain
+
+   Line Graphics
+       The  following  variables  may be used to add line drawing
+       characters to the screen with routines of the  addch  fam-
+       ily.   The  default  character listed below is used if the
+       acsc  capability  doesn't   define   a   terminal-specific
+       replacement for it (but see the EXTENSIONS section below).
+       The names are taken from VT100 nomenclature.
+
+       l  l  l  _  _  _  l   l   l.    Name Default   Description
+       ACS_ULCORNER   +    upper         left-hand         corner
+       ACS_LLCORNER   +    lower         left-hand         corner
+       ACS_URCORNER   +    upper         right-hand        corner
+       ACS_LRCORNER   +    lower        right-hand         corner
+       ACS_RTEE  +    right     tee    ACS_LTEE  +    left    tee
+       ACS_BTEE  +    bottom    tee    ACS_TTEE  +    top     tee
+       ACS_HLINE -    horizontal   line   ACS_VLINE |    vertical
+       line ACS_PLUS  +    plus ACS_S1    -    scan line 1 ACS_S9
+         _    scan     line     9     ACS_DIAMOND    +    diamond
+       ACS_CKBOARD    :    checker        board         (stipple)
+       ACS_DEGREE     '    degree                          symbol
+       ACS_PLMINUS    #    plus/minus  ACS_BULLET     o    bullet
+       ACS_LARROW     <    arrow           pointing          left
+       ACS_RARROW     >    arrow          pointing          right
+       ACS_DARROW     v    arrow           pointing          down
+       ACS_UARROW     ^    arrow pointing up ACS_BOARD #    board
+       of      squares     ACS_LANTERN    #    lantern     symbol
+       ACS_BLOCK #    solid square block ACS_S3    -    scan line
+       3  ACS_S7     -    scan  line  7 ACS_LEQUAL     <    less-
+       than-or-equal-to      ACS_GEQUAL     >    greater-than-or-
+       equal-to  ACS_PI    *    greek pi ACS_NEQUAL     !    not-
+       equal ACS_STERLING   f    pound-sterling symbol
+
+
+
+
+

RETURN VALUE

+       All routines return the integer ERR upon failure and OK on
+       success  (the  SVr4 manuals specify only "an integer value
+       other than ERR") upon successful completion, unless other-
+       wise noted in the preceding routine descriptions.
+
+
+
+

NOTES

+       Note  that  addch,  mvaddch, mvwaddch, and echochar may be
+       macros.
+
+
+
+

EXTENSIONS

+       The following extended curses features are available  only
+       on  PC-clone consoles and compatible terminals obeying the
+       ANSI.SYS de-facto standard for terminal control sequences.
+       They are not part of XSI curses.
+
+       The attribute A_ALTCHARSET actually forces literal display
+       of PC ROM characters  including  the  high-half  graphics.
+       the card-suit characters, up and down-arrow, and most oth-
+       ers in the range 0-32.  (In a terminfo entry designed  for
+       use  with  ncurses,  the high-half characters are obtained
+       using this attribute with an acsc string in which the sec-
+       ond of each pair is a high-half character.)
+
+       Giving  wechochar  an  argument with its high bit set will
+       produce the corresponding high-half  ASCII  graphic  (SVr4
+       curses also has this feature but does not document it).  A
+       control-character argument, however,  will  not  typically
+       produce  the corresponding graphic; characters such as CR,
+       NL, FF and TAB are typically interpreted  by  the  console
+       driver  itself,  and ESC will be interpreted as the leader
+       of a control sequence.
+
+
+
+

PORTABILITY

+       All these functions are described in the XSI Curses  stan-
+       dard,  Issue  4.  The defaults specified for forms-drawing
+       characters apply in the POSIX locale.
+
+       The seven ACS symbols starting with ACS_S3 were not  docu-
+       mented  in  any publicly released System V.  However, many
+       publicly available terminfos include acsc 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
+       ncurses(3X).
+
+
+
+

SEE ALSO

+       curses(3X), curs_attr(3X), curs_clear(3X),  curs_inch(3X),
+       curs_outopts(3X), curs_refresh(3X), putc(3S).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_addchstr.3x.html b/Ada95/html/curs_addchstr.3x.html new file mode 100644 index 00000000..3572b8c3 --- /dev/null +++ b/Ada95/html/curs_addchstr.3x.html @@ -0,0 +1,70 @@ + + +
+       addchstr,  addchnstr,  waddchstr,  waddchnstr, mvaddchstr,
+       mvaddchnstr, mvwaddchstr, mvwaddchnstr - add a  string  of
+       characters (and attributes) to a curses window
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int addchstr(const chtype *chstr);
+       int addchnstr(const chtype *chstr, int n);
+       int waddchstr(WINDOW *win, const chtype *chstr);
+       int waddchnstr(WINDOW *win, const chtype *chstr, int n);
+       int mvaddchstr(int y, int x, const chtype *chstr);
+       int mvaddchnstr(int y, int x, const chtype *chstr, int n);
+       int mvwaddchstr(WINDOW *win, int y, int  x,  const  chtype
+       *chstr);
+       int  mvwaddchnstr(WINDOW  *win, int y, int x, const chtype
+       *chstr, int n);
+
+
+
+

DESCRIPTION

+       These routines copy chstr into the window image  structure
+       at  and  after the current cursor position.  The four rou-
+       tines with n as the last argument copy at most n elements,
+       but  no  more than will fit on the line.  If n=-1 then the
+       whole string is copied, to the maximum number  of  charac-
+       ters that will fit on the line.
+
+       The window cursor is not advanced, and these routines work
+       faster than waddnstr.  On the other hand, they don't  per-
+       form  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.
+
+
+
+
+

RETURN VALUES

+       All routines return the integer ERR upon failure and OK on
+       success  (the  SVr4 manuals specify only "an integer value
+       other than ERR") upon successful completion, unless other-
+       wise noted in the preceding routine descriptions.
+
+
+
+

NOTES

+       Note that all routines except waddchnstr may be macros.
+
+
+
+

PORTABILITY

+       All  these  entry  points  are described in the XSI Curses
+       standard, Issue 4.
+
+
+
+

SEE ALSO

+       curses(3X).
+
+
+ + diff --git a/Ada95/html/curs_addstr.3x.html b/Ada95/html/curs_addstr.3x.html new file mode 100644 index 00000000..916aafb9 --- /dev/null +++ b/Ada95/html/curs_addstr.3x.html @@ -0,0 +1,70 @@ + + +
+       addstr,  addnstr,  waddstr, waddnstr, mvaddstr, mvaddnstr,
+       mvwaddstr, mvwaddnstr - add a string of  characters  to  a
+       curses window and advance cursor
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int addstr(const char *str);
+       int addnstr(const char *str, int n);
+       int waddstr(WINDOW *win, const char *str);
+       int waddnstr(WINDOW *win, const char *str, int n);
+       int mvaddstr(int y, int x, const char *str);
+       int mvaddnstr(int y, int x, const char *str, int n);
+       int mvwaddstr(WINDOW *win, int y, int x, const char *str);
+       int mvwaddnstr(WINDOW *win, int y, int x, const char *str,
+       int n);
+
+
+
+

DESCRIPTION

+       These  routines  write  the characters of the (null-termi-
+       nated) character string str on the given  window.   It  is
+       similar  to  calling waddch once for each character in the
+       string.  The four routines with n  as  the  last  argument
+       write  at  most n characters.  If n is -1, then the entire
+       string will be added.
+
+
+
+

RETURN VALUE

+       All routines return the integer ERR upon failure and OK on
+       success  (the  SVr4 manuals specify only "an integer value
+       other than ERR") upon successful completion.
+
+
+
+

NOTES

+       Note  that  all  of  these  routines  except  waddstr  and
+       waddnstr may be macros.
+
+
+
+

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.
+
+
+
+

SEE ALSO

+       curses(3X), curs_addch(3X).
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_attr.3x.html b/Ada95/html/curs_attr.3x.html new file mode 100644 index 00000000..6fe234c7 --- /dev/null +++ b/Ada95/html/curs_attr.3x.html @@ -0,0 +1,172 @@ + + +
+       attroff,  wattroff,  attron,  wattron,  attrset, wattrset,
+       standend, wstandend, standout, wstandout - curses  charac-
+       ter and window attribute control routines
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+       int attroff(int attrs);
+       int wattroff(WINDOW *win, int attrs);
+       int attron(int attrs);
+       int wattron(WINDOW *win, int attrs);
+       int attrset(int attrs);
+       int wattrset(WINDOW *win, int attrs);
+       int standend(void);
+       int wstandend(WINDOW *win);
+       int standout(void);
+       int wstandout(WINDOW *win);
+       attr_t attr_get(void);
+       attr_t wattr_get(WINDOW *);
+       int attr_off(attr_t attrs);
+       int wattr_off(WINDOW *, attr_t attrs);
+       int attr_on(attr_t attrs);
+       int wattr_on(WINDOW *, attr_t attrs);
+       int attr_set(attr_t attrs);
+       int wattr_set(WINDOW *, attr_t attrs);
+       int  chgat(int  n,  attr_t  attr,  short color, const void
+       *opts)
+       int wchgat(WINDOW *, int n, attr_t attr,
+             short color, const void *opts)
+       int mvchgat(int y, int x, int n, attr_t attr,
+             short color, const void *opts)
+       int mvwchgat(WINDOW *, int y, int x, int n, attr_t attr,
+             short color, const void *opts)
+
+
+
+

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  wad-
+       dch,  waddstr  and  wprintw.  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 attrset sets the  current  attributes  of  the
+       given  window to attrs.  The routine attroff turns off the
+       named attributes without turning any other  attributes  on
+       or  off.  The routine attron turns on the named attributes
+       without affecting any others.  The routine standout is the
+       same  as  attron(A_STANDOUT).  The routine standend is the
+       same as attrset(A_NORMAL) or attrset(0), that is, it turns
+       off all attributes.
+       the given window; attr_get returns the  current  attribute
+       for   stdscr.   The  remaining  attr_*  functions  operate
+       exactly like the  corresponding  attr*  functions,  except
+       that they take arguments of type attr_t rather than int.
+
+       The routine chgat changes the attributes of a given number
+       of characters starting at the current cursor  location  of
+       stdscr.   It  does not update the cursor and does not per-
+       form 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 wchgat  func-
+       tion generalizes this to any window; the mvwchgat function
+       does a cursor move before acting.  In these functions, the
+       color  argument  is  a  color-pair  index (as in the first
+       argument of  init_pair,  see  curs_color(3x)).   The  opts
+       argument  is  not  presently used, but is reserved for the
+       future (leave it NULL).
+
+   Attributes
+       The following video attributes, defined in <curses.h>, can
+       be passed to the routines attron, attroff, and attrset, or
+       OR'ed with the characters passed to addch.
+
+       center ; l l .  A_NORMAL  Normal  display  (no  highlight)
+       A_STANDOUT     Best  highlighting  mode  of  the terminal.
+       A_UNDERLINE    Underlining     A_REVERSE Reverse     video
+       A_BLINK   Blinking  A_DIM     Half  bright A_BOLD    Extra
+       bright or bold A_PROTECT Protected mode  A_INVIS   Invisi-
+       ble  or  blank mode A_ALTCHARSET   Alternate character set
+       A_CHARTEXT     Bit-mask    to    extract    a    character
+       COLOR_PAIR(n)  Color-pair number n
+
+       The following macro is the reverse of COLOR_PAIR(n):
+
+       PAIR_NUMBER(attrs) Returns the pair number associated
+                          with the COLOR_PAIR(n) attribute.
+
+       The  return values of many of these routines are not mean-
+       ingful (they are implemented as macro-expanded assignments
+       and  simply  return their argument).  The SVr4 manual page
+       claims (falsely) that these routines always return 1.
+
+
+
+
+

NOTES

+       Note that attroff,  wattroff,  attron,  wattron,  attrset,
+       wattrset, standend and standout may be macros.
+
+
+
+

PORTABILITY

+       All  these functions are supported in the XSI Curses stan-
+       dard, Issue 4.  The standard defined  the  dedicated  type
+       for  highlights,  attr_t,  which  is  not  defined in SVr4
+       curses. The functions taking attr_t arguments are not sup-
+       tional  functions  attron/attroff/attrset  can  manipulate
+       attributes  other  than A_BLINK, A_BOLD, A_DIM, A_REVERSE,
+       A_STANDOUT, or A_UNDERLINE is "unspecified".   Under  this
+       implementation  as  well  as  SVr4 curses, these functions
+       correctly manipulate all other  highlights  (specifically,
+       A_ALTCHARSET, A_PROTECT, and A_INVIS).
+
+       XSI  Curses added the new entry points, attr_get, attr_on,
+       attr_off,  attr_set,   wattr_on,   wattr_off,   wattr_get,
+       wattr_set.   These  are intended to work with a new series
+       of highlight macros prefixed with WA_.
+
+       center ; l l .  WA_NORMAL Normal  display  (no  highlight)
+       WA_STANDOUT    Best  highlighting  mode  of  the terminal.
+       WA_UNDERLINE   Underlining  WA_REVERSE     Reverse   video
+       WA_BLINK  Blinking  WA_DIM    Half  bright WA_BOLD   Extra
+       bright or bold WA_ALTCHARSET  Alternate character set
+
+       The XSI curses standard specifies that each pair of corre-
+       sponding  A_  and WA_-using functions operates on the same
+       current-highlight information.
+
+       The XSI standard extended conformance level adds new high-
+       lights A_HORIZONTAL, A_LEFT, A_LOW, A_RIGHT, A_TOP, A_VER-
+       TICAL (and corresponding WA_ macros for each)  which  this
+       curses does not yet support.
+
+
+
+

SEE ALSO

+       curses(3X),        curs_addch(3X),        curs_addstr(3X),
+       curs_printw(3X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_beep.3x.html b/Ada95/html/curs_beep.3x.html new file mode 100644 index 00000000..1abad227 --- /dev/null +++ b/Ada95/html/curs_beep.3x.html @@ -0,0 +1,70 @@ + + +
+       beep, flash - curses bell and screen flash routines
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int beep(void);
+       int flash(void);
+
+
+
+

DESCRIPTION

+       The beep and flash routines are used to alert the terminal
+       user.  The routine beep sounds an  audible  alarm  on  the
+       terminal,  if  possible;  otherwise  it flashes the screen
+       (visible bell).  The routine flash 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.
+
+
+
+

RETURN VALUE

+       These routines return OK if they  succeed  in  beeping  or
+       flashing, ERR otherwise.
+
+
+
+

EXTENSIONS

+       SVr4's  beep  and flash routines always returned OK, so it
+       was not possible to tell when the beep or flash failed.
+
+
+
+

PORTABILITY

+       These functions are defined in the  XSI  Curses  standard,
+       Issue  4.  Like SVr4, it specifies that they always return
+       OK.
+
+
+
+

SEE ALSO

+       curses(3X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_bkgd.3x.html b/Ada95/html/curs_bkgd.3x.html new file mode 100644 index 00000000..6a3396ca --- /dev/null +++ b/Ada95/html/curs_bkgd.3x.html @@ -0,0 +1,122 @@ + + +
+       bkgdset,  wbkgdset, bkgd, wbkgd - curses window background
+       manipulation routines
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       void bkgdset(const chtype ch);
+       void wbkgdset(WINDOW *win, const chtype ch);
+       int bkgd(const chtype ch);
+       int wbkgd(WINDOW *win, const chtype ch);
+       chtype getbkgd(WINDOW *win);
+
+
+
+

DESCRIPTION

+       The bkgdset and wbkgdset  routines  manipulate  the  back-
+       ground  of  the  named window.  The window background is a
+       chtype 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  charac-
+       ters  that  are written into the window with waddch.  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 bkgd and wbkgd functions set the  background  property
+       of  the  current  or  specified window and then apply this
+       setting to every character position in that window:
+
+              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.
+
+       The getbkgd function returns the  given  window's  current
+       background character/attribute pair.
+
+
+
+

RETURN VALUE

+       The  routines  bkgd  and wbkgd return the integer OK.  The
+       SVr4.0 manual says "or a non-negative integer  if  immedok
+       is set", but this appears to be an error.
+
+
+
+

NOTES

+       Note that bkgdset and bkgd may be macros.
+
+
+
+

PORTABILITY

+       These  functions are described in the XSI Curses standard,
+       return ERR, on failure. but gives no failure conditions.
+
+
+
+

SEE ALSO

+       curses(3X), curs_addch(3X), curs_outopts(3X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_border.3x.html b/Ada95/html/curs_border.3x.html new file mode 100644 index 00000000..1d45fa20 --- /dev/null +++ b/Ada95/html/curs_border.3x.html @@ -0,0 +1,120 @@ + + +
+       border,  wborder, box, hline, whline, vline, wvline - cre-
+       ate curses borders, horizontal and vertical lines
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+       int border(chtype ls, chtype rs, chtype ts, chtype bs,
+          chtype tl, chtype tr, chtype bl, chtype br);
+       int wborder(WINDOW *win, chtype ls, chtype rs,
+          chtype ts, chtype bs, chtype tl, chtype tr,
+          chtype bl, chtype br);
+       int box(WINDOW *win, chtype verch, chtype horch);
+       int hline(chtype ch, int n);
+       int whline(WINDOW *win, chtype ch, int n);
+       int vline(chtype ch, int n);
+       int wvline(WINDOW *win, chtype ch, int n);
+       mvhline(int y, int x, chtype ch, int n);
+       mvwhline(WINDOW *, int y, int x, chtype ch, int n);
+       int mvvline(int y, int x, chtype ch, int n);
+       int mvwvline(WINDOW *, int y, int x, chtype ch, int n);
+
+
+
+

DESCRIPTION

+       The border, wborder and box routines draw a box around the
+       edges  of  a  window.   The argument ls is a character and
+       attributes used for the left side  of  the  border,  rs  -
+       right  side,  ts  -  top  side, bs - bottom side, tl - top
+       left-hand corner, tr - top right-hand corner, bl -  bottom
+       left-hand  corner,  and br - bottom right-hand corner.  If
+       any of these arguments is zero, then the following default
+       values  (defined in curses.h) are used instead: ACS_VLINE,
+       ACS_VLINE,     ACS_HLINE,     ACS_HLINE,     ACS_ULCORNER,
+       ACS_URCORNER, ACS_BLCORNER, ACS_BRCORNER.
+
+       box(win,  verch,  horch)  is a shorthand for the following
+       call: wborder(win, verch, verch, horch, horch,  0,  0,  0,
+       0).
+
+       The  hline and whline functions draw a horizontal (left to
+       right) line using ch starting at the current cursor  posi-
+       tion  in  the  window.  The current cursor position is not
+       changed.  The line is at most n  characters  long,  or  as
+       many as fit into the window.
+
+       The  vline  and  wvline  functions draw a vertical (top to
+       bottom) line using ch starting at the current cursor posi-
+       tion  in  the  window.  The current cursor position is not
+       changed.  The line is at most n  characters  long,  or  as
+       many as fit into the window.
+
+
+
+

RETURN VALUE

+       All  routines  return  the  integer OK.  The SVr4.0 manual
+       says "or a non-negative integer if immedok  is  set",  but
+       this appears to be an error.
+       The  borders  generated by these functions are inside bor-
+       ders (this is also true of SVr4 curses, though the fact is
+       not documented).
+
+       Note that border and box may be macros.
+
+
+
+

PORTABILITY

+       These  functions are described in the XSI Curses standard,
+       Issue 4.  Additional functions mvhline, mvvline, mvwhline,
+       and mvwvline are described there which this implementation
+       does not yet support.  The standard  specifies  that  they
+       return  ERR on failure, but specifies no error conditions.
+
+
+
+

SEE ALSO

+       curses(3X), curs_outopts(3X).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_clear.3x.html b/Ada95/html/curs_clear.3x.html new file mode 100644 index 00000000..f2f3edf3 --- /dev/null +++ b/Ada95/html/curs_clear.3x.html @@ -0,0 +1,122 @@ + + +
+       erase,  werase,  clear,  wclear, clrtobot, wclrtobot, clr-
+       toeol, wclrtoeol - clear all or part of a curses window
+
+
+
+

SYNOPSIS

+       # include <curses.h>
+
+       int erase(void);
+       int werase(WINDOW *win);
+       int clear(void);
+       int wclear(WINDOW *win);
+       int clrtobot(void);
+       int wclrtobot(WINDOW *win);
+       int clrtoeol(void);
+       int wclrtoeol(WINDOW *win);
+
+
+
+

DESCRIPTION

+       The erase and werase routines copy blanks to  every  posi-
+       tion in the window, clearing the screen.
+
+       The  clear  and wclear routines are like erase and werase,
+       but they also call clearok, so that the screen is  cleared
+       completely  on  the  next call to wrefresh for that window
+       and repainted from scratch.
+
+       The clrtobot and wclrtobot 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 clrtoeol and wclrtoeol 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 ren-
+       dition (as set by wbkgdset) merged into them.
+
+
+
+

RETURN VALUE

+       All routines return the integer  OK.   The  SVr4.0  manual
+       says  "or  a  non-negative integer if immedok is set", but
+       this appears to be an error.
+
+
+
+

NOTES

+       Note that erase, werase, clear, wclear, clrtobot, and clr-
+       toeol may be macros.
+
+
+
+

PORTABILITY

+       These  functions are described in the XSI Curses standard,
+       Issue 4.  The standard specifies that they return  ERR  on
+       failure, but specifies no error conditions.
+
+       Some  historic  curses  implementations had, as an undocu-
+       mented feature,  the  ability  to  do  the  equivalent  of
+
+
+
+

SEE ALSO

+       curses(3X), curs_outopts(3X), curs_refresh(3X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_color.3x.html b/Ada95/html/curs_color.3x.html new file mode 100644 index 00000000..a1f877be --- /dev/null +++ b/Ada95/html/curs_color.3x.html @@ -0,0 +1,226 @@ + + +
+       start_color,     init_pair,     init_color,    has_colors,
+       can_change_color,  color_content,  pair_content  -  curses
+       color manipulation routines
+
+
+
+

SYNOPSIS

+       # include <curses.h>
+       int start_color(void);
+       int init_pair(short pair, short f, short b);
+       int init_color(short color, short r, short g, short b);
+       bool has_colors(void);
+       bool can_change_color(void);
+       int  color_content(short  color, short *r, short *g, short
+       *b);
+       int pair_content(short pair, short *f, short *b);
+
+
+
+

DESCRIPTION

+   Overview
+       curses support color attributes  on  terminals  with  that
+       capability.   To  use  these  routines start_color must be
+       called, usually right after initscr.   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 charac-
+       ters are displayed).  A programmer  initializes  a  color-
+       pair  with  the routine init_pair.  After it has been ini-
+       tialized, COLOR_PAIR(n), a macro  defined  in  <curses.h>,
+       can be used as a new video attribute.
+
+       If  a  terminal  is capable of redefining colors, the pro-
+       grammer can use the routine init_color to change the defi-
+       nition   of   a   color.    The  routines  has_colors  and
+       can_change_color  return  TRUE  or  FALSE,  depending   on
+       whether  the  terminal  has color capabilities and whether
+       the  programmer  can  change  the  colors.   The   routine
+       color_content  allows  a programmer to extract the amounts
+       of red, green,  and  blue  components  in  an  initialized
+       color.   The  routine  pair_content allows a programmer to
+       find out how a given color-pair is currently defined.
+
+   Routine Descriptions
+       The start_color 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 initscr.
+       start_color initializes eight basic  colors  (black,  red,
+       green,  yellow,  blue,  magenta, cyan, and white), and two
+       global variables,  COLORS  and  COLOR_PAIRS  (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.
+
+       pair to be changed, the foreground color number,  and  the
+       background  color number.  The value of the first argument
+       must be between 1 and COLOR_PAIRS-1.   The  value  of  the
+       second  and  third  arguments must be between 0 and COLORS
+       (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  init_color 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 0 and COLORS.  (See the section
+       Colors for the default color index.)   Each  of  the  last
+       three  arguments must be a value between 0 and 1000.  When
+       init_color is used, all occurrences of that color  on  the
+       screen immediately change to the new definition.
+
+       The  has_colors routine requires no arguments.  It returns
+       TRUE if the terminal can manipulate colors; otherwise,  it
+       returns FALSE.  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 can_change_color routine requires  no  arguments.   It
+       returns  TRUE  if  the  terminal  supports  colors and can
+       change their definitions; other, it returns  FALSE.   This
+       routine facilitates writing terminal-independent programs.
+
+       The color_content 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 shorts 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 COLORS.  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  com-
+       ponent).
+
+       The  pair_content  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 shorts for storing the foreground  and  the  background
+       color  numbers.   The  value of the first argument must be
+       between 1 and COLOR_PAIRS-1.  The values that  are  stored
+       at  the addresses pointed to by the second and third argu-
+       ments are between 0 and COLORS.
+
+   Colors
+       is the default background color for all terminals.
+
+             COLOR_BLACK
+             COLOR_RED
+             COLOR_GREEN
+             COLOR_YELLOW
+             COLOR_BLUE
+             COLOR_MAGENTA
+             COLOR_CYAN
+             COLOR_WHITE
+
+
+
+

RETURN VALUE

+       The routines can_change_color()  and  has_colors()  return
+       TRUE or FALSE.
+
+       All other routines return the integer ERR upon failure and
+       an OK (SVr4 specifies only "an integer  value  other  than
+       ERR") upon successful completion.
+
+
+
+

NOTES

+       In  the  ncurses implementation, there is a separate color
+       activation flag, color palette,  color  pairs  table,  and
+       associated  COLORS and COLOR_PAIRS counts for each screen;
+       the start_color 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 curs_bkgd(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 A_BOLD attribute.
+
+       The  A_BLINK  attribute  should  in theory cause the back-
+       ground 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.
+
+
+
+

PORTABILITY

+       This implementation satisfies XSI Curses's  minimum  maxi-
+       mums for COLORS and COLOR_PAIRS.
+       ground   and   background    color    to    support    the
+       use_default_colors extension, but only if that routine has
+       been first invoked.
+
+
+
+

SEE ALSO

+       curses(3X), curs_initscr(3X), curs_attr(3X), dft_fgbg(3X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_delch.3x.html b/Ada95/html/curs_delch.3x.html new file mode 100644 index 00000000..ebc85781 --- /dev/null +++ b/Ada95/html/curs_delch.3x.html @@ -0,0 +1,70 @@ + + +
+       delch,  wdelch, mvdelch, mvwdelch - delete character under
+       the cursor in a curses window
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int delch(void);
+       int wdelch(WINDOW *win);
+       int mvdelch(int y, int x);
+       int mvwdelch(WINDOW *win, int y, int x);
+
+
+
+

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 y, x,  if  specified).   (This
+       does  not  imply use of the hardware delete character fea-
+       ture.)
+
+
+
+

RETURN VALUE

+       All routines return the integer ERR upon failure and an OK
+       (SVr4  specifies  only  "an integer value other than ERR")
+       upon successful completion.
+
+
+
+

NOTES

+       Note that delch, mvdelch, and mvwdelch may be macros.
+
+
+
+

PORTABILITY

+       These functions are described in the XSI Curses  standard,
+       Issue  4.   The standard specifies that they return ERR on
+       failure, but specifies no error conditions.
+
+
+
+

SEE ALSO

+       curses(3X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_deleteln.3x.html b/Ada95/html/curs_deleteln.3x.html new file mode 100644 index 00000000..b0a74abf --- /dev/null +++ b/Ada95/html/curs_deleteln.3x.html @@ -0,0 +1,70 @@ + + +
+       deleteln,  wdeleteln,  insdelln, winsdelln, insertln, win-
+       sertln - delete and insert lines in a curses window
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int deleteln(void);
+       int wdeleteln(WINDOW *win);
+       int insdelln(int n);
+       int winsdelln(WINDOW *win, int n);
+       int insertln(void);
+       int winsertln(WINDOW *win);
+
+
+
+

DESCRIPTION

+       The deleteln and wdeleteln 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  insdelln  and  winsdelln  routines,  for  positive n,
+       insert n lines into the specified window above the current
+       line.   The  n  bottom  lines  are  lost.  For negative n,
+       delete n lines (starting with the one under  the  cursor),
+       and  move  the remaining lines up.  The bottom n lines are
+       cleared.  The current cursor position remains the same.
+
+       The insertln and insertln routines, insert  a  blank  line
+       above the current line and the bottom line is lost.
+
+
+
+

RETURN VALUE

+       All routines return the integer ERR upon failure and an OK
+       (SVr4 specifies only "an integer value  other  than  ERR")
+       upon successful completion.
+
+
+
+

PORTABILITY

+       These  functions are described in the XSI Curses standard,
+       Issue 4.  The standard specifies that they return  ERR  on
+       failure, but specifies no error conditions.
+
+
+
+

NOTES

+       Note that all but winsdelln may be a 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 idlok(..., TRUE) has
+       been set on the current window.
+
+
+
+

SEE ALSO

+       curses(3X)
+
+
+
+
+ + diff --git a/Ada95/html/curs_getch.3x.html b/Ada95/html/curs_getch.3x.html new file mode 100644 index 00000000..a89c96e7 --- /dev/null +++ b/Ada95/html/curs_getch.3x.html @@ -0,0 +1,226 @@ + + +
+       getch,  wgetch,  mvgetch, mvwgetch, ungetch - get (or push
+       back) characters from curses terminal keyboard
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int getch(void);
+       int wgetch(WINDOW *win);
+       int mvgetch(int y, int x);
+       int mvwgetch(WINDOW *win, int y, int x);
+       int ungetch(int ch);
+       int has_key(int ch);
+
+
+
+

DESCRIPTION

+       The getch, wgetch, mvgetch and mvwgetch, routines  read  a
+       character  from the window.  In no-delay mode, if no input
+       is waiting, the value ERR is returned.  In delay mode, the
+       program  waits until the system passes text through to the
+       program.  Depending on the  setting  of  cbreak,  this  is
+       after one character (cbreak mode), or after the first new-
+       line (nocbreak mode).  In  half-delay  mode,  the  program
+       waits  until a character is typed or the specified timeout
+       has been reached.
+
+       If noecho has been set, then the character  will  also  be
+       echoed into the designated window according to the follow-
+       ing rules: If the character is the current  erase  charac-
+       ter,  left  arrow,  or  backspace, the cursor is moved one
+       space to the left and that screen position is erased as if
+       delch  had  been  called.   If  the character value is any
+       other KEY_ define, the user is alerted with a  beep  call.
+       Otherwise the character is simply output to the screen.
+
+       If the window is not a pad, and it has been moved or modi-
+       fied since the last call to  wrefresh,  wrefresh  will  be
+       called before another character is read.
+
+       If  keypad  is  TRUE,  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
+       <curses.h> as macros with  values  outside  the  range  of
+       8-bit  characters  whose  names  begin  with KEY_. 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), curses 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
+
+       The ungetch routine places ch back onto the input queue to
+       be returned by the next call to wgetch.  Note  that  there
+       is, in effect, just one input queue for all windows.
+
+
+   Function Keys
+       The  following function keys, defined in <curses.h>, might
+       be returned by getch if keypad  has  been  enabled.   Note
+       that  not  all  of  these are necessarily supported on any
+       particular terminal.
+
+       center tab(/) ; l l l l .  Name/Key name
+
+       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(n)/T{ For 0 <= n
+       <=   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_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_RESTART/Restart     key     KEY_RESUME/Resume      key
+       KEY_SAVE/Save key KEY_SBEG/Shifted beginning key KEY_SCAN-
+       CEL/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 mes-
+       sage key KEY_SMOVE/Shifted move key KEY_SNEXT/Shifted next
+       key KEY_SOPTIONS/Shifted options key KEY_SPREVIOUS/Shifted
+       KEY_SRIGHT/Shifted right arrow  KEY_SRSUME/Shifted  resume
+       key  KEY_SSAVE/Shifted  save key KEY_SSUSPEND/Shifted sus-
+       pend key KEY_SUNDO/Shifted  undo  key  KEY_SUSPEND/Suspend
+       key KEY_UNDO/Undo key
+
+       Keypad is arranged like this:
+
+       center  allbox  tab(/)  ;  c c c .  A1/up/A3 left/B2/right
+       C1/down/C3
+
+       The has_key routine takes a key value from the above list,
+       and  returns TRUE or FALSE according as the current termi-
+       nal type recognizes a key with that value.
+
+
+
+
+

RETURN VALUE

+       All routines return the integer ERR upon  failure  and  an
+       integer value other than ERR (OK in the case of ungetch())
+       upon successful completion.
+
+
+
+

NOTES

+       Use of the escape key by a programmer for a single charac-
+       ter  function  is discouraged, as it will cause a delay of
+       up to one second while the keypad code looks for a follow-
+       ing function-key sequence.
+
+       When  using  getch, wgetch, mvgetch, or mvwgetch, nocbreak
+       mode (nocbreak) and echo mode (echo) 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 getch, mvgetch, and mvwgetch 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  KEY_UP,
+       KEY_DOWN,   KEY_LEFT,   KEY_RIGHT,   KEY_HOME,    KEY_END,
+       KEY_NPAGE, KEY_PPAGE, and function keys 1 through 12.  The
+       Ins key is usually mapped to KEY_IC.
+
+
+
+

PORTABILITY

+       The *get* functions are described in the XSI Curses  stan-
+       dard,  Issue  4.   They  read single-byte characters only.
+       The standard specifies that they return  ERR  on  failure,
+       but specifies no error conditions.
+
+       The  echo  behavior of these functions on input of KEY_ or
+       backspace characters was not specified in the  SVr4  docu-
+       mentation.   This  description  is  adopted  from  the XSI
+       dled  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
+       read(2)  call in progress or not, and also (in some imple-
+       mentations) 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  getch;  (b) signal receipt interrupts getch and
+       causes it to return ERR with errno set  to  EINTR.   Under
+       the  ncurses  implementation, handled signals never inter-
+       rupt getch.
+
+       The has_key function is unique to ncurses.   We  recommend
+       that  any  code using it be conditionalized on the NCURSES
+       feature macro.
+
+
+
+

SEE ALSO

+       curses(3X),        curs_inopts(3X),         curs_move(3X),
+       curs_refresh(3X).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_getstr.3x.html b/Ada95/html/curs_getstr.3x.html new file mode 100644 index 00000000..9d14eb7c --- /dev/null +++ b/Ada95/html/curs_getstr.3x.html @@ -0,0 +1,122 @@ + + +
+       getstr,  wgetstr,  mvgetstr,  mvwgetstr, wgetnstr - accept
+       character strings from curses terminal keyboard
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int getstr(char *str);
+       int getnstr(char *str, int n);
+       int wgetstr(WINDOW *win, char *str);
+       int mvgetstr(int y, int x, char *str);
+       int mvwgetstr(WINDOW *win, int y, int x, char *str);
+       int mvgetnstr(int y, int x, char *str, int n);
+       int mvwgetnstr(WINDOW *, int y, int x, char *str, int n);
+       int wgetnstr(WINDOW *win, char *str, int n);
+
+
+
+

DESCRIPTION

+       The function getstr is equivalent to a series of calls  to
+       getch, 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 str.
+
+       wgetnstr reads at most n  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 getnstr function  reads
+       from the stdscr default window.
+
+       The  user's erase and kill characters are interpreted.  If
+       keypad  mode  is  on  for   the   window,   KEY_LEFT   and
+       KEY_BACKSPACE are both considered equivalent to the user's
+       kill character.
+
+       Characters input are echoed only if echo is currently  on.
+       In  that case, backspace is echoed as deletion of the pre-
+       vious character (typically a left motion).
+
+
+
+

RETURN VALUE

+       All routines return the integer ERR upon failure and an OK
+       (SVr4  specifies  only  "an integer value other than ERR")
+       upon successful completion.
+
+
+
+

NOTES

+       Note that getstr, mvgetstr, and mvwgetstr may be macros.
+
+
+
+

PORTABILITY

+       These functions are described in the XSI Curses  standard,
+       Issue  4.   They  read  single-byte  characters only.  The
+       standard specifies that they return ERR  on  failure,  but
+       the  single  error  condition  EOVERFLOW  associated  with
+       extended-level conformance is not yet  returned  (the  XSI
+
+       SVr3 and early SVr4 curses implementations did not  reject
+       function keys; the SVr4.0 documentation claimed that "spe-
+       cial keys" (such as function  keys,  "home"  key,  "clear"
+       key,  etc.)  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 getnstr, mvgetnstr, and mvwgetnstr were pre-
+       sent but not documented in SVr4.
+
+
+
+

SEE ALSO

+       curses(3X), curs_getch(3X).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_getyx.3x.html b/Ada95/html/curs_getyx.3x.html new file mode 100644 index 00000000..89231567 --- /dev/null +++ b/Ada95/html/curs_getyx.3x.html @@ -0,0 +1,70 @@ + + +
+       getyx,  getparyx,  getbegyx,  getmaxyx - get curses cursor
+       and window coordinates
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       void getyx(WINDOW *win, int y, int x);
+       void getparyx(WINDOW *win, int y, int x);
+       void getbegyx(WINDOW *win, int y, int x);
+       void getmaxyx(WINDOW *win, int y, int x);
+
+
+
+

DESCRIPTION

+       The getyx macro places the current cursor position of  the
+       given window in the two integer variables y and x.
+
+       If  win  is  a  subwindow,  the  getparyx macro places the
+       beginning coordinates of the  subwindow  relative  to  the
+       parent  window into two integer variables y and x.  Other-
+       wise, -1 is placed into y and x.
+
+       Like getyx, the getbegyx and  getmaxyx  macros  store  the
+       current  beginning  coordinates  and size of the specified
+       window.
+
+
+
+

RETURN VALUE

+       The return values of these  macros  are  undefined  (i.e.,
+       they  should not be used as the right-hand side of assign-
+       ment statements).
+
+
+
+

NOTES

+       All of these interfaces are macros and  that  "&"  is  not
+       necessary before the variables y and x.
+
+
+
+

PORTABILITY

+       These  functions are described in the XSI Curses standard,
+       Issue 4.
+
+
+
+

SEE ALSO

+       curses(3X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_inch.3x.html b/Ada95/html/curs_inch.3x.html new file mode 100644 index 00000000..093f99ad --- /dev/null +++ b/Ada95/html/curs_inch.3x.html @@ -0,0 +1,68 @@ + + +
+       inch,  winch,  mvinch,  mvwinch  -  get  a  character  and
+       attributes from a curses window
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       chtype inch(void);
+       chtype winch(WINDOW *win);
+       chtype mvinch(int y, int x);
+       chtype mvwinch(WINDOW *win, int y, int x);
+
+
+
+

DESCRIPTION

+       These routines return the character, of  type  chtype,  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
+       <curses.h> can be used with the & (logical  AND)  operator
+       to extract the character or attributes alone.
+
+
+   Attributes
+       The  following  bit-masks  may  be  AND-ed with characters
+       returned by winch.
+
+       l  l  .   A_CHARTEXT     Bit-mask  to  extract   character
+       A_ATTRIBUTES   Bit-mask   to  extract  attributes  A_COLOR
+            Bit-mask to extract color-pair field information
+
+
+
+

NOTES

+       Note that all of these routines may be macros.
+
+
+
+

PORTABILITY

+       These functions are described in the XSI Curses  standard,
+       Issue 4.
+
+
+
+

SEE ALSO

+       curses(3X).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_inchstr.3x.html b/Ada95/html/curs_inchstr.3x.html new file mode 100644 index 00000000..c8b5fde8 --- /dev/null +++ b/Ada95/html/curs_inchstr.3x.html @@ -0,0 +1,70 @@ + + +
+       inchstr,   inchnstr,   winchstr,   winchnstr,   mvinchstr,
+       mvinchnstr, mvwinchstr, mvwinchnstr  -  get  a  string  of
+       characters (and attributes) from a curses window
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int inchstr(chtype *chstr);
+       int inchnstr(chtype *chstr, int n);
+       int winchstr(WINDOW *win, chtype *chstr);
+       int winchnstr(WINDOW *win, chtype *chstr, int n);
+       int mvinchstr(int y, int x, chtype *chstr);
+       int mvinchnstr(int y, int x, chtype *chstr, int n);
+       int mvwinchstr(WINDOW *win, int y, int x, chtype *chstr);
+       int  mvwinchnstr(WINDOW *win, int y, int x, chtype *chstr,
+       int n);
+
+
+
+

DESCRIPTION

+       These routines return a NULL-terminated  array  of  chtype
+       quantities, starting at the current cursor position in the
+       named window and ending at the right margin of the window.
+       The  four  functions with n as the last argument, return a
+       leading substring at most n characters long (exclusive  of
+       the  trailing (chtype)0).  Constants defined in <curses.h>
+       can be used with the & (logical AND) operator  to  extract
+       the  character or the attribute alone from any position in
+       the chstr [see curs_inch(3X)].
+
+
+
+

RETURN VALUE

+       All routines return the integer ERR upon  failure  and  an
+       integer  value  other  than ERR upon successful completion
+       (the number of  characters  retrieved,  exclusive  of  the
+       trailing 0).
+
+
+
+

NOTES

+       Note  that  all  routines  except winchnstr may be macros.
+       SVr4 does not document whether the result string is 0-ter-
+       minated; it does not document whether a length limit argu-
+       ment includes any trailing 0; and it does not document the
+       meaning of the return value.
+
+
+
+

PORTABILITY

+       These  functions are described in the XSI Curses standard,
+       Issue 4.  It is no more specific than the SVr4  documenta-
+       tion on the trailing 0.  It does specify that the success-
+       ful return of the functions is OK.
+
+
+
+

SEE ALSO

+       curses(3X), curs_inch(3X).
+
+
+
+
+ + diff --git a/Ada95/html/curs_initscr.3x.html b/Ada95/html/curs_initscr.3x.html new file mode 100644 index 00000000..78d883ab --- /dev/null +++ b/Ada95/html/curs_initscr.3x.html @@ -0,0 +1,122 @@ + + +
+       initscr,  newterm, endwin, isendwin, set_term, delscreen -
+       curses screen initialization and manipulation routines
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       WINDOW *initscr(void);
+       int endwin(void);
+       int isendwin(void);
+       SCREEN  *newterm(const  char  *type,  FILE  *outfd,   FILE
+       *infd);
+       SCREEN *set_term(SCREEN *new);
+       void delscreen(SCREEN* sp);
+
+
+
+

DESCRIPTION

+       initscr  is normally the first curses routine to call when
+       initializing a program.  A few special routines  sometimes
+       need  to  be called before it; these are slk_init, filter,
+       ripoffline, use_env.  For multiple-terminal  applications,
+       newterm may be called before initscr.
+
+       The initscr code determines the terminal type and initial-
+       izes all curses data structures.  initscr also causes  the
+       first  call  to  refresh  to  clear the screen.  If errors
+       occur, initscr writes  an  appropriate  error  message  to
+       standard error and exits; otherwise, a pointer is returned
+       to stdscr.
+
+       A program that outputs to more than  one  terminal  should
+       use  the  newterm  routine  for  each  terminal instead of
+       initscr.  A program that needs to inspect capabilities, so
+       it can continue to run in a line-oriented mode if the ter-
+       minal cannot support a screen-oriented program, would also
+       use  newterm.   The  routine newterm should be called once
+       for each terminal.  It returns a variable of type SCREEN *
+       which  should  be  saved  as a reference to that terminal.
+       The arguments are the type of the terminal to be  used  in
+       place of $TERM, a file pointer for output to the terminal,
+       and another file pointer for input from the  terminal  (if
+       type  is NULL, $TERM will be used).  The program must also
+       call endwin for each terminal being  used  before  exiting
+       from  curses.  If newterm is called more than once for the
+       same terminal, the first terminal referred to must be  the
+       last one for which endwin is called.
+
+       A  program  should  always  call  endwin before exiting or
+       escaping  from  curses  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 refresh or doupdate after
+       a temporary escape causes the  program  to  resume  visual
+       mode.
+       called without any subsequent calls to wrefresh, and FALSE
+       otherwise.
+
+       The  set_term  routine is used to switch between different
+       terminals.  The screen reference new becomes the new  cur-
+       rent  terminal.   The previous terminal is returned by the
+       routine.  This  is  the  only  routine  which  manipulates
+       SCREEN  pointers;  all other routines affect only the cur-
+       rent terminal.
+
+       The delscreen routine frees storage  associated  with  the
+       SCREEN  data  structure.   The  endwin routine does not do
+       this, so delscreen should be called after endwin if a par-
+       ticular SCREEN is no longer needed.
+
+
+
+

RETURN VALUE

+       endwin  returns  the  integer ERR upon failure and OK upon
+       successful completion.
+
+       Routines that return pointers always return NULL on error.
+
+
+
+

NOTES

+       Note that initscr and newterm may be macros.
+
+
+
+

PORTABILITY

+       These  functions are described in the XSI Curses standard,
+       Issue 4.  It specifies that portable applications must not
+       call initscr more than once.
+
+
+
+

SEE ALSO

+       curses(3X),       curs_kernel(3X),       curs_refresh(3X),
+       curs_slk(3X), curs_util(3X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_inopts.3x.html b/Ada95/html/curs_inopts.3x.html new file mode 100644 index 00000000..47eab78c --- /dev/null +++ b/Ada95/html/curs_inopts.3x.html @@ -0,0 +1,226 @@ + + +
+       cbreak, nocbreak, echo, noecho, halfdelay, intrflush, key-
+       pad, meta,  nodelay,  notimeout,  raw,  noraw,  noqiflush,
+       qiflush,  timeout,  wtimeout,  typeahead  -  curses  input
+       options
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int cbreak(void);
+       int nocbreak(void);
+       int echo(void);
+       int noecho(void);
+       int halfdelay(int tenths);
+       int intrflush(WINDOW *win, bool bf);
+       int keypad(WINDOW *win, bool bf);
+       int meta(WINDOW *win, bool bf);
+       int nodelay(WINDOW *win, bool bf);
+       int raw(void);
+       int noraw(void);
+       void noqiflush(void);
+       void qiflush(void);
+       int notimeout(WINDOW *win, bool bf);
+       void timeout(int delay);
+       void wtimeout(WINDOW *win, int delay);
+       int typeahead(int fd);
+
+
+
+

DESCRIPTION

+       Normally, the tty driver buffers typed characters until  a
+       newline  or  carriage return is typed.  The cbreak routine
+       disables line buffering and erase/kill  character-process-
+       ing  (interrupt  and  flow  control  characters  are unaf-
+       fected), making characters typed by the  user  immediately
+       available  to  the  program.  The nocbreak routine returns
+       the terminal to normal (cooked) mode.
+
+       Initially the terminal may or may not be in  cbreak  mode,
+       as the mode is inherited; therefore, a program should call
+       cbreak or nocbreak explicitly.  Most interactive  programs
+       using  curses set the cbreak mode.  Note that cbreak over-
+       rides raw.  [See curs_getch(3X) for a  discussion  of  how
+       these routines interact with echo and noecho.]
+
+       The  echo  and  noecho routines control whether characters
+       typed by the user are echoed by getch as they  are  typed.
+       Echoing  by  the  tty  driver is always disabled, but ini-
+       tially getch 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
+       noecho.  [See curs_getch(3X) for a discussion of how these
+       routines interact with cbreak and nocbreak.]
+
+       user  are  immediately available to the program.  However,
+       after blocking  for  tenths  tenths  of  seconds,  ERR  is
+       returned  if  nothing has been typed.  The value of tenths
+       must be a number between 1 and 255.  Use nocbreak to leave
+       half-delay mode.
+
+       If  the intrflush option is enabled, (bf is TRUE), 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  curses to have the wrong idea of
+       what is on the  screen.   Disabling  (bf  is  FALSE),  the
+       option  prevents the flush.  The default for the option is
+       inherited from the tty driver settings.  The window  argu-
+       ment is ignored.
+
+       The  keypad option enables the keypad of the user's termi-
+       nal.  If enabled (bf is TRUE), the user can press a  func-
+       tion  key (such as an arrow key) and wgetch returns a sin-
+       gle value representing the function key, as  in  KEY_LEFT.
+       If  disabled (bf is FALSE), curses 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 key-
+       pad to be turned on when wgetch 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 meta(win, TRUE); this is equivalent,  under  POSIX,
+       to  setting the CS8 flag on the terminal.  To force 7 bits
+       to be returned, invoke meta(win, FALSE); this  is  equiva-
+       lent,  under  POSIX, to setting the CS8 flag on the termi-
+       nal.  The window argument, win, is always ignored.  If the
+       terminfo capabilities smm (meta_on) and rmm (meta_off) are
+       defined for the terminal, smm is sent to the terminal when
+       meta(win,  TRUE)  is called and rmm is sent when meta(win,
+       FALSE) is called.
+
+       The nodelay option causes getch to be a non-blocking call.
+       If  no input is ready, getch returns ERR.  If disabled (bf
+       is FALSE), getch waits until a key is pressed.
+
+       While interpreting an input escape sequence, wgetch sets a
+       timer  while  waiting  for the next character.  If notime-
+       out(win, TRUE) is called,  then  wgetch  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.
+
+       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 curses.
+
+       When the noqiflush routine is used, normal flush of  input
+       and  output queues associated with the INTR, QUIT and SUSP
+       characters will not be done [see termio(7)].  When qiflush
+       is  called,  the queues will be flushed when these control
+       characters are read.  You may want to call noqiflush()  in
+       a  signal handler if you want output to continue as though
+       the interrupt had not occurred, after the handler exits.
+
+       The timeout and wtimeout routines  set  blocking  or  non-
+       blocking  read  for a given window.  If delay is negative,
+       blocking  read  is  used  (i.e.,  waits  indefinitely  for
+       input).   If delay is zero, then non-blocking read is used
+       (i.e., read returns ERR if no input is waiting).  If delay
+       is  positive, then read blocks for delay milliseconds, and
+       returns ERR if there is still no input.  Hence, these rou-
+       tines  provide the same functionality as nodelay, plus the
+       additional capability of being  able  to  block  for  only
+       delay milliseconds (where delay is positive).
+
+       The  curses 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 refresh or  doupdate
+       is  called again.  This allows faster response to commands
+       typed in advance.  Normally, the input FILE pointer passed
+       to  newterm,  or  stdin in the case that initscr was used,
+       will be used to do this typeahead checking.  The typeahead
+       routine  specifies  that  the  file descriptor fd is to be
+       used to check for typeahead instead.  If fd is -1, then no
+       typeahead checking is done.
+
+
+
+

RETURN VALUE

+       All  routines that return an integer return ERR upon fail-
+       ure and OK (SVr4 specifies only "an  integer  value  other
+       than  ERR")  upon  successful completion, unless otherwise
+       noted in the preceding routine descriptions.
+
+
+
+

PORTABILITY

+       These functions are described in the XSI Curses  standard,
+       Issue 4.
+
+       The  ncurses  library obeys the XPG4 standard and the his-
+       torical 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;
+       ity,  set echo or noecho explicitly just after initializa-
+       tion, even if your program remains in cooked mode.
+
+
+
+

NOTES

+       Note that echo, noecho, halfdelay, intrflush, meta,  node-
+       lay,  notimeout, noqiflush, qiflush, timeout, and wtimeout
+       may be macros.
+
+       The noraw and nocbreak 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.
+
+
+
+

SEE ALSO

+       curses(3X), curs_getch(3X), curs_initscr(3X), termio(7)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_insch.3x.html b/Ada95/html/curs_insch.3x.html new file mode 100644 index 00000000..36b7f32b --- /dev/null +++ b/Ada95/html/curs_insch.3x.html @@ -0,0 +1,70 @@ + + +
+       insch,  winsch,  mvinsch,  mvwinsch  -  insert a character
+       before cursor in a curses window
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int insch(chtype ch);
+       int winsch(WINDOW *win, chtype ch);
+       int mvinsch(int y, int x, chtype ch);
+       int mvwinsch(WINDOW *win, int y, int x, chtype ch);
+
+
+
+

DESCRIPTION

+       These routines, insert the character ch before the charac-
+       ter  under the cursor.  All characters to the right of the
+       cursor are moved one space to the right, with  the  possi-
+       bility  of the rightmost character on the line being lost.
+       The insertion operation does not change the  cursor  posi-
+       tion.
+
+
+
+

RETURN VALUE

+       All  routines that return an integer return ERR upon fail-
+       ure and OK (SVr4 specifies only "an  integer  value  other
+       than  ERR")  upon  successful completion, unless otherwise
+       noted in the preceding routine descriptions.
+
+
+
+

NOTES

+       These routines do not necessarily imply use of a  hardware
+       insert character feature.
+
+       Note that insch, mvinsch, and mvwinsch may be macros.
+
+
+
+

PORTABILITY

+       These  functions are described in the XSI Curses standard,
+       Issue 4.
+
+
+
+

SEE ALSO

+       curses(3X).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_insstr.3x.html b/Ada95/html/curs_insstr.3x.html new file mode 100644 index 00000000..a6fe2b45 --- /dev/null +++ b/Ada95/html/curs_insstr.3x.html @@ -0,0 +1,120 @@ + + +
+       insstr,  insnstr,  winsstr, winsnstr, mvinsstr, mvinsnstr,
+       mvwinsstr, mvwinsnstr - insert string before cursor  in  a
+       curses window
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+       int insstr(const char *str);
+       int insnstr(const char *str, int n);
+       int winsstr(WINDOW *win, const char *str);
+       int winsnstr(WINDOW *win, const char *str, int n);
+       int mvinsstr(int y, int x, const char *str);
+       int mvinsnstr(int y, int x, const char *str, int n);
+       int mvwinsstr(WINDOW *win, int y, int x, const char *str);
+       int mvwinsnstr(WINDOW *win, int y, int x, const char *str,
+       int n);
+
+
+
+

DESCRIPTION

+       These  routines insert a character string (as many charac-
+       ters 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 char-
+       acters  on  the line being lost.  The cursor position does
+       not change (after moving to y, x, if specified). The  four
+       routines with n as the last argument insert a leading sub-
+       string of at most n characters.  If n<=0, then the  entire
+       string is inserted.
+
+       If  a  character in str is a tab, newline, carriage return
+       or backspace, the cursor is moved appropriately within the
+       window.   A  newline  also  does a clrtoeol before moving.
+       Tabs are considered to be at every eighth  column.   If  a
+       character in str is another control character, it is drawn
+       in the ^X notation.  Calling winch after adding a  control
+       character (and moving to it, if necessary) does not return
+       the control character, but instead returns a character  in
+       the the ^-representation of the control character.
+
+
+
+

RETURN VALUE

+       All  routines that return an integer return ERR upon fail-
+       ure and OK (SVr4 specifies only "an  integer  value  other
+       than  ERR")  upon  successful completion, unless otherwise
+       noted in the preceding routine descriptions.
+
+
+
+

NOTES

+       Note that all but winsnstr may be macros.
+
+
+
+

PORTABILITY

+       These functions are described in the XSI Curses  standard,
+       Issue  4,  which  adds  const qualifiers to the arguments.
+       The XSI Curses error  conditions  EILSEQ  and  EILOVERFLOW
+       associated  with  extended-level  conformance  are not yet
+       detected (this implementation does not  yet  support  XPG4
+       curses(3X), curs_clear(3X), curs_inch(3X).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_instr.3x.html b/Ada95/html/curs_instr.3x.html new file mode 100644 index 00000000..487bd07c --- /dev/null +++ b/Ada95/html/curs_instr.3x.html @@ -0,0 +1,70 @@ + + +
+       instr,  innstr, winstr, winnstr, mvinstr, mvinnstr, mvwin-
+       str, mvwinnstr - get a string of characters from a  curses
+       window
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int instr(char *str);
+       int innstr(char *str, int n);
+       int winstr(WINDOW *win, char *str);
+       int winnstr(WINDOW *win, char *str, int n);
+       int mvinstr(int y, int x, char *str);
+       int mvinnstr(int y, int x, char *str, int n);
+       int mvwinstr(WINDOW *win, int y, int x, char *str);
+       int  mvwinnstr(WINDOW  *win,  int y, int x, char *str, int
+       n);
+
+
+
+

DESCRIPTION

+       These routines return  a  string  of  characters  in  str,
+       extracted  starting  at the current cursor position in the
+       named window.  Attributes are stripped  from  the  charac-
+       ters.   The  four  functions  with  n as the last argument
+       return a leading  substring  at  most  n  characters  long
+       (exclusive of the trailing NUL).
+
+
+
+

RETURN VALUE

+       All  of the functions return ERR upon failure, or the num-
+       ber of characters actually read into the string.
+
+
+
+

NOTES

+       Note that all routines except winnstr may be macros.
+
+
+
+

PORTABILITY

+       The XSI Curses error  conditions  EILSEQ  and  EILOVERFLOW
+       associated  with  extended-level  conformance  are not yet
+       detected (this implementation does not  yet  support  XPG4
+       multi-byte  characters).  SVr4 does not document whether a
+       length limit includes or excludes the trailing NUL.
+
+       The ncurses library extends the XSI description by  allow-
+       ing  a  negative value for n.  In this case, the functions
+       return the string ending at the right margin.
+
+
+
+

SEE ALSO

+       curses(3X).
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_kernel.3x.html b/Ada95/html/curs_kernel.3x.html new file mode 100644 index 00000000..82b012f7 --- /dev/null +++ b/Ada95/html/curs_kernel.3x.html @@ -0,0 +1,172 @@ + + +
+       def_prog_mode,       def_shell_mode,      reset_prog_mode,
+       reset_shell_mode, resetty, savetty, getsyx, setsyx, ripof-
+       fline, curs_set, napms - low-level xscurses routines
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int def_prog_mode(void);
+       int def_shell_mode(void);
+       int reset_prog_mode(void);
+       int reset_shell_mode(void);
+       int resetty(void);
+       int savetty(void);
+       void getsyx(int y, int x);
+       void setsyx(int y, int x);
+       int ripoffline(int line, int (*init)(WINDOW *, int));
+       int curs_set(int visibility);
+       int napms(int ms);
+
+
+
+

DESCRIPTION

+       The  following  routines  give low-level access to various
+       curses capabilities.  Theses routines typically  are  used
+       inside library routines.
+
+       The  def_prog_mode  and  def_shell_mode  routines save the
+       current terminal modes as the  "program"  (in  curses)  or
+       "shell"   (not   in   curses)   state   for   use  by  the
+       reset_prog_mode and reset_shell_mode  routines.   This  is
+       done  automatically  by  initscr.   There is one such save
+       area for each screen context allocated by newterm().
+
+       The reset_prog_mode and reset_shell_mode routines  restore
+       the  terminal  to "program" (in curses) or "shell" (out of
+       curses) state.  These are  done  automatically  by  endwin
+       and,  after  an  endwin, by doupdate, so they normally are
+       not called.
+
+       The resetty and savetty  routines  save  and  restore  the
+       state  of  the  terminal modes.  savetty saves the current
+       state in a buffer and resetty restores the state  to  what
+       it was at the last call to savetty.
+
+       The  getsyx routine returns the current coordinates of the
+       virtual screen cursor in y and x.  If leaveok is currently
+       TRUE,  then -1,-1 is returned.  If lines have been removed
+       from the top of the screen,  using  ripoffline,  y  and  x
+       include  these  lines;  therefore,  y and x should be used
+       only as arguments for setsyx.
+
+       The setsyx routine sets the virtual screen cursor to y, x.
+       If y and x are both -1, then leaveok is set.  The two rou-
+       tines getsyx and setsyx are  designed  to  be  used  by  a
+       cursor.   The  library  routine  would  call getsyx at the
+       beginning, do its manipulation of its own  windows,  do  a
+       wnoutrefresh  on  its  windows, call setsyx, and then call
+       doupdate.
+
+       The ripoffline routine provides access to the same  facil-
+       ity  that  slk_init  [see curs_slk(3X)] uses to reduce the
+       size of the screen.   ripoffline  must  be  called  before
+       initscr or newterm is called.  If line is positive, a line
+       is removed from the top of stdscr; if line is negative,  a
+       line is removed from the bottom.  When this is done inside
+       initscr, the routine init (supplied by the user) is called
+       with  two arguments: a window pointer to the one-line win-
+       dow that has been allocated and an integer with the number
+       of columns in the window.  Inside this initialization rou-
+       tine, the integer variables LINES  and  COLS  (defined  in
+       <curses.h>) are not guaranteed to be accurate and wrefresh
+       or doupdate must not be called.  It is allowable  to  call
+       wnoutrefresh during the initialization routine.
+
+       ripoffline  can  be called up to five times before calling
+       initscr or newterm.
+
+       The curs_set routine sets  the  cursor  state  is  set  to
+       invisible, normal, or very visible for visibility equal to
+       0, 1, or 2 respectively.  If  the  terminal  supports  the
+       visibility   requested,   the  previous  cursor  state  is
+       returned; otherwise, ERR is returned.
+
+       The napms routine is used to sleep for ms milliseconds.
+
+
+
+

RETURN VALUE

+       Except for curs_set,  these  routines  always  return  OK.
+       curs_set  returns the previous cursor state, or ERR if the
+       requested visibility is not supported.
+
+
+
+

NOTES

+       Note that getsyx is a macro, so & is not necessary  before
+       the variables y and x.
+
+       The  SVr4 man pages warn that the return value of curs_set
+       "is currently incorrect".   This  implementation  gets  it
+       right, but it may be unwise to count on the correctness of
+       the return value anywhere else.
+
+
+
+

PORTABILITY

+       The functions setsyx and getsyx are not described  in  the
+       XSI  Curses standard, Issue 4.  All other functions are as
+       described in XSI Curses.
+
+       The SVr4 documentation describes setsyx and getsyx as hav-
+       ing  return  type  int.  This  is  misleading, as they are
+       curses(3X),       curs_initscr(3X),      curs_outopts(3X),
+       curs_refresh(3X), curs_scr_dump(3X), curs_slk(3X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_mouse.3x.html b/Ada95/html/curs_mouse.3x.html new file mode 100644 index 00000000..d328f533 --- /dev/null +++ b/Ada95/html/curs_mouse.3x.html @@ -0,0 +1,174 @@ + + +
+       getmouse,  ungetmouse, mousemask - mouse interface through
+       curses
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       typedef unsigned long mmask_t;
+
+       typedef struct
+       {
+           short id;         /* ID to distinguish multiple devices */
+           int x, y, z;      /* event coordinates */
+           mmask_t bstate;   /* button state bits */
+       }
+       MEVENT;
+       int getmouse(MEVENT *event);
+       int ungetmouse(MEVENT *event);
+       mmask_t mousemask(mmask_t newmask, mmask_t *oldmask);
+       bool wenclose(WINDOW *win, int y, int x)
+       int mouseinterval(int erval)
+
+
+
+

DESCRIPTION

+       These functions provide an interface to mouse events  from
+       ncurses(3x).   Mouse  events  are represented by KEY_MOUSE
+       pseudo-key values in the wgetch input stream.
+
+       To make mouse events visible, use the mousemask  function.
+       This  will  set  the  mouse  events  to  be  reported.  By
+       default, no mouse events are reported.  The function  will
+       return  a  mask  to  indicate which of the specified mouse
+       events can be reported; on complete failure it returns  0.
+       If  oldmask is non-NULL, this function fills the indicated
+       location with the previous value  of  the  given  window's
+       mouse event mask.
+
+       As  a  side  effect, setting a zero mousemask may turn off
+       the mouse pointer; setting a nonzero mask may turn it  on.
+       Whether this happens is device-dependent.
+
+       Here are the mouse event type masks:
+
+       l  l  _ _ l l.  Name Description BUTTON1_PRESSED     mouse
+       button 1 down BUTTON1_RELEASED    mouse button 1  up  BUT-
+       TON1_CLICKED        mouse       button      1      clicked
+       BUTTON1_DOUBLE_CLICKED   mouse  button  1  double  clicked
+       BUTTON1_TRIPLE_CLICKED   mouse  button  1  triple  clicked
+       BUTTON2_PRESSED       mouse      button       2       down
+       BUTTON2_RELEASED    mouse   button  2  up  BUTTON2_CLICKED
+           mouse button 2 clicked  BUTTON2_DOUBLE_CLICKED   mouse
+       button  2  double  clicked  BUTTON2_TRIPLE_CLICKED   mouse
+       button 2 triple clicked BUTTON3_PRESSED     mouse button 3
+       down BUTTON3_RELEASED    mouse button 3 up BUTTON3_CLICKED
+       button 3 triple clicked BUTTON4_PRESSED     mouse button 4
+       down BUTTON4_RELEASED    mouse button 4 up BUTTON4_CLICKED
+           mouse button 4 clicked  BUTTON4_DOUBLE_CLICKED   mouse
+       button  4  double  clicked  BUTTON4_TRIPLE_CLICKED   mouse
+       button 4 triple clicked BUTTON_SHIFT   shift was down dur-
+       ing  button  state  change BUTTON_CTRL    control was down
+       during button state  change  BUTTON_ALT     alt  was  down
+       during  button state change ALL_MOUSE_EVENTS    report all
+       button state changes REPORT_MOUSE_POSITION    report mouse
+       movement
+
+       Once  a  class of mouse events have been made visible in a
+       window, calling the wgetch function  on  that  window  may
+       return  KEY_MOUSE  as  an indicator that a mouse event has
+       been queued.  To read the event data and pop the event off
+       the queue, call getmouse.  This function will return OK if
+       a mouse event is actually visible in the given window, ERR
+       otherwise.   When  getmouse returns OK, the data deposited
+       as y and x in the  event  structure  coordinates  will  be
+       screen-relative  character-cell coordinates.  The returned
+       state mask will have exactly one bit set to  indicate  the
+       event type.
+
+       The  ungetmouse  function  behaves analogously to ungetch.
+       It pushes a KEY_MOUSE event  onto  the  input  queue,  and
+       associates  with  that  event  the  given  state  data and
+       screen-relative character-cell coordinates.
+
+       The wenclose  function  tests  whether  a  given  pair  of
+       screen-relative  character-cell coordinates is enclosed by
+       a given window, returning TRUE if it is and  FALSE  other-
+       wise.   It  is  useful  for determining what subset of the
+       screen windows enclose the location of a mouse event.
+
+       The mouseinterval function sets the maximum time (in thou-
+       sands  of  a  second)  that  can  elapse between press and
+       release events in order for them to  be  recognized  as  a
+       click.  This function returns the previous interval value.
+       The default is one fifth of a second.
+
+       Note that mouse events will be ignored when  input  is  in
+       cooked mode, and will cause an error beep when cooked mode
+       is being simulated in a window by a function such as  get-
+       str that expects a linefeed for input-loop termination.
+
+
+
+
+

RETURN VALUE

+       All  routines  return  the  integer ERR upon failure or OK
+       upon successful completion.
+
+
+
+

PORTABILITY

+       These calls were designed for  ncurses(3x),  and  are  not
+
+       The feature macro NCURSES_MOUSE_VERSION is provided so the
+       preprocessor  can  be  used to test whether these features
+       are present (its value is 1).   NOTE:  THIS  INTERFACE  IS
+       EXPERIMENTAL  AND IS SUBJECT TO CHANGE WITHOUT NOTICE!  If
+       the interface is changed, the value of  NCURSES_MOUSE_VER-
+       SION will be incremented.
+
+       The  order  of the MEVENT structure members is not guaran-
+       teed.  Additional fields may be added to the structure  in
+       the future.
+
+       Under  ncurses(3x),  these  calls  are  implemented  using
+       either xterm's built-in mouse-tracking API  or  Alessandro
+       Rubini's  gpm  server.   If  you are using something other
+       than xterm there is no gpm daemon running on your machine,
+       mouse  events  will not be visible to ncurses(3x) (and the
+       wmousemask function will always return 0).
+
+       The z member in the event structure is not presently used.
+       It  is  intended  for use with touch screens (which may be
+       pressure-sensitive)   or   with   3D-mice/trackballs/power
+       gloves.
+
+
+
+

BUGS

+       Mouse  events under xterm will not in fact be ignored dur-
+       ing cooked mode, if they have been enabled by  wmousemask.
+       Instead,  the  xterm  mouse report sequence will appear in
+       the string read.
+
+       Mouse events under xterm will not be detected correctly in
+       a window with its keypad bit off.
+
+
+
+

SEE ALSO

+       curses(3X).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_move.3x.html b/Ada95/html/curs_move.3x.html new file mode 100644 index 00000000..4edbae80 --- /dev/null +++ b/Ada95/html/curs_move.3x.html @@ -0,0 +1,70 @@ + + +
+       move, wmove - move curses window cursor
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int move(int y, int x);
+       int wmove(WINDOW *win, int y, int x);
+
+
+
+

DESCRIPTION

+       These  routines move the cursor associated with the window
+       to line y and column x.  This routine does  not  move  the
+       physical  cursor  of the terminal until refresh is called.
+       The position specified is relative to the upper  left-hand
+       corner of the window, which is (0,0).
+
+
+
+

RETURN VALUE

+       These routines return ERR upon failure and OK (SVr4 speci-
+       fies only "an integer value other than ERR") upon success-
+       ful completion.
+
+
+
+

NOTES

+       Note that move may be a macro.
+
+
+
+

PORTABILITY

+       These  functions are described in the XSI Curses standard,
+       Issue 4.  The standard specifies that if (y,x) is within a
+       multi-column  character,  the cursor is moved to the first
+       column of that  character;  however,  this  implementation
+       does  not  yet  support  the extended-level XSI multi-byte
+       characters.
+
+
+
+

SEE ALSO

+       curses(3X), curs_refresh(3X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_outopts.3x.html b/Ada95/html/curs_outopts.3x.html new file mode 100644 index 00000000..54e8aa71 --- /dev/null +++ b/Ada95/html/curs_outopts.3x.html @@ -0,0 +1,172 @@ + + +
+       clearok,   idlok,   idcok   immedok,  leaveok,  setscrreg,
+       wsetscrreg, scrollok, nl, nonl - curses output options
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int clearok(WINDOW *win, bool bf);
+       int idlok(WINDOW *win, bool bf);
+       void idcok(WINDOW *win, bool bf);
+       void immedok(WINDOW *win, bool bf);
+       int leaveok(WINDOW *win, bool bf);
+       int setscrreg(int top, int bot);
+       int wsetscrreg(WINDOW *win, int top, int bot);
+       int scrollok(WINDOW *win, bool bf);
+       int nl(void);
+       int nonl(void);
+
+
+
+

DESCRIPTION

+       These routines set options that change the style of output
+       within  curses.   All  options are initially FALSE, unless
+       otherwise stated.  It  is  not  necessary  to  turn  these
+       options off before calling endwin.
+
+       If  clearok is called with TRUE as argument, the next call
+       to wrefresh with this window will clear  the  screen  com-
+       pletely  and  redraw the entire screen from scratch.  This
+       is useful when the contents of the screen  are  uncertain,
+       or  in  some  cases for a more pleasing visual effect.  If
+       the win argument to clearok is the global variable curscr,
+       the  next  call  to  wrefresh  with  any window causes the
+       screen to be cleared and repainted from scratch.
+
+       If idlok is called with TRUE as  second  argument,  curses
+       considers using the hardware insert/delete line feature of
+       terminals so equipped.  Calling idlok with FALSE as second
+       argument  disables  use  of  line  insertion and deletion.
+       This option should be  enabled  only  if  the  application
+       needs  insert/delete  line, for example, for a screen edi-
+       tor.  It is disabled by default because insert/delete line
+       tends  to  be  visually annoying when used in applications
+       where it isn't really needed.  If insert/delete line  can-
+       not  be  used,  curses redraws the changed portions of all
+       lines.
+
+       If idcok is called with FALSE as second  argument,  curses
+       no longer considers using the hardware insert/delete char-
+       acter feature of terminals so equipped.  Use of  character
+       insert/delete  is  enabled by default.  Calling idcok with
+       TRUE as second argument re-enables use of character inser-
+       tion and deletion.
+
+       If  immedok is called with TRUE as argument, any change in
+       fresh.  However, it may degrade performance  considerably,
+       due  to  repeated  calls  to  wrefresh.  It is disabled by
+       default.
+
+       Normally, the hardware cursor is left at the  location  of
+       the  window  cursor  being  refreshed.  The leaveok option
+       allows the cursor to be left wherever the  update  happens
+       to leave it.  It is useful for applications where the cur-
+       sor is not used, since it  reduces  the  need  for  cursor
+       motions.   If  possible, the cursor is made invisible when
+       this option is enabled.
+
+       The setscrreg and wsetscrreg routines allow  the  applica-
+       tion  programmer  to  set a software scrolling region in a
+       window.  top and bot are the line numbers of the  top  and
+       bottom margin of the scrolling region.  (Line 0 is the top
+       line of the window.)  If  this  option  and  scrollok  are
+       enabled,  an  attempt  to  move off the bottom margin line
+       causes all lines in the scrolling  region  to  scroll  one
+       line in the direction of the first line.  Only the text of
+       the window is scrolled.  (Note that this has nothing to do
+       with  the use of a physical scrolling region capability in
+       the terminal, like that in the VT100.  If idlok is enabled
+       and   the  terminal  has  either  a  scrolling  region  or
+       insert/delete line capability, they will probably be  used
+       by the output routines.)
+
+       The  scrollok option controls what happens when the cursor
+       of a window is  moved  off  the  edge  of  the  window  or
+       scrolling  region,  either as a result of a newline action
+       on the bottom line, or typing the last  character  of  the
+       last line.  If disabled, (bf is FALSE), the cursor is left
+       on the bottom line.  If enabled, (bf is TRUE), the  window
+       is  scrolled  up  one  line (Note that in order to get the
+       physical scrolling effect on the terminal, it is also nec-
+       essary to call idlok).
+
+       The  nl  and  nonl routines control whether the underlying
+       display device translates the return key into  newline  on
+       input,  and  whether it translates newline into return and
+       line-feed on output (in either case,  the  call  addch('0)
+       does the equivalent of return and line feed on the virtual
+       screen).  Initially, these translations do occur.  If  you
+       disable  them using nonl, curses will be able to make bet-
+       ter use of the line-feed capability, resulting  in  faster
+       cursor  motion.   Also, curses will then be able to detect
+       the return key.
+
+
+
+

RETURN VALUE

+       The functions setscrreg and wsetscrreg return OK upon suc-
+       cess  and ERR upon failure. All other routines that return
+       an integer always return OK.
+       These functions are described in the XSI Curses  standard,
+       Issue 4.
+
+       The  XSI  Curses  standard is ambiguous on the question of
+       whether raw() should disable the  CRLF  translations  con-
+       trolled by nl() and nonl().  BSD curses did turn off these
+       translations; AT&T curses (at least as late as  SVr1)  did
+       not.   We choose to do so, on the theory that a programmer
+       requesting raw input wants a clean (ideally  8-bit  clean)
+       connection that the operating system does not mess with.
+
+       Some  historic  curses  implementations had, as an undocu-
+       mented feature,  the  ability  to  do  the  equivalent  of
+       clearok(...,  1)  by saying touchwin(stdscr) or clear(std-
+       scr).  This will not work under ncurses.
+
+       Earlier System V  curses  implementations  specified  that
+       with  scrollok enabled, any window modification triggering
+       a scroll also forced a physical refresh.  XSI Curses  does
+       not  require this, and ncurses avoids doing it in order to
+       perform better vertical-motion  optimization  at  wrefresh
+       time.
+
+
+
+

NOTES

+       Note  that clearok, leaveok, scrollok, idcok, nl, nonl and
+       setscrreg may be macros.
+
+       The immedok routine is useful for windows that are used as
+       terminal emulators.
+
+
+
+

SEE ALSO

+       curses(3X),         curs_addch(3X),        curs_clear(3X),
+       curs_initscr(3X), curs_scroll(3X), curs_refresh(3X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_overlay.3x.html b/Ada95/html/curs_overlay.3x.html new file mode 100644 index 00000000..4c892d66 --- /dev/null +++ b/Ada95/html/curs_overlay.3x.html @@ -0,0 +1,70 @@ + + +
+       overlay, overwrite, copywin - overlay and manipulate over-
+       lapped curses windows
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int overlay(const WINDOW *srcwin, WINDOW *dstwin);
+       int overwrite(const WINDOW *srcwin, WINDOW *dstwin);
+       int copywin(WINDOW *srcwin, WINDOW *dstwin, int sminrow,
+             int smincol, int dminrow, int dmincol, int dmaxrow,
+             int dmaxcol, int overlay);
+
+
+
+

DESCRIPTION

+       The overlay and overwrite routines overlay srcwin  on  top
+       of  dstwin.   scrwin and dstwin are not required to be the
+       same size; only text where  the  two  windows  overlap  is
+       copied.  The difference is that overlay is non-destructive
+       (blanks are not copied) whereas overwrite is  destructive.
+
+       The  copywin  routine provides a finer granularity of con-
+       trol over the overlay and overwrite routines.  Like in the
+       prefresh routine, a rectangle is specified in the destina-
+       tion window, (dminrow, dmincol)  and  (dmaxrow,  dmaxcol),
+       and  the  upper-left-corner coordinates of the source win-
+       dow, (sminrow, smincol).  If the argument overlay is true,
+       then copying is non-destructive, as in overlay.
+
+
+
+

RETURN VALUE

+       Routines  that  return an integer return ERR upon failure,
+       and OK (SVr4 only specifies "an integer value  other  than
+       ERR") upon successful completion.
+
+
+
+

NOTES

+       Note that overlay and overwrite may be macros.
+
+
+
+

PORTABILITY

+       The XSI Curses standard, Issue 4 describes these functions
+       (adding the const qualifiers).  It further specifies their
+       behavior  in  the  presence  of characters with multi-byte
+       renditions (not yet supported in this implementation).
+
+
+
+

SEE ALSO

+       curses(3X), curs_pad(3X), curs_refresh(3X)
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_pad.3x.html b/Ada95/html/curs_pad.3x.html new file mode 100644 index 00000000..721b8ed9 --- /dev/null +++ b/Ada95/html/curs_pad.3x.html @@ -0,0 +1,122 @@ + + +
+       newpad, subpad, prefresh, pnoutrefresh, pechochar - create
+       and display curses pads
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       WINDOW *newpad(int nlines, int ncols);
+       WINDOW *subpad(WINDOW *orig, int nlines, int ncols,
+             int begin_y, int begin_x);
+       int prefresh(WINDOW *pad, int pminrow, int pmincol,
+             int sminrow, int smincol, int smaxrow, int smaxcol);
+       int pnoutrefresh(WINDOW *pad, int pminrow, int pmincol,
+             int sminrow, int smincol, int smaxrow, int smaxcol);
+       int pechochar(WINDOW *pad, chtype ch);
+
+
+
+

DESCRIPTION

+       The newpad routine creates and returns a pointer to a  new
+       pad data structure with the given number of lines, nlines,
+       and columns, ncols.  A pad is like a window,  except  that
+       it is not restricted by the screen size, and is not neces-
+       sarily associated with a particular part  of  the  screen.
+       Pads can be used when a large window is needed, and only a
+       part of the window will be on  the  screen  at  one  time.
+       Automatic refreshes of pads (e.g., from scrolling or echo-
+       ing of input) do not occur.  It is not legal to call  wre-
+       fresh  with a pad as an argument; the routines prefresh or
+       pnoutrefresh should be called instead.   Note  that  these
+       routines require additional parameters to specify the part
+       of the pad to be displayed and the location on the  screen
+       to be used for the display.
+
+       The subpad routine creates and returns a pointer to a sub-
+       window within a  pad  with  the  given  number  of  lines,
+       nlines,  and  columns,  ncols.   Unlike subwin, which uses
+       screen coordinates, the window is  at  position  (begin_x,
+       begin_y)  on the pad.  The window is made in the middle of
+       the window orig, so that changes made to one window affect
+       both  windows.   During  the  use of this routine, it will
+       often be necessary to call touchwin or touchline  on  orig
+       before calling prefresh.
+
+       The  prefresh  and  pnoutrefresh routines are analogous to
+       wrefresh and wnoutrefresh except that they relate to  pads
+       instead  of windows.  The additional parameters are needed
+       to indicate what part of the pad and screen are  involved.
+       pminrow  and pmincol specify the upper left-hand corner of
+       the rectangle to be displayed in the pad.  sminrow,  smin-
+       col, smaxrow, and smaxcol specify the edges of the rectan-
+       gle to be displayed on the screen.  The  lower  right-hand
+       corner of the rectangle to be displayed in the pad is cal-
+       culated from the screen coordinates, since the  rectangles
+       must  be  the same size.  Both rectangles must be entirely
+       treated as if they were zero.
+
+       The pechochar routine is functionally equivalent to a call
+       to  addch  followed by a call to refresh, a call to waddch
+       followed by a call to wrefresh, or a call to  waddch  fol-
+       lowed  by  a  call  to prefresh. The knowledge that only a
+       single character is being output is taken into  considera-
+       tion  and, for non-control characters, a considerable per-
+       formance gain  might  be  seen  by  using  these  routines
+       instead  of  their equivalents.  In the case of pechochar,
+       the last location of the pad on the screen is  reused  for
+       the arguments to prefresh.
+
+
+
+

RETURN VALUE

+       Routines  that  return  an integer return ERR upon failure
+       and OK (SVr4 only specifies "an integer value  other  than
+       ERR") upon successful completion.
+
+       Routines  that  return  pointers return NULL on error, and
+       set errno to ENOMEM.
+
+
+
+

NOTES

+       Note that pechochar may be a macro.
+
+
+
+

PORTABILITY

+       The XSI Curses standard, Issue  4  describes  these  func-
+       tions.
+
+
+
+

SEE ALSO

+       curses(3X),        curs_refresh(3X),       curs_touch(3X),
+       curs_addch(3X).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_print.3x.html b/Ada95/html/curs_print.3x.html new file mode 100644 index 00000000..fcf16ee0 --- /dev/null +++ b/Ada95/html/curs_print.3x.html @@ -0,0 +1,70 @@ + + +
+       mcprint - ship binary data to printer
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int mcprint(char *data, int len);
+
+
+
+

DESCRIPTION

+       This  function  uses the mc5p or mc4 and mc5 capabilities,
+       if they are present, to  ship  given  data  to  a  printer
+       attached to the terminal.
+
+       Note  that  the mcprint code has no way to do flow control
+       with the printer or to know how  much  buffering  it  has.
+       Your  application  is  responsible for keeping the rate of
+       writes to the printer below its continuous throughput rate
+       (typically  about  half  of its nominal cps rating).  Dot-
+       matrix printers and 6-page-per-minute lasers can typically
+       handle  80cps,  so a good conservative rule of thumb is to
+       sleep for a second after shipping each 80-character  line.
+
+
+
+
+

RETURN VALUE

+       The  mcprint  function  returns ERR if the write operation
+       aborted for some reason.  In this case, errno will contain
+       either  an  error  associated  with write(2) or one of the
+       following:
+
+       ENODEV
+            Capabilities for printer redirection don't exist.
+
+       ENOMEM
+            Couldn't allocate sufficient  memory  to  buffer  the
+            printer write.
+
+            When mcprint succeeds, it returns the number of char-
+            acters actually sent to the printer.
+
+
+
+

PORTABILITY

+       The mcprint call was designed for ncurses(3x), and is  not
+       found in SVr4 curses, 4.4BSD curses, or any other previous
+       version of curses.
+
+
+
+

BUGS

+       Padding in the mc5p, mc4 and mc5 capabilities will not  be
+       interpreted.
+
+
+
+

SEE ALSO

+       curses(3X)
+
+
+
+
+ + diff --git a/Ada95/html/curs_printw.3x.html b/Ada95/html/curs_printw.3x.html new file mode 100644 index 00000000..899d9741 --- /dev/null +++ b/Ada95/html/curs_printw.3x.html @@ -0,0 +1,68 @@ + + +
+       printw,  wprintw,  mvprintw,  mvwprintw,  vwprintw - print
+       formatted output in curses windows
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int printw(char *fmt [, arg] ...);
+       int wprintw(WINDOW *win, char *fmt [, arg] ...);
+       int mvprintw(int y, int x, char *fmt [, arg] ...);
+       int mvwprintw(WINDOW *win, int y, int x,
+             char *fmt [, arg] ...);
+
+       #include <varargs.h>
+       int vwprintw(WINDOW *win, char *fmt, varglist);
+
+
+
+

DESCRIPTION

+       The printw, wprintw, mvprintw and mvwprintw  routines  are
+       analogous  to  printf  [see  printf(3S)].   In effect, the
+       string that would be output by printf is output instead as
+       though waddstr were used on the given window.
+
+       The   vwprintw   routine  is  analogous  to  vprintf  [see
+       printf(3S)] and performs a wprintw using a variable  argu-
+       ment  list.  The third argument is a va_list, a pointer to
+       a list of arguments, as defined in <varargs.h>.
+
+
+
+

RETURN VALUE

+       Routines that return an integer return  ERR  upon  failure
+       and  OK  (SVr4 only specifies "an integer value other than
+       ERR") upon successful completion.
+
+
+
+

PORTABILITY

+       The XSI Curses standard, Issue  4  describes  these  func-
+       tions.   The  function vwprintw is marked TO BE WITHDRAWN,
+       and is to be replaced by a function  vw_printw  using  the
+       <stdarg.h> interface.
+
+
+
+

SEE ALSO

+       curses(3X), printf(3S), vprintf(3S)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_refresh.3x.html b/Ada95/html/curs_refresh.3x.html new file mode 100644 index 00000000..ff6d9a33 --- /dev/null +++ b/Ada95/html/curs_refresh.3x.html @@ -0,0 +1,122 @@ + + +
+       refresh, wrefresh, wnoutrefresh, doupdate, redrawwin, wre-
+       drawln - refresh curses windows and lines
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int refresh(void);
+       int wrefresh(WINDOW *win);
+       int wnoutrefresh(WINDOW *win);
+       int doupdate(void);
+       int redrawwin(WINDOW *win);
+       int wredrawln(WINDOW *win, int beg_line, int num_lines);
+
+
+
+

DESCRIPTION

+       The refresh and wrefresh  routines  (or  wnoutrefresh  and
+       doupdate)  must be called to get actual output to the ter-
+       minal, as other routines  merely  manipulate  data  struc-
+       tures.   The  routine  wrefresh copies the named window to
+       the physical terminal screen, taking into account what  is
+       already  there  in order to do optimizations.  The refresh
+       routine is the same, using stdscr as the  default  window.
+       Unless  leaveok  has  been enabled, the physical cursor of
+       the terminal is left at the location  of  the  cursor  for
+       that window.
+
+       The  wnoutrefresh  and  doupdate  routines  allow multiple
+       updates with more  efficiency  than  wrefresh  alone.   In
+       addition  to  all  the window structures, curses keeps two
+       data structures representing the terminal screen: a physi-
+       cal screen, describing what is actually on the screen, and
+       a virtual screen, describing what the programmer wants  to
+       have on the screen.
+
+       The  routine wrefresh works by first calling wnoutrefresh,
+       which copies the named window to the virtual  screen,  and
+       then  calling  doupdate, which compares the virtual screen
+       to the physical screen and does the actual update.  If the
+       programmer  wishes  to  output  several windows at once, a
+       series of calls to wrefresh results in  alternating  calls
+       to  wnoutrefresh  and  doupdate, causing several bursts of
+       output to the screen.  By first calling  wnoutrefresh  for
+       each  window,  it  is then possible to call doupdate once,
+       resulting in only one burst of output,  with  fewer  total
+       characters transmitted and less CPU time used.  If the win
+       argument to wrefresh is the global  variable  curscr,  the
+       screen  is immediately cleared and repainted from scratch.
+
+       The phrase "copies the named window to the virtual screen"
+       above  is  ambiguous.   What  actually happens is that all
+       touched (changed) lines in the window are  copied  to  the
+       virtual  screen.   This affects programs that use overlap-
+       ping windows; it means that if two  windows  overlap,  you
+       see  the  section on PORTABILITY below for a warning about
+       exploiting this behavior.)
+
+       The wredrawln routine indicates to curses that some screen
+       lines  are corrupted and should be thrown away before any-
+       thing is written over them it touches the indicated  lines
+       (marking  them changed) then does a refresh of the window.
+       The routine redrawwin() touches the entire window and then
+       refreshes it.
+
+
+
+

RETURN VALUE

+       Routines  that  return an integer return ERR upon failure,
+       and OK (SVr4 only specifies "an integer value  other  than
+       ERR") upon successful completion.
+
+
+
+

NOTES

+       Note that refresh and redrawwin may be macros.
+
+
+
+

PORTABILITY

+       The  XSI  Curses  standard,  Issue 4 describes these func-
+       tions.
+
+       Whether wnoutrefresh() copies to the  virtual  screen  the
+       entire  contents  of a window or just its changed portions
+       has never been well-documented in historic curses versions
+       (including  SVr4).   It  might be unwise to rely on either
+       behavior in programs that might have  to  be  linked  with
+       other  curses  implementations.   Instead,  you  can do an
+       explicit touchwin()  before  the  wnoutrefresh()  call  to
+       guarantee an entire-contents copy anywhere.
+
+
+
+

SEE ALSO

+       curses(3X), curs_outopts(3X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_scanw.3x.html b/Ada95/html/curs_scanw.3x.html new file mode 100644 index 00000000..c15106f6 --- /dev/null +++ b/Ada95/html/curs_scanw.3x.html @@ -0,0 +1,68 @@ + + +
+       scanw,  wscanw,  mvscanw, mvwscanw, vwscanw - convert for-
+       matted input from a curses widow
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int scanw(char *fmt [, arg] ...);
+       int wscanw(WINDOW *win, char *fmt [, arg] ...);
+       int mvscanw(int y, int x, char *fmt [, arg] ...);
+       int mvwscanw(WINDOW *win, int y, int x,
+             char *fmt [, arg] ...);
+       int vwscanw(WINDOW *win, char *fmt, va_list varglist);
+
+
+
+

DESCRIPTION

+       The scanw, wscanw and mvscanw routines  are  analogous  to
+       scanf [see scanf(3S)].  The effect of these routines is as
+       though wgetstr were called on the window, and the  result-
+       ing line used as input for sscanf(3).  Fields which do not
+       map to a variable in the fmt field are lost.
+
+       The vwscanw routine is similar to vwprintw in that it per-
+       forms  a wscanw using a variable argument list.  The third
+       argument is a va_list, a pointer to a list  of  arguments,
+       as defined in <varargs.h>.
+
+
+
+

RETURN VALUE

+       vwscanw returns ERR on failure and an integer equal to the
+       number of fields scanned on success.
+
+       Applications may use the  return  value  from  the  scanw,
+       wscanw,  mvscanw  and  mvwscanw  routines to determine the
+       number of fields which were mapped in the call.
+
+
+
+

PORTABILITY

+       The XSI Curses standard, Issue  4  describes  these  func-
+       tions.   The  function  vwscanw is marked TO BE WITHDRAWN,
+       and is to be replaced by a  function  vw_scanw  using  the
+       <stdarg.h> interface.
+
+
+
+

SEE ALSO

+       curses(3X), curs_getstr, curs_printw, scanf(3S)
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_scr_dmp.3x.html b/Ada95/html/curs_scr_dmp.3x.html new file mode 100644 index 00000000..5565d235 --- /dev/null +++ b/Ada95/html/curs_scr_dmp.3x.html @@ -0,0 +1,122 @@ + + +
+       scr_dump,  scr_restore, scr_init, scr_set - read (write) a
+       curses screen from (to) a file
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int scr_dump(const char *filename);
+       int scr_restore(const char *filename);
+       int scr_init(const char *filename);
+       int scr_set(const char *filename);
+
+
+
+

DESCRIPTION

+       The scr_dump routine dumps the  current  contents  of  the
+       virtual screen to the file filename.
+
+       The  scr_restore  routine  sets  the virtual screen to the
+       contents of filename, which must have been  written  using
+       scr_dump.   The  next call to doupdate restores the screen
+       to the way it looked in the dump file.
+
+       The scr_init routine reads in the contents of filename and
+       uses  them  to initialize the curses data structures about
+       what the terminal currently has on  its  screen.   If  the
+       data  is  determined  to  be  valid, curses bases its next
+       update of the  screen  on  this  information  rather  than
+       clearing  the  screen and starting from scratch.  scr_init
+       is used after initscr or  a  system  [see  system(BA_LIB)]
+       call  to  share  the screen with another process which has
+       done a scr_dump  after  its  endwin  call.   The  data  is
+       declared  invalid  if  the terminfo capabilities rmcup and
+       nrrmc exist; also if the  terminal  has  been  written  to
+       since the preceding scr_dump call.
+
+       The  scr_set  routine  is a combination of scr_restore and
+       scr_init.  It tells the program that  the  information  in
+       filename is what is currently on the screen, and also what
+       the program wants on the screen.  This can be  thought  of
+       as a screen inheritance function.
+
+       To  read (write) a window from (to) a file, use the getwin
+       and putwin routines [see curs_util(3X)].
+
+
+
+

RETURN VALUE

+       All routines return the integer ERR upon  failure  and  OK
+       upon success.
+
+
+
+

NOTES

+       Note  that  scr_init,  scr_set,  and  scr_restore  may  be
+       macros.
+
+
+
+

PORTABILITY

+       The XSI Curses standard, Issue 4,  describes  these  func-
+       is also considered invalid "if the time-stamp of  the  tty
+       is old" but don't define "old".
+
+
+
+

SEE ALSO

+       curses(3X),       curs_initscr(3X),      curs_refresh(3X),
+       curs_util(3X), system(3S)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_scroll.3x.html b/Ada95/html/curs_scroll.3x.html new file mode 100644 index 00000000..9c3ebe7f --- /dev/null +++ b/Ada95/html/curs_scroll.3x.html @@ -0,0 +1,70 @@ + + +
+       scroll, srcl, wscrl - scroll a curses window
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int scroll(WINDOW *win);
+       int scrl(int n);
+       int wscrl(WINDOW *win, int n);
+
+
+
+

DESCRIPTION

+       The  scroll  routine scrolls the window up one line.  This
+       involves moving the lines in the  window  data  structure.
+       As  an optimization, if the scrolling region of the window
+       is the entire screen, the physical screen may be  scrolled
+       at the same time.
+
+       For  positive  n,  the  scrl and wscrl routines scroll the
+       window up n lines (line i+n becomes i);  otherwise  scroll
+       the  window  down n lines.  This involves moving the lines
+       in the window character image structure.  The current cur-
+       sor position is not changed.
+
+       For these functions to work, scrolling must be enabled via
+       scrollok.
+
+
+
+

RETURN VALUE

+       These routines return ERR upon failure, and OK (SVr4  only
+       specifies "an integer value other than ERR") upon success-
+       ful completion.
+
+
+
+

NOTES

+       Note that scrl and scroll may be macros.
+
+       The SVr4 documentation says that the optimization of phys-
+       ically  scrolling  immediately if the scroll region is the
+       entire screen "is"  performed,  not  "may  be"  performed.
+       This  implementation  deliberately does not guarantee that
+       this will occur, in order to leave open the possibility of
+       smarter  optimization  of  multiple  scroll actions on the
+       next update.
+
+       Neither the SVr4 documentation specifies whether the  cur-
+       rent  attribute  or current color-pair of blanks generated
+       by the scroll function is zeroed.  Under this  implementa-
+       tion it is.
+
+
+
+

PORTABILITY

+       The  XSI  Curses  standard,  Issue 4 describes these func-
+       tions.
+
+
+
+

SEE ALSO

+       curses(3X), curs_outopts(3X)
+
+ + diff --git a/Ada95/html/curs_slk.3x.html b/Ada95/html/curs_slk.3x.html new file mode 100644 index 00000000..ea4a16af --- /dev/null +++ b/Ada95/html/curs_slk.3x.html @@ -0,0 +1,122 @@ + + +
+       slk_init,     slk_set,    slk_refresh,    slk_noutrefresh,
+       slk_label, slk_clear, slk_restore, slk_touch,  slk_attron,
+       slk_attrset, slk_attroff - curses soft label routines
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int slk_init(int fmt);
+       int slk_set(int labnum, const char *label, int fmt);
+       int slk_refresh(void);
+       int slk_noutrefresh(void);
+       char *slk_label(int labnum);
+       int slk_clear(void);
+       int slk_restore(void);
+       int slk_touch(void);
+       int slk_attron(attr_t attrs);
+       int slk_attrset(attr_t attrs);
+       attr_t slk_attr(void);
+       int slk_attroff(attr_t attrs);
+
+
+
+

DESCRIPTION

+       The slk* functions manipulate the set of soft function-key
+       labels that exist on many terminals.  For those  terminals
+       that do not have soft labels, curses takes over the bottom
+       line of stdscr, reducing the size of stdscr and the  vari-
+       able  LINES.  curses standardizes on eight labels of up to
+       eight characters each. In addition to  this,  the  ncurses
+       implementation  supports  a  mode  where  it  simulates 12
+       labels of up to five characters each. This is most  common
+       for  todays  PC  like  enduser  devices.  Please note that
+       ncurses simulates this mode by taking over up to two lines
+       at  the  bottom  of  the screen, it doesn't try to use any
+       hardware support for this mode.
+
+       The slk_init routine must  be  called  before  initscr  or
+       newterm is called.  If initscr eventually uses a line from
+       stdscr to emulate the soft labels, then fmt determines how
+       the  labels  are arranged on the screen.  Setting fmt to 0
+       indicates a 3-2-3 arrangement of the labels, 1 indicates a
+       4-4 arrangement and 2 indicates the PC like 4-4-4 mode. If
+       fmt is set to 3, it is again the PC like 4-4-4  mode,  but
+       in  addition  an index line is generated, helping the user
+       to identify the key numbers easily.
+
+       The slk_set routine requires labnum to be a label  number,
+       from 1 to 8 (resp. 12); label must be the string to be put
+       on the label, up  to  eight  (resp.  five)  characters  in
+       length.   A  null string or a null pointer sets up a blank
+       label. fmt is either 0, 1, or 2,  indicating  whether  the
+       label  is  to be left-justified, centered, or right-justi-
+       fied, respectively, within the label.
+
+
+       The  slk_label routine returns the current label for label
+       number labnum, with leading and trailing blanks  stripped.
+
+       The  slk_clear  routine  clears  the  soft labels from the
+       screen.
+
+       The slk_restore routine, restores the soft labels  to  the
+       screen after a slk_clear has been performed.
+
+       The  slk_touch  routine  forces  all the soft labels to be
+       output the next time a slk_noutrefresh is performed.
+
+       The slk_attron, slk_attrset, slk_attroff and slk_attr rou-
+       tines correspond to attron, attrset, attroff and attr_get.
+       They have an effect only if soft labels are  simulated  on
+       the  bottom line of the screen.  The default highlight for
+       soft keys is A_STANDOUT (as in System V curses, which does
+       not document this fact).
+
+
+
+

RETURN VALUE

+       These routines return ERR upon failure and OK (SVr4 speci-
+       fies only "an integer value other than ERR") upon success-
+       ful  completion.  slk_attr  returns the attribute used for
+       the soft keys.
+
+       slk_label returns NULL on error.
+
+
+
+

NOTES

+       Most applications would use slk_noutrefresh because a wre-
+       fresh is likely to follow soon.
+
+
+
+

PORTABILITY

+       The  XSI  Curses  standard, Issue 4, describes these func-
+       tions.  It changes the argument  type  of  the  attribute-
+       manipulation     functions     slk_attron,    slk_attroff,
+       slk_attrset to be attr_t, and adds const  qualifiers.  The
+       format  codes  2  and  3  for  slk_init() and the function
+       slk_attr are specific to ncurses.
+
+
+
+

SEE ALSO

+       curses(3X),        curs_attr(3X),        curs_initscr(3X),
+       curs_refresh(3X)
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_termattrs.3x.html b/Ada95/html/curs_termattrs.3x.html new file mode 100644 index 00000000..d0a17431 --- /dev/null +++ b/Ada95/html/curs_termattrs.3x.html @@ -0,0 +1,122 @@ + + +
+       baudrate,  erasechar,  has_ic, has_il, killchar, longname,
+       termattrs, termname - curses environment query routines
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int baudrate(void);
+       char erasechar(void);
+       int has_ic(void);
+       int has_il(void);
+       char killchar(void);
+       char *longname(void);
+       attr_t termattrs(void);
+       char *termname(void);
+
+
+
+

DESCRIPTION

+       The baudrate routine returns the output speed of the  ter-
+       minal.   The  number  returned  is in bits per second, for
+       example 9600, and is an integer.
+
+       The erasechar routine returns  the  user's  current  erase
+       character.
+
+       The has_ic routine is true if the terminal has insert- and
+       delete- character capabilities.
+
+       The has_il routine is true if the terminal has insert- and
+       delete-line  capabilities,  or  can  simulate  them  using
+       scrolling regions.  This might be used to determine if  it
+       would  be  appropriate to turn on physical scrolling using
+       scrollok.
+
+       The killchar routine returns the user's current line  kill
+       character.
+
+       The  longname  routine  returns a pointer to a static area
+       containing a verbose description of the current  terminal.
+       The maximum length of a verbose description is 128 charac-
+       ters.  It is defined only after the  call  to  initscr  or
+       newterm.   The area is overwritten by each call to newterm
+       and is not restored by set_term, so the  value  should  be
+       saved  between calls to newterm if longname is going to be
+       used with multiple terminals.
+
+       If a given terminal doesn't support a video attribute that
+       an  application  program is trying to use, curses may sub-
+       stitute a different video attribute for it.  The termattrs
+       function returns a logical OR of all video attributes sup-
+       ported by the terminal.  This information is useful when a
+       curses  program needs complete control over the appearance
+       of the screen.
+
+
+
+
+

RETURN VALUE

+       longname and termname return NULL on error.
+
+       Routines that return an integer return  ERR  upon  failure
+       and  OK  (SVr4 only specifies "an integer value other than
+       ERR") upon successful completion.
+
+
+
+

NOTES

+       Note that termattrs may be a macro.
+
+
+
+

PORTABILITY

+       The XSI Curses standard, Issue  4  describes  these  func-
+       tions.  It changes the return type of termattrs to the new
+       type attr_t.
+
+
+
+

SEE ALSO

+       curses(3X), curs_initscr(3X), curs_outopts(3X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_termcap.3x.html b/Ada95/html/curs_termcap.3x.html new file mode 100644 index 00000000..1e336333 --- /dev/null +++ b/Ada95/html/curs_termcap.3x.html @@ -0,0 +1,122 @@ + + +
+       tgetent, tgetflag, tgetnum, tgetstr, tgoto, tputs - direct
+       curses interface to the terminfo capability database
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+       #include <term.h>
+       int tgetent(const char *bp, char *name);
+       int tgetflag(const char *id);
+       int tgetnum(const char *id);
+       char *tgetstr(const char *id, char **area);
+       char *tgoto(const char *cap, int col, int row);
+       int tputs(const char *str, int affcnt, int (*putc)(int));
+
+
+
+

DESCRIPTION

+       These routines are included as a conversion aid  for  pro-
+       grams  that use the termcap library.  Their parameters are
+       the same and the routines are emulated using the  terminfo
+       database.   Thus, they can only be used to query the capa-
+       bilities of entries for which a terminfo  entry  has  been
+       compiled.
+
+       The  tgetent routine loads the entry for name.  It returns
+       1 on success, 0 if there is no such entry, and -1  if  the
+       terminfo  database  could  not  be  found.   The emulation
+       ignores the buffer pointer bp.
+
+       The tgetflag routine gets the boolean entry for id.
+
+       The tgetnum routine gets the numeric entry for id.
+
+       The tgetstr routine returns the string entry for id.   Use
+       tputs to output the returned string.
+
+       The  tgoto  routine  instantiates  the parameters into the
+       given capability.  The output from this routine is  to  be
+       passed to tputs.
+
+       The  tputs  routine  is described on the curs_terminfo(3X)
+       manual page.  It can retrieve capabilities by either term-
+       cap or terminfo name.
+
+
+
+
+

RETURN VALUE

+       Except  where  explicitly  noted,  routines that return an
+       integer return ERR upon failure and OK (SVr4  only  speci-
+       fies  "an  integer  value other than ERR") upon successful
+       completion.
+
+       Routines that return pointers return NULL on error.
+
+
+
+

BUGS

+       If you call tgetstr to fetch ca or any other parameterized
+       notation.  This won't cause problems if all you do with it
+       is call tgoto or tparm, which both expand  terminfo-style.
+
+       Because  terminfo  conventions for representing padding in
+       string capabilities differ  from  termcap's,  tputs("50");
+       will  put  out a literal "50" rather than busy-waiting for
+       50 milliseconds.  Cope with it.
+
+
+
+

PORTABILITY

+       The XSI Curses standard, Issue  4  describes  these  func-
+       tions.   However,  they are marked TO BE WITHDRAWN and may
+       be removed in future versions.
+
+       Neither the XSI Curses standard nor  the  SVr4  man  pages
+       documented  the return values of tgetent correctly, though
+       all three were in fact returned ever since SVr1.
+
+
+
+

SEE ALSO

+       curses(3X), curs_terminfo(5), putc(3S).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_terminfo.3x.html b/Ada95/html/curs_terminfo.3x.html new file mode 100644 index 00000000..e125d997 --- /dev/null +++ b/Ada95/html/curs_terminfo.3x.html @@ -0,0 +1,226 @@ + + +
+       setupterm, setterm, set_curterm, del_curterm, restartterm,
+       tparm, tputs, putp, vidputs,  vidattr,  mvcur,  tigetflag,
+       tigetnum,   tigetstr   -  curses  interfaces  to  terminfo
+       database
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+       #include <term.h>
+
+       int setupterm(const char *term, int fildes, int *errret);
+       int setterm(const char *term);
+       TERMINAL *set_curterm(TERMINAL *nterm);
+       int del_curterm(TERMINAL *oterm);
+       int  restartterm(const  char  *term,   int   fildes,   int
+       *errret);
+       char *tparm(const char *str, ...);
+       char  *tparam(const  char  *str,  char  *buffer, int size,
+       ...);
+       int tputs(const char *str, int affcnt, int (*putc)(int));
+       int putp(const char *str);
+       int vidputs(chtype attrs, int (*putc)(char));
+       int vidattr(chtype attrs);
+       int mvcur(int oldrow, int oldcol, int newrow, int newcol);
+       int tigetflag(const char *capname);
+       int tigetnum(const char *capname);
+       char *tigetstr(const char *capname);
+
+
+
+

DESCRIPTION

+       These  low-level  routines must be called by programs that
+       have to deal directly with the terminfo database to handle
+       certain  terminal  capabilities, such as programming func-
+       tion keys.  For all other functionality,  curses  routines
+       are more suitable and their use is recommended.
+
+       Initially,   setupterm   should   be  called.   Note  that
+       setupterm is automatically called by initscr and  newterm.
+       This  defines  the  set  of  terminal-dependent  variables
+       [listed in terminfo(5)].  The terminfo variables lines and
+       columns  are  initialized  by  setupterm  as  follows:  If
+       use_env(FALSE) has  been  called,  values  for  lines  and
+       columns specified in terminfo are used.  Otherwise, if the
+       environment variables LINES and COLUMNS exist, their  val-
+       ues are used.  If these environment variables do not exist
+       and the program is running in a window, the current window
+       size  is used.  Otherwise, if the environment variables do
+       not exist, the values for lines and columns  specified  in
+       the terminfo database are used.
+
+       The  header  files  curses.h and term.h should be included
+       (in this order) to get the definitions for these  strings,
+       numbers,  and  flags.   Parameterized  strings  should  be
+       passed through tparm to instantiate  them.   All  terminfo
+       the  tty modes before exiting [see curs_kernel(3X)].  Pro-
+       grams  which   use   cursor   addressing   should   output
+       enter_ca_mode  upon startup and should output exit_ca_mode
+       before exiting.  Programs desiring  shell  escapes  should
+       call
+
+       reset_shell_mode  and output exit_ca_mode before the shell
+       is  called  and  should  output  enter_ca_mode  and   call
+       reset_prog_mode after returning from the shell.
+
+       The setupterm routine reads in the terminfo database, ini-
+       tializing the terminfo structures, but does not set up the
+       output virtualization structures used by curses.  The ter-
+       minal type is the character string term; if term is  null,
+       the  environment  variable TERM is used.  All output is to
+       file descriptor fildes which is  initialized  for  output.
+       If  errret  is  not null, then setupterm returns OK or ERR
+       and stores a status value in the  integer  pointed  to  by
+       errret.   A  status of 1 in errret is normal, 0 means that
+       the terminal could not be found, and  -1  means  that  the
+       terminfo  database could not be found.  If errret is null,
+       setupterm prints an error message upon  finding  an  error
+       and exits.  Thus, the simplest call is:
+
+             setupterm((char *)0, 1, (int *)0);,
+
+       which  uses  all the defaults and sends the output to std-
+       out.
+
+       The setterm routine is being replaced by  setupterm.   The
+       call:
+
+             setupterm(term, 1, (int *)0)
+
+       provides  the  same  functionality  as setterm(term).  The
+       setterm routine is included here  for  BSD  compatibility,
+       and is not recommended for new programs.
+
+       The  set_curterm  routine  sets  the  variable cur_term to
+       nterm, and makes all of the terminfo boolean, numeric, and
+       string  variables  use  the values from nterm.  It returns
+       the old value of cur_term.
+
+       The del_curterm routine frees  the  space  pointed  to  by
+       oterm and makes it available for further use.  If oterm is
+       the same as cur_term, references to any  of  the  terminfo
+       boolean,  numeric,  and  string  variables  thereafter may
+       refer to invalid memory locations until another  setupterm
+       has been called.
+
+       The  restartterm  routine  is  similar  to  setupterm  and
+       initscr, except that it is called after  restoring  memory
+       and the input and output options are the same as when mem-
+       ory was saved, but the terminal type and baud rate may  be
+       different.   Accordingly, it saves various tty state bits,
+       does a setupterm, and then restores the bits.
+
+       The tparm routine instantiates the string str with parame-
+       ters  pi.  A pointer is returned to the result of str with
+       the parameters applied.
+
+       The tparam routine is included for compatibility with  the
+       GNU  termcap  implementation.  It works like tparm but you
+       specify a buffer and buffer size to  be  filled  with  the
+       expanded string.
+
+       The  tputs  routine  applies  padding  information  to the
+       string str and outputs it.  The str  must  be  a  terminfo
+       string  variable  or the return value from tparm, tgetstr,
+       or tgoto.  affcnt is the number of lines affected, or 1 if
+       not  applicable.   putc is a putchar-like routine to which
+       the characters are passed, one at a time.
+
+       The putp routine calls tputs(str, 1, putchar).  Note  that
+       the  output  of  putp  always  goes  to stdout, not to the
+       fildes specified in setupterm.
+
+       The vidputs routine displays the string on the terminal in
+       the  video  attribute mode attrs, which is any combination
+       of the attributes listed in  curses(3X).   The  characters
+       are passed to the putchar-like routine putc.
+
+       The  vidattr  routine  is like the vidputs routine, except
+       that it outputs through putchar.
+
+       The mvcur routine provides low-level  cursor  motion.   It
+       takes   effect   immediately  (rather  than  at  the  next
+       refresh).
+
+       The tigetflag, tigetnum and tigetstr routines  return  the
+       value of the capability corresponding to the terminfo cap-
+       name passed to them, such as xenl.
+
+       The tigetflag routine returns the value -1 if  capname  is
+       not a boolean capability.
+
+       The  tigetnum  routine  returns the value -2 if capname is
+       not a numeric capability.
+
+       The tigetstr routine returns the value (char *)-1 if  cap-
+       name is not a string capability.
+
+       The capname for each capability is given in the table col-
+       umn entitled capname code in the capabilities  section  of
+
+       char *numnames, *numcodes, *numfnames
+
+       char *strnames, *strcodes, *strfnames
+
+       These  null-terminated  arrays  contain  the capnames, the
+       termcap codes, and the full C names, for each of the  ter-
+       minfo variables.
+
+
+
+

RETURN VALUE

+       Routines  that  return  an integer return ERR upon failure
+       and OK (SVr4 only specifies "an integer value  other  than
+       ERR")  upon  successful completion, unless otherwise noted
+       in the preceding routine descriptions.
+
+       Routines that return pointers always return NULL on error.
+
+
+
+

NOTES

+       The  setupterm routine should be used in place of setterm.
+       It may be useful when you want to test for terminal  capa-
+       bilities  without  committing to the allocation of storage
+       involved in initscr.
+
+       Note that vidattr and vidputs may be macros.
+
+
+
+

PORTABILITY

+       The function setterm is not described in  the  XSI  Curses
+       standard  and  must be considered non-portable.  All other
+       functions are as described in the XSI curses standard.
+
+       In System V Release 4, set_curterm has an int return  type
+       and  returns  OK  or ERR.  We have chosen to implement the
+       XSI Curses semantics.
+
+       In System V Release 4, the third argument of tputs has the
+       type int (*putc)(char).
+
+       The XSI Curses standard prototypes tparm with a fixed num-
+       ber of parameters, rather than a variable argument list.
+
+
+
+

SEE ALSO

+       curses(3X), curs_initscr(3X), curs_kernel(3X),  curs_term-
+       cap(3X), putc(3S), terminfo(5)
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_touch.3x.html b/Ada95/html/curs_touch.3x.html new file mode 100644 index 00000000..b38a2566 --- /dev/null +++ b/Ada95/html/curs_touch.3x.html @@ -0,0 +1,120 @@ + + +
+       touchwin, touchline, untouchwin, wtouchln, is_linetouched,
+       is_wintouched - curses refresh control routines
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+       int touchwin(WINDOW *win);
+       int touchline(WINDOW *win, int start, int count);
+       int untouchwin(WINDOW *win);
+       int wtouchln(WINDOW *win, int y, int n, int changed);
+       int is_linetouched(WINDOW *win, int line);
+       int is_wintouched(WINDOW *win);
+
+
+
+

DESCRIPTION

+       The touchwin and touchline routines throw away  all  opti-
+       mization  information about which parts of the window have
+       been touched, by pretending that  the  entire  window  has
+       been  drawn  on.   This  is sometimes necessary when using
+       overlapping windows, since a change to one window  affects
+       the other window, but the records of which lines have been
+       changed in the other window do  not  reflect  the  change.
+       The  routine touchline only pretends that count lines have
+       been changed, beginning with line start.
+
+       The untouchwin routine marks all lines in  the  window  as
+       unchanged since the last call to wrefresh.
+
+       The wtouchln routine makes n lines in the window, starting
+       at line y, look as if they have (changed=1)  or  have  not
+       (changed=0)  been changed since the last call to wrefresh.
+
+       The is_linetouched and is_wintouched routines return  TRUE
+       if  the  specified line/window was modified since the last
+       call to wrefresh; otherwise they return FALSE.   In  addi-
+       tion,  is_linetouched returns ERR if line is not valid for
+       the given window.
+
+
+
+

RETURN VALUE

+       All routines return the integer ERR upon  failure  and  an
+       integer  value  other than ERR upon successful completion,
+       unless otherwise noted in the preceding  routine  descrip-
+       tions.
+
+
+
+

PORTABILITY

+       The  XSI  Curses  standard,  Issue 4 describes these func-
+       tions.
+
+       Some historic curses implementations had,  as  an  undocu-
+       mented  feature,  the  ability  to  do  the  equivalent of
+       clearok(..., 1) by saying touchwin(stdscr)  or  clear(std-
+       scr).  This will not work under ncurses.
+
+
+
+

NOTES

+       curses(3X), curs_refresh(3X).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_util.3x.html b/Ada95/html/curs_util.3x.html new file mode 100644 index 00000000..34d167d1 --- /dev/null +++ b/Ada95/html/curs_util.3x.html @@ -0,0 +1,122 @@ + + +
+       unctrl,   keyname,   filter,   use_env,   putwin,  getwin,
+       delay_output, flushinp - miscellaneous curses utility rou-
+       tines
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       char *unctrl(chtype c);
+       char *keyname(int c);
+       void filter(void);
+       void use_env(char bool);
+       int putwin(WINDOW *win, FILE *filep);
+       WINDOW *getwin(FILE *filep);
+       int delay_output(int ms);
+       int flushinp(void);
+
+
+
+

DESCRIPTION

+       The  unctrl macro expands to a character string which is a
+       printable representation  of  the  character  c.   Control
+       characters  are  displayed  in  the ^X notation.  Printing
+       characters are displayed as is.
+
+       The keyname routine returns a character string correspond-
+       ing to the key c.
+
+       The filter routine, if used, must be called before initscr
+       or newterm are called.  The effect is that,  during  those
+       calls,  LINES  is  set  to 1; the capabilities clear, cup,
+       cud, cud1, cuu1, cuu,  vpa  are  disabled;  and  the  home
+       string is set to the value of cr.
+
+       The  use_env routine, if used, is called before initscr or
+       newterm are called.  When called with FALSE  as  an  argu-
+       ment,  the  values  of  lines and columns specified in the
+       terminfo database will be used, even if environment  vari-
+       ables  LINES  and COLUMNS (used by default) are set, or if
+       curses is running in  a  window  (in  which  case  default
+       behavior  would  be  to  use  the window size if LINES and
+       COLUMNS are not set).
+
+       The putwin routine writes all data associated with  window
+       win into the file to which filep points.  This information
+       can be later retrieved using the getwin function.
+
+       The getwin routine reads window related data stored in the
+       file  by putwin.  The routine then creates and initializes
+       a new window using that data.  It returns a pointer to the
+       new window.
+
+       The  delay_output  routine inserts an ms millisecond pause
+       in output.  This routine should not  be  used  extensively
+       because  padding  characters  are  used  rather than a CPU
+       been  typed  by  the user and has not yet been read by the
+       program.
+
+
+
+

RETURN VALUE

+       Except for  flushinp,  routines  that  return  an  integer
+       return  ERR  upon  failure and OK (SVr4 specifies only "an
+       integer value other than ERR") upon successful completion.
+
+       flushinp always returns OK.
+
+       Routines that return pointers return NULL on error.
+
+
+
+

PORTABILITY

+       The  XSI  Curses  standard,  Issue 4 describes these func-
+       tions.
+
+       The SVr4 documentation describes the action of filter only
+       in  the  vaguest  terms.   The description here is adapted
+       from the XSI Curses standard (which erroneously  fails  to
+       describe the disabling of cuu).
+
+
+
+

NOTES

+       Note  that  unctrl  is  a macro, which is defined in <unc-
+       trl.h>.
+
+
+
+

SEE ALSO

+       curses(3X), curs_initscr(3X), curs_scr_dump(3X).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/curs_window.3x.html b/Ada95/html/curs_window.3x.html new file mode 100644 index 00000000..70a2236c --- /dev/null +++ b/Ada95/html/curs_window.3x.html @@ -0,0 +1,176 @@ + + +
+       newwin,  delwin,  mvwin, subwin, derwin, mvderwin, dupwin,
+       wsyncup, syncok, wcursyncup,  wsyncdown  -  create  curses
+       windows
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       WINDOW *newwin(int nlines, int ncols, int begin_y,
+             intbegin_x);
+       int delwin(WINDOW *win);
+       int mvwin(WINDOW *win, int y, int x);
+       WINDOW *subwin(WINDOW *orig, int nlines, int ncols,
+             int begin_y, int begin_x);
+       WINDOW *derwin(WINDOW *orig, int nlines, int ncols,
+             int begin_y, int begin_x);
+       int mvderwin(WINDOW *win, int par_y, int par_x);
+       WINDOW *dupwin(WINDOW *win);
+       void wsyncup(WINDOW *win);
+       int syncok(WINDOW *win, bool bf);
+       void wcursyncup(WINDOW *win);
+       void wsyncdown(WINDOW *win);
+
+
+
+

DESCRIPTION

+       Calling newwin creates and returns a pointer to a new win-
+       dow with the given number of lines and columns.  The upper
+       left-hand  corner of the window is at line begin_y, column
+       begin_x.  If either nlines or ncols is zero, they  default
+       to  LINES - begin_y and COLS - begin_x.  A new full-screen
+       window is created by calling newwin(0,0,0,0).
+
+       Calling delwin deletes the named window, freeing all  mem-
+       ory  associated  with  it  (it does not actually erase the
+       window's screen image).  Subwindows must be deleted before
+       the main window can be deleted.
+
+       Calling mvwin moves the window so that the upper left-hand
+       corner is at position (x, y).  If the move would cause the
+       window to be off the screen, it is an error and the window
+       is not moved.  Moving subwindows is allowed, but should be
+       avoided.
+
+       Calling subwin creates and returns a pointer to a new win-
+       dow with the given number of lines, nlines,  and  columns,
+       ncols.   The  window  is at position (begin_y, begin_x) on
+       the screen.  (This position is relative to the screen, and
+       not to the window orig.)  The window is made in the middle
+       of the window orig, so that changes  made  to  one  window
+       will  affect  both  windows.   The subwindow shares memory
+       with the window orig.  When using this routine, it is nec-
+       essary  to call touchwin or touchline on orig before call-
+       ing wrefresh on the subwindow.
+
+       dow orig rather than the screen.  There is  no  difference
+       between the subwindows and the derived windows.
+
+       Calling  mvderwin  moves  a  derived window (or subwindow)
+       inside its parent window.  The screen-relative  parameters
+       of  the  window  are not changed.  This routine is used to
+       display different parts of the parent window at  the  same
+       physical position on the screen.
+
+       Calling  dupwin  creates  an exact duplicate of the window
+       win.
+
+       Calling wsyncup touches all locations in ancestors of  win
+       that  are changed in win.  If syncok is called with second
+       argument TRUE then wsyncup is called  automatically  when-
+       ever there is a change in the window.
+
+       The  wsyncdown  routine  touches each location in win that
+       has been touched in any of  its  ancestor  windows.   This
+       routine  is  called by wrefresh, so it should almost never
+       be necessary to call it manually.
+
+       The routine wcursyncup updates the current cursor position
+       of  all the ancestors of the window to reflect the current
+       cursor position of the window.
+
+
+
+

RETURN VALUE

+       Routines that return an integer  return  the  integer  ERR
+       upon failure and OK (SVr4 only specifies "an integer value
+       other than ERR") upon successful completion.
+
+       delwin returns the integer ERR upon failure  and  OK  upon
+       successful completion.
+
+       Routines that return pointers return NULL on error.
+
+
+
+

NOTES

+       If  many small changes are made to the window, the wsyncup
+       option could degrade performance.
+
+       Note that syncok may be a macro.
+
+
+
+

BUGS

+       The subwindow functions (subwin, derwin,  mvderwin,  wsyn-
+       cup,  wsyncdown,  wcursyncup,  syncok)  are  flaky, incom-
+       pletely implemented, and not well tested.
+
+       The System V curses documentation is  very  unclear  about
+       what wsyncup and wsyncdown actually do.  It seems to imply
+       that they are only supposed to touch exactly  those  lines
+       that are affected by ancestor changes.  The language here,
+       and the behavior of the  curses  implementation,  is  pat-
+
+
+
+

PORTABILITY

+       The XSI Curses standard, Issue  4  describes  these  func-
+       tions.
+
+
+
+

SEE ALSO

+       curses(3X), curs_refresh(3X), curs_touch(3X)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/dft_fgbg.3x.html b/Ada95/html/dft_fgbg.3x.html new file mode 100644 index 00000000..02ddbcf2 --- /dev/null +++ b/Ada95/html/dft_fgbg.3x.html @@ -0,0 +1,72 @@ + + +
+       use_default_colors - use terminal's default colors
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int use_default_colors(void);
+
+
+
+

DESCRIPTION

+       This  is  an  extension to the curses library.  It is used
+       with terminals that support ISO 6429 color, or equivalent.
+       These terminals allow the application to reset color to an
+       unspecified default value (e.g., with SGR 39 or  SGR  49).
+       Because  they  are  designed to support this, their design
+       usually includes features to change the default foreground
+       or background colors so that they do not match the assump-
+       tion in XSI curses of white on black.
+
+       Applications that paint  a  colored  background  over  the
+       whole  screen  are  not adversely impacted by this type of
+       terminal design.  However, there are applications that are
+       designed to work with the default background.
+
+
+
+

RETURN VALUE

+       The  function  returns the integer ERR upon failure and OK
+       on success.  It will fail if either the terminal does  not
+       support  the  orig_pair or orig_colors capability.  If the
+       initialize_pair capability is found, this causes an  error
+       as well.
+
+
+
+

NOTES

+       Associated with this extension, the init_pair(3x) function
+       accepts negative arguments to specify  default  foreground
+       or background colors.
+
+
+
+

PORTABILITY

+       These  routines  are  specific  to ncurses.  They were not
+       supported on Version 7, BSD or System  V  implementations.
+       It  is recommended that any code depending on them be con-
+       ditioned using NCURSES_VERSION.
+
+
+
+

SEE ALSO

+       curs_color(3x), ded(1).
+
+
+
+

AUTHOR

+       Thomas Dickey (from an analysis of  the  requirements  for
+       color xterm for XFree86 3.1.2C, February 1996).
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form.3x.html b/Ada95/html/form.3x.html new file mode 100644 index 00000000..f2c3e19e --- /dev/null +++ b/Ada95/html/form.3x.html @@ -0,0 +1,176 @@ + + +
+       forms - curses extension for programming forms
+
+
+
+

SYNOPSIS

+       #include <form.h>
+
+
+
+

DESCRIPTION

+       The forms library provides terminal-independent facilities
+       for composing form screens  on  character-cell  terminals.
+       The  library  includes:  field  routines, which create and
+       modify form fields; and form routines, which group  fields
+       into forms, display forms on the screen, and handle inter-
+       action with the user.
+
+       The forms library uses the curses libraries, and a  curses
+       initialization  routine  such  as  initscr  must be called
+       before using any of these functions.   To  use  the  forms
+       library, link with the options -lform -lcurses.
+
+
+   Current Default Values for Field Attributes
+       The  forms  library  maintains  a  default value for field
+       attributes.  You can get or set this  default  by  calling
+       the  appropriate  get_  or  set_ routine with a NULL field
+       pointer.  Changing  this  default  with  a  set_  function
+       affects  future  field  creations, but does not change the
+       rendering of fields already created.
+
+
+   Routine Name Index
+       The following table lists each form routine and  the  name
+       of the manual page on which it is described.
+
+       l  l  l  l  .   curses  Routine  Name Manual  Page  Name =
+       current_field  form_page(3X)  data_ahead     form_data(3X)
+       data_behind    form_data(3X)  dup_field form_field_new(3X)
+       dynamic_fieldinfo   form_field_info(3X)
+       field_arg form_field_validation(3X)
+       field_back     form_field_attributes(3X)
+       field_buffer   form_field_buffer(3X)
+       field_count    form_field(3X)
+       field_fore     form_field_attributes(3X)
+       field_index    form_page(3X)
+       field_info     form_field_info(3X)
+       field_init     form_hook(3X)
+       field_just     form_field_just(3X)
+       field_opts     form_field_opts(3X)
+       field_opts_off form_field_opts(3X)
+       field_opts_on  form_field_opts(3X)
+       field_pad form_field_attributes(3X)
+       field_status   form_field_buffer(3X)
+       field_term     form_hook(3X)
+       field_type     form_field_validation(3X)
+       form_fields    form_field(3X)      form_init form_hook(3X)
+       form_opts form_opts(3X)       form_opts_off  form_opts(3X)
+       form_opts_on   form_opts(3X)       form_page form_page(3X)
+       form_request_by_name     form_requestname(3X)
+       form_request_name   form_requestname(3X)
+       form_sub  form_win(3X)             form_term form_hook(3X)
+       form_userptr   form_userptr(3X)     form_win  form_win(3X)
+       free_field     form_field_new(3X)   free_form form_new(3X)
+       link_field     form_field_new(3X)
+       link_fieldtype link_fieldtype(3X)
+       move_field     form_field(3X) new_field form_field_new(3X)
+       new_form  form_new(3X)         new_page  form_new_page(3X)
+       pos_form_cursor     form_cursor(3X)
+       post_form form_post(3X)        scale_form     form_win(3X)
+       set_current_field   form_page(3X)
+       set_field_back form_field_attributes(3X)
+       set_field_buffer    form_field_buffer(3X)
+       set_field_fore form_field_attributes(3X)
+       set_field_init form_hook(3X)
+       set_field_just form_field_just(3X)
+       set_field_opts form_field_opts(3X)
+       set_field_pad  form_field_attributes(3X)
+       set_field_status    form_field_buffer(3X)
+       set_field_term form_hook(3X)
+       set_field_type form_field_validation(3X)
+       set_field_userptr   form_field_userptr(3X)
+       set_fieldtype_arg   form_fieldtype(3X)
+       set_fieldtype_choice     form_fieldtype(3X)
+       set_form_fields     form_field(3X)
+       set_form_init  form_hook(3X)
+       set_form_opts  form_field_opts(3X)
+       set_form_page  form_page(3X)   set_form_sub   form_win(3X)
+       set_form_term  form_hook(3X)
+       set_form_userptr    form_userptr(3X)
+       set_form_win   form_win(3X)
+       set_max_field  form_field_buffer(3X)
+       set_new_page   form_new_page(3X)
+       unpost_form    form_post(3X)
+
+
+
+

RETURN VALUE

+       Routines that return pointers return NULL on error.   Rou-
+       tines  that  return an integer return one of the following
+       error codes:
+
+       E_OK The routine succeeded.
+
+       E_CONNECTED
+            The field is already connected to a form.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+       E_POSTED
+            The form is already posted.
+
+       E_BAD_STATE
+            Routine was called from an initialization or termina-
+            tion function.
+
+       E_NO_ROOM
+            Form is too large for its window.
+
+       E_NOT_POSTED
+            The form has not been posted.
+
+       E_UNKNOWN_COMMAND
+            The form driver code saw an unknown request code.
+
+       E_INVALID_FIELD
+            Contents of a field are not valid.
+
+       E_NOT_CONNECTED
+            No fields are connected to the form.
+
+       E_REQUEST_DENIED
+            The form driver could not process the request.
+
+
+
+

SEE ALSO

+       curses(3X) and 3X pages  whose  names  begin  "form_"  for
+       detailed descriptions of the entry points.
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       files <curses.h> and <eti.h>.
+
+       In your library list, libform.a  should  be  before  libn-
+       curses.a; that is, you want to say `-lform -lncurses', not
+       the other way around (which would give you  a  link  error
+       using GNU ld(1) and many other linkers).
+
+
+
+

PORTABILITY

+       These  routines  emulate the System V forms library.  They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual pages and adaptation for  ncurses
+       by Eric S. Raymond.
+
+
+
+
+
+ + diff --git a/Ada95/html/form_cursor.3x.html b/Ada95/html/form_cursor.3x.html new file mode 100644 index 00000000..6afc48ca --- /dev/null +++ b/Ada95/html/form_cursor.3x.html @@ -0,0 +1,72 @@ + + +
+       form_cursor - position a form window cursor
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int pos_form_cursor(FORM *form);
+
+
+
+

DESCRIPTION

+       The  function  pos_form_cursor  restores the cursor to the
+       position required for the forms driver  to  continue  pro-
+       cessing  requests.   This  is useful after curses routines
+       have been called to do screen-painting in  response  to  a
+       form operation.
+
+
+
+

RETURN VALUE

+       This routine returns one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine  detected  an incorrect or out-of-range argu-
+            ment.
+
+       E_NOT_POSTED
+            The form has not been posted.
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  emulate the System V forms library.  They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_data.3x.html b/Ada95/html/form_data.3x.html new file mode 100644 index 00000000..72eef44e --- /dev/null +++ b/Ada95/html/form_data.3x.html @@ -0,0 +1,70 @@ + + +
+       form_data -
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       bool data_ahead(const FORM *form);
+       bool data_behind(const FORM *form);
+
+
+
+

DESCRIPTION

+       The  function data_ahead tests whether there is off-screen
+       data ahead in the given form.   It  returns  TRUE  (1)  or
+       FALSE (0).
+
+       The function data_behind tests whether there is off-screen
+       data behind in the given form.  It  returns  TRUE  (1)  or
+       FALSE (0).
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V forms  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_driver.3x.html b/Ada95/html/form_driver.3x.html new file mode 100644 index 00000000..524917c4 --- /dev/null +++ b/Ada95/html/form_driver.3x.html @@ -0,0 +1,280 @@ + + +
+       form_driver - command-processing loop of the form system
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int form_driver(FORM *form, int c);
+
+
+
+

DESCRIPTION

+       Once a form has been posted (displayed), you should funnel
+       input events to it through form_driver.  This routine  has
+       two  major input cases; either the input is a form naviga-
+       tion request or it's a  printable  ASCII  character.   The
+       form driver requests are as follows:
+
+       REQ_NEXT_PAGE
+            Move to the next page.
+
+       REQ_PREV_PAGE
+            Move to the previous page.
+
+       REQ_FIRST_PAGE
+            Move to the first page.
+
+       REQ_LAST_PAGE
+            Move to the last field.
+
+
+       REQ_NEXT_FIELD
+            Move to the next field.
+
+       REQ_PREV_FIELD
+            Move to the previous field.
+
+       REQ_FIRST_FIELD
+            Move to the first field.
+
+       REQ_LAST_FIELD
+            Move to the last field.
+
+       REQ_SNEXT_FIELD
+            Move to the sorted next field.
+
+       REQ_SPREV_FIELD
+            Move to the sorted previous field.
+
+       REQ_SFIRST_FIELD
+            Move to the sorted first field.
+
+       REQ_SLAST_FIELD
+            Move to the sorted last field.
+
+       REQ_LEFT_FIELD
+            Move left to a field.
+            Move right to a field.
+
+       REQ_UP_FIELD
+            Move up to a field.
+
+       REQ_DOWN_FIELD
+            Move down to a field.
+
+
+       REQ_NEXT_CHAR
+            Move to the next char.
+
+       REQ_PREV_CHAR
+            Move to the previous char.
+
+       REQ_NEXT_LINE
+            Move to the next line.
+
+       REQ_PREV_LINE
+            Move to the previous line.
+
+       REQ_NEXT_WORD
+            Move to the next word.
+
+       REQ_PREV_WORD
+            Move to the previous word.
+
+       REQ_BEG_FIELD
+            Move to the beginning of the field.
+
+       REQ_END_FIELD
+            Move to the end of the field.
+
+       REQ_BEG_LINE
+            Move to the beginning of the line.
+
+       REQ_END_LINE
+            Move to the end of the line.
+
+       REQ_LEFT_CHAR
+            Move left in the field.
+
+       REQ_RIGHT_CHAR
+            Move right in the field.
+
+       REQ_UP_CHAR
+            Move up in the field.
+
+       REQ_DOWN_CHAR
+            Move down in the field.
+
+
+            Insert or overlay a new line.
+
+       REQ_INS_CHAR
+            Insert a blank at the cursor.
+
+       REQ_INS_LINE
+            Insert a blank line at the cursor.
+
+       REQ_DEL_CHAR
+            Delete character at the cursor.
+
+       REQ_DEL_PREV
+            Delete character before the cursor.
+
+       REQ_DEL_LINE
+            Delete line at the cursor.
+
+       REQ_DEL_WORD
+            Delete blank-delimited word at the cursor.
+
+       REQ_CLR_EOL
+            Clear to end of line from cursor.
+
+       REQ_CLR_EOF
+            Clear to end of field from cursor.
+
+       REQ_CLR_FIELD
+            Clear the entire field.
+
+       REQ_OVL_MODE
+            Enter overlay mode.
+
+       REQ_INS_MODE
+            Enter insert mode.
+
+
+       REQ_SCR_FLINE
+            Scroll the field forward a line.
+
+       REQ_SCR_BLINE
+            Scroll the field backward a line.
+
+       REQ_SCR_FPAGE
+            Scroll the field forward a page.
+
+       REQ_SCR_BPAGE
+            Scroll the field backward a page.
+
+       REQ_SCR_FHPAGE
+            Scroll the field forward half a page.
+
+       REQ_SCR_BHPAGE
+            Scroll the field forward a character.
+
+       REQ_SCR_BCHAR
+            Scroll the field backward a character.
+
+       REQ_SCR_HFLINE
+            Horizontal scroll the field forward a line.
+
+       REQ_SCR_HBLINE
+            Horizontal scroll the field backward a line.
+
+       REQ_SCR_HFHALF
+            Horizontal scroll the field forward half a line.
+
+       REQ_SCR_HBHALF
+            Horizontal scroll the field backward half a line.
+
+
+       REQ_VALIDATION
+            Validate field.
+
+       REQ_NEXT_CHOICE
+            Display next field choice.
+
+       REQ_PREV_CHOICE
+            Display previous field choice.
+
+       If the second argument is a printable ASCII character, the
+       driver places it in the current position  in  the  current
+       field.   If  it is one of the forms requests listed above,
+       that request is executed.
+
+       If the second argument is neither printable ASCII nor  one
+       of  the above pre-defined form requests, the drive assumes
+       it  is  an  application-specific   command   and   returns
+       E_UNKNOWN_COMMAND.  Application-defined commands should be
+       defined relative to  MAX_COMMAND,  the  maximum  value  of
+       these pre-defined requests.
+
+
+
+

RETURN VALUE

+       form_driver return one of the following error codes:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine  detected  an incorrect or out-of-range argu-
+            ment.
+
+       E_BAD_STATE
+
+       E_NOT_POSTED
+            The form has not been posted.
+
+       E_UNKNOWN_COMMAND
+            The form driver code saw an unknown request code.
+
+       E_INVALID_FIELD
+            Contents of field is invalid.
+
+       E_REQUEST_DENIED
+            The form driver could not process the request.
+
+
+
+

SEE ALSO

+       curses(3X), forms(3x).
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       files <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V forms  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_field.3x.html b/Ada95/html/form_field.3x.html new file mode 100644 index 00000000..df9822f9 --- /dev/null +++ b/Ada95/html/form_field.3x.html @@ -0,0 +1,124 @@ + + +
+       form_field - make and break connections between fields and
+       forms
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int set_form_fields(FORM *form, FIELD **fields);
+       FIELD **form_fields(const FORM *form);
+       int field_count(const FORM *form);
+       int move_field(FIELD *field, int frow, int fcol);
+
+
+
+

DESCRIPTION

+       The function set_form_fields  changes  the  field  pointer
+       array  of the given form.  The array must be terminated by
+       a NULL.
+
+       The function form_fields returns the field  array  of  the
+       given form.
+
+       The  function  field_count  returns the count of fields in
+       form.
+
+       The function move_field move the given field  (which  must
+       be disconnected) to a specified location on the screen.
+
+
+
+

RETURN VALUES

+       The function form_fields returns NULL on error.
+
+       The  function  field_count returns ERR (the general curses
+       error return value) on error.
+
+       The functions set_form_fields and move_field return one of
+       the following codes on error:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine  detected  an incorrect or out-of-range argu-
+            ment.
+
+       E_POSTED
+            The form is already posted.
+
+       E_CONNECTED
+            The field is already connected to a form.
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+
+
+

NOTES

+
+
+
+

PORTABILITY

+       These  routines  emulate the System V forms library.  They
+       were not supported on Version 7 or BSD versions.
+
+       The  SVr4  forms  library  documentation   specifies   the
+       field_count error value as -1 (which is the value of ERR).
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_field_attributes.3x.html b/Ada95/html/form_field_attributes.3x.html new file mode 100644 index 00000000..3cef5851 --- /dev/null +++ b/Ada95/html/form_field_attributes.3x.html @@ -0,0 +1,124 @@ + + +
+       form_field_attributes  -  color  and attribute control for
+       form fields
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int set_field_fore(FIELD *field, chtype attr);
+       chtype field_fore(const FIELD *field);
+       int set_field_back(FIELD *field, chtype attr);
+       chtype field_back(const FIELD *field);
+       int set_field_pad(FIELD *field, int pad);
+       chtype field_pad(const FIELD *field);
+
+
+
+

DESCRIPTION

+       The function set_field_fore sets the foreground  attribute
+       of  field. This is the highlight used to display the field
+       contents.  The function field_fore returns the  foreground
+       attribute.  The default is A_STANDOUT.
+
+       The  function set_field_back sets the background attribute
+       of form. This is the highlight used to display the  extent
+       fields  in  the form.  The function field_back returns the
+       background attribute.  The default is A_NORMAL.
+
+       The function set_field_pad sets the character used to fill
+       the  field.   The  function  field_pad  returns  the given
+       form's pad character.  The default is a blank.
+
+
+
+

RETURN VALUE

+       These routines return one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+
+
+

SEE ALSO

+       curses(3X)  and  3X  pages  whose  names begin "form_" for
+       detailed descriptions of the entry points.
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  emulate the System V forms library.  They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_field_buffer.3x.html b/Ada95/html/form_field_buffer.3x.html new file mode 100644 index 00000000..32ebdce6 --- /dev/null +++ b/Ada95/html/form_field_buffer.3x.html @@ -0,0 +1,122 @@ + + +
+       form_field_buffer - field buffer control
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int  set_field_buffer(FIELD  *field,  int  buf, const char
+       *value);
+       char *field_buffer(const FIELD *field, int buffer);
+       int set_field_status(FIELD *field, bool status);
+       bool field_status(const FIELD *field);
+       int set_max_field(FIELD *field, int max);
+
+
+
+

DESCRIPTION

+       The function set_field_buffer sets the numbered buffer  of
+       the  given  field  to contain a given string.  Buffer 0 is
+       the displayed value of the field; other  numbered  buffers
+       may be allocated by applications through the nbuf argument
+       of (see field_new(3X)) but  are  not  manipulated  by  the
+       forms  library.   The  function  field_buffer  returns the
+       foreground attribute.
+
+       The function set_field_status sets the  associated  status
+       flag  of  field; field_status gets the current value.  The
+       status flag is set to a nonzero value whenever  the  field
+       changes.
+
+       The  function  set_max_field  sets  the maximum size for a
+       dynamic field.  An argument of 0  turns  off  any  maximum
+       size threshold for that field.
+
+
+
+

RETURN VALUE

+       The field_buffer function returns NULL on error.
+
+       The field_status function returns TRUE or FALSE.
+
+       The remaining routines return one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine  detected  an incorrect or out-of-range argu-
+            ment.
+
+
+
+

SEE ALSO

+       curses(3X) and 3X pages  whose  names  begin  "form_"  for
+       detailed descriptions of the entry points.
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+       These routines emulate the System V forms  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_field_info.3x.html b/Ada95/html/form_field_info.3x.html new file mode 100644 index 00000000..334f0588 --- /dev/null +++ b/Ada95/html/form_field_info.3x.html @@ -0,0 +1,72 @@ + + +
+       form_field_info - retrieve field characteristics
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int field_info(const FIELD *field, int *rows, int *cols,
+                     int *frow, int *fcol, int *nrow, int *nbuf);
+       int dynamic_field_info(const FIELD *field, int *rows,  int
+       *cols, *max);
+
+
+
+

DESCRIPTION

+       The  function  field_info  returns  the  sizes  and  other
+       attributes passed in to the field at  its  creation  time.
+       The  attributes are: height, width, row of upper-left cor-
+       ner, column of upper-left corner, number off-screen  rows,
+       and number of working buffers.
+
+       The function dynamic_field_info returns the actual size of
+       the field, and its maximum possible size.   If  the  field
+       has  no  size  limit,  the location addressed by the third
+       argument will be set to 0.  (A field can be  made  dynamic
+       by turning off the O_STATIC).
+
+
+
+

RETURN VALUE

+       These routines return one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine  detected  an incorrect or out-of-range argu-
+            ment.
+
+
+
+

SEE ALSO

+       curses(3X) and 3X pages  whose  names  begin  "form_"  for
+       detailed descriptions of the entry points.
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V forms  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+ + diff --git a/Ada95/html/form_field_just.3x.html b/Ada95/html/form_field_just.3x.html new file mode 100644 index 00000000..c95657ef --- /dev/null +++ b/Ada95/html/form_field_just.3x.html @@ -0,0 +1,72 @@ + + +
+       form_field_just - retrieve field characteristics
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int set_field_just(FIELD *field, int justification);
+       int field_just(const FIELD *field);
+
+
+
+

DESCRIPTION

+       The   function   set_field_just   sets  the  justification
+       attribute of a field; field_just returns a field's  justi-
+       fication attribute.  The attribute may be one of NO_JUSTI-
+       FICATION, JUSTIFY_RIGHT, JUSTIFY_LEFT, or  JUSTIFY_CENTER.
+
+
+
+
+

RETURN VALUE

+       The  function field_just returns one of: NO_JUSTIFICATION,
+       JUSTIFY_RIGHT, JUSTIFY_LEFT, or JUSTIFY_CENTER.
+
+       The function set_field_just return one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+
+
+

SEE ALSO

+       curses(3X)  and  3X  pages  whose  names begin "form_" for
+       detailed descriptions of the entry points.
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  emulate the System V forms library.  They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_field_new.3x.html b/Ada95/html/form_field_new.3x.html new file mode 100644 index 00000000..5275c1d6 --- /dev/null +++ b/Ada95/html/form_field_new.3x.html @@ -0,0 +1,122 @@ + + +
+       form_field_new - create and destroy form fields
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       FIELD *new_field(int height, int width,
+                        int toprow, int leftcol,
+                        int offscreen, int nbuffers);
+       FIELD *dup_field(FIELD *field, int toprow, int leftcol);
+       FIELD *link_field(FIELD *field, int toprow, int leftcol);
+       int free_field(FIELD *field);
+
+
+
+

DESCRIPTION

+       The  function new_field allocates a new field and initial-
+       izes it from the parameters given: height, width,  row  of
+       upper-left  corner,  column  of  upper-left corner, number
+       off-screen rows, and number of additional working buffers.
+
+       The  function  dup_field duplicates a field at a new loca-
+       tion.  Most attributes (including current contents,  size,
+       validation  type, buffer count, growth threshold, justifi-
+       cation, foreground, background,  pad  character,  options,
+       and  user pointer) are copied.  Field status and the field
+       page bit are not copied.
+
+       The function link_field acts like dup_field, but  the  new
+       field  shares  buffers with its parent.  Attribute data is
+       separate.
+
+       The function free_field  de-allocates  storage  associated
+       with a field.
+
+
+
+

RETURN VALUE

+       The function, new_field, dup_field, link_field return NULL
+       on error.
+
+       The function free_field returns one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+       These routines emulate the System V forms  library.   They
+       were not supported on Version 7 or BSD versions.
+
+       It  may be unwise to count on the set of attributes copied
+       by  dup_field(3x)  being  portable;  the  System  V  forms
+       library  documents  are  not  very  explicit  on what gets
+       copied and was not.
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_field_opts.3x.html b/Ada95/html/form_field_opts.3x.html new file mode 100644 index 00000000..f92e9856 --- /dev/null +++ b/Ada95/html/form_field_opts.3x.html @@ -0,0 +1,122 @@ + + +
+       form_field_opts - set and get field options
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int set_field_opts(FIELD *field, OPTIONS opts);
+       int field_opts_on(FIELD *field, OPTIONS opts);
+       int field_opts_off(FIELD *field, OPTIONS opts);
+       OPTIONS field_opts(const FIELD *field);
+
+
+
+

DESCRIPTION

+       The  function  set_field_opts  sets  all the given field's
+       option bits (field  option  bits  may  be  logically-OR'ed
+       together).
+
+       The function field_opts_on turns on the given option bits,
+       and leaves others alone.
+
+       The function field_opts_off turns  off  the  given  option
+       bits, and leaves others alone.
+
+       The function field_opts returns the field's current option
+       bits.
+
+       The following options are defined (all are on by default):
+
+       O_VISIBLE
+            The  field is displayed.  If this option is off, dis-
+            play of the field is suppressed,
+
+       O_ACTIVE
+            The field is  visited  during  processing.   If  this
+            option  is  off,  the  field will not be reachable by
+            navigation keys.
+
+       O_PUBLIC
+            The field contents are displayed as data is  entered.
+
+       O_EDIT
+            The field can be edited.
+
+       O_WRAP
+            Words  that  don't  fit  on a line are wrapped to the
+            next line.  Words are blank-separated.
+
+       O_BLANK
+            The field is cleared whenever a character is  entered
+            at the first position.
+
+       O_AUTOSKIP
+            Skip to the next field when this one fills
+
+       O_NULLOK
+            Field buffers are fixed to field's original size.
+
+       O_PASSOK
+            Validate field only if modified by user.
+
+
+
+

RETURN VALUE

+       Except  for  field_opts,  each  routine returns one of the
+       following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_CURRENT
+            The field is the current field.
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+
+       NOTES  The header file <form.h> automatically includes the
+              header file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  emulate the System V forms library.  They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_field_userptr.3x.html b/Ada95/html/form_field_userptr.3x.html new file mode 100644 index 00000000..e8bb557f --- /dev/null +++ b/Ada95/html/form_field_userptr.3x.html @@ -0,0 +1,72 @@ + + +
+       form_field_userptr  -  associate  application  data with a
+       form field
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int set_field_userptr(FIELD *field, const void*userptr);
+       const void *field_userptr(const FIELD *field);
+
+
+
+

DESCRIPTION

+       Every form field has a field that  can  be  used  to  hold
+       application-specific  data  (that is, the form-driver code
+       leaves it alone).  These functions get and set that field.
+
+
+
+

RETURN VALUE

+       The  function  field_userptr  returns  NULL  on error. The
+       function set_field_userptr returns one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  emulate the System V forms library.  They
+       were not supported on Version 7 or BSD versions.
+
+       The user pointer should be a void pointer.  We leave it as
+       a char pointer for SVr4 compatibility.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_field_validation.3x.html b/Ada95/html/form_field_validation.3x.html new file mode 100644 index 00000000..0c33a6d0 --- /dev/null +++ b/Ada95/html/form_field_validation.3x.html @@ -0,0 +1,176 @@ + + +
+       form_field_validation - data type validation for fields
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int set_field_type(FIELD *field, FIELDTYPE *type, ...);
+       FIELDTYPE *field_type(const FIELD *field);
+       void *field_arg(const FIELD *field);
+
+
+
+

DESCRIPTION

+       The  function  set_field_type  declares  a data type for a
+       given form field.  This is the type checked by  validation
+       functions.  The types are as follows:
+
+       TYPE_ALNUM
+            Alphanumeric  data.  Requires a third int argument, a
+            minimum field width.
+
+       TYPE_ALPHA
+            Character data.  Requires a  third  int  argument,  a
+            minimum field width.
+
+       TYPE_ENUM
+            Accept one of a specified set of strings.  Requires a
+            third (char **) argument pointing to a string list; a
+            fourth  int flag argument to enable case-sensitivity;
+            and a fifth int flag argument  specifying  whether  a
+            partial  match  must be a unique one (if this flag is
+            off, a prefix matches the first of any  set  of  more
+            than  one  list  elements  with  that prefix). Please
+            notice that the string list is  not  copied,  only  a
+            reference to it is stored in the field. So you should
+            avoid to use a list that lives in automatic variables
+            on the stack.
+
+       TYPE_INTEGER
+            Integer  data,  parsable  to  an  integer by atoi(3).
+            Requires a third int argument controlling the  preci-
+            sion,  a  fourth  long  argument constraining minimum
+            value, and a fifth long constraining  maximum  value.
+            If  the  maximum  value  is less or equal the minimum
+            value, the range is simply  ignored.  On  return  the
+            field  buffer  is  formatted  according to the printf
+            format  specification  ".*ld",  where  the   '*'   is
+            replaced  by  the precision argument.  For details of
+            the precision handling see printf's man-page.
+
+       TYPE_NUMERIC
+            Numeric  data  (may  have  a   decimal-point   part).
+            Requires  a third int argument controlling the preci-
+            sion, a fourth double argument  constraining  minimum
+            value, and a fifth double constraining maximum value.
+            If your system supports locale's, the  decimal  point
+            the  minimum  value,  the range is simply ignored. On
+            return the field buffer is formatted according to the
+            printf  format  specification ".*f", where the '*' is
+            replaced by the precision argument.  For  details  of
+            the precision handling see printf's man-page.
+
+       TYPE_REGEXP
+            Regular  expression data.  Requires a regular expres-
+            sion (char *) third argument; the data  is  valid  if
+            the  regular  expression matches it.  Regular expres-
+            sions  are  in  the   format   of   regcomp(3x)   and
+            regexec(3X).  Please  notice that the regular expres-
+            sion must match the whole  field.  If  you  have  for
+            example  an  eight  character  wide  field, a regular
+            expression "^[0-9]*$" always means that you  have  to
+            fill  all eight positions with digits. If you want to
+            allow fewer digits, you may use for example  "^[0-9]*
+            *$" which is good for trailing spaces (up to an empty
+            field), or "^ *[0-9]* *$" which is good  for  leading
+            and trailing spaces around the digits.
+
+       TYPE_IPV4
+            An Internet Protocol Version 4 address. This requires
+            no additional argument. It is checked whether or  not
+            the  buffer  has  the form a.b.c.d, where a,b,c and d
+            are numbers between 0 and 255. Trailing blanks in the
+            buffer  are  ignored. The address itself is not vali-
+            dated. Please note that this is an ncurses extension.
+            This  field type may not be available in other curses
+            implementations.
+
+            It is possible to set up new programmer-defined field
+            types.  See the form_fieldtype(3X) manual page.
+
+
+
+

RETURN VALUE

+       The  functions  field_type  and  field_arg  return NULL on
+       error. The function set_field_type returns one of the fol-
+       lowing:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_fieldtype.3x.html b/Ada95/html/form_fieldtype.3x.html new file mode 100644 index 00000000..4a25187a --- /dev/null +++ b/Ada95/html/form_fieldtype.3x.html @@ -0,0 +1,124 @@ + + +
+       form_fieldtype - define validation-field types
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       FIELDTYPE *new_fieldtype(
+           bool (* const field_check)(FIELD *, const void *),
+           bool (* const char_check)(int, const void *));
+       int free_fieldtype(FIELDTYPE *fieldtype);
+       int set_fieldtype_arg(
+           FIELDTYPE *fieldtype,
+           void *(* const make_arg)(va_list *),
+           void *(* const copy_arg)(const void *),
+           void  (* const free_arg)(void *));
+       int set_fieldtype_choice(
+           FIELDTYPE *fieldtype
+           bool (* const next_choice)(FIELD *, const void *),
+           bool (* const prev_choice)(FIELD *, const void *));
+       FIELDTYPE *link_fieldtype(FIELDTYPE *type1,
+                                 FIELDTYPE *type2);
+
+
+
+

DESCRIPTION

+       The function new_fieldtype creates a new field type usable
+       for data validation.  You supply it  with  field_check,  a
+       predicate  to check the validity of an entered data string
+       whenever the user attempt to leave a field.  The (FIELD *)
+       argument  is passed in so the validation predicate can see
+       the field's buffer, sizes and other attributes; the second
+       argument  is an argument-block structure, about which more
+       below.
+
+       You also supply new_fieldtype with char_check, a  function
+       to  validate input characters as they are entered; it will
+       be passed the character to be checked and a pointer to  an
+       argument-block structure.
+
+       The  function free_fieldtype frees the space allocated for
+       a given validation type.
+
+       The function set_fieldtype associates  three  storage-man-
+       agement functions with a field type.  The mak_arg function
+       is automatically applied to the list of arguments you give
+       set_field_type  when  attaching validation to a field; its
+       job is to bundle these into  an  allocated  argument-block
+       object which can later be passed to validation predicated.
+       The other two hook arguments should copy  and  free  argu-
+       ment-block  structures.   They  will be used by the forms-
+       driver code.
+
+       The   form    driver    requests    REQ_NEXT_CHOICE    and
+       REQ_PREV_CHOICE assume that the possible values of a field
+       form an ordered set, and provide the forms user with a way
+       to  move  through the set.  The set_fieldtype_choice func-
+       take the field pointer and an argument-block structure  as
+       arguments.
+
+
+
+

RETURN VALUE

+       The pointer-valued routines return NULL on error.
+
+       The  integer-valued  routines  return one of the following
+       codes on error:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+       E_CONNECTED
+            The field is already connected to a form.
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+       All of the (char *) arguments of  these  functions  should
+       actually  be (void *).  The type has been left uncorrected
+       for strict compatibility with System V.
+
+
+
+

PORTABILITY

+       These routines emulate the System V forms  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_hook.3x.html b/Ada95/html/form_hook.3x.html new file mode 100644 index 00000000..d010b959 --- /dev/null +++ b/Ada95/html/form_hook.3x.html @@ -0,0 +1,124 @@ + + +
+       form_hook - set hooks for automatic invocation by applica-
+       tions
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int set_field_init(FORM *form, void (*func)(FORM *));
+       void (*)(FORM *) field_init(const FORM *form);
+       int set_field_term(FORM *form, void (*func)(FORM *));
+       void (*)(FORM *) field_term(const FORM *form);
+       int set_form_init(FORM *form, void (*func)(FORM *));
+       void (*)(FORM *) form_init(const FORM *form);
+       int set_form_term(FORM *form, void (*func)(FORM *));
+       void (*)(FORM *) form_term(const FORM *form);
+
+
+
+

DESCRIPTION

+       These functions make it possible to set hook functions  to
+       be called at various points in the automatic processing of
+       input event codes by form_driver.
+
+       The function set_field_init sets a hook to  be  called  at
+       form-post  time  and  each time the selected field changes
+       (after the change).  field_init returns the current  field
+       init hook, if any (NULL if there is no such hook).
+
+       The  function  set_field_term  sets a hook to be called at
+       form-unpost time and each time the selected field  changes
+       (before the change).  field_term returns the current field
+       term hook, if any (NULL if there is no such hook).
+
+       The function set_form_init sets a hook  to  be  called  at
+       form-post  time  and  just  after a page change once it is
+       posted.  form_init returns the current form init hook,  if
+       any (NULL if there is no such hook).
+
+       The  function  set_form_term  sets  a hook to be called at
+       form-unpost time and just before a page change change once
+       it  is  posted.   form_init  returns the current form term
+       hook, if any (NULL if there is no such hook).
+
+
+
+

RETURN VALUE

+       Routines that return pointers return NULL on error.  Other
+       routines return one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+
+
+

NOTES

+
+
+
+

PORTABILITY

+       These routines emulate the System V forms  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_new.3x.html b/Ada95/html/form_new.3x.html new file mode 100644 index 00000000..7527ca97 --- /dev/null +++ b/Ada95/html/form_new.3x.html @@ -0,0 +1,72 @@ + + +
+       form_new - create and destroy forms
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       FORM *new_form(FIELD **fields);
+       int free_form(FORM *form);
+
+
+
+

DESCRIPTION

+       The  function  new_form  creates a new form connected to a
+       specified field pointer array (which must  be  NULL-termi-
+       nated).
+
+       The  function  free_form  disconnects  form from its field
+       array and frees the storage allocated for the form.
+
+
+
+

RETURN VALUE

+       The function new_form returns NULL on error.
+
+       The function free_form returns one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+       E_POSTED
+            The form has already been posted.
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V forms  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_new_page.3x.html b/Ada95/html/form_new_page.3x.html new file mode 100644 index 00000000..b2f5deb4 --- /dev/null +++ b/Ada95/html/form_new_page.3x.html @@ -0,0 +1,72 @@ + + +
+       form_new_page - form pagination functions
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int set_new_page(FIELD *field, bool new_page_flag);
+       bool new_page(const FIELD *field);
+
+
+
+

DESCRIPTION

+       The  function  set_new_page  sets or resets a flag marking
+       the given field as the beginning of  a  new  page  on  its
+       form.
+
+       The  function  new_page  is  a  predicate which tests if a
+       given field marks a page beginning on its form.
+
+
+
+

RETURN VALUE

+       The function new_page returns TRUE or FALSE.
+
+       The function set_new_page return one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_CONNECTED
+            The given field is already connected to a form.
+
+
+
+

SEE ALSO

+       curses(3X) and 3X pages  whose  names  begin  "form_"  for
+       detailed descriptions of the entry points.
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V forms  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_opts.3x.html b/Ada95/html/form_opts.3x.html new file mode 100644 index 00000000..839facd1 --- /dev/null +++ b/Ada95/html/form_opts.3x.html @@ -0,0 +1,124 @@ + + +
+       form_opts - set and get form options
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int set_form_opts(FORM *form, OPTIONS opts);
+       int form_opts_on(FORM *form, OPTIONS opts);
+       int form_opts_off(FORM *form, OPTIONS opts);
+       OPTIONS form_opts(const FORM *form);
+
+
+
+

DESCRIPTION

+       The  function  set_form_opts  sets  all  the  given form's
+       option bits  (form  option  bits  may  be  logically-OR'ed
+       together).
+
+       The  function form_opts_on turns on the given option bits,
+       and leaves others alone.
+
+       The function form_opts_off  turns  off  the  given  option
+       bits, and leaves others alone.
+
+       The  function  form_opts returns the form's current option
+       bits.
+
+       The following options are defined (all are on by default):
+
+       O_NL_OVERLOAD
+            Overload  the  REQ_NEW_LINE  forms  driver request so
+            that calling it at the end of a  field  goes  to  the
+            next field.
+
+       O_BS_OVERLOAD
+            Overload  the  REQ_DEL_PREV  forms  driver request so
+            that calling it at the beginning of a field  goes  to
+            the previous field.
+
+
+
+

RETURN VALUE

+       Except for form_opts, each routine returns one of the fol-
+       lowing:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_page.3x.html b/Ada95/html/form_page.3x.html new file mode 100644 index 00000000..7715748f --- /dev/null +++ b/Ada95/html/form_page.3x.html @@ -0,0 +1,122 @@ + + +
+       form_page - set and get form page number
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int set_current_field(FORM *form, FIELD *field);
+       FIELD *current_field(const FORM *);
+       int set_form_page(FORM *form, int n);
+       int form_page(const FORM *form);
+       int field_index(const FIELD *field);
+
+
+
+

DESCRIPTION

+       The  function  set_current field sets the current field of
+       the given form; current_field returns the current field of
+       the given form.
+
+       The  function  set_form_page  sets  the form's page number
+       (goes to page n of the form).
+
+       The function form_page returns  the  form's  current  page
+       number.
+
+       The function field_index returns the index of the field in
+       the field array of the form it is connected to. It returns
+       ERR  if  the  argument is the null pointer or the field is
+       not connected.
+
+
+
+

RETURN VALUE

+       Except for form_page, each routine returns one of the fol-
+       lowing:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine  detected  an incorrect or out-of-range argu-
+            ment.
+
+       E_BAD_STATE
+            Routine was called from an initialization or termina-
+            tion function.
+
+       E_INVALID_FIELD
+            Contents of a field are not valid.
+
+       E_REQUEST_DENIED
+            The form driver could not process the request.
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V forms  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_post.3x.html b/Ada95/html/form_post.3x.html new file mode 100644 index 00000000..6ca86909 --- /dev/null +++ b/Ada95/html/form_post.3x.html @@ -0,0 +1,122 @@ + + +
+       form_post  -  write or erase forms from associated subwin-
+       dows
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int post_form(FORM *form);
+       int unpost_form(FORM *form);
+
+
+
+

DESCRIPTION

+       The function post_form displays a form to  its  associated
+       subwindow.   To trigger physical display of the subwindow,
+       use  refresh  or  some  equivalent  curses  routine   (the
+       implicit  doupdate  triggered  by  an curses input request
+       will do).
+
+       The function unpost_form erases form from  its  associated
+       subwindow.
+
+
+
+

RETURN VALUE

+       These routines return one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine  detected  an incorrect or out-of-range argu-
+            ment.
+
+       E_POSTED
+            The form has already been posted.
+
+       E_BAD_STATE
+            Routine was called from an initialization or termina-
+            tion function.
+
+       E_NO_ROOM
+            Form is too large for its window.
+
+       E_NOT_POSTED
+            The form has not been posted.
+
+       E_NOT_CONNECTED
+            No items are connected to the form.
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+       These routines emulate the System V forms  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_requestname.3x.html b/Ada95/html/form_requestname.3x.html new file mode 100644 index 00000000..ac1a5f3c --- /dev/null +++ b/Ada95/html/form_requestname.3x.html @@ -0,0 +1,72 @@ + + +
+       form_requestname - handle printable form request names
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       const char *form_request_name(int request);
+       int form_request_by_name(const char *name);
+
+
+
+

DESCRIPTION

+       The  function form_request_name returns the printable name
+       of a form request code.
+       The function form_request_by_name searches  in  the  name-
+       table  for  a  request with the given name and returns its
+       request code. Otherwise E_NO_MATCH is returned.
+
+
+
+

RETURN VALUE

+       form_request_name returns NULL on error and sets errno  to
+       E_BAD_ARGUMENT.
+       form_request_by_name returns E_NO_MATCH on error.
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines are specific to  ncurses.   They  were  not
+       supported  on  Version 7, BSD or System V implementations.
+       It is recommended that any code depending on them be  con-
+       ditioned using NCURSES_VERSION.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_userptr.3x.html b/Ada95/html/form_userptr.3x.html new file mode 100644 index 00000000..3dda58e6 --- /dev/null +++ b/Ada95/html/form_userptr.3x.html @@ -0,0 +1,72 @@ + + +
+       form_userptr - associate application data with a form item
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int set_form_userptr(FORM *form, const void *userptr);
+       const void* form_userptr(const FORM *form);
+
+
+
+

DESCRIPTION

+       Every form and every form item has a  field  that  can  be
+       used to hold application-specific data (that is, the form-
+       driver code leaves it alone).  These functions get and set
+       the form user pointer field.
+
+
+
+

RETURN VALUE

+       The  function  form_userptr  returns  NULL  on error.  The
+       function set_form_userptr returns one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+
+
+

NOTES

+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  emulate the System V forms library.  They
+       were not supported on Version 7 or BSD versions.
+
+       The user pointer should be a void pointer.  We leave it as
+       a char pointer for SVr4 compatibility.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/form_win.3x.html b/Ada95/html/form_win.3x.html new file mode 100644 index 00000000..3d5e94b1 --- /dev/null +++ b/Ada95/html/form_win.3x.html @@ -0,0 +1,122 @@ + + +
+       form_win  - make and break form window and subwindow asso-
+       ciations
+
+
+
+

SYNOPSIS

+       #include <form.h>
+       int set_form_win(FORM *form, WINDOW *win);
+       WINDOW *form_win(const FORM *form);
+       int set_form_sub(FORM *form, WINDOW *sub);
+       WINDOW *form_sub(const FORM *form);
+       int scale_form(const FORM *form, int *rows, int *columns);
+
+
+
+

DESCRIPTION

+       Every  form has an associated pair of curses windows.  The
+       form window displays any title and border associated  with
+       the  window;  the form subwindow displays the items of the
+       form that are currently available for selection.
+
+       The first four functions get and set those windows.  It is
+       not necessary to set either window; by default, the driver
+       code uses stdscr for both.
+
+       In the set_ functions, window argument of NULL is  treated
+       as  though  it  were  stsdcr.   A form argument of NULL is
+       treated as a request to change  the  system  default  form
+       window or subwindow.
+
+       The   function   scale_window  returns  the  minimum  size
+       required for the subwindow of form.
+
+
+
+

RETURN VALUE

+       Routines that return pointers return NULL on error.   Rou-
+       tines  that  return an integer return one of the following
+       error codes:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+       E_POSTED
+            The form has already been posted.
+
+       E_NOT_CONNECTED
+            No items are connected to the form.
+
+
+
+

SEE ALSO

+       curses(3X), form(3X).
+
+       The header file <form.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V forms  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/index.html b/Ada95/html/index.html new file mode 100644 index 00000000..6900ef37 --- /dev/null +++ b/Ada95/html/index.html @@ -0,0 +1,179 @@ + + + + +Ada95 Binding for ncurses + + +

Ada95 Binding for ncurses

+The ncurses Ada95 binding is © 1996 by +Jürgen Pfeifer. +

+ +Permission is hereby granted to reproduce and distribute this +binding by any means and for any fee, whether alone or as part +of a larger distribution, in source or in binary form, PROVIDED +this notice is included with any such distribution, and is not +removed from any of its header files. Mention of ncurses and the +author of this binding in any applications linked with it is +highly appreciated.
+ +This binding comes AS IS with no warranty, implied or expressed. +

+


+

General Remarks

+
    +
  • This document describes Version 00.92.00 of the binding.
  • +
  • The functionality is modelled to be compatible with the ncurses +package, a clone of the SVr4 curses model.
    +I did the development on an Intel box running +Linux 1.3.x and 2.0, +ncurses-1.9.9e and the +GNU Ada Translator +gnat-3.05. For any older versions of ncurses and gnat +it will not work.
  • +
  • You must have the m4 macroprocessor to build this package. +If you don't have this program, you can get the FSF version +here.
  • +
  • Ada programs are supposed to be readable. One of my +favourite methods to make code readable is to use expressive +names for the identifiers. You can find a list of a mapping +of the cryptic curses names to the Ada names in this table.
  • +
  • This is not a typical one-2-one interface mapping. It is +close to one-2-one on the functional level. Each (n)curses function +has it's counterpart with a more or less similar formal parameter list +in the binding. It is not one-2-one with respect to the datatypes. +I tried to make records out of the flat chtype and similar structures, +so you don't have to do bit operations to mark an attributed character +as bold. Just make the boolean member bold of the record +true. The binding also hides the structures like WINDOW, PANEL, MENU, FORM +etc. ! It's a pure functional API.
  • +
  • I try to do as much error checking as possible and feasible +in the binding. I will raise an Ada exception when something +went wrong in the low-level curses. This has the effect that - at least +first time in my life - (n)curses programs have now a very rigid error +checking, but - thanks to Ada - you don't have to code the orgiastic +error checking style of C.
  • +
  • Support for wide characters is currently not in the binding, as it +is not really in ncurses at this point in time.
  • +
+

+ +

Limitations

+
    +
  • I provide no SCREEN datatype and functions to set a new screen. +If you need this (mostly for debugging I guess), write a small +C routine doing all this and import it into your Ada program.
  • +
  • I provide no functions to switch on/off curses tracing options. +Same suggestion as above.
  • +
  • Although Ada95 is an OO Language, this binding doesn't provide +an OO abstraction of the (n)curses functionality. As mentioned above +it's a thin binding for the (n)curses functions. But without any +doubt it would be nice to build on top of this an OO abstraction +of (n)curses functionality.
  • +
  • If you use the user-pointer mechanism for most of the ncurses +structures in a mixed language environemt, i.e. Ada95 and C routines +operate on the same objects, care must be taken because the Ada +binding itself uses the user pointer mechanism for it's own purposes. +See the corresponding section in implementention +details.
  • +
  • I currently do not support the link_fieldtype functionality of the +forms subsystem.
  • +
  • The *_IO packages are currently output only.
  • +
+ + +

Hierarchy of packages

+ +

Implementation Details

+

Behind the abstraction

+All the new types like Window, Panel, +Menu, Form etc. are just +opaque representations of the pointers to the corresponding +low level (n)curses structures like +WINDOW *, PANEL *, +MENU * or FORM *. +So you can safely pass them to C routines that expect a pointer +to one of those structures. +

Item and Field Arrays

+In C you have to pass the item and field arrays to define menus or forms +terminated by a null item or null field. This is not necessary in this +binding. The binding routines will construct from an Ada95 style array +of Item or Field objects internally the properly terminated array of +C structure pointers. See the examples for more details. +

Extended ripoffline() usage

+The official documentation of (n)curses says, that the line parameter +determines only whether or not exactly one line is +stolen from the top or bottom of the screen. So essentially only the +sign of the parameter is evaluated. ncurses has internally implemented +it in a way, that uses the line parameter also to control the amount of +lines to steal. This mechanism is used in the Rip_Off_Lines +routine of the binding. + +

User Pointer mechanism

+TBD +

How user defined field types work

+TBD +

Enumeration fields handling

+The (n)curses documentation says, that the String arrays to be passed to +an TYPE_ENUM fieldtype must not be automatic variables. This is not true +in this binding, because it is internally arranged to safely copy these +values. +
+

Using other Ada compilers

+This should basically not be a problem, but you have to replace a code +sequence in package +
Terminal_Interface.Curses.Forms +that uses a hashing package supplied with the GNAT runtime, which is not part +of the Standard Ada runtimes. This should not be too hard. I intend to remove +this dependency in the future. +

Port to other curses implementations

+Basically it should not be too hard to make all this run on a regular SVr4 +implementation of curses. The problems are probably these:
+
    +
  • ncurses has some additional features which are presented in this binding. You +have two choices to deal with this: +
      +
    • Emulate the feature in this binding
    • +
    • Raise an exception for non implemented features
    • +
    +Most likely you will follow a mixed approach. Some features are easy to simulate, +others will be hard if not impossible.
  • +
  • For menu items, the name and descriptions are internally copied by ncurses. +So the binding doesn't care for the lifetime of the strings passed to the +construction routine for items. This assumption is not true in most other implementations +of the menu library. In this case you have to modify the binding routine +New_Item to safestore the strings.
  • +
+I'm quite sure I forgot something.

+ + diff --git a/Ada95/html/menu.3x.html b/Ada95/html/menu.3x.html new file mode 100644 index 00000000..8439ff83 --- /dev/null +++ b/Ada95/html/menu.3x.html @@ -0,0 +1,176 @@ + + +

+       menus - curses extension for programming menus
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+
+
+
+

DESCRIPTION

+       The menus library provides terminal-independent facilities
+       for composing menu systems  on  character-cell  terminals.
+       The library includes: item routines, which create and mod-
+       ify menu items; and menu routines, which group items  into
+       menus, display menus on the screen, and handle interaction
+       with the user.
+
+       The menus library uses the curses libraries, and a  curses
+       initialization  routine  such  as  initscr  must be called
+       before using any of these functions.   To  use  the  menus
+       library, link with the options -lmenu -lcurses.
+
+
+   Current Default Values for Item Attributes
+       The  menus  library  maintains  a  default  value for item
+       attributes.  You can get or set this  default  by  calling
+       the  appropriate  get_  or  set_  routine with a NULL item
+       pointer.  Changing  this  default  with  a  set_  function
+       affects  future  item  creations,  but does not change the
+       rendering of items already created.
+
+
+   Routine Name Index
+       The following table lists each menu routine and  the  name
+       of the manual page on which it is described.
+
+       l   l   .    curses   Routine   Name Manual  Page  Name  =
+       current_item   mitem_current(3X)                 free_item
+            mitem_new(3X)       free_menu            menu_new(3X)
+       item_count     menu_items(3X)
+       item_description    mitem_name(3X)
+       item_index     mitem_current(3X)                 item_init
+            menu_hook(3X) item_name      mitem_name(3X) item_opts
+            mitem_opts(3X)          item_opts_off  mitem_opts(3X)
+       item_opts_on   mitem_opts(3X) item_term      menu_hook(3X)
+       item_userptr   mitem_userptr(3X)
+       item_value     mitem_value(3X)  item_visible   mitem_visi-
+       ble(3X)          menu_back                menu_attribs(3X)
+       menu_driver    menu_driver(3X)                   menu_fore
+            menu_attribs(3X)       menu_format    menu_format(3X)
+       menu_grey               menu_attribs(3X)         menu_init
+            menu_hook(3X) menu_items     menu_items(3X) menu_mark
+            menu_mark(3X)       menu_opts           menu_opts(3X)
+       menu_opts_off  menu_opts(3X)  menu_opts_on   menu_opts(3X)
+       menu_pad        menu_attribs(3X)  menu_pattern   menu_pat-
+       tern(3X)     menu_request_by_name     menu_requestname(3X)
+            menu_win(3X)       menu_term            menu_hook(3X)
+       menu_userptr   menu_userptr(3X)                   menu_win
+            menu_win(3X)  new_item        mitem_new(3X)  new_menu
+            menu_new(3X)      pos_menu_cursor     menu_cursor(3X)
+       post_menu     menu_post(3X)    scale_menu     menu_win(3X)
+       set_current_item    menu_current_item(3X)
+       set_item_init  menu_hook(3X) set_item_opts  mitem_opts(3X)
+       set_item_term  menu_hook(3X)
+       set_item_userptr    mitem_userptr(3X)
+       set_item_value mitem_value(3X)
+       set_menu_back  menu_attribs(3X)
+       set_menu_fore  menu_attribs(3X)
+       set_menu_format     menu_format(3X)
+       set_menu_grey  menu_attribs(3X)
+       set_menu_init  menu_hook(3X) set_menu_items menu_items(3X)
+       set_menu_mark  menu_mark(3X) set_menu_opts  mitem_opts(3X)
+       set_menu_pad   menu_attribs(3X)
+       set_menu_pattern    menu_pattern(3X)
+       set_menu_spacing    menu_spacing(3X)
+       set_menu_sub   menu_win(3X)   set_menu_term  menu_hook(3X)
+       set_menu_userptr    menu_userptr(3X)
+       set_menu_win   menu_win(3X)      set_top_row    mitem_cur-
+       rent(3X)          top_row                mitem_current(3X)
+       unpost_menu    menu_post(3X)
+
+
+
+

RETURN VALUE

+       Routines that return pointers return NULL on error.   Rou-
+       tines  that  return an integer return one of the following
+       error codes:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+       E_POSTED
+            The menu is already posted.
+
+       E_BAD_STATE
+            Routine was called from an initialization or termina-
+            tion function.
+
+       E_NO_ROOM
+            Menu is too large for its window.
+
+       E_NOT_POSTED
+            The menu has not been posted.
+
+            The menu driver code saw an unknown request code.
+
+       E_NO_MATCH
+            Character failed to match.
+
+       E_NOT_SELECTABLE
+            The designated item cannot be selected.
+
+       E_NOT_CONNECTED
+            No items are connected to the menu.
+
+       E_REQUEST_DENIED
+            The menu driver could not process the request.
+
+
+
+

SEE ALSO

+       curses(3X) and 3X pages  whose  names  begin  "menu_"  for
+       detailed descriptions of the entry points.
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       files <curses.h> and <eti.h>.
+
+       In your library list, libmenu.a  should  be  before  libn-
+       curses.a; that is, you want to say `-lmenu -lncurses', not
+       the other way around (which would give you  a  link  error
+       using GNU ld(1) and many other linkers).
+
+
+
+

PORTABILITY

+       These  routines  emulate  the System V menu library.  They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual pages and adaptation for  ncurses
+       by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/menu_attribs.3x.html b/Ada95/html/menu_attribs.3x.html new file mode 100644 index 00000000..3bb11d64 --- /dev/null +++ b/Ada95/html/menu_attribs.3x.html @@ -0,0 +1,122 @@ + + +
+       menu_attributes - color and attribute control for menus
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int set_menu_fore(MENU *menu, chtype attr);
+       chtype menu_fore(const MENU *menu);
+       int set_menu_back(MENU *menu, chtype attr);
+       chtype menu_back(const MENU *menu);
+       int set_menu_grey(MENU *menu, chtype attr);
+       chtype menu_grey(const MENU *menu);
+       int set_menu_pad(MENU *menu, int pad);
+       int menu_pad(const MENU *menu);
+
+
+
+

DESCRIPTION

+       The  function  set_menu_fore sets the foreground attribute
+       of menu. This is the  highlight  used  for  selected  menu
+       items.   menu_fore  returns the foreground attribute.  The
+       default is A_STANDOUT.
+
+       The function set_menu_back sets the  background  attribute
+       of  menu.  This  is the highlight used for selectable (but
+       not  currently  selected)  menu   items.    The   function
+       menu_back  returns  the background attribute.  The default
+       is A_NORMAL.
+
+       The function set_menu_grey  sets  the  grey  attribute  of
+       menu.  This  is  the highlight used for un-selectable menu
+       items in menus that permit more than one  selection.   The
+       function   menu_grey  returns  the  grey  attribute.   The
+       default is A_UNDERLINE.
+
+       The function set_menu_pad sets the character used to  fill
+       the space between the name and description parts of a menu
+       item.  menu_pad returns the given  menu's  pad  character.
+       The default is a blank.
+
+
+
+

RETURN VALUE

+       These routines return one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine  detected  an incorrect or out-of-range argu-
+            ment.
+
+
+
+

SEE ALSO

+       curses(3X) and 3X pages  whose  names  begin  "menu_"  for
+       detailed descriptions of the entry points.
+
+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V  menu  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/menu_cursor.3x.html b/Ada95/html/menu_cursor.3x.html new file mode 100644 index 00000000..e65f687e --- /dev/null +++ b/Ada95/html/menu_cursor.3x.html @@ -0,0 +1,72 @@ + + +
+       menu_cursor - position a menu's cursor
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int pos_menu_cursor(const MENU *menu);
+
+
+
+

DESCRIPTION

+       The  function  pos_menu_cursor  restores the cursor to the
+       current position associated with the menu's selected item.
+       This  is  useful after curses routines have been called to
+       do screen-painting in response to a menu select.
+
+
+
+

RETURN VALUE

+       This routine returns one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+       E_NOT_POSTED
+            The menu has not been posted.
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V  menu  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/menu_driver.3x.html b/Ada95/html/menu_driver.3x.html new file mode 100644 index 00000000..81472363 --- /dev/null +++ b/Ada95/html/menu_driver.3x.html @@ -0,0 +1,176 @@ + + +
+       menu_driver - command-processing loop of the menu system
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int menu_driver(MENU *menu, int c);
+
+
+
+

DESCRIPTION

+       Once a menu has been posted (displayed), you should funnel
+       input events to it through menu_driver.  This routine  has
+       two  major input cases; either the input is a menu naviga-
+       tion request or it's a  printable  ASCII  character.   The
+       menu driver requests are as follows:
+
+       REQ_LEFT_ITEM
+            Move left to an item.
+
+       REQ_RIGHT_ITEM
+            Move right to an item.
+
+       REQ_UP_ITEM
+            Move up to an item.
+
+       REQ_DOWN_ITEM
+            Move down to an item.
+
+       REQ_SCR_ULINE
+            Scroll up a line.
+
+       REQ_SCR_DLINE
+            Scroll down a line.
+
+       REQ_SCR_DPAGE
+            Scroll down a page.
+
+       REQ_SCR_UPAGE
+            Scroll up a page.
+
+       REQ_FIRST_ITEM
+            Move to the first item.
+
+       REQ_LAST_ITEM
+            Move to the last item.
+
+       REQ_NEXT_ITEM
+            Move to the next item.
+
+       REQ_PREV_ITEM
+            Move to the previous item.
+
+       REQ_TOGGLE_ITEM
+            Select/deselect an item.
+
+            Clear the menu pattern buffer.
+
+       REQ_BACK_PATTERN
+            Delete   the  previous  character  from  the  pattern
+            buffer.
+
+       REQ_NEXT_MATCH
+            Move to the next item matching the pattern match.
+
+       REQ_PREV_MATCH
+            Move to the previous item matching the pattern match.
+
+       If the second argument is a printable ASCII character, the
+       code appends it to the pattern buffer and attempts to move
+       to the next item matching the new pattern.  If there is no
+       such match, menu_driver returns E_NO_MATCH and deletes the
+       appended character from the buffer.
+
+       If  the  second  argument  is one of the above pre-defined
+       requests, the corresponding action is performed.
+
+       If the second argument is neither printable ASCII nor  one
+       of  the above pre-defined menu requests, the drive assumes
+       it  is  an  application-specific   command   and   returns
+       E_UNKNOWN_COMMAND.  Application-defined commands should be
+       defined relative to  MAX_COMMAND,  the  maximum  value  of
+       these pre-defined requests.
+
+
+
+

RETURN VALUE

+       menu_driver return one of the following error codes:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine  detected  an incorrect or out-of-range argu-
+            ment.
+
+       E_BAD_STATE
+            Routine was called from an initialization or termina-
+            tion function.
+
+       E_NOT_POSTED
+            The menu has not been posted.
+
+       E_UNKNOWN_COMMAND
+            The menu driver code saw an unknown request code.
+
+       E_NO_MATCH
+            Character failed to match.
+            The menu driver could not process the request.
+
+
+
+

SEE ALSO

+       curses(3X), menus(3x).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       files <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V  menu  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/menu_format.3x.html b/Ada95/html/menu_format.3x.html new file mode 100644 index 00000000..4ab46deb --- /dev/null +++ b/Ada95/html/menu_format.3x.html @@ -0,0 +1,72 @@ + + +
+       menu_format - set and get menu sizes
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int set_menu_format(MENU *menu, int rows, int cols);
+       int menu_format(const MENU *menu, int *rows, int *cols);
+
+
+
+

DESCRIPTION

+       The function set_menu_format sets the maximum display size
+       of the given window.  If this size is too small to display
+       all menu items, the menu will be made scrollable.
+
+       The   default  format  is  16  rows,  1  column.   Calling
+       set_menu_format with a null menu pointer will change  this
+       default.  A zero row or column argument to set_menu_format
+       is interpreted as a request  not  to  change  the  current
+       value.
+
+       The  function  menu_format  returns  the maximum-size con-
+       straints for the given menu into the storage addressed  by
+       rows and cols.
+
+
+
+

RETURN VALUE

+       These routines returns one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine  detected  an incorrect or out-of-range argu-
+            ment.
+
+       E_POSTED
+            The menu is already posted.
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  emulate  the System V menu library.  They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+       curses by Eric S. Raymond.
+
+
+ + diff --git a/Ada95/html/menu_hook.3x.html b/Ada95/html/menu_hook.3x.html new file mode 100644 index 00000000..1f611114 --- /dev/null +++ b/Ada95/html/menu_hook.3x.html @@ -0,0 +1,124 @@ + + +
+       menu_hook - set hooks for automatic invocation by applica-
+       tions
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int set_item_init(MENU *menu, void (*func)(MENU *));
+       void (*)(MENU *) item_init(const MENU *menu);
+       int set_item_term(MENU *menu, void (*func)(MENU *));
+       void (*)(MENU *) item_term(const MENU *menu);
+       int set_menu_init(MENU *menu, void (*func)(MENU *));
+       void (*)(MENU *) menu_init(const MENU *menu);
+       int set_menu_term(MENU *menu, void (*func)(MENU *));
+       void (*)(MENU *) menu_term(const MENU *menu);
+
+
+
+

DESCRIPTION

+       These functions make it possible to set hook functions  to
+       be called at various points in the automatic processing of
+       input event codes by menu_driver.
+
+       The function set_item_init sets a hook  to  be  called  at
+       menu-post  time  and  each  time the selected item changes
+       (after the change).  item_init returns  the  current  item
+       init hook, if any (NULL if there is no such hook).
+
+       The  function  set_item_term  sets  a hook to be called at
+       menu-unpost time and each time the selected  item  changes
+       (before  the  change).  item_term returns the current item
+       term hook, if any (NULL if there is no such hook).
+
+       The function set_menu_init sets a hook  to  be  called  at
+       menu-post  time  and  just  after  the top row on the menu
+       changes once it is posted.  menu_init returns the  current
+       menu init hook, if any (NULL if there is no such hook).
+
+       The  function  set_menu_term  sets  a hook to be called at
+       menu-unpost time and just before the top row on  the  menu
+       changes  once it is posted.  menu_term returns the current
+       menu term hook, if any (NULL if there is no such hook).
+
+
+
+

RETURN VALUE

+       Routines that return pointers return NULL on error.  Other
+       routines return one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+
+
+
+

PORTABILITY

+       These routines emulate the System V  menu  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/menu_items.3x.html b/Ada95/html/menu_items.3x.html new file mode 100644 index 00000000..463ee587 --- /dev/null +++ b/Ada95/html/menu_items.3x.html @@ -0,0 +1,124 @@ + + +
+       menu_items  - make and break connections between items and
+       menus
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int set_menu_items(MENU *menu, ITEM **items);
+       ITEM **menu_items(const MENU *menu);
+       int item_count(const MENU *menu);
+
+
+
+

DESCRIPTION

+       The function set_menu_items changes the item pointer array
+       of  the  given  menu.   The  array must be terminated by a
+       NULL.
+
+       The function menu_items returns  the  item  array  of  the
+       given menu.
+
+       The  function  item_count  returns  the  count of items in
+       menu.
+
+
+
+

RETURN VALUES

+       The function menu_items returns NULL on error.
+
+       The function item_count returns ERR  (the  general  curses
+       error return value) on error.
+
+       The  function  set_menu_items returns one of the following
+       codes on error:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+       E_POSTED
+            The menu is already posted.
+
+       E_NOT_CONNECTED
+            No items are connected to the menu.
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+
+       The   SVr4   menu   library  documentation  specifies  the
+       item_count error value as -1 (which is the value of  ERR).
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/menu_mark.3x.html b/Ada95/html/menu_mark.3x.html new file mode 100644 index 00000000..d2e386f9 --- /dev/null +++ b/Ada95/html/menu_mark.3x.html @@ -0,0 +1,72 @@ + + +
+       menu_mark - get and set the menu mark string
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int set_menu_mark(MENU *menu, const char *mark);
+       const char *menu_mark(const MENU *menu);
+
+
+
+

DESCRIPTION

+       In  order  to make menu selections visible on older termi-
+       nals without highlighting or color  capability,  the  menu
+       library  marks  selected  items  in  a  menu with a prefix
+       string.
+
+       The function set_menu_mark sets the mark  string  for  the
+       given  menu.   Calling set_menu_mark with a null menu item
+       will abolish the mark  string.   Note  that  changing  the
+       length  of  the  mark  string for a menu while the menu is
+       posted is likely to produce unhelpful behavior.
+
+       The default string is "-" (a dash). Calling  set_menu_mark
+       with a NULL menu argument will change this default.
+
+       The  function menu_mark returns the menu's mark string (or
+       NULL if there is none).
+
+
+
+

RETURN VALUE

+       The function menu_mark returns NULL on error.   The  func-
+       tion set_menu_mark may return the following error codes:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine  detected  an incorrect or out-of-range argu-
+            ment.
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  emulate  the System V menu library.  They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+       curses by Eric S. Raymond.
+
+ + diff --git a/Ada95/html/menu_new.3x.html b/Ada95/html/menu_new.3x.html new file mode 100644 index 00000000..d125a476 --- /dev/null +++ b/Ada95/html/menu_new.3x.html @@ -0,0 +1,72 @@ + + +
+       menu_new - create and destroy menus
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       MENU *new_menu(ITEM **items);
+       int free_menu(MENU *menu);
+
+
+
+

DESCRIPTION

+       The  function  new_menu  creates a new menu connected to a
+       specified item pointer array (which  must  be  NULL-termi-
+       nated).
+
+       The  function  free_menu  disconnects  menu  from its item
+       array and frees the storage allocated for the menu.
+
+
+
+

RETURN VALUE

+       The function new_menu returns NULL on error.
+
+       The function free_menu returns one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+       E_POSTED
+            The menu has already been posted.
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V  menu  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/menu_opts.3x.html b/Ada95/html/menu_opts.3x.html new file mode 100644 index 00000000..2e4362ce --- /dev/null +++ b/Ada95/html/menu_opts.3x.html @@ -0,0 +1,124 @@ + + +
+       menu_opts - set and get menu options
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int set_menu_opts(MENU *menu, OPTIONS opts);
+       int menu_opts_on(MENU *menu, OPTIONS opts);
+       int menu_opts_off(MENU *menu, OPTIONS opts);
+       OPTIONS menu_opts(const MENU *menu);
+
+
+
+

DESCRIPTION

+       The  function  set_menu_opts  sets  all  the  given menu's
+       option bits  (menu  option  bits  may  be  logically-OR'ed
+       together).
+
+       The  function menu_opts_on turns on the given option bits,
+       and leaves others alone.
+
+       The function menu_opts_off  turns  off  the  given  option
+       bits, and leaves others alone.
+
+       The  function  menu_opts returns the menu's current option
+       bits.
+
+       The following options are defined (all are on by default):
+
+       O_ONEVALUE
+            Only one item can be selected for this menu.
+
+       O_SHOWDESC
+            Display  the  item  descriptions  when  the  menu  is
+            posted.
+
+       O_ROWMAJOR
+            Display the menu in row-major order.
+
+       O_IGNORECASE
+            Ignore the case when pattern-matching.
+
+       O_SHOWMATCH
+            Move the cursor to within the item  name  while  pat-
+            tern-matching.
+
+       O_NONCYCLIC
+            Don't   wrap   around  next-item  and  previous-item,
+            requests to the other end of the menu.
+
+
+
+

RETURN VALUE

+       Except for menu_opts, each routine returns one of the fol-
+       lowing:
+
+       E_OK The routine succeeded.
+
+            System error occurred (see errno).
+
+       E_POSTED
+            The menu is already posted.
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V  menu  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/menu_pattern.3x.html b/Ada95/html/menu_pattern.3x.html new file mode 100644 index 00000000..61286891 --- /dev/null +++ b/Ada95/html/menu_pattern.3x.html @@ -0,0 +1,72 @@ + + +
+       menu_pattern - get and set a menu's pattern buffer
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int set_menu_pattern(MENU *menu, const char *pattern);
+       char *menu_pattern(const MENU *menu);
+
+
+
+

DESCRIPTION

+       Every  menu  has  an  associated pattern match buffer.  As
+       input events that are printable ASCII characters come  in,
+       they  are  appended  to this match buffer and tested for a
+       match, as described in menu_driver(3x).
+
+       The function set_menu_pattern sets the pattern buffer  for
+       the  given menu and tries to find the first matching item.
+       If it succeeds, that item becomes  current;  if  not,  the
+       current item does not change.
+
+       The  function  menu_pattern  returns the pattern buffer of
+       the given menu.
+
+
+
+

RETURN VALUE

+       The function menu_pattern  returns  NULL  on  error.   The
+       function  set_menu_pattern  may return the following error
+       codes:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+       E_NO_MATCH
+            Character failed to match.
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V  menu  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+ + diff --git a/Ada95/html/menu_post.3x.html b/Ada95/html/menu_post.3x.html new file mode 100644 index 00000000..a181597f --- /dev/null +++ b/Ada95/html/menu_post.3x.html @@ -0,0 +1,122 @@ + + +
+       menu_post  -  write or erase menus from associated subwin-
+       dows
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int post_menu(MENU *menu);
+       int unpost_menu(MENU *menu);
+
+
+
+

DESCRIPTION

+       The function post_menu displays a menu to  its  associated
+       subwindow.   To trigger physical display of the subwindow,
+       use  refresh  or  some  equivalent  curses  routine   (the
+       implicit  doupdate  triggered  by  an curses input request
+       will do). post_menu resets the  selection  status  of  all
+       items.
+
+       The  function  unpost_menu erases menu from its associated
+       subwindow.
+
+
+
+

RETURN VALUE

+       These routines return one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+       E_POSTED
+            The menu has already been posted.
+
+       E_BAD_STATE
+            Routine was called from an initialization or termina-
+            tion function.
+
+       E_NO_ROOM
+            Menu is too large for its window.
+
+       E_NOT_POSTED
+            The menu has not been posted.
+
+       E_NOT_CONNECTED
+            No items are connected to the menu.
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       These  routines  emulate  the System V menu library.  They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/menu_requestname.3x.html b/Ada95/html/menu_requestname.3x.html new file mode 100644 index 00000000..25b3f545 --- /dev/null +++ b/Ada95/html/menu_requestname.3x.html @@ -0,0 +1,72 @@ + + +
+       menu_requestname - handle printable menu request names
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       const char *menu_request_name(int request);
+       int menu_request_by_name(const char *name);
+
+
+
+

DESCRIPTION

+       The  function menu_request_name returns the printable name
+       of a menu request code.
+       The function menu_request_by_name searches  in  the  name-
+       table  for  a  request with the given name and returns its
+       request code. Otherwise E_NO_MATCH is returned.
+
+
+
+

RETURN VALUE

+       menu_request_name returns NULL on error and sets errno  to
+       E_BAD_ARGUMENT.
+       menu_request_by_name returns E_NO_MATCH on error.
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines are specific to  ncurses.   They  were  not
+       supported  on  Version 7, BSD or System V implementations.
+       It is recommended that any code depending on them be  con-
+       ditioned using NCURSES_VERSION.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/menu_spacing.3x.html b/Ada95/html/menu_spacing.3x.html new file mode 100644 index 00000000..71b88170 --- /dev/null +++ b/Ada95/html/menu_spacing.3x.html @@ -0,0 +1,72 @@ + + +
+       menu_spacing - Control spacing between menu items.
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int set_menu_spacing(MENU *menu,
+                            int spc_description
+                            int spc_rows,
+                            int spc_columns);
+       int menu_spacing(const MENU *menu,
+                        int* spc_description
+                        int* spc_rows,
+                        int* spc_columns);
+
+
+
+

DESCRIPTION

+       The  function  set_menu_spacing  sets the spacing informa-
+       tions for the menu.  spc_description controls  the  number
+       of spaces between an item name and an item description. It
+       must not be larger than TABSIZE. The menu system  puts  in
+       the  middle  of  this  spacing area the pad character. The
+       remaining parts are filled with spaces.  spc_rows controls
+       the  number of rows that are used for an item. It must not
+       be larger than 3. The menu system inserts then blank lines
+       between  item rows, these lines will contain the pad char-
+       acter in the appropriate positions.  spc_columns  controls
+       the number of blanks between columns of items. It must not
+       be larger than TABSIZE.  A value of 0 for all the  spacing
+       values  resets  them to the default, which is 1 for all of
+       them.
+       The function menu_spacing passes back the spacing info for
+       the menu. If a pointer is NULL, this specific info is sim-
+       ply not returned.
+
+
+
+

RETURN VALUE

+       Both routines return E_OK on success. set_menu_spacing may
+       return  E_POSTED  if the menu is posted, or E_BAD_ARGUMENT
+       if one of the spacing values is out of range.
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  are  specific  to ncurses.  They were not
+       supported on Version 7, BSD or System  V  implementations.
+       It  is recommended that any code depending on them be con-
+       ditioned using NCURSES_VERSION.
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+
+ + diff --git a/Ada95/html/menu_userptr.3x.html b/Ada95/html/menu_userptr.3x.html new file mode 100644 index 00000000..85201592 --- /dev/null +++ b/Ada95/html/menu_userptr.3x.html @@ -0,0 +1,72 @@ + + +
+       menu_userptr - associate application data with a menu item
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int set_menu_userptr(MENU *menu, const void *userptr);
+       const void *menu_userptr(const MENU *menu);
+
+
+
+

DESCRIPTION

+       Every menu and every menu item has a  field  that  can  be
+       used to hold application-specific data (that is, the menu-
+       driver code leaves it alone).  These functions get and set
+       the menu user pointer field.
+
+
+
+

RETURN VALUE

+       Except  for  menu_userptr  (which  returns NULL on error),
+       each function returns one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  emulate  the System V menu library.  They
+       were not supported on Version 7 or BSD versions.
+
+       The user pointer should be a void pointer.  We leave it as
+       a char pointer for SVr4 compatibility.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/menu_win.3x.html b/Ada95/html/menu_win.3x.html new file mode 100644 index 00000000..08b0517c --- /dev/null +++ b/Ada95/html/menu_win.3x.html @@ -0,0 +1,122 @@ + + +
+       menu_win  - make and break menu window and subwindow asso-
+       ciations
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int set_menu_win(MENU *menu, WINDOW *win);
+       WINDOW *menu_win(const MENU *menu);
+       int set_menu_sub(MENU *menu, WINDOW *sub);
+       WINDOW *menu_sub(const MENU *menu);
+       int scale_menu(const MENU *menu, int *rows, int *columns);
+
+
+
+

DESCRIPTION

+       Every  menu has an associated pair of curses windows.  The
+       menu window displays any title and border associated  with
+       the  window;  the menu subwindow displays the items of the
+       menu that are currently available for selection.
+
+       The first four functions get and set those windows.  It is
+       not necessary to set either window; by default, the driver
+       code uses stdscr for both.
+
+       In the set_ functions, window argument of NULL is  treated
+       as  though  it  were  stsdcr.   A menu argument of NULL is
+       treated as a request to change  the  system  default  menu
+       window or subwindow.
+
+       The  function scale_menu returns the minimum size required
+       for the subwindow of menu.
+
+
+
+

RETURN VALUE

+       Routines that return pointers return NULL on error.   Rou-
+       tines  that  return an integer return one of the following
+       error codes:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+       E_POSTED
+            The menu has already been posted.
+
+       E_NOT_CONNECTED
+            No items are connected to the menu.
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V  menu  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/mitem_current.3x.html b/Ada95/html/mitem_current.3x.html new file mode 100644 index 00000000..d5cacd70 --- /dev/null +++ b/Ada95/html/mitem_current.3x.html @@ -0,0 +1,122 @@ + + +
+       mitem_current - set and get current_menu_item
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int set_current_item(MENU *menu, const ITEM *item);
+       ITEM *current_item(const MENU *menu);
+       int set_top_row(MENU *menu, int row);
+       int top_row(const MENU *menu);
+       int item_index(const ITEM *item);
+
+
+
+

DESCRIPTION

+       The  function  set_current_item sets the current item (the
+       item on  which  the  menu  cursor  is  positioned).   cur-
+       rent_item  returns  a  pointer  to the current item in the
+       given menu.
+
+       The function set_top_row sets the top row of the  menu  to
+       show  the  given  row  (the top row is initially 0, and is
+       reset to this value whenever the O_ROWMAJOR option is tog-
+       gled).   The  item  leftmost on the given row becomes cur-
+       rent.  The function top_row returns the number of the  top
+       menu row being displayed.
+
+       The function item_index returns the (zero-origin) index of
+       item in the menu's item pointer list.
+
+
+
+

RETURN VALUE

+       current_item returns NULL on error.
+
+       top_row and item_index  return  ERR  (the  general  curses
+       error value) on error.
+
+       set_current_item and set_top_row return one of the follow-
+       ing:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine detected an incorrect or  out-of-range  argu-
+            ment.
+
+       E_BAD_STATE
+            Routine was called from an initialization or termina-
+            tion function.
+
+       E_NOT_CONNECTED
+            No items are connected to the menu.
+
+
+
+

SEE ALSO

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  emulate  the System V menu library.  They
+       were not supported on Version 7 or BSD versions.
+
+       The SVr4 menu library documentation specifies the  top_row
+       and  index_item  error  value as -1 (which is the value of
+       ERR).
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/mitem_name.3x.html b/Ada95/html/mitem_name.3x.html new file mode 100644 index 00000000..7af9608d --- /dev/null +++ b/Ada95/html/mitem_name.3x.html @@ -0,0 +1,72 @@ + + +
+       mitem_name - get menu item name and description fields
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       const char *item_name(const ITEM *item);
+       const char *item_description(const ITEM *item);
+
+
+
+

DESCRIPTION

+       The  function item_name returns the name part of the given
+       item.
+       The function item_description returns the description part
+       of the given item.
+
+
+
+

RETURN VALUE

+       These routines returns NULL on error.
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V  menu  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/mitem_new.3x.html b/Ada95/html/mitem_new.3x.html new file mode 100644 index 00000000..54e4b030 --- /dev/null +++ b/Ada95/html/mitem_new.3x.html @@ -0,0 +1,72 @@ + + +
+       mitem_new - create and destroy menu items
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       ITEM *new_item(const char *name, const char *description);
+       int free_item(ITEM *item);
+
+
+
+

DESCRIPTION

+       The function new_item allocates a new item and initializes
+       it from the name and description pointers.
+       The function free_item de-allocates an item.
+
+
+
+

RETURN VALUE

+       The function new_item returns NULL on error.
+
+       The function free_item returns one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_BAD_ARGUMENT
+            Routine  detected  an incorrect or out-of-range argu-
+            ment.
+
+       E_CONNECTED
+            Item is connected to a menu.
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  emulate  the System V menu library.  They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/mitem_opts.3x.html b/Ada95/html/mitem_opts.3x.html new file mode 100644 index 00000000..02fd97e0 --- /dev/null +++ b/Ada95/html/mitem_opts.3x.html @@ -0,0 +1,72 @@ + + +
+       mitem_opts - set and get menu item options
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int set_item_opts(ITEM *item, OPTIONS opts);
+       int item_opts_on(ITEM *item, OPTIONS opts);
+       int item_opts_off(ITEM *item, OPTIONS opts);
+       OPTIONS item_opts(const ITEM *item);
+
+
+
+

DESCRIPTION

+       The  function  set_item_opts  sets  all  the  given item's
+       option bits  (menu  option  bits  may  be  logically-OR'ed
+       together).
+
+       The  function item_opts_on turns on the given option bits,
+       and leaves others alone.
+
+       The function item_opts_off  turns  off  the  given  option
+       bits, and leaves others alone.
+
+       The  function  item_opts returns the item's current option
+       bits.
+
+       There is only one defined option bit  mask,  O_SELECTABLE.
+       When this is on, the item may be selected during menu pro-
+       cessing.  This option defaults to on.
+
+
+
+

RETURN VALUE

+       Except for item_opts, each routine returns one of the fol-
+       lowing:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These routines emulate the System V  menu  library.   They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+ + diff --git a/Ada95/html/mitem_userptr.3x.html b/Ada95/html/mitem_userptr.3x.html new file mode 100644 index 00000000..8f8b5ef4 --- /dev/null +++ b/Ada95/html/mitem_userptr.3x.html @@ -0,0 +1,72 @@ + + +
+       mitem_userptr  -  associate  application  data with a menu
+       item
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int set_item_userptr(ITEM *item, const void *userptr);
+       const void *item_userptr(const ITEM *item);
+
+
+
+

DESCRIPTION

+       Every menu item has a field  that  can  be  used  to  hold
+       application-specific  data  (that is, the menu-driver code
+       leaves it alone).  These functions get and set that field.
+
+
+
+

RETURN VALUE

+       Except  for  item_userptr  (which  returns NULL on error),
+       each function returns one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  emulate  the System V menu library.  They
+       were not supported on Version 7 or BSD versions.
+
+       The user pointer should be a void pointer.  We leave it as
+       a char pointer for SVr4 compatibility.
+
+
+
+

AUTHORS

+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/mitem_value.3x.html b/Ada95/html/mitem_value.3x.html new file mode 100644 index 00000000..de0bd079 --- /dev/null +++ b/Ada95/html/mitem_value.3x.html @@ -0,0 +1,72 @@ + + +
+       mitem_value - set and get menu item values
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       int set_item_value(ITEM *item, bool value);
+       bool item_value(const ITEM *item);
+
+
+
+

DESCRIPTION

+       If  you  turn  off  the menu option O_ONEVALUE (e.g., with
+       set_menu_opts or menu_opts_off;  see  menu_opts(3x)),  the
+       menu becomes multi-valued; that is, more than one item may
+       simultaneously be selected.
+
+       In a multi_valued menu, you  can  used  set_item_value  to
+       select the given menu item (second argument TRUE) or dese-
+       lect it (second argument FALSE).
+
+
+
+

RETURN VALUE

+       The function set_item_value returns one of the following:
+
+       E_OK The routine succeeded.
+
+       E_SYSTEM_ERROR
+            System error occurred (see errno).
+
+       E_REQUEST_DENIED
+            The menu driver could not process the request.
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  emulate  the System V menu library.  They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/mitem_visible.3x.html b/Ada95/html/mitem_visible.3x.html new file mode 100644 index 00000000..cf4d67cc --- /dev/null +++ b/Ada95/html/mitem_visible.3x.html @@ -0,0 +1,70 @@ + + +
+       mitem_visible - check visibility of a menu item
+
+
+
+

SYNOPSIS

+       #include <menu.h>
+       bool item_visible(const ITEM *item);
+
+
+
+

DESCRIPTION

+       A  menu  item  is  visible  when it is in the portion of a
+       posted menu that is mapped onto the screen (if the menu is
+       scrollable,  in  particular,  this portion will be smaller
+       than the whole menu).
+
+
+
+

SEE ALSO

+       curses(3X), menu(3X).
+
+
+
+

NOTES

+       The header file <menu.h> automatically includes the header
+       file <curses.h>.
+
+
+
+

PORTABILITY

+       These  routines  emulate  the System V menu library.  They
+       were not supported on Version 7 or BSD versions.
+
+
+
+

AUTHORS

+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+       curses by Eric S. Raymond.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/ncurses.3x.html b/Ada95/html/ncurses.3x.html new file mode 100644 index 00000000..0db3fafb --- /dev/null +++ b/Ada95/html/ncurses.3x.html @@ -0,0 +1,490 @@ + + +
+       ncurses - CRT screen handling and optimization package
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+
+
+

DESCRIPTION

+       The curses library routines give the user a terminal-inde-
+       pendent method of updating character screens with  reason-
+       able  optimization.  This implementation is ``new curses''
+       (ncurses) and is the approved replacement for 4.4BSD clas-
+       sic curses, which has been discontinued.
+
+       The  ncurses  routines  emulate  the curses(3X) library of
+       System V Release 4 UNIX, and the XPG4 curses standard (XSI
+       curses)  but the ncurses library is freely redistributable
+       in source form.  Differences from the SVr4 curses are sum-
+       marized  under  the EXTENSIONS and BUGS sections below and
+       described in detail in the EXTENSIONS and BUGS sections of
+       individual man pages.
+
+       A  program  using  these  routines must be linked with the
+       -lncurses option, or (if it has been generated)  with  the
+       debugging  library  -lncurses_g.   (Your system integrator
+       may also have installed these libraries  under  the  names
+       -lcurses and -lcurses_g.)  The ncurses_g library generates
+       trace logs (in a file called 'trace' in the current direc-
+       tory) that describe curses actions.
+
+       The  ncurses  package supports: overall screen, window and
+       pad manipulation; output to windows and pads; reading ter-
+       minal  input;  control  over terminal and curses input and
+       output options; environment query routines; color  manipu-
+       lation; use of soft label keys; terminfo capabilities; and
+       access to low-level terminal-manipulation routines.
+
+       To initialize the routines, the routine initscr or newterm
+       must  be called before any of the other routines that deal
+       with windows and screens are  used.   The  routine  endwin
+       must be called before exiting.  To get character-at-a-time
+       input without echoing (most interactive,  screen  oriented
+       programs  want  this),  the  following  sequence should be
+       used:
+
+             initscr(); cbreak(); noecho();
+
+       Most programs would additionally use the sequence:
+
+             nonl();
+             intrflush(stdscr, FALSE);
+             keypad(stdscr, TRUE);
+
+       Before a curses program is run, the tab stops of the  ter-
+       the tput init command after the shell environment variable
+       TERM has been exported.  tset(1)  is  usually  responsible
+       for doing this.  [See terminfo(5) for further details.]
+
+       The  curses  library  permits  manipulation of data struc-
+       tures, called windows, which can be  thought  of  as  two-
+       dimensional  arrays of characters representing all or part
+       of a CRT screen.  A default window called stdscr, which is
+       the  size of the terminal screen, is supplied.  Others may
+       be created with newwin.
+
+       Note that curses  does  not  handle  overlapping  windows,
+       that's done by the panels(3x) library. This means that you
+       can either use stdscr or divide the screen into tiled win-
+       dows  and  not  using  stdscr  at all. Mixing the two will
+       result in unpredictable, and undesired, effects.
+
+       Windows are referred to by variables declared as WINDOW *.
+       These   data  structures  are  manipulated  with  routines
+       described here and elsewhere in the ncurses manual  pages.
+       Among  which  the  most basic routines are move and addch.
+       More general versions of these routines are included  with
+       names  beginning  with  w,  allowing the user to specify a
+       window.  The routines not beginning with w affect stdscr.)
+
+       After  using  routines  to manipulate a window, refresh is
+       called, telling curses to make the user's CRT screen  look
+       like  stdscr.   The characters in a window are actually of
+       type chtype, (character and attribute data) so that  other
+       information  about  the  character may also be stored with
+       each character.
+
+       Special windows  called  pads  may  also  be  manipulated.
+       These are windows which are not constrained to the size of
+       the screen and whose contents need not be completely  dis-
+       played.  See curs_pad(3X) for more information.
+
+       In  addition  to  drawing  characters on the screen, video
+       attributes and colors may be supported, causing the  char-
+       acters  to show up in such modes as underlined, in reverse
+       video, or in color on terminals that support such  display
+       enhancements.  Line drawing characters may be specified to
+       be output.  On input, curses is  also  able  to  translate
+       arrow  and  function  keys  that transmit escape sequences
+       into single values.  The video  attributes,  line  drawing
+       characters,   and  input  values  use  names,  defined  in
+       <curses.h>, such as A_REVERSE, ACS_HLINE, and KEY_LEFT.
+
+       If the environment variables LINES and COLUMNS are set, or
+       if  the program is executing in a window environment, line
+       and column information in the  environment  will  override
+       information read by terminfo.  This would effect a program
+
+       If  the environment variable TERMINFO is defined, any pro-
+       gram using curses checks for a local  terminal  definition
+       before  checking  in  the standard place.  For example, if
+       TERM is set to att4424, then the compiled terminal defini-
+       tion is found in
+
+             @DATADIR@/terminfo/a/att4424.
+
+       (The a is copied from the first letter of att4424 to avoid
+       creation of huge directories.)  However,  if  TERMINFO  is
+       set to $HOME/myterms, curses first checks
+
+             $HOME/myterms/a/att4424,
+
+       and if that fails, it then checks
+
+             @DATADIR@/terminfo/a/att4424.
+
+       This  is useful for developing experimental definitions or
+       when write permission in @DATADIR@/terminfo is not  avail-
+       able.
+
+       The  integer  variables  LINES  and  COLS  are  defined in
+       <curses.h> and will be filled in by initscr with the  size
+       of the screen.  The constants TRUE and FALSE have the val-
+       ues 1 and 0, respectively.
+
+       The curses routines also  define  the  WINDOW  *  variable
+       curscr which is used for certain low-level operations like
+       clearing and redrawing a screen containing  garbage.   The
+       curscr can be used in only a few routines.
+
+
+   Routine and Argument Names
+       Many  curses routines have two or more versions.  The rou-
+       tines prefixed with w require a window argument.  The rou-
+       tines prefixed with p require a pad argument.  Those with-
+       out a prefix generally use stdscr.
+
+       The routines prefixed with mv require a y and x coordinate
+       to  move to before performing the appropriate action.  The
+       mv routines imply a call to move before the  call  to  the
+       other  routine.  The coordinate y always refers to the row
+       (of the window), and x always refers to the  column.   The
+       upper left-hand corner is always (0,0), not (1,1).
+
+       The routines prefixed with mvw take both a window argument
+       and x and y coordinates.  The window  argument  is  always
+       specified before the coordinates.
+
+       In  each  case, win is the window affected, and pad is the
+
+       Option setting routines require a Boolean flag bf with the
+       value TRUE or FALSE; bf is always of type bool.  The vari-
+       ables  ch  and attrs below are always of type chtype.  The
+       types WINDOW, SCREEN, bool,  and  chtype  are  defined  in
+       <curses.h>.   The  type  TERMINAL  is defined in <term.h>.
+       All other arguments are integers.
+
+
+   Routine Name Index
+       The following table lists each curses routine and the name
+       of  the  manual  page  on which it is described.  Routines
+       flagged with `*' are ncurses-specific,  not  described  by
+       XPG4 or present in SVr4.
+
+       center  tab(/); l l l l .  curses Routine Name/Manual Page
+       Name  =  addch/curs_addch(3X)  addchnstr/curs_addchstr(3X)
+       addchstr/curs_addchstr(3X)         addnstr/curs_addstr(3X)
+       addstr/curs_addstr(3X)               attroff/curs_attr(3X)
+       attron/curs_attr(3X)       attrset/curs_attr(3X)      bau-
+       drate/curs_termattrs(3X)                beep/curs_beep(3X)
+       bkgd/curs_bkgd(3X)  bkgdset/curs_bkgd(3X) border/curs_bor-
+       der(3X)                                box/curs_border(3X)
+       can_change_color/curs_color(3X)     cbreak/curs_inopts(3X)
+       clear/curs_clear(3X)    clearok/curs_outopts(3X)    clrto-
+       bot/curs_clear(3X)    clrtoeol/curs_clear(3X)   color_con-
+       tent/curs_color(3X)               copywin/curs_overlay(3X)
+       curs_set/curs_kernel(3X)     def_prog_mode/curs_kernel(3X)
+       def_shell_mode/curs_kernel(3X)       del_curterm/curs_ter-
+       minfo(3X)  delay_output/curs_util(3X) delch/curs_delch(3X)
+       deleteln/curs_deleteln(3X) delscreen/curs_initscr(3X) del-
+       win/curs_window(3X)      derwin/curs_window(3X)      doup-
+       date/curs_refresh(3X)               dupwin/curs_window(3X)
+       echo/curs_inopts(3X)      echochar/curs_addch(3X)     end-
+       win/curs_initscr(3X)                  erase/curs_clear(3X)
+       erasechar/curs_termattrs(3X)          filter/curs_util(3X)
+       flash/curs_beep(3X)     flushinp/curs_util(3X)      getbe-
+       gyx/curs_getyx(3X)        getch/curs_getch(3X)        get-
+       maxyx/curs_getyx(3X)     getmouse/curs_mouse(3X)*     get-
+       paryx/curs_getyx(3X)      getstr/curs_getstr(3X)      get-
+       syx/curs_kernel(3X)                   getwin/curs_util(3X)
+       getyx/curs_getyx(3X)   halfdelay/curs_inopts(3X)  has_col-
+       ors/curs_color(3X)               has_ic/curs_termattrs(3X)
+       has_il/curs_termattrs(3X)          has_key/curs_getch(3X)*
+       hline/curs_border(3X)               idcok/curs_outopts(3X)
+       idlok/curs_outopts(3X)            immedok/curs_outopts(3X)
+       inch/curs_inch(3X)     inchnstr/curs_inchstr(3X)     inch-
+       str/curs_inchstr(3X)             init_color/curs_color(3X)
+       init_pair/curs_color(3X)          initscr/curs_initscr(3X)
+       innstr/curs_instr(3X)       insch/curs_insch(3X)      ins-
+       delln/curs_deleteln(3X)         insertln/curs_deleteln(3X)
+       insnstr/curs_insstr(3X)             insstr/curs_insstr(3X)
+       isendwin/curs_initscr(3X)    keyname/curs_util(3X)    key-
+       pad/curs_inopts(3X)            killchar/curs_termattrs(3X)
+       leaveok/curs_outopts(3X)       longname/curs_termattrs(3X)
+       mcprint/curs_print(3X)*  meta/curs_inopts(3X)  mouseinter-
+       val/curs_mouse(3X)*              mousemask/curs_mouse(3X)*
+       move/curs_move(3X)     mvaddch/curs_addch(3X)    mvaddchn-
+       str/curs_addchstr(3X)         mvaddchstr/curs_addchstr(3X)
+       mvaddnstr/curs_addstr(3X)         mvaddstr/curs_addstr(3X)
+       mvcur/curs_terminfo(3X)   mvdelch/curs_delch(3X)    mvder-
+       win/curs_window(3X)      mvgetch/curs_getch(3X)     mvget-
+       str/curs_getstr(3X)     mvinch/curs_inch(3X)      mvinchn-
+       str/curs_inchstr(3X)            mvinchstr/curs_inchstr(3X)
+       mvinnstr/curs_instr(3X)    mvinsch/curs_insch(3X)    mvin-
+       snstr/curs_insstr(3X)    mvinsstr/curs_insstr(3X)    mvin-
+       str/curs_instr(3X)      mvprintw/curs_printw(3X)      mvs-
+       canw/curs_scanw(3X)   mvwaddch/curs_addch(3X)   mvwaddchn-
+       str/curs_addchstr(3X)        mvwaddchstr/curs_addchstr(3X)
+       mvwaddnstr/curs_addstr(3X)       mvwaddstr/curs_addstr(3X)
+       mvwdelch/curs_delch(3X)  mvwgetch/curs_getch(3X)   mvwget-
+       str/curs_getstr(3X)                  mvwin/curs_window(3X)
+       mvwinch/curs_inch(3X)         mvwinchnstr/curs_inchstr(3X)
+       mvwinchstr/curs_inchstr(3X)       mvwinnstr/curs_instr(3X)
+       mvwinsch/curs_insch(3X)         mvwinsnstr/curs_insstr(3X)
+       mvwinsstr/curs_insstr(3X)   mvwinstr/curs_instr(3X)   mvw-
+       printw/curs_printw(3X)             mvwscanw/curs_scanw(3X)
+       napms/curs_kernel(3X)                  newpad/curs_pad(3X)
+       newterm/curs_initscr(3X)            newwin/curs_window(3X)
+       nl/curs_outopts(3X)     nocbreak/curs_inopts(3X)     node-
+       lay/curs_inopts(3X) noecho/curs_inopts(3X)  nonl/curs_out-
+       opts(3X)  noqiflush/curs_inopts(3X)  noraw/curs_inopts(3X)
+       notimeout/curs_inopts(3X)  overlay/curs_overlay(3X)  over-
+       write/curs_overlay(3X)         pair_content/curs_color(3X)
+       pechochar/curs_pad(3X)   pnoutrefresh/curs_pad(3X)    pre-
+       fresh/curs_pad(3X)  printw/curs_printw(3X)  putp/curs_ter-
+       minfo(3X)   putwin/curs_util(3X)   qiflush/curs_inopts(3X)
+       raw/curs_inopts(3X)             redrawwin/curs_refresh(3X)
+       refresh/curs_refresh(3X)   reset_prog_mode/curs_kernel(3X)
+       reset_shell_mode/curs_kernel(3X)   resetty/curs_kernel(3X)
+       resizeterm/resizeterm(3x)*   restartterm/curs_terminfo(3X)
+       ripoffline/curs_kernel(3X)         savetty/curs_kernel(3X)
+       scanw/curs_scanw(3X)            scr_dump/curs_scr_dump(3X)
+       scr_init/curs_scr_dump(3X)   scr_restore/curs_scr_dump(3X)
+       scr_set/curs_scr_dump(3X)             scrl/curs_scroll(3X)
+       scroll/curs_scroll(3X)           scrollok/curs_outopts(3X)
+       set_curterm/curs_terminfo(3X)    set_term/curs_initscr(3X)
+       setscrreg/curs_outopts(3X)   setsyx/curs_kernel(3X)   set-
+       term/curs_terminfo(3X)         setupterm/curs_terminfo(3X)
+       slk_attr/curs_slk(3X)*            slk_attroff/curs_slk(3X)
+       slk_attron/curs_slk(3X)           slk_attrset/curs_slk(3X)
+       slk_clear/curs_slk(3X)               slk_init/curs_slk(3X)
+       slk_label/curs_slk(3X)        slk_noutrefresh/curs_slk(3X)
+       slk_refresh/curs_slk(3X)          slk_restore/curs_slk(3X)
+       start_color/curs_color(3X)    subpad/curs_pad(3X)     sub-
+       win/curs_window(3X)     syncok/curs_window(3X)     termat-
+       trs/curs_termattrs(3X)  termname/curs_termattrs(3X)   tge-
+       tent/curs_termcap(3X)    tgetflag/curs_termcap(3X)   tget-
+       num/curs_termcap(3X)              tgetstr/curs_termcap(3X)
+       tgoto/curs_termcap(3X)  tigetflag/curs_terminfo(3X) tiget-
+       num/curs_terminfo(3X)   tigetstr/curs_terminfo(3X)   time-
+       out/curs_inopts(3X)     touchline/curs_touch(3X)    touch-
+       win/curs_touch(3X)                 tparm/curs_terminfo(3X)
+       tputs/curs_termcap(3X)    tputs/curs_terminfo(3X)   typea-
+       head/curs_inopts(3X)                  unctrl/curs_util(3X)
+       ungetch/curs_getch(3X) ungetmouse/curs_mouse(3X)* untouch-
+       win/curs_touch(3X) use_env/curs_util(3X) vidattr/curs_ter-
+       minfo(3X)  vidputs/curs_terminfo(3X) vline/curs_border(3X)
+       vwprintw/curs_printw(3X)    vwscanw/curs_scanw(3X)    wad-
+       dch/curs_addch(3X)   waddchnstr/curs_addchstr(3X)  waddch-
+       str/curs_addchstr(3X)             waddnstr/curs_addstr(3X)
+       waddstr/curs_addstr(3X)     wattroff/curs_attr(3X)    wat-
+       tron/curs_attr(3X)                  wattrset/curs_attr(3X)
+       wbkgd/curs_bkgd(3X)      wbkgdset/curs_bkgd(3X)      wbor-
+       der/curs_border(3X)     wclear/curs_clear(3X)      wclrto-
+       bot/curs_clear(3X)    wclrtoeol/curs_clear(3X)    wcursyn-
+       cup/curs_window(3X)                  wdelch/curs_delch(3X)
+       wdeleteln/curs_deleteln(3X)  wechochar/curs_addch(3X) wen-
+       close/curs_mouse(3X)*                werase/curs_clear(3X)
+       wgetch/curs_getch(3X)    wgetnstr/curs_getstr(3X)    wget-
+       str/curs_getstr(3X)                 whline/curs_border(3X)
+       winch/curs_inch(3X)    winchnstr/curs_inchstr(3X)   winch-
+       str/curs_inchstr(3X)      winnstr/curs_instr(3X)      win-
+       sch/curs_insch(3X)     winsdelln/curs_deleteln(3X)    win-
+       sertln/curs_deleteln(3X)          winsnstr/curs_insstr(3X)
+       winsstr/curs_insstr(3X)              winstr/curs_instr(3X)
+       wmove/curs_move(3X)          wnoutrefresh/curs_refresh(3X)
+       wprintw/curs_printw(3X)   wredrawln/curs_refresh(3X)  wre-
+       fresh/curs_refresh(3X)                wresize/wresize(3x)*
+       wscanw/curs_scanw(3X)    wscrl/curs_scroll(3X)    wsetscr-
+       reg/curs_outopts(3X)    wstandend/curs_attr(3X)    wstand-
+       out/curs_attr(3X)      wsyncdown/curs_window(3X)     wsyn-
+       cup/curs_window(3X)               wtimeout/curs_inopts(3X)
+       wtouchln/curs_touch(3X) wvline/curs_border(3X)
+
+
+
+

RETURN VALUE

+       Routines  that  return  an integer return ERR upon failure
+       and an integer value other than ERR upon  successful  com-
+       pletion,  unless  otherwise  noted in the routine descrip-
+       tions.
+
+       All macros return the  value  of  the  w  version,  except
+       setscrreg,  wsetscrreg,  getyx,  getbegyx,  getmaxyx.  The
+       return values of setscrreg, wsetscrreg,  getyx,  getbegyx,
+       and getmaxyx are undefined (i.e., these should not be used
+       as the right-hand side of assignment statements).
+
+
+
+

SEE ALSO

+       terminfo(5) and 3X pages whose  names  begin  "curs_"  for
+       detailed routine descriptions.
+
+
+
+

EXTENSIONS

+       The curses library can be compiled with an option (-DTERM-
+       CAP_FILE) that falls back to  the  old-style  /etc/termcap
+       file  if  the  terminal  setup code cannot find a terminfo
+       entry corresponding to TERM.  Use of this feature  is  not
+       recommended,  as it essentially includes an entire termcap
+       compiler in the curses startup code, at  significant  cost
+       in core and startup cycles.
+
+       Compiling  with  -DTERMCAP_FILE changes the library's ini-
+       tialization sequence in a way intended to mimic the behav-
+       ior of 4.4BSD curses.  If there is no local or system ter-
+       minfo entry matching TERM,  then  the  library  looks  for
+       termcap  entries  in the following places: (1) if TERMINFO
+       is undefined, in the file named by  TERMCAP_FILE;  (2)  if
+       TERMINFO  is defined and begins with a slash, it is inter-
+       preted as the name of a termcap file to search  for  TERM;
+       (3) otherwise, if TERMINFO has a leading string that looks
+       like a terminal entry name list, and it matches TERM,  the
+       contents  of  TERMINFO is interpreted as a termcap; (4) if
+       TERMINFO looks like a termcap but doesn't match TERM,  the
+       termcap  file  is  searched  for among the colon-separated
+       paths in the environment variable  TERMPATHS  if  that  is
+       defined,  and  in  ~/.termcap  and the file value of TERM-
+       CAP_FILE otherwise.
+
+       Versions of curses compiled on PC clones  support  display
+       of  the  PC ROM characters (including ROM characters 0-31,
+       which stock SVr4 curses cannot display).  See  the  EXTEN-
+       SIONS sections of curs_addch(3x) and curs_attr(3x).
+
+       The curses library includes facilities for capturing mouse
+       events on certain terminals  (including  xterm).  See  the
+       curs_mouse(3X) manual page for details.
+
+       The  curses  library  includes  a  function  for directing
+       application output to a printer attached to  the  terminal
+       device.  See the curs_print(3X) manual page for details.
+
+
+
+

PORTABILITY

+       The curses library is intended to be BASE-level conformant
+       with the XSI Curses standard.   Certain  portions  of  the
+       EXTENDED  XSI  Curses  functionality (including color sup-
+       port) are supported.  The following  EXTENDED  XSI  Curses
+       calls  in  support  of wide (multibyte) characters are not
+       yet implemented: addnwstr, addwstr, mvaddnwstr,  mvwaddnw-
+       str,  mvaddwstr,  waddnwstr,  waddwstr, add_wch, wadd_wch,
+       mvwadd_wchnstr,  mvwadd_wchstr,  bkgrndset,  bkgrnd,  get-
+       bkgrnd, wbkgrnd, wbkgrndset, wgetbkgrnd, border_set, wbor-
+       der_set,  box_set,  hline_set,  mvhline_set,  mvvline_set,
+       mvwhline_set,    mvwvline_set,   whline_set,   vhline_set,
+       wvline_set,  echo_wchar,  wecho_wchar,  erasewchar,  kill-
+       wchar,    get_wch,    mvget_wch,    mvwget_ch,   wget_wch,
+       getwchtype, get_wstr,  getn_wstr,  wget_wstr,  wgetn_wstr,
+       mvget_wstr,  mvgetn_wstr, mvwget_wstr, mvwgetn_wstr, innw-
+       str,  inwstr,  winnwstr,  winwstr,  mvinnwstr,   mvinwstr,
+       mvwinnwstr,  mvwinwstr,  ins_nwstr, ins_wstr, mvins_nwstr,
+       mvins_wstr,   mvwins_nwstr,    mvwins_wstr,    wins_nwstr,
+       wins_wstr,   ins_wch,   wins_wch,  mvins_wch,  mvwins_wch,
+       in_wch, win_wch, mvin_wch, mvwin_wch, inwchstr, inwchnstr,
+       winwchstr,  winwchnstr,  mvinwchstr, mvinwchnstr, mvinwch-
+       str, mvwinwchnstr.
+
+       A small number of local differences (that  is,  individual
+       differences  between  the XSI Curses and curses calls) are
+       described in  PORTABILITY  sections  of  the  library  man
+       pages.
+
+       The routine has_key is not part of XPG4, nor is it present
+       in SVr4.  See the curs_getch(3X) manual page for  details.
+
+       The  routine  slk_attr is not part of XPG4, nor is it pre-
+       sent in  SVr4.   See  the  curs_slk(3X)  manual  page  for
+       details.
+
+       The  routines getmouse, mousemask, ungetmouse, mouseinter-
+       val, and wenclose relating to mouse  interfacing  are  not
+       part  of  XPG4,  nor  are  they  present in SVr4.  See the
+       curs_mouse(3X) manual page for details.
+
+       The routine mcprint was not present in any previous curses
+       implementation.   See  the  curs_print(3X) manual page for
+       details.
+
+       The routine wresize is not part of XPG4, nor is it present
+       in SVr4.  See the wresize(3X) manual page for details.
+
+       In  historic curses versions, delays embedded in the capa-
+       bilities cr, ind, cub1, ff and tab activated corresponding
+       delay  bits  in  the UNIX tty driver.  In this implementa-
+       tion, all padding is done by NUL sends.   This  method  is
+       slightly  more expensive, but narrows the interface to the
+       UNIX kernel  significantly  and  increases  the  package's
+       portability correspondingly.
+
+       In  the  XSI  standard  and  SVr4 manual pages, many entry
+       points have prototype arguments of the for char *const (or
+       cchar_t  *const,  or  wchar_t  *const,  or  void  *const).
+       Depending on one's interpretation of the ANSI  C  standard
+       tion const char *x is a modifiable pointer to unmodifiable
+       data, but char *const x' is  an  unmodifiable  pointer  to
+       modifiable  data.  Given that C passes arguments by value,
+       <type> *const as a formal type is at best  dubious.   Some
+       compilers  choke  on  the  prototypes.  Therefore, in this
+       implementation, they have been changed to const  <type>  *
+       globally.
+
+
+
+

NOTES

+       The  header  file  <curses.h>  automatically  includes the
+       header files <stdio.h> and <unctrl.h>.
+
+       If standard output from a curses program is re-directed to
+       something  which  is  not  a  tty,  screen updates will be
+       directed to standard error.  This was an undocumented fea-
+       ture of AT&T System V Release 3 curses.
+
+
+
+

AUTHORS

+       Zeyd  M.  Ben-Halim,  Eric  S. Raymond.  Descends from the
+       original pcurses by Pavel Curtis.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/panel.3x.html b/Ada95/html/panel.3x.html new file mode 100644 index 00000000..9875c217 --- /dev/null +++ b/Ada95/html/panel.3x.html @@ -0,0 +1,180 @@ + + +
+       panel - panel stack extension for curses
+
+
+
+

SYNOPSIS

+       #include <panel.h>
+
+       cc [flags] sourcefiles -lpanel -lncurses
+
+       PANEL *new_panel(WINDOW *win)
+       int bottom_panel(PANEL *pan)
+       int top_panel(PANEL *pan)
+       int show_panel(PANEL *pan)
+       void update_panels();
+       int hide_panel(PANEL *pan)
+       WINDOW *panel_window(const PANEL *pan)
+       int replace_panel(PANEL *pan, WINDOW *window)
+       int move_panel(PANEL *pan, int starty, int startx)
+       int panel_hidden(const PANEL *pan)
+       PANEL *panel_above(const PANEL *pan)
+       PANEL *panel_below(const PANEL *pan)
+       int set_panel_userptr(PANEL *pan, const void *ptr)
+       const void *panel_userptr(const PANEL *pan)
+       int del_panel(PANEL *pan)
+
+
+
+

DESCRIPTION

+       Panels  are  curses(3X)  windows with the added feature of
+       depth.  Panel functions allow the use of  stacked  windows
+       and  ensure  the  proper  portions  of each window and the
+       curses stdscr window are hidden or displayed  when  panels
+       are  added,  moved,  modified or removed.  The set of cur-
+       rently visible panels is the stack of panels.  The  stdscr
+       window  is  beneath all panels, and is not considered part
+       of the stack.
+
+       A window is associated with every panel.  The  panel  rou-
+       tines  enable you to create, move, hides, and show panels,
+       as well as position a panel at any desired location in the
+       stack.
+
+       Panel routines are a functional layer added to curses(3X),
+       make only high-level curses calls, and work anywhere  ter-
+       minfo curses does.
+
+
+
+

FUNCTIONS

+       new_panel(win)
+              allocates   a   PANEL structure, associates it with
+              win, places the panel  on  the  top  of  the  stack
+              (causes   it  to   be   displayed  above  any other
+              panel) and returns a pointer to the new panel.
+
+       void update_panels()
+              refreshes the virtual screen to reflect  the  rela-
+              tions between the panels in the stack, but does not
+              update_panels() may be called more than once before
+              a  call  to doupdate(), but doupdate() is the func-
+              tion responsible for updating the physical  screen.
+
+       del_panel(pan)
+              removes the given panel from the  stack and deallo-
+              cates the PANEL structure (but not  its  associated
+              window).
+
+       hide_panel(pan)
+              removes  the  given  panel from the panel stack and
+              thus hides it from view. The PANEL structure is not
+              lost, merely removed from the stack.
+
+       show_panel(pan)
+              makes  a  hidden panel visible by placing it on top
+              of the panels in the panel stack. See COMPATIBILITY
+              below.
+
+       top_panel(pan)
+              puts  the  given visible panel on top of all panels
+              in the stack.  See COMPATIBILITY below.
+
+       bottom_panel(pan)
+              puts panel at the bottom of all panels.
+
+       move_panel(pan,starty,startx)
+              moves the given panel window so that its upper-left
+              corner  is  at  starty, startx.  It does not change
+              the position of the panel in the stack.  Be sure to
+              use  this  function,  not  mvwin(), to move a panel
+              window.
+
+       replace_panel(pan,window)
+              replaces the current window of  panel  with  window
+              (useful, for example if you want to resize a panel;
+              if you're using ncurses, you can call replace_panel
+              on  the output of wresize(3x)).  It does not change
+              the position of the panel in the stack.
+
+       panel_above(pan)
+              returns a pointer to the panel above pan.   If  the
+              panel  argument is (PANEL *)0, it returns a pointer
+              to the bottom panel in the stack.
+
+       panel_below(pan)
+              returns a pointer to the panel just below pan.   If
+              the  panel  argument  is  (PANEL  *)0, it returns a
+              pointer to the top panel in the stack.
+
+       set_panel_userptr(pan,ptr)
+              sets the panel's user pointer.
+              returns the user pointer for a given panel.
+
+       panel_window(pan)
+              returns a pointer to the window of the given panel.
+
+
+
+

DIAGNOSTICS

+       Each  routine  that  returns  a pointer returns NULL if an
+       error occurs. Each  routine  that  returns  an  int  value
+       returns OK if it executes successfully and ERR if not.
+
+
+
+

COMPATIBILITY

+       Reasonable  care  has been taken to  ensure  compatibility
+       with  the  native  panel  facility  introduced  in  SVr3.2
+       (inspection of the SVr4 manual pages suggests the program-
+       ming interface is unchanged).  The PANEL  data  structures
+       are  merely   similar. The  programmer is cautioned not to
+       directly use PANEL fields.
+
+       The functions show_panel() and top_panel()  are  identical
+       in  this  implementation,  and work equally well with dis-
+       played or hidden panels.  In the native System V implemen-
+       tation, show_panel() is intended for making a hidden panel
+       visible (at the top  of  the  stack)  and  top_panel()  is
+       intended  for  making an already-visible panel move to the
+       top of the stack. You are cautioned  to  use  the  correct
+       function   to   ensure  compatibility  with  native  panel
+       libraries.
+
+
+
+

NOTE

+       In your library list, libpanel.a should  be  before  libn-
+       curses.a;  that  is,  you want to say `-lpanel -lncurses',
+       not the other way around (which  would  give  you  a  link
+       error using GNU ld(1) and some other linkers).
+
+
+
+

FILES

+       panel.h interface for the panels library
+
+       libpanel.a the panels library itself
+
+
+
+

SEE ALSO

+       curses(3X)
+
+
+
+

AUTHOR

+       Originally   written   by   Warren  Tucker  <wht@n4hgf.mt-
+       park.ga.us>, primarily to assist  in  porting  u386mon  to
+       systems  without  a native panels library.  Repackaged for
+       ncurses by Zeyd ben-Halim.
+
+
+
+
+
+
+ + diff --git a/Ada95/html/resizeterm.3x.html b/Ada95/html/resizeterm.3x.html new file mode 100644 index 00000000..18401194 --- /dev/null +++ b/Ada95/html/resizeterm.3x.html @@ -0,0 +1,70 @@ + + +
+       resizeterm - change the curses terminal size
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int resizeterm(int lines, int columns);
+
+
+
+

DESCRIPTION

+       This  is  an extension to the curses library.  It provides
+       callers with a hook into the ncurses data to  resize  win-
+       dows, primarily for use by programs running in an X Window
+       terminal (e.g., xterm).  The function  resizeterm  resizes
+       the  standard  and current windows to the specified dimen-
+       sions, and adjusts other  bookkeeping  data  used  by  the
+       ncurses library that record the window dimensions.
+
+       When  resizing  the  windows, the function blank-fills the
+       areas that are extended. The  calling  application  should
+       fill in these areas with appropriate data.
+
+       The function attempts to resize all windows.  However, due
+       to the calling convention of pads, it is not  possible  to
+       resize  these  without  additional  interaction  with  the
+       application.
+
+
+
+

RETURN VALUE

+       The function returns the integer ERR upon failure  and  OK
+       on success.  It will fail if either of the dimensions less
+       than or equal  to  zero,  or  if  an  error  occurs  while
+       (re)allocating memory for the windows.
+
+
+
+

NOTES

+       While  this  function  is intended to be used to support a
+       signal handler (i.e., for SIGWINCH), care should be  taken
+       to  avoid invoking it in a context where malloc or realloc
+       may have been interrupted, since it uses those  functions.
+
+
+
+

SEE ALSO

+       wresize(3x).
+
+
+
+

AUTHOR

+       Thomas Dickey (from an equivalent function written in 1988
+       for BSD curses).
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/html/table.html b/Ada95/html/table.html new file mode 100644 index 00000000..f142107e --- /dev/null +++ b/Ada95/html/table.html @@ -0,0 +1,311 @@ + + + +Correspondence between ncurses C and Ada functions + + +

Correspondence between ncurses C and Ada functions

+

Sorted by C function name

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
C nameAda nameman page
baudrate()Baudratecurs_termattrs.3x
beep()Beepcurs_beep.3x
bottom_panel()Bottompanel.3x
box()Boxcurs_border.3x
can_change_color()Can_Change_Colorcurs_color.3x
cbreak()Set_Cbreak_Modecurs_inopts.3x
clearok()Clear_On_Next_Updatecurs_outopts.3x
color_content()Color_Contentcurs_color.3x
copywin()Copycurs_overlay.3x
current_field()Currentform_page.3x
current_item()Currentmitem_current.3x
curs_set()Set_Cursor_Visibilitycurs_kernel.3x
data_ahead()Data_Aheadform_data.3x
data_behind()Data_Behindform_data.3x
def_prog_mode()Save_Curses_Modecurs_kernel.3x
del_panel()Deletepanel.3x
delay_output()Delay_Outputcurs_util.3x
delwin()Deletecurs_window.3x
derwin()Derived_Windowcurs_window.3x
doupdate()Update_Screencurs_refresh.3x
dup_field()Duplicateform_field_new.3x
dupwin()Duplicatecurs_window.3x
dynamic_field_info()Dynamic_Infoform_field_info.3x
echo()Set_Echo_Modecurs_inopts.3x
endwin()End_Windowscurs_initscr.3x
erasechar()Erase_Charactercurs_termattrs.3x
field_back()Backgroundform_field_attributes.3x
field_back()Backgroundform_field_attributes.3x
field_buffer()Get_Bufferform_field_buffer.3x
field_count()Field_Countform_field.3x
field_fore()Foregroundform_field_attributes.3x
field_fore()Foregroundform_field_attributes.3x
field_index()Get_Indexform_page.3x
field_info()Infoform_field_info.3x
field_init()Get_Field_Init_Hookform_hook.3x
field_just()Get_Justificationform_field_just.3x
field_opts()Get_Optionsform_field_opts.3x
field_opts()Get_Optionsform_field_opts.3x
field_opts_on()Switch_Optionsform_field_opts.3x
field_pad()Pad_Characterform_field_attributes.3x
field_status()Changedform_field_buffer.3x
field_term()Get_Field_Term_Hookform_hook.3x
field_type()Get_Typeform_field_validation.3x
field_userptrGet_User_Dataform_field_userptr.3x
flash()Flash_Screencurs_beep.3x
flushinp()Flush_Inputcurs_util.3x
form_driver()Driverform_driver.3x
form_fields()Fieldsform_field.3x
form_init()Get_Form_Init_Hookform_hook.3x
form_opts()Get_Optionsform_opts.3x
form_opts()Get_Optionsform_opts.3x
form_opts_on()Switch_Optionsform_opts.3x
form_page()Pageform_page.3x
form_sub()Get_Sub_Windowform_win.3x
form_term()Get_Form_Term_Hookform_hook.3x
form_userptrGet_User_Dataform_userptr.3x
form_win()Get_Windowform_win.3x
free_field()Deleteform_field_new.3x
free_form()Deleteform_new.3x
free_item()Deletemitem_new.3x
free_menu()Deletemenu_new.3x
getbegyx()Get_Window_Positioncurs_getyx.3x
getmaxyx()Get_Sizecurs_getyx.3x
getmouse()Get_Mousecurs_mouse.3x
getparyx()Get_Origin_Relative_To_Parentcurs_getyx.3x
getyx()Get_Cursor_Positioncurs_getyx.3x
halfdelay()Half_Delaycurs_inopts.3x
has_colors()Has_Colorscurs_color.3x
has_ic()Has_Insert_Charactercurs_termattrs.3x
has_il()Has_Insert_Linecurs_termattrs.3x
has_key()Has_Keycurs_getch.3x
hide_panel()Hidepanel.3x
idcok()Use_Insert_Delete_Charactercurs_outopts.3x
idlok()Use_Insert_Delete_Linecurs_outopts.3x
immedok()Immediate_Update_Modecurs_outopts.3x
init_color()Init_Colorcurs_color.3x
init_pair()Init_Paircurs_color.3x
initscr()Init_Screencurs_initscr.3x
initscr()Init_Windowscurs_initscr.3x
intrflush()Set_Flush_On_Interrupt_Modecurs_inopts.3x
is_linetouched()Is_Touchedcurs_touch.3x
is_wintouched()Is_Touchedcurs_touch.3x
isendwin()Is_End_Windowcurs_initscr.3x
item_count()Item_Countmenu_items.3x
item_description();Descriptionmitem_name.3x
item_index()Get_Indexmitem_current.3x
item_init()Get_Item_Init_Hookmenu_hook.3x
item_name()Namemitem_name.3x
item_opts()Get_Optionsmitem_opts.3x
item_opts()Get_Optionsmitem_opts.3x
item_opts_on()Switch_Optionsmitem_opts.3x
item_term()Get_Item_Term_Hookmenu_hook.3x
item_userptrGet_User_Datamitem_userptr.3x
item_value()Valuemitem_value.3x
item_visible()Visiblemitem_visible.3x
keyname()Key_Namecurs_util.3x
keypad()Set_KeyPad_Modecurs_inopts.3x
killchar()Kill_Charactercurs_termattrs.3x
leaveok()Leave_Cursor_After_Updatecurs_outopts.3x
link_field()Linkform_field_new.3x
longname()Long_Namecurs_termattrs.3x
menu_back()Backgroundmenu_attribs.3x
menu_back()Backgroundmenu_attribs.3x
menu_driver()Drivermenu_new.3x
menu_fore()Foregroundmenu_attribs.3x
menu_fore()Foregroundmenu_attribs.3x
menu_format()Formatmenu_format.3x
menu_grey()Greymenu_attribs.3x
menu_grey()Greymenu_attribs.3x
menu_init()Get_Menu_Init_Hookmenu_hook.3x
menu_items()Itemsmenu_items.3x
menu_mark()Markmenu_mark.3x
menu_opts()Get_Optionsmenu_opts.3x
menu_opts()Get_Optionsmenu_opts.3x
menu_opts_on()Switch_Optionsmenu_opts.3x
menu_pad()Pad_Charactermenu_attribs.3x
menu_pattern()Patternmenu_pattern.3x
menu_spacing()Spacingmenu_spacing.3x
menu_sub()Get_Sub_Windowmenu_win.3x
menu_term()Get_Menu_Term_Hookmenu_hook.3x
menu_userptrGet_User_Datamenu_userptr.3x
menu_win()Get_Windowmenu_win.3x
meta()Set_Meta_Modecurs_inopts.3x
mouseinterval()Mouse_Intervalcurs_mouse.3x
mousemask()Start_Mousecurs_mouse.3x
move_field()Moveform_field.3x
move_panel()Movepanel.3x
mvderwin()Move_Derived_Windowcurs_window.3x
mvwaddch()Addcurs_addch.3x
mvwaddchnstr()Addcurs_addchstr.3x
mvwaddnstr()Addcurs_addstr.3x
mvwchgat()Change_Attributescurs_attr.3x
mvwdelch()Delete_Charactercurs_delch.3x
mvwin()Move_Windowcurs_window.3x
mvwinch()Peekcurs_inch.3x
mvwinchnstr()Peekcurs_inchstr.3x
mvwinnstr()Peekcurs_instr.3x
mvwinsch()Insertcurs_winch.3x
mvwinsnstr()Insertcurs_winch.3x
napms()Nap_Milli_Secondscurs_kernel.3x
new_field()Createform_field_new.3x
new_field()New_Fieldform_field_new.3x
new_form()Createform_new.3x
new_form()New_Formform_new.3x
new_item()Createmitem_new.3x
new_item()New_Itemmitem_new.3x
new_menu()Createmenu_new.3x
new_page()Is_New_Pageform_new_page.3x
new_panel()Createpanel.3x
new_panel()New_Panelpanel.3x
newpad()New_Padcurs_pad.3x
newwin()Createcurs_window.3x
nl()Set_NL_Modecurs_outopts.3x
nodelay()Set_NoDelay_Modecurs_inopts.3x
notimeout()Set_Escape_Time_Modecurs_inopts.3x
overlay()Overlaycurs_overlay.3x
overwrite()Overwritecurs_overlay.3x
pair_content()Pair_Contentcurs_color.3x
panel_above()Abovepanel.3x
panel_below()Belowpanel.3x
panel_hidden()Is_Hiddenpanel.3x
panel_userptrGet_User_Datapanel.3x
panel_window()Get_Windowpanel.3x
panel_window()Panel_Windowpanel.3x
pechochar()Add_Character_To_Pad_And_Echo_Itcurs_pad.3x
pnoutrefresh()Refresh_Without_Updatecurs_pad.3x
pos_form_cursor()Position_Cursorform_cursor.3x
pos_menu_cursor()Position_Cursormenu_cursor.3x
post_form()Postform_post.3x
post_menu()Postmenu_post.3x
prefresh()Refreshcurs_pad.3x
qiflush()Set_Queue_Interrupt_Modecurs_inopts.3x
raw()Set_Raw_Modecurs_inopts.3x
redrawwin()Redrawcurs_refresh.3x
replace_panel()Replacepanel.3x
reset_prog_mode()Reset_Curses_Modecurs_kernel.3x
resetty();Reset_Terminal_Statecurs_kernel.3x
ripoffline()Rip_Off_Linescurs_kernel.3x
savetty()Save_Terminal_Statecurs_kernel.3x
scale_form()Scaleform_win.3x
scale_menu()Scalemenu_win.3x
scrollok()Allow_Scrollingcurs_outopts.3x
set_current_field()Set_Currentform_page.3x
set_current_item()Set_Currentmitem_current.3x
set_field_back()Set_Backgroundform_field_attributes.3x
set_field_buffer()Set_Bufferform_field_buffer.3x
set_field_fore()Set_Foregroundform_field_attributes.3x
set_field_init()Set_Field_Init_Hookform_hook.3x
set_field_just()Set_Justificationform_field_just.3x
set_field_max()Set_Maximum_Sizeform_field_buffer.3x
set_field_opts()Set_Optionsform_field_opts.3x
set_field_pad()Set_Pad_Characterform_field_attributes.3x
set_field_status()Set_Statusform_field_buffer.3x
set_field_term()Set_Field_Term_Hookform_hook.3x
set_field_type()Set_Typeform_fieldtype.3x
set_field_userptrSet_User_Dataform_field_userptr.3x
set_form_fields()Redefineform_field.3x
set_form_fields()Set_Fieldsform_field.3x
set_form_init()Set_Form_Init_Hookform_hook.3x
set_form_opts()Set_Optionsform_opts.3x
set_form_page()Set_Pageform_page.3x
set_form_sub()Set_Sub_Windowform_win.3x
set_form_term()Set_Form_Term_Hookform_hook.3x
set_form_userptrSet_User_Dataform_userptr.3x
set_form_win()Set_Windowform_win.3x
set_item_init()Set_Item_Init_Hookmenu_hook.3x
set_item_opts()Set_Optionsmitem_opts.3x
set_item_term()Set_Item_Term_Hookmenu_hook.3x
set_item_userptrSet_User_Datamitem_userptr.3x
set_item_value()Set_Valuemitem_value.3x
set_menu_back()Set_Backgroundmenu_attribs.3x
set_menu_fore()Set_Foregroundmenu_attribs.3x
set_menu_format()Set_Formatmenu_format.3x
set_menu_grey()Set_Greymenu_attribs.3x
set_menu_init()Set_Menu_Init_Hookmenu_hook.3x
set_menu_items()Redefinemenu_items.3x
set_menu_mark()Set_Markmenu_mark.3x
set_menu_opts()Set_Optionsmenu_opts.3x
set_menu_pad()Set_Pad_Charactermenu_attribs.3x
set_menu_pattern()Set_Patternmenu_pattern.3x
set_menu_spacing()Set_Spacingmenu_spacing.3x
set_menu_sub()Set_Sub_Windowmenu_win.3x
set_menu_term()Set_Menu_Term_Hookmenu_hook.3x
set_menu_userptrSet_User_Datamenu_userptr.3x
set_menu_win()Set_Windowmenu_win.3x
set_new_page()Set_New_Pageform_new_page.3x
set_panel_userptrSet_User_Datapanel.3x
set_top_row()Set_Top_Rowmitem_current.3x
show_panel()Showpanel.3x
slk_attr()Get_Soft_Label_Key_Attributescurs_slk.3x
slk_attr()Get_Soft_Label_Key_Attributescurs_slk.3x
slk_attron()Switch_Soft_Label_Key_Attributescurs_slk.3x
slk_attrset()Set_Soft_Label_Key_Attributescurs_slk.3x
slk_clear()Clear_Soft_Label_Keyscurs_slk.3x
slk_init()Init_Soft_Label_Keyscurs_slk.3x
slk_label()Get_Soft_Label_Keycurs_slk.3x
slk_noutrefresh()Refresh_Soft_Label_Keys_Without_Updatecurs_slk.3x
slk_refresh()Refresh_Soft_Label_Keycurs_slk.3x
slk_restore()Restore_Soft_Label_Keyscurs_slk.3x
slk_set()Set_Soft_Label_Keycurs_slk.3x
slk_touch()Touch_Soft_Label_Keyscurs_slk.3x
start_clolor()Start_Colorcurs_color.3x
stdscrStandard_Windowcurs_initscr.3x
subpad()Sub_Padcurs_pad.3x
subwin()Sub_Windowcurs_window.3x
syncok()Set_Synch_Modecurs_window.3x
termattrs()Supported_Attributescurs_termattrs.3x
termname()Terminal_Namecurs_termattrs.3x
top_panel()Toppanel.3x
top_row()Top_Rowmitem_current.3x
touchline()Touchcurs_touch.3x
touchwin()Touchcurs_touch.3x
unctrl()Un_Controlcurs_util.3x
ungetch()Undo_Keystrokecurs_getch.3x
ungetmouse()Unget_Mousecurs_mouse.3x
untouchwin()Untouchcurs_touch.3x
update_panels()Update_Panelspanel.3x
waddch()Addcurs_addch.3x
waddchnstr()Addcurs_addchstr.3x
waddnstr()Addcurs_addstr.3x
wattr_get()Get_Character_Attributecurs_attr.3x
wattr_get()Get_Character_Attributecurs_attr.3x
wattron()Switch_Character_Attributecurs_attr.3x
wattrset()Set_Character_Attributescurs_attr.3x
wbkgd()Change_Backgroundcurs_bkgd.3x
wbkgdget()Get_Backgroundcurs_bkgd.3x
wbkgdset()Set_Backgroundcurs_bkgd.3x
wborder()Bordercurs_border.3x
wchgat()Change_Attributescurs_attr.3x
wclear()Clearcurs_clear.3x
wclrtobot()Clear_To_End_Of_Screencurs_clear.3x
wclrtoeol()Clear_To_End_Of_Linecurs_clear.3x
wdelch()Delete_Charactercurs_delch.3x
wdeleteln()Delete_Linecurs_deleteln.3x
wechochar()Add_With_Immediate_Echocurs_addch.3x
wenclose()Enclosed_In_Windowcurs_mouse.3x
werase()Erasecurs_clear.3x
wgetch()Get_Keystrokecurs_getch.3x
wgetnstr()Getcurs_getstr.3x
whline()Horizontal_Linecurs_border.3x
winch()Peekcurs_inch.3x
winchnstr()Peekcurs_inchstr.3x
winnstr()Peekcurs_instr.3x
winsch()Insertcurs_winch.3x
winsdelln()Insert_Delete_Linescurs_deleteln.3x
winsertln()Insert_Linecurs_deleteln.3x
winsnstr()Insertcurs_winch.3x
wmove()Move_Cursorcurs_move.3x
wnoutrefresh()Refresh_Without_Updatecurs_refresh.3x
wredrawln()Redrawcurs_refresh.3x
wrefresh()Refreshcurs_refresh.3x
wscrl()Scrollcurs_scroll.3x
wsetscrreg()Set_Scroll_Regioncurs_outopts.3x
wsyncdown()Synchronize_Downwardscurs_window.3x
wsyncup()Synchronize_Upwardscurs_window.3x
wtimeout()Set_Timeout_Modecurs_inopts.3x
wtouchln()Change_Line_Statuscurs_touch.3x
wvline()Vertical_Linecurs_border.3x
diff --git a/Ada95/html/terminal_interface-curses-forms-choice_field_types_s.html b/Ada95/html/terminal_interface-curses-forms-choice_field_types_s.html new file mode 100644 index 00000000..b696e9a1 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms-choice_field_types_s.html @@ -0,0 +1,64 @@ + + + + + +
+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--              Terminal_Interface.Curses.Forms.Choice_Field_Types          --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.6 @
+------------------------------------------------------------------------------
+--  You must instantiate this package for any user defined field type
+--  to make it visible to the runtime.
+--
+generic
+   type User is new Ada_Defined_Field_Type with private;
+   type User_Access is access User;
+   with function Field_Check (Fld  : Field;
+                              Info : User_Access) return Boolean;
+   with function Character_Check (Ch   : Character;
+                                  Info : User_Access) return Boolean;
+   with function Next_Choice (Fld  : Field;
+                              Info : User_Access) return Boolean;
+   with function Prev_Choice (Fld  : Field;
+                              Info : User_Access) return Boolean;
+package Terminal_Interface.Curses.Forms.Choice_Field_Types is
+--
+--  Nothing public.
+--  But we need the body.
+    pragma Elaborate_Body;
+end Terminal_Interface.Curses.Forms.Choice_Field_Types;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-forms-field_types_s.html b/Ada95/html/terminal_interface-curses-forms-field_types_s.html new file mode 100644 index 00000000..28c6fa6b --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms-field_types_s.html @@ -0,0 +1,68 @@ + + + + + +

+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--                 Terminal_Interface.Curses.Forms.Field_Types              --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.3 @
+------------------------------------------------------------------------------
+with Ada.Finalization; use Ada.Finalization;
+
+--  You must instantiate this package for any user defined field type
+--  to make it visible to the runtime.
+--
+generic
+   type User is new Ada_Defined_Field_Type with private;
+   type User_Access is access User;
+   with function Field_Check (Fld  : Field;
+                              Info : User_Access) return Boolean;
+   with function Character_Check (Ch   : Character;
+                                  Info : User_Access) return Boolean;
+package Terminal_Interface.Curses.Forms.Field_Types is
+--
+--  Nothing public. All happens magically.
+--
+private
+   type Tracker is new Limited_Controlled with null record;
+
+   procedure Initialize (Obj : in out Tracker);
+   procedure Finalize   (Obj : in out Tracker);
+
+end Terminal_Interface.Curses.Forms.Field_Types;
+
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-forms-field_user_data_s.html b/Ada95/html/terminal_interface-curses-forms-field_user_data_s.html new file mode 100644 index 00000000..7ad321cc --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms-field_user_data_s.html @@ -0,0 +1,77 @@ + + + + + +

+
+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--               Terminal_Interface.Curses.Forms.Field_User_Data            --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.3 @
+------------------------------------------------------------------------------
+
+generic
+   type User is limited private;
+   type User_Access is access User;
+package Terminal_Interface.Curses.Forms.Field_User_Data is
+
+   --  The binding uses the C level user pointer already for its own
+   --  internal purposes. So you can´t easily manipulate the user pointer
+   --  with the low level C routines for this field without taking care of
+   --  this special situation. If you want to read or write with C routines
+   --  the user pointer of this field, you should get first the low level
+   --  user pointer. This points to a record, that always has as its first
+   --  member the Ada95 user pointer for this field. You should never change
+   --  the low level user pointer of an Ada created field.
+   --
+   --  |=====================================================================
+   --  | Man page form_field_userptr.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_User_Data (Fld  : in Field;
+                            Data : in User_Access);
+   --  AKA: set_field_userptr
+   pragma Convention (C, Set_User_Data);
+
+   --  |
+   procedure Get_User_Data (Fld  : in  Field;
+                            Data : out User_Access);
+   --  AKA: field_userptr
+   pragma Convention (C, Get_User_Data);
+
+end Terminal_Interface.Curses.Forms.Field_User_Data;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-forms-form_user_data_s.html b/Ada95/html/terminal_interface-curses-forms-form_user_data_s.html new file mode 100644 index 00000000..be754bed --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms-form_user_data_s.html @@ -0,0 +1,78 @@ + + + + + +

+
+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--                Terminal_Interface.Curses.Forms.Form_User_Data            --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.3 @
+------------------------------------------------------------------------------
+
+generic
+   type User is limited private;
+   type User_Access is access User;
+package Terminal_Interface.Curses.Forms.Form_User_Data is
+
+   --  The binding uses the C level user pointer already for its own
+   --  internal purposes. So you can´t easily manipulate the user pointer
+   --  with the low level C routines for this form without taking care of
+   --  this special situation. If you want to read or write with C routines
+   --  the user pointer of this form, you should get first the low level
+   --  user pointer. This points to a record, that always has as its first
+   --  member the Ada95 user pointer for this form. You should never change
+   --  the low level user pointer of an Ada created form.
+   --
+   --  |=====================================================================
+   --  | Man page form_userptr.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_User_Data (Frm  : in Form;
+                            Data : in User_Access);
+   --  AKA: set_form_userptr
+   pragma Convention (C, Set_User_Data);
+
+   --  |
+   procedure Get_User_Data (Frm  : in  Form;
+                            Data : out User_Access);
+   --  AKA: form_userptr
+   pragma Convention (C, Get_User_Data);
+
+end Terminal_Interface.Curses.Forms.Form_User_Data;
+
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-forms_s.html b/Ada95/html/terminal_interface-curses-forms_s.html new file mode 100644 index 00000000..add98be2 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-forms_s.html @@ -0,0 +1,920 @@ + + + + + +

+
+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--                      Terminal_Interface.Curses.Form                      --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.9 @
+------------------------------------------------------------------------------
+--  form binding, generated at Sun Feb  2 17:21:44 1997
+--  This module is generated. Please don't change it manually!
+--  Run the generator instead.
+--  |
+with System;
+with Ada.Tags; use Ada.Tags;
+with Ada.Characters.Latin_1;
+with Interfaces.C;
+with Interfaces.C.Strings;
+
+package Terminal_Interface.Curses.Forms is
+
+   pragma Linker_Options ("-lform");
+
+
+   Space : Character renames Ada.Characters.Latin_1.Space;
+
+   type Field        is private;
+   type Form         is private;
+   type C_Field_Type is private;
+
+   Null_Field        : constant Field;
+   Null_Form         : constant Form;
+   Null_Field_Type   : constant C_Field_Type;
+
+
+   type Field_Justification is (None,
+                                Left,
+                                Center,
+                                Right);
+
+   type Field_Option_Set is
+      record
+         Visible   : Boolean;
+         Active    : Boolean;
+         Public    : Boolean;
+         Edit      : Boolean;
+         Wrap      : Boolean;
+         Blank     : Boolean;
+         Auto_Skip : Boolean;
+         Null_Ok   : Boolean;
+         Pass_Ok   : Boolean;
+         Static    : Boolean;
+         Reserved  : Boolean;
+      end record;
+   pragma Pack (Field_Option_Set);
+   pragma Convention (C, Field_Option_Set);
+
+   for Field_Option_Set use
+      record
+         Visible   at 0 range  0 ..  0;
+         Active    at 0 range  1 ..  1;
+         Public    at 0 range  2 ..  2;
+         Edit      at 0 range  3 ..  3;
+         Wrap      at 0 range  4 ..  4;
+         Blank     at 0 range  5 ..  5;
+         Auto_Skip at 0 range  6 ..  6;
+         Null_Ok   at 0 range  7 ..  7;
+         Pass_Ok   at 0 range  8 ..  8;
+         Static    at 0 range  9 ..  9;
+         Reserved  at 0 range 31 .. 31;
+      end record;
+   for Field_Option_Set'Size use Interfaces.C.int'Size;
+   --  Please note: this rep. clause is generated and may be
+   --               different on your system.
+
+   Default_Field_Options : Field_Option_Set;
+   --  The initial defaults for the field options.
+
+   type Form_Option_Set is
+      record
+         NL_Overload : Boolean;
+         BS_Overload : Boolean;
+         Reserved    : Boolean;
+      end record;
+   pragma Pack (Form_Option_Set);
+   pragma Convention (C, Form_Option_Set);
+
+   for Form_Option_Set use
+      record
+         NL_Overload at 0 range  0 ..  0;
+         BS_Overload at 0 range  1 ..  1;
+         Reserved    at 0 range 31 .. 31;
+      end record;
+   for Form_Option_Set'Size use Interfaces.C.int'Size;
+   --  Please note: this rep. clause is generated and may be
+   --               different on your system.
+
+   Default_Form_Options : Form_Option_Set;
+   --  The initial defaults for the form options.
+
+   type Buffer_Number is new Natural;
+
+   type Field_Array is array (Positive range <>) of aliased Field;
+   pragma Convention (C, Field_Array);
+
+   type Field_Array_Access is access all Field_Array;
+
+   subtype Form_Request_Code is Key_Code range (Key_Max + 1) .. (Key_Max + 57);
+
+   --  The prefix F_ stands for "Form Request"
+   F_Next_Page                : constant Form_Request_Code := Key_Max + 1;
+   F_Previous_Page            : constant Form_Request_Code := Key_Max + 2;
+   F_First_Page               : constant Form_Request_Code := Key_Max + 3;
+   F_Last_Page                : constant Form_Request_Code := Key_Max + 4;
+
+   F_Next_Field               : constant Form_Request_Code := Key_Max + 5;
+   F_Previous_Field           : constant Form_Request_Code := Key_Max + 6;
+   F_First_Field              : constant Form_Request_Code := Key_Max + 7;
+   F_Last_Field               : constant Form_Request_Code := Key_Max + 8;
+   F_Sorted_Next_Field        : constant Form_Request_Code := Key_Max + 9;
+   F_Sorted_Previous_Field    : constant Form_Request_Code := Key_Max + 10;
+   F_Sorted_First_Field       : constant Form_Request_Code := Key_Max + 11;
+   F_Sorted_Last_Field        : constant Form_Request_Code := Key_Max + 12;
+   F_Left_Field               : constant Form_Request_Code := Key_Max + 13;
+   F_Right_Field              : constant Form_Request_Code := Key_Max + 14;
+   F_Up_Field                 : constant Form_Request_Code := Key_Max + 15;
+   F_Down_Field               : constant Form_Request_Code := Key_Max + 16;
+
+   F_Next_Char                : constant Form_Request_Code := Key_Max + 17;
+   F_Previous_Char            : constant Form_Request_Code := Key_Max + 18;
+   F_Next_Line                : constant Form_Request_Code := Key_Max + 19;
+   F_Previous_Line            : constant Form_Request_Code := Key_Max + 20;
+   F_Next_Word                : constant Form_Request_Code := Key_Max + 21;
+   F_Previous_Word            : constant Form_Request_Code := Key_Max + 22;
+   F_Begin_Field              : constant Form_Request_Code := Key_Max + 23;
+   F_End_Field                : constant Form_Request_Code := Key_Max + 24;
+   F_Begin_Line               : constant Form_Request_Code := Key_Max + 25;
+   F_End_Line                 : constant Form_Request_Code := Key_Max + 26;
+   F_Left_Char                : constant Form_Request_Code := Key_Max + 27;
+   F_Right_Char               : constant Form_Request_Code := Key_Max + 28;
+   F_Up_Char                  : constant Form_Request_Code := Key_Max + 29;
+   F_Down_Char                : constant Form_Request_Code := Key_Max + 30;
+
+   F_New_Line                 : constant Form_Request_Code := Key_Max + 31;
+   F_Insert_Char              : constant Form_Request_Code := Key_Max + 32;
+   F_Insert_Line              : constant Form_Request_Code := Key_Max + 33;
+   F_Delete_Char              : constant Form_Request_Code := Key_Max + 34;
+   F_Delete_Previous          : constant Form_Request_Code := Key_Max + 35;
+   F_Delete_Line              : constant Form_Request_Code := Key_Max + 36;
+   F_Delete_Word              : constant Form_Request_Code := Key_Max + 37;
+   F_Clear_EOL                : constant Form_Request_Code := Key_Max + 38;
+   F_Clear_EOF                : constant Form_Request_Code := Key_Max + 39;
+   F_Clear_Field              : constant Form_Request_Code := Key_Max + 40;
+   F_Overlay_Mode             : constant Form_Request_Code := Key_Max + 41;
+   F_Insert_Mode              : constant Form_Request_Code := Key_Max + 42;
+
+   --  Vertical Scrolling
+   F_ScrollForward_Line       : constant Form_Request_Code := Key_Max + 43;
+   F_ScrollBackward_Line      : constant Form_Request_Code := Key_Max + 44;
+   F_ScrollForward_Page       : constant Form_Request_Code := Key_Max + 45;
+   F_ScrollBackward_Page      : constant Form_Request_Code := Key_Max + 46;
+   F_ScrollForward_HalfPage   : constant Form_Request_Code := Key_Max + 47;
+   F_ScrollBackward_HalfPage  : constant Form_Request_Code := Key_Max + 48;
+
+   --  Horizontal Scrolling
+   F_HScrollForward_Char      : constant Form_Request_Code := Key_Max + 49;
+   F_HScrollBackward_Char     : constant Form_Request_Code := Key_Max + 50;
+   F_HScrollForward_Line      : constant Form_Request_Code := Key_Max + 51;
+   F_HScrollBackward_Line     : constant Form_Request_Code := Key_Max + 52;
+   F_HScrollForward_HalfLine  : constant Form_Request_Code := Key_Max + 53;
+   F_HScrollBackward_HalfLine : constant Form_Request_Code := Key_Max + 54;
+
+   F_Validate_Field           : constant Form_Request_Code := Key_Max + 55;
+   F_Next_Choice              : constant Form_Request_Code := Key_Max + 56;
+   F_Previous_Choice          : constant Form_Request_Code := Key_Max + 57;
+
+   --  For those who like the old 'C' style request names
+   REQ_NEXT_PAGE    : Form_Request_Code renames F_Next_Page;
+   REQ_PREV_PAGE    : Form_Request_Code renames F_Previous_Page;
+   REQ_FIRST_PAGE   : Form_Request_Code renames F_First_Page;
+   REQ_LAST_PAGE    : Form_Request_Code renames F_Last_Page;
+
+   REQ_NEXT_FIELD   : Form_Request_Code renames F_Next_Field;
+   REQ_PREV_FIELD   : Form_Request_Code renames F_Previous_Field;
+   REQ_FIRST_FIELD  : Form_Request_Code renames F_First_Field;
+   REQ_LAST_FIELD   : Form_Request_Code renames F_Last_Field;
+   REQ_SNEXT_FIELD  : Form_Request_Code renames F_Sorted_Next_Field;
+   REQ_SPREV_FIELD  : Form_Request_Code renames F_Sorted_Previous_Field;
+   REQ_SFIRST_FIELD : Form_Request_Code renames F_Sorted_First_Field;
+   REQ_SLAST_FIELD  : Form_Request_Code renames F_Sorted_Last_Field;
+   REQ_LEFT_FIELD   : Form_Request_Code renames F_Left_Field;
+   REQ_RIGHT_FIELD  : Form_Request_Code renames F_Right_Field;
+   REQ_UP_FIELD     : Form_Request_Code renames F_Up_Field;
+   REQ_DOWN_FIELD   : Form_Request_Code renames F_Down_Field;
+
+   REQ_NEXT_CHAR    : Form_Request_Code renames F_Next_Char;
+   REQ_PREV_CHAR    : Form_Request_Code renames F_Previous_Char;
+   REQ_NEXT_LINE    : Form_Request_Code renames F_Next_Line;
+   REQ_PREV_LINE    : Form_Request_Code renames F_Previous_Line;
+   REQ_NEXT_WORD    : Form_Request_Code renames F_Next_Word;
+   REQ_PREV_WORD    : Form_Request_Code renames F_Previous_Word;
+   REQ_BEG_FIELD    : Form_Request_Code renames F_Begin_Field;
+   REQ_END_FIELD    : Form_Request_Code renames F_End_Field;
+   REQ_BEG_LINE     : Form_Request_Code renames F_Begin_Line;
+   REQ_END_LINE     : Form_Request_Code renames F_End_Line;
+   REQ_LEFT_CHAR    : Form_Request_Code renames F_Left_Char;
+   REQ_RIGHT_CHAR   : Form_Request_Code renames F_Right_Char;
+   REQ_UP_CHAR      : Form_Request_Code renames F_Up_Char;
+   REQ_DOWN_CHAR    : Form_Request_Code renames F_Down_Char;
+
+   REQ_NEW_LINE     : Form_Request_Code renames F_New_Line;
+   REQ_INS_CHAR     : Form_Request_Code renames F_Insert_Char;
+   REQ_INS_LINE     : Form_Request_Code renames F_Insert_Line;
+   REQ_DEL_CHAR     : Form_Request_Code renames F_Delete_Char;
+   REQ_DEL_PREV     : Form_Request_Code renames F_Delete_Previous;
+   REQ_DEL_LINE     : Form_Request_Code renames F_Delete_Line;
+   REQ_DEL_WORD     : Form_Request_Code renames F_Delete_Word;
+   REQ_CLR_EOL      : Form_Request_Code renames F_Clear_EOL;
+   REQ_CLR_EOF      : Form_Request_Code renames F_Clear_EOF;
+   REQ_CLR_FIELD    : Form_Request_Code renames F_Clear_Field;
+   REQ_OVL_MODE     : Form_Request_Code renames F_Overlay_Mode;
+   REQ_INS_MODE     : Form_Request_Code renames F_Insert_Mode;
+
+   REQ_SCR_FLINE    : Form_Request_Code renames F_ScrollForward_Line;
+   REQ_SCR_BLINE    : Form_Request_Code renames F_ScrollBackward_Line;
+   REQ_SCR_FPAGE    : Form_Request_Code renames F_ScrollForward_Page;
+   REQ_SCR_BPAGE    : Form_Request_Code renames F_ScrollBackward_Page;
+   REQ_SCR_FHPAGE   : Form_Request_Code renames F_ScrollForward_HalfPage;
+   REQ_SCR_BHPAGE   : Form_Request_Code renames F_ScrollBackward_HalfPage;
+
+   REQ_SCR_FCHAR    : Form_Request_Code renames F_HScrollForward_Char;
+   REQ_SCR_BCHAR    : Form_Request_Code renames F_HScrollBackward_Char;
+   REQ_SCR_HFLINE   : Form_Request_Code renames F_HScrollForward_Line;
+   REQ_SCR_HBLINE   : Form_Request_Code renames F_HScrollBackward_Line;
+   REQ_SCR_HFHALF   : Form_Request_Code renames F_HScrollForward_HalfLine;
+   REQ_SCR_HBHALF   : Form_Request_Code renames F_HScrollBackward_HalfLine;
+
+   REQ_VALIDATION   : Form_Request_Code renames F_Validate_Field;
+   REQ_NEXT_CHOICE  : Form_Request_Code renames F_Next_Choice;
+   REQ_PREV_CHOICE  : Form_Request_Code renames F_Previous_Choice;
+
+
+   procedure Request_Name (Key  : in Form_Request_Code;
+                           Name : out String);
+
+   ------------------
+   --  Exceptions  --
+   ------------------
+   Form_Exception : exception;
+
+   --  |=====================================================================
+   --  | Man page form_field_new.3x
+   --  |=====================================================================
+
+   --  |
+   function Create (Height       : Line_Count;
+                    Width        : Column_Count;
+                    Top          : Line_Position;
+                    Left         : Column_Position;
+                    Off_Screen   : Natural := 0;
+                    More_Buffers : Buffer_Number := Buffer_Number'First)
+                    return Field;
+   --  AKA: new_field()
+
+   --  |
+   function New_Field (Height       : Line_Count;
+                       Width        : Column_Count;
+                       Top          : Line_Position;
+                       Left         : Column_Position;
+                       Off_Screen   : Natural := 0;
+                       More_Buffers : Buffer_Number := Buffer_Number'First)
+                       return Field renames Create;
+   --  AKA: new_field()
+
+   --  |
+   procedure Delete (Fld : in out Field);
+   --  AKA: free_field()
+   --  Reset Fld to Null_Field
+
+   --  |
+   function Duplicate (Fld  : Field;
+                       Top  : Line_Position;
+                       Left : Column_Position) return Field;
+   --  AKA: dup_field()
+
+   --  |
+   function Link (Fld  : Field;
+                  Top  : Line_Position;
+                  Left : Column_Position) return Field;
+   --  AKA: link_field()
+
+   --  |=====================================================================
+   --  | Man page form_field_just.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Justification (Fld  : in Field;
+                                Just : in Field_Justification := None);
+   --  AKA: set_field_just()
+
+   --  |
+   function Get_Justification (Fld : Field) return Field_Justification;
+   --  AKA: field_just()
+
+   --  |=====================================================================
+   --  | Man page form_field_buffer.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Buffer
+     (Fld    : in Field;
+      Buffer : in Buffer_Number := Buffer_Number'First;
+      Str    : in String);
+   --  AKA: set_field_buffer()
+
+   --  |
+   procedure Get_Buffer
+     (Fld    : in Field;
+      Buffer : in Buffer_Number := Buffer_Number'First;
+      Str    : out String);
+   --  AKA: field_buffer()
+
+   --  |
+   procedure Set_Status (Fld    : in Field;
+                         Status : in Boolean := True);
+   --  AKA: set_field_status()
+
+   --  |
+   function Changed (Fld : Field) return Boolean;
+   --  AKA: field_status()
+
+   --  |
+   procedure Set_Maximum_Size (Fld : in Field;
+                               Max : in Natural := 0);
+   --  AKA: set_field_max()
+
+   --  |=====================================================================
+   --  | Man page form_field_opts.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Options (Fld     : in Field;
+                          Options : in Field_Option_Set);
+   --  AKA: set_field_opts()
+
+   --  |
+   procedure Switch_Options (Fld     : in Field;
+                             Options : in Field_Option_Set;
+                             On      : Boolean := True);
+   --  AKA: field_opts_on()
+   --  AKA: field_opts_off()
+
+   --  |
+   procedure Get_Options (Fld     : in  Field;
+                          Options : out Field_Option_Set);
+   --  AKA: field_opts()
+
+   --  |
+   function Get_Options (Fld : Field := Null_Field)
+                         return Field_Option_Set;
+   --  AKA: field_opts()
+
+   --  |=====================================================================
+   --  | Man page form_field_attributes.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Foreground
+     (Fld   : in Field;
+      Fore  : in Character_Attribute_Set := Normal_Video;
+      Color : in Color_Pair := Color_Pair'First);
+   --  AKA: set_field_fore()
+
+   --  |
+   procedure Foreground (Fld  : in  Field;
+                         Fore : out Character_Attribute_Set);
+   --  AKA: field_fore()
+
+   --  |
+   procedure Foreground (Fld   : in  Field;
+                         Fore  : out Character_Attribute_Set;
+                         Color : out Color_Pair);
+   --  AKA: field_fore()
+
+   --  |
+   procedure Set_Background
+     (Fld   : in Field;
+      Back  : in Character_Attribute_Set := Normal_Video;
+      Color : in Color_Pair := Color_Pair'First);
+   --  AKA: set_field_back()
+
+   --  |
+   procedure Background (Fld  : in  Field;
+                         Back : out Character_Attribute_Set);
+   --  AKA: field_back()
+
+   --  |
+   procedure Background (Fld   : in  Field;
+                         Back  : out Character_Attribute_Set;
+                         Color : out Color_Pair);
+   --  AKA: field_back()
+
+   --  |
+   procedure Set_Pad_Character (Fld : in Field;
+                                Pad : in Character := Space);
+   --  AKA: set_field_pad()
+
+   --  |
+   procedure Pad_Character (Fld : in  Field;
+                            Pad : out Character);
+   --  AKA: field_pad()
+
+   --  |=====================================================================
+   --  | Man page form_field_info.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Info (Fld                : in  Field;
+                   Lines              : out Line_Count;
+                   Columns            : out Column_Count;
+                   First_Row          : out Line_Position;
+                   First_Column       : out Column_Position;
+                   Off_Screen         : out Natural;
+                   Additional_Buffers : out Buffer_Number);
+   --  AKA: field_info()
+
+   --  |
+   procedure Dynamic_Info (Fld     : in Field;
+                           Lines   : out Line_Count;
+                           Columns : out Column_Count;
+                           Max     : out Natural);
+   --  AKA: dynamic_field_info()
+
+   --  |=====================================================================
+   --  | Man page form_win.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Window (Frm : in Form;
+                         Win : in Window);
+   --  AKA: set_form_win()
+
+   --  |
+   function Get_Window (Frm : Form) return Window;
+   --  AKA: form_win()
+
+   --  |
+   procedure Set_Sub_Window (Frm : in Form;
+                             Win : in Window);
+   --  AKA: set_form_sub()
+
+   --  |
+   function Get_Sub_Window (Frm : Form) return Window;
+   --  AKA: form_sub()
+
+   --  |
+   procedure Scale (Frm     : in Form;
+                    Lines   : out Line_Count;
+                    Columns : out Column_Count);
+   --  AKA: scale_form()
+
+   --  |=====================================================================
+   --  | Man page form_hook.3x
+   --  |=====================================================================
+
+   type Form_Hook_Function is access procedure (Frm : in Form);
+   pragma Convention (C, Form_Hook_Function);
+
+   --  |
+   procedure Set_Field_Init_Hook (Frm  : in Form;
+                                  Proc : in Form_Hook_Function);
+   --  AKA: set_field_init()
+
+   --  |
+   procedure Set_Field_Term_Hook (Frm  : in Form;
+                                  Proc : in Form_Hook_Function);
+   --  AKA: set_field_term()
+
+   --  |
+   procedure Set_Form_Init_Hook (Frm  : in Form;
+                                 Proc : in Form_Hook_Function);
+   --  AKA: set_form_init()
+
+   --  |
+   procedure Set_Form_Term_Hook (Frm  : in Form;
+                                 Proc : in Form_Hook_Function);
+   --  AKA: set_form_term()
+
+   --  |
+   function Get_Field_Init_Hook (Frm : Form) return Form_Hook_Function;
+   --  AKA: field_init()
+   pragma Import (C, Get_Field_Init_Hook, "field_init");
+
+   --  |
+   function Get_Field_Term_Hook (Frm : Form) return Form_Hook_Function;
+   --  AKA: field_term()
+   pragma Import (C, Get_Field_Term_Hook, "field_term");
+
+   --  |
+   function Get_Form_Init_Hook (Frm : Form) return Form_Hook_Function;
+   --  AKA: form_init()
+   pragma Import (C, Get_Form_Init_Hook, "form_init");
+
+   --  |
+   function Get_Form_Term_Hook (Frm : Form) return Form_Hook_Function;
+   --  AKA: form_term()
+   pragma Import (C, Get_Form_Term_Hook, "form_term");
+
+   --  |=====================================================================
+   --  | Man page form_field.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Redefine (Frm  : in Form;
+                       Flds : in Field_Array);
+   --  AKA: set_form_fields()
+   --  With a bit more comfort. You don´t need to terminate the Field_Array
+   --  with a null entry. This is handled internally in the binding.
+
+   --  |
+   procedure Set_Fields (Frm  : in Form;
+                         Flds : in Field_Array) renames Redefine;
+   --  AKA: set_form_fields()
+
+   --  |
+   function Fields (Frm : Form) return Field_Array_Access;
+   --  AKA: form_fields()
+
+   --  |
+   function Field_Count (Frm : Form) return Natural;
+   --  AKA: field_count()
+
+   --  |
+   procedure Move (Fld    : in Field;
+                   Line   : in Line_Position;
+                   Column : in Column_Position);
+   --  AKA: move_field()
+
+   --  |=====================================================================
+   --  | Man page form_new.3x
+   --  |=====================================================================
+
+   --  |
+   function Create (Fields : Field_Array) return Form;
+   --  AKA: new_form()
+
+   --  |
+   function New_Form (Fields : Field_Array) return Form renames Create;
+   --  AKA: new_form()
+
+   --  |
+   procedure Delete (Frm : in out Form);
+   --  AKA: free_form()
+   --  Reset Frm to Null_Form
+
+   --  |=====================================================================
+   --  | Man page form_opts.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Options (Frm     : in Form;
+                          Options : in Form_Option_Set);
+   --  AKA: set_form_opts()
+
+   --  |
+   procedure Switch_Options (Frm     : in Form;
+                             Options : in Form_Option_Set;
+                             On      : Boolean := True);
+   --  AKA: form_opts_on()
+   --  AKA: form_opts_off()
+
+   --  |
+   procedure Get_Options (Frm     : in  Form;
+                          Options : out Form_Option_Set);
+   --  AKA: form_opts()
+
+   --  |
+   function Get_Options (Frm : Form := Null_Form) return Form_Option_Set;
+   --  AKA: form_opts()
+
+   --  |=====================================================================
+   --  | Man page form_post.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Post (Frm  : in Form;
+                   Post : in Boolean := True);
+   --  AKA: post_form()
+   --  AKA: unpost_form()
+
+   --  |=====================================================================
+   --  | Man page form_cursor.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Position_Cursor (Frm : Form);
+   --  AKA: pos_form_cursor()
+
+   --  |=====================================================================
+   --  | Man page form_data.3x
+   --  |=====================================================================
+
+   --  |
+   function Data_Ahead (Frm : Form) return Boolean;
+   --  AKA: data_ahead()
+
+   --  |
+   function Data_Behind (Frm : Form) return Boolean;
+   --  AKA: data_behind()
+
+   --  |=====================================================================
+   --  | Man page form_driver.3x
+   --  |=====================================================================
+
+   type Driver_Result is (Form_Ok,
+                          Request_Denied,
+                          Unknown_Request,
+                          Invalid_Field);
+
+   --  |
+   function Driver (Frm : Form;
+                    Key : Key_Code) return Driver_Result;
+   --  AKA: form_driver()
+
+   --  |=====================================================================
+   --  | Man page form_page.3x
+   --  |=====================================================================
+
+   type Page_Number is new Natural;
+
+   --  |
+   procedure Set_Current (Frm : in Form;
+                          Fld : in Field);
+   --  AKA: set_current_field()
+
+   --  |
+   function Current (Frm : in Form) return Field;
+   --  AKA: current_field()
+
+   --  |
+   procedure Set_Page (Frm  : in Form;
+                       Page : in Page_Number := Page_Number'First);
+   --  AKA: set_form_page()
+
+   --  |
+   function Page (Frm : Form) return Page_Number;
+   --  AKA: form_page()
+
+   --  |
+   function Get_Index (Fld : Field) return Positive;
+   --  AKA: field_index()
+   --  Please note that in this binding we start the numbering of fields
+   --  with 1. So this is number is one more than you get from the low
+   --  level call.
+
+   --  |=====================================================================
+   --  | Man page form_new_page.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_New_Page (Fld      : in Field;
+                           New_Page : in Boolean := True);
+   --  AKA: set_new_page()
+
+   --  |
+   function Is_New_Page (Fld : Field) return Boolean;
+   --  AKA: new_page()
+
+   --  |=====================================================================
+   --  | Man page form_fieldtype.3x
+   --  |=====================================================================
+
+   type Field_Type is abstract tagged null record;
+   type Field_Type_Access is access all Field_Type'Class;
+
+   function Native_Type (Ftype : Field_Type)
+                         return C_Field_Type is abstract;
+   --  This function returns the C libraries handle to the field type.
+   --  May be you need this if you want to interface to lower level
+   --  routines in the form library.
+
+   --  |
+   procedure Set_Type (Fld      : in Field;
+                       Fld_Type : in Field_Type) is abstract;
+   --  AKA: set_field_type()
+   --  But: we hide the vararg mechanism of the C interface. You always
+   --       have to pass a single Field_Type parameter.
+
+   type C_Defined_Field_Type is abstract new Field_Type with null record;
+   --  This is the root of all field typed defined in C, i.e. this are
+   --  the predefined field types in the form library.
+
+   type Alpha_Field is new C_Defined_Field_Type
+      with record
+         Minimum_Field_Width : Natural := 0;
+      end record;
+   procedure Set_Type (Fld      : in Field;
+                       Fld_Type : in Alpha_Field);
+   function Native_Type (Ftype : Alpha_Field)
+                         return C_Field_Type;
+
+   type Alpha_Numeric_Field is new C_Defined_Field_Type with
+      record
+         Minimum_Field_Width : Natural := 0;
+      end record;
+   procedure Set_Type (Fld      : in Field;
+                       Fld_Type : in Alpha_Numeric_Field);
+   function Native_Type (Ftype : Alpha_Numeric_Field)
+                         return C_Field_Type;
+
+   type Integer_Field is new C_Defined_Field_Type with
+      record
+         Precision   : Natural;
+         Lower_Limit : Integer;
+         Upper_Limit : Integer;
+      end record;
+   procedure Set_Type (Fld      : in Field;
+                       Fld_Type : in Integer_Field);
+   function Native_Type (Ftype : Integer_Field)
+                         return C_Field_Type;
+
+   type Numeric_Field is new C_Defined_Field_Type with
+      record
+         Precision   : Natural;
+         Lower_Limit : Float;
+         Upper_Limit : Float;
+      end record;
+   procedure Set_Type (Fld      : in Field;
+                       Fld_Type : in Numeric_Field);
+   function Native_Type (Ftype : Numeric_Field)
+                         return C_Field_Type;
+
+   type String_Access is access String;
+
+   type Regular_Expression_Field is new C_Defined_Field_Type with
+      record
+         Regular_Expression : String_Access;
+      end record;
+   procedure Set_Type (Fld      : in Field;
+                       Fld_Type : in Regular_Expression_Field);
+   function Native_Type (Ftype : Regular_Expression_Field)
+                         return C_Field_Type;
+
+   type Enum_Array is array (Positive range <>)
+      of String_Access;
+
+   type Enumeration_Info (C : Positive) is
+      record
+         Names                : Enum_Array (1 .. C);
+         Case_Sensitive       : Boolean := False;
+         Match_Must_Be_Unique : Boolean := False;
+      end record;
+
+   type Enumeration_Field is new C_Defined_Field_Type with private;
+
+   function Create (Info : Enumeration_Info;
+                    Auto_Release_Names : Boolean := False)
+                    return Enumeration_Field;
+   --  Make an fieldtype from the info. Enumerations are special, because
+   --  they normally don't copy the enum values into a private store, so
+   --  we have to care for the lifetime of the info we provide.
+   --  The Auto_Release_Names flag may be used to automatically releases
+   --  the strings in the Names array of the Enumeration_Info.
+
+   function Make_Enumeration_Type (Info : Enumeration_Info;
+                                   Auto_Release_Names : Boolean := False)
+                                   return Enumeration_Field renames Create;
+
+   procedure Release (Enum : in out Enumeration_Field);
+   --  But we may want to release the field to release the memory allocated
+   --  by it internally. After that the Enumeration field is no longer usable.
+
+   procedure Set_Type (Fld      : in Field;
+                       Fld_Type : in Enumeration_Field);
+   function Native_Type (Ftype : Enumeration_Field)
+                         return C_Field_Type;
+
+   --  The next type defintions are all ncurses extensions. They are typically
+   --  not available in other curses implementations.
+
+   type Internet_V4_Address_Field is new C_Defined_Field_Type
+     with null record;
+   procedure Set_Type (Fld      : in Field;
+                       Fld_Type : in Internet_V4_Address_Field);
+   function Native_Type (Ftype : Internet_V4_Address_Field)
+                         return C_Field_Type;
+
+
+   type Ada_Defined_Field_Type is abstract new Field_Type with null record;
+   --  This is the root of the mechanism we use to create field types in
+   --  Ada95. You don't have to redefine the Set_Field_Type and
+   --  Native_Field_Type methods, because they work generically on this
+   --  class.
+
+   procedure Set_Type (Fld      : Field;
+                       Fld_Type : Ada_Defined_Field_Type);
+
+   function Native_Type (Ftype : Ada_Defined_Field_Type)
+                         return C_Field_Type;
+
+   --  |=====================================================================
+   --  | Man page form_field_validation.3x
+   --  |=====================================================================
+
+   --  |
+   function Get_Type (Fld : in Field) return Field_Type_Access;
+   --  AKA: field_type()
+   --  AKA: field_arg()
+   --  In Ada95 we can combine these
+
+------------------------------------------------------------------------------
+private
+
+   type Field        is new System.Address;
+   type Form         is new System.Address;
+   type C_Field_Type is new System.Address;
+
+   Null_Field        : constant Field        := Field (System.Null_Address);
+   Null_Form         : constant Form         := Form  (System.Null_Address);
+   Null_Field_Type   : constant C_Field_Type :=
+     C_Field_Type (System.Null_Address);
+
+   type CPA_Access is access Interfaces.C.Strings.chars_ptr_array;
+
+   type Enumeration_Field is new C_Defined_Field_Type with
+      record
+         Case_Sensitive       : Boolean := False;
+         Match_Must_Be_Unique : Boolean := False;
+         Arr                  : CPA_Access := null;
+      end record;
+
+   --  In our binding we use the fields user pointer as hook to maintain
+   --  our own info structure about the field type. To be able to still
+   --  provide a user pointer, we use this wrapper.
+   --
+   type Field_User_Wrapper is
+      record
+         U : System.Address;    --  the hook we provide for the user
+         T : Field_Type_Access; --  may be null
+         N : Natural;           --  use counter
+      end record;
+   pragma Convention (C, Field_User_Wrapper);
+   type Field_User_Wrapper_Access is access all Field_User_Wrapper;
+   pragma Controlled (Field_User_Wrapper_Access);
+
+   function Set_Field_Userptr (Fld : Field;
+                               Wrp : Field_User_Wrapper_Access)
+                               return Interfaces.C.int;
+   pragma Import (C, Set_Field_Userptr, "set_field_userptr");
+
+   function Field_Userptr (Fld : Field) return Field_User_Wrapper_Access;
+   pragma Import (C, Field_Userptr, "field_userptr");
+
+   --  In our binding we use the forms user pointer as hook to maintain
+   --  our own info structure about the field association. To be able to still
+   --  provide a user pointer, we use this wrapper.
+   --
+   type Form_User_Wrapper is
+      record
+         U : System.Address;      --  the hook we provide for the user
+         I : Field_Array_Access;
+      end record;
+   pragma Convention (C, Form_User_Wrapper);
+   type Form_User_Wrapper_Access is access all Form_User_Wrapper;
+   pragma Controlled (Form_User_Wrapper_Access);
+
+   function Set_Form_Userptr (Frm : Form;
+                              Wrp : Form_User_Wrapper_Access)
+                              return Interfaces.C.int;
+   pragma Import (C, Set_Form_Userptr, "set_form_userptr");
+
+   function Form_Userptr (Frm : Form) return Form_User_Wrapper_Access;
+   pragma Import (C, Form_Userptr, "form_userptr");
+
+   procedure Register_Type   (T   : in Ada_Defined_Field_Type'Class;
+                              Cft : in C_Field_Type);
+   procedure Unregister_Type (T   : in Ada_Defined_Field_Type'Class);
+   function  Search_Type (T : Ada_Defined_Field_Type'Class)
+                          return C_Field_Type;
+
+   Generation_Bit_Order : constant System.Bit_Order := System.Low_Order_First;
+   --  This constant may be different on your system.
+
+end Terminal_Interface.Curses.Forms;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-menus-item_user_data_s.html b/Ada95/html/terminal_interface-curses-menus-item_user_data_s.html new file mode 100644 index 00000000..5675d804 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-menus-item_user_data_s.html @@ -0,0 +1,72 @@ + + + + + +

+
+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--               Terminal_Interface.Curses.Menus.Item_User_Data             --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.2 @
+------------------------------------------------------------------------------
+
+generic
+   type User is limited private;
+   type User_Access is access User;
+package Terminal_Interface.Curses.Menus.Item_User_Data is
+
+   --  The binding uses the same user pointer for menu items
+   --  as the low level C implementation. So you can safely
+   --  read or write the user pointer also with the C routines
+   --
+   --  |=====================================================================
+   --  | Man page mitem_userptr.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_User_Data (Itm  : in Item;
+                            Data : in User_Access);
+   --  AKA: set_item_userptr
+   pragma Convention (C, Set_User_Data);
+
+   --  |
+   procedure Get_User_Data (Itm  : in  Item;
+                            Data : out User_Access);
+   --  AKA: item_userptr
+   pragma Convention (C, Get_User_Data);
+
+end Terminal_Interface.Curses.Menus.Item_User_Data;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-menus-menu_user_data_s.html b/Ada95/html/terminal_interface-curses-menus-menu_user_data_s.html new file mode 100644 index 00000000..2cbd2338 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-menus-menu_user_data_s.html @@ -0,0 +1,77 @@ + + + + + +

+
+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--               Terminal_Interface.Curses.Menus.Menu_User_Data             --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.2 @
+------------------------------------------------------------------------------
+
+generic
+   type User is limited private;
+   type User_Access is access User;
+package Terminal_Interface.Curses.Menus.Menu_User_Data is
+
+   --  The binding uses the C level user pointer already for its own
+   --  internal purposes. So you can´t easily manipulate the user pointer
+   --  with the low level C routines for this menu without taking care of
+   --  this special situation. If you want to read or write with C routines
+   --  the user pointer of this menu, you should get first the low level
+   --  user pointer. This points to a record, that always has as its first
+   --  member the Ada95 user pointer for this menu. You should never change
+   --  the low level user pointer of an Ada created menu.
+   --
+   --  |=====================================================================
+   --  | Man page menu_userptr.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_User_Data (Men  : in Menu;
+                            Data : in User_Access);
+   --  AKA: set_menu_userptr
+   pragma Convention (C, Set_User_Data);
+
+   --  |
+   procedure Get_User_Data (Men  : in  Menu;
+                            Data : out User_Access);
+   --  AKA: menu_userptr
+   pragma Convention (C, Get_User_Data);
+
+end Terminal_Interface.Curses.Menus.Menu_User_Data;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-menus_s.html b/Ada95/html/terminal_interface-curses-menus_s.html new file mode 100644 index 00000000..cd1ce0cc --- /dev/null +++ b/Ada95/html/terminal_interface-curses-menus_s.html @@ -0,0 +1,617 @@ + + + + + +

+
+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--                      Terminal_Interface.Curses.Menu                      --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.7 @
+------------------------------------------------------------------------------
+--  menu binding, generated at Sun Feb  2 17:21:44 1997
+--  This module is generated. Please don't change it manually!
+--  Run the generator instead.
+--  |
+with System;
+with Interfaces.C;
+with Ada.Characters.Latin_1;
+
+package Terminal_Interface.Curses.Menus is
+
+   pragma Linker_Options ("-lmenu");
+
+
+
+   Space : Character renames Ada.Characters.Latin_1.Space;
+
+   type Item is private;
+   type Menu is private;
+
+   ---------------------------
+   --  Interface constants  --
+   ---------------------------
+   Null_Item : constant Item;
+   Null_Menu : constant Menu;
+
+   subtype Menu_Request_Code is Key_Code
+     range (Key_Max + 1) .. (Key_Max + 17);
+
+   --  The prefix M_ stands for "Menu Request"
+   M_Left_Item       : constant Menu_Request_Code := Key_Max + 1;
+   M_Right_Item      : constant Menu_Request_Code := Key_Max + 2;
+   M_Up_Item         : constant Menu_Request_Code := Key_Max + 3;
+   M_Down_Item       : constant Menu_Request_Code := Key_Max + 4;
+   M_ScrollUp_Line   : constant Menu_Request_Code := Key_Max + 5;
+   M_ScrollDown_Line : constant Menu_Request_Code := Key_Max + 6;
+   M_ScrollDown_Page : constant Menu_Request_Code := Key_Max + 7;
+   M_ScrollUp_Page   : constant Menu_Request_Code := Key_Max + 8;
+   M_First_Item      : constant Menu_Request_Code := Key_Max + 9;
+   M_Last_Item       : constant Menu_Request_Code := Key_Max + 10;
+   M_Next_Item       : constant Menu_Request_Code := Key_Max + 11;
+   M_Previous_Item   : constant Menu_Request_Code := Key_Max + 12;
+   M_Toggle_Item     : constant Menu_Request_Code := Key_Max + 13;
+   M_Clear_Pattern   : constant Menu_Request_Code := Key_Max + 14;
+   M_Back_Pattern    : constant Menu_Request_Code := Key_Max + 15;
+   M_Next_Match      : constant Menu_Request_Code := Key_Max + 16;
+   M_Previous_Match  : constant Menu_Request_Code := Key_Max + 17;
+
+   --  For those who like the old 'C' names for the request codes
+   REQ_LEFT_ITEM     : Menu_Request_Code renames M_Left_Item;
+   REQ_RIGHT_ITEM    : Menu_Request_Code renames M_Right_Item;
+   REQ_UP_ITEM       : Menu_Request_Code renames M_Up_Item;
+   REQ_DOWN_ITEM     : Menu_Request_Code renames M_Down_Item;
+   REQ_SCR_ULINE     : Menu_Request_Code renames M_ScrollUp_Line;
+   REQ_SCR_DLINE     : Menu_Request_Code renames M_ScrollDown_Line;
+   REQ_SCR_DPAGE     : Menu_Request_Code renames M_ScrollDown_Page;
+   REQ_SCR_UPAGE     : Menu_Request_Code renames M_ScrollUp_Page;
+   REQ_FIRST_ITEM    : Menu_Request_Code renames M_First_Item;
+   REQ_LAST_ITEM     : Menu_Request_Code renames M_Last_Item;
+   REQ_NEXT_ITEM     : Menu_Request_Code renames M_Next_Item;
+   REQ_PREV_ITEM     : Menu_Request_Code renames M_Previous_Item;
+   REQ_TOGGLE_ITEM   : Menu_Request_Code renames M_Toggle_Item;
+   REQ_CLEAR_PATTERN : Menu_Request_Code renames M_Clear_Pattern;
+   REQ_BACK_PATTERN  : Menu_Request_Code renames M_Back_Pattern;
+   REQ_NEXT_MATCH    : Menu_Request_Code renames M_Next_Match;
+   REQ_PREV_MATCH    : Menu_Request_Code renames M_Previous_Match;
+
+   procedure Request_Name (Key  : in Menu_Request_Code;
+                           Name : out String);
+
+   ------------------
+   --  Exceptions  --
+   ------------------
+
+   Menu_Exception : exception;
+   --
+   --  Menu options
+   --
+
+   type Menu_Option_Set is
+      record
+         One_Valued        : Boolean;
+         Show_Descriptions : Boolean;
+         Row_Major_Order   : Boolean;
+         Ignore_Case       : Boolean;
+         Show_Matches      : Boolean;
+         Non_Cyclic        : Boolean;
+         Reserved          : Boolean;
+      end record;
+   pragma Pack (Menu_Option_Set);
+   pragma Convention (C, Menu_Option_Set);
+
+   for Menu_Option_Set use
+      record
+         One_Valued        at 0 range  0 ..  0;
+         Show_Descriptions at 0 range  1 ..  1;
+         Row_Major_Order   at 0 range  2 ..  2;
+         Ignore_Case       at 0 range  3 ..  3;
+         Show_Matches      at 0 range  4 ..  4;
+         Non_Cyclic        at 0 range  5 ..  5;
+         Reserved          at 0 range 31 .. 31;
+      end record;
+   for Menu_Option_Set'Size use Interfaces.C.int'Size;
+   --  Please note: this rep. clause is generated and may be
+   --               different on your system.
+
+   Default_Menu_Options : Menu_Option_Set;
+   --  Initial default options for a menu.
+
+   --
+   --  Item options
+   --
+   type Item_Option_Set is
+      record
+         Selectable : Boolean;
+         Reserved   : Boolean;
+      end record;
+   pragma Pack (Item_Option_Set);
+   pragma Convention (C, Item_Option_Set);
+
+   for Item_Option_Set use
+      record
+         Selectable at 0 range  0 ..  0;
+         Reserved   at 0 range 31 .. 31;
+      end record;
+   for Item_Option_Set'Size use Interfaces.C.int'Size;
+   --  Please note: this rep. clause is generated and may be
+   --               different on your system.
+
+   Default_Item_Options : Item_Option_Set;
+   --  Initial default options for an item.
+
+   --
+   --  Item Array
+   --
+   type Item_Array is array (Positive range <>) of aliased Item;
+   pragma Convention (C, Item_Array);
+
+   type Item_Array_Access is access all Item_Array;
+
+   --  |=====================================================================
+   --  | Man page mitem_new.3x
+   --  |=====================================================================
+
+   --  |
+   function Create (Name        : String;
+                    Description : String := "") return Item;
+   --  AKA: new_item()
+
+   --  |
+   function New_Item (Name        : String;
+                      Description : String := "") return Item
+     renames Create;
+   --  AKA: new_item()
+
+   --  |
+   procedure Delete (Itm : in out Item);
+   --  AKA: free_item()
+   --  Resets Itm to Null_Item
+
+   --  |=====================================================================
+   --  | Man page mitem_value.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Value (Itm   : in Item;
+                        Value : in Boolean := True);
+   --  AKA: set_item_value()
+
+   --  |
+   function Value (Itm : Item) return Boolean;
+   --  AKA: item_value()
+
+   --  |=====================================================================
+   --  | Man page mitem_visible.3x
+   --  |=====================================================================
+
+   --  |
+   function Visible (Itm : Item) return Boolean;
+   --  AKA: item_visible()
+
+   --  |=====================================================================
+   --  | Man page mitem_opts.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Options (Itm     : in Item;
+                          Options : in Item_Option_Set);
+   --  AKA: set_item_opts()
+
+   --  |
+   procedure Switch_Options (Itm     : in Item;
+                             Options : in Item_Option_Set;
+                             On      : Boolean := True);
+   --  AKA: item_opts_on()
+   --  AKA: item_opts_off()
+
+   --  |
+   procedure Get_Options (Itm     : in  Item;
+                          Options : out Item_Option_Set);
+   --  AKA: item_opts()
+
+   --  |
+   function Get_Options (Itm : Item := Null_Item) return Item_Option_Set;
+   --  AKA: item_opts()
+
+   --  |=====================================================================
+   --  | Man page mitem_name.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Name (Itm  : in Item;
+                   Name : out String);
+   --  AKA: item_name()
+
+   --  |
+   procedure Description (Itm         : in Item;
+                          Description : out String);
+   --  AKA: item_description();
+
+   --  |=====================================================================
+   --  | Man page mitem_current.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Current (Men : in Menu;
+                          Itm : in Item);
+   --  AKA: set_current_item()
+
+   --  |
+   function Current (Men : Menu) return Item;
+   --  AKA: current_item()
+
+   --  |
+   procedure Set_Top_Row (Men  : in Menu;
+                          Line : in Line_Position);
+   --  AKA: set_top_row()
+
+   --  |
+   function Top_Row (Men : Menu) return Line_Position;
+   --  AKA: top_row()
+
+   --  |
+   function Get_Index (Itm : Item) return Positive;
+   --  AKA: item_index()
+   --  Please note that in this binding we start the numbering of items
+   --  with 1. So this is number is one more than you get from the low
+   --  level call.
+
+   --  |=====================================================================
+   --  | Man page menu_post.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Post (Men  : in Menu;
+                   Post : in Boolean := True);
+   --  AKA: post_menu()
+   --  AKA: unpost_menu()
+
+   --  |=====================================================================
+   --  | Man page menu_opts.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Options (Men     : in Menu;
+                          Options : in Menu_Option_Set);
+   --  AKA: set_menu_opts()
+
+   --  |
+   procedure Switch_Options (Men     : in Menu;
+                             Options : in Menu_Option_Set;
+                             On      : Boolean := True);
+   --  AKA: menu_opts_on()
+   --  AKA: menu_opts_off()
+
+   --  |
+   procedure Get_Options (Men     : in  Menu;
+                          Options : out Menu_Option_Set);
+   --  AKA: menu_opts()
+
+   --  |
+   function Get_Options (Men : Menu := Null_Menu) return Menu_Option_Set;
+   --  AKA: menu_opts()
+
+   --  |=====================================================================
+   --  | Man page menu_win.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Window (Men : in Menu;
+                         Win : in Window);
+   --  AKA: set_menu_win()
+
+   --  |
+   function Get_Window (Men : Menu) return Window;
+   --  AKA: menu_win()
+
+   --  |
+   procedure Set_Sub_Window (Men : in Menu;
+                             Win : in Window);
+   --  AKA: set_menu_sub()
+
+   --  |
+   function Get_Sub_Window (Men : Menu) return Window;
+   --  AKA: menu_sub()
+
+   --  |
+   procedure Scale (Men     : in Menu;
+                    Lines   : out Line_Count;
+                    Columns : out Column_Count);
+   --  AKA: scale_menu()
+
+   --  |=====================================================================
+   --  | Man page menu_cursor.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Position_Cursor (Men : Menu);
+   --  AKA: pos_menu_cursor()
+
+   --  |=====================================================================
+   --  | Man page menu_mark.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Mark (Men  : in Menu;
+                       Mark : in String);
+   --  AKA: set_menu_mark()
+
+   --  |
+   procedure Mark (Men  : in  Menu;
+                   Mark : out String);
+   --  AKA: menu_mark()
+
+   --  |=====================================================================
+   --  | Man page menu_attribs.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Foreground
+     (Men   : in Menu;
+      Fore  : in Character_Attribute_Set := Normal_Video;
+      Color : in Color_Pair := Color_Pair'First);
+   --  AKA: set_menu_fore()
+
+   --  |
+   procedure Foreground (Men   : in  Menu;
+                         Fore  : out Character_Attribute_Set);
+   --  AKA: menu_fore()
+
+   --  |
+   procedure Foreground (Men   : in  Menu;
+                         Fore  : out Character_Attribute_Set;
+                         Color : out Color_Pair);
+   --  AKA: menu_fore()
+
+   --  |
+   procedure Set_Background
+     (Men   : in Menu;
+      Back  : in Character_Attribute_Set := Normal_Video;
+      Color : in Color_Pair := Color_Pair'First);
+   --  AKA: set_menu_back()
+
+   --  |
+   procedure Background (Men  : in  Menu;
+                         Back : out Character_Attribute_Set);
+   --  AKA: menu_back()
+   --  |
+
+   procedure Background (Men   : in  Menu;
+                         Back  : out Character_Attribute_Set;
+                         Color : out Color_Pair);
+   --  AKA: menu_back()
+
+   --  |
+   procedure Set_Grey
+     (Men   : in Menu;
+      Grey  : in Character_Attribute_Set := Normal_Video;
+      Color : in Color_Pair := Color_Pair'First);
+   --  AKA: set_menu_grey()
+
+   --  |
+   procedure Grey (Men  : in  Menu;
+                   Grey : out Character_Attribute_Set);
+   --  AKA: menu_grey()
+
+   --  |
+   procedure Grey
+     (Men   : in  Menu;
+      Grey  : out Character_Attribute_Set;
+      Color : out Color_Pair);
+   --  AKA: menu_grey()
+
+   --  |
+   procedure Set_Pad_Character (Men : in Menu;
+                                Pad : in Character := Space);
+   --  AKA: set_menu_pad()
+
+   --  |
+   procedure Pad_Character (Men : in  Menu;
+                            Pad : out Character);
+   --  AKA: menu_pad()
+
+   --  |=====================================================================
+   --  | Man page menu_spacing.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Spacing (Men   : in Menu;
+                          Descr : in Column_Position := 0;
+                          Row   : in Line_Position   := 0;
+                          Col   : in Column_Position := 0);
+   --  AKA: set_menu_spacing()
+
+   --  |
+   procedure Spacing (Men   : in Menu;
+                      Descr : out Column_Position;
+                      Row   : out Line_Position;
+                      Col   : out Column_Position);
+   --  AKA: menu_spacing()
+
+   --  |=====================================================================
+   --  | Man page menu_pattern.3x
+   --  |=====================================================================
+
+   --  |
+   function Set_Pattern (Men  : Menu;
+                         Text : String) return Boolean;
+   --  AKA: set_menu_pattern()
+   --  Return TRUE if the pattern matches, FALSE otherwise
+
+   --  |
+   procedure Pattern (Men  : in  Menu;
+                      Text : out String);
+   --  AKA: menu_pattern()
+
+   --  |=====================================================================
+   --  | Man page menu_format.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Format (Men     : in Menu;
+                         Lines   : in Line_Count;
+                         Columns : in Column_Count);
+   --  AKA: set_menu_format()
+
+   --  |
+   procedure Format (Men     : in  Menu;
+                     Lines   : out Line_Count;
+                     Columns : out Column_Count);
+   --  AKA: menu_format()
+
+   --  |=====================================================================
+   --  | Man page menu_hook.3x
+   --  |=====================================================================
+
+   type Menu_Hook_Function is access procedure (Men : in Menu);
+   pragma Convention (C, Menu_Hook_Function);
+
+   --  |
+   procedure Set_Item_Init_Hook (Men  : in Menu;
+                                 Proc : in Menu_Hook_Function);
+   --  AKA: set_item_init()
+
+   --  |
+   procedure Set_Item_Term_Hook (Men  : in Menu;
+                                 Proc : in Menu_Hook_Function);
+   --  AKA: set_item_term()
+
+   --  |
+   procedure Set_Menu_Init_Hook (Men  : in Menu;
+                                 Proc : in Menu_Hook_Function);
+   --  AKA: set_menu_init()
+
+   --  |
+   procedure Set_Menu_Term_Hook (Men  : in Menu;
+                                 Proc : in Menu_Hook_Function);
+   --  AKA: set_menu_term()
+
+   --  |
+   function Get_Item_Init_Hook (Men : Menu) return Menu_Hook_Function;
+   --  AKA: item_init()
+
+   --  |
+   function Get_Item_Term_Hook (Men : Menu) return Menu_Hook_Function;
+   --  AKA: item_term()
+
+   --  |
+   function Get_Menu_Init_Hook (Men : Menu) return Menu_Hook_Function;
+   --  AKA: menu_init()
+
+   --  |
+   function Get_Menu_Term_Hook (Men : Menu) return Menu_Hook_Function;
+   --  AKA: menu_term()
+
+   --  |=====================================================================
+   --  | Man page menu_items.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Redefine (Men   : in Menu;
+                       Items : in Item_Array);
+   --  AKA: set_menu_items()
+   --  With a bit more comfort. You don´t need to terminate the Item_Array
+   --  with a null entry. This is handled internally in the binding.
+
+   procedure Set_Items (Men   : in Menu;
+                        Items : in Item_Array) renames Redefine;
+
+   --  |
+   function Items (Men : Menu) return Item_Array_Access;
+   --  AKA: menu_items()
+
+   --  |
+   function Item_Count (Men : Menu) return Natural;
+   --  AKA: item_count()
+
+   --  |=====================================================================
+   --  | Man page menu_new.3x
+   --  |=====================================================================
+
+   --  |
+   function Create (Items : Item_Array) return Menu;
+   --  AKA: new_menu()
+
+   function New_Menu (Items : Item_Array) return Menu renames Create;
+
+   --  |
+   procedure Delete (Men : in out Menu);
+   --  AKA: free_menu()
+   --  Reset Men to Null_Menu
+
+   --  |=====================================================================
+   --  | Man page menu_new.3x
+   --  |=====================================================================
+
+   type Driver_Result is (Menu_Ok,
+                          Request_Denied,
+                          Unknown_Request,
+                          No_Match);
+
+   --  |
+   function Driver (Men : Menu;
+                    Key : Key_Code) return Driver_Result;
+   --  AKA: menu_driver()
+
+-------------------------------------------------------------------------------
+private
+   type Item   is new System.Address;
+   type Menu   is new System.Address;
+
+   Null_Item : constant Item := Item (System.Null_Address);
+   Null_Menu : constant Menu := Menu (System.Null_Address);
+
+   --  This binding uses the original user pointer mechanism of a menu to store
+   --  specific informations about a menu. This wrapper record carries this
+   --  specifics and contains a field to maintain a new user pointer. Please
+   --  note that you must take this into account if you wan't to use the user
+   --  pointer mechanism of a menu created with this binding in low-level C
+   --  routines.
+   type Ada_User_Wrapper is
+      record
+         U : System.Address;
+         I : Item_Array_Access;
+      end record;
+   pragma Convention (C, Ada_User_Wrapper);
+   type Ada_User_Wrapper_Access is access all Ada_User_Wrapper;
+   pragma Controlled (Ada_User_Wrapper_Access);
+
+   Generation_Bit_Order : constant System.Bit_Order := System.Low_Order_First;
+   --  This constant may be different on your system.
+
+end Terminal_Interface.Curses.Menus;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-mouse_s.html b/Ada95/html/terminal_interface-curses-mouse_s.html new file mode 100644 index 00000000..0b92a66a --- /dev/null +++ b/Ada95/html/terminal_interface-curses-mouse_s.html @@ -0,0 +1,158 @@ + + + + + +

+
+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--                      Terminal_Interface.Curses.Mouse                     --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.6 @
+------------------------------------------------------------------------------
+--  mouse binding, generated at Sun Feb  2 17:21:45 1997
+--  This module is generated. Please don't change it manually!
+--  Run the generator instead.
+--  |
+with System;
+
+package Terminal_Interface.Curses.Mouse is
+
+   --  |=====================================================================
+   --  | Man page curs_mouse.3x
+   --  |=====================================================================
+   --  Please note, that in ncurses-1.9.9e documentation mouse support
+   --  is still marked as experimental. So also this binding will change
+   --  if the ncurses methods change.
+   --
+   type Event_Mask is private;
+   No_Events  : constant Event_Mask;
+   All_Events : constant Event_Mask;
+
+   type Mouse_Button is (Left,     -- aka: Button 1
+                         Middle,   -- aka: Button 2
+                         Right,    -- aka: Button 3
+                         Button4,  -- aka: Button 4
+                         Control,  -- Control Key
+                         Shift,    -- Shift Key
+                         Alt);     -- ALT Key
+
+   type Button_State is (Released,
+                         Pressed,
+                         Clicked,
+                         Double_Clicked,
+                         Triple_Clicked);
+
+   type Mouse_Event is private;
+
+   --  |=====================================================================
+   --  | Man page curs_mouse.3x
+   --  |=====================================================================
+
+   procedure Register_Reportable_Event
+     (B    : in Mouse_Button;
+      S    : in Button_State;
+      Mask : in out Event_Mask);
+   --  Stores the event described by the button and the state in the mask.
+   --  Before you call this the first time, you should init the mask
+   --  with the Empty_Mask constant
+
+   --  |
+   function Start_Mouse (Mask : Event_Mask := All_Events)
+                         return Event_Mask;
+   --  AKA: mousemask()
+
+   procedure End_Mouse;
+   pragma Import (C, End_Mouse, "_nc_ada_unregister_mouse");
+   --  Terminates the mouse
+
+   --  |
+   function Get_Mouse return Mouse_Event;
+   --  AKA: getmouse()
+
+   procedure Get_Event (Event  : in  Mouse_Event;
+                        Y      : out Line_Position;
+                        X      : out Column_Position;
+                        Button : out Mouse_Button;
+                        State  : out Button_State);
+   --  !!! Warning: X and Y are screen coordinates. Due to ripped of lines they
+   --  may not be identical to window coordinates.
+
+   --  |
+   procedure Unget_Mouse (Event : in Mouse_Event);
+   --  AKA: ungetmouse()
+
+   --  |
+   function Enclosed_In_Window (Win    : Window := Standard_Window;
+                                Event  : Mouse_Event) return Boolean;
+   --  AKA: wenclose()
+   --  But : use event instead of screen coordinates.
+
+   --  |
+   function Mouse_Interval (Msec : Natural := 200) return Natural;
+   --  AKA: mouseinterval()
+
+private
+   type Event_Mask is new Interfaces.C.int;
+   No_Events  : constant Event_Mask := 0;
+   All_Events : constant Event_Mask := -1;
+
+   type Mouse_Event is
+      record
+         Id      : Integer range Integer (Interfaces.C.short'First) ..
+                                 Integer (Interfaces.C.Short'Last);
+         X, Y, Z : Integer range Integer (Interfaces.C.int'First) ..
+                                 Integer (Interfaces.C.int'Last);
+         Bstate  : Event_Mask;
+      end record;
+   pragma Convention (C, Mouse_Event);
+   pragma Pack (Mouse_Event);
+
+   for Mouse_Event use
+      record
+         Id      at 0 range   0 ..  15;
+         X       at 0 range  32 ..  63;
+         Y       at 0 range  64 ..  95;
+         Z       at 0 range  96 .. 127;
+         Bstate  at 0 range 128 .. 159;
+      end record;
+      --  Please note: this rep. clause is generated and may be
+      --               different on your system.
+
+   Generation_Bit_Order : constant System.Bit_Order := System.Low_Order_First;
+   --  This constant may be different on your system.
+
+end Terminal_Interface.Curses.Mouse;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-panels-user_data_s.html b/Ada95/html/terminal_interface-curses-panels-user_data_s.html new file mode 100644 index 00000000..236b7c81 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-panels-user_data_s.html @@ -0,0 +1,68 @@ + + + + + +

+
+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--                 Terminal_Interface.Curses.Panels.User_Data               --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.2 @
+------------------------------------------------------------------------------
+
+generic
+   type User is limited private;
+   type User_Access is access all User;
+package Terminal_Interface.Curses.Panels.User_Data is
+
+   --  |=====================================================================
+   --  | Man page panel.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_User_Data (Pan  : in Panel;
+                            Data : in User_Access);
+   --  AKA: set_panel_userptr
+   pragma Convention (C, Set_User_Data);
+
+   --  |
+   procedure Get_User_Data (Pan  : in  Panel;
+                            Data : out User_Access);
+   --  AKA: panel_userptr
+   pragma Convention (C, Get_User_Data);
+
+end Terminal_Interface.Curses.Panels.User_Data;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-panels_s.html b/Ada95/html/terminal_interface-curses-panels_s.html new file mode 100644 index 00000000..c292134e --- /dev/null +++ b/Ada95/html/terminal_interface-curses-panels_s.html @@ -0,0 +1,139 @@ + + + + + +

+
+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--                      Terminal_Interface.Curses.Panels                    --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.2 @
+------------------------------------------------------------------------------
+with System;
+
+package Terminal_Interface.Curses.Panels is
+
+   pragma Linker_Options ("-lpanel");
+
+
+   type Panel is private;
+
+   ---------------------------
+   --  Interface constants  --
+   ---------------------------
+   Null_Panel : constant Panel;
+
+   -------------------
+   --  Exceptions   --
+   -------------------
+
+   Panel_Exception : exception;
+
+   --  |=====================================================================
+   --  | Man page panel.3x
+   --  |=====================================================================
+
+   --  |
+   function Create (Win : Window) return Panel;
+   --  AKA: new_panel()
+
+   --  |
+   function New_Panel (Win : Window) return Panel renames Create;
+   --  AKA: new_panel()
+
+   --  |
+   procedure Bottom (Pan : in Panel);
+   --  AKA: bottom_panel()
+
+   --  |
+   procedure Top (Pan : in Panel);
+   --  AKA: top_panel()
+
+   --  |
+   procedure Show (Pan : in Panel);
+   --  AKA: show_panel()
+
+   --  |
+   procedure Update_Panels;
+   --  AKA: update_panels()
+   pragma Import (C, Update_Panels, "update_panels");
+
+   --  |
+   procedure Hide (Pan : in Panel);
+   --  AKA: hide_panel()
+
+   --  |
+   function Get_Window (Pan : Panel) return Window;
+   --  AKA: panel_window()
+
+   --  |
+   function Panel_Window (Pan : Panel) return Window renames Get_Window;
+
+   --  |
+   procedure Replace (Pan : in Panel;
+                      Win : in Window);
+   --  AKA: replace_panel()
+
+   --  |
+   procedure Move (Pan    : in Panel;
+                   Line   : in Line_Position;
+                   Column : in Column_Position);
+   --  AKA: move_panel()
+
+   --  |
+   function Is_Hidden (Pan : Panel) return Boolean;
+   --  AKA: panel_hidden()
+
+   --  |
+   function Above (Pan : Panel) return Panel;
+   --  AKA: panel_above()
+   pragma Import (C, Above, "panel_above");
+
+   --  |
+   function Below (Pan : Panel) return Panel;
+   --  AKA: panel_below()
+   pragma Import (C, Below, "panel_below");
+
+   --  |
+   procedure Delete (Pan : in out Panel);
+   --  AKA: del_panel()
+
+   private
+      type Panel is new System.Address;
+      Null_Panel : constant Panel := Panel (System.Null_Address);
+
+end Terminal_Interface.Curses.Panels;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-text_io-complex_io_s.html b/Ada95/html/terminal_interface-curses-text_io-complex_io_s.html new file mode 100644 index 00000000..a336fce8 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-text_io-complex_io_s.html @@ -0,0 +1,74 @@ + + + + + +

+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--               Terminal_Interface.Curses.Text_IO.Complex_IO               --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.3 @
+------------------------------------------------------------------------------
+with Ada.Numerics.Generic_Complex_Types;
+
+generic
+   with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (<>);
+
+package Terminal_Interface.Curses.Text_IO.Complex_IO is
+
+   use Complex_Types;
+
+   Default_Fore : Field := 2;
+   Default_Aft  : Field := Real'Digits - 1;
+   Default_Exp  : Field := 3;
+   
+   procedure Put
+     (Win  : in Window;
+      Item : in Complex;
+      Fore : in Field := Default_Fore;
+      Aft  : in Field := Default_Aft;
+      Exp  : in Field := Default_Exp);
+
+   procedure Put
+     (Item : in Complex;
+      Fore : in Field := Default_Fore;
+      Aft  : in Field := Default_Aft;
+      Exp  : in Field := Default_Exp);
+
+private
+   pragma Inline (Put);
+
+end Terminal_Interface.Curses.Text_IO.Complex_IO;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-text_io-decimal_io_s.html b/Ada95/html/terminal_interface-curses-text_io-decimal_io_s.html new file mode 100644 index 00000000..6ffe5562 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-text_io-decimal_io_s.html @@ -0,0 +1,70 @@ + + + + + +

+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--               Terminal_Interface.Curses.Text_IO.Decimal_IO               --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.4 @
+------------------------------------------------------------------------------
+generic
+   type Num is delta <> digits <>;
+
+package Terminal_Interface.Curses.Text_IO.Decimal_IO is
+
+   Default_Fore : Field := Num'Fore;
+   Default_Aft  : Field := Num'Aft;
+   Default_Exp  : Field := 0;
+
+   procedure Put
+     (Win  : in Window;
+      Item : in Num;
+      Fore : in Field := Default_Fore;
+      Aft  : in Field := Default_Aft;
+      Exp  : in Field := Default_Exp);
+
+   procedure Put
+     (Item  : in Num;
+      Fore : in Field := Default_Fore;
+      Aft  : in Field := Default_Aft;
+      Exp  : in Field := Default_Exp);
+
+private
+   pragma Inline (Put);
+
+end Terminal_Interface.Curses.Text_IO.Decimal_IO;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-text_io-enumeration_io_s.html b/Ada95/html/terminal_interface-curses-text_io-enumeration_io_s.html new file mode 100644 index 00000000..e3b3c89b --- /dev/null +++ b/Ada95/html/terminal_interface-curses-text_io-enumeration_io_s.html @@ -0,0 +1,67 @@ + + + + + +

+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--             Terminal_Interface.Curses.Text_IO.Enumeration_IO             --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.4 @
+------------------------------------------------------------------------------
+generic
+   type Enum is (<>);
+
+package Terminal_Interface.Curses.Text_IO.Enumeration_IO is
+
+   Default_Width : Field := 0;
+   Default_Setting : Type_Set := Mixed_Case;
+
+   procedure Put
+     (Win   : in Window;
+      Item  : in Enum;
+      Width : in Field := Default_Width;
+      Set   : in Type_Set := Default_Setting);
+
+   procedure Put
+     (Item  : in Enum;
+      Width : in Field := Default_Width;
+      Set   : in Type_Set := Default_Setting);
+
+private
+   pragma Inline (Put);
+
+end Terminal_Interface.Curses.Text_IO.Enumeration_IO;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-text_io-fixed_io_s.html b/Ada95/html/terminal_interface-curses-text_io-fixed_io_s.html new file mode 100644 index 00000000..c6686deb --- /dev/null +++ b/Ada95/html/terminal_interface-curses-text_io-fixed_io_s.html @@ -0,0 +1,70 @@ + + + + + +

+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--                Terminal_Interface.Curses.Text_IO.Fixed_IO                --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.4 @
+------------------------------------------------------------------------------
+generic
+   type Num is delta <>;
+
+package Terminal_Interface.Curses.Text_IO.Fixed_IO is
+
+   Default_Fore : Field := Num'Fore;
+   Default_Aft  : Field := Num'Aft;
+   Default_Exp  : Field := 0;
+
+   procedure Put
+     (Win  : in Window;
+      Item : in Num;
+      Fore : in Field := Default_Fore;
+      Aft  : in Field := Default_Aft;
+      Exp  : in Field := Default_Exp);
+
+   procedure Put
+     (Item  : in Num;
+      Fore : in Field := Default_Fore;
+      Aft  : in Field := Default_Aft;
+      Exp  : in Field := Default_Exp);
+
+private
+   pragma Inline (Put);
+
+end Terminal_Interface.Curses.Text_IO.Fixed_IO;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-text_io-float_io_s.html b/Ada95/html/terminal_interface-curses-text_io-float_io_s.html new file mode 100644 index 00000000..cf5cc4a4 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-text_io-float_io_s.html @@ -0,0 +1,70 @@ + + + + + +

+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--                Terminal_Interface.Curses.Text_IO.Float_IO                --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.4 @
+------------------------------------------------------------------------------
+generic
+   type Num is digits <>;
+
+package Terminal_Interface.Curses.Text_IO.Float_IO is
+
+   Default_Fore : Field := 2;
+   Default_Aft  : Field := Num'Digits - 1;
+   Default_Exp  : Field := 3;
+
+   procedure Put
+     (Win  : in Window;
+      Item : in Num;
+      Fore : in Field := Default_Fore;
+      Aft  : in Field := Default_Aft;
+      Exp  : in Field := Default_Exp);
+
+   procedure Put
+     (Item  : in Num;
+      Fore : in Field := Default_Fore;
+      Aft  : in Field := Default_Aft;
+      Exp  : in Field := Default_Exp);
+
+private
+   pragma Inline (Put);
+
+end Terminal_Interface.Curses.Text_IO.Float_IO;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-text_io-integer_io_s.html b/Ada95/html/terminal_interface-curses-text_io-integer_io_s.html new file mode 100644 index 00000000..052606a4 --- /dev/null +++ b/Ada95/html/terminal_interface-curses-text_io-integer_io_s.html @@ -0,0 +1,67 @@ + + + + + +

+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--               Terminal_Interface.Curses.Text_IO.Integer_IO               --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.4 @
+------------------------------------------------------------------------------
+generic
+   type Num is range <>;
+
+package Terminal_Interface.Curses.Text_IO.Integer_IO is
+
+   Default_Width : Field := Num'Width;
+   Default_Base  : Number_Base := 10;
+
+   procedure Put
+     (Win   : in Window;
+      Item  : in Num;
+      Width : in Field := Default_Width;
+      Base  : in Number_Base := Default_Base);
+
+   procedure Put
+     (Item  : in Num;
+      Width : in Field := Default_Width;
+      Base  : in Number_Base := Default_Base);
+
+private
+   pragma Inline (Put);
+
+end Terminal_Interface.Curses.Text_IO.Integer_IO;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-text_io-modular_io_s.html b/Ada95/html/terminal_interface-curses-text_io-modular_io_s.html new file mode 100644 index 00000000..d01cad1b --- /dev/null +++ b/Ada95/html/terminal_interface-curses-text_io-modular_io_s.html @@ -0,0 +1,67 @@ + + + + + +

+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--               Terminal_Interface.Curses.Text_IO.Modular_IO               --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.4 @
+------------------------------------------------------------------------------
+generic
+   type Num is mod <>;
+
+package Terminal_Interface.Curses.Text_IO.Modular_IO is
+
+   Default_Width : Field := Num'Width;
+   Default_Base  : Number_Base := 10;
+
+   procedure Put
+     (Win   : in Window;
+      Item  : in Num;
+      Width : in Field := Default_Width;
+      Base  : in Number_Base := Default_Base);
+
+   procedure Put
+     (Item  : in Num;
+      Width : in Field := Default_Width;
+      Base  : in Number_Base := Default_Base);
+
+private
+   pragma Inline (Put);
+
+end Terminal_Interface.Curses.Text_IO.Modular_IO;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses-text_io_s.html b/Ada95/html/terminal_interface-curses-text_io_s.html new file mode 100644 index 00000000..d7af6f4a --- /dev/null +++ b/Ada95/html/terminal_interface-curses-text_io_s.html @@ -0,0 +1,142 @@ + + + + + +

+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--                     Terminal_Interface.Curses.Text_IO                    --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.5 @
+------------------------------------------------------------------------------
+with System;
+with System.Parameters;
+with Ada.Text_IO;
+with Ada.IO_Exceptions;
+
+package Terminal_Interface.Curses.Text_IO is
+
+   use type Ada.Text_IO.Count;
+   subtype Count is Ada.Text_IO.Count;
+   subtype Positive_Count is Count range 1 .. Count'Last;
+
+   subtype Field is Integer range 0 .. System.Parameters.Field_Max;
+   subtype Number_Base is Integer range 2 .. 16;
+
+   type Type_Set is (Lower_Case, Upper_Case, Mixed_Case);
+
+   --  For most of the routines you will see a version without a Window
+   --  type parameter. They will operate on a default window, which can
+   --  be set by the user. It is initially equal to Standard_Window.
+
+   procedure Set_Window (Win : in Window);
+   --  Set Win as the default window
+
+   function Get_Window return Window;
+   --  Get the current default window
+
+   procedure Flush (Win : in Window);
+   procedure Flush;
+
+   --------------------------------------------
+   -- Specification of line and page lengths --
+   --------------------------------------------
+
+   --  There are no set routines in this package. I assume, that you allocate
+   --  the window with an appropriate size.
+   --  A scroll-window is interpreted as an page with unbounded page length,
+   --  i.e. it returns the conventional 0 as page length.
+
+   function Line_Length (Win : in Window) return Count;
+   function Line_Length return Count;
+
+   function Page_Length (Win : in Window) return Count;
+   function Page_Length return Count;
+
+   ------------------------------------
+   -- Column, Line, and Page Control --
+   ------------------------------------
+   procedure New_Line (Win : in Window; Spacing : in Positive_Count := 1);
+   procedure New_Line (Spacing : in Positive_Count := 1);
+
+   procedure New_Page (Win : in Window);
+   procedure New_Page;
+
+   procedure Set_Col (Win : in Window;  To : in Positive_Count);
+   procedure Set_Col (To : in Positive_Count);
+
+   procedure Set_Line (Win : in Window; To : in Positive_Count);
+   procedure Set_Line (To : in Positive_Count);
+
+   function Col (Win : in Window) return Positive_Count;
+   function Col return Positive_Count;
+
+   function Line (Win : in Window) return Positive_Count;
+   function Line return Positive_Count;
+
+   -----------------------
+   -- Characters-Output --
+   -----------------------
+
+   procedure Put (Win  : in Window; Item : in Character);
+   procedure Put (Item : in Character);
+
+   --------------------
+   -- Strings-Output --
+   --------------------
+
+   procedure Put (Win  : in Window; Item : in String);
+   procedure Put (Item : in String);
+
+   procedure Put_Line
+     (Win  : in Window;
+      Item : in String);
+
+   procedure Put_Line
+     (Item : in String);
+
+   --  Exceptions
+
+   Status_Error : exception renames Ada.IO_Exceptions.Status_Error;
+   Mode_Error   : exception renames Ada.IO_Exceptions.Mode_Error;
+   Name_Error   : exception renames Ada.IO_Exceptions.Name_Error;
+   Use_Error    : exception renames Ada.IO_Exceptions.Use_Error;
+   Device_Error : exception renames Ada.IO_Exceptions.Device_Error;
+   End_Error    : exception renames Ada.IO_Exceptions.End_Error;
+   Data_Error   : exception renames Ada.IO_Exceptions.Data_Error;
+   Layout_Error : exception renames Ada.IO_Exceptions.Layout_Error;
+
+end Terminal_Interface.Curses.Text_IO;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface-curses_s.html b/Ada95/html/terminal_interface-curses_s.html new file mode 100644 index 00000000..6eaf8bae --- /dev/null +++ b/Ada95/html/terminal_interface-curses_s.html @@ -0,0 +1,1541 @@ + + + + + +


+

+
+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--                         Terminal_Interface.Curses                        --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.7 @
+------------------------------------------------------------------------------
+--  curses binding, generated at Sun Feb  2 17:21:42 1997
+--  This module is generated. Please don't change it manually!
+--  Run the generator instead.
+--  |
+with System;
+with Interfaces.C;   --  We need this for some assertions.
+
+package Terminal_Interface.Curses is
+
+   pragma Linker_Options ("-lncurses");
+
+   type Window is private;
+   Null_Window : constant Window;
+
+   type Line_Position   is new Natural; --  line coordinate
+   type Column_Position is new Natural; --  column coordinate
+
+   subtype Line_Count   is Line_Position   range 1 .. Line_Position'Last;
+   --  Type to count lines. We do not allow null windows, so must be positive
+   subtype Column_Count is Column_Position range 1 .. Column_Position'Last;
+   --  Type to count columns. We do not allow null windows, so must be positive
+
+   type Key_Code is new Natural;
+   --  That is anything including real characters, special keys and logical
+   --  request codes.
+
+   subtype Real_Key_Code is Key_Code range 0 .. 8#777#;
+   --  This are the codes that potentially represent a real keystroke.
+   --  Not all codes may be possible on a specific terminal. To check the
+   --  availability of a special key, the Has_Key function is provided.
+
+   subtype Special_Key_Code is Real_Key_Code
+     range 8#400# .. Real_Key_Code'Last;
+   --  Type for a function- or special key number
+
+   subtype Normal_Key_Code is Real_Key_Code range
+     Character'Pos (Character'First) .. Character'Pos (Character'Last);
+   --  This are the codes for regular (incl. non-graphical) characters.
+
+   --  Constants for function- and special keys
+   --
+   Key_None                       : constant Special_Key_Code := 8#400#;
+   Key_Code_Yes                   : constant Special_Key_Code := 8#400#;
+   Key_Min                        : constant Special_Key_Code := 8#401#;
+   Key_Break                      : constant Special_Key_Code := 8#401#;
+   Key_Cursor_Down                : constant Special_Key_Code := 8#402#;
+   Key_Cursor_Up                  : constant Special_Key_Code := 8#403#;
+   Key_Cursor_Left                : constant Special_Key_Code := 8#404#;
+   Key_Cursor_Right               : constant Special_Key_Code := 8#405#;
+   Key_Home                       : constant Special_Key_Code := 8#406#;
+   Key_Backspace                  : constant Special_Key_Code := 8#407#;
+   Key_F0                         : constant Special_Key_Code := 8#410#;
+   Key_F1                         : constant Special_Key_Code := 8#411#;
+   Key_F2                         : constant Special_Key_Code := 8#412#;
+   Key_F3                         : constant Special_Key_Code := 8#413#;
+   Key_F4                         : constant Special_Key_Code := 8#414#;
+   Key_F5                         : constant Special_Key_Code := 8#415#;
+   Key_F6                         : constant Special_Key_Code := 8#416#;
+   Key_F7                         : constant Special_Key_Code := 8#417#;
+   Key_F8                         : constant Special_Key_Code := 8#420#;
+   Key_F9                         : constant Special_Key_Code := 8#421#;
+   Key_F10                        : constant Special_Key_Code := 8#422#;
+   Key_F11                        : constant Special_Key_Code := 8#423#;
+   Key_F12                        : constant Special_Key_Code := 8#424#;
+   Key_F13                        : constant Special_Key_Code := 8#425#;
+   Key_F14                        : constant Special_Key_Code := 8#426#;
+   Key_F15                        : constant Special_Key_Code := 8#427#;
+   Key_F16                        : constant Special_Key_Code := 8#430#;
+   Key_F17                        : constant Special_Key_Code := 8#431#;
+   Key_F18                        : constant Special_Key_Code := 8#432#;
+   Key_F19                        : constant Special_Key_Code := 8#433#;
+   Key_F20                        : constant Special_Key_Code := 8#434#;
+   Key_F21                        : constant Special_Key_Code := 8#435#;
+   Key_F22                        : constant Special_Key_Code := 8#436#;
+   Key_F23                        : constant Special_Key_Code := 8#437#;
+   Key_F24                        : constant Special_Key_Code := 8#440#;
+   Key_Delete_Line                : constant Special_Key_Code := 8#510#;
+   Key_Insert_Line                : constant Special_Key_Code := 8#511#;
+   Key_Delete_Char                : constant Special_Key_Code := 8#512#;
+   Key_Insert_Char                : constant Special_Key_Code := 8#513#;
+   Key_Exit_Insert_Mode           : constant Special_Key_Code := 8#514#;
+   Key_Clear_Screen               : constant Special_Key_Code := 8#515#;
+   Key_Clear_End_Of_Screen        : constant Special_Key_Code := 8#516#;
+   Key_Clear_End_Of_Line          : constant Special_Key_Code := 8#517#;
+   Key_Scroll_1_Forward           : constant Special_Key_Code := 8#520#;
+   Key_Scroll_1_Backward          : constant Special_Key_Code := 8#521#;
+   Key_Next_Page                  : constant Special_Key_Code := 8#522#;
+   Key_Previous_Page              : constant Special_Key_Code := 8#523#;
+   Key_Set_Tab                    : constant Special_Key_Code := 8#524#;
+   Key_Clear_Tab                  : constant Special_Key_Code := 8#525#;
+   Key_Clear_All_Tabs             : constant Special_Key_Code := 8#526#;
+   Key_Enter_Or_Send              : constant Special_Key_Code := 8#527#;
+   Key_Soft_Reset                 : constant Special_Key_Code := 8#530#;
+   Key_Reset                      : constant Special_Key_Code := 8#531#;
+   Key_Print                      : constant Special_Key_Code := 8#532#;
+   Key_Bottom                     : constant Special_Key_Code := 8#533#;
+   Key_Upper_Left_Of_Keypad       : constant Special_Key_Code := 8#534#;
+   Key_Upper_Right_Of_Keypad      : constant Special_Key_Code := 8#535#;
+   Key_Center_Of_Keypad           : constant Special_Key_Code := 8#536#;
+   Key_Lower_Left_Of_Keypad       : constant Special_Key_Code := 8#537#;
+   Key_Lower_Right_Of_Keypad      : constant Special_Key_Code := 8#540#;
+   Key_Back_Tab                   : constant Special_Key_Code := 8#541#;
+   Key_Beginning                  : constant Special_Key_Code := 8#542#;
+   Key_Cancel                     : constant Special_Key_Code := 8#543#;
+   Key_Close                      : constant Special_Key_Code := 8#544#;
+   Key_Command                    : constant Special_Key_Code := 8#545#;
+   Key_Copy                       : constant Special_Key_Code := 8#546#;
+   Key_Create                     : constant Special_Key_Code := 8#547#;
+   Key_End                        : constant Special_Key_Code := 8#550#;
+   Key_Exit                       : constant Special_Key_Code := 8#551#;
+   Key_Find                       : constant Special_Key_Code := 8#552#;
+   Key_Help                       : constant Special_Key_Code := 8#553#;
+   Key_Mark                       : constant Special_Key_Code := 8#554#;
+   Key_Message                    : constant Special_Key_Code := 8#555#;
+   Key_Move                       : constant Special_Key_Code := 8#556#;
+   Key_Next                       : constant Special_Key_Code := 8#557#;
+   Key_Open                       : constant Special_Key_Code := 8#560#;
+   Key_Options                    : constant Special_Key_Code := 8#561#;
+   Key_Previous                   : constant Special_Key_Code := 8#562#;
+   Key_Redo                       : constant Special_Key_Code := 8#563#;
+   Key_Reference                  : constant Special_Key_Code := 8#564#;
+   Key_Refresh                    : constant Special_Key_Code := 8#565#;
+   Key_Replace                    : constant Special_Key_Code := 8#566#;
+   Key_Restart                    : constant Special_Key_Code := 8#567#;
+   Key_Resume                     : constant Special_Key_Code := 8#570#;
+   Key_Save                       : constant Special_Key_Code := 8#571#;
+   Key_Shift_Begin                : constant Special_Key_Code := 8#572#;
+   Key_Shift_Cancel               : constant Special_Key_Code := 8#573#;
+   Key_Shift_Command              : constant Special_Key_Code := 8#574#;
+   Key_Shift_Copy                 : constant Special_Key_Code := 8#575#;
+   Key_Shift_Create               : constant Special_Key_Code := 8#576#;
+   Key_Shift_Delete_Char          : constant Special_Key_Code := 8#577#;
+   Key_Shift_Delete_Line          : constant Special_Key_Code := 8#600#;
+   Key_Select                     : constant Special_Key_Code := 8#601#;
+   Key_Shift_End                  : constant Special_Key_Code := 8#602#;
+   Key_Shift_Clear_End_Of_Line    : constant Special_Key_Code := 8#603#;
+   Key_Shift_Exit                 : constant Special_Key_Code := 8#604#;
+   Key_Shift_Find                 : constant Special_Key_Code := 8#605#;
+   Key_Shift_Help                 : constant Special_Key_Code := 8#606#;
+   Key_Shift_Home                 : constant Special_Key_Code := 8#607#;
+   Key_Shift_Insert_Char          : constant Special_Key_Code := 8#610#;
+   Key_Shift_Cursor_Left          : constant Special_Key_Code := 8#611#;
+   Key_Shift_Message              : constant Special_Key_Code := 8#612#;
+   Key_Shift_Move                 : constant Special_Key_Code := 8#613#;
+   Key_Shift_Next_Page            : constant Special_Key_Code := 8#614#;
+   Key_Shift_Options              : constant Special_Key_Code := 8#615#;
+   Key_Shift_Previous_Page        : constant Special_Key_Code := 8#616#;
+   Key_Shift_Print                : constant Special_Key_Code := 8#617#;
+   Key_Shift_Redo                 : constant Special_Key_Code := 8#620#;
+   Key_Shift_Replace              : constant Special_Key_Code := 8#621#;
+   Key_Shift_Cursor_Right         : constant Special_Key_Code := 8#622#;
+   Key_Shift_Resume               : constant Special_Key_Code := 8#623#;
+   Key_Shift_Save                 : constant Special_Key_Code := 8#624#;
+   Key_Shift_Suspend              : constant Special_Key_Code := 8#625#;
+   Key_Shift_Undo                 : constant Special_Key_Code := 8#626#;
+   Key_Suspend                    : constant Special_Key_Code := 8#627#;
+   Key_Undo                       : constant Special_Key_Code := 8#630#;
+   Key_Mouse                      : constant Special_Key_Code := 8#631#;
+
+   Key_Max                        : constant Special_Key_Code
+     := Special_Key_Code'Last;
+
+   subtype User_Key_Code is Key_Code
+     range (Key_Max + 129) .. Key_Code'Last;
+   --  This is reserved for user defined key codes. The range between Key_Max
+   --  and the first user code is reserved for subsystems like menu and forms.
+
+   --  For those who like to use the original key names we produce them were
+   --  they differ from the original. Please note that they may differ in
+   --  lower/upper case.
+   KEY_DOWN         : Special_Key_Code renames Key_Cursor_Down;
+   KEY_UP           : Special_Key_Code renames Key_Cursor_Up;
+   KEY_LEFT         : Special_Key_Code renames Key_Cursor_Left;
+   KEY_RIGHT        : Special_Key_Code renames Key_Cursor_Right;
+   KEY_DL           : Special_Key_Code renames Key_Delete_Line;
+   KEY_IL           : Special_Key_Code renames Key_Insert_Line;
+   KEY_DC           : Special_Key_Code renames Key_Delete_Char;
+   KEY_IC           : Special_Key_Code renames Key_Insert_Char;
+   KEY_EIC          : Special_Key_Code renames Key_Exit_Insert_Mode;
+   KEY_CLEAR        : Special_Key_Code renames Key_Clear_Screen;
+   KEY_EOS          : Special_Key_Code renames Key_Clear_End_Of_Screen;
+   KEY_EOL          : Special_Key_Code renames Key_Clear_End_Of_Line;
+   KEY_SF           : Special_Key_Code renames Key_Scroll_1_Forward;
+   KEY_SR           : Special_Key_Code renames Key_Scroll_1_Backward;
+   KEY_NPAGE        : Special_Key_Code renames Key_Next_Page;
+   KEY_PPAGE        : Special_Key_Code renames Key_Previous_Page;
+   KEY_STAB         : Special_Key_Code renames Key_Set_Tab;
+   KEY_CTAB         : Special_Key_Code renames Key_Clear_Tab;
+   KEY_CATAB        : Special_Key_Code renames Key_Clear_All_Tabs;
+   KEY_ENTER        : Special_Key_Code renames Key_Enter_Or_Send;
+   KEY_SRESET       : Special_Key_Code renames Key_Soft_Reset;
+   KEY_LL           : Special_Key_Code renames Key_Bottom;
+   KEY_A1           : Special_Key_Code renames Key_Upper_Left_Of_Keypad;
+   KEY_A3           : Special_Key_Code renames Key_Upper_Right_Of_Keypad;
+   KEY_B2           : Special_Key_Code renames Key_Center_Of_Keypad;
+   KEY_C1           : Special_Key_Code renames Key_Lower_Left_Of_Keypad;
+   KEY_C3           : Special_Key_Code renames Key_Lower_Right_Of_Keypad;
+   KEY_BTAB         : Special_Key_Code renames Key_Back_Tab;
+   KEY_BEG          : Special_Key_Code renames Key_Beginning;
+   KEY_SBEG         : Special_Key_Code renames Key_Shift_Begin;
+   KEY_SCANCEL      : Special_Key_Code renames Key_Shift_Cancel;
+   KEY_SCOMMAND     : Special_Key_Code renames Key_Shift_Command;
+   KEY_SCOPY        : Special_Key_Code renames Key_Shift_Copy;
+   KEY_SCREATE      : Special_Key_Code renames Key_Shift_Create;
+   KEY_SDC          : Special_Key_Code renames Key_Shift_Delete_Char;
+   KEY_SDL          : Special_Key_Code renames Key_Shift_Delete_Line;
+   KEY_SEND         : Special_Key_Code renames Key_Shift_End;
+   KEY_SEOL         : Special_Key_Code renames Key_Shift_Clear_End_Of_Line;
+   KEY_SEXIT        : Special_Key_Code renames Key_Shift_Exit;
+   KEY_SFIND        : Special_Key_Code renames Key_Shift_Find;
+   KEY_SHELP        : Special_Key_Code renames Key_Shift_Help;
+   KEY_SHOME        : Special_Key_Code renames Key_Shift_Home;
+   KEY_SIC          : Special_Key_Code renames Key_Shift_Insert_Char;
+   KEY_SLEFT        : Special_Key_Code renames Key_Shift_Cursor_Left;
+   KEY_SMESSAGE     : Special_Key_Code renames Key_Shift_Message;
+   KEY_SMOVE        : Special_Key_Code renames Key_Shift_Move;
+   KEY_SNEXT        : Special_Key_Code renames Key_Shift_Next_Page;
+   KEY_SOPTIONS     : Special_Key_Code renames Key_Shift_Options;
+   KEY_SPREVIOUS    : Special_Key_Code renames Key_Shift_Previous_Page;
+   KEY_SPRINT       : Special_Key_Code renames Key_Shift_Print;
+   KEY_SREDO        : Special_Key_Code renames Key_Shift_Redo;
+   KEY_SREPLACE     : Special_Key_Code renames Key_Shift_Replace;
+   KEY_SRIGHT       : Special_Key_Code renames Key_Shift_Cursor_Right;
+   KEY_SRSUME       : Special_Key_Code renames Key_Shift_Resume;
+   KEY_SSAVE        : Special_Key_Code renames Key_Shift_Save;
+   KEY_SSUSPEND     : Special_Key_Code renames Key_Shift_Suspend;
+   KEY_SUNDO        : Special_Key_Code renames Key_Shift_Undo;
+
+
+------------------------------------------------------------------------------
+
+   type Color_Number is range 0 .. Integer (Interfaces.C.short'Last);
+   for Color_Number'Size use Interfaces.C.short'Size;
+   --  (n)curses uses a short for the color index
+   --  The model is, that a Color_Number is an index into an array of
+   --  (potentially) definable colors. Some of those indices are
+   --  predefined (see below), although they may not really exist.
+
+   Black    : constant Color_Number := 0;
+   Red      : constant Color_Number := 1;
+   Green    : constant Color_Number := 2;
+   Yellow   : constant Color_Number := 3;
+   Blue     : constant Color_Number := 4;
+   Magenta  : constant Color_Number := 5;
+   Cyan     : constant Color_Number := 6;
+   White    : constant Color_Number := 7;
+
+   type RGB_Value is range 0 .. Integer (Interfaces.C.Short'Last);
+   for RGB_Value'Size use Interfaces.C.short'Size;
+   --  Some system may allow to redefine a color by setting RGB values.
+
+   type Color_Pair is range 0 .. 255;
+   for Color_Pair'Size use 8;
+   subtype Redefinable_Color_Pair is Color_Pair range 1 .. 255;
+   --  (n)curses reserves 1 Byte for the color-pair number. Color Pair 0
+   --  is fixed (Black & White). A color pair is simply a combination of
+   --  two colors described by Color_Numbers, one for the foreground and
+   --  the other for the background
+
+   type Character_Attribute_Set is
+      record
+         Stand_Out               : Boolean;
+         Under_Line              : Boolean;
+         Reverse_Video           : Boolean;
+         Blink                   : Boolean;
+         Dim_Character           : Boolean;
+         Bold_Character          : Boolean;
+         Alternate_Character_Set : Boolean;
+         Invisible_Character     : Boolean;
+         Protected_Character     : Boolean;
+         Horizontal              : Boolean;
+         Left                    : Boolean;
+         Low                     : Boolean;
+         Right                   : Boolean;
+         Top                     : Boolean;
+         Vertical                : Boolean;
+         Reserved                : Boolean;
+      end record;
+   pragma Pack (Character_Attribute_Set);
+   pragma Convention (C, Character_Attribute_Set);
+
+   for Character_Attribute_Set use
+      record
+         Stand_Out               at 0 range  0 ..  0;
+         Under_Line              at 0 range  1 ..  1;
+         Reverse_Video           at 0 range  2 ..  2;
+         Blink                   at 0 range  3 ..  3;
+         Dim_Character           at 0 range  4 ..  4;
+         Bold_Character          at 0 range  5 ..  5;
+         Alternate_Character_Set at 0 range  6 ..  6;
+         Invisible_Character     at 0 range  7 ..  7;
+         Protected_Character     at 0 range  8 ..  8;
+         Horizontal              at 0 range  9 ..  9;
+         Left                    at 0 range 10 .. 10;
+         Low                     at 0 range 11 .. 11;
+         Right                   at 0 range 12 .. 12;
+         Top                     at 0 range 13 .. 13;
+         Vertical                at 0 range 14 .. 14;
+         Reserved                at 0 range 15 .. 15;
+      end record;
+   for Character_Attribute_Set'Size use Interfaces.C.int'Size / 2;
+   --  Please note: this rep. clause is generated and may be
+   --               different on your system.
+   --  (n)curses uses half of an integer for attributes.
+
+   Normal_Video : constant Character_Attribute_Set := (others => False);
+
+   type Attributed_Character is
+      record
+         Attr  : Character_Attribute_Set := Normal_Video;
+         Color : Color_Pair := 0;
+         Ch    : Character  := ' ';
+      end record;
+   pragma Convention (C, Attributed_Character);
+   --  This is the counterpart for the chtype in C.
+
+   for Attributed_Character use
+      record
+         Ch    at 0 range  0 ..  7;
+         Color at 0 range  8 .. 15;
+         Attr  at 0 range 16 .. 31;
+      end record;
+   for Attributed_Character'Size use Interfaces.C.int'Size;
+      --  Please note: this rep. clause is generated and may be
+      --               different on your system.
+
+   Default_Character : constant Attributed_Character
+     := (Ch    => Character'First,
+         Color => Color_Pair'First,
+         Attr  => Normal_Video);
+
+   type Attributed_String is array (Positive range <>) of Attributed_Character;
+   pragma Pack (Attributed_String);
+   --  In this binding we allow strings of attributed characters.
+
+   ------------------
+   --  Exceptions  --
+   ------------------
+   Curses_Exception : exception;
+
+   --  Those exceptions are raised by the ETI (Extended Terminal Interface)
+   --  subpackets for Menu and Forms handling.
+   --
+   Eti_System_Error    : exception;
+   Eti_Bad_Argument    : exception;
+   Eti_Posted          : exception;
+   Eti_Connected       : exception;
+   Eti_Bad_State       : exception;
+   Eti_No_Room         : exception;
+   Eti_Not_Posted      : exception;
+   Eti_Unknown_Command : exception;
+   Eti_No_Match        : exception;
+   Eti_Not_Selectable  : exception;
+   Eti_Not_Connected   : exception;
+   Eti_Request_Denied  : exception;
+   Eti_Invalid_Field   : exception;
+   Eti_Current         : exception;
+
+   --------------------------------------------------------------------------
+   --  External C variables
+   --  Conceptually even in C this are kind of constants, but they are
+   --  initialized and sometimes changed by the library routines at runtime
+   --  depending on the type of terminal. I believe the best way to model
+   --  this is to use functions.
+   --------------------------------------------------------------------------
+
+   function Lines            return Line_Count;
+   pragma Inline (Lines);
+
+   function Columns          return Column_Count;
+   pragma Inline (Columns);
+
+   function Tab_Size         return Natural;
+   pragma Inline (Tab_Size);
+
+   function Number_Of_Colors return Natural;
+   pragma Inline (Number_Of_Colors);
+
+   function Number_Of_Color_Pairs return Natural;
+   pragma Inline (Number_Of_Color_Pairs);
+
+   ACS_Map : array (Character'Val (0) .. Character'Val (127)) of
+     Attributed_Character;
+   pragma Import (C, ACS_Map, "acs_map");
+   --
+   --
+   --  Constants for several symbols from the Alternate Character Set
+   --  You must use this constants as indices into the ACS_Map array
+   --  to get the corresponding attributed character at runtime.
+   --
+   ACS_Upper_Left_Corner    : constant Character := 'l';
+   ACS_Lower_Left_Corner    : constant Character := 'm';
+   ACS_Upper_Right_Corner   : constant Character := 'k';
+   ACS_Lower_Right_Corner   : constant Character := 'j';
+   ACS_Left_Tee             : constant Character := 't';
+   ACS_Right_Tee            : constant Character := 'u';
+   ACS_Bottom_Tee           : constant Character := 'v';
+   ACS_Top_Tee              : constant Character := 'w';
+   ACS_Horizontal_Line      : constant Character := 'q';
+   ACS_Vertical_Line        : constant Character := 'x';
+   ACS_Plus_Symbol          : constant Character := 'n';
+   ACS_Scan_Line_1          : constant Character := 'o';
+   ACS_Scan_Line_9          : constant Character := 's';
+   ACS_Diamond              : constant Character := Character'Val (96);
+   ACS_Checker_Board        : constant Character := 'a';
+   ACS_Degree               : constant Character := 'f';
+   ACS_Plus_Minus           : constant Character := 'g';
+   ACS_Bullet               : constant Character := '~';
+   ACS_Left_Arrow           : constant Character := ',';
+   ACS_Right_Arrow          : constant Character := '+';
+   ACS_Down_Arrow           : constant Character := '.';
+   ACS_Up_Arrow             : constant Character := '-';
+   ACS_Board_Of_Squares     : constant Character := 'h';
+   ACS_Lantern              : constant Character := 'I';
+   ACS_Solid_Block          : constant Character := '0';
+   ACS_Scan_Line_3          : constant Character := 'p';
+   ACS_Scan_Line_7          : constant Character := 'r';
+   ACS_Less_Or_Equal        : constant Character := 'y';
+   ACS_Greater_Or_Equal     : constant Character := 'z';
+   ACS_PI                   : constant Character := '{';
+   ACS_Not_Equal            : constant Character := '|';
+   ACS_Sterling             : constant Character := '}';
+
+
+   --  |=====================================================================
+   --  | Man page curs_initscr.3x
+   --  |=====================================================================
+   --  | Not implemented: newterm, set_term, delscreen
+
+   --  |
+   function Standard_Window return Window;
+   --  AKA: stdscr
+   pragma Inline (Standard_Window);
+
+   --  |
+   procedure Init_Screen;
+
+   --  |
+   procedure Init_Windows renames Init_Screen;
+   --  AKA: initscr()
+
+   --  |
+   procedure End_Windows;
+   --  AKA: endwin()
+   procedure End_Screen renames End_Windows;
+
+   --  |
+   function Is_End_Window return Boolean;
+   --  AKA: isendwin()
+
+   --  |=====================================================================
+   --  | Man page curs_move.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Move_Cursor (Win    : in Window := Standard_Window;
+                          Line   : in Line_Position;
+                          Column : in Column_Position);
+   --  AKA: wmove()
+
+   --  |=====================================================================
+   --  | Man page curs_addch.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Add (Win :  in Window := Standard_Window;
+                  Ch  :  in Attributed_Character);
+   --  AKA: waddch()
+
+   procedure Add (Win :  in Window := Standard_Window;
+                  Ch  :  in Character);
+   --  Add a single character at the current logical cursor position to
+   --  the window. Use the current windows attributes.
+
+   --  |
+   procedure Add
+     (Win    : in Window := Standard_Window;
+      Line   : in Line_Position;
+      Column : in Column_Position;
+      Ch     : in Attributed_Character);
+   --  AKA: mvwaddch()
+
+   procedure Add
+     (Win    : in Window := Standard_Window;
+      Line   : in Line_Position;
+      Column : in Column_Position;
+      Ch     : in Character);
+   --  Move to the position and add a single character into the window
+
+   --  |
+   procedure Add_With_Immediate_Echo
+     (Win : in Window := Standard_Window;
+      Ch  : in Attributed_Character);
+   --  AKA: wechochar()
+
+   procedure Add_With_Immediate_Echo
+     (Win : in Window := Standard_Window;
+      Ch  : in Character);
+   --  Add a character and do an immediate resfresh of the screen.
+
+   --  |=====================================================================
+   --  | Man page curs_window.3x
+   --  |=====================================================================
+
+   --  |
+   function Create
+     (Number_Of_Lines       : Line_Count;
+      Number_Of_Columns     : Column_Count;
+      First_Line_Position   : Line_Position;
+      First_Column_Position : Column_Position) return Window;
+   --  AKA: newwin()
+
+   function New_Window
+     (Number_Of_Lines       : Line_Count;
+      Number_Of_Columns     : Column_Count;
+      First_Line_Position   : Line_Position;
+      First_Column_Position : Column_Position) return Window
+     renames Create;
+
+   --  |
+   procedure Delete (Win : in out Window);
+   --  AKA: delwin()
+   --  Reset Win to Null_Window
+
+   --  |
+   function Sub_Window
+     (Win                   : Window := Standard_Window;
+      Number_Of_Lines       : Line_Count;
+      Number_Of_Columns     : Column_Count;
+      First_Line_Position   : Line_Position;
+      First_Column_Position : Column_Position) return Window;
+   --  AKA: subwin()
+
+   --  |
+   function Derived_Window
+     (Win                   : Window := Standard_Window;
+      Number_Of_Lines       : Line_Count;
+      Number_Of_Columns     : Column_Count;
+      First_Line_Position   : Line_Position;
+      First_Column_Position : Column_Position) return Window;
+   --  AKA: derwin()
+
+   --  |
+   function Duplicate (Win : Window) return Window;
+   --  AKA: dupwin()
+
+   --  |
+   procedure Move_Window (Win    : in Window;
+                          Line   : in Line_Position;
+                          Column : in Column_Position);
+   --  AKA: mvwin()
+
+   --  |
+   procedure Move_Derived_Window (Win    : in Window;
+                                  Line   : in Line_Position;
+                                  Column : in Column_Position);
+   --  AKA: mvderwin()
+
+   --  |
+   procedure Synchronize_Upwards (Win : in Window);
+   --  AKA: wsyncup()
+   pragma Import (C, Synchronize_Upwards, "wsyncup");
+
+   --  |
+   procedure Synchronize_Downwards (Win : in Window);
+   --  AKA: wsyncdown()
+   pragma Import (C, Synchronize_Downwards, "wsyncdown");
+
+   --  |
+   procedure Set_Synch_Mode (Win  : in Window := Standard_Window;
+                             Mode : in Boolean := False);
+   --  AKA: syncok()
+
+   --  |=====================================================================
+   --  | Man page curs_addstr.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Add (Win : in Window := Standard_Window;
+                  Str : in String;
+                  Len : in Integer := -1);
+   --  AKA: waddnstr()
+   --  AKA: waddstr()
+
+   --  |
+   procedure Add (Win    : in Window := Standard_Window;
+                  Line   : in Line_Position;
+                  Column : in Column_Position;
+                  Str    : in String;
+                  Len    : in Integer := -1);
+   --  AKA: mvwaddnstr()
+   --  AKA: mvwaddstr()
+
+   --  |=====================================================================
+   --  | Man page curs_addchstr.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Add (Win : in Window := Standard_Window;
+                  Str : in Attributed_String;
+                  Len : in Integer := -1);
+   --  AKA: waddchnstr()
+   --  AKA: waddchstr()
+
+   --  |
+   procedure Add (Win    : in Window := Standard_Window;
+                  Line   : in Line_Position;
+                  Column : in Column_Position;
+                  Str    : in Attributed_String;
+                  Len    : in Integer := -1);
+   --  AKA: mvwaddchnstr()
+   --  AKA: mvwaddchstr()
+
+   --  |=====================================================================
+   --  | Man page curs_border.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Border
+     (Win                       : in Window := Standard_Window;
+      Left_Side_Symbol          : in Attributed_Character := Default_Character;
+      Right_Side_Symbol         : in Attributed_Character := Default_Character;
+      Top_Side_Symbol           : in Attributed_Character := Default_Character;
+      Bottom_Side_Symbol        : in Attributed_Character := Default_Character;
+      Upper_Left_Corner_Symbol  : in Attributed_Character := Default_Character;
+      Upper_Right_Corner_Symbol : in Attributed_Character := Default_Character;
+      Lower_Left_Corner_Symbol  : in Attributed_Character := Default_Character;
+      Lower_Right_Corner_Symbol : in Attributed_Character := Default_Character
+     );
+   --  AKA: wborder()
+
+   --  |
+   procedure Box
+     (Win               : in Window := Standard_Window;
+      Vertical_Symbol   : in Attributed_Character := Default_Character;
+      Horizontal_Symbol : in Attributed_Character := Default_Character);
+   --  AKA: box()
+
+   --  |
+   procedure Horizontal_Line
+     (Win         : in Window := Standard_Window;
+      Line_Size   : in Natural;
+      Line_Symbol : in Attributed_Character := Default_Character);
+   --  AKA: whline()
+
+   --  |
+   procedure Vertical_Line
+     (Win         : in Window := Standard_Window;
+      Line_Size   : in Natural;
+      Line_Symbol : in Attributed_Character := Default_Character);
+   --  AKA: wvline()
+
+   --  |=====================================================================
+   --  | Man page curs_getch.3x
+   --  |=====================================================================
+
+   --  |
+   function Get_Keystroke (Win : Window := Standard_Window)
+                           return Real_Key_Code;
+   --  AKA: wgetch()
+   --  Get a character from the keyboard and echo it - if enabled - to the
+   --  window.
+   --  If for any reason (i.e. a timeout) we couldn't get a character the
+   --  returned keycode is Key_None.
+
+   --  |
+   procedure Undo_Keystroke (Key : in Real_Key_Code);
+   --  AKA: ungetch()
+
+   --  |
+   function Has_Key (Key : Special_Key_Code) return Boolean;
+   --  AKA: has_key()
+   --  |
+   --  | Some helper functions
+   --  |
+   function Is_Function_Key (Key : Special_Key_Code) return Boolean;
+   --  Return True if the Key is a function key (i.e. one of F0 .. F63)
+
+   subtype Function_Key_Number is Integer range 0 .. 63;
+   --  (n)curses allows for 64 function keys.
+
+   function Function_Key (Key : Real_Key_Code) return Function_Key_Number;
+   --  Return the number of the function key. If the code is not a
+   --  function key, a CONSTRAINT_ERROR will be raised.
+
+   function Function_Key_Code (Key : Function_Key_Number) return Real_Key_Code;
+   --  Return the key code for a given functionkey number.
+
+   --  |=====================================================================
+   --  | Man page curs_attr.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Switch_Character_Attribute
+     (Win  : in Window := Standard_Window;
+      Attr : in Character_Attribute_Set := Normal_Video;
+      On   : in Boolean := True); --  if False we switch Off.
+   --  AKA: wattron()
+   --  AKA: wattroff()
+
+   --  |
+   procedure Set_Character_Attributes
+     (Win   : in Window := Standard_Window;
+      Attr  : in Character_Attribute_Set := Normal_Video;
+      Color : in Color_Pair := Color_Pair'First);
+   --  AKA: wattrset()
+
+   --  |
+   function Get_Character_Attribute
+     (Win : in Window := Standard_Window) return Character_Attribute_Set;
+   --  AKA: wattr_get()
+
+   --  |
+   function Get_Character_Attribute
+     (Win : in Window := Standard_Window) return Color_Pair;
+   --  AKA: wattr_get()
+
+   --  |
+   procedure Change_Attributes
+     (Win   : in Window := Standard_Window;
+      Count : in Integer := -1;
+      Attr  : in Character_Attribute_Set := Normal_Video;
+      Color : in Color_Pair := Color_Pair'First);
+   --  AKA: wchgat()
+
+   --  |
+   procedure Change_Attributes
+     (Win    : in Window := Standard_Window;
+      Line   : in Line_Position := Line_Position'First;
+      Column : in Column_Position := Column_Position'First;
+      Count  : in Integer := -1;
+      Attr   : in Character_Attribute_Set := Normal_Video;
+      Color  : in Color_Pair := Color_Pair'First);
+   --  AKA: mvwchgat()
+
+   --  |=====================================================================
+   --  | Man page curs_beep.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Beep;
+   --  AKA: beep()
+
+   --  |
+   procedure Flash_Screen;
+   --  AKA: flash()
+
+   --  |=====================================================================
+   --  | Man page curs_inopts.3x
+   --  |=====================================================================
+
+   --  | Not implemented : typeahead
+   --
+   --  |
+   procedure Set_Cbreak_Mode (SwitchOn : in Boolean := True);
+   --  AKA: cbreak()
+   --  AKA: nocbreak()
+
+   --  |
+   procedure Set_Raw_Mode (SwitchOn : in Boolean := True);
+   --  AKA: raw()
+   --  AKA: noraw()
+
+   --  |
+   procedure Set_Echo_Mode (SwitchOn : in Boolean := True);
+   --  AKA: echo()
+   --  AKA: noecho()
+
+   --  |
+   procedure Set_Meta_Mode (Win      : in Window := Standard_Window;
+                            SwitchOn : in Boolean := True);
+   --  AKA: meta()
+
+   --  |
+   procedure Set_KeyPad_Mode (Win      : in Window := Standard_Window;
+                              SwitchOn : in Boolean := True);
+   --  AKA: keypad()
+
+   type Half_Delay_Amount is range 1 .. 255;
+
+   --  |
+   procedure Half_Delay (Amount : in Half_Delay_Amount);
+   --  AKA: halfdelay()
+
+   --  |
+   procedure Set_Flush_On_Interrupt_Mode
+     (Win  : in Window := Standard_Window;
+      Mode : in Boolean := True);
+   --  AKA: intrflush()
+
+   --  |
+   procedure Set_Queue_Interrupt_Mode
+     (Win   : in Window := Standard_Window;
+      Flush : in Boolean := True);
+   --  AKA: qiflush()
+   --  AKA: noqiflush()
+
+   --  |
+   procedure Set_NoDelay_Mode
+     (Win  : in Window := Standard_Window;
+      Mode : in Boolean := False);
+   --  AKA: nodelay()
+
+   type Timeout_Mode is (Blocking, Non_Blocking, Delayed);
+
+   --  |
+   procedure Set_Timeout_Mode (Win    : in Window := Standard_Window;
+                               Mode   : in Timeout_Mode;
+                               Amount : in Natural); --  in Miliseconds
+   --  AKA: wtimeout()
+   --  Instead of overloading the semantic of the sign of amount, we
+   --  introduce the Timeout_Mode parameter. This should improve
+   --  readability. For Blocking and Non_Blocking, the Amount is not
+   --  evaluated.
+
+   --  |
+   procedure Set_Escape_Timer_Mode
+     (Win       : in Window := Standard_Window;
+      Timer_Off : in Boolean := False);
+   --  AKA: notimeout()
+
+   --  |=====================================================================
+   --  | Man page curs_outopts.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_NL_Mode (SwitchOn : in Boolean := True);
+   --  AKA: nl()
+   --  AKA: nonl()
+
+   --  |
+   procedure Clear_On_Next_Update
+     (Win      : in Window := Standard_Window;
+      Do_Clear : in Boolean := True);
+   --  AKA: clearok()
+
+   --  |
+   procedure Use_Insert_Delete_Line
+     (Win    : in Window := Standard_Window;
+      Do_Idl : in Boolean := True);
+   --  AKA: idlok()
+
+   --  |
+   procedure Use_Insert_Delete_Character
+     (Win    : in Window := Standard_Window;
+      Do_Idc : in Boolean := True);
+   --  AKA: idcok()
+
+   --  |
+   procedure Leave_Cursor_After_Update
+     (Win      : in Window := Standard_Window;
+      Do_Leave : in Boolean := True);
+   --  AKA: leaveok()
+
+   --  |
+   procedure Immediate_Update_Mode
+     (Win  : in Window := Standard_Window;
+      Mode : in Boolean := False);
+   --  AKA: immedok()
+
+   --  |
+   procedure Allow_Scrolling
+     (Win  : in Window := Standard_Window;
+      Mode : in Boolean := False);
+   --  AKA: scrollok()
+
+   function Scrolling_Allowed (Win : Window := Standard_Window) return Boolean;
+   --  There is no such function in the C interface.
+
+   --  |
+   procedure Set_Scroll_Region
+     (Win         : in Window := Standard_Window;
+      Top_Line    : in Line_Position;
+      Bottom_Line : in Line_Position);
+   --  AKA: wsetscrreg()
+
+   --  |=====================================================================
+   --  | Man page curs_refresh.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Update_Screen;
+   --  AKA: doupdate()
+
+   --  |
+   procedure Refresh (Win : in Window := Standard_Window);
+   --  AKA: wrefresh()
+
+   --  |
+   procedure Refresh_Without_Update
+     (Win : in Window := Standard_Window);
+   --  AKA: wnoutrefresh()
+
+   --  |
+   procedure Redraw (Win : in Window := Standard_Window);
+   --  AKA: redrawwin()
+
+   --  |
+   procedure Redraw (Win        : in Window := Standard_Window;
+                     Begin_Line : in Line_Position;
+                     Line_Count : in Positive);
+   --  AKA: wredrawln()
+
+   --  |=====================================================================
+   --  | Man page curs_clear.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Erase (Win : in Window := Standard_Window);
+   --  AKA: werase()
+
+   --  |
+   procedure Clear
+     (Win : in Window := Standard_Window);
+   --  AKA: wclear()
+
+   --  |
+   procedure Clear_To_End_Of_Screen
+     (Win : in Window := Standard_Window);
+   --  AKA: wclrtobot()
+
+   --  |
+   procedure Clear_To_End_Of_Line
+     (Win : in Window := Standard_Window);
+   --  AKA: wclrtoeol()
+
+   --  |=====================================================================
+   --  | Man page curs_bkgd.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Set_Background
+     (Win : in Window := Standard_Window;
+      Ch  : in Attributed_Character);
+   --  AKA: wbkgdset()
+
+   --  |
+   procedure Change_Background
+     (Win : in Window := Standard_Window;
+      Ch  : in Attributed_Character);
+   --  AKA: wbkgd()
+
+   --  |
+   function Get_Background (Win : Window := Standard_Window)
+     return Attributed_Character;
+   --  AKA: wbkgdget()
+
+   --  |=====================================================================
+   --  | Man page curs_touch.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Touch (Win : in Window := Standard_Window);
+   --  AKA: touchwin()
+
+   --  |
+   procedure Untouch (Win : in Window := Standard_Window);
+   --  AKA: untouchwin()
+
+   --  |
+   procedure Touch (Win   : in Window := Standard_Window;
+                    Start : in Line_Position;
+                    Count : in Positive);
+   --  AKA: touchline()
+
+   --  |
+   procedure Change_Lines_Status (Win   : in Window := Standard_Window;
+                                  Start : in Line_Position;
+                                  Count : in Positive;
+                                  State : in Boolean);
+   --  AKA: wtouchln()
+
+   --  |
+   function Is_Touched (Win  : Window := Standard_Window;
+                        Line : Line_Position) return Boolean;
+   --  AKA: is_linetouched()
+
+   --  |
+   function Is_Touched (Win : Window := Standard_Window) return Boolean;
+   --  AKA: is_wintouched()
+
+   --  |=====================================================================
+   --  | Man page curs_overlay.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Copy
+     (Source_Window            : in Window;
+      Destination_Window       : in Window;
+      Source_Top_Row           : in Line_Position;
+      Source_Left_Column       : in Column_Position;
+      Destination_Top_Row      : in Line_Position;
+      Destination_Left_Column  : in Column_Position;
+      Destination_Bottom_Row   : in Line_Position;
+      Destination_Right_Column : in Column_Position;
+      Non_Destructive_Mode     : in Boolean := True);
+   --  AKA: copywin()
+
+   --  |
+   procedure Overwrite (Source_Window      : in Window;
+                        Destination_Window : in Window);
+   --  AKA: overwrite()
+
+   --  |
+   procedure Overlay (Source_Window      : in Window;
+                      Destination_Window : in Window);
+   --  AKA: overlay()
+
+   --  |=====================================================================
+   --  | Man page curs_deleteln.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Insert_Delete_Lines
+     (Win   : in Window  := Standard_Window;
+      Lines : in Integer := 1); --  default is to insert one line above
+   --  AKA: winsdelln()
+
+   --  |
+   procedure Delete_Line (Win : in Window := Standard_Window);
+   --  AKA: wdeleteln()
+
+   --  |
+   procedure Insert_Line (Win : in Window := Standard_Window);
+   --  AKA: winsertln()
+
+   --  |=====================================================================
+   --  | Man page curs_getyx.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Get_Size
+     (Win               : in Window := Standard_Window;
+      Number_Of_Lines   : out Line_Count;
+      Number_Of_Columns : out Column_Count);
+   --  AKA: getmaxyx()
+
+   --  |
+   procedure Get_Window_Position
+     (Win             : in Window := Standard_Window;
+      Top_Left_Line   : out Line_Position;
+      Top_Left_Column : out Column_Position);
+   --  AKA: getbegyx()
+
+   --  |
+   procedure Get_Cursor_Position
+     (Win    : in  Window := Standard_Window;
+      Line   : out Line_Position;
+      Column : out Column_Position);
+   --  AKA: getyx()
+
+   --  |
+   procedure Get_Origin_Relative_To_Parent
+     (Win                : in  Window;
+      Top_Left_Line      : out Line_Position;
+      Top_Left_Column    : out Column_Position;
+      Is_Not_A_Subwindow : out Boolean);
+   --  AKA: getparyx()
+   --  Instead of placing -1 in the coordinates as return, we use a boolean
+   --  to return the info that the window has no parent.
+
+   --  |=====================================================================
+   --  | Man page curs_pad.3x
+   --  |=====================================================================
+
+   --  |
+   function New_Pad (Lines   : Line_Count;
+                     Columns : Column_Count) return Window;
+   --  AKA: newpad()
+
+   --  |
+   function Sub_Pad
+     (Pad                   : Window;
+      Number_Of_Lines       : Line_Count;
+      Number_Of_Columns     : Column_Count;
+      First_Line_Position   : Line_Position;
+      First_Column_Position : Column_Position) return Window;
+   --  AKA: subpad()
+
+   --  |
+   procedure Refresh
+     (Pad                      : in Window;
+      Source_Top_Row           : in Line_Position;
+      Source_Left_Column       : in Column_Position;
+      Destination_Top_Row      : in Line_Position;
+      Destination_Left_Column  : in Column_Position;
+      Destination_Bottom_Row   : in Line_Position;
+      Destination_Right_Column : in Column_Position);
+   --  AKA: prefresh()
+
+   --  |
+   procedure Refresh_Without_Update
+     (Pad                      : in Window;
+      Source_Top_Row           : in Line_Position;
+      Source_Left_Column       : in Column_Position;
+      Destination_Top_Row      : in Line_Position;
+      Destination_Left_Column  : in Column_Position;
+      Destination_Bottom_Row   : in Line_Position;
+      Destination_Right_Column : in Column_Position);
+   --  AKA: pnoutrefresh()
+
+   --  |
+   procedure Add_Character_To_Pad_And_Echo_It
+     (Pad : in Window;
+      Ch  : in Attributed_Character);
+   --  AKA: pechochar()
+
+   procedure Add_Character_To_Pad_And_Echo_It
+     (Pad : in Window;
+      Ch  : in Character);
+
+   --  |=====================================================================
+   --  | Man page curs_scroll.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Scroll (Win    : in Window  := Standard_Window;
+                     Amount : in Integer := 1);
+   --  AKA: wscrl()
+
+   --  |=====================================================================
+   --  | Man page curs_delch.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Delete_Character (Win : in Window := Standard_Window);
+   --  AKA: wdelch()
+
+   --  |
+   procedure Delete_Character
+     (Win    : in Window := Standard_Window;
+      Line   : in Line_Position;
+      Column : in Column_Position);
+   --  AKA: mvwdelch()
+
+   --  |=====================================================================
+   --  | Man page curs_inch.3x
+   --  |=====================================================================
+
+   --  |
+   function Peek (Win : Window := Standard_Window)
+     return Attributed_Character;
+   --  AKA: winch()
+
+   --  |
+   function Peek
+     (Win    : Window := Standard_Window;
+      Line   : Line_Position;
+      Column : Column_Position) return Attributed_Character;
+   --  AKA: mvwinch()
+
+   --  |=====================================================================
+   --  | Man page curs_winch.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Insert (Win : in Window := Standard_Window;
+                     Ch  : in Attributed_Character);
+   --  AKA: winsch()
+
+   --  |
+   procedure Insert (Win    : in Window := Standard_Window;
+                     Line   : in Line_Position;
+                     Column : in Column_Position;
+                     Ch     : in Attributed_Character);
+   --  AKA: mvwinsch()
+
+   --  |=====================================================================
+   --  | Man page curs_winch.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Insert (Win : in Window := Standard_Window;
+                     Str : in String;
+                     Len : in Integer := -1);
+   --  AKA: winsnstr()
+   --  AKA: winsstr()
+
+   --  |
+   procedure Insert (Win    : in Window := Standard_Window;
+                     Line   : in Line_Position;
+                     Column : in Column_Position;
+                     Str    : in String;
+                     Len    : in Integer := -1);
+   --  AKA: mvwinsnstr()
+   --  AKA: mvwinsstr()
+
+   --  |=====================================================================
+   --  | Man page curs_instr.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Peek (Win : in  Window := Standard_Window;
+                   Str : out String;
+                   Len : in  Integer := -1);
+   --  AKA: winnstr()
+   --  AKA: winstr()
+
+   --  |
+   procedure Peek (Win    : in  Window := Standard_Window;
+                   Line   : in  Line_Position;
+                   Column : in  Column_Position;
+                   Str    : out String;
+                   Len    : in  Integer := -1);
+   --  AKA: mvwinnstr()
+   --  AKA: mvwinstr()
+
+   --  |=====================================================================
+   --  | Man page curs_inchstr.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Peek (Win : in  Window := Standard_Window;
+                   Str : out Attributed_String;
+                   Len : in  Integer := -1);
+   --  AKA: winchnstr()
+   --  AKA: winchstr()
+
+   --  |
+   procedure Peek (Win    : in  Window := Standard_Window;
+                   Line   : in  Line_Position;
+                   Column : in  Column_Position;
+                   Str    : out Attributed_String;
+                   Len    : in  Integer := -1);
+   --  AKA: mvwinchnstr()
+   --  AKA: mvwinchstr()
+
+   --  |=====================================================================
+   --  | Man page curs_getstr.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Get (Win : in  Window := Standard_Window;
+                  Str : out String;
+                  Len : in  Integer := -1);
+   --  AKA: wgetnstr()
+   --  AKA: wgetstr()
+
+   procedure Get (Win    : in  Window := Standard_Window;
+                  Line   : in  Line_Position;
+                  Column : in  Column_Position;
+                  Str    : out String;
+                  Len    : in  Integer := -1);
+   --  AKA: wgetnstr(): not specified in ncurses, should be: mvwgetnstr()
+   --       and mvwgetstr() (which exists)
+
+   --  |=====================================================================
+   --  | Man page curs_slk.3x
+   --  |=====================================================================
+
+   type Soft_Label_Key_Format is (Three_Two_Three,
+                                  Four_Four,
+                                  PC_Style,              --  ncurses specific
+                                  PC_Style_With_Index);  --  "
+   type Label_Number is new Positive range 1 .. 12;
+   type Label_Justification is (Left, Centered, Right);
+
+   --  |
+   procedure Init_Soft_Label_Keys
+     (Format : in Soft_Label_Key_Format := Three_Two_Three);
+   --  AKA: slk_init()
+
+   --  |
+   procedure Set_Soft_Label_Key (Label : in Label_Number;
+                                 Text  : in String;
+                                 Fmt   : in Label_Justification := Left);
+   --  AKA: slk_set()
+
+   --  |
+   procedure Refresh_Soft_Label_Keys;
+   --  AKA: slk_refresh()
+
+   --  |
+   procedure Refresh_Soft_Label_Keys_Without_Update;
+   --  AKA: slk_noutrefresh()
+
+   --  |
+   procedure Get_Soft_Label_Key (Label : in Label_Number;
+                                 Text  : out String);
+   --  AKA: slk_label()
+
+   --  |
+   procedure Clear_Soft_Label_Keys;
+   --  AKA: slk_clear()
+
+   --  |
+   procedure Restore_Soft_Label_Keys;
+   --  AKA: slk_restore()
+
+   --  |
+   procedure Touch_Soft_Label_Keys;
+   --  AKA: slk_touch()
+
+   --  |
+   procedure Switch_Soft_Label_Key_Attributes
+     (Attr : in Character_Attribute_Set;
+      On   : in Boolean := True);
+   --  AKA: slk_attron()
+   --  AKA: slk_attroff()
+
+   --  |
+   procedure Set_Soft_Label_Key_Attributes
+     (Attr  : in Character_Attribute_Set := Normal_Video;
+      Color : in Color_Pair := Color_Pair'First);
+   --  AKA: slk_attrset()
+
+   --  |
+   function Get_Soft_Label_Key_Attributes return Character_Attribute_Set;
+   --  AKA: slk_attr()
+
+   --  |
+   function Get_Soft_Label_Key_Attributes return Color_Pair;
+   --  AKA: slk_attr()
+
+   --  |=====================================================================
+   --  | Man page curs_util.3x
+   --  |=====================================================================
+
+   --  | Not implemented : filter, use_env, putwin, getwin
+   --
+   --  |
+   procedure Key_Name (Key  : in  Real_Key_Code;
+                       Name : out String);
+   --  AKA: keyname()
+   --  The external name for a real keystroke.
+
+   --  |
+   procedure Un_Control (Ch  : in Attributed_Character;
+                         Str : out String);
+   --  AKA: unctrl()
+
+   --  |
+   procedure Delay_Output (Msecs : in Natural);
+   --  AKA: delay_output()
+
+   --  |
+   procedure Flush_Input;
+   --  AKA: flushinp()
+
+   --  |=====================================================================
+   --  | Man page curs_termattrs.3x
+   --  |=====================================================================
+
+   --  |
+   function Baudrate return Natural;
+   --  AKA: baudrate()
+
+   --  |
+   function Erase_Character return Character;
+   --  AKA: erasechar()
+
+   --  |
+   function Kill_Character return Character;
+   --  AKA: killchar()
+
+   --  |
+   function Has_Insert_Character return Boolean;
+   --  AKA: has_ic()
+
+   --  |
+   function Has_Insert_Line return Boolean;
+   --  AKA: has_il()
+
+   --  |
+   function Supported_Attributes return Character_Attribute_Set;
+   --  AKA: termattrs()
+
+   --  |
+   procedure Long_Name (Name : out String);
+   --  AKA: longname()
+
+   --  |
+   procedure Terminal_Name (Name : out String);
+   --  AKA: termname()
+
+   --  |=====================================================================
+   --  | Man page curs_color.3x
+   --  |=====================================================================
+
+   --  |
+   procedure Start_Color;
+   --  AKA: start_clolor()
+   pragma Import (C, Start_Color, "start_color");
+
+   --  |
+   procedure Init_Pair (Pair : in Redefinable_Color_Pair;
+                        Fore : in Color_Number;
+                        Back : in Color_Number);
+   --  AKA: init_pair()
+
+   --  |
+   procedure Pair_Content (Pair : in Color_Pair;
+                           Fore : out Color_Number;
+                           Back : out Color_Number);
+   --  AKA: pair_content()
+
+   --  |
+   function Has_Colors return Boolean;
+   --  AKA: has_colors()
+
+   --  |
+   procedure Init_Color (Color : in Color_Number;
+                         Red   : in RGB_Value;
+                         Green : in RGB_Value;
+                         Blue  : in RGB_Value);
+   --  AKA: init_color()
+
+   --  |
+   function Can_Change_Color return Boolean;
+   --  AKA: can_change_color()
+
+   --  |
+   procedure Color_Content (Color : in  Color_Number;
+                            Red   : out RGB_Value;
+                            Green : out RGB_Value;
+                            Blue  : out RGB_Value);
+   --  AKA: color_content()
+
+   --  |=====================================================================
+   --  | Man page curs_kernel.3x
+   --  |=====================================================================
+
+   --  | Not implemented: getsyx, setsyx
+   --
+   type Curses_Mode is (Curses, Shell);
+
+   --  |
+   procedure Save_Curses_Mode (Mode : in Curses_Mode);
+   --  AKA: def_prog_mode()
+   --  AKA: def_shell_mode()
+
+   --  |
+   procedure Reset_Curses_Mode (Mode : in Curses_Mode);
+   --  AKA: reset_prog_mode()
+   --  AKA: reset_shell_mode()
+
+   --  |
+   procedure Save_Terminal_State;
+   --  AKA: savetty()
+
+   --  |
+   procedure Reset_Terminal_State;
+   --  AKA: resetty();
+
+   type Stdscr_Init_Proc is access
+      function (Win     : Window;
+                Columns : Column_Count) return Integer;
+   pragma Convention (C, Stdscr_Init_Proc);
+   --  N.B.: the return value is actually ignored, but it seems to be
+   --        a good practice to return 0 if you think all went fine
+   --        and -1 otherwise.
+
+   --  |
+   procedure Rip_Off_Lines (Lines : in Integer;
+                            Proc  : in Stdscr_Init_Proc);
+   --  AKA: ripoffline()
+   --  N.B.: to be more precise, this uses a ncurses specific enhancement of
+   --        ripoffline(), in which the Lines argument absolute value is the
+   --        number of lines to be ripped of. The official ripoffline() only
+   --        uses the sign of Lines to rip of a single line from bottom or top.
+
+   type Cursor_Visibility is (Invisible, Normal, Very_Visible);
+
+   --  |
+   procedure Set_Cursor_Visibility (Visibility : in out Cursor_Visibility);
+   --  AKA: curs_set()
+
+   --  |
+   procedure Nap_Milli_Seconds (Ms : in Natural);
+   --  AKA: napms()
+
+   --  |=====================================================================
+   --  | Some usefull helpers.
+   --  |=====================================================================
+   type Transform_Direction is (From_Screen, To_Screen);
+   procedure Transform_Coordinates
+     (W      : in Window := Standard_Window;
+      Line   : in out Line_Position;
+      Column : in out Column_Position;
+      Dir    : in Transform_Direction := From_Screen);
+   --  This procedure transforms screen coordinates into coordinates relative
+   --  to the window and vice versa, depending on the Dir parmeter.
+   --  Screen coordinates are the position informations on the physical device.
+   --  An Curses_Exception will be raised if Line and Column are not in the
+   --  Window or if you pass the Null_Window as argument.
+
+private
+   type Window is new System.Address;
+   Null_Window : constant Window := Window (System.Null_Address);
+
+   Generation_Bit_Order : constant System.Bit_Order := System.Low_Order_First;
+   --  This constant may be different on your system.
+
+end Terminal_Interface.Curses;
+
+
+ +


+This is BETA software. The interface is subject to change without notice. +

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/terminal_interface_s.html b/Ada95/html/terminal_interface_s.html new file mode 100644 index 00000000..32d50f4c --- /dev/null +++ b/Ada95/html/terminal_interface_s.html @@ -0,0 +1,49 @@ + + + + + +

+------------------------------------------------------------------------------
+--                                                                          --
+--                           GNAT ncurses Binding                           --
+--                                                                          --
+--                            Terminal_Interface                            --
+--                                                                          --
+--                                 S P E C                                  --
+--                                                                          --
+--  Version 00.92                                                           --
+--                                                                          --
+--  The ncurses Ada95 binding is copyrighted 1996 by                        --
+--  Jürgen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                      --
+--                                                                          --
+--  Permission is hereby granted to reproduce and distribute this           --
+--  binding by any means and for any fee, whether alone or as part          --
+--  of a larger distribution, in source or in binary form, PROVIDED         --
+--  this notice is included with any such distribution, and is not          --
+--  removed from any of its header files. Mention of ncurses and the        --
+--  author of this binding in any applications linked with it is            --
+--  highly appreciated.                                                     --
+--                                                                          --
+--  This binding comes AS IS with no warranty, implied or expressed.        --
+------------------------------------------------------------------------------
+--  Version Control:
+--  @Revision: 1.3 @
+------------------------------------------------------------------------------
+package Terminal_Interface is
+--
+--  Everything is in the child units
+--
+end Terminal_Interface;
+
+
+ +


+

+This is BETA software. The interface is subject to change without notice.

+ + +

This hypertext format was generated by David A. Wheeler's ada2html + + + diff --git a/Ada95/html/wresize.3x.html b/Ada95/html/wresize.3x.html new file mode 100644 index 00000000..3c1d67b1 --- /dev/null +++ b/Ada95/html/wresize.3x.html @@ -0,0 +1,70 @@ + + +

+       wresize - resize a curses window
+
+
+
+

SYNOPSIS

+       #include <curses.h>
+
+       int wresize(WINDOW *win, int lines, int columns);
+
+
+
+

DESCRIPTION

+       The  wresize  function  reallocates storage for an ncurses
+       window to adjust its dimensions to the  specified  values.
+       If either dimension is larger than the current values, the
+       window's data is filled with blanks that have the  current
+       background  rendition  (as  set  by wbkgndset) merged into
+       them.
+
+
+
+

RETURN VALUE

+       The function returns the integer ERR upon failure  and  OK
+       on success.  It will fail if either of the dimensions less
+       than or equal  to  zero,  or  if  an  error  occurs  while
+       (re)allocating memory for the window.
+
+
+
+

NOTES

+       The only restriction placed on the dimensions is that they
+       be greater than zero.  The dimensions are not compared  to
+       curses   screen   dimensions  to  simplify  the  logic  of
+       resizeterm.  The caller  must  ensure  that  the  window's
+       dimensions fit within the actual screen dimensions.
+
+
+
+

SEE ALSO

+       resizeterm(3x).
+
+
+
+

AUTHOR

+       Thomas Dickey (from an equivalent function written in 1988
+       for BSD curses).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/Ada95/samples/Makefile.in b/Ada95/samples/Makefile.in new file mode 100644 index 00000000..2130e4a3 --- /dev/null +++ b/Ada95/samples/Makefile.in @@ -0,0 +1,112 @@ +#---------------------------------------------------------------------------- +# -- +# GNAT ncurses Binding -- +# samples/Makefile -- +# -- +# Version 00.92 -- +# -- +# The ncurses Ada95 binding is copyrighted 1996 by -- +# Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +# -- +# Permission is hereby granted to reproduce and distribute this -- +# binding by any means and for any fee, whether alone or as part -- +# of a larger distribution, in source or in binary form, PROVIDED -- +# this notice is included with any such distribution, and is not -- +# removed from any of its header files. Mention of ncurses and the -- +# author of this binding in any applications linked with it is -- +# highly appreciated. -- +# -- +# This binding comes AS IS with no warranty, implied or expressed. -- +#---------------------------------------------------------------------------- +# Version Control +# $Revision: 1.7 $ +# +.SUFFIXES: + +SHELL = /bin/sh +THIS = Makefile + +MODEL = ../../@DFT_OBJ_SUBDIR@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ +datadir = @datadir@ +ticdir = $(datadir)/terminfo + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +AWK = @AWK@ +LN_S = @LN_S@ + +CC = @CC@ +CFLAGS = @CFLAGS@ + +CPPFLAGS = @ACPPFLAGS@ \ + -DHAVE_CONFIG_H -I$(srcdir) + +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@ + +RANLIB = @RANLIB@ +################################################################################ +ada_srcdir=../ada_include +ada_objdir=../ada_objects + +LD_FLAGS = @LD_MODEL@ $(LOCAL_LIBS) @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS) + +ADA = @nc_ada_compiler@ +ADAFLAGS = @ADAFLAGS@ -I$(srcdir) + +ADAMAKE = @nc_ada_make@ +ADAMAKEFLAGS = -aI$(srcdir) -aI$(ada_srcdir) -aI$(srcdir)/$(ada_srcdir) -aO$(ada_objdir) + +ALIB = @nc_ada_package@ +ABASE = $(ALIB)-curses + +CARGS =-cargs $(ADAFLAGS) +LARGS =-largs -L../../lib $(LD_FLAGS) + +PROGS = tour + +TOUR_OBJS = tour.o sample.o sample-curses_demo.o sample-explanation.o \ + sample-form_demo.o sample-function_key_setting.o \ + sample-header_handler.o sample-helpers.o \ + sample-keyboard_handler.o sample-manifest.o sample-menu_demo.o \ + sample-menu_demo-aux.o sample-text_io_demo.o \ + sample-curses_demo-attributes.o sample-curses_demo-mouse.o \ + sample-form_demo-aux.o sample-my_field_type.o + +all :: demo1 + @ + +demo1: explain.msg + $(ADAMAKE) $(ADAMAKEFLAGS) tour $(CARGS) $(LARGS) + +explain.msg: $(srcdir)/explain.txt + cp $(srcdir)/explain.txt $@ + +clean :: + rm -f *.o *.ali b_t*.* *.s $(PROGS) a.out core b_*_test.c *.xr[bs] explain.msg + +distclean :: clean + rm -f Makefile + +mostlyclean :: clean + @ + +realclean :: distclean + @ + + diff --git a/Ada95/samples/README b/Ada95/samples/README new file mode 100644 index 00000000..6ea8a18e --- /dev/null +++ b/Ada95/samples/README @@ -0,0 +1,6 @@ +The intention of the demo at this point in time is not to demonstrate all +the features of (n)curses and it's subsystems, but to give some sample +sources how to use the binding at all. + +Ideally in the future we can combine both goals. + diff --git a/Ada95/samples/explain.txt b/Ada95/samples/explain.txt new file mode 100644 index 00000000..51c7d695 --- /dev/null +++ b/Ada95/samples/explain.txt @@ -0,0 +1,185 @@ +#VERSION +This is Version 00.90.00 of the demo package. +#MENUKEYS +In a menu you can use the following Keys in the whole application: + + - CTRL-Q Quit the menu + - CTRL-N Go to next item + - CTRL-P Go to previous item + - CTRL-U Scroll up one line + - CTRL-D Scroll down one line + - CTRL-F Scroll down one page + - PAGE DOWN Scroll down one page + - PAGE UP Scroll back one page + - CTRL-B Scroll back one page + - CTRL-X Clear pattern + - CTRL-H Delete last character from pattern + - Backspace Delete last character from pattern + - CTRL-A Next pattern match + - CTRL-Z Previous pattern match + - CTRL-T Toggle item in a multi-selection menu + - CR or LF Select an item + - HOME Key Go to the first item + - F3 Quit the menu + - Cursor Down Down one item + - Cursor Up Up one item + - Cursor Left Left one item + - Cursor Right Right one item + - END Key Go to last item +#FORMKEYS + - CTRL-Q Quit the form + - CTRL-F Go to the next page of the form + - CTRL-B Go to the previous page of the form + - CTRL-N Go to the next field + - CTRL-P Go to the previous field + - CTRL-L Go to the field left of the current one + - CTRL-R Go to the field right of the current one + - CTRL-U Go to the field above the current one + - CTRL-D Go to the field below the current one + - CTRL-W Go to the next word in the field + - CTRL-T Go to the previous word in the field + - CTRL-S Go to the beginning of the field + - CTRL-E Go to the end of the field + - CTRL-I Insert a blank character at the current position + - CTRL-O Insert a line + - CTRL-V Delete a character + - CTRL-H Delete previous character + - CTRL-Y Delete a line + - CTRL-G Delete a word + - CTRL-K Clear to end of field + - CTRL-X Clear the field + - CTRL-A Next choice in a choice field (Enumerations etc.) + - CTRL-Z Previous choice in a choice field. +#HELP +#HELPKEYS +You may scroll with the Cursor Up/Down Keys. +You may leave the help with the Function Key labelled 'Quit'. +#INHELP +You are already in the help system. +You may leave the help with the Function Key labelled 'Quit'. +#MAIN +This is the main menu of the sample program for the ncurses Ada95 +binding. The main intention of the demo is not to demonstate or +test all the features of ncurses and it's subsystems, but to provide +to you some sample code how to use the binding with Ada95. + +You may select this options: + + * Look at some ncurses core functions + * Look at some features of the menu subsystem + * Look at some features of the form subsystem + * Look at the output of the Ada.Text_IO like functions + for ncurses. + +#MAINPAD +You may press at any place in this demo CTRL-C. This will give you a command +window. You can just type in the Label-String of a function key, then this +key will be simulated. This should help you to run the application even if +you run it on a terminal with no or only a few function keys. With CTRL-A +and CTRL-Z you may browse through the possible values in the command window. +#MENU00 +Here we give you a selection of various menu demonstrations. +#MENU-PAD00 +This menu itself is a demo for a single valued, 1-column menu with +descriptions for the items, a marker and a padding character between +the item name and the description. +#MENU01 +This is a demo of the some of the menu layout options. One of them +is the spacing functionality. Just press the Key labelled "Flip" to +flip between the non-spaced and a spaced version of the menu. Please +note that this functionality is unique for ncurses and is not found +in the SVr4 menu implementation. + +This is a menu that sometimes doesn't fit into it's window and +therefore it becomes a scroll menu. + +You can also see here very nicely the pattern matching functionality +of menus. Type for example a 'J' and you will be positioned to the +next item after the current starting with a 'J'. Any more characters +you type in make the pattern more specific. With CTRL-A and CTRL-Z +(for more details press the Key labelled "Keys") you can browse +through all the items matching the pattern. + +You may change the format of the menu. Just press one of the keys +labelled "4x1", "4x2" or "4x3" to get a menu with that many rows +and columns. + +With the Keys "O-Row" or "O-Col" (they occupy the same label and +switch on selection) you can change the major order scheme for +the menu. If "O-Col" is visible, the menu is currently major +ordered by rows, you can switch to major column order by pressing +the key. If "O-Row" is visible, it's just the reverse situation. +This Key is not visible in "4x1" layout mode, because in this case +the functionality makes no sense. + +With the Keys "Multi" or "Singl" (they occupy the same label and +switch on selection) you can change whether or not the menu allows +multiple or only single selection. + +With the Keys "+Desc" or "-Desc" (they occupy the same label and +switch on selection) you can change whether or not the descriptions +for each item should be displayed. Please not that this key is +not visible in the "4x3" layout mode, because in this case the +menu wouldn't fit on a typicall 80x24 screen. + +With the Keys "Disab" or "Enab" (they occupy the same label and +switch on selection) you can dis- or enable the selectability of +the month with 31 days. +#MENU-PAD01 +You may press "Flip" to see the effect of ncurses unique menu-spacing. +The Keys "4x1", "4x2" and "4x3" will change the format of the menu. +Please note that this is a scrolling menu. You may also play with the +pattern matching functionality or try to change the format of the menu. +For more details press the Key labelled "Help". +#FORM00 +This is a demo of the forms package. +#FORM-PAD00 +Please note that this demo is far from being complete. It really shows +only a small part of the functionality of the forms package. Let's hope +the next version will have a richer demo (You wan't to contribute ?). +#NOTIMPL +Sorry this functionality of the demo is not implemented at the moment. +Remember this is a freeware project, so I can use only my very rare +free time to continue coding. If you would like to contribute, you +are very welcome ! +#CURSES00 +This is a menu where you can select some different demos of the ncurses +functionality. +#CURSES-PAD00 +Please note that this demo is far from being complete. It really shows +only a small part of the functionality of the curses package. Let's hope +the next version will have a richer demo (You wan't to contribute ?). +#MOUSEKEYS +In this demo you may use this keys: + + - Key labelled "Help" to get a help + - Key labelled "Keys" is what you are reading now + - Key labelled "Quit" to leave the demo + +You may click the mouse buttons at any location at the screen and look +at the protocol window ! +#MOUSE00 +A rather simple use of a mouse as demo. It's there just to test the +code and to provide the sample source. + +It might be of interest, that the output into the protocol window is +done by the (n)curses Text_IO subpackages. Especially the output of +the button and state names is done by Ads's enumeration IO, which +allows you to print the names of enumeration literals. That's really +nice. +#MOUSE-PAD00 +This is a very simple demo of the mouse features of ncurses. It's there +just to test whether or not the generated code for the binding really +works on the different architectures (seems so). +#ATTRIBDEMO +Again this is a more than simple demo and just here to give you the +sourcecode. +#ATTRIBKEYS +You may press one of the three well known standard keys of this demo. +#ATTRIB-PAD00 +Again this is a more than simple demo and just here to give you the +sourcecode. Feel free to contribute more. +#TEXTIO +#TEXTIOKEYS +#TEXTIO-PAD00 +#END diff --git a/Ada95/samples/sample-curses_demo-attributes.adb b/Ada95/samples/sample-curses_demo-attributes.adb new file mode 100644 index 00000000..d1eb8f71 --- /dev/null +++ b/Ada95/samples/sample-curses_demo-attributes.adb @@ -0,0 +1,113 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Curses_Demo.Attributes -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses; use Terminal_Interface.Curses; +with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; + +with Sample.Manifest; use Sample.Manifest; +with Sample.Helpers; use Sample.Helpers; +with Sample.Function_Key_Setting; use Sample.Function_Key_Setting; +with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; +with Sample.Header_Handler; use Sample.Header_Handler; +with Sample.Explanation; use Sample.Explanation; + +with Sample.Menu_Demo.Handler; +with Sample.Curses_Demo.Mouse; + +package body Sample.Curses_Demo.Attributes is + + procedure Demo + is + P : Panel := Create (Standard_Window); + K : Real_Key_Code; + begin + Set_Meta_Mode; + Set_KeyPad_Mode; + + Top (P); + + Push_Environment ("ATTRIBDEMO"); + Default_Labels; + Notepad ("ATTRIB-PAD00"); + + Set_Character_Attributes (Attr => (others => False)); + Add (Line => 1, Column => Columns / 2 - 10, + Str => "This is NORMAL"); + + Set_Character_Attributes (Attr => (Stand_Out => True, + others => False)); + Add (Line => 2, Column => Columns / 2 - 10, + Str => "This is Stand_Out"); + + Set_Character_Attributes (Attr => (Under_Line => True, + others => False)); + Add (Line => 3, Column => Columns / 2 - 10, + Str => "This is Under_Line"); + + Set_Character_Attributes (Attr => (Reverse_Video => True, + others => False)); + Add (Line => 4, Column => Columns / 2 - 10, + Str => "This is Reverse_Video"); + + Set_Character_Attributes (Attr => (Blink => True, + others => False)); + Add (Line => 5, Column => Columns / 2 - 10, + Str => "This is Blink"); + + Set_Character_Attributes (Attr => (Dim_Character => True, + others => False)); + Add (Line => 6, Column => Columns / 2 - 10, + Str => "This is Dim_Character"); + + Set_Character_Attributes (Attr => (Bold_Character => True, + others => False)); + Add (Line => 7, Column => Columns / 2 - 10, + Str => "This is Bold_Character"); + + Refresh_Without_Update; + Update_Panels; Update_Screen; + + loop + K := Get_Key; + if K in Special_Key_Code'Range then + case K is + when QUIT_CODE => exit; + when HELP_CODE => Explain_Context; + when EXPLAIN_CODE => Explain ("ATTRIBKEYS"); + when others => null; + end case; + end if; + end loop; + + Pop_Environment; + Clear; + Refresh_Without_Update; + Delete (P); + Update_Panels; Update_Screen; + + end Demo; + +end Sample.Curses_Demo.Attributes; diff --git a/Ada95/samples/sample-curses_demo-attributes.ads b/Ada95/samples/sample-curses_demo-attributes.ads new file mode 100644 index 00000000..fc93e747 --- /dev/null +++ b/Ada95/samples/sample-curses_demo-attributes.ads @@ -0,0 +1,31 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Curses_Demo.Attributes -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +package Sample.Curses_Demo.Attributes is + + procedure Demo; + +end Sample.Curses_Demo.Attributes; diff --git a/Ada95/samples/sample-curses_demo-mouse.adb b/Ada95/samples/sample-curses_demo-mouse.adb new file mode 100644 index 00000000..e8351598 --- /dev/null +++ b/Ada95/samples/sample-curses_demo-mouse.adb @@ -0,0 +1,207 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Curses_Demo.Mouse -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses; use Terminal_Interface.Curses; +with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; +with Terminal_Interface.Curses.Mouse; use Terminal_Interface.Curses.Mouse; +with Terminal_Interface.Curses.Text_IO; use Terminal_Interface.Curses.Text_IO; +with Terminal_Interface.Curses.Text_IO.Integer_IO; +with Terminal_Interface.Curses.Text_IO.Enumeration_IO; + +with Sample.Helpers; use Sample.Helpers; +with Sample.Manifest; use Sample.Manifest; +with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; +with Sample.Function_Key_Setting; use Sample.Function_Key_Setting; +with Sample.Explanation; use Sample.Explanation; + +package body Sample.Curses_Demo.Mouse is + + package Int_IO is new + Terminal_Interface.Curses.Text_IO.Integer_IO (Integer); + use Int_IO; + + package Button_IO is new + Terminal_Interface.Curses.Text_IO.Enumeration_IO (Mouse_Button); + use Button_IO; + + package State_IO is new + Terminal_Interface.Curses.Text_IO.Enumeration_IO (Button_State); + use State_IO; + + procedure Demo is + + type Controls is array (1 .. 3) of Panel; + + Frame : Window; + Msg : Window; + Ctl : Controls; + Pan : Panel; + N : constant Natural := Ctl'Length; + K : Real_Key_Code; + V : Cursor_Visibility := Invisible; + W : Window; + Note : Window; + Msg_L : constant Line_Count := 8; + Lins : Line_Position := Lines; + Cols : Column_Position; + Mask : Event_Mask; + procedure Show_Mouse_Event; + + procedure Show_Mouse_Event + is + Evt : constant Mouse_Event := Get_Mouse; + Y : Line_Position; + X : Column_Position; + Button : Mouse_Button; + State : Button_State; + W : Window; + begin + Get_Event (Evt, Y, X, Button, State); + Put (Msg, "Event at"); + Put (Msg, " X="); Put (Msg, Integer (X), 3); + Put (Msg, ", Y="); Put (Msg, Integer (Y), 3); + Put (Msg, ", Btn="); Put (Msg, Button, 10); + Put (Msg, ", Stat="); Put (Msg, State, 15); + for I in Ctl'Range loop + W := Get_Window (Ctl (I)); + if Enclosed_In_Window (W, Evt) then + Transform_Coordinates (W, Y, X, From_Screen); + Put (Msg, ",Box("); + Put (Msg, Integer (I), 1); Put (Msg, ","); + Put (Msg, Integer (Y), 1); Put (Msg, ","); + Put (Msg, Integer (X), 1); Put (Msg, ")"); + end if; + end loop; + New_Line (Msg); + Flush (Msg); + Update_Panels; Update_Screen; + end Show_Mouse_Event; + + begin + Push_Environment ("MOUSE00"); + Notepad ("MOUSE-PAD00"); + Default_Labels; + Set_Cursor_Visibility (V); + + Note := Notepad_Window; + if Note /= Null_Window then + Get_Window_Position (Note, Lins, Cols); + end if; + Frame := Create (Msg_L, Columns, Lins - Msg_L, 0); + if Has_Colors then + Set_Background (Win => Frame, + Ch => (Color => Default_Colors, + Attr => Normal_Video, + Ch => ' ')); + Set_Character_Attributes (Win => Frame, + Attr => Normal_Video, + Color => Default_Colors); + Erase (Frame); + end if; + Msg := Derived_Window (Frame, Msg_L - 2, Columns - 2, 1, 1); + Pan := Create (Frame); + + Set_Meta_Mode; + Set_KeyPad_Mode; + Mask := Start_Mouse; + + Box (Frame); + Window_Title (Frame, "Mouse Protocol"); + Refresh_Without_Update (Frame); + Allow_Scrolling (Msg, True); + + declare + Middle_Column : constant Integer := Integer (Columns) / 2; + Middle_Index : constant Natural := Ctl'First + (Ctl'Length / 2); + Width : constant Column_Count := 5; + Height : constant Line_Count := 3; + Half : constant Column_Count := Width / 2; + Space : constant Column_Count := 3; + Position : Integer; + W : Window; + begin + for I in Ctl'Range loop + Position := (Integer (I) - Integer (Middle_Index)) * + Integer (Half + Space + Width) + Middle_Column; + W := Create (Height, + Width, + 1, + Column_Position (Position)); + if Has_Colors then + Set_Background (Win => W, + Ch => (Color => Menu_Back_Color, + Attr => Normal_Video, + Ch => ' ')); + Set_Character_Attributes (Win => W, + Attr => Normal_Video, + Color => Menu_Fore_Color); + Erase (W); + end if; + Ctl (I) := Create (W); + Box (W); + Move_Cursor (W, 1, Half); + Put (W, Integer (I), 1); + Refresh_Without_Update (W); + end loop; + end; + + Update_Panels; Update_Screen; + + loop + K := Get_Key; + if K in Special_Key_Code'Range then + case K is + when QUIT_CODE => exit; + when HELP_CODE => Explain_Context; + when EXPLAIN_CODE => Explain ("MOUSEKEYS"); + when Key_Mouse => Show_Mouse_Event; + when others => null; + end case; + end if; + end loop; + + for I in Ctl'Range loop + W := Get_Window (Ctl (I)); + Clear (W); + Delete (Ctl (I)); + Delete (W); + end loop; + + Clear (Frame); + Delete (Pan); + Delete (Msg); + Delete (Frame); + + Set_Cursor_Visibility (V); + End_Mouse; + + Pop_Environment; + Update_Panels; Update_Screen; + + end Demo; + +end Sample.Curses_Demo.Mouse; + diff --git a/Ada95/samples/sample-curses_demo-mouse.ads b/Ada95/samples/sample-curses_demo-mouse.ads new file mode 100644 index 00000000..ad3e5dac --- /dev/null +++ b/Ada95/samples/sample-curses_demo-mouse.ads @@ -0,0 +1,31 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Curses_Demo.Mouse -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +package Sample.Curses_Demo.Mouse is + + procedure Demo; + +end Sample.Curses_Demo.Mouse; diff --git a/Ada95/samples/sample-curses_demo.adb b/Ada95/samples/sample-curses_demo.adb new file mode 100644 index 00000000..81ac9a5a --- /dev/null +++ b/Ada95/samples/sample-curses_demo.adb @@ -0,0 +1,116 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Curses_Demo -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses; use Terminal_Interface.Curses; +with Terminal_Interface.Curses.Menus; use Terminal_Interface.Curses.Menus; +with Terminal_Interface.Curses.Mouse; use Terminal_Interface.Curses.Mouse; +with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; +with Terminal_Interface.Curses.Panels.User_Data; + +with Sample.Manifest; use Sample.Manifest; +with Sample.Helpers; use Sample.Helpers; +with Sample.Function_Key_Setting; use Sample.Function_Key_Setting; +with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; +with Sample.Header_Handler; use Sample.Header_Handler; +with Sample.Explanation; use Sample.Explanation; + +with Sample.Menu_Demo.Handler; +with Sample.Curses_Demo.Mouse; +with Sample.Curses_Demo.Attributes; + +package body Sample.Curses_Demo is + + procedure Demo + is + function My_Driver (M : Menu; + K : Key_Code; + Pan : Panel) return Boolean; + package Mh is new Sample.Menu_Demo.Handler (My_Driver); + + Itm : constant Item_Array (1 .. 2) := + (New_Item ("Attributes Demo"), + New_Item ("Mouse Demo")); + M : Menu := New_Menu (Itm); + + function My_Driver (M : Menu; + K : Key_Code; + Pan : Panel) return Boolean + is + Idx : constant Positive := Get_Index (Current (M)); + begin + if K in User_Key_Code'Range then + if K = QUIT then + return True; + elsif K = SELECT_ITEM then + if Idx in Itm'Range then + Hide (Pan); + Update_Panels; + end if; + case Idx is + when 1 => Sample.Curses_Demo.Attributes.Demo; + when 2 => Sample.Curses_Demo.Mouse.Demo; + when others => Not_Implemented; + end case; + if Idx in Itm'Range then + Top (Pan); + Show (Pan); + Update_Panels; + Update_Screen; + end if; + end if; + end if; + return False; + end My_Driver; + + begin + + if Item_Count (M) /= Itm'Length then + raise Constraint_Error; + end if; + + if not Has_Key (Key_Mouse) then + declare + O : Item_Option_Set; + begin + Get_Options (Itm (2), O); + O.Selectable := False; + Set_Options (Itm (2), O); + end; + end if; + + Push_Environment ("CURSES00"); + Notepad ("CURSES-PAD00"); + Default_Labels; + Refresh_Soft_Label_Keys_Without_Update; + + Mh.Drive_Me (M, " Demo "); + Pop_Environment; + + Delete (M); + + end Demo; + +end Sample.Curses_Demo; diff --git a/Ada95/samples/sample-curses_demo.ads b/Ada95/samples/sample-curses_demo.ads new file mode 100644 index 00000000..49e5fb6c --- /dev/null +++ b/Ada95/samples/sample-curses_demo.ads @@ -0,0 +1,31 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Curses_Demo -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +package Sample.Curses_Demo is + + procedure Demo; + +end Sample.Curses_Demo; diff --git a/Ada95/samples/sample-explanation.adb b/Ada95/samples/sample-explanation.adb new file mode 100644 index 00000000..67930911 --- /dev/null +++ b/Ada95/samples/sample-explanation.adb @@ -0,0 +1,395 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Explanation -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.6 $ +------------------------------------------------------------------------------ +-- Poor mans help system. This scans a sequential file for key lines and +-- then reads the lines up to the next key. Those lines are presented in +-- a window as help or explanation. +-- +with Ada.Text_IO; use Ada.Text_IO; +with Ada.Unchecked_Deallocation; +with Terminal_Interface.Curses; use Terminal_Interface.Curses; +with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; + +with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; +with Sample.Manifest; use Sample.Manifest; +with Sample.Function_Key_Setting; use Sample.Function_Key_Setting; +with Sample.Helpers; use Sample.Helpers; + +package body Sample.Explanation is + + Help_Keys : constant String := "HELPKEYS"; + In_Help : constant String := "INHELP"; + + File_Name : String := "explain.msg"; + F : File_Type; + + type Help_Line; + type Help_Line_Access is access Help_Line; + pragma Controlled (Help_Line_Access); + type String_Access is access String; + pragma Controlled (String_Access); + + type Help_Line is + record + Prev, Next : Help_Line_Access; + Line : String_Access; + end record; + + procedure Explain (Key : in String; + Win : in Window); + + procedure Release_String is + new Ada.Unchecked_Deallocation (String, + String_Access); + procedure Release_Help_Line is + new Ada.Unchecked_Deallocation (Help_Line, + Help_Line_Access); + + function Search (Key : String) return Help_Line_Access; + procedure Release_Help (Root : in out Help_Line_Access); + + procedure Explain (Key : in String) + is + begin + Explain (Key, Null_Window); + end Explain; + + procedure Explain (Key : in String; + Win : in Window) + is + -- Retrieve the text associated with this key and display it in this + -- window. If no window argument is passed, the routine will create + -- a temporary window and use it. + + function Filter_Key return Real_Key_Code; + procedure Unknown_Key; + procedure Redo; + procedure To_Window (C : in out Help_Line_Access; + More : in out Boolean); + + Frame : Window := Null_Window; + + W : Window := Win; + K : Real_Key_Code; + P : Panel; + + Height : Line_Count; + Width : Column_Count; + Help : Help_Line_Access := Search (Key); + Current : Help_Line_Access; + Top_Line : Help_Line_Access; + + Has_More : Boolean; + + procedure Unknown_Key + is + begin + Add (W, "Help message with ID "); + Add (W, Key); + Add (W, " not found."); + Add (W, Character'Val (10)); + Add (W, "Press the Function key labelled 'Quit' key to continue."); + end Unknown_Key; + + procedure Redo + is + H : Help_Line_Access := Top_Line; + begin + if Top_Line /= null then + for L in 0 .. (Height - 1) loop + Add (W, L, 0, H.Line.all); + exit when H.Next = null; + H := H.Next; + end loop; + else + Unknown_Key; + end if; + end Redo; + + function Filter_Key return Real_Key_Code + is + K : Real_Key_Code; + begin + loop + K := Get_Key (W); + if K in Special_Key_Code'Range then + case K is + when HELP_CODE => + if not Find_Context (In_Help) then + Push_Environment (In_Help, False); + Explain (In_Help, W); + Pop_Environment; + Redo; + end if; + when EXPLAIN_CODE => + if not Find_Context (Help_Keys) then + Push_Environment (Help_Keys, False); + Explain (Help_Keys, W); + Pop_Environment; + Redo; + end if; + when others => exit; + end case; + else + exit; + end if; + end loop; + return K; + end Filter_Key; + + procedure To_Window (C : in out Help_Line_Access; + More : in out Boolean) + is + L : Line_Position := 0; + begin + loop + Add (W, L, 0, C.Line.all); + L := L + 1; + exit when C.Next = null or else L = Height; + C := C.Next; + end loop; + if C.Next /= null then + pragma Assert (L = Height); + More := True; + else + More := False; + end if; + end To_Window; + + begin + if W = Null_Window then + Push_Environment ("HELP"); + Default_Labels; + Frame := New_Window (Lines - 2, Columns, 0, 0); + if Has_Colors then + Set_Background (Win => Frame, + Ch => (Ch => ' ', + Color => Help_Color, + Attr => Normal_Video)); + Set_Character_Attributes (Win => Frame, + Attr => Normal_Video, + Color => Help_Color); + Erase (Frame); + end if; + Box (Frame); + Set_Character_Attributes (Frame, (Reverse_Video => True, + others => False)); + Add (Frame, Lines - 3, 2, "Cursor Up/Down scrolls"); + Set_Character_Attributes (Frame); -- Back to default. + Window_Title (Frame, "Explanation"); + W := Derived_Window (Frame, Lines - 4, Columns - 2, 1, 1); + Refresh_Without_Update (Frame); + Get_Size (W, Height, Width); + Set_Meta_Mode (W); + Set_KeyPad_Mode (W); + Allow_Scrolling (W, True); + Set_Echo_Mode (False); + P := Create (Frame); + Top (P); + Update_Panels; + else + Clear (W); + Refresh_Without_Update (W); + end if; + + Current := Help; Top_Line := Help; + + if null = Help then + Unknown_Key; + loop + K := Filter_Key; + exit when K = QUIT_CODE; + end loop; + else + To_Window (Current, Has_More); + if Has_More then + -- This means there are more lines available, so we have to go + -- into a scroll manager. + loop + K := Filter_Key; + if K in Special_Key_Code'Range then + case K is + when Key_Cursor_Down => + if Current.Next /= null then + Move_Cursor (W, Height - 1, 0); + Scroll (W, 1); + Current := Current.Next; + Top_Line := Top_Line.Next; + Add (W, Current.Line.all); + end if; + when Key_Cursor_Up => + if Top_Line.Prev /= null then + Move_Cursor (W, 0, 0); + Scroll (W, -1); + Top_Line := Top_Line.Prev; + Current := Current.Prev; + Add (W, Top_Line.Line.all); + end if; + when QUIT_CODE => exit; + when others => null; + end case; + end if; + end loop; + else + loop + K := Filter_Key; + exit when K = QUIT_CODE; + end loop; + end if; + end if; + + Clear (W); + + if Frame /= Null_Window then + Clear (Frame); + Delete (P); + Delete (W); + Delete (Frame); + Pop_Environment; + end if; + + Update_Panels; + Update_Screen; + + Release_Help (Help); + + end Explain; + + function Search (Key : String) return Help_Line_Access + is + Last : Natural; + Buffer : String (1 .. 256); + Root : Help_Line_Access := null; + Current : Help_Line_Access; + Tail : Help_Line_Access := null; + Save : String_Access; + + function Next_Line return Boolean; + + function Next_Line return Boolean + is + H_End : constant String := "#END"; + begin + Get_Line (F, Buffer, Last); + if Last = H_End'Length and then H_End = Buffer (1 .. Last) then + return False; + else + return True; + end if; + end Next_Line; + begin + Reset (F); + Outer : + loop + exit when not Next_Line; + if Last = (1 + Key'Length) and then Key = Buffer (2 .. Last) + and then Buffer (1) = '#' then + loop + exit when not Next_Line; + exit when Buffer (1) = '#'; + Current := new Help_Line'(null, null, + new String'(Buffer (1 .. Last))); + if Tail = null then + Release_Help (Root); + Root := Current; + else + Tail.Next := Current; + Current.Prev := Tail; + end if; + Tail := Current; + end loop; + exit Outer; + end if; + end loop Outer; + return Root; + end Search; + + procedure Release_Help (Root : in out Help_Line_Access) + is + Next : Help_Line_Access; + begin + loop + exit when Root = null; + Next := Root.Next; + Release_String (Root.Line); + Release_Help_Line (Root); + Root := Next; + end loop; + end Release_Help; + + procedure Explain_Context + is + begin + Explain (Context); + end Explain_Context; + + procedure Notepad (Key : in String) + is + H : constant Help_Line_Access := Search (Key); + T : Help_Line_Access := H; + N : Line_Count := 1; + L : Line_Position := 0; + W : Window; + P : Panel; + begin + if H /= null then + loop + T := T.Next; + exit when T = null; + N := N + 1; + end loop; + W := New_Window (N + 2, Columns, Lines - N - 2, 0); + if Has_Colors then + Set_Background (Win => W, + Ch => (Ch => ' ', + Color => Notepad_Color, + Attr => Normal_Video)); + Set_Character_Attributes (Win => W, + Attr => Normal_Video, + Color => Notepad_Color); + Erase (W); + end if; + Box (W); + Window_Title (W, "Notepad"); + P := New_Panel (W); + T := H; + loop + Add (W, L + 1, 1, T.Line.all, Integer (Columns - 2)); + L := L + 1; + T := T.Next; + exit when T = null; + end loop; + T := H; + Release_Help (T); + Refresh_Without_Update (W); + Notepad_To_Context (P); + end if; + end Notepad; + +begin + Open (F, In_File, File_Name); +end Sample.Explanation; + diff --git a/Ada95/samples/sample-explanation.ads b/Ada95/samples/sample-explanation.ads new file mode 100644 index 00000000..3eaecbe3 --- /dev/null +++ b/Ada95/samples/sample-explanation.ads @@ -0,0 +1,49 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Explanation -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +-- Poor mans help system. This scans a sequential file for key lines and +-- then reads the lines up to the next key. Those lines are presented in +-- a window as help or explanation. +-- +with Terminal_Interface.Curses; + +package Sample.Explanation is + + package Curses renames Terminal_Interface.Curses; + + procedure Explain (Key : in String); + -- Retrieve the text associated with this key and display it. + + procedure Explain_Context; + -- Explain the current context. + + procedure Notepad (Key : in String); + -- Put a note on the screen and maintain it with the context + + Explanation_Not_Found : exception; + Explanation_Error : exception; + +end Sample.Explanation; diff --git a/Ada95/samples/sample-form_demo-aux.adb b/Ada95/samples/sample-form_demo-aux.adb new file mode 100644 index 00000000..2f3f24e7 --- /dev/null +++ b/Ada95/samples/sample-form_demo-aux.adb @@ -0,0 +1,241 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Form_Demo.Aux -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.5 $ +------------------------------------------------------------------------------ +with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; + +with Sample.Manifest; use Sample.Manifest; +with Sample.Helpers; use Sample.Helpers; +with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; +with Sample.Explanation; use Sample.Explanation; + +package body Sample.Form_Demo.Aux is + + procedure Geometry (F : in Form; + L : out Line_Count; -- Lines used for menu + C : out Column_Count; -- Columns used for menu + Y : out Line_Position; -- Proposed Line for menu + X : out Column_Position) -- Proposed Column for menu + is + begin + Scale (F, L, C); + + L := L + 2; -- count for frame at top and bottom + C := C + 2; -- " + + -- Calculate horizontal coordinate at the screen center + X := (Columns - C) / 2; + Y := 1; -- start always in line 1 + end Geometry; + + function Create (F : Form; + Title : String; + Lin : Line_Position; + Col : Column_Position) return Panel + is + W, S : Window; + L : Line_Count; + C : Column_Count; + Y : Line_Position; + X : Column_Position; + Pan : Panel; + begin + Geometry (F, L, C, Y, X); + W := New_Window (L, C, Lin, Col); + Set_Meta_Mode (W); + Set_KeyPad_Mode (W); + if Has_Colors then + Set_Background (Win => W, + Ch => (Ch => ' ', + Color => Default_Colors, + Attr => Normal_Video)); + Set_Character_Attributes (Win => W, + Color => Default_Colors, + Attr => Normal_Video); + Erase (W); + end if; + S := Derived_Window (W, L - 2, C - 2, 1, 1); + Set_Meta_Mode (S); + Set_KeyPad_Mode (S); + Box (W); + Set_Window (F, W); + Set_Sub_Window (F, S); + if Title'Length > 0 then + Window_Title (W, Title); + end if; + Pan := New_Panel (W); + Post (F); + return Pan; + end Create; + + procedure Destroy (F : in Form; + P : in out Panel) + is + W, S : Window; + begin + W := Get_Window (F); + S := Get_Sub_Window (F); + Post (F, False); + Erase (W); + Delete (P); + Set_Window (F, Null_Window); + Set_Sub_Window (F, Null_Window); + Delete (S); + Delete (W); + Update_Panels; + end Destroy; + + function Get_Request (F : Form; + P : Panel; + Handle_CRLF : Boolean := True) return Key_Code + is + W : constant Window := Get_Window (F); + K : Real_Key_Code; + Ch : Character; + begin + Top (P); + loop + K := Get_Key (W); + if K in Special_Key_Code'Range then + case K is + when HELP_CODE => Explain_Context; + when EXPLAIN_CODE => Explain ("FORMKEYS"); + when Key_Home => return F_First_Field; + when Key_End => return F_Last_Field; + when QUIT_CODE => return QUIT; + when Key_Cursor_Down => return F_Down_Char; + when Key_Cursor_Up => return F_Up_Char; + when Key_Cursor_Left => return F_Left_Char; + when Key_Cursor_Right => return F_Right_Char; + when Key_Next_Page => return F_ScrollForward_Line; + when Key_Previous_Page => return F_ScrollBackward_Line; + when Key_Backspace => return F_Delete_Previous; + when others => return K; + end case; + elsif K in Normal_Key_Code'Range then + Ch := Character'Val (K); + case Ch is + when DC1 => return QUIT; -- CTRL-Q + when ACK => return F_Next_Page; -- CTRL-F + when STX => return F_Previous_Page; -- CTRL-B + when SO => return F_Next_Field; -- CTRL-N + when DLE => return F_Previous_Field; -- CTRL-P + when FF => return F_Left_Field; -- CTRL-L + when DC2 => return F_Right_Field; -- CTRL-R + when NAK => return F_Up_Field; -- CTRL-U + when EOT => return F_Down_Field; -- CTRL-D + when ETB => return F_Next_Word; -- CTRL-W + when DC4 => return F_Previous_Word; -- CTRL-T + when DC3 => return F_Begin_Field; -- CTRL-S + when ENQ => return F_End_Field; -- CTRL-E + when HT => return F_Insert_Char; -- CTRL-I + when SI => return F_Insert_Line; -- CTRL-O + when SYN => return F_Delete_Char; -- CTRL-V + when BS => return F_Delete_Previous; -- CTRL-H + when EM => return F_Delete_Line; -- CTRL-Y + when BEL => return F_Delete_Word; -- CTRL-G + when VT => return F_Clear_EOF; -- CTRL-K + when CAN => return F_Clear_Field; -- CTRL-X + when SOH => return F_Next_Choice; -- CTRL-A + when SUB => return F_Previous_Choice; -- CTRL-Z + when CR | LF => + if Handle_CRLF then + return F_New_Line; + else + return K; + end if; + when others => return K; + end case; + else + return K; + end if; + end loop; + end Get_Request; + + function Make (Top : Line_Position; + Left : Column_Position; + Text : String) return Field + is + Fld : Field; + C : Column_Count := Column_Count (Text'Length); + begin + Fld := New_Field (1, C, Top, Left); + Set_Buffer (Fld, 0, Text); + Switch_Options (Fld, (Active => True, others => False), False); + if Has_Colors then + Set_Background (Fld => Fld, Color => Default_Colors); + end if; + return Fld; + end Make; + + function Make (Height : Line_Count := 1; + Width : Column_Count; + Top : Line_Position; + Left : Column_Position; + Off_Screen : Natural := 0) return Field + is + Fld : Field := New_Field (Height, Width, Top, Left, Off_Screen); + begin + if Has_Colors then + Set_Foreground (Fld => Fld, Color => Form_Fore_Color); + Set_Background (Fld => Fld, Color => Form_Back_Color); + else + Set_Background (Fld, (Reverse_Video => True, others => False)); + end if; + return Fld; + end Make; + + function Default_Driver (F : Form; + K : Key_Code; + P : Panel) return Boolean + is + begin + if K in User_Key_Code'Range and then K = QUIT then + if Driver (F, F_Validate_Field) = Form_Ok then + return True; + end if; + end if; + return False; + end Default_Driver; + + function Count_Active (F : Form) return Natural + is + N : Natural := 0; + O : Field_Option_Set; + A : constant Field_Array_Access := Fields (F); + H : constant Natural := Field_Count (F); + begin + if H > 0 then + for I in 1 .. H loop + Get_Options (A.all (I), O); + if O.Active then + N := N + 1; + end if; + end loop; + end if; + return N; + end Count_Active; + +end Sample.Form_Demo.Aux; diff --git a/Ada95/samples/sample-form_demo-aux.ads b/Ada95/samples/sample-form_demo-aux.ads new file mode 100644 index 00000000..d1927985 --- /dev/null +++ b/Ada95/samples/sample-form_demo-aux.ads @@ -0,0 +1,78 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Form_Demo.Aux -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses; use Terminal_Interface.Curses; +with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; +with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms; + +package Sample.Form_Demo.Aux is + + procedure Geometry (F : in Form; + L : out Line_Count; + C : out Column_Count; + Y : out Line_Position; + X : out Column_Position); + -- Calculate the geometry for a panel beeing able to be used to display + -- the menu. + + function Create (F : Form; + Title : String; + Lin : Line_Position; + Col : Column_Position) return Panel; + -- Create a panel decorated with a frame and the title at the specified + -- position. The dimension of the panel is derived from the menus layout. + + procedure Destroy (F : in Form; + P : in out Panel); + -- Destroy all the windowing structures associated with this menu and + -- panel. + + function Get_Request (F : Form; + P : Panel; + Handle_CRLF : Boolean := True) return Key_Code; + -- Centralized request driver for all menus in this sample. This + -- gives us a common key binding for all menus. + + function Make (Top : Line_Position; + Left : Column_Position; + Text : String) return Field; + -- create a label + + function Make (Height : Line_Count := 1; + Width : Column_Count; + Top : Line_Position; + Left : Column_Position; + Off_Screen : Natural := 0) return Field; + -- create a editable field + + function Default_Driver (F : Form; + K : Key_Code; + P : Panel) return Boolean; + + function Count_Active (F : Form) return Natural; + -- Count the number of active fields in the form + +end Sample.Form_Demo.Aux; diff --git a/Ada95/samples/sample-form_demo-handler.adb b/Ada95/samples/sample-form_demo-handler.adb new file mode 100644 index 00000000..6f992b7d --- /dev/null +++ b/Ada95/samples/sample-form_demo-handler.adb @@ -0,0 +1,85 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Form_Demo.Handler -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; +with Sample.Form_Demo.Aux; +with Sample.Explanation; use Sample.Explanation; + +package body Sample.Form_Demo.Handler is + + package Aux renames Sample.Form_Demo.Aux; + + procedure Drive_Me (F : in Form; + Title : in String := "") + is + L : Line_Count; + C : Column_Count; + Y : Line_Position; + X : Column_Position; + begin + Aux.Geometry (F, L, C, Y, X); + Drive_Me (F, Y, X, Title); + end Drive_Me; + + procedure Drive_Me (F : in Form; + Lin : in Line_Position; + Col : in Column_Position; + Title : in String := "") + is + Pan : Panel := Aux.Create (F, Title, Lin, Col); + V : Cursor_Visibility := Normal; + Handle_CRLF : Boolean := True; + + begin + Set_Cursor_Visibility (V); + if Aux.Count_Active (F) = 1 then + Handle_CRLF := False; + end if; + loop + declare + K : Key_Code := Aux.Get_Request (F, Pan, Handle_CRLF); + R : Driver_Result; + begin + if (K = 13 or else K = 10) and then not Handle_CRLF then + R := Unknown_Request; + else + R := Driver (F, K); + end if; + case R is + when Form_Ok => null; + when Unknown_Request => + if My_Driver (F, K, Pan) then + exit; + end if; + when others => Beep; + end case; + end; + end loop; + Set_Cursor_Visibility (V); + Aux.Destroy (F, Pan); + end Drive_Me; + +end Sample.Form_Demo.Handler; diff --git a/Ada95/samples/sample-form_demo-handler.ads b/Ada95/samples/sample-form_demo-handler.ads new file mode 100644 index 00000000..33c9f146 --- /dev/null +++ b/Ada95/samples/sample-form_demo-handler.ads @@ -0,0 +1,50 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Form_Demo.Handler -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses; +use Terminal_Interface.Curses; +with Terminal_Interface.Curses.Panels; +use Terminal_Interface.Curses.Panels; +with Terminal_Interface.Curses.Forms; +use Terminal_Interface.Curses.Forms; + +generic + with function My_Driver (Frm : Form; + K : Key_Code; + Pan : Panel) return Boolean; +package Sample.Form_Demo.Handler is + + procedure Drive_Me (F : in Form; + Lin : in Line_Position; + Col : in Column_Position; + Title : in String := ""); + -- Position the menu at the given point and drive it. + + procedure Drive_Me (F : in Form; + Title : in String := ""); + -- Center menu and drive it. + +end Sample.Form_Demo.Handler; diff --git a/Ada95/samples/sample-form_demo.adb b/Ada95/samples/sample-form_demo.adb new file mode 100644 index 00000000..9d4390f6 --- /dev/null +++ b/Ada95/samples/sample-form_demo.adb @@ -0,0 +1,124 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Form_Demo -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; +with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; + +with Terminal_Interface.Curses; use Terminal_Interface.Curses; +with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; +with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms; +with Terminal_Interface.Curses.Forms.Field_User_Data; +with Terminal_Interface.Curses.Forms.Form_User_Data; + +with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; +with Sample.My_Field_Type; use Sample.My_Field_Type; +with Sample.Manifest; use Sample.Manifest; +with Sample.Explanation; use Sample.Explanation; +with Sample.Form_Demo.Aux; use Sample.Form_Demo.Aux; +with Sample.Function_Key_Setting; use Sample.Function_Key_Setting; +with Sample.Form_Demo.Handler; + +package body Sample.Form_Demo is + + type User_Data is + record + Data : Integer; + end record; + type User_Access is access User_Data; + + package Fld_U is new + Terminal_Interface.Curses.Forms.Field_User_Data (User_Data, + User_Access); + + package Frm_U is new + Terminal_Interface.Curses.Forms.Form_User_Data (User_Data, + User_Access); + + Enums : constant Enum_Array := (new String'("alpha"), + new String'("beta"), + new String'("gamma")); + + Enum_Info : constant Enumeration_Info := (Enums'Length, Enums, + False, False); + + Enum_Field : constant Enumeration_Field := Create (Enum_Info, True); + + procedure Demo + is + + Mft : My_Data := (Ch => 'X'); + + FA : Field_Array (1 .. 9) := (Make (0, 14, "Sample Entry Form"), + Make (2, 0, "An Enumeration"), + Make (2, 20, "Numeric 1-10"), + Make (2, 34, "Only 'X'"), + Make (5, 0, + "Multiple Lines offscreen (Scroll)"), + + Make (Width => 18, Top => 3, Left => 0), + Make (Width => 12, Top => 3, Left => 20), + Make (Width => 12, Top => 3, Left => 34), + Make (Width => 46, Top => 6, Left => 0, + Height => 4, Off_Screen => 2) + ); + + Frm : Terminal_Interface.Curses.Forms.Form := Create (FA); + + I_F : constant Integer_Field := (Precision => 0, + Lower_Limit => 1, + Upper_Limit => 10); + + F1, F2 : User_Access; + + package Fh is new Sample.Form_Demo.Handler (Default_Driver); + + begin + Push_Environment ("FORM00"); + Notepad ("FORM-PAD00"); + Default_Labels; + + Set_Type (FA (6), Enum_Field); + Set_Type (FA (7), I_F); + Set_Type (FA (8), Mft); + + F1 := new User_Data'(Data => 4711); + Fld_U.Set_User_Data (FA (1), F1); + + Fh.Drive_Me (Frm); + + Fld_U.Get_User_Data (FA (1), F2); + pragma Assert (F1 = F2); + pragma Assert (F1.Data = F2.Data); + + Pop_Environment; + Delete (Frm); + + for I in FA'Range loop + Delete (FA (I)); + end loop; + end Demo; + +end Sample.Form_Demo; diff --git a/Ada95/samples/sample-form_demo.ads b/Ada95/samples/sample-form_demo.ads new file mode 100644 index 00000000..42fdec6b --- /dev/null +++ b/Ada95/samples/sample-form_demo.ads @@ -0,0 +1,31 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Form_Demo -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +package Sample.Form_Demo is + + procedure Demo; + +end Sample.Form_Demo; diff --git a/Ada95/samples/sample-function_key_setting.adb b/Ada95/samples/sample-function_key_setting.adb new file mode 100644 index 00000000..4cae7275 --- /dev/null +++ b/Ada95/samples/sample-function_key_setting.adb @@ -0,0 +1,199 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Function_Key_Setting -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Ada.Unchecked_Deallocation; +with Sample.Manifest; use Sample.Manifest; + +-- This package implements a simple stack of function key label environments. +-- +package body Sample.Function_Key_Setting is + + Max_Label_Length : constant Positive := 8; + Number_Of_Keys : Label_Number := Label_Number'Last; + Justification : Label_Justification := Left; + + subtype Label is String (1 .. Max_Label_Length); + type Label_Array is array (Label_Number range <>) of Label; + + type Key_Environment (N : Label_Number := Label_Number'Last); + type Env_Ptr is access Key_Environment; + pragma Controlled (Env_Ptr); + + type String_Access is access String; + pragma Controlled (String_Access); + + Active_Context : String_Access := new String'("MAIN"); + Active_Notepad : Panel := Null_Panel; + + type Key_Environment (N : Label_Number := Label_Number'Last) is + record + Prev : Env_Ptr; + Help : String_Access; + Notepad : Panel; + Labels : Label_Array (1 .. N); + end record; + + procedure Release_String is + new Ada.Unchecked_Deallocation (String, + String_Access); + + procedure Release_Environment is + new Ada.Unchecked_Deallocation (Key_Environment, + Env_Ptr); + + Top_Of_Stack : Env_Ptr := null; + + procedure Push_Environment (Key : in String; + Reset : in Boolean := True) + is + P : constant Env_Ptr := new Key_Environment (Number_Of_Keys); + begin + -- Store the current labels in the environment + for I in 1 .. Number_Of_Keys loop + Get_Soft_Label_Key (I, P.Labels (I)); + if Reset then + Set_Soft_Label_Key (I, " "); + end if; + end loop; + P.Prev := Top_Of_Stack; + -- now store active help context and notepad + P.Help := Active_Context; + P.Notepad := Active_Notepad; + -- The notepad must now vanish and the new notepad is empty. + if (P.Notepad /= Null_Panel) then + Hide (P.Notepad); + Update_Panels; + end if; + Active_Notepad := Null_Panel; + Active_Context := new String'(Key); + + Top_Of_Stack := P; + if Reset then + Refresh_Soft_Label_Keys_Without_Update; + end if; + end Push_Environment; + + procedure Pop_Environment + is + P : Env_Ptr := Top_Of_Stack; + begin + if Top_Of_Stack = null then + raise Function_Key_Stack_Error; + else + for I in 1 .. Number_Of_Keys loop + Set_Soft_Label_Key (I, P.Labels (I), Justification); + end loop; + pragma Assert (Active_Context /= null); + Release_String (Active_Context); + Active_Context := P.Help; + Refresh_Soft_Label_Keys_Without_Update; + Notepad_To_Context (P.Notepad); + Top_Of_Stack := P.Prev; + Release_Environment (P); + end if; + end Pop_Environment; + + function Context return String + is + begin + if Active_Context /= null then + return Active_Context.all; + else + return ""; + end if; + end Context; + + function Find_Context (Key : String) return Boolean + is + P : Env_Ptr := Top_Of_Stack; + begin + if Active_Context.all = Key then + return True; + else + loop + exit when P = null; + if P.Help.all = Key then + return True; + else + P := P.Prev; + end if; + end loop; + return False; + end if; + end Find_Context; + + procedure Notepad_To_Context (Pan : in Panel) + is + W : Window; + begin + if Active_Notepad /= Null_Panel then + W := Get_Window (Active_Notepad); + Clear (W); + Delete (Active_Notepad); + Delete (W); + end if; + Active_Notepad := Pan; + if Pan /= Null_Panel then + Top (Pan); + end if; + Update_Panels; + Update_Screen; + end Notepad_To_Context; + + procedure Initialize (Mode : Soft_Label_Key_Format := PC_Style; + Just : Label_Justification := Left) + is + begin + case Mode is + when PC_Style .. PC_Style_With_Index + => Number_Of_Keys := 12; + when others + => Number_Of_Keys := 8; + end case; + Init_Soft_Label_Keys (Mode); + Justification := Just; + end Initialize; + + procedure Default_Labels + is + begin + Set_Soft_Label_Key (FKEY_QUIT, "Quit"); + Set_Soft_Label_Key (FKEY_HELP, "Help"); + Set_Soft_Label_Key (FKEY_EXPLAIN, "Keys"); + Refresh_Soft_Label_Keys_Without_Update; + end Default_Labels; + + function Notepad_Window return Window + is + begin + if Active_Notepad /= Null_Panel then + return Get_Window (Active_Notepad); + else + return Null_Window; + end if; + end Notepad_Window; + +end Sample.Function_Key_Setting; diff --git a/Ada95/samples/sample-function_key_setting.ads b/Ada95/samples/sample-function_key_setting.ads new file mode 100644 index 00000000..6199094d --- /dev/null +++ b/Ada95/samples/sample-function_key_setting.ads @@ -0,0 +1,68 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Function_Key_Setting -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses; use Terminal_Interface.Curses; +with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; + +-- This package implements a simple stack of function key label environments. +-- +package Sample.Function_Key_Setting is + + procedure Push_Environment (Key : in String; + Reset : in Boolean := True); + -- Push the definition of the current function keys on an internal + -- stack. If the reset flag is true, all labels are reset while + -- pushed, so the new environment can assume a tabula rasa. + -- The Key defines the new Help Context associated with the new + -- Environment. This saves also the currently active Notepad. + + procedure Pop_Environment; + -- Pop the Definitions from the stack and make them the current ones. + -- This also restores the Help context and the previous Notepad. + + procedure Initialize (Mode : Soft_Label_Key_Format := PC_Style; + Just : Label_Justification := Left); + -- Initialize the environment + + function Context return String; + -- Return the current context identitfier + + function Find_Context (Key : String) return Boolean; + -- Look for a context, return true if it is in the stack, + -- false otherwise. + + procedure Notepad_To_Context (Pan : in Panel); + -- Add a panel representing a notepad to the current context. + + Function_Key_Stack_Error : exception; + + procedure Default_Labels; + -- Set the default labels used in all environments + + function Notepad_Window return Window; + -- Return the current notepad window or Null_Window if there is none. + +end Sample.Function_Key_Setting; diff --git a/Ada95/samples/sample-header_handler.adb b/Ada95/samples/sample-header_handler.adb new file mode 100644 index 00000000..b66402d8 --- /dev/null +++ b/Ada95/samples/sample-header_handler.adb @@ -0,0 +1,166 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Header_Handler -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +with Ada.Calendar; use Ada.Calendar; +with Terminal_Interface.Curses.Text_IO.Integer_IO; +with Sample.Manifest; use Sample.Manifest; + +-- This package handles the painting of the header line of the screen. +-- +package body Sample.Header_Handler is + + package Int_IO is new + Terminal_Interface.Curses.Text_IO.Integer_IO (Integer); + use Int_IO; + + Header_Window : Window := Null_Window; + + Display_Hour : Integer := -1; -- hour last displayed + Display_Min : Integer := -1; -- minute last displayed + Display_Day : Integer := -1; -- day last displayed + Display_Month : Integer := -1; -- month last displayed + + -- This is the routine handed over to the curses library to be called + -- as initialization routine when ripping of the header lines from + -- the screen. This routine must follow C conventions. + function Init_Header_Window (Win : Window; + Columns : Column_Count) return Integer; + pragma Convention (C, Init_Header_Window); + + procedure Internal_Update_Header_Window (Do_Update : in Boolean); + + + -- The initialization must be called before Init_Screen. It steals two + -- lines from the top of the screen. + procedure Init_Header_Handler + is + begin + Rip_Off_Lines (2, Init_Header_Window'Access); + end Init_Header_Handler; + + procedure N_Out (N : in Integer); + + -- Emit a two digit number and ensure that a leading zero is generated if + -- necessary. + procedure N_Out (N : in Integer) + is + begin + if N < 10 then + Add (Header_Window, '0'); + Put (Header_Window, N, 1); + else + Put (Header_Window, N, 2); + end if; + end N_Out; + + -- Paint the header window. The input parameter is a flag indicating + -- whether or not the screen should be updated physically after painting. + procedure Internal_Update_Header_Window (Do_Update : in Boolean) + is + type Month_Name_Array is + array (Month_Number'First .. Month_Number'Last) of String (1 .. 9); + + Month_Names : constant Month_Name_Array := + ("January ", + "February ", + "March ", + "April ", + "May ", + "June ", + "July ", + "August ", + "September", + "October ", + "November ", + "December "); + + Now : Time := Clock; + Sec : Integer := Integer (Seconds (Now)); + Hour : Integer := Sec / 3600; + Minute : Integer := (Sec - Hour * 3600) / 60; + Mon : Month_Number := Month (Now); + D : Day_Number := Day (Now); + begin + if Header_Window /= Null_Window then + if Minute /= Display_Min or else Hour /= Display_Hour + or else Display_Day /= D or else Display_Month /= Mon then + Move_Cursor (Header_Window, 0, 0); + N_Out (D); Add (Header_Window, '.'); + Add (Header_Window, Month_Names (Mon)); + Move_Cursor (Header_Window, 1, 0); + N_Out (Hour); Add (Header_Window, ':'); + N_Out (Minute); + Display_Min := Minute; + Display_Hour := Hour; + Display_Month := Mon; + Display_Day := D; + Refresh_Without_Update (Header_Window); + if Do_Update then + Update_Screen; + end if; + end if; + end if; + end Internal_Update_Header_Window; + + -- This routine is called in the keyboard input timeout handler. So it will + -- periodically update the header line of the screen. + procedure Update_Header_Window + is + begin + Internal_Update_Header_Window (True); + end Update_Header_Window; + + function Init_Header_Window (Win : Window; + Columns : Column_Count) return Integer + is + Title : constant String := "Ada 95 ncurses Binding Sample"; + Pos : Column_Position; + begin + Header_Window := Win; + if Win /= Null_Window then + if Has_Colors then + Set_Background (Win => Win, + Ch => (Ch => ' ', + Color => Header_Color, + Attr => Normal_Video)); + Set_Character_Attributes (Win => Win, + Attr => Normal_Video, + Color => Header_Color); + Erase (Win); + end if; + Leave_Cursor_After_Update (Win, True); + Pos := Columns - Column_Position (Title'Length); + Add (Win, 0, Pos / 2, Title); + -- In this phase we must not allow a physical update, because + -- ncurses isn´t properly initialized at this point. + Internal_Update_Header_Window (False); + return 0; + else + return -1; + end if; + end Init_Header_Window; + +end Sample.Header_Handler; diff --git a/Ada95/samples/sample-header_handler.ads b/Ada95/samples/sample-header_handler.ads new file mode 100644 index 00000000..a88b798d --- /dev/null +++ b/Ada95/samples/sample-header_handler.ads @@ -0,0 +1,39 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Header_Handler -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses; use Terminal_Interface.Curses; + +-- This package handles the painting of the header line of the screen. +-- +package Sample.Header_Handler is + + procedure Init_Header_Handler; + -- Initialize the handler for the headerlines. + + procedure Update_Header_Window; + -- Update the information in the header window + +end Sample.Header_Handler; diff --git a/Ada95/samples/sample-helpers.adb b/Ada95/samples/sample-helpers.adb new file mode 100644 index 00000000..379b592a --- /dev/null +++ b/Ada95/samples/sample-helpers.adb @@ -0,0 +1,55 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Helpers -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses; use Terminal_Interface.Curses; + +with Sample.Explanation; use Sample.Explanation; + +-- This package contains some conveniant helper routines used throughout +-- this example. +-- +package body Sample.Helpers is + + procedure Window_Title (Win : in Window; + Title : in String) + is + Height : Line_Count; + Width : Column_Count; + Pos : Column_Position := 0; + begin + Get_Size (Win, Height, Width); + if Title'Length < Width then + Pos := (Width - Title'Length) / 2; + end if; + Add (Win, 0, Pos, Title); + end Window_Title; + + procedure Not_Implemented is + begin + Explain ("NOTIMPL"); + end Not_Implemented; + +end Sample.Helpers; diff --git a/Ada95/samples/sample-helpers.ads b/Ada95/samples/sample-helpers.ads new file mode 100644 index 00000000..6b4ef2ae --- /dev/null +++ b/Ada95/samples/sample-helpers.ads @@ -0,0 +1,40 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Helpers -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses; use Terminal_Interface.Curses; + +-- This package contains some conveniant helper routines used throughout +-- this example. +-- +package Sample.Helpers is + + procedure Window_Title (Win : in Window; + Title : in String); + -- Put a title string into the first line of the window + + procedure Not_Implemented; + +end Sample.Helpers; diff --git a/Ada95/samples/sample-keyboard_handler.adb b/Ada95/samples/sample-keyboard_handler.adb new file mode 100644 index 00000000..c320cdd2 --- /dev/null +++ b/Ada95/samples/sample-keyboard_handler.adb @@ -0,0 +1,175 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Keyboard_Handler -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Ada.Strings; use Ada.Strings; +with Ada.Strings.Fixed; use Ada.Strings.Fixed; +with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants; +with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; + +with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; +with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms; + +with Sample.Header_Handler; use Sample.Header_Handler; +with Sample.Form_Demo.Aux; use Sample.Form_Demo.Aux; +with Sample.Manifest; use Sample.Manifest; +with Sample.Form_Demo.Handler; + +-- This package contains a centralized keyboard handler used throughout +-- this example. The handler establishes a timeout mechanism that provides +-- periodical updates of the common header lines used in this example. +-- + +package body Sample.Keyboard_Handler is + + In_Command : Boolean := False; + + function Get_Key (Win : Window := Standard_Window) return Real_Key_Code + is + K : Real_Key_Code; + + function Command return Real_Key_Code; + + + function Command return Real_Key_Code + is + function My_Driver (F : Form; + C : Key_Code; + P : Panel) return Boolean; + package Fh is new Sample.Form_Demo.Handler (My_Driver); + + type Label_Array is array (Label_Number) of String (1 .. 8); + + Labels : Label_Array; + + FA : Field_Array (1 .. 2) := (Make (0, 0, "Command:"), + Make (Top => 0, Left => 9, + Width => Columns - 11)); + + K : Real_Key_Code := Key_None; + N : Natural := 0; + + function My_Driver (F : Form; + C : Key_Code; + P : Panel) return Boolean + is + Ch : Character; + begin + if C in User_Key_Code'Range and then C = QUIT then + if Driver (F, F_Validate_Field) = Form_Ok then + K := Key_None; + return True; + end if; + elsif C in Normal_Key_Code'Range then + Ch := Character'Val (C); + if (Ch = LF or else Ch = CR) then + if Driver (F, F_Validate_Field) = Form_Ok then + declare + Buffer : String (1 .. Positive (Columns - 11)); + Cmdc : String (1 .. 8); + begin + Get_Buffer (Fld => FA (2), Str => Buffer); + Trim (Buffer, Left); + if Buffer (1) /= ' ' then + Cmdc := Buffer (Cmdc'Range); + for I in Labels'Range loop + if Cmdc = Labels (I) then + K := Function_Key_Code + (Function_Key_Number (I)); + exit; + end if; + end loop; + end if; + return True; + end; + end if; + end if; + end if; + return False; + end My_Driver; + + begin + In_Command := True; + for I in Label_Number'Range loop + Get_Soft_Label_Key (I, Labels (I)); + Trim (Labels (I), Left); + Translate (Labels (I), Upper_Case_Map); + if Labels (I) (1) /= ' ' then + N := N + 1; + end if; + end loop; + if N > 0 then -- some labels were really set + declare + Enum_Info : Enumeration_Info (N); + Enum_Field : Enumeration_Field; + J : Positive := Enum_Info.Names'First; + + Frm : Form := Create (FA); + + begin + for I in Label_Number'Range loop + if Labels (I) (1) /= ' ' then + Enum_Info.Names (J) := new String'(Labels (I)); + J := J + 1; + end if; + end loop; + Enum_Field := Create (Enum_Info, True); + Set_Type (FA (2), Enum_Field); + Set_Background (FA (2), Normal_Video); + + Fh.Drive_Me (Frm, Lines - 3, 0); + Delete (Frm); + Update_Panels; Update_Screen; + end; + end if; + for I in FA'Range loop + Delete (FA (I)); + end loop; + In_Command := False; + return K; + end Command; + + begin + Set_Timeout_Mode (Win, Delayed, 30000); + loop + K := Get_Keystroke (Win); + if K = Key_None then -- a timeout occured + Update_Header_Window; + elsif K = 3 and then not In_Command then -- CTRL-C + K := Command; + exit when K /= Key_None; + else + exit; + end if; + end loop; + return K; + end Get_Key; + + procedure Init_Keyboard_Handler is + begin + null; + end Init_Keyboard_Handler; + +end Sample.Keyboard_Handler; diff --git a/Ada95/samples/sample-keyboard_handler.ads b/Ada95/samples/sample-keyboard_handler.ads new file mode 100644 index 00000000..7927ac0e --- /dev/null +++ b/Ada95/samples/sample-keyboard_handler.ads @@ -0,0 +1,41 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Keyboard_Handler -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses; use Terminal_Interface.Curses; + +-- This package contains a centralized keyboard handler used throughout +-- this example. The handler establishes a timeout mechanism that provides +-- periodical updates of the common header lines used in this example. +-- +package Sample.Keyboard_Handler is + + function Get_Key (Win : Window := Standard_Window) return Real_Key_Code; + -- The central routine for handling keystrokes. + + procedure Init_Keyboard_Handler; + -- Initialize the keyboard + +end Sample.Keyboard_Handler; diff --git a/Ada95/samples/sample-manifest.ads b/Ada95/samples/sample-manifest.ads new file mode 100644 index 00000000..3f14246a --- /dev/null +++ b/Ada95/samples/sample-manifest.ads @@ -0,0 +1,53 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Manifest -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses; use Terminal_Interface.Curses; + +package Sample.Manifest is + + QUIT : constant User_Key_Code := User_Key_Code'First; + SELECT_ITEM : constant User_Key_Code := QUIT + 1; + + FKEY_HELP : constant Label_Number := 1; + HELP_CODE : constant Special_Key_Code := Key_F1; + FKEY_EXPLAIN : constant Label_Number := 2; + EXPLAIN_CODE : constant Special_Key_Code := Key_F2; + FKEY_QUIT : constant Label_Number := 3; + QUIT_CODE : constant Special_Key_Code := Key_F3; + + Menu_Marker : constant String := "=> "; + + Default_Colors : constant Redefinable_Color_Pair := 1; + Menu_Fore_Color : constant Redefinable_Color_Pair := 2; + Menu_Back_Color : constant Redefinable_Color_Pair := 3; + Menu_Grey_Color : constant Redefinable_Color_Pair := 4; + Form_Fore_Color : constant Redefinable_Color_Pair := 5; + Form_Back_Color : constant Redefinable_Color_Pair := 6; + Notepad_Color : constant Redefinable_Color_Pair := 7; + Help_Color : constant Redefinable_Color_Pair := 8; + Header_Color : constant Redefinable_Color_Pair := 9; + +end Sample.Manifest; diff --git a/Ada95/samples/sample-menu_demo-aux.adb b/Ada95/samples/sample-menu_demo-aux.adb new file mode 100644 index 00000000..9e091b2c --- /dev/null +++ b/Ada95/samples/sample-menu_demo-aux.adb @@ -0,0 +1,190 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Menu_Demo.Aux -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; + +with Sample.Manifest; use Sample.Manifest; +with Sample.Helpers; use Sample.Helpers; +with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; +with Sample.Explanation; use Sample.Explanation; + +package body Sample.Menu_Demo.Aux is + + procedure Geometry (M : in Menu; + L : out Line_Count; + C : out Column_Count; + Y : out Line_Position; + X : out Column_Position; + Fy : out Line_Position; + Fx : out Column_Position); + + procedure Geometry (M : in Menu; + L : out Line_Count; -- Lines used for menu + C : out Column_Count; -- Columns used for menu + Y : out Line_Position; -- Proposed Line for menu + X : out Column_Position; -- Proposed Column for menu + Fy : out Line_Position; -- Vertical inner frame + Fx : out Column_Position) -- Horiz. inner frame + is + Spc_Desc : Column_Position; -- spaces between description and item + begin + Set_Mark (M, Menu_Marker); + + Spacing (M, Spc_Desc, Fy, Fx); + Scale (M, L, C); + + Fx := Fx + Column_Position (Fy - 1); -- looks a bit nicer + + L := L + 2 * Fy; -- count for frame at top and bottom + C := C + 2 * Fx; -- " + + -- Calculate horizontal coordinate at the screen center + X := (Columns - C) / 2; + Y := 1; -- always startin line 1 + + end Geometry; + + procedure Geometry (M : in Menu; + L : out Line_Count; -- Lines used for menu + C : out Column_Count; -- Columns used for menu + Y : out Line_Position; -- Proposed Line for menu + X : out Column_Position) -- Proposed Column for menu + is + Fy : Line_Position; + Fx : Column_Position; + begin + Geometry (M, L, C, Y, X, Fy, Fx); + end Geometry; + + function Create (M : Menu; + Title : String; + Lin : Line_Position; + Col : Column_Position) return Panel + is + W, S : Window; + L : Line_Count; + C : Column_Count; + Y, Fy : Line_Position; + X, Fx : Column_Position; + Pan : Panel; + begin + Geometry (M, L, C, Y, X, Fy, Fx); + W := New_Window (L, C, Lin, Col); + Set_Meta_Mode (W); + Set_KeyPad_Mode (W); + if Has_Colors then + Set_Background (Win => W, + Ch => (Ch => ' ', + Color => Menu_Back_Color, + Attr => Normal_Video)); + Set_Foreground (Men => M, Color => Menu_Fore_Color); + Set_Background (Men => M, Color => Menu_Back_Color); + Set_Grey (Men => M, Color => Menu_Grey_Color); + Erase (W); + end if; + S := Derived_Window (W, L - Fy, C - Fx, Fy, Fx); + Set_Meta_Mode (S); + Set_KeyPad_Mode (S); + Box (W); + Set_Window (M, W); + Set_Sub_Window (M, S); + if Title'Length > 0 then + Window_Title (W, Title); + end if; + Pan := New_Panel (W); + Post (M); + return Pan; + end Create; + + procedure Destroy (M : in Menu; + P : in out Panel) + is + W, S : Window; + begin + W := Get_Window (M); + S := Get_Sub_Window (M); + Post (M, False); + Erase (W); + Delete (P); + Set_Window (M, Null_Window); + Set_Sub_Window (M, Null_Window); + Delete (S); + Delete (W); + Update_Panels; + end Destroy; + + function Get_Request (M : Menu; P : Panel) return Key_Code + is + W : constant Window := Get_Window (M); + K : Real_Key_Code; + Ch : Character; + begin + Top (P); + loop + K := Get_Key (W); + if K in Special_Key_Code'Range then + case K is + when HELP_CODE => Explain_Context; + when EXPLAIN_CODE => Explain ("MENUKEYS"); + when Key_Home => return REQ_FIRST_ITEM; + when QUIT_CODE => return QUIT; + when Key_Cursor_Down => return REQ_DOWN_ITEM; + when Key_Cursor_Up => return REQ_UP_ITEM; + when Key_Cursor_Left => return REQ_LEFT_ITEM; + when Key_Cursor_Right => return REQ_RIGHT_ITEM; + when Key_End => return REQ_LAST_ITEM; + when Key_Backspace => return REQ_BACK_PATTERN; + when Key_Next_Page => return REQ_SCR_DPAGE; + when Key_Previous_Page => return REQ_SCR_UPAGE; + when others => return K; + end case; + elsif K in Normal_Key_Code'Range then + Ch := Character'Val (K); + case Ch is + when DC1 => return QUIT; -- CTRL-Q + when SO => return REQ_NEXT_ITEM; -- CTRL-N + when DLE => return REQ_PREV_ITEM; -- CTRL-P + when NAK => return REQ_SCR_ULINE; -- CTRL-U + when EOT => return REQ_SCR_DLINE; -- CTRL-D + when ACK => return REQ_SCR_DPAGE; -- CTRL-F + when STX => return REQ_SCR_UPAGE; -- CTRL-B + when CAN => return REQ_CLEAR_PATTERN; -- CTRL-X + when BS => return REQ_BACK_PATTERN; -- CTRL-H + when SOH => return REQ_NEXT_MATCH; -- CTRL-A + when SUB => return REQ_PREV_MATCH; -- CTRL-Z + when DC4 => return REQ_TOGGLE_ITEM; -- CTRL-T + when CR => return SELECT_ITEM; -- CTRL-M + when LF => return SELECT_ITEM; -- CTRL-J + when others => return K; + end case; + else + return K; + end if; + end loop; + end Get_Request; + +end Sample.Menu_Demo.Aux; + diff --git a/Ada95/samples/sample-menu_demo-aux.ads b/Ada95/samples/sample-menu_demo-aux.ads new file mode 100644 index 00000000..a1061305 --- /dev/null +++ b/Ada95/samples/sample-menu_demo-aux.ads @@ -0,0 +1,57 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Menu_Demo.Aux -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses; use Terminal_Interface.Curses; +with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; +with Terminal_Interface.Curses.Menus; use Terminal_Interface.Curses.Menus; + +package Sample.Menu_Demo.Aux is + + procedure Geometry (M : in Menu; + L : out Line_Count; + C : out Column_Count; + Y : out Line_Position; + X : out Column_Position); + -- Calculate the geometry for a panel beeing able to be used to display + -- the menu. + + function Create (M : Menu; + Title : String; + Lin : Line_Position; + Col : Column_Position) return Panel; + -- Create a panel decorated with a frame and the title at the specified + -- position. The dimension of the panel is derived from the menus layout. + + procedure Destroy (M : in Menu; + P : in out Panel); + -- Destroy all the windowing structures associated with this menu and + -- panel. + + function Get_Request (M : Menu; P : Panel) return Key_Code; + -- Centralized request driver for all menus in this sample. This + -- gives us a common key binding for all menus. + +end Sample.Menu_Demo.Aux; diff --git a/Ada95/samples/sample-menu_demo-handler.adb b/Ada95/samples/sample-menu_demo-handler.adb new file mode 100644 index 00000000..aa0c10ea --- /dev/null +++ b/Ada95/samples/sample-menu_demo-handler.adb @@ -0,0 +1,74 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Menu_Demo.Handler -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Sample.Menu_Demo.Aux; +with Sample.Explanation; use Sample.Explanation; + +package body Sample.Menu_Demo.Handler is + + package Aux renames Sample.Menu_Demo.Aux; + + procedure Drive_Me (M : in Menu; + Title : in String := "") + is + L : Line_Count; + C : Column_Count; + Y : Line_Position; + X : Column_Position; + begin + Aux.Geometry (M, L, C, Y, X); + Drive_Me (M, Y, X, Title); + end Drive_Me; + + procedure Drive_Me (M : in Menu; + Lin : in Line_Position; + Col : in Column_Position; + Title : in String := "") + is + Pan : Panel := Aux.Create (M, Title, Lin, Col); + V : Cursor_Visibility := Invisible; + begin + Set_Cursor_Visibility (V); + loop + declare + K : Key_Code := Aux.Get_Request (M, Pan); + R : Driver_Result := Driver (M, K); + begin + case R is + when Menu_Ok => null; + when Unknown_Request => + if My_Driver (M, K, Pan) then + exit; + end if; + when others => Beep; + end case; + end; + end loop; + Set_Cursor_Visibility (V); + Aux.Destroy (M, Pan); + end Drive_Me; + +end Sample.Menu_Demo.Handler; diff --git a/Ada95/samples/sample-menu_demo-handler.ads b/Ada95/samples/sample-menu_demo-handler.ads new file mode 100644 index 00000000..107d1c7a --- /dev/null +++ b/Ada95/samples/sample-menu_demo-handler.ads @@ -0,0 +1,50 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Menu_Demo.Handler -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses; +use Terminal_Interface.Curses; +with Terminal_Interface.Curses.Panels; +use Terminal_Interface.Curses.Panels; +with Terminal_Interface.Curses.Menus; +use Terminal_Interface.Curses.Menus; + +generic + with function My_Driver (Men : Menu; + K : Key_Code; + Pan : Panel) return Boolean; +package Sample.Menu_Demo.Handler is + + procedure Drive_Me (M : in Menu; + Lin : in Line_Position; + Col : in Column_Position; + Title : in String := ""); + -- Position the menu at the given point and drive it. + + procedure Drive_Me (M : in Menu; + Title : in String := ""); + -- Center menu and drive it. + +end Sample.Menu_Demo.Handler; diff --git a/Ada95/samples/sample-menu_demo.adb b/Ada95/samples/sample-menu_demo.adb new file mode 100644 index 00000000..6006fc3c --- /dev/null +++ b/Ada95/samples/sample-menu_demo.adb @@ -0,0 +1,386 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Menu_Demo -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.4 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses; use Terminal_Interface.Curses; +with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; +with Terminal_Interface.Curses.Menus; use Terminal_Interface.Curses.Menus; +with Terminal_Interface.Curses.Menus.Menu_User_Data; +with Terminal_Interface.Curses.Menus.Item_User_Data; + +with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; + +with Sample.Manifest; use Sample.Manifest; +with Sample.Function_Key_Setting; use Sample.Function_Key_Setting; +with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; +with Sample.Menu_Demo.Handler; +with Sample.Helpers; use Sample.Helpers; +with Sample.Explanation; use Sample.Explanation; + +package body Sample.Menu_Demo is + + package Spacing_Demo is + procedure Spacing_Test; + end Spacing_Demo; + + package body Spacing_Demo is + + procedure Spacing_Test + is + function My_Driver (M : Menu; + K : Key_Code; + P : Panel) return Boolean; + + procedure Set_Option_Key; + procedure Set_Select_Key; + procedure Set_Description_Key; + procedure Set_Hide_Key; + + package Mh is new Sample.Menu_Demo.Handler (My_Driver); + + I : constant Item_Array (1 .. 12) := (New_Item ("January", + "31 Days"), + New_Item ("February", + "28/29 Days"), + New_Item ("March", + "31 Days"), + New_Item ("April", + "30 Days"), + New_Item ("May", + "31 Days"), + New_Item ("June", + "30 Days"), + New_Item ("July", + "31 Days"), + New_Item ("August", + "31 Days"), + New_Item ("September", + "30 Days"), + New_Item ("October", + "31 Days"), + New_Item ("November", + "30 Days"), + New_Item ("December", + "31 Days")); + + M : Menu := New_Menu (I); + Flip_State : Boolean := True; + Hide_Long : Boolean := False; + + type Format_Code is (Four_By_1, Four_By_2, Four_By_3); + type Operations is (Flip, Reorder, Reformat, Reselect, Describe); + + type Change is array (Operations) of Boolean; + pragma Pack (Change); + No_Change : constant Change := Change'(others => False); + + Current_Format : Format_Code := Four_By_1; + To_Change : Change := No_Change; + + function My_Driver (M : Menu; + K : Key_Code; + P : Panel) return Boolean + is + begin + To_Change := No_Change; + if K in User_Key_Code'Range then + if K = QUIT then + return True; + end if; + end if; + if K in Special_Key_Code'Range then + case K is + when Key_F4 => + To_Change (Flip) := True; + return True; + when Key_F5 => + To_Change (Reformat) := True; + Current_Format := Four_By_1; + return True; + when Key_F6 => + To_Change (Reformat) := True; + Current_Format := Four_By_2; + return True; + when Key_F7 => + To_Change (Reformat) := True; + Current_Format := Four_By_3; + return True; + when Key_F8 => + To_Change (Reorder) := True; + return True; + when Key_F9 => + To_Change (Reselect) := True; + return True; + when Key_F10 => + if Current_Format /= Four_By_3 then + To_Change (Describe) := True; + return True; + else + return False; + end if; + when Key_F11 => + Hide_Long := not Hide_Long; + declare + O : Item_Option_Set; + begin + for J in I'Range loop + Get_Options (I (J), O); + O.Selectable := True; + if Hide_Long then + case J is + when 1 | 3 | 5 | 7 | 8 | 10 | 12 => + O.Selectable := False; + when others => null; + end case; + end if; + Set_Options (I (J), O); + end loop; + end; + return False; + when others => null; + end case; + end if; + return False; + end My_Driver; + + procedure Set_Option_Key + is + O : Menu_Option_Set; + begin + if Current_Format = Four_By_1 then + Set_Soft_Label_Key (8, ""); + else + Get_Options (M, O); + if O.Row_Major_Order then + Set_Soft_Label_Key (8, "O-Col"); + else + Set_Soft_Label_Key (8, "O-Row"); + end if; + end if; + Refresh_Soft_Label_Keys_Without_Update; + end Set_Option_Key; + + procedure Set_Select_Key + is + O : Menu_Option_Set; + begin + Get_Options (M, O); + if O.One_Valued then + Set_Soft_Label_Key (9, "Multi"); + else + Set_Soft_Label_Key (9, "Singl"); + end if; + Refresh_Soft_Label_Keys_Without_Update; + end Set_Select_Key; + + procedure Set_Description_Key + is + O : Menu_Option_Set; + begin + if Current_Format = Four_By_3 then + Set_Soft_Label_Key (10, ""); + else + Get_Options (M, O); + if O.Show_Descriptions then + Set_Soft_Label_Key (10, "-Desc"); + else + Set_Soft_Label_Key (10, "+Desc"); + end if; + end if; + Refresh_Soft_Label_Keys_Without_Update; + end Set_Description_Key; + + procedure Set_Hide_Key + is + begin + if Hide_Long then + Set_Soft_Label_Key (11, "Enab"); + else + Set_Soft_Label_Key (11, "Disab"); + end if; + Refresh_Soft_Label_Keys_Without_Update; + end Set_Hide_Key; + + begin + Push_Environment ("MENU01"); + Notepad ("MENU-PAD01"); + Default_Labels; + Set_Soft_Label_Key (4, "Flip"); + Set_Soft_Label_Key (5, "4x1"); + Set_Soft_Label_Key (6, "4x2"); + Set_Soft_Label_Key (7, "4x3"); + Set_Option_Key; + Set_Select_Key; + Set_Description_Key; + Set_Hide_Key; + + Set_Format (M, 4, 1); + loop + Mh.Drive_Me (M); + exit when To_Change = No_Change; + if To_Change (Flip) then + if Flip_State then + Flip_State := False; + Set_Spacing (M, 3, 2, 0); + else + Flip_State := True; + Set_Spacing (M); + end if; + elsif To_Change (Reformat) then + case Current_Format is + when Four_By_1 => Set_Format (M, 4, 1); + when Four_By_2 => Set_Format (M, 4, 2); + when Four_By_3 => + declare + O : Menu_Option_Set; + begin + Get_Options (M, O); + O.Show_Descriptions := False; + Set_Options (M, O); + Set_Format (M, 4, 3); + end; + end case; + Set_Option_Key; + Set_Description_Key; + elsif To_Change (Reorder) then + declare + O : Menu_Option_Set; + begin + Get_Options (M, O); + O.Row_Major_Order := not O.Row_Major_Order; + Set_Options (M, O); + Set_Option_Key; + end; + elsif To_Change (Reselect) then + declare + O : Menu_Option_Set; + begin + Get_Options (M, O); + O.One_Valued := not O.One_Valued; + Set_Options (M, O); + Set_Select_Key; + end; + elsif To_Change (Describe) then + declare + O : Menu_Option_Set; + begin + Get_Options (M, O); + O.Show_Descriptions := not O.Show_Descriptions; + Set_Options (M, O); + Set_Description_Key; + end; + else + null; + end if; + end loop; + Set_Spacing (M); + Flip_State := True; + + Pop_Environment; + Delete (M); + + end Spacing_Test; + end Spacing_Demo; + + procedure Demo + is + -- We use this datatype only to test the instantiation of + -- the Menu_User_Data generic package. No functionality + -- behind it. + type User_Data is new Integer; + type User_Data_Access is access User_Data; + + -- Those packages are only instantiated to test the usability. + -- No real functionality is shown in the demo. + package MUD is new Menu_User_Data (User_Data, User_Data_Access); + package IUD is new Item_User_Data (User_Data, User_Data_Access); + + function My_Driver (M : Menu; + K : Key_Code; + P : Panel) return Boolean; + + package Mh is new Sample.Menu_Demo.Handler (My_Driver); + + Itm : constant Item_Array (1 .. 2) := + (New_Item ("Menu Layout Options"), + New_Item ("Demo of Hook functions")); + M : Menu := New_Menu (Itm); + + U1 : User_Data_Access := new User_Data'(4711); + U2 : User_Data_Access; + U3 : User_Data_Access := new User_Data'(4712); + U4 : User_Data_Access; + + function My_Driver (M : Menu; + K : Key_Code; + P : Panel) return Boolean + is + Idx : constant Positive := Get_Index (Current (M)); + begin + if K in User_Key_Code'Range then + if K = QUIT then + return True; + elsif K = SELECT_ITEM then + if Idx in Itm'Range then + Hide (P); + Update_Panels; + end if; + case Idx is + when 1 => Spacing_Demo.Spacing_Test; + when others => Not_Implemented; + end case; + if Idx in Itm'Range then + Top (P); + Show (P); + Update_Panels; + Update_Screen; + end if; + end if; + end if; + return False; + end My_Driver; + begin + Push_Environment ("MENU00"); + Notepad ("MENU-PAD00"); + Default_Labels; + Refresh_Soft_Label_Keys_Without_Update; + Set_Pad_Character (M, '|'); + + MUD.Set_User_Data (M, U1); + IUD.Set_User_Data (Itm (1), U3); + + Mh.Drive_Me (M); + + MUD.Get_User_Data (M, U2); + pragma Assert (U1 = U2 and U1.all = 4711); + + IUD.Get_User_Data (Itm (1), U4); + pragma Assert (U3 = U4 and U3.all = 4712); + + Pop_Environment; + Delete (M); + end Demo; + +end Sample.Menu_Demo; diff --git a/Ada95/samples/sample-menu_demo.ads b/Ada95/samples/sample-menu_demo.ads new file mode 100644 index 00000000..797ed2b1 --- /dev/null +++ b/Ada95/samples/sample-menu_demo.ads @@ -0,0 +1,31 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Menu_Demo -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +package Sample.Menu_Demo is + + procedure Demo; + +end Sample.Menu_Demo; diff --git a/Ada95/samples/sample-my_field_type.adb b/Ada95/samples/sample-my_field_type.adb new file mode 100644 index 00000000..5becee3d --- /dev/null +++ b/Ada95/samples/sample-my_field_type.adb @@ -0,0 +1,49 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.My_Field_Type -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms; + +-- This is a very simple user defined field type. It accepts only a +-- defined character as input into the field. +-- +package body Sample.My_Field_Type is + + -- That's simple. There are no field validity checks. + function F_Check (Fld : Field; Info : My_Access) return Boolean + is + begin + return True; + end F_Check; + + -- Check exactly against the specified character. + function C_Check (Ch : Character; Info : My_Access) return Boolean + is + C : constant Character := Info.Ch; + begin + return Ch = C; + end C_Check; + +end Sample.My_Field_Type; diff --git a/Ada95/samples/sample-my_field_type.ads b/Ada95/samples/sample-my_field_type.ads new file mode 100644 index 00000000..cf4d8f9f --- /dev/null +++ b/Ada95/samples/sample-my_field_type.ads @@ -0,0 +1,51 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.My_Field_Type -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.3 $ +------------------------------------------------------------------------------ +with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms; +with Terminal_Interface.Curses.Forms.Field_Types; + +-- This is a very simple user defined field type. It accepts only a +-- defined character as input into the field. +-- +package Sample.My_Field_Type is + + type My_Data is new Ada_Defined_Field_Type with + record + Ch : Character; + end record; + type My_Access is access My_Data; + +private + + function F_Check (Fld : Field; Info : My_Access) return Boolean; + function C_Check (Ch : Character; Info : My_Access) return Boolean; + + package One_Character_Only is new + Terminal_Interface.Curses.Forms.Field_Types + (My_Data, My_Access, F_Check, C_Check); + +end Sample.My_Field_Type; + diff --git a/Ada95/samples/sample-text_io_demo.adb b/Ada95/samples/sample-text_io_demo.adb new file mode 100644 index 00000000..d122801d --- /dev/null +++ b/Ada95/samples/sample-text_io_demo.adb @@ -0,0 +1,168 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Text_IO_Demo -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Ada.Numerics.Generic_Elementary_Functions; +with Ada.Numerics.Complex_Types; +use Ada.Numerics.Complex_Types; + +with Terminal_Interface.Curses; use Terminal_Interface.Curses; +with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; +with Terminal_Interface.Curses.Text_IO; +use Terminal_Interface.Curses.Text_IO; +with Terminal_Interface.Curses.Text_IO.Integer_IO; +with Terminal_Interface.Curses.Text_IO.Float_IO; +with Terminal_Interface.Curses.Text_IO.Enumeration_IO; +with Terminal_Interface.Curses.Text_IO.Complex_IO; +with Terminal_Interface.Curses.Text_IO.Fixed_IO; +with Terminal_Interface.Curses.Text_IO.Decimal_IO; +with Terminal_Interface.Curses.Text_IO.Modular_IO; + +with Sample.Manifest; use Sample.Manifest; +with Sample.Helpers; use Sample.Helpers; +with Sample.Function_Key_Setting; use Sample.Function_Key_Setting; +with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; +with Sample.Explanation; use Sample.Explanation; + +package body Sample.Text_IO_Demo is + + type Weekday is (Sunday, + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday); + + type Fix is delta 0.1 range 0.0 .. 4.0; + type Dec is delta 0.01 digits 5 range 0.0 .. 4.0; + type Md is mod 5; + + package Math is new + Ada.Numerics.Generic_Elementary_Functions (Float); + + package Int_IO is new + Terminal_Interface.Curses.Text_IO.Integer_IO (Integer); + use Int_IO; + + package Real_IO is new + Terminal_Interface.Curses.Text_IO.Float_IO (Float); + use Real_IO; + + package Enum_IO is new + Terminal_Interface.Curses.Text_IO.Enumeration_IO (Weekday); + use Enum_IO; + + package C_IO is new + Terminal_Interface.Curses.Text_IO.Complex_IO (Ada.Numerics.Complex_Types); + use C_IO; + + package F_IO is new + Terminal_Interface.Curses.Text_IO.Fixed_IO (Fix); + use F_IO; + + package D_IO is new + Terminal_Interface.Curses.Text_IO.Decimal_IO (Dec); + use D_IO; + + package M_IO is new + Terminal_Interface.Curses.Text_IO.Modular_IO (Md); + use M_IO; + + procedure Demo + is + W : Window; + P : Panel := Create (Standard_Window); + K : Real_Key_Code; + Im : Complex := (0.0, 1.0); + Fx : Fix := 3.14; + Dc : Dec := 2.72; + L : Md; + + begin + Push_Environment ("TEXTIO"); + Default_Labels; + Notepad ("TEXTIO-PAD00"); + + Set_Echo_Mode (FALSE); + Set_Raw_Mode; + Set_Meta_Mode; + Set_KeyPad_Mode; + W := Sub_Window (Standard_Window, Lines - 2, Columns - 2, 1, 1); + Box; + Refresh_Without_Update; + Set_Meta_Mode (W); + Set_KeyPad_Mode (W); + Immediate_Update_Mode (W, True); + + Set_Window (W); + + for I in 1 .. 10 loop + Put ("Square root of "); + Put (Item => I, Width => 5); + Put (" is "); + Put (Item => Math.Sqrt (Float (I)), Exp => 0, Aft => 7); + New_Line; + end loop; + + for W in Weekday loop + Put (Item => W); Put (' '); + end loop; + New_Line; + + L := Md'First; + for I in 1 .. 2 loop + for J in Md'Range loop + Put (L); Put (' '); + L := L + 1; + end loop; + end loop; + New_Line; + + Put (Im); New_Line; + Put (Fx); New_Line; + Put (Dc); New_Line; + + loop + K := Get_Key; + if K in Special_Key_Code'Range then + case K is + when QUIT_CODE => exit; + when HELP_CODE => Explain_Context; + when EXPLAIN_CODE => Explain ("TEXTIOKEYS"); + when others => null; + end case; + end if; + end loop; + + Set_Window (Null_Window); + Erase; Refresh_Without_Update; + Delete (P); + Delete (W); + + Pop_Environment; + end Demo; + +end Sample.Text_IO_Demo; diff --git a/Ada95/samples/sample-text_io_demo.ads b/Ada95/samples/sample-text_io_demo.ads new file mode 100644 index 00000000..557ce8a4 --- /dev/null +++ b/Ada95/samples/sample-text_io_demo.ads @@ -0,0 +1,31 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample.Text_IO_Demo -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +package Sample.Text_IO_Demo is + + procedure Demo; + +end Sample.Text_IO_Demo; diff --git a/Ada95/samples/sample.adb b/Ada95/samples/sample.adb new file mode 100644 index 00000000..8b3d55d5 --- /dev/null +++ b/Ada95/samples/sample.adb @@ -0,0 +1,204 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.5 $ +------------------------------------------------------------------------------ +with Text_IO; + +with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; +with Ada.Exceptions; use Ada.Exceptions; + +with Terminal_Interface.Curses; use Terminal_Interface.Curses; +with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; +with Terminal_Interface.Curses.Menus; use Terminal_Interface.Curses.Menus; +with Terminal_Interface.Curses.Menus.Menu_User_Data; +with Terminal_Interface.Curses.Menus.Item_User_Data; + +with Sample.Manifest; use Sample.Manifest; +with Sample.Helpers; use Sample.Helpers; +with Sample.Function_Key_Setting; use Sample.Function_Key_Setting; +with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; +with Sample.Header_Handler; use Sample.Header_Handler; +with Sample.Explanation; use Sample.Explanation; + +with Sample.Menu_Demo.Handler; +with Sample.Curses_Demo; +with Sample.Form_Demo; +with Sample.Menu_Demo; +with Sample.Text_IO_Demo; + +with GNAT.OS_Lib; + +package body Sample is + + type User_Data is + record + Data : Integer; + end record; + type User_Access is access User_Data; + + package Ud is new + Terminal_Interface.Curses.Menus.Menu_User_Data + (User_Data, User_Access); + + package Id is new + Terminal_Interface.Curses.Menus.Item_User_Data + (User_Data, User_Access); + + procedure Whow is + procedure Main_Menu; + procedure Main_Menu + is + function My_Driver (M : Menu; + K : Key_Code; + Pan : Panel) return Boolean; + + package Mh is new Sample.Menu_Demo.Handler (My_Driver); + + I : constant Item_Array (1 .. 4) := + (New_Item ("Curses Core Demo"), + New_Item ("Menu Demo"), + New_Item ("Form Demo"), + New_Item ("Text IO Demo")); + + M : Menu := New_Menu (I); + + D1, D2 : User_Access; + I1, I2 : User_Access; + + function My_Driver (M : Menu; + K : Key_Code; + Pan : Panel) return Boolean + is + Idx : constant Positive := Get_Index (Current (M)); + begin + if K in User_Key_Code'Range then + if K = QUIT then + return True; + elsif K = SELECT_ITEM then + if Idx in 1 .. 4 then + Hide (Pan); + Update_Panels; + end if; + case Idx is + when 1 => Sample.Curses_Demo.Demo; + when 2 => Sample.Menu_Demo.Demo; + when 3 => Sample.Form_Demo.Demo; + when 4 => Sample.Text_IO_Demo.Demo; + when others => null; + end case; + if Idx in 1 .. 4 then + Top (Pan); + Show (Pan); + Update_Panels; + Update_Screen; + end if; + end if; + end if; + return False; + end My_Driver; + + begin + + if Item_Count (M) /= I'Length then + raise Constraint_Error; + end if; + + D1 := new User_Data'(Data => 4711); + Ud.Set_User_Data (M, D1); + + I1 := new User_Data'(Data => 1174); + Id.Set_User_Data (I (1), I1); + + Set_Spacing (Men => M, Row => 2); + + Default_Labels; + Notepad ("MAINPAD"); + + Mh.Drive_Me (M, " Demo "); + + Ud.Get_User_Data (M, D2); + pragma Assert (D1 = D2); + pragma Assert (D1.Data = D2.Data); + + Id.Get_User_Data (I (1), I2); + pragma Assert (I1 = I2); + pragma Assert (I1.Data = I2.Data); + + Delete (M); + end Main_Menu; + + begin + Initialize (PC_Style_With_Index); + Init_Header_Handler; + Init_Screen; + + if Has_Colors then + Start_Color; + + Init_Pair (Pair => Default_Colors, Fore => Black, Back => White); + Init_Pair (Pair => Menu_Back_Color, Fore => Black, Back => Cyan); + Init_Pair (Pair => Menu_Fore_Color, Fore => Red, Back => Cyan); + Init_Pair (Pair => Menu_Grey_Color, Fore => White, Back => Cyan); + Init_Pair (Pair => Notepad_Color, Fore => Black, Back => Yellow); + Init_Pair (Pair => Help_Color, Fore => Blue, Back => Cyan); + Init_Pair (Pair => Form_Back_Color, Fore => Black, Back => Cyan); + Init_Pair (Pair => Form_Fore_Color, Fore => Red, Back => Cyan); + Init_Pair (Pair => Header_Color, Fore => Black, Back => Green); + + Set_Background (Ch => (Color => Default_Colors, + Attr => Normal_Video, + Ch => ' ')); + Set_Character_Attributes (Attr => Normal_Video, + Color => Default_Colors); + Erase; + + Set_Soft_Label_Key_Attributes (Color => Header_Color); + -- This propagates the attributes to the label window + Clear_Soft_Label_Keys; Restore_Soft_Label_Keys; + end if; + + Init_Keyboard_Handler; + + Set_Echo_Mode (FALSE); + Set_Raw_Mode; + Set_Meta_Mode; + Set_KeyPad_Mode; + + -- Initialize the Function Key Environment + -- We have some fixed key throughout this sample + Main_Menu; + End_Windows; + + exception + when Event : others => + Terminal_Interface.Curses.End_Windows; + Text_IO.Put ("Exception: "); + Text_IO.Put (Exception_Name (Event)); + Text_IO.New_Line; + GNAT.OS_Lib.OS_Exit (1); + + end Whow; + +end Sample; diff --git a/Ada95/samples/sample.ads b/Ada95/samples/sample.ads new file mode 100644 index 00000000..8a385d48 --- /dev/null +++ b/Ada95/samples/sample.ads @@ -0,0 +1,29 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Sample -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +package Sample is + procedure Whow; +end Sample; diff --git a/Ada95/samples/tour.adb b/Ada95/samples/tour.adb new file mode 100644 index 00000000..bbcdcd3a --- /dev/null +++ b/Ada95/samples/tour.adb @@ -0,0 +1,32 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- tour -- +-- -- +-- B O D Y -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +with Sample; use Sample; + +procedure Tour is +begin + Whow; +end Tour; diff --git a/Ada95/samples/tour.ads b/Ada95/samples/tour.ads new file mode 100644 index 00000000..9d8395c6 --- /dev/null +++ b/Ada95/samples/tour.ads @@ -0,0 +1,27 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT ncurses Binding Samples -- +-- -- +-- Tour -- +-- -- +-- S P E C -- +-- -- +-- Version 00.92 -- +-- -- +-- The ncurses Ada95 binding is copyrighted 1996 by -- +-- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de -- +-- -- +-- Permission is hereby granted to reproduce and distribute this -- +-- binding by any means and for any fee, whether alone or as part -- +-- of a larger distribution, in source or in binary form, PROVIDED -- +-- this notice is included with any such distribution, and is not -- +-- removed from any of its header files. Mention of ncurses and the -- +-- author of this binding in any applications linked with it is -- +-- highly appreciated. -- +-- -- +-- This binding comes AS IS with no warranty, implied or expressed. -- +------------------------------------------------------------------------------ +-- Version Control +-- $Revision: 1.2 $ +------------------------------------------------------------------------------ +procedure Tour; diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..0e6a92cb --- /dev/null +++ b/INSTALL @@ -0,0 +1,467 @@ +-- $Id: INSTALL,v 1.27 1997/04/26 23:48:19 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) + +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. + +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/read_termcap.c for details. + + 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 our recommended primary console names for the most important + freeware UNIX distributions: + + 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 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. + + 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 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 + +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 + ncurses@bsdi.com. To subscribe send mail to + ncurses-request@mailgate.bsdi.com with body that reads: + subscribe ncurses + + 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/MANIFEST b/MANIFEST new file mode 100644 index 00000000..bb5df407 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,581 @@ +./ANNOUNCE +./Ada95/Makefile.in +./Ada95/README +./Ada95/TODO +./Ada95/ada_include/Makefile.in +./Ada95/ada_include/terminal_interface-curses-aux.adb +./Ada95/ada_include/terminal_interface-curses-aux.ads +./Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.adb +./Ada95/ada_include/terminal_interface-curses-forms-choice_field_types.ads +./Ada95/ada_include/terminal_interface-curses-forms-field_types.adb +./Ada95/ada_include/terminal_interface-curses-forms-field_types.ads +./Ada95/ada_include/terminal_interface-curses-forms-field_user_data.adb +./Ada95/ada_include/terminal_interface-curses-forms-form_user_data.adb +./Ada95/ada_include/terminal_interface-curses-forms.adb +./Ada95/ada_include/terminal_interface-curses-menus-item_user_data.adb +./Ada95/ada_include/terminal_interface-curses-menus-menu_user_data.adb +./Ada95/ada_include/terminal_interface-curses-menus.adb +./Ada95/ada_include/terminal_interface-curses-mouse.adb +./Ada95/ada_include/terminal_interface-curses-panels-user_data.adb +./Ada95/ada_include/terminal_interface-curses-panels.adb +./Ada95/ada_include/terminal_interface-curses-text_io-aux.adb +./Ada95/ada_include/terminal_interface-curses-text_io-aux.ads +./Ada95/ada_include/terminal_interface-curses-text_io-complex_io.adb +./Ada95/ada_include/terminal_interface-curses-text_io-complex_io.ads +./Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.adb +./Ada95/ada_include/terminal_interface-curses-text_io-decimal_io.ads +./Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.adb +./Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.ads +./Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.adb +./Ada95/ada_include/terminal_interface-curses-text_io-fixed_io.ads +./Ada95/ada_include/terminal_interface-curses-text_io-float_io.adb +./Ada95/ada_include/terminal_interface-curses-text_io-float_io.ads +./Ada95/ada_include/terminal_interface-curses-text_io-integer_io.adb +./Ada95/ada_include/terminal_interface-curses-text_io-integer_io.ads +./Ada95/ada_include/terminal_interface-curses-text_io-modular_io.adb +./Ada95/ada_include/terminal_interface-curses-text_io-modular_io.ads +./Ada95/ada_include/terminal_interface-curses-text_io.adb +./Ada95/ada_include/terminal_interface-curses-text_io.ads +./Ada95/ada_include/terminal_interface-curses.adb +./Ada95/ada_include/terminal_interface.ads +./Ada95/gen/Makefile.in +./Ada95/gen/gen.c +./Ada95/gen/normal.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/Makefile +./Ada95/html/curs_addch.3x.html +./Ada95/html/curs_addchstr.3x.html +./Ada95/html/curs_addstr.3x.html +./Ada95/html/curs_attr.3x.html +./Ada95/html/curs_beep.3x.html +./Ada95/html/curs_bkgd.3x.html +./Ada95/html/curs_border.3x.html +./Ada95/html/curs_clear.3x.html +./Ada95/html/curs_color.3x.html +./Ada95/html/curs_delch.3x.html +./Ada95/html/curs_deleteln.3x.html +./Ada95/html/curs_getch.3x.html +./Ada95/html/curs_getstr.3x.html +./Ada95/html/curs_getyx.3x.html +./Ada95/html/curs_inch.3x.html +./Ada95/html/curs_inchstr.3x.html +./Ada95/html/curs_initscr.3x.html +./Ada95/html/curs_inopts.3x.html +./Ada95/html/curs_insch.3x.html +./Ada95/html/curs_insstr.3x.html +./Ada95/html/curs_instr.3x.html +./Ada95/html/curs_kernel.3x.html +./Ada95/html/curs_mouse.3x.html +./Ada95/html/curs_move.3x.html +./Ada95/html/curs_outopts.3x.html +./Ada95/html/curs_overlay.3x.html +./Ada95/html/curs_pad.3x.html +./Ada95/html/curs_print.3x.html +./Ada95/html/curs_printw.3x.html +./Ada95/html/curs_refresh.3x.html +./Ada95/html/curs_scanw.3x.html +./Ada95/html/curs_scr_dmp.3x.html +./Ada95/html/curs_scroll.3x.html +./Ada95/html/curs_slk.3x.html +./Ada95/html/curs_termattrs.3x.html +./Ada95/html/curs_termcap.3x.html +./Ada95/html/curs_terminfo.3x.html +./Ada95/html/curs_touch.3x.html +./Ada95/html/curs_util.3x.html +./Ada95/html/curs_window.3x.html +./Ada95/html/dft_fgbg.3x.html +./Ada95/html/form.3x.html +./Ada95/html/form_cursor.3x.html +./Ada95/html/form_data.3x.html +./Ada95/html/form_driver.3x.html +./Ada95/html/form_field.3x.html +./Ada95/html/form_field_attributes.3x.html +./Ada95/html/form_field_buffer.3x.html +./Ada95/html/form_field_info.3x.html +./Ada95/html/form_field_just.3x.html +./Ada95/html/form_field_new.3x.html +./Ada95/html/form_field_opts.3x.html +./Ada95/html/form_field_userptr.3x.html +./Ada95/html/form_field_validation.3x.html +./Ada95/html/form_fieldtype.3x.html +./Ada95/html/form_hook.3x.html +./Ada95/html/form_new.3x.html +./Ada95/html/form_new_page.3x.html +./Ada95/html/form_opts.3x.html +./Ada95/html/form_page.3x.html +./Ada95/html/form_post.3x.html +./Ada95/html/form_requestname.3x.html +./Ada95/html/form_userptr.3x.html +./Ada95/html/form_win.3x.html +./Ada95/html/index.html +./Ada95/html/menu.3x.html +./Ada95/html/menu_attribs.3x.html +./Ada95/html/menu_cursor.3x.html +./Ada95/html/menu_driver.3x.html +./Ada95/html/menu_format.3x.html +./Ada95/html/menu_hook.3x.html +./Ada95/html/menu_items.3x.html +./Ada95/html/menu_mark.3x.html +./Ada95/html/menu_new.3x.html +./Ada95/html/menu_opts.3x.html +./Ada95/html/menu_pattern.3x.html +./Ada95/html/menu_post.3x.html +./Ada95/html/menu_requestname.3x.html +./Ada95/html/menu_spacing.3x.html +./Ada95/html/menu_userptr.3x.html +./Ada95/html/menu_win.3x.html +./Ada95/html/mitem_current.3x.html +./Ada95/html/mitem_name.3x.html +./Ada95/html/mitem_new.3x.html +./Ada95/html/mitem_opts.3x.html +./Ada95/html/mitem_userptr.3x.html +./Ada95/html/mitem_value.3x.html +./Ada95/html/mitem_visible.3x.html +./Ada95/html/ncurses.3x.html +./Ada95/html/panel.3x.html +./Ada95/html/resizeterm.3x.html +./Ada95/html/table.html +./Ada95/html/terminal_interface-curses-forms-choice_field_types_s.html +./Ada95/html/terminal_interface-curses-forms-field_types_s.html +./Ada95/html/terminal_interface-curses-forms-field_user_data_s.html +./Ada95/html/terminal_interface-curses-forms-form_user_data_s.html +./Ada95/html/terminal_interface-curses-forms_s.html +./Ada95/html/terminal_interface-curses-menus-item_user_data_s.html +./Ada95/html/terminal_interface-curses-menus-menu_user_data_s.html +./Ada95/html/terminal_interface-curses-menus_s.html +./Ada95/html/terminal_interface-curses-mouse_s.html +./Ada95/html/terminal_interface-curses-panels-user_data_s.html +./Ada95/html/terminal_interface-curses-panels_s.html +./Ada95/html/terminal_interface-curses-text_io-complex_io_s.html +./Ada95/html/terminal_interface-curses-text_io-decimal_io_s.html +./Ada95/html/terminal_interface-curses-text_io-enumeration_io_s.html +./Ada95/html/terminal_interface-curses-text_io-fixed_io_s.html +./Ada95/html/terminal_interface-curses-text_io-float_io_s.html +./Ada95/html/terminal_interface-curses-text_io-integer_io_s.html +./Ada95/html/terminal_interface-curses-text_io-modular_io_s.html +./Ada95/html/terminal_interface-curses-text_io_s.html +./Ada95/html/terminal_interface-curses_s.html +./Ada95/html/terminal_interface_s.html +./Ada95/html/wresize.3x.html +./Ada95/samples/Makefile.in +./Ada95/samples/README +./Ada95/samples/explain.txt +./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/tour.adb +./Ada95/samples/tour.ads +./INSTALL +./MANIFEST +./Makefile.glibc +./Makefile.in +./NEWS +./README +./README.glibc +./TO-DO +./aclocal.m4 +./announce.html +./announce.html.in +./c++/Makefile.in +./c++/NEWS +./c++/PROBLEMS +./c++/README-first +./c++/cursesm.cc +./c++/cursesm.h +./c++/cursesp.cc +./c++/cursesp.h +./c++/cursesw.cc +./c++/cursesw.h +./c++/demo.cc +./c++/etip.h +./c++/internal.h +./c++/modules +./configure +./configure.in +./dist.mk +./form/Makefile.in +./form/READ.ME +./form/fld_def.c +./form/fld_stat.c +./form/fld_type.c +./form/fld_user.c +./form/form.h +./form/form.priv.h +./form/frm_adabind.c +./form/frm_data.c +./form/frm_def.c +./form/frm_driver.c +./form/frm_hook.c +./form/frm_opts.c +./form/frm_req_name.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/config_h.in +./include/curses.h.in +./include/edit_cfg.sh +./include/headers +./include/nc_alloc.h +./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_dmp.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/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/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_adabind.c +./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_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_post.c +./menu/m_req_name.c +./menu/m_spacing.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/hackguide.doc +./misc/hackguide.html +./misc/makellib +./misc/ncurses-intro.doc +./misc/ncurses-intro.html +./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.lsm +./ncurses/MKcaptab.awk +./ncurses/MKexpanded.sh +./ncurses/MKfallback.sh +./ncurses/MKkeyname.awk +./ncurses/MKkeys.awk +./ncurses/MKlib_gen.sh +./ncurses/MKnames.awk +./ncurses/MKunctrl.awk +./ncurses/Makefile.in +./ncurses/README +./ncurses/SigAction.h +./ncurses/alloc_entry.c +./ncurses/captoinfo.c +./ncurses/comp_error.c +./ncurses/comp_hash.c +./ncurses/comp_parse.c +./ncurses/comp_scan.c +./ncurses/curses.priv.h +./ncurses/hardscroll.c +./ncurses/hashmap.c +./ncurses/keys.list +./ncurses/lib_acs.c +./ncurses/lib_adabind.c +./ncurses/lib_addch.c +./ncurses/lib_addstr.c +./ncurses/lib_baudrate.c +./ncurses/lib_beep.c +./ncurses/lib_bkgd.c +./ncurses/lib_box.c +./ncurses/lib_clear.c +./ncurses/lib_clrbot.c +./ncurses/lib_clreol.c +./ncurses/lib_color.c +./ncurses/lib_data.c +./ncurses/lib_delch.c +./ncurses/lib_delwin.c +./ncurses/lib_dft_fgbg.c +./ncurses/lib_doupdate.c +./ncurses/lib_endwin.c +./ncurses/lib_erase.c +./ncurses/lib_freeall.c +./ncurses/lib_getch.c +./ncurses/lib_getstr.c +./ncurses/lib_inchstr.c +./ncurses/lib_initscr.c +./ncurses/lib_insch.c +./ncurses/lib_insdel.c +./ncurses/lib_insstr.c +./ncurses/lib_instr.c +./ncurses/lib_isendwin.c +./ncurses/lib_kernel.c +./ncurses/lib_longname.c +./ncurses/lib_mouse.c +./ncurses/lib_move.c +./ncurses/lib_mvcur.c +./ncurses/lib_mvwin.c +./ncurses/lib_newterm.c +./ncurses/lib_newwin.c +./ncurses/lib_options.c +./ncurses/lib_overlay.c +./ncurses/lib_pad.c +./ncurses/lib_print.c +./ncurses/lib_printw.c +./ncurses/lib_raw.c +./ncurses/lib_refresh.c +./ncurses/lib_restart.c +./ncurses/lib_scanw.c +./ncurses/lib_screen.c +./ncurses/lib_scroll.c +./ncurses/lib_scrreg.c +./ncurses/lib_set_term.c +./ncurses/lib_setup.c +./ncurses/lib_slk.c +./ncurses/lib_termcap.c +./ncurses/lib_ti.c +./ncurses/lib_touch.c +./ncurses/lib_tparm.c +./ncurses/lib_tputs.c +./ncurses/lib_trace.c +./ncurses/lib_traceatr.c +./ncurses/lib_tracechr.c +./ncurses/lib_tracedmp.c +./ncurses/lib_tracemse.c +./ncurses/lib_tstp.c +./ncurses/lib_twait.c +./ncurses/lib_vidattr.c +./ncurses/lib_window.c +./ncurses/llib-lncurses +./ncurses/modules +./ncurses/parse_entry.c +./ncurses/read_entry.c +./ncurses/read_termcap.c +./ncurses/resizeterm.c +./ncurses/sigaction.c +./ncurses/vsscanf.c +./ncurses/wresize.c +./ncurses/write_entry.c +./panel/Makefile.in +./panel/headers +./panel/llib-lpanel +./panel/modules +./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 +./sysdeps/unix/sysv/linux/Makefile +./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 +./test/Makefile.in +./test/README +./test/blue.c +./test/bs.6 +./test/bs.c +./test/configure.in +./test/firework.c +./test/gdc.6 +./test/gdc.c +./test/hanoi.c +./test/hashtest.c +./test/knight.c +./test/lrtest.c +./test/modules +./test/ncurses.c +./test/newdemo.c +./test/rain.c +./test/tclock.c +./test/test.priv.h +./test/testcurs.c +./test/tracemunch +./test/view.c +./test/worm.c +./test/xmas.c diff --git a/Makefile.glibc b/Makefile.glibc new file mode 100644 index 00000000..0767871b --- /dev/null +++ b/Makefile.glibc @@ -0,0 +1,224 @@ +# Copyright (C) 1997 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.1 +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_def fld_stat fld_type fld_user \ + frm_adabind frm_data frm_def \ + frm_driver frm_hook frm_opts \ + frm_req_name frm_user frm_win \ + fty_alnum fty_alpha fty_enum fty_int \ + fty_ipv4 fty_num fty_regex + +libncurses-routines = alloc_entry captoinfo comp_error comp_hash \ + comp_parse comp_scan hardscroll \ + hashmap lib_acs lib_adabind lib_addch \ + lib_addstr lib_baudrate \ + lib_beep lib_bkgd lib_box lib_clear \ + lib_clrbot lib_clreol lib_color \ + lib_data lib_delch lib_delwin \ + lib_dft_fgbg lib_doupdate lib_endwin \ + lib_erase lib_freeall lib_getch \ + lib_getstr lib_inchstr lib_initscr \ + lib_insch lib_insdel lib_insstr \ + lib_instr lib_isendwin lib_kernel \ + lib_longname lib_mouse lib_move \ + lib_mvcur lib_mvwin lib_newterm \ + lib_newwin lib_options lib_overlay \ + lib_pad lib_print lib_printw lib_raw \ + lib_refresh lib_restart lib_scanw \ + lib_screen lib_scroll lib_scrreg \ + lib_set_term lib_setup lib_slk \ + lib_termcap lib_ti lib_touch \ + lib_tparm lib_tputs lib_trace \ + lib_traceatr lib_tracechr \ + lib_tracedmp lib_tracemse lib_tstp \ + lib_twait lib_vidattr \ + lib_window names parse_entry \ + read_entry read_termcap resizeterm \ + wresize write_entry \ + codes comp_captab expanded fallback \ + lib_gen names lib_keyname unctrl + +libmenu-routines = m_adabind 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_use m_item_val m_item_vis \ + m_items m_new m_opts m_post \ + m_req_name m_spacing m_userptr m_win + +libpanel-routines = panel + +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) + +# mvcur won't compile +test-srcs = tctest thardscroll thashmap \ + blue bs firework gdc hanoi hashtest knight lrtest \ + ncurses newdemo rain tclock testcurs view worm xmas +mvcur-objs = mvcur.o dump_entry.o +tctest-objs = tctest.o +thardscroll-objs = thardscroll.o +thashmap-objs = thashmap.o hhardscroll.o + +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 -Incurses \ + -Imenu -Iprogs -Itest -I$(objpfx) + +$(objpfx)mvcur.o: ncurses/lib_mvcur.c + $(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -DTRACE -DMAIN $? + +$(objpfx)tctest.o: ncurses/captoinfo.c + $(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -DTRACE -DMAIN $? + +$(objpfx)thardscroll.o: ncurses/hardscroll.c + $(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -DTRACE -DSCROLLDEBUG $? + +$(objpfx)thashmap.o: ncurses/hashmap.c + $(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -DTRACE -DHASHDEBUG $? + +$(objpfx)hhardscroll.o: ncurses/hardscroll.c + $(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -DTRACE -DHASHDEBUG $? + +$(objpfx)mvcur: $(addprefix $(objpfx),$(mvcur-objs)) +$(objpfx)tctest: $(addprefix $(objpfx),$(tctest-objs)) +$(objpfx)thardscroll: $(addprefix $(objpfx),$(thardscroll-objs)) +$(objpfx)thashmap: $(addprefix $(objpfx),$(thashmap-objs)) + +$(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_libdir)/libtermcap.a $(inst_libdir)/libcurses.a: \ + $(inst_libdir)/libncurses.a + $(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/Makefile.in b/Makefile.in new file mode 100644 index 00000000..368d31f5 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,70 @@ +# $Id: Makefile.in,v 1.10 1997/03/22 00:57:42 tom Exp $ +################################################################################ +# Copyright 1996,1997 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Master Makefile for ncurses library. + +SHELL = /bin/sh + +INSTALL_PREFIX=@INSTALL_PREFIX@ +NC_MFLAGS = @nc_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@ + +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 '' + @ if test "$(includedir)" != "$(prefix)/include" ; then \ + echo '** Include-directory is not in a standard location'; fi + +# Put the common rules here so that we can easily construct the list of +# directories to visit. +all \ +clean \ +distclean \ +mostlyclean \ +realclean \ +install :: diff --git a/NEWS b/NEWS new file mode 100644 index 00000000..fff6125d --- /dev/null +++ b/NEWS @@ -0,0 +1,1503 @@ +This is a log of changes that ncurses has gone through since Zeyd +started working with Pavel Curtis' original work, pcurses, in 1992: + +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 ) + +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 + ) + +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 ). + +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 + ) + + 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 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 ) + +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 + ) + + 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 ) + + 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 ). + + 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 in configuration test for regex.h (patch by + Andreas Schwab) + + make infocmp recognize -I option, for SVr4 compatibility (reported by + Andreas Schwab ) + +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 + ) + + modify headers to accommodate compilers that don't allow duplicate + "#define" lines for NCURSES_VERSION (reported by Larry W. Virden + ) + + 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 + ) + + 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 ) + +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 'curscr', 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 ). 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 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 + ). + +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 ). + + 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 ) + + 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 + ). + + 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 ) + + 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 ). + + 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 ) + + 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 ) + +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 ) + + 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 ) + + 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 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 + ) + + 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 + + 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 , 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 in lib_termcap.c to ensure that the prototypes + are consistent (they weren't). +* corrected prototype of tputs in +* 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 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/README b/README new file mode 100644 index 00000000..8af7db77 --- /dev/null +++ b/README @@ -0,0 +1,170 @@ + 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.d, +where d.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', and `Ada95'. + +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_g.a (debug and trace code enabled) + + libmenu.a (normal) + libmenu_g.a (debug enabled) + + libform.a (normal) + 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 and panels library packaged as a C++ class, and a demo program in C++ +to test it. These class definition modules are not installed anywhere by +default; it's up to you what you do with them. + +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.05 or above). It is not installed automatically. +See the Ada95 directory for more build and installation instructions and +for documentation of the binding. + +In order 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 +--with-termcap option enabled, and the ncurses library can't 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. + tset -- terminal-initialization utility + toe -- table of entries utility + +The first two are used for manipulating terminfo descriptions; the next two +are for use in shell scripts. The last 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. + +The `test' directory contains programs that can be used to verify 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. + +RELATED RESOURCES: + +This distribution now includes (and uses) a copy of the master terminfo +database maintained by Eric Raymond. This database (which is the +official descendant of the 4.4BSD termcap file) changes faster than this +code does. + +You can surf to a WWW page that carries the current terminfo master file, +and news about ncurses, at + + http://www.ccil.org/~esr/ncurses.html + +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 extension and numerous bug fixes (more than half of those + enumerated in NEWS since release 1.9.2d) + +Eric S. Raymond: + the man pages, infocmp(1), tput(1), clear(1), captoinfo(1), tset(1), + toe(1), most of tic(1), src/lib_twait.c, 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 code, and the Ada95 binding. Ongoing support for + panel. + +CONTRIBUTORS: + +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. + +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/README.glibc b/README.glibc new file mode 100644 index 00000000..7d52269b --- /dev/null +++ b/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/TO-DO b/TO-DO new file mode 100644 index 00000000..8e4d6f27 --- /dev/null +++ b/TO-DO @@ -0,0 +1,254 @@ +SHORT-TERM TO-DO ITEMS: + +Known Problems: + +* 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. + +* Ncurses cursor movement does not make effective use of hard tabs, as SVr4 + does. + +* Scrolling optimization has holes: for example, the ncurses 'p' test, which + exercises scrolling in a pad does not (1996/12/24) use scrolling regions. + Also, running other tests shows that scrolling optimization forces repaints + of the screen between calls to refresh(). + +* The stacking order of windows on the screen does not match that implemented + in SVr4 (e.g., Solaris curses). XSI doesn't specify a stacking order, so + full compatibility for this behavior must be achieved by testing/analysis. + +* The ncurses 'o' test does not behave the same on SVr4 (Solaris) as with + ncurses (the latter pops windows up more). The former also produces 20% + fewer characters in a 'script' output. Further analysis is needed. + +* 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 (the + actual code that does this is in ncurses/lib_options.c:add_keytry(). + This is a legacy terminfo property we can't mess with. + +* Recognition of xterm mouse reports is implemented by setting the kmous + capability to the mouse-report prefix. As a result, the kmous sequence is + eaten even when mouse recognition is disabled. This could be fixed if + necessary with special code that pokes the kmous value back into the + input FIFO when KEY_MOUSE is seen and the mousemask is zero, but that would + be kind of ugly. + +* 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. + +* 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. + +* 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. + +Untested features: + +* The rep optimization in lib_doupdate.c is not yet thoroughly tested. + +* 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/aclocal.m4 b/aclocal.m4 new file mode 100644 index 00000000..efaa3949 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1219 @@ +dnl***************************************************************************** +dnl Copyright 1996,1997 by Thomas E. Dickey * +dnl All Rights Reserved. * +dnl * +dnl Permission to use, copy, modify, and distribute this software and its * +dnl documentation for any purpose and without fee is hereby granted, provided * +dnl that the above copyright notice appear in all copies and that both that * +dnl copyright notice and this permission notice appear in supporting * +dnl documentation, and that the name of the above listed copyright holder(s) * +dnl not be used in advertising or publicity pertaining to distribution of the * +dnl software without specific, written prior permission. THE ABOVE LISTED * +dnl COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * +dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * +dnl EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * +dnl SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * +dnl RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * +dnl CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * +dnl CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * +dnl***************************************************************************** +dnl $Id: aclocal.m4,v 1.60 1997/05/10 15:56:16 tom Exp $ +dnl Macros used in NCURSES auto-configuration script. +dnl +dnl --------------------------------------------------------------------------- +dnl Construct the list of include-options for the C programs in the Ada95 +dnl binding. +AC_DEFUN([NC_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 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([NC_BOOL_DECL], +[ +AC_MSG_CHECKING([for builtin c++ bool type]) +AC_CACHE_VAL(nc_cv_builtin_bool,[ + AC_TRY_COMPILE([],[bool x = false], + [nc_cv_builtin_bool=1], + [nc_cv_builtin_bool=0]) + ]) +if test $nc_cv_builtin_bool = 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([NC_BOOL_SIZE], +[ +AC_MSG_CHECKING([for size of c++ bool]) +AC_CACHE_VAL(nc_cv_type_of_bool,[ + rm -f nc_test.out + AC_TRY_RUN([ +#include +#include +#if HAVE_BUILTIN_H +#include +#endif +main() +{ + FILE *fp = fopen("nc_test.out", "w"); + if (fp != 0) { + bool x = false; + 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); +} + ], + [nc_cv_type_of_bool=`cat nc_test.out`], + [nc_cv_type_of_bool=unknown], + [nc_cv_type_of_bool=unknown]) + ]) + rm -f nc_test.out +AC_MSG_RESULT($nc_cv_type_of_bool) +if test $nc_cv_type_of_bool = unknown ; then + AC_MSG_WARN(Assuming unsigned for type of bool) + nc_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([NC_CFG_DEFAULTS], +[ +AC_MSG_CHECKING(for prefix) +if test "x$prefix" = "xNONE" ; then + case "$nc_cv_systype" in + # non-vendor systems don't have a conflict + NetBSD|FreeBSD|Linux) prefix=/usr + ;; + *) prefix=$ac_default_prefix + ;; + esac +fi +AC_MSG_RESULT($prefix) +AC_MSG_CHECKING(for default include-directory) +test -n "$verbose" && echo 1>&6 +for nc_symbol in \ + $includedir \ + $includedir/ncurses \ + $prefix/include \ + $prefix/include/ncurses \ + /usr/local/include \ + /usr/local/include/ncurses \ + /usr/include \ + /usr/include/ncurses +do + nc_dir=`eval echo $nc_symbol` + if test -f $nc_dir/curses.h ; then + if ( fgrep NCURSES_VERSION $nc_dir/curses.h 2>&1 >/dev/null ) ; then + includedir="$nc_symbol" + test -n "$verbose" && echo $ac_n " found " 1>&6 + break + fi + fi + test -n "$verbose" && echo " tested $nc_dir" 1>&6 +done +AC_MSG_RESULT($includedir) +])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([NC_CXX_LIBRARY], +[ +nc_cxx_library=unknown +if test $ac_cv_prog_gxx = yes; then + AC_MSG_CHECKING([for libg++]) + nc_save="$LIBS" + LIBS="$LIBS -lg++ -lm" + AC_TRY_LINK([ +#include + ], + [float foo=abs(1.0)], + [nc_cxx_library=yes + CXXLIBS="$CXXLIBS -lg++ -lm"], + [nc_cxx_library=no]) + LIBS="$nc_save" + AC_MSG_RESULT($nc_cxx_library) +fi +])dnl +dnl --------------------------------------------------------------------------- +AC_DEFUN([NC_DIRS_TO_MAKE], +[ +DIRS_TO_MAKE="lib" +for nc_item in $nc_list_models +do + NC_OBJ_SUBDIR($nc_item,nc_subdir) + DIRS_TO_MAKE="$DIRS_TO_MAKE $nc_subdir" +done +for nc_dir in $DIRS_TO_MAKE +do + test ! -d $nc_dir && mkdir $nc_dir +done +AC_SUBST(DIRS_TO_MAKE) +])dnl +dnl --------------------------------------------------------------------------- +dnl +AC_DEFUN([NC_ERRNO], +[ +AC_MSG_CHECKING([for errno external decl]) +AC_CACHE_VAL(nc_cv_extern_errno,[ + AC_TRY_COMPILE([ +#include ], + [int x = errno], + [nc_cv_extern_errno=yes], + [nc_cv_extern_errno=no]) + ]) +AC_MSG_RESULT($nc_cv_extern_errno) +test $nc_cv_extern_errno = yes && AC_DEFINE(HAVE_EXTERN_ERRNO) +])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([NC_GCC_ATTRIBUTES], +[cat > conftest.i < conftest.$ac_ext <&AC_FD_CC + case $nc_attribute in + scanf|printf) + cat >conftest.h <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* + +])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 +AC_DEFUN([NC_GCC_WARNINGS], +[nc_warn_CFLAGS="" +if test -n "$GCC" +then + changequote(,)dnl + cat > conftest.$ac_ext <>)dnl +nc_cv_gnat_version=`$nc_ada_make -v 2>&1 | grep '[0-9].[0-9][0-9]*' |\ + sed -e 's/[^0-9 \.]//g' | $AWK '{print $<<1>>;}'` +case $nc_cv_gnat_version in + 3.0[5-9]|3.[1-9]*|[4-9].*) + ac_cv_prog_gnat_correct=yes + ;; + *) echo Unsupported GNAT version $nc_cv_gnat_version. Disabling Ada95 binding. + ac_cv_prog_gnat_correct=no + ;; +esac +changequote([, ])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([NC_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 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.so -> +dnl lib.so. -> +dnl lib.so.. +AC_DEFUN([NC_LIB_RULES], +[ +AC_REQUIRE([NC_SYSTYPE]) +AC_REQUIRE([NC_VERSION]) +for nc_dir in $SRC_SUBDIRS +do + if test -f $srcdir/$nc_dir/modules; then + + nc_libs_to_make= + for nc_item in $NC_LIST_MODELS + do + NC_LIB_SUFFIX($nc_item,nc_suffix) + nc_libs_to_make="$nc_libs_to_make ../lib/lib${nc_dir}${nc_suffix}" + done + + sed -e "s@\@LIBS_TO_MAKE\@@$nc_libs_to_make@" \ + $nc_dir/Makefile >$nc_dir/Makefile.out + mv $nc_dir/Makefile.out $nc_dir/Makefile + + $AWK -f $srcdir/mk-0th.awk \ + name=$nc_dir \ + $srcdir/$nc_dir/modules >>$nc_dir/Makefile + + for nc_item in $NC_LIST_MODELS + do + echo 'Appending rules for '$nc_item' model ('$nc_dir')' + NC_UPPERCASE($nc_item,NC_ITEM) + NC_LIB_SUFFIX($nc_item,nc_suffix) + NC_OBJ_SUBDIR($nc_item,nc_subdir) + + # These dependencies really are for development, not + # builds, but they are useful in porting, too. + nc_depend="../include/ncurses_cfg.h" + if test "$srcdir" = "."; then + nc_reldir="." + else + nc_reldir="\$(srcdir)" + fi + if test -f $srcdir/$nc_dir/$nc_dir.priv.h; then + nc_depend="$nc_depend $nc_reldir/$nc_dir.priv.h" + elif test -f $srcdir/$nc_dir/curses.priv.h; then + nc_depend="$nc_depend $nc_reldir/curses.priv.h" + fi + $AWK -f $srcdir/mk-1st.awk \ + name=$nc_dir \ + MODEL=$NC_ITEM \ + model=$nc_subdir \ + suffix=$nc_suffix \ + DoLinks=$nc_cv_do_symlinks \ + rmSoLocs=$nc_cv_rm_so_locs \ + overwrite=$WITH_OVERWRITE \ + depend="$nc_depend" \ + $srcdir/$nc_dir/modules >>$nc_dir/Makefile + test $nc_dir = ncurses && WITH_OVERWRITE=no + $AWK -f $srcdir/mk-2nd.awk \ + name=$nc_dir \ + MODEL=$NC_ITEM \ + model=$nc_subdir \ + srcdir=$srcdir \ + echo=$WITH_ECHO \ + $srcdir/$nc_dir/modules >>$nc_dir/Makefile + done + fi + + echo ' cd '$nc_dir'; $(MAKE) $(NC_MFLAGS) [$]@' >>Makefile +done + +for nc_dir in $SRC_SUBDIRS +do + if test -f $srcdir/$nc_dir/modules; then + echo >> Makefile + if test -f $srcdir/$nc_dir/headers; then +cat >> Makefile <> Makefile +fi +cat >> Makefile <> Makefile <> Makefile <headers.sh </<\$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 +NC_EOF + +chmod 0755 headers.sh + +for nc_dir in $SRC_SUBDIRS +do + if test -f $srcdir/$nc_dir/headers; then + cat >>$nc_dir/Makefile <>$nc_dir/Makefile + j=$i + done + echo " $j" >>$nc_dir/Makefile + for i in `cat $srcdir/$nc_dir/headers |fgrep -v "#"` + do + echo " @ ../headers.sh \$(INSTALL_DATA) \$(INSTALL_PREFIX)\$(includedir) \$(srcdir) $i" >>$nc_dir/Makefile + done + fi +done + +])dnl +dnl --------------------------------------------------------------------------- +dnl Compute the library-suffix from the given model name +AC_DEFUN([NC_LIB_SUFFIX], +[ + AC_REQUIRE([NC_SYSTYPE]) + AC_REQUIRE([NC_VERSION]) + case $1 in + normal) $2='.a' ;; + debug) $2='_g.a' ;; + profile) $2='_p.a' ;; + shared) + case $nc_cv_systype in + NetBSD|FreeBSD) + $2='.so.$(ABI_VERSION)' ;; + HP_UX) $2='.sl' ;; + *) $2='.so' ;; + esac + esac +])dnl +dnl --------------------------------------------------------------------------- +dnl Compute the string to append to -library from the given model name +AC_DEFUN([NC_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([NC_LINK_DATAONLY], +[ +AC_MSG_CHECKING([if data-only library module links]) +AC_CACHE_VAL(nc_cv_link_dataonly,[ + rm -f conftest.a + changequote(,)dnl + cat >conftest.$ac_ext <&5 1>/dev/null + fi + rm -f conftest.$ac_ext data.o + changequote(,)dnl + cat >conftest.$ac_ext <&5 1>/dev/null + fi + rm -f conftest.$ac_ext func.o + ( eval $ac_cv_prog_RANLIB conftest.a ) 2>&5 >/dev/null + nc_saveLIBS="$LIBS" + LIBS="conftest.a $LIBS" + AC_TRY_RUN([ + int main() + { + extern int testfunc(); + exit (!testfunc()); + } + ], + [nc_cv_link_dataonly=yes], + [nc_cv_link_dataonly=no], + [nc_cv_link_dataonly=unknown]) + LIBS="$nc_saveLIBS" + ]) +AC_MSG_RESULT($nc_cv_link_dataonly) +test $nc_cv_link_dataonly = no && AC_DEFINE(BROKEN_LINKER) +])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 :-) +AC_DEFUN([NC_MAKEFLAGS], +[ +AC_MSG_CHECKING([for makeflags variable]) +AC_CACHE_VAL(nc_cv_makeflags,[ + nc_cv_makeflags='' + for nc_option in '$(MFLAGS)' '-$(MAKEFLAGS)' + do + cat >ncurses.tmp </dev/null` + if test "$nc_result" != "." + then + nc_cv_makeflags=$nc_option + break + fi + done + rm -f ncurses.tmp + ]) +AC_MSG_RESULT($nc_cv_makeflags) +AC_SUBST(nc_cv_makeflags) +])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([NC_MAN_PAGES], +[AC_MSG_CHECKING(format of man-pages) + 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}:" + nc_form=unknown + for nc_dir in $MANPATH; do + test -z "$nc_dir" && nc_dir=/usr/man + nc_rename="" + nc_format=no +changequote({{,}})dnl + for nc_name in $nc_dir/*/date.[01]* $nc_dir/*/date +changequote([,])dnl + do + nc_test=`echo $nc_name | sed -e 's/*//'` + if test "x$nc_test" = "x$nc_name" ; then + case "$nc_name" in + *.gz) nc_form=gzip; nc_name=`basename $nc_name .gz`;; + *.Z) nc_form=compress; nc_name=`basename $nc_name .Z`;; + *.0) nc_form=BSDI; nc_format=yes;; + *) nc_form=cat;; + esac + break + fi + done + if test "$nc_form" != "unknown" ; then + break + fi + done + IFS="$ac_save_ifs" + if test "$prefix" = "NONE" ; then + nc_prefix="$ac_default_prefix" + else + nc_prefix="$prefix" + fi + + # Debian 'man' program? + test -f /etc/debian_version && \ + nc_rename=`cd $srcdir;pwd`/man/man_db.renames + + test ! -d man && mkdir man + + # Construct a sed-script to perform renaming within man-pages + if test -n "$nc_rename" ; then + fgrep -v \# $nc_rename | \ + sed -e 's/^/s\//' \ + -e 's/\./\\./' \ + -e 's/ / /g' \ + -e 's/[ ]\+/\//' \ + -e s/\$/\\\/g/ >man/edit_man.sed + fi + if test $nc_format = yes ; then + nc_subdir='$mandir/cat' + else + nc_subdir='$mandir/man' + fi + +cat >man/edit_man.sh <>man/edit_man.sh <\$TMP +NC_EOF +else +cat >>man/edit_man.sh <\$TMP +NC_EOF +fi +if test $nc_format = yes ; then +cat >>man/edit_man.sh <\$TMP.out + mv \$TMP.out \$TMP +NC_EOF +fi +case "$nc_form" in +compress) +cat >>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh < +#include ],[ + regex_t *p; + int x = regcomp(p, "", 0); + int y = regexec(p, "", 0, 0, 0); + regfree(p); + ],[nc_cv_regex="regex.h"],[ + AC_TRY_LINK([#include ],[ + char *p = compile("", "", "", 0); + int x = step("", ""); + ],[nc_cv_regex="regexp.h"],[ + AC_TRY_LINK([#include ],[ + char *p = compile("", "", ""); + int x = step("", ""); + ],[nc_cv_regex="regexpr.h"])])]) +]) +AC_MSG_RESULT($nc_cv_regex) +case $nc_cv_regex in + regex.h) AC_DEFINE(HAVE_REGEX_H) ;; + regexp.h) AC_DEFINE(HAVE_REGEXP_H) ;; + regexpr.h) AC_DEFINE(HAVE_REGEXPR_H) ;; +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 'nc_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 Some loaders leave 'so_locations' lying around. It's nice to clean up. +AC_DEFUN([NC_SHARED_OPTS], +[ + AC_REQUIRE([NC_SYSTYPE]) + AC_REQUIRE([NC_VERSION]) + LOCAL_LDFLAGS= + LOCAL_LDFLAGS2= + + nc_cv_do_symlinks=no + nc_cv_rm_so_locs=no + + case $nc_cv_systype in + HP_UX) + # (tested with gcc 2.7.2 -- I don't have c89) + if test "${CC}" = "gcc"; then + CC_SHARED_OPTS='-fPIC' + else + CC_SHARED_OPTS='+Z' + fi + MK_SHARED_LIB='$(LD) -b -o $[@]' + ;; + IRIX*) + # tested with IRIX 5.2 and 'cc'. + if test "${CC}" = "gcc"; then + CC_SHARED_OPTS='-fPIC' + else + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $[@]` -o $[@]' + nc_cv_rm_so_locs=yes + ;; + Linux) + # tested with Linux 1.2.8 and gcc 2.7.0 (ELF) + CC_SHARED_OPTS='-fPIC' + MK_SHARED_LIB='gcc -o $[@].$(REL_VERSION) -shared -Wl,-soname,`basename $[@].$(ABI_VERSION)`,-stats' + if test $DFT_LWR_MODEL = "shared" ; then + LOCAL_LDFLAGS='-Wl,-rpath,../lib' + LOCAL_LDFLAGS2='-Wl,-rpath,../../lib' + fi + nc_cv_do_symlinks=yes + ;; + NetBSD|FreeBSD) + CC_SHARED_OPTS='-fpic -DPIC' + MK_SHARED_LIB='$(LD) -Bshareable -o $[@]' + ;; + OSF1|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) -o $[@].$(REL_VERSION) -shared -soname `basename $[@].$(ABI_VERSION)`' + if test $DFT_LWR_MODEL = "shared" ; then + LOCAL_LDFLAGS='-Wl,-rpath,../lib' + LOCAL_LDFLAGS2='-Wl,-rpath,../../lib' + fi + nc_cv_do_symlinks=yes + nc_cv_rm_so_locs=yes + ;; + SunOS) + # tested with SunOS 4.1.1 and gcc 2.7.0 + # tested with SunOS 5.3 (solaris 2.3) and gcc 2.7.0 + if test $ac_cv_prog_gcc = yes; then + CC_SHARED_OPTS='-fpic' + else + CC_SHARED_OPTS='-KPIC' + fi + case `uname -r` in + 4.*) + MK_SHARED_LIB='$(LD) -assert pure-text -o $[@].$(REL_VERSION)' + ;; + 5.*) + MK_SHARED_LIB='$(LD) -d y -G -h `basename $[@].$(ABI_VERSION)` -o $[@].$(REL_VERSION)' + ;; + esac + nc_cv_do_symlinks=yes + ;; + 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 + AC_SUBST(CC_SHARED_OPTS) + AC_SUBST(MK_SHARED_LIB) + AC_SUBST(LOCAL_LDFLAGS) + AC_SUBST(LOCAL_LDFLAGS2) +])dnl +dnl --------------------------------------------------------------------------- +dnl Check for datatype 'speed_t', which is normally declared via either +dnl sys/types.h or termios.h +AC_DEFUN([NC_SPEED_TYPE], +[ +AC_MSG_CHECKING([for speed_t]) +AC_CACHE_VAL(nc_cv_type_speed_t,[ + AC_TRY_COMPILE([ +#include +#if HAVE_TERMIOS_H +#include +#endif], + [speed_t x = 0], + [nc_cv_type_speed_t=yes], + [nc_cv_type_speed_t=no]) + ]) +AC_MSG_RESULT($nc_cv_type_speed_t) +test $nc_cv_type_speed_t != yes && AC_DEFINE(speed_t,unsigned) +])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 $nc_cv_src_modules which we'll +dnl use in NC_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([NC_SRC_MODULES], +[ +AC_MSG_CHECKING(for src modules) +TEST_DEPS="${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX}" +TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX}" +nc_cv_src_modules= +for nc_dir in $1 +do + if test -f $srcdir/$nc_dir/modules; then + if test -z "$nc_cv_src_modules"; then + nc_cv_src_modules=$nc_dir + else + nc_cv_src_modules="$nc_cv_src_modules $nc_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 -f $srcdir/${nc_dir}/${nc_dir}.h; then + NC_UPPERCASE($nc_dir,nc_have_include) + AC_DEFINE_UNQUOTED(HAVE_${nc_have_include}_H) + AC_DEFINE_UNQUOTED(HAVE_LIB${nc_have_include}) + TEST_DEPS="${LIB_PREFIX}${nc_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" + TEST_ARGS="-l${nc_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" + fi + fi +done +AC_MSG_RESULT($nc_cv_src_modules) +TEST_ARGS="-L${LIB_DIR} $TEST_ARGS" +AC_SUBST(TEST_DEPS) +AC_SUBST(TEST_ARGS) + +SRC_SUBDIRS="man include" +for nc_dir in $nc_cv_src_modules +do + SRC_SUBDIRS="$SRC_SUBDIRS $nc_dir" +done +SRC_SUBDIRS="$SRC_SUBDIRS misc test" +test $nc_cxx_library != no && SRC_SUBDIRS="$SRC_SUBDIRS c++" + +ADA_SUBDIRS= +if test "$ac_cv_prog_gnat_correct" = yes && test -d $srcdir/Ada95; then + SRC_SUBDIRS="$SRC_SUBDIRS Ada95" + ADA_SUBDIRS="gen ada_include samples" +fi + +SUB_MAKEFILES= +for nc_dir in $SRC_SUBDIRS +do + SUB_MAKEFILES="$SUB_MAKEFILES $nc_dir/Makefile" +done + +if test -n "$ADA_SUBDIRS"; then + for nc_dir in $ADA_SUBDIRS + do + SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$nc_dir/Makefile" + done + AC_SUBST(ADA_SUBDIRS) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Remove "-g" option from the compiler options +AC_DEFUN([NC_STRIP_G_OPT], +[$1=`echo ${$1} | sed -e 's/-g //' -e 's/-g$//'`])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([NC_SUBST], +[AC_CACHE_VAL(nc_cv_subst_$2,[ +AC_MSG_CHECKING(for $1 (symbol $2)) +test -z "[$]$2" && $2=$3 +AC_MSG_RESULT([$]$2) +AC_SUBST($2) +nc_cv_subst_$2=[$]$2]) +$2=${nc_cv_subst_$2} +])dnl +dnl --------------------------------------------------------------------------- +dnl Check for declarion of sys_errlist in one of stdio.h and errno.h. +dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration. +dnl Reported by Keith Bostic. +AC_DEFUN([NC_SYS_ERRLIST], +[ +AC_MSG_CHECKING([declaration of sys_errlist]) +AC_CACHE_VAL(nc_cv_dcl_sys_errlist,[ + AC_TRY_COMPILE([ +#include +#include +#include ], + [ char *c = (char *) *sys_errlist; ], + [nc_cv_dcl_sys_errlist=yes], + [nc_cv_dcl_sys_errlist=no]) + ]) +AC_MSG_RESULT($nc_cv_dcl_sys_errlist) +test $nc_cv_dcl_sys_errlist = yes && AC_DEFINE(HAVE_EXTERN_SYS_ERRLIST) +])dnl +dnl --------------------------------------------------------------------------- +dnl Derive the system-type (our main clue to the method of building shared +dnl libraries). +AC_DEFUN([NC_SYSTYPE], +[ +AC_CACHE_VAL(nc_cv_systype,[ +changequote(,)dnl +nc_cv_systype="`(uname -s || hostname || echo unknown) 2>/dev/null |sed -e s'/[:\/.-]/_/'g | sed 1q`" +changequote([,])dnl +if test -z "$nc_cv_systype"; then nc_cv_systype=unknown;fi +]) +AC_MSG_RESULT(System type is $nc_cv_systype) +])dnl +dnl --------------------------------------------------------------------------- +dnl On some systems ioctl(fd, TIOCGWINSZ, &size) will always return {0,0} until +dnl ioctl(fd, TIOCSWINSZ, &size) is called to explicitly set the size of the +dnl screen. +dnl +dnl Attempt to determine if we're on such a system by running a test-program. +dnl This won't work, of course, if the configure script is run in batch mode, +dnl since we've got to have access to the terminal. +dnl +dnl 1996/4/26 - Converted this into a simple test for able-to-compile, since +dnl we're reminded that _nc_get_screensize() does the same functional test. +AC_DEFUN([NC_TIOCGWINSZ], +[ +AC_MSG_CHECKING([for working TIOCGWINSZ]) +AC_CACHE_VAL(nc_cv_use_tiocgwinsz,[ + AC_TRY_RUN([ +#if HAVE_TERMIOS_H +#include +#endif +#if SYSTEM_LOOKS_LIKE_SCO +/* they neglected to define struct winsize in termios.h -- it's only + in termio.h */ +#include +#include +#endif +#if !defined(sun) || !defined(HAVE_TERMIOS_H) +#include +#endif +int main() +{ + static struct winsize size; + int fd; + for (fd = 0; fd <= 2; fd++) { /* try in/out/err in case redirected */ + if (ioctl(0, TIOCGWINSZ, &size) == 0 + && size.ws_row > 0 + && size.ws_col > 0) + exit(0); + } + exit(0); /* in either case, it compiles & links ... */ +} + ], + [nc_cv_use_tiocgwinsz=yes], + [nc_cv_use_tiocgwinsz=no], + [nc_cv_use_tiocgwinsz=unknown]) + ]) +AC_MSG_RESULT($nc_cv_use_tiocgwinsz) +test $nc_cv_use_tiocgwinsz != yes && AC_DEFINE(BROKEN_TIOCGWINSZ) +])dnl +dnl --------------------------------------------------------------------------- +dnl +AC_DEFUN([NC_TYPE_SIGACTION], +[ +AC_MSG_CHECKING([for type sigaction_t]) +AC_CACHE_VAL(nc_cv_type_sigaction,[ + AC_TRY_COMPILE([ +#include ], + [sigaction_t x], + [nc_cv_type_sigaction=yes], + [nc_cv_type_sigaction=no]) + ]) +AC_MSG_RESULT($nc_cv_type_sigaction) +test $nc_cv_type_sigaction = yes && AC_DEFINE(HAVE_TYPE_SIGACTION) +]) +dnl --------------------------------------------------------------------------- +dnl Make an uppercase version of a given name +AC_DEFUN([NC_UPPERCASE], +[ +changequote(,)dnl +$2=`echo $1 |tr '[a-z]' '[A-Z]'` +changequote([,])dnl +])dnl +dnl --------------------------------------------------------------------------- +dnl Get the version-number for use in shared-library naming, etc. +AC_DEFUN([NC_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 +nc_cv_abi_version=${NCURSES_MAJOR} +nc_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} +dnl Show the computed version, for logging +AC_MSG_RESULT(Configuring NCURSES $nc_cv_rel_version ABI $nc_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(nc_cv_rel_version) +AC_SUBST(nc_cv_abi_version) +AC_SUBST(nc_cv_builtin_bool) +AC_SUBST(nc_cv_type_of_bool) +])dnl diff --git a/announce.html b/announce.html new file mode 100644 index 00000000..27026006 --- /dev/null +++ b/announce.html @@ -0,0 +1,258 @@ + + + + +Announcing ncurses 4.1 + + + + +

Announcing ncurses 4.1

+ +The ncurses (new curses) library is a freeware emulation of System V +Release 4.0 curses. 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 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: +ftp://ftp.clark.net/pub/dickey/ncurses. +and +ftp://ftp.netcom.com/pub/zm/zmbenhal/ncurses. +It is also carried on the GNU distribution site at ftp://prep.ai.mit.edu/pub/gnu. + +

Features of ncurses

+ +The ncurses package is fully compatible with SVr4 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 System V Release 4 panels library, supporting +a stack of windows with backing store, is included.

    + +

  • An emulation of the System V Release 4 menus library, supporting +a uniform but flexible interface for menu programming, is included.

    + +

  • An emulation of the System V Release 4 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.

    + +

  • (PC-clone boxes only) Support for access to the IBM PC ROM characters +0-32 through the highlight A_ALTCHARSET.

    + +

  • Support for mouse event reporting under xterm.

    + +

  • The function wresize() allows you to resize windows, preserving +their data. + +
  • 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:

+

+
ded +
directory-editor +ftp://ftp.clark.net/pub/dickey/ded. +
dialog +
the underlying application used in Slackware's setup, and the basis +for similar applications on Linux. +
lynx-2.7 +
the character-screen WWW browser +
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 (unofficial) newsreader, supporting color, MIME +ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff. +
vile +
vi-like-emacs +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 maintainer of ncurses is Zeyd Ben-Halim. Unfortunately, +he can only work on the package part time. As a result, since 1.8.1, +much of the enhancement work and documentation has been done +by Eric S. Raymond. +The current primary maintainers are +Thomas Dickey +and +Juergen Pfeifer. +

+ +There is an ncurses mailing list. It is a majordomo list; to join, write +to ncurses-request@mailgate.bsdi.com with a message 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 +ftp://ftp.clark.net/pub/dickey/ncurses. + +

Future Plans

+
    +
  • Extended mouse support via Alessandro Rubini's gpm package. +
  • 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. + +

The terminfo/termcap Database

+ +The distribution includes and uses a copy of the terminfo-format +terminal description file maintained by Eric Raymond. + +You can download either the +termcap +or +terminfo +versions of the terminal-type +database from Eric's ncurses page, +http://www.ccil.org/~esr/ncurses.html.

+ +

Other Related Resources

+ +You can find lots of information on terminal-related topics +not covered in the terminfo file at +Richard Shuford's +archive. + + + diff --git a/announce.html.in b/announce.html.in new file mode 100644 index 00000000..a4c643b1 --- /dev/null +++ b/announce.html.in @@ -0,0 +1,258 @@ + + + + +Announcing ncurses @VERSION@ + + + + +

Announcing ncurses @VERSION@

+ +The ncurses (new curses) library is a freeware emulation of System V +Release 4.0 curses. 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 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: +ftp://ftp.clark.net/pub/dickey/ncurses. +and +ftp://ftp.netcom.com/pub/zm/zmbenhal/ncurses. +It is also carried on the GNU distribution site at ftp://prep.ai.mit.edu/pub/gnu. + +

Features of ncurses

+ +The ncurses package is fully compatible with SVr4 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 System V Release 4 panels library, supporting +a stack of windows with backing store, is included.

    + +

  • An emulation of the System V Release 4 menus library, supporting +a uniform but flexible interface for menu programming, is included.

    + +

  • An emulation of the System V Release 4 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.

    + +

  • (PC-clone boxes only) Support for access to the IBM PC ROM characters +0-32 through the highlight A_ALTCHARSET.

    + +

  • Support for mouse event reporting under xterm.

    + +

  • The function wresize() allows you to resize windows, preserving +their data. + +
  • 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:

+

+
ded +
directory-editor +ftp://ftp.clark.net/pub/dickey/ded. +
dialog +
the underlying application used in Slackware's setup, and the basis +for similar applications on Linux. +
lynx-2.7 +
the character-screen WWW browser +
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 (unofficial) newsreader, supporting color, MIME +ftp://ftp.akk.uni-karlsruhe.de/pub/news/clients/tin-unoff. +
vile +
vi-like-emacs +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 maintainer of ncurses is Zeyd Ben-Halim. Unfortunately, +he can only work on the package part time. As a result, since 1.8.1, +much of the enhancement work and documentation has been done +by Eric S. Raymond. +The current primary maintainers are +Thomas Dickey +and +Juergen Pfeifer. +

+ +There is an ncurses mailing list. It is a majordomo list; to join, write +to ncurses-request@mailgate.bsdi.com with a message 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 +ftp://ftp.clark.net/pub/dickey/ncurses. + +

Future Plans

+
    +
  • Extended mouse support via Alessandro Rubini's gpm package. +
  • 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. + +

The terminfo/termcap Database

+ +The distribution includes and uses a copy of the terminfo-format +terminal description file maintained by Eric Raymond. + +You can download either the +termcap +or +terminfo +versions of the terminal-type +database from Eric's ncurses page, +http://www.ccil.org/~esr/ncurses.html.

+ +

Other Related Resources

+ +You can find lots of information on terminal-related topics +not covered in the terminfo file at +Richard Shuford's +archive. + + + diff --git a/c++/Makefile.in b/c++/Makefile.in new file mode 100644 index 00000000..6be83aeb --- /dev/null +++ b/c++/Makefile.in @@ -0,0 +1,88 @@ +# $Id: Makefile.in,v 1.20 1997/05/04 21:15:38 tom Exp $ +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# 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@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ + +CXX = @CXX@ +CXXFLAGS = @CXXFLAGS@ +CXXLIBS = @CXXLIBS@ + +INCDIR = ../include +CPPFLAGS = @CPPFLAGS@ -I$(INCDIR) -I$(srcdir)/../c++ -DHAVE_CONFIG_H + +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@) + +LINK = $(CXX) +LDFLAGS = -L../lib \ + -lmenu@DFT_ARG_SUFFIX@ \ + -lpanel@DFT_ARG_SUFFIX@ \ + -lncurses@DFT_ARG_SUFFIX@ \ + @LDFLAGS@ \ + @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ @LOCAL_LDFLAGS@ $(CXXLIBS) + +all: demo + +OBJS_DEMO = \ + $(MODEL)/cursesm.o \ + $(MODEL)/cursesw.o \ + $(MODEL)/cursesp.o \ + $(MODEL)/demo.o + +demo: $(OBJS_DEMO) \ + ../lib/libmenu@DFT_DEP_SUFFIX@ \ + ../lib/libpanel@DFT_DEP_SUFFIX@ \ + ../lib/libncurses@DFT_DEP_SUFFIX@ + @ECHO_LINK@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS) + +install: +install.libs: + +clean :: + -rm -f core demo $(OBJS_DEMO) + +distclean :: clean + -rm -f Makefile + +mostlyclean :: clean + +realclean :: distclean + +############################################################################### +# The remainder of this file is automatically generated during configuration +############################################################################### diff --git a/c++/NEWS b/c++/NEWS new file mode 100644 index 00000000..525fa728 --- /dev/null +++ b/c++/NEWS @@ -0,0 +1,17 @@ +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. + +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/c++/PROBLEMS b/c++/PROBLEMS new file mode 100644 index 00000000..709846be --- /dev/null +++ b/c++/PROBLEMS @@ -0,0 +1,8 @@ +This is a list of open problems. This mainly lists known missing pieces +and design flaws. + +1. Missing binding to libform + + + + diff --git a/c++/README-first b/c++/README-first new file mode 100644 index 00000000..b0c38fad --- /dev/null +++ b/c++/README-first @@ -0,0 +1,57 @@ + C++ interface to ncurses routines +----------------------------------------------------------------------- + +This directory contains the source code for three 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, which is provided by a derived +class. The implementation chosen here is directed to unrestricted use +of mixes of color and monochrome windows. This is done through virtual +functions and means that you can write all of your code as if a color +window is the destination. If the destination window is monochrome these +functions calls have no effect. + + NOTE: This implementation of the color support was topic of + some discussion. The introduction of virtual functions + introduced some overhead. Please let us know what you think + about this: is it worth being able to write color supporting + functions. + +The last point to mention is the support of another package Zeyd +distributes with his ncurses package: the panels library. This support +is provided by the NCursesPanel class, which is also derived from the +NCursesWindow class. 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 for FSF's libg++ + +Authors of this release: + Ulrich Drepper + and Anatoly Ivasyuk diff --git a/c++/cursesm.cc b/c++/cursesm.cc new file mode 100644 index 00000000..8d77d19c --- /dev/null +++ b/c++/cursesm.cc @@ -0,0 +1,314 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/*-----------------------------------------------------------------------------+ +| The ncurses menu C++ binding is Copyright (C) 1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#include "internal.h" + +MODULE_ID("$Id: cursesm.cc,v 1.4 1997/05/05 20:27:32 tom Exp $") + +#pragma implementation + +#include "cursesm.h" + +const int CMD_ACTION = MAX_COMMAND + 1; +const int CMD_QUIT = MAX_COMMAND + 2; + +unsigned long NCursesMenu::total_count = 0; + +/* 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::setItems(NCursesMenuItem* nitems[]) +{ + OnError(::set_menu_items(menu,mapItems(nitems))); +} + +void +NCursesMenu::InitMenu(NCursesMenuItem* nitems[], + bool with_frame) { + int mrows, mcols; + + if (total_count++==0) { + raw(); + keypad(TRUE); + } + + b_framed = with_frame; + + 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,(const 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() { + if (NumberOfColors() > 1) { + setcolor(1); + setpalette(COLOR_YELLOW,COLOR_BLUE); + setcolor(2); + setpalette(COLOR_CYAN,COLOR_BLUE); + setcolor(3); + setpalette(COLOR_WHITE,COLOR_CYAN); + ::set_menu_fore(menu, COLOR_PAIR(1)); + ::set_menu_back(menu, COLOR_PAIR(2)); + ::set_menu_grey(menu, COLOR_PAIR(3)); + } + else { + ::set_menu_fore(menu, A_BOLD); + ::set_menu_back(menu, A_NORMAL); + ::set_menu_grey(menu, A_DIM); + } +} + + +NCursesMenu::NCursesMenu(NCursesMenuItem* menu[]) + : NCursesPanel() { + InitMenu(menu); +} + +NCursesMenu::NCursesMenu(NCursesMenuItem* menu[], + int lines, + int cols, + int begin_y, + int begin_x, + bool with_frame) + : NCursesPanel(lines, cols, begin_y, begin_x) { + InitMenu(menu,with_frame); +} + +NCursesMenu::~NCursesMenu() { + UserHook* hook = (UserHook*)::menu_userptr(menu); + delete hook; + if (b_sub_owner) { + delete sub; + ::set_menu_sub(menu,(WINDOW *)0); + } + free_menu(menu); + + // It's essential to do this after free_menu() + delete[] ::menu_items(menu); + --total_count; +} + +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); + } +} + +// 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); +} + +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; +} + +// 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('Q') : return(CMD_QUIT); + case KEY_DOWN : + case CTRL('N') : return(REQ_NEXT_ITEM); + case KEY_UP : + case CTRL('P') : return(REQ_PREV_ITEM); + case CTRL('U') : return(REQ_SCR_ULINE); + case CTRL('D') : return(REQ_SCR_DLINE); + case CTRL('F') : return(REQ_SCR_DPAGE); + case CTRL('B') : return(REQ_SCR_UPAGE); + case CTRL('X') : return(REQ_CLEAR_PATTERN); + case CTRL('H') : return(REQ_BACK_PATTERN); + case CTRL('A') : return(REQ_NEXT_MATCH); + case CTRL('Z') : 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) { + NCursesMenuItem& itm = current_item(); + b_action = itm.action(); + } 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(); + return *(my_items[::item_index (::current_item (menu))]); +} diff --git a/c++/cursesm.h b/c++/cursesm.h new file mode 100644 index 00000000..97825f7f --- /dev/null +++ b/c++/cursesm.h @@ -0,0 +1,621 @@ +// * This makes emacs happy -*-Mode: C++;-*- +/*-----------------------------------------------------------------------------+ +| The ncurses menu C++ binding is Copyright (C) 1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ +#ifndef _CURSESM_H +#define _CURSESM_H + +#include +#include +#include + +extern "C" { +# include +} + +// This wraps the ITEM type of +class NCursesMenuItem +{ + friend class NCursesMenu; + +protected: + ITEM *item; + + void OnError (int err) const THROWS(NCursesMenuException) + { + if (err != E_OK) + THROW(new NCursesMenuException (err)); + } + +public: + // Create an item. If you pass both parameters as NULL, a delimiter + // item is constructed which can be used to terminate a list of + // NCursesMenu objects. + 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); + } + + // Release the items memory + virtual ~NCursesMenuItem () + { + if (item) + ::free_item (item); + } + + // Name of the item + inline const char* name () const + { + return ::item_name (item); + } + + // Description of the item + inline const char* description () const + { + return ::item_description (item); + } + + // index of the item in an item array (or -1) + inline int index (void) const + { + return ::item_index (item); + } + + // switch on an item's option + inline void options_on (Item_Options options) + { + OnError (::item_opts_on (item, options)); + } + + // switch off an item's option + inline void options_off (Item_Options options) + { + OnError (::item_opts_off (item, options)); + } + + // return the item's options + inline Item_Options options () const + { + return ::item_opts (item); + } + + // set the item's options + inline void set_options (Item_Options options) + { + OnError (::set_item_opts (item, options)); + } + + // set/reset the item's selection state + inline void set_value (bool f) + { + OnError (::set_item_value (item,f)); + } + + // return the item's selection state + inline bool value () const + { + return ::item_value (item); + } + + // return visibility of the item + inline bool visible () const + { + return ::item_visible (item); + } + + // 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. + virtual bool action() { + return FALSE; + }; +}; + +// 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() { + if (p_fct) + return p_fct (*this); + else + return FALSE; + } +}; + + +class NCursesMenu : public NCursesPanel { +protected: + MENU *menu; + +private: + // Keep book of the number of instantiated C++ menus. + static unsigned long total_count; + + NCursesWindow* sub; // the subwindow object + bool b_sub_owner; // is this our own subwindow? + bool b_framed; // has the menu a border? + + 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 { + const 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 + void set_user(const void *user) + { + UserHook* uptr = (UserHook*)::menu_userptr (menu); + assert (uptr && uptr->m_back==this && uptr->m_owner==menu); + uptr->m_user = user; + } + + const 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=FALSE); + + 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) ; + +public: + // make a full window size menu + NCursesMenu (NCursesMenuItem* menu[]); + + // make a menu with a window of this size. + NCursesMenu (NCursesMenuItem* menu[], + int lines, + int cols, + int begin_y, + int begin_x, + bool with_frame=FALSE); + + 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 + void setItems(NCursesMenuItem* nitems[]); + + // 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 + void menu_format(int& rows,int& cols) + { + ::menu_format(menu,&rows,&cols); + } + + // item things + NCursesMenuItem* items() const + { + return *my_items; + } + + // Get the number of items in this menu + int count() const + { + return ::item_count(menu); + } + + // Get the current item (i.e. the one the cursor is located) + 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 + chtype back() const + { + return ::menu_back(menu); + } + + // Get the menus foreground attributes + chtype fore() const + { + return ::menu_fore(menu); + } + + // Get the menus grey attributes (used for unselectable items) + chtype grey() const + { + return ::menu_grey(menu); + } + + // Set the menus background attributes + chtype set_background(chtype a) + { + return ::set_menu_back(menu,a); + } + + // Set the menus foreground attributes + chtype foreground(chtype a) + { + return ::set_menu_fore(menu,a); + } + + // Set the menus grey attributes (used for unselectable items) + 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 + void frame(const char *title=NULL, const char* btitle=NULL) { + if (b_framed) + NCursesPanel::frame(title,btitle); + else + OnError(E_SYSTEM_ERROR); + } + + void boldframe(const char *title=NULL, const char* btitle=NULL) { + if (b_framed) + NCursesPanel::boldframe(title,btitle); + else + OnError(E_SYSTEM_ERROR); + } + + 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 + 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. + virtual NCursesMenuItem& operator()(void); + + // -------------------- + // Exception handlers + // Called by operator() + // -------------------- + + // Called if the request is denied + virtual void On_Request_Denied(int c) const { + beep(); + } + + // Called if the item is not selectable + virtual void On_Not_Selectable(int c) const { + beep(); + } + + // Called if pattern doesn't match + virtual void On_No_Match(int c) const { + beep(); + } + + // Called if the command is unknown + virtual void On_Unknown_Command(int c) const { + beep(); + } +}; + + +// 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 NCursesUserItem : public NCursesMenuItem +{ +public: + NCursesUserItem (const char* p_name = NULL, + const char* p_descript = NULL ) + : NCursesMenuItem (p_name, p_descript) + {}; + + NCursesUserItem (const T* p_UserData, + const char* p_name, + const char* p_descript = NULL ) + : NCursesMenuItem (p_name, p_descript) + { + if (item) + OnError (::set_item_userptr (item, (const void *)p_UserData)); + }; + + virtual ~NCursesUserItem() {}; + + const T* UserData (void) const + { + return (const T*)::item_userptr (item); + }; + + virtual void setUserData(const T* p_UserData) { + if (item) + OnError (::set_item_userptr (item, (const void *)p_UserData)); + } +}; + +// The same mechanism is used to attach user data to a menu +template class NCursesUserMenu : public NCursesMenu +{ +public: + NCursesUserMenu (NCursesMenuItem menu[]) + : NCursesMenu (menu) + {}; + + NCursesUserMenu (const T* p_UserData, + NCursesMenuItem menu[]) + : NCursesMenu (menu) + { + if (m) + set_user ((const void *)p_UserData); + }; + + NCursesUserMenu (const T* p_UserData, + NCursesMenuItem menu[], + int lines, + int cols, + int begin_y, + int begin_x, + bool with_frame=FALSE) + : NCursesMenu (menu, lines, cols, begin_y, begin_x, with_frame) + { + if (m) + set_user ((const void *)p_UserData); + }; + + virtual ~NCursesUserMenu() {}; + + const T* UserData (void) const + { + return (const T*)get_user (); + }; + + virtual void setUserData (const T* p_UserData) { + if (m) + set_user ((const void *)p_UserData); + } +}; + +#endif // _CURSESM_H diff --git a/c++/cursesp.cc b/c++/cursesp.cc new file mode 100644 index 00000000..bb5506c0 --- /dev/null +++ b/c++/cursesp.cc @@ -0,0 +1,95 @@ +// * this is for making emacs happy: -*-Mode: C++;-*- +/* + written and + Copyright (C) 1993 by Anatoly Ivasyuk (anatoly@nick.csh.rit.edu) + + Modified by Juergen Pfeifer, April 1997 +*/ + +#include "internal.h" + +MODULE_ID("$Id: cursesp.cc,v 1.6 1997/05/04 01:02:08 tom Exp $") + +#pragma implementation +#include "cursesp.h" + +NCursesPanel::NCursesPanel(int lines, + int cols, + int begin_y, + int begin_x) + : NCursesWindow(lines, cols, begin_y, begin_x) { + + 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, (const 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(); + ::doupdate(); +} + +void +NCursesPanel::redraw() { + PANEL *pan; + + pan = ::panel_above(NULL); + while (pan) { + ::touchwin(panel_window(pan)); + pan = ::panel_above(pan); + } + ::update_panels(); + ::doupdate(); +} + +void +NCursesPanel::refresh() { + ::update_panels(); + ::doupdate(); +} + +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) + OnError(addstr(row,(maxx() - strlen(label)) / 2, label)); +} diff --git a/c++/cursesp.h b/c++/cursesp.h new file mode 100644 index 00000000..9ea20aeb --- /dev/null +++ b/c++/cursesp.h @@ -0,0 +1,130 @@ +// * This makes emacs happy -*-Mode: C++;-*- +#ifndef _CURSESP_H +#define _CURSESP_H + +#include +#include + +extern "C" { +#include +#include +} + +class NCursesPanel : public NCursesWindow { + +protected: + PANEL *p; + +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 { + const 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; + +protected: + void set_user(const void *user) { + UserHook* uptr = (UserHook*)::panel_userptr (p); + assert (uptr && uptr->m_back==this && uptr->m_owner==p); + uptr->m_user = user; + } + + const 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 != OK) + THROW(new NCursesPanelException (this, err)); + } + +public: + NCursesPanel(int lines = 0, + int cols = 0, + int begin_y = 0, + int begin_x = 0); + + virtual ~NCursesPanel(); + + // basic manipulation + inline void hide() { + OnError (::hide_panel(p)); + } + + inline void show() { + OnError (::show_panel(p)); + } + + inline void top() { + OnError (::top_panel(p)); + } + + inline void bottom() { + OnError (::bottom_panel(p)); + } + + inline void mvpan(int y, int x) { + OnError (::move_panel(p, y, x)); + } + + inline void mvwin(int y, int x) { + OnError (::move_panel(p, y, x)); + } + + inline bool hidden() const { + return ::panel_hidden (p); + } + + static void redraw(); // redraw all panels + static void refresh(); // update screen + + // decorations + virtual void frame(const char *title=NULL, const char* btitle=NULL); + virtual void boldframe(const char *title=NULL, const char* btitle=NULL); + virtual void label(const char *topLabel, const char *bottomLabel); + virtual void centertext(int row,const char *label); + +}; + + +/* We use templates to provide a typesafe mechanism to associate + * user data with a panel. A NCursesUserPanel is a panel + * associated with some user data of type T. + */ +template class NCursesUserPanel : public NCursesPanel +{ +public: + NCursesUserPanel (int lines = 0, + int cols = 0, + int begin_y = 0, + int begin_x = 0) + : NCursesPanel (lines, cols, begin_y, begin_x) { + }; + + NCursesUserPanel (const T* p_UserData, + int lines = 0, + int cols = 0, + int begin_y = 0, + int begin_x = 0) + : NCursesPanel (lines, cols, begin_y, begin_x) { + if (p) + set_user ((const void *)p_UserData); + }; + + virtual ~NCursesUserPanel() {}; + + const T* UserData (void) const { + return (const T*)get_user (); + }; + + virtual void setUserData (const T* p_UserData) { + if (p) + set_user ((const void *)p_UserData); + } +}; + +#endif // _CURSESP_H diff --git a/c++/cursesw.cc b/c++/cursesw.cc new file mode 100644 index 00000000..d1354425 --- /dev/null +++ b/c++/cursesw.cc @@ -0,0 +1,344 @@ +// * 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@T-Online.de) +*/ + +#include "internal.h" + +MODULE_ID("$Id: cursesw.cc,v 1.5 1997/05/05 20:04:59 tom Exp $") + +#pragma implementation + +#include "cursesw.h" + +#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 +int NCursesWindow::count = 0; + +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, 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, 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) +{ + noecho(); + cbreak(); + leaveok(0); + keypad(1); +} + +void +NCursesWindow::err_handler(const char *msg) const THROWS(NCursesException) +{ + THROW(new NCursesException(msg)); +} + +void +NCursesWindow::initialize() { + ::initscr(); + if (colorInitialized==COLORS_NEED_INITIALIZATION) { + colorInitialized=COLORS_NOT_INITIALIZED; + count++; + useColors(); + count--; + } +} + +NCursesWindow::NCursesWindow(int lines, int cols, int begin_y, int begin_x) +{ + if (count==0) + initialize(); + + w = ::newwin(lines, cols, begin_y, begin_x); + if (w == 0) { + err_handler("Cannot construct window"); + } + init(); + + alloced = 1; + subwins = par = sib = 0; + count++; +} + +NCursesWindow::NCursesWindow(WINDOW* &window) +{ + if (count==0) + initialize(); + + w = window; + init(); + alloced = 0; + subwins = par = sib = 0; + count++; +} + + +NCursesWindow::NCursesWindow(NCursesWindow& win, int l, int c, + int by, int bx, char absrel) +{ + if (absrel == 'r') { // relative origin + by += win.begy(); + bx += win.begx(); + } + + // Even though we treat subwindows as a tree, the standard curses + // library needs the `subwin' call to link to the root in + // order to correctly perform refreshes, etc. + + NCursesWindow* root = &win; + while (root->par != 0) root = root->par; + + w = subwin(root->w, l, c, by, bx); + if (w == 0) { + err_handler("Cannot construct subwindow"); + } + + par = &win; + sib = win.subwins; + win.subwins = this; + subwins = 0; + alloced = 1; + count++; +} + +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 = 0; + } + 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); + + --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 (count>0) { + 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; +} diff --git a/c++/cursesw.h b/c++/cursesw.h new file mode 100644 index 00000000..41026f32 --- /dev/null +++ b/c++/cursesw.h @@ -0,0 +1,730 @@ +// * This makes emacs happy -*-Mode: C++;-*- +#ifndef _CURSESW_H +#define _CURSESW_H + +#include + +#pragma interface + +#include +#include + +#if defined(__GNUG__) +# if HAVE_BUILTIN_H +# define exception builtin_exception +# include +# undef exception +# endif +#else // #elif defined (__SUNPRO_CC) +# include +# include + extern "C" { unsigned sleep(int); } +#endif + +#if HAVE_VALUES_H +# include +#endif + +#include +#include + +extern "C" { +# include +} + +/* 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 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 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 clear +inline int UNDEF(clear)() { return clear(); } +#undef clear +#define clear UNDEF(clear) +#endif + +#ifdef clearok +inline int UNDEF(clearok)(WINDOW* win, int 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, int _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 getyx +inline void UNDEF(getyx)(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 int 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, int 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 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, int 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 int UNDEF(timeout)(int delay) { return 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 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)(WINDOW* win) { return winch(win); } +#undef winch +#define winch UNDEF(winch) +#endif + +#ifdef mvwaddch +inline int UNDEF(mvwaddch)(WINDOW *win, int y, int x, 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 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 mvwinch +inline int 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 mvinch +inline int 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 + +/* + * + * C++ class for windows. + * + * + */ + +class NCursesWindow +{ + friend class NCursesMenu; friend class NCursesForm; + +private: + static void initialize(); + void init(); + void err_handler(const char *) const THROWS(NCursesException); + + short getcolor(int getback) const; + + static int setpalette(short fore, short back, short pair); + static int colorInitialized; + +protected: + static int 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 + + int 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 + +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 by, // absolute or relative + int bx, // origins: + char absrel = 'a');// if `a', by & bx are + // absolute screen pos, + // else if `r', they are + // relative to par origin + virtual ~NCursesWindow(); + + static void useColors(void); + // Call this routine very early if you want to have colors. + + // 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 + 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 cols in this window + int begx() const { return w->_begx; } + // smallest x coord in window + int begy() const { return w->_begy; } + // smallest y coord in window + int maxx() const { return w->_maxx; } + // largest x coord in window + int maxy() const { return w->_maxy; } + // largest x 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 + int move(int y, int x) { return ::wmove(w, y, x); } + + // coordinate positioning + void getyx(int& y, int& x) { ::getyx(w, y, x); } + int mvcur(int sy, int ey, int sx, int ex) { + return ::mvcur(sy, ey, sx, ex); } + + // input + int getch() { return ::wgetch(w); } + int getch(int y, int x) { + return (::wmove(w, y, x)==ERR) ? ERR : ::wgetch(w); } + int getstr(char* str) { return ::wgetstr(w, str); } + int getstr(int y, int x, char* str) { + return (::wmove(w, y, x)==ERR) ? ERR : ::wgetstr(w, str); } + int scanw(const char*, ...) +#if __GNUG__ >= 2 + __attribute__ ((format (scanf, 2, 3))); +#else + ; +#endif + int scanw(int, int, const char*, ...) +#if __GNUG__ >= 2 + __attribute__ ((format (scanf, 4, 5))); +#else + ; +#endif + + // output + int addch(const chtype ch) { return ::waddch(w, ch); } + int addch(int y, int x, chtype ch) { + return (::wmove(w, y, x)==ERR) ? ERR : ::waddch(w, ch); } + int addstr(const char* str) { return ::waddstr(w, (char*)str); } + int addstr(int y, int x, const char * str) { + return (::wmove(w, y, x)==ERR) ? ERR : ::waddstr(w, (char*)str); } + int printw(const char* fmt, ...) +#if __GNUG__ >= 2 + __attribute__ ((format (printf, 2, 3))); +#else + ; +#endif + int printw(int y, int x, const char * fmt, ...) +#if __GNUG__ >= 2 + __attribute__ ((format (printf, 4, 5))); +#else + ; +#endif + int inch() { return ::winch(w); } + int inch(int y, int x) { + return (::wmove(w, y, x)==ERR) ? ERR : (int) ::winch(w); } + int insch(chtype ch) { return ::winsch(w, ch); } + int insch(int y, int x, chtype ch) { + return (::wmove(w, y, x)==ERR) ? ERR : ::winsch(w, ch); } + int insertln() { return ::winsertln(w); } + int attron(chtype at) { return ::wattron(w, at); } + int attroff(chtype at) { return ::wattroff(w, at); } + int attrset(chtype at) { return ::wattrset(w, at); } + + // borders + int box(chtype vert=0, chtype hor=0) { return ::box(w, vert, hor); } + + // lines and boxes + int hline(int y, int x, chtype ch, int len) { + return (::wmove(w, y, x)==ERR) ? ERR: ::whline(w, ch, len); } + int hline(int y, int x, int len) { + return (::wmove(w, y, x)==ERR) ? ERR: ::whline(w, 0, len); } + int hline(chtype ch, int len) { return ::whline(w, ch, len); } + int hline(int len) { return ::whline(w, 0, len); } + int vline(int y, int x, chtype ch, int len) { + return (::wmove(w, y, x)==ERR) ? ERR: ::wvline(w, ch, len); } + int vline(int y, int x, int len) { + return (::wmove(w, y, x)==ERR) ? ERR: ::wvline(w, 0, len); } + int vline(chtype ch, int len) { return ::wvline(w, ch, len); } + int vline(int len) { return ::wvline(w, 0, len); } + + // erasure + int erase() { return ::werase(w); } + int clear() { return ::wclear(w); } + int clearok(int bf) { return ::clearok(w, bf); } + int clrtobot() { return ::wclrtobot(w); } + int clrtoeol() { return ::wclrtoeol(w); } + int delch() { return ::wdelch(w); } + int delch(int y, int x) { + return (::wmove(w, y, x)==ERR) ? ERR : ::wdelch(w); } + int deleteln() { return ::wdeleteln(w); } + + // screen control + int scroll() { return ::scroll(w); } + int scrollok(int bf) { return ::scrollok(w, bf); } + int idlok(int bf) { return ::idlok(w, bf); } + int touchwin() { return ::touchwin(w); } + int refresh() { return ::wrefresh(w); } + int leaveok(int bf) { return ::leaveok(w, bf); } + int noutrefresh() { return ::wnoutrefresh(w); } + int doupdate() { return ::doupdate(); } +#ifndef _no_flushok + int flushok(int bf) { return ::flushok(w, bf); } +#endif + int keypad(int bf) { return ::keypad(w, bf); } + int standout() { return ::wstandout(w); } + int standend() { return ::wstandend(w); } + + // multiple window control + int overlay(NCursesWindow &win) { + return ::overlay(w, win.w); } + int overwrite(NCursesWindow &win) { + return ::overwrite(w, win.w); } + + + // traversal support + NCursesWindow* child() { return subwins; } + NCursesWindow* sibling() { return sib; } + NCursesWindow* parent() { return par; } + + // True if win is a child of this window. + bool isDescendant(NCursesWindow& win); +}; + + +// 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 by, // absolute or relative + int bx, // origins: + char absrel = 'a') // if `a', by & bx are + : NCursesWindow(par,lines,cols, // absolute screen pos, + by,bx) { // else if `r', they are + useColors(); } // relative to par origin +}; + +#endif // _CURSESW_H diff --git a/c++/demo.cc b/c++/demo.cc new file mode 100644 index 00000000..29b60fd7 --- /dev/null +++ b/c++/demo.cc @@ -0,0 +1,240 @@ +/* + * Silly demo program for the NCursesPanel class. + * + * written by Anatoly Ivasyuk (anatoly@nick.csh.rit.edu) + * + * $Id: demo.cc,v 1.7 1997/05/05 20:53:41 tom Exp $ + */ + +#include + +#include "cursesm.h" + +#if HAVE_LIBC_H +# include +#endif + +class SillyDemo +{ + public: + void run(int sleeptime) { + // We need to define a full screen panel for the main screen so + // that when redraws happen, the main screen actually gets redrawn. + // I think there may be a bug in the panels code which won't redraw + // the main screen otherwise. Maybe someone out there can find it... + + NCursesPanel *std = new NCursesPanel(); + + // Make a few small demo panels + + NCursesPanel *u = new NCursesPanel(10,20,12,4); + NCursesPanel *v = new NCursesPanel(10,20,10,6); + NCursesPanel *w = new NCursesPanel(10,20,8,8); + NCursesPanel *x = new NCursesPanel(10,20,6,10); + NCursesPanel *y = new NCursesPanel(10,20,4,12); + NCursesPanel *z = new NCursesPanel(10,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(10,0); + std->hline('a',79); + std->move(0,40); + std->vline(20); + + // 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"); + + // 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(); + + // Show that things actually come back correctly when the screen + // is cleared and the global NCursesPanel::redraw() is called. + + sleep(sleeptime); + ::clear(); // call ncurses clear() directly + ::wrefresh(stdscr); // call ncurses refresh directly + sleep(sleeptime); + NCursesPanel::redraw(); + + // 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->mvpan(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->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 MyAction : public NCursesUserItem +{ +public: + MyAction (const T* p_UserData, + const char* p_name) + : NCursesUserItem(p_UserData, p_name) + {}; + + ~MyAction() {} + + bool action() { + SillyDemo a; + a.run(UserData()->sleeptime()); + return FALSE; + } +}; + +class QuitItem : public NCursesMenuItem +{ +public: + QuitItem() : NCursesMenuItem("Quit") { + } + + bool action() { + endwin(); + return TRUE; + } +}; + +class MyMenu : public NCursesMenu +{ +private: + NCursesPanel* P; + +public: + MyMenu (NCursesMenuItem* menu[]) + : NCursesMenu (menu, 7, 8, 2, 2, TRUE) + { + if (NCursesWindow::NumberOfColors() > 2) { + setcolor(1); + setpalette(COLOR_YELLOW, COLOR_BLUE); + } + + P = new NCursesPanel(1,COLS,LINES-1,0); + boldframe("Demo","Silly"); + P->show(); + } + + ~MyMenu() + { + P->hide(); + delete P; + } + + virtual void On_Menu_Init() + { + P->move(0,0); + P->clrtoeol(); + P->addstr("12345"); + NCursesPanel::refresh(); + } + + virtual void On_Menu_Termination() + { + P->move(0,0); + P->clrtoeol(); + P->addstr("Menu Exit"); + NCursesPanel::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); + NCursesPanel::refresh(); + } + + virtual void On_Item_Termination(NCursesMenuItem& item) + { + P->move(0,item.index()); + P->attroff(A_REVERSE); + P->printw("%1d",1+item.index()); + NCursesPanel::refresh(); + } +}; + +main() +{ + UserData* u = new UserData(1); + + NCursesWindow::useColors(); + + NCursesMenuItem** I = new NCursesMenuItem*[6]; + I[0] = new NCursesMenuItem("One"); + I[1] = new NCursesMenuItem("Two"); + I[2] = new MyAction (u, "Silly"); + I[3] = new NCursesMenuItem("Four"); + I[4] = new QuitItem(); + I[5] = new NCursesMenuItem(); + + MyMenu m(I); + + m(); + + for(int i=0; i < 6; i++) { + delete I[i]; + } + delete I; + delete u; + + exit(0); +} diff --git a/c++/etip.h b/c++/etip.h new file mode 100644 index 00000000..82fb7710 --- /dev/null +++ b/c++/etip.h @@ -0,0 +1,148 @@ +#ifndef _ETIP_H +#define _ETIP_H + +#ifdef __GNUG__ +#if HAVE_TYPEINFO +# include +#endif +#endif + +#include + +// Forward Declarations +class NCursesPanel; +class NCursesMenu; +class NCursesForm; + +class NCursesException +{ +public: + int errorno; + const char *message; + + 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"; + } + +}; + +inline void THROW(const NCursesException *e) { +#if defined(__GNUG__) + (*lib_error_handler)(e?e->classname():"",e?e->message:""); +#else // #elif defined(__SUNPRO_CC) + genericerror(1, ((e != 0) ? (char *)(e->message) : "")); +#endif +} + +#define THROWS(s) + +#endif diff --git a/c++/internal.h b/c++/internal.h new file mode 100644 index 00000000..a2df9f61 --- /dev/null +++ b/c++/internal.h @@ -0,0 +1,14 @@ +#ifndef CPLUS_INTERNAL_H +#define CPLUS_INTERNAL_H 1 + +#include + +#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/c++/modules b/c++/modules new file mode 100644 index 00000000..3d21ec02 --- /dev/null +++ b/c++/modules @@ -0,0 +1,24 @@ +# Program modules +################################################################################ +# Copyright 1995 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +cursesm c++ $(srcdir) $(srcdir)/cursesm.h $(srcdir)/cursesp.h $(srcdir)/cursesw.h $(srcdir)/etip.h +cursesp c++ $(srcdir) $(srcdir)/cursesp.h $(srcdir)/cursesw.h $(srcdir)/etip.h +cursesw c++ $(srcdir) $(srcdir)/cursesw.h $(srcdir)/etip.h +demo c++ $(srcdir) $(srcdir)/cursesp.h $(srcdir)/cursesw.h $(srcdir)/etip.h diff --git a/configure b/configure new file mode 100755 index 00000000..c494a667 --- /dev/null +++ b/configure @@ -0,0 +1,4829 @@ +#! /bin/sh + +# From configure.in Revision: 1.64 + + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.970309 +# 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: +ac_help="$ac_help + --enable-add-ons=DIR... used to check if we are a glibc add-on." +ac_help="$ac_help + --without-cxx suppress check for C++" +ac_help="$ac_help + --with-install-prefix prefixes actual install-location" +ac_help="$ac_help + --with-shared generate shared-libraries" +ac_help="$ac_help + --with-normal generate normal-libraries (default)" +ac_help="$ac_help + --with-debug generate debug-libraries (default)" +ac_help="$ac_help + --with-profile generate profile-libraries" +ac_help="$ac_help + --with-dbmalloc test: use Conor Cahill's dbmalloc library" +ac_help="$ac_help + --with-dmalloc test: use Gray Watson's dmalloc library" +ac_help="$ac_help + --with-gpm use Alessandro Rubini's GPM library" +ac_help="$ac_help + --disable-overwrite leave out the link to -lcurses" +ac_help="$ac_help + --enable-big-core assume machine has lots of memory" +ac_help="$ac_help + --enable-termcap compile in termcap fallback support" +ac_help="$ac_help + --enable-getcap fast termcap load, no xrefs to terminfo" +ac_help="$ac_help + --enable-getcap-cache cache translated termcaps in ~/.terminfo" +ac_help="$ac_help + --enable-symlinks make tic use symbolic links not hard links" +ac_help="$ac_help + --enable-bsdpad recognize BSD-style prefix padding" +ac_help="$ac_help + --enable-const compile with extra/non-standard const" +ac_help="$ac_help + --with-rcs-ids build: compile-in RCS identifiers" +ac_help="$ac_help + --enable-echo build: display \"compiling\" commands (default)" +ac_help="$ac_help + --enable-warnings build: turn on GCC compiler warnings" +ac_help="$ac_help + --enable-assertions test: turn on generation of assertion code" +ac_help="$ac_help + --disable-leaks test: suppress permanent memory-leaks" +ac_help="$ac_help + --enable-expanded test: generate functions for certain macros" +ac_help="$ac_help + --disable-macros test: use functions rather than macros" + +# 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= +# 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 + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + 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.12.970309" + 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/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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +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]*//'`" +nc_cv_abi_version=${NCURSES_MAJOR} +nc_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} +echo "$ac_t""Configuring NCURSES $nc_cv_rel_version ABI $nc_cv_abi_version (`date`)" 1>&6 + + + + + + + + + +if eval "test \"`echo '$''{'nc_cv_systype'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +nc_cv_systype="`(uname -s || hostname || echo unknown) 2>/dev/null |sed -e s'/[:\/.-]/_/'g | sed 1q`" +if test -z "$nc_cv_systype"; then nc_cv_systype=unknown;fi + +fi + +echo "$ac_t""System type is $nc_cv_systype" 1>&6 + + +# 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 +if test -f $srcdir/../glibcbug.in; 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 +fi + +### Save the given $CFLAGS to allow user-override. +nc_user_CFLAGS="$CFLAGS" + +### Derive the system name, as a check for reusing the autoconf cache +system_name="`(uname -s -r || hostname || echo unknown) 2>/dev/null`" +if test -n "$system_name" ; then + cat >> confdefs.h <&6 +else + nc_cv_system_name="$system_name" +fi + +test -z "$system_name" && system_name="$nc_cv_system_name" +test -n "$nc_cv_system_name" && echo "$ac_t"""Configuring for $nc_cv_system_name"" 1>&6 + +if test ".$system_name" != ".$nc_cv_system_name" ; then + echo "$ac_t"""Cached system name does not agree with actual"" 1>&6 + { echo "configure: error: "Please remove config.cache and try again."" 1>&2; exit 1; } +fi + +### Default install-location + +echo $ac_n "checking for prefix""... $ac_c" 1>&6 +echo "configure:665: checking for prefix" >&5 +if test "x$prefix" = "xNONE" ; then + case "$nc_cv_systype" in + # non-vendor systems don't have a conflict + NetBSD|FreeBSD|Linux) prefix=/usr + ;; + *) prefix=$ac_default_prefix + ;; + esac +fi +echo "$ac_t""$prefix" 1>&6 +echo $ac_n "checking for default include-directory""... $ac_c" 1>&6 +echo "configure:677: checking for default include-directory" >&5 +test -n "$verbose" && echo 1>&6 +for nc_symbol in \ + $includedir \ + $includedir/ncurses \ + $prefix/include \ + $prefix/include/ncurses \ + /usr/local/include \ + /usr/local/include/ncurses \ + /usr/include \ + /usr/include/ncurses +do + nc_dir=`eval echo $nc_symbol` + if test -f $nc_dir/curses.h ; then + if ( fgrep NCURSES_VERSION $nc_dir/curses.h 2>&1 >/dev/null ) ; then + includedir="$nc_symbol" + test -n "$verbose" && echo $ac_n " found " 1>&6 + break + fi + fi + test -n "$verbose" && echo " tested $nc_dir" 1>&6 +done +echo "$ac_t""$includedir" 1>&6 + + +### 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:706: 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="${IFS}:" + for ac_dir in $PATH; 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:735: 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="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; 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 + + 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:783: 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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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* + +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:817: 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:822: 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 <&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 + 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:846: 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 + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +if test -n "$GCC" ; then +echo $ac_n "checking version of gcc""... $ac_c" 1>&6 +echo "configure:875: checking version of gcc" >&5 +eval "$CC --version" +fi +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:879: 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 < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:900: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +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 < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:917: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +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* + 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:941: 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 < +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 < +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:987: 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 + + +# Check whether --with-cxx or --without-cxx was given. +if test "${with_cxx+set}" = set; then + withval="$with_cxx" + : +fi + +if test "X$withval" != Xno ; then +for ac_prog in $CCC c++ g++ gcc CC cxx 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:1020: 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="${IFS}:" + for ac_dir in $PATH; 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:1051: 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 $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 $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:1091: 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:1096: 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 <&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 + 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:1120: 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 + CXXFLAGS="-g -O2" + else + CXXFLAGS="-O2" + fi +else + GXX= + test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" +fi + +fi +if test -n "$GXX" ; then case "`${CXX-g++} --version`" in 1*|2.[0-6]*) GXX=""; CXX=""; ac_cv_prog_gxx=no; nc_cxx_library=no ; echo No: templates do not work;; esac; fi +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:1154: 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="${IFS}:" + for ac_dir in $PATH; 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:1183: 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 + +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. + +# 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 +# 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:1239: 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="${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. + for ac_prog in ginstall installbsd 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. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + 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_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +case $INSTALL in +/*) + ;; +*) + nc_dir=`echo $INSTALL|sed -e 's%/[^/]*$%%'` + test -z "$nc_dir" && nc_dir=. + INSTALL=`cd $nc_dir;pwd`/`echo $INSTALL | sed -e 's:^.*/::'` + ;; +esac + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:1299: 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:1322: 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="${IFS}:" + for ac_dir in $PATH; 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:1353: 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="${IFS}:" + for ac_dir in $PATH; 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:1386: 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="${IFS}:" + for ac_dir in $PATH; 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 '$''{'nc_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:1421: checking for loader (symbol LD)" >&5 +test -z "$LD" && LD=ld +echo "$ac_t""$LD" 1>&6 + +nc_cv_subst_LD=$LD +fi + +LD=${nc_cv_subst_LD} + +if eval "test \"`echo '$''{'nc_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:1435: checking for archiver (symbol AR)" >&5 +test -z "$AR" && AR=ar +echo "$ac_t""$AR" 1>&6 + +nc_cv_subst_AR=$AR +fi + +AR=${nc_cv_subst_AR} + +if eval "test \"`echo '$''{'nc_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:1449: checking for archiver options (symbol AR_OPTS)" >&5 +test -z "$AR_OPTS" && AR_OPTS=rv +echo "$ac_t""$AR_OPTS" 1>&6 + +nc_cv_subst_AR_OPTS=$AR_OPTS +fi + +AR_OPTS=${nc_cv_subst_AR_OPTS} + + + +echo $ac_n "checking for makeflags variable""... $ac_c" 1>&6 +echo "configure:1461: checking for makeflags variable" >&5 +if eval "test \"`echo '$''{'nc_cv_makeflags'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + nc_cv_makeflags='' + for nc_option in '$(MFLAGS)' '-$(MAKEFLAGS)' + do + cat >ncurses.tmp </dev/null` + if test "$nc_result" != "." + then + nc_cv_makeflags=$nc_option + break + fi + done + rm -f ncurses.tmp + +fi + +echo "$ac_t""$nc_cv_makeflags" 1>&6 + + +echo $ac_n "checking format of man-pages""... $ac_c" 1>&6 +echo "configure:1488: checking format of man-pages" >&5 + 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}:" + nc_form=unknown + for nc_dir in $MANPATH; do + test -z "$nc_dir" && nc_dir=/usr/man + nc_rename="" + nc_format=no + for nc_name in $nc_dir/*/date.[01]* $nc_dir/*/date + do + nc_test=`echo $nc_name | sed -e 's/*//'` + if test "x$nc_test" = "x$nc_name" ; then + case "$nc_name" in + *.gz) nc_form=gzip; nc_name=`basename $nc_name .gz`;; + *.Z) nc_form=compress; nc_name=`basename $nc_name .Z`;; + *.0) nc_form=BSDI; nc_format=yes;; + *) nc_form=cat;; + esac + break + fi + done + if test "$nc_form" != "unknown" ; then + break + fi + done + IFS="$ac_save_ifs" + if test "$prefix" = "NONE" ; then + nc_prefix="$ac_default_prefix" + else + nc_prefix="$prefix" + fi + + # Debian 'man' program? + test -f /etc/debian_version && \ + nc_rename=`cd $srcdir;pwd`/man/man_db.renames + + test ! -d man && mkdir man + + # Construct a sed-script to perform renaming within man-pages + if test -n "$nc_rename" ; then + fgrep -v \# $nc_rename | \ + sed -e 's/^/s\//' \ + -e 's/\./\\./' \ + -e 's/ / /g' \ + -e 's/ \+/\//' \ + -e s/\$/\\\/g/ >man/edit_man.sed + fi + if test $nc_format = yes ; then + nc_subdir='$mandir/cat' + else + nc_subdir='$mandir/man' + fi + +cat >man/edit_man.sh <>man/edit_man.sh <\$TMP +NC_EOF +else +cat >>man/edit_man.sh <\$TMP +NC_EOF +fi +if test $nc_format = yes ; then +cat >>man/edit_man.sh <\$TMP.out + mv \$TMP.out \$TMP +NC_EOF +fi +case "$nc_form" in +compress) +cat >>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <>man/edit_man.sh <&6 + + +# 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 + + + +### 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. +nc_list_models="" +# Check whether --with-shared or --without-shared was given. +if test "${with_shared+set}" = set; then + withval="$with_shared" + test "$withval" = "yes" && nc_list_models="$nc_list_models shared" +fi + +# Check whether --with-normal or --without-normal was given. +if test "${with_normal+set}" = set; then + withval="$with_normal" + test "$withval" = "yes" && nc_list_models="$nc_list_models normal" +else + nc_list_models="$nc_list_models normal" +fi + +# Check whether --with-debug or --without-debug was given. +if test "${with_debug+set}" = set; then + withval="$with_debug" + test "$withval" = "yes" && nc_list_models="$nc_list_models debug" +else + nc_list_models="$nc_list_models debug" +fi + +# Check whether --with-profile or --without-profile was given. +if test "${with_profile+set}" = set; then + withval="$with_profile" + test "$withval" = "yes" && nc_list_models="$nc_list_models profile" +fi + + +### Checks for special libraries, must be done up-front. +# Check whether --with-dbmalloc or --without-dbmalloc was given. +if test "${with_dbmalloc+set}" = set; then + withval="$with_dbmalloc" + echo $ac_n "checking for debug_malloc in -ldbmalloc""... $ac_c" 1>&6 +echo "configure:1678: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 <&6 +fi + +fi + +# Check whether --with-dmalloc or --without-dmalloc was given. +if test "${with_dmalloc+set}" = set; then + withval="$with_dmalloc" + echo $ac_n "checking for dmalloc_debug in -ldmalloc""... $ac_c" 1>&6 +echo "configure:1730: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 <&6 +fi + +fi + +# Check whether --with-gpm or --without-gpm was given. +if test "${with_gpm+set}" = set; then + withval="$with_gpm" + echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6 +echo "configure:1782: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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="$EXTRA_LIBS -lgpm -lncurses" + 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:1826: 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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +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 <&6 +fi +done + + +else + echo "$ac_t""no" 1>&6 +fi + +fi + + + + +echo $ac_n "checking for specified models""... $ac_c" 1>&6 +echo "configure:1873: checking for specified models" >&5 +test -z "$nc_list_models" && nc_list_models=normal +echo "$ac_t""$nc_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 $nc_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 $nc_cv_systype in + NetBSD|FreeBSD) + DFT_DEP_SUFFIX='.so.$(ABI_VERSION)' ;; + HP_UX) 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 + +LIB_NAME=ncurses + + +LIB_DIR=../lib +LIB_PREFIX=$LIB_DIR/lib + + + +if test X"$CC_G_OPT" = X"" ; then + CC_G_OPT='-g' + test -n "$GCC" && test "${ac_cv_prog_cc_g}${ac_cv_prog_gcc_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}${ac_cv_prog_gxx_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 + + + + LOCAL_LDFLAGS= + LOCAL_LDFLAGS2= + + nc_cv_do_symlinks=no + nc_cv_rm_so_locs=no + + case $nc_cv_systype in + HP_UX) + # (tested with gcc 2.7.2 -- I don't have c89) + if test "${CC}" = "gcc"; then + CC_SHARED_OPTS='-fPIC' + else + CC_SHARED_OPTS='+Z' + fi + MK_SHARED_LIB='$(LD) -b -o $@' + ;; + IRIX*) + # tested with IRIX 5.2 and 'cc'. + if test "${CC}" = "gcc"; then + CC_SHARED_OPTS='-fPIC' + else + CC_SHARED_OPTS='-KPIC' + fi + MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $@` -o $@' + nc_cv_rm_so_locs=yes + ;; + Linux) + # tested with Linux 1.2.8 and gcc 2.7.0 (ELF) + CC_SHARED_OPTS='-fPIC' + MK_SHARED_LIB='gcc -o $@.$(REL_VERSION) -shared -Wl,-soname,`basename $@.$(ABI_VERSION)`,-stats' + if test $DFT_LWR_MODEL = "shared" ; then + LOCAL_LDFLAGS='-Wl,-rpath,../lib' + LOCAL_LDFLAGS2='-Wl,-rpath,../../lib' + fi + nc_cv_do_symlinks=yes + ;; + NetBSD|FreeBSD) + CC_SHARED_OPTS='-fpic -DPIC' + MK_SHARED_LIB='$(LD) -Bshareable -o $@' + ;; + OSF1|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) -o $@.$(REL_VERSION) -shared -soname `basename $@.$(ABI_VERSION)`' + if test $DFT_LWR_MODEL = "shared" ; then + LOCAL_LDFLAGS='-Wl,-rpath,../lib' + LOCAL_LDFLAGS2='-Wl,-rpath,../../lib' + fi + nc_cv_do_symlinks=yes + nc_cv_rm_so_locs=yes + ;; + SunOS) + # tested with SunOS 4.1.1 and gcc 2.7.0 + # tested with SunOS 5.3 (solaris 2.3) and gcc 2.7.0 + if test $ac_cv_prog_gcc = yes; then + CC_SHARED_OPTS='-fpic' + else + CC_SHARED_OPTS='-KPIC' + fi + case `uname -r` in + 4.*) + MK_SHARED_LIB='$(LD) -assert pure-text -o $@.$(REL_VERSION)' + ;; + 5.*) + MK_SHARED_LIB='$(LD) -d y -G -h `basename $@.$(ABI_VERSION)` -o $@.$(REL_VERSION)' + ;; + esac + nc_cv_do_symlinks=yes + ;; + 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 + + + + + + +if test "$CC_SHARED_OPTS" = "unknown"; then + for model in $nc_list_models; do + if test "$model" = "shared"; then + echo '** Shared libraries are not supported in this version' + exit 1 + fi + done +fi + +### use option --disable-overwrite to leave out the link to -lcurses +echo $ac_n "checking include directory""... $ac_c" 1>&6 +echo "configure:2039: checking include directory" >&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""$includedir" 1>&6 + +### use option --enable-big-core to make tic run faster on big machines +echo $ac_n "checking if big-core option selected""... $ac_c" 1>&6 +echo "configure:2056: 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 + with_big_core=no +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 termcap-fallback support is needed""... $ac_c" 1>&6 +echo "configure:2073: checking if termcap-fallback support is needed" >&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:2093: 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:2109: 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 +echo $ac_n "checking if tic should use symbolic links""... $ac_c" 1>&6 +echo "configure:2128: 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 +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:2145: 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:2162: 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 +test "$with_ext_const" = yes && cat >> confdefs.h <<\EOF +#define NCURSES_CONST const +EOF + + +### Enable compiling-in rcs id's +echo $ac_n "checking if RCS identifiers should be compiled-in""... $ac_c" 1>&6 +echo "configure:2179: 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=$enableval +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 + + +### 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" + nc_warn_CFLAGS="" +if test -n "$GCC" +then + cat > conftest.$ac_ext <&6 +echo "configure:2227: checking for gcc warning options" >&5 + nc_save_CFLAGS="$CFLAGS" + nc_warn_CFLAGS="-W -Wall" + nc_warn_CONST="" + test "$with_ext_const" = yes && nc_warn_CONST="Wwrite-strings" + for nc_opt in \ + Wbad-function-cast \ + Wcast-align \ + Wcast-qual \ + Winline \ + Wmissing-declarations \ + Wmissing-prototypes \ + Wnested-externs \ + Wpointer-arith \ + Wshadow \ + Wstrict-prototypes $nc_warn_CONST + do + CFLAGS="$nc_save_CFLAGS $nc_warn_CFLAGS -$nc_opt" + if { (eval echo configure:2245: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + test -n "$verbose" && echo "$ac_t""... -$nc_opt" 1>&6 + nc_warn_CFLAGS="$nc_warn_CFLAGS -$nc_opt" + fi + done + rm -f conftest* + CFLAGS="$nc_save_CFLAGS" +fi + +fi +cat > conftest.i <&6 +echo "configure:2272: checking for gcc __attribute__ directives" >&5 + cat > conftest.$ac_ext <&5 + case $nc_attribute in + scanf|printf) + cat >conftest.h <conftest.h <&5; (eval $ac_compile) 2>&5; }; then + test -n "$verbose" && echo "$ac_t""... $nc_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* + + + +### 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 +fi + +if test -n "$GCC" +then + if test -z "$with_assertions" + then + 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:2382: 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 < +/* 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:2410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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:2432: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 + +### Checks for header files. +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:2479: 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 < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +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 +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 +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 < +#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:2559: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./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:2587: 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 < +#include <$ac_hdr> +int main() { +DIR *dirp = 0; +; return 0; } +EOF +if { (eval echo configure:2600: \"$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 <&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:2625: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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:2666: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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:2709: checking for regular-expression headers" >&5 +if eval "test \"`echo '$''{'nc_cv_regex'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +cat > conftest.$ac_ext < +#include +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:2728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + nc_cv_regex="regex.h" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + cat > conftest.$ac_ext < +int main() { + + char *p = compile("", "", "", 0); + int x = step("", ""); + +; return 0; } +EOF +if { (eval echo configure:2747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + nc_cv_regex="regexp.h" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + cat > conftest.$ac_ext < +int main() { + + char *p = compile("", "", ""); + int x = step("", ""); + +; return 0; } +EOF +if { (eval echo configure:2766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + nc_cv_regex="regexpr.h" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + +fi + +echo "$ac_t""$nc_cv_regex" 1>&6 +case $nc_cv_regex in + regex.h) cat >> confdefs.h <<\EOF +#define HAVE_REGEX_H 1 +EOF + ;; + regexp.h) cat >> confdefs.h <<\EOF +#define HAVE_REGEXP_H 1 +EOF + ;; + regexpr.h) cat >> confdefs.h <<\EOF +#define HAVE_REGEXPR_H 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:2821: 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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +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 <&6 +fi +done + + +# check for HPUX's ANSI compiler +if test $nc_cv_systype = HP_UX; then +if test -z "$GCC"; then + echo $ac_n "checking for HP/UX ANSI compiler""... $ac_c" 1>&6 +echo "configure:2862: checking for HP/UX ANSI compiler" >&5 + nc_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Aa" + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + nc_hpux_cc=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + nc_hpux_cc=no +fi +rm -f conftest* + echo "$ac_t""$nc_hpux_cc" 1>&6 + if test $nc_hpux_cc = yes; then + cat >> confdefs.h <<\EOF +#define _HPUX_SOURCE 1 +EOF + + else + CFLAGS="$nc_save_CFLAGS" + fi +fi;fi + +# check for ISC (this may also define _POSIX_SOURCE) +# Note: even non-Posix ISC needs to declare fd_set +if test "$ISC" = yes ; then + echo $ac_n "checking for main in -lcposix""... $ac_c" 1>&6 +echo "configure:2898: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 <&6 +fi + + echo $ac_n "checking for bzero in -linet""... $ac_c" 1>&6 +echo "configure:2941: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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:2983: 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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2993: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +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 <&6 +fi +done + +fi + +# check for SCO. this is a hack, and should be split into individual +# features -- the sys/time.h and select.h conflict, and the need for +# ptem.h due to winsize struct. +echo "checking for SCO by checking on /usr/bin/scosh" 1>&6 +echo "configure:3025: checking for SCO by checking on /usr/bin/scosh" >&5 +# Extract the first word of "scosh", so it can be a program name with args. +set dummy scosh; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3029: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_COULD_BE_SCO'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$COULD_BE_SCO"; then + ac_cv_prog_COULD_BE_SCO="$COULD_BE_SCO" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_COULD_BE_SCO="maybe" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_COULD_BE_SCO" && ac_cv_prog_COULD_BE_SCO="maybenot" +fi +fi +COULD_BE_SCO="$ac_cv_prog_COULD_BE_SCO" +if test -n "$COULD_BE_SCO"; then + echo "$ac_t""$COULD_BE_SCO" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test "$COULD_BE_SCO" = "maybe" +then + cat >> confdefs.h <<\EOF +#define SYSTEM_LOOKS_LIKE_SCO 1 +EOF + +fi + +### 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 $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:3072: 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 <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:3126: \"$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:3147: 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 <&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 <> confdefs.h <<\EOF +#define CC_HAS_INLINE_FUNCS 1 +EOF + + +### Checks for external-data + +echo $ac_n "checking for errno external decl""... $ac_c" 1>&6 +echo "configure:3194: checking for errno external decl" >&5 +if eval "test \"`echo '$''{'nc_cv_extern_errno'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { +int x = errno +; return 0; } +EOF +if { (eval echo configure:3208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + nc_cv_extern_errno=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + nc_cv_extern_errno=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$nc_cv_extern_errno" 1>&6 +test $nc_cv_extern_errno = yes && cat >> confdefs.h <<\EOF +#define HAVE_EXTERN_ERRNO 1 +EOF + + + +echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6 +echo "configure:3229: checking declaration of sys_errlist" >&5 +if eval "test \"`echo '$''{'nc_cv_dcl_sys_errlist'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +#include +#include +int main() { + char *c = (char *) *sys_errlist; +; return 0; } +EOF +if { (eval echo configure:3245: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + nc_cv_dcl_sys_errlist=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + nc_cv_dcl_sys_errlist=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$nc_cv_dcl_sys_errlist" 1>&6 +test $nc_cv_dcl_sys_errlist = yes && cat >> confdefs.h <<\EOF +#define HAVE_EXTERN_SYS_ERRLIST 1 +EOF + + + +echo $ac_n "checking if data-only library module links""... $ac_c" 1>&6 +echo "configure:3266: checking if data-only library module links" >&5 +if eval "test \"`echo '$''{'nc_cv_link_dataonly'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + rm -f conftest.a + cat >conftest.$ac_ext <&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 <&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 + nc_saveLIBS="$LIBS" + LIBS="conftest.a $LIBS" + if test "$cross_compiling" = yes; then + nc_cv_link_dataonly=unknown +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + nc_cv_link_dataonly=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + nc_cv_link_dataonly=no +fi +rm -fr conftest* +fi + + LIBS="$nc_saveLIBS" + +fi + +echo "$ac_t""$nc_cv_link_dataonly" 1>&6 +test $nc_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:3341: checking for speed_t" >&5 +if eval "test \"`echo '$''{'nc_cv_type_speed_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +#if HAVE_TERMIOS_H +#include +#endif +int main() { +speed_t x = 0 +; return 0; } +EOF +if { (eval echo configure:3358: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + nc_cv_type_speed_t=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + nc_cv_type_speed_t=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$nc_cv_type_speed_t" 1>&6 +test $nc_cv_type_speed_t != yes && cat >> confdefs.h <<\EOF +#define speed_t unsigned +EOF + + + +### Checks for library functions. +for ac_func in \ +getttynam \ +memccpy \ +poll \ +select \ +setbuf \ +setbuffer \ +setvbuf \ +sigaction \ +sigvec \ +strdup \ +tcgetattr \ +times \ +usleep \ +vfscanf \ +vsscanf \ + +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3398: 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 < +/* 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:3426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 <&6 +fi +done + + +if test $ac_cv_func_sigaction = yes; then +echo $ac_n "checking whether sigaction needs _POSIX_SOURCE""... $ac_c" 1>&6 +echo "configure:3453: checking whether sigaction needs _POSIX_SOURCE" >&5 +cat > conftest.$ac_ext < +#include +int main() { +struct sigaction act; +; return 0; } +EOF +if { (eval echo configure:3463: \"$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* + sigact_bad=yes cat >> confdefs.h <<\EOF +#define SVR4_ACTION 1 +EOF + +fi +rm -f conftest* +echo "$ac_t""$sigact_bad" 1>&6 +fi + +# some machines require _POSIX_SOURCE to completely define 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 + echo $ac_n "checking whether termios.h needs _POSIX_SOURCE""... $ac_c" 1>&6 +echo "configure:3488: checking whether termios.h needs _POSIX_SOURCE" >&5 + cat > conftest.$ac_ext < +int main() { +struct termios foo; int x = foo.c_iflag +; return 0; } +EOF +if { (eval echo configure:3497: \"$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 < +int main() { +struct termios foo; int x = foo.c_iflag +; return 0; } +EOF +if { (eval echo configure:3515: \"$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:3539: 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 < +/* 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:3561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./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:3586: 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 < +#include +#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:3608: \"$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 <&6 +echo "configure:3628: checking for type sigaction_t" >&5 +if eval "test \"`echo '$''{'nc_cv_type_sigaction'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { +sigaction_t x +; return 0; } +EOF +if { (eval echo configure:3642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + nc_cv_type_sigaction=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + nc_cv_type_sigaction=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$nc_cv_type_sigaction" 1>&6 +test $nc_cv_type_sigaction = yes && cat >> confdefs.h <<\EOF +#define HAVE_TYPE_SIGACTION 1 +EOF + + + +echo $ac_n "checking for working TIOCGWINSZ""... $ac_c" 1>&6 +echo "configure:3663: checking for working TIOCGWINSZ" >&5 +if eval "test \"`echo '$''{'nc_cv_use_tiocgwinsz'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + if test "$cross_compiling" = yes; then + nc_cv_use_tiocgwinsz=unknown +else + cat > conftest.$ac_ext < +#endif +#if SYSTEM_LOOKS_LIKE_SCO +/* they neglected to define struct winsize in termios.h -- it's only + in termio.h */ +#include +#include +#endif +#if !defined(sun) || !defined(HAVE_TERMIOS_H) +#include +#endif +int main() +{ + static struct winsize size; + int fd; + for (fd = 0; fd <= 2; fd++) { /* try in/out/err in case redirected */ + if (ioctl(0, TIOCGWINSZ, &size) == 0 + && size.ws_row > 0 + && size.ws_col > 0) + exit(0); + } + exit(0); /* in either case, it compiles & links ... */ +} + +EOF +if { (eval echo configure:3701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + nc_cv_use_tiocgwinsz=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + nc_cv_use_tiocgwinsz=no +fi +rm -fr conftest* +fi + + +fi + +echo "$ac_t""$nc_cv_use_tiocgwinsz" 1>&6 +test $nc_cv_use_tiocgwinsz != yes && cat >> confdefs.h <<\EOF +#define BROKEN_TIOCGWINSZ 1 +EOF + + + +case "$nc_cv_systype" in +Linux) + cat >> confdefs.h <<\EOF +#define GOOD_SELECT 1 +EOF + + ;; +esac + +if test -z "$nc_user_CFLAGS" ; then + CFLAGS=`echo ${CFLAGS} | sed -e 's/-g //' -e 's/-g$//'` + CXXFLAGS=`echo ${CXXFLAGS} | sed -e 's/-g //' -e 's/-g$//'` +fi + +if test -n "$CXX" ; then + # Extract the first word of "$CXX", so it can be a program name with args. +set dummy $CXX; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3741: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CXX_EXISTS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CXX_EXISTS"; then + ac_cv_prog_CXX_EXISTS="$CXX_EXISTS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CXX_EXISTS="yes" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_CXX_EXISTS" && ac_cv_prog_CXX_EXISTS="no" +fi +fi +CXX_EXISTS="$ac_cv_prog_CXX_EXISTS" +if test -n "$CXX_EXISTS"; then + echo "$ac_t""$CXX_EXISTS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + ac_cv_prog_CXX_EXISTS=no +fi +if test "$ac_cv_prog_CXX_EXISTS" = yes; 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 $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + + +nc_cxx_library=unknown +if test $ac_cv_prog_gxx = yes; then + echo $ac_n "checking for libg++""... $ac_c" 1>&6 +echo "configure:3782: checking for libg++" >&5 + nc_save="$LIBS" + LIBS="$LIBS -lg++ -lm" + cat > conftest.$ac_ext < + +int main() { +float foo=abs(1.0) +; return 0; } +EOF +if { (eval echo configure:3795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + nc_cxx_library=yes + CXXLIBS="$CXXLIBS -lg++ -lm" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + nc_cxx_library=no +fi +rm -f conftest* + LIBS="$nc_save" + echo "$ac_t""$nc_cxx_library" 1>&6 +fi + + echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 +echo "configure:3811: 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 $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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +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" +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:3851: 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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3861: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +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 <&6 +fi +done + + +echo $ac_n "checking for builtin c++ bool type""... $ac_c" 1>&6 +echo "configure:3889: checking for builtin c++ bool type" >&5 +if eval "test \"`echo '$''{'nc_cv_builtin_bool'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + nc_cv_builtin_bool=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + nc_cv_builtin_bool=0 +fi +rm -f conftest* + +fi + +if test $nc_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 c++ bool""... $ac_c" 1>&6 +echo "configure:3922: checking for size of c++ bool" >&5 +if eval "test \"`echo '$''{'nc_cv_type_of_bool'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + rm -f nc_test.out + if test "$cross_compiling" = yes; then + nc_cv_type_of_bool=unknown +else + cat > conftest.$ac_ext < +#include +#if HAVE_BUILTIN_H +#include +#endif +main() +{ + FILE *fp = fopen("nc_test.out", "w"); + if (fp != 0) { + bool x = false; + 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:3958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + nc_cv_type_of_bool=`cat nc_test.out` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + nc_cv_type_of_bool=unknown +fi +rm -fr conftest* +fi + + +fi + + rm -f nc_test.out +echo "$ac_t""$nc_cv_type_of_bool" 1>&6 +if test $nc_cv_type_of_bool = unknown ; then + echo "configure: warning: Assuming unsigned for type of bool" 1>&2 + nc_cv_type_of_bool=unsigned +fi + +else + nc_cxx_library=no + if eval "test \"`echo '$''{'nc_cv_builtin_bool'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + nc_cv_builtin_bool=0 +fi + + if eval "test \"`echo '$''{'nc_cv_sizeof_bool'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + nc_cv_sizeof_bool=int +fi + +fi + + +nc_ada_make=gnatmake +# Extract the first word of "$nc_ada_make", so it can be a program name with args. +set dummy $nc_ada_make; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4001: 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="${IFS}:" + for ac_dir in $PATH; 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 + nc_ada_make= +else + +nc_cv_gnat_version=`$nc_ada_make -v 2>&1 | grep '[0-9].[0-9][0-9]*' |\ + sed -e 's/[^0-9 \.]//g' | $AWK '{print $1;}'` +case $nc_cv_gnat_version in + 3.0[5-9]|3.[1-9]*|[4-9].*) + ac_cv_prog_gnat_correct=yes + ;; + *) echo Unsupported GNAT version $nc_cv_gnat_version. Disabling Ada95 binding. + ac_cv_prog_gnat_correct=no + ;; +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:4045: 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="${IFS}:" + for ac_dir in $PATH; 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 + ac_cv_prog_gnat_correct=no + echo Ada95 binding required program m4 not found. Ada95 binding disabled. + fi +fi +if test "$ac_cv_prog_gnat_correct" = yes; then + nc_ada_compiler=gcc + nc_ada_package=terminal_interface + + + + +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 "$nc_cv_sizeof_bool" != "char"; then + nc_warn_CFLAGS="$nc_warn_CFLAGS -Wconversion" + fi + ;; + 2.5*) + nc_warn_CFLAGS="$nc_warn_CFLAGS -Wconversion" + ;; + esac + fi +fi + +### 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 + + + +### 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:4145: checking for src modules" >&5 +TEST_DEPS="${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX}" +TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX}" +nc_cv_src_modules= +for nc_dir in ncurses progs panel menu form +do + if test -f $srcdir/$nc_dir/modules; then + if test -z "$nc_cv_src_modules"; then + nc_cv_src_modules=$nc_dir + else + nc_cv_src_modules="$nc_cv_src_modules $nc_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 -f $srcdir/${nc_dir}/${nc_dir}.h; then + +nc_have_include=`echo $nc_dir |tr '[a-z]' '[A-Z]'` + + cat >> confdefs.h <> confdefs.h <&6 +TEST_ARGS="-L${LIB_DIR} $TEST_ARGS" + + + +SRC_SUBDIRS="man include" +for nc_dir in $nc_cv_src_modules +do + SRC_SUBDIRS="$SRC_SUBDIRS $nc_dir" +done +SRC_SUBDIRS="$SRC_SUBDIRS misc test" +test $nc_cxx_library != no && SRC_SUBDIRS="$SRC_SUBDIRS c++" + +ADA_SUBDIRS= +if test "$ac_cv_prog_gnat_correct" = yes && test -d $srcdir/Ada95; then + SRC_SUBDIRS="$SRC_SUBDIRS Ada95" + ADA_SUBDIRS="gen ada_include samples" +fi + +SUB_MAKEFILES= +for nc_dir in $SRC_SUBDIRS +do + SUB_MAKEFILES="$SUB_MAKEFILES $nc_dir/Makefile" +done + +if test -n "$ADA_SUBDIRS"; then + for nc_dir in $ADA_SUBDIRS + do + SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$nc_dir/Makefile" + done + +fi + + +DIRS_TO_MAKE="lib" +for nc_item in $nc_list_models +do + + case $nc_item in + normal) nc_subdir='objects' ;; + debug) nc_subdir='obj_g' ;; + profile) nc_subdir='obj_p' ;; + shared) nc_subdir='obj_s' ;; + esac + + DIRS_TO_MAKE="$DIRS_TO_MAKE $nc_subdir" +done +for nc_dir in $DIRS_TO_MAKE +do + test ! -d $nc_dir && mkdir $nc_dir +done + + + +### Now that we're done running tests, add the compiler-warnings, if any +CFLAGS="$CFLAGS $nc_warn_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) 2>&1 | grep '^ac_space='` 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 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# 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 </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.12.970309" + 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/config_h \ + include/MKterm.h.awk \ + include/curses.h \ + include/termcap.h \ + include/unctrl.h \ + $SUB_MAKEFILES \ + Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%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%@nc_cv_rel_version@%$nc_cv_rel_version%g +s%@nc_cv_abi_version@%$nc_cv_abi_version%g +s%@nc_cv_builtin_bool@%$nc_cv_builtin_bool%g +s%@nc_cv_type_of_bool@%$nc_cv_type_of_bool%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@CXX@%$CXX%g +s%@AWK@%$AWK%g +s%@SET_MAKE@%$SET_MAKE%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%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%@nc_cv_makeflags@%$nc_cv_makeflags%g +s%@INSTALL_PREFIX@%$INSTALL_PREFIX%g +s%@EXTRA_LIBS@%$EXTRA_LIBS%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%@nc_list_models@%$nc_list_models%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%@MK_SHARED_LIB@%$MK_SHARED_LIB%g +s%@LOCAL_LDFLAGS@%$LOCAL_LDFLAGS%g +s%@LOCAL_LDFLAGS2@%$LOCAL_LDFLAGS2%g +s%@ECHO_LINK@%$ECHO_LINK%g +s%@COULD_BE_SCO@%$COULD_BE_SCO%g +s%@CXX_EXISTS@%$CXX_EXISTS%g +s%@CXXCPP@%$CXXCPP%g +s%@CXXLIBS@%$CXXLIBS%g +s%@gnat_exists@%$gnat_exists%g +s%@m4_exists@%$m4_exists%g +s%@nc_ada_make@%$nc_ada_make%g +s%@nc_ada_compiler@%$nc_ada_compiler%g +s%@nc_ada_package@%$nc_ada_package%g +s%@ADAFLAGS@%$ADAFLAGS%g +s%@ACPPFLAGS@%$ACPPFLAGS%g +s%@TEST_DEPS@%$TEST_DEPS%g +s%@TEST_ARGS@%$TEST_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 <> $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* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + + + + + +for nc_dir in $SRC_SUBDIRS +do + if test -f $srcdir/$nc_dir/modules; then + + nc_libs_to_make= + for nc_item in $NC_LIST_MODELS + do + + + + case $nc_item in + normal) nc_suffix='.a' ;; + debug) nc_suffix='_g.a' ;; + profile) nc_suffix='_p.a' ;; + shared) + case $nc_cv_systype in + NetBSD|FreeBSD) + nc_suffix='.so.$(ABI_VERSION)' ;; + HP_UX) nc_suffix='.sl' ;; + *) nc_suffix='.so' ;; + esac + esac + + nc_libs_to_make="$nc_libs_to_make ../lib/lib${nc_dir}${nc_suffix}" + done + + sed -e "s@\@LIBS_TO_MAKE\@@$nc_libs_to_make@" \ + $nc_dir/Makefile >$nc_dir/Makefile.out + mv $nc_dir/Makefile.out $nc_dir/Makefile + + $AWK -f $srcdir/mk-0th.awk \ + name=$nc_dir \ + $srcdir/$nc_dir/modules >>$nc_dir/Makefile + + for nc_item in $NC_LIST_MODELS + do + echo 'Appending rules for '$nc_item' model ('$nc_dir')' + +NC_ITEM=`echo $nc_item |tr '[a-z]' '[A-Z]'` + + + + + case $nc_item in + normal) nc_suffix='.a' ;; + debug) nc_suffix='_g.a' ;; + profile) nc_suffix='_p.a' ;; + shared) + case $nc_cv_systype in + NetBSD|FreeBSD) + nc_suffix='.so.$(ABI_VERSION)' ;; + HP_UX) nc_suffix='.sl' ;; + *) nc_suffix='.so' ;; + esac + esac + + + case $nc_item in + normal) nc_subdir='objects' ;; + debug) nc_subdir='obj_g' ;; + profile) nc_subdir='obj_p' ;; + shared) nc_subdir='obj_s' ;; + esac + + + # These dependencies really are for development, not + # builds, but they are useful in porting, too. + nc_depend="../include/ncurses_cfg.h" + if test "$srcdir" = "."; then + nc_reldir="." + else + nc_reldir="\$(srcdir)" + fi + if test -f $srcdir/$nc_dir/$nc_dir.priv.h; then + nc_depend="$nc_depend $nc_reldir/$nc_dir.priv.h" + elif test -f $srcdir/$nc_dir/curses.priv.h; then + nc_depend="$nc_depend $nc_reldir/curses.priv.h" + fi + $AWK -f $srcdir/mk-1st.awk \ + name=$nc_dir \ + MODEL=$NC_ITEM \ + model=$nc_subdir \ + suffix=$nc_suffix \ + DoLinks=$nc_cv_do_symlinks \ + rmSoLocs=$nc_cv_rm_so_locs \ + overwrite=$WITH_OVERWRITE \ + depend="$nc_depend" \ + $srcdir/$nc_dir/modules >>$nc_dir/Makefile + test $nc_dir = ncurses && WITH_OVERWRITE=no + $AWK -f $srcdir/mk-2nd.awk \ + name=$nc_dir \ + MODEL=$NC_ITEM \ + model=$nc_subdir \ + srcdir=$srcdir \ + echo=$WITH_ECHO \ + $srcdir/$nc_dir/modules >>$nc_dir/Makefile + done + fi + + echo ' cd '$nc_dir'; $(MAKE) $(NC_MFLAGS) $@' >>Makefile +done + +for nc_dir in $SRC_SUBDIRS +do + if test -f $srcdir/$nc_dir/modules; then + echo >> Makefile + if test -f $srcdir/$nc_dir/headers; then +cat >> Makefile <> Makefile +fi +cat >> Makefile <> Makefile <> Makefile <headers.sh </<\$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 +NC_EOF + +chmod 0755 headers.sh + +for nc_dir in $SRC_SUBDIRS +do + if test -f $srcdir/$nc_dir/headers; then + cat >>$nc_dir/Makefile <>$nc_dir/Makefile + j=$i + done + echo " $j" >>$nc_dir/Makefile + for i in `cat $srcdir/$nc_dir/headers |fgrep -v "#"` + do + echo " @ ../headers.sh \$(INSTALL_DATA) \$(INSTALL_PREFIX)\$(includedir) \$(srcdir) $i" >>$nc_dir/Makefile + done + fi +done + + + +### Special editing. We generate ncurses_cfg.h directly to allow all filenames +### to be MSDOS-compatible, as well as to make the list of definitions be +### dynamically determined by the configuration script -- a consideration when +### doing type-clean development testing. + +echo creating include/ncurses_cfg.h +rm -f include/ncurses_cfg.h +echo "/* generated by configure-script + * On host: $SYS_NAME + */ +#ifndef NC_CONFIG_H +#define NC_CONFIG_H" >include/ncurses_cfg.h +sed -e '/^ -D/!d' \ + -e 's/ -D/\ +#define /g' \ + -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \ + -e 's/\\//g' \ + include/config_h | sort >>include/ncurses_cfg.h +echo " + /* 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 */" >> include/ncurses_cfg.h +echo removing include/config_h +rm include/config_h + +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 preinstall diff --git a/configure.in b/configure.in new file mode 100644 index 00000000..3e202a79 --- /dev/null +++ b/configure.in @@ -0,0 +1,658 @@ +dnl***************************************************************************** +dnl Copyright 1996,1997 by Thomas E. Dickey * +dnl All Rights Reserved. * +dnl * +dnl Permission to use, copy, modify, and distribute this software and its * +dnl documentation for any purpose and without fee is hereby granted, provided * +dnl that the above copyright notice appear in all copies and that both that * +dnl copyright notice and this permission notice appear in supporting * +dnl documentation, and that the name of the above listed copyright holder(s) * +dnl not be used in advertising or publicity pertaining to distribution of the * +dnl software without specific, written prior permission. THE ABOVE LISTED * +dnl COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * +dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * +dnl EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * +dnl SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * +dnl RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * +dnl CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * +dnl CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * +dnl***************************************************************************** +dnl $Id: configure.in,v 1.64 1997/05/10 15:26:07 tom Exp $ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.12) +AC_REVISION($Revision: 1.64 $) +AC_INIT(ncurses/lib_initscr.c) + +NC_VERSION +NC_SYSTYPE + +# 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 +if test -f $srcdir/../glibcbug.in; 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 +fi +changequote([,])dnl + +### Save the given $CFLAGS to allow user-override. +nc_user_CFLAGS="$CFLAGS" + +### Derive the system name, as a check for reusing the autoconf cache +system_name="`(uname -s -r || hostname || echo unknown) 2>/dev/null`" +if test -n "$system_name" ; then + AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") +else + system_name="`(hostname) 2>/dev/null`" +fi +AC_CACHE_VAL(nc_cv_system_name,[nc_cv_system_name="$system_name"]) +test -z "$system_name" && system_name="$nc_cv_system_name" +test -n "$nc_cv_system_name" && AC_MSG_RESULT("Configuring for $nc_cv_system_name") + +if test ".$system_name" != ".$nc_cv_system_name" ; then + AC_MSG_RESULT("Cached system name does not agree with actual") + AC_ERROR("Please remove config.cache and try again.") +fi + +### Default install-location +NC_CFG_DEFAULTS + +### Checks for programs. +AC_PROG_CC +if test -n "$GCC" ; then +AC_MSG_CHECKING(version of gcc) +eval "$CC --version" +fi +AC_PROG_CPP +AC_PROG_GCC_TRADITIONAL +AC_ISC_POSIX + +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_ARG_WITH(cxx, + [ --without-cxx suppress check for C++]) +if test "X$withval" != 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; nc_cxx_library=no ; echo No: templates do not work;; esac; fi +changequote([,])dnl +AC_PROG_AWK +AC_PROG_MAKE_SET +NC_PROG_INSTALL +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 +NC_SUBST(loader,LD,ld) +NC_SUBST(archiver,AR,ar) +NC_SUBST(archiver options,AR_OPTS,rv) + +NC_MAKEFLAGS +NC_MAN_PAGES + +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_ARG_WITH(install-prefix, + [ --with-install-prefix prefixes actual install-location], + [case "$withval" in #(vi + yes|no) #(vi + ;; + *) INSTALL_PREFIX="$withval" + ;; + esac]) +AC_SUBST(INSTALL_PREFIX) + +### 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. +nc_list_models="" +AC_ARG_WITH(shared, + [ --with-shared generate shared-libraries], + [test "$withval" = "yes" && nc_list_models="$nc_list_models shared"]) +AC_ARG_WITH(normal, + [ --with-normal generate normal-libraries (default)], + [test "$withval" = "yes" && nc_list_models="$nc_list_models normal"], + [nc_list_models="$nc_list_models normal"]) +AC_ARG_WITH(debug, + [ --with-debug generate debug-libraries (default)], + [test "$withval" = "yes" && nc_list_models="$nc_list_models debug"], + [nc_list_models="$nc_list_models debug"]) +AC_ARG_WITH(profile, + [ --with-profile generate profile-libraries], + [test "$withval" = "yes" && nc_list_models="$nc_list_models profile"]) + +### Checks for special libraries, must be done up-front. +AC_ARG_WITH(dbmalloc, + [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], + [AC_CHECK_LIB(dbmalloc,debug_malloc)]) +AC_ARG_WITH(dmalloc, + [ --with-dmalloc test: use Gray Watson's dmalloc library], + [AC_CHECK_LIB(dmalloc,dmalloc_debug)]) +AC_ARG_WITH(gpm, + [ --with-gpm use Alessandro Rubini's GPM library], + [AC_CHECK_LIB(gpm,Gpm_Open,[ + EXTRA_LIBS="$EXTRA_LIBS -lgpm -lncurses" + AC_DEFINE(HAVE_LIBGPM) + AC_CHECK_HEADERS(gpm.h) + ],,-lcurses -ltermcap)]) + +AC_SUBST(EXTRA_LIBS) + +AC_MSG_CHECKING(for specified models) +test -z "$nc_list_models" && nc_list_models=normal +AC_MSG_RESULT($nc_list_models) + +### Use the first model as the default, and save its suffix for use in building +### up test-applications. +DFT_LWR_MODEL=`echo $nc_list_models | $AWK '{print $1}'` +NC_UPPERCASE($DFT_LWR_MODEL,DFT_UPR_MODEL)dnl +NC_LIB_SUFFIX($DFT_LWR_MODEL,DFT_DEP_SUFFIX)dnl +NC_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl +NC_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(nc_list_models)dnl the complete list of models ("normal debug") + +LIB_NAME=ncurses +AC_SUBST(LIB_NAME) + +LIB_DIR=../lib +LIB_PREFIX=$LIB_DIR/lib +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}${ac_cv_prog_gcc_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}${ac_cv_prog_gxx_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) +NC_SHARED_OPTS + +if test "$CC_SHARED_OPTS" = "unknown"; then + for model in $nc_list_models; do + if test "$model" = "shared"; then + echo '** Shared libraries are not supported in this version' + exit 1 + fi + done +fi + +### use option --disable-overwrite to leave out the link to -lcurses +AC_MSG_CHECKING(include directory) +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($includedir) + +### use option --enable-big-core to make tic run faster on big machines +AC_MSG_CHECKING(if big-core option selected) +AC_ARG_ENABLE(big-core, + [ --enable-big-core assume machine has lots of memory], + [with_big_core=$enableval], + [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 termcap-fallback support is needed) +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 +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) +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) +test "$with_ext_const" = yes && AC_DEFINE(NCURSES_CONST,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 build: compile-in RCS identifiers], + [with_rcs_ids=$enableval], + [with_rcs_ids=no]) +AC_MSG_RESULT($with_rcs_ids) +test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS) + +### 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" + NC_GCC_WARNINGS +fi +NC_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]) +if test -n "$GCC" +then + if test -z "$with_assertions" + then + 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 + +### Checks for header files. +AC_STDC_HEADERS +AC_HEADER_DIRENT +NC_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 HPUX's ANSI compiler +if test $nc_cv_systype = HP_UX; then +if test -z "$GCC"; then + AC_MSG_CHECKING([for HP/UX ANSI compiler]) + nc_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Aa" + AC_TRY_COMPILE([],[void (*f)(void)=0],[nc_hpux_cc=yes],[nc_hpux_cc=no]) + AC_MSG_RESULT($nc_hpux_cc) + if test $nc_hpux_cc = yes; then + AC_DEFINE(_HPUX_SOURCE) + else + CFLAGS="$nc_save_CFLAGS" + fi +fi;fi + +# check for ISC (this may also define _POSIX_SOURCE) +# Note: even non-Posix ISC needs 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 + +# check for SCO. this is a hack, and should be split into individual +# features -- the sys/time.h and select.h conflict, and the need for +# ptem.h due to winsize struct. +AC_CHECKING([for SCO by checking on /usr/bin/scosh]) +AC_PROGRAM_CHECK(COULD_BE_SCO, [scosh], maybe, maybenot) +if test "$COULD_BE_SCO" = "maybe" +then + AC_DEFINE(SYSTEM_LOOKS_LIKE_SCO) +fi + +### 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) + +### Checks for external-data +NC_ERRNO +NC_SYS_ERRLIST +NC_LINK_DATAONLY +NC_SPEED_TYPE + +### Checks for library functions. +AC_CHECK_FUNCS( \ +getttynam \ +memccpy \ +poll \ +select \ +setbuf \ +setbuffer \ +setvbuf \ +sigaction \ +sigvec \ +strdup \ +tcgetattr \ +times \ +usleep \ +vfscanf \ +vsscanf \ +) + +if test $ac_cv_func_sigaction = yes; then +AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE) +AC_TRY_COMPILE([#include +#include ], [struct sigaction act;], + sigact_bad=no, sigact_bad=yes AC_DEFINE(SVR4_ACTION)) +AC_MSG_RESULT($sigact_bad) +fi + +# some machines require _POSIX_SOURCE to completely define 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 ], + [struct termios foo; int x = foo.c_iflag], + termios_bad=no, [ + AC_TRY_COMPILE([ +#define _POSIX_SOURCE +#include ], + [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 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 +NC_TYPE_SIGACTION +NC_TIOCGWINSZ + +dnl FIXME checks we don't do (but neither does the old Configure script): +case "$nc_cv_systype" in +Linux) + AC_DEFINE(GOOD_SELECT) + ;; +esac + +dnl We'll do our own -g libraries, unless the user's overridden via $CFLAGS +if test -z "$nc_user_CFLAGS" ; then + NC_STRIP_G_OPT(CFLAGS) + NC_STRIP_G_OPT(CXXFLAGS) +fi + +dnl Check for C++ compiler characteristics (and ensure that it's there!) +if test -n "$CXX" ; then + AC_CHECK_PROG(CXX_EXISTS, $CXX, yes, no) +else + ac_cv_prog_CXX_EXISTS=no +fi +if test "$ac_cv_prog_CXX_EXISTS" = yes; then + AC_LANG_CPLUSPLUS + NC_CXX_LIBRARY + AC_CHECK_HEADERS(builtin.h typeinfo) + NC_BOOL_DECL + NC_BOOL_SIZE +else + nc_cxx_library=no + AC_CACHE_VAL(nc_cv_builtin_bool,[nc_cv_builtin_bool=0]) + AC_CACHE_VAL(nc_cv_sizeof_bool,[nc_cv_sizeof_bool=int]) +fi +AC_SUBST(CXXLIBS) + +dnl Check for availability of GNU Ada Translator (GNAT). +dnl At the moment we support no other Ada95 compiler. +nc_ada_make=gnatmake +AC_CHECK_PROG(gnat_exists, $nc_ada_make, yes, no) +if test "$ac_cv_prog_gnat_exists" = no; then + nc_ada_make= +else + NC_GNAT_VERSION + AC_CHECK_PROG(m4_exists, m4, yes, no) + if test "$ac_cv_prog_m4_exists" = no; then + ac_cv_prog_gnat_correct=no + echo Ada95 binding required program m4 not found. Ada95 binding disabled. + fi +fi +if test "$ac_cv_prog_gnat_correct" = yes; then + nc_ada_compiler=gcc + nc_ada_package=terminal_interface + AC_SUBST(nc_ada_make) + AC_SUBST(nc_ada_compiler) + AC_SUBST(nc_ada_package) + AC_SUBST(ADAFLAGS) +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 "$nc_cv_sizeof_bool" != "char"; then + nc_warn_CFLAGS="$nc_warn_CFLAGS -Wconversion" + fi + ;; + 2.5*) + nc_warn_CFLAGS="$nc_warn_CFLAGS -Wconversion" + ;; + esac + fi +fi + +### Construct the list of include-directories to be generated +NC_INCLUDE_DIRS +NC_ADA_INCLUDE_DIRS + +### Construct the list of subdirectories for which we'll customize makefiles +### with the appropriate compile-rules. +NC_SRC_MODULES(ncurses progs panel menu form) +NC_DIRS_TO_MAKE + +### Now that we're done running tests, add the compiler-warnings, if any +CFLAGS="$CFLAGS $nc_warn_CFLAGS" + +################################################################################ +changequote({,})dnl +AC_OUTPUT(include/config_h \ + include/MKterm.h.awk \ + include/curses.h \ + include/termcap.h \ + include/unctrl.h \ + $SUB_MAKEFILES \ + Makefile,{ + +NC_LIB_RULES + +### Special editing. We generate ncurses_cfg.h directly to allow all filenames +### to be MSDOS-compatible, as well as to make the list of definitions be +### dynamically determined by the configuration script -- a consideration when +### doing type-clean development testing. + +echo creating include/ncurses_cfg.h +rm -f include/ncurses_cfg.h +echo "/* generated by configure-script + * On host: $SYS_NAME + */ +#ifndef NC_CONFIG_H +#define NC_CONFIG_H" >include/ncurses_cfg.h +sed -e '/^ -D/!d' \ + -e 's/ -D/\ +#define /g' \ + -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \ + -e 's/\\//g' \ + include/config_h | sort >>include/ncurses_cfg.h +echo " + /* 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 */" >> include/ncurses_cfg.h +echo removing include/config_h +rm include/config_h +},{ +### Special initialization commands, used to pass information from the +### configuration-run into config.status + +SYS_NAME="`(uname -a || hostname) 2>/dev/null | sed 1q`" +if test -z "\$SYS_NAME"; then SYS_NAME=unknown;fi + +AWK=$AWK +DFT_LWR_MODEL="$DFT_LWR_MODEL" +NC_LIST_MODELS="$nc_list_models" +WITH_ECHO="$with_echo" +WITH_OVERWRITE="$with_overwrite" +SRC_SUBDIRS="$SRC_SUBDIRS" +nc_cxx_library="$nc_cxx_library" +nc_cv_systype="$nc_cv_systype" +nc_cv_rel_version="$nc_cv_rel_version" +nc_cv_abi_version="$nc_cv_abi_version" +nc_cv_do_symlinks="$nc_cv_do_symlinks" +nc_cv_rm_so_locs="$nc_cv_rm_so_locs" + +})dnl +changequote([,])dnl +make preinstall diff --git a/dist.mk b/dist.mk new file mode 100644 index 00000000..91d0b25a --- /dev/null +++ b/dist.mk @@ -0,0 +1,56 @@ +# $Id: dist.mk,v 1.38 1997/05/16 00:33:41 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 = 4 +NCURSES_MINOR = 1 +NCURSES_PATCH = 970515 + +# 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 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 + +TAGS: + etags */*.[ch] + +# Makefile ends here diff --git a/form/Makefile.in b/form/Makefile.in new file mode 100644 index 00000000..054b7b58 --- /dev/null +++ b/form/Makefile.in @@ -0,0 +1,126 @@ +# $Id: Makefile.in,v 1.17 1997/05/05 22:39:30 tom Exp $ +################################################################################ +# Copyright 1996,1997 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# 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_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@ + +MK_SHARED_LIB = @MK_SHARED_LIB@ +REL_VERSION = @nc_cv_rel_version@ +ABI_VERSION = @nc_cv_abi_version@ + +RANLIB = @RANLIB@ + +LIBRARIES = @LIBS_TO_MAKE@ + +LINT = @LINT@ +LINT_OPTS = @LINT_OPTS@ +LINT_LIBS = -lform -lncurses @LIBS@ + +################################################################################ +all \ +install :: ../include/form.h $(LIBRARIES) + +$(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] + +clean :: + -rm -f tags TAGS *~ ../include/form.h + +distclean :: clean + -rm -f Makefile + +mostlyclean :: clean + +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/form/READ.ME b/form/READ.ME new file mode 100644 index 00000000..bb26b1cb --- /dev/null +++ b/form/READ.ME @@ -0,0 +1,19 @@ +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). This system was used together +with an NCR3000 system to compile the clone using original curses +implementation and to run various programs to check the compatibility of +this clone with the original libform library. + +The development environment was an ELF based Linux system, the German +Unifix distribution (aka Linux FT). + +For things that still need doing, see the TO-DO file in the top-level +directory. + +Juergen Pfeifer + +eMail: Juergen.Pfeifer@T-Online.de + diff --git a/form/fld_def.c b/form/fld_def.c new file mode 100644 index 00000000..9b88ee3f --- /dev/null +++ b/form/fld_def.c @@ -0,0 +1,661 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses form library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_def.c,v 1.6 1997/05/01 16:47:54 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 : static TypeArgument *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. ++--------------------------------------------------------------------------*/ +static TypeArgument* 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 = Make_Argument(typ->left ,ap,err); + p->right = Make_Argument(typ->right,ap,err); + return p; + } + else + *err += 1; + } else + { + if ( !(res=(TypeArgument *)typ->makearg(ap)) ) + *err += 1; + } + } + return res; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static TypeArgument *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. ++--------------------------------------------------------------------------*/ +static TypeArgument *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 = Copy_Argument(typ,argp->left ,err); + p->right = Copy_Argument(typ,argp->right,err); + return p; + } + *err += 1; + } + else + { + if (!(res = (TypeArgument *)(typ->copyarg((const void *)argp)))) + *err += 1; + } + } + return res; +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Free_Argument( +| const FIELDTYPE *typ, +| TypeArgument * argp ) +| +| Description : Release memory associated with the argument structure +| for the given fieldtype. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +static void Free_Argument(const FIELDTYPE * typ, TypeArgument * argp) +{ + if (!typ || !(typ->status & _HAS_ARGS)) + return; + + if (typ->status & _LINKED_TYPE) + { + assert(argp); + Free_Argument(typ->left ,argp->left ); + Free_Argument(typ->right,argp->right); + free(argp); + } + else + { + typ->freearg((void *)argp); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static bool Copy_Type( FIELD *new, FIELD const *old ) +| +| Description : Copy argument structure of field old to field new +| +| Return Values : TRUE - copy worked +| FALSE - error occured ++--------------------------------------------------------------------------*/ +static bool Copy_Type(FIELD *new, FIELD const *old) +{ + int err = 0; + + assert(new && old); + + new->type = old->type; + new->arg = (void *)Copy_Argument(old->type,(TypeArgument *)(old->arg),&err); + + if (err) + { + Free_Argument(new->type,(TypeArgument *)(new->arg)); + new->type = (FIELDTYPE *)0; + new->arg = (void *)0; + return FALSE; + } + else + { + if (new->type) + new->type->ref++; + return TRUE; + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static void Free_Type( FIELD *field ) +| +| Description : Release Argument structure for this field +| +| Return Values : - ++--------------------------------------------------------------------------*/ +INLINE static void Free_Type(FIELD *field) +{ + assert(field); + if (field->type) + field->type->ref--; + 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 (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 : 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 = 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 (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; +} + +/*--------------------------------------------------------------------------- +| 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 = 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 (Copy_Type(New_Field,field)) + 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; + } + Free_Type(field); + free(field); + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| 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 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); +} + +/*--------------------------------------------------------------------------- +| 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); + Free_Type(field); + + field->type = type; + field->arg = (void *)Make_Argument(field->type,&ap,&err); + + if (err) + { + 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; +} + +/*--------------------------------------------------------------------------- +| 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; +} + +/*--------------------------------------------------------------------------- +| 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); +} + +/*--------------------------------------------------------------------------- +| 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); +} + +/*--------------------------------------------------------------------------- +| 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_def.c ends here */ diff --git a/form/fld_stat.c b/form/fld_stat.c new file mode 100644 index 00000000..98cd3a70 --- /dev/null +++ b/form/fld_stat.c @@ -0,0 +1,63 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses form library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_stat.c,v 1.3 1997/05/01 16:47:54 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/form/fld_type.c b/form/fld_type.c new file mode 100644 index 00000000..dad5a115 --- /dev/null +++ b/form/fld_type.c @@ -0,0 +1,222 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses form library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_type.c,v 1.4 1997/05/01 16:47: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 */ +}; + +/*--------------------------------------------------------------------------- +| 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 : 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 = 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; +} + +/*--------------------------------------------------------------------------- +| 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); +} + +/*--------------------------------------------------------------------------- +| 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 one of those functions must be non-NULL. +| +| 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 || !copy_arg || !free_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 : 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_type.c ends here */ diff --git a/form/fld_user.c b/form/fld_user.c new file mode 100644 index 00000000..2c6475a1 --- /dev/null +++ b/form/fld_user.c @@ -0,0 +1,57 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses form library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#include "form.priv.h" + +MODULE_ID("$Id: fld_user.c,v 1.4 1997/05/01 16:47:54 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, const 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 ++--------------------------------------------------------------------------*/ +const void *field_userptr(const FIELD *field) +{ + return Normalize_Field( field )->usrptr; +} + +/* fld_user.c ends here */ diff --git a/form/form.h b/form/form.h new file mode 100644 index 00000000..6e2eabe2 --- /dev/null +++ b/form/form.h @@ -0,0 +1,380 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses form library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#ifndef FORM_H +#define FORM_H + +#include +#include + +#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 */ + const 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] */ + const 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 *,const 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 const 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 *,const 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 const 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/form/form.priv.h b/form/form.priv.h new file mode 100644 index 00000000..b08d70d6 --- /dev/null +++ b/form/form.priv.h @@ -0,0 +1,94 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses form library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#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 */ + +/* 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) + + +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) diff --git a/form/frm_adabind.c b/form/frm_adabind.c new file mode 100644 index 00000000..9db7e9f5 --- /dev/null +++ b/form/frm_adabind.c @@ -0,0 +1,61 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses form library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module frm_adabind.c * +* Helper routines to ease the implementation of an Ada95 binding to * +* ncurses. For details and copyright of the binding see the ../Ada95 * +* subdirectory. * +***************************************************************************/ +#include "form.priv.h" + +MODULE_ID("$Id: frm_adabind.c,v 1.3 1997/05/01 16:47:54 juergen Exp $") + +/* Prototypes for the functions in this module */ +void _nc_ada_normalize_field_opts (int *opt); +void _nc_ada_normalize_form_opts (int *opt); +void *_nc_ada_getvarg(va_list *); + + +void _nc_ada_normalize_field_opts (int *opt) +{ + *opt = ALL_FIELD_OPTS & (*opt); +} + +void _nc_ada_normalize_form_opts (int *opt) +{ + *opt = ALL_FORM_OPTS & (*opt); +} + + +/* This tiny stub helps us to get a void pointer from an argument list. +// The mechanism for libform to handle arguments to field types uses +// unfortunately functions with variable argument lists. In the Ada95 +// binding we replace this by a mechanism that only uses one argument +// that is a pointer to a record describing all the specifics of an +// user defined field type. So we need only this simple generic +// procedure to get the pointer from the arglist. +*/ +void *_nc_ada_getvarg(va_list *ap) +{ + return va_arg(*ap,void*); +} diff --git a/form/frm_data.c b/form/frm_data.c new file mode 100644 index 00000000..1fd79415 --- /dev/null +++ b/form/frm_data.c @@ -0,0 +1,171 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses form library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_data.c,v 1.3 1997/05/01 16:47:54 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/form/frm_def.c b/form/frm_def.c new file mode 100644 index 00000000..9b537bfa --- /dev/null +++ b/form/frm_def.c @@ -0,0 +1,391 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses form library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_def.c,v 1.4 1997/05/01 16:47:54 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 ) +{ + FIELD **fields; + + assert(form && form->field); + + 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;jpmin = 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); +} + +/*--------------------------------------------------------------------------- +| 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_def.c ends here */ diff --git a/form/frm_driver.c b/form/frm_driver.c new file mode 100644 index 00000000..51297e5a --- /dev/null +++ b/form/frm_driver.c @@ -0,0 +1,4307 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses form library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + 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. + --------------------------------------------------------------------------*/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_driver.c,v 1.20 1997/05/01 16:47:54 juergen Exp $") + +/* +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) + +/*---------------------------------------------------------------------------- + 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)) + +/* This are the field options required to be a selectable field in field + navigation requests */ +#define O_SELECTABLE (O_ACTIVE | O_VISIBLE) + +/* 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) + +#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; istatus & _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 : static int Position_Form_Cursor(FORM * form) +| +| Description : Position the currsor 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 ++--------------------------------------------------------------------------*/ +static int 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 : static int 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 ++--------------------------------------------------------------------------*/ +static int 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 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); +} + +/*--------------------------------------------------------------------------- +| 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; + + if (!field) + return E_SYSTEM_ERROR; + + win = derwin(Get_Form_Window(field->form), + field->rows,field->cols,field->frow,field->fcol); + + if (!win) + return E_SYSTEM_ERROR; + else + { + Set_Field_Window_Attributes(field,win); + 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 = 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 : static int 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 ++--------------------------------------------------------------------------*/ +static int 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 */ + Refresh_Current_Field(form); + } + } + else + { + res = Display_Field(field); + } + } + return(res); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int 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 ++--------------------------------------------------------------------------*/ +static int 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 = Erase_Field(field); + else + res = Display_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 : static int 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 ++--------------------------------------------------------------------------*/ +static int 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)) + { + 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 and 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) + { + form->currow--; + 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) + { + 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 ) + { + --(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 ) + { + --(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 id 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; + } + } + 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 : static bool Internal_Validation(FORM * form ) +| +| Description : Validate the current field of the form. +| +| Return Values : TRUE - field is valid +| FALSE - field is invalid ++--------------------------------------------------------------------------*/ +static bool 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 (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 : static FIELD * 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. ++--------------------------------------------------------------------------*/ +static FIELD * 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->fcolfrow!=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 (!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 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 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 + 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 + 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 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 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 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 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 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 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 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 Set_Current_Field(form, + Down_Neighbour_Field(form->current)); +} +/*---------------------------------------------------------------------------- + END of Field Navigation routines + --------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + Helper routines for Page Navigation + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Facility : libnform +| Function : static int 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 ++--------------------------------------------------------------------------*/ +static int 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 = 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 (!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 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 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 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 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; + bool End_Of_Field; + + 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) + { + form->status |= _WINDOW_MODIFIED; + End_Of_Field= (((field->drows-1)==form->currow) && + ((field->dcols-1)==form->curcol)); + 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 = 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 */ + }; + int nMethods = (sizeof(Generic_Methods)/sizeof(Generic_Methods[0])); + int method = ((BI->keycode & ID_Mask) >> ID_Shft) & 0xffff; + + if ( (method < 0) || (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); + } + Refresh_Current_Field(form); + RETURN(res); +} + +/*--------------------------------------------------------------------------- +| 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 = Set_Form_Page(form,page,form->current))!=E_OK) + RETURN(err); + + form->status |= _POSTED; + + Call_Hook(form,forminit); + Call_Hook(form,fieldinit); + + 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); +} + +/*--------------------------------------------------------------------------- +| 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 = Position_Form_Cursor(form); + } + RETURN(res); +} + +/*--------------------------------------------------------------------------- +| 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 (!Internal_Validation(form)) + err = E_INVALID_FIELD; + else + { + Call_Hook(form,fieldterm); + if (field->page != form->curpage) + { + Call_Hook(form,formterm); + err = Set_Form_Page(form,field->page,field); + Call_Hook(form,forminit); + } + else + { + err = Set_Current_Field(form,field); + } + Call_Hook(form,fieldinit); + 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 ); +} + +/*--------------------------------------------------------------------------- +| 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 = First_Active_Field(form); + } + else + { + if (form->status & _IN_DRIVER) + err = E_BAD_STATE; + else + { + if (form->curpage != page) + { + if (!Internal_Validation(form)) + err = E_INVALID_FIELD; + else + { + Call_Hook(form,fieldterm); + Call_Hook(form,formterm); + err = Set_Form_Page(form,page,(FIELD *)0); + Call_Hook(form,forminit); + Call_Hook(form,fieldinit); + 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; +} + +/*---------------------------------------------------------------------------- + Field-Buffer manipulation routines + --------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| 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) + { + 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= (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; +} + +/*---------------------------------------------------------------------------- + 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; + if (!(opts & ~ALL_FIELD_OPTS)) + res = 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; + + if (!(opts & ~ALL_FIELD_OPTS)) + { + Normalize_Field( field ); + res = 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; + + if (!(opts & ~ALL_FIELD_OPTS)) + { + Normalize_Field( field ); + res = Synchronize_Options( field, field->opts & ~opts ); + } + RETURN(res); +} + +/*---------------------------------------------------------------------------- + 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 = 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 ) + +/*--------------------------------------------------------------------------- +| 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 = 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; +} + +/*--------------------------------------------------------------------------- +| 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 = 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; +} + +/* frm_driver.c ends here */ diff --git a/form/frm_hook.c b/form/frm_hook.c new file mode 100644 index 00000000..60c9993d --- /dev/null +++ b/form/frm_hook.c @@ -0,0 +1,130 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses form library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_hook.c,v 1.5 1997/05/01 16:47:54 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/form/frm_opts.c b/form/frm_opts.c new file mode 100644 index 00000000..0adb88f5 --- /dev/null +++ b/form/frm_opts.c @@ -0,0 +1,103 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses form library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_opts.c,v 1.3 1997/05/01 16:47:54 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) +{ + 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) +{ + 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) +{ + 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/form/frm_req_name.c b/form/frm_req_name.c new file mode 100644 index 00000000..b878147e --- /dev/null +++ b/form/frm_req_name.c @@ -0,0 +1,153 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses form library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* 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.4 1997/05/01 16:47:54 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 | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_user.c,v 1.4 1997/05/01 16:47:54 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, const 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 ++--------------------------------------------------------------------------*/ +const void *form_userptr(const FORM * form) +{ + return Normalize_Form(form)->usrptr; +} + +/* frm_user.c ends here */ diff --git a/form/frm_win.c b/form/frm_win.c new file mode 100644 index 00000000..2d96868a --- /dev/null +++ b/form/frm_win.c @@ -0,0 +1,91 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses form library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#include "form.priv.h" + +MODULE_ID("$Id: frm_win.c,v 1.4 1997/05/01 16:47:54 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); +} + +/*--------------------------------------------------------------------------- +| 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_win.c ends here */ diff --git a/form/fty_alnum.c b/form/fty_alnum.c new file mode 100644 index 00000000..5f358042 --- /dev/null +++ b/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@T-Online.de * +* * +***************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fty_alnum.c,v 1.6 1997/02/15 17:31:21 tom 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 *new = (alnumARG *)malloc(sizeof(alnumARG)); + + if (new) + *new = *ap; + + return ((void *)new); +} + +/*--------------------------------------------------------------------------- +| 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/form/fty_alpha.c b/form/fty_alpha.c new file mode 100644 index 00000000..4f24c319 --- /dev/null +++ b/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@T-Online.de * +* * +***************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fty_alpha.c,v 1.6 1997/02/15 17:31:08 tom 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 *new = (alphaARG *)malloc(sizeof(alphaARG)); + + if (new) + { + *new = *ap; + } + return ((void *)new); +} + +/*--------------------------------------------------------------------------- +| 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/form/fty_enum.c b/form/fty_enum.c new file mode 100644 index 00000000..0e128083 --- /dev/null +++ b/form/fty_enum.c @@ -0,0 +1,287 @@ + +/* + * 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@T-Online.de * +* * +***************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fty_enum.c,v 1.5 1997/02/15 17:33:59 tom 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 *new = (enumARG *)0; + + if (argp) + { + new = (enumARG *)malloc(sizeof(enumARG)); + if (new) + *new = *ap; + } + return (void *)new; +} + +/*--------------------------------------------------------------------------- +| 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)) + { + s++; + 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) + { + t=s; + if ((unique && res!=EXACT)) + { + while( (p = *kwds++) ) + { + if ((res=Compare((unsigned char *)p,bp,ccase))!=NOMATCH) + { + if (res==EXACT) + { + t = p; + break; + } + t = (char *)0; + } + } + } + if (t) + { + set_field_buffer(field,0,t); + return TRUE; + } + } + } + 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/form/fty_int.c b/form/fty_int.c new file mode 100644 index 00000000..e9850883 --- /dev/null +++ b/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@T-Online.de * +* * +***************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fty_int.c,v 1.7 1997/04/19 15:22:40 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 *new = (integerARG *)0; + + if (argp) + { + new = (integerARG *)malloc(sizeof(integerARG)); + if (new) + *new = *ap; + } + return (void *)new; +} + +/*--------------------------------------------------------------------------- +| 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 (lowhigh) 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/form/fty_ipv4.c b/form/fty_ipv4.c new file mode 100644 index 00000000..064c02c8 --- /dev/null +++ b/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/form/fty_num.c b/form/fty_num.c new file mode 100644 index 00000000..eb2d5869 --- /dev/null +++ b/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@T-Online.de * +* * +***************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fty_num.c,v 1.9 1997/04/19 17:26:38 juergen Exp $") + +#if HAVE_LOCALE_H +#include +#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 *new = (numericARG *)0; + + if (argp) + { + new = (numericARG *)malloc(sizeof(numericARG)); + if (new) + *new = *ap; + } + return (void *)new; +} + +/*--------------------------------------------------------------------------- +| 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 (lowhigh) 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 == ( +#ifdef 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/form/fty_regex.c b/form/fty_regex.c new file mode 100644 index 00000000..3ad62e9f --- /dev/null +++ b/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@T-Online.de * +* * +***************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: fty_regex.c,v 1.9 1997/05/01 16:03:17 tom Exp $") + +#if HAVE_REGEX_H /* We prefer POSIX regex */ +#include + +typedef struct +{ + regex_t *pRegExp; + unsigned long *refCount; +} RegExp_Arg; + +#elif HAVE_REGEXP_H | HAVE_REGEXPR_H +#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 +#include +#else +#include +#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 + 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 | HAVE_REGEXPR_H + 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 + char *last_pos = compile (rx, buf, &buf[blen], '\0'); +#else + char *last_pos = compile (rx, buf, &buf[blen], '\0'); +#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 | HAVE_REGEXP_H | HAVE_REGEXPR_H) + const RegExp_Arg *ap = (const RegExp_Arg *)argp; + const RegExp_Arg *new = (const RegExp_Arg *)0; + + if (ap) + { + *(ap->refCount) += 1; + new = ap; + } + return (void *)new; +#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 | HAVE_REGEXP_H | HAVE_REGEXPR_H + RegExp_Arg *ap = (RegExp_Arg *)argp; + if (ap) + { + if (--(*(ap->refCount)) == 0) + { +#if HAVE_REGEX_H + if (ap->pRegExp) + { + free(ap->refCount); + regfree(ap->pRegExp); + } +#elif HAVE_REGEXP_H | HAVE_REGEXPR_H + 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 + 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 | HAVE_REGEXPR_H + 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/form/headers b/form/headers new file mode 100644 index 00000000..22a25341 --- /dev/null +++ b/form/headers @@ -0,0 +1,20 @@ +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +$(srcdir)/form.h diff --git a/form/llib-lform b/form/llib-lform new file mode 100644 index 00000000..7090cc13 --- /dev/null +++ b/form/llib-lform @@ -0,0 +1,580 @@ +/****************************************************************************** + * Copyright 1996 by Thomas E. Dickey * + * All Rights Reserved. * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * + * that the above copyright notice appear in all copies and that both that * + * copyright notice and this permission notice appear in supporting * + * documentation, and that the name of the above listed copyright holder(s) * + * not be used in advertising or publicity pertaining to distribution of the * + * software without specific, written prior permission. THE ABOVE LISTED * + * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * + * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + ******************************************************************************/ +/* LINTLIBRARY */ + +/* ./fty_regex.c */ + +#include "form.priv.h" +#include + +typedef struct +{ + regex_t *pRegExp; + unsigned long refCount; +} RegExp_Arg; + +#undef TYPE_REGEXP +FIELDTYPE *TYPE_REGEXP; + +/* ./fty_num.c */ + +#include + +typedef struct { + int precision; + double low; + double high; + struct lconv* L; +} numericARG; + +#undef TYPE_NUMERIC +FIELDTYPE *TYPE_NUMERIC; + +/* ./fty_int.c */ + +typedef struct { + int precision; + int low; + int high; +} integerARG; + +#undef TYPE_INTEGER +FIELDTYPE *TYPE_INTEGER; + +/* ./fty_enum.c */ + +typedef struct { + char **kwds; + int count; + bool checkcase; + bool checkunique; +} enumARG; + +#undef TYPE_ENUM +FIELDTYPE *TYPE_ENUM; + +/* ./fty_alpha.c */ + +typedef struct { + int width; +} alphaARG; + +#undef TYPE_ALPHA +FIELDTYPE *TYPE_ALPHA; + +/* ./fty_alnum.c */ + +typedef struct { + int width; +} alnumARG; + +#undef TYPE_ALNUM +FIELDTYPE *TYPE_ALNUM; + +/* ./fty_ipv4.c */ +#undef TYPE_IPV4 +FIELDTYPE *TYPE_IPV4; + +/* ./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_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); } + +#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, + const void *usrptr) + { return(*(int *)0); } + +#undef form_userptr +const void *form_userptr( + const FORM *form) + { return(*(const void **)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_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_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); } + +/* ./fld_user.c */ + +#undef set_field_userptr +int set_field_userptr( + FIELD *field, + const void *usrptr) + { return(*(int *)0); } + +#undef field_userptr +const void *field_userptr( + const FIELD *field) + { return(*(const void **)0); } + +/* ./fld_type.c */ + +#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 link_fieldtype +FIELDTYPE *link_fieldtype( + FIELDTYPE *type1, + FIELDTYPE *type2) + { return(*(FIELDTYPE **)0); } + +#undef free_fieldtype +int free_fieldtype( + FIELDTYPE *typ) + { return(*(int *)0); } + +#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 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_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_def.c */ + +#undef _nc_Default_Field +FIELD *_nc_Default_Field; + +#undef new_field +FIELD *new_field( + int rows, + int cols, + int frow, + int fcol, + int nrow, + int nbuf) + { return(*(FIELD **)0); } + +#undef dup_field +FIELD *dup_field( + FIELD *field, + int frow, + int fcol) + { return(*(FIELD **)0); } + +#undef link_field +FIELD *link_field( + FIELD *field, + int frow, + int fcol) + { return(*(FIELD **)0); } + +#undef free_field +int free_field( + FIELD *field) + { return(*(int *)0); } + +#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 move_field +int move_field( + FIELD *field, + int frow, + int fcol) + { return(*(int *)0); } + +#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); } + +#undef field_arg +void *field_arg( + const FIELD *field) + { return(*(void **)0); } + +#undef set_max_field +int set_max_field( + FIELD *field, + int maxgrow) + { return(*(int *)0); } + +#undef dynamic_field_info +int dynamic_field_info( + const FIELD *field, + int *drows, + int *dcols, + int *maxgrow) + { return(*(int *)0); } + +#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); } + +/* ./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); } + +#undef scale_form +int scale_form( + const FORM *form, + int *rows, + int *cols) + { return(*(int *)0); } + +/* ./frm_driver.c */ + +typedef struct { + int keycode; + int (*cmd)(FORM *); +} Binding_Info; + +#undef form_driver +int form_driver( + FORM *form, + int c) + { return(*(int *)0); } + +#undef post_form +int post_form( + FORM *form) + { return(*(int *)0); } + +#undef unpost_form +int unpost_form( + FORM *form) + { return(*(int *)0); } + +#undef pos_form_cursor +int pos_form_cursor( + FORM *form) + { return(*(int *)0); } + +#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); } + +#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); } + +#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); } + +#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); } + +#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); } + +#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); } + +#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); } + +/* ./frm_adabind.c */ + +#undef _nc_ada_normalize_field_opts +void _nc_ada_normalize_field_opts( + int *opt) + { /* void */ } + +#undef _nc_ada_normalize_form_opts +void _nc_ada_normalize_form_opts( + int *opt) + { /* void */ } + +#undef _nc_ada_getvarg +void *_nc_ada_getvarg( + va_list *ap) + { return(*(void **)0); } diff --git a/form/modules b/form/modules new file mode 100644 index 00000000..de5f38cf --- /dev/null +++ b/form/modules @@ -0,0 +1,40 @@ +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Library objects +fty_regex lib $(srcdir) $(FORM_PRIV_H) +fty_num lib $(srcdir) $(FORM_PRIV_H) +fty_int lib $(srcdir) $(FORM_PRIV_H) +fty_enum lib $(srcdir) $(FORM_PRIV_H) +fty_alpha lib $(srcdir) $(FORM_PRIV_H) +fty_alnum lib $(srcdir) $(FORM_PRIV_H) +fty_ipv4 lib $(srcdir) $(FORM_PRIV_H) +frm_data lib $(srcdir) $(FORM_PRIV_H) +frm_win lib $(srcdir) $(FORM_PRIV_H) +frm_user lib $(srcdir) $(FORM_PRIV_H) +frm_opts lib $(srcdir) $(FORM_PRIV_H) +frm_hook lib $(srcdir) $(FORM_PRIV_H) +frm_req_name lib $(srcdir) $(FORM_PRIV_H) +fld_user lib $(srcdir) $(FORM_PRIV_H) +fld_type lib $(srcdir) $(FORM_PRIV_H) +fld_stat lib $(srcdir) $(FORM_PRIV_H) +fld_def lib $(srcdir) $(FORM_PRIV_H) +frm_def lib $(srcdir) $(FORM_PRIV_H) +frm_driver lib $(srcdir) $(FORM_PRIV_H) +frm_adabind lib $(srcdir) $(FORM_PRIV_H) diff --git a/include/Caps b/include/Caps new file mode 100644 index 00000000..3681387a --- /dev/null +++ b/include/Caps @@ -0,0 +1,1302 @@ +# /*************************************************************************** +# * COPYRIGHT NOTICE * +# **************************************************************************** +# * ncurses is copyright (C) 1992-1995 * +# * Zeyd M. Ben-Halim * +# * zmbenhal@netcom.com * +# * Eric S. Raymond * +# * esr@snark.thyrsus.com * +# * * +# * Permission is hereby granted to reproduce and distribute ncurses * +# * by any means and for any fee, whether alone or as part of a * +# * larger distribution, in source or in binary form, PROVIDED * +# * this notice is included with any such distribution, and is not * +# * removed from any of its header files. Mention of ncurses in any * +# * applications linked with it is highly appreciated. * +# * * +# * ncurses comes AS IS with no warranty, implied or expressed. * +# * * +# ***************************************************************************/ +# +# $Id: Caps,v 1.15 1996/10/05 21:26:18 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, sets msb high +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 aline +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 => varies +magic_cookie_glitch xmc num sg YBCGE number of blank chars 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- 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 ----- maxumum number of defineable windows +# These came in with SVr4's color support +max_colors colors num Co ----- maximum numbers 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_char_size mcs num Yf ----- character size when in micro mode +micro_line_size mls num Yg ----- line 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 chars 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 passed 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) (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 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 fucntion 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- last-line key +key_npage knp str kN YB-GE next-page key +key_ppage kpp str kP YB-GE prev-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-* lable 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 chars (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 chars (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 chars to the left (P) +parm_right_cursor cuf str RI YBCGE move #1 chars 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 last position of sc +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 - def=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 key +key_scancel kCAN str &0 ----- shifted key +key_scommand kCMD str *1 ----- shifted key +key_scopy kCPY str *2 ----- shifted key +key_screate kCRT str *3 ----- shifted key +key_sdc kDC str *4 ----- shifted key +key_sdl kDL str *5 ----- shifted key +key_select kslt str *6 ----- select key +key_send kEND str *7 ----- shifted key +key_seol kEOL str *8 ----- shifted key +key_sexit kEXT str *9 ----- shifted key +key_sfind kFND str *0 ----- shifted key +key_shelp kHLP str #1 ----- shifted key +key_shome kHOM str #2 ----- shifted key +key_sic kIC str #3 ----- shifted key +key_sleft kLFT str #4 ----- shifted key +key_smessage kMSG str %a ----- shifted key +key_smove kMOV str %b ----- shifted key +key_snext kNXT str %c ----- shifted key +key_soptions kOPT str %d ----- shifted key +key_sprevious kPRV str %e ----- shifted key +key_sprint kPRT str %f ----- shifted key +key_sredo kRDO str %g ----- shifted key +key_sreplace kRPL str %h ----- shifted key +key_sright kRIT str %i ----- shifted key +key_srsume kRES str %j ----- shifted key +key_ssave kSAV str !1 ----- shifted key +key_ssuspend kSPD str !2 ----- shifted key +key_sundo kUND str !3 ----- shifted 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 +set_right_margin smgr str MR ----- set right soft margin +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 dialling +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 ----- Wnter 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 braphics +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 aet +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 chars 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 are 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 ANSI foreground color +set_a_background setab str AB ----- Set ANSI background color +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 probably in some post-4.1 +#%version of System V curses as well, but because XSI Curses lists them in +#%strict alphabetical order we don't know if this is the right binary order. +#%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 +#%.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 +# r1, and vice versa, if an entry does not already have an r1. 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 nytinfo 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 chars +# parm_scroll_right OTsr str SR ----- scroll screen rightward #1 chars +# +# 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 chars, 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 chars primary set +#box_chars_2 box2 str by ----K box chars 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 questionmarked 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/include/MKhashsize.sh b/include/MKhashsize.sh new file mode 100755 index 00000000..d11d7bf2 --- /dev/null +++ b/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/include/MKparametrized.sh b/include/MKparametrized.sh new file mode 100755 index 00000000..a957229d --- /dev/null +++ b/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 <" + print "#define TTY struct termios" + print "" + print "#else /* !HAVE_TERMIOS_H */" + print "" + print "#if HAVE_TERMIO_H" + print "#ifndef TERMIOS" + print "#define TERMIOS 1" + print "#endif" + print "#include " + print "#define TTY struct termio" + print "#define TCSANOW TCSETA" + print "#define TCSADRAIN TCSETAW" + print "#define TCSAFLUSH TCSETAF" + print "#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)" + print "#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)" + print "#define cfgetospeed(t) ((t)->c_cflag & CBAUD)" + print "#define TCIFLUSH 0" + print "#define TCOFLUSH 1" + print "#define TCIOFLUSH 2" + print "#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)" + print "" + print "#else /* !HAVE_TERMIO_H */" + print "" + print "#undef TERMIOS" + print "#include " + print "#include " + 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 "extern char ttytype[];" + 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 "" + print "/* XSI synonyms */" + print "#define micro_col_size micro_char_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 "" + 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[BOOLCOUNT]; /* array of values */" + print " short Numbers[NUMCOUNT]; /* array of values */" + print " char *Strings[STRCOUNT]; /* array of string offsets */" + 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 "} TERMINAL;" + print "" + print "extern TERMINAL *cur_term;" + print "" + print "" + print "#ifdef __cplusplus" + print "extern \"C\" {" + print "#endif" + 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 char * const *_nc_boolnames(void);" + print "extern char * const *_nc_boolcodes(void);" + print "extern char * const *_nc_boolfnames(void);" + print "extern char * const *_nc_numnames(void);" + print "extern char * const *_nc_numcodes(void);" + print "extern char * const *_nc_numfnames(void);" + print "extern char * const *_nc_strnames(void);" + print "extern char * const *_nc_strcodes(void);" + print "extern char * const *_nc_strfnames(void);" + print "" + print "#else" + print "" + print "extern char *const boolnames[];" + print "extern char *const boolcodes[];" + print "extern char *const boolfnames[];" + print "extern char *const numnames[];" + print "extern char *const numcodes[];" + print "extern char *const numfnames[];" + print "extern char *const strnames[];" + print "extern char *const strcodes[];" + print "extern char *const strfnames[];" + print "" + print "#endif" + print "" + print "/* internals */" + 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 "/* entry points */" + print "extern int putp(const char *);" + print "extern int restartterm(const char *, int, int *);" + print "extern int setupterm(const char *,int,int *);" + print "extern int tgetent(char *, const char *);" + print "extern int tgetflag(const char *);" + print "extern int tgetnum(const char *);" + print "extern char *tgetstr(const char *, char **);" + print "extern char *tgoto(const char *, int, int);" + print "extern int tigetflag(const char *);" + print "extern int tigetnum(const char *);" + print "extern char *tigetstr(const char *);" + print "extern char *tparm(const char *, ...);" + print "extern int tputs(const char *, int, int (*)(int));" + print "" + print "#ifdef __cplusplus" + print "}" + print "#endif" + print "" + print "#endif /* TERM_H */" + } diff --git a/include/Makefile.in b/include/Makefile.in new file mode 100644 index 00000000..f5d521e0 --- /dev/null +++ b/include/Makefile.in @@ -0,0 +1,93 @@ +# $Id: Makefile.in,v 1.17 1997/04/05 23:38:51 tom Exp $ +################################################################################ +# Copyright 1996,1997 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# 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@ + +VERSION = @nc_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 \ +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 + sh $(srcdir)/MKparametrized.sh $(srcdir)/Caps >$@ + +tags: + ctags *.[ch] + +TAGS: + etags *.[ch] + +mostlyclean :: + -rm -f tags TAGS *~ + +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/include/capdefaults.c b/include/capdefaults.c new file mode 100644 index 00000000..a7ceda19 --- /dev/null +++ b/include/capdefaults.c @@ -0,0 +1,72 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* $Id: capdefaults.c,v 1.4 1996/08/18 00:56:09 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 VALID_STRING(s) ((s) && s != CANCELLED_STRING) +#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 *)NULL; + } + if (VALID_STRING(reset_1string) + && !VALID_STRING(reset_2string) + && VALID_STRING(reset_3string)) + { + termcap_reset = reset_1string; + reset_1string = (char *)NULL; + } + if (magic_cookie_glitch_ul < 0 && magic_cookie_glitch && VALID_STRING(enter_underline_mode)) + magic_cookie_glitch_ul = magic_cookie_glitch; + + /* 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/include/config_h.in b/include/config_h.in new file mode 100644 index 00000000..b4c65508 --- /dev/null +++ b/include/config_h.in @@ -0,0 +1,26 @@ +/****************************************************************************** + * Copyright 1995 by Thomas E. Dickey * + * All Rights Reserved. * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * + * that the above copyright notice appear in all copies and that both that * + * copyright notice and this permission notice appear in supporting * + * documentation, and that the name of the above listed copyright holder(s) * + * not be used in advertising or publicity pertaining to distribution of the * + * software without specific, written prior permission. THE ABOVE LISTED * + * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * + * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + ******************************************************************************/ +/* + * 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'. + */ +@DEFS@ diff --git a/include/curses.h.in b/include/curses.h.in new file mode 100644 index 00000000..43e474ba --- /dev/null +++ b/include/curses.h.in @@ -0,0 +1,1285 @@ +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* $Id: curses.h.in,v 1.44 1997/04/20 01:32:08 tom Exp $ */ + +#ifndef __NCURSES_H +#define __NCURSES_H +#define CURSES 1 +#define CURSES_H 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 + +#ifndef NCURSES_CONST +#define NCURSES_CONST /* nothing */ +#endif + +#ifndef _UNCTRL_H +typedef unsigned long chtype; +#endif + +#include +#include +#include /* we need va_list */ +#ifdef _XOPEN_SOURCE_EXTENDED +#include /* 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. + * + * To simplify use with/without the configuration script, we define the symbols + * CXX_BUILTIN_BOOL and CXX_TYPE_OF_BOOL; they're edited by the configure + * script. + */ + +#undef TRUE +#undef FALSE +#define CXX_BUILTIN_BOOL @nc_cv_builtin_bool@ +#define CXX_TYPE_OF_BOOL @nc_cv_type_of_bool@ + +#if defined(__cplusplus) && CXX_BUILTIN_BOOL +#define TRUE ((CXX_TYPE_OF_BOOL)true) +#define FALSE ((CXX_TYPE_OF_BOOL)false) +#else +typedef CXX_TYPE_OF_BOOL bool; +#define TRUE ((bool)1) +#define FALSE ((bool)0) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XSI attributes. In the ncurses implementation, they are identical to the + * A_ attributes because attr_t is just an int. The XSI Curses attr_* and + * wattr_* entry points are all mapped to attr* and wattr* entry points. + */ +#define WA_ATTRIBUTES 0xffffff00 +#define WA_NORMAL 0x00000000 +#define WA_STANDOUT 0x00010000 +#define WA_UNDERLINE 0x00020000 +#define WA_REVERSE 0x00040000 +#define WA_BLINK 0x00080000 +#define WA_DIM 0x00100000 +#define WA_BOLD 0x00200000 +#define WA_ALTCHARSET 0x00400000 +#define WA_INVIS 0x00800000 +#define WA_PROTECT 0x01000000 +#define WA_HORIZONTAL 0x02000000 /* XSI Curses attr -- not yet used */ +#define WA_LEFT 0x04000000 /* XSI Curses attr -- not yet used */ +#define WA_LOW 0x08000000 /* XSI Curses attr -- not yet used */ +#define WA_RIGHT 0x10000000 /* XSI Curses attr -- not yet used */ +#define WA_TOP 0x20000000 /* XSI Curses attr -- not yet used */ +#define WA_VERTICAL 0x40000000 /* XSI Curses attr -- not yet used */ + +/* 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 _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 */ + + /* the actual line data */ + 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 */ + } + *_line; + + /* 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, *curscr, *newscr; + +extern int LINES, COLS, TABSIZE; + +/* + * This global was an undocumented feature under AIX curses. + */ +extern int ESCDELAY; /* ESC expire time in milliseconds */ + +/* non-XSI extensions (dickey@clark.net) */ +extern int resizeterm (int, int); +extern int wresize (WINDOW *, int, int); +extern int use_default_colors (void); + +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. + */ +#if !defined(__GNUC__) && !defined(__attribute__) +#define __attribute__(p) /* nothing */ +#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(void); /* generated */ +extern int attr_off(NCURSES_ATTR_T); /* generated */ +extern int attr_on(NCURSES_ATTR_T); /* generated */ +extern int attr_set(NCURSES_ATTR_T); /* 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 int 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(cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int box(WINDOW *, chtype, chtype); /* generated */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int box_set(WINDOW *, cchar_t, 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_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 */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int endwin(void); /* implemented */ +extern char erasechar(void); /* implemented */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int erase_wchar(wchar_t *); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +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 *); /* not in XPG4 */ +#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 int has_ic(void); /* implemented */ +extern int 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(const cchar_t *); /* missing */ +extern int in_wchstr(const cchar_t *); /* missing */ +extern int in_wchntr(const cchar_t *, int); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int isendwin(void); /* implemented */ +extern int is_linetouched(WINDOW *,int); /* implemented */ +extern int is_wintouched(WINDOW *); /* implemented */ +extern const char *keyname(int); /* implemented */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int 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, const cchar_t *); /* missing */ +extern int mvin_wchstr(int, int, const cchar_t *); /* missing */ +extern int mvin_wchntr(int, int, const cchar_t *, int); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int mvprintw(int,int,const char *,...) /* implemented */ + GCC_PRINTFLIKE(3,4); +extern int mvscanw(int,int,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, const cchar_t *); /* missing */ +extern int mvwin_wchnstr(WINDOW *, int,int,const cchar_t *,int); /* missing */ +extern int mvwin_wchstr(WINDOW *, int, int, const cchar_t *); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int mvwprintw(WINDOW*,int,int,const char *,...) /* implemented */ + GCC_PRINTFLIKE(4,5); +extern int mvwscanw(WINDOW *,int,int,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(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 int 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 *, 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(const char *,...) /* implemented */ + GCC_PRINTFLIKE(1,2); +extern int putp(const char *); /* implemented */ +extern int putwin(WINDOW *, FILE *); /* implemented */ +extern int 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(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 *, wchar_t *, 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 attr_t); /* implemented */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int slk_attr_off(attr_t); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int slk_attron(const attr_t); /* implemented */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int slk_attr_on(attr_t); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int slk_attrset(const attr_t); /* implemented */ +extern attr_t slk_attr(void); /* implemented */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int slk_attr_set(attr_t); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int slk_clear(void); /* 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, 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 attr_t termattrs(void); /* implemented */ +extern char *termname(void); /* implemented */ +extern int tigetflag(const char *); /* implemented */ +extern int tigetnum(const char *); /* implemented */ +extern char *tigetstr(const char *); /* implemented */ +extern int timeout(int); /* generated */ +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 */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int vid_attr(attr_t); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int vidputs(chtype, int (*)(int)); /* implemented */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int vid_puts(attr_t, 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 *,const char *,va_list); /* implemented */ +extern int vw_printw(WINDOW *,const char *,va_list); /* generated */ +extern int vwscanw(WINDOW *,const char *,va_list); /* implemented */ +extern int vw_scanw(WINDOW *,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 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 attr_t wattr_get(WINDOW *); /* generated */ +extern int wattr_on(WINDOW *, const attr_t); /* implemented */ +extern int wattr_off(WINDOW *, const attr_t); /* implemented */ +extern int wattr_set(WINDOW *, attr_t); /* generated */ +extern int wbkgd(WINDOW *,const chtype); /* implemented */ +extern void wbkgdset(WINDOW *,chtype); /* generated */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern int 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 *,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,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 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 *); /* generated */ +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 *, const cchar_t *); /* missing */ +extern int win_wchnstr(WINDOW *, const cchar_t *, int); /* missing */ +extern int win_wchstr(WINDOW *, const cchar_t *); /* missing */ +#endif /* _XOPEN_SOURCE_EXTENDED */ +extern int wmove(WINDOW *,int,int); /* implemented */ +extern int wnoutrefresh(WINDOW *); /* implemented */ +extern int wprintw(WINDOW *,const char *,...) /* implemented */ + GCC_PRINTFLIKE(2,3); +extern int wredrawln(WINDOW *,int,int); /* implemented */ +extern int wrefresh(WINDOW *); /* implemented */ +extern int wscanw(WINDOW *,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 int 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 */ + +/* attributes */ +#define A_ATTRIBUTES 0xffffff00 +#define A_NORMAL 0x00000000 +#define A_STANDOUT 0x00010000 +#define A_UNDERLINE 0x00020000 +#define A_REVERSE 0x00040000 +#define A_BLINK 0x00080000 +#define A_DIM 0x00100000 +#define A_BOLD 0x00200000 +#define A_ALTCHARSET 0x00400000 +#define A_INVIS 0x00800000 +#define A_PROTECT 0x01000000 +#define A_HORIZONTAL 0x02000000 /* XSI Curses attr -- not yet used */ +#define A_LEFT 0x04000000 /* XSI Curses attr -- not yet used */ +#define A_LOW 0x08000000 /* XSI Curses attr -- not yet used */ +#define A_RIGHT 0x10000000 /* XSI Curses attr -- not yet used */ +#define A_TOP 0x20000000 /* XSI Curses attr -- not yet used */ +#define A_VERTICAL 0x40000000 /* XSI Curses attr -- not yet used */ +#define A_CHARTEXT 0x000000ff +#define A_COLOR 0x0000ff00 +#define COLOR_PAIR(n) ((n) << 8) +#define PAIR_NUMBER(a) (((a) & A_COLOR) >> 8) + +/* + * 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)->_cury, x = (win)->_curx) +#define getbegyx(win,y,x) (y = (win)->_begy, x = (win)->_begx) +#define getmaxyx(win,y,x) (y = (win)->_maxy + 1, x = (win)->_maxx + 1) +#define getparyx(win,y,x) (y = (win)->_pary, x = (win)->_parx) +#define getsyx(y,x) getyx(stdscr, y, x) +#define setsyx(y,x) (stdscr->_cury = y, stdscr->_curx = x) + +#define wbkgdset(win, ch) \ + (((win)->_attrs = (((win)->_attrs & ~((win)->_bkgd & A_ATTRIBUTES)) | \ + ((ch) & A_ATTRIBUTES))), \ + ((win)->_bkgd = (ch))) + +/* It seems older SYSV curses versions define these */ +#define getattrs(win) ((win)->_attrs) +#define getmaxx(win) ((win)->_maxx + 1) +#define getmaxy(win) ((win)->_maxy + 1) + +#define winch(win) ((win)->_line[(win)->_cury].text[(win)->_curx]) +#define wstandout(win) (wattr_set(win,A_STANDOUT)) +#define wstandend(win) (wattr_set(win,A_NORMAL)) +#define wattr_set(win,at) ((win)->_attrs = (at)) + +#define wattron(win,at) wattr_on(win, at) +#define wattroff(win,at) wattr_off(win, at) +#define wattrset(win,at) wattr_set(win, at) + +#define scroll(win) wscrl(win,1) + +#define touchwin(win) wtouchln((win), 0, (win)->_maxy + 1, 1) +#define touchline(win, s, c) wtouchln((win), s, c, 1) +#define untouchwin(win) wtouchln((win), 0, (win)->_maxy + 1, 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 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(stsdscr,c) +#define addnwstr(wstr,n) waddnwstr(stdscr,wstr,n) +#define addwstr(wstr,n) waddnwstr(stdscr,wstr,-1) +#define attr_get() wattr_get(stdscr) +#define attr_off(a) wattr_off(stdscr,a) +#define attr_on(a) wattr_on(stdscr,a) +#define attr_set(a) wattr_set(stdscr,a) +#define box_set(w,v,h) wborder_set(w,v,v,h,h,0,0,0,9) +#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(y,x,win,c) (wmove(win,y,x) == ERR ? ERR : wadd_wch(stsdscr,c)) +#define mvwaddnwstr(y,x,win,wstr,n) (wmove(win,y,x) == ERR ? ERR : waddnwstr(stdscr,wstr,n)) +#define mvwaddwstr(y,x,win,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,n)) +#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(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 vline_set(c,n) vhline_set(stdscr,c,n) +#define waddwstr(win,wstr,n) waddnwstr(win,wstr,-1) +#define wattr_get(win) ((win)->_attrs) +#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_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(WINDOW *, int, int); +extern int mouseinterval(int); + +/* 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 *_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 */ +#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/include/edit_cfg.sh b/include/edit_cfg.sh new file mode 100755 index 00000000..cc6efcac --- /dev/null +++ b/include/edit_cfg.sh @@ -0,0 +1,49 @@ +#!/bin/sh +# $Id: edit_cfg.sh,v 1.6 1997/04/06 01:54:44 tom Exp $ +################################################################################ +# Copyright 1996,1997 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Edit the default value of the term.h file based on the autoconf-generated +# values: +# +# $1 = ncurses_cfg.h +# $2 = term.h +# +for name in \ + HAVE_TCGETATTR \ + HAVE_TERMIOS_H \ + HAVE_TERMIO_H \ + BROKEN_LINKER +do + mv $2 $2.bak + if ( grep "[ ]$name[ ]" $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/include/headers b/include/headers new file mode 100644 index 00000000..581f8b7f --- /dev/null +++ b/include/headers @@ -0,0 +1,23 @@ +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +term.h +curses.h +unctrl.h +termcap.h diff --git a/include/nc_alloc.h b/include/nc_alloc.h new file mode 100644 index 00000000..362e41dd --- /dev/null +++ b/include/nc_alloc.h @@ -0,0 +1,60 @@ +/****************************************************************************** + * Copyright 1996,1997 by Thomas E. Dickey * + * All Rights Reserved. * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * + * that the above copyright notice appear in all copies and that both that * + * copyright notice and this permission notice appear in supporting * + * documentation, and that the name of the above listed copyright holder(s) * + * not be used in advertising or publicity pertaining to distribution of the * + * software without specific, written prior permission. THE ABOVE LISTED * + * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * + * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + ******************************************************************************/ +/* $Id: nc_alloc.h,v 1.4 1997/02/15 18:51:39 tom Exp $ */ + +#ifndef NC_ALLOC_included +#define NC_ALLOC_included 1 + +#if HAVE_LIBDMALLOC +#include /* Gray Watson's library */ +#else +#undef HAVE_LIBDMALLOC +#define HAVE_LIBDMALLOC 0 +#endif + +#if HAVE_LIBDBMALLOC +#include /* Conor Cahill's library */ +#else +#undef HAVE_LIBDBMALLOC +#define HAVE_LIBDBMALLOC 0 +#endif + +#ifndef NO_LEAKS +#define NO_LEAKS 0 +#endif + +#ifndef HAVE_NC_FREEALL +#define HAVE_NC_FREEALL 0 +#endif + +#if HAVE_LIBDBMALLOC || HAVE_LIBDMALLOC || NO_LEAKS || HAVE_NC_FREEALL +struct termtype; +extern void _nc_free_and_exit(int) GCC_NORETURN; +extern void _nc_free_tparm(void); +extern void _nc_leaks_dump_entry(void); +extern void _nc_free_termtype(struct termtype *, int); +#define ExitProgram(code) _nc_free_and_exit(code) +#endif + +#ifndef ExitProgram +#define ExitProgram(code) return code +#endif + +#endif /* NC_ALLOC_included */ diff --git a/include/term_entry.h b/include/term_entry.h new file mode 100644 index 00000000..9045774f --- /dev/null +++ b/include/term_entry.h @@ -0,0 +1,77 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * term_entry.h -- interface to entry-manipulation code + */ + +#ifndef _TERM_ENTRY_H +#define _TERM_ENTRY_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; + +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 + +/* alloc_entry.c: elementary allocation code */ +extern void _nc_init_entry(TERMTYPE *const); +extern char *_nc_save_str(const char *const); +extern void _nc_merge_entry(TERMTYPE *const, TERMTYPE *const); +extern void _nc_wrap_entry(ENTRY *const); + +/* parse_entry.c: entry-parsing code */ +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 *); + +#endif /* _TERM_ENTRY_H */ + +/* term_entry.h ends here */ diff --git a/include/termcap.h.in b/include/termcap.h.in new file mode 100644 index 00000000..adae0b74 --- /dev/null +++ b/include/termcap.h.in @@ -0,0 +1,54 @@ +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* $Id: termcap.h.in,v 1.4 1997/02/08 21:50:39 tom Exp $ */ + +#ifndef _TERMCAP_H +#define _TERMCAP_H 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "@NCURSES_MAJOR@.@NCURSES_MINOR@" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include + +extern char PC; +extern char *UP; +extern char *BC; +extern short ospeed; + +extern int tgetent(char *, const char *); +extern int tgetflag(const char *); +extern int tgetnum(const char *); +extern char *tgetstr(const char *, char **); + +extern int tputs(const char *, int, int (*)(int)); + +extern char *tgoto(const char *, int, int); + +#ifdef __cplusplus +} +#endif + +#endif /* _TERMCAP_H */ diff --git a/include/tic.h b/include/tic.h new file mode 100644 index 00000000..b7485310 --- /dev/null +++ b/include/tic.h @@ -0,0 +1,199 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* + * tic.h - Global variables and structures for the terminfo + * compiler. + * + */ + +#ifndef __TIC_H +#define __TIC_H + +#include /* 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 */ +#define MAX_NAME_SIZE 127 /* maximum legal name field size */ +#define MAX_ENTRY_SIZE 4096 /* maximum legal entry size */ +#define MAX_ALIAS 14 /* maximum size of individual name or alias */ + +/* location of user's personal info directory */ +#define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */ + +#define DEBUG(n, a) if (_nc_tracing & (1 << (n - 1))) _tracef a +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; + + /* + * 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); + +#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 + +/* 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; + +/* captoinfo.c: capability conversion */ +extern char *_nc_captoinfo(char *const, char *, int const); +extern char *_nc_infotocap(char *const, char *, int const); + +/* 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); + +#endif /* __TIC_H */ diff --git a/include/unctrl.h.in b/include/unctrl.h.in new file mode 100644 index 00000000..b3c3c1e1 --- /dev/null +++ b/include/unctrl.h.in @@ -0,0 +1,54 @@ +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* + * 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. + * + * The returned pointer points to a static buffer which gets overwritten by + * each call. Therefore, you must copy the resulting string to a safe place + * before calling unctrl() again. + * + */ + +/* $Id: unctrl.h.in,v 1.5 1997/04/26 23:04:09 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 + +extern NCURSES_CONST char *unctrl(chtype); + +#ifdef __cplusplus +} +#endif + +#endif /* _UNCTRL_H */ diff --git a/install-sh b/install-sh new file mode 100755 index 00000000..ab74c882 --- /dev/null +++ b/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/man/MKterminfo.sh b/man/MKterminfo.sh new file mode 100755 index 00000000..66b58615 --- /dev/null +++ b/man/MKterminfo.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# +# 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 master 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 +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 +" | tr "" "\012" +cat $tail diff --git a/man/Makefile.in b/man/Makefile.in new file mode 100644 index 00000000..b4dbbd33 --- /dev/null +++ b/man/Makefile.in @@ -0,0 +1,57 @@ +# $Id: Makefile.in,v 1.20 1996/08/04 01:16:40 tom Exp $ +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# 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: terminfo.5 + +$(INSTALL_PREFIX)$(mandir) : + $(srcdir)/../mkinstalldirs $@ + +install install.man : terminfo.5 $(INSTALL_PREFIX)$(mandir) + sh ./edit_man.sh $(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 + +clean mostlyclean: + rm -f terminfo.5 + +distclean realclean: clean + rm -f Makefile edit_man.* diff --git a/man/captoinfo.1m b/man/captoinfo.1m new file mode 100644 index 00000000..ee031f73 --- /dev/null +++ b/man/captoinfo.1m @@ -0,0 +1,159 @@ +'\" t +.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\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 +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/clear.1 b/man/clear.1 new file mode 100644 index 00000000..28317e24 --- /dev/null +++ b/man/clear.1 @@ -0,0 +1,19 @@ +.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/man/curs_addch.3x b/man/curs_addch.3x new file mode 100644 index 00000000..d00bd1b4 --- /dev/null +++ b/man/curs_addch.3x @@ -0,0 +1,146 @@ +'\" t +.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 \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. (To emit control characters +literally, use \fBechochar\fR.) + +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_ULCORNER + upper left-hand corner +ACS_LLCORNER + lower left-hand corner +ACS_URCORNER + upper right-hand corner +ACS_LRCORNER + lower right-hand corner +ACS_RTEE + right tee +ACS_LTEE + left tee +ACS_BTEE + bottom tee +ACS_TTEE + top tee +ACS_HLINE - horizontal line +ACS_VLINE | vertical line +ACS_PLUS + plus +ACS_S1 - scan line 1 +ACS_S9 \&_ scan line 9 +ACS_DIAMOND + diamond +ACS_CKBOARD : checker board (stipple) +ACS_DEGREE ' degree symbol +ACS_PLMINUS # plus/minus +ACS_BULLET o bullet +ACS_LARROW < arrow pointing left +ACS_RARROW > arrow pointing right +ACS_DARROW v arrow pointing down +ACS_UARROW ^ arrow pointing up +ACS_BOARD # board of squares +ACS_LANTERN # lantern symbol +ACS_BLOCK # solid square block +ACS_S3 - scan line 3 +ACS_S7 - scan line 7 +ACS_LEQUAL < less-than-or-equal-to +ACS_GEQUAL > greater-than-or-equal-to +ACS_PI * greek pi +ACS_NEQUAL ! not-equal +ACS_STERLING f pound-sterling symbol +.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 EXTENSIONS +The following extended \fBcurses\fR features are available only on PC-clone +consoles and compatible terminals obeying the ANSI.SYS de-facto standard for +terminal control sequences. They are not part of XSI curses. + +The attribute A_ALTCHARSET actually forces literal display of PC ROM characters +including the high-half graphics. Your console driver may still capture or +translate a few (such as ESC) but this feature should give you access to the +card-suit characters, up and down-arrow, and most others in the range 0-32. +(In a terminfo entry designed for use with \fBncurses\fR, the high-half +characters are obtained using this attribute with an \fBacsc\fR string in +which the second of each pair is a high-half character.) + +Giving \fBwechochar\fR an argument with its high bit set will produce the +corresponding high-half ASCII graphic (SVr4 curses also has this feature but +does not document it). A control-character argument, however, will not +typically produce the corresponding graphic; characters such as CR, NL, FF and +TAB are typically interpreted by the console driver itself, and ESC will be +interpreted as the leader of a control sequence. +.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. + +The seven ACS symbols starting with \fBACS_S3\fR 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/man/curs_addchstr.3x b/man/curs_addchstr.3x new file mode 100644 index 00000000..fd5600dd --- /dev/null +++ b/man/curs_addchstr.3x @@ -0,0 +1,55 @@ +.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 \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/man/curs_addstr.3x b/man/curs_addstr.3x new file mode 100644 index 00000000..3859a34b --- /dev/null +++ b/man/curs_addstr.3x @@ -0,0 +1,48 @@ +.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 \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/man/curs_attr.3x b/man/curs_attr.3x new file mode 100644 index 00000000..d9568a5f --- /dev/null +++ b/man/curs_attr.3x @@ -0,0 +1,172 @@ +.\" $Id: curs_attr.3x,v 1.12 1997/01/05 01:14:33 tom Exp $ +.TH curs_attr 3X "" +.SH NAME +\fBattroff\fR, \fBwattroff\fR, \fBattron\fR, \fBwattron\fR, +\fBattrset\fR, \fBwattrset\fR, \fBstandend\fR, \fBwstandend\fR, \fBstandout\fR, +\fBwstandout\fR - \fBcurses\fR character and window attribute control routines +.SH SYNOPSIS +\fB#include \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 standend(void);\fR +.br +\fBint wstandend(WINDOW *win);\fR +.br +\fBint standout(void);\fR +.br +\fBint wstandout(WINDOW *win);\fR +.br +\fBattr_t attr_get(void);\fR +.br +\fBattr_t wattr_get(WINDOW *);\fR +.br +\fBint attr_off(attr_t attrs);\fR +.br +\fBint wattr_off(WINDOW *, attr_t attrs);\fR +.br +\fBint attr_on(attr_t attrs);\fR +.br +\fBint wattr_on(WINDOW *, attr_t attrs);\fR +.br +\fBint attr_set(attr_t attrs);\fR +.br +\fBint wattr_set(WINDOW *, attr_t attrs);\fR +.br +\fBint chgat(int n, attr_t attr, short color, const void *opts)\fR +.br +\fBint wchgat(WINDOW *, int n, attr_t attr, + short color, const void *opts)\fR +.br +\fBint mvchgat(int y, int x, int n, attr_t attr, + short color, const void *opts)\fR +.br +\fBint mvwchgat(WINDOW *, int y, int x, int n, attr_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 \fBwattr_get\fR returns the current attribute for the given +window; \fBattr_get\fR returns the current attribute 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\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(\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/man/curs_beep.3x b/man/curs_beep.3x new file mode 100644 index 00000000..140f255c --- /dev/null +++ b/man/curs_beep.3x @@ -0,0 +1,34 @@ +.TH curs_beep 3X "" +.SH NAME +\fBbeep\fR, \fBflash\fR - \fBcurses\fR bell and screen flash routines +.SH SYNOPSIS +\fB#include \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/man/curs_bkgd.3x b/man/curs_bkgd.3x new file mode 100644 index 00000000..97b4094f --- /dev/null +++ b/man/curs_bkgd.3x @@ -0,0 +1,74 @@ +.\" $Id: curs_bkgd.3x,v 1.10 1996/07/20 23:48:30 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 \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/man/curs_border.3x b/man/curs_border.3x new file mode 100644 index 00000000..a9e49151 --- /dev/null +++ b/man/curs_border.3x @@ -0,0 +1,80 @@ +.\" $Id: curs_border.3x,v 1.8 1996/08/04 00:29:11 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 \fR +.br +\fBint border(chtype ls, chtype rs, chtype ts, chtype bs, + chtype tl, chtype tr, chtype bl, chtype br);\fR +.br +\fBint wborder(WINDOW *win, chtype ls, chtype rs, + chtype ts, chtype bs, chtype tl, chtype tr, + chtype 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_BLCORNER\fR, \fBACS_BRCORNER\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/man/curs_clear.3x b/man/curs_clear.3x new file mode 100644 index 00000000..1a9efb7c --- /dev/null +++ b/man/curs_clear.3x @@ -0,0 +1,65 @@ +.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 \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/man/curs_color.3x b/man/curs_color.3x new file mode 100644 index 00000000..b228ebaa --- /dev/null +++ b/man/curs_color.3x @@ -0,0 +1,162 @@ +.\" $Id: curs_color.3x,v 1.8 1997/01/19 02:50:30 tom 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 \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\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\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/man/curs_delch.3x b/man/curs_delch.3x new file mode 100644 index 00000000..d7973a98 --- /dev/null +++ b/man/curs_delch.3x @@ -0,0 +1,39 @@ +.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 \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/man/curs_deleteln.3x b/man/curs_deleteln.3x new file mode 100644 index 00000000..2b471099 --- /dev/null +++ b/man/curs_deleteln.3x @@ -0,0 +1,55 @@ +.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 \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 a 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/man/curs_getch.3x b/man/curs_getch.3x new file mode 100644 index 00000000..092c8b78 --- /dev/null +++ b/man/curs_getch.3x @@ -0,0 +1,239 @@ +.\" $Id: curs_getch.3x,v 1.10 1997/01/05 11:57:54 Jesse.Thilo 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 \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\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\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_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_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 NCURSES feature macro. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_inopts\fR(3X), \fBcurs_move\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/man/curs_getstr.3x b/man/curs_getstr.3x new file mode 100644 index 00000000..cd3abf4d --- /dev/null +++ b/man/curs_getstr.3x @@ -0,0 +1,73 @@ +.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 \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/man/curs_getyx.3x b/man/curs_getyx.3x new file mode 100644 index 00000000..58a3a52e --- /dev/null +++ b/man/curs_getyx.3x @@ -0,0 +1,43 @@ +.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 \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/man/curs_inch.3x b/man/curs_inch.3x new file mode 100644 index 00000000..9cfb6cef --- /dev/null +++ b/man/curs_inch.3x @@ -0,0 +1,44 @@ +.\" $Id: curs_inch.3x,v 1.7 1997/01/05 01:29:23 tom 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 \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\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/man/curs_inchstr.3x b/man/curs_inchstr.3x new file mode 100644 index 00000000..75c02b2f --- /dev/null +++ b/man/curs_inchstr.3x @@ -0,0 +1,55 @@ +.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 \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\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 curs_inch(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/man/curs_initscr.3x b/man/curs_initscr.3x new file mode 100644 index 00000000..0ede098d --- /dev/null +++ b/man/curs_initscr.3x @@ -0,0 +1,87 @@ +.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 \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/man/curs_inopts.3x b/man/curs_inopts.3x new file mode 100644 index 00000000..64d0dad4 --- /dev/null +++ b/man/curs_inopts.3x @@ -0,0 +1,183 @@ +.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 \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 curs_getch(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 curs_getch(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/man/curs_insch.3x b/man/curs_insch.3x new file mode 100644 index 00000000..11f49053 --- /dev/null +++ b/man/curs_insch.3x @@ -0,0 +1,39 @@ +.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 \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/man/curs_insstr.3x b/man/curs_insstr.3x new file mode 100644 index 00000000..efbb6d64 --- /dev/null +++ b/man/curs_insstr.3x @@ -0,0 +1,61 @@ +.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 \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 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/man/curs_instr.3x b/man/curs_instr.3x new file mode 100644 index 00000000..dcc5f023 --- /dev/null +++ b/man/curs_instr.3x @@ -0,0 +1,56 @@ +.\" $Id: curs_instr.3x,v 1.7 1997/03/15 23:25:24 tom 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 \fR + +\fBint instr(char *str);\fR +.br +\fBint innstr(char *str, int n);\fR +.br +\fBint winstr(WINDOW *win, char *str);\fR +.br +\fBint winnstr(WINDOW *win, char *str, int n);\fR +.br +\fBint mvinstr(int y, int x, char *str);\fR +.br +\fBint mvinnstr(int y, int x, char *str, int n);\fR +.br +\fBint mvwinstr(WINDOW *win, int y, int x, char *str);\fR +.br +\fBint mvwinnstr(WINDOW *win, int y, int x, char *str, int n);\fR +.br +.SH DESCRIPTION +These routines return a string of characters in \fIstr\fR, extracted starting +at the current cursor position in the named window. +Attributes are stripped from the characters. The four +functions with \fIn\fR as the last argument return a leading substring at most +\fIn\fR characters long (exclusive of the trailing NUL). +.SH RETURN VALUE +All of the functions return \fBERR\fR upon failure, +or the number of characters actually read into the string. +.SH NOTES +Note that all routines except \fBwinnstr\fR may be macros. +.SH PORTABILITY +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). +SVr4 does not +document whether a length limit includes or excludes the trailing NUL. +.PP +The ncurses library extends the XSI description by allowing a negative +value for \fIn\fR. +In this case, the functions return the string ending at the right margin. +.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/man/curs_kernel.3x b/man/curs_kernel.3x new file mode 100644 index 00000000..ffba687f --- /dev/null +++ b/man/curs_kernel.3x @@ -0,0 +1,123 @@ +.TH curs_kernel 3X "" +.SH NAME +\fBdef_prog_mode\fR, \fBdef_shell_mode\fR, +\fBreset_prog_mode\fR, \fBreset_shell_mode\fR, \fBresetty\fR, +\fBsavetty\fR, \fBgetsyx\fR, \fBsetsyx\fR, \fBripoffline\fR, +\fBcurs_set\fR, \fBnapms\fR - low-level \fBxscurses\fR routines +.SH SYNOPSIS +\fB#include \fR + +\fBint def_prog_mode(void);\fR +.br +\fBint def_shell_mode(void);\fR +.br +\fBint reset_prog_mode(void);\fR +.br +\fBint reset_shell_mode(void);\fR +.br +\fBint resetty(void);\fR +.br +\fBint savetty(void);\fR +.br +\fBvoid getsyx(int y, int x);\fR +.br +\fBvoid setsyx(int y, int x);\fR +.br +\fBint ripoffline(int line, int (*init)(WINDOW *, int));\fR +.br +\fBint curs_set(int visibility);\fR +.br +\fBint napms(int ms);\fR +.br +.SH DESCRIPTION +The following routines give low-level access to various \fBcurses\fR +capabilities. Theses routines typically are used inside library +routines. + +The \fBdef_prog_mode\fR and \fBdef_shell_mode\fR routines save the +current terminal modes as the "program" (in \fBcurses\fR) or "shell" +(not in \fBcurses\fR) state for use by the \fBreset_prog_mode\fR and +\fBreset_shell_mode\fR routines. This is done automatically by +\fBinitscr\fR. There is one such save area for each screen context +allocated by \fBnewterm()\fR. + +The \fBreset_prog_mode\fR and \fBreset_shell_mode\fR routines restore +the terminal to "program" (in \fBcurses\fR) or "shell" (out of +\fBcurses\fR) state. These are done automatically by \fBendwin\fR +and, after an \fBendwin\fR, by \fBdoupdate\fR, so they normally are +not called. + +The \fBresetty\fR and \fBsavetty\fR routines save and restore the +state of the terminal modes. \fBsavetty\fR saves the current state in +a buffer and \fBresetty\fR restores the state to what it was at the +last call to \fBsavetty\fR. + +The \fBgetsyx\fR routine returns the current coordinates of the virtual screen +cursor in \fIy\fR and \fIx\fR. If \fBleaveok\fR is currently \fBTRUE\fR, then +\fB-1\fR,\fB-1\fR is returned. If lines have been removed from the top of the +screen, using \fBripoffline\fR, \fIy\fR and \fIx\fR include these lines; +therefore, \fIy\fR and \fIx\fR should be used only as arguments for +\fBsetsyx\fR. + +The \fBsetsyx\fR routine sets the virtual screen cursor to +\fIy\fR, \fIx\fR. If \fIy\fR and \fIx\fR are both \fB-1\fR, then +\fBleaveok\fR is set. The two routines \fBgetsyx\fR and \fBsetsyx\fR +are designed to be used by a library routine, which manipulates +\fBcurses\fR windows but does not want to change the current position +of the program's cursor. The library routine would call \fBgetsyx\fR +at the beginning, do its manipulation of its own windows, do a +\fBwnoutrefresh\fR on its windows, call \fBsetsyx\fR, and then call +\fBdoupdate\fR. + +The \fBripoffline\fR routine provides access to the same facility that +\fBslk_init\fR [see curs_slk(3X)] uses to reduce the size of the +screen. \fBripoffline\fR must be called before \fBinitscr\fR or +\fBnewterm\fR is called. If \fIline\fR is positive, a line is removed +from the top of \fBstdscr\fR; if \fIline\fR is negative, a line is +removed from the bottom. When this is done inside \fBinitscr\fR, the +routine \fBinit\fR (supplied by the user) is called with two +arguments: a window pointer to the one-line window that has been +allocated and an integer with the number of columns in the window. +Inside this initialization routine, the integer variables \fBLINES\fR +and \fBCOLS\fR (defined in \fB\fR) are not guaranteed to be +accurate and \fBwrefresh\fR or \fBdoupdate\fR must not be called. It +is allowable to call \fBwnoutrefresh\fR during the initialization +routine. + +\fBripoffline\fR can be called up to five times before calling \fBinitscr\fR or +\fBnewterm\fR. + +The \fBcurs_set\fR routine sets the cursor state is set to invisible, +normal, or very visible for \fBvisibility\fR equal to \fB0\fR, +\fB1\fR, or \fB2\fR respectively. If the terminal supports the +\fIvisibility\fR requested, the previous \fIcursor\fR state is +returned; otherwise, \fBERR\fR is returned. + +The \fBnapms\fR routine is used to sleep for \fIms\fR milliseconds. +.SH RETURN VALUE +Except for \fBcurs_set\fR, these routines always return \fBOK\fR. +\fBcurs_set\fR returns the previous cursor state, or \fBERR\fR if the +requested \fIvisibility\fR is not supported. +.SH NOTES +Note that \fBgetsyx\fR is a macro, so \fB&\fR is not necessary before +the variables \fIy\fR and \fIx\fR. + +The SVr4 man pages warn that the return value of \fBcurs_set\fR "is currently +incorrect". This implementation gets it right, but it may be unwise to count +on the correctness of the return value anywhere else. +.SH PORTABILITY +The functions \fBsetsyx\fR and \fBgetsyx\fR are not described in the XSI +Curses standard, Issue 4. All other functions are as described in XSI Curses. + +The SVr4 documentation describes \fBsetsyx\fR and \fBgetsyx\fR as having return +type int. This is misleading, as they are macros with no documented semantics +for the return value. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_initscr\fR(3X), \fBcurs_outopts\fR(3X), \fBcurs_refresh\fR(3X), +\fBcurs_scr_dump\fR(3X), \fBcurs_slk\fR(3X) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/curs_mouse.3x b/man/curs_mouse.3x new file mode 100644 index 00000000..ad7d601d --- /dev/null +++ b/man/curs_mouse.3x @@ -0,0 +1,151 @@ +'\" t +.TH curs_mouse 3X "" +.SH NAME +\fBgetmouse\fR, \fBungetmouse\fR, +\fBmousemask\fR - mouse interface through curses +.SH SYNOPSIS +.nf +\fB#include \fR + +\fBtypedef unsigned long mmask_t; + +typedef struct +{ + short id; \fI/* ID to distinguish multiple devices */\fB + int x, y, z; \fI/* event coordinates */\fB + mmask_t bstate; \fI/* button state bits */\fB +} +MEVENT;\fR +.fi +.br +\fBint getmouse(MEVENT *event);\fR +.br +\fBint ungetmouse(MEVENT *event);\fR +.br +\fBmmask_t mousemask(mmask_t newmask, mmask_t *oldmask);\fR +.br +\fBbool wenclose(WINDOW *win, int y, int x)\fR +.br +\fBint mouseinterval(int erval)\fR +.br +.SH DESCRIPTION +These functions provide an interface to mouse events from +\fBncurses\fR(3x). Mouse events are represented by \fBKEY_MOUSE\fR +pseudo-key values in the \fBwgetch\fR input stream. + +To make mouse events visible, use the \fBmousemask\fR function. This will set +the mouse events to be reported. By default, no mouse events are reported. +The function will return a mask to indicate which of the specified mouse events +can be reported; on complete failure it returns 0. If oldmask is non-NULL, +this function fills the indicated location with the previous value of the given +window's mouse event mask. + +As a side effect, setting a zero mousemask may turn off the mouse pointer; +setting a nonzero mask may turn it on. Whether this happens is +device-dependent. + +Here are the mouse event type masks: + +.TS +l l +_ _ +l l. +\fIName\fR \fIDescription\fR +BUTTON1_PRESSED mouse button 1 down +BUTTON1_RELEASED mouse button 1 up +BUTTON1_CLICKED mouse button 1 clicked +BUTTON1_DOUBLE_CLICKED mouse button 1 double clicked +BUTTON1_TRIPLE_CLICKED mouse button 1 triple clicked +BUTTON2_PRESSED mouse button 2 down +BUTTON2_RELEASED mouse button 2 up +BUTTON2_CLICKED mouse button 2 clicked +BUTTON2_DOUBLE_CLICKED mouse button 2 double clicked +BUTTON2_TRIPLE_CLICKED mouse button 2 triple clicked +BUTTON3_PRESSED mouse button 3 down +BUTTON3_RELEASED mouse button 3 up +BUTTON3_CLICKED mouse button 3 clicked +BUTTON3_DOUBLE_CLICKED mouse button 3 double clicked +BUTTON3_TRIPLE_CLICKED mouse button 3 triple clicked +BUTTON4_PRESSED mouse button 4 down +BUTTON4_RELEASED mouse button 4 up +BUTTON4_CLICKED mouse button 4 clicked +BUTTON4_DOUBLE_CLICKED mouse button 4 double clicked +BUTTON4_TRIPLE_CLICKED mouse button 4 triple clicked +BUTTON_SHIFT shift was down during button state change +BUTTON_CTRL control was down during button state change +BUTTON_ALT alt was down during button state change +ALL_MOUSE_EVENTS report all button state changes +REPORT_MOUSE_POSITION report mouse movement +.TE + +Once a class of mouse events have been made visible in a window, +calling the \fBwgetch\fR function on that window may return +\fBKEY_MOUSE\fR as an indicator that a mouse event has been queued. +To read the event data and pop the event off the queue, call +\fBgetmouse\fR. This function will return \fBOK\fR if a mouse event +is actually visible in the given window, \fBERR\fR otherwise. +When \fBgetmouse\fR returns \fBOK\fR, the data deposited as y and +x in the event structure coordinates will be screen-relative character-cell +coordinates. The returned state mask will have exactly one bit set to +indicate the event type. + +The \fBungetmouse\fR function behaves analogously to \fBungetch\fR. It pushes +a \fBKEY_MOUSE\fR event onto the input queue, and associates with that event +the given state data and screen-relative character-cell coordinates. + +The \fBwenclose\fR function tests whether a given pair of screen-relative +character-cell coordinates is enclosed by a given window, returning TRUE +if it is and FALSE otherwise. It is useful for determining what subset of +the screen windows enclose the location of a mouse event. + +The \fBmouseinterval\fR function sets the maximum time (in thousands of a +second) that can elapse between press and release events in order for them to +be recognized as a click. This function returns the previous interval value. +The default is one fifth of a second. + +Note that mouse events will be ignored when input is in cooked mode, and will +cause an error beep when cooked mode is being simulated in a window by a +function such as \fBgetstr\fR that expects a linefeed for input-loop +termination. + +.SH RETURN VALUE +All routines return the integer \fBERR\fR upon failure or \fBOK\fR +upon successful completion. +.SH PORTABILITY +These calls were designed for \fBncurses\fR(3x), and are not found in SVr4 +curses, 4.4BSD curses, or any other previous version of curses. + +The feature macro \fBNCURSES_MOUSE_VERSION\fR is provided so the preprocessor +can be used to test whether these features are present (its value is 1). NOTE: +THIS INTERFACE IS EXPERIMENTAL AND IS SUBJECT TO CHANGE WITHOUT NOTICE! If the +interface is changed, the value of \fBNCURSES_MOUSE_VERSION\fR will be +incremented. + +The order of the \fBMEVENT\fR structure members is not guaranteed. +Additional fields may be added to the structure in the future. + +Under \fBncurses\fR(3x), these calls are implemented using either +xterm's built-in mouse-tracking API or Alessandro Rubini's gpm server. +If you are using something other than xterm there is no gpm daemon +running on your machine, mouse events will not be visible to +\fBncurses\fR(3x) (and the \fBwmousemask\fR function will always +return \fB0\fR). + +The z member in the event structure is not presently used. It is intended +for use with touch screens (which may be pressure-sensitive) or with +3D-mice/trackballs/power gloves. +.SH BUGS +Mouse events under xterm will not in fact be ignored during cooked mode, +if they have been enabled by \fBwmousemask\fR. Instead, the xterm mouse +report sequence will appear in the string read. + +Mouse events under xterm will not be detected correctly in a window with +its keypad bit off. +.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/man/curs_move.3x b/man/curs_move.3x new file mode 100644 index 00000000..7d915ed2 --- /dev/null +++ b/man/curs_move.3x @@ -0,0 +1,34 @@ +.TH curs_move 3X "" +.SH NAME +\fBmove\fR, \fBwmove\fR - move \fBcurses\fR window cursor +.SH SYNOPSIS +\fB#include \fR + +\fBint move(int y, int x);\fR +.br +\fBint wmove(WINDOW *win, int y, int x);\fR +.br +.SH DESCRIPTION +These routines move the cursor associated with the window to line \fIy\fR and +column \fIx\fR. This routine does not move the physical cursor of the terminal +until \fBrefresh\fR is called. The position specified is relative to the upper +left-hand corner of the window, which is (0,0). +.SH RETURN VALUE +These routines return \fBERR\fR upon failure and OK (SVr4 +specifies only "an integer value other than \fBERR\fR") upon successful +completion. +.SH NOTES +Note that \fBmove\fR may be a macro. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4. The +standard specifies that if (y,x) is within a multi-column character, the cursor +is moved to the first column of that character; however, this implementation +does not yet support the extended-level XSI multi-byte characters. +.SH SEE ALSO +\fBcurses\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/man/curs_outopts.3x b/man/curs_outopts.3x new file mode 100644 index 00000000..d8e4189a --- /dev/null +++ b/man/curs_outopts.3x @@ -0,0 +1,135 @@ +.TH curs_outopts 3X "" +.SH NAME +\fBclearok\fR, \fBidlok\fR, \fBidcok immedok\fR, +\fBleaveok\fR, \fBsetscrreg\fR, \fBwsetscrreg\fR, \fBscrollok\fR, +\fBnl\fR, \fBnonl\fR - \fBcurses\fR output options +.SH SYNOPSIS +\fB#include \fR + +\fBint clearok(WINDOW *win, bool bf);\fR +.br +\fBint idlok(WINDOW *win, bool bf);\fR +.br +\fBvoid idcok(WINDOW *win, bool bf);\fR +.br +\fBvoid immedok(WINDOW *win, bool bf);\fR +.br +\fBint leaveok(WINDOW *win, bool bf);\fR +.br +\fBint setscrreg(int top, int bot);\fR +.br +\fBint wsetscrreg(WINDOW *win, int top, int bot);\fR +.br +\fBint scrollok(WINDOW *win, bool bf);\fR +.br +\fBint nl(void);\fR +.br +\fBint nonl(void);\fR +.br +.SH DESCRIPTION +These routines set options that change the style of output within +\fBcurses\fR. All options are initially \fBFALSE\fR, unless otherwise stated. +It is not necessary to turn these options off before calling \fBendwin\fR. + +If \fBclearok\fR is called with \fBTRUE\fR as argument, the next +call to \fBwrefresh\fR with this window will clear the screen completely and +redraw the entire screen from scratch. This is useful when the contents of the +screen are uncertain, or in some cases for a more pleasing visual effect. If +the \fIwin\fR argument to \fBclearok\fR is the global variable \fBcurscr\fR, +the next call to \fBwrefresh\fR with any window causes the screen to be cleared +and repainted from scratch. + +If \fBidlok\fR is called with \fBTRUE\fR as second argument, \fBcurses\fR +considers using the hardware insert/delete line feature of terminals so +equipped. Calling \fBidlok\fR with \fBFALSE\fR as second argument disables use +of line insertion and deletion. This option should be enabled only if the +application needs insert/delete line, for example, for a screen editor. It is +disabled by default because insert/delete line tends to be visually annoying +when used in applications where it isn't really needed. If insert/delete line +cannot be used, \fBcurses\fR redraws the changed portions of all lines. + +If \fBidcok\fR is called with \fBFALSE\fR as second argument, \fBcurses\fR +no longer considers using the hardware insert/delete character feature of +terminals so equipped. Use of character insert/delete is enabled by default. +Calling \fBidcok\fR with \fBTRUE\fR as second argument re-enables use +of character insertion and deletion. + +If \fBimmedok\fR is called with \fBTRUE as argument\fR, any change +in the window image, such as the ones caused by \fBwaddch, wclrtobot, wscrl\fR, +\fIetc\fR., automatically cause a call to \fBwrefresh\fR. However, it may +degrade performance considerably, due to repeated calls to \fBwrefresh\fR. +It is disabled by default. + +Normally, the hardware cursor is left at the location of the window cursor +being refreshed. The \fBleaveok\fR option allows the cursor to be left +wherever the update happens to leave it. It is useful for applications where +the cursor is not used, since it reduces the need for cursor motions. If +possible, the cursor is made invisible when this option is enabled. + +The \fBsetscrreg\fR and \fBwsetscrreg\fR routines allow the application +programmer to set a software scrolling region in a window. \fItop\fR and +\fIbot\fR are the line numbers of the top and bottom margin of the scrolling +region. (Line 0 is the top line of the window.) If this option and +\fBscrollok\fR are enabled, an attempt to move off the bottom margin line +causes all lines in the scrolling region to scroll one line in the direction +of the first line. Only the text of the window is scrolled. (Note that this +has nothing to do with the use of a physical scrolling region capability in the +terminal, like that in the VT100. If \fBidlok\fR is enabled and the terminal +has either a scrolling region or insert/delete line capability, they will +probably be used by the output routines.) + +The \fBscrollok\fR option controls what happens when the cursor of a window is +moved off the edge of the window or scrolling region, either as a result of a +newline action on the bottom line, or typing the last character of the last +line. If disabled, (\fIbf\fR is \fBFALSE\fR), the cursor is left on the bottom +line. If enabled, (\fIbf\fR is \fBTRUE\fR), the window is scrolled up one line +(Note that in order to get the physical scrolling effect on the terminal, it is +also necessary to call \fBidlok\fR). + +The \fBnl\fR and \fBnonl\fR routines control whether the underlying display +device translates the return key into newline on input, and whether it +translates newline into return and line-feed on output (in either case, the +call \fBaddch('\n')\fR does the equivalent of return and line feed on the +virtual screen). Initially, these translations do occur. If you disable them +using \fBnonl\fR, \fBcurses\fR will be able to make better use of the line-feed +capability, resulting in faster cursor motion. Also, \fBcurses\fR will then be +able to detect the return key. +.SH RETURN VALUE +The functions \fBsetscrreg\fR and \fBwsetscrreg\fR return \fBOK\fR upon success +and \fBERR\fR upon failure. All other routines that return an integer always +return \fBOK\fR. +.SH PORTABILITY +These functions are described in the XSI Curses standard, Issue 4. + +The XSI Curses standard is ambiguous on the question of whether \fBraw\fR() +should disable the CRLF translations controlled by \fBnl\fR() and \fBnonl\fR(). +BSD curses did turn off these translations; AT&T curses (at least as late as +SVr1) did not. We choose to do so, on the theory that a programmer requesting +raw input wants a clean (ideally 8-bit clean) connection that the operating +system does not mess with. + +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. + +Earlier System V curses implementations specified that with \fBscrollok\fR +enabled, any window modification triggering a scroll also forced a physical +refresh. XSI Curses does not require this, and \fBncurses\fR avoids doing +it in order to perform better vertical-motion optimization at \fBwrefresh\fR +time. +.SH NOTES +Note that \fBclearok\fR, \fBleaveok\fR, \fBscrollok\fR, \fBidcok\fR, \fBnl\fR, +\fBnonl\fR and \fBsetscrreg\fR may be macros. + +The \fBimmedok\fR routine is useful for windows that are used as terminal +emulators. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_addch\fR(3X), \fBcurs_clear\fR(3X), +\fBcurs_initscr\fR(3X), \fBcurs_scroll\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/man/curs_overlay.3x b/man/curs_overlay.3x new file mode 100644 index 00000000..0c7b93df --- /dev/null +++ b/man/curs_overlay.3x @@ -0,0 +1,46 @@ +.TH curs_overlay 3X "" +.SH NAME +\fBoverlay\fR, \fBoverwrite\fR, \fBcopywin\fR - overlay and +manipulate overlapped \fBcurses\fR windows +.SH SYNOPSIS +\fB#include \fR + +\fBint overlay(const WINDOW *srcwin, WINDOW *dstwin);\fR +.br +\fBint overwrite(const WINDOW *srcwin, WINDOW *dstwin);\fR +.br +\fBint copywin(WINDOW *srcwin, WINDOW *dstwin, int sminrow, + int smincol, int dminrow, int dmincol, int dmaxrow, + int dmaxcol, int overlay);\fR +.SH DESCRIPTION +The \fBoverlay\fR and \fBoverwrite\fR routines overlay \fIsrcwin\fR on +top of \fIdstwin\fR. \fIscrwin\fR and \fIdstwin\fR are not required +to be the same size; only text where the two windows overlap is +copied. The difference is that \fBoverlay\fR is non-destructive +(blanks are not copied) whereas \fBoverwrite\fR is destructive. + +The \fBcopywin\fR routine provides a finer granularity of control over the +\fBoverlay\fR and \fBoverwrite\fR routines. Like in the \fBprefresh\fR +routine, a rectangle is specified in the destination window, (\fIdminrow\fR, +\fIdmincol\fR) and (\fIdmaxrow\fR, \fIdmaxcol\fR), and the upper-left-corner +coordinates of the source window, (\fIsminrow\fR, \fIsmincol\fR). If the +argument \fIoverlay\fR is \fBtrue\fR, then copying is non-destructive, as in +\fBoverlay\fR. +.SH RETURN VALUE +Routines that return an integer return \fBERR\fR upon failure, and \fBOK\fR +(SVr4 only specifies "an integer value other than \fBERR\fR") upon successful +completion. +.SH NOTES +Note that \fBoverlay\fR and \fBoverwrite\fR may be macros. +.SH PORTABILITY +The XSI Curses standard, Issue 4 describes these functions (adding the const +qualifiers). It further specifies their behavior in the presence of characters +with multi-byte renditions (not yet supported in this implementation). +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_pad\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/man/curs_pad.3x b/man/curs_pad.3x new file mode 100644 index 00000000..18969c94 --- /dev/null +++ b/man/curs_pad.3x @@ -0,0 +1,82 @@ +.TH curs_pad 3X "" +.SH NAME +\fBnewpad\fR, \fBsubpad\fR, \fBprefresh\fR, +\fBpnoutrefresh\fR, \fBpechochar\fR - create and display \fBcurses\fR +pads +.SH SYNOPSIS +\fB#include \fR + +\fBWINDOW *newpad(int nlines, int ncols);\fR +.br +\fBWINDOW *subpad(WINDOW *orig, int nlines, int ncols, + int begin_y, int begin_x);\fR +.br +\fBint prefresh(WINDOW *pad, int pminrow, int pmincol, + int sminrow, int smincol, int smaxrow, int smaxcol);\fR +.br +\fBint pnoutrefresh(WINDOW *pad, int pminrow, int pmincol, + int sminrow, int smincol, int smaxrow, int smaxcol);\fR +.br +\fBint pechochar(WINDOW *pad, chtype ch);\fR +.SH DESCRIPTION +The \fBnewpad\fR routine creates and returns a pointer to a new pad data +structure with the given number of lines, \fInlines\fR, and columns, +\fIncols\fR. A pad is like a window, except that it is not restricted by the +screen size, and is not necessarily associated with a particular part of the +screen. Pads can be used when a large window is needed, and only a part of the +window will be on the screen at one time. Automatic refreshes of pads +(\fIe\fR.\fIg\fR., from scrolling or echoing of input) do not occur. It is not +legal to call \fBwrefresh\fR with a \fIpad\fR as an argument; the routines +\fBprefresh\fR or \fBpnoutrefresh\fR should be called instead. Note that these +routines require additional parameters to specify the part of the pad to be +displayed and the location on the screen to be used for the display. + +The \fBsubpad\fR routine creates and returns a pointer to a subwindow within a +pad with the given number of lines, \fInlines\fR, and columns, \fIncols\fR. +Unlike \fBsubwin\fR, which uses screen coordinates, the window is at position +(\fIbegin\fR_\fIx\fR\fB,\fR \fIbegin\fR_\fIy\fR) on the pad. The window is +made in the middle of the window \fIorig\fR, so that changes made to one window +affect both windows. During the use of this routine, it will often be +necessary to call \fBtouchwin\fR or \fBtouchline\fR on \fIorig\fR before +calling \fBprefresh\fR. + +The \fBprefresh\fR and \fBpnoutrefresh\fR routines are analogous to +\fBwrefresh\fR and \fBwnoutrefresh\fR except that they relate to pads instead +of windows. The additional parameters are needed to indicate what part of the +pad and screen are involved. \fIpminrow\fR and \fIpmincol\fR specify the upper +left-hand corner of the rectangle to be displayed in the pad. \fIsminrow\fR, +\fIsmincol\fR, \fIsmaxrow\fR, and \fIsmaxcol\fR specify the edges of the +rectangle to be displayed on the screen. The lower right-hand corner of the +rectangle to be displayed in the pad is calculated from the screen coordinates, +since the rectangles must be the same size. Both rectangles must be entirely +contained within their respective structures. Negative values of +\fIpminrow\fR, \fIpmincol\fR, \fIsminrow\fR, or \fIsmincol\fR are treated as if +they were zero. + +The \fBpechochar\fR routine is functionally equivalent to a call to \fBaddch\fR +followed by a call to \fBrefresh\fR, a call to \fBwaddch\fR followed by a call +to \fBwrefresh\fR, or a call to \fBwaddch\fR followed by a call to +\fBprefresh.\fR The knowledge that only a single character is being output is +taken into consideration and, for non-control characters, a considerable +performance gain might be seen by using these routines instead of their +equivalents. In the case of \fBpechochar\fR, the last location of the pad on +the screen is reused for the arguments to \fBprefresh\fR. +.SH RETURN VALUE +Routines that return an integer return \fBERR\fR upon failure and \fBOK\fR +(SVr4 only specifies "an integer value other than \fBERR\fR") upon successful +completion. + +Routines that return pointers return \fBNULL\fR on error, and set \fBerrno\fR +to \fBENOMEM\fR. +.SH NOTES +Note that \fBpechochar\fR may be a macro. +.SH PORTABILITY +The XSI Curses standard, Issue 4 describes these functions. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_refresh\fR(3X), \fBcurs_touch\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/man/curs_print.3x b/man/curs_print.3x new file mode 100644 index 00000000..19851b99 --- /dev/null +++ b/man/curs_print.3x @@ -0,0 +1,45 @@ +.TH curs_print 3X "" +.SH NAME +\fBmcprint\fR - ship binary data to printer +.SH SYNOPSIS +\fB#include \fR + +\fBint mcprint(char *data, int len);\fR +.SH DESCRIPTION +This function uses the \fBmc5p\fR or \fBmc4\fR and \fBmc5\fR capabilities, +if they are present, to ship given data to a printer attached to the terminal. + +Note that the \fBmcprint\fR code has no way to do flow control with the printer +or to know how much buffering it has. Your application is responsible for +keeping the rate of writes to the printer below its continuous throughput rate +(typically about half of its nominal cps rating). Dot-matrix printers and +6-page-per-minute lasers can typically handle 80cps, so a good conservative +rule of thumb is to sleep for a second after shipping each 80-character line. + +.SH RETURN VALUE +The \fBmcprint\fR function returns \fBERR\fR if the write operation aborted +for some reason. In this case, errno will contain either an error associated +with \fBwrite(2)\fR or one of the following: +.TP 5 +ENODEV +Capabilities for printer redirection don't exist. +.TP 5 +ENOMEM +Couldn't allocate sufficient memory to buffer the printer write. + +When \fBmcprint\fR succeeds, it returns the number of characters actually +sent to the printer. +.SH PORTABILITY +The \fBmcprint\fR call was designed for \fBncurses\fR(3x), and is not found +in SVr4 curses, 4.4BSD curses, or any other previous version of curses. +.SH BUGS +Padding in the \fBmc5p\fR, \fBmc4\fR and \fBmc5\fR capabilities will not be +interpreted. +.SH SEE ALSO +\fBcurses\fR(3X)\fR +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/curs_printw.3x b/man/curs_printw.3x new file mode 100644 index 00000000..e3ac2e8d --- /dev/null +++ b/man/curs_printw.3x @@ -0,0 +1,47 @@ +.TH curs_printw 3X "" +.SH NAME +\fBprintw\fR, \fBwprintw\fR, \fBmvprintw\fR, +\fBmvwprintw\fR, \fBvwprintw\fR - print formatted output in +\fBcurses\fR windows +.SH SYNOPSIS +\fB#include \fR + +\fBint printw(char *fmt\fR [\fB, arg\fR] \fB...);\fR +.br +\fBint wprintw(WINDOW *win, char *fmt\fR [\fB, arg\fR] \fB...);\fR +.br +\fBint mvprintw(int y, int x, char *fmt\fR [\fB, arg\fR] \fB...);\fR +.br +\fBint mvwprintw(WINDOW *win, int y, int x, + \fBchar *fmt\fR [\fB, arg]\fR ...); + +\fB#include \fR +.br +\fBint vwprintw(WINDOW *win, char *fmt, varglist);\fR +.br +.SH DESCRIPTION +The \fBprintw\fR, \fBwprintw\fR, \fBmvprintw\fR and \fBmvwprintw\fR +routines are analogous to \fBprintf\fR [see \fBprintf\fR(3S)]. In +effect, the string that would be output by \fBprintf\fR is output +instead as though \fBwaddstr\fR were used on the given window. + +The \fBvwprintw\fR routine is analogous to \fBvprintf\fR [see +\fBprintf\fR(3S)] and performs a \fBwprintw\fR using a variable +argument list. The third argument is a \fBva_list\fR, a pointer to a +list of arguments, as defined in \fB\fR. +.SH RETURN VALUE +Routines that return an integer return \fBERR\fR upon failure and \fBOK\fR +(SVr4 only specifies "an integer value other than \fBERR\fR") upon successful +completion. +.SH PORTABILITY +The XSI Curses standard, Issue 4 describes these functions. The function +\fBvwprintw\fR is marked TO BE WITHDRAWN, and is to be replaced by a function +\fBvw_printw\fR using the \fB\fR interface. +.SH SEE ALSO +\fBcurses\fR(3X), \fBprintf\fR(3S), \fBvprintf(3S)\fR +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/curs_refresh.3x b/man/curs_refresh.3x new file mode 100644 index 00000000..77bae2ee --- /dev/null +++ b/man/curs_refresh.3x @@ -0,0 +1,84 @@ +.TH curs_refresh 3X "" +.SH NAME +\fBrefresh\fR, \fBwrefresh\fR, \fBwnoutrefresh\fR, +\fBdoupdate\fR, \fBredrawwin\fR, \fBwredrawln\fR - refresh +\fBcurses\fR windows and lines +.SH SYNOPSIS +\fB#include \fR + +\fBint refresh(void);\fR +.br +\fBint wrefresh(WINDOW *win);\fR +.br +\fBint wnoutrefresh(WINDOW *win);\fR +.br +\fBint doupdate(void);\fR +.br +\fBint redrawwin(WINDOW *win);\fR +.br +\fBint wredrawln(WINDOW *win, int beg_line, int num_lines);\fR +.br +.SH DESCRIPTION +The \fBrefresh\fR and \fBwrefresh\fR routines (or \fBwnoutrefresh\fR and +\fBdoupdate\fR) must be called to get actual output to the terminal, as other +routines merely manipulate data structures. The routine \fBwrefresh\fR copies +the named window to the physical terminal screen, taking into account what is +already there in order to do optimizations. The \fBrefresh\fR routine is the +same, using \fBstdscr\fR as the default window. Unless \fBleaveok\fR has been +enabled, the physical cursor of the terminal is left at the location of the +cursor for that window. + +The \fBwnoutrefresh\fR and \fBdoupdate\fR routines allow multiple updates with +more efficiency than \fBwrefresh\fR alone. In addition to all the window +structures, \fBcurses\fR keeps two data structures representing the terminal +screen: a physical screen, describing what is actually on the screen, and a +virtual screen, describing what the programmer wants to have on the screen. + +The routine \fBwrefresh\fR works by first calling \fBwnoutrefresh\fR, which +copies the named window to the virtual screen, and then calling \fBdoupdate\fR, +which compares the virtual screen to the physical screen and does the actual +update. If the programmer wishes to output several windows at once, a series +of calls to \fBwrefresh\fR results in alternating calls to \fBwnoutrefresh\fR +and \fBdoupdate\fR, causing several bursts of output to the screen. By first +calling \fBwnoutrefresh\fR for each window, it is then possible to call +\fBdoupdate\fR once, resulting in only one burst of output, with fewer total +characters transmitted and less CPU time used. If the \fIwin\fR argument to +\fBwrefresh\fR is the global variable \fBcurscr\fR, the screen is immediately +cleared and repainted from scratch. + +The phrase "copies the named window to the virtual screen" above is ambiguous. +What actually happens is that all \fItouched\fR (changed) lines in the window +are copied to the virtual screen. This affects programs that use overlapping +windows; it means that if two windows overlap, you can refresh them in either +order and the overlap region will be modified only when it is explicitly +changed. (But see the section on \fBPORTABILITY\fR below for a warning about +exploiting this behavior.) + +The \fBwredrawln\fR routine indicates to \fBcurses\fR that some screen lines +are corrupted and should be thrown away before anything is written over them +it touches the indicated lines (marking them changed) then does a refresh +of the window. The routine \fBredrawwin\fR() touches the entire window and then +refreshes it. +.SH RETURN VALUE +Routines that return an integer return \fBERR\fR upon failure, and \fBOK\fR +(SVr4 only specifies "an integer value other than \fBERR\fR") upon successful +completion. +.SH NOTES +Note that \fBrefresh\fR and \fBredrawwin\fR may be macros. +.SH PORTABILITY +The XSI Curses standard, Issue 4 describes these functions. + +Whether \fBwnoutrefresh()\fR copies to the virtual screen the entire contents +of a window or just its changed portions has never been well-documented in +historic curses versions (including SVr4). It might be unwise to rely on +either behavior in programs that might have to be linked with other curses +implementations. Instead, you can do an explicit \fBtouchwin()\fR before the +\fBwnoutrefresh()\fR call to guarantee an entire-contents copy anywhere. +.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/man/curs_scanw.3x b/man/curs_scanw.3x new file mode 100644 index 00000000..6ce1c0d2 --- /dev/null +++ b/man/curs_scanw.3x @@ -0,0 +1,48 @@ +.TH curs_scanw 3X "" +.SH NAME +\fBscanw\fR, \fBwscanw\fR, \fBmvscanw\fR, +\fBmvwscanw\fR, \fBvwscanw\fR - convert formatted input from a +\fBcurses\fR widow +.SH SYNOPSIS +\fB#include \fR + +\fBint scanw(char *fmt\fR [\fB, arg\fR] \fB...);\fR +.br +\fBint wscanw(WINDOW *win, char *fmt\fR [\fB, arg\fR] \fB...);\fR +.br +\fBint mvscanw(int y, int x, char *fmt\fR [\fB, arg\fR] \fB...);\fR +.br +\fBint mvwscanw(WINDOW *win, int y, int x, + char *fmt\fR [\fB, arg]\fR \fB...);\fR +.br +\fBint vwscanw(WINDOW *win, char *fmt, va_list varglist);\fR +.SH DESCRIPTION +The \fBscanw\fR, \fBwscanw\fR and \fBmvscanw\fR routines are analogous to +\fBscanf\fR [see \fBscanf\fR(3S)]. The effect of these routines is as though +\fBwgetstr\fR were called on the window, and the resulting line used as input +for \fBsscanf\fR(3). Fields which do not map to a variable in the \fIfmt\fR +field are lost. + +The \fBvwscanw\fR routine is similar to \fBvwprintw\fR in that it performs a +\fBwscanw\fR using a variable argument list. The third argument is a +\fIva\fR_\fIlist\fR, a pointer to a list of arguments, as defined in +\fB\fR. +.SH RETURN VALUE +\fBvwscanw\fR returns \fBERR\fR on failure and an integer equal to the +number of fields scanned on success. + +Applications may use the return value from the \fBscanw\fR, \fBwscanw\fR, +\fBmvscanw\fR and \fBmvwscanw\fR routines to determine the number of fields +which were mapped in the call. +.SH PORTABILITY +The XSI Curses standard, Issue 4 describes these functions. The function +\fBvwscanw\fR is marked TO BE WITHDRAWN, and is to be replaced by a function +\fBvw_scanw\fR using the \fB\fR interface. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_getstr\fR, \fBcurs_printw\fR, \fBscanf\fR(3S) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/curs_scr_dmp.3x b/man/curs_scr_dmp.3x new file mode 100644 index 00000000..c1b89f12 --- /dev/null +++ b/man/curs_scr_dmp.3x @@ -0,0 +1,64 @@ +.TH curs_scr_dump 3X "" +.SH NAME +\fBscr_dump\fR, \fBscr_restore\fR, +\fBscr_init\fR, \fBscr_set\fR - read (write) a \fBcurses\fR screen +from (to) a file +.SH SYNOPSIS +\fB#include \fR + +\fBint scr_dump(const char *filename);\fR +.br +\fBint scr_restore(const char *filename);\fR +.br +\fBint scr_init(const char *filename);\fR +.br +\fBint scr_set(const char *filename);\fR +.br +.SH DESCRIPTION +The \fBscr_dump\fR routine dumps the current contents of the virtual screen +to the file \fIfilename\fR. + +The \fBscr_restore\fR routine sets the virtual screen to the contents +of \fIfilename\fR, which must have been written using \fBscr_dump\fR. The next +call to \fBdoupdate\fR restores the screen to the way it looked in the dump +file. + +The \fBscr_init\fR routine reads in the contents of \fIfilename\fR and uses +them to initialize the \fBcurses\fR data structures about what the terminal +currently has on its screen. If the data is determined to be valid, +\fBcurses\fR bases its next update of the screen on this information rather +than clearing the screen and starting from scratch. \fBscr_init\fR is used +after \fBinitscr\fR or a \fBsystem\fR [see \fBsystem\fR(BA_LIB)] call to share +the screen with another process which has done a \fBscr_dump\fR after its +\fBendwin\fR call. The data is declared invalid if the terminfo capabilities +\fBrmcup\fR and \fBnrrmc\fR exist; also if the terminal has been written to +since the preceding \fBscr_dump\fR call. + +The \fBscr_set\fR routine is a combination of \fBscr_restore\fR and +\fBscr_init\fR. It tells the program that the information in \fIfilename\fR is +what is currently on the screen, and also what the program wants on the screen. +This can be thought of as a screen inheritance function. + +To read (write) a window from (to) a file, use the \fBgetwin\fR and +\fBputwin\fR routines [see \fBcurs_util\fR(3X)]. +.SH RETURN VALUE +All routines return the integer \fBERR\fR upon failure and \fBOK\fR +upon success. +.SH NOTES +Note that \fBscr_init\fR, \fBscr_set\fR, and \fBscr_restore\fR may be macros. +.SH PORTABILITY +The XSI Curses standard, Issue 4, describes these functions (adding the const +qualifiers). + +The SVr4 docs merely say under \fBscr_init\fR that the dump data is also +considered invalid "if the time-stamp of the tty is old" but don't define +"old". +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_initscr\fR(3X), \fBcurs_refresh\fR(3X), +\fBcurs_util\fR(3X), \fBsystem\fR(3S) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/curs_scroll.3x b/man/curs_scroll.3x new file mode 100644 index 00000000..0ac518d5 --- /dev/null +++ b/man/curs_scroll.3x @@ -0,0 +1,49 @@ +.TH curs_scroll 3X "" +.SH NAME +\fBscroll\fR, \fBsrcl\fR, \fBwscrl\fR - scroll a \fBcurses\fR window +.SH SYNOPSIS +\fB#include \fR + +\fBint scroll(WINDOW *win);\fR +.br +\fBint scrl(int n);\fR +.br +\fBint wscrl(WINDOW *win, int n);\fR +.br +.SH DESCRIPTION +The \fBscroll\fR routine scrolls the window up one line. This involves moving +the lines in the window data structure. As an optimization, if the scrolling +region of the window is the entire screen, the physical screen may be scrolled +at the same time. + +For positive \fIn\fR, the \fBscrl\fR and \fBwscrl\fR routines scroll the +window up \fIn\fR lines (line \fIi\fR+\fIn\fR becomes \fIi\fR); otherwise +scroll the window down \fIn\fR lines. This involves moving the lines in the +window character image structure. The current cursor position is not changed. + +For these functions to work, scrolling must be enabled via \fBscrollok\fR. +.SH RETURN VALUE +These routines return \fBERR\fR upon failure, and \fBOK\fR (SVr4 only specifies +"an integer value other than \fBERR\fR") upon successful completion. +.SH NOTES +Note that \fBscrl\fR and \fBscroll\fR may be macros. + +The SVr4 documentation says that the optimization of physically scrolling +immediately if the scroll region is the entire screen "is" performed, not +"may be" performed. This implementation deliberately does not guarantee +that this will occur, in order to leave open the possibility of smarter +optimization of multiple scroll actions on the next update. + +Neither the SVr4 documentation specifies whether the current attribute or +current color-pair of blanks generated by the scroll function is zeroed. +Under this implementation it is. +.SH PORTABILITY +The XSI Curses standard, Issue 4 describes these functions. +.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/man/curs_slk.3x b/man/curs_slk.3x new file mode 100644 index 00000000..ac25bf3c --- /dev/null +++ b/man/curs_slk.3x @@ -0,0 +1,104 @@ +.TH curs_slk 3X "" +.SH NAME +\fBslk_init\fR, \fBslk_set\fR, \fBslk_refresh\fR, +\fBslk_noutrefresh\fR, \fBslk_label\fR, \fBslk_clear\fR, \fBslk_restore\fR, +\fBslk_touch\fR, \fBslk_attron\fR, \fBslk_attrset\fR, \fBslk_attroff\fR - +\fBcurses\fR soft label routines +.SH SYNOPSIS +\fB#include \fR + +\fBint slk_init(int fmt);\fR +.br +\fBint slk_set(int labnum, const char *label, int fmt);\fR +.br +\fBint slk_refresh(void);\fR +.br +\fBint slk_noutrefresh(void);\fR +.br +\fBchar *slk_label(int labnum);\fR +.br +\fBint slk_clear(void);\fR +.br +\fBint slk_restore(void);\fR +.br +\fBint slk_touch(void);\fR +.br +\fBint slk_attron(attr_t attrs);\fR +.br +\fBint slk_attrset(attr_t attrs);\fR +.br +\fBattr_t slk_attr(void);\fR +.br +\fBint slk_attroff(attr_t attrs);\fR +.br +.SH DESCRIPTION +The slk* functions manipulate the set of soft function-key labels that exist on +many terminals. For those terminals that do not have soft labels, +\fBcurses\fR takes over the bottom line of \fBstdscr\fR, reducing the size of +\fBstdscr\fR and the variable \fBLINES\fR. \fBcurses\fR standardizes on eight +labels of up to eight characters each. In addition to this, the ncurses +implementation supports a mode where it simulates 12 labels of up to five +characters each. This is most common for todays PC like enduser devices. +Please note that ncurses simulates this mode by taking over up to two lines at +the bottom of the screen, it doesn't try to use any hardware support for this +mode. + +The \fBslk_init\fR routine must be called before \fBinitscr\fR or \fBnewterm\fR +is called. If \fBinitscr\fR eventually uses a line from \fBstdscr\fR to +emulate the soft labels, then \fIfmt\fR determines how the labels are arranged +on the screen. Setting \fIfmt\fR to \fB0\fR indicates a 3-2-3 arrangement of +the labels, \fB1\fR indicates a 4-4 arrangement and \fB2\fR indicates the +PC like 4-4-4 mode. If \fBfmt\fR is set to \fB3\fR, it is again the PC like +4-4-4 mode, but in addition an index line is generated, helping the user to +identify the key numbers easily. + +The \fBslk_set\fR routine requires \fIlabnum\fR to be a label number, +from \fB1\fR to \fB8\fR (resp. \fB12\fR); \fIlabel\fR must be the string +to be put on the label, up to eight (resp. five) characters in length. +A null string or a null pointer sets up a blank label. \fIfmt\fR is either +\fB0\fR, \fB1\fR, or \fB2\fR, indicating whether the label is to be +left-justified, centered, or right-justified, respectively, within the +label. + +The \fBslk_refresh\fR and \fBslk_noutrefresh\fR routines correspond to +the \fBwrefresh\fR and \fBwnoutrefresh\fR routines. + +The \fBslk_label\fR routine returns the current label for label number +\fIlabnum\fR, with leading and trailing blanks stripped. + +The \fBslk_clear\fR routine clears the soft labels from the screen. + +The \fBslk_restore\fR routine, restores the soft labels to the screen +after a \fBslk_clear\fR has been performed. + +The \fBslk_touch\fR routine forces all the soft labels to be output +the next time a \fBslk_noutrefresh\fR is performed. + +The \fBslk_attron\fR, \fBslk_attrset\fR, \fBslk_attroff\fR and \fBslk_attr\fR +routines correspond to \fBattron\fR, \fBattrset\fR, \fBattroff\fR and \fBattr_get\fR. +They have an effect only if soft labels are simulated on the bottom line of +the screen. The default highlight for soft keys is A_STANDOUT (as in +System V curses, which does not document this fact). +.SH RETURN VALUE +These routines return \fBERR\fR upon failure and OK (SVr4 specifies only "an +integer value other than \fBERR\fR") upon successful completion. \fBslk_attr\fR +returns the attribute used for the soft keys. + +\fBslk_label\fR returns \fBNULL\fR on error. +.SH NOTES +Most applications would use \fBslk_noutrefresh\fR because a +\fBwrefresh\fR is likely to follow soon. +.SH PORTABILITY +The XSI Curses standard, Issue 4, describes these functions. It changes the +argument type of the attribute-manipulation functions \fBslk_attron\fR, +\fBslk_attroff\fR, \fBslk_attrset\fR to be \fBattr_t\fR, and adds \fBconst\fR +qualifiers. The format codes \fB2\fR and \fB3\fR for \fBslk_init()\fR and the +function \fBslk_attr\fR are specific to ncurses. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_attr\fR(3X), \fBcurs_initscr\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/man/curs_termattrs.3x b/man/curs_termattrs.3x new file mode 100644 index 00000000..5c65d3c5 --- /dev/null +++ b/man/curs_termattrs.3x @@ -0,0 +1,78 @@ +.TH curs_termattrs 3X "" +.SH NAME +\fBbaudrate\fR, \fBerasechar\fR, \fBhas_ic\fR, +\fBhas_il\fR, \fBkillchar\fR, \fBlongname\fR, \fBtermattrs\fR, +\fBtermname\fR - \fBcurses\fR environment query routines +.SH SYNOPSIS +\fB#include \fR + +\fBint baudrate(void);\fR +.br +\fBchar erasechar(void);\fR +.br +\fBint has_ic(void);\fR +.br +\fBint has_il(void);\fR +.br +\fBchar killchar(void);\fR +.br +\fBchar *longname(void);\fR +.br +\fBattr_t termattrs(void);\fR +.br +\fBchar *termname(void);\fR +.br +.SH DESCRIPTION +The \fBbaudrate\fR routine returns the output speed of the terminal. The +number returned is in bits per second, for example \fB9600\fR, and is an +integer. + +The \fBerasechar\fR routine returns the user's current erase character. + +The \fBhas_ic\fR routine is true if the terminal has insert- and delete- +character capabilities. + +The \fBhas_il\fR routine is true if the terminal has insert- and delete-line +capabilities, or can simulate them using scrolling regions. This might +be used to determine if it would be appropriate to turn on physical +scrolling using \fBscrollok\fR. + +The \fBkillchar\fR routine returns the user's current line kill character. + +The \fBlongname\fR routine returns a pointer to a static area +containing a verbose description of the current terminal. The maximum +length of a verbose description is 128 characters. It is defined only +after the call to \fBinitscr\fR or \fBnewterm\fR. The area is +overwritten by each call to \fBnewterm\fR and is not restored by +\fBset_term\fR, so the value should be saved between calls to +\fBnewterm\fR if \fBlongname\fR is going to be used with multiple +terminals. + +If a given terminal doesn't support a video attribute that an +application program is trying to use, \fBcurses\fR may substitute a +different video attribute for it. The \fBtermattrs\fR function +returns a logical \fBOR\fR of all video attributes supported by the +terminal. This information is useful when a \fBcurses\fR program +needs complete control over the appearance of the screen. + +The \fBtermname\fR routine returns the value of the environmental +variable \fBTERM\fR (truncated to 14 characters). +.SH RETURN VALUE +\fBlongname\fR and \fBtermname\fR return \fBNULL\fR on error. + +Routines that return an integer return \fBERR\fR upon failure and \fBOK\fR +(SVr4 only specifies "an integer value other than \fBERR\fR") upon successful +completion. +.SH NOTES +Note that \fBtermattrs\fR may be a macro. +.SH PORTABILITY +The XSI Curses standard, Issue 4 describes these functions. It changes the +return type of \fBtermattrs\fR to the new type \fBattr_t\fR. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_initscr\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/man/curs_termcap.3x b/man/curs_termcap.3x new file mode 100644 index 00000000..23a3ba06 --- /dev/null +++ b/man/curs_termcap.3x @@ -0,0 +1,80 @@ +.TH curs_termcap 3X "" +.ds n 5 +.SH NAME +\fBtgetent\fR, \fBtgetflag\fR, \fBtgetnum\fR, +\fBtgetstr\fR, \fBtgoto\fR, \fBtputs\fR - direct \fBcurses\fR +interface to the terminfo capability database +.SH SYNOPSIS +\fB#include \fR +.br +\fB#include \fR +.br +\fBint tgetent(const char *bp, char *name);\fR +.br +\fBint tgetflag(const char *id);\fR +.br +\fBint tgetnum(const char *id);\fR +.br +\fBchar *tgetstr(const char *id, char **area);\fR +.br +\fBchar *tgoto(const char *cap, int col, int row);\fR +.br +\fBint tputs(const char *str, int affcnt, int (*putc)(int));\fR +.br +.SH DESCRIPTION +These routines are included as a conversion aid for programs that use +the \fItermcap\fR library. Their parameters are the same and the +routines are emulated using the \fIterminfo\fR database. Thus, they +can only be used to query the capabilities of entries for which a +terminfo entry has been compiled. + +The \fBtgetent\fR routine loads the entry for \fIname\fR. +It returns 1 on success, 0 if there is no such entry, and -1 if the +terminfo database could not be found. +The emulation ignores the buffer pointer \fIbp\fR. + +The \fBtgetflag\fR routine gets the boolean entry for \fIid\fR. + +The \fBtgetnum\fR routine gets the numeric entry for \fIid\fR. + +The \fBtgetstr\fR routine returns the string entry for \fIid\fR. Use +\fBtputs\fR to output the returned string. + +The \fBtgoto\fR routine instantiates the parameters into the given capability. +The output from this routine is to be passed to \fBtputs\fR. + +The \fBtputs\fR routine is described on the curs_\fBterminfo\fR(3X) manual +page. It can retrieve capabilities by either termcap or terminfo name. + +.SH RETURN VALUE +Except where explicitly noted, +routines that return an integer return \fBERR\fR upon failure and \fBOK\fR +(SVr4 only specifies "an integer value other than \fBERR\fR") upon successful +completion. + +Routines that return pointers return \fBNULL\fR on error. +.SH BUGS +If you call \fBtgetstr\fR to fetch \fBca\fR or any other parameterized string, +be aware that it will be returned in terminfo notation, not the older and +not-quite-compatible termcap notation. This won't cause problems if all +you do with it is call \fBtgoto\fR or \fBtparm\fR, which both expand +terminfo-style. + +Because terminfo conventions for representing padding in string capabilities +differ from termcap's, \fBtputs("50");\fR will put out a literal "50" rather +than busy-waiting for 50 milliseconds. Cope with it. +.SH PORTABILITY +The XSI Curses standard, Issue 4 describes these functions. However, they +are marked TO BE WITHDRAWN and may be removed in future versions. + +Neither the XSI Curses standard nor the SVr4 man pages documented the return +values of \fBtgetent\fR correctly, though all three were in fact returned ever +since SVr1. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_terminfo(\*n), putc(3S).\fR +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/curs_terminfo.3x b/man/curs_terminfo.3x new file mode 100644 index 00000000..1b31a02d --- /dev/null +++ b/man/curs_terminfo.3x @@ -0,0 +1,213 @@ +.\" $Id: curs_terminfo.3x,v 1.6 1996/06/15 22:45:50 tom Exp $ +.TH curs_terminfo 3X "" +.ds n 5 +.SH NAME +\fBsetupterm\fR, \fBsetterm\fR, +\fBset_curterm\fR, \fBdel_curterm\fR, \fBrestartterm\fR, \fBtparm\fR, +\fBtputs\fR, \fBputp\fR, \fBvidputs\fR, \fBvidattr\fR, \fBmvcur\fR, +\fBtigetflag\fR, \fBtigetnum\fR, \fBtigetstr\fR - \fBcurses\fR +interfaces to terminfo database +.SH SYNOPSIS +\fB#include \fR +.br +\fB#include \fR + +\fBint setupterm(const char *term, int fildes, int *errret);\fR +.br +\fBint setterm(const char *term);\fR +.br +\fBTERMINAL *set_curterm(TERMINAL *nterm);\fR +.br +\fBint del_curterm(TERMINAL *oterm);\fR +.br +\fBint restartterm(const char *term, int fildes, int *errret);\fR +.br +\fBchar *tparm(const char *str, ...);\fR +.br +\fBchar *tparam(const char *str, char *buffer, int size, ...);\fR +.br +\fBint tputs(const char *str, int affcnt, int (*putc)(int));\fR +.br +\fBint putp(const char *str);\fR +.br +\fBint vidputs(chtype attrs, int (*putc)(char));\fR +.br +\fBint vidattr(chtype attrs);\fR +.br +\fBint mvcur(int oldrow, int oldcol, int newrow, int newcol);\fR +.br +\fBint tigetflag(const char *capname);\fR +.br +\fBint tigetnum(const char *capname);\fR +.br +\fBchar *tigetstr(const char *capname);\fR +.br +.SH DESCRIPTION +These low-level routines must be called by programs that have to deal +directly with the \fBterminfo\fR database to handle certain terminal +capabilities, such as programming function keys. For all other +functionality, \fBcurses\fR routines are more suitable and their use is +recommended. + +Initially, \fBsetupterm\fR should be called. Note that +\fBsetupterm\fR is automatically called by \fBinitscr\fR and +\fBnewterm\fR. This defines the set of terminal-dependent variables +[listed in \fBterminfo\fR(\*n)]. The \fBterminfo\fR variables +\fBlines\fR and \fBcolumns\fR are initialized by \fBsetupterm\fR as +follows: If \fBuse_env(FALSE)\fR has been called, values for +\fBlines\fR and \fBcolumns\fR specified in \fBterminfo\fR are used. +Otherwise, if the environment variables \fBLINES\fR and \fBCOLUMNS\fR +exist, their values are used. If these environment variables do not +exist and the program is running in a window, the current window size +is used. Otherwise, if the environment variables do not exist, the +values for \fBlines\fR and \fBcolumns\fR specified in the +\fBterminfo\fR database are used. + +The header files \fBcurses.h\fR and \fBterm.h\fR should be included (in this +order) to get the definitions for these strings, numbers, and flags. +Parameterized strings should be passed through \fBtparm\fR to instantiate them. +All \fBterminfo\fR strings [including the output of \fBtparm\fR] should be printed +with \fBtputs\fR or \fBputp\fR. Call the \fBreset_shell_mode\fR to restore the +tty modes before exiting [see \fBcurs_kernel\fR(3X)]. Programs which use +cursor addressing should output \fBenter_ca_mode\fR upon startup and should +output \fBexit_ca_mode\fR before exiting. Programs desiring shell escapes +should call + +\fBreset_shell_mode\fR and output \fBexit_ca_mode\fR before the shell +is called and should output \fBenter_ca_mode\fR and call +\fBreset_prog_mode\fR after returning from the shell. + +The \fBsetupterm\fR routine reads in the \fBterminfo\fR database, +initializing the \fBterminfo\fR structures, but does not set up the +output virtualization structures used by \fBcurses\fR. The terminal +type is the character string \fIterm\fR; if \fIterm\fR is null, the +environment variable \fBTERM\fR is used. All output is to file +descriptor \fBfildes\fR which is initialized for output. If +\fIerrret\fR is not null, then \fBsetupterm\fR returns \fBOK\fR or +\fBERR\fR and stores a status value in the integer pointed to by +\fIerrret\fR. A status of \fB1\fR in \fIerrret\fR is normal, \fB0\fR +means that the terminal could not be found, and \fB-1\fR means that +the \fBterminfo\fR database could not be found. If \fIerrret\fR is +null, \fBsetupterm\fR prints an error message upon finding an error +and exits. Thus, the simplest call is: + + \fBsetupterm((char *)0, 1, (int *)0);\fR, + +which uses all the defaults and sends the output to \fBstdout\fR. + +The \fBsetterm\fR routine is being replaced by \fBsetupterm\fR. The call: + + \fBsetupterm(\fR\fIterm\fR\fB, 1, (int *)0)\fR + +provides the same functionality as \fBsetterm(\fR\fIterm\fR\fB)\fR. +The \fBsetterm\fR routine is included here for BSD compatibility, and +is not recommended for new programs. + +The \fBset_curterm\fR routine sets the variable \fBcur_term\fR to +\fInterm\fR, and makes all of the \fBterminfo\fR boolean, numeric, and +string variables use the values from \fInterm\fR. It returns the old value +of \fBcur_term\fR. + +The \fBdel_curterm\fR routine frees the space pointed to by +\fIoterm\fR and makes it available for further use. If \fIoterm\fR is +the same as \fBcur_term\fR, references to any of the \fBterminfo\fR +boolean, numeric, and string variables thereafter may refer to invalid +memory locations until another \fBsetupterm\fR has been called. + +The \fBrestartterm\fR routine is similar to \fBsetupterm\fR and \fBinitscr\fR, +except that it is called after restoring memory to a previous state (for +example, when reloading a game saved as a core image dump). It assumes that +the windows and the input and output options are the same as when memory was +saved, but the terminal type and baud rate may be different. Accordingly, +it saves various tty state bits, does a setupterm, and then restores the bits. + +The \fBtparm\fR routine instantiates the string \fIstr\fR with +parameters \fIpi\fR. A pointer is returned to the result of \fIstr\fR +with the parameters applied. + +The \fBtparam\fR routine is included for compatibility with the GNU termcap +implementation. It works like \fBtparm\fR but you specify a buffer and buffer +size to be filled with the expanded string. + +The \fBtputs\fR routine applies padding information to the string +\fIstr\fR and outputs it. The \fIstr\fR must be a terminfo string +variable or the return value from \fBtparm\fR, \fBtgetstr\fR, or +\fBtgoto\fR. \fIaffcnt\fR is the number of lines affected, or 1 if +not applicable. \fIputc\fR is a \fBputchar\fR-like routine to which +the characters are passed, one at a time. + +The \fBputp\fR routine calls \fBtputs(\fR\fIstr\fR\fB, 1, putchar)\fR. +Note that the output of \fBputp\fR always goes to \fBstdout\fR, not to +the \fIfildes\fR specified in \fBsetupterm\fR. + +The \fBvidputs\fR routine displays the string on the terminal in the +video attribute mode \fIattrs\fR, which is any combination of the +attributes listed in \fBcurses\fR(3X). The characters are passed to +the \fBputchar\fR-like routine \fIputc\fR. + +The \fBvidattr\fR routine is like the \fBvidputs\fR routine, except +that it outputs through \fBputchar\fR. + +The \fBmvcur\fR routine provides low-level cursor motion. It takes +effect immediately (rather than at the next refresh). + +The \fBtigetflag\fR, \fBtigetnum\fR and \fBtigetstr\fR routines return +the value of the capability corresponding to the \fBterminfo\fR +\fIcapname\fR passed to them, such as \fBxenl\fR. + +The \fBtigetflag\fR routine returns the value \fB-1\fR if +\fIcapname\fR is not a boolean capability. + +The \fBtigetnum\fR routine returns the value \fB-2\fR if +\fIcapname\fR is not a numeric capability. + +The \fBtigetstr\fR routine returns the value \fB(char *)-1\fR +if \fIcapname\fR is not a string capability. + +The \fIcapname\fR for each capability is given in the table column entitled +\fIcapname\fR code in the capabilities section of \fBterminfo\fR(\*n). + +\fBchar *boolnames\fR, \fB*boolcodes\fR, \fB*boolfnames\fR + +\fBchar *numnames\fR, \fB*numcodes\fR, \fB*numfnames\fR + +\fBchar *strnames\fR, \fB*strcodes\fR, \fB*strfnames\fR + +These null-terminated arrays contain the \fIcapnames\fR, the +\fBtermcap\fR codes, and the full C names, for each of the +\fBterminfo\fR variables. +.SH RETURN VALUE +Routines that return an integer return \fBERR\fR upon failure and \fBOK\fR +(SVr4 only specifies "an integer value other than \fBERR\fR") upon successful +completion, unless otherwise noted in the preceding routine descriptions. + +Routines that return pointers always return \fBNULL\fR on error. +.SH NOTES +The \fBsetupterm\fR routine should be used in place of \fBsetterm\fR. +It may be useful when you want to test for terminal capabilities without +committing to the allocation of storage involved in \fBinitscr\fR. + +Note that \fBvidattr\fR and \fBvidputs\fR may be macros. +.SH PORTABILITY +The function \fBsetterm\fR is not described in the XSI Curses standard and must +be considered non-portable. All other functions are as described in the XSI +curses standard. + +In System V Release 4, \fBset_curterm\fR has an \fBint\fR return type and +returns \fBOK\fR or \fBERR\fR. We have chosen to implement the XSI Curses +semantics. + +In System V Release 4, the third argument of \fBtputs\fR has the type +\fBint (*putc)(char)\fR. + +The XSI Curses standard prototypes \fBtparm\fR with a fixed number of parameters, +rather than a variable argument list. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_initscr\fR(3X), \fBcurs_kernel\fR(3X), \fBcurs_termcap\fR(3X), +\fBputc\fR(3S), \fBterminfo\fR(\*n) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/curs_touch.3x b/man/curs_touch.3x new file mode 100644 index 00000000..5b67d3f8 --- /dev/null +++ b/man/curs_touch.3x @@ -0,0 +1,64 @@ +.TH curs_touch 3X "" +.SH NAME +\fBtouchwin\fR, \fBtouchline\fR, \fBuntouchwin\fR, +\fBwtouchln\fR, \fBis_linetouched\fR, \fBis_wintouched\fR - +\fBcurses\fR refresh control routines +.SH SYNOPSIS +\fB#include \fR +.br +\fBint touchwin(WINDOW *win);\fR +.br +\fBint touchline(WINDOW *win, int start, int count);\fR +.br +\fBint untouchwin(WINDOW *win);\fR +.br +\fBint wtouchln(WINDOW *win, int y, int n, int changed);\fR +.br +\fBint is_linetouched(WINDOW *win, int line);\fR +.br +\fBint is_wintouched(WINDOW *win);\fR +.br +.SH DESCRIPTION +The \fBtouchwin\fR and \fBtouchline\fR routines throw away all +optimization information about which parts of the window have been +touched, by pretending that the entire window has been drawn on. This +is sometimes necessary when using overlapping windows, since a change +to one window affects the other window, but the records of which lines +have been changed in the other window do not reflect the change. The +routine \fBtouchline\fR only pretends that \fIcount\fR lines have been +changed, beginning with line \fIstart\fR. + +The \fBuntouchwin\fR routine marks all lines in the window as unchanged since +the last call to \fBwrefresh\fR. + +The \fBwtouchln\fR routine makes \fIn\fR lines in the window, starting +at line \fIy\fR, look as if they have (\fIchanged\fR\fB=1\fR) or have +not (\fIchanged\fR\fB=0\fR) been changed since the last call to +\fBwrefresh\fR. + +The \fBis_linetouched\fR and \fBis_wintouched\fR routines return +\fBTRUE\fR if the specified line/window was modified since the last +call to \fBwrefresh\fR; otherwise they return \fBFALSE\fR. In +addition, \fBis_linetouched\fR returns \fBERR\fR if \fIline\fR is not +valid for the given window. +.SH RETURN VALUE +All routines return the integer \fBERR\fR upon failure and an integer value +other than \fBERR\fR upon successful completion, unless otherwise noted in the +preceding routine descriptions. +.SH PORTABILITY +The XSI Curses standard, Issue 4 describes these functions. + +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 NOTES +Note that all routines except \fBwtouchln\fR may be macros. +.SH SEE ALSO +\fBcurses\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/man/curs_util.3x b/man/curs_util.3x new file mode 100644 index 00000000..0d2e0b88 --- /dev/null +++ b/man/curs_util.3x @@ -0,0 +1,85 @@ +.TH curs_util 3X "" +.SH NAME +\fBunctrl\fR, \fBkeyname\fR, \fBfilter\fR, +\fBuse_env\fR, \fBputwin\fR, \fBgetwin\fR, \fBdelay_output\fR, +\fBflushinp\fR - miscellaneous \fBcurses\fR utility routines +.SH SYNOPSIS +\fB#include \fR + +\fBchar *unctrl(chtype c);\fR +.br +\fBchar *keyname(int c);\fR +.br +\fBvoid filter(void);\fR +.br +\fBvoid use_env(char bool);\fR +.br +\fBint putwin(WINDOW *win, FILE *filep);\fR +.br +\fBWINDOW *getwin(FILE *filep);\fR +.br +\fBint delay_output(int ms);\fR +.br +\fBint flushinp(void);\fR +.br +.SH DESCRIPTION +The \fBunctrl\fR macro expands to a character string which is a printable +representation of the character \fIc\fR. Control characters are displayed in +the \fB^\fR\fIX\fR notation. Printing characters are displayed as is. + +The \fBkeyname\fR routine returns a character string corresponding to +the key \fIc\fR. + +The \fBfilter\fR routine, if used, must be called before \fBinitscr\fR or +\fBnewterm\fR are called. The effect is that, during those calls, \fBLINES\fR +is set to 1; the capabilities \fBclear\fR, \fBcup\fR, \fBcud\fR, \fBcud1\fR, +\fBcuu1\fR, \fBcuu\fR, \fBvpa\fR are disabled; and the \fBhome\fR string is +set to the value of \fBcr\fR. + +The \fBuse_env\fR routine, if used, is called before \fBinitscr\fR or +\fBnewterm\fR are called. When called with \fBFALSE\fR as an +argument, the values of \fBlines\fR and \fBcolumns\fR specified in the +\fIterminfo\fR database will be used, even if environment variables +\fBLINES\fR and \fBCOLUMNS\fR (used by default) are set, or if +\fBcurses\fR is running in a window (in which case default behavior +would be to use the window size if \fBLINES\fR and \fBCOLUMNS\fR are +not set). + +The \fBputwin\fR routine writes all data associated with window \fIwin\fR into +the file to which \fIfilep\fR points. This information can be later retrieved +using the \fBgetwin\fR function. + +The \fBgetwin\fR routine reads window related data stored in the file by +\fBputwin\fR. The routine then creates and initializes a new window using that +data. It returns a pointer to the new window. + +The \fBdelay_output\fR routine inserts an \fIms\fR millisecond pause +in output. This routine should not be used extensively because +padding characters are used rather than a CPU pause. + +The \fBflushinp\fR routine throws away any typeahead that has been typed by the +user and has not yet been read by the program. +.SH RETURN VALUE +Except for \fBflushinp\fR, routines that return an integer return \fBERR\fR +upon failure and \fBOK\fR (SVr4 specifies only "an integer value other than +\fBERR\fR") upon successful completion. + +\fBflushinp\fR always returns \fBOK\fR. + +Routines that return pointers return \fBNULL\fR on error. +.SH PORTABILITY +The XSI Curses standard, Issue 4 describes these functions. + +The SVr4 documentation describes the action of \fBfilter\fR only in the vaguest +terms. The description here is adapted from the XSI Curses standard (which +erroneously fails to describe the disabling of \fBcuu\fR). +.SH NOTES +Note that \fBunctrl\fR is a macro, which is defined in <\fBunctrl.h\fR>. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_initscr\fR(3X), \fBcurs_scr_dump\fR(3X). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/curs_window.3x b/man/curs_window.3x new file mode 100644 index 00000000..9bd3facd --- /dev/null +++ b/man/curs_window.3x @@ -0,0 +1,123 @@ +.TH curs_window 3X "" +.SH NAME +\fBnewwin\fR, \fBdelwin\fR, \fBmvwin\fR, +\fBsubwin\fR, \fBderwin\fR, \fBmvderwin\fR, \fBdupwin\fR, +\fBwsyncup\fR, \fBsyncok\fR, \fBwcursyncup\fR, \fBwsyncdown\fR - +create \fBcurses\fR windows +.SH SYNOPSIS +\fB#include \fR + +\fBWINDOW *newwin(int nlines, int ncols, int begin_y,\fR + \fBintbegin_x);\fR +.br +\fBint delwin(WINDOW *win);\fR +.br +\fBint mvwin(WINDOW *win, int y, int x);\fR +.br +\fBWINDOW *subwin(WINDOW *orig, int nlines, int ncols, + int begin_y, int begin_x);\fR +.br +\fBWINDOW *derwin(WINDOW *orig, int nlines, int ncols, + int begin_y, int begin_x);\fR +.br +\fBint mvderwin(WINDOW *win, int par_y, int par_x);\fR +.br +\fBWINDOW *dupwin(WINDOW *win);\fR +.br +\fBvoid wsyncup(WINDOW *win);\fR +.br +\fBint syncok(WINDOW *win, bool bf);\fR +.br +\fBvoid wcursyncup(WINDOW *win);\fR +.br +\fBvoid wsyncdown(WINDOW *win);\fR +.br +.SH DESCRIPTION +Calling \fBnewwin\fR creates and returns a pointer to a new window with the +given number of lines and columns. The upper left-hand corner of the window is +at line \fIbegin\fR_\fIy\fR, column \fIbegin\fR_\fIx\fR. If either +\fInlines\fR or \fIncols\fR is zero, they default to \fBLINES -\fR +\fIbegin\fR_\fIy\fR and \fBCOLS -\fR \fIbegin\fR_\fIx\fR. A new full-screen +window is created by calling \fBnewwin(0,0,0,0)\fR. + +Calling \fBdelwin\fR deletes the named window, freeing all memory +associated with it (it does not actually erase the window's screen +image). Subwindows must be deleted before the main window can be +deleted. + +Calling \fBmvwin\fR moves the window so that the upper left-hand +corner is at position (\fIx\fR, \fIy\fR). If the move would cause the +window to be off the screen, it is an error and the window is not +moved. Moving subwindows is allowed, but should be avoided. + +Calling \fBsubwin\fR creates and returns a pointer to a new window +with the given number of lines, \fInlines\fR, and columns, +\fIncols\fR. The window is at position (\fIbegin\fR_\fIy\fR, +\fIbegin\fR_\fIx\fR) on the screen. (This position is relative to the +screen, and not to the window \fIorig\fR.) The window is made in the +middle of the window \fIorig\fR, so that changes made to one window +will affect both windows. The subwindow shares memory with the window +\fIorig\fR. When using this routine, it is necessary to call +\fBtouchwin\fR or \fBtouchline\fR on \fIorig\fR before calling +\fBwrefresh\fR on the subwindow. + +Calling \fBderwin\fR is the same as calling \fBsubwin,\fR except that +\fIbegin\fR_\fIy\fR and \fIbegin\fR_\fIx\fR are relative to the origin +of the window \fIorig\fR rather than the screen. There is no +difference between the subwindows and the derived windows. + +Calling \fBmvderwin\fR moves a derived window (or subwindow) +inside its parent window. The screen-relative parameters of the +window are not changed. This routine is used to display different +parts of the parent window at the same physical position on the +screen. + +Calling \fBdupwin\fR creates an exact duplicate of the window \fIwin\fR. + +Calling \fBwsyncup\fR touches all locations in ancestors of \fIwin\fR that are +changed in \fIwin\fR. If \fBsyncok\fR is called with second argument +\fBTRUE\fR then \fBwsyncup\fR is called automatically whenever there is a +change in the window. + +The \fBwsyncdown\fR routine touches each location in \fIwin\fR that has been +touched in any of its ancestor windows. This routine is called by +\fBwrefresh\fR, so it should almost never be necessary to call it manually. + +The routine \fBwcursyncup\fR updates the current cursor position of all the +ancestors of the window to reflect the current cursor position of the +window. +.SH RETURN VALUE +Routines that return an integer return the integer \fBERR\fR upon failure and +\fBOK\fR (SVr4 only specifies "an integer value other than \fBERR\fR") upon +successful completion. + +\fBdelwin\fR returns the integer \fBERR\fR upon failure and \fBOK\fR +upon successful completion. + +Routines that return pointers return \fBNULL\fR on error. +.SH NOTES +If many small changes are made to the window, the \fBwsyncup\fR option could +degrade performance. + +Note that \fBsyncok\fR may be a macro. +.SH BUGS +The subwindow functions (\fIsubwin\fR, \fIderwin\fR, \fImvderwin\fR, +\fBwsyncup\fR, \fBwsyncdown\fR, \fBwcursyncup\fR, \fBsyncok\fR) are flaky, +incompletely implemented, and not well tested. + +The System V curses documentation is very unclear about what \fBwsyncup\fR +and \fBwsyncdown\fR actually do. It seems to imply that they are only +supposed to touch exactly those lines that are affected by ancestor changes. +The language here, and the behavior of the \fBcurses\fR implementation, +is patterned on the XPG4 curses standard. The weaker XPG4 spec may result +in slower updates. +.SH PORTABILITY +The XSI Curses standard, Issue 4 describes these functions. +.SH SEE ALSO +\fBcurses\fR(3X), \fBcurs_refresh\fR(3X), \fBcurs_touch\fR(3X) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/dft_fgbg.3x b/man/dft_fgbg.3x new file mode 100644 index 00000000..92196b75 --- /dev/null +++ b/man/dft_fgbg.3x @@ -0,0 +1,74 @@ +.\"***************************************************************************** +.\" Copyright 1997 by Thomas E. Dickey * +.\" All Rights Reserved. * +.\" * +.\" Permission to use, copy, modify, and distribute this software and its * +.\" documentation for any purpose and without fee is hereby granted, provided * +.\" that the above copyright notice appear in all copies and that both that * +.\" copyright notice and this permission notice appear in supporting * +.\" documentation, and that the name of the above listed copyright holder(s) * +.\" not be used in advertising or publicity pertaining to distribution of the * +.\" software without specific, written prior permission. THE ABOVE LISTED * +.\" COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * +.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * +.\" EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * +.\" SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * +.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * +.\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * +.\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * +.\"***************************************************************************** +.\" $Id: dft_fgbg.3x,v 1.1 1997/01/19 02:51:30 tom Exp $ +.TH use_default_colors 3X "" +. +.SH NAME +\fBuse_default_colors\fP \- use terminal's default colors +. +.SH SYNOPSIS +\fB#include \fP + +\fBint use_default_colors(void);\fP +. +.SH DESCRIPTION +This is an extension to the curses library. +It is used with terminals that support ISO 6429 color, or equivalent. +These terminals allow the application to reset color to an unspecified +default value (e.g., with SGR 39 or SGR 49). +Because they are designed to support this, their design usually includes +features to change the default foreground or background colors so that +they do not match the assumption in XSI curses of white on black. +.PP +Applications that paint a colored background over the whole screen +are not adversely impacted by this type of terminal design. +However, there are applications that are designed to work with +the default background. +. +.SH RETURN VALUE +The function returns the integer \fBERR\fP upon failure and \fBOK\fP on success. +It will fail if either the terminal does not support +the \fIorig_pair\fP or \fIorig_colors\fP capability. +If the \fIinitialize_pair\fP capability is found, this causes an +error as well. +. +.SH NOTES +Associated with this extension, the \fBinit_pair\fP(3x) function accepts +negative arguments to specify default foreground or background +colors. +. +.SH PORTABILITY +These routines are specific to ncurses. They were not supported on +Version 7, BSD or System V implementations. It is recommended that +any code depending on them be conditioned using NCURSES_VERSION. +. +.SH SEE ALSO +\fBcurs_color\fP(3x), +\fBded\fP(1). +. +.SH AUTHOR +Thomas Dickey (from an analysis of the requirements for color xterm +for XFree86 3.1.2C, February 1996). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form.3x b/man/form.3x new file mode 100644 index 00000000..36ce7612 --- /dev/null +++ b/man/form.3x @@ -0,0 +1,170 @@ +'\" t +.TH forms 3X "" +.SH NAME +\fBforms\fR - curses extension for programming forms +.SH SYNOPSIS +\fB#include \fR +.br +.SH DESCRIPTION +The \fBforms\fR library provides terminal-independent facilities for composing +form screens on character-cell terminals. The library includes: field +routines, which create and modify form fields; and form routines, which group +fields into forms, display forms on the screen, and handle interaction with the +user. + +The \fBforms\fR library uses the \fBcurses\fR libraries, and a curses +initialization routine such as \fBinitscr\fR must be called before using any of +these functions. To use the \fBforms\fR library, link with the options +\fB-lform -lcurses\fR. + +.SS Current Default Values for Field Attributes + +The \fBforms\fR library maintains a default value for field attributes. You +can get or set this default by calling the appropriate \fBget_\fR or \fBset_\fR +routine with a \fBNULL\fR field pointer. Changing this default with a +\fBset_\fR function affects future field creations, but does not change the +rendering of fields already created. + +.SS Routine Name Index + +The following table lists each \fBform\fR routine and the name of +the manual page on which it is described. + +.TS +l l +l l . +\fBcurses\fR Routine Name Manual Page Name += +\fBcurrent_field\fR form_page(3X) +\fBdata_ahead\fR form_data(3X) +\fBdata_behind\fR form_data(3X) +\fBdup_field\fR form_field_new(3X) +\fBdynamic_fieldinfo\fR form_field_info(3X) +\fBfield_arg\fR form_field_validation(3X) +\fBfield_back\fR form_field_attributes(3X) +\fBfield_buffer\fR form_field_buffer(3X) +\fBfield_count\fR form_field(3X) +\fBfield_fore\fR form_field_attributes(3X) +\fBfield_index\fR form_page(3X) +\fBfield_info\fR form_field_info(3X) +\fBfield_init\fR form_hook(3X) +\fBfield_just\fR form_field_just(3X) +\fBfield_opts\fR form_field_opts(3X) +\fBfield_opts_off\fR form_field_opts(3X) +\fBfield_opts_on\fR form_field_opts(3X) +\fBfield_pad\fR form_field_attributes(3X) +\fBfield_status\fR form_field_buffer(3X) +\fBfield_term\fR form_hook(3X) +\fBfield_type\fR form_field_validation(3X) +\fBfield_userptr\fR form_field_userptr(3X) +\fBform_driver\fR form_driver(3X) +\fBform_fields\fR form_field(3X) +\fBform_init\fR form_hook(3X) +\fBform_opts\fR form_opts(3X) +\fBform_opts_off\fR form_opts(3X) +\fBform_opts_on\fR form_opts(3X) +\fBform_page\fR form_page(3X) +\fBform_request_by_name\fR form_requestname(3X) +\fBform_request_name\fR form_requestname(3X) +\fBform_sub\fR form_win(3X) +\fBform_term\fR form_hook(3X) +\fBform_userptr\fR form_userptr(3X) +\fBform_win\fR form_win(3X) +\fBfree_field\fR form_field_new(3X) +\fBfree_form\fR form_new(3X) +\fBlink_field\fR form_field_new(3X) +\fBlink_fieldtype\fR link_fieldtype(3X) +\fBmove_field\fR form_field(3X) +\fBnew_field\fR form_field_new(3X) +\fBnew_form\fR form_new(3X) +\fBnew_page\fR form_new_page(3X) +\fBpos_form_cursor\fR form_cursor(3X) +\fBpost_form\fR form_post(3X) +\fBscale_form\fR form_win(3X) +\fBset_current_field\fR form_page(3X) +\fBset_field_back\fR form_field_attributes(3X) +\fBset_field_buffer\fR form_field_buffer(3X) +\fBset_field_fore\fR form_field_attributes(3X) +\fBset_field_init\fR form_hook(3X) +\fBset_field_just\fR form_field_just(3X) +\fBset_field_opts\fR form_field_opts(3X) +\fBset_field_pad\fR form_field_attributes(3X) +\fBset_field_status\fR form_field_buffer(3X) +\fBset_field_term\fR form_hook(3X) +\fBset_field_type\fR form_field_validation(3X) +\fBset_field_userptr\fR form_field_userptr(3X) +\fBset_fieldtype_arg\fR form_fieldtype(3X) +\fBset_fieldtype_choice\fR form_fieldtype(3X) +\fBset_form_fields\fR form_field(3X) +\fBset_form_init\fR form_hook(3X) +\fBset_form_opts\fR form_field_opts(3X) +\fBset_form_page\fR form_page(3X) +\fBset_form_sub\fR form_win(3X) +\fBset_form_term\fR form_hook(3X) +\fBset_form_userptr\fR form_userptr(3X) +\fBset_form_win\fR form_win(3X) +\fBset_max_field\fR form_field_buffer(3X) +\fBset_new_page\fR form_new_page(3X) +\fBunpost_form\fR form_post(3X) +.TE +.SH RETURN VALUE +Routines that return pointers return \fBNULL\fR on error. Routines that return +an integer return one of the following error codes: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_CONNECTED\fR +The field is already connected to a form. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_POSTED\fR +The form is already posted. +.TP 5 +\fBE_BAD_STATE\fR +Routine was called from an initialization or termination function. +.TP 5 +\fBE_NO_ROOM\fR +Form is too large for its window. +.TP 5 +\fBE_NOT_POSTED\fR +The form has not been posted. +.TP 5 +\fBE_UNKNOWN_COMMAND\fR +The form driver code saw an unknown request code. +.TP 5 +\fBE_INVALID_FIELD\fR +Contents of a field are not valid. +.TP 5 +\fBE_NOT_CONNECTED\fR +No fields are connected to the form. +.TP 5 +\fBE_REQUEST_DENIED\fR +The form driver could not process the request. +.SH SEE ALSO +\fBcurses\fR(3X) and 3X pages whose names begin "form_" for detailed +descriptions of the entry points. +.SH NOTES +The header file \fB\fR automatically includes the header files +\fB\fR and \fB\fR. + +In your library list, libform.a should be before libncurses.a; that is, +you want to say `-lform -lncurses', not the other way around (which would +give you a link error using GNU \fBld\fR(1) and many other linkers). +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for ncurses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_cursor.3x b/man/form_cursor.3x new file mode 100644 index 00000000..1e9a1d90 --- /dev/null +++ b/man/form_cursor.3x @@ -0,0 +1,45 @@ +'\" t +.TH form_cursor 3X "" +.SH NAME +\fBform_cursor\fR - position a form window cursor +.SH SYNOPSIS +\fB#include \fR +.br +int pos_form_cursor(FORM *form); +.br +.SH DESCRIPTION +The function \fBpos_form_cursor\fR restores the cursor to the position required +for the forms driver to continue processing requests. This is useful after +\fBcurses\fR routines have been called to do screen-painting in response to a +form operation. +.SH RETURN VALUE +This routine returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_NOT_POSTED\fR +The form has not been posted. +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_data.3x b/man/form_data.3x new file mode 100644 index 00000000..bf8a2404 --- /dev/null +++ b/man/form_data.3x @@ -0,0 +1,34 @@ +'\" t +.TH form_data 3X "" +.SH NAME +\fBform_data\fR - +.SH SYNOPSIS +\fB#include \fR +.br +bool data_ahead(const FORM *form); +.br +bool data_behind(const FORM *form); +.br +.SH DESCRIPTION +The function \fBdata_ahead\fR tests whether there is off-screen data +ahead in the given form. It returns TRUE (1) or FALSE (0). + +The function \fBdata_behind\fR tests whether there is off-screen data +behind in the given form. It returns TRUE (1) or FALSE (0). +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_driver.3x b/man/form_driver.3x new file mode 100644 index 00000000..6a6acc7b --- /dev/null +++ b/man/form_driver.3x @@ -0,0 +1,244 @@ +'\" t +.TH form_driver 3X "" +.SH NAME +\fBform_driver\fR - command-processing loop of the form system +.SH SYNOPSIS +\fB#include \fR +.br +int form_driver(FORM *form, int c); +.br +.SH DESCRIPTION +Once a form has been posted (displayed), you should funnel input events to it +through \fBform_driver\fR. This routine has two major input cases; either +the input is a form navigation request or it's a printable ASCII character. +The form driver requests are as follows: +.TP 5 +REQ_NEXT_PAGE +Move to the next page. +.TP 5 +REQ_PREV_PAGE +Move to the previous page. +.TP 5 +REQ_FIRST_PAGE +Move to the first page. +.TP 5 +REQ_LAST_PAGE +Move to the last field. + +.TP 5 +REQ_NEXT_FIELD +Move to the next field. +.TP 5 +REQ_PREV_FIELD +Move to the previous field. +.TP 5 +REQ_FIRST_FIELD +Move to the first field. +.TP 5 +REQ_LAST_FIELD +Move to the last field. +.TP 5 +REQ_SNEXT_FIELD +Move to the sorted next field. +.TP 5 +REQ_SPREV_FIELD +Move to the sorted previous field. +.TP 5 +REQ_SFIRST_FIELD +Move to the sorted first field. +.TP 5 +REQ_SLAST_FIELD +Move to the sorted last field. +.TP 5 +REQ_LEFT_FIELD +Move left to a field. +.TP 5 +REQ_RIGHT_FIELD +Move right to a field. +.TP 5 +REQ_UP_FIELD +Move up to a field. +.TP 5 +REQ_DOWN_FIELD +Move down to a field. + +.TP 5 +REQ_NEXT_CHAR +Move to the next char. +.TP 5 +REQ_PREV_CHAR +Move to the previous char. +.TP 5 +REQ_NEXT_LINE +Move to the next line. +.TP 5 +REQ_PREV_LINE +Move to the previous line. +.TP 5 +REQ_NEXT_WORD +Move to the next word. +.TP 5 +REQ_PREV_WORD +Move to the previous word. +.TP 5 +REQ_BEG_FIELD +Move to the beginning of the field. +.TP 5 +REQ_END_FIELD +Move to the end of the field. +.TP 5 +REQ_BEG_LINE +Move to the beginning of the line. +.TP 5 +REQ_END_LINE +Move to the end of the line. +.TP 5 +REQ_LEFT_CHAR +Move left in the field. +.TP 5 +REQ_RIGHT_CHAR +Move right in the field. +.TP 5 +REQ_UP_CHAR +Move up in the field. +.TP 5 +REQ_DOWN_CHAR +Move down in the field. + +.TP 5 +REQ_NEW_LINE +Insert or overlay a new line. +.TP 5 +REQ_INS_CHAR +Insert a blank at the cursor. +.TP 5 +REQ_INS_LINE +Insert a blank line at the cursor. +.TP 5 +REQ_DEL_CHAR +Delete character at the cursor. +.TP 5 +REQ_DEL_PREV +Delete character before the cursor. +.TP 5 +REQ_DEL_LINE +Delete line at the cursor. +.TP 5 +REQ_DEL_WORD +Delete blank-delimited word at the cursor. +.TP 5 +REQ_CLR_EOL +Clear to end of line from cursor. +.TP 5 +REQ_CLR_EOF +Clear to end of field from cursor. +.TP 5 +REQ_CLR_FIELD +Clear the entire field. +.TP 5 +REQ_OVL_MODE +Enter overlay mode. +.TP 5 +REQ_INS_MODE +Enter insert mode. + +.TP 5 +REQ_SCR_FLINE +Scroll the field forward a line. +.TP 5 +REQ_SCR_BLINE +Scroll the field backward a line. +.TP 5 +REQ_SCR_FPAGE +Scroll the field forward a page. +.TP 5 +REQ_SCR_BPAGE +Scroll the field backward a page. +.TP 5 +REQ_SCR_FHPAGE +Scroll the field forward half a page. +.TP 5 +REQ_SCR_BHPAGE +Scroll the field backward half a page. + +.TP 5 +REQ_SCR_FCHAR +Scroll the field forward a character. +.TP 5 +REQ_SCR_BCHAR +Scroll the field backward a character. +.TP 5 +REQ_SCR_HFLINE +Horizontal scroll the field forward a line. +.TP 5 +REQ_SCR_HBLINE +Horizontal scroll the field backward a line. +.TP 5 +REQ_SCR_HFHALF +Horizontal scroll the field forward half a line. +.TP 5 +REQ_SCR_HBHALF +Horizontal scroll the field backward half a line. + +.TP +REQ_VALIDATION +Validate field. +.TP +REQ_NEXT_CHOICE +Display next field choice. +.TP +REQ_PREV_CHOICE +Display previous field choice. +.PP +If the second argument is a printable ASCII character, the driver places it +in the current position in the current field. If it is one of the forms +requests listed above, that request is executed. +.PP +If the second argument is neither printable ASCII nor one of the above +pre-defined form requests, the drive assumes it is an application-specific +command and returns \fBE_UNKNOWN_COMMAND\fR. Application-defined commands +should be defined relative to \fBMAX_COMMAND\fR, the maximum value of these +pre-defined requests. +.SH RETURN VALUE +\fBform_driver\fR return one of the following error codes: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_BAD_STATE\fR +Routine was called from an initialization or termination function. +.TP 5 +\fBE_NOT_POSTED\fR +The form has not been posted. +.TP 5 +\fBE_UNKNOWN_COMMAND\fR +The form driver code saw an unknown request code. +.TP 5 +\fBE_INVALID_FIELD\fR +Contents of field is invalid. +.TP 5 +\fBE_REQUEST_DENIED\fR +The form driver could not process the request. +.SH SEE ALSO +\fBcurses\fR(3X), \fBforms\fR(3x). +.SH NOTES +The header file \fB\fR automatically includes the header files +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_field.3x b/man/form_field.3x new file mode 100644 index 00000000..3e651a5a --- /dev/null +++ b/man/form_field.3x @@ -0,0 +1,68 @@ +'\" t +.TH form_field 3X "" +.SH NAME +\fBform_field\fR - make and break connections between fields and forms +.SH SYNOPSIS +\fB#include \fR +.br +int set_form_fields(FORM *form, FIELD **fields); +.br +FIELD **form_fields(const FORM *form); +.br +int field_count(const FORM *form); +.br +int move_field(FIELD *field, int frow, int fcol); +.br +.SH DESCRIPTION +The function \fBset_form_fields\fR changes the field pointer array of +the given \fIform\fR. The array must be terminated by a \fBNULL\fR. + +The function \fBform_fields\fR returns the field array of the given form. + +The function \fBfield_count\fR returns the count of fields in \fIform\fR. + +The function \fBmove_field\fR move the given field (which must be disconnected) +to a specified location on the screen. +.SH RETURN VALUES +The function \fBform_fields\fR returns \fBNULL\fR on error. + +The function \fBfield_count\fR returns \fBERR\fR (the general +\fBcurses\fR error return value) on error. + +The functions \fBset_form_fields\fR and \fBmove_field\fR return one of +the following codes on error: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_POSTED\fR +The form is already posted. +.TP 5 +\fBE_CONNECTED\fR +The field is already connected to a form. +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. + +The SVr4 forms library documentation specifies the \fBfield_count\fR error value +as -1 (which is the value of \fBERR\fR). +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_field_attributes.3x b/man/form_field_attributes.3x new file mode 100644 index 00000000..610bef2d --- /dev/null +++ b/man/form_field_attributes.3x @@ -0,0 +1,62 @@ +'\" t +.TH form_field_attributes 3X "" +.SH NAME +\fBform_field_attributes\fR - color and attribute control for form fields +.SH SYNOPSIS +\fB#include \fR +.br +int set_field_fore(FIELD *field, chtype attr); +.br +chtype field_fore(const FIELD *field); +.br +int set_field_back(FIELD *field, chtype attr); +.br +chtype field_back(const FIELD *field); +.br +int set_field_pad(FIELD *field, int pad); +.br +chtype field_pad(const FIELD *field); +.br +.SH DESCRIPTION +The function \fBset_field_fore\fR sets the foreground attribute of +\fIfield\fR. This is the highlight used to display the field contents. The +function \fBfield_fore\fR returns the foreground attribute. The default is +\fBA_STANDOUT\fR. + +The function \fBset_field_back\fR sets the background attribute of +\fIform\fR. This is the highlight used to display the extent fields in the +form. The function \fBfield_back\fR returns the background attribute. The +default is \fBA_NORMAL\fR. + +The function \fBset_field_pad\fR sets the character used to fill the field. +The function \fBfield_pad\fR returns the given form's pad character. The +default is a blank. +.SH RETURN VALUE +These routines return one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.SH SEE ALSO +\fBcurses\fR(3X) and 3X pages whose names begin "form_" for detailed +descriptions of the entry points. +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_field_buffer.3x b/man/form_field_buffer.3x new file mode 100644 index 00000000..d1a32aaa --- /dev/null +++ b/man/form_field_buffer.3x @@ -0,0 +1,63 @@ +'\" t +.TH form_field_buffer 3X "" +.SH NAME +\fBform_field_buffer\fR - field buffer control +.SH SYNOPSIS +\fB#include \fR +.br +int set_field_buffer(FIELD *field, int buf, const char *value); +.br +char *field_buffer(const FIELD *field, int buffer); +.br +int set_field_status(FIELD *field, bool status); +.br +bool field_status(const FIELD *field); +.br +int set_max_field(FIELD *field, int max); +.br +.SH DESCRIPTION +The function \fBset_field_buffer\fR sets the numbered buffer of the given field +to contain a given string. Buffer 0 is the displayed value of the field; other +numbered buffers may be allocated by applications through the \fBnbuf\fR +argument of (see \fBfield_new\fR(3X)) but are not manipulated by the forms +library. The function \fBfield_buffer\fR returns the foreground attribute. + +The function \fBset_field_status\fR sets the associated status flag of +\fIfield\fR; \fBfield_status\fR gets the current value. The status flag +is set to a nonzero value whenever the field changes. + +The function \fBset_max_field\fR sets the maximum size for a dynamic field. +An argument of 0 turns off any maximum size threshold for that field. +.SH RETURN VALUE +The \fBfield_buffer\fR function returns NULL on error. + +The \fBfield_status\fR function returns \fBTRUE\fR or \fBFALSE\fR. + +The remaining routines return one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.SH SEE ALSO +\fBcurses\fR(3X) and 3X pages whose names begin "form_" for detailed +descriptions of the entry points. +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_field_info.3x b/man/form_field_info.3x new file mode 100644 index 00000000..aca06fb7 --- /dev/null +++ b/man/form_field_info.3x @@ -0,0 +1,51 @@ +'\" t +.TH form_field_info 3X "" +.SH NAME +\fBform_field_info\fR - retrieve field characteristics +.SH SYNOPSIS +\fB#include \fR +.br +int field_info(const FIELD *field, int *rows, int *cols, + int *frow, int *fcol, int *nrow, int *nbuf); +.br +int dynamic_field_info(const FIELD *field, int *rows, int *cols, *max); +.br +.SH DESCRIPTION +The function \fBfield_info\fR returns the sizes and other attributes passed in +to the field at its creation time. The attributes are: height, width, row of +upper-left corner, column of upper-left corner, number off-screen rows, and +number of working buffers. + +The function \fBdynamic_field_info\fR returns the actual size of the field, and +its maximum possible size. If the field has no size limit, the location +addressed by the third argument will be set to 0. (A field can be made dynamic +by turning off the \fBO_STATIC\fR). +.SH RETURN VALUE +These routines return one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.SH SEE ALSO +\fBcurses\fR(3X) and 3X pages whose names begin "form_" for detailed +descriptions of the entry points. +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_field_just.3x b/man/form_field_just.3x new file mode 100644 index 00000000..cbe2102b --- /dev/null +++ b/man/form_field_just.3x @@ -0,0 +1,49 @@ +'\" t +.TH form_field_just 3X "" +.SH NAME +\fBform_field_just\fR - retrieve field characteristics +.SH SYNOPSIS +\fB#include \fR +.br +int set_field_just(FIELD *field, int justification); +.br +int field_just(const FIELD *field); +.br +.SH DESCRIPTION +The function \fBset_field_just\fR sets the justification attribute of +a field; \fBfield_just\fR returns a field's justification attribute. +The attribute may be one of NO_JUSTIFICATION, JUSTIFY_RIGHT, +JUSTIFY_LEFT, or JUSTIFY_CENTER. + +.SH RETURN VALUE +The function \fBfield_just\fR returns one of: NO_JUSTIFICATION, +JUSTIFY_RIGHT, JUSTIFY_LEFT, or JUSTIFY_CENTER. + +The function \fBset_field_just\fR return one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.SH SEE ALSO +\fBcurses\fR(3X) and 3X pages whose names begin "form_" for detailed +descriptions of the entry points. +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_field_new.3x b/man/form_field_new.3x new file mode 100644 index 00000000..af2dcad5 --- /dev/null +++ b/man/form_field_new.3x @@ -0,0 +1,67 @@ +'\" t +.TH form_field_new 3X "" +.SH NAME +\fBform_field_new\fR - create and destroy form fields +.SH SYNOPSIS +\fB#include \fR +.br +FIELD *new_field(int height, int width, + int toprow, int leftcol, + int offscreen, int nbuffers); +.br +FIELD *dup_field(FIELD *field, int toprow, int leftcol); +.br +FIELD *link_field(FIELD *field, int toprow, int leftcol); +.br +int free_field(FIELD *field); +.br +.SH DESCRIPTION +The function \fBnew_field\fR allocates a new field and initializes it from the +parameters given: height, width, row of upper-left corner, column of upper-left +corner, number off-screen rows, and number of additional working buffers. + +The function \fBdup_field\fR duplicates a field at a new location. Most +attributes (including current contents, size, validation type, buffer count, +growth threshold, justification, foreground, background, pad character, +options, and user pointer) are copied. Field status and the field page bit are +not copied. + +The function \fBlink_field\fR acts like \fBdup_field\fR, but the new field +shares buffers with its parent. Attribute data is separate. + +The function \fBfree_field\fR de-allocates storage associated with a field. +.SH RETURN VALUE +The function, \fBnew_field\fR, \fBdup_field\fR, \fBlink_field\fR return +\fBNULL\fR on error. + +The function \fBfree_field\fR returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. + +It may be unwise to count on the set of attributes copied by +\fBdup_field\fR(3x) being portable; the System V forms library documents are +not very explicit on what gets copied and was not. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_field_opts.3x b/man/form_field_opts.3x new file mode 100644 index 00000000..d3dc8db1 --- /dev/null +++ b/man/form_field_opts.3x @@ -0,0 +1,90 @@ +'\" t +.TH form_field_opts 3X "" +.SH NAME +\fBform_field_opts\fR - set and get field options +.SH SYNOPSIS +\fB#include \fR +.br +int set_field_opts(FIELD *field, OPTIONS opts); +.br +int field_opts_on(FIELD *field, OPTIONS opts); +.br +int field_opts_off(FIELD *field, OPTIONS opts); +.br +OPTIONS field_opts(const FIELD *field); +.br +.SH DESCRIPTION +The function \fBset_field_opts\fR sets all the given field's option bits (field +option bits may be logically-OR'ed together). + +The function \fBfield_opts_on\fR turns on the given option bits, and leaves +others alone. + +The function \fBfield_opts_off\fR turns off the given option bits, and leaves +others alone. + +The function \fBfield_opts\fR returns the field's current option bits. + +The following options are defined (all are on by default): +.TP 5 +O_VISIBLE +The field is displayed. If this option is off, display of the field is +suppressed, +.TP 5 +O_ACTIVE +The field is visited during processing. If this option is off, the field will +not be reachable by navigation keys. +.TP 5 +O_PUBLIC +The field contents are displayed as data is entered. +.TP 5 +O_EDIT +The field can be edited. +.TP 5 +O_WRAP +Words that don't fit on a line are wrapped to the next line. Words are +blank-separated. +.TP 5 +O_BLANK +The field is cleared whenever a character is entered at the first position. +.TP 5 +O_AUTOSKIP +Skip to the next field when this one fills +.TP 5 +O_NULLOK +Allow a blank field. +.TP 5 +O_STATIC +Field buffers are fixed to field's original size. +.TP 5 +O_PASSOK +Validate field only if modified by user. +.SH RETURN VALUE +Except for \fBfield_opts\fR, each routine returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_CURRENT\fR +The field is the current field. +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.TP 5 +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_field_userptr.3x b/man/form_field_userptr.3x new file mode 100644 index 00000000..f2d7bd9d --- /dev/null +++ b/man/form_field_userptr.3x @@ -0,0 +1,44 @@ +'\" t +.TH form_field_userptr 3X "" +.SH NAME +\fBform_field_userptr\fR - associate application data with a form field +.SH SYNOPSIS +\fB#include \fR +.br +int set_field_userptr(FIELD *field, const void*userptr); +.br +const void *field_userptr(const FIELD *field); +.br +.SH DESCRIPTION +Every form field has a field that can be used to hold application-specific data +(that is, the form-driver code leaves it alone). These functions get and set +that field. +.SH RETURN VALUE +The function \fBfield_userptr\fR returns \fBNULL\fR on error. The function +\fBset_field_userptr\fR returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. + +The user pointer should be a void pointer. We leave it as a char pointer for +SVr4 compatibility. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_field_validation.3x b/man/form_field_validation.3x new file mode 100644 index 00000000..8fee91d0 --- /dev/null +++ b/man/form_field_validation.3x @@ -0,0 +1,99 @@ +'\" t +.TH form_field_validation 3X "" +.SH NAME +\fBform_field_validation\fR - data type validation for fields +.SH SYNOPSIS +\fB#include \fR +.br +int set_field_type(FIELD *field, FIELDTYPE *type, ...); +.br +FIELDTYPE *field_type(const FIELD *field); +.br +void *field_arg(const FIELD *field); +.br +.SH DESCRIPTION +The function \fBset_field_type\fR declares a data type for a given form field. +This is the type checked by validation functions. The types are as follows: +.TP 5 +TYPE_ALNUM +Alphanumeric data. Requires a third \fBint\fR argument, a minimum field width. +.TP 5 +TYPE_ALPHA +Character data. Requires a third \fBint\fR argument, a minimum field width. +.TP 5 +TYPE_ENUM +Accept one of a specified set of strings. Requires a third \fB(char **)\fR +argument pointing to a string list; a fourth \fBint\fR flag argument to enable +case-sensitivity; and a fifth \fBint\fR flag argument specifying whether a partial +match must be a unique one (if this flag is off, a prefix matches the first +of any set of more than one list elements with that prefix). Please notice +that the string list is not copied, only a reference to it is stored in the +field. So you should avoid to use a list that lives in automatic variables +on the stack. +.TP 5 +TYPE_INTEGER +Integer data, parsable to an integer by \fBatoi(3)\fR. Requires a third +\fBint\fR argument controlling the precision, a fourth \fBlong\fR argument +constraining minimum value, and a fifth \fBlong\fR constraining maximum value. +If the maximum value is less or equal the minimum value, the range is simply +ignored. On return the field buffer is formatted according to the \fBprintf\fR +format specification ".*ld", where the '*' is replaced by the precision argument. +For details of the precision handling see \fBprintf's\fR man-page. +.TP 5 +TYPE_NUMERIC +Numeric data (may have a decimal-point part). Requires a third +\fBint\fR argument controlling the precision, a fourth \fBdouble\fR +argument constraining minimum value, and a fifth \fBdouble\fR constraining +maximum value. If your system supports locale's, the decimal point character +to be used must be the one specified by your locale. +If the maximum value is less or equal the minimum value, the range is simply +ignored. On return the field buffer is formatted according to the \fBprintf\fR +format specification ".*f", where the '*' is replaced by the precision argument. +For details of the precision handling see \fBprintf's\fR man-page. +.TP 5 +TYPE_REGEXP +Regular expression data. Requires a regular expression \fB(char *)\fR third argument; +the data is valid if the regular expression matches it. Regular expressions +are in the format of \fBregcomp\fR(3x) and \fBregexec\fR(3X). Please notice +that the regular expression must match the whole field. If you have for +example an eight character wide field, a regular expression "^[0-9]*$" always +means that you have to fill all eight positions with digits. If you want to +allow fewer digits, you may use for example "^[0-9]* *$" which is good for +trailing spaces (up to an empty field), or "^ *[0-9]* *$" which is good for +leading and trailing spaces around the digits. +.TP 5 +TYPE_IPV4 +An Internet Protocol Version 4 address. This requires no additional argument. It +is checked whether or not the buffer has the form a.b.c.d, where a,b,c and d are +numbers between 0 and 255. Trailing blanks in the buffer are ignored. The address +itself is not validated. Please note that this is an ncurses extension. This +field type may not be available in other curses implementations. + +It is possible to set up new programmer-defined field types. See the +\fBform_fieldtype\fR(3X) manual page. +.SH RETURN VALUE +The functions \fBfield_type\fR and \fBfield_arg\fR return \fBNULL\fR on +error. The function \fBset_field_type\fR returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_fieldtype.3x b/man/form_fieldtype.3x new file mode 100644 index 00000000..a6697eed --- /dev/null +++ b/man/form_fieldtype.3x @@ -0,0 +1,94 @@ +'\" t +.TH form_field 3X "" +.SH NAME +\fBform_fieldtype\fR - define validation-field types +.SH SYNOPSIS +\fB#include \fR +.br +FIELDTYPE *new_fieldtype( + bool (* const field_check)(FIELD *, const void *), + bool (* const char_check)(int, const void *)); +.br +int free_fieldtype(FIELDTYPE *fieldtype); +.br +int set_fieldtype_arg( + FIELDTYPE *fieldtype, + void *(* const make_arg)(va_list *), + void *(* const copy_arg)(const void *), + void (* const free_arg)(void *)); +.br +int set_fieldtype_choice( + FIELDTYPE *fieldtype + bool (* const next_choice)(FIELD *, const void *), + bool (* const prev_choice)(FIELD *, const void *)); +.br +FIELDTYPE *link_fieldtype(FIELDTYPE *type1, + FIELDTYPE *type2); +.br +.SH DESCRIPTION +The function \fBnew_fieldtype\fR creates a new field type usable for data +validation. You supply it with \fIfield_check\fR, a predicate to check the +validity of an entered data string whenever the user attempt to leave a field. +The (FIELD *) argument is passed in so the validation predicate can see the +field's buffer, sizes and other attributes; the second argument is an +argument-block structure, about which more below. + +You also supply \fBnew_fieldtype\fR with \fIchar_check\fR, +a function to validate input characters as they are entered; it will be passed +the character to be checked and a pointer to an argument-block structure. + +The function \fBfree_fieldtype\fR frees the space allocated for a given +validation type. + +The function \fBset_fieldtype\fR associates three storage-management functions +with a field type. The \fImak_arg\fR function is automatically applied to the +list of arguments you give \fBset_field_type\fR when attaching validation +to a field; its job is to bundle these into an allocated argument-block +object which can later be passed to validation predicated. The other two +hook arguments should copy and free argument-block structures. They will +be used by the forms-driver code. + +The form driver requests \fBREQ_NEXT_CHOICE\fR and \fBREQ_PREV_CHOICE\fR assume +that the possible values of a field form an ordered set, and provide the forms +user with a way to move through the set. The \fBset_fieldtype_choice\fR +function allows forms programmers to define successor and predecessor functions +for the field type. These functions take the field pointer and an +argument-block structure as arguments. +.SH RETURN VALUE +The pointer-valued routines return NULL on error. + +The integer-valued routines return one of the following codes on +error: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_CONNECTED\fR +The field is already connected to a form. +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. + +All of the \fB(char *)\fR arguments of these functions should actually be +\fB(void *)\fR. The type has been left uncorrected for strict compatibility +with System V. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_hook.3x b/man/form_hook.3x new file mode 100644 index 00000000..3ed7d8c3 --- /dev/null +++ b/man/form_hook.3x @@ -0,0 +1,71 @@ +'\" t +.TH form_hook 3X "" +.SH NAME +\fBform_hook\fR - set hooks for automatic invocation by applications +.SH SYNOPSIS +\fB#include \fR +.br +int set_field_init(FORM *form, void (*func)(FORM *)); +.br +void (*)(FORM *) field_init(const FORM *form); +.br +int set_field_term(FORM *form, void (*func)(FORM *)); +.br +void (*)(FORM *) field_term(const FORM *form); +.br +int set_form_init(FORM *form, void (*func)(FORM *)); +.br +void (*)(FORM *) form_init(const FORM *form); +.br +int set_form_term(FORM *form, void (*func)(FORM *)); +.br +void (*)(FORM *) form_term(const FORM *form); +.br +.SH DESCRIPTION +These functions make it possible to set hook functions to be called at various +points in the automatic processing of input event codes by \fBform_driver\fR. + +The function \fBset_field_init\fR sets a hook to be called at form-post time +and each time the selected field changes (after the change). \fBfield_init\fR +returns the current field init hook, if any (\fBNULL\fR if there is no such +hook). + +The function \fBset_field_term\fR sets a hook to be called at form-unpost time +and each time the selected field changes (before the change). \fBfield_term\fR +returns the current field term hook, if any (\fBNULL\fR if there is no such +hook). + +The function \fBset_form_init\fR sets a hook to be called at form-post time and +just after a page change once it is posted. \fBform_init\fR returns the +current form init hook, if any (\fBNULL\fR if there is no such hook). + +The function \fBset_form_term\fR sets a hook to be called at form-unpost time +and just before a page change change once it is posted. \fBform_init\fR +returns the current form term hook, if any (\fBNULL\fR if there is no such +hook). +.SH RETURN VALUE +Routines that return pointers return \fBNULL\fR on error. Other routines +return one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_new.3x b/man/form_new.3x new file mode 100644 index 00000000..af85586d --- /dev/null +++ b/man/form_new.3x @@ -0,0 +1,50 @@ +'\" t +.TH form_new 3X "" +.SH NAME +\fBform_new\fR - create and destroy forms +.SH SYNOPSIS +\fB#include \fR +.br +FORM *new_form(FIELD **fields); +.br +int free_form(FORM *form); +.br +.SH DESCRIPTION +The function \fBnew_form\fR creates a new form connected to a specified field +pointer array (which must be \fBNULL\fR-terminated). + +The function \fBfree_form\fR disconnects \fIform\fR from its field array +and frees the storage allocated for the form. +.SH RETURN VALUE +The function \fBnew_form\fR returns \fBNULL\fR on error. + +The function \fBfree_form\fR returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_POSTED\fR +The form has already been posted. +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_new_page.3x b/man/form_new_page.3x new file mode 100644 index 00000000..c3d4a180 --- /dev/null +++ b/man/form_new_page.3x @@ -0,0 +1,48 @@ +'\" t +.TH form_new_page 3X "" +.SH NAME +\fBform_new_page\fR - form pagination functions +.SH SYNOPSIS +\fB#include \fR +.br +int set_new_page(FIELD *field, bool new_page_flag); +.br +bool new_page(const FIELD *field); +.br +.SH DESCRIPTION +The function \fBset_new_page\fR sets or resets a flag marking the given field +as the beginning of a new page on its form. + +The function \fBnew_page\fR is a predicate which tests if a given field marks +a page beginning on its form. +.SH RETURN VALUE +The function \fBnew_page\fR returns \fBTRUE\fR or \fBFALSE\fR. + +The function \fBset_new_page\fR return one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_CONNECTED\fR +The given field is already connected to a form. +.SH SEE ALSO +\fBcurses\fR(3X) and 3X pages whose names begin "form_" for detailed +descriptions of the entry points. +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_opts.3x b/man/form_opts.3x new file mode 100644 index 00000000..dc0e0c45 --- /dev/null +++ b/man/form_opts.3x @@ -0,0 +1,61 @@ +'\" t +.TH form_opts 3X "" +.SH NAME +\fBform_opts\fR - set and get form options +.SH SYNOPSIS +\fB#include \fR +.br +int set_form_opts(FORM *form, OPTIONS opts); +.br +int form_opts_on(FORM *form, OPTIONS opts); +.br +int form_opts_off(FORM *form, OPTIONS opts); +.br +OPTIONS form_opts(const FORM *form); +.br +.SH DESCRIPTION +The function \fBset_form_opts\fR sets all the given form's option bits (form +option bits may be logically-OR'ed together). + +The function \fBform_opts_on\fR turns on the given option bits, and leaves +others alone. + +The function \fBform_opts_off\fR turns off the given option bits, and leaves +others alone. + +The function \fBform_opts\fR returns the form's current option bits. + +The following options are defined (all are on by default): +.TP 5 +O_NL_OVERLOAD +Overload the \fBREQ_NEW_LINE\fR forms driver request so that calling it at the +end of a field goes to the next field. +.TP 5 +O_BS_OVERLOAD +Overload the \fBREQ_DEL_PREV\fR forms driver request so that calling it at the +beginning of a field goes to the previous field. +.SH RETURN VALUE +Except for \fBform_opts\fR, each routine returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_page.3x b/man/form_page.3x new file mode 100644 index 00000000..27beb3d1 --- /dev/null +++ b/man/form_page.3x @@ -0,0 +1,66 @@ +'\" t +.TH form_page 3X "" +.SH NAME +\fBform_page\fR - set and get form page number +.SH SYNOPSIS +\fB#include \fR +.br +int set_current_field(FORM *form, FIELD *field); +.br +FIELD *current_field(const FORM *); +.br +int set_form_page(FORM *form, int n); +.br +int form_page(const FORM *form); +.br +int field_index(const FIELD *field); +.br +.SH DESCRIPTION +The function \fBset_current field\fR sets the current field of the given +form; \fBcurrent_field\fR returns the current field of the given form. +.PP +The function \fBset_form_page\fR sets the form's page number (goes to page +\fIn\fR of the form). +.PP +The function \fBform_page\fR returns the form's current page number. +.PP +The function \fBfield_index\fR returns the index of the field in the +field array of the form it is connected to. It returns \fBERR\fR if +the argument is the null pointer or the field is not connected. +.SH RETURN VALUE +Except for \fBform_page\fR, each routine returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_BAD_STATE\fR +Routine was called from an initialization or termination function. +.TP 5 +\fBE_INVALID_FIELD\fR +Contents of a field are not valid. +.TP 5 +\fBE_REQUEST_DENIED\fR +The form driver could not process the request. +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_post.3x b/man/form_post.3x new file mode 100644 index 00000000..42de332c --- /dev/null +++ b/man/form_post.3x @@ -0,0 +1,61 @@ +'\" t +.TH form_post 3X "" +.SH NAME +\fBform_post\fR - write or erase forms from associated subwindows +.SH SYNOPSIS +\fB#include \fR +.br +int post_form(FORM *form); +.br +int unpost_form(FORM *form); +.br +.SH DESCRIPTION +The function \fBpost_form\fR displays a form to its associated subwindow. To +trigger physical display of the subwindow, use \fBrefresh\fR or some equivalent +\fBcurses\fR routine (the implicit \fBdoupdate\fR triggered by an \fBcurses\fR +input request will do). + +The function \fBunpost_form\fR erases form from its associated subwindow. +.SH RETURN VALUE +These routines return one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_POSTED\fR +The form has already been posted. +.TP 5 +\fBE_BAD_STATE\fR +Routine was called from an initialization or termination function. +.TP 5 +\fBE_NO_ROOM\fR +Form is too large for its window. +.TP 5 +\fBE_NOT_POSTED\fR +The form has not been posted. +.TP 5 +\fBE_NOT_CONNECTED\fR +No items are connected to the form. +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_requestname.3x b/man/form_requestname.3x new file mode 100644 index 00000000..10824d3a --- /dev/null +++ b/man/form_requestname.3x @@ -0,0 +1,40 @@ +'\" t +.TH form_requestname 3X "" +.SH NAME +\fBform_requestname\fR - handle printable form request names +.SH SYNOPSIS +\fB#include \fR +.br +const char *form_request_name(int request); +.br +int form_request_by_name(const char *name); +.br +.SH DESCRIPTION +The function \fBform_request_name\fR returns the printable name of a form +request code. +.br +The function \fBform_request_by_name\fR searches in the name-table for a request +with the given name and returns its request code. Otherwise E_NO_MATCH is returned. +.SH RETURN VALUE +\fBform_request_name\fR returns \fBNULL\fR on error and sets errno +to \fBE_BAD_ARGUMENT\fR. +.br +\fBform_request_by_name\fR returns \fBE_NO_MATCH\fR on error. +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines are specific to ncurses. They were not supported on +Version 7, BSD or System V implementations. It is recommended that +any code depending on them be conditioned using NCURSES_VERSION. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_userptr.3x b/man/form_userptr.3x new file mode 100644 index 00000000..b32963d4 --- /dev/null +++ b/man/form_userptr.3x @@ -0,0 +1,44 @@ +'\" t +.TH form_userptr 3X "" +.SH NAME +\fBform_userptr\fR - associate application data with a form item +.SH SYNOPSIS +\fB#include \fR +.br +int set_form_userptr(FORM *form, const void *userptr); +.br +const void* form_userptr(const FORM *form); +.br +.SH DESCRIPTION +Every form and every form item has a field that can be used to hold +application-specific data (that is, the form-driver code leaves it alone). +These functions get and set the form user pointer field. +.SH RETURN VALUE +The function \fBform_userptr\fR returns \fBNULL\fR on error. +The function \fBset_form_userptr\fR returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. + +The user pointer should be a void pointer. We leave it as a char pointer for +SVr4 compatibility. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/form_win.3x b/man/form_win.3x new file mode 100644 index 00000000..a43f9c08 --- /dev/null +++ b/man/form_win.3x @@ -0,0 +1,66 @@ +'\" t +.TH form_win 3X "" +.SH NAME +\fBform_win\fR - make and break form window and subwindow associations +.SH SYNOPSIS +\fB#include \fR +.br +int set_form_win(FORM *form, WINDOW *win); +.br +WINDOW *form_win(const FORM *form); +.br +int set_form_sub(FORM *form, WINDOW *sub); +.br +WINDOW *form_sub(const FORM *form); +.br +int scale_form(const FORM *form, int *rows, int *columns); +.br +.SH DESCRIPTION +Every form has an associated pair of \fBcurses\fR windows. The form window +displays any title and border associated with the window; the form subwindow +displays the items of the form that are currently available for selection. + +The first four functions get and set those windows. It is not necessary to set +either window; by default, the driver code uses \fBstdscr\fR for both. + +In the \fBset_\fR functions, window argument of \fBNULL\fR is treated as though +it were \fBstsdcr\fR. A form argument of \fBNULL\fR is treated as a request +to change the system default form window or subwindow. + +The function \fBscale_window\fR returns the minimum size required for the +subwindow of \fIform\fR. +.SH RETURN VALUE +Routines that return pointers return \fBNULL\fR on error. Routines that return +an integer return one of the following error codes: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_POSTED\fR +The form has already been posted. +.TP 5 +\fBE_NOT_CONNECTED\fR +No items are connected to the form. +.SH SEE ALSO +\fBcurses\fR(3X), \fBform\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V forms library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/infocmp.1m b/man/infocmp.1m new file mode 100644 index 00000000..3c714e57 --- /dev/null +++ b/man/infocmp.1m @@ -0,0 +1,298 @@ +'\" t +.\" $Id: infocmp.1m,v 1.12 1997/01/05 00:47:22 tom Exp $ +.TH infocmp 1M "" +.ds n 5 +.ds d @DATADIR@/terminfo +.SH NAME +\fBinfocmp\fR - compare or print out \fIterminfo\fR descriptions +.SH SYNOPSIS +\fBinfocmp\fR [\fB-dcnpILCuV1\fR] [\fB-v\fR \fIn\fR] [\fB-s d\fR| \fBi\fR| \fBl\fR| \fBc\fR] +.br + [\fB-w\fR \fIwidth\fR] [\fB-A\fR \fIdirectory\fR] [\fB-B\fR \fIdirectory\fR] [\fItermname\fR...] +.SH DESCRIPTION +\fBinfocmp\fR can be used to compare a binary \fBterminfo\fR entry with other +terminfo entries, rewrite a \fBterminfo\fR description to take advantage of the +\fBuse=\fR terminfo field, or print out a \fBterminfo\fR description from the +binary file (\fBterm\fR) in a variety of formats. In all cases, the boolean +fields will be printed first, followed by the numeric fields, followed by the +string fields. + +.SS Default Options +If no options are specified and zero or one \fItermnames\fR are specified, the +\fB-I\fR option will be assumed. If more than one \fItermname\fR is specified, +the \fB-d\fR option will be assumed. + +.SS Comparison Options [-d] [-c] [-n] +\fBinfocmp\fR compares the \fBterminfo\fR description of the first terminal +\fItermname\fR with each of the descriptions given by the entries for the other +terminal's \fItermnames\fR. If a capability is defined for only one of the +terminals, the value returned will depend on the type of the capability: +\fBF\fR for boolean variables, \fB-1\fR for integer variables, and \fBNULL\fR +for string variables. + +The \fB-d\fR option produces a list of each capability that is different +between two entries. This option is useful to show the difference between two +entries, created by different people, for the same or similar terminals. + +The \fB-c\fR option produces a list of each capability that is common between +two entries. Capabilities that are not set are ignored. This option can be +used as a quick check to see if the \fB-u\fR option is worth using. + +The \fB-n\fR option produces a list of each capability that is in neither +entry. If no \fItermnames\fR are given, the environment variable \fBTERM\fR +will be used for both of the \fItermnames\fR. This can be used as a quick +check to see if anything was left out of a description. + +.SS Source Listing Options [-I] [-L] [-C] [-r] +The \fB-I\fR, \fB-L\fR, and \fB-C\fR options will produce a source listing for +each terminal named. + +.TS +center tab(/) ; +l l . +\fB-I\fR/use the \fBterminfo\fR names +\fB-L\fR/use the long C variable name listed in <\fBterm.h\fR> +\fB-C\fR/use the \fBtermcap\fR names +\fB-r\fR/when using \fB-C\fR, put out all capabilities in \fBtermcap\fR form +.TE + +If no \fItermnames\fR are given, the environment variable \fBTERM\fR will be +used for the terminal name. + +The source produced by the \fB-C\fR option may be used directly as a +\fBtermcap\fR entry, but not all parameterized strings can be changed to +the \fBtermcap\fR format. \fBinfocmp\fR will attempt to convert most of the +parameterized information, and anything not converted will be plainly marked in +the output and commented out. These should be edited by hand. + +All padding information for strings will be collected together and placed +at the beginning of the string where \fBtermcap\fR expects it. Mandatory +padding (padding information with a trailing '/') will become optional. + +All \fBtermcap\fR variables no longer supported by \fBterminfo\fR, but which +are derivable from other \fBterminfo\fR variables, will be output. Not all +\fBterminfo\fR capabilities will be translated; only those variables which were +part of \fBtermcap\fR will normally be output. Specifying the \fB-r\fR option +will take off this restriction, allowing all capabilities to be output in +\fItermcap\fR form. + +Note that because padding is collected to the beginning of the capability, not +all capabilities are output. Mandatory padding is not supported. Because +\fBtermcap\fR strings are not as flexible, it is not always possible to convert +a \fBterminfo\fR string capability into an equivalent \fBtermcap\fR format. A +subsequent conversion of the \fBtermcap\fR file back into \fBterminfo\fR format +will not necessarily reproduce the original \fBterminfo\fR +source. + +Some common \fBterminfo\fR parameter sequences, their \fBtermcap\fR +equivalents, and some terminal types which commonly have such sequences, are: + +.TS +center tab(/) ; +l c l +l l l. +\fBterminfo/termcap\fR/Representative Terminals += +\fB%p1%c/%.\fR/adm +\fB%p1%d/%d\fR/hp, ANSI standard, vt100 +\fB%p1%'x'%+%c/%+x\fR/concept +\fB%i/%i\fRq/ANSI standard, vt100 +\fB%p1%?%'x'%>%t%p1%'y'%+%;/%>xy\fR/concept +\fB%p2\fR is printed before \fB%p1/%r\fR/hp +.TE +.SS Use= Option [-u] +The \fB-u\fR option produces a \fBterminfo\fR source description of the first +terminal \fItermname\fR which is relative to the sum of the descriptions given +by the entries for the other terminals \fItermnames\fR. It does this by +analyzing the differences between the first \fItermname\fR and the other +\fItermnames\fR and producing a description with \fBuse=\fR fields for the +other terminals. In this manner, it is possible to retrofit generic terminfo +entries into a terminal's description. Or, if two similar terminals exist, but +were coded at different times or by different people so that each description +is a full description, using \fBinfocmp\fR will show what can be done to change +one description to be relative to the other. + +A capability will get printed with an at-sign (@) if it no longer exists in the +first \fItermname\fR, but one of the other \fItermname\fR entries contains a +value for it. A capability's value gets printed if the value in the first +\fItermname\fR is not found in any of the other \fItermname\fR entries, or if +the first of the other \fItermname\fR entries that has this capability gives a +different value for the capability than that in the first \fItermname\fR. + +The order of the other \fItermname\fR entries is significant. Since the +terminfo compiler \fBtic\fR does a left-to-right scan of the capabilities, +specifying two \fBuse=\fR entries that contain differing entries for the same +capabilities will produce different results depending on the order that the +entries are given in. \fBinfocmp\fR will flag any such inconsistencies between +the other \fItermname\fR entries as they are found. + +Alternatively, specifying a capability \fIafter\fR a \fBuse=\fR entry that +contains that capability will cause the second specification to be ignored. +Using \fBinfocmp\fR to recreate a description can be a useful check to make +sure that everything was specified correctly in the original source +description. + +Another error that does not cause incorrect compiled files, but will slow down +the compilation time, is specifying extra \fBuse=\fR fields that are +superfluous. \fBinfocmp\fR will flag any other \fItermname use=\fR fields that +were not needed. + +.SS Other Options [-s d|i|l|c] [-v] [-V] [-1] [-T] [-w \fIwidth\fR] +The \fB-s\fR option sorts the fields within each type according to the argument +below: + +.TP 5 +\fBd\fR +leave fields in the order that they are stored in the \fIterminfo\fR database. +.TP 5 +\fBi\fR +sort by \fIterminfo\fR name. +.TP 5 +\fBl\fR +sort by the long C variable name. +.TP 5 +\fBc\fR +sort by the \fItermcap\fR name. + +If the \fB-s\fR option is not given, the fields printed out will be +sorted alphabetically by the \fBterminfo\fR name within each type, +except in the case of the \fB-C\fR or the \fB-L\fR options, which cause the +sorting to be done by the \fBtermcap\fR name or the long C variable +name, respectively. + +.TP 5 +\fB-F\fR +compare terminfo files. This assumes that two following arguments are +filenames. The files are searched for pairwise matches between +entries, with two entries considered to match if any of their names do. +The report printed to standard output lists entries with no matches in +the other file, and entries with more than one match. For entries +with exactly one match it includes a difference report. +.TP 5 +\fB-p\fR +Ignore padding specifications when comparing strings. +.TP 5 +\fB-v\fR \fIn\fR +prints out tracing information on standard error as the program runs. +Higher values of n induce greater verbosity. +.TP 5 +\fB-V\fR +prints out the version of the program in use on standard error and exits. +.TP 5 +\fB-1\fR +causes the fields to be printed 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-T\fR +eliminates size-restrictions on the generated text. +This is mainly useful for testing and analysis, since the compiled +descriptions are limited (e.g., 1023 for termcap, 4096 for terminfo). +.TP 5 +\fB-w\fR +changes the output to \fIwidth\fR characters. +.TP 5 +\fB-R\fR\fIsubset\fR +Restrict output to a given subset. This option is for use with archaic +versions of terminfo like those on SVr1, Ultrix, or HP/UX that don't support +the full set of SVR4/XSI Curses terminfo; and outright broken ports like AIX +that have their own extensions incompatible with SVr4/XSI. Available terminfo +subsets are "SVr1", "Ultrix", "HP", and "AIX"; see \fBterminfo\fR(\*n) for +details. You can also choose the subset "BSD" which selects only capabilities +with termcap equivalents recognized by 4.4BSD. +.TP 5 +\fB-e\fR +Dump the capabilities of the given terminal as a C initializer for a +TERMTYPE structure (the terminal capability structure in the \fB\fR). +This option is useful for preparing versions of the curses library hardwired +for a given terminal type. +.SS Changing Databases [-A \fIdirectory\fR] [-B \fIdirectory\fR] +The location of the compiled \fBterminfo\fR database is taken from the +environment variable \fBTERMINFO\fR . If the variable is not defined, or the +terminal is not found in that location, the system \fBterminfo\fR database, +in \fB@DATADIR@/terminfo\fR, will be used. The options \fB-A\fR +and \fB-B\fR may be used to override this location. The \fB-A\fR option will +set \fBTERMINFO\fR for the first \fItermname\fR and the \fB-B\fR option will +set \fBTERMINFO\fR for the other \fItermnames\fR. With this, it is possible to +compare descriptions for a terminal with the same name located in two different +databases. This is useful for comparing descriptions for the same terminal +created by different people. +.TP 5 +\fB-i\fR +Analyze the initialization (\fBis1\fR, \fBis2\fR, \fBis3\fR), and reset +(\fBrs1\fR, \fBrs2\fR, \fBrs3\fR), strings in the entry. For each string, the +code tries to analyze it into actions in terms of the other capabilities in the +entry, certain X3.64/ISO 6429/ECMA-48 capabilities, and certain DEC VT-series +private modes (the set of recognized special sequences has been selected for +completeness over the existing terminfo database). Each report line consists +of the capability name, followed by a colon and space, followed by a printable +expansion of the capability string with sections matching recognized actions +translated into {}-bracketed descriptions. Here is a list of the DEC/ANSI +special sequences recognized: + +.TS +center tab(/) ; +l l +l l. +Action/Meaning += +RIS/full reset +SC/save cursor +RC/restore cursor +LL/home-down +RSR/reset scroll region + +ISO DEC G0/enable DEC graphics for G0 +ISO UK G0/enable UK chars for G0 +ISO US G0/enable US chars for G0 +ISO DEC G1/enable DEC graphics for G1 +ISO UK G1/enable UK chars for G1 +ISO US G1/enable US chars for G1 + +DECPAM/application keypad mode +DECPNM/normal keypad mode +DECANSI/enter ANSI mode + +DEC[+-]CKM/application cursor keys +DEC[+-]ANM/set VT52 mode +DEC[+-]COLM/132-column mode +DEC[+-]SCLM/smooth scroll +DEC[+-]SCNM/reverse video mode +DEC[+-]OM/origin mode +DEC[+-]AWM/wraparound mode +DEC[+-]ARM/auto-repeat mode +.TE +.sp +It also recognizes a SGR action corresponding to ANSI/ISO 6429/ECMA Set +Graphics Rendition, with the values NORMAL, BOLD, UNDERLINE, BLINK, and +REVERSE. All but NORMAL may be prefixed with `+' (turn on) or `-' (turn off). +An SGR0 designates an empty highlight sequence (equivalent to {SGR:NORMAL}). +.SH FILES +.TP 20 +\*d +Compiled terminal description database. +.SH EXTENSIONS +The \fB-F\fR option is not supported in SVr4 curses. (It is primarily intended +to help infocmp's author, while wearing his terminfo/termcap maintainer hat, +merge termcap/terminfo files from various sources into the master.) + +The \fB-R\fR, \fB-p\fR, \fB-e\fR, \fB-T\fR and \fB-i\fR options are not +supported in SVr4 curses. + +The \fB-r\fR option's notion of `termcap' capabilities is System V Release 4's. +Actual BSD curses versions will have a more restricted set. To see only the +4.4BSD set, use -r -RBSD. +.SH BUGS +The -F option of \fBinfocmp\fR(1m) should be a \fBtoe\fR(1m) mode. +.SH SEE ALSO +\fBinfocmp\fR(1m), \fBcaptoinfo\fR(1m), \fBinfotocap\fR(1m), +\fBtic\fR(1m), \fBtoe\fR(1m), +\fBcurses\fR(3X), \fBterminfo\fR(\*n). +.SH AUTHOR +Eric S. Raymond +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/man_db.renames b/man/man_db.renames new file mode 100644 index 00000000..f60f94ed --- /dev/null +++ b/man/man_db.renames @@ -0,0 +1,103 @@ +# $Id: man_db.renames,v 0.4 1996/09/07 14:53:01 tom Exp $ +# Manual-page renamings for the man_db program +# +captoinfo.1m captoinfo.1m +clear.1 clear.1m +curs_addch.3x addch.3ncurses +curs_addchstr.3x addchstr.3ncurses +curs_addstr.3x addstr.3ncurses +curs_attr.3x attr.3ncurses +curs_beep.3x beep.3ncurses +curs_bkgd.3x bkgd.3ncurses +curs_border.3x border.3ncurses +curs_clear.3x clear.3ncurses +curs_color.3x color.3ncurses +curs_delch.3x delch.3ncurses +curs_deleteln.3x deleteln.3ncurses +curs_getch.3x getch.3ncurses +curs_getstr.3x getstr.3ncurses +curs_getyx.3x getyx.3ncurses +curs_inch.3x inch.3ncurses +curs_inchstr.3x inchstr.3ncurses +curs_initscr.3x initscr.3ncurses +curs_inopts.3x inopts.3ncurses +curs_insch.3x insch.3ncurses +curs_insstr.3x insstr.3ncurses +curs_instr.3x instr.3ncurses +curs_kernel.3x kernel.3ncurses +curs_mouse.3x mouse.3ncurses +curs_move.3x move.3ncurses +curs_outopts.3x outopts.3ncurses +curs_overlay.3x overlay.3ncurses +curs_pad.3x pad.3ncurses +curs_print.3x print.3ncurses +curs_printw.3x printw.3ncurses +curs_refresh.3x refresh.3ncurses +curs_scanw.3x scanw.3ncurses +curs_scr_dmp.3x scr_dmp.3ncurses +curs_scroll.3x scroll.3ncurses +curs_slk.3x slk.3ncurses +curs_termattrs.3x termattrs.3ncurses +curs_termcap.3x termcap.3ncurses +curs_terminfo.3x terminfo.3ncurses +curs_touch.3x touch.3ncurses +curs_util.3x util.3ncurses +curs_window.3x window.3ncurses +form.3x form.3form +form_cursor.3x cursor.3form +form_data.3x data.3form +form_driver.3x driver.3form +form_field.3x field.3form +form_field_attributes.3x field_attributes.3form +form_field_buffer.3x field_buffer.3form +form_field_info.3x field_info.3form +form_field_just.3x field_just.3form +form_field_new.3x field_new.3form +form_field_opts.3x field_opts.3form +form_field_userptr.3x field_userptr.3form +form_field_validation.3x field_validation.3form +form_fieldtype.3x fieldtype.3form +form_hook.3x hook.3form +form_new.3x new.3form +form_new_page.3x new_page.3form +form_opts.3x opts.3form +form_page.3x page.3form +form_post.3x post.3form +form_requestname.3x requestname.3form +form_userptr.3x userptr.3form +form_win.3x win.3form +infocmp.1m infocmp.1m +menu.3x menu.3menu +menu_attribs.3x attribs.3menu +menu_cursor.3x cursor.3menu +menu_driver.3x driver.3menu +menu_format.3x format.3menu +menu_hook.3x hook.3menu +menu_items.3x items.3menu +menu_mark.3x mark.3menu +menu_new.3x new.3menu +menu_opts.3x opts.3menu +menu_pattern.3x pattern.3menu +menu_post.3x post.3menu +menu_requestname.3x requestname.3menu +menu_spacing.3x spacing.3menu +menu_userptr.3x userptr.3menu +menu_win.3x win.3menu +mitem_current.3x menu_current.3menu +mitem_name.3x menu_name.3menu +mitem_new.3x menu_new.3menu +mitem_opts.3x menu_opts.3menu +mitem_userptr.3x menu_userptr.3menu +mitem_value.3x menu_value.3menu +mitem_visible.3x menu_visible.3menu +ncurses.3x ncurses.3ncurses +panel.3x panel.3curses +resizeterm.3x resizeterm.3ncurses +term.5 term.5 +term.7 term.7 +terminfo.5 terminfo.5 +tic.1m tic.1m +toe.1m toe.1m +tput.1 tput.1 +tset.1 tset.1 +wresize.3x wresize.3ncurses diff --git a/man/menu.3x b/man/menu.3x new file mode 100644 index 00000000..ace2b7d3 --- /dev/null +++ b/man/menu.3x @@ -0,0 +1,162 @@ +'\" t +.\" $Id: menu.3x,v 1.9 1997/01/05 01:23:39 tom Exp $ +.TH menus 3X "" +.SH NAME +\fBmenus\fR - curses extension for programming menus +.SH SYNOPSIS +\fB#include \fR +.br +.SH DESCRIPTION +The \fBmenus\fR library provides terminal-independent facilities for composing +menu systems on character-cell terminals. The library includes: item routines, +which create and modify menu items; and menu routines, which group items into +menus, display menus on the screen, and handle interaction with the user. + +The \fBmenus\fR library uses the \fBcurses\fR libraries, and a curses +initialization routine such as \fBinitscr\fR must be called before using any of +these functions. To use the \fBmenus\fR library, link with the options +\fB-lmenu -lcurses\fR. + +.SS Current Default Values for Item Attributes + +The \fBmenus\fR library maintains a default value for item attributes. You can +get or set this default by calling the appropriate \fBget_\fR or \fBset_\fR +routine with a \fBNULL\fR item pointer. Changing this default with a +\fBset_\fR function affects future item creations, but does not change the +rendering of items already created. + +.SS Routine Name Index + +The following table lists each \fBmenu\fR routine and the name of +the manual page on which it is described. + +.TS +l l . +\fBcurses\fR Routine Name Manual Page Name += +\fBcurrent_item\fR mitem_current(3X) +\fBfree_item\fR mitem_new(3X) +\fBfree_menu\fR menu_new(3X) +\fBitem_count\fR menu_items(3X) +\fBitem_description\fR mitem_name(3X) +\fBitem_index\fR mitem_current(3X) +\fBitem_init\fR menu_hook(3X) +\fBitem_name\fR mitem_name(3X) +\fBitem_opts\fR mitem_opts(3X) +\fBitem_opts_off\fR mitem_opts(3X) +\fBitem_opts_on\fR mitem_opts(3X) +\fBitem_term\fR menu_hook(3X) +\fBitem_userptr\fR mitem_userptr(3X) +\fBitem_value\fR mitem_value(3X) +\fBitem_visible\fR mitem_visible(3X) +\fBmenu_back\fR menu_attribs(3X) +\fBmenu_driver\fR menu_driver(3X) +\fBmenu_fore\fR menu_attribs(3X) +\fBmenu_format\fR menu_format(3X) +\fBmenu_grey\fR menu_attribs(3X) +\fBmenu_init\fR menu_hook(3X) +\fBmenu_items\fR menu_items(3X) +\fBmenu_mark\fR menu_mark(3X) +\fBmenu_opts\fR menu_opts(3X) +\fBmenu_opts_off\fR menu_opts(3X) +\fBmenu_opts_on\fR menu_opts(3X) +\fBmenu_pad\fR menu_attribs(3X) +\fBmenu_pattern\fR menu_pattern(3X) +\fBmenu_request_by_name\fR menu_requestname(3X) +\fBmenu_request_name\fR menu_requestname(3X) +\fBmenu_spacing\fR menu_spacing(3X) +\fBmenu_sub\fR menu_win(3X) +\fBmenu_term\fR menu_hook(3X) +\fBmenu_userptr\fR menu_userptr(3X) +\fBmenu_win\fR menu_win(3X) +\fBnew_item\fR mitem_new(3X) +\fBnew_menu\fR menu_new(3X) +\fBpos_menu_cursor\fR menu_cursor(3X) +\fBpost_menu\fR menu_post(3X) +\fBscale_menu\fR menu_win(3X) +\fBset_current_item\fR menu_current_item(3X) +\fBset_item_init\fR menu_hook(3X) +\fBset_item_opts\fR mitem_opts(3X) +\fBset_item_term\fR menu_hook(3X) +\fBset_item_userptr\fR mitem_userptr(3X) +\fBset_item_value\fR mitem_value(3X) +\fBset_menu_back\fR menu_attribs(3X) +\fBset_menu_fore\fR menu_attribs(3X) +\fBset_menu_format\fR menu_format(3X) +\fBset_menu_grey\fR menu_attribs(3X) +\fBset_menu_init\fR menu_hook(3X) +\fBset_menu_items\fR menu_items(3X) +\fBset_menu_mark\fR menu_mark(3X) +\fBset_menu_opts\fR mitem_opts(3X) +\fBset_menu_pad\fR menu_attribs(3X) +\fBset_menu_pattern\fR menu_pattern(3X) +\fBset_menu_spacing\fR menu_spacing(3X) +\fBset_menu_sub\fR menu_win(3X) +\fBset_menu_term\fR menu_hook(3X) +\fBset_menu_userptr\fR menu_userptr(3X) +\fBset_menu_win\fR menu_win(3X) +\fBset_top_row\fR mitem_current(3X) +\fBtop_row\fR mitem_current(3X) +\fBunpost_menu\fR menu_post(3X) +.TE +.SH RETURN VALUE +Routines that return pointers return \fBNULL\fR on error. Routines that return +an integer return one of the following error codes: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_POSTED\fR +The menu is already posted. +.TP 5 +\fBE_BAD_STATE\fR +Routine was called from an initialization or termination function. +.TP 5 +\fBE_NO_ROOM\fR +Menu is too large for its window. +.TP 5 +\fBE_NOT_POSTED\fR +The menu has not been posted. +.TP 5 +\fBE_UNKNOWN_COMMAND\fR +The menu driver code saw an unknown request code. +.TP 5 +\fBE_NO_MATCH\fR +Character failed to match. +.TP 5 +\fBE_NOT_SELECTABLE\fR +The designated item cannot be selected. +.TP 5 +\fBE_NOT_CONNECTED\fR +No items are connected to the menu. +.TP 5 +\fBE_REQUEST_DENIED\fR +The menu driver could not process the request. +.SH SEE ALSO +\fBcurses\fR(3X) and 3X pages whose names begin "menu_" for detailed +descriptions of the entry points. +.SH NOTES +The header file \fB\fR automatically includes the header files +\fB\fR and \fB\fR. + +In your library list, libmenu.a should be before libncurses.a; that is, +you want to say `-lmenu -lncurses', not the other way around (which would +give you a link error using GNU \fBld\fR(1) and many other linkers). +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for ncurses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_attribs.3x b/man/menu_attribs.3x new file mode 100644 index 00000000..39850c1e --- /dev/null +++ b/man/menu_attribs.3x @@ -0,0 +1,71 @@ +'\" t +.TH menu_attributes 3X "" +.SH NAME +\fBmenu_attributes\fR - color and attribute control for menus +.SH SYNOPSIS +\fB#include \fR +.br +int set_menu_fore(MENU *menu, chtype attr); +.br +chtype menu_fore(const MENU *menu); +.br +int set_menu_back(MENU *menu, chtype attr); +.br +chtype menu_back(const MENU *menu); +.br +int set_menu_grey(MENU *menu, chtype attr); +.br +chtype menu_grey(const MENU *menu); +.br +int set_menu_pad(MENU *menu, int pad); +.br +int menu_pad(const MENU *menu); +.br +.SH DESCRIPTION +The function \fBset_menu_fore\fR sets the foreground attribute of +\fImenu\fR. This is the highlight used for selected menu items. +\fBmenu_fore\fR returns the foreground attribute. The default +is \fBA_STANDOUT\fR. + +The function \fBset_menu_back\fR sets the background attribute of +\fImenu\fR. This is the highlight used for selectable (but not currently +selected) menu items. The function \fBmenu_back\fR returns the background +attribute. The default is \fBA_NORMAL\fR. + +The function \fBset_menu_grey\fR sets the grey attribute of \fImenu\fR. This is +the highlight used for un-selectable menu items in menus that permit more than +one selection. The function \fBmenu_grey\fR returns the grey attribute. +The default is \fBA_UNDERLINE\fR. + +The function \fBset_menu_pad\fR sets the character used to fill the space +between the name and description parts of a menu item. \fBmenu_pad\fR returns +the given menu's pad character. The default is a blank. +.SH RETURN VALUE +These routines return one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.SH SEE ALSO +\fBcurses\fR(3X) and 3X pages whose names begin "menu_" for detailed +descriptions of the entry points. +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_cursor.3x b/man/menu_cursor.3x new file mode 100644 index 00000000..d2e5e2a3 --- /dev/null +++ b/man/menu_cursor.3x @@ -0,0 +1,44 @@ +'\" t +.TH menu_cursor 3X "" +.SH NAME +\fBmenu_cursor\fR - position a menu's cursor +.SH SYNOPSIS +\fB#include \fR +.br +int pos_menu_cursor(const MENU *menu); +.br +.SH DESCRIPTION +The function \fBpos_menu_cursor\fR restores the cursor to the current position +associated with the menu's selected item. This is useful after \fBcurses\fR +routines have been called to do screen-painting in response to a menu select. +.SH RETURN VALUE +This routine returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_NOT_POSTED\fR +The menu has not been posted. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_driver.3x b/man/menu_driver.3x new file mode 100644 index 00000000..d6485356 --- /dev/null +++ b/man/menu_driver.3x @@ -0,0 +1,122 @@ +'\" t +.TH menu_driver 3X "" +.SH NAME +\fBmenu_driver\fR - command-processing loop of the menu system +.SH SYNOPSIS +\fB#include \fR +.br +int menu_driver(MENU *menu, int c); +.br +.SH DESCRIPTION +Once a menu has been posted (displayed), you should funnel input events to it +through \fBmenu_driver\fR. This routine has two major input cases; either +the input is a menu navigation request or it's a printable ASCII character. +The menu driver requests are as follows: +.TP 5 +REQ_LEFT_ITEM +Move left to an item. +.TP 5 +REQ_RIGHT_ITEM +Move right to an item. +.TP 5 +REQ_UP_ITEM +Move up to an item. +.TP 5 +REQ_DOWN_ITEM +Move down to an item. +.TP 5 +REQ_SCR_ULINE +Scroll up a line. +.TP 5 +REQ_SCR_DLINE +Scroll down a line. +.TP 5 +REQ_SCR_DPAGE +Scroll down a page. +.TP 5 +REQ_SCR_UPAGE +Scroll up a page. +.TP 5 +REQ_FIRST_ITEM +Move to the first item. +.TP 5 +REQ_LAST_ITEM +Move to the last item. +.TP 5 +REQ_NEXT_ITEM +Move to the next item. +.TP 5 +REQ_PREV_ITEM +Move to the previous item. +.TP 5 +REQ_TOGGLE_ITEM +Select/deselect an item. +.TP 5 +REQ_CLEAR_PATTERN +Clear the menu pattern buffer. +.TP 5 +REQ_BACK_PATTERN +Delete the previous character from the pattern buffer. +.TP 5 +REQ_NEXT_MATCH +Move to the next item matching the pattern match. +.TP 5 +REQ_PREV_MATCH +Move to the previous item matching the pattern match. +.PP +If the second argument is a printable ASCII character, the code appends +it to the pattern buffer and attempts to move to the next item matching +the new pattern. If there is no such match, \fBmenu_driver\fR returns +\fBE_NO_MATCH\fR and deletes the appended character from the buffer. +.PP +If the second argument is one of the above pre-defined requests, the +corresponding action is performed. +.PP +If the second argument is neither printable ASCII nor one of the above +pre-defined menu requests, the drive assumes it is an application-specific +command and returns \fBE_UNKNOWN_COMMAND\fR. Application-defined commands +should be defined relative to \fBMAX_COMMAND\fR, the maximum value of these +pre-defined requests. +.SH RETURN VALUE +\fBmenu_driver\fR return one of the following error codes: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_BAD_STATE\fR +Routine was called from an initialization or termination function. +.TP 5 +\fBE_NOT_POSTED\fR +The menu has not been posted. +.TP 5 +\fBE_UNKNOWN_COMMAND\fR +The menu driver code saw an unknown request code. +.TP 5 +\fBE_NO_MATCH\fR +Character failed to match. +.TP 5 +\fBE_REQUEST_DENIED\fR +The menu driver could not process the request. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenus\fR(3x). +.SH NOTES +The header file \fB\fR automatically includes the header files +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_format.3x b/man/menu_format.3x new file mode 100644 index 00000000..a901a065 --- /dev/null +++ b/man/menu_format.3x @@ -0,0 +1,54 @@ +'\" t +.TH menu_format 3X "" +.SH NAME +\fBmenu_format\fR - set and get menu sizes +.SH SYNOPSIS +\fB#include \fR +.br +int set_menu_format(MENU *menu, int rows, int cols); +.br +int menu_format(const MENU *menu, int *rows, int *cols); +.br +.SH DESCRIPTION +The function \fBset_menu_format\fR sets the maximum display size of the given +window. If this size is too small to display all menu items, the menu will be +made scrollable. + +The default format is 16 rows, 1 column. Calling \fBset_menu_format\fR with a +null menu pointer will change this default. A zero row or column argument to +\fBset_menu_format\fR is interpreted as a request not to change the current +value. + +The function \fBmenu_format\fR returns the maximum-size constraints for the +given menu into the storage addressed by \fBrows\fR and \fBcols\fR. +.SH RETURN VALUE +These routines returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_POSTED\fR +The menu is already posted. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_hook.3x b/man/menu_hook.3x new file mode 100644 index 00000000..36adef9f --- /dev/null +++ b/man/menu_hook.3x @@ -0,0 +1,72 @@ +'\" t +.TH menu_hook 3X "" +.SH NAME +\fBmenu_hook\fR - set hooks for automatic invocation by applications +.SH SYNOPSIS +\fB#include \fR +.br +int set_item_init(MENU *menu, void (*func)(MENU *)); +.br +void (*)(MENU *) item_init(const MENU *menu); +.br +int set_item_term(MENU *menu, void (*func)(MENU *)); +.br +void (*)(MENU *) item_term(const MENU *menu); +.br +int set_menu_init(MENU *menu, void (*func)(MENU *)); +.br +void (*)(MENU *) menu_init(const MENU *menu); +.br +int set_menu_term(MENU *menu, void (*func)(MENU *)); +.br +void (*)(MENU *) menu_term(const MENU *menu); +.br +.SH DESCRIPTION +These functions make it possible to set hook functions to be called at various +points in the automatic processing of input event codes by \fBmenu_driver\fR. + +The function \fBset_item_init\fR sets a hook to be called at menu-post time and +each time the selected item changes (after the change). \fBitem_init\fR +returns the current item init hook, if any (\fBNULL\fR if there is no such +hook). + +The function \fBset_item_term\fR sets a hook to be called at menu-unpost time +and each time the selected item changes (before the change). \fBitem_term\fR +returns the current item term hook, if any (\fBNULL\fR if there is no such +hook). + +The function \fBset_menu_init\fR sets a hook to be called at menu-post time and +just after the top row on the menu changes once it is posted. \fBmenu_init\fR +returns the current menu init hook, if any (\fBNULL\fR if there is no such +hook). + +The function \fBset_menu_term\fR sets a hook to be called at menu-unpost time +and just before the top row on the menu changes once it is posted. +\fBmenu_term\fR returns the current menu term hook, if any (\fBNULL\fR if there +is no such hook). +.SH RETURN VALUE +Routines that return pointers return \fBNULL\fR on error. Other routines +return one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_items.3x b/man/menu_items.3x new file mode 100644 index 00000000..888ae819 --- /dev/null +++ b/man/menu_items.3x @@ -0,0 +1,62 @@ +'\" t +.TH menu_items 3X "" +.SH NAME +\fBmenu_items\fR - make and break connections between items and menus +.SH SYNOPSIS +\fB#include \fR +.br +int set_menu_items(MENU *menu, ITEM **items); +.br +ITEM **menu_items(const MENU *menu); +.br +int item_count(const MENU *menu); +.br +.SH DESCRIPTION +The function \fBset_menu_items\fR changes the item pointer array of the given +\fImenu\fR. The array must be terminated by a \fBNULL\fR. + +The function \fBmenu_items\fR returns the item array of the given menu. + +The function \fBitem_count\fR returns the count of items in \fImenu\fR. +.SH RETURN VALUES +The function \fBmenu_items\fR returns \fBNULL\fR on error. + +The function \fBitem_count\fR returns \fBERR\fR (the general \fBcurses\fR error +return value) on error. + +The function \fBset_menu_items\fR returns one of the following codes on error: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_POSTED\fR +The menu is already posted. +.TP 5 +\fBE_NOT_CONNECTED\fR +No items are connected to the menu. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. + +The SVr4 menu library documentation specifies the \fBitem_count\fR error value +as -1 (which is the value of \fBERR\fR). +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_mark.3x b/man/menu_mark.3x new file mode 100644 index 00000000..62f6d39c --- /dev/null +++ b/man/menu_mark.3x @@ -0,0 +1,55 @@ +'\" t +.TH menu_mark 3X "" +.SH NAME +\fBmenu_mark\fR - get and set the menu mark string +.SH SYNOPSIS +\fB#include \fR +.br +int set_menu_mark(MENU *menu, const char *mark); +.br +const char *menu_mark(const MENU *menu); +.br +.SH DESCRIPTION +In order to make menu selections visible on older terminals without +highlighting or color capability, the menu library marks selected items +in a menu with a prefix string. + +The function \fBset_menu_mark\fR sets the mark string for the given menu. +Calling \fBset_menu_mark\fR with a null menu item will abolish the mark string. +Note that changing the length of the mark string for a menu while the +menu is posted is likely to produce unhelpful behavior. + +The default string is "-" (a dash). Calling \fBset_menu_mark\fR with +a \fBNULL\fR menu argument will change this default. + +The function \fBmenu_mark\fR returns the menu's mark string (or \fBNULL\fR if +there is none). +.SH RETURN VALUE +The function \fBmenu_mark\fR returns \fBNULL\fR on error. The function +\fBset_menu_mark\fR may return the following error codes: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_new.3x b/man/menu_new.3x new file mode 100644 index 00000000..9053fdd5 --- /dev/null +++ b/man/menu_new.3x @@ -0,0 +1,50 @@ +'\" t +.TH menu_new 3X "" +.SH NAME +\fBmenu_new\fR - create and destroy menus +.SH SYNOPSIS +\fB#include \fR +.br +MENU *new_menu(ITEM **items); +.br +int free_menu(MENU *menu); +.br +.SH DESCRIPTION +The function \fBnew_menu\fR creates a new menu connected to a specified item +pointer array (which must be \fBNULL\fR-terminated). + +The function \fBfree_menu\fR disconnects \fImenu\fR from its item array +and frees the storage allocated for the menu. +.SH RETURN VALUE +The function \fBnew_menu\fR returns \fBNULL\fR on error. + +The function \fBfree_menu\fR returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_POSTED\fR +The menu has already been posted. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_opts.3x b/man/menu_opts.3x new file mode 100644 index 00000000..f5b67b19 --- /dev/null +++ b/man/menu_opts.3x @@ -0,0 +1,75 @@ +'\" t +.TH menu_opts 3X "" +.SH NAME +\fBmenu_opts\fR - set and get menu options +.SH SYNOPSIS +\fB#include \fR +.br +int set_menu_opts(MENU *menu, OPTIONS opts); +.br +int menu_opts_on(MENU *menu, OPTIONS opts); +.br +int menu_opts_off(MENU *menu, OPTIONS opts); +.br +OPTIONS menu_opts(const MENU *menu); +.br +.SH DESCRIPTION +The function \fBset_menu_opts\fR sets all the given menu's option bits (menu +option bits may be logically-OR'ed together). + +The function \fBmenu_opts_on\fR turns on the given option bits, and leaves +others alone. + +The function \fBmenu_opts_off\fR turns off the given option bits, and leaves +others alone. + +The function \fBmenu_opts\fR returns the menu's current option bits. + +The following options are defined (all are on by default): +.TP 5 +O_ONEVALUE +Only one item can be selected for this menu. +.TP 5 +O_SHOWDESC +Display the item descriptions when the menu is posted. +.TP 5 +O_ROWMAJOR +Display the menu in row-major order. +.TP 5 +O_IGNORECASE +Ignore the case when pattern-matching. +.TP 5 +O_SHOWMATCH +Move the cursor to within the item name while pattern-matching. +.TP 5 +O_NONCYCLIC +Don't wrap around next-item and previous-item, +requests to the other end of the menu. +.SH RETURN VALUE +Except for \fBmenu_opts\fR, each routine returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_POSTED\fR +The menu is already posted. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_pattern.3x b/man/menu_pattern.3x new file mode 100644 index 00000000..30bc5279 --- /dev/null +++ b/man/menu_pattern.3x @@ -0,0 +1,54 @@ +'\" t +.TH menu_pattern 3X "" +.SH NAME +\fBmenu_pattern\fR - get and set a menu's pattern buffer +.SH SYNOPSIS +\fB#include \fR +.br +int set_menu_pattern(MENU *menu, const char *pattern); +.br +char *menu_pattern(const MENU *menu); +.br +.SH DESCRIPTION +Every menu has an associated pattern match buffer. As input events that are +printable ASCII characters come in, they are appended to this match buffer +and tested for a match, as described in \fBmenu_driver\fR(3x). + +The function \fBset_menu_pattern\fR sets the pattern buffer for the given menu +and tries to find the first matching item. If it succeeds, that item becomes +current; if not, the current item does not change. + +The function \fBmenu_pattern\fR returns the pattern buffer of the given +\fImenu\fR. +.SH RETURN VALUE +The function \fBmenu_pattern\fR returns \fBNULL\fR on error. The function +\fBset_menu_pattern\fR may return the following error codes: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_NO_MATCH\fR +Character failed to match. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_post.3x b/man/menu_post.3x new file mode 100644 index 00000000..0cf8dfd3 --- /dev/null +++ b/man/menu_post.3x @@ -0,0 +1,61 @@ +'\" t +.TH menu_post 3X "" +.SH NAME +\fBmenu_post\fR - write or erase menus from associated subwindows +.SH SYNOPSIS +\fB#include \fR +.br +int post_menu(MENU *menu); +.br +int unpost_menu(MENU *menu); +.br +.SH DESCRIPTION +The function \fBpost_menu\fR displays a menu to its associated subwindow. To +trigger physical display of the subwindow, use \fBrefresh\fR or some equivalent +\fBcurses\fR routine (the implicit \fBdoupdate\fR triggered by an \fBcurses\fR +input request will do). \fBpost_menu\fR resets the selection status of all items. + +The function \fBunpost_menu\fR erases menu from its associated subwindow. +.SH RETURN VALUE +These routines return one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_POSTED\fR +The menu has already been posted. +.TP 5 +\fBE_BAD_STATE\fR +Routine was called from an initialization or termination function. +.TP 5 +\fBE_NO_ROOM\fR +Menu is too large for its window. +.TP 5 +\fBE_NOT_POSTED\fR +The menu has not been posted. +.TP 5 +\fBE_NOT_CONNECTED\fR +No items are connected to the menu. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_requestname.3x b/man/menu_requestname.3x new file mode 100644 index 00000000..9ae823e3 --- /dev/null +++ b/man/menu_requestname.3x @@ -0,0 +1,40 @@ +'\" t +.TH menu_requestname 3X "" +.SH NAME +\fBmenu_requestname\fR - handle printable menu request names +.SH SYNOPSIS +\fB#include \fR +.br +const char *menu_request_name(int request); +.br +int menu_request_by_name(const char *name); +.br +.SH DESCRIPTION +The function \fBmenu_request_name\fR returns the printable name of a menu +request code. +.br +The function \fBmenu_request_by_name\fR searches in the name-table for a request +with the given name and returns its request code. Otherwise E_NO_MATCH is returned. +.SH RETURN VALUE +\fBmenu_request_name\fR returns \fBNULL\fR on error and sets errno +to \fBE_BAD_ARGUMENT\fR. +.br +\fBmenu_request_by_name\fR returns \fBE_NO_MATCH\fR on error. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines are specific to ncurses. They were not supported on +Version 7, BSD or System V implementations. It is recommended that +any code depending on them be conditioned using NCURSES_VERSION. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_spacing.3x b/man/menu_spacing.3x new file mode 100644 index 00000000..ece22632 --- /dev/null +++ b/man/menu_spacing.3x @@ -0,0 +1,55 @@ +'\" t +.TH menu_spacing 3X "" +.SH NAME +\fBmenu_spacing\fR - Control spacing between menu items. +.SH SYNOPSIS +\fB#include \fR +.br +int set_menu_spacing(MENU *menu, + int spc_description + int spc_rows, + int spc_columns); +.br +int menu_spacing(const MENU *menu, + int* spc_description + int* spc_rows, + int* spc_columns); +.br +.SH DESCRIPTION +The function \fBset_menu_spacing\fR sets the spacing informations for the menu. +\fBspc_description\fR controls the number of spaces between an item name and an item +description. It must not be larger than \fBTABSIZE\fR. The menu system puts in the +middle of this spacing area the pad character. The remaining parts are filled with +spaces. +\fBspc_rows\fR controls the number of rows that are used for an item. It must not be +larger than 3. The menu system inserts then blank lines between item rows, these lines +will contain the pad character in the appropriate positions. +\fBspc_columns\fR controls the number of blanks between columns of items. It must not +be larger than TABSIZE. +A value of 0 for all the spacing values resets them to the default, which is 1 for all +of them. +.br +The function \fBmenu_spacing\fR passes back the spacing info for the menu. If a +pointer is NULL, this specific info is simply not returned. +.SH RETURN VALUE +Both routines return \fBE_OK\fR on success. \fBset_menu_spacing\fR may return +\fBE_POSTED\fR if the menu is posted, or \fBE_BAD_ARGUMENT\fR if one of the +spacing values is out of range. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines are specific to ncurses. They were not supported on +Version 7, BSD or System V implementations. It is recommended that +any code depending on them be conditioned using NCURSES_VERSION. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_userptr.3x b/man/menu_userptr.3x new file mode 100644 index 00000000..30afd616 --- /dev/null +++ b/man/menu_userptr.3x @@ -0,0 +1,44 @@ +'\" t +.TH menu_userptr 3X "" +.SH NAME +\fBmenu_userptr\fR - associate application data with a menu item +.SH SYNOPSIS +\fB#include \fR +.br +int set_menu_userptr(MENU *menu, const void *userptr); +.br +const void *menu_userptr(const MENU *menu); +.br +.SH DESCRIPTION +Every menu and every menu item has a field that can be used to hold +application-specific data (that is, the menu-driver code leaves it alone). +These functions get and set the menu user pointer field. +.SH RETURN VALUE +Except for \fBmenu_userptr\fR (which returns \fBNULL\fR on error), each +function returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. + +The user pointer should be a void pointer. We leave it as a char pointer for +SVr4 compatibility. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/menu_win.3x b/man/menu_win.3x new file mode 100644 index 00000000..9ed9b4eb --- /dev/null +++ b/man/menu_win.3x @@ -0,0 +1,66 @@ +'\" t +.TH menu_win 3X "" +.SH NAME +\fBmenu_win\fR - make and break menu window and subwindow associations +.SH SYNOPSIS +\fB#include \fR +.br +int set_menu_win(MENU *menu, WINDOW *win); +.br +WINDOW *menu_win(const MENU *menu); +.br +int set_menu_sub(MENU *menu, WINDOW *sub); +.br +WINDOW *menu_sub(const MENU *menu); +.br +int scale_menu(const MENU *menu, int *rows, int *columns); +.br +.SH DESCRIPTION +Every menu has an associated pair of \fBcurses\fR windows. The menu window +displays any title and border associated with the window; the menu subwindow +displays the items of the menu that are currently available for selection. + +The first four functions get and set those windows. It is not necessary to set +either window; by default, the driver code uses \fBstdscr\fR for both. + +In the \fBset_\fR functions, window argument of \fBNULL\fR is treated as though +it were \fBstsdcr\fR. A menu argument of \fBNULL\fR is treated as a request +to change the system default menu window or subwindow. + +The function \fBscale_menu\fR returns the minimum size required for the +subwindow of \fImenu\fR. +.SH RETURN VALUE +Routines that return pointers return \fBNULL\fR on error. Routines that return +an integer return one of the following error codes: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_POSTED\fR +The menu has already been posted. +.TP 5 +\fBE_NOT_CONNECTED\fR +No items are connected to the menu. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/mitem_current.3x b/man/mitem_current.3x new file mode 100644 index 00000000..52812b16 --- /dev/null +++ b/man/mitem_current.3x @@ -0,0 +1,72 @@ +'\" t +.TH mitem_current 3X "" +.SH NAME +\fBmitem_current\fR - set and get current_menu_item +.SH SYNOPSIS +\fB#include \fR +.br +int set_current_item(MENU *menu, const ITEM *item); +.br +ITEM *current_item(const MENU *menu); +.br +int set_top_row(MENU *menu, int row); +.br +int top_row(const MENU *menu); +.br +int item_index(const ITEM *item); +.br +.SH DESCRIPTION +The function \fBset_current_item\fR sets the current item (the item on which +the menu cursor is positioned). \fBcurrent_item\fR returns a pointer to the +current item in the given menu. + +The function \fBset_top_row\fR sets the top row of the menu to show the given +row (the top row is initially 0, and is reset to this value whenever the +\fBO_ROWMAJOR\fR option is toggled). The item leftmost on the given row +becomes current. The function \fBtop_row\fR returns the number of the top menu +row being displayed. + +The function \fBitem_index\fR returns the (zero-origin) index of \fIitem\fR in +the menu's item pointer list. +.SH RETURN VALUE +\fBcurrent_item\fR returns \fBNULL\fR on error. + +\fBtop_row\fR and \fBitem_index\fR return \fBERR\fR (the general \fBcurses\fB +error value) on error. + +\fBset_current_item\fR and \fBset_top_row\fR return one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_BAD_STATE\fR +Routine was called from an initialization or termination function. +.TP 5 +\fBE_NOT_CONNECTED\fR +No items are connected to the menu. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. + +The SVr4 menu library documentation specifies the \fBtop_row\fR and +\fBindex_item\fR error value as -1 (which is the value of \fBERR\fR). +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/mitem_name.3x b/man/mitem_name.3x new file mode 100644 index 00000000..dcce6990 --- /dev/null +++ b/man/mitem_name.3x @@ -0,0 +1,35 @@ +'\" t +.TH mitem_name 3X "" +.SH NAME +\fBmitem_name\fR - get menu item name and description fields +.SH SYNOPSIS +\fB#include \fR +.br +const char *item_name(const ITEM *item); +.br +const char *item_description(const ITEM *item); +.br +.SH DESCRIPTION +The function \fBitem_name\fR returns the name part of the given item. +.br +The function \fBitem_description\fR returns the description part of the given +item. +.SH RETURN VALUE +These routines returns \fBNULL\fR on error. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/mitem_new.3x b/man/mitem_new.3x new file mode 100644 index 00000000..e61febfa --- /dev/null +++ b/man/mitem_new.3x @@ -0,0 +1,49 @@ +'\" t +.TH mitem_new 3X "" +.SH NAME +\fBmitem_new\fR - create and destroy menu items +.SH SYNOPSIS +\fB#include \fR +.br +ITEM *new_item(const char *name, const char *description); +.br +int free_item(ITEM *item); +.br +.SH DESCRIPTION +The function \fBnew_item\fR allocates a new item and initializes it from the +\fBname\fR and \fBdescription\fR pointers. +.br +The function \fBfree_item\fR de-allocates an item. +.SH RETURN VALUE +The function \fBnew_item\fR returns \fBNULL\fR on error. + +The function \fBfree_item\fR returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_BAD_ARGUMENT\fR +Routine detected an incorrect or out-of-range argument. +.TP 5 +\fBE_CONNECTED\fR +Item is connected to a menu. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/mitem_opts.3x b/man/mitem_opts.3x new file mode 100644 index 00000000..c430d9b7 --- /dev/null +++ b/man/mitem_opts.3x @@ -0,0 +1,55 @@ +'\" t +.TH mitem_opts 3X "" +.SH NAME +\fBmitem_opts\fR - set and get menu item options +.SH SYNOPSIS +\fB#include \fR +.br +int set_item_opts(ITEM *item, OPTIONS opts); +.br +int item_opts_on(ITEM *item, OPTIONS opts); +.br +int item_opts_off(ITEM *item, OPTIONS opts); +.br +OPTIONS item_opts(const ITEM *item); +.br +.SH DESCRIPTION +The function \fBset_item_opts\fR sets all the given item's option bits (menu +option bits may be logically-OR'ed together). + +The function \fBitem_opts_on\fR turns on the given option bits, and leaves +others alone. + +The function \fBitem_opts_off\fR turns off the given option bits, and leaves +others alone. + +The function \fBitem_opts\fR returns the item's current option bits. + +There is only one defined option bit mask, \fBO_SELECTABLE\fR. When this is +on, the item may be selected during menu processing. This option defaults +to on. +.SH RETURN VALUE +Except for \fBitem_opts\fR, each routine returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/mitem_userptr.3x b/man/mitem_userptr.3x new file mode 100644 index 00000000..931b50d4 --- /dev/null +++ b/man/mitem_userptr.3x @@ -0,0 +1,43 @@ +'\" t +.TH mitem_userptr 3X "" +.SH NAME +\fBmitem_userptr\fR - associate application data with a menu item +.SH SYNOPSIS +\fB#include \fR +.br +int set_item_userptr(ITEM *item, const void *userptr); +.br +const void *item_userptr(const ITEM *item); +.br +.SH DESCRIPTION +Every menu item has a field that can be used to hold application-specific data +(that is, the menu-driver code leaves it alone). These functions get and set +that field. +.SH RETURN VALUE +Except for \fBitem_userptr\fR (which returns \fBNULL\fR on error), each function returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. + +The user pointer should be a void pointer. We leave it as a char pointer for +SVr4 compatibility. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/mitem_value.3x b/man/mitem_value.3x new file mode 100644 index 00000000..7738767b --- /dev/null +++ b/man/mitem_value.3x @@ -0,0 +1,48 @@ +'\" t +.TH mitem_value 3X "" +.SH NAME +\fBmitem_value\fR - set and get menu item values +.SH SYNOPSIS +\fB#include \fR +.br +int set_item_value(ITEM *item, bool value); +.br +bool item_value(const ITEM *item); +.br +.SH DESCRIPTION +If you turn off the menu option \fBO_ONEVALUE\fR (e.g., with +\fBset_menu_opts\fR or \fBmenu_opts_off\fR; see \fBmenu_opts\fR(3x)), the menu +becomes multi-valued; that is, more than one item may simultaneously be +selected. + +In a multi_valued menu, you can used \fBset_item_value\fR to select the +given menu item (second argument \fBTRUE\fR) or deselect it (second argument +\fBFALSE\fR). +.SH RETURN VALUE +The function \fBset_item_value\fR returns one of the following: +.TP 5 +\fBE_OK\fR +The routine succeeded. +.TP 5 +\fBE_SYSTEM_ERROR\fR +System error occurred (see \fBerrno\fR). +.TP 5 +\fBE_REQUEST_DENIED\fR +The menu driver could not process the request. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/mitem_visible.3x b/man/mitem_visible.3x new file mode 100644 index 00000000..1fe86846 --- /dev/null +++ b/man/mitem_visible.3x @@ -0,0 +1,30 @@ +'\" t +.TH mitem_visible 3X "" +.SH NAME +\fBmitem_visible\fR - check visibility of a menu item +.SH SYNOPSIS +\fB#include \fR +.br +bool item_visible(const ITEM *item); +.br +.SH DESCRIPTION +A menu item is visible when it is in the portion of a posted menu that +is mapped onto the screen (if the menu is scrollable, in particular, this +portion will be smaller than the whole menu). +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB\fR automatically includes the header file +\fB\fR. +.SH PORTABILITY +These routines emulate the System V menu library. They were not supported on +Version 7 or BSD versions. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/ncurses.3x b/man/ncurses.3x new file mode 100644 index 00000000..0386dba4 --- /dev/null +++ b/man/ncurses.3x @@ -0,0 +1,631 @@ +.\" $Id: ncurses.3x,v 1.19 1997/01/05 00:42:39 tom Exp $ +.TH ncurses 3X "" +.ds n 5 +.ds d @DATADIR@/terminfo +.SH NAME +\fBncurses\fR - CRT screen handling and optimization package +.SH SYNOPSIS +\fB#include \fR +.br +.SH DESCRIPTION +The \fBcurses\fR library routines give the user a terminal-independent method +of updating character screens with reasonable optimization. This +implementation is ``new curses'' (ncurses) and is the approved replacement for +4.4BSD classic curses, which has been discontinued. + +The \fBncurses\fR routines emulate the \fBcurses\fR(3X) library of System V +Release 4 UNIX, and the XPG4 curses standard (XSI curses) but the \fBncurses\fR +library is freely redistributable in source form. Differences from the SVr4 +curses are summarized under the EXTENSIONS and BUGS sections below and +described in detail in the EXTENSIONS and BUGS sections of individual man +pages. + +A program using these routines must be linked with the \fB-lncurses\fR option, +or (if it has been generated) with the debugging library \fB-lncurses_g\fR. +(Your system integrator may also have installed these libraries under +the names \fB-lcurses\fR and \fB-lcurses_g\fR.) +The ncurses_g library generates trace logs (in a file called 'trace' in the +current directory) that describe curses actions. + +The \fBncurses\fR package supports: overall screen, window and pad +manipulation; output to windows and pads; reading terminal input; control over +terminal and \fBcurses\fR input and output options; environment query +routines; color manipulation; use of soft label keys; terminfo capabilities; +and access to low-level terminal-manipulation routines. + +To initialize the routines, the routine \fBinitscr\fR or \fBnewterm\fR +must be called before any of the other routines that deal with windows +and screens are used. The routine \fBendwin\fR must be called before +exiting. To get character-at-a-time input without echoing (most +interactive, screen oriented programs want this), the following +sequence should be used: + + \fBinitscr(); cbreak(); noecho();\fR + +Most programs would additionally use the sequence: + + \fBnonl();\fR + \fBintrflush(stdscr, FALSE);\fR + \fBkeypad(stdscr, TRUE);\fR + +Before a \fBcurses\fR program is run, the tab stops of the terminal +should be set and its initialization strings, if defined, must be +output. This can be done by executing the \fBtput init\fR command +after the shell environment variable \fBTERM\fR has been exported. +\fBtset(1)\fR is usually responsible for doing this. +[See \fBterminfo\fR(\*n) for further details.] + +The \fBcurses\fR library permits manipulation of data structures, +called \fIwindows\fR, which can be thought of as two-dimensional +arrays of characters representing all or part of a CRT screen. A +default window called \fBstdscr\fR, which is the size of the terminal +screen, is supplied. Others may be created with \fBnewwin\fR. + +Note that \fBcurses\fR does not handle overlapping windows, that's done by +the \fBpanels(3x)\fR library. This means that you can either use +\fBstdscr\fR or divide the screen into tiled windows and not using +\fBstdscr\fR at all. Mixing the two will result in unpredictable, and +undesired, effects. + +Windows are referred to by variables declared as \fBWINDOW *\fR. +These data structures are manipulated with routines described here and +elsewhere in the \fBncurses\fR manual pages. Among which the most basic +routines are \fBmove\fR and \fBaddch\fR. More general versions of +these routines are included with names beginning with \fBw\fR, +allowing the user to specify a window. The routines not beginning +with \fBw\fR affect \fBstdscr\fR.) + +After using routines to manipulate a window, \fBrefresh\fR is called, +telling \fBcurses\fR to make the user's CRT screen look like +\fBstdscr\fR. The characters in a window are actually of type +\fBchtype\fR, (character and attribute data) so that other information +about the character may also be stored with each character. + +Special windows called \fIpads\fR may also be manipulated. These are windows +which are not constrained to the size of the screen and whose contents need not +be completely displayed. See curs_pad(3X) for more information. + +In addition to drawing characters on the screen, video attributes and colors +may be supported, causing the characters to show up in such modes as +underlined, in reverse video, or in color on terminals that support such +display enhancements. Line drawing characters may be specified to be output. +On input, \fBcurses\fR is also able to translate arrow and function keys that +transmit escape sequences into single values. The video attributes, line +drawing characters, and input values use names, defined in \fB\fR, +such as \fBA_REVERSE\fR, \fBACS_HLINE\fR, and \fBKEY_LEFT\fR. + +If the environment variables \fBLINES\fR and \fBCOLUMNS\fR are set, or if the +program is executing in a window environment, line and column information in +the environment will override information read by \fIterminfo\fR. This would +effect a program running in an AT&T 630 layer, for example, where the size of a +screen is changeable. + +If the environment variable \fBTERMINFO\fR is defined, any program using +\fBcurses\fR checks for a local terminal definition before checking in the +standard place. For example, if \fBTERM\fR is set to \fBatt4424\fR, then the +compiled terminal definition is found in + + \fB\*d/a/att4424\fR. + +(The \fBa\fR is copied from the first letter of \fBatt4424\fR to avoid +creation of huge directories.) However, if \fBTERMINFO\fR is set to +\fB$HOME/myterms\fR, \fBcurses\fR first checks + + \fB$HOME/myterms/a/att4424\fR, + +and if that fails, it then checks + + \fB\*d/a/att4424\fR. + +This is useful for developing experimental definitions or when write +permission in \fB\*d\fR is not available. + +The integer variables \fBLINES\fR and \fBCOLS\fR are defined in +\fB\fR and will be filled in by \fBinitscr\fR with the size of the +screen. The constants \fBTRUE\fR and \fBFALSE\fR have the values \fB1\fR and +\fB0\fR, respectively. + +The \fBcurses\fR routines also define the \fBWINDOW *\fR variable \fBcurscr\fR +which is used for certain low-level operations like clearing and redrawing a +screen containing garbage. The \fBcurscr\fR can be used in only a few +routines. + +.SS Routine and Argument Names +Many \fBcurses\fR routines have two or more versions. The routines prefixed +with \fBw\fR require a window argument. The routines prefixed with \fBp\fR +require a pad argument. Those without a prefix generally use \fBstdscr\fR. + +The routines prefixed with \fBmv\fR require a \fIy\fR and \fIx\fR +coordinate to move to before performing the appropriate action. The +\fBmv\fR routines imply a call to \fBmove\fR before the call to the +other routine. The coordinate \fIy\fR always refers to the row (of +the window), and \fIx\fR always refers to the column. The upper +left-hand corner is always (0,0), not (1,1). + +The routines prefixed with \fBmvw\fR take both a window argument and +\fIx\fR and \fIy\fR coordinates. The window argument is always +specified before the coordinates. + +In each case, \fIwin\fR is the window affected, and \fIpad\fR is the +pad affected; \fIwin\fR and \fIpad\fR are always pointers to type +\fBWINDOW\fR. + +Option setting routines require a Boolean flag \fIbf\fR with the value +\fBTRUE\fR or \fBFALSE\fR; \fIbf\fR is always of type \fBbool\fR. The +variables \fIch\fR and \fIattrs\fR below are always of type +\fBchtype\fR. The types \fBWINDOW\fR, \fBSCREEN\fR, \fBbool\fR, and +\fBchtype\fR are defined in \fB\fR. The type \fBTERMINAL\fR +is defined in \fB\fR. All other arguments are integers. + +.SS Routine Name Index +The following table lists each \fBcurses\fR routine and the name of +the manual page on which it is described. Routines flagged with `*' +are ncurses-specific, not described by XPG4 or present in SVr4. + +.TS +center tab(/); +l l +l l . +\fBcurses\fR Routine Name/Manual Page Name += +addch/curs_addch(3X) +addchnstr/curs_addchstr(3X) +addchstr/curs_addchstr(3X) +addnstr/curs_addstr(3X) +addstr/curs_addstr(3X) +attroff/curs_attr(3X) +attron/curs_attr(3X) +attrset/curs_attr(3X) +baudrate/curs_termattrs(3X) +beep/curs_beep(3X) +bkgd/curs_bkgd(3X) +bkgdset/curs_bkgd(3X) +border/curs_border(3X) +box/curs_border(3X) +can_change_color/curs_color(3X) +cbreak/curs_inopts(3X) +clear/curs_clear(3X) +clearok/curs_outopts(3X) +clrtobot/curs_clear(3X) +clrtoeol/curs_clear(3X) +color_content/curs_color(3X) +copywin/curs_overlay(3X) +curs_set/curs_kernel(3X) +def_prog_mode/curs_kernel(3X) +def_shell_mode/curs_kernel(3X) +del_curterm/curs_terminfo(3X) +delay_output/curs_util(3X) +delch/curs_delch(3X) +deleteln/curs_deleteln(3X) +delscreen/curs_initscr(3X) +delwin/curs_window(3X) +derwin/curs_window(3X) +doupdate/curs_refresh(3X) +dupwin/curs_window(3X) +echo/curs_inopts(3X) +echochar/curs_addch(3X) +endwin/curs_initscr(3X) +erase/curs_clear(3X) +erasechar/curs_termattrs(3X) +filter/curs_util(3X) +flash/curs_beep(3X) +flushinp/curs_util(3X) +getbegyx/curs_getyx(3X) +getch/curs_getch(3X) +getmaxyx/curs_getyx(3X) +getmouse/curs_mouse(3X)* +getparyx/curs_getyx(3X) +getstr/curs_getstr(3X) +getsyx/curs_kernel(3X) +getwin/curs_util(3X) +getyx/curs_getyx(3X) +halfdelay/curs_inopts(3X) +has_colors/curs_color(3X) +has_ic/curs_termattrs(3X) +has_il/curs_termattrs(3X) +has_key/curs_getch(3X)* +hline/curs_border(3X) +idcok/curs_outopts(3X) +idlok/curs_outopts(3X) +immedok/curs_outopts(3X) +inch/curs_inch(3X) +inchnstr/curs_inchstr(3X) +inchstr/curs_inchstr(3X) +init_color/curs_color(3X) +init_pair/curs_color(3X) +initscr/curs_initscr(3X) +innstr/curs_instr(3X) +insch/curs_insch(3X) +insdelln/curs_deleteln(3X) +insertln/curs_deleteln(3X) +insnstr/curs_insstr(3X) +insstr/curs_insstr(3X) +instr/curs_instr(3X) +intrflush/curs_inopts(3X) +is_linetouched/curs_touch(3X) +is_wintouched/curs_touch(3X) +isendwin/curs_initscr(3X) +keyname/curs_util(3X) +keypad/curs_inopts(3X) +killchar/curs_termattrs(3X) +leaveok/curs_outopts(3X) +longname/curs_termattrs(3X) +mcprint/curs_print(3X)* +meta/curs_inopts(3X) +mouseinterval/curs_mouse(3X)* +mousemask/curs_mouse(3X)* +move/curs_move(3X) +mvaddch/curs_addch(3X) +mvaddchnstr/curs_addchstr(3X) +mvaddchstr/curs_addchstr(3X) +mvaddnstr/curs_addstr(3X) +mvaddstr/curs_addstr(3X) +mvcur/curs_terminfo(3X) +mvdelch/curs_delch(3X) +mvderwin/curs_window(3X) +mvgetch/curs_getch(3X) +mvgetstr/curs_getstr(3X) +mvinch/curs_inch(3X) +mvinchnstr/curs_inchstr(3X) +mvinchstr/curs_inchstr(3X) +mvinnstr/curs_instr(3X) +mvinsch/curs_insch(3X) +mvinsnstr/curs_insstr(3X) +mvinsstr/curs_insstr(3X) +mvinstr/curs_instr(3X) +mvprintw/curs_printw(3X) +mvscanw/curs_scanw(3X) +mvwaddch/curs_addch(3X) +mvwaddchnstr/curs_addchstr(3X) +mvwaddchstr/curs_addchstr(3X) +mvwaddnstr/curs_addstr(3X) +mvwaddstr/curs_addstr(3X) +mvwdelch/curs_delch(3X) +mvwgetch/curs_getch(3X) +mvwgetstr/curs_getstr(3X) +mvwin/curs_window(3X) +mvwinch/curs_inch(3X) +mvwinchnstr/curs_inchstr(3X) +mvwinchstr/curs_inchstr(3X) +mvwinnstr/curs_instr(3X) +mvwinsch/curs_insch(3X) +mvwinsnstr/curs_insstr(3X) +mvwinsstr/curs_insstr(3X) +mvwinstr/curs_instr(3X) +mvwprintw/curs_printw(3X) +mvwscanw/curs_scanw(3X) +napms/curs_kernel(3X) +newpad/curs_pad(3X) +newterm/curs_initscr(3X) +newwin/curs_window(3X) +nl/curs_outopts(3X) +nocbreak/curs_inopts(3X) +nodelay/curs_inopts(3X) +noecho/curs_inopts(3X) +nonl/curs_outopts(3X) +noqiflush/curs_inopts(3X) +noraw/curs_inopts(3X) +notimeout/curs_inopts(3X) +overlay/curs_overlay(3X) +overwrite/curs_overlay(3X) +pair_content/curs_color(3X) +pechochar/curs_pad(3X) +pnoutrefresh/curs_pad(3X) +prefresh/curs_pad(3X) +printw/curs_printw(3X) +putp/curs_terminfo(3X) +putwin/curs_util(3X) +qiflush/curs_inopts(3X) +raw/curs_inopts(3X) +redrawwin/curs_refresh(3X) +refresh/curs_refresh(3X) +reset_prog_mode/curs_kernel(3X) +reset_shell_mode/curs_kernel(3X) +resetty/curs_kernel(3X) +resizeterm/resizeterm(3x)* +restartterm/curs_terminfo(3X) +ripoffline/curs_kernel(3X) +savetty/curs_kernel(3X) +scanw/curs_scanw(3X) +scr_dump/curs_scr_dump(3X) +scr_init/curs_scr_dump(3X) +scr_restore/curs_scr_dump(3X) +scr_set/curs_scr_dump(3X) +scrl/curs_scroll(3X) +scroll/curs_scroll(3X) +scrollok/curs_outopts(3X) +set_curterm/curs_terminfo(3X) +set_term/curs_initscr(3X) +setscrreg/curs_outopts(3X) +setsyx/curs_kernel(3X) +setterm/curs_terminfo(3X) +setupterm/curs_terminfo(3X) +slk_attr/curs_slk(3X)* +slk_attroff/curs_slk(3X) +slk_attron/curs_slk(3X) +slk_attrset/curs_slk(3X) +slk_clear/curs_slk(3X) +slk_init/curs_slk(3X) +slk_label/curs_slk(3X) +slk_noutrefresh/curs_slk(3X) +slk_refresh/curs_slk(3X) +slk_restore/curs_slk(3X) +slk_set/curs_slk(3X) +slk_touch/curs_slk(3X) +standend/curs_attr(3X) +standout/curs_attr(3X) +start_color/curs_color(3X) +subpad/curs_pad(3X) +subwin/curs_window(3X) +syncok/curs_window(3X) +termattrs/curs_termattrs(3X) +termname/curs_termattrs(3X) +tgetent/curs_termcap(3X) +tgetflag/curs_termcap(3X) +tgetnum/curs_termcap(3X) +tgetstr/curs_termcap(3X) +tgoto/curs_termcap(3X) +tigetflag/curs_terminfo(3X) +tigetnum/curs_terminfo(3X) +tigetstr/curs_terminfo(3X) +timeout/curs_inopts(3X) +touchline/curs_touch(3X) +touchwin/curs_touch(3X) +tparm/curs_terminfo(3X) +tputs/curs_termcap(3X) +tputs/curs_terminfo(3X) +typeahead/curs_inopts(3X) +unctrl/curs_util(3X) +ungetch/curs_getch(3X) +ungetmouse/curs_mouse(3X)* +untouchwin/curs_touch(3X) +use_env/curs_util(3X) +vidattr/curs_terminfo(3X) +vidputs/curs_terminfo(3X) +vline/curs_border(3X) +vwprintw/curs_printw(3X) +vwscanw/curs_scanw(3X) +waddch/curs_addch(3X) +waddchnstr/curs_addchstr(3X) +waddchstr/curs_addchstr(3X) +waddnstr/curs_addstr(3X) +waddstr/curs_addstr(3X) +wattroff/curs_attr(3X) +wattron/curs_attr(3X) +wattrset/curs_attr(3X) +wbkgd/curs_bkgd(3X) +wbkgdset/curs_bkgd(3X) +wborder/curs_border(3X) +wclear/curs_clear(3X) +wclrtobot/curs_clear(3X) +wclrtoeol/curs_clear(3X) +wcursyncup/curs_window(3X) +wdelch/curs_delch(3X) +wdeleteln/curs_deleteln(3X) +wechochar/curs_addch(3X) +wenclose/curs_mouse(3X)* +werase/curs_clear(3X) +wgetch/curs_getch(3X) +wgetnstr/curs_getstr(3X) +wgetstr/curs_getstr(3X) +whline/curs_border(3X) +winch/curs_inch(3X) +winchnstr/curs_inchstr(3X) +winchstr/curs_inchstr(3X) +winnstr/curs_instr(3X) +winsch/curs_insch(3X) +winsdelln/curs_deleteln(3X) +winsertln/curs_deleteln(3X) +winsnstr/curs_insstr(3X) +winsstr/curs_insstr(3X) +winstr/curs_instr(3X) +wmove/curs_move(3X) +wnoutrefresh/curs_refresh(3X) +wprintw/curs_printw(3X) +wredrawln/curs_refresh(3X) +wrefresh/curs_refresh(3X) +wresize/wresize(3x)* +wscanw/curs_scanw(3X) +wscrl/curs_scroll(3X) +wsetscrreg/curs_outopts(3X) +wstandend/curs_attr(3X) +wstandout/curs_attr(3X) +wsyncdown/curs_window(3X) +wsyncup/curs_window(3X) +wtimeout/curs_inopts(3X) +wtouchln/curs_touch(3X) +wvline/curs_border(3X) +.TE +.SH RETURN VALUE +Routines that return an integer return \fBERR\fR upon failure and an +integer value other than \fBERR\fR upon successful completion, unless +otherwise noted in the routine descriptions. + +All macros return the value of the \fBw\fR version, except \fBsetscrreg\fR, +\fBwsetscrreg\fR, \fBgetyx\fR, \fBgetbegyx\fR, \fBgetmaxyx\fR. The return +values of \fBsetscrreg\fR, \fBwsetscrreg\fR, \fBgetyx\fR, \fBgetbegyx\fR, and +\fBgetmaxyx\fR are undefined (\fIi\fR.\fIe\fR., these should not be used as the +right-hand side of assignment statements). + +Routines that return pointers return \fBNULL\fR on error. +.SH SEE ALSO +\fBterminfo\fR(\*n) and 3X pages whose names begin "curs_" for detailed routine +descriptions. +.SH EXTENSIONS +The \fBcurses\fR library can be compiled with an option (\fB-DTERMCAP_FILE\fR) +that falls back to the old-style /etc/termcap file if the terminal setup code +cannot find a terminfo entry corresponding to \fBTERM\fR. Use of this feature +is not recommended, as it essentially includes an entire termcap compiler in +the \fBcurses\fR startup code, at significant cost in core and startup cycles. + +Compiling with \fB-DTERMCAP_FILE\fR changes the library's initialization +sequence in a way intended to mimic the behavior of 4.4BSD curses. If there is +no local or system terminfo entry matching \fBTERM\fR, then the library looks +for termcap entries in the following places: (1) if \fBTERMINFO\fR is +undefined, in the file named by \fBTERMCAP_FILE\fR; (2) if \fBTERMINFO\fR is +defined and begins with a slash, it is interpreted as the name of a termcap +file to search for \fBTERM\fR; (3) otherwise, if \fBTERMINFO\fR has a leading +string that looks like a terminal entry name list, and it matches \fBTERM\fR, +the contents of \fBTERMINFO\fR is interpreted as a termcap; (4) if +\fBTERMINFO\fR looks like a termcap but doesn't match \fBTERM\fR, the termcap +file is searched for among the colon-separated paths in the environment +variable \fBTERMPATHS\fR if that is defined, and in ~/.termcap and the file +value of \fBTERMCAP_FILE\fR otherwise. + +Versions of \fBcurses\fR compiled on PC clones support display of the PC ROM +characters (including ROM characters 0-31, which stock SVr4 curses cannot +display). See the EXTENSIONS sections of \fBcurs_addch\fR(3x) and +\fBcurs_attr\fR(3x). + +The \fBcurses\fR library includes facilities for capturing mouse events on +certain terminals (including xterm). See the \fBcurs_mouse\fR(3X) +manual page for details. + +The \fBcurses\fR library includes a function for directing application output +to a printer attached to the terminal device. See the \fBcurs_print\fR(3X) +manual page for details. +.SH PORTABILITY +The \fBcurses\fR library is intended to be BASE-level conformant with the XSI +Curses standard. Certain portions of the EXTENDED XSI Curses functionality +(including color support) are supported. The following EXTENDED XSI Curses +calls in support of wide (multibyte) characters are not yet implemented: +\fBaddnwstr\fB, +\fBaddwstr\fB, +\fBmvaddnwstr\fB, +\fBmvwaddnwstr\fB, +\fBmvaddwstr\fB, +\fBwaddnwstr\fB, +\fBwaddwstr\fB, +\fBadd_wch\fB, +\fBwadd_wch\fB, +\fBmvadd_wch\fB, +\fBmvwadd_wch\fB, +\fBadd_wchnstr\fB, +\fBadd_wchstr\fB, +\fBwadd_wchnstr\fB, +\fBwadd_wchstr\fB, +\fBmvadd_wchnstr\fB, +\fBmvadd_wchstr\fB, +\fBmvwadd_wchnstr\fB, +\fBmvwadd_wchstr\fB, +\fBbkgrndset\fB, +\fBbkgrnd\fB, +\fBgetbkgrnd\fB, +\fBwbkgrnd\fB, +\fBwbkgrndset\fB, +\fBwgetbkgrnd\fB, +\fBborder_set\fB, +\fBwborder_set\fB, +\fBbox_set\fB, +\fBhline_set\fB, +\fBmvhline_set\fB, +\fBmvvline_set\fB, +\fBmvwhline_set\fB, +\fBmvwvline_set\fB, +\fBwhline_set\fB, +\fBvhline_set\fB, +\fBwvline_set\fB, +\fBecho_wchar\fB, +\fBwecho_wchar\fB, +\fBerasewchar\fB, +\fBkillwchar\fB, +\fBget_wch\fB, +\fBmvget_wch\fB, +\fBmvwget_ch\fB, +\fBwget_wch\fB, +\fBgetwchtype\fB, +\fBget_wstr\fB, +\fBgetn_wstr\fB, +\fBwget_wstr\fB, +\fBwgetn_wstr\fB, +\fBmvget_wstr\fB, +\fBmvgetn_wstr\fB, +\fBmvwget_wstr\fB, +\fBmvwgetn_wstr\fB, +\fBinnwstr\fB, +\fBinwstr\fB, +\fBwinnwstr\fB, +\fBwinwstr\fB, +\fBmvinnwstr\fB, +\fBmvinwstr\fB, +\fBmvwinnwstr\fB, +\fBmvwinwstr\fB, +\fBins_nwstr\fB, +\fBins_wstr\fB, +\fBmvins_nwstr\fB, +\fBmvins_wstr\fB, +\fBmvwins_nwstr\fB, +\fBmvwins_wstr\fB, +\fBwins_nwstr\fB, +\fBwins_wstr\fB, +\fBins_wch\fB, +\fBwins_wch\fB, +\fBmvins_wch\fB, +\fBmvwins_wch\fB, +\fBin_wch\fB, +\fBwin_wch\fB, +\fBmvin_wch\fB, +\fBmvwin_wch\fB, +\fBinwchstr\fB, +\fBinwchnstr\fB, +\fBwinwchstr\fB, +\fBwinwchnstr\fB, +\fBmvinwchstr\fB, +\fBmvinwchnstr\fB, +\fBmvinwchstr\fB, +\fBmvwinwchnstr\fB. +.PP +A small number of local differences (that is, individual differences between +the XSI Curses and \fBcurses\fR calls) are described in \fBPORTABILITY\fR +sections of the library man pages. +.PP +The routine \fBhas_key\fR is not part of XPG4, nor is it present in SVr4. See +the \fBcurs_getch\fR(3X) manual page for details. +.PP +The routine \fBslk_attr\fR is not part of XPG4, nor is it present in SVr4. See +the \fBcurs_slk\fR(3X) manual page for details. +.PP +The routines \fBgetmouse\fR, \fBmousemask\fR, \fBungetmouse\fR, +\fBmouseinterval\fR, and \fBwenclose\fR relating to mouse interfacing are not +part of XPG4, nor are they present in SVr4. See the \fBcurs_mouse\fR(3X) +manual page for details. +.PP +The routine \fBmcprint\fR was not present in any previous curses +implementation. See the \fBcurs_print\fR(3X) manual page for details. +.PP +The routine \fBwresize\fR is not part of XPG4, nor is it present in SVr4. See +the \fBwresize\fR(3X) manual page for details. +.PP +In historic curses versions, delays embedded in the capabilities \fBcr\fR, +\fBind\fR, \fBcub1\fR, \fBff\fR and \fBtab\fR activated corresponding delay +bits in the UNIX tty driver. In this implementation, all padding is done by +NUL sends. This method is slightly more expensive, but narrows the interface +to the UNIX kernel significantly and increases the package's portability +correspondingly. +.PP +In the XSI standard and SVr4 manual pages, many entry points have prototype +arguments of the for \fBchar *const\fR (or \fBcchar_t *const\fR, or \fBwchar_t +*const\fR, or \fBvoid *const\fR). Depending on one's interpretation of the +ANSI C standard (see section 3.5.4.1), these declarations are either (a) +meaningless, or (b) meaningless and illegal. The declaration \fBconst char +*x\fR is a modifiable pointer to unmodifiable data, but \fBchar *const x\fR' is +an unmodifiable pointer to modifiable data. Given that C passes arguments by +value, \fB *const\fR as a formal type is at best dubious. Some compilers +choke on the prototypes. Therefore, in this implementation, they have been +changed to \fBconst *\fR globally. +.SH NOTES +The header file \fB\fR automatically includes the header files +\fB\fR and \fB\fR. + +If standard output from a \fBcurses\fR program is re-directed to something +which is not a tty, screen updates will be directed to standard error. This +was an undocumented feature of AT&T System V Release 3 curses. +.SH AUTHORS +Zeyd M. Ben-Halim, Eric S. Raymond. Descends from the original pcurses +by Pavel Curtis. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/panel.3x b/man/panel.3x new file mode 100644 index 00000000..cfa170ef --- /dev/null +++ b/man/panel.3x @@ -0,0 +1,155 @@ +.TH panel 3X "" +.ds n 5 +.ds d @DATADIR@/terminfo +.SH NAME +panel - panel stack extension for curses +.SH SYNOPSIS +\fB#include \fR +.P +\fBcc [flags] sourcefiles -lpanel -lncurses\fR +.P +\fBPANEL *new_panel(WINDOW *win)\fR +.br +\fBint bottom_panel(PANEL *pan)\fR +.br +\fBint top_panel(PANEL *pan)\fR +.br +\fBint show_panel(PANEL *pan)\fR +.br +\fBvoid update_panels();\fR +.br +\fBint hide_panel(PANEL *pan)\fR +.br +\fBWINDOW *panel_window(const PANEL *pan)\fR +.br +\fBint replace_panel(PANEL *pan, WINDOW *window)\fR +.br +\fBint move_panel(PANEL *pan, int starty, int startx)\fR +.br +\fBint panel_hidden(const PANEL *pan)\fR +.br +\fBPANEL *panel_above(const PANEL *pan)\fR +.br +\fBPANEL *panel_below(const PANEL *pan)\fR +.br +\fBint set_panel_userptr(PANEL *pan, const void *ptr)\fR +.br +\fBconst void *panel_userptr(const PANEL *pan)\fR +.br +\fBint del_panel(PANEL *pan)\fR +.br +.SH DESCRIPTION +Panels are curses(3X) windows with the added feature of +depth. Panel functions allow the use of stacked windows and ensure +the proper portions of each window and the curses \fBstdscr\fR window are +hidden or displayed when panels are added, moved, modified or removed. +The set of currently visible panels is the stack of panels. The +\fBstdscr\fR window is beneath all panels, and is not considered part +of the stack. +.P +A window is associated with every panel. The panel routines enable +you to create, move, hides, and show panels, as well as position a +panel at any desired location in the stack. +.P +Panel routines are a functional layer added to curses(3X), make only +high-level curses calls, and work anywhere terminfo curses does. +.SH FUNCTIONS +.TP +\fBnew_panel(win)\fR +allocates a \fBPANEL\fR structure, associates it with +\fBwin\fR, places the panel on the top of the stack (causes it +to be displayed above any other panel) and returns a +pointer to the new panel. +.TP +\fBvoid update_panels()\fR +refreshes the virtual screen to reflect the relations between the +panels in the stack, but does not call doupdate() to refresh the +physical screen. Use this function and not wrefresh or wnoutrefresh. +update_panels() may be called more than once before a call to +doupdate(), but doupdate() is the function responsible for updating +the physical screen. +.TP +\fBdel_panel(pan)\fR +removes the given panel from the stack and deallocates the +\fBPANEL\fR structure (but not its associated window). +.TP +\fBhide_panel(pan)\fR +removes the given panel from the panel stack and thus hides it from +view. The \fBPANEL\fR structure is not lost, merely removed from the stack. +.TP +\fBshow_panel(pan)\fR +makes a hidden panel visible by placing it on top of the panels in the +panel stack. See COMPATIBILITY below. +.TP +\fBtop_panel(pan)\fR +puts the given visible panel on top of all panels in the stack. See +COMPATIBILITY below. +.TP +\fBbottom_panel(pan)\fR +puts panel at the bottom of all panels. +.TP +\fBmove_panel(pan,starty,startx)\fR +moves the given panel window so that its upper-left corner is at +\fBstarty\fR, \fBstartx\fR. It does not change the position of the +panel in the stack. Be sure to use this function, not \fBmvwin()\fR, +to move a panel window. +.TP +\fBreplace_panel(pan,window)\fR +replaces the current window of panel with \fBwindow\fR (useful, for +example if you want to resize a panel; if you're using \fBncurses\fR, +you can call \fBreplace_panel\fR on the output of \fBwresize\fR(3x)). +It does not change the position of the panel in the stack. +.TP +\fBpanel_above(pan)\fR +returns a pointer to the panel above pan. If the panel argument is +\fB(PANEL *)0\fR, it returns a pointer to the bottom panel in the stack. +.TP +\fBpanel_below(pan)\fR +returns a pointer to the panel just below pan. If the panel argument +is \fB(PANEL *)0\fR, it returns a pointer to the top panel in the stack. +.TP +\fBset_panel_userptr(pan,ptr)\fR +sets the panel's user pointer. +.TP +\fBpanel_userptr(pan)\fR +returns the user pointer for a given panel. +.TP +\fBpanel_window(pan)\fR +returns a pointer to the window of the given panel. +.SH DIAGNOSTICS +Each routine that returns a pointer returns \fBNULL\fR if an error +occurs. Each routine that returns an int value returns \fBOK\fR if it +executes successfully and \fBERR\fR if not. +.SH COMPATIBILITY +Reasonable care has been taken to ensure compatibility +with the native panel facility introduced in SVr3.2 (inspection of +the SVr4 manual pages suggests the programming interface is unchanged). +The \fBPANEL\fR data structures are merely similar. The programmer +is cautioned not to directly use \fBPANEL\fR fields. +.P +The functions \fBshow_panel()\fR and \fBtop_panel()\fR are identical +in this implementation, and work equally well with displayed or hidden +panels. In the native System V implementation, \fBshow_panel()\fR is +intended for making a hidden panel visible (at the top of the stack) +and \fBtop_panel()\fR is intended for making an already-visible panel +move to the top of the stack. You are cautioned to use the correct +function to ensure compatibility with native panel libraries. +.SH NOTE +In your library list, libpanel.a should be before libncurses.a; that is, +you want to say `-lpanel -lncurses', not the other way around (which would +give you a link error using GNU \fBld\fR(1) and some other linkers). +.SH FILES +.P +panel.h +interface for the panels library +.P +libpanel.a +the panels library itself +.SH SEE ALSO +curses(3X) +.SH AUTHOR +Originally written by Warren Tucker , +primarily to assist in porting u386mon to systems without a native +panels library. Repackaged for ncurses by Zeyd ben-Halim. + + diff --git a/man/resizeterm.3x b/man/resizeterm.3x new file mode 100644 index 00000000..ceb49e3d --- /dev/null +++ b/man/resizeterm.3x @@ -0,0 +1,69 @@ +.\"***************************************************************************** +.\" Copyright 1996 by Thomas E. Dickey * +.\" All Rights Reserved. * +.\" * +.\" Permission to use, copy, modify, and distribute this software and its * +.\" documentation for any purpose and without fee is hereby granted, provided * +.\" that the above copyright notice appear in all copies and that both that * +.\" copyright notice and this permission notice appear in supporting * +.\" documentation, and that the name of the above listed copyright holder(s) * +.\" not be used in advertising or publicity pertaining to distribution of the * +.\" software without specific, written prior permission. THE ABOVE LISTED * +.\" COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * +.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * +.\" EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * +.\" SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * +.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * +.\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * +.\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * +.\"***************************************************************************** +.\" $Id: resizeterm.3x,v 1.3 1996/12/28 20:00:50 tom Exp $ +.TH resizeterm 3X "" +. +.SH NAME +\fBresizeterm\fR - change the curses terminal size +. +.SH SYNOPSIS +\fB#include \fR + +\fBint resizeterm(int lines, int columns);\fR +. +.SH DESCRIPTION +This is an extension to the curses library. +It provides callers with a hook into the \fBncurses\fR data to resize windows, +primarily for use by programs running in an X Window terminal (e.g., xterm). +The function \fBresizeterm\fR resizes the standard and current windows +to the specified dimensions, and adjusts other bookkeeping data used by +the \fBncurses\fR library that record the window dimensions. + +When resizing the windows, the function blank-fills the areas that are +extended. The calling application should fill in these areas with +appropriate data. + +The function attempts to resize all windows. +However, due to the calling convention of pads, +it is not possible to resize these +without additional interaction with the application. +. +.SH RETURN VALUE +The function returns the integer \fBERR\fR upon failure and \fBOK\fR on success. +It will fail if either of the dimensions less than or equal to zero, +or if an error occurs while (re)allocating memory for the windows. +. +.SH NOTES +While this function is intended to be used to support a signal handler +(i.e., for SIGWINCH), care should be taken to avoid invoking it in a +context where \fBmalloc\fR or \fBrealloc\fR may have been interrupted, +since it uses those functions. +. +.SH SEE ALSO +\fBwresize\fR(3x). +. +.SH AUTHOR +Thomas Dickey (from an equivalent function written in 1988 for BSD curses). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/term.5 b/man/term.5 new file mode 100644 index 00000000..3ac1fa86 --- /dev/null +++ b/man/term.5 @@ -0,0 +1,179 @@ +.TH TERM 5 +.ds n 5 +.ds d @DATADIR@/terminfo +.SH NAME +term \- format of compiled term file. +.SH SYNOPSIS +.B term +.SH DESCRIPTION +.PP +Compiled terminfo descriptions are placed under the directory \fB\*d\fP. +In order to avoid a linear search of a huge \s-1UNIX\s+1 system directory, a +two-level scheme is used: \fB\*b/c/name\fP +where +.I name +is the name of the terminal, and +.I c +is the first character of +.IR name . +Thus, +.I act4 +can be found in the file \fB\*d/a/act4\fP. +Synonyms for the same terminal are implemented by multiple +links to the same compiled file. +.PP +The format has been chosen so that it will be the same on all hardware. +An 8 or more bit byte is assumed, but no assumptions about byte ordering +or sign extension are made. +.PP +The compiled file is created with the +.I tic +program, and read by the routine +.IR setupterm . +The file is divided into six parts: +the header, +terminal names, +boolean flags, +numbers, +strings, +and +string table. +.PP +The header section begins the file. +This section contains six short integers in the format +described below. +These integers are +(1) the magic number (octal 0432); +(2) the size, in bytes, of the names section; +(3) the number of bytes in the boolean section; +(4) the number of short integers in the numbers section; +(5) the number of offsets (short integers) in the strings section; +(6) the size, in bytes, of the string table. +.PP +Short integers are stored in two 8-bit bytes. +The first byte contains the least significant 8 bits of the value, +and the second byte contains the most significant 8 bits. +(Thus, the value represented is 256*second+first.) +The value \-1 is represented by the two bytes 0377, 0377; other negative +values are illegal. This value generally +means that the corresponding capability is missing from this terminal. +Note that this format corresponds to the hardware of the \s-1VAX\s+1 +and \s-1PDP\s+1-11 (that is, little-endian machines). +Machines where this does not correspond to the hardware must read the +integers as two bytes and compute the little-endian value. +.PP +The terminal names section comes next. +It contains the first line of the terminfo description, +listing the various names for the terminal, +separated by the `|' character. +The section is terminated with an \s-1ASCII NUL\s+1 character. +.PP +The boolean flags have one byte for each flag. +This byte is either 0 or 1 as the flag is present or absent. +The capabilities are in the same order as the file . +.PP +Between the boolean section and the number section, +a null byte will be inserted, if necessary, +to ensure that the number section begins on an even byte (this is a +relic of the PDP-11's word-addressed architecture, originally +designed in to avoid IOT traps induced by addressing a word on an +odd byte boundary). +All short integers are aligned on a short word boundary. +.PP +The numbers section is similar to the flags section. +Each capability takes up two bytes, +and is stored as a little-endian short integer. +If the value represented is \-1, the capability is taken to be missing. +.PP +The strings section is also similar. +Each capability is stored as a short integer, in the format above. +A value of \-1 means the capability is missing. +Otherwise, the value is taken as an offset from the beginning +of the string table. +Special characters in ^X or \ec notation are stored in their +interpreted form, not the printing representation. +Padding information $ and parameter information %x are +stored intact in uninterpreted form. +.PP +The final section is the string table. +It contains all the values of string capabilities referenced in +the string section. +Each string is null terminated. +.PP +Note that it is possible for +.I setupterm +to expect a different set of capabilities +than are actually present in the file. +Either the database may have been updated since +.I setupterm +has been recompiled +(resulting in extra unrecognized entries in the file) +or the program may have been recompiled more recently +than the database was updated +(resulting in missing entries). +The routine +.I setupterm +must be prepared for both possibilities \- +this is why the numbers and sizes are included. +Also, new capabilities must always be added at the end of the lists +of boolean, number, and string capabilities. +.PP +Despite the consistent use of little-endian for numbers and the otherwise +self-describing format, it is not wise to count on portability of binary +terminfo entries between commercial UNIX versions. The problem is that there +are at least three versions of terminfo (under HP-UX, AIX, and OSF/1) which +diverged from System V terminfo after SVr1, and have added extension +capabilities to the string table that (in the binary format) collide with +System V and XSI Curses extensions. See \fBterminfo\fR(\*n) for detailed +discussion of terminfo source compatibility issues. +.PP +As an example, here is a hex dump of the description for the Lear-Siegler +ADM-3, a popular though rather stupid early terminal: +.nf +.sp +adm3a|lsi adm3a, + am, + cols#80, lines#24, + bel=^G, clear=\032$<1>, cr=^M, cub1=^H, cud1=^J, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + home=^^, ind=^J, +.sp +.ft CW +\s-20000 1a 01 10 00 02 00 03 00 82 00 31 00 61 64 6d 33 ........ ..1.adm3 +0010 61 7c 6c 73 69 20 61 64 6d 33 61 00 00 01 50 00 a|lsi ad m3a...P. +0020 ff ff 18 00 ff ff 00 00 02 00 ff ff ff ff 04 00 ........ ........ +0030 ff ff ff ff ff ff ff ff 0a 00 25 00 27 00 ff ff ........ ..%.'... +0040 29 00 ff ff ff ff 2b 00 ff ff 2d 00 ff ff ff ff ).....+. ..-..... +0050 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........ +0060 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........ +0070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........ +0080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........ +0090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........ +00a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........ +00b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........ +00c0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........ +00d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........ +00e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........ +00f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........ +0100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........ +0110 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........ +0120 ff ff ff ff ff ff 2f 00 07 00 0d 00 1a 24 3c 31 ....../. .....$<1 +0130 3e 00 1b 3d 25 70 31 25 7b 33 32 7d 25 2b 25 63 >..=%p1% {32}%+%c +0140 25 70 32 25 7b 33 32 7d 25 2b 25 63 00 0a 00 1e %p2%{32} %+%c.... +0150 00 08 00 0c 00 0b 00 0a 00 ........ .\s+2 +.ft R +.fi +.sp +.PP +Some limitations: total compiled entries cannot exceed 4096 bytes. +The name field cannot exceed 128 bytes. +.SH FILES +\*d/*/* compiled terminal capability data base +.SH "SEE ALSO" +curses(3X), terminfo(\*n). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/term.7 b/man/term.7 new file mode 100644 index 00000000..9d0f6d35 --- /dev/null +++ b/man/term.7 @@ -0,0 +1,175 @@ +.TH TERM 7 +.ds n 5 +.ds d @DATADIR@/terminfo +.SH NAME +term \- conventions for naming terminal types +.SH DESCRIPTION +.PP +The environment variable \fBTERM\fR should normally contain the type name of +the terminal, console or display-device type you are using. This information +is critical for all screen-oriented programs, including your editor and mailer. +.PP +A default \fBTERM\fR value will be set on a per-line basis by either +\fB/etc/inittab\fR (Linux and System-V-like UNIXes) or \fB/etc/ttys\fR (BSD +UNIXes). This will nearly always suffice for workstation and microcomputer +consoles. +.PP +If you use a dialup line, the type of device attached to it may vary. Older +UNIX systems pre-set a very dumb terminal type like `dumb' or `dialup' on +dialup lines. Newer ones may pre-set `vt100', reflecting the prevalence of DEC +VT100-compatible terminals and personal-computer emulators. +.PP +Modern telnets pass your \fBTERM\fR environment variable from the local side to +the remote one. There can be problems if the remote terminfo or termcap entry +for your type is not compatible with yours, but this situation is rare and +can almost always be avoided by explicitly exporting `vt100' (assuming you +are in fact using a VT100-superset console, terminal, or terminal emulator.) +.PP +In any case, you are free to override the system \fBTERM\fR setting to your +taste in your shell profile. The \fBtset\fB(1) utility may be of assistance; +you can give it a set of rules for deducing or requesting a terminal type based +on the tty device and baud rate. +.PP +Setting your own \fBTERM\fR value may also be useful if you have created a +custom entry incorporating options (such as visual bell or reverse-video) +which you wish to override the system default type for your line. +.PP +Terminal type descriptions are stored as files of capability data underneath +\*d. To browse a list of all terminal names recognized by the system, do + + toe | more + +from your shell. These capability files are in a binary format optimized for +retrieval speed (unlike the old text-based \fBtermcap\fR format they replace); +to examine an entry, you must use the \fBinfocmp\fR(1) command. Invoke it as +follows: + + infocmp \fIentry-name\fR + +where \fIentry-name\fR is the name of the type you wish to examine (and the +name of its capability file the subdirectory of \*d named for its first +letter). This command dumps a capability file in the text format described by +\fBterminfo\fR(\*n). +.PP +The first line of a \fBterminfo\fR(\*n) description gives the names by which +terminfo knows a terminal, separated by `|' (pipe-bar) characters with the last +name field terminated by a comma. The first name field is the type's +\fIprimary name\fR, and is the one to use when setting \fBTERM\fR. The last +name field (if distinct from the first) is actually a description of the +terminal type (it may contain blanks; the others must be single words). Name +fields between the first and last (if present) are aliases for the terminal, +usually historical names retained for compatibility. +.PP +There are some conventions for how to choose terminal primary names that help +keep them informative and unique. Here is a step-by-step guide to naming +terminals that also explains how to parse them: +.PP +First, choose a root name. The root will consist of a lower-case letter +followed by up to seven lower-case letters or digits. You need to avoid using +punctuation characters in root names, because they are used and interpreted as +filenames and shell meta-characters (such as !, $, *, ? etc.) embedded in them +may cause odd and unhelpful behavior. The slash (/), or any other character +that may be interpreted by anyone's file system (\e, $, [, ]), is especially +dangerous (terminfo is platform-independent, and choosing names with special +characters could someday make life difficult for users of a future port). The +dot (.) character is relatively safe as long as there is at most one per root +name; some historical terminfo names use it. +.PP +The root name for a terminal or workstation console type should almost always +begin with a vendor prefix (such as \fBhp\fR for Hewlett-Packard, \fBwy\fR for +Wyse, or \fBatt\fR for AT&T terminals), or a common name of the terminal line +(\fBvt\fR for the VT series of terminals from DEC, or \fBsun\fR for Sun +Microsystems workstation consoles, or \fBregent\fR for the ADDS Regent series. +You can list the terminfo tree to see what prefixes are already in common use. +The root name prefix should be followed when appropriate by a model number; +thus \fBvt100\fR, \fBhp2621\fR, \fBwy50\fR. +.PP +The root name for a PC-Unix console type should be the OS name, +i.e. \fBlinux\fR, \fBbsdos\fR, \fBfreebsd\fB, \fBnetbsd\fR. It should +\fInot\fR be \fBconsole\fR or any other generic that might cause confusion in a +multi-platform environment! If a model number follows, it should indicate +either the OS release level or the console driver release level. +.PP +The root name for a terminal emulator (assuming it doesn't fit one of the +standard ANSI or vt100 types) should be the program name or a readily +recognizable abbreviation of it (i.e. \fBversaterm\fR, \fBctrm\fR). +.PP +Following the root name, you may add any reasonable number of hyphen-separated +feature suffixes. +.TP 5 +2p +Has two pages of memory. Likewise 4p, 8p, etc. +.TP 5 +mc +Magic-cookie. Some terminals (notably older Wyses) can only support one +attribute without magic-cookie lossage. Their base entry is usually paired +with another that has this suffix and uses magic cookies to support multiple +attributes. +.TP 5 +-am +Enable auto-margin (right-margin wraparound) +.TP 5 +-m +Mono mode - suppress color support +.TP 5 +-na +No arrow keys - termcap ignores arrow keys which are actually there on the +terminal, so the user can use the arrow keys locally. +.TP 5 +-nam +No auto-margin - suppress am capability +.TP 5 +-nl +No labels - suppress soft labels +.TP 5 +-nsl +No status line - suppress status line +.TP 5 +-pp +Has a printer port which is used. +.TP 5 +-rv +Terminal in reverse video mode (black on white) +.TP 5 +-s +Enable status line. +.TP 5 +-vb +Use visible bell (flash) rather than beep. +.TP 5 +-w +Wide; terminal is in 132 column mode. +.PP +Conventionally, if your terminal type is a variant intended to specify a +line height, that suffix should go first. So, for a hypothetical FuBarCo +model 2317 terminal in 30-line mode with reverse video, best form would be +\fBfubar-30-rv\fR (rather than, say, `fubar-rv-30'). +.PP +Terminal types that are written not as standalone entries, but rather as +components to be plugged into other entries via \fBuse\fB capabilities, +are distinguished by using embedded plus signs rather than dashes. +.PP +Commands which use a terminal type to control display often accept a -T +option that accepts a terminal name argument. Such programs should fall back +on the \fBTERM\fR environment variable when no -T option is specified. +.SH PORTABILITY +For maximum compatibility with older System V UNIXes, names and aliases +should be unique within the first 14 characters. +.SH FILES +.TP 5 +\*d/?/* +compiled terminal capability data base +.TP 5 +/etc/inittab +tty line initialization (AT&T-like UNIXes). +.TP 5 +/etc/ttys +tty line initialization (BSD-like UNIXes). +.SH "SEE ALSO" +curses(3X), terminfo(\*n), term(\*d). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/terminfo.head b/man/terminfo.head new file mode 100644 index 00000000..b024f578 --- /dev/null +++ b/man/terminfo.head @@ -0,0 +1,67 @@ +.\" $Id: terminfo.head,v 1.6 1997/01/05 01:03:16 tom Exp $ +.TH TERMINFO 5 "" "" "File Formats" +.ds n 5 +.ds d @DATADIR@/terminfo +.SH NAME +terminfo \- terminal capability data base +.SH SYNOPSIS +\*d/*/* +.SH DESCRIPTION +.I Terminfo +is a data base describing terminals, used by screen-oriented programs such as +.IR nvi (1), +.IR rogue (1) +and libraries such as +.IR curses (3X). +.I Terminfo +describes terminals by giving a set of capabilities which they +have, by specifying how to perform screen operations, and by +specifying padding requirements and initialization sequences. +.PP +Entries in +.I terminfo +consist of a sequence of `,' separated fields (embedded commas may be +escaped with a backslash or notated as \e072). +White space after the `,' separator is ignored. +The first entry for each terminal gives the names which are known for the +terminal, separated by `|' characters. +The first name given is the most common abbreviation for the terminal, +the last name given should be a long name fully identifying the terminal, +and all others are understood as synonyms for the terminal name. +All names but the last should be in lower case and contain no blanks; +the last name may well contain upper case and blanks for readability. +.PP +Terminal names (except for the last, verbose entry) should +be chosen using the following conventions. +The particular piece of hardware making up the terminal should +have a root name, thus ``hp2621''. +This name should not contain hyphens. +Modes that the hardware can be in, or user preferences, should +be indicated by appending a hyphen and a mode suffix. +Thus, a vt100 in 132 column mode would be vt100-w. +The following suffixes should be used where possible: +.PP +.TS +center ; +l c l +l l l. +\fBSuffix Meaning Example\fP +-\fInn\fP Number of lines on the screen aaa-60 +-\fIn\fPp Number of pages of memory c100-4p +-am With automargins (usually the default) vt100-am +-m Mono mode; suppress color ansi-m +-mc Magic cookie; spaces when highlighting wy30-mc +-na No arrow keys (leave them in local) c100-na +-nam Without automatic margins vt100-nam +-nl No status line att4415-nl +-ns No status line hp2626-ns +-rv Reverse video c100-rv +-s Enable status line vt100-s +-vb Use visible bell instead of beep wy370-vb +-w Wide mode (> 80 columns, usually 132) vt100-w +.TE +.PP +For more on terminal naming conventions, see the \fBterm(7)\fR manual page. +.SS Capabilities +.\" Head of terminfo man page ends here +.ps -1 diff --git a/man/terminfo.tail b/man/terminfo.tail new file mode 100644 index 00000000..5101ec3b --- /dev/null +++ b/man/terminfo.tail @@ -0,0 +1,1387 @@ +.\" $Id: terminfo.tail,v 1.12 1996/09/21 23:23:19 tom Exp $ +.\" Beginning of terminfo.tail file +.ps +1 +.PP +.SS A Sample Entry +.PP +The following entry, describing an ANSI-standard terminal, is representative +of what a \fBterminfo\fR entry for a modern terminal typically looks like. +.PP +.nf +.in -2 +.ta .3i +.ft CW +\s-2ansi|ansi/pc-term compatible with color, + mc5i, + colors#8, ncv#3, pairs#64, + cub=\\E[%p1%dD, cud=\\E[%p1%dB, cuf=\\E[%p1%dC, + cuu=\\E[%p1%dA, dch=\\E[%p1%dP, dl=\\E[%p1%dM, + ech=\\E[%p1%dX, el1=\\E[1K, hpa=\\E[%p1%dG, ht=\\E[I, + ich=\\E[%p1%d@, il=\\E[%p1%dL, indn=\\E[%p1%dS, + kbs=^H, kcbt=\\E[Z, kcub1=\\E[D, kcud1=\\E[B, + kcuf1=\\E[C, kcuu1=\\E[A, kf1=\\E[M, kf10=\\E[V, + kf11=\\E[W, kf12=\\E[X, kf2=\\E[N, kf3=\\E[O, kf4=\\E[P, + kf5=\\E[Q, kf6=\\E[R, kf7=\\E[S, kf8=\\E[T, kf9=\\E[U, + kich1=\\E[L, mc4=\\E[4i, mc5=\\E[5i, nel=\\r\\E[S, + op=\\E[37;40m, rep=%p1%c\\E[%p2%{1}%-%db, + rin=\\E[%p1%dT, s0ds=\\E(B, s1ds=\\E)B, s2ds=\\E*B, + s3ds=\\E+B, setab=\\E[4%p1%dm, setaf=\\E[3%p1%dm, + setb=\\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, + setf=\\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, + sgr=\\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p8%t;11%;%?%p9%t;12%;m, + sgr0=\\E[0;10m, tbc=\\E[2g, u6=\\E[%d;%dR, u7=\\E[6n, + u8=\\E[?%[;0123456789]c, u9=\\E[c, vpa=\\E[%p1%dd,\s+2 +.in +2 +.fi +.ft R +.PP +Entries may continue onto multiple lines by placing white space at +the beginning of each line except the first. +Comments may be included on lines beginning with ``#''. +Capabilities in +.I terminfo +are of three types: +Boolean capabilities which indicate that the terminal has +some particular feature, numeric capabilities giving the size of the terminal +or the size of particular delays, and string +capabilities, which give a sequence which can be used to perform particular +terminal operations. +.PP +.SS Types of Capabilities +.PP +All capabilities have names. For instance, the fact that +ANSI-standard terminals have +.I "automatic margins" +(i.e., an automatic return and line-feed +when the end of a line is reached) is indicated by the capability \fBam\fR. +Hence the description of ansi includes \fBam\fR. +Numeric capabilities are followed by the character `#' and then the value. +Thus \fBcols\fR, which indicates the number of columns the terminal has, +gives the value `80' for ansi. +.PP +Finally, string valued capabilities, such as \fBel\fR (clear to end of line +sequence) are given by the two-character code, an `=', and then a string +ending at the next following `,'. +.PP +A number of escape sequences are provided in the string valued capabilities +for easy encoding of characters there. Both \fB\eE\fR and \fB\ee\fR +map to an \s-1ESCAPE\s0 character, +\fB^x\fR maps to a control-x for any appropriate x, and the sequences +\fB\en \el \er \et \eb \ef \es\fR give +a newline, line-feed, return, tab, backspace, form-feed, and space. +Other escapes include \fB\e^\fR for \fB^\fR, +\fB\e\e\fR for \fB\e\fR, +\fB\e\fR, for comma, +\fB\e:\fR for \fB:\fR, +and \fB\e0\fR for null. +(\fB\e0\fR will produce \e200, which does not terminate a string but behaves +as a null character on most terminals.) +Finally, characters may be given as three octal digits after a \fB\e\fR. +.PP +A delay in milliseconds may appear anywhere in a string capability, enclosed in +$<..> brackets, as in \fBel\fP=\eEK$<5>, and padding characters are supplied by +.I tputs +to provide this delay. The delay must be a number with at most one decimal +place of precision; it may be followed by suffixes `*' or '/' or both. A `*' +indicates that the padding required is proportional to the number of lines +affected by the operation, and the amount given is the per-affected-unit +padding required. (In the case of insert character, the factor is still the +number of +.IR lines +affected.) Normally, padding is advisory if the device has the \fBxon\fR +capability; it is used for cost computation but does not trigger delays. A `/' +suffix indicates that the padding is mandatory and forces a delay of the given +number of milliseconds even on devices for which \fBxon\fR is present to +indicate flow control. +.PP +Sometimes individual capabilities must be commented out. +To do this, put a period before the capability name. +For example, see the second +.B ind +in the example above. +.br +.ne 5 +.PP +.SS Fetching Compiled Descriptions +.PP +If the environment variable TERMINFO is set, it is interpreted as the pathname +of a directory containing the compiled description you are working on. Only +that directory is searched. +.PP +If TERMINFO is not set, the \fBncurses\fR version of the terminfo reader code +will instead look in the directory \fB$HOME/.terminfo\fR +for a compiled description. +If it fails to find one there, and the environment variable TERMINFO_DIRS is +set, it will interpret the contents of that variable as a list of colon- +separated directories to be searched (an empty entry is interpreted as a +command to search \fI\*d\fR). If no description is found in any of the +TERMINFO_DIRS directories, the fetch fails. +.PP +If neither TERMINFO nor TERMINFO_DIRS is set, the last place tried will be the +system terminfo directory, \fI\*d\fR. +.PP +(Neither the \fB$HOME/.terminfo\fR lookups nor TERMINFO_DIRS extensions are +supported under stock System V terminfo/curses.) +.PP +.SS Preparing Descriptions +.PP +We now outline how to prepare descriptions of terminals. +The most effective way to prepare a terminal description is by imitating +the description of a similar terminal in +.I terminfo +and to build up a description gradually, using partial descriptions +with +.I vi +or some other screen-oriented program to check that they are correct. +Be aware that a very unusual terminal may expose deficiencies in +the ability of the +.I terminfo +file to describe it +or bugs in the screen-handling code of the test program. +.PP +To get the padding for insert line right (if the terminal manufacturer +did not document it) a severe test is to edit /etc/passwd at 9600 baud, +delete 16 or so lines from the middle of the screen, then hit the `u' +key several times quickly. +If the terminal messes up, more padding is usually needed. +A similar test can be used for insert character. +.PP +.SS Basic Capabilities +.PP +The number of columns on each line for the terminal is given by the +\fBcols\fR numeric capability. If the terminal is a \s-1CRT\s0, then the +number of lines on the screen is given by the \fBlines\fR capability. +If the terminal wraps around to the beginning of the next line when +it reaches the right margin, then it should have the \fBam\fR capability. +If the terminal can clear its screen, leaving the cursor in the home +position, then this is given by the \fBclear\fR string capability. +If the terminal overstrikes +(rather than clearing a position when a character is struck over) +then it should have the \fBos\fR capability. +If the terminal is a printing terminal, with no soft copy unit, +give it both +.B hc +and +.BR os . +.RB ( os +applies to storage scope terminals, such as \s-1TEKTRONIX\s+1 4010 +series, as well as hard copy and APL terminals.) +If there is a code to move the cursor to the left edge of the current +row, give this as +.BR cr . +(Normally this will be carriage return, control M.) +If there is a code to produce an audible signal (bell, beep, etc) +give this as +.BR bel . +.PP +If there is a code to move the cursor one position to the left +(such as backspace) that capability should be given as +.BR cub1 . +Similarly, codes to move to the right, up, and down should be +given as +.BR cuf1 , +.BR cuu1 , +and +.BR cud1 . +These local cursor motions should not alter the text they pass over, +for example, you would not normally use `\fBcuf1\fP=\ ' because the +space would erase the character moved over. +.PP +A very important point here is that the local cursor motions encoded +in +.I terminfo +are undefined at the left and top edges of a \s-1CRT\s0 terminal. +Programs should never attempt to backspace around the left edge, +unless +.B bw +is given, +and never attempt to go up locally off the top. +In order to scroll text up, a program will go to the bottom left corner +of the screen and send the +.B ind +(index) string. +.PP +To scroll text down, a program goes to the top left corner +of the screen and sends the +.B ri +(reverse index) string. +The strings +.B ind +and +.B ri +are undefined when not on their respective corners of the screen. +.PP +Parameterized versions of the scrolling sequences are +.B indn +and +.B rin +which have the same semantics as +.B ind +and +.B ri +except that they take one parameter, and scroll that many lines. +They are also undefined except at the appropriate edge of the screen. +.PP +The \fBam\fR capability tells whether the cursor sticks at the right +edge of the screen when text is output, but this does not necessarily +apply to a +.B cuf1 +from the last column. +The only local motion which is defined from the left edge is if +.B bw +is given, then a +.B cub1 +from the left edge will move to the right edge of the previous row. +If +.B bw +is not given, the effect is undefined. +This is useful for drawing a box around the edge of the screen, for example. +If the terminal has switch selectable automatic margins, +the +.I terminfo +file usually assumes that this is on; i.e., \fBam\fR. +If the terminal has a command which moves to the first column of the next +line, that command can be given as +.B nel +(newline). +It does not matter if the command clears the remainder of the current line, +so if the terminal has no +.B cr +and +.B lf +it may still be possible to craft a working +.B nel +out of one or both of them. +.PP +These capabilities suffice to describe hard-copy and \*(lqglass-tty\*(rq terminals. +Thus the model 33 teletype is described as +.PP +.DT +.nf +.ft CW +.in -7 + \s-133\||\|tty33\||\|tty\||\|model 33 teletype, + bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,\s+1 +.in +7 +.ft R +.PP +while the Lear Siegler \s-1ADM\-3\s0 is described as +.PP +.DT +.nf +.ft CW +.in -7 + \s-1adm3\||\|3\||\|lsi adm3, + am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J, + ind=^J, lines#24,\s+1 +.in +7 +.ft R +.fi +.PP +.SS Parameterized Strings +.PP +Cursor addressing and other strings requiring parameters +in the terminal are described by a +parameterized string capability, with +.IR printf (3S) +like escapes \fB%x\fR in it. +For example, to address the cursor, the +.B cup +capability is given, using two parameters: +the row and column to address to. +(Rows and columns are numbered from zero and refer to the +physical screen visible to the user, not to any unseen memory.) +If the terminal has memory relative cursor addressing, +that can be indicated by +.BR mrcup . +.PP +The parameter mechanism uses a stack and special \fB%\fP codes +to manipulate it. Typically a sequence will push one of the +parameters onto the stack and then print it in some format. +Often more complex operations are necessary. +.PP +The \fB%\fR encodings have the following meanings: +.PP +.DT +.nf +.ta .5i 1.5i + \s-1%% outputs `%' + %d print pop() as in printf + %2d print pop() like %2d + %3d print pop() like %3d + %02d + %03d as in printf + %x print pop() as in printf + %2x print pop() like %2x + %3x print pop() like %3x + %02x + %03x as in printf + %c print pop() gives %c + %s print pop() gives %s + + %p[1-9] push i'th parm + %P[a-z] set variable [a-z] to pop() + %g[a-z] get variable [a-z] and push it + %'c' char constant c + %{nn} integer constant nn + + %+ %- %* %/ %m + arithmetic (%m is mod): push(pop() op pop()) + %& %| %^ bit operations: push(pop() op pop()) + %= %> %< logical operations: push(pop() op pop()) + %A, %O logical and & or operations (for conditionals) + %! %~ unary operations push(op pop()) + %i add 1 to first two parms (for ANSI terminals) + + %? expr %t thenpart %e elsepart %; + if-then-else, %e elsepart is optional. + else-if's are possible a la Algol 68: + %? c\d1\u %t b\d1\u %e c\d2\u %t b\d2\u %e c\d3\u %t b\d3\u %e c\d4\u %t b\d4\u %e %; +\s+1 c\di\u are conditions, b\di\u are bodies. +.fi +.PP +Binary operations are in postfix form with the operands in the usual order. +That is, to get x-5 one would use "%gx%{5}%-". %P and %g variables are +persistent across escape-string evaluations. +.PP +Consider the HP2645, which, to get to row 3 and column 12, needs +to be sent \eE&a12c03Y padded for 6 milliseconds. Note that the order +of the rows and columns is inverted here, and that the row and column +are printed as two digits. +Thus its \fBcup\fR capability is \*(lqcup=6\eE&%p2%2dc%p1%2dY\*(rq. +.PP +The Microterm \s-1ACT-IV\s0 needs the current row and column sent +preceded by a \fB^T\fR, with the row and column simply encoded in binary, +\*(lqcup=^T%p1%c%p2%c\*(rq. +Terminals which use \*(lq%c\*(rq need to be able to +backspace the cursor (\fBcub1\fR), +and to move the cursor up one line on the screen (\fBcuu1\fR). +This is necessary because it is not always safe to transmit \fB\en\fR +\fB^D\fR and \fB\er\fR, as the system may change or discard them. +(The library routines dealing with terminfo set tty modes so that +tabs are never expanded, so \et is safe to send. +This turns out to be essential for the Ann Arbor 4080.) +.PP +A final example is the \s-1LSI ADM\s0-3a, which uses row and column +offset by a blank character, thus \*(lqcup=\eE=%p1%' '%+%c%p2%' '%+%c\*(rq. +After sending `\eE=', this pushes the first parameter, pushes the +ASCII value for a space (32), adds them (pushing the sum on the stack +in place of the two previous values) and outputs that value as a character. +Then the same is done for the second parameter. +More complex arithmetic is possible using the stack. +.PP +If the terminal has row or column absolute cursor addressing, +these can be given as single parameter capabilities +.B hpa +(horizontal position absolute) +and +.B vpa +(vertical position absolute). +Sometimes these are shorter than the more general two parameter +sequence (as with the hp2645) and can be used in preference to +.B cup . +If there are parameterized local motions (e.g., move +.I n +spaces to the right) these can be given as +.BR cud , +.BR cub , +.BR cuf , +and +.BR cuu +with a single parameter indicating how many spaces to move. +These are primarily useful if the terminal does not have +.BR cup , +such as the \s-1TEKTRONIX\s+1 4025. +.PP +.SS Cursor Motions +.PP +If the terminal has a fast way to home the cursor +(to very upper left corner of screen) then this can be given as +\fBhome\fR; similarly a fast way of getting to the lower left-hand corner +can be given as \fBll\fR; this may involve going up with \fBcuu1\fR +from the home position, +but a program should never do this itself (unless \fBll\fR does) because it +can make no assumption about the effect of moving up from the home position. +Note that the home position is the same as addressing to (0,0): +to the top left corner of the screen, not of memory. +(Thus, the \eEH sequence on HP terminals cannot be used for +.BR home .) +.PP +.SS Area Clears +.PP +If the terminal can clear from the current position to the end of the +line, leaving the cursor where it is, this should be given as \fBel\fR. +If the terminal can clear from the current position to the end of the +display, then this should be given as \fBed\fR. +\fBEd\fR is only defined from the first column of a line. +(Thus, it can be simulated by a request to delete a large number of lines, +if a true +.B ed +is not available.) +.PP +.SS Insert/delete line and vertical motions +.PP +If the terminal can open a new blank line before the line where the cursor +is, this should be given as \fBil1\fR; this is done only from the first +position of a line. The cursor must then appear on the newly blank line. +If the terminal can delete the line which the cursor is on, then this +should be given as \fBdl1\fR; this is done only from the first position on +the line to be deleted. +Versions of +.B il1 +and +.B dl1 +which take a single parameter and insert or delete that many lines can +be given as +.B il +and +.BR dl . +If the terminal has a settable scrolling region (like the vt100) +the command to set this can be described with the +.B csr +capability, which takes two parameters: +the top and bottom lines of the scrolling region. +The cursor position is, alas, undefined after using this command. +.PP +It is possible to get the effect of insert or delete line using +.B csr +on a properly chosen region; the +.B sc +and +.B rc +(save and restore cursor) commands may be useful for ensuring that +your synthesized insert/delete string does not move the cursor. +(Note that the \fBncurses\fR\fR(3x) library does this synthesis +automatically, so you need not compose insert/delete strings for +an entry with \fBcsr\fR). +.PP +Yet another way to construct insert and delete might be to use a combination of +index with the memory-lock feature found on some terminals (like the HP-700/90 +series, which however also has insert/delete). +.PP +Inserting lines at the top or bottom of the screen can also be +done using +.B ri +or +.B ind +on many terminals without a true insert/delete line, +and is often faster even on terminals with those features. +.PP +The boolean \fBnon_dest_scroll_region\fR should be set if each scrolling +window is effectively a view port on a screen-sized canvas. To test for +this capability, create a scrolling region in the middle of the screen, +write something to the bottom line, move the cursor to the top of the region, +and do \fBri\fR followed by \fBdl1\fR or \fBind\fR. If the data scrolled +off the bottom of the region by the \fBri\fR re-appears, then scrolling +is non-destructive. System V and XSI Curses expect that \fBind\fR, \fBri\fR, +\fBindn\fR, and \fBrin\fR will simulate destructive scrolling; their +documentation cautions you not to define \fBcsr\fR unless this is true. +This \fBcurses\fR implementation is more liberal and will do explicit erases +after scrolling if \fBndstr\fR is defined. +.PP +If the terminal has the ability to define a window as part of +memory, which all commands affect, +it should be given as the parameterized string +.BR wind . +The four parameters are the starting and ending lines in memory +and the starting and ending columns in memory, in that order. +.PP +If the terminal can retain display memory above, then the +\fBda\fR capability should be given; if display memory can be retained +below, then \fBdb\fR should be given. These indicate +that deleting a line or scrolling may bring non-blank lines up from below +or that scrolling back with \fBri\fR may bring down non-blank lines. +.PP +.SS Insert/Delete Character +.PP +There are two basic kinds of intelligent terminals with respect to +insert/delete character which can be described using +.I terminfo. +The most common insert/delete character operations affect only the characters +on the current line and shift characters off the end of the line rigidly. +Other terminals, such as the Concept 100 and the Perkin Elmer Owl, make +a distinction between typed and untyped blanks on the screen, shifting +upon an insert or delete only to an untyped blank on the screen which is +either eliminated, or expanded to two untyped blanks. You can determine the +kind of terminal you have by clearing the screen and then typing +text separated by cursor motions. Type \*(lqabc\ \ \ \ def\*(rq using local +cursor motions (not spaces) between the \*(lqabc\*(rq and the \*(lqdef\*(rq. +Then position the cursor before the \*(lqabc\*(rq and put the terminal in insert +mode. If typing characters causes the rest of the line to shift +rigidly and characters to fall off the end, then your terminal does +not distinguish between blanks and untyped positions. If the \*(lqabc\*(rq +shifts over to the \*(lqdef\*(rq which then move together around the end of the +current line and onto the next as you insert, you have the second type of +terminal, and should give the capability \fBin\fR, which stands for +\*(lqinsert null\*(rq. +While these are two logically separate attributes (one line vs. multi-line +insert mode, and special treatment of untyped spaces) we have seen no +terminals whose insert mode cannot be described with the single attribute. +.PP +Terminfo can describe both terminals which have an insert mode, and terminals +which send a simple sequence to open a blank position on the current line. +Give as \fBsmir\fR the sequence to get into insert mode. +Give as \fBrmir\fR the sequence to leave insert mode. +Now give as \fBich1\fR any sequence needed to be sent just before sending +the character to be inserted. Most terminals with a true insert mode +will not give \fBich1\fR; terminals which send a sequence to open a screen +position should give it here. +.PP +If your terminal has both, insert mode is usually preferable to \fBich1\fR. +Technically, you should not give both unless the terminal actually requires +both to be used in combination. Accordingly, some non-curses applications get +confused if both are present; the symptom is doubled characters in an update +using insert. This requirement is now rare; most \fBich\fR sequences do not +require previous smir, and most smir insert modes do not require \fBich1\fR +before each character. Therefore, the new \fBcurses\fR actually assumes this +is the case and uses either \fBrmir\fR/\fBsmir\fR or \fBich\fR/\fBich1\fR as +appropriate (but not both). If you have to write an entry to be used under +new curses for a terminal old enough to need both, include the +\fBrmir\fR/\fBsmir\fR sequences in \fBich1\fR. +.PP +If post insert padding is needed, give this as a number of milliseconds +in \fBip\fR (a string option). Any other sequence which may need to be +sent after an insert of a single character may also be given in \fBip\fR. +If your terminal needs both to be placed into an `insert mode' and +a special code to precede each inserted character, then both +.BR smir / rmir +and +.B ich1 +can be given, and both will be used. +The +.B ich +capability, with one parameter, +.IR n , +will repeat the effects of +.B ich1 +.I n +times. +.PP +It is occasionally necessary to move around while in insert mode +to delete characters on the same line (e.g., if there is a tab after +the insertion position). If your terminal allows motion while in +insert mode you can give the capability \fBmir\fR to speed up inserting +in this case. Omitting \fBmir\fR will affect only speed. Some terminals +(notably Datamedia's) must not have \fBmir\fR because of the way their +insert mode works. +.PP +Finally, you can specify +.B dch1 +to delete a single character, +.B dch +with one parameter, +.IR n , +to delete +.I n characters, +and delete mode by giving \fBsmdc\fR and \fBrmdc\fR +to enter and exit delete mode (any mode the terminal needs to be placed +in for +.B dch1 +to work). +.PP +A command to erase +.I n +characters (equivalent to outputting +.I n +blanks without moving the cursor) +can be given as +.B ech +with one parameter. +.PP +.SS "Highlighting, Underlining, and Visible Bells" +.PP +If your terminal has one or more kinds of display attributes, +these can be represented in a number of different ways. +You should choose one display form as +\f2standout mode\fR, +representing a good, high contrast, easy-on-the-eyes, +format for highlighting error messages and other attention getters. +(If you have a choice, reverse video plus half-bright is good, +or reverse video alone.) +The sequences to enter and exit standout mode +are given as \fBsmso\fR and \fBrmso\fR, respectively. +If the code to change into or out of standout +mode leaves one or even two blank spaces on the screen, +as the TVI 912 and Teleray 1061 do, +then \fBxmc\fR should be given to tell how many spaces are left. +.PP +Codes to begin underlining and end underlining can be given as \fBsmul\fR +and \fBrmul\fR respectively. +If the terminal has a code to underline the current character and move +the cursor one space to the right, +such as the Microterm Mime, +this can be given as \fBuc\fR. +.PP +Other capabilities to enter various highlighting modes include +.B blink +(blinking) +.B bold +(bold or extra bright) +.B dim +(dim or half-bright) +.B invis +(blanking or invisible text) +.B prot +(protected) +.B rev +(reverse video) +.B sgr0 +(turn off +.I all +attribute modes) +.B smacs +(enter alternate character set mode) +and +.B rmacs +(exit alternate character set mode). +Turning on any of these modes singly may or may not turn off other modes. +.PP +If there is a sequence to set arbitrary combinations of modes, +this should be given as +.B sgr +(set attributes), +taking 9 parameters. +Each parameter is either 0 or 1, as the corresponding attribute is on or off. +The 9 parameters are, in order: +standout, underline, reverse, blink, dim, bold, blank, protect, alternate +character set. +Not all modes need be supported by +.BR sgr , +only those for which corresponding separate attribute commands exist. +.PP +Terminals with the ``magic cookie'' glitch +.RB ( xmc ) +deposit special ``cookies'' when they receive mode-setting sequences, +which affect the display algorithm rather than having extra bits for +each character. +Some terminals, such as the HP 2621, automatically leave standout +mode when they move to a new line or the cursor is addressed. +Programs using standout mode should exit standout mode before +moving the cursor or sending a newline, +unless the +.B msgr +capability, asserting that it is safe to move in standout mode, is present. +.PP +If the terminal has +a way of flashing the screen to indicate an error quietly (a bell replacement) +then this can be given as \fBflash\fR; it must not move the cursor. +.PP +If the cursor needs to be made more visible than normal when it is +not on the bottom line (to make, for example, a non-blinking underline into an +easier to find block or blinking underline) +give this sequence as +.BR cvvis . +If there is a way to make the cursor completely invisible, give that as +.BR civis . +The capability +.BR cnorm +should be given which undoes the effects of both of these modes. +.PP +If the terminal needs to be in a special mode when running +a program that uses these capabilities, +the codes to enter and exit this mode can be given as \fBsmcup\fR and \fBrmcup\fR. +This arises, for example, from terminals like the Concept with more than +one page of memory. +If the terminal has only memory relative cursor addressing and not screen +relative cursor addressing, a one screen-sized window must be fixed into +the terminal for cursor addressing to work properly. +This is also used for the \s-1TEKTRONIX\s+1 4025, +where +.B smcup +sets the command character to be the one used by terminfo. +.PP +If your terminal correctly generates underlined characters +(with no special codes needed) +even though it does not overstrike, +then you should give the capability \fBul\fR. +If overstrikes are erasable with a blank, +then this should be indicated by giving \fBeo\fR. +.PP +.SS Keypad Handling +.PP +If the terminal has a keypad that transmits codes when the keys are pressed, +this information can be given. Note that it is not possible to handle +terminals where the keypad only works in local (this applies, for example, +to the unshifted HP 2621 keys). +If the keypad can be set to transmit or not transmit, +give these codes as \fBsmkx\fR and \fBrmkx\fR. +Otherwise the keypad is assumed to always transmit. +The codes sent by the left arrow, right arrow, up arrow, down arrow, +and home keys can be given as \fBkcub1, kcuf1, kcuu1, kcud1, +\fRand\fB khome\fR respectively. +If there are function keys such as f0, f1, ..., f10, the codes they send +can be given as \fBkf0, kf1, ..., kf10\fR. +If these keys have labels other than the default f0 through f10, the labels +can be given as \fBlf0, lf1, ..., lf10\fR. +The codes transmitted by certain other special keys can be given: +.B kll +(home down), +.B kbs +(backspace), +.B ktbc +(clear all tabs), +.B kctab +(clear the tab stop in this column), +.B kclr +(clear screen or erase key), +.B kdch1 +(delete character), +.B kdl1 +(delete line), +.B krmir +(exit insert mode), +.B kel +(clear to end of line), +.B ked +(clear to end of screen), +.B kich1 +(insert character or enter insert mode), +.B kil1 +(insert line), +.B knp +(next page), +.B kpp +(previous page), +.B kind +(scroll forward/down), +.B kri +(scroll backward/up), +.B khts +(set a tab stop in this column). +In addition, if the keypad has a 3 by 3 array of keys including the four +arrow keys, the other five keys can be given as +.BR ka1 , +.BR ka3 , +.BR kb2 , +.BR kc1 , +and +.BR kc3 . +These keys are useful when the effects of a 3 by 3 directional pad are needed. +.PP +.SS Tabs and Initialization +.PP +If the terminal has hardware tabs, the command to advance to the next +tab stop can be given as +.B ht +(usually control I). +A ``back-tab'' command which moves leftward to the next tab stop can +be given as +.BR cbt . +By convention, if the teletype modes indicate that tabs are being +expanded by the computer rather than being sent to the terminal, +programs should not use +.B ht +or +.B cbt +even if they are present, since the user may not have the tab stops +properly set. +If the terminal has hardware tabs which are initially set every +.I n +spaces when the terminal is powered up, +the numeric parameter +.B it +is given, showing the number of spaces the tabs are set to. +This is normally used by the +.IR tset +command to determine whether to set the mode for hardware tab expansion, +and whether to set the tab stops. +If the terminal has tab stops that can be saved in non-volatile memory, +the terminfo description can assume that they are properly set. +.PP +Other capabilities +include +.BR is1 , +.BR is2 , +and +.BR is3 , +initialization strings for the terminal, +.BR iprog , +the path name of a program to be run to initialize the terminal, +and \fBif\fR, the name of a file containing long initialization strings. +These strings are expected to set the terminal into modes consistent +with the rest of the terminfo description. +They are normally sent to the terminal, by the +.IR tset +program, each time the user logs in. +They will be printed in the following order: +.BR is1 ; +.BR is2 ; +setting tabs using +.B tbc +and +.BR hts ; +.BR if ; +running the program +.BR iprog ; +and finally +.BR is3 . +Most initialization is done with +.BR is2 . +Special terminal modes can be set up without duplicating strings +by putting the common sequences in +.B is2 +and special cases in +.B is1 +and +.BR is3 . +A pair of sequences that does a harder reset from a totally unknown state +can be analogously given as +.BR rs1 , +.BR rs2 , +.BR rf , +and +.BR rs3 , +analogous to +.B is2 +and +.BR if . +These strings are output by the +.IR reset +program, which is used when the terminal gets into a wedged state. +Commands are normally placed in +.B rs2 +and +.B rf +only if they produce annoying effects on the screen and are not +necessary when logging in. +For example, the command to set the vt100 into 80-column mode would +normally be part of +.BR is2 , +but it causes an annoying glitch of the screen and is not normally +needed since the terminal is usually already in 80 column mode. +.PP +If there are commands to set and clear tab stops, they can be given as +.B tbc +(clear all tab stops) +and +.B hts +(set a tab stop in the current column of every row). +If a more complex sequence is needed to set the tabs than can be +described by this, the sequence can be placed in +.B is2 +or +.BR if . +.SS Delays and Padding +.PP +Many older and slower terminals don't support either XON/XOFF or DTR +handshaking, including hard copy terminals and some very archaic CRTs +(including, for example, DEC VT100s). These may require padding characters +after certain cursor motions and screen changes. +.PP +If the terminal uses xon/xoff handshaking for flow control (that is, +it automatically emits ^S back to the host when its input buffers are +close to full), set +.BR xon . +This capability suppresses the emission of padding. You can also set it +for memory-mapped console devices effectively that don't have a speed limit. +Padding information should still be included so that routines can +make better decisions about relative costs, but actual pad characters will +not be transmitted. +.PP +If \fBpb\fR (padding baud rate) is given, padding is suppressed at baud rates +below the value of \fBpb\fR. If the entry has no padding baud rate, then +whether padding is emitted or not is completely controlled by \fBxon\fR. +.PP +If the terminal requires other than a null (zero) character as a pad, +then this can be given as \fBpad\fR. +Only the first character of the +.B pad +string is used. +.PP +.SS Status Lines +Some terminals have an extra `status line' which is not normally used by +software (and thus not counted in the terminal's \fBlines\fR capability). +.PP +The simplest case is a status line which is cursor-addressable but not +part of the main scrolling region on the screen; the Heathkit H19 has +a status line of this kind, as would a 24-line VT100 with a 23-line +scrolling region set up on initialization. This situation is indicated +by the \fBhs\fR capability. +.PP +Some terminals with status lines need special sequences to access the +status line. These may be expressed as a string with single parameter +\fBtsl\fR which takes the cursor to a given zero-origin column on the +status line. The capability \fBfsl\fR must return to the main-screen +cursor positions before the last \fBtsl\fR. You may need to embed the +string values of \fBsc\fR (save cursor) and \fBrc\fR (restore cursor) +in \fBtsl\fR and \fBfsl\fR to accomplish this. +.PP +The status line is normally assumed to be the same width as the width +of the terminal. If this is untrue, you can specify it with the numeric +capability \fBwsl\fR. +.PP +A command to erase or blank the status line may be specified as \fBdsl\fR. +.PP +The boolean capability \fBeslok\fR specifies that escape sequences, tabs, +etc. work ordinarily in the status line. +.PP +The \fBncurses\fR implementation does not yet use any of these capabilities. +They are documented here in case they ever become important. +.PP +.SS Line Graphics +.PP +Many terminals have alternate character sets useful for forms-drawing. +Terminfo and \fBcurses\fR build in support for the drawing characters +supported by the VT100, with some characters from the AT&T 4410v1 added. +This alternate character set may be specified by the \fBacsc\fR capability. +.PP +.TS H +center expand; +c l l c +c l l c +lw25 lw6 lw2 lw20. +.\".TH +\fBGlyph ACS Ascii VT100 +Name Name Default Name\fR +upper left corner ACS_ULCORNER + l +lower left corner ACS_LLCORNER + m +upper right corner ACS_URCORNER + k +lower right corner ACS_LRCORNER + j +tee pointing right ACS_LTEE + t +tee pointing left ACS_RTEE + u +tee pointing up ACS_BTEE + v +tee pointing down ACS_TTEE + w +horizontal line ACS_HLINE - q +vertical line ACS_VLINE | x +large plus or crossover ACS_PLUS + n +scan line 1 ACS_S1 ~ o +scan line 9 ACS_S9 \&_ s +diamond ACS_DIAMOND + ` +checker board (stipple) ACS_CKBOARD : a +degree symbol ACS_DEGREE \e f +plus/minus ACS_PLMINUS # g +bullet ACS_BULLET o ~ +arrow pointing left ACS_LARROW < , +arrow pointing right ACS_RARROW > + +arrow pointing down ACS_DARROW v . +arrow pointing up ACS_UARROW ^ - +board of squares ACS_BOARD # h +lantern symbol ACS_LANTERN # I +solid square block ACS_BLOCK # 0 +.TE +.PP +The best way to define a new device's graphics set is to add a column +to a copy of this table for your terminal, giving the character which +(when emitted between \fBsmacs\fR/\fBrmacs\fR switches) will be rendered +as the corresponding graphic. Then read off the VT100/your terminal +character pairs right to left in sequence; these become the ACSC string. +.PP +.SS Color Handling +.PP +Most color terminals are either `Tektronix-like' or `HP-like'. Tektronix-like +terminals have a predefined set of N colors (where N usually 8), and can set +character-cell foreground and background characters independently, mixing them +into N * N color-pairs. On HP-like terminals, the use must set each color +pair up separately (foreground and background are not independently settable). +Up to M color-pairs may be set up from 2*M different colors. ANSI-compatible +terminals are Tektronix-like. +.PP +Some basic color capabilities are independent of the color method. The numeric +capabilities \fBcolors\fR and \fBpairs\fR specify the maximum numbers of colors +and color-pairs that can be displayed simultaneously. The \fBop\fR (original +pair) string resets foreground and background colors to their default values +for the terminal. The \fBoc\fR string resets all colors or color-pairs to +their default values for the terminal. Some terminals (including many PC +terminal emulators) erase screen areas with the current background color rather +than the power-up default background; these should have the boolean capability +\fBbce\fR. +.PP +To change the current foreground or background color on a Tektronix-type +terminal, use \fBsetaf\fR (set ANSI foreground) and \fBsetab\fR (set ANSI +background) or \fBsetf\fR (set foreground) and \fBsetb\fR (set background). +These take one parameter, the color number. The SVr4 documentation describes +only \fBsetaf\fR/\fBsetab\fR; the XPG4 draft says that "If the terminal +supports ANSI escape sequences to set background and foreground, they should +be coded as \fBsetaf\fR and \fBsetab\fR, respectively. If the terminal +supports other escape sequences to set background and foreground, they should +be coded as \fBsetf\fR and \fBsetb\fR, respectively. The \fIvidputs()\fR +function and the refresh functions use \fBsetaf\fR and \fBsetab\fR if they are +defined." +.PP +The \fBsetaf\fR/\fBsetab\fR and \fBsetf\fR/\fBsetb\fR capabilities take a +single numeric argument each. Argument values 0-7 are portably defined as +follows (the middle column is the symbolic #define available in the header for +the \fBcurses\fR or \fBncurses\fR libraries). The terminal hardware is free to +map these as it likes, but the RGB values indicate normal locations in color +space. +.PP +.TS H +center; +l c c c +l l n l. +\fBColor #define Value RGB\fR +black \fBCOLOR_BLACK\fR 0 0, 0, 0 +red \fBCOLOR_RED\ \fR 1 max,0,0 +green \fBCOLOR_GREEN\fR 2 0,max,0 +yellow \fBCOLOR_YELLOW\fR 3 max,max,0 +blue \fBCOLOR_BLUE\fR 4 0,0,max +magenta \fBCOLOR_MAGENTA\fR 5 max,0,max +cyan \fBCOLOR_CYAN\fR 6 0,max,max +white \fBCOLOR_WHITE\fR 7 max,max,max +.TE +.PP +On an HP-like terminal, use \fBscp\fR with a color-pair number parameter to set +which color pair is current. +.PP +On a Tektronix-like terminal, the capability \fBccc\fR may be present to +indicate that colors can be modified. If so, the \fBinitc\fR capability will +take a color number (0 to \fBcolors\fR - 1)and three more parameters which +describe the color. These three parameters default to being interpreted as RGB +(Red, Green, Blue) values. If the boolean capability \fBhls\fR is present, +they are instead as HLS (Hue, Lightness, Saturation) indices. The ranges are +terminal-dependent. +.PP +On an HP-like terminal, \fBinitp\fR may give a capability for changing a +color-pair value. It will take seven parameters; a color-pair number (0 to +\fBmax_pairs\fR - 1), and two triples describing first background and then +foreground colors. These parameters must be (Red, Green, Blue) or +(Hue, Lightness, Saturation) depending on \fBhls\fR. +.PP +On some color terminals, colors collide with highlights. You can register +these collisions with the \fBncv\fR capability. This is a bit-mask of +attributes not to be used when colors are enabled. The correspondence with the +attributes understood by \fBcurses\fR is as follows: +.PP +.TS +center; +l c c +lw25 lw2 lw10. +\fBAttribute Bit Decimal\fR +A_STANDOUT 0 1 +A_UNDERLINE 1 2 +A_REVERSE 2 4 +A_BLINK 3 8 +A_DIM 4 16 +A_BOLD 5 32 +A_INVIS 6 64 +A_PROTECT 7 128 +A_ALTCHARSET 8 256 +.TE +.PP +For example, on many IBM PC consoles, the underline attribute collides with the +foreground color blue and is not available in color mode. These should have +an \fBncv\fR capability of 2. +.PP +.SS Miscellaneous +.PP +If the terminal can move up or down half a line, +this can be indicated with +.B hu +(half-line up) +and +.B hd +(half-line down). +This is primarily useful for superscripts and subscripts on hard-copy terminals. +If a hard-copy terminal can eject to the next page (form feed), give this as +.B ff +(usually control L). +.PP +If there is a command to repeat a given character a given number of +times (to save time transmitting a large number of identical characters) +this can be indicated with the parameterized string +.BR rep . +The first parameter is the character to be repeated and the second +is the number of times to repeat it. +Thus, tparm(repeat_char, 'x', 10) is the same as `xxxxxxxxxx'. +.PP +If the terminal has a settable command character, such as the \s-1TEKTRONIX\s+1 4025, +this can be indicated with +.BR cmdch . +A prototype command character is chosen which is used in all capabilities. +This character is given in the +.B cmdch +capability to identify it. +The following convention is supported on some UNIX systems: +The environment is to be searched for a +.B CC +variable, and if found, all +occurrences of the prototype character are replaced with the character +in the environment variable. +.PP +Terminal descriptions that do not represent a specific kind of known +terminal, such as +.IR switch , +.IR dialup , +.IR patch , +and +.IR network , +should include the +.B gn +(generic) capability so that programs can complain that they do not know +how to talk to the terminal. +(This capability does not apply to +.I virtual +terminal descriptions for which the escape sequences are known.) +.PP +If the terminal has a ``meta key'' which acts as a shift key, +setting the 8th bit of any character transmitted, this fact can +be indicated with +.BR km . +Otherwise, software will assume that the 8th bit is parity and it +will usually be cleared. +If strings exist to turn this ``meta mode'' on and off, they +can be given as +.B smm +and +.BR rmm . +.PP +If the terminal has more lines of memory than will fit on the screen +at once, the number of lines of memory can be indicated with +.BR lm . +A value of +.BR lm #0 +indicates that the number of lines is not fixed, +but that there is still more memory than fits on the screen. +.PP +If the terminal is one of those supported by the \s-1UNIX\s+1 virtual +terminal protocol, the terminal number can be given as +.BR vt . +.PP +Media copy +strings which control an auxiliary printer connected to the terminal +can be given as +.BR mc0 : +print the contents of the screen, +.BR mc4 : +turn off the printer, and +.BR mc5 : +turn on the printer. +When the printer is on, all text sent to the terminal will be sent +to the printer. +It is undefined whether the text is also displayed on the terminal screen +when the printer is on. +A variation +.B mc5p +takes one parameter, and leaves the printer on for as many characters +as the value of the parameter, then turns the printer off. +The parameter should not exceed 255. +All text, including +.BR mc4 , +is transparently passed to the printer while an +.B mc5p +is in effect. +.PP +Strings to program function keys can be given as +.BR pfkey , +.BR pfloc , +and +.BR pfx . +Each of these strings takes two parameters: the function key number to +program (from 0 to 10) and the string to program it with. +Function key numbers out of this range may program undefined keys in +a terminal dependent manner. +The difference between the capabilities is that +.B pfkey +causes pressing the given key to be the same as the user typing the +given string; +.B pfloc +causes the string to be executed by the terminal in local; and +.B pfx +causes the string to be transmitted to the computer. +.PP +.SS Glitches and Braindamage +.PP +Hazeltine terminals, which do not allow `~' characters to be displayed should +indicate \fBhz\fR. +.PP +Terminals which ignore a line-feed immediately after an \fBam\fR wrap, +such as the Concept and vt100, +should indicate \fBxenl\fR. +.PP +If +.B el +is required to get rid of standout +(instead of merely writing normal text on top of it), +\fBxhp\fP should be given. +.PP +Teleray terminals, where tabs turn all characters moved over to blanks, +should indicate \fBxt\fR (destructive tabs). +Note: the variable indicating this is now `dest_tabs_magic_smso'; in +older versions, it was teleray_glitch. +This glitch is also taken to mean that it is not possible to position +the cursor on top of a ``magic cookie'', +that to erase standout mode it is instead necessary to use +delete and insert line. The ncurses implementation ignores this glitch. +.PP +The Beehive Superbee, which is unable to correctly transmit the escape +or control C characters, has +.BR xsb , +indicating that the f1 key is used for escape and f2 for control C. +(Only certain Superbees have this problem, depending on the ROM.) +Note that in older terminfo versions, this capability was called +`beehive_glitch'; it is now `no_esc_ctl_c'. +.PP +Other specific terminal problems may be corrected by adding more +capabilities of the form \fBx\fIx\fR. +.PP +.SS Similar Terminals +.PP +If there are two very similar terminals, +one can be defined as being just like the other with certain exceptions. +The string capability \fBuse\fR can be given +with the name of the similar terminal. +The capabilities given before +.B use +override those in the terminal type invoked by +.BR use . +A capability can be canceled by placing \fBxx@\fR to the left of the +capability definition, where xx is the capability. +For example, the entry +.PP + 2621-nl, smkx@, rmkx@, use=2621, +.PP +defines a 2621-nl that does not have the \fBsmkx\fR or \fBrmkx\fR capabilities, +and hence does not turn on the function key labels when in visual mode. +This is useful for different modes for a terminal, or for different +user preferences. +.PP +.SS Pitfalls of Long Entries +.PP +Long terminfo entries are unlikely to be a problem; to date, no entry has even +approached terminfo's 4K string-table maximum. Unfortunately, the termcap +translations are much more strictly limited (to 1K), thus termcap translations +of long terminfo entries can cause problems. +.PP +The man pages for 4.3BSD and older versions of tgetent() instruct the user to +allocate a 1K buffer for the termcap entry. The entry gets null-terminated by +the termcap library, so that makes the maximum safe length for a termcap entry +1k-1 (1023) bytes. Depending on what the application and the termcap library +being used does, and where in the termcap file the terminal type that tgetent() +is searching for is, several bad things can happen. +.PP +Some termcap libraries print a warning message or exit if they find an +entry that's longer than 1023 bytes; others don't; others truncate the +entries to 1023 bytes. Some application programs allocate more than +the recommended 1K for the termcap entry; others don't. +.PP +Each termcap entry has two important sizes associated with it: before +"tc" expansion, and after "tc" expansion. "tc" is the capability that +tacks on another termcap entry to the end of the current one, to add +on its capabilities. If a termcap entry doesn't use the "tc" +capability, then of course the two lengths are the same. +.PP +The "before tc expansion" length is the most important one, because it +affects more than just users of that particular terminal. This is the +length of the entry as it exists in /etc/termcap, minus the +backslash-newline pairs, which tgetent() strips out while reading it. +Some termcap libraries strip off the final newline, too (GNU termcap does not). +Now suppose: +.TP 5 +* +a termcap entry before expansion is more than 1023 bytes long, +.TP 5 +* +and the application has only allocated a 1k buffer, +.TP 5 +* +and the termcap library (like the one in BSD/OS 1.1 and GNU) reads +the whole entry into the buffer, no matter what its length, to see +if it's the entry it wants, +.TP 5 +* +and tgetent() is searching for a terminal type that either is the +long entry, appears in the termcap file after the long entry, or +doesn't appear in the file at all (so that tgetent() has to search +the whole termcap file). +.PP +Then tgetent() will overwrite memory, perhaps its stack, and probably core dump +the program. Programs like telnet are particularly vulnerable; modern telnets +pass along values like the terminal type automatically. The results are almost +as undesirable with a termcap library, like SunOS 4.1.3 and Ultrix 4.4, that +prints warning messages when it reads an overly long termcap entry. If a +termcap library truncates long entries, like OSF/1 3.0, it is immune to dying +here but will return incorrect data for the terminal. +.PP +The "after tc expansion" length will have a similar effect to the +above, but only for people who actually set TERM to that terminal +type, since tgetent() only does "tc" expansion once it's found the +terminal type it was looking for, not while searching. +.PP +In summary, a termcap entry that is longer than 1023 bytes can cause, +on various combinations of termcap libraries and applications, a core +dump, warnings, or incorrect operation. If it's too long even before +"tc" expansion, it will have this effect even for users of some other +terminal types and users whose TERM variable does not have a termcap +entry. +.PP +When in -C (translate to termcap) mode, the \fBncurses\fR implementation of +\fBtic\fR(1) issues warning messages when the pre-tc length of a termcap +translation is too long. The -c (check) option also checks resolved (after tc +expansion) lengths. +.SS Binary Compatibility +It is not wise to count on portability of binary terminfo entries between +commercial UNIX versions. The problem is that there are at least two versions +of terminfo (under HP-UX and AIX) which diverged from System V terminfo after +SVr1, and have added extension capabilities to the string table that (in the +binary format) collide with System V and XSI Curses extensions. +.SH EXTENSIONS +The %x operator in parameterized strings is unique to the ncurses implementation +of \fBtparm\fR (it is required in order to support an unfortunate choice of +\fBinitc\fR format on the Linux console). +.PP +Some SVr4 \fBcurses\fR implementations, and all previous to SVr4, don't +interpret the %A and %O operators in parameter strings. +.PP +SVr4/XPG4 do not specify whether \fBmsgr\fR licenses movement while in +an alternate-character-set mode (such modes may, among other things, map +CR and NL to characters that don't trigger local motions). +The \fBncurses\fR implementation ignores \fBmsgr\fR in \fBALTCHARSET\fR +mode. This raises the possibility that an XPG4 +implementation making the opposite interpretation may need terminfo +entries made for \fBncurses\fR to have \fBmsgr\fR turned off. +.PP +The \fBncurses\fR library handles insert-character and insert-character modes +in a slightly non-standard way in order to get better update efficiency. See +the \fBInsert/Delete Character\fR subsection above. +.PP +The parameter substitutions for \fBset_clock\fR and \fBdisplay_clock\fR are +not documented in SVr4 or the XSI Curses standard. They are deduced from the +documentation for the AT&T 505 terminal. +.PP +Be careful assigning the \fBkmous\fR capability. The \fBncurses\fR wants to +interpret it as \fBKEY_MOUSE\fR, for use by terminals and emulators like xterm +that can return mouse-tracking information in the keyboard-input stream. +.PP +Different commercial ports of terminfo and curses support different subsets of +the XSI Curses standard and (in some cases) different extension sets. Here +is a summary, accurate as of October 1995: +.PP +\fBSVR4, Solaris, ncurses\fR -- +These support all SVr4 capabilities. +.PP +\fBSGI\fR -- +Supports the SVr4 set, adds one undocumented extended string +capability (\fBset_pglen\fR). +.PP +\fBSVr1, Ultrix\fR -- +These support a restricted subset of terminfo capabilities. The booleans +end with \fBxon_xoff\fR; the numerics with \fBwidth_status_line\fR; and the +strings with \fBprtr_non\fR. +.PP +\fBHP/UX\fR -- +Supports the SVr1 subset, plus the SVr[234] numerics \fBnum_labels\fR, +\fBlabel_height\fR, \fBlabel_width\fR, plus function keys 11 through 63, plus +\fBplab_norm\fR, \fBlabel_on\fR, and \fBlabel_off\fR, plus some incompatible +extensions in the string table. +.PP +\fBAIX\fR -- +Supports the SVr1 subset, plus function keys 11 through 63, plus a number +of incompatible string table extensions. +.PP +\fBOSF\fR -- +Supports both the SVr4 set and the AIX extensions. +.SH FILES +.TP 25 +\*d/?/* +files containing terminal descriptions +.SH "SEE ALSO" +tic(1m), curses(3X), printf(3S), term(\*n). +.SH AUTHORS +Zeyd M. Ben-Halim, Eric S. Raymond. Descends from the original pcurses +by Pavel Curtis. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/tic.1m b/man/tic.1m new file mode 100644 index 00000000..9bb1c0e5 --- /dev/null +++ b/man/tic.1m @@ -0,0 +1,211 @@ +.TH tic 1M "" +.ds n 5 +.ds d @DATADIR@/terminfo +.SH NAME +\fBtic\fR - the \fIterminfo\fR entry-description compiler +.SH SYNOPSIS +\fBtic\fR [\fB-v\fR[\fIn\fR]] [\fB-w\fR[\fIn\fR]] [\fB-1hcpICNRrsTu\fR] [\fB-e\fR \fInames\fR] \fIfile\fR +.br +.SH DESCRIPTION +The command \fBtic\fR translates a \fBterminfo\fR file from source +format into compiled format. The compiled format is necessary for use with +the library routines in \fBncurses\fR(3X). +.PP +The results are normally placed in the system terminfo +directory \fB\*d\fR. There are two ways to change this behavior. +.PP +First, you may override the system default by setting the variable +\fBTERMINFO\fR in your shell environment to a valid (existing) directory name. +.PP +Secondly, if \fBtic\fR cannot get access to \fI\*d\fR or your TERMINFO +directory, it looks for the directory \fI$HOME/.terminfo\fR; if that directory +exists, the entry is placed there. +.PP +Libraries that read terminfo entries are expected to check for a TERMINFO +directory first, look at \fI$HOME/.terminfo\fR if TERMINFO is not set, and +finally look in \fI\*d\fR. +.TP +\fB-h\fR +Print help message and exit. +.TP +\fB-c\fR +specifies to only check \fIfile\fR for errors, including syntax problems and +bad use links. If you specify \fB-C\fR (\fB-I\fR) with this option, the code +will print warnings about entries which, after use resolution, are more than +1023 (4096) bytes long. Due to a fixed buffer length in older termcap +libraries (and a documented limit in terminfo), these entries may cause core +dumps. +.TP +\fB-v\fR\fIn\fR +specifies that (verbose) output be written to standard error trace +information showing \fBtic\fR's progress. The optional integer +\fIn\fR is a number from 1 to 10, inclusive, indicating the desired +level of detail of information. If \fIn\fR is omitted, the default +level is 1. If \fIn\fR is specified and greater than 1, the level of +detail is increased. +.TP +\fB-o\fR\fIdir\fR +Write compiled entries to given directory. Overrides the TERMINFO environment +variable. +.TP +\fB-w\fR\fIn\fR +specifies the width of the output. +.TP +\fB-1\fR +restricts the output to a single column +.TP +\fB-T\fR +eliminates size-restrictions on the generated text. +This is mainly useful for testing and analysis, since the compiled +descriptions are limited (e.g., 1023 for termcap, 4096 for terminfo). +.TP +\fB-I\fR +Force source translation to terminfo format. +.TP +\fB-L\fR +Force source translation to terminfo format +using the long C variable names listed in <\fBterm.h\fR> +.TP +\fB-C\fR +Force source translation to termcap format. Note: this differs from the -C +option of \fIinfocmp\fR(1m) in that it does not merely translate capability +names, but also translates terminfo strings to termcap format. Capabilities +that are not translatable are left in the entry under their terminfo names +but commented out with two preceding dots. +.TP +\fB-N\fR +Disable smart defaults. +Normally, when translating from termcap to terminfo, the compiler makes +a number of assumptions about the defaults of string capabilities +\fBreset1_string\fR, \fBcarriage_return\fR, \fBcursor_left\fR, +\fBcursor_down\fR, \fBscroll_forward\fR, \fBtab\fR, \fBnewline\fR, +\fBkey_backspace\fR, \fBkey_left\fR, and \fBkey_down\fR, then attempts +to use obsolete termcap capabilities to deduce correct values. It also +normally suppresses output of obsolete termcap capabilities such as \fBbs\fR. +This option forces a more literal translation that also preserves the +obsolete capabilities. +.TP +\fB-R\fR\fIsubset\fR +Restrict output to a given subset. This option is for use with archaic +versions of terminfo like those on SVr1, Ultrix, or HP/UX that don't support +the full set of SVR4/XSI Curses terminfo; and outright broken ports like AIX +that have their own extensions incompatible with SVr4/XSI. Available subsets +are "SVr1", "Ultrix", "HP", "BSD" and "AIX"; see \fBterminfo\fR(\*n) for details. +.TP +\fI-r\fR +Force entry resolution (so there are no remaining tc capabilities) even +when doing translation to termcap format. This may be needed if you are +preparing a termcap file for a termcap library (such as GNU termcap up +to version 1.3 or BSD termcap up to 4.3BSD) that doesn't handle multiple +tc capabilities per entry. +.TP +\fI-s\fR +Summarize the compile by showing the directory into which entries +are written, and the number of entries which are compiled. +.TP +\fI-e\fR +Limit writes and translations to the following comma-separated list of +terminals. +If any name or alias of a terminal matches one of the names in +the list, the entry will be written or translated as normal. +Otherwise no output will be generated for it. +The option value is interpreted as a file containing the list if it +contains a '/'. +(Note: depending on how tic was compiled, this option may require -I or -C.) +.TP +\fIfile\fR +contains one or more \fBterminfo\fR terminal descriptions in source +format [see \fBterminfo\fR(\*n)]. Each description in the file +describes the capabilities of a particular terminal. +.PP +The debug flag levels are as follows: +.TP +1 +Names of files created and linked +.TP +2 +Information related to the ``use'' facility +.TP +3 +Statistics from the hashing algorithm +.TP +5 +String-table memory allocations +.TP +7 +Entries into the string-table +.TP +8 +List of tokens encountered by scanner +.TP +9 +All values computed in construction of the hash table +.LP +If n is not given, it is taken to be one. +.PP +All but one of the capabilities recognized by \fBtic\fR are documented +in \fBterminfo\fR(\*n). The exception is the \fBuse\fR capability. + +When a \fBuse\fR=\fIentry\fR-\fIname\fR field is discovered in a +terminal entry currently being compiled, \fBtic\fR reads in the binary +from \fB\*d\fR to complete the entry. (Entries created from +\fIfile\fR will be used first. If the environment variable +\fBTERMINFO\fR is set, that directory is searched instead of +\fB\*d\fR.) \fBtic\fR duplicates the capabilities in +\fIentry\fR-\fIname\fR for the current entry, with the exception of +those capabilities that explicitly are defined in the current entry. + +When an entry, e.g., \fBentry_name_1\fR, contains a +\fBuse=\fR\fIentry\fR_\fIname\fR_\fI2\fR field, any canceled +capabilities in \fIentry\fR_\fIname\fR_\fI2\fR must also appear in +\fBentry_name_1\fR before \fBuse=\fR for these capabilities to be +canceled in \fBentry_name_1\fR. + +If the environment variable \fBTERMINFO\fR is set, the compiled +results are placed there instead of \fB\*d\fR. + +Total compiled entries cannot exceed 4096 bytes. The name field cannot +exceed 128 bytes. Terminal names exceeding 14 characters will be +truncated to 14 characters and a warning message will be printed. +.SH COMPATIBILITY +There is some evidence that historic \fBtic\fR implementations treated +description fields with no whitespace in them as additional aliases or +short names. This \fBtic\fR does not do that, but it does warn when +description fields may be treated that way and check them for dangerous +characters. +.SH EXTENSIONS +Unlike the stock SVr4 \fBtic\fR command, this implementation can actually +compile termcap sources. In fact, entries in terminfo and termcap syntax can +be mixed in a single source file. See \fBterminfo\fR(\*n) for the list of +termcap names taken to be equivalent to terminfo names. + +The SVr4 manual pages are not clear on the resolution rules for \fBuse\fR +capabilities. +This implementation of \fBtic\fR will find \fBuse\fR targets anywhere +in the source file, or anywhere in the file tree rooted at \fBTERMINFO\fR (if +\fBTERMINFO\fR is defined), or in the user's \fI$HOME/.terminfo\fR directory +(if it exists), or (finally) anywhere in the system's file tree of +compiled entries. + +The error messages from this \fBtic\fR have the same format as GNU C +error messages, and can be parsed by GNU Emacs's compile facility. + +The -o, -I, -C, -N, -R, -h, -e, -T, -r and -s options +are not supported under SVr4. +The SVr4 -c mode does not report bad use links. + +System V does not compile entries to or read entries from your +\fI$HOME/.terminfo\fR directory unless TERMINFO is explicitly set to it. +.SH FILES +.TP 5 +\fB\*d/?/*\fR +Compiled terminal description database. +.SH SEE ALSO +\fBinfocmp\fR(1m), \fBcaptoinfo\fR(1m), \fBinfotocap\fR(1m), \fBtoe\fR(1m), +\fBcurses\fR(3X), \fBterminfo\fR(\*n). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/toe.1m b/man/toe.1m new file mode 100644 index 00000000..a032217c --- /dev/null +++ b/man/toe.1m @@ -0,0 +1,52 @@ +.TH toe 1M "" +.ds n 5 +.ds d @DATADIR@/terminfo +.SH NAME +\fBtoe\fR - table of (terminfo) entries +.SH SYNOPSIS +\fBtoe\fR [\fB-v\fR[\fIn\fR]] [\fB-huUV\fR] \fIfile...\fR +.br +.SH DESCRIPTION +.PP +With no options, \fBtoe\fR lists all available terminal types by primary name +with descriptions. File arguments specify the directories to be scanned; if no +such arguments are given, your default terminfo directory is scanned. If you +also specify the -h option, a directory header will be issued as each +directory is entered. +.PP +There are other options intended for use by terminfo file maintainers: +.TP +\fB-u\fR \fIfile\fR +says to issue a report on dependencies in the given file. This report condenses +the `use' relation: each line consists of the primary name of a terminal that +has use capabilities, followed by a colon, followed by the +whitespace-separated primary names of all terminals which occur in those use +capabilities, followed by a newline +.TP +\fB-U\fR \fIfile\fR +says to issue a report on reverse dependencies in the given file. This report +reverses the `use' relation: each line consists of the primary name of a +terminal that occurs in use capabilities, followed by a colon, followed by the +whitespace-separated primary names of all terminals which depend on it, +followed by a newline. +.TP +\fB-v\fR\fIn\fR +specifies that (verbose) output be written to standard error trace +information showing \fBtoe\fR's progress. The optional integer +\fIn\fR is a number from 1 to 10, interpreted as for \fBtic\fR(1). +.TP 5 +\fB-V\fR +prints out the version of the program in use on standard error and exits. +.SH FILES +.TP 5 +\fB\*d/?/*\fR +Compiled terminal description database. +.SH SEE ALSO +\fBtic\fR(1m), \fBinfocmp\fR(1m), \fBcaptoinfo\fR(1m), \fBinfotocap\fR(1m), +\fBcurses\fR(3X), \fBterminfo\fR(\*n). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/tput.1 b/man/tput.1 new file mode 100644 index 00000000..3dcb4680 --- /dev/null +++ b/man/tput.1 @@ -0,0 +1,209 @@ +'\" t +.TH tput 1 "" +.ds d @DATADIR@/terminfo +.ds n 5 +.SH NAME +\fBtput\fR - initialize a terminal or query terminfo database +.SH SYNOPSIS +\fBtput\fR [\fB-T\fR\fItype\fR] \fIcapname\fR [\fIparms\fR ... ] +.br +\fBtput\fR [\fB-T\fR\fItype\fR] \fBinit\fR +.br +\fBtput\fR [\fB-T\fR\fItype\fR] \fBreset\fR +.br +\fBtput\fR [\fB-T\fR\fItype\fR] \fBlongname\fR +.br +\fBtput -S\fR \fB<<\fR +.br +.SH DESCRIPTION +The \fBtput\fR utility uses the \fBterminfo\fR database to make the +values of terminal-dependent capabilities and information available to +the shell (see \fBsh\fR(1)), to initialize or reset the terminal, or +return the long name of the requested terminal type. \fBtput\fR +outputs a string if the attribute (\fIcap\fRability \fIname\fR) is of +type string, or an integer if the attribute is of type integer. If +the attribute is of type boolean, \fBtput\fR simply sets the exit code +(\fB0\fR for TRUE if the terminal has the capability, \fB1\fR for +FALSE if it does not), and produces no output. Before using a value +returned on standard output, the user should test the exit code +[\fB$?\fR, see \fBsh\fR(1)] to be sure it is \fB0\fR. (See the \fBEXIT +CODES\fR and \fBDIAGNOSTICS\fR sections.) For a complete list of capabilities +and the \fIcapname\fR associated with each, see \fBterminfo\fR(\*n). +.TP +\fB-T\fR\fItype\fR +indicates the \fItype\fR of terminal. Normally this option is +unnecessary, because the default is taken from the environment +variable \fBTERM\fR. If \fB-T\fR is specified, then the shell +variables \fBLINES\fR and \fBCOLUMNS\fR will be ignored,and the +operating system will not be queried for the actual screen size. +.TP +\fIcapname\fR +indicates the attribute from the \fBterminfo\fR database. +.TP +\fIparms\fR +If the attribute is a string that takes parameters, the arguments +\fIparms\fR will be instantiated into the string. An all numeric +argument will be passed to the attribute as a number. +.TP +\fB-S\fR +allows more than one capability per invocation of \fBtput\fR. The +capabilities must be passed to \fBtput\fR from the standard input +instead of from the command line (see example). Only one +\fIcapname\fR is allowed per line. The \fB-S\fR option changes the +meaning of the \fB0\fR and \fB1\fR boolean and string exit codes (see the +EXIT CODES section). +.TP +\fBinit\fR +If the \fBterminfo\fR database is present and an entry for the user's +terminal exists (see \fB-T\fR\fItype\fR, above), the following will +occur: (1) if present, the terminal's initialization strings will be +output (\fBis1\fR, \fBis2\fR, \fBis3\fR, \fBif\fR, \fBiprog\fR), (2) +any delays (e.g., newline) specified in the entry will be set in the +tty driver, (3) tabs expansion will be turned on or off according to +the specification in the entry, and (4) if tabs are not expanded, +standard tabs will be set (every 8 spaces). If an entry does not +contain the information needed for any of the four above activities, +that activity will silently be skipped. +.TP +\fBreset\fR +Instead of putting out initialization strings, the terminal's +reset strings will be output if present (\fBrs1\fR, \fBrs2\fR, \fBrs3\fR, \fBrf\fR). +If the reset strings are not present, but initialization +strings are, the initialization strings will be output. +Otherwise, \fBreset\fR acts identically to \fBinit\fR. +.TP +\fBlongname\fR +If the \fBterminfo\fR database is present and an entry for the +user's terminal exists (see \fB-T\fR\fItype\fR above), then the long name +of the terminal will be put out. The long name is the last +name in the first line of the terminal's description in the +\fBterminfo\fR database [see \fBterm\fR(5)]. +.SH EXAMPLES +.TP 5 +\fBtput init\fR +Initialize the terminal according to the type of +terminal in the environmental variable \fBTERM\fR. This +command should be included in everyone's .profile after +the environmental variable \fBTERM\fR has been exported, as +illustrated on the \fBprofile\fR(4) manual page. +.TP 5 +\fBtput -T5620 reset\fR +Reset an AT&T 5620 terminal, overriding the type of +terminal in the environmental variable \fBTERM\fR. +.TP 5 +\fBtput cup 0 0\fR +Send the sequence to move the cursor to row \fB0\fR, column \fB0\fR +(the upper left corner of the screen, usually known as the "home" +cursor position). +.TP 5 +\fBtput clear\fR +Echo the clear-screen sequence for the current terminal. +.TP 5 +\fBtput cols\fR +Print the number of columns for the current terminal. +.TP 5 +\fBtput -T450 cols\fR +Print the number of columns for the 450 terminal. +.TP 5 +\fBbold=`tput smso` offbold=`tput rmso`\fR +Set the shell variables \fBbold\fR, to begin stand-out mode +sequence, and \fBoffbold\fR, to end standout mode sequence, +for the current terminal. This might be followed by a +prompt: \fBecho "${bold}Please type in your name: ${offbold}\\c"\fR +.TP 5 +\fBtput hc\fR +Set exit code to indicate if the current terminal is a hard copy terminal. +.TP 5 +\fBtput cup 23 4\fR +Send the sequence to move the cursor to row 23, column 4. +.TP 5 +\fBtput longname\fR +Print the long name from the \fBterminfo\fR database for the +type of terminal specified in the environmental +variable \fBTERM\fR. +.TP 0 +\fBtput -S < clear\fR +.br +\fB> cup 10 10\fR +.br +\fB> bold\fR +.br +\fB> !\fR +.TP 5 +\& +This example shows tput processing several capabilities in one +invocation. This example clears the screen, moves the cursor to +position 10, 10 and turns on bold (extra bright) mode. The list is +terminated by an exclamation mark (\fB!\fR) on a line by itself. +.SH FILES +.TP +\fB\*d\fR +compiled terminal description database +.TP +\fB/usr/include/curses.h\fR +\fBcurses\fR(3X) header file +.TP +\fB/usr/include/term.h\fR +\fBterminfo\fR header file +.TP +\fB@DATADIR@/tabset/*\fR +tab settings for some terminals, in a format +appropriate to be output to the terminal (escape +sequences that set margins and tabs); for more +information, see the "Tabs and Initialization" +section of \fBterminfo\fR(4) +.SH SEE ALSO +\fBclear\fR(1), \fBstty\fR(1), \fBtabs\fR(\*n). \fBprofile\fR(\*n), +\fBterminfo\fR(4) in the \fISystem\fR \fIAdministrator\fR'\fIs\fR +\fIReference\fR \fIManual\fR. Chapter 10 of the +\fIProgrammer\fR'\fIs\fR \fIGuide\fR. +.SH EXIT CODES +If \fIcapname\fR is of type boolean, a value of \fB0\fR is set for +TRUE and \fB1\fR for FALSE unless the \fB-S\fR option is used. + +If \fIcapname\fR is of type string, a value of \fB0\fR is set if the +\fIcapname\fR is defined for this terminal \fItype\fR (the value of +\fIcapname\fR is returned on standard output); a value of \fB1\fR is +set if \fIcapname\fR is not defined for this terminal \fItype\fR (a +null value is returned on standard output). + +If \fIcapname\fR is of type boolean or string and the \fB-S\fR option +is used, a value of \fB0\fR is returned to indicate that all lines +were successful. No indication of which line failed can be given so +exit code \fB1\fR will never appear. Exit codes \fB2\fR, \fB3\fR, and +\fB4\fR retain their usual interpretation. + +If \fIcapname\fR is of type integer, a value of \fB0\fR is always set, +whether or not \fIcapname\fR is defined for this terminal \fItype\fR. +To determine if \fIcapname\fR is defined for this terminal \fItype\fR, +the user must test the value of standard output. A value of \fB-1\fR +means that \fIcapname\fR is not defined for this terminal \fItype\fR. + +Any other exit code indicates an error; see the DIAGNOSTICS section. +.SH DIAGNOSTICS +\fBtput\fR prints the following error messages and sets the corresponding exit +codes. + +.TS +l l. +exit code error message +\fB0\fR (\fIcapname\fR is a numeric variable that is not specified in the + \fBterminfo\fR(\*n) database for this terminal type, e.g. + \fBtput -T450 lines\fR and \fBtput -T2621 xmc\fR) +\fB1\fR no error message is printed, see the \fBEXIT CODES\fR section. +\fB2\fR usage error +\fB3\fR unknown terminal \fItype\fR or no \fBterminfo\fR database +\fB4\fR unknown \fBterminfo\fR capability \fIcapname\fR +.TE +.SH PORTABILITY +The \fBlongname\fR and \fB-S\fR options, and the parameter-substitution +features used in the \fBcup\fR example, are not supported in BSD curses or in +AT&T/USL curses before SVr4. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/tset.1 b/man/tset.1 new file mode 100644 index 00000000..99a55f8b --- /dev/null +++ b/man/tset.1 @@ -0,0 +1,218 @@ +.TH tset 1 "" +.SH NAME +\fBtset\fR - terminal initialization +.SH SYNOPSIS +tset [-IQqrs] [-] [-e \fIch\fR] [-i \fIch\fR] [-k \fIch\fR] [-m \fImapping\fR] [\fIterminal\fR] +.br +reset [-IQqrs] [-] [-e \fIch\fR] [-i \fIch\fR] [-k \fIch\fR] [-m \fImapping\fR] [\fIterminal\fR] +.SH DESCRIPTION +\&\fBTset\fR initializes terminals. +\fBTset\fR first determines the type of terminal that you are using. +This determination is done as follows, using the first terminal type found. +.PP +1. The \fBterminal\fR argument specified on the command line. +.PP +2. The value of the \fBTERM\fR environmental variable. +.PP +3. (BSD systems only.) The terminal type associated with the standard +error output device in the \fI/etc/ttys\fR file. (On Linux and +System-V-like UNIXes, \fIgetty\fR does this job by setting +\fBTERM\fR according to the type passed to it by \fI/etc/inittab\fR.) +.PP +4. The default terminal type, ``unknown''. +.PP +If the terminal type was not specified on the command-line, the -m +option mappings are then applied (see below for more information). +Then, if the terminal type begins with a question mark (``?''), the +user is prompted for confirmation of the terminal type. An empty +response confirms the type, or, another type can be entered to specify +a new type. Once the terminal type has been determined, the terminfo +entry for the terminal is retrieved. If no terminfo entry is found +for the type, the user is prompted for another terminal type. +.PP +Once the terminfo entry is retrieved, the window size, backspace, interrupt +and line kill characters (among many other things) are set and the terminal +and tab initialization strings are sent to the standard error output. +Finally, if the erase, interrupt and line kill characters have changed, +or are not set to their default values, their values are displayed to the +standard error output. +.PP +When invoked as \fBreset\fR, \fBtset\fR sets cooked and echo modes, +turns off cbreak and raw modes, turns on newline translation and +resets any unset special characters to their default values before +doing the terminal initialization described above. This is useful +after a program dies leaving a terminal in an abnormal state. Note, +you may have to type + + \fBreset\fR + +(the line-feed character is normally control-J) to get the terminal +to work, as carriage-return may no longer work in the abnormal state. +Also, the terminal will often not echo the command. +.PP +The options are as follows: +.TP 5 +-q +The terminal type is displayed to the standard output, and the terminal is +not initialized in any way. The option `-' by itself is equivalent but +archaic. +.TP 5 +-e +Set the erase character to \fIch\fR. +.TP 5 +-I +Do not send the terminal or tab initialization strings to the terminal. +.TP 5 +-i +Set the interrupt character to \fIch\fR. +.TP 5 +-k +Set the line kill character to \fIch\fR. +.TP 5 +-m +Specify a mapping from a port type to a terminal. +See below for more information. +.TP 5 +-Q +Don't display any values for the erase, interrupt and line kill characters. +.TP 5 +-r +Print the terminal type to the standard error output. +.TP 5 +-s +Print the sequence of shell commands to initialize the environment variable +\fBTERM\fR to the standard output. +See the section below on setting the environment for details. +.PP +The arguments for the -e, -i, and -k +options may either be entered as actual characters or by using the `hat' +notation, i.e. control-h may be specified as ``^H'' or ``^h''. +.SH SETTING THE ENVIRONMENT +It is often desirable to enter the terminal type and information about +the terminal's capabilities into the shell's environment. +This is done using the -s option. +.PP +When the -s option is specified, the commands to enter the information +into the shell's environment are written to the standard output. If +the \fBSHELL\fR environmental variable ends in ``csh'', the commands +are for \fBcsh\fR, otherwise, they are for \fBsh\fR. +Note, the \fBcsh\fR commands set and unset the shell variable +\fBnoglob\fR, leaving it unset. The following line in the \fB.login\fR +or \fB.profile\fR files will initialize the environment correctly: + + eval \`tset -s options ... \` + +.SH TERMINAL TYPE MAPPING +When the terminal is not hardwired into the system (or the current +system information is incorrect) the terminal type derived from the +\fI/etc/ttys\fR file or the \fBTERM\fR environmental variable is often +something generic like \fBnetwork\fR, \fBdialup\fR, or \fBunknown\fR. +When \fBtset\fR is used in a startup script it is often desirable to +provide information about the type of terminal used on such ports. +.PP +The purpose of the -m option is to map +from some set of conditions to a terminal type, that is, to +tell \fBtset\fR +``If I'm on this port at a particular speed, guess that I'm on that +kind of terminal''. +.PP +The argument to the -m option consists of an optional port type, an +optional operator, an optional baud rate specification, an optional +colon (``:'') character and a terminal type. The port type is a +string (delimited by either the operator or the colon character). The +operator may be any combination of ``>'', ``<'', ``@'', and ``!''; ``>'' +means greater than, ``<'' means less than, ``@'' means equal to +and ``!'' inverts the sense of the test. +The baud rate is specified as a number and is compared with the speed +of the standard error output (which should be the control terminal). +The terminal type is a string. +.PP +If the terminal type is not specified on the command line, the -m +mappings are applied to the terminal type. If the port type and baud +rate match the mapping, the terminal type specified in the mapping +replaces the current type. If more than one mapping is specified, the +first applicable mapping is used. +.PP +For example, consider the following mapping: \fBdialup>9600:vt100\fR. +The port type is dialup , the operator is >, the baud rate +specification is 9600, and the terminal type is vt100. The result of +this mapping is to specify that if the terminal type is \fBdialup\fR, +and the baud rate is greater than 9600 baud, a terminal type of +\fBvt100\fR will be used. +.PP +If no baud rate is specified, the terminal type will match any baud rate. +If no port type is specified, the terminal type will match any port type. +For example, \fB-m dialup:vt100 -m :?xterm\fR +will cause any dialup port, regardless of baud rate, to match the terminal +type vt100, and any non-dialup port type to match the terminal type ?xterm. +Note, because of the leading question mark, the user will be +queried on a default port as to whether they are actually using an xterm +terminal. +.PP +No whitespace characters are permitted in the -m option argument. +Also, to avoid problems with meta-characters, it is suggested that the +entire -m option argument be placed within single quote characters, +and that \fBcsh\fR users insert a backslash character (``\e'') before +any exclamation marks (``!''). +.SH HISTORY +The \fBtset\fR command appeared in BSD 3.0. The \fBncurses\fR implementation +was lightly adapted from the 4.4BSD sources for a terminfo environment by Eric +S. Raymond . +.SH COMPATIBILITY +The \fBtset\fR utility has been provided for backward-compatibility with BSD +environments (under most modern UNIXes, \fB/etc/inittab\fR and \fIgetty\fR(1) +can set \fBTERM\fR appropriately for each dial-up line; this obviates what was +\fBtset\fR's most important use). This implementation behaves like 4.4BSD +tset, with a few exceptions specified here. +.PP +The -S option of BSD tset no longer works; it prints an error message to stderr +and dies. The -s option only sets \fBTERM\fR, not \fBTERMCAP\fB. Both these +changes are because the \fBTERMCAP\fR variable is no longer supported under +terminfo-based \fBncurses\fR, which makes \fBtset -S\fR useless (we made it die +noisily rather than silently induce lossage). +.PP +There was an undocumented 4.4BSD feature that invoking tset via a link named +`TSET` (or via any other name beginning with an upper-case letter) set the +terminal to use upper-case only. This feature has been omitted. +.PP +The -A, -E, -h, -u and -v options were deleted from the \fBtset\fR +utility in 4.4BSD. None of them were documented in 4.3BSD and all are +of limited utility at best. The -a, -d, and -p options are similarly +not documented or useful, but were retained as they appear to be in +widespread use. It is strongly recommended that any usage of these +three options be changed to use the -m option instead. The +-n option remains, but has no effect. The -adnp options are therefore +omitted from the usage summary above. +.PP +It is still permissible to specify the -e, -i, and -k options without +arguments, although it is strongly recommended that such usage be fixed to +explicitly specify the character. +.PP +As of 4.4BSD, executing \fBtset\fR as \fBreset\fR no longer implies the -Q +option. Also, the interaction between the - option and the \fIterminal\fR +argument in some historic implementations of \fBtset\fR has been removed. +.SH ENVIRONMENT +The \fBtset\fR command uses the \fBSHELL\fR and \fBTERM\fR +environment variables. +.SH FILES +.TP 5 +/etc/ttys +system port name to terminal type mapping database (BSD versions only). +.TP 5 +@DATADIR@/terminfo +terminal capability database +.SH SEE ALSO +csh(1), +sh(1), +stty(1), +tty(4), +termcap(5), +ttys(5), +environ(7), +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: + diff --git a/man/wresize.3x b/man/wresize.3x new file mode 100644 index 00000000..50537aef --- /dev/null +++ b/man/wresize.3x @@ -0,0 +1,60 @@ +.\"***************************************************************************** +.\" Copyright 1996 by Thomas E. Dickey * +.\" All Rights Reserved. * +.\" * +.\" Permission to use, copy, modify, and distribute this software and its * +.\" documentation for any purpose and without fee is hereby granted, provided * +.\" that the above copyright notice appear in all copies and that both that * +.\" copyright notice and this permission notice appear in supporting * +.\" documentation, and that the name of the above listed copyright holder(s) * +.\" not be used in advertising or publicity pertaining to distribution of the * +.\" software without specific, written prior permission. THE ABOVE LISTED * +.\" COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * +.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * +.\" EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * +.\" SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * +.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * +.\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * +.\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * +.\"***************************************************************************** +.\" $Id: wresize.3x,v 1.2 1996/09/07 14:51:04 tom Exp $ +.TH wresize 3X "" +. +.SH NAME +\fBwresize\fR - resize a curses window +. +.SH SYNOPSIS +\fB#include \fR + +\fBint wresize(WINDOW *win, int lines, int columns);\fR +. +.SH DESCRIPTION +The \fBwresize\fR function reallocates storage for an \fBncurses\fR +window to adjust its dimensions to the specified values. +If either dimension is larger than the current values, the +window's data is filled with blanks that have the current background rendition +(as set by \fBwbkgndset\fR) merged into them. +. +.SH RETURN VALUE +The function returns the integer \fBERR\fR upon failure and \fBOK\fR on success. +It will fail if either of the dimensions less than or equal to zero, +or if an error occurs while (re)allocating memory for the window. +. +.SH NOTES +The only restriction placed on the dimensions is that they be greater than zero. +The dimensions are not compared to \fBcurses\fR screen dimensions to +simplify the logic of \fBresizeterm\fR. +The caller must ensure that the window's dimensions fit within the +actual screen dimensions. +. +.SH SEE ALSO +\fBresizeterm\fR(3x). +. +.SH AUTHOR +Thomas Dickey (from an equivalent function written in 1988 for BSD curses). +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/menu/Makefile.in b/menu/Makefile.in new file mode 100644 index 00000000..bfe248fd --- /dev/null +++ b/menu/Makefile.in @@ -0,0 +1,131 @@ +# $Id: Makefile.in,v 1.16 1997/02/15 17:10:04 tom Exp $ +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Makefile for menu 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_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 +# Juergen Pfeifer reports: +# "Unfortunately -O crashes my linker on Linux and -O2 works" +# If your linker coughs and dies, try uncommenting the -O2 +CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ # -O2 + +CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) + +LINK = $(CC) +LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ + +MK_SHARED_LIB = @MK_SHARED_LIB@ +REL_VERSION = @nc_cv_rel_version@ +ABI_VERSION = @nc_cv_abi_version@ + +RANLIB = @RANLIB@ + +LIBRARIES = @LIBS_TO_MAKE@ + +LINT = @LINT@ +LINT_OPTS = @LINT_OPTS@ +LINT_LIBS = -lmenu -lncurses @LIBS@ + +################################################################################ +all :: ../include/menu.h ../include/eti.h ../include/mf_common.h $(LIBRARIES) + +$(INSTALL_PREFIX)$(libdir) : + $(srcdir)/../mkinstalldirs $@ + +# make copies to simplify include-paths while still keeping menu's include +# file in this directory. +../include/menu.h : $(srcdir)/menu.h + -rm -f $@ + cp $(srcdir)/menu.h $@ +../include/eti.h : $(srcdir)/eti.h + -rm -f $@ + cp $(srcdir)/eti.h $@ +../include/mf_common.h : $(srcdir)/mf_common.h + -rm -f $@ + cp $(srcdir)/mf_common.h $@ + +MENU_PRIV_H = \ + $(srcdir)/menu.priv.h \ + $(srcdir)/menu.h \ + $(srcdir)/mf_common.h \ + ../include/curses.h \ + $(srcdir)/eti.h + +tags: + ctags *.[ch] + +TAGS: + etags *.[ch] + +clean :: + -rm -f tags TAGS *~ ../include/menu.h ../include/eti.h \ + ../include/mf_common.h + +distclean :: clean + -rm -f Makefile + +mostlyclean :: clean + +realclean :: distclean + +############################################################################### +# The remainder of this file is automatically generated during configuration +############################################################################### diff --git a/menu/READ.ME b/menu/READ.ME new file mode 100644 index 00000000..eb5a64cd --- /dev/null +++ b/menu/READ.ME @@ -0,0 +1,18 @@ +This is a clone of the menu 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). This system was used together +with an NCR3000 system to compile the clone using original curses +implementation and to run various programs to check the compatibility of +this clone with the original libmenu library. + +The development environment was an ELF based Linux system, the German +Unifix distribution (aka Linux FT). + +For things that still need doing, see the TO-DO file in the top-level +directory. + +Juergen Pfeifer + +eMail: Juergen.Pfeifer@T-Online.de diff --git a/menu/eti.h b/menu/eti.h new file mode 100644 index 00000000..63028e84 --- /dev/null +++ b/menu/eti.h @@ -0,0 +1,42 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses Extended Terminal Interface (ETI) is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#ifndef _ETI_ERRNO_H_ +#define _ETI_ERRNO_H_ + +#define E_OK (0) +#define E_SYSTEM_ERROR (-1) +#define E_BAD_ARGUMENT (-2) +#define E_POSTED (-3) +#define E_CONNECTED (-4) +#define E_BAD_STATE (-5) +#define E_NO_ROOM (-6) +#define E_NOT_POSTED (-7) +#define E_UNKNOWN_COMMAND (-8) +#define E_NO_MATCH (-9) +#define E_NOT_SELECTABLE (-10) +#define E_NOT_CONNECTED (-11) +#define E_REQUEST_DENIED (-12) +#define E_INVALID_FIELD (-13) +#define E_CURRENT (-14) + +#endif diff --git a/menu/headers b/menu/headers new file mode 100644 index 00000000..bb1ebe73 --- /dev/null +++ b/menu/headers @@ -0,0 +1,21 @@ +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +$(srcdir)/eti.h +$(srcdir)/menu.h diff --git a/menu/llib-lmenu b/menu/llib-lmenu new file mode 100644 index 00000000..0116f4c5 --- /dev/null +++ b/menu/llib-lmenu @@ -0,0 +1,483 @@ +/****************************************************************************** + * Copyright 1996 by Thomas E. Dickey * + * All Rights Reserved. * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * + * that the above copyright notice appear in all copies and that both that * + * copyright notice and this permission notice appear in supporting * + * documentation, and that the name of the above listed copyright holder(s) * + * not be used in advertising or publicity pertaining to distribution of the * + * software without specific, written prior permission. THE ABOVE LISTED * + * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * + * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + ******************************************************************************/ +/* LINTLIBRARY */ + +/* ./m_attribs.c */ + +#include "menu.priv.h" + +#undef set_menu_fore +int set_menu_fore( + MENU *menu, + chtype attr) + { return(*(int *)0); } + +#undef menu_fore +chtype menu_fore( + const MENU *menu) + { return(*(chtype *)0); } + +#undef set_menu_back +int set_menu_back( + MENU *menu, + chtype attr) + { return(*(int *)0); } + +#undef menu_back +chtype menu_back( + const MENU *menu) + { return(*(chtype *)0); } + +#undef set_menu_grey +int set_menu_grey( + MENU *menu, + chtype attr) + { return(*(int *)0); } + +#undef menu_grey +chtype menu_grey( + const MENU *menu) + { return(*(chtype *)0); } + +#undef set_menu_pad +int set_menu_pad( + MENU *menu, + int pad) + { return(*(int *)0); } + +#undef menu_pad +int menu_pad( + const MENU *menu) + { return(*(int *)0); } + +/* ./m_cursor.c */ + +#undef pos_menu_cursor +int pos_menu_cursor( + const MENU *menu) + { return(*(int *)0); } + +/* ./m_driver.c */ + +#undef menu_pattern +char *menu_pattern( + const MENU *menu) + { return(*(char **)0); } + +#undef set_menu_pattern +int set_menu_pattern( + MENU *menu, + const char *p) + { return(*(int *)0); } + +#undef menu_driver +int menu_driver( + MENU *menu, + int c) + { return(*(int *)0); } + +/* ./m_format.c */ + +#undef set_menu_format +int set_menu_format( + MENU *menu, + int rows, + int cols) + { return(*(int *)0); } + +#undef menu_format +void menu_format( + const MENU *menu, + int *rows, + int *cols) + { /* void */ } + +/* ./m_global.c */ + +#undef _nc_Default_Menu +MENU _nc_Default_Menu; +#undef _nc_Default_Item +ITEM _nc_Default_Item; + +#undef _nc_Connect_Items +bool _nc_Connect_Items( + MENU *menu, + ITEM **items) + { return(*(bool *)0); } + +#undef _nc_Disconnect_Items +void _nc_Disconnect_Items( + MENU *menu) + { /* void */ } + +#undef _nc_Calculate_Item_Length_and_Width +void _nc_Calculate_Item_Length_and_Width( + MENU *menu) + { /* void */ } + +#undef _nc_Link_Items +void _nc_Link_Items( + MENU *menu) + { /* void */ } + +#undef _nc_Show_Menu +void _nc_Show_Menu( + const MENU *menu) + { /* void */ } + +#undef _nc_New_TopRow_and_CurrentItem +void _nc_New_TopRow_and_CurrentItem( + MENU *menu, + int new_toprow, + ITEM *new_current_item) + { /* void */ } + +/* ./m_hook.c */ + +#undef set_menu_init +int set_menu_init( + MENU *menu, + Menu_Hook func) + { return(*(int *)0); } + +#undef menu_init +Menu_Hook menu_init( + const MENU *menu) + { return(*(Menu_Hook *)0); } + +#undef set_menu_term +int set_menu_term( + MENU *menu, + Menu_Hook func) + { return(*(int *)0); } + +#undef menu_term +Menu_Hook menu_term( + const MENU *menu) + { return(*(Menu_Hook *)0); } + +#undef set_item_init +int set_item_init( + MENU *menu, + Menu_Hook func) + { return(*(int *)0); } + +#undef item_init +Menu_Hook item_init( + const MENU *menu) + { return(*(Menu_Hook *)0); } + +#undef set_item_term +int set_item_term( + MENU *menu, + Menu_Hook func) + { return(*(int *)0); } + +#undef item_term +Menu_Hook item_term( + const MENU *menu) + { return(*(Menu_Hook *)0); } + +/* ./m_item_cur.c */ + +#undef set_current_item +int set_current_item( + MENU *menu, + ITEM *item) + { return(*(int *)0); } + +#undef current_item +ITEM *current_item( + const MENU *menu) + { return(*(ITEM **)0); } + +#undef item_index +int item_index( + const ITEM *item) + { return(*(int *)0); } + +#undef set_top_row +int set_top_row( + MENU *menu, + int row) + { return(*(int *)0); } + +#undef top_row +int top_row( + const MENU *menu) + { return(*(int *)0); } + +/* ./m_item_nam.c */ + +#undef item_name +const char *item_name( + const ITEM *item) + { return(*(const char **)0); } + +#undef item_description +const char *item_description( + const ITEM *item) + { return(*(const char **)0); } + +/* ./m_item_new.c */ + +#undef new_item +ITEM *new_item( + const char *name, + const char *description) + { return(*(ITEM **)0); } + +#undef free_item +int free_item( + ITEM *item) + { return(*(int *)0); } + +#undef set_menu_mark +int set_menu_mark( + MENU *menu, + const char *mark) + { return(*(int *)0); } + +#undef menu_mark +const char *menu_mark( + const MENU *menu) + { return(*(const char **)0); } + +/* ./m_item_opt.c */ + +#undef set_item_opts +int set_item_opts( + ITEM *item, + Item_Options opts) + { return(*(int *)0); } + +#undef item_opts_off +int item_opts_off( + ITEM *item, + Item_Options opts) + { return(*(int *)0); } + +#undef item_opts_on +int item_opts_on( + ITEM *item, + Item_Options opts) + { return(*(int *)0); } + +#undef item_opts +Item_Options item_opts( + const ITEM *item) + { return(*(Item_Options *)0); } + +/* ./m_item_use.c */ + +#undef set_item_userptr +int set_item_userptr( + ITEM *item, + const void *userptr) + { return(*(int *)0); } + +#undef item_userptr +const void *item_userptr( + const ITEM *item) + { return(*(const void **)0); } + +/* ./m_item_val.c */ + +#undef set_item_value +int set_item_value( + ITEM *item, + bool value) + { return(*(int *)0); } + +#undef item_value +bool item_value( + const ITEM *item) + { return(*(bool *)0); } + +/* ./m_item_vis.c */ + +#undef item_visible +bool item_visible( + const ITEM *item) + { return(*(bool *)0); } + +/* ./m_items.c */ + +#undef set_menu_items +int set_menu_items( + MENU *menu, + ITEM **items) + { return(*(int *)0); } + +#undef menu_items +ITEM **menu_items( + const MENU *menu) + { return(*(ITEM ***)0); } + +#undef item_count +int item_count( + const MENU *menu) + { return(*(int *)0); } + +/* ./m_new.c */ + +#undef new_menu +MENU *new_menu( + ITEM **items) + { return(*(MENU **)0); } + +#undef free_menu +int free_menu( + MENU *menu) + { return(*(int *)0); } + +/* ./m_opts.c */ + +#undef set_menu_opts +int set_menu_opts( + MENU *menu, + Menu_Options opts) + { return(*(int *)0); } + +#undef menu_opts_off +int menu_opts_off( + MENU *menu, + Menu_Options opts) + { return(*(int *)0); } + +#undef menu_opts_on +int menu_opts_on( + MENU *menu, + Menu_Options opts) + { return(*(int *)0); } + +#undef menu_opts +Menu_Options menu_opts( + const MENU *menu) + { return(*(Menu_Options *)0); } + +/* ./m_post.c */ + +#undef _nc_Post_Item +void _nc_Post_Item( + const MENU *menu, + const ITEM *item) + { /* void */ } + +#undef _nc_Draw_Menu +void _nc_Draw_Menu( + const MENU *menu) + { /* void */ } + +#undef post_menu +int post_menu( + MENU *menu) + { return(*(int *)0); } + +#undef unpost_menu +int unpost_menu( + MENU *menu) + { return(*(int *)0); } + +/* ./m_req_name.c */ + +#undef menu_request_name +const char *menu_request_name( + int request) + { return(*(const char **)0); } + +#undef menu_request_by_name +int menu_request_by_name( + const char *str) + { return(*(int *)0); } + +/* ./m_spacing.c */ + +#undef set_menu_spacing +int set_menu_spacing( + MENU *menu, + int s_desc, + int s_row, + int s_col) + { return(*(int *)0); } + +#undef menu_spacing +int menu_spacing( + const MENU *menu, + int *s_desc, + int *s_row, + int *s_col) + { return(*(int *)0); } + +/* ./m_userptr.c */ + +#undef set_menu_userptr +int set_menu_userptr( + MENU *menu, + const void *userptr) + { return(*(int *)0); } + +#undef menu_userptr +const void *menu_userptr( + const MENU *menu) + { return(*(const void **)0); } + +/* ./m_win.c */ + +#undef set_menu_win +int set_menu_win( + MENU *menu, + WINDOW *win) + { return(*(int *)0); } + +#undef menu_win +WINDOW *menu_win( + const MENU *menu) + { return(*(WINDOW **)0); } + +#undef set_menu_sub +int set_menu_sub( + MENU *menu, + WINDOW *win) + { return(*(int *)0); } + +#undef menu_sub +WINDOW *menu_sub( + const MENU *menu) + { return(*(WINDOW **)0); } + +#undef scale_menu +int scale_menu( + const MENU *menu, + int *rows, + int *cols) + { return(*(int *)0); } + +/* ./m_adabind.c */ + +#undef _nc_ada_normalize_menu_opts +void _nc_ada_normalize_menu_opts( + int *opt) + { /* void */ } + +#undef _nc_ada_normalize_item_opts +void _nc_ada_normalize_item_opts( + int *opt) + { /* void */ } diff --git a/menu/m_adabind.c b/menu/m_adabind.c new file mode 100644 index 00000000..63735b3d --- /dev/null +++ b/menu/m_adabind.c @@ -0,0 +1,46 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module m_adabind.c * +* Helper routines to ease the implementation of an Ada95 binding to * +* ncurses. For details and copyright of the binding see the ../Ada95 * +* subdirectory. * +***************************************************************************/ +#include "menu.priv.h" + +MODULE_ID("$Id: m_adabind.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") + +/* Prototypes for the functions in this module */ +void _nc_ada_normalize_menu_opts (int *opt); +void _nc_ada_normalize_item_opts (int *opt); + + +void _nc_ada_normalize_menu_opts (int *opt) +{ + *opt = ALL_MENU_OPTS & (*opt); +} + +void _nc_ada_normalize_item_opts (int *opt) +{ + *opt = ALL_ITEM_OPTS & (*opt); +} diff --git a/menu/m_attribs.c b/menu/m_attribs.c new file mode 100644 index 00000000..00b18776 --- /dev/null +++ b/menu/m_attribs.c @@ -0,0 +1,172 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_attribs * +* Control menus display attributes * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_attribs.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") + +/* Macro to redraw menu if it is posted and changed */ +#define Refresh_Menu(menu) \ + if ( (menu) && ((menu)->status & _POSTED) )\ + {\ + _nc_Draw_Menu( menu );\ + _nc_Show_Menu( menu );\ + } + +/* "Template" macro to generate a function to set a menus attribute */ +#define GEN_MENU_ATTR_SET_FCT( name ) \ +int set_menu_ ## name (MENU * menu, chtype attr)\ +{\ + if (!(attr==A_NORMAL || (attr & A_ATTRIBUTES)==attr))\ + RETURN(E_BAD_ARGUMENT);\ + if (menu && ( menu -> name != attr))\ + {\ + (menu -> name) = attr;\ + Refresh_Menu(menu);\ + }\ + Normalize_Menu( menu ) -> name = attr;\ + RETURN(E_OK);\ +} + +/* "Template" macro to generate a function to get a menus attribute */ +#define GEN_MENU_ATTR_GET_FCT( name ) \ +chtype menu_ ## name (const MENU * menu)\ +{\ + return (Normalize_Menu( menu ) -> name);\ +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_fore(MENU *menu, chtype attr) +| +| Description : Set the attribute for selectable items. In single- +| valued menus thiis is used to highlight the current +| item ((i.e. where the cursor is), in multi-valued +| menus this is used to highlight the selected items. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - an invalid value has been passed ++--------------------------------------------------------------------------*/ +GEN_MENU_ATTR_SET_FCT( fore ) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : chtype menu_fore(const MENU* menu) +| +| Description : Return the attribute used for selectable items that +| are current (single-valued menu) or selected (multi- +| valued menu). +| +| Return Values : Attribute value ++--------------------------------------------------------------------------*/ +GEN_MENU_ATTR_GET_FCT( fore ) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_back(MENU *menu, chtype attr) +| +| Description : Set the attribute for selectable but not yet selected +| items. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - an invalid value has been passed ++--------------------------------------------------------------------------*/ +GEN_MENU_ATTR_SET_FCT( back ) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : chtype menu_back(const MENU *menu) +| +| Description : Return the attribute used for selectable but not yet +| selected items. +| +| Return Values : Attribute value ++--------------------------------------------------------------------------*/ +GEN_MENU_ATTR_GET_FCT( back ) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_grey(MENU *menu, chtype attr) +| +| Description : Set the attribute for unselectable items. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - an invalid value has been passed ++--------------------------------------------------------------------------*/ +GEN_MENU_ATTR_SET_FCT( grey ) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : chtype menu_grey(const MENU *menu) +| +| Description : Return the attribute used for non-selectable items +| +| Return Values : Attribute value ++--------------------------------------------------------------------------*/ +GEN_MENU_ATTR_GET_FCT( grey ) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_pad(MENU *menu, int pad) +| +| Description : Set the character to be used to separate the item name +| from its description. This must be a printable +| character. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - an invalid value has been passed ++--------------------------------------------------------------------------*/ +int set_menu_pad(MENU *menu, int pad) +{ + bool do_refresh = !(menu); + + if (!isprint((unsigned char)pad)) + RETURN(E_BAD_ARGUMENT); + + Normalize_Menu( menu ); + menu->pad = pad; + + if (do_refresh) + Refresh_Menu( menu ); + + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int menu_pad(const MENU *menu) +| +| Description : Return the value of the padding character +| +| Return Values : The pad character ++--------------------------------------------------------------------------*/ +int menu_pad(const MENU * menu) +{ + return (Normalize_Menu( menu ) -> pad); +} + +/* m_attribs.c ends here */ diff --git a/menu/m_cursor.c b/menu/m_cursor.c new file mode 100644 index 00000000..9ad0b12e --- /dev/null +++ b/menu/m_cursor.c @@ -0,0 +1,79 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_cursor * +* Correctly position a menus cursor * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_cursor.c,v 1.7 1997/05/01 16:47:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : pos_menu_cursor +| +| Description : Position logical cursor to current item in menu +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid menu +| E_NOT_POSTED - Menu is not posted ++--------------------------------------------------------------------------*/ +int pos_menu_cursor(const MENU * menu) +{ + if (!menu) + RETURN(E_BAD_ARGUMENT); + else + { + ITEM *item; + int x, y; + WINDOW *win, *sub; + + if ( !( menu->status & _POSTED ) ) + RETURN(E_NOT_POSTED); + + item = menu->curitem; + assert(item); + + x = item->x * (menu->spc_cols + menu->itemlen); + y = (item->y - menu->toprow) * menu->spc_rows; + win = menu->userwin ? menu->userwin : stdscr; + sub = menu->usersub ? menu->usersub : win; + assert(win && sub); + + if ((menu->opt & O_SHOWMATCH) && (menu->pindex > 0)) + x += ( menu->pindex + menu->marklen - 1); + + wmove(sub,y,x); + + if ( win != sub ) + { + wcursyncup(sub); + wsyncup(sub); + untouchwin(sub); + } + } + RETURN(E_OK); +} + +/* m_cursor.c ends here */ diff --git a/menu/m_driver.c b/menu/m_driver.c new file mode 100644 index 00000000..5e86843c --- /dev/null +++ b/menu/m_driver.c @@ -0,0 +1,512 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_driver and menu_pattern * +* Central dispatching routine and pattern matching handling * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_driver.c,v 1.8 1997/05/01 16:47:26 juergen Exp $") + +/* Macros */ + +/* Remove the last character from the match pattern buffer */ +#define Remove_Character_From_Pattern(menu) \ + (menu)->pattern[--((menu)->pindex)] = '\0' + +/* Add a new character to the match pattern buffer */ +#define Add_Character_To_Pattern(menu,ch) \ + { (menu)->pattern[((menu)->pindex)++] = (ch);\ + (menu)->pattern[(menu)->pindex] = '\0'; } + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : static bool Is_Sub_String( +| bool IgnoreCaseFlag, +| const char *part, +| const char *string) +| +| Description : Checks whether or not part is a substring of string. +| +| Return Values : TRUE - if it is a substring +| FALSE - if it is not a substring ++--------------------------------------------------------------------------*/ +static bool Is_Sub_String( + bool IgnoreCaseFlag, + const char *part, + const char *string + ) +{ + assert( part && string ); + if ( IgnoreCaseFlag ) + { + while(*string && *part) + { + if (toupper(*string++)!=toupper(*part)) break; + part++; + } + } + else + { + while( *string && *part ) + if (*part != *string++) break; + part++; + } + return ( (*part) ? FALSE : TRUE ); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : static int Match_Next_Character_In_Item_Name( +| MENU *menu, +| int ch, +| ITEM **item) +| +| Description : This internal routine is called for a menu positioned +| at an item with three different classes of characters: +| - a printable character; the character is added to +| the current pattern and the next item matching +| this pattern is searched. +| - NUL; the pattern stays as it is and the next item +| matching the pattern is searched +| - BS; the pattern stays as it is and the previous +| item matching the pattern is searched +| +| The item parameter contains on call a pointer to +| the item where the search starts. On return - if +| a match was found - it contains a pointer to the +| matching item. +| +| Return Values : E_OK - an item matching the pattern was found +| E_NO_MATCH - nothing found ++--------------------------------------------------------------------------*/ +static int Match_Next_Character_In_Item_Name(MENU *menu, int ch, ITEM **item) +{ + bool found = FALSE, passed = FALSE; + int idx, last; + + assert( menu && item && *item); + idx = (*item)->index; + + if (ch && ch!=BS) + { + /* if we become to long, we need no further checking : there can't be + a match ! */ + if ((menu->pindex+1) > menu->namelen) + RETURN(E_NO_MATCH); + + Add_Character_To_Pattern(menu,ch); + /* we artificially position one item back, because in the do...while + loop we start with the next item. This means, that with a new + pattern search we always start the scan with the actual item. If + we do a NEXT_PATTERN oder PREV_PATTERN search, we start with the + one after or before the actual item. */ + if (--idx < 0) + idx = menu->nitems-1; + } + + last = idx; /* this closes the cycle */ + + do{ + if (ch==BS) + { /* we have to go backward */ + if (--idx < 0) + idx = menu->nitems-1; + } + else + { /* otherwise we always go forward */ + if (++idx >= menu->nitems) + idx = 0; + } + if (Is_Sub_String((menu->opt & O_IGNORECASE) != 0, + menu->pattern, + menu->items[idx]->name.str) + ) + found = TRUE; + else + passed = TRUE; + } while (!found && (idx != last)); + + if (found) + { + if (!((idx==(*item)->index) && passed)) + { + *item = menu->items[idx]; + RETURN(E_OK); + } + /* This point is reached, if we fully cycled through the item list + and the only match we found is the starting item. With a NEXT_PATTERN + or PREV_PATTERN scan this means, that there was no additional match. + If we searched with an expanded new pattern, we should never reach + this point, because if the expanded pattern matches also the actual + item we will find it in the first attempt (passed==FALSE) and we + will never cycle through the whole item array. + */ + assert( ch==0 || ch==BS ); + } + else + { + if (ch && ch!=BS && menu->pindex>0) + { + /* if we had no match with a new pattern, we have to restore it */ + Remove_Character_From_Pattern(menu); + } + } + RETURN(E_NO_MATCH); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : char *menu_pattern(const MENU *menu) +| +| Description : Return the value of the pattern buffer. +| +| Return Values : NULL - if there is no pattern buffer allocated +| EmptyString - if there is a pattern buffer but no +| pattern is stored +| PatternString - as expected ++--------------------------------------------------------------------------*/ +char *menu_pattern(const MENU * menu) +{ + return (menu ? (menu->pattern ? menu->pattern : "") : (char *)0); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_pattern(MENU *menu, const char *p) +| +| Description : Set the match pattern for a menu and position to the +| first item that matches. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid menu or pattern pointer +| E_NOT_CONNECTED - no items connected to menu +| E_BAD_STATE - menu in user hook routine +| E_NO_MATCH - no item matches pattern ++--------------------------------------------------------------------------*/ +int set_menu_pattern(MENU *menu, const char *p) +{ + ITEM *matchitem; + int matchpos; + + if (!menu || !p) + RETURN(E_BAD_ARGUMENT); + + if (!(menu->items)) + RETURN(E_NOT_CONNECTED); + + if ( menu->status & _IN_DRIVER ) + RETURN(E_BAD_STATE); + + Reset_Pattern(menu); + + if (!(*p)) + { + pos_menu_cursor(menu); + RETURN(E_OK); + } + + if (menu->status & _LINK_NEEDED) + _nc_Link_Items(menu); + + matchpos = menu->toprow; + matchitem = menu->curitem; + assert(matchitem); + + while(*p) + { + if ( !isprint(*p) || + (Match_Next_Character_In_Item_Name(menu,*p,&matchitem) != E_OK) ) + { + Reset_Pattern(menu); + pos_menu_cursor(menu); + RETURN(E_NO_MATCH); + } + p++; + } + + /* This is reached if there was a match. So we position to the new item */ + Adjust_Current_Item(menu,matchpos,matchitem); + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int menu_driver(MENU *menu, int c) +| +| Description : Central dispatcher for the menu. Translates the logical +| request 'c' into a menu action. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid menu pointer +| E_BAD_STATE - menu is in user hook routine +| E_NOT_POSTED - menu is not posted ++--------------------------------------------------------------------------*/ +int menu_driver(MENU * menu, int c) +{ +#define NAVIGATE(dir) \ + if (!item->dir)\ + result = E_REQUEST_DENIED;\ + else\ + item = item->dir + + int result = E_OK; + ITEM *item; + int my_top_row, rdiff; + + if (!menu) + RETURN(E_BAD_ARGUMENT); + + if ( menu->status & _IN_DRIVER ) + RETURN(E_BAD_STATE); + if ( !( menu->status & _POSTED ) ) + RETURN(E_NOT_POSTED); + + my_top_row = menu->toprow; + item = menu->curitem; + assert(item); + + if ((c > KEY_MAX) && (c<=MAX_MENU_COMMAND)) + { + if (!((c==REQ_BACK_PATTERN) + || (c==REQ_NEXT_MATCH) || (c==REQ_PREV_MATCH))) + { + assert( menu->pattern ); + Reset_Pattern(menu); + } + + switch(c) + { + case REQ_LEFT_ITEM: + /*=================*/ + NAVIGATE(left); + break; + + case REQ_RIGHT_ITEM: + /*==================*/ + NAVIGATE(right); + break; + + case REQ_UP_ITEM: + /*===============*/ + NAVIGATE(up); + break; + + case REQ_DOWN_ITEM: + /*=================*/ + NAVIGATE(down); + break; + + case REQ_SCR_ULINE: + /*=================*/ + if (my_top_row == 0) + result = E_REQUEST_DENIED; + else + { + --my_top_row; + item = item->up; + } + break; + + case REQ_SCR_DLINE: + /*=================*/ + my_top_row++; + if ((menu->rows - menu->arows)>0) + { + /* only if the menu has less items than rows, we can deny the + request. Otherwise the epilogue of this routine adjusts the + top row if necessary */ + my_top_row--; + result = E_REQUEST_DENIED; + } + else + item = item->down; + break; + + case REQ_SCR_DPAGE: + /*=================*/ + rdiff = menu->rows - menu->arows - my_top_row; + if (rdiff > menu->arows) + rdiff = menu->arows; + if (rdiff==0) + result = E_REQUEST_DENIED; + else + { + my_top_row += rdiff; + while(rdiff-- > 0) + item = item->down; + } + break; + + case REQ_SCR_UPAGE: + /*=================*/ + rdiff = (menu->arows < my_top_row) ? + menu->arows : my_top_row; + if (rdiff==0) + result = E_REQUEST_DENIED; + else + { + my_top_row -= rdiff; + while(rdiff--) + item = item->up; + } + break; + + case REQ_FIRST_ITEM: + /*==================*/ + item = menu->items[0]; + break; + + case REQ_LAST_ITEM: + /*=================*/ + item = menu->items[menu->nitems-1]; + break; + + case REQ_NEXT_ITEM: + /*=================*/ + if ((item->index+1)>=menu->nitems) + { + if (menu->opt & O_NONCYCLIC) + result = E_REQUEST_DENIED; + else + item = menu->items[0]; + } + else + item = menu->items[item->index + 1]; + break; + + case REQ_PREV_ITEM: + /*=================*/ + if (item->index<=0) + { + if (menu->opt & O_NONCYCLIC) + result = E_REQUEST_DENIED; + else + item = menu->items[menu->nitems-1]; + } + else + item = menu->items[item->index - 1]; + break; + + case REQ_TOGGLE_ITEM: + /*===================*/ + if (menu->opt & O_ONEVALUE) + { + result = E_REQUEST_DENIED; + } + else + { + if (menu->curitem->opt & O_SELECTABLE) + { + menu->curitem->value = !menu->curitem->value; + Move_And_Post_Item(menu,menu->curitem); + _nc_Show_Menu(menu); + } + else + result = E_NOT_SELECTABLE; + } + break; + + case REQ_CLEAR_PATTERN: + /*=====================*/ + /* already cleared in prologue */ + break; + + case REQ_BACK_PATTERN: + /*====================*/ + if (menu->pindex>0) + { + assert(menu->pattern); + Remove_Character_From_Pattern(menu); + pos_menu_cursor( menu ); + } + else + result = E_REQUEST_DENIED; + break; + + case REQ_NEXT_MATCH: + /*==================*/ + assert(menu->pattern); + if (menu->pattern[0]) + result = Match_Next_Character_In_Item_Name(menu,0,&item); + else + { + if ((item->index+1)nitems) + item=menu->items[item->index+1]; + else + { + if (menu->opt & O_NONCYCLIC) + result = E_REQUEST_DENIED; + else + item = menu->items[0]; + } + } + break; + + case REQ_PREV_MATCH: + /*==================*/ + assert(menu->pattern); + if (menu->pattern[0]) + result = Match_Next_Character_In_Item_Name(menu,BS,&item); + else + { + if (item->index) + item = menu->items[item->index-1]; + else + { + if (menu->opt & O_NONCYCLIC) + result = E_REQUEST_DENIED; + else + item = menu->items[menu->nitems-1]; + } + } + break; + + default: + /*======*/ + result = E_UNKNOWN_COMMAND; + break; + } + } + else + { /* not a command */ + if ( !(c & ~((int)MAX_REGULAR_CHARACTER)) && isprint(c) ) + result = Match_Next_Character_In_Item_Name( menu, c, &item ); + else + result = E_UNKNOWN_COMMAND; + } + + /* Adjust the top row if it turns out that the current item unfortunately + doesn't appear in the menu window */ + if ( item->y < my_top_row ) + my_top_row = item->y; + else if ( item->y >= (my_top_row + menu->arows) ) + my_top_row = item->y - menu->arows + 1; + + _nc_New_TopRow_and_CurrentItem( menu, my_top_row, item ); + + RETURN(result); +} + +/* m_driver.c ends here */ diff --git a/menu/m_format.c b/menu/m_format.c new file mode 100644 index 00000000..71b974df --- /dev/null +++ b/menu/m_format.c @@ -0,0 +1,115 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_format * +* Set and get maximum numbers of rows and columns in menus * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_format.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") + +#define minimum(a,b) ((a)<(b) ? (a): (b)) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_format(MENU *menu, int rows, int cols) +| +| Description : Sets the maximum number of rows and columns of items +| that may be displayed at one time on a menu. If the +| menu contains more items than can be displayed at +| once, the menu will be scrollable. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid values passed +| E_NOT_CONNECTED - there are no items connected +| E_POSTED - the menu is already posted ++--------------------------------------------------------------------------*/ +int set_menu_format(MENU *menu, int rows, int cols) +{ + int total_rows, total_cols; + + if (rows<0 || cols<0) + RETURN(E_BAD_ARGUMENT); + + if (menu) + { + if ( menu->status & _POSTED ) + RETURN(E_POSTED); + + if (!(menu->items)) + RETURN(E_NOT_CONNECTED); + + if (rows==0) + rows = menu->frows; + if (cols==0) + cols = menu->fcols; + + if (menu->pattern) + Reset_Pattern(menu); + + menu->frows = rows; + menu->fcols = cols; + + assert(rows>0 && cols>0); + total_rows = (menu->nitems - 1)/cols + 1; + total_cols = (menu->status & O_ROWMAJOR) ? + minimum(menu->nitems,cols) : + (menu->nitems-1)/total_rows + 1; + + menu->rows = total_rows; + menu->cols = total_cols; + menu->arows = minimum(total_rows,rows); + menu->toprow = 0; + menu->curitem = *(menu->items); + assert(menu->curitem); + menu->status |= _LINK_NEEDED; + _nc_Calculate_Item_Length_and_Width(menu); + } + else + { + if (rows>0) _nc_Default_Menu.frows = rows; + if (cols>0) _nc_Default_Menu.fcols = cols; + } + + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : void menu_format(const MENU *menu, int *rows, int *cols) +| +| Description : Returns the maximum number of rows and columns that may +| be displayed at one time on menu. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +void menu_format(const MENU *menu, int *rows, int *cols) +{ + if (rows) + *rows = Normalize_Menu(menu)->frows; + if (cols) + *cols = Normalize_Menu(menu)->fcols; +} + +/* m_format.c ends here */ diff --git a/menu/m_global.c b/menu/m_global.c new file mode 100644 index 00000000..9d0ba0ac --- /dev/null +++ b/menu/m_global.c @@ -0,0 +1,473 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_global * +* Globally used internal routines and the default menu and item structures * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_global.c,v 1.7 1997/05/01 16:47:26 juergen Exp $") + +MENU _nc_Default_Menu = { + 16, /* Nr. of chars high */ + 1, /* Nr. of chars wide */ + 16, /* Nr. of items high */ + 1, /* Nr. of items wide */ + 16, /* Nr. of formatted items high */ + 1, /* Nr. of formatted items wide */ + 16, /* Nr. of items high (actual) */ + 0, /* length of widest name */ + 0, /* length of widest description */ + 1, /* length of mark */ + 1, /* length of one item */ + 1, /* Spacing for descriptor */ + 1, /* Spacing for columns */ + 1, /* Spacing for rows */ + (char *)0, /* buffer used to store match chars */ + 0, /* Index into pattern buffer */ + (WINDOW *)0, /* Window containing entire menu */ + (WINDOW *)0, /* Portion of menu displayed */ + (WINDOW *)0, /* User's window */ + (WINDOW *)0, /* User's subwindow */ + (ITEM **)0, /* List of items */ + 0, /* Total Nr. of items in menu */ + (ITEM *)0, /* Current item */ + 0, /* Top row of menu */ + (chtype)A_REVERSE, /* Attribute for selection */ + (chtype)A_NORMAL, /* Attribute for nonselection */ + (chtype)A_UNDERLINE, /* Attribute for inactive */ + ' ', /* Pad character */ + (Menu_Hook)0, /* Menu init */ + (Menu_Hook)0, /* Menu term */ + (Menu_Hook)0, /* Item init */ + (Menu_Hook)0, /* Item term */ + (void *)0, /* userptr */ + "-", /* mark */ + ALL_MENU_OPTS, /* options */ + 0 /* status */ +}; + +ITEM _nc_Default_Item = { + { (char *)0, 0 }, /* name */ + { (char *)0, 0 }, /* description */ + (MENU *)0, /* Pointer to parent menu */ + (char *)0, /* Userpointer */ + ALL_ITEM_OPTS, /* options */ + 0, /* Item Nr. */ + 0, /* y */ + 0, /* x */ + FALSE, /* value */ + (ITEM *)0, /* left */ + (ITEM *)0, /* right */ + (ITEM *)0, /* up */ + (ITEM *)0 /* down */ + }; + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : static void ComputeMaximum_NameDesc_Lenths(MENU *menu) +| +| Description : Calculates the maximum name and description lengths +| of the items connected to the menu +| +| Return Values : - ++--------------------------------------------------------------------------*/ +INLINE static void ComputeMaximum_NameDesc_Lengths(MENU * menu) +{ + unsigned MaximumNameLength = 0; + unsigned MaximumDescriptionLength = 0; + ITEM **items; + + assert(menu && menu->items); + for( items = menu->items; *items ; items++ ) + { + if (items[0]->name.length > MaximumNameLength ) + MaximumNameLength = items[0]->name.length; + + if (items[0]->description.length > MaximumDescriptionLength) + MaximumDescriptionLength = items[0]->description.length; + } + + menu->namelen = MaximumNameLength; + menu->desclen = MaximumDescriptionLength; +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : static void ResetConnectionInfo(MENU *, ITEM **) +| +| Description : Reset all informations in the menu and the items in +| the item array that indicates a connection +| +| Return Values : - ++--------------------------------------------------------------------------*/ +INLINE static void ResetConnectionInfo(MENU *menu, ITEM **items) +{ + ITEM **item; + + assert(menu && items); + for(item=items; *item; item++) + { + (*item)->index = 0; + (*item)->imenu = (MENU *)0; + } + if (menu->pattern) + free(menu->pattern); + menu->pattern = (char *)0; + menu->pindex = 0; + menu->items = (ITEM **)0; + menu->nitems = 0; +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : bool _nc_Connect_Items(MENU *menu, ITEM **items) +| +| Description : Connect the items in the item array to the menu. +| Decorate all the items with a number and a backward +| pointer to the menu. +| +| Return Values : TRUE - successfull connection +| FALSE - connection failed ++--------------------------------------------------------------------------*/ +bool _nc_Connect_Items(MENU *menu, ITEM **items) +{ + ITEM **item; + unsigned int ItemCount = 0; + + if ( menu && items ) + { + for(item=items; *item ; item++) + { + if ( (*item)->imenu ) + { + /* if a item is already connected, reject connection */ + break; + } + } + if (! (*item) ) + /* we reached the end, so there was no connected item */ + { + for(item=items; *item ; item++) + { + if (menu->opt & O_ONEVALUE) + { + (*item)->value = FALSE; + } + (*item)->index = ItemCount++; + (*item)->imenu = menu; + } + } + } + else + return(FALSE); + + if (ItemCount != 0) + { + menu->items = items; + menu->nitems = ItemCount; + ComputeMaximum_NameDesc_Lengths(menu); + if ( (menu->pattern = (char *)malloc( (unsigned)(1 + menu->namelen))) ) + { + Reset_Pattern(menu); + set_menu_format(menu,menu->frows,menu->fcols); + menu->curitem = *items; + menu->toprow = 0; + return(TRUE); + } + } + + /* If we fall through to this point, we have to reset all items connection + and inform about a reject connection */ + ResetConnectionInfo( menu, items ); + return(FALSE); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : void _nc_Disconnect_Items(MENU *menu) +| +| Description : Disconnect the menus item array from the menu +| +| Return Values : - ++--------------------------------------------------------------------------*/ +void _nc_Disconnect_Items(MENU * menu) +{ + if (menu && menu->items) + ResetConnectionInfo( menu, menu->items ); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : void _nc_Calculate_Item_Length_and_Width(MENU *menu) +| +| Description : Calculate the length of an item and the width of the +| whole menu. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +void _nc_Calculate_Item_Length_and_Width(MENU * menu) +{ + int l; + + assert(menu); + + menu->height = 1 + menu->spc_rows * (menu->arows - 1); + + l = menu->namelen + menu->marklen; + if ( (menu->opt & O_SHOWDESC) && (menu->desclen > 0) ) + l += (menu->desclen + menu->spc_desc); + + menu->itemlen = l; + l *= menu->cols; + l += (menu->cols-1)*menu->spc_cols; /* for the padding between the columns */ + menu->width = l; +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : void _nc_Link_Item(MENU *menu) +| +| Description : Statically calculate for every item its four neighbours. +| This depends on the orientation of the menu. This +| static aproach simplifies navigation in the menu a lot. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +void _nc_Link_Items(MENU * menu) +{ + if (menu && menu->items && *(menu->items)) + { + int i,j; + ITEM *item; + int Number_Of_Items = menu->nitems; + int col = 0, row = 0; + int Last_in_Row; + int Last_in_Column; + bool cycle = (menu->opt & O_NONCYCLIC) ? FALSE : TRUE; + + menu->status &= ~_LINK_NEEDED; + + if (menu->opt & O_ROWMAJOR) + { + int Number_Of_Columns = menu->cols; + + for(i=0; i < Number_Of_Items; i++) + { + item = menu->items[i]; + + Last_in_Row = row * Number_Of_Columns + (Number_Of_Columns-1); + + item->left = (col) ? + /* if we are not in the leftmost column, we can use the + predecessor in the items array */ + menu->items[i-1] : + (cycle ? menu->items[(Last_in_Row>=Number_Of_Items) ? + Number_Of_Items-1: + Last_in_Row] : + (ITEM *)0 ); + + item->right = ( (col < (Number_Of_Columns-1)) && + ((i+1) < Number_Of_Items) + ) ? + menu->items[i+1] : + ( cycle ? menu->items[row * Number_Of_Columns] : + (ITEM *)0 + ); + + Last_in_Column = (menu->rows-1) * Number_Of_Columns + col; + + item->up = (row) ? menu->items[i-Number_Of_Columns] : + (cycle ? menu->items[(Last_in_Column>=Number_Of_Items) ? + Number_Of_Items-1 : + Last_in_Column] : + (ITEM *)0); + + item->down = ( (i+Number_Of_Columns) < Number_Of_Items ) + ? + menu->items[i + Number_Of_Columns] : + (cycle ? menu->items[(row+1)rows ? + Number_Of_Items-1:col] : + (ITEM *)0); + item->x = col; + item->y = row; + if ( ++col == Number_Of_Columns ) + { + row++; + col = 0; + } + } + } + else + { + int Number_Of_Rows = menu->rows; + + for(j=0; jitems[i=(col * Number_Of_Rows + row)]; + + Last_in_Column = (menu->cols-1) * Number_Of_Rows + row; + + item->left = (col) ? + menu->items[i - Number_Of_Rows] : + (cycle ? (Last_in_Column >= Number_Of_Items ) ? + menu->items[Last_in_Column-Number_Of_Rows] : + menu->items[Last_in_Column] : + (ITEM *)0 ); + + item->right = ((i + Number_Of_Rows) items[i + Number_Of_Rows] : + (cycle ? menu->items[row] : (ITEM *)0); + + Last_in_Row = col * Number_Of_Rows + (Number_Of_Rows - 1); + + item->up = (row) ? + menu->items[i-1] : + (cycle ? + menu->items[(Last_in_Row>=Number_Of_Items) ? + Number_Of_Items-1: + Last_in_Row] : + (ITEM *)0); + + item->down = (row < (Number_Of_Rows-1)) + ? + (menu->items[((i+1)items[col * Number_Of_Rows] : + (ITEM *)0 + ); + + item->x = col; + item->y = row; + if ( (++row) == Number_Of_Rows ) + { + col++; + row = 0; + } + } + } + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : void _nc_Show_Menu(const MENU *menu) +| +| Description : Update the window that is associated with the menu +| +| Return Values : - ++--------------------------------------------------------------------------*/ +void _nc_Show_Menu(const MENU *menu) +{ + WINDOW *win; + int maxy, maxx; + + assert(menu); + if ( (menu->status & _POSTED) && !(menu->status & _IN_DRIVER) ) + { + /* adjust the internal subwindow to start on the current top */ + assert(menu->sub); + mvderwin(menu->sub,menu->spc_rows * menu->toprow,0); + win = Get_Menu_Window(menu); + + maxy = getmaxy(win); + maxx = getmaxx(win); + + if (menu->height < maxy) + maxy = menu->height; + if (menu->width < maxx) + maxx = menu->width; + + copywin(menu->sub,win,0,0,0,0,maxy-1,maxx-1,0); + pos_menu_cursor(menu); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : void _nc_New_TopRow_and_CurrentItem( +| MENU *menu, +| int new_toprow, +| ITEM *new_current_item) +| +| Description : Redisplay the menu so that the given row becomes the +| top row and the given item becomes the new current +| item. +| +| Return Values : - ++--------------------------------------------------------------------------*/ +void _nc_New_TopRow_and_CurrentItem(MENU *menu, int new_toprow, + ITEM *new_current_item) +{ + ITEM *cur_item; + bool mterm_called = FALSE; + bool iterm_called = FALSE; + + assert(menu); + if (menu->status & _POSTED) + { + if (new_current_item != menu->curitem) + { + Call_Hook(menu,itemterm); + iterm_called = TRUE; + } + if (new_toprow != menu->toprow) + { + Call_Hook(menu,menuterm); + mterm_called = TRUE; + } + + cur_item = menu->curitem; + assert(cur_item); + menu->toprow = new_toprow; + menu->curitem = new_current_item; + + if (mterm_called) + { + Call_Hook(menu,menuinit); + } + if (iterm_called) + { + /* this means, move from the old current_item to the new one... */ + Move_To_Current_Item( menu, cur_item ); + Call_Hook(menu,iteminit); + } + if (mterm_called || iterm_called) + { + _nc_Show_Menu(menu); + } + else + pos_menu_cursor(menu); + } + else + { /* if we are not posted, this is quite simple */ + menu->toprow = new_toprow; + menu->curitem = new_current_item; + } +} + +/* m_global.c ends here */ diff --git a/menu/m_hook.c b/menu/m_hook.c new file mode 100644 index 00000000..a30900cd --- /dev/null +++ b/menu/m_hook.c @@ -0,0 +1,139 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_hook * +* Assign application specific routines for automatic invocation by menus * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_hook.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") + +/* "Template" macro to generate function to set application specific hook */ +#define GEN_HOOK_SET_FUNCTION( typ, name ) \ +int set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\ +{\ + (Normalize_Menu(menu) -> typ ## name = func );\ + RETURN(E_OK);\ +} + +/* "Template" macro to generate function to get application specific hook */ +#define GEN_HOOK_GET_FUNCTION( typ, name ) \ +Menu_Hook typ ## _ ## name ( const MENU *menu )\ +{\ + return (Normalize_Menu(menu) -> typ ## name);\ +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_init(MENU *menu, void (*f)(MENU *)) +| +| Description : Set user-exit which is called when menu is posted +| or just after the top row changes. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +GEN_HOOK_SET_FUNCTION( menu, init ) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : void (*)(MENU *) menu_init(const MENU *menu) +| +| Description : Return address of user-exit function which is called +| when a menu is posted or just after the top row +| changes. +| +| Return Values : Menu init function address or NULL ++--------------------------------------------------------------------------*/ +GEN_HOOK_GET_FUNCTION( menu, init ) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_term (MENU *menu, void (*f)(MENU *)) +| +| Description : Set user-exit which is called when menu is unposted +| or just before the top row changes. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +GEN_HOOK_SET_FUNCTION( menu, term ) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : void (*)(MENU *) menu_term(const MENU *menu) +| +| Description : Return address of user-exit function which is called +| when a menu is unposted or just before the top row +| changes. +| +| Return Values : Menu finalization function address or NULL ++--------------------------------------------------------------------------*/ +GEN_HOOK_GET_FUNCTION( menu, term ) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_item_init (MENU *menu, void (*f)(MENU *)) +| +| Description : Set user-exit which is called when menu is posted +| or just after the current item changes. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +GEN_HOOK_SET_FUNCTION( item, init ) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : void (*)(MENU *) item_init (const MENU *menu) +| +| Description : Return address of user-exit function which is called +| when a menu is posted or just after the current item +| changes. +| +| Return Values : Item init function address or NULL ++--------------------------------------------------------------------------*/ +GEN_HOOK_GET_FUNCTION( item, init ) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_item_term (MENU *menu, void (*f)(MENU *)) +| +| Description : Set user-exit which is called when menu is unposted +| or just before the current item changes. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +GEN_HOOK_SET_FUNCTION( item, term ) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : void (*)(MENU *) item_init (const MENU *menu) +| +| Description : Return address of user-exit function which is called +| when a menu is unposted or just before the current item +| changes. +| +| Return Values : Item finalization function address or NULL ++--------------------------------------------------------------------------*/ +GEN_HOOK_GET_FUNCTION( item, term ) + +/* m_hook.c ends here */ diff --git a/menu/m_item_cur.c b/menu/m_item_cur.c new file mode 100644 index 00000000..9881666f --- /dev/null +++ b/menu/m_item_cur.c @@ -0,0 +1,156 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_item_cur * +* Set and get current menus item * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_item_cur.c,v 1.7 1997/05/01 16:47:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_current_item(MENU *menu, const ITEM *item) +| +| Description : Make the item the current item +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +int set_current_item(MENU * menu, ITEM * item) +{ + if (menu && item && (item->imenu==menu)) + { + if ( menu->status & _IN_DRIVER ) + RETURN(E_BAD_STATE); + + assert( menu->curitem ); + if (item != menu->curitem) + { + if (menu->status & _LINK_NEEDED) + { + /* + * Items are available, but they are not linked together. + * So we have to link here. + */ + _nc_Link_Items(menu); + } + assert(menu->pattern); + Reset_Pattern(menu); + /* adjust the window to make item visible and update the menu */ + Adjust_Current_Item(menu,menu->toprow,item); + } + } + else + RETURN(E_BAD_ARGUMENT); + + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : ITEM *current_item(const MENU *menu) +| +| Description : Return the menus current item +| +| Return Values : Item pointer or NULL if failure ++--------------------------------------------------------------------------*/ +ITEM *current_item(const MENU * menu) +{ + return (menu && menu->items) ? menu->curitem : (ITEM *)0; +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int item_index(const ITEM *) +| +| Description : Return the logical index of this item. +| +| Return Values : The index or ERR if this is an invalid item pointer ++--------------------------------------------------------------------------*/ +int item_index(const ITEM *item) +{ + return (item && item->imenu) ? item->index : ERR; +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_top_row(MENU *menu, int row) +| +| Description : Makes the speified row the top row in the menu +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - not a menu pointer or invalid row +| E_NOT_CONNECTED - there are no items for the menu ++--------------------------------------------------------------------------*/ +int set_top_row(MENU * menu, int row) +{ + ITEM *item; + + if (menu) + { + if ( menu->status & _IN_DRIVER ) + RETURN(E_BAD_STATE); + if (menu->items == (ITEM **)0) + RETURN(E_NOT_CONNECTED); + + if ((row<0) || (row > (menu->rows - menu->arows))) + RETURN(E_BAD_ARGUMENT); + } + else + RETURN(E_BAD_ARGUMENT); + + if (row != menu->toprow) + { + if (menu->status & _LINK_NEEDED) + _nc_Link_Items(menu); + + item = menu->items[ (menu->opt&O_ROWMAJOR) ? (row*menu->cols) : row ]; + assert(menu->pattern); + Reset_Pattern(menu); + _nc_New_TopRow_and_CurrentItem(menu, row, item); + } + + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int top_row(const MENU *) +| +| Description : Return the top row of the menu +| +| Return Values : The row number or ERR if there is no row ++--------------------------------------------------------------------------*/ +int top_row(const MENU * menu) +{ + if (menu && menu->items && *(menu->items)) + { + assert( (menu->toprow>=0) && (menu->toprow < menu->rows) ); + return menu->toprow; + } + else + return(ERR); +} + +/* m_item_cur.c ends here */ diff --git a/menu/m_item_nam.c b/menu/m_item_nam.c new file mode 100644 index 00000000..c18f9477 --- /dev/null +++ b/menu/m_item_nam.c @@ -0,0 +1,58 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_item_nam * +* Get menus item name and description * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_item_nam.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : char *item_name(const ITEM *item) +| +| Description : Return name of menu item +| +| Return Values : See above; returns NULL if item is invalid ++--------------------------------------------------------------------------*/ +const char *item_name(const ITEM * item) +{ + return ((item) ? item->name.str : (char *)0); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : char *item_description(const ITEM *item) +| +| Description : Returns description of item +| +| Return Values : See above; Returns NULL if item is invalid ++--------------------------------------------------------------------------*/ +const char *item_description(const ITEM * item) +{ + return ((item) ? item->description.str : (char *)0); +} + +/* m_item_nam.c ends here */ diff --git a/menu/m_item_new.c b/menu/m_item_new.c new file mode 100644 index 00000000..0d0e9844 --- /dev/null +++ b/menu/m_item_new.c @@ -0,0 +1,242 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_item_new * +* Create and destroy menu items * +* Set and get marker string for menu +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_item_new.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : bool Is_Printable_String(const char *s) +| +| Description : Checks whether or not the string contains only printable +| characters. +| +| Return Values : TRUE - if string is printable +| FALSE - if string contains non-printable characters ++--------------------------------------------------------------------------*/ +static bool Is_Printable_String(const char *s) +{ + assert(s); + while(*s) + { + if (!isprint((unsigned char)*s)) + return FALSE; + s++; + } + return TRUE; +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : ITEM *new_item(char *name, char *description) +| +| Description : Create a new item with name and description. Return +| a pointer to this new item. +| N.B.: an item must(!) have a name. +| +| Return Values : The item pointer or NULL if creation failed. ++--------------------------------------------------------------------------*/ +ITEM *new_item(const char *name, const char *description) +{ + ITEM *item; + + if ( !name || (*name == '\0') || !Is_Printable_String(name) ) + { + item = (ITEM *)0; + SET_ERROR( E_BAD_ARGUMENT ); + } + else + { + item = (ITEM *)calloc(1,sizeof(ITEM)); + if (item) + { + *item = _nc_Default_Item; /* hope we have struct assignment */ + + item->name.length = strlen(name); + item->name.str = (char *)malloc(1 + item->name.length); + if (item->name.str) + { + strcpy(item->name.str, name); + } + else + { + free(item); + SET_ERROR( E_SYSTEM_ERROR ); + return (ITEM *)0; + } + + if (description && (*description != '\0') && + Is_Printable_String(description)) + { + item->description.length = strlen(description); + item->description.str = + (char *)malloc(1 + item->description.length); + if (item->description.str) + { + strcpy(item->description.str, description); + } + else + { + free(item->name.str); + free(item); + SET_ERROR( E_SYSTEM_ERROR ); + return (ITEM *)0; + } + } + else + { + item->description.length = 0; + item->description.str = (char *)0; + } + } + else + SET_ERROR( E_SYSTEM_ERROR ); + } + return(item); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int free_item(ITEM *item) +| +| Description : Free the allocated storage for this item. +| N.B.: a connected item can't be freed. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid value has been passed +| E_CONNECTED - item is still connected to a menu ++--------------------------------------------------------------------------*/ +int free_item(ITEM * item) +{ + if (!item) + RETURN( E_BAD_ARGUMENT ); + + if (item->imenu) + RETURN( E_CONNECTED ); + + if (item->name.str) + free(item->name.str); + if (item->description.str) + free (item->description.str); + free(item); + + RETURN( E_OK ); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_mark( MENU *menu, const char *mark ) +| +| Description : Set the mark string used to indicate the current +| item (single-valued menu) or the selected items +| (multi-valued menu). +| The mark argument may be NULL, in which case no +| marker is used. +| This might be a little bit tricky, because this may +| affect the geometry of the menu, which we don't allow +| if it is already posted. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - an invalid value has been passed +| E_SYSTEM_ERROR - no memory to store mark ++--------------------------------------------------------------------------*/ +int set_menu_mark(MENU * menu, const char * mark) +{ + int l; + + if ( mark && (*mark != '\0') && Is_Printable_String(mark) ) + l = strlen(mark); + else + l = 0; + + if ( menu ) + { + char *old_mark = menu->mark; + unsigned short old_status = menu->status; + + if (menu->status & _POSTED) + { + /* If the menu is already posted, the geometry is fixed. Then + we can only accept a mark with exactly the same length */ + if (menu->marklen != l) + RETURN(E_BAD_ARGUMENT); + } + menu->marklen = l; + if (l) + { + menu->mark = (char *)malloc(l+1); + if (menu->mark) + { + strcpy(menu->mark, mark); + menu->status |= _MARK_ALLOCATED; + } + else + { + menu->mark = old_mark; + RETURN(E_SYSTEM_ERROR); + } + } + else + menu->mark = (char *)0; + + if ((old_status & _MARK_ALLOCATED) && old_mark) + free(old_mark); + + if (menu->status & _POSTED) + { + _nc_Draw_Menu( menu ); + _nc_Show_Menu( menu ); + } + else + { + /* Recalculate the geometry */ + _nc_Calculate_Item_Length_and_Width( menu ); + } + } + else + { + return set_menu_mark(&_nc_Default_Menu, mark); + } + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : char *menu_mark(const MENU *menu) +| +| Description : Return a pointer to the marker string +| +| Return Values : The marker string pointer or NULL if no marker defined ++--------------------------------------------------------------------------*/ +const char *menu_mark(const MENU * menu) +{ + return Normalize_Menu( menu )->mark; +} + +/* m_item_new.c */ diff --git a/menu/m_item_opt.c b/menu/m_item_opt.c new file mode 100644 index 00000000..0d30b08d --- /dev/null +++ b/menu/m_item_opt.c @@ -0,0 +1,133 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_item_opt * +* Menus item option routines * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_item_opt.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_item_opts(ITEM *item, Item_Options opts) +| +| Description : Set the options of the item. If there are relevant +| changes, the item is connected and the menu is posted, +| the menu will be redisplayed. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid item options ++--------------------------------------------------------------------------*/ +int set_item_opts(ITEM *item, Item_Options opts) +{ + if (opts & ~ALL_ITEM_OPTS) + RETURN(E_BAD_ARGUMENT); + + if (item) + { + if (item->opt != opts) + { + MENU *menu = item->imenu; + + item->opt = opts; + + if ((!(opts & O_SELECTABLE)) && item->value) + item->value = FALSE; + + if (menu && (menu->status & _POSTED)) + { + Move_And_Post_Item( menu, item ); + _nc_Show_Menu(menu); + } + } + } + else + _nc_Default_Item.opt = opts; + + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int item_opts_off(ITEM *item, Item_Options opts) +| +| Description : Switch of the options for this item. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid options ++--------------------------------------------------------------------------*/ +int item_opts_off(ITEM *item, Item_Options opts) +{ + ITEM *citem = item; /* use a copy because set_item_opts must detect + NULL item itself to adjust its behaviour */ + + if (opts & ~ALL_ITEM_OPTS) + RETURN(E_BAD_ARGUMENT); + else + { + Normalize_Item(citem); + opts = citem->opt & ~opts; + return set_item_opts( item, opts ); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int item_opts_on(ITEM *item, Item_Options opts) +| +| Description : Switch on the options for this item. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid options ++--------------------------------------------------------------------------*/ +int item_opts_on(ITEM *item, Item_Options opts) +{ + ITEM *citem = item; /* use a copy because set_item_opts must detect + NULL item itself to adjust its behaviour */ + + if (opts & ~ALL_ITEM_OPTS) + RETURN(E_BAD_ARGUMENT); + else + { + Normalize_Item(citem); + opts = citem->opt | opts; + return set_item_opts( item, opts ); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : Item_Options item_opts(const ITEM *item) +| +| Description : Switch of the options for this item. +| +| Return Values : Items options ++--------------------------------------------------------------------------*/ +Item_Options item_opts(const ITEM * item) +{ + return (ALL_ITEM_OPTS & Normalize_Item(item)->opt); +} + +/* m_item_opt.c ends here */ diff --git a/menu/m_item_use.c b/menu/m_item_use.c new file mode 100644 index 00000000..e4fcf15c --- /dev/null +++ b/menu/m_item_use.c @@ -0,0 +1,62 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_item_use * +* Associate application data with menu items * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_item_use.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_item_userptr(ITEM *item, const void *userptr) +| +| Description : Set the pointer that is reserved in any item to store +| application relevant informations. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +int set_item_userptr(ITEM * item, const void * userptr) +{ + Normalize_Item(item)->userptr = userptr; + RETURN( E_OK ); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : const void *item_userptr(const ITEM *item) +| +| Description : Return the pointer that is reserved in any item to store +| application relevant informations. +| +| Return Values : Value of the pointer. If no such pointer has been set, +| NULL is returned. ++--------------------------------------------------------------------------*/ +const void *item_userptr(const ITEM * item) +{ + return Normalize_Item(item)->userptr; +} + +/* m_item_use.c */ diff --git a/menu/m_item_val.c b/menu/m_item_val.c new file mode 100644 index 00000000..9bb79e59 --- /dev/null +++ b/menu/m_item_val.c @@ -0,0 +1,90 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_item_val * +* Set and get menus item values * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_item_val.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_item_value(ITEM *item, int value) +| +| Description : Programmatically set the items selection value. This is +| only allowed if the item is selectable at all and if +| it is not connected to a single-valued menu. +| If the item is connected to a posted menu, the menu +| will be redisplayed. +| +| Return Values : E_OK - success +| E_REQUEST_DENIED - not selectable or single valued menu ++--------------------------------------------------------------------------*/ +int set_item_value(ITEM *item, bool value) +{ + MENU *menu; + + if (item) + { + menu = item->imenu; + + if ((!(item->opt & O_SELECTABLE)) || + (menu && (menu->opt & O_ONEVALUE))) + RETURN(E_REQUEST_DENIED); + + if (item->value ^ value) + { + item->value = value ? TRUE : FALSE; + if (menu) + { + if (menu->status & _POSTED) + { + Move_And_Post_Item(menu,item); + _nc_Show_Menu(menu); + } + } + } + } + else + _nc_Default_Item.value = value; + + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : bool item_value(const ITEM *item) +| +| Description : Return the selection value of the item +| +| Return Values : TRUE - if item is selected +| FALSE - if item is not selected ++--------------------------------------------------------------------------*/ +bool item_value(const ITEM *item) +{ + return ((Normalize_Item(item)->value) ? TRUE : FALSE); +} + +/* m_item_val.c ends here */ diff --git a/menu/m_item_vis.c b/menu/m_item_vis.c new file mode 100644 index 00000000..cea7b7ef --- /dev/null +++ b/menu/m_item_vis.c @@ -0,0 +1,56 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_item_vis * +* Tell if menu item is visible * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_item_vis.c,v 1.6 1997/05/01 16:47:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : bool item_visible(const ITEM *item) +| +| Description : A item is visible if it currently appears in the +| subwindow of a posted menu. +| +| Return Values : TRUE if visible +| FALSE if invisible ++--------------------------------------------------------------------------*/ +bool item_visible(const ITEM * item) +{ + MENU *menu; + + if ( item && + (menu=item->imenu) && + (menu->status & _POSTED) && + ( (menu->toprow + menu->arows) > (item->y) ) && + ( item->y >= menu->toprow) ) + return TRUE; + else + return FALSE; +} + +/* m_item_vis.c ends here */ diff --git a/menu/m_items.c b/menu/m_items.c new file mode 100644 index 00000000..677a0110 --- /dev/null +++ b/menu/m_items.c @@ -0,0 +1,93 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_items * +* Connect and disconnect items to and from menus * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_items.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_items(MENU *menu, ITEM **items) +| +| Description : Sets the item pointer array connected to menu. +| +| Return Values : E_OK - success +| E_POSTED - menu is already posted +| E_CONNECTED - one or more items are already connected +| to another menu. +| E_BAD_ARGUMENT - An incorrect menu or item array was +| passed to the function ++--------------------------------------------------------------------------*/ +int set_menu_items(MENU * menu, ITEM ** items) +{ + if (!menu || (items && !(*items))) + RETURN(E_BAD_ARGUMENT); + + if ( menu->status & _POSTED ) + RETURN(E_POSTED); + + if (menu->items) + _nc_Disconnect_Items(menu); + + if (items) + { + if(!_nc_Connect_Items( menu, items )) + RETURN(E_CONNECTED); + } + + menu->items = items; + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : ITEM **menu_items(const MENU *menu) +| +| Description : Returns a pointer to the item pointer arry of the menu +| +| Return Values : NULL on error ++--------------------------------------------------------------------------*/ +ITEM **menu_items(const MENU *menu) +{ + return(menu ? menu->items : (ITEM **)0); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int item_count(const MENU *menu) +| +| Description : Get the number of items connected to the menu. If the +| menu pointer is NULL we return -1. +| +| Return Values : Number of items or -1 to indicate error. ++--------------------------------------------------------------------------*/ +int item_count(const MENU *menu) +{ + return(menu ? menu->nitems : -1); +} + +/* m_items.c ends here */ diff --git a/menu/m_new.c b/menu/m_new.c new file mode 100644 index 00000000..66837061 --- /dev/null +++ b/menu/m_new.c @@ -0,0 +1,97 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_new * +* Creation and destruction of new menus * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_new.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : MENU *new_menu(ITEM **items) +| +| Description : Creates a new menu connected to the item pointer +| array items and returns a pointer to the new menu. +| The new menu is initialized with the values from the +| default menu. +| +| Return Values : NULL on error ++--------------------------------------------------------------------------*/ +MENU *new_menu(ITEM ** items) +{ + MENU *menu = (MENU *)calloc(1,sizeof(MENU)); + + if (menu) + { + *menu = _nc_Default_Menu; + menu->rows = menu->frows; + menu->cols = menu->fcols; + if (items && *items) + { + if (!_nc_Connect_Items(menu,items)) + { + free(menu); + menu = (MENU *)0; + } + } + } + + if (!menu) + SET_ERROR(E_SYSTEM_ERROR); + + return(menu); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int free_menu(MENU *menu) +| +| Description : Disconnects menu from its associated item pointer +| array and frees the storage allocated for the menu. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - Invalid menu pointer passed +| E_POSTED - Menu is already posted ++--------------------------------------------------------------------------*/ +int free_menu(MENU * menu) +{ + if (!menu) + RETURN(E_BAD_ARGUMENT); + + if ( menu->status & _POSTED ) + RETURN(E_POSTED); + + if (menu->items) + _nc_Disconnect_Items(menu); + + if ((menu->status & _MARK_ALLOCATED) && menu->mark) + free(menu->mark); + + free(menu); + RETURN(E_OK); +} + +/* m_new.c ends here */ diff --git a/menu/m_opts.c b/menu/m_opts.c new file mode 100644 index 00000000..55085901 --- /dev/null +++ b/menu/m_opts.c @@ -0,0 +1,156 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_opts * +* Menus option routines * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_opts.c,v 1.6 1997/05/01 16:47:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_opts(MENU *menu, Menu_Options opts) +| +| Description : Set the options for this menu. If the new settings +| end up in a change of the geometry of the menu, it +| will be recalculated. This operation is forbidden if +| the menu is already posted. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid menu options +| E_POSTED - menu is already posted ++--------------------------------------------------------------------------*/ +int set_menu_opts(MENU * menu, Menu_Options opts) +{ + if (opts & ~ALL_MENU_OPTS) + RETURN(E_BAD_ARGUMENT); + + if (menu) + { + if ( menu->status & _POSTED ) + RETURN(E_POSTED); + + if ( (opts&O_ROWMAJOR) != (menu->opt&O_ROWMAJOR)) + { + /* we need this only if the layout really changed ... */ + if (menu->items && menu->items[0]) + { + menu->toprow = 0; + menu->curitem = menu->items[0]; + assert(menu->curitem); + set_menu_format( menu, menu->frows, menu->fcols ); + } + } + + menu->opt = opts; + + if (opts & O_ONEVALUE) + { + ITEM **item; + + if ( ((item=menu->items) != (ITEM**)0) ) + for(;*item;item++) + (*item)->value = FALSE; + } + + if (opts & O_SHOWDESC) /* this also changes the geometry */ + _nc_Calculate_Item_Length_and_Width( menu ); + } + else + _nc_Default_Menu.opt = opts; + + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int menu_opts_off(MENU *menu, Menu_Options opts) +| +| Description : Switch off the options for this menu. If the new settings +| end up in a change of the geometry of the menu, it +| will be recalculated. This operation is forbidden if +| the menu is already posted. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid options +| E_POSTED - menu is already posted ++--------------------------------------------------------------------------*/ +int menu_opts_off(MENU *menu, Menu_Options opts) +{ + MENU *cmenu = menu; /* use a copy because set_menu_opts must detect + NULL menu itself to adjust its behaviour */ + + if (opts & ~ALL_MENU_OPTS) + RETURN(E_BAD_ARGUMENT); + else + { + Normalize_Menu(cmenu); + opts = cmenu->opt & ~opts; + return set_menu_opts( menu, opts ); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int menu_opts_on(MENU *menu, Menu_Options opts) +| +| Description : Switch on the options for this menu. If the new settings +| end up in a change of the geometry of the menu, it +| will be recalculated. This operation is forbidden if +| the menu is already posted. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid menu options +| E_POSTED - menu is already posted ++--------------------------------------------------------------------------*/ +int menu_opts_on(MENU * menu, Menu_Options opts) +{ + MENU *cmenu = menu; /* use a copy because set_menu_opts must detect + NULL menu itself to adjust its behaviour */ + + if (opts & ~ALL_MENU_OPTS) + RETURN(E_BAD_ARGUMENT); + else + { + Normalize_Menu(cmenu); + opts = cmenu->opt | opts; + return set_menu_opts(menu, opts); + } +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : Menu_Options menu_opts(const MENU *menu) +| +| Description : Return the options for this menu. +| +| Return Values : Menu options ++--------------------------------------------------------------------------*/ +Menu_Options menu_opts(const MENU *menu) +{ + return (ALL_MENU_OPTS & Normalize_Menu( menu )->opt); +} + +/* m_opts.c ends here */ diff --git a/menu/m_post.c b/menu/m_post.c new file mode 100644 index 00000000..b9f0bd4a --- /dev/null +++ b/menu/m_post.c @@ -0,0 +1,356 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_post * +* Write or erase menus from associated subwindows * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_post.c,v 1.12 1997/05/01 16:47:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : void _nc_Post_Item(MENU *menu, ITEM *item) +| +| Description : Draw the item in the menus window at the current +| window position +| +| Return Values : - ++--------------------------------------------------------------------------*/ +void _nc_Post_Item(const MENU * menu, const ITEM * item) +{ + int i; + chtype ch; + int item_x, item_y; + int count = 0; + bool isfore = FALSE, isback=FALSE, isgrey = FALSE; + + assert(menu->win); + + getyx(menu->win,item_y,item_x); + + /* We need a marker iff + - it is a onevalued menu and it is the current item + - or it has a selection value + */ + wattron(menu->win,menu->back); + if (item->value || (item==menu->curitem)) + { + if (menu->marklen) + { + /* In a multi selection menu we use the fore attribute + for a selected marker that is not the current one. + This improves visualization of the menu, because now + always the 'normal' marker denotes the current + item. */ + if (!(menu->opt & O_ONEVALUE) && item->value && item!=menu->curitem) + { + wattron(menu->win,menu->fore); + isfore = TRUE; + } + waddstr(menu->win,menu->mark); + if (isfore) + { + wattron(menu->win,menu->fore); + isfore = FALSE; + } + } + } + else /* otherwise we have to wipe out the marker area */ + for(ch=' ',i=menu->marklen;i>0;i--) + waddch(menu->win,ch); + wattroff(menu->win,menu->back); + count += menu->marklen; + + /* First we have to calculate the attribute depending on selectability + and selection status + */ + if (!(item->opt & O_SELECTABLE)) + { + wattron(menu->win,menu->grey); + isgrey = TRUE; + } + else + { + if (item->value || item==menu->curitem) + { + wattron(menu->win,menu->fore); + isfore = TRUE; + } + else + { + wattron(menu->win,menu->back); + isback = TRUE; + } + } + + waddnstr(menu->win,item->name.str,item->name.length); + for(ch=' ',i=menu->namelen-item->name.length;i>0;i--) + { + waddch(menu->win,ch); + } + count += menu->namelen; + + /* Show description if required and available */ + if ( (menu->opt & O_SHOWDESC) && menu->desclen>0 ) + { + int m = menu->spc_desc/2; + int cy = -1, cx = -1; + + for(ch=' ',i=0; i < menu->spc_desc; i++) + { + if (i==m) + { + waddch(menu->win,menu->pad); + getyx(menu->win,cy,cx); + } + else + waddch(menu->win,ch); + } + if (item->description.length) + waddnstr(menu->win,item->description.str,item->description.length); + for(ch=' ',i=menu->desclen-item->description.length; i>0; i--) + { + waddch(menu->win,ch); + } + count += menu->desclen + menu->spc_desc; + + if (menu->spc_rows > 1) + { + int j, k, ncy, ncx; + + assert(cx>=0 && cy>=0); + getyx(menu->win,ncy,ncx); + if (isgrey) wattroff(menu->win,menu->grey); + else if (isfore) wattroff(menu->win,menu->fore); + wattron(menu->win,menu->back); + for(j=1; j < menu->spc_rows;j++) + { + if ((item_y+j) < getmaxy(menu->win)) + { + wmove (menu->win,item_y+j,item_x); + for(k=0;kwin,' '); + } + if ((cy+j) < getmaxy(menu->win)) + mvwaddch(menu->win,cy+j,cx-1,menu->pad); + } + wmove(menu->win,ncy,ncx); + if (!isback) + wattroff(menu->win,menu->back); + } + } + + /* Remove attributes */ + if (isfore) + wattroff(menu->win,menu->fore); + if (isback) + wattroff(menu->win,menu->back); + if (isgrey) + wattroff(menu->win,menu->grey); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : void _nc_Draw_Menu(const MENU *) +| +| Description : Display the menu in its windows +| +| Return Values : - ++--------------------------------------------------------------------------*/ +void _nc_Draw_Menu(const MENU * menu) +{ + ITEM *item = menu->items[0]; + ITEM *lasthor, *lastvert; + ITEM *hitem; + int y = 0; + chtype s_bkgd; + + assert(item && menu->win); + + s_bkgd = getbkgd(menu->win); + wbkgdset(menu->win,menu->back); + werase(menu->win); + wbkgdset(menu->win,s_bkgd); + + lastvert = (menu->opt & O_NONCYCLIC) ? (ITEM *)0 : item; + + do + { + wmove(menu->win,y,0); + + hitem = item; + lasthor = (menu->opt & O_NONCYCLIC) ? (ITEM *)0 : hitem; + + do + { + _nc_Post_Item( menu, hitem); + + wattron(menu->win,menu->back); + if ( ((hitem = hitem->right) != lasthor) && hitem ) + { + int i,j, cy, cx; + chtype ch = ' '; + + getyx(menu->win,cy,cx); + for(j=0;jspc_rows;j++) + { + wmove(menu->win,cy+j,cx); + for(i=0; i < menu->spc_cols; i++) + { + waddch( menu->win,ch); + } + } + wmove(menu->win,cy,cx+menu->spc_cols); + } + } while (hitem && (hitem != lasthor)); + wattroff(menu->win,menu->back); + + item = item->down; + y += menu->spc_rows; + + } while( item && (item != lastvert) ); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int post_menu(MENU *) +| +| Description : Post a menu to the screen. This makes it visible. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - not a valid menu pointer +| E_SYSTEM_ERROR - error in lower layers +| E_NO_ROOM - Menu to large for screen +| E_NOT_CONNECTED - No items connected to menu +| E_BAD_STATE - Menu in userexit routine +| E_POSTED - Menu already posted ++--------------------------------------------------------------------------*/ +int post_menu(MENU * menu) +{ + if (!menu) + RETURN(E_BAD_ARGUMENT); + + if ( menu->status & _IN_DRIVER ) + RETURN(E_BAD_STATE); + + if ( menu->status & _POSTED ) + RETURN(E_POSTED); + + if (menu->items && *(menu->items)) + { + int y; + int h = 1 + menu->spc_rows * (menu->rows - 1); + + WINDOW *win = Get_Menu_Window(menu); + int maxy = getmaxy(win); + int maxx = getmaxx(win); + + if (maxx < menu->width || maxy < menu->height) + RETURN(E_NO_ROOM); + + if ( (menu->win = newpad(h,menu->width)) ) + { + y = (maxy >= h) ? h : maxy; + if (y>=menu->height) + y = menu->height; + if(!(menu->sub = subpad(menu->win,y,menu->width,0,0))) + RETURN(E_SYSTEM_ERROR); + } + else + RETURN(E_SYSTEM_ERROR); + + if (menu->status & _LINK_NEEDED) + _nc_Link_Items(menu); + } + else + RETURN(E_NOT_CONNECTED); + + menu->status |= _POSTED; + + if (!(menu->opt&O_ONEVALUE)) + { + ITEM **items; + + for(items=menu->items;*items;items++) + { + (*items)->value = FALSE; + } + } + + _nc_Draw_Menu(menu); + + Call_Hook(menu,menuinit); + Call_Hook(menu,iteminit); + + _nc_Show_Menu(menu); + + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int unpost_menu(MENU *) +| +| Description : Detach menu from screen +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - not a valid menu pointer +| E_BAD_STATE - menu in userexit routine +| E_NOT_POSTED - menu is not posted ++--------------------------------------------------------------------------*/ +int unpost_menu(MENU * menu) +{ + WINDOW *win; + + if (!menu) + RETURN(E_BAD_ARGUMENT); + + if ( menu->status & _IN_DRIVER ) + RETURN(E_BAD_STATE); + + if ( !( menu->status & _POSTED ) ) + RETURN(E_NOT_POSTED); + + Call_Hook(menu,itemterm); + Call_Hook(menu,menuterm); + + win = Get_Menu_Window(menu); + werase(win); + wsyncup(win); + + assert(menu->sub); + delwin(menu->sub); + menu->sub = (WINDOW *)0; + + assert(menu->win); + delwin(menu->win); + menu->win = (WINDOW *)0; + + menu->status &= ~_POSTED; + + RETURN(E_OK); +} + +/* m_post.c ends here */ diff --git a/menu/m_req_name.c b/menu/m_req_name.c new file mode 100644 index 00000000..13c9e31f --- /dev/null +++ b/menu/m_req_name.c @@ -0,0 +1,109 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_request_name * +* Routines to handle external names of menu requests * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_req_name.c,v 1.8 1997/05/01 16:47:26 juergen Exp $") + +static const char *request_names[ MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1 ] = { + "LEFT_ITEM" , + "RIGHT_ITEM" , + "UP_ITEM" , + "DOWN_ITEM" , + "SCR_ULINE" , + "SCR_DLINE" , + "SCR_DPAGE" , + "SCR_UPAGE" , + "FIRST_ITEM" , + "LAST_ITEM" , + "NEXT_ITEM" , + "PREV_ITEM" , + "TOGGLE_ITEM" , + "CLEAR_PATTERN", + "BACK_PATTERN" , + "NEXT_MATCH" , + "PREV_MATCH" +}; +#define A_SIZE (sizeof(request_names)/sizeof(request_names[0])) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : const char * menu_request_name (int request); +| +| Description : Get the external name of a menu request. +| +| Return Values : Pointer to name - on success +| NULL - on invalid request code ++--------------------------------------------------------------------------*/ +const char *menu_request_name( int request ) +{ + if ( (request < MIN_MENU_COMMAND) || (request > MAX_MENU_COMMAND) ) + { + SET_ERROR(E_BAD_ARGUMENT); + return (const char *)0; + } + else + return request_names[ request - MIN_MENU_COMMAND ]; +} + + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int menu_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 menu_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 | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_spacing * +* Routines to handle spacing between entries * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_spacing.c,v 1.7 1997/05/01 16:47:26 juergen Exp $") + +#define MAX_SPC_DESC ((TABSIZE) ? (TABSIZE) : 8) +#define MAX_SPC_COLS ((TABSIZE) ? (TABSIZE) : 8) +#define MAX_SPC_ROWS (3) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_spacing(MENU *menu,int desc, int r, int c); +| +| Description : Set the spacing between entried +| +| Return Values : E_OK - on success ++--------------------------------------------------------------------------*/ +int set_menu_spacing(MENU *menu, int s_desc, int s_row, int s_col ) +{ + MENU *m; /* split for ATAC workaround */ + m = Normalize_Menu(menu); + + assert(m); + if (m->status & _POSTED) + RETURN(E_POSTED); + + if (((s_desc < 0) || (s_desc > MAX_SPC_DESC)) || + ((s_row < 0) || (s_row > MAX_SPC_ROWS)) || + ((s_col < 0) || (s_col > MAX_SPC_COLS))) + RETURN(E_BAD_ARGUMENT); + + m->spc_desc = s_desc ? s_desc : 1; + m->spc_rows = s_row ? s_row : 1; + m->spc_cols = s_col ? s_col : 1; + _nc_Calculate_Item_Length_and_Width(m); + + RETURN(E_OK); +} + + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int menu_spacing (const MENU *,int *,int *,int *); +| +| Description : Retrieve info about spacing between the entries +| +| Return Values : E_OK - on success ++--------------------------------------------------------------------------*/ +int menu_spacing( const MENU *menu, int* s_desc, int* s_row, int* s_col) +{ + const MENU *m; /* split for ATAC workaround */ + m = Normalize_Menu(menu); + + assert(m); + if (s_desc) *s_desc = m->spc_desc; + if (s_row) *s_row = m->spc_rows; + if (s_col) *s_col = m->spc_cols; + + RETURN(E_OK); +} + +/* m_spacing.c ends here */ diff --git a/menu/m_userptr.c b/menu/m_userptr.c new file mode 100644 index 00000000..9ac73b9f --- /dev/null +++ b/menu/m_userptr.c @@ -0,0 +1,62 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_userptr * +* Associate application data with menus * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_userptr.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_userptr(MENU *menu, const void *userptr) +| +| Description : Set the pointer that is reserved in any menu to store +| application relevant informations. +| +| Return Values : E_OK - success ++--------------------------------------------------------------------------*/ +int set_menu_userptr(MENU * menu, const void * userptr) +{ + Normalize_Menu(menu)->userptr = userptr; + RETURN( E_OK ); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : char *menu_userptr(const MENU *menu) +| +| Description : Return the pointer that is reserved in any menu to +| store application relevant informations. +| +| Return Values : Value of the pointer. If no such pointer has been set, +| NULL is returned ++--------------------------------------------------------------------------*/ +const void *menu_userptr(const MENU * menu) +{ + return( Normalize_Menu(menu)->userptr); +} + +/* m_userptr.c ends here */ diff --git a/menu/m_win.c b/menu/m_win.c new file mode 100644 index 00000000..2cc5c236 --- /dev/null +++ b/menu/m_win.c @@ -0,0 +1,136 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_win * +* Menus window and subwindow association routines * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_win.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_win(MENU *menu, WINDOW *win) +| +| Description : Sets the window of the menu. +| +| Return Values : E_OK - success +| E_POSTED - menu is already posted ++--------------------------------------------------------------------------*/ +int set_menu_win(MENU *menu, WINDOW *win) +{ + if (menu) + { + if ( menu->status & _POSTED ) + RETURN(E_POSTED); + menu->userwin = win; + _nc_Calculate_Item_Length_and_Width(menu); + } + else + _nc_Default_Menu.userwin = win; + + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : WINDOW *menu_win(const MENU *) +| +| Description : Returns pointer to the window of the menu +| +| Return Values : NULL on error, otherwise pointer to window ++--------------------------------------------------------------------------*/ +WINDOW *menu_win(const MENU *menu) +{ + const MENU* m = Normalize_Menu(menu); + return (m->userwin ? m->userwin : stdscr); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_sub(MENU *menu, WINDOW *win) +| +| Description : Sets the subwindow of the menu. +| +| Return Values : E_OK - success +| E_POSTED - menu is already posted ++--------------------------------------------------------------------------*/ +int set_menu_sub(MENU *menu, WINDOW *win) +{ + if (menu) + { + if ( menu->status & _POSTED ) + RETURN(E_POSTED); + menu->usersub = win; + _nc_Calculate_Item_Length_and_Width(menu); + } + else + _nc_Default_Menu.usersub = win; + + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : WINDOW *menu_sub(const MENU *menu) +| +| Description : Returns a pointer to the subwindow of the menu +| +| Return Values : NULL on error, otherwise a pointer to the window ++--------------------------------------------------------------------------*/ +WINDOW *menu_sub(const MENU * menu) +{ + const MENU* m = Normalize_Menu(menu); + return Get_Menu_Window(m); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int scale_menu(const MENU *menu) +| +| Description : Returns the minimum window size necessary for the +| subwindow of menu. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid menu pointer +| E_NOT_CONNECTED - no items are connected to menu ++--------------------------------------------------------------------------*/ +int scale_menu(const MENU *menu, int *rows, int *cols) +{ + if (!menu) + RETURN( E_BAD_ARGUMENT ); + + if (menu->items && *(menu->items)) + { + if (rows) + *rows = menu->height; + if (cols) + *cols = menu->width; + RETURN(E_OK); + } + else + RETURN( E_NOT_CONNECTED ); +} + +/* m_win.c ends here */ diff --git a/menu/menu.h b/menu/menu.h new file mode 100644 index 00000000..b63c7406 --- /dev/null +++ b/menu/menu.h @@ -0,0 +1,240 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +#ifndef ETI_MENU +#define ETI_MENU + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int Menu_Options; +typedef int Item_Options; + +/* Menu options: */ +#define O_ONEVALUE (0x01) +#define O_SHOWDESC (0x02) +#define O_ROWMAJOR (0x04) +#define O_IGNORECASE (0x08) +#define O_SHOWMATCH (0x10) +#define O_NONCYCLIC (0x20) + +/* Item options: */ +#define O_SELECTABLE (0x01) + +typedef struct +{ + char* str; + unsigned short length; +} TEXT; + +typedef struct tagITEM +{ + TEXT name; /* name of menu item */ + TEXT description; /* description of item, optional in display */ + struct tagMENU *imenu; /* Pointer to parent menu */ + const void *userptr; /* Pointer to user defined per item data */ + Item_Options opt; /* Item options */ + short index; /* Item number if connected to a menu */ + short y; /* y and x location of item in menu */ + short x; + bool value; /* Selection value */ + + struct tagITEM *left; /* neighbour items */ + struct tagITEM *right; + struct tagITEM *up; + struct tagITEM *down; + +} ITEM; + +typedef void (*Menu_Hook)(struct tagMENU *); + +typedef struct tagMENU +{ + short height; /* Nr. of chars high */ + short width; /* Nr. of chars wide */ + short rows; /* Nr. of items high */ + short cols; /* Nr. of items wide */ + short frows; /* Nr. of formatted items high */ + short fcols; /* Nr. of formatted items wide */ + short arows; /* Nr. of items high (actual) */ + short namelen; /* Max. name length */ + short desclen; /* Max. description length */ + short marklen; /* Length of mark, if any */ + short itemlen; /* Length of one item */ + short spc_desc; /* Spacing for descriptor */ + short spc_cols; /* Spacing for columns */ + short spc_rows; /* Spacing for rows */ + char *pattern; /* Buffer to store match chars */ + short pindex; /* Index into pattern buffer */ + WINDOW *win; /* Window containing menu */ + WINDOW *sub; /* Subwindow for menu display */ + WINDOW *userwin; /* User's window */ + WINDOW *usersub; /* User's subwindow */ + ITEM **items; /* array of items */ + short nitems; /* Nr. of items in menu */ + ITEM *curitem; /* Current item */ + short toprow; /* Top row of menu */ + chtype fore; /* Selection attribute */ + chtype back; /* Nonselection attribute */ + chtype grey; /* Inactive attribute */ + unsigned char pad; /* Pad character */ + + Menu_Hook menuinit; /* User hooks */ + Menu_Hook menuterm; + Menu_Hook iteminit; + Menu_Hook itemterm; + + const void *userptr; /* Pointer to menus user data */ + char *mark; /* Pointer to marker string */ + + Menu_Options opt; /* Menu options */ + unsigned short status; /* Internal state of menu */ + +} MENU; + + +/* Define keys */ + +#define REQ_LEFT_ITEM (KEY_MAX + 1) +#define REQ_RIGHT_ITEM (KEY_MAX + 2) +#define REQ_UP_ITEM (KEY_MAX + 3) +#define REQ_DOWN_ITEM (KEY_MAX + 4) +#define REQ_SCR_ULINE (KEY_MAX + 5) +#define REQ_SCR_DLINE (KEY_MAX + 6) +#define REQ_SCR_DPAGE (KEY_MAX + 7) +#define REQ_SCR_UPAGE (KEY_MAX + 8) +#define REQ_FIRST_ITEM (KEY_MAX + 9) +#define REQ_LAST_ITEM (KEY_MAX + 10) +#define REQ_NEXT_ITEM (KEY_MAX + 11) +#define REQ_PREV_ITEM (KEY_MAX + 12) +#define REQ_TOGGLE_ITEM (KEY_MAX + 13) +#define REQ_CLEAR_PATTERN (KEY_MAX + 14) +#define REQ_BACK_PATTERN (KEY_MAX + 15) +#define REQ_NEXT_MATCH (KEY_MAX + 16) +#define REQ_PREV_MATCH (KEY_MAX + 17) + +#define MIN_MENU_COMMAND (KEY_MAX + 1) +#define MAX_MENU_COMMAND (KEY_MAX + 17) + +/* + * Some AT&T code expects MAX_COMMAND to be out-of-band not + * just for menu commands but for forms ones as well. + */ +#if defined(MAX_COMMAND) +# if (MAX_MENU_COMMAND > MAX_COMMAND) +# error Something is wrong -- MAX_MENU_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 + + +/* --------- prototypes for libmenu functions ----------------------------- */ + +extern ITEM **menu_items(const MENU *), + *current_item(const MENU *), + *new_item(const char *,const char *); + +extern MENU *new_menu(ITEM **); + +extern Item_Options item_opts(const ITEM *); +extern Menu_Options menu_opts(const MENU *); + +Menu_Hook item_init(const MENU *), + item_term(const MENU *), + menu_init(const MENU *), + menu_term(const MENU *); + +extern WINDOW *menu_sub(const MENU *), + *menu_win(const MENU *); + +extern const char *item_description(const ITEM *), + *item_name(const ITEM *), + *menu_mark(const MENU *), + *menu_request_name(int); + +extern char *menu_pattern(const MENU *); + +extern const void *menu_userptr(const MENU *), + *item_userptr(const ITEM *); + +extern chtype menu_back(const MENU *), + menu_fore(const MENU *), + menu_grey(const MENU *); + +extern int free_item(ITEM *), + free_menu(MENU *), + item_count(const MENU *), + item_index(const ITEM *), + item_opts_off(ITEM *,Item_Options), + item_opts_on(ITEM *,Item_Options), + menu_driver(MENU *,int), + menu_opts_off(MENU *,Menu_Options), + menu_opts_on(MENU *,Menu_Options), + menu_pad(const MENU *), + pos_menu_cursor(const MENU *), + post_menu(MENU *), + scale_menu(const MENU *,int *,int *), + set_current_item(MENU *menu,ITEM *item), + set_item_init(MENU *,void(*)(MENU *)), + set_item_opts(ITEM *,Item_Options), + set_item_term(MENU *,void(*)(MENU *)), + set_item_userptr(ITEM *, const void *), + set_item_value(ITEM *,bool), + set_menu_back(MENU *,chtype), + set_menu_fore(MENU *,chtype), + set_menu_format(MENU *,int,int), + set_menu_grey(MENU *,chtype), + set_menu_init(MENU *,void(*)(MENU *)), + set_menu_items(MENU *,ITEM **), + set_menu_mark(MENU *, const char *), + set_menu_opts(MENU *,Menu_Options), + set_menu_pad(MENU *,int), + set_menu_pattern(MENU *,const char *), + set_menu_sub(MENU *,WINDOW *), + set_menu_term(MENU *,void(*)(MENU *)), + set_menu_userptr(MENU *,const void *), + set_menu_win(MENU *,WINDOW *), + set_top_row(MENU *,int), + top_row(const MENU *), + unpost_menu(MENU *), + menu_request_by_name(const char *), + set_menu_spacing(MENU *,int,int,int), + menu_spacing(const MENU *,int *,int *,int *); + + +extern bool item_value(const ITEM *), + item_visible(const ITEM *); + +void menu_format(const MENU *,int *,int *); + +#ifdef __cplusplus + } +#endif + +#endif /* ETI_MENU */ diff --git a/menu/menu.priv.h b/menu/menu.priv.h new file mode 100644 index 00000000..e478e0c0 --- /dev/null +++ b/menu/menu.priv.h @@ -0,0 +1,99 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu.priv.h * +* Top level private header file for all libnmenu modules * +***************************************************************************/ + +#include "mf_common.h" +#include "menu.h" + +/* Backspace code */ +#define BS (8) + +extern ITEM _nc_Default_Item; +extern MENU _nc_Default_Menu; + +/* Normalize item to default if none was given */ +#define Normalize_Item( item ) ((item)=(item)?(item):&_nc_Default_Item) + +/* Normalize menu to default if none was given */ +#define Normalize_Menu( menu ) ((menu)=(menu)?(menu):&_nc_Default_Menu) + +/* Normalize menu window */ +#define Get_Menu_Window( menu ) \ + ( (menu)->usersub ? (menu)->usersub : (\ + (menu)->userwin ? (menu)->userwin : stdscr )) + +/* menu specific status flags */ +#define _LINK_NEEDED (0x04) +#define _MARK_ALLOCATED (0x08) + +#define ALL_MENU_OPTS ( \ + O_ONEVALUE | \ + O_SHOWDESC | \ + O_ROWMAJOR | \ + O_IGNORECASE | \ + O_SHOWMATCH | \ + O_NONCYCLIC ) + +#define ALL_ITEM_OPTS (O_SELECTABLE) + +/* Move to the window position of an item and draw it */ +#define Move_And_Post_Item(menu,item) \ + {wmove((menu)->win,(menu)->spc_rows*(item)->y,((menu)->itemlen+(menu)->spc_cols)*(item)->x);\ + _nc_Post_Item((menu),(item));} + +#define Move_To_Current_Item(menu,item) \ + if ( (item) != (menu)->curitem)\ + {\ + Move_And_Post_Item(menu,item);\ + Move_And_Post_Item(menu,(menu)->curitem);\ + } + +/* This macro ensures, that the item becomes visible, if possible with the + specified row as the top row of the window. If this is not possible, + the top row will be adjusted and the value is stored in the row argument. +*/ +#define Adjust_Current_Item(menu,row,item) \ + { if ((item)->y < row) \ + row = (item)->y;\ + if ( (item)->y >= (row + (menu)->arows) )\ + row = ( (item)->y < ((menu)->rows - row) ) ? \ + (item)->y : (menu)->rows - (menu)->arows;\ + _nc_New_TopRow_and_CurrentItem(menu,row,item); } + +/* Reset the match pattern buffer */ +#define Reset_Pattern(menu) \ + { (menu)->pindex = 0; \ + (menu)->pattern[0] = '\0'; } + +/* Internal functions. */ +extern void _nc_Draw_Menu(const MENU *); +extern void _nc_Show_Menu(const MENU *); +extern void _nc_Calculate_Item_Length_and_Width(MENU *); +extern void _nc_Post_Item(const MENU *, const ITEM *); +extern bool _nc_Connect_Items(MENU *, ITEM **); +extern void _nc_Disconnect_Items(MENU *); +extern void _nc_New_TopRow_and_CurrentItem(MENU *,int, ITEM *); +extern void _nc_Link_Items(MENU *); diff --git a/menu/mf_common.h b/menu/mf_common.h new file mode 100644 index 00000000..1e0b3caf --- /dev/null +++ b/menu/mf_common.h @@ -0,0 +1,85 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/* Common internal header for menu and form library */ + +#if HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#if !HAVE_EXTERN_ERRNO +extern int errno; +#endif + +#if HAVE_EXTERN_ERRNO +#include +#endif + +/* in case of debug version we ignore the suppression of assertions */ +#ifdef TRACE +# ifdef NDEBUG +# undef NDEBUG +# endif +#endif + +#include + +#ifdef USE_RCS_IDS +#define MODULE_ID(id) static const char Ident[] = id; +#else +#define MODULE_ID(id) /*nothing*/ +#endif + + +/* Maximum regular 8-bit character code */ +#define MAX_REGULAR_CHARACTER (0xff) + +#define SET_ERROR(code) (errno=(code)) +#define RETURN(code) return( SET_ERROR(code) ) + +/* The few common values in the status fields for menus and forms */ +#define _POSTED (0x01) /* menu or form is posted */ +#define _IN_DRIVER (0x02) /* menu or form is processing hook routine */ + +/* Call object hook */ +#define Call_Hook( object, handler ) \ + if ( (object) && ((object)->handler) )\ + {\ + (object)->status |= _IN_DRIVER;\ + (object)->handler(object);\ + (object)->status &= ~_IN_DRIVER;\ + } + +#define INLINE + +#ifndef TRACE +# if CC_HAS_INLINE_FUNCS +# undef INLINE +# define INLINE inline +# endif +#endif diff --git a/menu/modules b/menu/modules new file mode 100644 index 00000000..53eab5a9 --- /dev/null +++ b/menu/modules @@ -0,0 +1,42 @@ +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Library objects +m_attribs lib $(srcdir) $(MENU_PRIV_H) +m_cursor lib $(srcdir) $(MENU_PRIV_H) +m_driver lib $(srcdir) $(MENU_PRIV_H) +m_format lib $(srcdir) $(MENU_PRIV_H) +m_global lib $(srcdir) $(MENU_PRIV_H) +m_hook lib $(srcdir) $(MENU_PRIV_H) +m_item_cur lib $(srcdir) $(MENU_PRIV_H) +m_item_nam lib $(srcdir) $(MENU_PRIV_H) +m_item_new lib $(srcdir) $(MENU_PRIV_H) +m_item_opt lib $(srcdir) $(MENU_PRIV_H) +m_item_use lib $(srcdir) $(MENU_PRIV_H) +m_item_val lib $(srcdir) $(MENU_PRIV_H) +m_item_vis lib $(srcdir) $(MENU_PRIV_H) +m_items lib $(srcdir) $(MENU_PRIV_H) +m_new lib $(srcdir) $(MENU_PRIV_H) +m_opts lib $(srcdir) $(MENU_PRIV_H) +m_post lib $(srcdir) $(MENU_PRIV_H) +m_req_name lib $(srcdir) $(MENU_PRIV_H) +m_spacing lib $(srcdir) $(MENU_PRIV_H) +m_userptr lib $(srcdir) $(MENU_PRIV_H) +m_win lib $(srcdir) $(MENU_PRIV_H) +m_adabind lib $(srcdir) $(MENU_PRIV_H) diff --git a/misc/Makefile.in b/misc/Makefile.in new file mode 100644 index 00000000..147e8537 --- /dev/null +++ b/misc/Makefile.in @@ -0,0 +1,89 @@ +# $Id: Makefile.in,v 1.13 1996/06/23 00:54:27 tom Exp $ +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Makefile for ncurses miscellany directory +# +# This makes/installs the terminfo database +# +# 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, +# and the programs with the configured default model. + +# turn off _all_ suffix rules; we'll generate our own +.SUFFIXES: + +SHELL = /bin/sh +THIS = Makefile + +NC_MFLAGS = @nc_cv_makeflags@ +@SET_MAKE@ + +INSTALL_PREFIX = @INSTALL_PREFIX@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +datadir = @datadir@ + +tabsetdir = $(datadir)/tabset +ticdir = $(datadir)/terminfo + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +################################################################################ +all: + +install: install.data + +install.data: $(INSTALL_PREFIX)$(libdir) \ + $(INSTALL_PREFIX)$(ticdir) \ + $(INSTALL_PREFIX)$(tabsetdir) + sh $(srcdir)/run_tic.sh $(bindir) $(srcdir) $(ticdir) $(INSTALL_PREFIX) + @cd $(srcdir)/tabset && \ + sh -c 'for i in *; do \ + echo installing $$i; \ + $(INSTALL_DATA) $$i $(INSTALL_PREFIX)$(tabsetdir); done' + +$(INSTALL_PREFIX)$(libdir) \ +$(INSTALL_PREFIX)$(tabsetdir) \ +$(INSTALL_PREFIX)$(ticdir) : + $(srcdir)/../mkinstalldirs $@ + +tags: + +TAGS: + +clean :: + -rm -f tags TAGS *~ + +distclean: clean + -rm -f Makefile + +mostlyclean: clean + +realclean: distclean + +############################################################################### +# The remainder of this file is automatically generated during configuration +############################################################################### diff --git a/misc/hackguide.doc b/misc/hackguide.doc new file mode 100644 index 00000000..11bcd707 --- /dev/null +++ b/misc/hackguide.doc @@ -0,0 +1,723 @@ + + A Hacker's Guide to NCURSES + + Contents + + * Abstract + * Objective of the Package + + Why System V Curses? + + How to Design Extensions + * Portability and Configuration + + If autoconf Fails + * Documentation Conventions + * How to Report Bugs + * A Tour of the Ncurses Library + + Library Overview + + The Engine Room + + Keyboard Input + + Mouse Events + + Output and Screen Updating + * The Forms and Menu Libraries + * A Tour of the Terminfo Compiler + + Translation of Non-use Capabilities + + Use Capability Resolution + + Source-Form Translation + * Other Utilities + * Style Tips for Developers + * Porting Hints + + Abstract + + This document is a hacker's tour of the ncurses library and utilities. + It discusses design philosophy, implementation methods, and the + conventions used for coding and documentation. It is recommended + reading for anyone who is interested in porting, extending or + improving the package. + + Objective of the Package + + The objective of the ncurses package is to provide a freeware API for + character-cell terminals and terminal emulators with the following + characteristics: + + * Source-compatible with historical curses implementations + (including the original BSD curses and System V curses. + * Conformant with the XSI Curses standard issued as part of XPG4 by + X/Open. + * High-quality -- stable and reliable code, wide portability, good + packaging, superior documentation. + * Featureful -- should eliminate as much of the drudgery of C + interface programming as possible, freeing programmers to think at + a higher level of design. + + These objectives are in priority order. So, for example, source + compatibility with older version must trump featurefulness -- we + cannot add features if it means breaking the portion of the API + corresponding to historical curses versions. + +Why System V Curses? + + We used System V curses as a model, reverse-engineering their API, in + order to fulfill the first two objectives. + + System V curses implementations can support BSD curses programs with + just a recompilation, so by capturing the System V API we also capture + BSD's. + + More importantly for the future, the XSI Curses standard issued by + X/Open is explicitly and closely modeled on System V. So conformance + with System V took us most of the way to base-level XSI conformance. + +How to Design Extensions + + The third objective (standards conformance) requires that it be easy + to condition source code using ncurses so that the absence of + nonstandard extensions does not break the code. + + Accordingly, we have a policy of associating with each nonstandard + extension a feature macro, so that ncurses client code can use this + macro to condition in or out the code that requires the ncurses + extension. + + For example, there is a macro NCURSES_MOUSE_VERSION which XSI Curses + does not define, but which is defined in the ncurses library header. + You can use this to condition the calls to the mouse API calls. + + Portability and Configuration + + Code written for ncurses may assume an ANSI-standard C compiler and + POSIX-compatible OS interface. It may also assume the presence of a + System-V-compatible select(2) call. + + We encourage (but do not require) developers to make the code friendly + to less-capable UNIX environments wherever possible. + + We encourage developers to support OS-specific optimizations and + methods not available under POSIX/ANSI, provided only that: + + * All such code is properly conditioned so the build process does + not attempt to compile it under a plain ANSI/POSIX environment. + * Adding such implementation methods does not introduce + incompatibilities in the ncurses API between platforms. + + We use GNU autoconf(1) as a tool to deal with portability issues. The + right way to leverage an OS-specific feature is to modify the autoconf + specification files (configure.in and aclocal.m4) to set up a new + feature macro, which you then use to condition your code. + +If autoconf Fails + + The 'configure' script usually gets your system environment right + automatically. Here are some -D options you might need to compile with + if it fails: + + -DHAVE_UNISTD_H + if is present + + -DHAVE_SIGACTION + if the sigaction function is present + + -DHAVE_USLEEP + if the usleep function is present + + -DSVR4_ACTION + if (e.g., svr4) you need _POSIX_SOURCE to have sigaction + + -DHAVE_TERMIOS_H + if you have + + -DHAVE_TERMIO_H + if you have ; otherwise it uses + + -DBROKEN_TIOCGETWINSZ + on SVR4 and HPUX, the get window size ioctl is broken. + + Documentation Conventions + + There are three kinds of documentation associated with this package. + Each has a different preferred format: + + * Package-internal files (README, INSTALL, TO-DO etc.) + * Manual pages. + * Everything else (i.e., narrative documentation). + + Our conventions are simple: + + 1. Maintain package-internal files in plain text. The expected viewer + for them more(1) or an editor window; there's no point in + elaborate mark-up. + 2. Mark up manual pages in the man macros. These have to be viewable + through traditional man(1) programs. + 3. Write everything else in HTML. + + When in doubt, HTMLize a master and use lynx(1) to generate plain + ASCII (as we do for the announcement document). + + The reason for choosing HTML is that it's (a) well-adapted for on-line + browsing through viewers that are everywhere; (b) more easily readable + as plain text than most other mark-ups, if you don't have a viewer; + and (c) carries enough information that you can generate a + nice-looking printed version from it. Also, of course, it make + exporting things like the announcement document to WWW pretty trivial. + + How to Report Bugs + + The reporting address for bugs is ncurses@bsdi.com. This is a + majordomo list; to join, write to ncurses-request@mailgate.bsdi.com + with a message containing the line: + + subscribe @ + + The ncurses code is maintained by a small group of volunteers. While + we try our best to fix bugs promptly, we simply don't have a lot of + hours to spend on elementary hand-holding. We rely on intelligent + cooperation from our users. If you think you have found a bug in + ncurses, there are some steps you can take before contacting us that + will help get the bug fixed quickly. + + In order to use our bug-fixing time efficiently, we put people who + show us they've taken these steps at the head of our queue. This means + that if you don't, you'll probably end up at the tail end and have to + wait a while. + + 1. Develop a recipe to reproduce the bug. + Bugs we can reproduce are likely to be fixed very quickly, often + within days. The most effective single thing you can do to get a + quick fix is develop a way we can duplicate the bad behavior -- + ideally, by giving us source for a small, portable test program + that breaks the library. (Even better is a keystroke recipe using + one of the test programs provided with the distribution.) + 2. Try to reproduce the bug on a different terminal type. + In our experience, most of the behaviors people report as library + bugs are actually due to subtle problems in terminal descriptions. + This is especially likely to be true if you're using a traditional + asynchronous terminal or PC-based terminal emulator, rather than + xterm or a UNIX console entry. + It's therefore extremely helpful if you can tell us whether or not + your problem reproduces on other terminal types. Usually you'll + have both a console type and xterm available; please tell us + whether or not your bug reproduces on both. + If you have xterm available, it is also good to collect xterm + reports for different window sizes. This is especially true if you + normally use an unusual xterm window size -- a surprising number + of the bugs we've seen are either triggered or masked by these. + 3. Generate and examine a trace file for the broken behavior. + Recompile your program with the debugging versions of the + libraries. Insert a trace() call with the argument set to + TRACE_UPDATE. (See "Writing Programs with NCURSES" for details on + trace levels.) Reproduce your bug, then look at the trace file to + see what the library was actually doing. + Another frequent cause of apparent bugs is application coding + errors that cause the wrong things to be put on the virtual + screen. Looking at the virtual-screen dumps in the trace file will + tell you immediately if this is happening, and save you from the + possible embarrassment of being told that the bug is in your code + and is your problem rather than ours. + If the virtual-screen dumps look correct but the bug persists, + it's possible to crank up the trace level to give more and more + information about the library's update actions and the control + sequences it issues to perform them. The test directory of the + distribution contains a tool for digesting these logs to make them + less tedious to wade through. + Often you'll find terminfo problems at this stage by noticing that + the escape sequences put out for various capabilities are wrong. + If not, you're likely to learn enough to be able to characterize + any bug in the screen-update logic quite exactly. + 4. Report details and symptoms, not just interpretations. + If you do the preceding two steps, it is very likely that you'll + discover the nature of the problem yourself and be able to send us + a fix. This will create happy feelings all around and earn you + good karma for the first time you run into a bug you really can't + characterize and fix yourself. + If you're still stuck, at least you'll know what to tell us. + Remember, we need details. If you guess about what is safe to + leave out, you are too likely to be wrong. + If your bug produces a bad update, include a trace file. Try to + make the trace at the least voluminous level that pins down the + bug. Logs that have been through tracemunch are OK, it doesn't + throw away any information (actually they're better than + un-munched ones because they're easier to read). + If your bug produces a core-dump, please include a symbolic stack + trace generated by gdb(1) or your local equivalent. + Tell us about every terminal on which you've reproduced the bug -- + and every terminal on which you can't. Ideally, sent us terminfo + sources for all of these (yours might differ from ours). + Include your ncurses version and your OS/machine type, of course! + You can find your ncurses version in the curses.h file. + + If your problem smells like a logic error or in cursor movement or + scrolling or a bad capability, there are a couple of tiny test frames + for the library algorithms in the progs directory that may help you + isolate it. These are not part of the normal build, but do have their + own make productions. + + The most important of these is mvcur, a test frame for the + cursor-movement optimization code. With this program, you can see + directly what control sequences will be emitted for any given cursor + movement or scroll/insert/delete operations. If you think you've got a + bad capability identified, you can disable it and test again. The + program is command-driven and has on-line help. + + If you think the vertical-scroll optimization is broken, or just want + to understand how it works better, build hashmap and read the header + comments of hardscroll.c and hashmap.c; then try it out. You can also + test the hardware-scrolling optimization separately with hardscroll. + + There's one other interactive tester, tctest, that exercises + translation between termcap and terminfo formats. If you have a + serious need to run this, you probably belong on our development team! + + A Tour of the Ncurses Library + +Library Overview + + Most of the library is superstructure -- fairly trivial convenience + interfaces to a small set of basic functions and data structures used + to manipulate the virtual screen (in particular, none of this code + does any I/O except through calls to more fundamental modules + described below). The files lib_addch.c, lib_bkgnd.c, lib_box.c, + lib_clear.c, lib_clrbot.c, lib_clreol.c, lib_data.c, lib_delch.c, + lib_delwin.c, lib_erase.c, lib_getstr.c, lib_inchstr.c, lib_insch.c, + lib_insdel.c, lib_insstr.c, lib_instr.c, lib_isendwin.c, + lib_keyname.c, lib_move.c, lib_mvwin.c, lib_overlay.c, lib_pad.c, + lib_printw.c, lib_scanw.c, lib_screen.c, lib_scroll.c, lib_scrreg.c, + lib_set_term.c, lib_slk.c, lib_touch.c, lib_unctrl.c, and lib_window.c + are all in this category. They are very unlikely to need change, + barring bugs or some fundamental reorganization in the underlying data + structures. + + The lib_trace.c, lib_traceatr.c, and lib_tracechr.c file are used only + for debugging support. It is rather unlikely you will ever need to + change these, unless you want to introduce a new debug trace level for + some reasoon. + + There is another group of files that do direct I/O via tputs(), + computations on the terminal capabilities, or queries to the OS + environment, but nevertheless have only fairly low complexity. These + include: lib_acs.c, lib_beep.c, lib_color.c, lib_endwin.c, + lib_initscr.c, lib_longname.c, lib_newterm.c, lib_options.c, + lib_termcap.c, lib_ti.c, lib_tparm.c, lib_tputs.c, lib_vidattr.c, and + read_entry.c. These are likely to need revision only if ncurses is + being ported to an environment without an underlying terminfo + capability representation. + + The files lib_kernel.c, lib_baudrate.c, lib_raw.c, lib_tstp.c, and + lib_twait.c have serious hooks into the tty driver and signal + facilities. If you run into porting snafus moving the package to + another UNIX, the problem is likely to be in one of these files. The + file lib_print.c uses sleep(2) and also falls in this category. + + Almost all of the real work is done in the files hashmap.c, + hardscroll.c, lib_addch.c, lib_doupdate.c, lib_mvcur.c, lib_getch.c, + lib_mouse.c, lib_refresh.c, and lib_setup.c. Most of the algorithmic + complexity in the library lives in these files. If there is a real bug + in ncurses itself, it's probably here. We'll tour some of these files + in detail below (see The Engine Room). + + Finally, there is a group of files that is actually most of the + terminfo compiler. The reason this code lives in the ncurses library + is to support fallback to /etc/termcap. These files include + alloc_entry.c, captoinfo.c, comp_captab.c, comp_error.c, comp_hash.c, + comp_parse.c, comp_scan.c, and parse_entry.c, read_termcap.c, and + write_entry.c. We'll discuss these in the compiler tour. + +The Engine Room + + Keyboard Input + + All ncurses input funnels through the function wgetch(), defined in + lib_getch.c. This function is tricky; it has to poll for keyboard and + mouse events and do a running match of incoming input against the set + of defined special keys. + + The central data structure in this module is a FIFO queue, used to + match multiple-character input sequences against special-key + capabilities; also to implement pushback via ungetch(). + + The wgetch() code distinguishes between function key sequences and the + same sequences typed manually by doing a timed wait after each input + character that could lead a function key sequence. If the entire + sequence takes less than 1 second, it is assumed to have been + generated by a function key press. + + Hackers bruised by previous encounters with variant select(2) calls + may find the code in lib_twait.c interesting. It deals with the + problem that some BSD selects don't return a reliable time-left value. + The function timed_wait() effectively simulates a System V select. + + Mouse Events + + If the mouse interface is active, wgetch() polls for mouse events each + call, before it goes to the keyboard for input. It is up to + lib_mouse.c how the polling is accomplished; it may vary for different + devices. + + Under xterm, however, mouse event notifications come in via the + keyboard input stream. They are recognized by having the kmous + capability as a prefix. This is kind of klugey, but trying to wire in + recognition of a mouse key prefix without going through the + function-key machinery would be just too painful, and this turns out + to imply having the prefix somewhere in the function-key capabilities + at terminal-type initialization. + + This kluge only works because kmous isn't actually used by any + historic terminal type or curses implementation we know of. Best guess + is it's a relic of some forgotten experiment in-house at Bell Labs + that didn't leave any traces in the publicly-distributed System V + terminfo files. If System V or XPG4 ever gets serious about using it + again, this kluge may have to change. + + Here are some more details about mouse event handling: + + The lib_mouse()code is logically split into a lower level that accepts + event reports in a device-dependent format and an upper level that + parses mouse gestures and filters events. The mediating data structure + is a circular queue of event structures. + + Functionally, the lower level's job is to pick up primitive events and + put them on the circular queue. This can happen in one of two ways: + either (a) _nc_mouse_event() detects a series of incoming mouse + reports and queues them, or (b) code in lib_getch.c detects the kmous + prefix in the keyboard input stream and calls _nc_mouse_inline to + queue up a series of adjacent mouse reports. + + In either case, _nc_mouse_parse() should be called after the series is + accepted to parse the digested mouse reports (low-level events) into a + gesture (a high-level or composite event). + + Output and Screen Updating + + With the single exception of character echoes during a wgetnstr() call + (which simulates cooked-mode line editing in an ncurses window), the + library normally does all its output at refresh time. + + The main job is to go from the current state of the screen (as + represented in the curscr window structure) to the desired new state + (as represented in the newscr window structure), while doing as little + I/O as possible. + + The brains of this operation are the modules hashmap.c, hardscroll.c + and lib_doupdate.c; the latter two use lib_mvcur.c. Essentially, what + happens looks like this: + + The hashmap.c module tries to detect vertical motion changes between + the real and virtual screens. This information is represented by the + oldindex members in the newscr structure. These are modified by + vertical-motion and clear operations, and both are re-initialized + after each update. To this change-journalling information, the hashmap + code adds deductions made using a modified Heckel algorithm on hash + values generated from the line contents. + + The hardscroll.c module computes an optimum set of scroll, insertion, + and deletion operations to make the indices match. It calls + _nc_mvcur_scrolln() in lib_mvcur.c to do those motions. + + Then lib_doupdate.c goes to work. Its job is to do line-by-line + transformations of curscr lines to newscr lines. Its main tool is the + routine mvcur() in lib_mvcur.c. This routine does cursor-movement + optimization, attempting to get from given screen location A to given + location B in the fewest output characters posible. + + If you want to work on screen optimizations, you should use the fact + that (in the trace-enabled version of the library) enabling the + TRACE_TIMES trace level causes a report to be emitted after each + screen update giving the elapsed time and a count of characters + emitted during the update. You can use this to tell when an update + optimization improves efficiency. + + In the trace-enabled version of the library, it is also possible to + disable and re-enable various optimizations at runtime by tweaking the + variable _nc_optimize_enable. See the file include/curses.h.in for + mask values, near the end. + + The Forms and Menu Libraries + + The forms and menu libraries should work reliably in any environment + you can port ncurses to. The only portability issue anywhere in them + is what flavor of regular expressions the built-in form field type + TYPE_REGEXP will recognize. + + The configuration code prefers the POSIX regex facility, modeled on + System V's, but will settle for BSD regexps if the former isn't + available. + + Historical note: the panels code was written primarily to assist in + porting u386mon 2.0 (comp.sources.misc v14i001-4) to systems lacking + panels support; u386mon 2.10 and beyond use it. This version has been + slightly cleaned up for ncurses. + + A Tour of the Terminfo Compiler + + The ncurses implementation of tic is rather complex internally; it has + to do a trying combination of missions. This starts with the fact + that, in addition to its normal duty of compiling terminfo sources + into loadable terminfo binaries, it has to be able to handle termcap + syntax and compile that too into terminfo entries. + + The implementation therefore starts with a table-driven, dual-mode + lexical analyzer (in comp_scan.c). The lexer chooses its mode (termcap + or terminfo) based on the first `,' or `:' it finds in each entry. The + lexer does all the work of recognizing capability names and values; + the grammar above it is trivial, just "parse entries till you run out + of file". + +Translation of Non-use Capabilities + + Translation of most things besides use capabilities is pretty + straightforward. The lexical analyzer's tokenizer hands each + capability name to a hash function, which drives a table lookup. The + table entry yields an index which is used to look up the token type in + another table, and controls interpretation of the value. + + One possibly interesting aspect of the implementation is the way the + compiler tables are initialized. All the tables are generated by + various awk/sed/sh scripts from a master table include/Caps; these + scripts actually write C initializers which are linked to the + compiler. Furthermore, the hash table is generated in the same way, so + it doesn't have to be generated at compiler startup time (another + benefit of this organization is that the hash table can be in + shareable text space). + + Thus, adding a new capability is usually pretty trivial, just a matter + of adding one line to the include/Caps file. We'll have more to say + about this in the section on Source-Form Translation. + +Use Capability Resolution + + The background problem that makes tic tricky isn't the capability + translation itself, it's the resolution of use capabilities. Older + versions would not handle forward use references for this reason (that + is, a using terminal always had to follow its use target in the source + file). By doing this, they got away with a simple implementation + tactic; compile everything as it blows by, then resolve uses from + compiled entries. + + This won't do for ncurses. The problem is that that the whole + compilation process has to be embeddable in the ncurses library so + that it can be called by the startup code to translate termcap entries + on the fly. The embedded version can't go promiscuously writing + everything it translates out to disk -- for one thing, it will + typically be running with non-root permissions. + + So our tic is designed to parse an entire terminfo file into a + doubly-linked circular list of entry structures in-core, and then do + use resolution in-memory before writing everything out. This design + has other advantages: it makes forward and back use-references equally + easy (so we get the latter for free), and it makes checking for name + collisions before they're written out easy to do. + + And this is exactly how the embedded version works. But the + stand-alone user-accessible version of tic partly reverts to the + historical strategy; it writes to disk (not keeping in core) any entry + with no use references. + + This is strictly a core-economy kluge, implemented because the + terminfo master file is large enough that some core-poor systems swap + like crazy when you compile it all in memory...there have been reports + of this process taking three hours, rather than the twenty seconds or + less typical on the author's development box. + + So. The executable tic passes the entry-parser a hook that immediately + writes out the referenced entry if it has no use capabilities. The + compiler main loop refrains from adding the entry to the in-core list + when this hook fires. If some other entry later needs to reference an + entry that got written immediately, that's OK; the resolution code + will fetch it off disk when it can't find it in core. + + Name collisions will still be detected, just not as cleanly. The + write_entry() code complains before overwriting an entry that + postdates the time of tic's first call to write_entry(), Thus it will + complain about overwriting entries newly made during the tic run, but + not about overwriting ones that predate it. + +Source-Form Translation + + Another use of tic is to do source translation between various termcap + and terminfo formats. There are more variants out there than you might + think; the ones we know about are described in the captoinfo(1) manual + page. + + The translation output code (dump_entry() in ncurses/dump_entry.c) is + shared with the infocmp(1) utility. It takes the same internal + representation used to generate the binary form and dumps it to + standard output in a specified format. + + The include/Caps file has a header comment describing ways you can + specify source translations for nonstandard capabilities just by + altering the master table. It's possible to set up capability aliasing + or tell the compiler to plain ignore a given capability without + writing any C code at all. + + For circumstances where you need to do algorithmic translation, there + are functions in parse_entry.c called after the parse of each entry + that are specifically intended to encapsulate such translations. This, + for example, is where the AIX box1 capability get translated to an + acsc string. + + Other Utilities + + The infocmp utility is just a wrapper around the same entry-dumping + code used by tic for source translation. Perhaps the one interesting + aspect of the code is the use of a predicate function passed in to + dump_entry() to control which capabilities are dumped. This is + necessary in order to handle both the ordinary De-compilation case and + entry difference reporting. + + The tput and clear utilities just do an entry load followed by a + tputs() of a selected capability. + + Style Tips for Developers + + See the TO-DO file in the top-level directory of the source + distribution for additions that would be particularly useful. + + The prefix _nc_ should be used on library public functions that are + not part of the curses API in order to prevent pollution of the + application namespace. If you have to add to or modify the function + prototypes in curses.h.in, read ncurses/MKlib_gen.sh first so you can + avoid breaking XSI conformance. Please join the ncurses mailing list. + See the INSTALL file in the top level of the distribution for details + on the list. + + Look for the string FIXME in source files to tag minor bugs and + potential problems that could use fixing. + + Don't try to auto-detect OS features in the main body of the C code. + That's the job of the configuration system. + + To hold down complexity, do make your code data-driven. Especially, if + you can drive logic from a table filtered out of include/Caps, do it. + If you find you need to augment the data in that file in order to + generate the proper table, that's still preferable to ad-hoc code -- + that's why the fifth field (flags) is there. + + Have fun! + + Porting Hints + + The following notes are intended to be a first step towards DOS and + Macintosh ports of the ncurses libraries. + + The following library modules are `pure curses'; they operate only on + the curses internal structures, do all output through other curses + calls (not including tputs() and putp()) and do not call any other + UNIX routines such as signal(2) or the stdio library. Thus, they + should not need to be modified for single-terminal ports. + + lib_addch.c lib_addstr.c lib_bkgd.c lib_box.c lib_clear.c lib_clrbot.c + lib_clreol.c lib_delch.c lib_delwin.c lib_erase.c lib_inchstr.c + lib_insch.c lib_insdel.c lib_insstr.c lib_keyname.c lib_move.c + lib_mvwin.c lib_newwin.c lib_overlay.c lib_pad.c lib_printw.c + lib_refresh.c lib_scanw.c lib_scroll.c lib_scrreg.c lib_set_term.c + lib_touch.c lib_tparm.c lib_tputs.c lib_unctrl.c lib_window.c panel.c + + This module is pure curses, but calls outstr(): + + lib_getstr.c + + These modules are pure curses, except that they use tputs() and + putp(): + + lib_beep.c lib_endwin.c lib_color.c lib_options.c lib_slk.c + lib_vidattr.c + + This modules assist in POSIX emulation on non-POSIX systems: + + sigaction.c + signal calls + + The following source files will not be needed for a + single-terminal-type port. + + captoinfo.c clear.c comp_captab.c comp_error.c comp_hash.c comp_main.c + comp_parse.c comp_scan.c alloc_entry.c dump_entry.c parse_entry.c + read_entry.c write_entry.c infocmp.c tput.c + + The following modules will use open()/read()/write()/close()/lseek() + on files, but no other OS calls. + + lib_screen.c + used to read/write screen dumps + + lib_trace.c + used to write trace data to the logfile + + Modules that would have to be modified for a port start here: + + The following modules are `pure curses' but contain assumptions + inappropriate for a memory-mapped port. + +lib_longname.c -- assumes there may be multiple terminals + longname() -- return long name of terminal +lib_acs.c -- assumes acs_map as a double indirection + init_acs() -- initialize acs map +lib_mvcur.c -- assumes cursor moves have variable cost + mvcur_init() -- initialize + mvcur() -- do physical cursor move + mvcur_wrap() -- wrap + scrolln() -- do physical scrolling +lib_termcap.c -- assumes there may be multiple terminals + tgetent() -- load entry + tgetflag() -- get boolean capability + tgetnum() -- get numeric capability + tgetstr() -- get string capability +lib_ti.c -- assumes there may be multiple terminals + tigetent() -- load entry + tigetflag() -- get boolean capability + tigetnum() -- get numeric capability + tigetstr() -- get string capability + +The following modules use UNIX-specific calls: + +lib_doupdate.c -- input checking + doupdate() -- repaint real screen to match virtual + _nc_outch() -- put out a single character +lib_getch.c -- read() + wgetch() -- get single character + wungetch() -- push back single character +lib_initscr.c -- getenv() + initscr() -- initialize curses functions +lib_newterm.c + newterm() -- set up new terminal screen +lib_baudrate.c + baudrate() -- return the baudrate +lib_kernel.c -- various tty-manipulation and system calls + reset_prog_mode() -- reset ccurses-raw mode + reset_shell_mode() -- reset cooked mode + erasechar() -- return the erase char + killchar() -- return the kill character + flushinp() -- flush pending input + savetty() -- save tty state + resetty() -- reset tty to state at last savetty() +lib_raw.c -- various tty-manipulation calls + raw() + echo() + nl() + qiflush() + cbreak() + noraw() + noecho() + nonl() + noqiflush() + nocbreak() +lib_setup.c -- various tty-manipulation calls + use_env() + setupterm() +lib_restart.c -- various tty-manipulation calls + def_shell_mode() + def_prog_mode() + set_curterm() + del_curterm() +lib_tstp.c -- signal-manipulation calls + _nc_signal_handler() -- enable/disable window-mode signal catching +lib_twait.c -- gettimeofday(), select(). + usleep() -- microsecond sleep + _nc_timed_wait() -- timed wait for input + + The package kernel could be made smaller. + _________________________________________________________________ + + + Eric S. Raymond + + (Note: This is not the bug address!) diff --git a/misc/hackguide.html b/misc/hackguide.html new file mode 100644 index 00000000..0bbbd6d1 --- /dev/null +++ b/misc/hackguide.html @@ -0,0 +1,855 @@ + + + + +A Hacker's Guide to Ncurses Internals + + + + + +

A Hacker's Guide to NCURSES

+ +

Contents

+ + +

Abstract

+ +This document is a hacker's tour of the ncurses library and utilities. +It discusses design philosophy, implementation methods, and the +conventions used for coding and documentation. It is recommended +reading for anyone who is interested in porting, extending or improving the +package.

+ +

Objective of the Package

+ +The objective of the ncurses package is to provide a freeware API for +character-cell terminals and terminal emulators with the following +characteristics:

+ +

    +
  • Source-compatible with historical curses implementations (including + the original BSD curses and System V curses. +

    +

  • Conformant with the XSI Curses standard issued as part of XPG4 by + X/Open. +

    +

  • High-quality -- stable and reliable code, wide portability, good + packaging, superior documentation. +

    +

  • Featureful -- should eliminate as much of the drudgery of C interface + programming as possible, freeing programmers to think at a higher + level of design. +
+ +These objectives are in priority order. So, for example, source +compatibility with older version must trump featurefulness -- we cannot +add features if it means breaking the portion of the API corresponding +to historical curses versions.

+ +

Why System V Curses?

+ +We used System V curses as a model, reverse-engineering their API, in +order to fulfill the first two objectives.

+ +System V curses implementations can support BSD curses programs with +just a recompilation, so by capturing the System V API we also +capture BSD's.

+ +More importantly for the future, the XSI Curses standard issued by X/Open +is explicitly and closely modeled on System V. So conformance with +System V took us most of the way to base-level XSI conformance.

+ +

How to Design Extensions

+ +The third objective (standards conformance) requires that it be easy to +condition source code using ncurses so that the absence of nonstandard +extensions does not break the code.

+ +Accordingly, we have a policy of associating with each nonstandard extension +a feature macro, so that ncurses client code can use this macro to condition +in or out the code that requires the ncurses extension.

+ +For example, there is a macro NCURSES_MOUSE_VERSION which XSI Curses +does not define, but which is defined in the ncurses library header. +You can use this to condition the calls to the mouse API calls.

+ +

Portability and Configuration

+ +Code written for ncurses may assume an ANSI-standard C compiler and +POSIX-compatible OS interface. It may also assume the presence of a +System-V-compatible select(2) call.

+ +We encourage (but do not require) developers to make the code friendly +to less-capable UNIX environments wherever possible.

+ +We encourage developers to support OS-specific optimizations and methods +not available under POSIX/ANSI, provided only that:

+ +

    +
  • All such code is properly conditioned so the build process does not + attempt to compile it under a plain ANSI/POSIX environment. +

    +

  • Adding such implementation methods does not introduce incompatibilities + in the ncurses API between platforms. +
+ +We use GNU autoconf(1) as a tool to deal with portability issues. +The right way to leverage an OS-specific feature is to modify the autoconf +specification files (configure.in and aclocal.m4) to set up a new feature +macro, which you then use to condition your code.

+ +

If autoconf Fails

+ +The 'configure' script usually gets your system environment right +automatically. Here are some -D options you might need to compile +with if it fails:

+

+
-DHAVE_UNISTD_H +
if <unistd.h> is present +
-DHAVE_SIGACTION +
if the sigaction function is present +
-DHAVE_USLEEP +
if the usleep function is present +
-DSVR4_ACTION +
if (e.g., svr4) you need _POSIX_SOURCE to have sigaction +
-DHAVE_TERMIOS_H +
if you have <termios.h> +
-DHAVE_TERMIO_H +
if you have <termio.h>; otherwise it uses <sgtty.h> +
-DBROKEN_TIOCGETWINSZ +
on SVR4 and HPUX, the get window size ioctl is broken. +
+ +

Documentation Conventions

+ +There are three kinds of documentation associated with this package. Each +has a different preferred format:

+ +

    +
  • Package-internal files (README, INSTALL, TO-DO etc.) +
  • Manual pages. +
  • Everything else (i.e., narrative documentation). +
+ +Our conventions are simple:

+

    +
  1. Maintain package-internal files in plain text. + The expected viewer for them more(1) or an editor window; there's + no point in elaborate mark-up.

    + +

  2. Mark up manual pages in the man macros. These have to be viewable + through traditional man(1) programs.

    + +

  3. Write everything else in HTML. +
+ +When in doubt, HTMLize a master and use lynx(1) to generate +plain ASCII (as we do for the announcement document).

+ +The reason for choosing HTML is that it's (a) well-adapted for on-line +browsing through viewers that are everywhere; (b) more easily readable +as plain text than most other mark-ups, if you don't have a viewer; and (c) +carries enough information that you can generate a nice-looking printed +version from it. Also, of course, it make exporting things like the +announcement document to WWW pretty trivial.

+ +

How to Report Bugs

+ +The reporting address for bugs is +ncurses@bsdi.com. +This is a majordomo list; to join, write +to ncurses-request@mailgate.bsdi.com with a message containing the line: +
+             subscribe <name>@<host.domain>
+
+ +The ncurses code is maintained by a small group of +volunteers. While we try our best to fix bugs promptly, we simply +don't have a lot of hours to spend on elementary hand-holding. We rely +on intelligent cooperation from our users. If you think you have +found a bug in ncurses, there are some steps you can take +before contacting us that will help get the bug fixed quickly.

+ +In order to use our bug-fixing time efficiently, we put people who +show us they've taken these steps at the head of our queue. This +means that if you don't, you'll probably end up at the tail end and +have to wait a while.

+ +

    +
  1. Develop a recipe to reproduce the bug.

    + +Bugs we can reproduce are likely to be fixed very quickly, often +within days. The most effective single thing you can do to get a +quick fix is develop a way we can duplicate the bad behavior -- +ideally, by giving us source for a small, portable test program that +breaks the library. (Even better is a keystroke recipe using one of +the test programs provided with the distribution.)

    + +

  2. Try to reproduce the bug on a different terminal type.

    + +In our experience, most of the behaviors people report as library bugs +are actually due to subtle problems in terminal descriptions. This is +especially likely to be true if you're using a traditional +asynchronous terminal or PC-based terminal emulator, rather than xterm +or a UNIX console entry.

    + +It's therefore extremely helpful if you can tell us whether or not your +problem reproduces on other terminal types. Usually you'll have both +a console type and xterm available; please tell us whether or not your +bug reproduces on both.

    + +If you have xterm available, it is also good to collect xterm reports for +different window sizes. This is especially true if you normally use an +unusual xterm window size -- a surprising number of the bugs we've seen +are either triggered or masked by these.

    + +

  3. Generate and examine a trace file for the broken behavior.

    + +Recompile your program with the debugging versions of the libraries. +Insert a trace() call with the argument set to TRACE_UPDATE. +(See "Writing Programs with +NCURSES" for details on trace levels.) +Reproduce your bug, then look at the trace file to see what the library +was actually doing.

    + +Another frequent cause of apparent bugs is application coding errors +that cause the wrong things to be put on the virtual screen. Looking +at the virtual-screen dumps in the trace file will tell you immediately if +this is happening, and save you from the possible embarrassment of being +told that the bug is in your code and is your problem rather than ours.

    + +If the virtual-screen dumps look correct but the bug persists, it's +possible to crank up the trace level to give more and more information +about the library's update actions and the control sequences it issues +to perform them. The test directory of the distribution contains a +tool for digesting these logs to make them less tedious to wade +through.

    + +Often you'll find terminfo problems at this stage by noticing that the +escape sequences put out for various capabilities are wrong. If not, +you're likely to learn enough to be able to characterize any bug in +the screen-update logic quite exactly.

    + +

  4. Report details and symptoms, not just interpretations.

    + +If you do the preceding two steps, it is very likely that you'll discover +the nature of the problem yourself and be able to send us a fix. This +will create happy feelings all around and earn you good karma for the first +time you run into a bug you really can't characterize and fix yourself.

    + +If you're still stuck, at least you'll know what to tell us. Remember, we +need details. If you guess about what is safe to leave out, you are too +likely to be wrong.

    + +If your bug produces a bad update, include a trace file. Try to make +the trace at the least voluminous level that pins down the +bug. Logs that have been through tracemunch are OK, it doesn't throw +away any information (actually they're better than un-munched ones because +they're easier to read).

    + +If your bug produces a core-dump, please include a symbolic stack trace +generated by gdb(1) or your local equivalent.

    + +Tell us about every terminal on which you've reproduced the bug -- and +every terminal on which you can't. Ideally, sent us terminfo sources +for all of these (yours might differ from ours).

    + +Include your ncurses version and your OS/machine type, of course! You can +find your ncurses version in the curses.h file. +

+ +If your problem smells like a logic error or in cursor movement or +scrolling or a bad capability, there are a couple of tiny test frames +for the library algorithms in the progs directory that may help you +isolate it. These are not part of the normal build, but do have their +own make productions.

+ +The most important of these is mvcur, a test frame for the +cursor-movement optimization code. With this program, you can see +directly what control sequences will be emitted for any given cursor +movement or scroll/insert/delete operations. If you think you've got +a bad capability identified, you can disable it and test again. The +program is command-driven and has on-line help.

+ +If you think the vertical-scroll optimization is broken, or just want to +understand how it works better, build hashmap and read the +header comments of hardscroll.c and hashmap.c; then try +it out. You can also test the hardware-scrolling optimization separately +with hardscroll.

+ +There's one other interactive tester, tctest, that exercises +translation between termcap and terminfo formats. If you have a serious +need to run this, you probably belong on our development team!

+ +

A Tour of the Ncurses Library

+ +

Library Overview

+ +Most of the library is superstructure -- fairly trivial convenience +interfaces to a small set of basic functions and data structures used +to manipulate the virtual screen (in particular, none of this code +does any I/O except through calls to more fundamental modules +described below). The files lib_addch.c, +lib_bkgnd.c, lib_box.c, lib_clear.c, +lib_clrbot.c, lib_clreol.c, lib_data.c, +lib_delch.c, lib_delwin.c, lib_erase.c, +lib_getstr.c, lib_inchstr.c, lib_insch.c, +lib_insdel.c, lib_insstr.c, lib_instr.c, +lib_isendwin.c, lib_keyname.c, lib_move.c, +lib_mvwin.c, lib_overlay.c, lib_pad.c, +lib_printw.c, lib_scanw.c, lib_screen.c, +lib_scroll.c, lib_scrreg.c, lib_set_term.c, +lib_slk.c, lib_touch.c, lib_unctrl.c, and +lib_window.c are all in this category. They are very +unlikely to need change, barring bugs or some fundamental +reorganization in the underlying data structures.

+ +The lib_trace.c, lib_traceatr.c, and +lib_tracechr.c file are used only for debugging support. +It is rather unlikely you will ever need to change these, unless +you want to introduce a new debug trace level for some reasoon.

+ +There is another group of files that do direct I/O via tputs(), +computations on the terminal capabilities, or queries to the OS +environment, but nevertheless have only fairly low complexity. These +include: lib_acs.c, lib_beep.c, +lib_color.c, lib_endwin.c, lib_initscr.c, +lib_longname.c, lib_newterm.c, +lib_options.c, lib_termcap.c, lib_ti.c, +lib_tparm.c, lib_tputs.c, lib_vidattr.c, +and read_entry.c. These are likely to need revision only if +ncurses is being ported to an environment without an underlying +terminfo capability representation.

+ +The files lib_kernel.c, lib_baudrate.c, lib_raw.c, +lib_tstp.c, and lib_twait.c have serious hooks into +the tty driver and signal facilities. If you run into porting snafus +moving the package to another UNIX, the problem is likely to be in one +of these files. The file lib_print.c uses sleep(2) and also +falls in this category.

+ +Almost all of the real work is done in the files +hashmap.c, hardscroll.c, +lib_addch.c, lib_doupdate.c, lib_mvcur.c, +lib_getch.c, lib_mouse.c, lib_refresh.c, +and lib_setup.c. Most of the algorithmic complexity in the +library lives in these files. If there is a real bug in ncurses +itself, it's probably here. We'll tour some of these files in detail +below (see The Engine Room).

+ +Finally, there is a group of files that is actually most of the +terminfo compiler. The reason this code lives in the ncurses +library is to support fallback to /etc/termcap. These files include +alloc_entry.c, captoinfo.c, comp_captab.c, +comp_error.c, comp_hash.c, comp_parse.c, +comp_scan.c, and parse_entry.c, +read_termcap.c, and write_entry.c. We'll discuss these +in the compiler tour.

+ +

The Engine Room

+ +

Keyboard Input

+ +All ncurses input funnels through the function +wgetch(), defined in lib_getch.c. This function is +tricky; it has to poll for keyboard and mouse events and do a running +match of incoming input against the set of defined special keys.

+ +The central data structure in this module is a FIFO queue, used to +match multiple-character input sequences against special-key +capabilities; also to implement pushback via ungetch().

+ +The wgetch() code distinguishes between function key +sequences and the same sequences typed manually by doing a timed wait +after each input character that could lead a function key sequence. +If the entire sequence takes less than 1 second, it is assumed to have +been generated by a function key press.

+ +Hackers bruised by previous encounters with variant select(2) +calls may find the code in lib_twait.c interesting. It deals +with the problem that some BSD selects don't return a reliable +time-left value. The function timed_wait() effectively +simulates a System V select.

+ +

Mouse Events

+ +If the mouse interface is active, wgetch() polls for mouse +events each call, before it goes to the keyboard for input. It is +up to lib_mouse.c how the polling is accomplished; it may vary +for different devices.

+ +Under xterm, however, mouse event notifications come in via the keyboard +input stream. They are recognized by having the kmous capability +as a prefix. This is kind of klugey, but trying to wire in recognition of +a mouse key prefix without going through the function-key machinery would +be just too painful, and this turns out to imply having the prefix somewhere +in the function-key capabilities at terminal-type initialization.

+ +This kluge only works because kmous isn't actually used by any +historic terminal type or curses implementation we know of. Best +guess is it's a relic of some forgotten experiment in-house at Bell +Labs that didn't leave any traces in the publicly-distributed System V +terminfo files. If System V or XPG4 ever gets serious about using it +again, this kluge may have to change.

+ +Here are some more details about mouse event handling:

+ +The lib_mouse()code is logically split into a lower level that +accepts event reports in a device-dependent format and an upper level that +parses mouse gestures and filters events. The mediating data structure is a +circular queue of event structures.

+ +Functionally, the lower level's job is to pick up primitive events and +put them on the circular queue. This can happen in one of two ways: +either (a) _nc_mouse_event() detects a series of incoming +mouse reports and queues them, or (b) code in lib_getch.c detects the +kmous prefix in the keyboard input stream and calls _nc_mouse_inline +to queue up a series of adjacent mouse reports.

+ +In either case, _nc_mouse_parse() should be called after the +series is accepted to parse the digested mouse reports (low-level +events) into a gesture (a high-level or composite event).

+ +

Output and Screen Updating

+ +With the single exception of character echoes during a wgetnstr() +call (which simulates cooked-mode line editing in an ncurses window), +the library normally does all its output at refresh time.

+ +The main job is to go from the current state of the screen (as represented +in the curscr window structure) to the desired new state (as +represented in the newscr window structure), while doing as +little I/O as possible.

+ +The brains of this operation are the modules hashmap.c, +hardscroll.c and lib_doupdate.c; the latter two use +lib_mvcur.c. Essentially, what happens looks like this:

+ +The hashmap.c module tries to detect vertical motion +changes between the real and virtual screens. This information +is represented by the oldindex members in the newscr structure. +These are modified by vertical-motion and clear operations, and both are +re-initialized after each update. To this change-journalling +information, the hashmap code adds deductions made using a modified Heckel +algorithm on hash values generated from the line contents.

+ +The hardscroll.c module computes an optimum set of scroll, +insertion, and deletion operations to make the indices match. It calls +_nc_mvcur_scrolln() in lib_mvcur.c to do those motions.

+ +Then lib_doupdate.c goes to work. Its job is to do line-by-line +transformations of curscr lines to newscr lines. Its main +tool is the routine mvcur() in lib_mvcur.c. This routine +does cursor-movement optimization, attempting to get from given screen +location A to given location B in the fewest output characters posible.

+ +If you want to work on screen optimizations, you should use the fact +that (in the trace-enabled version of the library) enabling the +TRACE_TIMES trace level causes a report to be emitted after +each screen update giving the elapsed time and a count of characters +emitted during the update. You can use this to tell when an update +optimization improves efficiency.

+ +In the trace-enabled version of the library, it is also possible to disable +and re-enable various optimizations at runtime by tweaking the variable +_nc_optimize_enable. See the file include/curses.h.in +for mask values, near the end.

+ +

The Forms and Menu Libraries

+ +The forms and menu libraries should work reliably in any environment you +can port ncurses to. The only portability issue anywhere in them is what +flavor of regular expressions the built-in form field type TYPE_REGEXP +will recognize.

+ +The configuration code prefers the POSIX regex facility, modeled on +System V's, but will settle for BSD regexps if the former isn't available.

+ +Historical note: the panels code was written primarily to assist in +porting u386mon 2.0 (comp.sources.misc v14i001-4) to systems lacking +panels support; u386mon 2.10 and beyond use it. This version has been +slightly cleaned up for ncurses.

+ +

A Tour of the Terminfo Compiler

+ +The ncurses implementation of tic is rather complex +internally; it has to do a trying combination of missions. This starts +with the fact that, in addition to its normal duty of compiling +terminfo sources into loadable terminfo binaries, it has to be able to +handle termcap syntax and compile that too into terminfo entries.

+ +The implementation therefore starts with a table-driven, dual-mode +lexical analyzer (in comp_scan.c). The lexer chooses its +mode (termcap or terminfo) based on the first `,' or `:' it finds in +each entry. The lexer does all the work of recognizing capability +names and values; the grammar above it is trivial, just "parse entries +till you run out of file".

+ +

Translation of Non-use Capabilities

+ +Translation of most things besides use capabilities is pretty +straightforward. The lexical analyzer's tokenizer hands each capability +name to a hash function, which drives a table lookup. The table entry +yields an index which is used to look up the token type in another table, +and controls interpretation of the value.

+ +One possibly interesting aspect of the implementation is the way the +compiler tables are initialized. All the tables are generated by various +awk/sed/sh scripts from a master table include/Caps; these +scripts actually write C initializers which are linked to the compiler. +Furthermore, the hash table is generated in the same way, so it doesn't +have to be generated at compiler startup time (another benefit of this +organization is that the hash table can be in shareable text space).

+ +Thus, adding a new capability is usually pretty trivial, just a matter +of adding one line to the include/Caps file. We'll have more +to say about this in the section on Source-Form +Translation.

+ +

Use Capability Resolution

+ +The background problem that makes tic tricky isn't the capability +translation itself, it's the resolution of use capabilities. Older +versions would not handle forward use references for this reason +(that is, a using terminal always had to follow its use target in the +source file). By doing this, they got away with a simple implementation +tactic; compile everything as it blows by, then resolve uses from compiled +entries.

+ +This won't do for ncurses. The problem is that that the whole +compilation process has to be embeddable in the ncurses library +so that it can be called by the startup code to translate termcap +entries on the fly. The embedded version can't go promiscuously writing +everything it translates out to disk -- for one thing, it will typically +be running with non-root permissions.

+ +So our tic is designed to parse an entire terminfo file into a +doubly-linked circular list of entry structures in-core, and then do +use resolution in-memory before writing everything out. This +design has other advantages: it makes forward and back use-references +equally easy (so we get the latter for free), and it makes checking for +name collisions before they're written out easy to do.

+ +And this is exactly how the embedded version works. But the stand-alone +user-accessible version of tic partly reverts to the historical +strategy; it writes to disk (not keeping in core) any entry with no +use references.

+ +This is strictly a core-economy kluge, implemented because the +terminfo master file is large enough that some core-poor systems swap +like crazy when you compile it all in memory...there have been reports of +this process taking three hours, rather than the twenty seconds +or less typical on the author's development box.

+ +So. The executable tic passes the entry-parser a hook that +immediately writes out the referenced entry if it has no use +capabilities. The compiler main loop refrains from adding the entry +to the in-core list when this hook fires. If some other entry later +needs to reference an entry that got written immediately, that's OK; +the resolution code will fetch it off disk when it can't find it in +core.

+ +Name collisions will still be detected, just not as cleanly. The +write_entry() code complains before overwriting an entry that +postdates the time of tic's first call to +write_entry(), Thus it will complain about overwriting +entries newly made during the tic run, but not about +overwriting ones that predate it.

+ +

Source-Form Translation

+ +Another use of tic is to do source translation between various termcap +and terminfo formats. There are more variants out there than you might +think; the ones we know about are described in the captoinfo(1) +manual page.

+ +The translation output code (dump_entry() in +ncurses/dump_entry.c) is shared with the infocmp(1) +utility. It takes the same internal representation used to generate +the binary form and dumps it to standard output in a specified +format.

+ +The include/Caps file has a header comment describing ways you +can specify source translations for nonstandard capabilities just by +altering the master table. It's possible to set up capability aliasing +or tell the compiler to plain ignore a given capability without writing +any C code at all.

+ +For circumstances where you need to do algorithmic translation, there +are functions in parse_entry.c called after the parse of each +entry that are specifically intended to encapsulate such +translations. This, for example, is where the AIX box1 capability +get translated to an acsc string.

+ +

Other Utilities

+ +The infocmp utility is just a wrapper around the same +entry-dumping code used by tic for source translation. Perhaps +the one interesting aspect of the code is the use of a predicate +function passed in to dump_entry() to control which +capabilities are dumped. This is necessary in order to handle both +the ordinary De-compilation case and entry difference reporting.

+ +The tput and clear utilities just do an entry load +followed by a tputs() of a selected capability.

+ +

Style Tips for Developers

+ +See the TO-DO file in the top-level directory of the source distribution +for additions that would be particularly useful.

+ +The prefix _nc_ should be used on library public functions that are +not part of the curses API in order to prevent pollution of the +application namespace. + +If you have to add to or modify the function prototypes in curses.h.in, +read ncurses/MKlib_gen.sh first so you can avoid breaking XSI conformance. + +Please join the ncurses mailing list. See the INSTALL file in the +top level of the distribution for details on the list.

+ +Look for the string FIXME in source files to tag minor bugs +and potential problems that could use fixing.

+ +Don't try to auto-detect OS features in the main body of the C code. +That's the job of the configuration system.

+ +To hold down complexity, do make your code data-driven. Especially, +if you can drive logic from a table filtered out of +include/Caps, do it. If you find you need to augment the +data in that file in order to generate the proper table, that's still +preferable to ad-hoc code -- that's why the fifth field (flags) is +there.

+ +Have fun!

+ +

Porting Hints

+ +The following notes are intended to be a first step towards DOS and Macintosh +ports of the ncurses libraries.

+ +The following library modules are `pure curses'; they operate only on +the curses internal structures, do all output through other curses +calls (not including tputs() and putp()) and do not +call any other UNIX routines such as signal(2) or the stdio library. +Thus, they should not need to be modified for single-terminal +ports.

+ + +lib_addch.c +lib_addstr.c +lib_bkgd.c +lib_box.c +lib_clear.c +lib_clrbot.c +lib_clreol.c +lib_delch.c +lib_delwin.c +lib_erase.c +lib_inchstr.c +lib_insch.c +lib_insdel.c +lib_insstr.c +lib_keyname.c +lib_move.c +lib_mvwin.c +lib_newwin.c +lib_overlay.c +lib_pad.c +lib_printw.c +lib_refresh.c +lib_scanw.c +lib_scroll.c +lib_scrreg.c +lib_set_term.c +lib_touch.c +lib_tparm.c +lib_tputs.c +lib_unctrl.c +lib_window.c +panel.c + +

+ +This module is pure curses, but calls outstr():

+ + +lib_getstr.c + +

+ +These modules are pure curses, except that they use tputs() +and putp():

+ + +lib_beep.c +lib_endwin.c +lib_color.c +lib_options.c +lib_slk.c +lib_vidattr.c + +

+ +This modules assist in POSIX emulation on non-POSIX systems:

+

+
sigaction.c +
signal calls +
+ +The following source files will not be needed for a +single-terminal-type port.

+ + +captoinfo.c +clear.c +comp_captab.c +comp_error.c +comp_hash.c +comp_main.c +comp_parse.c +comp_scan.c +alloc_entry.c +dump_entry.c +parse_entry.c +read_entry.c +write_entry.c +infocmp.c +tput.c + +

+ +The following modules will use open()/read()/write()/close()/lseek() on files, +but no other OS calls.

+ +

+
lib_screen.c +
used to read/write screen dumps +
lib_trace.c +
used to write trace data to the logfile +
+ +Modules that would have to be modified for a port start here:

+ +The following modules are `pure curses' but contain assumptions inappropriate +for a memory-mapped port.

+ +

+lib_longname.c	-- assumes there may be multiple terminals
+	longname()		-- return long name of terminal
+lib_acs.c	-- assumes acs_map as a double indirection
+	init_acs()		-- initialize acs map
+lib_mvcur.c	-- assumes cursor moves have variable cost
+	mvcur_init()		-- initialize
+	mvcur()			-- do physical cursor move
+	mvcur_wrap()		-- wrap
+	scrolln()		-- do physical scrolling
+lib_termcap.c	-- assumes there may be multiple terminals
+	tgetent()		-- load entry
+	tgetflag()		-- get boolean capability
+	tgetnum()		-- get numeric capability
+	tgetstr()		-- get string capability
+lib_ti.c	-- assumes there may be multiple terminals
+	tigetent()		-- load entry
+	tigetflag()		-- get boolean capability
+	tigetnum()		-- get numeric capability
+	tigetstr()		-- get string capability
+
+The following modules use UNIX-specific calls:
+
+lib_doupdate.c	-- input checking
+	doupdate()		-- repaint real screen to match virtual
+	_nc_outch()		-- put out a single character
+lib_getch.c	-- read()
+	wgetch()		-- get single character
+	wungetch()		-- push back single character
+lib_initscr.c	-- getenv()
+	initscr()		-- initialize curses functions
+lib_newterm.c
+	newterm()		-- set up new terminal screen
+lib_baudrate.c
+	baudrate()		-- return the baudrate
+lib_kernel.c	-- various tty-manipulation and system calls
+	reset_prog_mode()	-- reset ccurses-raw mode
+	reset_shell_mode()	-- reset cooked mode
+	erasechar()		-- return the erase char
+	killchar()		-- return the kill character
+	flushinp()		-- flush pending input
+	savetty()		-- save tty state
+	resetty()		-- reset tty to state at last savetty() 
+lib_raw.c	-- various tty-manipulation calls
+	raw()
+	echo()
+	nl()
+	qiflush()
+	cbreak()
+	noraw()
+	noecho()
+	nonl()
+	noqiflush()
+	nocbreak()
+lib_setup.c	-- various tty-manipulation calls
+	use_env()
+	setupterm()
+lib_restart.c	-- various tty-manipulation calls
+	def_shell_mode()
+	def_prog_mode()
+	set_curterm()
+	del_curterm()
+lib_tstp.c	-- signal-manipulation calls
+	_nc_signal_handler()	-- enable/disable window-mode signal catching
+lib_twait.c	-- gettimeofday(), select().
+	usleep()		-- microsecond sleep
+	_nc_timed_wait()	-- timed wait for input
+
+ +The package kernel could be made smaller.

+ +


+
Eric S. Raymond <esr@snark.thyrsus.com>
+(Note: This is not the bug address!) + + diff --git a/misc/makellib b/misc/makellib new file mode 100755 index 00000000..4a571d60 --- /dev/null +++ b/misc/makellib @@ -0,0 +1,151 @@ +#!/bin/sh +################################################################################ +# Copyright 1996,1997 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# $Id: makellib,v 1.6 1997/03/02 01:28:36 tom Exp $ +# System-dependent wrapper for 'lint' that creates a lint-library via the +# following method (XXX is the name of the library): +# a. If the file llib-lXXX doesn't exist, create it using the make-rule +# b. Process llib-lXXX with the system's lint utility, making +# llib-lXXX.ln +# c. Install llib-lXXX.ln in the lib directory. +# +# Using the intermediate file llib-lXXX bypasses a weakness of lint (passing +# through warning messages from the original source-files). +# +# There are two drawbacks to this approach: +# a. On a few systems, you'll have to manually-edit the llib-lXXX file +# to get a usable lint-library (not all C-preprocessors work well). +# b. The system's lint utility won't recognize -lXXX as a lint-library +# (Use tdlint as a wrapper; it's designed for this). +# +# Parameters: +# $1 = library name +# $* = C-preprocessor options +# +ARCH=`uname -s` +if test "x$ARCH" = "xSunOS" ; then + case `uname -r` in + 5.*) ARCH=Solaris + ;; + esac +fi +# +DST="$HOME/lib/$ARCH/lint" +OPT="" +LLIB="" +llib="" +# +while test $# != 0 +do + case $1 in + -L*) + DST="$DST `echo $1|sed -e 's/^-L//'`" + ;; + -*) + OPT="$OPT $1" + ;; + *) + if test -z "$LLIB" + then + LLIB=$1 + else + llib=llib-l$1 + fi + ;; + esac + shift +done + +if test -z "$LLIB" +then + echo '? no library name specified' + exit 1 +elif test -z "$llib" +then + llib="llib-l$LLIB" +fi + +if test ! -f $llib ; then + if ( make $llib ) + then + : + else + exit 1 + fi +fi + +rm -f $llib.ln $llib.c +TARGET=$LLIB + +case "$ARCH" in +AIX) + CREATE="-uvxo$LLIB -Nn4000" + TARGET=$llib.c + ln $llib $TARGET + ;; +Solaris) + CREATE="-C$llib" + TARGET=$llib.c + ln $llib $TARGET + ;; +CLIX) + CREATE="-DLINTLIBRARY -vxo$LLIB" + TARGET=$llib.c + ln $llib $TARGET + ;; +IRIX*) + CREATE="-DLINTLIBRARY -vxyo$LLIB" + TARGET=$llib.c + ln $llib $TARGET + ;; +UNIX_SV) + CREATE="-DLINTLIBRARY -vxyo$LLIB" + TARGET=$llib.c + ln $llib $TARGET + ;; +*) + echo "Sorry. I do not know how to build a lint-library for $ARCH" + exit 1 +esac + +echo OPT "$OPT" +echo TARGET "$TARGET" +echo LIBNAME "$llib" +if ( lint $CREATE $OPT $TARGET ) +then + if test -f $llib.ln + then + for p in $HOME/lib $HOME/lib/$ARCH $HOME/lib/$ARCH/lint + do + if test ! -d $p + then + mkdir $p + fi + done + for p in $DST + do + cp $llib.ln $p/ + done + rm -f $llib.ln + fi +fi +if test "x$TARGET" = "x$llib.c" ; then + rm -f $TARGET +fi diff --git a/misc/ncurses-intro.doc b/misc/ncurses-intro.doc new file mode 100644 index 00000000..4dcb8905 --- /dev/null +++ b/misc/ncurses-intro.doc @@ -0,0 +1,2508 @@ + + Writing Programs with NCURSES + + by Eric S. Raymond and Zeyd M. Ben-Halim + + Contents + + * Introduction + + A Brief History of Curses + + Scope of This Document + + Terminology + * The Curses Library + + An Overview of Curses + o Compiling Programs using Curses + o Updating the Screen + o Standard Windows and Function Naming Conventions + o Variables + + Using the Library + o Starting up + o Output + o Input + o Using Forms Characters + o Character Attributes and Color + o Mouse Interfacing + o Finishing Up + + Function Descriptions + o Initialization and Wrapup + o Causing Output to the Terminal + o Low-Level Capability Access + o Debugging + + Hints, Tips, and Tricks + o Some Notes of Caution + o Temporarily Leaving ncurses Mode + o Using ncurses under xterm + o Handling Multiple Terminal Screens + o Testing for Terminal Capabilities + o Tuning for Speed + o Special Features of ncurses + + Compatibility with Older Versions + o Refresh of Overlapping Windows + o Background Erase + + XSI Curses Conformance + * The Panels Library + + Compiling With the Panels Library + + Overview of Panels + + Panels, Input, and the Standard Screen + + Hiding Panels + + Miscellaneous Other Facilities + * The Menu Library + + Compiling with the menu Library + + Overview of Menus + + Selecting items + + Menu Display + + Menu Windows + + Processing Menu Input + + Miscellaneous Other Features + * The Forms Library + + Compiling with the forms Library + + Overview of Forms + + Creating and Freeing Fields and Forms + + Fetching and Changing Field Attributes + o Fetching Size and Location Data + o Changing the Field Location + o The Justification Attribute + o Field Display Attributes + o Field Option Bits + o Field Status + o Field User Pointer + + Variable-Sized Fields + + Field Validation + o TYPE_ALPHA + o TYPE_ALNUM + o TYPE_ENUM + o TYPE_INTEGER + o TYPE_NUMERIC + o TYPE_REGEXP + + Direct Field Buffer Manipulation + + Attributes of Forms + + Control of Form Display + + Input Processing in the Forms Driver + o Page Navigation Requests + o Inter-Field Navigation Requests + o Intra-Field Navigation Requests + o Scrolling Requests + o Field Editing Requests + o Order Requests + o Application Commands + + Field Change Hooks + + Field Change Commands + + Form Options + + Custom Validation Types + o Union Types + o New Field Types + o Validation Function Arguments + o Order Functions For Custom Types + o Avoiding Problems + _________________________________________________________________ + + Introduction + + This document is an introduction to programming with curses. It is not + an exhaustive reference for the curses Application Programming + Interface (API); that role is filled by the curses manual pages. + Rather, it is intended to help C programmers ease into using the + package. + + This document is aimed at C applications programmers not yet + specifically familiar with ncurses. If you are already an experienced + curses programmer, you should nevertheless read the sections on Mouse + Interfacing, Debugging, Compatibility with Older Versions, and Hints, + Tips, and Tricks. These will bring you up to speed on the special + features and quirks of the ncurses implementation. If you are not so + experienced, keep reading. + + The curses package is a subroutine library for terminal-independent + screen-painting and input-event handling which presents a high level + screen model to the programmer, hiding differences between terminal + types and doing automatic optimization of output to change one screen + full of text into another. Curses uses terminfo, which is a database + format that can describe the capabilities of thousands of different + terminals. + + The curses API may seem something of an archaism on UNIX desktops + increasingly dominated by X, Motif, and Tcl/Tk. Nevertheless, UNIX + still supports tty lines and X supports xterm(1); the curses API has + the advantage of (a) back-portability to character-cell terminals, and + (b) simplicity. For an application that does not require bit-mapped + graphics and multiple fonts, an interface implementation using curses + will typically be a great deal simpler and less expensive than one + using an X toolkit. + +A Brief History of Curses + + Historically, the first ancestor of curses was the routines written to + provide screen-handling for the game rogue; these used the + already-existing termcap database facility for describing terminal + capabilities. These routines were abstracted into a documented library + and first released with the early BSD UNIX versions. + + System III UNIX from Bell Labs featured a rewritten and much-improved + curses library. It introduced the terminfo format. Terminfo is based + on Berkeley's termcap database, but contains a number of improvements + and extensions. Parameterized capabilities strings were introduced, + making it possible to describe multiple video attributes, and colors + and to handle far more unusual terminals than possible with termcap. + In the later AT&T System V releases, curses evolved to use more + facilities and offer more capabilities, going far beyond BSD curses in + power and flexibility. + +Scope of This Document + + This document describes ncurses, a freeware implementation of the + System V curses API with some clearly marked extensions. It includes + the following System V curses features: + + * Support for multiple screen highlights (BSD curses could only + handle one `standout' highlight, usually reverse-video). + * Support for line- and box-drawing using forms characters. + * Recognition of function keys on input. + * Color support. + * Support for pads (windows of larger than screen size on which the + screen or a subwindow defines a viewport). + + Also, this package makes use of the insert and delete line and + character features of terminals so equipped, and determines how to + optimally use these features with no help from the programmer. It + allows arbitrary combinations of video attributes to be displayed, + even on terminals that leave ``magic cookies'' on the screen to mark + changes in attributes. + + The ncurses package can also capture and use event reports from a + mouse in some environments (notably, xterm under the X window system). + This document includes tips for using the mouse. + + The ncurses package was originated by Pavel Curtis. The original + maintainer of the package is Zeyd Ben-Halim . + Eric S. Raymond wrote many of the new features + in versions after 1.8.1 and wrote most of this introduction. The + current primary maintainers are Thomas Dickey and + Juergen Pfeifer. + + This document also describes the panels extension library, similarly + modeled on the SVr4 panels facility. This library allows you to + associate backing store with each of a stack or deck of overlapping + windows, and provides operations for moving windows around in the + stack that change their visibility in the natural way (handling window + overlaps). + + Finally, this document describes in detail the menus and forms + extension libraries, also cloned from System V, which support easy + construction and sequences of menus and fill-in forms. This code was + contributed to the project by Jürgen Pfeifer. + +Terminology + + In this document, the following terminology is used with reasonable + consistency: + + window + A data structure describing a sub-rectangle of the screen + (possibly the entire screen). You can write to a window as + though it were a miniature screen, scrolling independently of + other windows on the physical screen. + + screens + A subset of windows which are as large as the terminal screen, + i.e., they start at the upper left hand corner and encompass + the lower right hand corner. One of these, stdscr, is + automatically provided for the programmer. + + terminal screen + The package's idea of what the terminal display currently looks + like, i.e., what the user sees now. This is a special screen. + + The Curses Library + +An Overview of Curses + + Compiling Programs using Curses + + In order to use the library, it is necessary to have certain types and + variables defined. Therefore, the programmer must have a line: + + #include + + at the top of the program source. The screen package uses the Standard + I/O library, so includes . also + includes , , or depending on your + system. It is redundant (but harmless) for the programmer to do these + includes, too. In linking with curses you need to have -lncurses in + your LDFLAGS or on the command line. There is no need for any other + libraries. + + Updating the Screen + + In order to update the screen optimally, it is necessary for the + routines to know what the screen currently looks like and what the + programmer wants it to look like next. For this purpose, a data type + (structure) named WINDOW is defined which describes a window image to + the routines, including its starting position on the screen (the (y, + x) coordinates of the upper left hand corner) and its size. One of + these (called curscr, for current screen) is a screen image of what + the terminal currently looks like. Another screen (called stdscr, for + standard screen) is provided by default to make changes on. + + A window is a purely internal representation. It is used to build and + store a potential image of a portion of the terminal. It doesn't bear + any necessary relation to what is really on the terminal screen; it's + more like a scratchpad or write buffer. + + To make the section of physical screen corresponding to a window + reflect the contents of the window structure, the routine refresh() + (or wrefresh() if the window is not stdscr) is called. + + A given physical screen section may be within the scope of any number + of overlapping windows. Also, changes can be made to windows in any + order, without regard to motion efficiency. Then, at will, the + programmer can effectively say ``make it look like this,'' and let the + package implementation determine the most efficient way to repaint the + screen. + + Standard Windows and Function Naming Conventions + + As hinted above, the routines can use several windows, but two are + automatically given: curscr, which knows what the terminal looks like, + and stdscr, which is what the programmer wants the terminal to look + like next. The user should never actually access curscr directly. + Changes should be made to through the API, and then the routine + refresh() (or wrefresh()) called. + + Many functions are defined to use stdscr as a default screen. For + example, to add a character to stdscr, one calls addch() with the + desired character as argument. To write to a different window. use the + routine waddch() (for `w'indow-specific addch()) is provided. This + convention of prepending function names with a `w' when they are to be + applied to specific windows is consistent. The only routines which do + not follow it are those for which a window must always be specified. + + In order to move the current (y, x) coordinates from one point to + another, the routines move() and wmove() are provided. However, it is + often desirable to first move and then perform some I/O operation. In + order to avoid clumsiness, most I/O routines can be preceded by the + prefix 'mv' and the desired (y, x) coordinates prepended to the + arguments to the function. For example, the calls + + move(y, x); + addch(ch); + + can be replaced by + mvaddch(y, x, ch); + + and + wmove(win, y, x); + waddch(win, ch); + + can be replaced by + mvwaddch(win, y, x, ch); + + Note that the window description pointer (win) comes before the added + (y, x) coordinates. If a function requires a window pointer, it is + always the first parameter passed. + + Variables + + The curses library sets some variables describing the terminal + capabilities. + + type name description + ------------------------------------------------------------------ + int LINES number of lines on the terminal + int COLS number of columns on the terminal + + The curses.h also introduces some #define constants and types of + general usefulness: + + bool + boolean type, actually a `char' (e.g., bool doneit;) + + TRUE + boolean `true' flag (1). + + FALSE + boolean `false' flag (0). + + ERR + error flag returned by routines on a failure (-1). + + OK + error flag returned by routines when things go right. + +Using the Library + + Now we describe how to actually use the screen package. In it, we + assume all updating, reading, etc. is applied to stdscr. These + instructions will work on any window, providing you change the + function names and parameters as mentioned above. + + Here is a sample program to motivate the discussion: + +#include +#include + +static void finish(int sig); + +main(int argc, char *argv[]) +{ + /* initialize your non-curses data structures here */ + + (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ + + (void) initscr(); /* initialize the curses library */ + keypad(stdscr, TRUE); /* enable keyboard mapping */ + (void) nonl(); /* tell curses not to do NL->CR/NL on output */ + (void) cbreak(); /* take input chars one at a time, no wait for \n */ + (void) noecho(); /* don't echo input */ + + if (has_colors()) + { + start_color(); + + /* + * Simple color assignment, often all we need. + */ + init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_BLACK); + init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK); + init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK); + init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK); + init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK); + init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK); + init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK); + init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK); + } + + for (;;) + { + int c = getch(); /* refresh, accept single keystroke of input */ + + /* process the command keystroke */ + } + + finish(0); /* we're done */ +} + +static void finish(int sig) +{ + endwin(); + + /* do your non-curses wrapup here */ + + exit(0); +} + + Starting up + + In order to use the screen package, the routines must know about + terminal characteristics, and the space for curscr and stdscr must be + allocated. These function initscr() does both these things. Since it + must allocate space for the windows, it can overflow memory when + attempting to do so. On the rare occasions this happens, initscr() + will terminate the program with an error message. initscr() must + always be called before any of the routines which affect windows are + used. If it is not, the program will core dump as soon as either + curscr or stdscr are referenced. However, it is usually best to wait + to call it until after you are sure you will need it, like after + checking for startup errors. Terminal status changing routines like + nl() and cbreak() should be called after initscr(). + + Once the screen windows have been allocated, you can set them up for + your program. If you want to, say, allow a screen to scroll, use + scrollok(). If you want the cursor to be left in place after the last + change, use leaveok(). If this isn't done, refresh() will move the + cursor to the window's current (y, x) coordinates after updating it. + + You can create new windows of your own using the functions newwin(), + derwin(), and subwin(). The routine delwin() will allow you to get rid + of old windows. All the options described above can be applied to any + window. + + Output + + Now that we have set things up, we will want to actually update the + terminal. The basic functions used to change what will go on a window + are addch() and move(). addch() adds a character at the current (y, x) + coordinates. move() changes the current (y, x) coordinates to whatever + you want them to be. It returns ERR if you try to move off the window. + As mentioned above, you can combine the two into mvaddch() to do both + things at once. + + The other output functions, such as addstr() and printw(), all call + addch() to add characters to the window. + + After you have put on the window what you want there, when you want + the portion of the terminal covered by the window to be made to look + like it, you must call refresh(). In order to optimize finding + changes, refresh() assumes that any part of the window not changed + since the last refresh() of that window has not been changed on the + terminal, i.e., that you have not refreshed a portion of the terminal + with an overlapping window. If this is not the case, the routine + touchwin() is provided to make it look like the entire window has been + changed, thus making refresh() check the whole subsection of the + terminal for changes. + + If you call wrefresh() with curscr as its argument, it will make the + screen look like curscr thinks it looks like. This is useful for + implementing a command which would redraw the screen in case it get + messed up. + + Input + + The complementary function to addch() is getch() which, if echo is + set, will call addch() to echo the character. Since the screen package + needs to know what is on the terminal at all times, if characters are + to be echoed, the tty must be in raw or cbreak mode. Since initially + the terminal has echoing enabled and is in ordinary ``cooked'' mode, + one or the other has to changed before calling getch(); otherwise, the + program's output will be unpredictable. + + When you need to accept line-oriented input in a window, the functions + wgetstr() and friends are available. There is even a wscanw() function + that can do scanf()(3)-style multi-field parsing on window input. + These pseudo-line-oriented functions turn on echoing while they + execute. + + The example code above uses the call keypad(stdscr, TRUE) to enable + support for function-key mapping. With this feature, the getch() code + watches the input stream for character sequences that correspond to + arrow and function keys. These sequences are returned as + pseudo-character values. The #define values returned are listed in the + curses.h The mapping from sequences to #define values is determined by + key_ capabilities in the terminal's terminfo entry. + + Using Forms Characters + + The addch() function (and some others, including box() and border()) + can accept some pseudo-character arguments which are specially defined + by ncurses. These are #define values set up in the curses.h header; + see there for a complete list (look for the prefix ACS_). + + The most useful of the ACS defines are the forms-drawing characters. + You can use these to draw boxes and simple graphs on the screen. If + the terminal does not have such characters, curses.h will map them to + a recognizable (though ugly) set of ASCII defaults. + + Character Attributes and Color + + The ncurses package supports screen highlights including standout, + reverse-video, underline, and blink. It also supports color, which is + treated as another kind of highlight. + + Highlights are encoded, internally, as high bits of the + pseudo-character type (chtype) that curses.h uses to represent the + contents of a screen cell. See the curses.h header file for a complete + list of highlight mask values (look for the prefix A_). + + There are two ways to make highlights. One is to logical-or the value + of the highlights you want into the character argument of an addch() + call, or any other output call that takes a chtype argument. + + The other is to set the current-highlight value. This is logical-or'ed + with any highlight you specify the first way. You do this with the + functions attron(), attroff(), and attrset(); see the manual pages for + details. Color is a special kind of highlight. The package actually + thinks in terms of color pairs, combinations of foreground and + background colors. The sample code above sets up eight color pairs, + all of the guaranteed-available colors on black. Note that each color + pair is, in effect, given the name of its foreground color. Any other + range of eight non-conflicting values could have been used as the + first arguments of the init_pair() values. + + Once you've done an init_pair() that creates color-pair N, you can use + COLOR_PAIR(N) as a highlight that invokes that particular color + combination. Note that COLOR_PAIR(N), for constant N, is itself a + compile-time constant and can be used in initializers. + + Mouse Interfacing + + The ncurses library also provides a mouse interface. Note: his + facility is original to ncurses, it is not part of either the XSI + Curses standard, nor of System V Release 4, nor BSD curses. Thus, we + recommend that you wrap mouse-related code in an #ifdef using the + feature macro NCURSES_MOUSE_VERSION so it will not be compiled and + linked on non-ncurses systems. + + Presently, mouse event reporting works only under xterm. In the + future, ncurses will detect the presence of gpm(1), Alessandro + Rubini's freeware mouse server for Linux systems, and accept mouse + reports through it. + + The mouse interface is very simple. To activate it, you use the + function mousemask(), passing it as first argument a bit-mask that + specifies what kinds of events you want your program to be able to + see. It will return the bit-mask of events that actually become + visible, which may differ from the argument if the mouse device is not + capable of reporting some of the event types you specify. + + Once the mouse is active, your application's command loop should watch + for a return value of KEY_MOUSE from wgetch(). When you see this, a + mouse event report has been queued. To pick it off the queue, use the + function getmouse() (you must do this before the next wgetch(), + otherwise another mouse event might come in and make the first one + inaccessible). + + Each call to getmouse() fills a structure (the address of which you'll + pass it) with mouse event data. The event data includes zero-origin, + screen-relative character-cell coordinates of the mouse pointer. It + also includes an event mask. Bits in this mask will be set, + corresponding to the event type being reported. + + The mouse structure contains two additional fields which may be + significant in the future as ncurses interfaces to new kinds of + pointing device. In addition to x and y coordinates, there is a slot + for a z coordinate; this might be useful with touch-screens that can + return a pressure or duration parameter. There is also a device ID + field, which could be used to distinguish between multiple pointing + devices. + + The class of visible events may be changed at any time via + mousemask(). Events that can be reported include presses, releases, + single-, double- and triple-clicks (you can set the maximum + button-down time for clicks). If you don't make clicks visible, they + will be reported as press-release pairs. In some environments, the + event mask may include bits reporting the state of shift, alt, and + ctrl keys on the keyboard during the event. + + A function to check whether a mouse event fell within a given window + is also supplied. You can use this to see whether a given window + should consider a mouse event relevant to it. + + Because mouse event reporting will not be available in all + environments, it would be unwise to build ncurses applications that + require the use of a mouse. Rather, you should use the mouse as a + shortcut for point-and-shoot commands your application would normally + accept from the keyboard. Two of the test games in the ncurses + distribution (bs and knight) contain code that illustrates how this + can be done. + + See the manual page curs_mouse(3X) for full details of the + mouse-interface functions. + + Finishing Up + + In order to clean up after the ncurses routines, the routine endwin() + is provided. It restores tty modes to what they were when initscr() + was first called, and moves the cursor down to the lower-left corner. + Thus, anytime after the call to initscr, endwin() should be called + before exiting. + +Function Descriptions + + We describe the detailed behavior of some important curses functions + here, as a supplement to the manual page descriptions. + + Initialization and Wrapup + + initscr() + The first function called should almost always be initscr(). + This will determine the terminal type and initialize curses + data structures. initscr() also arranges that the first call to + refresh() will clear the screen. If an error occurs a message + is written to standard error and the program exits. Otherwise + it returns a pointer to stdscr. A few functions may be called + before initscr (slk_init(), filter(), ripofflines(), use_env(), + and, if you are using multiple terminals, newterm().) + + endwin() + Your program should always call endwin() before exiting or + shelling out of the program. This function will restore tty + modes, move the cursor to the lower left corner of the screen, + reset the terminal into the proper non-visual mode. Calling + refresh() or doupdate() after a temporary escape from the + program will restore the ncurses screen from before the escape. + + newterm(type, ofp, ifp) + A program which outputs to more than one terminal should use + newterm() instead of initscr(). newterm() should be called once + for each terminal. It returns a variable of type SCREEN * which + should be saved as a reference to that terminal. The arguments + are the type of the terminal (a string) and FILE pointers for + the output and input of the terminal. If type is NULL then the + environment variable $TERM is used. endwin() should called once + at wrapup time for each terminal opened using this function. + + set_term(new) + This function is used to switch to a different terminal + previously opened by newterm(). The screen reference for the + new terminal is passed as the parameter. The previous terminal + is returned by the function. All other calls affect only the + current terminal. + + delscreen(sp) + The inverse of newterm(); deallocates the data structures + associated with a given SCREEN reference. + + Causing Output to the Terminal + + refresh() and wrefresh(win) + These functions must be called to actually get any output on + the terminal, as other routines merely manipulate data + structures. wrefresh() copies the named window to the physical + terminal screen, taking into account what is already there in + order to do optimizations. refresh() does a refresh of + stdscr(). Unless leaveok() has been enabled, the physical + cursor of the terminal is left at the location of the window's + cursor. + + doupdate() and wnoutrefresh(win) + These two functions allow multiple updates with more efficiency + than wrefresh. To use them, it is important to understand how + curses works. In addition to all the window structures, curses + keeps two data structures representing the terminal screen: a + physical screen, describing what is actually on the screen, and + a virtual screen, describing what the programmer wants to have + on the screen. wrefresh works by first copying the named window + to the virtual screen (wnoutrefresh()), and then calling the + routine to update the screen (doupdate()). If the programmer + wishes to output several windows at once, a series of calls to + wrefresh will result in alternating calls to wnoutrefresh() and + doupdate(), causing several bursts of output to the screen. By + calling wnoutrefresh() for each window, it is then possible to + call doupdate() once, resulting in only one burst of output, + with fewer total characters transmitted (this also avoids a + visually annoying flicker at each update). + + Low-Level Capability Access + + setupterm(term, filenum, errret) + This routine is called to initialize a terminal's description, + without setting up the curses screen structures or changing the + tty-driver mode bits. term is the character string representing + the name of the terminal being used. filenum is the UNIX file + descriptor of the terminal to be used for output. errret is a + pointer to an integer, in which a success or failure indication + is returned. The values returned can be 1 (all is well), 0 (no + such terminal), or -1 (some problem locating the terminfo + database). + + The value of term can be given as NULL, which will cause the + value of TERM in the environment to be used. The errret pointer + can also be given as NULL, meaning no error code is wanted. If + errret is defaulted, and something goes wrong, setupterm() will + print an appropriate error message and exit, rather than + returning. Thus, a simple program can call setupterm(0, 1, 0) + and not worry about initialization errors. + + After the call to setupterm(), the global variable cur_term is + set to point to the current structure of terminal capabilities. + By calling setupterm() for each terminal, and saving and + restoring cur_term, it is possible for a program to use two or + more terminals at once. Setupterm() also stores the names + section of the terminal description in the global character + array ttytype[]. Subsequent calls to setupterm() will overwrite + this array, so you'll have to save it yourself if need be. + + Debugging + + NOTE: These functions are not part of the standard curses API! + + trace() + This function can be used to explicitly set a trace level. If + the trace level is nonzero, execution of your program will + generate a file called `trace' in the current working directory + containing a report on the library's actions. Higher trace + levels enable more detailed (and verbose) reporting -- see + comments attached to TRACE_ defines in the curses.h file for + details. (It is also possible to set a trace level by assigning + a trace level value to the environment variable NCURSES_TRACE). + + _tracef() + This function can be used to output your own debugging + information. It is only available only if you link with + -lncurses_g. It can be used the same way as printf(), only it + outputs a newline after the end of arguments. The output goes + to a file called trace in the current directory. + + Trace logs can be difficult to interpret due to the sheer volume of + data dumped in them. There is a script called tracemunch included with + the ncurses distribution that can alleviate this problem somewhat; it + compacts long sequences of similar operations into more succinct + single-line pseudo-operations. These pseudo-ops can be distinguished + by the fact that they are named in capital letters. + +Hints, Tips, and Tricks + + The ncurses manual pages are a complete reference for this library. In + the remainder of this document, we discuss various useful methods that + may not be obvious from the manual page descriptions. + + Some Notes of Caution + + If you find yourself thinking you need to use noraw() or nocbreak(), + think again and move carefully. It's probably better design to use + getstr() or one of its relatives to simulate cooked mode. The noraw() + and nocbreak() functions try to restore cooked mode, but they may end + up clobbering some control bits set before you started your + application. Also, they have always been poorly documented, and are + likely to hurt your application's usability with other curses + libraries. + + Bear in mind that refresh() is a synonym for wrefresh(stdscr), and + don't try to mix use of stdscr with use of windows declared by + newwin(); a refresh() call will blow them off the screen. The right + way to handle this is to use subwin(), or not touch stdscr at all and + tile your screen with declared windows which you then wnoutrefresh() + somewhere in your program event loop, with a single doupdate() call to + trigger actual repainting. + + You are much less likely to run into problems if you design your + screen layouts to use tiled rather than overlapping windows. + Historically, curses support for overlapping windows has been weak, + fragile, and poorly documented. The ncurses library is not yet an + exception to this rule. + + There is a freeware panels library included in the ncurses + distribution that does a pretty good job of strengthening the + overlapping-windows facilities. + + Try to avoid using the global variables LINES and COLS. Use getmaxyx() + on the stdscr context instead. Reason: your code may be ported to run + in an environment with window resizes, in which case several screens + could be open with different sizes. + + Temporarily Leaving ncurses Mode + + Sometimes you will want to write a program that spends most of its + time in screen mode, but occasionally returns to ordinary `cooked' + mode. A common reason for this is to support shell-out. This behavior + is simple to arrange in ncurses. + + To leave ncurses mode, call endwin() as you would if you were + intending to terminate the program. This will take the screen back to + cooked mode; you can do your shell-out. When you want to return to + ncurses mode, simply call refresh() or doupdate(). This will repaint + the screen. + + There is a boolean function, isendwin(), which code can use to test + whether ncurses screen mode is active. It returns TRUE in the interval + between an endwin() call and the following refresh(), FALSE otherwise. + + Here is some sample code for shellout: + addstr("Shelling out..."); + def_prog_mode(); /* save current tty modes */ + endwin(); /* restore original tty modes */ + system("sh"); /* run shell */ + addstr("returned.\n"); /* prepare return message */ + refresh(); /* restore save modes, repaint screen */ + + Using ncurses Under xterm + + A resize operation in X sends SIGWINCH to the application running + under xterm. The ncurses library does not catch this signal, because + it cannot in general know how you want the screen re-painted. You will + have to write the SIGWINCH handler yourself. + + The easiest way to code your SIGWINCH handler is to have it do an + endwin, followed by an refresh and a screen repaint you code yourself. + The refresh will pick up the new screen size from the xterm's + environment. + + Handling Multiple Terminal Screens + + The initscr() function actually calls a function named newterm() to do + most of its work. If you are writing a program that opens multiple + terminals, use newterm() directly. + + For each call, you will have to specify a terminal type and a pair of + file pointers; each call will return a screen reference, and stdscr + will be set to the last one allocated. You will switch between screens + with the set_term call. Note that you will also have to call + def_shell_mode and def_prog_mode on each tty yourself. + + Testing for Terminal Capabilities + + Sometimes you may want to write programs that test for the presence of + various capabilities before deciding whether to go into ncurses mode. + An easy way to do this is to call setupterm(), then use the functions + tigetflag(), tigetnum(), and tigetstr() to do your testing. + + A particularly useful case of this often comes up when you want to + test whether a given terminal type should be treated as `smart' + (cursor-addressable) or `stupid'. The right way to test this is to see + if the return value of tigetstr("cup") is non-NULL. Alternatively, you + can include the term.h file and test the value of the macro + cursor_address. + + Tuning for Speed + + Use the addchstr() family of functions for fast screen-painting of + text when you know the text doesn't contain any control characters. + Try to make attribute changes infrequent on your screens. Don't use + the immedok() option! + + Special Features of ncurses + + When running on PC-clones, ncurses has enhanced support for the IBM + high-half and ROM characters. The A_ALTCHARSET highlight, enables + display of both high-half ACS graphics and the PC ROM graphics 0-31 + that are normally interpreted as control characters. + + The wresize() function allows you to resize a window in place. + +Compatibility with Older Versions + + Despite our best efforts, there are some differences between ncurses + and the (undocumented!) behavior of older curses implementations. + These arise from ambiguities or omissions in the documentation of the + API. + + Refresh of Overlapping Windows + + If you define two windows A and B that overlap, and then alternately + scribble on and refresh them, the changes made to the overlapping + region under historic curses versions were often not documented + precisely. + + To understand why this is a problem, remember that screen updates are + calculated between two representations of the entire display. The + documentation says that when you refresh a window, it is first copied + to to the virtual screen, and then changes are calculated to update + the physical screen (and applied to the terminal). But "copied to" is + not very specific, and subtle differences in how copying works can + produce different behaviors in the case where two overlapping windows + are each being refreshed at unpredictable intervals. + + What happens to the overlapping region depends on what wnoutrefresh() + does with its argument -- what portions of the argument window it + copies to the virtual screen. Some implementations do "change copy", + copying down only locations in the window that have changed (or been + marked changed with wtouchln() and friends). Some implementations do + "entire copy", copying all window locations to the virtual screen + whether or not they have changed. + + The ncurses library itself has not always been consistent on this + score. Due to a bug, versions 1.8.7 to 1.9.8a did entire copy. + Versions 1.8.6 and older, and versions 1.9.9 and newer, do change + copy. + + For most commercial curses implementations, it is not documented and + not known for sure (at least not to the ncurses maintainers) whether + they do change copy or entire copy. We know that System V release 3 + curses has logic in it that looks like an attempt to do change copy, + but the surrounding logic and data representations are sufficiently + complex, and our knowledge sufficiently indirect, that it's hard to + know whether this is reliable. It is not clear what the SVr4 + documentation and XSI standard intend. The XSI Curses standard barely + mentions wnoutrefresh(); the SVr4 documents seem to be describing + entire-copy, but it is possible with some effort and straining to read + them the other way. + + It might therefore be unwise to rely on either behavior in programs + that might have to be linked with other curses implementations. + Instead, you can do an explicit touchwin() before the wnoutrefresh() + call to guarantee an entire-contents copy anywhere. + + The really clean way to handle this is to use the panels library. If, + when you want a screen update, you do update_panels(), it will do all + the necessary wnoutrfresh() calls for whatever panel stacking order + you have defined. Then you can do one doupdate() and there will be a + single burst of physical I/O that will do all your updates. + + Background Erase + + If you have been using a very old versions of ncurses (1.8.7 or older) + you may be surprised by the behavior of the erase functions. In older + versions, erased areas of a window were filled with a blank modified + by the window's current attribute (as set by wattrset(), wattron(), + wattroff() and friends). + + In newer versions, this is not so. Instead, the attribute of erased + blanks is normal unless and until it is modified by the functions + bkgdset() or wbkgdset(). + + This change in behavior conforms ncurses to System V Release 4 and the + XSI Curses standard. + +XSI Curses Conformance + + The ncurses library is intended to be base-level conformant with the + XSI Curses standard from X/Open. Many extended-level features (in + fact, almost all features not directly concerned with wide characters + and internationalization) are also supported. + + One effect of XSI conformance is the change in behavior described + under "Background Erase -- Compatibility with Old Versions". + + Also, ncurses meets the XSI requirement that every macro entry point + have a corresponding function which may be linked (and will be + prototype-checked) if the macro definition is disabled with #undef. + + The Panels Library + + The ncurses library by itself provides good support for screen + displays in which the windows are tiled (non-overlapping). In the more + general case that windows may overlap, you have to use a series of + wnoutrefresh() calls followed by a doupdate(), and be careful about + the order you do the window refreshes in. It has to be bottom-upwards, + otherwise parts of windows that should be obscured will show through. + + When your interface design is such that windows may dive deeper into + the visibility stack or pop to the top at runtime, the resulting + book-keeping can be tedious and difficult to get right. Hence the + panels library. + + The panel library first appeared in AT&T System V. The version + documented here is the freeware panel code distributed with ncurses. + +Compiling With the Panels Library + + Your panels-using modules must import the panels library declarations + with + + #include + + and must be linked explicitly with the panels library using an -lpanel + argument. Note that they must also link the ncurses library with + -lncurses. Many linkers are two-pass and will accept either order, but + it is still good practice to put -lpanel first and -lncurses second. + +Overview of Panels + + A panel object is a window that is implicitly treated as part of a + deck including all other panel objects. The deck has an implicit + bottom-to-top visibility order. The panels library includes an update + function (analogous to refresh()) that displays all panels in the deck + in the proper order to resolve overlaps. The standard window, stdscr, + is considered below all panels. + + Details on the panels functions are available in the man pages. We'll + just hit the highlights here. + + You create a panel from a window by calling new_panel() on a window + pointer. It then becomes the top of the deck. The panel's window is + available as the value of panel_window() called with the panel pointer + as argument. + + You can delete a panel (removing it from the deck) with del_panel. + This will not deallocate the associated window; you have to do that + yourself. You can replace a panel's window with a different window by + calling replace_window. The new window may be of different size; the + panel code will re-compute all overlaps. This operation doesn't change + the panel's position in the deck. + + To move a panel's window, use move_panel(). The mvwin() function on + the panel's window isn't sufficient because it doesn't update the + panels library's representation of where the windows are. This + operation leaves the panel's depth, contents, and size unchanged. + + Two functions (top_panel(), bottom_panel()) are provided for + rearranging the deck. The first pops its argument window to the top of + the deck; the second sends it to the bottom. Either operation leaves + the panel's screen location, contents, and size unchanged. + + The function update_panels() does all the wnoutrefresh() calls needed + to prepare for doupdate() (which you must call yourself, afterwards). + + Typically, you will want to call update_panels() and doupdate() just + before accepting command input, once in each cycle of interaction with + the user. If you call update_panels() after each and every panel + write, you'll generate a lot of unnecessary refresh activity and + screen flicker. + +Panels, Input, and the Standard Screen + + You shouldn't mix wnoutrefresh() or wrefresh() operations with panels + code; this will work only if the argument window is either in the top + panel or unobscured by any other panels. + + The stsdcr window is a special case. It is considered below all + panels. Because changes to panels may obscure parts of stdscr, though, + you should call update_panels() before doupdate() even when you only + change stdscr. + + Note that wgetch automatically calls wrefresh. Therefore, before + requesting input from a panel window, you need to be sure that the + panel is totally unobscured. + + There is presently no way to display changes to one obscured panel + without repainting all panels. + +Hiding Panels + + It's possible to remove a panel from the deck temporarily; use + hide_panel for this. Use show_panel() to render it visible again. The + predicate function panel_hidden tests whether or not a panel is + hidden. + + The panel_update code ignores hidden panels. You cannot do top_panel() + or bottom_panel on a hidden panel(). Other panels operations are + applicable. + +Miscellaneous Other Facilities + + It's possible to navigate the deck using the functions panel_above() + and panel_below. Handed a panel pointer, they return the panel above + or below that panel. Handed NULL, they return the bottom-most or + top-most panel. + + Every panel has an associated user pointer, not used by the panel + code, to which you can attach application data. See the man page + documentation of set_panel_userptr() and panel_userptr for details. + + The Menu Library + + A menu is a screen display that assists the user to choose some subset + of a given set of items. The menu library is a curses extension that + supports easy programming of menu hierarchies with a uniform but + flexible interface. + + The menu library first appeared in AT&T System V. The version + documented here is the freeware menu code distributed with ncurses. + +Compiling With the menu Library + + Your menu-using modules must import the menu library declarations with + + #include + + and must be linked explicitly with the menus library using an -lmenu + argument. Note that they must also link the ncurses library with + -lncurses. Many linkers are two-pass and will accept either order, but + it is still good practice to put -lmenu first and -lncurses second. + +Overview of Menus + + The menus created by this library consist of collections of items + including a name string part and a description string part. To make + menus, you create groups of these items and connect them with menu + frame objects. + + The menu can then by posted, that is written to an associated window. + Actually, each menu has two associated windows; a containing window in + which the programmer can scribble titles or borders, and a subwindow + in which the menu items proper are displayed. If this subwindow is too + small to display all the items, it will be a scrollable viewport on + the collection of items. + + A menu may also be unposted (that is, undisplayed), and finally freed + to make the storage associated with it and its items available for + re-use. + + The general flow of control of a menu program looks like this: + 1. Initialize curses. + 2. Create the menu items, using new_item(). + 3. Create the menu using new_menu(). + 4. Post the menu using menu_post(). + 5. Refresh the screen. + 6. Process user requests via an input loop. + 7. Unpost the menu using menu_unpost(). + 8. Free the menu, using free_menu(). + 9. Free the items using free_item(). + 10. Terminate curses. + +Selecting items + + Menus may be multi-valued or (the default) single-valued (see the + manual page menu_opts(3x) to see how to change the default). Both + types always have a current item. + + From a single-valued menu you can read the selected value simply by + looking at the current item. From a multi-valued menu, you get the + selected set by looping through the items applying the item_value() + predicate function. Your menu-processing code can use the function + set_item_value() to flag the items in the select set. + + Menu items can be made unselectable using set_item_opts() or + item_opts_off() with the O_SELECTABLE argument. This is the only + option so far defined for menus, but it is good practice to code as + though other option bits might be on. + +Menu Display + + The menu library calculates a minimum display size for your window, + based on the following variables: + + * The number and maximum length of the menu items + * Whether the O_ROWMAJOR option is enabled + * Whether display of descriptions is enabled + * Whatever menu format may have been set by the programmer + * The length of the menu mark string used for highlighting selected + items + + The function set_menu_format() allows you to set the maximum size of + the viewport or menu page that will be used to display menu items. You + can retrieve any format associated with a menu with menu_format(). The + default format is rows=16, columns=1. + + The actual menu page may be smaller than the format size. This depends + on the item number and size and whether O_ROWMAJOR is on. This option + (on by default) causes menu items to be displayed in a `raster-scan' + pattern, so that if more than one item will fit horizontally the first + couple of items are side-by-side in the top row. The alternative is + column-major display, which tries to put the first several items in + the first column. + + As mentioned above, a menu format not large enough to allow all items + to fit on-screen will result in a menu display that is vertically + scrollable. + + You can scroll it with requests to the menu driver, which will be + described in the section on menu input handling. + + Each menu has a mark string used to visually tag selected items; see + the menu_mark(3x) manual page for details. The mark string length also + influences the menu page size. + + The function scale_menu() returns the minimum display size that the + menu code computes from all these factors. There are other menu + display attributes including a select attribute, an attribute for + selectable items, an attribute for unselectable items, and a pad + character used to separate item name text from description text. These + have reasonable defaults which the library allows you to change (see + the menu_attribs(3x) manual page. + +Menu Windows + + Each menu has, as mentioned previously, a pair of associated windows. + Both these windows are painted when the menu is posted and erased when + the menu is unposted. + + The outer or frame window is not otherwise touched by the menu + routines. It exists so the programmer can associate a title, a border, + or perhaps help text with the menu and have it properly refreshed or + erased at post/unpost time. The inner window or subwindow is where the + current menu page is displayed. + + By default, both windows are stdscr. You can set them with the + functions in menu_win(3x). + + When you call menu_post(), you write the menu to its subwindow. When + you call menu_unpost(), you erase the subwindow, However, neither of + these actually modifies the screen. To do that, call wrefresh() or + some equivalent. + +Processing Menu Input + + The main loop of your menu-processing code should call menu_driver() + repeatedly. The first argument of this routine is a menu pointer; the + second is a menu command code. You should write an input-fetching + routine that maps input characters to menu command codes, and pass its + output to menu_driver(). The menu command codes are fully documented + in menu_driver(3x). + + The simplest group of command codes is REQ_NEXT_ITEM, REQ_PREV_ITEM, + REQ_FIRST_ITEM, REQ_LAST_ITEM, REQ_UP_ITEM, REQ_DOWN_ITEM, + REQ_LEFT_ITEM, REQ_RIGHT_ITEM. These change the currently selected + item. These requests may cause scrolling of the menu page if it only + partially displayed. + + There are explicit requests for scrolling which also change the + current item (because the select location does not change, but the + item there does). These are REQ_SCR_DLINE, REQ_SCR_ULINE, + REQ_SCR_DPAGE, and REQ_SCR_UPAGE. + + The REQ_TOGGLE_ITEM selects or deselects the current item. It is for + use in multi-valued menus; if you use it with O_ONEVALUE on, you'll + get an error return (E_REQUEST_DENIED). + + Each menu has an associated pattern buffer. The menu_driver() logic + tries to accumulate printable ASCII characters passed in in that + buffer; when it matches a prefix of an item name, that item (or the + next matching item) is selected. If appending a character yields no + new match, that character is deleted from the pattern buffer, and + menu_driver() returns E_NO_MATCH. + + Some requests change the pattern buffer directly: REQ_CLEAR_PATTERN, + REQ_BACK_PATTERN, REQ_NEXT_MATCH, REQ_PREV_MATCH. The latter two are + useful when pattern buffer input matches more than one item in a + multi-valued menu. + + Each successful scroll or item navigation request clears the pattern + buffer. It is also possible to set the pattern buffer explicitly with + set_menu_pattern(). + + Finally, menu driver requests above the constant MAX_COMMAND are + considered application-specific commands. The menu_driver() code + ignores them and returns E_UNKNOWN_COMMAND. + +Miscellaneous Other Features + + Various menu options can affect the processing and visual appearance + and input processing of menus. See menu_opts(3x) for details. + + It is possible to change the current item from application code; this + is useful if you want to write your own navigation requests. It is + also possible to explicitly set the top row of the menu display. See + mitem_current(3x). If your application needs to change the menu + subwindow cursor for any reason, pos_menu_cursor() will restore it to + the correct location for continuing menu driver processing. + + It is possible to set hooks to be called at menu initialization and + wrapup time, and whenever the selected item changes. See + menu_hook(3x). + + Each item, and each menu, has an associated user pointer on which you + can hang application data. See mitem_userptr(3x) and menu_userptr(3x). + + The Forms Library + + The form library is a curses extension that supports easy programming + of on-screen forms for data entry and program control. + + The form library first appeared in AT&T System V. The version + documented here is the freeware form code distributed with ncurses. + +Compiling With the form Library + + Your form-using modules must import the form library declarations with + + #include + + and must be linked explicitly with the forms library using an -lform + argument. Note that they must also link the ncurses library with + -lncurses. Many linkers are two-pass and will accept either order, but + it is still good practice to put -lform first and -lncurses second. + +Overview of Forms + + A form is a collection of fields; each field may be either a label + (explanatory text) or a data-entry location. Long forms may be + segmented into pages; each entry to a new page clears the screen. + + To make forms, you create groups of fields and connect them with form + frame objects; the form library makes this relatively simple. + + Once defined, a form can be posted, that is written to an associated + window. Actually, each form has two associated windows; a containing + window in which the programmer can scribble titles or borders, and a + subwindow in which the form fields proper are displayed. + + As the form user fills out the posted form, navigation and editing + keys support movement between fields, editing keys support modifying + field, and plain text adds to or changes data in a current field. The + form library allows you (the forms designer) to bind each navigation + and editing key to any keystroke accepted by curses Fields may have + validation conditions on them, so that they check input data for type + and value. The form library supplies a rich set of pre-defined field + types, and makes it relatively easy to define new ones. + + Once its transaction is completed (or aborted), a form may be unposted + (that is, undisplayed), and finally freed to make the storage + associated with it and its items available for re-use. + + The general flow of control of a form program looks like this: + 1. Initialize curses. + 2. Create the form fields, using new_field(). + 3. Create the form using new_form(). + 4. Post the form using form_post(). + 5. Refresh the screen. + 6. Process user requests via an input loop. + 7. Unpost the form using form_unpost(). + 8. Free the form, using free_form(). + 9. Free the fields using free_field(). + 10. Terminate curses. + + Note that this looks much like a menu program; the form library + handles tasks which are in many ways similar, and its interface was + obviously designed to resemble that of the menu library wherever + possible. + + In forms programs, however, the `process user requests' is somewhat + more complicated than for menus. Besides menu-like navigation + operations, the menu driver loop has to support field editing and data + validation. + +Creating and Freeing Fields and Forms + + The basic function for creating fields is new_field(): + +FIELD *new_field(int height, int width, /* new field size */ + int top, int left, /* upper left corner */ + int offscreen, /* number of offscreen rows */ + int nbuf); /* number of working buffers */ + + Menu items always occupy a single row, but forms fields may have + multiple rows. So new_field() requires you to specify a width and + height (the first two arguments, which mist both be greater than + zero). + + You must also specify the location of the field's upper left corner on + the screen (the third and fourth arguments, which must be zero or + greater). Note that these coordinates are relative to the form + subwindow, which will coincide with stdscr by default but need not be + stdscr if you've done an explicit set_form_window() call. + + The fifth argument allows you to specify a number of off-screen rows. + If this is zero, the entire field will always be displayed. If it is + nonzero, the form will be scrollable, with only one screen-full + (initially the top part) displayed at any given time. If you make a + field dynamic and grow it so it will no longer fit on the screen, the + form will become scrollable even if the offscreen argument was + initially zero. + + The forms library allocates one working buffer per field; the size of + each buffer is ((height + offscreen)*width + 1, one character for each + position in the field plus a NUL terminator. The sixth argument is the + number of additional data buffers to allocate for the field; your + application can use them for its own purposes. + +FIELD *dup_field(FIELD *field, /* field to copy */ + int top, int left); /* location of new copy */ + + The function dup_field() duplicates an existing field at a new + location. Size and buffering information are copied; some attribute + flags and status bits are not (see the form_field_new(3X) for + details). + +FIELD *link_field(FIELD *field, /* field to copy */ + int top, int left); /* location of new copy */ + + The function link_field() also duplicates an existing field at a new + location. The difference from dup_field() is that it arranges for the + new field's buffer to be shared with the old one. + + Besides the obvious use in making a field editable from two different + form pages, linked fields give you a way to hack in dynamic labels. If + you declare several fields linked to an original, and then make them + inactive, changes from the original will still be propagated to the + linked fields. + + As with duplicated fields, linked fields have attribute bits separate + from the original. + + As you might guess, all these field-allocations return NULL if the + field allocation is not possible due to an out-of-memory error or + out-of-bounds arguments. + + To connect fields to a form, use + +FORM *new_form(FIELD **fields); + + This function expects to see a NULL-terminated array of field + pointers. Said fields are connected to a newly-allocated form object; + its address is returned (or else NULL if the allocation fails). + + Note that new_field() does not copy the pointer array into private + storage; if you modify the contents of the pointer array during forms + processing, all manner of bizarre things might happen. Also note that + any given field may only be connected to one form. + + The functions free_field() and free_form are available to free field + and form objects. It is an error to attempt to free a field connected + to a form, but not vice-versa; thus, you will generally free your form + objects first. + +Fetching and Changing Field Attributes + + Each form field has a number of location and size attributes + associated with it. There are other field attributes used to control + display and editing of the field. Some (for example, the O_STATIC bit) + involve sufficient complications to be covered in sections of their + own later on. We cover the functions used to get and set several basic + attributes here. + + When a field is created, the attributes not specified by the new_field + function are copied from an invisible system default field. In + attribute-setting and -fetching functions, the argument NULL is taken + to mean this field. Changes to it persist as defaults until your forms + application terminates. + + Fetching Size and Location Data + + You can retrieve field sizes and locations through: + +int field_info(FIELD *field, /* field from which to fetch */ + int *height, *int width, /* field size */ + int *top, int *left, /* upper left corner */ + int *offscreen, /* number of offscreen rows */ + int *nbuf); /* number of working buffers */ + + This function is a sort of inverse of new_field(); instead of setting + size and location attributes of a new field, it fetches them from an + existing one. + + Changing the Field Location + + If is possible to move a field's location on the screen: + +int move_field(FIELD *field, /* field to alter */ + int top, int left); /* new upper-left corner */ + + You can, of course. query the current location through field_info(). + + The Justification Attribute + + One-line fields may be unjustified, justified right, justified left, + or centered. Here is how you manipulate this attribute: + +int set_field_just(FIELD *field, /* field to alter */ + int justmode); /* mode to set */ + +int field_just(FIELD *field); /* fetch mode of field */ + + The mode values accepted and returned by this functions are + preprocessor macros NO_JUSTIFICATION, JUSTIFY_RIGHT, JUSTIFY_LEFT, or + JUSTIFY_CENTER. + + Field Display Attributes + + For each field, you can set a foreground attribute for entered + characters, a background attribute for the entire field, and a pad + character for the unfilled portion of the field. You can also control + pagination of the form. + + This group of four field attributes controls the visual appearance of + the field on the screen, without affecting in any way the data in the + field buffer. + +int set_field_fore(FIELD *field, /* field to alter */ + chtype attr); /* attribute to set */ + +chtype field_fore(FIELD *field); /* field to query */ + +int set_field_back(FIELD *field, /* field to alter */ + chtype attr); /* attribute to set */ + +chtype field_back(FIELD *field); /* field to query */ + +int set_field_pad(FIELD *field, /* field to alter */ + int pad); /* pad character to set */ + +chtype field_pad(FIELD *field); + +int set_new_page(FIELD *field, /* field to alter */ + int flag); /* TRUE to force new page */ + +chtype new_page(FIELD *field); /* field to query */ + + The attributes set and returned by the first four functions are normal + curses(3x) display attribute values (A_STANDOUT, A_BOLD, A_REVERSE + etc). The page bit of a field controls whether it is displayed at the + start of a new form screen. + + Field Option Bits + + There is also a large collection of field option bits you can set to + control various aspects of forms processing. You can manipulate them + with these functions: + +int set_field_opts(FIELD *field, /* field to alter */ + int attr); /* attribute to set */ + +int field_opts_on(FIELD *field, /* field to alter */ + int attr); /* attributes to turn on */ + +int field_opts_off(FIELD *field, /* field to alter */ + int attr); /* attributes to turn off */ + +int field_opts(FIELD *field); /* field to query */ + + By default, all options are on. Here are the available option bits: + + O_VISIBLE + Controls whether the field is visible on the screen. Can be + used during form processing to hide or pop up fields depending + on the value of parent fields. + + O_ACTIVE + Controls whether the field is active during forms processing + (i.e. visited by form navigation keys). Can be used to make + labels or derived fields with buffer values alterable by the + forms application, not the user. + + O_PUBLIC + Controls whether data is displayed during field entry. If this + option is turned off on a field, the library will accept and + edit data in that field, but it will not be displayed and the + visible field cursor will not move. You can turn off the + O_PUBLIC bit to define password fields. + + O_EDIT + Controls whether the field's data can be modified. When this + option is off, all editing requests except REQ_PREV_CHOICE and + REQ_NEXT_CHOICE will fail. Such read-only fields may be useful + for help messages. + + O_WRAP + Controls word-wrapping in multi-line fields. Normally, when any + character of a (blank-separated) word reaches the end of the + current line, the entire word is wrapped to the next line + (assuming there is one). When this option is off, the word will + be split across the line break. + + O_BLANK + Controls field blanking. When this option is on, entering a + character at the first field position erases the entire field + (except for the just-entered character). + + O_AUTOSKIP + Controls automatic skip to next field when this one fills. + Normally, when the forms user tries to type more data into a + field than will fit, the editing location jumps to next field. + When this option is off, the user's cursor will hang at the end + of the field. This option is ignored in dynamic fields that + have not reached their size limit. + + O_NULLOK + Controls whether validation is applied to blank fields. + Normally, it is not; the user can leave a field blank without + invoking the usual validation check on exit. If this option is + off on a field, exit from it will invoke a validation check. + + O_PASSOK + Controls whether validation occurs on every exit, or only after + the field is modified. Normally the latter is true. Setting + O_PASSOK may be useful if your field's validation function may + change during forms processing. + + O_STATIC + Controls whether the field is fixed to its initial dimensions. + If you turn this off, the field becomes dynamic and will + stretch to fit entered data. + + A field's options cannot be changed while the field is currently + selected. However, options may be changed on posted fields that are + not current. + + The option values are bit-masks and can be composed with logical-or in + the obvious way. + +Field Status + + Every field has a status flag, which is set to FALSE when the field is + created and TRUE when the value in field buffer 0 changes. This flag + can be queried and set directly: + +int set_field_status(FIELD *field, /* field to alter */ + int status); /* mode to set */ + +int field_status(FIELD *field); /* fetch mode of field */ + + Setting this flag under program control can be useful if you use the + same form repeatedly, looking for modified fields each time. + + Calling field_status() on a field not currently selected for input + will return a correct value. Calling field_status() on a field that is + currently selected for input may not necessarily give a correct field + status value, because entered data isn't necessarily copied to buffer + zero before the exit validation check. To guarantee that the returned + status value reflects reality, call field_status() either (1) in the + field's exit validation check routine, (2) from the field's or form's + initialization or termination hooks, or (3) just after a + REQ_VALIDATION request has been processed by the forms driver. + +Field User Pointer + + Each field structure contains one character pointer slot that is not + used by the forms library. It is intended to be used by applications + to store private per-field data. You can manipulate it with: + +int set_field_userptr(FIELD *field, /* field to alter */ + char *userptr); /* mode to set */ + +char *field_userptr(FIELD *field); /* fetch mode of field */ + + (Properly, this user pointer field ought to have (void *) type. The + (char *) type is retained for System V compatibility.) + + It is valid to set the user pointer of the default field (with a + set_field_userptr() call passed a NULL field pointer.) When a new + field is created, the default-field user pointer is copied to + initialize the new field's user pointer. + +Variable-Sized Fields + + Normally, a field is fixed at the size specified for it at creation + time. If, however, you turn off its O_STATIC bit, it becomes dynamic + and will automatically resize itself to accommodate data as it is + entered. If the field has extra buffers associated with it, they will + grow right along with the main input buffer. + + A one-line dynamic field will have a fixed height (1) but variable + width, scrolling horizontally to display data within the field area as + originally dimensioned and located. A multi-line dynamic field will + have a fixed width, but variable height (number of rows), scrolling + vertically to display data within the field area as originally + dimensioned and located. + + Normally, a dynamic field is allowed to grow without limit. But it is + possible to set an upper limit on the size of a dynamic field. You do + it with this function: + +int set_max_field(FIELD *field, /* field to alter (may not be NULL) */ + int max_size); /* upper limit on field size */ + + If the field is one-line, max_size is taken to be a column size limit; + if it is multi-line, it is taken to be a line size limit. To disable + any limit, use an argument of zero. The growth limit can be changed + whether or not the O_STATIC bit is on, but has no effect until it is. + + The following properties of a field change when it becomes dynamic: + * If there is no growth limit, there is no final position of the + field; therefore O_AUTOSKIP and O_NL_OVERLOAD are ignored. + * Field justification will be ignored (though whatever justification + is set up will be retained internally and can be queried). + * The dup_field() and link_field() calls copy dynamic-buffer sizes. + If the O_STATIC option is set on one of a collection of links, + buffer resizing will occur only when the field is edited through + that link. + * The call field_info() will retrieve the original static size of + the field; use dynamic_field_info() to get the actual dynamic + size. + +Field Validation + + By default, a field will accept any data that will fit in its input + buffer. However, it is possible to attach a validation type to a + field. If you do this, any attempt to leave the field while it + contains data that doesn't match the validation type will fail. Some + validation types also have a character-validity check for each time a + character is entered in the field. + + A field's validation check (if any) is not called when + set_field_buffer() modifies the input buffer, nor when that buffer is + changed through a linked field. + + The form library provides a rich set of pre-defined validation types, + and gives you the capability to define custom ones of your own. You + can examine and change field validation attributes with the following + functions: + +int set_field_type(FIELD *field, /* field to alter */ + FIELDTYPE *ftype, /* type to associate */ + ...); /* additional arguments*/ + +FIELDTYPE *field_type(FIELD *field); /* field to query */ + + The validation type of a field is considered an attribute of the + field. As with other field attributes, Also, doing set_field_type() + with a NULL field default will change the system default for + validation of newly-created fields. + + Here are the pre-defined validation types: + + TYPE_ALPHA + + This field type accepts alphabetic data; no blanks, no digits, no + special characters (this is checked at character-entry time). It is + set up with: + +int set_field_type(FIELD *field, /* field to alter */ + TYPE_ALPHA, /* type to associate */ + int width); /* maximum width of field */ + + The width argument sets a minimum width of data. Typically you'll want + to set this to the field width; if it's greater than the field width, + the validation check will always fail. A minimum width of zero makes + field completion optional. + + TYPE_ALNUM + + This field type accepts alphabetic data and digits; no blanks, no + special characters (this is checked at character-entry time). It is + set up with: + +int set_field_type(FIELD *field, /* field to alter */ + TYPE_ALNUM, /* type to associate */ + int width); /* maximum width of field */ + + The width argument sets a minimum width of data. As with TYPE_ALPHA, + typically you'll want to set this to the field width; if it's greater + than the field width, the validation check will always fail. A minimum + width of zero makes field completion optional. + + TYPE_ENUM + + This type allows you to restrict a field's values to be among a + specified set of string values (for example, the two-letter postal + codes for U.S. states). It is set up with: + +int set_field_type(FIELD *field, /* field to alter */ + TYPE_ENUM, /* type to associate */ + char **valuelist; /* list of possible values */ + int checkcase; /* case-sensitive? */ + int checkunique); /* must specify uniquely? */ + + The valuelist parameter must point at a NULL-terminated list of valid + strings. The checkcase argument, if true, makes comparison with the + string case-sensitive. + + When the user exits a TYPE_ENUM field, the validation procedure tries + to complete the data in the buffer to a valid entry. If a complete + choice string has been entered, it is of course valid. But it is also + possible to enter a prefix of a valid string and have it completed for + you. + + By default, if you enter such a prefix and it matches more than one + value in the string list, the prefix will be completed to the first + matching value. But the checkunique argument, if true, requires prefix + matches to be unique in order to be valid. + + The REQ_NEXT_CHOICE and REQ_PREV_CHOICE input requests can be + particularly useful with these fields. + + TYPE_INTEGER + + This field type accepts an integer. It is set up as follows: + +int set_field_type(FIELD *field, /* field to alter */ + TYPE_INTEGER, /* type to associate */ + int padding, /* # places to zero-pad to */ + int vmin, int vmax); /* valid range */ + + Valid characters consist of an optional leading minus and digits. The + range check is performed on exit. If the range maximum is less than or + equal to the minimum, the range is ignored. + + If the value passes its range check, it is padded with as many leading + zero digits as necessary to meet the padding argument. + + A TYPE_INTEGER value buffer can conveniently be interpreted with the C + library function atoi(3). + + TYPE_NUMERIC + + This field type accepts a decimal number. It is set up as follows: + +int set_field_type(FIELD *field, /* field to alter */ + TYPE_NUMERIC, /* type to associate */ + int padding, /* # places of precision */ + double vmin, double vmax); /* valid range */ + + Valid characters consist of an optional leading minus and digits. + possibly including a decimal point. If your system supports locale's, + the decimal point character used must be the one defined by your + locale. The range check is performed on exit. If the range maximum is + less than or equal to the minimum, the range is ignored. + + If the value passes its range check, it is padded with as many + trailing zero digits as necessary to meet the padding argument. + + A TYPE_NUMERIC value buffer can conveniently be interpreted with the C + library function atof(3). + + TYPE_REGEXP + + This field type accepts data matching a regular expression. It is set + up as follows: + +int set_field_type(FIELD *field, /* field to alter */ + TYPE_REGEXP, /* type to associate */ + char *regexp); /* expression to match */ + + The syntax for regular expressions is that of regcomp(3). The check + for regular-expression match is performed on exit. + +Direct Field Buffer Manipulation + + The chief attribute of a field is its buffer contents. When a form has + been completed, your application usually needs to know the state of + each field buffer. You can find this out with: + +char *field_buffer(FIELD *field, /* field to query */ + int bufindex); /* number of buffer to query */ + + Normally, the state of the zero-numbered buffer for each field is set + by the user's editing actions on that field. It's sometimes useful to + be able to set the value of the zero-numbered (or some other) buffer + from your application: + +int set_field_buffer(FIELD *field, /* field to alter */ + int bufindex, /* number of buffer to alter */ + char *value); /* string value to set */ + + If the field is not large enough and cannot be resized to a + sufficiently large size to contain the specified value, the value will + be truncated to fit. + + Calling field_buffer() with a null field pointer will raise an error. + Calling field_buffer() on a field not currently selected for input + will return a correct value. Calling field_buffer() on a field that is + currently selected for input may not necessarily give a correct field + buffer value, because entered data isn't necessarily copied to buffer + zero before the exit validation check. To guarantee that the returned + buffer value reflects on-screen reality, call field_buffer() either + (1) in the field's exit validation check routine, (2) from the field's + or form's initialization or termination hooks, or (3) just after a + REQ_VALIDATION request has been processed by the forms driver. + +Attributes of Forms + + As with field attributes, form attributes inherit a default from a + system default form structure. These defaults can be queried or set by + of these functions using a form-pointer argument of NULL. + + The principal attribute of a form is its field list. You can query and + change this list with: + +int set_form_fields(FORM *form, /* form to alter */ + FIELD **fields); /* fields to connect */ + +char *form_fields(FORM *form); /* fetch fields of form */ + +int field_count(FORM *form); /* count connect fields */ + + The second argument of set_form_fields() may be a NULL-terminated + field pointer array like the one required by new_form(). In that case, + the old fields of the form are disconnected but not freed (and + eligible to be connected to other forms), then the new fields are + connected. + + It may also be null, in which case the old fields are disconnected + (and not freed) but no new ones are connected. + + The field_count() function simply counts the number of fields + connected to a given from. It returns -1 if the form-pointer argument + is NULL. + +Control of Form Display + + In the overview section, you saw that to display a form you normally + start by defining its size (and fields), posting it, and refreshing + the screen. There is an hidden step before posting, which is the + association of the form with a frame window (actually, a pair of + windows) within which it will be displayed. By default, the forms + library associates every form with the full-screen window stdscr. + + By making this step explicit, you can associate a form with a declared + frame window on your screen display. This can be useful if you want to + adapt the form display to different screen sizes, dynamically tile + forms on the screen, or use a form as part of an interface layout + managed by panels. + + The two windows associated with each form have the same functions as + their analogues in the menu library. Both these windows are painted + when the form is posted and erased when the form is unposted. + + The outer or frame window is not otherwise touched by the form + routines. It exists so the programmer can associate a title, a border, + or perhaps help text with the form and have it properly refreshed or + erased at post/unpost time. The inner window or subwindow is where the + current form page is actually displayed. + + In order to declare your own frame window for a form, you'll need to + know the size of the form's bounding rectangle. You can get this + information with: + +int scale_form(FORM *form, /* form to query */ + int *rows, /* form rows */ + int *cols); /* form cols */ + + The form dimensions are passed back in the locations pointed to by the + arguments. Once you have this information, you can use it to declare + of windows, then use one of these functions: + +int set_form_win(FORM *form, /* form to alter */ + WINDOW *win); /* frame window to connect */ + +WINDOW *form_win(FORM *form); /* fetch frame window of form */ + +int set_form_sub(FORM *form, /* form to alter */ + WINDOW *win); /* form subwindow to connect */ + +WINDOW *form_sub(FORM *form); /* fetch form subwindow of form */ + + Note that curses operations, including refresh(), on the form, should + be done on the frame window, not the form subwindow. + + It is possible to check from your application whether all of a + scrollable field is actually displayed within the menu subwindow. Use + these functions: + +int data_ahead(FORM *form); /* form to be queried */ + +int data_behind(FORM *form); /* form to be queried */ + + The function data_ahead() returns TRUE if (a) the current field is + one-line and has undisplayed data off to the right, (b) the current + field is multi-line and there is data off-screen below it. + + The function data_behind() returns TRUE if the first (upper left hand) + character position is off-screen (not being displayed). + + Finally, there is a function to restore the form window's cursor to + the value expected by the forms driver: + +int pos_form_cursor(FORM *) /* form to be queried */ + + If your application changes the form window cursor, call this function + before handing control back to the forms driver in order to + re-synchronize it. + +Input Processing in the Forms Driver + + The function form_driver() handles virtualized input requests for form + navigation, editing, and validation requests, just as menu_driver does + for menus (see the section on menu input handling). + +int form_driver(FORM *form, /* form to pass input to */ + int request); /* form request code */ + + Your input virtualization function needs to take input and then + convert it to either an alphanumeric character (which is treated as + data to be entered in the currently-selected field), or a forms + processing request. + + The forms driver provides hooks (through input-validation and + field-termination functions) with which your application code can + check that the input taken by the driver matched what was expected. + + Page Navigation Requests + + These requests cause page-level moves through the form, triggering + display of a new form screen. + + REQ_NEXT_PAGE + Move to the next form page. + + REQ_PREV_PAGE + Move to the previous form page. + + REQ_FIRST_PAGE + Move to the first form page. + + REQ_LAST_PAGE + Move to the last form page. + + These requests treat the list as cyclic; that is, REQ_NEXT_PAGE from + the last page goes to the first, and REQ_PREV_PAGE from the first page + goes to the last. + + Inter-Field Navigation Requests + + These requests handle navigation between fields on the same page. + + REQ_NEXT_FIELD + Move to next field. + + REQ_PREV_FIELD + Move to previous field. + + REQ_FIRST_FIELD + Move to the first field. + + REQ_LAST_FIELD + Move to the last field. + + REQ_SNEXT_FIELD + Move to sorted next field. + + REQ_SPREV_FIELD + Move to sorted previous field. + + REQ_SFIRST_FIELD + Move to the sorted first field. + + REQ_SLAST_FIELD + Move to the sorted last field. + + REQ_LEFT_FIELD + Move left to field. + + REQ_RIGHT_FIELD + Move right to field. + + REQ_UP_FIELD + Move up to field. + + REQ_DOWN_FIELD + Move down to field. + + These requests treat the list of fields on a page as cyclic; that is, + REQ_NEXT_FIELD from the last field goes to the first, and + REQ_PREV_FIELD from the first field goes to the last. The order of the + fields for these (and the REQ_FIRST_FIELD and REQ_LAST_FIELD requests) + is simply the order of the field pointers in the form array (as set up + by new_form() or set_form_fields() + + It is also possible to traverse the fields as if they had been sorted + in screen-position order, so the sequence goes left-to-right and + top-to-bottom. To do this, use the second group of four + sorted-movement requests. + + Finally, it is possible to move between fields using visual directions + up, down, right, and left. To accomplish this, use the third group of + four requests. Note, however, that the position of a form for purposes + of these requests is its upper-left corner. + + For example, suppose you have a multi-line field B, and two + single-line fields A and C on the same line with B, with A to the left + of B and C to the right of B. A REQ_MOVE_RIGHT from A will go to B + only if A, B, and C all share the same first line; otherwise it will + skip over B to C. + + Intra-Field Navigation Requests + + These requests drive movement of the edit cursor within the currently + selected field. + + REQ_NEXT_CHAR + Move to next character. + + REQ_PREV_CHAR + Move to previous character. + + REQ_NEXT_LINE + Move to next line. + + REQ_PREV_LINE + Move to previous line. + + REQ_NEXT_WORD + Move to next word. + + REQ_PREV_WORD + Move to previous word. + + REQ_BEG_FIELD + Move to beginning of field. + + REQ_END_FIELD + Move to end of field. + + REQ_BEG_LINE + Move to beginning of line. + + REQ_END_LINE + Move to end of line. + + REQ_LEFT_CHAR + Move left in field. + + REQ_RIGHT_CHAR + Move right in field. + + REQ_UP_CHAR + Move up in field. + + REQ_DOWN_CHAR + Move down in field. + + Each word is separated from the previous and next characters by + whitespace. The commands to move to beginning and end of line or field + look for the first or last non-pad character in their ranges. + + Scrolling Requests + + Fields that are dynamic and have grown and fields explicitly created + with offscreen rows are scrollable. One-line fields scroll + horizontally; multi-line fields scroll vertically. Most scrolling is + triggered by editing and intra-field movement (the library scrolls the + field to keep the cursor visible). It is possible to explicitly + request scrolling with the following requests: + + REQ_SCR_FLINE + Scroll vertically forward a line. + + REQ_SCR_BLINE + Scroll vertically backward a line. + + REQ_SCR_FPAGE + Scroll vertically forward a page. + + REQ_SCR_BPAGE + Scroll vertically backward a page. + + REQ_SCR_FHPAGE + Scroll vertically forward half a page. + + REQ_SCR_BHPAGE + Scroll vertically backward half a page. + + REQ_SCR_FCHAR + Scroll horizontally forward a character. + + REQ_SCR_BCHAR + Scroll horizontally backward a character. + + REQ_SCR_HFLINE + Scroll horizontally one field width forward. + + REQ_SCR_HBLINE + Scroll horizontally one field width backward. + + REQ_SCR_HFHALF + Scroll horizontally one half field width forward. + + REQ_SCR_HBHALF + Scroll horizontally one half field width backward. + + For scrolling purposes, a page of a field is the height of its visible + part. + + Editing Requests + + When you pass the forms driver an ASCII character, it is treated as a + request to add the character to the field's data buffer. Whether this + is an insertion or a replacement depends on the field's edit mode + (insertion is the default. + + The following requests support editing the field and changing the edit + mode: + + REQ_INS_MODE + Set insertion mode. + + REQ_OVL_MODE + Set overlay mode. + + REQ_NEW_LINE + New line request (see below for explanation). + + REQ_INS_CHAR + Insert space at character location. + + REQ_INS_LINE + Insert blank line at character location. + + REQ_DEL_CHAR + Delete character at cursor. + + REQ_DEL_PREV + Delete previous word at cursor. + + REQ_DEL_LINE + Delete line at cursor. + + REQ_DEL_WORD + Delete word at cursor. + + REQ_CLR_EOL + Clear to end of line. + + REQ_CLR_EOF + Clear to end of field. + + REQ_CLEAR_FIELD + Clear entire field. + + The behavior of the REQ_NEW_LINE and REQ_DEL_PREV requests is + complicated and partly controlled by a pair of forms options. The + special cases are triggered when the cursor is at the beginning of a + field, or on the last line of the field. + + First, we consider REQ_NEW_LINE: + + The normal behavior of REQ_NEW_LINE in insert mode is to break the + current line at the position of the edit cursor, inserting the portion + of the current line after the cursor as a new line following the + current and moving the cursor to the beginning of that new line (you + may think of this as inserting a newline in the field buffer). + + The normal behavior of REQ_NEW_LINE in overlay mode is to clear the + current line from the position of the edit cursor to end of line. The + cursor is then moved to the beginning of the next line. + + However, REQ_NEW_LINE at the beginning of a field, or on the last line + of a field, instead does a REQ_NEXT_FIELD. O_NL_OVERLOAD option is + off, this special action is disabled. + + Now, let us consider REQ_DEL_PREV: + + The normal behavior of REQ_DEL_PREV is to delete the previous + character. If insert mode is on, and the cursor is at the start of a + line, and the text on that line will fit on the previous one, it + instead appends the contents of the current line to the previous one + and deletes the current line (you may think of this as deleting a + newline from the field buffer). + + However, REQ_DEL_PREV at the beginning of a field is instead treated + as a REQ_PREV_FIELD. + + If the O_BS_OVERLOAD option is off, this special action is disabled + and the forms driver just returns E_REQUEST_DENIED. + + See Form Options for discussion of how to set and clear the overload + options. + + Order Requests + + If the type of your field is ordered, and has associated functions for + getting the next and previous values of the type from a given value, + there are requests that can fetch that value into the field buffer: + + REQ_NEXT_CHOICE + Place the successor value of the current value in the buffer. + + REQ_PREV_CHOICE + Place the predecessor value of the current value in the buffer. + + Of the built-in field types, only TYPE_ENUM has built-in successor and + predecessor functions. When you define a field type of your own (see + Custom Validation Types), you can associate our own ordering + functions. + + Application Commands + + Form requests are represented as integers above the curses value + greater than KEY_MAX and less than or equal to the constant + MAX_COMMAND. If your input-virtualization routine returns a value + above MAX_COMMAND, the forms driver will ignore it. + +Field Change Hooks + + It is possible to set function hooks to be executed whenever the + current field or form changes. Here are the functions that support + this: + +typedef void (*HOOK)(); /* pointer to function returning void */ + +int set_form_init(FORM *form, /* form to alter */ + HOOK hook); /* initialization hook */ + +HOOK form_init(FORM *form); /* form to query */ + +int set_form_term(FORM *form, /* form to alter */ + HOOK hook); /* termination hook */ + +HOOK form_term(FORM *form); /* form to query */ + +int set_field_init(FORM *form, /* form to alter */ + HOOK hook); /* initialization hook */ + +HOOK field_init(FORM *form); /* form to query */ + +int set_field_term(FORM *form, /* form to alter */ + HOOK hook); /* termination hook */ + +HOOK field_term(FORM *form); /* form to query */ + + These functions allow you to either set or query four different hooks. + In each of the set functions, the second argument should be the + address of a hook function. These functions differ only in the timing + of the hook call. + + form_init + This hook is called when the form is posted; also, just after + each page change operation. + + field_init + This hook is called when the form is posted; also, just after + each field change + + field_term + This hook is called just after field validation; that is, just + before the field is altered. It is also called when the form is + unposted. + + form_term + This hook is called when the form is unposted; also, just + before each page change operation. + + Calls to these hooks may be triggered + 1. When user editing requests are processed by the forms driver + 2. When the current page is changed by set_current_field() call + 3. When the current field is changed by a set_form_page() call + + See Field Change Commands for discussion of the latter two cases. + + You can set a default hook for all fields by passing one of the set + functions a NULL first argument. + + You can disable any of these hooks by (re)setting them to NULL, the + default value. + +Field Change Commands + + Normally, navigation through the form will be driven by the user's + input requests. But sometimes it is useful to be able to move the + focus for editing and viewing under control of your application, or + ask which field it currently is in. The following functions help you + accomplish this: + +int set_current_field(FORM *form, /* form to alter */ + FIELD *field); /* field to shift to */ + +FIELD *current_field(FORM *form); /* form to query */ + +int field_index(FORM *form, /* form to query */ + FIELD *field); /* field to get index of */ + + The function field_index() returns the index of the given field in the + given form's field array (the array passed to new_form() or + set_form_fields()). + + The initial current field of a form is the first active field on the + first page. The function set_form_fields() resets this. + + It is also possible to move around by pages. + +int set_form_page(FORM *form, /* form to alter */ + int page); /* page to go to (0-origin) */ + +int form_page(FORM *form); /* return form's current page */ + + The initial page of a newly-created form is 0. The function + set_form_fields() resets this. + +Form Options + + Like fields, forms may have control option bits. They can be changed + or queried with these functions: + +int set_form_opts(FORM *form, /* form to alter */ + int attr); /* attribute to set */ + +int form_opts_on(FORM *form, /* form to alter */ + int attr); /* attributes to turn on */ + +int form_opts_off(FORM *form, /* form to alter */ + int attr); /* attributes to turn off */ + +int form_opts(FORM *form); /* form to query */ + + By default, all options are on. Here are the available option bits: + + O_NL_OVERLOAD + Enable overloading of REQ_NEW_LINE as described in Editing + Requests. The value of this option is ignored on dynamic fields + that have not reached their size limit; these have no last + line, so the circumstances for triggering a REQ_NEXT_FIELD + never arise. + + O_BS_OVERLOAD + Enable overloading of REQ_DEL_PREV as described in Editing + Requests. + + The option values are bit-masks and can be composed with logical-or in + the obvious way. + +Custom Validation Types + + The form library gives you the capability to define custom validation + types of your own. Further, the optional additional arguments of + set_field_type effectively allow you to parameterize validation types. + Most of the complications in the validation-type interface have to do + with the handling of the additional arguments within custom validation + functions. + + Union Types + + The simplest way to create a custom data type is to compose it from + two preexisting ones: + +FIELD *link_fieldtype(FIELDTYPE *type1, + FIELDTYPE *type2); + + This function creates a field type that will accept any of the values + legal for either of its argument field types (which may be either + predefined or programmer-defined). If a set_field_type() call later + requires arguments, the new composite type expects all arguments for + the first type, than all arguments for the second. Order functions + (see Order Requests) associated with the component types will work on + the composite; what it does is check the validation function for the + first type, then for the second, to figure what type the buffer + contents should be treated as. + + New Field Types + + To create a field type from scratch, you need to specify one or both + of the following things: + + * A character-validation function, to check each character as it is + entered. + * A field-validation function to be applied on exit from the field. + + Here's how you do that: + +typedef int (*HOOK)(); /* pointer to function returning int */ + +FIELDTYPE *new_fieldtype(HOOK f_validate, /* field validator */ + HOOK c_validate) /* character validator */ + + +int free_fieldtype(FIELDTYPE *ftype); /* type to free */ + + At least one of the arguments of new_fieldtype() must be non-NULL. The + forms driver will automatically call the new type's validation + functions at appropriate points in processing a field of the new type. + + The function free_fieldtype() deallocates the argument fieldtype, + freeing all storage associated with it. + + Normally, a field validator is called when the user attempts to leave + the field. Its first argument is a field pointer, from which it can + get to field buffer 0 and test it. If the function returns TRUE, the + operation succeeds; if it returns FALSE, the edit cursor stays in the + field. + + A character validator gets the character passed in as a first + argument. It too should return TRUE if the character is valid, FALSE + otherwise. + + Validation Function Arguments + + Your field- and character- validation functions will be passed a + second argument as well. This second argument is the address of a + structure (which we'll call a pile) built from any of the + field-type-specific arguments passed to set_field_type(). If no such + arguments are defined for the field type, this pile pointer argument + will be NULL. + + In order to arrange for such arguments to be passed to your validation + functions, you must associate a small set of storage-management + functions with the type. The forms driver will use these to synthesize + a pile from the trailing arguments of each set_field_type() argument, + and a pointer to the pile will be passed to the validation functions. + + Here is how you make the association: + +typedef char *(*PTRHOOK)(); /* pointer to function returning (char *) */ +typedef void (*VOIDHOOK)(); /* pointer to function returning void */ + +int set_fieldtype_arg(FIELDTYPE *type, /* type to alter */ + PTRHOOK make_str, /* make structure from args */ + PTRHOOK copy_str, /* make copy of structure */ + VOIDHOOK free_str); /* free structure storage */ + + Here is how the storage-management hooks are used: + + make_str + This function is called by set_field_type(). It gets one + argument, a va_list of the type-specific arguments passed to + set_field_type(). It is expected to return a pile pointer to a + data structure that encapsulates those arguments. + + copy_str + This function is called by form library functions that allocate + new field instances. It is expected to take a pile pointer, + copy the pile to allocated storage, and return the address of + the pile copy. + + free_str + This function is called by field- and type-deallocation + routines in the library. It takes a pile pointer argument, and + is expected to free the storage of that pile. + + The make_str and copy_str functions may return NULL to signal + allocation failure. The library routines will that call them will + return error indication when this happens. Thus, your validation + functions should never see a NULL file pointer and need not check + specially for it. + + Order Functions For Custom Types + + Some custom field types are simply ordered in the same well-defined + way that TYPE_ENUM is. For such types, it is possible to define + successor and predecessor functions to support the REQ_NEXT_CHOICE and + REQ_PREV_CHOICE requests. Here's how: + +typedef int (*INTHOOK)(); /* pointer to function returning int */ + +int set_fieldtype_arg(FIELDTYPE *type, /* type to alter */ + INTHOOK succ, /* get successor value */ + INTHOOK pred); /* get predecessor value */ + + The successor and predecessor arguments will each be passed two + arguments; a field pointer, and a pile pointer (as for the validation + functions). They are expected to use the function field_buffer() to + read the current value, and set_field_buffer() on buffer 0 to set the + next or previous value. Either hook may return TRUE to indicate + success (a legal next or previous value was set) or FALSE to indicate + failure. + + Avoiding Problems + + The interface for defining custom types is complicated and tricky. + Rather than attempting to create a custom type entirely from scratch, + you should start by studying the library source code for whichever of + the pre-defined types seems to be closest to what you want. + + Use that code as a model, and evolve it towards what you really want. + You will avoid many problems and annoyances that way. The code in the + ncurses library has been specifically exempted from the package + copyright to support this. + + If your custom type defines order functions, have do something + intuitive with a blank field. A useful convention is to make the + successor of a blank field the types minimum value, and its + predecessor the maximum. diff --git a/misc/ncurses-intro.html b/misc/ncurses-intro.html new file mode 100644 index 00000000..9ab84885 --- /dev/null +++ b/misc/ncurses-intro.html @@ -0,0 +1,2639 @@ + + + + +Writing Programs with NCURSES + + + + +

Writing Programs with NCURSES

+ +
+by Eric S. Raymond and Zeyd M. Ben-Halim
+
+ +

Contents

+ + +
+

Introduction

+ +This document is an introduction to programming with curses. It is +not an exhaustive reference for the curses Application Programming Interface +(API); that role is filled by the curses manual pages. Rather, it +is intended to help C programmers ease into using the package.

+ +This document is aimed at C applications programmers not yet specifically +familiar with ncurses. If you are already an experienced curses +programmer, you should nevertheless read the sections on +Mouse Interfacing, Debugging, +Compatibility with Older Versions, +and Hints, Tips, and Tricks. These will bring you up +to speed on the special features and quirks of the ncurses +implementation. If you are not so experienced, keep reading.

+ +The curses package is a subroutine library for +terminal-independent screen-painting and input-event handling which +presents a high level screen model to the programmer, hiding differences +between terminal types and doing automatic optimization of output to change +one screen full of text into another. Curses uses terminfo, which +is a database format that can describe the capabilities of thousands of +different terminals.

+ +The curses API may seem something of an archaism on UNIX desktops +increasingly dominated by X, Motif, and Tcl/Tk. Nevertheless, UNIX still +supports tty lines and X supports xterm(1); the curses +API has the advantage of (a) back-portability to character-cell terminals, +and (b) simplicity. For an application that does not require bit-mapped +graphics and multiple fonts, an interface implementation using curses +will typically be a great deal simpler and less expensive than one using an +X toolkit.

+ +

A Brief History of Curses

+ +Historically, the first ancestor of curses was the routines written to +provide screen-handling for the game rogue; these used the +already-existing termcap database facility for describing terminal +capabilities. These routines were abstracted into a documented library and +first released with the early BSD UNIX versions.

+ +System III UNIX from Bell Labs featured a rewritten and much-improved +curses library. It introduced the terminfo format. Terminfo is based +on Berkeley's termcap database, but contains a number of improvements and +extensions. Parameterized capabilities strings were introduced, making it +possible to describe multiple video attributes, and colors and to handle far +more unusual terminals than possible with termcap. In the later AT&T +System V releases, curses evolved to use more facilities and offer +more capabilities, going far beyond BSD curses in power and flexibility.

+ +

Scope of This Document

+ +This document describes ncurses, a freeware implementation of +the System V curses API with some clearly marked extensions. +It includes the following System V curses features:

+

    +
  • Support for multiple screen highlights (BSD curses could only +handle one `standout' highlight, usually reverse-video).

    +

  • Support for line- and box-drawing using forms characters.

    +

  • Recognition of function keys on input.

    +

  • Color support.

    +

  • Support for pads (windows of larger than screen size on which the +screen or a subwindow defines a viewport). +
+ +Also, this package makes use of the insert and delete line and character +features of terminals so equipped, and determines how to optimally use these +features with no help from the programmer. It allows arbitrary combinations of +video attributes to be displayed, even on terminals that leave ``magic +cookies'' on the screen to mark changes in attributes.

+ +The ncurses package can also capture and use event reports from a +mouse in some environments (notably, xterm under the X window system). This +document includes tips for using the mouse.

+ +The ncurses package was originated by Pavel Curtis. The original +maintainer of the package is +Zeyd Ben-Halim +<zmbenhal@netcom.com>. +Eric S. Raymond +<esr@snark.thyrsus.com> +wrote many of the new features in versions after 1.8.1 +and wrote most of this introduction. +The current primary maintainers are +Thomas Dickey +<dickey@clark.net> +and +Juergen Pfeifer. +<Juergen.Pfeifer@T-Online.de> +

+ +This document also describes the panels extension library, +similarly modeled on the SVr4 panels facility. This library allows you to +associate backing store with each of a stack or deck of overlapping windows, +and provides operations for moving windows around in the stack that change +their visibility in the natural way (handling window overlaps).

+ +Finally, this document describes in detail the menus and forms extension libraries, also cloned from System V, +which support easy construction and sequences of menus and fill-in +forms. This code was contributed to the project by +Jürgen Pfeifer.

+ + +

Terminology

+ +In this document, the following terminology is used with reasonable +consistency: + +
+
window +
+A data structure describing a sub-rectangle of the screen (possibly the +entire screen). You can write to a window as though it were a miniature +screen, scrolling independently of other windows on the physical screen.

+

screens +
+A subset of windows which are as large as the terminal screen, i.e., they start +at the upper left hand corner and encompass the lower right hand corner. One +of these, stdscr, is automatically provided for the programmer.

+

terminal screen +
+The package's idea of what the terminal display currently looks like, i.e., +what the user sees now. This is a special screen. +
+ +

The Curses Library

+ +

An Overview of Curses

+ +

Compiling Programs using Curses

+ +In order to use the library, it is necessary to have certain types and +variables defined. Therefore, the programmer must have a line: + +
+	  #include <curses.h>
+
+ +at the top of the program source. The screen package uses the Standard I/O +library, so <curses.h> includes +<stdio.h>. <curses.h> also includes +<termios.h>, <termio.h>, or +<sgtty.h> depending on your system. It is redundant (but +harmless) for the programmer to do these includes, too. In linking with +curses you need to have -lncurses in your LDFLAGS or on the +command line. There is no need for any other libraries. + +

Updating the Screen

+ +In order to update the screen optimally, it is necessary for the routines to +know what the screen currently looks like and what the programmer wants it to +look like next. For this purpose, a data type (structure) named WINDOW is +defined which describes a window image to the routines, including its starting +position on the screen (the (y, x) coordinates of the upper left hand corner) +and its size. One of these (called curscr, for current screen) is a +screen image of what the terminal currently looks like. Another screen (called +stdscr, for standard screen) is provided by default to make changes +on.

+ +A window is a purely internal representation. It is used to build and store a +potential image of a portion of the terminal. It doesn't bear any necessary +relation to what is really on the terminal screen; it's more like a +scratchpad or write buffer.

+ +To make the section of physical screen corresponding to a window reflect the +contents of the window structure, the routine refresh() (or +wrefresh() if the window is not stdscr) is called.

+ +A given physical screen section may be within the scope of any number of +overlapping windows. Also, changes can be made to windows in any order, +without regard to motion efficiency. Then, at will, the programmer can +effectively say ``make it look like this,'' and let the package implementation +determine the most efficient way to repaint the screen.

+ +

Standard Windows and Function Naming Conventions

+ +As hinted above, the routines can use several windows, but two are +automatically given: curscr, which knows what the terminal looks like, +and stdscr, which is what the programmer wants the terminal to look +like next. The user should never actually access curscr directly. +Changes should be made to through the API, and then the routine +refresh() (or wrefresh()) called.

+ +Many functions are defined to use stdscr as a default screen. For +example, to add a character to stdscr, one calls addch() with +the desired character as argument. To write to a different window. use the +routine waddch() (for `w'indow-specific addch()) is provided. This +convention of prepending function names with a `w' when they are to be +applied to specific windows is consistent. The only routines which do not +follow it are those for which a window must always be specified.

+ +In order to move the current (y, x) coordinates from one point to another, the +routines move() and wmove() are provided. However, it is +often desirable to first move and then perform some I/O operation. In order to +avoid clumsiness, most I/O routines can be preceded by the prefix 'mv' and +the desired (y, x) coordinates prepended to the arguments to the function. For +example, the calls + +

+	  move(y, x);
+	  addch(ch);
+
+ +can be replaced by + +
+	  mvaddch(y, x, ch);
+
+ +and + +
+	  wmove(win, y, x);
+	  waddch(win, ch);
+
+ +can be replaced by + +
+	  mvwaddch(win, y, x, ch);
+
+ +Note that the window description pointer (win) comes before the added (y, x) +coordinates. If a function requires a window pointer, it is always the first +parameter passed.

+ +

Variables

+ +The curses library sets some variables describing the terminal +capabilities. + +
+      type   name      description
+      ------------------------------------------------------------------
+      int    LINES     number of lines on the terminal
+      int    COLS      number of columns on the terminal
+
+ +The curses.h also introduces some #define constants and types +of general usefulness: + +
+
bool +
boolean type, actually a `char' (e.g., bool doneit;) +
TRUE +
boolean `true' flag (1). +
FALSE +
boolean `false' flag (0). +
ERR +
error flag returned by routines on a failure (-1). +
OK +
error flag returned by routines when things go right. +
+ +

Using the Library

+ +Now we describe how to actually use the screen package. In it, we assume all +updating, reading, etc. is applied to stdscr. These instructions will +work on any window, providing you change the function names and parameters as +mentioned above.

+ +Here is a sample program to motivate the discussion:

+ +

+#include <curses.h>
+#include <signal.h>
+
+static void finish(int sig);
+
+main(int argc, char *argv[])
+{
+    /* initialize your non-curses data structures here */
+
+    (void) signal(SIGINT, finish);      /* arrange interrupts to terminate */
+
+    (void) initscr();      /* initialize the curses library */
+    keypad(stdscr, TRUE);  /* enable keyboard mapping */
+    (void) nonl();         /* tell curses not to do NL->CR/NL on output */
+    (void) cbreak();       /* take input chars one at a time, no wait for \n */
+    (void) noecho();       /* don't echo input */
+
+    if (has_colors())
+    {
+        start_color();
+
+        /*
+         * Simple color assignment, often all we need.
+         */
+        init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_BLACK);
+        init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK);
+        init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK);
+        init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK);
+        init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK);
+        init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
+        init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK);
+        init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK);
+    }
+
+    for (;;)
+    {
+        int c = getch();     /* refresh, accept single keystroke of input */
+
+        /* process the command keystroke */
+    }
+
+    finish(0);               /* we're done */
+}
+
+static void finish(int sig)
+{
+    endwin();
+
+    /* do your non-curses wrapup here */
+
+    exit(0);
+}
+
+ +

Starting up

+ +In order to use the screen package, the routines must know about terminal +characteristics, and the space for curscr and stdscr must be +allocated. These function initscr() does both these things. Since it +must allocate space for the windows, it can overflow memory when attempting to +do so. On the rare occasions this happens, initscr() will terminate +the program with an error message. initscr() must always be called +before any of the routines which affect windows are used. If it is not, the +program will core dump as soon as either curscr or stdscr are +referenced. However, it is usually best to wait to call it until after you are +sure you will need it, like after checking for startup errors. Terminal status +changing routines like nl() and cbreak() should be called +after initscr().

+ +Once the screen windows have been allocated, you can set them up for +your program. If you want to, say, allow a screen to scroll, use +scrollok(). If you want the cursor to be left in place after +the last change, use leaveok(). If this isn't done, +refresh() will move the cursor to the window's current (y, x) +coordinates after updating it.

+ +You can create new windows of your own using the functions newwin(), +derwin(), and subwin(). The routine delwin() will +allow you to get rid of old windows. All the options described above can be +applied to any window.

+ +

Output

+ +Now that we have set things up, we will want to actually update the terminal. +The basic functions used to change what will go on a window are +addch() and move(). addch() adds a character at the +current (y, x) coordinates. move() changes the current (y, x) +coordinates to whatever you want them to be. It returns ERR if you +try to move off the window. As mentioned above, you can combine the two into +mvaddch() to do both things at once.

+ +The other output functions, such as addstr() and printw(), +all call addch() to add characters to the window.

+ +After you have put on the window what you want there, when you want the portion +of the terminal covered by the window to be made to look like it, you must call +refresh(). In order to optimize finding changes, refresh() +assumes that any part of the window not changed since the last +refresh() of that window has not been changed on the terminal, i.e., +that you have not refreshed a portion of the terminal with an overlapping +window. If this is not the case, the routine touchwin() is provided +to make it look like the entire window has been changed, thus making +refresh() check the whole subsection of the terminal for changes.

+ +If you call wrefresh() with curscr as its argument, it will +make the screen look like curscr thinks it looks like. This is useful +for implementing a command which would redraw the screen in case it get messed +up.

+ +

Input

+ +The complementary function to addch() is getch() which, if +echo is set, will call addch() to echo the character. Since the +screen package needs to know what is on the terminal at all times, if +characters are to be echoed, the tty must be in raw or cbreak mode. Since +initially the terminal has echoing enabled and is in ordinary ``cooked'' mode, +one or the other has to changed before calling getch(); otherwise, +the program's output will be unpredictable.

+ +When you need to accept line-oriented input in a window, the functions +wgetstr() and friends are available. There is even a wscanw() +function that can do scanf()(3)-style multi-field parsing on window +input. These pseudo-line-oriented functions turn on echoing while they +execute.

+ +The example code above uses the call keypad(stdscr, TRUE) to enable +support for function-key mapping. With this feature, the getch() code +watches the input stream for character sequences that correspond to arrow and +function keys. These sequences are returned as pseudo-character values. The +#define values returned are listed in the curses.h The +mapping from sequences to #define values is determined by +key_ capabilities in the terminal's terminfo entry.

+ +

Using Forms Characters

+ +The addch() function (and some others, including box() and +border()) can accept some pseudo-character arguments which are specially +defined by ncurses. These are #define values set up in +the curses.h header; see there for a complete list (look for +the prefix ACS_).

+ +The most useful of the ACS defines are the forms-drawing characters. You can +use these to draw boxes and simple graphs on the screen. If the terminal +does not have such characters, curses.h will map them to a +recognizable (though ugly) set of ASCII defaults.

+ +

Character Attributes and Color

+ +The ncurses package supports screen highlights including standout, +reverse-video, underline, and blink. It also supports color, which is treated +as another kind of highlight.

+ +Highlights are encoded, internally, as high bits of the pseudo-character type +(chtype) that curses.h uses to represent the contents of a +screen cell. See the curses.h header file for a complete list of +highlight mask values (look for the prefix A_).

+ +There are two ways to make highlights. One is to logical-or the value of the +highlights you want into the character argument of an addch() call, +or any other output call that takes a chtype argument.

+ +The other is to set the current-highlight value. This is logical-or'ed with +any highlight you specify the first way. You do this with the functions +attron(), attroff(), and attrset(); see the manual +pages for details. + +Color is a special kind of highlight. The package actually thinks in terms +of color pairs, combinations of foreground and background colors. The sample +code above sets up eight color pairs, all of the guaranteed-available colors +on black. Note that each color pair is, in effect, given the name of its +foreground color. Any other range of eight non-conflicting values could +have been used as the first arguments of the init_pair() values.

+ +Once you've done an init_pair() that creates color-pair N, you can +use COLOR_PAIR(N) as a highlight that invokes that particular +color combination. Note that COLOR_PAIR(N), for constant N, +is itself a compile-time constant and can be used in initializers.

+ +

Mouse Interfacing

+ +The ncurses library also provides a mouse interface. Note: +his facility is original to ncurses, it is not part of either +the XSI Curses standard, nor of System V Release 4, nor BSD curses. +Thus, we recommend that you wrap mouse-related code in an #ifdef using the +feature macro NCURSES_MOUSE_VERSION so it will not be compiled and linked +on non-ncurses systems.

+ +Presently, mouse event reporting works only under xterm. In the +future, ncurses will detect the presence of gpm(1), Alessandro +Rubini's freeware mouse server for Linux systems, and accept mouse +reports through it.

+ +The mouse interface is very simple. To activate it, you use the function +mousemask(), passing it as first argument a bit-mask that specifies +what kinds of events you want your program to be able to see. It will +return the bit-mask of events that actually become visible, which may differ +from the argument if the mouse device is not capable of reporting some of +the event types you specify.

+ +Once the mouse is active, your application's command loop should watch +for a return value of KEY_MOUSE from wgetch(). When +you see this, a mouse event report has been queued. To pick it off +the queue, use the function getmouse() (you must do this before +the next wgetch(), otherwise another mouse event might come +in and make the first one inaccessible).

+ +Each call to getmouse() fills a structure (the address of which you'll +pass it) with mouse event data. The event data includes zero-origin, +screen-relative character-cell coordinates of the mouse pointer. It also +includes an event mask. Bits in this mask will be set, corresponding +to the event type being reported.

+ +The mouse structure contains two additional fields which may be +significant in the future as ncurses interfaces to new kinds of +pointing device. In addition to x and y coordinates, there is a slot +for a z coordinate; this might be useful with touch-screens that can +return a pressure or duration parameter. There is also a device ID +field, which could be used to distinguish between multiple pointing +devices.

+ +The class of visible events may be changed at any time via mousemask(). +Events that can be reported include presses, releases, single-, double- and +triple-clicks (you can set the maximum button-down time for clicks). If +you don't make clicks visible, they will be reported as press-release +pairs. In some environments, the event mask may include bits reporting +the state of shift, alt, and ctrl keys on the keyboard during the event.

+ +A function to check whether a mouse event fell within a given window is +also supplied. You can use this to see whether a given window should +consider a mouse event relevant to it.

+ +Because mouse event reporting will not be available in all +environments, it would be unwise to build ncurses +applications that require the use of a mouse. Rather, you should +use the mouse as a shortcut for point-and-shoot commands your application +would normally accept from the keyboard. Two of the test games in the +ncurses distribution (bs and knight) contain +code that illustrates how this can be done.

+ +See the manual page curs_mouse(3X) for full details of the +mouse-interface functions.

+ +

Finishing Up

+ +In order to clean up after the ncurses routines, the routine +endwin() is provided. It restores tty modes to what they were when +initscr() was first called, and moves the cursor down to the +lower-left corner. Thus, anytime after the call to initscr, endwin() +should be called before exiting.

+ +

Function Descriptions

+ +We describe the detailed behavior of some important curses functions here, as a +supplement to the manual page descriptions. + +

Initialization and Wrapup

+ +
+
initscr() +
The first function called should almost always be initscr(). +This will determine the terminal type and +initialize curses data structures. initscr() also arranges that +the first call to refresh() will clear the screen. If an error +occurs a message is written to standard error and the program +exits. Otherwise it returns a pointer to stdscr. A few functions may be +called before initscr (slk_init(), filter(), +ripofflines(), use_env(), and, if you are using multiple +terminals, newterm().)

+

endwin() +
Your program should always call endwin() before exiting or +shelling out of the program. This function will restore tty modes, +move the cursor to the lower left corner of the screen, reset the +terminal into the proper non-visual mode. Calling refresh() +or doupdate() after a temporary escape from the program will +restore the ncurses screen from before the escape.

+

newterm(type, ofp, ifp) +
A program which outputs to more than one terminal should use +newterm() instead of initscr(). newterm() should +be called once for each terminal. It returns a variable of type +SCREEN * which should be saved as a reference to that +terminal. The arguments are the type of the terminal (a string) and +FILE pointers for the output and input of the terminal. If +type is NULL then the environment variable $TERM is used. +endwin() should called once at wrapup time for each terminal +opened using this function.

+

set_term(new) +
This function is used to switch to a different terminal previously +opened by newterm(). The screen reference for the new terminal +is passed as the parameter. The previous terminal is returned by the +function. All other calls affect only the current terminal.

+

delscreen(sp) +
The inverse of newterm(); deallocates the data structures +associated with a given SCREEN reference. +
+ +

Causing Output to the Terminal

+ +
+
refresh() and wrefresh(win) +
These functions must be called to actually get any output on +the terminal, as other routines merely manipulate data +structures. wrefresh() copies the named window to the physical +terminal screen, taking into account what is already +there in order to do optimizations. refresh() does a +refresh of stdscr(). Unless leaveok() has been +enabled, the physical cursor of the terminal is left at the +location of the window's cursor.

+

doupdate() and wnoutrefresh(win) +
These two functions allow multiple updates with more efficiency +than wrefresh. To use them, it is important to understand how curses +works. In addition to all the window structures, curses keeps two +data structures representing the terminal screen: a physical screen, +describing what is actually on the screen, and a virtual screen, +describing what the programmer wants to have on the screen. wrefresh +works by first copying the named window to the virtual screen +(wnoutrefresh()), and then calling the routine to update the +screen (doupdate()). If the programmer wishes to output +several windows at once, a series of calls to wrefresh will result +in alternating calls to wnoutrefresh() and doupdate(), +causing several bursts of output to the screen. By calling +wnoutrefresh() for each window, it is then possible to call +doupdate() once, resulting in only one burst of output, with +fewer total characters transmitted (this also avoids a visually annoying +flicker at each update). +
+ +

Low-Level Capability Access

+ +
+
setupterm(term, filenum, errret) +
This routine is called to initialize a terminal's description, without setting +up the curses screen structures or changing the tty-driver mode bits. +term is the character string representing the name of the terminal +being used. filenum is the UNIX file descriptor of the terminal to +be used for output. errret is a pointer to an integer, in which a +success or failure indication is returned. The values returned can be 1 (all +is well), 0 (no such terminal), or -1 (some problem locating the terminfo +database).

+ +The value of term can be given as NULL, which will cause the value of +TERM in the environment to be used. The errret pointer can +also be given as NULL, meaning no error code is wanted. If errret is +defaulted, and something goes wrong, setupterm() will print an +appropriate error message and exit, rather than returning. Thus, a simple +program can call setupterm(0, 1, 0) and not worry about initialization +errors.

+ +After the call to setupterm(), the global variable cur_term is +set to point to the current structure of terminal capabilities. By calling +setupterm() for each terminal, and saving and restoring +cur_term, it is possible for a program to use two or more terminals at +once. Setupterm() also stores the names section of the terminal +description in the global character array ttytype[]. Subsequent calls +to setupterm() will overwrite this array, so you'll have to save it +yourself if need be. +

+ +

Debugging

+ +NOTE: These functions are not part of the standard curses API!

+ +

+
trace() +
+This function can be used to explicitly set a trace level. If the +trace level is nonzero, execution of your program will generate a file +called `trace' in the current working directory containing a report on +the library's actions. Higher trace levels enable more detailed (and +verbose) reporting -- see comments attached to TRACE_ defines +in the curses.h file for details. (It is also possible to set +a trace level by assigning a trace level value to the environment variable +NCURSES_TRACE). +
_tracef() +
+This function can be used to output your own debugging information. It is only +available only if you link with -lncurses_g. It can be used the same way as +printf(), only it outputs a newline after the end of arguments. +The output goes to a file called trace in the current directory. +
+ +Trace logs can be difficult to interpret due to the sheer volume of +data dumped in them. There is a script called tracemunch +included with the ncurses distribution that can alleviate +this problem somewhat; it compacts long sequences of similar operations into +more succinct single-line pseudo-operations. These pseudo-ops can be +distinguished by the fact that they are named in capital letters.

+ +

Hints, Tips, and Tricks

+ +The ncurses manual pages are a complete reference for this library. +In the remainder of this document, we discuss various useful methods that +may not be obvious from the manual page descriptions.

+ +

Some Notes of Caution

+ +If you find yourself thinking you need to use noraw() or +nocbreak(), think again and move carefully. It's probably +better design to use getstr() or one of its relatives to +simulate cooked mode. The noraw() and nocbreak() +functions try to restore cooked mode, but they may end up clobbering +some control bits set before you started your application. Also, they +have always been poorly documented, and are likely to hurt your +application's usability with other curses libraries.

+ +Bear in mind that refresh() is a synonym for wrefresh(stdscr), +and don't try to mix use of stdscr with use of windows declared +by newwin(); a refresh() call will blow them off the +screen. The right way to handle this is to use subwin(), or +not touch stdscr at all and tile your screen with declared +windows which you then wnoutrefresh() somewhere in your program +event loop, with a single doupdate() call to trigger actual +repainting.

+ +You are much less likely to run into problems if you design your screen +layouts to use tiled rather than overlapping windows. Historically, +curses support for overlapping windows has been weak, fragile, and poorly +documented. The ncurses library is not yet an exception to this +rule.

+ +There is a freeware panels library included in the ncurses +distribution that does a pretty good job of strengthening the +overlapping-windows facilities.

+ +Try to avoid using the global variables LINES and COLS. Use +getmaxyx() on the stdscr context instead. Reason: +your code may be ported to run in an environment with window resizes, +in which case several screens could be open with different sizes.

+ +

Temporarily Leaving ncurses Mode

+ +Sometimes you will want to write a program that spends most of its time in +screen mode, but occasionally returns to ordinary `cooked' mode. A common +reason for this is to support shell-out. This behavior is simple to arrange +in ncurses.

+ +To leave ncurses mode, call endwin() as you would if you +were intending to terminate the program. This will take the screen back to +cooked mode; you can do your shell-out. When you want to return to +ncurses mode, simply call refresh() or doupdate(). +This will repaint the screen.

+ +There is a boolean function, isendwin(), which code can use to +test whether ncurses screen mode is active. It returns TRUE +in the interval between an endwin() call and the following +refresh(), FALSE otherwise.

+ +Here is some sample code for shellout: + +

+    addstr("Shelling out...");
+    def_prog_mode();           /* save current tty modes */
+    endwin();                  /* restore original tty modes */
+    system("sh");              /* run shell */
+    addstr("returned.\n");     /* prepare return message */
+    refresh();                 /* restore save modes, repaint screen */
+
+ +

Using ncurses Under xterm

+ +A resize operation in X sends SIGWINCH to the application running under xterm. +The ncurses library does not catch this signal, because it cannot in +general know how you want the screen re-painted. You will have to write the +SIGWINCH handler yourself.

+ +The easiest way to code your SIGWINCH handler is to have it do an +endwin, followed by an refresh and a screen repaint you code +yourself. The refresh will pick up the new screen size from the +xterm's environment. + +

Handling Multiple Terminal Screens

+ +The initscr() function actually calls a function named +newterm() to do most of its work. If you are writing a program that +opens multiple terminals, use newterm() directly.

+ +For each call, you will have to specify a terminal type and a pair of file +pointers; each call will return a screen reference, and stdscr will be +set to the last one allocated. You will switch between screens with the +set_term call. Note that you will also have to call +def_shell_mode and def_prog_mode on each tty yourself.

+ +

Testing for Terminal Capabilities

+ +Sometimes you may want to write programs that test for the presence of various +capabilities before deciding whether to go into ncurses mode. An easy +way to do this is to call setupterm(), then use the functions +tigetflag(), tigetnum(), and tigetstr() to do your +testing.

+ +A particularly useful case of this often comes up when you want to +test whether a given terminal type should be treated as `smart' +(cursor-addressable) or `stupid'. The right way to test this is to see +if the return value of tigetstr("cup") is non-NULL. Alternatively, +you can include the term.h file and test the value of the +macro cursor_address.

+ +

Tuning for Speed

+ +Use the addchstr() family of functions for fast +screen-painting of text when you know the text doesn't contain any +control characters. Try to make attribute changes infrequent on your +screens. Don't use the immedok() option!

+ +

Special Features of ncurses

+ +When running on PC-clones, ncurses has enhanced support for +the IBM high-half and ROM characters. The A_ALTCHARSET highlight, +enables display of both high-half ACS graphics and the PC ROM graphics +0-31 that are normally interpreted as control characters.

+ +The wresize() function allows you to resize a window in place.

+ +

Compatibility with Older Versions

+ +Despite our best efforts, there are some differences between ncurses +and the (undocumented!) behavior of older curses implementations. These arise +from ambiguities or omissions in the documentation of the API. + +

Refresh of Overlapping Windows

+ +If you define two windows A and B that overlap, and then alternately scribble +on and refresh them, the changes made to the overlapping region under historic +curses versions were often not documented precisely.

+ +To understand why this is a problem, remember that screen updates are +calculated between two representations of the entire display. The +documentation says that when you refresh a window, it is first copied to to the +virtual screen, and then changes are calculated to update the physical screen +(and applied to the terminal). But "copied to" is not very specific, and +subtle differences in how copying works can produce different behaviors in the +case where two overlapping windows are each being refreshed at unpredictable +intervals.

+ +What happens to the overlapping region depends on what wnoutrefresh() +does with its argument -- what portions of the argument window it copies to the +virtual screen. Some implementations do "change copy", copying down only +locations in the window that have changed (or been marked changed with +wtouchln() and friends). Some implementations do "entire copy", +copying all window locations to the virtual screen whether or not +they have changed.

+ +The ncurses library itself has not always been consistent on this +score. Due to a bug, versions 1.8.7 to 1.9.8a did entire copy. Versions +1.8.6 and older, and versions 1.9.9 and newer, do change copy.

+ +For most commercial curses implementations, it is not documented and not known +for sure (at least not to the ncurses maintainers) whether they do +change copy or entire copy. We know that System V release 3 curses has logic +in it that looks like an attempt to do change copy, but the surrounding logic +and data representations are sufficiently complex, and our knowledge +sufficiently indirect, that it's hard to know whether this is reliable. + +It is not clear what the SVr4 documentation and XSI standard intend. The XSI +Curses standard barely mentions wnoutrefresh(); the SVr4 documents seem to be +describing entire-copy, but it is possible with some effort and straining to +read them the other way.

+ +It might therefore be unwise to rely on either behavior in programs that might +have to be linked with other curses implementations. Instead, you can do an +explicit touchwin() before the wnoutrefresh() call to +guarantee an entire-contents copy anywhere.

+ +The really clean way to handle this is to use the panels library. If, +when you want a screen update, you do update_panels(), it will +do all the necessary wnoutrfresh() calls for whatever panel +stacking order you have defined. Then you can do one doupdate() +and there will be a single burst of physical I/O that will do +all your updates.

+ +

Background Erase

+ +If you have been using a very old versions of ncurses (1.8.7 or +older) you may be surprised by the behavior of the erase functions. In older +versions, erased areas of a window were filled with a blank modified by the +window's current attribute (as set by wattrset(), wattron(), +wattroff() and friends).

+ +In newer versions, this is not so. Instead, the attribute of erased blanks +is normal unless and until it is modified by the functions bkgdset() +or wbkgdset().

+ +This change in behavior conforms ncurses to System V Release 4 and +the XSI Curses standard.

+ +

XSI Curses Conformance

+ +The ncurses library is intended to be base-level conformant with the +XSI Curses standard from X/Open. Many extended-level features (in fact, almost +all features not directly concerned with wide characters and +internationalization) are also supported.

+ +One effect of XSI conformance is the change in behavior described under +"Background Erase -- Compatibility with Old Versions".

+ +Also, ncurses meets the XSI requirement that every macro +entry point have a corresponding function which may be linked (and +will be prototype-checked) if the macro definition is disabled with +#undef.

+ +

The Panels Library

+ +The ncurses library by itself provides good support for screen +displays in which the windows are tiled (non-overlapping). In the more +general case that windows may overlap, you have to use a series of +wnoutrefresh() calls followed by a doupdate(), and be +careful about the order you do the window refreshes in. It has to be +bottom-upwards, otherwise parts of windows that should be obscured will +show through.

+ +When your interface design is such that windows may dive deeper into the +visibility stack or pop to the top at runtime, the resulting book-keeping +can be tedious and difficult to get right. Hence the panels library.

+ +The panel library first appeared in AT&T System V. The +version documented here is the freeware panel code distributed +with ncurses. + +

Compiling With the Panels Library

+ +Your panels-using modules must import the panels library declarations with + +
+	  #include <panel.h>
+
+ +and must be linked explicitly with the panels library using an +-lpanel argument. Note that they must also link the +ncurses library with -lncurses. Many linkers +are two-pass and will accept either order, but it is still good practice +to put -lpanel first and -lncurses second. + +

Overview of Panels

+ +A panel object is a window that is implicitly treated as part of a +deck including all other panel objects. The deck has an implicit +bottom-to-top visibility order. The panels library includes an update +function (analogous to refresh()) that displays all panels in the +deck in the proper order to resolve overlaps. The standard window, +stdscr, is considered below all panels.

+ +Details on the panels functions are available in the man pages. We'll just +hit the highlights here.

+ +You create a panel from a window by calling new_panel() on a +window pointer. It then becomes the top of the deck. The panel's window +is available as the value of panel_window() called with the +panel pointer as argument.

+ +You can delete a panel (removing it from the deck) with del_panel. +This will not deallocate the associated window; you have to do that yourself. + +You can replace a panel's window with a different window by calling +replace_window. The new window may be of different size; +the panel code will re-compute all overlaps. This operation doesn't +change the panel's position in the deck.

+ +To move a panel's window, use move_panel(). The +mvwin() function on the panel's window isn't sufficient because it +doesn't update the panels library's representation of where the windows are. +This operation leaves the panel's depth, contents, and size unchanged.

+ +Two functions (top_panel(), bottom_panel()) are +provided for rearranging the deck. The first pops its argument window to the +top of the deck; the second sends it to the bottom. Either operation leaves +the panel's screen location, contents, and size unchanged.

+ +The function update_panels() does all the +wnoutrefresh() calls needed to prepare for +doupdate() (which you must call yourself, afterwards).

+ +Typically, you will want to call update_panels() and +doupdate() just before accepting command input, once in each cycle +of interaction with the user. If you call update_panels() after +each and every panel write, you'll generate a lot of unnecessary refresh +activity and screen flicker.

+ +

Panels, Input, and the Standard Screen

+ +You shouldn't mix wnoutrefresh() or wrefresh() +operations with panels code; this will work only if the argument window +is either in the top panel or unobscured by any other panels.

+ +The stsdcr window is a special case. It is considered below all +panels. Because changes to panels may obscure parts of stdscr, +though, you should call update_panels() before +doupdate() even when you only change stdscr.

+ +Note that wgetch automatically calls wrefresh. +Therefore, before requesting input from a panel window, you need to be sure +that the panel is totally unobscured.

+ +There is presently no way to display changes to one obscured panel without +repainting all panels.

+ +

Hiding Panels

+ +It's possible to remove a panel from the deck temporarily; use +hide_panel for this. Use show_panel() to render it +visible again. The predicate function panel_hidden +tests whether or not a panel is hidden.

+ +The panel_update code ignores hidden panels. You cannot do +top_panel() or bottom_panel on a hidden panel(). +Other panels operations are applicable.

+ +

Miscellaneous Other Facilities

+ +It's possible to navigate the deck using the functions +panel_above() and panel_below. Handed a panel +pointer, they return the panel above or below that panel. Handed +NULL, they return the bottom-most or top-most panel.

+ +Every panel has an associated user pointer, not used by the panel code, to +which you can attach application data. See the man page documentation +of set_panel_userptr() and panel_userptr for +details.

+ +

The Menu Library

+ +A menu is a screen display that assists the user to choose some subset +of a given set of items. The menu library is a curses +extension that supports easy programming of menu hierarchies with a +uniform but flexible interface.

+ +The menu library first appeared in AT&T System V. The +version documented here is the freeware menu code distributed +with ncurses.

+ +

Compiling With the menu Library

+ +Your menu-using modules must import the menu library declarations with + +
+	  #include <menu.h>
+
+ +and must be linked explicitly with the menus library using an +-lmenu argument. Note that they must also link the +ncurses library with -lncurses. Many linkers +are two-pass and will accept either order, but it is still good practice +to put -lmenu first and -lncurses second. + +

Overview of Menus

+ +The menus created by this library consist of collections of +items including a name string part and a description string +part. To make menus, you create groups of these items and connect +them with menu frame objects.

+ +The menu can then by posted, that is written to an +associated window. Actually, each menu has two associated windows; a +containing window in which the programmer can scribble titles or +borders, and a subwindow in which the menu items proper are displayed. +If this subwindow is too small to display all the items, it will be a +scrollable viewport on the collection of items.

+ +A menu may also be unposted (that is, undisplayed), and finally +freed to make the storage associated with it and its items available for +re-use.

+ +The general flow of control of a menu program looks like this: + +

    +
  1. Initialize curses. +
  2. Create the menu items, using new_item(). +
  3. Create the menu using new_menu(). +
  4. Post the menu using menu_post(). +
  5. Refresh the screen. +
  6. Process user requests via an input loop. +
  7. Unpost the menu using menu_unpost(). +
  8. Free the menu, using free_menu(). +
  9. Free the items using free_item(). +
  10. Terminate curses. +
+ +

Selecting items

+ +Menus may be multi-valued or (the default) single-valued (see the manual +page menu_opts(3x) to see how to change the default). +Both types always have a current item.

+ +From a single-valued menu you can read the selected value simply by looking +at the current item. From a multi-valued menu, you get the selected set +by looping through the items applying the item_value() +predicate function. Your menu-processing code can use the function +set_item_value() to flag the items in the select set.

+ +Menu items can be made unselectable using set_item_opts() +or item_opts_off() with the O_SELECTABLE +argument. This is the only option so far defined for menus, but it +is good practice to code as though other option bits might be on.

+ +

Menu Display

+ +The menu library calculates a minimum display size for your window, based +on the following variables:

+ +

    +
  • The number and maximum length of the menu items +
  • Whether the O_ROWMAJOR option is enabled +
  • Whether display of descriptions is enabled +
  • Whatever menu format may have been set by the programmer +
  • The length of the menu mark string used for highlighting selected items +
+ +The function set_menu_format() allows you to set the +maximum size of the viewport or menu page that will be used +to display menu items. You can retrieve any format associated with a +menu with menu_format(). The default format is rows=16, +columns=1.

+ +The actual menu page may be smaller than the format size. This depends +on the item number and size and whether O_ROWMAJOR is on. This option +(on by default) causes menu items to be displayed in a `raster-scan' +pattern, so that if more than one item will fit horizontally the first +couple of items are side-by-side in the top row. The alternative is +column-major display, which tries to put the first several items in +the first column.

+ +As mentioned above, a menu format not large enough to allow all items to fit +on-screen will result in a menu display that is vertically scrollable.

+You can scroll it with requests to the menu driver, which will be described +in the section on menu input handling.

+ +Each menu has a mark string used to visually tag selected items; +see the menu_mark(3x) manual page for details. The mark +string length also influences the menu page size.

+ +The function scale_menu() returns the minimum display size +that the menu code computes from all these factors. + +There are other menu display attributes including a select attribute, +an attribute for selectable items, an attribute for unselectable items, +and a pad character used to separate item name text from description +text. These have reasonable defaults which the library allows you to +change (see the menu_attribs(3x) manual page.

+ +

Menu Windows

+ +Each menu has, as mentioned previously, a pair of associated windows. +Both these windows are painted when the menu is posted and erased when +the menu is unposted.

+ +The outer or frame window is not otherwise touched by the menu +routines. It exists so the programmer can associate a title, a +border, or perhaps help text with the menu and have it properly +refreshed or erased at post/unpost time. The inner window or +subwindow is where the current menu page is displayed.

+ +By default, both windows are stdscr. You can set them with the +functions in menu_win(3x).

+ +When you call menu_post(), you write the menu to its +subwindow. When you call menu_unpost(), you erase the +subwindow, However, neither of these actually modifies the screen. To +do that, call wrefresh() or some equivalent.

+ +

Processing Menu Input

+ +The main loop of your menu-processing code should call +menu_driver() repeatedly. The first argument of this routine +is a menu pointer; the second is a menu command code. You should write an +input-fetching routine that maps input characters to menu command codes, and +pass its output to menu_driver(). The menu command codes are +fully documented in menu_driver(3x).

+ +The simplest group of command codes is REQ_NEXT_ITEM, +REQ_PREV_ITEM, REQ_FIRST_ITEM, +REQ_LAST_ITEM, REQ_UP_ITEM, +REQ_DOWN_ITEM, REQ_LEFT_ITEM, +REQ_RIGHT_ITEM. These change the currently selected +item. These requests may cause scrolling of the menu page if it only +partially displayed.

+ +There are explicit requests for scrolling which also change the +current item (because the select location does not change, but the +item there does). These are REQ_SCR_DLINE, +REQ_SCR_ULINE, REQ_SCR_DPAGE, and +REQ_SCR_UPAGE.

+ +The REQ_TOGGLE_ITEM selects or deselects the current item. +It is for use in multi-valued menus; if you use it with O_ONEVALUE +on, you'll get an error return (E_REQUEST_DENIED).

+ +Each menu has an associated pattern buffer. The +menu_driver() logic tries to accumulate printable ASCII +characters passed in in that buffer; when it matches a prefix of an +item name, that item (or the next matching item) is selected. If +appending a character yields no new match, that character is deleted +from the pattern buffer, and menu_driver() returns +E_NO_MATCH.

+ +Some requests change the pattern buffer directly: +REQ_CLEAR_PATTERN, REQ_BACK_PATTERN, +REQ_NEXT_MATCH, REQ_PREV_MATCH. The latter +two are useful when pattern buffer input matches more than one item +in a multi-valued menu.

+ +Each successful scroll or item navigation request clears the pattern +buffer. It is also possible to set the pattern buffer explicitly +with set_menu_pattern().

+ +Finally, menu driver requests above the constant MAX_COMMAND +are considered application-specific commands. The menu_driver() +code ignores them and returns E_UNKNOWN_COMMAND. + +

Miscellaneous Other Features

+ +Various menu options can affect the processing and visual appearance +and input processing of menus. See menu_opts(3x) for +details.

+ +It is possible to change the current item from application code; this +is useful if you want to write your own navigation requests. It is +also possible to explicitly set the top row of the menu display. See +mitem_current(3x). + +If your application needs to change the menu subwindow cursor for +any reason, pos_menu_cursor() will restore it to the +correct location for continuing menu driver processing.

+ +It is possible to set hooks to be called at menu initialization and +wrapup time, and whenever the selected item changes. See +menu_hook(3x).

+ +Each item, and each menu, has an associated user pointer on which you +can hang application data. See mitem_userptr(3x) and +menu_userptr(3x).

+ +

The Forms Library

+ +The form library is a curses extension that supports easy +programming of on-screen forms for data entry and program control.

+ +The form library first appeared in AT&T System V. The +version documented here is the freeware form code distributed +with ncurses.

+ +

Compiling With the form Library

+ +Your form-using modules must import the form library declarations with + +
+	  #include <form.h>
+
+ +and must be linked explicitly with the forms library using an +-lform argument. Note that they must also link the +ncurses library with -lncurses. Many linkers +are two-pass and will accept either order, but it is still good practice +to put -lform first and -lncurses second.

+ +

Overview of Forms

+ +A form is a collection of fields; each field may be either a label +(explanatory text) or a data-entry location. Long forms may be +segmented into pages; each entry to a new page clears the screen.

+To make forms, you create groups of fields and connect them with form +frame objects; the form library makes this relatively simple.

+ +Once defined, a form can be posted, that is written to an +associated window. Actually, each form has two associated windows; a +containing window in which the programmer can scribble titles or +borders, and a subwindow in which the form fields proper are displayed.

+ +As the form user fills out the posted form, navigation and editing +keys support movement between fields, editing keys support modifying +field, and plain text adds to or changes data in a current field. The +form library allows you (the forms designer) to bind each navigation +and editing key to any keystroke accepted by curses + +Fields may have validation conditions on them, so that they check input +data for type and value. The form library supplies a rich set of +pre-defined field types, and makes it relatively easy to define new ones.

+ +Once its transaction is completed (or aborted), a form may be +unposted (that is, undisplayed), and finally freed to make +the storage associated with it and its items available for re-use.

+ +The general flow of control of a form program looks like this: + +

    +
  1. Initialize curses. +
  2. Create the form fields, using new_field(). +
  3. Create the form using new_form(). +
  4. Post the form using form_post(). +
  5. Refresh the screen. +
  6. Process user requests via an input loop. +
  7. Unpost the form using form_unpost(). +
  8. Free the form, using free_form(). +
  9. Free the fields using free_field(). +
  10. Terminate curses. +
+ +Note that this looks much like a menu program; the form library handles +tasks which are in many ways similar, and its interface was obviously +designed to resemble that of the menu library +wherever possible.

+ +In forms programs, however, the `process user requests' is somewhat more +complicated than for menus. Besides menu-like navigation operations, +the menu driver loop has to support field editing and data validation.

+ +

Creating and Freeing Fields and Forms

+ +The basic function for creating fields is new_field():

+ +

+FIELD *new_field(int height, int width,   /* new field size */ 
+                 int top, int left,       /* upper left corner */
+                 int offscreen,           /* number of offscreen rows */
+                 int nbuf);               /* number of working buffers */
+
+ +Menu items always occupy a single row, but forms fields may have +multiple rows. So new_field() requires you to specify a +width and height (the first two arguments, which mist both be greater +than zero).

+ +You must also specify the location of the field's upper left corner on +the screen (the third and fourth arguments, which must be zero or +greater). Note that these coordinates are relative to the form +subwindow, which will coincide with stdscr by default but +need not be stdscr if you've done an explicit +set_form_window() call.

+ +The fifth argument allows you to specify a number of off-screen rows. If +this is zero, the entire field will always be displayed. If it is +nonzero, the form will be scrollable, with only one screen-full (initially +the top part) displayed at any given time. If you make a field dynamic +and grow it so it will no longer fit on the screen, the form will become +scrollable even if the offscreen argument was initially zero.

+ +The forms library allocates one working buffer per field; the size of +each buffer is ((height + offscreen)*width + 1, one character +for each position in the field plus a NUL terminator. The sixth +argument is the number of additional data buffers to allocate for the +field; your application can use them for its own purposes.

+ +

+FIELD *dup_field(FIELD *field,            /* field to copy */
+                 int top, int left);      /* location of new copy */
+
+ +The function dup_field() duplicates an existing field at a +new location. Size and buffering information are copied; some +attribute flags and status bits are not (see the +form_field_new(3X) for details).

+ +

+FIELD *link_field(FIELD *field,           /* field to copy */
+                  int top, int left);     /* location of new copy */
+
+ +The function link_field() also duplicates an existing field +at a new location. The difference from dup_field() is that +it arranges for the new field's buffer to be shared with the old one.

+ +Besides the obvious use in making a field editable from two different +form pages, linked fields give you a way to hack in dynamic labels. If +you declare several fields linked to an original, and then make them +inactive, changes from the original will still be propagated to the +linked fields.

+ +As with duplicated fields, linked fields have attribute bits separate +from the original.

+ +As you might guess, all these field-allocations return NULL if +the field allocation is not possible due to an out-of-memory error or +out-of-bounds arguments.

+ +To connect fields to a form, use

+ +

+FORM *new_form(FIELD **fields);
+
+ +This function expects to see a NULL-terminated array of field pointers. +Said fields are connected to a newly-allocated form object; its address +is returned (or else NULL if the allocation fails).

+ +Note that new_field() does not copy the pointer array +into private storage; if you modify the contents of the pointer array +during forms processing, all manner of bizarre things might happen. Also +note that any given field may only be connected to one form.

+ +The functions free_field() and free_form are available +to free field and form objects. It is an error to attempt to free a field +connected to a form, but not vice-versa; thus, you will generally free +your form objects first.

+ +

Fetching and Changing Field Attributes

+ +Each form field has a number of location and size attributes +associated with it. There are other field attributes used to control +display and editing of the field. Some (for example, the O_STATIC bit) +involve sufficient complications to be covered in sections of their own +later on. We cover the functions used to get and set several basic +attributes here.

+ +When a field is created, the attributes not specified by the +new_field function are copied from an invisible system +default field. In attribute-setting and -fetching functions, the +argument NULL is taken to mean this field. Changes to it persist +as defaults until your forms application terminates.

+ +

Fetching Size and Location Data

+ +You can retrieve field sizes and locations through:

+ +

+int field_info(FIELD *field,              /* field from which to fetch */
+               int *height, *int width,   /* field size */ 
+               int *top, int *left,       /* upper left corner */
+               int *offscreen,            /* number of offscreen rows */
+               int *nbuf);                /* number of working buffers */
+
+ +This function is a sort of inverse of new_field(); instead of +setting size and location attributes of a new field, it fetches them +from an existing one.

+ +

Changing the Field Location

+ +If is possible to move a field's location on the screen:

+ +

+int move_field(FIELD *field,              /* field to alter */
+               int top, int left);        /* new upper-left corner */
+
+ +You can, of course. query the current location through field_info(). + +

The Justification Attribute

+ +One-line fields may be unjustified, justified right, justified left, +or centered. Here is how you manipulate this attribute:

+ +

+int set_field_just(FIELD *field,          /* field to alter */
+                   int justmode);         /* mode to set */
+
+int field_just(FIELD *field);             /* fetch mode of field */
+
+ +The mode values accepted and returned by this functions are +preprocessor macros NO_JUSTIFICATION, JUSTIFY_RIGHT, +JUSTIFY_LEFT, or JUSTIFY_CENTER.

+ +

Field Display Attributes

+ +For each field, you can set a foreground attribute for entered +characters, a background attribute for the entire field, and a pad +character for the unfilled portion of the field. You can also +control pagination of the form.

+ +This group of four field attributes controls the visual appearance +of the field on the screen, without affecting in any way the data +in the field buffer.

+ +

+int set_field_fore(FIELD *field,          /* field to alter */
+                   chtype attr);          /* attribute to set */ 
+
+chtype field_fore(FIELD *field);          /* field to query */
+
+int set_field_back(FIELD *field,          /* field to alter */
+                   chtype attr);          /* attribute to set */ 
+
+chtype field_back(FIELD *field);          /* field to query */
+
+int set_field_pad(FIELD *field,           /* field to alter */
+                 int pad);                /* pad character to set */ 
+
+chtype field_pad(FIELD *field);
+
+int set_new_page(FIELD *field,            /* field to alter */
+                 int flag);               /* TRUE to force new page */ 
+
+chtype new_page(FIELD *field);            /* field to query */
+
+ +The attributes set and returned by the first four functions are normal +curses(3x) display attribute values (A_STANDOUT, +A_BOLD, A_REVERSE etc). + +The page bit of a field controls whether it is displayed at the start of +a new form screen.

+ +

Field Option Bits

+ +There is also a large collection of field option bits you can set to control +various aspects of forms processing. You can manipulate them with these +functions: + +
+int set_field_opts(FIELD *field,          /* field to alter */
+                   int attr);             /* attribute to set */ 
+
+int field_opts_on(FIELD *field,           /* field to alter */
+                  int attr);              /* attributes to turn on */ 
+
+int field_opts_off(FIELD *field,          /* field to alter */
+                   int attr);             /* attributes to turn off */ 
+
+int field_opts(FIELD *field);             /* field to query */
+
+ +By default, all options are on. Here are the available option bits: +
+
O_VISIBLE +
Controls whether the field is visible on the screen. Can be used +during form processing to hide or pop up fields depending on the value +of parent fields. +
O_ACTIVE +
Controls whether the field is active during forms processing (i.e. +visited by form navigation keys). Can be used to make labels or derived +fields with buffer values alterable by the forms application, not the user. +
O_PUBLIC +
Controls whether data is displayed during field entry. If this option is +turned off on a field, the library will accept and edit data in that field, +but it will not be displayed and the visible field cursor will not move. +You can turn off the O_PUBLIC bit to define password fields. +
O_EDIT +
Controls whether the field's data can be modified. When this option is +off, all editing requests except REQ_PREV_CHOICE and +REQ_NEXT_CHOICE will fail. Such read-only fields may be useful for +help messages. +
O_WRAP +
Controls word-wrapping in multi-line fields. Normally, when any +character of a (blank-separated) word reaches the end of the current line, the +entire word is wrapped to the next line (assuming there is one). When this +option is off, the word will be split across the line break. +
O_BLANK +
Controls field blanking. When this option is on, entering a character at +the first field position erases the entire field (except for the just-entered +character). +
O_AUTOSKIP +
Controls automatic skip to next field when this one fills. Normally, +when the forms user tries to type more data into a field than will fit, +the editing location jumps to next field. When this option is off, the +user's cursor will hang at the end of the field. This option is ignored +in dynamic fields that have not reached their size limit. +
O_NULLOK +
Controls whether validation is applied to +blank fields. Normally, it is not; the user can leave a field blank +without invoking the usual validation check on exit. If this option is +off on a field, exit from it will invoke a validation check. +
O_PASSOK +
Controls whether validation occurs on every exit, or only after +the field is modified. Normally the latter is true. Setting O_PASSOK +may be useful if your field's validation function may change during +forms processing. +
O_STATIC +
Controls whether the field is fixed to its initial dimensions. If you +turn this off, the field becomes dynamic and will +stretch to fit entered data. +
+ +A field's options cannot be changed while the field is currently selected. +However, options may be changed on posted fields that are not current.

+ +The option values are bit-masks and can be composed with logical-or in +the obvious way.

+ +

Field Status

+ +Every field has a status flag, which is set to FALSE when the field is +created and TRUE when the value in field buffer 0 changes. This flag can +be queried and set directly:

+ +

+int set_field_status(FIELD *field,      /* field to alter */
+                   int status);         /* mode to set */
+
+int field_status(FIELD *field);         /* fetch mode of field */
+
+ +Setting this flag under program control can be useful if you use the same +form repeatedly, looking for modified fields each time.

+ +Calling field_status() on a field not currently selected +for input will return a correct value. Calling field_status() on a +field that is currently selected for input may not necessarily give a +correct field status value, because entered data isn't necessarily copied to +buffer zero before the exit validation check. + +To guarantee that the returned status value reflects reality, call +field_status() either (1) in the field's exit validation check +routine, (2) from the field's or form's initialization or termination +hooks, or (3) just after a REQ_VALIDATION request has been +processed by the forms driver.

+ +

Field User Pointer

+ +Each field structure contains one character pointer slot that is not used +by the forms library. It is intended to be used by applications to store +private per-field data. You can manipulate it with: + +
+int set_field_userptr(FIELD *field,       /* field to alter */
+                   char *userptr);        /* mode to set */
+
+char *field_userptr(FIELD *field);        /* fetch mode of field */
+
+ +(Properly, this user pointer field ought to have (void *) type. +The (char *) type is retained for System V compatibility.)

+ +It is valid to set the user pointer of the default field (with a +set_field_userptr() call passed a NULL field pointer.) +When a new field is created, the default-field user pointer is copied +to initialize the new field's user pointer.

+ +

Variable-Sized Fields

+ +Normally, a field is fixed at the size specified for it at creation +time. If, however, you turn off its O_STATIC bit, it becomes +dynamic and will automatically resize itself to accommodate +data as it is entered. If the field has extra buffers associated with it, +they will grow right along with the main input buffer.

+ +A one-line dynamic field will have a fixed height (1) but variable +width, scrolling horizontally to display data within the field area as +originally dimensioned and located. A multi-line dynamic field will +have a fixed width, but variable height (number of rows), scrolling +vertically to display data within the field area as originally +dimensioned and located.

+ +Normally, a dynamic field is allowed to grow without limit. But it is +possible to set an upper limit on the size of a dynamic field. You do +it with this function:

+ +

+int set_max_field(FIELD *field,     /* field to alter (may not be NULL) */
+                   int max_size);   /* upper limit on field size */ 
+
+ +If the field is one-line, max_size is taken to be a column size +limit; if it is multi-line, it is taken to be a line size limit. To disable +any limit, use an argument of zero. The growth limit can be changed whether +or not the O_STATIC bit is on, but has no effect until it is.

+ +The following properties of a field change when it becomes dynamic: + +

    +
  • If there is no growth limit, there is no final position of the field; +therefore O_AUTOSKIP and O_NL_OVERLOAD are ignored. +
  • Field justification will be ignored (though whatever justification is +set up will be retained internally and can be queried). +
  • The dup_field() and link_field() calls copy +dynamic-buffer sizes. If the O_STATIC option is set on one of a +collection of links, buffer resizing will occur only when the field is +edited through that link. +
  • The call field_info() will retrieve the original static size of +the field; use dynamic_field_info() to get the actual dynamic size. +
+ +

Field Validation

+ +By default, a field will accept any data that will fit in its input buffer. +However, it is possible to attach a validation type to a field. If you do +this, any attempt to leave the field while it contains data that doesn't +match the validation type will fail. Some validation types also have a +character-validity check for each time a character is entered in the field.

+ +A field's validation check (if any) is not called when +set_field_buffer() modifies the input buffer, nor when that buffer +is changed through a linked field.

+ +The form library provides a rich set of pre-defined validation +types, and gives you the capability to define custom ones of your own. You +can examine and change field validation attributes with the following +functions:

+ +

+int set_field_type(FIELD *field,          /* field to alter */
+                   FIELDTYPE *ftype,      /* type to associate */
+                   ...);                  /* additional arguments*/
+
+FIELDTYPE *field_type(FIELD *field);      /* field to query */
+
+ +The validation type of a field is considered an attribute of the field. As +with other field attributes, Also, doing set_field_type() with a +NULL field default will change the system default for validation of +newly-created fields.

+ +Here are the pre-defined validation types:

+ +

TYPE_ALPHA

+ +This field type accepts alphabetic data; no blanks, no digits, no special +characters (this is checked at character-entry time). It is set up with:

+ +

+int set_field_type(FIELD *field,          /* field to alter */
+                   TYPE_ALPHA,            /* type to associate */
+                   int width);            /* maximum width of field */
+
+ +The width argument sets a minimum width of data. Typically +you'll want to set this to the field width; if it's greater than the +field width, the validation check will always fail. A minimum width +of zero makes field completion optional.

+ +

TYPE_ALNUM

+ +This field type accepts alphabetic data and digits; no blanks, no special +characters (this is checked at character-entry time). It is set up with:

+ +

+int set_field_type(FIELD *field,          /* field to alter */
+                   TYPE_ALNUM,            /* type to associate */
+                   int width);            /* maximum width of field */
+
+ +The width argument sets a minimum width of data. As with +TYPE_ALPHA, typically you'll want to set this to the field width; if it's +greater than the field width, the validation check will always fail. A +minimum width of zero makes field completion optional.

+ +

TYPE_ENUM

+ +This type allows you to restrict a field's values to be among a specified +set of string values (for example, the two-letter postal codes for U.S. +states). It is set up with:

+ +

+int set_field_type(FIELD *field,          /* field to alter */
+                   TYPE_ENUM,             /* type to associate */
+                   char **valuelist;      /* list of possible values */
+                   int checkcase;         /* case-sensitive? */
+                   int checkunique);      /* must specify uniquely? */
+
+ +The valuelist parameter must point at a NULL-terminated list of +valid strings. The checkcase argument, if true, makes comparison +with the string case-sensitive.

+ +When the user exits a TYPE_ENUM field, the validation procedure tries to +complete the data in the buffer to a valid entry. If a complete choice string +has been entered, it is of course valid. But it is also possible to enter a +prefix of a valid string and have it completed for you.

+ +By default, if you enter such a prefix and it matches more than one value +in the string list, the prefix will be completed to the first matching +value. But the checkunique argument, if true, requires prefix +matches to be unique in order to be valid.

+ +The REQ_NEXT_CHOICE and REQ_PREV_CHOICE input requests +can be particularly useful with these fields.

+ +

TYPE_INTEGER

+ +This field type accepts an integer. It is set up as follows:

+ +

+int set_field_type(FIELD *field,          /* field to alter */
+                   TYPE_INTEGER,          /* type to associate */
+                   int padding,           /* # places to zero-pad to */
+                   int vmin, int vmax);   /* valid range */
+
+ +Valid characters consist of an optional leading minus and digits. +The range check is performed on exit. If the range maximum is less +than or equal to the minimum, the range is ignored.

+ +If the value passes its range check, it is padded with as many leading +zero digits as necessary to meet the padding argument.

+ +A TYPE_INTEGER value buffer can conveniently be interpreted +with the C library function atoi(3). + +

TYPE_NUMERIC

+ +This field type accepts a decimal number. It is set up as follows:

+ +

+int set_field_type(FIELD *field,              /* field to alter */
+                   TYPE_NUMERIC,              /* type to associate */
+                   int padding,               /* # places of precision */
+                   double vmin, double vmax); /* valid range */
+
+ +Valid characters consist of an optional leading minus and digits. possibly +including a decimal point. If your system supports locale's, the decimal point +character used must be the one defined by your locale. The range check is +performed on exit. If the range maximum is less than or equal to the minimum, +the range is ignored.

+ +If the value passes its range check, it is padded with as many trailing +zero digits as necessary to meet the padding argument.

+ +A TYPE_NUMERIC value buffer can conveniently be interpreted +with the C library function atof(3). + +

TYPE_REGEXP

+ +This field type accepts data matching a regular expression. It is set up +as follows:

+ +

+int set_field_type(FIELD *field,          /* field to alter */
+                   TYPE_REGEXP,           /* type to associate */
+                   char *regexp);         /* expression to match */
+
+ +The syntax for regular expressions is that of regcomp(3). +The check for regular-expression match is performed on exit. + +

Direct Field Buffer Manipulation

+ +The chief attribute of a field is its buffer contents. When a form has +been completed, your application usually needs to know the state of each +field buffer. You can find this out with:

+ +

+char *field_buffer(FIELD *field,          /* field to query */
+                   int bufindex);         /* number of buffer to query */
+
+ +Normally, the state of the zero-numbered buffer for each field is set by +the user's editing actions on that field. It's sometimes useful to be able +to set the value of the zero-numbered (or some other) buffer from your +application: + +
+int set_field_buffer(FIELD *field,        /* field to alter */
+                   int bufindex,          /* number of buffer to alter */
+                   char *value);          /* string value to set */
+
+ +If the field is not large enough and cannot be resized to a sufficiently +large size to contain the specified value, the value will be truncated +to fit.

+ +Calling field_buffer() with a null field pointer will raise an +error. Calling field_buffer() on a field not currently selected +for input will return a correct value. Calling field_buffer() on a +field that is currently selected for input may not necessarily give a +correct field buffer value, because entered data isn't necessarily copied to +buffer zero before the exit validation check. + +To guarantee that the returned buffer value reflects on-screen reality, +call field_buffer() either (1) in the field's exit validation +check routine, (2) from the field's or form's initialization or termination +hooks, or (3) just after a REQ_VALIDATION request has been processed +by the forms driver.

+ +

Attributes of Forms

+ +As with field attributes, form attributes inherit a default from a +system default form structure. These defaults can be queried or set by +of these functions using a form-pointer argument of NULL.

+ +The principal attribute of a form is its field list. You can query +and change this list with:

+ +

+int set_form_fields(FORM *form,           /* form to alter */
+                    FIELD **fields);      /* fields to connect */
+
+char *form_fields(FORM *form);            /* fetch fields of form */
+
+int field_count(FORM *form);              /* count connect fields */
+
+ +The second argument of set_form_fields() may be a +NULL-terminated field pointer array like the one required by +new_form(). In that case, the old fields of the form are +disconnected but not freed (and eligible to be connected to other +forms), then the new fields are connected.

+ +It may also be null, in which case the old fields are disconnected +(and not freed) but no new ones are connected.

+ +The field_count() function simply counts the number of fields +connected to a given from. It returns -1 if the form-pointer argument +is NULL.

+ +

Control of Form Display

+ +In the overview section, you saw that to display a form you normally +start by defining its size (and fields), posting it, and refreshing +the screen. There is an hidden step before posting, which is the +association of the form with a frame window (actually, a pair of +windows) within which it will be displayed. By default, the forms +library associates every form with the full-screen window +stdscr.

+ +By making this step explicit, you can associate a form with a declared +frame window on your screen display. This can be useful if you want to +adapt the form display to different screen sizes, dynamically tile +forms on the screen, or use a form as part of an interface layout +managed by panels.

+ +The two windows associated with each form have the same functions as +their analogues in the menu library. Both these +windows are painted when the form is posted and erased when the form +is unposted.

+ +The outer or frame window is not otherwise touched by the form +routines. It exists so the programmer can associate a title, a +border, or perhaps help text with the form and have it properly +refreshed or erased at post/unpost time. The inner window or subwindow +is where the current form page is actually displayed.

+ +In order to declare your own frame window for a form, you'll need to +know the size of the form's bounding rectangle. You can get this +information with:

+ +

+int scale_form(FORM *form,                /* form to query */
+               int *rows,                 /* form rows */
+               int *cols);                /* form cols */
+
+ +The form dimensions are passed back in the locations pointed to by +the arguments. Once you have this information, you can use it to +declare of windows, then use one of these functions: + +
+int set_form_win(FORM *form,              /* form to alter */
+                 WINDOW *win);            /* frame window to connect */
+
+WINDOW *form_win(FORM *form);             /* fetch frame window of form */
+
+int set_form_sub(FORM *form,              /* form to alter */
+                 WINDOW *win);            /* form subwindow to connect */
+
+WINDOW *form_sub(FORM *form);             /* fetch form subwindow of form */
+
+ +Note that curses operations, including refresh(), on the form, +should be done on the frame window, not the form subwindow.

+ +It is possible to check from your application whether all of a +scrollable field is actually displayed within the menu subwindow. Use +these functions:

+ +

+int data_ahead(FORM *form);               /* form to be queried */ 
+
+int data_behind(FORM *form);              /* form to be queried */ 
+
+ +The function data_ahead() returns TRUE if (a) the current +field is one-line and has undisplayed data off to the right, (b) the current +field is multi-line and there is data off-screen below it.

+ +The function data_behind() returns TRUE if the first (upper +left hand) character position is off-screen (not being displayed).

+ +Finally, there is a function to restore the form window's cursor to the +value expected by the forms driver:

+ +

+int pos_form_cursor(FORM *)               /* form to be queried */
+
+ +If your application changes the form window cursor, call this function before +handing control back to the forms driver in order to re-synchronize it.

+ +

Input Processing in the Forms Driver

+ +The function form_driver() handles virtualized input requests +for form navigation, editing, and validation requests, just as +menu_driver does for menus (see the section on menu input handling).

+ +

+int form_driver(FORM *form,               /* form to pass input to */
+                int request);             /* form request code */
+
+ +Your input virtualization function needs to take input and then convert it +to either an alphanumeric character (which is treated as data to be +entered in the currently-selected field), or a forms processing request.

+ +The forms driver provides hooks (through input-validation and +field-termination functions) with which your application code can check +that the input taken by the driver matched what was expected.

+ +

Page Navigation Requests

+ +These requests cause page-level moves through the form, +triggering display of a new form screen.

+ +

+
REQ_NEXT_PAGE +
Move to the next form page. +
REQ_PREV_PAGE +
Move to the previous form page. +
REQ_FIRST_PAGE +
Move to the first form page. +
REQ_LAST_PAGE +
Move to the last form page. +
+ +These requests treat the list as cyclic; that is, REQ_NEXT_PAGE +from the last page goes to the first, and REQ_PREV_PAGE from +the first page goes to the last.

+ +

Inter-Field Navigation Requests

+ +These requests handle navigation between fields on the same page.

+ +

+
REQ_NEXT_FIELD +
Move to next field. +
REQ_PREV_FIELD +
Move to previous field. +
REQ_FIRST_FIELD +
Move to the first field. +
REQ_LAST_FIELD +
Move to the last field. +

+

REQ_SNEXT_FIELD +
Move to sorted next field. +
REQ_SPREV_FIELD +
Move to sorted previous field. +
REQ_SFIRST_FIELD +
Move to the sorted first field. +
REQ_SLAST_FIELD +
Move to the sorted last field. +

+

REQ_LEFT_FIELD +
Move left to field. +
REQ_RIGHT_FIELD +
Move right to field. +
REQ_UP_FIELD +
Move up to field. +
REQ_DOWN_FIELD +
Move down to field. +
+ +These requests treat the list of fields on a page as cyclic; that is, +REQ_NEXT_FIELD from the last field goes to the first, and +REQ_PREV_FIELD from the first field goes to the last. The +order of the fields for these (and the REQ_FIRST_FIELD and +REQ_LAST_FIELD requests) is simply the order of the field +pointers in the form array (as set up by new_form() or +set_form_fields()

+ +It is also possible to traverse the fields as if they had been sorted in +screen-position order, so the sequence goes left-to-right and top-to-bottom. +To do this, use the second group of four sorted-movement requests.

+ +Finally, it is possible to move between fields using visual directions up, +down, right, and left. To accomplish this, use the third group of four +requests. Note, however, that the position of a form for purposes of these +requests is its upper-left corner.

+ +For example, suppose you have a multi-line field B, and two +single-line fields A and C on the same line with B, with A to the left +of B and C to the right of B. A REQ_MOVE_RIGHT from A will +go to B only if A, B, and C all share the same first line; +otherwise it will skip over B to C.

+ +

Intra-Field Navigation Requests

+ +These requests drive movement of the edit cursor within the currently +selected field.

+ +

+
REQ_NEXT_CHAR +
Move to next character. +
REQ_PREV_CHAR +
Move to previous character. +
REQ_NEXT_LINE +
Move to next line. +
REQ_PREV_LINE +
Move to previous line. +
REQ_NEXT_WORD +
Move to next word. +
REQ_PREV_WORD +
Move to previous word. +
REQ_BEG_FIELD +
Move to beginning of field. +
REQ_END_FIELD +
Move to end of field. +
REQ_BEG_LINE +
Move to beginning of line. +
REQ_END_LINE +
Move to end of line. +
REQ_LEFT_CHAR +
Move left in field. +
REQ_RIGHT_CHAR +
Move right in field. +
REQ_UP_CHAR +
Move up in field. +
REQ_DOWN_CHAR +
Move down in field. +
+ +Each word is separated from the previous and next characters +by whitespace. The commands to move to beginning and end of line or field +look for the first or last non-pad character in their ranges.

+ +

Scrolling Requests

+ +Fields that are dynamic and have grown and fields explicitly created +with offscreen rows are scrollable. One-line fields scroll horizontally; +multi-line fields scroll vertically. Most scrolling is triggered by +editing and intra-field movement (the library scrolls the field to keep the +cursor visible). It is possible to explicitly request scrolling with the +following requests: +

+ +

+
REQ_SCR_FLINE +
Scroll vertically forward a line. +
REQ_SCR_BLINE +
Scroll vertically backward a line. +
REQ_SCR_FPAGE +
Scroll vertically forward a page. +
REQ_SCR_BPAGE +
Scroll vertically backward a page. +
REQ_SCR_FHPAGE +
Scroll vertically forward half a page. +
REQ_SCR_BHPAGE +
Scroll vertically backward half a page. +
REQ_SCR_FCHAR +
Scroll horizontally forward a character. +
REQ_SCR_BCHAR +
Scroll horizontally backward a character. +
REQ_SCR_HFLINE +
Scroll horizontally one field width forward. +
REQ_SCR_HBLINE +
Scroll horizontally one field width backward. +
REQ_SCR_HFHALF +
Scroll horizontally one half field width forward. +
REQ_SCR_HBHALF +
Scroll horizontally one half field width backward. +
+ +For scrolling purposes, a page of a field is the height +of its visible part.

+ +

Editing Requests

+ +When you pass the forms driver an ASCII character, it is treated as a +request to add the character to the field's data buffer. Whether this +is an insertion or a replacement depends on the field's edit mode +(insertion is the default.

+ +The following requests support editing the field and changing the edit +mode:

+ +

+
REQ_INS_MODE +
Set insertion mode. +
REQ_OVL_MODE +
Set overlay mode. +
REQ_NEW_LINE +
New line request (see below for explanation). +
REQ_INS_CHAR +
Insert space at character location. +
REQ_INS_LINE +
Insert blank line at character location. +
REQ_DEL_CHAR +
Delete character at cursor. +
REQ_DEL_PREV +
Delete previous word at cursor. +
REQ_DEL_LINE +
Delete line at cursor. +
REQ_DEL_WORD +
Delete word at cursor. +
REQ_CLR_EOL +
Clear to end of line. +
REQ_CLR_EOF +
Clear to end of field. +
REQ_CLEAR_FIELD +
Clear entire field. +
+ +The behavior of the REQ_NEW_LINE and REQ_DEL_PREV requests +is complicated and partly controlled by a pair of forms options. +The special cases are triggered when the cursor is at the beginning of +a field, or on the last line of the field.

+ +First, we consider REQ_NEW_LINE:

+ +The normal behavior of REQ_NEW_LINE in insert mode is to break the +current line at the position of the edit cursor, inserting the portion of +the current line after the cursor as a new line following the current +and moving the cursor to the beginning of that new line (you may think +of this as inserting a newline in the field buffer).

+ +The normal behavior of REQ_NEW_LINE in overlay mode is to clear the +current line from the position of the edit cursor to end of line. +The cursor is then moved to the beginning of the next line.

+ +However, REQ_NEW_LINE at the beginning of a field, or on the +last line of a field, instead does a REQ_NEXT_FIELD. +O_NL_OVERLOAD option is off, this special action is +disabled.

+ +Now, let us consider REQ_DEL_PREV:

+ +The normal behavior of REQ_DEL_PREV is to delete the previous +character. If insert mode is on, and the cursor is at the start of a +line, and the text on that line will fit on the previous one, it +instead appends the contents of the current line to the previous one +and deletes the current line (you may think of this as deleting a +newline from the field buffer).

+ +However, REQ_DEL_PREV at the beginning of a field is instead +treated as a REQ_PREV_FIELD.

If the +O_BS_OVERLOAD option is off, this special action is +disabled and the forms driver just returns E_REQUEST_DENIED.

+ +See Form Options for discussion of how to set +and clear the overload options.

+ +

Order Requests

+ +If the type of your field is ordered, and has associated functions +for getting the next and previous values of the type from a given value, +there are requests that can fetch that value into the field buffer:

+ +

+
REQ_NEXT_CHOICE +
Place the successor value of the current value in the buffer. +
REQ_PREV_CHOICE +
Place the predecessor value of the current value in the buffer. +
+ +Of the built-in field types, only TYPE_ENUM has built-in successor +and predecessor functions. When you define a field type of your own +(see Custom Validation Types), you can associate +our own ordering functions.

+ +

Application Commands

+ +Form requests are represented as integers above the curses value +greater than KEY_MAX and less than or equal to the constant +MAX_COMMAND. If your input-virtualization routine returns a +value above MAX_COMMAND, the forms driver will ignore it.

+ +

Field Change Hooks

+ +It is possible to set function hooks to be executed whenever the +current field or form changes. Here are the functions that support this:

+ +

+typedef void	(*HOOK)();       /* pointer to function returning void */
+
+int set_form_init(FORM *form,    /* form to alter */
+                  HOOK hook);    /* initialization hook */
+
+HOOK form_init(FORM *form);      /* form to query */
+
+int set_form_term(FORM *form,    /* form to alter */
+                  HOOK hook);    /* termination hook */
+
+HOOK form_term(FORM *form);      /* form to query */
+
+int set_field_init(FORM *form,   /* form to alter */
+                  HOOK hook);    /* initialization hook */
+
+HOOK field_init(FORM *form);     /* form to query */
+
+int set_field_term(FORM *form,   /* form to alter */
+                  HOOK hook);    /* termination hook */
+
+HOOK field_term(FORM *form);     /* form to query */
+
+ +These functions allow you to either set or query four different hooks. +In each of the set functions, the second argument should be the +address of a hook function. These functions differ only in the timing +of the hook call.

+ +

+
form_init +
This hook is called when the form is posted; also, just after +each page change operation. +
field_init +
This hook is called when the form is posted; also, just after +each field change +
field_term +
This hook is called just after field validation; that is, just before +the field is altered. It is also called when the form is unposted.

+

form_term +
This hook is called when the form is unposted; also, just before +each page change operation. +
+ +Calls to these hooks may be triggered +
    +
  1. When user editing requests are processed by the forms driver +
  2. When the current page is changed by set_current_field() call +
  3. When the current field is changed by a set_form_page() call +
+ +See Field Change Commands for discussion of the latter +two cases.

+ +You can set a default hook for all fields by passing one of the set functions +a NULL first argument.

+ +You can disable any of these hooks by (re)setting them to NULL, the default +value.

+ +

Field Change Commands

+ +Normally, navigation through the form will be driven by the user's +input requests. But sometimes it is useful to be able to move the +focus for editing and viewing under control of your application, or +ask which field it currently is in. The following functions help you +accomplish this:

+ +

+int set_current_field(FORM *form,         /* form to alter */
+                      FIELD *field);      /* field to shift to */
+
+FIELD *current_field(FORM *form);         /* form to query */
+
+int field_index(FORM *form,               /* form to query */
+                FIELD *field);            /* field to get index of */
+
+ +The function field_index() returns the index of the given field +in the given form's field array (the array passed to new_form() or +set_form_fields()).

+ +The initial current field of a form is the first active field on the +first page. The function set_form_fields() resets this.

+ +It is also possible to move around by pages.

+ +

+int set_form_page(FORM *form,             /* form to alter */
+                  int page);              /* page to go to (0-origin) */
+
+int form_page(FORM *form);                /* return form's current page */
+
+ +The initial page of a newly-created form is 0. The function +set_form_fields() resets this.

+ +

Form Options

+ +Like fields, forms may have control option bits. They can be changed +or queried with these functions:

+ +

+int set_form_opts(FORM *form,             /* form to alter */
+                  int attr);              /* attribute to set */ 
+
+int form_opts_on(FORM *form,              /* form to alter */
+                 int attr);               /* attributes to turn on */ 
+
+int form_opts_off(FORM *form,             /* form to alter */
+                  int attr);              /* attributes to turn off */ 
+
+int form_opts(FORM *form);                /* form to query */
+
+ +By default, all options are on. Here are the available option bits: + +
+
O_NL_OVERLOAD +
Enable overloading of REQ_NEW_LINE as described in Editing Requests. The value of this option is +ignored on dynamic fields that have not reached their size limit; +these have no last line, so the circumstances for triggering a +REQ_NEXT_FIELD never arise. +
O_BS_OVERLOAD +
Enable overloading of REQ_DEL_PREV as described in +Editing Requests. +
+ +The option values are bit-masks and can be composed with logical-or in +the obvious way.

+ +

Custom Validation Types

+ +The form library gives you the capability to define custom +validation types of your own. Further, the optional additional arguments +of set_field_type effectively allow you to parameterize validation +types. Most of the complications in the validation-type interface have to +do with the handling of the additional arguments within custom validation +functions.

+ +

Union Types

+ +The simplest way to create a custom data type is to compose it from two +preexisting ones:

+ +

+FIELD *link_fieldtype(FIELDTYPE *type1, 
+                      FIELDTYPE *type2);
+
+ +This function creates a field type that will accept any of the values +legal for either of its argument field types (which may be either +predefined or programmer-defined). + +If a set_field_type() call later requires arguments, the new +composite type expects all arguments for the first type, than all arguments +for the second. Order functions (see Order Requests) +associated with the component types will work on the composite; what it does +is check the validation function for the first type, then for the second, to +figure what type the buffer contents should be treated as.

+ +

New Field Types

+ +To create a field type from scratch, you need to specify one or both of the +following things:

+ +

    +
  • A character-validation function, to check each character as it is entered. +
  • A field-validation function to be applied on exit from the field. +
+ +Here's how you do that:

+

+typedef int	(*HOOK)();       /* pointer to function returning int */
+
+FIELDTYPE *new_fieldtype(HOOK f_validate, /* field validator */
+                         HOOK c_validate) /* character validator */
+
+
+int free_fieldtype(FIELDTYPE *ftype);     /* type to free */
+
+ +At least one of the arguments of new_fieldtype() must be +non-NULL. The forms driver will automatically call the new type's +validation functions at appropriate points in processing a field of +the new type.

+ +The function free_fieldtype() deallocates the argument +fieldtype, freeing all storage associated with it.

+ +Normally, a field validator is called when the user attempts to +leave the field. Its first argument is a field pointer, from which it +can get to field buffer 0 and test it. If the function returns TRUE, +the operation succeeds; if it returns FALSE, the edit cursor stays in +the field.

+ +A character validator gets the character passed in as a first argument. +It too should return TRUE if the character is valid, FALSE otherwise.

+ +

Validation Function Arguments

+ +Your field- and character- validation functions will be passed a +second argument as well. This second argument is the address of a +structure (which we'll call a pile) built from any of the +field-type-specific arguments passed to set_field_type(). If +no such arguments are defined for the field type, this pile pointer +argument will be NULL.

+ +In order to arrange for such arguments to be passed to your validation +functions, you must associate a small set of storage-management functions +with the type. The forms driver will use these to synthesize a pile +from the trailing arguments of each set_field_type() argument, and +a pointer to the pile will be passed to the validation functions.

+ +Here is how you make the association:

+ +

+typedef char	*(*PTRHOOK)();    /* pointer to function returning (char *) */
+typedef void	(*VOIDHOOK)();    /* pointer to function returning void */
+
+int set_fieldtype_arg(FIELDTYPE *type,    /* type to alter */
+                      PTRHOOK make_str,   /* make structure from args */
+                      PTRHOOK copy_str,   /* make copy of structure */
+                      VOIDHOOK free_str); /* free structure storage */
+
+ +Here is how the storage-management hooks are used:

+ +

+
make_str +
This function is called by set_field_type(). It gets one +argument, a va_list of the type-specific arguments passed to +set_field_type(). It is expected to return a pile pointer to a data +structure that encapsulates those arguments. +
copy_str +
This function is called by form library functions that allocate new +field instances. It is expected to take a pile pointer, copy the pile +to allocated storage, and return the address of the pile copy. +
free_str +
This function is called by field- and type-deallocation routines in the +library. It takes a pile pointer argument, and is expected to free the +storage of that pile. +
+ +The make_str and copy_str functions may return NULL to +signal allocation failure. The library routines will that call them will +return error indication when this happens. Thus, your validation functions +should never see a NULL file pointer and need not check specially for it.

+ +

Order Functions For Custom Types

+ +Some custom field types are simply ordered in the same well-defined way +that TYPE_ENUM is. For such types, it is possible to define +successor and predecessor functions to support the REQ_NEXT_CHOICE +and REQ_PREV_CHOICE requests. Here's how:

+ +

+typedef int	(*INTHOOK)();     /* pointer to function returning int */
+
+int set_fieldtype_arg(FIELDTYPE *type,    /* type to alter */
+                      INTHOOK succ,       /* get successor value */
+                      INTHOOK pred);      /* get predecessor value */
+
+ +The successor and predecessor arguments will each be passed two arguments; +a field pointer, and a pile pointer (as for the validation functions). They +are expected to use the function field_buffer() to read the +current value, and set_field_buffer() on buffer 0 to set the next +or previous value. Either hook may return TRUE to indicate success (a +legal next or previous value was set) or FALSE to indicate failure.

+ +

Avoiding Problems

+ +The interface for defining custom types is complicated and tricky. +Rather than attempting to create a custom type entirely from scratch, +you should start by studying the library source code for whichever of +the pre-defined types seems to be closest to what you want.

+ +Use that code as a model, and evolve it towards what you really want. +You will avoid many problems and annoyances that way. The code +in the ncurses library has been specifically exempted from +the package copyright to support this.

+ +If your custom type defines order functions, have do something intuitive +with a blank field. A useful convention is to make the successor of a +blank field the types minimum value, and its predecessor the maximum. + + diff --git a/misc/run_tic.sh b/misc/run_tic.sh new file mode 100755 index 00000000..4dcbd79a --- /dev/null +++ b/misc/run_tic.sh @@ -0,0 +1,138 @@ +#!/bin/sh +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# $Id: run_tic.sh,v 1.8 1996/12/01 05:10:08 tom Exp $ +# This script is used to install terminfo.src using tic. We use a script +# because the path checking is too awkward to do in a makefile. +# +# Parameters: +# $1 = nominal directory in which to find 'tic', i.e., $(bindir). +# $2 = source-directory, i.e., $(srcdir) +# $3 = destination-directory path, i.e., $(ticdir) +# $4 = install-prefix, if any +# +# Assumes: +# The leaf directory names (bin, lib, shared, tabset, terminfo) +# +echo '** Building terminfo database, please wait...' +# +# Parameter parsing is primarily for debugging. The script is designed to +# be run from the misc/Makefile as +# make install.data +prefix=/usr/local +if test $# != 0 ; then + bindir=$1 + shift + PREFIX=`echo $bindir | sed -e 's/\/bin$//'` + test -n "$PREFIX" && test "x$PREFIX" != "x$bindir" && prefix=$PREFIX +else + bindir=$prefix/bin +fi + +if test $# != 0 ; then + srcdir=$1 + shift +else + srcdir=. +fi + +if test $# != 0 ; then + ticdir=$1 + shift +else + ticdir=$prefix/share/terminfo +fi + +if test $# != 0 ; then + IP=$1 + shift +else + IP="" +fi + +# Allow tic to run either from the install-path, or from the build-directory +case "$PATH" in +:*) PATH=../progs:$IP$bindir$PATH ;; +*) PATH=../progs:$IP$bindir:$PATH ;; +esac +export PATH +TERMINFO=$IP$ticdir ; export TERMINFO +umask 022 + +# Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo. +TICDIR=`echo $TERMINFO | sed -e 's/\/share\//\/lib\//'` + +# Remove the old terminfo stuff; we don't care if it existed before, and it +# would generate a lot of confusing error messages if we tried to overwrite it. +# We explicitly remove its contents rather than the directory itself, in case +# the directory is actually a symbolic link. +( rm -fr $TERMINFO/[0-9A-Za-z] 2>/dev/null ) + +# If we're not installing into /usr/share/, we'll have to adjust the location +# of the tabset files in terminfo.src (which are in a parallel directory). +TABSET=`echo $ticdir | sed -e 's/\/terminfo$/\/tabset/'` +SRC=$srcdir/terminfo.src +if test "x$TABSET" != "x/usr/share/tabset" ; then + echo '** adjusting tabset paths' + TMP=${TMPDIR-/tmp}/$$ + sed -e s:/usr/share/tabset:$TABSET:g $SRC >$TMP + trap "rm -f $TMP" 0 1 2 5 15 + SRC=$TMP +fi + +if ( $srcdir/shlib tic -s $SRC ) +then + echo '** built new '$TERMINFO +else + echo '? tic could not build '$TERMINFO + exit 1 +fi + +# Make a symbolic link to provide compatibility with applications that expect +# to find terminfo under /usr/lib. That is, we'll _try_ to do that. Not +# all systems support symbolic links, and those that do provide a variety +# of options for 'test'. +if test "$TICDIR" != "$TERMINFO" ; then + ( rm -f $TICDIR 2>/dev/null ) + if ( cd $TICDIR 2>/dev/null ) + then + cd $TICDIR + TICDIR=`pwd` + if test $TICDIR != $TERMINFO ; then + # Well, we tried. Some systems lie to us, so the + # installer will have to double-check. + echo "Verify if $TICDIR and $TERMINFO are the same." + echo "The new terminfo is in $TERMINFO; the other should be a link to it." + echo "Otherwise, remove $TICDIR and link it to $TERMINFO." + fi + else + cd $IP$prefix + # Construct a symbolic link that only assumes $ticdir has the + # same $prefix as the other installed directories. + RELATIVE=`echo $ticdir|sed -e 's:^'$prefix'/::'` + if test "$RELATIVE" != "$ticdir" ; then + RELATIVE=../`echo $ticdir|sed -e 's:^'$prefix'/::' -e 's:^/::'` + fi + if ( ln -s $RELATIVE $TICDIR ) + then + echo '** linked '$TICDIR' for compatibility' + fi + fi +fi diff --git a/misc/shlib b/misc/shlib new file mode 100755 index 00000000..afed335d --- /dev/null +++ b/misc/shlib @@ -0,0 +1,62 @@ +#!/bin/sh +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# $Id: shlib,v 1.3 1996/06/17 21:45:36 tom Exp $ +# Use this script as a wrapper when running executables linked to shared +# libraries on systems that use the $LD_LIBRARY_PATH variable and don't embed +# the soname's path within the linked executable (such as IRIX), e.g, +# +# shlib knight +# +# Setting LD_LIBRARY_PATH, overrides/supplements the loader's normal search +# path, and works on most systems. The drawback is that then the environment +# variable has to be set to run the programs within this directory tree. +# +# For Linux (and other systems using the GNU loader), we can use the rpath +# directive, which embeds the pathname of the library within the executable. +# Using the Linux loader's rpath directive introduces a constraint, since +# it's embedded into the binary, and means that the binary cannot be moved +# around (though it'll work if the $exec_prefix convention that puts the bin +# and lib directories under the same parent is followed). +# +# Using the actual soname (e.g., ../lib/libncurses.so) alone, is a more +# flexible solution; you can link without having to set the environment +# variable, and on some systems (IRIX) you can even run the resulting binaries +# without setting LD_LIBRARY_PATH. +# +# Using a conventional link, with -L and -l options on Linux results in a +# statically linked executable, which we don't want at all. +# +q="" +for p in lib ../lib +do + if test -d $p; then + q="$p" + fi +done +if test -n "$q" ; then + if test -n "$LD_LIBRARY_PATH"; then + LD_LIBRARY_PATH="$q:$LD_LIBRARY_PATH" + else + LD_LIBRARY_PATH="$q" + fi + export LD_LIBRARY_PATH +fi +eval "$*" diff --git a/misc/tabset/std b/misc/tabset/std new file mode 100644 index 00000000..e93f737f --- /dev/null +++ b/misc/tabset/std @@ -0,0 +1 @@ + 3 1 1 1 1 1 1 1 1 1 1 1 1 1 diff --git a/misc/tabset/stdcrt b/misc/tabset/stdcrt new file mode 100644 index 00000000..66ba12f6 --- /dev/null +++ b/misc/tabset/stdcrt @@ -0,0 +1 @@ + 3 1 1 1 1 1 1 1 1 1 \ No newline at end of file diff --git a/misc/tabset/vt100 b/misc/tabset/vt100 new file mode 100644 index 00000000..8828d19d --- /dev/null +++ b/misc/tabset/vt100 @@ -0,0 +1,3 @@ + + +H H H H H H H H H H H H H H H H diff --git a/misc/tabset/vt300 b/misc/tabset/vt300 new file mode 100644 index 00000000..b1f9ce16 --- /dev/null +++ b/misc/tabset/vt300 @@ -0,0 +1,3 @@ + + +P2$t9/17/25/33/41/49/57/65/73/81/89/97/105/113/121/129\ diff --git a/misc/tdlint b/misc/tdlint new file mode 100755 index 00000000..287b8e1c --- /dev/null +++ b/misc/tdlint @@ -0,0 +1,100 @@ +#!/bin/sh +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# $Id: tdlint,v 1.3 1996/07/15 00:47:21 tom Exp $ +# +# Lint-script that allows user's own lint libraries, in addition to the ones +# installed in the system. +# +OPT="" +DIRS="" +LIBS="" +FILES="" +ARCH=`uname -s` +if test -z "$ARCH" ; then + echo '? uname not found' + exit 1 +else + case $ARCH in + AIX) set - $* -Nn4000 + ;; + IRIX) set - $* -n -lc + ;; + SunOS) + case `uname -r` in + 5.*) ARCH=Solaris + set - $* -n -lc + ;; + esac + ;; + esac +fi +# LIBDIR=$HOME/lib/$ARCH/lint ;export LIBDIR +for p in $HOME/lib/$ARCH/lint /usr/lib/lint /usr/lib +do + if [ -d $p ] + then + DIRS="$DIRS $p" + fi +done +# +while [ $# != 0 ] +do + case $1 in + -D*\"*) ;; + -L*) + DIRS="`echo $1|sed -e 's/^-L//'` $DIRS" + ;; + -l*) + lib="llib-l`echo $1 | sed -e 's/^-l//'`.ln" + found=no + for p in $DIRS + do + echo -n testing $p/$lib + if [ -f $p/$lib ] + then + LIBS="$LIBS $p/$lib" + echo " (ok)" + found=yes + break + fi + echo + done + if [ $found = no ] + then + echo "ignored library $1" + fi + ;; + -n) if [ -z "$OPT" ] + then + OPT="-I." + fi + OPT="$OPT $1" + ;; + -*) OPT="$OPT $1" + ;; + *) + FILES="$FILES $1" + ;; + esac + shift +done +# +eval lint $OPT $FILES $LIBS diff --git a/misc/terminfo.src b/misc/terminfo.src new file mode 100644 index 00000000..496be629 --- /dev/null +++ b/misc/terminfo.src @@ -0,0 +1,13911 @@ +######## TERMINAL TYPE DESCRIPTIONS SOURCE FILE +# +# Version 10.1.1 +# terminfo syntax +# +# Eric S. Raymond (current maintainer) +# John Kunze, Berkeley +# Craig Leres, Berkeley +# +# Please e-mail changes to terminfo@ccil.org. The old termcap@berkeley.edu +# address is no longer valid. +# +# PURPOSE OF THIS FILE: +# +# This file describes the capabilities of various character-cell terminals, +# as needed by software such as screen-oriented editors. +# +# Other terminfo and termcap files exist, supported by various OS vendors +# or as relics of various older versions of UNIX. This one is the longest +# and most comprehensive one in existence. It subsumes not only the entirety +# of the historical 4.4BSD, GNU, System V and SCO termcap files and the BRL +# termcap file, but also large numbers of vendor-maintained termcap and +# terminfo entries more complete and carefully tested than those in historical +# termcap/terminfo versions. +# +# Pointers to related resources (including the ncurses distribution) may +# be found at . +# +# INTERNATIONALIZATION: +# +# This file uses only the US-ASCII character set (no ISO8859 characters). +# +# This file assumes a US-ASCII character set. If you need to fix this, start +# by global-replacing \E(B and \E)B with the appropriate ISO 6429 enablers +# for your character set. \E(A and \E)A enables the British character set +# with the pound sign at position 2/3. +# +# In a Japanese-processing environment using EUC/Japanese or Shift-JIS, +# C1 characters are considered the first-byte set of the Japanese encodings, +# so \E)0 should be avoided in and initialization strings. +# +# FILE FORMAT: +# +# The version you are looking at may be in any of three formats: master +# (terminfo with OT capabilities), stock terminfo, or termcap. You can tell +# which by the format given in the header above. +# +# The master format is accepted and generated by the terminfo tools in the +# ncurses suite; it differs from stock (System V-compatible) terminfo only +# in that it admits a group of capabilities (prefixed `OT') equivalent to +# various obsolete termcap capabilities. You can, thus, convert from master +# to stock terminfo simply by filtering with `sed "/OT[^,]*,/s///"'; but if +# you have ncurses `tic -I' is nicer (among other things, it automatically +# outputs entries in a canonical form). +# +# The termcap version is generated automatically from the master version +# using tic -C. This filtering leaves in the OT capabilities under their +# original termcap names. All translated entries fit within the 1023-byte +# string-table limit of archaic termcap libraries except where explicitly +# noted below. Note that the termcap translation assumes that your termcap +# library can handle multiple tc capabilities in an entry. 4.4BSD has this +# capability. Older versions of GNU termcap, through 1.3, do not. +# +# For details on these formats, see terminfo(5) in the ncurses distribution, +# and termcap(5) in the 4.4BSD Unix Programmer's Manual. Be aware that 4.4BSD +# curses has been declared obsolete by the caretakers of the 4.4BSD sources +# as of June 1995; they are encouraging everyone to migrate to ncurses. +# +# Note: unlike some other distributed terminfo files (Novell Unix & SCO's), +# no entry in this file has embedded comments. This is so source translation +# to termcap only has to carry over leading comments. Also, no name field +# contains embedded whitespace (such whitespace confuses rdist). +# +# Further note: older versions of this file were often installed with an editor +# script (reorder) that moved the most common terminal types to the front of +# the file. This should no longer be necessary, as the file is now ordered +# roughly by type frequency with ANSI/VT100 and other common types up front. +# +# Some information has been merged in from terminfo files distributed by +# USL and SCO (see COPYRIGHTS AND OTHER DELUSIONS below). Much information +# comes from vendors who maintain official terminfos for their hardware +# (notably DEC and Wyse). +# +# A detailed change history is included at the end of this file. +# +# FILE ORGANIZATION: +# +# Comments in this file begin with # - they cannot appear in the middle +# of a terminfo/termcap entry. Individual capabilities are commented out by +# placing a period between the colon and the capability name. +# +# The file is divided up into major sections (headed by lines beginning with +# the string "########") and minor sections (beginning with "####"); do +# +# grep "^####" | more +# +# to see a listing of section headings. The intent of the divisions is +# (a) to make it easier to find things, and (b) to order the database so +# that important and frequently-encountered terminal types are near the +# front (so that you'll get reasonable search efficiency even if you don't +# use reorder). Minor sections usually correspond to manufacturers or +# standard terminal classes. Parenthesized words following manufacturer +# names are type prefixes or product line names used by that manufacturers. +# +# HOW TO READ THE ENTRIES: +# +# The first name in an entry is the canonical name for the model or +# type, last entry is a verbose description. Others are mnemonic synonyms for +# the terminal. +# +# Terminal names look like - +# The part to the left of the dash, if a dash is present, describes the +# particular hardware of the terminal. The part to the right may be used +# for flags indicating special ROMs, extra memory, particular terminal modes, +# or user preferences. +# +# All names should be in lower case, for consistency in typing. +# +# The following are conventionally used suffixes: +# -2p Has two pages of memory. Likewise 4p, 8p, etc. +# -am Enable auto-margin. +# -m Monochrome. Suppress color support +# -mc Magic-cookie. Some terminals (notably older Wyses) can +# only support one attribute without magic-cookie lossage. +# Their base entry is usually paired with another that +# uses magic cookies to support multiple attributes. +# -na No arrow keys - termcap ignores arrow keys which are +# actually there on the terminal, so the user can use +# the arrow keys locally. +# -nam No auto-margin - suppress capability +# -nl No labels - suppress soft labels +# -ns No status line - suppress status line +# -rv Terminal in reverse video mode (black on white) +# -s Enable status line. +# -vb Use visible bell () rather than . +# -w Wide - in 132 column mode. +# If a name has multiple suffixes and one is a line height, that one should +# go first. Thus `aaa-30-s-rv' is recommended over `aaa-s-rv'. +# +# Entries with embedded plus signs are designed to be included through use/tc +# capabilities, not used as standalone entries. +# +# To avoid search clashes, some older all-numeric names for terminals have +# been removed (i.e., "33" for the Model 33 Teletype, "2621" for the HP2621). +# All primary names of terminals now have alphanumeric prefixes. +# +# Comments marked "esr" are mostly results of applying the termcap-compiler +# code packaged with ncurses and contemplating the resulting error messages. +# In many cases, these indicated obvious fixes to syntax garbled by the +# composers. In a few cases, I was able to deduce corrected forms for garbled +# capabilities by looking at context. All the information in the original +# entries is preserved in the comments. +# +# In the comments, terminfo capability names are bracketed with <> (angle +# brackets). Termcap capability names are bracketed with :: (colons). +# +# INTERPRETATION OF USER CAPABILITIES +# +# The System V Release 4 and XPG4 terminfo format defines ten string +# capabilities for use by applications, .... In this file, we use +# certain of these capabilities to describe functions which are not covered +# by terminfo. The mapping is as follows: +# +# u9 terminal enquire string (equiv. to ANSI/ECMA-48 DA) +# u8 terminal answerback description +# u7 cursor position request (equiv. to VT100/ANSI/ECMA-48 DSR 6) +# u6 cursor position report (equiv. to ANSI/ECMA-48 CPR) +# +# The terminal enquire string should elicit an answerback response +# from the terminal. Common values for will be ^E (on older ASCII +# terminals) or \E[c (on newer VT100/ANSI/ECMA-48-compatible terminals). +# +# The cursor position request () string should elicit a cursor position +# report. A typical value (for VT100 terminals) is \E[6n. +# +# The terminal answerback description (u8) must consist of an expected +# answerback string. The string may contain the following scanf(3)-like +# escapes: +# +# %c Accept any character +# %[...] Accept any number of characters in the given set +# +# The cursor position report () string must contain two scanf(3)-style +# %d format elements. The first of these must correspond to the Y coordinate +# and the second to the %d. If the string contains the sequence %i, it is +# taken as an instruction to decrement each value after reading it (this is +# the inverse sense from the cup string). The typical CPR value is +# \E[%i%d;%dR (on VT100/ANSI/ECMA-48-compatible terminals). +# +# These capabilities are used by tac(1m), the terminfo action checker soon +# to be distributed with ncurses. +# +# TABSET FILES +# +# All the entries in this file have been edited to assume that the tabset +# files directory is /usr/share/tabset, in conformance with the File Hierarchy +# Standard for Linux and free BSD systems. Some vendors (notably Sun) use +# /usr/lib/tabset or (more recently) /usr/share/lib/tabset. +# +# No curses package we know of uses these files. If their location is an +# issue, you will have to hand-patch the file locations before compiling +# this file. +# +# REQUEST FOR CONTACT INFORMATION AND HISTORICAL MATERIAL: +# +# As the ANSI/ECMA-48 standard and variants take firmer hold, and as +# character-cell terminals are increasingly replaced by X displays, much of +# this file is becoming a historical document (this is part of the reason for +# the new organization, which puts ANSI types, xterm, free-Unix consoles, +# and vt100 up front in confidence that this will catch 95% of new hardware). +# +# For the terminal types still alive, I'd like to have manufacturer's +# contact data (Internet address and/or snail-mail + phone). +# +# I'm also interested in enriching the comments so that the latter portions of +# the file do in fact become a potted history of VDT technology as seen by +# UNIX hackers. Ideally, I'd like the headers for each manufacturer to +# include its live/dead/out-of-the-business status, and for as many +# terminal types as possible to be tagged with information like years +# of heaviest use, popularity, and interesting features. +# +# I'm especially interested in identifying the obscure entries listed under +# `Miscellaneous obsolete terminals, manufacturers unknown' before the tribal +# wisdom about them gets lost. If you know a lot about obscure old terminals, +# please go to the terminfo resource page, grab the UFO file (ufo.ti), and +# eyeball it for things you can identify and describe. +# +# If you have been around long enough to contribute, please read the file +# with this in mind and send me your annotations. +# +# COPYRIGHTS AND OTHER DELUSIONS +# +# The BSD ancestor of this file had a standard Regents of the University of +# California copyright with dates from 1980 to 1993. +# +# Some information has been merged in from a terminfo file SCO distributes. +# It has an obnoxious boilerplate copyright which I'm ignoring because they +# took so much of the content from the ancestral BSD versions of this file +# and didn't attribute it, thereby violating the BSD Regents' copyright. +# +# Not that anyone should care. However many valid functions copyrights may +# serve, putting one on a termcap/terminfo file with hundreds of anonymous +# contributors makes about as much sense as copyrighting a wall-full of +# graffiti -- it's legally dubious, ethically bogus, and patently ridiculous. +# +# This file deliberately has no copyright. It belongs to no one and everyone. +# If you claim you own it, you will merely succeed in looking like a fool. +# Use it as you like. Use it at your own risk. Copy and redistribute freely. +# There are no guarantees anywhere. Svaha! +# + +######## STANDARD AND SPECIAL TYPES +# +# This section describes terminal classes and maker brands that are still +# quite common. +# + +#### Specials +# +# Special "terminals". These are used to label tty lines when you don't +# know what kind of terminal is on it. The characteristics of an unknown +# terminal are the lowest common denominator - they look about like a ti 700. +# + +dumb|80-column dumb tty, + am, + cols#80, + bel=^G, cr=^M, cud1=^J, ind=^J, +unknown|unknown terminal type, + gn, use=dumb, +lpr|printer|line printer, + hc, os, + cols#132, lines#66, + bel=^G, cr=^M, cub1=^H, cud1=^J, ff=^L, ind=^J, +glasstty|classic glass tty interpreting ASCII control characters, + am, + cols#80, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, ht=^I, kbs=^H, + kcub1=^H, kcud1=^J, nel=^M^J, + +#### ANSI.SYS/ISO 6429/ECMA-48 Capabilities +# +# See the end-of-file comment for more on these. +# + +# The IBM PC alternate character set. Plug this into any Intel console entry. +# We use \E[11m for rmacs rather than \E[12m so the string can use the +# ROM graphics for control characters such as the diamond, up- and down-arrow. +# This works with the System V, Linux, and BSDI consoles. It's a safe bet this +# will work with any Intel console, they all seem to have inherited \E[11m +# from the ANSI.SYS de-facto standard. +klone+acs|alternate character set for ansi.sys displays, + acsc=`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~q\304r\362s_t\303u\264v\301w\302x\263y\371z\372{\373|\374}\375~\376.\031-\030\,\021+^P0\333p\304r\304y\363z\362{\343|\330}\234, + rmacs=\E[10m, smacs=\E[11m, + +# Highlight controls corresponding to the ANSI.SYS standard. Most +# console drivers for Intel boxes obey these. Makes the same assumption +# about \E[11m as klone+acs. True ANSI/ECMA-48 would have , +# , but this isn't a documented feature of ANSI.SYS. +klone+sgr|attribute control for ansi.sys displays, + blink=\E[5m, bold=\E[1m, invis=\E[8m, rev=\E[7m, + rmpch=\E[10m, rmso=\E[m, rmul=\E[m, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, + sgr0=\E[0;10m, smpch=\E[11m, smso=\E[7m, smul=\E[4m, + use=klone+acs, + +# Highlight controls corresponding to the ANSI.SYS standard. *All* +# console drivers for Intel boxes obey these. Does not assume \E[11m will +# work; uses \E[12m instead, which is pretty bulletproof but loses you the ACS +# diamond and arrow characters under curses. +klone+sgr-dumb|attribute control for ansi.sys displays (no ESC [ 11 m), + blink=\E[5m, bold=\E[1m, invis=\E[8m, rev=\E[7m, rmso=\E[m, + rmul=\E[m, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%;m, + sgr0=\E[0;10m, smacs=\E[12m, smso=\E[7m, smul=\E[4m, + use=klone+acs, + +# KOI8 (RFC1489) alternate character set +# From: Qing Long , 24 Feb 1996. +klone+koi8acs|alternate character set for ansi.sys displays with KOI8 charset, + acsc=l\202m\204k\203j\205u\207t\206v\210w\211q\200x\201n\212o\213s\214p\216r\217`\004a\237f\234g\232~\225.\037-\036+\020\,\021h\222I\2200\215y\230z\231{\267}L|\274, + rmacs=\E[10m, smacs=\E[11m, + +# ANSI.SYS color control. The setab/setaf caps depend on the coincidence +# between SVr4/XPG4's color numbers and ANSI.SYS attributes. Here are longer +# but equivalent strings that don't rely on that coincidence: +# setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, +# setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, +# The DOS 5 manual asserts that these sequences meet the ISO 6429 standard. +# They match a subset of ECMA-48. +klone+color|color control for ansi.sys and ISO6429-compatible displays, + colors#8, ncv#3, pairs#64, + op=\E[37;40m, setb=\E[4%p1%dm, setf=\E[3%p1%dm, + +# This is better than klone+color, it doesn't assume white-on-black as the +# default color pair, but many `ANSI' terminals don't grok the cap. +ecma+color|color control for ECMA-48-compatible terminals, + colors#8, ncv#3, pairs#64, + op=\E[39;49m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + +# Attribute control for ECMA-48-compatible terminals +ecma+sgr|attribute capabilities for true ECMA-48 terminals, + rmso=\E[27m, rmul=\E[24m, + use=klone+sgr, + +# For comparison, here are all the capabilities implied by the Intel +# Binary Compatibility Standard (level 2) that fit within terminfo. +# For more detail on this rather pathetic standard, see the comments +# near the end of this file. +ibcs2|Intel Binary Compatibility Standard prescriptions, + cbt=\E[Z, clear=\Ec, cub=\E[%p1%dD, cud=\E[%p1%dB, + cuf=\E[%p1%dC, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + dch=\E[%p1%dP, dispc=\E=%p1%dg, ech=\E[%p1%dX, + hpa=\E[%i%p1%dG, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, + indn=\E[%p1%dS, rc=\E7, rin=\E[%p1%dT, rmam=\E[?7l, sc=\E7, + smam=\E[?7h, tbc=\E[g, vpa=\E[%i%p1%dd, + +#### ANSI/ECMA-48 terminals and terminal emulators +# +# See near the end of this file for details on ANSI conformance. +# Don't mess with these entries! Lots of other entries depend on them! +# +# This section lists entries in a least-capable to most-capable order. +# if you're in doubt about what `ANSI' matches yours, try them in that +# order and back off from the first that breaks. + +ansi-mini|any ansi terminal with pessimistic assumptions, + am, + cols#80, it#8, lines#24, + clear=\E[H\E[2J$<50>, cub1=\E[D, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, + ht=^I, + +# ANSI X3.64 from emory!mlhhh (Hugh Hansard) via BRL +# +# The following is an entry for the full ANSI 3.64 (1977). It lacks +# padding, but most terminals using the standard are "fast" enough +# not to require any -- even at 9600 bps. If you encounter problems, +# try including the padding specifications. +# +# Note: the "as" and "ae" specifications are not implemented here, for +# the available termcap documentation does not make clear WHICH alternate +# character set to specify. ANSI 3.64 seems to make allowances for several. +# Please make the appropriate adjustments to fit your needs -- that is +# if you will be using alternate character sets. +# +# There are very few terminals running the full ANSI 3.64 standard, +# so I could only test this entry on one verified terminal (Visual 102). +# I would appreciate the results on other terminals sent to me. +# +# Please report comments, changes, and problems to: +# +# U.S. MAIL: Hugh Hansard +# Box: 22830 +# Emory University +# Atlanta, GA. 30322. +# +# USENET {akgua,msdc,sb1,sb6,gatech}!emory!mlhhh. +# +ansi77|ansi 3.64 standard 1977 version, + am, mir, + cols#80, it#8, lines#24, + bel=^G, clear=\E[;H\E[2J, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, dch1=\E[P, dl1=\E[M$<5*/>, ed=\E[J, el=\E[K, + home=\E[H, ht=^I, il1=\E[L$<5*/>, ind=\ED, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, + kf2=\EOR, kf4=\EOS, khome=\E[H, nel=^M\ED, ri=\EM, + rmir=\E[4l, rmso=\E[m, rmul=\E[m, smir=\E[4h, smso=\E[7m, + smul=\E[4m, + +# Procomm and some other ANSI emulations don't recognize all of the ANSI- +# standard capabilities. This entry deletes , , , , and +# / capabilities, forcing curses to use repetitions of , +# , and . Also deleted and , as QModem up to +# 5.03 doesn't recognize these. Finally, we delete and , which seem +# to confuse many emulators. On the other hand, we can count on these programs +# doing //. Older versions of this entry featured +# , but now seems to be more common under +# ANSI.SYS influence. +# From: Eric S. Raymond Oct 30 1995 +pcansi-m|pcansi-mono|ibm-pc terminal programs claiming to be ansi (mono mode), + am, mir, msgr, + cols#80, it#8, lines#24, + bel=^G, cbt=\E[Z, clear=\E[H\E[J, cr=^M, cub1=\E[D, + cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, + hts=\EH, il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, tbc=\E[2g, + use=klone+sgr-dumb, +pcansi-25-m|pcansi25m|ibm-pc terminal programs with 25 lines (mono mode), + lines#25, use=pcansi-m, +pcansi-33-m|pcansi33m|ibm-pc terminal programs with 33 lines (mono mode), + lines#33, use=pcansi-m, +pcansi-43-m|ansi43m|ibm-pc terminal programs with 43 lines (mono mode), + lines#43, use=pcansi-m, +# The color versions. All PC emulators do color... +pcansi|ibm-pc terminal programs claiming to be ansi, + use=klone+color, use=pcansi-m, +pcansi-25|pcansi25|ibm-pc terminal programs with 25 lines, + lines#25, use=pcansi, +pcansi-33|pcansi33|ibm-pc terminal programs with 33 lines, + lines#33, use=pcansi, +pcansi-43|pcansi43|ibm-pc terminal programs with 43 lines, + lines#43, use=pcansi, + +# ansi-m -- full ANSI X3.64 with ANSI.SYS-compatible attributes, no color. +# If you want pound signs rather than dollars, replace `B' with `A' +# in the , , , and capabilities. +# From: Eric S. Raymond Nov 6 1995 +ansi-m|ansi-mono|ANSI X3.64-1979 terminal with ANSI.SYS compatible attributes, + mc5i, + cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC, + cuu=\E[%p1%dA, dch=\E[%p1%dP, dl=\E[%p1%dM, + ech=\E[%p1%dX, el1=\E[1K, hpa=\E[%i%p1%dG, ht=\E[I, + ich=\E[%p1%d@, il=\E[%p1%dL, indn=\E[%p1%dS, kbs=^H, + kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kich1=\E[L, mc4=\E[4i, mc5=\E[5i, nel=\r\E[S, + rep=%p1%c\E[%p2%{1}%-%db, rin=\E[%p1%dT, s0ds=\E(B, + s1ds=\E)B, s2ds=\E*B, s3ds=\E+B, tbc=\E[2g, + vpa=\E[%i%p1%dd, use=pcansi-m, + +# ansi -- this terminfo expresses the largest subset of X3.64 that will fit in +# standard terminfo. Assumes ANSI.SYS-compatible attributes and color. +# From: Eric S. Raymond Nov 6 1995 +ansi|ansi/pc-term compatible with color, + u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?%[;0123456789]c, + u9=\E[c, + use=ecma+color, use=klone+sgr, use=ansi-m, + +# +# ANSI.SYS entries +# +# This completely describes the sequences specified in the DOS 2.1 ANSI.SYS +# documentation (except for the keyboard key reassignment feature, which +# doen't fit the model well). The klone+acs sequences were valid +# though undocumented. The capability is untested but should work for +# keys F1-F10 (%p1 values outside this range will yield unpredictable results). +# From: Eric S. Raymond Nov 7 1995 +ansi.sys-old|ANSI.SYS under PC-DOS 2.1, + am, mir, msgr, xon, + cols#80, lines#25, + clear=\E[2J, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[k, home=\E[H, + is2=\E[m\E[?7h, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, + khome=^^, pfkey=\E[0;%p1%{58}%+%d;%p2"%s", rc=\E[u, + rmam=\E[?7l, sc=\E[s, smam=\E[?7h, u6=\E[%i%d;%dR, + u7=\E[6n, + use=klone+color, use=klone+sgr, +ansi.sys|ANSI.SYS 3.1 and later versions, + el=\E[K, use=ansi.sys-old, + +# +# Define IBM PC keypad keys for vi as per MS-Kermit while using ANSI.SYS. +# This should only be used when the terminal emulator cannot redefine the keys. +# Since redefining keys with ansi.sys also affects PC-DOS programs, the key +# definitions must be restored. If the terminal emulator is quit while in vi +# or others using /, the keypad will not be defined as per PC-DOS. +# The PgUp and PgDn are prefixed with ESC so that tn3270 can be used on Unix +# (^U and ^D are already defined for tn3270). The ESC is safe for vi but it +# does "beep". ESC ESC i is used for Ins to avoid tn3270 ESC i for coltab. +# Note that is always BS, because PC-dos can tolerate this change. +# Caution: vi is limited to 256 string bytes, longer crashes or weirds out vi. +# Consequently the End keypad key could not be set (it is relatively safe and +# actually useful because it sends ^@ O, which beeps and opens a line above). +ansi.sysk|ansisysk|PC-DOS 3.1 ANSI.SYS with keypad redefined for vi, + is2=U2 PC-DOS 3.1 ANSI.SYS with keypad redefined for vi 9-29-86\n\E[;75;8p, + rmkx=\E[;71;0;71p\E[;72;0;72p\E[;73;0;73p\E[;77;0;77p\E[;80;0;80p\E[;81;0;81p\E[;82;0;82p\E[;83;0;83p, + smkx=\E[;71;30p\E[;72;11p\E[;73;27;21p\E[;77;12p\E[;80;10p\E[;81;27;4p\E[;82;27;27;105p\E[;83;127p, + use=ansi.sys, +# +# Adds ins/del line/character, hence vi reverse scrolls/inserts/deletes nicer. +nansi.sys|nansisys|PC-DOS Public Domain NANSI.SYS, + dch1=\E[1P, dl1=\E[1M, ich1=\E[1@, il1=\E[1L, + is2=U3 PC-DOS Public Domain NANSI.SYS 9-23-86\n, use=ansi.sys, +# +# See ansi.sysk and nansi.sys above. +nansi.sysk|nansisysk|PC-DOS Public Domain NANSI.SYS with keypad redefined for vi, + dch1=\E[1P, dl1=\E[1M, ich1=\E[1@, il1=\E[1L, + is2=U4 PC-DOS Public Domain NANSI.SYS with keypad redefined for vi 9-29-86\n\E[;75;8p, + use=ansi.sysk, + +#### ANSI console types +# + +# This entry is good for the 1.2.13 version of the Linux console driver. +# +# Note: there are numerous broken linux entries out there, which didn't screw +# up BSD termcap but hose ncurses's smarter cursor-movement optimization. +# One common pathology is an incorrect tab length of 4. +# +# *************************************************************************** +# * * +# * WARNING: * +# * Linuxes come with a default keyboard mapping kcbt=^I. This entry, in * +# * response to user requests, assumes kcbt=\E[Z, the ANSI/ECMA reverse-tab * +# * character. Here are the keymap replacement lines that will set this up: * +# * * +# keycode 15 = Tab Tab +# alt keycode 15 = Meta_Tab +# shift keycode 15 = F26 +# string F26 ="\033[Z" +# * * +# * This has to use a key slot which is unfortunate (any unused one will * +# # do, F26 is the higher-numbered one). The change ought to be built * +# * into the kernel tables. * +# * * +# *************************************************************************** +# +# The 1.3.x kernels add color-change capabilities; if yours doesn't have this +# and it matters, turn off . The %02x escape used to implement this is +# not back-portable to SV curses and not supported in ncurses versions before +# 1.9.9. All linux kernels since 1.2.13 (at least) set the screen size +# themselves; this entry assumes that capability. +# +# From: Eric S. Raymond 15 Dec 1995 +linux|linux console, + am, bce, eo, mir, msgr, xenl, xon, + it#8, + bel=^G, civis=\E[?25l, clear=\E[H\E[J, cnorm=\E[?25h, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, + dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, + flash=\E[?5h\E[?5l$<200/>, home=\E[H, hpa=\E[%i%p1%dG, + ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=^J, kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, + kend=\E[4~, kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kspd=^Z, + nel=^M^J, rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, rmso=\E[27m, + rmul=\E[24m, rs1=\Ec, sc=\E7, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, + smir=\E[4h, smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, + u7=\E[6n, u8=\E[?6c, u9=\E[c, vpa=\E[%i%p1%dd, + use=klone+sgr, use=ecma+color, +linux-m|Linux console no color, + colors@, pairs@, + setab@, setaf@, setb@, setf@, use=linux, +linux-c-nc|linux console 1.3.x hack for ncurses only, + ccc, + initc=\E]P%p1%x%p2%02x%p3%02x%p4%02x, oc=\E]R, use=linux, +# From: Dennis Henriksen , 9 July 1996 +linux-c|linux console 1.3.6+, with private palette for each virtual console, + ccc, + colors#8, pairs#64, + initc=\E]P%?%p1%{9}%>%t%p1%{10}%-%p'a'%+%c%e%p1%d%p2%{255}%&%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%p3%{255}%&%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%p4%{255}%&%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;, + oc=\E]R, + use=linux, + +# See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file +linux-nic|linux with ich/ich1 suppressed for non-curses programs, + ich@, ich1@, + use=linux, + +# This assumes you have used setfont(8) to load one of the Linux koi8-r fonts. +linux-koi8|linux with koi8 alternate character set, + use=linux, use=klone+koi8acs, + +# SCO console and SOS-Syscons console for 386bsd +# (scoansi: had unknown capabilities +# :Gc=N:Gd=K:Gh=M:Gl=L:Gu=J:Gv=\072:\ +# :GC=E:GD=B:GH=D:GL=\64:GU=A:GV=\63:GR=C: +# :G1=?:G2=Z:G3=@:G4=Y:G5=;:G6=I:G7=H:G8=<:\ +# :CW=\E[M:NU=\E[N:RF=\E[O:RC=\E[P:\ +# :WL=\E[S:WR=\E[T:CL=\E[U:CR=\E[V:\ +# I renamed GS/GE/HM/EN/PU/PD/RT and added klone+sgr-dumb, based +# on the =\E[12m -- esr) +scoansi|SCO Extended ANSI standard crt, + am, eo, xon, + cols#80, it#8, lines#25, + blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[2J, + cub1=\E[D, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, + ht=^I, ich1=\E[@, il1=\E[L, ind=\E[S, kbs=^H, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[F, kf1=\E[M, + kf10=\E[V, kf2=\E[N, kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, + kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, knp=\E[G, kpp=\E[I, + ri=\E[T, + use=klone+sgr-dumb, + +# This actually describes the generic SVr4 display driver for Intel boxes. +# The isn't documented and therefore may not be reliable. +# From: Eric Raymond Mon Nov 27 19:00:53 EST 1995 +att6386|at386|386at|AT&T WGS 6386 console, + am, bw, eo, xon, + cols#80, it#8, lines#25, + acsc=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[=C, + clear=\E[2J\E[H, cnorm=\E[=1C, cr=^M, cub=\E[%p1%dD, + cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[1M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E[1@, il=\E[%p1%dL, il1=\E[1L, ind=\E[S, + indn=\E[%p1%dS, invis=\E[9m, is2=\E[0;10;39m, kbs=^H, + kcbt=^], kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[P, kend=\E[Y, kf1=\EOP, kf10=\EOY, kf11=\EOZ, + kf12=\EOA, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, + kf7=\EOV, kf8=\EOW, kf9=\EOX, khome=\E[H, kich1=\E[@, + knp=\E[U, kpp=\E[V, krmir=\E0, nel=\r\E[S, rc=\E8, rev=\E[7m, + ri=\E[T, rin=\E[%p1%dT, rmacs=\E[10m, rmso=\E[m, rmul=\E[m, + sc=\E7, + sgr=\E[10m\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p5%t;2%;?%p6%t;1%;%?%p9%t;12%e;10%;%?%p7%t;9%;m, + sgr0=\E[0;10m, smacs=\E[12m, smso=\E[7m, smul=\E[4m, + tbc=\E[2g, vpa=\E[%i%p1%dd, + use=klone+color, +# (pc6300plus: removed ":KM=/usr/lib/ua/kmap.s5:"; renamed BO/EE/CI/CV -- esr) +pc6300plus|AT&T 6300 plus, + am, xon, + cols#80, lines#24, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[=C, + clear=\E[2J\E[H, cnorm=\E[=1C, cr=^M, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, + dch1=\E[1P, dim=\E[2m, dl1=\E[1M, ed=\E[0J, el=\E[0K, + home=\E[H, hts=\EH, ich1=\E[1@, il1=\E[1L, ind=^J, + invis=\E[9m, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOc, kf10=\EOu, kf2=\EOd, kf3=\EOe, + kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\EOk, + nel=^M^J, rev=\E[7m, rmso=\E[m, rmul=\E[m, sgr0=\E[m, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, + +# +# Terminfo entry for the AT&T Unix PC 7300 +# from escape(7) in Unix PC 7300 Manual. +# Somewhat similar to a vt100-am (but different enough +# to redo this from scratch.) +# +# /*************************************************************** +# * +# * FONT LOADING PROGRAM FOR THE UNIX PC +# * +# * This routine loads a font defined in the file ALTFONT +# * into font memory slot #1. Once the font has been loaded, +# * it can be used as an alternative character set. +# * +# * The call to ioctl with the argument WIOCLFONT is the key +# * to this routine. For more information, see window(7) in +# * the PC 7300 documentation. +# ***************************************************************/ +# #include /* needed for strcpy call */ +# #include /* needed for ioctl call */ +# #define FNSIZE 60 /* font name size */ +# #define ALTFONT "/usr/lib/wfont/special.8.ft" /* font file */ +# /* +# * The file /usr/lib/wfont/special.8.ft comes with the +# * standard PC software. It defines a graphics character set +# * similar to that of the Teletype 5425 terminal. To view +# * this or other fonts in /usr/lib/wfont, use the command +# * cfont . For further information on fonts see +# * cfont(1) in the PC 7300 documentation. +# */ +# +# struct altfdata /* structure for alt font data */ +# { +# short altf_slot; /* memory slot number */ +# char altf_name[FNSIZE]; /* font name (file name) */ +# }; +# ldfont() +# { +# int wd; /* window in which altfont will be */ +# struct altfdata altf; +# altf.altf_slot=1; +# strcpy(altf.altf_name,ALTFONT); +# for (wd =1; wd < 12; wd++) { +# ioctl(wd, WIOCLFONT,&altf); +# } +# } +# +# (att7300: added /// from the BSDI entry, +# they're confirmed by the man page for the System V display---esr) +# +att7300|unixpc|pc7300|3b1|s4|AT&T UNIX PC Model 7300, + am, xenl, xon, + cols#80, it#8, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, bold=\E[7m, cbt=\E^I, civis=\E[=C, clear=\E[2J\E[H, + cnorm=\E[=1C, cr=^M, cub=\E[%p1%dD, cud=\E[%p1%dB, + cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, + el=\E[0K, home=\E[H, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, + ind=^J, invis=\E[9m, is1=^O, kBEG=\EBG, kCAN=\ECN, kCPY=\ECP, + kCRT=\ECR, kDC=\EDC, kDL=\EDL, kEND=\EEN, kEOL=\ECI, + kFND=\EFI, kHLP=\EHL, kHOM=\EHM, kIC=\ENJ, kLFT=\EBW, + kMOV=\EMV, kNXT=\ENX, kOPT=\EOT, kPRV=\EPV, kRDO=\ERO, + kRIT=\EFW, kRPL=\ERP, kSAV=\ESV, kUND=\EUD, kbeg=\Ebg, + kbs=^H, kcan=\Ecn, kcbt=\E^I, kclo=\Ecl, kclr=\Ece, + kcmd=\Ecm, kcpy=\Ecp, kcrt=\Ecr, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\Edc, ked=\Ece, kel=\Eci, + kend=\Een, kext=\Eex, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + kf5=\E5, kf6=\E6, kf7=\E7, kf8=\E8, kfnd=\Efi, khlp=\Ehl, + khome=\Ehm, kich1=\Eim, kind=\Erd, kmov=\Emv, kmrk=\Emk, + knp=\Epg, knxt=\Enx, kopn=\Eop, kopt=\Eot, kpp=\EPG, + kprt=\Epr, kprv=\Epv, krdo=\Ero, kref=\Ere, krfr=\Erf, + kri=\Eru, krpl=\Erp, krst=\Ers, ksav=\Esv, kslt=\Esl, + kund=\Eud, nel=\EE, rev=\E[7m, ri=\EM, rmacs=\E[10m, + rmso=\E[m, rmul=\E[m, sgr0=\E[0;10m, smacs=\E[11m, + smso=\E[7m, smul=\E[4m, + +# From: davis@unidata.ucar.edu +# (iris-ansi: added rmam/smam based on init string -- esr) +iris-ansi|iris-ansi-net|IRIS emulating ANSI terminal, + am, + cols#80, it#8, lines#40, + bel=^G, bold=\E[1m, clear=\E[H\E[2J, + cnorm=\E[9/y\E[12/y\E[=6l, cr=^M, cub=\E[%p1%dD, + cub1=\E[D, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, cvvis=\E[10/y\E[=1h\E[=2l\E[=6h, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=\ED, + is2=\E[?1l\E>\E[?7h\E[100g\E[0m\E7\E[r\E8, kDC=\E[P, + kEND=\E[147q, kHOM=\E[143q, kLFT=\E[158q, kPRT=\E[210q, + kRIT=\E[167q, kSPD=\E[218q, kbs=^H, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, + kend=\E[146q, kent=^M, kf1=\E[001q, kf10=\EOQ, kf11=\EOR, + kf12=\EOS, kf2=\E[002q, kf3=\E[003q, kf4=\E[004q, + kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, kf8=\E[008q, + kf9=\EOP, khome=\E[H, kich1=\E[139q, knp=\E[154q, + kpp=\E[150q, kprt=\E[209q, krmir=\E[146q, kspd=\E[217q, + nel=\EE, pfkey=\EP101;%p1%d.y%p2%s\E\\, rc=\E8, + rev=\E[7m, ri=\EM, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, sc=\E7, + sgr0=\E[m, smam=\E[?7h, smso=\E[1;7m, smul=\E[4m, + tbc=\E[3g, +iris-ansi-ap|IRIS ANSI in application-keypad mode, + is2=\E[?1l\E>\E[?7h, kf10=\E[010q, kf11=\E[011q, + kf12=\E[012q, rmkx=\E>, smkx=\E=, + use=iris-ansi, + +# The following is a version of the ibm-pc entry distributed with PC/IX, +# (Interactive Systems' System 3 for the Big Blue), modified by Richard +# McIntosh at UCB/CSM. The :pt: and :uc: have been removed from the original, +# (the former is untrue, and the latter failed under UCB/man); standout and +# underline modes have been added. Note: this entry describes the "native" +# capabilities of the PC monochrome display, without ANY emulation; most +# communications packages (but NOT PC/IX connect) do some kind of emulation. +pcix|PC/IX console, + am, bw, eo, + cols#80, lines#24, + clear=\Ec, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, ed=\E[J, el=\E[K, + home=\E[H, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, + smul=\E[4m, + +# (ibmpcx: this entry used to be known as ibmx. +# It formerly included the following extension capabilities: +# :GC=b:GL=v:GR=t:RT=^J:\ +# :GH=\E[196g:GV=\E[179g:\ +# :GU=\E[193g:GD=\E[194g:\ +# :G1=\E[191g:G2=\E[218g:G3=\E[192g:G4=\E[217g:\ +# :CW=\E[E:NU=\E[F:RF=\E[G:RC=\E[H:\ +# :WL=\E[K:WR=\E[L:CL=\E[M:CR=\E[N:\ +# I renamed GS/GE/WL/WR/CL/CR/PU/PD/HM/EN; also, removed a duplicate +# ":kh=\E[Y:". Added IBM-PC forms characters and highlights, they match +# what was there before. -- esr) +ibmpcx|xenix|ibmx|IBM PC xenix console display, + am, msgr, + cols#80, lines#25, + clear=^L, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, home=\E[H, ich1=\E[@, il1=\E[L, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[d, + kf1=\E[K, kf2=\E[L, kf3=\E[M, kf4=\E[N, khome=\E[Y, knp=\E[e, + kpp=\E[Z, + use=klone+acs, use=klone+sgr, + + +# QNX 4.0 Console +# Michael's original version of this entry had , , +# ; this was so terminfo applications could write the lower +# right corner without triggering a scroll. The ncurses terminfo library can +# handle this case with the capability, and prefers for better +# optimization. Bug: The capability resets attributes. +# From: Michael Hunter 30 Jul 1996 +qnx|qnx4|qnx console, + daisy, km, mir, msgr, xhpa, xt, + colors#8, cols#80, it#4, lines#25, ncv#3, pairs#8, + acsc=l\332m\300k\277j\331q\304x\263u\264t\303n\305v\301w\302O\333a\261o\337s\334, + bel=^G, blink=\E{, bold=\E<, civis=\Ey0, clear=\EH\EJ, + cnorm=\Ey1, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%' '%+%c%p2%' '%+%c, cuu1=\EA, cvvis=\Ey2, + dch1=\Ef, dl1=\EF, ed=\EJ, el=\EK, home=\EH, ht=^I, ich1=\Ee, + il1=\EE, ind=^J, kBEG=\377\356, kCAN=\377\263, + kCMD=\377\267, kCPY=\377\363, kCRT=\377\364, + kDL=\377\366, kEND=\377\301, kEOL=\377\311, + kEXT=\377\367, kFND=\377\370, kHLP=\377\371, + kHOM=\377\260, kIC=\377\340, kLFT=\377\264, + kMOV=\377\306, kMSG=\377\304, kNXT=\377\272, + kOPT=\377\372, kPRT=\377\275, kPRV=\377\262, + kRDO=\377\315, kRES=\377\374, kRIT=\377\266, + kRPL=\377\373, kSAV=\377\307, kSPD=\377\303, + kUND=\377\337, kbeg=\377\300, kcan=\377\243, + kcbt=\377\200, kclo=\377\343, kclr=\377\341, + kcmd=\377\245, kcpy=\377\265, kcrt=\377\305, + kctab=\377\237, kcub1=\377\244, kcud1=\377\251, + kcuf1=\377\246, kcuu1=\377\241, kdch1=\377\254, + kdl1=\377\274, ked=\377\314, kel=\377\310, kend=\377\250, + kent=\377\320, kext=\377\270, kf1=\377\201, + kf10=\377\212, kf11=\377\256, kf12=\377\257, + kf13=\377\213, kf14=\377\214, kf15=\377\215, + kf16=\377\216, kf17=\377\217, kf18=\377\220, + kf19=\377\221, kf2=\377\202, kf20=\377\222, + kf21=\377\223, kf22=\377\224, kf23=\377\333, + kf24=\377\334, kf25=\377\225, kf26=\377\226, + kf27=\377\227, kf28=\377\230, kf29=\377\231, + kf3=\377\203, kf30=\377\232, kf31=\377\233, + kf32=\377\234, kf33=\377\235, kf34=\377\236, + kf35=\377\276, kf36=\377\277, kf37=\377\321, + kf38=\377\322, kf39=\377\323, kf4=\377\204, + kf40=\377\324, kf41=\377\325, kf42=\377\326, + kf43=\377\327, kf44=\377\330, kf45=\377\331, + kf46=\377\332, kf47=\377\316, kf48=\377\317, + kf5=\377\205, kf6=\377\206, kf7=\377\207, kf8=\377\210, + kf9=\377\211, kfnd=\377\346, khlp=\377\350, + khome=\377\240, khts=\377\342, kich1=\377\253, + kil1=\377\273, kind=\377\261, kmov=\377\351, + kmrk=\377\355, kmsg=\377\345, knp=\377\252, + knxt=\377\312, kopn=\377\357, kopt=\377\353, + kpp=\377\242, kprt=\377\255, kprv=\377\302, + krdo=\377\336, kref=\377\354, kres=\377\360, + krfr=\377\347, kri=\377\271, krmir=\377\313, + krpl=\377\362, krst=\377\352, ksav=\377\361, + kslt=\377\247, kspd=\377\335, ktbc=\377\344, + kund=\377\365, mvpa=\E!%p1%02d, op=\ER, + rep=\Eg%p2%' '%+%c%p1%c, rev=\E(, ri=\EI, rmcup=\Eh\ER, + rmso=\E), rmul=\E], rs1=\ER, setb=\E@%p1%Pb%gb%gf%d%d, + setf=\E@%p1%Pf%gb%gf%d%d, + sgr=%?%p1%t\E<%;%p2%t\E[%;%p3%t\E(%;%p4%t\E{%;%p6%t\E<%;, + sgr0=\E}\E]\E>\E), smcup=\Ei, smso=\E(, smul=\E[, + +#### NetBSD consoles +# +# pcvt termcap database entries (corresponding to release 3.31) +# Author's last edit-date: [Fri Sep 15 20:29:10 1995] +# +# (For the terminfo master file, I translated these into terminfo syntax. +# Then I dropped all the pseudo-HP entries. we don't want and can't use +# the :Xs: flag. Then I split :is: into a size-independent and a +# size-dependent . Finally, I added / -- esr) + +# NOTE: because the 386BSD "vi"/"elvis" seems to have a bug if +# both and are specified (an original VT220 +# shows the same buggy behaviour!), has been taken +# out of this entry. for reference, it should be . +pcvtXX|pcvt vt200 emulator (DEC VT220), + am, km, mir, msgr, xenl, + it#8, vt#3, + acsc=llmmkkjjuuttvvwwqqxxnnoosspprr``aaffgg~~..--++\,\,hhII00yyzz, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=\ED, indn=\E[%p1%dS, + is1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kbs=\177, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\E[3~, kf1=\E[17~, kf2=\E[18~, kf3=\E[19~, + kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, + khome=\E[1~, kich1=\E[2~, kll=\E[4~, knp=\E[6~, kpp=\E[5~, + nel=\EE, rc=\E8, rev=\E[7m, rf=/usr/share/tabset/vt100, + ri=\EM, rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, + rs1=\Ec\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr0=\E[m, smacs=\E(0, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + +# NetBSD/FreeBSD vt220 terminal emulator console (pc keyboard & monitor) +# termcap entries for pure VT220-Emulation and 25, 28, 35, 40, 43 and +# 50 lines entries; 80 columns +pcvt25|dec vt220 emulation with 25 lines, + cols#80, lines#25, + is2=\E[1;25r\E[25;1H, use=pcvtXX, +pcvt28|dec vt220 emulation with 28 lines, + cols#80, lines#28, + is2=\E[1;28r\E[28;1H, use=pcvtXX, +pcvt35|dec vt220 emulation with 35 lines, + cols#80, lines#35, + is2=\E[1;35r\E[35;1H, use=pcvtXX, +pcvt40|dec vt220 emulation with 40 lines, + cols#80, lines#40, + is2=\E[1;40r\E[40;1H, use=pcvtXX, +pcvt43|dec vt220 emulation with 43 lines, + cols#80, lines#43, + is2=\E[1;43r\E[43;1H, use=pcvtXX, +pcvt50|dec vt220 emulation with 50 lines, + cols#80, lines#50, + is2=\E[1;50r\E[50;1H, use=pcvtXX, + +# NetBSD/FreeBSD vt220 terminal emulator console (pc keyboard & monitor) +# termcap entries for pure VT220-Emulation and 25, 28, 35, 40, 43 and +# 50 lines entries; 132 columns +pcvt25w|dec vt220 emulation with 25 lines and 132 cols, + cols#132, lines#25, + is2=\E[1;25r\E[25;1H, use=pcvtXX, +pcvt28w|dec vt220 emulation with 28 lines and 132 cols, + cols#132, lines#28, + is2=\E[1;28r\E[28;1H, use=pcvtXX, +pcvt35w|dec vt220 emulation with 35 lines and 132 cols, + cols#132, lines#35, + is2=\E[1;35r\E[35;1H, use=pcvtXX, +pcvt40w|dec vt220 emulation with 40 lines and 132 cols, + cols#132, lines#40, + is2=\E[1;40r\E[40;1H, use=pcvtXX, +pcvt43w|dec vt220 emulation with 43 lines and 132 cols, + cols#132, lines#43, + is2=\E[1;43r\E[43;1H, use=pcvtXX, +pcvt50w|dec vt220 emulation with 50 lines and 132 cols, + cols#132, lines#50, + is2=\E[1;50r\E[50;1H, use=pcvtXX, + +# NetBSD/x68k console vt200 emulator. This port runs on a 68K machine +# manufactured by Sharp for the Japenese market. +# From Minoura Makoto , 12 May 1996 +x68k|x68k-ite|NetBSD/x68k ITE, + cols#96, lines#32, + kclr=\E[9~, khlp=\E[28~, use=vt220, + +#### FreeBSD console entries +# +# From: Andrey Chernov 29 Mar 1996 +# Andrey Chernov maintains the FreeBSD termcap distributions. +# +# Note: Users of FreeBSD 2.1.0 and older versions must either upgrade +# or comment out the :cb: capability in the console entry. +# +# Alexander Lukyanov reports: +# I have seen FreeBSD-2.1.5R... The old el1 bug changed, but it is still there. +# Now el1 clears not only to the line beginning, but also a large chunk +# of previous line. But there is another bug - ech does not work at all. +# + +# for syscons +# common entry without semigraphics +# Bug: The capability resets attributes. +# Bug? The ech and el1 attributes appear to move the cursor in some cases; for +# instance el1 does if the cursor is moved to the right margin first. Removed +# by T.Dickey 97/5/3 (ech=\E[%p1%dX, el1=\E[1K) +cons25w|ansiw|ansi80x25-raw|freebsd console (25-line raw mode), + am, bce, bw, eo, msgr, npc, + colors#8, cols#80, it#8, lines#25, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, + cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dim=\E[30;1m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, + home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, + indn=\E[%p1%dS, kb2=\E[E, kbs=^H, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, kend=\E[F, + kf1=\E[M, kf10=\E[V, kf11=\E[W, kf12=\E[X, kf2=\E[N, + kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, + kf9=\E[U, khome=\E[H, kich1=\E[L, knp=\E[G, kpp=\E[I, + nel=\E[E, op=\E[x, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, + rmso=\E[m, rs1=\E[x\E[m\Ec, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, sgr0=\E[m, smso=\E[7m, vpa=\E[%i%p1%dd, +cons25|ansis|ansi80x25|freebsd console (25-line ansi mode), + acsc=l\332m\300k\277j\331u\264t\303v\301w\302q\304x\263n\305`\004a\260f\370g\361~\371.\031-\030h\261I^U0\333y\363z\362, + use=cons25w, +cons25-m|ansis-mono|ansi80x25-mono|freebsd console (25-line mono ansi mode), + colors@, pairs@, + bold@, dim@, op@, rmul=\E[m, setab@, setaf@, smul=\E[4m, use=cons25, +cons30|ansi80x30|freebsd console (30-line ansi mode), + lines#30, use=cons25, +cons30-m|ansi80x30-mono|freebsd console (30-line mono ansi mode), + lines#30, use=cons25-m, +cons43|ansi80x43|freebsd console (43-line ansi mode), + lines#43, use=cons25, +cons43-m|ansi80x43-mono|freebsd console (43-line mono ansi mode), + lines#43, use=cons25-m, +cons50|ansil|ansi80x50|freebsd console (50-line ansi mode), + lines#50, use=cons25, +cons50-m|ansil-mono|ansi80x50-mono|freebsd console (50-line mono ansi mode), + lines#50, use=cons25-m, +cons60|ansi80x60|freebsd console (60-line ansi mode), + lines#60, use=cons25, +cons60-m|ansi80x60-mono|freebsd console (60-line mono ansi mode), + lines#60, use=cons25-m, +cons25r|pc3r|ibmpc3r|cons25-koi8-r|freebsd console w/koi8-r cyrillic, + acsc=q\200x\201m\204v\211j\205t\206n\212u\207l\202w\210k\203y\230z\231f\234~\225a\220h\221`\004.\031-\030I^U0\215, + use=cons25w, +cons25r-m|pc3r-m|ibmpc3r-mono|cons25-koi8r-m|freebsd console w/koi8-r cyrillic (mono), + colors@, pairs@, + op@, rmul=\E[m, setab@, setaf@, smul=\E[4m, use=cons25r, +cons50r|cons50-koi8r|freebsd console w/koi8-r cyrillic (50 lines), + lines#50, use=cons25r, +cons50r-m|cons50-koi8r-m|freebsd console w/koi8-r cyrillic (50-line mono), + lines#50, use=cons25r-m, +cons60r|cons60-koi8r|freebsd console w/koi8-r cyrillic (60 lines), + lines#60, use=cons25r, +cons60r-m|cons60-koi8r-m|freebsd console w/koi8-r cyrillic (60-line mono), + lines#60, use=cons25r-m, +# ISO 8859-1 FreeBSD console +cons25l1|cons25-iso8859|freebsd console w/iso 8859-1 chars, + acsc=l\215m\216k\214j\213u\226t\225v\227w\230q\222x\231n\217o\220s\224p\221r\223`\201a\202f\207g\210~\237.\031-\030+\253\,\273I\247y\232z\233, + use=cons25w, +cons25l1-m|cons25-iso-m|freebsd console w/iso 8859-1 chars (mono), + colors@, pairs@, + bold@, dim@, op@, rmul=\E[m, setab@, setaf@, smul=\E[4m, use=cons25l1, +cons50l1|cons50-iso8859|freebsd console w/iso 8859-1 chars (50 lines), + lines#50, use=cons25l1, +cons50l1-m|cons50-iso-m|freebsd console w/iso 8859-1 chars (50-line mono), + lines#50, use=cons25l1-m, +cons60l1|cons60-iso|freebsd console w/iso 8859-1 chars (60 lines), + lines#60, use=cons25l1, +cons60l1-m|cons60-iso-m|freebsd console w/iso 8859-1 chars (60-line mono), + lines#60, use=cons25l1-m, + +#### 386BSD and BSD/OS Consoles +# + +# This was the original 386BSD console entry (I think). +# Some places it's named oldpc3|oldibmpc3. +# From: Alex R.N. Wetmore +origpc3|origibmpc3|IBM PC 386BSD Console, + am, bw, eo, xon, + cols#80, lines#25, + acsc=l\332q\304k\277x\263j\331m\300w\302u\264v\301t\303n\305, + bold=\E[7m, clear=\Ec, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, ed=\E[J, el=\E[K, + home=\E[H, ind=\E[S, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, khome=\E[Y, ri=\E[T, rmso=\E[1;0x\E[2;7x, + rmul=\E[1;0x\E[2;7x, sgr0=\E[m\E[1;0x\E[2;7x, + smso=\E[1;7x\E[2;0x, smul=\E[1;7x\E[2;0x, + +# description of BSD/386 console emulator in version 1.0 (supplied by BSDI) +oldpc3|oldibmpc3|old IBM PC BSD/386 Console, + km, + lines#25, + bel=^G, bold=\E[=15F, cr=^M, cud1=^J, dim=\E[=8F, dl1=\E[M, + ht=^I, il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kich1=\E[L, kll=\E[F, + knp=\E[G, kpp=\E[I, nel=^M^J, sgr0=\E[=R, + +# Description of BSD/OS console emulator in version 1.1, 2.0, 2.1 +# Note, the emulator supports many of the additional console features +# listed in the iBCS2 (e.g. character-set selection) though not all +# are described here. This entry really ought to be upgraded. +# Also note, the console will also work with fewer lines after doing +# "stty rows NN", e.g. to use 24 lines. +# (Color support from Kevin Rosenberg , 2 May 1996) +# Bug: The capability resets attributes. +bsdos|BSD/OS console, + am, bw, eo, km, xon, + colors#8, cols#80, it#8, lines#25, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\Ec, cr=^M, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dim=\E[=8F, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, il=\E[%p1%dL, + il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, khome=\E[H, kich1=\E[L, kll=\E[F, knp=\E[G, + kpp=\E[I, nel=^M^J, op=\E[x, rc=\E8, rev=\E[7m, rmso=\E[0m, + sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[0m, + smso=\E[7m, +bsdos-bold|IBM PC BSD/386 Console with bold instead of underline, + rmul=\E[0m, smul=\E[1m, + use=bsdos, + +# If you are BSDI, you want the following entries, for the moment. +# In release 2.0 they will probably phase out the pc3 and ibmpc3 names +pc3|IBM PC BSD/386 Console, + use=bsdos, +ibmpc3|pc3-bold|IBM PC BSD/386 Console with bold instead of underline, + smul=\E[1m, + use=bsdos-bold, + +#### DEC VT100 and compatibles +# +# DEC terminals from the vt100 forward (and the vt52, way obsolete but still +# the basis of some emulations) are collected here. Older DEC terminals and +# micro consoles can be found in the `obsolete' section. More details on +# the relationship between the VT100 and ANSI X3.64/ISO 6429/ECMA-48 may be +# found near the end of this file. +# +# Except where noted, these entries are DEC's official terminfos. +# Contact Bill Hedberg of Terminal Support +# Engineering for more information. Updated terminfos and termcaps +# are kept available at ftp://gatekeeper.dec.com/pub/DEC/termcaps. +# +# In October 1995 DEC sold its terminals business, including the VT and Dorio +# line and trademark, to SunRiver Data Systems. +# +# (The , , and capabilities aren't in DEC's official +# entry -- esr) + +vt52|dec vt52, + cols#80, it#8, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, clear=\EH\EJ, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EK, home=\EH, ht=^I, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, nel=^M^J, ri=\EI, rmacs=\EG, smacs=\EF, + +# NOTE: Any VT100 emulation, whether in hardware or software, almost +# certainly includes what DEC called the `Level 1 editing extension' codes; +# only the very oldest VT100s lacked these and there probably aren't any of +# those left alive. To capture these, use one of the VT102 entries. +# +# Note that the glitch in vt100 is not quite the same as on the Concept, +# since the cursor is left in a different position while in the +# weird state (concept at beginning of next line, vt100 at end +# of this line) so all versions of vi before 3.7 don't handle +# right on vt100. The correct way to handle is when +# you output the char in column 80, immediately output CR LF +# and then assume you are in column 1 of the next line. If +# is on, am should be on too. +# +# I assume you have smooth scroll off or are at a slow enough baud +# rate that it doesn't matter (1200? or less). Also this assumes +# that you set auto-nl to "on", if you set it off use vt100-nam +# below. +# +# The padding requirements listed here are guesses. It is strongly +# recommended that xon/xoff be enabled, as this is assumed here. +# +# The vt100 uses and rather than // because the +# tab settings are in non-volatile memory and don't need to be +# reset upon login. Also setting the number of columns glitches +# the screen annoyingly. You can type "reset" to get them set. +# +# Here's a diagram of the VT100 keypad keys with their bindings. +# The top line is the name of the key (some DEC keyboards have the keys +# labelled somewhat differently, like GOLD instead of PF1, but this is +# the most "official" name). The second line is the escape sequence it +# generates in Application Keypad mode (where "$" means the ESC +# character). The third line contains two items, first the mapping of +# the key in terminfo, and then in termcap. +# _______________________________________ +# | PF1 | PF2 | PF3 | PF4 | +# | $OP | $OQ | $OR | $OS | +# |_kf1__k1_|_kf2__k2_|_kf3__k3_|_kf4__k4_| +# | 7 8 9 - | +# | $Ow | $Ox | $Oy | $Om | +# |_kf9__k9_|_kf10_k;_|_kf0__k0_|_________| +# | 4 | 5 | 6 | , | +# | $Ot | $Ou | $Ov | $Ol | +# |_kf5__k5_|_kf6__k6_|_kf7__k7_|_kf8__k8_| +# | 1 | 2 | 3 | | +# | $Oq | $Or | $Os | enter | +# |_ka1__K1_|_kb2__K2_|_ka3__K3_| $OM | +# | 0 | . | | +# | $Op | $On | | +# |___kc1_______K4____|_kc3__K5_|_kent_@8_| +# +# And here, for those of you with orphaned VT100s lacking documentation, is +# a description of the soft switches invoked when you do `Set Up'. +# +# Scroll 0-Jump Shifted 3 0-# +# | 1-Smooth | 1-British pound sign +# | Autorepeat 0-Off | Wrap Around 0-Off +# | | 1-On | | 1-On +# | | Screen 0-Dark Bkg | | New Line 0-Off +# | | | 1-Light Bkg | | | 1-On +# | | | Cursor 0-Underline | | | Interlace 0-Off +# | | | | 1-Block | | | | 1-On +# | | | | | | | | +# 1 1 0 1 1 1 1 1 0 1 0 0 0 0 1 0 <--Standard Settings +# | | | | | | | | +# | | | Auto XON/XOFF 0-Off | | | Power 0-60 Hz +# | | | 1-On | | | 1-50 Hz +# | | Ansi/VT52 0-VT52 | | Bits Per Char. 0-7 Bits +# | | 1-ANSI | | 1-8 Bits +# | Keyclick 0-Off | Parity 0-Off +# | 1-On | 1-On +# Margin Bell 0-Off Parity Sense 0-Odd +# 1-On 1-Even +# +# The following SET-UP modes are assumed for normal operation: +# ANSI_MODE AUTO_XON/XOFF_ON NEWLINE_OFF 80_COLUMNS +# WRAP_AROUND_ON JUMP_SCROLL_OFF +# Other SET-UP modes may be set for operator convenience or communication +# requirements; I recommend +# AUTOREPEAT_ON BLOCK_CURSOR MARGIN_BELL_OFF SHIFTED_3_# +# Unless you have a graphics add-on such as Digital Engineering's VT640 +# (and even then, whenever it can be arranged!) you should set +# INTERLACE_OFF +# +# (I added / based on the init string, also -- esr) +vt100|vt100-am|dec vt100 (w/advanced video), + am, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, + cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, + enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ind=^J, ka1=\EOq, + ka3=\EOs, kb2=\EOr, kbs=^H, kc1=\EOp, kc3=\EOn, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, kf0=\EOy, + kf1=\EOP, kf10=\EOx, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOt, + kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, rc=\E8, + rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, + rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, + smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, +vt100nam|vt100-nam|vt100 no automargins, + am@, xenl@, use=vt100-am, + +# Ordinary vt100 in 132 column ("wide") mode. +vt100-w|vt100-w-am|dec vt100 132 cols (w/advanced video), + cols#132, lines#24, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=vt100-am, +vt100-w-nam|vt100-nam-w|dec vt100 132 cols (w/advanced video no automargin), + cols#132, lines#14, vt@, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=vt100-nam, + +# vt100 with no advanced video. +vt100-nav|vt100 without advanced video option, + xmc#1, + blink@, bold@, rev@, rmso=\E[m, rmul@, sgr@, sgr0@, smso=\E[7m, + smul@, + use=vt100, +vt100-nav-w|vt100-w-nav|dec vt100 132 cols 14 lines (no advanced video option), + cols#132, lines#14, use=vt100-nav, + +# vt100 with one of the 24 lines used as a status line. +# We put the status line on the top. +vt100-s|vt100-s-top|vt100-top-s|vt100 for use with top sysline, + eslok, hs, + lines#23, + clear=\E[2;1H\E[J$<50>, csr=\E[%i%i%p1%d;%p2%dr, + cup=\E[%i%p1%{1}%+%d;%p2%dH$<5>, dsl=\E7\E[1;24r\E8, + fsl=\E8, home=\E[2;1H, is2=\E7\E[2;24r\E8, + tsl=\E7\E[1;%p1%dH\E[1K, use=vt100-am, + +# Status line at bottom. +# Clearing the screen will clobber status line. +vt100-s-bot|vt100-bot-s|vt100 for use with bottom sysline, + eslok, hs, + lines#23, + dsl=\E7\E[1;24r\E8, fsl=\E8, is2=\E[1;23r\E[23;1H, + tsl=\E7\E[24;%p1%dH\E[1K, + use=vt100-am, + +# Most of the `vt100' emulators out there actually emulate a vt102 +# This entry (or vt102-nsgr) is probably the right thing to use for +# these. +vt102|dec vt102, + mir, + dch1=\E[P, dl1=\E[M, il1=\E[L, rmir=\E[4l, smir=\E[4h, use=vt100, +vt102-w|dec vt102 in wide mode, + lines#132, + rs3=\E[?3h, use=vt102, + +# Many brain-dead PC comm programs that pretend to be `vt100-compatible' +# fail to interpret the ^O and ^N escapes properly. Symptom: the +# string in the canonical vt100 entry above leaves the screen littered +# with little snowflake or star characters (IBM PC ROM character \017 = ^O) +# after highlight turnoffs. This entry should fix that, and even leave +# ACS support working, at the cost of making multiple-highlight changes +# slightly more expensive. +# From: Eric S. Raymond July 22 1995 +vt102-nsgr|vt102 no sgr (use if you see snowflakes after highlight changes), + sgr@, sgr0=\E[m, + use=vt102, + +# VT125 Graphics CRT. Clear screen also erases graphics +vt125|vt125 graphics terminal, + clear=\E[H\E[2J\EPpS(E)\E\\$<50>, use=vt100, + +# This isn't a DEC entry, it came from University of Wisconsin. +# (vt131: I added / based on the init string, also -- esr) +vt131|dec vt131, + am, xenl, + cols#80, it#8, lines#24, vt#3, + bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, + clear=\E[;H\E[2J$<50/>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=^J, cuf1=\E[C$<2/>, + cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<2/>, + ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, ht=^I, + is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, nel=^M^J, rc=\E8, rev=\E[7m$<2/>, ri=\EM$<5/>, + rmam=\E[?7h, rmkx=\E[?1l\E>, rmso=\E[m$<2/>, + rmul=\E[m$<2/>, + rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr0=\E[m$<2/>, smam=\E[?7h, smkx=\E[?1h\E=, + smso=\E[7m$<2/>, smul=\E[4m$<2/>, + +# vt132 - like vt100 but slower and has ins/del line and such. +# I'm told that / are backwards in the terminal from the +# manual and from the ANSI standard, this describes the actual +# terminal. I've never actually used a vt132 myself, so this +# is untested. +# +vt132|DEC vt132, + xenl, + dch1=\E[P$<7>, dl1=\E[M$<99>, il1=\E[L$<99>, ind=\n$<30>, + ip=$<7>, rmir=\E[4h, smir=\E[4l, + use=vt100, + +# vt220: +# This vt220 description maps F5--F9 to the second block of function keys +# at the top of the keyboard. The "DO" key is used as F10 to avoid conflict +# with the key marked (ESC) on the vt220. See vt220d for an alternate mapping. +# PF1--PF4 are used as F1--F4. +# +vt220|vt200|DEC VT220 in vt100 emulation mode, + am, mir, xenl, xon, + cols#80, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, civis=\E[?25l, + clear=\E[H\E[2J$<50>, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P, + dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, + if=/usr/share/tabset/vt100, il1=\E[L, ind=\ED$<20/>, + is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\EOP, + kf10=\E[29~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[17~, + kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, + khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, rc=\E8, + rev=\E[7m$<2>, rf=/usr/share/tabset/vt100, + ri=\EM$<14/>, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, + rmso=\E[27m, rmul=\E[24m, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, + smso=\E[7m, smul=\E[4m, +vt220-w|vt200-w|DEC vt220 in wide mode, + cols#132, + rs3=\E[?3h, use=vt220, + +# +# vt220d: +# This vt220 description regards F6--F10 as the second block of function keys +# at the top of the keyboard. This mapping follows the description given +# in the VT220 Programmer Reference Manual and agrees with the labeling +# on some terminals that emulate the vt220. There is no support for an F5. +# See vt220 for an alternate mapping. +# +vt220d|DEC VT220 in vt100 mode with DEC function key labeling, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, kf5@, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + use=vt220, + +vt220-nam|v200-nam|VT220 in vt100 mode with no auto margins, + am@, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h, use=vt220, + +vt220-8|dec vt220 8 bit terminal, + am, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, + flash=\E[?5h$<200/>\E[?5l, home=\E[H, ht=^I, hts=\EH, + ich=\E[%p1%d@, if=/usr/share/tabset/vt100, + il=\E[%p1%dL, il1=\E[L, ind=\ED, + is2=\E[?7h\E[>\E[?1h\E F\E[?4l, kbs=^H, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, + kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\EOQ, + kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, + khome=\E[H, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, krdo=\E[29~, + kslt=\E[4~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, mc0=\E[i, + mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmso=\E[27m, + rmul=\E[24m, rs1=\E[?3l, sc=\E7, sgr0=\E[m, smacs=^N, + smam=\E[?7h, smir=\E[4h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + +# This was DEC's vt320. Use the purpose-built one below instead +#vt320|DEC VT320 in vt100 emulation mode, +# use=vt220, + +# +# Use v320n for SCO's LYRIX. Otherwise, use Adam Thompson's vt320-nam. +# +vt320nam|v320n|DEC VT320 in vt100 emul. mode with NO AUTO WRAP mode, + am@, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h, use=vt220, + +# These entries are not DEC's official ones, they were purpose-built for the +# VT320. Here are the designer's notes: +# is end on a PC kbd. Actually 'select' on a VT. Mapped to +# 'Erase to End of Field'... since nothing seems to use 'end' anyways... +# khome is Home on a PC kbd. Actually 'FIND' on a VT. +# Things that use usually use tab anyways... and things that don't use +# tab usually use instead... +# kprv is same as tab - Backtab is useless... +# I left out because of its RIDICULOUS complexity, +# and the resulting fact that it causes the termcap translation of the entry +# to SMASH the 1k-barrier... +# From: Adam Thompson Sept 10 1995 +# (vt320: uncommented --esr) +vt320|vt300|dec vt320 7 bit terminal, + am, eslok, hs, mir, msgr, xenl, + cols#80, lines#24, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, fsl=\E[0$}, + home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, + il1=\E[L, ind=\ED, + is2=\E>\E[?3l\E[?4l\E[5?l\E[?7h\E[?8h\E[1;24r\E[24;1H, + ka1=\EOw, ka3=\EOy, kb2=\EOu, kbs=\177, kc1=\EOq, kc3=\EOs, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\E[3~, kel=\E[4~, kent=\EOM, kf1=\EOP, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, knp=\E[6~, knxt=^I, kpp=\E[5~, + kprv=\E[Z, kslt=\E[4~, mc0=\E[i, mc4=\E[?4i, mc5=\E[?5i, + nel=\EE, rc=\E8, rev=\E[7m, rf=/usr/share/tabset/vt300, + ri=\EM, rmacs=\E(B, rmam=\E[?7l, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs2=\E>\E[?3l\E[?4l\E[5?l\E[?7h\E[?8h\E[1;24r\E[24;1H, + sc=\E7, sgr0=\E[m, smacs=\E(0, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[1$}\E[H\E[K, +vt320-nam|vt300-nam|dec vt320 7 bit terminal with no am to make SAS happy, + am@, + is2=\E>\E[?3l\E[?4l\E[5?l\E[?7l\E[?8h\E[1;24r\E[24;1H, + rs2=\E>\E[?3l\E[?4l\E[5?l\E[?7l\E[?8h\E[1;24r\E[24;1H, + use=vt320, +# We have to init 132-col mode, not 80-col mode. +vt320-w|vt300-w|dec vt320 wide 7 bit terminal, + cols#132, wsl#132, + is2=\E>\E[?3h\E[?4l\E[5?l\E[?7h\E[?8h\E[1;24r\E[24;1H, + rs2=\E>\E[?3h\E[?4l\E[5?l\E[?7h\E[?8h\E[1;24r\E[24;1H, + use=vt320, +vt320-w-nam|vt300-w-nam|dec vt320 wide 7 bit terminal with no am, + am@, + is2=\E>\E[?3h\E[?4l\E[5?l\E[?7l\E[?8h\E[1;24r\E[24;1H, + rs2=\E>\E[?3h\E[?4l\E[5?l\E[?7l\E[?8h\E[1;24r\E[24;1H, + use=vt320-w, + +# VT330 and VT340 -- These are ReGIS and SIXEL graphics terminals +# which are pretty much a superset of the VT320. They have the +# host writable status line, yet another different DRCS matrix size, +# and such, but they add the DEC Technical character set, Multiple text +# pages, selectable length pages, and the like. The difference between +# the vt330 and vt340 is that the latter has only 2 planes and a monochrome +# monitor, the former has 4 planes and a color monitor. These terminals +# support VT131 and ANSI block mode, but as with much of these things, +# termcap/terminfo doesn't deal with these features. +# +# Note that this entry is are set up in what was the standard way for GNU +# Emacs v18 terminal modes to deal with the cursor keys in that the arrow +# keys were switched into application mode at the same time the numeric pad +# is switched into application mode. This changes the definitions of the +# arrow keys. Emacs v19 is smarter and mines its keys directly out of +# your termcap or terminfo entry, +# +# From: Daniel Glasser , 13 Oct 1993 +# (vt340: string capability "sb=\E[M" corrected to "sr"; +# also, added / based on the init string -- esr) +vt340|dec-vt340|vt330|dec-vt330|dec vt340 graphics terminal with 24 line page, + am, eslok, hs, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + blink=\E[5m, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[J, + cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[?25h, dch=\E[%p1%dP, + dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J, el=\E[K, + flash=\E[?5h\E[?5l$<200/>, fsl=\E[$}, home=\E[H, ht=^I, + hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, + is2=\E<\E F\E>\E[?1h\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, + lf3=pf3, lf4=pf4, nel=^M\ED, rc=\E8, rev=\E[7m, + rf=/usr/share/tabset/vt300, ri=\EM, rmacs=^O, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, + rmul=\E[24m, rs1=\E[?3l, sc=\E7, sgr0=\E[m, smacs=^N, + smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, tsl=\E[2$~\E[1$}\E[1;%dH, + +# DEC doesn't supply a vt400 description, so we add Daniel Glasser's +# (originally written with vt420 as its primary name, and usable for it). +# +# VT400/420 -- This terminal is a superset of the vt320. It adds the multiple +# text pages and long text pages with selectable length of the vt340, along +# with left and right margins, rectangular area text copy, fill, and erase +# operations, selected region character attribute change operations, +# page memory and rectangle checksums, insert/delete column, reception +# macros, and other features too numerous to remember right now. TERMCAP +# can only take advantage of a few of these added features. +# +# Note that this entry is are set up in what was the standard way for GNU +# Emacs v18 terminal modes to deal with the cursor keys in that the arrow +# keys were switched into application mode at the same time the numeric pad +# is switched into application mode. This changes the definitions of the +# arrow keys. Emacs v19 is smarter and mines its keys directly out of +# your termcap entry, +# +# From: Daniel Glasser , 13 Oct 1993 +# (vt400: string capability ":sb=\E[M:" corrected to ":sr=\E[M:"; +# also, added / based on the init string -- esr) +vt400|vt400-24|dec-vt400|dec vt400 24x80 column autowrap, + am, eslok, hs, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J$<10/>, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J$<10/>, + el=\E[K$<4/>, flash=\E[?5h\E[?5l$<200/>, fsl=\E[$}, + home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=\ED, + is2=\E<\E F\E>\E[?1h\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, + lf3=pf3, lf4=pf4, nel=^M\ED, rc=\E8, rev=\E[7m, + rf=/usr/share/tabset/vt300, ri=\EM, rmacs=^O, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, + rmul=\E[24m, rs1=\E<\E[?3l\E[!p\E[?7h, sc=\E7, sgr0=\E[m, + smacs=^N, smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[2$~\E[1$}\E[1;%dH, + +# (vt420: I removed , it collided with . I also restored +# a missing -- esr) +vt420|DEC VT420, + am, mir, xenl, xon, + cols#80, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[2J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P, + dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, + if=/usr/share/tabset/vt300, il1=\E[L, ind=\ED, + is2=\E[1;24r\E[24;1H, is3=\E[?67h\E[64;1"p, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kf1=\EOP, kf10=\E[29~, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, + kf9=\E[21~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + kslt=\E[4~, rc=\E8, rev=\E[7m$<2>, + rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B$<4>, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, + rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + rmso=\E[m, rmul=\E[m, rs3=\E[?67h\E[64;1"p, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, + smkx=\E=, smso=\E[7m, smul=\E[4m, + +# +# DECUDK +# if (key < 16) then value = key; +# else if (key < 21) then value = key + 1; +# else if (key < 25) then value = key + 2; +# else if (key < 27) then value = key + 3; +# else if (key < 30) then value = key + 4; +# else value = key + 5; +# +vt420pc|DEC VT420 w/PC keyboard, + kdch1=\177, kend=\E[4~, kf1=\E[11~, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[11;2~, kf14=\E[12;2~, + kf15=\E[13;2~, kf16=\E[14;2~, kf17=\E[15;2~, + kf18=\E[17;2~, kf19=\E[18;2~, kf2=\E[12~, kf20=\E[19;2~, + kf21=\E[20;2~, kf22=\E[21;2~, kf23=\E[23;2~, + kf24=\E[24;2~, kf25=\E[23~, kf26=\E[24~, kf27=\E[25~, + kf28=\E[26~, kf29=\E[28~, kf3=\E[13~, kf30=\E[29~, + kf31=\E[31~, kf32=\E[32~, kf33=\E[33~, kf34=\E[34~, + kf35=\E[35~, kf36=\E[36~, kf37=\E[23;2~, kf38=\E[24;2~, + kf39=\E[25;2~, kf4=\E[14~, kf40=\E[26;2~, kf41=\E[28;2~, + kf42=\E[29;2~, kf43=\E[31;2~, kf44=\E[32;2~, + kf45=\E[33;2~, kf46=\E[34;2~, kf47=\E[35;2~, + kf48=\E[36;2~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[H, + pctrm=USR_TERM\:vt420pcdos\:, + pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%>%t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+%d/%p2%s\E\\, use=vt420, + +vt420pcdos|DEC VT420 w/PC for DOS Merge, + lines#25, + dispc=%?%p2%{19}%=%t\E\023\021%e%p2%{32}%<%t\E%p2%c%e%p2%{127}%=%t\E\177%e%p2%c%;, + pctrm@, + rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr@, + sgr0=\E[m, smsc=\E[?1;2r\E[34h, + use=vt420pc, + +vt420f|DEC VT420 with VT kbd; VT400 mode; F1-F5 used as Fkeys, + kdch1=\177, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[H, lf1=\EOP, lf2=\EOQ, lf3=\EOR, lf4=\EOS, + use=vt420, + +vt510|DEC VT510, + use=vt420, +vt510pc|DEC VT510 w/PC keyboard, + use=vt420pc, +vt510pcdos|DEC VT510 w/PC for DOS Merge, + use=vt420pcdos, + +# VT520/VT525 +# +# The VT520 is a monochrome text terminal capable of managing up to +# four independent sessions in the terminal. It has multiple ANSI +# emulations (VT520, VT420, VT320, VT220, VT100, VT PCTerm, SCO Console) +# and ASCII emulations (WY160/60, PCTerm, 50/50+, 150/120, TVI 950, +# 925 910+, ADDS A2). This terminfo data is for the ANSI emulations only. +# +# Terminal Set-Up is entered by pressing [F3], [Caps Lock]/[F3] or +# [Alt]/[Print Screen] depending upon which keyboard and which +# terminal mode is being used. If Set-Up has been disabled or +# assigned to an unknown key, Set-Up may be entered by pressing +# [F3] as the first key after power up, regardless of keyboard type. +# (vt520: I added / based on the init string, also -- esr) +vt520|DEC VT520, + am, mir, xenl, xon, + cols#80, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[2J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P, + dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, + if=/usr/share/tabset/vt300, il1=\E[L, ind=\ED, + is2=\E[1;24r\E[24;1H, is3=\E[?67h\E[64;1"p, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kf0=\E[29~, kf1=\EOP, kf10=\E[29~, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, + kf8=\E[20~, kf9=\E[21~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, + kpp=\E[5~, kslt=\E[4~, + pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%>%t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+%d/%p2%s\E\\, + rc=\E8, rev=\E[7m$<2>, rf=/usr/share/tabset/vt300, + ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, + rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + rmso=\E[m, rmul=\E[m, rs3=\E[?67h\E[64;1"p, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, + smso=\E[7m, smul=\E[4m, + +# (vt525: I added / based on the init string; +# removed =\E[m, =\E[m, added -- esr) +vt525|DEC VT525, + am, mir, xenl, xon, + cols#80, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[2J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P, + dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, + if=/usr/share/tabset/vt300, il1=\E[L, ind=\ED, + is2=\E[1;24r\E[24;1H, is3=\E[?67h\E[64;1"p, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kf0=\E[29~, kf1=\EOP, kf10=\E[29~, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, + kf8=\E[20~, kf9=\E[21~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, + kpp=\E[5~, kslt=\E[4~, + pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%>%t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+%d/%p2%s\E\\, + rc=\E8, rev=\E[7m$<2>, rf=/usr/share/tabset/vt300, + ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, + rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + rmso=\E[m, rmul=\E[m, rs3=\E[?67h\E[64;1"p, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, + smso=\E[7m, smul=\E[4m, + +#### VT100 emulations +# + +# John Hawkinson tells us that the EWAN telnet for Windows +# (the best Windows telnet as of September 1995) presents the name `dec-vt100' +# to telnetd. Michael Deutschmann informs us +# that this works best with a stock vt100 entry. +dec-vt100|EWAN telnet's vt100 emulation, + use=vt100, + +# From: Adrian Garside <94ajg2@eng.cam.ac.uk>, 19 Nov 1996 +dec-vt220|DOS tnvt200 terminal emulator, + am@, use=vt220, + +# Zstem340 is an (IMHO) excellent VT emulator for PC's. I recommend it to +# anyone who needs PC VT340 emulation. (or anything below that level, for +# that matter -- DEC's ALL-in-1 seems happy with it, as does INFOPLUS's +# RDBM systems, it includes ReGIS and SiXel support! I'm impressed... +# I can send the address if requested. +# (z340: changed garbled \E[5?l to \E[?5l, DEC smooth scroll off -- esr) +# From: Adam Thompson Sept 10 1995 +z340|zstem vt340 terminal emulator 132col 42line, + lines#42, + is2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;42r\E[42;1H, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;42r\E[42;1H, + use=vt320-w, +z340-nam|zstem vt340 terminal emulator 132col 42line, + am@, + is2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;42r\E[42;1H, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;42r\E[42;1H, + use=z340, + +#### X terminal emulators +# +# You can add the following line to your .Xdefaults to change the terminal type +# set by the xterms you start up to my-xterm: +# +# *termName: my-xterm +# +# System administrators can change the default entry for xterm instances +# by adding a similar line to /usr/X11/lib/X11/app-defaults/XTerm. In either +# case, xterm will detect and reject an invalid terminal type, falling back +# to the default of xterm. +# + +# X10/6.6 11/7/86, minus alternate screen, plus (csr) +# (xterm: ":MT:" changed to ":km:"; added / based on init string; +# removed (hs, eslok, tsl=\E[?E\E[?%i%dT, fsl=\E[?F, dsl=\E[?E) +# as these seem not to work -- esr) +x10term|vs100-x10|xterm terminal emulator (X10 window system), + am, km, mir, msgr, xenl, xon, + cols#80, it#8, lines#65, + bold=\E[1m, clear=\E[H\E[2J, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, il=\E[%p1%dL, + il1=\E[L, ind=^J, is2=\E\E[m\E[?7h\E[?1;4l, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, rev=\E[7m, ri=\EM, rmam=\E[?7l, + rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, + smso=\E[7m, smul=\E[4m, +# Compatible with the R5 xterm +# (from the XFree86 3.2 distribution, removed) +xterm-r5|xterm R5 version, + am, km, msgr, xenl, + cols#80, it#8, lines#24, + bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, + kdl1=\E[31~, kel=\E[8~, kf0=\EOq, kf1=\E[11~, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, kf3=\E[13~, + kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, + kf9=\E[20~, khome=\E[7~, kich1=\E[2~, kil1=\E[30~, + knp=\E[6~, kpp=\E[5~, rc=\E8, rev=\E[7m, ri=\EM, + rmkx=\E[?1l\E>, rmso=\E[m, + rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, sc=\E7, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, + sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, tbc=\E[3g, +# Compatible with the R6 xterm +# (from XFree86 3.2 distribution, and added, removed) +xterm-r6|xterm-old|xterm X11R6 version, + am, km, mir, msgr, xenl, + cols#80, it#8, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, enacs=\E)0, home=\E[H, ht=^I, il=\E[%p1%dL, + il1=\E[L, ind=^J, + is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\E[3~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf5=\E[15~, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, + kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, meml=\El, + memu=\Em, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, + rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E[?1l\E>, + rmso=\E[m, rmul=\E[m, + rs2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, sc=\E7, + sgr0=\E[m, smacs=^N, smcup=\E7\E[?47h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, +# This is the stock xterm entry supplied with XFree86 3.2 +# The name has been changed and some aliases have been removed. +xterm-xf86-v32|xterm terminal emulator (X Window System), + am, bce, km, mir, msgr, xenl, + colors#8, cols#80, it#8, lines#24, pairs#64, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[2J, + cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[?25h, dch=\E[%p1%dP, + dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, + el=\E[K, el1=\E[1K, enacs=\E(B\E)0, flash=\E[?5h\E[?5l, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, + is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, + ka1=\EOw, ka3=\EOu, kb2=\EOy, kbeg=\EOE, kbs=^H, kc1=\EOq, + kc3=\EOs, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\177, kend=\EOF, kent=\EOM, kf1=\E[11~, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, + kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, + kf9=\E[20~, kfnd=\E[1~, khome=\EOH, kich1=\E[2~, + kmous=\E[M, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, meml=\El, + memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, + rmam=\E[?7l, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, rs1=^O, + rs2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, + setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E7\E[?47h, + smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, vpa=\E[%i%p1%dd, + +# This is xterm for ncurses. It mainly adds mappings for more high-half +# characters. Note that these will only work for fixed-width fonts. +# Once XFree86 3.2 is established, we'll switch this to use=xterm-xf86-v32 +xterm|vs100|xterms|xterm terminal emulator (X Window System), + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++\,\,II00, + kmous=\E[M, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, + use=xterm-r6, + +# These entries allow access to the X titlebar and icon name as a status line. +# Note that twm (and possibly window managers descended from it such as tvtwm, +# ctwm, and vtwm) track windows by icon-name; thus, you don't want to mess +# with it. +xterm+sl|access X title line and icon name, + hs, + wsl#40, + dsl=\E]0;\007, fsl=^G, tsl=\E]0;, +xterm+sl-twm|access X title line (pacify twm-descended window managers), + hs, + wsl#40, + dsl=\E]2;\007, fsl=^G, tsl=\E]2;, + +# +# The following xterm variants don't depend on your base version +# +xterm-bold|xterm terminal emulator (X11R6 Window System) standout w/bold, + smso=\E[1m, + use=xterm, +# (kterm: this had extension capabilities ":KJ:TY=ascii:" -- esr) +# (kterm should not invoke DEC Graphics as the alternate character set +# -- Kenji Rikitake) +kterm|kterm kanji terminal emulator (X window system), + eslok, hs, + csr=\E[%i%p1%d;%p2%dr, dsl=\E[?H, enacs=\E(B, fsl=\E[?F, + rc=\E8, sc=\E7, tsl=\E[?E\E[?%i%dT, + use=xterm, +# See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file +xterm-nic|xterm with ich/ich1 suppressed for non-curses programs, + ich@, ich1@, + use=xterm, +# From: Mark Sheppard , 4 May 1996 +xterm1|xterm terminal emulator ignoring the alternate screen buffer, + rmcup@, smcup@, + use=xterm, + +# This describes the capabilities of color_xterm, an xterm variant from +# before ECMA-64 color support was folded into the main-line xterm release. +# This entry is straight from color_xterm's maintainer. +# From: Jacob Mandelson , 09 Nov 1996 +color_xterm|cx|cx100|color_xterm color terminal emulator for X, + am, km, mir, msgr, xenl, + colors#8, cols#80, it#8, lines#65, pairs#64, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, el1=\E[1K, enacs=\E(B\E)0, home=\E[H, ht=^I, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, + is1=\E[r\E[m\E[?7h\E[?4;6l\E[4l, ka1=\EOw, ka3=\EOy, + kb2=\EOu, kbs=^H, kc1=\EOq, kc3=\EOs, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kend=\E[8~, kent=\EOM, kf1=\E[11~, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, + kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[7~, kich1=\E[2~, + kmous=\E[M, knp=\E[6~, kpp=\E[5~, op=\E[39;49m, rc=\E8, + rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, + rmcup=\E>\E[?41;1r, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + rs1=\E(B\017\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E<, + sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr0=\E[m, smacs=^N, smam=\E[?7h, + smcup=\E[?1;41s\E[?1;41h\E=, smir=\E[4h, smso=\E[7m, + smul=\E[4m, + +# From: Mark Olesen & Thomas Dickey 13 Jul 1996 +rxvt|reduced xterm terminal (X Window System), + am, bce, km, mir, msgr, xenl, xon, + colors#8, cols#80, it#8, lines#24, pairs#64, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)0, flash=\E[?5h\E[?5l, home=\E[H, + hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=^J, is1=\E[?47l\E=\E[?1l, + is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, + kDC=\E[3$, kEND=\E[8$, kHOM=\E[7$, kLFT=\E[d, kNXT=\E[6$, + kPRV=\E[5$, kRIT=\E[c, ka1=\EOq, ka3=\EOs, kb2=\EOr, kbs=^H, + kc1=\EOp, kc3=\EOn, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[8~, kent=\EOM, + kf0=\E[21~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[7~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + op=\E[39m\E[49m, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=\E(B\E)0\017, rmcup=\E[?47l\E8, rmir=\E[4l, + rmkx=\E>, rmso=\E[27m, rmul=\E[24m, + rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, + rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>, + sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[m, + smacs=\E(B\E)U\016, smcup=\E7\E[?47h, smir=\E[4h, + smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + vpa=\E[%i%p1%dd, + +# From: David J. MacKenzie 20 Apr 1995 +# Here's a termcap entry I've been using for xterm_color, which comes +# with BSD/OS 2.0, and the X11R6 contrib tape too I think. Besides the +# color stuff, I also have a status line defined as the window manager +# title bar. [I have translated it to terminfo -- ESR] +xterm-pcolor|xterm with color used for highlights and status line, + bold=\E[1m\E[43m, rev=\E[7m\E[34m, smso=\E[7m\E[31m, + smul=\E[4m\E[42m, + use=xterm+sl, use=xterm, + +# HP ships this, except for the pb#9600 which was merged in from BSD termcap. +# (hpterm: added empty , we have no idea what ACS chars look like --esr) +xhpterm|X-hpterm|hp X11 terminal emulator, + am, da, db, mir, xhp, + cols#80, lh#2, lines#24, lm#0, lw#8, nlab#8, pb#9600, xmc#0, + acsc=, bel=^G, bold=\E&dB, cbt=\Ei, clear=\E&a0y0C\EJ, cr=^M, + cub1=^H, cud1=\EB, cuf1=\EC, cup=\E&a%p1%dy%p2%dC, + cuu1=\EA, dch1=\EP, dim=\E&dH, dl1=\EM, ed=\EJ$<1>, el=\EK, + hpa=\E&a%p1%dC, ht=^I, hts=\E1, il1=\EL, ind=^J, kbs=^H, + kclr=\EJ, kctab=\E2, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, kf1=\Ep, + kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, + khome=\Eh, khts=\E1, kich1=\EQ, kil1=\EL, kind=\ES, kll=\EF, + knp=\EU, kpp=\EV, kri=\ET, krmir=\ER, ktbc=\E3, meml=\El, + memu=\Em, pfkey=\E&f%p1%dk%p2%l%dL%p2%s, + pfloc=\E&f1a%p1%dk%p2%l%dL%p2%s, + pfx=\E&f2a%p1%dk%p2%l%dL%p2%s, + pln=\E&f%p1%dk%p2%l%dd0L%p2%s, rev=\E&dB, ri=\ET, + rmacs=^O, rmir=\ER, rmkx=\E&s0A, rmln=\E&j@, rmso=\E&d@, + rmul=\E&d@, + sgr=\E&d%?%p7%t%'s'%c%;%p1%p3%|%p6%|%{2}%*%p2%{4}%*%+%p4%+%p5%{8}%*%+%'@'%+%c%?%p9%t%'\016'%c%e%'\017'%c%;, + sgr0=\E&d@, smacs=^N, smir=\EQ, smkx=\E&s1A, smln=\E&jB, + smso=\E&dJ, smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, + +# This entry describes an xterm with Sun-style function keys enabled +# via the X resource setting "xterm*sunFunctionKeys:true" +# To understand / note that L1,L2 and F11,F12 are the same. +# The ... keys are L3-L10. We don't set +# because we want it to be seen as . +# The ... keys are R1-R15. We treat some of these in accordance +# with their Sun keyboard labels instead. +# From: Simon J. Gerraty 10 Jan 1996 +xterm-sun|xterm with sunFunctionKeys true, + kb2=\E[218z, kcpy=\E[197z, kend=\E[220z, kf1=\E[224z, + kf10=\E[233z, kf11=\E[192z, kf12=\E[193z, kf13=\E[194z, + kf14=\E[195z, kf15=\E[196z, kf17=\E[198z, kf18=\E[199z, + kf19=\E[200z, kf2=\E[225z, kf20=\E[201z, kf3=\E[226z, + kf31=\E[208z, kf32=\E[209z, kf33=\E[210z, kf34=\E[211z, + kf35=\E[212z, kf36=\E[213z, kf38=\E[215z, kf4=\E[227z, + kf40=\E[217z, kf42=\E[219z, kf44=\E[221z, kf5=\E[228z, + kf6=\E[229z, kf7=\E[230z, kf8=\E[231z, kf9=\E[232z, + kfnd=\E[200z, khlp=\E[196z, khome=\E[214z, kich1=\E[2z, + knp=\E[222z, kpp=\E[216z, kund=\E[195z, + use=xterm, +xterms-sun|small (80x24) xterm with sunFunctionKeys true, + cols#80, lines#24, use=xterm-sun, + +# This is for the extensible terminal emulator on the X11R6 contrib tape (emu). +emu|emu native mode, + mir, msgr, xon, + colors#15, cols#80, it#8, lines#24, pairs#64, vt#200, + acsc=a\202f\260g261j\213k\214l\215m\216n\217o\220q\222s\224t\225u\226v\227w\230x\231~\244, + bel=^G, blink=\ES\EW, bold=\ES\EU, civis=\EZ, + clear=\EP\EE0;0;, cnorm=\Ea, cr=^M, csr=\Ek%p1%d;%p2%d;, + cub=\Eq-%p1%d;, cub1=^H, cud=\Ep%p1%d;, cud1=\EB, + cuf=\Eq%p1%d;, cuf1=\ED, cup=\EE%p1%d;%p2%d;, + cuu=\Ep-%p1%d;, cuu1=\EA, cvvis=\Ea, dch=\EI%p1%d;, + dch1=\EI1;, dl=\ER%p1%d;, dl1=\ER1;, ech=\Ej%p1%d;, ed=\EN, + el=\EK, el1=\EL, enacs=\200, home=\EE0;0;, ht=^I, hts=\Eh, + il=\EQ%p1%d;, il1=\EQ1;, ind=\EG, is2=\ES\Er0;\Es0;, + kbs=^H, kcub1=\EC, kcud1=\EB, kcuf1=\ED, kcuu1=\EA, + kdch1=\177, kent=^M, kf0=\EF00, kf1=\EF01, kf10=\EF10, + kf11=\EF11, kf12=\EF12, kf13=\EF13, kf14=\EF14, kf15=\EF15, + kf16=\EF16, kf17=\EF17, kf18=\EF18, kf19=\EF19, kf2=\EF02, + kf20=\EF20, kf3=\EF03, kf4=\EF04, kf5=\EF05, kf6=\EF06, + kf7=\EF07, kf8=\EF08, kf9=\EF09, kfnd=\Efind, kich1=\Eins, + knp=\Enext, kpp=\Eprior, kslt=\Esel, oc=\Es0;\Er0;, + rev=\ES\ET, ri=\EF, rmacs=\200, rmir=\EX, rmso=\ES, rmul=\ES, + rs2=\ES\Es0;\Er0;, + setab=\Es%i%p1%d; setaf=\Er%i%p1%d;, sgr0=\ES, + smacs=\200, smir=\EY, smso=\ES\ET, smul=\ES\EV, tbc=\Ej, + +######## UNIX VIRTUAL TERMINALS AND VIRTUAL CONSOLES +# + +# Columbus UNIX virtual terminal. This terminal also appears in +# UNIX 4.0 and successors as line discipline 1 (?), but is +# undocumented and does not really work quite right. +cbunix|cb unix virtual terminal, + am, da, db, + cols#80, lines#24, lm#0, + bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EG%p2%c%p1%c, cuu1=\EA, dch1=\EM, dl1=\EN, ed=\EL, + el=\EK, ich1=\EO, il1=\EP, ind=^J, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, khome=\EE, rmso=\Eb^D, rmul=\Eb^A, + smso=\Ea^D, smul=\Ea^A, +# (vremote: removed obsolete ":nl@:" -- esr) +vremote|virtual remote terminal, + am@, + cols#79, use=cbunix, +pty|4bsd pseudo teletype, + cup=\EG%p1%{32}%+%c%p2%{32}%+%c, rmso=\Eb$, rmul=\Eb!, + smso=\Ea$, smul=\Ea!, + use=cbunix, + +# The codes supported by the term.el terminal emulation in GNU Emacs 19.30 +eterm|gnu emacs term.el terminal emulation, + am, mir, xenl, + cols#80, lines#24, + bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\\E[J, + el=\E[K, el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=^J, rev=\E[7m, + rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smcup=\E7\E[?47h, smir=\E[4h, smso=\E[7m, + smul=\E[4m, + +# Entries for use by the FSF's `screen' program. The screen and +# screen-w entries came with version 3.7.1. The screen2 and screen3 entries +# come from University of Wisconsin and may be older. +# (screen: added on ANSI model -- esr) + +screen|VT 100/ANSI X3.64 virtual terminal, + am, km, mir, msgr, xenl, + colors#8, cols#80, it#8, lines#24, pairs#64, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++\,\,hhII00, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, + cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, enacs=\E(B\E)0, flash=\Eg, + home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, + il1=\E[L, ind=^J, is2=\E)0, kbs=^H, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kf1=\EOP, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, kll=\E[4~, knp=\E[6~, kpp=\E[5~, + nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[23m, rmul=\E[24m, rs2=\Ec, sc=\E7, + sgr0=\E[m, smacs=^N, smir=\E[4h, smkx=\E[?1h\E=, + smso=\E[3m, smul=\E[4m, tbc=\E[3g, + use=ecma+color, + +screen-w|VT 100/ANSI X3.64 virtual terminal with 132 cols, + cols#132, use=screen, + +screen2|VT 100/ANSI X3.64 virtual terminal, + cols#80, it#8, lines#24, + cbt=\E[Z, clear=\E[2J\E[H, cr=^M, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=, il=\E[%p1%dL, + il1=\E[L, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kf0=\E~, kf1=\ES, kf2=\ET, kf3=\EU, kf4=\EV, + kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, kf9=\E0I, khome=\EH, + nel=^M^J, rc=\E8, ri=\EM, rmir=\E[4l, rmso=\E[23m, + rmul=\E[24m, rs1=\Ec, sc=\E7, sgr0=\E[m, smir=\E[4h, + smso=\E[3m, smul=\E[4m, tbc=\E[3g, +# (screen3: removed unknown ":xv:LP:G0:" -- esr) +screen3|VT 100/ANSI X3.64 virtual terminal, + km, mir, msgr, + cols#80, it#8, lines#24, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E)0, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, + rmir=\E[4l, rmkx=\E>, rmso=\E[23m, rmul=\E[24m, rs1=\Ec, + sc=\E7, sgr0=\E[m, smir=\E[4h, smkx=\E=, smso=\E[3m, + smul=\E[4m, tbc=\E[3g, + +######## WORKSTATION CONSOLES +# + +#### Sun consoles +# + +# :is1: resets scrolling region in case a previous user had used "tset vt100" +oldsun|Sun Microsystems Workstation console, + am, km, mir, msgr, + cols#80, it#8, lines#34, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, + dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, ht=^I, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, + is1=\E[1r, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, + rmso=\E[m, sgr0=\E[m, smso=\E[7m, +# From: Alexander Lukyanov , 14 Nov 1995 +# capability later corrected by J.T. Conklin +sun-il|Sun Microsystems console with working insert-line, + am, km, msgr, + cols#80, lines#34, + bel=^G, bold=\E[1m, clear=^L, cr=^M, cub1=^H, cud1=^J, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, ht=^I, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=^J, kb2=\E[218z, kbs=^H, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, + kend=\E[220z, kf1=\E[224z, kf10=\E[233z, kf11=\E[234z, + kf12=\E[235z, kf2=\E[225z, kf3=\E[226z, kf4=\E[227z, + kf5=\E[228z, kf6=\E[229z, kf7=\E[230z, kf8=\E[231z, + kf9=\E[232z, khome=\E[214z, knp=\E[222z, kopt=\E[194z, + kpp=\E[216z, kres=\E[193z, kund=\E[195z, rev=\E[7m, + rmso=\E[m, rmul=\E[m, rs2=\E[s, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m, + sgr0=\E[m, smso=\E[7m, smul=\E[4m, +# On a SparcStation 5, / flake out on the last line. +# Unfortunately, without them the terminal has no way to scroll. +sun-ss5|Sun SparcStation 5 console, + il@, il1@, use=sun-il, +# If you are using an SS5, change the sun definition to use sun-ss5. +sun|sun1|sun2|Sun Microsystems Inc. workstation console, + use=sun-il, + +# From: Tue Sep 24 13:14:44 1985 +sun-s|Sun Microsystems Workstation window with status line, + hs, + dsl=\E]l\E\\, fsl=\E\\, tsl=\E]l, use=sun, +sun-e-s|sun-s-e|Sun Microsystems Workstation with status hacked for emacs, + hs, + dsl=\E]l\E\\, fsl=\E\\, tsl=\E]l, use=sun-e, +sun-48|Sun 48-line window, + cols#80, lines#48, use=sun, +sun-34|Sun 34-line window, + cols#80, lines#34, use=sun, +sun-24|Sun 24-line window, + cols#80, lines#24, use=sun, +sun-17|Sun 17-line window, + cols#80, lines#17, use=sun, +sun-12|Sun 12-line window, + cols#80, lines#12, use=sun, +sun-1|Sun 1-line window for sysline, + eslok, hs, + cols#80, lines#1, + dsl=^L, fsl=\E[K, tsl=^M, use=sun, +sun-e|sun-nic|sune|Sun Microsystems Workstation without insert character, + ich1@, rmir@, smir@, + use=sun, +sun-c|sun-cmd|Sun Microsystems Workstation console with scrollable history, + lines#35, + rmcup=\E[>4h, smcup=\E[>4l, use=sun, + +#### Iris consoles +# + +# (wsiris: this had extension capabilities +# :HS=\E7F2:HE=\E7F7:\ +# :CT#2:CZ=*Bblack,red,green,yellow,blue,magenta,cyan,*Fwhite: +# See the note on Iris extensions near the end of this file. +# Finally, removed suboptimal =\EH\EJ and added & +# from BRL -- esr) +wsiris|iris40|iris emulating a 40 line visual 50 (approximately), + am, + cols#80, it#8, lines#40, + bel=^G, clear=\Ev, cnorm=\E>, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, cvvis=\E;, + dim=\E7F2, dl1=\EM, ed=\EJ, el=\EK, + flash=\E7F4\E7B1\013\E7F7\E7B0, home=\EH, ht=^I, il1=\EL, + ind=^J, is2=\E7B0\E7F7\E7C2\E7R3, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, kf0=\E0, kf1=\E1, kf2=\E2, kf3=\E3, + kf4=\E4, kf5=\E5, kf6=\E6, kf7=\E7, kf8=\E8, kf9=\E9, ri=\EI, + rmso=\E0@, rmul=\E7R3\E0@, sgr0=\E7F7, smso=\E9P, + smul=\E7R2\E9P, + +#### NeWS consoles +# +# Console terminal windows under the NeWS (Sun's Display Postscript windowing +# environment). Note: these have nothing to do with Sony's News workstation +# line. +# + +# Entry for NeWS's psterm from Eric Messick & Hugh Daniel +# (psterm: unknown ":sl=\EOl:el=\ENl:" removed -- esr) +psterm|psterm-basic|NeWS psterm-80x34, + am, hs, km, ul, + cols#80, it#8, lines#34, + blink=\EOb, bold=\EOd, clear=^L, csr=\EE%p1%d;%p2%d;, + cub1=\ET, cud1=\EP, cuf1=\EV, cup=\E%p1%d;%p2%d;, cuu1=\EY, + dch1=\EF, dl1=\EK, ed=\EB, el=\EC, flash=\EZ, fsl=\ENl, + home=\ER, ht=^I, il1=\EA, ind=\EW, is1=\EN*, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, ll=\EU, rc=^\, rev=\EOr, + ri=\EX, rmcup=\ENt, rmir=\ENi, rmso=\ENo, rmul=\ENu, sc=^], + sgr0=\EN*, smcup=\EOt, smir=\EOi, smso=\EOo, smul=\EOu, + tsl=\EOl, +psterm-96x48|NeWS psterm 96x48, + cols#96, lines#48, use=psterm, +psterm-90x28|NeWS psterm 90x28, + cols#90, lines#28, use=psterm, +psterm-80x24|NeWS psterm 80x24, + cols#80, lines#24, use=psterm, +# This is a faster termcap for psterm. Warning: if you use this termcap, +# some control characters you type will do strange things to the screen. +# (psterm-fast: unknown ":sl=^Ol:el=^Nl:" -- esr) +psterm-fast|NeWS psterm fast version (flaky ctrl chars), + am, hs, km, ul, + cols#80, it#8, lines#34, + blink=^Ob, bold=^Od, clear=^L, csr=\005%p1%d;%p2%d;, + cub1=^T, cud1=^P, cuf1=^V, cup=\004%p1%d;%p2%d;, cuu1=^Y, + dch1=^F, dl1=^K, ed=^B, el=^C, flash=^Z, fsl=^Nl, home=^R, ht=^I, + il1=^A, ind=^W, is1=^N*, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, ll=^U, rc=^\, rev=^Or, ri=^X, rmcup=^Nt, rmir=^Ni, + rmso=^No, rmul=^Nu, sc=^], sgr0=^N*, smcup=^Ot, smir=^Oi, + smso=^Oo, smul=^Ou, tsl=^Ol, + +#### NeXT Consoles +# +# Use `glasstty' for the Workspace application +# + +# From: Dave Wetzel 22 Dec 1995 +next|NeXT console, + am, xt, + cols#80, it#8, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, + ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, + rmso=\E[4;1m, sgr0=\E[m, smso=\E[4;2m, +nextshell|NeXT Shell application, + am, + cols#80, + bel=^G, cr=^M, cub1=^H, cud1=^J, ht=^I, kbs=^H, kcub1=^H, + kcud1=^J, nel=^M^J, + +### Common Desktop Environment +# + +# This ships with Sun's CDE in Solaris 2.5 +dtterm|CDE desktop terminal, + am, mir, msgr, xenl, xon, + colors#8, cols#80, it#8, lines#24, lm#0, pairs#64, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, + flash=\E[?5h$<200>\E[?5l, home=\E[H, ht=^I, hts=\EH, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, + invis=\E[8m, is2=\E F\E>\E[?1l\E[?7h\E[?45l, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + kfnd=\E[1~, khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + kslt=\E[4~, nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmso=\E[22;27m, + rmul=\E[24m, sc=\E7, setab=\E[%p1%{40}%+%dm, + setaf=\E[%p1%{30}%+%dm, + sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, + smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, + +######## COMMON TERMINAL TYPES +# +# This section describes terminal classes and maker brands that are still +# quite common, but have proprietary command sets not blessed by ANSI. +# + +#### Altos +# +# Altos made a moderately successful line of UNIX boxes. In 1990 they were +# bought out by Acer, a major Taiwanese manufacturer of PC-clones. +# Acer has a web site at http://www.acer.com. +# +# Altos descriptions from Ted Mittelstaedt 4 Sep 1993 +# His comments suggest they were shipped with the system. +# + +# (altos2: had extension capabilities +# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ +# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ +# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ +# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: +# :XU=^Aq\r:XD=^Ar\r:XR=^As\r:XL=^At\r:\ +# :YU=^AQ\r:YD=^AR\r:YR=^AS\r:YL=^AT\r:\ +# :HL=^AP\r:SP=\E[i:\ +# :IS=\E[@:DE=\E[P:IL=\E[L:NS=\E[S:PS=\E[T:\ +# :LO=\E[0q:LC=\E[5q:LL=\E[6q:\ +# Comparison with the k* capabilities makes it obvious that the c* things are +# shift keys. I have renamed them to keys 32 and up accordingly. Also, +# :sr: was given as a boolean-- esr) +altos2|alt2|altos-2|altos II, + cols#80, it#8, lines#24, xmc#0, + clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=\E[1B, cuf1=\E[1C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[1A, dch1=\E[P, dl=\E[M, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, + if=/usr/share/tabset/vt100, il1=\E[L, ind=^J, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kDL=^Am\r, + kEOL=^An\r, kbs=^H, kcbt=^AK\r, kclr=^AL\r, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=^AM\r, kel=^AN\r, + kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf32=^A`\r, + kf33=^Aa\r, kf34=^Ab\r, kf35=^Ac\r, kf36=^Ad\r, kf37=^Ae\r, + kf38=^Af\r, kf39=^Ag\r, kf4=^AC\r, kf40=^Ah\r, kf41=^Ai\r, + kf42=^Aj\r, kf43=^Ak\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khome=\E[f, kil1=^AJ\r, kind=^AO\r, + nel=^M^J, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, sgr0=\E[m, + smam=\E[?7h, smso=\E[7m, smul=\E[4m, +# (altos3: had extension capabilities +# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ +# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ +# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ +# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: +# :XU=^Aq\r:XD=^Ar\r:XR=^As\r:XL=^At\r:\ +# :HL=^AP\r:SP=\E[i:\ +# :IS=\E[@:DE=\E[P:IL=\E[L:NS=\E[S:PS=\E[T:\ +altos3|altos5|alt3|alt5|altos-3|altos-5|altos III or V, + blink=\E[5p, ri=\EM, sgr0=\E[p, + use=altos2, +altos4|alt4|altos-4|altos IV, + use=wy50, +# (altos7: had extension capabilities: +# :GG#0:GI=\EH8:GF=\EH7:\ +# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ +# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ +# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ +# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: +# Comparison with the k* capabilities makes it obvious that the c* things are +# shift keys. I have renamed them to keys 32 and up accordingly. I have +# also made this entry relative to adm12 in order to give it an . The +# imported by use=adm+sgr may work, let me know. -- esr) +altos7|alt7|altos VII, + am, mir, + cols#80, lines#24, xmc#0, + acsc=l2m1k3j5t4u9v=w0q\:x6n8, blink=\EG2, bold=\EGt, + clear=\E+^^, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dim=\EGp, dl=\ER, ed=\EY, el=\ET, home=^^, ht=^I, il1=\EE, + ind=^J, invis=\EG1, + is2=\E`\:\Ee(\EO\Ee6\Ec41\E~4\Ec21\Eu\E~2, kDL=^Am\r, + kEOL=^An\r, kbs=^H, kcbt=^AK\r, kclr=^AL\r, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=^AM\r, kel=^AN\r, + kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf32=^A`\r, + kf33=^Aa\r, kf34=^Ab\r, kf35=^Ac\r, kf36=^Ad\r, kf37=^Ae\r, + kf38=^Af\r, kf39=^Ag\r, kf4=^AC\r, kf40=^Ah\r, kf41=^Ai\r, + kf42=^Aj\r, kf43=^Ak\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khome=^^, kil1=^AJ\r, kind=^AO\r, + knp=\EK, kpp=\EJ, mc4=\EJ, mc5=\Ed#, nel=^M^J, ri=\Ej, + rmir=\Er, smir=\Eq, + use=adm+sgr, +altos7pc|alt7pc|altos PC VII, + kend=\ET, use=altos7, + +#### Hewlett-Packard (hp) +# +# Hewlett-Packard +# 8000 Foothills Blvd +# Roseville, CA 95747 +# Vox: 1-(916)-785-4363 (Technical response line for VDTs) +# 1-(800)-633-3600 (General customer support) +# + +# Generic HP terminal - this should (hopefully) work on any HP terminal. +hpgeneric|hp|hewlett-packard generic terminal, + am, da, db, mir, xhp, + cols#80, lines#24, lm#0, vt#6, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\E&a%p2%dc%p1%dY$<6>, cuu1=\EA, dch1=\EP, dl1=\EM, + ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, il1=\EL, + ind=^J, kbs=^H, kcbt=\Ei, rmir=\ER, rmso=\E&d@, rmul=\E&d@, + sgr0=\E&d@, smir=\EQ, smso=\E&dJ, smul=\E&dD, tbc=\E3, + vpa=\E&a%p1%dY, + +hp110|hewlett-packard model 110 portable, + lines#16, use=hpgeneric, + +hp+pfk+cr|hp function keys with CR, + kf1=\Ep\r, kf2=\Eq\r, kf3=\Er\r, kf4=\Es\r, kf5=\Et\r, + kf6=\Eu\r, kf7=\Ev\r, kf8=\Ew\r, + +hp+pfk-cr|hp function keys w/o CR, + kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, + kf8=\Ew, + +# The hp2621s use the same keys for the arrows and function keys, +# but not separate escape sequences. These definitions allow the +# user to use those keys as arrow keys rather than as function +# keys. +hp+pfk+arrows|hp alternate arrow definitions, + kcub1=\Eu\r, kcud1=\Ew\r, kcuf1=\Ev\r, kcuu1=\Et\r, kf1@, + kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, khome=\Ep\r, kind=\Er\r, + kll=\Eq\r, kri=\Es\r, + +hp+arrows|hp arrow definitions, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\Eh, + kind=\ES, kll=\EF, kri=\ET, + +# Generic stuff from the HP 262x series +# +hp262x|HP 262x terminals, + xhp, + blink=\E&dA, dch1=\EP$<2>, ed=\EJ, ht=\011$<2>, ind=\ES, + invis=\E&dS, ip=$<2>, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, khome=\Eh, + kich1=\EQ, kil1=\EL, kind=\ES, knp=\EU, kpp=\EV, kri=\ET, + krmir=\ER, rev=\E&dB, rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, + sgr=\E&d%'@'%?%p1%t%'B'%|%;%?%p2%t%'D'%|%;%?%p3%t%'B'%|%;%?%p4%t%'A'%|%;%c, + sgr0=\E&d@, smkx=\E&s1A, smso=\E&dB, smul=\E&dD, + +# Note: no on HPs since that homes to top of memory, not screen. +# Due to severe 2621 braindamage, the only way to get the arrow keys to +# transmit anything at all is to turn on the function key labels +# with , and even then the user has to hold down shift! +# The default 2621 turns off the labels except when it has to to +# enable the function keys. If your installation prefers labels +# on all the time, or off all the time (at the "expense" of the +# function keys), use 2621-nl or 2621-wl. +# +# Note: there are newer ROMs for 2621's that allow you to set +# strap A so the regular arrow keys xmit \EA, etc, as with the +# 2645. However, even with this strap set, the terminal stops +# xmitting if you reset it, until you unset and reset the strap! +# Since there is no way to set/unset the strap with an escape +# sequence, we don't use it in the default. +# If you like, you can use 2621-ba (brain-damaged arrow keys). +hp2621-ba|2621 w/new rom and strap A set, + rmkx@, smkx@, use=hp+arrows, + use=hp2621, + +# hp2621 with function labels. Most of the time they are off, +# but inside vi, the function key labels appear. You have to +# hold down shift to get them to xmit. +hp2621|hp2621a|hp2621A|2621|2621a|2621A|hp2621-wl|2621-wl|hp 2621 w/labels, + is2=\E&jA\r, rmkx=\E&jA, + use=hp2621-fl, +hp2621-fl|hp 2621, + xhp@, xon, + pb#19200, + cbt=\Ei, cup=\E&a%p2%dc%p1%dY, dch1=\EP$<2>, ht=\011$<2>, + ip=$<2>, is2=\E&j@\r, rmkx=\E&j@, rmso=\E&d@, rmul=\E&d@, + sgr0=\E&d@, smkx=\E&jB, smso=\E&dD, smul=\E&dD, + use=hp+pfk+cr, use=hpgeneric, + +# To use hp2621p printer, setenv TERM=2621p, PRINTER=2612p +hp2621p|hp 2621 with printer, + mc4=\E&p13C, mc5=\E&p11C, use=hp2621, + +hp2621p-a|hp2621p with fn as arrows, + use=hp+pfk+arrows, use=hp2621p, + +# hp2621 with k45 keyboard +hp2621-k45|hp2621k45|k45|hp 2621 with 45 keyboard, + kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + khome=\Eh, rmkx=\E&s0A, smkx=\E&s1A, + use=hp2621, + +# 2621 using all 48 lines of memory, only 24 visible at any time. +hp2621-48|48 line 2621, + lines#48, + cup=\E&a%p2%dc%p1%dR, home=\EH, vpa=\E&a%p1%dR, use=hp2621, + +# 2621 with no labels ever. Also prevents vi delays on escape. +hp2621-nl|hp 2621 with no labels, + kcub1@, kcud1@, kcuf1@, kcuu1@, khome@, rmkx@, smkx@, use=hp2621-fl, + +# Needed for UCB ARPAVAX console, since lsi-11 expands tabs +# (wrong). +# +hp2621-nt|hp 2621 w/no tabs, + ht@, use=hp2621, + +# Hp 2624 B with 4 or 10 pages of memory. +# +# Some assumptions are made with this entry. These settings are +# NOT set up by the initialization strings. +# +# Port Configuration +# RecvPace=Xon/Xoff +# XmitPace=Xon/Xoff +# StripNulDel=Yes +# +# Terminal Configuration +# InhHndShk=Yes +# InhDC2=Yes +# XmitFnctn(A)=No +# InhEolWrp=No +# +# Note: the 2624 DOES have a true , believe it or not! +# +# The 2624 has an "error line" to which messages can be sent. +# This is CLOSE to what is expected for a "status line". However, +# after a message is sent to the "error line", the next carriage +# return is EATEN and the "error line" is turned back off again! +# So I guess we can't define , , , , , . +# +# This entry supports emacs (and any other program that uses raw +# mode) at 4800 baud and less. I couldn't get the padding right +# for 9600. +# +# (hp2624: replaced NUL sequences in flash with mandatory pauses -- esr) +hp2624|hp2624a|hp2624b|hp2624b-4p|Hewlett Packard 2624 B, + da, db, + lm#96, + flash=\E&w13F$<66/>\E&w12F$<66/>\E&w13F$<66/>\E&w12F, use=hp+labels, use=scrhp, + +# This hp2626 entry does not use any of the fancy windowing stuff +# of the 2626. +# +# Indeed, terminfo does not yet handle such stuff. Since changing +# any window clears memory, it is probably not possible to use +# this for screen opt. +# +# ed is incredibly slow most of the time - I am guessing at the +# exact padding. Since the terminal uses xoff/xon this is intended +# only for cost computation, so that the terminal will prefer el +# or even dl1 which is probably faster! +# +# \ED\EJ\EC hack for ed from Ed Bradford - apparently ed is only +# extra slow on the last line of the window. +# +# The padding probably should be changed. +# +hp2626|hp2626a|hp2626p|hp 2626, + da, db, + lm#0, pb#19200, + ed=\ED\EJ$<500>\EC, indn=\E&r%p1%dD, ip=$<4>, + is2=\E&j@\r, rin=\E&r%p1%dU, + use=hp+pfk+cr, use=hp+labels, use=scrhp, + +# This entry is for sysline. It allocates a 23 line window with +# a 115 line workspace for regular use, and a 1 line window for +# the status line. +# +# This assumes port 2 is being used. +# Turn off horizontal line, Create ws #1 with 115 lines, +# Create ws #2 with 1 line, Create window #1 lines 1-23, +# Create window #2 lines 24-24, Attach cursor to workspace #1. +# Note that this clears the tabs so it must be done by tset before +# it sets the tabs. +# +hp2626-s|hp 2626 using only 23 lines, + eslok, hs, + lines#23, + fsl=\E&d@\E&w7f2p1I\E&w4f1I, + is1=\E&q3t0{0H \E&w0f115n1I \E&w0f1n2I \E&w2f1i0d0u22l0S \E&w2f2i0d23u23l0S \E&w7f2p1I \r, + tsl=\E&w7f2p2I\E&w4f2I\r\EK\E&a%p1%dC, + use=hp2626, +# Force terminal back to 24 lines after being 23. +hp2626-ns|hp 2626 using all 24 lines, + is1=\E&q3t0{0H \E&w0f118n1I \E&w0f1n2I \E&w2f1i0d0u23l0S \E&w3f2I \E&w7f2p1I \r, use=hp2626, +# Various entries useful for small windows on 2626. +hp2626-12|hewlett-packard 2626 12 lines, + lines#12, use=hp2626, +hp2626-12x40|hewlett-packard 2626 12 lines 40 columns, + cols#40, lines#12, use=hp2626, +hp2626-x40|hewlett-packard 2626 40 columns, + cols#40, use=hp2626, +hp2626-12-s|hewlett-packard 2626 11 lines plus status, + lines#11, use=hp2626-s, + +# +# hp2627 color tubes from University of Wisconsin +# +hp2627a-rev|hp 2627 with reverse video colors, + cr=^M, cud1=^J, ht=^I, ind=^J, + is2=\E&v0m1a0b0c1x1y1z1i0a0b1c1x1y1z0i0S\E&j@\r\E3\r, + kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, rmul=\E&v0S\E&d@, + smul=\E&dD\E&v1S, + use=hp2621-nl, +hp2627a|hp 2627 color terminal with no labels, + cr=^M, cud1=^J, ht=^I, ind=^J, + is2=\E&v0m1a1b0c1i0a1b1c2i1a0b0c0i0S\E&j@\r\E3\r, + kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, rmso=\E&v0S, + rmul=\E&v0S\E&d@, smso=\E&v2S, smul=\E&dD\E&v1S, + use=hp2621-nl, +hp2627c|hp 2627 color (cyan) terminal with no labels, + cr=^M, cud1=^J, ht=^I, ind=^J, + is2=\E&v0m1a0b0c2i1a1b0c1i0a1b1c0i0S\E&j@\r\E3\r, + kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, + use=hp2627a, + +# hp2640a doesn't have the Y cursor addressing feature, and C is +# memory relative instead of screen relative, as we need. +# +hp2640a|hp 2640a, + cup@, rmkx@, smkx@, use=hp2645, + +hp2640b|hp2644a|hp 264x series, + rmkx@, smkx@, use=hp2645, + +# (hp2641a: removed unknown :gu: -- esr) +hp2641a|hp2645a|hp2647a|HP 264?A series BRL entry, + am, da, db, mir, xhp, + cols#80, lines#24, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\E&a%p2%2dc%p1%2dY, cuu1=\EA, dch1=\EP, dl1=\EM, + ed=\EJ, el=\EK, hpa=\E&a%p1%2dC, ht=^I, + if=/usr/share/tabset/std, il1=\EL, ind=^J, + is2=\EE$<500/>, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, + rmir=\ER, rmso=\E&d@, smir=\EQ, smso=\E&dB, + vpa=\E&a%p1%2dY, + +# This terminal should be used at 4800 baud or less. It needs padding for +# plain characters at 9600, I guessed at an appropriate cr delay. It really +# wants ^E/^F handshaking, but that doesn't work well even if you write +# software to support it. +hp2645|hp45|HP 2645 series, + pb#9600, + blink=\E&dA, cr=\r$<20>, dim=\E&dH, kctab=\E2, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, + ked=\EJ, kel=\EK, khome=\Eh, khts=\E1, kich1=\EQ, kil1=\EL, + kind=\ES, knp=\EU, kpp=\EV, kri=\ET, krmir=\ER, rev=\E&dB, + rmkx=\E&s0A, + sgr=\E&d%'@'%?%p1%t%'B'%|%;%?%p2%t%'D'%|%;%?%p3%t%'B'%|%;%?%p4%t%'A'%|%;%?%p5%t%'H'%|%;%?%p6%t%'B'%|%;%c, + sgr0=\E&d@, smkx=\E&s1A, smul=\E&dD, + use=hpgeneric, +# You should use this terminal at 4800 baud or less. +hp2648|hp2648a|HP 2648a graphics terminal, + clear=\EH\EJ$<50>, cup=\E&a%p2%dc%p1%dY$<20>, + dch1=\EP$<7>, ip=$<5>, + use=hp2645, + +# The HP 150 terminal is a fairly vanilla HP terminal, with the +# clreol standout problem. It also has graphics capabilities and +# a touch screen, which we don't describe here. +hp150|hewlett packard Model 150, + use=hp2622, + +# HP 2382a terminals, "the little ones." They don't have any +# alternate character set support and sending out ^N/^O will +# leave the screen blank. +hp2382a|hp2382|hewlett packard 2382a, + da, db, + lh#1, lm#48, + acsc@, + pln=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d0L%?%ga%!%t %;%p2%s, + rmacs@, + sgr=\E&d%{0}%Pa%?%p4%t%{1}%ga%+%Pa%;%?%p1%p3%|%p6%|%t%{2}%ga%+%Pa%;%?%p2%p6%|%t%{4}%ga%+%Pa%;%?%p1%p5%|%t%{8}%ga%+%Pa%;%?%p7%t%?%ga%ts%ga%'@'%+%e%'S'%;%e%?%ga%t%ga%'@'%+%e%'@'%;%;%c, + sgr0=\E&d@, smacs@, + use=hp+labels, use=scrhp, + +hp2621-a|hp2621a-a|hp2621 with fn as arrows, + use=hp+pfk+arrows, use=hp2621-fl, + +# newer hewlett packard terminals + +newhpkeyboard|generic entry for HP extended keyboard, + kbs=^H, kcbt=\Ei, kclr=\EJ, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, khome=\Eh, + kich1=\EQ, kil1=\EL, kind=\ET, kll=\EF, knp=\EU, kpp=\EV, + kri=\ES, krmir=\ER, rmkx=\E&s0A, smkx=\E&s1A, + use=hp+pfk-cr, + +newhp|generic entry for new hewlett packard terminals, + am, bw, mir, xhp, xon, + cols#80, lines#24, pb#4800, + acsc=T1R!U2S"W3O#V4P$t5u6w7v8\:'9(LQKWlRkT5I3@2[MAJSmFjGdHQ;Y+Z*X\:4>q\,x.n/, + bel=^G, blink=\E&dA, bold=\E&dF, cbt=\Ei, cr=^M, cub1=^H, + cud1=^J, cuf1=\EC, cuu1=\EA, dch1=\EP$<2>, dim=\E&dH, + dl1=\EM, ed=\EJ, el=\EK, ht=\011$<2>, hts=\E1, il1=\EL, ind=^J, + invis=\E&dS, ip=$<2>, is1=\E&jB$<8>, nel=^M^J, + pfkey=\E&f0a%p1%dk0d%p2%l%dL%p2%s, + pfloc=\E&f1a%p1%dk0d%p2%l%dL%p2%s, + pfx=\E&f2a%p1%dk0d%p2%l%dL%p2%s, rev=\E&dB, ri=\ET, + rmacs=^O, rmir=\ER, rmso=\E&d@, rmul=\E&d@, rs1=\Eg, + sgr=\E&d%{0}%Pa%?%p4%t%{1}%ga%+%Pa%;%?%p1%p3%|%p6%|%t%{2}%ga%+%Pa%;%?%p2%p6%|%t%{4}%ga%+%Pa%;%?%p1%p5%|%t%{8}%ga%+%Pa%;%?%p7%t%?%ga%ts%ga%'@'%+%e%'S'%;%e%?%ga%t%ga%'@'%+%e%'@'%;%;%c%?%p9%t\016%e\017%;, + sgr0=\E&d@\017, smacs=^N, smir=\EQ, smso=\E&dJ, smul=\E&dD, + tbc=\E3, + use=newhpkeyboard, + +memhp|memory relative addressing for new HP ttys, + vt#6, + clear=\EH\EJ$<40>, cub=\E&a-%p1%dC, cud=\E&a+%p1%dR, + cuf=\E&a+%p1%dC, cup=\E&a%p1%dr%p2%dC, cuu=\E&a-%p1%dR, + home=\EH, hpa=\E&a%p1%dC, ll=\E&a23R\r, + mrcup=\E&a%p1%dr%p2%dC, vpa=\E&a%p1%dR, use=newhp, + +scrhp|screen relative addressing for new HP ttys, + clear=\E&a0c0Y\EJ$<40>, cub=\E&a-%p1%dC, + cud=\E&a+%p1%dR, cuf=\E&a+%p1%dC, + cup=\E&a%p1%dy%p2%dC$<10>, cuu=\E&a-%p1%dR, + home=\E&a0y0C, hpa=\E&a%p1%dC, ll=\E&a0y0C\EA, + mrcup=\E&a%p1%dr%p2%dC, vpa=\E&a%p1%dY, use=newhp, + +# (hp+labels: added label values from a BRL termcap -- esr) +hp+labels|"standard" label info for new HP ttys, + lh#2, lw#8, nlab#8, + lf0=f1, lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, + pln=\E&f2a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d0L%?%ga%!%t %;%p2%s, + rmln=\E&j@, smln=\E&jB, + +hp+printer|"standard" printer info for HP ttys, + ff=\E&p4u0C, mc0=\EH\E&p4dF, mc4=\E&p13C, mc5=\E&p11C, + + +# The new hp2621b is kind of a cross between the old 2621 and the +# new 262x series of machines. It has dip-switched options. +# The firmware has a bug in it such that if you give it a null +# length label, the following character is eaten! +hp2621b|hp 2621b with old style keyboard, + lh#1, lm#48, lw#8, nlab#8, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\Eh, + kind=\ET, kll=\EF, kri=\ES, + pln=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d3L%?%ga%!%t%{32}%c%;%p2%s\E%'o'%p1%+%c\r, + smln=\E&jB, + use=hp2621, + +hp2621b-p|hp 2621b with printer, + use=hp+printer, use=hp2621b, + +# hp2621b - new 2621b with new extended keyboard +# these are closer to the new 26xx series than the other 2621b +hp2621b-kx|hp 2621b with extended keyboard, + use=newhpkeyboard, use=hp2621b, + +hp2621b-kx-p|hp 2621b with new keyboard & printer, + use=hp+printer, use=hp2621b-kx, + +# Some assumptions are made in the following entries. +# These settings are NOT set up by the initialization strings. +# +# Port Configuration +# RecvPace=Xon/Xoff XmitPace=Xon/Xoff StripNulDel=Yes +# +# Terminal Configuration +# InhHndShk(G)=Yes InhDC2(H)=Yes +# XmitFnctn(A)=No InhEolWrp=No +# +# +# Hp 2622a & hp2623a display and graphics terminals +# +hp2622|hp2622a|hp 2622, + da, db, + lm#0, pb#19200, + is2=\E&dj@\r, use=hp+pfk+cr, use=hp+labels, use=scrhp, + +# The 2623 is a 2622 with extra graphics hardware. +hp2623|hp2623a|hp 2623, + use=hp2622, + +hp2624b-p|hp2624b-4p-p|hewlett packard 2624 B with printer, + use=hp+printer, use=hp2624, + +# The hewlett packard B can have an optional extra 6 pages of memory. +hp2624-10p|hp2624a-10p|hp2624b-10p|hewlett packard 2624 B w/ 10 pages of memory, + lm#240, use=hp2624, + +hp2624b-10p-p|hewlett packard 2624 B w/ extra memory & printer, + lm#240, use=hp2624b-p, + +# Color manipulations for HP terminals +hp+color|hp with colors, + ccc, + colors#16, ncv#17, pairs#7, + initp=\E&v%?%p2%{1000}%=%t1%e.%p2%d%;a\n%?%p3%{1000}%=%t1%e.%p3%d%;b\n%?%p4%{1000}%=%t1%e.%p4%d%;c\n%?%p5%{1000}%=%t1%e.%p5%d%;x\n%?%p6%{1000}%=%t1%e.%p6%d%;y\n%?%p7%{1000}%=%t1%e.%p7%d%;z\n%p1%dI, + oc=\E&v0m1a1b1c0I\E&v1a1I\E&v1b2I\E&v1a1b3I\E&v1c4I\E&v1a1c5I\E&v1b1c6I\E&v1x1y7I, + op=\E&v0S, scp=\E&v%p1%dS, + +# sets the screen to be 80 columns wide +hp2397a|hp2397|hewlett packard 2397A color terminal, + is2=\E&w6f80X, + use=memhp, use=hp+labels, use=hp+color, + +# HP 700/44 Setup parameters: +# Terminal Mode HP-PCterm +# Inhibit Auto Wrap NO +# Status Line Host Writable +# PC Character Set YES +# Twenty-Five Line Mode YES +# XON/XOFF @128 or 64 (sc) +# Keycode Mode NO or YES (sc) +# Backspace Key BS or BS/DEL +# +# sets pcterm; autowrap; 25 lines; pc char set; prog DEL key; +# \E\\? does not turn off keycode mode +# sets alternate start/stop; keycode on +hpansi|hp700|hewlett packard 700/44 in HP-PCterm mode, + am, eo, xenl, xon, + cols#80, lines#25, + acsc=k\277l\332m\300j\331n\305w\302q\304u\264t\303v\301x\263, + bel=^G, cbt=\E[Z, civis=\E[?25l, clear=\E[2J\E[H, + cnorm=\E[?25h, cr=^M, cub1=\E[D, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, + ind=^J, + is2=\E[44"p\E[?7h\E[>10h\E[>12h\EP1;1|3/7F\E\\, + kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kend=\E[4~, kf1=\E[17~, kf10=\E[28~, + kf2=\E[18~, kf3=\E[19~, kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, + kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khome=\E[1~, knp=\E[6~, + kpp=\E[5~, rmam=\E[?7l, + rmsc=\E[>11l\EP1**x0/11;1/13\E[m\E\\, rmso=\E[m, + rmul=\E[m, sgr0=\E[m, smam=\E[?7h, + smsc=\E[>11h\EPO**x0/65;1/67\E\\$<250>, smso=\E[7m, + smul=\E[4m, xoffc=g, xonc=e, +# +# (hp2392: copied here from hpex -- esr) +hp2392|239x series, + cols#80, + cbt=\Ei, cup=\E&a%p1%dy%p2%dC, kf1=\Ep\r, kf2=\Eq\r, + kf3=\Er\r, kf4=\Es\r, kf5=\Et\r, kf6=\Eu\r, kf7=\Ev\r, + kf8=\Ew\r, khome=\Eh, kind=\EU, knp=\Eu, kpp=\Ev, kri=\EV, + rmir=\ER, rmul=\E&d@, smir=\EQ, smul=\E&dD, vpa=\E&a%p1%dY, + use=hpsub, + +hpsub|hp terminals -- capability subset, + am, da, db, mir, xhp, xon, + lines#24, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cuu1=\EA, dch1=\EP, dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, + ht=^I, if=/usr/share/tabset/stdcrt, il1=\EL, ind=^J, + is2=\E&s1A\E<\E&k0\\, kbs=^H, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, khome=\Eh, rmkx=\E&s0A, rmso=\E&d@, + sgr0=\E&d@, smkx=\E&s1A, smso=\E&dB, + +# hpex: +# May be used for most 24 x 80 hp terminals, +# but has no padding added, so may allow runover in some terminals at high +# baud rates. Will not work for hp2640a or hp2640b terminals, hp98x6 and +# hp98x5 terminal emulators or hp98x6 consoles. +# Adds xy-cursor addressing, vertical cursor addressing, home, +# last line, and underline capabilities. +# +# (hpex: removed memory-lock capabilities ":ml=\El:mu=\Em:", +# moved here from hpsub -- esr) +hpex|hp extended capabilites, + cr=^M, cud1=^J, cup=\E&a%p1%dy%p2%dC, ht=^I, ind=^J, kbs=^H, + kcub1=^H, kcud1=^J, nel=^M^J, rmir=\ER, rmul=\E&d@, smir=\EQ, + smul=\E&dD, vpa=\E&a%p1%dY, + use=hpsub, + +# From: Ville Sulko , 05 Aug 1996 +hp2|hpex2|hewlett-packard extended capabilities newer version, + am, da, db, mir, xhp, + cols#80, lh#2, lines#24, lm#0, lw#8, nlab#8, xmc#0, + bel=^G, clear=\E&a0y0C\EJ, cr=^M, cub1=^H, cud1=\EB, + cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, + dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, + il1=\EL, ind=^J, kbs=^H, kclr=\EJ, kctab=\E2, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, + ked=\EJ, kel=\EK, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, + kf6=\Eu, kf7=\Ev, kf8=\Ew, khome=\Eh, khts=\E1, kich1=\EQ, + kil1=\EL, kind=\ES, kll=\EF, knp=\EU, kpp=\EV, kri=\ET, + krmir=\ER, ktbc=\E3, meml=\El, memu=\Em, + pfkey=\E&f%p1%dk%p2%l%dL%p2%s, + pfloc=\E&f1a%p1%dk%p2%l%dL%p2%s, + pfx=\E&f2a%p1%dk%p2%l%dL%p2%s, + pln=\E&f%p1%dk%p2%l%dd0L%p2%s, rmir=\ER, rmkx=\E&s0A, + rmln=\E&j@, rmso=\E&d@, rmul=\E&d@, + sgr=\E&d%?%p7%t%'s'%c%;%p1%p3%|%p6%|%{2}%*%p2%{4}%*%+%p4%+%p5%{8}%*%+%'@'%+%c%?%p9%t%'\016'%c%e%'\017'%c%;, + sgr0=\E&d@, smir=\EQ, smkx=\E&s1A, smln=\E&jB, smso=\E&dB, + smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, + +# HP 236 console +# From: +hp236|hp236 internal terminal emulator, + am, + cols#80, lines#24, + clear=\EF, cnorm=\EDE, cub1=^H, + cup=\EE%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, cvvis=\EDB, + dch1=\EJ, dl1=\EH, el=\EK, ich1=\EI, il1=\EG, rmso=\ECI, + sgr0=\ECI, smso=\EBI, + +# This works on a hp300 console running Utah 4.3 BSD +# From: Craig Leres +hp300h|HP Catseye console, + am, da, db, mir, xhp, + cols#128, lines#51, lm#0, xmc#0, + bel=^G, cbt=\Ei, clear=\E&a0y0C\EJ, cr=^M, cub1=^H, cud1=\EB, + cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, + dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, + if=/usr/share/tabset/stdcrt, il1=\EL, ind=^J, kbs=^H, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\Eh, + rmir=\ER, rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, sgr0=\E&d@, + smir=\EQ, smkx=\E&s1A, smso=\E&dB, smul=\E&dD, tbc=\E3, + vpa=\E&a%p1%dY, +# From: Greg Couch +hp9837|hp98720|hp98721|HP 9000/300 workstations, + am, da, db, mir, xhp, + cols#128, it#8, lines#46, lm#0, + bel=^G, cbt=\Ei, clear=\E&a0y0C\EJ, cub1=^H, cud1=\EB, + cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, + dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, + il1=\EL, ind=^J, is2=\E&v0m1b0i&j@, kbs=^H, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, + ked=\EJ, kel=\EK, khome=\Eh, kich1=\EQ, kil1=\EL, knp=\EU, + kpp=\EV, rmir=\ER, rmkx=\E&s0A, rmso=\E&v0S, rmul=\E&d@, + sgr0=\E&d@, smir=\EQ, smkx=\E&s1A, smso=\E&v5S, smul=\E&dD, + tbc=\E3, vpa=\E&a%p1%dY, +# HP 9845 desktop computer from BRL +# (hp9845: removed unknown capability :gu: -- esr) +hp9845|HP 9845, + am, da, db, eo, mir, xhp, + cols#80, lines#21, + clear=\EH\EJ, cuf1=\EC, cup=\E&a%p2%2dc%p1%2dY, cuu1=\EA, + dch1=\EP, dl1=\EM, ed=\EJ, el=\EK, + if=/usr/share/tabset/std, il1=\EL, rmir=\ER, rmso=\E&d@, + smir=\EQ, smso=\E&dB, +# From: Charles A. Finnell of MITRE , developed 07SEP90 +# (hp98550: replaced /usr/share/tabset/9837 with std because ,; +# added empty to avoid warnings re / --esr) +hp98550|hp98550a|HP 9000 Series 300 color console, + am, da, db, mir, xhp, + cols#128, it#8, lines#49, lm#0, + acsc=, bel=^G, blink=\E&dA, bold=\E&dJ, cbt=\Ei, civis=\E*dR, + clear=\EH\EJ, cnorm=\E*dQ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, dim=\E&dH, + dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, + if=/usr/share/tabset/std, il1=\EL, ind=^J, invis=\E&ds, + kbs=^H, kclr=\EJ, kctab=\E2, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, kf1=\Ep, + kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, + khome=\Eh, khts=\E1, kich1=\EQ, kil1=\EL, kind=\ES, kll=\EF, + knp=\EU, kpp=\EV, kri=\ET, krmir=\ER, ktbc=\E3, rev=\E&dJ, + rmacs=^O, rmir=\ER, rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, + sgr0=\E&d@, smacs=^N, smir=\EQ, smkx=\E&s1A, smso=\E&dJ, + smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, +# From: Victor Duchovni +# (hp700-wy: removed obsolete ":nl=^J:"; +# replaced /usr/share/tabset/hp700-wy with std because , -- esr) +hp700-wy|HP700/41 emulating wyse30, + am, bw, mir, msgr, + cols#80, it#8, lines#24, xmc#1, + cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^V, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET$<10/>, home=^^, ht=^I, hts=\E1, + if=/usr/share/tabset/stdcrt, il1=\EE$<0.7*/>, + is1=\E~"\EC\Er\E(\EG0\003\E`9\E`1, kbs=\177, kcbt=\EI, + kclr=^Z, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, ked=\EY, + kel=\ET, khome=^^, khts=\EI, kich1=\Eq, krmir=\Er, ll=^^^K, + ri=\Ej, rmir=\Er, rmso=\EG0$<10/>, rmul=\EG0$<10/>, + sgr0=\EG0$<10/>, smir=\Eq, smso=\EG4$<10/>, + smul=\EG8$<10/>, tbc=\E0, vpa=\E[%p1%{32}%+%c, +# (hp70092: added empty to avoid warnings re / --esr) +hp70092|hp70092a|hp70092A|HP 700/92, + am, da, db, xhp, + cols#80, lh#2, lines#24, lm#0, lw#8, nlab#8, + acsc=, bel=^G, blink=\E&dA, bold=\E&dB, cbt=\Ei, + clear=\E&a0y0C\EJ, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, dim=\E&dH, + dl1=\EM, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, il1=\EL, + kbs=^H, kclr=\EJ, kctab=\E2, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, kf1=\Ep, + kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, + khome=\Eh, khts=\E1, kich1=\EQ, kil1=\EL, kind=\ES, kll=\EF, + knp=\EU, kpp=\EV, kri=\ET, krmir=\ER, ktbc=\E3, rev=\E&dB, + ri=\ET, rmacs=^O, rmir=\ER, rmkx=\E&s0A, rmln=\E&j@, + rmso=\E&d@, rmul=\E&d@, sgr0=\E&d@, smacs=^N, smir=\EQ, + smkx=\E&s1A, smln=\E&jB, smso=\E&dJ, smul=\E&dD, tbc=\E3, + vpa=\E&a%p1%dY, + +bobcat|sbobcat|HP 9000 model 300 console, + am, da, db, mir, xhp, + cols#128, it#8, lines#47, xmc#0, + cbt=\Ei, clear=\EH\EJ, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\E&a%dy%dC$<6/>, cuu1=\EA, dch1=\EP, dl1=\EM$<10*/>, + ed=\EJ, el=\EK, hpa=\E&a%dC$<6/>, ht=^I, il1=\EL$<10*/>, + ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + khome=\Eh, nel=^M^J, rmir=\ER, rmkx=\E&s0A, rmso=\E&d@, + rmul=\E&d@, sgr0=\E&d@, smir=\EQ, smkx=\E&s1A, smso=\E&dB, + smul=\E&dD, vpa=\E&a%dY$<6/>, +gator-t|HP 9000 model 237 emulating extra-tall AAA, + lines#94, use=gator, +gator|HP 9000 model 237 emulating AAA, + bw, km, mir, ul, + cols#128, it#8, lines#47, + bel=^G, cbt=\E[Z, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, + dch=\E[%p1%dP$<4/>, dch1=\E[P, dl=\E[%p1%dM$<1*/>, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, hpa=\E[%i%p1%d`, + ht=^I, ich=\E[%p1%d@$<4/>, ich1=\E[@, il=\E[%p1%dL$<1*/>, + il1=\E[L, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, + rep=%p1%c\E[%p2%db$<1*/>, rev=\E[7m, rmso=\E[m, + rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, +gator-52|HP 9000 model 237 emulating VT52, + cols#128, lines#47, use=vt52, +gator-52t|HP 9000 model 237 emulating extra-tall VT52, + lines#94, use=gator-52, + +#### Honeywell-Bull +# +# From: Michael Haardt 11 Jan 93 +# + +# Honeywell Bull terminal. Its cursor and function keys send single +# control characters and it has standout/underline glitch. Most programs +# do not like these features/bugs. Visual bell is realized by flashing the +# "keyboard locked" LED. +dku7003-dumb|Honeywell Bull DKU 7003 dumb mode, + cols#80, lines#25, + clear=^]^_, cr=^M, cub1=^Y, cud1=^K, cuf1=^X, + cup=\E[%i%p1%d;%p2%dH, cuu1=^Z, ed=^_, el=\E[K, + flash=\E[2h\E[2l, home=^], ht=^I, ind=^J, kbs=^H, kcub1=^Y, + kcud1=^K, kcuf1=^X, kcuu1=^Z, khome=^], nel=^M^J, +dku7003|Honeywell Bull DKU 7003 all features described, + msgr, + xmc#1, + blink=\E[5m, bold=\E[7m, dim=\E[2m, rev=\E[7m, rmso=\E[m, + rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, + use=dku7003-dumb, + +#### Lear-Siegler (adm) +# +# These guys are long since out of the terminals business, but +# in 1995 many current terminals still have an adm type as one of their +# emulations (usually their stupidest, and usually labeled adm3, though +# these `adm3' emulations normally have adm3a+ capabilities). +# +# WARNING: Some early ADM terminals (including the ADM3 and ADM5) are +# reputed to have had the weird `feature' that sending them a ^G would trigger +# a diagnostic dump to screen if one of the more obscure RS-232 pins +# (variously reported as 22 or as `Ring Indicator') was being held high during +# receipt of the ^G. If you have a real ADM and think you've run into this, +# check it out with a breakout box and tell us if this rumor is correct! +# A quick fix might be to drop back to a cheesy 4-wire cable. +# + +adm1a|adm1|lsi adm1a, + am, + cols#80, lines#24, + bel=^G, clear=\E;$<1>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, home=^^, + ind=^J, +adm2|lsi adm2, + am, + cols#80, lines#24, + bel=^G, clear=\E;, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET, home=^^, ich1=\EQ, il1=\EE, ind=^J, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, +# (adm3: removed obsolete ":ma=^K^P:" -- esr) +adm3|lsi adm3, + am, + cols#80, lines#24, + bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, ind=^J, +# The following ADM-3A switch settings are assumed for normal operation: +# SPACE U/L_DISP CLR_SCRN 24_LINE +# CUR_CTL LC_EN AUTO_NL FDX +# Other switches may be set for operator convenience or communication +# requirements. I recommend +# DISABLE_KB_LOCK LOCAL_OFF 103 202_OFF +# ETX_OFF EOT_OFF +# Most of these terminals required an option ROM to support lower case display. +# Open the case and look at the motherboard; if you see an open 24-pin DIP +# socket, you may be out of luck. +# +# (adm3a: some capabilities merged in from BRl entry -- esr) +adm3a|lsi adm3a, + am, + cols#80, lines#24, + bel=^G, clear=\032$<1/>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, home=^^, + ind=^J, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, rs1=^N, +adm3a+|adm3a plus, + kbs=^H, use=adm3a, +# (adm5: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" & duplicate ":do=^J:" -- esr) +adm5|lsi adm5, + xmc#1, + bel=^G, cr=^M, cud1=^J, ed=\EY, el=\ET, kbs=^H, khome=^^, + rmso=\EG, smso=\EG, + use=adm3a+, +# A lot of terminals other than adm11s use these. Wherever you see +# use=adm+sgr with some of its capabilities disabled, try the +# disabled ones. They may well work but not have been documented or +# expressed in the using entry. We'd like to cook up an but the +# / sequences of the using entries vary too much. +adm+sgr|adm style highlight capabilities, + invis=\EG1, rev=\EG4, rmso=\EG0, rmul=\EG0, sgr0=\EG0, + smso=\EG4, smul=\EG8, +# LSI ADM-11 from George William Hartwig, Jr. via BRL +# Status line additions from Stephen J. Muir +# from . could also +# be ^Z, according to his entry. +# (adm11: =\EG4 was obviously erroneous because it also said +# =\EG4. Looking at other ADMs confirms this -- esr) +adm11|LSI ADM-11, + am, hs, + cols#80, lines#24, + bel=^G, blink=\EG2, clear=\E*, cr=^M, cub1=^H, cud1=^J, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dsl=\Eh, ed=\EY, el=\ET, fsl=\E(\r, home=^^, ht=^I, kbs=^H, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, kf2=^AA\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, khome=^^, nel=^M^J, tsl=\EF\E), + use=adm+sgr, +# From: Andrew Scott Beals +# Corrected by Olaf Siebert , 11 May 1995 +# (adm12: removed obsolete ":kn:ma=j^Jk^P^K^Pl ^R^L^L :". This formerly had +# =\Eq but that looked wrong; this is from Dave Yost +# via BRL. That entry asserted , but I've left that out because +# neither earlier nor later ADMSs have it -- esr) +adm12|lsi adm12, + am, mir, + cols#80, it#8, lines#24, + bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET, home=^^, hts=\E1, ich1=\EQ, il1=\EE, + is2=\E0 \E1 \E1 \E1 \E1 \E1 \E1 \E1 \E1, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^A0\r, kf1=^A1\r, + kf2=^A2\r, kf3=^A3\r, kf4=^A4\r, kf5=^A5\r, kf6=^A6\r, + kf7=^A7\r, kf8=^A8\r, kf9=^A9\r, rmir=\Er, smir=\Eq, tbc=\E0, + use=adm+sgr, +# (adm20: removed obsolete ":kn#7:" -- esr) +adm20|lear siegler adm20, + am, + cols#80, it#8, lines#24, + bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cuf1=^L, + cup=\E=%i%p2%{31}%+%c%p1%{31}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET, home=^^, ht=^I, ich1=\EQ, il1=\EE, + kf1=^A, kf2=^B, kf3=^W, kf4=^D, kf5=^E, kf6=^X, kf7=^Z, rmso=\E(, + sgr0=\E(, smso=\E), +adm21|lear siegler adm21, + xmc#1, + bel=^G, cr=^M, cud1=^J, dch1=\EW, dl1=30*\ER, ed=\EY, el=\ET, + ich1=\EQ, il1=30*\EE, ind=^J, invis@, kbs=^H, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, + use=adm+sgr, use=adm3a, +# (adm22: ":em=:" was an obvious typo for ":ei=:"; also, +# removed obsolete ":kn#7:ma=j^Jk^P^K^Pl ^R^L^L :"; +# removed bogus-looking \200 from before . -- esr) +adm22|lsi adm22, + am, + cols#80, lines#24, + bel=^G, cbt=\EI, clear=\E+, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\Ey, el=\Et, home=^^, ht=\Ei, ich1=\EQ, il1=\EE, + is2=\E%\014\014\014\016\003\200\003\002\003\002\200\200\200\200\200\200\200\200\200\200\200, + kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, khome=^^, lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, + lf6=F6, lf7=F7, rmso=\E(, sgr0=\E(, smso=\E), +# ADM 31 DIP Switches +# +# This information comes from two versions of the manual for the +# Lear-Siegler ADM 31. +# +# Main board: +# rear of case +# +-||||-------------------------------------+ +# + S1S2 ||S + +# + ||3 + +# + + +# + ||S + +# + ||4 + +# + + +# + + +# + + +# + + +# + + +# +-+ +-+ +# + + +# + S5 S6 S7 + +# + == == == + +# +----------------------------------------------+ +# front of case (keyboard) +# +# S1 - Data Rate - Modem +# S2 - Data Rate - Printer +# ------------------------ +# Data Rate Setting +# ------------------- +# 50 0 0 0 0 +# 75 1 0 0 0 +# 110 0 1 0 0 +# 134.5 1 1 0 0 +# 150 0 0 1 0 +# 300 1 0 1 0 +# 600 0 1 1 0 +# 1200 1 1 1 0 +# 1800 0 0 0 1 +# 2000 1 0 0 1 +# 2400 0 1 0 1 +# 3600 1 1 0 1 +# 4800 0 0 1 1 +# 7200 1 0 1 1 +# 9600 0 1 1 1 +# x 1 1 1 1 +# +# S3 - Interface/Printer/Attributes +# --------------------------------- +# Printer Busy Control +# sw1 sw2 sw3 +# --------------- +# off off off Busy not active, CD disabled +# off off on Busy not active, CD enabled +# off on off Busy active on J5-20, CD disabled +# on off off Busy active on J5-19, CD disabled - Factory Set. +# on off on Busy active on J5-19, CD enabled +# +# sw4 Used in conjuction with S4 for comm interface control - Fact 0 +# +# sw5 Secondary Channel Control (Hardware implementation only) - Fact 0 +# +# sw6 ON enables printer BUSY active LOW - Factory Setting +# OFF enables printer BUSY active HIGH - If set to this, ADM31 senses +# +# sw7 ON - steady cursor - Factory Setting +# OFF - blinking cursor +# +# sw8 ON causes selected attribute character to be displayed +# OFF causes SPACE to be displayed instead - Factory Setting +# +# S4 - Interface +# -------------- +# Modem Interface +# S3 S4 S4 S4 S4 +# sw4 sw1 sw2 sw3 sw4 +# --------------------------- +# OFF ON OFF ON OFF Enable RS-232C interface, Direct Connect and +# Current Loop disabled - Factory Setting +# ON ON OFF ON OFF Enable Current Loop interface, Direct Connect +# disabled +# OFF OFF ON OFF ON Enable Direct Connect interface, RS-232C and +# Current Loop Disabled +# +# sw5 ON disables dot stretching mode - Factory Setting +# OFF enables dot stretching mode +# sw6 ON enables blanking function +# OFF enables underline function - Factory Setting +# sw7 ON causes NULLS to be displayed as NULLS +# OFF causes NULLS to be displayed as SPACES - Factory Setting +# +# S5 - Word Structure +# ------------------- +# sw1 ON enables BREAK key - Factory Setting +# OFF disables BREAK key +# sw2 ON selects 50Hz monitor refresh rate +# OFF selects 60Hz monitor refresh rate - Factory Setting +# +# Modem Port Selection +# sw3 sw4 sw5 +# --------------- +# ON ON ON Selects 7 DATA bits, even parity, 2 STOP bits +# OFF ON ON Selects 7 DATA bits, odd parity, 2 STOP bits +# ON OFF ON Selects 7 DATA bits, even parity, 1 STOP bit - Factory Set. +# OFF OFF ON Selects 7 DATA bits, odd parity, 1 STOP bit +# ON ON OFF Selects 8 DATA bits, no parity, 2 STOP bits +# OFF ON OFF Selects 8 DATA bits, no parity, 1 STOP bit +# ON OFF OFF Selects 8 DATA bits, even parity, 1 STOP bit +# OFF OFF OFF Selects 8 DATA bits, odd parity, 1 STOP bit +# +# sw6 ON sends bit 8 a 1 (mark) +# OFF sends bit 8 as 0 (space) - Factory Setting +# sw7 ON selects Block Mode +# OFF selects Conversation Mode - Factory Setting +# sw8 ON selects Full Duplex operation +# OFF selects Half Duplex operation - Factory Setting +# +# S6 - Printer +# ------------ +# sw1, sw2, sw6, sw7 Reserved - Factory 0 +# +# Printer Port Selection +# same as Modem above, bit 8 (when 8 DATA bits) is always = 0 +# +# sw8 ON enables Printer Port +# OFF disables Printer Port - Factory Setting +# +# S7 - Polling Address +# -------------------- +# sw1-7 Establish ASCII character which designates terminal polling address +# ON = logic 0 +# OFF = logic 1 - Factory Setting +# sw8 ON enables Polling Option +# OFF disables Polling Option - Factory Setting +# +# +# On some older adm31s, S4 does not exist, and S5-sw6 is not defined. +# +# This adm31 entry uses underline as the standout mode. +# If the adm31 gives you trouble with standout mode, check the DIP switch in +# position 6, bank @c11, 25% from back end of the circuit board. Should be +# OFF. If there is no such switch, you have an old adm31 and must use oadm31. +# (adm31: removed obsolete ":ma=j^Jk^P^K^Pl ^R^L^L :" -- esr) +adm31|lsi adm31 with sw6 set for underline mode, + am, mir, + cols#80, lines#24, + bel=^G, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET, home=^^, il1=\EE, ind=^J, is2=\Eu\E0, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^A0\r, kf1=^A1\r, + kf2=^A2\r, kf3=^A3\r, kf4=^A4\r, kf5=^A5\r, kf6=^A6\r, + kf7=^A7\r, kf8=^A8\r, kf9=^A9\r, rmir=\Er, rmso=\EG0, + rmul=\EG0, sgr0=\EG0, smir=\Eq, smso=\EG1, smul=\EG1, +adm31-old|o31|old adm31, + rmul@, smso=\EG4, smul@, use=adm31, +# LSI ADM-36 from Col. George L. Sicherman via BRL +adm36|LSI ADM36, + if=/usr/lib/tabset/vt100, + is2=\E<\E>\E[6;?2;?7;?8h\E[4;20;?1;?3;?4;?5;?6;?18;?19l, use=vt100, +# (adm42: removed obsolete ":ma=^K^P:" -- esr) +adm42|lsi adm42, + am, + cols#80, lines#24, + bel=^G, cbt=\EI, clear=\E;, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + cvvis=\EC\E3 \E3(, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, ht=^I, + il1=\EE$<270>, ind=^J, invis@, ip=$<6*>, kcub1=^H, kcud1=^J, + kcuf1=^L, kcuu1=^K, khome=^^, pad=\177, rmir=\Er, rmul@, + smir=\Eq, smul@, + use=adm+sgr, +# The following termcap for the Lear Siegler ADM-42 leaves the +# "system line" at the bottom of the screen blank (for those who +# find it distracting otherwise) +adm42-ns|lsi adm-42 with no system line, + cbt=\EI\EF \011, clear=\E;\EF \011, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<6>\EF \011, + dch1=\EW\EF \011, dl1=\ER\EF \011, ed=\EY\EF \011, + el=\ET\EF \011, il1=\EE\EF \011, rmir=\Er\EF \011, + smir=\Eq\EF \011, + use=adm42, +# ADM 1178 terminal -- rather like an ADM-42. Manual is dated March 1 1985. +# The insert mode of this terminal is commented out because it's broken for our +# purposes in that it will shift the position of every character on the page, +# not just the cursor line! +# From: Michael Driscoll 10 July 1996 +adm1178|1178|lsi adm1178, + am, + cols#80, lines#24, xmc#1, + bel=^G, bold=\E(, cbt=\EI, clear=\E+, cr=^M, cub1=^H, cud1=^J, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + cvvis=\EC\E3 \E3(, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, + home=^^, ht=^I, il1=\EE, ind=^J, ip=$<6*/>, kbs=^H, kcub1=^H, + kcud1=^J, nel=^M^J, pad=\177, rev=\EG4, rmso=\EG0, rmul=\EG0, + sgr0=\E), smso=\EG4, smul=\EG1, + +#### Prime +# +# Yes, Prime makes terminals. These entries were posted by Kevin J. Cummings +# on 14 Dec 1992 and lightly edited by esr. +# + +# Standout mode is dim reverse-video. +pt100|pt200|wren|fenix|prime pt100/pt200, + am, bw, mir, msgr, + cols#80, it#8, lines#24, + cbt=\E[Z, clear=\E?, cr=^M, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\ED, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E0%p1%'!'%+%c%p2%'!'%+%c, cuu=\E[%p1%dA, cuu1=\EM, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[M, ed=\E[J\E[r, + el=\E[K\E[t, flash=\E$$<200/>\E$P, home=\E$B, ht=^I, + il1=\E[L\E[t, ind=^J, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, khome=\E$A, nel=^M^J, rmcup=, + rmir=\E[4l, rmkx=\E[>13l, rmso=\E[m, rmul=\E[m, sgr0=\E[m, + smcup=\E[>1l\E[>2l\E[>16l\E[4l\E[>9l\E[20l\E[>3l\E[>7h\E[>12l\E[1Q, + smir=\E[4h, smkx=\E[>13h, smso=\E[2;7m, smul=\E[4m, +pt100w|pt200w|wrenw|fenixw|prime pt100/pt200 in 132-column mode, + cols#132, + cup=\E[%i%p1%d;%p2%dH, use=pt100, +pt250|Prime PT250, + rmso@, smso@, use=pt100, +pt250w|Prime PT250 in 132-column mode, + rmso@, smso@, use=pt100w, + +#### Qume (qvt) +# +# Qume, Inc. +# 3475-A North 1st Street +# San Jose CA 95134 +# Vox: (800)-457-4447 +# Fax: (408)-473-1510 +# Net: josed@techsupp.wyse.com (Jose D'Oliveira) +# +# Qume was bought by Wyse, but still (as of early 1995) has its own support +# group and production division. +# +# Discontinued Qume models: +# +# The qvt101 and qvt102 listed here are long obsolete; so is the qvt101+ +# built to replace them, and a qvt119+ which was a 101+ with available wide +# mode (132 columns). There was a qvt103 which added vt100/vt131 emulations +# and an ANSI-compatible qvt203 that replaced it. Qume started producing +# ANSI-compatible terminals with the qvt323 and qvt61. +# +# Current Qume models (as of February 1995): +# +# All current Qume terminals have ANSI-compatible operation modes. +# Qume is still producing the qvt62, which features emulations for other +# popular lines such as ADDS, and dual-host capabilities. The qvt82 is +# designed for use as a SCO ANSI terminal. The qvt70 is a color terminal +# with many emulations including Wyse370, Wyse 325, etc. Their newest +# model is the qvt520, which is vt420-compatible. +# +# There are some ancient printing Qume terminals under `Daisy Wheel Printers' + +qvt101|qvt108|qume qvt 101 and QVT 108, + xmc#1, use=qvt101+, + +# This used to have but no or . The BSD termcap +# file had . I've done the safe thing and yanked +# both. The is from BSD, which also claimed bold=\E( and dim=\E). +# What seems to be going on here is that this entry was designed so that +# the normal highlight is bold and standout is dim plus something else +# (reverse-video maybe? But then, are there two sequences?) +qvt101+|qvt101p|qume qvt 101 PLUS product, + am, bw, hs, ul, + cols#80, lines#24, xmc#0, + bel=^G, cbt=\EI, clear=^Z, cnorm=\E.4, cr=^M, cub1=^H, cud1=^J, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\EW, dl1=\ER, dsl=\Eg\Ef\r, ed=\EY, el=\ET, + flash=\Eb$<200>\Ed, fsl=^M, home=^^, ht=^I, hts=\E1, + ich1=\EQ, il1=\EE, ind=^J, invis@, kbs=^H, kcbt=\EI, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, kdl1=\ER, ked=\EY, kel=\ET, + kf1=^A@\r, kf10=^AI\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, + kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, + khome=^^, kich1=\EQ, kil1=\EE, mc4=\EA, mc5=\E@, rmso=\E(, + smso=\E0P\E), tbc=\E3, tsl=\Eg\Ef, + use=adm+sgr, +qvt102|qume qvt 102, + cnorm=\E., use=qvt101, +# (qvt103: added / based on init string -- esr) +qvt103|qume qvt 103, + am, xenl, xon, + cols#80, it#8, lines#24, vt#3, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[2J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, + cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, + hts=\EH, ind=^J, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, rc=\E8, + rev=\E[7m$<2>, ri=\EM$<5>, rmam=\E[?7l, rmkx=\E[?1l\E>, + rmso=\E[m$<2>, rmul=\E[m$<2>, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, + sgr0=\E[m$<2>, smam=\E[?7h, smkx=\E[?1h\E=, + smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, +qvt103-w|qume qvt103 132 cols, + cols#132, lines#24, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=qvt103, +qvt119+|qvt119p|qvt119|qume qvt 119 and 119PLUS terminals, + am, hs, mir, msgr, + cols#80, lines#24, xmc#0, + bel=^G, cbt=\EI, clear=\E*1, cnorm=\E.4, cr=^M, cub1=^H, + cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, + cuu1=^K, cvvis=\E.2, dch1=\EW, dl1=\ER, dsl=\Eg\Ef\r, ed=\Ey, + el=\Et, flash=\En0$<200>\En1, fsl=^M, home=^^, ht=^I, + hts=\E1, il1=\EE, ind=^J, is2=\EDF\EC\EG0\Er\E(\E%EX, + kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^AI\r, + kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + mc4=\EA, mc5=\E@, ri=\EJ, rmir=\Er, smir=\Eq, smul=\EG8, + tbc=\E3, tsl=\Eg\Ef, + use=adm+sgr, +qvt119+-25|qvt119p-25|QVT 119 PLUS with 25 data lines, + lines#25, use=qvt119+, +qvt119+-w|qvt119p-w|qvt119-w|QVT 119 and 119 PLUS in 132 column mode, + cols#132, + is2=\EDF\EC\EG0\Er\E(\E%\EX\En4, use=qvt119+, +qvt119+-25-w|qvt119p-25-w|qvt119-25-w|QVT 119 and 119 PLUS 132 by 25, + lines#25, use=qvt119+, +qvt203|qvt203+|qume qvt 203 Plus, + dch1=\E[P$<7>, dl1=\E[M$<99>, il1=\E[L$<99>, ind=\n$<30>, + ip=$<7>, kf0=\E[29~, kf1=\E[17~, kf2=\E[18~, kf3=\E[19~, + kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, + kf9=\E[28~, rmir=\E[4l, smir=\E[4h, + use=qvt103, +qvt203-w|qvt203-w-am|qume qvt 203 PLUS in 132 cols (w/advanced video), + cols#132, lines#24, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=qvt203, +# +# Since a command is present for enabling 25 data lines, +# a specific terminfo entry may be generated for the 203. +# If one is desired for the QVT 119 PLUS then 25 lines must +# be selected in the status line (setup line 9). +# +qvt203-25|QVT 203 PLUS with 25 by 80 column mode, + cols#80, lines#25, + is2=\E[=40h\E[?3l, use=qvt203, +qvt203-25-w|QVT 203 PLUS with 25 by 132 columns, + cols#132, lines#25, + rs2=\E[?3h\E[=40h, use=qvt203, + +#### Televideo (tvi) +# +# TeleVideo +# 550 East Brokaw Road +# PO Box 49048 95161 +# San Jose CA 95112 +# Vox: (408)-954-8333 +# Fax: (408)-954-0623 +# +# +# There are some tvi terminals that require incredible amounts of padding and +# some that don't. I'm assuming tvi912 and tvi920 are the old slow ones, and +# tvi912b, tvi912c, tvi920b, tvi920c are the new ones that don't need padding. +# +# All of these terminals (912 to 970 and the tvipt) are discontinued. Newer +# Televideo terminals are ANSI and PC-ANSI compatible. + +tvi803|televideo 803, + clear=\E*$<10>, use=tvi950, + +# Vanilla tvi910 -- W. Gish 10/29/86 +# Switch settings are: +# +# S1 1 2 3 4 +# D D D D 9600 +# D D D U 50 +# D D U D 75 +# D D U U 110 +# D U D D 135 +# D U D U 150 +# D U U D 300 +# D U U U 600 +# U D D D 1200 +# U D D U 1800 +# U D U D 2400 +# U D U U 3600 +# U U D D 4800 +# U U D U 7200 +# U U U D 9600 +# U U U U 19200 +# +# S1 5 6 7 8 +# U D X D 7N1 (data bits, parity, stop bits) (X means ignored) +# U D X U 7N2 +# U U D D 7O1 +# U U D U 7O2 +# U U U D 7E1 +# U U U U 7E2 +# D D X D 8N1 +# D D X U 8N2 +# D U D D 8O1 +# D U U U 8E2 +# +# S1 9 Autowrap +# U on +# D off +# +# S1 10 CR/LF +# U do CR/LF when CR received +# D do CR when CR received +# +# S2 1 Mode +# U block +# D conversational +# +# S2 2 Duplex +# U half +# D full +# +# S2 3 Hertz +# U 50 +# D 60 +# +# S2 4 Edit mode +# U local +# D duplex +# +# S2 5 Cursor type +# U underline +# D block +# +# S2 6 Cursor down key +# U send ^J +# D send ^V +# +# S2 7 Screen colour +# U green on black +# D black on green +# +# S2 8 DSR status (pin 6) +# U disconnected +# D connected +# +# S2 9 DCD status (pin 8) +# U disconnected +# D duplex +# +# S2 10 DTR status (pin 20) +# U disconnected +# D duplex +# (tvi910: removed obsolete ":ma=^Kk^Ll^R^L:"; added , , , +# , , , , from SCO entry -- esr) +tvi910|televideo model 910, + am, msgr, + cols#80, it#8, lines#24, xmc#1, + bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=\EY, el=\ET, + home=\E=\001\001, hpa=\E]%p1%{32}%+%c, ht=^I, + if=/usr/share/tabset/stdcrt, ind=^J, invis@, kbs=^H, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^AI\r, kf1=^A@\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + vpa=\E[%p1%{32}%+%c, use=adm+sgr, +# From: Alan R. Rogers +# as subsequently hacked over by someone at SCO +# (tvi910+: removed obsolete ":ma=^K^P^L :" -- esr) +# +# Here are the 910+'s DIP switches (U = up, D = down, X = don't care): +# +# S1 1 2 3 4: +# D D D D 9600 D D D U 50 D D U D 75 D D U U 110 +# D U D D 135 D U D U 150 D U U D 300 D U U U 600 +# U D D D 1200 U D D U 1800 U D U D 2400 U D U U 3600 +# U U D D 4800 U U D U 7200 U U U D 9600 U U U U 19200 +# +# S1 5 6 7 8: +# U D X D 7N1 U D X U 7N2 U U D D 7O1 U U D U 7O2 +# U U U D 7E1 U U U U 7E2 D D X D 8N1 D D X U 8N2 +# D U D D 8O1 D U U U 8E2 +# +# S1 9 Autowrap (U = on, D = off) +# S1 10 CR/LF (U = CR/LF on CR received, D = CR on CR received) +# S2 1 Mode (U = block, D = conversational) +# S2 2 Duplex (U = half, D = full) +# S2 3 Hertz (U = 50, D = 60) +# S2 4 Edit mode (U = local, D = duplex) +# S2 5 Cursor type (U = underline, D = block) +# S2 6 Cursor down key (U = send ^J, D = send ^V) +# S2 7 Screen colour (U = green on black, D = black on green) +# S2 8 DSR status (pin 6) (U = disconnected, D = connected) +# S2 9 DCD status (pin 8) (U = disconnected, D = connected) +# S2 10 DTR status (pin 20) (U = disconnected, D = connected) +# +tvi910+|televideo 910+, + dch1=\EW, dl1=\ER$<33*>, home=^^, ich1=\EQ, il1=\EE$<33*>, + kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, + kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, + ll=\E=7\s, + use=tvi910, + +# (tvi912: removed obsolete ":ma=^K^P^L :", added and +# from BRL entry -- esr) +tvi912|tvi914|tvi920|old televideo 912/914/920, + am, msgr, + cols#80, it#8, lines#24, xmc#1, + bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER$<33*>, ed=\Ey, el=\ET, flash=\Eb$<50/>\Ed, home=^^, + ht=^I, hts=\E1, ich1=\EQ, if=/usr/share/tabset/stdcrt, + il1=\EE$<33*>, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, + kcuu1=^K, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, + kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, + kf9=^AH\r, khome=^^, rmso=\Ek, rmul=\Em, smso=\Ej, smul=\El, + tbc=\E3, +# the 912 has a key that's like shift: 8 xmits "^A8\r". +# The 920 has this plus real function keys that xmit different things. +# Terminfo makes you use the funct key on the 912 but the real keys on the 920. +tvi912c|tvi912b|new televideo 912, + dl1=\ER$<5*>, il1=\EE$<5*>, use=tvi912, +# set to page 1 when entering curses application (\E-17 ) +# reset to page 0 when exiting curses application (\E-07 ) +tvi912-2p|tvi920-2p|tvi-2p|televideo w/2 pages, + rmcup=\E-07\s, smcup=\E-17\s, use=tvi912, +# We got some new tvi912c terminals that act really weird on the regular +# termcap, so one of our gurus worked this up. Seems that cursor +# addressing is broken. +tvi912cc|tvi912 at cowell college, + cup@, use=tvi912c, + +# Here are the switch settings for the tvi920c: +# +# S1 (Line), and S3 (Printer) baud rates -- put one, and only one, switch down: +# 2: 9600 3: 4800 4: 2400 5: 1200 +# 6: 600 7: 300 8: 150 9: 75 +# 10: 110 +# +# S2 UART/Terminal options: +# Up Down +# 1: Not used Not allowed +# 2: Alternate character set Standard character set +# 3: Full duplex Half duplex +# 4: 50 Hz refresh 60 Hz refresh +# 5: No parity Send parity +# 6: 2 stop bits 1 stop bit +# 7: 8 data bits 7 data bits +# 8: Not used Not allowed on Rev E or lower +# 9: Even parity Odd parity +# 10: Steady cursor Blinking cursor +# (On Rev E or lower, use W25 instead of switch 10.) +# +# S5 UART/Terminal options: +# Open Closed +# 1: P3-6 Not connected DSR received on P3-6 +# 2: P3-8 Not connected DCD received on P3-8 +# +# 3 Open, 4 Open: P3-20 Not connected +# 3 Open, 4 Closed: DTR on when terminal is on +# 3 Closed, 4 Open: DTR is connected to RTS +# 3 Closed, 4 Closed: Not allowed +# +# 5 Closed: HDX printer (hardware control) Rev. K with extension port off, +# all data transmitted out of the modem port (P3) will also be +# transmitted out of the printer port (P4). +# +# 6 Open, 7 Open: Not allowed +# 6 Open, 7 Closed: 20ma current loop input +# 6 Closed, 7 Open: RS232 input +# 6 Closed, 7 Closed: Not allowed +# +# Jumper options: +# If the jumper is installed, the effect will occur (the next time the terminal +# is switched on). +# +# S4/W31: Enables automatic LF upon receipt of CR from +# remote or keyboard. +# S4/W32: Enables transmission of EOT at the end of Send. If not +# installed, a carriage return is sent. +# S4/W33: Disables automatic carriage return in column 80. +# S4/W34: Selects Page Print Mode as initial condition. If not +# installed, Extension Mode is selected. +# +tvi920b|tvi920c|new televideo 920, + dl1=\ER$<5*>, il1=\EE$<5*>, kf0=^AI\r, kf1=^A@\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, + use=tvi912, + +# Televideo 921 and variants +# From: Tim Theisen 22 Sept 1995 +# (tvi921: removed :ko=bt: before translation, I see no backtab cap; +# also added empty to suppress tic warning -- esr) +tvi921|televideo model 921 with sysline same as page & real vi function, + am, hs, xenl, xhp, + cols#80, lines#24, xmc#0, + acsc=, clear=^Z, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<3/>, cuu1=^K, + cvvis=\E.2, dch1=\EW, dl1=\ER$<1*/>, dsl=\Ef\r\Eg, ed=\EY, + el=\ET, fsl=\Eg, home=^^, ht=^I, ich1=\EQ, + if=/usr/share/tabset/stdcrt, il1=\EE, ind=^J, invis@, + is2=\El\E"\EF1\E.3\017\EA\E<, kbs=^H, kclr=^Z, kcub1=^H, + kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER$<1*/>, + ked=\EY, kel=\ET, kich1=\EQ, kil1=\EE, nel=^M^J, rmacs=\E%, + rmir=, smacs=\E$, smir=, tsl=\Ef\EG0, + use=adm+sgr, +# without the beeper +# (tvi92B: removed :ko=bt: before translation, I see no backtab cap; +# also added empty to suppress tic warning -- esr) +tvi92B|televideo model 921 with sysline same as page & real vi function, + am, hs, xenl, xhp, + cols#80, lines#24, xmc#0, + acsc=, clear=^Z, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<3/>, cuu1=^K, + cvvis=\E.2, dch1=\EW, dl1=\ER$<1*/>, dsl=\Ef\r\Eg, ed=\EY, + el=\ET, flash=\Eb$<200/>\Ed, fsl=\Eg, home=^^, ht=^I, + ich1=\EQ, if=/usr/share/tabset/stdcrt, il1=\EE, ind=^J, + invis@, is2=\El\E"\EF1\E.3\017\EA\E<, kbs=^H, kclr=^Z, + kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, + kdl1=\ER$<1*/>, ked=\EY, kel=\ET, kich1=\EQ, kil1=\EE, + nel=^M^J, rmacs=\E%, rmir=, smacs=\E$, smir=, tsl=\Ef\EG0, + use=adm+sgr, +# (tvi92D: removed :ko=bt: before translation, I see no backtab cap -- esr) +tvi92D|tvi92B with DTR instead of XON/XOFF & better padding, + dl1=\ER$<2*/>, il1=\EE$<2*/>, + is2=\El\E"\EF1\E.3\016\EA\E<, kdl1=\ER$<2*/>, + kil1=\EE$<2*/>, + use=tvi92B, + +# (tvi924: This used to have , . I put the new strings +# in from a BSD termcap file because it looks like they do something the +# old ones skip -- esr) +tvi924|televideo tvi924, + am, bw, hs, in, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, wsl#80, xmc#0, + bel=^G, blink=\EG2, cbt=\EI, civis=\E.0, clear=\E*0, + cnorm=\E.3, cr=^M, csr=\E_%p1%{32}%+%c%p2%{32}%+%c, + cub1=^H, cud1=^V, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, cvvis=\E.1, + dch1=\EW, dl1=\ER, dsl=\Es0\Ef\031, ed=\Ey, el=\Et, + flash=\Eb$<200>\Ed, fsl=\031\Es1, home=^^, ht=^I, hts=\E1, + ich1=\EQ, if=/usr/share/tabset/stdcrt, il1=\EE, ind=^J, + invis@, is1=\017\E%\E'\E(\EDF\EC\EG0\EN0\Es0\Ev0, + kbs=^H, kclr=\E*0, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, + kdch1=\EW, kdl1=\ER, ked=\Ey, kel=\Et, kf0=^A@\r, kf1=^AA\r, + kf10=^AJ\r, kf11=^AK\r, kf12=^AL\r, kf13=^AM\r, kf14=^AN\r, + kf15=^AO\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, kf5=^AE\r, + kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, khome=^^, + kich1=\EQ, kil1=\EE, lf0=F1, lf1=F2, lf10=F11, lf2=F3, lf3=F4, + lf4=F5, lf5=F6, lf6=F7, lf7=F8, lf8=F9, lf9=F10, + pfkey=\E|%p1%'1'%+%c%p2%s\031, ri=\Ej, tbc=\E3, tsl=\Ef, use=adm+sgr, + +# TVI925 DIP switches. In each of these, D = Down and U = Up, +# +# Here are the settings for the external (baud) switches (S1): +# +# Position Baud +# 7 8 9 10 [Printer] +# 1 2 3 4 [Main RS232] +# ----------------------------------------------------- +# D D D D 9600 +# D D D U 50 +# D D U D 75 +# D D U U 110 +# D U D D 135 +# D U D U 150 +# D U U D 300 +# D U U U 600 +# U D D D 1200 +# U D D U 1800 +# U D U D 2400 +# U D U U 3600 +# U U D D 4800 +# U U D U 7200 +# U U U D 9600 +# U U U U 19200 +# +# +# Settings for word length and stop-bits (S1) +# +# Position Description +# 5 6 +# --------------------------- +# U - 7-bit word +# D - 8-bit word +# - U 2 stop bits +# - D 1 stop bit +# +# +# S2 (external) settings +# +# Position Up Dn Description +# -------------------------------------------- +# 1 X Local edit +# X Duplex edit (transmit editing keys) +# -------------------------------------------- +# 2 X 912/920 emulation +# X 925 +# -------------------------------------------- +# 3 X +# 4 X No parity +# 5 X +# -------------------------------------------- +# 3 X +# 4 X Odd parity +# 5 X +# -------------------------------------------- +# 3 X +# 4 X Even parity +# 5 X +# -------------------------------------------- +# 3 X +# 4 X Mark parity +# 5 X +# -------------------------------------------- +# 3 X +# 4 X Space parity +# 5 X +# -------------------------------------------- +# 6 X White on black display +# X Black on white display +# -------------------------------------------- +# 7 X Half Duplex +# 8 X +# -------------------------------------------- +# 7 X Full Duplex +# 8 X +# -------------------------------------------- +# 7 X Block mode +# 8 X +# -------------------------------------------- +# 9 X 50 Hz +# X 60 Hz +# -------------------------------------------- +# 10 X CR/LF (Auto LF) +# X CR only +# +# S3 (internal switch) settings: +# +# Position Up Dn Description +# -------------------------------------------- +# 1 X Keyclick off +# X Keyclick on +# -------------------------------------------- +# 2 X English +# 3 X +# -------------------------------------------- +# 2 X German +# 3 X +# -------------------------------------------- +# 2 X French +# 3 X +# -------------------------------------------- +# 2 X Spanish +# 3 X +# -------------------------------------------- +# 4 X Blinking block cursor +# 5 X +# -------------------------------------------- +# 4 X Blinking underline cursor +# 5 X +# -------------------------------------------- +# 4 X Steady block cursor +# 5 X +# -------------------------------------------- +# 4 X Steady underline cursor +# 5 X +# -------------------------------------------- +# 6 X Screen blanking timer (ON) +# X Screen blanking timer (OFF) +# -------------------------------------------- +# 7 X Page attributes +# X Line attributes +# -------------------------------------------- +# 8 X DCD disconnected +# X DCD connected +# -------------------------------------------- +# 9 X DSR disconnected +# X DSR connected +# -------------------------------------------- +# 10 X DTR Disconnected +# X DTR connected +# -------------------------------------------- +# +# (tvi925: BSD has . I got and from there -- esr) +tvi925|televideo 925, + am, bw, hs, ul, + cols#80, lines#24, xmc#1, + bel=^G, cbt=\EI, clear=^Z, cnorm=\E.4, cr=^M, cub1=^H, cud1=^V, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + cvvis=\E.2, dch1=\EW, dl1=\ER, dsl=\Eh, ed=\EY, el=\ET, + flash=\Eb$<200>\Ed, fsl=^M\Eg, home=^^, ht=^I, hts=\E1, + ich1=\EQ, il1=\EE, ind=^J, invis@, is2=\El\E", kbs=^H, kclr=^Z, + kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, + ked=\EY, kel=\ET, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, + kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, + kf9=^AH\r, khome=^^, kich1=\EQ, kil1=\EE, ri=\Ej, tbc=\E3, + tsl=\Eh\Ef, + use=adm+sgr, +# TeleVideo 925 from Mitch Bradley via BRL +# to avoid "magic cookie" standout glitch: +tvi925-hi|TeleVideo Model 925 with half intensity standout mode, + xmc@, + kbs=^H, kcub1=^H, kcud1=^J, rmso=\E(, smso=\E), use=tvi925, + +# From: Todd Litwin 28 May 1993 +# Originally Tim Curry, Univ. of Central Fla., 5/21/82 +# for additional capabilities, +# The following tvi descriptions from B:pjphar and virus!mike +# is for all 950s. It sets the following attributes: +# full duplex (\EDF) write protect off (\E() +# conversation mode (\EC) graphics mode off (\E%) +# white on black (\Ed) auto page flip off (\Ew) +# turn off status line (\Eg) clear status line (\Ef\r) +# normal video (\E0) monitor mode off (\EX or \Eu) +# edit mode (\Er) load blank char to space (\Ee\040) +# line edit mode (\EO) enable buffer control (^O) +# protect mode off (\E\047) duplex edit keys (\El) +# program unshifted send key to send line all (\E016) +# program shifted send key to send line unprotected (\E004) +# set the following to nulls: +# field delimiter (\Ex0\200\200) +# line delimiter (\Ex1\200\200) +# start-protected field delimiter (\Ex2\200\200) +# end-protected field delimiter (\Ex3\200\200) +# set end of text delimiter to carriage return/null (\Ex4\r\200) +# +# TVI 950 Switch Setting Reference Charts +# +# TABLE 1: +# +# S1 1 2 3 4 5 6 7 8 9 10 +# +-----------------------+-----+-----+-----------------------+ +# | Computer Baud Rate |Data |Stop | Printer Baud Rate | +# | |Bits |Bits | | +# +------+-----------------------+-----+-----+-----------------------+ +# | Up | See | 7 | 2 | See | +# +------+-----------------------+-----+-----+-----------------------+ +# | Down | TABLE 2 | 8 | 1 | TABLE 2 | +# +------+-----------------------+-----+-----+-----------------------+ +# +# +# S2 1 2 3 4 5 6 7 8 9 10 +# +-----+-----+-----------------+-----+-----------+-----+-----+ +# |Edit |Cursr| Parity |Video|Transmiss'n| Hz |Click| +# +------+-----+-----+-----------------+-----+-----------+-----+-----+ +# | Up | Dplx|Blink| See |GonBk| See | 60 | Off | +# +------+-----+-----+-----------------+-----+-----------+-----+-----+ +# | Down |Local|St'dy| TABLE 3 |BkonG| CHART | 50 | On | +# +------+-----+-----+-----------------+-----+-----------+-----+-----+ +# +# TABLE 2: +# +# +-----------+-----+-----+-----+-----+-----------+ +# | Display | 1 | 2 | 3 | 4 | Baud | +# +-----------+-----+-----+-----+-----+ | +# | Printer | 7 | 8 | 9 | 10 | Rate | +# +-----------+-----+-----+-----+-----+-----------+ +# | D | D | D | D | 9600 | +# | U | D | D | D | 50 | +# | D | U | D | D | 75 | +# | U | U | D | D | 110 | +# | D | D | U | D | 135 | +# | U | D | U | D | 150 | +# | D | U | U | D | 300 | +# | U | U | U | D | 600 | +# | D | D | D | U | 1200 | +# | U | D | D | U | 1800 | +# | D | U | D | U | 2400 | +# | U | U | D | U | 3600 | +# | D | D | U | U | 4800 | +# | U | D | U | U | 7200 | +# | D | U | U | U | 9600 | +# | U | U | U | U | 19200 | +# +-----+-----+-----+-----+-----------+ +# +# TABLE 3: +# +-----+-----+-----+-----------+ +# | 3 | 4 | 5 | Parity | +# +-----+-----+-----+-----------+ +# | X | X | D | None | +# | D | D | U | Odd | +# | D | U | U | Even | +# | U | D | U | Mark | +# | U | U | U | Space | +# +-----+-----+-----+-----------+ +# X = don't care +# +# CHART: +# +-----+-----+-----------------+ +# | 7 | 8 | Communication | +# +-----+-----+-----------------+ +# | D | D | Half Duplex | +# | D | U | Full Duplex | +# | U | D | Block | +# | U | U | Local | +# +-----+-----+-----------------+ +# +# (tvi950: early versions had obsolete ":ma=^Vj^Kk^Hh^Ll^^H:". +# I also inserted and ; the :ko: string indicated that +# should be present and all tvi native modes use the same string for this. +# Finally, note that BSD has cud1=^V. -- esr) +tvi950|televideo 950, + am, hs, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, xmc#1, + acsc=d\rc\014e\nb\011i\013, bel=^G, cbt=\EI, clear=\E*, + cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, dsl=\Eg\Ef\r, ed=\Ey, el=\Et, flash=\Eb$<200/>\Ed, + fsl=^M, home=^^, ht=^I, hts=\E1, ich1=\EQ, il1=\EE, ind=^J, + invis@, + is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\El\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\011\Ex3\200\200\Ex4\r\200\Ef\r, + kbs=^H, kcbt=\EI, kclr=\E*, kcub1=^H, kcud1=^V, kcuf1=^L, + kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\Ey, kel=\Et, kf0=^A0\r, + kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + kich1=\EQ, kil1=\EE, mc4=\Ea, mc5=\E`, ri=\Ej, rmacs=^X, + rmir=\Er, smacs=^U, smir=\Eq, tbc=\E3, tsl=\Eg\Ef, + use=adm+sgr, +# +# is for 950 with two pages adds the following: +# set 48 line page (\E\\2) +# place cursor at page 0, line 24, column 1 (\E-07 ) +# set local (no send) edit keys (\Ek) +# +# two page 950 adds the following: +# when entering ex, set 24 line page (\E\\1) +# when exiting ex, reset 48 line page (\E\\2) +# place cursor at 0,24,1 (\E-07 ) +# set duplex (send) edit keys (\El) when entering vi +# set local (no send) edit keys (\Ek) when exiting vi +# +tvi950-2p|televideo950 w/2 pages, + is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\011\Ex3\200\200\Ex4\r\200\E\\2\E-07 \011, + rmcup=\E\\2\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, + smkx=\El, + use=tvi950, +# +# is for 950 with four pages adds the following: +# set 96 line page (\E\\3) +# place cursor at page 0, line 24, column 1 (\E-07 ) +# +# four page 950 adds the following: +# when entering ex, set 24 line page (\E\\1) +# when exiting ex, reset 96 line page (\E\\3) +# place cursor at 0,24,1 (\E-07 ) +# +tvi950-4p|televideo950 w/4 pages, + is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\011\Ex3\200\200\Ex4\r\200\E\\3\E-07 \011, + rmcup=\E\\3\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, + smkx=\El, + use=tvi950, +# +# for reverse video 950 changes the following: +# set reverse video (\Ed) +# +# set vb accordingly (\Ed ...delay... \Eb) +# +tvi950-rv|televideo950 rev video, + flash=\Ed$<200/>\Eb, + is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\El\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\011\Ex3\200\200\Ex4\r\200, use=tvi950, + +# tvi950-rv-2p uses the appropriate entries from 950-2p and 950-rv +tvi950-rv-2p|televideo950 rev video w/2 pages, + flash=\Ed$<200/>\Eb, + is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\011\Ex3\200\200\Ex4\r\200\E\\2\E-07\s, + rmcup=\E\\2\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, + smkx=\El, + use=tvi950, + +# tvi950-rv uses the appropriate entries from 950-4p and 950-rv +tvi950-rv-4p|televideo950 rev video w/4 pages, + flash=\Ed$<200/>\Eb, + is2=\EDF\EC\Eb\EG0\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\011\Ex3\200\200\Ex4\r\200\E\\3\E-07\s, + rmcup=\E\\3\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, + smkx=\El, + use=tvi950, +# From: Andreas Stolcke +# (tvi955: removed obsolete ":ma:=^Vj^Kk^Hh^Ll^^H"; +# removed incorrect (and overridden) ":do=^J:"; fixed broken continuations in +# the :rs: string, inserted the implied by the termcap :ko: string. Note +# the :ko: string had :cl: in it, which means that one of the original +# , had to be wrong; set because that's what +# the 950 has. Finally, corrected the string to match the 950 and what +# ko implies -- esr) +# If the BSD termcap file was right, would +# also work. +tvi955|televideo 955, + mc5i, msgr@, + it#8, xmc@, + acsc=0_`RjHkGlFmEnIoPqKsQtMuLvOwNxJ, blink=\EG2, + civis=\E.0, cnorm=\E.2, cud1=^V, cup=\E[%i%p1%d;%p2%dH, + cvvis=\E.1, dim=\E[=5h, ind@, invis=\EG1, + is2=\E[=3l\EF1\Ed\EG0\E[=5l\E%\El, kctab=\E2, khts=\E1, + knp=\EK, kpp=\EJ, krmir=\EQ, ktbc=\E3, mc0=\EP, rmacs=\E%, + rmam=\E[=7l, rmxon=^N, + rs1=\EDF\EC\Eg\Er\EO\E'\E(\Ew\EX\Ee \017\E0P\E6\200\E0p\E4\200\Ef\r, + sgr0=\EG0\E[=5l, smacs=\E$, smam=\E[=7h, smxon=^O, + use=tvi950, +tvi955-w|955-w|televideo955 w/132 cols, + cols#132, + is2=\E[=3h\EF1\Ed\EG0\E[=5l\E%\El, use=tvi955, +# use half-intensity as normal mode, full intensity as +tvi955-hb|955-hb|televideo955 half-bright, + bold=\E[=5l, dim@, is2=\E[=3l\EF1\Ed\EG0\E[=5h\E%\El, + sgr0=\EG0\E[=5h, + use=tvi955, +# From: Humberto Appleton , 880521 UT Austin +# (tvi970: removed ":sg#0:"; removed =\E[m, =\E[m; +# added ////// from BRL. +# According to BRL we could have =\E>, =\E= but I'm not sure what +# it does to the function keys. I deduced /. +# also added empty to suppress tic warning, -- esr) +tvi970|televideo 970, + am, da, db, mir, msgr, + cols#80, it#8, lines#24, + acsc=, cbt=\E[Z, clear=\E[H\E[2J, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=\ED, cuf1=\E[C, cup=\E[%i%p1%d;%p2%df, + cuu1=\EM, cvvis=\E[1Q, dch1=\E[P, dl1=\E[M, dsl=\Eg\Ef\r, + ed=\E[J, el=\E[K, flash=\E[5m$<200/>\E[m, home=\E[H, + hpa=\E[%i%p1%dG, ht=^I, il1=\E[L, + is2=\E<\E[?21l\E[19h\E[1Q\E[10l\E[7l\E[H\E[2J, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\E?a, kf2=\E?b, kf3=\E?c, kf4=\E?d, kf5=\E?e, kf6=\E?f, + kf7=\E?g, kf8=\E?h, kf9=\E?i, khome=\E[H, ri=\EM, rmacs=\E(B, + rmam=\E[?7h, rmcup=, rmir=\E[4l, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smacs=\E(B, smam=\E[?7l, + smcup=\E[?20l\E[?7h\E[1Q, smir=\E[4h, smso=\E[7m, + smul=\E[4m, vpa=\E[%i%p1%dd, +tvi970-vb|televideo 970 with visual bell, + flash=\E[?5h\200\200\200\200\200\200\200\200\200\200\200\200\200\E[?5l, use=tvi970, +tvi970-2p|televideo 970 with using 2 pages of memory, + rmcup=\E[H\E[J\E[V, smcup=\E[U\E[?20l\E[?7h\E[1Q, + use=tvi970, +# Works with vi and rogue. NOTE: Esc v sets autowrap on, Esc u sets 80 chars +# per line (rather than 40), Esc K chooses the normal character set. Not sure +# padding is needed, but adapted from the tvi920c termcap. The and +# strings are klutzy, but at least use no screen space. +# (tvipt: removed obsolete ":ma=^Kk^Ll^R^L:". I wish we knew , +# its absence means =\Ev isn't save to use. -- esr) +# From: Gene Rochlin 9/19/84. +# The ////, and caps are from BRL, which says: +# F1 and F2 should be programmed as ^A and ^B; required for UNIFY. +tvipt|televideo personal terminal, + am, + cols#80, lines#24, + cbt=\EI, clear=^Z, cub1=^H, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dl1=\ER$<5*>, + ed=\EY, el=\ET, home=^^, if=/usr/share/tabset/stdcrt, + il1=\EE$<5*>, is2=\Ev\Eu\EK, kbs=^H, kcub1=^H, kcud1=^J, + kcuf1=^L, kcuu1=^K, kf0=^A, kf1=^B, khome=^^, mc4=^T, mc5=^R, + rmso=\EF, rmul=\EF, smso=\EG1@A\EH, smul=\EG1B@\EH, +# From: Nathan Peterson , 03 Sep 1996 +tvi9065|televideo 9065, + am, bw, chts, hs, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lh#1, lines#25, lm#0, lw#9, ma#4, nlab#8, vt#0, + wnum#0, wsl#30, + acsc=0_'rjhkglfmeniopxjqksqtmulvown, bel=^G, + blink=\EG2, bold=\EG\,, cbt=\EI, civis=\E.0, clear=^Z, + cnorm=\E.3, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, + cub1=^H, cud=\E[%p1%dB, cud1=^V, cuf=\E[%p1%dC, cuf1=^L, + cup=\E=%p1%' '%+%c%p2%' '%+%c, cuu=\E[%p1%dA, cuu1=^K, + cvvis=\E.2, dch=\E[%p1%dP, dch1=\EW, dim=\EGp, + dl=\E[%p1%dM, dl1=\ER, dsl=\E_30\r, ech=\E[%p1%d@, ed=\EY, + el=\ET, flash=\Eb$<15>\Ed, fsl=^M, home=^^, ht=^I, hts=\E1, + ich=\E[%p1%d@, if=/usr/share/tabset/stdcrt, + il=\E[%p1%dL, il1=\EE, ind=^J, indn=\E[%p1%dS, invis=\EG1, + ip=$<3>, + is1=\E"\E%\E'\E(\EG@\EO\EX\E[=5l\E[=6l\E[=7h\Ed\Er, + is2=\EF2\EG0\E\\L, is3=\E<\E[=4l\E[=8h, kHOM=\E\s\s\s, + kbs=^H, kcbt=\EI, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, + kdch1=\EW, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, kf12=^AK\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, ll=\E[25;1H, + mc0=\E[0;0i, mc4=\Ea, mc5=\E`, nel=^M^J, + pfkey=\E|%p1%'0'%+%c3%p2%s\031, + pfloc=\E|%p1%'0'%+%c2%p2%s\031, + pfx=\E|%p1%'0'%+%c1%p2%s\031, + pln=\E_%p1%'?'%+%c%p2%s\r, prot=\E&, + rep=\E[%p2%db%p1%c, rev=\EG4, + rf=/usr/share/tabset/stdcrt, ri=\Ej, rin=\E[%p1%dT, + rmacs=\E%, rmam=\E[=7l, rmcup=\E.3\Er\E[1;25r\E[25;0H, + rmdc=\200, rmir=\Er, rmln=\E[4;1v, rmso=\EG0, rmul=\EG0, + rmxon=^N, rs1=\EC\EDF\E[0;0v\E[8;1v\E[=65l, + rs2=\E.b\E[10;20v\E[14;1v\E[3;0v\E[7;0v\E[=11.h\E[=12.h\E[=13.h\E[=14.h\E[=15l\E[=20h\E[=60l\E[=61h\E[=9l\E[=10l\E[=21l\E[=23l\E[=3l\E_40\E_50\En\Ew\Ee \Ex0\200\200\Ex1\200\200\Ex2\200\200\Ex3\200\200\Ex4\200\200\E1, + rs3=\E[=19h\E.3\E9\E0O\200\200\200\200\200\E0o\200\200\200\200\200\E0J\177\200\200\200\200, + sgr=\EG0%?%p1%t\EGt%;%?%p2%t\EG8%;%?%p3%t\EG4%;%?%p4%t\EG2%;%?%p5%t\EGp%;%?%p6%t\EG\,%;%?%p7%t\EG1%;%?%p9%t\E$%e\E%%%;, + sgr0=\EG0, smacs=\E$, smam=\E=7h, smcup=\E.2, smdc=\Er, + smir=\Eq, smln=\E[4;2v, smso=\EGt, smul=\EG8, smxon=^O, + tbc=\E3, tsl=\E[4;1v\E_30, uc=\EG8\EG0, + +#### Visual (vi) +# +# In September 1993, Visual Technology of Westboro, Massachusetts, +# merged with White Pine Software of Nashua, New Hampshire. +# +# White Pine Software may be contacted at +1 603/886-9050. +# Or visit White Pine on the World Wide Web at URL http://www.wpine.com. +# + +# Visual 50 from Beau Shekita, BTL-Whippany +# Recently I hacked together the following termcap for Visual +# Technology's Visual 50 terminal. It's a slight modification of +# the vt52 termcap. +# It's intended to run when the Visual 50 is in vt52 emulation mode +# (I know what you're thinking; if it's emulating a vt52, then why +# another termcap? Well, it turns out that the Visual 50 can handle +# and db(?) among other things, which the vt52 can't) +# The termcap works OK for the most part. The only problem is on +# character inserts. The whole line gets painfully redrawn for each +# character typed. Any suggestions? +# Beau's entry is combined with the vi50 entry from University of Wisconsin. +# Note especially the function. - are really l4-l6 in +# disguise; - are really l1-l3. +vi50|visual 50, + am, da, db, msgr, + cols#80, it#8, lines#24, + bel=^G, cbt=\Ez$<4/>, clear=\EH\EJ, cr=^M, cub1=^H, cud1=\EB, + cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, + dl1=\EM$<3*/>, ed=\EJ, el=\EK$<16/>, home=\EH, ht=^I, + il1=\EL, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kf1=\EP, kf2=\EQ, kf3=\ER, kf4=\EV, kf5=\EE, + kf6=\E], kf7=\EL, kf8=\Ev, kf9=\EM, khome=\EH, nel=^M^J, + ri=\EI, rmso=\ET, rmul=\EW, smso=\EU, smul=\ES, +# this one was BSD & SCO's vi50 +vi50adm|visual 50 in adm3a mode, + am, msgr, + cols#80, it#8, lines#24, + bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dl1=\EM, + ed=\Ek, el=\EK, home=\EH, ht=^I, il1=\EL, ind=^J, kbs=^H, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\EH, + rmso=\ET, smso=\EU, +# From: Jeff Siegal +vi55|Visual 55, + am, mir, msgr, + cols#80, it#8, lines#24, + clear=\Ev, csr=\E_%p1%'A'%+%c%p2%'A'%+%c, cub1=^H, + cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, dch1=\Ew, dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, + il1=\EL, is2=\Ev\E_AX\Eb\EW\E9P\ET, kbs=^H, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, ri=\EI, rmir=\Eb, rmso=\ET, + smir=\Ea, smso=\EU, + +# Visual 200 from BRL +# The following switch settings are assumed for normal operation: +# FULL_DUPLEX SCROLL CR +# AUTO_NEW_LINE_ON VISUAL_200_EMULATION_MODE +# Other switches may be set for operator convenience or communication +# requirements. +# Character insertion is kludged in order to get around the "beep" misfeature. +# (This cap is commented out because / is more efficient -- esr) +# Supposedly "4*" delays should be used for , , , , +# and strings, but we seem to get along fine without them. +vi200|visual 200, + am, mir, msgr, + cols#80, it#8, lines#24, + acsc=, bel=^G, cbt=\Ez, clear=\Ev, cnorm=\Ec, cr=^M, cub1=^H, + cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, cvvis=\Ed, dch1=\EO, dim=\E4, dl1=\EM, ed=\Ey, + el=\Ex, home=\EH, ht=^I, hts=\E1, il1=\EL, ind=^J, invis=\Ea, + kbs=^H, kclr=\Ev, kctab=\E2, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EO, kdl1=\EM, ked=\EJ, kel=\Et, kf0=\E?p, + kf1=\E?q, kf2=\E?r, kf3=\E?s, kf4=\E?t, kf5=\E?u, kf6=\E?v, + kf7=\E?w, kf8=\E?x, kf9=\E?y, khome=\EH, khts=\E1, kich1=\Ei, + kil1=\EL, krmir=\Ej, mc0=\EH\E], mc4=\EX, mc5=\EW, ri=\EI, + rmacs=\EG, rmkx=\E>, rmso=\E3, + rs1=\E3\Eb\Ej\E\\\El\EG\Ec\Ek\EX, sgr0=\E3\Eb, + smacs=\EF, smkx=\E=, smso=\E4, tbc=\Eg, +# The older Visuals didn't come with function keys. This entry uses +# and so that the keypad keys can be used as function keys. +# If your version of vi doesn't support function keys you may want +# to use vi200-f. +vi200-f|visual 200 no function keys, + is2=\E3\Eb\Ej\E\\\El\EG\Ed\Ek, kf0=\E?p, kf1=\E?q, + kf2=\E?r, kf3=\E?s, kf4=\E?t, kf5=\E?u, kf6=\E?v, kf7=\E?w, + kf8=\E?x, kf9=\E?y, rmkx=\E>, rmso@, smkx=\E=, smso@, + use=vi200, +vi200-rv|visual 200 reverse video, + cnorm@, cvvis@, ri@, rmso=\E3, smso=\E4, use=vi200, + +# the function keys are programmable but we don't reprogram them to their +# default values with because programming them is very verbose. maybe +# an initialization file should be made for the 300 and they could be stuck +# in it. +# (vi300: added / based on init string -- esr) +vi300|visual 300 ansi x3.64, + am, bw, mir, xenl, + cols#80, lines#24, + bel=^G, cbt=\E[Z, clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch1=\E[P$<40>, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, + il1=\E[L, ind=^J, + is2=\E[7s\E[2;3;4;20;?5;?6l\E[12;?7h\E[1Q\E[0;1(D\E[8s, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\E_A\E\\, kf2=\E_B\E\\, kf3=\E_C\E\\, kf4=\E_D\E\\, + kf5=\E_E\E\\, kf6=\E_F\E\\, kf7=\E_G\E\\, kf8=\E_H\E\\, + kf9=\E_I\E\\, khome=\E[H, ri=\EM, rmam=\E[?7l, rmir=\E[4l, + rmso=\E[m, rmul=\E[m, sgr0=\E[m, smam=\E[?7h, smir=\E[4h, + smso=\E[1m, smul=\E[4m, +# some of the vi300s have older firmware that has the command +# sequence for setting editing extent reversed. +vi300-old|visual 300 with old firmware (set edit extent reversed), + is2=\E[7s\E[2;3;4;20;?5;?6l\E[12;?7h\E[2Q\E[0;1(D\E[8s, + use=vi300, + +# Visual 500 prototype entry from University of Wisconsin. +# The best place to look for the escape sequences is page A1-1 of the +# Visual 500 manual. The initialization sequence given here may be +# overkill, but it does leave out some of the initializations which can +# be done with the menus in set-up mode. +# The :xp: line below is so that emacs can understand the padding requirements +# of this slow terminal. :xp: is 10 time the padding factor. +# (vi500: removed unknown :xp#4: termcap; +# also added empty to suppress tic warning -- esr) +vi500|visual 500, + am, mir, msgr, + cols#80, it#8, lines#33, + acsc=, cbt=\Ez$<4/>, clear=\Ev$<6*/>, cr=^M, + csr=\E(%p1%{32}%+%c%p2%{32}%+%c, cub1=^H, cud1=\EB, + cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, + dch1=\EO$<3*/>, dl1=\EM$<3*/>, ed=\Ey$<3*/>, + el=\Ex$<16/>, home=\EH, ht=\011$<8/>, il1=\EL\Ex$<3*/>, + ind=^J, + is2=\E3\E\001\E\007\E\003\Ek\EG\Ed\EX\El\E>\Eb\E\\, + kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + khome=\EH, nel=^M^J, rmacs=^O, rmir=\Ej, rmso=\E^G, + rmul=\E^C, smacs=^N, smir=\Ei, smso=\E^H, smul=\E^D, + +# The visual 550 is a visual 300 with tektronix graphics, +# and with 33 lines. clear screen is modified here to +# also clear the graphics. +vi550|visual 550 ansi x3.64, + lines#33, + clear=\030\E[H\E[2J, use=vi300, + +vi603|visual603|visual 603, + hs, mir, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, + csr=\E[%i%p1%d;%p2%dr, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + dsl=\EP2;1~\E\\, ed=\E[J, el=\E[K, fsl=\E\\, il1=\E[L, + ind=\ED, is1=\E>\E[?3l\E[?4l\E[?7h\E[?8h\E[1;24r, + rev=\E[7m, ri=\EM, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + sgr0=\E[m, smir=\E[4h, smso=\E[7m, smul=\E[4m, tsl=\EP2~, + use=vt100, + +#### Wyse (wy) +# +# Wyse Technology +# 3471 North First Street +# San Jose, CA 95134 +# Vox: (408)-473-1200 +# Fax: (408) 473-1222 +# Web: http://www.wyse.com +# +# Wyse sales can be reached by phone at 1-800-GET-WYSE. Tech support is at +# (800)-800-WYSE (option 5 gets you a human). There's a Web page at the +# obvious address, http://www.wyse.com. +# +# Wyse bought out Link Technology, Inc. in 1990 and closed it down in 1995. +# They now own the Qume and Amdek brands, too. So these are the people to +# talk with about all Link, Qume, and Amdek terminals. +# +# Wyse has a BBS containing termcap and terminfo stuff for their terminals +# (though this may not last long -- I expect the Web will kill it off by +# mid-1997 or so). According to their tech support, at 800-800-9973, it's +# at 408-922-4400 thru 4405. The 4400 modem is flaky as of 5/96, so +# call 4401 etc. Come in at 9600 hard; don't use autospeed sense. +# +# All the following entries until (but not including) wy520 are direct from +# Wyse technical support and represent their best knowledge as of January 1995. +# I canceled the bel capacities in the vb entries. +# I made two trivial syntax fixes in the wyse30 entry. +# I made some entries relative to adm+sgr. +# +# +# Note: The wyse75, wyse85, and wyse99 have been discontinued. + +# Although the Wyse 30 can support more than one attribute +# it requires magic cookies to do so. Many applications do not +# function well with magic cookies. The following terminfo uses +# the protect mode to support one attribute (dim) without cookies. +# If more than one attribute is needed then the wy30-mc terminfo +# should be used. +# +wy30|wyse30|Wyse 30, + am, bw, hs, mc5i, mir, msgr, xon, + cols#80, lh#1, lines#24, lw#8, ma#1, nlab#8, wsl#45, + acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, cbt=\EI, + civis=\E`0, clear=\E+$<80>, cnorm=\E`1, cr=^M, cub1=^H, + cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, + cuu1=^K, dch1=\EW$<10>, dim=\E`7\E), dl1=\ER$<1>, + dsl=\EF\r, ed=\EY$<80>, el=\ET, flash=\E`8$<100/>\E`9, + fsl=^M, home=^^, ht=\011$<1>, hts=\E1, il1=\EE$<2>, + ind=\n$<2>, ip=$<2>, is2=\E'\E(\E\^3\E`9\016\024, + kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, kcud1=^J, kcuf1=^L, + kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, kent=\E7, + kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, khome=^^, kich1=\EQ, + kil1=\EE, knp=\EK, kpp=\EJ, krpl=\Er, ll=^^^K, mc0=\EP, mc4=^T, + mc5=^X, nel=^M^J, pfx=\Ez%p1%'?'%+%c%p2%s\177, + pln=\Ez%p1%'/'%+%c%p2%s\r, prot=\E`7\E), ri=\Ej$<3>, + rmacs=\EH^C, rmir=\Er, rmln=\EA11, rmso=\E(, + sgr=%?%p1%p5%p8%|%|%t\E`7\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, + sgr0=\E(\EH\003, smacs=\EH^B, smir=\Eq, smln=\EA10, + smso=\E`7\E), tbc=\E0, tsl=\EF, +# +# This terminal description uses the non-hidden attribute mode +# (with magic cookie). +# +# (wy30-mc: added to suppress tic warning --esr) +wy30-mc|wyse30-mc|wyse 30 with magic cookies, + msgr@, + ma@, xmc#1, + blink=\EG2, dim=\EGp, prot=\EG0\E), rmacs=\EG0\EH\003, + rmcup=\EG0, + sgr=\EG%'0'%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, + sgr0=\EG0\E(\EH\003, smacs=\EG0\EH\002, smcup=, + use=wy30, use=adm+sgr, +# The mandatory pause used by does not work with +# older versions of terminfo. If you see this effect then +# unset xon and delete the / from the delay. +# i.e. change $<100/> to $<100> +wy30-vb|wyse30-vb|wyse 30 visible bell, + bel@, use=wy30, +# +# The Wyse 50 can support one attribute (e.g. Dim, Inverse, +# Normal) without magic cookies by using the protect mode. +# The following description uses this feature, but when more +# than one attribute is put on the screen at once, all attributes +# will be changed to be the same as the last attribute given. +# The Wyse 50 can support more attributes when used with magic +# cookies. The wy50-mc terminal description uses magic cookies +# to correctly handle multiple attributes on a screen. +# +wy50|wyse50|Wyse 50, + am, bw, hs, mc5i, mir, msgr, xon, + cols#80, lh#1, lines#24, lw#8, ma#1, nlab#8, wsl#45, + acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, cbt=\EI, + civis=\E`0, clear=\E+$<20>, cnorm=\E`1, cr=^M, cub1=^H, + cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, + cuu1=^K, dch1=\EW$<1>, dim=\E`7\E), dl1=\ER, dsl=\EF\r, + ed=\EY$<20>, el=\ET, flash=\E`8$<100/>\E`9, fsl=^M, + home=^^, ht=^I, hts=\E1, il1=\EE, ind=\n$<2>, ip=$<1>, + is1=\E`\:\E`9$<30>, is2=\016\024\E'\E(, kHOM=\E{, kbs=^H, + kcbt=\EI, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, + kdl1=\ER, ked=\EY, kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, + kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, + kf16=^AO\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + kich1=\EQ, kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, + ll=^^^K, mc0=\EP, mc4=^T, mc5=^X, nel=^M^J, + pfx=\Ez%p1%'?'%+%c%p2%s\177, + pln=\Ez%p1%'/'%+%c%p2%s\r, prot=\E`7\E), rev=\E`6\E), + ri=\Ej, rmacs=\EH^C, rmir=\Er, rmln=\EA11, rmso=\E(, + sgr=%?%p1%p3%|%t\E`6\E)\n%e%p5%p8%|%t\E`7\E)%e\E(%;\n%?%p9%t\EH\002%e\EH\003%;, + sgr0=\E(\EH\003, smacs=\EH^B, smir=\Eq, smln=\EA10, + smso=\E`6\E), tbc=\E0, tsl=\EF, +# +# This terminal description uses the non-hidden attribute mode +# (with magic cookie). +# +# The mandatory pause used by flash does not work with some +# older versions of terminfo. If you see this effect then +# unset and delete the / from the delay. +# i.e. change $<100/> to $<100> +# (wy50-mc: added to suppress tic warning --esr) +wy50-mc|wyse50-mc|wyse 50 with magic cookies, + msgr@, + ma@, xmc#1, + blink=\EG2, dim=\EGp, prot=\EG0\E), rmacs=\EG0\EH\003, + rmcup=\EG0, + sgr=\EG%'0'%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, + sgr0=\EG0\E(\EH\003, smacs=\EG0\EH\002, smcup=, + smso=\EGt, use=wy50, + use=adm+sgr, +wy50-vb|wyse50-vb|wyse 50 visible bell, + bel@, use=wy50, +wy50-w|wyse50-w|wyse 50 132-column, + cols#132, lw#7, nlab#16, wsl#97, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<2>, is1=\E`;\E`9$<30>, use=wy50, +wy50-wvb|wyse50-wvb|wyse 50 132-column visible bell, + bel@, + use=wy50-w, +# +# The Wyse 350 is a Wyse 50 with color. +# Unfortunately this means that it has magic cookies. +# The color attributes are designed to overlap the reverse, dim and +# underline attributes. This is nice for monochrome applications +# because you can make underline stuff green (or any other color) +# but for true color applications it's not so hot because you cannot +# mix color with reverse, dim or underline. +# To further complicate things one of the attributes must be +# black (either the foreground or the background). In reverse video +# the background changes color with black letters. In normal video +# the foreground changes colors on a black background. +# This terminfo uses some of the more advanced features of curses +# to display both color and blink. In the final analysis I am not +# sure that the wy350 runs better with this terminfo than it does +# with the wy50 terminfo (with user adjusted colors). +# +# The mandatory pause used by flash does not work with +# older versions of terminfo. If you see this effect then +# unset xon and delete the / from the delay. +# i.e. change $<100/> to $<100> +# +# Bug: The capability resets attributes. +wy350|wyse350|Wyse 350, + am, bw, hs, mc5i, mir, xon, + colors#8, cols#80, lh#1, lines#24, lw#8, ncv#55, nlab#8, pairs#8, + wsl#45, xmc#1, + acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, blink=\EG2, + cbt=\EI, civis=\E`0, clear=\E+$<20>, cnorm=\E`1, cr=^M, + cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<1>, + dim=\EGp, dl1=\ER, dsl=\EF\r, ed=\EY$<20>, el=\ET, + flash=\E`8$<100/>\E`9, fsl=^M, home=^^, ht=^I, hts=\E1, + il1=\EE, ind=\n$<2>, ip=$<1>, is1=\E`\:\E`9$<30>, + is2=\016\024\E'\E(, is3=\E%?, kHOM=\E{, kbs=^H, kcbt=\EI, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, + ked=\EY, kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, + kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, + kf16=^AO\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + kich1=\EQ, kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, + ll=^^^K, mc0=\EP, mc4=^T, mc5=^X, nel=^M^J, oc=\E%?, op=\EG0, + pfx=\Ez%p1%'?'%+%c%p2%s\177, + pln=\Ez%p1%'/'%+%c%p2%s\r, prot=\EG0\E), ri=\Ej, + rmacs=\EG0\EH\003, rmir=\Er, rmln=\EA11, setb=, + setf=%?%p1%{0}%=%t%{76}\n%e%p1%{1}%=%t%{64}\n%e%p1%{2}%=%t%{8}\n%e%p1%{3}%=%t%{72}\n%e%p1%{4}%=%t%{4}\n%e%p1%{5}%=%t%{68}\n%e%p1%{6}%=%t%{12}\n%e%p1%{7}%=%t%{0}\n%;%PC\n\EG%gC%gA%+%'0'%+%c, + sgr=%{0}%?%p4%t%{2}%|%;\n%?%p7%t%{1}%|%;%PA\n\EG%?%gC%t%gC%e\n%{0}%?%p1%t%{4}%|%;\n%?%p2%t%{8}%|%;\n%?%p3%t%{4}%|%;\n%?%p5%t%{64}%|%;\n%;%gA%+%'0'%+%c\n%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, + sgr0=\EG0\E(\EH\003%{0}%PA%{0}%PC, smacs=\EG0\EH\002, + smir=\Eq, smln=\EA10, tbc=\E0, tsl=\EF, + use=adm+sgr, +wy350-vb|wyse350-vb|wyse 350 visible bell, + bel@, use=wy350, +wy350-w|wyse350-w|wyse 350 132-column, + cols#132, lw#7, nlab#16, wsl#97, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<2>, is1=\E`;\E`9$<30>, use=wy350, +wy350-wvb|wyse350-wvb|wyse 350 132-column visible bell, + bel@, + use=wy350-w, +# +# This terminfo description is untested. +# The wyse100 emulates an adm31, so the adm31 entry should work. +# +wy100|wyse 100, + hs, mir, + cols#80, lines#24, xmc#1, + bel=^G, clear=\E;, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, dsl=\EA31, ed=\EY, el=\ET, fsl=^M, il1=\EE, ind=^J, + invis@, is2=\Eu\E0, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, + kcuu1=^K, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, + kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, khome=\E{, + rmir=\Er, smir=\Eq, tsl=\EF, + use=adm+sgr, +# +# The Wyse 120/150 has most of the features of the Wyse 60. +# This terminal does not need padding up to 9600 baud! +# should be set but the clear screen fails when in +# alt-charset mode. Try \EcE\s\s\E+\s if the screen is really clear +# then set . +# +wy120|wyse120|wy150|wyse150|Wyse 120/150, + am, bw, hs, km, mc5i, mir, msgr, xon, + cols#80, it#8, lh#1, lines#24, lw#8, nlab#8, pb#9601, wsl#45, + acsc=+/\\\,.0[Iha2fxgqh1jYk?lZm@nEqDtCu4vAwBx3yszr{c~~, + bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<50>, + cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<7>, + dim=\EGp, dl1=\ER$<3>, dsl=\EF\r, ed=\EY$<50>, el=\ET$<4>, + flash=\E`8$<100/>\E`9, fsl=^M, home=^^, ht=\011$<1>, + hts=\E1, il1=\EE$<3>, ind=\n$<3>, ip=$<2>, is1=\EcB0\EcC1, + is2=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El, + is3=\EwJ\Ew1$<150>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, + kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, + kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, + kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=^^^K, + mc0=\EP, mc4=^T, mc5=\Ed#, nel=\r\n$<3>, + pfloc=\EZ2%p1%'?'%+%c%p2%s\177, + pfx=\EZ1%p1%'?'%+%c%p2%s\177, + pln=\Ez%p1%'/'%+%c%p2%s\r, prot=\E), ri=\Ej$<2>, + rmacs=\EcD, rmam=\Ed., rmcup=\Ew1, rmir=\Er, rmln=\EA11, + rmxon=\Ec20, rs1=\E~!\E~4$<30>, rs2=\EeF\E`\:$<70>, + rs3=\EwG\Ee($<100>, + sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%'0'%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, + sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, + smcup=\Ew0, smir=\Eq, smln=\EA10, smso=\EGt, + smxon=\Ec21\ntbc=\E0, tsl=\EF, use=adm+sgr, +# +wy120-w|wyse120-w|wy150-w|wyse150-w|wyse 120/150 132-column, + cols#132, lw#7, nlab#16, wsl#97, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<12>, ip=$<4>, + rs2=\E`;$<70>, use=wy120, +# +wy120-25|wyse120-25|wy150-25|wyse150-25|wyse 120/150 80-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<100>, use=wy120, +# +wy120-25-w|wyse120-25-w|wy150-25-w|wyse150-25-w|wyse 120/150 132-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<100>, use=wy120-w, +# +wy120-vb|wyse120-vb|wy150-vb|wyse150-vb|Wyse 120/150 visible bell, + bel@, + use=wy120, +# +wy120-w-vb|wy120-wvb|wyse120-wvb|wy150-w-vb|wyse150-w-vb|Wyse 120/150 132-column visible bell, + bel@, + use=wy120-w, +# +# The Wyse 60 is like the Wyse 50 but with more padding. +# The reset strings are slow and the pad times very depending +# on other parameters such as font loading. I have tried +# to follow the following outline: +# +# -> set personality +# -> set number of columns +# -> set number of lines +# -> select the proper font +# -> do the initialization +# -> set up display memory (2 pages) +# +# The Wyse 60's that have vt100 emulation are slower than the +# older Wyse 60's. This change happened mid-1987. +# The capabilities effected are +# +# The meta key is only half right. This terminal will return the +# high order bit set when you hit CTRL-function_key +# +# It may be useful to assign two function keys with the +# values \E=(\s look at old data in page 1 +# \E=W, look at bottom of page 1 +# where \s is a space ( ). +# +# Note: +# The Wyse 60 runs faster when the XON/XOFF +# handshake is turned off. +# +# (wy60: we use \E{ rather than ^^ for home (both are documented) to avoid +# a bug reported by Robert Dunn, -- esr) +wy60|wyse60|Wyse 60, + am, bw, hs, km, mc5i, mir, msgr, + cols#80, lh#1, lines#24, lw#8, nlab#8, wsl#45, + acsc=+/\\\,.0[Iha2fxgqh1jYk?lZm@nEqDtCu4vAwBx3yszr{c~~, + bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<100>, + cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\EW$<11>, dclk=\E`b, dim=\EGp, dl1=\ER$<5>, dsl=\EF\r, + ed=\EY$<100>, el=\ET, flash=\E`8$<100/>\E`9, fsl=^M, + home=\E{, ht=\011$<1>, hts=\E1, il1=\EE$<4>, ind=\n$<5>, + ip=$<3>, is1=\EcB0\EcC1, + is2=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El, + is3=\EwJ\Ew1$<150>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, + kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, + kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, + kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=\E{^K, + mc0=\EP, mc4=^T, mc5=\Ed#, nel=\r\n$<3>, + pfloc=\EZ2%p1%'?'%+%c%p2%s\177, + pfx=\EZ1%p1%'?'%+%c%p2%s\177, + pln=\Ez%p1%'/'%+%c%p2%s\r, prot=\E), ri=\Ej$<7>, + rmacs=\EcD, rmam=\Ed., rmclk=\E`c, rmcup=\Ew1, rmir=\Er, + rmln=\EA11, rmxon=\Ec20, rs1=\E~!\E~4$<150>, + rs2=\EeG$<150>, rs3=\EwG\Ee($<200>, + sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%'0'%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, + sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, + smcup=\Ew0, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, + tbc=\E0, tsl=\EF, + use=adm+sgr, +# +wy60-w|wyse60-w|wyse 60 132-column, + cols#132, lw#7, nlab#16, wsl#97, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<16>, ip=$<5>, + rs2=\EeF$<150>\E`;$<150>, use=wy60, +# +wy60-25|wyse60-25|wyse 60 80-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<200>, use=wy60, +wy60-25-w|wyse60-25-w|wyse 60 132-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<200>, use=wy60-w, +# +wy60-42|wyse60-42|wyse 60 80-column 42-lines, + lines#42, + clear=\E+$<260>, cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<2>, + dch1=\EW$<16>, dl1=\ER$<11>, ed=\Ey$<260>, il1=\EE$<11>, + ind=\n$<9>, ip=$<5>, is1=\EcB2\EcC3, nel=\r\n$<6>, + ri=\Ej$<10>, rs3=\Ee*$<150>, + use=wy60, +wy60-42-w|wyse60-42-w|wyse 60 132-column 42-lines, + cols#132, lw#7, nlab#16, wsl#97, + clear=\E+$<260>, cup=\Ea%i%p1%dR%p2%dC$<2>, + dch1=\EW$<19>, ed=\Ey$<260>, home=\036$<2>, ip=$<6>, + nel=\r\n$<11>, rs2=\EeF$<150>\E`;$<150>, + use=wy60-42, +# +wy60-43|wyse60-43|wyse 60 80-column 43-lines, + lh@, lines#43, lw@, nlab@, + pln@, rs3=\Ee+$<150>, use=wy60-42, +wy60-43-w|wyse60-43-w|wyse 60 132-column 43-lines, + lh@, lines#43, lw@, nlab@, + pln@, rs3=\Ee+$<150>, use=wy60-42-w, +# +wy60-vb|wyse60-vb|Wyse 60 visible bell, + bel@, use=wy60, +wy60-w-vb|wy60-wvb|wyse60-wvb|Wyse 60 132-column visible bell, + bel@, + use=wy60-w, + +# The Wyse-99GT looks at lot like the Wyse 60 except that it +# does not have the 42/43 line mode. In the Wyse-60 the "lines" +# setup parameter controls the number of lines on the screen. +# For the Wyse 99GT the "lines" setup parameter controls the +# number of lines in a page. The screen can display 25 lines max. +# The Wyse-99GT also has personalities for the VT220 and +# Tektronix 4014. But this has no bearing on the native mode. +# +# (msgr) should be set but the clear screen fails when in +# alt-charset mode. Try \EcE\s\s\E+\s if the screen is really clear +# then set msgr, else use msgr@. +# +# u0 -> enter Tektronix mode +# u1 -> exit Tektronix mode +# +wy99gt|wyse99gt|Wyse 99gt, + msgr@, + clear=\E+$<130>, dch1=\EW$<7>, dl1=\ER$<4>, ed=\Ey$<130>, + el=\Et$<5>, flash=\E`8$<100/>\E`9, ht=\011$<1>, + il1=\EE$<4>, ind=\n$<4>, ip=$<2>, is3=\Ew0$<20>, nel@, + ri=\Ej$<3>, rmcup=\Ew0, rs2=\E`\:$<150>, smcup=\Ew1, + u0=\E~>\E8, u1=\E[42h, + use=wy60, +# +wy99gt-w|wyse99gt-w|wyse 99gt 132-column, + cols#132, lw#7, nlab#16, wsl#97, + clear=\E+$<160>, cup=\Ea%i%p1%dR%p2%dC$<2>, + dch1=\EW$<9>, ed=\Ey$<160>, ip=$<4>, rs2=\E`;$<150>, use=wy99gt, +# +wy99gt-25|wyse99gt-25|wyse 99gt 80-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs2=\E`\:$<150>, rs3=\EwG\Ee)$<200>, use=wy99gt, +# +wy99gt-25-w|wyse99gt-25-w|wyse 99gt 132-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs2=\E`;$<150>, use=wy99gt-w, +# +wy99gt-vb|wyse99gt-vb|Wyse 99gt visible bell, + bel@, use=wy99gt, +# +wy99gt-w-vb|wy99gt-wvb|wyse99gt-wvb|Wyse 99gt 132-column visible bell, + bel@, + use=wy99gt-w, +# +# The Wyse 160 is combination of the WY-60 and the WY-99gt. +# The reset strings are slow and the pad times very depending +# on other parameters such as font loading. I have tried +# to follow the following outline: +# +# -> set personality +# -> set number of columns +# -> set number of lines +# -> select the proper font +# -> do the initialization +# -> set up display memory (2 pages) +# +# The display memory may be used for either text or graphics. +# When "Display Memory = Shared" the terminal will have more pages +# but garbage may be left on the screen when you switch from +# graphics to text. If "Display Memory = Unshared" then the +# text area will be only one page long. +# +# (wy160: we use \E{ rather than ^^ for home (both are documented) to avoid +# a bug reported by Robert Dunn, -- esr) +wy160|wyse160|Wyse 160, + am, bw, hs, km, mc5i, mir, msgr, + cols#80, lh#1, lines#24, lw#8, nlab#8, wsl#38, + acsc=+/\\\,.0[Iha2fxgqh1jYk?lZm@nEqDtCu4vAwBx3yszr{c~~, + bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<30>, + cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<5>, + dclk=\E`b, dim=\EGp, dl1=\ER$<1>, dsl=\EF\r, ed=\EY$<30>, + el=\ET$<5>, flash=\E`8$<100/>\E`9, fsl=^M, home=\E{, ht=^I, + hts=\E1, il1=\EE$<1>, ind=\n$<1>, ip=$<2>, is1=\EcB0\EcC1, + is2=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El, + is3=\Ew0$<100>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, + kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, + kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, + kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=\E{^K, + mc0=\EP, mc4=^T, mc5=\Ed#, nel=\r\n$<1>, + pfloc=\EZ2%p1%'?'%+%c%p2%s\177, + pfx=\EZ1%p1%'?'%+%c%p2%s\177, + pln=\Ez%p1%'/'%+%c%p2%s\r, prot=\E), ri=\Ej$<1>, + rmacs=\EcD, rmam=\Ed., rmclk=\E`c, rmcup=\Ew0, rmir=\Er, + rmln=\EA11, rmxon=\Ec20, rs1=\E~!\E~4$<70>, + rs2=\E`\:$<100>, rs3=\EwG\Ee($<140>, + sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%'0'%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, + sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, + smcup=\Ew1, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, + tbc=\E0, tsl=\EF, + use=adm+sgr, +# +wy160-w|wyse160-w|wyse 160 132-column, + cols#132, lw#7, nlab#16, wsl#90, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<9>, + rs2=\EeF$<150>\E`;$<150>, use=wy160, +# +wy160-25|wyse160-25|wyse 160 80-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<200>, use=wy160, +wy160-25-w|wyse160-25-w|wyse 160 132-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<200>, use=wy160-w, +# +wy160-42|wyse160-42|wyse 160 80-column 42-lines, + lines#42, + clear=\E+$<50>, dl1=\ER$<2>, ed=\Ey$<50>, il1=\EE$<2>, + ind=\n$<2>, is1=\EcB2\EcC3, nel=\r\n$<2>, ri=\Ej$<2>, + rs3=\Ee*$<150>, + use=wy160, +wy160-42-w|wyse160-42-w|wyse 160 132-column 42-lines, + cols#132, lw#7, nlab#16, wsl#90, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<8>, ip=$<3>, + rs2=\EeF$<150>\E`;$<150>, + use=wy160-42, +# +wy160-43|wyse160-43|wyse 160 80-column 43-lines, + lh@, lines#43, lw@, nlab@, + pln@, rs3=\Ee+$<150>, use=wy160-42, +wy160-43-w|wyse160-43-w|wyse 160 132-column 43-lines, + lh@, lines#43, lw@, nlab@, + pln@, rs3=\Ee+$<150>, use=wy160-42-w, +# +wy160-vb|wyse160-vb|Wyse 160 visible bell, + bel@, use=wy160, +wy160-w-vb|wy160-wvb|wyse160-wvb|Wyse 160 132-column visible bell, + bel@, + use=wy160-w, +# +# The Wyse 75 is a vt100 lookalike without advanced video. +# +# The Wyse 75 can support one attribute (e.g. Dim, Inverse, +# Underline) without magic cookies. The following description +# uses this capability, but when more than one attribute is +# put on the screen at once, all attributes will be changed +# to be the same as the last attribute given. +# The Wyse 75 can support more attributes when used with magic +# cookies. The wy75-mc terminal description uses magic cookies +# to correctly handle multiple attributes on a screen. +# +wy75|wyse75|wyse 75, + am, hs, mc5i, mir, msgr, xenl, xon, + cols#80, lines#24, ma#1, pb#1201, wsl#78, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, cbt=\E[Z, civis=\E[?25l, clear=\E[H\E[J$<30>, + cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr$<2>, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP$<3*>, + dch1=\E[P$<3>, dim=\E[0t\E[2m, dl=\E[%p1%dM$<1*>, + dl1=\E[M, dsl=\E[>\\\,\001\001\E[>-\001\001, + ech=\E[%p1%dX, ed=\E[J$<30>, el=\E[K$<3>, el1=\E[1K$<3>, + enacs=\E)0, flash=\E[30h\E\\\,\E[30l$<250>, fsl=^A, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, + ich=\E[%p1%d@$<1*>, il=\E[%p1%dL$<2*>, il1=\E[L$<2>, + ind=\n$<2>, ip=$<1>, + is1=\E[2;4;20;30l\E[?1;10l\E[12h\E[?7;8;25h, + is2=\E>\E(B\E)0\017, is3=\E[m, ka1=\EOw, ka3=\EOy, + kb2=\EOu, kbs=^H, kc1=\EOq, kc3=\EOs, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdl1=\E[M, kel=\E[K, kent=\EOM, + kf1=\E[?5i, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, + kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[?3i, + kf20=\E[34~, kf21=\E[35~, kf3=\E[2i, kf4=\E[@, kf5=\E[M, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, + khlp=\E[28~, khome=\E[H, kich1=\E[@, kil1=\E[L, knp=\E[6~, + kpp=\E[5~, kprt=\E[?5i, kslt=\E[4~, mc0=\E[0i, mc4=\E[4i, + mc5=\E[5i, rc=\E8, rev=\E[1t\E[7m, ri=\EM$<2>, rmacs=^O, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[m, rmul=\E[m, + rs1=\E[13l\E[3l\E!p, rs2=\E[35h\E[?3l$<80>, rs3=\E[?5l, + sc=\E7, + sgr=%?%p5%t\E[0t%;%?%p3%p1%|%t\E[1t%;%?%p2%t\E[2t%;%?%p4%t\E[3t%;%?%p1%p2%p3%p4%p5%|%|%|%|%t\E[7m%e\E[m%;%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1l\E[?7h\E=, smso=\E[1t\E[7m, smul=\E[2t\E[4m, + tbc=\E[3g, tsl=\E[>\\\,\001, +# +# This terminal description uses the non-hidden attribute mode +# (with magic cookie). +# +wy75-mc|wyse75-mc|wyse 75 with magic cookies, + msgr@, + ma@, xmc#1, + blink=\E[2p, dim=\E[1p, invis=\E[4p, is3=\E[m\E[p, + rev=\E[16p, rmacs=\E[0p\017, rmso=\E[0p, rmul=\E[0p, + sgr=\E[%{0}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{16}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{1}%|%;%?%p7%t%{4}%|%;%dp%?%p9%t\016%e\017%;, + sgr0=\E[0p\017, smacs=\E[0p\016, smso=\E[17p, smul=\E[8p, + use=wy75, +wy75-vb|wyse75-vb|wyse 75 with visible bell, + pb@, + bel@, use=wy75, +wy75-w|wyse75-w|wyse 75 in 132 column mode, + cols#132, wsl#130, + rs2=\E[35h\E[?3h$<80>, use=wy75, +wy75-wvb|wyse75-wvb|wyse 75 with visible bell 132 columns, + pb@, + bel@, use=wy75-w, +# +# Wyse 85 emulating a vt220 7 bit mode. +# 24 line screen with status line. +# +# The vt220 mode permits more function keys but it wipes out +# the escape key. I strongly recommend that be set to +# escape (esc). +# The terminal may have to be set for 8 data bits and 2 stop +# bits for the arrow keys to work. +# The Wyse 85 runs faster with XON/XOFF enabled. Also the +# and work best when XON/XOFF is set. and +# leave trash on the screen when used without XON/XOFF. +# +wy85|wyse85|wyse 85, + am, hs, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J$<110>, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH$<1>, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP$<3*>, dch1=\E[P$<3>, dim=\E[2m, + dl=\E[%p1%dM$<3*>, dl1=\E[M$<3>, dsl=\E[40l, + ech=\E[%p1%dX, ed=\E[J$<110>, el=\E[K$<1>, el1=\E[1K, + enacs=\E)0, flash=\E[30h\E\\\,\E[30l$<300>, + fsl=\E[1;24r\E8, home=\E[H, ht=\011$<1>, hts=\EH, + ich=\E[%p1%d@$<4*>, il=\E[%p1%dL$<5*>, il1=\E[L$<5>, + ind=\n$<3>, invis=\E[8m, ip=$<3>, is1=\E[62;1"p\E[?5W, + is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h$<16>, + is3=\E>\E(B\E)0\017\E[m, ka1=\EOw, ka3=\EOy, kb2=\EOu, + kbs=^H, kc1=\EOq, kc3=\EOs, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kent=\EOM, kf1=\EOP, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf2=\EOQ, kf20=\E[34~, kf3=\EOR, + kf4=\EOS, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + kfnd=\E[1~, khlp=\E[28~, khome=\E[26~, kich1=\E[2~, + knp=\E[6~, kpp=\E[5~, kslt=\E[4~, lf1=PF1, lf2=PF2, lf3=PF3, + lf4=PF4, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, + ri=\EM$<3>, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, + rmso=\E[m, rmul=\E[m, rs1=\E[13l\E[3l\E!p, + rs2=\E[35h\E[?3l$<70>, rs3=\E[?5l, sc=\E7, + sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[40h\E7\E[25;%i%p1%dH, +# +# Wyse 85 with visual bell. +wy85-vb|wyse85-vb|wyse 85 with visible bell, + bel@, flash=\E[30h\E\\\,\E[30l$<300>, use=wy85, +# +# Wyse 85 in 132-column mode. +wy85-w|wyse85-w|wyse 85 in 132-column mode, + cols#132, wsl#132, + rs2=\E[35h\E[?3h$<70>, use=wy85, +# +# Wyse 85 in 132-column mode with visual bell. +wy85-wvb|wyse85-wvb|wyse 85 with visible bell 132-columns, + bel@, + use=wy85-w, +# +# Wyse 185 emulating a vt320 7 bit mode. +# +# This terminal always displays 25 lines. These lines may be used +# as 24 data lines and a terminal status line (top or bottom) or +# 25 data lines. The 48 and 50 line modes change the page size +# and not the number of lines on the screen. +# +# The Compose Character key can be used as a meta key if changed +# by set-up. +# +wy185|wyse185|wyse 185, + am, hs, km, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J$<40>, cnorm=\E[34h\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr$<20>, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<3>, dch1=\E[P$<3>, + dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, + dsl=\E7\E[99;0H\E[K\E8, ech=\E[%p1%dX, ed=\E[J$<40>, + el=\E[K, el1=\E[1K, enacs=\E)0, + flash=\E[30h\E\\\,\E[30l$<100>, fsl=\E[1;24r\E8, + home=\E[H, hpa=\E[%i%p1%d`, ht=^I, hts=\EH, + ich=\E[%p1%d@$<2>, il=\E[%p1%dL$<3*>, il1=\E[L$<3>, + ind=\n$<2>, invis=\E[8m, ip=$<4>, is1=\E[?5W, + is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h, + is3=\E>\E(B\E)0\017\E[m, ka1=\EOw, ka3=\EOy, kb2=\EOu, + kbs=^H, kc1=\EOq, kc3=\EOs, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kent=\EOM, + kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, + kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\EOQ, + kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, + khome=\E[26~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + kslt=\E[4~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, + mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, ri=\EM$<2>, + rmacs=^O, rmam=\E[?7l, rmcup=\E[ R, rmir=\E[4l, rmkx=\E>, + rmso=\E[27m, rmul=\E[24m, + rs1=\E[13l\E[3l\E\\\E[63;1"p\E[!p, rs2=\E[35h\E[?3l, + rs3=\E[?5l\E[47h\E[40l\E[r, sc=\E7, + sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[ Q, + smir=\E[4h, smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, tsl=\E7\E[99;%i%p1%dH, vpa=\E[%i%p1%dd, +# +# Wyse 185 with 24 data lines and top status (terminal status) +wy185-24|wyse185-24|wyse 185 with 24 data lines, + hs@, + dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, use=wy185, +# +# Wyse 185 with visual bell. +wy185-vb|wyse185-vb|wyse 185+flash, + bel@, use=wy185, +# +# Wyse 185 in 132-column mode. +wy185-w|wyse185-w|wyse 185 in 132-column mode, + cols#132, wsl#132, + dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, + ip=$<7>, rs2=\E[35h\E[?3h, + use=wy185, +# +# Wyse 185 in 132-column mode with visual bell. +wy185-wvb|wyse185-wvb|wyse 185+flash+132 cols, + bel@, use=wy185-w, + +# wy325 terminfo entries +# Done by Joe H. Davis 3-9-92 + +# lines 25 columns 80 +# +wy325|wyse325|Wyse epc, + am, bw, hs, mc5i, mir, + cols#80, lh#1, lines#24, lw#8, nlab#8, pb#9601, wsl#45, + acsc=+/\\\,.0[Iha2fxgqh1jYk?lZm@nEqDtCu4vAwBx3yszr{c~~, + bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<50>, + cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<7>, + dim=\EGp, dl1=\ER$<3>, dsl=\EF\r, ed=\EY$<50>, el=\ET$<4>, + flash=\E`8$<100/>\E`9, fsl=^M, home=^^, ht=^I, hts=\E1, + il1=\EE$<3>, ind=\n$<3>, ip=$<2>, is1=\EcB0\EcC1, + is2=\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El, + is3=\Ew0$<16>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, + kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, + kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\Eq, + kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=^^^K, + mc0=\EP, mc4=^T, mc5=\Ed#, + pfloc=\EZ2%p1%'?'%+%c%p2%s\177, + pfx=\EZ1%p1%'?'%+%c%p2%s\177, + pln=\Ez%p1%'/'%+%c%p2%s\r, prot=\E), ri=\Ej$<2>, + rmacs=\EcD, rmam=\Ed., rmcup=\Ew0, rmir=\Er, rmln=\EA11, + rs1=\E~!\E~4$<30>, rs2=\EeF\E`\:$<70>, + rs3=\EwG\Ee($<100>, + sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%'0'%?%p2%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, + sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, + smcup=\Ew1, smir=\Eq, smln=\EA10, smso=\EGt, tbc=\E0, + tsl=\EF, + use=adm+sgr, + +# +# lines 24 columns 80 vb +# +wy325-vb|wyse325-vb|wyse-325 with visual bell, + bel@, use=wy325, + +# +# lines 24 columns 132 +# +wy325-w|wyse325-w|wy325w-24|wyse-325 in wide mode, + cols#132, lw#7, nlab#16, wsl#97, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<12>, ip=$<4>, + rs2=\E`;$<70>, use=wy325, +# +# lines 25 columns 80 +# +wy325-25|wyse325-25|wy325-80|wyse-325|wyse-325 25 lines, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<100>, use=wy325, +# +# lines 25 columns 132 +# +wy325-25w|wyse325-25w|wy325 132 columns, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<100>, use=wy325-w, +# +# lines 25 columns 132 vb +# +wy325-w-vb|wy325-wvb|wyse325-wvb|wyse-325 wide mode reverse video, + bel@, + use=wy325-w, + +# +# lines 42 columns 80 +# +wy325-42|wyse325-42|wyse-325 42 lines, + lh@, lines#42, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<100>, use=wy325, +# +# lines 42 columns 132 +# +wy325-42w|wyse325-42w|wyse-325 42 lines wide mode, + lh@, lines#42, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<100>, use=wy325-w, +# +# lines 42 columns 132 vb +# +wy325-42w-vb|wy325-42wvb|wyse-325 42 lines wide mode visual bell, + bel@, + use=wy325-w, +# +# lines 43 columns 80 +# +wy325-43|wyse325-43|wyse-325 43 lines, + lh@, lines#43, lw@, nlab@, + pln@, use=wy325, +# +# lines 43 columns 132 +# +wy325-43w|wyse325-43w|wyse-325 43 lines wide mode, + lh@, lines#43, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<100>, use=wy325-w, +# +# lines 43 columns 132 vb +# +wy325-43w-vb|wy325-43wvb|wyse-325 43 lines wide mode visual bell, + bel@, + use=wy325-w, + +# Wyse 370 -- 24 line screen with status line. +# +# The terminal may have to be set for 8 data bits and 2 stop +# bits for the arrow keys to work. +# +# If you change keyboards the terminal will send different +# escape sequences. +# The following definition is for the basic terminal without +# function keys. +# +# -> enter Tektronix 4010/4014 mode +# -> exit Tektronix 4010/4014 mode +# -> enter ASCII mode (from any ANSI mode) +# -> exit ASCII mode (goto native ANSI mode) +# -> enter Tek 4207 ANSI mode (from any ANSI mode) +# -> exit Tek 4207 mode (goto native ANSI mode) +# +# Bug: The capability resets attributes. +wy370-nk|wyse 370 without function keys, + am, ccc, hs, mc5i, mir, msgr, xenl, xon, + colors#64, cols#80, it#8, lines#24, ncv#48, pairs#64, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J$<40>, cnorm=\E[34h\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH$<1>, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<1*>, dch1=\E[P$<1>, + dclk=\E[31h, dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, + dsl=\E[40l, ech=\E[%p1%dX$<.1*>, ed=\E[J$<40>, + el=\E[K$<10>, el1=\E[1K$<12>, enacs=\E)0, + flash=\E[30h\E\\\,\E[30l$<300>, fsl=\E[1;24r\E8, + home=\E[H, hpa=\E[%i%p1%d`, ht=\011$<1>, hts=\EH, + ich=\E[%p1%d@$<1*>, il=\E[%p1%dL$<2*>, il1=\E[L$<2>, + ind=\n$<2>, + initc=\E[66;%p1%d;\n%?%p2%{250}%<%t%{0}\n%e%p2%{500}%<%t%{16}\n%e%p2%{750}%<%t%{32}%e%{48}%;\n%?%p3%{250}%<%t%{0}\n%e%p3%{500}%<%t%{4}\n%e%p3%{750}%<%t%{8}%e%{12}%;\n%?%p4%{250}%<%t%{0}\n%e%p4%{500}%<%t%{1}\n%e%p4%{750}%<%t%{2}%e%{3}%;%{1}%+%+%+%dw, + invis=\E[8m, ip=$<1>, is1=\E[90;1"p\E[?5W$<6>, + is2=\E[2;4;20;30;40l\E[?1;10;16l\E[12h\E[?7;8;25h, + is3=\E>\017\E)0\E(B\E[63;0w\E[m, mc0=\E[0i, mc4=\E[4i, + mc5=\E[5i, + oc=\E[60w\E[63;0w\n\E[66;1;4w\n\E[66;2;13w\n\E[66;3;16w\n\E[66;4;49w\n\E[66;5;51w\n\E[66;6;61w\n\E[66;7;64w, + op=\E[m, rc=\E8, rev=\E[7m, ri=\EM$<2>, rmacs=^O, + rmam=\E[?7l, rmclk=\E[31l, rmcup=\E[ R, rmir=\E[4l, + rmkx=\E>, rmso=\E[27m, rmul=\E[24m, + rs1=\E[13l\E[3l\E!p\E[?4i, rs2=\E[35h\E[?3l$<8>, + rs3=\E[?5l, sc=\E7, setb=\E[62;%p1%dw, setf=\E[61;%p1%dw, + sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[ Q, + smir=\E[4h, smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, tsl=\E[40l\E[40h\E7\E[99;%i%p1%dH, + u0=\E[?38h\E8, u1=\E[?38l\E)0, u2=\E[92;52"p, u3=\E~B, + u4=\E[92;76"p, u5=\E%!1\E[90;1"p, vpa=\E[%i%p1%dd, +# +# Function key set for the ASCII (wy-50 compatible) keyboard +# This is the default 370. +# +wy370|wyse370|wy370-101k|Wyse 370 with 101 key keyboard, + kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kdch1=\EOQ, kdl1=\EOQ, kent=\EOM, kf1=\E[?4i, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf2=\E[?3i, + kf3=\E[2i, kf4=\E[@, kf5=\E[M, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[H, kich1=\EOP, kil1=\EOP, + knp=\E[U, kpp=\E[V, + use=wy370-nk, +# +# Function key set for the VT-320 (and wy85) compatible keyboard +# +wy370-105k|Wyse 370 with 105 key keyboard, + ka1=\EOw, ka3=\EOy, kb2=\EOu, kbs=^H, kc1=\EOq, kc3=\EOs, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kent=\EOM, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, + khlp=\E[28~, khome=\E[26~, kich1=\E[2~, knp=\E[6~, + kpp=\E[5~, kslt=\E[4~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, + use=wy370-nk, +# +# Function key set for the PC compatible keyboard +# +wy370-EPC|Wyse 370 with 102 key keyboard, + kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kend=\E[1~, kent=\EOM, kf1=\EOP, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + kf5=\E[M, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[H, kich1=\E[2~, knp=\E[U, kpp=\E[V, + use=wy370-nk, +# +# Wyse 370 with visual bell. +wy370-vb|Wyse 370 with visible bell, + bel@, use=wy370, +# +# Wyse 370 in 132-column mode. +wy370-w|Wyse 370 in 132-column mode, + cols#132, wsl#132, + rs2=\E[35h\E[?3h$<70>, use=wy370, +# +# Wyse 370 in 132-column mode with visual bell. +wy370-wvb|Wyse 370 with visible bell 132-columns, + flash=\E[30h\E\\\,\E[30l$<300>, + use=wy370-w, +wy370-rv|Wyse 370 reverse video, + rs3=\E[32h\E[?5h, use=wy370, +# +# Wyse 99gt Tektronix 4010/4014 emulator, +# +wy99gt-tek|Wyse 99gt Tektronix 4010/4014 emulator, + am, os, + cols#74, lines#35, + bel=^G, clear=\E^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, + cup=\035%{3040}%{89}%p1%*%-%Py\n%p2%{55}%*%Px\n%gy%{128}%/%{31}%&%{32}%+%c\n%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c\n%gy%{004}%/%{31}%&%{96}%+%c\n%gx%{128}%/%{31}%&%{32}%+%c\n%gx%{004}%/%{31}%&%{64}%+%c\037, + cuu1=^K, ff=^L, + hd=\036HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\037, + home=^]7`x @\037, + hu=\036DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\037, + is2=\E8, nel=^M^J, u0=\E~>\E8, u1=\E[42h, +# +# Wyse 160 Tektronix 4010/4014 emulator, +# +wy160-tek|Wyse 160 Tektronix 4010/4014 emulator, + cup=\035%{3103}%{91}%p1%*%-%Py\n%p2%{55}%*%Px\n%gy%{128}%/%{31}%&%{32}%+%c\n%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c\n%gy%{004}%/%{31}%&%{96}%+%c\n%gx%{128}%/%{31}%&%{32}%+%c\n%gx%{004}%/%{31}%&%{64}%+%c\037, + home=^]8`g @\037, + use=wy99gt-tek, +# +# Wyse 370 Tektronix 4010/4014 emulator, +# +wy370-tek|Wyse 370 Tektronix 4010/4014 emulator, + am, os, + cols#80, lines#36, + bel=^G, clear=\E^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, + cup=\035%{775}%{108}%p1%*%{5}%/%-%Py\n%p2%{64}%*%{4}%+%{5}%/%Px\n%gy%{32}%/%{31}%&%{32}%+%c\n%gy%{31}%&%{96}%+%c\n%gx%{32}%/%{31}%&%{32}%+%c\n%gx%{31}%&%{64}%+%c\037, + cuu1=^K, ff=^L, + hd=\036HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\037, + home=^]8g @\037, + hu=\036DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\037, + is2=\E8, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^I, kcuu1=^K, + nel=^M^J, u0=\E[?38h\E8, u1=\E[?38l\E)0, + +# Vendor-supplied Wyse entries end here. + +# +#TITLE: TERMINFO ENTRY WY520 +#DATE: 8/5/93 +# The WY520 terminfo is based on the WY285 entry published on the WYSE +# BBS with the addition of more function keys and special keys. +# +# rs1 -> set personality +# rs2 -> set number of columns +# rs3 -> set number of lines +# is1 -> select the proper font +# is2 -> do the initialization +# is3 -> If this string is empty then rs3 gets sent. +# +# Wyse 520 emulating a vt420 7 bit mode with default ANSI keyboard +# - The BS key is programmed to generate BS in smcup since +# is2 doesn't seem to work. +# - Remove and shift/Remove: delete a character +# - Insert : enter insert mode +# - Find : delete to end of file +# - Select : clear a line +# - F11, F12, F13: send default sequences (not ESC, BS, LF) +# - F14 : Home key +# - Bottom status line (host writable line) is used. +# - smkx,rmkx are removed because this would put the numeric +# keypad in Dec application mode which doesn't seem to work +# with SCO applications. +# +wy520|wyse520|wyse 520, + am, hs, km, mc5i, mir, xenl, xon, + cols#80, it#8, lines#24, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J$<40>, cnorm=\E[34h\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr$<20>, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<3>, dch1=\E[P$<30>, + dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, dsl=\E[0$~, + ech=\E[%p1%dX, ed=\E[J$<40>, el=\E[K, el1=\E[1K, + enacs=\E)0, fsl=\E[0$}, home=\E[H, hpa=\E[%i%p1%d`, ht=^I, + hts=\EH, ich=\E[%p1%d@$<2>, il=\E[%p1%dL$<3*>, + il1=\E[L$<3>, ind=\n$<2>, invis=\E[8m, ip=$<4>, is1=\E[?5W, + is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25;67h, + is3=\E>\E(B\E)0\017\E[m, ka1=\EOw, ka3=\EOu, kb2=\EOy, + kbs=^H, kc1=\EOq, kc3=\EOs, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, ked=\E[1~, + kel=\E[4~, kent=\EOM, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, + khlp=\E[28~, khome=\E[26~, kich1=\E[2~, knp=\E[6~, + kpp=\E[5~, kslt=\E[4~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, + mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, + ri=\EM$<2>, rmacs=^O, rmam=\E[?7l, rmcup=\E[ R, rmir=\E[4l, + rmso=\E[m, rmul=\E[24m, + rs1=\E[13l\E[3l\E\\\E[63;1"p\E[!p, rs2=\E[35h\E[?3l, + rs3=\E[?5l\E[47h\E[40l\E[r, sc=\E7, + sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, + smcup=\E[ Q\E[?67;8h, smir=\E[4h, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, tsl=\E[2$~\E[1$}\E[%i%p1%d`, + vpa=\E[%i%p1%dd, +# +# Wyse 520 with 24 data lines and status (terminal status) +wy520-24|wyse520-24|wyse 520 with 24 data lines, + hs@, + dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, use=wy520, +# +# Wyse 520 with visual bell. +wy520-vb|wyse520-vb|wyse 520 with visible bell, + flash=\E[30h\E\\\,\E[30l$<100>, use=wy520, +# +# Wyse 520 in 132-column mode. +wy520-w|wyse520-w|wyse 520 in 132-column mode, + cols#132, wsl#132, + dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, + ip=$<7>, rs2=\E[35h\E[?3h, + use=wy520, +# +# Wyse 520 in 132-column mode with visual bell. +wy520-wvb|wyse520-wvb|wyse 520 with visible bell 132-columns, + flash=\E[30h\E\\\,\E[30l$<100>, + use=wy520-w, +# +# +# Wyse 520 emulating a vt420 7 bit mode. +# The DEL key is programmed to generate BS in is2. +# With EPC keyboard. +# - 'End' key will clear till end of line on EPC keyboard +# - Shift/End : ignored. +# - Insert : enter insert mode. +# - Delete : delete a character (have to change interrupt character +# to CTRL-C: stty intr '^c') for it to work since the +# Delete key sends 7FH. +wy520-epc|wyse520-epc|wyse 520 with EPC kb, + kdch1=\177, kel=\E[4~, kend=\E[4~, kf0=\E[21~, kf1=\E[11~, + kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, khome=\E[H, + use=wy520, +# +# Wyse 520 with 24 data lines and status (terminal status) +# with EPC keyboard. +wy520-epc-24|wyse520-pc-24|wyse 520 with 24 data lines, + hs@, + dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, use=wy520-epc, +# +# Wyse 520 with visual bell. +wy520-epc-vb|wyse520-pc-vb|wyse 520 with visible bell, + flash=\E[30h\E\\\,\E[30l$<100>, + use=wy520-epc, +# +# Wyse 520 in 132-column mode. +wy520-epc-w|wyse520-epc-w|wyse 520 in 132-column mode, + cols#132, wsl#132, + dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, + ip=$<7>, rs2=\E[35h\E[?3h, + use=wy520-epc, +# +# Wyse 520 in 132-column mode with visual bell. +wy520-epc-wvb|wyse520-p-wvb|wyse 520 with visible bell 132-columns, + flash=\E[30h\E\\\,\E[30l$<100>, + use=wy520-epc-w, +# +# Wyse 520 in 80-column, 36 lines +wy520-36|wyse520-36|wyse 520 with 36 data lines, + hs@, + lines#36, + dsl@, fsl@, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r, tsl@, use=wy520, +# +# Wyse 520 in 80-column, 48 lines +wy520-48|wyse520-48|wyse 520 with 48 data lines, + hs@, + lines#48, + dsl@, fsl@, rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r, tsl@, use=wy520, +# +# Wyse 520 in 132-column, 36 lines +wy520-36w|wyse520-36w|wyse 520 with 36 data lines, + cols#132, wsl#132, + rs2=\E[?3h, + rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|, use=wy520-36, +# +# Wyse 520 in 132-column, 48 lines +wy520-48w|wyse520-48w|wyse 520 with 48 data lines, + cols#132, wsl#132, + rs2=\E[?3h, + rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r\E[132$|, use=wy520-48, +# +# +# Wyse 520 in 80-column, 36 lines with EPC keyboard +wy520-36pc|wyse520-36pc|wyse 520 with 36 data lines, + hs@, + lines#36, + dsl@, fsl@, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r, tsl@, use=wy520-epc, +# +# Wyse 520 in 80-column, 48 lines with EPC keyboard +wy520-48pc|wyse520-48pc|wyse 520 with 48 data lines, + hs@, + lines#48, + dsl@, fsl@, rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r, tsl@, use=wy520-epc, +# +# Wyse 520 in 132-column, 36 lines with EPC keyboard +wy520-36wpc|wyse520-36wpc|wyse 520 with 36 data lines, + cols#132, wsl#132, + rs2=\E[?3h, + rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|, use=wy520-36pc, +# +# Wyse 520 in 132-column, 48 lines with EPC keyboard +wy520-48wpc|wyse520-48wpc|wyse 520 with 48 data lines, + cols#132, wsl#132, + rs2=\E[?3h, + rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r\E[132$|, use=wy520-48pc, + +# From: John Gilmore +# (wyse-vp: removed , there's no such +# file and we don't know what is -- esr) +wyse-vp|wyse|Wyse 50 in ADDS Viewpoint emulation mode with "enhance" on, + am, + cols#80, it#8, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^F, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dch1=\EW, + dl1=\El, ed=\Ek, el=\EK, home=^A, ht=^I, il1=\EM, ind=^J, + is2=\E`\:\E`9\017\Er, kbs=^H, kcub1=^U, kcud1=^J, kcuf1=^F, + kcuu1=^Z, khome=^A, ll=^A^Z, nel=^M^J, rmir=\Er, rmso=^O, + rmul=^O, rs1=\E`\:\E`9\017\Er, sgr0=^O, smir=\Eq, smso=^N, + smul=^N, + +wy75ap|wyse75ap|wy-75ap|wyse-75ap|Wyse WY-75 Applications and Cursor keypad, + is2=\E[1;24r\E[?10;3l\E[?1;25h\E[4l\E[m\E(B\E=, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + khome=\EOH, rmkx=\E[?1l\E>$<10/>, smkx=\E[?1h\E=$<10/>, + use=wy75, + +# From: Eric Freudenthal +wy100q|Wyse 100 for Quotron, + cols#80, lines#24, xmc#1, + cbt=\EI, clear=^Z, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET, home=^^, il1=\EE, invis@, + is2=\E`\:\200\EC\EDF\E0\E'\E(\EA21, kcub1=^H, kcud1=^J, + kcuf1=^L, kcuu1=^K, ri=\Ej, rmir=\Er, smir=\Eq, + use=adm+sgr, + +#### Kermit terminal emulations +# +# Obsolete Kermit versions may be listed in the section describing obsolete +# non-ANSI terminal emulators later in the file. +# + +# KERMIT standard all versions. +# Straight ascii keyboard. :sr=\EI: not avail. many versions + bug prone in vi. +# (kermit: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" -- esr) +# From: greg small 9-25-84 +kermit|standard kermit, + cols#80, lines#24, + clear=\EE, cub1=^H, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EK, home=\EH, is2=K0 Standard Kermit 9-25-84\n, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, +kermit-am|standard kermit plus auto-margin, + am, + is2=K1 Standard Kermit plus Automatic Margins\n, use=kermit, +# IBMPC Kermit 1.2. +# Bugs: , : do not work except at beginning of line! does +# not work, but fake with :cl=\EH\EJ (since :cd=\EJ: works at beginning of +# line). +# From: greg small 8-30-84 +pckermit|pckermit12|UCB IBMPC Kermit 1.2, + am, + lines#25, + clear=\EH\EJ, ed@, el@, + is2=K2 UCB IBMPC Kermit 1.2 8-30-84\n, use=kermit, +# IBMPC Kermit 1.20 +# Cannot use line 25, now acts funny like ansi special scrolling region. +# Initialization must escape from that region by cursor position to line 24. +# Cannot use character insert because 1.20 goes crazy if insert at col 80. +# Does not use :am: because autowrap is lost when kermit dropped and restarted. +# From: greg small 12-19-84 +pckermit120|UCB IBMPC Kermit 1.20, + it#8, lines#24, + cud1=\EB, cvvis=\EO\Eq\EEK3, dch1=\EN, dl1=\EM, ht=^I, + il1=\EL, + is2=\EO\Eq\EJ\EY7 K3 UCB IBMPC Kermit 1.20 12-19-84\n, + rmir@, rmso=\Eq, smir@, smso=\Ep, + use=kermit, +# MS-DOS Kermit 2.27 for the IBMPC +# Straight ascii keyboard. :sr=\EI: not avail. many versions + bug prone in vi. +# Cannot use line 25, now acts funny like ansi special scrolling region. +# Initialization must escape from that region by cursor position to line 24. +# Does not use am: because autowrap is lost when kermit dropped and restarted. +# Reverse video for standout like H19. +# (msk227: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" -- esr) +# From: greg small 3-17-85 +msk227|mskermit227|MS-DOS Kermit 2.27 for the IBMPC, + am@, + cols#80, it#8, lines#24, + clear=\EE, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, + cvvis=\EO\Eq\EG\EwK4, dch1=\EN, dl1=\EM, ed=\EJ, el=\EK, + home=\EH, ht=^I, il1=\EL, + is2=\EO\Eq\EG\Ew\EJ\EY7 K4 MS Kermit 2.27 for the IBMPC 3-17-85\n, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, rc=\Ek, + rmir=\EO, rmso=\Eq, sc=\Ej, smir=\E@, smso=\Ep, +# MS-DOS Kermit 2.27 with automatic margins +# From: greg small 3-17-85 +msk227am|mskermit227am|UCB MS-DOS Kermit 2.27 with automatic margins, + am, + cvvis=\EO\Eq\EG\EvK5, + is2=\EO\Eq\EG\Ev\EJ\EY7 K5 MS Kermit 2.27 +automatic margins 3-17-85\n, use=msk227, +# MS-DOS Kermit 2.27 UCB 227.14 for the IBM PC +# Automatic margins now default. Use ansi for highlights. +# Define function keys. +# (msk22714: removed obsolete ":kn#10:" -- esr) +# From: greg small 3-17-85 +msk22714|mskermit22714|UCB MS-DOS Kermit 2.27 UCB 227.14 IBM PC, + am, + bold=\E[1m, cvvis=\EO\Eq\EG\EvK6, + is2=\EO\Eq\EG\Ev\EJ\EY7 K6 MS Kermit 2.27 UCB 227.14 IBM PC 3-17-85\n, + kf0=\E0, kf1=\E1, kf2=\E2, kf3=\E3, kf4=\E4, kf5=\E5, kf6=\E6, + kf7=\E7, kf8=\E8, kf9=\E9, rev=\E[7m, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smso=\E[1m, smul=\E[4m, + use=mskermit227, +# This was designed for a VT320 emulator, but it is probably a good start +# at support for the VT320 itself. +# Please send changes with explanations to bug-gnu-emacs@prep.ai.mit.edu. +# (vt320-k3: I added / based on the init string -- esr) +vt320-k3|MS-Kermit 3.00's vt320 emulation, + am, eslok, hs, km, mir, msgr, xenl, + cols#80, it#8, lines#49, pb#9600, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J, cmdch=\E, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p1%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p1%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + dsl=\E[0$~, ech=\E[%p1%dX, ed=\E[J, el=\E[K, + flash=\E[?5h\E[?5l\E[?5h\E[?5l\E[?5h\E[?5l, + fsl=\E[0$}, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, + is2=\E>\E F\E[?1l\E[?7h\E[r\E[2$~, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdl1=\E[3~, kf0=\E[21~, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kich1=\E[2~, knp=\E[6~, + kpp=\E[5~, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, nel=^M^J, rc=\E8, + rev=\E[7m, ri=\EM, rin=\E[%p1%dL, rmacs=\E(B, rmam=\E[?7l, + rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, + rs1=\E(B\E)B\E>\E F\E[4;20l\E[12h\E[?1;5;6;38;42l\E[?7;25h\E4i\E?4i\E[m\E[r\E[2$~, + sc=\E7, sgr0=\E[m, smacs=\E(0, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[1$}\r\E[K, vpa=\E[%i%p1%dd, +# From: Joseph Gil 13 Dec 1991 +# ACS capabilities from Philippe De Muyter 30 May 1996 +# (I removed a bogus boolean :mo: and added , , -- esr) +vt320-k311|dec vt320 series as defined by kermit 3.11, + am, eslok, hs, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[;H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J, el=\E[K, + flash=\E[?5h\E[?5l, fsl=\E[$}, home=\E[H, ht=^I, hts=\EH, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L$<3/>, ind=\ED, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, + lf3=pf3, lf4=pf4, nel=^M\ED, rc=\E8, rev=\E[7m, + rf=/usr/share/tabset/vt100, ri=\EM, rmacs=^O, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, + rmul=\E[24m, rs1=\E[?3l, sc=\E7, sgr0=\E[m, smacs=^N, + smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, tsl=\E[2$~\E[1$}\E[1;%dH, + +######## NON-ANSI TERMINAL EMULATIONS +# + +#### Avatar +# +# These entries attempt to describe Avatar, a terminal emulation used with +# MS-DOS bulletin-board systems. It was designed to give ANSI-like +# capabilities, but with cheaper (shorter) control sequences. Messy design, +# excessively dependent on PC idiosyncracies, but apparently rather popular +# in the BBS world. +# +# No color support. Avatar doesn't fit either of the Tektronix or HP color +# models that terminfo knows about. An Avatar color attribute is the +# low 7 bits of the IBM-PC display-memory attribute. Bletch. +# +# I wrote these entries while looking at the Avatar spec. I don't have +# the facilities to test them. Let me know if they work, or don't. +# +# From: Eric S. Raymond 1 Nov 1995 +# (The ///// capabilities exist only to +# tell ncurses that the corresponding highlights exist; it should use , +# which is the only method that will actually work for multiple highlights.) +avatar0|avatar terminal emulator level 0, + am, bce, msgr, + cols#80, it#8, lines#25, + blink=^A^V\177, bold=^V^A^P, cr=^M, cub1=^V^E, cud1=^V^D, + cuf1=^V^F, cup=\026\010%p1%c%p2%c, cuu1=^V^C, el=^V^G, + ind=^J, invis=^V^A\200, rep=\031%p1%c%p2%d, rev=^A^Vp, + rs2=^L, + sgr=\026\001%{0}%?%p1%t%{112}%|%;%?%p2%t%{1}%|%;%?%p3%t%{112}%|%;%?%p4%t{128}%|%;%?%p6%t%{16}%|%;, + sgr0=^V^A^G, smacs=, smso=^A^Vp, smul=^V^A, + use=klone+acs, +# From: Eric S. Raymond 1 Nov 1995 +avatar0+|avatar terminal emulator level 0+, + dch1=^V^N, rmir=\026\n\200\200\200\200, smir=^V^I, use=avatar0, +# From: Eric S. Raymond 1 Nov 1995 +avatar|avatar1|avatar terminal emulator level 1, + civis=^V'^B, cnorm=^V'^A, cvvis=^V^C, dl1=^V-, il1=^V+, + rmam=^V", rmir=^V^P, smam=^V$, + use=avatar0+, + +######## OLDER TERMINAL TYPES +# +# This section is devoted to older commercial terminal brands that are now +# discontinued, but known to be still in use or represented by emulations. +# + +#### AT&T (att, tty) +# +# This section also includes Teletype-branded VDTs. +# +# The AT&T/Teletype terminals group was sold to SunRiver Data Systems; for +# details, see the header comment on the ADDS section. +# +# These are AT&T's official terminfo entries. All-caps aliases have been +# removed. +# +att2300|sv80|AT&T 2300 Video Information Terminal 80 column mode, + am, eo, mir, msgr, xon, + cols#80, it#8, lines#24, + bel=^G, clear=\E[H\E[J, cr=^M, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcbt=\E[Z, kclr=\E[J, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, + kdl1=\E[M, kf1=\E[1r, kf10=\E[10r, kf11=\E[11r, + kf12=\E[12r, kf13=\E[13r, kf14=\E[14r, kf15=\E[15r, + kf16=\E[16r, kf2=\E[2r, kf3=\E[3r, kf4=\E[4r, kf5=\E[5r, + kf6=\E[6r, kf7=\E[7r, kf8=\E[8r, kf9=\E[9r, khome=\E[H, + kich1=\E[@, kil1=\E[L, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, + rev=\E[7m, rmir=\E[4l, rmso=\E[m, sgr0=\E[m, smir=\E[4h, + smso=\E[7m, +att2350|AT&T 2350 Video Information Terminal 80 column mode, + mc0@, mc4@, mc5@, + use=att2300, + +# Must setup RETURN KEY - CR, REC'VD LF - INDEX. +# Seems upward compatible with vt100, plus ins/del line/char. +# On sgr, the protection parameter is ignored. +# No check is made to make sure that only 3 parameters are output. +# standout= reverse + half-intensity = 3 | 5. +# bold= reverse + underline = 2 | 3. +# note that half-bright blinking doesn't look different from normal blinking. +# NOTE:you must program the function keys first, label second! +# (att4410: a BSD entry has been seen with the following capabilities: +# , , , , , +# , , , -- esr) +att5410v1|att4410v1|tty5410v1|AT&T 4410/5410 80 columns - version 1, + am, hs, mir, msgr, xon, + cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, + acsc=``aaffhhggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~00++--\,\,.., + bel=^G, blink=\E[5m, bold=\E[2;7m, clear=\E[H\E[J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dim=\E[2m, + dl1=\E[M, ed=\E[J, el=\E[K, fsl=\E8, home=\E[H, ht=^I, + ich1=\E[@, il1=\E[L, ind=^J, invis=\E[8m, is1=\E[?3l\E)0, + is3=\E[1;03q f1 \EOP\E[2;03q f2 \EOQ\E[3;03q f3 \EOR\E[4;03q f4 \EOS\E[5;03q f5 \EOT\E[6;03q f6 \EOU\E[7;03q f7 \EOV\E[8;03q f8 \EOW, + kbs=^H, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, + kf6=\EOU, kf7=\EOV, kf8=\EOW, khome=\E[H, kll=\E[24;1H, + ll=\E[24H, nel=^M^J, + pfx=\E[%p1%1d;%p2%l%2.2dq f%p1%1d %p2%s, + pln=\E[%p1%d;00q%p2%:-16s, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, + sc=\E7, + sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smso=\E[7m, smul=\E[4m, + tsl=\E7\E[25;%p1%{1}%+%dH, + +att4410v1-w|att5410v1-w|tty5410v1-w|AT&T 4410/5410 132 columns - version 1, + cols#132, wsl#132, + is1=\E[?3h\E)0, rs2=\Ec\E[?3h\E[2;0y, use=att5410v1, + +att4410|att5410|tty5410|AT&T 4410/5410 80 columns - version 2, + pfx=\E[%p1%d;%p2%l%02dq f%p1%d %p2%s, + use=att5410v1, + +att5410-w|att4410-w|4410-w|tty5410-w|5410-w|AT&T 4410/5410 in 132 column mode, + cols#132, wsl#132, + is1=\E[?3h\E)0, rs2=\Ec\E[?3h\E[2;0y, use=att4410, + +# 5410 in terms of a vt100 +# (v5410: added / based on init string -- esr) +v5410|att5410 in terms of a vt100, + am, mir, msgr, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=^J, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu1=\E[A$<2>, dch1=\E[P, + dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, + enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ich1=\E[@, + il1=\E[L, ind=^J, ka1=\EOq, ka3=\EOs, kb2=\EOr, kbs=^H, + kc1=\EOp, kc3=\EOn, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, kent=\EOM, kf0=\EOy, kf1=\EOP, kf10=\EOx, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOt, kf6=\EOu, kf7=\EOv, + kf8=\EOl, kf9=\EOw, rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, + rmacs=^O, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, + rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, + smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, + +# +# Teletype Model 5420 -- A souped up 5410, with multiple windows, +# even! the 5420 has three modes: scroll, window or page mode +# this terminfo should work in scroll or window mode, but doesn't +# take advantage of any of the differences between them. +# +# Has memory below (2 lines!) +# 3 pages of memory (plus some spare) +# The 5410 sequences for , , ,

, , , , +# , would work for these, but these work in both scroll and window +# mode... Unset insert character so insert mode works +# sets 80 column mode, +# escape sequence: +# 1) turn off all fonts +# 2) function keys off, keyboard lock off, control display off, +# insert mode off, erasure mode off, +# 3) full duplex, monitor mode off, send graphics off, nl on lf off +# 4) reset origin mode +# 5) set line wraparound +# 6) exit erasure mode, positional attribute mode, and erasure extent mode +# 7) clear margins +# 8) program ENTER to transmit ^J, +# We use \212 to program the ^J because a bare ^J will get translated by +# UNIX into a CR/LF. The enter key is needed for AT&T uOMS. +# 1 2 3 4 5 6 7 8 +# set screen color to black, +# No representation in terminfo for the delete word key: kdw1=\Ed +# Key capabilities assume the power-up send sequence... +# This is not strictly necessary, but it helps maximize +# memory usefulness: , +# Alternate sgr0: , +# Alternate sgr: , +# smkx programs the SYS PF keys to send a set sequence. +# It also sets up labels f1, f2, ..., f8, and sends edit keys. +# This string causes them to send the strings - +# when pressed in SYS PF mode. +# (att4415: I added / based on the init string -- esr) +att4415|tty5420|att5420|AT&T 4415/5420 80 cols, + db, mir, xon, + lh#2, lm#78, lw#8, nlab#8, wsl#55, + cbt=\E[Z, clear=\E[x\E[J, cnorm=\E[11;0j, cub=\E[%p1%dD, + cud=\E[%p1%dB, cuf=\E[%p1%dC, cup=\E[%i%p1%d;%p2%dx, + cuu=\E[%p1%dA, cvvis=\E[11;1j, dch=\E[%p1%dP, + dl=\E[%p1%dM, ech=\E[%p1%ds\E[%p1%dD, + flash=\E[?5h$<200>\E[?5l, home=\E[x, + hpa=\E[%p1%{1}%+%dG, hts=\EH, ich=\E[%p1%d@, ich1@, + il=\E[%p1%dL, indn=\E[%p1%dE, is1=\E[?3l$<100>, + is2=\E[m\017\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h\E[4i\Ex\E[21;1j\212, + is3=\E[?5l, kbeg=\Et, kcbt=\E[Z, kdch1=\E[P, kdl1=\E[M, + kel=\E[2K, kend=\Ez, kent=\Eent, kf1=\EOc, kf2=\EOd, + kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, + kich1=\E[4h, kil1=\E[L, kind=\E[T, kll=\Eu, knp=\E[U, + kpp=\E[V, kri=\E[S, lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, + lf6=F6, lf7=F7, lf8=F8, ll=\Ew, mc0=\E[?2i, mc4=\E[?9i, + mc5=\E[?4i, mrcup=\E[%i%p1%d;%p2%dt, + pfx=\E[%p1%d;%p2%l%02dq F%p1%d %p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, prot=\EV, + rin=\E[%p1%dF, rmam=\E[?7l, rmir=\E[4l, + rmkx=\E[19;0j\E[21;1j\212, rmln=\E|, + sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smam=\E[?7h, smir=\E[4h, + smkx=\E[19;1j\E[21;4j\Eent, smln=\E~, tbc=\E[3g, + tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd, + use=att4410, + +att4415-w|tty5420-w|att5420-w|AT&T 4415/5420 132 cols, + cols#132, lm#54, wsl#97, + is1=\E[?3h$<100>, use=att4415, + +att4415-rv|tty5420-rv|att5420-rv|AT&T 4415/5420 80 cols/rv, + flash=\E[?5l$<200>\E[?5h, is3=\E[?5h, + use=att4415, + +att4415-w-rv|tty5420-w-rv|att5420-w-rv|AT&T 4415/5420 132 cols/rv, + cols#132, lm#54, wsl#97, + flash=\E[?5l$<200>\E[?5h, is1=\E[?3h$<100>, is3=\E[?5h, use=att4415, + +# Note that this mode permits programming USER PF KEYS and labels +# However, when you program user pf labels you have to reselect +# user pf keys to make them appear! +att4415+nl|tty5420+nl|att5420+nl|generic AT&T 4415/5420 changes for not changing labels, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, + pfx=\E[%p1%d;%p2%l%02d;0;1q F%p1%d %p2%s, + pln=\E[%p1%d;0;0;1q%p2%:-16.16s, + +att4415-nl|tty5420-nl|att5420-nl|AT&T 4415/5420 without changing labels, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, + use=att4415+nl, use=att4415, + +att4415-rv-nl|tty5420-rv-nl|att5420-rv-nl|AT&T 4415/5420 reverse video without changing labels, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, + use=att4415+nl, use=att4415-rv, + +att4415-w-nl|tty5420-w-nl|att5420-w-nl|AT&T 4415/5420 132 cols without changing labels, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, + use=att4415+nl, use=att4415-w, + +att4415-w-rv-n|tty5420-w-rv-n|att5420-w-rv-n|AT&T 4415/5420 132 cols reverse without changing labels, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, + use=att4415+nl, use=att4415-w-rv, + +att5420_2|AT&T 5420 model 2 80 cols, + am, db, hs, mir, msgr, xon, + cols#80, it#8, lh#2, lines#24, lm#78, lw#8, nlab#8, wsl#55, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + blink=\E[5m, cbt=\E[1Z, clear=\EH\EJ, cnorm=\E[11;0j, + cr=\EG, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud1=\E[1B, cuf=\E[%p1%dC, cuf1=\E[1C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cvvis=\E[11;1j, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, ech=\E[%p1%ds\E[%p1%dD, ed=\E[0J, el=\E[0K, + el1=\E[1K, flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, + hpa=\E[%p1%{1}%+%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dE, + invis=\E[8m, + is1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;0j\E[6;0j\E[7;0j\E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j\E[29;0j\E[1;24r, + kbeg=\Et, kbs=^H, kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[M, + kel=\E[2K, kend=\Ez, kent=^J, kf1=\EOc, kf2=\EOd, kf3=\EOe, + kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, khome=\E[H, + kich1=\E[4h, kil1=\E[L, kind=\E[T, kll=\Eu, knp=\E[U, + kpp=\E[V, kri=\E[S, lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, + lf6=F6, lf7=F7, lf8=F8, ll=\Ew, mc0=\E[?;2i, mc4=\E[4i, + mc5=\E[5i, mrcup=\E[%i%p1%d;%p2%dt, nel=^M^J, + pfx=\E[%p1%d;%p2%l%02dq F%p1%d %p2%s\E~, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s\E~, prot=\EV, rc=\E8, + rev=\E[7m, ri=\EM, rin=\E[%p1%dF, rmacs=^O, rmkx=\E[19;0j, + rmln=\E|, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, + sc=\E7, + sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smkx=\E[19;1j, smln=\E~, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd, +att5420_2-w|AT&T 5420 model 2 in 132 column mode, + cols#132, + is1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;1j\E[6;0j\E[7;0j\E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j\E[29;0j\E[1;24r, use=att5420_2, + +att4418|att5418|AT&T 5418 80 cols, + am, xon, + cols#80, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, clear=\E[H\E[2J, cr=^M, cub=\E[%p1%dD, + cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[1P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, el=\E[0K, home=\E[H, + ich=\E[%p1%d@, ich1=\E[1@, il=\E[%p1%dL, il1=\E[1L, ind=^J, + is1=\E[?3l, is2=\E)0\E?6l\E?5l, kclr=\E[%, kcub1=\E@, + kcud1=\EU, kcuf1=\EA, kcuu1=\ES, kent=\E[, kf1=\E[h, + kf10=\E[m, kf11=\E[n, kf12=\E[o, kf13=\E[H, kf14=\E[I, + kf15=\E[J, kf18=\E[K, kf19=\E[L, kf2=\E[i, kf20=\E[E, + kf21=\E[_, kf22=\E[M, kf23=\E[N, kf24=\E[O, kf3=\E[j, + kf6=\E[k, kf7=\E[l, kf8=\E[f, kf9=\E[w, khome=\Ec, rc=\E8, + rev=\E[7m, rmacs=^O, rmso=\E[m, rmul=\E[m, sc=\E7, + sgr0=\E[m\017, smacs=^N, smso=\E[7m, smul=\E[4m, +att4418-w|att5418-w|AT&T 5418 132 cols, + cols#132, + is1=\E[?3h, use=att5418, + +att4420|tty4420|teletype 4420, + da, db, eo, msgr, ul, xon, + cols#80, lines#24, lm#72, + bel=^G, clear=\EH\EJ, cr=\EG, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EP, + dl1=\EM, ed=\EJ, el=\Ez, home=\EH, il1=\EL, ind=\EH\EM\EY7\s, + kcbt=\EO, kclr=\EJ, kcub1=^H, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EP, kdl1=\EM, kf0=\EU, kf3=\E@, khome=\EH, + kich1=\E\^, kil1=\EL, kind=\ES, kri=\ET, + lf0=segment advance, lf3=cursor tab, rmdc@, rmso=\E~, + rmul=\EZ, smdc@, smso=\E}, smul=\E\\, + +# The following is a terminfo entry for the Teletype 4424 +# asynchronous keyboard-display terminal. It supports +# the vi editor. The terminal must be set up as follows, +# +# HIGHLIGHT DEFINITION 3-TONE +# DISPLAY FUNCTION GROUP III +# +# The second entry below provides limited (a la adm3a) +# operation under GROUP II. +# +# This must be used with DISPLAY FUNCTION GROUP I or III +# and HIGHLIGHT DEFINITION 3-TONE +# The terminal has either bold or blink, depending on options +# +# (att4424: commented out =\E[1m, we don't need bright locked on -- esr) +att4424|tty4424|teletype 4424, + am, xon, + cols#80, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E3, bold=\E3, cbt=\EO, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\EB, cuf=\E[%p1%dC, cuf1=\EC, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EA, + dch=\E[%p1%dP, dch1=\EP, dim=\EW, dl=\E[%p1%dM, dl1=\EM, + ed=\EJ, el=\Ez, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E\^, il=\E[%p1%dL, il1=\EL, ind=^J, is2=\E[20l\E[?7h, + kbs=^H, kclr=\EJ, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + khome=\E[H, nel=\EE, rev=\E}, ri=\ET, rmacs=\E(B, rmso=\E~, + rmul=\EZ, + sgr=\E[%?%p1%t7%;%?%p2%t;4%;%?%p3%t;7%;%?%p6%t;1%;%?%p6%p4%|%t;5%;%?%p5%t;0%;m, + sgr0=\EX\E~\EZ\E4\E(B, smacs=\E(0, smso=\E}, smul=\E\\, + tbc=\EF, + +att4424-1|tty4424-1|teletype 4424 in display function group I, + kclr@, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome@, + use=att4424, + +# This entry is not one of AT&T's official ones, it was translated from the +# 4.4BSD termcap file. The highlight strings are different from att4424. +# I have no idea why this is -- older firmware version, maybe? +# The following two lines are the comment originally attached to the entry: +# This entry appears to avoid the top line - I have no idea why. +# From: jwb Wed Mar 31 13:25:09 1982 remote from ihuxp +att4424m|tty4424m|teletype 4424M, + am, da, db, mir, + cols#80, it#8, lines#23, + bel=^G, clear=\E[2;H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%2d;%p2%2dH\E[B, cuu1=\E[A, dch1=\EP, + dl1=\EM, el=\E[K, ht=^I, ich1=\E\^, il1=\EL, ind=^J, ip=$<2/>, + is2=\E[m\E[2;24r, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, khome=\E[H, nel=^M^J, ri=\ET, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smso=\E[7m, smul=\E[4m, + +# The Teletype 5425 is really version 2 of the Teletype 5420. It +# is quite similar, except for some minor differences. No page +# mode, for example, so all of the sequences used above have +# to change back to what's being used for the 5410. Many of the +# option settings have changed their numbering as well. +# +# This has been tested on a preliminary model. +# +# (att5425: added / based on the init string -- esr) +att5425|tty5425|att4425|AT&T 4425/5425, + am, da, db, hs, mir, msgr, xenl, xon, + cols#80, it#8, lh#2, lines#24, lm#78, lw#8, nlab#8, wsl#55, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, + clear=\E[H\E[J, cnorm=\E[12;0j, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[12;1j, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%ds\E[%p1%dD, ed=\E[J, + el=\E[K, el1=\E[1K, enacs=\E(B\E)0, + flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, + hpa=\E[%p1%{1}%+%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dE, + invis=\E[8m, is1=\E<\E[?3l$<100>, + is2=\E[m\017\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h\E[4i\Ex\E[25;1j\212, + is3=\E[?5l, kbeg=\Et, kbs=^H, kcbt=\E[Z, kclr=\E[J, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, + kdl1=\E[M, kel=\E[2K, kend=\Ez, kent=\Eent, kf1=\EOc, + kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, + kf8=\EOj, khome=\E[H, kich1=\E[4h, kil1=\E[L, kind=\E[T, + kri=\E[S, ll=\E[24H, mc0=\E[?2i, mc4=\E[?9i, mc5=\E[?4i, + nel=^M^J, + pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, prot=\EV, rc=\E8, + rev=\E[7m, ri=\EM, rin=\E[%p1%dF, rmacs=^O, rmam=\E[?7l, + rmir=\E[4l, rmkx=\E[21;0j\E[25;1j\212, rmln=\E|, + rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, sc=\E7, + sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, + smkx=\E[21;1j\E[25;4j\Eent\E~, smln=\E~, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, tsl=\E7\E[25;%p1%{8}%+%dH, + vpa=\E[%p1%{1}%+%dd, + +att5425-nl|tty5425-nl|att4425-nl|AT&T 4425/5425 80 columns no labels, + smkx=\E[21;1j\E[25;4j\Eent, + use=att4425, + +att5425-w|att4425-w|tty5425-w|teletype 4425/5425 in 132 column mode, + cols#132, lm#54, wsl#97, + is1=\E[?3h$<100>, use=tty5425, + +# (att4426: his had bogus capabilities: :ri=\EM:, :ri=\E[1U:. +# I also added / -- esr) +att4426|tty4426|teletype 4426S, + am, da, db, xon, + cols#80, lines#24, lm#48, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, bold=\E[5m, clear=\E[H\E[2J\E[1U\E[H\E[2J\E[1V, + cr=^M, cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\EA, dch=\E[%p1%dP, dch1=\EP, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[0K, home=\E[H, + hpa=\E[%p1%dG, ht=^I, hts=\E1, ich=\E[%p1%d@, ich1=\E\^, + il=\E[%p1%dL, il1=\EL, ind=^J, indn=\E[%p1%dS, + is1=\Ec\E[?7h, is2=\E[m\E[1;24r, kbs=^H, kcbt=\EO, + kclr=\E[2J, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, + kf7=\EOV, kf8=\EOW, khome=\E[H, kll=\E[24;1H, ll=\E[24H, + nel=^M^J, rc=\E8, rev=\E[7m, ri=\ET, rin=\E[%p1%dT, + rmacs=\E(B, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, + rs2=\Ec\E[?3l\E[2;0y, sc=\E7, sgr0=\E[m\E(B, smacs=\E(0, + smam=\E[?7h, smso=\E[5m, smul=\E[4m, tbc=\E[3g, + vpa=\E[%p1%dd, + +# Terminfo entry for the AT&T 510 A Personal Terminal +# Function keys 9 - 16 are available only after the +# screen labeled (soft keys/action blocks) are labeled. Function key +# 9 corresponds to the leftmost touch target on the screen, +# function key 16 corresponds to the rightmost. +# +# This entry is based on one done by Ernie Rice at Summit, NJ and +# changed by Anne Gallup, Skokie, IL, ttrdc!anne +att510a|bct510a|AT&T 510A Personal Terminal, + am, mir, msgr, xenl, xon, + cols#80, lh#2, lines#24, lw#7, nlab#8, + acsc=hrisjjkkllmmnnqqttuuvvwwxx{{||}}~~-f\,h.e+g`b, + bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, + civis=\E[11;0|, clear=\E[H\E[J, cnorm=\E[11;3|, cr=^M, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[1B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[11;2|, dch=\E[%p1%dP, + dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, + el=\E[0K, el1=\E[1K, enacs=\E(B\E)1, ff=^L, home=\E[H, ht=^I, + hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, is1=\E(B\E)1\E[2l, + is3=\E[21;1|\212, kLFT=\E[u, kRIT=\E[v, kbs=^H, kcbt=\E[Z, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOm, + kf10=\EOd, kf11=\EOe, kf12=\EOf, kf13=\EOg, kf14=\EOh, + kf15=\EOi, kf16=\EOj, kf2=\EOV, kf3=\EOu, kf4=\ENj, kf5=\ENe, + kf6=\ENf, kf7=\ENh, kf8=\E[H, kf9=\EOc, kind=\E[S, kri=\E[T, + mc0=\E[0i, mc4=\E[?8i, mc5=\E[?4i, nel=\EE, + pln=\E[%p1%dp%p2%:-16s, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmkx=\E[19;0|, rmso=\E[m, rmul=\E[m, sc=\E7, + sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smkx=\E[19;1|, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, + +# Terminfo entry for the AT&T 510 D Personal Terminal +# Function keys 9 through 16 are accessed by bringing up the +# system blocks. +# Function key 9 corresponds to the leftmost touch target on the screen, +# function key 16 corresponds to the rightmost. +# +# There are problems with soft key labeling. These are due to +# strangenesses in the native terminal that are impossible to +# describe in a terminfo. +att510d|bct510d|AT&T 510D Personal Terminal, + am, da, db, mir, msgr, xenl, xon, + cols#80, lh#2, lines#24, lm#48, lw#7, nlab#8, + acsc=hrisjjkkllmmnnqqttuuvvwwxx{{||}}~~-f\,h.e+g`b, + bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, + clear=\E[H\E[J, cnorm=\E[11;3|, cr=^M, cub=\E[%p1%dD, + cub1=^H, cud=\E[%p1%dB, cud1=\E[1B, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, cvvis=\E[11;2|, dch=\E[%p1%dP, dch1=\E[P, + dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, el=\E[0K, + el1=\E[1K, enacs=\E(B\E)1, ff=^L, home=\E[H, + hpa=\E[%p1%{1}%+%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, + invis=\E[8m, is1=\E(B\E)1\E[5;0|, is3=\E[21;1|\212, + kLFT=\E[u, kRIT=\E[v, kbs=^H, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOm, kf10=\EOd, + kf11=\EOe, kf12=\EOf, kf13=\EOg, kf14=\EOh, kf15=\EOi, + kf16=\EOj, kf2=\EOV, kf3=\EOu, kf4=\ENj, kf5=\ENe, kf6=\ENf, + kf7=\ENh, kf8=\E[H, kf9=\EOc, kind=\E[S, kri=\E[T, ll=\E#2, + mc0=\E[0i, mc4=\E[?8i, mc5=\E[?4i, mgc=\E\:, nel=\EE, + pln=\E[%p1%dp%p2%:-16s, rc=\E8, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, + rin=\E[%p1%dT, rmacs=^O, rmir=\E[4l, rmkx=\E[19;0|, + rmln=\E<, rmso=\E[m, rmul=\E[m, rmxon=\E[29;1|, + rs2=\E[5;0|, sc=\E7, + sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smgl=\E4, smgr=\E5, smir=\E[4h, + smkx=\E[19;1|, smln=\E?, smso=\E[7m, smul=\E[4m, + smxon=\E[29;0|, tbc=\E[3g, vpa=\E[%p1%{1}%+%dd, + +# (att500: I merged this with the att513 entry, att500 just used att513 -- esr) +att500|att513|AT&T 513 using page mode, + am, chts, mir, msgr, xenl, xon, + cols#80, lh#2, lines#24, lw#8, nlab#8, + acsc=hrisjjkkllmmnnqqttuuvvwwxx{{||}}~~-f\,h.e+g`b, + bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, + clear=\E[H\E[J, cnorm=\E[11;0|, cr=^M, + csr=%i\E[%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[11;1|, dch=\E[%p1%dP, dch1=\E[P$<1>, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)1, home=\E[H, hpa=\E[%p1%{1}%+%dG, ht=^I, + hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, + indn=\E[%p1%dE, invis=\E[8m, + is1=\E?\E[3;3|\E[10;0|\E[21;1|\212\E[6;1|\E[1{\E[?99l, + kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, + kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, + kFND=\EOX, kHLP=\EOM, kHOM=\ENM, kIC=\ENJ, kLFT=\ENK, + kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, kOPT=\EOR, kPRT=\EOZ, + kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, kRIT=\ENL, kRPL=\EOY, + kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, kbs=^H, kcan=\EOw, + kcbt=\E[Z, kclo=\EOV, kclr=\E[J, kcmd=\EOu, kcpy=\ENd, + kcrt=\EOn, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\ENf, kdl1=\ENe, kel=\EOa, kend=\E0, kent=\Eent, + kext=\EOk, kf1=\EOc, kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, + kf6=\EOh, kf7=\EOi, kf8=\EOj, kfnd=\EOx, khlp=\EOm, + khome=\E[H, kich1=\ENj, kind=\E[S, kmov=\ENc, kmrk=\ENi, + kmsg=\EOl, knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, + kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, + kres=\EOq, krfr=\ENa, kri=\E[T, krpl=\EOy, krst=\EOB, + ksav=\EOo, kslt=\ENI, kspd=\EOp, kund=\EOs, ll=\E#2, + mc0=\E[?98l\E[0i, mc4=\E[?98l\E[?8i, mc5=\E[?98l\E[?4i, + nel=\EE, + pfkey=\E[%p1%d;%p2%l%d;3;0p F%p1%d %p2%s, + pfloc=\E[%p1%d;%p2%l%d;2;0p F%p1%d %p2%s, + pfx=\E[%p1%d;%p2%l%d;1;0p F%p1%d %p2%s, + pln=\E[%p1%dp%p2%:-16s, rc=\E8, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, + rin=\E[%p1%dF, rmacs=^O, rmir=\E[4l, + rmkx=\E[19;0|\E[21;1|\212, rmln=\E<, rmso=\E[m, + rmul=\E[m, + rs1=\E?\E[3;3|\E[10;0|\E[21;1|\212\E[6;1|\E[1{\E[?99l\E[2;0|\E[6;1|\E[8;0|\E[19;0|\E[1{\E[?99l, + rs2=\E[5;0|, sc=\E7, + sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smir=\E[4h, + smkx=\E[19;1|\E[21;4|\Eent, smln=\E?, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, vpa=\E[%p1%{1}%+%dd, + +# 01-07-88 +# printer must be set to EMUL ANSI to accept ESC codes +# stops at top margin +# sets cpi 10,lpi 6,form 66,left 1,right 132,top 1,bottom 66,font +# and alt font ascii,wrap on,tabs cleared +# disables newline on LF,Emphasized off +# The capability sets form length +att5310|att5320|AT&T Model 53210 or 5320 matrix printer, + xhpa, xvpa, + bufsz#8192, cols#132, cps#120, it#8, lines#66, orc#10, + orhi#100, orl#12, orvi#72, + cpi=%?%p1%{10}%=%t\E[w%e%p1%{12}%=%t\E[2w%e%p1%{5}%=%t\E[5w%e%p1%{13}%=%p1%{14}%=%O%t\E[3w%e%p1%{16}%=%p1%{17}%=%O%t\E[4w%e%p1%{6}%=%t\E[6w%e%p1%{7}%=%t\E[7w%e%p1%{8}%=%t\E[8w%;, + cr=^M, + csnm=%?%p1%{0}%=%tusascii%e%p1%{1}%=%tenglish%e%p1%{2}%=%tfinnish%e%p1%{3}%=%tjapanese%e%p1%{4}%=%tnorwegian%e%p1%{5}%=%tswedish%e%p1%{6}%=%tgermanic%e%p1%{7}%=%tfrench%e%p1%{8}%=%tcanadian_french%e%p1%{9}%=%titalian%e%p1%{10}%=%tspanish%e%p1%{11}%=%tline%e%p1%{12}%=%tsecurity%e%p1%{13}%=%tebcdic%e%p1%{14}%=%tapl%e%p1%{15}%=%tmosaic%;, + cud=\E[%p1%de, cud1=^J, cuf=\E[%p1%da, cuf1=\s, cuu1=\EM, + ff=^L, hpa=\E[%p1%d`, ht=^I, is1=\Ec, is2=\E[20l\r, + lpi=%?%p1%{2}%=%t\E[4z%e%p1%{3}%=%t\E[5z%e%p1%{4}%=%t\E[6z%e%p1%{6}%=%t\E[z%e%p1%{8}%=%t\E[2z%e%p1%{12}%=%t\E[3z%;, + rshm=\E[m, + scs=%?%p1%{0}%=%t\E(B%e%p1%{1}%=%t\E(A%e%p1%{2}%=%t\E(C%e%p1%{3}%=%t\E(D%e%p1%{4}%=%t\E(E%e%p1%{5}%=%t\E(H%e%p1%{6}%=%t\E(K%e%p1%{7}%=%t\E(R%e%p1%{8}%=%t\E(Q%e%p1%{9}%=%t\E(Y%e%p1%{10}%=%t\E(Z%e%p1%{11}%=%t\E(0%e%p1%{12}%=%t\E(1%e%p1%{13}%=%t\E(3%e%p1%{14}%=%t\E(8%e%p1%{15}%=%t\E(}%;, + smgbp=\E[;%p1%dr, smglp=\E[%{1}%p1%+%ds, + smgrp=\E[;%{1}%p1%+%ds, smgtp=\E[%p1%dr, sshm=\E[5m, + u0=\E[%p1%dt, vpa=\E[%p1%dd, + +# Teletype 5620, firmware version 1.1 (8;7;3) or earlier from BRL +# The following SET-UP modes are assumed for normal operation: +# CR_DEF=CR NL_DEF=INDEX DUPLEX=FULL +# Other SET-UP modes may be set for operator convenience or communication +# requirements. This termcap description is for the Resident Terminal Mode. +# No delays specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! +# The BRL entry also said: UNSAFE :ll=\E[70H: +att5620-1|tty5620-1|dmd1|Teletype 5620 with old ROMs, + am, xon, + cols#88, it#8, lines#70, vt#3, + bel=^G, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, + dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, + home=\E[H, ht=^I, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=^J, indn=\E[%p1%dS, kbs=^H, kclr=\E[2J, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, + kll=\E[70;1H, nel=^M^J, rc=\E8, ri=\E[T, rin=\E[%p1%dT, + rs1=\Ec, sc=\E7, + +# 5620 terminfo (2.0 or later ROMS with char attributes) +# The following SET-UP modes are assumed for normal operation: +# DUPLEX=FULL GEN_FLOW=ON NEWLINE=INDEX RETURN=CR +# Other SET-UP modes may be set for operator convenience or communication +# requirements. This termcap description is for Resident Terminal Mode. No +# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! +# assumptions: (scroll forward one line) is only done at screen bottom +# Be aware that older versions of the dmd have a firmware bug that affects +# parameter defaulting; for this terminal, the 0 in \E[0m is not optional. +# is from an otherwise inferior BRL for this terminal. That entry +# also has =\E[70H commented out and marked unsafe. +# For more, see the 5620 FAQ maintained by David Breneman . +att5620|dmd|tty5620|ttydmd|5620|5620 terminal 88 columns, + am, msgr, npc, xon, + cols#88, it#8, lines#70, + bel=^G, bold=\E[2m, clear=\E[H\E[J, cr=^M, cub1=^H, + cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, + indn=\E[%p1%dS, kbs=^H, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kll=\E[70;1H, nel=^J, + pfx=\E[%p1%d;%p2%l%dq%p2%s, rc=\E8, rev=\E[7m, ri=\E[T, + rin=\E[%p1%dT, rmso=\E[0m, rmul=\E[0m, rs1=\Ec, sc=\E7, + sgr0=\E[0m, smso=\E[7m, smul=\E[4m, +att5620-24|tty5620-24|dmd-24|teletype dmd 5620 in a 24x80 layer, + lines#24, use=att5620, +att5620-34|tty5620-34|dmd-34|teletype dmd 5620 in a 34x80 layer, + lines#34, use=att5620, +# 5620 layer running the "S" system's downloaded graphics handler: +att5620-s|tty5620-s|layer|vitty|5620 S layer, + am, + cols#80, it#8, lines#72, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, + cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=^K, dl1=\ED, + el=\EK, flash=\E^G, ht=^I, il1=\EI, ind=^J, kbs=^H, kclr=\E[2J, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, + kll=\E[70;1H, + +# Entries for thru refer to the shifted system pf keys. +# +# Entries for thru refer to the alternate keypad mode +# keys: = * / + 7 8 9 - 4 5 6 , 1 2 3 0 . ENTER +att605|AT&T 605 80 column 102key keyboard, + am, eo, xon, + cols#80, lines#24, lw#8, nlab#8, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, + cr=^M, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, + dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, el1=\E[1K, fsl=\E8, ht=^I, ich=\E[%p1%d@, ich1=\E[@, + il1=\E[L, ind=^J, invis=\E[8m, + is1=\E[8;0|\E[?\E[13;20l\E[?\E[12h, is2=\E[m\017, + kLFT=\E[ A, kRIT=\E[ @, kbs=^H, kcbt=\E[Z, kclr=\E[2J, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, + kdl1=\E[M, kend=\E[24;1H, kf1=\EOc, kf10=\ENp, kf11=\ENq, + kf12=\ENr, kf13=\ENs, kf14=\ENt, kf15=\EOC, kf16=\EOD, + kf17=\EOE, kf18=\EOF, kf19=\EOG, kf2=\EOd, kf20=\EOH, + kf21=\EOI, kf22=\EOJ, kf23=\ENO, kf24=\ENP, kf25=\ENQ, + kf26=\ENR, kf27=\ENS, kf28=\ENT, kf29=\EOP, kf3=\EOe, + kf30=\EOQ, kf31=\EOR, kf32=\EOS, kf33=\EOw, kf34=\EOx, + kf35=\EOy, kf36=\EOm, kf37=\EOt, kf38=\EOu, kf39=\EOv, + kf4=\EOf, kf40=\EOl, kf41=\EOq, kf42=\EOr, kf43=\EOs, + kf44=\EOp, kf45=\EOn, kf46=\EOM, kf5=\EOg, kf6=\EOh, + kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, kich1=\E[@, + kil1=\E[L, kind=\E[S, knp=\E[U, kpp=\E[V, ll=\E[24H, + mc4=\E[?4i, mc5=\E[?5i, nel=\EE, + pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m, + rmacs=^O, rmir=\E[4l, rmln=\E[2p, rmso=\E[m, rmul=\E[m, + rs2=\Ec\E[?3l, sc=\E7, sgr0=\E[m\017, smacs=\E)0\016, + smir=\E[4h, smln=\E[p, smso=\E[7m, smul=\E[4m, + tsl=\E7\E[25;%i%p1%dx, +att605-pc|ATT 605 in pc term mode, + acsc=k\277l\332m\300j\331n\305w\302q\304u\264t\303v\301x\263, + cbt=\E[Z, cub1=\E[D, cud1=\E[B, cuf1=\E[C, cuu1=\E[A, + dch1=\E[P, dl1=\E[M, ich1=\E[@, il=\E[L, il1=\E[L, kcbt=\E[Z, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, + kdl1=\E[M, kend=\E[F, kf1=\E[M, kf10=\E[V, kf2=\E[N, + kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, + kf9=\E[U, khome=\E[H, kich1=\E[@, knp=\E[G, kpp=\E[I, + rmsc=400\E[50;0|, smsc=250\E[?11l\E[50;1|, xoffc=g, + xonc=e, + use=att605, +att605-w|AT&T 605-w 132 column 102 key keyboard, + cols#132, wsl#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h\E(B\E)0, use=att605, +# (att610: I added / based on the init string. I also +# added and because the BSD file says the att615s have them, +# and the 615 is like a 610 with a big keyboard, and most of their other +# smart terminals support the same sequence -- esr) +att610|AT&T 610; 80 column; 98key keyboard, + am, eslok, hs, mir, msgr, xenl, xon, + cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, ht=^I, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, + indn=\E[%p1%dS, invis=\E[8m, + is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0, + is2=\E[m\017, is3=\E(B\E)0, kLFT=\E[ @, kRIT=\E[ A, kbs=^H, + kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOc, kf10=\ENp, kf11=\ENq, kf12=\ENr, + kf13=\ENs, kf14=\ENt, kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, + kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, + kind=\E[S, kri=\E[T, ll=\E[24H, mc4=\E[?4i, mc5=\E[?5i, + nel=\EE, + pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m, + ri=\EM, rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, + rmln=\E[2p, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, + smln=\E[p, smso=\E[7m, smul=\E[4m, tsl=\E7\E[25;%i%p1%dx, +att610-w|AT&T 610; 132 column; 98key keyboard, + cols#132, wsl#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, use=att610, + +att610-103k|AT&T 610; 80 column; 103key keyboard, + kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, + kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, + kFND=\EOX, kHLP=\EOM, kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, + kOPT=\EOR, kPRT=\EOZ, kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, + kRPL=\EOY, kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, + kcan=\EOw, kclo=\EOV, kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, + kdch1=\ENf, kdl1=\ENe, kel=\EOa, kend=\E0, kent=^M, + kext=\EOk, kf10@, kf11@, kf12@, kf13@, kf14@, kf9@, kfnd=\EOx, + khlp=\EOm, kich1=\ENj, kmov=\ENc, kmrk=\ENi, kmsg=\EOl, + knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, kpp=\E[V, + kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, kres=\EOq, + krfr=\ENa, krmir=\ENj, krpl=\EOy, krst=\EOB, ksav=\EOo, + kslt=\ENI, kspd=\EOp, kund=\EOs, + use=att610, +att610-103k-w|AT&T 610; 132 column; 103key keyboard, + cols#132, wsl#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, use=att610-103k, +att615|AT&T 615; 80 column; 98key keyboard, + kLFT=\E[ A, kRIT=\E[ @, kf15=\EOC, kf16=\EOD, kf17=\EOE, + kf18=\EOF, kf19=\EOG, kf20=\EOH, kf21=\EOI, kf22=\EOJ, + kf23=\ENO, kf24=\ENP, kf25=\ENQ, kf26=\ENR, kf27=\ENS, + kf28=\ENT, kf29=\EOP, kf30=\EOQ, kf31=\EOR, kf32=\EOS, + kf33=\EOw, kf34=\EOx, kf35=\EOy, kf36=\EOm, kf37=\EOt, + kf38=\EOu, kf39=\EOv, kf40=\EOl, kf41=\EOq, kf42=\EOr, + kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, + use=att610, +att615-w|AT&T 615; 132 column; 98key keyboard, + kLFT=\E[ A, kRIT=\E[ @, kf15=\EOC, kf16=\EOD, kf17=\EOE, + kf18=\EOF, kf19=\EOG, kf20=\EOH, kf21=\EOI, kf22=\EOJ, + kf23=\ENO, kf24=\ENP, kf25=\ENQ, kf26=\ENR, kf27=\ENS, + kf28=\ENT, kf29=\EOP, kf30=\EOQ, kf31=\EOR, kf32=\EOS, + kf33=\EOw, kf34=\EOx, kf35=\EOy, kf36=\EOm, kf37=\EOt, + kf38=\EOu, kf39=\EOv, kf40=\EOl, kf41=\EOq, kf42=\EOr, + kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, + use=att610-w, +att615-103k|AT&T 615; 80 column; 103key keyboard, + kLFT=\E[ A, kRIT=\E[ @, + use=att610-103k, +att615-103k-w|AT&T 615; 132 column; 103key keyboard, + kLFT=\E[ A, kRIT=\E[ @, + use=att610-103k-w, +# (att620: I added / based on the init string and +# / from a BSD termcap -- esr) +att620|AT&T 620; 80 column; 98key keyboard, + am, eslok, hs, mir, msgr, xenl, xon, + cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, ht=^I, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, + indn=\E[%p1%dS, invis=\E[8m, + is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h, + is2=\E[m\017, is3=\E(B\E)0, kLFT=\E[ A, kRIT=\E[ @, kbs=^H, + kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOc, kf10=\ENp, kf11=\ENq, kf12=\ENr, + kf13=\ENs, kf14=\ENt, kf15=\EOC, kf16=\EOD, kf17=\EOE, + kf18=\EOF, kf19=\EOG, kf2=\EOd, kf20=\EOH, kf21=\EOI, + kf22=\EOJ, kf23=\ENO, kf24=\ENP, kf25=\ENQ, kf26=\ENR, + kf27=\ENS, kf28=\ENT, kf29=\EOP, kf3=\EOe, kf30=\EOQ, + kf31=\EOR, kf32=\EOS, kf33=\EOw, kf34=\EOx, kf35=\EOy, + kf36=\EOm, kf37=\EOt, kf38=\EOu, kf39=\EOv, kf4=\EOf, + kf40=\EOl, kf41=\EOq, kf42=\EOr, kf43=\EOs, kf44=\EOp, + kf45=\EOn, kf46=\EOM, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, + kf9=\ENo, khome=\E[H, kind=\E[S, kri=\E[T, ll=\E[24H, + mc4=\E[?4i, mc5=\E[?5i, nel=\EE, + pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m, + ri=\EM, rin=\E[%p1%dT, rmacs=\E(B\017, rmam=\E[?7l, + rmir=\E[4l, rmln=\E[2p, rmso=\E[m, rmul=\E[m, + rs2=\Ec\E[?3l, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\E(B\017, smacs=\E)0\016, smam=\E[?7h, + smir=\E[4h, smln=\E[p, smso=\E[7m, smul=\E[4m, + tsl=\E7\E[25;%i%p1%dx, +att620-w|AT&T 620; 132 column; 98key keyboard, + cols#132, wsl#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, use=att620, +att620-103k|AT&T 620; 80 column; 103key keyboard, + kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, + kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, + kFND=\EOX, kHLP=\EOM, kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, + kOPT=\EOR, kPRT=\EOZ, kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, + kRPL=\EOY, kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, + kcan=\EOw, kclo=\EOV, kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, + kdch1=\ENf, kdl1=\ENe, kel=\EOa, kend=\E0, kent=^M, + kext=\EOk, kf10@, kf11@, kf12@, kf13@, kf14@, kf15@, kf16@, kf17@, + kf18@, kf19@, kf20@, kf21@, kf22@, kf23@, kf24@, kf25@, kf26@, kf27@, + kf28@, kf29@, kf30@, kf31@, kf32@, kf33@, kf34@, kf35@, kf36@, kf37@, + kf38@, kf39@, kf40@, kf41@, kf42@, kf43@, kf44@, kf45@, kf46@, kf9@, + kfnd=\EOx, khlp=\EOm, kich1=\ENj, kmov=\ENc, kmrk=\ENi, + kmsg=\EOl, knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, + kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, + kres=\EOq, krfr=\ENa, krmir=\ENj, krpl=\EOy, krst=\EOB, + ksav=\EOo, kslt=\ENI, kspd=\EOp, kund=\EOs, + use=att620, + +att620-103k-w|AT&T 620; 132 column; 103key keyboard, + cols#132, wsl#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, use=att620-103k, + +# AT&T (formerly Teletype) 630 Multi-Tasking Graphics terminal +# The following SETUP modes are assumed for normal operation: +# Local_Echo=Off Gen_Flow=On Return=CR Received_Newline=LF +# Font_Size=Large Non-Layers_Window_Cols=80 +# Non-Layers_Window_Rows=60 +# Other SETUP modes may be set for operator convenience or communication +# requirements. Some capabilities assume a printer attached to the Aux EIA +# port. This termcap description is for the Fixed Non-Layers Window. No +# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! +# (att630: added , and from a BSD termcap file -- esr) +att630|AT&T 630 windowing terminal, + am, da, db, mir, msgr, npc, xon, + cols#80, it#8, lines#60, lm#0, + bel=^G, blink=\E[5m, cbt=\E[Z, clear=\E[H\E[J, cr=^M, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, + el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=\ED, indn=\E[%p1%dS, is2=\E[m, + kbs=^H, kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[M, kent=^M, + kf10=\ENp, kf11=\ENq, kf12=\ENr, kf13=\ENs, kf14=\ENt, + kf15=\ENu, kf16=\ENv, kf17=\ENw, kf18=\ENx, kf19=\ENy, + kf20=\ENz, kf21=\EN{, kf22=\EN|, kf23=\EN}, kf24=\EN~, + kf9=\ENo, khome=\E[H, kich1=\E[@, kil1=\E[L, mc4=\E[?4i, + mc5=\E[?5i, nel=^M^J, pfx=\E[%p1%d;%p2%l%dq%p2%s, rc=\E8, + rev=\E[7m, ri=\EM, rin=\E[%p1%dT, rmir=\E[4l, rmso=\E[m, + rmul=\E[m, rs2=\Ec, sc=\E7, + sgr=\E[0%?%p2%t;4%;%?%p1%p3%|%p4%|%p5%|%t;7%;m, + sgr0=\E[m, smir=\E[4h, smso=\E[7m, smul=\E[4m, +att630-24|5630-24|5630DMD-24|630MTG-24|AT&T 630 windowing terminal 24 lines, + lines#24, use=att630, + +# This entry was modified 3/13/90 by JWE. +# fixes include additions of , correcting , and modification +# of . (See comments below) +# att730 has status line of 80 chars +# These were commented out: , , +# the and up keys are used for shifted system Fkeys +# NOTE: JWE 3/13/90 The 98 key keyboard translation for shift/HOME is +# currently the same as (unshifted HOME or \E[H). On the 102, 102+1 +# and 122 key keyboards, the 730's translation is \E[2J. For consistency +# has been commented out. The user can uncomment if using the +# 102, 102+1, or 122 key keyboards +# kHOM=\E[2J, +# (att730: I added / based on the init string -- esr) +att730|AT&T 730 windowing terminal, + am, da, db, eslok, hs, mir, msgr, npc, xenl, xon, + cols#80, it#8, lh#2, lines#60, lm#0, lw#8, nlab#24, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)0, flash=\E[?5h$<200>\E[?5l, fsl=\E8, + home=\E[H, ht=^I, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, + ind=\ED, invis=\E[8m, + is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)B, + is2=\E[m\017, is3=\E(B\E)0, kLFT=\E[ @, kRIT=\E[ A, kbs=^H, + kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOc, kf10=\ENp, kf11=\ENq, kf12=\ENr, + kf13=\ENs, kf14=\ENt, kf15=\ENu, kf16=\ENv, kf17=\ENw, + kf18=\ENx, kf19=\ENy, kf2=\EOd, kf20=\ENz, kf21=\EN{, + kf22=\EN|, kf23=\EN}, kf24=\EN~, kf25=\EOC, kf26=\EOD, + kf27=\EOE, kf28=\EOF, kf29=\EOG, kf3=\EOe, kf30=\EOH, + kf31=\EOI, kf32=\EOJ, kf33=\ENO, kf34=\ENP, kf35=\ENQ, + kf36=\ENR, kf37=\ENS, kf38=\ENT, kf39=\EOU, kf4=\EOf, + kf40=\EOV, kf41=\EOW, kf42=\EOX, kf43=\EOY, kf44=\EOZ, + kf45=\EO[, kf46=\EO\s, kf47=\EO], kf48=\EO\^, kf5=\EOg, + kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, + kich1=\E[@, kil1=\E[L, kind=\E[S, kri=\E[T, + mc0=\E[?19h\E[0i, mc4=\E[?4i, mc5=\E[?5i, nel=\EE, + pfx=\E[%?%p1%{25}%<%t%p1%e%p1%{24}%-%;%d;%p2%l%02d%?%p1%{25}%<%tq SYS F%p1%:-2d %e;0;3q%;%p2%s, + pfxl=\E[%p1%d;%p2%l%02d;0;0q%p3%:-16.16s%p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, rmacs=^O, + rmam=\E[?7l, rmir=\E[4l, rmln=\E[?13h, rmso=\E[27m, + rmul=\E[24m, rmxon=\E[?21l, rs2=\Ec\E[?3l, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, + smln=\E[?13l, smso=\E[7m, smul=\E[4m, smxon=\E[?21h, + swidm=\E#6, tsl=\E7\E[;%i%p1%dx, +att730-41|730MTG-41|AT&T 730-41 windowing terminal Version, + lines#41, use=att730, +att730-24|730MTG-24|AT&T 730-24 windowing terminal Version, + lines#24, use=att730, +att730r|730MTGr|AT&T 730 rev video windowing terminal Version, + flash=\E[?5l$<200>\E[?5h, + is1=\E[8;0|\E[?3;4;13;15l\E[?5h\E[13;20l\E[?7h\E[12h\E(B\E)B, use=att730, +att730r-41|730MTG-41r|AT&T 730r-41 rev video windowing terminal Version, + lines#41, use=att730r, +att730r-24|730MTGr-24|AT&T 730r-24 rev video windowing terminal Version, + lines#24, use=att730r, + +# The following represents the screen layout along with the associated +# bezel buttons for the 5430/pt505 terminal. The "kf" designations do +# not appear on the screen but are shown to reference the bezel buttons. +# The "CMD", "MAIL", and "REDRAW" buttons are shown in their approximate +# position relative to the screen. +# +# +# +# +----------------------------------------------------------------+ +# | | +# XXXX | kf0 kf24 | XXXX +# | | +# | | +# XXXX | kf1 kf23 | XXXX +# | | +# | | +# XXXX | kf2 kf22 | XXXX +# | | +# | | +# XXXX | kf3 kf21 | XXXX +# | | +# | | +# XXXX | kf4 kf20 | XXXX +# | | +# | | +# XXXX | kf5 kf19 | XXXX +# | | +# | | +# XXXX | kf6 kf18 | XXXX +# | | +# | | +# XXXX | | XXXX +# | | +# | | +# +----------------------------------------------------------------+ +# +# XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX +# +# Note: XXXX represents the screen buttons +# CMD REDRAW +# +# MAIL +# +# version 1 note: +# The character string sent by key 'kf26' may be user programmable +# to send either \E[16s, or \E[26s. +# The character string sent by key 'krfr' may be user programmable +# to send either \E[17s, or \E[27s. +# +# Depression of the "CMD" key sends \E! (kcmd) +# Depression of the "MAIL" key sends \E[26s (kf26) +# "REDRAW" same as "REFRESH" (krfr) +# +# "kf" functions adds carriage return to output string if terminal is in +# 'new line' mode. +# +# The following are functions not covered in the table above: +# +# Set keyboard character (SKC): \EPn1;Pn2w +# Pn1= 0 Back Space key +# Pn1= 1 Break key +# Pn2= Program char (hex) +# +# Screen Definition (SDF): \E[Pn1;Pn2;Pn3;Pn4;Pn5t +# Pn1= Window number (1-39) +# Pn2-Pn5= Y;X;Y;X coordinates +# +# Screen Selection (SSL): \E[Pnu +# Pn= Window number +# +# Set Terminal Modes (SM): \E[Pnh +# Pn= 3 Graphics mode +# Pn= > Cursor blink +# Pn= < Enter new line mode +# Pn= = Enter reverse insert/replace mode +# Pn= ? Enter no scroll mode +# +# Reset Terminal Mode (RM): \E[Pnl +# Pn= 3 Exit graphics mode +# Pn= > Exit cursor blink +# Pn= < Exit new line mode +# Pn= = Exit reverse insert/replace mode +# Pn= ? Exit no scroll mode +# +# Screen Status Report (SSR): \E[Pnp +# Pn= 0 Request current window number +# Pn= 1 Request current window dimensions +# +# Device Status Report (DSR): \E[6n Request cursor position +# +# Call Status Report (CSR): \E[Pnv +# Pn= 0 Call failed +# Pn= 1 Call successful +# +# Transparent Button String (TBS): \E[Pn1;Pn2;Pn3;{string +# Pn1= Button number to be loaded +# Pn2= Character count of "string" +# Pn3= Key mode being loaded: +# 0= Unshifted +# 1= Shifted +# 2= Control +# String= Text string (15 chars max) +# +# Screen Number Report (SNR): \E[Pnp +# Pn= Screen number +# +# Screen Dimension Report (SDR): \E[Pn1;Pn2r +# Pn1= Number of rows available in window +# Pn2= Number of columns available in window +# +# Cursor Position Report (CPR): \E[Pn1;Pn2R +# Pn1= "Y" Position of cursor +# Pn2= "X" Position of cursor +# +# Request Answer Back (RAB): \E[c +# +# Answer Back Response (ABR): \E[?;*;30;VSV +# *= 0 No printer available +# *= 2 Printer available +# V= Software version number +# SV= Software sub version number +# (printer-available field not documented in v1) +# +# Screen Alignment Aid: \En +# +# Bell (lower pitch): \E[x +# +# Dial Phone Number: \EPdstring\ +# string= Phone number to be dialed +# +# Set Phone Labels: \EPpstring\ +# string= Label for phone buttons +# +# Set Clock: \EPchour;minute;second\ +# +# Position Clock: \EPsY;X\ +# Y= "Y" coordinate +# X= "X" coordinate +# +# Delete Clock: \Epr\ +# +# Programming The Function Buttons: \EPfPn;string\ +# Pn= Button number (00-06, 18-24) +# (kf00-kf06, kf18-kf24) +# string= Text to sent on button depression +# +# The following in version 2 only: +# +# Request For Local Directory Data: \EPp12;\ +# +# Local Directory Data to host: \EPp11;LOCAL...DIRECTORY...DATA\ +# +# Request for Local Directory Data in print format: \EPp13;\ +# +# Enable 'Prt on Line' mode: \022 (DC2) +# +# Disable 'Prt on Line' mode: \024 (DC4) +# + +# 05-Aug-86: +# The following Terminfo entry describes functions which are supported by +# the AT&T 5430/pt505 terminal software version 2 and later. +att505|pt505|att5430|gs5430|AT&T Personal Terminal 505 or 5430 GETSET terminal, + am, xon, + cols#80, it#8, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[2J\E[H, + cnorm=\E[>l, cr=^M, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[>h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[0J, el=\E[0K, el1=\E2K, home=\E[H, ht=^I, + il=\E[%p1%dL, il1=\E[L, ind=^J, + is1=\EPr\\E[0u\E[2J\E[0;0H\E[m\E[3l\E[l\E[=l\E[?l, + kbs=^H, kcmd=\E!, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf0=\E[00s, kf1=\E[01s, kf18=\E[18s, + kf19=\E[19s, kf2=\E[02s, kf20=\E[20s, kf21=\E[21s, + kf22=\E[22s, kf23=\E[23s, kf24=\E24s, kf26=\E26s, + kf3=\E[03s, kf4=\E[04s, kf5=\E[05s, kf6=\E[06s, + krfr=\E[27s, mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, + rmacs=\E[10m, rmam=\E[11;1j, rmir=\E[4l, rmso=\E[m, + rmul=\E[m, rs1=\Ec, sc=\E7, sgr0=\E[m, smacs=\E[11m, + smam=\E[11;0j, smir=\E[4h, smso=\E[1m, smul=\E[4m, + +# The following Terminfo entry describes functions which are supported by +# the AT&T 5430/pt505 terminal software version 1. +att505-24|pt505-24|gs5430-24|AT&T PT505 or 5430 GETSET version 1 24 lines, + lines#24, + mc4@, mc5@, rc@, rmam@, sc@, smam@, use=att505, +tt505-22|pt505-22|gs5430-22|AT&T PT505 or 5430 GETSET version 1 22 lines, + lines#22, use=att505, +# +# -------------------- TERMINFO FILE CAN BE SPLIT HERE ----------------------- +# This cut mark helps make life less painful for people running ncurses tic +# on machines with relatively little RAM. The file can be broken in half here +# cleanly and compiled in sections -- no `use' references cross this cut +# going forward. +# + +#### Ampex (Dialogue) +# +# Yes, these are the same people who are better-known for making audio- and +# videotape. I'm told they are located in Redwood City, CA. +# + +# From: Fri Sep 11 22:38:32 1981 +# (ampex80: some capabilities merged in from SCO's entry -- esr) +ampex80|a80|d80|dialogue|dialogue80|ampex dialogue 80, + am, bw, ul, + cols#80, it#8, lines#24, + bel=^G, cbt=\EI, clear=\E*$<75>, cr=^M, cub1=^H, cud1=^J, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\EW, dl1=\ER$<5*>, ed=\Ey, el=\Et, ht=^I, hts=\E1, + ich1=\EQ, il1=\EE$<5*>, ind=^J, is2=\EA, rmso=\Ek, rmul=\Em, + smso=\Ej, smul=\El, tbc=\E3, +# This entry was from somebody anonymous, Tue Aug 9 20:11:37 1983, who wrote: +ampex175|ampex d175, + am, + cols#80, lines#24, + bel=^G, clear=\E+, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\Ey, el=\Et, home=^^, ich1=\EQ, il1=\EE, ind=^J, + is2=\EX\EA\EF, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, + kdch1=\EW, kdl1=\ER, khome=^^, kich1=\EQ, kil1=\EE, ll=^^^K, + rmcup=\EF, rmso=\Ek, rmul=\Em, smcup=\EN, smso=\Ej, smul=\El, +# No backspace key in the main QWERTY cluster. Fortunately, it has a +# NEWLINE/PAGE key just above RETURN that sends a strange single-character +# code. Given a suitable Unix (one that lets you set an echo-erase-as-BS-SP-BS +# mode), this key can be used as the erase key; I find I like this. Because +# some people and some systems may not, there is another termcap ("ampex175") +# that suppresses this little eccentricity by omitting the relevant capability. +ampex175-b|ampex d175 using left arrow for erase, + kbs=^_, + use=ampex175, +# From: Richard Bascove +# (ampex210: removed obsolete ":kn#10:" -- esr) +ampex210|a210|ampex a210, + am, hs, xenl, + cols#80, it#8, lines#24, xmc#1, + cbt=\EI, clear=\E*, cub1=^H, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\Ey, el=\Et, flash=\EU\EX\EU\EX\EU\EX\EU\EX, + fsl=\E.2, home=^^, ht=^I, ich1=\EQ, + if=/usr/share/tabset/std, il1=\EE, invis@, + is2=\EC\Eu\E'\E(\El\EA\E%\E{\E.2\EG0\Ed\En, kcub1=^H, + kcud1=^V, kcuf1=^L, kcuu1=^K, kf0=^A0\r, kf1=^A1\r, + kf2=^A2\r, kf3=^A3\r, kf4=^A4\r, kf5=^A5\r, kf6=^A6\r, + kf7=^A7\r, kf8=^A8\r, kf9=^A9\r, khome=^^, + tsl=\E.0\Eg\E}\Ef, use=adm+sgr, +# (ampex219: I added / based on the init string, added +# from ampex219w, added =\E[?3l, irresistibly suggested by , +# and moved the padding to be *after* the caps -- esr) +ampex219|ampex-219|amp219|Ampex with Automargins, + hs, xenl, + cols#80, it#8, lines#24, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, cbt=\E[Z, + clear=\E[H\E[2J$<50>, cnorm=\E[?3l, cr=^M, + csr=%i\E[%p1%2d;%p2%2dr, cub1=^H, cud1=\E[B, + cuf1=\E[C$<2>, cup=\E[%i%p1%d;%p2%dH$<5>, + cuu1=\E[A$<2>, cvvis=\E[?3h, dim=\E[1m, ed=\E[J$<50>, + el=\E[K$<3>, home=\E[H, ht=^I, ind=^J, + is2=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\E[21~, + kf1=\E[7~, kf2=\E[8~, kf3=\E[9~, kf4=\E[10~, kf5=\E[11~, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[H, + rev=\E[7m, ri=\EM$<5>, rmam=\E[?7l, rmkx=\E>, + rmso=\E[m$<2>, rmul=\E[m$<2>, sgr0=\E[m$<2>, smam=\E[?7h, + smkx=\E=, smso=\E[7m$<2>, smul=\E[4m$<2>, +ampex219w|ampex-219w|amp219w|Ampex 132 cols, + cols#132, lines#24, + bel=^G, cr=^M, cud1=^J, ind=^J, + is2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, use=ampex219, +# (ampex232: removed , no file and no --esr) +ampex232|ampex-232|Ampex Model 232, + am, + cols#80, lines#24, xmc#1, + cbt=\EI, civis=\E.0, clear=\E+, cnorm=\E.4, cub1=^H, cud1=^V, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\EW, dl1=\ER$<5*/>, ed=\EY, el=\ET, + flash=\Eb$<200/>\Ed, ht=^I, ich1=\EQ, il1=\EE$<5*/>, + invis@, is2=\Eg\El, kbs=^H, kcub1=^H, kcud1=^V, kcuf1=^L, + kcuu1=^K, kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, + kf4=^AD\r, kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, + kf9=^AI\r, khome=^^, + use=adm+sgr, +# (ampex: removed , no file and no -- esr) +ampex232w|Ampex Model 232 / 132 columns, + cols#132, lines#24, + is2=\E\034Eg\El, use=ampex232, + +#### Ann Arbor (aa) +# +# Ann Arbor made dream terminals for hackers -- large screen sizes and huge +# numbers of function keys. At least some used monitors in portrait mode, +# allowing up to 76-character screen heights! They were reachable at: +# +# Ann Arbor Terminals +# 6175 Jackson Road +# Ann Arbor, MI 48103 +# (313)-663-8000 +# +# But in 1996 the phone number reaches some kitschy retail shop, and Ann Arbor +# can't be found on the Web; I fear they're long dead. R.I.P. +# + + +# Originally from Mike O'Brien@Rand and Howard Katseff at Bell Labs. +# Highly modified 6/22 by Mike O'Brien. +# split out into several for the various screen sizes by dave-yost@rand +# Modifications made 3/82 by Mark Horton +# Modified by Tom Quarles at UCB for greater efficiency and more diversity +# status line moved to top of screen, removed 5/82 +# Some unknown person at SCO then hacked the init strings to make them more +# efficient. +# +# assumes the following setup: +# A menu: 0000 1010 0001 0000 +# B menu: 9600 0100 1000 0000 0000 1000 0000 17 19 +# C menu: 56 66 0 0 9600 0110 1100 +# D menu: 0110 1001 1 0 +# +# Briefly, the settings are for the following modes: +# (values are for bit set/clear with * indicating our preference +# and the value used to test these termcaps) +# Note that many of these settings are irrelevent to the terminfo +# and are just set to the default mode of the terminal as shipped +# by the factory. +# +# A menu: 0000 1010 0001 0000 +# Block/underline cursor* +# blinking/nonblinking cursor* +# key click/no key click* +# bell/no bell at column 72* +# +# key pad is cursor control*/key pad is numeric +# return and line feed/return for key * +# repeat after .5 sec*/no repeat +# repeat at 25/15 chars per sec. * +# +# hold data until pause pressed/process data unless pause pressed* +# slow scroll/no slow scroll* +# Hold in area/don't hold in area* +# functions keys have default*/function keys disabled on powerup +# +# show/don't show position of cursor during page transmit* +# unused +# unused +# unused +# +# B menu: 9600 0100 1000 0000 0000 1000 0000 17 19 +# Baud rate (9600*) +# +# 2 bits of parity - 00=odd,01=even*,10=space,11=mark +# 1 stop bit*/2 stop bits +# parity error detection off*/on +# +# keyboard local/on line* +# half/full duplex* +# disable/do not disable keyboard after data transmission* +# +# transmit entire page/stop transmission at cursor* +# transfer/do not transfer protected characters* +# transmit all characters/transmit only selected characters* +# transmit all selected areas/transmit only 1 selected area* +# +# transmit/do not transmit line separators to host* +# transmit/do not transmit page tab stops tabs to host* +# transmit/do not transmit column tab stop tabs to host* +# transmit/do not transmit graphics control (underline,inverse..)* +# +# enable*/disable auto XON/XOFF control +# require/do not require receipt of a DC1 from host after each LF* +# pause key acts as a meta key/pause key is pause* +# unused +# +# unused +# unused +# unused +# unused +# +# XON character (17*) +# XOFF character (19*) +# +# C menu: 56 66 0 0 9600 0110 1100 +# number of lines to print data on (printer) (56*) +# +# number of lines on a sheet of paper (printer) (66*) +# +# left margin (printer) (0*) +# +# number of pad chars on new line to printer (0*) +# +# printer baud rate (9600*) +# +# printer parity: 00=odd,01=even*,10=space,11=mark +# printer stop bits: 2*/1 +# print/do not print guarded areas* +# +# new line is: 01=LF,10=CR,11=CRLF* +# unused +# unused +# +# D menu: 0110 1001 1 0 +# LF is newline/LF is down one line, same column* +# wrap to preceding line if move left from col 1*/don't wrap +# wrap to next line if move right from col 80*/don't wrap +# backspace is/is not destructive* +# +# display*/ignore DEL character +# display will not/will scroll* +# page/column tab stops* +# erase everything*/erase unprotected only +# +# editing extent: 0=display,1=line*,2=field,3=area +# +# unused +# + +annarbor4080|aa4080|ann arbor 4080, + am, + cols#80, lines#40, + bel=^G, clear=\014$<2>, cr=^M, cub1=^H, cud1=^J, cuf1=^_, + cup=\017%p2%{10}%/%{16}%*%p2%{10}%m%+%c%p1%?%p1%{19}%>%t%{12}%+%;%'@'%+%c, + cuu1=^N, home=^K, ht=^I, hts=^]^P1, ind=^J, kbs=^^, kcub1=^H, + kcud1=^J, kcuf1=^_, kcuu1=^N, khome=^K, tbc=^\^P^P, + +# Strange Ann Arbor terminal from BRL +aas1901|Ann Arbor K4080 w/S1901 mod, + am, + cols#80, lines#40, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^_, cuu1=^N, + home=^K, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, ll=^O\200c, + nel=^M^J, + +# If you're using the GNU termcap library, add +# :cS=\E[%p1%d;%p2%d;%p3%d;%p4%dp: +# to these capabilities. This is the nonstandard GNU termcap scrolling +# capability, arguments are: +# 1. Total number of lines on the screen. +# 2. Number of lines above desired scroll region. +# 3. Number of lines below (outside of) desired scroll region. +# 4. Total number of lines on the screen, the same as the first parameter. +# The generic Ann Arbor entry is the only one that uses this. +aaa+unk|aaa-unk|ann arbor ambassador (internal - don't use this directly), + am, km, mc5i, mir, xon, + cols#80, it#8, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + clear=\E[H\E[J$<156>, cr=^M, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^K, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K$<5>, home=\E[H, hpa=\E[%p1%{1}%+%dG, ht=^I, + hts=\EH, ich=\E[%p1%d@$<4*>, ich1=\E[@$<4>, il=\E[%p1%dL, + il1=\E[L$<3>, ind=^K, invis=\E[8m, is1=\E[m\E7\E[H\E9\E8, + is3=\E[1Q\E[>20;30l\EP`+x~M\E\\, kbs=^H, kcbt=\E[Z, + kclr=\E[J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[P, kdl1=\E[M, kf1=\EOA, kf10=\EOJ, kf11=\EOK, + kf12=\EOL, kf13=\EOM, kf14=\EON, kf15=\EOO, kf16=\EOP, + kf17=\EOQ, kf18=\EOR, kf19=\EOS, kf2=\EOB, kf20=\EOT, + kf21=\EOU, kf22=\EOV, kf23=\EOW, kf24=\EOX, kf3=\EOC, + kf4=\EOD, kf5=\EOE, kf6=\EOF, kf7=\EOG, kf8=\EOH, kf9=\EOI, + khome=\E[H, kich1=\E[@, kil1=\E[L, krmir=\E6, mc0=\E[0i, + mc4=^C, mc5=\E[v, mc5p=\E[%p1%dv, rc=\E8, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, + rmkx=\EP`>y~[[J`8xy~[[A`4xy~[[D`6xy~[[C`2xy~[[B\E\\, + rmm=\E[>52l, rmso=\E[m, rmul=\E[m, sc=\E7, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m, + sgr0=\E[m, + smkx=\EP`>z~[[J`8xz~[[A`4xz~[[D`6xz~[[C`2xz~[[B\E\\, + smm=\E[>52h, smso=\E[7m, smul=\E[4m, tbc=\E[2g, + vpa=\E[%p1%{1}%+%dd, + +aaa+rv|ann arbor ambassador in reverse video, + blink=\E[5;7m, bold=\E[1;7m, invis=\E[7;8m, + is1=\E[7m\E7\E[H\E9\E8, rev=\E[m, rmso=\E[7m, rmul=\E[7m, + rs1=\E[H\E[7m\E[J$<156>, + sgr=\E[%?%p1%p3%|%!%t7;%;%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m, + sgr0=\E[7m\016, smso=\E[m, smul=\E[4;7m, +# Ambassador with the DEC option, for partial vt100 compatibility. +aaa+dec|ann arbor ambassador in dec vt100 mode, + acsc=aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}, + csr=\E[%i%p1%d;%p2%dr, enacs=\E(0, rmacs=^N, + sgr=\E[%?%p1%p3%|%!%t7;%;%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m%?%p9%t\017%e\016%;, + smacs=^O, +aaa-18|ann arbor ambassador/18 lines, + lines#18, + is2=\E7\E[60;0;0;18p\E8, + rmcup=\E[60;0;0;18p\E[60;1H\E[K, smcup=\E[18;0;0;18p, use=aaa+unk, +aaa-18-rv|ann arbor ambassador/18 lines+reverse video, + use=aaa+rv, use=aaa-18, +aaa-20|ann arbor ambassador/20 lines, + lines#20, + is2=\E7\E[60;0;0;20p\E8, + rmcup=\E[60;0;0;20p\E[60;1H\E[K, smcup=\E[20;0;0;20p, use=aaa+unk, +aaa-22|ann arbor ambassador/22 lines, + lines#22, + is2=\E7\E[60;0;0;22p\E8, + rmcup=\E[60;0;0;22p\E[60;1H\E[K, smcup=\E[22;0;0;22p, use=aaa+unk, +aaa-24|ann arbor ambassador/24 lines, + lines#24, + is2=\E7\E[60;0;0;24p\E8, + rmcup=\E[60;0;0;24p\E[60;1H\E[K, smcup=\E[24;0;0;24p, use=aaa+unk, +aaa-24-rv|ann arbor ambassador/24 lines+reverse video, + use=aaa+rv, use=aaa-24, +aaa-26|ann arbor ambassador/26 lines, + lines#26, + is2=\E7\E[60;0;0;26p\E8, + rmcup=\E[60;0;0;26p\E[26;1H\E[K, + smcup=\E[H\E[J$<156>\E[26;0;0;26p, use=aaa+unk, +aaa-28|ann arbor ambassador/28 lines, + lines#28, + is2=\E7\E[60;0;0;28p\E8, + rmcup=\E[60;0;0;28p\E[28;1H\E[K, + smcup=\E[H\E[J$<156>\E[28;0;0;28p, use=aaa+unk, +aaa-30-s|aaa-s|ann arbor ambassador/30 lines w/status, + eslok, hs, + lines#29, + dsl=\E7\E[60;0;0;30p\E[1;1H\E[K\E[H\E8\r\n\E[K, + fsl=\E[>51l, is2=\r\n\E[A\E7\E[60;1;0;30p\E8, + rmcup=\E[60;1;0;30p\E[29;1H\E[K, + smcup=\E[H\E[J$<156>\E[30;1;0;30p\E[30;1H\E[K, + tsl=\E[>51h\E[1;%p1%dH\E[2K, + use=aaa+unk, +aaa-30-s-rv|aaa-s-rv|ann arbor ambassador/30 lines+status+reverse video, + use=aaa+rv, use=aaa-30-s, +aaa-s-ctxt|aaa-30-s-ctxt|ann arbor ambassador/30 lines+status+save context, + rmcup=\E[60;1;0;30p\E[59;1H\E[K, + smcup=\E[30;1H\E[K\E[30;1;0;30p, use=aaa-30-s, +aaa-s-rv-ctxt|aaa-30-s-rv-ct|ann arbor ambassador/30 lines+status+save context, + rmcup=\E[60;1;0;30p\E[59;1H\E[K, + smcup=\E[30;1H\E[K\E[30;1;0;30p, use=aaa-30-s-rv, +aaa|aaa-30|ambas|ambassador|ann arbor ambassador/30 lines, + lines#30, + is2=\E7\E[60;0;0;30p\E8, + rmcup=\E[60;0;0;30p\E[30;1H\E[K, + smcup=\E[H\E[J$<156>\E[30;0;0;30p, use=aaa+unk, +aaa-30-rv|aaa-rv|ann arbor ambassador/30 lines in reverse video, + use=aaa+rv, use=aaa-30, +aaa-30-ctxt|aaa-ctxt|ann arbor ambassador/30 lines; saving context, + rmcup=\E[60;0;0;30p\E[60;1H\E[K, smcup=\E[30;0;0;30p, + use=aaa-30, +aaa-30-rv-ctxt|aaa-rv-ctxt|ann arbor ambassador/30 lines reverse video; saving context, + rmcup=\E[60;0;0;30p\E[60;1H\E[K, smcup=\E[30;0;0;30p, + use=aaa+rv, use=aaa-30, +aaa-36|ann arbor ambassador/36 lines, + lines#36, + is2=\E7\E[60;0;0;36p\E8, + rmcup=\E[60;0;0;36p\E[36;1H\E[K, + smcup=\E[H\E[J$<156>\E[36;0;0;36p, use=aaa+unk, +aaa-36-rv|ann arbor ambassador/36 lines+reverse video, + use=aaa+rv, use=aaa-36, +aaa-40|ann arbor ambassador/40 lines, + lines#40, + is2=\E7\E[60;0;0;40p\E8, + rmcup=\E[60;0;0;40p\E[40;1H\E[K, + smcup=\E[H\E[J$<156>\E[40;0;0;40p, use=aaa+unk, +aaa-40-rv|ann arbor ambassador/40 lines+reverse video, + use=aaa+rv, use=aaa-40, +aaa-48|ann arbor ambassador/48 lines, + lines#48, + is2=\E7\E[60;0;0;48p\E8, + rmcup=\E[60;0;0;48p\E[48;1H\E[K, + smcup=\E[H\E[J$<156>\E[48;0;0;48p, use=aaa+unk, +aaa-48-rv|ann arbor ambassador/48 lines+reverse video, + use=aaa+rv, use=aaa-48, +aaa-60-s|ann arbor ambassador/59 lines+status, + eslok, hs, + lines#59, + dsl=\E7\E[60;0;0;60p\E[1;1H\E[K\E[H\E8\r\n\E[K, + fsl=\E[>51l, is2=\r\n\E[A\E7\E[60;1;0;60p\E8, + tsl=\E[>51h\E[1;%p1%dH\E[2K, + use=aaa+unk, +aaa-60-s-rv|ann arbor ambassador/59 lines+status+reverse video, + use=aaa+rv, use=aaa-60-s, +aaa-60-dec-rv|ann arbor ambassador/dec mode+59 lines+status+rev video, + use=aaa+dec, use=aaa+rv, use=aaa-60-s, +aaa-60|ann arbor ambassador/60 lines, + lines#60, + is2=\E7\E[60;0;0;60p\E[1Q\E[m\E[>20;30l\E8, use=aaa+unk, +aaa-60-rv|ann arbor ambassador/60 lines+reverse video, + use=aaa+rv, use=aaa-60, +aaa-db|ann arbor ambassador 30/destructive backspace, + cub1=\E[D, is3=\E[1Q\E[m\E[>20l\E[>30h, + use=aaa-30, + +guru|guru-33|guru+unk|ann arbor guru/33 lines 80 cols, + lines#33, + flash=\E[>59h$<100>\E[>59l, + is2=\E7\E[255;0;0;33;80;80p\E8\E[J, is3=\E[>59l, + rmcup=\E[255p\E[255;1H\E[K, smcup=\E[33p, + use=aaa+unk, +guru+rv|guru changes for reverse video, + flash=\E[>59l$<100>\E[>59h, is3=\E[>59h, +guru-rv|guru-33-rv|ann arbor guru/33 lines+reverse video, + use=guru+rv, use=guru-33, +guru+s|guru status line, + eslok, hs, + dsl=\E7\E[;0p\E[1;1H\E[K\E[H\E8\r\n\E[K, fsl=\E[>51l, + rmcup=\E[255;1p\E[255;1H\E[K, smcup=, + tsl=\E[>51h\E[1;%p1%dH\E[2K, +guru-nctxt|guru with no saved context, + smcup=\E[H\E[J$<156>\E[33p\E[255;1H\E[K, use=guru, +guru-s|guru-33-s|ann arbor guru/33 lines+status, + lines#32, + is2=\r\n\E[A\E7\E[255;1;0;33;80;80p\E8\E[J, + smcup=\E[33;1p\E[255;1H\E[K, + use=guru+s, use=guru+unk, +guru-24|ann arbor guru 24 lines, + cols#80, lines#24, + is2=\E7\E[255;0;0;24;80;80p\E8\E[J, smcup=\E[24p, use=guru+unk, +guru-44|ann arbor guru 44 lines, + cols#97, lines#44, + is2=\E7\E[255;0;0;44;97;100p\E8\E[J, smcup=\E[44p, use=guru+unk, +guru-44-s|ann arbor guru/44 lines+status, + lines#43, + is2=\r\n\E[A\E7\E[255;1;0;44;80;80p\E8\E[J, + smcup=\E[44;1p\E[255;1H\E[K, + use=guru+s, use=guru+unk, +guru-76|guru with 76 lines by 89 cols, + cols#89, lines#76, + is2=\E7\E[255;0;0;76;89;100p\E8\E[J, smcup=\E[76p, use=guru+unk, +guru-76-s|ann arbor guru/76 lines+status, + cols#89, lines#75, + is2=\r\n\E[A\E7\E[255;1;0;76;89;100p\E8\E[J, + smcup=\E[76;1p\E[255;1H\E[K, + use=guru+s, use=guru+unk, +guru-76-lp|guru-lp|guru with page bigger than line printer, + cols#134, lines#76, + is2=\E7\E[255;0;0;76;134;134p\E8\E[J, smcup=\E[76p, use=guru+unk, +guru-76-w|guru 76 lines by 178 cols, + cols#178, lines#76, + is2=\E7\E[255;0;0;76;178;178p\E8\E[J, smcup=\E[76p, use=guru+unk, +guru-76-w-s|ann arbor guru/76 lines+status+wide, + cols#178, lines#75, + is2=\r\n\E[A\E7\E[255;1;0;76;178;178p\E8\E[J, + smcup=\E[76;1p\E[255;1H\E[K, + use=guru+s, use=guru+unk, +guru-76-wm|guru 76 lines by 178 cols with 255 cols memory, + cols#178, lines#76, + is2=\E7\E[255;0;0;76;178;255p\E8\E[J, smcup=\E[76p, use=guru+unk, +aaa-rv-unk|ann arbor unknown type, + lh#0, lw#0, nlab#0, + blink=\E[5;7m, bold=\E[1;7m, home=\E[H, invis=\E[7;8m, + is1=\E[7m\E7\E[H\E9\E8, rev=\E[m, rmso=\E[7m, rmul=\E[7m, + rs1=\E[H\E[7m\E[J, + sgr=\E[%?%p1%!%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m, + sgr0=\E[7m, smso=\E[m, smul=\E[4;7m, + +#### Applied Digital Data Systems (adds) +# +# ADDS itself is long gone. ADDS was bought by NCR, and the same group made +# ADDS and NCR terminals. When AT&T and NCR merged, the engineering for +# terminals was merged again. Then AT&T sold the terminal business to +# SunRiver. The engineers from Teletype, AT&T terminals, ADDS, +# and NCR (who are still there as of early 1995) are at: +# +# SunRiver Data Systems +# 100 Marcus Boulevard +# Hauppauge, NY 11788-3762 +# Vox: (800)-231-5445 +# Fax: (516)-342-7378 +# +# Their voice mail used to describe the place as "SunRiver (formerly ADDS)". +# In 1995 SunRiver acquired DEC's terminals business. +# + +# Regent: lowest common denominator, works on all regents. +# (regent: renamed ":bc:" to ":le:" -- esr) +regent|Adds Regent Series, + am, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^U, cud1=^J, cuf1=^F, cuu1=^Z, + home=\EY\s\s, ind=^J, ll=^A, +# Regent 100 has a bug where if computer sends escape when user is holding +# down shift key it gets confused, so we avoid escape. +regent100|Adds Regent 100, + xmc#1, + bel=^G, cup=\013%p1%{32}%+%c%p2%p2%{6}%*%+\020%c, + kf0=^B1\r, kf1=^B2\r, kf2=^B3\r, kf3=^B4\r, kf4=^B5\r, + kf5=^B6\r, kf6=^B7\r, kf7=^B8\r, lf0=F1, lf1=F2, lf2=F3, + lf3=F4, lf4=F5, lf5=F6, lf6=F7, lf7=F8, rmso=\E0@, rmul=\E0@, + sgr0=\E0@, smso=\E0P, smul=\E0`, + use=regent, +regent20|Adds Regent 20, + bel=^G, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, ed=\Ek, el=\EK, use=regent, +regent25|Adds Regent 25, + bel=^G, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^Z, khome=^A, use=regent20, +regent40|Adds Regent 40, + xmc#1, + bel=^G, dl1=\El$<2*>, il1=\EM$<2*>, kf0=^B1\r, kf1=^B2\r, + kf2=^B3\r, kf3=^B4\r, kf4=^B5\r, kf5=^B6\r, kf6=^B7\r, + kf7=^B8\r, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, lf5=F6, + lf6=F7, lf7=F8, rmso=\E0@, rmul=\E0@, sgr0=\E0@, smso=\E0P, + smul=\E0`, + use=regent25, +regent40+|Adds Regent 40+, + is2=\EB, use=regent40, +regent60|regent200|Adds Regent 60, + dch1=\EE, is2=\EV\EB, kdch1=\EE, kich1=\EF, krmir=\EF, + rmir=\EF, rmso=\ER\E0@\EV, smir=\EF, smso=\ER\E0P\EV, + use=regent40+, +# From: Thu Jul 9 09:27:33 1981 +# (viewpoint: added , function key, and capabilities -- esr) +viewpoint|addsviewpoint|adds viewpoint, + am, + cols#80, lines#24, + bel=^G, clear=^L, cnorm=\017\E0`, cr=^M, cub1=^H, cud1=^J, + cuf1=^F, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, + cvvis=\017\E0P, dl1=\El, ed=\Ek$<16.1*>, el=\EK$<16>, + ind=^J, is2=\017\E0`, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^Z, + kf0=^B1, kf2=^B2, kf3=^B!, kf4=^B", kf5=^B#, khome=^A, ll=^A, + rmso=^O, rmul=^O, sgr0=^O, smso=^N, smul=^N, +# Some viewpoints have bad ROMs that foo up on ^O +screwpoint|adds viewpoint with ^O bug, + cvvis@, rmso@, rmul@, smso@, smul@, use=viewpoint, + +# From: Jay S. Rouman 5 Jul 92 +# The /// strings were added by ESR from specs. +# Theory; the vp3a+ wants \E0%c to set highlights, where normal=01000000, +# underline=01100000, rev=01010000, blink=01000010,dim=01000001, +# invis=01000100 and %c is the logical or of desired attributes. +# There is also a `tag bit' enabling attributes, set by \E) and unset by \E(. +vp3a+|viewpoint3a+|adds viewpoint 3a+, + am, bw, + cols#80, it#8, lines#24, + civis=^W, clear=\E*$<80>, cnorm=^X, cr=^M, cub1=^H, cud1=^J, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + ed=\EY$<80>, el=\ET, home=^^, ht=^I, ind=^J, kbs=^H, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, nel=^M^J, rmso=\E(, + sgr=\E0%'@'%?%p1%tQ%|%;%?%p2%t%'`'%|%;%?%p3%tP%|%;%?%p4%t%{2}%|%;%?%p5%t%{1}%|%;%?%p7%tD%|%;%c\E), + sgr0=\E(, smso=\E0Q\E), +vp60|viewpoint60|addsvp60|adds viewpoint60, + use=regent40, +# +# adds viewpoint 90 - from cornell +# Note: emacs sends ei occasionally to insure the terminal is out of +# insert mode. This unfortunately puts the viewpoint90 IN insert +# mode. A hack to get around this is . (Also, +# - :ei=:im=: must be present in the termcap translation.) +# - indicates glitch that attributes stick to location +# - means it's safe to move in standout mode +# - : clears screen and visual attributes without affecting +# the status line +# Function key and label capabilities merged in from SCO. +vp90|viewpoint90|adds viewpoint 90, + bw, msgr, xhp, + cols#80, lines#24, + clear=\EG\Ek, cub1=^H, cud1=^J, cuf1=^F, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dch1=\EE, + dl1=\El, ed=\Ek, el=\EK, home=\EY\s\s, ht=^I, + ich1=\EF \EF\025, ind=^J, kbs=^H, kcub1=^U, kcud1=^J, + kcuf1=^F, kcuu1=^Z, kf0=^B1\r, kf1=^B2\r, kf10=^B;\r, + kf2=^B3\r, kf3=^B4\r, kf4=^B5\r, kf5=^B6\r, kf6=^B7\r, + kf7=^B8\r, kf8=^B9\r, kf9=^B\:\r, khome=^A, lf0=F1, lf1=F2, + lf10=F11, lf2=F3, lf3=F4, lf4=F5, lf5=F6, lf6=F7, lf7=F8, lf8=F9, + lf9=F10, ll=^A, rmso=\ER\E0@\EV, rmul=\ER\E0@\EV, + sgr0=\ER\E0@\EV, smso=\ER\E0Q\EV, smul=\ER\E0`\EV, +# Note: if return acts weird on a980, check internal switch #2 +# on the top chip on the CONTROL pc board. +adds980|a980|adds consul 980, + am, + cols#80, lines#24, + bel=^G, clear=\014$<1>\013@, cr=^M, cub1=^H, cud1=^J, + cuf1=\E^E01, cup=\013%p1%'@'%+%c\E\005%p2%2d, + dl1=\E\017$<13>, il1=\E\016$<13>, ind=^J, kf0=\E0, kf1=\E1, + kf2=\E2, kf3=\E3, kf4=\E4, kf5=\E5, kf6=\E6, kf7=\E7, kf8=\E8, + kf9=\E9, rmso=^O, sgr0=^O, smso=^Y^^^N, + +#### C. Itoh Electronics +# +# As of 1995 these people no longer make terminals (they're still in the +# printer business). Their terminals were all clones of the DEC VT series. +# They're located in Orange County, CA. +# + +# CIT 80 - vt-52 emulator, the termcap has been modified to remove +# the delay times and do an auto tab set rather than the indirect +# file used in vt100. +cit80|cit-80|citoh 80, + am, + cols#80, lines#24, + clear=\E[H\EJ, cr=^M, cub1=^H, cuf1=\E[C, + cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, ed=\EJ, el=\EK, ff=^L, + ind=^J, is2=\E>, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, rmkx=\E[?1l\E>, smkx=\E[?1h\E=, +# From: Tim Wood Fri Sep 27 09:39:12 PDT 1985 +# (cit101: added / based on init string, merged this with c101 -- esr) +cit101|citc|C.itoh fast vt100, + am, xenl, + cols#80, lines#24, + bel=^G, clear=\E[H\E[2J, cnorm=\E[V\E8, cub1=^H, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, cvvis=\E7\E[U, + dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, + flash=\E[?5h$<200/>\E[?5l, ich1=\E[@, il1=\E[L, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[3g\E[>5g, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m, + smul=\E[4m, +# CIE Terminals CIT-101e from Geoff Kuenning via BRL +# The following termcap entry was created from the Callan cd100 entry. The +# last two lines (with the capabilities in caps) are used by RM-cobol to allow +# full selection of combinations of reverse video, underline, and blink. +# (cit101e: emoved unknown :f0=\EOp:f1=\EOq:f2=\EOr:f3=\EOs:f4=\EOt:f5=\EOu:\ +# f6=\EOv:f7=\EOw:f8=\EOx:f9=\EOy:AB=\E[0;5m:AL=\E[m:AR=\E[0;7m:AS=\E[0;5;7m:\ +# :NB=\E[0;1;5m:NM=\E[0;1m:NR=\E[0;1;7m:NS=\E[0;1;5;7m: -- esr) +cit101e|C. Itoh CIT-101e, + am, mir, msgr, + cols#80, it#8, lines#24, + acsc=, clear=\E[H\E[J, cnorm=, csr=\E[%i%p1%2d;%p2%2dr, + cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, + cvvis=\E[?1l\E[?4l\E[?7h, dch1=\E[P, dl1=\E[M, ed=\E[J, + el=\E[K, if=/usr/share/tabset/vt100, il1=\E[L, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\EOT, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOm, kf6=\EOl, + kf7=\EOM, kf8=\EOn, rc=\E8, ri=\EM, rmacs=^O, rmir=\E[4l, + rmkx=\E>, rmso=\E[m, rmul=\E[m, sc=\E7, smacs=^N, smir=\E[4h, + smkx=\E=, smso=\E[7m, smul=\E[4m, +cit101e-n|CIT-101e w/o am, + am@, + cvvis=\E[?1l\E[?4l\E[?7l, kbs=^H, kcub1=^H, kcud1=^J, use=cit101e, +cit101e-132|CIT-101e, 132 cols, + cols#132, + kbs=^H, kcub1=^H, kcud1=^J, use=cit101e, +cit101e-n132|CIT-101e, 132 cols w/o am, + am@, + cols#132, + cvvis=\E[?1l\E[?4l\E[?7l, kbs=^H, kcub1=^H, kcud1=^J, use=cit101e, +# CIE Terminals CIT-500 from BRL +# The following SET-UP modes are assumed for normal operation: +# GENERATE_XON/XOFF:YES DUPLEX:FULL NEWLINE:OFF +# AUTOWRAP:ON MODE:ANSI SCREEN_LENGTH:64_LINES +# DSPLY_CNTRL_CODES?NO PAGE_WIDTH:80 EDIT_MODE:OFF +# Other SET-UP modes may be set for operator convenience or communication +# requirements. +# Hardware tabs are assumed to be set every 8 columns; they can be set up +# by the "reset", "tset", or "tabs" utilities. No delays are specified; use +# "stty ixon -ixany" to enable DC3/DC1 flow control! +# (cit500: I added / based on the init string -- esr) +cit500|CIE Terminals CIT-500, + mir, msgr, xon, + cols#80, it#8, lines#64, vt#3, + acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\EM, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ed=\EJ, el=\EK, home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, + il1=\E[L, ind=^J, is2=\E<\E)0, kbs=^H, kcbt=\E[Z, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[P, kdl1=\E[M, + ked=\EJ, kel=\EK, kf0=\EOP, kf1=\EOQ, kf2=\EOR, kf3=\EOS, + kf4=\EOU, kf5=\EOV, kf6=\EOW, kf7=\EOX, kf8=\EOY, kf9=\EOZ, + khome=\E[H, kich1=\E[4h, kil1=\E[L, krmir=\E[4l, lf0=PF1, + lf1=PF2, lf2=PF3, lf3=PF4, lf4=F15, lf5=F16, lf6=F17, lf7=F18, + lf8=F19, lf9=F20, ll=\E[64H, nel=\EE, rc=\E8, rev=\E[7m, + ri=\EM, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, + rmso=\E[m, rmul=\E[m, + rs1=\E<\E2\E[20l\E[?6l\E[r\E[m\E[q\E(B\017\E)0\E>, + sc=\E7, sgr0=\E[m, smacs=^N, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + +# C. Itoh printers begin here +citoh|ci8510|8510|c.itoh 8510a, + cols#80, it#8, + bold=\E!, cub1@, + is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073., + rep=\ER%p2%03d%p1%c, ri=\Er, rmul=\EY, sgr0=\E"\EY, + smul=\EX, + use=lpr, +citoh-pica|citoh in pica, + is1=\EN, use=citoh, +citoh-elite|citoh in elite, + cols#96, + is1=\EE, + is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073\,081\,089., use=citoh, +citoh-comp|citoh in compressed, + cols#136, + is1=\EQ, + is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073\,081\,089\,097\,105\,113\,121\,129., use=citoh, +# citoh has infinite cols because we don't want lp ever inserting \n\t**. +citoh-prop|citoh-ps|ips|citoh in proportional spacing mode, + cols#32767, + is1=\EP, use=citoh, +citoh-6lpi|citoh in 6 lines per inch mode, + is3=\EA, use=citoh, +citoh-8lpi|citoh in 8 lines per inch mode, + lines#88, + is3=\EB, use=citoh, + +#### Control Data (cdc) +# + +cdc456|cdc 456 terminal, + am, + cols#80, lines#24, + bel=^G, clear=^Y^X, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E1%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dl1=\EJ, ed=^X, + el=^V, home=^Y, il1=\EL, ind=^J, + +# Assorted CDC terminals from BRL (improvements by DAG & Ferd Brundick) +cdc721|CDC Viking, + am, + cols#80, lines#24, + clear=^L, cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, + cuu1=^W, el=^K, home=^Y, kcub1=^H, kcud1=^J, kcuf1=^I, + kcuu1=^W, khome=^Y, +cdc721ll|CDC Vikingll, + am, + cols#132, lines#24, + clear=^L, cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, + cuu1=^W, el=^K, home=^Y, kcub1=^H, kcud1=^J, kcuf1=^I, + kcuu1=^W, khome=^Y, +# (cdc752: the BRL entry had :ll=\E1 ^Z: commented out +cdc752|CDC 752, + am, bw, xhp, + cols#80, lines#24, + bel=^G, clear=\030\E1\s\s, cr=^M, cub1=^H, cud1=^J, cuf1=^U, + cup=\E1%p2%{32}%+%c%p1%{32}%+%c, cuu1=^Z, el=^V, + home=\E1\s\s, ind=^J, ll=^Y, rs1=\E1 \030\002\003\017, +# CDC 756 +# The following switch/key settings are assumed for normal operation: +# 96 chars SCROLL FULL duplex not BLOCK +# Other switches may be set according to communication requirements. +# Insert/delete-character cannot be used, as the whole display is affected. +# "so" & "se" are commented out until jove handles "sg" correctly. +cdc756|CDC 756, + am, bw, + cols#80, lines#24, + bel=^G, clear=^Y^X, cr=^M, cub1=^H, cud1=^J, cuf1=^U, + cup=\E1%p2%{32}%+%c%p1%{32}%+%c, cuu1=^Z, + dl1=\EJ$<6*/>, ed=^X, el=^V, home=^Y, il1=\EL$<6*/>, ind=^J, + kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^U, kcuu1=^Z, kdch1=\EI, + kdl1=\EL, ked=^X, kel=^V, kf0=\EA, kf1=\EB, kf2=\EC, kf3=\ED, + kf4=\EE, kf5=\EF, kf6=\EG, kf7=\EH, kf8=\Ea, kf9=\Eb, khome=^Y, + khts=^O, kich1=\EK, kil1=\EL, lf0=F1, lf1=F2, lf2=F3, lf3=F4, + lf4=F5, lf5=F6, lf6=F7, lf7=F8, lf8=F9, lf9=F10, ll=^Y^Z, + rs1=\031\030\002\003\017, +# +# CDC 721 from Robert Viduya, Ga. Tech. via BRL. +# +# Part of the long initialization string defines the "DOWN" key to the left +# of the tab key to send an ESC. The real ESC key is positioned way out +# in right field. +# +# The termcap won't work in 132 column mode due to the way it it moves the +# cursor. Termcap doesn't have the capability (as far as I could tell) to +# handle the 721 in 132 column mode. +# +# (cdc721: changed :ri: to :sr: -- esr) +cdc721-esc|Control Data 721, + am, bw, msgr, xon, + cols#80, it#8, lines#30, + bel=^G, blink=^N, cbt=^^^K, clear=^L, cub1=^H, cud1=^Z, + cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, cuu1=^W, + dch1=^^N, dim=^\, dl1=^^Q, ed=^^P, el=^K, home=^Y, hts=^^^RW, + ich1=^^O, il1=^^R, ind=\036W =\036U, invis=^^^R[, + is2=\036\022B\003\036\035\017\022\025\035\036E\036\022H\036\022J\036\022L\036\022N\036\022P\036\022Q\036\022\\\036\022\^\036\022b\036\022i\036W =\036\022Z\036\011C1-` `!k/o, + kbs=^H, kcub1=^H, kcud1=^Z, kcuf1=^X, kcuu1=^W, kf0=^^q, + kf1=^^r, kf2=^^s, kf3=^^t, kf4=^^u, kf5=^^v, kf6=^^w, kf7=^^x, + kf8=^^y, kf9=^^z, khome=^Y, ll=^B =, rev=^^D, + ri=\036W =\036V, rmir=, rmkx=^^^Rl, rmso=^^E, rmul=^], + sgr0=\017\025\035\036E\036\022\\, smir=, smkx=^^^Rk, + smso=^^D, smul=^\, tbc=^^^RY, + +#### Getronics +# +# Getronics is a Dutch electronics company that at one time was called +# `Geveke' and made async terminals; but (according to the company itself!) +# they've lost all their documentation on the command set. The hardware +# documentation suggests the terminals were actually manufactured by a +# Taiwanese electronics company named Cal-Comp. There are known +# to have been at least two models, the 33 and the 50. +# + +# The 50 seems to be a top end vt220 clone, with the addition of a higher +# screen resolution, a larger screen, at least 1 page of memory above and +# below the screen, apparently pages of memory right and left of the screen +# which can be panned, and about 75 function keys (15 function keys x normal, +# shift, control, func A, func B). It also has more setup possibilities than +# the vt220. The monitor case is dated November 1978 and the keyboard case is +# May 1982. +# +# The vt100 emulation works as is. The entry below describes the rather +# non-conformant (but more featureful) ANSI mode. +# +# From: Stephen Peterson , 27 May 1995 +visa50|geveke visa 50 terminal in ansi 80 character mode, + bw, mir, msgr, + cols#80, lines#25, + acsc=0_aaffggjjkkllmmnnqqttuuvvwwxxh ooss, bel=^G, + blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dX, dch1=\E[X, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, flash=\E[?5h\E[?5l, home=\E[H, + hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=^J, invis=\E[8m, + is2=\E0;2m\E[1;25r\E[25;1H\E[?3l\E[?7h\E[?8h, + ka1=\E[f, ka3=\EOQ, kb2=\EOP, kbs=^H, kc1=\EOR, kc3=\EOS, + kcub1=\E[D, kcud1=\E[A, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, + kdl1=\EOS, kf0=\E010, kf1=\E001, kf10=\E011, kf2=\E002, + kf3=\E003, kf4=\E004, kf5=\E005, kf6=\E006, kf7=\E007, + kf8=\E008, kf9=\E009, khome=\E[f, lf2=A delete char, + lf3=A insert line, lf4=A delete line, lf5=A clear, + lf6=A ce of/cf gn, lf7=A print, lf8=A on-line, + lf9=A funcl0=A send, nel=^M^J, rev=\E[7m, rmacs=\E[3l, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[0;2m, + rmul=\E[0m, sgr0=\E[0;2m, smacs=\E3h, smam=\E?7h, + smir=\E[4h, smkx=\E=, smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, + vpa=\E[%i%p1%dd, + +#### Human Designed Systems (Concept) +# +# Human Designed Systems +# 400 Fehley Drive +# King of Prussia, PA 19406 +# Vox: (610)-277-8300 +# Fax: (610)-275-5739 +# Net: support@hds.com +# +# John Martin is their termcap expert. They're mostly out of +# the character-terminal business now (1995) and making X terminals. In +# particular, the whole `Concept' line described here was discontinued long +# ago. +# + +# From: Sat Jun 27 07:41:20 1981 +# Extensive changes to c108 by arpavax:eric Feb 1982 +# Some unknown person at SCO then translated it to terminfo. +# +# There seem to be a number of different versions of the C108 PROMS +# (with bug fixes in its Z-80 program). +# +# The first one that we had would lock out the keyboard of you +# sent lots of short lines (like /usr/dict/words) at 9600 baud. +# Try that on your C108 and see if it sends a ^S when you type it. +# If so, you have an old version of the PROMs. +# +# You should configure the C108 to send ^S/^Q before running this. +# It is much faster (at 9600 baud) than the c100 because the delays +# are not fixed. +# new status line display entries for c108-8p: +# - init str #3 - setup term for status display - +# set programmer mode, select window 2, define window at last +# line of memory, set bkgnd stat mesg there, select window 0. +# +# - to status line - select window 2, home cursor, erase to +# end-of-window, 1/2 bright on, goto(line#0, col#?) +# +# - from status line - 1/2 bright off, select window 0 +# +# - disable status display - set bkgnd status mesg with +# illegal window # +# +# There are probably more function keys that should be added but +# I don't know what they are. +# +# No delays needed on c108 because of ^S/^Q handshaking +# +c108|concept108|c108-8p|concept108-8p|concept 108 w/8 pages, + is3=\EU\E z"\Ev\001\177 !p\E ;"\E z \Ev \001\177p\Ep\n, + rmcup=\Ev \001\177p\Ep\r\n, + use=c108-4p, +c108-4p|concept108-4p|concept 108 w/4 pages, + eslok, hs, xon, + pb@, + acsc=l\\qLkTxUmMjE, cnorm=\Ew, cr=^M, + cup=\Ea%p1%?%p1%{95}%>%t\001%{96}%-%;%{32}%+%c%p2%?%p2%{95}%>%t\001%{96}%-%;%{32}%+%c, + cvvis=\EW, dch1=\E 1$<16*>, dsl=\E ;\177, fsl=\Ee\E z\s, + ind=^J, is1=\EK\E!\E F, + is3=\EU\E z"\Ev\177 !p\E ;"\E z \Ev \001 p\Ep\n, + rmacs=\Ej\s, rmcup=\Ev \001 p\Ep\r\n, smacs=\Ej!, + smcup=\EU\Ev 8p\Ep\r\E\025, + tsl=\E z"\E?\E\005\EE\Ea %+\s, use=c100, +c108-rv|c108-rv-8p|concept 108 w/8 pages in reverse video, + rmcup=\Ev \002 p\Ep\r\n, smcup=\EU\Ev 8p\Ep\r, + use=c108-rv-4p, +c108-rv-4p|concept108rv4p|concept 108 w/4 pages in reverse video, + flash=\EK$<200>\Ek, is1=\Ek, rmso=\Ee, smso=\EE, + use=c108-4p, +c108-w|c108-w-8p|concept108-w-8|concept108-w8p|concept 108 w/8 pages in wide mode, + cols#132, + is1=\E F\E", rmcup=\Ev ^A0\001D\Ep\r\n, + smcup=\EU\Ev 8\001D\Ep\r, use=c108-8p, + +# Concept 100: +# These have only window relative cursor addressing, not screen +# relative. To get it to work right here, smcup/rmcup (which +# were invented for the concept) lock you into a one page +# window for screen style programs. +# +# To get out of the one page window, we use a clever trick: +# we set the window size to zero ("\Ev " in rmcup) which the +# terminal recognizes as an error and resets the window to all +# of memory. +# +# This trick works on c100 but does not on c108, sigh. +# +# Some tty drivers use cr3 for concept, others use nl3, hence +# the delays on cr and ind below. This padding is only needed at +# 9600 baud and up. One or the other is commented out depending on +# local conventions. +# +# 2 ms padding on isn't always enough. 6 works fine. Maybe +# less than 6 but more than 2 will work. +# +# Note: can't use function keys f7-f10 because they are +# indistinguishable from arrow keys (!), also, del char and +# clear eol use xon/xoff so they probably won't work very well. +# +# Also note that we don't define insrt/del char/delline/eop/send +# because they don't transmit unless we reset them - I figured +# it was a bad idea to clobber their definitions. +# +# The sequence changes the escape character to ^^ so that +# escapes will be passed through to the printer. Only trouble +# is that ^^ won't be - ^^ was chosen to be unlikely. +# Unfortunately, if you're sending raster bits through to be +# plotted, any character you choose will be likely, so we lose. +# +# \EQ"\EY(^W (send anything from printer to host, for xon/xoff) +# cannot be # in is2 because it will hang a c100 with no printer +# if sent twice. +c100|concept100|concept|c104|c100-4p|hds concept 100, + am, eo, mir, ul, xenl, + cols#80, lines#24, pb#9600, vt#8, + bel=^G, blink=\EC, clear=\E?\E\005$<2*>, cr=$<9>\r, + cub1=^H, cud1=^J, cuf1=\E=, + cup=\Ea%p1%{32}%+%c%p2%{32}%+%c, cuu1=\E;, + dch1=\E\021$<16*>, dim=\EE, dl1=\E\002$<3*>, + ed=\E\005$<16*>, el=\E\025$<16>, flash=\Ek$<200>\EK, + ht=\011$<8>, il1=\E\022$<3*>, ind=^J, invis=\EH, ip=$<16*>, + is1=\EK, + is2=\EU\Ef\E7\E5\E8\El\ENH\E\200\Eo&\200\Eo'\E\Eo!\200\E\007!\E\010A@ \E4#\:"\E\:a\E4#;"\E\:b\E4#<"\E\:c, + is3=\Ev $<6>\Ep\n, kbs=^H, kcbt=\E', kctab=\E_, + kcub1=\E>, kcud1=\E<, kcuf1=\E=, kcuu1=\E;, kdch1=\E^Q, + kdl1=\E^B, ked=\E^C, kel=\E^S, kf1=\E5, kf2=\E6, kf3=\E7, + kf4=\E8, kf5=\E9, kf6=\E\:a, kf7=\E\:b, kf8=\E\:c, khome=\E?, + khts=\E], kich1=\E^P, kil1=\E^R, kind=\E[, knp=\E-, kpp=\E., + kri=\E\\, krmir=\E\200, mc4=\036o \E\EQ!\EYP\027, + mc5=\EQ"\EY(\027\EYD\Eo \036, prot=\EI, + rep=\Er%p1%c%p2%{32}%+%c$<.2*>, rev=\ED, + rmcup=\Ev $<6>\Ep\r\n, rmir=\E\s\s, rmkx=\Ex, + rmso=\Ed, rmul=\Eg, sgr0=\EN@, + smcup=\EU\Ev 8p\Ep\r\E\025$<16>, smir=\E^P, smkx=\EX, + smso=\ED, smul=\EG, +c100-rv|c100-rv-4p|concept100-rv|c100 rev video, + cnorm@, cvvis@, flash=\EK$<200>\Ek, is1=\Ek, rmso=\Ee, + smso=\EE, + use=c100, +oc100|oconcept|c100-1p|old 1 page concept 100, + in, + is3@, use=c100, + +# through included to specify padding needed in raw mode. +# (avt-ns: added empty to suppress a tic warning --esr) +avt-ns|concept avt no status line, + am, eo, mir, ul, xenl, xon, + cols#80, it#8, lines#24, lm#192, + acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + clear=\E[H\E[J$<38>, cnorm=\E[=119l, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[=119h, dch1=\E[P, dim=\E[1!{, dl=\E[%p1%dM$<4*>, + dl1=\E[M$<4>, ed=\E[J$<96>, el=\E[K$<6>, home=\E[H, + hpa=\E[%p1%{1}%+%dG, ht=\011$<4>, hts=\EH, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL$<4*>, il1=\E[L$<4>, ind=\n$<8>, + invis=\E8m, ip=$<4>, is1=\E[=103l\E[=205l, + is2=\E[1*q\E[2!t\E[7!t\E[=4;101;119;122l\E[=107;118;207h\E)1\E[1Q\EW\E[!y\E[!z\E>\E[0\:0\:32!r\E[0*w\E[w\E2\r\n\E[2;27!t, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E^B\r, ked=\E^D\r, kf1=\EOP, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, khome=\E[H, kich1=\E^A\r, kil1=\E^C\r, ll=\E[24H, + mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, + pfloc=\E[%p1%d;0u#%p2%s#, pfx=\E[%p1%d;1u#%p2%s#, + prot=\E[99m, rc=\E8, rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, + ri=\EM$<4>, rmacs=\016$<1>, rmcup=\E[w\E2\r\n, rmir=\E4l, + rmkx=\E[!z\E[0;2u, rmso=\E[7!{, rmul=\E[4!{, sc=\E7, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m, + sgr0=\E[m, smacs=\017$<1>, smcup=\E[=4l\E[1;24w\E2\r, + smir=\E1, smkx=\E[1!z\E[0;3u, smso=\E[7m, smul=\E[4m, + tbc=\E[2g, vpa=\E[%p1%{1}%+%dd, +avt-rv-ns|concept avt in reverse video mode/no status line, + flash=\E[=205l$<200>\E[=205h, is1=\E[=103l\E[=205h, + use=avt-ns, +avt-w-ns|concept avt in 132 column mode/no status line, + is1=\E[=103h\E[=205l, smcup=\E[H\E[1;24;1;132w, + use=avt-ns, +avt-w-rv-ns|concept avt in 132 column mode/no status line/reverse video, + flash=\E[=205l$<200>\E[=205h, is1=\E[=103h\E[=205h, + smcup=\E[H\E[1;24;1;132w, + use=avt-ns, + +# Concept AVT with status line. We get the status line using the +# "Background status line" feature of the terminal. We swipe the +# first line of memory in window 2 for the status line, keeping +# 191 lines of memory and 24 screen lines for regular use. +# The first line is used instead of the last so that this works +# on both 4 and 8 page AVTs. (Note the lm#191 or 192 - this +# assumes an 8 page AVT but lm isn't currently used anywhere.) +# +avt+s|concept avt status line changes, + eslok, hs, + lm#191, + dsl=\E[0*w, fsl=\E[1;1!w, + is3=\E[2w\E[2!w\E[1;1;1;80w\E[H\E[2*w\E[1!w\E2\r\n, + rmcup=\E[2w\E2\r\n, smcup=\E[2;25w\E2\r, + tsl=\E[2;1!w\E[;%p1%dH\E[2K, +avt|avt-s|concept-avt|avt w/80 columns, + use=avt+s, use=avt-ns, +avt-rv|avt-rv-s|avt reverse video w/sl, + flash=\E[=205l$<200>\E[=205h, is1=\E[=103l\E[=205h, use=avt+s, + use=avt-ns, +avt-w|avt-w-s|concept avt 132 cols+status, + is1=\E[=103h\E[=205l, smcup=\E[H\E[1;24;1;132w, use=avt+s, + use=avt-ns, +avt-w-rv|avt-w-rv-s|avt wide+status+rv, + flash=\E[=205l$<200>\E[=205h, is1=\E[=103h\E[=205h, + smcup=\E[H\E[1;24;1;132w, + use=avt+s, use=avt-ns, + +#### Contel Business Systems. +# + +# Contel c300 and c320 terminals. +contel300|contel320|c300|Contel Business Systems C-300 or C-320, + am, in, xon, + cols#80, lines#24, xmc#1, + bel=^G, clear=\EK, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, + dch1=\EO$<5.5*>, dl1=\EM$<5.5*>, ed=\EJ$<5.5*>, + el=\EI$<5.5>, flash=\020\002$<200/>\020\003, home=\EH, + hts=\E1, ich1=\EN, il1=\EL$<5.5*>, ind=^J, ip=$<5.5*>, + kbs=^H, kf0=\ERJ, kf1=\ERA, kf2=\ERB, kf3=\ERC, kf4=\ERD, + kf5=\ERE, kf6=\ERF, kf7=\ERG, kf8=\ERH, kf9=\ERI, ll=\EH\EA, + rmso=\E!\200, sgr0=\E!\200, smso=\E!\r, tbc=\E3, +# Contel c301 and c321 terminals. +contel301|contel321|c301|c321|Contel Business Systems C-301 or C-321, + flash@, ich1@, ip@, rmso=\E!\200$<20>, smso=\E!\r$<20>, + use=contel300, + +#### Data General (dg) +# +# According to James Carlson writing in January 1995, +# the terminals group at Data General was shut down in 1991; all these +# terminals have thus been discontinued. +# + +# According to the 4.4BSD termcap file, the dg200 should be the +# termcap equivalent of \020%p2%{128}%+%c%p1%{128}%+%c (in termcap +# notation that's "^P%r%+\200%+\200"). Those \200s are suspicious, +# maybe they were originally nuls (which would fit). +dg200|data general dasher 200, + am, bw, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^Y, cud1=^Z, cuf1=^X, + cup=\020%p2%c%p1%c, cuu1=^W, el=^K, home=^H, ind=^J, + kcub1=^Y, kcud1=^Z, kcuf1=^X, kcuu1=^W, kf0=^^z, kf1=^^q, + kf2=^^r, kf3=^^s, kf4=^^t, kf5=^^u, kf6=^^v, kf7=^^w, kf8=^^x, + kf9=^^y, khome=^H, lf0=f10, nel=^J, rmso=^^E, rmul=^U, + smso=^^D, smul=^T, +# Data General 210/211 (and 410?) from Lee Pearson (umich!lp) via BRL +dg210|dg-ansi|Data General 210/211, + am, + cols#80, lines#24, + clear=\E[2J, cud1=\E[B, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + ed=\E[J, el=\E[K, home=\E[H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, nel=\r\E[H\E[A\n, + rmso=\E[0;m, rmul=\E[0;m, smso=\E[7;m, smul=\E[4;m, +# From: Peter N. Wan +# courtesy of Carlos Rucalde of Vantage Software, Inc. +# (dg211: this had ., which was an ancient termcap hangover. +# I suspect the d200 function keys actually work on the dg211, check it out.) +dg211|Data General d211, + cnorm=^L, cvvis=^L^R, ht=^I, ind@, kbs=^Y, kf0@, kf1@, kf2@, kf3@, + kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, lf0@, nel=^M^Z, rmcup=^L, + rmso=\036E$<\200/>, smcup=^L^R, smso=\036D$<5/>, + use=dg200, +# dg450 from cornell +dg450|dg6134|data general 6134, + cub1@, cuf1=^X, use=dg200, +# Note: lesser Dasher terminals will not work with vi because vi insists upon +# having a command to move straight down from any position on the bottom line +# and scroll the screen up, or a direct vertical scroll command. The 460 and +# above have both, the D210/211, for instance, has neither. We must use ANSI +# mode rather than DG mode because standard UNIX tty drivers assume that ^H is +# backspace on all terminals. This is not so in DG mode. +# (dg460-ansi: removed obsolete ":kn#6:"; also removed ":mu=\EW:", on the +# grounds that there is no matching ":ml:" +# fixed garbled ":k9=\E[00\:z:" capability -- esr) +dg460-ansi|Data General Dasher 460 in ANSI-mode, + am, msgr, ul, + cols#80, it#8, lines#24, + blink=\E[5m, clear=\E[2J, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, dch1=\E[P, dim=\E[2m, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, + il1=\E[L, ind=\E[S, is2=^^F@, kbs=\E[D, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\E[001z, + kf1=\E[002z, kf2=\E[003z, kf3=\E[004z, kf4=\E[005z, + kf5=\E[006z, kf6=\E[007z, kf7=\E[008z, kf8=\E[009z, + kf9=\E[010z, khome=\E[H, lf0=f1, lf1=f2, lf2=f3, lf3=f4, + lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf9=f10, rev=\E[7m, ri=\E[T, + rmso=\E[m, rmul=\E[05, sgr0=\E[m, smso=\E[7m, smul=\E[4m, +# From: Wayne Throop +# Data General 605x +# Ought to work for a Model 6242, Type D210 as well as a 605x. +# Note that the cursor-down key transmits ^Z. Job control users, beware! +# This also matches a posted description of something called a `Dasher 100' +# so there's a dg100 alias here. +# (dg6053: the 4.4BSD file had , , . -- esr) +dg6053|dg100|data general 6053, + am, bw, ul, + cols#80, lines#24, + bel=^G, clear=^L, cnorm=^L, cr=^M, cub1=^Y, cud1=^Z, cuf1=^X, + cup=\020%p2%c%p1%c, cuu1=^W, cvvis=^L^R, el=^K, home=^H, + ht=^I, is2=^R, kbs=^Y, kcub1=^Y, kcud1=^Z, kcuf1=^X, kcuu1=^W, + kf0=^^q, kf1=^^r, kf2=^^s, kf3=^^t, kf4=^^u, kf5=^^v, kf6=^^w, + kf7=^^x, kf8=^^y, kf9=^^z, khome=^H, rmcup=^L, rmso=\200^^E, + rmul=^U, smcup=^L^R, smso=\200\200\200\200\200\036D, + smul=^T, + +#### Datamedia (dm) +# +# Datamedia was headquartered in Nashua, New Hampshire in 1993. +# As of early 1996, at least one company called `Datamedia' has been taken +# over by: +# +# Axent Technologies, Inc. +# 2400 Research Boulevard +# Rockville, Maryland 20850 +# voice: +1 301/258-5043 +# fax: +1 301/330-5756 +# email: +# +# makers of OmniGuard client/server security software. They are a software +# only company and no longer make terminals. However, the operator there +# told me that she had once spoken to a customer looking for Datamedia +# terminals who'd mentioned a Datamedia in New Jersey. This is backed up +# by comp.terminals poosting describing the ID plate on the back of a +# "Datamedia 3000" terminal. Was this an earlier incarnation of Axent? +# Inquiring minds want to know... +# + +cs10|colorscan|Datamedia Color Scan 10, + msgr, + cols#80, lines#24, + bel=^G, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%02d;%p2%02dH, cuu1=\E[A, ed=\E[J, el=\E[K, + ind=^J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smso=\E[7m, smul=\E[4m, +cs10-w|Datamedia Color Scan 10 with 132 columns, + cols#132, + cup=\E[%i%p1%02d;%p2%03dH, use=cs10, + +# (dm1520: removed obsolete ":ma=^\ ^_^P^YH:" -- esr) +dm1520|dm1521|datamedia 1520, + am, xenl, + cols#80, it#8, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^\, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], + home=^Y, ht=^I, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^\, kcuu1=^_, + khome=^Y, +dm2500|datamedia2500|datamedia 2500, + cols#80, lines#24, + bel=^G, clear=^^^^\177, cub1=^H, cud1=^J, cuf1=^\, + cup=\014%p2%{96}%^%c%p1%{96}%^%c, cuu1=^Z, + dch1=\020\010\030\035$<10*>, + dl1=\020\032\030\035$<10*>, el=^W, home=^B, + ich1=\020\034\030\035$<10*>, + il1=\020\n\030\035\030\035$<15>, ind=^J, pad=\377, + rmdc=^X^], rmir=\377\377\030\035$<10>, rmso=^X^], + smdc=^P, smir=^P, smso=^N, +# dmchat is like DM2500, but DOES need "all that padding" (jcm 1/31/82) +# also, has a meta-key. +# From: +# (dmchat: ":MT:" changed to ":km:" -- esr) +dmchat|dmchat version of datamedia 2500, + km, + dl1=\020\032\030\035$<2/>, + il1=\020\n\030\035\030\035$<1*/>, use=dm2500, +# (dm3025: ":MT:" changed to ":km:" -- esr) +dm3025|datamedia 3025a, + km, + cols#80, it#8, lines#24, + bel=^G, clear=\EM$<2>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, + dch1=\010$<6>, dl1=\EP\EA\EQ$<130>, ed=\EJ$<2>, el=\EK, + home=\EH, ht=^I, il1=\EP\n\EQ$<130>, ind=^J, ip=$<6>, + is2=\EQ\EU\EV, rmdc=\EQ, rmir=\EQ, rmso=\EO0, smdc=\EP, + smir=\EP, smso=\EO1, +dm3045|datamedia 3045a, + am, eo, km@, ul, xenl, + dch1=\EB$<6>, dl1@, il1@, is2=\EU\EV, kcuf1=\EC, kcuu1=\EA, + kf0=\Ey\r, kf1=\Ep\r, kf2=\Eq\r, kf3=\Er\r, kf4=\Es\r, + kf5=\Et\r, kf6=\Eu\r, kf7=\Ev\r, kf8=\Ew\r, kf9=\Ex\r, + khome=\EH, pad=\177, rmdc@, rmir=\EP, rmso@, smdc@, smso@, + use=dm3025, +# Datamedia DT80 soft switches: +# 1 0=Jump 1=Smooth +# Autorepeat 0=off 1=on +# Screen 0=Dark 1=light +# Cursor 0=u/l 1=block +# +# 2 Margin Bell 0=off 1=on +# Keyclick 0=off 1=on +# Ansi/VT52 0=VT52 1=Ansi +# Xon/Xoff 0=Off 1=On +# +# 3 Shift3 0=Hash 1=UK Pound +# Wrap 0=Off 1=On +# Newline 0=Off 1=On +# Interlace 0=Off 1=On +# +# 4 Parity 0=Odd 1=Even +# Parity 0=Off 1=On +# Bits/Char 0=7 1=8 +# Power 0=60Hz 1=50Hz +# +# 5 Line Interface 0=EIA 1=Loop +# Aux Interface 0=EIA 1=Loop +# Local Copy 0=Off 1=On +# Spare +# +# 6 Aux Parity 0=Odd 1=Even +# Aux Parity 0=Off 1=On +# Aux Bits/Char 0=7 1=8 +# CRT Saver 0=Off 1=On +# dm80/1 is a vt100 lookalike, but it doesn't seem to need any padding. +dm80|dmdt80|dt80|datamedia dt80/1, + clear=\E[2J\E[H, cud1=^J, cuf1=\E[C, + cup=%i\E[%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, + home=\E[H, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, ri=\EM, + rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, + use=vt100, +# except in 132 column mode, where it needs a little padding. +# This is still less padding than the vt100, and you can always turn on +# the ^S/^Q handshaking, so you can use vt100 flavors for things like +# reverse video. +dm80w|dmdt80w|dt80w|datamedia dt80/1 in 132 char mode, + cols#132, + clear=\E[H\E[2J$<50/>, cud1=^J, + cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<5/>, + ed=\E[0J$<20/>, el=\E[0K$<20/>, use=dm80, +# From: Adam Thompson Sept 10 1995 +dt80-sas|Datamedia DT803/DTX for SAS usage, + am, bw, + cols#80, lines#24, + acsc=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~, + bel=^G, clear=^L, cr=^M, + csr=\E=%p1%' '%+%c%' '%c\E#1\E=%p2%' '%+%c%' '%c\E#2, + cub1=^H, cud1=\EB, cuf1=^\, + cup=\E=%p2%' '%+%c%p1%' '%+%c, cuu1=^_, dl1=\EM, ed=^K, + el=^], ff=^L, home=^Y, ht=^I, hts=\E'1, il1=\EL, ind=\EB, + is2=\E)0\E<\EP\E'0\E$2, kclr=^L, kcub1=^H, kcud1=^J, + kcuf1=^\, kcuu1=^_, ked=^K, kel=^], khome=^Y, mc4=^O, mc5=^N, + rev=\E$2\004, ri=\EI, rmacs=\EG, rmso=^X, sgr0=^X, smacs=\EF, + smso=\E$2\004, tbc=\E'0, + +# Datamedia Excel 62, 64 from Gould/SEL UTX/32 via BRL +# These aren't end-all Excel termcaps; but do insert/delete char/line +# and name some of the extra function keys. (Mike Feldman ccvaxa!feldman) +# The naming convention has been bent somewhat, with the use of E? (where +# E is for 'Excel') as # a name. This was done to distinguish the entries +# from the other Datamedias in use here, and yet to associate a model of +# the Excel terminals with the regular datamedia terminals that share +# major characteristics. +excel62|excel64|datamedia Excel 62, + dch1=\E[P, kbs=^H, kcub1=^H, kcud1=^J, kf5=\EOu, kf6=\EOv, + kf7=\EOw, kf8=\EOx, kf9=\EOy, rmir=\E[4l, smir=\E[4h, + use=dt80, +excel62-w|excel64-w|datamedia Excel 62 in 132 char mode, + dch1=\E[P, kbs=^H, kcub1=^H, kcud1=^J, kf5=\EOu, kf6=\EOv, + kf7=\EOw, kf8=\EOx, kf9=\EOy, rmir=\E[4l, smir=\E[4h, + use=dt80w, +excel62-rv|excel64-rv|datamedia Excel 62 in reverse video mode, + dch1=\E[P, flash=\E[?5l\E[?5h, kbs=^H, kcub1=^H, kcud1=^J, + kf5=\EOu, kf6=\EOv, kf7=\EOw, kf8=\EOx, kf9=\EOy, rmir=\E[4l, + smir=\E[4h, + use=dt80, + +#### Falco +# +# Falco Data Products +# 440 Potrero Avenue +# Sunnyvale, CA 940864-196 +# Vox: (800)-325-2648 +# Fax: (408)-745-7860 +# Net: techsup@charm.sys.falco.com +# +# Current Falco models as of 1995 are generally ANSI-compatible and support +# emulations of DEC VT-series, Wyse, and Televideo types. +# + +# Test version for Falco ts-1. See for info +# This terminal was released around 1983 and was discontinued long ago. +# The standout and underline highlights are the same. +falco|ts1|ts-1|falco ts-1, + am, + cols#80, it#8, lines#24, + bel=^G, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET\EG0\010, home=^^, ht=^I, il1=\EE, + ind=^J, is2=\Eu\E3, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, + kf0=^A0\r, rmir=\Er, rmso=\Eg0, rmul=\Eg0, sgr0=\Eg0, + smir=\Eq, smso=\Eg1, smul=\Eg1, +falco-p|ts1p|ts-1p|falco ts-1 with paging option, + am, da, db, mir, msgr, ul, + cols#80, it#8, lines#24, + bel=^G, cbt=\EI, clear=\E*, cr=^M, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=\E[A, + dch1=\EW, dl1=\ER, ed=\EY, el=\ET\EG0\010\Eg0, ht=^I, + il1=\EE, ind=^J, is2=\EZ\E3\E_c, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, rmcup=\E_b, rmir=\Er, + rmso=\Eg0, rmul=\Eg0, sgr0=\Eg0, smcup=\E_d, smir=\Eq, + smso=\Eg4, smul=\Eg1, +# (ts100: I added / based on the init string -- esr) +ts100|ts100-sp|falco ts100-sp, + am, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, + cuu1=\E[A$<2>, dch1=\E~W, dl1=\E~R, ed=\E[J$<50>, + el=\E[K$<3>, el1=\E[1K$<3>, enacs=\E(B\E)0, home=\E[H, + ht=^I, hts=\EH, ich1=\E~Q, il1=\E~E, ind=^J, is1=\E~)\E~ea, + ka1=\EOq, ka3=\EOs, kb2=\EOr, kbs=^H, kc1=\EOp, kc3=\EOn, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, + kf0=\EOy, kf1=\EOP, kf10=\EOx, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + kf5=\EOt, kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, rc=\E8, + rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, + rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, + smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, +ts100-ctxt|falco ts-100 saving context, + rmcup=\E~_b, smcup=\E~_d\E[2J, use=ts100, + +#### Florida Computer Graphics +# + +# Florida Computer Graphics Beacon System, using terminal emulator program +# "host.com", as provided by FCG. This description is for an early release +# of the "host" program. Known bug: clears the whole screen, so it's +# commented out. + +# From: David Bryant 1/7/83 +beacon|FCG Beacon System, + am, da, db, + cols#80, lines#32, + bel=\ESTART\r\E37\r\EEND\r$<1>, + blink=\ESTART\r\E61\,1\r\EEND\r, clear=\EZ$<10>, cr=^M, + cub1=^H, cud1=^J, cuf1=\EV, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<20>, cuu1=\EU, + dch1=\EW, dl1=\ER, el=\ET, home=\EH$<10>, ich1=\EQ, il1=\EE, + ind=^J, rev=\ESTART\r\E59\,1\r\EEND\r, rmcup=, + rmso=\ESTART\r\E70\,0\r\EEND\r$<20>, + rmul=\ESTART\r\E60\,0\r\EEND\r, + sgr0=\ESTART\r\E78\r\E70\,0\r\EEND\r$<20>, + smcup=\ESTART\r\E2\,0\r\E12\r\EEND\r$<10>, + smso=\ESTART\r\E70\,6\r\EEND\r$<20>, + smul=\ESTART\r\E60\,1\r\EEND\r, + +#### Fluke +# + +# The f1720a differences from ANSI: no auto margin, destructive +# tabs, # of lines, funny highlighting and underlining +f1720|f1720a|fluke 1720A, + xt, + cols#80, lines#16, xmc#1, + bel=^G, clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, + el=\E[K, ind=\ED, is2=\E[H\E[2J, kcub1=^_, kcud1=^], + kcuf1=^^, kcuu1=^\, ri=\EM, rmso=\E[m, rmul=\E[m, sgr0=\E[m, + smso=\E[7m, smul=\E[4m, + +#### Liberty Electronics (Freedom) +# +# Liberty Electronics +# 48089 Fremont Blvd +# Fremont CA 94538 +# Vox: (510)-623-6000 +# Fax: (510)-623-7021 + +# From: +# (f100: added empty to suppress a tic warning; +# made this relative to adm+sgr -- note that isn't +# known to work for f100 but does on the f110. --esr) +f100|freedom|freedom100|freedom model 100, + am, bw, hs, mir, msgr, xon, + cols#80, lines#24, + acsc=, bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^J, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\EW, dl1=\ER$<11.5*>, dsl=\Eg\Ef\r, ed=\EY, el=\ET, + flash=\Eb$<200>\Ed, fsl=^M, home=^^, hpa=\E]%p1%{32}%+%c, + ht=^I, hts=\E1, il1=\EE$<8.5*>, ind=^J, ip=$<6>, + is2=\Eg\Ef\r\Ed, kbs=^H, kcbt=\EI, kcub1=^H, kcud1=^V, + kcuf1=^L, kcuu1=^K, kf1=^A@\r, kf10=^AI\r, kf2=^AA\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khome=^^, ri=\Ej, rmacs=\E$, rmir=\Er, + smacs=\E%, smir=\Eq, tbc=\E3, tsl=\Eg\Ef, + vpa=\E[%p1%{32}%+%c, use=adm+sgr, +f100-rv|freedom-rv|freedom 100 in reverse video, + flash=\Ed$<200>\Eb, is2=\Eg\Ef\r\Eb, use=f100, +# The f110 and f200 have problems with vi(1). They use the ^V +# code for the down cursor key. When kcud1 is defined in terminfo +# as ^V, the Control Character Quoting capability (^V in insert mode) +# is lost! It cannot be remapped in vi because it is necessary to enter +# a ^V to to quote the ^V that is being remapped!!! +# +# f110/f200 users will have to decide whether +# to lose the down cursor key or the quoting capability. We will opt +# initially for leaving the quoting capability out, since use of VI +# is not generally applicable to most interactive applications +# (f110: added , & from f100 -- esr) +f110|freedom110|Liberty Freedom 110, + bw@, eslok, + it#8, wsl#80, + blink=\EG2, bold=\EG0, civis=\E.1, cnorm=\E.2, cud1=^V, + cvvis=\E.2, dim=\EG@, dl1=\ER, dsl=\Ef\r, + flash=\Eb$<200/>\Ed, il1=\EE, ip@, is2@, kclr=^^, kdch1=\EW, + kdl1=\ER, ked=\EY, kel=\ET, kf0=^AI\r, kf10@, kich1=\EQ, + kil1=\EE, mc4=\Ea, mc5=\E`, ri=\EJ, rmacs=\E%%, rmir=\Er\EO, + smacs=\E$, smir=\EO\Eq, smso=\EG<, tsl=\Ef, + use=f100, +f110-14|Liberty Freedom 110 14inch, + dch1@, use=f110, +f110-w|Liberty Freedom 110 - 132 cols, + cols#132, use=f110, +f110-14w|Liberty Freedom 110 14in/132 cols, + cols#132, + dch1@, use=f110, +# (f200: added to suppress tic warnings re / --esr) +f200|freedom200|Liberty Freedom 200, + am, eslok, hs, mir, msgr, xon, + cols#80, it#8, lines#24, wsl#80, + acsc=, bel=^G, blink=\EG2, bold=\EG0, cbt=\EI, civis=\E.0, + clear=^Z, cnorm=\E.1, cr=^M, + csr=\Em0%p1%{32}%+%c%p2%{32}%+%c, cub1=^H, cud1=^V, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + cvvis=\E.1, dch1=\EW, dim=\EG@, dl1=\ER, dsl=\Ef\r, ed=\EY, + el=\ET, flash=\Eo$<200/>\En, fsl=^M, home=^^, + hpa=\E]%p1%{32}%+%c, hts=\E1, il1=\EE, ind=^J, kbs=^H, + kclr=^^, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, + kdl1=\ER, ked=\EY, kel=\ET, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, kich1=\EQ, kil1=\EE, mc4=\Ea, mc5=\E`, + ri=\EJ, rmacs=\E%%, rmir=\Er, smacs=\E$, smir=\Eq, smso=\EG<, + tbc=\E3, tsl=\Ef, vpa=\E[%p1%{32}%+%c, + use=adm+sgr, +f200-w|Liberty Freedom 200 - 132 cols, + cols#132, use=f200, +# The f200 has the ability to reprogram the down cursor key. The key is +# reprogrammed to ^J (linefeed). This value is remembered in non-volatile RAM, +# so powering the terminal off and on will not cause the change to be lost. +f200vi|Liberty Freedom 200 for vi, + flash=\Eb$<200/>\Ed, kcud1=^J, use=f200, +f200vi-w|Liberty Freedom 200 - 132 cols for vi, + cols#132, use=f200vi, + +#### GraphOn (go) +# +# Graphon Corporation +# 544 Division Street +# Campbell, CA 95008 +# Vox: (408)-370-4080 +# Fax: (408)-370-5047 +# Net: troy@graphon.com (Troy Morrison) +# +# +# The go140 and go225 have been discontinued. GraphOn now makes X terminals, +# including one odd hybrid that starts out life on power-up as a character +# terminal, than can be switched to X graphics mode (driven over the serial +# line) by an escape sequence. No info on this beast yet. +# (go140: I added / based on the init string -- esr) +go140|graphon go-140, + cols#80, it#8, lines#24, + clear=\E[H\E[2J$<10/>, cub1=^H, cuf1=\E[C, + cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J$<10/>, el=\E[K, ht=^I, + if=/usr/share/tabset/vt100, il1=\E[L, + is2=\E<\E=\E[?3l\E[?7l\E(B\E[J\E7\E[;r\E8\E[m\E[q, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, ri=\EM, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, + rmul=\E[m, sgr0=\E[m, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, +go140w|graphon go-140 in 132 column mode, + am, + cols#132, + is2=\E<\E=\E[?3h\E[?7h\E(B\E[J\E7\E[;r\E8\E[m\E[q, use=go140, +# Hacked up vt200 termcap to handle GO-225/VT220 +# From: +# (go225: I added / based on the init string -- esr) +go225|go-225|Graphon 225, + am, mir, xenl, + cols#80, it#8, lines#25, vt#3, + blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, il1=\E[L, ind=\ED, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, rc=\E8, rev=\E[7m, + rf=/usr/share/tabset/vt100, ri=\EM, rmam=\E[?7l, + rmcup=\E[!p\E[?7h\E[2;1;1#w, rmir=\E[4l, rmkx=\E>, + rmso=\E[27m, rmul=\E[24m, rs1=\E[!p\E[?7h\E[2;1;1#w, + sc=\E7, sgr0=\E[m, smam=\E[?7h, smcup=\E[2;0#w\E[1;25r, + smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, + +#### Harris (Beehive) +# +# Bletch. These guys shared the Terminal Brain Damage laurels with Hazeltine. +# Their terminal group is ancient history now (1995) though the parent +# company is still in business. +# + +# Beehive documentation is undated and marked Preliminary and has no figures +# so we must have early Superbee2 (Model 600, according to phone conversation +# with mfr.). It has proved reliable except for some missing padding +# (notably after \EK and at bottom of screen). +# +# The key idea is that AEP mode is poison for & that US's in +# the local memory should be avoided like the plague. That means +# that the 2048 character local buffer is used as 25 lines of 80 +# characters, period. No scrolling local memory, folks. It also +# appears that we cannot use naked INS LINE feature since it uses +# US. The sbi fakes with an 80-space insert that may be too +# slow at low speeds; also spaces get converted to \040 which is +# too long for some programs (not vi). DEL LINE is ok but slow. +# +# The string is designed for last line of screen ONLY; cup to +# 25th line corrects the motion inherent in scrolling to Page 1. +# +# There is one understood bug. It is that the screen appears to +# pop to a new (blank) page after a , or leave a half-line +# ellipsis to a quad that is the extra 48 memory locations. The +# data received is dumped into memory but not displayed. Not to +# worry if is being used; the lines not displayed will be, +# whenever the cursor is moved up there. Since is addressed +# relative to MEMORY of window, nothing is lost; but beware of +# relative cursor motion (,,,). Recommended, +# therefore, is setenv MORE -c . +# +# WARNING: Not all features tested. +# +# Timings are assembled from 3 sources. Some timings may reflect +# SB2/Model 300 that were used if more conservative. +# Tested on a Model 600 at 1200 and 9600 bd. +# +# The BACKSPACEkb option is cute. The NEWLINE key, so cleverly +# placed on the keyboard and useless because of AEP, is made +# into a backspace key. In use ESC must be pressed twice (to send) +# and sending ^C must be prefixed by ESC to avoid that weird +# transmit mode associated with ENTER key. +# +# IF TERMINAL EVER GOES CATATONIC with the cursor buzzing across +# the screen, then it has dropped into ENTER mode; hit +# RESET--ONLINE--!tset. +# +# As delivered this machine has a FATAL feature that will throw +# it into that strange transmit state (SPOW) if the space bar is +# hit after a CR is received, but before receiving a LF (or a +# few others). +# +# The circuits MUST be modified to eliminate the SPOW latch. +# This is done by strapping on chip A46 of the I/O board; cut +# the p.c. connection to Pin 5 and strap Pin 5 to Pin 8 of that +# chip. This mod has been checked out on a Mod 600 of Superbee II. +# With this modification absurdly high timings on cr are +# unnecessary. +# +# NOTE WELL that the rear panel switch should be set to CR/LF, +# not AEP! +# +sb1|beehive superbee, + am, bw, da, db, mir, ul, xsb, + cols#80, lines#25, xmc#1, + bel=^G, cbt=\E`$<650>, clear=\EH$<1>\EJ$<3>, cr=$<1>\r, + cub1=^H, cud1=^J, cuf1=\EC$<3>, cup=\EF%p2%03d%p1%03d, + cuu1=\EA$<3>, dch1=\EP$<3>, dl1=\EM$<100>, ed=\EJ$<3>, + el=\EK$<3>, home=\EH$<1>, ht=^I, hts=\E1, + il1=\EN\EL$<3>\EQ \EP$<3> \EO\ER\EA$<3>, + ind=^J, is2=\EE$<3>\EX\EZ\EO\Eb\Eg\ER, kbs=^_, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdl1=\EM, ked=\EJ, kel=\EK, + kf0=\E2, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, + kf7=\Ev, kf8=\Ew, kf9=\E1, khome=\EH, kich1=\EQ\EO, + krmir=\ER, lf0=TAB CLEAR, lf9=TAB SET, rmcup=, rmir=\ER, + rmso=\E_3, rmul=\E_3, sgr0=\E_3, smcup=\EO, smir=\EQ\EO, + smso=\E_1, smul=\E_0, tbc=\E3, +sbi|superbee|beehive superbee at Indiana U., + xsb, + cr=\r$<1>, il1=1\EN\EL$<9>\EQ \EP$<9> \EO\ER\EA, use=sb1, +# Alternate (older) description of Superbee - f1=escape, f2=^C. +# Note: there are at least 3 kinds of superbees in the world. The sb1 +# holds onto escapes and botches ^C's. The sb2 is the best of the 3. +# The sb3 puts garbage on the bottom of the screen when you scroll with +# the switch in the back set to CRLF instead of AEP. This description +# is tested on the sb2 but should work on all with either switch setting. +# The f1/f2 business is for the sb1 and the can be taken out for +# the other two if you want to try to hit that tiny escape key. +# This description is tricky: being able to use cup depends on there being +# 2048 bytes of memory and the hairy string. +superbee-xsb|beehive super bee, + am, da, db, xsb, + cols#80, it#8, lines#25, + clear=\EH\EJ$<3>, cnorm=^J, cr=\r$<1000>, cub1=^H, cud1=^J, + cuf1=\EC, cup=\EF%p2%3d%p1%3d, cuu1=\EA$<3>, + dch1=\EP$<3>, dl1=\EM$<100>, ed=\EJ$<3>, el=\EK$<3>, + home=\EH, ht=^I, hts=\E1, + ind=\n\200\200\200\n\200\200\200\EA\EK\200\200\200\ET\ET, + is2=\EH\EJ, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, + kf8=\Ew, khome=\EH, rmso=\E_3, sgr0=\E_3, smso=\E_1, tbc=\E3, +# This loses on lines > 80 chars long, use at your own risk +superbeeic|super bee with insert char, + ich1=, rmir=\ER, smir=\EQ, use=superbee-xsb, +sb2|sb3|fixed superbee, + xsb@, use=superbee, + +# Reports are that most of these Beehive entries (except superbee) have not +# been tested and do not work right. is a trouble spot. Be warned. + +# (bee: was empty, which is obviously bogus -- esr) +beehive|bee|harris beehive, + am, mir, + cols#80, lines#24, + cbt=\E>, clear=\EE, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EF%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EP, + dl1=\EM, ed=\EJ, el=\EK, home=\EH, il1=\EL, kbs=^H, kcbt=\E>, + kclr=\EE, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + kdch1=\EP, kdl1=\EM, kel=\EK, khome=\EH, kich1=\EQ, kil1=\EL, + krmir=\E@, rmir=\E@, rmso=\Ed@, rmul=\Ed@, sgr0=\Ed@, + smir=\EQ, smso=\EdP, smul=\Ed`, +# set tab is ^F, clear (one) tab is ^V, no way to clear all tabs. +# good grief - does this entry make :sg:/:ug: when it doesn't have to? +# look at those spaces in /. Seems strange to me... +# (beehive: removed, no such file. If you +# really care, cook up one using ^F -- esr) +beehive3|bh3m|beehiveIIIm|harris beehive 3m, + am, + cols#80, it#8, lines#20, + bel=^G, clear=^E^R, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cuu1=^K, + dl1=\021$<350>, ed=^R, el=^P, home=^E, ht=^I, hts=^F, + il1=\023$<160>, ind=^J, ll=^E^K, rmso=\s^_, smso=^]\s, +beehive4|bh4|beehive 4, + am, + cols#80, lines#24, + bel=^G, clear=\EE, cr=^M, cub1=\ED, cud1=^J, cuf1=\EC, + cuu1=\EA, ed=\EJ, el=\EK, home=\EH, ind=^J, +microb|microbee|micro bee series, + am, + cols#80, it#8, lines#24, + bel=^G, clear=\EE, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EF%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EK, ht=^I, ind=^J, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, + kf6=\Eu, kf7=\Ev, kf8=\Ew, kf9=\Ex, khome=\EH, rmso=\Ed@, + rmul=\Ed@, sgr0=\Ed@, smso=\s\EdP, smul=\Ed`, + +# 8675, 8686, and bee from Cyrus Rahman +# (8675: changed k10, k11...k16 to k;, F1...F6 -- esr) +ha8675|harris 8675, + is2=\ES\E#\E*\Eh\Em\E?\E1\E9\E@\EX\EU, kf1=^F, + kf10=\Ed, kf11=^W, kf12=\ER, kf13=\EE, kf14=\EI, kf15=\Ei, + kf16=\Eg, kf2=^P, kf3=^N, kf4=^V, kf5=^J, kf6=^T, kf7=^H, + kf8=\177, kf9=\Ee, + use=bee, +# (8686: changed k10, k11...k16 to k;, F1...F6; fixed broken continuation +# in :is: -- esr) +ha8686|harris 8686, + is2=\ES\E#\E*\Eh\Em\E?\E1\E9\E@\EX\EU\E"*Z01\E"8F35021B7C83#\E"8F45021B7D83#\E"8F55021B7E83#\E"8F65021B7F83#\E"8F75021B7383#\E"8F851BD7#\E"8F95021B7083#\E"8FA5021B7183#\E"8FB5021B7283#, + kf1=\002\Ep\003, kf10=\Ej, kf11=\EW, kf12=\002\E{\003, + kf13=\002\E|\003, kf14=\002\E}\003, kf15=\002\E~\003, + kf16=\002\E\177\003, kf2=\002\Eq\003, kf3=\002\Er\003, + kf4=\002\Es\003, kf5=\E3, kf6=\EI, kf7=\ER, kf8=\EJ, kf9=\E(, + use=bee, + +#### Hazeltine +# +# Hazeltine appears to be out of the business now (1995). These guys were +# co-owners of the Terminal Brain Damage Hall Of Fame along with Harris. +# They have a hazeltine.com domain and can be reached at: +# +# Hazeltine +# 450 East Pulaski Road +# Greenlawn, New York 11740 +# +# As late as 1993, manuals for the terminal product line could still be +# purchased from: +# +# TRW Customer Service Division +# 15 Law Drive +# P.O. Box 2076 +# Fairfield, NJ 07007-2078 +# + +# Since is blank, when you want to erase something you +# are out of luck. You will have to do ^L's a lot to +# redraw the screen. h1000 is untested. It doesn't work in +# vi - this terminal is too dumb for even vi. (The code is +# there but it isn't debugged for this case.) +hz1000|hazeltine 1000, + cols#80, lines#12, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, home=^K, + ind=^J, +# From: Thu Aug 20 09:09:18 1981 +hz1420|hazeltine 1420, + am, + cols#80, lines#24, + bel=^G, clear=\E^\, cr=^M, cub1=^H, cud1=^J, cuf1=^P, + cup=\E\021%p2%c%p1%{32}%+%c, cuu1=\E^L, dl1=\E^S, + ed=\E^X, el=\E^O, ht=^N, il1=\E^Z, ind=^J, rmso=\E^Y, + smso=\E^_, +# New "safe" cursor movement (11/87) from . Prevents +# freakout with out-of-range args and tn3270. No hz since it needs to +# receive tildes. +hz1500|hazeltine 1500, + am, hz, + cols#80, lines#24, + bel=^G, clear=~^\, cr=^M, cub1=^H, cud1=~^K, cuf1=^P, + cup=~\021%p2%p2%?%{30}%>%t%{32}%+%;%'`'%+%c%p1%'`'%+%c, + cuu1=~^L, dl1=~\023$<40>, ed=~\030$<10>, el=~^O, home=~^R, + il1=~\032$<40>, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^P, + kcuu1=~^L, khome=~^R, rmso=~^Y, smso=~^_, +# h1510 assumed to be in sane escape mode. Else use h1500. +# (h1510: early versions of this entry apparently had ", +# , but these caps were commented out in 8.3; also, +# removed incorrect and overridden ":do=^J:" -- esr) +hz1510|hazeltine 1510, + am, + cols#80, lines#24, + bel=^G, clear=\E^\, cr=^M, cub1=^H, cud1=\E^K, cuf1=^P, + cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, ed=\E^X, + el=\E^O, il1=\E^Z, ind=^J, +# Hazeltine 1520 +# The following switch settings are assumed for normal operation: +# FULL CR U/L_CASE ESCAPE +# FORMAT_OFF EOM_A_OFF EOM_B_OFF WRAPAROUND_ON +# Other switches may be set for operator convenience or communication +# requirements. +hz1520|Hazeltine 1520, + am, bw, msgr, + cols#80, lines#24, + bel=^G, bold=\E^_, clear=\E^\, cr=^M, cub1=^H, cud1=^J, + cuf1=^P, cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, + ed=\E^X, el=\E^O, home=\E^R, il1=\E^Z, ind=^J, kbs=^H, + kclr=\E^\, kcub1=^H, kcud1=\E^K, kcuf1=^P, kcuu1=\E^L, + kdl1=\E^S, ked=\E^X, kel=\E^O, khome=\E^R, kil1=\E^Z, + rmso=\E^Y, rs1=\E$\E\005\E?\E\031, sgr0=\E^Y, smso=\E^_, +# This version works with the escape switch off +# (h1520: removed incorrect and overridden ":do=^J:" -- esr) +hz1520-noesc|hazeltine 1520, + am, hz, + cols#80, lines#24, + bel=^G, clear=~^\, cr=^M, cub1=^H, cud1=~^K, cuf1=^P, + cup=~\021%p2%c%p1%c$<1>, cuu1=~^L, dl1=~^S, ed=~^X, el=~^O, + home=~^R, il1=~^Z, ind=^J, rmso=~^Y, smso=~^_, +# Note: the h1552 appears to be the first Hazeltine terminal which +# is not braindamaged. It has tildes and backprimes and everything! +# Be sure the auto lf/cr switch is set to cr. +hz1552|hazeltine 1552, + cud1=^J, dl1=\EO, il1=\EE, kf1=\EP, kf2=\EQ, kf3=\ER, lf1=blue, + lf2=red, lf3=green, + use=vt52, +hz1552-rv|hazeltine 1552 reverse video, + cud1=^J, rmso=\ET, smso=\ES, use=hz1552, +# Note: h2000 won't work well because of a clash between upper case and ~'s. +hz2000|hazeltine 2000, + am, + cols#74, lines#27, + bel=^G, clear=~\034$<6>, cub1=^H, cud1=^J, + cup=~\021%p2%c%p1%c, dl1=~\023$<6>, home=~^R, + il1=~\032$<6>, ind=^J, pad=\177, +# Date: Fri Jul 23 10:27:53 1982. Some unknown person wrote: +# I tested this termcap entry for the Hazeltine Esprit with vi. It seems +# to work ok. There is one problem though if one types a lot of garbage +# characters very fast vi seems not able to keep up and hangs while trying +# to insert. That's in insert mode while trying to insert in the middle of +# a line. It might be because the Esprit doesn't have insert char and delete +# char as a built in function. Vi has to delete to end of line and then +# redraw the rest of the line. +esprit|Hazeltine Esprit I, + am, bw, + cols#80, lines#24, + bel=^G, cbt=\E^T, clear=\E^\, cr=^M, cub1=^H, cud1=\E^K, + cuf1=^P, cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, + ed=\E^W, el=\E^O, home=\E^R, il1=\E^Z, ind=^J, is2=\E?, kbs=^H, + kcub1=^H, kcud1=\E^K, kcuf1=^P, kcuu1=\E^L, kf0=^B0^J, + kf1=^B1^J, kf2=^B2^J, kf3=^B3^J, kf4=^B4^J, kf5=^B5^J, + kf6=^B6^J, kf7=^B7^J, kf8=^B8^J, kf9=^B9^J, khome=\E^R, + lf0=0, lf1=1, lf2=2, lf3=3, lf4=4, lf5=5, lf6=6, lf7=7, lf8=8, lf9=9, + rmkx=\E>, rmso=\E^Y, smkx=\E<, smso=\E^_, +esprit-am|hazeltine esprit auto-margin, + am, use=esprit, +# Hazeltine Modular-1 from Cliff Shackelton via BRL +# Vi it seems always wants to send a control J for "do" and it turned out +# that the terminal would work somewhat if the auto LF/CR was turned off. +# (hmod1: removed :dn=~^K: -- esr) +hmod1|Hazeltine Modular 1, + am, hz, + cols#80, lines#24, + bel=^G, cbt=~^T, clear=~^\, cr=^M, cub1=^H, cud1=~^K, cuf1=^P, + cup=~\021%p2%c%p1%c, cuu1=~^L, dl1=~^S, home=~^R, il1=~^Z, + ind=^J, kcub1=^H, kcud1=~^K, kcuf1=^P, kcuu1=~^L, khome=~^R, + rc=~^Q, rmso=~^Y, sc=~^E, sgr0=~^Y, smso=~^_, +# +# Hazeltine Executive 80 Model 30 (1554?) +# from Will Martin via BRL +# Like VT100, except for different "am" behavior. +hazel|exec80|h80|he80|Hazeltine Executive 80, + am, + cols#80, it#8, lines#24, vt#3, + bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, + clear=\E[;H\E[2J$<50/>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=^J, cuf1=\E[C$<2/>, + cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<2/>, + ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, ht=^I, + is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, rc=\E8, rev=\E[7m$<2/>, + rf=/usr/share/tabset/vt100, ri=\EM$<5/>, + rmkx=\E[?1l\E>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, + rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr0=\E[m$<2/>, smkx=\E[?1h\E=, smso=\E[7m$<2/>, + smul=\E[4m$<2/>, + +#### IBM +# + +ibm327x|line mode IBM 3270 style, + gn, + clear=^M^J, el=^M, home=^M, + +# Beware! The 3101 entry IBM shipped with AIX 3 is *wrong*. Losers... +# From: J.B. Nicholson-Owens 8 Mar 94 +# (ibm3101: removed, no such file -- esr) +ibm3101|i3101|IBM 3101-10, + am, xon, + cols#80, lines#24, + bel=^G, clear=\EK, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EI, home=\EH, ht=^I, hts=\E0, ind=^J, kbs=^H, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, nel=^M^J, tbc=\E1, +# Received from the IBM terminals division (given to DRB) +# June 1988 for PS/2 OS 2.2.3 cut +ibm3151|i3151|IBM 3151, + rmso=\E4@, rmul=\E4@, + sgr=\E4%{64}%?%p1%{0}%>%p1%{4}%<%&%t%{8}%|%;%?%p1%{7}%=%t%{16}%|%;%?%p2%t%{1}%|%;%?%p3%t%{4}%|%;%?%p4%t%{2}%|%;%c, + sgr0=\E4@, smso=\E4A, smul=\E4B, + use=ibm3163, +# From: Mark Easter 29 Oct 1992 +# I've commented out or translated some IBM extensions. +ibm3161|ibm3163|wy60-316X|wyse60-316X|IBM 3161/3163 display, + am, mir, msgr, + cols#80, it#8, lines#24, + acsc=l\354q\361k\353x\370j\352m\355w\367u\365v\366t\364n\356, + bel=^G, blink=\E4D, bold=\E4H, clear=\EH\EJ, cr=^M, cub1=\ED, + cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, dch1=\EQ, dl1=\EO, ed=\EJ, el=\EI, home=\EH, ind=^J, + invis=\E4P, kbs=^H, kcbt=\E2, kclr=\EL\r, kctab=\E1, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EQ, + kdl1=\EO, ked=\EJ, kel=\EI, kf1=\Ea\r, kf10=\Ej\r, + kf11=\Ek\r, kf12=\El\r, kf13=\E!a\r, kf14=\E!b\r, + kf15=\E!c\r, kf16=\E!d\r, kf17=\E!e\r, kf18=\E!f\r, + kf19=\E!g\r, kf2=\Eb\r, kf20=\E!h\r, kf21=\E!i\r, + kf22=\E!j\r, kf23=\E!k\r, kf24=\E!l\r, kf3=\Ec\r, + kf4=\Ed\r, kf5=\Ee\r, kf6=\Ef\r, kf7=\Eg\r, kf8=\Eh\r, + kf9=\Ei\r, khome=\EH, khts=\E0, kich1=\EP \010, kil1=\EN, + ktbc=\E 1, rev=\E4A, rmcup=\E>A, rmso=\E4@, rmul=\E4@, + sgr=\E4%'@'%?%p1%t%'A'%|%;\n%?%p2%t%'B'%|%;\n%?%p3%t%'A'%|%;\n%?%p4%t%'D'%|%;\n%?%p5%t%'@'%|%;\n%?%p6%t%'H'%|%;\n%?%p7%t%'P'%|%;%c\n%?%p9%t\E>A%e\E<@%;, + sgr0=\E4@\E<@, smcup=\E>A, smso=\E4A, smul=\E4B, + +# How the 3164 sgr string works: +# %{32} # push space for no special video characteristics +# %?%p2%t%{1}%|%; # if p2 set, then OR the 1 bit for reverse +# %?%p3%t%{4}%|%; # if p3 set, then OR the 4 bit for blink +# %?%p4%t%{2}%|%; # if p4 set, then OR the 2 bit for underline +# %c # pop Pa1 +# %{39}%p1%- # calculate 32 + (7 - p1) for foreground +# %c # pop Pa2 +# %{64} # use only black background for now +# %c # pop Pa3 +ibm3164|i3164|IBM 3164, + blink=\E4D, bold=\E4H, + sgr=\E4%{32}%?%p2%t%{1}%|%;%?%p3%t%{4}%|%;%?%p4%t%{2}%|%;%c%{39}%p1%-%c%{64}%c, + sgr0=\E4@, + use=ibm3163, + +ibmaed|IBM Experimental display, + am, eo, msgr, + cols#80, it#8, lines#52, + clear=\EH\EK, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, + dl1=\EO, ed=\EJ, el=\EI, flash=\EG, home=\EH, ht=^I, ich1=\EP, + il1=\EN, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + rmso=\E0, sgr0=\E0, smso=\E0, +ibm-apl|apl|IBM apl terminal simulator, + lines#25, use=dm1520, +# (ibmmono: this had an unknown `sb' boolean, I changed it to `bs'. +# Also it had ":I0=f10:" which pretty obviously should be "l0=f10" -- esr) +ibmmono|ibm5151|IBM workstation monochrome, + eslok, hs, + bold=\EZ, dl1=\EM, dsl=\Ej\EY8 \EI\Ek, fsl=\Ek, il1=\EL, + invis=\EF\Ef0;\Eb0;, kbs=^H, kf0=\E<, kf1=\ES, kf2=\ET, + kf3=\EU, kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, kf9=\EY, + khome=\EH, kich1=\200, kind=\EE, knp=\EE, kpp=\Eg, kri=\EG, + lf0=f10, rev=\Ep, ri=\EA, rmso=\Ez, rmul=\Ew, + sgr0=\Ew\Eq\Ez\EB, smso=\EZ, smul=\EW, tsl=\Ej\EY8%+ \Eo, use=ibm3101, +ibmega|ibm5154|IBM Enhanced Color Display, + cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, + nel=^M^J, + use=ibmmono, +ibmega-c|ibm5154-c|IBM Enhanced Color Display, + rmso=\EB, rmul=\EB, smso=\EF\Ef3;, smul=\EF\Ef2;, use=ibmmono, +ibmvga-c|IBM VGA display color termcap, + cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, + nel=^M^J, + use=ibmega-c, +ibmvga|IBM VGA display, + cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, + nel=^M^J, + use=ibmega, +# ibmapa* and ibmmono entries come from ACIS 4.3 distribution +rtpc|ibmapa16|ibm6155|IBM 6155 Extended Monochrome Graphics Display, + lines#32, + dsl=\Ej\EY@ \EI\Ek, tsl=\Ej\EY@%+ \Eo, use=ibmmono, +# Advanced Monochrome (6153) and Color (6154) Graphics Display: +ibmapa8c|ibmapa8|ibm6154|ibm6153|IBM 6153/4 Advanced Graphics Display, + lines#31, + dsl=\Ej\EY? \EI\Ek, tsl=\Ej\EY?%+ \Eo, use=ibmmono, +ibmapa8c-c|ibm6154-c|IBM 6154 Advanced Color Graphics Display, + lines#31, + dim=\EF\Ef7;, dsl=\Ej\EY? \EI\Ek, tsl=\Ej\EY?%+ \Eo, use=ibmega-c, +# From: Marc Pawliger +# also in /usr/lpp/bos/bsdsysadmin. +# (hft-c: this entry had :kb=\E[D:kf=\E[C: on the line with ku/kd/kh; this was +# pretty obviously mislabeled for :le: and :nd:; also ":ul=\E[4m:" was clearly +# a typo for ":us=\E[4m:"; also ":el=\E[K:" was a typo for ":ce=\E[K:". +# I also added / based on the terminal reset string. +# There was an unknown boolean ":ht:" which I assume was meant to set hardware +# tabs, so I have inserted it#8. Finally, :ac=^N: paired with the :ae: looked +# like a typo for :as=^N:; finally, added empty to quiet tic -- esr) +ibm8512|ibm8513|hft-c|IBM High Function Terminal, + am, mir, msgr, + cols#80, it#8, lines#25, + acsc=, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cub1=\E[D, + cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, + home=\E[H, il=\E[%p1%dL, il1=\E[L, is2=\Eb\E[m\017\E[?7h, + kcud1=\E[B, kcuu1=\E[A, kf0=\E[010q, kf1=\E[001q, + kf2=\E[002q, kf3=\E[003q, kf4=\E[004q, kf5=\E[005q, + kf6=\E[006q, kf7=\E[007q, kf8=\E[008q, kf9=\E[009q, + khome=\E[H, rc=\E[u, rev=\E[7m, rmacs=^O, rmam=\E[?7l, + rmcup=\E[20h, rmdc=\E[4l, rmir=\E[4l, rmso=\E[m, rmul=\E[m, + rs1=\Eb\E[m\017\E[?7h\E[H\E[J, sc=\E[s, sgr0=\E[m, + smacs=^N, smam=\E[?7h, smcup=\E[20;4l\E[?7h\Eb, + smdc=\E[4h, smir=\E[4h, smso=\E[7m, smul=\E[4m, +hft|AIWS High Function Terminal, + am, xon, + cols#80, lines#25, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=^M, + cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, + ht=^I, ich1=\E[@, il1=\E[L, ind=^J, invis=\E[8m, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\E[001q, kf2=\E[002q, kf3=\E[003q, kf4=\E[004q, + kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, kf8=\E[008q, + kf9=\E[009q, khome=\E[H, knp=\E[153q, kpp=\E[159q, + ktbc=\E[010q, rev=\E[7m, rmir=\E6, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smir=\E6, smso=\E[7m, smul=\E[4m, +ibm-system1|system1|ibm system/1 computer, + am, xt, + cols#80, lines#24, + bel=^G, clear=^Z, cub1=^H, cuf1=^\, + cup=\005%p1%{32}%+%c%p2%{32}%+%c, cuu1=^^, home=^K, + ind=^J, + +# From: +ibm5081|ibmmpel|IBM 5081 1024x1024 256/4096 color display, + eslok, hs, + lines#33, + dsl=\Ej\EYA \EI\Ek, fsl=\Ek, tsl=\Ej\EYA%+ \Eo, use=ibmmono, +ibm5081-c|ibmmpel-c|IBM 5081 1024x1024 256/4096 enhanced color display, + eslok, hs, + lines#33, + dsl=\Ej\EYA \EI\Ek, fsl=\Ek, tsl=\Ej\EYA%+ \Eo, use=ibmega-c, +ibm8514|IBM 8514 color display, + eslok, hs, + lines#41, + cr=^M, cud1=^J, dsl=\Ej\EYI \EI\Ek, fsl=\Ek, ht=^I, ind=^J, + kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, tsl=\Ej\EYI%+ \Eo, + use=ibmega, +ibm8514-c|IBM 8514 color display, + eslok, hs, + lines#41, + cr=^M, cud1=^J, dsl=\Ej\EYI \EI\Ek, fsl=\Ek, ht=^I, ind=^J, + kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, tsl=\Ej\EYI%+ \Eo, + use=ibmega-c, + +# +# AIX entries. IBM ships these with AIX 3. +# AIX extension caps are commented out, +# except for box1 which has been translated to an string. +# +aixterm-m|IBM AIXterm Monochrome Terminal Emulator, + eslok, hs, + acsc=llqqkkxxjjmmwwuuvvttnn, bold=\E[1m, dsl=\E[?E, + fsl=\E[?F, ri@, s0ds=\E(B, s1ds=\E(0, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, + sgr0=\E[0;10m\E(B, tsl=\E[?%p1%dT, + use=ibm6153, +aixterm-m-old|IBM AIXterm Monochrome Terminal Emulator, + eslok, hs, + bold=\E[1m, dsl=\E[?E, fsl=\E[?F, ri@, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, + tsl=\E[?%p1%dT, + use=ibm6153, +jaixterm-m|IBM Kanji AIXterm Monochrome Terminal Emulator, + acsc@, + use=aixterm-m, + +#### Infoton/General Terminal Corp. +# + +# gt100 sounds like something DEC would come out with. Let's hope they don't. +i100|gt100|gt100a|General Terminal 100A (formerly Infoton 100), + am, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\Ef%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, dl1=\EM, + ed=\EJ, el=\EK, flash=\Eb$<200/>\Ea, home=\EH, il1=\EL, + ind=^J, rmso=\Ea, smso=\Eb, +i400|infoton 400, + am, + cols#80, lines#25, + bel=^G, clear=\E[2J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=%i\E[%p1%3d;%p2%3dH, cuu1=\E[A, + dch1=\E[4h\E[2Q\E[P\E[4l\E[0Q, dl1=\E[M, el=\E[N, + il1=\E[L, ind=^J, rmir=\E[4l\E[0Q, smir=\E[4h\E[2Q, +# (addrinfo: removed obsolete ":bc=^Z:" -- esr) +addrinfo, + am, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^Z, cud1=^J, cuf1=^Y, + cup=\037%p1%{1}%-%c%p2%{1}%-%c, cuu1=^\, ed=^K, home=^H, + ind=^J, ll=^H^\, +# (infoton: used to have the no-ops , , -- esr) +infoton, + am, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^Z, cud1=^J, cuf1=^Y, cuu1=^\, + ed=^K, ind=^J, ll=^H^\, + +#### Interactive Systems Corp +# +# ISC used to sell OEMed and customized hardware to support ISC UNIX. +# ISC UNIX still exists in 1995, but ISC itself is no more; they got +# bought out by Sun. +# + +# From: Wed Sep 16 08:06:44 1981 +# (intext: removed obsolete ":ma=^K^P^R^L^L ::bc=^_:", also the +# ":le=^_:" later overridden -- esr) +intext|Interactive Systems Corporation modified owl 1200, + am, + cols#80, it#8, lines#24, xmc#1, + bel=^G, cbt=^Y, clear=\014$<132>, cr=^M, cub1=^H, cud1=^J, + cuf1=^^, cup=\017%p1%{32}%+%c%p2%{32}%+%c, cuu1=^\, + dch1=\022$<5.5*>, dl1=\021$<5.5*>, ed=\026J$<5.5*>, + el=^Kp^R, ht=^I, il1=\020$<5.5*>, ind=^J, ip=$<5.5*>, kbs=^H, + kcub1=^_, kcud1=^J, kcuf1=^^, kcuu1=^\, kf0=^VJ\r, kf1=^VA\r, + kf2=^VB\r, kf3=^VC\r, kf4=^VD\r, kf5=^VE\r, kf6=^VF\r, + kf7=^VG\r, kf8=^VH\r, kf9=^VI\r, khome=^Z, rmir=^V<, + rmkx=^V9, rmso=^V#\s, smir=^V;, smkx=\036\:\264\026%, + smso=^V$\,, +intext2|intextii|INTERACTIVE modified owl 1251, + am, bw, ul, + cols#80, lines#24, xmc#0, + bel=^G, cbt=\E[Z, clear=\E[H\E[2J, cr=^M, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, + dl1=\E[M, ed=\E[J, el=\E[K, + flash=\E[;;;;;;;;;2;;u$<200/>\E[;;;;;;;;;1;;u, + hpa=\E[%p1%{1}%+%dG, ht=^I, ich1=\E[@, il1=\E[L, ind=\E[S, + kbs=^H, kcub1=\ED\r, kcud1=\EB\r, kcuf1=\EC\r, kcuu1=\EA\r, + kf0=\E@\r, kf1=\EP\r, kf2=\EQ\r, kf3=\ES\r, kf4=\ET\r, + kf5=\EU\r, kf6=\EV\r, kf7=\EW\r, kf8=\EX\r, kf9=\EY\r, + khome=\ER\r, lf0=REFRSH, lf1=DEL CH, lf2=TABSET, lf3=GOTO, + lf4=+PAGE, lf5=+SRCH, lf6=-PAGE, lf7=-SRCH, lf8=LEFT, + lf9=RIGHT, ri=\E[T, rmso=\E[2 D, rmul=\E[2 D, smso=\E[6 D, + smul=\E[18 D, + +#### Kimtron (abm, kt) +# +# Kimtron entries include (undocumented) codes for: enter dim mode, +# enter bold mode, enter reverse mode, turn off all attributes. +# + +# Kimtron ABM 85 added by Dual Systems +# (abm85: removed duplicated ":kd=^J:" -- esr) +abm85|Kimtron ABM 85, + am, bw, msgr, + cols#80, it#8, lines#24, xmc#1, + cbt=\EI, clear=\E*, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\Ey, el=\Et, ht=^I, + if=/usr/share/tabset/stdcrt, il1=\EE, + is2=\EC\EX\Eg\En\E%\Er\E(\Ek\Em\Eq, kbs=^H, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, rmir=\Er, rmso=\Ek, + rmul=\Em, smir=\EQ, smso=\Ej, smul=\El, +# Kimtron ABM 85H added by Dual Systems. +# Some notes about the abm85h entries: +# 1) there are several firmware revs of 85H in the world. Use abm85h-old for +# firmware revs prior to SP51 +# 2) Make sure to use abm85h entry if the terminal is in 85h mode and the +# abm85e entry if it is in tvi920 emulation mode. They are incompatible +# in some places and NOT software settable i.e., can't fix it) +# 3) In 85h mode, the arrow keys and special functions transmit when +# the terminal is in dup-edit, and work only locally in local-edit. +# Vi won't swallow `del char' for instance, but turns on +# dup-edit anyway so that the arrow keys will work right. If the +# arrow keys don't work the way you like, change , , and +# . Note that 920E mode does not have software commands to toggle +# between dup and local edit, so you get whatever was set last on the +# terminal. +# 4) attribute is nice, but seems too slow to work correctly +# (\Eb\Ed) +# 5) Make sure `hidden' attributes are selected. If `embedded' attributes +# are selected, the entry should be removed. +# 6) auto new-line should be on (selectable from setup mode only) +# +# From: Erik Fair Sun Oct 27 07:21:05 1985 +abm85h|Kimtron ABM 85H native mode, + hs, + xmc@, + bel=^G, cnorm=\E.4, cvvis=\E.2, dim=\E), dsl=\Ee, flash@, + fsl=^M, invis@, + is2=\EC\EN\EX\024\016\EA\Ea\E%\E9\Ee\Er\En\E"\E}\E'\E(\Ef\r\EG0\Ed\E.4\El, + kcud1=^V, sgr0=\E(\EG0, smir=\EZ, tsl=\Eg\Ef, + use=adm+sgr, use=abm85, +abm85e|Kimtron ABM 85H in 920E mode, + xmc@, + bel=^G, dim=\E), flash@, + is2=\EC\EX\EA\E%\E9\Ee\Er\En\E"\E}\E'\E(\Ef\r\Ek\Eq\Em, + rev=\Ej, sgr0=\E(\Ek, smir=\EZ, + use=abm85, +abm85h-old|oabm85h|o85h|Kimtron ABM 85H with old firmware rev., + xmc@, + bel=^G, dim=\E), + is2=\E}\EC\EX\Ee\En\E%\Er\E(\Ek\Em\Eq\Ed\ET\EC\E9\EF, + rev=\Ej, sgr0=\E(\Ek, smir=\EZ, + use=abm85, +# From: +# (kt7: removed obsolete :ma=^V^J^L :" -- esr) +kt7|kimtron model kt-7, + am, + cols#80, it#8, lines#24, + cbt=\EI, clear=^Z, cub1=^H, cud1=^V, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET, fsl=\Eg, home=^^, ht=^I, ich1=\EQ, + if=/usr/share/tabset/stdcrt, il1=\EE, invis@, is2=\El\E", + kbs=^H, kcbt=\EI, kclr=^Z, kcub1=^H, kcud1=^V, kcuf1=^L, + kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, kf0=^AI\r, + kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + kich1=\EQ, kil1=\EE, tsl=\Ef, + use=adm+sgr, +# Renamed TB=^I to :ta:, BE=^G to :bl:, BS=^H to :kb:, N to :kS: (based on the +# other kt7 entry and the adjacent key capabilities). Removed EE which is +# identical to :mh:. Removed :ES=\EGD: which is some kind of highlight +# but we can't figure out what. +kt7ix|kimtron model kt-7 or 70 in IX mode, + am, bw, + cols#80, it#8, lines#25, + acsc=lZm@k?jYt4uCvAwBqDx3nE, bel=^G, blink=\EG2, cbt=\EI, + civis=\E.0, clear=\E*, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\EW, dim=\EG@, dl1=\ER, dsl=\Ef\r, ed=\EY, el=\ET, fsl=^M, + home=^^, ht=^I, ich1=\EQ, il1=\EE, ind=^J, + is2=\EG0\E s\017\E~, kbs=^H, kcbt=\EI, kclr=\E*, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdl1=\ER, + ked=\EY, kel=\ET, kend=\EY, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, kil1=\EE, knp=\EJ, + nel=^M^J, pulse=\EK, rmacs=\E%, rmir=, rmso=\EG0, rmul=\EG0, + sgr0=\EG0, smacs=\E$, smir=, smso=\EG4, smul=\EG8, tsl=\Ef, + +#### Microdata/MDIS +# +# This was a line of terminals made by McDonnell-Douglas Information Systems. +# These entries come direct from MDIS documentation. I have edited them only +# to move primary names of the form p[0-9] * to aliases, and to comment out +# / in a couple of entries without strings. I have +# also removed the change history; the last version indicates this is +# version 4.3 by A.Barkus, September 1990 (earliest entry is October 1989). +# + +# McDonnell Information Systems Terminal Family History +# ========================================= +# +# Prism-1, Prism-2 and P99: +# Ancient Microdata and CMC terminals, vaguely like Adds Regent 25. +# +# Prism-4 and Prism-5: +# Slightly less ancient range of Microdata terminals. Follow-on from +# Prism-2, but with many enhancements. P5 has eight display pages. +# +# Prism-6: +# A special terminal for use with library systems, primarily in Germany. +# Limited numbers. Similar functionality to P5 (except attributes?). +# +# Prism-7, Prism-8 and Prism-9: +# More recent range of MDIS terminals, in which P7 and P8 +# replace the P4 & P5, with added functionality, and P9 is the flagship. +# The P9 has two emulation modes - P8 and ANSI - and includes a +# large number of the DEC VT220 control sequences. Both +# P8 and P9 support 80c/24ln/8pg and 132cl/24li/4pg formats. +# +# Prism-12 and Prism-14: +# Latest range, functionally very similar to the P9. The P14 has a +# black-on-white overscanning screen. +# +# The terminfo definitions given here are: +# +# p2 - Prism-2 (or Prism-1 or P99). +# +# p4 - Prism-4 (and older P7s & P8s). +# p5 - Prism-5 (or Prism-6). +# +# p7 - Prism-7. +# p8 - Prism-8 (in national or multinational mode). +# p8-w - 132 column version of p8. +# p9 - Prism-9 in ANSI mode. +# p9-w - 132 column version of p9. +# p9-8 - Prism-9 in Prism-8 emulation mode. +# p9-8-w - As p9-8, but with 132 columns. +# +# p12 - Prism-12 in ANSI mode. +# p12-w - 132 column version of p12. +# p12-m - Prism-12 in MDC emulation mode. +# p12-m-w - As p12-m, but with 132 columns. +# p14 - Prism-14 in ANSI mode. +# p14-w - 132 column version of p14. +# p14-m - Prism-14 in MDC emulation mode. +# p14-m-w - As p14-m, but with 132 columns. +# +# p2: Prism-2 +# ----------- +# +# Includes Prism-1 and basic P99 without SP or MP loaded. +# The simplest form of Prism-type terminal. +# Basic cursor movement and clearing operations only. +# No video attributes. +# Notes: +# Horizontal cursor qualifiers of NUL, XON and XOFF are mapped to the next +# value up, followed by backspace. +# +prism2|MDC Prism-2, + am, bw, msgr, + cols#80, lines#24, + bel=^G, clear=\014$<20>, cr=^M, cub1=^H, cud1=^J, cuf1=^F, + cup=\013%p1%' '%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, + cuu1=^Z, ed=\EJ, el=\EK, home=^A, + hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, + ind=^J, kbs=^H, khome=^A, vpa=\013%p1%' '%+%c, + +# p4: Prism-4 +# ----------- +# +# Includes early versions of P7 & P8. +# Basic family definition for most Prisms (except P2 and P9 ANSI). +# Notes: +# Horizontal cursor qualifiers of NUL, XON and XOFF are mapped to the next +# value up, followed by backspace. +# Cursor key definitions removed because they interfere with vi and csh keys. +# +prism4|p4|P4|MDC Prism-4, + am, bw, hs, mc5i, msgr, + cols#80, lines#24, wsl#72, xmc#1, + bel=^G, blink=^CB, civis=^]\344, clear=\014$<20>, + cnorm=^]\342, cr=^M, cub1=^H, cud1=^J, cuf1=^F, + cup=\013%p1%' '%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, + cuu1=^Z, dim=^CA, dsl=\035\343\035\345, ed=\EJ, el=\EK, + fsl=^]\345, home=^A^J, + hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, + ind=^J, invis=^CH, kbs=^H, khome=^A, mc0=\EU, mc4=\ET, mc5=\ER, + rev=^CD, rmso=^C\s, rmul=^C\s, + sgr=\003%'@'%?%p1%p3%|%t%{4}%+%;%?%p2%t%{16}%+%;%?%p4%t%{2}%+%;%?%p5%t%{1}%+%;%?%p7%t%{8}%+%;%c%?%p9%t\016%e\017%;, + sgr0=^C\s, smso=^CD, smul=^CP, tsl=^]\343, + vpa=\013%p1%' '%+%c, + +# p5: Prism-5 +# ----------- +# +# Same definition as p4. Includes Prism-6 (not tested!). +# Does not use any multi-page features. +# +prism5|p5|P5|MDC Prism-5, + use=p4, + +# p7: Prism-7 +# ----------- +# +# Similar definition to p4. Uses ANSI cursor motion to avoid network problems. +# Notes: +# Use p4 for very early models of P7. +# Rev-index removed; can't send nulls to terminal in 8-bit modes. +# +prism7|p7|P7|MDC Prism-7, + cup=\E[%i%p1%d;%p2%dH, hpa@, vpa@, use=p4, + +# p8: Prism-8 +# ----------- +# +# Similar definition to p7. Uses ANSI cursor motion to avoid network problems. +# Supports national and multinational character sets. +# Notes: +# Alternate char set operations only work in multinational mode. +# Use p4 for very early models of P8. +# Rev-index removed; can't send nulls to terminal in 8-bit modes. +# (esr: commented out / because there's no ) +# +prism8|p8|P8|MDC Prism-8, + cup=\E[%i%p1%d;%p2%dH, hpa=\E[%i%p1%d`, is2=\E[<12h, + vpa=\E[%i%p1%dd, + use=p4, + +# p8-w: Prism-8 in 132 column mode +# -------------------------------- +# +# 'Wide' version of p8. +# Notes: +# Rev-index removed; can't send nulls to terminal in 8-bit modes. +# +prism8-w|p8-w|P8-W|MDC Prism-8 in 132 column mode, + cols#132, + is2=\E[<12h\E[<14h, use=p8, + +# p9: Prism-9 in ANSI mode +# ------------------------- +# +# The "flagship" model of this generation of terminals. +# ANSI X3.64 (ISO 6429) standard sequences, plus many DEC VT220 ones. +# Notes: +# Tabs only reset by "reset". Otherwise assumes default (8 cols). +# Fixes to deal with terminal firmware bugs: +# . 'ri' uses insert-line since rev index doesn't always +# . 'sgr0' has extra '0' since esc[m fails +# . 'fsl' & 'dsl' use illegal char since cr is actioned wrong on line 25 +# Not covered in the current definition: +# . Labels +# . Programming Fn keys +# . Graphic characters (defaults correctly to vt100) +# . Padding values (sets xon) +# (esr: commented out / because there's no ) +# +prism9|p9|P9|MDC Prism-9 in ANSII mode, + am, bw, hs, mc5i, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, wsl#72, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[<4l, + clear=^L, cnorm=\E[<4h, cr=^M, csr=\E[%i%p1%d;%p2%d%%v, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, dsl=\E[%}\024, ech=\E[%p1%dX, + ed=\E[J$<10>, el=\E[K, fsl=^T, home=\E[H, hpa=\E[%i%p1%d`, + ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, + is2=\E[&p\E[<12l\E F, kbs=^H, kclr=^L, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\E[11~, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[H, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=^M^J, + prot=\E[32%{, rc=\E[%z, rep=\E[%p2%db%p1%c, rev=\E[7m, + ri=\E[L, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + rs2=\E[&p\E[<12l\E F\E[3g\E[9;17;25;33;41;49;57;65;73 N, + sc=\E[%y, + sgr=\E[%{0}%?%p1%p3%|%t%{4}%+%;%?%p2%t%{2}%+%;%?%p4%t%{1}%+%;%?%p6%t%{8}%+%;%?%p8%t%{32}%+%;%d%%{%?%p9%t\016%e\017%;, + sgr0=\E[0m, smir=\E[4h, smso=\E[7m, smul=\E[4m, tbc=\E[2g, + tsl=\E[%i%p1%d%%}, vpa=\E[%i%p1%dd, + +# p9-w: Prism-9 in 132 column mode +# -------------------------------- +# +# 'Wide' version of p9. +# +prism9-w|p9-w|P9-W|MDC Prism-9 in 132 column mode, + cols#132, + is2=\E[&p\E[<12l\E F\E[<14h, + rs2=\E[&p\E[<12l\E F\E[<14h, use=p9, + +# p9-8: Prism-9 in P8 mode +# ------------------------ +# +# P9 terminal in P8 emulation mode. +# Similar to p8 definition. +# Insertion and deletion operations possible. +# +prism9-8|p9-8|P9-8|MDC Prism-9 in P8 mode, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, use=p8, + +# p9-8-w: Prism-9 in P8 and 132 column modes +# ------------------------------------------ +# +# P9 terminal in P8 emulation mode and 132 column mode. +# +prism9-8-w|p9-8-w|P9-8-W|MDC Prism-9 in Prism 8 emulation and 132 column mode, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, use=p8-w, + +# p12: Prism-12 in ANSI mode +# --------------------------- +# +# See p9 definition. +# +prism12|p12|P12|MDC Prism-12 in ANSI mode, + use=p9, + +# p12-w: Prism-12 in 132 column mode +# ---------------------------------- +# +# 'Wide' version of p12. +# +prism12-w|p12-w|P12-W|MDC Prism-12 in 132 column mode, + use=p9-w, + +# p12-m: Prism-12 in MDC emulation mode +# ------------------------------------- +# +# P12 terminal in MDC emulation mode. +# Similar to p8 definition. +# Insertion and deletion operations possible. +# +prism12-m|p12-m|P12-M|MDC Prism-12 in MDC emulation mode, + use=p9-8, + +# p12-m-w: Prism-12 in MDC emulation and 132 column modes +# ------------------------------------------------------- +# +# P12 terminal in MDC emulation mode and 132 column mode. +# +prism12-m-w|p12-m-w|P12-M-W|MDC Prism-12 in MDC emulation and 132 column mode, + use=p9-8-w, + +# p14: Prism-14 in ANSII mode +# --------------------------- +# +# See p9 definition. +# +prism14|p14|P14|MDC Prism-14 in ANSII mode, + use=p9, + +# p14-w: Prism-14 in 132 column mode +# ---------------------------------- +# +# 'Wide' version of p14. +# +prism14-w|p14-w|P14-W|MDC Prism-14 in 132 column mode, + use=p9-w, + +# p14-m: Prism-14 in MDC emulation mode +# ------------------------------------- +# +# P14 terminal in MDC emulation mode. +# Similar to p8 definition. +# Insertion and deletion operations possible. +# +prism14-m|p14-m|P14-M|MDC Prism-14 in MDC emulation mode, + use=p9-8, + +# p14-m-w: Prism-14 in MDC emulation and 132 column modes +# ------------------------------------------------------- +# +# P14 terminal in MDC emulation mode and 132 column mode. +# +prism14-m-w|p14-m-w|P14-M-W|MDC Prism-14 in MDC emulation and 132 column mode, + use=p9-8-w, + +# End of McDonnell Information Systems Prism definitions + +# These things were popular in the Pick database community at one time +# From: George Land 24 Sep 1996 +p8gl|prism8gl|McDonnell-Douglas Prism-8 alternate definition, + am, bw, hs, mir, + cols#80, lines#24, ma#1, wsl#78, xmc#1, + bel=^G, blink=^CB, clear=^L, cr=^M, cub1=^U, cud1=^J, cuf1=^F, + cup=\E[%i%p1%d;%p2%dH, cuu1=^Z, dch1=\s^H, dim=^CA, dl1=^P, + ed=\EJ, el=\EK, home=^A, ind=^J, invis=^CH, kbs=^H, kcub1=^U, + kcud1=^J, kcuf1=^F, kcuu1=^Z, kdch1=\s^H, kdl1=^P, ked=\EJ, + kel=\EK, kf1=^A@\r, kf10=^AI\r, kf12=^AJ\r, kf13=^AK\r, + kf14=^AL\r, kf15=^AM\r, kf16=^AN\r, kf17=^AO\r, kf2=^AA\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khome=^A, lf1=F1, lf10=F10, lf2=F2, + lf3=F3, lf4=F4, lf5=F5, lf6=F6, lf7=F7, lf8=F8, lf9=F9, nel=^J^M, + pad=\200, rev=^CD, rmso=^C\s, rmul=^C\s, sgr0=^C\s, smso=^CE, + smul=^C0, + +#### Microterm (act, mime) +# +# The mime1 entries refer to the Microterm Mime I or Mime II. +# The default mime is assumed to be in enhanced act iv mode. +# + +# New "safe" cursor movement (5/87) from . Prevents +# freakout with out-of-range args on Sytek multiplexors. No and +# since it gets confused and it's too dim anyway. No +# since Sytek insists ^S means xoff. +# (act4: found ":ic=2^S:ei=:im=:ip=.1*^V:" commented out in 8.3 -- esr) +act4|microterm|microterm act iv, + am, + cols#80, lines#24, + bel=^G, clear=\014$<12/>, cr=^M, cub1=^H, cud1=^K, cuf1=^X, + cup=\024%p1%{24}%+%c%p2%p2%?%'/'%>%t%'0'%+%;%'P'%+%c, + cuu1=^Z, dch1=\004$<.1*/>, dl1=\027$<2.3*/>, + ed=\037$<2.2*/>, el=\036$<.1*/>, home=^], + il1=\001<2.3*/>, ind=^J, kcub1=^H, kcud1=^K, kcuf1=^X, + kcuu1=^Z, +# The padding on :sr: and :ta: for act5 and mime is a guess and not final. +# The act 5 has hardware tabs, but they are in columns 8, 16, 24, 32, 41 (!)... +# (microterm5: removed obsolete ":ma==^Z^P^Xl^Kj:" -- esr) +act5|microterm5|microterm act v, + kcub1=^H, kcud1=^K, kcuf1=^X, kcuu1=^Z, ri=\EH$<3>, uc=^H\EA, use=act4, +# Mimes using brightness for standout. Half bright is really dim unless +# you turn up the brightness so far that lines show up on the screen. +mime-fb|full bright mime1, + is2=^S\E, rmso=^S, smso=^Y, use=mime, +mime-hb|half bright mime1, + is2=^Y\E, rmso=^Y, smso=^S, use=mime, +# (mime: removed obsolete ":ma=^X ^K^J^Z^P:"; removed ":do=^K:" that overrode +# the more plausible ":do=^J:" -- esr) +# uc was at one time disabled to get around a curses bug, be wary of it +mime|mime1|mime2|mimei|mimeii|microterm mime1, + am, + cols#80, it#8, lines#24, vt#9, + bel=^G, clear=^]^C, cr=^M, cub1=^H, cud1=^J, cuf1=^X, + cup=\024%p1%{24}%+%c%p2%p2%?%{32}%>%t%'0'%+%;%'P'%+%c, + cuu1=^Z, dl1=\027$<80>, ed=^_, el=^^, home=^], ht=\011$<2>, + il1=\001$<80>, ind=^J, is2=^S\E^Q, kcub1=^H, kcud1=^K, + kcuf1=^X, kcuu1=^Z, ri=\022$<3>, uc=^U, +# These termcaps (for mime2a) put the terminal in low intensity mode +# since high intensity mode is so obnoxious. +mime2a-s|microterm mime2a (emulating an enhanced soroc iq120), + am, + cols#80, lines#24, + bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EI, dch1=\ED, + dl1=\027$<20*>, ed=\EJ$<20*>, el=\EK, home=^^, + il1=\001$<20*>, ind=^J, ip=$<2>, is2=\E), kcub1=^H, kcud1=^J, + kcuf1=^L, kcuu1=^K, ri=\EI, rmir=^Z, rmso=\E;, rmul=\E7, + smir=\EE, smso=\E\:, smul=\E6, +# This is the preferred mode (but ^X can't be used as a kill character) +mime2a|mime2a-v|microterm mime2a (emulating an enhanced vt52), + cols#80, it#8, lines#24, + bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=^N, + dl1=\027$<20*>, ed=\EQ$<20*>, el=\EP, home=\EH, ht=^I, + il1=\001$<20*>, ind=^J, ip=$<2>, is2=^Y, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, ri=\EA, rmir=^Z, rmso=\E9, + rmul=\E5, smir=^O, smso=\E8, smul=\E4, +# (mime3a: removed obsolete ":ma=^X ^K^J^Z^P:" -- esr) +mime3a|mime1 emulating 3a, + am@, + kcub1=^H, kcud1=^K, kcuf1=^X, kcuu1=^Z, use=adm3a, +mime3ax|mime-3ax|mime1 emulating enhanced 3a, + it#8, + dl1=\027$<80>, ed=^_, el=^X, ht=\011$<3>, il1=\001$<80>, use=mime3a, +# Wed Mar 9 18:53:21 1983 +# We run our terminals at 2400 baud, so there might be some timing problems at +# higher speeds. The major improvements in this model are the terminal now +# scrolls down and insert mode works without redrawing the rest of the line +# to the right of the cursor. This is done with a bit of a kludge using the +# exit graphics mode to get out of insert, but it does not appear to hurt +# anything when using vi at least. If you have some users using act4s with +# programs that use curses and graphics mode this could be a problem. +mime314|mm314|mime 314, + am, + cols#80, lines#24, + clear=^L, cub1=^H, cuf1=^X, cup=\024%p1%c%p2%c, cuu1=^Z, + dch1=^D, dl1=^W, ed=^_, el=^^, home=^], ht=^I, il1=^A, kcub1=^H, + kcud1=^K, kcuf1=^X, kcuu1=^Z, rmir=^V, smir=^S, +# Microterm mime 340 from University of Wisconsin +mm340|mime340|mime 340, + cols#80, lines#24, + clear=\032$<12/>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\E#$<2.1*/>, dl1=\EV$<49.6/>, ed=\037$<2*/>, + el=\EL$<2.1/>, ht=^I, il1=\EU$<46/>, ind=^J, is2=\E\,, + kbs=^H, kcub1=^H, kcud1=^J, kcuu1=^K, nel=^M^J, +# This came from University of Wisconsin marked "astro termcap for jooss". +# (mt4520-rv: removed obsolete ":kn#4:" and incorrect ":ri=\E[C:"; +# also added / based on the init string -- esr) +mt4520-rv|micro-term 4520 reverse video, + am, hs, msgr, xenl, xon, + cols#80, it#8, lines#24, wsl#80, + bel=^G, clear=\E[H\E[J, cnorm=\E[0V\E8, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E7\E[0U, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, flash=\E[?5l$<200/>\E[?5h, + fsl=\E[?5l\E[?5h, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\ED, + is2=\E(B\E[2l\E>\E[20l\E[?3l\E[?5h\E[?7h\E[1;24r\E[24;1H\E[H\E[J, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, + ll=\E[24;1H, nel=\EE, rc=\E8, rf=/usr/share/tabset/vt100, + ri=\EM, rmam=\E[?7l, rmso=\E[0m, rmul=\E[24m, + rs1=\E(B\E[2l\E>\E[20l\E[?3l\E[?5h\E[?7h\E[H\E[J, + sc=\E7, sgr0=\E[m, smam=\E[?7h, smso=\E[7m, smul=\E[4m, + tbc=\E[g, tsl=\E[25;1H, + +# Fri Aug 5 08:11:57 1983 +# This entry works for the ergo 4000 with the following setups: +# ansi,wraparound,newline disabled, xon/xoff disabled in both +# setup a & c. +# +# WARNING!!! There are multiple versions of ERGO 4000 microcode +# Be advised that very early versions DO NOT WORK RIGHT !! +# Microterm does have a ROM exchange program- use it or lose big +# (ergo400: added / based on the init string -- esr) +ergo4000|microterm ergo 4000, + da, db, msgr, + cols#80, lines#66, + bel=^G, clear=\E[H\E[2J$<80>, cr=^M, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch1=\E[1P$<80>, dl1=\E[1M$<5*>, ed=\E[0J$<15>, + el=\E[0K$<13>, ht=^I, il=\E[1L$<5*>, ind=\ED$<20*>, + is2=\E<\E=\E[?1l\E[?4l\E[?5l\E[?7h\E[?8h$<300>, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, lf1=pf1, lf2=pf2, lf3=pf3, + lf4=pf4, ri=\EM$<20*>, rmam=\E[?7l, rmir=\E[4l, + rmkx=\E=$<4>, rmso=\E[m$<20>, sgr0=\E[m$<20>, + smam=\E[?7m, smir=\E[4h$<6>, smkx=\E=$<4>, + smso=\E[7m$<20>, + +#### NCR +# +# NCR's terminal group was merged with AT&T's when AT&T bought the company. +# For what happened to that group, see the ADDS section. +# +# There is an NCR4103 terminal that's just a re-badged Wyse-50. +# + +# NCR7900 DIP switches: +# +# Switch A: +# 1-4 - Baud Rate +# 5 - Parity (Odd/Even) +# 6 - Don't Send or Do Send Spaces +# 7 - Parity Enable +# 8 - Stop Bits (One/Two) +# +# Switch B: +# 1 - Upper/Lower Shift +# 2 - Typewriter Shift +# 3 - Half Duplex / Full Duplex +# 4 - Light/Dark Background +# 5-6 - Carriage Return Without / With Line Feed +# 7 - Extended Mode +# 8 - Suppress Keyboard Display +# +# Switch C: +# 1 - End of line entry disabled/enabled +# 2 - Conversational mode / (Local?) Mode +# 3 - Control characters displayed / not displayed +# 4 - (2-wire?) / 4-wire communications +# 5 - RTS on and off for each character +# 6 - (50Hz?) / 60 Hz +# 7 - Exit after level zero diagnostics +# 8 - RS-232 interface +# +# Switch D: +# 1 - Reverse Channel (yes / no) +# 2 - Manual answer (no / yes) +# 3-4 - Cursor appearance +# 5 - Communication Rate +# 6 - Enable / Disable EXT turnoff +# 7 - Enable / Disable CR turnoff +# 8 - Enable / Disable backspace +# +# From , init string hacked by SCO. +ncr7900i|ncr7900|ncr 7900 model 1, + am, bw, ul, + cols#80, lines#24, xmc#1, + bel=^G, blink=\E0B, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^F, + cup=\E1%p2%c%p1%c, cuu1=^Z, dim=\E0A, ed=\Ek, el=\EK, ind=^J, + is2=\E0@\010\E3\E4\E7, kcub1=^U, kcud1=^J, kcuf1=^F, + kcuu1=^Z, khome=^A, ll=^A, mc4=^T, mc5=^R, rev=\E0P, rmso=\E0@, + rmul=\E0@, + sgr=\E0%p5%'@'%+%p4%{2}%*%+%p3%{16}%*%+%p2%{32}%*%+%p1%{17}%*%+%c, + sgr0=\E0@, smso=\E0Q, smul=\E0`, +ncr7900iv|ncr 7900 model 4, + am, bw, eslok, hs, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, + cup=\013%p1%'@'%+%c\E\005%p2%02d, dl1=\E^O, dsl=\Ey1, + fsl=\Ek\Ey5, home=\013@\E^E00, il1=\E^N, ind=^J, kbs=^H, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf1=\ES, kf2=\ET, + kf3=\EU, kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, + khome=\EH, lf6=blue, lf7=red, lf8=white, nel=^M^J, + tsl=\Ej\Ex5\Ex1\EY8%p1%{32}%+%c\Eo, +ncr7901|ncr 7901 model, + am, bw, ul, + cols#80, lines#24, + bel=^G, blink=\E0B, civis=^W, clear=^L, cnorm=^X, cr=^M, + cub1=^H, cud1=^J, cuf1=^F, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dim=\E0A, + ed=\Ek, el=\EK, + hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%c, ind=^J, + is2=\E4^O, kclr=^L, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^Z, + khome=^H, ll=^A, mc4=^T, mc5=^R, rev=\E0P, rmso=^O, rmul=^O, + sgr=\E0%p5%'@'%+%p4%{2}%*%+%p3%{16}%*%+%p2%{32}%*%+%p1%{17}%*%+%c\016, + sgr0=^O, smso=\E0Q\016, smul=\E0`\016, + vpa=\013%p1%'@'%+%c, + +#### Perkin-Elmer (Owl) +# +# These are official terminfo entries from within Perkin-Elmer. +# + +bantam|pe550|pe6100|perkin elmer 550, + cols#80, lines#24, + bel=^G, clear=\EK$<20>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, + el=\EI$<20>, home=\EH, ind=^J, ll=\EH\EA, +fox|pe1100|perkin elmer 1100, + am, + cols#80, lines#24, + bel=^G, clear=\EH\EJ$<132>, cr=^M, cub1=^H, cud1=^J, + cuf1=\EC, cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, + ed=\EJ$<5.5*>, el=\EI, flash=\020\002$<200/>\020\003, + home=\EH, hts=\E1, ind=^J, ll=\EH\EA, tbc=\E3, +owl|pe1200|perkin elmer 1200, + am, in, + cols#80, lines#24, + bel=^G, clear=\EH\EJ$<132>, cr=^M, cub1=^H, cud1=^J, + cuf1=\EC, cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, + dch1=\EO$<5.5*>, dl1=\EM$<5.5*>, ed=\EJ$<5.5*>, + el=\EI$<5.5>, flash=\020\002$<200/>\020\003, home=\EH, + hts=\E1, ich1=\EN, il1=\EL$<5.5*>, ind=^J, ip=$<5.5*>, + kbs=^H, kf0=\ERJ, kf1=\ERA, kf2=\ERB, kf3=\ERC, kf4=\ERD, + kf5=\ERE, kf6=\ERF, kf7=\ERG, kf8=\ERH, kf9=\ERI, ll=\EH\EA, + rmso=\E!\200, sgr0=\E!\200, smso=\E!^H, tbc=\E3, +pe1251|pe6300|pe6312|perkin elmer 1251, + am, + cols#80, it#8, lines#24, pb#300, vt#8, xmc#1, + bel=^G, clear=\EK$<332>, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, + ed=\EJ$<20*>, el=\EI$<10*>, home=\EH, hts=\E1, ind=^J, + kf0=\ERA, kf1=\ERB, kf10=\ERK, kf2=\ERC, kf3=\ERD, kf4=\ERE, + kf5=\ERF, kf6=\ERG, kf7=\ERH, kf8=\ERI, kf9=\ERJ, tbc=\E3, +# (pe7000m: this had +# rmul=\E!\0, smul=\E!\040, +# which is probably wrong, it collides with kf0 +pe7000m|perkin elmer 7000 series monochrome monitor, + am, + cols#80, lines#24, + bel=^G, cbt=\E!Y, clear=\EK, cr=^M, cub1=\ED, cud1=\EB, + cuf1=\EC, cup=\ES%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, + ed=\EJ, el=\EI, home=\EH, ind=^J, + is1=\E!\200\EW 7o\Egf\ES7\s, kbs=^H, kcub1=\E!V, + kcud1=\E!U, kcuf1=\E!W, kcuu1=\E!T, kf0=\E!\200, kf1=\E!^A, + kf10=\E!^J, kf2=\E!^B, kf3=\E!^C, kf4=\E!^D, kf5=\E!^E, + kf6=\E!^F, kf7=\E!^G, kf8=\E!^H, kf9=\E!^I, khome=\E!S, + ll=\ES7\s, ri=\ER, +pe7000c|perkin elmer 7000 series colour monitor, + is1=\E!\200\EW 7o\Egf\Eb0\Ec7\ES7\s, rmso=\Eb0, + rmul=\E!\200, smso=\Eb2, smul=\E!\s, + use=pe7000m, + +#### Sperry Univac +# +# Sperry Univac has merged with Burroughs to form Unisys. +# + +# This entry is for the Sperry UTS30 terminal running the TTY +# utility under control of CP/M Plus 1R1. The functionality +# provided is comparable to the DEC vt100. +# (uts30: I added / based on the init string -- esr) +uts30|sperry uts30 with cp/m@1R1, + am, bw, hs, + cols#80, lines#24, wsl#40, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\ER, clear=^L, + cnorm=\ES, cr=^M, csr=\EU%p1%{32}%+%c%p2%{32}%+%c, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\EB, + cuf=\E[%p1%dC, cuf1=\EC, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\EM, + dl=\E[%p1%dM, dl1=\EL, ed=\E[J, el=\E[K, fsl=^M, home=\E[H, + ht=^I, ich=\E[%p1%d@, ich1=\EO, il=\E[%p1%dL, il1=\EN, + ind=^J, indn=\E[%p1%dB, is2=\E[U 7\E[24;1H, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, khome=\E[H, + rc=\EX, rev=\E[7m, rf=/usr/share/tabset/vt100, ri=\EI, + rin=\E[%p1%dA, rmacs=\Ed, rmam=\E[?7l, rmso=\E[m, + rmul=\E[m, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + sc=\EW, sgr0=\E[m, smacs=\EF, smam=\E[?7m, smso=\E[7m, + smul=\E[4m, tsl=\E], uc=\EPB, + +#### Tandem +# +# Tandem builds these things for use with its line of fault-tolerant +# transaction-processing computers. They aren't generally available +# on the merchant market, and so are fairly uncommon. +# + +tandem6510|adm3a repackaged by Tandem, + use=adm3a, + +# A funny series of terminal that TANDEM uses. The actual model numbers +# have a fourth digit after 653 that designates minor variants. These are +# natively block-mode and rather ugly, but they have a character mode which +# this doubtless(?) exploits. There is a 6520 that is slightly dumber. +# (tandem653: had ":sb=\ES:", probably someone's mistake for sf; also, +# removed , no such file -- esr) +tandem653|t653x|Tandem 653x multipage terminal, + am, da, db, hs, + cols#80, lines#24, wsl#64, xmc#1, + clear=\EI, cub1=^H, cud1=^J, cuf1=\EC, + cup=\023%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dsl=\Eo\r, + ed=\EJ, el=\EK, fsl=^M, home=\EH, ind=\ES, ri=\ET, rmso=\E6\s, + rmul=\E6\s, sgr0=\E6\s, smso=\E6$, smul=\E60, tsl=\Eo, + +#### Tandy/Radio Shack +# +# Tandy has a line of VDTs distinct from its microcomputers. +# + +dmterm|deskmate terminal, + am, bw, + cols#80, lines#24, + bel=^G, civis=\EG5, clear=\Ej, cnorm=\EG6, cr=^M, cub1=^H, + cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, dch1=\ES, dl1=\ER, ed=\EJ, el=\EK, home=\EH, ht=^I, + ich1=\EQ, il1=\EP, ind=\EX, invis@, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, kf0=\E1, kf1=\E2, kf2=\E3, kf3=\E4, + kf4=\E5, kf5=\E6, kf6=\E7, kf7=\E8, kf8=\E9, kf9=\E0, + khome=\EH, lf0=f1, lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, + lf6=f7, lf7=f8, lf8=f9, lf9=f10, ll=\EE, rmul@, smul@, + use=adm+sgr, +dt100|dt-100|Tandy DT-100 terminal, + xon, + cols#80, lines#24, xmc#1, + acsc=kkllmmjjnnwwvvttuuqqxx, bel=^G, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%p1%2d;%p2%2dr, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\010\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, + il1=\E[L, ind=^J, is2=\E[?3l\E)0\E(B, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\E[?3i, + kf10=\E[?5i, kf2=\E[2i, kf3=\E[@, kf4=\E[M, kf5=\E[17~, + kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, khome=\E[H, + knp=\E[29~, kpp=\E[28~, lf1=f1, lf2=f2, lf3=f3, lf4=f4, lf5=f5, + lf6=f6, lf7=f7, lf8=f8, ri=\EM, rmacs=^O, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smacs=^N, smso=\E[7m, smul=\E[4m, +dt100w|dt-100w|Tandy DT-100 terminal (wide mode), + cols#132, use=dt100, +dt110|Tandy DT-110 emulating ansi, + xon, + cols#80, lines#24, + acsc=kkllmmjjnnwwvvuuttqqxx, bel=^G, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[0B, cuf1=\E[C, + cup=\010\E[%i%p1%d;%p2%dH, cuu1=\E[0A, dch1=\E[0P, + dl1=\E[0M, ed=\E[0J, el=\E[0K, enacs=\E(B\E)0, home=\E[H, + ht=^I, ich1=\E[0@, il1=\E[0L, ind=^J, is2=\E[?3l\E)0\E(B, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[K, + kf1=\E[1~, kf10=\E[10~, kf2=\E[2~, kf3=\E[3~, kf4=\E[4~, + kf5=\E[5~, kf6=\E[6~, kf7=\E[7~, kf8=\E[8~, kf9=\E[9~, + khome=\E[G, kich1=\E[@, knp=\E[26~, kpp=\E[25~, lf0=f1, + lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf8=f9, + lf9=f10, ri=\EM, rmacs=^O, rmso=\E[m, rmul=\E[m, sgr0=\E[m, + smacs=^N, smso=\E[7m, smul=\E[4m, +pt210|TRS-80 PT-210 printing terminal, + hc, os, + cols#80, + bel=^G, cr=^M, cud1=^J, ind=^J, + +#### Tektronix (tek) +# +# Tektronix tubes are graphics terminals. Most of them use modified +# oscilloscope technology incorporating a long-persistence green phosphor, +# and support vector graphics on a main screen with an attached "dialogue +# area" for interactive text. +# + +tek|tek4012|tektronix 4012, + os, + cols#75, lines#35, + bel=^G, clear=\E\014$<1000>, cr=^M, cub1=^H, cud1=^J, + ff=\014$<1000>, is2=\E^O, +# (tek4013: added to suppress tic warnings re / --esr) +tek4013|tektronix 4013, + acsc=, rmacs=\E^O, smacs=\E^N, use=tek4012, +tek4014|tektronix 4014, + cols#81, lines#38, + is2=\E\017\E9, use=tek4012, +# (tek4015: added to suppress tic warnings re / --esr) +tek4015|tektronix 4015, + acsc=, rmacs=\E^O, smacs=\E^N, use=tek4014, +tek4014-sm|tektronix 4014 in small font, + cols#121, lines#58, + is2=\E\017\E\:, use=tek4014, +# (tek4015-sm: added to suppress tic warnings re / --esr) +tek4015-sm|tektronix 4015 in small font, + acsc=, rmacs=\E^O, smacs=\E^N, use=tek4014-sm, +# Tektronix 4023 from Andrew Klossner +# +# You need to have "stty nl2" in effect. Some versions of tset(1) know +# how to set it for you. +# +# It's got the Magic Cookie problem around stand-out mode. If you can't +# live with Magic Cookie, remove the :so: and :se: fields and do without +# reverse video. If you like reverse video stand-out mode but don't want +# it to flash, change the letter 'H' to 'P' in the :so: field. +tek4023|tektronix 4023, + am, + cols#80, lines#24, vt#4, xmc#1, + bel=^G, clear=\E\014$<4/>, cr=^M, cub1=^H, cud1=^J, cuf1=^I, + cup=\034%p2%{32}%+%c%p1%{32}%+%c, kbs=^H, rmso=^_@, + smso=^_P, +# It is recommended that you run the 4025 at 4800 baud or less; +# various bugs in the terminal appear at 9600. It wedges at the +# bottom of memory (try "cat /usr/dict/words"); ^S and ^Q typed +# on keyboard don't work. You have to hit BREAK twice to get +# one break at any speed - this is a documented feature. +# Can't use cursor motion because it's memory relative, and +# because it only works in the workspace, not the monitor. +# Same for home. Likewise, standout only works in the workspace. +# +# was commented out since vi and rogue seem to work better +# simulating it with lots of spaces! +# +# and had 145ms of padding, but that slowed down vi's ^U +# and didn't seem necessary. +# +tek4024|tek4025|tek4027|tektronix 4024/4025/4027, + am, da, db, + cols#80, it#8, lines#34, lm#0, + bel=^G, clear=\037era\r\n\n, cmdch=^_, cr=^M, + cub=\037lef %p1%d\r, cub1=^H, cud=\037dow %p1%d\r, + cud1=^F^J, cuf=\037rig %p1%d\r, cuf1=\037rig\r, + cuu=\037up %p1%d\r, cuu1=^K, dch1=\037dch\r, + dl=\037dli %p1%d\r\006, dl1=\037dli\r\006, + ed=\037dli 50\r, ht=^I, ich1=\037ich\r \010, + il=\037up\r\037ili %p1%d\r, il1=\037up\r\037ili\r, + ind=^F^J, + is2=!com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r, + rmkx=\037lea p2\r\037lea p4\r\037lea p6\r\037lea p8\r\037lea f5\r, + smkx=\037lea p4 /h/\r\037lea p8 /k/\r\037lea p6 / /\r\037lea p2 /j/\r\037lea f5 /H/\r, +tek4025-17|tek 4025 17 line window, + lines#17, use=tek4025, +tek4025-17-ws|tek 4025 17 line window in workspace, + is2=!com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r\037wor 17\r\037mon 17\r, + rmcup=\037mon h\r, rmso=\037att s\r, smcup=\037wor h\r, + smso=\037att e\r, + use=tek4025-17, +tek4025-ex|tek4027-ex|tek 4025/4027 w/!, + is2=\037com 33\r\n!sto 9 17 25 33 41 49 57 65 73\r, + rmcup=\037com 33\r, smcup=!com 31\r, + use=tek4025, +# Tektronix 4025a +# From: Doug Gwyn +# The following status modes are assumed for normal operation (replace the +# initial "!" by whatever the current command character is): +# !COM 29 # NOTE: changes command character to GS (^]) +# ^]DUP +# ^]ECH R +# ^]EOL +# ^]RSS T +# ^]SNO N +# ^]STO 9 17 25 33 41 49 57 65 73 +# Other modes may be set according to communication requirements. +# If the command character is inadvertently changed, termcap can't restore it. +# Insert-character cannot be made to work on both top and bottom rows. +# Clear-to-end-of-display emulation via !DLI 988 is too grotty to use, alas. +# There also seems to be a problem with vertical motion, perhaps involving +# delete/insert-line, following a typed carriage return. This terminal sucks. +# Delays not specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! +# (tek4025a: removed obsolete ":xx:". This may mean the tek4025a entry won't +# work any more. -- esr) +tek4025a|Tektronix 4025A, + am, bw, da, db, xon, + cols#80, it#8, lines#34, + bel=^G, cbt=\035bac;, clear=\035era;\n\035rup;, cmdch=^], + cr=^M, cub=\035lef %p1%d;, cub1=^H, cud=\035dow %p1%d;, + cud1=^J, cuf=\035rig %p1%d;, cuf1=\035rig;, + cuu=\035up %p1%d;, cuu1=^K, dch=\035dch %p1%d;, + dch1=\035dch;, dl=\035dli %p1%d;, dl1=\035dli;, + el=\035dch 80;, hpa=\r\035rig %p1%d;, ht=^I, + il1=\013\035ili;, ind=^J, indn=\035dow %p1%d;, + tbc=\035sto;, +# From: cbosg!teklabs!davem Wed Sep 16 21:11:41 1981 +# Here's the command file that I use to get rogue to work on the 4025. +# It should work with any program using the old curses (e.g. it better +# not try to scroll, or cursor addressing won't work. Also, you can't +# see the cursor.) +# (This "learns" the arrow keys for rogue. I have adapted it for termcap - mrh) +tek4025-cr|tek 4025 for curses and rogue, + am, + cols#80, it#8, lines#33, + clear=\037era;, cub1=^H, cud1=^F^J, cuf1=\037rig;, + cup=\037jum%i%p1%d\,%p2%d;, cuu1=^K, ht=^I, ind=^F^J, + is2=!com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r, + rmcup=\037wor 0, smcup=\037wor 33h, +# next two lines commented out since curses only allows 128 chars, sigh. +# :ti=\037lea p1/b/\037lea p2/j/\037lea p3/n/\037lea p4/h/\037lea p5/ /\037lea p6/l/\037lea p7/y/\037lea p8/k/\037lea p9/u/\037lea p./f/\037lea pt/`era w/13\037lea p0/s/\037wor 33h:\ +# :te=\037lea p1\037lea p2\037lea p3\037lea p4\037lea pt\037lea p5\037lea p6\037lea p7\037lea p8\037lea p9/la/13\037lea p.\037lea p0\037wor 0: +tek4025ex|4025ex|4027ex|tek 4025 w/!, + is2=\037com 33\r\n!sto 9\,17\,25\,33\,41\,49\,57\,65\,73\r, + rmcup=\037com 33\r, smcup=!com 31\r, + use=tek4025, +tek4105|tektronix 4105, + am, mir, msgr, ul, xenl, xt, + cols#79, it#8, lines#29, + acsc=, bel=^G, blink=\E[=3;<7m, bold=\E[=7;<4m, cbt=\E[Z, + clear=\E[2J\E[H, cr=^M, cud1=\E[1B, cuf1=\E[1C, + cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[1A, dch1=\E[1P, + dim=\E[=1;<6m, dl1=\E[1M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, + il1=\E[1L, ind=\E[S, invis=\E[=6;<5, is1=\E%!1\E[m, + is2=\E%!1\E[?6141\E[m, kbs=^H, kcub1=\E[1D, kcud1=\E[1B, + kcuf1=\E[1C, kcuu1=\E[1A, rev=\E[=1;<3m, ri=\E[T, + rmacs=\E[m, rmcup=, rmir=\E[4l, rmso=\E[=0;<1m, + rmul=\E[=0;<1m, sgr0=\E[=0;<1m, smacs=\E[1m, + smcup=\E%!1\E[?6l\E[2J, smir=\E[4h, smso=\E[=2;<3m, + smul=\E[=5;<2m, tbc=\E[1g, + +# (tek4105-30: I added / based on the init string -- esr) +tek4105-30|4015 emulating 30 line vt100, + am, mir, msgr, xenl, xon, + cols#80, it#8, lines#30, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, + cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, + enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ind=^J, ka1=\EOq, + ka3=\EOs, kb2=\EOr, kbs=^H, kc1=\EOp, kc3=\EOn, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, kf0=\EOy, + kf1=\EOP, kf10=\EOx, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOt, + kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, rc=\E8, + rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, + rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, + smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, + +# Tektronix 4105 from BRL +# The following setup modes are assumed for normal operation: +# CODE ansi CRLF no DABUFFER 141 +# DAENABLE yes DALINES 30 DAMODE replace +# DAVISIBILITY yes ECHO no EDITMARGINS 1 30 +# FLAGGING input INSERTREPLACE replace LFCR no +# ORIGINMODE relative PROMPTMODE no SELECTCHARSET G0 B +# SELECTCHARSET G1 0 TABS -2 +# Other setup modes may be set for operator convenience or communication +# requirements; I recommend +# ACURSOR 1 0 AUTOREPEAT yes AUTOWRAP yes +# BYPASSCANCEL CURSORKEYMODE no DAINDEX 1 0 0 +# EOFSTRING '' EOLSTRING EOMCHARS +# GAMODE overstrike GCURSOR 0 100 0 GSPEED 10 1 +# IGNOREDEL no KEYEXCHAR
NVDEFINE -53 "" +# PROMPTSTRING '' QUEUESIZE 2460 WINDOW 0 0 4095 3132 +# XMTDELAY 0 +# and factory color maps. After setting these modes, save them with NVSAVE. No +# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! +# "IC" cannot be used in combination with "im" & "ei". +# "tek4105a" is just a guess: +tek4105a|Tektronix 4105, + msgr, xon, + cols#80, it#8, lines#30, vt#3, + acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + civis=\E%!0\ETD00\E%!1, clear=\E[H\E[J, + cnorm=\E%!0\ETD10\E%!1, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\EM, cvvis=\E%!0\ETD70\E%!1, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\EH, + il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, is2=\E%!1, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf0=\EOA, kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EOP, kf5=\EOQ, + kf6=\EOR, kf7=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, + lf5=F6, lf6=F8, ll=\E[30;H, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, + rin=\E[%p1%dT, rmacs=^O, rmcup=\E%!0\ELBH=\E%!1, + rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, sc=\E7, + sgr0=\E[m, smacs=^N, smcup=\E[?6l, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + +# +# Tektronix 4106/4107/4109 from BRL +# The following setup modes are assumed for normal operation: +# CODE ansi COLUMNMODE 80 CRLF no +# DABUFFER 141 DAENABLE yes DALINES 32 +# DAMODE replace DAVISIBILITY yes ECHO no +# EDITMARGINS 1 32 FLAGGING input INSERTREPLACE replace +# LFCR no LOCKKEYBOARD no ORIGINMODE relative +# PROMPTMODE no SELECTCHARSET G0 B SELECTCHARSET G1 0 +# TABS -2 +# Other setup modes may be set for operator convenience or communication +# requirements; I recommend +# ACURSOR 1 0 AUTOREPEAT yes AUTOWRAP yes +# BYPASSCANCEL CURSORKEYMODE no DAINDEX 1 0 0 +# EOFSTRING '' EOLSTRING EOMCHARS +# GAMODE overstrike GCURSOR 0 100 0 GSPEED 9 3 +# IGNOREDEL no KEYEXCHAR
NVDEFINE -53 "" +# PROMPTSTRING '' QUEUESIZE 2620 WINDOW 0 0 4095 3132 +# XMTDELAY 0 +# and factory color maps. After setting these modes, save them with NVSAVE. No +# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! +# "IC" cannot be used in combination with "im" & "ei". +tek4106brl|tek4107brl|tek4109brl|Tektronix 4106, 4107, or 4109, + msgr, xon, + cols#80, it#8, lines#32, vt#3, + acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + civis=\E%!0\ETD00\E%!1, clear=\E[H\E[J, + cnorm=\E%!0\ETD10\E%!1, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\EM, cvvis=\E%!0\ETD70\E%!1, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\EH, + il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, is2=\E%!1, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf0=\EOA, kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EOP, kf5=\EOQ, + kf6=\EOR, kf7=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, + lf5=F6, lf6=F8, ll=\E[32;H, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, + rin=\E[%p1%dT, rmacs=^O, rmcup=\E%!0\ELBH=\E%!1, + rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs1=\030\E%!0\EKC\E\014\EKR0\EKF0\ENM0\ELBH=\ETF8000010F40\ELI100\ELLB0\ELM0\EKE0\ENF1\EKS0\END0\ERE0\E%!1\Ec\E[?3;5l\E[?7;8h\E[r\E[m\E>, + sc=\E7, sgr0=\E[m, smacs=^N, smcup=\E[?6l, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7;42m, smul=\E[4m, tbc=\E[3g, + +tek4107|tek4109|tektronix terminals 4107 4109, + am, mir, msgr, ul, xenl, xt, + cols#79, it#8, lines#29, + bel=^G, blink=\E%!1\E[5m$<2>\E%!0, + bold=\E%!1\E[1m$<2>\E%!0, clear=\ELZ, cnorm=\E%!0, cr=^M, + cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, cvvis=\E%!3, + dim=\E%!1\E[<0m$<2>\E%!0, ed=\EJ, el=\EK, ht=^I, ind=^J, + kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + rev=\E%!1\E[7m$<2>\E%0, ri=\EI, + rmso=\E%!1\E[m$<2>\E%!0, rmul=\E%!1\E[m$<2>\E%!0, + sgr=\E%%!1\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m\E%%!0, + sgr0=\E%!1\E[m$<2>\E%!0, smso=\E%!1\E[7;5m$<2>\E%!0, + smul=\E%!1\E[4m$<2>\E%!0, +# Tektronix 4207 with sysline. In the ancestral termcap file this was 4107-s; +# see the note attached to tek4207. +tek4207-s|Tektronix 4207 with sysline but no memory, + eslok, hs, + dsl=\E7\E[?6l\E[2K\E[?6h\E8, fsl=\E[?6h\E8, + is1=\E%!1\E[2;32r\E[132D\E[2g\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[J, + is2=\E7\E[?6l\E[2K\E[?6h\E8, + tsl=\E7\E[?6l\E[2K\E[;%i%df, use=tek4107, + +# The 4110 series may be a wonderful graphics series, but they make the 4025 +# look good for screen editing. In the dialog area, you can't move the cursor +# off the bottom line. Out of the dialog area, ^K moves it up, but there +# is no way to scroll. +# +# Note that there is a floppy for free from Tek that makes the +# 4112 emulate the vt52 (use the vt52 termcap). There is also +# an expected enhancement that will use ANSI standard sequences. +# +# 4112 in non-dialog area pretending to scroll. It really wraps +# but vi is said to work (more or less) in this mode. +# +# 'vi' works reasonably well with this entry. +# +otek4112|o4112-nd|otek4113|otek4114|old tektronix 4110 series, + am, + cols#80, lines#34, + bel=^G, clear=\E^L, cr=^M, cub1=^H, cud1=^J, cuu1=^K, ind=^J, + rmcup=\EKA1\ELV1, smcup=\EKA0\ELV0\EMG0, +# The 4112 with the ANSI compatibility enhancement +tek4112|tek4114|tektronix 4110 series, + am, db, + cols#80, lines#34, + cbt=\E[Z, clear=\E[2J\E[0;0H, cub1=^H, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, dch1=\E[P, dl1=\E[M, + ed=\E[0J, el=\E[0K, ich1=\E[@, il1=\E[L, + ind=\E7\E[0;0H\E[M\E8, is2=\E3!1, ri=\E7\E[0;0H\E[L\E8, + rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, +tek4112-nd|4112 not in dialog area, + cuu1=^K, use=tek4112, +tek4112-5|4112 in 5 line dialog area, + lines#5, use=tek4112, +# (tek4113: this used to have "", someone's mistake; +# removed ", ", which had been commented out in 8.3. +# Note, the !0 and !1 sequences in /// were +# previously \0410 and \0411 sequences...I don't *think* they were supposed +# to be 4-digit octal -- esr) +tek4113|tektronix 4113 color graphics with 5 line dialog area, + am, da, eo, + cols#80, lines#5, + clear=\ELZ, cub1=^H, cud1=^J, cuf1=\ELM1 \ELM0, + flash=\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERB0, + is2=\EKA1\ELL5\ELV0\ELV1, uc=\010\ELM1_\ELM0, +tek4113-34|tektronix 4113 color graphics with 34 line dialog area, + lines#34, + is2=\EKA1\ELLB2\ELV0\ELV1, use=tek4113, +# :ns: left off to allow vi visual mode. APL font (:as=\E^N:/:ae=\E^O:) not +# supported here. :uc: is slow, but looks nice. Suggest setenv MORE -up . +# :vb: needs enough delay to let you see the background color being toggled. +tek4113-nd|tektronix 4113 color graphics with no dialog area, + am, eo, + cols#80, it#8, lines#34, + clear=\E^L, cub1=^H, cud1=^J, cuf1=^I, cuu1=^K, + cvvis=\ELZ\EKA0, + flash=\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERB0, + home=\ELF7l\177 @, ht=^I, is2=\ELZ\EKA0\ELF7l\177 @, + ll=\ELF hl @, rmso=\EMT1, smso=\EMT2, uc=\010\EMG1_\EMG0, +# This entry is from Tek. Inc. (Brian Biehl) +# (tek4115: :bc: renamed to :le:, / added based on init string -- esr) +otek4115|Tektronix 4115, + am, da, db, eo, + cols#80, it#8, lines#34, + cbt=\E[Z, clear=\E[H\E[2J, + cnorm=\E%!0\ELBG8\E%!1\E[34;1H, cub1=\E[D, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + cvvis=\E%!0\ELBB2\E%!1, dch1=\E[P, dl1=\E[M, ed=\E[J, + el=\E[K, home=\E[H, ht=^I, if=/usr/share/tabset/vt100, + il1=\E[L, + is2=\E%!0\E%\014\ELV0\EKA1\ELBB2\ENU@=\ELLB2\ELM0\ELV1\EKYA?\E%!1\E[<1l\E[?7h\E[?8h\E[34;1H\E[34B\E[m, + kbs=^H, ri=\EM, rmam=\E[?7l, + rmcup=\E%!0\ELBG8\E%!1\E[34;1H\E[J, rmir=\E[4l, + rmkx=\E>, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smam=\E[?7h, + smcup=\E%!0\ELBB2\E%!1, smir=\E[4h, smkx=\E=, smso=\E[7m, + smul=\E[4m, +tek4115|newer tektronix 4115 entry with more ANSI capabilities, + am, xon, + cols#80, lines#34, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, + cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, hpa=\E[%p1%{1}%+%dG, + ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=^J, invis=\E[8m, kbs=^H, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, rmam=\E[?7l, + rmso=\E[m, rmul=\E[m, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m, + sgr0=\E[m, smam=\E[?7h, smso=\E[7m, smul=\E[4m, tbc=\E[2g, + vpa=\E[%p1%{1}%+%dd, +# The tek4125 emulates a vt100 incorrectly - the scrolling region +# command is ignored. The following entry replaces with the needed +# , , and ; removes some cursor pad commands that the tek4125 +# chokes on; and adds a lot of initialization for the tek dialog area. +# Note that this entry uses all 34 lines and sets the cursor color to green. +# Steve Jacobson 8/85 +# (tek4125: there were two "\!"s in the is that I replaced with "\E!"; +# commented out, =\E1 because there's no -- esr) +tek4125|tektronix 4125, + lines#34, + csr@, dl1=\E[1M, il1=\E[1L, + is2=\E%\E!0\EQD1\EUX03\EKA\ELBB2\ELCE0\ELI100\ELJ2\ELLB2\ELM0\ELS1\ELX00\ELV1\E%\E!1\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + rc@, sc@, smkx=\E=, + use=vt100, + +# From: +# (tek4207: This was the termcap file's entry for the 4107/4207, but SCO +# supplied another, less capable 4107 entry. So we'll use that for 4107 and +# note that if jcoker wasn't confused you may be able to use this one. +# I merged in ,,,, from a BRL entry -- esr) +tek4207|Tektronix 4207 graphics terminal with memory, + am, bw, mir, msgr, ul, xenl, + cols#80, it#8, lines#32, + blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J$<156/>, + cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\EM, dch1=\E[P$<4/>, dl1=\E[M$<3/>, ed=\E[J, + el=\E[K$<5/>, home=\E[H, ht=^I, ich1=\E[@$<4/>, + il1=\E[L$<3/>, ind=\E[S, invis=\E[=6;<5, + is2=\E%!0\ELBP0\E%!1\E[H\E[2g\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[J, + kcub1=\E[D, kcud1=\ED, kcuf1=\E[C, kcuu1=\EM, khome=\E[H, + rev=\E[7m, ri=\E[T, + rmcup=\E[?6h\E%!0\ELBP0\E%!1\E[32;1f, rmso=\E[m, + rmul=\E[m, sgr0=\E[m, smcup=\E[?6l\E[H\E[J, smso=\E[7m, + smul=\E[4m, tbc=\E[1g, + +# From: Thu Oct 31 12:54:27 1985 +# (tek4404: There was a "\!" in that I replaced with "\E!". +# Tab had been given as \E2I,that must be the tab-set capability -- esr) +tek4404|tektronix 4404, + cols#80, it#8, lines#32, + blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[1M, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\E[2I, il1=\E[1L, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, rc=\E8, + rmcup=\E[1;1H\E[0J\E[?6h\E[?1l, rmir=\E[4l, + rmkx=\E[?1h, rmso=\E[27m, rmul=\E[m, sc=\E7, sgr0=\E[m, + smcup=\E%\E!1\E[1;32r\E[?6l\E>, smir=\E[4h, + smkx=\E[?1l, smso=\E[7m, smul=\E[4m, +# Some unknown person wrote: +# I added the is string - straight Unix has ESC ; in the login +# string which sets a ct8500 into monitor mode (aka 4025 snoopy +# mode). The is string here cleans up a few things (but not +# everything). +ct8500|tektronix ct8500, + am, bw, da, db, + cols#80, lines#25, + bel=^G, cbt=\E^I, clear=\E^E, cr=^M, cub1=^H, cud1=^J, + cuf1=\ES, cup=\E|%p1%{32}%+%c%p2%{32}%+%c, cuu1=\ER, + dch1=\E^], dl1=\E^M, ed=\E^U, el=\E^T, ht=^I, ich1=\E^\, + il1=\E^L, ind=^J, is2=\037\EZ\Ek, ri=\E^A, rmso=\E\s, + rmul=\E\s, sgr0=\E\s, smso=\E$, smul=\E!, + +# Tektronix 4205 terminal. +# +# am is not defined because the wrap around occurs not when the char. +# is placed in the 80'th column, but when we are attempting to type +# the 81'st character on the line. (esr: hmm, this is like the vt100 +# version of xenl, perhaps am + xenl would work!) +# +# Bold, dim, and standout are simulated by colors and thus not allowed +# with colors. The tektronix color table is mapped into the RGB color +# table by setf/setb. All colors are reset to factory specifications by oc. +# The cap uses RGB notation to define colors. for arguments 1-3 the +# interval (0-1000) is broken into 8 smaller sub-intervals (125). Each sub- +# interval then maps into pre-defined value. +tek4205|tektronix 4205, + ccc, mir, msgr, + colors#8, cols#80, it#8, lines#30, ncv#49, pairs#63, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[=7;<4m, cbt=\E[Z, + clear=\E[2J\E[H, cr=^M, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch1=\E[1P, dim=\E[=1;<6m, dl1=\E[1M, ech=\E%p1%dX, + ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, home=\E[H, ht=^I, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[1L, ind=\ED, + initc=\E%%!0\n\ETF4\n%?%p1%{0}%=%t0\n%e%p1%{1}%=%t4\n%e%p1%{2}%=%t3\n%e%p1%{3}%=%t5\n%e%p1%{4}%=%t2\n%e%p1%{5}%=%t6\n%e%p1%{6}%=%t7\n%e1%;\n%?%p2%{125}%<%t0\n%e%p2%{250}%<%tA2\n%e%p2%{375}%<%tA?\n%e%p2%{500}%<%tC8\n%e%p2%{625}%<%tD4\n%e%p2%{750}%<%tE1\n%e%p2%{875}%<%tE\:\n%eF4%;\n%?%p3%{125}%<%t0\n%e%p3%{250}%<%tA2\n%e%p3%{375}%<%tA?\n%e%p3%{500}%<%tC8\n%e%p3%{625}%<%tD4\n%e%p3%{750}%<%tE1\n%e%p3%{875}%<%tE\:\n%eF4%;\n%?%p4%{125}%<%t0\n%e%p4%{250}%<%tA2\n%e%p4%{375}%<%tA?\n%e%p4%{500}%<%tC8\n%e%p4%{625}%<%tD4\n%e%p4%{750}%<%tE1\n%e%p4%{875}%<%tE\:\n%eF4%;\n\E%%!1, + invis=\E[=6;<5, is1=\E%!0\ETM1\E%!1\E[m, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\EOA, + kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EP, kf5=\EQ, kf6=\ER, + kf7=\ES, + oc=\E%!0\n\ETFB0\n0000\n1F4F4F4\n2F400\n30F40\n4A4C because of a bug in old vi (if stty says you have +# a "newline" style terminal (-crmode) vi figures all it needs is nl +# to get crlf, even if is not ^M.) +# (tty40: removed obsolete ":nl=\EG\EB:", it's just do+cr -- esr) +tty40|ds40|ds40-2|dataspeed40|teletype dataspeed 40/2, + xon, + cols#80, lines#24, + clear=\EH$<20>\EJ$<80>, cr=\EG, cub1=^H, cud1=\EB, + cuf1=\EC, cuu1=\E7, dch1=\EP$<50>, dl1=\EM$<50>, + ed=\EJ$<75>, home=\EH$<10>, ht=\E@$<10>, hts=\E1, + ich1=\E\^$<50>, il1=\EL$<50>, ind=\ES$<20>, kbs=^], + kcub1=^H, mc4=^T, mc5=\022$<2000>, ri=\ET$<10>, rmso=\E4, + rs2=\023\ER$<60>, smso=\E3, tbc=\EH\E2$<80>, +tty43|model 43 teletype, + am, hc, os, xon, + cols#132, + bel=^G, cr=^M, cub1=^H, cud1=^J, ind=^J, kbs=^H, + +#### Tymshare +# + +# You can add to put this 40-column mode, though I can't +# for the life of me think why anyone would want to. +scanset|sc410|sc415|Tymshare Scan Set, + am, bw, msgr, + cols#80, lines#24, + acsc=l, sc=^B, smacs=^N, + +#### Volker-Craig (vc) +# +# If you saw a Byte Magazine cover with a terminal on it during the early +# 1980s, it was probably one of these. Carl Helmers liked them because +# they could crank 19.2 and were cheap (that is, until he tried to program +# one...) +# + +# Missing in vc303a and vc303 descriptions: they scroll 2 lines at a time +# every other linefeed. +vc303|vc103|vc203|volker-craig 303, + am, + cols#80, lines#24, + bel=^G, clear=\014$<40>, cr=^M, cub1=^H, cud1=^J, cuf1=^I, + cuu1=^N, home=\013$<40>, kcub1=^H, kcud1=^J, kcuf1=^I, + kcuu1=^N, ll=\017$<1>W, +vc303a|vc403a|volker-craig 303a, + clear=\030$<40>, cuf1=^U, cuu1=^Z, el=\026$<20>, + home=\031$<40>, kcuf1=^U, kcuu1=^Z, ll=^P, use=vc303, +# (vc404: removed obsolete ":ma=^Z^P^U :" -- esr) +vc404|volker-craig 404, + am, + cols#80, lines#24, + bel=^G, clear=\030$<40>, cr=^M, cub1=^H, cud1=^J, cuf1=^U, + cup=\020%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, + ed=\027$<40>, el=\026$<20>, home=\031$<40>, ind=^J, + kcub1=^H, kcud1=^J, kcuf1=^U, kcuu1=^Z, +vc404-s|volker-craig 404 w/standout mode, + cud1=^J, rmso=^O, smso=^N, use=vc404, +# From: +# (vc414: merged in cup/dl1/home from an old vc414h-noxon) +vc414|vc414h|Volker-Craig 414H in sane escape mode., + am, + cols#80, lines#24, + clear=\E\034$<40>, cud1=\E^K, cuf1=^P, + cup=\E\021%p2%c%p1%c$<40>, cuu1=\E^L, dch1=\E3, + dl1=\E\023$<40>, ed=\E^X, el=\E\017$<10/>, home=\E^R, + ich1=\E\:, il1=\E\032$<40>, kcub1=^H, kcud1=\E^K, kcuf1=^P, + kcuu1=\E^L, kf0=\EA, kf1=\EB, kf2=\EC, kf3=\ED, kf4=\EE, + kf5=\EF, kf6=\EG, kf7=\EH, khome=\E^R, lf0=PF1, lf1=PF2, + lf2=PF3, lf3=PF4, lf4=PF5, lf5=PF6, lf6=PF7, lf7=PF8, + rmso=\E^_, smso=\E^Y, +vc415|volker-craig 415, + clear=^L, use=vc404, + +######## OBSOLETE PERSONAL-MICRO CONSOLES AND EMULATIONS +# + +#### IBM PC and clones +# + +# The pcplot IBM-PC terminal emulation program is really messed up. It is +# supposed to emulate a vt-100, but emulates the wraparound bug incorrectly, +# doesn't support scrolling regions, ignores add line commands, and ignores +# delete line commands. Consequently, the resulting behavior looks like a +# crude adm3a-type terminal. +# Steve Jacobson 8/85 +pcplot|pc-plot terminal emulation program, + xenl@, + csr@, dl@, dl1@, il@, il1@, rc@, sc@, use=vt100, +# KayPro II from Richard G Turner +# I've found that my KayPro II, running MDM730, continues to emulate an +# ADM-3A terminal, just like I was running TERM.COM. On our 4.2 UNIX +# system the following termcap entry works well: +# I have noticed a couple of minor glitches, but nothing I can't work +# around. (I added two capabilities from the BRL entry -- esr) +kaypro|kaypro2|kaypro II, + am, + cols#80, lines#24, + bel=^G, clear=\032$<1/>, cr=^M, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dl1=\ER, ed=^W, + el=^X, home=^^, il1=\EE, ind=^J, kcud1=^J, kcuf1=^L, kcuu1=^K, + +# From IBM, Thu May 5 19:35:27 1983 +# (ibmpc: commented out =\200R because we don't know -- esr) +ibmpc|ibm-pc|ibm5051|5051|IBM Personal Computer (no ANSI.SYS), + am, + cols#80, lines#24, + bel=^G, clear=^L^K, cr=^M^^, cub1=^], cud1=^J, cuf1=^\, + cuu1=^^, home=^K, ind=\n$<10>, kcud1=^_, + +#### Apple II +# +# Apple II firmware console first, then various 80-column cards and +# terminal emulators. For two cents I'd toss all these in the UFO file +# along with the 40-column apple entries. +# + +# From: brsmith@umn-cs.cs.umn.edu (Brian R. Smith) via BRL +# 'it#8' tells UNIX that you have tabs every 8 columns. This is a +# function of TIC, not the firmware. +# The clear key on a IIgs will do something like clear-screen, +# depending on what you're in. +appleIIgs|appleIIe|appleIIc|Apple 80 column firmware interface, + am, bw, eo, msgr, + cols#80, it#8, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^\, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], + home=^Y, ht=^I, ind=^W, kbs=^H, kclr=^X, kcub1=^H, kcud1=^J, + kcuf1=^U, kcuu1=^K, kdch1=\177, nel=^M^W, ri=^V, rmso=^N, + smso=^O, +# Apple //e with 80-column card, entry from BRL +# The modem interface is permitted to discard LF (maybe DC1), otherwise +# passing characters to the 80-column firmware via COUT (PR#3 assumed). +# Auto-wrap does not work right due to newline scrolling delay, which also +# requires that you set "stty cr2". +# Note: Cursor addressing is only available via the Pascal V1.1 entry, +# not via the BASIC PR#3 hook. All this nonsense can be avoided only by +# using a terminal emulation program instead of the built-in firmware. +apple2e|Apple //e, + bw, msgr, + cols#80, lines#24, + bel=^G, clear=\014$<100/>, cub1=^H, cud1=^J, cuu1=^_, + ed=\013$<4*/>, el=\035$<4/>, home=^Y, ht=^I, ind=^W, + is2=^R^N, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^U, kcuu1=^K, + nel=\r$<100/>, rev=^O, ri=^V, rmso=^N, rs1=^R^N, sgr0=^N, + smso=^O, +# mcvax!vu44!vu45!wilcke uses the "ap" entry together with Ascii Express Pro +# 4.20, with incoming and outgoing terminals both on 0, emulation On. +apple2e-p|Apple //e via Pascal, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, kbs=^H, kcub1=^H, + kcud1=^J, + use=apple2e, +# (ASCII Express) MouseTalk "Standard Apple //" emulation from BRL +# Enable DC3/DC1 flow control with "stty ixon -ixany". +apple-ae|ASCII Express, + am, bw, msgr, nxon, xon, + cols#80, it#8, lines#24, + bel=\007$<500/>, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^U, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], + home=^Y, ind=^W, is2=^R^N, kclr=^X, kcub1=^H, kcud1=^J, + kcuf1=^U, kcuu1=^K, rev=^O, ri=^V, rmso=^N, rs1=^R^N, sgr0=^N, + smso=^O, +appleII|apple ii plus, + am, + cols#80, it#8, lines#24, + clear=^L, cnorm=^TC2, cub1=^H, cud1=^J, cuf1=^\, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, cvvis=^TC6, + ed=^K, el=^], flash=\024G1$<200/>\024T1, home=\E^Y, ht=^I, + is2=\024T1\016, kcud1=^J, kcuf1=^U, rmso=^N, sgr0=^N, + smso=^O, +# Originally by Gary Ford 21NOV83 +# From: Fri Oct 11 21:27:00 1985 +apple-80|apple II with smarterm 80 col, + am, bw, + cols#80, lines#24, + cbt=^R, clear=\014$<10*/>, cr=\r$<10*/>, cub1=^H, cud1=^J, + cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, + ed=\013$<10*/>, el=\035$<10/>, home=^Y, +apple-soroc|apple emulating soroc 120, + am, + cols#80, lines#24, + bel=^G, clear=\E*$<300>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=\EY, el=\ET, + home=^^, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, +# From Peter Harrison, Computer Graphics Lab, San Francisco +# ucbvax!ucsfmis!harrison .....uucp +# ucbvax!ucsfmis!harrison@BERKELEY .......ARPA +# "These two work. If you don't have the inverse video chip for the +# Apple with videx then remove the :so: and :se: fields." +# (apple-videx: this used to be called DaleApple -- esr) +apple-videx|Apple with videx videoterm 80 column board with inverse video, + am, xenl, + cols#80, it#8, lines#24, + clear=\014$<300/>, cub1=^H, cud1=^J, cuf1=^\, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], + home=^Y, ht=^I, kcub1=^H, kcud1=^J, kcuf1=^U, khome=^Y, + rmso=^Z2, sgr0=^Z2, smso=^Z3, +# My system [for reference] : Apple ][+, 64K, Ultraterm display card, +# Apple Cat ][ 212 modem, + more all +# controlled by ASCII Express: Pro. +# From Dave Shaver +apple-uterm-vb|Videx Ultraterm for Apple micros with Visible Bell, + am, eo, xt, + cols#80, lines#24, + acsc=, clear=^L, cuf1=^\, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], + flash=^W35^W06, home=^Y, + is2=^V4^W06\017\rVisible Bell Installed.\016\r\n, + rmso=^N, smso=^O, +apple-uterm|Ultraterm for Apple micros, + am, eo, xt, + cols#80, lines#24, + acsc=, clear=^L, cuf1=^\, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], + home=^Y, is2=^V4^W06\016, rmso=^N, smso=^O, +# from trwrba!bwong (Bradley W. Wong): +# +# This entry assumes that you are using an apple with the UCSD Pascal +# language card. SYSTEM.MISCINFO is assumed to be the same as that +# supplied with the standard apple except that screenwidth should be set +# using SETUP to 80 columns. Note that the right arrow in not mapped in +# this termcap entry. This is because that key, on the Apple, transmits +# a ^U and would thus preempt the more useful "up" function of vi. +# +# HMH 2/23/81 +apple80p|80-column apple with Pascal card, + am, bw, + cols#80, lines#24, + clear=^Y^L, cuf1=^\\:, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], + home=^Y, kcub1=^H, +# +# Apple II+ equipped with Videx 80 column card +# +# Terminfo from ihnp4!ihu1g!djc1 (Dave Christensen) via BRL; +# manually converted by D A Gwyn +# +# DO NOT use any terminal emulation with this data base, it works directly +# with the Videx card. This has been tested with vi 1200 baud and works fine. +# +# This works great for vi, except I've noticed in pre-R2, ^U will scroll back +# 1 screen, while in R2 ^U doesn't. +# For inverse alternate character set add: +# =^O:=^N: +# (apple-v: added it#8 -- esr) +apple-videx2|Apple II+ w/ Videx card (similar to Datamedia h1520), + am, xenl, + cols#80, it#8, lines#24, + bel=\007$<100/>, clear=\014$<16*/>, cr=^M, cub1=^H, + cud1=^J, cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, + cuu1=^_, ed=\013$<16*/>, el=^], home=^Y, ht=\011$<8/>, + ind=^J, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^\, kcuu1=^_, + khome=^Y, rmso=^Z2, smso=^Z3, +apple-videx3|vapple|Apple II with 80 col card, + am, + cols#80, lines#24, + clear=\Ev, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, el=\Ex, home=\EH, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kf0=\EP, kf1=\EQ, kf2=\ER, kf3=\E\s, kf4=\E!, + kf5=\E", kf6=\E#, kf7=\E$, kf8=\E%, kf9=\E&, khome=\EH, +#From: decvax!cbosgd!cbdkc1!mww Mike Warren via BRL +aepro|Apple II+ running ASCII Express Pro--vt52, + cols#80, lines#24, + clear=\014$<300/>, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EK, home=\EH, +# UCSD addition: Yet another termcap from Brian Kantor's Micro Munger Factory +apple-vm80|ap-vm80|apple with viewmax-80, + cols#80, lines#24, + clear=\014$<300/>, cuf1=^\\:, + cup=\036%p1%{32}%+%c%p2%{32}%+%c$<100/>, cuu1=^_, + ed=\013$<300/>, el=^], home=\031$<200/>, + +#### Apple Lisa & Macintosh +# + +# (lisa: changed to -- esr) +lisa|apple lisa console display (black on white), + am, eo, msgr, + cols#88, it#8, lines#32, + acsc=lfmekcjdttuvvuwsqax`nb, civis=\E[5h, clear=^L, + cnorm=\E[5l, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, + is2=\E>\E[m\014, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, rmacs=\E[10m, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smacs=\E[11m, smso=\E[7m, smul=\E[4m, +liswb|apple lisa console display (white on black), + is2=\E>\E[0;7m\014, rmso=\E[0;7m, rmul=\E[0;7m, + smso=\E[m, smul=\E[4m, use=lisa, + +# lisaterm from ulysses!gamma!epsilon!mb2c!jed (John E. Duncan III) via BRL; +# revised by Ferd Brundick +# +# These entries assume that the 'Auto Wraparound' is enabled. +# Xon-Xoff flow control should also be enabled. +# +# The vt100 uses :rs2: and :rf: rather than :is2:/:tbc:/:hts: because the tab +# settings are in non-volatile memory and don't need to be reset upon login. +# Also setting the number of columns glitches the screen annoyingly. +# You can type "reset" to get them set. +# +lisaterm|Apple Lisa or Lisa/2 running LisaTerm vt100 emulation, + am, xenl, xon, + cols#80, it#8, lines#24, vt#3, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, ed=\E[J, + el=\E[K, home=\E[H, ht=^I, hts=\EH, ind=^J, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOP, kf1=\EOQ, + kf2=\EOR, kf3=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, rc=\E8, + rev=\E[7m, ri=\EM, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs1=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r, + sc=\E7, sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, +# Lisaterm in 132 column ("wide") mode. +lisaterm-w|Apple Lisa with Lisaterm in 132 column mode, + cols#132, + kbs=^H, kcub1=^H, kcud1=^J, use=lisaterm, +# Although MacTerminal has insert/delete line, it is commented out here +# since it is much faster and cleaner to use the "lock scrolling region" +# method of inserting and deleting lines due to the MacTerminal implementation. +# Also, the "Insert/delete ch" strings have an extra character appended to them +# due to a bug in MacTerminal V1.1. Blink is disabled since it is not +# supported by MacTerminal. +mac|macintosh|Macintosh with MacTerminal, + xenl, + blink@, dch1=\E[P$<7/>, ich1=\E[@$<9/>, ip=$<7/>, use=lisa, +# Lisaterm in 132 column ("wide") mode. +mac-w|macterminal-w|Apple Macintosh with Macterminal in 132 column mode, + cols#132, use=mac, + +#### Radio Shack/Tandy +# + +# (coco3: This had "ta" used incorrectly as a boolean and bl given as "bl#7". +# I read these as mistakes for ":it#8:" and ":bl=\007:" respectively -- esr) +# From: <{pbrown,ctl}@ocf.berkeley.edu> 12 Mar 90 +coco3|os9LII|Tandy CoCo3 24*80 OS9 Level II, + am, + cols#80, it#8, lines#24, + bel=^G, blink=^_", bold=\E\:^A, civis=^E\s, + clear=\014$<5*/>, cnorm=^E!, cub1=^H, cud1=^J, cuf1=^F, + cup=\002%p2%{32}%+%c%p1%{32}%+%c$<2/>, cuu1=^I, + dl1=^_1, ed=^K, el=^D, home=^A, il1=^_0, kcub1=^H, kcud1=^J, + kcuf1=^I, kcuu1=^L, rev=^_\s, rmso=^_!, rmul=^_#, + sgr0=\037!\E\:\200, smso=^_\s, smul=^_", +# (trs2: removed obsolete ":nl=^_:" -- esr) +trs2|trsII|trs80II|Radio Shack Model II using P&T CP/M, + am, msgr, + cols#80, it#8, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^_, cuf1=^], + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^^, dl1=^K, ed=^B, + el=^A, home=^F, ht=^I, il1=^D, ind=^J, kbs=^H, kcub1=^\, + kcud1=^_, kcuf1=^], kcuu1=^^, rmso=^O, sgr0=^O, smso=^N, +# From: Kevin Braunsdorf +# (This had extension capabilities +# :BN=\E[?33h:BF=\E[?33l:UC=\E[_ q:BC=\E[\177 q:\ +# :CN=\ERC:CF=\ERc:NR=\ERD:NM=\ER@: +# I also deleted the unnecessary ":kn#2:", ":sg#0:" -- esr) +trs16|trs-80 model 16 console, + am, + cols#80, it#8, lines#24, + acsc=l_mbk`javewcquxs, bel=^G, civis=\ERc, clear=^L, + cnorm=\ERC, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, + dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, ich1=\EP, il1=\EL, + ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + kf0=^A, kf1=^B, kf2=^D, kf3=^L, kf4=^U, kf5=^P, kf6=^N, kf7=^S, + khome=^W, lf0=f1, lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, + lf7=f8, mc4=\E]+, mc5=\E]=, rmacs=\ERg, rmso=\ER@, sgr0=\ER@, + smacs=\ERG, smso=\ERD, + +#### Atari ST +# + +# From: Simson L. Garfinkel +atari|atari st, + am, + cols#80, it#8, lines#25, + clear=\EH\EJ, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dl1=\EM, + ed=\EJ, el=\EK, ht=^I, il1=\EL, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, ri=\EI, rmso=\Eq, sgr0=\Eq, smso=\Ep, +# UniTerm terminal program for the Atari ST: 49-line VT220 emulation mode +# From: Paul M. Aoki +uniterm|uniterm49|UniTerm VT220 emulator with 49 lines, + lines#49, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;49r\E[49;1H, use=vt220, +# MiNT VT52 emulation. 80 columns, 25 rows. +# MiNT is Now TOS, the operating system which comes with all Ataris now +# (mainly Atari Falcon). This termcap is for the VT52 emulation you get +# under tcsh/zsh/bash/sh/ksh/ash/csh when you run MiNT in `console' mode +# From: Per Persson , 27 Feb 1996 +st52|Atari ST with VT52 emulation, + am, km, + cols#80, lines#25, + bel=^G, civis=\Ef, clear=\EH\EJ, cnorm=\Ee, cr=^M, cub1=\ED, + cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, il1=\EL, + ind=^J, ka1=\E#7, ka3=\E#5, kb2=\E#9, kbs=^H, kc1=\E#1, + kc3=\E#3, kclr=\E#7, kcub1=\E#K, kcud1=\E#P, kcuf1=\E#M, + kcuu1=\E#H, kf0=\E#D, kf1=\E#;, kf2=\E#<, kf3=\E#=, kf4=\E#>, + kf5=\E#?, kf6=\E#@, kf7=\E#A, kf8=\E#B, kf9=\E#C, khome=\E#G, + kil1=\E#R, kind=\E#2, kri=\E#8, lf0=f10, nel=^M^J, rc=\Ek, + ri=\EI, rmcup=, rmso=\Eq, rs1=\Ez_\Eb@\EcA, sc=\Ej, sgr0=\Eq, + smcup=\Ee, smso=\Ep, + +#### Commodore Business Machines +# +# Formerly located in West Chester, PA; went spectacularly bust in 1994 +# after years of shaky engineering and egregious mismanagement. Made one +# really nice machine (the Amiga) and boatloads of nasty ones (PET, C-64, +# C-128, VIC-20). The C-64 is said to have been the most popular machine +# ever (most units sold); they can still be found gathering dust in closets +# everywhere. +# + +# From: Kent Polk , 30 May 90 +# Added a few more entries, converted caret-type control sequence (^x) entries +# to '\0xx' entries since a couple of people mentioned losing '^x' sequences. +# +# :as:, :ae: Support for alternate character sets. +# :ve=\E[\040p:vi=\E[\060\040p: cursor visible/invisible. +# :xn: vt100 kludginess at column 80/NEWLINE ignore after 80 cols(Concept) +# This one appears to fix a problem I always had with a line ending +# at 'width+1' (I think) followed by a blank line in vi. The blank +# line tended to disappear and reappear depending on how the screen +# was refreshed. Note that this is probably needed only if you use +# something like a Dnet Fterm with the window sized to some peculiar +# dimension larger than 80 columns. +# :k0=\E9~: map F10 to k0 - could have F0-9 -> k0-9, but ... F10 was 'k;' +# (amiga: removed obsolete :kn#10:, +# also added empty to suppress a warning --esr) +amiga-old|Amiga ANSI, + am, bw, xenl, + cols#80, lines#24, + acsc=, bel=^G, blink=\E[7;2m, bold=\E[1m, cbt=\E[Z, + civis=\E[0 p, clear=\E[H\E[J, cnorm=\E[ p, cub=\E[%p1%dD, + cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, + indn=\E[%p1%dS, invis=\E[8m, is2=\E[20l, kbs=^H, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf0=\E9~, kf1=\E0~, + kf2=\E1~, kf3=\E2~, kf4=\E3~, kf5=\E4~, kf6=\E5~, kf7=\E6~, + kf8=\E7~, kf9=\E8~, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, + rmacs=^O, rmso=\E[m, rmul=\E[m, rs1=\Ec, sgr0=\E[m, smacs=^N, + smso=\E[7m, smul=\E[4m, + +# From: Hans Verkuil , 4 Dec 1995 +# (amiga: added empty to suppress a warning --esr) +amiga|Amiga ANSI, + bw, msgr, + cols#80, lines#24, + acsc=, bel=^G, blink=\2337;2m, bold=\2331m, cbt=\233Z, + civis=\2330 p, clear=\233H\233J, cnorm=\233 p, cr=^M, + cub=\233%p1%dD, cub1=\233D, cud=\233%p1%dB, cud1=\233B, + cuf=\233%p1%dC, cuf1=\233C, cup=\233%i%p1%d;%p2%dH, + cuu=\233%p1%dA, cuu1=\233A, dch=\233%p1%dP, dch1=\233P, + dim=\2332m, ech=\233%p1%dP, ed=\233J, el=\233K, flash=^G, + home=\233H, ht=^I, ich=\233%p1%d@, ich1=\233@, ind=\233S, + indn=\233%p1%dS, invis=\2338m, is2=\23320l, kbs=^H, + kcub1=\233D, kcud1=\233B, kcuf1=\233C, kcuu1=\233A, + kdch1=\177, kf0=\2339~, kf1=\2330~, kf2=\2331~, kf3=\2332~, + kf4=\2333~, kf5=\2334~, kf6=\2335~, kf7=\2336~, kf8=\2337~, + kf9=\2338~, nel=\233B\r, rev=\2337m, ri=\233T, + rin=\233%p1%dT, rmacs=^O, rmcup=\233?7h, rmso=\2330m, + rmul=\2330m, rs1=\Ec, sgr0=\2330m, smacs=^N, smcup=\233?7l, + smso=\2337m, smul=\2334m, + +# Commodore B-128 microcomputer from Doug Tyrol +# I'm trying to write a termcap for a commodore b-128, and I'm +# having a little trouble. I've had to map most of my control characters +# to something that unix will accept (my delete-char is a ctrl-t, etc), +# and create some functions (like cm), but thats life. +# The problem is with the arrow keys - right, and up work fine, but +# left deletes the previous character and down I just can't figure out. +# Jove knows what I want, but I don't know what it's sending to me (it +# isn't thats bound to next-line in jove). +# Anybody got any ideas? Here's my termcap. +# DAG -- I changed his "^n" entries to "\n"; see if that works. +# +commodore|b-128|Commodore B-128 micro, + am, bw, + cols#80, lines#24, pb#150, + clear=\E\006$<10/>, cr=^M, cud1=^J, cuf1=^F, + cup=\E\013%p1%2d\,%p2%2d\,$<20/>, cuu1=^P, + dch1=\177$<10*/>, dl1=\Ed$<10*/>, el=\Eq$<10/>, + home=\E^E, ht=\011$<5/>, ich1=\E\n$<5/>, il1=\Ei$<10/>, + kcub1=^B, kcud1=^J, kcuf1=^F, kcuu1=^P, khome=\E^E, rmir=, + smir=, + +#### North Star +# +# North Star Advantage from Lt. Fickie via BRL +northstar|North Star Advantage, + cols#80, lines#24, + clear=\004$<200/>, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<1/>, ed=\017$<200/>, + el=\016$<200/>, home=\034\032$<200/>, + +#### Osborne +# +# Thu Jul 7 03:55:16 1983 +# +# As an aside, be careful; it may sound like an anomaly on the +# Osborne, but with the 80-column upgrade, it's too easy to +# enter lines >80 columns! +# +# I've already had several comments... +# The Osborne-1 with the 80-col option is capable of being +# 52, 80, or 104 characters wide; default to 80 for compatibility +# with most systems. +# +# The tab is destructive on the Ozzie; make sure to 'stty -tabs'. +osborne-w|osborne1-w|osborne I in 104-column mode, + msgr, ul, xt, + cols#104, lines#24, + bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, el=\ET, ich1=\EQ, il1=\EE, ind=^J, kcub1=^H, kcud1=^J, + kcuf1=^L, kcuu1=^K, rmso=\E(, rmul=\Em, smso=\E), smul=\El, +# Osborne I from ptsfa!rhc (Robert Cohen) via BRL +osborne|osborne1|osborne I in 80-column mode, + am, mir, msgr, ul, xhp, + cols#80, lines#24, + clear=^Z, cub1=\010$<4>, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\\EW$<4/>, dl1=\ER, el=\ET, il1=\EE, is2=^Z, kbs=^H, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, rmir=, rmso=\E), + rmul=\Em, smir=\EQ, smso=\E(, smul=\El, +# +# Osborne Executive definition from BRL +# Similar to tvi920 +# Added by David Milligan and Tom Smith (SMU) +osexec|Osborne executive, + am, + cols#80, lines#24, xmc#1, + bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET, home=^^, hts=\E1, ich1=\EQ, il1=\EE, + is2=\Eq\Ek\Em\EA\Ex0, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, + kcuu1=^K, kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, + kf4=^AD\r, kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, + kf9=^AI\r, rmir=, rmso=\Ek, rmul=\Em, smir=, smso=\Ej, + smul=\El, tbc=\E3, + +#### Console types for obsolete UNIX clones +# +# Coherent, Minix, Venix, and several lesser-known kin were OSs for 8088 +# machines that tried to emulate the UNIX look'n'feel. Coherent and Venix +# were commercial, Minix an educational tool sold in conjunction with a book. +# Memory-segmentation limits and a strong tendency to look like V7 long after +# it was obsolete made all three pretty lame. Venix croaked early. Coherent +# and Minix were ported to 32-bit Intel boxes, only to be run over by a +# steamroller named `Linux' (which, to be fair, traces some lineage to Minix). +# Coherent's vendor, the Mark Williams Company, went belly-up in 1994. There +# are also, I'm told, Minix ports that ran on Amiga and Atari machines and +# even as single processes under SunOS and the Macintosh OS. +# + +# This is the entry provided with minix 1.7.4, with bogus :ri: removed. +minix|minix console (v1.7), + am, xenl, + cols#80, it#8, lines#25, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[0J, cr=^M, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, el=\E[K, home=\E[H, ht=^I, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, + is2=\E[0m, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf0=\E[Y, kf1=\E[V, kf2=\E[U, kf3=\E[T, kf4=\E[S, + kf5=\E[G, khome=\E[H, lf0=End, lf1=PgUp, lf2=PgDn, lf3=Num +, + lf4=Num -, lf5=Num 5, nel=^M^J, rev=\E[7m, ri=\EM, + rmso=\E[0m, rmul=\E[0m, sgr0=\E[0m, smso=\E[7m, smul=\E[4m, +minix-old|minix console (v1.5), + cols#80, it#8, lines#25, + blink=\E[5m, bold=\E[1m, clear=\E[H\E[0J, cr=^M, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, el=\E[K, home=\E[H, ht=^I, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf0=\E[Y, kf1=\E[V, kf2=\E[U, kf3=\E[T, kf4=\E[S, kf5=\E[G, + khome=\E[H, nel=^M^J, rev=\E[7m, ri=\EM, rmso=\E[0m, + rmul=\E[0m, sgr0=\E[0m, smso=\E[7m, smul=\E[4m, + +pc-minix|minix console on an Intel box, + use=klone+acs, use=minix, + +# According to the Coherent 2.3 manual, the PC console is similar +# to a z19. The differences seem to be (1) 25 lines, (2) no status +# line, (3) standout is broken, (4) ins/del line is broken, (5) +# has blinking and bold. +pc-coherent|pcz19|coherent|IBM PC console running Coherent, + am, mir, + cols#80, it#8, lines#25, + bel=^G, clear=\EE, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EN, + ed=\EJ, el=\EK, home=\EH, ht=^I, ind=^J, kbs=^H, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\EH, ri=\EI, rmir=\EO, + rmso=\Eq, sgr0=\Eq, smir=\E@, smso=\Ep, + +# According to the Venix 1.1 manual, the PC console is similar +# to a DEC vt52. Differences seem to be (1) arrow keys send +# different strings, (2) enhanced standout, (3) added insert/delete line. +# Note in particular that it doesn't have automatic margins. +# There are other keys (f1-f10, kpp, knp, kcbt, kich1, kdch1) but they +# not described here because this derives from an old termcap entry. +pc-venix|venix|IBM PC console running Venix, + cols#80, it#8, lines#25, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dl1=\EM, + ed=\EJ, el=\EK, ht=^I, il1=\EL, ind=^J, kbs=^H, kcub1=\EK, + kcud1=\EP, kcuf1=\EM, kcuu1=\EH, khome=\EG, ri=\EI, + +#### Miscellaneous microcomputer consoles +# +# If you know anything more about any of these, please tell me. +# + +# basis from Peter Harrison, Computer Graphics Lab, San Francisco +# ucbvax!ucsfmis!harrison ...uucp / ucbvax!ucsfmis!harrison@BERKELEY ...ARPA +# (basis: removed obsolete ":ma=^K^P^R^L^L :nl=5000*^J:" -- esr) +basis|BASIS108 computer with terminal translation table active, + clear=\E*$<300/>, cud1=\n$<5000/>, ed=\EY, el=\ET, kbs=^H, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, rmso=\E), sgr0=\E), + smso=\E(, + use=adm3a, +# luna's BMC terminal emulator +luna|luna68k|LUNA68K Bitmap console, + cols#88, lines#46, use=ansi-mini, +megatek|pegasus workstation terminal emulator, + am, os, + cols#83, lines#60, +# The Xerox 820 was a Z80 micro with a snazzy XEROX PARC-derived +# interface (pre-Macintosh by several years) that went nowhere. +xerox820|x820|Xerox 820, + am, + cols#80, lines#24, + bel=^G, clear=1^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=^Q, el=^X, + home=^^, ind=^J, + +#### Videotex and teletext +# + +# standard-issue France Telecom minitel terminal (made by Philips) +# (m2-nam: had unknown :zd=\E[1m:zb=\E[5m:zc=lkmjqxtuwvn:; also deleted +# unnecessary :ug#0:sg#0: and added to quiet tic. -- esr) +m2-nam|minitel|minitel-2|minitel-2-nam|France Telecom Minitel, + xenl, + cols#80, it#8, lines#24, + acsc=, clear=\E[H\E[J, cub1=^H, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, il1=\E[L, ind=^J, ip=$<7/>, + is2=\E[1;24r\E[24;1H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + khome=\E[H, ri=\EM, rmacs=\E(B, rmir=\E[4l, rmso=\E[m, + rmul=\E[m, sgr0=\E[m, smacs=\E(0, smir=\E[4h, smso=\E[7m, + smul=\E[4m, + +######## OBSOLETE VDT TYPES +# +# These terminals are *long* dead -- these entries are retained for +# historical interest only. + +#### Amtek Business Machines +# + +# (abm80: early versions of this entry apparently had ":se=\E^_:so=\E^Y", +# but these caps were commented out in 8.3; also, removed overridden +# ":do=^J:" -- esr) +abm80|amtek business machines 80, + am, bw, + cols#80, lines#24, + cbt=^T, clear=\E^\, cub1=^H, cud1=\E^K, cuf1=^P, + cup=\E\021%p2%{32}%+%c%p1%{32}%+%c, cuu1=\E^L, + dl1=\E^S, ed=\E^X, el=\E^O, home=\E^R, il1=\E^Z, + +#### Bell Labs blit terminals +# +# These were AT&T's official entries. The 5620 FAQ maintained by +# David Breneman has this to say: +# +# Actually, in the beginning was the Jerq, and the Jerq was white with a +# green face, and Locanthi and Pike looked upon the Jerq and said the Jerq +# was good. But lo, upon the horizon loomed a mighty management-type person +# (known now only by the initials VP) who said, the mighty Jerq must stay +# alone, and could not go forth into the world. So Locanthi and Pike put the +# Jerq to sleep, cloned its parts, and the Blit was brought forth unto the +# world. And the Jerq lived the rest of its days in research, but never +# strayed from those paths. +# +# In all seriousness, the Blit was originally known as the Jerq, but when +# it started to be shown outside of the halls of the Bell Labs Research +# organization, the management powers that be decided that the name could +# not remain. So it was renamed to be Blit. This was in late 1981. +# +# (The AT&T 5620 was the commercialized Blit. Its successors were the 630, +# 730, and 730+.) +# + +blit|jerq|blit running teletype rom, + am, eo, ul, xon, + cols#87, it#8, lines#72, + bel=^G, clear=^L, cr=^M, cub1=\ED, cud1=^J, cuf1=\EC, + cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, + dch=\Ee%p1%{32}%+%c, dch1=\Ee!, dl=\EE%p1%{32}%+%c, + dl1=\EE!, el=\EK, ht=^I, ich=\Ef%p1%{32}%+%c, ich1=\Ef!, + il=\EF%p1%{32}%+%c, il1=\EF!, ind=^J, kbs=^H, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf1=\Ex, kf2=\Ey, kf3=\Ez, + +# (cbblit: here's a BSD termcap that says -- esr) +cbblit|fixterm|blit running columbus code, + cols#88, + ed=\EJ, flash=\E^G, ich1@, mc4=^T, mc5=^R, mc5p=\EP%p1%03d, + rmir=\ER, rmso=\EV!, rmul=\EV", smir=\EQ, smso=\EU!, + smul=\EU", + use=blit, + +oblit|ojerq|first version of blit rom, + am, da, db, eo, mir, ul, xon, + cols#88, it#8, lines#72, + bel=^G, clear=^L, cr=^M, cub1=\ED, cud1=^J, cuf1=\EC, + cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, dch1=\EO, + dl=\Ee%p1%{32}%+%c, dl1=\EE, ed=\EJ, el=\EK, flash=\E^G, + ht=^I, il=\Ef%p1%{32}%+%c, il1=\EF, ind=^J, kbs=^H, rmir=\ER, + smir=\EQ, + +#### Bolt, Beranek & Newman (bbn) +# +# The BitGraph was a product of the now-defunct BBN Computer Corporation. +# The parent company, best known as the architects of the Internet, is +# still around. +# + +# Entries for the BitGraph terminals. The problem +# with scrolling in vi can only be fixed by getting BBN to put +# smarter scroll logic in the terminal or changing vi or padding +# scrolls with about 500 ms delay. +# +# I always thought the problem was related to the terminal +# counting newlines in its input buffer before scrolling and +# then moving the screen that much. Then vi comes along and +# paints lines in on the bottom line of the screen, so you get +# this big white gap. + +bitgraph|bg2.0nv|bg3.10nv|bbn bitgraph 2.0 or later (normal video), + flash=\E[?5h$<200/>\E[?5l, is2=\E>\E[?5l\E[?7h, + use=bg2.0, +bg2.0rv|bg3.10rv|bbn bitgraph 2.0 (reverse video), + flash=\E[?5l$<200/>\E[?5h, is2=\E>\E[?5h\E[?7h, + use=bg2.0, +bg2.0|bg3.10|bbn bitgraph 2.0 or later (no init), + xenl, + cols#85, lines#64, + bel=^G, clear=\E[H\E[J$<150>, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=%i\E[%p1%d;%p2%dH, cuu1=\E[A, dl1=\E[M$<2*>, + ed=\E[J$<150>, el=\E[K$<2>, ht=^I, il1=\E[L$<2*>, + ind=\n$<280>, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, lf1=PF1, + lf2=PF2, lf3=PF3, lf4=PF4, rc=\E8, rmkx=\E>, rmso=\E[m, sc=\E7, + sgr0=\E[m, smkx=\E=, smso=\E[7m, + +bg1.25rv|bbn bitgraph 1.25 (reverse video), + flash=\E[?5l$<200/>\E[?5h, is2=\E>\E[?5h\E[?7h, use=bg1.25, +bg1.25nv|bbn bitgraph 1.25 (normal video), + flash=\E[?5h$<200/>\E[?5l, is2=\E>\E[?5l\E[?7h, use=bg1.25, +# (bg1.25: I added / based on the init string -- esr) +bg1.25|bbn bitgraph 1.25, + cols#85, lines#64, + bel=^G, clear=\E[H\E[J$<150>, cr=^M, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=%i\E[%p1%d;%p2%dH, cuu1=\E[A, + dl1=\E[M$<2*>, ed=\E[J$<150>, el=\E[K$<2>, ht=^I, + il1=\E[L$<2*>, ind=\n$<280>, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, kf1=\EP, kf2=\EQ, kf3=\ER, kf4=\ES, + lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, ll=\E[64;1H, rmam=\E[?7l, + rmkx=\E>, rmso=\E[m, sgr0=\E[m, smam=\E[?7h, smkx=\E=, + smso=\E[7m, + +#### Chromatics +# + +# I have put the long strings in /. Ti sets up a window +# that is smaller than the screen, and puts up a warning message +# outside the window. Te erases the warning message, puts the +# window back to be the whole screen, and puts the cursor at just +# below the small window. I defined and to really turn +# the cursor on and off, but I have taken this out since I don't +# like the cursor being turned off when vi exits. +cg7900|chromatics|chromatics 7900, + am, + cols#80, lines#40, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^], + cup=\001M%p2%d\,%p1%d\,, cuu1=^K, dch1=^A<1, dl1=^A<2, + ed=^Al, el=^A`, home=^\, ich1=^A>1, il1=^A>2, ind=^J, ll=^A|, + rmcup=\001W0\,40\,85\,48\,\014\001W0\,0\,85\,48\,\001M0\,40\,, + rmso=\001C1\,\001c2\,, + smcup=\001P0\001O1\001R1\001C4\,\001c0\,\014\001M0\,42\,WARNING DOUBLE ENTER ESCAPE and \025\001C1\,\001c2\,\001W0\,0\,79\,39\,, + smso=\001C4\,\001c7\,, uc=\001\001_\001\200, + +#### Computer Automation +# + +ca22851|computer automation 22851, + am, + cols#80, lines#24, + bel=^G, clear=\014$<8>, cr=^M, cub1=^U, cud1=^J, cuf1=^I, + cup=\002%i%p1%c%p2%c, cuu1=^V, ed=^\, el=^], home=^^, ind=^J, + kcub1=^U, kcud1=^W, kcuu1=^V, khome=^^, + +#### Cybernex +# + +# This entry has correct padding and the undocumented "ri" capability +cyb83|xl83|cybernex xl-83, + am, + cols#80, lines#24, + bel=^G, clear=\014$<62>, cr=^M, cub1=^H, cud1=^J, cuf1=^I, + cup=\027%p1%{32}%+%c%p2%{32}%+%c, cuu1=^N, + ed=\020$<62>, el=\017$<3>, home=^K, ind=^J, kcub1=^H, + kcud1=^J, kcuf1=^I, kcuu1=^N, ri=^N, +# (mdl110: removed obsolete ":ma=^Z^P:" and overridden ":cd=145^NA^W:" -- esr) +cyb110|mdl110|cybernex mdl-110, + am, + cols#80, lines#24, + bel=^G, clear=\030$<70>, cr=^M, cub1=^H, cud1=^J, cuf1=^U, + cup=\020%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, + dch1=\016A\036$<3.5>, dl1=\016A\016\036$<40>, + ed=\016@\026$<6>, el=\016@\026$<145>, home=^Y, + ht=\011$<43>, ich1=\016A\035$<3.5>, + il1=\016A\016\035$<65>, ind=^J, rmso=^NG, smso=^NF, + +#### Datapoint +# +# Datapoint is gone. They used to be headquartered in Texas. +# They created ARCnet, an Ethernet competitor that flourished for a while +# in the early 1980s before 3COM got wise and cut its prices. The service +# side of Datapoint still lives (1995) in the form of Intelogic Trace. +# + +dp3360|datapoint|datapoint 3360, + am, + cols#82, lines#25, + bel=^G, clear=^]^_, cr=^M, cub1=^H, cud1=^J, cuf1=^X, cuu1=^Z, + ed=^_, el=^^, home=^], ind=^J, + +#### DEC terminals (Obsolete types: DECwriter and vt40/42/50) +# +# These entries are DEC's official terminfos for its older terminals. +# Contact Bill Hedberg of Terminal Support +# Engineering for more information. Updated terminfos and termcaps +# are kept available at ftp://gatekeeper.dec.com/pub/DEC/termcaps. +# + +gt40|dec gt40, + os, + cols#72, lines#30, + bel=^G, cr=^M, cub1=^H, cud1=^J, +gt42|dec gt42, + os, + cols#72, lines#40, + bel=^G, cr=^M, cub1=^H, cud1=^J, +vt50|dec vt50, + cols#80, lines#12, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cuu1=\EA, ed=\EJ, el=\EK, ht=^I, ind=^J, +vt50h|dec vt50h, + cols#80, lines#12, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EK, ht=^I, ind=^J, ri=\EI, +# (vt61: there's a BSD termcap that claims , ) +vt61|vt-61|vt61.5|dec vt61, + cols#80, lines#24, + bel=^G, clear=\EH\EJ$<120>, cr=\r$<20>, cub1=^H, cud1=^J, + cuf1=\EC$<20>, cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<20>, + cuu1=\EA$<20>, ed=\EJ$<120>, el=\EK$<70>, ht=^I, + ind=\n$<20>, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + ri=\E$<20>I, + +# The gigi does standout with red! +# (gigi: I added / based on the init string, corrected cub1 -- esr) +gigi|vk100|dec gigi graphics terminal, + am, xenl, + cols#84, lines#24, + bel=^G, clear=\E[H\E[2J, cr=^M, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, ed=\E[J, + el=\E[K, ht=^I, ind=^J, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?20l\E[?7h\E[?8h, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, ri=\EM, + rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7;31m, + smul=\E[4m, + +# DEC PRO-350 console (VT220-style). The 350 was DEC's attempt to produce +# a PC differentiated from the IBM clones. It was a total, ludicrous, +# grossly-overpriced failure (among other things, DEC's OS didn't include +# a format program, so you had to buy pre-formatted floppies from DEC at +# a hefty premium!). +pro350|decpro|dec pro console, + cols#80, it#8, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + clear=\EH\EJ, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EK, home=\EH, ht=^I, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kf0=\EE, kf1=\EF, kf2=\EG, kf3=\EH, kf4=\EI, + kf5=\EJ, kf6=\Ei, kf7=\Ej, khome=\EH, ri=\EI, rmacs=\EG, + rmso=\E^N, rmul=\E^C, smacs=\EF, smso=\E^H, smul=\E^D, + +dw1|decwriter I, + hc, os, + cols#72, + bel=^G, cr=^M, cub1=^H, cud1=^J, ind=^J, +dw2|decwriter|dw|decwriter II, + hc, os, + cols#132, + bel=^G, cr=^M, cub1=^H, cud1=^J, ind=^J, kbs=^H, + +# \E(B Use U.S. character set (otherwise # => british pound !) +# \E[20l Disable "linefeed newline" mode (else puts \r after \n,\f,\v) +# \E[w 10 char/in pitch +# \E[1;132 full width horizontal margins +# \E[2g clear all tab stops +# \E[z 6 lines/in +# \E[66t 66 lines/page (for \f) +# \E[1;66r full vertical page can be printed +# \E[4g clear vertical tab stops +# \E> disable alternate keypad mode (so it transmits numbers!) +# \E[%i%p1%du set tab stop at column %d (origin == 1) +# (Full syntax is \E[n;n;n;n;n;...;nu where each 'n' is +# a tab stop) +# +# The dw3 does standout with wide characters. +# +dw3|la120|decwriter III, + hc, os, + cols#132, + bel=^G, cr=^M, cub1=^H, cud1=^J, ht=^I, ind=^J, + is1=\E(B\E[20l\E[w\E[0;132s\E[2g\E[z\E[66t\E[1;66r\E[4g\E>, + is2=\E[9;17;25;33;41;49;57;65;73;81;89;97;105;113;121;129u\r, + kbs=^H, rmso=\E[w, sgr0=\E[w, smso=\E[6w, +dw4|decwriter IV, + am, hc, os, + cols#132, + bel=^G, cr=^M, cub1=^H, cud1=^J, ht=^I, ind=^J, is2=\Ec, kbs=^H, + kf0=\EOP, kf1=\EOQ, kf2=\EOR, kf3=\EOS, + +# These aren't official +ln03|dec ln03 laser printer, + hc, + cols#80, lines#66, + bel=^G, cr=^M, cud1=^J, hd=\EK, ht=^I, hu=\EL, ind=^J, nel=^M^J, + rmso=\E[22m, rmul=\E[24m, sgr0=\E[m, smso=\E[1m, + smul=\E[4m, +ln03-w|dec ln03 laser printer 132 cols, + cols#132, + bel=^G, cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, + kcud1=^J, nel=^M^J, + use=ln03, + +#### Delta Data (dd) +# + +# Untested. The cup sequence is hairy enough that it probably needs work. +# The idea is ctrl(O), dd(row), dd(col), where dd(x) is x - 2*(x%16) + '9'. +# There are BSD-derived termcap entries floating around for this puppy +# that are *certainly* wrong. +delta|dd5000|delta data 5000, + am, + cols#80, lines#27, + bel=^G, clear=^NR, cub1=^H, cud1=^J, cuf1=^Y, + cup=\017%p1%p1%{16}%m%{2}%*%-%'9'%+%c%p2%p2%{16}%m%{2}%*%-%'9'%+%c, + cuu1=^Z, dch1=^NV, el=^NU, home=^NQ, ind=^J, + +#### Digital Data Research (ddr) +# + +# (ddr: I added / based on the init string -- esr) +ddr|rebus3180|ddr3180|Rebus/DDR 3180 vt100 emulator, + am, xenl, + cols#80, it#8, lines#24, vt#3, + blink=\E[5m$<2/>, bold=\E[1m$<2/>, + clear=\E[H\E[2J$<50/>, csr=\E[%i%p1%d;%p2%dr, cub1=^H, + cud1=^J, cuf1=\E[C$<2/>, cup=\E[%i%p1%d;%p2%dH$<5/>, + cuu1=\E[A$<2/>, ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, + ht=^I, ind=\ED$<5/>, is2=\E[1;24r\E[24;1H, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, rc=\E8, rev=\E[7m$<2/>, + rf=/usr/share/tabset/vt100, ri=\EM$<5/>, rmam=\E[7l, + rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m$<2/>, + rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr0=\E[m$<2/>, smam=\E[7l, smkx=\E[?1h\E=, smso=\E[7m, + smul=\E[4m$<2/>, + +#### Evans & Sutherland +# + +# Jon Leech tells us: +# The ps300 was the Evans & Sutherland Picture System 300, a high +# performance 3D vector graphics system with a bunch of specialized hardware. +# Approximate date of release was 1982 (early 80s, anyway), and it had several +# evolutions including (limited) color versions such as the PS330C. PS300s +# were effectively obsolete by the late 80s, replaced by raster graphics +# systems, although specialized applications like molecular modelling +# hung onto them for a while longer. AFAIK all E&S vector graphics systems +# are out of production, though of course E&S is very much alive (in 1996). +# (ps300: changed ":pt@:" to "it@" -- esr) +# +ps300|Picture System 300, + xt, + it@, + rmso@, rmul@, smso@, smul@, use=vt100, + +#### General Electric (ge) +# + +terminet1200|terminet300|tn1200|tn300|terminet|GE terminet 1200, + hc, os, + cols#120, + bel=^G, cr=^M, cud1=^J, ind=^J, + +#### Heathkit/Zenith +# + +# Here is a description of the H19 DIP switches: +# +# S401 +# 0-3 = baud rate as follows: +# +# 3 2 1 0 +# --- --- --- --- +# 0 0 1 1 300 baud +# 0 1 0 1 1200 baud +# 1 0 0 0 2400 baud +# 1 0 1 0 4800 baud +# 1 1 0 0 9600 baud +# 1 1 0 1 19.2K baud +# +# 4 = parity (0 = no parity) +# 5 = even parity (0 = odd parity) +# 6 = stick parity (0 = normal parity) +# 7 = full duplex (0 = half duplex) +# +# S402 +# 0 = block cursor (0 = underscore cursor) +# 1 = no key click (0 = keyclick) +# 2 = wrap at end of line (0 = no wrap) +# 3 = auto LF on CR (0 = no LF on CR) +# 4 = auto CR on LF (0 = no CR on LF) +# 5 = ANSI mode (0 = VT52 mode) +# 6 = keypad shifted (0 = keypad unshifted) +# 7 = 50Hz refresh (1 = 60Hz refresh) +# +# Factory Default settings are as follows: +# 7 6 5 4 3 2 1 0 +# S401 1 0 0 0 1 1 0 0 +# S402 0 0 0 0 0 0 0 0 +# (h19: I added / based on the init string; +# also added empty to suppress a tic warning -- esr) +h19-a|h19a|heath-ansi|heathkit-a|heathkit h19 ansi mode, + am, mir, msgr, + cols#80, it#8, lines#24, + acsc=, bel=^G, clear=\E[2J, cnorm=\E[>4l, cr=^M, cub1=^H, + cud1=\E[1B, cuf1=\E[1C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[1A, cvvis=\E[>4h, dch1=\E[1P, dl1=\E[1M$<1*>, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, il1=\E[1L$<1*>, ind=^J, + is2=\E<\E[>1;2;3;4;5;6;7;8;9l\E[m\E[11m\E[?7h, + kbs=^H, kcub1=\E[1D, kcud1=\E[1B, kcuf1=\E[1C, kcuu1=\E[1A, + kf1=\EOS, kf2=\EOT, kf3=\EOU, kf4=\EOV, kf5=\EOW, kf6=\EOP, + kf7=\EOQ, kf8=\EOR, khome=\E[H, lf6=blue, lf7=red, lf8=white, + ri=\EM, rmacs=\E[11m, rmam=\E[?7l, rmir=\E[4l, rmso=\E[m, + smacs=\E[10m, smam=\E[?7h, smir=\E[4h, smso=\E[7m, +h19-bs|heathkit w/keypad shifted, + rmkx=\Eu, smkx=\Et, use=h19-b, +h19-smul|heathkit w/keypad shifted/underscore cursor, + rmkx=\Eu, smkx=\Et, + use=h19-u, +# (h19: merged in from BSDI hp19-e entry>; +# also added empty to suppress a tic warning --esr) +h19|heath|h19-b|heathkit|heath-19|z19|zenith|heathkit h19, + am, eslok, hs, mir, msgr, + cols#80, it#8, lines#24, + acsc=, bel=^G, clear=\EE, cnorm=\Ey4, cr=^M, cub1=^H, cud1=\EB, + cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, + cvvis=\Ex4, dch1=\EN, dl1=\EM$<1*>, ed=\EJ, el=\EK, + fsl=\Ek\Ey5, home=\EH, ht=^I, il1=\EL$<1*>, ind=^J, + ip=<1.5/>, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kf1=\ES, kf2=\ET, kf3=\EU, kf4=\EV, kf5=\EW, + kf6=\EP, kf7=\EQ, kf8=\ER, khome=\EH, lf6=blue, lf7=red, + lf8=white, ri=\EI, rmacs=\EG, rmir=\EO, rmso=\Eq, smacs=\EF, + smir=\E@, smso=\Ep, tsl=\Ej\Ex5\EY8%p1%{32}%+%c\Eo\Eo, +h19-u|heathkit with underscore cursor, + cnorm@, cvvis@, use=h19-b, +h19-us|h19us|heathkit w/keypad shifted/underscore cursor, + rmkx=\Eu, smkx=\Et, + use=h19-u, +h19-g|h19g|heathkit w/block cursor, + cnorm=\Ex4, use=h19-b, +alto-h19|altoh19|altoheath|alto-heath|alto emulating heathkit h19, + lines#60, + dl1=\EM, il1=\EL, use=h19, + +# The major problem with the Z29 is that it requires more padding than the Z19. +# +# The problem with declaring an H19 to be synonymous with a Z29 is that +# it needs more padding. It especially loses if a program attempts +# to put the Z29 into insert mode and insert text at 9600 baud. It +# even loses worse if the program attempts to insert tabs at 9600 +# baud. Adding padding to text that is inserted loses because in +# order to make the Z29 not die, one must add so much padding that +# whenever the program tries to use insert mode, the effective +# rate is about 110 baud. +# +# What program would want to put the terminal into insert mode +# and shove stuff at it at 9600 baud you ask? +# +# Emacs. Emacs seems to want to do the mathematically optimal +# thing in doing a redisplay rather than the practical thing. +# When it is about to output a line on top of a line that is +# already on the screen, instead of just killing to the end of +# the line and outputting the new line, it compares the old line +# and the new line and if there are any similarities, it +# constructs the new line by deleting the text on the old line +# on the terminal that is already there and then inserting new +# text into the line to transform it into the new line that is +# to be displayed. The Z29 does not react kindly to this. +# +# But don't cry for too long.... There is a solution. You can make +# a termcap entry for the Z29 that says the Z29 has no insert mode. +# Then Emacs cannot use it. "Oh, no, but now inserting into a +# line will be really slow", you say. Well there is a sort of a +# solution to that too. There is an insert character option on +# the Z29 that will insert one character. Unfortunately, it +# involves putting the terminal into ansi mode, inserting the +# character, and changing it back to H19 mode. All this takes 12 +# characters. Pretty expensive to insert one character, but it +# works. Either Emacs doesn't try to use its inserting hack when +# it's only given an insert character ability or the Z29 doesn't +# require padding with this (the former is probably more likely, +# but I haven't checked it out). +# (z29: added empty to suppress a tic warning, merged in +# status line capabilities from BRL entry --esr) +z29|zenith29|z29b|zenith z29b, + am, eslok, hs, mir, msgr, + cols#80, lines#24, + acsc=, bel=^G, cbt=\E-, clear=\EE$<14>, cnorm=\Ey4, cr=^M, + cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\E$<1>A, + cvvis=\Ex4, dch1=\EN$<0.1*>, dl1=\EM$<1/>, dsl=\Ey1, + ed=\EJ$<14>, el=\EK$<1>, fsl=\Ek\Ey5, home=\EH, ht=^I, + ich1=\E<\E[1@\E[?2h$<1>, il1=\EL$<1/>, ind=\n$<2>, + is2=\E<\E[?2h\Ev, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kf0=\E~, kf1=\ES, kf2=\ET, kf3=\EU, kf4=\EV, + kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, kf9=\E0I, khome=\EH, + lf0=home, ri=\EI$<2/>, rmacs=\EF, rmir=\EO, rmso=\Eq, + rmul=\Es0, smacs=\EG, smir=\E@, smso=\Ep, smul=\Es8, + tsl=\Ej\Ex5\Ex1\EY8%+ \Eo, +# z29 in ansi mode. Assumes that the cursor is in the correct state, and that +# the world is stable. causes the terminal to be reset to the state +# indicated by the name. kc -> key click, nkc -> no key click, uc -> underscore +# cursor, bc -> block cursor. +# From: Mike Meyers +# (z29a: replaced nonexistent befause +# looks vt100-compatible -- esr) +z29a|z29a-kc-bc|h29a-kc-bc|heath/zenith 29 in ansi mode, + am, eslok, hs, mir, msgr, + cols#80, it#8, lines#24, + bel=^G, blink=\E[5m, bold=\E[2m, clear=\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[1P, dim=\E[2m, dl=\E[%p1%dM, + dsl=\E[>1l, ed=\E[J, el=\E[K, fsl=\E[u\E[>5l, home=\E[H, + ht=^I, hts=\EH, if=/usr/share/tabset/vt100, il=\E[%p1%dL, + ind=\ED, kbs=^H, kclr=\E[J, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, ked=\E[J, kf0=\E[~, kf1=\EOS, + kf2=\EOT, kf3=\EOU, kf4=\EOV, kf5=\EOW, kf6=\EOP, kf7=\EOQ, + kf8=\EOR, kf9=\EOX, khome=\E[H, lf0=help, mc0=\E#7, + nel=^M\ED, rc=\E[r, rev=\E[7m, ri=\EM, rmcup=\E[?7h, + rmso=\E[m, rmul=\E[m, + rs1=\E<\E[1;24r\E[24;1H\E[?7h\E[>4h\E[>1;2;3;5;6;7;8;9l\E[m\E[11m, + sc=\E[s, sgr0=\E[m, smcup=\E[?7l, smso=\E[7;2m, smul=\E[4m, + tbc=\E[3g, tsl=\E[s\E[>5;1h\E[25;%i%dH\E[1K, +z29a-kc-uc|h29a-kc-uc|z29 ansi mode with keyckick and underscore cursor, + rs1=\E<\E[1;24r\E[24;1H\E[?7h\E[>1;2;3;4;5;6;7;8;9l\E[m\E[11m, + use=z29a, +z29a-nkc-bc|h29a-nkc-bc|z29 ansi mode with block cursor and no keyclick, + rs1=\E<\E[1;24r\E[24;1H\E[?7h\E[>2;4h\E[>1;3;5;6;7;8;9l\E[m\E[11m, + use=z29a, +z29a-nkc-uc|h29a-nkc-uc|z29 ansi mode with underscore cursor and no keyclick, + rs1=\E<\E[1;24r\E[24;1H\E[?7h\E[>2h\E[>1;3;4;5;6;7;8;9l\E[m\E[11m, + use=z29a, +# From: Jeff Bartig 31 Mar 1995 +z39-a|z39a|zenith39-a|zenith39-ansi|Zenith 39 in ANSI mode, + am, eslok, hs, mc5i, mir, msgr, xon, + cols#80, lines#24, + acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~0a, bel=^G, + blink=\E[5m, bold=\E[1m, cbt=\E[1Z, civis=\E[>5h, + clear=\E[2J\E[H, cnorm=\E[>5l, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[1P, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[1M, dsl=\E[>1l, ed=\E[0J, el=\E[0K, el1=\E[1K, + fsl=\E[u, home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[1L, + ind=^J, is2=\E<\E[>1;3;5;6;7l\E[0m\E[2J, ka1=\EOw, + ka3=\EOu, kb2=\EOy, kbs=^H, kc1=\EOq, kc3=\EOs, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, ked=\E[J, kf1=\EOS, + kf2=\EOT, kf3=\EOU, kf4=\EOV, kf5=\EOW, kf6=\EOP, kf7=\EOQ, + kf8=\EOR, kf9=\EOX, khlp=\E[~, khome=\E[H, ll=\E[24;1H, + mc0=\E[?19h\E[i, mc4=\E[4i, mc5=\E[5i, rc=\E[u, rev=\E[7m, + rmacs=\E(B, rmir=\E[4l, rmkx=\E[>7l, rmso=\E[0m, + rmul=\E[0m, rs2=\E<\Ec\200, sc=\E[s, sgr0=\E[0m, + smacs=\E(0, smir=\E[4h, smkx=\E[>7h, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, tsl=\E[s\E[>1h\E[25;%i%p1%dH, + +# From: Brad Brahms +z100|h100|z110|z-100|h-100|heath/zenith z-100 pc with color monitor, + cnorm=\Ey4\Em70, cvvis=\Ex4\Em71, + use=z100bw, +# (z100bw: removed obsolete ":kn#10:", added empty -- esr) +z100bw|h100bw|z110bw|z-100bw|h-100bw|heath/zenith z-100 pc, + mir, msgr, + cols#80, it#8, lines#24, + acsc=, clear=\EE$<5*/>, cnorm=\Ey4, cub1=^H, cud1=\EB, + cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<1*/>, + cuu1=\EA, cvvis=\Ex4, dch1=\EN$<1*/>, dl1=\EM$<5*/>, + ed=\EJ, el=\EK, home=\EH, ht=^I, il1=\EL$<5*/>, kbs=^H, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf0=\EJ, kf1=\ES, + kf2=\ET, kf3=\EU, kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, + kf9=\EOI, khome=\EH, ri=\EI, rmacs=\EG, rmir=\EO, rmso=\Eq, + smacs=\EF, smir=\E@, smso=\Ep, +p19|h19-b with il1/dl1, + dl1=\EM$<2*/>, il1=\EL$<2*/>, use=h19-b, +# From: +# (ztx: removed duplicate :sr: -- esr) +ztx|ztx11|zt-1|htx11|ztx-1-a|ztx-10 or 11, + am, eslok, hs, + cols#80, it#8, lines#24, + clear=\EE, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dl1=\EM, + dsl=\Ey1, ed=\EJ, el=\EK, fsl=\Ek\Ey5, home=\EH, ht=^I, + il1=\EL, is2=\Ej\EH\Eq\Ek\Ev\Ey1\Ey5\EG\Ey8\Ey9\Ey>, + kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf0=\ES, + kf1=\EB, kf2=\EU, kf3=\EV, kf4=\EW, kf5=\EP, kf6=\EQ, kf7=\ER, + ri=\EI, rmso=\Eq, rmul=\Eq, smso=\Es5, smul=\Es2, + tsl=\Ej\Ex5\Ex1\EY8%+ \Eo, + +#### IMS International (ims) +# +# There was a company called IMS International located in Carson City, +# Nevada, that flourished from the mid-70s to mid-80s. They made S-100 +# bus/Z80 hardware and a line of terminals called Ultimas. +# + +# From: Erik Fair Sun Oct 27 07:21:05 1985 +ims950-b|bare ims950 no init string, + is2@, use=ims950, +# (ims950: removed obsolete ":ko@:" -- esr) +ims950|ims televideo 950 emulation, + xenl@, + flash@, kbs@, kcub1@, kcud1@, kcuf1@, kcuu1@, kf0@, kf1@, kf2@, kf3@, + kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, khome@, + use=tvi950, +# (ims950-rv: removed obsolete ":ko@:" -- esr) +ims950-rv|ims tvi950 rev video, + xenl@, + flash@, kbs@, kcub1@, kcud1@, kcuf1@, kcuu1@, kf0@, kf1@, kf2@, kf3@, + kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, khome@, + use=tvi950-rv, +ims-ansi|ultima2|ultimaII|IMS Ultima II, + am, + cols#80, it#8, lines#24, + clear=\E[H\E[2J, cub1=^H, cud1=\ED, + cup=\E[%i%p1%2d;%p2%2dH, cuu1=\EM, ed=\E[0J, el=\E[0K, + ht=^I, if=/usr/share/tabset/vt100, + is2=\E[m\E[>14l\E[?1;?5;20l\E>\E[1m\r, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, ri=\EM, + rmso=\E[m\E[1m, rmul=\E[m\E[1m, sgr0=\E[m, smso=\E[7m, + smul=\E[4m, + +#### Intertec Data Systems +# +# I think this company is long dead as of 1995. They made an early CP/M +# micro called the "Intertec Superbrain" that was moderately popular, +# then sank out of sight. +# + +superbrain|intertec superbrain, + am, bw, + cols#80, lines#24, + bel=^G, clear=\014$<5*>, cr=^M, cub1=^H, cud1=^J, cuf1=^F, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<20>, cuu1=^K, + ed=\E~k<10*>, el=\E~K$<15>, ht=^I, ind=^J, kcub1=^U, + kcud1=^J, kcuf1=^F, kcuu1=^K, rmcup=^L, smcup=^L, +# (intertube: a Gould entry via BRL asserted smul=\E0@$<200/>, +# rmul=\E0A$<200/>; my guess is the highlight letter is bit-coded like an ADM, +# and the reverse is actually true. Try it. -- esr) +intertube|intertec|Intertec InterTube, + am, + cols#80, lines#25, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^F, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<50>, cuu1=^Z, home=^A, + ind=^J, rmso=\E0@, smso=\E0P, +# The intertube 2 has the "full duplex" problem like the tek 4025: if you +# are typing and a command comes in, the keystrokes you type get interspersed +# with the command and it messes up +intertube2|intertec data systems intertube 2, + cup=\016%p1%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%c, + el=\EK, hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%c, + ll=^K^X\r, vpa=\013%p1%c, + use=intertube, + +#### Ithaca Intersystems +# +# This company made S100-bus personal computers long ago in the pre-IBM-PC +# past. They used to be reachable at: +# +# Ithaca Intersystems +# 1650 Hanshaw Road +# Ithaca, New York 14850 +# +# However, the outfit went bankrupt years ago. +# + +# The Graphos III was a color graphics terminal from Ithaca Intersystems. +# These entries were written (originally in termcap syntax) by Brian Yandell +# and Mike Meyer at the +# University of Wisconsin. + +# (graphos: removed obsolete and syntactically incorrect :kn=4:, +# removed and +# no such file & no -- esr) +graphos|graphos III, + am, mir, + cols#80, it#8, lines#24, + clear=\E[H\E[2J, cnorm=\Ez56;2;0;0z\Ez73z\Ez4;1;1z, + cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\Ez4;2;1z\Ez56;2;80;24z, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, il=\E[%p1%dL, + il1=\E[L, ind=\ED, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, khome=\E[H, nel=^M\ED, rc=\E8, ri=\EM, rmdc=\E[4l, + rmir=\E[4l, rmso=\E[m, sc=\E7, sgr0=\E[m, smdc=\E[4h, + smir=\E[4h, smso=\E[7m, +graphos-30|graphos III with 30 lines, + lines#30, + cvvis=\Ez4;2;1z\Ez56;2;80;30z, use=graphos, + +#### Modgraph +# +# These people used to be reachable at: +# +# Modgraph, Inc +# 1393 Main Street, +# Waltham, MA 02154 +# Vox: (617)-890-5796. +# +# However, if you call that number today you'll get an insurance company. +# I think Modgraph is long gone. +# + +modgraph|mod24|modgraph terminal emulating vt100, + xenl@, + cols#80, lines#24, + cvvis=\E\^9;0s\E\^7;1s, + is2=\E\^9;0s\E\^7;1s\E[3g\E\^11;9s\E\^11;17s\E\^11;25s\E\^11;33s\E\^11;41s\E\^11;49s\E\^11;57s\E\^11;65s\E\^11;73s\E\^11;81s\E\^11;89s, + rf@, ri=\EM\E[K$<5/>, + use=vt100, +# The GX-1000 manual is dated 1984. This looks rather like a VT-52. +modgraph2|modgraph gx-1000 80x24 with keypad not enabled, + am, da, db, + cols#80, it#8, lines#24, + clear=\EH\EJ$<50/>, cub1=^H, cuf1=\EC$<2/>, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<5/>, cuu1=\EA$<2/>, + ed=\EJ$<50/>, el=\EK$<3/>, ht=^I, + is2=\E<\E\^5;2s\E\^7;1s\E[3g\E\^11;9s\E\^11;17s\E\^11;25s\E\^11;33s\E\^11;41s\E\^11;49s\E\^11;57s\E\^11;65s\E\^11;73s\E\^11;81s\E\^11;89s\E\^12;0s\E\^14;2s\E\^15;9s\E\^25;1s\E\^9;1s\E\^27;1, + ri=\EI$<5/>, +# +# Modgraph from Nancy L. Cider +# BUG NOTE from Barbara E. Ringers : +# If we set TERM=vt100, and set the Modgraph screen to 24 lines, setting a +# mark and using delete-to-killbuffer work correctly. However, we would +# like normal mode of operation to be using a Modgraph with 48 line setting. +# If we set TERM=mod (which is a valid entry in termcap with 48 lines) +# the setting mark and delete-to-killbuffer results in the deletion of only +# the line the mark is set on. +# We've discovered that the delete-to-killbuffer works correctly +# with TERM=mod and screen set to 80x48 but it's not obvious. Only +# the first line disappears but a ctrl-l shows that it did work +# correctly. +modgraph48|mod|Modgraph w/48 lines, + am, xenl, + cols#80, it#8, lines#48, vt#3, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[;H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, + flash=\E[?5h\E[0q\E[1;2q\E[?5l\E[0q\E[4;3q, + home=\E[H, ht=^I, is2=\E<\E[1;48r\E[0q\E[3;4q\E=\E[?1h, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, rc=\E8, rev=\E[7m, + ri=\EM, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs1=\E=\E[0q\E>, sc=\E7, sgr0=\E[m, smkx=\E[?1h\E=, + smso=\E[7m, smul=\E[4m, + +#### Morrow Designs +# +# This was George Morrow's company. They started in the late 1970s making +# S100-bus machines. They used to be reachable at: +# +# Morrow +# 600 McCormick St. +# San Leandro, CA 94577 +# +# but they're long gone now (1995). +# + +# The mt70 terminal was shipped with the Morrow MD-3 microcomputer. +# Jeff's specimen was dated June 1984. +# From: Jeff Wieland 24 Feb 1995 +mt70|mt-70|Morrow MD-70; native Morrow mode, + am, mir, msgr, xon, + cols#80, it#8, lines#24, + acsc=+z\,{.yOi-x`|jGkFlEmDnHtLuKvNwMxIqJ, bel=^G, + cbt=\EI, civis=\E"0, clear=^Z, cnorm=\E"2, cr=^M, cub1=^H, + cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<1>, + cuu1=^K, dch1=\EW, dim=\EG2, dl1=\ER, ed=\EY, el=\ET$<10>, + flash=\EK1$<200>\EK0, home=^^, ht=^I, ich1=\EQ, il1=\EE, + ind=^J, invis@, is1=\E"2\EG0\E], kbs=^H, kcbt=^A^Z\r, + kclr=^An\r, kcub1=^AL\r, kcud1=^AK\r, kcuf1=^AM\r, + kcuu1=^AJ\r, kdch1=\177, kf1=^A@\r, kf10=^AI\r, kf11=^A`\r, + kf12=^Aa\r, kf13=^Ab\r, kf14=^Ac\r, kf15=^Ad\r, kf16=^Ae\r, + kf17=^Af\r, kf18=^Ag\r, kf19=^Ah\r, kf2=^AA\r, kf20=^Ai\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khlp=^AO\r, khome=^AN\r, nel=^_, + rmacs=\E%, rmcup=, smacs=\E$, smcup=\E"2\EG0\E], smul=\EG1, + tbc=\E0, + use=adm+sgr, + +#### Motorola +# + +# Motorola EXORterm 155 from {decvax, ihnp4}!philabs!sbcs!megad!seth via BRL +# (Seth H Zirin) +ex155|Motorola Exorterm 155, + am, bw, + cols#80, lines#24, + cbt=\E[, clear=\EX, cud1=\EB, cuf1=\ED, + cup=\EE%p1%{32}%+%c%p2%{32}%+%c, ed=\ET, el=\EU, + home=\E@, ht=\EZ, kbs=^H, kcbt=\E[, kclr=\EX, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, ked=\ET, kel=\EU, khome=\E@, + rmso=\Ec\ED, rmul=\Eg\ED, smso=\Eb\ED, smul=\Ef\ED, + +#### Omron +# +# This company is still around in 1995, manufacturing point-of-sale systems. + +omron|Omron 8025AG, + am, da, db, + cols#80, lines#24, + bel=^G, clear=\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cuu1=\EA, + cvvis=\EN, dch1=\EP, dl1=\EM, ed=\ER, el=\EK, home=\EH, + il1=\EL, ind=\ES, ri=\ET, rmso=\E4, smso=\Ef, + +#### Ramtek +# +# Ramtek was a vendor of high-end graphics terminals around 1979-1983; they +# were competition for things like the Tektronics 4025. +# + +# Ramtek 6221 from BRL, probably by Doug Gwyn +# The following SET-UP modes are assumed for normal operation: +# UNDERLINE_CURSOR ANSI_MODE AUTO_XON/XOFF_ON +# NEWLINE_OFF 80_COLUMNS +# Other SET-UP modes may be set for operator convenience or communication +# requirements; I recommend +# SMOOTH_SCROLL AUTO_REPEAT_ON 3_#_SHIFTED WRAP_AROUND_ON +# Hardware tabs are assumed to be every 8 columns; they can be set up by the +# "reset", "tset", or "tabs" utilities (use rt6221-w, 160 columns, for this). +# Note that the Control-E key is useless on this brain-damaged terminal. No +# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! +rt6221|Ramtek 6221, 80x24, + msgr, xon, + cols#80, it#8, lines#24, vt#3, + acsc=, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[>5l, + clear=\E[1;1H\E[J, cnorm=\E[>5h\E[>9h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^K, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, + cvvis=\E[>7h\E[>9l, ed=\E[J, el=\E[K, home=\E[1;1H, ht=^I, + hts=\EH, ind=^J, is2=\E)0, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kf0=\EOP, kf1=\EOQ, kf2=\EOR, + kf3=\EOS, lf0=PF1, lf1=PF2, lf2=PF3, lf3=PF4, ll=\E[24;1H, + nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmkx=\E>, + rmso=\E[m, rmul=\E[m, + rs1=\E[1w\E[>37m\E[>39m\E[1v\E[20l\E[?3l\E[?6l\E[>5h\E[>6h\E[>7h\E[>8l\E[>9h\E[>10l\E[1;24r\E[m\E[q\E(B\017\E)0\E#5\E>, + sc=\E7, sgr0=\E[m, smacs=^N, smkx=\E=, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, +# [TO DO: Check out: short forms of ho/cl and ll; reset (\Ec)]. +rt6221-w|Ramtek 6221, 160x48, + cols#160, lines#48, + ll=\E[48;1H, use=rt6221, + +#### RCA +# + +# RCA VP3301 or VP3501 +rca|rca vp3301/vp3501, + cols#40, lines#24, + clear=^L, cuf1=^U, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=^K, home=^Z, rmso=\E\ES0, smso=\E\ES1, + + +#### Selanar +# + +# Selanar HiREZ-100 from BRL, probably by Doug Gwyn +# The following SET-UP modes are assumed for normal operation: +# SET_DEFAULT_TABS 48_LINES 80_COLUMNS +# ONLINE ANSI CURSOR_VISIBLE +# VT102_AUTO_WRAP_ON VT102_NEWLINE_OFF VT102_MONITOR_MODE_OFF +# LOCAL_ECHO_OFF US_CHAR_SET WPS_TERMINAL_DISABLED +# CPU_AUTO_XON/XOFF_ENABLED PRINT_FULL_SCREEN +# For use with graphics software, all graphics modes should be set to factory +# default. Other SET-UP modes may be set for operator convenience or +# communication requirements. No delays are specified; use "stty ixon -ixany" +# to enable DC3/DC1 flow control! +# I commented out the scrolling capabilities since they are too slow. +hirez100|Selanar HiREZ-100, + mir, msgr, xon, + cols#80, it#8, lines#48, vt#3, + acsc=, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, + cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\EM, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, + hts=\EH, il=\E[%p1%dL, il1=\E[L, is2=\E<\E)0, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOP, + kf1=\EOQ, kf2=\EOR, kf3=\EOS, lf0=PF1, lf1=PF2, lf2=PF3, + lf3=PF4, ll=\E[48H, mc0=\E[i, mc4=\E[4i\E[?4i, + mc5=\E[?5i\E[5i, nel=\EE, rc=\E8, rev=\E[7m, rmacs=^O, + rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs1=\030\E2\E<\E[4i\E[?4i\E[12h\E[2;4;20l\E[?0;7h\E[?1;3;6;19l\E[r\E[m\E(B\017\E)0\E>, + sc=\E7, sgr0=\E[m, smacs=^N, smkx=\E[?1h\E=, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, +hirez100-w|Selanar HiREZ-100 in 132-column mode, + cols#132, use=hirez100, + +#### Signetics +# + +# From University of Wisconsin +vsc|Signetics Vsc Video driver by RMC, + am, msgr, + cols#80, it#8, lines#26, + clear=\E[;H\E[2J$<50/>, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, + ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, rev=^_\s, + rmso=^_!, rmul=^_#, sgr0=^_!, smso=^_\s, smul=^_", + +#### Soroc +# +# Alan Frisbie writes: +# +# As you may recall, the Soroc logo consisted of their name, +# with the letter "S" superimposed over an odd design. This +# consisted of a circle with a slightly smaller 15 degree (approx.) +# wedge with rounded corners inside it. The color was sort of +# a metallic gold/yellow. +# +# If I had been more of a beer drinker it might have been obvious +# to me, but it took a clue from their service department to make +# me exclaim, "Of course!" The circular object was the top of +# a beer can (the old removable pop-top style) and "Soroc" was an +# anagram for "Coors". +# +# I can just imagine the founders of the company sitting around +# one evening, tossing back a few and trying to decide what to +# call their new company and what to use for a logo. +# + +# (soroc120: removed obsolete ":ma=^K^P^R^L^L :" -- esr) +soroc120|iq120|soroc|soroc iq120, + clear=\E*$<2>, cud1=^J, ed=\EY, el=\ET, kcub1=^H, kcud1=^J, + kcuf1=^L, kcuu1=^K, + use=adm3a, +soroc140|iq140|soroc iq140, + am, mir, + cols#80, lines#24, + bel=^G, cbt=\EI, clear=\E+, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\Ew, + dl1=\Er$<.7*>, ed=\Ey, el=\Et, home=^^, il1=\Ee$<1*>, ind=^J, + kbs=^H, kcuf1=^L, kcuu1=^K, kf0=^A0\r, kf1=^A@\r, kf2=^AA\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khome=^^, ll=^^^K, rmir=\E8, + rmso=\E\177, rmul=\E^A, smir=\E9, smso=\E\177, smul=\E^A, + +#### Southwest Technical Products +# +# These guys made an early personal micro called the M6800. +# The ct82 was probably its console terminal. +# + +# (swtp: removed obsolete ":bc=^D:" -- esr) +swtp|ct82|southwest technical products ct82, + am, + cols#82, lines#20, + bel=^G, clear=^L, cr=^M, cub1=^D, cud1=^J, cuf1=^S, + cup=\013%p2%c%p1%c, cuu1=^A, dch1=^\^H, dl1=^Z, ed=^V, el=^F, + home=^P, ich1=^\^X, il1=^\^Y, ind=^N, + is2=\034\022\036\023\036\004\035\027\011\023\036\035\036\017\035\027\022\011, + ll=^C, ri=^O, rmso=^^^F, smso=^^^V, + +#### Synertek +# +# Bob Manson writes (28 Apr 1995): +# +# Synertek used to make ICs, various 6502-based single-board process +# control and hobbyist computers, and assorted peripherals including a +# series of small inexpensive terminals (I think they were one of the +# first to have a "terminal-on-a-keyboard", where the terminal itself +# was only slightly larger than the keyboard). +# +# They apparently had a KTM-1 model, which I've never seen. The KTM-2/40 +# was a 40x24 terminal that could connect to a standard TV through a +# video modulator. The KTM-2/80 was the 80-column version (the 2/40 +# could be upgraded to the 2/80 by adding 2 2114 SRAMs and a new ROM). +# I have a KTM-2/80 still in working order. The KTM-2s had fully +# socketed parts, used 2 6507s, a 6532 as keyboard scanner, a program +# ROM and 2 ROMs as character generators. They were incredibly simple, +# and I've never had any problems with mine (witness the fact that mine +# was made in 1981 and is still working great... I've blown the video +# output transistor a couple of times, but it's a 2N2222 :-) +# +# The KTM-3 (which is what is listed in the terminfo file) was their +# attempt at putting a KTM-2 in a box (and some models came with a +# CRT). It wasn't much different from the KTM-2 hardware-wise, but the +# control and escape sequences are very different. The KTM-3 was always +# real broken, at least according to the folks I've talked to about it. +# +# The padding in the entry is probably off--these terminals were very +# slow (it takes like 100ms for the KTM-2 to clear the screen...) And +# anyone with any sanity replaced the ROMs with something that provided +# a reasonable subset of VT100 functionality, since the usual ROMs were +# obviously very primitive... oh, you could get an upgraded ROM from +# Synertek for some incredible amount of money, but what hacker with an +# EPROM burner would do that? :) +# +# Sorry I don't have any contact info; I believe they were located in +# Sunnyvale, and I'm fairly sure they are still manufacturing ICs +# (they've gone to ASICs and FPGAs), but I doubt they're in the computer +# business these days. +# + +# Tested, seems to work fine with vi. +synertek|ktm|synertek380|synertek ktm 3/80 tubeless terminal, + am, + cols#80, lines#24, + clear=^Z, cub1=^H, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=\EJ, el=\EK, + +#### Tab Office Products +# +# TAB Products Co. - Palo Alto, California +# Electronic Office Products, +# 1451 California Avenue 94304 +# +# I think they're out of business. +# + +# The tab 132 uses xon/xoff, so no padding needed. +# / have nothing to do with arrow keys. +# sets 80 col mode, normal video, autowrap on (for ). +# Seems to be no way to get rid of status line. +# The manual for this puppy was dated June 1981. It claims to be VT52- +# compatible but looks more vt100-like. +tab132|tab|tab132-15|tab 132/15, + da, db, + cols#80, lines#24, lm#96, + cud1=^J, cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, dl1=\E[M, + il1=\E[L, is2=\E[?7h\E[?3l\E[?5l, kcub1=\E[D, kcud1=\E[B, + kcuu1=\E[A, rmir=\E[4l, rmkx@, smir=\E[4h, smkx@, + use=vt100, +tab132-w|tab132 in wide mode, + cols#132, + is2=\E[?7h\E[?3h\E[?5l, use=tab132, +tab132-rv|tab132 in reverse-video mode, + is2=\E[?7h\E[?3l\E[?5h, use=tab132, +tab132-w-rv|tab132 in reverse-video/wide mode, + is2=\E[?7h\E[?3h\E[?5h, + use=tab132-w, + + +#### Teleray +# +# Research Incorporated +# 6425 Flying Cloud Drive +# Eden Prairie, MN 55344 +# Vox: (612)-941-3300 +# +# The Teleray terminals were all discontinued in 1992-93. RI still services +# and repairs these beasts, but no longer manufactures them. The Teleray +# people believe that all the types listed below are very rare now (1995). +# There was a newer line of Telerays (Model 7, Model 20, Model 30, and +# Model 100) that were ANSI-compatible. +# +# Note two things called "teleray". Reorder should move the common one +# to the front if you have either. A dumb teleray with the cursor stuck +# on the bottom and no obvious model number is probably a 3700. +# + +t3700|dumb teleray 3700, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, ind=^J, +t3800|teleray 3800 series, + cols#80, it#8, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=\EJ, el=\EK, + home=\EH, ht=^I, ind=^J, ll=\EY7\s, +t1061|teleray|teleray 1061, + am, km, xhp, xt, + cols#80, it#8, lines#24, xmc#1, + bel=^G, clear=\014$<1>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, + dl1=\EM$<2*>, ed=\EJ$<1>, el=\EK, home=\EH, ht=^I, hts=\EF, + ich1=\EP, il1=\EL$<2*>, ind=^J, ip=$<0.4*>, + is2=\Ee\EU01^Z1\EV\EU02^Z2\EV\EU03^Z3\EV\EU04^Z4\EV\EU05^Z5\EV\EU06^Z6\EV\EU07^Z7\EV\EU08^Z8\EV\Ef, + kf1=^Z1, kf2=^Z2, kf3=^Z3, kf4=^Z4, kf5=^Z5, kf6=^Z6, kf7=^Z7, + kf8=^Z8, rmso=\ER@, rmul=\ER@, smso=\s\ERD, smul=\ERH, + tbc=\EG, +t1061f|teleray 1061 with fast PROMs, + dl1=\EM, il1=\EL, ip@, use=t1061, +# "Teleray Arpa Special", officially designated as +# "Teleray Arpa network model 10" with "Special feature 720". +# This is the new (1981) fast microcode updating the older "arpa" proms +# (which gave meta-key and programmable-fxn keys). 720 is much much faster, +# converts the keypad to programmable function keys, and has other goodies. +# Standout mode is still broken (magic cookie, etc) so is suppressed as no +# programs handle such lossage properly. +# Note: this is NOT the old termcap's "t1061f with fast proms." +# From: J. Lepreau Tue Feb 1 06:39:37 1983, Univ of Utah +# (t10: removed overridden ":so@:se@:us@:ue@:" -- esr) +t10|teleray 10 special, + km, xhp, xt, + cols#80, it#8, lines#24, xmc#2, + clear=\Ej$<30/>, cub1=^H, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, + dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, ich1=\EP, il1=\EL, + ind=\Eq, pad=\200, ri=\Ep, rmso=\ER@, rmul=\ER@, smso=\ERD, + smul=\ERH, +# teleray 16 - map the arrow keys for vi/rogue, shifted to up/down page, and +# back/forth words. Put the function keys (f1-f10) where they can be +# found, and turn off the other magic keys along the top row, except +# for line/local. Do the magic appropriate to make the page shifts work. +# Also toggle ^S/^Q for those of us who use Emacs. +t16|teleray 16, + am, da, db, mir, xhp, xt, + cols#80, lines#24, + bel=^G, clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=%i\E[%p1%d;%p2%df, cuu1=\E[A, dch1=\E[P, + dl1=\E[M, ed=\E[0J, el=\E[0K, home=\E[H, ht=^I, il1=\E[L, + ind=^J, kf1=^Z1, kf10=^Z0, kf2=^Z2, kf3=^Z3, kf4=^Z4, kf5=^Z5, + kf6=^Z6, kf7=^Z7, kf8=^Z8, kf9=^Z9, ri=\E[T, + rmcup=\E[V\E[24;1f\E[?38h, rmir=\E[4l, rmso=\E[m, + rmul=\E[m, sgr0=\E[m, smcup=\E[U\E[?38l, smir=\E[4h, + smso=\E[7m, smul=\E[4m, + +#### Texas Instruments (ti) +# + +# The Silent 700 was so called because it was built around a quiet thermal +# printer. It was portable, equipped with an acoustic coupler, and pretty +# neat for its day. +ti700|ti733|ti735|ti745|ti800|ti silent 700/733/735/745 or omni 800, + hc, os, + cols#80, + bel=^G, cr=\r$<162>, cub1=^H, cud1=^J, ind=^J, + +# +# Texas Instruments 916 VDT 7 bit control mode +# +ti916|ti916-220-7|Texas Instruments 916 VDT 8859/1 vt220 mode 7 bit CTRL, + da, db, in, msgr, + cbt=\E[Z, civis=\E[?25l, clear=\E[H\E[2J$<6>, + cnorm=\E[?25h, cub=\E[%p1%dD, cud=\E[%p1%dB, + cuf=\E[%p1%dC, cup=\E[%p1%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cvvis=\E[?25h, dch=\E[%p1%dP$<250>, dch1=\E[P, + dl=\E[%p1%dM, ech=\E[%p1%dX$<20>, ed=\E[J$<6>, el=\E[0K, + el1=\E[1K, enacs=\E(B\E)0, ff=^L, flash=\E[?5h\E[?5l$<6>, + hpa=\E[%p1%{1}%+%dG, hts=\E[0W, ich=\E[%p1%d@$<250>, + il=\E[%p1%dL$<36>, ip=$<10>, is2=\E[1;24r\E[24;1H, + kcmd=\E[29~, kdch1=\E[P, kent=^J, kf1=\E[17~, kf10=\E[28~, + kf11=\E[29~, kf12=\E[31~, kf2=\E[18~, kf3=\E[19~, + kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, + kf9=\E[26~, khome=\E[H, kich1=\E[@, knp=\E[S, kpp=\E[T, + kprt=^X, prot=\E&, rmacs=\017$<2>, rs2=\E[!p, + smacs=\016$<2>, tbc=\E[3g, vpa=\E[%p1%{1}%+%dd, use=vt220, +# +# Texas Instruments 916 VDT 8 bit control mode +# +ti916-8|ti916-220-8|Texas Instruments 916 VDT 8859/1 8 vt220 mode bit CTRL, + kcmd=\23329~, kcub1=\233D, kcud1=\233B, kcuf1=\233C, + kcuu1=\233A, kdch1=\233P, kent=^J, kf1=\23317~, + kf10=\23328~, kf11=\23329~, kf12=\23331~, kf2=\23318~, + kf3=\23319~, kf4=\23320~, kf5=\23321~, kf6=\23323~, + kf7=\23324~, kf8=\23325~, kf9=\23326~, khome=\233H, + kich1=\233@, knp=\233S, kpp=\233T, kprt=^X, + use=ti916, +# +# Texas Instruments 916 VDT 8859/1 7 bit control 132 column mode +# +ti916-132|Texas Instruments 916 VDT vt220 132 column, + cols#132, use=ti916, +# +# Texas Instruments 916 VDT 8859/1 8 bit control 132 column mode +# +ti916-8-132|Texas Instruments 916 VDT vt220 132 column, + cols#132, use=ti916-8, +ti924|Texas Instruments 924 VDT 8859/1 7 bit CTRL, + am, xon, + cols#80, it#8, lines#24, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[2J\E[H, cnorm=\E[?25h, cr=^M, + csr=%i\E[%p1%d;%p2%dr, cub1=\E[D, cud1=\E[B, cuf1=\E[C, + cup=%i\E[%p1%d;%p2%dH, cuu1=\E[A, cvvis=\E[?31h, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\EH, + il1=\E[L, ind=\ED, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kf1=\EOP, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, kf5=\E[16~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, kich1=\E[@, rc=\E8, rev=\E[7m, + ri=\EM, rmso=\E[m, rmul=\E[m, sc=\E7, sgr0=\E[m, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, +ti924-8|Texas Instruments 924 VDT 8859/1 8 bit CTRL, + am, xon, + cols#80, it#8, lines#24, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[2J\E[H, cnorm=\E[?25h, cr=^M, + csr=%i\E[%p1%d;%p2%dr, cub1=\E[D, cud1=\E[B, cuf1=\E[C, + cup=%i\E[%p1%d;%p2%dH, cuu1=\E[A, cvvis=\E[?31h, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\EH, + il1=\E[L, ind=\ED, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=P$<\233>, kf1=P$<\217>, + kf2=Q$<\217>, kf3=R$<\217>, kf4=S$<\217>, kf5=~$<\23316>, + kf6=~$<\23317>, kf7=~$<\23318>, kf8=~$<\23319>, + kf9=~$<\23320>, kich1=@$<\233>, rc=\E8, rev=\E[7m, ri=\EM, + rmso=\E[m, rmul=\E[m, sc=\E7, sgr0=\E[m, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, +ti924w|Texas Instruments 924 VDT 7 bit - 132 column mode, + cols#132, use=ti924, +ti924-8w|Texas Instruments 924 VDT 8 bit - 132 column mode, + cols#132, use=ti924-8, +ti931|Texas Instruments 931 VDT, + am, xon, + cols#80, lines#24, + bel=^G, blink=\E4P, clear=\EL, cnorm=\E4@, cr=^M, cub1=\ED, + cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, dch1=\EQ, dl1=\EO, ed=\EJ, el=\EI, home=\EH, + ich1=\ER\EP\EM, il1=\EN, ind=\Ea, invis=\E4H, + is2=\EGB\E(@B@@\E), kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EQ, kdl1=\EO, kf1=\Ei1, kf2=\Ei2, kf3=\Ei3, + kf4=\Ei4, kf5=\Ei5, kf6=\Ei6, kf7=\Ei7, kf8=\Ei8, kf9=\Ei9, + kich1=\EP, kil1=\EN, rev=\E4B, ri=\Eb, rmso=\E4@, rmul=\E4@, + sgr0=\E4@, smso=\E4A, smul=\E4D, +ti926|Texas Instruments 926 VDT 8859/1 7 bit CTRL, + csr@, ind=\E[1S, ri=\E[1T, + use=ti924, +# (ti926-8: I corrected this from the broken SCO entry -- esr) +ti926-8|Texas Instruments 926 VDT 8859/1 8 bit CTRL, + csr@, ind=\2331S, ri=\2331T, + use=ti924-8, +ti_ansi|basic entry for ti928, + am, bce, eo, xenl, xon, + colors#8, cols#80, it#8, lines#25, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[2J\E[H, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, + il1=\E[L, ind=\E[S, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kend=\E[F, kf0=\E[V, kf1=\E[M, + kf2=\E[N, kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, + kf8=\E[T, kf9=\E[U, khome=\E[H, knp=\E[G, kpp=\E[I, + op=\E[37;40m, ri=\E[T, rmso=\E[m, rmul=\E[m, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[m, + smso=\E[7m, smul=\E[4m, +# +# 928 VDT 7 bit control mode +# +ti928|Texas Instruments 928 VDT 8859/1 7 bit CTRL, + kdch1=\E[P, kend=\E_1\E\\, kent=\E[8~, kf1=\E[17~, + kf10=\E[28~, kf11=\E[29~, kf12=\E[31~, kf13=\E[32~, + kf15=\E[34~, kf2=\E[18~, kf3=\E[19~, kf4=\E[20~, + kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, + kich1=\E[@, knp=\E[S, kpp=\E[T, kprt=\E[35~, + use=ti_ansi, +# +# 928 VDT 8 bit control mode +# +ti928-8|Texas Instruments 928 VDT 8859/1 8 bit CTRL, + kdch1=\233P, kend=\2371\234, kent=\2338~, kf1=\23317~, + kf10=\23328~, kf11=\23329~, kf12=\23331~, kf13=\23332~, + kf15=\23334~, kf2=\23318~, kf3=\23319~, kf4=\23320~, + kf5=\23321~, kf6=\23323~, kf7=\23324~, kf8=\23325~, + kf9=\23326~, khome=\233H, kich1=\233@, knp=\233S, + kpp=\233T, kprt=\23335~, + use=ti_ansi, + +#### Zentec (zen) +# + +# (zen30: removed obsolete :ma=^L ^R^L^K^P:. This entry originally +# had just =\EG6 which I think means standout was supposed to be +# dim-reverse using ADM12-style attributes. ADM12 / and +# might work-- esr) +zen30|z30|zentec 30, + am, mir, ul, + cols#80, lines#24, + bel=^G, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dim=\EG2, dl1=\ER$<1.5*>, ed=\EY, el=\ET$<1.0*>, home=^^, + il1=\EE$<1.5*>, ind=^J, rmir=\Er, rmul@, smir=\Eq, smso=\EG6, + smul@, + use=adm+sgr, +# (zen50: this had extension capabilities +# :BS=^U:CL=^V:CR=^B: +# UK/DK/RK/LK/HM were someone's aliases for ku/kd/kl/kr/kh, +# which were also in the original entry -- esr) +# (zen50: removed obsolete ":ma=^Hh^Ll^Jj^Kk:" -- esr) +zen50|z50|zentec zephyr, + am, + cols#80, lines#24, xmc#1, + clear=\E+, cub1=^H, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, + cuu1=^K, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, ich1=\EQ, il1=\EE, + invis@, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, + rmul@, smul@, + use=adm+sgr, + +# CCI 4574 (Office Power) from Will Martin via BRL +cci|cci1|z8001|zen8001|CCI Custom Zentec 8001, + am, bw, + cols#80, lines#24, + blink=\EM", clear=\EH\EJ, cnorm=\EP, + csr=\ER%p1%{32}%+%c%p2%{32}%+%c, cub1=^H, cud1=^J, + cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, + cvvis=\EF\EQ\EM \ER 7, dim=\EM!, ed=\EJ, el=\EK, home=\EH, + invis=\EM(, is2=\EM \EF\ET\EP\ER 7, kbs=^H, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\EH, mc4=^T, mc5=^R, + rev=\EM$, ri=\EI, rmso=\EM\s, rmul=\EM\s, sgr0=\EM\s, + smso=\EM$, smul=\EM0, + +######## OBSOLETE UNIX CONSOLES +# + +#### Apollo consoles +# +# Apollo got bought by Hewlett-Packard. The Apollo workstations are +# labeled HP700s now. +# + +# From: Gary Darland +apollo|apollo console, + am, mir, + cols#88, lines#53, + clear=^L, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EM%p1%{32}%+%c%p2%d), cuu1=\EA, dch1=\EP, dl1=\EL, + ed=\EJ, el=\EK, hpa=\EN%p1%d, il1=\EI, ind=\EE, ri=\ED, + rmcup=\EX, rmir=\ER, rmso=\ET, rmul=\EV, smcup=\EW, smir=\EQ, + smso=\ES, smul=\EU, vpa=\EO+\s, + +# We don't know whether or not the apollo guys replicated DEC's firmware bug +# in the VT132 that reversed /. To be on the safe side, disable +# both these capabilities. +apollo_15P|apollo 15 inch display, + rmir@, smir@, use=vt132, +apollo_19L|apollo 19 inch display, + rmir@, smir@, use=vt132, +apollo_color|apollo color display, + rmir@, smir@, use=vt132, + +#### Convergent Technology +# +# Burroughs bought Convergent shortly before it merged with Univac. +# CTOS is (I believe) dead. Probably the aws is too (this entry dates +# from 1991 or earlier). +# + +# Convergent AWS workstation from Gould/SEL UTX/32 via BRL +# (aws: removed unknown :dn=^K: -- esr) +aws|Convergent Technologies AWS workstation under UTX,Xenix, + am, + cols#80, lines#28, xmc#0, + acsc=, clear=^L, cud1=^K, cuf1=^R, cup=\EC%p2%c%p1%c, + cuu1=^A, dch1=\EDC, dl1=\EDL, ed=\EEF, el=\EEL, hpa=\EH%p1%c, + ich1=\EIC, il1=\EIL, ind=\ESU, kbs=^H, kcub1=^N, kcud1=^K, + kcuf1=^R, kcuu1=^A, ri=\ESD, rmacs=\EAAF, rmso=\EARF, + rmul=\EAUF, smacs=\EAAN, smso=\EARN, smul=\EAUN, + vpa=\EV%p1%c, +awsc|Convergent Technologies AWS workstation under CTOS, + am, + cols#80, lines#24, xmc#0, + acsc=, clear=^L, cud1=^K, cuf1=^R, cup=\EC%p2%c%p1%c, + cuu1=^A, ed=\EEF, el=\EEL, kbs=^H, kcub1=^N, kcud1=^K, + kcuf1=^R, kcuu1=^A, rmacs=\EAAF, rmso=\EAA, rmul=\EAA, + smacs=\EAAN, smso=\EAE, smul=\EAC, + +#### DEC consoles +# + +# The MicroVax console. Tim Theisen writes: +# The digital uVax II's had a graphic display called a qdss. It was +# supposed to be a high performance graphic accelerator, but it was +# late to market and barely appeared before faster dumb frame buffers +# appeared. I have only used this display while running X11. However, +# during bootup, it was in text mode, and probably had a terminal emulator +# within it. And that is what your termcap entry is for. In graphics +# mode the screen size is 1024x864 pixels. +qdss|qdcons|qdss glass tty, + am, + cols#128, lines#57, + clear=\032$<1/>, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%c%p2%c, cuu1=^K, + +#### Fortune Systems consoles +# +# Fortune made a line of 68K-based UNIX boxes that were pretty nifty +# in their day; I (esr) used one myself for a year or so around 1984. +# They had no graphics, though, and couldn't compete against Suns and +# the like. R.I.P. +# + +# From: Robert Nathanson via tut Wed Oct 5, 1983 +# (This had extension capabilities +# :rv=\EH:re=\EI:rg=0:GG=0:\ +# :CO=\E\\:WL=^Aa\r:WR=^Ab\r:CL=^Ac\r:CR=^Ad\r:DL=^Ae\r:RF=^Af\r:\ +# :RC=^Ag\r:CW=^Ah\r:NU=^Aj\r:EN=^Ak\r:HM=^Al:PL=^Am\r:\ +# :PU=^An\r:PD=^Ao\r:PR=^Ap\r:HP=^A@\r:RT=^Aq\r:TB=\r:CN=\177:MP=\E+F: +# It had both ":bs:" and ":bs=^H:"; I removed the latter. Also, it had +# ":sg=0:" and ":ug=0:"; evidently the composer was trying (unnecessarily) +# to force both magic cookie glitches off. Once upon a time, I +# used a Fortune myself, so I know the capabilities of the form ^A[a-z]\r are +# function keys; thus the "Al" value for HM was certainly an error. I renamed +# EN/PD/PU/CO/CF/RT according to the XENIX/TC mappings, but not HM/DL/RF/RC. +# I think :rv: and :re: are start/end reverse video and :rg: is a nonexistent +# "reverse-video-glitch" capability; I have put :rv: and :re: in with standard +# names below. I've removed obsolete ":nl=5^J:" as there is a :do: -- esr) +fos|fortune|Fortune system, + am, bw, + cols#80, lines#25, + acsc=l m"k(j*v%w#q&x-, bel=^G, blink=\EN, civis=\E], + clear=\014$<20>, cnorm=\E\\, cr=^M, cub1=^H, cud1=\n$<3>, + cup=\034C%p1%{32}%+%c%p2%{32}%+%c, cuu1=\013$<3>, + cvvis=\E\:, dch1=\034W$<5>, dl1=\034R$<15>, + ed=\034Y$<3*>, el=^\Z, home=\036$<10>, ht=^Z, + ich1=\034Q$<5>, il1=\034E$<15>, ind=^J, is2=^_.., kbs=^H, + kcub1=^Aw\r, kcud1=^Ay\r, kcuf1=^Az\r, kcuu1=^Ax\r, + kend=^Ak\r, kent=^Aq, kf1=^Aa\r, kf2=^Ab\r, kf3=^Ac\r, + kf4=^Ad\r, kf5=^Ae\r, kf6=^Af\r, kf7=^Ag\r, kf8=^Ah\r, + khome=^A?\r, knp=^Ao\r, kpp=^An\r, nel=^M^J, rev=\EH, + rmacs=^O, rmso=^\I`, rmul=^\IP, sgr0=\EI, smacs=\Eo, + smso=^\H`, smul=^\HP, + +#### Masscomp consoles +# +# Masscomp has gone out of business. Their product line was purchased by +# comany in Georgia (US) called "XS International", parts and service may +# still be available through them. +# + +# (masscomp: ":MT:" changed to ":km:"; -- esr) +masscomp|masscomp workstation console, + km, mir, + cols#80, it#8, lines#24, + clear=\E[2J, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, ht=^I, il1=\E[L, is2=\EGc\EGb\EGw, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, rmir=\E[4l, + rmso=\E[m, rmul=\EGau, smir=\E[4h, smso=\E[7m, smul=\EGu, +masscomp1|masscomp large screen version 1, + cols#104, lines#36, use=masscomp, +masscomp2|masscomp large screen version 2, + cols#64, lines#21, use=masscomp, + +######## OTHER OBSOLETE TYPES +# +# These terminals are *long* dead -- these entries are retained for +# historical interest only. +# + +#### Obsolete non-ANSI software emulations +# + +# CTRM terminal emulator +# 1. underlining is not allowed with colors: first, is is simulated by +# black on white, second, it disables background color manipulations. +# 2. BLINKING, REVERSE and BOLD are allowed with colors, +# so we have to save their status in the static registers A, B and H +# respectively, to be able to restore them when color changes +# (because any color change turns off ALL attributes) +# 3. and sequences alternate modes, +# rather then simply entering them. Thus we have to check the +# static register B and H to determine the status, before sending the +# escape sequence. +# 4. now must set the status of all 3 register (A,B,H) to zero +# and then reset colors +# 5. implementation of the protect mode would badly penalize the performance. +# we would have to use \E&bn sequence to turn off colors (as well as all +# other attributes), and keep the status of protect mode in yet another +# static variable. If someone really needs this mode, they would have to +# create another terminfo entry. +# 6. original color-pair is white on black. +# store the information about colors into static registers +# 7. set foreground color. it performs the following steps. +# 1) turn off all attributes +# 2) turn on the background and video attributes that have been turned +# on before (this information is stored in static registers X,Y,Z,A,B,H,D). +# 3) turn on foreground attributes +# 4) store information about foreground into U,V,W static registers +# 8. turn on background: similar to turn on foreground above +ctrm|C terminal emulator, + am, bce, xon, + colors#8, cols#80, lh#0, lines#24, lm#0, lw#0, ncv#2, nlab#0, + pairs#63, pb#19200, vt#6, + bel=^G, blink=\E&dA%{1}%PA, + bold=%?%gH%{0}%=%t\E&dH%{1}%PH%;, cbt=\Ei, + clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\E&a%p2%dc%p1%dY, cuu1=\EA, dch1=\EP$<2>, dl1=\EM, + ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=\011$<2>, hts=\E1, + il1=\EL, ind=^J, ip=$<2>, is2=\E&jA\r, kbs=^H, kcub1=\Eu\r, + kcud1=\Ew\r, kcuf1=\Ev\r, kcuu1=\Et\r, kf1=\Ep\r, + kf2=\Eq\r, kf3=\Er\r, kf4=\Es\r, kf5=\Et\r, kf6=\Eu\r, + kf7=\Ev\r, kf8=\Ew\r, khome=\Ep\r, + op=\E&bn\E&bB\E&bG\E&bR\n%{0}%PX%{0}%PY%{0}%PZ\n%{1}%PW%{1}%PV%{1}%PU, + rev=%?%gB%{0}%=%t\E&dB%{1}%PB%;, rmir=\ER, rmkx=\E&jA, + setb=\E&bn\n%?%gA%t\E&dA%;\n%?%gB%t\E&dB%;\n%?%gH%t\E&dH%;\n%?%gU%t\E&bR%;\n%?%gV%t\E&bG%;\n%?%gW%t\E&bB%;\n\n%?%p1%{1}%&%t\E&bb%{1}%e%{0}%;%PZ\n%?%p1%{2}%&%t\E&bg%{1}%e%{0}%;%PY\n%?%p1%{4}%&%t\E&br%{1}%e%{0}%;%PX, + setf=\E&bn\n%?%gA%t\E&dA%;\n%?%gB%t\E&dB%;\n%?%gH%t\E&dH%;\n%?%gX%t\E&br%;\n%?%gY%t\E&bg%;\n%?%gZ%t\E&bb%;\n\n%?%p1%{1}%&%t\E&bB%{1}%e%{0}%;%PW\n%?%p1%{2}%&%t\E&bG%{1}%e%{0}%;%PV\n%?%p1%{4}%&%t\E&bR%{1}%e%{0}%;%PU, + sgr=\E&d@%{0}%PA%{0}%PB%{0}%PD%{0}%PH\n%?%p1%p3%p5%|%|%t\E&dB%{1}%PB%;\n%?%p4%t\E&dA%{1}%PA%;\n%?%p6%t\E&dH%{1}%PH%;\n%?%p2%t\E&dD%;, + sgr0=\E&d@%{0}%PA%{0}%PB%{0}%PH, smir=\EQ, smkx=\E&jB, + smso=\E&dD, smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, + +# gs6300 - can't use blue foreground, it clashes with underline; +# it's simulated with cyan +# Bug: The capability probably resets attributes. +# (gs6300: commented out (no ) --esr) +gs6300|emots|AT&T PC6300 with EMOTS terminal emulator, + am, bce, msgr, xon, + colors#8, cols#80, it#8, lines#24, pairs#63, + acsc=\,\,..--++``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, + is2=\E[m, kbs=^H, kcbt=^R^I, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kf1=\E[0s, kf2=\E[24s, kf3=\E[1s, + kf4=\E[23s, kf5=\E[2s, kf6=\E[22s, kf7=\E[3s, kf8=\E[21s, + khome=\E[H, mc4=\E[4i, mc5=\E[5i, op=\E[?;m, rev=\E[7m, + ri=\E[L, rmacs=\E[10m, rs1=\Ec, setb=\E[?;%p1%dm, + setf=\E[?%?%p1%{0}%=%t0\n%e%p1%{1}%=%t2\n%e%p1%{1}%-%d%;m, + sgr0=\E[m\E[10m, smacs=\E[11m, smso=\E[1m, smul=\E[4m, + +# From: 29 Oct 85 05:40:18 GMT +# MS-Kermit with Heath-19 emulation mode enabled +# (h19k: changed ":pt@:" to ":it@" +h19k|h19kermit|heathkit emulation provided by Kermit (no auto margin), + am@, da, db, xt, + it@, + ht@, use=h19-u, + +# Apple Macintosh with Versaterm, a terminal emulator distributed by Synergy +# Software (formerly Peripherals Computers & Supplies, Inc) of +# 2457 Perkiomen Ave., Reading, PA 19606, 1-800-876-8376. They can +# also be reached at support@synergy.com. +versaterm|versaterm vt100 emulator for the macintosh, + am, xenl, + cols#80, it#8, lines#24, + bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, + clear=\E[;H\E[2J$<50/>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=^J, cuf1=\E[C$<2/>, + cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<2/>, + dch1=\E[1P$<7/>, dl1=\E[1M$<9/>, ed=\E[J$<50/>, + el=\E[K$<3/>, home=\E[H, ht=^I, ich1=\E[1@$<7/>, + il1=\E[1L$<9/>, is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, nel=^M^J, rc=\E8, rev=\E[7m$<2/>, + rf=/usr/share/tabset/vt100, ri=\EM$<5/>, + rmkx=\E>\E[?1l, rmso=\E[m$<2/>, rmul=\E[m$<2/>, rs1=\E>, + sc=\E7, sgr0=\E[m$<2/>, smkx=\E=\E[?1h, smso=\E[7m$<2/>, + smul=\E[4m$<2/>, + +# From: Rick Thomas +# (xtalk: I added / based on the init string. +# I also removed and the trailing \s characters from the highlight +# changers, I don't believe these on a VT100-emulating PC display -- esr) +xtalk|IBM PC with xtalk communication program (versions up to 3.4), + am, mir, msgr, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, clear=\E[H\E[J$<50>, cr=^M, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, + cuu1=\E[A$<2>, dl1=\E[M$<99>, ed=\E[J$<50>, el=\E[K$<3>, + el1=\E[1K$<3>, enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, + il1=\E[L$<99>, ind=^J, ka1=\EOq, ka3=\EOs, kb2=\EOr, kbs=^H, + kc1=\EOp, kc3=\EOn, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, kent=\EOM, kf0=\EOy, kf1=\EOP, kf10=\EOx, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOt, kf6=\EOu, kf7=\EOv, + kf8=\EOl, kf9=\EOw, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, + rmkx=\E[?1l\E>, rmso=\E[m, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr0=\E[m, + smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m, + tbc=\E[3g, + +# The official PC terminal emulator program of the AT&T Product Centers. +# Note - insert mode commented out - doesn't seem to work on AT&T PC. +simterm|attpc running simterm, + am, + cols#80, lines#24, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\ER, + dl1=\EM, ed=\EJ, el=\EK, home=\EH, il1=\EL, ind=^J, rmcup=\EVE, + rmso=\E&d@, sgr0=\E&d@, smcup=\EVS, smso=\E&dB, + +#### Daisy wheel printers +# +# This section collects Diablo, DTC, Xerox, Qume, and other daisy +# wheel terminals. These are now largely obsolete. +# + +# (diablo1620: removed , no such file -- esr) +diablo1620|diablo1720|diablo450|ipsi|diablo 1620, + hc, os, + cols#132, it#8, + cub1=^H, cud1=^J, cuu1=\E^J, hd=\ED, hpa=\E\011%i%p1%c, + ht=^I, hts=\E1, hu=\EU, kbs=^H, tbc=\E2, +diablo1620-m8|diablo1640-m8|diablo 1620 w/8 column left margin, + cols#124, + is2=\r \E9, use=diablo1620, +# (diablo1640: removed , no such file -- esr) +diablo1640|diablo1730|diablo1740|diablo630|x1700|diablo|xerox|diablo 1640, + bel=^G, rmso=\E&, rmul=\ER, smso=\EW, smul=\EE, + use=diablo1620, +# (diablo1640-lm: removed , no such +# file -- esr) +diablo1640-lm|diablo-lm|xerox-lm|diablo 1640 with indented left margin, + cols#124, + rmso=\E&, rmul=\ER, smso=\EW, smul=\EE, use=diablo1620, +diablo1740-lm|630-lm|1730-lm|x1700-lm|diablo 1740 printer, + use=diablo1640-lm, +# DTC 382 with VDU. Has no so we fake it with . Standout +# works but won't go away without dynamite . +# The terminal has tabs, but I'm getting tired of fighting the braindamage. +# If no tab is set or the terminal's in a bad mood, it glitches the screen +# around all of memory. Note that return puts a blank ("a return character") +# in the space the cursor was at, so we use ^P return (and thus ^P newline for +# newline). Note also that if you turn off :pt: and let Unix expand tabs, +# curses won't work (some old BSD versions) because it doesn't clear this bit, +# and cursor addressing sends a tab for row/column 9. What a losing terminal! +# I have been unable to get tabs set in all 96 lines - it always leaves at +# least one line with no tabs in it, and once you tab through that line, +# it completely weirds out. +# (dtc382: change to -- it just does a clear --esr) +dtc382|DTC 382, + am, da, db, xhp, + cols#80, lines#24, lm#96, + bel=^G, clear=\020\035$<20>, cnorm=^Pb, cr=^P^M, cub1=^H, + cuf1=^PR, cup=\020\021%p2%c%p1%c, cuu1=^P^L, cvvis=^PB, + dch1=^X, dl1=^P^S, ed=\020\025\020\023\020\023, el=^P^U, + home=^P^R, il1=^P^Z, ind=^J, pad=\177, rmcup=, rmir=^Pi, + rmul=^P \200, smcup=\020\035$<20>, smir=^PI, smul=^P ^P, +dtc300s|DTC 300s, + hc, os, + cols#132, + bel=^G, cr=^M, cub1=^H, cud1=^J, cuu1=^Z, ff=^L, hd=\Eh, ht=^I, + hts=\E1, hu=\EH, ind=^J, kbs=^H, tbc=\E3, +gsi|mystery gsi terminal, + hc, os, + cols#132, + bel=^G, cr=^M, cub1=^H, cud1=^J, cuu1=^Z, hd=\Eh, ht=^I, hu=\EH, + ind=^J, +aj830|aj832|aj|anderson jacobson, + hc, os, + bel=^G, cr=^M, cub1=^H, cud1=^J, cuu1=\E7, hd=\E9, hu=\E8, + ind=^J, +# From: Chris Torek Thu, 7 Nov 85 18:21:58 EST +aj510|Anderson-Jacobson model 510, + am, mir, + cols#80, lines#24, + clear=^L, cub1=^H, cuf1=\EX, + cup=\E#%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EY, + dch1=.1*\E'D, dl1=\E&D$<2*/>, ed=\E'P, el=\E'L, ich1=, + il1=\E&I$<2*/>, ip=$<.1*/>, kcub1=\EW, kcud1=\EZ, + kcuf1=\EX, kcuu1=\EY, pad=\177, rmcup=\E"N, rmir=\E'J, + rmso=\E"I, rmul=\E"U, smcup=\E"N, smir=\E'I, smso=\E"I, + smul=\E"U, +# From: Thu Aug 20 09:09:18 1981 +# This is incomplete, but it's a start. +nec5520|nec|spinwriter|nec 5520, + hc, os, + cols#132, it#8, + bel=^G, cr=^M, cub1=^H, cud1=^J, cuu1=\E9, ff=^L, + hd=\E]s\n\E]W, ht=^I, hts=\E1, hu=\E]s\E9\E]W, ind=^J, + kbs=^H, tbc=\E3, +qume5|qume|Qume Sprint 5, + hc, os, + cols#80, it#8, + bel=^G, cr=^M, cub1=^H, cud1=^J, cuu1=^Z, ff=^L, hd=\Eh, ht=^I, + hts=\E1, hu=\EH, ind=^J, kbs=^H, tbc=\E3, +# I suspect the xerox 1720 is the same as the diablo 1620. +xerox1720|x1720|x1750|xerox 1720, + hc, os, + cols#132, it#8, + bel=^G, cr=^M, cub1=^H, cud1=^J, ff=^L, ht=^I, hts=\E1, ind=^J, + tbc=\E2, + +#### Miscellaneous obsolete terminals, manufacturers unknown +# +# If you have any information about these (like, a manufacturer's name, +# and a date on the serial-number plate) please send it! + +cad68-3|cgc3|cad68 basic monitor transparent mode size 3 chars, + am, + cols#73, lines#36, + clear=^Z, cub1=^H, cuf1=^L, cuu1=^K, home=^^, +cad68-2|cgc2|cad68 basic monitor transparent mode size 2 chars, + am, + cols#85, lines#39, + clear=^Z, cub1=^H, cuf1=^L, cuu1=^K, home=^^, kcub1=\E3, + kcud1=\E2, kcuf1=\E4, kcuu1=\E1, kf1=\E5, kf2=\E6, kf3=\E7, + kf4=\E8, rmso=\Em^C, smso=\Em^L, +cops10|cops|cops-10|cops 10, + am, bw, + cols#80, lines#24, + bel=^G, clear=\030$<30/>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\020%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=^W, el=^V, + ind=^J, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, + khome=^Y, +# (d132: removed duplicate :ic=\E5:, +# merged in capabilities from a BRL entry -- esr) +d132|datagraphix|datagraphix 132a, + da, db, in, + cols#80, lines#30, + bel=^G, clear=^L, cnorm=\Em\En, cr=^M, cub1=^H, cud1=^J, + cuf1=\EL, cup=\E8%i%p1%3d%p2%3d, cuu1=\EK, cvvis=\Ex, + dch1=\E6, home=\ET, ht=^I, ich1=\E5, il1=\E3, ind=^J, kbs=^H, + kcub1=^H, kcud1=^J, nel=^M^J, ri=\Ew, +# The d800 was an early portable terminal from c.1984-85 that looked a lot +# like the original Compaq `lunchbox' portable (but no handle). It had a vt220 +# mode (which is what this entry looks like) and several other lesser-known +# emulations. +d800|Direct 800/A, + am, da, db, msgr, xhp, + cols#80, it#8, lines#24, + acsc=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~, + bel=^G, clear=\E[1;1H\E[2J, cnorm=\E[>12h, cr=^M, cub1=^H, + cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + cvvis=\E[>12l, ed=\E[J, el=\E[K, ht=^I, ind=\ED, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, + ri=\EM, rmacs=\E[m, rmso=\E[m, rmul=\E[m, sgr0=\E[m, + smacs=\E[1m, smso=\E[7m, smul=\E[4m, +digilog|digilog 333, + cols#80, lines#16, + bel=^G, cr=^M, cub1=^H, cud1=^J, cuf1=^I, cuu1=^O, el=^X, + home=^N, ind=^J, +# The DWK was a terminal manufactured in the Soviet Union c.1986 +dwk|dwk-vt|dwk terminal, + am, + cols#80, it#8, lines#24, + acsc=lJmFkCjXtEuPv\\wKqUxWnNo~s_`+a\:f'g#~_\\\,Q+\^.M-Sh#I#0\177, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%' '%+%c%p2%' '%+%c, cuu1=\EA, dch1=\EP, + ed=\EJ, el=\EK, home=\EH, ht=^I, ich1=\EQ, ind=^J, kbs=\177, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\Ee, + kf1=\Ef1, kf10=\Ef0, kf2=\Ef2, kf3=\Ef3, kf4=\Ef4, kf5=\Ef5, + kf6=\Ef6, kf7=\Ef7, kf8=\Ef8, kf9=\Ef9, kich1=\Ed, knp=\Eh, + kpp=\Eg, nel=^M^J, rev=\ET, ri=\ES, rmacs=\EG, rmso=\EX, + sgr0=\EX, smacs=\EF, smso=\ET, +env230|envision230|envision 230 graphics terminal, + xenl@, + mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, + sgr=\E[%?%p1%t;1%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, use=vt100, +# These execuports were impact-printer ttys with a 30- or maybe 15-cps acoustic +# coupler attached, the whole rig fitting in a suitcase and more or less +# portable. Hot stuff for c.1977 :-) -- esr +ep48|ep4080|execuport 4080, + am, os, + cols#80, + bel=^G, cr=^M, cub1=^H, cud1=^J, hd=^\, hu=^^, ind=^J, +ep40|ep4000|execuport 4000, + cols#136, use=ep4080, +# Adam Thompson tells us: +# Informer series - these are all portable units, resembling older +# automatic bread-baking machines. The terminal looks like a `clamshell' +# design, but isn't. The structure is similar to the Direct terminals, +# but only half the width. The entire unit is only about 10" wide. +# It features an 8" screen (6" or 7" if you have color!), and an 9"x6" +# keyboard. All the keys are crammed together, much like some laptop +# PCs today, but perhaps less well organized...all these units have a +# bewildering array of plugs on the back, including a built-in modem. +# The 305 was a color version of the 304; the 306 and 307 were mono and +# color terminals built for IBM bisync protocols. +# From: Paul Leondis +ifmr|Informer D304, + am, + cols#80, lines#24, + clear=\EZ, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, dch1=\E\\, + ed=\E/, el=\EQ, home=\EH, ich1=\E[, ri=\En, rmso=\EK, sgr0=\EK, + smso=\EJ, +# Entry largely based on wy60 and has the features of wy60ak. +opus3n1+|Esprit Opus3n1+ in wy60 mode with ANSI arrow keys, + am, bw, hs, km, mir, msgr, ul, xon, + cols#80, lh#1, lines#24, lw#8, nlab#8, wsl#80, + acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, blink=\EG2, + cbt=\EI, civis=\E`0, clear=\E*$<100>, cnorm=\E`1, cr=^M, + cub1=^H, cud1=^J, cuf1=^L, cup=\Ea%i%p1%dR%p2%dC, cuu1=^K, + dch1=\EW$<11>, dim=\EGp, dl1=\ER$<5>, dsl=\Ez(\r, + ed=\EY$<100>, el=\ET, fsl=^M, home=\036$<2>, ht=\011$<5>, + hts=\E1, if=/usr/share/tabset/std, il1=\EE$<4>, ind=^J, + ip=$<3>, + is2=\E`\:\Ee(\EO\Ee6\Ec41\E~4\Ec21\Ed/\Ezz&\E[A\177\Ezz'\E[B\177\Ezz(\E[D\177\Ezz)\E[C\177\Ezz<\E[Q\177\Ezz`\E[F\177\EA1*\EZH12, + kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\EW, kdl1=\ER, ked=\EY, + kel=\ET, kend=\E[F, kent=\E7, kf1=^A@\r, kf10=^AI\r, + kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, + kf16=^AO\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + kich1=\EQ, kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, + mc0=\EP, mc4=^T, mc5=^R, nel=\r\n$<3>, + pfloc=\EZ2%p1%'?'%+%c%p2%s\177, + pfx=\EZ1%p1%'?'%+%c%p2%s\177, + pln=\Ez%p1%'/'%+%c%p2%s\r, prot=\E), ri=\Ej$<7>, + rmacs=\EH^C, rmam=\Ed., rmcup=, rmir=\Er, rmln=\EA11, + rmxon=\Ec20, rs1=\E~!\E~4$<150>, rs2=\EeF$<150>, + rs3=\EwG\Ee($<150>, + sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;\EG%'0'%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c, + sgr0=\E(\EH\003\EG0\EcD, smacs=\EH^B, smam=\Ed/, + smcup=\Ezz&\E[A\177\Ezz'\E[B\177\Ezz(\E[D\177\Ezz)\E[C\177\Ezz<\E[Q\177, + smir=\Eq, smln=\EA10, smxon=\Ec21, tbc=\E0, tsl=\Ez(, + uc=\EG8%p1%c\EG0, + use=adm+sgr, +teletec|Teletec Datascreen, + am, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^_, cuu1=^K, + home=^^, ind=^J, +# From: Mark Dornfeld +# This termcap is for the LANPAR Technologies VISION 3220 +# terminal. The function key definitions k0-k5 represent the +# edit keypad: FIND, INSERT HERE, REMOVE, SELECT, PREV SCREEN, +# NEXT SCREEN. The key definitions k6-k9 represent the PF1 to +# PF4 keys. +# (v3220: removed obsolete ":kn#10:", +# I added / based on the init string -- esr) +v3220|LANPAR Vision II model 3220/3221/3222, + am, mir, xenl, + cols#80, it#8, lines#24, + clear=\E[H\E[J, cub1=^H, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, ht=^I, il1=\E[L, + is2=\E>\E[?3l\E[?7h\E[?8h\E[p, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kf0=\E[1~, kf1=\E[2~, kf2=\E[3~, + kf3=\E[4~, kf4=\E[5~, kf5=\E[6~, kf6=\E[OP, kf7=\E[OQ, + kf8=\E[OR, kf9=\E[OS, khome=\E[H, ri=\EM, rmam=\E[?7l, + rmir=\E[4l, rmkx=\E>, rmso=\E[m, rmul=\E[m, sgr0=\E[m, + smam=\E[?7h, smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, +######## ICH/ICH1 VERSUS RMIR/SMIR +# +# Some non-curses applications get confused if both ich/ich1 and rmir/smir +# are present; the symptom is doubled characters in an update using insert. +# These applications are technically correct; in both 4.3BSD termcap and +# terminfo, you're not actually supposed to specify both ich/ich1 and rmir/smir +# unless the terminal needs both. This requirement is now rare; most ich +# sequences do not require previous smir, and most smir insert modes do not +# require ich1 before each character. +# +# For ncurses-based applications this is not a problem, as ncurses uses +# one or the other as appropriate but never mixes the two. Therefore we +# have not corrected entries like `linux' and `xterm' that specify both. +# If you see doubled characters from these, use the linux-nic and xterm-nic +# entries that suppress ich/ich1. And upgrade to ncurses! +# + +######## VT100/ANSI/ISO 6429/ECMA-48/PC-TERM TERMINAL STANDARDS +# +# ANSI X3.64 has been withdrawn and replaced by ECMA-48. The ISO 6429 and +# ECMA-48 standards are said to be almost identical, but are not the same +# as X3.64 (though for practical purposes they are close supersets of it). +# +# You can obtain ECMA-48 for free by sending email to helpdesk@ecma.ch +# requesting the standard(s) you want (i.e. ECMA-48, "Control Functions for +# Coded Character Sets"), include your snail-mail address, and you should +# receive the document in due course. Don't expect an email acknowledgement. +# +# Related standards include "X3.4-1977: American National Standard Code for +# Information Interchange" (the ASCII standard) and "X3.41.1974: +# Code-Extension Techniques for Use with the 7-Bit Coded Character Set of +# American National Standard for Information Interchange." I believe (but +# am not certain) that these are effectively identical to ECMA-6 and ECMA-35 +# respectively. +# + +#### VT100/ANSI/ECMA-48 +# +# ANSI Standard (X3.64) Control Sequences for Video Terminals and Peripherals +# and ECMA-48 Control Functions for Coded Character Sets. +# +# Much of the content of this comment is adapted from a table prepared by +# Richard Shuford, based on a 1984 Byte article. Terminfo correspondences, +# discussion of some terminfo-related issues, and updates to capture ECMA-48 +# have been added. Control functions described in ECMA-48 only are tagged +# with * after their names. +# +# The table is a complete list of the defined ANSI X3.64/ECMA-48 control +# sequences. In the main table, \E stands for an escape (\033) character, +# SPC for space. Pn stands for a single numeric parameter to be inserted +# in decimal ASCII. Ps stands for a list of such parameters separated by +# semicolons. Parameter meanings for most parametrized sequences are +# decribed in the notes. +# +# Sequence Sequence Parameter or +# Mnemonic Name Sequence Value Mode terminfo +# ----------------------------------------------------------------------------- +# APC Applicatn Program Command \E _ - Delim - +# BEL Bell * ^G - - bel +# BPH Break Permitted Here * \E B - * - +# BS Backpace * ^H - EF - +# CAN Cancel * ^X - - - (A) +# CBT Cursor Backward Tab \E [ Pn Z 1 eF cbt +# CCH Cancel Previous Character \E T - - - +# CHA Cursor Horizntal Absolute \E [ Pn G 1 eF hpa (B) +# CHT Cursor Horizontal Tab \E [ Pn I 1 eF tab (C) +# CMD Coding Method Delimiter * \E +# CNL Cursor Next Line \E [ Pn E 1 eF nel (D) +# CPL Cursor Preceding Line \E [ Pn F 1 eF - +# CPR Cursor Position Report \E [ Pn ; Pn R 1, 1 - - (E) +# CSI Control Sequence Intro \E [ - Intro - +# CTC Cursor Tabulation Control \E [ Ps W 0 eF - (F) +# CUB Cursor Backward \E [ Pn D 1 eF cub +# CUD Cursor Down \E [ Pn B 1 eF cud +# CUF Cursor Forward \E [ Pn C 1 eF cuf +# CUP Cursor Position \E [ Pn ; Pn H 1, 1 eF cup (G) +# CUU Cursor Up \E [ Pn A 1 eF cuu +# CVT Cursor Vertical Tab \E [ Pn Y - eF - (H) +# DA Device Attributes \E [ Pn c 0 - - +# DAQ Define Area Qualification \E [ Ps o 0 - - +# DCH Delete Character \E [ Pn P 1 eF dch +# DCS Device Control String \E P - Delim - +# DL Delete Line \E [ Pn M 1 eF dl +# DLE Data Link Escape * ^P - - - +# DMI Disable Manual Input \E \ - Fs - +# DSR Device Status Report \E [ Ps n 0 - - (I) +# DTA Dimension Text Area * \E [ Pn ; Pn SPC T - PC - +# EA Erase in Area \E [ Ps O 0 eF - (J) +# ECH Erase Character \E [ Pn X 1 eF ech +# ED Erase in Display \E [ Ps J 0 eF ed (J) +# EF Erase in Field \E [ Ps N 0 eF - +# EL Erase in Line \E [ Ps K 0 eF el (J) +# EM End of Medium * ^Y - - - +# EMI Enable Manual Input \E b Fs - +# ENQ Enquire ^E - - - +# EOT End Of Transmission ^D - * - +# EPA End of Protected Area \E W - - - (K) +# ESA End of Selected Area \E G - - - +# ESC Escape ^[ - - - +# ETB End Transmission Block ^W - - - +# ETX End of Text ^C - - - +# FF Form Feed ^L - - - +# FNK Function Key * \E [ Pn SPC W - - - +# GCC Graphic Char Combination* \E [ Pn ; Pn SPC B - - - +# FNT Font Selection \E [ Pn ; Pn SPC D 0, 0 FE - +# GSM Graphic Size Modify \E [ Pn ; Pn SPC B 100, 100 FE - (L) +# GSS Graphic Size Selection \E [ Pn SPC C none FE - +# HPA Horz Position Absolute \E [ Pn ` 1 FE - (B) +# HPB Char Position Backward \E [ j 1 FE - +# HPR Horz Position Relative \E [ Pn a 1 FE - (M) +# HT Horizontal Tab * ^I - FE - (N) +# HTJ Horz Tab w/Justification \E I - FE - +# HTS Horizontal Tab Set \E H - FE hts +# HVP Horz & Vertical Position \E [ Pn ; Pn f 1, 1 FE - (G) +# ICH Insert Character \E [ Pn @ 1 eF ich +# IDCS ID Device Control String \E [ SPC O - * - +# IGS ID Graphic Subrepertoire \E [ SPC M - * - +# IL Insert Line \E [ Pn L 1 eF il +# IND Index \E D - FE - +# INT Interrupt \E a - Fs - +# JFY Justify \E [ Ps SPC F 0 FE - +# IS1 Info Separator #1 * ^_ - * - +# IS2 Info Separator #1 * ^^ - * - +# IS3 Info Separator #1 * ^] - * - +# IS4 Info Separator #1 * ^\ - * - +# LF Line Feed ^J - - - +# LS1R Locking Shift Right 1 * \E ~ - - - +# LS2 Locking Shift 2 * \E n - - - +# LS2R Locking Shift Right 2 * \E } - - - +# LS3 Locking Shift 3 * \E o - - - +# LS3R Locking Shift Right 3 * \E | - - - +# MC Media Copy \E [ Ps i 0 - - (S) +# MW Message Waiting \E U - - - +# NAK Negative Acknowledge * ^U - * - +# NBH No Break Here * \E C - - - +# NEL Next Line \E E - FE nel (D) +# NP Next Page \E [ Pn U 1 eF - +# NUL Null * ^@ - - - +# OSC Operating System Command \E ] - Delim - +# PEC Pres. Expand/Contract * \E Pn SPC Z 0 - - +# PFS Page Format Selection * \E Pn SPC J 0 - - +# PLD Partial Line Down \E K - FE - (T) +# PLU Partial Line Up \E L - FE - (U) +# PM Privacy Message \E ^ - Delim - +# PP Preceding Page \E [ Pn V 1 eF - +# PPA Page Position Absolute * \E [ Pn SPC P 1 FE - +# PPB Page Position Backward * \E [ Pn SPC R 1 FE - +# PPR Page Position Forward * \E [ Pn SPC Q 1 FE - +# PTX Parallel Texts * \E [ \ - - - +# PU1 Private Use 1 \E Q - - - +# PU2 Private Use 2 \E R - - - +# QUAD Typographic Quadding \E [ Ps SPC H 0 FE - +# REP Repeat Char or Control \E [ Pn b 1 - rep +# RI Reverse Index \E M - FE - (V) +# RIS Reset to Initial State \E c - Fs - +# RM Reset Mode * \E [ Ps l - - - (W) +# SACS Set Add. Char. Sep. * \E [ Pn SPC / 0 - - +# SAPV Sel. Alt. Present. Var. * \E [ Ps SPC ] 0 - - (X) +# SCI Single-Char Introducer \E Z - - - +# SCO Sel. Char. Orientation * \E [ Pn ; Pn SPC k - - - +# SCS Set Char. Spacing * \E [ Pn SPC g - - - +# SD Scroll Down \E [ Pn T 1 eF rin +# SDS Start Directed String * \E [ Pn ] 1 - - +# SEE Select Editing Extent \E [ Ps Q 0 - - (Y) +# SEF Sheet Eject & Feed * \E [ Ps ; Ps SPC Y 0,0 - - +# SGR Select Graphic Rendition \E [ Ps m 0 FE sgr (O) +# SHS Select Char. Spacing * \E [ Ps SPC K 0 - - +# SI Shift In ^O - - - (P) +# SIMD Sel. Imp. Move Direct. * \E [ Ps ^ - - - +# SL Scroll Left \E [ Pn SPC @ 1 eF - +# SLH Set Line Home * \E [ Pn SPC U - - - +# SLL Set Line Limit * \E [ Pn SPC V - - - +# SLS Set Line Spacing * \E [ Pn SPC h - - - +# SM Select Mode \E [ Ps h none - - (W) +# SO Shift Out ^N - - - (Q) +# SOH Start Of Heading * ^A - - - +# SOS Start of String * \E X - - - +# SPA Start of Protected Area \E V - - - (Z) +# SPD Select Pres. Direction * \E [ Ps ; Ps SPC S 0,0 - - +# SPH Set Page Home * \E [ Ps SPC G - - - +# SPI Spacing Increment \E [ Pn ; Pn SPC G none FE - +# SPL Set Page Limit * \E [ Ps SPC j - - - +# SPQR Set Pr. Qual. & Rapid. * \E [ Ps SPC X 0 - - +# SR Scroll Right \E [ Pn SPC A 1 eF - +# SRCS Set Reduced Char. Sep. * \E [ Pn SPC f 0 - - +# SRS Start Reversed String * \E [ Ps [ 0 - - +# SSA Start of Selected Area \E F - - - +# SSU Select Size Unit * \E [ Pn SPC I 0 - - +# SSW Set Space Width * \E [ Pn SPC [ none - - +# SS2 Single Shift 2 (G2 set) \E N - Intro - +# SS3 Single Shift 3 (G3 set) \E O - Intro - +# ST String Terminator \E \ - Delim - +# STAB Selective Tabulation * \E [ Pn SPC ^ - - - +# STS Set Transmit State \E S - - - +# STX Start pf Text * ^B - - - +# SU Scroll Up \E [ Pn S 1 eF indn +# SUB Substitute * ^Z - - - +# SVS Select Line Spacing * \E [ Pn SPC \ 1 - - +# SYN Synchronous Idle * ^F - - - +# TAC Tabul. Aligned Centered * \E [ Pn SPC b - - - +# TALE Tabul. Al. Leading Edge * \E [ Pn SPC a - - - +# TATE Tabul. Al. Trailing Edge* \E [ Pn SPC ` - - - +# TBC Tab Clear \E [ Ps g 0 FE tbc +# TCC Tabul. Centered on Char * \E [ Pn SPC c - - - +# TSR Tabulation Stop Remove * \E [ Pn SPC d - FE - +# TSS Thin Space Specification \E [ Pn SC E none FE - +# VPA Vert. Position Absolute \E [ Pn d 1 FE vpa +# VPB Line Position Backward * \E [ Pn k 1 FE - +# VPR Vert. Position Relative \E [ Pn e 1 FE - (R) +# VT Vertical Tabulation * ^K - FE - +# VTS Vertical Tabulation Set \E J - FE - +# +# --------------------------------------------------------------------------- +# +# Notes: +# +# Some control characters are listed in the ECMA-48 standard without +# being assigned functions relevant to terminal control there (they +# referred to other standards such as ISO 1745 or ECMA-35). They are listed +# here anyway for completeness. +# +# (A) ECMA-48 calls this "CancelCharacter" but retains the CCH abbreviation. +# +# (B) There seems to be some confusion abroad between CHA and HPA. Most +# `ANSI' terminals accept the CHA sequence, not the HPA. but terminfo calls +# the capability (hpa). ECMA-48 calls this "Cursor Character Absolute" but +# preserved the CHA abbreviation. +# +# (C) CHT corresponds to terminfo (tab). Usually it has the value ^I. +# Occasionally (as on, for example, certain HP terminals) this has the HTJ +# value. ECMA-48 calls this "Cursor Forward Tabulation" but preserved the +# CHT abbreviation. +# +# (D) terminfo (nel) is usually \r\n rather than ANSI \EE. +# +# (E) ECMA-48 calls this "Active Position Report" but preserves the CPR +# abbreviation. +# +# (F) CTC parameter values: 0 = set char tab, 1 = set line tab, 2 = clear +# char tab, 3 = clear line tab, 4 = clear all char tabs on current line, +# 5 = clear all char tabs, 6 = clear all line tabs. +# +# (G) CUP and HVP are identical in effect. Some ANSI.SYS versions accept +# HVP, but always allow CUP as an alternate. ECMA-48 calls HVP "Character +# Position Absolute" but retains the HVP abbreviation. +# +# (H) ECMA calls this "Cursor Line Tabulation" but preserves the CVT +# abbreviation. +# +# (I) DSR parameter values: 0 = ready, 1 = busy, 2 = busy, will send DSR +# later, 3 = malfunction, 4 = malfunction, will send DSR later, 5 = request +# DSR, 6 = request CPR response. +# +# (J) ECMA calls ED "Erase In Page". EA/ED/EL parameters: 0 = clear to end, +# 1 = clear from beginning, 2 = clear. +# +# (K) ECMA calls this "End of Guarded Area" but preserves the EPA abbreviation. +# +# (L) The GSM parameters are vertical and horizontal parameters to scale by. +# +# (M) Some ANSI.SYS versions accept HPR, but more commonly `ANSI' terminals +# use CUF for this function and ignore HPR. ECMA-48 calls this "Character +# Position Relative" but retains the HPR abbreviation. +# +# (N) ECMA-48 calls this "Character Tabulation" but retains the HT +# abbreviation. +# +# (O) SGR parameter values: 0 = default mode (attributes off), 1 = bold, +# 2 = dim, 3 = italicized, 4 = underlined, 5 = slow blink, 6 = fast blink, +# 7 = reverse video, 8 = invisible, 9 = crossed-out (marked for deletion), +# 10 = primary font, 10 + n (n in 1..9) = nth alternative font, 20 = Fraktur, +# 21 = double underline, 22 = turn off 2, 23 = turn off 3, 24 = turn off 4, +# 25 = turn off 5, 26 = proportional spacing, 27 = turn off 7, 28 = turn off +# 8, 29 = turn off 9, 30 = black fg, 31 = red fg, 32 = green fg, 33 = yellow +# fg, 34 = blue fg, 35 = magenta fg, 36 = cyan fg, 37 = white fg, 38 = set +# fg color as in CCIT T.416, 39 = set default fg color, 40 = black bg +# 41 = red bg, 42 = green bg, 43 = yellow bg, 44 = blue bg, 45 = magenta bg, +# 46 = cyan bg, 47 = white bg, 48 = set bg color as in CCIT T.416, 39 = set +# default bg color, 50 = turn off 26, 51 = framed, 52 = encircled, 53 = +# overlined, 54 = turn off 51 & 52, 55 = not overlined, 56-59 = reserved, +# 61-65 = variable highlights for ideograms. +# +# (P) SI is also called LSO, Locking Shift Zero. +# +# (Q) SI is also called LS1, Locking Shift One. +# +# (R) Some ANSI.SYS versions accept VPR, but more commonly `ANSI' terminals +# use CUD for this function and ignore VPR. ECMA calls it `Line Position +# Absolute' but retains the VPA abbreviation. +# +# (S) MC parameters: 0 = start xfer to primary aux device, 1 = start xfer from +# primary aux device, 2 = start xfer to secondary aux device, 3 = start xfer +# from secondary aux device, 4 = stop relay to primary aux device, 5 = +# start relay to primary aux device, 6 = stop relay to secondary aux device, +# 7 = start relay to secondary aux device. +# +# (T) ECMA-48 calls this "Partial Line Forward" but retains the PLD +# abbreviation. +# +# (U) ECMA-48 calls this "Partial Line Backward" but retains the PLD +# abbreviation. +# +# (V) ECMA-48 calls this "Reverse Line Feed" but retains the RI abbreviation. +# +# (W) RM/SM modes are as follows: 1 = Guarder Area Transfer Mode (GATM), +# 2 = Keyboard Action Mode (KAM), 3 = Control Representation Mode (CRM), +# 4 = Insertion Replacement Mode, 5 = Status Report Transfer Mode (SRTM), +# 6 = Erasure Mode (ERM), 7 = Line Editing Mode (LEM), 8 = Bi-Directional +# Support Mode (BDSM), 9 = Device Component Select Mode (DCSM), +# 10 = Character Editing Mode (HEM), 11 = Positioning Unit Mode (PUM), +# 12 = Send/Receive Mode, 13 = Format Effector Action Mode (FEAM), +# 14 = Format Effector Transfer Mode (FETM), 15 = Multiple Area Transfer +# Mode (MATM), 16 = Transfer Termination Mode, 17 = Selected Area Transfer +# Mode, 18 = Tabulation Stop Mode, 19 = Editing Boundary Mode, 20 = Line Feed +# New Line Mode (LF/NL), Graphic Rendition Combination Mode (GRCM), 22 = +# Zero Default Mode (ZDM). The EBM and LF/NL modes have actually been removed +# from ECMA-48's 5th edition but are listed here for reference. +# +# (X) Select Alternate Presentation Variants is used only for non-Latin +# alphabets. +# +# (Y) "Select Editing Extent" (SEE) was ANSI "Select Edit Extent Mode" (SEM). +# +# (Z) ECMA-48 calls this "Start of Guarded Area" but retains the SPA +# abbreviation. +# +# --------------------------------------------------------------------------- +# +# Abbreviations: +# +# Intro an Introducer of some kind of defined sequence; the normal 7-bit +# X3.64 Control Sequence Introducer is the two characters "Escape [" +# +# Delim a Delimiter +# +# x/y identifies a character by position in the ASCII table (column/row) +# +# eF editor function (see explanation) +# +# FE format effector (see explanation) +# +# F is a Final character in +# an Escape sequence (F from 3/0 to 7/14 in the ASCII table) +# a control sequence (F from 4/0 to 7/14) +# +# Gs is a graphic character appearing in strings (Gs ranges from +# 2/0 to 7/14) in the ASCII table +# +# Ce is a control represented as a single bit combination in the C1 set +# of controls in an 8-bit character set +# +# C0 the familiar set of 7-bit ASCII control characters +# +# C1 roughly, the set of control chars available only in 8-bit systems. +# This is too complicated to explain fully here, so read Jim Fleming's +# article in the February 1983 BYTE, especially pages 214 through 224. +# +# Fe is a Final character of a 2-character Escape sequence that has an +# equivalent representation in an 8-bit environment as a Ce-type +# (Fe ranges from 4/0 to 5/15) +# +# Fs is a Final character of a 2-character Escape sequence that is +# standardized internationally with identical representation in 7-bit +# and 8-bit environments and is independent of the currently +# designated C0 and C1 control sets (Fs ranges from 6/0 to 7/14) +# +# I is an Intermediate character from 2/0 to 2/15 (inclusive) in the +# ASCII table +# +# P is a parameter character from 3/0 to 3/15 (inclusive) in the ASCII +# table +# +# Pn is a numeric parameter in a control sequence, a string of zero or +# more characters ranging from 3/0 to 3/9 in the ASCII table +# +# Ps is a variable number of selective parameters in a control sequence +# with each selective parameter separated from the other by the code +# 3/11 (which usually represents a semicolon); Ps ranges from +# 3/0 to 3/9 and includes 3/11 +# +# * Not relevant to terminal control, listed for completeness only. +# +# Format Effectors versus Editor Functions +# +# A format effector specifies how following output is to be displayed. +# An editor function allows you to modify the display. Informally +# format effectors may be destructive; format effectors should not be. +# +# For instance, a format effector that moves the "active position" (the +# cursor or equivalent) one space to the left would be useful when you want to +# create an overstrike, a compound character made of two standard characters +# overlaid. Control-H, the Backspace character, is actually supposed to be a +# format effector, so you can do this. But many systems use it in a +# nonstandard fashion, as an editor function, deleting the character to the +# left of the cursor and moving the cursor left. When Control-H is assumed to +# be an editor function, you cannot predict whether its use will create an +# overstrike unless you also know whether the output device is in an "insert +# mode" or an "overwrite mode". When Control-H is used as a format effector, +# its effect can always be predicted. The familiar characters carriage +# return, linefeed, formfeed, etc., are defined as format effectors. +# +# NOTES ON THE DEC VT100 IMPLEMENTATION +# +# Control sequences implemented in the VT100 are as follows: +# +# CPR, CUB, CUD, CUF, CUP, CUU, DA, DSR, ED, EL, HTS, HVP, IND, +# LNM, NEL, RI, RIS, RM, SGR, SM, TBC +# +# plus several private DEC commands. +# +# Erasing parts of the display (EL and ED) in the VT100 is performed thus: +# +# Erase from cursor to end of line Esc [ 0 K or Esc [ K +# Erase from beginning of line to cursor Esc [ 1 K +# Erase line containing cursor Esc [ 2 K +# Erase from cursor to end of screen Esc [ 0 J or Esc [ J +# Erase from beginning of screen to cursor Esc [ 1 J +# Erase entire screen Esc [ 2 J +# +# Some brain-damaged terminal/emulators respond to Esc [ J as if it were +# Esc [ 2 J, but this is wrong; the default is 0. +# +# The VT100 responds to receiving the DA (Device Attributes) control +# +# Esc [ c (or Esc [ 0 c) +# +# by transmitting the sequence +# +# Esc [ ? l ; Ps c +# +# where Ps is a character that describes installed options. +# +# The VT100's cursor location can be read with the DSR (Device Status +# Report) control +# +# Esc [ 6 n +# +# The VT100 reports by transmitting the CPR sequence +# +# Esc [ Pl ; Pc R +# +# where Pl is the line number and Pc is the column number (in decimal). +# +# The specification for the DEC VT100 is document EK-VT100-UG-003. + +#### ANSI.SYS +# +# Here is a description of the color and attribute controls supported in the +# the ANSI.SYS driver under MS-DOS. Most console drivers and ANSI +# terminal emulators for Intel boxes obey these. They are a proper subset +# of the ECMA-48 escapes. +# +# 0 all attributes off +# 1 foreground bright +# 4 underscore on +# 5 blink on/background bright (not reliable with brown) +# 7 reverse-video +# 8 set blank (non-display) +# 10 set primary font +# 11 set first alternate font (on PCs, display ROM characters 1-31) +# 12 set second alternate font (on PCs, display IBM high-half chars) +# +# Color attribute sets +# 3n set foreground color / 0=black, 1=red, 2=green, 3=brown, +# 4n set background color \ 4=blue, 5=magenta, 6=cyan, 7=white +# Bright black becomes gray. Bright brown becomes yellow, +# These coincide with the prescriptions of the ISO 6429/ECMA-48 standard. +# +# * If the 5 attribute is on and you set a background color (40-47) it is +# supposed to enable bright background. +# +# * Many VGA cards (such as the Paradise and compatibles) do the wrong thing +# when you try to set a "bright brown" (yellow) background with attribute +# 5 (you get a blinking yellow foreground instead). A few displays +# (including the System V console) support an attribute 6 that undoes this +# braindamage (this is required by iBCS2). +# +# * Some older versions of ANSI.SYS have a bug that causes thems to require +# ESC [ Pn k as EL rather than the ANSI ESC [ Pn K. (This is not ECMA-48 +# compatible.) + +#### Intel Binary Compatibility Standard +# +# For comparison, here are the capabilities implied by the Intel Binary +# Compatibility Standard for UNIX systems (Intel order number 468366-001). +# These recommendations are optional. IBCS2 allows the leading escape to +# be either the 7-bit \E[ or 8-bit \0233 introducer, in accordance with +# the ANSI X.364/ISO 6429/ECMA-48 standard. Here are the iBCS2 capabilities +# (as described in figure 9-3 of the standard). Those expressed in the ibcs2 +# terminfo entry are followed with the corresponding capability in parens: +# +# CSI k disable (n=0) or enable (n=1) keyclick +# CSI 2h lock keyboard +# CSI 2i send screen as input +# CSI 2l unlock keyboard +# CSI 6m enable background color intensity +# CSI <0-2>c reserved +# CSI <0-59>m select graphic rendition +# CSI ;H (cup) cursor to line n and column m +# CSI ;f cursor to line n and column m +# CSI @ (ich) insert characters +# CSI A (cuu) cursor up n lines +# CSI B (cud) cursor down n lines +# CSI C (cuu) cursor right n characters +# CSI D (cud) cursor left n characters +# CSI E cursor down n lines and in first column +# CSI F cursor up n lines and in first column +# CSI G (hpa) position cursor at column n-1 +# CSI J (ed) erase in display +# CSI K (el) erase in line +# CSI L (il) insert line(s) +# CSI P (dch) delete characters +# CSI S (indn) scroll up n lines +# CSI T (rin) scroll down n lines +# CSI X (ech) erase characters +# CSI Z (cbt) back up n tab stops +# CSI ` cursor to column n on line +# CSI a (cuu) cursor right n characters +# CSI d (vpa) cursor to line n +# CSI e cursor down n lines and in first column +# CSI g (cbt) clear all tabs +# CSI z make virtual terminal n active +# CSI ?7h (smam) turn automargin on +# CSI ?7l (rmam) turn automargin off +# CSI s save cursor position +# CSI u restore cursor position to saved value +# CSI =A set overscan color +# CSI =F set normal foreground color +# CSI =G set normal background color +# CSI =H set reverse foreground color +# CSI =I set reverse foreground color +# CSI =J set graphic foreground color +# CSI =K set graphic foreground color +# CSI =g (dispc) display n from alternate graphics character set +# CSI =

;B set bell parameters +# CSI =;C set cursor parameters +# CSI =D enable/disable intensity of background color +# CSI =E set/clear blink vs. bold background +# CSI 7 (sc) (sc) save cursor position +# CSI 8 (rc) (rc) restore cursor position to saved value +# CSI H (hts) (hts) set tab stop +# CSI Q define function key string +# (string must begin and end with delimiter char) +# CSI c (clear) clear screen +# +# The lack of any specification for attributes in SGR (among other things) +# makes this a wretchedly weak standard. The table above is literally +# everything iBSC2 has to say about terminal escape sequences; there is +# no further discussion of their meaning or how to set the parameters +# in these sequences at all. +# + +######## NONSTANDARD CAPABILITY TRANSLATIONS USED IN THIS FILE +# +# The historical termcap file entries were written primarily in 4.4BSD termcap. +# The 4.4BSD termcap set was substantially larger than the original 4.1BSD set, +# with the extension names chosen for compatibility with the termcap names +# assigned in System V terminfo. There are some variant extension sets out +# there. We try to describe them here. +# +# XENIX extensions: +# +# The XENIX extensions include a set of function-key capabilities as follows: +# +# code XENIX variable name terminfo name name clashes? +# ---- ------------------- ------------- ----------------------- +# CL key_char_left +# CR key_char_right +# CW key_change_window create_window +# EN key_end kend +# HM key_home khome +# HP ?? +# LD key_delete_line kdl1 +# LF key_linefeed label_off +# NU key_next_unlocked_cell +# PD key_page_down knp +# PL ?? +# PN start_print mc5 +# PR ?? +# PS stop_print mc4 +# PU key_page_up kpp pulse +# RC key_recalc remove_clock +# RF key_toggle_ref req_for_input +# RT key_return kent +# UP key_up_arrow kcuu1 parm_up_cursor +# WL key_word_left +# WR key_word_right +# +# The XENIX extensions also include the following character-set and highlight +# capabilities: +# +# XENIX terminfo function +# ----- -------- ------------------------------ +# GS smacs start alternate character set +# GE rmacs end alternate character set +# GG :as:/:ae: glitch (analogous to :sg:/:ug:) +# bo blink begin blink (not used in /etc/termcap) +# be end blink (not used in /etc/termcap) +# bb blink glitch (not used in /etc/termcap) +# it dim begin dim (not used in /etc/termcap) +# ie end dim (not used in /etc/termcap) +# ig dim glitch (not used in /etc/termcap) +# +# Finally, XENIX also used the following forms-drawing capabilities: +# +# single double type ASCII approximation +# ------ ------ ------------- ------------------- +# GV Gv vertical line | +# GH Gv horizontal line - _ +# G1 G5 top right corner _ | +# G2 G6 top left corner | +# G3 G7 bottom left corner |_ +# G4 G8 bottom right corner _| +# GD Gd down-tick character T +# GL Gl left-tick character -| +# GR Gr right-tick character |- +# GC Gc middle intersection -|- +# GU Gu up-tick character _|_ +# +# These were invented to take advantage of the IBM PC ROM character set. One +# can compose an acsc string from the single-width characters as follows +# "j{G4}k{G1}l{G2}m{G3}q{GH}x{GV}t{GR}u{GL}v{GU}w{GD}n{GC}" +# When translating a termcap file, ncurses tic will do this automatically. +# The double forms characters don't fit the SVr4 terminfo model. +# +# 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 that BO=:mr: (start reverse video), DS=:mh: +# (start dim), XS=:mk: (secure/invisible mode), EE=:me: (end highlights), +# FL=:LO: (enable soft labels), FE=:LF: (disable soft labels), CI=:vi: (make +# cursor invisible), and CV=:ve: (make cursor normal). +# +# HP Extensions +# +# The HP library (as of mid-1995, their term.h file version 70.1) appears to +# have the System V capabilities up to SVr1 level. After that, it supports +# two nonstandard caps meml and memu corresponding to the old termcap :ml:, +# :mu: capabilities. After that, it supports caps plab_norm, label_on, +# label_off, and key_f11..key_f63 capabilities like SVr4's. This makes the +# HP binary format incompatible with SVr4's. +# +# IBM Extensions +# +# There is a set of nonstandard terminfos used by IBM's AIX operating system. +# The AIX terminfo library diverged from SVr1 terminfo, and replaces all +# capabilities following prtr_non with the following special capabilties: +# box[12], batt[12], colb[0123456789], colf[0123456789], f[01234567], kbtab, +# kdo, kcmd, kcpn, kend, khlp, knl, knpn, kppn, kppn, kquit, ksel, kscl, kscr, +# ktab, kmpf[123456789], apstr, ksf1..ksf10, kf11...kf63, kact, topl, btml, +# rvert, lvert. Some of these are identical to XPG4/SVr4 equivalents: +# kcmd, kend, khlp, and kf11...kf63. Two others (kbtab and ksel) can be +# renamed (to kcbt and kslt). The places in the box[12] capabilities +# correspond to acsc chars, 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. +# The AIX binary terminfo format is incompatible with SVr4's. +# +# Iris console extensions: +# +# HS is half-intensity start; HE is half-intensity end +# CT is color terminal type (for Curses & rogue) +# CP is color change escape sequence +# CZ are color names (for Curses & rogue) +# +# The ncurses tic utility recognizes HS as an alias for mh . +# +# TC Extensions: +# +# There is a set of extended termcaps associated with something +# called the "Terminal Control" or TC package created by MainStream Systems, +# Winfield Kansas. This one also uses GS/GE for as/ae, and also uses +# CF for civis and CO for cvvis. Finally, they define a boolean :ct: +# that flags color terminals. +# +######## CHANGE HISTORY +# +# The last /etc/termcap version maintained by John Kunze was 8.3, dated 8/5/94. +# Releases 9 and up are maintained by Eric S. Raymond as part of the ncurses +# project. +# +# This file contains all the capability information present in John Kunze's +# last version of the termcap master file, except as noted in the change +# comments at end of file. Some information about very ancient obsolete +# capabilities has been moved to comments. Some all-numeric names of older +# terminals have been retired. +# +# I changed :MT: to :km: (the 4.4BSD name) everywhere. I commented out some +# capabilities (EP, dF, dT, dV, kn, ma, ml, mu, xr, xx) that are no longer +# used by BSD curses. +# +# The 9.1.0 version of this file was translated from my lightly-edited copy of +# 8.3, then mechanically checked against 8.3 using Emacs Lisp code written for +# the purpose. Unless the ncurses tic implementation and the Lisp code were +# making perfectly synchronized mistakes which I then failed to catch by +# eyeball, the translation was correct and perfectly information-preserving. +# +# Major version number bumps correspond to major version changes in ncurses. +# +# Here is a log of the changes since then: +# +# 9.1.0 (Wed Feb 1 04:50:32 EST 1995): +# * First terminfo master translated from 8.3. +# 9.2.0 (Wed Feb 1 12:21:45 EST 1995): +# * Replaced Wyse entries with updated entries supplied by vendor. +# +# 9.3.0 (Mon Feb 6 19:14:40 EST 1995): +# * Added contact & status info from G. Clark Brown . +# 9.3.1 (Tue Feb 7 12:00:24 EST 1995): +# * Better XENIX keycap translation. Describe TC termcaps. +# * Contact and history info supplied by Qume. +# 9.3.2 (Sat Feb 11 23:40:02 EST 1995): +# * Raided the Shuford FTP site for recent termcaps/terminfos. +# * Added information on X3.64 and VT100 standard escape sequences. +# 9.3.3 (Mon Feb 13 12:26:15 EST 1995): +# * Added a correct X11R6 xterm entry. +# * Fixed terminfo translations of padding. +# 9.3.4 (Wed Feb 22 19:27:34 EST 1995): +# * Added correct acsc/smacs/rmacs strings for vt100 and xterm. +# * Added u6/u7/u8/u9 capabilities. +# * Added PCVT entry. +# 9.3.5 (Thu Feb 23 09:37:12 EST 1995): +# * Emacs uses :so:, not :mr:, for its mode line. Fix linux entry +# to use reverse-video standout so Emacs will look right. +# * Added el1 capability to ansi. +# * Added smacs/rmacs to ansi.sys. +# +# 9.4.0 (Sat Feb 25 16:43:25 EST 1995): +# * New mt70 entry. +# * Added COPYRIGHTS AND OTHER DELUSIONS. +# * Added AT&T 23xx & 500/513, vt220 and vt420, opus3n1+, netronics +# smartvid & smarterm, ampex 175 & 219 & 232, +# env230, falco ts100, fluke, intertube, superbrain, ncr7901, vic20, +# ozzie, trs200, tr600, Tandy & Texas Instruments VDTs, intext2, +# screwpoint, fviewpoint, Contel Business Systems, Datamedia Colorscan, +# adm36, mime314, ergo4000, ca22851. Replaced att7300, esprit, dd5500. +# * Replaced the Perkin-Elmer entries with vendor's official ones. +# * Restored the old minimal-ansi entry, luna needs it. +# * Fixed some incorrect ip and proportional-padding translations. +# 9.4.1 (Mon Feb 27 14:18:33 EST 1995): +# * Fix linux & AT386 sgr strings to do A_ALTCHARSET turnoff correctly. +# * Make the xterm entry 65 lines again; create xterm25 and xterm24 +# to force a particular height. +# * Added beehive4 and reorganized other Harris entries. +# 9.4.2 (Thu Mar 9 01:45:44 EST 1995): +# * Merged in DEC's official entries for its terminals. The only old +# entry I kept was Doug Gwyn's alternate vt100 (as vt100-avo). +# * Replaced the translated BBN Bitgraph entries with purpose-built +# ones from AT&T's SVr3. +# * Replaced the AT&T entries with AT&T's official terminfos. +# * Added teleray 16, vc415, cops10. +# * Merged in many individual capabilities from SCO terminfo files. +# 9.4.3 (Mon Mar 13 02:37:53 EST 1995): +# * Typo fixes. +# * Change linux entry so A_PROTECT enables IBM-PC ROM characters. +# 9.4.4 (Mon Mar 27 12:32:35 EST 1995): +# * Added tty35, Ann Arbor Guru series. vi300 and 550, cg7900, tvi803, +# pt210, ibm3164, IBM System 1, ctrm, Tymshare scanset, dt200, adm21, +# simterm, citoh and variants. +# * Replaced sol entry with sol1 and sol2. +# * Replaced Qume QVT and Freedom-series entries with purpose-built +# terminfo entries. +# * Enhanced vt220, tvi910, tvi924, hpterm, hp2645, adm42, tek +# and dg200 entries using caps from from SCO. +# * Added the usual set of function-key mappings to ANSI entry. +# * Corrected xterm's function-key capabilities. +# 9.4.5 (Tue Mar 28 14:27:49 EST 1995): +# * Fix in xterm entry, cub and cud are not reliable under X11R6. +# 9.4.6 (Thu Mar 30 14:52:15 EST 1995): +# * Fix in xterm entry, get the arrow keys right. +# * Change some \0 escapes to \200. +# 9.4.7 (Tue Apr 4 11:27:11 EDT 1995) +# * Added apple (Videx card), adm1a, oadm31. +# * Fixed malformed ampex csr. +# * Fixed act4, cyb110; they had old-style prefix padding left in. +# * Changed mandatory to advisory padding in many entries. +# * Replaced HP entries up to hpsub with purpose-built ones. +# * Blank rmir/smir/rmdc/smdc capabilities removed. +# * Small fixes merged in from SCO entries for lpr, fos, tvi910+, tvi924. +# 9.4.8 (Fri Apr 7 09:36:34 EDT 199): +# * Replaced the Ann Arbor entries with SCO's, the init strings are +# more efficient (but the entries otherwise identical). +# * Added dg211 from Shuford archive. +# * Added synertek, apple-soroc, ibmpc, pc-venix, pc-coherent, xtalk, +# adm42-nl, pc52, gs6300, xerox820, uts30. +# * Pull SCO's padding into vi200 entry. +# * Improved capabilities for tvi4107 and other Televideo and Viewpoint +# entries merged in from SCO's descriptions. +# * Fixed old-style prefix padding on zen50, h1500. +# * Moved old superbee entry to superbee-xsb, pulled in new superbee +# entry from SCO's description. +# * Reorganized the special entries. +# * Added lm#0 to cbunix and virtual entries. +# +# 9.5.0 (Mon Apr 10 11:30:00 EDT 1995): +# * Restored cdc456tst. +# * Fixed sb1 entry, SCO erroneously left out the xsb glitch. +# * Added megatek, beacon, microkit. +# * Freeze for ncurses-1.9 release. +# 9.5.1 (Fri Apr 21 12:46:42 EDT 1995): +# * Added historical data for TAB. +# * Comment fixes from David MacKenzie. +# * Added the new BSDI pc3 entry. +# 9.5.2 (Tue Apr 25 17:27:52 EDT 1995) +# * A change in the tic -C logic now ensures that all entries in +# the termcap translation will fit in < 1024 bytes. +# * Added `bobcat' and `gator' HP consoles and the Nu machine entries +# from GNU termcap file. This merges in all their local information. +# 9.5.3 (Tue Apr 25 22:28:13 EDT 1995) +# * Changed tic -C logic to dump all capabilities used by GNU termcap. +# * Added warnings about entries with long translations (restoring +# all the GNU termcaps pushes a few over the edge). +# 9.5.4 (Wed Apr 26 15:35:09 EDT 1995) +# * Yet another tic change, and a couple of entry tweaks, to reduce the +# number of long (> 1024) termcap translations back to 0. +# +# 9.6.0 (Mon May 1 10:35:54 EDT 1995) +# * Added kf13-kf20 to Linux entry. +# * Regularize Prime terminal names. +# * Historical data on Synertek. +# * Freeze for ncurses-1.9.1. +# 9.6.1 (Sat May 6 02:00:52 EDT 1995): +# * Added true xterm-color entry, renamed djm's pseudo-color entry. +# * Eliminate whitespace in short name fields, this tanks some scripts. +# * Name field changes to shorten some long entries. +# * Termcap translation now automatically generates empty rmir/smir +# when ich1/ich is present (copes with an ancient vi bug). +# * Added `screen' entries from FSF's screen-3.6.2. +# * Added linux-nic and xterm-nic entries. +# 9.6.2 (Sat May 6 17:00:55 EDT 1995): +# * Change linux entry to use smacs=\E[11m and have an explicit acsc, +# eliminating some special-case code in ncurses. +# +# 9.7.0 (Tue May 9 18:03:12 EDT 1995): +# * Added vt320-k3, rsvidtx from the Emacs termcap.dat file. I think +# that captures everything unique from it. +# * Added reorder script generator. +# * Freeze for ncurses 1.9.2 release. +# 9.7.1 (Thu Jun 29 09:35:22 EDT 1995): +# * Added Sean Farley's kspd, flash, rs1 capabilities for linux. +# * Added Olaf Siebert's corrections for adm12. +# * ansi-pc-color now includes the colors and pairs caps, so that +# entries which use it will inherit them automatically. +# * The linux entry can now recognize the center (keypad 5) key. +# * Removed some junk that found its way into Linux acsc. +# +# 9.8.0 (Fri Jul 7 04:46:57 EDT 1995): +# * Add 50% cut mark as a desperate hack to reduce tic's core usage. +# * xterm doesn't try to use application keypad mode any more. +# * Freeze for ncurses-1.9.3 release. +# 9.8.1 (Thu Jul 19 17:02:12 EDT 1995): +# * Added corrected sun entry from vendor. +# * Added csr capability to linux entry. +# * Peter Wemm says the at386 hpa should be \E[%i%p1%dG, not \E[%p1%dG. +# * Added vt102-nsgr to cope with stupid IBM PC `VT100' emulators. +# * Some commented-out caps in long entries come back in, my code +# for computing string-table lengths had a bug in it. +# * pcansi series modified to fit comm-program reality better. +# 9.8.2 (Sat Sep 9 23:35:00 EDT 1995): +# * BSD/OS actually ships the ibmpc3 bold entry as its console. +# * Correct some bad aliases in the pcansi series +# * Added entry for QNX console. +# * Clean up duplicate long names for use with 4.4 library. +# * Change vt100 standout to be normal reverse vide, not bright reverse; +# this makes the Emacs status line look better. +# 9.8.3 (Sun Sep 10 13:07:34 EDT 1995): +# * Added Adam Thompson's VT320 entries, also his dtx-sas and z340. +# * Minor surgery, mostly on name strings, to shorten termcap version. +# +# 9.9.0 (Sat Sep 16 23:03:48 EDT 1995): +# * Added dec-vt100 for use with the EWAN emulator. +# * Added kmous to xterm for use with xterm's mouse-tracking facility. +# * Freeze for 1.9.5 alpha release. +# 9.9.1 (Wed Sep 20 13:46:09 EDT 1995): +# * Changed xterm lines to 24, the X11R6 default. +# 9.9.2 (Sat Sep 23 21:29:21 EDT 1995): +# * Added 7 newly discovered, undocumented acsc characters to linux +# entry (the pryz{|} characters). +# * ncurses no longer steals A_PROTECT. Simplify linux sgr accordingly. +# * Correct two typos in the xterm entries introduced in 9.9.1. +# * I finally figured out how to translate ko capabilities. Done. +# * Added tvi921 entries from Tim Theisen. +# * Cleanup: dgd211 -> dg211, adm42-nl -> adm42-nsl. +# * Removed mystery tec entry, it was neither interesting nor useful. +# * shortened altos3, qvt203, tvi910+, tvi92D, tvi921-g, tvi955, vi200-f, +# vi300-ss, att505-24, contel301, dm3045, f200vi, pe7000c, vc303a, +# trs200, wind26, wind40, wind50, cdc456tst, dku7003, f110, dg211, +# by making them relative to use capabilities +# * Added cuf1=^L to tvi925 from deleted variant tvi925a. +# * fixed cup in adm22 entry and parametrized strings in vt320-k3. +# * added it#8 to entries that used to have :pt: -- tvi912, vi200, +# ampex80, +# * Translate all home=\E[;H capabilities to home=\E[H, they're +# equivalent. +# * Translate \E[0m -> \E[m in [rs]mso, [rs]mul, and init strings of +# vt100 and ANSI-like terminals. +# 9.9.3 (Tue Sep 26 20:11:15 EDT 1995): +# * Added it#8 and ht=\t to *all* entries with :pt:; the ncurses tic +# does this now, too. +# * fviewpoint is gone, it duplicated screwpoint. +# * Added hp2627, graphos, graphos-30, hpex, ibmega, ibm8514, ibm8514-c, +# ibmvga, ibmvga-c, minix, mm340, mt4520-rv, screen2, screen3, +# versaterm, vi500, vsc, vt131, vt340, vt400 entries from UW. +# The UW vi50 replaces the old one, which becomes vi50adm, +# * No more embedded commas in name fields. +# +# 9.10.0 (Wed Oct 4 15:39:37 EDT 1995): +# * XENIX forms characters in fos, trs16, scoansi become acsc strings, +# * Introduced klone+* entries for describing Intel-console behavior. +# * Linux kbs is default-mapped to delete for some brain-dead reason. +# * -nsl -> -ns. The -pp syntax is obsolete. +# * Eliminate [A-Z]* primaries in accordance with SVr4 terminfo docs. +# * Make xterm entry do application-keypad mode again. I got complaints +# that it was messing up someone's 3270 emulator. +# * Added some longname fields in order to avoid warning messages from +# older tic implementations. +# * According to ctrlseqs.ms, xterm has a full vt100 graphics set. Use +# it! (This gives us pi, greater than, less than, and a few more.) +# * Freeze for ncurses-1.9.6 release. +# 9.10.1 (Sat Oct 21 22:18:09 EDT 1995): +# * Add xon to a number of console entries, they're memory-mapped and +# don't need padding. +# * Correct the use dependencies in the ansi series. +# * Hand-translate more XENIX capabilities. +# * Added hpterm entry for HP's X terminal emulator. +# * Added aixterm entries. +# * Shortened four names so everything fits in 14 chars. +# +# 9.11.0 (Thu Nov 2 17:29:35 EST 1995): +# * Added ibcs2 entry and info on iBCS2 standard. +# * Corrected hpa/vpa in linux entry. They still fail the worm test. +# * We can handle the HP meml/memu capability now. +# * Added smacs to klone entries, just as documentation. +# * Carrected ansi.sys and cit-500 entries. +# * Added z39, vt320-k311, v220c, and avatar entries. +# * Make pcansi use the ansi.sys invis capability. +# * Added DIP switch descriptions for vt100, adm31, tvi910, tvi920c, +# tvi925, tvi950, dt80, ncr7900i, h19. +# * X3.64 has been withdrawn, change some references. +# * Removed function keys from ansi-m entry. +# * Corrected ansi.sys entry. +# * Freeze for ncurses-1.9.7 release. +# 9.11.1 (Tue Nov 6 18:18:38 EST 1995): +# * Added rmam/smam capabilities to many entries based on init strings. +# * Added correct hpa/vpa to linux. +# * Reduced several entries relative to vt52. +# 9.11.2 (Tue Nov 7 00:21:06 EST 1995): +# * Exiled some utterly unidentifiable custom and homebrew types to the +# UFO file; also, obsolete small-screen hardware; also, entries which +# look flat-out incorrect, garbled, or redundant. These include the +# following entries: carlock, cdc456tst, microkit, qdss, ramtek, tec, +# tec400, tec500, ubell, wind, wind16, wind40, wind50, plasma, agile, +# apple, bch, daleblit, nucterm, ttywilliams, nuterminal, nu24, bnu, +# fnu, nunix-30, nunix-61, exidy, ex3000, sexidy, pc52, sanyo55, +# yterm10, yterm11, yterm10nat, aed, aed-ucb, compucolor, compucolor2, +# vic20, dg1, act5s, netx, smartvid, smarterm, sol, sol2, dt200, +# trs80, trs100, trs200, trs600, xitex, rsvidtx, vid, att2300-x40, +# att2350-x40, att4410-nfk, att5410-ns, otty5410, att5425-nl-w, +# tty5425-fk, tty5425-w-fk, cita, c108-na, c108-rv-na, c100-rv-na, +# c108-na-acs, c108-rv-na-acs, ims950-ns, infotonKAS, ncr7900i-na, +# regent60na, scanset-n, tvi921-g, tvi925n, tvi925vbn, tvi925vb, +# vc404-na, vc404-s-na, vt420nam, vt420f-nam, vt420pc-nam, vt510nam, +# vt510pc-nam, vt520nam, vt525nam, xterm25, xterm50, xterm65, xterms. +# * Corrected pcvt25h as suggested by Brian C. Grayson +# . +# 9.11.3 (Thu Nov 9 12:14:40 EST 1995): +# * Added kspd=\E[P, kcbt=\E[Z, to linux entry, changed kbs back to ^H. +# * Added kent=\EOM to xterm entry. +# +# 9.11.4 (Fri Nov 10 08:31:35 EST 1995): +# * Corrected gigi entry. +# * Restored cuf/cud1 to xterm, their apparent bugginess was due to +# bad hpa/vpa capabilities. +# * Corrected flash strings to have a uniform delay of .2 sec. No +# more speed-dependent NUL-padding! +# * terminfo capabilities in comments bracketed with <>. +# 9.11.5 (Fri Nov 10 15:35:02 EST 1995): +# * Replaced pcvt with the 3.31 pcvt entries. +# * Freeze for 1.9.7a. +# 9.11.6 (Mon Nov 13 10:20:24 EST 1995): +# * Added emu entry from the X11R6 contrib tape sources. +# +# 9.12.0 (Wed Nov 29 04:22:25 EST 1995): +# * Improved iris-ansi and sun entries. +# * More flash string improvements. +# * Corrected wy160 & wy160 as suggested by Robert Dunn +# * Added dim to at386. +# * Reconciled pc3 and ibmpc3 with the BSDI termcap file. Keith says +# he's ready to start using the termcap generated from this one. +# * Added vt102-w, vt220-w, xterm-bold, wyse-vp, wy75ap, att4424m, +# ln03, lno3-w, h19-g, z29a*, qdss. Made vt200 an alias of vt220. +# * Improved hpterm, apollo consoles, fos, qvt101, tvi924. tvi925, +# att610, att620, att630, +# * Changed hazeltine name prefix from h to hz. +# * Sent t500 to the UFI file. +# * I think we've sucked all the juice out of BSDI's termcap file now. +# * Freeze for ncurses 1.9.8 release +# 9.12.1 (Thu Nov 30 03:14:06 EST 1995) +# * Unfreeze, linux kbs needed to be fixed. +# * Tim Theisen pinned down a bug in the DMD firmware. +# 9.12.2 (Thu Nov 30 19:08:55 EST 1995): +# * Fixes to ansi and klone capabilities (thank you, Aaron Ucko). +# (The broken ones had been shadowed by sgr.) +# 9.12.3 (Thu Dec 7 17:47:22 EST 1995): +# * Added documentation on ECMA-48 standard. +# * New Amiga entry. +# 9.12.4 (Thu Dec 14 04:16:39 EST 1995): +# * More ECMA-48 stuff +# * Corrected typo in minix entry, added pc-minix. +# * Corrected khome/kend in xterm (thank you again, Aaron Ucko). +# * Added rxvt entry. +# * Added 1.3.x color-change capabilities to linux entry. +# 9.12.5 (Tue Dec 19 00:22:10 EST 1995): +# * Corrected rxvt entry khome/kend. +# * Corrected linux color change capabilities. +# * NeXT entries from Dave Wetzel. +# * Cleaned up if and rf file names (all in /usr/share now). +# * Changed linux op capability to avoid screwing up a background color +# pair set by setterm. +# 9.12.6 (Wed Feb 7 16:14:35 EST 1996): +# * Added xterm-sun. +# 9.12.7 (Fri Feb 9 13:27:35 EST 1996): +# * Added visa50. +# +# 9.13.0 (Sun Mar 10 00:13:08 EST 1996): +# * Another sweep through the Shuford archive looking for new info. +# * Added dg100 alias to dg6053 based on a comp.terminals posting. +# * Added st52 from Per Persson. +# * Added eterm from the GNU Emacs 19.30 distribution. +# * Freeze for 1.9.9. +# 9.13.1 (Fri Mar 29 14:06:46 EST 1996): +# * FreeBSD console entries from Andrew Chernov. +# * Removed duplicate Atari st52 name. +# 9.13.2 (Tue May 7 16:10:06 EDT 1996) +# * xterm doesn't actually have ACS_BLOCK. +# * Change klone+color setf/setb to simpler forms that can be +# translated into termcap. +# * Added xterm1. +# * Removed mechanically-generated junk capabilities from cons* entries. +# * Added color support to bsdos. +# 9.13.3 (Thu May 9 10:35:51 EDT 1996): +# * Added Wyse 520 entries from Wm. Randolph Franklin . +# * Created ecma+color, linux can use it. Also added ech to linux. +# * Teach xterm about more keys. Add Thomas Dickey's 3.1.2E updates. +# * Add descriptions to FreeBSD console entries. Also shorten +# some aliases to <= 14 chars for portability. +# * Added x68k console +# * Added OTbs to several VT-series entries. +# 9.13.4 (Wed May 22 10:54:09 EDT 1996): +# * screen entry update for 3.7.1 from Michael Alan Dorfman. +# 9.13.5 (Wed Jun 5 11:22:41 EDT 1996): +# * kterm correction due to Kenji Rikitake. +# * ACS correction in vt320-kll due to Phillippe De Muyter. +# 9.13.6 (Sun Jun 16 15:01:07 EDT 1996): +# * Sun console entry correction from J.T. Conklin. +# * Changed all DEC VT300 and up terminals to use VT300 tab set +# 9.13.7 (Mon Jul 8 20:14:32 EDT 1996): +# * Added smul to linux entry (we never noticed it was missing +# because of sgr!). +# * Added rmln to hp+labels (deduced from other HP entries). +# * Added vt100 acsc capability to vt220, vt340, vt400, d800, dt80-sas, +# pro350, att7300, 5420_2, att4418, att4424, att4426, att505, vt320-k3. +# * Corrected vt220 acsc. +# * The klone+sgr and klone+sgr-dumb entries now use klone+acs; +# this corresponds to reality and helps prevent some tic warnings. +# * Added sgr0 to c101, pcix, vt100-nav, screen2, oldsun, next, altos2, +# hpgeneric, hpansi, hpsub, hp236, hp700-wy, bobcat, dku7003, adm11, +# adm12, adm20, adm21, adm22, adm31, adm36, adm42, pt100, pt200, +# qvt101, tvi910, tvi921, tvi92B, tvi925, tvi950, tvi970, wy30-mc, +# wy50-mc, wy100, wyse-vp, ampex232, regent100, viewpoint, vp90, +# adds980, cit101, cit500, contel300, cs10, dm80, falco, falco-p, +# f1720a, go140, sb1, superbeeic, microb, ibm8512, kt7, ergo4000, +# owl, uts30, dmterm, dt100, dt100, dt110, appleII, apple-videx, +# lisa, trsII, atari, st52, pc-coherent, basis, m2-man, bg2.0, bg1.25, +# dw3, ln03, ims-ansi, graphos, t16, zen30, xtalk, simterm, d800, +# ifmr, v3220, wy100q, tandem653, ibmaed. +# * Added DWK terminal description. +# 9.13.8 (Wed Jul 10 11:45:21 EDT 1996): +# * Many entries now have highlights inherited from adm+sgr. +# * xterm entry now corresponds to XFree86 3.1.2E, with color. +# * xtitle and xtitle-twm enable access to the X status line. +# * Added linux-1.3.6 color palette caps in conventional format. +# * Added adm1178 terminal. +# * Move fos and apollo terminals to obsolete category. +# * Aha! The BRL terminals file told us what the Iris extensions mean. +# * Added, from the BRL termcap file: rt6221, rt6221-w, northstar, +# commodore, cdc721-esc, excel62, osexec. Replaced from the BRL file: +# cit500, adm11. +# 9.13.9 (Mon Jul 15 00:32:51 EDT 1996): +# * Added, from the BRL termcap file: cdc721, cdc721l, cdc752, cdc756, +# aws, awsc, zentec8001, modgraph48, rca vp3301/vp3501, ex155. +# * Corrected, from BRL termcap file: vi50. +# * Better rxvt entry & corrected xterm entries from Thomas Dickey. +# 9.13.10 (Mon Jul 15 12:20:13 EDT 1996): +# * Added from BRL: cit101e & variants, hmod1, vi200, ansi77, att5620-1, +# att5620-s, att5620-s, dg210, aas1901, hz1520, hp9845, osborne +# (old osborne moved to osborne-w), tvi970-vb, tvi970-2p, tvi925-hi, +# tek4105brl, tek4106brl, tek4107brl,tek4109brl, hazel, aepro, +# apple40p, apple80p, appleIIgs, apple2e, apple2e-p, apple-ae. +# * Paired-attribute fixes to various terminals. +# * Sun entry corrections from A. Lukyanov & Gert-Jan Vons. +# * xterm entry corrections from Thomas Dickey. +# 9.13.11 (Tue Jul 30 16:42:58 EDT 1996): +# * Added t916 entry, translated from a termcap in SCO's support area. +# * New qnx entry from Michael Hunter. +# 9.13.12 (Mon Aug 5 14:31:11 EDT 1996): +# * Added hpex2 from Ville Sulko. +# * Fixed a bug that ran the qnx and pcvtXX together. +# 9.13.13 (Fri Aug 9 01:16:17 EDT 1996): +# * Added dtterm entry from Solaris CDE. +# 9.13.14 (Tue Sep 10 15:31:56 EDT 1996): +# * corrected pairs#8 typo in dtterm entry. +# * added tvi9065. +# 9.13.15 (Sun Sep 15 02:47:05 EDT 1996): +# * updated xterm entry to cover 3.1.2E's new features. +# 9.13.16 (Tue Sep 24 12:47:43 EDT 1996): +# * Added new minix entry +# * Removed aliases of the form ^[0-9]* for obsolete terminals. +# * Commented out linux-old, nobody's using pre-1.2 kernels now. +# 9.13.17 (Fri Sep 27 13:25:38 EDT 1996): +# * Added Prism entries and kt7ix. +# * Caution notes about EWAN and tabset files. +# * Changed /usr/lib/tabset -> /usr/share/tabset. +# * Added acsc/rmacs/smacs to vt52. +# 9.13.18 (Mon Oct 28 13:24:59 EST 1996): +# * Merged in Thomas Dickey's reorganization of the xterm entries; +# added technical corrections to avoid warning messages. +# 9.13.19 (Sat Nov 16 16:05:49 EST 1996): +# * Added rmso=\E[27m in Linux entry. +# * Added koi8-r support for Linux console. +# * Replace xterm entries with canonical ones from XFree86 3.2. +# 9.13.20 (Sun Nov 17 23:02:51 EST 1996): +# * Added color_xterm from Jacob Mandelson +# 9.13.21 (Mon Nov 18 12:43:42 EST 1996): +# * Back off the xterm entry to use r6 as a base. +# 9.13.22 (Sat Nov 30 11:51:31 EST 1996): +# * Added dec-vt220 at Adrian Garside's request. +# +# 10.1.0 (Sun Dec 29 02:36:31 EST 1996): +# * Minor corrections to xterm entries. +# * Replaced EWAN telnet entry. +# * Dropped the reorder script generator. It was a fossil. +# 10.1.1 (Sat May 3 21:41:27 EDT 1997): +# * Use setaf/setab consistently with SVr4. +# * Remove ech, el1 from cons25w, they do not work in FreeBSD 2.1.5 +# +# The following sets edit modes for GNU EMACS +# Local Variables: +# fill-prefix:"\t" +# fill-column:75 +# End: +######## SHANTIH! SHANTIH! SHANTIH! diff --git a/mk-0th.awk b/mk-0th.awk new file mode 100644 index 00000000..a4a3a543 --- /dev/null +++ b/mk-0th.awk @@ -0,0 +1,70 @@ +# $Id: mk-0th.awk,v 1.3 1996/12/01 00:27:23 tom Exp $ +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Generate list of sources for a library, together with lint/lintlib rules +# +# Variables: +# name (library name, e.g., "ncurses", "panel", "forms", "menus") +# +BEGIN { + print "" + print "# generated by mk-0th.awk" + print "" + found = 0; + } + !/^#/ { + if ( $2 == "lib" ) + { + if ( found == 0 ) + { + printf "C_SRC =" + found = 1 + } + printf " \\\n\t%s/%s.c", $3, $1 + } + } +END { + print "" + if ( found != 0 ) + { + print "" + printf "# Producing llib-l%s is time-consuming, so there's no direct-dependency for\n", name + print "# it in the lintlib rule. We'll only remove in the cleanest setup." + print "clean ::" + printf "\trm -f llib-l%s.*\n", name + print "" + print "realclean ::" + printf "\trm -f llib-l%s\n", name + print "" + printf "llib-l%s : $(C_SRC)\n", name + printf "\tcproto -a -l -DLINT $(CPPFLAGS) $(C_SRC) >$@\n" + print "" + print "lintlib :" + printf "\t$(srcdir)/../misc/makellib %s $(CPPFLAGS)", name + print "" + print "lint :" + print "\t$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(C_SRC) $(LINT_LIBS)" + } + else + { + print "lintlib :" + print "\t@echo no action needed" + } + } diff --git a/mk-1st.awk b/mk-1st.awk new file mode 100644 index 00000000..235ceab0 --- /dev/null +++ b/mk-1st.awk @@ -0,0 +1,165 @@ +# $Id: mk-1st.awk,v 1.20 1997/05/05 21:28:17 tom Exp $ +################################################################################ +# Copyright 1996,1997 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Generate list of objects for a given model library +# Variables: +# name (library name, e.g., "ncurses", "panel", "forms", "menus") +# model (directory into which we compile, e.g., "obj") +# suffix (e.g., "_g.a", for debug libraries) +# MODEL (e.g., "DEBUG", uppercase; toupper is not portable) +# DoLinks ("yes" or "no", flag to add symbolic links) +# rmSoLocs ("yes" or "no", flag to add extra clean target) +# overwrite ("yes" or "no", flag to add link to libcurses.a +# +# Notes: +# CLIXs nawk does not like underscores in command-line variable names. +# Mixed-case is ok. +# HP/UX requires shared libraries to have executable permissions. +# +function symlink(src,dst) { + if ( src != dst ) { + printf "rm -f %s; ", dst + printf "$(LN_S) %s %s; ", src, dst + } + } +function sharedlinks(directory) { + if ( end_name != lib_name ) { + printf "\tcd %s && (", directory + abi_name = sprintf("%s.$(ABI_VERSION)", lib_name); + symlink(end_name, abi_name); + symlink(abi_name, lib_name); + printf ")\n" + } + } +function removelinks() { + if ( end_name != lib_name ) { + printf "\trm -f ../lib/%s ../lib/%s\n", abi_name, end_name + } + } +function installed_name() { + if ( DO_LINKS == "yes" ) { + return sprintf("%s.$(REL_VERSION)", lib_name); + } else { + return lib_name; + } + } +BEGIN { + print "" + print "# generated by mk-1st.awk" + print "" + found = 0; + } + !/^#/ { + if ( $2 == "lib" || $2 == "progs" ) + { + if ( found == 0 ) + { + printf "%s_OBJS =", MODEL + if ( $2 == "lib" ) + found = 1 + else + found = 2 + } + printf " \\\n\t../%s/%s.o", model, $1 + } + } +END { + print "" + if ( found != 0 ) + { + printf "\n$(%s_OBJS) : %s\n", MODEL, depend + } + if ( found == 1 ) + { + print "" + lib_name = sprintf("lib%s%s", name, suffix) + if ( MODEL == "SHARED" ) + { + if ( DoLinks == "yes" ) { + end_name = sprintf("%s.$(REL_VERSION)", lib_name); + } else { + end_name = lib_name; + } + printf "../lib/%s : $(%s_OBJS)\n", lib_name, MODEL + print "\t@-rm -f $@" + printf "\t$(MK_SHARED_LIB) $(%s_OBJS)\n", MODEL + sharedlinks("../lib") + print "" + if ( end_name != lib_name ) { + printf "../lib/%s : ../lib/%s\n", end_name, lib_name + } + print "" + print "install \\" + print "install.libs \\" + printf "install.%s :: $(INSTALL_PREFIX)$(libdir) ../lib/%s\n", name, end_name + printf "\t@echo installing ../lib/%s as $(INSTALL_PREFIX)$(libdir)/%s \n", lib_name, end_name + printf "\t-rm -f $(INSTALL_PREFIX)$(libdir)/%s \n", end_name + printf "\t$(INSTALL) ../lib/%s $(INSTALL_PREFIX)$(libdir)/%s \n", lib_name, end_name + sharedlinks("$(INSTALL_PREFIX)$(libdir)") + if ( overwrite == "yes" && name == "ncurses" ) + { + ovr_name = sprintf("libcurses%s", suffix) + printf "\t@echo linking %s to %s\n", ovr_name, lib_name + printf "\t-rm -f $(INSTALL_PREFIX)$(libdir)/%s \n", ovr_name + printf "\t(cd $(INSTALL_PREFIX)$(libdir) && $(LN_S) %s %s)\n", lib_name, ovr_name + } + printf "\t- ldconfig\n" + if ( rmSoLocs == "yes" ) { + print "" + print "mostlyclean \\" + print "clean ::" + printf "\t@-rm -f so_locations\n" + } + } + else + { + end_name = lib_name; + printf "../lib/%s : $(%s_OBJS)\n", lib_name, MODEL + printf "\t$(AR) $(AR_OPTS) $@ $?\n" + printf "\t$(RANLIB) $@\n" + print "" + print "install \\" + print "install.libs \\" + printf "install.%s :: $(INSTALL_PREFIX)$(libdir) ../lib/%s\n", name, lib_name + printf "\t@echo installing ../lib/%s as $(INSTALL_PREFIX)$(libdir)/%s \n", lib_name, lib_name + printf "\t$(INSTALL_DATA) ../lib/%s $(INSTALL_PREFIX)$(libdir)/%s \n", lib_name, lib_name + if ( overwrite == "yes" && lib_name == "libncurses.a" ) + { + printf "\t@echo linking libcurses.a to libncurses.a \n" + printf "\t-rm -f $(INSTALL_PREFIX)$(libdir)/libcurses.a \n" + printf "\t(cd $(INSTALL_PREFIX)$(libdir) && $(LN_S) libncurses.a libcurses.a)\n" + } + printf "\t$(RANLIB) $(INSTALL_PREFIX)$(libdir)/%s\n", lib_name + } + print "" + print "mostlyclean \\" + print "clean ::" + printf "\trm -f ../lib/%s\n", lib_name + printf "\trm -f $(%s_OBJS)\n", MODEL + removelinks(); + } + else if ( found == 2 ) + { + print "" + print "mostlyclean \\" + print "clean ::" + printf "\trm -f $(%s_OBJS)\n", MODEL + } + } diff --git a/mk-2nd.awk b/mk-2nd.awk new file mode 100644 index 00000000..cc1db565 --- /dev/null +++ b/mk-2nd.awk @@ -0,0 +1,75 @@ +# $Id: mk-2nd.awk,v 1.7 1996/12/01 00:26:51 tom Exp $ +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Generate compile-rules for the modules that we are using in libraries or +# programs. We are listing them explicitly because we have turned off the +# suffix rules (to force compilation with the appropriate flags). We could use +# make-recursion but that would result in makefiles that are useless for +# development. +# +# Variables: +# model +# MODEL (uppercase version of "model"; toupper is not portable) +# echo (yes iff we will show the $(CC) lines) +# +# Fields in src/modules: +# $1 = module name +# $2 = progs|lib|c++ +# $3 = source-directory +# +# Fields in src/modules past $3 are dependencies +# +BEGIN { + print "" + print "# generated by mk-2nd.awk" + print "" + } + !/^#/ { + if ( $1 != "" ) { + print "" + if ( $2 == "c++" ) { + compile="CXX" + suffix=".cc" + } else { + compile="CC" + suffix=".c" + } + printf "../%s/%s.o :\t%s/%s%s", model, $1, $3, $1, suffix + for (n = 4; n <= NF; n++) printf " \\\n\t\t\t%s", $n + print "" + if ( echo == "yes" ) + atsign="" + else { + atsign="@" + printf "\t@echo 'compiling %s (%s)'\n", $1, model + } + if ( $3 == "." || srcdir == "." ) + printf "\t%scd ../%s; $(%s) $(CFLAGS_%s) -c ../%s/%s%s", atsign, model, compile, MODEL, name, $1, suffix + else + printf "\t%scd ../%s; $(%s) $(CFLAGS_%s) -c %s/%s%s", atsign, model, compile, MODEL, $3, $1, suffix + } else { + printf "%s", $1 + for (n = 2; n <= NF; n++) printf " %s", $n + } + print "" + } +END { + print "" + } diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 00000000..91f6d04e --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,32 @@ +#!/bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Last modified: 1994-03-25 +# Public domain + +errstatus=0 + +for file in ${1+"$@"} ; do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d in ${1+"$@"} ; do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + mkdir "$pathcomp" || errstatus=$? + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/ncurses.lsm b/ncurses.lsm new file mode 100644 index 00000000..46dc4bd8 --- /dev/null +++ b/ncurses.lsm @@ -0,0 +1,30 @@ +Begin3 +Title: ncurses +Version: 4.1 +Entered-date: 05MAY97 +Description: SVr4 and XSI-Curses compatible curses library and terminfo + tools including tic, infocmp, captoinfo. The library can + be configured to fall back to reading /etc/termcap for + backward compatibility with BSD curses, but the distribution + includes a copy of the master terminfo database. Supports + color, multiple highlights, forms-drawing characters, and + automatic recognition of keypad and function-key sequences. + Extensions include resizable windows and mouse support on both + xterm and Linux console using the gpm library. C++ binding + (not supported) and example. Ada95 binding and examples. + Includes man pages, test programs. Approved to replace 4.4BSD + curses, June 1995. +Keywords: curses, interface, screen, library +Author: zmbenhal@netcom.com (Zeyd Ben-Halim) + dickey@clark.net (Thomas Dickey) + esr@snark.thyrsus.com (Eric S. Raymond) + juergen.pfeifer@T-Online.de (Juergen Pfeifer) +Maintained-by: dickey@clark.net (Thomas Dickey) + juergen.pfeifer@T-Online.de (Juergen Pfeifer) +Primary-site: ftp.clark.net /pub/dickey/ncurses + ncurses-4.1.tar.gz +Platforms: Portable to any ANSI/POSIX system. +Alternate-site: ftp.netcom.com /pub/zm/zmbenhal/ncurses +Alternate-site: prep.ai.mit.edu /pub/gnu +Copying-policy: BSD-like. +End diff --git a/ncurses/MKcaptab.awk b/ncurses/MKcaptab.awk new file mode 100644 index 00000000..d028cb2d --- /dev/null +++ b/ncurses/MKcaptab.awk @@ -0,0 +1,66 @@ +#!/bin/sh +# $Id: MKcaptab.awk,v 1.9 1997/04/05 23:38:24 tom Exp $ +AWK=${1-awk} +DATA=${2-../include/Caps} + +cat <<'EOF' +/* + * comp_captab.c -- The names of the capabilities indexed via a hash + * table for the compiler. + * + */ + +#include +#include +#include +#include + +EOF + +./make_hash 1 info <$DATA +./make_hash 3 cap <$DATA + +cat <<'EOF' +const struct alias _nc_capalias_table[] = +{ +EOF + +$AWK <$DATA ' +$1 == "capalias" { + if ($3 == "IGNORE") + to = "(char *)NULL"; + else + to = "\"" $3 "\""; + printf "\t{\"%s\", %s, \"%s\"},\t /* %s */\n", + $2, to, $4, $5 + } +' + +cat <<'EOF' + {(char *)NULL, (char *)NULL, (char *)NULL} +}; + +const struct alias _nc_infoalias_table[] = +{ +EOF + +$AWK <$DATA ' +$1 == "infoalias" { + if ($3 == "IGNORE") + to = "(char *)NULL"; + else + to = "\"" $3 "\""; + printf "\t{\"%s\", %s, \"%s\"},\t /* %s */\n", + $2, to, $4, $5 + } +' + +cat <<'EOF' + {(char *)NULL, (char *)NULL, (char *)NULL} +}; + +const struct name_table_entry *_nc_get_table(bool termcap) +{ + return termcap ? _nc_cap_table: _nc_info_table ; +} +EOF diff --git a/ncurses/MKexpanded.sh b/ncurses/MKexpanded.sh new file mode 100755 index 00000000..53624449 --- /dev/null +++ b/ncurses/MKexpanded.sh @@ -0,0 +1,96 @@ +#!/bin/sh +################################################################################ +# Copyright 1997 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# $Id: MKexpanded.sh,v 1.4 1997/05/10 20:21:58 tom Exp $ +# +# Script to generate 'expanded.c', a dummy source that contains functions +# corresponding to complex macros used in this library. By making functions, +# we simplify analysis and debugging. + +if test $# != 0; then +preprocessor="$1" +else +preprocessor="cc -E" +fi +shift +if test $# != 0 ; then + preprocessor="$preprocessor $*" +else + preprocessor="$preprocessor -DHAVE_CONFIG_H -I. -I../include" +fi + +TMP=gen$$.c +trap "rm -f $TMP" 0 1 2 5 15 + +cat >expanded.c < +#include +#ifdef NCURSES_EXPANDED +EOF + +cat >$TMP < +#undef NCURSES_EXPANDED /* this probably is set in ncurses_cfg.h */ +#include +/* these are names we'd like to see */ +#undef ALL_BUT_COLOR +#undef PAIR_NUMBER +#undef TRUE +#undef FALSE +/* this is a marker */ +IGNORE +chtype _nc_ch_or_attr(chtype ch, attr_t at) +{ + return ch_or_attr(ch,at); +} +void _nc_toggle_attr_on(attr_t *S, attr_t at) +{ + toggle_attr_on(*S,at); +} +void _nc_toggle_attr_off(attr_t *S, attr_t at) +{ + toggle_attr_off(*S,at); +} +int _nc_can_clear_with(chtype ch) +{ + return can_clear_with(ch); +} +int _nc_DelCharCost(int count) +{ + return DelCharCost(count); +} +int _nc_InsCharCost(int count) +{ + return InsCharCost(count); +} +void _nc_UpdateAttrs(chtype c) +{ + UpdateAttrs(c); +} +EOF + +$preprocessor $TMP 2>/dev/null | sed -e '1,/^IGNORE$/d' >>expanded.c + +cat >>expanded.c < +#include + +EOF + +if [ "$*" ] +then + cat < + +/* fallback entries for: $* */ + +static const TERMTYPE fallbacks[$#] = +{ +EOF + comma="" + for x in $* + do + echo "$comma /* $x */" + infocmp -e $x + comma="," + done + + cat <term_names, name, "|")) + return(tp); +EOF +else + echo " /* the fallback list is empty */"; +fi + +cat <" + print "#include " + print "#include " + print "#include " + print "" + print "struct kn {" + print "\tconst char *name;" + print "\tint code;" + print "};" + print "" + print "const struct kn key_names[] = {" +} + +{printf "\t{\"%s\", %s,},\n", $1, $2;} + +END { + print "};" + print "" + print "const char *keyname(int c)" + print "{" + print "int i, size = sizeof(key_names)/sizeof(struct kn);" + print "" + print "\tfor (i = 0; i < size; i++) {" + print "\t\tif (key_names[i].code == c) return key_names[i].name;" + print "\t}" + print "\treturn NULL;" + print "}" + print "" +} diff --git a/ncurses/MKkeys.awk b/ncurses/MKkeys.awk new file mode 100644 index 00000000..669c455e --- /dev/null +++ b/ncurses/MKkeys.awk @@ -0,0 +1 @@ +{printf "\tadd_to_try(%s, %s);\n", $1, $2;} diff --git a/ncurses/MKlib_gen.sh b/ncurses/MKlib_gen.sh new file mode 100755 index 00000000..a08dc0a0 --- /dev/null +++ b/ncurses/MKlib_gen.sh @@ -0,0 +1,212 @@ +#!/bin/sh +# +# MKlib_gen.sh -- generate sources from curses.h macro definitions +# +# ($Id: MKlib_gen.sh,v 1.9 1997/05/10 23:48:19 tom Exp $) +# +# The XSI Curses standard requires all curses entry points to exist as +# functions, even though many definitions would normally be shadowed +# by macros. Rather than hand-hack all that code, we actually +# generate functions from the macros. +# +# This script accepts a file of prototypes on standard input. It discards +# any that don't have a `generated' comment attached. It then parses each +# prototype (relying on the fact that none of the macros take function +# pointer or array arguments) and generates C source from it. +# +# Here is what the pipeline stages are doing: +# +# 1. sed: extract prototypes of generated functions +# 2. sed: decorate prototypes with generated arguments a1. a2,...z +# 3. awk: generate the calls with args matching the formals +# 4. sed: prefix function names in prototypes so the preprocessor won't expand +# them. +# 5. cpp: macro-expand the file so the macro calls turn into C calls +# 6. awk: strip the expansion junk off the front and add the new header +# 7. sed: squeeze spaces, strip off gen_ prefix, create needed #undef +# + +preprocessor="$1 -I../include" +AWK="$2" +TMP=gen$$.c +trap "rm -f $TMP" 0 1 2 5 15 + +(cat < +#include + +DECLARATIONS + +EOF +sed -n -e "/^extern.*generated/s/^extern \([^;]*\);.*/\1/p" \ +| sed \ + -e "/(void)/b nc" \ + -e "s/,/ a1% /" \ + -e "s/,/ a2% /" \ + -e "s/,/ a3% /" \ + -e "s/,/ a4% /" \ + -e "s/,/ a5% /" \ + -e "s/,/ a6% /" \ + -e "s/,/ a7% /" \ + -e "s/,/ a8% /" \ + -e "s/,/ a9% /" \ + -e "s/,/ a10% /" \ + -e "s/,/ a11% /" \ + -e "s/,/ a12% /" \ + -e "s/,/ a13% /" \ + -e "s/,/ a14% /" \ + -e "s/,/ a15% /" \ + -e "s/*/ * /g" \ + -e "s/%/ , /g" \ + -e "s/)/ z)/" \ + -e ":nc" \ + -e "/(/s// ( /" \ + -e "s/)/ )/" \ +| $AWK '{ + print "\n" + + print "M_" $2 + print $0; + print "{"; + argcount = 1; + if (NF == 5 && $4 == "void") + argcount = 0; + if (argcount != 0) { + for (i = 1; i <= NF; i++) + if ($i == ",") + argcount++; + } + + # suppress trace-code for functions that we cannot do properly here, + # since they return data. + dotrace = 1; + if ($2 == "innstr") + dotrace = 0; + + call = "%%T((T_CALLED(\"" + args = "" + comma = "" + num = 0; + pointer = 0; + argtype = "" + for (i = 1; i <= NF; i++) { + ch = $i; + if ( ch == "*" ) + pointer = 1; + else if ( ch == "va_list" ) + pointer = 1; + else if ( ch == "char" ) + argtype = "char"; + else if ( ch == "int" ) + argtype = "int"; + else if ( ch == "short" ) + argtype = "short"; + else if ( ch == "chtype" ) + argtype = "chtype"; + else if ( ch == "attr_t" || ch == "NCURSES_ATTR_T" ) + argtype = "attr"; + + if ( ch == "," || ch == ")" ) { + if (pointer) { + if ( argtype == "char" ) { + call = call "%s" + comma = comma "_nc_visbuf2(" num "," + pointer = 0; + } else + call = call "%p" + } else if (argcount != 0) { + if ( argtype == "int" || argtype == "short" ) { + call = call "%d" + argtype = "" + } else if ( argtype != "" ) { + call = call "%s" + comma = comma "_trace" argtype "2(" num "," + } else { + call = call "%#lx" + comma = comma "(long)" + } + } + if (ch == ",") + args = args comma "a" ++num; + else if (argcount != 0) + args = args comma "z" + call = call ch + if (pointer == 0 && argcount != 0 && argtype != "" ) + args = args ")" + if (args != "") + comma = ", " + pointer = 0; + argtype = "" + } + if ( i == 2 || ch == "(" ) + call = call ch + } + call = call "\")" + if (args != "") + call = call ", " args + call = call ")); " + + if (dotrace) + printf "%s", call + + if (match($0, "^void")) + call = "" + else if (dotrace) + call = "returnCode( "; + else + call = "%%return "; + + call = call $2 "("; + for (i = 1; i < argcount; i++) + call = call "a" i ", "; + if (argcount != 0) + call = call "z"; + if (!match($0, "^void")) + call = call ") "; + if (dotrace) + call = call ")"; + print call ";" + + if (match($0, "^void")) + print "%%returnVoid;" + print "}"; +} +' ) \ +| sed \ + -e '/^\([a-z_][a-z_]*\) /s//\1 gen_/' >$TMP + $preprocessor $TMP 2>/dev/null \ +| $AWK ' +BEGIN { + print "/*" + print " * DO NOT EDIT THIS FILE BY HAND!" + print " * It is generated by MKlib_gen.sh." + print " *" + print " * This is a file of trivial functions generated from macro" + print " * definitions in curses.h in order to satisfy the XSI Curses" + print " * requirement that every macro also exist as a callable" + print " * function." + print " *" + print " * It will never be linked unless you call one of the entry" + print " * points with its normal macro definition disabled. In that" + print " * case, if you have no shared libraries, it will indirectly" + print " * pull most of the rest of the library into your link image." + print " * Cope with it." + print " */" + print "#include " + print "" + } +/^DECLARATIONS/ {start = 1; next;} + {if (start) print $0;} +' \ +| sed \ + -e 's/ */ /g' \ + -e 's/ */ /g' \ + -e 's/ ,/,/g' \ + -e 's/ )/)/g' \ + -e 's/ gen_/ /' \ + -e 's/^M_/#undef /' \ + -e '/^%%/s// /' \ +| sed \ + -e 's/^.*T_CALLED.*returnCode( \([a-z].*) \));/ return \1;/' \ + -e 's/^.*T_CALLED.*returnCode( \((wmove.*) \));/ return \1;/' + diff --git a/ncurses/MKnames.awk b/ncurses/MKnames.awk new file mode 100644 index 00000000..33075095 --- /dev/null +++ b/ncurses/MKnames.awk @@ -0,0 +1,98 @@ +# $Id: MKnames.awk,v 1.8 1997/05/10 16:11:33 tom Exp $ +BEGIN { + print "/* This file was generated by MKnames.awk */" > "namehdr" + print "" > "namehdr" + print "#include " > "namehdr" + print "" > "namehdr" + print "#define IT NCURSES_CONST char * const" > "namehdr" + print "" > "namehdr" + print "#if BROKEN_LINKER" > "namehdr" + print "#include " > "namehdr" + print "#define DCL(it) static IT data##it[]" > "namehdr" + print "#else" > "namehdr" + print "#define DCL(it) IT it[]" > "namehdr" + print "#endif" > "namehdr" + print "" > "namehdr" + print "/*" > "boolnames" + print " * names.c - Arrays of capability names and codes" > "boolnames" + print " *" > "boolnames" + print " */" > "boolnames" + print "" > "boolnames" + print "DCL(boolnames) = {" > "boolnames" + print "DCL(boolfnames) = {" > "boolfnames" + print "DCL(boolcodes) = {" > "boolcodes" + print "DCL(numnames) = {" > "numnames" + print "DCL(numfnames) = {" > "numfnames" + print "DCL(numcodes) = {" > "numcodes" + print "DCL(strnames) = {" > "strnames" + print "DCL(strfnames) = {" > "strfnames" + print "DCL(strcodes) = {" > "strcodes" + } + +$1 ~ /^#/ {next;} + +$1 == "SKIPWARN" {next;} + +$3 == "bool" { + printf "\t\t\"%s\",\n", $2 > "boolnames" + printf "\t\t\"%s\",\n", $1 > "boolfnames" + printf "\t\t\"%s\",\n", $4 > "boolcodes" + } + +$3 == "num" { + printf "\t\t\"%s\",\n", $2 > "numnames" + printf "\t\t\"%s\",\n", $1 > "numfnames" + printf "\t\t\"%s\",\n", $4 > "numcodes" + } + +$3 == "str" { + printf "\t\t\"%s\",\n", $2 > "strnames" + printf "\t\t\"%s\",\n", $1 > "strfnames" + printf "\t\t\"%s\",\n", $4 > "strcodes" + } + +END { + print "\t\t(NCURSES_CONST char *)0," > "boolnames" + print "};" > "boolnames" + print "" > "boolnames" + print "\t\t(NCURSES_CONST char *)0," > "boolfnames" + print "};" > "boolfnames" + print "" > "boolfnames" + print "\t\t(NCURSES_CONST char *)0," > "boolcodes" + print "};" > "boolcodes" + print "" > "boolcodes" + print "\t\t(NCURSES_CONST char *)0," > "numnames" + print "};" > "numnames" + print "" > "numnames" + print "\t\t(NCURSES_CONST char *)0," > "numfnames" + print "};" > "numfnames" + print "" > "numfnames" + print "\t\t(NCURSES_CONST char *)0," > "numcodes" + print "};" > "numcodes" + print "" > "numcodes" + print "\t\t(NCURSES_CONST char *)0," > "strnames" + print "};" > "strnames" + print "" > "strnames" + print "\t\t(NCURSES_CONST char *)0," > "strfnames" + print "};" > "strfnames" + print "" > "strfnames" + print "\t\t(NCURSES_CONST char *)0," > "strcodes" + print "};" > "strcodes" + print "" > "strcodes" + print "#if BROKEN_LINKER" > "nameftr" + print "#define FIX(it) IT *_nc_##it(void) { return data##it; }" > "nameftr" + print "FIX(boolnames)" > "nameftr" + print "FIX(boolfnames)" > "nameftr" + print "FIX(numnames)" > "nameftr" + print "FIX(numfnames)" > "nameftr" + print "FIX(strnames)" > "nameftr" + print "FIX(strfnames)" > "nameftr" + print "#endif /* BROKEN_LINKER */" > "nameftr" + print "" > "codeftr" + print "#if BROKEN_LINKER" > "codeftr" + print "#define FIX(it) IT *_nc_##it(void) { return data##it; }" > "codeftr" + print "FIX(boolcodes)" > "codeftr" + print "FIX(numcodes)" > "codeftr" + print "FIX(strcodes)" > "codeftr" + print "#endif /* BROKEN_LINKER */" > "codeftr" + } diff --git a/ncurses/MKunctrl.awk b/ncurses/MKunctrl.awk new file mode 100644 index 00000000..34d8cd3b --- /dev/null +++ b/ncurses/MKunctrl.awk @@ -0,0 +1,54 @@ +# $Id: MKunctrl.awk,v 1.3 1997/04/26 23:04:45 tom Exp $ +################################################################################ +# Copyright 1997 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ + +BEGIN { + print "/* generated by MKunctrl.awk */" + print + print "#include " + print + } +END { + print "NCURSES_CONST char *unctrl(register chtype ch)" + print "{" + printf "static const char* const table[] = {" + for ( ch = 0; ch < 256; ch++ ) { + gap = "," + if ((ch % 8) == 0) + printf "\n " + if (ch < 32) { + printf "\"^\\%03o\"", ch + 64 + } else if (ch == 127) { + printf "\"^?\"" + } else { + printf "\"\\%03o\"", ch + gap = gap " " + } + if (ch == 255) + gap = "\n" + else if (((ch + 1) % 8) != 0) + gap = gap " " + printf "%s", gap + } + print "};" + print "" + print "\treturn (NCURSES_CONST char *)table[TextOf(ch)];" + print "}" + } diff --git a/ncurses/Makefile.in b/ncurses/Makefile.in new file mode 100644 index 00000000..c76ec188 --- /dev/null +++ b/ncurses/Makefile.in @@ -0,0 +1,180 @@ +# $Id: Makefile.in,v 1.28 1997/05/10 20:21:06 tom Exp $ +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Makefile for ncurses source code. +# +# This makes the following: +# programs +# includes +# 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, +# and the programs with the configured default model. + +# turn off _all_ suffix rules; we'll generate our own +.SUFFIXES: + +SHELL = /bin/sh +THIS = Makefile + +NC_MFLAGS = @nc_cv_makeflags@ +@SET_MAKE@ + +MODEL = @DFT_LWR_MODEL@ +INSTALL_PREFIX = @INSTALL_PREFIX@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ +datadir = @datadir@ + +ticdir = $(datadir)/terminfo + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +AR = @AR@ +AR_OPTS = @AR_OPTS@ +AWK = @AWK@ +LD = @LD@ +LN_S = @LN_S@ + +CC = @CC@ +CPP = @CPP@ +CFLAGS = @CFLAGS@ + +INCDIR = $(srcdir)/../include +CPPFLAGS = -I../ncurses -I$(srcdir) @CPPFLAGS@ \ + -DHAVE_CONFIG_H -DTERMINFO=\"$(ticdir)\" + +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@ + +MK_SHARED_LIB = @MK_SHARED_LIB@ +REL_VERSION = @nc_cv_rel_version@ +ABI_VERSION = @nc_cv_abi_version@ + +RANLIB = @RANLIB@ + +LIBRARIES = @LIBS_TO_MAKE@ + +LINT = @LINT@ +LINT_OPTS = @LINT_OPTS@ +LINT_LIBS = -lncurses @LIBS@ + +AUTO_SRC = \ + ../include/nomacros.h \ + ./comp_captab.c \ + ./expanded.c \ + ./fallback.c \ + keys.tries \ + ./lib_keyname.c \ + ./lib_gen.c \ + ./codes.c \ + ./names.c \ + ./unctrl.c + +################################################################################ +all :: ../lib $(AUTO_SRC) $(LIBRARIES) + +$(INSTALL_PREFIX)$(libdir) : + $(srcdir)/../mkinstalldirs $@ + +../lib : ; mkdir $@ + +./fallback.c : $(srcdir)/MKfallback.sh + sh $(srcdir)/MKfallback.sh >$@ + +./lib_gen.c : $(srcdir)/MKlib_gen.sh ../include/curses.h + sh $(srcdir)/MKlib_gen.sh "$(CPP)" "$(AWK)" <../include/curses.h >$@ + +../include/nomacros.h : $(srcdir)/MKlib_gen.sh ../include/curses.h + sh $(srcdir)/MKlib_gen.sh "$(CPP)" "$(AWK)" <../include/curses.h | \ + fgrep undef >$@ + +keys.tries: $(srcdir)/keys.list + $(AWK) -f $(srcdir)/MKkeys.awk $(srcdir)/keys.list > keys.tries + +make_hash : \ + $(srcdir)/comp_hash.c \ + ../include/hashsize.h + $(CC) -o $@ $(CCFLAGS) -DMAIN_PROGRAM $(srcdir)/comp_hash.c $(LDFLAGS) + +./expanded.c : $(srcdir)/MKexpanded.sh + sh $(srcdir)/MKexpanded.sh "$(CPP)" $(CPPFLAGS) + +./comp_captab.c: \ + make_hash \ + ../include/hashsize.h \ + $(srcdir)/MKcaptab.awk + sh $(srcdir)/MKcaptab.awk $(AWK) $(srcdir)/../include/Caps > $@ + +./lib_keyname.c: $(srcdir)/keys.list $(srcdir)/MKkeyname.awk + $(AWK) -f $(srcdir)/MKkeyname.awk $(srcdir)/keys.list > $@ + +./names.c ./codes.c: $(srcdir)/MKnames.awk + $(AWK) -f $(srcdir)/MKnames.awk $(srcdir)/../include/Caps + cat namehdr boolnames boolfnames numnames numfnames strnames strfnames nameftr >./names.c + cat namehdr boolcodes numcodes strcodes codeftr >./codes.c + -rm -f namehdr nameftr codeftr boolnames boolfnames boolcodes numnames numfnames numcodes strnames strfnames strcodes + +./unctrl.c: $(srcdir)/MKunctrl.awk + echo | $(AWK) -f $(srcdir)/MKunctrl.awk >$@ + +tags: + ctags *.[ch] + +TAGS: + etags *.[ch] + +mostlyclean :: + -rm -f tags TAGS *~ + +clean :: mostlyclean + -rm -f $(AUTO_SRC) + -rm -f make_hash + +distclean :: clean + -rm -f Makefile + +realclean :: distclean + +# These rules are used to allow "make -n" to work on a clean directory-tree +../include/hashsize.h \ +../include/parametrized.h \ +../include/term.h : + cd ../include; $(MAKE) $(NC_MFLAGS) + +############################################################################### +# The remainder of this file is automatically generated during configuration +############################################################################### diff --git a/ncurses/README b/ncurses/README new file mode 100644 index 00000000..be4b8b00 --- /dev/null +++ b/ncurses/README @@ -0,0 +1,19 @@ +For discussion of the package internals, see hackguide.html in the misc +directory. + +Here are some -D options you might need to compile with. +The 'configure' script gets most other definitions right automatically. + +-DHAVE_SIGACTION if the sigaction function is present + +-DHAVE_USLEEP if the usleep function is present + +-DSVR4_ACTION if (e.g., svr4) you need _POSIX_SOURCE to have sigaction + +-DSVR4_TERMIO if (e.g., svr4) you need _POSIX_SOURCE to have termio + +-DOPT_MVCUR if you want mvcur() to cost its actions or you have a + terminal that doesn't have direct cursor addressing. + +There are several problems with strict POSIX systems so extra flags +or #define's may be needed. diff --git a/ncurses/SigAction.h b/ncurses/SigAction.h new file mode 100644 index 00000000..3e4f5786 --- /dev/null +++ b/ncurses/SigAction.h @@ -0,0 +1,83 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* This file exists to handle non-POSIX systems which don't have , + * and usually no sigaction() nor + */ + +#ifndef _SIGACTION_H +#define _SIGACTION_H + +#if HAVE_LIBC_H +#include +#endif + +#undef SIG_BLOCK +#define SIG_BLOCK 00 + +#undef SIG_UNBLOCK +#define SIG_UNBLOCK 01 + +#undef SIG_SETMASK +#define SIG_SETMASK 02 + + /* + * is in the Linux 1.2.8 + gcc 2.7.0 configuration, + * and is useful for testing this header file. + */ +#if HAVE_BSD_SIGNAL_H +#include +#endif + +typedef struct sigvec sigaction_t; + +#define sigset_t _nc_sigset_t +typedef unsigned long sigset_t; + +#undef sa_mask +#define sa_mask sv_mask +#undef sa_handler +#define sa_handler sv_handler +#undef sa_flags +#define sa_flags sv_flags + +#undef sigaction +#define sigaction _nc_sigaction +#undef sigprocmask +#define sigprocmask _nc_sigprocmask +#undef sigemptyset +#define sigemptyset _nc_sigemptyset +#undef sigsuspend +#define sigsuspend _nc_sigsuspend +#undef sigdelset +#define sigdelset _nc_sigdelset +#undef sigaddset +#define sigaddset _nc_sigaddset + +extern int sigaction (int sig, sigaction_t * sigact, sigaction_t * osigact); +extern int sigprocmask (int how, sigset_t *mask, sigset_t *omask); +extern int sigemptyset (sigset_t *mask); +extern int sigsuspend (sigset_t *mask); +extern int sigdelset (sigset_t *mask, int sig); +extern int sigaddset (sigset_t *mask, int sig); + +#endif diff --git a/ncurses/alloc_entry.c b/ncurses/alloc_entry.c new file mode 100644 index 00000000..27f21d0f --- /dev/null +++ b/ncurses/alloc_entry.c @@ -0,0 +1,160 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * alloc_entry.c -- allocation functions for terminfo entries + * + * _nc_init_entry() + * _nc_save_str() + * _nc_merge_entry(); + * _nc_wrap_entry(); + * + */ + +#include + +#include +#include +#include + +MODULE_ID("$Id: alloc_entry.c,v 1.12 1997/02/01 22:59:47 tom Exp $") + +#define MAX_STRTAB 4096 /* documented maximum entry size */ + +static char stringbuf[MAX_STRTAB]; /* buffer for string capabilities */ +static size_t next_free; /* next free character in stringbuf */ + +void _nc_init_entry(TERMTYPE *const tp) +/* initialize a terminal type data block */ +{ +int i; + + for (i=0; i < BOOLCOUNT; i++) + tp->Booleans[i] = FALSE; + + for (i=0; i < NUMCOUNT; i++) + tp->Numbers[i] = -1; + + for (i=0; i < STRCOUNT; i++) + tp->Strings[i] = (char *)NULL; + + next_free = 0; +} + +char *_nc_save_str(const char *const string) +/* save a copy of string in the string buffer */ +{ +size_t old_next_free = next_free; +size_t len = strlen(string) + 1; + + if (next_free + len < MAX_STRTAB) + { + strcpy(&stringbuf[next_free], string); + DEBUG(7, ("Saved string %s", _nc_visbuf(string))); + DEBUG(7, ("at location %d", (int) next_free)); + next_free += len; + } + return(stringbuf + old_next_free); +} + +void _nc_wrap_entry(ENTRY *const ep) +/* copy the string parts to allocated storage, preserving pointers to it */ +{ +int offsets[STRCOUNT], useoffsets[MAX_USES]; +int i, n; + + n = ep->tterm.term_names - stringbuf; + for (i=0; i < STRCOUNT; i++) + if (ep->tterm.Strings[i] == (char *)NULL) + offsets[i] = -1; + else if (ep->tterm.Strings[i] == CANCELLED_STRING) + offsets[i] = -2; + else + offsets[i] = ep->tterm.Strings[i] - stringbuf; + + for (i=0; i < ep->nuses; i++) + if (ep->uses[i].parent == (void *)NULL) + useoffsets[i] = -1; + else + useoffsets[i] = (char *)(ep->uses[i].parent) - stringbuf; + + if ((ep->tterm.str_table = (char *)malloc(next_free)) == (char *)NULL) + _nc_err_abort("Out of memory"); + (void) memcpy(ep->tterm.str_table, stringbuf, next_free); + + ep->tterm.term_names = ep->tterm.str_table + n; + for (i=0; i < STRCOUNT; i++) + if (offsets[i] == -1) + ep->tterm.Strings[i] = (char *)NULL; + else if (offsets[i] == -2) + ep->tterm.Strings[i] = CANCELLED_STRING; + else + ep->tterm.Strings[i] = ep->tterm.str_table + offsets[i]; + + for (i=0; i < ep->nuses; i++) + if (useoffsets[i] == -1) + ep->uses[i].parent = (void *)NULL; + else + ep->uses[i].parent = (char *)(ep->tterm.str_table + useoffsets[i]); +} + +void _nc_merge_entry(TERMTYPE *const to, TERMTYPE *const from) +/* merge capabilities from `from' entry into `to' entry */ +{ + int i; + + for (i=0; i < BOOLCOUNT; i++) + { + int mergebool = from->Booleans[i]; + + if (mergebool == CANCELLED_BOOLEAN) + to->Booleans[i] = FALSE; + else if (mergebool == TRUE) + to->Booleans[i] = mergebool; + } + + for (i=0; i < NUMCOUNT; i++) + { + int mergenum = from->Numbers[i]; + + if (mergenum == CANCELLED_NUMERIC) + to->Numbers[i] = ABSENT_NUMERIC; + else if (mergenum != ABSENT_NUMERIC) + to->Numbers[i] = mergenum; + } + + /* + * Note: the copies of strings this makes don't have their own + * storage. This is OK right now, but will be a problem if we + * we ever want to deallocate entries. + */ + for (i=0; i < STRCOUNT; i++) + { + char *mergestring = from->Strings[i]; + + if (mergestring == CANCELLED_STRING) + to->Strings[i] = ABSENT_STRING; + else if (mergestring != ABSENT_STRING) + to->Strings[i] = mergestring; + } +} + diff --git a/ncurses/captoinfo.c b/ncurses/captoinfo.c new file mode 100644 index 00000000..a70c7687 --- /dev/null +++ b/ncurses/captoinfo.c @@ -0,0 +1,791 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* + * captoinfo.c --- conversion between termcap and terminfo formats + * + * The captoinfo() code was swiped from Ross Ridge's mytinfo package, + * adapted to fit ncurses by Eric S. Raymond . + * + * There is just one entry point: + * + * char *captoinfo(n, s, parametrized) + * + * Convert value s for termcap string capability named n into terminfo + * format. + * + * This code recognizes all the standard 4.4BSD %-escapes: + * + * %% output `%' + * %d output value as in printf %d + * %2 output value as in printf %2d + * %3 output value as in printf %3d + * %. output value as in printf %c + * %+x add x to value, then do %. + * %>xy if value > x then add y, no output + * %r reverse order of two parameters, no output + * %i increment by one, no output + * %n exclusive-or all parameters with 0140 (Datamedia 2500) + * %B BCD (16*(value/10)) + (value%10), no output + * %D Reverse coding (value - 2*(value%16)), no output (Delta Data). + * + * Also, %02 and %03 are accepted as synonyms for %2 and %3. + * + * Besides all the standard termcap escapes, this translator understands + * the following extended escapes: + * + * used by GNU Emacs termcap libraries + * %a[+*-/=][cp]x GNU arithmetic. + * %m xor the first two parameters by 0177 + * %b backup to previous parameter + * %f skip this parameter + * + * used by the University of Waterloo (MFCF) termcap libraries + * %-x subtract parameter FROM char x and output it as a char + * %ax add the character x to parameter + * + * If #define WATERLOO is on, also enable these translations: + * + * %sx subtract parameter FROM the character x + * + * By default, this Waterloo translations are not compiled in, because + * the Waterloo %s conflicts with the way terminfo uses %s in strings for + * function programming. + * + * Note the two definitions of %a: the GNU definition is translated if the + * characters after the 'a' are valid for it, otherwise the UW definition + * is translated. + */ + +#include + +#include +#include + +MODULE_ID("$Id: captoinfo.c,v 1.15 1996/12/21 14:24:06 tom Exp $") + +#define MAX_PUSHED 16 /* max # args we can push onto the stack */ +#define MAX_ENTRY 2048 /* maximum chars in a translated capability */ + +static int stack[MAX_PUSHED]; /* the stack */ +static int stackptr; /* the next empty place on the stack */ +static int onstack; /* the top of stack */ +static int seenm; /* seen a %m */ +static int seenn; /* seen a %n */ +static int seenr; /* seen a %r */ +static int param; /* current parameter */ +static char *dp; /* pointer to end of the converted string */ + +static char *my_string; +static size_t my_length; + +static char *init_string(void) +/* initialize 'my_string', 'my_length' */ +{ + if (my_string == 0) + my_string = malloc(my_length = 256); + if (my_string == 0) + _nc_err_abort("Out of memory"); + + *my_string = '\0'; + return my_string; +} + +static char *save_string(char *d, const char *const s) +{ + size_t have = (d - my_string); + size_t need = have + strlen(s) + 2; + if (need > my_length) { + my_string = realloc(my_string, my_length = (need + need)); + d = my_string + have; + } + (void) strcpy(d, s); + return d + strlen(d); +} + +static inline char *save_char(char *s, char c) +{ + static char temp[2]; + temp[0] = c; + return save_string(s, temp); +} + +static void push(void) +/* push onstack on to the stack */ +{ + if (stackptr > MAX_PUSHED) + _nc_warning("string too complex to convert"); + else + stack[stackptr++] = onstack; +} + +static void pop(void) +/* pop the top of the stack into onstack */ +{ + if (stackptr == 0) + if (onstack == 0) + _nc_warning("I'm confused"); + else + onstack = 0; + else + onstack = stack[--stackptr]; + param++; +} + +static int cvtchar(register char *sp) +/* convert a character to a terminfo push */ +{ + unsigned char c = 0; + int len; + + switch(*sp) { + case '\\': + switch(*++sp) { + case '\'': + case '$': + case '\\': + case '%': + c = *sp; + len = 2; + break; + case '\0': + c = '\\'; + len = 1; + break; + case '0': + case '1': + case '2': + case '3': + len = 1; + while (isdigit(*sp)) + { + c = 8 * c + (*sp++ - '0'); + len++; + } + break; + default: + c = *sp; + len = 2; + break; + } + break; + case '^': + c = (*++sp & 0x1f); + len = 2; + break; + default: + c = *sp; + len = 1; + } + if (isgraph(c) && c != ',' && c != '\'' && c != '\\' && c != ':') { + *dp++ = '%'; *dp++ = '\''; *dp++ = c; *dp++ = '\''; + } else { + *dp++ = '%'; *dp++ = '{'; + if (c > 99) + *dp++ = c / 100 + '0'; + if (c > 9) + *dp++ = ((int)(c / 10)) % 10 + '0'; + *dp++ = c % 10 + '0'; + *dp++ = '}'; + } + return len; +} + +static void getparm(int parm, int n) +/* push n copies of param on the terminfo stack if not already there */ +{ + if (seenr) { + if (parm == 1) + parm = 2; + else if (parm == 2) + parm = 1; + } + if (onstack == parm) { + if (n > 1) { + _nc_warning("string may not be optimal"); + *dp++ = '%'; *dp++ = 'P'; *dp++ = 'a'; + while(n--) { + *dp++ = '%'; *dp++ = 'g'; *dp++ = 'a'; + } + } + return; + } + if (onstack != 0) + push(); + + onstack = parm; + + while(n--) { /* %p0 */ + *dp++ = '%'; *dp++ = 'p'; *dp++ = '0' + parm; + } + + if (seenn && parm < 3) { /* %{96}%^ */ + *dp++ = '%'; *dp++ = '{'; *dp++ = '9'; *dp++ = '6'; *dp++ = '}'; + *dp++ = '%'; *dp++ = '^'; + } + + if (seenm && parm < 3) { /* %{127}%^ */ + *dp++ = '%'; *dp++ = '{'; *dp++ = '1'; *dp++ = '2'; *dp++ = '7'; + *dp++ = '}'; *dp++ = '%'; *dp++ = '^'; + } +} + +char *_nc_captoinfo( +/* convert a termcap string to terminfo format */ +register char *const cap, /* relevant terminfo capability index */ +register char *s, /* string value of the capability */ +int const parametrized) /* do % translations if 1, pad translations if >=0 */ +{ + static char line[MAX_ENTRY]; + char *capstart; + + stackptr = 0; + onstack = 0; + seenm = 0; + seenn = 0; + seenr = 0; + param = 1; + + dp = line; + + /* skip the initial padding (if we haven't been told not to) */ + capstart = (char *)NULL; + if (s == 0) + s = ""; + if (parametrized >= 0 && isdigit(*s)) + for (capstart = s; ; s++) + if (!(isdigit(*s) || *s == '*' || *s == '.')) + break; + + while(*s != '\0') { + switch(*s) { + case '%': + s++; + if (parametrized < 1) { + *dp++ = '%'; + break; + } + switch(*s++) { + case '%': *dp++ = '%'; break; + case 'r': + if (seenr++ == 1) { + _nc_warning("saw %%r twice in %s", cap); + } + break; + case 'm': + if (seenm++ == 1) { + _nc_warning("saw %%m twice in %s", cap); + } + break; + case 'n': + if (seenn++ == 1) { + _nc_warning("saw %%n twice in %s", cap); + } + break; + case 'i': *dp++ = '%'; *dp++ = 'i'; break; + case '6': + case 'B': + getparm(param, 2); + /* %{6}%*%+ */ + *dp++ = '%'; *dp++ = '{'; *dp++ = '6'; + *dp++ = '}'; *dp++ = '%'; *dp++ = '*'; + *dp++ = '%'; *dp++ = '+'; + break; + case '8': + case 'D': + getparm(param, 2); + /* %{2}%*%- */ + *dp++ = '%'; *dp++ = '{'; *dp++ = '2'; + *dp++ = '}'; *dp++ = '%'; *dp++ = '*'; + *dp++ = '%'; *dp++ = '-'; + break; + case '>': + getparm(param, 2); + /* %?%{x}%>%t%{y}%+%; */ + *dp++ = '%'; *dp++ = '?'; + s += cvtchar(s); + *dp++ = '%'; *dp++ = '>'; + *dp++ = '%'; *dp++ = 't'; + s += cvtchar(s); + *dp++ = '%'; *dp++ = '+'; + *dp++ = '%'; *dp++ = ';'; + break; + case 'a': + if ((*s == '=' || *s == '+' || *s == '-' + || *s == '*' || *s == '/') + && (s[1] == 'p' || s[1] == 'c') + && s[2] != '\0') { + int l; + l = 2; + if (*s != '=') + getparm(param, 1); + if (s[1] == 'p') { + getparm(param + s[2] - '@', 1); + if (param != onstack) { + pop(); + param--; + } + l++; + } else + l += cvtchar(s + 2); + switch(*s) { + case '+': + *dp++ = '%'; *dp++ = '+'; + break; + case '-': + *dp++ = '%'; *dp++ = '-'; + break; + case '*': + *dp++ = '%'; *dp++ = '*'; + break; + case '/': + *dp++ = '%'; *dp++ = '/'; + break; + case '=': + if (seenr) + if (param == 1) + onstack = 2; + else if (param == 2) + onstack = 1; + else + onstack = param; + else + onstack = param; + break; + } + s += l; + break; + } + getparm(param, 1); + s += cvtchar(s); + *dp++ = '%'; *dp++ = '+'; + break; + case '+': + getparm(param, 1); + s += cvtchar(s); + *dp++ = '%'; *dp++ = '+'; + *dp++ = '%'; *dp++ = 'c'; + pop(); + break; + case 's': +#ifdef WATERLOO + s += cvtchar(s); + getparm(param, 1); + *dp++ = '%'; *dp++ = '-'; +#else + getparm(param, 1); + *dp++ = '%'; *dp++ = 's'; + pop(); +#endif /* WATERLOO */ + break; + case '-': + s += cvtchar(s); + getparm(param, 1); + *dp++ = '%'; *dp++ = '-'; + *dp++ = '%'; *dp++ = 'c'; + pop(); + break; + case '.': + getparm(param, 1); + *dp++ = '%'; *dp++ = 'c'; + pop(); + break; + case '0': /* not clear any of the historical termcaps did this */ + if (*s == '3') + goto see03; + else if (*s != '2') + goto invalid; + /* FALLTHRU */ + case '2': + getparm(param, 1); + *dp++ = '%'; /* *dp++ = '0'; */ + *dp++ = '2'; *dp++ = 'd'; + pop(); + break; + case '3': see03: + getparm(param, 1); + *dp++ = '%'; /* *dp++ = '0'; */ + *dp++ = '3'; *dp++ = 'd'; + pop(); + break; + case 'd': + getparm(param, 1); + *dp++ = '%'; *dp++ = 'd'; + pop(); + break; + case 'f': + param++; + break; + case 'b': + param--; + break; + case '\\': + *dp++ = '%'; + *dp++ = '\\'; + break; + default: invalid: + *dp++ = '%'; + s--; + _nc_warning("unknown %% code %s in %s", + _tracechar(*s), cap); + break; + } + break; +#ifdef REVISIBILIZE + case '\\': + *dp++ = *s++; *dp++ = *s++; break; + case '\n': + *dp++ = '\\'; *dp++ = 'n'; s++; break; + case '\t': + *dp++ = '\\'; *dp++ = 't'; s++; break; + case '\r': + *dp++ = '\\'; *dp++ = 'r'; s++; break; + case '\200': + *dp++ = '\\'; *dp++ = '0'; s++; break; + case '\f': + *dp++ = '\\'; *dp++ = 'f'; s++; break; + case '\b': + *dp++ = '\\'; *dp++ = 'b'; s++; break; + case ' ': + *dp++ = '\\'; *dp++ = 's'; s++; break; + case '^': + *dp++ = '\\'; *dp++ = '^'; s++; break; + case ':': + *dp++ = '\\'; *dp++ = ':'; s++; break; + case ',': + *dp++ = '\\'; *dp++ = ','; s++; break; + default: + if (*s == '\033') { + *dp++ = '\\'; + *dp++ = 'E'; + s++; + } else if (*s > 0 && *s < 32) { + *dp++ = '^'; + *dp++ = *s + '@'; + s++; + } else if (*s <= 0 || *s >= 127) { + *dp++ = '\\'; + *dp++ = ((*s & 0300) >> 6) + '0'; + *dp++ = ((*s & 0070) >> 3) + '0'; + *dp++ = (*s & 0007) + '0'; + s++; + } else + *dp++ = *s++; + break; +#else + default: + *dp++ = *s++; + break; +#endif + } + } + + /* + * Now, if we stripped off some leading padding, add it at the end + * of the string as mandatory padding. + */ + if (capstart) + { + *dp++ = '$'; + *dp++ = '<'; + for (s = capstart; ; s++) + if (isdigit(*s) || *s == '*' || *s == '.') + *dp++ = *s; + else + break; + *dp++ = '/'; + *dp++ = '>'; + } + + *dp = '\0'; + return(line); +} + +/* + * Here are the capabilities infotocap assumes it can translate to: + * + * %% output `%' + * %d output value as in printf %d + * %2 output value as in printf %2d + * %3 output value as in printf %3d + * %. output value as in printf %c + * %+c add character c to value, then do %. + * %>xy if value > x then add y, no output + * %r reverse order of two parameters, no output + * %i increment by one, no output + * %n exclusive-or all parameters with 0140 (Datamedia 2500) + * %B BCD (16*(value/10)) + (value%10), no output + * %D Reverse coding (value - 2*(value%16)), no output (Delta Data). + * %m exclusive-or all parameters with 0177 (not in 4.4BSD) + */ + +char *_nc_infotocap( +/* convert a terminfo string to termcap format */ +register char *const cap GCC_UNUSED, /* relevant termcap capability index */ +register char *str, /* string value of the capability */ +int const parametrized) /* do % translations if 1, pad translations if >=0 */ +{ + int seenone = 0, seentwo = 0, saw_m = 0, saw_n = 0; + char *padding, ch1 = 0, ch2 = 0; + char *bufptr = init_string(); + char temp[256]; + + /* we may have to move some trailing mandatory padding up front */ + padding = str + strlen(str) - 1; + if (*padding == '>' && *--padding == '/') + { + --padding; + while (isdigit(*padding) || *padding == '.' || *padding == '*') + padding--; + if (*padding == '<' && *--padding == '$') + *padding = '\0'; + padding += 2; + + while (isdigit(*padding) || *padding == '.' || *padding == '*') + bufptr = save_char(bufptr, *padding++); + } + + for (; *str; str++) + { + int c1, c2; + char *cp; + + if (str[0] == '\\' && (str[1] == '^' || str[1] == ',')) + { + bufptr = save_char(bufptr, *++str); + } + else if (str[0] == '$' && str[1] == '<') /* discard padding */ + { + str += 2; + while (isdigit(*str) || *str == '.' || *str == '*' || *str == '/' || *str == '>') + str++; + --str; + } + else if (*str != '%' || (parametrized < 1)) + bufptr = save_char(bufptr, *str); + else if (sscanf(str, "%%?%%{%d}%%>%%t%%{%d}%%+%%;", &c1,&c2) == 2) + { + str = strchr(str, ';'); + (void) sprintf(temp, "%%>"); + (void) strcat(temp, unctrl(c1)); + (void) strcat(temp, unctrl(c2)); + bufptr = save_string(bufptr, temp); + } + else if (sscanf(str, "%%?%%{%d}%%>%%t%%'%c'%%+%%;", &c1,&ch2) == 2) + { + str = strchr(str, ';'); + (void) sprintf(temp, "%%>%s%c", unctrl(c1), ch2); + bufptr = save_string(bufptr, temp); + } + else if (sscanf(str, "%%?%%'%c'%%>%%t%%{%d}%%+%%;", &ch1,&c2) == 2) + { + str = strchr(str, ';'); + (void) sprintf(temp, "%%>%c%c", ch1, c2); + bufptr = save_string(bufptr, temp); + } + else if (sscanf(str, "%%?%%'%c'%%>%%t%%'%c'%%+%%;", &ch1, &ch2) == 2) + { + str = strchr(str, ';'); + (void) sprintf(temp, "%%>%c%c", ch1, ch2); + bufptr = save_string(bufptr, temp); + } + else if (strncmp(str, "%{6}%*%+", 8) == 0) + { + str += 7; + (void) sprintf(temp, "%%B"); + bufptr = save_string(bufptr, temp); + } + else if ((sscanf(str, "%%{%d}%%+%%c", &c1) == 1 + || sscanf(str, "%%'%c'%%+%%c", &ch1) == 1) + && (cp = strchr(str, '+'))) + { + str = cp + 2; + bufptr = save_char(bufptr, '%'); + bufptr = save_char(bufptr, '+'); + + if (ch1) + c1 = ch1; + if (is7bits(c1) && isprint(c1)) + bufptr = save_char(bufptr, (char)c1); + else + { + if (c1 == (c1 & 0x1f)) /* iscntrl() returns T on 255 */ + (void) strcpy(temp, unctrl(c1)); + else + (void) sprintf(temp, "\\%03o", c1); + bufptr = save_string(bufptr, temp); + } + } + else if (strncmp(str, "%{2}%*%-", 8) == 0) + { + str += 7; + (void) sprintf(temp, "%%D"); + bufptr = save_string(bufptr, temp); + } + else if (strncmp(str, "%{96}%^", 7) == 0) + { + str += 6; + if (saw_m++ == 0) + { + (void) sprintf(temp, "%%n"); + bufptr = save_string(bufptr, temp); + } + } + else if (strncmp(str, "%{127}%^", 8) == 0) + { + str += 7; + if (saw_n++ == 0) + { + (void) sprintf(temp, "%%m"); + bufptr = save_string(bufptr, temp); + } + } + else + { + str++; + switch (*str) { + case '%': + bufptr = save_char(bufptr, '%'); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + bufptr = save_char(bufptr, '%'); + while (isdigit(*str)) + bufptr = save_char(bufptr, *str++); + if (*str == 'd') + str++; + else + _nc_warning("numeric prefix is missing trailing d in %s", + cap); + --str; + break; + + case 'd': + bufptr = save_char(bufptr, '%'); + bufptr = save_char(bufptr, 'd'); + break; + + case 'c': + bufptr = save_char(bufptr, '%'); + bufptr = save_char(bufptr, '.'); + break; + + /* + * %s isn't in termcap, but it's convenient to pass it through + * so we can represent things like terminfo pfkey strings in + * termcap notation. + */ + case 's': + bufptr = save_char(bufptr, '%'); + bufptr = save_char(bufptr, 's'); + break; + + case 'p': + str++; + if (*str == '1') + seenone = 1; + else if (*str == '2') + { + if (!seenone && !seentwo) + { + bufptr = save_char(bufptr, '%'); + bufptr = save_char(bufptr, 'r'); + seentwo++; + } + } + else if (*str >= '3') + return((char *)NULL); + break; + + case 'i': + bufptr = save_char(bufptr, '%'); + bufptr = save_char(bufptr, 'i'); + break; + + default: + return((char *)NULL); + + } /* endswitch (*str) */ + } /* endelse (*str == '%') */ + + if (*str == '\0') + break; + + } /* endwhile (*str) */ + + return(my_string); +} + +#ifdef MAIN + +int curr_line; + +int main(int argc, char *argv[]) +{ + int c, tc = FALSE; + + while ((c = getopt(argc, argv, "c")) != EOF) + switch (c) + { + case 'c': + tc = TRUE; + break; + } + + curr_line = 0; + for (;;) + { + char buf[BUFSIZ]; + + ++curr_line; + if (fgets(buf, sizeof(buf), stdin) == (char *)NULL) + break; + buf[strlen(buf) - 1] = '\0'; + _nc_set_source(buf); + + if (tc) + { + char *cp = _nc_infotocap("to termcap", buf, 1); + + if (cp) + (void) fputs(cp, stdout); + } + else + (void) fputs(_nc_captoinfo("to terminfo", buf, 1), stdout); + (void) putchar('\n'); + } + return(0); +} +#endif /* MAIN */ + +/* captoinfo.c ends here */ + diff --git a/ncurses/comp_error.c b/ncurses/comp_error.c new file mode 100644 index 00000000..8c4089d3 --- /dev/null +++ b/ncurses/comp_error.c @@ -0,0 +1,108 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * comp_error.c -- Error message routines + * + */ + +#include + +#include + +MODULE_ID("$Id: comp_error.c,v 1.12 1996/12/21 14:24:06 tom Exp $") + +bool _nc_suppress_warnings; + +static const char *sourcename; +static char termtype[MAX_NAME_SIZE+1]; + +void _nc_set_source(const char *const name) +{ + sourcename = name; +} + +void _nc_set_type(const char *const name) +{ + if (name) + strncpy( termtype, name, MAX_NAME_SIZE ); + else + termtype[0] = '\0'; +} + +void _nc_get_type(char *name) +{ + strcpy( name, termtype ); +} + +static inline void where_is_problem(void) +{ + fprintf (stderr, "\"%s\"", sourcename); + if (_nc_curr_line >= 0) + fprintf (stderr, ", line %d", _nc_curr_line); + if (_nc_curr_col >= 0) + fprintf (stderr, ", col %d", _nc_curr_col); + if (termtype[0]) + fprintf (stderr, ", terminal '%s'", termtype); + fputc(':', stderr); + fputc(' ', stderr); +} + +void _nc_warning(const char *const fmt, ...) +{ +va_list argp; + + if (_nc_suppress_warnings) + return; + + where_is_problem(); + va_start(argp,fmt); + vfprintf (stderr, fmt, argp); + fprintf (stderr, "\n"); + va_end(argp); +} + + +void _nc_err_abort(const char *const fmt, ...) +{ +va_list argp; + + where_is_problem(); + va_start(argp,fmt); + vfprintf (stderr, fmt, argp); + fprintf (stderr, "\n"); + va_end(argp); + exit(EXIT_FAILURE); +} + + +void _nc_syserr_abort(const char *const fmt, ...) +{ +va_list argp; + + where_is_problem(); + va_start(argp,fmt); + vfprintf (stderr, fmt, argp); + fprintf (stderr, "\n"); + va_end(argp); + abort(); +} diff --git a/ncurses/comp_hash.c b/ncurses/comp_hash.c new file mode 100644 index 00000000..c44a55d0 --- /dev/null +++ b/ncurses/comp_hash.c @@ -0,0 +1,320 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * comp_hash.c --- Routines to deal with the hashtable of capability + * names. + * + */ + +#include + +#include +#include + +#ifdef MAIN_PROGRAM +#include +#undef DEBUG +#define DEBUG(level, params) /*nothing*/ +#endif + +MODULE_ID("$Id: comp_hash.c,v 1.15 1997/04/26 18:16:19 tom Exp $") + +static int hash_function(const char *); + +/* + * _nc_make_hash_table() + * + * Takes the entries in table[] and hashes them into hash_table[] + * by name. There are CAPTABSIZE entries in table[] and HASHTABSIZE + * slots in hash_table[]. + * + */ + +#ifdef MAIN_PROGRAM +static void _nc_make_hash_table(struct name_table_entry *table, + struct name_table_entry **hash_table) +{ +int i; +int hashvalue; +int collisions = 0; + + for (i = 0; i < CAPTABSIZE; i++) { + hashvalue = hash_function(table[i].nte_name); + + if (hash_table[hashvalue] != (struct name_table_entry *) 0) + collisions++; + + if (hash_table[hashvalue] != 0) + table[i].nte_link = (short)(hash_table[hashvalue] - table); + hash_table[hashvalue] = &table[i]; + } + + DEBUG(4, ("Hash table complete: %d collisions out of %d entries", collisions, CAPTABSIZE)); +} +#endif + + +/* + * int hash_function(string) + * + * Computes the hashing function on the given string. + * + * The current hash function is the sum of each consectutive pair + * of characters, taken as two-byte integers, mod Hashtabsize. + * + */ + +static +int +hash_function(const char *string) +{ +long sum = 0; + + DEBUG(9, ("hashing %s", string)); + while (*string) { + sum += (long)(*string + (*(string + 1) << 8)); + string++; + } + + DEBUG(9, ("sum is %ld", sum)); + return (int)(sum % HASHTABSIZE); +} + + +/* + * struct name_table_entry * + * find_entry(string) + * + * Finds the entry for the given string in the hash table if present. + * Returns a pointer to the entry in the table or 0 if not found. + * + */ + +#ifndef MAIN_PROGRAM +struct name_table_entry const * +_nc_find_entry(const char *string, const struct name_table_entry *const *hash_table) +{ +int hashvalue; +struct name_table_entry const *ptr; + + hashvalue = hash_function(string); + + if ((ptr = hash_table[hashvalue]) != 0) { + while (strcmp(ptr->nte_name, string) != 0) { + if (ptr->nte_link < 0) + return 0; + ptr = ptr->nte_link + hash_table[HASHTABSIZE]; + } + } + + return (ptr); +} + +/* + * struct name_table_entry * + * find_type_entry(string, type, table) + * + * Finds the first entry for the given name with the given type in the + * given table if present (as distinct from find_entry, which finds the + * the last entry regardless of type). You can use this if you detect + * a name clash. It's slower, though. Returns a pointer to the entry + * in the table or 0 if not found. + */ + +struct name_table_entry const * +_nc_find_type_entry(const char *string, + int type, + const struct name_table_entry *table) +{ +struct name_table_entry const *ptr; + + for (ptr = table; ptr < table + CAPTABSIZE; ptr++) { + if (ptr->nte_type == type && strcmp(string, ptr->nte_name) == 0) + return(ptr); + } + + return ((struct name_table_entry *)NULL); +} +#endif + +#ifdef MAIN_PROGRAM +/* + * This filter reads from standard input a list of tab-delimited columns, + * (e.g., from Caps.filtered) computes the hash-value of a specified column and + * writes the hashed tables to standard output. + * + * By compiling the hash table at build time, we're able to make the entire + * set of terminfo and termcap tables readonly (and also provide some runtime + * performance enhancement). + */ + +#if !HAVE_STRDUP +static char *strdup (char *s) +{ + char *p; + + p = malloc(strlen(s)+1); + if (p) + strcpy(p,s); + return(p); +} +#endif /* not HAVE_STRDUP */ + +#define MAX_COLUMNS BUFSIZ /* this _has_ to be worst-case */ + +static char **parse_columns(char *buffer) +{ + static char **list; + + int col = 0; + + if (list == 0) + list = typeCalloc(char *, MAX_COLUMNS); + + if (*buffer != '#') { + while (*buffer != '\0') { + char *s; + for (s = buffer; (*s != '\0') && !isspace(*s); s++) + /*EMPTY*/; + if (s != buffer) { + char mark = *s; + *s = '\0'; + if ((s - buffer) > 1 + && (*buffer == '"') + && (s[-1] == '"')) { /* strip the quotes */ + buffer++; + s[-1] = '\0'; + } + list[col] = buffer; + col++; + if (mark == '\0') + break; + while (*++s && isspace(*s)) + /*EMPTY*/; + buffer = s; + } else + break; + } + } + return col ? list : 0; +} + +int main(int argc, char **argv) +{ + struct name_table_entry *name_table = typeCalloc(struct name_table_entry, CAPTABSIZE); + struct name_table_entry **hash_table = typeCalloc(struct name_table_entry *, HASHTABSIZE); + const char *root_name = ""; + int column = 0; + int n; + char buffer[BUFSIZ]; + + static const char * typenames[] = { "BOOLEAN", "NUMBER", "STRING" }; + + short BoolCount = 0; + short NumCount = 0; + short StrCount = 0; + + /* The first argument is the column-number (starting with 0). + * The second is the root name of the tables to generate. + */ + if (argc <= 2 + || (column = atoi(argv[1])) <= 0 + || (column >= MAX_COLUMNS) + || *(root_name = argv[2]) == 0) { + fprintf(stderr, "usage: make_hash column root_name\n"); + exit(EXIT_FAILURE); + } + + /* + * Read the table into our arrays. + */ + for (n = 0; (n < CAPTABSIZE) && fgets(buffer, BUFSIZ, stdin); ) { + char **list, *nlp = strchr(buffer, '\n'); + if (nlp) + *nlp = '\0'; + list = parse_columns(buffer); + if (list == 0) /* blank or comment */ + continue; + name_table[n].nte_link = -1; /* end-of-hash */ + name_table[n].nte_name = strdup(list[column]); + if (!strcmp(list[2], "bool")) { + name_table[n].nte_type = BOOLEAN; + name_table[n].nte_index = BoolCount++; + } else if (!strcmp(list[2], "num")) { + name_table[n].nte_type = NUMBER; + name_table[n].nte_index = NumCount++; + } else if (!strcmp(list[2], "str")) { + name_table[n].nte_type = STRING; + name_table[n].nte_index = StrCount++; + } else { + fprintf(stderr, "Unknown type: %s\n", list[2]); + exit(EXIT_FAILURE); + } + n++; + } + _nc_make_hash_table(name_table, hash_table); + + /* + * Write the compiled tables to standard output + */ + printf("static struct name_table_entry const _nc_%s_table[] =\n", + root_name); + printf("{\n"); + for (n = 0; n < CAPTABSIZE; n++) { + sprintf(buffer, "\"%s\"", + name_table[n].nte_name); + printf("\t{ %15s,\t%10s,\t%3d, %3d }%c\n", + buffer, + typenames[name_table[n].nte_type], + name_table[n].nte_index, + name_table[n].nte_link, + n < CAPTABSIZE - 1 ? ',' : ' '); + } + printf("};\n\n"); + + printf("const struct name_table_entry * const _nc_%s_hash_table[%d] =\n", + root_name, + HASHTABSIZE+1); + printf("{\n"); + for (n = 0; n < HASHTABSIZE; n++) { + if (hash_table[n] != 0) { + sprintf(buffer, "_nc_%s_table + %3d", + root_name, + hash_table[n] - name_table); + } else { + strcpy(buffer, "0"); + } + printf("\t%s,\n", buffer); + } + printf("\t_nc_%s_table\t/* base-of-table */\n", root_name); + printf("};\n\n"); + + printf("#if (BOOLCOUNT!=%d)||(NUMCOUNT!=%d)||(STRCOUNT!=%d)\n", + BoolCount, NumCount, StrCount); + printf("#error\t--> term.h and comp_captab.c disagree about the <--\n"); + printf("#error\t--> numbers of booleans, numbers and/or strings <--\n"); + printf("#endif\n\n"); + + return EXIT_SUCCESS; +} +#endif diff --git a/ncurses/comp_parse.c b/ncurses/comp_parse.c new file mode 100644 index 00000000..45e347a2 --- /dev/null +++ b/ncurses/comp_parse.c @@ -0,0 +1,492 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* + * comp_parse.c -- parser driver loop and use handling. + * + * _nc_read_entry_source(FILE *, literal, bool, bool (*hook)()) + * _nc_resolve_uses(void) + * _nc_free_entries(void) + * + * Use this code by calling _nc_read_entry_source() on as many source + * files as you like (either terminfo or termcap syntax). If you + * want use-resolution, call _nc_resolve_uses(). To free the list + * storage, do _nc_free_entries(). + * + */ + +#include + +#include + +#include +#include +#include + +MODULE_ID("$Id: comp_parse.c,v 1.18 1996/12/21 14:24:06 tom Exp $") + +static void sanity_check(TERMTYPE *); + +/**************************************************************************** + * + * Entry queue handling + * + ****************************************************************************/ +/* + * The entry list is a doubly linked list with NULLs terminating the lists: + * + * --------- --------- --------- + * | | | | | | offset + * |-------| |-------| |-------| + * | ----+-->| ----+-->| NULL | next + * |-------| |-------| |-------| + * | NULL |<--+---- |<--+---- | last + * --------- --------- --------- + * ^ ^ + * | | + * | | + * _nc_head _nc_tail + */ + +ENTRY *_nc_head, *_nc_tail; + +static void enqueue(ENTRY *ep) +/* add an entry to the in-core list */ +{ + ENTRY *newp = (ENTRY *)malloc(sizeof(ENTRY)); + + if (newp == NULL) + _nc_err_abort("Out of memory"); + + (void) memcpy(newp, ep, sizeof(ENTRY)); + + newp->last = _nc_tail; + _nc_tail = newp; + + newp->next = (ENTRY *)NULL; + if (newp->last) + newp->last->next = newp; +} + +void _nc_free_entries(ENTRY *head) +/* free the allocated storage consumed by list entries */ +{ + ENTRY *ep, *next; + + for (ep = head; ep; ep = next) + { + /* + * This conditional lets us disconnect storage from the list. + * To do this, copy an entry out of the list, then null out + * the string-table member in the original and any use entries + * it references. + */ + FreeIfNeeded(ep->tterm.str_table); + + next = ep->next; + + free(ep); + if (ep == _nc_head) _nc_head = 0; + if (ep == _nc_tail) _nc_tail = 0; + } +} + +bool _nc_entry_match(char *n1, char *n2) +/* do any of the aliases in a pair of terminal names match? */ +{ + char *pstart, *qstart, *pend, *qend; + char nc1[MAX_NAME_SIZE+1], nc2[MAX_NAME_SIZE+1]; + + if (strchr(n1, '|') == NULL) + { + (void) strcpy(nc1, n1); + (void) strcat(nc1, "|"); + n1 = nc1; + } + + if (strchr(n2, '|') == NULL) + { + (void) strcpy(nc2, n2); + (void) strcat(nc2, "|"); + n2 = nc2; + } + + for (pstart = n1; (pend = strchr(pstart, '|')); pstart = pend + 1) + for (qstart = n2; (qend = strchr(qstart, '|')); qstart = qend + 1) + if ((pend-pstart == qend-qstart) + && memcmp(pstart, qstart, (size_t)(pend-pstart)) == 0) + return(TRUE); + + return(FALSE); +} + +/**************************************************************************** + * + * Entry compiler and resolution logic + * + ****************************************************************************/ + +void _nc_read_entry_source(FILE *fp, char *buf, + int literal, bool silent, + bool (*hook)(ENTRY *)) +/* slurp all entries in the given file into core */ +{ + ENTRY thisentry; + bool oldsuppress = _nc_suppress_warnings; + int immediate = 0; + + if (silent) + _nc_suppress_warnings = TRUE; /* shut the lexer up, too */ + + for (_nc_reset_input(fp, buf); _nc_parse_entry(&thisentry, literal, silent) != ERR; ) + { + if (!isalnum(thisentry.tterm.term_names[0])) + _nc_err_abort("terminal names must start with letter or digit"); + + /* + * This can be used for immediate compilation of entries with no + * use references to disk, so as to avoid chewing up a lot of + * core when the resolution code could fetch entries off disk. + */ + if (hook != NULLHOOK && (*hook)(&thisentry)) + immediate++; + else + enqueue(&thisentry); + } + + if (_nc_tail) + { + /* set up the head pointer */ + for (_nc_head = _nc_tail; _nc_head->last; _nc_head = _nc_head->last) + continue; + + DEBUG(1, ("head = %s", _nc_head->tterm.term_names)); + DEBUG(1, ("tail = %s", _nc_tail->tterm.term_names)); + } + else if (!immediate) + DEBUG(1, ("no entries parsed")); + + _nc_suppress_warnings = oldsuppress; +} + +int _nc_resolve_uses(void) +/* try to resolve all use capabilities */ +{ + ENTRY *qp, *rp, *lastread = NULL; + bool keepgoing; + int i, j, unresolved, total_unresolved, multiples; + + DEBUG(2, ("RESOLUTION BEGINNING")); + + /* + * Check for multiple occurrences of the same name. + */ + multiples = 0; + for_entry_list(qp) + { + int matchcount = 0; + + for_entry_list(rp) + if (qp > rp + && _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) + { + matchcount++; + if (matchcount == 1) + { + (void) fprintf(stderr, "Name collision between %s", + _nc_first_name(qp->tterm.term_names)); + multiples++; + } + if (matchcount >= 1) + (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names)); + } + if (matchcount >= 1) + (void) putc('\n', stderr); + } + if (multiples > 0) + return(FALSE); + + DEBUG(2, ("NO MULTIPLE NAME OCCURRENCES")); + + /* + * First resolution stage: replace names in use arrays with entry + * pointers. By doing this, we avoid having to do the same name + * match once for each time a use entry is itself unresolved. + */ + total_unresolved = 0; + _nc_curr_col = -1; + for_entry_list(qp) + { + unresolved = 0; + for (i = 0; i < qp->nuses; i++) + { + bool foundit; + char *child = _nc_first_name(qp->tterm.term_names); + char *lookfor = (char *)(qp->uses[i].parent); + long lookline = qp->uses[i].line; + + foundit = FALSE; + + _nc_set_type(child); + + /* first, try to resolve from in-core records */ + for_entry_list(rp) + if (rp != qp + && _nc_name_match(rp->tterm.term_names, lookfor, "|")) + { + DEBUG(2, ("%s: resolving use=%s (in core)", + child, lookfor)); + + qp->uses[i].parent = rp; + foundit = TRUE; + } + + /* if that didn't work, try to merge in a compiled entry */ + if (!foundit) + { + TERMTYPE thisterm; + char filename[PATH_MAX]; + + if (_nc_read_entry(lookfor, filename, &thisterm) == 1) + { + DEBUG(2, ("%s: resolving use=%s (compiled)", + child, lookfor)); + + rp = (ENTRY *)malloc(sizeof(ENTRY)); + memcpy(&rp->tterm, &thisterm, sizeof(TERMTYPE)); + rp->nuses = 0; + rp->next = lastread; + lastread = rp; + + qp->uses[i].parent = rp; + foundit = TRUE; + } + } + + /* no good, mark this one unresolvable and complain */ + if (!foundit) + { + unresolved++; + total_unresolved++; + + _nc_curr_line = lookline; + _nc_warning("resolution of use=%s failed", lookfor); + qp->uses[i].parent = (ENTRY *)NULL; + } + } + } + if (total_unresolved) + { + /* free entries read in off disk */ + _nc_free_entries(lastread); + return(FALSE); + } + + DEBUG(2, ("NAME RESOLUTION COMPLETED OK")); + + /* + * OK, at this point all (char *) references have been successfully + * replaced by (ENTRY *) pointers. Time to do the actual merges. + */ + do { + TERMTYPE merged; + + keepgoing = FALSE; + + for_entry_list(qp) + if (qp->nuses > 0) + { + DEBUG(2, ("%s: attempting merge", _nc_first_name(qp->tterm.term_names))); + /* + * If any of the use entries we're looking for is + * incomplete, punt. We'll catch this entry on a + * subsequent pass. + */ + for (i = 0; i < qp->nuses; i++) + if (((ENTRY *)qp->uses[i].parent)->nuses) + { + DEBUG(2, ("%s: use entry %d unresolved", + _nc_first_name(qp->tterm.term_names), i)); + goto incomplete; + } + + /* + * First, make sure there's no garbage in the merge block. + * as a side effect, copy into the merged entry the name + * field and string table pointer. + */ + memcpy(&merged, &qp->tterm, sizeof(TERMTYPE)); + + /* + * Now merge in each use entry in the proper + * (reverse) order. + */ + for (; qp->nuses; qp->nuses--) + _nc_merge_entry(&merged, + &((ENTRY *)qp->uses[qp->nuses-1].parent)->tterm); + + /* + * Now merge in the original entry. + */ + _nc_merge_entry(&merged, &qp->tterm); + + /* + * Replace the original entry with the merged one. + */ + memcpy(&qp->tterm, &merged, sizeof(TERMTYPE)); + + /* + * We know every entry is resolvable because name resolution + * didn't bomb. So go back for another pass. + */ + /* FALLTHRU */ + incomplete: + keepgoing = TRUE; + } + } while + (keepgoing); + + DEBUG(2, ("MERGES COMPLETED OK")); + + /* + * The exit condition of the loop above is such that all entries + * must now be resolved. Now handle cancellations. In a resolved + * entry there should be no cancellation markers. + */ + for_entry_list(qp) + { + for (j = 0; j < BOOLCOUNT; j++) + if (qp->tterm.Booleans[j] == CANCELLED_BOOLEAN) + qp->tterm.Booleans[j] = FALSE; + for (j = 0; j < NUMCOUNT; j++) + if (qp->tterm.Numbers[j] == CANCELLED_NUMERIC) + qp->tterm.Numbers[j] = ABSENT_NUMERIC; + for (j = 0; j < STRCOUNT; j++) + if (qp->tterm.Strings[j] == CANCELLED_STRING) + qp->tterm.Strings[j] = ABSENT_STRING; + } + + /* + * We'd like to free entries read in off disk at this point, but can't. + * The merge_entry() code doesn't copy the strings in the use entries, + * it just aliases them. If this ever changes, do a + * free_entries(lastread) here. + */ + + DEBUG(2, ("RESOLUTION FINISHED")); + + _nc_curr_col = -1; + for_entry_list(qp) + { + _nc_curr_line = qp->startline; + _nc_set_type(_nc_first_name(qp->tterm.term_names)); + sanity_check(&qp->tterm); + } + + DEBUG(2, ("SANITY CHECK FINISHED")); + + return(TRUE); +} + +/* + * This bit of legerdemain turns all the terminfo variable names into + * references to locations in the arrays Booleans, Numbers, and Strings --- + * precisely what's needed. + */ + +#undef CUR +#define CUR tp-> + +/* + * 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); \ + } + +static void sanity_check(TERMTYPE *tp) +{ +#ifdef __UNUSED__ /* this casts too wide a net */ + bool terminal_entry = !strchr(tp->term_names, '+'); +#endif + + if (!PRESENT(exit_attribute_mode)) + { +#ifdef __UNUSED__ /* this casts too wide a net */ + if (terminal_entry && + (PRESENT(set_attributes) + || PRESENT(enter_standout_mode) + || PRESENT(enter_underline_mode) + || PRESENT(enter_blink_mode) + || PRESENT(enter_bold_mode) + || PRESENT(enter_dim_mode) + || PRESENT(enter_secure_mode) + || PRESENT(enter_protected_mode) + || PRESENT(enter_reverse_mode))) + _nc_warning("no exit_attribute_mode"); +#endif /* __UNUSED__ */ + PAIRED(enter_standout_mode, exit_standout_mode) + PAIRED(enter_underline_mode, exit_underline_mode) + } + + /* listed in structure-member order of first argument */ +#ifdef __UNUSED__ + ANDMISSING(cursor_invisible, cursor_normal) + ANDMISSING(cursor_visible, cursor_normal) +#endif /* __UNUSED__ */ + PAIRED(enter_alt_charset_mode, exit_alt_charset_mode) + ANDMISSING(enter_alt_charset_mode, acs_chars) + ANDMISSING(exit_alt_charset_mode, acs_chars) + ANDMISSING(enter_blink_mode, exit_attribute_mode) + ANDMISSING(enter_bold_mode, exit_attribute_mode) + PAIRED(exit_ca_mode, enter_ca_mode) + PAIRED(enter_delete_mode, exit_delete_mode) + ANDMISSING(enter_dim_mode, exit_attribute_mode) + PAIRED(enter_insert_mode, exit_insert_mode) + ANDMISSING(enter_secure_mode, exit_attribute_mode) + ANDMISSING(enter_protected_mode, exit_attribute_mode) + ANDMISSING(enter_reverse_mode, exit_attribute_mode) + PAIRED(from_status_line, to_status_line) + PAIRED(meta_off, meta_on) + + PAIRED(prtr_on, prtr_off) + PAIRED(save_cursor, restore_cursor) + PAIRED(enter_xon_mode, exit_xon_mode) + PAIRED(enter_am_mode, exit_am_mode) + ANDMISSING(label_off, label_on) + PAIRED(display_clock, remove_clock) + ANDMISSING(set_color_pair, initialize_pair) +#undef PAIRED +#undef ANDMISSING +} diff --git a/ncurses/comp_scan.c b/ncurses/comp_scan.c new file mode 100644 index 00000000..9b15823e --- /dev/null +++ b/ncurses/comp_scan.c @@ -0,0 +1,696 @@ +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* + * comp_scan.c --- Lexical scanner for terminfo compiler. + * + * _nc_reset_input() + * _nc_get_token() + * _nc_panic_mode() + * int _nc_syntax; + * int _nc_curr_line; + * long _nc_curr_file_pos; + * long _nc_comment_start; + * long _nc_comment_end; + */ + +#include + +#include +#include + +MODULE_ID("$Id: comp_scan.c,v 1.21 1997/04/24 10:37:34 tom Exp $") + +/* + * Maximum length of string capability we'll accept before raising an error. + * Yes, there is a real capability in /etc/termcap this long, an "is". + */ +#define MAXCAPLEN 600 + +#define iswhite(ch) (ch == ' ' || ch == '\t') + +int _nc_syntax; /* termcap or terminfo? */ +int _nc_curr_line; /* current line # in input */ +int _nc_curr_col; /* current column # in input */ +long _nc_curr_file_pos; /* file offset of current line */ +long _nc_comment_start; /* start of comment range before name */ +long _nc_comment_end; /* end of comment range before name */ +long _nc_start_line; /* start line of current entry */ + +/***************************************************************************** + * + * Token-grabbing machinery + * + *****************************************************************************/ + +static bool first_column; /* See 'next_char()' below */ +static char separator; /* capability separator */ +static int pushtype; /* type of pushback token */ +static char pushname[MAX_NAME_SIZE+1]; + +static int next_char(void); +static long stream_pos(void); +static bool end_of_stream(void); +static char trans_string(char *); +static void push_back(char c); + +/* Assume we may be looking at a termcap-style continuation */ +static inline int eat_escaped_newline(int ch) +{ + if (ch == '\\') + while ((ch = next_char()) == '\n' || iswhite(ch)) + continue; + return ch; +} + +/* + * int + * get_token() + * + * Scans the input for the next token, storing the specifics in the + * global structure 'curr_token' and returning one of the following: + * + * NAMES A line beginning in column 1. 'name' + * will be set to point to everything up to but + * not including the first separator on the line. + * BOOLEAN An entry consisting of a name followed by + * a separator. 'name' will be set to point to + * the name of the capability. + * NUMBER An entry of the form + * name#digits, + * 'name' will be set to point to the capability + * name and 'valnumber' to the number given. + * STRING An entry of the form + * name=characters, + * 'name' is set to the capability name and + * 'valstring' to the string of characters, with + * input translations done. + * CANCEL An entry of the form + * name@, + * 'name' is set to the capability name and + * 'valnumber' to -1. + * EOF The end of the file has been reached. + * + * A `separator' is either a comma or a semicolon, depending on whether + * we are in termcap or terminfo mode. + * + */ + +int _nc_get_token(void) +{ +static const char terminfo_punct[] = "@%&*!#"; +long number; +int type; +int ch; +bool found; +static char buffer[MAX_ENTRY_SIZE]; +char *ptr; +int dot_flag = FALSE; +long token_start; + + if (pushtype != NO_PUSHBACK) + { + int retval = pushtype; + + _nc_set_type(pushname); + DEBUG(3, ("pushed-back token: `%s', class %d", + _nc_curr_token.tk_name, pushtype)); + + pushtype = NO_PUSHBACK; + pushname[0] = '\0'; + + /* currtok wasn't altered by _nc_push_token() */ + return(retval); + } + + if (end_of_stream()) + return(EOF); + +start_token: + token_start = stream_pos(); + while ((ch = next_char()) == '\n' || iswhite(ch)) + continue; + + ch = eat_escaped_newline(ch); + + if (ch == EOF) + type = EOF; + else { + /* if this is a termcap entry, skip a leading separator */ + if (separator == ':' && ch == ':') + ch = next_char(); + + if (ch == '.') { + dot_flag = TRUE; + DEBUG(8, ("dot-flag set")); + + while ((ch = next_char())=='.' || iswhite(ch)) + continue; + } + + if (ch == EOF) { + type = EOF; + goto end_of_token; + } + + /* have to make some punctuation chars legal for terminfo */ + if (!isalnum(ch) && !strchr(terminfo_punct, (char)ch)) { + _nc_warning("Illegal character (expected alphanumeric or %s) - %s", + terminfo_punct, _tracechar((chtype)ch)); + _nc_panic_mode(separator); + goto start_token; + } + + ptr = buffer; + *(ptr++) = ch; + + if (first_column) { + char *desc; + + _nc_comment_start = token_start; + _nc_comment_end = _nc_curr_file_pos; + _nc_start_line = _nc_curr_line; + + _nc_syntax = ERR; + while ((ch = next_char()) != '\n') + { + if (ch == EOF) + _nc_err_abort("premature EOF"); + else if (ch == ':') + { + _nc_syntax = SYN_TERMCAP; + separator = ':'; + break; + } + else if (ch == ',') + { + _nc_syntax = SYN_TERMINFO; + separator = ','; + /* + * Fall-through here is not an accident. + * The idea is that if we see a comma, we + * figure this is terminfo unless we + * subsequently run into a colon -- but + * we don't stop looking for that colon until + * hitting a newline. This allows commas to + * be embedded in description fields of + * either syntax. + */ + /* FALLTHRU */ + } + else + ch = eat_escaped_newline(ch); + + *ptr++ = ch; + } + ptr[0] = '\0'; + if (_nc_syntax == ERR) + { + /* + * Grrr...what we ought to do here is barf, + * complaining that the entry is malformed. + * But because a couple of name fields in the + * 8.2 termcap file end with |\, we just have + * to assume it's termcap syntax. + */ + _nc_syntax = SYN_TERMCAP; + separator = ':'; + } + else if (_nc_syntax == SYN_TERMINFO) + { + /* throw away trailing /, *$/ */ + for (--ptr; iswhite(*ptr) || *ptr == ','; ptr--) + continue; + ptr[1] = '\0'; + } + + /* + * This is the soonest we have the terminal name + * fetched. Set up for following warning messages. + */ + ptr = strchr(buffer, '|'); + if (ptr == (char *)NULL) + ptr = buffer + strlen(buffer); + ch = *ptr; + *ptr = '\0'; + _nc_set_type(buffer); + *ptr = ch; + + /* + * Compute the boundary between the aliases and the + * description field for syntax-checking purposes. + */ + desc = strrchr(buffer, '|'); + if (desc) + if (*desc == '\0') + _nc_warning("empty longname field"); + else if (strchr(desc, ' ') == (char *)NULL) + _nc_warning("older tic versions may treat the description field as an alias"); + if (!desc) + desc = buffer + strlen(buffer); + + /* + * Whitespace in a name field other than the long name + * can confuse rdist and some termcap tools. Slashes + * are a no-no. Other special characters can be + * dangerous due to shell expansion. + */ + for (ptr = buffer; ptr < desc; ptr++) + { + if (isspace(*ptr)) + { + _nc_warning("whitespace in name or alias field"); + break; + } + else if (*ptr == '/') + { + _nc_warning("slashes aren't allowed in names or aliases"); + break; + } + else if (strchr("$[]!*?", *ptr)) + { + _nc_warning("dubious character `%c' in name or alias field", *ptr); + break; + } + } + + ptr = buffer; + + _nc_curr_token.tk_name = buffer; + type = NAMES; + } else { + while ((ch = next_char()) != EOF) { + if (!isalnum(ch)) { + if (_nc_syntax == SYN_TERMINFO) { + if (ch != '_') + break; + } else { /* allow ';' for "k;" */ + if (ch != ';') + break; + } + } + *(ptr++) = ch; + } + + *ptr++ = '\0'; + switch (ch) { + case ',': + case ':': + if (ch != separator) + _nc_err_abort("Separator inconsistent with syntax"); + _nc_curr_token.tk_name = buffer; + type = BOOLEAN; + break; + case '@': + if ((ch = next_char()) != separator) + _nc_warning("Missing separator after `%s', have %s", + buffer, _tracechar((chtype)ch)); + _nc_curr_token.tk_name = buffer; + type = CANCEL; + break; + + case '#': + number = 0; + found = FALSE; + while (isdigit(ch = next_char())) { + number = number * 10 + ch - '0'; + found = TRUE; + } + if (found == FALSE) + _nc_warning("no value given for `%s'", buffer); + if (ch != separator) + _nc_warning("Missing separator"); + _nc_curr_token.tk_name = buffer; + _nc_curr_token.tk_valnumber = number; + type = NUMBER; + break; + + case '=': + ch = trans_string(ptr); + if (ch != separator) + _nc_warning("Missing separator"); + _nc_curr_token.tk_name = buffer; + _nc_curr_token.tk_valstring = ptr; + type = STRING; + break; + + case EOF: + type = EOF; + break; + default: + /* just to get rid of the compiler warning */ + type = UNDEF; + _nc_warning("Illegal character - %s", + _tracechar((chtype)ch)); + } + } /* end else (first_column == FALSE) */ + } /* end else (ch != EOF) */ + +end_of_token: + if (dot_flag == TRUE) + DEBUG(8, ("Commented out ")); + + if (_nc_tracing & TRACE_IEVENT) + { + fprintf(stderr, "Token: "); + switch (type) + { + case BOOLEAN: + fprintf(stderr, "Boolean; name='%s'\n", + _nc_curr_token.tk_name); + break; + + case NUMBER: + fprintf(stderr, "Number; name='%s', value=%d\n", + _nc_curr_token.tk_name, + _nc_curr_token.tk_valnumber); + break; + + case STRING: + fprintf(stderr, "String; name='%s', value=%s\n", + _nc_curr_token.tk_name, + _nc_visbuf(_nc_curr_token.tk_valstring)); + break; + + case CANCEL: + fprintf(stderr, "Cancel; name='%s'\n", + _nc_curr_token.tk_name); + break; + + case NAMES: + + fprintf(stderr, "Names; value='%s'\n", + _nc_curr_token.tk_name); + break; + + case EOF: + fprintf(stderr, "End of file\n"); + break; + + default: + _nc_warning("Bad token type"); + } + } + + if (dot_flag == TRUE) /* if commented out, use the next one */ + type = _nc_get_token(); + + DEBUG(3, ("token: `%s', class %d", _nc_curr_token.tk_name, type)); + + return(type); +} + +/* + * char + * trans_string(ptr) + * + * Reads characters using next_char() until encountering a separator, nl, + * or end-of-file. The returned value is the character which caused + * reading to stop. The following translations are done on the input: + * + * ^X goes to ctrl-X (i.e. X & 037) + * {\E,\n,\r,\b,\t,\f} go to + * {ESCAPE,newline,carriage-return,backspace,tab,formfeed} + * {\^,\\} go to {carat,backslash} + * \ddd (for ddd = up to three octal digits) goes to the character ddd + * + * \e == \E + * \0 == \200 + * + */ + +static char +trans_string(char *ptr) +{ +int count = 0; +int number; +int i, c; +chtype ch, last_ch = '\0'; + + while ((ch = c = next_char()) != (chtype)separator && c != EOF) { + if ((_nc_syntax == SYN_TERMCAP) && c == '\n') + break; + if (ch == '^' && last_ch != '%') { + ch = c = next_char(); + if (c == EOF) + _nc_err_abort("Premature EOF"); + + if (! (is7bits(ch) && isprint(ch))) { + _nc_warning("Illegal ^ character - %s", + _tracechar((unsigned char)ch)); + } + if (ch == '?') + *(ptr++) = '\177'; + else + *(ptr++) = (char)(ch & 037); + } + else if (ch == '\\') { + ch = c = next_char(); + if (c == EOF) + _nc_err_abort("Premature EOF"); + + if (ch >= '0' && ch <= '7') { + number = ch - '0'; + for (i=0; i < 2; i++) { + ch = c = next_char(); + if (c == EOF) + _nc_err_abort("Premature EOF"); + + if (c < '0' || c > '7') { + if (isdigit(c)) { + _nc_warning("Non-octal digit `%c' in \\ sequence", c); + /* allow the digit; it'll do less harm */ + } else { + push_back((char)c); + break; + } + } + + number = number * 8 + c - '0'; + } + + if (number == 0) + number = 0200; + *(ptr++) = (char) number; + } else { + switch (c) { + case 'E': + case 'e': *(ptr++) = '\033'; break; + + case 'l': + case 'n': *(ptr++) = '\n'; break; + + case 'r': *(ptr++) = '\r'; break; + + case 'b': *(ptr++) = '\010'; break; + + case 's': *(ptr++) = ' '; break; + + case 'f': *(ptr++) = '\014'; break; + + case 't': *(ptr++) = '\t'; break; + + case '\\': *(ptr++) = '\\'; break; + + case '^': *(ptr++) = '^'; break; + + case ',': *(ptr++) = ','; break; + + case ':': *(ptr++) = ':'; break; + + case '\n': + continue; + + default: + _nc_warning("Illegal character %s in \\ sequence", + _tracechar((unsigned char)ch)); + *(ptr++) = (char)ch; + } /* endswitch (ch) */ + } /* endelse (ch < '0' || ch > '7') */ + } /* end else if (ch == '\\') */ + else { + *(ptr++) = (char)ch; + } + + count ++; + + last_ch = ch; + + if (count > MAXCAPLEN) + _nc_warning("Very long string found. Missing separator?"); + } /* end while */ + + *ptr = '\0'; + + return(ch); +} + +/* + * _nc_push_token() + * + * Push a token of given type so that it will be reread by the next + * get_token() call. + */ + +void _nc_push_token(int class) +{ + /* + * This implementation is kind of bogus, it will fail if we ever do + * more than one pushback at a time between get_token() calls. It + * relies on the fact that curr_tok is static storage that nothing + * but get_token() touches. + */ + pushtype = class; + _nc_get_type(pushname); + + DEBUG(3, ("pushing token: `%s', class %d", + _nc_curr_token.tk_name, pushtype)); +} + +/* + * Panic mode error recovery - skip everything until a "ch" is found. + */ +void _nc_panic_mode(char ch) +{ + int c; + + for (;;) { + c = next_char(); + if (c == ch) + return; + if (c == EOF) + return; + } +} + +/***************************************************************************** + * + * Character-stream handling + * + *****************************************************************************/ + +#define LEXBUFSIZ 1024 + +static char *bufptr; /* otherwise, the input buffer pointer */ +static char *bufstart; /* start of buffer so we can compute offsets */ +static FILE *yyin; /* scanner's input file descriptor */ + +/* + * _nc_reset_input() + * + * Resets the input-reading routines. Used on initialization, + * or after a seek has been done. Exactly one argument must be + * non-null. + */ + +void _nc_reset_input(FILE *fp, char *buf) +{ + pushtype = NO_PUSHBACK; + pushname[0] = '\0'; + yyin = fp; + bufstart = bufptr = buf; + _nc_curr_file_pos = 0L; + if (fp != 0) + _nc_curr_line = 0; + _nc_curr_col = 0; +} + +/* + * int next_char() + * + * Returns the next character in the input stream. Comments and leading + * white space are stripped. + * + * The global state variable 'firstcolumn' is set TRUE if the character + * returned is from the first column of the input line. + * + * The global variable _nc_curr_line is incremented for each new line. + * The global variable _nc_curr_file_pos is set to the file offset of the + * beginning of each line. + */ + +static int +next_char(void) +{ + if (!yyin) + { + if (*bufptr == '\0') + return(EOF); + if (*bufptr == '\n') { + _nc_curr_line++; + _nc_curr_col = 0; + } + } + else if (!bufptr || !*bufptr) + { + /* + * In theory this could be recoded to do its I/O one + * character at a time, saving the buffer space. In + * practice, this turns out to be quite hard to get + * completely right. Try it and see. If you succeed, + * don't forget to hack push_back() correspondingly. + */ + static char line[LEXBUFSIZ]; + + do { + _nc_curr_file_pos = ftell(yyin); + + if ((bufstart = fgets(line, LEXBUFSIZ, yyin)) != NULL) { + _nc_curr_line++; + _nc_curr_col = 0; + } + bufptr = bufstart; + } while + (bufstart != NULL && line[0] == '#'); + + if (bufstart == NULL) + return (EOF); + + while (iswhite(*bufptr)) + bufptr++; + } + + first_column = (bufptr == bufstart); + + _nc_curr_col++; + return(*bufptr++); +} + +static void push_back(char c) +/* push a character back onto the input stream */ +{ + if (bufptr == bufstart) + _nc_syserr_abort("Can't backspace off beginning of line"); + *--bufptr = c; +} + +static long stream_pos(void) +/* return our current character position in the input stream */ +{ + return (yyin ? ftell(yyin) : (bufptr ? bufptr - bufstart : 0)); +} + +static bool end_of_stream(void) +/* are we at end of input? */ +{ + return (yyin ? feof(yyin) : (bufptr && *bufptr == '\0')); +} + +/* comp_scan.c ends here */ diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h new file mode 100644 index 00000000..5ebf73b9 --- /dev/null +++ b/ncurses/curses.priv.h @@ -0,0 +1,541 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * $Id: curses.priv.h,v 1.61 1997/04/26 20:54:54 tom Exp $ + * + * curses.priv.h + * + * Header file for curses library objects which are private to + * the library. + * + */ + +#ifndef CURSES_PRIV_H +#define CURSES_PRIV_H 1 + +#include + +#ifdef USE_RCS_IDS +#define MODULE_ID(id) static const char Ident[] = id; +#else +#define MODULE_ID(id) /*nothing*/ +#endif + +#include +#include +#include + +#if HAVE_UNISTD_H +#include +#endif + +#if HAVE_SYS_BSDTYPES_H +#include /* needed for ISC */ +#endif + +#if HAVE_LIMITS_H +# include +#elif HAVE_SYS_PARAM_H +# include +#endif + +#ifndef PATH_MAX +# if defined(_POSIX_PATH_MAX) +# define PATH_MAX _POSIX_PATH_MAX +# elif defined(MAXPATHLEN) +# define PATH_MAX MAXPATHLEN +# else +# define PATH_MAX 255 /* the Posix minimum path-size */ +# endif +#endif + +#include +#include + +#include + +#if !HAVE_EXTERN_ERRNO +extern int errno; +#endif + +/* Some systems have a broken 'select()', but workable 'poll()'. Use that */ +#if HAVE_POLL && HAVE_SYS_STROPTS_H && HAVE_POLL_H +#define USE_FUNC_POLL 1 +#else +#define USE_FUNC_POLL 0 +#endif + +/* Alessandro Rubini's GPM (general-purpose mouse) */ +#if HAVE_LIBGPM && HAVE_GPM_H +#define USE_GPM_SUPPORT 1 +#else +#define USE_GPM_SUPPORT 0 +#endif + +/* + * ht/cbt expansion flakes out randomly under Linux 1.1.47, but only when + * we're throwing control codes at the screen at high volume. To see this, + * re-enable TABS_OK and run worm for a while. Other systems probably don't + * want to define this either due to uncertainties about tab delays and + * expansion in raw mode. + */ +#undef TABS_OK /* OK to use tab/backtab for local motions? */ + +/* + * The internal types (e.g., struct screen) must precede , otherwise + * we cannot construct lint-libraries (structures must be fully-defined). + */ + +struct tries { + struct tries *child; /* ptr to child. NULL if none */ + struct tries *sibling; /* ptr to sibling. NULL if none */ + unsigned char ch; /* character at this node */ + unsigned short value; /* code of string so far. 0 if none. */ +}; + +/* + * Structure for soft labels. + */ + +typedef struct +{ + char *text; /* text for the label */ + char *form_text; /* formatted text (left/center/...) */ + int x; /* x coordinate of this field */ + char dirty; /* this label has changed */ + char visible; /* field is visible */ +} slk_ent; + +typedef struct { + char dirty; /* all labels have changed */ + char hidden; /* soft labels are hidden */ + struct _win_st *win; + slk_ent *ent; + char *buffer; /* buffer for labels */ + short maxlab; /* number of available labels */ + short labcnt; /* number of allocated labels */ + short maxlen; /* length of labels */ +} SLK; + +/* + * Definitions for color pairs + */ +#define C_SHIFT 8 /* we need more bits than there are colors */ +#define C_MASK ((1 << C_SHIFT) - 1) + +#define PAIR_OF(fg, bg) ((((fg) & C_MASK) << C_SHIFT) | ((bg) & C_MASK)) + +/* + * Structure for palette tables + */ + +typedef struct +{ + short red, green, blue; +} +color_t; + +#define MAXCOLUMNS 135 +#define MAXLINES 66 +#define FIFO_SIZE MAXLINES + +struct screen { + int _ifd; /* input file ptr for screen */ + FILE *_ofp; /* output file ptr for screen */ + char *_setbuf; /* buffered I/O for output */ + int _checkfd; /* filedesc for typeahead check */ + struct term *_term; /* terminal type information */ + short _lines; /* screen lines */ + short _columns; /* screen columns */ + short _lines_avail; /* lines available for stdscr */ + short _topstolen; /* lines stolen from top */ + struct _win_st *_curscr; /* current screen */ + struct _win_st *_newscr; /* virtual screen to be updated to */ + struct _win_st *_stdscr; /* screen's full-window context */ + struct tries *_keytry; /* "Try" for use with keypad mode */ + unsigned int _fifo[FIFO_SIZE]; /* input push-back buffer */ + signed char _fifohead, /* head of fifo queue */ + _fifotail, /* tail of fifo queue */ + _fifopeek; /* where to peek for next char */ + int _endwin; /* are we out of window mode? */ + unsigned long _current_attr; /* terminal attribute current set */ + int _coloron; /* is color enabled? */ + int _cursor; /* visibility of the cursor */ + int _cursrow; /* physical cursor row */ + int _curscol; /* physical cursor column */ + int _nl; /* True if NL -> CR/NL is on */ + int _raw; /* True if in raw mode */ + int _cbreak; /* 1 if in cbreak mode */ + /* > 1 if in halfdelay mode */ + int _echo; /* True if echo on */ + int _use_meta; /* use the meta key? */ + SLK *_slk; /* ptr to soft key struct / NULL */ + int _baudrate; /* used to compute padding */ + + /* cursor movement costs; units are 10ths of milliseconds */ + int _char_padding; /* cost of character put */ + int _cr_cost; /* cost of (carriage_return) */ + int _cup_cost; /* cost of (cursor_address) */ + int _home_cost; /* cost of (cursor_home) */ + int _ll_cost; /* cost of (cursor_to_ll) */ +#ifdef TABS_OK + int _ht_cost; /* cost of (tab) */ + int _cbt_cost; /* cost of (backtab) */ +#endif /* TABS_OK */ + int _cub1_cost; /* cost of (cursor_left) */ + int _cuf1_cost; /* cost of (cursor_right) */ + int _cud1_cost; /* cost of (cursor_down) */ + int _cuu1_cost; /* cost of (cursor_up) */ + int _cub_cost; /* cost of (parm_cursor_left) */ + int _cuf_cost; /* cost of (parm_cursor_right) */ + int _cud_cost; /* cost of (parm_cursor_down) */ + int _cuu_cost; /* cost of (parm_cursor_up) */ + int _hpa_cost; /* cost of (column_address) */ + int _vpa_cost; /* cost of (row_address) */ + /* used in lib_doupdate.c, must be chars */ + int _ed_cost; /* cost of (clr_eos) */ + int _el_cost; /* cost of (clr_eol) */ + int _el1_cost; /* cost of (clr_bol) */ + int _dch1_cost; /* cost of (delete_character) */ + int _ich1_cost; /* cost of (insert_character) */ + int _dch_cost; /* cost of (parm_dch) */ + int _ich_cost; /* cost of (parm_ich) */ + int _ech_cost; /* cost of (erase_chars) */ + int _rep_cost; /* cost of (repeat_char) */ + int _hpa_ch_cost; /* cost of (column_address) */ + int _cup_ch_cost; /* cost of (cursor_address) */ + /* used in lib_mvcur.c */ + char * _address_cursor; + int _carriage_return_length; + int _cursor_home_length; + int _cursor_to_ll_length; + /* used in lib_color.c */ + color_t *_color_table; /* screen's color palette */ + int _color_count; /* count of colors in palette */ + unsigned short *_color_pairs; /* screen's color pair list */ + int _pair_count; /* count of color pairs */ + int _default_color; /* use default colors */ +}; + +/* Ncurses' public interface follows the internal types */ +#include /* we'll use -Ipath directive to get the right one! */ + +#ifdef NCURSES_NOMACROS +#include +#endif + +#define WINDOWLIST struct _win_list + WINDOWLIST { + WINDOWLIST *next; + WINDOW *win; +}; + +typedef struct { + int line; /* lines to take, < 0 => from bottom*/ + int (*hook)(struct _win_st *, int); /* callback for user */ + struct _win_st *w; /* maybe we need this for cleanup */ +} ripoff_t; + +/* The terminfo source is assumed to be 7-bit ASCII */ +#define is7bits(c) ((unsigned)(c) < 128) + +#ifndef min +#define min(a,b) ((a) > (b) ? (b) : (a)) +#endif + +#ifndef max +#define max(a,b) ((a) < (b) ? (b) : (a)) +#endif + +/* usually in */ +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif + +#ifndef STDERR_FILENO +#define STDERR_FILENO 2 +#endif + +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif + +#ifndef R_OK +#define R_OK 4 /* Test for read permission. */ +#endif +#ifndef W_OK +#define W_OK 2 /* Test for write permission. */ +#endif +#ifndef X_OK +#define X_OK 1 /* Test for execute permission. */ +#endif +#ifndef F_OK +#define F_OK 0 /* Test for existence. */ +#endif + +#define TextOf(c) ((c) & (chtype)A_CHARTEXT) +#define AttrOf(c) ((c) & (chtype)A_ATTRIBUTES) + +#define BLANK (' '|A_NORMAL) + +#define CHANGED -1 + +#define typeCalloc(type,elts) (type *)calloc(elts,sizeof(type)) +#define FreeIfNeeded(p) if(p != 0) free(p) +#define FreeAndNull(p) free(p); p = 0 + +#include + +/* + * Prefixes for call/return points of library function traces. We use these to + * instrument the public functions so that the traces can be easily transformed + * into regression scripts. + */ +#define T_CALLED(fmt) "called " fmt +#define T_CREATE(fmt) "create " fmt +#define T_RETURN(fmt) "return " fmt + +#ifdef TRACE +#define TR(n, a) if (_nc_tracing & (n)) _tracef a +#define T(a) TR(TRACE_CALLS, a) +#define TPUTS_TRACE(s) _nc_tputs_trace = s; +#define TRACE_RETURN(value,type) return _nc_retrace_##type(value) +#define returnWin(code) TRACE_RETURN(code,win) +#define returnPtr(code) TRACE_RETURN(code,ptr) +#define returnCode(code) TRACE_RETURN(code,int) +#define returnVoid T((T_RETURN(""))); return +extern unsigned _nc_tracing; +extern WINDOW * _nc_retrace_win(WINDOW *); +extern char *_nc_retrace_ptr(char *); +extern const char *_nc_tputs_trace; +extern const char *_nc_visbuf(const char *); +extern const char *_nc_visbuf2(int, const char *); +extern int _nc_retrace_int(int); +extern long _nc_outchars; +#else +#define T(a) +#define TR(n, a) +#define TPUTS_TRACE(s) +#define returnWin(code) return code +#define returnCode(code) return code +#define returnVoid return +#endif + +#define _trace_key(ch) ((ch > KEY_MIN) ? keyname(ch) : _tracechar((unsigned char)ch)) + +#define ALL_BUT_COLOR ((chtype)~(A_COLOR)) +#define IGNORE_COLOR_OFF FALSE + + +/* Macro to put together character and attribute info and return it. + If colors are in the attribute, they have precedence. */ +#define ch_or_attr(ch,at) \ + ((PAIR_NUMBER(at) > 0) ? \ + ((((chtype)ch) & ALL_BUT_COLOR) | (at)) : ((((chtype)ch) | (at)))) + + +#define toggle_attr_on(S,at) \ + if (PAIR_NUMBER(at) > 0)\ + (S) = ((S) & ALL_BUT_COLOR) | (at);\ + else\ + (S) |= (at);\ + T(("new attribute is %s", _traceattr((S)))) + + +#define toggle_attr_off(S,at) \ + if (IGNORE_COLOR_OFF == TRUE) {\ + if (PAIR_NUMBER(at) == 0xff) /* turn off color */\ + (S) &= ~(at);\ + else /* leave color alone */\ + (S) &= ~((at)&ALL_BUT_COLOR);\ + } else {\ + if (PAIR_NUMBER(at) > 0x00) /* turn off color */\ + (S) &= ~(at|A_COLOR);\ + else /* leave color alone */\ + (S) &= ~(at);\ + }\ + T(("new attribute is %s", _traceattr((S)))); + +#define DelCharCost(count) \ + ((parm_dch != 0) \ + ? SP->_dch_cost \ + : ((delete_character != 0) \ + ? (SP->_dch1_cost * count) \ + : INFINITY)) + +#define InsCharCost(count) \ + ((parm_ich != 0) \ + ? SP->_ich_cost \ + : ((insert_character != 0) \ + ? (SP->_ich1_cost * count) \ + : INFINITY)) + +#define UpdateAttrs(c) if (SP->_current_attr != AttrOf(c)) \ + vidattr(AttrOf(c)); + +/* + * Check whether the given character can be output by clearing commands. This + * includes test for being a space and not including any 'bad' attributes, such + * as A_REVERSE. All attribute flags which don't affect appearance of a space + * or can be output by clearing (A_COLOR in case of bce-terminal) are excluded. + */ +#define NONBLANK_ATTR (A_BOLD|A_DIM|A_BLINK) +#define can_clear_with(ch) \ + ((ch & ~(NONBLANK_ATTR|(back_color_erase ? A_COLOR:0))) == BLANK) + +#ifdef NCURSES_EXPANDED + +#undef ch_or_attr +#define ch_or_attr(ch,at) _nc_ch_or_attr(ch,at) +extern chtype _nc_ch_or_attr(chtype, attr_t); + +#undef toggle_attr_on +#define toggle_attr_on(S,at) _nc_toggle_attr_on(&(S), at) +extern void _nc_toggle_attr_on(attr_t *, attr_t); + +#undef toggle_attr_off +#define toggle_attr_off(S,at) _nc_toggle_attr_off(&(S), at) +extern void _nc_toggle_attr_off(attr_t *, attr_t); + +#undef can_clear_with +#define can_clear_with(ch) _nc_can_clear_with(ch) +extern int _nc_can_clear_with(chtype); + +#undef DelCharCost +#define DelCharCost(count) _nc_DelCharCost(count) +extern int _nc_DelCharCost(int); + +#undef InsCharCost +#define InsCharCost(count) _nc_InsCharCost(count) +extern int _nc_InsCharCost(int); + +#undef UpdateAttrs +#define UpdateAttrs(c) _nc_UpdateAttrs(c) +extern void _nc_UpdateAttrs(chtype); + +#else + +extern void _nc_expanded(void); + +#endif + +/* lib_acs.c */ +extern void init_acs(void); /* no prefix, this name is traditional */ + +/* lib_mvcur.c */ +#define INFINITY 1000000 /* cost: too high to use */ + +extern void _nc_mvcur_init(void); +extern void _nc_mvcur_resume(void); +extern void _nc_mvcur_wrap(void); +extern int _nc_mvcur_scrolln(int, int, int, int); + +/* lib_mouse.c */ +extern void _nc_mouse_init(SCREEN *); +extern bool _nc_mouse_event(SCREEN *); +extern bool _nc_mouse_inline(SCREEN *); +extern bool _nc_mouse_parse(int); +extern void _nc_mouse_wrap(SCREEN *); +extern void _nc_mouse_resume(SCREEN *); +extern int _nc_max_click_interval; +extern int _nc_mouse_fd(void); + +/* elsewhere ... */ +extern WINDOW *_nc_makenew(int, int, int, int, int); +extern chtype _nc_background(WINDOW *); +extern chtype _nc_render(WINDOW *, chtype); +extern char *_nc_trace_buf(int, size_t); +extern int _nc_initscr(void); +extern int _nc_keypad(bool); +extern int _nc_outch(int); +extern int _nc_setupscreen(short, short const, FILE *); +extern int _nc_timed_wait(int, int, int *); +extern int _nc_waddch_nosync(WINDOW *, const chtype); +extern void _nc_backspace(WINDOW *win); +extern void _nc_do_color(int, int (*)(int)); +extern void _nc_freeall(void); +extern void _nc_free_and_exit(int); +extern void _nc_freewin(WINDOW *win); +extern void _nc_get_screensize(void); +extern void _nc_hash_map(void); +extern void _nc_outstr(const char *str); +extern void _nc_scroll_optimize(void); +extern void _nc_scroll_window(WINDOW *, int const, short const, short const); +extern void _nc_set_buffer(FILE *ofp, bool buffered); +extern void _nc_signal_handler(bool); +extern void _nc_synchook(WINDOW *win); + +/* + * On systems with a broken linker, define 'SP' as a function to force the + * linker to pull in the data-only module with 'SP'. + */ +#ifndef BROKEN_LINKER +#define BROKEN_LINKER 0 +#endif + +#if BROKEN_LINKER +#define SP _nc_screen() +extern SCREEN *_nc_screen(void); +extern int _nc_alloc_screen(void); +extern void _nc_set_screen(SCREEN *); +#else +extern SCREEN *SP; +#define _nc_alloc_screen() ((SP = typeCalloc(SCREEN, 1)) != 0) +#define _nc_set_screen(sp) SP = sp +#endif + +#if !HAVE_USLEEP +extern int _nc_usleep(unsigned int); +#define usleep(msecs) _nc_usleep(msecs) +#endif + +/* + * We don't want to use the lines or columns capabilities internally, + * because if the application is running multiple screens under + * X windows, it's quite possible they could all have type xterm + * but have different sizes! So... + */ +#define screen_lines SP->_lines +#define screen_columns SP->_columns + +extern int _nc_slk_format; /* != 0 if slk_init() called */ +extern int _nc_slk_initialize(WINDOW *, int); + +/* Macro to check whether or not we use a standard format */ +#define SLK_STDFMT (_nc_slk_format < 3) +/* Macro to determine height of label window */ +#define SLK_LINES (SLK_STDFMT ? 1 : (_nc_slk_format - 2)) + +extern int _nc_ripoffline(int line, int (*init)(WINDOW *,int)); + +#define UNINITIALISED ((struct tries * ) -1) + +extern bool _nc_idlok, _nc_idcok; + +extern WINDOWLIST *_nc_windows; + +#endif /* CURSES_PRIV_H */ diff --git a/ncurses/hardscroll.c b/ncurses/hardscroll.c new file mode 100644 index 00000000..ea2b693d --- /dev/null +++ b/ncurses/hardscroll.c @@ -0,0 +1,420 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/****************************************************************************** + +NAME + hardscroll.c -- hardware-scrolling optimization for ncurses + +SYNOPSIS + void _nc_scroll_optimize(void) + +DESCRIPTION + OVERVIEW + +This algorithm for computes optimum hardware scrolling to transform an +old screen (curscr) into a new screen (newscr) via vertical line moves. + +Because the screen has a `grain' (there are insert/delete/scroll line +operations but no insert/delete/scroll column operations), it is efficient +break the update algorithm into two pieces: a first stage that does only line +moves, optimizing the end product of user-invoked insertions, deletions, and +scrolls; and a second phase (corresponding to the present doupdate code in +ncurses) that does only line transformations. + +The common case we want hardware scrolling for is to handle line insertions +and deletions in screen-oriented text-editors. This two-stage approach will +accomplish that at a low computation and code-size cost. + + LINE-MOVE COMPUTATION + +Now, to a discussion of the line-move computation. + +For expository purposes, consider the screen lines to be represented by +integers 0..23 (with the understanding that the value of 23 may vary). +Let a new line introduced by insertion, scrolling, or at the bottom of +the screen following a line delete be given the index -1. + +Assume that the real screen starts with lines 0..23. Now, we have +the following possible line-oriented operations on the screen: + +Insertion: inserts a line at a given screen row, forcing all lines below +to scroll forward. The last screen line is lost. For example, an insertion +at line 5 would produce: 0..4 -1 5..23. + +Deletion: deletes a line at a given screen row, forcing all lines below +to scroll forward. The last screen line is made new. For example, a deletion +at line 7 would produce: 0..6 8..23 -1. + +Scroll up: move a range of lines up 1. The bottom line of the range +becomes new. For example, scrolling up the region from 9 to 14 will +produce 0..8 10..14 -1 15..23. + +Scroll down: move a range of lines down 1. The top line of the range +becomes new. For example, scrolling down the region from 12 to 16 will produce +0..11 -1 12..15 17..23. + +Now, an obvious property of all these operations is that they preserve the +order of old lines, though not their position in the sequence. + +The key trick of this algorithm is that the original line indices described +above are actually maintained as _line[].oldindex fields in the window +structure, and stick to each line through scroll and insert/delete operations. + +Thus, it is possible at update time to look at the oldnum fields and compute +an optimal set of il/dl/scroll operations that will take the real screen +lines to the virtual screen lines. Once these vertical moves have been done, +we can hand off to the second stage of the update algorithm, which does line +transformations. + +Note that the move computation does not need to have the full generality +of a diff algorithm (which it superficially resembles) because lines cannot +be moved out of order. + + THE ALGORITHM + +First, mark each line on the real screen that is *not* carried over to the +virtual screen discarded (that is, with a -1 oldnum index). + +Second, optionally run through each virtual line with a non -1 oldnum. If the +line is sufficiently changed, mark it -1 (we don't want to move it). The exact +test for "sufficiently changed" is not relevant to the control flow of this +algorithm. Cases the test should detect are those in which rewriting +the line from whatever might be on the real screen would be cheaper than the +move. Blank lines on a terminal with clear-to-eol probably meet this test. + +Here is pseudo-code for the remainder of the algorithm: + + repeat +1: first = 0; +2: no_hunk_moved = TRUE; + + # on each pass, try to find a movable hunk +3: while (first < screen_depth) + + # scan for start of hunk +4: while (oldnum field of first == -1) + first++ + + # if we have no hunk, quit this pass +5: if (first >= screen_depth) + break; + + # we found a hunk +6: last = (end of longest continues oldnum range starting here) + +7: ofirst = (first line's oldnum, where it was on real screen) +8: olast = (last line's oldnum, where it was on real screen) + + # figure the hunk's displacement +9: disp = first - (first virtual line's oldnum field) + + # does the hunk want to move? +10: if (disp != 0) + # is the hunk movable without destroying info? +11: if (real [ofirst+disp, olast+disp] are all in range or DISCARDED) +12: if (disp > 0) +13: scroll real [ofirst, olast+disp] down by disp + (mark [ofirst, olast+disp] DISCARDED) +14: else if (disp < 0) +15: scroll real [ofirst+disp, olast] up by disp + (mark [ofirst+disp, olast] DISCARDED) +16: no_hunk_moved = FALSE + + # done trying to move this hunk +17: first = last + 1; + end while + until +18: no_hunk_moved; # quit when a complete pass finds no movable hunks + +HOW TO TEST THIS: + +Use the following production: + +hardscroll: hardscroll.c + $(CC) -g -DSCROLLDEBUG hardscroll.c -o hardscroll + +Then just type scramble vectors and watch. The following test loads are +a representative sample of cases: + +----------------------------- CUT HERE ------------------------------------ +# No lines moved + 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 +# +# A scroll up + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 -1 +# +# A scroll down +-1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 +# +# An insertion (after line 12) + 0 1 2 3 4 5 6 7 8 9 10 11 12 -1 13 14 15 16 17 18 19 20 21 22 +# +# A simple deletion (line 10) + 0 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 -1 +# +# A more complex case +-1 -1 -1 -1 -1 3 4 5 6 7 -1 -1 8 9 10 11 12 13 14 15 16 17 -1 -1 +----------------------------- CUT HERE ------------------------------------ + +AUTHOR + Eric S. Raymond , November 1994 + +*****************************************************************************/ + +#include + +MODULE_ID("$Id: hardscroll.c,v 1.17 1997/02/15 22:33:12 tom Exp $") + +#if defined(TRACE) || defined(SCROLLDEBUG) +void _nc_linedump(void); +#endif /* defined(TRACE) || defined(SCROLLDEBUG) */ + +/* if only this number of lines is carried over, nuke the screen and redraw */ +#define CLEAR_THRESHOLD 3 + +#if defined(SCROLLDEBUG) || defined(HASHDEBUG) +#define LINES 24 +int oldnums[LINES], reallines[LINES]; +#define OLDNUM(n) oldnums[n] +#define REAL(m) reallines[m] +#undef T +#define T(x) (void) printf x ; (void) putchar('\n'); +#else +#include +#define OLDNUM(n) newscr->_line[n].oldindex +#define REAL(m) curscr->_line[m].oldindex +#ifndef _NEWINDEX +#define _NEWINDEX -1 +#endif /* _NEWINDEX */ +#endif /* defined(SCROLLDEBUG) || defined(HASHDEBUG) */ + +static bool all_discarded(int const top, int const bottom, int const disp) +/* has the given range of real lines been marked discarded? */ +{ + int n; + + for (n = top + disp; n <= bottom + disp; n++) + if (REAL(n) != _NEWINDEX && !(REAL(n) <= bottom && REAL(n) >= top)) + return(FALSE); + + return(TRUE); +} + +void _nc_scroll_optimize(void) +/* scroll optimization to transform curscr to newscr */ +{ + bool no_hunk_moved; /* no hunk moved on this pass? */ + int n, new_lines; +#if defined(TRACE) || defined(SCROLLDEBUG) + int pass = 0; +#endif /* defined(TRACE) || defined(SCROLLDEBUG) */ + + TR(TRACE_ICALLS, ("_nc_scroll_optimize() begins")); + + /* mark any line not carried over with _NEWINDEX */ + for (n = 0; n < LINES; n++) + REAL(n) += (MAXLINES + 1); + for (n = 0; n < LINES; n++) + if (OLDNUM(n) != _NEWINDEX + && REAL(OLDNUM(n)) >= MAXLINES) + REAL(OLDNUM(n)) -= (MAXLINES + 1); + for (n = new_lines = 0; n < LINES; n++) + if (REAL(n) > MAXLINES) + { + REAL(n) = _NEWINDEX; + new_lines++; + } + + /* + * ^F in vi (which scrolls forward by LINES-2 in the file) exposes + * a weakness in this design. Ideally, vertical motion + * optimization should cost its actions and then force a + * ClrUpdate() and complete redraw if that would be faster than + * the scroll. Unfortunately, this would be a serious pain to + * arrange; hence, this hack. If there are few enough lines + * carried over, don't bother with the scrolling, we just nuke the + * screen and redraw the whole thing. Keith Bostic argues that + * this will be a win on strictly visual grounds even if the + * resulting update is theoretically sub-optimal. Experience + * with vi says he's probably right. + */ + if (LINES - new_lines <= CLEAR_THRESHOLD) + { + T(("too few lines carried over, nuking screen")); +#if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) + clearok(stdscr, TRUE); +#endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */ + return; + } + +#ifdef TRACE + TR(TRACE_UPDATE | TRACE_MOVE, ("After real line marking:")); + if (_nc_tracing & (TRACE_UPDATE | TRACE_MOVE)) + _nc_linedump(); +#endif /* TRACE */ + + /* time to shuffle lines to do scroll optimization */ + do { + int first; /* first line of current hunk */ + int last; /* last line of current hunk */ + int ofirst; /* oldnum index of first line */ + int olast; /* oldnum index of last line */ + int disp; /* hunk displacement */ + + TR(TRACE_UPDATE | TRACE_MOVE, ("Pass %d:", pass++)); + + first = 0; /* start scan at top line */ + no_hunk_moved = TRUE; + + while (first < LINES) + { + /* find the beginning of a hunk */ + while (first < LINES && OLDNUM(first) == _NEWINDEX) + first++; + if (first >= LINES) + break; + + /* find the end of the hunk */ + for (last = first; last < LINES; last++) + if (last == LINES - 1 || OLDNUM(last + 1) != OLDNUM(last) + 1) + break; + + /* find the corresponding range on the old screen */ + ofirst = OLDNUM(first); + olast = OLDNUM(last); + + /* compute the hunk's displacement */ + disp = first - OLDNUM(first); + + TR(TRACE_UPDATE | TRACE_MOVE, ("found hunk: first = %2d, last = %2d, ofirst = %2d, olast = %2d, disp = %2d", + first, last, ofirst, olast, disp)); + + /* OK, time to try to move the hunk? */ + if (disp != 0) + if (all_discarded(ofirst, olast, disp)) + { + int m; + + if (disp > 0) + olast += disp; + else /* (disp < 0) */ + ofirst += disp; + + TR(TRACE_UPDATE | TRACE_MOVE, ("scroll [%d, %d] by %d", ofirst, olast, -disp)); +#if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) + if (_nc_mvcur_scrolln(-disp, ofirst, olast, LINES - 1) == ERR) + break; + _nc_scroll_window(curscr, -disp, ofirst, olast); +#endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */ + + for (m = ofirst; m <= olast; m++) + { + REAL(m) = _NEWINDEX; +#if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) + /* + * This will tell the second stage of the optimizer + * that every line in the hunk on the real screen has + * been changed. + */ + curscr->_line[m].firstchar = 0; + curscr->_line[m].lastchar = curscr->_maxx; +#endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */ + } + for (m = first; m <= last; m++) + OLDNUM(m) = _NEWINDEX; + + no_hunk_moved = FALSE; + } + + /* OK, done with this hunk */ + first = last + 1; + } + } while + (!no_hunk_moved); +} + +#if defined(TRACE) || defined(SCROLLDEBUG) +void _nc_linedump(void) +/* dump the state of the real and virtual oldnum fields */ +{ + int n; + char buf[BUFSIZ]; + + (void) strcpy(buf, "real"); + for (n = 0; n < LINES; n++) + (void) sprintf(buf + strlen(buf), " %02d", REAL(n)); + TR(TRACE_UPDATE | TRACE_MOVE, (buf)); + + (void) strcpy(buf, "virt"); + for (n = 0; n < LINES; n++) + (void) sprintf(buf + strlen(buf), " %02d", OLDNUM(n)); + TR(TRACE_UPDATE | TRACE_MOVE, (buf)); +} +#endif /* defined(TRACE) || defined(SCROLLDEBUG) */ + +#ifdef SCROLLDEBUG + +int +main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) +{ + char line[BUFSIZ], *st; + + _nc_tracing = TRACE_MOVE; + for (;;) + { + int n; + + for (n = 0; n < LINES; n++) + { + reallines[n] = n; + oldnums[n] = _NEWINDEX; + } + + /* grab the test vector */ + if (fgets(line, sizeof(line), stdin) == (char *)NULL) + exit(EXIT_SUCCESS); + + /* parse it */ + n = 0; + if (line[0] == '#') + { + (void) fputs(line, stderr); + continue; + } + st = strtok(line, " "); + do { + oldnums[n++] = atoi(st); + } while + ((st = strtok((char *)NULL, " ")) != 0); + + /* display it */ + (void) fputs("Initial input:\n", stderr); + _nc_linedump(); + + _nc_scroll_optimize(); + } +} + +#endif /* SCROLLDEBUG */ + +/* hardscroll.c ends here */ diff --git a/ncurses/hashmap.c b/ncurses/hashmap.c new file mode 100644 index 00000000..184ff1d7 --- /dev/null +++ b/ncurses/hashmap.c @@ -0,0 +1,319 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/****************************************************************************** + +NAME + hashmap.c -- fill in scramble vector based on text hashes + +SYNOPSIS + void _nc_hash_map(void) + +DESCRIPTION: + This code attempts to recognize pairs of old and new lines in the physical +and virtual screens. When a line pair is recognized, the old line index is +placed in the oldindex member of the virtual screen line, to be used by the +vertical-motion optimizer portion of the update logic (see hardscroll.c). + + Line pairs are recognized by applying a modified Heckel's algorithm, +sped up by hashing. If a line hash is unique in both screens, those +lines must be a pair. If the hashes of the two lines immediately following +lines known to be a pair are the same, the following lines are also a pair. +We apply these rules repeatedly until no more pairs are found. The +modifications stem from the fact that there may already be oldindex info +associated with the virtual screen, which has to be respected. + + We don't worry about false pairs produced by hash collisions, on the +assumption that such cases are rare and will only make the latter stages +of update less efficient, not introduce errors. + +HOW TO TEST THIS: + +Use the following production: + +hashmap: hashmap.c + $(CC) -g -DHASHDEBUG hashmap.c hardscroll.c ../objects/lib_trace.o -o hashmap + +AUTHOR + Eric S. Raymond , May 1996 + +*****************************************************************************/ + +#include + +MODULE_ID("$Id: hashmap.c,v 1.12 1997/05/03 20:30:06 tom Exp $") + +#ifdef HASHDEBUG +#define LINES 24 +#define TEXTWIDTH 1 +int oldnums[LINES], reallines[LINES]; +static chtype oldtext[LINES][TEXTWIDTH], newtext[LINES][TEXTWIDTH]; +#define OLDNUM(n) oldnums[n] +#define REAL(m) reallines[m] +#define OLDTEXT(n) oldtext[n] +#define NEWTEXT(m) newtext[m] +#undef T +#define T(x) (void) printf x ; (void) putchar('\n'); +#else +#include +#define OLDNUM(n) newscr->_line[n].oldindex +#define REAL(m) curscr->_line[m].oldindex +#define OLDTEXT(n) curscr->_line[n].text +#define NEWTEXT(m) newscr->_line[m].text +#define TEXTWIDTH (curscr->_maxx+1) +#ifndef _NEWINDEX +#define _NEWINDEX -1 +#endif /* _NEWINDEX */ +#endif /* HASHDEBUG */ + +/* Chris Torek's hash function (from his DB package). */ +static inline unsigned long hash4(const void *key, size_t len) +{ + register long h, loop; + register unsigned const char *k; + +#define HASH4a h = (h << 5) - h + *k++; +#define HASH4b h = (h << 5) + h + *k++; +#define HASH4 HASH4b + h = 0; + k = (unsigned const char *)key; + if (len > 0) { + loop = (len + 8 - 1) >> 3; + switch (len & (8 - 1)) { + case 0: + do { /* All fall throughs */ + HASH4; + case 7: + HASH4; + case 6: + HASH4; + case 5: + HASH4; + case 4: + HASH4; + case 3: + HASH4; + case 2: + HASH4; + case 1: + HASH4; + } while (--loop); + } + } + return ((unsigned long)h); +} + +static inline unsigned long hash(chtype *text) +{ + return(hash4(text, TEXTWIDTH*sizeof(*text))); +} + +void _nc_hash_map(void) +{ + typedef struct + { + unsigned long hashval; + int oldcount, newcount; + int oldindex, newindex; + } + sym; + sym hashtab[MAXLINES*2], *sp; + register int i; + long oldhash[MAXLINES], newhash[MAXLINES]; + bool keepgoing; + + /* + * Set up and count line-hash values. + */ + memset(hashtab, '\0', sizeof(sym) * MAXLINES); + for (i = 0; i < LINES; i++) + { + unsigned long hashval = hash(OLDTEXT(i)); + + for (sp = hashtab; sp->hashval; sp++) + if (sp->hashval == hashval) + break; + sp->hashval = hashval; /* in case this is a new entry */ + oldhash[i] = hashval; + sp->oldcount++; + sp->oldindex = i; + } + for (i = 0; i < LINES; i++) + { + unsigned long hashval = hash(NEWTEXT(i)); + + for (sp = hashtab; sp->hashval; sp++) + if (sp->hashval == hashval) + break; + sp->hashval = hashval; /* in case this is a new entry */ + newhash[i] = hashval; + sp->newcount++; + sp->newindex = i; + + OLDNUM(i) = _NEWINDEX; + } + + /* + * Mark line pairs corresponding to unique hash pairs. + * Note: we only do this where the new line doesn't + * already have a valid oldindex -- this way we preserve the + * information left in place by the software scrolling functions. + */ + for (sp = hashtab; sp->hashval; sp++) + if (sp->oldcount == 1 && sp->newcount == 1 + && OLDNUM(sp->newindex) == _NEWINDEX) + { + TR(TRACE_UPDATE | TRACE_MOVE, + ("new line %d is hash-identical to old line %d (unique)", + sp->newindex, sp->oldindex)); + OLDNUM(sp->newindex) = sp->oldindex; + } + + /* + * Now for the tricky part. We have unique pairs to use as anchors. + * Use these to deduce the presence of spans of identical lines. + */ + do { + keepgoing = FALSE; + + for (i = 0; i < LINES-1; i++) + if (OLDNUM(i) != _NEWINDEX && OLDNUM(i+1) == _NEWINDEX) + { + if (OLDNUM(i) + 1 < LINES + && newhash[i+1] == oldhash[OLDNUM(i) + 1]) + { + OLDNUM(i+1) = OLDNUM(i) + 1; + TR(TRACE_UPDATE | TRACE_MOVE, + ("new line %d is hash-identical to old line %d (forward continuation)", + i+1, OLDNUM(i) + 1)); + keepgoing = TRUE; + } + } + + for (i = 0; i < LINES-1; i++) + if (OLDNUM(i) != _NEWINDEX && OLDNUM(i-1) == _NEWINDEX) + { + if (OLDNUM(i) - 1 >= 0 + && newhash[i-1] == oldhash[OLDNUM(i) - 1]) + { + OLDNUM(i-1) = OLDNUM(i) - 1; + TR(TRACE_UPDATE | TRACE_MOVE, + ("new line %d is hash-identical to old line %d (backward continuation)", + i-1, OLDNUM(i) - 1)); + keepgoing = TRUE; + } + } + } while + (keepgoing); +} + +#ifdef HASHDEBUG + +int +main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) +{ + extern void _nc_linedump(void); + char line[BUFSIZ], *st; + int n; + + for (n = 0; n < LINES; n++) + { + reallines[n] = n; + oldnums[n] = _NEWINDEX; + oldtext[n][0] = newtext[n][0] = '.'; + } + + _nc_tracing = TRACE_MOVE; + for (;;) + { + /* grab a test command */ + if (fgets(line, sizeof(line), stdin) == (char *)NULL) + exit(EXIT_SUCCESS); + + switch(line[0]) + { + case '#': /* comment */ + (void) fputs(line, stderr); + break; + + case 'l': /* get initial line number vector */ + for (n = 0; n < LINES; n++) + { + reallines[n] = n; + oldnums[n] = _NEWINDEX; + } + n = 0; + st = strtok(line, " "); + do { + oldnums[n++] = atoi(st); + } while + ((st = strtok((char *)NULL, " ")) != 0); + break; + + case 'n': /* use following letters as text of new lines */ + for (n = 0; n < LINES; n++) + newtext[n][0] = '.'; + for (n = 0; n < LINES; n++) + if (line[n+1] == '\n') + break; + else + newtext[n][0] = line[n+1]; + break; + + case 'o': /* use following letters as text of old lines */ + for (n = 0; n < LINES; n++) + oldtext[n][0] = '.'; + for (n = 0; n < LINES; n++) + if (line[n+1] == '\n') + break; + else + oldtext[n][0] = line[n+1]; + break; + + case 'd': /* dump state of test arrays */ + _nc_linedump(); + (void) fputs("Old lines: [", stdout); + for (n = 0; n < LINES; n++) + putchar(oldtext[n][0]); + putchar(']'); + putchar('\n'); + (void) fputs("New lines: [", stdout); + for (n = 0; n < LINES; n++) + putchar(newtext[n][0]); + putchar(']'); + putchar('\n'); + break; + + case 'h': /* apply hash mapper and see scroll optimization */ + _nc_hash_map(); + (void) fputs("Result:\n", stderr); + _nc_linedump(); + _nc_scroll_optimize(); + (void) fputs("Done.\n", stderr); + break; + } + } + return EXIT_SUCCESS; +} + +#endif /* HASHDEBUG */ + +/* hashmap.c ends here */ diff --git a/ncurses/keys.list b/ncurses/keys.list new file mode 100644 index 00000000..f9e3dd65 --- /dev/null +++ b/ncurses/keys.list @@ -0,0 +1,150 @@ +key_a1 KEY_A1 +key_a3 KEY_A3 +key_b2 KEY_B2 +key_backspace KEY_BACKSPACE +key_beg KEY_BEG +key_btab KEY_BTAB +key_c1 KEY_C1 +key_c3 KEY_C3 +key_cancel KEY_CANCEL +key_catab KEY_CATAB +key_clear KEY_CLEAR +key_close KEY_CLOSE +key_command KEY_COMMAND +key_copy KEY_COPY +key_create KEY_CREATE +key_ctab KEY_CTAB +key_dc KEY_DC +key_dl KEY_DL +key_down KEY_DOWN +key_eic KEY_EIC +key_end KEY_END +key_enter KEY_ENTER +key_eol KEY_EOL +key_eos KEY_EOS +key_exit KEY_EXIT +key_f0 KEY_F(0) +key_f1 KEY_F(1) +key_f2 KEY_F(2) +key_f3 KEY_F(3) +key_f4 KEY_F(4) +key_f5 KEY_F(5) +key_f6 KEY_F(6) +key_f7 KEY_F(7) +key_f8 KEY_F(8) +key_f9 KEY_F(9) +key_f10 KEY_F(10) +key_f11 KEY_F(11) +key_f12 KEY_F(12) +key_f13 KEY_F(13) +key_f14 KEY_F(14) +key_f15 KEY_F(15) +key_f16 KEY_F(16) +key_f17 KEY_F(17) +key_f18 KEY_F(18) +key_f19 KEY_F(19) +key_f20 KEY_F(20) +key_f21 KEY_F(21) +key_f22 KEY_F(22) +key_f23 KEY_F(23) +key_f24 KEY_F(24) +key_f25 KEY_F(25) +key_f26 KEY_F(26) +key_f27 KEY_F(27) +key_f28 KEY_F(28) +key_f29 KEY_F(29) +key_f30 KEY_F(30) +key_f31 KEY_F(31) +key_f32 KEY_F(32) +key_f33 KEY_F(33) +key_f34 KEY_F(34) +key_f35 KEY_F(35) +key_f36 KEY_F(36) +key_f37 KEY_F(37) +key_f38 KEY_F(38) +key_f39 KEY_F(39) +key_f40 KEY_F(40) +key_f41 KEY_F(41) +key_f42 KEY_F(42) +key_f43 KEY_F(43) +key_f44 KEY_F(44) +key_f45 KEY_F(45) +key_f46 KEY_F(46) +key_f47 KEY_F(47) +key_f48 KEY_F(48) +key_f49 KEY_F(49) +key_f50 KEY_F(50) +key_f51 KEY_F(51) +key_f52 KEY_F(52) +key_f53 KEY_F(53) +key_f54 KEY_F(54) +key_f55 KEY_F(55) +key_f56 KEY_F(56) +key_f57 KEY_F(57) +key_f58 KEY_F(58) +key_f59 KEY_F(59) +key_f60 KEY_F(60) +key_f61 KEY_F(61) +key_f62 KEY_F(62) +key_f63 KEY_F(63) +key_find KEY_FIND +key_help KEY_HELP +key_home KEY_HOME +key_ic KEY_IC +key_il KEY_IL +key_left KEY_LEFT +key_ll KEY_LL +key_mark KEY_MARK +key_message KEY_MESSAGE +key_move KEY_MOVE +key_next KEY_NEXT +key_npage KEY_NPAGE +key_open KEY_OPEN +key_options KEY_OPTIONS +key_ppage KEY_PPAGE +key_previous KEY_PREVIOUS +key_print KEY_PRINT +key_redo KEY_REDO +key_reference KEY_REFERENCE +key_refresh KEY_REFRESH +key_replace KEY_REPLACE +key_restart KEY_RESTART +key_resume KEY_RESUME +key_right KEY_RIGHT +key_save KEY_SAVE +key_sbeg KEY_SBEG +key_scancel KEY_SCANCEL +key_scommand KEY_SCOMMAND +key_scopy KEY_SCOPY +key_screate KEY_SCREATE +key_sdc KEY_SDC +key_sdl KEY_SDL +key_select KEY_SELECT +key_send KEY_SEND +key_seol KEY_SEOL +key_sexit KEY_SEXIT +key_sf KEY_SF +key_sfind KEY_SFIND +key_shelp KEY_SHELP +key_shome KEY_SHOME +key_sic KEY_SIC +key_sleft KEY_SLEFT +key_smessage KEY_SMESSAGE +key_smove KEY_SMOVE +key_snext KEY_SNEXT +key_soptions KEY_SOPTIONS +key_sprevious KEY_SPREVIOUS +key_sprint KEY_SPRINT +key_sr KEY_SR +key_sredo KEY_SREDO +key_sreplace KEY_SREPLACE +key_sright KEY_SRIGHT +key_srsume KEY_SRSUME +key_ssave KEY_SSAVE +key_ssuspend KEY_SSUSPEND +key_stab KEY_STAB +key_sundo KEY_SUNDO +key_suspend KEY_SUSPEND +key_undo KEY_UNDO +key_up KEY_UP +key_mouse KEY_MOUSE diff --git a/ncurses/lib_acs.c b/ncurses/lib_acs.c new file mode 100644 index 00000000..bacfe058 --- /dev/null +++ b/ncurses/lib_acs.c @@ -0,0 +1,133 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +#include +#include /* ena_acs, acs_chars */ + +MODULE_ID("$Id: lib_acs.c,v 1.8 1997/04/24 11:04:07 tom Exp $") + +chtype acs_map[128]; + +void init_acs(void) +{ + T(("initializing ACS map")); + + /* + * Initializations for a UNIX-like multi-terminal environment. Use + * ASCII chars and count on the terminfo description to do better. + */ + ACS_ULCORNER = '+'; /* should be upper left corner */ + ACS_LLCORNER = '+'; /* should be lower left corner */ + ACS_URCORNER = '+'; /* should be upper right corner */ + ACS_LRCORNER = '+'; /* should be lower right corner */ + ACS_RTEE = '+'; /* should be tee pointing left */ + ACS_LTEE = '+'; /* should be tee pointing right */ + ACS_BTEE = '+'; /* should be tee pointing up */ + ACS_TTEE = '+'; /* should be tee pointing down */ + ACS_HLINE = '-'; /* should be horizontal line */ + ACS_VLINE = '|'; /* should be vertical line */ + ACS_PLUS = '+'; /* should be large plus or crossover */ + ACS_S1 = '~'; /* should be scan line 1 */ + ACS_S9 = '_'; /* should be scan line 9 */ + ACS_DIAMOND = '+'; /* should be diamond */ + ACS_CKBOARD = ':'; /* should be checker board (stipple) */ + ACS_DEGREE = '\''; /* should be degree symbol */ + ACS_PLMINUS = '#'; /* should be plus/minus */ + ACS_BULLET = 'o'; /* should be bullet */ + ACS_LARROW = '<'; /* should be arrow pointing left */ + ACS_RARROW = '>'; /* should be arrow pointing right */ + ACS_DARROW = 'v'; /* should be arrow pointing down */ + ACS_UARROW = '^'; /* should be arrow pointing up */ + ACS_BOARD = '#'; /* should be board of squares */ + ACS_LANTERN = '#'; /* should be lantern symbol */ + ACS_BLOCK = '#'; /* should be solid square block */ + /* these defaults were invented for ncurses */ + ACS_S3 = '-'; /* should be scan line 3 */ + ACS_S7 = '-'; /* should be scan line 7 */ + ACS_LEQUAL = '<'; /* should be less-than-or-equal-to */ + ACS_GEQUAL = '>'; /* should be greater-than-or-equal-to */ + ACS_PI = '*'; /* should be greek pi */ + ACS_NEQUAL = '!'; /* should be not-equal */ + ACS_STERLING = 'f'; /* should be pound-sterling symbol */ + +#ifdef ena_acs + if (ena_acs != NULL) + { + TPUTS_TRACE("ena_acs"); + putp(ena_acs); + } +#endif /* ena_acs */ + +#ifdef acs_chars +#define ALTCHAR(c) (TextOf(c) | A_ALTCHARSET) + + if (acs_chars != NULL) { + size_t i = 0; + size_t length = strlen(acs_chars); + + while (i < length) + switch (acs_chars[i]) { + case 'l':case 'm':case 'k':case 'j': + case 'u':case 't':case 'v':case 'w': + case 'q':case 'x':case 'n':case 'o': + case 's':case '`':case 'a':case 'f': + case 'g':case '~':case ',':case '+': + case '.':case '-':case 'h':case 'I': + case '0':case 'p':case 'r':case 'y': + case 'z':case '{':case '|':case '}': + acs_map[(unsigned int)acs_chars[i]] = + ALTCHAR(acs_chars[i+1]); + i++; + /* FALLTHRU */ + default: + i++; + break; + } + } +#ifdef TRACE +#define SIZEOF(v) (sizeof(v)/sizeof(v[0])) + /* Show the equivalent mapping, noting if it does not match the + * given attribute, whether by re-ordering or duplication. + */ + if (_nc_tracing & TRACE_CALLS) { + size_t n, m; + char show[SIZEOF(acs_map) + 1]; + for (n = 1, m = 0; n < SIZEOF(acs_map); n++) { + if (acs_map[n] != 0) { + show[m++] = (char)n; + show[m++] = TextOf(acs_map[n]); + } + } + show[m] = 0; + _tracef("%s acs_chars %s", + (acs_chars == NULL) + ? "NULL" + : (strcmp(acs_chars, show) + ? "DIFF" + : "SAME"), + _nc_visbuf(show)); + } +#endif /* TRACE */ +#endif /* acs_char */ +} + diff --git a/ncurses/lib_adabind.c b/ncurses/lib_adabind.c new file mode 100644 index 00000000..aea6f1a5 --- /dev/null +++ b/ncurses/lib_adabind.c @@ -0,0 +1,220 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* +** lib_adabind.c +** +** Some small wrappers to ease the implementation of an Ada95 +** binding. Especially functionalities only available as macros +** in (n)curses are wrapped here by functions. +** See the documentation and copyright notices in the ../Ada95 +** subdirectory. +*/ +#include "curses.priv.h" + +/* In (n)curses are a few functionalities that can't be expressed as +// functions, because for historic reasons they use as macro argument +// variable names that are "out" parameters. For those macros we provide +// small wrappers. +*/ + +/* Prototypes for the functions in this module */ +int _nc_ada_getmaxyx (WINDOW *win, int *y, int *x); +int _nc_ada_getbegyx (WINDOW *win, int *y, int *x); +int _nc_ada_getyx (WINDOW *win, int *y, int *x); +int _nc_ada_getparyx (WINDOW *win, int *y, int *x); +int _nc_ada_isscroll (WINDOW *win); +int _nc_ada_coord_transform (WINDOW *win, int *Y, int *X, int dir); +void _nc_ada_mouse_event (mmask_t m, int *b, int *s); +int _nc_ada_mouse_mask (int button, int state, mmask_t *mask); +void _nc_ada_unregister_mouse (void); + + +int _nc_ada_getmaxyx (WINDOW *win, int *y, int *x) +{ + if (win && y && x) + { + getmaxyx(win,*y,*x); + return OK; + } + else + return ERR; +} + +int _nc_ada_getbegyx (WINDOW *win, int *y, int *x) +{ + if (win && y && x) + { + getbegyx(win,*y,*x); + return OK; + } + else + return ERR; +} + +int _nc_ada_getyx (WINDOW *win, int *y, int *x) +{ + if (win && y && x) + { + getyx(win,*y,*x); + return OK; + } + else + return ERR; +} + +int _nc_ada_getparyx (WINDOW *win, int *y, int *x) +{ + if (win && y && x) + { + getparyx(win,*y,*x); + return OK; + } + else + return ERR; +} + +int _nc_ada_isscroll (WINDOW *win) +{ + return win ? (win->_scroll ? TRUE : FALSE) : ERR; +} + +int _nc_ada_coord_transform( WINDOW *win, int *Y, int *X, int dir) +{ + if (win && Y && X) + { + int y = *Y; int x = *X; + if (dir) + { /* to screen coordinates */ + y += win->_yoffset; + y += win->_begy; + x += win->_begx; + if (!wenclose(win,y,x)) + return FALSE; + } + else + { /* from screen coordinates */ + if (!wenclose(win,y,x)) + return FALSE; + y -= win->_yoffset; + y -= win->_begy; + x -= win->_begx; + } + *X = x; + *Y = y; + return TRUE; + } + return FALSE; +} + +#define BUTTON1_EVENTS (BUTTON1_RELEASED |\ + BUTTON1_PRESSED |\ + BUTTON1_CLICKED |\ + BUTTON1_DOUBLE_CLICKED |\ + BUTTON1_TRIPLE_CLICKED |\ + BUTTON1_RESERVED_EVENT ) + +#define BUTTON2_EVENTS (BUTTON2_RELEASED |\ + BUTTON2_PRESSED |\ + BUTTON2_CLICKED |\ + BUTTON2_DOUBLE_CLICKED |\ + BUTTON2_TRIPLE_CLICKED |\ + BUTTON2_RESERVED_EVENT ) + +#define BUTTON3_EVENTS (BUTTON3_RELEASED |\ + BUTTON3_PRESSED |\ + BUTTON3_CLICKED |\ + BUTTON3_DOUBLE_CLICKED |\ + BUTTON3_TRIPLE_CLICKED |\ + BUTTON3_RESERVED_EVENT ) + +#define BUTTON4_EVENTS (BUTTON4_RELEASED |\ + BUTTON4_PRESSED |\ + BUTTON4_CLICKED |\ + BUTTON4_DOUBLE_CLICKED |\ + BUTTON4_TRIPLE_CLICKED |\ + BUTTON4_RESERVED_EVENT ) + +void _nc_ada_mouse_event( mmask_t m, int *b, int *s ) +{ + int k = 0; + + if ( m & BUTTON1_EVENTS) + { + k = 1; + } + else if ( m & BUTTON2_EVENTS) + { + k = 2; + } + else if ( m & BUTTON3_EVENTS) + { + k = 3; + } + else if ( m & BUTTON4_EVENTS) + { + k = 4; + } + + if (k) + { + *b = k-1; + if (BUTTON_RELEASE(m,k)) *s = 0; + else if (BUTTON_PRESS(m,k)) *s = 1; + else if (BUTTON_CLICK(m,k)) *s = 2; + else if (BUTTON_DOUBLE_CLICK(m,k)) *s = 3; + else if (BUTTON_TRIPLE_CLICK(m,k)) *s = 4; + else if (BUTTON_RESERVED_EVENT(m,k)) *s = 5; + else + { + *s = -1; + } + } + else + { + *s = 1; + if (m & BUTTON_CTRL) *b = 4; + else if (m & BUTTON_SHIFT) *b = 5; + else if (m & BUTTON_ALT) *b = 6; + else + { + *b = -1; + } + } +} + +int _nc_ada_mouse_mask ( int button, int state, mmask_t *mask ) +{ + mmask_t b = (button<4) ? ((1<=4 && state!=1) + return ERR; + + *mask |= b; + return OK; +} + +void _nc_ada_unregister_mouse (void) +{ + _nc_mouse_wrap(SP); +} + diff --git a/ncurses/lib_addch.c b/ncurses/lib_addch.c new file mode 100644 index 00000000..e2e58190 --- /dev/null +++ b/ncurses/lib_addch.c @@ -0,0 +1,310 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* +** lib_addch.c +** +** The routines waddch(), wattr_on(), wattr_off(), wchgat(). +** +*/ + +#include +#include + +MODULE_ID("$Id: lib_addch.c,v 1.30 1997/04/12 17:45:55 tom Exp $") + +int wattr_on(WINDOW *win, const attr_t at) +{ + T((T_CALLED("wattr_on(%p,%s)"), win, _traceattr(at))); + T(("... current %s", _traceattr(win->_attrs))); + toggle_attr_on(win->_attrs,at); + returnCode(OK); +} + +int wattr_off(WINDOW *win, const attr_t at) +{ + T((T_CALLED("wattr_off(%p,%s)"), win, _traceattr(at))); + T(("... current %s", _traceattr(win->_attrs))); + toggle_attr_off(win->_attrs,at); + returnCode(OK); +} + +int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED) +{ + int i; + + T((T_CALLED("wchgat(%p,%d,%s,%d)"), win, n, _traceattr(attr), color)); + + toggle_attr_on(attr,COLOR_PAIR(color)); + + for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) + win->_line[win->_cury].text[i] + = ch_or_attr(TextOf(win->_line[win->_cury].text[i]),attr); + + returnCode(OK); +} + +/* + * Ugly microtweaking alert. Everything from here to end of module is + * likely to be speed-critical -- profiling data sure says it is! + * Most of the important screen-painting functions are shells around + * waddch(). So we make every effort to reduce function-call overhead + * by inlining stuff, even at the cost of making wrapped copies for + * export. Also we supply some internal versions that don't call the + * window sync hook, for use by string-put functions. + */ + +static inline chtype render_char(WINDOW *win, chtype ch) +/* compute a rendition of the given char correct for the current context */ +{ + if (TextOf(ch) == ' ') + ch = ch_or_attr(ch, win->_bkgd); + else if (!(ch & A_ATTRIBUTES)) + ch = ch_or_attr(ch, (win->_bkgd & A_ATTRIBUTES)); + TR(TRACE_VIRTPUT, ("bkg = %#lx -> ch = %#lx", win->_bkgd, ch)); + + return(ch); +} + +chtype _nc_background(WINDOW *win) +/* make render_char() visible while still allowing us to inline it below */ +{ + return(render_char(win, BLANK)); +} + +chtype _nc_render(WINDOW *win, chtype ch) +/* make render_char() visible while still allowing us to inline it below */ +{ + chtype c = render_char(win,ch); + return (ch_or_attr(c,win->_attrs)); +} + +/* check if position is legal; if not, return error */ +#ifdef NDEBUG /* treat this like an assertion */ +#define CHECK_POSITION(win, x, y) \ + if (y > win->_maxy \ + || x > win->_maxx \ + || y < 0 \ + || x < 0) { \ + TR(TRACE_VIRTPUT, ("Alert! Win=%p _curx = %d, _cury = %d " \ + "(_maxx = %d, _maxy = %d)", win, x, y, \ + win->_maxx, win->_maxy)); \ + return(ERR); \ + } +#else +#define CHECK_POSITION(win, x, y) /* nothing */ +#endif + +static inline +int waddch_literal(WINDOW *win, chtype ch) +{ +register int x, y; + + x = win->_curx; + y = win->_cury; + + CHECK_POSITION(win, x, y); + + /* + * If we're trying to add a character at the lower-right corner more + * than once, fail. (Moving the cursor will clear the flag). + */ + if (win->_flags & _WRAPPED) { + if (x >= win->_maxx) + return (ERR); + win->_flags &= ~_WRAPPED; + } + + ch = render_char(win, ch); + ch = ch_or_attr(ch,win->_attrs); + TR(TRACE_VIRTPUT, ("win attr = %s", _traceattr(win->_attrs))); + + if (win->_line[y].text[x] != ch) { + if (win->_line[y].firstchar == _NOCHANGE) + win->_line[y].firstchar = win->_line[y].lastchar = x; + else if (x < win->_line[y].firstchar) + win->_line[y].firstchar = x; + else if (x > win->_line[y].lastchar) + win->_line[y].lastchar = x; + + } + + win->_line[y].text[x++] = ch; + TR(TRACE_VIRTPUT, ("(%d, %d) = %s", y, x, _tracechtype(ch))); + if (x > win->_maxx) { + /* + * The _WRAPPED flag is useful only for telling an application + * that we've just wrapped the cursor. We don't do anything + * with this flag except set it when wrapping, and clear it + * whenever we move the cursor. If we try to wrap at the + * lower-right corner of a window, we cannot move the cursor + * (since that wouldn't be legal). So we return an error + * (which is what SVr4 does). Unlike SVr4, we can successfully + * add a character to the lower-right corner. + */ + win->_flags |= _WRAPPED; + if (++y > win->_regbottom) { + y = win->_regbottom; + x = win->_maxx; + if (win->_scroll) + scroll(win); + else { + win->_curx = x; + win->_cury = y; + return (ERR); + } + } + x = 0; + } + + win->_curx = x; + win->_cury = y; + + return OK; +} + +static inline +int waddch_nosync(WINDOW *win, const chtype c) +/* the workhorse function -- add a character to the given window */ +{ +register chtype ch = c; +register int x, y; + + x = win->_curx; + y = win->_cury; + + CHECK_POSITION(win, x, y); + + if (ch & A_ALTCHARSET) + goto noctrl; + + switch ((int)TextOf(ch)) { + case '\t': + x += (TABSIZE-(x%TABSIZE)); + + /* + * Space-fill the tab on the bottom line so that we'll get the + * "correct" cursor position. + */ + if ((! win->_scroll && (y == win->_regbottom)) + || (x <= win->_maxx)) { + while (win->_curx < x) { + if (waddch_literal(win, (' ' | AttrOf(ch))) == ERR) + return(ERR); + } + break; + } else { + wclrtoeol(win); + win->_flags |= _WRAPPED; + if (++y > win->_regbottom) { + x = win->_maxx; + y--; + if (win->_scroll) { + scroll(win); + x = 0; + } + } else { + x = 0; + } + } + break; + case '\n': + wclrtoeol(win); + if (++y > win->_regbottom) { + y--; + if (win->_scroll) + scroll(win); + else + return (ERR); + } + /* FALLTHRU */ + case '\r': + x = 0; + win->_flags &= ~_WRAPPED; + break; + case '\b': + if (x > 0) { + x--; + win->_flags &= ~_WRAPPED; + } + break; + default: + if (is7bits(TextOf(ch)) && iscntrl(TextOf(ch))) + return(waddstr(win, unctrl((unsigned char)ch))); + + /* FALLTHRU */ + noctrl: + return waddch_literal(win, ch); + } + + win->_curx = x; + win->_cury = y; + + return(OK); +} + +int _nc_waddch_nosync(WINDOW *win, const chtype c) +/* export copy of waddch_nosync() so the string-put functions can use it */ +{ + return(waddch_nosync(win, c)); +} + +/* + * The versions below call _nc_synhook(). We wanted to avoid this in the + * version exported for string puts; they'll call _nc_synchook once at end + * of run. + */ + +/* These are actual entry points */ + +int waddch(WINDOW *win, const chtype ch) +{ + int code = ERR; + + TR(TRACE_VIRTPUT|TRACE_CCALLS, (T_CALLED("waddch(%p, %s)"), win, _tracechtype(ch))); + + if (waddch_nosync(win, ch) != ERR) + { + _nc_synchook(win); + code = OK; + } + + TR(TRACE_VIRTPUT|TRACE_CCALLS, (T_RETURN("%d"), code)); + return(code); +} + +int wechochar(WINDOW *win, const chtype ch) +{ + int code = ERR; + + TR(TRACE_VIRTPUT|TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"), win, _tracechtype(ch))); + + if (waddch_literal(win, ch) != ERR) + { + bool save_immed = win->_immed; + win->_immed = TRUE; + _nc_synchook(win); + win->_immed = save_immed; + code = OK; + } + TR(TRACE_VIRTPUT|TRACE_CCALLS, (T_RETURN("%d"), code)); + return(code); +} diff --git a/ncurses/lib_addstr.c b/ncurses/lib_addstr.c new file mode 100644 index 00000000..363d2787 --- /dev/null +++ b/ncurses/lib_addstr.c @@ -0,0 +1,90 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* +** lib_addstr.c +* +** The routines waddnstr(), waddchnstr(). +** +*/ + +#include + +MODULE_ID("$Id: lib_addstr.c,v 1.11 1997/03/08 21:38:52 tom Exp $") + +int +waddnstr(WINDOW *win, const char *const astr, int n) +{ +unsigned const char *str = (unsigned const char *)astr; +int code = ERR; + + T((T_CALLED("waddnstr(%p,%s,%d)"), win, _nc_visbuf(astr), n)); + T(("... current %s", _traceattr(win->_attrs))); + + if (str != 0) { + + TR(TRACE_VIRTPUT, ("str is not null")); + code = OK; + if (n < 0) + n = (int)strlen(astr); + + while((n-- > 0) && (*str != '\0')) { + TR(TRACE_VIRTPUT, ("*str = %#x", *str)); + if (_nc_waddch_nosync(win, (chtype)*str++) == ERR) { + code = ERR; + break; + } + } + } + _nc_synchook(win); + TR(TRACE_VIRTPUT, ("waddnstr returns %d", code)); + returnCode(code); +} + +int +waddchnstr(WINDOW *win, const chtype *const astr, int n) +{ +short oy = win->_cury; +short ox = win->_curx; +const chtype *str = (const chtype *)astr; +int code = OK; + + T((T_CALLED("waddchnstr(%p,%p,%d)"), win, str, n)); + + if (n < 0) { + n = 0; + while (*str++ != 0) + n++; + str = (const chtype *)astr; + } + + while(n-- > 0) { + if (_nc_waddch_nosync(win, *str++) == ERR) { + code = ERR; + break; + } + } + + win->_curx = ox; + win->_cury = oy; + _nc_synchook(win); + returnCode(code); +} diff --git a/ncurses/lib_baudrate.c b/ncurses/lib_baudrate.c new file mode 100644 index 00000000..333fd035 --- /dev/null +++ b/ncurses/lib_baudrate.c @@ -0,0 +1,135 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * lib_baudrate.c + * + */ + +#include +#include /* cur_term, pad_char */ + +MODULE_ID("$Id: lib_baudrate.c,v 1.7 1997/04/26 17:41:48 tom Exp $") + +/* + * int + * baudrate() + * + * Returns the current terminal's baud rate. + * + */ + +struct speed { + speed_t s; + int sp; +}; + +static struct speed const speeds[] = { + {B0, 0}, + {B50, 50}, + {B75, 75}, + {B110, 110}, + {B134, 134}, + {B150, 150}, + {B200, 200}, + {B300, 300}, + {B600, 600}, + {B1200, 1200}, + {B1800, 1800}, + {B2400, 2400}, + {B4800, 4800}, + {B9600, 9600}, +#define MAX_BAUD B9600 +#ifdef B19200 +#undef MAX_BAUD +#define MAX_BAUD B19200 + {B19200, 19200}, +#else +#ifdef EXTA +#define MAX_BAUD EXTA + {EXTA, 19200}, +#endif +#endif +#ifdef B38400 +#undef MAX_BAUD +#define MAX_BAUD B38400 + {B38400, 38400}, +#else +#ifdef EXTB +#define MAX_BAUD EXTB + {EXTB, 38400}, +#endif +#endif +#ifdef B57600 +#undef MAX_BAUD +#define MAX_BAUD B57600 + {B57600, 57600}, +#endif +#ifdef B115200 +#undef MAX_BAUD +#define MAX_BAUD B115200 + {B115200, 115200}, +#endif +}; + +int +baudrate(void) +{ +size_t i; +int ret; +#ifdef TRACE +char *debug_rate; +#endif + + T((T_CALLED("baudrate()"))); + + /* + * In debugging, allow the environment symbol to override when we're + * redirecting to a file, so we can construct repeatable test-cases + * that take into account costs that depend on baudrate. + */ +#ifdef TRACE + if (!isatty(fileno(SP->_ofp)) + && (debug_rate = getenv("BAUDRATE")) != 0) { + if (sscanf(debug_rate, "%d", &ret) != 1) + ret = 9600; + returnCode(ret); + } + else +#endif + +#ifdef TERMIOS + ret = cfgetospeed(&cur_term->Nttyb); +#else + ret = cur_term->Nttyb.sg_ospeed; +#endif + if(ret < 0 || ret > MAX_BAUD) + returnCode(ERR); + SP->_baudrate = ERR; + for (i = 0; i < (sizeof(speeds) / sizeof(struct speed)); i++) + if (speeds[i].s == (speed_t)ret) + { + SP->_baudrate = speeds[i].sp; + break; + } + returnCode(SP->_baudrate); +} diff --git a/ncurses/lib_beep.c b/ncurses/lib_beep.c new file mode 100644 index 00000000..71d4b964 --- /dev/null +++ b/ncurses/lib_beep.c @@ -0,0 +1,81 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * beep.c + * + * Routines beep() and flash() + * + */ + +#include +#include /* beep, flash */ + +MODULE_ID("$Id: lib_beep.c,v 1.3 1997/02/02 00:27:01 tom Exp $") + +/* + * beep() + * + * Sound the current terminal's audible bell if it has one. If not, + * flash the screen if possible. + * + */ + +int beep(void) +{ + T((T_CALLED("beep()"))); + + /* FIXME: should make sure that we are not in altchar mode */ + if (bell) { + TPUTS_TRACE("bell"); + return(putp(bell)); + } else if (flash_screen) { + TPUTS_TRACE("flash_screen"); + return(putp(flash_screen)); + } + else + returnCode(ERR); +} + +/* + * flash() + * + * Flash the current terminal's screen if possible. If not, + * sound the audible bell if one exists. + * + */ + +int flash(void) +{ + T((T_CALLED("flash()"))); + + /* FIXME: should make sure that we are not in altchar mode */ + if (flash_screen) { + TPUTS_TRACE("flash_screen"); + returnCode(putp(flash_screen)); + } else if (bell) { + TPUTS_TRACE("bell"); + returnCode(putp(bell)); + } + else + returnCode(ERR); +} diff --git a/ncurses/lib_bkgd.c b/ncurses/lib_bkgd.c new file mode 100644 index 00000000..1bf03870 --- /dev/null +++ b/ncurses/lib_bkgd.c @@ -0,0 +1,52 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +#include + +MODULE_ID("$Id: lib_bkgd.c,v 1.7 1997/04/12 17:44:37 tom Exp $") + +int wbkgd(WINDOW *win, const chtype ch) +{ +int x, y; +chtype old_bkgd = getbkgd(win); +chtype new_bkgd = ch; + + T((T_CALLED("wbkgd(%p,%s)"), win, _tracechtype(new_bkgd))); + + if (TextOf(new_bkgd) == 0) + new_bkgd |= BLANK; + wbkgdset(win, new_bkgd); + wattrset(win, AttrOf(new_bkgd)); + + for (y = 0; y <= win->_maxy; y++) { + for (x = 0; x <= win->_maxx; x++) { + if (win->_line[y].text[x] == old_bkgd) + win->_line[y].text[x] = new_bkgd; + else + win->_line[y].text[x] = + TextOf(win->_line[y].text[x]) + | AttrOf(new_bkgd); + } + } + touchwin(win); + _nc_synchook(win); + returnCode(OK); +} diff --git a/ncurses/lib_box.c b/ncurses/lib_box.c new file mode 100644 index 00000000..c3288254 --- /dev/null +++ b/ncurses/lib_box.c @@ -0,0 +1,160 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* +** lib_box.c +** +** line drawing routines: +** wborder() +** whline() +** wvline() +** +*/ + +#include + +MODULE_ID("$Id: lib_box.c,v 1.7 1997/04/12 17:51:49 tom Exp $") + +int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, + chtype bs, chtype tl, chtype tr, chtype bl, chtype br) +{ +short i; +short endx, endy; + + T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"), + win, + _tracechtype2(1,ls), + _tracechtype2(2,rs), + _tracechtype2(3,ts), + _tracechtype2(4,bs), + _tracechtype2(5,tl), + _tracechtype2(6,tr), + _tracechtype2(7,bl), + _tracechtype2(8,br))); + + if (ls == 0) ls = ACS_VLINE; + if (rs == 0) rs = ACS_VLINE; + if (ts == 0) ts = ACS_HLINE; + if (bs == 0) bs = ACS_HLINE; + if (tl == 0) tl = ACS_ULCORNER; + if (tr == 0) tr = ACS_URCORNER; + if (bl == 0) bl = ACS_LLCORNER; + if (br == 0) br = ACS_LRCORNER; + + ls = _nc_render(win, ls); + rs = _nc_render(win, rs); + ts = _nc_render(win, ts); + bs = _nc_render(win, bs); + tl = _nc_render(win, tl); + tr = _nc_render(win, tr); + bl = _nc_render(win, bl); + br = _nc_render(win, br); + + T(("using %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx", ls, rs, ts, bs, tl, tr, bl, br)); + + endx = win->_maxx; + endy = win->_maxy; + + for (i = 0; i <= endx; i++) { + win->_line[0].text[i] = ts; + win->_line[endy].text[i] = bs; + } + win->_line[endy].firstchar = win->_line[0].firstchar = 0; + win->_line[endy].lastchar = win->_line[0].lastchar = endx; + + for (i = 0; i <= endy; i++) { + win->_line[i].text[0] = ls; + win->_line[i].text[endx] = rs; + win->_line[i].firstchar = 0; + win->_line[i].lastchar = endx; + } + win->_line[0].text[0] = tl; + win->_line[0].text[endx] = tr; + win->_line[endy].text[0] = bl; + win->_line[endy].text[endx] = br; + + _nc_synchook(win); + returnCode(OK); +} + +int whline(WINDOW *win, chtype ch, int n) +{ +short line; +short start; +short end; + + T((T_CALLED("whline(%p,%s,%d)"), win, _tracechtype(ch), n)); + + line = win->_cury; + start = win->_curx; + end = start + n - 1; + if (end > win->_maxx) + end = win->_maxx; + + if (win->_line[line].firstchar == _NOCHANGE || win->_line[line].firstchar > start) + win->_line[line].firstchar = start; + if (win->_line[line].lastchar == _NOCHANGE || win->_line[line].lastchar < start) + win->_line[line].lastchar = end; + + if (ch == 0) + ch = ACS_HLINE; + ch = _nc_render(win, ch); + + while ( end >= start) { + win->_line[line].text[end] = ch; + end--; + } + + returnCode(OK); +} + +int wvline(WINDOW *win, chtype ch, int n) +{ +short row, col; +short end; + + T((T_CALLED("wvline(%p,%s,%d)"), win, _tracechtype(ch), n)); + + row = win->_cury; + col = win->_curx; + end = row + n - 1; + if (end > win->_maxy) + end = win->_maxy; + + if (ch == 0) + ch = ACS_VLINE; + ch = _nc_render(win, ch); + + while(end >= row) { + win->_line[end].text[col] = ch; + if (win->_line[end].firstchar == _NOCHANGE || win->_line[end].firstchar > col) + win->_line[end].firstchar = col; + if (win->_line[end].lastchar == _NOCHANGE || win->_line[end].lastchar < col) + win->_line[end].lastchar = col; + end--; + } + + _nc_synchook(win); + returnCode(OK); +} + diff --git a/ncurses/lib_clear.c b/ncurses/lib_clear.c new file mode 100644 index 00000000..e6485d59 --- /dev/null +++ b/ncurses/lib_clear.c @@ -0,0 +1,42 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* +** lib_clear.c +** +** The routine wclear(). +** +*/ + +#include + +MODULE_ID("$Id: lib_clear.c,v 1.3 1997/02/01 23:18:18 tom Exp $") + +int wclear(WINDOW *win) +{ + T((T_CALLED("wclear(%p)"), win)); + + werase(win); + + win->_clear = TRUE; + + returnCode(OK); +} diff --git a/ncurses/lib_clrbot.c b/ncurses/lib_clrbot.c new file mode 100644 index 00000000..3f0ebda9 --- /dev/null +++ b/ncurses/lib_clrbot.c @@ -0,0 +1,72 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* +** lib_clrbot.c +** +** The routine wclrtobot(). +** +*/ + +#include + +MODULE_ID("$Id: lib_clrbot.c,v 1.9 1997/02/01 23:18:18 tom Exp $") + +int wclrtobot(WINDOW *win) +{ +chtype *ptr, *end, *maxx = NULL; +short y, startx, minx; + + T((T_CALLED("wclrtobot(%p)"), win)); + + startx = win->_curx; + + T(("clearing from y = %d to y = %d with maxx = %d", win->_cury, win->_maxy, win->_maxx)); + + for (y = win->_cury; y <= win->_maxy; y++) { + minx = _NOCHANGE; + end = &win->_line[y].text[win->_maxx]; + + for (ptr = &win->_line[y].text[startx]; ptr <= end; ptr++) { + chtype blank = _nc_background(win); + + if (*ptr != blank) { + maxx = ptr; + if (minx == _NOCHANGE) + minx = ptr - win->_line[y].text; + *ptr = blank; + } + } + + if (minx != _NOCHANGE) { + if (win->_line[y].firstchar > minx + || win->_line[y].firstchar == _NOCHANGE) + win->_line[y].firstchar = minx; + + if (win->_line[y].lastchar < maxx - win->_line[y].text) + win->_line[y].lastchar = maxx - win->_line[y].text; + } + + startx = 0; + } + _nc_synchook(win); + returnCode(OK); +} diff --git a/ncurses/lib_clreol.c b/ncurses/lib_clreol.c new file mode 100644 index 00000000..47dd89a4 --- /dev/null +++ b/ncurses/lib_clreol.c @@ -0,0 +1,77 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* +** lib_clreol.c +** +** The routine wclrtoeol(). +** +*/ + +#include + +MODULE_ID("$Id: lib_clreol.c,v 1.9 1997/02/01 23:22:54 tom Exp $") + +int wclrtoeol(WINDOW *win) +{ +chtype *maxx, *ptr, *end; +short y, x, minx; + + T((T_CALLED("wclrtoeol(%p)"), win)); + + y = win->_cury; + x = win->_curx; + + /* + * We don't want to clear if we just wrapped the cursor. There's no + * point in clearing if we're not on a legal position, either. + */ + if (win->_flags & _WRAPPED + || y > win->_maxy + || x > win->_maxx) + returnCode(ERR); + + end = &win->_line[y].text[win->_maxx]; + minx = _NOCHANGE; + maxx = &win->_line[y].text[x]; + + for (ptr = maxx; ptr <= end; ptr++) { + chtype blank = _nc_background(win); + + if (*ptr != blank) { + maxx = ptr; + if (minx == _NOCHANGE) + minx = ptr - win->_line[y].text; + *ptr = blank; + } + } + + if (minx != _NOCHANGE) { + if (win->_line[y].firstchar > minx || win->_line[y].firstchar == _NOCHANGE) + win->_line[y].firstchar = minx; + + if (win->_line[y].lastchar < maxx - win->_line[y].text) + win->_line[y].lastchar = maxx - win->_line[y].text; + } + _nc_synchook(win); + returnCode(OK); +} diff --git a/ncurses/lib_color.c b/ncurses/lib_color.c new file mode 100644 index 00000000..0f2d5b33 --- /dev/null +++ b/ncurses/lib_color.c @@ -0,0 +1,380 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* lib_color.c + * + * Handles color emulation of SYS V curses + * + */ + +#include + +#include + +MODULE_ID("$Id: lib_color.c,v 1.17 1997/05/03 19:16:05 tom Exp $") + +/* + * These should be screen structure members. They need to be globals for + * hystorical reasons. So we assign them in start_color() and also in + * set_term()'s screen-switching logic. + */ +int COLOR_PAIRS; +int COLORS; + +static const color_t cga_palette[] = +{ + /* R G B */ + {0, 0, 0}, /* COLOR_BLACK */ + {1000, 0, 0}, /* COLOR_RED */ + {0, 1000, 0}, /* COLOR_GREEN */ + {1000, 1000, 0}, /* COLOR_YELLOW */ + {0, 0, 1000}, /* COLOR_BLUE */ + {1000, 0, 1000}, /* COLOR_MAGENTA */ + {0, 1000, 1000}, /* COLOR_CYAN */ + {1000, 1000, 1000}, /* COLOR_WHITE */ +}; +static const color_t hls_palette[] = +{ + /* H L S */ + {0, 0, 0}, /* COLOR_BLACK */ + {120, 50, 100}, /* COLOR_RED */ + {240, 50, 100}, /* COLOR_GREEN */ + {180, 50, 100}, /* COLOR_YELLOW */ + {330, 50, 100}, /* COLOR_BLUE */ + {60, 50, 100}, /* COLOR_MAGENTA */ + {300, 50, 100}, /* COLOR_CYAN */ + {0, 50, 100}, /* COLOR_WHITE */ +}; + +int start_color(void) +{ + T((T_CALLED("start_color()"))); + +#ifdef orig_pair + if (orig_pair != NULL) + { + TPUTS_TRACE("orig_pair"); + putp(orig_pair); + } +#endif /* orig_pair */ +#ifdef orig_colors + if (orig_colors != NULL) + { + TPUTS_TRACE("orig_colors"); + putp(orig_colors); + } +#endif /* orig_colors */ +#if defined(orig_pair) && defined(orig_colors) + if (!orig_pair && !orig_colors) + returnCode(ERR); +#endif /* defined(orig_pair) && defined(orig_colors) */ + if (max_pairs != -1) + COLOR_PAIRS = SP->_pair_count = max_pairs; + else + returnCode(ERR); + SP->_color_pairs = typeCalloc(unsigned short, max_pairs); + SP->_color_pairs[0] = PAIR_OF(COLOR_WHITE, COLOR_BLACK); + if (max_colors != -1) + COLORS = SP->_color_count = max_colors; + else + returnCode(ERR); + SP->_coloron = 1; + + SP->_color_table = malloc(sizeof(color_t) * COLORS); +#ifdef hue_lightness_saturation + if (hue_lightness_saturation) + memcpy(SP->_color_table, hls_palette, sizeof(color_t) * COLORS); + else +#endif /* hue_lightness_saturation */ + memcpy(SP->_color_table, cga_palette, sizeof(color_t) * COLORS); + + if (orig_colors) + { + TPUTS_TRACE("orig_colors"); + putp(orig_colors); + } + + T(("started color: COLORS = %d, COLOR_PAIRS = %d", COLORS, COLOR_PAIRS)); + + returnCode(OK); +} + +#ifdef hue_lightness_saturation +static void rgb2hls(short r, short g, short b, short *h, short *l, short *s) +/* convert RGB to HLS system */ +{ + short min, max, t; + + if ((min = g < r ? g : r) > b) min = b; + if ((max = g > r ? g : r) < b) max = b; + + /* calculate lightness */ + *l = (min + max) / 20; + + if (min == max) /* black, white and all shades of gray */ + { + *h = 0; + *s = 0; + return; + } + + /* calculate saturation */ + if (*l < 50) + *s = ((max - min) * 100) / (max + min); + else *s = ((max - min) * 100) / (2000 - max - min); + + /* calculate hue */ + if (r == max) + t = 120 + ((g - b) * 60) / (max - min); + else + if (g == max) + t = 240 + ((b - r) * 60) / (max - min); + else + t = 360 + ((r - g) * 60) / (max - min); + + *h = t % 360; +} +#endif /* hue_lightness_saturation */ + +/* + * Extension (1997/1/18) - Allow negative f/b values to set default color + * values. + */ +int init_pair(short pair, short f, short b) +{ + T((T_CALLED("init_pair(%d,%d,%d)"), pair, f, b)); + + if ((pair < 1) || (pair >= COLOR_PAIRS)) + returnCode(ERR); + if (SP->_default_color) + { + if (f < 0) + f = C_MASK; + if (b < 0) + b = C_MASK; + if (f >= COLORS && f != C_MASK) + returnCode(ERR); + if (b >= COLORS && b != C_MASK) + returnCode(ERR); + } + else + if ((f < 0) || (f >= COLORS) + || (b < 0) || (b >= COLORS)) + returnCode(ERR); + + /* + * FIXME: when a pair's content is changed, replace its colors + * (if pair was initialized before a screen update is performed + * replacing original pair colors with the new ones) + */ + + SP->_color_pairs[pair] = PAIR_OF(f,b); + + if (initialize_pair) + { + const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette; + + T(("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)", + pair, + tp[f].red, tp[f].green, tp[f].blue, + tp[b].red, tp[b].green, tp[b].blue)); + + if (initialize_pair) + { + TPUTS_TRACE("initialize_pair"); + putp(tparm(initialize_pair, + pair, + tp[f].red, tp[f].green, tp[f].blue, + tp[b].red, tp[b].green, tp[b].blue)); + } + } + + returnCode(OK); +} + +int init_color(short color, short r, short g, short b) +{ + T((T_CALLED("init_color(%d,%d,%d,%d)"), color, r, g, b)); +#ifdef initialize_color + if (initialize_color == NULL) + returnCode(ERR); +#endif /* initialize_color */ + + if (color < 0 || color >= COLORS) + returnCode(ERR); +#ifdef hue_lightness_saturation + if (hue_lightness_saturation == TRUE) + if (r < 0 || r > 360 || g < 0 || g > 100 || b < 0 || b > 100) + returnCode(ERR); + if (hue_lightness_saturation == FALSE) +#endif /* hue_lightness_saturation */ + if (r < 0 || r > 1000 || g < 0 || g > 1000 || b < 0 || b > 1000) + returnCode(ERR); + +#ifdef hue_lightness_saturation + if (hue_lightness_saturation) + rgb2hls(r, g, b, + &SP->_color_table[color].red, + &SP->_color_table[color].green, + &SP->_color_table[color].blue); + else +#endif /* hue_lightness_saturation */ + { + SP->_color_table[color].red = r; + SP->_color_table[color].green = g; + SP->_color_table[color].blue = b; + } + +#ifdef initialize_color + if (initialize_color) + { + TPUTS_TRACE("initialize_color"); + putp(tparm(initialize_color, color, r, g, b)); + } +#endif /* initialize_color */ + returnCode(OK); +} + +bool can_change_color(void) +{ + T((T_CALLED("can_change_color()"))); + returnCode(can_change != 0); +} + +bool has_colors(void) +{ + T((T_CALLED("has_colors()"))); + returnCode((orig_pair != NULL || orig_colors != NULL) + && (max_colors != -1) && (max_pairs != -1) + && + (((set_foreground != NULL) && (set_background != NULL)) + || ((set_a_foreground != NULL) && (set_a_background != NULL)) + || set_color_pair) + ); +} + +int color_content(short color, short *r, short *g, short *b) +{ + T((T_CALLED("color_content(%d,%p,%p,%p)"), color, r, g, b)); + if (color < 0 || color > COLORS) + returnCode(ERR); + + *r = SP->_color_table[color].red; + *g = SP->_color_table[color].green; + *b = SP->_color_table[color].blue; + returnCode(OK); +} + +int pair_content(short pair, short *f, short *b) +{ + T((T_CALLED("pair_content(%d,%p,%p)"), pair, f, b)); + + if ((pair < 0) || (pair > COLOR_PAIRS)) + returnCode(ERR); + *f = ((SP->_color_pairs[pair] >> C_SHIFT) & C_MASK); + *b = (SP->_color_pairs[pair] & C_MASK); + + returnCode(OK); +} + +/* + * SVr4 curses is known to interchange color codes (1,4) and (3,6), possibly + * to maintain compatibility with a pre-ANSI scheme. The same scheme is + * also used in the FreeBSD syscons. + */ +static int toggled_colors(int c) +{ + if (c < 16) { + static const int table[] = + { 0, 4, 2, 6, 1, 5, 3, 7, + 8, 12, 10, 14, 9, 13, 11, 15}; + c = table[c]; + } + return c; +} + +void _nc_do_color(int pair, int (*outc)(int)) +{ + short fg, bg; + + if (pair == 0) + { + if (orig_pair) + { + TPUTS_TRACE("orig_pair"); + tputs(orig_pair, 1, outc); + } + } + else + { + if (set_color_pair) + { + TPUTS_TRACE("set_color_pair"); + tputs(tparm(set_color_pair, pair), 1, outc); + } + else + { + pair_content(pair, &fg, &bg); + + T(("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg)); + + if (fg == C_MASK || bg == C_MASK) + { + if (orig_pair) + { + TPUTS_TRACE("orig_pair"); + tputs(orig_pair, 1, outc); + } + else + { + TPUTS_TRACE("orig_colors"); + tputs(orig_colors, 1, outc); + } + } + if (fg != C_MASK) + { + if (set_a_foreground) + { + TPUTS_TRACE("set_a_foreground"); + tputs(tparm(set_a_foreground, fg), 1, outc); + } + else + { + TPUTS_TRACE("set_foreground"); + tputs(tparm(set_foreground, toggled_colors(fg)), 1, outc); + } + } + if (bg != C_MASK) + { + if (set_a_background) + { + TPUTS_TRACE("set_a_background"); + tputs(tparm(set_a_background, bg), 1, outc); + } + else + { + TPUTS_TRACE("set_background"); + tputs(tparm(set_background, toggled_colors(bg)), 1, outc); + } + } + } + } +} diff --git a/ncurses/lib_data.c b/ncurses/lib_data.c new file mode 100644 index 00000000..57f41294 --- /dev/null +++ b/ncurses/lib_data.c @@ -0,0 +1,79 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* +** lib_data.c +** +** Common data that may/may not be allocated, but is referenced globally +** +*/ + +#include + +MODULE_ID("$Id: lib_data.c,v 1.8 1997/01/18 23:02:54 tom Exp $") + +WINDOW *stdscr, *curscr, *newscr; + +/* + * Linked-list of all windows, to support '_nc_resizeall()' and '_nc_freeall()' + */ +WINDOWLIST *_nc_windows; + +/* + * These data correspond to the state of the idcok() and idlok() functions. A + * caveat is in order here: the XSI and SVr4 documentation specify that these + * functions apply to the window which is given as an argument. However, + * ncurses implements this logic only for the newscr/curscr update process, + * _not_ per-window. + */ +bool _nc_idcok = TRUE; +bool _nc_idlok = FALSE; + +/* + * The variable 'SP' will be defined as a function on systems that cannot link + * data-only modules, since it is used in a lot of places within ncurses and we + * cannot guarantee that any application will use any particular function. We + * put the WINDOW variables in this module, because it appears that any + * application that uses them will also use 'SP'. + * + * This module intentionally does not reference other ncurses modules, to avoid + * module coupling that increases the size of the executable. + */ +#if BROKEN_LINKER +static SCREEN *my_screen; + +SCREEN *_nc_screen(void) +{ + return my_screen; +} + +int _nc_alloc_screen(void) +{ + return ((my_screen = typeCalloc(SCREEN, 1)) != 0); +} + +void _nc_set_screen(SCREEN *sp) +{ + my_screen = sp; +} +#else +SCREEN *SP; +#endif diff --git a/ncurses/lib_delch.c b/ncurses/lib_delch.c new file mode 100644 index 00000000..16d89430 --- /dev/null +++ b/ncurses/lib_delch.c @@ -0,0 +1,58 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* +** lib_delch.c +** +** The routine wdelch(). +** +*/ + +#include + +MODULE_ID("$Id: lib_delch.c,v 1.5 1997/02/01 23:18:18 tom Exp $") + +int wdelch(WINDOW *win) +{ +chtype *temp1, *temp2; +chtype *end; +chtype blank = _nc_background(win); + + T((T_CALLED("wdelch(%p)"), win)); + + end = &win->_line[win->_cury].text[win->_maxx]; + temp2 = &win->_line[win->_cury].text[win->_curx + 1]; + temp1 = temp2 - 1; + + while (temp1 < end) + *temp1++ = *temp2++; + + *temp1 = blank; + + win->_line[win->_cury].lastchar = win->_maxx; + + if (win->_line[win->_cury].firstchar == _NOCHANGE + || win->_line[win->_cury].firstchar > win->_curx) + win->_line[win->_cury].firstchar = win->_curx; + + _nc_synchook(win); + returnCode(OK); +} diff --git a/ncurses/lib_delwin.c b/ncurses/lib_delwin.c new file mode 100644 index 00000000..f35ec4e9 --- /dev/null +++ b/ncurses/lib_delwin.c @@ -0,0 +1,60 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* +** lib_delwin.c +** +** The routine delwin(). +** +*/ + +#include + +MODULE_ID("$Id: lib_delwin.c,v 1.8 1997/02/01 23:22:54 tom Exp $") + +static bool have_children(WINDOW *win) +{ + WINDOWLIST *p; + for (p = _nc_windows; p != 0; p = p->next) { + if (p->win->_flags & _SUBWIN + && p->win->_parent == win) + return TRUE; + } + return FALSE; +} + +int delwin(WINDOW *win) +{ + T((T_CALLED("delwin(%p)"), win)); + + if (win == 0 + || have_children(win)) + returnCode(ERR); + + if (win->_flags & _SUBWIN) + touchwin(win->_parent); + else if (curscr != 0) + touchwin(curscr); + + _nc_freewin(win); + + returnCode(OK); +} diff --git a/ncurses/lib_dft_fgbg.c b/ncurses/lib_dft_fgbg.c new file mode 100644 index 00000000..075b27a9 --- /dev/null +++ b/ncurses/lib_dft_fgbg.c @@ -0,0 +1,48 @@ +/****************************************************************************** + * Copyright 1997 by Thomas E. Dickey * + * All Rights Reserved. * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * + * that the above copyright notice appear in all copies and that both that * + * copyright notice and this permission notice appear in supporting * + * documentation, and that the name of the above listed copyright holder(s) * + * not be used in advertising or publicity pertaining to distribution of the * + * software without specific, written prior permission. THE ABOVE LISTED * + * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * + * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + ******************************************************************************/ +#include +#include + +MODULE_ID("$Id: lib_dft_fgbg.c,v 1.2 1997/02/02 01:45:36 tom Exp $") + +/* + * Modify the behavior of color-pair 0 so that the library doesn't assume that + * it is black on white. This is an extension to XSI curses. + * + * Invoke this function after 'start_color()'. + */ +int +use_default_colors(void) +{ + T((T_CALLED("use_default_colors()"))); + + if (!SP->_coloron) + returnCode(ERR); + + if (!orig_pair && !orig_colors) + returnCode(ERR); + + if (initialize_pair) /* don't know how to handle this */ + returnCode(ERR); + + SP->_default_color = TRUE; + SP->_color_pairs[0] = PAIR_OF(C_MASK, C_MASK); + returnCode(OK); +} diff --git a/ncurses/lib_doupdate.c b/ncurses/lib_doupdate.c new file mode 100644 index 00000000..20ac96c5 --- /dev/null +++ b/ncurses/lib_doupdate.c @@ -0,0 +1,1208 @@ +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/*----------------------------------------------------------------- + * + * lib_doupdate.c + * + * The routine doupdate() and its dependents. Also _nc_outstr(), + * so all physical output is concentrated here (except _nc_outch() + * in lib_tputs.c). + * + *-----------------------------------------------------------------*/ + +#include + +#if defined(TRACE) && HAVE_SYS_TIMES_H && HAVE_TIMES +#define USE_TRACE_TIMES 1 +#else +#define USE_TRACE_TIMES 0 +#endif + +#if HAVE_SYS_TIME_H && ! SYSTEM_LOOKS_LIKE_SCO +#include +#endif + +#if USE_TRACE_TIMES +#include +#endif + +#if USE_FUNC_POLL +#include +#include +#elif HAVE_SELECT +#if HAVE_SYS_SELECT_H +#include +#endif +#endif + +#include + +MODULE_ID("$Id: lib_doupdate.c,v 1.60 1997/05/03 19:32:55 Alexander.V.Lukyanov Exp $") + +/* + * This define controls the line-breakout optimization. Every once in a + * while during screen refresh, we want to check for input and abort the + * update if there's some waiting. CHECK_INTERVAL controls the number of + * changed lines to be emitted between input checks. + * + * Note: Input-check-and-abort is no longer done if the screen is being + * updated from scratch. This is a feature, not a bug. + */ +#define CHECK_INTERVAL 6 + +/* + * Enable checking to see if doupdate and friends are tracking the true + * cursor position correctly. NOTE: this is a debugging hack which will + * work ONLY on ANSI-compatible terminals! + */ +/* #define POSITION_DEBUG */ + +static inline chtype ClrBlank ( WINDOW *win ); +static inline chtype ClrSetup ( WINDOW *scr ); +static int ClrBottom(int total); +static int InsStr( chtype *line, int count ); +static void ClearScreen( void ); +static void ClrUpdate( WINDOW *scr ); +static void DelChar( int count ); +static void TransformLine( int const lineno ); + +#ifdef POSITION_DEBUG +/**************************************************************************** + * + * Debugging code. Only works on ANSI-standard terminals. + * + ****************************************************************************/ + +void position_check(int expected_y, int expected_x, char *legend) +/* check to see if the real cursor position matches the virtual */ +{ + static char buf[9]; + int y, x; + + if (_nc_tracing) + return; + + memset(buf, '\0', sizeof(buf)); + (void) write(1, "\033[6n", 4); /* only works on ANSI-compatibles */ + (void) read(0, (void *)buf, 8); + _tracef("probe returned %s", _nc_visbuf(buf)); + + /* try to interpret as a position report */ + if (sscanf(buf, "\033[%d;%dR", &y, &x) != 2) + _tracef("position probe failed in %s", legend); + else if (y - 1 != expected_y || x - 1 != expected_x) + _tracef("position seen (%d, %d) doesn't match expected one (%d, %d) in %s", + y-1, x-1, expected_y, expected_x, legend); + else + _tracef("position matches OK in %s", legend); +} +#endif /* POSITION_DEBUG */ + +/**************************************************************************** + * + * Optimized update code + * + ****************************************************************************/ + +static inline void GoTo(int const row, int const col) +{ + chtype oldattr = SP->_current_attr; + + TR(TRACE_MOVE, ("GoTo(%d, %d) from (%d, %d)", + row, col, SP->_cursrow, SP->_curscol)); + +#ifdef POSITION_DEBUG + position_check(SP->_cursrow, SP->_curscol, "GoTo"); +#endif /* POSITION_DEBUG */ + + /* + * Force restore even if msgr is on when we're in an alternate + * character set -- these have a strong tendency to screw up the + * CR & LF used for local character motions! + */ + if ((oldattr & A_ALTCHARSET) + || (oldattr && !move_standout_mode)) + { + TR(TRACE_CHARPUT, ("turning off (%#lx) %s before move", + oldattr, _traceattr(oldattr))); + vidattr(A_NORMAL); + } + + mvcur(SP->_cursrow, SP->_curscol, row, col); + SP->_cursrow = row; + SP->_curscol = col; +} + +static inline void PutAttrChar(chtype ch) +{ + if (tilde_glitch && (TextOf(ch) == '~')) + ch = ('`' | AttrOf(ch)); + + TR(TRACE_CHARPUT, ("PutAttrChar(%s) at (%d, %d)", + _tracechtype(ch), + SP->_cursrow, SP->_curscol)); + UpdateAttrs(ch); + putc((int)TextOf(ch), SP->_ofp); +#ifdef TRACE + _nc_outchars++; +#endif /* TRACE */ + SP->_curscol++; + if (char_padding) { + TPUTS_TRACE("char_padding"); + putp(char_padding); + } +} + +static bool check_pending(void) +/* check for pending input */ +{ + if (SP->_checkfd >= 0) { +#if USE_FUNC_POLL + struct pollfd fds[1]; + fds[0].fd = SP->_checkfd; + fds[0].events = POLLIN; + if (poll(fds, 1, 0) > 0) + { + fflush(SP->_ofp); + return TRUE; + } +#elif HAVE_SELECT + fd_set fdset; + struct timeval ktimeout; + + ktimeout.tv_sec = + ktimeout.tv_usec = 0; + + FD_ZERO(&fdset); + FD_SET(SP->_checkfd, &fdset); + if (select(SP->_checkfd+1, &fdset, NULL, NULL, &ktimeout) > 0) + { + fflush(SP->_ofp); + return TRUE; + } +#endif + } + return FALSE; +} + +/* + * No one supports recursive inline functions. However, gcc is quieter if we + * instantiate the recursive part separately. + */ +#if CC_HAS_INLINE_FUNCS +static void callPutChar(chtype const); +#else +#define callPutChar(ch) PutChar(ch) +#endif + +static inline void PutChar(chtype const ch) +/* insert character, handling automargin stuff */ +{ + if (!(SP->_cursrow == screen_lines-1 && SP->_curscol == screen_columns-1 + && auto_right_margin && !eat_newline_glitch)) + { + PutAttrChar(ch); /* normal case */ + } + else if (!auto_right_margin /* maybe we can suppress automargin */ + || (enter_am_mode && exit_am_mode)) + { + bool old_am = auto_right_margin; + + if (old_am) + { + TPUTS_TRACE("exit_am_mode"); + putp(exit_am_mode); + } + PutAttrChar(ch); + if (old_am) + { + TPUTS_TRACE("enter_am_mode"); + putp(enter_am_mode); + } + } + else + { + GoTo(screen_lines-1,screen_columns-2); + callPutChar(ch); + GoTo(screen_lines-1,screen_columns-2); + if (InsStr(newscr->_line[screen_lines-1].text+screen_columns-2,1)==ERR) + return; + } + + if (SP->_curscol >= screen_columns) + { + if (eat_newline_glitch) + { + /* + * xenl can manifest two different ways. The vt100 + * way is that, when you'd expect the cursor to wrap, + * it stays hung at the right margin (on top of the + * character just emitted) and doesn't wrap until the + * *next* graphic char is emitted. The c100 way is + * to ignore LF received just after an am wrap. + * + * An aggressive way to handle this would be to + * emit CR/LF after the char and then assume the wrap + * is done, you're on the first position of the next + * line, and the terminal out of its weird state. + * Here it's safe to just tell the code that the + * cursor is in hyperspace and let the next mvcur() + * call straighten things out. + */ + SP->_curscol = -1; + SP->_cursrow = -1; + } + else if (auto_right_margin) + { + SP->_curscol = 0; + SP->_cursrow++; + } + else + { + SP->_curscol--; + } + } +#ifdef POSITION_DEBUG + position_check(SP->_cursrow, SP->_curscol, "PutChar"); +#endif /* POSITION_DEBUG */ +} + +/* + * Issue a given span of characters from an array. + * Must be functionally equivalent to: + * for (i = 0; i < num; i++) + * PutChar(ntext[i]); + * but can leave the cursor positioned at the middle of the interval. + * + * Returns: 0 - cursor is at the end of interval + * 1 - cursor is somewhere in the middle + * + * This code is optimized using ech and rep. + */ +static inline int EmitRange(const chtype *ntext, int num) +{ + int i; + + if (erase_chars || repeat_char) + { + while (num > 0) + { + int runcount; + chtype ntext0; + + while (num>1 && ntext[0]!=ntext[1]) + { + PutChar(ntext[0]); + ntext++; + num--; + } + ntext0 = ntext[0]; + if (num==1) + { + PutChar(ntext0); + return 0; + } + runcount = 2; + + while (runcount < num && ntext[runcount] == ntext0) + runcount++; + + /* + * The cost expression in the middle isn't exactly right. + * _cup_cost is an upper bound on the cost for moving to the + * end of the erased area, but not the cost itself (which we + * can't compute without emitting the move). This may result + * in erase_chars not getting used in some situations for + * which it would be marginally advantageous. + */ + if (erase_chars + && runcount > SP->_ech_cost + SP->_cup_cost + && can_clear_with(ntext0)) + { + UpdateAttrs(ntext0); + putp(tparm(erase_chars, runcount)); + + /* + * If this is the last part of the given interval, + * don't bother moving cursor, since it can be the + * last update on the line. + */ + if (runcount < num) + GoTo(SP->_cursrow, SP->_curscol + runcount); + else + return 1; /* cursor stays in the middle */ + } + else if (repeat_char && runcount > SP->_rep_cost) + { + bool wrap_possible = (SP->_curscol + runcount >= screen_columns); + int rep_count = runcount; + + if (wrap_possible) + rep_count--; + + UpdateAttrs(ntext0); + putp(tparm(repeat_char, TextOf(ntext0), rep_count)); + SP->_curscol += rep_count; + + if (wrap_possible) + PutChar(ntext0); + } + else + { + for (i = 0; i < runcount; i++) + PutChar(ntext[i]); + } + ntext += runcount; + num -= runcount; + } + return 0; + } + + for (i = 0; i < num; i++) + PutChar(ntext[i]); + return 0; +} + +/* + * Output the line in the given range [first .. last] + * + * If there's a run of identical characters that's long enough to justify + * cursor movement, use that also. + * + * Returns: same as EmitRange + */ +static int PutRange( + const chtype *otext, + const chtype *ntext, + int row, + int first, int last) +{ + int j, run; + int cost = min(SP->_cup_ch_cost, SP->_hpa_ch_cost); + + TR(TRACE_CHARPUT, ("PutRange(%p, %p, %d, %d, %d)", + otext, ntext, row, first, last)); + + if (otext != ntext + && (last-first+1) > cost) { + for (j = first, run = 0; j <= last; j++) { + if (otext[j] == ntext[j]) { + run++; + } else { + if (run > cost) { + int before_run = (j - run); + EmitRange(ntext+first, before_run-first); + GoTo(row, first = j); + } + run = 0; + } + } + } + return EmitRange(ntext + first, last-first+1); +} + +#if CC_HAS_INLINE_FUNCS +static void callPutChar(chtype const ch) +{ + PutChar(ch); +} +#endif + +#define MARK_NOCHANGE(win,row) \ + { \ + win->_line[row].firstchar = _NOCHANGE; \ + win->_line[row].lastchar = _NOCHANGE; \ + win->_line[row].oldindex = row; \ + } + +int doupdate(void) +{ +int i; +int nonempty; +#if USE_TRACE_TIMES +struct tms before, after; +#endif /* USE_TRACE_TIMES */ + + T((T_CALLED("doupdate()"))); + +#ifdef TRACE + if (_nc_tracing & TRACE_UPDATE) + { + if (curscr->_clear) + _tracef("curscr is clear"); + else + _tracedump("curscr", curscr); + _tracedump("newscr", newscr); + } +#endif /* TRACE */ + + _nc_signal_handler(FALSE); + + if (SP->_endwin == TRUE) { + + T(("coming back from shell mode")); + reset_prog_mode(); + + /* + * This is a transparent extension: XSI does not address it, + * and applications need not know that ncurses can do it. + * + * Check if the terminal size has changed while curses was off + * (this can happen in an xterm, for example), and resize the + * ncurses data structures accordingly. + */ + _nc_get_screensize(); + resizeterm(LINES, COLS); + + _nc_mvcur_resume(); + _nc_mouse_resume(SP); + newscr->_clear = TRUE; + SP->_endwin = FALSE; + } + +#if USE_TRACE_TIMES + /* zero the metering machinery */ + _nc_outchars = 0; + (void) times(&before); +#endif /* USE_TRACE_TIMES */ + + /* + * This is the support for magic-cookie terminals. The + * theory: we scan the virtual screen looking for attribute + * turnons. Where we find one, check to make sure it's + * realizable by seeing if the required number of + * un-attributed blanks are present before and after the + * attributed range; try to shift the range boundaries over + * blanks (not changing the screen display) so this becomes + * true. If it is, shift the beginning attribute change + * appropriately (the end one, if we've gotten this far, is + * guaranteed room for its cookie). If not, nuke the added + * attributes out of the span. + */ + if (magic_cookie_glitch > 0) { + int j, k; + attr_t rattr = A_NORMAL; + + for (i = 0; i < screen_lines; i++) + for (j = 0; j < screen_columns; j++) + { + bool failed = FALSE; + chtype turnon = AttrOf(newscr->_line[i].text[j]) & ~rattr; + + /* is an attribute turned on here? */ + if (turnon == 0) + continue; + + T(("At (%d, %d): from %s...", i, j, _traceattr(rattr))); + T(("...to %s",_traceattr(turnon))); + + /* + * If the attribute change location is a blank with a + * "safe" attribute, undo the attribute turnon. This may + * ensure there's enough room to set the attribute before + * the first non-blank in the run. + */ +#define SAFE(a) !((a) & ~NONBLANK_ATTR) + if (TextOf(newscr->_line[i].text[j])==' ' && SAFE(turnon)) + { + newscr->_line[i].text[j] &= ~turnon; + continue; + } + + /* check that there's enough room at start of span */ + for (k = 1; k <= magic_cookie_glitch; k++) + if (j-k < 0 + || TextOf(newscr->_line[i].text[j-k]) != ' ' + || !SAFE(AttrOf(newscr->_line[i].text[j-k]))) + failed = TRUE; + if (!failed) + { + bool end_onscreen = FALSE; + int m, n = -1; + + /* find end of span, if it's onscreen */ + for (m = i; m < screen_lines; m++) + for (n = j; n < screen_columns; n++) + if (AttrOf(newscr->_line[m].text[n]) == rattr) + { + end_onscreen = TRUE; + T(("Range attributed with %s ends at (%d, %d)", + _traceattr(turnon),m,n)); + goto foundit; + } + T(("Range attributed with %s ends offscreen", + _traceattr(turnon))); + foundit:; + + if (end_onscreen) + { + chtype *lastline = newscr->_line[m].text; + + /* + * If there are safely-attributed blanks at the + * end of the range, shorten the range. This will + * help ensure that there is enough room at end + * of span. + */ + while (n >= 0 + && TextOf(lastline[n]) == ' ' + && SAFE(AttrOf(lastline[n]))) + lastline[n--] &=~ turnon; + + /* check that there's enough room at end of span */ + for (k = 1; k <= magic_cookie_glitch; k++) + if (n + k >= screen_columns + || TextOf(lastline[n + k]) != ' ' + || !SAFE(AttrOf(lastline[n+k]))) + failed = TRUE; + } + } + + if (failed) + { + int p, q; + + T(("Clearing %s beginning at (%d, %d)", + _traceattr(turnon), i, j)); + + /* turn off new attributes over span */ + for (p = i; p < screen_lines; p++) + for (q = j; q < screen_columns; q++) + if (AttrOf(newscr->_line[p].text[q]) == rattr) + goto foundend; + else + newscr->_line[p].text[q] &=~ turnon; + foundend:; + } + else + { + T(("Cookie space for %s found before (%d, %d)", + _traceattr(turnon), i, j)); + + /* + * back up the start of range so there's room + * for cookies before the first nonblank character + */ + for (k = 1; k <= magic_cookie_glitch; k++) + newscr->_line[i].text[j-k] |= turnon; + } + + rattr = AttrOf(newscr->_line[i].text[j]); + } + +#ifdef TRACE + /* show altered highlights after magic-cookie check */ + if (_nc_tracing & TRACE_UPDATE) + { + _tracef("After magic-cookie check..."); + _tracedump("newscr", newscr); + } +#endif /* TRACE */ + } + + nonempty = 0; + if (curscr->_clear) { /* force refresh ? */ + T(("clearing and updating curscr")); + ClrUpdate(newscr); /* yes, clear all & update */ + curscr->_clear = FALSE; /* reset flag */ + } else if (newscr->_clear) { + T(("clearing and updating newscr")); + ClrUpdate(newscr); + newscr->_clear = FALSE; + } else { + int changedlines; + + nonempty = min(screen_lines, newscr->_maxy+1); +#if 0 /* still 5% slower 960928 */ +#if defined(TRACE) || defined(NCURSES_TEST) + if (_nc_optimize_enable & OPTIMIZE_HASHMAP) +#endif /*TRACE */ + _nc_hash_map(); +#endif +#if defined(TRACE) || defined(NCURSES_TEST) + if (_nc_optimize_enable & OPTIMIZE_SCROLL) +#endif /*TRACE */ + _nc_scroll_optimize(); + + if (clr_eos) + nonempty = ClrBottom(nonempty); + + T(("Transforming lines, nonempty %d", nonempty)); + for (i = changedlines = 0; i < nonempty; i++) { + /* + * newscr->line[i].firstchar is normally set + * by wnoutrefresh. curscr->line[i].firstchar + * is normally set by _nc_scroll_window in the + * vertical-movement optimization code, + */ + if (newscr->_line[i].firstchar != _NOCHANGE + || curscr->_line[i].firstchar != _NOCHANGE) + { + TransformLine(i); + changedlines++; + } + + /* mark line changed successfully */ + if (i <= newscr->_maxy) + MARK_NOCHANGE(newscr,i) + if (i <= curscr->_maxy) + MARK_NOCHANGE(curscr,i) + + /* + * Here is our line-breakout optimization. + */ + if ((changedlines % CHECK_INTERVAL) == CHECK_INTERVAL-1 + && check_pending()) + goto cleanup; + } + } + + /* put everything back in sync */ + for (i = nonempty; i <= newscr->_maxy; i++) + MARK_NOCHANGE(newscr,i) + for (i = nonempty; i <= curscr->_maxy; i++) + MARK_NOCHANGE(curscr,i) + + curscr->_curx = newscr->_curx; + curscr->_cury = newscr->_cury; + + GoTo(curscr->_cury, curscr->_curx); + + cleanup: + /* + * Keep the physical screen in normal mode in case we get other + * processes writing to the screen. + */ + UpdateAttrs(A_NORMAL); + + fflush(SP->_ofp); + curscr->_attrs = newscr->_attrs; +/* curscr->_bkgd = newscr->_bkgd; */ + +#if USE_TRACE_TIMES + (void) times(&after); + TR(TRACE_TIMES, ("Update cost: %ld chars, %ld clocks system time, %ld clocks user time", + _nc_outchars, + after.tms_stime-before.tms_stime, + after.tms_utime-before.tms_utime)); +#endif /* USE_TRACE_TIMES */ + + _nc_signal_handler(TRUE); + + returnCode(OK); +} + +/* + * ClrBlank(win) + * + * Returns the attributed character that corresponds to the "cleared" + * screen. If the terminal has the back-color-erase feature, this will be + * colored according to the wbkgd() call. (Other attributes are + * unspecified, hence assumed to be reset in accordance with + * 'ClrSetup()'). + * + * We treat 'curscr' specially because it isn't supposed to be set directly + * in the wbkgd() call. Assume 'stdscr' for this case. + */ +#define BCE_ATTRS (A_NORMAL|A_COLOR) +#define BCE_BKGD(win) (((win) == curscr ? stdscr : (win))->_bkgd) + +static inline chtype ClrBlank (WINDOW *win) +{ +chtype blank = BLANK; + if (back_color_erase) + blank |= (BCE_BKGD(win) & BCE_ATTRS); + return blank; +} + +/* + * ClrSetup(win) + * + * Ensures that if the terminal recognizes back-color-erase, that we + * set the video attributes to match the window's background color + * before an erase operation. + */ +static inline chtype ClrSetup (WINDOW *win) +{ + if (back_color_erase) + vidattr(BCE_BKGD(win) & BCE_ATTRS); + return ClrBlank(win); +} + +/* +** ClrUpdate(scr) +** +** Update by clearing and redrawing the entire screen. +** +*/ + +static void ClrUpdate(WINDOW *scr) +{ +int i = 0, j = 0; +int lastNonBlank; +chtype blank = ClrSetup(scr); + + T(("ClrUpdate(%p) called", scr)); + ClearScreen(); + + if (scr != curscr) { + for (i = 0; i < screen_lines ; i++) + for (j = 0; j < screen_columns; j++) + curscr->_line[i].text[j] = blank; + } + + T(("updating screen from scratch")); + for (i = 0; i < min(screen_lines, scr->_maxy + 1); i++) { + lastNonBlank = scr->_maxx; + + while (lastNonBlank >= 0 + && scr->_line[i].text[lastNonBlank] == blank) + lastNonBlank--; + + if (lastNonBlank >= 0) { + if (lastNonBlank > screen_columns) + lastNonBlank = screen_columns; + GoTo(i, 0); + PutRange(curscr->_line[i].text, + scr->_line[i].text, i, 0, lastNonBlank); + } + } + + if (scr != curscr) { + for (i = 0; i < screen_lines ; i++) + memcpy(curscr->_line[i].text, + scr->_line[i].text, + screen_columns * sizeof(chtype)); + } +} + +/* +** ClrToEOL(blank) +** +** Clear to end of current line, starting at the cursor position +*/ + +static void ClrToEOL(chtype blank) +{ +int j; +bool needclear = FALSE; + + for (j = SP->_curscol; j < screen_columns; j++) + { + chtype *cp = &(curscr->_line[SP->_cursrow].text[j]); + + if (*cp != blank) + { + *cp = blank; + needclear = TRUE; + } + } + + if (needclear) + { + UpdateAttrs(blank); + TPUTS_TRACE("clr_eol"); + if (SP->_el_cost > (screen_columns - SP->_curscol)) + { + int count = (screen_columns - SP->_curscol); + while (count-- > 0) + PutChar(blank); + } + else + putp(clr_eol); + } +} + +/* + * ClrBottom(total) + * + * Test if clearing the end of the screen would satisfy part of the + * screen-update. Do this by scanning backwards through the lines in the + * screen, checking if each is blank, and one or more are changed. + */ +static int ClrBottom(int total) +{ +static chtype *tstLine; +static size_t lenLine; + +int row, col; +int top = total; +int last = min(screen_columns, newscr->_maxx+1); +size_t length = sizeof(chtype) * last; +chtype blank = newscr->_line[total-1].text[last-1]; /* lower right char */ + + if(!can_clear_with(blank)) + return total; + + if (tstLine == 0) + tstLine = (chtype *)malloc(length); + else if (length > lenLine) + tstLine = (chtype *)realloc(tstLine, length); + + if (tstLine != 0) { + lenLine = length; + for (col = 0; col < last; col++) + tstLine[col] = blank; + + for (row = total-1; row >= 0; row--) { + if (memcmp(tstLine, newscr->_line[row].text, length)) + break; + if (newscr->_line[row].firstchar != _NOCHANGE) + top = row; + } + + if (top < total) { + GoTo(top,0); + UpdateAttrs(blank); + TPUTS_TRACE("clr_eos"); + putp(clr_eos); + while (total-- > top) { + for (col = 0; col <= curscr->_maxx; col++) + curscr->_line[total].text[col] = blank; + } + total++; + } + } +#if NO_LEAKS + FreeAndNull(tstLine); +#endif + return total; +} + + +/* +** TransformLine(lineno) +** +** Transform the given line in curscr to the one in newscr, using +** Insert/Delete Character if _nc_idcok && has_ic(). +** +** firstChar = position of first different character in line +** oLastChar = position of last different character in old line +** nLastChar = position of last different character in new line +** +** move to firstChar +** overwrite chars up to min(oLastChar, nLastChar) +** if oLastChar < nLastChar +** insert newLine[oLastChar+1..nLastChar] +** else +** delete oLastChar - nLastChar spaces +*/ + +static void TransformLine(int const lineno) +{ +int firstChar, oLastChar, nLastChar; +chtype *newLine = newscr->_line[lineno].text; +chtype *oldLine = curscr->_line[lineno].text; +int n; +bool attrchanged = FALSE; + + T(("TransformLine(%d) called", lineno)); + + if(ceol_standout_glitch && clr_eol) { + firstChar = 0; + while(firstChar < screen_columns) { + if(AttrOf(newLine[firstChar]) != AttrOf(oldLine[firstChar])) + attrchanged = TRUE; + firstChar++; + } + } + + firstChar = 0; + + if (attrchanged) { /* we may have to disregard the whole line */ + GoTo(lineno, firstChar); + ClrToEOL(ClrBlank(curscr)); + PutRange(oldLine, newLine, lineno, 0, (screen_columns-1)); + } else { + chtype blank; + + /* find the first differing character */ + while (firstChar < screen_columns && + newLine[firstChar] == oldLine[firstChar]) + firstChar++; + + /* if there wasn't one, we're done */ + if (firstChar >= screen_columns) + return; + + /* it may be cheap to clear leading whitespace with clr_bol */ + if (clr_bol && can_clear_with(blank=newLine[0])) + { + int oFirstChar, nFirstChar; + + for (oFirstChar = 0; oFirstChar < screen_columns; oFirstChar++) + if (oldLine[oFirstChar] != blank) + break; + for (nFirstChar = 0; nFirstChar < screen_columns; nFirstChar++) + if (newLine[nFirstChar] != blank) + break; + + if (nFirstChar > oFirstChar + SP->_el1_cost) + { + GoTo(lineno, nFirstChar - 1); + UpdateAttrs(blank); + TPUTS_TRACE("clr_bol"); + putp(clr_bol); + + while (firstChar < nFirstChar) + oldLine[firstChar++] = blank; + + if (firstChar >= screen_columns) + return; + } + } + + blank = newLine[screen_columns-1]; + + if(!can_clear_with(blank)) + { + /* find the last differing character */ + nLastChar = screen_columns - 1; + + while (nLastChar > firstChar + && newLine[nLastChar] == oldLine[nLastChar]) + nLastChar--; + + if (nLastChar >= firstChar) { + GoTo(lineno, firstChar); + PutRange(oldLine, newLine, lineno, firstChar, nLastChar); + memcpy( oldLine + firstChar, + newLine + firstChar, + (nLastChar - firstChar + 1) * sizeof(chtype)); + } + return; + } + + /* find last non-blank character on old line */ + oLastChar = screen_columns - 1; + while (oLastChar > firstChar && oldLine[oLastChar] == blank) + oLastChar--; + + /* find last non-blank character on new line */ + nLastChar = screen_columns - 1; + while (nLastChar > firstChar && newLine[nLastChar] == blank) + nLastChar--; + + if((nLastChar == firstChar) + && (SP->_el_cost < (screen_columns - nLastChar))) { + GoTo(lineno, firstChar); + ClrToEOL(blank); + if(newLine[firstChar] != blank ) + PutChar(newLine[firstChar]); + } else if( newLine[nLastChar] != oldLine[oLastChar] + || !(_nc_idcok && has_ic()) ) { + GoTo(lineno, firstChar); + if ((oLastChar - nLastChar) > SP->_el_cost) { + if(PutRange(oldLine, newLine, lineno, firstChar, nLastChar)) + GoTo(lineno, nLastChar+1); + ClrToEOL(blank); + } else { + n = max( nLastChar , oLastChar ); + PutRange(oldLine, newLine, lineno, firstChar, n); + } + } else { + int nLastNonblank = nLastChar; + int oLastNonblank = oLastChar; + + /* find the last characters that really differ */ + while (newLine[nLastChar] == oldLine[oLastChar]) { + if (nLastChar != 0 + && oLastChar != 0) { + nLastChar--; + oLastChar--; + } else { + break; + } + } + + n = min(oLastChar, nLastChar); + if (n >= firstChar) { + GoTo(lineno, firstChar); + PutRange(oldLine, newLine, lineno, firstChar, n); + } + GoTo(lineno, n+1); + + if (oLastChar < nLastChar) { + int m = max(nLastNonblank, oLastNonblank); + if (InsCharCost(nLastChar - oLastChar) + > (m - n)) { + PutRange(oldLine, newLine, lineno, n+1, m); + } else { + InsStr(&newLine[n+1], nLastChar - oLastChar); + } + } else if (oLastChar > nLastChar ) { + if (DelCharCost(oLastChar - nLastChar) + > SP->_el_cost + nLastNonblank - (n+1)) { + if(PutRange(oldLine, newLine, lineno, + n+1, nLastNonblank)) + GoTo(lineno, nLastNonblank+1); + ClrToEOL(blank); + } else { + /* + * The delete-char sequence will + * effectively shift in blanks from the + * right margin of the screen. Ensure + * that they are the right color by + * setting the video attributes from + * the last character on the row. + */ + UpdateAttrs(blank); + DelChar(oLastChar - nLastChar); + } + } + } + } + + /* update the code's internal representation */ + if (screen_columns > firstChar) + memcpy( oldLine + firstChar, + newLine + firstChar, + (screen_columns - firstChar) * sizeof(chtype)); +} + +/* +** ClearScreen() +** +** Clear the physical screen and put cursor at home +** +*/ + +static void ClearScreen(void) +{ + + T(("ClearScreen() called")); + + if (clear_screen) { + TPUTS_TRACE("clear_screen"); + putp(clear_screen); + SP->_cursrow = SP->_curscol = 0; +#ifdef POSITION_DEBUG + position_check(SP->_cursrow, SP->_curscol, "ClearScreen"); +#endif /* POSITION_DEBUG */ + } else if (clr_eos) { + SP->_cursrow = SP->_curscol = -1; + GoTo(0,0); + + TPUTS_TRACE("clr_eos"); + putp(clr_eos); + } else if (clr_eol) { + SP->_cursrow = SP->_curscol = -1; + + while (SP->_cursrow < screen_lines) { + GoTo(SP->_cursrow, 0); + TPUTS_TRACE("clr_eol"); + putp(clr_eol); + } + GoTo(0,0); + } + T(("screen cleared")); +} + + +/* +** InsStr(line, count) +** +** Insert the count characters pointed to by line. +** +*/ + +static int InsStr(chtype *line, int count) +{ + T(("InsStr(%p,%d) called", line, count)); + + if (enter_insert_mode && exit_insert_mode) { + TPUTS_TRACE("enter_insert_mode"); + putp(enter_insert_mode); + while (count) { + PutAttrChar(*line); + line++; + count--; + } + TPUTS_TRACE("exit_insert_mode"); + putp(exit_insert_mode); + return(OK); + } else if (parm_ich) { + TPUTS_TRACE("parm_ich"); + tputs(tparm(parm_ich, count), count, _nc_outch); + while (count) { + PutAttrChar(*line); + line++; + count--; + } + return(OK); + } else { + while (count) { + TPUTS_TRACE("insert_character"); + putp(insert_character); + PutAttrChar(*line); + if (insert_padding) + { + TPUTS_TRACE("insert_padding"); + putp(insert_padding); + } + line++; + count--; + } + return(OK); + } +} + +/* +** DelChar(count) +** +** Delete count characters at current position +** +*/ + +static void DelChar(int count) +{ + T(("DelChar(%d) called, position = (%d,%d)", count, newscr->_cury, newscr->_curx)); + + if (parm_dch) { + TPUTS_TRACE("parm_dch"); + tputs(tparm(parm_dch, count), count, _nc_outch); + } else { + while (count--) + { + TPUTS_TRACE("delete_character"); + putp(delete_character); + } + } +} + +/* +** _nc_outstr(char *str) +** +** Emit a string without waiting for update. +*/ + +void _nc_outstr(const char *str) +{ + FILE *ofp = SP ? SP->_ofp : stdout; + + (void) fputs(str, ofp); + (void) fflush(ofp); + +#ifdef TRACE + _nc_outchars += strlen(str); +#endif /* TRACE */ +} diff --git a/ncurses/lib_endwin.c b/ncurses/lib_endwin.c new file mode 100644 index 00000000..bb1aab0e --- /dev/null +++ b/ncurses/lib_endwin.c @@ -0,0 +1,68 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* +** lib_endwin.c +** +** The routine endwin(). +** +*/ + +#include +#include + +MODULE_ID("$Id: lib_endwin.c,v 1.10 1997/02/02 00:36:41 tom Exp $") + +int +endwin(void) +{ + T((T_CALLED("endwin()"))); + + SP->_endwin = TRUE; + + _nc_mouse_wrap(SP); + + /* SP->_curs{row,col} may be used later in _nc_mvcur_wrap,save_curs */ + mvcur(-1, -1, SP->_cursrow = screen_lines - 1, SP->_curscol = 0); + + curs_set(1); /* set cursor to normal mode */ + + if (SP->_coloron == TRUE && orig_pair) + putp(orig_pair); + + _nc_mvcur_wrap(); /* wrap up cursor addressing */ + + if (SP && (SP->_current_attr != A_NORMAL)) + vidattr(A_NORMAL); + + /* + * Reset terminal's tab counter. There's a long-time bug that + * if you exit a "curses" program such as vi or more, tab + * forward, and then backspace, the cursor doesn't go to the + * right place. The problem is that the kernel counts the + * escape sequences that reset things as column positions. + * Utter a \r to reset this invisibly. + */ + _nc_outch('\r'); + + returnCode(reset_shell_mode()); +} diff --git a/ncurses/lib_erase.c b/ncurses/lib_erase.c new file mode 100644 index 00000000..2687e1f2 --- /dev/null +++ b/ncurses/lib_erase.c @@ -0,0 +1,68 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* +** lib_erase.c +** +** The routine werase(). +** +*/ + +#include + +MODULE_ID("$Id: lib_erase.c,v 1.7 1997/02/01 23:18:18 tom Exp $") + +int werase(WINDOW *win) +{ +int y; +chtype *sp, *end, *start, *maxx = NULL; +short minx; + + T((T_CALLED("werase(%p)"), win)); + + for (y = 0; y <= win->_maxy; y++) { + minx = _NOCHANGE; + start = win->_line[y].text; + end = &start[win->_maxx]; + + maxx = start; + for (sp = start; sp <= end; sp++) { + maxx = sp; + if (minx == _NOCHANGE) + minx = sp - start; + *sp = _nc_background(win); + } + + if (minx != _NOCHANGE) { + if (win->_line[y].firstchar > minx || + win->_line[y].firstchar == _NOCHANGE) + win->_line[y].firstchar = minx; + + if (win->_line[y].lastchar < maxx - win->_line[y].text) + win->_line[y].lastchar = maxx - win->_line[y].text; + } + } + win->_curx = win->_cury = 0; + win->_flags &= ~_WRAPPED; + _nc_synchook(win); + returnCode(OK); +} diff --git a/ncurses/lib_freeall.c b/ncurses/lib_freeall.c new file mode 100644 index 00000000..4eaf6599 --- /dev/null +++ b/ncurses/lib_freeall.c @@ -0,0 +1,123 @@ +/****************************************************************************** + * Copyright 1996 by Thomas E. Dickey * + * All Rights Reserved. * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * + * that the above copyright notice appear in all copies and that both that * + * copyright notice and this permission notice appear in supporting * + * documentation, and that the name of the above listed copyright holder(s) * + * not be used in advertising or publicity pertaining to distribution of the * + * software without specific, written prior permission. THE ABOVE LISTED * + * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * + * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + ******************************************************************************/ + +#define HAVE_NC_FREEALL 1 + +#include +#include + +#if HAVE_LIBDBMALLOC +extern int malloc_errfd; /* FIXME */ +#endif + +MODULE_ID("$Id: lib_freeall.c,v 1.8 1997/02/15 18:53:43 tom Exp $") + +static void free_slk(SLK *p) +{ + if (p != 0) { + FreeIfNeeded(p->ent); + FreeIfNeeded(p->buffer); + free(p); + } +} + +void _nc_free_termtype(struct termtype *p, int base) +{ + if (p != 0) { + FreeIfNeeded(p->term_names); + FreeIfNeeded(p->str_table); + if (base) + free(p); + } +} + +static void free_tries(struct tries *p) +{ + struct tries *q; + + while (p != 0) { + q = p->sibling; + if (p->child != 0) + free_tries(p->child); + free(p); + p = q; + } +} + +/* + * Free all ncurses data. This is used for testing only (there's no practical + * use for it as an extension). + */ +void _nc_freeall(void) +{ + WINDOWLIST *p, *q; + +#if NO_LEAKS + _nc_free_tparm(); +#endif + while (_nc_windows != 0) { + /* Delete only windows that're not a parent */ + for (p = _nc_windows; p != 0; p = p->next) { + bool found = FALSE; + + for (q = _nc_windows; q != 0; q = q->next) { + if ((p != q) + && (q->win->_flags & _SUBWIN) + && (p->win == q->win->_parent)) { + found = TRUE; + break; + } + } + + if (!found) { + delwin(p->win); + break; + } + } + } + + if (SP != 0) { + free_tries (SP->_keytry); + free_slk(SP->_slk); + FreeIfNeeded(SP->_color_pairs); + FreeIfNeeded(SP->_color_table); + _nc_set_buffer(SP->_ofp, FALSE); +#if !BROKEN_LINKER + FreeAndNull(SP); +#endif + } + + if (cur_term != 0) { + _nc_free_termtype(&(cur_term->type), TRUE); + } + +#if HAVE_LIBDBMALLOC + malloc_dump(malloc_errfd); +#elif HAVE_LIBDMALLOC +#elif HAVE_PURIFY + purify_all_inuse(); +#endif +} + +void _nc_free_and_exit(int code) +{ + _nc_freeall(); + exit(code); +} diff --git a/ncurses/lib_getch.c b/ncurses/lib_getch.c new file mode 100644 index 00000000..d59531f2 --- /dev/null +++ b/ncurses/lib_getch.c @@ -0,0 +1,381 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* +** lib_getch.c +** +** The routine getch(). +** +*/ + +#include + +MODULE_ID("$Id: lib_getch.c,v 1.24 1997/02/15 21:12:16 tom Exp $") + +#define head SP->_fifohead +#define tail SP->_fifotail +#define peek SP->_fifopeek + +#define h_inc() { head == FIFO_SIZE-1 ? head = 0 : head++; if (head == tail) head = -1, tail = 0;} +#define h_dec() { head == 0 ? head = FIFO_SIZE-1 : head--; if (head == tail) tail = -1;} +#define t_inc() { tail == FIFO_SIZE-1 ? tail = 0 : tail++; if (tail == head) tail = -1;} +#define p_inc() { peek == FIFO_SIZE-1 ? peek = 0 : peek++;} + +int ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */ + +static int fifo_peek(void) +{ + T(("peeking at %d", peek+1)); + return SP->_fifo[++peek]; +} + +#ifdef TRACE +static inline void fifo_dump(void) +{ +int i; + T(("head = %d, tail = %d, peek = %d", head, tail, peek)); + for (i = 0; i < 10; i++) + T(("char %d = %s", i, _trace_key(SP->_fifo[i]))); +} +#endif /* TRACE */ + +static inline int fifo_pull(void) +{ +int ch; + ch = SP->_fifo[head]; + T(("pulling %d from %d", ch, head)); + + h_inc(); +#ifdef TRACE + if (_nc_tracing & TRACE_IEVENT) fifo_dump(); +#endif + return ch; +} + +int ungetch(int ch) +{ + if (tail == -1) + return ERR; + if (head == -1) { + head = 0; + t_inc() + } else + h_dec(); + + SP->_fifo[head] = ch; + T(("ungetch ok")); +#ifdef TRACE + if (_nc_tracing & TRACE_IEVENT) fifo_dump(); +#endif + return OK; +} + +static inline int fifo_push(void) +{ +int n; +unsigned int ch; + + if (tail == -1) return ERR; + /* FALLTHRU */ +again: + errno = 0; +#if USE_GPM_SUPPORT + if ((_nc_mouse_fd() >= 0) + && (_nc_timed_wait(3, -1, (int *)0) & 2)) + { + _nc_mouse_event(SP); + ch = KEY_MOUSE; + n = 1; + } else +#endif + { + unsigned char c2; + n = read(SP->_ifd, &c2, 1); + ch = c2; + } + + /* + * Under System V curses with non-restarting signals, getch() returns + * with value ERR when a handled signal keeps it from completing. + * If signals restart system calls, OTOH, the signal is invisible + * except to its handler. + * + * We don't want this difference to show. This piece of code + * tries to make it look like we always have restarting signals. + */ + if (n <= 0 && errno == EINTR) + goto again; + + if ((n == -1) || (n == 0)) + { + T(("read(%d,&ch,1)=%d", SP->_ifd, n)); + return ERR; + } + T(("read %d characters", n)); + + SP->_fifo[tail] = ch; + if (head == -1) head = tail; + t_inc(); + T(("pushed %#x at %d", ch, tail)); +#ifdef TRACE + if (_nc_tracing & TRACE_IEVENT) fifo_dump(); +#endif + return ch; +} + +static inline void fifo_clear(void) +{ +int i; + for (i = 0; i < FIFO_SIZE; i++) + SP->_fifo[i] = 0; + head = -1; tail = peek = 0; +} + +static int kgetch(WINDOW *); + +void _nc_backspace(WINDOW *win) +{ + if (win->_curx == 0) + { + beep(); + return; + } + + mvwaddstr(curscr, win->_begy + win->_cury + win->_yoffset, + win->_begx + win->_curx, "\b \b"); + waddstr(win, "\b \b"); + + /* + * This used to do the equivalent of _nc_outstr("\b \b"), which + * would fail on terminals with a non-backspace cursor_left + * character. + */ + mvcur(win->_begy + win->_cury + win->_yoffset, + win->_begx + win->_curx, + win->_begy + win->_cury + win->_yoffset, + win->_begx + win->_curx - 1); + _nc_outstr(" "); + mvcur(win->_begy + win->_cury + win->_yoffset, + win->_begx + win->_curx, + win->_begy + win->_cury + win->_yoffset, + win->_begx + win->_curx - 1); + SP->_curscol--; +} + +int +wgetch(WINDOW *win) +{ +int ch; + + T((T_CALLED("wgetch(%p)"), win)); + + /* + * Handle cooked mode. Grab a string from the screen, + * stuff its contents in the FIFO queue, and pop off + * the first character to return it. + */ + if (head == -1 && !SP->_raw && !SP->_cbreak) + { + char buf[MAXCOLUMNS], *sp; + + T(("filling queue in cooked mode")); + + wgetnstr(win, buf, MAXCOLUMNS); + + for (sp = buf; *sp; sp++) + ungetch(*sp); + ungetch('\n'); + + return(fifo_pull()); + } + + /* this should be eliminated */ + if (!has_ic() + && !win->_scroll + && (SP->_echo) + && (win->_flags & _FULLWIN) + && win->_curx == win->_maxx + && win->_cury == win->_maxy) + returnCode(ERR); + + if ((is_wintouched(win) || (win->_flags & _HASMOVED)) && !(win->_flags & _ISPAD)) + wrefresh(win); + + if (!win->_notimeout && (win->_delay >= 0 || SP->_cbreak > 1)) { + int delay; + + T(("timed delay in wgetch()")); + if (SP->_cbreak > 1) + delay = (SP->_cbreak-1) * 100; + else + delay = win->_delay; + + T(("delay is %d microseconds", delay)); + + if (head == -1) /* fifo is empty */ + if (!_nc_timed_wait(3, delay, (int *)0)) + returnCode(ERR); + /* else go on to read data available */ + } + + if (win->_use_keypad) { + /* + * This is tricky. We only want to get special-key + * events one at a time. But we want to accumulate + * mouse events until either (a) the mouse logic tells + * us it's picked up a complete gesture, or (b) + * there's a detectable time lapse after one. + * + * Note: if the mouse code starts failing to compose + * press/release events into clicks, you should probably + * increase _nc_max_click_interval. + */ + int runcount = 0; + + do { + ch = kgetch(win); + if (ch == KEY_MOUSE) + { + ++runcount; + if (_nc_mouse_inline(SP)) + break; + } + } while + (ch == KEY_MOUSE + && (_nc_timed_wait(3, _nc_max_click_interval, (int *)0) + || !_nc_mouse_parse(runcount))); + if (runcount > 0 && ch != KEY_MOUSE) + { + /* mouse event sequence ended by keystroke, push it */ + ungetch(ch); + ch = KEY_MOUSE; + } + } else { + if (head == -1) + fifo_push(); + ch = fifo_pull(); + } + + if (ch == ERR) + { + T(("wgetch returning ERR")); + returnCode(ERR); + } + + /* + * Simulate ICRNL mode + */ + if ((ch == '\r') && SP->_nl) + ch = '\n'; + + /* Strip 8th-bit if so desired. We do this only for characters that + * are in the range 128-255, to provide compatibility with terminals + * that display only 7-bit characters. Note that 'ch' may be a + * function key at this point, so we mustn't strip _those_. + */ + if ((ch < KEY_MIN) && (ch & 0x80)) + if (!SP->_use_meta) + ch &= 0x7f; + + if (!(win->_flags & _ISPAD) && SP->_echo) { + /* there must be a simpler way of doing this */ + if (ch == erasechar() || ch == KEY_BACKSPACE || ch == KEY_LEFT) + _nc_backspace(win); + else if (ch < KEY_MIN) { + mvwaddch(curscr, + win->_begy + win->_cury + win->_yoffset, + win->_begx + win->_curx, + ch); + waddch(win, (chtype)ch); + } + else + beep(); + } + + T(("wgetch returning : %#x = %s", ch, _trace_key(ch));) + + returnCode(ch); +} + + +/* +** int +** kgetch() +** +** Get an input character, but take care of keypad sequences, returning +** an appropriate code when one matches the input. After each character +** is received, set an alarm call based on ESCDELAY. If no more of the +** sequence is received by the time the alarm goes off, pass through +** the sequence gotten so far. +** +*/ + +static int +kgetch(WINDOW *win GCC_UNUSED) +{ +struct tries *ptr; +int ch = 0; +int timeleft = ESCDELAY; + + TR(TRACE_IEVENT, ("kgetch(%p) called", win)); + + ptr = SP->_keytry; + + if (head == -1) { + if ((ch = fifo_push()) == ERR) + return ERR; + peek = 0; + while (ptr != NULL) { + TR(TRACE_IEVENT, ("ch: %s", _trace_key((unsigned char)ch))); + while ((ptr != NULL) && (ptr->ch != (unsigned char)ch)) + ptr = ptr->sibling; +#ifdef TRACE + if (ptr == NULL) + {TR(TRACE_IEVENT, ("ptr is null"));} + else + TR(TRACE_IEVENT, ("ptr=%p, ch=%d, value=%d", + ptr, ptr->ch, ptr->value)); +#endif /* TRACE */ + + if (ptr != NULL) + if (ptr->value != 0) { /* sequence terminated */ + TR(TRACE_IEVENT, ("end of sequence")); + fifo_clear(); + return(ptr->value); + } else { /* go back for another character */ + ptr = ptr->child; + TR(TRACE_IEVENT, ("going back for more")); + } else + break; + + TR(TRACE_IEVENT, ("waiting for rest of sequence")); + if (!_nc_timed_wait(3, timeleft, &timeleft)) { + TR(TRACE_IEVENT, ("ran out of time")); + return(fifo_pull()); + } else { + TR(TRACE_IEVENT, ("got more!")); + fifo_push(); + ch = fifo_peek(); + } + } + } + return(fifo_pull()); +} diff --git a/ncurses/lib_getstr.c b/ncurses/lib_getstr.c new file mode 100644 index 00000000..aaed1873 --- /dev/null +++ b/ncurses/lib_getstr.c @@ -0,0 +1,162 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* +** lib_getstr.c +** +** The routine wgetstr(). +** +*/ + +#include +#include + +MODULE_ID("$Id: lib_getstr.c,v 1.11 1997/02/01 23:22:54 tom Exp $") + +/* + * This wipes out the last character, no matter whether it was a tab, control + * or other character, and handles reverse wraparound. + */ +static char *WipeOut(WINDOW *win, int y, int x, char *first, char *last, bool echoed) +{ + if (last > first) { + *--last = '\0'; + if (echoed) { + int y1 = win->_cury; + int x1 = win->_curx; + + wmove(win, y, x); + waddstr(win, first); + getyx(win, y, x); + while (win->_cury < y1 + || (win->_cury == y1 && win->_curx < x1)) + waddch(win, ' '); + + wmove(win, y, x); + } + } + return last; +} + +int wgetnstr(WINDOW *win, char *str, int maxlen) +{ +TTY buf; +bool oldnl, oldecho, oldraw, oldcbreak, oldkeypad; +char erasec; +char killc; +char *oldstr; +int ch; +int y, x; + + T((T_CALLED("wgetnstr(%p,%p, %d)"), win, str, maxlen)); + + GET_TTY(cur_term->Filedes, &buf); + + oldnl = SP->_nl; + oldecho = SP->_echo; + oldraw = SP->_raw; + oldcbreak = SP->_cbreak; + oldkeypad = win->_use_keypad; + nl(); + noecho(); + noraw(); + cbreak(); + keypad(win, TRUE); + + erasec = erasechar(); + killc = killchar(); + + oldstr = str; + getyx(win, y, x); + + if (is_wintouched(win) || (win->_flags & _HASMOVED)) + wrefresh(win); + + while ((ch = wgetch(win)) != ERR) { + /* + * Some terminals (the Wyse-50 is the most common) generate + * a \n from the down-arrow key. With this logic, it's the + * user's choice whether to set kcud=\n for wgetch(); + * terminating *getstr() with \n should work either way. + */ + if (ch == '\n' + || ch == '\r' + || ch == KEY_DOWN + || ch == KEY_ENTER) + break; + if (ch == erasec || ch == KEY_LEFT || ch == KEY_BACKSPACE) { + if (str > oldstr) { + str = WipeOut(win, y, x, oldstr, str, oldecho); + } + } else if (ch == killc) { + while (str > oldstr) { + str = WipeOut(win, y, x, oldstr, str, oldecho); + } + } else if (ch >= KEY_MIN + || (maxlen >= 0 && str - oldstr >= maxlen)) { + beep(); + } else { + *str++ = ch; + if (oldecho == TRUE) { + if (waddch(win, ch) == ERR) { + /* + * We can't really use the lower-right + * corner for input, since it'll mess + * up bookkeeping for erases. + */ + win->_flags &= ~_WRAPPED; + waddch(win, ' '); + str = WipeOut(win, y, x, oldstr, str, oldecho); + continue; + } + wrefresh(win); + } + } + } + + win->_curx = 0; + win->_flags &= ~_WRAPPED; + if (win->_cury < win->_maxy) + win->_cury++; + wrefresh(win); + + /* Restore with a single I/O call, to fix minor asymmetry between + * raw/noraw, etc. + */ + SP->_nl = oldnl; + SP->_echo = oldecho; + SP->_raw = oldraw; + SP->_cbreak = oldcbreak; + + SET_TTY(cur_term->Filedes, &buf); + + if (oldkeypad == FALSE) + keypad(win, FALSE); + + *str = '\0'; + if (ch == ERR) + returnCode(ERR); + + T(("wgetnstr returns %s", _nc_visbuf(oldstr))); + + returnCode(OK); +} diff --git a/ncurses/lib_inchstr.c b/ncurses/lib_inchstr.c new file mode 100644 index 00000000..1d90a5f6 --- /dev/null +++ b/ncurses/lib_inchstr.c @@ -0,0 +1,45 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* +** lib_inchstr.c +** +** The routine winchnstr(). +** +*/ + +#include + +MODULE_ID("$Id: lib_inchstr.c,v 1.5 1997/02/02 01:06:03 tom Exp $") + +int winchnstr(WINDOW *win, chtype *str, int n) +{ + int i; + + T((T_CALLED("winchnstr(%p,%p,%d)"), win, str, n)); + + for (i = 0; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++) + str[i] = win->_line[win->_cury].text[win->_curx + i]; + str[i] = (chtype)0; + + returnCode(i); +} diff --git a/ncurses/lib_initscr.c b/ncurses/lib_initscr.c new file mode 100644 index 00000000..3a995d22 --- /dev/null +++ b/ncurses/lib_initscr.c @@ -0,0 +1,106 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* +** lib_initscr.c +** +** The routines initscr(), and termname(). +** +*/ + +#include +#include /* cur_term */ + +#if HAVE_SYS_TERMIO_H +#include /* needed for ISC */ +#endif + +MODULE_ID("$Id: lib_initscr.c,v 1.18 1997/03/08 14:03:59 tom Exp $") + +#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */ +#define ONLCR 0 +#endif + +/* + * SVr4/XSI Curses specify that hardware echo is turned off in initscr, and not + * restored during the curses session. The library simulates echo in software. + * (The behavior is unspecified if the application enables hardware echo). + * + * The newterm function also initializes terminal settings. + */ +int _nc_initscr(void) +{ + /* for extended XPG4 conformance requires cbreak() at this point */ + /* (SVr4 curses does this anyway) */ + cbreak(); + +#ifdef TERMIOS + cur_term->Nttyb.c_lflag &= ~(ECHO|ECHONL); + cur_term->Nttyb.c_iflag &= ~(ICRNL|INLCR|IGNCR); + cur_term->Nttyb.c_oflag &= ~(ONLCR); +#else + cur_term->Nttyb.sg_flags &= ~(ECHO|CRMOD); +#endif + if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) + return ERR; + return OK; +} + +WINDOW *initscr(void) +{ +static bool initialized = FALSE; +const char *name; + + T((T_CALLED("initscr()"))); + /* Portable applications must not call initscr() more than once */ + if (!initialized) { + initialized = TRUE; + + if ((name = getenv("TERM")) == 0) + name = "unknown"; + if (newterm(name, stdout, stdin) == 0) { + fprintf(stderr, "Error opening terminal: %s.\n", name); + exit(EXIT_FAILURE); + } + + /* allow user to set maximum escape delay from the environment */ + if ((name = getenv("ESCDELAY")) != 0) + ESCDELAY = atoi(getenv("ESCDELAY")); + + /* def_shell_mode - done in newterm/_nc_setupscreen */ + def_prog_mode(); + } + returnWin(stdscr); +} + +char *termname(void) +{ +char *term = getenv("TERM"); +static char ret[15]; + + T(("termname() called")); + + if (term != 0) { + (void) strncpy(ret, term, sizeof(ret) - 1); + term = ret; + } + return term; +} diff --git a/ncurses/lib_insch.c b/ncurses/lib_insch.c new file mode 100644 index 00000000..2040b385 --- /dev/null +++ b/ncurses/lib_insch.c @@ -0,0 +1,56 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* +** lib_insch.c +** +** The routine winsch(). +** +*/ + +#include + +MODULE_ID("$Id: lib_insch.c,v 1.7 1997/04/12 17:43:02 tom Exp $") + +int winsch(WINDOW *win, chtype c) +{ +chtype *temp1, *temp2; +chtype *end; + + T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(c))); + + end = &win->_line[win->_cury].text[win->_curx]; + temp1 = &win->_line[win->_cury].text[win->_maxx]; + temp2 = temp1 - 1; + + while (temp1 > end) + *temp1-- = *temp2--; + + *temp1 = _nc_render(win, c); + + win->_line[win->_cury].lastchar = win->_maxx; + if (win->_line[win->_cury].firstchar == _NOCHANGE + || win->_line[win->_cury].firstchar > win->_curx) + win->_line[win->_cury].firstchar = win->_curx; + returnCode(OK); +} diff --git a/ncurses/lib_insdel.c b/ncurses/lib_insdel.c new file mode 100644 index 00000000..c367c93d --- /dev/null +++ b/ncurses/lib_insdel.c @@ -0,0 +1,48 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* +** lib_insdel.c +** +** The routine winsdelln(win, n). +** positive n insert n lines above current line +** negative n delete n lines starting from current line +** +*/ + +#include + +MODULE_ID("$Id") + +int +winsdelln(WINDOW *win, int n) +{ + T((T_CALLED("winsdel(%p,%d)"), win, n)); + + if (n == 0) + returnCode(OK); + + _nc_scroll_window(win, -n, win->_cury, win->_maxy); + touchline(win, win->_cury, win->_maxy - win->_cury + 1); + + _nc_synchook(win); + returnCode(OK); +} diff --git a/ncurses/lib_insstr.c b/ncurses/lib_insstr.c new file mode 100644 index 00000000..5c440b72 --- /dev/null +++ b/ncurses/lib_insstr.c @@ -0,0 +1,63 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* +** lib_insstr.c +** +** The routine winsnstr(). +** +*/ + +#include +#include + +MODULE_ID("$Id: lib_insstr.c,v 1.9 1997/02/15 16:09:53 tom Exp $") + +int winsnstr(WINDOW *win, const char *str, int n) +{ +short oy = win->_cury; +short ox = win->_curx; +const char *cp; + + T((T_CALLED("winsstr(%p,%s,%d)"), win, _nc_visbuf(str), n)); + + for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) { + if (*cp == '\n' || *cp == '\r' || *cp == '\t' || *cp == '\b') + _nc_waddch_nosync(win, (chtype)(*cp)); + else if (is7bits(*cp) && iscntrl(*cp)) { + winsch(win, ' ' + (chtype)(*cp)); + winsch(win, '^'); + win->_curx += 2; + } else { + winsch(win, (chtype)(*cp)); + win->_curx++; + } + if (win->_curx > win->_maxx) + win->_curx = win->_maxx; + } + + win->_curx = ox; + win->_cury = oy; + _nc_synchook(win); + returnCode(OK); +} diff --git a/ncurses/lib_instr.c b/ncurses/lib_instr.c new file mode 100644 index 00000000..607a8e09 --- /dev/null +++ b/ncurses/lib_instr.c @@ -0,0 +1,56 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* +** lib_instr.c +** +** The routine winnstr(). +** +*/ + +#include + +MODULE_ID("$Id: lib_instr.c,v 1.6 1997/05/03 10:51:07 juergen Exp $") + +int winnstr(WINDOW *win, char *str, int n) +{ + int i, row, col; + + T((T_CALLED("winnstr(%p,%p,%d)"), win, str, n)); + + getyx(win, row, col); + + if (n < 0) + n = win->_maxx - win->_curx + 1; + + for (i = 0; i < n;) { + str[i++] = TextOf(win->_line[row].text[col]); + if (++col > win->_maxx) { + col = 0; + if (++row > win->_maxy) + break; + } + } + str[i] = '\0'; /* SVr4 does not seem to count the null */ + + returnCode(i); +} diff --git a/ncurses/lib_isendwin.c b/ncurses/lib_isendwin.c new file mode 100644 index 00000000..39f90098 --- /dev/null +++ b/ncurses/lib_isendwin.c @@ -0,0 +1,39 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* +** lib_endwin.c +** +** The routine endwin(). +** +*/ + +#include + +MODULE_ID("$Id: lib_isendwin.c,v 1.2 1996/07/30 22:29:50 tom Exp $") + +int isendwin(void) +{ + if (SP == NULL) + return FALSE; + return SP->_endwin; +} diff --git a/ncurses/lib_kernel.c b/ncurses/lib_kernel.c new file mode 100644 index 00000000..86f87726 --- /dev/null +++ b/ncurses/lib_kernel.c @@ -0,0 +1,173 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * lib_kernel.c + * + * Misc. low-level routines: + * napms() + * reset_prog_mode() + * reset_shell_mode() + * erasechar() + * killchar() + * flushinp() + * savetty() + * resetty() + * + * The baudrate() and delay_output() functions could logically live here, + * but are in other modules to reduce the static-link size of programs + * that use only these facilities. + */ + +#include +#include /* cur_term */ + +MODULE_ID("$Id: lib_kernel.c,v 1.13 1997/02/02 00:33:14 tom Exp $") + +int napms(int ms) +{ + T((T_CALLED("napms(%d)"), ms)); + + usleep(1000*(unsigned)ms); + returnCode(OK); +} + +int reset_prog_mode(void) +{ + T((T_CALLED("reset_prog_mode()"))); + + SET_TTY(cur_term->Filedes, &cur_term->Nttyb); + if (SP && stdscr && stdscr->_use_keypad) + _nc_keypad(TRUE); + + returnCode(OK); +} + + +int reset_shell_mode(void) +{ + T((T_CALLED("reset_shell_mode()"))); + + if (SP) + { + fflush(SP->_ofp); + _nc_keypad(FALSE); + } + + SET_TTY(cur_term->Filedes, &cur_term->Ottyb); + returnCode(OK); +} + +/* + * erasechar() + * + * Return erase character as given in cur_term->Ottyb. + * + */ + +char +erasechar(void) +{ + T((T_CALLED("erasechar()"))); + +#ifdef TERMIOS + returnCode(cur_term->Ottyb.c_cc[VERASE]); +#else + returnCode(cur_term->Ottyb.sg_erase); +#endif + +} + + + +/* + * killchar() + * + * Return kill character as given in cur_term->Ottyb. + * + */ + +char +killchar(void) +{ + T((T_CALLED("killchar()"))); + +#ifdef TERMIOS + returnCode(cur_term->Ottyb.c_cc[VKILL]); +#else + returnCode(cur_term->Ottyb.sg_kill); +#endif +} + + + +/* + * flushinp() + * + * Flush any input on cur_term->Filedes + * + */ + +int flushinp(void) +{ + T((T_CALLED("flushinp()"))); + +#ifdef TERMIOS + tcflush(cur_term->Filedes, TCIFLUSH); +#else + errno = 0; + do { + ioctl(cur_term->Filedes, TIOCFLUSH, 0); + } while + (errno == EINTR); +#endif + if (SP) { + SP->_fifohead = -1; + SP->_fifotail = 0; + SP->_fifopeek = 0; + } + returnCode(OK); + +} + +/* +** savetty() and resetty() +** +*/ + +static TTY buf; + +int savetty(void) +{ + T((T_CALLED("savetty()"))); + + GET_TTY(cur_term->Filedes, &buf); + returnCode(OK); +} + +int resetty(void) +{ + T((T_CALLED("resetty()"))); + + SET_TTY(cur_term->Filedes, &buf); + returnCode(OK); +} diff --git a/ncurses/lib_longname.c b/ncurses/lib_longname.c new file mode 100644 index 00000000..50442996 --- /dev/null +++ b/ncurses/lib_longname.c @@ -0,0 +1,46 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* +** lib_longname.c +** +** The routine longname(). +** +*/ + +#include + +MODULE_ID("$Id: lib_longname.c,v 1.5 1996/12/21 14:24:06 tom Exp $") + +char * +longname(void) +{ +char *ptr; + + T(("longname() called")); + + for (ptr = ttytype + strlen(ttytype); ptr > ttytype; ptr--) + if (*ptr == '|') + return(ptr + 1); + + return(ttytype); +} diff --git a/ncurses/lib_mouse.c b/ncurses/lib_mouse.c new file mode 100644 index 00000000..86eaf13e --- /dev/null +++ b/ncurses/lib_mouse.c @@ -0,0 +1,670 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* + * This module is intended to encapsulate ncurses's interface to pointing + * devices. + * + * The first method used is xterm's internal mouse-tracking facility. + * The second (not yet implemented) will be Alessandro Rubini's GPM server. + * + * Notes for implementors of new mouse-interface methods: + * + * The code is logically split into a lower level that accepts event reports + * in a device-dependent format and an upper level that parses mouse gestures + * and filters events. The mediating data structure is a circular queue of + * MEVENT structures. + * + * Functionally, the lower level's job is to pick up primitive events and + * put them on the circular queue. This can happen in one of two ways: + * either (a) _nc_mouse_event() detects a series of incoming mouse reports + * and queues them, or (b) code in lib_getch.c detects the kmous prefix in + * the keyboard input stream and calls _nc_mouse_inline to queue up a series + * of adjacent mouse reports. + * + * In either case, _nc_mouse_parse() should be called after the series is + * accepted to parse the digested mouse reports (low-level MEVENTs) into + * a gesture (a high-level or composite MEVENT). + * + * Don't be too shy about adding new event types or modifiers, if you can find + * room for them in the 32-bit mask. The API is written so that users get + * feedback on which theoretical event types they won't see when they call + * mousemask. There's one bit per button (the RESERVED_EVENT bit) not being + * used yet, and a couple of bits open at the high end. + */ + +#include +#include + +#if USE_GPM_SUPPORT +#ifndef LINT /* don't need this for llib-lncurses */ +#undef buttons /* term.h defines this, and gpm uses it! */ +#include +#endif +#endif + +MODULE_ID("$Id: lib_mouse.c,v 0.22 1997/02/15 22:33:37 tom Exp $") + +#define MY_TRACE TRACE_ICALLS|TRACE_IEVENT + +#define INVALID_EVENT -1 + +int _nc_max_click_interval = 166; /* max press/release separation */ + +static int mousetype; +#define M_XTERM -1 /* use xterm's mouse tracking? */ +#define M_NONE 0 /* no mouse device */ +#define M_GPM 1 /* use GPM */ + +#if USE_GPM_SUPPORT +#ifndef LINT +static Gpm_Connect gpm_connect; +#endif +#endif + +static mmask_t eventmask; /* current event mask */ + +/* maintain a circular list of mouse events */ +#define EV_MAX 8 /* size of circular event queue */ +static MEVENT events[EV_MAX]; /* hold the last mouse event seen */ +static MEVENT *eventp = events; /* next free slot in event queue */ +#define NEXT(ep) ((ep == events + EV_MAX - 1) ? events : ep + 1) +#define PREV(ep) ((ep == events) ? events + EV_MAX - 1 : ep - 1) + +#ifdef TRACE +static void _trace_slot(const char *tag) +{ + MEVENT *ep; + + _tracef(tag); + + for (ep = events; ep < events + EV_MAX; ep++) + _tracef("mouse event queue slot %d = %s", ep-events, _tracemouse(ep)); +} +#endif + +void _nc_mouse_init(SCREEN *sp GCC_UNUSED) +/* initialize the mouse -- called at screen-setup time */ +{ + int i; + + TR(MY_TRACE, ("_nc_mouse_init() called")); + + for (i = 0; i < EV_MAX; i++) + events[i].id = INVALID_EVENT; + + /* we know how to recognize mouse events under xterm */ + if (!strncmp(cur_term->type.term_names, "xterm", 5) && key_mouse) + mousetype = M_XTERM; + +#if USE_GPM_SUPPORT + else if (!strncmp(cur_term->type.term_names, "linux", 5)) + { + /* GPM: initialize connection to gpm server */ + gpm_connect.eventMask = GPM_DOWN|GPM_UP; + gpm_connect.defaultMask = ~gpm_connect.eventMask; + gpm_connect.minMod = 0; + gpm_connect.maxMod = ~0; + if (Gpm_Open (&gpm_connect, 0) >= 0) /* returns the file-descriptor */ + mousetype = M_GPM; + } +#endif +} + +int _nc_mouse_fd(void) +{ + if (mousetype == M_XTERM) + return -1; +#if USE_GPM_SUPPORT + else if (mousetype == M_GPM) + return gpm_fd; +#endif + return -1; +} + +bool _nc_mouse_event(SCREEN *sp GCC_UNUSED) +/* query to see if there is a pending mouse event */ +{ +#if USE_GPM_SUPPORT + /* GPM: query server for event, return TRUE if we find one */ + Gpm_Event ev; + + if (gpm_fd >= 0 + && _nc_timed_wait(2, 0, (int *)0) + && Gpm_GetEvent(&ev) == 1) + { + eventp->id = 0; /* there's only one mouse... */ + + eventp->bstate = 0; + switch (ev.type & 0x0f) + { + case(GPM_DOWN): + if (ev.buttons & GPM_B_LEFT) eventp->bstate |= BUTTON1_PRESSED; + if (ev.buttons & GPM_B_MIDDLE) eventp->bstate |= BUTTON2_PRESSED; + if (ev.buttons & GPM_B_RIGHT) eventp->bstate |= BUTTON3_PRESSED; + break; + case(GPM_UP): + if (ev.buttons & GPM_B_LEFT) eventp->bstate |= BUTTON1_RELEASED; + if (ev.buttons & GPM_B_MIDDLE) eventp->bstate |= BUTTON2_RELEASED; + if (ev.buttons & GPM_B_RIGHT) eventp->bstate |= BUTTON3_RELEASED; + break; + default: + break; + } + + eventp->x = ev.x - 1; + eventp->y = ev.y - 1; + eventp->z = 0; + + /* bump the next-free pointer into the circular list */ + eventp = NEXT(eventp); + return (TRUE); + } +#endif + /* xterm: never have to query, mouse events are in the keyboard stream */ + return(FALSE); /* no event waiting */ +} + +bool _nc_mouse_inline(SCREEN *sp) +/* mouse report received in the keyboard stream -- parse its info */ +{ + TR(MY_TRACE, ("_nc_mouse_inline() called")); + + if (mousetype == M_XTERM) + { + unsigned char kbuf[4]; + MEVENT *prev; + size_t grabbed; + int res; + + /* This code requires that your xterm entry contain the kmous + * capability and that it be set to the \E[M documented in the + * Xterm Control Sequences reference. This is how we + * arrange for mouse events to be reported via a KEY_MOUSE + * return value from wgetch(). After this value is received, + * _nc_mouse_inline() gets called and is immediately + * responsible for parsing the mouse status information + * following the prefix. + * + * The following quotes from the ctrlseqs.ms document in the + * X distribution, describing the X mouse tracking feature: + * + * Parameters for all mouse tracking escape sequences + * generated by xterm encode numeric parameters in a single + * character as value+040. For example, ! is 1. + * + * On button press or release, xterm sends ESC [ M CbCxCy. + * The low two bits of Cb encode button information: 0=MB1 + * pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release. The + * upper bits encode what modifiers were down when the + * button was pressed and are added together. 4=Shift, + * 8=Meta, 16=Control. Cx and Cy are the x and y coordinates + * of the mouse event. The upper left corner is (1,1). + * + * (End quote) By the time we get here, we've eaten the + * key prefix. FYI, the loop below is necessary because + * mouse click info isn't guaranteed to present as a + * single clist item. It always does under Linux but often + * fails to under Solaris. + */ + for (grabbed = 0; grabbed < 3; grabbed += res) + { + res = read(sp->_ifd, kbuf + grabbed, 3-grabbed); + if (res == -1) + break; + } + kbuf[3] = '\0'; + + TR(TRACE_IEVENT, ("_nc_mouse_inline sees the following xterm data: '%s'", kbuf)); + + eventp->id = 0; /* there's only one mouse... */ + + /* processing code goes here */ + eventp->bstate = 0; + switch (kbuf[0] & 0x3) + { + case 0x0: + eventp->bstate = BUTTON1_PRESSED; + break; + + case 0x1: + eventp->bstate = BUTTON2_PRESSED; + break; + + case 0x2: + eventp->bstate = BUTTON3_PRESSED; + break; + + case 0x3: + /* + * Release events aren't reported for individual buttons, + * just for the button set as a whole... + */ + eventp->bstate = + (BUTTON1_RELEASED | + BUTTON2_RELEASED | + BUTTON3_RELEASED); + /* + * ...however, because there are no kinds of mouse events under + * xterm that can intervene between press and release, we can + * deduce which buttons were actually released by looking at the + * previous event. + */ + prev = PREV(eventp); + if (!(prev->bstate & BUTTON1_PRESSED)) + eventp->bstate &=~ BUTTON1_RELEASED; + if (!(prev->bstate & BUTTON2_PRESSED)) + eventp->bstate &=~ BUTTON2_RELEASED; + if (!(prev->bstate & BUTTON3_PRESSED)) + eventp->bstate &=~ BUTTON3_RELEASED; + break; + } + + if (kbuf[0] & 4) { + eventp->bstate |= BUTTON_SHIFT; + } + if (kbuf[0] & 8) { + eventp->bstate |= BUTTON_ALT; + } + if (kbuf[0] & 16) { + eventp->bstate |= BUTTON_CTRL; + } + + eventp->x = (kbuf[1] - ' ') - 1; + eventp->y = (kbuf[2] - ' ') - 1; + TR(MY_TRACE, ("_nc_mouse_inline: primitive mouse-event %s has slot %d", _tracemouse(eventp), eventp - events)); + + /* bump the next-free pointer into the circular list */ + eventp = NEXT(eventp); + } + + return(FALSE); +} + +static void mouse_activate(bool on) +{ + if (mousetype == M_XTERM) + { + if (on) + { + TPUTS_TRACE("xterm mouse initialization"); + putp("\033[?1000h"); + } + else + { + TPUTS_TRACE("xterm mouse deinitialization"); + putp("\033[?1000l"); + } + (void) fflush(SP->_ofp); + } +} + +/************************************************************************** + * + * Device-independent code + * + **************************************************************************/ + +bool _nc_mouse_parse(int runcount) +/* parse a run of atomic mouse events into a gesture */ +{ + MEVENT *ep, *runp, *next, *prev = PREV(eventp); + int n; + bool merge; + + TR(MY_TRACE, ("_nc_mouse_parse(%d) called", runcount)); + + /* + * When we enter this routine, the event list next-free pointer + * points just past a run of mouse events that we know were separated + * in time by less than the critical click interval. The job of this + * routine is to collaps this run into a single higher-level event + * or gesture. + * + * We accomplish this in two passes. The first pass merges press/release + * pairs into click events. The second merges runs of click events into + * double or triple-click events. + * + * It's possible that the run may not resolve to a single event (for + * example, if the user quadruple-clicks). If so, leading events + * in the run are ignored. + * + * Note that this routine is independent of the format of the specific + * format of the pointing-device's reports. We can use it to parse + * gestures on anything that reports press/release events on a per- + * button basis, as long as the device-dependent mouse code puts stuff + * on the queue in MEVENT format. + */ + if (runcount == 1) + { + TR(MY_TRACE, ("_nc_mouse_parse: returning simple mouse event %s at slot %d", + _tracemouse(prev), prev-events)); + return (PREV(prev)->id >= 0) ? (PREV(prev)->bstate & eventmask) : 0; + } + + /* find the start of the run */ + runp = eventp; + for (n = runcount; n > 0; n--) + runp = PREV(runp); + +#ifdef TRACE + if (_nc_tracing & TRACE_IEVENT) + { + _trace_slot("before mouse press/release merge:"); + _tracef("_nc_mouse_parse: run starts at %d, ends at %d, count %d", + runp-events, ((eventp - events) + (EV_MAX-1)) % EV_MAX, runcount); + } +#endif /* TRACE */ + + /* first pass; merge press/release pairs */ + do { + merge = FALSE; + for (ep = runp; next = NEXT(ep), next != eventp; ep = next) + { + if (ep->x == next->x && ep->y == next->y + && (ep->bstate & (BUTTON1_PRESSED|BUTTON2_PRESSED|BUTTON3_PRESSED)) + && (!(ep->bstate & BUTTON1_PRESSED) + == !(next->bstate & BUTTON1_RELEASED)) + && (!(ep->bstate & BUTTON2_PRESSED) + == !(next->bstate & BUTTON2_RELEASED)) + && (!(ep->bstate & BUTTON3_PRESSED) + == !(next->bstate & BUTTON3_RELEASED)) + ) + { + if ((eventmask & BUTTON1_CLICKED) + && (ep->bstate & BUTTON1_PRESSED)) + { + ep->bstate &=~ BUTTON1_PRESSED; + ep->bstate |= BUTTON1_CLICKED; + merge = TRUE; + } + if ((eventmask & BUTTON2_CLICKED) + && (ep->bstate & BUTTON2_PRESSED)) + { + ep->bstate &=~ BUTTON2_PRESSED; + ep->bstate |= BUTTON2_CLICKED; + merge = TRUE; + } + if ((eventmask & BUTTON3_CLICKED) + && (ep->bstate & BUTTON3_PRESSED)) + { + ep->bstate &=~ BUTTON3_PRESSED; + ep->bstate |= BUTTON3_CLICKED; + merge = TRUE; + } + if (merge) + next->id = INVALID_EVENT; + } + } + } while + (merge); + +#ifdef TRACE + if (_nc_tracing & TRACE_IEVENT) + { + _trace_slot("before mouse click merge:"); + _tracef("_nc_mouse_parse: run starts at %d, ends at %d, count %d", + runp-events, ((eventp - events) + (EV_MAX-1)) % EV_MAX, runcount); + } +#endif /* TRACE */ + + /* + * Second pass; merge click runs. At this point, click events are + * each followed by one invalid event. We merge click events + * forward in the queue. + * + * NOTE: There is a problem with this design! If the application + * allows enough click events to pile up in the circular queue so + * they wrap around, it will cheerfully merge the newest forward + * into the oldest, creating a bogus doubleclick and confusing + * the queue-traversal logic rather badly. Generally this won't + * happen, because calling getmouse() marks old events invalid and + * ineligible for merges. The true solution to this problem would + * be to timestamp each MEVENT and perform the obvious sanity check, + * but the timer element would have to have sub-second resolution, + * which would get us into portability trouble. + */ + do { + MEVENT *follower; + + merge = FALSE; + for (ep = runp; next = NEXT(ep), next != eventp; ep = next) + if (ep->id != INVALID_EVENT) + { + if (next->id != INVALID_EVENT) + continue; + follower = NEXT(next); + if (follower->id == INVALID_EVENT) + continue; + + /* merge click events forward */ + if ((ep->bstate & + (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED)) + && (follower->bstate & + (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED))) + { + if ((eventmask & BUTTON1_DOUBLE_CLICKED) + && (follower->bstate & BUTTON1_CLICKED)) + { + follower->bstate &=~ BUTTON1_CLICKED; + follower->bstate |= BUTTON1_DOUBLE_CLICKED; + merge = TRUE; + } + if ((eventmask & BUTTON2_DOUBLE_CLICKED) + && (follower->bstate & BUTTON2_CLICKED)) + { + follower->bstate &=~ BUTTON2_CLICKED; + follower->bstate |= BUTTON2_DOUBLE_CLICKED; + merge = TRUE; + } + if ((eventmask & BUTTON3_DOUBLE_CLICKED) + && (follower->bstate & BUTTON3_CLICKED)) + { + follower->bstate &=~ BUTTON3_CLICKED; + follower->bstate |= BUTTON3_DOUBLE_CLICKED; + merge = TRUE; + } + if (merge) + ep->id = INVALID_EVENT; + } + + /* merge double-click events forward */ + if ((ep->bstate & + (BUTTON1_DOUBLE_CLICKED + | BUTTON2_DOUBLE_CLICKED + | BUTTON3_DOUBLE_CLICKED)) + && (follower->bstate & + (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED))) + { + if ((eventmask & BUTTON1_TRIPLE_CLICKED) + && (follower->bstate & BUTTON1_CLICKED)) + { + follower->bstate &=~ BUTTON1_CLICKED; + follower->bstate |= BUTTON1_TRIPLE_CLICKED; + merge = TRUE; + } + if ((eventmask & BUTTON2_TRIPLE_CLICKED) + && (follower->bstate & BUTTON2_CLICKED)) + { + follower->bstate &=~ BUTTON2_CLICKED; + follower->bstate |= BUTTON2_TRIPLE_CLICKED; + merge = TRUE; + } + if ((eventmask & BUTTON3_TRIPLE_CLICKED) + && (follower->bstate & BUTTON3_CLICKED)) + { + follower->bstate &=~ BUTTON3_CLICKED; + follower->bstate |= BUTTON3_TRIPLE_CLICKED; + merge = TRUE; + } + if (merge) + ep->id = INVALID_EVENT; + } + } + } while + (merge); + +#ifdef TRACE + if (_nc_tracing & TRACE_IEVENT) + { + _trace_slot("before mouse event queue compaction:"); + _tracef("_nc_mouse_parse: run starts at %d, ends at %d, count %d", + runp-events, ((eventp - events) + (EV_MAX-1)) % EV_MAX, runcount); + } +#endif /* TRACE */ + + /* + * Now try to throw away trailing events flagged invalid, or that + * don't match the current event mask. + */ + for (; runcount; prev = PREV(eventp), runcount--) + if (prev->id == INVALID_EVENT || !(prev->bstate & eventmask)) + eventp = prev; + +#ifdef TRACE + if (_nc_tracing & TRACE_IEVENT) + { + _trace_slot("after mouse event queue compaction:"); + _tracef("_nc_mouse_parse: run starts at %d, ends at %d, count %d", + runp-events, ((eventp - events) + (EV_MAX-1)) % EV_MAX, runcount); + } + for (ep = runp; ep != eventp; ep = NEXT(ep)) + if (ep->id != INVALID_EVENT) + TR(MY_TRACE, ("_nc_mouse_parse: returning composite mouse event %s at slot %d", + _tracemouse(ep), ep-events)); +#endif /* TRACE */ + + /* after all this, do we have a valid event? */ + return(PREV(eventp)->id != INVALID_EVENT); +} + +void _nc_mouse_wrap(SCREEN *sp GCC_UNUSED) +/* release mouse -- called by endwin() before shellout/exit */ +{ + TR(MY_TRACE, ("_nc_mouse_wrap() called")); + + /* xterm: turn off reporting */ + if (mousetype == M_XTERM && eventmask) + mouse_activate(FALSE); + + /* GPM: pass all mouse events to next client */ +} + +void _nc_mouse_resume(SCREEN *sp GCC_UNUSED) +/* re-connect to mouse -- called by doupdate() after shellout */ +{ + TR(MY_TRACE, ("_nc_mouse_resume() called")); + + /* xterm: re-enable reporting */ + if (mousetype == M_XTERM && eventmask) + mouse_activate(TRUE); + + /* GPM: reclaim our event set */ +} + +/************************************************************************** + * + * Mouse interface entry points for the API + * + **************************************************************************/ + +int getmouse(MEVENT *aevent) +/* grab a copy of the current mouse event */ +{ + if (aevent && (mousetype == M_XTERM || mousetype == M_GPM)) + { + /* compute the current-event pointer */ + MEVENT *prev = PREV(eventp); + + /* copy the event we find there */ + *aevent = *prev; + + TR(TRACE_IEVENT, ("getmouse: returning event %s from slot %d", + _tracemouse(prev), prev-events)); + + prev->id = INVALID_EVENT; /* so the queue slot becomes free */ + return(OK); + } + return(ERR); +} + +int ungetmouse(MEVENT *aevent) +/* enqueue a synthesized mouse event to be seen by the next wgetch() */ +{ + /* stick the given event in the next-free slot */ + *eventp = *aevent; + + /* bump the next-free pointer into the circular list */ + eventp = NEXT(eventp); + + /* push back the notification event on the keyboard queue */ + return ungetch(KEY_MOUSE); +} + +mmask_t mousemask(mmask_t newmask, mmask_t *oldmask) +/* set the mouse event mask */ +{ + if (oldmask) + *oldmask = eventmask; + + if (mousetype == M_XTERM || mousetype == M_GPM) + { + eventmask = newmask & + (BUTTON_ALT | BUTTON_CTRL | BUTTON_SHIFT + | BUTTON1_PRESSED | BUTTON1_RELEASED | BUTTON1_CLICKED + | BUTTON1_DOUBLE_CLICKED | BUTTON1_TRIPLE_CLICKED + | BUTTON2_PRESSED | BUTTON2_RELEASED | BUTTON2_CLICKED + | BUTTON2_DOUBLE_CLICKED | BUTTON2_TRIPLE_CLICKED + | BUTTON3_PRESSED | BUTTON3_RELEASED | BUTTON3_CLICKED + | BUTTON3_DOUBLE_CLICKED | BUTTON3_TRIPLE_CLICKED); + + mouse_activate(eventmask != 0); + + return(eventmask); + } + + return(0); +} + +bool wenclose(WINDOW *win, int y, int x) +/* check to see if given window encloses given screen location */ +{ + if (win) + { + y -= win->_yoffset; + return (win->_begy <= y && + win->_begx <= x && + (win->_begx + win->_maxx) >= x && + (win->_begy + win->_maxy) >= y); + } + return FALSE; +} + +int mouseinterval(int maxclick) +/* set the maximum mouse interval within which to recognize a click */ +{ + int oldval = _nc_max_click_interval; + + _nc_max_click_interval = maxclick; + return(oldval); +} + +/* lib_mouse.c ends here */ diff --git a/ncurses/lib_move.c b/ncurses/lib_move.c new file mode 100644 index 00000000..10d25c73 --- /dev/null +++ b/ncurses/lib_move.c @@ -0,0 +1,50 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* +** lib_move.c +** +** The routine wmove(). +** +*/ + +#include + +MODULE_ID("$Id: lib_move.c,v 1.6 1997/02/02 00:00:47 tom Exp $") + +int +wmove(WINDOW *win, int y, int x) +{ + T((T_CALLED("wmove(%p,%d,%d)"), win, y, x)); + + if (x >= 0 && x <= win->_maxx && + y >= 0 && y <= win->_maxy) + { + win->_curx = (short)x; + win->_cury = (short)y; + + win->_flags &= ~_WRAPPED; + win->_flags |= _HASMOVED; + returnCode(OK); + } else + returnCode(ERR); +} diff --git a/ncurses/lib_mvcur.c b/ncurses/lib_mvcur.c new file mode 100644 index 00000000..f1389d27 --- /dev/null +++ b/ncurses/lib_mvcur.c @@ -0,0 +1,1448 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* +** lib_mvcur.c +** +** The routines for moving the physical cursor and scrolling: +** +** void _nc_mvcur_init(void), mvcur_wrap(void) +** +** void _nc_mvcur_resume(void) +** +** int mvcur(int old_y, int old_x, int new_y, int new_x) +** +** void _nc_mvcur_wrap(void) +** +** int _nc_mvcur_scrolln(int n, int top, int bot, int maxy) +** +** Comparisons with older movement optimizers: +** SVr3 curses mvcur() can't use cursor_to_ll or auto_left_margin. +** 4.4BSD curses can't use cuu/cud/cuf/cub/hpa/vpa/tab/cbt for local +** motions. It doesn't use tactics based on auto_left_margin. Weirdly +** enough, it doesn't use its own hardware-scrolling routine to scroll up +** destination lines for out-of-bounds addresses! +** old ncurses optimizer: less accurate cost computations (in fact, +** it was broken and had to be commented out!). +** +** Compile with -DMAIN to build an interactive tester/timer for the movement +** optimizer. You can use it to investigate the optimizer's behavior. +** You can also use it for tuning the formulas used to determine whether +** or not full optimization is attempted. +** +** This code has a nasty tendency to find bugs in terminfo entries, because it +** exercises the non-cup movement capabilities heavily. If you think you've +** found a bug, try deleting subsets of the following capabilities (arranged +** in decreasing order of suspiciousness): it, tab, cbt, hpa, vpa, cuu, cud, +** cuf, cub, cuu1, cud1, cuf1, cub1. It may be that one or more are wrong. +** +** Note: you should expect this code to look like a resource hog in a profile. +** That's because it does a lot of I/O, through the tputs() calls. The I/O +** cost swamps the computation overhead (and as machines get faster, this +** will become even more true). Comments in the test exerciser at the end +** go into detail about tuning and how you can gauge the optimizer's +** effectiveness. +**/ + +/**************************************************************************** + * + * Constants and macros for optimizer tuning. + * + ****************************************************************************/ + +/* + * The average overhead of a full optimization computation in character + * transmission times. If it's too high, the algorithm will be a bit + * over-biased toward using cup rather than local motions; if it's too + * low, the algorithm may spend more time than is strictly optimal + * looking for non-cup motions. Profile the optimizer using the `t' + * command of the exerciser (see below), and round to the nearest integer. + * + * Yes, I (esr) thought about computing expected overhead dynamically, say + * by derivation from a running average of optimizer times. But the + * whole point of this optimization is to *decrease* the frequency of + * system calls. :-) + */ +#define COMPUTE_OVERHEAD 1 /* I use a 90MHz Pentium @ 9.6Kbps */ + +/* + * LONG_DIST is the distance we consider to be just as costly to move over as a + * cup sequence is to emit. In other words, it's the length of a cup sequence + * adjusted for average computation overhead. The magic number is the length + * of "\033[yy;xxH", the typical cup sequence these days. + */ +#define LONG_DIST (8 - COMPUTE_OVERHEAD) + +/* + * Tell whether a motion is optimizable by local motions. Needs to be cheap to + * compute. In general, all the fast moves go to either the right or left edge + * of the screen. So any motion to a location that is (a) further away than + * LONG_DIST and (b) further inward from the right or left edge than LONG_DIST, + * we'll consider nonlocal. + */ +#define NOT_LOCAL(fy, fx, ty, tx) ((tx > LONG_DIST) && (tx < screen_lines - 1 - LONG_DIST) && (abs(ty-fy) + abs(tx-fx) > LONG_DIST)) + +/**************************************************************************** + * + * External interfaces + * + ****************************************************************************/ + +/* + * For this code to work OK, the following components must live in the + * screen structure: + * + * int _char_padding; // cost of character put + * int _cr_cost; // cost of (carriage_return) + * int _cup_cost; // cost of (cursor_address) + * int _home_cost; // cost of (cursor_home) + * int _ll_cost; // cost of (cursor_to_ll) + *#ifdef TABS_OK + * int _ht_cost; // cost of (tab) + * int _cbt_cost; // cost of (backtab) + *#endif TABS_OK + * int _cub1_cost; // cost of (cursor_left) + * int _cuf1_cost; // cost of (cursor_right) + * int _cud1_cost; // cost of (cursor_down) + * int _cuu1_cost; // cost of (cursor_up) + * int _cub_cost; // cost of (parm_cursor_left) + * int _cuf_cost; // cost of (parm_cursor_right) + * int _cud_cost; // cost of (parm_cursor_down) + * int _cuu_cost; // cost of (parm_cursor_up) + * int _hpa_cost; // cost of (column_address) + * int _vpa_cost; // cost of (row_address) + * int _ech_cost; // cost of (erase_chars) + * int _rep_cost; // cost of (repeat_char) + * + * The TABS_OK switch controls whether it is reliable to use tab/backtabs + * for local motions. On many systems, it's not, due to uncertainties about + * tab delays and whether or not tabs will be expanded in raw mode. If you + * have parm_right_cursor, tab motions don't win you a lot anyhow. + */ + +#include +#include +#include + +MODULE_ID("$Id: lib_mvcur.c,v 1.37 1997/05/03 22:15:26 Peter.Wemm Exp $") + +#define STRLEN(s) (s != 0) ? strlen(s) : 0 + +#define CURRENT_ATTR SP->_current_attr /* current phys attribute */ +#define CURRENT_ROW SP->_cursrow /* phys cursor row */ +#define CURRENT_COLUMN SP->_curscol /* phys cursor column */ +#define REAL_ATTR SP->_current_attr /* phys current attribute */ +#define WANT_CHAR(y, x) SP->_newscr->_line[y].text[x] /* desired state */ +#define BAUDRATE SP->_baudrate /* bits per second */ + +#ifdef MAIN +#include + +static bool profiling = FALSE; +static float diff; +#endif /* MAIN */ + +#define OPT_SIZE 512 + +static void save_curs(void); +static void restore_curs(void); +static int cost_of(const char *const cap, int affcnt); +static int normalized_cost(const char *const cap, int affcnt); + +/**************************************************************************** + * + * Initialization/wrapup (including cost pre-computation) + * + ****************************************************************************/ + +#ifdef TRACE +static int +trace_cost_of(const char *capname, const char *cap, int affcnt) +{ + int result = cost_of(cap,affcnt); + TR(TRACE_CHARPUT|TRACE_MOVE, ("CostOf %s %d", capname, result)); + return result; +} +#define CostOf(cap,affcnt) trace_cost_of(#cap,cap,affcnt); + +static int +trace_normalized_cost(const char *capname, const char *cap, int affcnt) +{ + int result = normalized_cost(cap,affcnt); + TR(TRACE_CHARPUT|TRACE_MOVE, ("NormalizedCost %s %d", capname, result)); + return result; +} +#define NormalizedCost(cap,affcnt) trace_normalized_cost(#cap,cap,affcnt); + +#else + +#define CostOf(cap,affcnt) cost_of(cap,affcnt); +#define NormalizedCost(cap,affcnt) normalized_cost(cap,affcnt); + +#endif + +static int cost_of(const char *const cap, int affcnt) +/* compute the cost of a given operation */ +{ + if (cap == 0) + return(INFINITY); + else + { + const char *cp; + float cum_cost = 0; + + for (cp = cap; *cp; cp++) + { + /* extract padding, either mandatory or required */ + if (cp[0] == '$' && cp[1] == '<' && strchr(cp, '>')) + { + float number = 0; + + for (cp += 2; *cp != '>'; cp++) + { + if (isdigit(*cp)) + number = number * 10 + (*cp - '0'); + else if (*cp == '.') + number += (*++cp - 10) / 10.0; + else if (*cp == '*') + number *= affcnt; + } + + cum_cost += number * 10; + } + else + cum_cost += SP->_char_padding; + } + + return((int)cum_cost); + } +} + +static int normalized_cost(const char *const cap, int affcnt) +/* compute the effective character-count for an operation (round up) */ +{ + int cost = cost_of(cap, affcnt); + if (cost != INFINITY) + cost = (cost + SP->_char_padding - 1) / SP->_char_padding; + return cost; +} + +static void reset_scroll_region(void) +/* Set the scroll-region to a known state (the default) */ +{ + if (change_scroll_region) + { + /* change_scroll_region may trash the cursor location */ + save_curs(); + TPUTS_TRACE("change_scroll_region"); + putp(tparm(change_scroll_region, 0, screen_lines - 1)); + restore_curs(); + } +} + +void _nc_mvcur_resume(void) +/* what to do at initialization time and after each shellout */ +{ + /* initialize screen for cursor access */ + if (enter_ca_mode) + { + TPUTS_TRACE("enter_ca_mode"); + putp(enter_ca_mode); + } + + /* + * Doing this here rather than in _nc_mvcur_wrap() ensures that + * ncurses programs will see a reset scroll region even if a + * program that messed with it died ungracefully. + * + * This also undoes the effects of terminal init strings that assume + * they know the screen size. This is useful when you're running + * a vt100 emulation through xterm. + */ + reset_scroll_region(); +} + +void _nc_mvcur_init(void) +/* initialize the cost structure */ +{ + /* + * 9 = 7 bits + 1 parity + 1 stop. + */ + SP->_char_padding = (9 * 1000 * 10) / (BAUDRATE > 0 ? BAUDRATE : 9600); + if (SP->_char_padding <= 0) + SP->_char_padding = 1; /* must be nonzero */ + TR(TRACE_CHARPUT|TRACE_MOVE, ("char_padding %d msecs", SP->_char_padding)); + + /* non-parameterized local-motion strings */ + SP->_cr_cost = CostOf(carriage_return, 0); + SP->_home_cost = CostOf(cursor_home, 0); + SP->_ll_cost = CostOf(cursor_to_ll, 0); +#ifdef TABS_OK + SP->_ht_cost = CostOf(tab, 0); + SP->_cbt_cost = CostOf(back_tab, 0); +#endif /* TABS_OK */ + SP->_cub1_cost = CostOf(cursor_left, 0); + SP->_cuf1_cost = CostOf(cursor_right, 0); + SP->_cud1_cost = CostOf(cursor_down, 0); + SP->_cuu1_cost = CostOf(cursor_up, 0); + + /* + * Assumption: if the terminal has memory_relative addressing, the + * initialization strings or smcup will set single-page mode so we + * can treat it like absolute screen addressing. This seems to be true + * for all cursor_mem_address terminal types in the terminfo database. + */ + SP->_address_cursor = cursor_address ? cursor_address : cursor_mem_address; + + /* + * Parametrized local-motion strings. This static cost computation + * depends on the following assumptions: + * + * (1) They never have * padding. In the entire master terminfo database + * as of March 1995, only the obsolete Zenith Z-100 pc violates this. + * (Proportional padding is found mainly in insert, delete and scroll + * capabilities). + * + * (2) The average case of cup has two two-digit parameters. Strictly, + * the average case for a 24 * 80 screen has ((10*10*(1 + 1)) + + * (14*10*(1 + 2)) + (10*70*(2 + 1)) + (14*70*4)) / (24*80) = 3.458 + * digits of parameters. On a 25x80 screen the average is 3.6197. + * On larger screens the value gets much closer to 4. + * + * (3) The average case of cub/cuf/hpa/ech/rep has 2 digits of parameters + * (strictly, (((10 * 1) + (70 * 2)) / 80) = 1.8750). + * + * (4) The average case of cud/cuu/vpa has 2 digits of parameters + * (strictly, (((10 * 1) + (14 * 2)) / 24) = 1.5833). + * + * All these averages depend on the assumption that all parameter values + * are equally probable. + */ + SP->_cup_cost = CostOf(tparm(SP->_address_cursor, 23, 23), 1); + SP->_cub_cost = CostOf(tparm(parm_left_cursor, 23), 1); + SP->_cuf_cost = CostOf(tparm(parm_right_cursor, 23), 1); + SP->_cud_cost = CostOf(tparm(parm_down_cursor, 23), 1); + SP->_cuu_cost = CostOf(tparm(parm_up_cursor, 23), 1); + SP->_hpa_cost = CostOf(tparm(column_address, 23), 1); + SP->_vpa_cost = CostOf(tparm(row_address, 23), 1); + + /* non-parameterized screen-update strings */ + SP->_ed_cost = NormalizedCost(clr_eos, 1); + SP->_el_cost = NormalizedCost(clr_eol, 1); + SP->_el1_cost = NormalizedCost(clr_bol, 1); + SP->_dch1_cost = NormalizedCost(delete_character, 1); + SP->_ich1_cost = NormalizedCost(insert_character, 1); + + /* parameterized screen-update strings */ + SP->_dch_cost = NormalizedCost(tparm(parm_dch, 23), 1); + SP->_ich_cost = NormalizedCost(tparm(parm_ich, 23), 1); + SP->_ech_cost = NormalizedCost(tparm(erase_chars, 23), 1); + SP->_rep_cost = NormalizedCost(tparm(repeat_char, ' ', 23), 1); + + SP->_cup_ch_cost = NormalizedCost(tparm(SP->_address_cursor, 23, 23), 1); + SP->_hpa_ch_cost = NormalizedCost(tparm(column_address, 23), 1); + + /* pre-compute some capability lengths */ + SP->_carriage_return_length = STRLEN(carriage_return); + SP->_cursor_home_length = STRLEN(cursor_home); + SP->_cursor_to_ll_length = STRLEN(cursor_to_ll); + + /* + * A different, possibly better way to arrange this would be to set + * SP->_endwin = TRUE at window initialization time and let this be + * called by doupdate's return-from-shellout code. + */ + _nc_mvcur_resume(); +} + +void _nc_mvcur_wrap(void) +/* wrap up cursor-addressing mode */ +{ + reset_scroll_region(); + if (exit_ca_mode) + { + TPUTS_TRACE("exit_ca_mode"); + putp(exit_ca_mode); + } +} + +/**************************************************************************** + * + * Optimized cursor movement + * + ****************************************************************************/ + +/* + * Perform repeated-append, returning cost + */ +static inline int +repeated_append (int total, int num, int repeat, char *dst, const char *src) +{ + register size_t src_len = strlen(src); + register size_t dst_len = STRLEN(dst); + + if ((dst_len + repeat * src_len) < OPT_SIZE-1) { + total += (num * repeat); + if (dst) { + dst += dst_len; + while (repeat-- > 0) { + (void) strcpy(dst, src); + dst += src_len; + } + } + } else { + total = INFINITY; + } + return total; +} + +#ifndef NO_OPTIMIZE +#define NEXTTAB(fr) (fr + init_tabs - (fr % init_tabs)) +#define LASTTAB(fr) (fr - init_tabs + (fr % init_tabs)) + +/* Note: we'd like to inline this for speed, but GNU C barfs on the attempt. */ + +static int +relative_move(char *result, int from_y,int from_x,int to_y,int to_x, bool ovw) +/* move via local motions (cuu/cuu1/cud/cud1/cub1/cub/cuf1/cuf/vpa/hpa) */ +{ + int n, vcost = 0, hcost = 0; + + if (result) + result[0] = '\0'; + + if (to_y != from_y) + { + vcost = INFINITY; + + if (row_address) + { + if (result) + (void) strcpy(result, tparm(row_address, to_y)); + vcost = SP->_vpa_cost; + } + + if (to_y > from_y) + { + n = (to_y - from_y); + + if (parm_down_cursor && SP->_cud_cost < vcost) + { + if (result) + (void) strcpy(result, tparm(parm_down_cursor, n)); + vcost = SP->_cud_cost; + } + + if (cursor_down && (n * SP->_cud1_cost < vcost)) + { + if (result) + result[0] = '\0'; + vcost = repeated_append(vcost, SP->_cud1_cost, n, result, cursor_down); + } + } + else /* (to_y < from_y) */ + { + n = (from_y - to_y); + + if (parm_up_cursor && SP->_cup_cost < vcost) + { + if (result) + (void) strcpy(result, tparm(parm_up_cursor, n)); + vcost = SP->_cup_cost; + } + + if (cursor_up && (n * SP->_cuu1_cost < vcost)) + { + if (result) + result[0] = '\0'; + vcost = repeated_append(vcost, SP->_cuu1_cost, n, result, cursor_up); + } + } + + if (vcost == INFINITY) + return(INFINITY); + } + + if (result) + result += strlen(result); + + if (to_x != from_x) + { + char try[OPT_SIZE]; + + hcost = INFINITY; + + if (column_address) + { + if (result) + (void) strcpy(result, tparm(column_address, to_x)); + hcost = SP->_hpa_cost; + } + + if (to_x > from_x) + { + n = to_x - from_x; + + if (parm_right_cursor && SP->_cuf_cost < hcost) + { + if (result) + (void) strcpy(result, tparm(parm_right_cursor, n)); + hcost = SP->_cuf_cost; + } + + if (cursor_right) + { + int lhcost = 0; + + try[0] = '\0'; + +#ifdef TABS_OK + /* use hard tabs, if we have them, to do as much as possible */ + if (init_tabs > 0 && tab) + { + int nxt, fr; + + for (fr = from_x; (nxt = NEXTTAB(fr)) <= to_x; fr = nxt) + { + lhcost = repeated_append(lhcost, SP->_ht_cost, 1, try, tab); + if (lhcost == INFINITY) + break; + } + + n = to_x - fr; + from_x = fr; + } +#endif /* TABS_OK */ + +#if defined(REAL_ATTR) && defined(WANT_CHAR) + /* + * If we have no attribute changes, overwrite is cheaper. + * Note: must suppress this by passing in ovw = FALSE whenever + * WANT_CHAR would return invalid data. In particular, this + * is true between the time a hardware scroll has been done + * and the time the structure WANT_CHAR would access has been + * updated. + */ + if (ovw) + { + int i; + + for (i = 0; i < n; i++) + if ((WANT_CHAR(to_y, from_x + i) & A_ATTRIBUTES) != CURRENT_ATTR) + { + ovw = FALSE; + break; + } + } + if (ovw) + { + char *sp; + int i; + + sp = try + strlen(try); + + for (i = 0; i < n; i++) + *sp++ = WANT_CHAR(to_y, from_x + i); + *sp = '\0'; + lhcost += n * SP->_char_padding; + } + else +#endif /* defined(REAL_ATTR) && defined(WANT_CHAR) */ + { + lhcost = repeated_append(lhcost, SP->_cuf1_cost, n, try, cursor_right); + } + + if (lhcost < hcost) + { + if (result) + (void) strcpy(result, try); + hcost = lhcost; + } + } + } + else /* (to_x < from_x) */ + { + n = from_x - to_x; + + if (parm_left_cursor && SP->_cub_cost < hcost) + { + if (result) + (void) strcpy(result, tparm(parm_left_cursor, n)); + hcost = SP->_cub_cost; + } + + if (cursor_left) + { + int lhcost = 0; + + try[0] = '\0'; + +#ifdef TABS_OK + if (init_tabs > 0 && back_tab) + { + int nxt, fr; + + for (fr = from_x; (nxt = LASTTAB(fr)) >= to_x; fr = nxt) + { + lhcost = repeated_append(lhcost, SP->_cbt_cost, 1, try, back_tab); + if (lhcost == INFINITY) + break; + } + + n = to_x - fr; + } +#endif /* TABS_OK */ + + lhcost = repeated_append(lhcost, SP->_cub1_cost, n, try, cursor_left); + + if (lhcost < hcost) + { + if (result) + (void) strcpy(result, try); + hcost = lhcost; + } + } + } + + if (hcost == INFINITY) + return(INFINITY); + } + + return(vcost + hcost); +} +#endif /* !NO_OPTIMIZE */ + +/* + * With the machinery set up above, it's conceivable that + * onscreen_mvcur could be modified into a recursive function that does + * an alpha-beta search of motion space, as though it were a chess + * move tree, with the weight function being boolean and the search + * depth equated to length of string. However, this would jack up the + * computation cost a lot, especially on terminals without a cup + * capability constraining the search tree depth. So we settle for + * the simpler method below. + */ + +static inline int +onscreen_mvcur(int yold,int xold,int ynew,int xnew, bool ovw) +/* onscreen move from (yold, xold) to (ynew, xnew) */ +{ + char use[OPT_SIZE], *sp; + int tactic = 0, newcost, usecost = INFINITY; + +#ifdef MAIN + struct timeval before, after; + + gettimeofday(&before, NULL); +#endif /* MAIN */ + + /* tactic #0: use direct cursor addressing */ + sp = tparm(SP->_address_cursor, ynew, xnew); + if (sp) + { + tactic = 0; + (void) strcpy(use, sp); + usecost = SP->_cup_cost; + +#if defined(TRACE) || defined(NCURSES_TEST) + if (!(_nc_optimize_enable & OPTIMIZE_MVCUR)) + goto nonlocal; +#endif /* TRACE */ + + /* + * We may be able to tell in advance that the full optimization + * will probably not be worth its overhead. Also, don't try to + * use local movement if the current attribute is anything but + * A_NORMAL...there are just too many ways this can screw up + * (like, say, local-movement \n getting mapped to some obscure + * character because A_ALTCHARSET is on). + */ + if (yold == -1 || xold == -1 || + REAL_ATTR != A_NORMAL || NOT_LOCAL(yold, xold, ynew, xnew)) + { +#ifdef MAIN + if (!profiling) + { + (void) fputs("nonlocal\n", stderr); + goto nonlocal; /* always run the optimizer if profiling */ + } +#else + goto nonlocal; +#endif /* MAIN */ + } + } + +#ifndef NO_OPTIMIZE + /* tactic #1: use local movement */ + if (yold != -1 && xold != -1 + && ((newcost=relative_move(NULL, yold, xold, ynew, xnew, ovw))!=INFINITY) + && newcost < usecost) + { + tactic = 1; + usecost = newcost; + } + + /* tactic #2: use carriage-return + local movement */ + if (yold < screen_lines - 1 && xold < screen_columns - 1) + { + if (carriage_return + && ((newcost=relative_move(NULL, yold,0,ynew,xnew, ovw)) != INFINITY) + && SP->_cr_cost + newcost < usecost) + { + tactic = 2; + usecost = SP->_cr_cost + newcost; + } + } + + /* tactic #3: use home-cursor + local movement */ + if (cursor_home + && ((newcost=relative_move(NULL, 0, 0, ynew, xnew, ovw)) != INFINITY) + && SP->_home_cost + newcost < usecost) + { + tactic = 3; + usecost = SP->_home_cost + newcost; + } + + /* tactic #4: use home-down + local movement */ + if (cursor_to_ll + && ((newcost=relative_move(NULL, screen_lines-1, 0, ynew, xnew, ovw)) != INFINITY) + && SP->_ll_cost + newcost < usecost) + { + tactic = 4; + usecost = SP->_ll_cost + newcost; + } + + /* + * tactic #5: use left margin for wrap to right-hand side, + * unless strange wrap behavior indicated by xenl might hose us. + */ + if (auto_left_margin && !eat_newline_glitch + && yold > 0 && yold < screen_lines - 1 && cursor_left + && ((newcost=relative_move(NULL, yold-1, screen_columns-1, ynew, xnew, ovw)) != INFINITY) + && SP->_cr_cost + SP->_cub1_cost + newcost + newcost < usecost) + { + tactic = 5; + usecost = SP->_cr_cost + SP->_cub1_cost + newcost; + } + + /* + * These cases are ordered by estimated relative frequency. + */ + if (tactic) + { + if (tactic == 1) + (void) relative_move(use, yold, xold, ynew, xnew, ovw); + else if (tactic == 2) + { + (void) strcpy(use, carriage_return); + (void) relative_move(use + SP->_carriage_return_length, + yold,0,ynew,xnew, ovw); + } + else if (tactic == 3) + { + (void) strcpy(use, cursor_home); + (void) relative_move(use + SP->_cursor_home_length, + 0, 0, ynew, xnew, ovw); + } + else if (tactic == 4) + { + (void) strcpy(use, cursor_to_ll); + (void) relative_move(use + SP->_cursor_to_ll_length, + screen_lines-1, 0, ynew, xnew, ovw); + } + else /* if (tactic == 5) */ + { + use[0] = '\0'; + if (xold > 0) + (void) strcat(use, carriage_return); + (void) strcat(use, cursor_left); + (void) relative_move(use + strlen(use), + yold-1, screen_columns-1, ynew, xnew, ovw); + } + } +#endif /* !NO_OPTIMIZE */ + +#ifdef MAIN + gettimeofday(&after, NULL); + diff = after.tv_usec - before.tv_usec + + (after.tv_sec - before.tv_sec) * 1000000; + if (!profiling) + (void) fprintf(stderr, "onscreen: %d msec, %f 28.8Kbps char-equivalents\n", + (int)diff, diff/288); +#endif /* MAIN */ + + nonlocal: + if (usecost != INFINITY) + { + TPUTS_TRACE("mvcur"); + tputs(use, 1, _nc_outch); + return(OK); + } + else + return(ERR); +} + +int mvcur(int yold, int xold, int ynew, int xnew) +/* optimized cursor move from (yold, xold) to (ynew, xnew) */ +{ + TR(TRACE_MOVE, ("mvcur(%d,%d,%d,%d) called", yold, xold, ynew, xnew)); + + if (yold == ynew && xold == xnew) + return(OK); + + /* + * Most work here is rounding for terminal boundaries getting the + * column position implied by wraparound or the lack thereof and + * rolling up the screen to get ynew on the screen. + */ + + if (xnew >= screen_columns) + { + ynew += xnew / screen_columns; + xnew %= screen_columns; + } + if (xold >= screen_columns) + { + int l; + + l = (xold + 1) / screen_columns; + yold += l; + if (yold >= screen_lines) + l -= (yold - screen_lines - 1); + + while (l > 0) { + if (newline) + { + TPUTS_TRACE("newline"); + tputs(newline, 0, _nc_outch); + } + else + putchar('\n'); + l--; + if (xold > 0) + { + if (carriage_return) + { + TPUTS_TRACE("carriage_return"); + tputs(carriage_return, 0, _nc_outch); + } + else + putchar('\r'); + xold = 0; + } + } + } + + if (yold > screen_lines - 1) + yold = screen_lines - 1; + if (ynew > screen_lines - 1) + ynew = screen_lines - 1; + + /* destination location is on screen now */ + return(onscreen_mvcur(yold, xold, ynew, xnew, TRUE)); +} + + +/**************************************************************************** + * + * Cursor save_restore + * + ****************************************************************************/ + +/* assumption: sc/rc is faster than cursor addressing */ + +static int oy, ox; /* ugh, mvcur_scrolln() needs to see this */ + +static void save_curs(void) +{ + if (save_cursor && restore_cursor) + { + TPUTS_TRACE("save_cursor"); + putp(save_cursor); + } + + oy = CURRENT_ROW; + ox = CURRENT_COLUMN; +} + +static void restore_curs(void) +{ + if (save_cursor && restore_cursor) + { + TPUTS_TRACE("restore_cursor"); + putp(restore_cursor); + } + else + onscreen_mvcur(-1, -1, oy, ox, FALSE); +} + +/**************************************************************************** + * + * Physical-scrolling support + * + ****************************************************************************/ + +static int DoTheScrolling(int n, int top, int bot, int maxy) +/* scroll region from top to bot by n lines */ +{ + int i; + + /* + * This code was adapted from Keith Bostic's hardware scrolling + * support for 4.4BSD curses. I (esr) translated it to use terminfo + * capabilities, narrowed the call interface slightly, and cleaned + * up some convoluted tests. I also added support for the memory_above + * memory_below, and non_dest_scroll_region capabilities. + * + * For this code to work, we must have either + * change_scroll_region and scroll forward/reverse commands, or + * insert and delete line capabilities. + * When the scrolling region has been set, the cursor has to + * be at the last line of the region to make the scroll + * happen. + * + * This code makes one aesthetic decision in the opposite way from + * BSD curses. BSD curses preferred pairs of il/dl operations + * over scrolls, allegedly because il/dl looked faster. We, on + * the other hand, prefer scrolls because (a) they're just as fast + * on many terminals and (b) using them avoids bouncing an + * unchanged bottom section of the screen up and down, which is + * visually nasty. + */ + if (n > 0) + { + /* + * Explicitly clear if stuff pushed off top of region might + * be saved by the terminal. + */ + if (non_dest_scroll_region || (memory_above && top == 0)) { + for (i = 0; i < n; i++) + { + mvcur(-1, -1, i, 0); + TPUTS_TRACE("clr_eol"); + tputs(clr_eol, n, _nc_outch); + } + } + + if (change_scroll_region && (scroll_forward || parm_index)) + { + TPUTS_TRACE("change_scroll_region"); + tputs(tparm(change_scroll_region, top, bot), 0, _nc_outch); + + onscreen_mvcur(-1, -1, bot, 0, TRUE); + + if (parm_index != NULL) + { + TPUTS_TRACE("parm_index"); + tputs(tparm(parm_index, n, 0), n, _nc_outch); + } + else + { + for (i = 0; i < n; i++) + { + TPUTS_TRACE("scroll_forward"); + tputs(scroll_forward, 0, _nc_outch); + } + } + TPUTS_TRACE("change_scroll_region"); + tputs(tparm(change_scroll_region, 0, maxy), 0, _nc_outch); + } + else if (parm_index && top == 0 && bot == maxy) + { + onscreen_mvcur(oy, ox, bot, 0, TRUE); + TPUTS_TRACE("parm_index"); + tputs(tparm(parm_index, n, 0), n, _nc_outch); + } + else if (scroll_forward && top == 0 && bot == maxy) + { + onscreen_mvcur(oy, ox, bot, 0, TRUE); + for (i = 0; i < n; i++) + { + TPUTS_TRACE("scroll_forward"); + tputs(scroll_forward, 0, _nc_outch); + } + } + else if (_nc_idlok + && (parm_delete_line || delete_line) + && (parm_insert_line || insert_line)) + { + onscreen_mvcur(oy, ox, top, 0, TRUE); + + if (parm_delete_line) + { + TPUTS_TRACE("parm_delete_line"); + tputs(tparm(parm_delete_line, n, 0), n, _nc_outch); + } + else + { + for (i = 0; i < n; i++) + { + TPUTS_TRACE("parm_index"); + tputs(delete_line, 0, _nc_outch); + } + } + + onscreen_mvcur(top, 0, bot - n + 1, 0, FALSE); + + /* Push down the bottom region. */ + if (parm_insert_line) + { + TPUTS_TRACE("parm_insert_line"); + tputs(tparm(parm_insert_line, n, 0), n, _nc_outch); + } + else + { + for (i = 0; i < n; i++) + { + TPUTS_TRACE("insert_line"); + tputs(insert_line, 0, _nc_outch); + } + } + } + else + return(ERR); + } + else /* (n < 0) */ + { + /* + * Do explicit clear to end of region if it's possible that the + * terminal might hold on to stuff we push off the end. + */ + if (non_dest_scroll_region || (memory_below && bot == maxy)) + { + if (bot == maxy && clr_eos) + { + mvcur(-1, -1, lines + n, 0); + TPUTS_TRACE("clr_eos"); + tputs(clr_eos, n, _nc_outch); + } + else if (clr_eol) + { + for (i = 0; i < -n; i++) + { + mvcur(-1, -1, lines + n + i, 0); + TPUTS_TRACE("clr_eol"); + tputs(clr_eol, n, _nc_outch); + } + } + } + + if (change_scroll_region && (scroll_reverse || parm_rindex)) + { + TPUTS_TRACE("change_scroll_region"); + tputs(tparm(change_scroll_region, top, bot), 0, _nc_outch); + + onscreen_mvcur(-1, -1, top, 0, TRUE); + + if (parm_rindex) + { + TPUTS_TRACE("parm_rindex"); + tputs(tparm(parm_rindex, -n, 0), -n, _nc_outch); + } + else + { + for (i = n; i < 0; i++) + { + TPUTS_TRACE("scroll_reverse"); + tputs(scroll_reverse, 0, _nc_outch); + } + } + TPUTS_TRACE("change_scroll_region"); + tputs(tparm(change_scroll_region, 0, maxy), 0, _nc_outch); + } + else if (parm_rindex && top == 0 && bot == maxy) + { + onscreen_mvcur(oy, ox, bot + n + 1, 0, TRUE); + + TPUTS_TRACE("parm_rindex"); + tputs(tparm(parm_rindex, -n, 0), -n, _nc_outch); + } + else if (scroll_reverse && top == 0 && bot == maxy) + { + onscreen_mvcur(-1, -1, 0, 0, TRUE); + for (i = n; i < 0; i++) + { + TPUTS_TRACE("scroll_reverse"); + tputs(scroll_reverse, 0, _nc_outch); + } + } + else if (_nc_idlok + && (parm_delete_line || delete_line) + && (parm_insert_line || insert_line)) + { + onscreen_mvcur(oy, ox, bot + n + 1, 0, TRUE); + + if (parm_delete_line) + { + TPUTS_TRACE("parm_delete_line"); + tputs(tparm(parm_delete_line, -n, 0), -n, _nc_outch); + } + else + { + for (i = n; i < 0; i++) + { + TPUTS_TRACE("delete_line"); + tputs(delete_line, 0, _nc_outch); + } + } + + onscreen_mvcur(bot + n + 1, 0, top, 0, FALSE); + + /* Scroll the block down. */ + if (parm_insert_line) + { + TPUTS_TRACE("parm_insert_line"); + tputs(tparm(parm_insert_line, -n, 0), -n, _nc_outch); + } + else + { + for (i = n; i < 0; i++) + { + TPUTS_TRACE("insert_line"); + tputs(insert_line, 0, _nc_outch); + } + } + } + else + return(ERR); + } + + return(OK); +} + +int _nc_mvcur_scrolln(int n, int top, int bot, int maxy) +/* scroll region from top to bot by n lines */ +{ + int code; + + TR(TRACE_MOVE, ("mvcur_scrolln(%d, %d, %d, %d)", n, top, bot, maxy)); + + save_curs(); + code = DoTheScrolling(n, top, bot, maxy); + restore_curs(); + return(code); +} + +#ifdef MAIN +/**************************************************************************** + * + * Movement optimizer test code + * + ****************************************************************************/ + +#include +#include + +char *_nc_progname = "mvcur"; + +static unsigned long xmits; + +int tputs(const char *string, int affcnt, int (*outc)(int)) +/* stub tputs() that dumps sequences in a visible form */ +{ + if (profiling) + xmits += strlen(string); + else + (void) fputs(_nc_visbuf(string), stdout); + return(OK); +} + +int putp(const char *string) +{ + return(tputs(string, 1, _nc_outch)); +} + +int _nc_outch(int ch) +{ + putc(ch, stdout); + return OK; +} + +static char tname[BUFSIZ]; + +static void load_term(void) +{ + (void) setupterm(tname, STDOUT_FILENO, NULL); +} + +static int roll(int n) +{ + int i, j; + + i = (RAND_MAX / n) * n; + while ((j = rand()) >= i) + continue; + return (j % n); +} + +int main(int argc, char *argv[]) +{ + (void) strcpy(tname, getenv("TERM")); + load_term(); + _nc_setupscreen(lines, columns, stdout); + baudrate(); + + _nc_mvcur_init(); +#if HAVE_SETVBUF || HAVE_SETBUFFER + /* + * Undo the effects of our optimization hack, otherwise our interactive + * prompts don't flush properly. + */ +#if HAVE_SETVBUF + (void) setvbuf(SP->_ofp, malloc(BUFSIZ), _IOLBF, BUFSIZ); +#elif HAVE_SETBUFFER + (void) setbuffer(SP->_ofp, malloc(BUFSIZ), BUFSIZ); +#endif +#endif /* HAVE_SETVBUF || HAVE_SETBUFFER */ + + (void) puts("The mvcur tester. Type ? for help"); + + fputs("smcup:", stdout); + putchar('\n'); + + for (;;) + { + int fy, fx, ty, tx, n, i; + char buf[BUFSIZ], capname[BUFSIZ]; + + (void) fputs("> ", stdout); + (void) fgets(buf, sizeof(buf), stdin); + + if (buf[0] == '?') + { +(void) puts("? -- display this help message"); +(void) puts("fy fx ty tx -- (4 numbers) display (fy,fx)->(ty,tx) move"); +(void) puts("s[croll] n t b m -- display scrolling sequence"); +(void) printf("r[eload] -- reload terminal info for %s\n", + getenv("TERM")); +(void) puts("l[oad] -- load terminal info for type "); +(void) puts("d[elete] -- delete named capability"); +(void) puts("i[nspect] -- display terminal capabilities"); +(void) puts("c[ost] -- dump cursor-optimization cost table"); +(void) puts("o[optimize] -- toggle movement optimization"); +(void) puts("t[orture] -- torture-test with random moves"); +(void) puts("q[uit] -- quit the program"); + } + else if (sscanf(buf, "%d %d %d %d", &fy, &fx, &ty, &tx) == 4) + { + struct timeval before, after; + + putchar('"'); + + gettimeofday(&before, NULL); + mvcur(fy, fx, ty, tx); + gettimeofday(&after, NULL); + + printf("\" (%ld msec)\n", + after.tv_usec - before.tv_usec + (after.tv_sec - before.tv_sec) * 1000000); + } + else if (sscanf(buf, "s %d %d %d %d", &fy, &fx, &ty, &tx) == 4) + { + struct timeval before, after; + + putchar('"'); + + gettimeofday(&before, NULL); + _nc_mvcur_scrolln(fy, fx, ty, tx); + gettimeofday(&after, NULL); + + printf("\" (%ld msec)\n", + after.tv_usec - before.tv_usec + (after.tv_sec - before.tv_sec) * 1000000); + } + else if (buf[0] == 'r') + { + (void) strcpy(tname, getenv("TERM")); + load_term(); + } + else if (sscanf(buf, "l %s", tname) == 1) + { + load_term(); + } + else if (sscanf(buf, "d %s", capname) == 1) + { + struct name_table_entry const *np = _nc_find_entry(capname, + _nc_info_hash_table); + + if (np == NULL) + (void) printf("No such capability as \"%s\"\n", capname); + else + { + switch(np->nte_type) + { + case BOOLEAN: + cur_term->type.Booleans[np->nte_index] = FALSE; + (void) printf("Boolean capability `%s' (%d) turned off.\n", + np->nte_name, np->nte_index); + break; + + case NUMBER: + cur_term->type.Numbers[np->nte_index] = -1; + (void) printf("Number capability `%s' (%d) set to -1.\n", + np->nte_name, np->nte_index); + break; + + case STRING: + cur_term->type.Strings[np->nte_index] = (char *)NULL; + (void) printf("String capability `%s' (%d) deleted.\n", + np->nte_name, np->nte_index); + break; + } + } + } + else if (buf[0] == 'i') + { + dump_init((char *)NULL, F_TERMINFO, S_TERMINFO, 70, 0); + dump_entry(&cur_term->type, NULL); + putchar('\n'); + } + else if (buf[0] == 'o') + { + if (_nc_optime_enable & OPTIMIZE_MVCUR) + { + _nc_optimize_enable &=~ OPTIMIZE_MVCUR; + (void) puts("Optimization is now off."); + } + else + { + _nc_optimize_enable |= OPTIMIZE_MVCUR; + (void) puts("Optimization is now on."); + } + } + /* + * You can use the `t' test to profile and tune the movement + * optimizer. Use iteration values in three digits or more. + * At above 5000 iterations the profile timing averages are stable + * to within a millisecond or three. + * + * The `overhead' field of the report will help you pick a + * COMPUTE_OVERHEAD figure appropriate for your processor and + * expected line speed. The `total estimated time' is + * computation time plus a character-transmission time + * estimate computed from the number of transmits and the baud + * rate. + * + * Use this together with the `o' command to get a read on the + * optimizer's effectiveness. Compare the total estimated times + * for `t' runs of the same length in both optimized and un-optimized + * modes. As long as the optimized times are less, the optimizer + * is winning. + */ + else if (sscanf(buf, "t %d", &n) == 1) + { + float cumtime = 0, perchar; + int speeds[] = {2400, 9600, 14400, 19200, 28800, 38400, 0}; + + srand((unsigned)(getpid() + time((time_t *)0))); + profiling = TRUE; + xmits = 0; + for (i = 0; i < n; i++) + { + /* + * This does a move test between two random locations, + * Random moves probably short-change the optimizer, + * which will work better on the short moves probably + * typical of doupdate()'s usage pattern. Still, + * until we have better data... + */ +#ifdef FIND_COREDUMP + int from_y = roll(lines); + int to_y = roll(lines); + int from_x = roll(columns); + int to_x = roll(columns); + + printf("(%d,%d) -> (%d,%d)\n", from_y, from_x, to_y, to_x); + mvcur(from_y, from_x, to_y, to_x); +#else + mvcur(roll(lines), roll(columns), roll(lines), roll(columns)); +#endif /* FIND_COREDUMP */ + if (diff) + cumtime += diff; + } + profiling = FALSE; + + /* + * Average milliseconds per character optimization time. + * This is the key figure to watch when tuning the optimizer. + */ + perchar = cumtime / n; + + (void) printf("%d moves (%ld chars) in %d msec, %f msec each:\n", + n, xmits, (int)cumtime, perchar); + + for (i = 0; speeds[i]; i++) + { + /* + * Total estimated time for the moves, computation and + * transmission both. Transmission time is an estimate + * assuming 9 bits/char, 8 bits + 1 stop bit. + */ + float totalest = cumtime + xmits * 9 * 1e6 / speeds[i]; + + /* + * Per-character optimization overhead in character transmits + * at the current speed. Round this to the nearest integer + * to figure COMPUTE_OVERHEAD for the speed. + */ + float overhead = speeds[i] * perchar / 1e6; + + (void) printf("%6d bps: %3.2f char-xmits overhead; total estimated time %15.2f\n", + speeds[i], overhead, totalest); + } + } + else if (buf[0] == 'c') + { + (void) printf("char padding: %d\n", SP->_char_padding); + (void) printf("cr cost: %d\n", SP->_cr_cost); + (void) printf("cup cost: %d\n", SP->_cup_cost); + (void) printf("home cost: %d\n", SP->_home_cost); + (void) printf("ll cost: %d\n", SP->_ll_cost); +#ifdef TABS_OK + (void) printf("ht cost: %d\n", SP->_ht_cost); + (void) printf("cbt cost: %d\n", SP->_cbt_cost); +#endif /* TABS_OK */ + (void) printf("cub1 cost: %d\n", SP->_cub1_cost); + (void) printf("cuf1 cost: %d\n", SP->_cuf1_cost); + (void) printf("cud1 cost: %d\n", SP->_cud1_cost); + (void) printf("cuu1 cost: %d\n", SP->_cuu1_cost); + (void) printf("cub cost: %d\n", SP->_cub_cost); + (void) printf("cuf cost: %d\n", SP->_cuf_cost); + (void) printf("cud cost: %d\n", SP->_cud_cost); + (void) printf("cuu cost: %d\n", SP->_cuu_cost); + (void) printf("hpa cost: %d\n", SP->_hpa_cost); + (void) printf("vpa cost: %d\n", SP->_vpa_cost); + } + else if (buf[0] == 'x' || buf[0] == 'q') + break; + else + (void) puts("Invalid command."); + } + + (void) fputs("rmcup:", stdout); + _nc_mvcur_wrap(); + putchar('\n'); + + return(0); +} + +#endif /* MAIN */ + +/* lib_mvcur.c ends here */ diff --git a/ncurses/lib_mvwin.c b/ncurses/lib_mvwin.c new file mode 100644 index 00000000..a47bd006 --- /dev/null +++ b/ncurses/lib_mvwin.c @@ -0,0 +1,57 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* +** lib_mvwin.c +** +** The routine mvwin(). +** +*/ + +#include + +MODULE_ID("$Id: lib_mvwin.c,v 1.3 1997/02/02 00:20:41 tom Exp $") + +int mvwin(WINDOW *win, int by, int bx) +{ + T((T_CALLED("mvwin(%p,%d,%d)"), win, by, bx)); + + if (win->_flags & _SUBWIN) + returnCode(ERR); + + if (by + win->_maxy > screen_lines - 1 + || bx + win->_maxx > screen_columns - 1 + || by < 0 + || bx < 0) + returnCode(ERR); + + /* + * Whether or not the window is moved, touch the window's contents so + * that a following call to 'wrefresh()' will paint the window at the + * new location. This ensures that if the caller has refreshed another + * window at the same location, that this one will be displayed. + */ + win->_begy = by; + win->_begx = bx; + returnCode(touchwin(win)); +} diff --git a/ncurses/lib_newterm.c b/ncurses/lib_newterm.c new file mode 100644 index 00000000..aa5b5879 --- /dev/null +++ b/ncurses/lib_newterm.c @@ -0,0 +1,155 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* +** lib_newterm.c +** +** The newterm() function. +** +*/ + +#include + +#ifdef SVR4_TERMIO +#define _POSIX_SOURCE +#endif + +#include /* clear_screen, cup & friends, cur_term */ + +MODULE_ID("$Id: lib_newterm.c,v 1.23 1997/03/30 01:42:01 tom Exp $") + +/* This should be moved to TERMINAL */ +static int filter_mode = FALSE; + +void filter(void) +{ + filter_mode = TRUE; +} + +SCREEN * newterm(const char *term, FILE *ofp, FILE *ifp) +{ +int errret; +#ifdef TRACE +char *t = getenv("NCURSES_TRACE"); + + if (t) + trace((unsigned) strtol(t, 0, 0)); +#endif + + T((T_CALLED("newterm(\"%s\",%p,%p)"), term, ofp, ifp)); + + /* this loads the capability entry, then sets LINES and COLS */ + if (setupterm(term, fileno(ofp), &errret) == ERR) + return NULL; + + /* + * Check for mismatched graphic-rendition capabilities. Most SVr4 + * terminfo tree contain entries that have rmul or rmso equated to sgr0 + * (Solaris curses copes with those entries). We do this only for + * curses, since many termcap applications assume that smso/rmso and + * smul/rmul are paired, and will not function properly if we remove + * rmso or rmul. Curses applications shouldn't be looking at this + * detail. + */ + if (exit_attribute_mode) { +#define SGR0_FIX(mode) if (mode != 0 && !strcmp(mode, exit_attribute_mode)) \ + mode = 0 + SGR0_FIX(exit_underline_mode); + SGR0_FIX(exit_standout_mode); + } + + /* implement filter mode */ + if (filter_mode) { + LINES = 1; + +#ifdef init_tabs + if (init_tabs != -1) + TABSIZE = init_tabs; + else +#endif /* init_tabs */ + TABSIZE = 8; + + T(("TABSIZE = %d", TABSIZE)); + +#ifdef clear_screen + clear_screen = (char *)NULL; + cursor_down = parm_down_cursor = (char *)NULL; + cursor_address = (char *)NULL; + cursor_up = parm_up_cursor = (char *)NULL; + row_address = (char *)NULL; + + cursor_home = carriage_return; +#endif /* clear_screen */ + } + + /* If we must simulate soft labels, grab off the line to be used. + We assume that we must simulate, if it is none of the standard + formats (4-4 or 3-2-3) for which there may be some hardware + support. */ +#ifdef num_labels + if (num_labels <= 0 || !SLK_STDFMT) +#endif /* num_labels */ + if (_nc_slk_format) + { + if (ERR==_nc_ripoffline(-SLK_LINES, _nc_slk_initialize)) + return NULL; + } + /* this actually allocates the screen structure, and saves the + * original terminal settings. + */ + if (_nc_setupscreen(LINES, COLS, ofp) == ERR) + return NULL; + +#ifdef num_labels + /* if the terminal type has real soft labels, set those up */ + if (_nc_slk_format && num_labels > 0 && SLK_STDFMT) + _nc_slk_initialize(stdscr, COLS); +#endif /* num_labels */ + + SP->_ifd = fileno(ifp); + SP->_checkfd = fileno(ifp); + typeahead(fileno(ifp)); +#ifdef TERMIOS + SP->_use_meta = ((cur_term->Ottyb.c_cflag & CSIZE) == CS8 && + !(cur_term->Ottyb.c_iflag & ISTRIP)); +#else + SP->_use_meta = FALSE; +#endif + SP->_endwin = FALSE; + + baudrate(); /* sets a field in the SP structure */ + + /* compute movement costs so we can do better move optimization */ + _nc_mvcur_init(); + + _nc_signal_handler(TRUE); + + /* open a connection to the screen's associated mouse, if any */ + _nc_mouse_init(SP); + + /* Initialize the terminal line settings. */ + _nc_initscr(); + + T((T_RETURN("%p"), SP)); + return(SP); +} diff --git a/ncurses/lib_newwin.c b/ncurses/lib_newwin.c new file mode 100644 index 00000000..3fd894d4 --- /dev/null +++ b/ncurses/lib_newwin.c @@ -0,0 +1,259 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* +** lib_newwin.c +** +** The routines newwin(), subwin() and their dependent +** +*/ + +#include + +MODULE_ID("$Id: lib_newwin.c,v 1.17 1997/02/15 21:46:05 tom Exp $") + +void _nc_freewin(WINDOW *win) +{ +WINDOWLIST *p, *q; +int i; + + if (win != 0) { + for (p = _nc_windows, q = 0; p != 0; q = p, p = p->next) { + if (p->win == win) { + if (q == 0) + _nc_windows = p->next; + else + q->next = p->next; + free(p); + + if (! (win->_flags & _SUBWIN)) { + for (i = 0; i <= win->_maxy && win->_line[i].text; i++) + free(win->_line[i].text); + } + free(win->_line); + free(win); + + if (win == curscr) curscr = 0; + if (win == stdscr) stdscr = 0; + if (win == newscr) newscr = 0; + + T(("...deleted win=%p", win)); + break; + } + } + } +} + +WINDOW * newwin(int num_lines, int num_columns, int begy, int begx) +{ +WINDOW *win; +chtype *ptr; +int i; + + T((T_CALLED("newwin(%d,%d,%d,%d)"), num_lines, num_columns, begy, begx)); + + if (begy < 0 || begx < 0 || num_lines < 0 || num_columns < 0) + returnWin(0); + + if (num_lines == 0) + num_lines = SP->_lines_avail - begy; + if (num_columns == 0) + num_columns = screen_columns - begx; + + if (num_columns + begx > SP->_columns || num_lines + begy > SP->_lines_avail) + returnWin(0); + + if ((win = _nc_makenew(num_lines, num_columns, begy, begx, 0)) == 0) + returnWin(0); + + for (i = 0; i < num_lines; i++) { + if ((win->_line[i].text = typeCalloc(chtype, (unsigned)num_columns)) == 0) { + _nc_freewin(win); + returnWin(0); + } + for (ptr = win->_line[i].text; ptr < win->_line[i].text + num_columns; ) + *ptr++ = ' '; + } + + T(("newwin: returned window is %p", win)); + + returnWin(win); +} + +WINDOW * derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx) +{ +WINDOW *win; +int i; +int flags = _SUBWIN; + + T((T_CALLED("derwin(%p,%d,%d,%d,%d)"), orig, num_lines, num_columns, begy, begx)); + + /* + ** make sure window fits inside the original one + */ + if ( begy < 0 || begx < 0 || orig == 0 || num_lines < 0 || num_columns < 0) + returnWin(0); + if ( begy + num_lines > orig->_maxy + 1 + || begx + num_columns > orig->_maxx + 1) + returnWin(0); + + if (num_lines == 0) + num_lines = orig->_maxy - begy; + + if (num_columns == 0) + num_columns = orig->_maxx - begx; + + if (orig->_flags & _ISPAD) + flags |= _ISPAD; + + if ((win = _nc_makenew(num_lines, num_columns, orig->_begy + begy, orig->_begx + begx, flags)) == 0) + returnWin(0); + + win->_pary = begy; + win->_parx = begx; + win->_attrs = orig->_attrs; + win->_bkgd = orig->_bkgd; + + for (i = 0; i < num_lines; i++) + win->_line[i].text = &orig->_line[begy++].text[begx]; + + win->_parent = orig; + + T(("derwin: returned window is %p", win)); + + returnWin(win); +} + + +WINDOW *subwin(WINDOW *w, int l, int c, int y, int x) +{ + T((T_CALLED("subwin(%p, %d, %d, %d, %d)"), w, l, c, y, x)); + T(("parent has begy = %d, begx = %d", w->_begy, w->_begx)); + + returnWin(derwin(w, l, c, y - w->_begy, x - w->_begx)); +} + +WINDOW * +_nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags) +{ +int i; +WINDOWLIST *wp; +WINDOW *win; +bool is_pad = (flags & _ISPAD); + + T(("_nc_makenew(%d,%d,%d,%d)", num_lines, num_columns, begy, begx)); + + if (num_lines <= 0 || num_columns <= 0) + return 0; + + if ((wp = typeCalloc(WINDOWLIST, 1)) == 0) + return 0; + + if ((win = typeCalloc(WINDOW, 1)) == 0) + return 0; + + if ((win->_line = typeCalloc(struct ldat, ((unsigned)num_lines))) == 0) { + free(win); + return 0; + } + + win->_curx = 0; + win->_cury = 0; + win->_maxy = num_lines - 1; + win->_maxx = num_columns - 1; + win->_begy = begy; + win->_begx = begx; + win->_yoffset = SP->_topstolen; + + win->_flags = flags; + win->_attrs = A_NORMAL; + win->_bkgd = BLANK; + + win->_clear = is_pad ? FALSE : (num_lines == screen_lines && num_columns == screen_columns); + win->_idlok = FALSE; + win->_idcok = TRUE; + win->_scroll = FALSE; + win->_leaveok = FALSE; + win->_use_keypad = FALSE; + win->_delay = -1; + win->_immed = FALSE; + win->_sync = 0; + win->_parx = -1; + win->_pary = -1; + win->_parent = 0; + + win->_regtop = 0; + win->_regbottom = num_lines - 1; + + win->_pad._pad_y = -1; + win->_pad._pad_x = -1; + win->_pad._pad_top = -1; + win->_pad._pad_bottom = -1; + win->_pad._pad_left = -1; + win->_pad._pad_right = -1; + + for (i = 0; i < num_lines; i++) + { + /* + * This used to do + * + * win->_line[i].firstchar = win->_line[i].lastchar = _NOCHANGE; + * + * which marks the whole window unchanged. That's how + * SVr1 curses did it, but SVr4 curses marks the whole new + * window changed. + * + * With the old SVr1-like code, say you have stdscr full of + * characters, then create a new window with newwin(), + * then do a printw(win, "foo ");, the trailing spaces are + * completely ignored by the following refreshes. So, you + * get "foojunkjunk" on the screen instead of "foo " as + * you actually intended. + * + * SVr4 doesn't do this. Instead the spaces are actually written. + * So that's how we want ncurses to behave. + */ + win->_line[i].firstchar = 0; + win->_line[i].lastchar = num_columns-1; + + win->_line[i].oldindex = i; + } + + if (!is_pad && (begx + num_columns == screen_columns)) { + win->_flags |= _ENDLINE; + + if (begx == 0 && num_lines == screen_lines && begy == 0) + win->_flags |= _FULLWIN; + + if (begy + num_lines == screen_lines) + win->_flags |= _SCROLLWIN; + } + + wp->next = _nc_windows; + wp->win = win; + _nc_windows = wp; + + T((T_CREATE("window %p"), win)); + + return(win); +} diff --git a/ncurses/lib_options.c b/ncurses/lib_options.c new file mode 100644 index 00000000..e98c2d9d --- /dev/null +++ b/ncurses/lib_options.c @@ -0,0 +1,400 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* +** lib_options.c +** +** The routines to handle option setting. +** +*/ + +#include + +#include /* keypad_xmit, keypad_local, meta_on, meta_off */ + /* cursor_visible,cursor_normal,cursor_invisible */ + +MODULE_ID("$Id: lib_options.c,v 1.22 1997/05/01 23:46:18 Alexander.V.Lukyanov Exp $") + +int has_ic(void) +{ + T((T_CALLED("has_ic()"))); + returnCode((insert_character || parm_ich + || (enter_insert_mode && exit_insert_mode)) + && (delete_character || parm_dch)); +} + +int has_il(void) +{ + T((T_CALLED("has_il()"))); + returnCode((insert_line || parm_insert_line) + && (delete_line || parm_delete_line)); +} + +int idlok(WINDOW *win, bool flag) +{ + T((T_CALLED("idlok(%p,%d)"), win, flag)); + + _nc_idlok = win->_idlok = flag && (has_il() || change_scroll_region); + returnCode(OK); +} + + +void idcok(WINDOW *win, bool flag) +{ + T((T_CALLED("idcok(%p,%d)"), win, flag)); + + _nc_idcok = win->_idcok = flag && has_ic(); + + returnVoid; +} + + +int clearok(WINDOW *win, bool flag) +{ + T((T_CALLED("clearok(%p,%d)"), win, flag)); + + win->_clear = flag; + returnCode(OK); +} + + +void immedok(WINDOW *win, bool flag) +{ + T((T_CALLED("immedok(%p,%d)"), win, flag)); + + win->_immed = flag; + + returnVoid; +} + +int leaveok(WINDOW *win, bool flag) +{ + T((T_CALLED("leaveok(%p,%d)"), win, flag)); + + win->_leaveok = flag; + if (flag == TRUE) + curs_set(0); + else + curs_set(1); + returnCode(OK); +} + + +int scrollok(WINDOW *win, bool flag) +{ + T((T_CALLED("scrollok(%p,%d)"), win, flag)); + + win->_scroll = flag; + returnCode(OK); +} + +int halfdelay(int t) +{ + T((T_CALLED("halfdelay(%d)"), t)); + + if (t < 1 || t > 255) + returnCode(ERR); + + cbreak(); + SP->_cbreak = t+1; + returnCode(OK); +} + +int nodelay(WINDOW *win, bool flag) +{ + T((T_CALLED("nodelay(%p,%d)"), win, flag)); + + if (flag == TRUE) + win->_delay = 0; + else win->_delay = -1; + returnCode(OK); +} + +int notimeout(WINDOW *win, bool f) +{ + T((T_CALLED("notimout(%p,%d)"), win, f)); + + win->_notimeout = f; + returnCode(OK); +} + +int wtimeout(WINDOW *win, int delay) +{ + T((T_CALLED("wtimeout(%p,%d)"), win, delay)); + + win->_delay = delay; + returnCode(OK); +} + +static void init_keytry(void); +static void add_to_try(char *, short); + +/* Turn the keypad on/off + * + * Note: we flush the output because changing this mode causes some terminals + * to emit different escape sequences for cursor and keypad keys. If we don't + * flush, then the next wgetch may get the escape sequence that corresponds to + * the terminal state _before_ switching modes. + */ +int _nc_keypad(bool flag) +{ + if (flag && keypad_xmit) + { + TPUTS_TRACE("keypad_xmit"); + putp(keypad_xmit); + (void) fflush(SP->_ofp); + } + else if (! flag && keypad_local) + { + TPUTS_TRACE("keypad_local"); + putp(keypad_local); + (void) fflush(SP->_ofp); + } + + if (SP->_keytry == UNINITIALISED) + init_keytry(); + return(OK); +} + +int keypad(WINDOW *win, bool flag) +{ + T((T_CALLED("keypad(%p,%d)"), win, flag)); + + win->_use_keypad = flag; + returnCode(_nc_keypad(flag)); +} + + +int meta(WINDOW *win GCC_UNUSED, bool flag) +{ + T((T_CALLED("meta(%p,%d)"), win, flag)); + + SP->_use_meta = flag; + + if (flag && meta_on) + { + TPUTS_TRACE("meta_on"); + putp(meta_on); + } + else if (! flag && meta_off) + { + TPUTS_TRACE("meta_off"); + putp(meta_off); + } + returnCode(OK); +} + +/* curs_set() moved here to narrow the kernel interface */ + +int curs_set(int vis) +{ +int cursor = SP->_cursor; + + T((T_CALLED("curs_set(%d)"), vis)); + + if (vis < 0 || vis > 2) + returnCode(ERR); + + if (vis == cursor) + returnCode(cursor); + + switch(vis) { + case 2: + if (cursor_visible) + { + TPUTS_TRACE("cursor_visible"); + putp(cursor_visible); + } + else + returnCode(ERR); + break; + case 1: + if (cursor_normal) + { + TPUTS_TRACE("cursor_normal"); + putp(cursor_normal); + } + else + returnCode(ERR); + break; + case 0: + if (cursor_invisible) + { + TPUTS_TRACE("cursor_invisible"); + putp(cursor_invisible); + } + else + returnCode(ERR); + break; + } + SP->_cursor = vis; + (void) fflush(SP->_ofp); + + returnCode(cursor==-1 ? 1 : cursor); +} + +/* +** init_keytry() +** +** Construct the try for the current terminal's keypad keys. +** +*/ + + +static struct tries *newtry; + +static void init_keytry(void) +{ + newtry = 0; + +/* LINT_PREPRO +#if 0*/ +#include +/* LINT_PREPRO +#endif*/ + + SP->_keytry = newtry; +} + + +static void add_to_try(char *str, short code) +{ +static bool out_of_memory = FALSE; +struct tries *ptr, *savedptr; + + if (! str || out_of_memory) + return; + + if (newtry != 0) { + ptr = savedptr = newtry; + + for (;;) { + while (ptr->ch != (unsigned char) *str + && ptr->sibling != 0) + ptr = ptr->sibling; + + if (ptr->ch == (unsigned char) *str) { + if (*(++str)) { + if (ptr->child != 0) + ptr = ptr->child; + else + break; + } else { + ptr->value = code; + return; + } + } else { + if ((ptr->sibling = typeCalloc(struct tries,1)) == 0) { + out_of_memory = TRUE; + return; + } + + savedptr = ptr = ptr->sibling; + if (*str == '\200') + ptr->ch = '\0'; + else + ptr->ch = (unsigned char) *str; + str++; + ptr->value = 0; + + break; + } + } /* end for (;;) */ + } else { /* newtry == 0 :: First sequence to be added */ + savedptr = ptr = newtry = typeCalloc(struct tries,1); + + if (ptr == 0) { + out_of_memory = TRUE; + return; + } + + if (*str == '\200') + ptr->ch = '\0'; + else + ptr->ch = (unsigned char) *str; + str++; + ptr->value = 0; + } + + /* at this point, we are adding to the try. ptr->child == 0 */ + + while (*str) { + ptr->child = typeCalloc(struct tries,1); + + ptr = ptr->child; + + if (ptr == 0) { + out_of_memory = TRUE; + + ptr = savedptr; + while (ptr != 0) { + savedptr = ptr->child; + free(ptr); + ptr = savedptr; + } + + return; + } + + if (*str == '\200') + ptr->ch = '\0'; + else + ptr->ch = (unsigned char) *str; + str++; + ptr->value = 0; + } + + ptr->value = code; + return; +} + +int typeahead(int fd) +{ + T((T_CALLED("typeahead(%d)"), fd)); + SP->_checkfd = fd; + returnCode(OK); +} + +/* +** has_key() +** +** Return TRUE if the current terminal has the given key +** +*/ + + +static int has_key_internal(int keycode, struct tries *tp) +{ + if (!tp) + return(FALSE); + else if (tp->value == keycode) + return(TRUE); + else + return(has_key_internal(keycode, tp->child) + || has_key_internal(keycode, tp->sibling)); +} + +int has_key(int keycode) +{ + T((T_CALLED("has_key(%d)"), keycode)); + returnCode(has_key_internal(keycode, SP->_keytry)); +} diff --git a/ncurses/lib_overlay.c b/ncurses/lib_overlay.c new file mode 100644 index 00000000..e63b3672 --- /dev/null +++ b/ncurses/lib_overlay.c @@ -0,0 +1,139 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* +** lib_overlay.c +** +** The routines overlay(), copywin(), and overwrite(). +** +*/ + +#include + +MODULE_ID("$Id: lib_overlay.c,v 1.8 1997/04/24 10:34:38 tom Exp $") + +static int overlap(const WINDOW *const s, WINDOW *const d, int const flag) +{ +int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol; + + T(("overlap : sby %d, sbx %d, smy %d, smx %d, dby %d, dbx %d, dmy %d, dmx %d", + s->_begy, s->_begx, s->_maxy, s->_maxx, + d->_begy, d->_begx, d->_maxy, d->_maxx)); + sminrow = max(s->_begy, d->_begy) - s->_begy; + smincol = max(s->_begx, d->_begx) - s->_begx; + dminrow = max(s->_begy, d->_begy) - d->_begy; + dmincol = max(s->_begx, d->_begx) - d->_begx; + dmaxrow = min(s->_maxy+s->_begy, d->_maxy+d->_begy) - d->_begy; + dmaxcol = min(s->_maxx+s->_begx, d->_maxx+d->_begx) - d->_begx; + + return(copywin(s, d, + sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, + flag)); +} + +/* +** +** overlay(win1, win2) +** +** +** overlay() writes the overlapping area of win1 behind win2 +** on win2 non-destructively. +** +**/ + +int overlay(const WINDOW *win1, WINDOW *win2) +{ + T((T_CALLED("overlay(%p,%p)"), win1, win2)); + returnCode(overlap(win1, win2, TRUE)); +} + +/* +** +** overwrite(win1, win2) +** +** +** overwrite() writes the overlapping area of win1 behind win2 +** on win2 destructively. +** +**/ + +int overwrite(const WINDOW *win1, WINDOW *win2) +{ + T((T_CALLED("overwrite(%p,%p)"), win1, win2)); + returnCode(overlap(win1, win2, FALSE)); +} + +int copywin(const WINDOW *src, WINDOW *dst, + int sminrow, int smincol, + int dminrow, int dmincol, int dmaxrow, int dmaxcol, + int over) +{ +int sx, sy, dx, dy; +bool touched; + + T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"), + src, dst, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, over)); + + /* make sure rectangle exists in source */ + if ((sminrow + dmaxrow - dminrow) > (src->_maxy + 1) || + (smincol + dmaxcol - dmincol) > (src->_maxx + 1)) { + returnCode(ERR); + } + + T(("rectangle exists in source")); + + /* make sure rectangle fits in destination */ + if (dmaxrow > dst->_maxy || dmaxcol > dst->_maxx) { + returnCode(ERR); + } + + T(("rectangle fits in destination")); + + for (dy = dminrow, sy = sminrow; dy <= dmaxrow; sy++, dy++) { + touched = FALSE; + for(dx=dmincol, sx=smincol; dx <= dmaxcol; sx++, dx++) + { + if (over) + { + if ((TextOf(src->_line[sy].text[sx]) != ' ') && + (dst->_line[dy].text[dx]!=src->_line[sy].text[sx])) + { + dst->_line[dy].text[dx] = src->_line[sy].text[sx]; + touched = TRUE; + } + } + else { + if (dst->_line[dy].text[dx] != src->_line[sy].text[sx]) + { + dst->_line[dy].text[dx] = src->_line[sy].text[sx]; + touched = TRUE; + } + } + } + if (touched) + { + touchline(dst,0,getmaxy(dst)); + } + } + T(("finished copywin")); + returnCode(OK); +} diff --git a/ncurses/lib_pad.c b/ncurses/lib_pad.c new file mode 100644 index 00000000..fab9fe87 --- /dev/null +++ b/ncurses/lib_pad.c @@ -0,0 +1,248 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * lib_pad.c + * newpad -- create a new pad + * pnoutrefresh -- refresh a pad, no update + * pechochar -- add a char to a pad and refresh + */ + +#include + +MODULE_ID("$Id: lib_pad.c,v 1.18 1997/04/12 17:42:52 tom Exp $") + +WINDOW *newpad(int l, int c) +{ +WINDOW *win; +chtype *ptr; +int i; + + T((T_CALLED("newpad(%d, %d)"), l, c)); + + if (l <= 0 || c <= 0) + returnWin(0); + + if ((win = _nc_makenew(l,c,0,0,_ISPAD)) == NULL) + returnWin(0); + + for (i = 0; i < l; i++) { + win->_line[i].oldindex = _NEWINDEX; + if ((win->_line[i].text = typeCalloc(chtype, ((size_t)c))) == 0) { + _nc_freewin(win); + returnWin(0); + } + for (ptr = win->_line[i].text; ptr < win->_line[i].text + c; ) + *ptr++ = ' '; + } + + returnWin(win); +} + +WINDOW *subpad(WINDOW *orig, int l, int c, int begy, int begx) +{ +WINDOW *win; + + T((T_CALLED("subpad(%d, %d)"), l, c)); + + if (!(orig->_flags & _ISPAD) || ((win = derwin(orig, l, c, begy, begx)) == NULL)) + returnWin(0); + + returnWin(win); +} + +int prefresh(WINDOW *win, int pminrow, int pmincol, + int sminrow, int smincol, int smaxrow, int smaxcol) +{ + T((T_CALLED("prefresh()"))); + if (pnoutrefresh(win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol) != ERR + && doupdate() != ERR) { + returnCode(OK); + } + returnCode(ERR); +} + +int pnoutrefresh(WINDOW *win, int pminrow, int pmincol, + int sminrow, int smincol, int smaxrow, int smaxcol) +{ +short i, j; +short m, n; +short pmaxrow; +short pmaxcol; +short displaced; +bool wide; + + T((T_CALLED("pnoutrefresh(%p, %d, %d, %d, %d, %d, %d)"), + win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)); + + if (win == 0) + returnCode(ERR); + + if (!(win->_flags & _ISPAD)) + returnCode(ERR); + + /* negative values are interpreted as zero */ + if (pminrow < 0) pminrow = 0; + if (pmincol < 0) pmincol = 0; + if (sminrow < 0) sminrow = 0; + if (smincol < 0) smincol = 0; + + pmaxrow = pminrow + smaxrow - sminrow; + pmaxcol = pmincol + smaxcol - smincol; + + T((" pminrow + smaxrow - sminrow %d, win->_maxy %d", pmaxrow, win->_maxy)); + T((" pmincol + smaxcol - smincol %d, win->_maxx %d", pmaxcol, win->_maxx)); + + /* + * Trim the caller's screen size back to the actual limits. + */ + if (pmaxrow > win->_maxy) { + smaxrow -= (pmaxrow - win->_maxy); + pmaxrow = pminrow + smaxrow - sminrow; + } + if (pmaxcol > win->_maxx) { + smaxcol -= (pmaxcol - win->_maxx); + pmaxcol = pmincol + smaxcol - smincol; + } + + if (smaxrow > screen_lines + || smaxcol > screen_columns + || sminrow > smaxrow + || smincol > smaxcol) + returnCode(ERR); + + T(("pad being refreshed")); + + if (win->_pad._pad_y >= 0) { + displaced = pminrow - win->_pad._pad_y + -(sminrow - win->_pad._pad_top); + T(("pad being shifted by %d line(s)", displaced)); + } else + displaced = 0; + + /* + * For pure efficiency, we'd want to transfer scrolling information + * from the pad to newscr whenever the window is wide enough that + * its update will dominate the cost of the update for the horizontal + * band of newscr that it occupies. Unfortunately, this threshold + * tends to be complex to estimate, and in any case scrolling the + * whole band and rewriting the parts outside win's image would look + * really ugly. So. What we do is consider the pad "wide" if it + * either (a) occupies the whole width of newscr, or (b) occupies + * all but at most one column on either vertical edge of the screen + * (this caters to fussy people who put boxes around full-screen + * windows). Note that changing this formula will not break any code, + * merely change the costs of various update cases. + */ + wide = (sminrow <= 1 && win->_maxx >= (newscr->_maxx - 1)); + + for (i = pminrow, m = sminrow + win->_yoffset; + i <= pmaxrow && m <= newscr->_maxy; + i++, m++) { + register struct ldat *nline = &newscr->_line[m]; + register struct ldat *oline = &win->_line[i]; + + for (j = pmincol, n = smincol; j <= pmaxcol; j++, n++) { + if (oline->text[j] != nline->text[n]) { + nline->text[n] = oline->text[j]; + + if (nline->firstchar == _NOCHANGE) + nline->firstchar = nline->lastchar = n; + else if (n < nline->firstchar) + nline->firstchar = n; + else if (n > nline->lastchar) + nline->lastchar = n; + } + } + + if (wide) { + int nind = m + displaced; + if (oline->oldindex < 0 + || nind < sminrow + || nind > smaxrow) + nind = _NEWINDEX; + + nline->oldindex = nind; + } + oline->firstchar = oline->lastchar = _NOCHANGE; + oline->oldindex = i; + } + + /* + * Clean up debris from scrolling or resizing the pad, so we do not + * accidentally pick up the index value during the next call to this + * procedure. The only rows that should have an index value are those + * that are displayed during this cycle. + */ + for (i = pminrow-1; (i >= 0) && (win->_line[i].oldindex >= 0); i--) + win->_line[i].oldindex = _NEWINDEX; + for (i = pmaxrow+1; (i <= win->_maxy) && (win->_line[i].oldindex >= 0); i++) + win->_line[i].oldindex = _NEWINDEX; + + win->_begx = smincol; + win->_begy = sminrow; + + if (win->_clear) { + win->_clear = FALSE; + newscr->_clear = TRUE; + } + + /* + * Use the pad's current position, if it will be visible. + * If not, don't do anything; it's not an error. + */ + if (win->_leaveok == FALSE + && win->_cury >= pminrow + && win->_curx >= pmincol + && win->_cury <= pmaxrow + && win->_curx <= pmaxcol) { + newscr->_cury = win->_cury - pminrow + win->_begy + win->_yoffset; + newscr->_curx = win->_curx - pmincol + win->_begx; + } + win->_flags &= ~_HASMOVED; + + /* + * Update our cache of the line-numbers that we displayed from the pad. + * We will use this on subsequent calls to this function to derive + * values to stuff into 'oldindex[]' -- for scrolling optimization. + */ + win->_pad._pad_y = pminrow; + win->_pad._pad_x = pmincol; + win->_pad._pad_top = sminrow; + win->_pad._pad_left = smincol; + win->_pad._pad_bottom = smaxrow; + win->_pad._pad_right = smaxcol; + + returnCode(OK); +} + +int pechochar(WINDOW *pad, chtype ch) +{ + T((T_CALLED("pechochar(%p, %s)"), pad, _tracechtype(ch))); + + if (pad->_flags & _ISPAD) + returnCode(ERR); + + waddch(curscr, ch); + doupdate(); + returnCode(OK); +} diff --git a/ncurses/lib_print.c b/ncurses/lib_print.c new file mode 100644 index 00000000..fec32e82 --- /dev/null +++ b/ncurses/lib_print.c @@ -0,0 +1,84 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +#include + +#include + +MODULE_ID("$Id: lib_print.c,v 1.8 1996/12/21 14:24:06 tom Exp $") + +int mcprint(char *data, int len) +/* ship binary character data to the printer via mc4/mc5/mc5p */ +{ + char *mybuf, *switchon; + size_t onsize, offsize, res; + + errno = 0; + if (!prtr_non && (!prtr_on || !prtr_off)) + { + errno = ENODEV; + return(ERR); + } + + if (prtr_non) + { + switchon = tparm(prtr_non, len); + onsize = strlen(switchon); + offsize = 0; + } + else + { + switchon = prtr_on; + onsize = strlen(prtr_on); + offsize = strlen(prtr_off); + } + + if ((mybuf = malloc(onsize + len + offsize + 1)) == (char *)NULL) + { + errno = ENOMEM; + return(ERR); + } + + (void) strcpy(mybuf, switchon); + memcpy(mybuf + onsize, data, len); + if (offsize) + (void) strcpy(mybuf + onsize + len, prtr_off); + + /* + * We're relying on the atomicity of UNIX writes here. The + * danger is that output from a refresh() might get interspersed + * with the printer data after the write call returns but before the + * data has actually been shipped to the terminal. If the write(2) + * operation is truly atomic we're protected from this. + */ + res = write(cur_term->Filedes, mybuf, onsize + len + offsize); + + /* + * By giving up our scheduler slot here we increase the odds that the + * kernel will ship the contiguous clist items from the last write + * immediately. + */ + (void) sleep(0); + + free(mybuf); + return(res); +} diff --git a/ncurses/lib_printw.c b/ncurses/lib_printw.c new file mode 100644 index 00000000..874da9ce --- /dev/null +++ b/ncurses/lib_printw.c @@ -0,0 +1,95 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* +** lib_printw.c +** +** The routines printw(), wprintw() and friends. +** +*/ + +#include + +MODULE_ID("$Id: lib_printw.c,v 1.3 1997/02/16 00:07:23 tom Exp $") + +int printw(const char *fmt, ...) +{ +va_list argp; +char buf[BUFSIZ]; + + T(("printw(%s,...) called", _nc_visbuf(fmt))); + + va_start(argp, fmt); + vsprintf(buf, fmt, argp); + va_end(argp); + return(waddstr(stdscr, buf)); +} + + + +int wprintw(WINDOW *win, const char *fmt, ...) +{ +va_list argp; +char buf[BUFSIZ]; + + T(("wprintw(%p,%s,...) called", win, _nc_visbuf(fmt))); + + va_start(argp, fmt); + vsprintf(buf, fmt, argp); + va_end(argp); + return(waddstr(win, buf)); +} + + + +int mvprintw(int y, int x, const char *fmt, ...) +{ +va_list argp; +char buf[BUFSIZ]; + + va_start(argp, fmt); + vsprintf(buf, fmt, argp); + va_end(argp); + return(move(y, x) == OK ? waddstr(stdscr, buf) : ERR); +} + + + +int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...) +{ +va_list argp; +char buf[BUFSIZ]; + + va_start(argp, fmt); + vsprintf(buf, fmt, argp); + va_end(argp); + return(wmove(win, y, x) == OK ? waddstr(win, buf) : ERR); +} + +int vwprintw(WINDOW *win, const char *fmt, va_list argp) +{ +char buf[BUFSIZ]; + + vsprintf(buf, fmt, argp); + return(waddstr(win, buf)); +} diff --git a/ncurses/lib_raw.c b/ncurses/lib_raw.c new file mode 100644 index 00000000..95f26f62 --- /dev/null +++ b/ncurses/lib_raw.c @@ -0,0 +1,435 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * raw.c + * + * Routines: + * raw() + * echo() + * nl() + * cbreak() + * noraw() + * noecho() + * nonl() + * nocbreak() + * qiflush() + * noqiflush() + * intrflush() + * + */ + +#include +#include /* cur_term */ + +MODULE_ID("$Id: lib_raw.c,v 1.16 1997/02/02 00:02:32 tom Exp $") + +#ifdef SVR4_TERMIO +#define _POSIX_SOURCE +#endif + +#if HAVE_SYS_TERMIO_H +#include /* needed for ISC */ +#endif + +/* may be undefined if we're using termio.h */ +#ifndef TOSTOP +#define TOSTOP 0 +#endif +#ifndef IEXTEN +#define IEXTEN 0 +#endif + +#define COOKED_INPUT (IXON|BRKINT|PARMRK) + +#ifdef TRACE +char *_tracebits(void) +/* describe the state of the terminal control bits exactly */ +{ +static char buf[BUFSIZ]; +static const struct {unsigned int val; const char *name;} + +#ifdef TERMIOS +iflags[] = + { + {BRKINT, "BRKINT"}, + {IGNBRK, "IGNBRK"}, + {IGNPAR, "IGNPAR"}, + {PARMRK, "PARMRK"}, + {INPCK, "INPCK"}, + {ISTRIP, "ISTRIP"}, + {INLCR, "INLCR"}, + {IGNCR, "IGNC"}, + {ICRNL, "ICRNL"}, + {IXON, "IXON"}, + {IXOFF, "IXOFF"}, + {0, NULL} +#define ALLIN (BRKINT|IGNBRK|IGNPAR|PARMRK|INPCK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IXOFF) + }, +oflags[] = + { + {OPOST, "OPOST"}, + {0, NULL} +#define ALLOUT (OPOST) + }, +cflags[] = + { + {CLOCAL, "CLOCAL"}, + {CREAD, "CREAD"}, + {CSIZE, "CSIZE"}, + {CSTOPB, "CSTOPB"}, + {HUPCL, "HUPCL"}, + {PARENB, "PARENB"}, + {PARODD|PARENB, "PARODD"}, /* concession to readability */ + {0, NULL} +#define ALLCTRL (CLOCAL|CREAD|CSIZE|CSTOPB|HUPCL|PARENB|PARODD) + }, +lflags[] = + { + {ECHO, "ECHO"}, + {ECHOE|ECHO, "ECHOE"}, /* concession to readability */ + {ECHOK|ECHO, "ECHOK"}, /* concession to readability */ + {ECHONL, "ECHONL"}, + {ICANON, "ICANON"}, + {ISIG, "ISIG"}, + {NOFLSH, "NOFLSH"}, +#if TOSTOP != 0 + {TOSTOP, "TOSTOP"}, +#endif +#if IEXTEN != 0 + {IEXTEN, "IEXTEN"}, +#endif + {0, NULL} +#define ALLLOCAL (ECHO|ECHONL|ICANON|ISIG|NOFLSH|TOSTOP|IEXTEN) + }, + *sp; + + if (cur_term->Nttyb.c_iflag & ALLIN) + { + (void) strcpy(buf, "iflags: {"); + for (sp = iflags; sp->val; sp++) + if ((cur_term->Nttyb.c_iflag & sp->val) == sp->val) + { + (void) strcat(buf, sp->name); + (void) strcat(buf, ", "); + } + if (buf[strlen(buf) - 2] == ',') + buf[strlen(buf) - 2] = '\0'; + (void) strcat(buf,"} "); + } + + if (cur_term->Nttyb.c_oflag & ALLOUT) + { + (void) strcat(buf, "oflags: {"); + for (sp = oflags; sp->val; sp++) + if ((cur_term->Nttyb.c_oflag & sp->val) == sp->val) + { + (void) strcat(buf, sp->name); + (void) strcat(buf, ", "); + } + if (buf[strlen(buf) - 2] == ',') + buf[strlen(buf) - 2] = '\0'; + (void) strcat(buf,"} "); + } + + if (cur_term->Nttyb.c_cflag & ALLCTRL) + { + (void) strcat(buf, "cflags: {"); + for (sp = cflags; sp->val; sp++) + if ((cur_term->Nttyb.c_cflag & sp->val) == sp->val) + { + (void) strcat(buf, sp->name); + (void) strcat(buf, ", "); + } + if (buf[strlen(buf) - 2] == ',') + buf[strlen(buf) - 2] = '\0'; + (void) strcat(buf,"} "); + } + + if (cur_term->Nttyb.c_lflag & ALLLOCAL) + { + (void) strcat(buf, "lflags: {"); + for (sp = lflags; sp->val; sp++) + if ((cur_term->Nttyb.c_lflag & sp->val) == sp->val) + { + (void) strcat(buf, sp->name); + (void) strcat(buf, ", "); + } + if (buf[strlen(buf) - 2] == ',') + buf[strlen(buf) - 2] = '\0'; + (void) strcat(buf,"} "); + } + +#else + /* reference: ttcompat(4M) on SunOS 4.1 */ +#ifndef EVENP +#define EVENP 0 +#endif +#ifndef LCASE +#define LCASE 0 +#endif +#ifndef LLITOUT +#define LLITOUT 0 +#endif +#ifndef ODDP +#define ODDP 0 +#endif +#ifndef TANDEM +#define TANDEM 0 +#endif + +cflags[] = + { + {CBREAK, "CBREAK"}, + {CRMOD, "CRMOD"}, + {ECHO, "ECHO"}, + {EVENP, "EVENP"}, + {LCASE, "LCASE"}, + {LLITOUT, "LLITOUT"}, + {ODDP, "ODDP"}, + {RAW, "RAW"}, + {TANDEM, "TANDEM"}, + {XTABS, "XTABS"}, + {0, NULL} +#define ALLCTRL (CBREAK|CRMOD|ECHO|EVENP|LCASE|LLITOUT|ODDP|RAW|TANDEM|XTABS) + }, + *sp; + + if (cur_term->Nttyb.sg_flags & ALLCTRL) + { + (void) strcat(buf, "cflags: {"); + for (sp = cflags; sp->val; sp++) + if ((cur_term->Nttyb.sg_flags & sp->val) == sp->val) + { + (void) strcat(buf, sp->name); + (void) strcat(buf, ", "); + } + if (buf[strlen(buf) - 2] == ',') + buf[strlen(buf) - 2] = '\0'; + (void) strcat(buf,"} "); + } + +#endif + return(buf); +} + +#define BEFORE(N) if (_nc_tracing&TRACE_BITS) _tracef("%s before bits: %s", N, _tracebits()) +#define AFTER(N) if (_nc_tracing&TRACE_BITS) _tracef("%s after bits: %s", N, _tracebits()) +#else +#define BEFORE(s) +#define AFTER(s) +#endif /* TRACE */ + +int raw(void) +{ + T((T_CALLED("raw()"))); + + SP->_raw = TRUE; + SP->_cbreak = TRUE; + +#ifdef TERMIOS + BEFORE("raw"); + cur_term->Nttyb.c_lflag &= ~(ICANON|ISIG); + cur_term->Nttyb.c_iflag &= ~(COOKED_INPUT); + cur_term->Nttyb.c_cc[VMIN] = 1; + cur_term->Nttyb.c_cc[VTIME] = 0; + AFTER("raw"); +#else + cur_term->Nttyb.sg_flags |= RAW; +#endif + if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) + returnCode(ERR); + returnCode(OK); +} + +int cbreak(void) +{ + T((T_CALLED("cbreak()"))); + + SP->_cbreak = TRUE; + +#ifdef TERMIOS + BEFORE("cbreak"); + cur_term->Nttyb.c_lflag &= ~ICANON; + cur_term->Nttyb.c_iflag &= ~ICRNL; + cur_term->Nttyb.c_lflag |= ISIG; + cur_term->Nttyb.c_cc[VMIN] = 1; + cur_term->Nttyb.c_cc[VTIME] = 0; + AFTER("cbreak"); +#else + cur_term->Nttyb.sg_flags |= CBREAK; +#endif + if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) + returnCode(ERR); + returnCode(OK); +} + +int echo(void) +{ + T((T_CALLED("echo()"))); + + SP->_echo = TRUE; + + returnCode(OK); +} + + +int nl(void) +{ + T((T_CALLED("nl()"))); + + SP->_nl = TRUE; + + returnCode(OK); +} + + +int qiflush(void) +{ + T((T_CALLED("qiflush()"))); + + /* + * Note: this implementation may be wrong. See the comment under + * intrflush(). + */ + +#ifdef TERMIOS + BEFORE("qiflush"); + cur_term->Nttyb.c_lflag &= ~(NOFLSH); + AFTER("qiflush"); + if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) + returnCode(ERR); + else + returnCode(OK); +#else + returnCode(ERR); +#endif +} + + +int noraw(void) +{ + T((T_CALLED("noraw()"))); + + SP->_raw = FALSE; + SP->_cbreak = FALSE; + +#ifdef TERMIOS + BEFORE("noraw"); + cur_term->Nttyb.c_lflag |= ISIG|ICANON; + cur_term->Nttyb.c_iflag |= COOKED_INPUT; + AFTER("noraw"); +#else + cur_term->Nttyb.sg_flags &= ~(RAW|CBREAK); +#endif + if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) + returnCode(ERR); + returnCode(OK); +} + + +int nocbreak(void) +{ + T((T_CALLED("nocbreak()"))); + + SP->_cbreak = 0; + +#ifdef TERMIOS + BEFORE("nocbreak"); + cur_term->Nttyb.c_lflag |= ICANON; + cur_term->Nttyb.c_iflag |= ICRNL; + AFTER("nocbreak"); +#else + cur_term->Nttyb.sg_flags &= ~CBREAK; +#endif + if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) + returnCode(ERR); + returnCode(OK); +} + +int noecho(void) +{ + T((T_CALLED("noecho()"))); + SP->_echo = FALSE; + returnCode(OK); +} + + +int nonl(void) +{ + T((T_CALLED("nonl()"))); + + SP->_nl = FALSE; + + returnCode(OK); +} + +int noqiflush(void) +{ + T((T_CALLED("noqiflush()"))); + + /* + * Note: this implementation may be wrong. See the comment under + * intrflush(). + */ + +#ifdef TERMIOS + BEFORE("noqiflush"); + cur_term->Nttyb.c_lflag |= NOFLSH; + AFTER("noqiflush"); + if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) + returnCode(ERR); + else + returnCode(OK); +#else + returnCode(ERR); +#endif +} + +int intrflush(WINDOW *win GCC_UNUSED, bool flag) +{ + T((T_CALLED("intrflush(%d)"), flag)); + + /* + * This call does the same thing as the qiflush()/noqiflush() + * pair. We know for certain that SVr3 intrflush() tweaks the + * NOFLSH bit; on the other hand, the match (in the SVr4 man + * pages) between the language describing NOFLSH in termio(7) + * and the language describing qiflush()/noqiflush() in + * curs_inopts(3x) is too exact to be coincidence. + */ + +#ifdef TERMIOS + BEFORE("intrflush"); + if (flag) + cur_term->Nttyb.c_lflag &= ~(NOFLSH); + else + cur_term->Nttyb.c_lflag |= (NOFLSH); + AFTER("intrflush"); + if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) + returnCode(ERR); + else + returnCode(OK); +#else + returnCode(ERR); +#endif +} diff --git a/ncurses/lib_refresh.c b/ncurses/lib_refresh.c new file mode 100644 index 00000000..c3418bf1 --- /dev/null +++ b/ncurses/lib_refresh.c @@ -0,0 +1,180 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* + * lib_refresh.c + * + * The routines wredrawln(), wrefresh() and wnoutrefresh(). + * + */ + +#include + +MODULE_ID("$Id: lib_refresh.c,v 1.14 1997/02/02 01:05:26 tom Exp $") + +int wredrawln(WINDOW *win, int beg, int num) +{ + T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num)); + touchline(win, beg, num); + wrefresh(win); + returnCode(OK); +} + +int wrefresh(WINDOW *win) +{ +int code; + + T((T_CALLED("wrefresh(%p)"), win)); + + if (win == curscr) { + curscr->_clear = TRUE; + code = doupdate(); + } else if ((code = wnoutrefresh(win)) == OK) { + if (win->_clear) + newscr->_clear = TRUE; + code = doupdate(); + /* + * Reset the clearok() flag in case it was set for the special + * case in hardscroll.c (if we don't reset it here, we'll get 2 + * refreshes because the flag is copied from stdscr to newscr). + * Resetting the flag shouldn't do any harm, anyway. + */ + win->_clear = FALSE; + } + returnCode(code); +} + +int wnoutrefresh(WINDOW *win) +{ +short i, j; +short begx = win->_begx; +short begy = win->_begy; +short m, n; +bool wide; + + T((T_CALLED("wnoutrefresh(%p)"), win)); +#ifdef TRACE + if (_nc_tracing & TRACE_UPDATE) + _tracedump("...win", win); +#endif /* TRACE */ + + /* + * This function will break badly if we try to refresh a pad. + */ + if ((win == 0) + || (win->_flags & _ISPAD)) + returnCode(ERR); + + /* + * If 'newscr' has a different background than the window that we're + * trying to refresh, we'll have to copy the whole thing. + */ + if (win->_bkgd != newscr->_bkgd) { + touchwin(win); + newscr->_bkgd = win->_bkgd; + } + newscr->_attrs = win->_attrs; + + /* merge in change information from all subwindows of this window */ + wsyncdown(win); + + /* + * For pure efficiency, we'd want to transfer scrolling information + * from the window to newscr whenever the window is wide enough that + * its update will dominate the cost of the update for the horizontal + * band of newscr that it occupies. Unfortunately, this threshold + * tends to be complex to estimate, and in any case scrolling the + * whole band and rewriting the parts outside win's image would look + * really ugly. So. What we do is consider the window "wide" if it + * either (a) occupies the whole width of newscr, or (b) occupies + * all but at most one column on either vertical edge of the screen + * (this caters to fussy people who put boxes around full-screen + * windows). Note that changing this formula will not break any code, + * merely change the costs of various update cases. + */ + wide = (begx <= 1 && win->_maxx >= (newscr->_maxx - 1)); + + win->_flags &= ~_HASMOVED; + + /* + * Microtweaking alert! This double loop is one of the genuine + * hot spots in the code. Even gcc doesn't seem to do enough + * common-subexpression chunking to make it really tense, + * so we'll force the issue. + */ + for (i = 0, m = begy + win->_yoffset; + i <= win->_maxy && m <= newscr->_maxy; + i++, m++) { + register struct ldat *nline = &newscr->_line[m]; + register struct ldat *oline = &win->_line[i]; + + if (oline->firstchar != _NOCHANGE) { + int last = oline->lastchar; + + /* limit(j) */ + if (last > win->_maxx) + last = win->_maxx; + /* limit(n) */ + if (last > newscr->_maxx - begx) + last = newscr->_maxx - begx; + + for (j = oline->firstchar, n = j + begx; j <= last; j++, n++) { + if (oline->text[j] != nline->text[n]) { + nline->text[n] = oline->text[j]; + + if (nline->firstchar == _NOCHANGE) + nline->firstchar = nline->lastchar = n; + else if (n < nline->firstchar) + nline->firstchar = n; + else if (n > nline->lastchar) + nline->lastchar = n; + } + } + + } + + if (wide) { + int oind = oline->oldindex; + + nline->oldindex = (oind == _NEWINDEX) ? _NEWINDEX : begy + oind + win->_yoffset; + } + + oline->firstchar = oline->lastchar = _NOCHANGE; + oline->oldindex = i; + } + + if (win->_clear) { + win->_clear = FALSE; + newscr->_clear = TRUE; + } + + if (! win->_leaveok) { + newscr->_cury = win->_cury + win->_begy + win->_yoffset; + newscr->_curx = win->_curx + win->_begx; + } +#ifdef TRACE + if (_nc_tracing & TRACE_UPDATE) + _tracedump("newscr", newscr); +#endif /* TRACE */ + returnCode(OK); +} diff --git a/ncurses/lib_restart.c b/ncurses/lib_restart.c new file mode 100644 index 00000000..54ee81ea --- /dev/null +++ b/ncurses/lib_restart.c @@ -0,0 +1,154 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* + * Terminfo-only terminal setup routines: + * + * int restartterm(const char *, int, int *) + * TERMINAL *set_curterm(TERMINAL *) + * int del_curterm(TERMINAL *) + */ + +#include + +#ifdef SVR4_TERMIO +#define _POSIX_SOURCE +#endif + +#include /* lines, columns, cur_term */ + +MODULE_ID("$Id: lib_restart.c,v 1.11 1997/02/02 01:10:25 tom Exp $") + +#undef tabs + +#ifdef TAB3 +# define tabs TAB3 +#else +# ifdef XTABS +# define tabs XTABS +# else +# ifdef OXTABS +# define tabs OXTABS +# else +# define tabs 0 +# endif +# endif +#endif + +int def_shell_mode(void) +{ + T((T_CALLED("def_shell_mode()"))); + + if (cur_term == 0) + returnCode(ERR); + + /* + * Turn off the XTABS bit in the tty structure if it was on. If XTABS + * was on, remove the tab and backtab capabilities. + */ + + if (GET_TTY(cur_term->Filedes, &cur_term->Ottyb) == -1) + returnCode(ERR); +#ifdef TERMIOS + if (cur_term->Ottyb.c_oflag & tabs) + tab = back_tab = NULL; +#else + if (cur_term->Ottyb.sg_flags & XTABS) + tab = back_tab = NULL; +#endif + returnCode(OK); +} + +int def_prog_mode(void) +{ + T((T_CALLED("def_prog_mode()"))); + + if (cur_term == 0) + returnCode(ERR); + + if (GET_TTY(cur_term->Filedes, &cur_term->Nttyb) == -1) + returnCode(ERR); +#ifdef TERMIOS + cur_term->Nttyb.c_oflag &= ~tabs; +#else + cur_term->Nttyb.sg_flags &= ~XTABS; +#endif + returnCode(OK); +} + +int restartterm(const char *term, int filenum, int *errret) +{ +int saveecho = SP->_echo; +int savecbreak = SP->_cbreak; +int saveraw = SP->_raw; +int savenl = SP->_nl; + + T((T_CALLED("restartterm(%s,%d,%p)"), term, filenum, errret)); + + setupterm(term, filenum, errret); + + if (saveecho) + echo(); + else + noecho(); + + if (savecbreak) { + cbreak(); + noraw(); + } else if (saveraw) { + nocbreak(); + raw(); + } else { + nocbreak(); + noraw(); + } + if (savenl) + nl(); + else + nonl(); + + reset_prog_mode(); + + _nc_get_screensize(); + + returnCode(OK); +} + +TERMINAL *set_curterm(TERMINAL *term) +{ + TERMINAL *oldterm = cur_term; + + cur_term = term; + return oldterm; +} + +int del_curterm(TERMINAL *term) +{ + T((T_CALLED("del_curterm(%p)"), term)); + + if (term != NULL) { + FreeIfNeeded(term->type.str_table); + FreeIfNeeded(term->type.term_names); + free(term); + returnCode(OK); + } + returnCode(ERR); +} diff --git a/ncurses/lib_scanw.c b/ncurses/lib_scanw.c new file mode 100644 index 00000000..bf5d5f7e --- /dev/null +++ b/ncurses/lib_scanw.c @@ -0,0 +1,95 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* +** lib_scanw.c +** +** The routines scanw(), wscanw() and friends. +** +*/ + +#include + +MODULE_ID("$Id: lib_scanw.c,v 1.4 1997/02/08 14:45:51 tom Exp $") + +#if !HAVE_VSSCANF +extern int vsscanf(const char *str, const char *format, ...); +#endif + +int vwscanw(WINDOW *win, const char *fmt, va_list argp) +{ +char buf[BUFSIZ]; + + if (wgetstr(win, buf) == ERR) + return(ERR); + + return(vsscanf(buf, fmt, argp)); +} + +int scanw(const char *fmt, ...) +{ +int code; +va_list ap; + + T(("scanw(\"%s\",...) called", fmt)); + + va_start(ap, fmt); + code = vwscanw(stdscr, fmt, ap); + va_end(ap); + return (code); +} + +int wscanw(WINDOW *win, const char *fmt, ...) +{ +int code; +va_list ap; + + T(("wscanw(%p,\"%s\",...) called", win, fmt)); + + va_start(ap, fmt); + code = vwscanw(win, fmt, ap); + va_end(ap); + return (code); +} + +int mvscanw(int y, int x, const char *fmt, ...) +{ +int code; +va_list ap; + + va_start(ap, fmt); + code = (move(y, x) == OK) ? vwscanw(stdscr, fmt, ap) : ERR; + va_end(ap); + return (code); +} + +int mvwscanw(WINDOW *win, int y, int x, const char *fmt, ...) +{ +int code; +va_list ap; + + va_start(ap, fmt); + code = (wmove(win, y, x) == OK) ? vwscanw(win, fmt, ap) : ERR; + va_end(ap); + return (code); +} diff --git a/ncurses/lib_screen.c b/ncurses/lib_screen.c new file mode 100644 index 00000000..44716f58 --- /dev/null +++ b/ncurses/lib_screen.c @@ -0,0 +1,182 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +#include + +#include +#include +#include /* exit_ca_mode, non_rev_rmcup */ + +MODULE_ID("$Id: lib_screen.c,v 1.7 1997/02/02 00:41:10 tom Exp $") + +static time_t dumptime; + +WINDOW *getwin(FILE *filep) +{ + WINDOW try, *nwin; + int n; + + T((T_CALLED("getwin(%p)"), filep)); + + (void) fread(&try, sizeof(WINDOW), 1, filep); + if (ferror(filep)) + returnWin(0); + + if ((nwin = newwin(try._maxy+1, try._maxx+1, 0, 0)) == 0) + returnWin(0); + + /* + * We deliberately do not restore the _parx, _pary, or _parent + * fields, because the window hierarchy within which they + * made sense is probably gone. + */ + nwin->_curx = try._curx; + nwin->_cury = try._cury; + nwin->_maxy = try._maxy; + nwin->_maxx = try._maxx; + nwin->_begy = try._begy; + nwin->_begx = try._begx; + nwin->_yoffset = try._yoffset; + nwin->_flags = try._flags & ~(_SUBWIN|_ISPAD); + + nwin->_attrs = try._attrs; + nwin->_bkgd = try._bkgd; + + nwin->_clear = try._clear; + nwin->_scroll = try._scroll; + nwin->_leaveok = try._leaveok; + nwin->_use_keypad = try._use_keypad; + nwin->_delay = try._delay; + nwin->_immed = try._immed; + nwin->_sync = try._sync; + + nwin->_regtop = try._regtop; + nwin->_regbottom = try._regbottom; + + for (n = 0; n < nwin->_maxy + 1; n++) + { + (void) fread(nwin->_line[n].text, + sizeof(chtype), (size_t)(nwin->_maxx + 1), filep); + if (ferror(filep)) + { + delwin(nwin); + returnWin(0); + } + } + touchwin(nwin); + + returnWin(nwin); +} + +int putwin(WINDOW *win, FILE *filep) +{ + int n; + + T((T_CALLED("putwin(%p,%p)"), win, filep)); + + (void) fwrite(win, sizeof(WINDOW), 1, filep); + if (ferror(filep)) + returnCode(ERR); + + for (n = 0; n < win->_maxy + 1; n++) + { + (void) fwrite(win->_line[n].text, + sizeof(chtype), (size_t)(win->_maxx + 1), filep); + if (ferror(filep)) + returnCode(ERR); + } + + returnCode(OK); +} + +int scr_restore(const char *file) +{ + FILE *fp; + + T((T_CALLED("scr_restore(%s)"), _nc_visbuf(file))); + + if ((fp = fopen(file, "r")) == 0) + returnCode(ERR); + else + { + delwin(newscr); + newscr = getwin(fp); + (void) fclose(fp); + returnCode(OK); + } +} + +int scr_dump(const char *file) +{ + FILE *fp; + + T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file))); + + if ((fp = fopen(file, "w")) == 0) + returnCode(ERR); + else + { + (void) putwin(newscr, fp); + (void) fclose(fp); + dumptime = time((time_t *)0); + returnCode(OK); + } +} + +int scr_init(const char *file) +{ + FILE *fp; + struct stat stb; + + T((T_CALLED("scr_init(%s)"), _nc_visbuf(file))); + +#ifdef exit_ca_mode + if (exit_ca_mode && non_rev_rmcup) + returnCode(ERR); +#endif /* exit_ca_mode */ + + if ((fp = fopen(file, "r")) == 0) + returnCode(ERR); + else if (fstat(STDOUT_FILENO, &stb) || stb.st_mtime > dumptime) + returnCode(ERR); + else + { + delwin(curscr); + curscr = getwin(fp); + (void) fclose(fp); + returnCode(OK); + } +} + +int scr_set(const char *file) +{ + T((T_CALLED("scr_set(%s)"), _nc_visbuf(file))); + + if (scr_init(file) == ERR) + returnCode(ERR); + else + { + delwin(newscr); + newscr = dupwin(curscr); + returnCode(OK); + } +} diff --git a/ncurses/lib_scroll.c b/ncurses/lib_scroll.c new file mode 100644 index 00000000..acf99384 --- /dev/null +++ b/ncurses/lib_scroll.c @@ -0,0 +1,111 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* +** lib_scroll.c +** +** The routine wscrl(win, n). +** positive n scroll the window up (ie. move lines down) +** negative n scroll the window down (ie. move lines up) +** +*/ + +#include + +MODULE_ID("$Id: lib_scroll.c,v 1.11 1997/02/01 23:22:54 tom Exp $") + +void _nc_scroll_window(WINDOW *win, int const n, short const top, short const bottom) +{ +int line, j; +chtype blank = _nc_background(win); +size_t to_copy = (size_t)(sizeof(chtype) * (win->_maxx + 1)); + + TR(TRACE_MOVE, ("_nc_scroll_window(%p, %d, %d, %d)", win, n, top,bottom)); + + /* + * This used to do a line-text pointer-shuffle instead of text copies. + * That (a) doesn't work when the window is derived and doesn't have + * its own storage, (b) doesn't save you a lot on modern machines + * anyway. Your typical memcpy implementations are coded in + * assembler using a tight BLT loop; for the size of copies we're + * talking here, the total execution time is dominated by the one-time + * setup cost. So there is no point in trying to be excessively + * clever -- esr. + */ + + /* shift n lines downwards */ + if (n < 0) { + for (line = bottom; line >= top-n; line--) { + memcpy(win->_line[line].text, + win->_line[line+n].text, + to_copy); + win->_line[line].oldindex = win->_line[line+n].oldindex; + } + for (line = top; line < top-n; line++) { + for (j = 0; j <= win->_maxx; j ++) + win->_line[line].text[j] = blank; + win->_line[line].oldindex = _NEWINDEX; + win->_line[line].firstchar = 0; + win->_line[line].lastchar = win->_maxx; + } + } + + /* shift n lines upwards */ + if (n > 0) { + for (line = top; line <= bottom-n; line++) { + memcpy(win->_line[line].text, + win->_line[line+n].text, + to_copy); + win->_line[line].oldindex = win->_line[line+n].oldindex; + } + for (line = bottom; line > bottom-n; line--) { + for (j = 0; j <= win->_maxx; j ++) + win->_line[line].text[j] = blank; + win->_line[line].oldindex = _NEWINDEX; + win->_line[line].firstchar = 0; + win->_line[line].lastchar = win->_maxx; + } + } +} + +int +wscrl(WINDOW *win, int n) +{ + T((T_CALLED("wscrl(%p,%d)"), win, n)); + + if (! win->_scroll) + returnCode(ERR); + + if (n == 0) + returnCode(OK); + + if ((n > (win->_regbottom - win->_regtop)) || + (-n > (win->_regbottom - win->_regtop))) + returnCode(ERR); + + _nc_scroll_window(win, n, win->_regtop, win->_regbottom); + touchline(win, win->_regtop, (int)(win->_regbottom - win->_regtop + 1)); + + _nc_synchook(win); + returnCode(OK); +} diff --git a/ncurses/lib_scrreg.c b/ncurses/lib_scrreg.c new file mode 100644 index 00000000..70696a4b --- /dev/null +++ b/ncurses/lib_scrreg.c @@ -0,0 +1,49 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* +** lib_scrreg.c +** +** The routine wsetscrreg(). +** +*/ + +#include + +MODULE_ID("$Id: lib_scrreg.c,v 1.5 1997/02/01 23:22:54 tom Exp $") + +int wsetscrreg(WINDOW *win, int top, int bottom) +{ + T((T_CALLED("wsetscrreg(%p,%d,%d)"), win, top, bottom)); + + if (top >= 0 && top <= win->_maxy && + bottom >= 0 && bottom <= win->_maxy && + bottom > top) + { + win->_regtop = (short)top; + win->_regbottom = (short)bottom; + + returnCode(OK); + } else + returnCode(ERR); +} diff --git a/ncurses/lib_set_term.c b/ncurses/lib_set_term.c new file mode 100644 index 00000000..a34cdc1b --- /dev/null +++ b/ncurses/lib_set_term.c @@ -0,0 +1,281 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* +** lib_set_term.c +** +** The routine set_term(). +** +*/ + +#include + +#include /* cur_term */ + +MODULE_ID("$Id: lib_set_term.c,v 1.17 1997/05/01 23:46:18 Alexander.V.Lukyanov Exp $") + +/* + * If the output file descriptor is connected to a tty (the typical case) it + * will probably be line-buffered. Keith Bostic pointed out that we don't want + * this; it hoses people running over networks by forcing out a bunch of small + * packets instead of one big one, so screen updates on ptys look jerky. + * Restore block buffering to prevent this minor lossage. + * + * The buffer size is a compromise. Ideally we'd like a buffer that can hold + * the maximum possible update size (the whole screen plus cup commands to + * change lines as it's painted). On a 66-line xterm this can become + * excessive. So we min it with the amount of data we think we can get through + * two Ethernet packets (maximum packet size - 100 for TCP/IP overhead). + * + * Why two ethernet packets? It used to be one, on the theory that said + * packets define the maximum size of atomic update. But that's less than the + * 2000 chars on a 25 x 80 screen, and we don't want local updates to flicker + * either. Two packet lengths will handle up to a 35 x 80 screen. + * + * The magic '6' is the estimated length of the end-of-line cup sequence to go + * to the next line. It's generous. We used to mess with the buffering in + * init_mvcur() after cost computation, but that lost the sequences emitted by + * init_acs() in setupscreen(). + * + * "The setvbuf function may be used only after the stream pointed to by stream + * has been associated with an open file and before any other operation is + * performed on the stream." (ISO 7.9.5.6.) + * + * Grrrr... + */ +void _nc_set_buffer(FILE *ofp, bool buffered) +{ + /* optional optimization hack -- do before any output to ofp */ +#if HAVE_SETVBUF || HAVE_SETBUFFER + unsigned buf_len; + char *buf_ptr; + + if (buffered) { + buf_len = min(LINES * (COLS + 6), 2800); + buf_ptr = malloc(buf_len); + } else { + buf_len = 0; + buf_ptr = 0; + } + +#if HAVE_SETVBUF +#ifdef SETVBUF_REVERSED /* pre-svr3? */ + (void) setvbuf(ofp, buf_ptr, buf_len, buf_len ? _IOFBF : _IONBF); +#else + (void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IONBF, buf_len); +#endif +#elif HAVE_SETBUFFER + (void) setbuffer(ofp, buf_ptr, (int)buf_len); +#endif + + if (!buffered) { + FreeIfNeeded(SP->_setbuf); + } + SP->_setbuf = buf_ptr; + +#endif /* HAVE_SETVBUF || HAVE_SETBUFFER */ +} + +SCREEN * set_term(SCREEN *screen) +{ +SCREEN *oldSP; + + T((T_CALLED("set_term(%p)"), screen)); + + oldSP = SP; + _nc_set_screen(screen); + + cur_term = SP->_term; + curscr = SP->_curscr; + newscr = SP->_newscr; + stdscr = SP->_stdscr; + COLORS = SP->_color_count; + COLOR_PAIRS = SP->_pair_count; + + T((T_RETURN("%p"), oldSP)); + return(oldSP); +} + +static void _nc_free_keytry(struct tries *kt) +{ + if (kt != 0) { + _nc_free_keytry(kt->child); + _nc_free_keytry(kt->sibling); + free(kt); + } +} + +/* + * Free the storage associated with the given SCREEN sp. + */ +void delscreen(SCREEN *sp) +{ + T((T_CALLED("delscreen(%p)"), sp)); + + _nc_freewin(sp->_curscr); + _nc_freewin(sp->_newscr); + _nc_freewin(sp->_stdscr); + _nc_free_keytry(sp->_keytry); + + FreeIfNeeded(sp->_color_table); + FreeIfNeeded(sp->_color_pairs); + + free(sp); + + /* + * If this was the current screen, reset everything that the + * application might try to use (except cur_term, which may have + * multiple references in different screens). + */ + if (sp == SP) { + curscr = 0; + newscr = 0; + stdscr = 0; + COLORS = 0; + COLOR_PAIRS = 0; + _nc_set_screen(0); + } + returnVoid; +} + +ripoff_t rippedoff[5], *rsp = rippedoff; +#define N_RIPS (int)(sizeof(rippedoff)/sizeof(rippedoff[0])) + +int _nc_setupscreen(short slines, short const scolumns, FILE *output) +/* OS-independent screen initializations */ +{ +int bottom_stolen = 0, i; + + if (!_nc_alloc_screen()) + return ERR; + + _nc_set_buffer(output, TRUE); + SP->_term = cur_term; + SP->_lines = slines; + SP->_lines_avail = slines; + SP->_columns = scolumns; + SP->_cursrow = -1; + SP->_curscol = -1; + SP->_keytry = UNINITIALISED; + SP->_nl = TRUE; + SP->_raw = FALSE; + SP->_cbreak = FALSE; + SP->_echo = FALSE; + SP->_fifohead = -1; + SP->_fifotail = 0; + SP->_fifopeek = 0; + SP->_endwin = TRUE; + SP->_ofp = output; + SP->_coloron = 0; + SP->_curscr = 0; + SP->_newscr = 0; + SP->_stdscr = 0; + SP->_topstolen = 0; + SP->_cursor = -1; /* cannot know real cursor shape */ + + init_acs(); + + T(("creating newscr")); + if ((newscr = newwin(slines, scolumns, 0, 0)) == 0) + return ERR; + + T(("creating curscr")); + if ((curscr = newwin(slines, scolumns, 0, 0)) == 0) + return ERR; + + SP->_newscr = newscr; + SP->_curscr = curscr; + + newscr->_clear = TRUE; + curscr->_clear = FALSE; + + for (i=0, rsp = rippedoff; rsp->line && (i < N_RIPS); rsp++, i++) { + if (rsp->hook) { + WINDOW *w; + int count = (rsp->line < 0) ? -rsp->line : rsp->line; + + if (rsp->line < 0) { + w = newwin(count,scolumns,SP->_lines_avail - count,0); + if (w) { + rsp->w = w; + rsp->hook(w, scolumns); + bottom_stolen += count; + } + else + return ERR; + } else { + w = newwin(count,scolumns, 0, 0); + if (w) { + rsp->w = w; + rsp->hook(w, scolumns); + SP->_topstolen += count; + } + else + return ERR; + } + SP->_lines_avail -= count; + } + } + + T(("creating stdscr")); + assert ((SP->_lines_avail + SP->_topstolen + bottom_stolen) == slines); + if ((stdscr = newwin(LINES = SP->_lines_avail, scolumns, 0, 0)) == 0) + return ERR; + SP->_stdscr = stdscr; + + def_shell_mode(); + def_prog_mode(); + + return OK; +} + +/* The internal implementation interprets line as the number of + lines to rip off from the top or bottom. + */ +int +_nc_ripoffline(int line, int (*init)(WINDOW *,int)) +{ + if (line == 0) + return(OK); + + if (rsp >= rippedoff + N_RIPS) + return(ERR); + + rsp->line = line; + rsp->hook = init; + rsp->w = 0; + rsp++; + + return(OK); +} + +int +ripoffline(int line, int (*init)(WINDOW *, int)) +{ + T((T_CALLED("ripoffline(%d,%p)"), line, init)); + + if (line == 0) + returnCode(OK); + + returnCode(_nc_ripoffline ((line<0) ? -1 : 1, init)); +} diff --git a/ncurses/lib_setup.c b/ncurses/lib_setup.c new file mode 100644 index 00000000..9a194b54 --- /dev/null +++ b/ncurses/lib_setup.c @@ -0,0 +1,300 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * Terminal setup routines common to termcap and terminfo: + * + * use_env(bool) + * setupterm(char *, int, int *) + */ + +#include + +#ifdef SVR4_TERMIO +#define _POSIX_SOURCE +#endif + +#include /* lines, columns, cur_term */ + +MODULE_ID("$Id: lib_setup.c,v 1.24 1997/03/08 21:25:44 tom Exp $") + +/**************************************************************************** + * + * Terminal size computation + * + ****************************************************************************/ + +#if !defined(sun) || !HAVE_TERMIOS_H +#include +#endif + +static int _use_env = TRUE; + +static void do_prototype(void); + +void use_env(bool f) +{ + _use_env = f; +} + +int LINES, COLS, TABSIZE; + +void _nc_get_screensize(void) +/* set LINES and COLS from the environment and/or terminfo entry */ +{ +char *rows, *cols; + + /* figure out the size of the screen */ + T(("screen size: terminfo lines = %d columns = %d", lines, columns)); + + if (!_use_env) + { + LINES = (int)lines; + COLS = (int)columns; + } + else /* usually want to query LINES and COLUMNS from environment */ + { + LINES = COLS = 0; + + /* first, look for environment variables */ + rows = getenv("LINES"); + if (rows != (char *)NULL) + LINES = atoi(rows); + cols = getenv("COLUMNS"); + if (cols != (char *)NULL) + COLS = atoi(cols); + T(("screen size: environment LINES = %d COLUMNS = %d",LINES,COLS)); + +#if defined(TIOCGWINSZ) && !BROKEN_TIOCGWINSZ + /* if that didn't work, maybe we can try asking the OS */ + if (LINES <= 0 || COLS <= 0) + { + if (isatty(cur_term->Filedes)) + { + struct winsize size; + + errno = 0; + do { + if (ioctl(cur_term->Filedes, TIOCGWINSZ, &size) < 0 + && errno != EINTR) + goto failure; + } while + (errno == EINTR); + + LINES = (int)size.ws_row; + COLS = (int)size.ws_col; + } + /* FALLTHRU */ + failure:; + } +#endif /* defined(TIOCGWINSZ) && !defined(BROKEN_TIOCGWINSZ) */ + + /* if we can't get dynamic info about the size, use static */ + if (LINES <= 0 || COLS <= 0) + if (lines > 0 && columns > 0) + { + LINES = (int)lines; + COLS = (int)columns; + } + + /* the ultimate fallback, assume fixed 24x80 size */ + if (LINES <= 0 || COLS <= 0) + { + LINES = 24; + COLS = 80; + } + + /* + * Put the derived values back in the screen-size caps, so + * tigetnum() and tgetnum() will do the right thing. + */ + lines = (short)LINES; + columns = (short)COLS; + } + + T(("screen size is %dx%d", LINES, COLS)); + +#ifdef init_tabs + if (init_tabs != -1) + TABSIZE = (int)init_tabs; + else +#endif /* init_tabs */ + TABSIZE = 8; + T(("TABSIZE = %d", TABSIZE)); + +} + +/**************************************************************************** + * + * Terminal setup + * + ****************************************************************************/ + +#define ret_error(code, fmt, arg) if (errret) {\ + *errret = code;\ + returnCode(ERR);\ + } else {\ + fprintf(stderr, fmt, arg);\ + exit(EXIT_FAILURE);\ + } + +#define ret_error0(code, msg) if (errret) {\ + *errret = code;\ + returnCode(ERR);\ + } else {\ + fprintf(stderr, msg);\ + exit(EXIT_FAILURE);\ + } + +static int grab_entry(const char *const tn, TERMTYPE *const tp) +/* return 1 if entry found, 0 if not found, -1 if database not accessible */ +{ + char filename[PATH_MAX]; + int status; + + if ((status = _nc_read_entry(tn, filename, tp)) == 1) + return(1); + +#ifndef PURE_TERMINFO + /* + * Try falling back on the termcap file. Note: allowing this call + * links the entire terminfo/termcap compiler into the startup code. + * It's preferable to build a real terminfo database and use that. + */ + status = _nc_read_termcap_entry(tn, tp); +#endif /* PURE_TERMINFO */ + + return(status); +} + +char ttytype[NAMESIZE]; + +/* + * setupterm(termname, Filedes, errret) + * + * Find and read the appropriate object file for the terminal + * Make cur_term point to the structure. + * + */ + +int setupterm(const char *tname, int Filedes, int *errret) +{ +struct term *term_ptr; +int status; + + T((T_CALLED("setupterm(\"%s\",%d,%p)"), tname, Filedes, errret)); + + if (tname == NULL) { + tname = getenv("TERM"); + if (tname == NULL) + ret_error0(-1, "TERM environment variable not set.\n"); + } + + T(("your terminal name is %s", tname)); + + term_ptr = typeCalloc(TERMINAL, 1); + + if (term_ptr == NULL) + ret_error0(-1, "Not enough memory to create terminal structure.\n") ; + status = grab_entry(tname, &term_ptr->type); + + /* try fallback list if entry on disk */ + if (status != 1) + { + const TERMTYPE *fallback = _nc_fallback(tname); + + if (fallback) + { + memcpy(&term_ptr->type, fallback, sizeof(TERMTYPE)); + status = 1; + } + } + + if (status == -1) + { + ret_error0(-1, "terminals database is inaccessible\n"); + } + else if (status == 0) + { + ret_error(0, "'%s': unknown terminal type.\n", tname); + } + + cur_term = term_ptr; + if (generic_type) + ret_error(0, "'%s': I need something more specific.\n", tname); + if (hard_copy) + ret_error(1, "'%s': I can't handle hardcopy terminals.\n", tname); + + if (command_character && getenv("CC")) + do_prototype(); + + strncpy(ttytype, cur_term->type.term_names, NAMESIZE - 1); + ttytype[NAMESIZE - 1] = '\0'; + + /* + * Allow output redirection. This is what SVr3 does. + * If stdout is directed to a file, screen updates go + * to standard error. + */ + if (Filedes == STDOUT_FILENO && !isatty(Filedes)) + Filedes = STDERR_FILENO; + cur_term->Filedes = Filedes; + + _nc_get_screensize(); + + if (errret) + *errret = 1; + + T((T_CREATE("screen %s %dx%d"), tname, LINES, COLS)); + + returnCode(OK); +} + +/* +** do_prototype() +** +** Take the real command character out of the CC environment variable +** and substitute it in for the prototype given in 'command_character'. +** +*/ + +static void +do_prototype(void) +{ +int i, j; +char CC; +char proto; +char *tmp; + + tmp = getenv("CC"); + CC = *tmp; + proto = *command_character; + + for (i=0; i < STRCOUNT; i++) { + j = 0; + while (cur_term->type.Strings[i][j]) { + if (cur_term->type.Strings[i][j] == proto) + cur_term->type.Strings[i][j] = CC; + j++; + } + } +} diff --git a/ncurses/lib_slk.c b/ncurses/lib_slk.c new file mode 100644 index 00000000..b1124e85 --- /dev/null +++ b/ncurses/lib_slk.c @@ -0,0 +1,443 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* + * lib_slk.c + * Soft key routines. + */ + +#include + +#include +#include /* num_labels, label_*, plab_norm */ + +MODULE_ID("$Id: lib_slk.c,v 1.11 1997/01/18 23:06:32 tom Exp $") + +#define MAX_SKEY_OLD 8 /* count of soft keys */ +#define MAX_SKEY_LEN_OLD 8 /* max length of soft key text */ +#define MAX_SKEY_PC 12 /* This is what most PC's have */ +#define MAX_SKEY_LEN_PC 5 + +#define MAX_SKEY (SLK_STDFMT ? MAX_SKEY_OLD : MAX_SKEY_PC) +#define MAX_SKEY_LEN (SLK_STDFMT ? MAX_SKEY_LEN_OLD : MAX_SKEY_LEN_PC) +/* + * We'd like to move these into the screen context structure, but cannot, + * because slk_init() is called before initscr()/newterm(). + */ +int _nc_slk_format; /* one more than format specified in slk_init() */ + +static chtype _slk_attr = A_STANDOUT; /* soft label attribute */ +static SLK *_slk; +static void slk_paint_info(WINDOW *win); + +/* + * Fetch the label text. + */ + +char * +slk_label(int n) +{ + T(("slk_label(%d)", n)); + + if (SP->_slk == NULL || n < 1 || n > SP->_slk->labcnt) + return NULL; + return(SP->_slk->ent[n-1].text); +} + +/* + * Write the soft labels to the soft-key window. + */ + +static void +slk_intern_refresh(SLK *slk) +{ +int i; + for (i = 0; i < slk->labcnt; i++) { + if (slk->dirty || slk->ent[i].dirty) { + if (slk->ent[i].visible) { +#ifdef num_labels + if (num_labels > 0 && SLK_STDFMT) + { + if (i < num_labels) { + TPUTS_TRACE("plab_norm"); + putp(tparm(plab_norm, i, slk->win,slk->ent[i].form_text)); + } + } + else +#endif /* num_labels */ + { + wmove(slk->win,SLK_LINES-1,slk->ent[i].x); + wattrset(slk->win,_slk_attr); + waddnstr(slk->win,slk->ent[i].form_text, MAX_SKEY_LEN); + /* if we simulate SLK's, it's looking much more + natural to use the current ATTRIBUTE also + for the label window */ + wattrset(slk->win,stdscr->_attrs); + } + } + slk->ent[i].dirty = FALSE; + } + } + slk->dirty = FALSE; + +#ifdef num_labels + if (num_labels > 0) + if (slk->hidden) + { + TPUTS_TRACE("label_off"); + putp(label_off); + } + else + { + TPUTS_TRACE("label_on"); + putp(label_on); + } +#endif /* num_labels */ +} + +/* + * Refresh the soft labels. + */ + +int +slk_noutrefresh(void) +{ + T(("slk_noutrefresh()")); + + if (SP->_slk == NULL) + return(ERR); + if (SP->_slk->hidden) + return(OK); + slk_intern_refresh(SP->_slk); + return(wnoutrefresh(SP->_slk->win)); +} + +/* + * Refresh the soft labels. + */ + +int +slk_refresh(void) +{ + T(("slk_refresh()")); + + if (SP->_slk == NULL) + return(ERR); + if (SP->_slk->hidden) + return(OK); + slk_intern_refresh(SP->_slk); + return(wrefresh(SP->_slk->win)); +} + +/* + * Restore the soft labels on the screen. + */ + +int +slk_restore(void) +{ + T(("slk_restore()")); + + if (SP->_slk == NULL) + return(ERR); + SP->_slk->hidden = FALSE; + SP->_slk->dirty = TRUE; + /* we have to repaint info line eventually */ + slk_paint_info(SP->_slk->win); + return slk_refresh(); +} + +/* + * Set soft label text. + */ + +int +slk_set(int i, const char *astr, int format) +{ +SLK *slk = SP->_slk; +size_t len; +const char *str = astr; +const char *p; + + T(("slk_set(%d, \"%s\", %d)", i, str, format)); + + if (slk == NULL || i < 1 || i > slk->labcnt || format < 0 || format > 2) + return(ERR); + if (str == NULL) + str = ""; + + while (isspace(*str)) str++; /* skip over leading spaces */ + p = str; + while (isprint(*p)) p++; /* The first non-print stops */ + + --i; /* Adjust numbering of labels */ + + len = (size_t)(p - str); + if (len > (unsigned)slk->maxlen) + len = slk->maxlen; + if (len==0) + slk->ent[i].text[0] = 0; + else + (void) strncpy(slk->ent[i].text, str, len); + memset(slk->ent[i].form_text,' ', (unsigned)slk->maxlen); + slk->ent[i].text[slk->maxlen] = 0; + /* len = strlen(slk->ent[i].text); */ + + switch(format) { + case 0: /* left-justified */ + memcpy(slk->ent[i].form_text, + slk->ent[i].text, + len); + break; + case 1: /* centered */ + memcpy(slk->ent[i].form_text+(slk->maxlen - len)/2, + slk->ent[i].text, + len); + break; + case 2: /* right-justified */ + memcpy(slk->ent[i].form_text+ slk->maxlen - len, + slk->ent[i].text, + len); + break; + } + slk->ent[i].form_text[slk->maxlen] = 0; + slk->ent[i].dirty = TRUE; + return(OK); +} + +/* + * Force the code to believe that the soft keys have been changed. + */ + +int +slk_touch(void) +{ + T(("slk_touch()")); + + if (SP->_slk == NULL) + return(ERR); + SP->_slk->dirty = TRUE; + return(OK); +} + +/* + * Remove soft labels from the screen. + */ + +int +slk_clear(void) +{ + T(("slk_clear()")); + + if (SP->_slk == NULL) + return(ERR); + SP->_slk->hidden = TRUE; + /* For simulated SLK's it's looks much more natural to + inherit those attributes from the standard screen */ + SP->_slk->win->_bkgd = stdscr->_bkgd; + SP->_slk->win->_attrs = stdscr->_attrs; + werase(SP->_slk->win); + return wrefresh(SP->_slk->win); +} + +/* + * Paint the info line for the PC style SLK emulation. + * + */ + +static void +slk_paint_info(WINDOW *win) +{ + if (win && _nc_slk_format==4) + { + int i; + + mvwhline (win,0,0,0,getmaxx(win)); + wmove (win,0,0); + + for (i = 0; i < _slk->maxlab; i++) { + if (win && _nc_slk_format==4) + { + mvwaddch(win,0,_slk->ent[i].x,'F'); + if (i<9) + waddch(win,'1'+i); + else + { + waddch(win,'1'); + waddch(win,'0' + (i-9)); + } + } + } + } +} + +/* + * Initialize soft labels. + * Called from newterm() + */ + +int +_nc_slk_initialize(WINDOW *stwin, int cols) +{ +int i, x; +char *p; + + T(("slk_initialize()")); + + if (_slk) + { /* we did this already, so simply return */ + SP->_slk = _slk; + return(OK); + } + else + if ((SP->_slk = _slk = typeCalloc(SLK, 1)) == 0) + return(ERR); + + _slk->ent = NULL; + _slk->buffer = NULL; + +#ifdef num_labels + _slk->maxlab = (num_labels > 0) ? num_labels : MAX_SKEY; + _slk->maxlen = (num_labels > 0) ? label_width * label_height : MAX_SKEY_LEN; + _slk->labcnt = (_slk->maxlab < MAX_SKEY) ? MAX_SKEY : _slk->maxlab; +#else + _slk->labcnt = _slk->maxlab = MAX_SKEY; + _slk->maxlen = MAX_SKEY_LEN; +#endif /* num_labels */ + + _slk->ent = typeCalloc(slk_ent, _slk->labcnt); + if (_slk->ent == NULL) + goto exception; + + p = _slk->buffer = (char*) calloc(2*_slk->labcnt,(1+_slk->maxlen)); + if (_slk->buffer == NULL) + goto exception; + + for (i = 0; i < _slk->labcnt; i++) { + _slk->ent[i].text = p; + p += (1 + _slk->maxlen); + _slk->ent[i].form_text = p; + p += (1 + _slk->maxlen); + memset(_slk->ent[i].form_text, ' ', (unsigned)_slk->maxlen); + _slk->ent[i].visible = (i < _slk->maxlab); + } + if (_nc_slk_format >= 3) /* PC style */ + { + int gap = (cols - 3 * (3 + 4*_slk->maxlen))/2; + + if (gap < 1) + gap = 1; + + for (i = x = 0; i < _slk->maxlab; i++) { + _slk->ent[i].x = x; + x += _slk->maxlen; + x += (i==3 || i==7) ? gap : 1; + } + if (_nc_slk_format == 4) + slk_paint_info (stwin); + } + else { + if (_nc_slk_format == 2) { /* 4-4 */ + int gap = cols - (_slk->maxlab * _slk->maxlen) - 6; + + if (gap < 1) + gap = 1; + for (i = x = 0; i < _slk->maxlab; i++) { + _slk->ent[i].x = x; + x += _slk->maxlen; + x += (i == 3) ? gap : 1; + } + } + else + { + if (_nc_slk_format == 1) { /* 1 -> 3-2-3 */ + int gap = (cols - (_slk->maxlab * _slk->maxlen) - 5) / 2; + + if (gap < 1) + gap = 1; + for (i = x = 0; i < _slk->maxlab; i++) { + _slk->ent[i].x = x; + x += _slk->maxlen; + x += (i == 2 || i == 4) ? gap : 1; + } + } + else + goto exception; + } + } + _slk->dirty = TRUE; + if ((_slk->win = stwin) == NULL) + { + exception: + if (_slk) + { + FreeIfNeeded(_slk->buffer); + FreeIfNeeded(_slk->ent); + free(_slk); + SP->_slk = _slk = (SLK*)0; + return(ERR); + } + } + + return(OK); +} + +/* + * Initialize soft labels. Called by the user before initscr(). + */ + +int +slk_init(int format) +{ + if (format < 0 || format > 3) + return(ERR); + _nc_slk_format = 1 + format; + return(OK); +} + +/* Functions to manipulate the soft-label attribute */ + +int +slk_attrset(const attr_t attr) +{ + _slk_attr = attr; + return(OK); +} + +int +slk_attron(const attr_t attr) +{ + toggle_attr_on(_slk_attr,attr); + return(OK); +} + +int +slk_attroff(const attr_t attr) +{ + toggle_attr_off(_slk_attr,attr); + return(OK); +} + +attr_t +slk_attr(void) +{ + return _slk_attr; +} diff --git a/ncurses/lib_termcap.c b/ncurses/lib_termcap.c new file mode 100644 index 00000000..e0fac6f8 --- /dev/null +++ b/ncurses/lib_termcap.c @@ -0,0 +1,226 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +#include + +#include +#include + +#define __INTERNAL_CAPS_VISIBLE +#include + +MODULE_ID("$Id: lib_termcap.c,v 1.13 1996/12/21 14:24:06 tom Exp $") + +/* + some of the code in here was contributed by: + Magnus Bengtsson, d6mbeng@dtek.chalmers.se +*/ + +char PC; +char *UP; +char *BC; +short ospeed; + +/*************************************************************************** + * + * tgetent(bufp, term) + * + * In termcap, this function reads in the entry for terminal `term' into the + * buffer pointed to by bufp. It must be called before any of the functions + * below are called. + * In this terminfo emulation, tgetent() simply calls setupterm() (which + * does a bit more than tgetent() in termcap does), and returns its return + * value (1 if successful, 0 if no terminal with the given name could be + * found, or -1 if no terminal descriptions have been installed on the + * system). The bufp argument is ignored. + * + ***************************************************************************/ + +int tgetent(char *bufp GCC_UNUSED, const char *name) +{ +int errcode; +#if defined(TERMIOS) +speed_t speed; +#endif + + T(("calling tgetent")); + setupterm((char *)name, STDOUT_FILENO, &errcode); + + if (errcode != 1) + return(errcode); + + if (cursor_left) + if ((backspaces_with_bs = !strcmp(cursor_left, "\b")) == 0) + backspace_if_not_bs = cursor_left; + + /* we're required to export these */ + if (pad_char != NULL) + PC = pad_char[0]; + if (cursor_up != NULL) + UP = cursor_up; + if (backspace_if_not_bs != NULL) + BC = backspace_if_not_bs; +#if defined(TERMIOS) + /* + * Back-convert to the funny speed encoding used by the old BSD + * curses library. Method suggested by Andrey Chernov + * + */ + if ((speed = cfgetospeed(&cur_term->Nttyb)) < 1) + ospeed = 1; /* assume lowest non-hangup speed */ + else + { + const speed_t *sp; + static const speed_t speeds[] = { +#ifdef B115200 + B115200, +#endif +#ifdef B57600 + B57600, +#endif +#ifdef B38400 + B38400, +#else +#ifdef EXTB + EXTB, +#endif +#endif /* B38400 */ +#ifdef B19200 + B19200, +#else +#ifdef EXTA + EXTA, +#endif +#endif /* B19200 */ + B9600, + B4800, + B2400, + B1800, + B1200, + B600, + B300, + B200, + B150, + B134, + B110, + B75, + B50, + B0, + }; +#define MAXSPEED sizeof(speeds)/sizeof(speeds[0]) + + for (sp = speeds; sp < speeds + MAXSPEED; sp++) { + if (sp[0] <= speed) { + break; + } + } + ospeed = MAXSPEED - (sp - speeds); + } +#else + ospeed = cur_term->Nttyb.sg_ospeed; +#endif + +/* LINT_PREPRO +#if 0*/ +#include +/* LINT_PREPRO +#endif*/ + + return errcode; +} + +/*************************************************************************** + * + * tgetflag(str) + * + * Look up boolean termcap capability str and return its value (TRUE=1 if + * present, FALSE=0 if not). + * + ***************************************************************************/ + +int tgetflag(const char *id) +{ +int i; + + T(("tgetflag: %s", id)); + for (i = 0; i < BOOLCOUNT; i++) + if (!strcmp(id, boolcodes[i])) + return cur_term->type.Booleans[i]; + return ERR; +} + +/*************************************************************************** + * + * tgetnum(str) + * + * Look up numeric termcap capability str and return its value, or -1 if + * not given. + * + ***************************************************************************/ + +int tgetnum(const char *id) +{ +int i; + + T(("tgetnum: %s", id)); + for (i = 0; i < NUMCOUNT; i++) + if (!strcmp(id, numcodes[i])) + return cur_term->type.Numbers[i]; + return ERR; +} + +/*************************************************************************** + * + * tgetstr(str, area) + * + * Look up string termcap capability str and return a pointer to its value, + * or NULL if not given. + * + ***************************************************************************/ + +char *tgetstr(const char *id, char **area GCC_UNUSED) +{ +int i; + + T(("tgetstr: %s", id)); + for (i = 0; i < STRCOUNT; i++) { + T(("trying %s", strcodes[i])); + if (!strcmp(id, strcodes[i])) { + T(("found match : %s", cur_term->type.Strings[i])); + return cur_term->type.Strings[i]; + } + } + return NULL; +} + +/* + * char * + * tgoto(string, x, y) + * + * Retained solely for upward compatibility. Note the intentional + * reversing of the last two arguments. + * + */ + +char *tgoto(const char *string, int x, int y) +{ + return(tparm((char *)string, y, x)); +} diff --git a/ncurses/lib_ti.c b/ncurses/lib_ti.c new file mode 100644 index 00000000..41117f0b --- /dev/null +++ b/ncurses/lib_ti.c @@ -0,0 +1,67 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +#include + +#include +#include + +MODULE_ID("$Id: lib_ti.c,v 1.7 1996/12/21 14:24:06 tom Exp $") + +int tigetflag(const char *str) +{ +int i; + + T(("tigetflag(%s)", str)); + + for (i = 0; i < BOOLCOUNT; i++) + if (!strcmp(str, boolnames[i])) + return cur_term->type.Booleans[i]; + + return ABSENT_BOOLEAN; +} + +int tigetnum(const char *str) +{ +int i; + + T(("tigetnum(%s)", str)); + + for (i = 0; i < NUMCOUNT; i++) + if (!strcmp(str, numnames[i])) + return cur_term->type.Numbers[i]; + + return CANCELLED_NUMERIC; +} + +char *tigetstr(const char *str) +{ +int i; + + T(("tigetstr(%s)", str)); + + for (i = 0; i < STRCOUNT; i++) + if (!strcmp(str, strnames[i])) + return cur_term->type.Strings[i]; + + return CANCELLED_STRING; +} diff --git a/ncurses/lib_touch.c b/ncurses/lib_touch.c new file mode 100644 index 00000000..82ef92c5 --- /dev/null +++ b/ncurses/lib_touch.c @@ -0,0 +1,70 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* +** lib_touch.c +** +** The routines untouchwin(), +** wtouchln(), +** is_linetouched() +** is_wintouched(). +** +*/ + +#include + +MODULE_ID("$Id: lib_touch.c,v 1.3 1997/02/02 00:26:15 tom Exp $") + +int is_linetouched(WINDOW *win, int line) +{ + T((T_CALLED("is_linetouched(%p,%d)"), win, line)); + + /* XSI doesn't define any error */ + if (line > win->_maxy || line < 0) + returnCode(ERR); + + returnCode(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE); +} + +int is_wintouched(WINDOW *win) +{ +int i; + + T((T_CALLED("is_wintouched(%p)"), win)); + + for (i = 0; i <= win->_maxy; i++) + if (win->_line[i].firstchar != _NOCHANGE) + returnCode(TRUE); + returnCode(FALSE); +} + +int wtouchln(WINDOW *win, int y, int n, int changed) +{ +int i; + + T((T_CALLED("wtouchln(%p,%d,%d,%d)"), win, y, n, changed)); + + for (i = y; i < y+n; i++) { + win->_line[i].firstchar = changed ? 0 : _NOCHANGE; + win->_line[i].lastchar = changed ? win->_maxx : _NOCHANGE; + } + returnCode(OK); +} diff --git a/ncurses/lib_tparm.c b/ncurses/lib_tparm.c new file mode 100644 index 00000000..26b5691a --- /dev/null +++ b/ncurses/lib_tparm.c @@ -0,0 +1,533 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * tparm.c + * + */ + +#include + +#include + +MODULE_ID("$Id: lib_tparm.c,v 1.18 1997/04/26 18:37:50 tom Exp $") + +/* + * char * + * tparm(string, ...) + * + * Substitute the given parameters into the given string by the following + * rules (taken from terminfo(5)): + * + * Cursor addressing and other strings requiring parame- + * ters in the terminal are described by a parameterized string + * capability, with like escapes %x in it. For example, to + * address the cursor, the cup capability is given, using two + * parameters: the row and column to address to. (Rows and + * columns are numbered from zero and refer to the physical + * screen visible to the user, not to any unseen memory.) If + * the terminal has memory relative cursor addressing, that can + * be indicated by + * + * The parameter mechanism uses a stack and special % + * codes to manipulate it. Typically a sequence will push one + * of the parameters onto the stack and then print it in some + * format. Often more complex operations are necessary. + * + * The % encodings have the following meanings: + * + * %% outputs `%' + * %d print pop() like %d in printf() + * %2d print pop() like %2d in printf() + * %02d print pop() like %02d in printf() + * %3d print pop() like %3d in printf() + * %03d print pop() like %03d in printf() + * %2x print pop() like %2x in printf() + * %02x print pop() like %02x in printf() + * %3x print pop() like %3x in printf() + * %03x print pop() like %03x in printf() + * %c print pop() like %c in printf() + * %s print pop() like %s in printf() + * + * %p[1-9] push ith parm + * %P[a-z] set variable [a-z] to pop() + * %g[a-z] get variable [a-z] and push it + * %'c' push char constant c + * %{nn} push integer constant nn + * + * %+ %- %* %/ %m + * arithmetic (%m is mod): push(pop() op pop()) + * %& %| %^ bit operations: push(pop() op pop()) + * %= %> %< logical operations: push(pop() op pop()) + * %A %O logical and & or operations for conditionals + * %! %~ unary operations push(op pop()) + * %i add 1 to first two parms (for ANSI terminals) + * + * %? expr %t thenpart %e elsepart %; + * if-then-else, %e elsepart is optional. + * else-if's are possible ala Algol 68: + * %? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e c4 %t b4 %e b5 %; + * + * For those of the above operators which are binary and not commutative, + * the stack works in the usual way, with + * %gx %gy %m + * resulting in x mod y, not the reverse. + */ + +#define L_BRACE '{' +#define R_BRACE '}' + +#define STACKSIZE 20 + +typedef union { + unsigned int num; + char *str; +} stack_frame; + +static stack_frame stack[STACKSIZE]; +static int stack_ptr; +#ifdef TRACE +static const char *tname; +#endif /* TRACE */ + +static char *out_buff; +static size_t out_size; +static size_t out_used; + +#if NO_LEAKS +void _nc_free_tparm(void) +{ + if (out_buff != 0) { + FreeAndNull(out_buff); + out_size = 0; + out_used = 0; + } +} +#endif + +static void save_text(char *s) +{ + size_t want = strlen(s); + size_t need = want + out_used + 1; + + if (need > out_size) { + out_size = need * 2; + if (out_buff == 0) + out_buff = malloc(out_size); + else + out_buff = realloc(out_buff, out_size); + } + (void)strcpy(out_buff + out_used, s); + out_used += want; +} + +static void save_number(const char *fmt, int number) +{ + char temp[80]; + (void)sprintf(temp, fmt, number); + save_text(temp); +} + +static inline void save_char(int c) +{ + static char text[2]; + text[0] = c; + save_text(text); +} + +static inline void npush(int x) +{ + if (stack_ptr < STACKSIZE) { + stack[stack_ptr].num = x; + stack_ptr++; + } +} + +static inline int npop(void) +{ + return (stack_ptr > 0 ? stack[--stack_ptr].num : 0); +} + +static inline char *spop(void) +{ + return (stack_ptr > 0 ? stack[--stack_ptr].str : 0); +} + +static inline char *tparam_internal(const char *string, va_list ap) +{ +int param[9]; +int popcount; +int variable[26]; +char len; +int number; +int level; +int x, y; +int i; +register const char *cp; + + out_used = 0; + if (string == NULL) + return NULL; + + /* + * Find the highest parameter-number referred to in the format string. + * Use this value to limit the number of arguments copied from the + * variable-length argument list. + */ + for (cp = string, popcount = number = 0; *cp != '\0'; cp++) { + if (cp[0] == '%' && cp[1] != '\0') { + switch (cp[1]) { + case '%': + cp++; + break; + case 'i': + if (popcount < 2) + popcount = 2; + break; + case 'p': + cp++; + if (cp[1] >= '1' && cp[1] <= '9') { + int c = cp[1] - '0'; + if (c > popcount) + popcount = c; + } + break; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case 'd': case 'c': case 's': + ++number; + break; + } + } + } + + if (number > 9) number = 9; + for (i = 0; i < max(popcount, number); i++) { + /* + * FIXME: potential loss here if sizeof(int) != sizeof(char *). + * A few caps (such as plab_norm) have string-valued parms. + */ + param[i] = va_arg(ap, int); + } + + /* + * This is a termcap compatibility hack. If there are no explicit pop + * operations in the string, load the stack in such a way that + * successive pops will grab successive parameters. That will make + * the expansion of (for example) \E[%d;%dH work correctly in termcap + * style, which means tparam() will expand termcap strings OK. + */ + stack_ptr = 0; + if (popcount == 0) { + popcount = number; + for (i = number - 1; i >= 0; i--) + npush(param[i]); + } + +#ifdef TRACE + if (_nc_tracing & TRACE_CALLS) { + for (i = 0; i < popcount; i++) + save_number(", %d", param[i]); + _tracef(T_CALLED("%s(%s%s)"), tname, _nc_visbuf(string), out_buff); + out_used = 0; + } +#endif /* TRACE */ + + while (*string) { + if (*string != '%') + save_char(*string); + else { + string++; + switch (*string) { + default: + break; + case '%': + save_char('%'); + break; + + case 'd': + save_number("%d", npop()); + break; + + case 'x': + save_number("%x", npop()); + break; + + case '0': + string++; + len = *string; + if (len == '2' || len == '3') + { + ++string; + if (*string == 'd') { + if (len == '2') + save_number("%02d", npop()); + else + save_number("%03d", npop()); + } + else if (*string == 'x') { + if (len == '2') + save_number("%02x", npop()); + else + save_number("%03x", npop()); + } + } + break; + + case '2': + string++; + if (*string == 'd') { + save_number("%2d", npop()); + } + else if (*string == 'x') { + save_number("%2x", npop()); + } + break; + + case '3': + string++; + if (*string == 'd') { + save_number("%3d", npop()); + } + else if (*string == 'x') { + save_number("%3x", npop()); + } + break; + + case 'c': + save_char(npop()); + break; + + case 's': + save_text(spop()); + break; + + case 'p': + string++; + if (*string >= '1' && *string <= '9') + npush(param[*string - '1']); + break; + + case 'P': + string++; + if (*string >= 'a' && *string <= 'z') + variable[*string - 'a'] = npop(); + break; + + case 'g': + string++; + if (*string >= 'a' && *string <= 'z') + npush(variable[*string - 'a']); + break; + + case '\'': + string++; + npush(*string); + string++; + break; + + case L_BRACE: + number = 0; + string++; + while (*string >= '0' && *string <= '9') { + number = number * 10 + *string - '0'; + string++; + } + npush(number); + break; + + case '+': + npush(npop() + npop()); + break; + + case '-': + y = npop(); + x = npop(); + npush(x - y); + break; + + case '*': + npush(npop() * npop()); + break; + + case '/': + y = npop(); + x = npop(); + npush(x / y); + break; + + case 'm': + y = npop(); + x = npop(); + npush(x % y); + break; + + case 'A': + npush(npop() && npop()); + break; + + case 'O': + npush(npop() || npop()); + break; + + case '&': + npush(npop() & npop()); + break; + + case '|': + npush(npop() | npop()); + break; + + case '^': + npush(npop() ^ npop()); + break; + + case '=': + y = npop(); + x = npop(); + npush(x == y); + break; + + case '<': + y = npop(); + x = npop(); + npush(x < y); + break; + + case '>': + y = npop(); + x = npop(); + npush(x > y); + break; + + case '!': + npush(! npop()); + break; + + case '~': + npush(~ npop()); + break; + + case 'i': + param[0]++; + param[1]++; + break; + + case '?': + break; + + case 't': + x = npop(); + if (!x) { + /* scan forward for %e or %; at level zero */ + string++; + level = 0; + while (*string) { + if (*string == '%') { + string++; + if (*string == '?') + level++; + else if (*string == ';') { + if (level > 0) + level--; + else + break; + } + else if (*string == 'e' && level == 0) + break; + } + + if (*string) + string++; + } + } + break; + + case 'e': + /* scan forward for a %; at level zero */ + string++; + level = 0; + while (*string) { + if (*string == '%') { + string++; + if (*string == '?') + level++; + else if (*string == ';') { + if (level > 0) + level--; + else + break; + } + } + + if (*string) + string++; + } + break; + + case ';': + break; + + } /* endswitch (*string) */ + } /* endelse (*string == '%') */ + + if (*string == '\0') + break; + + string++; + } /* endwhile (*string) */ + + T((T_RETURN("%s"), _nc_visbuf(out_buff))); + return(out_buff); +} + +char *tparm(const char *string, ...) +{ +va_list ap; +char *result; + + va_start(ap, string); +#ifdef TRACE + tname = "tparm"; +#endif /* TRACE */ + result = tparam_internal(string, ap); + va_end(ap); + return result; +} + +#ifdef __UNUSED__ /* we never documented this, and it confuses Emacs */ +char *tparam(const char *string, char *buffer, int bufsiz, ...) +{ +va_list ap; +char *result = 0; + + va_start(ap, bufsiz); +#ifdef TRACE + tname = "tparam"; +#endif /* TRACE */ + if (tparam_internal(string, ap) != 0 + && (int)out_used < bufsiz) + result = strcpy(buffer, out_buff); + va_end(ap); + return result; +} +#endif /* __UNUSED */ diff --git a/ncurses/lib_tputs.c b/ncurses/lib_tputs.c new file mode 100644 index 00000000..65fa4d79 --- /dev/null +++ b/ncurses/lib_tputs.c @@ -0,0 +1,213 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * tputs.c + * delay_output() + * _nc_outch() + * tputs() + * + */ + +#include +#include +#include /* padding_baud_rate, xon_xoff */ +#include + +MODULE_ID("$Id: lib_tputs.c,v 1.18 1997/02/02 01:52:39 tom Exp $") + +int delay_output(int ms) +{ + T((T_CALLED("delay_output(%d)"), ms)); + + if (SP == 0 || SP->_baudrate <= 0) + returnCode(ERR); +#ifdef no_pad_char + else if (no_pad_char) + napms(ms); +#endif /* no_pad_char */ + else { + register int nullcount; + char null = '\0'; + +#ifdef pad_char + if (pad_char) + null = pad_char[0]; +#endif /* pad_char */ + + for (nullcount = ms * 1000 / SP->_baudrate; nullcount > 0; nullcount--) + putc(null, SP->_ofp); + (void) fflush(SP->_ofp); + } + + returnCode(OK); +} + +int _nc_outch(int ch) +{ +#ifdef TRACE + _nc_outchars++; +#endif /* TRACE */ + + if (SP != NULL) + putc(ch, SP->_ofp); + else + putc(ch, stdout); + return OK; +} + +int putp(const char *string) +{ + return tputs(string, 1, _nc_outch); +} + +int tputs(const char *string, int affcnt, int (*outc)(int)) +{ +float number; +#ifdef BSD_TPUTS +float trailpad; +#endif /* BSD_TPUTS */ + +#ifdef TRACE +char addrbuf[17]; + + if (_nc_tracing & TRACE_TPUTS) + { + if (outc == _nc_outch) + (void) strcpy(addrbuf, "_nc_outch"); + else + (void) sprintf(addrbuf, "%p", outc); + if (_nc_tputs_trace) + TR(TRACE_MAXIMUM, ("tputs(%s = %s, %d, %s) called", _nc_tputs_trace, _nc_visbuf(string), affcnt, addrbuf)); + else + TR(TRACE_MAXIMUM, ("tputs(%s, %d, %s) called", _nc_visbuf(string), affcnt, addrbuf)); + _nc_tputs_trace = (char *)NULL; + } +#endif /* TRACE */ + + if (string == ABSENT_STRING || string == CANCELLED_STRING) + return ERR; + +#ifdef BSD_TPUTS + /* + * This ugly kluge deals with the fact that some ancient BSD programs + * (like nethack) actually do the likes of tputs("50") to get delays. + */ + trailpad = 0; + number = 0; + + while (isdigit(*string)) { + trailpad = trailpad * 10 + *string - '0'; + string++; + } + + if (*string == '.') { + string++; + if (isdigit(*string)) { + trailpad += (float) (*string - '0') / 10.; + string++; + } + while (isdigit(*string)) + string++; + } + + if (*string == '*') { + trailpad *= affcnt; + string++; + } +#endif /* BSD_TPUTS */ + + while (*string) { + if (*string != '$') + (*outc)(*string); + else { + string++; + if (*string != '<') { + (*outc)('$'); + if (*string) + (*outc)(*string); + } else { + bool mandatory; + + number = 0; + string++; + + if ((!isdigit(*string) && *string != '.') || !strchr(string, '>')) { + (*outc)('$'); + (*outc)('<'); + continue; + } + while (isdigit(*string)) { + number = number * 10 + *string - '0'; + string++; + } + + if (*string == '.') { + string++; + if (isdigit(*string)) { + number += (float) (*string - '0') / 10.; + string++; + } + while (isdigit(*string)) + string++; + } + + mandatory = !xon_xoff; + while (*string == '*' || *string == '/') + { + if (*string == '*') { + number *= affcnt; + string++; + } + else /* if (*string == '/') */ { + mandatory = TRUE; + string++; + } + } + +#ifdef padding_baud_rate + if (mandatory && number > 0 && padding_baud_rate && (!SP || SP->_baudrate >= padding_baud_rate)) + delay_output(number); +#endif /* padding_baud_rate */ + number = 0; + + } /* endelse (*string == '<') */ + } /* endelse (*string == '$') */ + + if (*string == '\0') + break; + + string++; + } + +#ifdef BSD_TPUTS + /* + * Emit any BSD-style prefix padding that we've accumulated now. + */ +#ifdef padding_baud_rate + if (trailpad > 0 && !xon_xoff && padding_baud_rate && (!SP || SP->_baudrate >= padding_baud_rate)) + delay_output(number); +#endif /* padding_baud_rate */ +#endif /* BSD_TPUTS */ + + return OK; +} diff --git a/ncurses/lib_trace.c b/ncurses/lib_trace.c new file mode 100644 index 00000000..e1caeff3 --- /dev/null +++ b/ncurses/lib_trace.c @@ -0,0 +1,179 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* + * lib_trace.c - Tracing/Debugging routines + */ + +#ifndef TRACE +#define TRACE /* turn on internal defs for this module */ +#endif + +#include + +MODULE_ID("$Id: lib_trace.c,v 1.23 1997/05/02 00:13:07 tom Exp $") + +#include +#if HAVE_FCNTL_H +#include +#endif + +unsigned _nc_tracing = 0; +const char *_nc_tputs_trace = ""; +long _nc_outchars; +int _nc_optimize_enable = OPTIMIZE_ALL; + +static FILE * tracefp; /* default to writing to stderr */ + +void trace(const unsigned int tracelevel) +{ +static bool been_here = FALSE; + + _nc_tracing = tracelevel; + if (! been_here && tracelevel) { + been_here = TRUE; + + if ((tracefp = fopen("trace", "w")) == 0) { + perror("curses: Can't open 'trace' file: "); + exit(EXIT_FAILURE); + } + /* Try to set line-buffered mode, or (failing that) unbuffered, + * so that the trace-output gets flushed automatically at the + * end of each line. This is useful in case the program dies. + */ +#if HAVE_SETVBUF /* ANSI */ + (void) setvbuf(tracefp, (char *)0, _IOLBF, 0); +#elif HAVE_SETBUF /* POSIX */ + (void) setbuffer(tracefp, (char *)0); +#endif + _tracef("TRACING NCURSES version %s (%d)", + NCURSES_VERSION, NCURSES_VERSION_PATCH); + } +} + +const char *_nc_visbuf2(int bufnum, const char *buf) +/* visibilize a given string */ +{ +char *vbuf; +char *tp; +int c; + + if (buf == 0) + return("(null)"); + + tp = vbuf = _nc_trace_buf(bufnum, (strlen(buf) * 4) + 5); + *tp++ = '"'; + while ((c = *buf++) != '\0') { + if (c == '"') { + *tp++ = '\\'; *tp++ = '"'; + } else if (is7bits(c) && (isgraph(c) || c == ' ')) { + *tp++ = c; + } else if (c == '\n') { + *tp++ = '\\'; *tp++ = 'n'; + } else if (c == '\r') { + *tp++ = '\\'; *tp++ = 'r'; + } else if (c == '\b') { + *tp++ = '\\'; *tp++ = 'b'; + } else if (c == '\033') { + *tp++ = '\\'; *tp++ = 'e'; + } else if (is7bits(c) && iscntrl(c)) { + *tp++ = '\\'; *tp++ = '^'; *tp++ = '@' + c; + } else { + sprintf(tp, "\\%03o", c & 0xff); + tp += strlen(tp); + } + } + *tp++ = '"'; + *tp++ = '\0'; + return(vbuf); +} + +const char *_nc_visbuf(const char *buf) +{ + return _nc_visbuf2(0, buf); +} + +void +_tracef(const char *fmt, ...) +{ +static const char Called[] = T_CALLED(""); +static const char Return[] = T_RETURN(""); +static int level; +va_list ap; +bool before = FALSE; +bool after = FALSE; +int doit = _nc_tracing; + + if (strlen(fmt) >= sizeof(Called) - 1) { + if (!strncmp(fmt, Called, sizeof(Called)-1)) { + before = TRUE; + level++; + } else if (!strncmp(fmt, Return, sizeof(Return)-1)) { + after = TRUE; + } + if (before || after) { + if ((level <= 1) + || (doit & TRACE_ICALLS) != 0) + doit &= (TRACE_CALLS|TRACE_CCALLS); + else + doit = 0; + } + } + + if (doit != 0) { + if (tracefp == 0) + tracefp = stderr; + if (before || after) { + int n; + for (n = 1; n < level; n++) + fputs("+ ", tracefp); + } + va_start(ap, fmt); + vfprintf(tracefp, fmt, ap); + fputc('\n', tracefp); + va_end(ap); + fflush(tracefp); + } + + if (after && level) + level--; +} + +/* Trace 'int' return-values */ +int _nc_retrace_int(int code) +{ + T((T_RETURN("%d"), code)); + return code; +} + +/* Trace 'char*' return-values */ +char * _nc_retrace_ptr(char * code) +{ + T((T_RETURN("%s"), _nc_visbuf(code))); + return code; +} + +/* Trace 'WINDOW *' return-values */ +WINDOW *_nc_retrace_win(WINDOW *code) +{ + T((T_RETURN("%p"), code)); + return code; +} diff --git a/ncurses/lib_traceatr.c b/ncurses/lib_traceatr.c new file mode 100644 index 00000000..13d96a43 --- /dev/null +++ b/ncurses/lib_traceatr.c @@ -0,0 +1,230 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* + * lib_traceatr.c - Tracing/Debugging routines (attributes) + */ + +#ifndef TRACE +#define TRACE /* turn on internal defs for this module */ +#endif + +#include +#include /* acs_chars */ + +MODULE_ID("$Id: lib_traceatr.c,v 1.20 1997/05/06 11:07:27 tom Exp $") + +#define COLOR_OF(c) (c < 0 || c > 7 ? "default" : colors[c].name) + +char * _nc_trace_buf(int bufnum, size_t want) +{ + static struct { + char *text; + size_t size; + } *list; + static size_t have; + + if (bufnum < 0) + bufnum = 0; + + if ((size_t)(bufnum+1) > have) { + size_t need = (bufnum + 1) * 2; + size_t used = sizeof(*list) * need; + list = (list == 0) ? malloc(used) : realloc(list, used); + while (need > have) + list[have++].text = 0; + } + + if (list[bufnum].text == 0) + { + list[bufnum].text = malloc(want); + list[bufnum].size = want; + } + else if (want > list[bufnum].size) { + list[bufnum].text = realloc(list[bufnum].text, want); + list[bufnum].size = want; + } + *(list[bufnum].text) = '\0'; + return list[bufnum].text; +} + +char *_traceattr2(int bufnum, attr_t newmode) +{ +char *buf = _nc_trace_buf(bufnum, BUFSIZ); +char *tmp = buf; +static const struct {unsigned int val; const char *name;} +names[] = + { + { A_STANDOUT, "A_STANDOUT" }, + { A_UNDERLINE, "A_UNDERLINE" }, + { A_REVERSE, "A_REVERSE" }, + { A_BLINK, "A_BLINK" }, + { A_DIM, "A_DIM" }, + { A_BOLD, "A_BOLD" }, + { A_ALTCHARSET, "A_ALTCHARSET" }, + { A_INVIS, "A_INVIS" }, + { A_PROTECT, "A_PROTECT" }, + { A_CHARTEXT, "A_CHARTEXT" }, + { A_NORMAL, "A_NORMAL" }, + { A_COLOR, "A_COLOR" }, + }, +colors[] = + { + { COLOR_BLACK, "COLOR_BLACK" }, + { COLOR_RED, "COLOR_RED" }, + { COLOR_GREEN, "COLOR_GREEN" }, + { COLOR_YELLOW, "COLOR_YELLOW" }, + { COLOR_BLUE, "COLOR_BLUE" }, + { COLOR_MAGENTA, "COLOR_MAGENTA" }, + { COLOR_CYAN, "COLOR_CYAN" }, + { COLOR_WHITE, "COLOR_WHITE" }, + }; +size_t n; +unsigned save_nc_tracing = _nc_tracing; + _nc_tracing = 0; + + strcpy(tmp++, "{"); + + for (n = 0; n < sizeof(names)/sizeof(names[0]); n++) { + if ((newmode & names[n].val) != 0) { + if (buf[1] != '\0') + strcat(tmp, "|"); + strcat(tmp, names[n].name); + tmp += strlen(tmp); + + if (names[n].val == A_COLOR) + { + short pairnum = PAIR_NUMBER(newmode); + short fg, bg; + + if (pair_content(pairnum, &fg, &bg) == OK) + (void) sprintf(tmp, + "{%d = {%s, %s}}", + pairnum, + COLOR_OF(fg), + COLOR_OF(bg) + ); + else + (void) sprintf(tmp, "{%d}", pairnum); + } + } + } + if (AttrOf(newmode) == A_NORMAL) { + if (buf[1] != '\0') + strcat(tmp, "|"); + strcat(tmp, "A_NORMAL"); + } + + _nc_tracing = save_nc_tracing; + return (strcat(buf,"}")); +} + +char *_traceattr(attr_t newmode) +{ + return _traceattr2(0, newmode); +} + +char *_tracechtype2(int bufnum, chtype ch) +{ +char *buf = _nc_trace_buf(bufnum, BUFSIZ); +char *found = 0; + + strcpy(buf, "{"); + if (ch & A_ALTCHARSET) + { + char *cp; + static const struct {unsigned int val; const char *name;} + names[] = + { + {'l', "ACS_ULCORNER"}, /* upper left corner */ + {'m', "ACS_LLCORNER"}, /* lower left corner */ + {'k', "ACS_URCORNER"}, /* upper right corner */ + {'j', "ACS_LRCORNER"}, /* lower right corner */ + {'t', "ACS_LTEE"}, /* tee pointing right */ + {'u', "ACS_RTEE"}, /* tee pointing left */ + {'v', "ACS_BTEE"}, /* tee pointing up */ + {'w', "ACS_TTEE"}, /* tee pointing down */ + {'q', "ACS_HLINE"}, /* horizontal line */ + {'x', "ACS_VLINE"}, /* vertical line */ + {'n', "ACS_PLUS"}, /* large plus or crossover */ + {'o', "ACS_S1"}, /* scan line 1 */ + {'s', "ACS_S9"}, /* scan line 9 */ + {'`', "ACS_DIAMOND"}, /* diamond */ + {'a', "ACS_CKBOARD"}, /* checker board (stipple) */ + {'f', "ACS_DEGREE"}, /* degree symbol */ + {'g', "ACS_PLMINUS"}, /* plus/minus */ + {'~', "ACS_BULLET"}, /* bullet */ + {',', "ACS_LARROW"}, /* arrow pointing left */ + {'+', "ACS_RARROW"}, /* arrow pointing right */ + {'.', "ACS_DARROW"}, /* arrow pointing down */ + {'-', "ACS_UARROW"}, /* arrow pointing up */ + {'h', "ACS_BOARD"}, /* board of squares */ + {'I', "ACS_LANTERN"}, /* lantern symbol */ + {'0', "ACS_BLOCK"}, /* solid square block */ + {'p', "ACS_S3"}, /* scan line 3 */ + {'r', "ACS_S7"}, /* scan line 7 */ + {'y', "ACS_LEQUAL"}, /* less/equal */ + {'z', "ACS_GEQUAL"}, /* greater/equal */ + {'{', "ACS_PI"}, /* Pi */ + {'|', "ACS_NEQUAL"}, /* not equal */ + {'}', "ACS_STERLING"}, /* UK pound sign */ + {'\0',(char *)0} + }, + *sp; + + for (cp = acs_chars; cp[0] && cp[1]; cp += 2) + { + if (TextOf(cp[1]) == TextOf(ch)) + { + found = cp; + /* don't exit from loop - there may be redefinitions */ + } + } + + if (found != 0) + { + ch = TextOf(*found); + for (sp = names; sp->val; sp++) + if (sp->val == ch) + { + (void) strcat(buf, sp->name); + ch &= ~A_ALTCHARSET; + break; + } + } + } + + if (found == 0) + (void) strcat(buf, _tracechar(TextOf(ch))); + + if (AttrOf(ch) != A_NORMAL) + (void) sprintf(buf + strlen(buf), " | %s", _traceattr2(bufnum+20,AttrOf(ch))); + + strcat(buf, "}"); + return(buf); +} + +char *_tracechtype(chtype ch) +{ + return _tracechtype2(0, ch); +} diff --git a/ncurses/lib_tracechr.c b/ncurses/lib_tracechr.c new file mode 100644 index 00000000..2a4eed71 --- /dev/null +++ b/ncurses/lib_tracechr.c @@ -0,0 +1,52 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* + * lib_tracechr.c - Tracing/Debugging routines + */ + +#ifndef TRACE +#define TRACE /* turn on internal defs for this module */ +#endif + +#include + +#include + +char *_tracechar(const unsigned char ch) +{ + static char crep[20]; + /* + * We can show the actual character if it's either an ordinary printable + * or one of the high-half characters. + */ + if (isprint(ch) || (ch & 0x80)) + { + crep[0] = '\''; + crep[1] = ch; /* necessary; printf tries too hard on metachars */ + (void) sprintf(crep + 2, "' = 0x%02x", (unsigned)ch); + } + else + (void) sprintf(crep, "0x%02x", (unsigned)ch); + return(crep); +} diff --git a/ncurses/lib_tracedmp.c b/ncurses/lib_tracedmp.c new file mode 100644 index 00000000..e2c3434a --- /dev/null +++ b/ncurses/lib_tracedmp.c @@ -0,0 +1,115 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* + * lib_tracedmp.c - Tracing/Debugging routines + */ + +#ifndef TRACE +#define TRACE /* turn on internal defs for this module */ +#endif + +#include + +MODULE_ID("$Id: lib_tracedmp.c,v 1.9 1997/01/15 00:39:27 tom Exp $") + +void _tracedump(const char *name, WINDOW *win) +{ + int i, j, n, width; + + /* compute narrowest possible display width */ + for (width = i = 0; i <= win->_maxy; i++) + { + n = 0; + for (j = 0; j <= win->_maxx; j++) + if (win->_line[i].text[j] != ' ') + n = j; + + if (n > width) + width = n; + } + if (width < win->_maxx) + ++width; + + for (n = 0; n <= win->_maxy; n++) + { + char buf[BUFSIZ], *ep; + bool haveattrs, havecolors; + + /* dump A_CHARTEXT part */ + (void) sprintf(buf, "%s[%2d] %3d%3d ='", + name, n, + win->_line[n].firstchar, + win->_line[n].lastchar); + ep = buf + strlen(buf); + for (j = 0; j <= width; j++) { + ep[j] = TextOf(win->_line[n].text[j]); + if (ep[j] == 0) + ep[j] = '.'; + } + ep[j] = '\''; + ep[j+1] = '\0'; + _tracef(buf); + + /* dump A_COLOR part, will screw up if there are more than 96 */ + havecolors = FALSE; + for (j = 0; j <= width; j++) + if (win->_line[n].text[j] & A_COLOR) + { + havecolors = TRUE; + break; + } + if (havecolors) + { + (void) sprintf(buf, "%*s[%2d]%*s='", (int)strlen(name), "colors", n, 8, " "); + ep = buf + strlen(buf); + for (j = 0; j <= width; j++) + ep[j] = ((win->_line[n].text[j] >> 8) & 0xff) + ' '; + ep[j] = '\''; + ep[j+1] = '\0'; + _tracef(buf); + } + + for (i = 0; i < 4; i++) + { + const char *hex = " 123456789ABCDEF"; + chtype mask = (0xf << ((i + 4) * 4)); + + haveattrs = FALSE; + for (j = 0; j <= width; j++) + if (win->_line[n].text[j] & mask) + { + haveattrs = TRUE; + break; + } + if (haveattrs) + { + (void) sprintf(buf, "%*s%d[%2d]%*s='", (int)strlen(name)-1, "attrs", i, n, 8, " "); + ep = buf + strlen(buf); + for (j = 0; j <= width; j++) + ep[j] = hex[(win->_line[n].text[j] & mask) >> ((i + 4) * 4)]; + ep[j] = '\''; + ep[j+1] = '\0'; + _tracef(buf); + } + } + } +} diff --git a/ncurses/lib_tracemse.c b/ncurses/lib_tracemse.c new file mode 100644 index 00000000..b88ecd97 --- /dev/null +++ b/ncurses/lib_tracemse.c @@ -0,0 +1,82 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* + * lib_tracemse.c - Tracing/Debugging routines (mouse events) + */ + +#ifndef TRACE +#define TRACE /* turn on internal defs for this module */ +#endif + +#include + +MODULE_ID("$Id: lib_tracemse.c,v 1.4 1996/12/21 14:24:06 tom Exp $") + +char *_tracemouse(MEVENT const *ep) +{ + static char buf[80]; + + (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {", + ep->id, ep->x, ep->y, ep->z, ep->bstate); + +#define SHOW(m, s) if ((ep->bstate & m)==m) {strcat(buf,s); strcat(buf, ", ");} + SHOW(BUTTON1_RELEASED, "release-1") + SHOW(BUTTON1_PRESSED, "press-1") + SHOW(BUTTON1_CLICKED, "click-1") + SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1") + SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1") + SHOW(BUTTON1_RESERVED_EVENT, "reserved-1") + SHOW(BUTTON2_RELEASED, "release-2") + SHOW(BUTTON2_PRESSED, "press-2") + SHOW(BUTTON2_CLICKED, "click-2") + SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2") + SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2") + SHOW(BUTTON2_RESERVED_EVENT, "reserved-2") + SHOW(BUTTON3_RELEASED, "release-3") + SHOW(BUTTON3_PRESSED, "press-3") + SHOW(BUTTON3_CLICKED, "click-3") + SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3") + SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3") + SHOW(BUTTON3_RESERVED_EVENT, "reserved-3") + SHOW(BUTTON4_RELEASED, "release-4") + SHOW(BUTTON4_PRESSED, "press-4") + SHOW(BUTTON4_CLICKED, "click-4") + SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4") + SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4") + SHOW(BUTTON4_RESERVED_EVENT, "reserved-4") + SHOW(BUTTON_CTRL, "ctrl") + SHOW(BUTTON_SHIFT, "shift") + SHOW(BUTTON_ALT, "alt") + SHOW(ALL_MOUSE_EVENTS, "all-events") + SHOW(REPORT_MOUSE_POSITION, "position") +#undef SHOW + + if (buf[strlen(buf)-1] == ' ') + buf[strlen(buf)-2] = '\0'; + (void) strcat(buf, "}"); + return(buf); +} + + + diff --git a/ncurses/lib_tstp.c b/ncurses/lib_tstp.c new file mode 100644 index 00000000..ee7c2afb --- /dev/null +++ b/ncurses/lib_tstp.c @@ -0,0 +1,282 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* +** lib_tstp.c +** +** The routine _nc_signal_handler(). +** +*/ + +#include + +#include + +#if HAVE_SIGACTION +#if !HAVE_TYPE_SIGACTION +typedef struct sigaction sigaction_t; +#endif +#else /* !HAVE_SIGACTION */ +#if HAVE_SIGVEC +#include +#endif +#endif + +#ifdef SVR4_ACTION +#define _POSIX_SOURCE +#endif + +MODULE_ID("$Id: lib_tstp.c,v 1.8 1996/11/17 00:11:41 tom Exp $") + +/* + * Note: This code is fragile! Its problem is that different OSs + * handle restart of system calls interrupted by signals differently. + * The ncurses code needs signal-call restart to happen -- otherwise, + * interrupted wgetch() calls will return FAIL, probably making the + * application think the input stream has ended and it should + * terminate. In particular, you know you have this problem if, when + * you suspend an ncurses-using lynx with ^Z and resume, it dies + * immediately. + * + * Default behavior of POSIX sigaction(2) is not to restart + * interrupted system calls, but Linux's sigaction does it anyway (at + * least, on and after the 1.1.47 I (esr) use). Thus this code works + * OK under Linux. The 4.4BSD sigaction(2) supports a (non-portable) + * SA_RESTART flag that forces the right behavior. Thus, this code + * should work OK under BSD/OS, NetBSD, and FreeBSD (let us know if it + * does not). + * + * Stock System Vs (and anything else using a strict-POSIX + * sigaction(2) without SA_RESTART) may have a problem. Possible + * solutions: + * + * sigvec restarts by default (SV_INTERRUPT flag to not restart) + * signal restarts by default in SVr4 (assuming you link with -lucb) + * and BSD, but not SVr3. + * sigset restarts, but is only available under SVr4/Solaris. + * + * The signal(3) call is mandated by the ANSI standard, and its + * interaction with sigaction(2) is described in the POSIX standard + * (3.3.4.2, page 72,line 934). According to section 8.1, page 191, + * however, signal(3) itself is not required by POSIX.1. And POSIX is + * silent on whether it is required to restart signals. + * + * So. The present situation is, we use sigaction(2) with no + * guarantee of restart anywhere but on Linux and BSD. We could + * switch to signal(3) and collar Linux, BSD, and SVr4. Any way + * we slice it, System V UNIXes older than SVr4 will probably lose + * (this may include XENIX). + * + * This implementation will probably be changed to use signal(3) in + * the future. If nothing else, it's simpler... + */ + +#ifdef SIGTSTP +static void tstp(int dummy GCC_UNUSED) +{ + sigset_t mask, omask; + sigaction_t act, oact; + + T(("tstp() called")); + + /* + * The user may have changed the prog_mode tty bits, so save them. + */ + def_prog_mode(); + + /* + * Block window change and timer signals. The latter + * is because applications use timers to decide when + * to repaint the screen. + */ + (void)sigemptyset(&mask); + (void)sigaddset(&mask, SIGALRM); +#ifdef SIGWINCH + (void)sigaddset(&mask, SIGWINCH); +#endif + (void)sigprocmask(SIG_BLOCK, &mask, &omask); + + /* + * End window mode, which also resets the terminal state to the + * original (pre-curses) modes. + */ + endwin(); + + /* Unblock SIGTSTP. */ + (void)sigemptyset(&mask); + (void)sigaddset(&mask, SIGTSTP); + (void)sigprocmask(SIG_UNBLOCK, &mask, NULL); + + /* Now we want to resend SIGSTP to this process and suspend it */ + act.sa_handler = SIG_DFL; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; +#ifdef SA_RESTART + act.sa_flags |= SA_RESTART; +#endif /* SA_RESTART */ + sigaction(SIGTSTP, &act, &oact); + kill(getpid(), SIGTSTP); + + /* Process gets suspended...time passes...process resumes */ + + T(("SIGCONT received")); + sigaction(SIGTSTP, &oact, NULL); + flushinp(); + + /* + * If the user modified the tty state while suspended, he wants + * those changes to stick. So save the new "default" terminal state. + */ + def_shell_mode(); + + /* + * This relies on the fact that doupdate() will restore the + * program-mode tty state, and issue enter_ca_mode if need be. + */ + doupdate(); + + /* Reset the signals. */ + (void)sigprocmask(SIG_SETMASK, &omask, NULL); +} +#endif /* defined(SIGTSTP) */ + +static void cleanup(int sig) +{ + /* + * Actually, doing any sort of I/O from within an signal handler is + * "unsafe". But we'll _try_ to clean up the screen and terminal + * settings on the way out. + */ + if (sig == SIGINT + || sig == SIGQUIT) { +#if HAVE_SIGACTION || HAVE_SIGVEC + sigaction_t act; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + act.sa_handler = SIG_IGN; + if (sigaction(sig, &act, (sigaction_t *)0) == 0) { + endwin(); + } +#else + if (signal(sig, SIG_IGN) != SIG_ERR) { + endwin(); + } +#endif + } + exit(EXIT_FAILURE); +} + +/* + * If the given signal is still in its default state, set it to the given + * handler. + */ +#if HAVE_SIGACTION || HAVE_SIGVEC +static int CatchIfDefault(int sig, sigaction_t *act) +{ + sigaction_t old_act; + +#ifdef SA_RESTART + act->sa_flags |= SA_RESTART; +#endif /* SA_RESTART */ + if (sigaction(sig, (sigaction_t *)0, &old_act) == 0 + && old_act.sa_handler == SIG_DFL) { + (void)sigaction(sig, act, (sigaction_t *)0); + return TRUE; + } + return FALSE; +} +#else +static int CatchIfDefault(int sig, RETSIGTYPE (*handler)()) +{ + void (*ohandler)(); + + ohandler = signal(sig, SIG_IGN); + if (ohandler == SIG_DFL) { + signal(sig, handler); + return TRUE; + } else { + signal(sig, ohandler); + return FALSE; + } +} +#endif + +/* + * This is invoked once at the beginning (e.g., from 'initscr()'), to + * initialize the signal catchers, and thereafter when spawning a shell (and + * returning) to disable/enable the SIGTSTP (i.e., ^Z) catcher. + * + * If the application has already set one of the signals, we'll not modify it + * (during initialization). + * + * The XSI document implies that we shouldn't keep the SIGTSTP handler if + * the caller later changes its mind, but that doesn't seem correct. + */ +void _nc_signal_handler(bool enable) +{ +#ifdef SIGTSTP /* Xenix 2.x doesn't have this */ +static sigaction_t act, oact; +static int ignore; + + if (!ignore) + { + if (!enable) + { + act.sa_handler = SIG_IGN; + sigaction(SIGTSTP, &act, &oact); + } + else if (act.sa_handler) + { + sigaction(SIGTSTP, &oact, NULL); + } + else /*initialize */ + { + sigemptyset(&act.sa_mask); + act.sa_flags = 0; +#ifdef SA_RESTART + act.sa_flags |= SA_RESTART; +#endif /* SA_RESTART */ + + act.sa_handler = cleanup; + CatchIfDefault(SIGINT, &act); + CatchIfDefault(SIGTERM, &act); + + act.sa_handler = tstp; + if (!CatchIfDefault(SIGTSTP, &act)) + ignore = TRUE; + } + } +#else + if (enable) + { +#if HAVE_SIGACTION || HAVE_SIGVEC + static sigaction_t act; + act.sa_handler = cleanup; + CatchIfDefault(SIGINT, &act); + CatchIfDefault(SIGTERM, &act); +#else + CatchIfDefault(SIGINT, cleanup); + CatchIfDefault(SIGTERM, cleanup); +#endif + } +#endif +} diff --git a/ncurses/lib_twait.c b/ncurses/lib_twait.c new file mode 100644 index 00000000..15ab948a --- /dev/null +++ b/ncurses/lib_twait.c @@ -0,0 +1,267 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* +** lib_twait.c +** +** The routine _nc_timed_wait(). +** +*/ + +#include + +#if USE_FUNC_POLL +#include +#include +#if HAVE_SYS_TIME_H +#include +#endif +#elif HAVE_SELECT +/* on SCO, conflicts with */ +#if HAVE_SYS_TIME_H && ! SYSTEM_LOOKS_LIKE_SCO +#include +#endif +#if HAVE_SYS_SELECT_H +#include +#endif +#endif + +MODULE_ID("$Id: lib_twait.c,v 1.18 1997/02/15 18:27:51 tom Exp $") + +/* + * We want to define GOOD_SELECT if the last argument of select(2) is + * modified to indicate time left. The code will deal gracefully with + * the other case, this is just an optimization to reduce the number + * of system calls per input event. + * + * In general, expect System-V-like UNIXes to have this behavior and BSD-like + * ones to not have it. Check your manual page. If it doesn't explicitly + * say the last argument is modified, assume it's not. + * + * (We'd really like configure to autodetect this, but writing a proper test + * turns out to be hard.) + */ + +#if HAVE_GETTIMEOFDAY +#if (defined(TRACE) && !HAVE_USLEEP) || ! GOOD_SELECT +static void _nc_gettime(struct timeval *tp) +{ + gettimeofday(tp, (struct timezone *)0); + T(("time: %ld.%06ld", tp->tv_sec, tp->tv_usec)); +} +#endif +#endif + +#if !HAVE_USLEEP +int _nc_usleep(unsigned int usec) +{ +int code; +struct timeval tval; + +#if defined(TRACE) && HAVE_GETTIMEOFDAY + _nc_gettime(&tval); +#endif +#if USE_FUNC_POLL + { + struct pollfd fds[1]; + code = poll(fds, 0, usec / 1000); + } +#elif HAVE_SELECT + tval.tv_sec = usec / 1000000; + tval.tv_usec = usec % 1000000; + code = select(0, NULL, NULL, NULL, &tval); +#endif + +#if defined(TRACE) && HAVE_GETTIMEOFDAY + _nc_gettime(&tval); +#endif + return code; +} +#endif /* !HAVE_USLEEP */ + +/* + * Wait a specified number of milliseconds, returning true if the timer + * didn't expire before there is activity on the specified file descriptors. + * The file-descriptors are specified by the mode: + * 0 - none (absolute time) + * 1 - ncurses' normal input-descriptor + * 2 - mouse descriptor, if any + * 3 - either input or mouse. + * + * If the milliseconds given are -1, the wait blocks until activity on the + * descriptors. + */ +int _nc_timed_wait(int mode, int milliseconds, int *timeleft) +{ +int fd; +int count = 0; +long whole_secs = milliseconds / 1000; +long micro_secs = (milliseconds % 1000) * 1000; + +int result = 0; +struct timeval ntimeout; + +#if USE_FUNC_POLL +struct pollfd fds[2]; +#elif HAVE_SELECT +static fd_set set; +#endif + +#if !GOOD_SELECT && HAVE_GETTIMEOFDAY +struct timeval starttime, returntime; +long delta; + + _nc_gettime(&starttime); +#endif + + if (milliseconds >= 0) { + ntimeout.tv_sec = whole_secs; + ntimeout.tv_usec = micro_secs; + } else { + ntimeout.tv_sec = 0; + ntimeout.tv_usec = 0; + } + + T(("start twait: %lu.%06lu secs", (long) ntimeout.tv_sec, (long) ntimeout.tv_usec)); + + /* + * The do loop tries to make it look like we have restarting signals, + * even if we don't. + */ + do { + count = 0; +#if USE_FUNC_POLL + + if (mode & 1) { + fds[count].fd = SP->_ifd; + fds[count].events = POLLIN; + count++; + } + if ((mode & 2) + && (fd = _nc_mouse_fd()) >= 0) { + fds[count].fd = fd; + fds[count].events = POLLIN; + count++; + } + + result = poll(fds, count, milliseconds); +#elif HAVE_SELECT + /* + * Some systems modify the fd_set arguments; do this in the + * loop. + */ + FD_ZERO(&set); + + if (mode & 1) { + FD_SET(SP->_ifd, &set); + count = SP->_ifd + 1; + } + if ((mode & 2) + && (fd = _nc_mouse_fd()) >= 0) { + FD_SET(fd, &set); + count = max(fd, count) + 1; + } + + errno = 0; + result = select(count, &set, NULL, NULL, milliseconds >= 0 ? &ntimeout : 0); +#endif + +#if !GOOD_SELECT && HAVE_GETTIMEOFDAY + _nc_gettime(&returntime); + + /* The contents of ntimeout aren't guaranteed after return from + * 'select()', so we disregard its contents. Also, note that + * on some systems, tv_sec and tv_usec are unsigned. + */ + ntimeout.tv_sec = whole_secs; + ntimeout.tv_usec = micro_secs; + +#define DELTA(f) (long)ntimeout.f - (long)returntime.f + (long)starttime.f + + delta = DELTA(tv_sec); + if (delta < 0) + delta = 0; + ntimeout.tv_sec = delta; + + delta = DELTA(tv_usec); + while (delta < 0 && ntimeout.tv_sec != 0) { + ntimeout.tv_sec--; + delta += 1000000; + } + ntimeout.tv_usec = delta; + if (delta < 0) + ntimeout.tv_sec = ntimeout.tv_usec = 0; + + /* + * If the timeout hasn't expired, and we've gotten no data, + * this is probably a system where 'select()' needs to be left + * alone so that it can complete. Make this process sleep, + * then come back for more. + */ + if (result == 0 + && (ntimeout.tv_sec != 0 || ntimeout.tv_usec > 100000)) { + napms(100); + continue; + } +#endif + } while (result == -1 && errno == EINTR); + + /* return approximate time left on the ntimeout, in milliseconds */ + if (timeleft) + *timeleft = (ntimeout.tv_sec * 1000) + (ntimeout.tv_usec / 1000); + + T(("end twait: returned %d, remaining time %lu.%06lu secs (%d msec)", + result, (long) ntimeout.tv_sec, (long) ntimeout.tv_usec, + timeleft ? *timeleft : -1)); + + /* + * Both 'poll()' and 'select()' return the number of file descriptors + * that are active. Translate this back to the mask that denotes which + * file-descriptors, so that we don't need all of this system-specific + * code everywhere. + */ + if (result != 0) { + if (result > 0) { + result = 0; +#if USE_FUNC_POLL + for (count = 0; count < 2; count++) { + if ((mode & (1 << count)) + && (fds[count].revents & POLLIN)) { + result |= (1 << count); + count++; + } + } +#elif HAVE_SELECT + if ((mode & 2) + && (fd = _nc_mouse_fd()) >= 0 + && FD_ISSET(fd, &set)) + result |= 2; + if ((mode & 1) + && FD_ISSET(SP->_ifd, &set)) + result |= 1; +#endif + } + else + result = 0; + } + + return (result); +} diff --git a/ncurses/lib_vidattr.c b/ncurses/lib_vidattr.c new file mode 100644 index 00000000..afdf57f7 --- /dev/null +++ b/ncurses/lib_vidattr.c @@ -0,0 +1,215 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* + * vidputs(newmode, outc) + * + * newmode is taken to be the logical 'or' of the symbols in curses.h + * representing graphic renditions. The terminal is set to be in all of + * the given modes, if possible. + * + * if the new attribute is normal + * if exit-alt-char-set exists + * emit it + * emit exit-attribute-mode + * else if set-attributes exists + * use it to set exactly what you want + * else + * if exit-attribute-mode exists + * turn off everything + * else + * turn off those which can be turned off and aren't in + * newmode. + * turn on each mode which should be on and isn't, one by one + * + * NOTE that this algorithm won't achieve the desired mix of attributes + * in some cases, but those are probably just those cases in which it is + * actually impossible, anyway, so... + * + * NOTE that we cannot assume that there's no interaction between color + * and other attribute resets. So each time we reset color (or other + * attributes) we'll have to be prepared to restore the other. + */ + +#include +#include + +MODULE_ID("$Id: lib_vidattr.c,v 1.14 1997/05/06 16:02:43 tom Exp $") + +#define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) + +#define TurnOn(mask,mode) \ + if ((turn_on & mask) && mode) { doPut(mode); } + +#define TurnOff(mask,mode) \ + if ((turn_off & mask) && mode) { doPut(mode); turn_off &= ~mask; } + +int vidputs(attr_t newmode, int (*outc)(int)) +{ +static attr_t previous_attr = A_NORMAL; +attr_t turn_on, turn_off; +int pair, current_pair; + + T((T_CALLED("vidputs(%s)"), _traceattr(newmode))); + + /* this allows us to go on whether or not newterm() has been called */ + if (SP) + previous_attr = SP->_current_attr; + + T(("previous attribute was %s", _traceattr(previous_attr))); + + if (newmode == previous_attr) + returnCode(OK); + + turn_off = (~newmode & previous_attr) & ALL_BUT_COLOR; + turn_on = (newmode & ~previous_attr) & ALL_BUT_COLOR; + + pair = PAIR_NUMBER(newmode); + current_pair = PAIR_NUMBER(previous_attr); + + /* if there is no current screen, assume we *can* do color */ + if ((!SP || SP->_coloron) && pair == 0) { + T(("old pair = %d -- new pair = %d", current_pair, pair)); + if (pair != current_pair) { + _nc_do_color(pair, outc); + previous_attr &= ~A_COLOR; + } + } + + if (newmode == A_NORMAL) { + if((previous_attr & A_ALTCHARSET) && exit_alt_charset_mode) { + doPut(exit_alt_charset_mode); + previous_attr &= ~A_ALTCHARSET; + } + if (previous_attr) { + doPut(exit_attribute_mode); + previous_attr &= ~A_COLOR; + } + + } else if (set_attributes) { + if (turn_on || turn_off) { + TPUTS_TRACE("set_attributes"); + tputs(tparm(set_attributes, + (newmode & A_STANDOUT) != 0, + (newmode & A_UNDERLINE) != 0, + (newmode & A_REVERSE) != 0, + (newmode & A_BLINK) != 0, + (newmode & A_DIM) != 0, + (newmode & A_BOLD) != 0, + (newmode & A_INVIS) != 0, + (newmode & A_PROTECT) != 0, + (newmode & A_ALTCHARSET) != 0), 1, outc); + previous_attr &= ~A_COLOR; + } + } else { + + T(("turning %s off", _traceattr(turn_off))); + + TurnOff(A_ALTCHARSET, exit_alt_charset_mode); + TurnOff(A_UNDERLINE, exit_underline_mode); + TurnOff(A_STANDOUT, exit_standout_mode); + + if (turn_off && exit_attribute_mode) { + doPut(exit_attribute_mode); + turn_on |= (newmode & (chtype)(~A_COLOR)); + previous_attr &= ~A_COLOR; + } + + T(("turning %s on", _traceattr(turn_on))); + + TurnOn (A_ALTCHARSET, enter_alt_charset_mode); + TurnOn (A_BLINK, enter_blink_mode); + TurnOn (A_BOLD, enter_bold_mode); + TurnOn (A_DIM, enter_dim_mode); + TurnOn (A_REVERSE, enter_reverse_mode); + TurnOn (A_STANDOUT, enter_standout_mode); + TurnOn (A_PROTECT, enter_protected_mode); + TurnOn (A_INVIS, enter_secure_mode); + TurnOn (A_UNDERLINE, enter_underline_mode); + TurnOn (A_HORIZONTAL, enter_horizontal_hl_mode); + TurnOn (A_LEFT, enter_left_hl_mode); + TurnOn (A_LOW, enter_low_hl_mode); + TurnOn (A_RIGHT, enter_right_hl_mode); + TurnOn (A_TOP, enter_top_hl_mode); + TurnOn (A_VERTICAL, enter_vertical_hl_mode); + } + + /* if there is no current screen, assume we *can* do color */ + if ((!SP || SP->_coloron) && pair != 0) { + current_pair = PAIR_NUMBER(previous_attr); + T(("old pair = %d -- new pair = %d", current_pair, pair)); + if (pair != current_pair) { + _nc_do_color(pair, outc); + } + } + + if (SP) + SP->_current_attr = newmode; + else + previous_attr = newmode; + + returnCode(OK); +} + +int vidattr(attr_t newmode) +{ + T((T_CALLED("vidattr(%s)"), _traceattr(newmode))); + + returnCode(vidputs(newmode, _nc_outch)); +} + +attr_t termattrs(void) +{ + int attrs = A_NORMAL; + + if (enter_alt_charset_mode) + attrs |= A_ALTCHARSET; + + if (enter_blink_mode) + attrs |= A_BLINK; + + if (enter_bold_mode) + attrs |= A_BOLD; + + if (enter_dim_mode) + attrs |= A_DIM; + + if (enter_reverse_mode) + attrs |= A_REVERSE; + + if (enter_standout_mode) + attrs |= A_STANDOUT; + + if (enter_protected_mode) + attrs |= A_PROTECT; + + if (enter_secure_mode) + attrs |= A_INVIS; + + if (enter_underline_mode) + attrs |= A_UNDERLINE; + + if (SP->_coloron) + attrs |= A_COLOR; + + return(attrs); +} + diff --git a/ncurses/lib_window.c b/ncurses/lib_window.c new file mode 100644 index 00000000..6dab3b80 --- /dev/null +++ b/ncurses/lib_window.c @@ -0,0 +1,222 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* +** lib_window.c +** +** +*/ + +#include + +MODULE_ID("$Id: lib_window.c,v 1.8 1997/02/02 01:14:43 tom Exp $") + +void _nc_synchook(WINDOW *win) +/* hook to be called after each window change */ +{ + if (win->_immed) wrefresh(win); + if (win->_sync) wsyncup(win); +} + +int mvderwin(WINDOW *win, int y, int x) +/* move a derived window */ +{ + WINDOW *orig = win->_parent; + int i; + + T((T_CALLED("mvderwin(%p,%d,%d)"), win, y, x)); + + if (orig) + { + if (win->_parx==x && win->_pary==y) + returnCode(OK); + if (x<0 || y<0) + returnCode(ERR); + if ( (x+getmaxx(win) > getmaxx(orig)) || + (y+getmaxy(win) > getmaxy(orig)) ) + returnCode(ERR); + } + else + returnCode(ERR); + wsyncup(win); + win->_parx = x; + win->_pary = y; + for(i=0;i_line[i].text = &(orig->_line[y++].text[x]); + returnCode(OK); +} + +int syncok(WINDOW *win, bool bf) +/* enable/disable automatic wsyncup() on each change to window */ +{ + T((T_CALLED("syncok(%p,%d)"), win, bf)); + + if (win) { + win->_sync = bf; + returnCode(OK); + } else + returnCode(ERR); +} + +void wsyncup(WINDOW *win) +/* mark changed every cell in win's ancestors that is changed in win */ +/* Rewritten by J. Pfeifer, 1-Apr-96 (don't even think that...) */ +{ + WINDOW *wp; + + if (win && win->_parent) + for (wp = win; wp->_parent; wp = wp->_parent) + { + int y; + WINDOW *pp = wp->_parent; + + assert((wp->_pary <= pp->_maxy) && + ((wp->_pary+wp->_maxy) <= pp->_maxy)); + + for (y = 0; y <= wp->_maxy; y++) + { + int left = wp->_line[y].firstchar; + if (left >= 0) /* line is touched */ + { + /* left & right character in parent window coordinates */ + int right = wp->_line[y].lastchar + wp->_parx; + left += wp->_parx; + + if (pp->_line[wp->_pary + y].firstchar == _NOCHANGE) + { + pp->_line[wp->_pary + y].firstchar = left; + pp->_line[wp->_pary + y].lastchar = right; + } + else + { + if (left < pp->_line[wp->_pary + y].firstchar) + pp->_line[wp->_pary + y].firstchar = left; + if (pp->_line[wp->_pary + y].lastchar < right) + pp->_line[wp->_pary + y].lastchar = right; + } + } + } + } +} + +void wsyncdown(WINDOW *win) +/* mark changed every cell in win that is changed in any of its ancestors */ +/* Rewritten by J. Pfeifer, 1-Apr-96 (don't even think that...) */ +{ + if (win && win->_parent) + { + WINDOW *pp = win->_parent; + int y; + + /* This recursion guarantees, that the changes are propagated down- + wards from the root to our direct parent. */ + wsyncdown(pp); + + /* and now we only have to propagate the changes from our direct + parent, if there are any. */ + assert((win->_pary <= pp->_maxy) && + ((win->_pary + win->_maxy) <= pp->_maxy)); + + for (y = 0; y <= win->_maxy; y++) + { + if (pp->_line[win->_pary + y].firstchar >= 0) /* parent changed */ + { + /* left and right character in child coordinates */ + int left = pp->_line[win->_pary + y].firstchar - win->_parx; + int right = pp->_line[win->_pary + y].lastchar - win->_parx; + /* The change maybe outside the childs range */ + if (left<0) + left = 0; + if (right > win->_maxx) + right = win->_maxx; + if (win->_line[y].firstchar == _NOCHANGE) + { + win->_line[y].firstchar = left; + win->_line[y].lastchar = right; + } + else + { + if (left < win->_line[y].firstchar) + win->_line[y].firstchar = left; + if (win->_line[y].lastchar < right) + win->_line[y].lastchar = right; + } + } + } + } +} + +void wcursyncup(WINDOW *win) +/* sync the cursor in all derived windows to its value in the base window */ +{ + WINDOW *wp; + for( wp = win; wp && wp->_parent; wp = wp->_parent ) { + wmove( wp->_parent, wp->_pary + wp->_cury, wp->_parx + wp->_curx ); + } +} + +WINDOW *dupwin(WINDOW *win) +/* make an exact duplicate of the given window */ +{ +WINDOW *nwin; +size_t linesize; +int i; + + T((T_CALLED("dupwin(%p)"), win)); + + if ((nwin = newwin(win->_maxy + 1, win->_maxx + 1, win->_begy, win->_begx)) == NULL) + returnWin(0); + + nwin->_curx = win->_curx; + nwin->_cury = win->_cury; + nwin->_maxy = win->_maxy; + nwin->_maxx = win->_maxx; + nwin->_begy = win->_begy; + nwin->_begx = win->_begx; + nwin->_yoffset = win->_yoffset; + + nwin->_flags = win->_flags; + nwin->_attrs = win->_attrs; + nwin->_bkgd = win->_bkgd; + + nwin->_clear = win->_clear; + nwin->_scroll = win->_scroll; + nwin->_leaveok = win->_leaveok; + nwin->_use_keypad = win->_use_keypad; + nwin->_delay = win->_delay; + nwin->_immed = win->_immed; + nwin->_sync = win->_sync; + nwin->_parx = win->_parx; + nwin->_pary = win->_pary; + nwin->_parent = win->_parent; + + nwin->_regtop = win->_regtop; + nwin->_regbottom = win->_regbottom; + + linesize = (win->_maxx + 1) * sizeof(chtype); + for (i = 0; i <= nwin->_maxy; i++) { + memcpy(nwin->_line[i].text, win->_line[i].text, linesize); + nwin->_line[i].firstchar = win->_line[i].firstchar; + nwin->_line[i].lastchar = win->_line[i].lastchar; + } + + returnWin(nwin); +} diff --git a/ncurses/llib-lncurses b/ncurses/llib-lncurses new file mode 100644 index 00000000..0ca29b5e --- /dev/null +++ b/ncurses/llib-lncurses @@ -0,0 +1,2560 @@ +/****************************************************************************** + * Copyright 1996,1997 by Thomas E. Dickey * + * All Rights Reserved. * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * + * that the above copyright notice appear in all copies and that both that * + * copyright notice and this permission notice appear in supporting * + * documentation, and that the name of the above listed copyright holder(s) * + * not be used in advertising or publicity pertaining to distribution of the * + * software without specific, written prior permission. THE ABOVE LISTED * + * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * + * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + ******************************************************************************/ +/* LINTLIBRARY */ + +/* ./fallback.c */ + +#include +#include + +#undef _nc_fallback +const TERMTYPE *_nc_fallback( + const char *name) + { return(*(const TERMTYPE **)0); } + +/* ./hashmap.c */ + +#undef _nc_hash_map +void _nc_hash_map(void) + { /* void */ } + +/* ./hardscroll.c */ + +#undef _nc_scroll_optimize +void _nc_scroll_optimize(void) + { /* void */ } + +/* ./lib_acs.c */ + +#undef acs_map +chtype acs_map[128]; + +#undef init_acs +void init_acs(void) + { /* void */ } + +/* ./lib_addch.c */ + +#include + +#undef wattr_on +int wattr_on( + WINDOW *win, + const attr_t at) + { return(*(int *)0); } + +#undef wattr_off +int wattr_off( + WINDOW *win, + const attr_t at) + { return(*(int *)0); } + +#undef wchgat +int wchgat( + WINDOW *win, + int n, + attr_t attr, + short color, + const void *opts) + { return(*(int *)0); } + +#undef _nc_background +chtype _nc_background( + WINDOW *win) + { return(*(chtype *)0); } + +#undef _nc_render +chtype _nc_render( + WINDOW *win, + chtype ch) + { return(*(chtype *)0); } + +#undef _nc_waddch_nosync +int _nc_waddch_nosync( + WINDOW *win, + const chtype c) + { return(*(int *)0); } + +#undef waddch +int waddch( + WINDOW *win, + const chtype ch) + { return(*(int *)0); } + +#undef wechochar +int wechochar( + WINDOW *win, + const chtype ch) + { return(*(int *)0); } + +/* ./lib_addstr.c */ + +#undef waddnstr +int waddnstr( + WINDOW *win, + const char *const astr, + int n) + { return(*(int *)0); } + +#undef waddchnstr +int waddchnstr( + WINDOW *win, + const chtype *const astr, + int n) + { return(*(int *)0); } + +/* ./lib_beep.c */ + +#undef beep +int beep(void) + { return(*(int *)0); } + +#undef flash +int flash(void) + { return(*(int *)0); } + +/* ./lib_bkgd.c */ + +#undef wbkgd +int wbkgd( + WINDOW *win, + const chtype ch) + { return(*(int *)0); } + +/* ./lib_baudrate.c */ + +struct speed { + speed_t s; + int sp; +}; + +#undef baudrate +int baudrate(void) + { return(*(int *)0); } + +/* ./lib_box.c */ + +#undef wborder +int wborder( + WINDOW *win, + chtype ls, + chtype rs, + chtype ts, + chtype bs, + chtype tl, + chtype tr, + chtype bl, + chtype br) + { return(*(int *)0); } + +#undef whline +int whline( + WINDOW *win, + chtype ch, + int n) + { return(*(int *)0); } + +#undef wvline +int wvline( + WINDOW *win, + chtype ch, + int n) + { return(*(int *)0); } + +/* ./lib_clear.c */ + +#undef wclear +int wclear( + WINDOW *win) + { return(*(int *)0); } + +/* ./lib_clrbot.c */ + +#undef wclrtobot +int wclrtobot( + WINDOW *win) + { return(*(int *)0); } + +/* ./lib_clreol.c */ + +#undef wclrtoeol +int wclrtoeol( + WINDOW *win) + { return(*(int *)0); } + +/* ./lib_color.c */ + +#undef COLOR_PAIRS +int COLOR_PAIRS; +#undef COLORS +int COLORS; + +#undef start_color +int start_color(void) + { return(*(int *)0); } + +#undef init_pair +int init_pair( + short pair, + short f, + short b) + { return(*(int *)0); } + +#undef init_color +int init_color( + short color, + short r, + short g, + short b) + { return(*(int *)0); } + +#undef can_change_color +bool can_change_color(void) + { return(*(bool *)0); } + +#undef has_colors +bool has_colors(void) + { return(*(bool *)0); } + +#undef color_content +int color_content( + short color, + short *r, + short *g, + short *b) + { return(*(int *)0); } + +#undef pair_content +int pair_content( + short pair, + short *f, + short *b) + { return(*(int *)0); } + +#undef _nc_do_color +void _nc_do_color( + int pair, + int (*outc)( + int p1)) + { /* void */ } + +/* ./lib_data.c */ + +#undef stdscr +WINDOW *stdscr; +#undef curscr +WINDOW *curscr; +#undef newscr +WINDOW *newscr; +#undef _nc_windows +struct _win_list *_nc_windows; +#undef _nc_idcok +bool _nc_idcok; +#undef _nc_idlok +bool _nc_idlok; +#undef SP +SCREEN *SP; + +/* ./lib_delch.c */ + +#undef wdelch +int wdelch( + WINDOW *win) + { return(*(int *)0); } + +/* ./lib_delwin.c */ + +#undef delwin +int delwin( + WINDOW *win) + { return(*(int *)0); } + +/* ./lib_doupdate.c */ + +#include + +#undef doupdate +int doupdate(void) + { return(*(int *)0); } + +#undef _nc_outstr +void _nc_outstr( + const char *str) + { /* void */ } + +/* ./lib_endwin.c */ + +#undef endwin +int endwin(void) + { return(*(int *)0); } + +/* ./lib_erase.c */ + +#undef werase +int werase( + WINDOW *win) + { return(*(int *)0); } + +/* ./lib_gen.c */ + +#include + +#undef addch +int addch( + const chtype z) + { return(*(int *)0); } + +#undef addchnstr +int addchnstr( + const chtype *a1, + int z) + { return(*(int *)0); } + +#undef addchstr +int addchstr( + const chtype *z) + { return(*(int *)0); } + +#undef addnstr +int addnstr( + const char *a1, + int z) + { return(*(int *)0); } + +#undef addstr +int addstr( + const char *z) + { return(*(int *)0); } + +#undef attroff +int attroff( + int z) + { return(*(int *)0); } + +#undef attron +int attron( + int z) + { return(*(int *)0); } + +#undef attrset +int attrset( + int z) + { return(*(int *)0); } + +#undef attr_get +int attr_get(void) + { return(*(int *)0); } + +#undef attr_off +int attr_off( + int z) + { return(*(int *)0); } + +#undef attr_on +int attr_on( + int z) + { return(*(int *)0); } + +#undef attr_set +int attr_set( + int z) + { return(*(int *)0); } + +#undef bkgd +int bkgd( + chtype z) + { return(*(int *)0); } + +#undef bkgdset +void bkgdset( + chtype z) + { /* void */ } + +#undef border +int border( + chtype a1, + chtype a2, + chtype a3, + chtype a4, + chtype a5, + chtype a6, + chtype a7, + chtype z) + { return(*(int *)0); } + +#undef box +int box( + WINDOW *a1, + chtype a2, + chtype z) + { return(*(int *)0); } + +#undef chgat +int chgat( + int a1, + attr_t a2, + short a3, + const void *z) + { return(*(int *)0); } + +#undef clear +int clear(void) + { return(*(int *)0); } + +#undef clrtobot +int clrtobot(void) + { return(*(int *)0); } + +#undef clrtoeol +int clrtoeol(void) + { return(*(int *)0); } + +#undef COLOR_PAIR +int COLOR_PAIR( + int z) + { return(*(int *)0); } + +#undef delch +int delch(void) + { return(*(int *)0); } + +#undef deleteln +int deleteln(void) + { return(*(int *)0); } + +#undef echochar +int echochar( + const chtype z) + { return(*(int *)0); } + +#undef getbkgd +chtype getbkgd( + WINDOW *z) + { return(*(chtype *)0); } + +#undef getch +int getch(void) + { return(*(int *)0); } + +#undef getnstr +int getnstr( + char *a1, + int z) + { return(*(int *)0); } + +#undef getstr +int getstr( + char *z) + { return(*(int *)0); } + +#undef hline +int hline( + chtype a1, + int z) + { return(*(int *)0); } + +#undef inch +chtype inch(void) + { return(*(chtype *)0); } + +#undef inchnstr +int inchnstr( + chtype *a1, + int z) + { return(*(int *)0); } + +#undef inchstr +int inchstr( + chtype *z) + { return(*(int *)0); } + +#undef innstr +int innstr( + char *a1, + int z) + { return(*(int *)0); } + +#undef insch +int insch( + chtype z) + { return(*(int *)0); } + +#undef insdelln +int insdelln( + int z) + { return(*(int *)0); } + +#undef insertln +int insertln(void) + { return(*(int *)0); } + +#undef insnstr +int insnstr( + const char *a1, + int z) + { return(*(int *)0); } + +#undef insstr +int insstr( + const char *z) + { return(*(int *)0); } + +#undef instr +int instr( + char *z) + { return(*(int *)0); } + +#undef move +int move( + int a1, + int z) + { return(*(int *)0); } + +#undef mvaddch +int mvaddch( + int a1, + int a2, + const chtype z) + { return(*(int *)0); } + +#undef mvaddchnstr +int mvaddchnstr( + int a1, + int a2, + const chtype *a3, + int z) + { return(*(int *)0); } + +#undef mvaddchstr +int mvaddchstr( + int a1, + int a2, + const chtype *z) + { return(*(int *)0); } + +#undef mvaddnstr +int mvaddnstr( + int a1, + int a2, + const char *a3, + int z) + { return(*(int *)0); } + +#undef mvaddstr +int mvaddstr( + int a1, + int a2, + const char *z) + { return(*(int *)0); } + +#undef mvchgat +int mvchgat( + int a1, + int a2, + int a3, + attr_t a4, + short a5, + const void *z) + { return(*(int *)0); } + +#undef mvdelch +int mvdelch( + int a1, + int z) + { return(*(int *)0); } + +#undef mvgetch +int mvgetch( + int a1, + int z) + { return(*(int *)0); } + +#undef mvgetnstr +int mvgetnstr( + int a1, + int a2, + char *a3, + int z) + { return(*(int *)0); } + +#undef mvgetstr +int mvgetstr( + int a1, + int a2, + char *z) + { return(*(int *)0); } + +#undef mvhline +int mvhline( + int a1, + int a2, + chtype a3, + int z) + { return(*(int *)0); } + +#undef mvinch +chtype mvinch( + int a1, + int z) + { return(*(chtype *)0); } + +#undef mvinchnstr +int mvinchnstr( + int a1, + int a2, + chtype *a3, + int z) + { return(*(int *)0); } + +#undef mvinchstr +int mvinchstr( + int a1, + int a2, + chtype *z) + { return(*(int *)0); } + +#undef mvinnstr +int mvinnstr( + int a1, + int a2, + char *a3, + int z) + { return(*(int *)0); } + +#undef mvinsch +int mvinsch( + int a1, + int a2, + chtype z) + { return(*(int *)0); } + +#undef mvinsnstr +int mvinsnstr( + int a1, + int a2, + const char *a3, + int z) + { return(*(int *)0); } + +#undef mvinsstr +int mvinsstr( + int a1, + int a2, + const char *z) + { return(*(int *)0); } + +#undef mvinstr +int mvinstr( + int a1, + int a2, + char *z) + { return(*(int *)0); } + +#undef mvvline +int mvvline( + int a1, + int a2, + chtype a3, + int z) + { return(*(int *)0); } + +#undef mvwaddch +int mvwaddch( + WINDOW *a1, + int a2, + int a3, + const chtype z) + { return(*(int *)0); } + +#undef mvwaddchnstr +int mvwaddchnstr( + WINDOW *a1, + int a2, + int a3, + const chtype *a4, + int z) + { return(*(int *)0); } + +#undef mvwaddchstr +int mvwaddchstr( + WINDOW *a1, + int a2, + int a3, + const chtype *z) + { return(*(int *)0); } + +#undef mvwaddnstr +int mvwaddnstr( + WINDOW *a1, + int a2, + int a3, + const char *a4, + int z) + { return(*(int *)0); } + +#undef mvwaddstr +int mvwaddstr( + WINDOW *a1, + int a2, + int a3, + const char *z) + { return(*(int *)0); } + +#undef mvwchgat +int mvwchgat( + WINDOW *a1, + int a2, + int a3, + int a4, + attr_t a5, + short a6, + const void *z) + { return(*(int *)0); } + +#undef mvwdelch +int mvwdelch( + WINDOW *a1, + int a2, + int z) + { return(*(int *)0); } + +#undef mvwgetch +int mvwgetch( + WINDOW *a1, + int a2, + int z) + { return(*(int *)0); } + +#undef mvwgetnstr +int mvwgetnstr( + WINDOW *a1, + int a2, + int a3, + char *a4, + int z) + { return(*(int *)0); } + +#undef mvwgetstr +int mvwgetstr( + WINDOW *a1, + int a2, + int a3, + char *z) + { return(*(int *)0); } + +#undef mvwhline +int mvwhline( + WINDOW *a1, + int a2, + int a3, + chtype a4, + int z) + { return(*(int *)0); } + +#undef mvwinch +chtype mvwinch( + WINDOW *a1, + int a2, + int z) + { return(*(chtype *)0); } + +#undef mvwinchnstr +int mvwinchnstr( + WINDOW *a1, + int a2, + int a3, + chtype *a4, + int z) + { return(*(int *)0); } + +#undef mvwinchstr +int mvwinchstr( + WINDOW *a1, + int a2, + int a3, + chtype *z) + { return(*(int *)0); } + +#undef mvwinnstr +int mvwinnstr( + WINDOW *a1, + int a2, + int a3, + char *a4, + int z) + { return(*(int *)0); } + +#undef mvwinsch +int mvwinsch( + WINDOW *a1, + int a2, + int a3, + chtype z) + { return(*(int *)0); } + +#undef mvwinsnstr +int mvwinsnstr( + WINDOW *a1, + int a2, + int a3, + const char *a4, + int z) + { return(*(int *)0); } + +#undef mvwinsstr +int mvwinsstr( + WINDOW *a1, + int a2, + int a3, + const char *z) + { return(*(int *)0); } + +#undef mvwinstr +int mvwinstr( + WINDOW *a1, + int a2, + int a3, + char *z) + { return(*(int *)0); } + +#undef mvwvline +int mvwvline( + WINDOW *a1, + int a2, + int a3, + chtype a4, + int z) + { return(*(int *)0); } + +#undef PAIR_NUMBER +int PAIR_NUMBER( + int z) + { return(*(int *)0); } + +#undef redrawwin +int redrawwin( + WINDOW *z) + { return(*(int *)0); } + +#undef refresh +int refresh(void) + { return(*(int *)0); } + +#undef scrl +int scrl( + int z) + { return(*(int *)0); } + +#undef scroll +int scroll( + WINDOW *z) + { return(*(int *)0); } + +#undef setscrreg +int setscrreg( + int a1, + int z) + { return(*(int *)0); } + +#undef standout +int standout(void) + { return(*(int *)0); } + +#undef standend +int standend(void) + { return(*(int *)0); } + +#undef timeout +int timeout( + int z) + { return(*(int *)0); } + +#undef untouchwin +int untouchwin( + WINDOW *z) + { return(*(int *)0); } + +#undef vline +int vline( + chtype a1, + int z) + { return(*(int *)0); } + +#undef vw_printw +int vw_printw( + WINDOW *a1, + const char *a2, + va_list z) + { return(*(int *)0); } + +#undef vw_scanw +int vw_scanw( + WINDOW *a1, + const char *a2, + va_list z) + { return(*(int *)0); } + +#undef waddchstr +int waddchstr( + WINDOW *a1, + const chtype *z) + { return(*(int *)0); } + +#undef waddstr +int waddstr( + WINDOW *a1, + const char *z) + { return(*(int *)0); } + +#undef wattron +int wattron( + WINDOW *a1, + int z) + { return(*(int *)0); } + +#undef wattroff +int wattroff( + WINDOW *a1, + int z) + { return(*(int *)0); } + +#undef wattrset +int wattrset( + WINDOW *a1, + int z) + { return(*(int *)0); } + +#undef wattr_get +attr_t wattr_get( + WINDOW *z) + { return(*(attr_t *)0); } + +#undef wattr_set +int wattr_set( + WINDOW *a1, + attr_t z) + { return(*(int *)0); } + +#undef wbkgdset +void wbkgdset( + WINDOW *a1, + chtype z) + { /* void */ } + +#undef wdeleteln +int wdeleteln( + WINDOW *z) + { return(*(int *)0); } + +#undef wgetstr +int wgetstr( + WINDOW *a1, + char *z) + { return(*(int *)0); } + +#undef winch +chtype winch( + WINDOW *z) + { return(*(chtype *)0); } + +#undef winchstr +int winchstr( + WINDOW *a1, + chtype *z) + { return(*(int *)0); } + +#undef winsertln +int winsertln( + WINDOW *z) + { return(*(int *)0); } + +#undef winsstr +int winsstr( + WINDOW *a1, + const char *z) + { return(*(int *)0); } + +#undef winstr +int winstr( + WINDOW *a1, + char *z) + { return(*(int *)0); } + +#undef wstandout +int wstandout( + WINDOW *z) + { return(*(int *)0); } + +#undef wstandend +int wstandend( + WINDOW *z) + { return(*(int *)0); } + +/* ./lib_getch.c */ + +#undef ESCDELAY +int ESCDELAY; + +#undef ungetch +int ungetch( + int ch) + { return(*(int *)0); } + +#undef _nc_backspace +void _nc_backspace( + WINDOW *win) + { /* void */ } + +#undef wgetch +int wgetch( + WINDOW *win) + { return(*(int *)0); } + +/* ./lib_getstr.c */ + +#undef wgetnstr +int wgetnstr( + WINDOW *win, + char *str, + int maxlen) + { return(*(int *)0); } + +/* ./lib_inchstr.c */ + +#undef winchnstr +int winchnstr( + WINDOW *win, + chtype *str, + int n) + { return(*(int *)0); } + +/* ./lib_initscr.c */ + +#undef _nc_initscr +int _nc_initscr(void) + { return(*(int *)0); } + +#undef initscr +WINDOW *initscr(void) + { return(*(WINDOW **)0); } + +#undef termname +char *termname(void) + { return(*(char **)0); } + +/* ./lib_insch.c */ + +#undef winsch +int winsch( + WINDOW *win, + chtype c) + { return(*(int *)0); } + +/* ./lib_insdel.c */ + +#undef winsdelln +int winsdelln( + WINDOW *win, + int n) + { return(*(int *)0); } + +/* ./lib_insstr.c */ + +#undef winsnstr +int winsnstr( + WINDOW *win, + const char *str, + int n) + { return(*(int *)0); } + +/* ./lib_instr.c */ + +#undef winnstr +int winnstr( + WINDOW *win, + char *str, + int n) + { return(*(int *)0); } + +/* ./lib_isendwin.c */ + +#undef isendwin +int isendwin(void) + { return(*(int *)0); } + +/* ./lib_kernel.c */ + +#undef napms +int napms( + int ms) + { return(*(int *)0); } + +#undef reset_prog_mode +int reset_prog_mode(void) + { return(*(int *)0); } + +#undef reset_shell_mode +int reset_shell_mode(void) + { return(*(int *)0); } + +#undef erasechar +char erasechar(void) + { return(*(char *)0); } + +#undef killchar +char killchar(void) + { return(*(char *)0); } + +#undef flushinp +int flushinp(void) + { return(*(int *)0); } + +#undef savetty +int savetty(void) + { return(*(int *)0); } + +#undef resetty +int resetty(void) + { return(*(int *)0); } + +/* ./lib_keyname.c */ + +#include +#include + +struct kn { + const char *name; + int code; +}; + +#undef key_names +const struct kn key_names[] = {0}; + +#undef keyname +const char *keyname( + int c) + { return(*(const char **)0); } + +/* ./lib_longname.c */ + +#undef longname +char *longname(void) + { return(*(char **)0); } + +/* ./lib_mouse.c */ + +#undef _nc_max_click_interval +int _nc_max_click_interval; + +#undef _nc_mouse_init +void _nc_mouse_init( + SCREEN *sp) + { /* void */ } + +#undef _nc_mouse_fd +int _nc_mouse_fd(void) + { return(*(int *)0); } + +#undef _nc_mouse_event +bool _nc_mouse_event( + SCREEN *sp) + { return(*(bool *)0); } + +#undef _nc_mouse_inline +bool _nc_mouse_inline( + SCREEN *sp) + { return(*(bool *)0); } + +#undef _nc_mouse_parse +bool _nc_mouse_parse( + int runcount) + { return(*(bool *)0); } + +#undef _nc_mouse_wrap +void _nc_mouse_wrap( + SCREEN *sp) + { /* void */ } + +#undef _nc_mouse_resume +void _nc_mouse_resume( + SCREEN *sp) + { /* void */ } + +#undef getmouse +int getmouse( + MEVENT *aevent) + { return(*(int *)0); } + +#undef ungetmouse +int ungetmouse( + MEVENT *aevent) + { return(*(int *)0); } + +#undef mousemask +mmask_t mousemask( + mmask_t newmask, + mmask_t *oldmask) + { return(*(mmask_t *)0); } + +#undef wenclose +bool wenclose( + WINDOW *win, + int y, + int x) + { return(*(bool *)0); } + +#undef mouseinterval +int mouseinterval( + int maxclick) + { return(*(int *)0); } + +/* ./lib_move.c */ + +#undef wmove +int wmove( + WINDOW *win, + int y, + int x) + { return(*(int *)0); } + +/* ./lib_mvcur.c */ + +#undef _nc_mvcur_resume +void _nc_mvcur_resume(void) + { /* void */ } + +#undef _nc_mvcur_init +void _nc_mvcur_init(void) + { /* void */ } + +#undef _nc_mvcur_wrap +void _nc_mvcur_wrap(void) + { /* void */ } + +#undef mvcur +int mvcur( + int yold, + int xold, + int ynew, + int xnew) + { return(*(int *)0); } + +#undef _nc_mvcur_scrolln +int _nc_mvcur_scrolln( + int n, + int top, + int bot, + int maxy) + { return(*(int *)0); } + +/* ./lib_mvwin.c */ + +#undef mvwin +int mvwin( + WINDOW *win, + int by, + int bx) + { return(*(int *)0); } + +/* ./lib_newterm.c */ + +#undef filter +void filter(void) + { /* void */ } + +#undef newterm +SCREEN *newterm( + const char *term, + FILE *ofp, + FILE *ifp) + { return(*(SCREEN **)0); } + +/* ./lib_newwin.c */ + +#undef _nc_freewin +void _nc_freewin( + WINDOW *win) + { /* void */ } + +#undef newwin +WINDOW *newwin( + int num_lines, + int num_columns, + int begy, + int begx) + { return(*(WINDOW **)0); } + +#undef derwin +WINDOW *derwin( + WINDOW *orig, + int num_lines, + int num_columns, + int begy, + int begx) + { return(*(WINDOW **)0); } + +#undef subwin +WINDOW *subwin( + WINDOW *w, + int l, + int c, + int y, + int x) + { return(*(WINDOW **)0); } + +#undef _nc_makenew +WINDOW *_nc_makenew( + int num_lines, + int num_columns, + int begy, + int begx, + int flags) + { return(*(WINDOW **)0); } + +/* ./lib_options.c */ + +#undef has_ic +int has_ic(void) + { return(*(int *)0); } + +#undef has_il +int has_il(void) + { return(*(int *)0); } + +#undef idlok +int idlok( + WINDOW *win, + bool flag) + { return(*(int *)0); } + +#undef idcok +void idcok( + WINDOW *win, + bool flag) + { /* void */ } + +#undef clearok +int clearok( + WINDOW *win, + bool flag) + { return(*(int *)0); } + +#undef immedok +void immedok( + WINDOW *win, + bool flag) + { /* void */ } + +#undef leaveok +int leaveok( + WINDOW *win, + bool flag) + { return(*(int *)0); } + +#undef scrollok +int scrollok( + WINDOW *win, + bool flag) + { return(*(int *)0); } + +#undef halfdelay +int halfdelay( + int t) + { return(*(int *)0); } + +#undef nodelay +int nodelay( + WINDOW *win, + bool flag) + { return(*(int *)0); } + +#undef notimeout +int notimeout( + WINDOW *win, + bool f) + { return(*(int *)0); } + +#undef wtimeout +int wtimeout( + WINDOW *win, + int delay) + { return(*(int *)0); } + +#undef _nc_keypad +int _nc_keypad( + bool flag) + { return(*(int *)0); } + +#undef keypad +int keypad( + WINDOW *win, + bool flag) + { return(*(int *)0); } + +#undef meta +int meta( + WINDOW *win, + bool flag) + { return(*(int *)0); } + +#undef curs_set +int curs_set( + int vis) + { return(*(int *)0); } + +#if 0 + +#include + +#endif + +#undef typeahead +int typeahead( + int fd) + { return(*(int *)0); } + +#undef has_key +int has_key( + int keycode) + { return(*(int *)0); } + +/* ./lib_overlay.c */ + +#undef overlay +int overlay( + const WINDOW *win1, + WINDOW *win2) + { return(*(int *)0); } + +#undef overwrite +int overwrite( + const WINDOW *win1, + WINDOW *win2) + { return(*(int *)0); } + +#undef copywin +int copywin( + const WINDOW *src, + WINDOW *dst, + int sminrow, + int smincol, + int dminrow, + int dmincol, + int dmaxrow, + int dmaxcol, + int over) + { return(*(int *)0); } + +/* ./lib_pad.c */ + +#undef newpad +WINDOW *newpad( + int l, + int c) + { return(*(WINDOW **)0); } + +#undef subpad +WINDOW *subpad( + WINDOW *orig, + int l, + int c, + int begy, + int begx) + { return(*(WINDOW **)0); } + +#undef prefresh +int prefresh( + WINDOW *win, + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, + int smaxcol) + { return(*(int *)0); } + +#undef pnoutrefresh +int pnoutrefresh( + WINDOW *win, + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, + int smaxcol) + { return(*(int *)0); } + +#undef pechochar +int pechochar( + WINDOW *pad, + chtype ch) + { return(*(int *)0); } + +/* ./lib_print.c */ + +#undef mcprint +int mcprint( + char *data, + int len) + { return(*(int *)0); } + +/* ./lib_printw.c */ + +#undef printw +int printw( + const char *fmt, + ...) + { return(*(int *)0); } + +#undef wprintw +int wprintw( + WINDOW *win, + const char *fmt, + ...) + { return(*(int *)0); } + +#undef mvprintw +int mvprintw( + int y, + int x, + const char *fmt, + ...) + { return(*(int *)0); } + +#undef mvwprintw +int mvwprintw( + WINDOW *win, + int y, + int x, + const char *fmt, + ...) + { return(*(int *)0); } + +#undef vwprintw +int vwprintw( + WINDOW *win, + const char *fmt, + va_list argp) + { return(*(int *)0); } + +/* ./lib_raw.c */ + +#undef raw +int raw(void) + { return(*(int *)0); } + +#undef cbreak +int cbreak(void) + { return(*(int *)0); } + +#undef echo +int echo(void) + { return(*(int *)0); } + +#undef nl +int nl(void) + { return(*(int *)0); } + +#undef qiflush +int qiflush(void) + { return(*(int *)0); } + +#undef noraw +int noraw(void) + { return(*(int *)0); } + +#undef nocbreak +int nocbreak(void) + { return(*(int *)0); } + +#undef noecho +int noecho(void) + { return(*(int *)0); } + +#undef nonl +int nonl(void) + { return(*(int *)0); } + +#undef noqiflush +int noqiflush(void) + { return(*(int *)0); } + +#undef intrflush +int intrflush( + WINDOW *win, + bool flag) + { return(*(int *)0); } + +/* ./lib_refresh.c */ + +#undef wredrawln +int wredrawln( + WINDOW *win, + int beg, + int num) + { return(*(int *)0); } + +#undef wrefresh +int wrefresh( + WINDOW *win) + { return(*(int *)0); } + +#undef wnoutrefresh +int wnoutrefresh( + WINDOW *win) + { return(*(int *)0); } + +/* ./lib_restart.c */ + +#undef def_shell_mode +int def_shell_mode(void) + { return(*(int *)0); } + +#undef def_prog_mode +int def_prog_mode(void) + { return(*(int *)0); } + +#undef restartterm +int restartterm( + const char *term, + int filenum, + int *errret) + { return(*(int *)0); } + +#undef set_curterm +TERMINAL *set_curterm( + TERMINAL *term) + { return(*(TERMINAL **)0); } + +#undef del_curterm +int del_curterm( + TERMINAL *term) + { return(*(int *)0); } + +/* ./lib_scanw.c */ + +#undef vwscanw +int vwscanw( + WINDOW *win, + const char *fmt, + va_list argp) + { return(*(int *)0); } + +#undef scanw +int scanw( + const char *fmt, + ...) + { return(*(int *)0); } + +#undef wscanw +int wscanw( + WINDOW *win, + const char *fmt, + ...) + { return(*(int *)0); } + +#undef mvscanw +int mvscanw( + int y, + int x, + const char *fmt, + ...) + { return(*(int *)0); } + +#undef mvwscanw +int mvwscanw( + WINDOW *win, + int y, + int x, + const char *fmt, + ...) + { return(*(int *)0); } + +/* ./lib_screen.c */ + +#include +#include + +#undef getwin +WINDOW *getwin( + FILE *filep) + { return(*(WINDOW **)0); } + +#undef putwin +int putwin( + WINDOW *win, + FILE *filep) + { return(*(int *)0); } + +#undef scr_restore +int scr_restore( + const char *file) + { return(*(int *)0); } + +#undef scr_dump +int scr_dump( + const char *file) + { return(*(int *)0); } + +#undef scr_init +int scr_init( + const char *file) + { return(*(int *)0); } + +#undef scr_set +int scr_set( + const char *file) + { return(*(int *)0); } + +/* ./lib_scroll.c */ + +#undef _nc_scroll_window +void _nc_scroll_window( + WINDOW *win, + int const n, + short const top, + short const bottom) + { /* void */ } + +#undef wscrl +int wscrl( + WINDOW *win, + int n) + { return(*(int *)0); } + +/* ./lib_scrreg.c */ + +#undef wsetscrreg +int wsetscrreg( + WINDOW *win, + int top, + int bottom) + { return(*(int *)0); } + +/* ./lib_set_term.c */ + +#undef _nc_set_buffer +void _nc_set_buffer( + FILE *ofp, + bool buffered) + { /* void */ } + +#undef set_term +SCREEN *set_term( + SCREEN *screen) + { return(*(SCREEN **)0); } + +#undef delscreen +void delscreen( + SCREEN *sp) + { /* void */ } + +#undef rippedoff +ripoff_t rippedoff[5]; +#undef rsp +ripoff_t *rsp; + +#undef _nc_setupscreen +int _nc_setupscreen( + short slines, + short const scolumns, + FILE *output) + { return(*(int *)0); } + +#undef _nc_ripoffline +int _nc_ripoffline( + int line, + int (*init)( + WINDOW *p1, + int p2)) + { return(*(int *)0); } + +#undef ripoffline +int ripoffline( + int line, + int (*init)( + WINDOW *p1, + int p2)) + { return(*(int *)0); } + +/* ./lib_setup.c */ + +#include + +#undef use_env +void use_env( + bool f) + { /* void */ } + +#undef LINES +int LINES; +#undef COLS +int COLS; +#undef TABSIZE +int TABSIZE; + +#undef _nc_get_screensize +void _nc_get_screensize(void) + { /* void */ } + +#undef ttytype +char ttytype[256 ]; + +#undef setupterm +int setupterm( + const char *tname, + int Filedes, + int *errret) + { return(*(int *)0); } + +/* ./lib_slk.c */ + +#undef _nc_slk_format +int _nc_slk_format; + +#undef slk_label +char *slk_label( + int n) + { return(*(char **)0); } + +#undef slk_noutrefresh +int slk_noutrefresh(void) + { return(*(int *)0); } + +#undef slk_refresh +int slk_refresh(void) + { return(*(int *)0); } + +#undef slk_restore +int slk_restore(void) + { return(*(int *)0); } + +#undef slk_set +int slk_set( + int i, + const char *astr, + int format) + { return(*(int *)0); } + +#undef slk_touch +int slk_touch(void) + { return(*(int *)0); } + +#undef slk_clear +int slk_clear(void) + { return(*(int *)0); } + +#undef _nc_slk_initialize +int _nc_slk_initialize( + WINDOW *stwin, + int cols) + { return(*(int *)0); } + +#undef slk_init +int slk_init( + int format) + { return(*(int *)0); } + +#undef slk_attrset +int slk_attrset( + const attr_t attr) + { return(*(int *)0); } + +#undef slk_attron +int slk_attron( + const attr_t attr) + { return(*(int *)0); } + +#undef slk_attroff +int slk_attroff( + const attr_t attr) + { return(*(int *)0); } + +#undef slk_attr +attr_t slk_attr(void) + { return(*(attr_t *)0); } + +/* ./lib_termcap.c */ + +#include +#include + +#undef PC +char PC; +#undef UP +char *UP; +#undef BC +char *BC; +#undef ospeed +short ospeed; + +#undef tgetent +int tgetent( + char *bufp, + const char *name) + { return(*(int *)0); } + +#if 0 + +#include + +#endif + +#undef tgetflag +int tgetflag( + const char *id) + { return(*(int *)0); } + +#undef tgetnum +int tgetnum( + const char *id) + { return(*(int *)0); } + +#undef tgetstr +char *tgetstr( + const char *id, + char **area) + { return(*(char **)0); } + +#undef tgoto +char *tgoto( + const char *string, + int x, + int y) + { return(*(char **)0); } + +/* ./lib_ti.c */ + +#undef tigetflag +int tigetflag( + const char *str) + { return(*(int *)0); } + +#undef tigetnum +int tigetnum( + const char *str) + { return(*(int *)0); } + +#undef tigetstr +char *tigetstr( + const char *str) + { return(*(char **)0); } + +/* ./lib_touch.c */ + +#undef is_linetouched +int is_linetouched( + WINDOW *win, + int line) + { return(*(int *)0); } + +#undef is_wintouched +int is_wintouched( + WINDOW *win) + { return(*(int *)0); } + +#undef wtouchln +int wtouchln( + WINDOW *win, + int y, + int n, + int changed) + { return(*(int *)0); } + +/* ./lib_tparm.c */ + +typedef union { + unsigned int num; + char *str; +} stack_frame; + +#undef tparm +char *tparm( + const char *string, + ...) + { return(*(char **)0); } + +/* ./lib_tputs.c */ + +#undef delay_output +int delay_output( + int ms) + { return(*(int *)0); } + +#undef _nc_outch +int _nc_outch( + int ch) + { return(*(int *)0); } + +#undef putp +int putp( + const char *string) + { return(*(int *)0); } + +#undef tputs +int tputs( + const char *string, + int affcnt, + int (*outc)( + int p1)) + { return(*(int *)0); } + +/* ./lib_trace.c */ + +#include + +#undef _nc_tracing +unsigned _nc_tracing; +#undef _nc_tputs_trace +const char *_nc_tputs_trace = {0}; +#undef _nc_outchars +long _nc_outchars; +#undef _nc_optimize_enable +int _nc_optimize_enable; + +#undef trace +void trace( + const unsigned int tracelevel) + { /* void */ } + +#undef _nc_visbuf +const char *_nc_visbuf( + const char *buf) + { return(*(const char **)0); } + +#undef _tracef +void _tracef( + const char *fmt, + ...) + { /* void */ } + +/* ./lib_traceatr.c */ + +#undef _traceattr +char *_traceattr( + attr_t newmode) + { return(*(char **)0); } + +#undef _tracechtype +char *_tracechtype( + chtype ch) + { return(*(char **)0); } + +/* ./lib_tracechr.c */ + +#undef _tracechar +char *_tracechar( + const unsigned char ch) + { return(*(char **)0); } + +/* ./lib_tracedmp.c */ + +#undef _tracedump +void _tracedump( + const char *name, + WINDOW *win) + { /* void */ } + +/* ./lib_tracemse.c */ + +#undef _tracemouse +char *_tracemouse( + MEVENT const *ep) + { return(*(char **)0); } + +/* ./lib_tstp.c */ + +#include + +typedef struct sigaction sigaction_t; + +#undef _nc_signal_handler +void _nc_signal_handler( + bool enable) + { /* void */ } + +/* ./lib_twait.c */ + +#undef _nc_timed_wait +int _nc_timed_wait( + int mode, + int milliseconds, + int *timeleft) + { return(*(int *)0); } + +/* ./lib_unctrl.c */ + +#undef unctrl +char *unctrl( + chtype uch) + { return(*(char **)0); } + +/* ./lib_vidattr.c */ + +#undef vidputs +int vidputs( + attr_t newmode, + int (*outc)( + int p1)) + { return(*(int *)0); } + +#undef vidattr +int vidattr( + attr_t newmode) + { return(*(int *)0); } + +#undef termattrs +attr_t termattrs(void) + { return(*(attr_t *)0); } + +/* ./lib_window.c */ + +#undef _nc_synchook +void _nc_synchook( + WINDOW *win) + { /* void */ } + +#undef mvderwin +int mvderwin( + WINDOW *win, + int y, + int x) + { return(*(int *)0); } + +#undef syncok +int syncok( + WINDOW *win, + bool bf) + { return(*(int *)0); } + +#undef wsyncup +void wsyncup( + WINDOW *win) + { /* void */ } + +#undef wsyncdown +void wsyncdown( + WINDOW *win) + { /* void */ } + +#undef wcursyncup +void wcursyncup( + WINDOW *win) + { /* void */ } + +#undef dupwin +WINDOW *dupwin( + WINDOW *win) + { return(*(WINDOW **)0); } + +/* ./names.c */ + +#undef boolnames +char *const boolnames[] = {0}; +#undef boolfnames +char *const boolfnames[] = {0}; +#undef numnames +char *const numnames[] = {0}; +#undef numfnames +char *const numfnames[] = {0}; +#undef strnames +char *const strnames[] = {0}; +#undef strfnames +char *const strfnames[] = {0}; + +/* ./codes.c */ +#undef boolcodes +char *const boolcodes[] = {0}; +#undef numcodes +char *const numcodes[] = {0}; +#undef strcodes +char *const strcodes[] = {0}; + +/* ./read_entry.c */ +#undef cur_term +TERMINAL *cur_term; + +#undef _nc_tic_dir +char *_nc_tic_dir( + char *path) + { return(*(char **)0); } + +#undef _nc_read_file_entry +int _nc_read_file_entry( + const char *const filename, + TERMTYPE *ptr) + { return(*(int *)0); } + +#undef _nc_read_entry +int _nc_read_entry( + const char *const tn, + char *const filename, + TERMTYPE *const tp) + { return(*(int *)0); } + +#undef _nc_first_name +char *_nc_first_name( + const char *const sp) + { return(*(char **)0); } + +#undef _nc_name_match +int _nc_name_match( + const char *const namelst, + const char *const name, + const char *const delim) + { return(*(int *)0); } + +/* ./read_termcap.c */ + +#include + +#undef _nc_read_termcap_entry +int _nc_read_termcap_entry( + const char *const tn, + TERMTYPE *const tp) + { return(*(int *)0); } + +/* ./write_entry.c */ + +#undef _nc_set_writedir +void _nc_set_writedir( + char *dir) + { /* void */ } + +#undef _nc_write_entry +void _nc_write_entry( + TERMTYPE *const tp) + { /* void */ } + +#undef _nc_tic_written +int _nc_tic_written(void) + { return(*(int *)0); } + +/* ./sigaction.c */ + +#undef _nc_sigaction +void _nc_sigaction(void) + { /* void */ } + +/* ./vsscanf.c */ + +#undef _nc_vsscanf +void _nc_vsscanf(void) + { /* void */ } + +/* ./alloc_entry.c */ + +#undef _nc_init_entry +void _nc_init_entry( + TERMTYPE *const tp) + { /* void */ } + +#undef _nc_save_str +char *_nc_save_str( + const char *const string) + { return(*(char **)0); } + +#undef _nc_wrap_entry +void _nc_wrap_entry( + ENTRY *const ep) + { /* void */ } + +#undef _nc_merge_entry +void _nc_merge_entry( + TERMTYPE *const to, + TERMTYPE *const from) + { /* void */ } + +/* ./captoinfo.c */ + +#undef _nc_captoinfo +char *_nc_captoinfo( + char *const cap, + char *s, + int const parametrized) + { return(*(char **)0); } + +#undef _nc_infotocap +char *_nc_infotocap( + char *const cap, + char *str, + int const parametrized) + { return(*(char **)0); } + +/* ./comp_captab.c */ + +#include + +#undef _nc_info_hash_table +const struct name_table_entry *const _nc_info_hash_table[991] = {0}; +#undef _nc_cap_hash_table +const struct name_table_entry *const _nc_cap_hash_table[991] = {0}; +#undef _nc_capalias_table +const struct alias _nc_capalias_table[] = {0}; +#undef _nc_infoalias_table +const struct alias _nc_infoalias_table[] = {0}; + +#undef _nc_get_table +const struct name_table_entry *_nc_get_table( + bool termcap) + { return(*(const struct name_table_entry **)0); } + +/* ./comp_error.c */ + +#undef _nc_suppress_warnings +bool _nc_suppress_warnings; + +#undef _nc_set_source +void _nc_set_source( + const char *const name) + { /* void */ } + +#undef _nc_set_type +void _nc_set_type( + const char *const name) + { /* void */ } + +#undef _nc_get_type +void _nc_get_type( + char *name) + { /* void */ } + +#undef _nc_warning +void _nc_warning( + const char *const fmt, + ...) + { /* void */ } + +#undef _nc_err_abort +void _nc_err_abort( + const char *const fmt, + ...) + { /* void */ } + +#undef _nc_syserr_abort +void _nc_syserr_abort( + const char *const fmt, + ...) + { /* void */ } + +/* ./comp_hash.c */ + +#undef _nc_find_entry +struct name_table_entry const *_nc_find_entry( + const char *string, + const struct name_table_entry *const *hash_table) + { return(*(struct name_table_entry const **)0); } + +#undef _nc_find_type_entry +struct name_table_entry const *_nc_find_type_entry( + const char *string, + int type, + const struct name_table_entry *table) + { return(*(struct name_table_entry const **)0); } + +/* ./comp_parse.c */ + +#undef _nc_head +ENTRY *_nc_head; +#undef _nc_tail +ENTRY *_nc_tail; + +#undef _nc_free_entries +void _nc_free_entries( + ENTRY *head) + { /* void */ } + +#undef _nc_entry_match +bool _nc_entry_match( + char *n1, + char *n2) + { return(*(bool *)0); } + +#undef _nc_read_entry_source +void _nc_read_entry_source( + FILE *fp, + char *buf, + int literal, + bool silent, + bool (*hook)( + ENTRY *p1)) + { /* void */ } + +#undef _nc_resolve_uses +int _nc_resolve_uses(void) + { return(*(int *)0); } + +/* ./comp_scan.c */ + +#undef _nc_syntax +int _nc_syntax; +#undef _nc_curr_line +int _nc_curr_line; +#undef _nc_curr_col +int _nc_curr_col; +#undef _nc_curr_file_pos +long _nc_curr_file_pos; +#undef _nc_comment_start +long _nc_comment_start; +#undef _nc_comment_end +long _nc_comment_end; +#undef _nc_start_line +long _nc_start_line; + +#undef _nc_get_token +int _nc_get_token(void) + { return(*(int *)0); } + +#undef _nc_push_token +void _nc_push_token( + int class) + { /* void */ } + +#undef _nc_panic_mode +void _nc_panic_mode( + char ch) + { /* void */ } + +#undef _nc_reset_input +void _nc_reset_input( + FILE *fp, + char *buf) + { /* void */ } + +/* ./parse_entry.c */ + +#undef _nc_curr_token +struct token _nc_curr_token; + +#undef _nc_parse_entry +int _nc_parse_entry( + struct entry *entryp, + int literal, + bool silent) + { return(*(int *)0); } + +#undef _nc_capcmp +int _nc_capcmp( + const char *s, + const char *t) + { return(*(int *)0); } + +typedef struct {const char *from; const char *to;} assoc; + +/* ./lib_dft_fgbg.c */ + +#undef use_default_colors +int use_default_colors(void) + { return(*(int *)0); } + +/* ./lib_freeall.c */ + +#undef _nc_free_termtype +void _nc_free_termtype( + struct termtype *p, + int base) + { /* void */ } + +#undef _nc_freeall +void _nc_freeall(void) + { /* void */ } + +#undef _nc_free_and_exit +void _nc_free_and_exit( + int code) + { /* void */ } + +/* ./resizeterm.c */ + +#undef resizeterm +int resizeterm( + int ToLines, + int ToCols) + { return(*(int *)0); } + +/* ./wresize.c */ + +#undef wresize +int wresize( + WINDOW *win, + int ToLines, + int ToCols) + { return(*(int *)0); } + +/* ./lib_adabind.c */ + +#undef _nc_ada_getmaxyx +int _nc_ada_getmaxyx( + WINDOW *win, + int *y, + int *x) + { return(*(int *)0); } + +#undef _nc_ada_getbegyx +int _nc_ada_getbegyx( + WINDOW *win, + int *y, + int *x) + { return(*(int *)0); } + +#undef _nc_ada_getyx +int _nc_ada_getyx( + WINDOW *win, + int *y, + int *x) + { return(*(int *)0); } + +#undef _nc_ada_getparyx +int _nc_ada_getparyx( + WINDOW *win, + int *y, + int *x) + { return(*(int *)0); } + +#undef _nc_ada_isscroll +int _nc_ada_isscroll( + WINDOW *win) + { return(*(int *)0); } + +#undef _nc_ada_coord_transform +int _nc_ada_coord_transform( + WINDOW *win, + int *Y, + int *X, + int dir) + { return(*(int *)0); } + +#undef _nc_ada_mouse_event +void _nc_ada_mouse_event( + mmask_t m, + int *b, + int *s) + { /* void */ } + +#undef _nc_ada_mouse_mask +int _nc_ada_mouse_mask( + int button, + int state, + mmask_t *mask) + { return(*(int *)0); } + +#undef _nc_ada_unregister_mouse +void _nc_ada_unregister_mouse(void) + { /* void */ } diff --git a/ncurses/modules b/ncurses/modules new file mode 100644 index 00000000..91fa3135 --- /dev/null +++ b/ncurses/modules @@ -0,0 +1,117 @@ +# $Id: modules,v 1.25 1997/04/26 21:59:59 tom Exp $ +################################################################################ +# Copyright 1996,1997 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Library objects +fallback lib . ../include/term.h $(INCDIR)/tic.h +hashmap lib $(srcdir) +hardscroll lib $(srcdir) +lib_acs lib $(srcdir) ../include/term.h +lib_addch lib $(srcdir) +lib_addstr lib $(srcdir) +lib_beep lib $(srcdir) ../include/term.h +lib_bkgd lib $(srcdir) +lib_baudrate lib $(srcdir) ../include/term.h +lib_box lib $(srcdir) +lib_clear lib $(srcdir) +lib_clrbot lib $(srcdir) +lib_clreol lib $(srcdir) +lib_color lib $(srcdir) ../include/term.h +lib_data lib $(srcdir) +lib_delch lib $(srcdir) +lib_delwin lib $(srcdir) +lib_doupdate lib $(srcdir) ../include/term.h +lib_endwin lib $(srcdir) +lib_erase lib $(srcdir) +lib_gen lib . ../include/curses.h +lib_getch lib $(srcdir) +lib_getstr lib $(srcdir) ../include/term.h +lib_inchstr lib $(srcdir) +lib_initscr lib $(srcdir) +lib_insch lib $(srcdir) +lib_insdel lib $(srcdir) +lib_insstr lib $(srcdir) +lib_instr lib $(srcdir) +lib_isendwin lib $(srcdir) +lib_kernel lib $(srcdir) ../include/term.h +lib_keyname lib . ../include/term.h +lib_longname lib $(srcdir) +lib_mouse lib $(srcdir) ../include/term.h +lib_move lib $(srcdir) +lib_mvcur lib $(srcdir) ../include/term.h +lib_mvwin lib $(srcdir) +lib_newterm lib $(srcdir) ../include/term.h +lib_newwin lib $(srcdir) +lib_options lib $(srcdir) ../include/term.h keys.tries +lib_overlay lib $(srcdir) +lib_pad lib $(srcdir) +lib_print lib $(srcdir) ../include/term.h +lib_printw lib $(srcdir) +lib_raw lib $(srcdir) ../include/term.h +lib_refresh lib $(srcdir) +lib_restart lib $(srcdir) +lib_scanw lib $(srcdir) +lib_screen lib $(srcdir) ../include/term.h +lib_scroll lib $(srcdir) +lib_scrreg lib $(srcdir) +lib_set_term lib $(srcdir) ../include/term.h +lib_setup lib $(srcdir) ../include/term.h +lib_slk lib $(srcdir) ../include/term.h +lib_termcap lib $(srcdir) ../include/term.h +lib_ti lib $(srcdir) ../include/term.h +lib_touch lib $(srcdir) +lib_tparm lib $(srcdir) ../include/term.h +lib_tputs lib $(srcdir) ../include/term.h +lib_trace lib $(srcdir) +lib_traceatr lib $(srcdir) +lib_tracechr lib $(srcdir) +lib_tracedmp lib $(srcdir) +lib_tracemse lib $(srcdir) +lib_tstp lib $(srcdir) +lib_twait lib $(srcdir) +lib_vidattr lib $(srcdir) ../include/term.h +lib_window lib $(srcdir) +names lib . +codes lib . +unctrl lib . +read_entry lib $(srcdir) ../include/term.h $(INCDIR)/tic.h +read_termcap lib $(srcdir) ../include/term.h +write_entry lib $(srcdir) ../include/term.h $(INCDIR)/tic.h + +# Modules for porting +sigaction lib $(srcdir) +vsscanf lib $(srcdir) + +# Support for termcap (and tic, etc.) +alloc_entry lib $(srcdir) ../include/term.h +captoinfo lib $(srcdir) +comp_captab lib . ../include/term.h ../include/hashsize.h +comp_error lib $(srcdir) +comp_hash lib $(srcdir) ../include/term.h ../include/hashsize.h +comp_parse lib $(srcdir) ../include/term.h $(INCDIR)/tic.h +comp_scan lib $(srcdir) +parse_entry lib $(srcdir) ../include/term.h ../include/parametrized.h + +# Extensions +lib_dft_fgbg lib $(srcdir) +lib_freeall lib $(srcdir) +resizeterm lib $(srcdir) ../include/term.h +wresize lib $(srcdir) ../include/term.h +lib_adabind lib $(srcdir) +expanded lib . diff --git a/ncurses/parse_entry.c b/ncurses/parse_entry.c new file mode 100644 index 00000000..f3f74f79 --- /dev/null +++ b/ncurses/parse_entry.c @@ -0,0 +1,896 @@ +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * parse_entry.c -- compile one terminfo or termcap entry + * + * Get an exact in-core representation of an entry. Don't + * try to resolve use or tc capabilities, that is someone + * else's job. Depends on the lexical analyzer to get tokens + * from the input stream. + */ + +#include + +#include +#include +#define __INTERNAL_CAPS_VISIBLE +#include +#include + +MODULE_ID("$Id: parse_entry.c,v 1.18 1997/02/02 01:50:15 tom Exp $") + +#ifdef LINT +static short const parametrized[] = { 0 }; +#else +#include +#endif + +struct token _nc_curr_token; + +static void postprocess_termcap(TERMTYPE *, bool); +static void postprocess_terminfo(TERMTYPE *); +static struct name_table_entry const * lookup_fullname(const char *name); + +/* + * int + * _nc_parse_entry(entry, literal, silent) + * + * Compile one entry. Doesn't try to resolve use or tc capabilities. + * + * found-forward-use = FALSE + * re-initialise internal arrays + * get_token(); + * if the token was not a name in column 1, complain and die + * save names in entry's string table + * while (get_token() is not EOF and not NAMES) + * check for existance and type-correctness + * enter cap into structure + * if STRING + * save string in entry's string table + * push back token + */ + +int _nc_parse_entry(struct entry *entryp, int literal, bool silent) +{ + int token_type; + struct name_table_entry const *entry_ptr; + char *ptr, namecpy[MAX_NAME_SIZE+1]; + + token_type = _nc_get_token(); + + if (token_type == EOF) + return(EOF); + if (token_type != NAMES) + _nc_err_abort("Entry does not start with terminal names in column one"); + + _nc_init_entry(&entryp->tterm); + + entryp->cstart = _nc_comment_start; + entryp->cend = _nc_comment_end; + entryp->startline = _nc_start_line; + DEBUG(2, ("Comment range is %ld to %ld", entryp->cstart, entryp->cend)); + + /* junk the 2-character termcap name, if present */ + ptr = _nc_curr_token.tk_name; + if (ptr[2] == '|') + { + ptr = _nc_curr_token.tk_name + 3; + _nc_curr_token.tk_name[2] = '\0'; + } + + entryp->tterm.str_table = entryp->tterm.term_names = _nc_save_str(ptr); + + DEBUG(1, ("Starting '%s'", ptr)); + + /* + * We do this because the one-token lookahead in the parse loop + * results in the terminal type getting prematurely set to correspond + * to that of the next entry. + */ + _nc_set_type(_nc_first_name(entryp->tterm.term_names)); + + /* check for overly-long names and aliases */ + (void) strncpy(namecpy, entryp->tterm.term_names, MAX_NAME_SIZE); + namecpy[MAX_NAME_SIZE] = '\0'; + if ((ptr = strrchr(namecpy, '|')) != (char *)NULL) + *ptr = '\0'; + ptr = strtok(namecpy, "|"); + if (strlen(ptr) > MAX_ALIAS) + _nc_warning("primary name may be too long"); + while ((ptr = strtok((char *)NULL, "|")) != (char *)NULL) + if (strlen(ptr) > MAX_ALIAS) + _nc_warning("alias `%s' may be too long", ptr); + + entryp->nuses = 0; + + for (token_type = _nc_get_token(); + token_type != EOF && token_type != NAMES; + token_type = _nc_get_token()) + { + if (strcmp(_nc_curr_token.tk_name, "use") == 0 + || strcmp(_nc_curr_token.tk_name, "tc") == 0) { + entryp->uses[entryp->nuses].parent = (void *)_nc_save_str(_nc_curr_token.tk_valstring); + entryp->uses[entryp->nuses].line = _nc_curr_line; + entryp->nuses++; + } else { + /* normal token lookup */ + entry_ptr = _nc_find_entry(_nc_curr_token.tk_name, + _nc_syntax ? _nc_cap_hash_table : _nc_info_hash_table); + + /* + * Our kluge to handle aliasing. The reason it's done + * this ugly way, with a linear search, is so the hashing + * machinery doesn't have to be made really complicated + * (also we get better warnings this way). No point in + * making this case fast, aliased caps aren't common now + * and will get rarer. + */ + if (entry_ptr == NOTFOUND) + { + const struct alias *ap; + + if (_nc_syntax == SYN_TERMCAP) + { + for (ap = _nc_capalias_table; ap->from; ap++) + if (strcmp(ap->from, _nc_curr_token.tk_name) == 0) + { + if (ap->to == (char *)NULL) + { + _nc_warning("%s (%s termcap extension) ignored", + ap->from, ap->source); + goto nexttok; + } + + entry_ptr = _nc_find_entry(ap->to, _nc_cap_hash_table); + if (entry_ptr && !silent) + _nc_warning("%s (%s termcap extension) aliased to %s", ap->from, ap->source, ap->to); + break; + } + } + else /* if (_nc_syntax == SYN_TERMINFO) */ + { + for (ap = _nc_infoalias_table; ap->from; ap++) + if (strcmp(ap->from, _nc_curr_token.tk_name) == 0) + { + if (ap->to == (char *)NULL) + { + _nc_warning("%s (%s terminfo extension) ignored", + ap->from, ap->source); + goto nexttok; + } + + entry_ptr = _nc_find_entry(ap->to, _nc_info_hash_table); + if (entry_ptr && !silent) + _nc_warning("%s (%s terminfo extension) aliased to %s", ap->from, ap->source, ap->to); + break; + } + + /* last chance: a full-name */ + if (entry_ptr == NOTFOUND) { + entry_ptr = lookup_fullname(_nc_curr_token.tk_name); + } + } + } + + /* can't find this cap name, not even as an alias */ + if (entry_ptr == NOTFOUND) { + if (!silent) + _nc_warning("unknown capability '%s'", + _nc_curr_token.tk_name); + continue; + } + + /* deal with bad type/value combinations. */ + if (token_type != CANCEL && entry_ptr->nte_type != token_type) + { + /* + * Nasty special cases here handle situations in which type + * information can resolve name clashes. Normal lookup + * finds the last instance in the capability table of a + * given name, regardless of type. find_type_entry looks + * for a first matching instance with given type. So as + * long as all ambiguous names occur in pairs of distinct + * type, this will do the job. + */ + + /* tell max_attributes from arrow_key_map */ + if (token_type == NUMBER && !strcmp("ma", _nc_curr_token.tk_name)) + entry_ptr = _nc_find_type_entry("ma", NUMBER, + _nc_get_table(_nc_syntax != 0)); + + /* map terminfo's string MT to MT */ + else if (token_type==STRING &&!strcmp("MT",_nc_curr_token.tk_name)) + entry_ptr = _nc_find_type_entry("MT", STRING, + _nc_get_table(_nc_syntax != 0)); + + /* treat strings without following "=" as empty strings */ + else if (token_type==BOOLEAN && entry_ptr->nte_type==STRING) + token_type = STRING; + /* we couldn't recover; skip this token */ + else + { + if (!silent) + { + const char *type_name; + switch (entry_ptr->nte_type) + { + case BOOLEAN: + type_name = "boolean"; + break; + case STRING: + type_name = "string"; + break; + case NUMBER: + type_name = "numeric"; + break; + default: + type_name = "unknown"; + break; + } + _nc_warning("wrong type used for %s capability '%s'", + type_name, _nc_curr_token.tk_name); + } + continue; + } + } + + /* now we know that the type/value combination is OK */ + switch (token_type) { + case CANCEL: + switch (entry_ptr->nte_type) { + case BOOLEAN: + entryp->tterm.Booleans[entry_ptr->nte_index] = CANCELLED_BOOLEAN; + break; + + case NUMBER: + entryp->tterm.Numbers[entry_ptr->nte_index] = CANCELLED_NUMERIC; + break; + + case STRING: + entryp->tterm.Strings[entry_ptr->nte_index] = CANCELLED_STRING; + break; + } + break; + + case BOOLEAN: + entryp->tterm.Booleans[entry_ptr->nte_index] = TRUE; + break; + + case NUMBER: + entryp->tterm.Numbers[entry_ptr->nte_index] = + _nc_curr_token.tk_valnumber; + break; + + case STRING: + ptr = _nc_curr_token.tk_valstring; + if (_nc_syntax==SYN_TERMCAP) + ptr = _nc_captoinfo(_nc_curr_token.tk_name, + ptr, + parametrized[entry_ptr->nte_index]); + entryp->tterm.Strings[entry_ptr->nte_index] = _nc_save_str(ptr); + break; + + default: + if (!silent) + _nc_warning("unknown token type"); + _nc_panic_mode((_nc_syntax==SYN_TERMCAP) ? ':' : ','); + continue; + } + } /* end else cur_token.name != "use" */ + nexttok: + continue; /* cannot have a label w/o statement */ + } /* endwhile (not EOF and not NAMES) */ + + _nc_push_token(token_type); + _nc_set_type(_nc_first_name(entryp->tterm.term_names)); + + /* + * Try to deduce as much as possible from extension capabilities + * (this includes obsolete BSD capabilities). Sigh...it would be more + * space-efficient to call this after use resolution, but it has + * to be done before entry allocation is wrapped up. + */ + if (!literal) + if (_nc_syntax == SYN_TERMCAP) + { + bool has_base_entry = FALSE; + int i; + + /* + * Don't insert defaults if this is a `+' entry meant only + * for inclusion in other entries (not sure termcap ever + * had these, actually). + */ + if (strchr(entryp->tterm.term_names, '+')) + has_base_entry = TRUE; + else + /* + * Otherwise, look for a base entry that will already + * have picked up defaults via translation. + */ + for (i = 0; i < entryp->nuses; i++) + if (!strchr(entryp->uses[i].parent, '+')) + has_base_entry = TRUE; + + postprocess_termcap(&entryp->tterm, has_base_entry); + } + else + postprocess_terminfo(&entryp->tterm); + + _nc_wrap_entry(entryp); + + return(OK); +} + +int _nc_capcmp(const char *s, const char *t) +/* compare two string capabilities, stripping out padding */ +{ + if (!s && !t) + return(0); + else if (!s || !t) + return(1); + + for (;;) + { + if (s[0] == '$' && s[1] == '<') + { + for (s += 2; ; s++) + if (!(isdigit(*s) || *s=='.' || *s=='*' || *s=='/' || *s=='>')) + break; + } + + if (t[0] == '$' && t[1] == '<') + { + for (t += 2; ; t++) + if (!(isdigit(*t) || *t=='.' || *t=='*' || *t=='/' || *t=='>')) + break; + } + + /* we've now pushed s and t past any padding they were pointing at */ + + if (*s == '\0' && *t == '\0') + return(0); + + if (*s != *t) + return(*t - *s); + + /* else *s == *t but one is not NUL, so continue */ + s++, t++; + } +} + +/* + * The ko capability, if present, consists of a comma-separated capability + * list. For each capability, we may assume there is a keycap that sends the + * string which is the value of that capability. + */ +typedef struct {const char *from; const char *to;} assoc; +static assoc const ko_xlate[] = +{ + {"al", "kil1"}, /* insert line key -> KEY_IL */ + {"bt", "kcbt"}, /* back tab -> KEY_BTAB */ + {"cd", "ked"}, /* clear-to-eos key -> KEY_EOL */ + {"ce", "kel"}, /* clear-to-eol key -> KEY_EOS */ + {"cl", "kclr"}, /* clear key -> KEY_CLEAR */ + {"ct", "tbc"}, /* clear all tabs -> KEY_CATAB */ + {"dc", "kdch1"}, /* delete char -> KEY_DC */ + {"dl", "kdl1"}, /* delete line -> KEY_DL */ + {"do", "kcud1"}, /* down key -> KEY_DOWN */ + {"ei", "krmir"}, /* exit insert key -> KEY_EIC */ + {"ho", "khome"}, /* home key -> KEY_HOME */ + {"ic", "kich1"}, /* insert char key -> KEY_IC */ + {"im", "kIC"}, /* insert-mode key -> KEY_SIC */ + {"le", "kcub1"}, /* le key -> KEY_LEFT */ + {"nd", "kcuf1"}, /* nd key -> KEY_RIGHT */ + {"nl", "kent"}, /* new line key -> KEY_ENTER */ + {"st", "khts"}, /* set-tab key -> KEY_STAB */ + {"ta", CANCELLED_STRING}, + {"up", "kcuu1"}, /* up-arrow key -> KEY_UP */ + {(char *)NULL, (char *)NULL}, +}; + +/* + * This routine fills in string caps that either had defaults under + * termcap or can be manufactured from obsolete termcap capabilities. + * It was lifted from Ross Ridge's mytinfo package. + */ + +static const char C_CR[] = "\r"; +static const char C_LF[] = "\n"; +static const char C_BS[] = "\b"; +static const char C_HT[] = "\t"; + +/* + * 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) == (char *)NULL) +#define PRESENT(s) (((s) != (char *)NULL) && ((s) != CANCELLED_STRING)) + +/* + * This bit of legerdemain turns all the terminfo variable names into + * references to locations in the arrays Booleans, Numbers, and Strings --- + * precisely what's needed. + */ + +#undef CUR +#define CUR tp-> + +static +void postprocess_termcap(TERMTYPE *tp, bool has_base) +{ + char buf[MAX_LINE * 2 + 2]; + + /* + * TERMCAP DEFAULTS AND OBSOLETE-CAPABILITY TRANSLATIONS + * + * This first part of the code is the functional inverse of the + * fragment in capdefaults.c. + * ---------------------------------------------------------------------- + */ + + /* if there was a tc entry, assume we picked up defaults via that */ + if (!has_base) + { + if (WANTED(init_3string) && termcap_init2) + init_3string = _nc_save_str(termcap_init2); + + if (WANTED(reset_1string) && termcap_reset) + reset_1string = _nc_save_str(termcap_reset); + + if (WANTED(carriage_return)) { + if (carriage_return_delay > 0) { + sprintf(buf, "%s$<%d>", C_CR, carriage_return_delay); + carriage_return = _nc_save_str(buf); + } else + carriage_return = _nc_save_str(C_CR); + } + if (WANTED(cursor_left)) { + if (backspace_delay > 0) { + sprintf(buf, "%s$<%d>", C_BS, backspace_delay); + cursor_left = _nc_save_str(buf); + } else if (backspaces_with_bs == 1) + cursor_left = _nc_save_str(C_BS); + else if (PRESENT(backspace_if_not_bs)) + cursor_left = backspace_if_not_bs; + } + /* vi doesn't use "do", but it does seems to use nl (or '\n') instead */ + if (WANTED(cursor_down)) { + if (PRESENT(linefeed_if_not_lf)) + cursor_down = linefeed_if_not_lf; + else if (linefeed_is_newline != 1) { + if (new_line_delay > 0) { + sprintf(buf, "%s$<%d>", C_LF, new_line_delay); + cursor_down = _nc_save_str(buf); + } else + cursor_down = _nc_save_str(C_LF); + } + } + if (WANTED(scroll_forward) && crt_no_scrolling != 1) { + if (PRESENT(linefeed_if_not_lf)) + cursor_down = linefeed_if_not_lf; + else if (linefeed_is_newline != 1) { + if (new_line_delay > 0) { + sprintf(buf, "%s$<%d>", C_LF, new_line_delay); + scroll_forward = _nc_save_str(buf); + } else + scroll_forward = _nc_save_str(C_LF); + } + } + if (WANTED(newline)) { + if (linefeed_is_newline == 1) { + if (new_line_delay > 0) { + sprintf(buf, "%s$<%d>", C_LF, new_line_delay); + newline = _nc_save_str(buf); + } else + newline = _nc_save_str(C_LF); + } else if (PRESENT(carriage_return) && PRESENT(scroll_forward)) { + strncpy(buf, carriage_return, MAX_LINE-2); + buf[MAX_LINE-1] = '\0'; + strncat(buf, scroll_forward, MAX_LINE-strlen(buf)-1); + buf[MAX_LINE] = '\0'; + newline = _nc_save_str(buf); + } else if (PRESENT(carriage_return) && PRESENT(cursor_down)) { + strncpy(buf, carriage_return, MAX_LINE-2); + buf[MAX_LINE-1] = '\0'; + strncat(buf, cursor_down, MAX_LINE-strlen(buf)-1); + buf[MAX_LINE] = '\0'; + newline = _nc_save_str(buf); + } + } + } + + /* + * Inverse of capdefaults.c code ends here. + * ---------------------------------------------------------------------- + * + * TERMCAP-TO TERMINFO MAPPINGS FOR SOURCE TRANSLATION + * + * These translations will *not* be inverted by tgetent(). + */ + + if (!has_base) + { + /* + * We wait until now to decide if we've got a working cr because even + * one that doesn't work can be used for newline. Unfortunately the + * space allocated for it is wasted. + */ + if (return_does_clr_eol == 1 || no_correctly_working_cr == 1) + carriage_return = NULL; + + /* + * Supposedly most termcap entries have ta now and '\t' is no longer a + * default, but it doesn't seem to be true... + */ + if (WANTED(tab)) { + if (horizontal_tab_delay > 0) { + sprintf(buf, "%s$<%d>", C_HT, horizontal_tab_delay); + tab = _nc_save_str(buf); + } else + tab = _nc_save_str(C_HT); + } + if (init_tabs == -1 && has_hardware_tabs == TRUE) + init_tabs = 8; + + /* + * Assume we can beep with ^G unless we're given bl@. + */ + if (WANTED(bell)) + bell = _nc_save_str("\007"); + } + + /* + * Translate the old termcap :pt: capability to it#8 + ht=\t + */ + if (has_hardware_tabs == TRUE) + if (init_tabs != 8) + _nc_warning("hardware tabs with a width other than 8: %d", init_tabs); + else + { + if (tab && _nc_capcmp(tab, C_HT)) + _nc_warning("hardware tabs with a non-^I tab string %s", + _nc_visbuf(tab)); + else + { + if (WANTED(tab)) + tab = _nc_save_str(C_HT); + init_tabs = 8; + } + } + + /* + * Now translate the ko capability, if there is one. This + * isn't from mytinfo... + */ + if (PRESENT(other_non_function_keys)) + { + char *dp, *cp = strtok(other_non_function_keys, ","); + struct name_table_entry const *from_ptr; + struct name_table_entry const *to_ptr; + assoc const *ap; + char buf2[MAX_TERMINFO_LENGTH]; + bool foundim; + + /* we're going to use this for a special case later */ + dp = strchr(other_non_function_keys, 'i'); + foundim = dp && dp[1] == 'm'; + + /* look at each comma-separated capability in the ko string... */ + do { + for (ap = ko_xlate; ap->from; ap++) + if (strcmp(ap->from, cp) == 0) + break; + if (!ap->to) + { + _nc_warning("unknown capability `%s' in ko string", cp); + continue; + } + else if (ap->to == CANCELLED_STRING) /* ignore it */ + continue; + + /* now we know we found a match in ko_table, so... */ + + from_ptr = _nc_find_entry(ap->from, _nc_cap_hash_table); + to_ptr = _nc_find_entry(ap->to, _nc_info_hash_table); + + if (!from_ptr || !to_ptr) /* should never happen! */ + _nc_err_abort("ko translation table is invalid, I give up"); + + if (WANTED(tp->Strings[from_ptr->nte_index])) + { + _nc_warning("no value for ko capability %s", ap->from); + continue; + } + + if (tp->Strings[to_ptr->nte_index]) + { + /* There's no point in warning about it if it's the same + * string; that's just an inefficiency. + */ + if (strcmp( + tp->Strings[from_ptr->nte_index], + tp->Strings[to_ptr->nte_index]) != 0) + _nc_warning("%s (%s) already has an explicit value %s, ignoring ko", + ap->to, ap->from, + _nc_visbuf(tp->Strings[to_ptr->nte_index]) ); + continue; + } + + /* + * The magic moment -- copy the mapped key string over, + * stripping out padding. + */ + dp = buf2; + for (cp = tp->Strings[from_ptr->nte_index]; *cp; cp++) + { + if (cp[0] == '$' && cp[1] == '<') + { + while (*cp && *cp != '>') + if (!*cp) + break; + else + ++cp; + } + else + *dp++ = *cp; + } + *dp++ = '\0'; + + tp->Strings[to_ptr->nte_index] = _nc_save_str(buf2); + } while + ((cp = strtok((char *)NULL, ",")) != 0); + + /* + * Note: ko=im and ko=ic both want to grab the `Insert' + * keycap. There's a kich1 but no ksmir, so the ic capability + * got mapped to kich1 and im to kIC to avoid a collision. + * If the description has im but not ic, hack kIC back to kich1. + */ + if (foundim && WANTED(key_ic) && key_sic) + { + key_ic = key_sic; + key_sic = ABSENT_STRING; + } + } + + if (!hard_copy) + { + if (WANTED(key_backspace)) + key_backspace = _nc_save_str(C_BS); + if (WANTED(key_left)) + key_left = _nc_save_str(C_BS); + if (WANTED(key_down)) + key_down = _nc_save_str(C_LF); + } + + /* + * Translate XENIX forms characters. + */ + if (PRESENT(acs_ulcorner) || + PRESENT(acs_llcorner) || + PRESENT(acs_urcorner) || + PRESENT(acs_lrcorner) || + PRESENT(acs_ltee) || + PRESENT(acs_rtee) || + PRESENT(acs_btee) || + PRESENT(acs_ttee) || + PRESENT(acs_hline) || + PRESENT(acs_vline) || + PRESENT(acs_plus)) + { + char buf2[MAX_TERMCAP_LENGTH], *bp = buf2; + + if (acs_ulcorner && acs_ulcorner[1] == '\0') + { + *bp++ = 'l'; + *bp++ = *acs_ulcorner; + } + if (acs_llcorner && acs_llcorner[1] == '\0') + { + *bp++ = 'm'; + *bp++ = *acs_llcorner; + } + if (acs_urcorner && acs_urcorner[1] == '\0') + { + *bp++ = 'k'; + *bp++ = *acs_urcorner; + } + if (acs_lrcorner && acs_lrcorner[1] == '\0') + { + *bp++ = 'j'; + *bp++ = *acs_lrcorner; + } + if (acs_ltee && acs_ltee[1] == '\0') + { + *bp++ = 't'; + *bp++ = *acs_ltee; + } + if (acs_rtee && acs_rtee[1] == '\0') + { + *bp++ = 'u'; + *bp++ = *acs_rtee; + } + if (acs_btee && acs_btee[1] == '\0') + { + *bp++ = 'v'; + *bp++ = *acs_btee; + } + if (acs_ttee && acs_ttee[1] == '\0') + { + *bp++ = 'w'; + *bp++ = *acs_ttee; + } + if (acs_hline && acs_hline[1] == '\0') + { + *bp++ = 'q'; + *bp++ = *acs_hline; + } + if (acs_vline && acs_vline[1] == '\0') + { + *bp++ = 'x'; + *bp++ = *acs_vline; + } + if (acs_plus) + { + *bp++ = 'n'; + strcpy(bp, acs_plus); + bp = buf2 + strlen(buf2); + } + + if (bp != buf2) + { + *bp++ = '\0'; + acs_chars = _nc_save_str(buf2); + _nc_warning("acsc string synthesized from XENIX capabilities"); + } + } +} + +static +void postprocess_terminfo(TERMTYPE *tp) +{ + /* + * TERMINFO-TO-TERMINFO MAPPINGS FOR SOURCE TRANSLATION + * ---------------------------------------------------------------------- + */ + + /* + * Translate AIX forms characters. + */ + if (PRESENT(box_chars_1)) + { + char buf2[MAX_TERMCAP_LENGTH], *bp = buf2; + + if (box_chars_1[0]) /* ACS_ULCORNER */ + { + *bp++ = 'l'; + *bp++ = box_chars_1[0]; + } + if (box_chars_1[1]) /* ACS_HLINE */ + { + *bp++ = 'q'; + *bp++ = box_chars_1[1]; + } + if (box_chars_1[2]) /* ACS_URCORNER */ + { + *bp++ = 'k'; + *bp++ = box_chars_1[2]; + } + if (box_chars_1[3]) /* ACS_VLINE */ + { + *bp++ = 'x'; + *bp++ = box_chars_1[3]; + } + if (box_chars_1[4]) /* ACS_LRCORNER */ + { + *bp++ = 'j'; + *bp++ = box_chars_1[4]; + } + if (box_chars_1[5]) /* ACS_LLCORNER */ + { + *bp++ = 'm'; + *bp++ = box_chars_1[5]; + } + if (box_chars_1[6]) /* ACS_TTEE */ + { + *bp++ = 'w'; + *bp++ = box_chars_1[6]; + } + if (box_chars_1[7]) /* ACS_RTEE */ + { + *bp++ = 'u'; + *bp++ = box_chars_1[7]; + } + if (box_chars_1[8]) /* ACS_BTEE */ + { + *bp++ = 'v'; + *bp++ = box_chars_1[8]; + } + if (box_chars_1[9]) /* ACS_LTEE */ + { + *bp++ = 't'; + *bp++ = box_chars_1[9]; + } + if (box_chars_1[10]) /* ACS_PLUS */ + { + *bp++ = 'n'; + *bp++ = box_chars_1[10]; + } + + if (bp != buf2) + { + *bp++ = '\0'; + acs_chars = _nc_save_str(buf2); + _nc_warning("acsc string synthesized from AIX capabilities"); + box_chars_1 = ABSENT_STRING; + } + } + /* + * ---------------------------------------------------------------------- + */ +} + +/* + * Do a linear search through the terminfo tables to find a given full-name. + * We don't expect to do this often, so there's no hashing function. + * + * In effect, this scans through the 3 lists of full-names, and looks them + * up in _nc_info_table, which is organized so that the nte_index fields are + * sorted, but the nte_type fields are not necessarily grouped together. + */ +static +struct name_table_entry const * lookup_fullname(const char *find) +{ + int state = -1; + + for (;;) { + int count = 0; + char *const *names; + + switch (++state) { + case BOOLEAN: + names = boolfnames; + break; + case STRING: + names = strfnames; + break; + case NUMBER: + names = numfnames; + break; + default: + return NOTFOUND; + } + + for (count = 0; names[count] != 0; count++) { + if (!strcmp(names[count], find)) { + struct name_table_entry const *entry_ptr = _nc_get_table(FALSE); + while (entry_ptr->nte_type != state + || entry_ptr->nte_index != count) + entry_ptr++; + return entry_ptr; + } + } + } +} + +/* parse_entry.c ends here */ diff --git a/ncurses/read_entry.c b/ncurses/read_entry.c new file mode 100644 index 00000000..868073dc --- /dev/null +++ b/ncurses/read_entry.c @@ -0,0 +1,327 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* + * read_entry.c -- Routine for reading in a compiled terminfo file + * + */ + +#include + +#if HAVE_FCNTL_H +#include +#endif +#include + +#include +#include + +MODULE_ID("$Id: read_entry.c,v 1.31 1997/05/10 17:31:08 tom Exp $") + +TERMINAL *cur_term; + +/* + * int + * _nc_read_file_entry(filename, ptr) + * + * Read the compiled terminfo entry in the given file into the + * structure pointed to by ptr, allocating space for the string + * table. + */ + +#undef BYTE +#define BYTE(p,n) (unsigned char)((p)[n]) + +#define IS_NEG1(p) ((BYTE(p,0) == 0377) && (BYTE(p,1) == 0377)) +#define IS_NEG2(p) ((BYTE(p,0) == 0376) && (BYTE(p,1) == 0377)) +#define LOW_MSB(p) (BYTE(p,0) + 256*BYTE(p,1)) + +static bool have_tic_directory = FALSE; + +/* + * Record the "official" location of the terminfo directory, according to + * the place where we're writing to, or the normal default, if not. + */ +const char *_nc_tic_dir(const char *path) +{ + static const char *result = TERMINFO; + + if (path != 0) { + result = path; + have_tic_directory = TRUE; + } else if (!have_tic_directory) { + char *envp; + if ((envp = getenv("TERMINFO")) != 0) + return _nc_tic_dir(envp); + } + return result; +} + +int _nc_read_file_entry(const char *const filename, TERMTYPE *ptr) +/* return 1 if read, 0 if not found or garbled */ +{ + int name_size, bool_count, num_count, str_count, str_size; + int i, fd, numread; + char buf[MAX_ENTRY_SIZE]; + + if ((fd = open(filename, O_RDONLY)) < 0) + return(0); + + T(("read terminfo %s", filename)); + + /* grab the header */ + (void) read(fd, buf, 12); + if (LOW_MSB(buf) != MAGIC) + { + close(fd); + return(0); + } + name_size = LOW_MSB(buf + 2); + bool_count = LOW_MSB(buf + 4); + num_count = LOW_MSB(buf + 6); + str_count = LOW_MSB(buf + 8); + str_size = LOW_MSB(buf + 10); + + if (str_size) + { + /* try to allocate space for the string table */ + ptr->str_table = malloc((unsigned)str_size); + if (ptr->str_table == 0) + { + close(fd); + return(0); + } + } + + /* grab the name */ + read(fd, buf, min(MAX_NAME_SIZE, (unsigned)name_size)); + buf[MAX_NAME_SIZE] = '\0'; + ptr->term_names = calloc(strlen(buf) + 1, sizeof(char)); + (void) strcpy(ptr->term_names, buf); + if (name_size > MAX_NAME_SIZE) + lseek(fd, (off_t) (name_size - MAX_NAME_SIZE), 1); + + /* grab the booleans */ + read(fd, ptr->Booleans, min(BOOLCOUNT, (unsigned)bool_count)); + if (bool_count > BOOLCOUNT) + lseek(fd, (off_t) (bool_count - BOOLCOUNT), 1); + else + for (i=bool_count; i < BOOLCOUNT; i++) + ptr->Booleans[i] = 0; + + /* + * If booleans end on an odd byte, skip it. The machine they + * originally wrote terminfo on must have been a 16-bit + * word-oriented machine that would trap out if you tried a + * word access off a 2-byte boundary. + */ + if ((name_size + bool_count) % 2 != 0) + read(fd, buf, 1); + + /* grab the numbers */ + (void) read(fd, buf, min(NUMCOUNT*2, (unsigned)num_count*2)); + for (i = 0; i < min(num_count, NUMCOUNT); i++) + { + if (IS_NEG1(buf + 2*i)) + ptr->Numbers[i] = ABSENT_NUMERIC; + else if (IS_NEG2(buf + 2*i)) + ptr->Numbers[i] = CANCELLED_NUMERIC; + else + ptr->Numbers[i] = LOW_MSB(buf + 2*i); + } + if (num_count > NUMCOUNT) + lseek(fd, (off_t) (2 * (num_count - NUMCOUNT)), 1); + else + for (i=num_count; i < NUMCOUNT; i++) + ptr->Numbers[i] = ABSENT_NUMERIC; + + if (str_count) + { + /* grab the string offsets */ + numread = read(fd, buf, (unsigned)(str_count*2)); + if (numread < str_count*2) + { + close(fd); + return(0); + } + for (i = 0; i < numread/2; i++) + { + if (IS_NEG1(buf + 2*i)) + ptr->Strings[i] = ABSENT_STRING; + else if (IS_NEG2(buf + 2*i)) + ptr->Strings[i] = CANCELLED_STRING; + else + ptr->Strings[i] = (LOW_MSB(buf+2*i) + ptr->str_table); + } + } + + if (str_count > STRCOUNT) + lseek(fd, (off_t) (2 * (str_count - STRCOUNT)), 1); + else + for (i = str_count; i < STRCOUNT; i++) + ptr->Strings[i] = ABSENT_STRING; + + if (str_size) + { + /* finally, grab the string table itself */ + numread = read(fd, ptr->str_table, (unsigned)str_size); + if (numread != str_size) + { + close(fd); + return(0); + } + } + + close(fd); + return(1); +} + +/* + * Build a terminfo pathname and try to read the data. Returns 1 on success, + * 0 on failure. + */ +static int _nc_read_tic_entry(char *const filename, + const char *const dir, const char *ttn, TERMTYPE *const tp) +{ +/* maximum safe length of terminfo root directory name */ +#define MAX_TPATH (PATH_MAX - MAX_ALIAS - 6) + + if (strlen(dir) > MAX_TPATH) + return 0; + (void) sprintf(filename, "%s/%s", dir, ttn); + return _nc_read_file_entry(filename, tp); +} + +/* + * _nc_read_entry(char *tn, char *filename, TERMTYPE *tp) + * + * Find and read the compiled entry for a given terminal type, + * if it exists. We take pains here to make sure no combination + * of environment variables and terminal type name can be used to + * overrun the file buffer. + */ + +int _nc_read_entry(const char *const tn, char *const filename, TERMTYPE *const tp) +{ +char *envp; +char ttn[MAX_ALIAS + 3]; + + /* truncate the terminal name to prevent dangerous buffer airline */ + (void) sprintf(ttn, "%c/%.*s", *tn, MAX_ALIAS, tn); + + /* This is System V behavior, in conjunction with our requirements for + * writing terminfo entries. + */ + if (have_tic_directory + && _nc_read_tic_entry(filename, _nc_tic_dir(0), ttn, tp) == 1) + return 1; + + if ((envp = getenv("TERMINFO")) != 0 + && _nc_read_tic_entry(filename, _nc_tic_dir(envp), ttn, tp) == 1) + return 1; + + /* this is an ncurses extension */ + if ((envp = getenv("HOME")) != 0) + { + char *home = malloc(strlen(envp) + strlen(PRIVATE_INFO) + 2); + + (void) sprintf(home, PRIVATE_INFO, envp); + if (_nc_read_tic_entry(filename, home, ttn, tp) == 1) { + free(home); + return(1); + } + free(home); + } + + /* this is an ncurses extension */ + if ((envp = getenv("TERMINFO_DIRS")) != 0) + { + /* strtok modifies its argument, so we must copy */ + char *list = strcpy(malloc(strlen(envp)+1), envp); + const char *cp = strtok(list, ":"); + int code = 0; + + do { + if (cp[0] == '\0') + cp = TERMINFO; + if (_nc_read_tic_entry(filename, cp, ttn, tp) == 1) { + code = 1; + break; + } + } while + ((cp = strtok((char *)0, ":")) != 0); + + free(list); + return(code); + } + + /* try the system directory */ + return(_nc_read_tic_entry(filename, TERMINFO, ttn, tp)); +} + +/* + * _nc_first_name(char *names) + * + * Extract the primary name from a compiled entry. + */ + +char *_nc_first_name(const char *const sp) +/* get the first name from the given name list */ +{ + static char buf[MAX_NAME_SIZE]; + register char *cp; + + (void) strcpy(buf, sp); + + cp = strchr(buf, '|'); + if (cp) + *cp = '\0'; + + return(buf); +} + +/* + * bool _nc_name_match(namelist, name, delim) + * + * Is the given name matched in namelist? + */ + +int _nc_name_match(const char *const namelst, const char *const name, const char *const delim) +/* microtune this, it occurs in several critical loops */ +{ +char namecopy[MAX_ENTRY_SIZE]; /* this may get called on a TERMCAP value */ +register char *cp; + + if (namelst == 0) + return(FALSE); + (void) strcpy(namecopy, namelst); + if ((cp = strtok(namecopy, delim)) != 0) { + do { + /* avoid strcmp() function-call cost if possible */ + if (cp[0] == name[0] && strcmp(cp, name) == 0) + return(TRUE); + } while + ((cp = strtok((char *)0, delim)) != 0); + } + return(FALSE); +} diff --git a/ncurses/read_termcap.c b/ncurses/read_termcap.c new file mode 100644 index 00000000..3243694d --- /dev/null +++ b/ncurses/read_termcap.c @@ -0,0 +1,966 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * Termcap compatibility support + * + * If your OS integrator didn't install a terminfo database, you can call + * _nc_read_termcap_entry() to support reading and translating capabilities + * from the system termcap file. This is a kludge; it will bulk up and slow + * down every program that uses ncurses, and translated termcap entries cannot + * use full terminfo capabilities. Don't use it unless you absolutely have to; + * instead, get your system people to run tic(1) from root on the terminfo + * master included with ncurses to translate it into a terminfo database. + * + * If USE_GETCAP is enabled, we use what is effectively a copy of the 4.4BSD + * getcap code to fetch entries. There are disadvantages to this; mainly that + * getcap(3) does its own resolution, meaning that entries read in in this way + * can't reference the terminfo tree. The only thing it buys is faster startup + * time, getcap(3) is much faster than our tic parser. + */ + +#include + +#include +#include +#include + +#if HAVE_FCNTL_H +#include +#endif + +MODULE_ID("$Id: read_termcap.c,v 1.21 1996/12/21 14:24:06 tom Exp $") + +#define TC_SUCCESS 0 +#define TC_UNRESOLVED -1 +#define TC_NOT_FOUND -2 +#define TC_SYS_ERR -3 +#define TC_REF_LOOP -4 + +#ifdef USE_GETCAP +/* + * Copyright (c) 1980, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* static char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93" */ + +#define PBUFSIZ 512 /* max length of filename path */ +#define PVECSIZ 32 /* max number of names in path */ + +static char *_nc_cgetcap(char *, const char *, int); +static int _nc_cgetent(char **, int *, char **, const char *); +static int _nc_cgetmatch(char *, const char *); +static int _nc_cgetset(const char *); +static int _nc_getent(char **, unsigned int *, int *, int, char **, int, const char *, int, char *); +static int _nc_nfcmp(const char *, char *); +static int _nc_tgetent(char *, char **, int *, const char *); + +/* + * termcap - routines for dealing with the terminal capability data base + * + * BUG: Should use a "last" pointer in tbuf, so that searching + * for capabilities alphabetically would not be a n**2/2 + * process when large numbers of capabilities are given. + * Note: If we add a last pointer now we will screw up the + * tc capability. We really should compile termcap. + * + * Essentially all the work here is scanning and decoding escapes in string + * capabilities. We don't use stdio because the editor doesn't, and because + * living w/o it is not hard. + */ + +static char *tbuf; /* termcap buffer */ + +/* + * Get an entry for terminal name in buffer bp from the termcap file. + */ +static int +_nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) +{ + static char *the_source; + + register char *p; + register char *cp; + char *dummy; + char **fname; + char *home; + int i; + char pathbuf[PBUFSIZ]; /* holds raw path of filenames */ + char *pathvec[PVECSIZ]; /* to point to names in pathbuf */ + char **pvec; /* holds usable tail of path vector */ + char *termpath; + + fname = pathvec; + pvec = pathvec; + tbuf = bp; + p = pathbuf; + cp = getenv("TERMCAP"); + + /* + * TERMCAP can have one of two things in it. It can be the name of a + * file to use instead of /etc/termcap. In this case it better start + * with a "/". Or it can be an entry to use so we don't have to read + * the file. In this case it has to already have the newlines crunched + * out. If TERMCAP does not hold a file name then a path of names is + * searched instead. The path is found in the TERMPATH variable, or + * becomes "$HOME/.termcap /etc/termcap" if no TERMPATH exists. + */ + if (!cp || *cp != '/') { /* no TERMCAP or it holds an entry */ + if ((termpath = getenv("TERMPATH")) != 0) { + strncpy(pathbuf, termpath, sizeof(pathbuf)-1); + } else { + if ((home = getenv("HOME")) != 0) { /* setup path */ + p += strlen(home); /* path, looking in */ + strcpy(pathbuf, home); /* $HOME first */ + *p++ = '/'; + } /* if no $HOME look in current directory */ +#define MY_PATH_DEF ".termcap /etc/termcap /usr/share/misc/termcap" + strncpy(p, MY_PATH_DEF, PBUFSIZ - (p - pathbuf)); + } + } + else /* user-defined name in TERMCAP */ + strncpy(pathbuf, cp, PBUFSIZ); /* still can be tokenized */ + + *fname++ = pathbuf; /* tokenize path into vector of names */ + while (*++p) { + if (*p == ' ' || *p == ':') { + *p = '\0'; + while (*++p) + if (*p != ' ' && *p != ':') + break; + if (*p == '\0') + break; + *fname++ = p; + if (fname >= pathvec + PVECSIZ) { + fname--; + break; + } + } + } + *fname = 0; /* mark end of vector */ + if (cp && *cp && *cp != '/') { + if (_nc_cgetset(cp) < 0) + return(TC_SYS_ERR); + } + + i = _nc_cgetent(&dummy, lineno, pathvec, name); + + if (i >= 0) + strcpy(bp, dummy); + + FreeIfNeeded(dummy); + FreeIfNeeded(the_source); + the_source = 0; + + if (i >= 0) { + the_source = malloc(strlen(pathvec[i]) + 1); + if (the_source != 0) + *sourcename = strcpy(the_source, pathvec[i]); + } + + return(i); +} + +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Casey Leedom of Lawrence Livermore National Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* static char sccsid[] = "@(#)getcap.c 8.3 (Berkeley) 3/25/94"; */ + +#define BFRAG 1024 +#define BSIZE 1024 +#define ESC ('[' & 037) /* ASCII ESC */ +#define MAX_RECURSION 32 /* maximum getent recursion */ +#define SFRAG 100 /* cgetstr mallocs in SFRAG chunks */ + +#define RECOK (char)0 +#define TCERR (char)1 +#define SHADOW (char)2 + +static size_t topreclen; /* toprec length */ +static char *toprec; /* Additional record specified by cgetset() */ +static int gottoprec; /* Flag indicating retrieval of toprecord */ + +/* + * Cgetset() allows the addition of a user specified buffer to be added to the + * database array, in effect "pushing" the buffer on top of the virtual + * database. 0 is returned on success, -1 on failure. + */ +static int +_nc_cgetset(const char *ent) +{ + if (ent == 0) { + FreeIfNeeded(toprec); + toprec = 0; + topreclen = 0; + return (0); + } + topreclen = strlen(ent); + if ((toprec = malloc (topreclen + 1)) == 0) { + errno = ENOMEM; + return (-1); + } + gottoprec = 0; + (void)strcpy(toprec, ent); + return (0); +} + +/* + * Cgetcap searches the capability record buf for the capability cap with type + * `type'. A pointer to the value of cap is returned on success, 0 if the + * requested capability couldn't be found. + * + * Specifying a type of ':' means that nothing should follow cap (:cap:). In + * this case a pointer to the terminating ':' or NUL will be returned if cap is + * found. + * + * If (cap, '@') or (cap, terminator, '@') is found before (cap, terminator) + * return 0. + */ +static char * +_nc_cgetcap(char *buf, const char *cap, int type) +{ + register const char *cp; + register char *bp; + + bp = buf; + for (;;) { + /* + * Skip past the current capability field - it's either the + * name field if this is the first time through the loop, or + * the remainder of a field whose name failed to match cap. + */ + for (;;) { + if (*bp == '\0') + return (0); + else if (*bp++ == ':') + break; + } + + /* + * Try to match (cap, type) in buf. + */ + for (cp = cap; *cp == *bp && *bp != '\0'; cp++, bp++) + continue; + if (*cp != '\0') + continue; + if (*bp == '@') + return (0); + if (type == ':') { + if (*bp != '\0' && *bp != ':') + continue; + return(bp); + } + if (*bp != type) + continue; + bp++; + return (*bp == '@' ? 0 : bp); + } + /* NOTREACHED */ +} + +/* + * Cgetent extracts the capability record name from the NULL terminated file + * array db_array and returns a pointer to a malloc'd copy of it in buf. Buf + * must be retained through all subsequent calls to cgetcap, cgetnum, cgetflag, + * and cgetstr, but may then be freed. + * + * Returns: + * + * positive # on success (i.e., the index in db_array) + * TC_UNRESOLVED if we had too many recurrences to resolve + * TC_NOT_FOUND if the requested record couldn't be found + * TC_SYS_ERR if a system error was encountered (e.g.,couldn't open a file) + * TC_REF_LOOP if a potential reference loop is detected + */ +static int +_nc_cgetent(char **buf, int *oline, char **db_array, const char *name) +{ + unsigned int dummy; + + return (_nc_getent(buf, &dummy, oline, 0, db_array, -1, name, 0, 0)); +} + +/* + * Getent implements the functions of cgetent. If fd is non-negative, + * *db_array has already been opened and fd is the open file descriptor. We + * do this to save time and avoid using up file descriptors for tc= + * recursions. + * + * Getent returns the same success/failure codes as cgetent. On success, a + * pointer to a malloc'd capability record with all tc= capabilities fully + * expanded and its length (not including trailing ASCII NUL) are left in + * *cap and *len. + * + * Basic algorithm: + * + Allocate memory incrementally as needed in chunks of size BFRAG + * for capability buffer. + * + Recurse for each tc=name and interpolate result. Stop when all + * names interpolated, a name can't be found, or depth exceeds + * MAX_RECURSION. + */ +static int +_nc_getent( + char **cap, /* termcap-content */ + unsigned int *len, /* length, needed for recursion */ + int *beginning, /* line-number at match */ + int in_array, /* index in 'db_array[] */ + char **db_array, /* list of files to search */ + int fd, + const char *name, + int depth, + char *nfield) +{ + register char *r_end, *rp; + int myfd = FALSE; + char *record; + int tc_not_resolved; + int current; + int lineno; + + /* + * Return with ``loop detected'' error if we've recurred more than + * MAX_RECURSION times. + */ + if (depth > MAX_RECURSION) + return (TC_REF_LOOP); + + /* + * Check if we have a top record from cgetset(). + */ + if (depth == 0 && toprec != 0 && _nc_cgetmatch(toprec, name) == 0) { + if ((record = malloc (topreclen + BFRAG)) == 0) { + errno = ENOMEM; + return (TC_SYS_ERR); + } + (void)strcpy(record, toprec); + rp = record + topreclen + 1; + r_end = rp + BFRAG; + current = in_array; + } else { + int foundit; + + /* + * Allocate first chunk of memory. + */ + if ((record = malloc(BFRAG)) == 0) { + errno = ENOMEM; + return (TC_SYS_ERR); + } + rp = r_end = record + BFRAG; + foundit = FALSE; + + /* + * Loop through database array until finding the record. + */ + for (current = in_array; db_array[current] != 0; current++) { + int eof = FALSE; + + /* + * Open database if not already open. + */ + if (fd >= 0) { + (void)lseek(fd, (off_t)0, SEEK_SET); + } else { + fd = open(db_array[current], O_RDONLY, 0); + if (fd < 0) { + /* No error on unfound file. */ + if (errno == ENOENT) + continue; + free(record); + return (TC_SYS_ERR); + } + myfd = TRUE; + } + lineno = 0; + + /* + * Find the requested capability record ... + */ + { + char buf[2048]; + register char *b_end = buf; + register char *bp = buf; + register int c; + + /* + * Loop invariants: + * There is always room for one more character in record. + * R_end always points just past end of record. + * Rp always points just past last character in record. + * B_end always points just past last character in buf. + * Bp always points at next character in buf. + */ + + for (;;) { + int first = lineno + 1; + + /* + * Read in a line implementing (\, newline) + * line continuation. + */ + rp = record; + for (;;) { + if (bp >= b_end) { + int n; + + n = read(fd, buf, sizeof(buf)); + if (n <= 0) { + if (myfd) + (void)close(fd); + if (n < 0) { + free(record); + return (TC_SYS_ERR); + } + fd = -1; + eof = TRUE; + break; + } + b_end = buf+n; + bp = buf; + } + + c = *bp++; + if (c == '\n') { + lineno++; + if (rp == record || *(rp-1) != '\\') + break; + } + *rp++ = c; + + /* + * Enforce loop invariant: if no room + * left in record buffer, try to get + * some more. + */ + if (rp >= r_end) { + unsigned int pos; + size_t newsize; + + pos = rp - record; + newsize = r_end - record + BFRAG; + record = realloc(record, newsize); + if (record == 0) { + errno = ENOMEM; + if (myfd) + (void)close(fd); + return (TC_SYS_ERR); + } + r_end = record + newsize; + rp = record + pos; + } + } + /* loop invariant lets us do this */ + *rp++ = '\0'; + + /* + * If encountered eof check next file. + */ + if (eof) + break; + + /* + * Toss blank lines and comments. + */ + if (*record == '\0' || *record == '#') + continue; + + /* + * See if this is the record we want ... + */ + if (_nc_cgetmatch(record, name) == 0 + && (nfield == 0 + || !_nc_nfcmp(nfield, record))) { + foundit = TRUE; + *beginning = first; + break; /* found it! */ + } + } + } + if (foundit) + break; + } + + if (!foundit) + return (TC_NOT_FOUND); + } + + /* + * Got the capability record, but now we have to expand all tc=name + * references in it ... + */ + { + register char *newicap, *s; + register int newilen; + unsigned int ilen; + int diff, iret, tclen, oline; + char *icap, *scan, *tc, *tcstart, *tcend; + + /* + * Loop invariants: + * There is room for one more character in record. + * R_end points just past end of record. + * Rp points just past last character in record. + * Scan points at remainder of record that needs to be + * scanned for tc=name constructs. + */ + scan = record; + tc_not_resolved = FALSE; + for (;;) { + if ((tc = _nc_cgetcap(scan, "tc", '=')) == 0) + break; + + /* + * Find end of tc=name and stomp on the trailing `:' + * (if present) so we can use it to call ourselves. + */ + s = tc; + while (*s != '\0') { + if (*s++ == ':') { + *(s - 1) = '\0'; + break; + } + } + tcstart = tc - 3; + tclen = s - tcstart; + tcend = s; + + iret = _nc_getent(&icap, &ilen, &oline, current, db_array, fd, tc, depth+1, 0); + newicap = icap; /* Put into a register. */ + newilen = ilen; + if (iret != TC_SUCCESS) { + /* an error */ + if (iret < TC_NOT_FOUND) { + if (myfd) + (void)close(fd); + free(record); + return (iret); + } + if (iret == TC_UNRESOLVED) + tc_not_resolved = TRUE; + /* couldn't resolve tc */ + if (iret == TC_NOT_FOUND) { + *(s - 1) = ':'; + scan = s - 1; + tc_not_resolved = TRUE; + continue; + } + } + + /* not interested in name field of tc'ed record */ + s = newicap; + while (*s != '\0' && *s++ != ':') + ; + newilen -= s - newicap; + newicap = s; + + /* make sure interpolated record is `:'-terminated */ + s += newilen; + if (*(s-1) != ':') { + *s = ':'; /* overwrite NUL with : */ + newilen++; + } + + /* + * Make sure there's enough room to insert the + * new record. + */ + diff = newilen - tclen; + if (diff >= r_end - rp) { + unsigned int pos, tcpos, tcposend; + size_t newsize; + + pos = rp - record; + newsize = r_end - record + diff + BFRAG; + tcpos = tcstart - record; + tcposend = tcend - record; + record = realloc(record, newsize); + if (record == 0) { + errno = ENOMEM; + if (myfd) + (void)close(fd); + free(icap); + return (TC_SYS_ERR); + } + r_end = record + newsize; + rp = record + pos; + tcstart = record + tcpos; + tcend = record + tcposend; + } + + /* + * Insert tc'ed record into our record. + */ + s = tcstart + newilen; + memmove(s, tcend, rp - tcend); + memmove(tcstart, newicap, newilen); + rp += diff; + free(icap); + + /* + * Start scan on `:' so next cgetcap works properly + * (cgetcap always skips first field). + */ + scan = s-1; + } + } + + /* + * Close file (if we opened it), give back any extra memory, and + * return capability, length and success. + */ + if (myfd) + (void)close(fd); + *len = rp - record - 1; /* don't count NUL */ + if (r_end > rp) { + if ((record = realloc(record, (size_t)(rp - record))) == 0) { + errno = ENOMEM; + return (TC_SYS_ERR); + } + } + + *cap = record; + if (tc_not_resolved) + return (TC_UNRESOLVED); + return (current); +} + +/* + * Cgetmatch will return 0 if name is one of the names of the capability + * record buf, -1 if not. + */ +static int +_nc_cgetmatch(char *buf, const char *name) +{ + register const char *np; + register char *bp; + + /* + * Start search at beginning of record. + */ + bp = buf; + for (;;) { + /* + * Try to match a record name. + */ + np = name; + for (;;) { + if (*np == '\0') { + if (*bp == '|' || *bp == ':' || *bp == '\0') + return (0); + else + break; + } else if (*bp++ != *np++) { + break; + } + } + + /* + * Match failed, skip to next name in record. + */ + bp--; /* a '|' or ':' may have stopped the match */ + for (;;) { + if (*bp == '\0' || *bp == ':') + return (-1); /* match failed totally */ + else if (*bp++ == '|') + break; /* found next name */ + } + } +} + +/* + * Compare name field of record. + */ +static int +_nc_nfcmp(const char *nf, char *rec) +{ + char *cp, tmp; + int ret; + + for (cp = rec; *cp != ':'; cp++) + ; + + tmp = *(cp + 1); + *(cp + 1) = '\0'; + ret = strcmp(nf, rec); + *(cp + 1) = tmp; + + return (ret); +} +#endif /* USE_GETCAP */ + +int _nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp) +{ + int found = FALSE; + ENTRY *ep; + char cwd_buf[PATH_MAX]; +#ifndef USE_GETCAP + /* + * Here is what the 4.4BSD termcap(3) page prescribes: + * + * It will look in the environment for a TERMCAP variable. If found, + * and the value does not begin with a slash, and the terminal type + * name is the same as the environment string TERM, the TERMCAP string + * is used instead of reading a termcap file. If it does begin with a + * slash, the string is used as a path name of the termcap file to + * search. If TERMCAP does not begin with a slash and name is + * different from TERM, tgetent() searches the files $HOME/.termcap and + * /usr/share/misc/termcap, in that order, unless the environment + * variable TERMPATH exists, in which case it specifies a list of file + * pathnames (separated by spaces or colons) to be searched instead. + * + * It goes on to state: + * + * Whenever multiple files are searched and a tc field occurs in the + * requested entry, the entry it names must be found in the same file + * or one of the succeeding files. + * + * However, this restriction is relaxed in ncurses; tc references to + * previous files are permitted. + * + * This routine returns 1 if an entry is found, 0 if not found, and -1 + * if the database is not accessible. + */ + FILE *fp; +#define MAXPATHS 32 + char *tc, *termpaths[MAXPATHS]; + int filecount = 0; + bool use_buffer = FALSE; + char tc_buf[1024]; + char pathbuf[PATH_MAX]; + + if ((tc = getenv("TERMCAP")) != 0) + { + if (tc[0] == '/') /* interpret as a filename */ + { + termpaths[0] = tc; + termpaths[filecount = 1] = 0; + } + else if (_nc_name_match(tc, tn, "|:")) /* treat as a capability file */ + { + use_buffer = TRUE; + (void) sprintf(tc_buf, "%.*s\n", (int)sizeof(tc_buf)-2, tc); + } + else if ((tc = getenv("TERMPATH")) != 0) + { + char *cp; + + for (cp = tc; *cp; cp++) + { + if (*cp == ':') + *cp = '\0'; + else if (cp == tc || cp[-1] == '\0') + { + if (filecount >= MAXPATHS - 1) + return(-1); + + termpaths[filecount++] = cp; + } + } + termpaths[filecount] = 0; + } + } + else /* normal case */ + { + char envhome[PATH_MAX], *h; + + filecount = 0; + + /* + * Probably /etc/termcap is a symlink to /usr/share/misc/termcap. + * Avoid reading the same file twice. + */ + if (access("/etc/termcap", R_OK) == 0) + termpaths[filecount++] = "/etc/termcap"; + else if (access("/usr/share/misc/termcap", R_OK) == 0) + termpaths[filecount++] = "/usr/share/misc/termcap"; + + if ((h = getenv("HOME")) != (char *)NULL) + { + /* user's .termcap, if any, should override it */ + (void) strncpy(envhome, h, PATH_MAX - 10); + envhome[PATH_MAX - 10] = '\0'; + (void) sprintf(pathbuf, "%s/.termcap", envhome); + termpaths[filecount++] = pathbuf; + } + + termpaths[filecount] = 0; + } + + /* parse the sources */ + if (use_buffer) + { + _nc_set_source("TERMCAP"); + + /* + * We don't suppress warning messages here. The presumption is + * that since it's just a single entry, they won't be a pain. + */ + _nc_read_entry_source((FILE *)0, tc_buf, FALSE, FALSE, NULLHOOK); + } else { + int i; + + for (i = 0; i < filecount; i++) { + + T(("Looking for %s in %s", tn, termpaths[i])); + if ((fp = fopen(termpaths[i], "r")) != (FILE *)0) + { + _nc_set_source(termpaths[i]); + + /* + * Suppress warning messages. Otherwise you + * get 400 lines of crap from archaic termcap + * files as ncurses complains about all the + * obsolete capabilities. + */ + _nc_read_entry_source(fp, (char*)0, FALSE, TRUE, NULLHOOK); + + (void) fclose(fp); + } + } + } +#else + char tc[2048 * 2]; + static char *source; + static int lineno; + + /* we're using getcap(3) */ + if (_nc_tgetent(tc, &source, &lineno, tn) <= 0) + return (ERR); + + _nc_curr_line = lineno; + _nc_set_source(source); + _nc_read_entry_source((FILE *)0, tc, FALSE, FALSE, NULLHOOK); +#endif + + if (_nc_head == 0) + return(ERR); + + /* resolve all use references */ + _nc_resolve_uses(); + + /* find a terminal matching tn, if we can */ + if (getcwd(cwd_buf, sizeof(cwd_buf)) != 0) + { + _nc_set_writedir((char *)0); /* note: this does a chdir */ + for_entry_list(ep) { + if (_nc_name_match(ep->tterm.term_names, tn, "|:")) + { + /* + * Make a local copy of the terminal + * capabilities. Free all entry storage except + * the string table for the loaded type (which + * we disconnected from the list by NULLing out + * ep->tterm.str_table above). + */ + memcpy(tp, &ep->tterm, sizeof(TERMTYPE)); + ep->tterm.str_table = (char *)0; + + /* + * OK, now try to write the type to user's + * terminfo directory. Next time he loads + * this, it will come through terminfo. + * + * Advantage: Second and subsequent fetches of + * this entry will be very fast. + * + * Disadvantage: After the first time a + * termcap type is loaded by its user, editing + * it in the /etc/termcap file, or in TERMCAP, + * or in a local ~/.termcap, will be + * ineffective unless the terminfo entry is + * explicitly removed. + */ +#if USE_GETCAP_CACHE + (void) _nc_write_entry(tp); +#endif + found = TRUE; + break; + } + } + chdir(cwd_buf); + } + + _nc_free_entries(_nc_head); + return(found); +} diff --git a/ncurses/resizeterm.c b/ncurses/resizeterm.c new file mode 100644 index 00000000..59a971f5 --- /dev/null +++ b/ncurses/resizeterm.c @@ -0,0 +1,99 @@ +/****************************************************************************** + * Copyright 1996,1997 by Thomas E. Dickey * + * All Rights Reserved. * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * + * that the above copyright notice appear in all copies and that both that * + * copyright notice and this permission notice appear in supporting * + * documentation, and that the name of the above listed copyright holder(s) * + * not be used in advertising or publicity pertaining to distribution of the * + * software without specific, written prior permission. THE ABOVE LISTED * + * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * + * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + ******************************************************************************/ + +/* + * This is an extension to the curses library. It provides callers with a hook + * into the NCURSES data to resize windows, primarily for use by programs + * running in an X Window terminal (e.g., xterm). I abstracted this module + * from my application library for NCURSES because it must be compiled with + * the private data structures -- T.Dickey 1995/7/4. + */ + +#include +#include + +MODULE_ID("$Id: resizeterm.c,v 1.3 1997/02/02 01:03:06 tom Exp $") + +/* + * This function reallocates NCURSES window structures. It is invoked in + * response to a SIGWINCH interrupt. Other user-defined windows may also need + * to be reallocated. + * + * Because this performs memory allocation, it should not (in general) be + * invoked directly from the signal handler. + */ +int +resizeterm(int ToLines, int ToCols) +{ + int stolen = screen_lines - SP->_lines_avail; + int bottom = screen_lines + SP->_topstolen - stolen; + + T((T_CALLED("resizeterm(%d,%d) old(%d,%d)"), + ToLines, ToCols, + screen_lines, screen_columns)); + + if (ToLines != screen_lines + || ToCols != screen_columns) { + WINDOWLIST *wp; + + for (wp = _nc_windows; wp != 0; wp = wp->next) { + WINDOW *win = wp->win; + int myLines = win->_maxy + 1; + int myCols = win->_maxx + 1; + + /* pads aren't treated this way */ + if (win->_flags & _ISPAD) + continue; + + if (win->_begy >= bottom) { + win->_begy += (ToLines - screen_lines); + } else { + if (myLines == screen_lines - stolen + && ToLines != screen_lines) + myLines = ToLines - stolen; + else + if (myLines == screen_lines + && ToLines != screen_lines) + myLines = ToLines; + } + + if (myCols == screen_columns + && ToCols != screen_columns) + myCols = ToCols; + + if (wresize(win, myLines, myCols) != OK) + returnCode(ERR); + } + + screen_lines = lines = ToLines; + screen_columns = columns = ToCols; + + SP->_lines_avail = lines - stolen; + } + + /* + * Always update LINES, to allow for call from lib_doupdate.c which + * needs to have the count adjusted by the stolen (ripped off) lines. + */ + LINES = ToLines - stolen; + COLS = ToCols; + + returnCode(OK); +} diff --git a/ncurses/sigaction.c b/ncurses/sigaction.c new file mode 100644 index 00000000..f3a5704c --- /dev/null +++ b/ncurses/sigaction.c @@ -0,0 +1,86 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +#include + +/* This file provides sigaction() emulation using sigvec() */ +/* Use only if this is non POSIX system */ + +#if !HAVE_SIGACTION +#include +#include + +MODULE_ID("$Id: sigaction.c,v 1.6 1996/07/31 00:15:36 tom Exp $") + +int +sigaction (int sig, sigaction_t * sigact, sigaction_t * osigact) +{ + return sigvec(sig, sigact, osigact); +} + +int +sigemptyset (sigset_t * mask) +{ + *mask = 0; + return 0; +} + +int +sigprocmask (int mode, sigset_t * mask, sigset_t * omask) + { + sigset_t current = sigsetmask(0); + + if (omask) *omask = current; + + if (mode==SIG_BLOCK) + current |= *mask; + else if (mode==SIG_UNBLOCK) + current &= ~*mask; + else if (mode==SIG_SETMASK) + current = *mask; + + sigsetmask(current); + return 0; + } + +int +sigsuspend (sigset_t * mask) +{ + return sigpause (*mask); +} + +int +sigdelset (sigset_t * mask, int sig) +{ + *mask &= ~sigmask (sig); + return 0; +} + +int +sigaddset (sigset_t * mask, int sig) +{ + *mask |= sigmask (sig); + return 0; +} +#else +extern void _nc_sigaction(void); /* quiet's gcc warning */ +void _nc_sigaction(void) { } /* nonempty for strict ANSI compilers */ +#endif diff --git a/ncurses/vsscanf.c b/ncurses/vsscanf.c new file mode 100644 index 00000000..ac2bf9f2 --- /dev/null +++ b/ncurses/vsscanf.c @@ -0,0 +1,47 @@ +/* + * This function is needed to support vwscanw + */ + +#include + +#if !HAVE_VSSCANF + +MODULE_ID("$Id: vsscanf.c,v 1.10 1996/12/21 14:24:06 tom Exp $") + +#if defined(_IOREAD) && defined(_NFILE) +/*VARARGS2*/ +int vsscanf(const char *str, const char *format, va_list ap) +{ + /* + * This code should work on anything descended from AT&T SVr1. + */ + FILE strbuf; + + strbuf._flag = _IOREAD; + strbuf._ptr = strbuf._base = (unsigned char*)str; + strbuf._cnt = strlen(str); + strbuf._file = _NFILE; + +#if HAVE_VFSCANF + return(vfscanf(&strbuf, format, ap)); +#else + return(_doscan(&strbuf, format, ap)); +#endif +} +#else +/*VARARGS2*/ +int vsscanf(const char *str, const char *format, va_list ap) +{ + /* + * You don't have a native vsscanf(3), and you don't have System-V + * compatible stdio internals. You're probably using a BSD + * older than 4.4 or a really old Linux. You lose. Upgrade + * to a current C library to win. + */ + return -1; /* not implemented */ +} +#endif +#else +extern void _nc_vsscanf(void); /* quiet's gcc warning */ +void _nc_vsscanf(void) { } /* nonempty for strict ANSI compilers */ +#endif /* !HAVE_VSSCANF */ diff --git a/ncurses/wresize.c b/ncurses/wresize.c new file mode 100644 index 00000000..bd96c3f3 --- /dev/null +++ b/ncurses/wresize.c @@ -0,0 +1,159 @@ +/****************************************************************************** + * Copyright 1996,1997 by Thomas E. Dickey * + * All Rights Reserved. * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * + * that the above copyright notice appear in all copies and that both that * + * copyright notice and this permission notice appear in supporting * + * documentation, and that the name of the above listed copyright holder(s) * + * not be used in advertising or publicity pertaining to distribution of the * + * software without specific, written prior permission. THE ABOVE LISTED * + * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * + * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + ******************************************************************************/ + +#include +#include + +MODULE_ID("$Id: wresize.c,v 1.5 1997/02/01 23:22:54 tom Exp $") + +/* + * Reallocate a curses WINDOW struct to either shrink or grow to the specified + * new lines/columns. If it grows, the new character cells are filled with + * blanks. The application is responsible for repainting the blank area. + */ + +static void *doalloc(void *p, size_t n) +{ + if (p == 0) + p = malloc(n); + else + p = realloc(p, n); + return p; +} + +#define DOALLOC(p,t,n) (t *)doalloc(p, sizeof(t)*(n)) +#define ld_ALLOC(p,n) DOALLOC(p,struct ldat,n) +#define c_ALLOC(p,n) DOALLOC(p,chtype,n) + +int +wresize(WINDOW *win, int ToLines, int ToCols) +{ + register int row; + int size_x, size_y; + struct ldat *pline = (win->_flags & _SUBWIN) ? win->_parent->_line : 0; + +#ifdef TRACE + T((T_CALLED("wresize(%p,%d,%d)"), win, ToLines, ToCols)); + TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)", + win->_begy, win->_begx, + win->_maxy, win->_maxx, + win->_regtop, win->_regbottom)); + if (_nc_tracing & TRACE_UPDATE) + _tracedump("...before", win); +#endif + + if (--ToLines < 0 || --ToCols < 0) + returnCode(ERR); + + size_x = win->_maxx; + size_y = win->_maxy; + + if (ToLines == size_y + && ToCols == size_x) + returnCode(OK); + + /* + * If the number of lines has changed, adjust the size of the overall + * vector: + */ + if (ToLines != size_y) { + if (! (win->_flags & _SUBWIN)) { + for (row = ToLines+1; row <= size_y; row++) + free((char *)(win->_line[row].text)); + } + + win->_line = ld_ALLOC(win->_line, ToLines+1); + if (win->_line == 0) + returnCode(ERR); + + for (row = size_y+1; row <= ToLines; row++) { + win->_line[row].text = 0; + win->_line[row].firstchar = 0; + win->_line[row].lastchar = ToCols; + if ((win->_flags & _SUBWIN)) { + win->_line[row].text = + &pline[win->_begy + row].text[win->_begx]; + } + } + } + + /* + * Adjust the width of the columns: + */ + for (row = 0; row <= ToLines; row++) { + chtype *s = win->_line[row].text; + int begin = (s == 0) ? 0 : size_x + 1; + int end = ToCols; + chtype blank = _nc_background(win); + + win->_line[row].oldindex = row; + + if (ToCols != size_x || s == 0) { + if (! (win->_flags & _SUBWIN)) { + win->_line[row].text = s = c_ALLOC(s, ToCols+1); + if (win->_line[row].text == 0) + returnCode(ERR); + } else if (s == 0) { + win->_line[row].text = s = + &pline[win->_begy + row].text[win->_begx]; + } + + if (end >= begin) { /* growing */ + if (win->_line[row].firstchar < begin) + win->_line[row].firstchar = begin; + win->_line[row].lastchar = ToCols; + do { + s[end] = blank; + } while (--end >= begin); + } else { /* shrinking */ + win->_line[row].firstchar = 0; + win->_line[row].lastchar = ToCols; + } + } + } + + /* + * Finally, adjust the parameters showing screen size and cursor + * position: + */ + win->_maxx = ToCols; + win->_maxy = ToLines; + + if (win->_regtop > win->_maxy) + win->_regtop = win->_maxy; + if (win->_regbottom > win->_maxy + || win->_regbottom == size_y) + win->_regbottom = win->_maxy; + + if (win->_curx > win->_maxx) + win->_curx = win->_maxx; + if (win->_cury > win->_maxy) + win->_cury = win->_maxy; + +#ifdef TRACE + TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)", + win->_begy, win->_begx, + win->_maxy, win->_maxx, + win->_regtop, win->_regbottom)); + if (_nc_tracing & TRACE_UPDATE) + _tracedump("...after:", win); +#endif + returnCode(OK); +} diff --git a/ncurses/write_entry.c b/ncurses/write_entry.c new file mode 100644 index 00000000..95117128 --- /dev/null +++ b/ncurses/write_entry.c @@ -0,0 +1,408 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + + +/* + * write_entry.c -- write a terminfo structure onto the file system + */ + +#include + +#include + +#include +#include +#include + +#ifndef S_ISDIR +#define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR) +#endif + +MODULE_ID("$Id: write_entry.c,v 1.16 1997/05/10 17:33:12 tom Exp $") + +static int total_written; + +static int write_object(FILE *, TERMTYPE *); + +/* + * make_directory(char *path) + * + * Make a directory if it doesn't exist. + */ +static int make_directory(const char *path) +{ +int rc; +struct stat statbuf; +char fullpath[PATH_MAX]; +const char *destination = _nc_tic_dir(0); + + if (path == destination || *path == '/') + (void)strcpy(fullpath, path); + else + (void)sprintf(fullpath, "%s/%s", destination, path); + + if ((rc = stat(path, &statbuf)) < 0) { + rc = mkdir(path, 0777); + } else { + if (access(path, R_OK|W_OK|X_OK) < 0) { + _nc_err_abort("%s: permission denied", fullpath); + } else if (!(S_ISDIR(statbuf.st_mode))) { + _nc_err_abort("%s: not a directory", fullpath); + } + } + return rc; +} + +void _nc_set_writedir(char *dir) +/* set the write directory for compiled entries */ +{ + const char *destination; + + if (dir != 0) + (void) _nc_tic_dir(dir); + else if (getenv("TERMINFO") != NULL) + (void) _nc_tic_dir(getenv("TERMINFO")); + + destination = _nc_tic_dir(0); + if (make_directory(destination) < 0) + { + char *home; + + /* ncurses extension...fall back on user's private directory */ + if ((home = getenv("HOME")) != (char *)NULL) + { + char *temp = malloc(sizeof(PRIVATE_INFO) + strlen(home)); + (void) sprintf(temp, PRIVATE_INFO, home); + destination = temp; + + if (make_directory(destination) < 0) + _nc_err_abort("%s: permission denied (errno %d)", + destination, errno); + } + } + + /* + * Note: because of this code, this logic should be exercised + * *once only* per run. + */ + if (chdir(_nc_tic_dir(destination)) < 0) + _nc_err_abort("%s: not a directory", destination); +} + +/* + * check_writeable(char code) + * + * Miscellaneous initialisations + * + * Check for access rights to destination directories + * Create any directories which don't exist. + * + */ + +static void check_writeable(int code) +{ +static const char dirnames[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; +static bool verified[sizeof(dirnames)]; + +char dir[2]; +char *s; + + if (code == 0 || (s = strchr(dirnames, code)) == 0) + _nc_err_abort("Illegal terminfo subdirectory \"%c\"", code); + + if (verified[s-dirnames]) + return; + + dir[0] = code; + dir[1] = '\0'; + (void) make_directory(dir); + + verified[s-dirnames] = TRUE; +} + +/* + * _nc_write_entry() + * + * Save the compiled version of a description in the filesystem. + * + * make a copy of the name-list + * break it up into first-name and all-but-last-name + * creat(first-name) + * write object information to first-name + * close(first-name) + * for each name in all-but-last-name + * link to first-name + * + * Using 'time()' to obtain a reference for file timestamps is unreliable, + * e.g., with NFS, because the filesystem may have a different time + * reference. We check for pre-existence of links by latching the first + * timestamp from a file that we create. + * + * The _nc_warning() calls will report a correct line number only if + * _nc_curr_line is properly set before the write_entry() call. + */ + +void _nc_write_entry(TERMTYPE *const tp) +{ +struct stat statbuf; +FILE *fp; +char name_list[MAX_TERMINFO_LENGTH]; +char *first_name, *other_names; +char *ptr; +char filename[PATH_MAX]; +char linkname[PATH_MAX]; +#if USE_SYMLINKS +char symlinkname[PATH_MAX]; +#endif /* USE_SYMLINKS */ +static int call_count; +static time_t start_time; /* time at start of writes */ + + if (call_count++ == 0) { + start_time = 0; + } + + (void) strcpy(name_list, tp->term_names); + DEBUG(7, ("Name list = '%s'", name_list)); + + first_name = name_list; + + ptr = &name_list[strlen(name_list) - 1]; + other_names = ptr + 1; + + while (ptr > name_list && *ptr != '|') + ptr--; + + if (ptr != name_list) { + *ptr = '\0'; + + for (ptr = name_list; *ptr != '\0' && *ptr != '|'; ptr++) + continue; + + if (*ptr == '\0') + other_names = ptr; + else { + *ptr = '\0'; + other_names = ptr + 1; + } + } + + DEBUG(7, ("First name = '%s'", first_name)); + DEBUG(7, ("Other names = '%s'", other_names)); + + _nc_set_type(first_name); + + if (strlen(first_name) > sizeof(filename)-3) + _nc_warning("terminal name too long."); + + sprintf(filename, "%c/%s", first_name[0], first_name); + + /* + * Has this primary name been written since the first call to + * write_entry()? If so, the newer write will step on the older, + * so warn the user. + */ + if (start_time > 0 && + stat(filename, &statbuf) >= 0 + && statbuf.st_mtime >= start_time) + { + _nc_warning("name multiply defined."); + } + + check_writeable(first_name[0]); + fp = fopen(filename, "w"); + if (fp == NULL) { + perror(filename); + _nc_syserr_abort("can't open %s/%s", _nc_tic_dir(0), filename); + } + DEBUG(1, ("Created %s", filename)); + + if (write_object(fp, tp) == ERR) { + _nc_syserr_abort("error writing %s/%s", _nc_tic_dir(0), filename); + } + fclose(fp); + + if (start_time == 0) { + if (stat(filename, &statbuf) < 0 + || (start_time = statbuf.st_mtime) == 0) { + _nc_syserr_abort("error obtaining time from %s/%s", + _nc_tic_dir(0), filename); + } + } + while (*other_names != '\0') { + ptr = other_names++; + while (*other_names != '|' && *other_names != '\0') + other_names++; + + if (*other_names != '\0') + *(other_names++) = '\0'; + + if (strlen(ptr) > sizeof(linkname)-3) { + _nc_warning("terminal alias %s too long.", ptr); + continue; + } + + check_writeable(ptr[0]); + sprintf(linkname, "%c/%s", ptr[0], ptr); + + if (strcmp(filename, linkname) == 0) { + _nc_warning("self-synonym ignored"); + } + else if (stat(linkname, &statbuf) >= 0 && + statbuf.st_mtime < start_time) + { + _nc_warning("alias %s multiply defined.", ptr); + } + else + { +#if USE_SYMLINKS + strcpy(symlinkname, "../"); + strcat(symlinkname, filename); +#endif /* USE_SYMLINKS */ + unlink(linkname); +#if USE_SYMLINKS + if (symlink(symlinkname, linkname) < 0) +#else + if (link(filename, linkname) < 0) +#endif /* USE_SYMLINKS */ + _nc_syserr_abort("can't link %s to %s", filename, linkname); + DEBUG(1, ("Linked %s", linkname)); + } + } +} + +#undef LITTLE_ENDIAN /* BSD/OS defines this as a feature macro */ +#define HI(x) ((x) / 256) +#define LO(x) ((x) % 256) +#define LITTLE_ENDIAN(p, x) (p)[0] = LO(x), (p)[1] = HI(x) + +static int write_object(FILE *fp, TERMTYPE *tp) +{ +char *namelist; +size_t namelen, boolmax, nummax, strmax; +char zero = '\0'; +size_t i; +short nextfree; +short offsets[STRCOUNT]; +unsigned char buf[MAX_ENTRY_SIZE]; + + namelist = tp->term_names; + namelen = strlen(namelist) + 1; + + boolmax = 0; + for (i = 0; i < BOOLWRITE; i++) + if (tp->Booleans[i]) + boolmax = i+1; + + nummax = 0; + for (i = 0; i < NUMWRITE; i++) + if (tp->Numbers[i] != ABSENT_NUMERIC) + nummax = i+1; + + strmax = 0; + for (i = 0; i < STRWRITE; i++) + if (tp->Strings[i] != ABSENT_STRING) + strmax = i+1; + + nextfree = 0; + for (i = 0; i < strmax; i++) + if (tp->Strings[i] == ABSENT_STRING) + offsets[i] = -1; + else if (tp->Strings[i] == CANCELLED_STRING) + offsets[i] = -2; + else + { + offsets[i] = nextfree; + nextfree += strlen(tp->Strings[i]) + 1; + } + + /* fill in the header */ + LITTLE_ENDIAN(buf, MAGIC); + LITTLE_ENDIAN(buf+2, min(namelen, MAX_NAME_SIZE + 1)); + LITTLE_ENDIAN(buf+4, boolmax); + LITTLE_ENDIAN(buf+6, nummax); + LITTLE_ENDIAN(buf+8, strmax); + LITTLE_ENDIAN(buf+10, nextfree); + + /* write out the header */ + if (fwrite(buf, 12, 1, fp) != 1 + || fwrite(namelist, sizeof(char), (size_t)namelen, fp) != namelen + || fwrite(tp->Booleans, sizeof(char), (size_t)boolmax, fp) != boolmax) + return(ERR); + + /* the even-boundary padding byte */ + if ((namelen+boolmax) % 2 != 0 && fwrite(&zero, sizeof(char), 1, fp) != 1) + return(ERR); + +#ifdef SHOWOFFSET + (void) fprintf(stderr, "Numerics begin at %04lx\n", ftell(fp)); +#endif /* SHOWOFFSET */ + + /* the numerics */ + for (i = 0; i < nummax; i++) + { + if (tp->Numbers[i] == -1) /* HI/LO won't work */ + buf[2*i] = buf[2*i + 1] = 0377; + else + LITTLE_ENDIAN(buf + 2*i, tp->Numbers[i]); + } + if (fwrite(buf, 2, (size_t)nummax, fp) != nummax) + return(ERR); + +#ifdef SHOWOFFSET + (void) fprintf(stderr, "String offets begin at %04lx\n", ftell(fp)); +#endif /* SHOWOFFSET */ + + /* the string offsets */ + for (i = 0; i < strmax; i++) + if (offsets[i] == -1) /* HI/LO won't work */ + buf[2*i] = buf[2*i + 1] = 0377; + else if (offsets[i] == -2) /* HI/LO won't work */ + { + buf[2*i] = 0376; + buf[2*i + 1] = 0377; + } + else + LITTLE_ENDIAN(buf + 2*i, offsets[i]); + if (fwrite(buf, 2, (size_t)strmax, fp) != strmax) + return(ERR); + +#ifdef SHOWOFFSET + (void) fprintf(stderr, "String table begins at %04lx\n", ftell(fp)); +#endif /* SHOWOFFSET */ + + /* the strings */ + for (i = 0; i < strmax; i++) + if (tp->Strings[i] != ABSENT_STRING && tp->Strings[i] != CANCELLED_STRING) + if (fwrite(tp->Strings[i], sizeof(char), strlen(tp->Strings[i]) + 1, fp) != strlen(tp->Strings[i]) + 1) + return(ERR); + + total_written++; + return(OK); +} + +/* + * Returns the total number of entries written by this process + */ +int _nc_tic_written(void) +{ + return total_written; +} diff --git a/panel/Makefile.in b/panel/Makefile.in new file mode 100644 index 00000000..e1877932 --- /dev/null +++ b/panel/Makefile.in @@ -0,0 +1,121 @@ +# $Id: Makefile.in,v 1.15 1997/02/15 17:10:04 tom Exp $ +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Makefile for panels 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@ +datadir = @datadir@ + +ticdir = $(datadir)/terminfo + +INSTALL = @INSTALL@ +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 -DTERMINFO=\"$(ticdir)\" + +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@ + +MK_SHARED_LIB = @MK_SHARED_LIB@ +REL_VERSION = @nc_cv_rel_version@ +ABI_VERSION = @nc_cv_abi_version@ + +RANLIB = @RANLIB@ + +LIBRARIES = @LIBS_TO_MAKE@ + +LINT = @LINT@ +LINT_OPTS = @LINT_OPTS@ +LINT_LIBS = -lpanel -lncurses @LIBS@ + +################################################################################ +all :: ../include/panel.h $(LIBRARIES) + +$(INSTALL_PREFIX)$(libdir) : + $(srcdir)/../mkinstalldirs $@ + +# make a copy to simplify include-paths while still keeping panel's include +# file in this directory. +../include/panel.h : $(srcdir)/panel.h + -rm -f $@ + cp $(srcdir)/panel.h $@ + +PANEL_PRIV_H = \ + $(srcdir)/panel.priv.h \ + $(srcdir)/panel.h + +tags: + ctags *.[ch] + +TAGS: + etags *.[ch] + +clean :: + -rm -f tags TAGS *~ ../include/panel.h + +distclean :: clean + -rm -f Makefile + +mostlyclean :: clean + +realclean :: distclean + +############################################################################### +# The remainder of this file is automatically generated during configuration +############################################################################### diff --git a/panel/headers b/panel/headers new file mode 100644 index 00000000..f70e2085 --- /dev/null +++ b/panel/headers @@ -0,0 +1,20 @@ +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +$(srcdir)/panel.h diff --git a/panel/llib-lpanel b/panel/llib-lpanel new file mode 100644 index 00000000..2f0e99fa --- /dev/null +++ b/panel/llib-lpanel @@ -0,0 +1,102 @@ +/****************************************************************************** + * Copyright 1996 by Thomas E. Dickey * + * All Rights Reserved. * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * + * that the above copyright notice appear in all copies and that both that * + * copyright notice and this permission notice appear in supporting * + * documentation, and that the name of the above listed copyright holder(s) * + * not be used in advertising or publicity pertaining to distribution of the * + * software without specific, written prior permission. THE ABOVE LISTED * + * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * + * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + ******************************************************************************/ +/* LINTLIBRARY */ + +/* ./panel.c */ + +#include "panel.priv.h" + +#undef panel_window +WINDOW *panel_window( + const PANEL *pan) + { return(*(WINDOW **)0); } + +#undef update_panels +void update_panels(void) + { /* void */ } + +#undef hide_panel +int hide_panel( + PANEL *pan) + { return(*(int *)0); } + +#undef show_panel +int show_panel( + PANEL *pan) + { return(*(int *)0); } + +#undef top_panel +int top_panel( + PANEL *pan) + { return(*(int *)0); } + +#undef del_panel +int del_panel( + PANEL *pan) + { return(*(int *)0); } + +#undef bottom_panel +int bottom_panel( + PANEL *pan) + { return(*(int *)0); } + +#undef new_panel +PANEL *new_panel( + WINDOW *win) + { return(*(PANEL **)0); } + +#undef panel_above +PANEL *panel_above( + const PANEL *pan) + { return(*(PANEL **)0); } + +#undef panel_below +PANEL *panel_below( + const PANEL *pan) + { return(*(PANEL **)0); } + +#undef set_panel_userptr +int set_panel_userptr( + PANEL *pan, + const void *uptr) + { return(*(int *)0); } + +#undef panel_userptr +const void *panel_userptr( + const PANEL *pan) + { return(*(const void **)0); } + +#undef move_panel +int move_panel( + PANEL *pan, + int starty, + int startx) + { return(*(int *)0); } + +#undef replace_panel +int replace_panel( + PANEL *pan, + WINDOW *win) + { return(*(int *)0); } + +#undef panel_hidden +int panel_hidden( + const PANEL *pan) + { return(*(int *)0); } diff --git a/panel/modules b/panel/modules new file mode 100644 index 00000000..9e979f74 --- /dev/null +++ b/panel/modules @@ -0,0 +1,21 @@ +################################################################################ +# Copyright 1995 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Library objects +panel lib $(srcdir) $(PANEL_PRIV_H) diff --git a/panel/panel.c b/panel/panel.c new file mode 100644 index 00000000..fdc6e564 --- /dev/null +++ b/panel/panel.c @@ -0,0 +1,664 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* panel.c -- implementation of panels library */ +#include "panel.priv.h" + +MODULE_ID("$Id: panel.c,v 1.10 1997/05/05 09:42:11 tom Exp $") + +#ifdef TRACE +extern char *_nc_visbuf(const char *); +#ifdef TRACE_TXT +#define USER_PTR(ptr) _nc_visbuf((const char *)ptr) +#else +static char *my_nc_visbuf(const void *ptr) +{ + char temp[20]; + if (ptr != 0) + sprintf(temp, "ptr:%p", ptr); + else + strcpy(temp, ""); + return _nc_visbuf(temp); +} +#define USER_PTR(ptr) my_nc_visbuf((const char *)ptr) +#endif +#endif + +static PANEL *__bottom_panel = (PANEL *)0; +static PANEL *__top_panel = (PANEL *)0; + +static PANEL __stdscr_pseudo_panel = { (WINDOW *)0, + 0,0,0,0, + (PANEL *)0, (PANEL *)0, + (void *)0, + (PANELCONS *)0 }; + +/* Prototypes */ +static void __panel_link_bottom(PANEL *pan); + +/*+------------------------------------------------------------------------- + dPanel(text,pan) +--------------------------------------------------------------------------*/ +#ifdef TRACE +static void +dPanel(const char *text, const PANEL *pan) +{ + _tracef("%s id=%s b=%s a=%s y=%d x=%d", + text, USER_PTR(pan->user), + (pan->below) ? USER_PTR(pan->below->user) : "--", + (pan->above) ? USER_PTR(pan->above->user) : "--", + pan->wstarty, pan->wstartx); +} /* end of dPanel */ +#else +# define dPanel(text,pan) +#endif + +/*+------------------------------------------------------------------------- + dStack(fmt,num,pan) +--------------------------------------------------------------------------*/ +#ifdef TRACE +static void +dStack(const char *fmt, int num, const PANEL *pan) +{ + char s80[80]; + + sprintf(s80,fmt,num,pan); + _tracef("%s b=%s t=%s",s80, + (__bottom_panel) ? USER_PTR(__bottom_panel->user) : "--", + (__top_panel) ? USER_PTR(__top_panel->user) : "--"); + if(pan) + _tracef("pan id=%s", USER_PTR(pan->user)); + pan = __bottom_panel; + while(pan) + { + dPanel("stk",pan); + pan = pan->above; + } +} /* end of dStack */ +#else +# define dStack(fmt,num,pan) +#endif + +/*+------------------------------------------------------------------------- + Wnoutrefresh(pan) - debugging hook for wnoutrefresh +--------------------------------------------------------------------------*/ +#ifdef TRACE +static void +Wnoutrefresh(const PANEL *pan) +{ + dPanel("wnoutrefresh",pan); + wnoutrefresh(pan->win); +} /* end of Wnoutrefresh */ +#else +# define Wnoutrefresh(pan) wnoutrefresh((pan)->win) +#endif + +/*+------------------------------------------------------------------------- + Touchpan(pan) +--------------------------------------------------------------------------*/ +#ifdef TRACE +static void +Touchpan(const PANEL *pan) +{ + dPanel("Touchpan",pan); + touchwin(pan->win); +} /* end of Touchpan */ +#else +# define Touchpan(pan) touchwin((pan)->win) +#endif + +/*+------------------------------------------------------------------------- + Touchline(pan,start,count) +--------------------------------------------------------------------------*/ +#ifdef TRACE +static void +Touchline(const PANEL *pan, int start, int count) +{ + char s80[80]; + sprintf(s80,"Touchline s=%d c=%d",start,count); + dPanel(s80,pan); + touchline(pan->win,start,count); +} /* end of Touchline */ +#else +# define Touchline(pan,start,count) touchline((pan)->win,start,count) +#endif + +/*+------------------------------------------------------------------------- + __panels_overlapped(pan1,pan2) - check panel overlapped +--------------------------------------------------------------------------*/ +static INLINE bool +__panels_overlapped(register const PANEL *pan1, register const PANEL *pan2) +{ + if(!pan1 || !pan2) + return(FALSE); + dBug(("__panels_overlapped %s %s", USER_PTR(pan1->user), USER_PTR(pan2->user))); + /* pan1 intersects with pan2 ? */ + if((pan1->wstarty >= pan2->wstarty) && (pan1->wstarty < pan2->wendy) && + (pan1->wstartx >= pan2->wstartx) && (pan1->wstartx < pan2->wendx)) + return(TRUE); + /* or vice versa test */ + if((pan2->wstarty >= pan1->wstarty) && (pan2->wstarty < pan1->wendy) && + (pan2->wstartx >= pan1->wstartx) && (pan2->wstartx < pan1->wendx)) + return(TRUE); + dBug((" no")); + return(FALSE); +} /* end of __panels_overlapped */ + +/*+------------------------------------------------------------------------- + __free_obscure(pan) +--------------------------------------------------------------------------*/ +static INLINE void +__free_obscure(PANEL *pan) +{ + PANELCONS *tobs = pan->obscure; /* "this" one */ + PANELCONS *nobs; /* "next" one */ + + while(tobs) + { + nobs = tobs->above; + free((char *)tobs); + tobs = nobs; + } + pan->obscure = (PANELCONS *)0; +} /* end of __free_obscure */ + +/*+------------------------------------------------------------------------- + Get root (i.e. stdscr's) panel. + Establish the pseudo panel for stdscr if necessary. +--------------------------------------------------------------------------*/ +static PANEL* +__root_panel(void) +{ + if(!__stdscr_pseudo_panel.win) + { /* initialize those fields not already statically initialized */ + assert(stdscr && !__bottom_panel && !__top_panel); + __stdscr_pseudo_panel.win = stdscr; + __stdscr_pseudo_panel.wendy = LINES; + __stdscr_pseudo_panel.wendx = COLS; +#ifdef TRACE + __stdscr_pseudo_panel.user = "stdscr"; +#endif + __panel_link_bottom(&__stdscr_pseudo_panel); + } + return &__stdscr_pseudo_panel; +} + +/*+------------------------------------------------------------------------- + __override(pan,show) +--------------------------------------------------------------------------*/ +static void +__override(const PANEL *pan, int show) +{ + int y; + PANEL *pan2; + PANELCONS *tobs = pan->obscure; /* "this" one */ + + dBug(("__override %s,%d", USER_PTR(pan->user),show)); + + switch (show) + { + case P_TOUCH: + Touchpan(pan); + /* The following while loop will now mark all panel window lines + * obscured by use or obscuring us as touched, so they will be + * updated. + */ + break; + case P_UPDATE: + while(tobs && (tobs->pan != pan)) + tobs = tobs->above; + /* The next loop will now only go through the panels obscuring pan; + * it updates all the lines in the obscuring panels in sync. with + * the lines touched in pan itself. This is called in update_panels() + * in a loop from the bottom_panel to the top_panel, resulting in + * the desired update effect. + */ + break; + default: + return; + } + + while(tobs) + { + if((pan2 = tobs->pan) != pan) { + dBug(("test obs pan=%s pan2=%s", USER_PTR(pan->user), USER_PTR(pan2->user))); + for(y = pan->wstarty; y < pan->wendy; y++) { + if( (y >= pan2->wstarty) && (y < pan2->wendy) && + ((is_linetouched(pan->win,y - pan->wstarty) == TRUE)) ) + Touchline(pan2,y - pan2->wstarty,1); + } + } + tobs = tobs->above; + } +} /* end of __override */ + +/*+------------------------------------------------------------------------- + __calculate_obscure() +--------------------------------------------------------------------------*/ +static void +__calculate_obscure(void) +{ + PANEL *pan; + PANEL *pan2; + PANELCONS *tobs; /* "this" one */ + PANELCONS *lobs = (PANELCONS *)0; /* last one */ + + pan = __bottom_panel; + while(pan) + { + if(pan->obscure) + __free_obscure(pan); + dBug(("--> __calculate_obscure %s", USER_PTR(pan->user))); + lobs = (PANELCONS *)0; /* last one */ + pan2 = __bottom_panel; + /* This loop builds a list of panels obsured by pan or obscuring + pan; pan itself is in the list; all panels before pan are + obscured by pan, all panels after pan are obscuring pan. */ + while(pan2) + { + if(__panels_overlapped(pan,pan2)) + { + if(!(tobs = (PANELCONS *)malloc(sizeof(PANELCONS)))) + return; + tobs->pan = pan2; + dPanel("obscured",pan2); + tobs->above = (PANELCONS *)0; + if(lobs) + lobs->above = tobs; + else + pan->obscure = tobs; + lobs = tobs; + } + pan2 = pan2->above; + } + __override(pan,P_TOUCH); + pan = pan->above; + } +} /* end of __calculate_obscure */ + +/*+------------------------------------------------------------------------- + __panel_is_linked(pan) - check to see if panel is in the stack +--------------------------------------------------------------------------*/ +static INLINE bool +__panel_is_linked(const PANEL *pan) +{ + /* This works! The only case where it would fail is, when the list has + only one element. But this could only be the pseudo panel at the bottom */ + return ( ((pan->above!=(PANEL *)0) || + (pan->below!=(PANEL *)0) || + (pan==__bottom_panel)) ? TRUE : FALSE ); +} /* end of __panel_is_linked */ + +/*+------------------------------------------------------------------------- + __panel_link_top(pan) - link panel into stack at top +--------------------------------------------------------------------------*/ +static void +__panel_link_top(PANEL *pan) +{ +#ifdef TRACE + dStack("",1,pan); + if(__panel_is_linked(pan)) + return; +#endif + + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + if(__top_panel) + { + __top_panel->above = pan; + pan->below = __top_panel; + } + __top_panel = pan; + if(!__bottom_panel) + __bottom_panel = pan; + __calculate_obscure(); + dStack("",9,pan); + +} /* end of __panel_link_top */ + +/*+------------------------------------------------------------------------- + __panel_link_bottom(pan) - link panel into stack at bottom +--------------------------------------------------------------------------*/ +static void +__panel_link_bottom(PANEL *pan) +{ +#ifdef TRACE + dStack("",1,pan); + if(__panel_is_linked(pan)) + return; +#endif + + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + if(__bottom_panel) + { /* the stdscr pseudo panel always stays real bottom; + so we insert after bottom panel*/ + pan->below = __bottom_panel; + pan->above = __bottom_panel->above; + if (pan->above) + pan->above->below = pan; + __bottom_panel->above = pan; + } + else + __bottom_panel = pan; + if(!__top_panel) + __top_panel = pan; + assert(__bottom_panel == &__stdscr_pseudo_panel); + __calculate_obscure(); + dStack("",9,pan); +} /* end of __panel_link_bottom */ + +/*+------------------------------------------------------------------------- + __panel_unlink(pan) - unlink panel from stack +--------------------------------------------------------------------------*/ +static void +__panel_unlink(PANEL *pan) +{ + PANEL *prev; + PANEL *next; + +#ifdef TRACE + dStack("",1,pan); + if(!__panel_is_linked(pan)) + return; +#endif + + __override(pan,P_TOUCH); + __free_obscure(pan); + + prev = pan->below; + next = pan->above; + + if(prev) + { /* if non-zero, we will not update the list head */ + prev->above = next; + if(next) + next->below = prev; + } + else if(next) + next->below = prev; + if(pan == __bottom_panel) + __bottom_panel = next; + if(pan == __top_panel) + __top_panel = prev; + + __calculate_obscure(); + + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + dStack("",9,pan); +} /* end of __panel_unlink */ + +/*+------------------------------------------------------------------------- + panel_window(pan) - get window associated with panel +--------------------------------------------------------------------------*/ +WINDOW * +panel_window(const PANEL *pan) +{ + return(pan ? pan->win : (WINDOW *)0); +} /* end of panel_window */ + +/*+------------------------------------------------------------------------- + update_panels() - wnoutrefresh windows in an orderly fashion +--------------------------------------------------------------------------*/ +void +update_panels(void) +{ + PANEL *pan; + + dBug(("--> update_panels")); + pan = __bottom_panel; + while(pan) + { + __override(pan,P_UPDATE); + pan = pan->above; + } + + pan = __bottom_panel; + while (pan) + { + if(is_wintouched(pan->win)) + Wnoutrefresh(pan); + pan = pan->above; + } +} /* end of update_panels */ + +/*+------------------------------------------------------------------------- + hide_panel(pan) - remove a panel from stack +--------------------------------------------------------------------------*/ +int +hide_panel(register PANEL *pan) +{ + if(!pan) + return(ERR); + + dBug(("--> hide_panel %s", USER_PTR(pan->user))); + + if(!__panel_is_linked(pan)) + { + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + return(ERR); + } + + __panel_unlink(pan); + return(OK); +} /* end of hide_panel */ + +/*+------------------------------------------------------------------------- + show_panel(pan) - place a panel on top of stack +may already be in stack +--------------------------------------------------------------------------*/ +int +show_panel(register PANEL *pan) +{ + if(!pan) + return(ERR); + if(pan == __top_panel) + return(OK); + dBug(("--> show_panel %s", USER_PTR(pan->user))); + if(__panel_is_linked(pan)) + (void)hide_panel(pan); + __panel_link_top(pan); + return(OK); +} /* end of show_panel */ + +/*+------------------------------------------------------------------------- + top_panel(pan) - place a panel on top of stack +--------------------------------------------------------------------------*/ +int +top_panel(register PANEL *pan) +{ + return(show_panel(pan)); +} /* end of top_panel */ + +/*+------------------------------------------------------------------------- + del_panel(pan) - remove a panel from stack, if in it, and free struct +--------------------------------------------------------------------------*/ +int +del_panel(register PANEL *pan) +{ + if(pan) + { + dBug(("--> del_panel %s", USER_PTR(pan->user))); + if(__panel_is_linked(pan)) + (void)hide_panel(pan); + free((void *)pan); + return(OK); + } + return(ERR); +} /* end of del_panel */ + +/*+------------------------------------------------------------------------- + bottom_panel(pan) - place a panel on bottom of stack +may already be in stack +--------------------------------------------------------------------------*/ +int +bottom_panel(register PANEL *pan) +{ + if(!pan) + return(ERR); + if(pan == __bottom_panel) + return(OK); + dBug(("--> bottom_panel %s", USER_PTR(pan->user))); + if(__panel_is_linked(pan)) + (void)hide_panel(pan); + __panel_link_bottom(pan); + return(OK); +} /* end of bottom_panel */ + +/*+------------------------------------------------------------------------- + new_panel(win) - create a panel and place on top of stack +--------------------------------------------------------------------------*/ +PANEL * +new_panel(WINDOW *win) +{ + PANEL *pan = (PANEL *)malloc(sizeof(PANEL)); + + (void)__root_panel(); + + if(pan) + { + pan->win = win; + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + getbegyx(win, pan->wstarty, pan->wstartx); + pan->wendy = pan->wstarty + getmaxy(win); + pan->wendx = pan->wstartx + getmaxx(win); +#ifdef TRACE + pan->user = "new"; +#else + pan->user = (char *)0; +#endif + pan->obscure = (PANELCONS *)0; + (void)show_panel(pan); + } + return(pan); +} /* end of new_panel */ + +/*+------------------------------------------------------------------------- + panel_above(pan) +--------------------------------------------------------------------------*/ +PANEL * +panel_above(const PANEL *pan) +{ + if(!pan) + { + /* if top and bottom are equal, we have no or only the pseudo panel; + if not, we return the panel above the pseudo panel */ + return(__bottom_panel==__top_panel ? (PANEL*)0 : __bottom_panel->above); + } + else + return(pan->above); +} /* end of panel_above */ + +/*+------------------------------------------------------------------------- + panel_below(pan) +--------------------------------------------------------------------------*/ +PANEL * +panel_below(const PANEL *pan) +{ + if(!pan) + { + /* if top and bottom are equal, we have no or only the pseudo panel */ + return(__top_panel==__bottom_panel ? (PANEL*)0 : __top_panel); + } + else + { + /* we must not return the pseudo panel */ + return(pan->below==__bottom_panel ? (PANEL*) 0 : pan->below); + } +} /* end of panel_below */ + +/*+------------------------------------------------------------------------- + set_panel_userptr(pan,uptr) +--------------------------------------------------------------------------*/ +int +set_panel_userptr(PANEL *pan, const void *uptr) +{ + if(!pan) + return(ERR); + pan->user = uptr; + return(OK); +} /* end of set_panel_userptr */ + +/*+------------------------------------------------------------------------- + panel_userptr(pan) +--------------------------------------------------------------------------*/ +const void* +panel_userptr(const PANEL *pan) +{ + return(pan ? pan->user : (void *)0); +} /* end of panel_userptr */ + +/*+------------------------------------------------------------------------- + move_panel(pan,starty,startx) +--------------------------------------------------------------------------*/ +int +move_panel(PANEL *pan, int starty, int startx) +{ + WINDOW *win; + + if(!pan) + return(ERR); + if(__panel_is_linked(pan)) + __override(pan,P_TOUCH); + win = pan->win; + if(mvwin(win,starty,startx)) + return(ERR); + getbegyx(win, pan->wstarty, pan->wstartx); + pan->wendy = pan->wstarty + getmaxy(win); + pan->wendx = pan->wstartx + getmaxx(win); + if(__panel_is_linked(pan)) + __calculate_obscure(); + return(OK); +} /* end of move_panel */ + +/*+------------------------------------------------------------------------- + replace_panel(pan,win) +--------------------------------------------------------------------------*/ +int +replace_panel(PANEL *pan, WINDOW *win) +{ + if(!pan) + return(ERR); + if(__panel_is_linked(pan)) + __override(pan,P_TOUCH); + pan->win = win; + if(__panel_is_linked(pan)) + __calculate_obscure(); + return(OK); +} /* end of replace_panel */ + +/*+------------------------------------------------------------------------- + panel_hidden(pan) +--------------------------------------------------------------------------*/ +int +panel_hidden(const PANEL *pan) +{ + if(!pan) + return(ERR); + return(__panel_is_linked(pan) ? TRUE : FALSE); +} /* end of panel_hidden */ + +/* end of panel.c */ diff --git a/panel/panel.h b/panel/panel.h new file mode 100644 index 00000000..2f917827 --- /dev/null +++ b/panel/panel.h @@ -0,0 +1,71 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* panel.h -- interface file for panels library */ + +#ifndef _PANEL_H +#define _PANEL_H + +#include + +typedef struct panel +{ + WINDOW *win; + int wstarty; + int wendy; + int wstartx; + int wendx; + struct panel *below; + struct panel *above; + const void *user; + struct panelcons *obscure; +} +PANEL; + +#if defined(__cplusplus) +extern "C" { +#endif + +extern WINDOW *panel_window(const PANEL *); +extern void update_panels(void); +extern int hide_panel(PANEL *); +extern int show_panel(PANEL *); +extern int del_panel(PANEL *); +extern int top_panel(PANEL *); +extern int bottom_panel(PANEL *); +extern PANEL *new_panel(WINDOW *); +extern PANEL *panel_above(const PANEL *); +extern PANEL *panel_below(const PANEL *); +extern int set_panel_userptr(PANEL *,const void *); +extern const void* panel_userptr(const PANEL *); +extern int move_panel(PANEL *, int, int); +extern int replace_panel(PANEL *,WINDOW *); +extern int panel_hidden(const PANEL *); + +#if defined(__cplusplus) +} +#endif + +#endif /* _PANEL_H */ + +/* end of panel.h */ diff --git a/panel/panel.priv.h b/panel/panel.priv.h new file mode 100644 index 00000000..0e6fa591 --- /dev/null +++ b/panel/panel.priv.h @@ -0,0 +1,52 @@ +/* $Id: panel.priv.h,v 1.4 1997/04/05 23:38:02 tom Exp $ */ + +#ifndef _PANEL_PRIV_H +#define _PANEL_PRIV_H + +#if HAVE_CONFIG_H +# include +#endif + +#include +#include + +#if HAVE_LIBDMALLOC +#include /* Gray Watson's library */ +#endif + +#if HAVE_LIBDBMALLOC +#include /* Conor Cahill's library */ +#endif + +#include "panel.h" + + +#if ( CC_HAS_INLINE_FUNCS && !defined(TRACE) ) +# define INLINE inline +#else +# define INLINE +#endif + + +typedef struct panelcons +{ + struct panelcons *above; + struct panel *pan; +} PANELCONS; + +#ifdef TRACE +# define dBug(x) _tracef x +#else +# define dBug(x) +#endif + +#ifdef USE_RCS_IDS +#define MODULE_ID(id) static const char Ident[] = id; +#else +#define MODULE_ID(id) /*nothing*/ +#endif + +#define P_TOUCH (0) +#define P_UPDATE (1) + +#endif diff --git a/progs/MKtermsort.sh b/progs/MKtermsort.sh new file mode 100755 index 00000000..6cbe9548 --- /dev/null +++ b/progs/MKtermsort.sh @@ -0,0 +1,121 @@ +#!/bin/sh +# +# MKtermsort.sh -- generate indirection vectors for the various sort methods +# +# The output of this script is C source for nine arrays that list three sort +# orders for each of the three different classes of terminfo capabilities. +# +AWK=${1-awk} +DATA=${2-../include/Caps} + +echo "/*"; +echo " * termsort.c --- sort order arrays for use by infocmp."; +echo " *"; +echo " * Note: this file is generated using termsort.sh, do not edit by hand."; +echo " */"; + +echo "static const int bool_terminfo_sort[] = {"; +$AWK <$DATA ' +BEGIN {i = 0;} +/^#/ {next;} +$3 == "bool" {printf("%s\t%d\n", $2, i++);} +' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}'; +echo "};"; +echo ""; + +echo "static const int num_terminfo_sort[] = {"; +$AWK <$DATA ' +BEGIN {i = 0;} +/^#/ {next;} +$3 == "num" {printf("%s\t%d\n", $2, i++);} +' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}'; +echo "};"; +echo ""; + +echo "static const int str_terminfo_sort[] = {"; +$AWK <$DATA ' +BEGIN {i = 0;} +/^#/ {next;} +$3 == "str" {printf("%s\t%d\n", $2, i++);} +' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}'; +echo "};"; +echo ""; + +echo "static const int bool_variable_sort[] = {"; +$AWK <$DATA ' +BEGIN {i = 0;} +/^#/ {next;} +$3 == "bool" {printf("%s\t%d\n", $1, i++);} +' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}'; +echo "};"; +echo ""; + +echo "static const int num_variable_sort[] = {"; +$AWK <$DATA ' +BEGIN {i = 0;} +/^#/ {next;} +$3 == "num" {printf("%s\t%d\n", $1, i++);} +' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}'; +echo "};"; +echo ""; + +echo "static const int str_variable_sort[] = {"; +$AWK <$DATA ' +BEGIN {i = 0;} +/^#/ {next;} +$3 == "str" {printf("%s\t%d\n", $1, i++);} +' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}'; +echo "};"; +echo ""; + +echo "static const int bool_termcap_sort[] = {"; +$AWK <$DATA ' +BEGIN {i = 0;} +/^#/ {next;} +$3 == "bool" {printf("%s\t%d\n", $4, i++);} +' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}'; +echo "};"; +echo ""; + +echo "static const int num_termcap_sort[] = {"; +$AWK <$DATA ' +BEGIN {i = 0;} +/^#/ {next;} +$3 == "num" {printf("%s\t%d\n", $4, i++);} +' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}'; +echo "};"; +echo ""; + +echo "static const int str_termcap_sort[] = {"; +$AWK <$DATA ' +BEGIN {i = 0;} +/^#/ {next;} +$3 == "str" {printf("%s\t%d\n", $4, i++);} +' | sort | $AWK '{print "\t", $2, ",\t/* ", $1, " */";}'; +echo "};"; +echo ""; + +echo "static const int bool_from_termcap[] = {"; +$AWK <$DATA ' +$3 == "bool" && substr($5, 1, 1) == "-" {print "0,\t/* ", $2, " */";} +$3 == "bool" && substr($5, 1, 1) == "Y" {print "1,\t/* ", $2, " */";} +' +echo "};"; +echo ""; + +echo "static const int num_from_termcap[] = {"; +$AWK <$DATA ' +$3 == "num" && substr($5, 1, 1) == "-" {print "0,\t/* ", $2, " */";} +$3 == "num" && substr($5, 1, 1) == "Y" {print "1,\t/* ", $2, " */";} +' +echo "};"; +echo ""; + +echo "static const int str_from_termcap[] = {"; +$AWK <$DATA ' +$3 == "str" && substr($5, 1, 1) == "-" {print "0,\t/* ", $2, " */";} +$3 == "str" && substr($5, 1, 1) == "Y" {print "1,\t/* ", $2, " */";} +' +echo "};"; +echo ""; + diff --git a/progs/Makefile.in b/progs/Makefile.in new file mode 100644 index 00000000..a8bce990 --- /dev/null +++ b/progs/Makefile.in @@ -0,0 +1,246 @@ +# $Id: Makefile.in,v 1.21 1997/02/15 20:03:34 tom Exp $ +################################################################################ +# Copyright 1996,1997 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Makefile for ncurses source code. +# +# This makes the ncurses utility programs. +# +# 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, +# and the programs with the configured default model. + +# turn off _all_ suffix rules; we'll generate our own +.SUFFIXES: + +SHELL = /bin/sh +THIS = Makefile + +NC_MFLAGS = @nc_cv_makeflags@ +@SET_MAKE@ + +MODEL = ../@DFT_OBJ_SUBDIR@ +INSTALL_PREFIX = @INSTALL_PREFIX@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +includedir = @includedir@ +datadir = @datadir@ + +ticdir = $(datadir)/terminfo + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ + +AWK = @AWK@ +LN_S = @LN_S@ + +CC = @CC@ +CFLAGS = @CFLAGS@ + +INCDIR = $(srcdir)/../include +CPPFLAGS = -I../progs -I$(srcdir) @CPPFLAGS@ \ + -DHAVE_CONFIG_H -DTERMINFO=\"$(ticdir)\" + +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@) + +LD = @LD@ +LINK = $(CC) +LDFLAGS = -L../lib -lncurses@DFT_ARG_SUFFIX@ @LDFLAGS@ @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ + +LDFLAGS_NORMAL = $(LDFLAGS) +LDFLAGS_DEBUG = $(LDFLAGS) @CC_G_OPT@ +LDFLAGS_PROFILE = $(LDFLAGS) -pg +LDFLAGS_SHARED = $(LDFLAGS) @CC_SHARED_OPTS@ + +LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) + +LINT = @LINT@ +LINT_OPTS = @LINT_OPTS@ +LINT_LIBS = -lncurses @LIBS@ + +AUTO_SRC = \ + termsort.c + +PROGS = tic toe infocmp clear tput tset + +TESTPROGS = mvcur tctest hardscroll hashmap + +# Default library, for linking applications +DEPS_CURSES = ../lib/libncurses@DFT_DEP_SUFFIX@ + +################################################################################ +all: $(AUTO_SRC) $(PROGS) + +install: install.progs + +# this line simplifies the configure-script +install.libs: + +install.progs: $(PROGS) $(INSTALL_PREFIX)$(bindir) + $(INSTALL_PROGRAM) tic $(INSTALL_PREFIX)$(bindir)/tic + $(INSTALL_PROGRAM) toe $(INSTALL_PREFIX)$(bindir)/toe + $(INSTALL_PROGRAM) infocmp $(INSTALL_PREFIX)$(bindir)/infocmp + $(INSTALL_PROGRAM) clear $(INSTALL_PREFIX)$(bindir)/clear + $(INSTALL_PROGRAM) tput $(INSTALL_PREFIX)$(bindir)/tput + $(INSTALL_PROGRAM) tset $(INSTALL_PREFIX)$(bindir)/tset + @echo "linking captoinfo to tic" + -@rm -f $(INSTALL_PREFIX)$(bindir)/captoinfo + (cd $(INSTALL_PREFIX)$(bindir) && $(LN_S) tic captoinfo) + @echo "linking reset to tset" + -@rm -f $(INSTALL_PREFIX)$(bindir)/reset + (cd $(INSTALL_PREFIX)$(bindir) && $(LN_S) tset reset) + +$(INSTALL_PREFIX)$(bindir) : + $(srcdir)/../mkinstalldirs $@ + +# +# Utilities normally built by make all start here +# + +DEPS_TIC = \ + $(MODEL)/tic.o \ + $(MODEL)/dump_entry.o + +tic: $(DEPS_TIC) $(DEPS_CURSES) + @ECHO_LINK@ $(LINK) $(DEPS_TIC) $(LDFLAGS_DEFAULT) -o $@ + +DEPS_TOE = \ + $(MODEL)/toe.o \ + $(MODEL)/dump_entry.o + +toe: $(DEPS_TOE) $(DEPS_CURSES) + @ECHO_LINK@ $(LINK) $(DEPS_TOE) $(LDFLAGS_DEFAULT) -o $@ + +DEPS_CLEAR = \ + $(MODEL)/clear.o + +clear: $(DEPS_CLEAR) $(DEPS_CURSES) + @ECHO_LINK@ $(LINK) $(DEPS_CLEAR) $(LDFLAGS_DEFAULT) -o $@ + +DEPS_TPUT = \ + $(MODEL)/tput.o + +tput: $(DEPS_TPUT) $(DEPS_CURSES) + @ECHO_LINK@ $(LINK) $(DEPS_TPUT) $(LDFLAGS_DEFAULT) -o $@ + +DEPS_INFOCMP = \ + $(MODEL)/infocmp.o \ + $(MODEL)/dump_entry.o + +infocmp: $(DEPS_INFOCMP) $(DEPS_CURSES) + @ECHO_LINK@ $(LINK) $(DEPS_INFOCMP) $(LDFLAGS_DEFAULT) -o $@ + +DEPS_TSET = \ + $(MODEL)/tset.o \ + $(MODEL)/dump_entry.o + +tset: $(DEPS_TSET) $(DEPS_CURSES) + @ECHO_LINK@ $(LINK) $(DEPS_TSET) $(LDFLAGS_DEFAULT) -o $@ + +termsort.c: $(srcdir)/MKtermsort.sh + sh -c "$(srcdir)/MKtermsort.sh $(AWK) $(srcdir)/../include/Caps" >$@ + +# +# Test programs (not normally built by make all) start here. +# + +# Cursor movement optimization tester. Use -g for debugging but -O if you're +# profiling with intent to determine COMPUTE_OVERHEAD +MVFLAGS = -O +DEPS_MVCUR = \ + $(srcdir)/../ncurses/lib_mvcur.c \ + $(MODEL)/dump_entry.o + +mvcur: $(DEPS_MVCUR) $(DEPS_CURSES) + @ECHO_LINK@ $(LINK) $(CCFLAGS) -DTRACE -DMAIN $(MVFLAGS) $(DEPS_MVCUR) $(LDFLAGS_DEFAULT) -o $@ + +# Termcap-conversion tester +DEPS_TCTEST = \ + $(srcdir)/../ncurses/captoinfo.c + +tctest: $(DEPS_TCTEST) $(DEPS_CURSES) + @ECHO_LINK@ $(LINK) $(CCFLAGS) -DTRACE -DMAIN $(DEPS_TCTEST) $(LDFLAGS_DEFAULT) -o $@ + +# Demonstrator/tester for hardware-scrolling algorithm. +DEPS_HARDSCROLL = \ + $(srcdir)/../ncurses/hardscroll.c \ + $(MODEL)/lib_trace.o +hardscroll: + @ECHO_LINK@ $(LINK) $(CCFLAGS) -I$(srcdir)/../ncurses -DTRACE -DSCROLLDEBUG $(DEPS_HARDSCROLL) $(LDFLAGS_DEFAULT) -o $@ + +# Demonstrator-tester for enhanced hardware-scrolling code with hash mapping +DEPS_HASHMAP = \ + $(srcdir)/../ncurses/hashmap.c \ + $(srcdir)/../ncurses/hardscroll.c \ + $(MODEL)/lib_trace.o +hashmap: $(DEPS_HASHMAP) + @ECHO_LINK@ $(LINK) $(CCFLAGS) -I$(srcdir)/../ncurses -DTRACE -DHASHDEBUG $(DEPS_HASHMAP) -o $@ + +# +# Utility productions start here +# + +tags: + ctags *.[ch] + +TAGS: + etags *.[ch] + +clean :: + -rm -f tags TAGS do.tic *~ + -rm -f $(AUTO_SRC) $(TESTPROGS) + -rm -f $(PROGS) + +distclean :: clean + -rm -f Makefile + +mostlyclean :: clean + +realclean :: distclean + +# These rules are used to allow "make -n" to work on a clean directory-tree +../include/hashsize.h \ +../include/parametrized.h \ +../include/term.h : + cd ../include; $(MAKE) $(NC_MFLAGS) +$(DEPS_CURSES) : + cd ../ncurses; $(MAKE) $(NC_MFLAGS) + +lint: + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/clear.c $(LINT_LIBS) + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/infocmp.c $(srcdir)/dump_entry.c $(LINT_LIBS) + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tic.c $(srcdir)/dump_entry.c $(LINT_LIBS) + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/toe.c $(srcdir)/dump_entry.c $(LINT_LIBS) + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tput.c $(LINT_LIBS) + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tset.c $(srcdir)/dump_entry.c $(LINT_LIBS) + +############################################################################### +# The remainder of this file is automatically generated during configuration +############################################################################### diff --git a/progs/capconvert b/progs/capconvert new file mode 100755 index 00000000..0a3ea5d5 --- /dev/null +++ b/progs/capconvert @@ -0,0 +1,190 @@ +#! /bin/sh +# +# capconvert -- automated conversion from termcap to terminfo +# + +echo "This script tries to automatically set you up so that your applications" +echo "that now use termcap can use terminfo and the ncurses library." +echo "" + +# Note, except for telling if we're running under xterm we don't use TERM at +# all. This is because BSD users not infrequently have multiple termtypes +# selected by conditionals in tset -- unless they're xterm users, in which +# case they're on a workstation and probably don't. + +# Check to make sure TERMINFO is not already defined +if [ "$TERMINFO" ] +then + echo "TERMINFO is already defined in your environment. This means" + echo "you already have a local terminfo tree, so you do not need any" + echo "conversion." + exit; +fi + +# Check to see if terminfo is present. +if [ -d /usr/lib/terminfo -o -d /usr/local/lib/terminfo ] +then + echo "Your system already has a system-wide terminfo tree." + terminfo=yes + echo "" + if [ "$TERMCAP" = "" ] + then + echo "You have no TERMCAP variable set, so we're done." + # Assumes the terminfo master covers all canned terminal types + exit; + fi + if [ "$TERM" = "xterm" ] + then + echo "You're running xterm, which rudely sets TERMCAP itself." + echo "We can ignore this, because terminfo knows about xterm." + echo "So you'll just use the system-wide terminfo tree." + exit; + else + echo "We'll have to make a local one for you anyway, in order" + echo "to capture the effect of your TERMCAP variable." + fi +else + echo "No system-wide terminfo tree. We'll make you a local one." + terminfo=no +fi +echo ""; + + +# First step -- go find tic +set -- `echo $PATH | tr ':' '\n' | sort | uniq` +for x in $* +do + if [ -x $x/tic ] + then + tic=$x/tic + fi; +done +if [ "$tic" ] +then + echo "I see tic at $tic." +else + echo "You don't have tic installed anywhere I can see, please fix that." + exit; +fi +echo ""; + +# We have tic. Either there's no system terminfo tree or there is one but +# the user has a TERMCAP variable that may modify a stock description. +# + +# Make the user a terminfo directory +if [ -d $HOME/.terminfo ] +then + echo "It appears you already have a private terminfo directory" + echo "at $HOME/.terminfo; this seems odd, because TERMINFO" + echo "is not defined. I'm not going to second-guess this -- if you" + echo "really want me to try auto-configuring for you, remove or" + echo "rename $HOME/terminfo and run me again." + exit; +else + echo "I'm creating your private terminfo directory at $HOME/.terminfo" + mkdir $HOME/.terminfo + # Ensure that that's where tic's compilation results. + # This isn't strictly necessary with a 1.9.7 or later tic. + TERMINFO="$HOME/.terminfo"; export TERMINFO +fi +echo ""; + +# Find a terminfo source to work from +if [ -f ../misc/terminfo.src ] +then + echo "I see the terminfo master source is handy; I'll use that." + master=../misc/terminfo.src +else + # Ooops...looks like we're running from somewhere other than the + # progs directory of an ncurses source tree. + master=`find $HOME -name "*terminfo.src" -print` + mcount=`echo $master | wc -l` + case $mcount in + 0) + echo "I can't find a terminfo source file anywhere under your home directory." + echo "There should be a file called terminfo.src somewhere in your" + echo "ncurses distribution; please put it in your home directotry" + echo "and run me again (it doesn't have to live there permanently)." + exit; + ;; + 1) + echo "I see a file called $master." + echo "I'm going to assume this is the terminfo source included with" + echo "the ncurses distribution. If this assumption is wrong, please" + echo "interrupt me now! OK to continue?" + read ans; + ;; + 2) + echo "I see more than one possible terminfo source. Here they are:" + echo $master | sed "/^/s// /"; + while : + do + echo "Please tell me which one to use:" + read master; + if [ -f $master ] + then + break + else + echo "That file doesn't exist. Try again?"; + fi + done + ;; + esac +fi +echo ""; + +# Now that we have a master, compile it into the local tree +echo "OK, now I'll make your private terminfo tree. This may take a bit..." +# +# Kluge alert: we compile terminfo.src in two pieces because a lot of machines +# with < 16MB RAM choke on tic's core-hog habits. +sed -n $master \ + -e '1,/SPLIT HERE/w tsplit$$.01' \ + -e '/SPLIT HERE/,$w tsplit$$.02' \ + 2>/dev/null +for x in tsplit$$.*; do $tic -v $x; done +rm tsplit$$.* +# +echo "You now have a private tree under $HOME/.terminfo;" +echo "the ncurses library will automatically read from it," +echo "and ncurses tic will automatically compile entries to it." + +# We're done unless user has a .termcap file or equivalent named by TERMCAP +if [ "$TERMCAP" = "" ] +then + echo "You have no TERMCAP set, so we're done." +fi + +# OK, here comes the nasty case...user has a TERMCAP. Instead of +# trying to follow all the convolutions of the relationship between +# TERM and TERMCAP (partly because it's too painful, and partly because +# we don't actually know what TERM will be nor even if it always has +# the same value for this user) we do the following three steps... + +if [ -f $HOME/.termcap ] +then + echo 'I see you have a $HOME/.termcap file. I'll compile that.' + $tic $HOME/.termcap + echo "Done." + echo "Note that editing $HOME/.termcap will no longer change the data curses sees." +else if `expr $TERMCAP : "/"` = '1' +then + echo "Your TERMCAP names the file $TERMCAP. I'll compile that." + $tic $TERMCAP + echo "Done." + echo "Note that editing $TERMCAP will no longer change the data curses sees." +else + echo "Your TERMCAP value appears to be an entry in termcap format." + echo "I'll compile it." + echo $TERMCAP >myterm$$ + $tic myterm$$ + rm myterm$$ + echo "Done." + echo "Note that editing TERMCAP will no longer change the data curses sees." +fi fi +echo "To do that, decompile the terminal decription you want with infocmp(1)," +echo "edit to taste, and recompile using tic(1)." + +# capconvert ends here + diff --git a/progs/clear.c b/progs/clear.c new file mode 100644 index 00000000..417c2446 --- /dev/null +++ b/progs/clear.c @@ -0,0 +1,47 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * clear.c -- clears the terminal's screen + */ + +#include + +#include + +MODULE_ID("$Id: clear.c,v 1.6 1996/12/21 17:35:11 tom Exp $") + +static int putch(int c) +{ + return putchar(c); +} + +int main( + int argc GCC_UNUSED, + char *argv[] GCC_UNUSED) +{ + setupterm((char *) 0, STDOUT_FILENO, (int *) 0); + if (clear_screen == (char *) 0) + return EXIT_FAILURE; + tputs(clear_screen, lines > 0 ? lines : 1, putch); + return EXIT_SUCCESS; +} diff --git a/progs/clear.sh b/progs/clear.sh new file mode 100755 index 00000000..1b6b0bb8 --- /dev/null +++ b/progs/clear.sh @@ -0,0 +1 @@ +exec tput clear diff --git a/progs/dump_entry.c b/progs/dump_entry.c new file mode 100644 index 00000000..8610f797 --- /dev/null +++ b/progs/dump_entry.c @@ -0,0 +1,848 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +#define __INTERNAL_CAPS_VISIBLE +#include + +#include +#include "dump_entry.h" +#include "termsort.c" /* this C file is generated */ +#include "parametrized.h" /* so is this */ + +MODULE_ID("$Id: dump_entry.c,v 1.17 1997/05/10 17:35:30 tom Exp $") + +#define INDENT 8 + +static int tversion; /* terminfo version */ +static int outform; /* output format to use */ +static int sortmode; /* sort mode to use */ +static int width = 60; /* max line width for listings */ +static int column; /* current column, limited by 'width' */ +static int oldcol; /* last value of column before wrap */ +static int tracelevel; /* level of debug output */ + +static char *outbuf; /* the output-buffer */ +static size_t out_used; /* ...its current length */ +static size_t out_size; /* ...and its allocated length */ + +/* indirection pointers for implementing sort and display modes */ +static const int *bool_indirect, *num_indirect, *str_indirect; +static char * const *bool_names, * const *num_names, * const *str_names; + +static const char *separator, *trailer; + +/* cover various ports and variants of terminfo */ +#define V_ALLCAPS 0 /* all capabilities (SVr4, XSI, ncurses) */ +#define V_SVR1 1 /* SVR1, Ultrix */ +#define V_HPUX 2 /* HP/UX */ +#define V_AIX 3 /* AIX */ +#define V_BSD 4 /* BSD */ + +#define OBSOLETE(n) (n[0] == 'O' && n[1] == 'T') + +#if NO_LEAKS +void _nc_leaks_dump_entry(void) +{ + if (outbuf != 0) { + free(outbuf); + outbuf = 0; + } +} +#endif + +char *nametrans(const char *name) +/* translate a capability name from termcap to terminfo */ +{ + const struct name_table_entry *np; + + if ((np = _nc_find_entry(name, _nc_info_hash_table)) != NULL) + switch(np->nte_type) + { + case BOOLEAN: + if (bool_from_termcap[np->nte_index]) + return(boolcodes[np->nte_index]); + break; + + case NUMBER: + if (num_from_termcap[np->nte_index]) + return(numcodes[np->nte_index]); + break; + + case STRING: + if (str_from_termcap[np->nte_index]) + return(strcodes[np->nte_index]); + break; + } + + return((char *)NULL); +} + +void dump_init(const char *version, int mode, int sort, int twidth, int traceval) +/* set up for entry display */ +{ + width = twidth; + tracelevel = traceval; + + /* versions */ + if (version == (char *)NULL) + tversion = V_ALLCAPS; + else if (!strcmp(version, "SVr1") || !strcmp(version, "SVR1") + || !strcmp(version, "Ultrix")) + tversion = V_SVR1; + else if (!strcmp(version, "HP")) + tversion = V_HPUX; + else if (!strcmp(version, "AIX")) + tversion = V_AIX; + else if (!strcmp(version, "BSD")) + tversion = V_BSD; + else + tversion = V_ALLCAPS; + + /* implement display modes */ + switch (outform = mode) + { + case F_LITERAL: + case F_TERMINFO: + bool_names = boolnames; + num_names = numnames; + str_names = strnames; + separator = twidth ? ", " : ","; + trailer = "\n\t"; + break; + + case F_VARIABLE: + bool_names = boolfnames; + num_names = numfnames; + str_names = strfnames; + separator = twidth ? ", " : ","; + trailer = "\n\t"; + break; + + case F_TERMCAP: + case F_TCONVERR: + bool_names = boolcodes; + num_names = numcodes; + str_names = strcodes; + separator = ":"; + trailer = "\\\n\t:"; + break; + } + + /* implement sort modes */ + switch(sortmode = sort) + { + case S_NOSORT: + if (traceval) + (void) fprintf(stderr, + "%s: sorting by term structure order\n", _nc_progname); + break; + + case S_TERMINFO: + if (traceval) + (void) fprintf(stderr, + "%s: sorting by terminfo name order\n", _nc_progname); + bool_indirect = bool_terminfo_sort; + num_indirect = num_terminfo_sort; + str_indirect = str_terminfo_sort; + break; + + case S_VARIABLE: + if (traceval) + (void) fprintf(stderr, + "%s: sorting by C variable order\n", _nc_progname); + bool_indirect = bool_variable_sort; + num_indirect = num_variable_sort; + str_indirect = str_variable_sort; + break; + + case S_TERMCAP: + if (traceval) + (void) fprintf(stderr, + "%s: sorting by termcap name order\n", _nc_progname); + bool_indirect = bool_termcap_sort; + num_indirect = num_termcap_sort; + str_indirect = str_termcap_sort; + break; + } + + if (traceval) + (void) fprintf(stderr, + "%s: width = %d, tversion = %d, outform = %d\n", + _nc_progname, width, tversion, outform); +} + +static int trailing_spaces(const char *src) +{ + while (*src == ' ') + src++; + return *src == 0; +} + +/* this deals with differences over whether 0x7f and 0x80..0x9f are controls */ +#define CHAR_OF(s) (*(unsigned const char *)(s)) +#define REALCTL(s) (CHAR_OF(s) < 127 && iscntrl(CHAR_OF(s))) +#define REALPRINT(s) (CHAR_OF(s) < 127 && isprint(CHAR_OF(s))) + +char *expand(char *srcp) +{ +static char buffer[1024]; +int bufp; +const char *ptr, *str = (srcp == ABSENT_STRING + || srcp == CANCELLED_STRING) ? "" : srcp; +bool islong = (strlen(str) > 3); + + bufp = 0; + ptr = str; + while (*str) { + if (*str == '%' && REALPRINT(str+1)) { + buffer[bufp++] = *str++; + buffer[bufp++] = *str; + } + else if (*str == '\033') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'E'; + } + else if (*str == '\\' && (outform==F_TERMINFO) && (str == srcp || str[-1] != '^')) { + buffer[bufp++] = '\\'; + buffer[bufp++] = '\\'; + } + else if (*str == ' ' && (outform==F_TERMINFO) && (str == srcp || trailing_spaces(str))) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 's'; + } + else if ((*str == ',' || *str == ':' || *str == '^') && (outform==F_TERMINFO)) { + buffer[bufp++] = '\\'; + buffer[bufp++] = *str; + } + else if (REALPRINT(str) && (*str != ',' && *str != ':' && !(*str == '!' && outform!=F_TERMINFO) && *str != '^')) + buffer[bufp++] = *str; +#if 0 /* FIXME: this would be more readable */ + else if (*str == '\b') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'b'; + } + else if (*str == '\f') { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'f'; + } + else if (*str == '\t' && islong) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 't'; + } +#endif + else if (*str == '\r' && (islong || (strlen(srcp) > 2 && str[1] == '\0'))) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'r'; + } + else if (*str == '\n' && islong) { + buffer[bufp++] = '\\'; + buffer[bufp++] = 'n'; + } +#define UnCtl(c) ((0xff & (c)) + '@') + else if (REALCTL(str) && *str != '\\' && (!islong || isdigit(str[1]))) + { + (void) sprintf(&buffer[bufp], "^%c", UnCtl(*str)); + bufp += 2; + } + else + { + (void) sprintf(&buffer[bufp], "\\%03o", 0xff & *str); + bufp += 4; + } + + str++; + } + + buffer[bufp] = '\0'; + return(buffer); +} + +static TERMTYPE *cur_type; + +static int dump_predicate(int type, int idx) +/* predicate function to use for ordinary decompilation */ +{ + switch(type) { + case BOOLEAN: + return (cur_type->Booleans[idx] == FALSE) + ? FAIL : cur_type->Booleans[idx]; + + case NUMBER: + return (cur_type->Numbers[idx] == ABSENT_NUMERIC) + ? FAIL : cur_type->Numbers[idx]; + + case STRING: + return (cur_type->Strings[idx] != ABSENT_STRING) + ? (int)TRUE : FAIL; + } + + return(FALSE); /* pacify compiler */ +} + +static void set_obsolete_termcaps(TERMTYPE *tp); + +/* is this the index of a function key string? */ +#define FNKEY(i) (((i)<= 65 && (i)>= 75) || ((i)<= 216 && (i)>= 268)) + +static bool version_filter(int type, int idx) +/* filter out capabilities we may want to suppress */ +{ + switch (tversion) + { + case V_ALLCAPS: /* SVr4, XSI Curses */ + return(TRUE); + + case V_SVR1: /* System V Release 1, Ultrix */ + switch (type) + { + case BOOLEAN: + return (idx <= 20); /* below and including xon_xoff */ + case NUMBER: + return (idx <= 7); /* below and including width_status_line */ + case STRING: + return (idx <= 144); /* below and including prtr_non */ + } + break; + + case V_HPUX: /* Hewlett-Packard */ + switch (type) + { + case BOOLEAN: + return (idx <= 20); /* below and including xon_xoff */ + case NUMBER: + return (idx <= 10); /* below and including label_width */ + case STRING: + if (idx <= 144) /* below and including prtr_non */ + return(TRUE); + else if (FNKEY(idx)) /* function keys */ + return(TRUE); + else if (idx==147||idx==156||idx==157) /* plab_norm,label_on,label_off */ + return(TRUE); + else + return(FALSE); + } + break; + + case V_AIX: /* AIX */ + switch (type) + { + case BOOLEAN: + return (idx <= 20); /* below and including xon_xoff */ + case NUMBER: + return (idx <= 7); /* below and including width_status_line */ + case STRING: + if (idx <= 144) /* below and including prtr_non */ + return(TRUE); + else if (FNKEY(idx)) /* function keys */ + return(TRUE); + else + return(FALSE); + } + break; + + case V_BSD: /* BSD */ + switch (type) + { + case BOOLEAN: + return bool_from_termcap[idx]; + case NUMBER: + return num_from_termcap[idx]; + case STRING: + return str_from_termcap[idx]; + } + break; + } + + return(FALSE); /* pacify the compiler */ +} + +static +void append_output (const char *src) +{ + if (src == 0) { + out_used = 0; + append_output(""); + } else { + size_t need = strlen(src); + size_t want = need + out_used + 1; + if (want > out_size) { + out_size += want; /* be generous */ + if (outbuf == 0) + outbuf = malloc(out_size); + else + outbuf = realloc(outbuf, out_size); + } + (void)strcpy(outbuf + out_used, src); + out_used += need; + } +} + +static +void force_wrap(void) +{ + oldcol = column; + append_output(trailer); + column = INDENT; +} + +static +void wrap_concat(const char *src) +{ + int need = strlen(src); + int want = strlen(separator) + need; + + if (column > INDENT + && column + want > width) { + force_wrap(); + } + append_output(src); + append_output(separator); + column += need; +} + +#define IGNORE_SEP_TRAIL(first,last,sep_trail) \ + if ((size_t)(last - first) > sizeof(sep_trail)-1 \ + && !strncmp(first, sep_trail, sizeof(sep_trail)-1)) \ + first += sizeof(sep_trail)-2 + +/* Returns the nominal length of the buffer assuming it is termcap format, + * i.e., the continuation sequence is treated as a single character ":". + * + * There are several implementations of termcap which read the text into a + * fixed-size buffer. Generally they strip the newlines from the text, but may + * not do it until after the buffer is read. Also, "tc=" resolution may be + * expanded in the same buffer. This function is useful for measuring the size + * of the best fixed-buffer implementation; the worst case may be much worse. + */ +#ifdef TEST_TERMCAP_LENGTH +static int termcap_length(const char *src) +{ + static const char pattern[] = ":\\\n\t:"; + + int len = 0; + const char *const t = src + strlen(src); + + while (*src != '\0') { + IGNORE_SEP_TRAIL(src, t, pattern); + src++; + len++; + } + return len; +} +#else +#define termcap_length(src) strlen(src) +#endif + +int fmt_entry(TERMTYPE *tterm, + int (*pred)(int type, int idx), + bool suppress_untranslatable, + bool infodump) +{ +int i, j; +char buffer[MAX_TERMINFO_LENGTH]; +int predval, len; +int num_bools = 0; +int num_values = 0; +int num_strings = 0; +bool outcount = 0; + +#define WRAP_CONCAT \ + wrap_concat(buffer); \ + outcount = TRUE + + len = 12; /* terminfo file-header */ + + if (pred == NULL) { + cur_type = tterm; + pred = dump_predicate; + } + + append_output(NULL); + append_output(tterm->term_names); + append_output(separator); + column = out_used; + force_wrap(); + + for (j=0; j < BOOLCOUNT; j++) { + if (sortmode == S_NOSORT) + i = j; + else + i = bool_indirect[j]; + + if (!version_filter(BOOLEAN, i)) + continue; + else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE) + && (OBSOLETE(bool_names[i]) && outform != F_LITERAL)) + continue; + + predval = pred(BOOLEAN, i); + if (predval != FAIL) { + (void) strcpy(buffer, bool_names[i]); + if (predval <= 0) + (void) strcat(buffer, "@"); + else if (i + 1 > num_bools) + num_bools = i + 1; + WRAP_CONCAT; + } + } + + if (column != INDENT) + force_wrap(); + + for (j=0; j < NUMCOUNT; j++) { + if (sortmode == S_NOSORT) + i = j; + else + i = num_indirect[j]; + + if (!version_filter(NUMBER, i)) + continue; + else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE) + && (OBSOLETE(num_names[i]) && outform != F_LITERAL)) + continue; + + predval = pred(NUMBER, i); + if (predval != FAIL) { + if (tterm->Numbers[i] < 0) { + sprintf(buffer, "%s@", num_names[i]); + } else { + sprintf(buffer, "%s#%d", num_names[i], tterm->Numbers[i]); + if (i + 1 > num_values) + num_values = i + 1; + } + WRAP_CONCAT; + } + } + + if (column != INDENT) + force_wrap(); + + len += num_bools + + num_values * 2 + + strlen(tterm->term_names) + 1; + if (len & 1) + len++; + + for (j=0; j < STRCOUNT; j++) { + if (sortmode == S_NOSORT) + i = j; + else + i = str_indirect[j]; + + if (!version_filter(STRING, i)) + continue; + else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE) + && (OBSOLETE(str_names[i]) && outform != F_LITERAL)) + continue; + + /* + * Some older versions of vi want rmir/smir to be defined + * for ich/ich1 to work. If they're not defined, force + * them to be output as defined and empty. + */ + if (outform==F_TERMCAP) +#undef CUR +#define CUR tterm-> + if (insert_character || parm_ich) + { + if (&tterm->Strings[i] == &enter_insert_mode + && enter_insert_mode == ABSENT_STRING) + { + (void) strcpy(buffer, "im="); + goto catenate; + } + + if (&tterm->Strings[i] == &exit_insert_mode + && exit_insert_mode == ABSENT_STRING) + { + (void) strcpy(buffer, "ei="); + goto catenate; + } + } + + predval = pred(STRING, i); + buffer[0] = '\0'; + if (predval != FAIL) { + if (tterm->Strings[i] != ABSENT_STRING + && i + 1 > num_strings) + num_strings = i + 1; + if (tterm->Strings[i] == ABSENT_STRING + || tterm->Strings[i] == CANCELLED_STRING) + sprintf(buffer, "%s@", str_names[i]); + else if (outform == F_TERMCAP || outform == F_TCONVERR) + { + char *srccap = expand(tterm->Strings[i]); + char *cv = _nc_infotocap(str_names[i], srccap,parametrized[i]); + + if (cv == (char *)NULL) + { + if (outform == F_TCONVERR) + sprintf(buffer, "%s=!!! %s WILL NOT CONVERT !!!", str_names[i], srccap); + else if (suppress_untranslatable) + continue; + else + sprintf(buffer, "..%s=%s", str_names[i], srccap); + } + else + sprintf(buffer, "%s=%s", str_names[i], cv); + len += strlen(tterm->Strings[i]) + 1; + } + else + { + sprintf(buffer,"%s=%s",str_names[i],expand(tterm->Strings[i])); + len += strlen(tterm->Strings[i]) + 1; + } + + catenate: + WRAP_CONCAT; + } + } + len += num_strings * 2; + + /* + * This piece of code should be an effective inverse of the functions + * postprocess_terminfo and postprocess_terminfo in parse_entry.c. + * Much more work should be done on this to support dumping termcaps. + */ + if (tversion == V_HPUX) + { + if (memory_lock) + { + (void) sprintf(buffer, "meml=%s", memory_lock); + WRAP_CONCAT; + } + if (memory_unlock) + { + (void) sprintf(buffer, "memu=%s", memory_unlock); + WRAP_CONCAT; + } + } + else if (tversion == V_AIX) + { + if (acs_chars) + { + bool box_ok = TRUE; + const char *acstrans = "lqkxjmwuvtn"; + const char *cp; + char *tp, *sp, boxchars[11]; + + tp = boxchars; + for (cp = acstrans; *cp; cp++) + { + sp = strchr(acs_chars, *cp); + if (sp) + *tp++ = sp[1]; + else + { + box_ok = FALSE; + break; + } + } + tp[0] = '\0'; + + if (box_ok) + { + (void) strcpy(buffer, "box1="); + (void) strcat(buffer, expand(boxchars)); + WRAP_CONCAT; + } + } + } + + /* + * kludge: trim off trailer to avoid an extra blank line + * in infocmp -u output when there are no string differences + */ + if (outcount) + { + j = out_used; + if (j >= 2 + && outbuf[j-1] == '\t' + && outbuf[j-2] == '\n') { + out_used -= 2; + } else if (j >= 4 + && outbuf[j-1] == ':' + && outbuf[j-2] == '\t' + && outbuf[j-3] == '\n' + && outbuf[j-4] == '\\') { + out_used -= 4; + } + outbuf[out_used] = '\0'; + column = oldcol; + } + +#if 0 + fprintf(stderr, "num_bools = %d\n", num_bools); + fprintf(stderr, "num_values = %d\n", num_values); + fprintf(stderr, "num_strings = %d\n", num_strings); + fprintf(stderr, "term_names=%s, len=%d, strlen(outbuf)=%d, outbuf=%s\n", + tterm->term_names, len, out_used, outbuf); +#endif + /* + * Here's where we use infodump to trigger a more stringent length check + * for termcap-translation purposes. + * Return the length of the raw entry, without tc= expansions, + * It gives an idea of which entries are deadly to even *scan past*, + * as opposed to *use*. + */ + return(infodump ? len : termcap_length(outbuf)); +} + +int dump_entry(TERMTYPE *tterm, bool limited, int (*pred)(int type, int idx)) +/* dump a single entry */ +{ + int len, critlen; + const char *legend; + bool infodump; + + if (outform==F_TERMCAP || outform==F_TCONVERR) + { + critlen = MAX_TERMCAP_LENGTH; + legend = "older termcap"; + infodump = FALSE; + set_obsolete_termcaps(tterm); + } + else + { + critlen = MAX_TERMINFO_LENGTH; + legend = "terminfo"; + infodump = TRUE; + } + + if (((len = fmt_entry(tterm, pred, FALSE, infodump)) > critlen) && limited) + { + (void) printf("# (untranslatable capabilities removed to fit entry within %d bytes)\n", + critlen); + if ((len = fmt_entry(tterm, pred, TRUE, infodump)) > critlen) + { + /* + * We pick on sgr because it's a nice long string capability that + * is really just an optimization hack. + */ + char *oldsgr = set_attributes; + set_attributes = ABSENT_STRING; + (void) printf("# (sgr removed to fit entry within %d bytes)\n", + critlen); + if ((len = fmt_entry(tterm, pred, TRUE, infodump)) > critlen) + { + int oldversion = tversion; + + tversion = V_BSD; + (void) printf("# (terminfo-only capabilities suppressed to fit entry within %d bytes)\n", + critlen); + + if ((len = fmt_entry(tterm, pred, TRUE, infodump)) > critlen) + { + (void) fprintf(stderr, + "warning: %s entry is %d bytes long\n", + _nc_first_name(tterm->term_names), + len); + (void) printf( + "# WARNING: this entry, %d bytes long, may core-dump %s libraries!\n", + len, legend); + } + tversion = oldversion; + } + set_attributes = oldsgr; + } + } + + (void) fputs(outbuf, stdout); + return len; +} + +int dump_uses(const char *name, bool infodump) +/* dump "use=" clauses in the appropriate format */ +{ + char buffer[MAX_TERMINFO_LENGTH]; + + append_output(NULL); + (void)sprintf(buffer, "%s%s", infodump ? "use=" : "tc=", name); + wrap_concat(buffer); + (void) fputs(outbuf, stdout); + return out_used; +} + +void compare_entry(void (*hook)(int t, int i, const char *name)) +/* compare two entries */ +{ + int i, j; + + (void) fputs(" comparing booleans.\n", stdout); + for (j=0; j < BOOLCOUNT; j++) + { + if (sortmode == S_NOSORT) + i = j; + else + i = bool_indirect[j]; + + if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE) + && (OBSOLETE(bool_names[i]) && outform != F_LITERAL)) + continue; + + (*hook)(BOOLEAN, i, bool_names[i]); + } + + (void) fputs(" comparing numbers.\n", stdout); + for (j=0; j < NUMCOUNT; j++) + { + if (sortmode == S_NOSORT) + i = j; + else + i = num_indirect[j]; + + if ((outform==F_LITERAL || outform==F_TERMINFO || outform==F_VARIABLE) + && (OBSOLETE(num_names[i]) && outform != F_LITERAL)) + continue; + + (*hook)(NUMBER, i, num_names[i]); + } + + (void) fputs(" comparing strings.\n", stdout); + for (j=0; j < STRCOUNT; j++) + { + if (sortmode == S_NOSORT) + i = j; + else + i = str_indirect[j]; + + if ((outform==F_LITERAL || outform==F_TERMINFO || outform==F_VARIABLE) + && (OBSOLETE(str_names[i]) && outform != F_LITERAL)) + continue; + + (*hook)(STRING, i, str_names[i]); + } +} + +#define NOTSET(s) ((s) == (char *)NULL) + +/* + * This bit of legerdemain turns all the terminfo variable names into + * references to locations in the arrays Booleans, Numbers, and Strings --- + * precisely what's needed. + */ +#undef CUR +#define CUR tp-> + +static void set_obsolete_termcaps(TERMTYPE *tp) +{ +#include "capdefaults.c" +} diff --git a/progs/dump_entry.h b/progs/dump_entry.h new file mode 100644 index 00000000..7ea6fcf2 --- /dev/null +++ b/progs/dump_entry.h @@ -0,0 +1,49 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * Dump control definitions and variables + */ + +/* capability output formats */ +#define F_TERMINFO 0 /* use terminfo names */ +#define F_VARIABLE 1 /* use C variable names */ +#define F_TERMCAP 2 /* termcap names with capability conversion */ +#define F_TCONVERR 3 /* as T_TERMCAP, no skip of untranslatables */ +#define F_LITERAL 4 /* like F_TERMINFO, but no smart defaults */ + +/* capability sort modes */ +#define S_DEFAULT 0 /* sort by terminfo name (implicit) */ +#define S_NOSORT 1 /* don't sort */ +#define S_TERMINFO 2 /* sort by terminfo names (explicit) */ +#define S_VARIABLE 3 /* sort by C variable names */ +#define S_TERMCAP 4 /* sort by termcap names */ + +extern char *nametrans(const char *); +extern void dump_init(const char *, int, int, int, int); +extern int fmt_entry(TERMTYPE *, int (*)(int, int), bool, bool); +extern int dump_entry(TERMTYPE *, bool, int (*)(int, int)); +extern int dump_uses(const char *, bool); +extern void compare_entry(void (*)(int, int, const char *)); +extern char *expand(char *); + +#define FAIL -1 diff --git a/progs/infocmp.c b/progs/infocmp.c new file mode 100644 index 00000000..71e0a7c0 --- /dev/null +++ b/progs/infocmp.c @@ -0,0 +1,1169 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * infocmp.c -- decompile an entry, or compare two entries + * written by Eric S. Raymond + */ + +#include + +#include + +#include +#include + +MODULE_ID("$Id: infocmp.c,v 1.27 1997/02/15 18:54:44 tom Exp $") + +#define L_CURL "{" +#define R_CURL "}" + +#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING) + +#define MAXTERMS 32 /* max # terminal arguments we can handle */ + +const char *_nc_progname = "infocmp"; + +typedef char path[PATH_MAX]; + +/*************************************************************************** + * + * The following control variables, together with the contents of the + * terminfo entries, completely determine the actions of the program. + * + ***************************************************************************/ + +static char *tname[MAXTERMS]; /* terminal type names */ +static TERMTYPE term[MAXTERMS]; /* terminfo entries */ +static int termcount; /* count of terminal entries */ + +static const char *tversion; /* terminfo version selected */ +static int outform; /* output format */ +static int sortmode; /* sort_mode */ +static int itrace; /* trace flag for debugging */ +static int mwidth = 60; + +/* main comparison mode */ +static int compare; +#define C_DEFAULT 0 /* don't force comparison mode */ +#define C_DIFFERENCE 1 /* list differences between two terminals */ +#define C_COMMON 2 /* list common capabilities */ +#define C_NAND 3 /* list capabilities in neither terminal */ +#define C_USEALL 4 /* generate relative use-form entry */ +static bool ignorepads; /* ignore pad prefixes when diffing */ + +#if NO_LEAKS +#undef ExitProgram +static void ExitProgram(int code) GCC_NORETURN; +static void ExitProgram(int code) +{ + while (termcount-- > 0) + _nc_free_termtype(&term[termcount], FALSE); + _nc_leaks_dump_entry(); + _nc_free_and_exit(code); +} +#endif + +static char *canonical_name(char *ptr, char *buf) +/* extract the terminal type's primary name */ +{ + char *bp; + + (void) strcpy(buf, ptr); + if ((bp = strchr(buf, '|')) != (char *)NULL) + *bp = '\0'; + + return(buf); +} + +/*************************************************************************** + * + * Predicates for dump function + * + ***************************************************************************/ + +static int capcmp(const char *s, const char *t) +/* capability comparison function */ +{ + if (!VALID_STRING(s) && !VALID_STRING(t)) + return(0); + else if (!VALID_STRING(s) || !VALID_STRING(t)) + return(1); + + if (ignorepads) + return(_nc_capcmp(s, t)); + else + return(strcmp(s, t)); +} + +static int use_predicate(int type, int idx) +/* predicate function to use for use decompilation */ +{ + TERMTYPE *tp; + + switch(type) + { + case BOOLEAN: { + int is_set = FALSE; + + /* + * This assumes that multiple use entries are supposed + * to contribute the logical or of their boolean capabilities. + * This is true if we take the semantics of multiple uses to + * be 'each capability gets the first non-default value found + * in the sequence of use entries'. + */ + for (tp = &term[1]; tp < term + termcount; tp++) + if (tp->Booleans[idx]) { + is_set = TRUE; + break; + } + if (is_set != term->Booleans[idx]) + return(!is_set); + else + return(FAIL); + } + + case NUMBER: { + int value = ABSENT_NUMERIC; + + /* + * We take the semantics of multiple uses to be 'each + * capability gets the first non-default value found + * in the sequence of use entries'. + */ + for (tp = &term[1]; tp < term + termcount; tp++) + if (tp->Numbers[idx] >= 0) { + value = tp->Numbers[idx]; + break; + } + + if (value != term->Numbers[idx]) + return(value != ABSENT_NUMERIC); + else + return(FAIL); + } + + case STRING: { + char *termstr, *usestr = ABSENT_STRING; + + termstr = term->Strings[idx]; + + /* + * We take the semantics of multiple uses to be 'each + * capability gets the first non-default value found + * in the sequence of use entries'. + */ + for (tp = &term[1]; tp < term + termcount; tp++) + if (tp->Strings[idx]) + { + usestr = tp->Strings[idx]; + break; + } + + if (usestr == ABSENT_STRING && termstr == ABSENT_STRING) + return(FAIL); + else if (!usestr || !termstr || capcmp(usestr,termstr)) + return(TRUE); + else + return(FAIL); + } + } + + return(FALSE); /* pacify compiler */ +} + +static bool entryeq(TERMTYPE *t1, TERMTYPE *t2) +/* are two terminal types equal */ +{ + int i; + + for (i = 0; i < BOOLCOUNT; i++) + if (t1->Booleans[i] != t2->Booleans[i]) + return(FALSE); + + for (i = 0; i < NUMCOUNT; i++) + if (t1->Numbers[i] != t2->Numbers[i]) + return(FALSE); + + for (i = 0; i < STRCOUNT; i++) + if (capcmp(t1->Strings[i], t2->Strings[i])) + return(FALSE); + + return(TRUE); +} + +static void compare_predicate(int type, int idx, const char *name) +/* predicate function to use for entry difference reports */ +{ + register TERMTYPE *t1 = &term[0]; + register TERMTYPE *t2 = &term[1]; + char *s1, *s2; + + switch(type) + { + case BOOLEAN: + switch(compare) + { + case C_DIFFERENCE: + if (t1->Booleans[idx] != t2->Booleans[idx]) + (void) printf("\t%s: %c:%c.\n", + name, + t1->Booleans[idx] ? 'T' : 'F', + t2->Booleans[idx] ? 'T' : 'F'); + break; + + case C_COMMON: + if (t1->Booleans[idx] && t2->Booleans[idx]) + (void) printf("\t%s= T.\n", name); + break; + + case C_NAND: + if (!t1->Booleans[idx] && !t2->Booleans[idx]) + (void) printf("\t!%s.\n", name); + break; + } + break; + + case NUMBER: + switch(compare) + { + case C_DIFFERENCE: + if (t1->Numbers[idx] != t2->Numbers[idx]) + (void) printf("\t%s: %d:%d.\n", + name, t1->Numbers[idx], t2->Numbers[idx]); + break; + + case C_COMMON: + if (t1->Numbers[idx]!=-1 && t2->Numbers[idx]!=-1 + && t1->Numbers[idx] == t2->Numbers[idx]) + (void) printf("\t%s= %d.\n", name, t1->Numbers[idx]); + break; + + case C_NAND: + if (t1->Numbers[idx]==-1 && t2->Numbers[idx] == -1) + (void) printf("\t!%s.\n", name); + break; + } + break; + + case STRING: + s1 = t1->Strings[idx]; + s2 = t2->Strings[idx]; + switch(compare) + { + case C_DIFFERENCE: + if (capcmp(s1, s2)) + { + char buf1[BUFSIZ], buf2[BUFSIZ]; + + if (s1 == (char *)NULL) + (void) strcpy(buf1, "NULL"); + else + { + (void) strcpy(buf1, "'"); + (void) strcat(buf1, expand(s1)); + (void) strcat(buf1, "'"); + } + + if (s2 == (char *)NULL) + (void) strcpy(buf2, "NULL"); + else + { + (void) strcpy(buf2, "'"); + (void) strcat(buf2, expand(s2)); + (void) strcat(buf2, "'"); + } + + (void) printf("\t%s: %s, %s.\n", + name, buf1, buf2); + } + break; + + case C_COMMON: + if (s1 && s2 && !capcmp(s1, s2)) + (void) printf("\t%s= '%s'.\n",name,expand(s1)); + break; + + case C_NAND: + if (!s1 && !s2) + (void) printf("\t!%s.\n", name); + break; + } + break; + } + +} + +/*************************************************************************** + * + * Init string analysis + * + ***************************************************************************/ + +typedef struct {const char *from; const char *to;} assoc; + +static const assoc std_caps[] = +{ + /* these are specified by X.364 and iBCS2 */ + {"\033c", "RIS"}, /* full reset */ + {"\0337", "SC"}, /* save cursor */ + {"\0338", "RC"}, /* restore cursor */ + {"\033[r", "RSR"}, /* not an X.364 mnemonic */ + {"\033[m", "SGR0"}, /* not an X.364 mnemonic */ + {"\033[2J", "ED2"}, /* clear page */ + + /* this group is specified by ISO 2022 */ + {"\033(0", "ISO DEC G0"}, /* enable DEC graphics for G0 */ + {"\033(A", "ISO UK G0"}, /* enable UK chars for G0 */ + {"\033(B", "ISO US G0"}, /* enable US chars for G0 */ + {"\033)0", "ISO DEC G1"}, /* enable DEC graphics for G1 */ + {"\033)A", "ISO UK G1"}, /* enable UK chars for G1 */ + {"\033)B", "ISO US G1"}, /* enable US chars for G1 */ + + /* these are DEC private modes widely supported by emulators */ + {"\033=", "DECPAM"}, /* application keypad mode */ + {"\033>", "DECPNM"}, /* normal keypad mode */ + {"\033<", "DECANSI"}, /* enter ANSI mode */ + + { (char *)0, (char *)0} +}; + +static const assoc private_modes[] = +/* DEC \E[ ... [hl] modes recognized by many emulators */ +{ + {"1", "CKM"}, /* application cursor keys */ + {"2", "ANM"}, /* set VT52 mode */ + {"3", "COLM"}, /* 132-column mode */ + {"4", "SCLM"}, /* smooth scroll */ + {"5", "SCNM"}, /* reverse video mode */ + {"6", "OM"}, /* origin mode */ + {"7", "AWM"}, /* wraparound mode */ + {"8", "ARM"}, /* auto-repeat mode */ + {(char *)0, (char *)0} +}; + +static const assoc ecma_highlights[] = +/* recognize ECMA attribute sequences */ +{ + {"0", "NORMAL"}, /* normal */ + {"1", "+BOLD"}, /* bold on */ + {"2", "+DIM"}, /* dim on */ + {"3", "+ITALIC"}, /* italic on */ + {"4", "+UNDERLINE"}, /* underline on */ + {"5", "+BLINK"}, /* blink on */ + {"6", "+FASTBLINK"}, /* fastblink on */ + {"7", "+REVERSE"}, /* reverse on */ + {"8", "+INVISIBLE"}, /* invisible on */ + {"9", "+DELETED"}, /* deleted on */ + {"10", "MAIN-FONT"}, /* select primary font */ + {"11", "ALT-FONT-1"}, /* select alternate font 1 */ + {"12", "ALT-FONT-2"}, /* select alternate font 2 */ + {"13", "ALT-FONT-3"}, /* select alternate font 3 */ + {"14", "ALT-FONT-4"}, /* select alternate font 4 */ + {"15", "ALT-FONT-5"}, /* select alternate font 5 */ + {"16", "ALT-FONT-6"}, /* select alternate font 6 */ + {"17", "ALT-FONT-7"}, /* select alternate font 7 */ + {"18", "ALT-FONT-1"}, /* select alternate font 1 */ + {"19", "ALT-FONT-1"}, /* select alternate font 1 */ + {"20", "FRAKTUR"}, /* Fraktur font */ + {"21", "DOUBLEUNDER"}, /* double underline */ + {"22", "-DIM"}, /* dim off */ + {"23", "-ITALIC"}, /* italic off */ + {"24", "-UNDERLINE"}, /* underline off */ + {"25", "-BLINK"}, /* blink off */ + {"26", "-FASTBLINK"}, /* fastblink off */ + {"27", "-REVERSE"}, /* reverse off */ + {"28", "-INVISIBLE"}, /* invisible off */ + {"29", "-DELETED"}, /* deleted off */ + {(char *)0, (char *)0} +}; + +static void analyze_string(const char *name, const char *cap, TERMTYPE *tp) +{ + char buf[MAX_TERMINFO_LENGTH]; + char buf2[MAX_TERMINFO_LENGTH]; + const char *sp, *ep; + const assoc *ap; + + if (cap == ABSENT_STRING || cap == CANCELLED_STRING) + return; + (void) printf("%s: ", name); + + buf[0] = '\0'; + for (sp = cap; *sp; sp++) + { + int i; + size_t len = 0; + const char *expansion = 0; + + /* first, check other capabilities in this entry */ + for (i = 0; i < STRCOUNT; i++) + { + char *cp = tp->Strings[i]; + + /* don't use soft-key capabilities */ + if (strnames[i][0] == 'k' && strnames[i][0] == 'f') + continue; + + + if (cp != ABSENT_STRING && cp != CANCELLED_STRING && cp[0] && cp != cap) + { + len = strlen(cp); + (void) strncpy(buf2, sp, len); + buf2[len] = '\0'; + + if (_nc_capcmp(cp, buf2)) + continue; + +#define ISRS(s) (!strncmp((s), "is", 2) || !strncmp((s), "rs", 2)) + /* + * Theoretically we just passed the test for translation + * (equality once the padding is stripped). However, there + * are a few more hoops that need to be jumped so that + * identical pairs of initialization and reset strings + * don't just refer to each other. + */ + if (ISRS(name) || ISRS(strnames[i])) + if (cap < cp) + continue; +#undef ISRS + + expansion = strnames[i]; + break; + } + } + + /* now check the standard capabilities */ + if (!expansion) + for (ap = std_caps; ap->from; ap++) + { + len = strlen(ap->from); + + if (strncmp(ap->from, sp, len) == 0) + { + expansion = ap->to; + break; + } + } + + /* now check for private-mode sequences */ + if (!expansion + && sp[0] == '\033' && sp[1] == '[' && sp[2] == '?' + && (len = strspn(sp + 3, "0123456789;")) + && ((sp[3 + len] == 'h') || (sp[3 + len] == 'l'))) + { + char buf3[MAX_TERMINFO_LENGTH]; + + (void) strcpy(buf2, (sp[3 + len] == 'h') ? "DEC+" : "DEC-"); + (void) strncpy(buf3, sp + 3, len); + len += 4; + buf3[len] = '\0'; + + ep = strtok(buf3, ";"); + do { + bool found = FALSE; + + for (ap = private_modes; ap->from; ap++) + { + size_t tlen = strlen(ap->from); + + if (strncmp(ap->from, ep, tlen) == 0) + { + (void) strcat(buf2, ap->to); + found = TRUE; + break; + } + } + + if (!found) + (void) strcat(buf2, ep); + (void) strcat(buf2, ";"); + } while + ((ep = strtok((char *)NULL, ";"))); + buf2[strlen(buf2) - 1] = '\0'; + expansion = buf2; + } + + /* now check for ECMA highlight sequences */ + if (!expansion + && sp[0] == '\033' && sp[1] == '[' + && (len = strspn(sp + 2, "0123456789;")) + && sp[2 + len] == 'm') + { + char buf3[MAX_TERMINFO_LENGTH]; + + (void) strcpy(buf2, "SGR:"); + (void) strncpy(buf3, sp + 2, len); + len += 3; + buf3[len] = '\0'; + + ep = strtok(buf3, ";"); + do { + bool found = FALSE; + + for (ap = ecma_highlights; ap->from; ap++) + { + size_t tlen = strlen(ap->from); + + if (strncmp(ap->from, ep, tlen) == 0) + { + (void) strcat(buf2, ap->to); + found = TRUE; + break; + } + } + + if (!found) + (void) strcat(buf2, ep); + (void) strcat(buf2, ";"); + } while + ((ep = strtok((char *)NULL, ";"))); + + buf2[strlen(buf2) - 1] = '\0'; + expansion = buf2; + } + /* now check for scroll region reset */ + if (!expansion) + { + (void) sprintf(buf2, "\033[1;%dr", tp->Numbers[2]); + len = strlen(buf2); + if (strncmp(buf2, sp, len) == 0) + expansion = "RSR"; + } + + /* now check for home-down */ + if (!expansion) + { + (void) sprintf(buf2, "\033[%d;1H", tp->Numbers[2]); + len = strlen(buf2); + if (strncmp(buf2, sp, len) == 0) + expansion = "LL"; + } + + /* now look at the expansion we got, if any */ + if (expansion) + { + (void) sprintf(buf + strlen(buf), "{%s}", expansion); + sp += len - 1; + continue; + } + else + { + /* couldn't match anything */ + buf2[0] = *sp; + buf2[1] = '\0'; + (void) strcat(buf, expand(buf2)); + } + } + (void) printf("%s\n", buf); +} + +/*************************************************************************** + * + * File comparison + * + ***************************************************************************/ + +static void file_comparison(int argc, char *argv[]) +{ +#define MAXCOMPARE 2 + /* someday we may allow comparisons on more files */ + int filecount = 0; + ENTRY *heads[MAXCOMPARE]; + ENTRY *tails[MAXCOMPARE]; + ENTRY *qp, *rp; + int i, n; + + dump_init((char *)NULL, F_LITERAL, S_TERMINFO, 0, itrace); + + for (n = 0; n < argc && n < MAXCOMPARE; n++) + { + if (freopen(argv[n], "r", stdin) == NULL) + _nc_err_abort("Can't open %s", argv[n]); + + _nc_head = _nc_tail = (ENTRY *)NULL; + + /* parse entries out of the source file */ + _nc_set_source(argv[n]); + _nc_read_entry_source(stdin, NULL, TRUE, FALSE, NULLHOOK); + + if (itrace) + (void) fprintf(stderr, "Resolving file %d...\n",n-0); + + /* do use resolution */ + if (!_nc_resolve_uses()) + { + (void) fprintf(stderr, + "There are unresolved use entries in %s:\n", + argv[n]); + for_entry_list(qp) + if (qp->nuses) + { + (void) fputs(qp->tterm.term_names, stderr); + (void) fputc('\n', stderr); + } + exit(EXIT_FAILURE); + } + + heads[filecount] = _nc_head; + tails[filecount] = _nc_tail; + filecount++; + } + + /* OK, all entries are in core. Ready to do the comparison */ + if (itrace) + (void) fprintf(stderr, "Entries are now in core...\n"); + + /* + * The entry-matching loop. We're not using the use[] + * slots any more (they got zeroed out by resolve_uses) so + * we stash each entry's matches in the other file there. + * Sigh, this is intrinsically quadratic. + */ + for (qp = heads[0]; qp; qp = qp->next) + { + for (rp = heads[1]; rp; rp = rp->next) + if (_nc_entry_match(qp->tterm.term_names,rp->tterm.term_names)) + { + /* + * This is why the uses structure parent element is + * (void *) -- so we can have either (char *) for + * names or entry structure pointers in them and still + * be type-safe. + */ + if (qp->nuses < MAX_USES) + qp->uses[qp->nuses].parent = (void *)rp; + qp->nuses++; + + if (rp->nuses < MAX_USES) + rp->uses[rp->nuses].parent = (void *)qp; + rp->nuses++; + } + } + + /* now we have two circular lists with crosslinks */ + if (itrace) + (void) fprintf(stderr, "Name matches are done...\n"); + + for (qp = heads[0]; qp; qp = qp->next) + if (qp->nuses > 1) + { + (void) fprintf(stderr, + "%s in file 1 (%s) has %d matches in file 2 (%s):\n", + _nc_first_name(qp->tterm.term_names), + argv[0], + qp->nuses, + argv[1]); + for (i = 0; i < qp->nuses; i++) + (void) fprintf(stderr, + "\t%s\n", + _nc_first_name(((ENTRY *)qp->uses[i].parent)->tterm.term_names)); + } + for (rp = heads[1]; rp; rp = rp->next) + if (rp->nuses > 1) + { + (void) fprintf(stderr, + "%s in file 2 (%s) has %d matches in file 1 (%s):\n", + _nc_first_name(rp->tterm.term_names), + argv[1], + rp->nuses, + argv[0]); + for (i = 0; i < rp->nuses; i++) + (void) fprintf(stderr, + "\t%s\n", + _nc_first_name(((ENTRY *)rp->uses[i].parent)->tterm.term_names)); + } + + (void) printf("In file 1 (%s) only:\n", argv[0]); + for (qp = heads[0]; qp; qp = qp->next) + if (qp->nuses == 0) + (void) printf("\t%s\n", + _nc_first_name(qp->tterm.term_names)); + + (void) printf("In file 2 (%s) only:\n", argv[1]); + for (rp = heads[1]; rp; rp = rp->next) + if (rp->nuses == 0) + (void) printf("\t%s\n", + _nc_first_name(rp->tterm.term_names)); + + (void) printf("The following entries are equivalent:\n"); + for (qp = heads[0]; qp; qp = qp->next) + { + rp = (ENTRY *)qp->uses[0].parent; + + if (qp->nuses == 1 && entryeq(&qp->tterm, &rp->tterm)) + { + char name1[NAMESIZE], name2[NAMESIZE]; + + (void) canonical_name(qp->tterm.term_names, name1); + (void) canonical_name(rp->tterm.term_names, name2); + + (void) printf("%s = %s\n", name1, name2); + } + } + + (void) printf("Differing entries:\n"); + termcount = 2; + for (qp = heads[0]; qp; qp = qp->next) + { + rp = (ENTRY *)qp->uses[0].parent; + + if (qp->nuses == 1 && !entryeq(&qp->tterm, &rp->tterm)) + { + char name1[NAMESIZE], name2[NAMESIZE]; + + memcpy(&term[0], &qp->tterm, sizeof(TERMTYPE)); + memcpy(&term[1], &rp->tterm, sizeof(TERMTYPE)); + + (void) canonical_name(qp->tterm.term_names, name1); + (void) canonical_name(rp->tterm.term_names, name2); + + switch (compare) + { + case C_DIFFERENCE: + if (itrace) + (void)fprintf(stderr,"infocmp: dumping differences\n"); + (void) printf("comparing %s to %s.\n", name1, name2); + compare_entry(compare_predicate); + break; + + case C_COMMON: + if (itrace) + (void) fprintf(stderr, + "infocmp: dumping common capabilities\n"); + (void) printf("comparing %s to %s.\n", name1, name2); + compare_entry(compare_predicate); + break; + + case C_NAND: + if (itrace) + (void) fprintf(stderr, + "infocmp: dumping differences\n"); + (void) printf("comparing %s to %s.\n", name1, name2); + compare_entry(compare_predicate); + break; + + } + } + } +} + +static void usage(void) +{ + fprintf(stderr, +"usage: infocmp [-dcnILCuvV1T] [-s d| i| l| c] [-w width] [-A directory] [-B directory] [termname...]\n"); + exit(EXIT_FAILURE); +} + +/*************************************************************************** + * + * Main sequence + * + ***************************************************************************/ + +int main(int argc, char *argv[]) +{ + char *terminal, *firstdir, *restdir; + path tfile[MAXTERMS]; + int c, i, len; + bool filecompare = FALSE; + bool initdump = FALSE; + bool init_analyze = FALSE; + bool limited = TRUE; + + if ((terminal = getenv("TERM")) == NULL) + { + (void) fprintf(stderr, + "infocmp: environment variable TERM not set\n"); + return EXIT_FAILURE; + } + + /* where is the terminfo database location going to default to? */ + restdir = firstdir = 0; + + while ((c = getopt(argc, argv, "decCFIinlLprR:s:uv:Vw:A:B:1T")) != EOF) + switch (c) + { + case 'd': + compare = C_DIFFERENCE; + break; + + case 'e': + initdump = TRUE; + break; + + case 'c': + compare = C_COMMON; + break; + + case 'C': + outform = F_TERMCAP; + tversion = "BSD"; + if (sortmode == S_DEFAULT) + sortmode = S_TERMCAP; + break; + + case 'F': + filecompare = TRUE; + break; + + case 'i': + init_analyze = TRUE; + break; + + case 'l': + outform = F_TERMINFO; + break; + + case 'L': + outform = F_VARIABLE; + if (sortmode == S_DEFAULT) + sortmode = S_VARIABLE; + break; + + case 'n': + compare = C_NAND; + break; + + case 'p': + ignorepads = TRUE; + break; + + case 'r': + tversion = (char *)NULL; + break; + + case 'R': + tversion = optarg; + break; + + case 's': + if (*optarg == 'd') + sortmode = S_NOSORT; + else if (*optarg == 'i') + sortmode = S_TERMINFO; + else if (*optarg == 'l') + sortmode = S_VARIABLE; + else if (*optarg == 'c') + sortmode = S_TERMCAP; + else + { + (void) fprintf(stderr, + "infocmp: unknown sort mode\n"); + return EXIT_FAILURE; + } + break; + + case 'u': + compare = C_USEALL; + break; + + case 'v': + itrace = atoi(optarg); + _nc_tracing = (1 << itrace) - 1; + break; + + case 'V': + (void) fputs(NCURSES_VERSION, stdout); + putchar('\n'); + ExitProgram(EXIT_SUCCESS); + + case 'w': + mwidth = atoi(optarg); + break; + + case 'A': + firstdir = optarg; + break; + + case 'B': + restdir = optarg; + break; + + case '1': + mwidth = 0; + break; + case 'T': + limited = FALSE; + break; + default: + usage(); + } + + /* by default, sort by terminfo name */ + if (sortmode == S_DEFAULT) + sortmode = S_TERMINFO; + + /* set up for display */ + dump_init(tversion, outform, sortmode, mwidth, itrace); + + /* make sure we have at least one terminal name to work with */ + if (optind >= argc) + argv[argc++] = terminal; + + /* if user is after a comparison, make sure we have two entries */ + if (compare != C_DEFAULT && optind >= argc - 1) + argv[argc++] = terminal; + + /* exactly two terminal names with no options means do -d */ + if (argc - optind == 2 && compare == C_DEFAULT) + compare = C_DIFFERENCE; + + if (!filecompare) + { + /* grab the entries */ + termcount = 0; + for (; optind < argc; optind++) + { + if (termcount >= MAXTERMS) + { + (void) fprintf(stderr, + "infocmp: too many terminal type arguments\n"); + return EXIT_FAILURE; + } + else + { + const char *directory = termcount ? restdir : firstdir; + int status; + + tname[termcount] = argv[optind]; + + if (directory) + { + (void) sprintf(tfile[termcount], "%s/%c/%s", + directory, + *argv[optind], argv[optind]); + if (itrace) + (void) fprintf(stderr, + "infocmp: reading entry %s from file %s\n", + argv[optind], tfile[termcount]); + + status = _nc_read_file_entry(tfile[termcount], + &term[termcount]); + } + else + { + if (itrace) + (void) fprintf(stderr, + "infocmp: reading entry %s from system directories %s\n", + argv[optind], tname[termcount]); + + status = _nc_read_entry(tname[termcount], + tfile[termcount], + &term[termcount]); + directory = TERMINFO; /* for error message */ + } + + if (status <= 0) + { + (void) fprintf(stderr, + "infocmp: couldn't open terminfo file %s.\n", + tfile[termcount]); + return EXIT_FAILURE; + } + termcount++; + } + } + + /* dump as C initializer for the terminal type */ + if (initdump) + { + int n; + const char *str = 0; + int size; + + (void) printf("\t%s\n\t\t\"%s\",\n", + L_CURL, term->term_names); + (void) printf("\t\t(char *)0,\n"); + + (void) printf("\t\t%s /* BOOLEANS */\n", L_CURL); + for (n = 0; n < BOOLCOUNT; n++) + { + switch((int)(term->Booleans[n])) + { + case TRUE: + str = "TRUE"; + break; + + case FALSE: + str = "FALSE"; + break; + + case ABSENT_BOOLEAN: + str = "ABSENT_BOOLEAN"; + break; + + case CANCELLED_BOOLEAN: + str = "CANCELLED_BOOLEAN"; + break; + } + (void) printf("\t\t/* %s */\t%s%s,\n", + boolnames[n], str, + n == BOOLCOUNT-1 ? R_CURL : ""); + } + + (void) printf("\t\t%s /* NUMERICS */\n", L_CURL); + for (n = 0; n < NUMCOUNT; n++) + { + char buf[BUFSIZ]; + switch (term->Numbers[n]) + { + case ABSENT_NUMERIC: + str = "ABSENT_NUMERIC"; + break; + case CANCELLED_NUMERIC: + str = "CANCELLED_NUMERIC"; + break; + default: + sprintf(buf, "%d", term->Numbers[n]); + str = buf; + break; + } + (void) printf("\t\t/* %s */\t%s%s,\n", + numnames[n], str, + n == NUMCOUNT-1 ? R_CURL : ""); + } + + size = sizeof(TERMTYPE) + + (BOOLCOUNT * sizeof(term->Booleans[0])) + + (NUMCOUNT * sizeof(term->Numbers[0])); + + (void) printf("\t\t%s /* STRINGS */\n", L_CURL); + for (n = 0; n < STRCOUNT; n++) + { + char buf[BUFSIZ], *sp, *tp; + + if (term->Strings[n] == ABSENT_STRING) + str = "ABSENT_STRING"; + else if (term->Strings[n] == CANCELLED_STRING) + str = "CANCELLED_STRING"; + else + { + tp = buf; + *tp++ = '"'; + for (sp = term->Strings[n]; *sp; sp++) + if (isascii(*sp) && isprint(*sp) && *sp !='\\' && *sp != '"') + *tp++ = *sp; + else + { + (void) sprintf(tp, "\\%03o", *sp); + tp += 4; + } + *tp++ = '"'; + *tp = '\0'; + size += (strlen(term->Strings[n]) + 1); + str = buf; + } + (void) printf("\t\t/* %s */\t%s%s%s\n", + strnames[n], str, + n == STRCOUNT-1 ? R_CURL : "", + n == STRCOUNT-1 ? "" : ","); + } + (void) printf("\t%s /* size = %d */\n", R_CURL, size); + ExitProgram(EXIT_SUCCESS); + } + + /* analyze the init strings */ + if (init_analyze) + { +#undef CUR +#define CUR term[0]. + analyze_string("is1", init_1string, &term[0]); + analyze_string("is2", init_2string, &term[0]); + analyze_string("is3", init_3string, &term[0]); + analyze_string("rs1", reset_1string, &term[0]); + analyze_string("rs2", reset_2string, &term[0]); + analyze_string("rs3", reset_3string, &term[0]); + analyze_string("smcup", enter_ca_mode, &term[0]); + analyze_string("rmcup", exit_ca_mode, &term[0]); +#undef CUR + ExitProgram(EXIT_SUCCESS); + } + + /* + * Here's where the real work gets done + */ + switch (compare) + { + case C_DEFAULT: + if (itrace) + (void) fprintf(stderr, + "infocmp: about to dump %s\n", + tname[0]); + (void) printf("#\tReconstructed via infocmp from file: %s\n", + tfile[0]); + len = dump_entry(&term[0], limited, NULL); + putchar('\n'); + if (itrace) + (void)fprintf(stderr,"infocmp: length %d\n", len); + break; + + case C_DIFFERENCE: + if (itrace) + (void)fprintf(stderr,"infocmp: dumping differences\n"); + (void) printf("comparing %s to %s.\n", tname[0], tname[1]); + compare_entry(compare_predicate); + break; + + case C_COMMON: + if (itrace) + (void) fprintf(stderr, + "infocmp: dumping common capabilities\n"); + (void) printf("comparing %s to %s.\n", tname[0], tname[1]); + compare_entry(compare_predicate); + break; + + case C_NAND: + if (itrace) + (void) fprintf(stderr, + "infocmp: dumping differences\n"); + (void) printf("comparing %s to %s.\n", tname[0], tname[1]); + compare_entry(compare_predicate); + break; + + case C_USEALL: + if (itrace) + (void) fprintf(stderr, "infocmp: dumping use entry\n"); + len = dump_entry(&term[0], limited, use_predicate); + for (i = 1; i < termcount; i++) + len += dump_uses(tname[i], !(outform==F_TERMCAP || outform==F_TCONVERR)); + putchar('\n'); + if (itrace) + (void)fprintf(stderr,"infocmp: length %d\n", len); + break; + } + } + else if (compare == C_USEALL) + (void) fprintf(stderr, "Sorry, -u doesn't work with -F\n"); + else if (compare == C_DEFAULT) + (void) fprintf(stderr, "Use `tic -[CI] ' for this.\n"); + else if (argc - optind != 2) + (void) fprintf(stderr, + "File comparison needs exactly two file arguments.\n"); + else + file_comparison(argc-optind, argv+optind); + + ExitProgram(EXIT_SUCCESS); +} + +/* infocmp.c ends here */ diff --git a/progs/modules b/progs/modules new file mode 100644 index 00000000..3c6157b1 --- /dev/null +++ b/progs/modules @@ -0,0 +1,27 @@ +# Program modules (some are in ncurses lib!) +################################################################################ +# Copyright 1995 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +clear progs $(srcdir) ../include/term.h +tic progs $(srcdir) ../include/term.h $(INCDIR)/tic.h $(srcdir)/dump_entry.h +toe progs $(srcdir) ../include/term.h $(INCDIR)/tic.h $(srcdir)/dump_entry.h +dump_entry progs $(srcdir) ../include/term.h $(INCDIR)/tic.h $(srcdir)/dump_entry.h ../include/parametrized.h termsort.c +infocmp progs $(srcdir) ../include/term.h $(INCDIR)/tic.h $(srcdir)/dump_entry.h +tput progs $(srcdir) ../include/term.h +tset progs $(srcdir) ../include/term.h diff --git a/progs/progs.priv.h b/progs/progs.priv.h new file mode 100644 index 00000000..854ff30b --- /dev/null +++ b/progs/progs.priv.h @@ -0,0 +1,136 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* + * $Id: progs.priv.h,v 1.9 1997/04/05 23:38:08 tom Exp $ + * + * progs.priv.h + * + * Header file for curses utility programs + * + */ + +#include + +#ifdef USE_RCS_IDS +#define MODULE_ID(id) static const char Ident[] = id; +#else +#define MODULE_ID(id) /*nothing*/ +#endif + +#include +#include +#include + +#if HAVE_UNISTD_H +#include +#else +# if HAVE_LIBC_H +# include +# endif +#endif + +#if HAVE_SYS_BSDTYPES_H +#include /* needed for ISC */ +#endif + +#if HAVE_LIMITS_H +# include +#elif HAVE_SYS_PARAM_H +# include +#endif + +#ifndef PATH_MAX +# if defined(_POSIX_PATH_MAX) +# define PATH_MAX _POSIX_PATH_MAX +# elif defined(MAXPATHLEN) +# define PATH_MAX MAXPATHLEN +# else +# define PATH_MAX 255 /* the Posix minimum pathsize */ +# endif +#endif + +#if HAVE_DIRENT_H +# include +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if HAVE_SYS_NDIR_H +# include +# endif +# if HAVE_SYS_DIR_H +# include +# endif +# if HAVE_NDIR_H +# include +# endif +#endif + +#include + +#if !HAVE_EXTERN_ERRNO +extern int errno; +#endif + +#if HAVE_GETOPT_H +#include +#else +/* 'getopt()' may be prototyped in , but declaring its + * variables doesn't hurt. + */ +extern char *optarg; +extern int optind; +#endif /* HAVE_GETOPT_H */ + +#include +#include +#include + +/* usually in */ +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif + +#ifndef STDERR_FILENO +#define STDERR_FILENO 2 +#endif + +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif + +#ifndef F_OK +#define F_OK 0 /* Test for existence. */ +#endif + +/* usually in */ +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif + +#ifndef STDERR_FILENO +#define STDERR_FILENO 2 +#endif diff --git a/progs/tic.c b/progs/tic.c new file mode 100644 index 00000000..5921b340 --- /dev/null +++ b/progs/tic.c @@ -0,0 +1,570 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* + * tic.c --- Main program for terminfo compiler + * by Eric S. Raymond + * + */ + +#include + +#include + +#include +#include + +MODULE_ID("$Id: tic.c,v 1.21 1996/12/30 02:24:15 tom Exp $") + +const char *_nc_progname = "tic"; + +static FILE *log_fp; +static bool showsummary = FALSE; + +static const char usage_string[] = "[-hc] [-v[n]] [-e names] [-CILNRTrsw1] source-file\n"; + +static void usage(void) +{ + static const char *const tbl[] = { + "Options:", + " -1 format translation output one capability per line", + " -C translate entries to termcap source form", + " -I translate entries to terminfo source form", + " -L translate entries to full terminfo source form", + " -N disable smart defaults for source translation", + " -R restrict translation to given terminfo/termcap version", + " -T remove size-restrictions on compiled description", + " -c check only, validate input without compiling or translating", + " -e translate/compile only entries named by comma-separated list", + " -o

set output directory for compiled entry writes", + " -r force resolution of all use entries in source translation", + " -s print summary statistics", + " -v[n] set verbosity level", + " -w[n] set format width for translation output", + "", + "Parameters:", + " file to translate or compile" + }; + size_t j; + + printf("Usage: %s %s\n", _nc_progname, usage_string); + for (j = 0; j < sizeof(tbl)/sizeof(tbl[0]); j++) + puts(tbl[j]); + exit(EXIT_FAILURE); +} + +static bool immedhook(ENTRY *ep) +/* write out entries with no use capabilities immediately to save storage */ +{ +#ifndef HAVE_BIG_CORE + /* + * This is strictly a core-economy kluge. The really clean way to handle + * compilation is to slurp the whole file into core and then do all the + * name-collision checks and entry writes in one swell foop. But the + * terminfo master file is large enough that some core-poor systems swap + * like crazy when you compile it this way...there have been reports of + * this process taking *three hours*, rather than the twenty seconds or + * less typical on my development box. + * + * So. This hook *immediately* writes out the referenced entry if it + * has no use capabilities. The compiler main loop refrains from + * adding the entry to the in-core list when this hook fires. If some + * other entry later needs to reference an entry that got written + * immediately, that's OK; the resolution code will fetch it off disk + * when it can't find it in core. + * + * Name collisions will still be detected, just not as cleanly. The + * write_entry() code complains before overwriting an entry that + * postdates the time of tic's first call to write_entry(). Thus + * it will complain about overwriting entries newly made during the + * tic run, but not about overwriting ones that predate it. + * + * The reason this is a hook, and not in line with the rest of the + * compiler code, is that the support for termcap fallback cannot assume + * it has anywhere to spool out these entries! + * + * The _nc_set_type() call here requires a compensating one in + * _nc_parse_entry(). + * + * If you define HAVE_BIG_CORE, you'll disable this kluge. This will + * make tic a bit faster (because the resolution code won't have to do + * disk I/O nearly as often). + */ + if (ep->nuses == 0) + { + int oldline = _nc_curr_line; + + _nc_set_type(_nc_first_name(ep->tterm.term_names)); + _nc_curr_line = ep->startline; + _nc_write_entry(&ep->tterm); + _nc_curr_line = oldline; + free(ep->tterm.str_table); + return(TRUE); + } + else +#endif /* HAVE_BIG_CORE */ + return(FALSE); +} + +static void put_translate(int c) +/* emit a comment char, translating terminfo names to termcap names */ +{ + static bool in_name = FALSE; + static char namebuf[132], suffix[132], *sp; + + if (!in_name) + { + if (c == '<') + { + in_name = TRUE; + sp = namebuf; + } + else + putchar(c); + } + else if (c == '\n' || c == '@') + { + *sp++ = '\0'; + (void) putchar('<'); + (void) fputs(namebuf, stdout); + putchar(c); + in_name = FALSE; + } + else if (c != '>') + *sp++ = c; + else /* ah! candidate name! */ + { + char *up, *tp; + + *sp++ = '\0'; + in_name = FALSE; + + suffix[0] = '\0'; + if ((up = strchr(namebuf, '#')) != 0 + || (up = strchr(namebuf, '=')) != 0 + || ((up = strchr(namebuf, '@')) != 0 && up[1] == '>')) + { + (void) strcpy(suffix, up); + *up = '\0'; + } + + if ((tp = nametrans(namebuf)) != (char *)NULL) + { + (void) putchar(':'); + (void) fputs(tp, stdout); + (void) fputs(suffix, stdout); + (void) putchar(':'); + } + else + { + /* couldn't find a translation, just dump the name */ + (void) putchar('<'); + (void) fputs(namebuf, stdout); + (void) fputs(suffix, stdout); + (void) putchar('>'); + } + + } +} + +/* Returns a string, stripped of leading/trailing whitespace */ +static char *stripped(char *src) +{ + while (isspace(*src)) + src++; + if (*src != '\0') { + char *dst = strcpy(malloc(strlen(src)+1), src); + size_t len = strlen(dst); + while (--len != 0 && isspace(dst[len])) + dst[len] = '\0'; + return dst; + } + return 0; +} + +/* Parse the "-e" option-value into a list of names */ +static const char **make_namelist(char *src) +{ + const char **dst = 0; + + char *s, *base; + size_t pass, n, nn; + char buffer[BUFSIZ]; + + if (strchr(src, '/') != 0) { /* a filename */ + FILE *fp = fopen(src, "r"); + if (fp == 0) { + perror(src); + exit(EXIT_FAILURE); + } + for (pass = 1; pass <= 2; pass++) { + nn = 0; + while (fgets(buffer, sizeof(buffer), fp) != 0) { + if ((s = stripped(buffer)) != 0) { + if (dst != 0) + dst[nn] = s; + nn++; + } + } + if (pass == 1) { + dst = (const char **)calloc(nn+1, sizeof(*dst)); + rewind(fp); + } + } + fclose(fp); + } else { /* literal list of names */ + for (pass = 1; pass <= 2; pass++) { + for (n = nn = 0, base = src; ; n++) { + int mark = src[n]; + if (mark == ',' || mark == '\0') { + if (pass == 1) { + nn++; + } else { + src[n] = '\0'; + if ((s = stripped(base)) != 0) + dst[nn++] = s; + base = &src[n+1]; + } + } + if (mark == '\0') + break; + } + if (pass == 1) + dst = (const char **)calloc(nn+1, sizeof(*dst)); + } + } + if (showsummary) { + fprintf(log_fp, "Entries that will be compiled:\n"); + for (n = 0; dst[n] != 0; n++) + fprintf(log_fp, "%d:%s\n", n+1, dst[n]); + } + return dst; +} + +static bool matches(const char **needle, const char *haystack) +/* does entry in needle list match |-separated field in haystack? */ +{ + int code = FALSE; + size_t n; + + if (needle != 0) + { + for (n = 0; needle[n] != 0; n++) + { + if (_nc_name_match(haystack, needle[n], "|")) + { + code = TRUE; + break; + } + } + } + else + code = TRUE; + return(code); +} + +int main (int argc, char *argv[]) +{ +int v_opt = -1, debug_level; +int smart_defaults = TRUE; +char *termcap; +ENTRY *qp; + +int this_opt, last_opt = '?'; + +int outform = F_TERMINFO; /* output format */ +int sortmode = S_TERMINFO; /* sort_mode */ + +int width = 60; +bool infodump = FALSE; /* running as captoinfo? */ +bool capdump = FALSE; /* running as infotocap? */ +bool forceresolve = FALSE; /* force resolution */ +bool limited = TRUE; +char *tversion = (char *)NULL; +const char *source_file = "terminfo"; +const char **namelst = 0; +char *outdir = (char *)NULL; +bool check_only = FALSE; + + log_fp = stderr; + + if ((_nc_progname = strrchr(argv[0], '/')) == NULL) + _nc_progname = argv[0]; + else + _nc_progname++; + + infodump = (strcmp(_nc_progname, "captoinfo") == 0); + capdump = (strcmp(_nc_progname, "infotocap") == 0); + + /* + * Processing arguments is a little complicated, since someone made a + * design decision to allow the numeric values for -w, -v options to + * be optional. + */ + while ((this_opt = getopt(argc, argv, "0123456789CILNR:TVce:orsvw")) != EOF) { + if (isdigit(this_opt)) { + switch (last_opt) { + case 'v': + v_opt = (v_opt * 10) + (this_opt - '0'); + break; + case 'w': + width = (width * 10) + (this_opt - '0'); + break; + default: + if (this_opt != '1') + usage(); + last_opt = this_opt; + width = 0; + } + continue; + } + switch (this_opt) { + case 'C': + capdump = TRUE; + outform = F_TERMCAP; + sortmode = S_TERMCAP; + break; + case 'I': + infodump = TRUE; + outform = F_TERMINFO; + sortmode = S_TERMINFO; + break; + case 'L': + infodump = TRUE; + outform = F_VARIABLE; + sortmode = S_VARIABLE; + break; + case 'N': + smart_defaults = FALSE; + break; + case 'R': + tversion = optarg; + break; + case 'T': + limited = FALSE; + break; + case 'V': + puts(NCURSES_VERSION); + return EXIT_SUCCESS; + case 'c': + check_only = TRUE; + break; + case 'e': + namelst = make_namelist(optarg); + break; + case 'o': + outdir = optarg; + break; + case 'r': + forceresolve = TRUE; + break; + case 's': + showsummary = TRUE; + break; + case 'v': + v_opt = 0; + break; + case 'w': + width = 0; + break; + default: + usage(); + } + last_opt = this_opt; + } + + debug_level = (v_opt > 0) ? v_opt : (v_opt == 0); + _nc_tracing = (1 << debug_level) - 1; + + if (optind < argc) { + source_file = argv[optind++]; + if (optind < argc) { + fprintf (stderr, + "%s: Too many file names. Usage:\n\t%s %s", + _nc_progname, + _nc_progname, + usage_string); + return EXIT_FAILURE; + } + } else { + if (infodump == TRUE) { + /* captoinfo's no-argument case */ + source_file = "/etc/termcap"; + if ((termcap = getenv("TERMCAP")) != NULL) { + if (access(termcap, F_OK) == 0) { + /* file exists */ + source_file = termcap; + } + } + } else { + /* tic */ + fprintf (stderr, + "%s: File name needed. Usage:\n\t%s %s", + _nc_progname, + _nc_progname, + usage_string); + return EXIT_FAILURE; + } + } + + if (freopen(source_file, "r", stdin) == NULL) { + fprintf (stderr, "%s: Can't open %s\n", _nc_progname, source_file); + return EXIT_FAILURE; + } + + if (infodump) + dump_init(tversion, + smart_defaults + ? outform + : F_LITERAL, + sortmode, width, debug_level); + else if (capdump) + dump_init(tversion, + outform, + sortmode, width, debug_level); + + /* parse entries out of the source file */ + _nc_set_source(source_file); +#ifndef HAVE_BIG_CORE + if (!(check_only || infodump || capdump)) + _nc_set_writedir(outdir); +#endif /* HAVE_BIG_CORE */ + _nc_read_entry_source(stdin, (char *)NULL, + !smart_defaults, FALSE, + (check_only || infodump || capdump) ? NULLHOOK : immedhook); + + /* do use resolution */ + if (check_only || (!infodump && !capdump) || forceresolve) + if (!_nc_resolve_uses() && !check_only) + return EXIT_FAILURE; + +#ifndef HAVE_BIG_CORE + /* + * Aaargh! immedhook seriously hoses us! + * + * One problem with immedhook is it means we can't do -e. Problem + * is that we can't guarantee that for each terminal listed, all the + * terminals it depends on will have been kept in core for reference + * resolution -- in fact it's certain the primitive types at the end + * of reference chains *won't* be in core unless they were explicitly + * in the select list themselves. + */ + if (namelst && (!infodump && !capdump)) + { + (void) fprintf(stderr, + "Sorry, -e can't be used without -I or -C\n"); + return EXIT_FAILURE; + } +#endif /* HAVE_BIG_CORE */ + + /* length check */ + if (check_only && (capdump || infodump)) + { + for_entry_list(qp) + { + if (matches(namelst, qp->tterm.term_names)) + { + int len = fmt_entry(&qp->tterm, NULL, TRUE, infodump); + + if (len>(infodump?MAX_TERMINFO_LENGTH:MAX_TERMCAP_LENGTH)) + (void) fprintf(stderr, + "warning: resolved %s entry is %d bytes long\n", + _nc_first_name(qp->tterm.term_names), + len); + } + } + } + + /* write or dump all entries */ + if (!check_only) + { + if (!infodump && !capdump) + { + _nc_set_writedir(outdir); + for_entry_list(qp) + if (matches(namelst, qp->tterm.term_names)) + { + _nc_set_type(_nc_first_name(qp->tterm.term_names)); + _nc_curr_line = qp->startline; + _nc_write_entry(&qp->tterm); + } + } + else + { + bool trailing_comment = FALSE; + int c, oldc = '\0'; + + /* this is in case infotocap() generates warnings */ + _nc_curr_col = _nc_curr_line = -1; + + for_entry_list(qp) + if (matches(namelst, qp->tterm.term_names)) + { + int j = qp->cend - qp->cstart; + int len = 0; + + /* this is in case infotocap() generates warnings */ + _nc_set_type(_nc_first_name(qp->tterm.term_names)); + + (void) fseek(stdin, qp->cstart, SEEK_SET); + while (j-- ) + if (infodump) + (void) putchar(getchar()); + else + put_translate(getchar()); + + len = dump_entry(&qp->tterm, limited, NULL); + for (j = 0; j < qp->nuses; j++) + len += dump_uses((char *)(qp->uses[j].parent), infodump); + (void) putchar('\n'); + if (debug_level != 0 && !limited) + printf("# length=%d\n", len); + } + if (!namelst) + { + (void) fseek(stdin, _nc_tail->cend, SEEK_SET); + while ((c = getchar()) != EOF) + { + if (oldc == '\n' && c == '#') + trailing_comment = TRUE; + if (trailing_comment) + putchar(c); + oldc = c; + } + } + } + } + + /* Show the directory into which entries were written, and the total + * number of entries + */ + if (showsummary + && (!(check_only || infodump || capdump))) { + int total = _nc_tic_written(); + if (total != 0) + fprintf(log_fp, "%d entries written to %s\n", + total, + _nc_tic_dir((char *)0)); + else + fprintf(log_fp, "No entries written\n"); + } + return(EXIT_SUCCESS); +} diff --git a/progs/toe.c b/progs/toe.c new file mode 100644 index 00000000..438d59de --- /dev/null +++ b/progs/toe.c @@ -0,0 +1,284 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* + * toe.c --- table of entries report generator + * + */ + +#include + +#include +#include + +MODULE_ID("$Id: toe.c,v 0.15 1997/02/15 18:54:47 tom Exp $") + +const char *_nc_progname; + +static int typelist(int eargc, char *eargv[], bool, + void (*)(const char *, TERMTYPE *)); +static void deschook(const char *, TERMTYPE *); + +#if NO_LEAKS +#undef ExitProgram +static void ExitProgram(int code) GCC_NORETURN; +static void ExitProgram(int code) +{ + _nc_free_entries(_nc_head); + _nc_leaks_dump_entry(); + _nc_free_and_exit(code); +} +#endif + +int main (int argc, char *argv[]) +{ + bool direct_dependencies = FALSE; + bool invert_dependencies = FALSE; + bool header = FALSE; + int i, c, debug_level = 0; + int code; + + if ((_nc_progname = strrchr(argv[0], '/')) == NULL) + _nc_progname = argv[0]; + else + _nc_progname++; + + while ((c = getopt(argc, argv, "huv:UV")) != EOF) + switch (c) + { + case 'h': + header = TRUE; + break; + case 'u': + direct_dependencies = TRUE; + break; + case 'v': + debug_level = atoi(optarg); + _nc_tracing = (1 << debug_level) - 1; + break; + case 'U': + invert_dependencies = TRUE; + break; + case 'V': + (void) fputs(NCURSES_VERSION, stdout); + putchar('\n'); + ExitProgram(EXIT_SUCCESS); + default: + (void) fprintf (stderr, "usage: toe [-huUV] [-v n] [file...]\n"); + ExitProgram(EXIT_FAILURE); + } + + if (direct_dependencies || invert_dependencies) + { + if (freopen(argv[optind], "r", stdin) == NULL) + { + fprintf(stderr, "%s: can't open %s\n", _nc_progname, argv[optind]); + ExitProgram(EXIT_FAILURE); + } + + /* parse entries out of the source file */ + _nc_set_source(argv[optind]); + _nc_read_entry_source(stdin, (char *)NULL, + FALSE, FALSE, + NULLHOOK); + } + + /* maybe we want a direct-dependency listing? */ + if (direct_dependencies) + { + ENTRY *qp; + + for_entry_list(qp) + if (qp->nuses) + { + int j; + + (void) printf("%s:", _nc_first_name(qp->tterm.term_names)); + for (j = 0; j < qp->nuses; j++) + (void) printf(" %s", (char *)(qp->uses[j].parent)); + putchar('\n'); + } + + ExitProgram(EXIT_SUCCESS); + } + + /* maybe we want a reverse-dependency listing? */ + if (invert_dependencies) + { + ENTRY *qp, *rp; + int matchcount; + + for_entry_list(qp) + { + matchcount = 0; + for_entry_list(rp) + { + if (rp->nuses == 0) + continue; + + for (i = 0; i < rp->nuses; i++) + if (_nc_name_match(qp->tterm.term_names,(char*)rp->uses[i].parent, "|")) + { + if (matchcount++ == 0) + (void) printf("%s:", + _nc_first_name(qp->tterm.term_names)); + (void) printf(" %s", + _nc_first_name(rp->tterm.term_names)); + } + } + if (matchcount) + putchar('\n'); + } + + ExitProgram(EXIT_SUCCESS); + } + + /* + * If we get this far, user wants a simple terminal type listing. + */ + if (optind < argc) { + code = typelist(argc-optind, argv+optind, header, deschook); + } else { + char *explicit, *home, *eargv[3]; + int j; + + j = 0; + if ((explicit = getenv("TERMINFO")) != (char *)NULL) + eargv[j++] = explicit; + else + { + if ((home = getenv("HOME")) != (char *)NULL) + { + char personal[PATH_MAX]; + + (void) sprintf(personal, PRIVATE_INFO, home); + if (access(personal, F_OK) == 0) + eargv[j++] = personal; + } + eargv[j++] = TERMINFO; + } + eargv[j] = (char *)NULL; + + code = typelist(j, eargv, header, deschook); + } + + ExitProgram(code); +} + +static void deschook(const char *cn, TERMTYPE *tp) +/* display a description for the type */ +{ + const char *desc; + + if ((desc = strrchr(tp->term_names, '|')) == (char *)NULL) + desc = "(No description)"; + else + ++desc; + + (void) printf("%-10s\t%s\n", cn, desc); +} + +static int typelist(int eargc, char *eargv[], + bool verbosity, + void (*hook)(const char *, TERMTYPE *tp)) +/* apply a function to each entry in given terminfo directories */ +{ + int i; + + for (i = 0; i < eargc; i++) + { + DIR *termdir; + struct dirent *subdir; + + if ((termdir = opendir(eargv[i])) == (DIR *)NULL) + { + (void) fprintf(stderr, + "%s: can't open terminfo directory %s\n", + _nc_progname, eargv[i]); + return(EXIT_FAILURE); + } + else if (verbosity) + (void) printf("#\n#%s:\n#\n", eargv[i]); + + while ((subdir = readdir(termdir)) != NULL) + { + size_t len = NAMLEN(subdir); + char buf[PATH_MAX]; + char name_1[PATH_MAX]; + DIR *entrydir; + struct dirent *entry; + + strncpy(name_1, subdir->d_name, len)[len] = '\0'; + if (!strcmp(name_1, ".") + || !strcmp(name_1, "..")) + continue; + + (void) strcpy(buf, eargv[i]); + (void) strcat(buf, "/"); + (void) strcat(buf, name_1); + (void) strcat(buf, "/"); + chdir(buf); + entrydir = opendir("."); + while ((entry = readdir(entrydir)) != NULL) + { + char name_2[PATH_MAX]; + TERMTYPE lterm; + char *cn; + int status; + + len = NAMLEN(entry); + strncpy(name_2, entry->d_name, len)[len] = '\0'; + if (!strcmp(name_2, ".") + || !strcmp(name_2, "..")) + continue; + + status = _nc_read_file_entry(name_2, <erm); + if (status <= 0) + { + (void) fprintf(stderr, + "toe: couldn't open terminfo file %s.\n", + name_2); + return(EXIT_FAILURE); + } + + /* only visit things once, by primary name */ + cn = _nc_first_name(lterm.term_names); + if (!strcmp(cn, name_2)) + { + /* apply the selected hook function */ + (*hook)(cn, <erm); + } + if (lterm.term_names) { + free(lterm.term_names); + lterm.term_names = NULL; + } + if (lterm.str_table) { + free(lterm.str_table); + lterm.str_table = NULL; + } + } + closedir(entrydir); + } + closedir(termdir); + } + + return(EXIT_SUCCESS); +} diff --git a/progs/tput.c b/progs/tput.c new file mode 100644 index 00000000..5d0cabc6 --- /dev/null +++ b/progs/tput.c @@ -0,0 +1,277 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * tput.c -- shellscript access to terminal capabilities + * + * by Eric S. Raymond , portions based on code from + * Ross Ridge's mytinfo package. + */ + +#include + +#include +#include + +MODULE_ID("$Id: tput.c,v 1.8 1996/12/21 17:34:36 tom Exp $") + +#define PUTS(s) fputs(s, stdout) +#define PUTCHAR(c) putchar(c) +#define FLUSH fflush(stdout) + +static char *prg_name; + +static void quit(int status, const char *fmt, ...) +{ +va_list argp; + + va_start(argp,fmt); + vfprintf (stderr, fmt, argp); + fprintf(stderr, "\n"); + va_end(argp); + exit(status); +} + +static void usage(void) +{ + fprintf(stderr, "usage: %s [-S] [-T term] capname\n", prg_name); + exit(EXIT_FAILURE); +} + +static int tput(int argc, char *argv[]) +{ +char *s; +int i, j, c; +int reset, status; +FILE *f; + + reset = 0; + if (strcmp(argv[0], "reset") == 0) { + reset = 1; + } + if (reset || strcmp(argv[0], "init") == 0) { + if (init_prog != NULL) { + system(init_prog); + } + FLUSH; + + if (reset && reset_1string != NULL) { + PUTS(reset_1string); + } else if (init_1string != NULL) { + PUTS(init_1string); + } + FLUSH; + + if (reset && reset_2string != NULL) { + PUTS(reset_2string); + } else if (init_2string != NULL) { + PUTS(init_2string); + } + FLUSH; + + if (set_lr_margin != NULL) { + PUTS(tparm(set_lr_margin, 0, columns - 1)); + } else if (set_left_margin_parm != NULL + && set_right_margin_parm != NULL) { + PUTS(tparm(set_left_margin_parm, 0)); + PUTS(tparm(set_right_margin_parm, columns - 1)); + } else if (clear_margins != NULL && set_left_margin != NULL + && set_right_margin != NULL) { + PUTS(clear_margins); + if (carriage_return != NULL) { + PUTS(carriage_return); + } else { + PUTCHAR('\r'); + } + PUTS(set_left_margin); + if (parm_right_cursor) { + PUTS(tparm(parm_right_cursor, columns - 1)); + } else { + for(i = 0; i < columns - 1; i++) { + PUTCHAR(' '); + } + } + PUTS(set_right_margin); + if (carriage_return != NULL) { + PUTS(carriage_return); + } else { + PUTCHAR('\r'); + } + } + FLUSH; + + if (init_tabs != 8) { + if (clear_all_tabs != NULL && set_tab != NULL) { + for(i = 0; i < columns - 1; i += 8) { + if (parm_right_cursor) { + PUTS(tparm(parm_right_cursor, 8)); + } else { + for(j = 0; j < 8; j++) + PUTCHAR(' '); + } + PUTS(set_tab); + } + FLUSH; + } + } + + if (reset && reset_file != NULL) { + f = fopen(reset_file, "r"); + if (f == NULL) { + quit(errno, "Can't open reset_file: '%s'", reset_file); + } + while((c = fgetc(f)) != EOF) { + PUTCHAR(c); + } + fclose(f); + } else if (init_file != NULL) { + f = fopen(init_file, "r"); + if (f == NULL) { + quit(errno, "Can't open init_file: '%s'", init_file); + } + while((c = fgetc(f)) != EOF) { + PUTCHAR(c); + } + fclose(f); + } + FLUSH; + + if (reset && reset_3string != NULL) { + PUTS(reset_3string); + } else if (init_2string != NULL) { + PUTS(init_2string); + } + FLUSH; + return 0; + } + + if (strcmp(argv[0], "longname") == 0) { + PUTS(longname()); + return 0; + } + + if ((status = tigetflag(argv[0])) != -1) + return(status != 0); + else if ((status = tigetnum(argv[0])) != CANCELLED_NUMERIC) { + (void) printf("%d\n", status); + return(0); + } + else if ((s = tigetstr(argv[0])) == CANCELLED_STRING) + quit(4, "%s: unknown terminfo capability '%s'", prg_name, argv[0]); + else if (s != (char *)NULL) { + if (argc > 1) { + int k; + + /* Nasty hack time. The tparm function needs to see numeric + * parameters as numbers, not as pointers to their string + * representations + */ + + for (k = 1; k < argc; k++) + if (isdigit(argv[k][0])) { + long val = atol(argv[k]); + argv[k] = (char *)val; + } + + s = tparm(s,argv[1],argv[2],argv[3],argv[4], + argv[5],argv[6],argv[7],argv[8], + argv[9]); + } + + /* use putp() in order to perform padding */ + putp(s); + return(0); + } + return(0); +} + +int main(int argc, char **argv) +{ +char *s, *term; +int errret, cmdline = 1; +int c; + + prg_name = argv[0]; + s = strrchr(prg_name, '/'); + if (s != NULL && *++s != '\0') + prg_name = s; + + term = getenv("TERM"); + + while ((c = getopt (argc, argv, "ST:")) != EOF) + switch (c) + { + case 'S': + cmdline = 0; + break; + case 'T': + use_env(FALSE); + term = optarg; + break; + default: + usage(); + /* NOTREACHED */ + } + argc -= optind; + argv += optind; + + if (cmdline && argc == 0) { + usage(); + /* NOTREACHED */ + } + + if (term == NULL || *term == '\0') { + quit(2, "No value for $TERM and no -T specified"); + } + + setupterm(term, STDOUT_FILENO, &errret); + if (errret == ERR) + quit(3, "unknown terminal \"%s\"", term); + + if (cmdline) + return(tput(argc, argv)); + else { + char buf[BUFSIZ]; + int errors = 0; + + while (fgets(buf, sizeof(buf), stdin) != (char *)NULL) { + char *argvec[16]; /* command, 9 parms, null, & slop */ + int argnum = 0; + char *cp; + + /* crack the argument list into a dope vector */ + for (cp = buf; *cp; cp++) { + if (isspace(*cp)) + *cp = '\0'; + else if (cp == buf || cp[-1] == 0) + argvec[argnum++] = cp; + } + argvec[argnum] = (char *)NULL; + + if (tput(argnum, argvec) != 0) + errors++; + } + + return(errors > 0); + } +} + diff --git a/progs/tset.c b/progs/tset.c new file mode 100644 index 00000000..e6a075d9 --- /dev/null +++ b/progs/tset.c @@ -0,0 +1,1161 @@ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* ncurses is copyright (C) 1992-1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* Permission is hereby granted to reproduce and distribute ncurses * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of ncurses in any * +* applications linked with it is highly appreciated. * +* * +* ncurses comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + + +/* + * tset.c - terminal initialization utility + * + * This code was mostly swiped from 4.4BSD tset, with some obsolescent + * cruft removed and substantial portions rewritten. A Regents of the + * University of California copyright applies to some portions of the + * code, and is reproduced below: + */ +/*- + * Copyright (c) 1980, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define __INTERNAL_CAPS_VISIBLE /* we need to see has_hardware_tabs */ +#include + +#include +#include +#include +#include +#include + +#if HAVE_GETTTYNAM && HAVE_TTYENT_H +#include +#endif +#ifdef NeXT +char *ttyname(int fd); +#endif + +/* this is just to stifle a missing-prototype warning */ +#ifdef linux +# include +#endif + +#if SYSTEM_LOOKS_LIKE_SCO +/* they neglected to define struct winsize in termios.h -- it's only + in termio.h */ +#include +#include +#endif + +#include /* for bool typedef */ +#include + +MODULE_ID("$Id: tset.c,v 0.23 1997/05/10 17:44:47 tom Exp $") + +extern char **environ; + +#undef CTRL +#define CTRL(x) ((x) & 0x1f) + +const char *_nc_progname = "tset"; + +static TTY mode, oldmode; + +static int terasechar; /* new erase character */ +static int intrchar; /* new interrupt character */ +static int isreset; /* invoked as reset */ +static int tkillchar; /* new kill character */ +static int tlines, tcolumns; /* window size */ + +#define LOWERCASE(c) ((isalpha(c) && isupper(c)) ? tolower(c) : (c)) + +static int +CaselessCmp(const char *a, const char *b) /* strcasecmp isn't portable */ +{ + while (*a && *b) { + int cmp = LOWERCASE(*a) - LOWERCASE(*b); + if (cmp != 0) + break; + a++, b++; + } + return LOWERCASE(*a) - LOWERCASE(*b); +} + +#if !HAVE_STRDUP +static char *strdup (char *s) +{ + char *p; + + p = malloc(strlen(s)+1); + if (p) + strcpy(p,s); + return(p); +} +#endif /* not HAVE_STRDUP */ + +static void +err(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + (void)fprintf(stderr, "tset: "); + (void)vfprintf(stderr, fmt, ap); + va_end(ap); + (void)fprintf(stderr, "\n"); + exit(EXIT_FAILURE); + /* NOTREACHED */ +} + +static void +failed(const char *msg) +{ + char temp[BUFSIZ]; + perror(strcat(strcpy(temp, "tset: "), msg)); + exit(EXIT_FAILURE); + /* NOTREACHED */ +} + +static void +cat(char *file) +{ + register int fd, nr, nw; + char buf[1024]; + + if ((fd = open(file, O_RDONLY, 0)) < 0) + failed(file); + + while ((nr = read(fd, buf, sizeof(buf))) > 0) + if ((nw = write(STDERR_FILENO, buf, (size_t)nr)) == -1) + failed("write to stderr"); + if (nr != 0) + failed(file); + (void)close(fd); +} + +static int +outc(int c) +{ + return putc(c, stderr); +} + +/* Prompt the user for a terminal type. */ +static const char * +askuser(const char *dflt) +{ + static char answer[256]; + char *p; + + /* We can get recalled; if so, don't continue uselessly. */ + if (feof(stdin) || ferror(stdin)) { + (void)fprintf(stderr, "\n"); + exit(EXIT_FAILURE); + } + for (;;) { + if (dflt) + (void)fprintf(stderr, "Terminal type? [%s] ", dflt); + else + (void)fprintf(stderr, "Terminal type? "); + (void)fflush(stderr); + + if (fgets(answer, sizeof(answer), stdin) == 0) { + if (dflt == 0) { + (void)fprintf(stderr, "\n"); + exit(EXIT_FAILURE); + } + return (dflt); + } + + if ((p = strchr(answer, '\n')) != 0) + *p = '\0'; + if (answer[0]) + return (answer); + if (dflt != 0) + return (dflt); + } +} + +/************************************************************************** + * + * Mapping logic begins here + * + **************************************************************************/ + +/* Baud rate conditionals for mapping. */ +#define GT 0x01 +#define EQ 0x02 +#define LT 0x04 +#define NOT 0x08 +#define GE (GT | EQ) +#define LE (LT | EQ) + +typedef struct map { + struct map *next; /* Linked list of maps. */ + const char *porttype; /* Port type, or "" for any. */ + const char *type; /* Terminal type to select. */ + int conditional; /* Baud rate conditionals bitmask. */ + int speed; /* Baud rate to compare against. */ +} MAP; + +static MAP *cur, *maplist; + +typedef struct speeds { + const char *string; + int speed; +} SPEEDS; + +static const SPEEDS speeds[] = { + { "0", B0 }, + { "50", B50 }, + { "75", B75 }, + { "110", B110 }, + { "134", B134 }, + { "134.5", B134 }, + { "150", B150 }, + { "200", B200 }, + { "300", B300 }, + { "600", B600 }, + { "1200", B1200 }, + { "1800", B1800 }, + { "2400", B2400 }, + { "4800", B4800 }, + { "9600", B9600 }, + { "19200", B19200 }, + { "38400", B38400 }, + { "19200", B19200 }, + { "38400", B38400 }, + { (char *)0, 0 } +}; + +static int +tbaudrate(char *rate) +{ + const SPEEDS *sp; + int found = FALSE; + + /* The baudrate number can be preceded by a 'B', which is ignored. */ + if (*rate == 'B') + ++rate; + + for (sp = speeds; sp->string; ++sp) { + if (!CaselessCmp(rate, sp->string)) { + found = TRUE; + break; + } + } + if (!found) + err("unknown baud rate %s", rate); + return (sp->speed); +} + +/* + * Syntax for -m: + * [port-type][test baudrate]:terminal-type + * The baud rate tests are: >, <, @, =, ! + */ +static void +add_mapping(const char *port, char *arg) +{ + MAP *mapp; + char *copy, *p; + const char *termp; + char *base = 0; + + copy = strdup(arg); + mapp = malloc((u_int)sizeof(MAP)); + if (copy == 0 || mapp == 0) + failed("malloc"); + mapp->next = 0; + if (maplist == 0) + cur = maplist = mapp; + else { + cur->next = mapp; + cur = mapp; + } + + mapp->porttype = arg; + mapp->conditional = 0; + + arg = strpbrk(arg, "><@=!:"); + + if (arg == 0) { /* [?]term */ + mapp->type = mapp->porttype; + mapp->porttype = 0; + goto done; + } + + if (arg == mapp->porttype) /* [><@=! baud]:term */ + termp = mapp->porttype = 0; + else + termp = base = arg; + + for (;; ++arg) /* Optional conditionals. */ + switch(*arg) { + case '<': + if (mapp->conditional & GT) + goto badmopt; + mapp->conditional |= LT; + break; + case '>': + if (mapp->conditional & LT) + goto badmopt; + mapp->conditional |= GT; + break; + case '@': + case '=': /* Not documented. */ + mapp->conditional |= EQ; + break; + case '!': + mapp->conditional |= NOT; + break; + default: + goto next; + } + +next: if (*arg == ':') { + if (mapp->conditional) + goto badmopt; + ++arg; + } else { /* Optional baudrate. */ + arg = strchr(p = arg, ':'); + if (arg == 0) + goto badmopt; + *arg++ = '\0'; + mapp->speed = tbaudrate(p); + } + + if (arg == (char *)0) /* Non-optional type. */ + goto badmopt; + + mapp->type = arg; + + /* Terminate porttype, if specified. */ + if (termp != 0) + *base = '\0'; + + /* If a NOT conditional, reverse the test. */ + if (mapp->conditional & NOT) + mapp->conditional = ~mapp->conditional & (EQ | GT | LT); + + /* If user specified a port with an option flag, set it. */ +done: if (port) { + if (mapp->porttype) +badmopt: err("illegal -m option format: %s", copy); + mapp->porttype = port; + } + +#ifdef MAPDEBUG + (void)printf("port: %s\n", mapp->porttype ? mapp->porttype : "ANY"); + (void)printf("type: %s\n", mapp->type); + (void)printf("conditional: "); + p = ""; + if (mapp->conditional & GT) { + (void)printf("GT"); + p = "/"; + } + if (mapp->conditional & EQ) { + (void)printf("%sEQ", p); + p = "/"; + } + if (mapp->conditional & LT) + (void)printf("%sLT", p); + (void)printf("\nspeed: %d\n", mapp->speed); +#endif +} + +/* + * Return the type of terminal to use for a port of type 'type', as specified + * by the first applicable mapping in 'map'. If no mappings apply, return + * 'type'. + */ +static const char * +mapped(const char *type) +{ + MAP *mapp; + int match; + + for (mapp = maplist; mapp; mapp = mapp->next) + if (mapp->porttype == 0 || !strcmp(mapp->porttype, type)) { + switch (mapp->conditional) { + case 0: /* No test specified. */ + match = TRUE; + break; + case EQ: + match = (ospeed == mapp->speed); + break; + case GE: + match = (ospeed >= mapp->speed); + break; + case GT: + match = (ospeed > mapp->speed); + break; + case LE: + match = (ospeed <= mapp->speed); + break; + case LT: + match = (ospeed < mapp->speed); + break; + default: + match = FALSE; + } + if (match) + return (mapp->type); + } + /* No match found; return given type. */ + return (type); +} + +/************************************************************************** + * + * Entry fetching + * + **************************************************************************/ + +/* + * Figure out what kind of terminal we're dealing with, and then read in + * its termcap entry. + */ +static const char * +get_termcap_entry(char *userarg) +{ + int rval, errret; + char *p; + const char *ttype; +#if HAVE_GETTTYNAM + struct ttyent *t; + char *ttypath; +#endif + + if (userarg) { + ttype = userarg; + goto found; + } + + /* Try the environment. */ + if ((ttype = getenv("TERM")) != 0) + goto map; + +#if HAVE_GETTTYNAM + /* + * We have the 4.3BSD library call getttynam(3); that means + * there's an /etc/ttys to look up device-to-type mappings in. + * Try ttyname(3); check for dialup or other mapping. + */ + if ((ttypath = ttyname(STDERR_FILENO)) != 0) { + if ((p = strrchr(ttypath, '/')) != 0) + ++p; + else + p = ttypath; + if ((t = getttynam(p))) { + ttype = t->ty_type; + goto map; + } + } +#endif /* BSD */ + + /* If still undefined, use "unknown". */ + ttype = "unknown"; + +map: ttype = mapped(ttype); + + /* + * If not a path, remove TERMCAP from the environment so we get a + * real entry from /etc/termcap. This prevents us from being fooled + * by out of date stuff in the environment. + */ +found: if ((p = getenv("TERMCAP")) != 0 && *p != '/') { + /* 'unsetenv("TERMCAP")' is not portable. + * The 'environ' array is better. + */ + int n; + for (n = 0; environ[n] != 0; n++) { + if (!strncmp("TERMCAP=", environ[n], 8)) { + while ((environ[n] = environ[n+1]) != 0) { + n++; + } + break; + } + } + } + + /* + * ttype now contains a pointer to the type of the terminal. + * If the first character is '?', ask the user. + */ + if (ttype[0] == '?') + if (ttype[1] != '\0') + ttype = askuser(ttype + 1); + else + ttype = askuser(0); + + /* Find the terminfo entry. If it doesn't exist, ask the user. */ + while ((rval = setupterm(ttype, STDOUT_FILENO, &errret)) != OK) { + if (errret == 0) { + (void)fprintf(stderr, "tset: unknown terminal type %s\n", + ttype); + ttype = 0; + } + else { + (void)fprintf(stderr, "tset: can't initialize terminal\ + type %s (error %d)\n", ttype, errret); + ttype = 0; + } + ttype = askuser(ttype); + } +#if BROKEN_LINKER + tgetflag("am"); /* force lib_termcap.o to be linked for 'ospeed' */ +#endif + return (ttype); +} + +/************************************************************************** + * + * Mode-setting logic + * + **************************************************************************/ + +/* some BSD systems have these built in, some systems are missing + * one or more definitions. The safest solution is to override. + */ +#undef CEOF +#undef CERASE +#undef CINTR +#undef CKILL +#undef CQUIT +#undef CSTART +#undef CSTOP +#undef CSUSP + +/* control-character defaults */ +#define CEOF CTRL('D') +#define CERASE CTRL('H') +#define CINTR 127 /* ^? */ +#define CKILL CTRL('U') +#if defined(CLNEXT) +#undef CLNEXT +#define CLNEXT CTRL('v') +#endif +#if defined(CRPRNT) +#undef CRPRNT +#define CRPRNT CTRL('r') +#endif +#define CQUIT CTRL('\\') +#define CSTART CTRL('Q') +#define CSTOP CTRL('S') +#define CSUSP CTRL('Z') + +#define CHK(val, dft) ((int)val <= 0 ? dft : val) + +static bool set_tabs (void); + +/* + * Reset the terminal mode bits to a sensible state. Very useful after + * a child program dies in raw mode. + */ +static void +reset_mode(void) +{ +#ifdef TERMIOS + tcgetattr(STDERR_FILENO, &mode); +#else + stty(STDERR_FILENO,&mode); +#endif + +#ifdef TERMIOS +#if defined(VDISCARD) && defined(CDISCARD) + mode.c_cc[VDISCARD] = CHK(mode.c_cc[VDISCARD], CDISCARD); +#endif + mode.c_cc[VEOF] = CHK(mode.c_cc[VEOF], CEOF); + mode.c_cc[VERASE] = CHK(mode.c_cc[VERASE], CERASE); +#if defined(VFLUSH) && defined(CFLUSH) + mode.c_cc[VFLUSH] = CHK(mode.c_cc[VFLUSH], CFLUSH); +#endif + mode.c_cc[VINTR] = CHK(mode.c_cc[VINTR], CINTR); + mode.c_cc[VKILL] = CHK(mode.c_cc[VKILL], CKILL); +#if defined(VLNEXT) && defined(CLNEXT) + mode.c_cc[VLNEXT] = CHK(mode.c_cc[VLNEXT], CLNEXT); +#endif + mode.c_cc[VQUIT] = CHK(mode.c_cc[VQUIT], CQUIT); +#if defined(VREPRINT) && defined(CRPRNT) + mode.c_cc[VREPRINT] = CHK(mode.c_cc[VREPRINT], CRPRNT); +#endif +#if defined(VSTART) && defined(CSTART) + mode.c_cc[VSTART] = CHK(mode.c_cc[VSTART], CSTART); +#endif +#if defined(VSTOP) && defined(CSTOP) + mode.c_cc[VSTOP] = CHK(mode.c_cc[VSTOP], CSTOP); +#endif +#if defined(VSUSP) && defined(CSUSP) + mode.c_cc[VSUSP] = CHK(mode.c_cc[VSUSP], CSUSP); +#endif +#if defined(VWERASE) && defined(CWERASE) + mode.c_cc[VWERASE] = CHK(mode.c_cc[VWERASE], CWERASE); +#endif + + mode.c_iflag &= ~(IGNBRK | PARMRK | INPCK | ISTRIP | INLCR | IGNCR +#ifdef IUCLC + | IUCLC +#endif +#ifdef IXANY + | IXANY +#endif + | IXOFF); + + mode.c_iflag |= (BRKINT | IGNPAR | ICRNL | IXON +#ifdef IMAXBEL + | IMAXBEL +#endif + ); + + mode.c_oflag &= ~(0 +#ifdef OLCUC + | OLCUC +#endif +#ifdef OCRNL + | OCRNL +#endif +#ifdef ONOCR + | ONOCR +#endif +#ifdef ONLRET + | ONLRET +#endif +#ifdef OFILL + | OFILL +#endif +#ifdef OFDEL + | OFDEL +#endif +#ifdef NLDLY + | NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY +#endif + ); + + mode.c_oflag |= (OPOST +#ifdef ONLCR + | ONLCR +#endif + ); + + mode.c_cflag &= ~(CSIZE | CSTOPB | PARENB | PARODD | CLOCAL); + mode.c_cflag |= (CS8 | CREAD); + mode.c_lflag &= ~(ECHONL | NOFLSH +#ifdef TOSTOP + | TOSTOP +#endif +#ifdef ECHOPTR + | ECHOPRT +#endif +#ifdef XCASE + | XCASE +#endif + ); + + mode.c_lflag |= (ISIG | ICANON | ECHO | ECHOE | ECHOK +#ifdef ECHOCTL + | ECHOCTL +#endif +#ifdef ECHOKE + | ECHOKE +#endif + ); +#endif + +#ifdef TERMIOS + tcsetattr(STDERR_FILENO, TCSADRAIN, &mode); +#else + stty(STDERR_FILENO, &mode); +#endif +} + +/* + * Determine the erase, interrupt, and kill characters from the termcap + * entry and command line and update their values in 'mode'. + */ +static void +set_control_chars(void) +{ +#ifdef __OBSOLETE__ + /* + * 4.4BSD logic for setting erasechar, left here in case there is some + * necessary subtlety missed in the production code below that really + * needs to be added someday (in particular, I don't understand what + * the second if-statement involving the os flag is doing, and it makes + * my head hurt when I try and follow out all the combinations). + */ + char *bp, *p, bs_char, buf[1024]; + + bp = buf; + p = tgetstr("kb", &bp); + if (p == 0 || p[1] != '\0') + p = tgetstr("bc", &bp); + if (p != 0 && p[1] == '\0') + bs_char = p[0]; + else if (tgetflag("bs")) + bs_char = CTRL('h'); + else + bs_char = 0; + + if (terasechar==0 && !tgetflag("os") && mode.c_cc[VERASE] != CERASE) { + if (tgetflag("bs") || bs_char != 0) + terasechar = -1; + } + if (terasechar < 0) + terasechar = (bs_char != 0) ? bs_char : CTRL('h'); +#else + /* the real erasechar logic used now */ + char bs_char = 0; + + if (key_backspace != (char *)0) + bs_char = key_backspace[0]; + + if (terasechar <= 0) + terasechar = (bs_char != 0) ? bs_char : CTRL('h'); +#endif /* __OBSOLETE__ */ + +#ifdef TERMIOS + if (mode.c_cc[VERASE] == 0 || terasechar != 0) + mode.c_cc[VERASE] = terasechar ? terasechar : CERASE; + + if (mode.c_cc[VINTR] == 0 || intrchar != 0) + mode.c_cc[VINTR] = intrchar ? intrchar : CINTR; + + if (mode.c_cc[VKILL] == 0 || tkillchar != 0) + mode.c_cc[VKILL] = tkillchar ? tkillchar : CKILL; +#endif +} + +/* + * Set up various conversions in 'mode', including parity, tabs, returns, + * echo, and case, according to the termcap entry. If the program we're + * running was named with a leading upper-case character, map external + * uppercase to internal lowercase. + */ +static void +set_conversions(void) +{ +#ifdef __OBSOLETE__ + /* + * Conversion logic for some *really* ancient terminal glitches, + * not supported in terminfo. Left here for succeeding generations + * to marvel at. + */ + if (tgetflag("UC")) { +#ifdef IUCLC + mode.c_iflag |= IUCLC; + mode.c_oflag |= OLCUC; +#endif + } else if (tgetflag("LC")) { +#ifdef IUCLC + mode.c_iflag &= ~IUCLC; + mode.c_oflag &= ~OLCUC; +#endif + } + mode.c_iflag &= ~(PARMRK | INPCK); + mode.c_lflag |= ICANON; + if (tgetflag("EP")) { + mode.c_cflag |= PARENB; + mode.c_cflag &= ~PARODD; + } + if (tgetflag("OP")) { + mode.c_cflag |= PARENB; + mode.c_cflag |= PARODD; + } +#endif /* __OBSOLETE__ */ + +#ifdef TERMIOS +#ifdef ONLCR + mode.c_oflag |= ONLCR; +#endif + mode.c_iflag |= ICRNL; + mode.c_lflag |= ECHO; +#ifdef OXTABS + mode.c_oflag |= OXTABS; +#endif /* OXTABS */ + + /* test used to be tgetflag("NL") */ + if (newline != (char *)0 && newline[0] == '\n' && !newline[1]) { + /* Newline, not linefeed. */ +#ifdef ONLCR + mode.c_oflag &= ~ONLCR; +#endif + mode.c_iflag &= ~ICRNL; + } +#ifdef __OBSOLETE__ + if (tgetflag("HD")) /* Half duplex. */ + mode.c_lflag &= ~ECHO; +#endif /* __OBSOLETE__ */ +#ifdef OXTABS + /* test used to be tgetflag("pt") */ + if (has_hardware_tabs) /* Print tabs. */ + mode.c_oflag &= ~OXTABS; +#endif /* OXTABS */ + mode.c_lflag |= (ECHOE | ECHOK); +#endif +} + +/* Output startup string. */ +static void +set_init(void) +{ + char *p; + bool settle; + +#ifdef __OBSOLETE__ + if (pad_char != (char *)0) /* Get/set pad character. */ + PC = pad_char[0]; +#endif /* OBSOLETE */ + +#ifdef TAB3 + if (oldmode.c_oflag & (TAB3 | ONLCR | OCRNL | ONLRET)) { + oldmode.c_oflag &= (TAB3 | ONLCR | OCRNL | ONLRET); + tcsetattr(STDERR_FILENO, TCSADRAIN, &oldmode); + } +#endif + settle = set_tabs(); + + if (isreset) { + if ((p = reset_1string) != 0) { + tputs(p, 0, outc); + settle = TRUE; + } + if ((p = reset_2string) != 0) { + tputs(p, 0, outc); + settle = TRUE; + } + /* What about rf, rs3, as per terminfo man page? */ + /* also might be nice to send rmacs, rmul, rmm */ + if ((p = reset_file) != 0 + || (p = init_file) != 0) { + cat(p); + settle = TRUE; + } + } + + if (settle) { + (void)putc('\r', stderr); + (void)fflush(stderr); + (void)sleep(1); /* Settle the terminal. */ + } +} + +/* + * Set the hardware tabs on the terminal, using the ct (clear all tabs), + * st (set one tab) and ch (horizontal cursor addressing) capabilities. + * This is done before if and is, so they can patch in case we blow this. + * Return TRUE if we set any tab stops, FALSE if not. + */ +static bool +set_tabs() +{ + if (set_tab && clear_all_tabs) { + int c; + + (void)putc('\r', stderr); /* Force to left margin. */ + tputs(clear_all_tabs, 0, outc); + + for (c = 8; c < tcolumns; c += 8) { + /* Get to the right column. In BSD tset, this + * used to try a bunch of half-clever things + * with cup and hpa, for an average saving of + * somewhat less than two character times per + * tab stop, less that .01 sec at 2400cps. We + * lost all this cruft because it seemed to be + * introducing some odd bugs. + * ----------12345678----------- */ + (void)fputs(" ", stderr); + tputs(set_tab, 0, outc); + } + putc('\r', stderr); + return (TRUE); + } + return (FALSE); +} + +/************************************************************************** + * + * Main sequence + * + **************************************************************************/ + +/* + * Tell the user if a control key has been changed from the default value. + */ +static void +report(const char *name, int which, u_int def) +{ +#ifdef TERMIOS + u_int old, new; + char *p; + + new = mode.c_cc[which]; + old = oldmode.c_cc[which]; + + if (old == new && old == def) + return; + + (void)fprintf(stderr, "%s %s ", name, old == new ? "is" : "set to"); + + if ((p = key_backspace) != 0 + && new == (u_int)p[0] + && p[1] == '\0') + (void)fprintf(stderr, "backspace.\n"); + else if (new == 0177) + (void)fprintf(stderr, "delete.\n"); + else if (new < 040) { + new ^= 0100; + (void)fprintf(stderr, "control-%c (^%c).\n", new, new); + } else + (void)fprintf(stderr, "%c.\n", new); +#endif +} + +/* + * Convert the obsolete argument forms into something that getopt can handle. + * This means that -e, -i and -k get default arguments supplied for them. + */ +static void +obsolete(char **argv) +{ + for (; *argv; ++argv) { + char *parm = argv[0]; + + if (parm[0] == '-' && parm[1] == '\0') + { + argv[0] = strdup("-q"); + continue; + } + + if ((parm[0] != '-') + || (argv[1] && argv[1][0] != '-') + || (parm[1] != 'e' && parm[1] != 'i' && parm[1] != 'k') + || (parm[2] != '\0')) + continue; + switch(argv[0][1]) { + case 'e': + argv[0] = strdup("-e^H"); + break; + case 'i': + argv[0] = strdup("-i^C"); + break; + case 'k': + argv[0] = strdup("-k^U"); + break; + } + } +} + +static void +usage(const char* pname) +{ + (void)fprintf(stderr, +"usage: %s [-IQrs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]\n", pname); + exit(EXIT_FAILURE); +} + +int +main(int argc, char **argv) +{ +#ifdef TIOCGWINSZ + struct winsize win; +#endif + int ch, noinit, noset, quiet, Sflag, sflag, showterm; + const char *p; + const char *ttype; + +#ifdef TERMIOS + if (tcgetattr(STDERR_FILENO, &mode) < 0) + failed("standard error"); + + oldmode = mode; + ospeed = cfgetospeed(&mode); +#else + if (gtty(STDERR_FILENO, &mode) < 0) + failed("standard error"); + + oldmode = mode; + ospeed = mode.sg_ospeed; +#endif + + if ((p = strrchr(*argv, '/')) != 0) + ++p; + else + p = *argv; + if (!CaselessCmp(p, "reset")) { + isreset = 1; + reset_mode(); + } + + obsolete(argv); + noinit = noset = quiet = Sflag = sflag = showterm = 0; + while ((ch = getopt(argc, argv, "a:d:e:Ii:k:m:np:qQSrs")) != EOF) { + switch (ch) { + case 'q': /* display term only */ + noset = 1; + break; + case 'a': /* OBSOLETE: map identifier to type */ + add_mapping("arpanet", optarg); + break; + case 'd': /* OBSOLETE: map identifier to type */ + add_mapping("dialup", optarg); + break; + case 'e': /* erase character */ + terasechar = optarg[0] == '^' && optarg[1] != '\0' ? + optarg[1] == '?' ? '\177' : CTRL(optarg[1]) : + optarg[0]; + break; + case 'I': /* no initialization strings */ + noinit = 1; + break; + case 'i': /* interrupt character */ + intrchar = optarg[0] == '^' && optarg[1] != '\0' ? + optarg[1] == '?' ? '\177' : CTRL(optarg[1]) : + optarg[0]; + break; + case 'k': /* kill character */ + tkillchar = optarg[0] == '^' && optarg[1] != '\0' ? + optarg[1] == '?' ? '\177' : CTRL(optarg[1]) : + optarg[0]; + break; + case 'm': /* map identifier to type */ + add_mapping(0, optarg); + break; + case 'n': /* OBSOLETE: set new tty driver */ + break; + case 'p': /* OBSOLETE: map identifier to type */ + add_mapping("plugboard", optarg); + break; + case 'Q': /* don't output control key settings */ + quiet = 1; + break; + case 'S': /* OBSOLETE: output TERM & TERMCAP */ + Sflag = 1; + break; + case 'r': /* display term on stderr */ + showterm = 1; + break; + case 's': /* output TERM set command */ + sflag = 1; + break; + case '?': + default: + usage(*argv); + } + } + argc -= optind; + argv += optind; + + if (argc > 1) + usage(*argv); + + ttype = get_termcap_entry(*argv); + + if (!noset) { + tcolumns = columns; + tlines = lines; + +#ifdef TIOCGWINSZ + /* Set window size */ + (void)ioctl(STDERR_FILENO, TIOCGWINSZ, &win); + if (win.ws_row == 0 && win.ws_col == 0 && + tlines > 0 && tcolumns > 0) { + win.ws_row = tlines; + win.ws_col = tcolumns; + (void)ioctl(STDERR_FILENO, TIOCSWINSZ, &win); + } +#endif + set_control_chars(); + set_conversions(); + + if (!noinit) + set_init(); + + /* Set the modes if they've changed. */ + if (memcmp(&mode, &oldmode, sizeof(mode))) +#ifdef TERMIOS + tcsetattr(STDERR_FILENO, TCSADRAIN, &mode); +#else + stty(STDERR_FILENO, &mode); +#endif + } + + /* Get the terminal name from the entry. */ + ttype = _nc_first_name(cur_term->type.term_names); + + if (noset) + (void)printf("%s\n", ttype); + else { + if (showterm) + (void)fprintf(stderr, "Terminal type is %s.\n", ttype); + /* + * If erase, kill and interrupt characters could have been + * modified and not -Q, display the changes. + */ + if (!quiet) { + report("Erase", VERASE, CERASE); + report("Kill", VKILL, CINTR); + report("Interrupt", VINTR, CKILL); + } + } + + if (Sflag) + err("The -S option is not supported under terminfo."); + + if (sflag) { + /* + * Figure out what shell we're using. A hack, we look for an + * environmental variable SHELL ending in "csh". + */ + if ((p = getenv("SHELL")) != 0 + && !strcmp(p + strlen(p) - 3, "csh")) + p = "set noglob;\nsetenv TERM %s;\nunset noglob;\n"; + else + p = "TERM=%s;\n"; + (void) printf(p, ttype); + } + + return EXIT_SUCCESS; +} + +/* tset.c ends here */ diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile new file mode 100644 index 00000000..9489c19f --- /dev/null +++ b/sysdeps/unix/sysv/linux/Makefile @@ -0,0 +1,10 @@ +ifeq ($(subdir),ncurses) + +CPPFLAGS += -DNDEBUG -DHAVE_CONFIG_H + +edit_man-sed = sysdeps/unix/sysv/linux/edit_man.sed +edit_man-sh = sysdeps/unix/sysv/linux/edit_man.sh + +run_tic-sh = sysdeps/unix/sysv/linux/run_tic.sh + +endif diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure new file mode 100644 index 00000000..87f91bf5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/configure @@ -0,0 +1,273 @@ +# Local configure fragment for ncurses/sysdeps/unix/sysv/linux. + +glibc_nc_srcdir=${srcdir}/ncurses + +NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[ ]*=' $glibc_nc_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" +NCURSES_MINOR="`egrep '^NCURSES_MINOR[ ]*=' $glibc_nc_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" +NCURSES_PATCH="`egrep '^NCURSES_PATCH[ ]*=' $glibc_nc_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`" +nc_cv_abi_version=${NCURSES_MAJOR} +nc_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} + +rm -f ncurses/codes.c \ + ncurses/comp_captab.c \ + ncurses/curses.h \ + ncurses/edit_man.sed \ + ncurses/edit_man.sh \ + ncurses/eti.h \ + ncurses/expanded.c \ + ncurses/fallback.c \ + ncurses/form.h \ + ncurses/hashsize.h \ + ncurses/keys.tries \ + ncurses/lib_gen.c \ + ncurses/lib_keyname.c \ + ncurses/menu.h \ + ncurses/mf_common.h \ + ncurses/names.c \ + ncurses/ncurses_cfg.h \ + ncurses/nomacros.h \ + ncurses/panel.h \ + ncurses/parametrized.h \ + ncurses/run_tic.sh \ + ncurses/term.h \ + ncurses/termcap.h \ + ncurses/terminfo.5 \ + ncurses/termsort.c \ + ncurses/unctrl.c \ + ncurses/unctrl.h \ + ncurses/config_h + +# 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 < conftest.s$nc_file + else + sed "${nc_end}q" conftest.subs > conftest.s$nc_file + fi + if test ! -s conftest.s$nc_file; then + nc_more_lines=false + rm -f conftest.s$nc_file + else + if test -z "$nc_sed_cmds"; then + nc_sed_cmds="sed -f conftest.s$nc_file" + else + nc_sed_cmds="$nc_sed_cmds | sed -f conftest.s$nc_file" + fi + nc_file=`expr $nc_file + 1` + nc_beg=$nc_end + nc_end=`expr $nc_end + $nc_max_sed_cmds` + fi +done +if test -z "$nc_sed_cmds"; then + nc_sed_cmds=cat +fi + +NC_CONFIG_FILES=${NC_CONFIG_FILES-"ncurses/config_h ncurses/MKterm.h.awk ncurses/curses.h ncurses/termcap.h ncurses/unctrl.h"} +for nc_file in .. $NC_CONFIG_FILES; do if test "x$nc_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$nc_file" in + *:*) nc_file_in=`echo "$nc_file"|sed 's%[^:]*:%%'` + nc_file=`echo "$nc_file"|sed 's%:.*%%'` ;; + *) nc_file_in=`echo "${nc_file}"| sed 's%ncurses%include%'`.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. + nc_dir=`echo $nc_file|sed 's%/[^/][^/]*$%%'` + if test "$nc_dir" != "$nc_file" && test "$nc_dir" != .; then + # The file is in a subdirectory. + test ! -d "$nc_dir" && mkdir "$nc_dir" + nc_dir_suffix="/`echo $nc_dir|sed 's%^\./%%'`" + # A "../" for each directory in $nc_dir_suffix. + nc_dots=`echo $nc_dir_suffix|sed 's%/[^/]*%../%g'` + else + nc_dir_suffix= nc_dots= + fi + + echo creating "$nc_file" + rm -f "$nc_file" + configure_input="Generated automatically from `echo $nc_file_in|sed 's%.*/%%'` by configure." + case "$nc_file" in + *Makefile*) nc_comsub="1i\\ +# $configure_input" ;; + *) nc_comsub= ;; + esac + + nc_file_inputs=`echo $nc_file_in|sed -e "s%^%$glibc_nc_srcdir/%" -e "s%:% $glibc_nc_srcdir/%g"` + sed -e "$nc_comsub +s%@configure_input@%$configure_input%g +" $nc_file_inputs | (eval "$nc_sed_cmds") > $nc_file +fi; done +rm -f conftest.s* + + +SYS_NAME=`uname -a` +if test -z "$SYS_NAME"; then SYS_NAME=unknown;fi + +AWK=awk +CC="gcc -I${glibc_nc_srcdir}/ncurses -Incurses -I${glibc_nc_srcdir}/include" +CPP="${CC} -E" +NC_LIST_MODELS="normal" +WITH_ECHO="yes" +WITH_OVERWRITE="yes" +nc_cxx_library="yes" +nc_cv_systype="Linux" +nc_cv_rel_version="4.1" +nc_cv_abi_version="4" +nc_cv_do_symlinks="yes" +nc_cv_rm_so_locs="no" + + + + + + + + +rm -f headers.sed headers.sh + +echo creating headers.sh +cat >headers.sh </<\$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 +NC_EOF + +chmod 0755 headers.sh + +### Special editing. We generate ncurses_cfg.h directly to allow all filenames +### to be MSDOS-compatible, as well as to make the list of definitions be +### dynamically determined by the configuration script -- a consideration when +### doing type-clean development testing. + +echo creating ncurses/ncurses_cfg.h +rm -f ncurses/ncurses_cfg.h +echo "/* generated by configure-script + * On host: $SYS_NAME + */ +#ifndef NC_CONFIG_H +#define NC_CONFIG_H" >ncurses/ncurses_cfg.h +sed -e '/^ -D/!d' \ + -e 's/ -D/\ +#define /g' \ + -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \ + -e 's/\\//g' \ + ncurses/config_h | sort >>ncurses/ncurses_cfg.h +echo " + /* 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 */" >> ncurses/ncurses_cfg.h +echo removing ncurses/config_h +rm ncurses/config_h + +echo creating ncurses/term.h +${AWK} -f ncurses/MKterm.h.awk ${glibc_nc_srcdir}/include/Caps > ncurses/term.h +sh ${glibc_nc_srcdir}/include/edit_cfg.sh ncurses/ncurses_cfg.h ncurses/term.h + +echo creating ncurses/hashsize.h +sh ${glibc_nc_srcdir}/include/MKhashsize.sh ${glibc_nc_srcdir}/include/Caps > ncurses/hashsize.h + +echo creating ncurses/parametrized.h +sh ${glibc_nc_srcdir}/include/MKparametrized.sh ${glibc_nc_srcdir}/include/Caps > ncurses/parametrized.h + +echo creating ncurses/termsort.c +sh ${glibc_nc_srcdir}/progs/MKtermsort.sh "${AWK}" ${glibc_nc_srcdir}/include/Caps > ncurses/termsort.c + +echo creating ncurses/fallback.c +sh ${glibc_nc_srcdir}/ncurses/MKfallback.sh > ncurses/fallback.c + +echo creating ncurses/lib_gen.c +sh ${glibc_nc_srcdir}/ncurses/MKlib_gen.sh "${CPP}" "${AWK}" < ncurses/curses.h > ncurses/lib_gen.c + +echo creating ncurses/nomacros.h +sh ${glibc_nc_srcdir}/ncurses/MKlib_gen.sh "${CPP}" "${AWK}" < ncurses/curses.h | fgrep undef > ncurses/nomacros.h + +echo creating ncurses/keys.tries +${AWK} -f ${glibc_nc_srcdir}/ncurses/MKkeys.awk ${glibc_nc_srcdir}/ncurses/keys.list > ncurses/keys.tries + +echo creating ncurses/expanded.c +sh ${glibc_nc_srcdir}/ncurses/MKexpanded.sh "${CPP}" +mv expanded.c ncurses/expanded.c + +echo creating ncurses/comp_captab.c +${CC} -o make_hash -DMAIN_PROGRAM ${glibc_nc_srcdir}/ncurses/comp_hash.c +sh ${glibc_nc_srcdir}/ncurses/MKcaptab.awk "${AWK}" ${glibc_nc_srcdir}/include/Caps > ncurses/comp_captab.c +rm -f make_hash + +echo creating ncurses/lib_keyname.c +${AWK} -f ${glibc_nc_srcdir}/ncurses/MKkeyname.awk ${glibc_nc_srcdir}/ncurses/keys.list > ncurses/lib_keyname.c + +echo creating ncurses/names.c and ncurses/codes.c +${AWK} -f ${glibc_nc_srcdir}/ncurses/MKnames.awk ${glibc_nc_srcdir}/include/Caps +cat namehdr boolnames boolfnames numnames numfnames strnames strfnames nameftr >ncurses/names.c +cat namehdr boolcodes numcodes strcodes codeftr > ncurses/codes.c +rm -f namehdr nameftr codeftr boolnames boolfnames boolcodes numnames numfnames numcodes strnames strfnames strcodes + +echo creating ncurses/unctrl.c +echo | ${AWK} -f ${glibc_nc_srcdir}/ncurses/MKunctrl.awk > ncurses/unctrl.c +echo creating ncurses/terminfo.5 +sh ${glibc_nc_srcdir}/man/MKterminfo.sh ${glibc_nc_srcdir}/man/terminfo.head ${glibc_nc_srcdir}/include/Caps ${glibc_nc_srcdir}/man/terminfo.tail > ncurses/terminfo.5 diff --git a/sysdeps/unix/sysv/linux/edit_man.sed b/sysdeps/unix/sysv/linux/edit_man.sed new file mode 100644 index 00000000..163eb7b2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/edit_man.sed @@ -0,0 +1,100 @@ +s/captoinfo\.1m/captoinfo.1m/g +s/clear\.1/clear.1m/g +s/curs_addch\.3x/addch.3ncurses/g +s/curs_addchstr\.3x/addchstr.3ncurses/g +s/curs_addstr\.3x/addstr.3ncurses/g +s/curs_attr\.3x/attr.3ncurses/g +s/curs_beep\.3x/beep.3ncurses/g +s/curs_bkgd\.3x/bkgd.3ncurses/g +s/curs_border\.3x/border.3ncurses/g +s/curs_clear\.3x/clear.3ncurses/g +s/curs_color\.3x/color.3ncurses/g +s/curs_delch\.3x/delch.3ncurses/g +s/curs_deleteln\.3x/deleteln.3ncurses/g +s/curs_getch\.3x/getch.3ncurses/g +s/curs_getstr\.3x/getstr.3ncurses/g +s/curs_getyx\.3x/getyx.3ncurses/g +s/curs_inch\.3x/inch.3ncurses/g +s/curs_inchstr\.3x/inchstr.3ncurses/g +s/curs_initscr\.3x/initscr.3ncurses/g +s/curs_inopts\.3x/inopts.3ncurses/g +s/curs_insch\.3x/insch.3ncurses/g +s/curs_insstr\.3x/insstr.3ncurses/g +s/curs_instr\.3x/instr.3ncurses/g +s/curs_kernel\.3x/kernel.3ncurses/g +s/curs_mouse\.3x/mouse.3ncurses/g +s/curs_move\.3x/move.3ncurses/g +s/curs_outopts\.3x/outopts.3ncurses/g +s/curs_overlay\.3x/overlay.3ncurses/g +s/curs_pad\.3x/pad.3ncurses/g +s/curs_print\.3x/print.3ncurses/g +s/curs_printw\.3x/printw.3ncurses/g +s/curs_refresh\.3x/refresh.3ncurses/g +s/curs_scanw\.3x/scanw.3ncurses/g +s/curs_scr_dmp\.3x/scr_dmp.3ncurses/g +s/curs_scroll\.3x/scroll.3ncurses/g +s/curs_slk\.3x/slk.3ncurses/g +s/curs_termattrs\.3x/termattrs.3ncurses/g +s/curs_termcap\.3x/termcap.3ncurses/g +s/curs_terminfo\.3x/terminfo.3ncurses/g +s/curs_touch\.3x/touch.3ncurses/g +s/curs_util\.3x/util.3ncurses/g +s/curs_window\.3x/window.3ncurses/g +s/form\.3x/form.3form/g +s/form_cursor\.3x/cursor.3form/g +s/form_data\.3x/data.3form/g +s/form_driver\.3x/driver.3form/g +s/form_field\.3x/field.3form/g +s/form_field_attributes\.3x/field_attributes.3form/g +s/form_field_buffer\.3x/field_buffer.3form/g +s/form_field_info\.3x/field_info.3form/g +s/form_field_just\.3x/field_just.3form/g +s/form_field_new\.3x/field_new.3form/g +s/form_field_opts\.3x/field_opts.3form/g +s/form_field_userptr\.3x/field_userptr.3form/g +s/form_field_validation\.3x/field_validation.3form/g +s/form_fieldtype\.3x/fieldtype.3form/g +s/form_hook\.3x/hook.3form/g +s/form_new\.3x/new.3form/g +s/form_new_page\.3x/new_page.3form/g +s/form_opts\.3x/opts.3form/g +s/form_page\.3x/page.3form/g +s/form_post\.3x/post.3form/g +s/form_requestname\.3x/requestname.3form/g +s/form_userptr\.3x/userptr.3form/g +s/form_win\.3x/win.3form/g +s/infocmp\.1m/infocmp.1m/g +s/menu\.3x/menu.3menu/g +s/menu_attribs\.3x/attribs.3menu/g +s/menu_cursor\.3x/cursor.3menu/g +s/menu_driver\.3x/driver.3menu/g +s/menu_format\.3x/format.3menu/g +s/menu_hook\.3x/hook.3menu/g +s/menu_items\.3x/items.3menu/g +s/menu_mark\.3x/mark.3menu/g +s/menu_new\.3x/new.3menu/g +s/menu_opts\.3x/opts.3menu/g +s/menu_pattern\.3x/pattern.3menu/g +s/menu_post\.3x/post.3menu/g +s/menu_requestname\.3x/requestname.3menu/g +s/menu_spacing\.3x/spacing.3menu/g +s/menu_userptr\.3x/userptr.3menu/g +s/menu_win\.3x/win.3menu/g +s/mitem_current\.3x/menu_current.3menu/g +s/mitem_name\.3x/menu_name.3menu/g +s/mitem_new\.3x/menu_new.3menu/g +s/mitem_opts\.3x/menu_opts.3menu/g +s/mitem_userptr\.3x/menu_userptr.3menu/g +s/mitem_value\.3x/menu_value.3menu/g +s/mitem_visible\.3x/menu_visible.3menu/g +s/ncurses\.3x/ncurses.3ncurses/g +s/panel\.3x/panel.3curses/g +s/resizeterm\.3x/resizeterm.3ncurses/g +s/term\.5/term.5/g +s/term\.7/term.7/g +s/terminfo\.5/terminfo.5/g +s/tic\.1m/tic.1m/g +s/toe\.1m/toe.1m/g +s/tput\.1/tput.1/g +s/tset\.1/tset.1/g +s/wresize\.3x/wresize.3ncurses/g diff --git a/sysdeps/unix/sysv/linux/edit_man.sh b/sysdeps/unix/sysv/linux/edit_man.sh new file mode 100644 index 00000000..4488fad7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/edit_man.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# this script is generated by the configure-script +prefix=$1 +shift +mandir=$1 +shift +edit_man_sed=$1 +shift + +datadir="${prefix}/share" +MKDIRS="mkinstalldirs" +INSTALL="/usr/bin/install -c" +INSTALL_DATA="${INSTALL} -m 644" +TMP=${TMPDIR-/tmp}/man$$ +trap "rm -f $TMP" 0 1 2 5 15 + +for i in $* +do +case $i in +*.[0-9]*) + section=`expr "$i" : '.*\.\([0-9]\)[xm]*'`; + if [ ! -d $mandir/man${section} ]; then + $MKDIRS $mandir/man$section + fi + source=`basename $i` + target=`grep "^$source" man/man_db.renames | mawk '{print $2}'` + if test -z "$target" ; then + echo '? missing rename for '$source + target="$source" + fi + target="$mandir/man$section/$target" + sed -e 's,@DATADIR@,$datadir,' < $i | sed -f ${edit_man_sed} >$TMP + echo installing $target + $INSTALL_DATA $TMP $target + ;; +esac +done diff --git a/sysdeps/unix/sysv/linux/run_tic.sh b/sysdeps/unix/sysv/linux/run_tic.sh new file mode 100755 index 00000000..12b16feb --- /dev/null +++ b/sysdeps/unix/sysv/linux/run_tic.sh @@ -0,0 +1,132 @@ +#!/bin/sh +################################################################################ +# Copyright 1996 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# $Id: run_tic.sh,v 1.8 1997/05/09 10:43:29 hjl Exp $ +# This script is used to install terminfo.src using tic. We use a script +# because the path checking is too awkward to do in a makefile. +# +# Parameters: +# $1 = the common object directory. +# $2 = source-directory, i.e., $(srcdir) +# $3 = destination-directory path, i.e., $(ticdir) +# $4 = install-prefix, if any +# +# Assumes: +# The leaf directory names (bin, lib, shared, tabset, terminfo) +# +echo '** Building terminfo database, please wait...' +# +# Parameter parsing is primarily for debugging. The script is designed to +# be run from the misc/Makefile as +# make install.data + +prefix=/usr +if test $# != 0 ; then + common_objpfx=$1 + shift +fi + +if test $# != 0 ; then + srcdir=$1 + shift +else + srcdir=. +fi + +if test $# != 0 ; then + ticdir=$1 + shift +else + ticdir=$prefix/share/terminfo +fi + +if test $# != 0 ; then + IP=$1 + shift +else + IP="" +fi + +TERMINFO=$IP$ticdir ; export TERMINFO +umask 022 + +# Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo. +TICDIR=`echo $TERMINFO | sed -e 's/\/share\//\/lib\//'` + +# Remove the old terminfo stuff; we don't care if it existed before, and it +# would generate a lot of confusing error messages if we tried to overwrite it. +# We explicitly remove its contents rather than the directory itself, in case +# the directory is actually a symbolic link. +( rm -fr $TERMINFO/[0-9A-Za-z] 2>/dev/null ) + +# If we're not installing into /usr/share/, we'll have to adjust the location +# of the tabset files in terminfo.src (which are in a parallel directory). +TABSET=`echo $ticdir | sed -e 's/\/terminfo$/\/tabset/'` +SRC=$srcdir/terminfo.src +if test "x$TABSET" != "x/usr/share/tabset" ; then + echo '** adjusting tabset paths' + TMP=${TMPDIR-/tmp}/$$ + sed -e s:/usr/share/tabset:$TABSET:g $SRC >$TMP + trap "rm -f $TMP" 0 1 2 5 15 + SRC=$TMP +fi + +LD_LIBRARY_PATH=$common_objpfx:$common_objpfx/nss:$common_objpfx/ncurses \ + $common_objpfx/elf/ld.so \ + $common_objpfx/ncurses/tic -s $SRC +if [ $? = 0 ] +then + echo '** built new '$TERMINFO +else + echo '? tic could not build '$TERMINFO + exit 1 +fi + +# Make a symbolic link to provide compatibility with applications that expect +# to find terminfo under /usr/lib. That is, we'll _try_ to do that. Not +# all systems support symbolic links, and those that do provide a variety +# of options for 'test'. +if test "$TICDIR" != "$TERMINFO" ; then + ( rm -f $TICDIR 2>/dev/null ) + if ( cd $TICDIR 2>/dev/null ) + then + cd $TICDIR + TICDIR=`pwd` + if test $TICDIR != $TERMINFO ; then + # Well, we tried. Some systems lie to us, so the + # installer will have to double-check. + echo "Verify if $TICDIR and $TERMINFO are the same." + echo "The new terminfo is in $TERMINFO; the other should be a link to it." + echo "Otherwise, remove $TICDIR and link it to $TERMINFO." + fi + else + cd $IP$prefix + # Construct a symbolic link that only assumes $ticdir has the + # same $prefix as the other installed directories. + RELATIVE=`echo $ticdir|sed -e 's:^'$prefix'/::'` + if test "$RELATIVE" != "$ticdir" ; then + RELATIVE=../`echo $ticdir|sed -e 's:^'$prefix'/::' -e 's:^/::'` + fi + if ( ln -s $RELATIVE $TICDIR ) + then + echo '** linked '$TICDIR' for compatibility' + fi + fi +fi diff --git a/test/Makefile.in b/test/Makefile.in new file mode 100644 index 00000000..87ead9c4 --- /dev/null +++ b/test/Makefile.in @@ -0,0 +1,133 @@ +# $Id: Makefile.in,v 1.29 1997/05/10 16:23:07 tom Exp $ +################################################################################ +# Copyright 1996,1997 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +# Makefile for ncurses tests. + +SHELL = /bin/sh + +MODEL = ../@DFT_OBJ_SUBDIR@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ + +CC = @CC@ + +CFLAGS = @CFLAGS@ +CPPFLAGS = -I../test -I$(srcdir) @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@) + +ABI_VERSION = @nc_cv_abi_version@ +LOCAL_LIBS = @TEST_DEPS@ + +LD = @LD@ +LINK = $(CC) + +LDFLAGS = @LD_MODEL@ @TEST_ARGS@ @LIBS@ @EXTRA_LIBS@ @LOCAL_LDFLAGS@ @LDFLAGS@ + +LDFLAGS_NORMAL = $(LDFLAGS) +LDFLAGS_DEBUG = $(LDFLAGS) @CC_G_OPT@ +LDFLAGS_PROFILE = $(LDFLAGS) -pg +LDFLAGS_SHARED = $(LDFLAGS) @CC_SHARED_OPTS@ + +LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) + +LINT = @LINT@ +LINT_OPTS = @LINT_OPTS@ +LINT_LIBS = -lform -lmenu -lpanel -lncurses @LIBS@ + +TESTS = \ + blue \ + bs \ + firework \ + gdc \ + hanoi \ + hashtest \ + knight \ + lrtest \ + ncurses \ + newdemo \ + rain \ + tclock \ + testcurs \ + view \ + worm \ + xmas + +all: $(TESTS) + +blue: $(MODEL)/blue.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +bs: $(MODEL)/bs.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +firework: $(MODEL)/firework.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +gdc: $(MODEL)/gdc.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +hanoi: $(MODEL)/hanoi.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +hashtest: $(MODEL)/hashtest.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +knight: $(MODEL)/knight.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +lrtest: $(MODEL)/lrtest.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +ncurses: $(MODEL)/ncurses.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +newdemo: $(MODEL)/newdemo.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +rain: $(MODEL)/rain.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +tclock: $(MODEL)/tclock.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) -lm +testcurs: $(MODEL)/testcurs.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +view: $(MODEL)/view.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +worm: $(MODEL)/worm.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) +xmas: $(MODEL)/xmas.o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/$@.o $(LDFLAGS_DEFAULT) + +install: +install.libs: +install.test: + +clean :: + -rm -rf *.o trace screendump *.atac *.lis core $(TESTS) + +distclean :: clean + -rm -f Makefile ncurses_cfg.h config.* + +mostlyclean :: clean + +realclean :: distclean + +lint: + sh -c 'for N in $(TESTS); do echo LINT:$$N; $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/$$N.c $(LINT_LIBS); done' diff --git a/test/README b/test/README new file mode 100644 index 00000000..cd1767a1 --- /dev/null +++ b/test/README @@ -0,0 +1,22 @@ +The programs in this directory are designed to test your newest toy :-) +Check the sources for any further details. + +blue - Blue Moon, a nifty solitaire (uses color) +bs.c - the game of Battleships (uses color) +firework.c - multi-colored fireworks (uses color) +gdc.c - Great Digital Clock (uses color) +hanoi.c - the game of hanoi (uses color essentially) +knight.c - the game of Knight's Tour (uses color) +lrtest.c - test of access to the lower-right corner +ncurses.c - multi-test program (uses color) +newdemo.c - another test from PDCurses (uses color) +rain.c - rain drops keep falling on my head... +tclock.c - analog/digital clock +testcurs.c - a test from the PDCurses people (uses color) +worm.c - worms run all over your screen (uses color) +xmas.c - Xmas greeting card + +The bs and knight games demonstrate processing of mouse events under xterm. +This directory also contains: + +tracemunch - Perl script to crunch trace scripts to make them easier to read diff --git a/test/blue.c b/test/blue.c new file mode 100644 index 00000000..a97cdafb --- /dev/null +++ b/test/blue.c @@ -0,0 +1,436 @@ +/***************************************************************************** + * * + * B l u e M o o n * + * ================= * + * V2.2 * + * A patience game by T.A.Lister * + * Integral screen support by Eric S. Raymond * + * * + *****************************************************************************/ + +/* + * Compile this with the command `cc -O blue.c -lcurses -o blue'. For best + * results, use the portable freeware ncurses(3) library. On non-Intel + * machines, SVr4 curses is just as good. + * + * $Id: blue.c,v 1.15 1997/03/09 00:47:41 tom Exp $ + */ + +#include + +#include +#include +#include + +#include + +#define NOCARD (-1) + +#define ACE 0 +#define KING 12 +#define SUIT_LENGTH 13 + +#define HEARTS 0 +#define SPADES 1 +#define DIAMONDS 2 +#define CLUBS 3 +#define NSUITS 4 + +#define GRID_WIDTH 14 /* 13+1 */ +#define GRID_LENGTH 56 /* 4*(13+1) */ +#define PACK_SIZE 52 + +#define BASEROW 1 +#define PROMPTROW 11 + +#define RED_ON_WHITE 1 +#define BLACK_ON_WHITE 2 +#define BLUE_ON_WHITE 3 + +static RETSIGTYPE die(int onsig) GCC_NORETURN; + +static int deck_size = PACK_SIZE; /* initial deck */ +static int deck[PACK_SIZE]; + +static int grid[GRID_LENGTH]; /* card layout grid */ +static int freeptr[4]; /* free card space pointers */ + +static int deal_number=0; + +static chtype ranks[SUIT_LENGTH][2] = +{ + {' ', 'A'}, + {' ', '2'}, + {' ', '3'}, + {' ', '4'}, + {' ', '5'}, + {' ', '6'}, + {' ', '7'}, + {' ', '8'}, + {' ', '9'}, + {'1', '0'}, + {' ', 'J'}, + {' ', 'Q'}, + {' ', 'K'} +}; + +/* Please note, that this is a bad example. + Color values should not be or'ed in. This + only works, because the characters used here + are plain and have no color attribute themselves. */ +static chtype letters[4] = +{ +#ifdef COLOR_PAIR + 'h' | COLOR_PAIR(RED_ON_WHITE), /* hearts */ + 's' | COLOR_PAIR(BLACK_ON_WHITE), /* spades */ + 'd' | COLOR_PAIR(RED_ON_WHITE), /* diamonds */ + 'c' | COLOR_PAIR(BLACK_ON_WHITE), /* clubs */ +#endif +}; + +#if defined(__i386__) +static chtype glyphs[] = +{ +#ifdef COLOR_PAIR + '\003' | A_ALTCHARSET | COLOR_PAIR(RED_ON_WHITE), /* hearts */ + '\006' | A_ALTCHARSET | COLOR_PAIR(BLACK_ON_WHITE), /* spades */ + '\004' | A_ALTCHARSET | COLOR_PAIR(RED_ON_WHITE), /* diamonds */ + '\005' | A_ALTCHARSET | COLOR_PAIR(BLACK_ON_WHITE), /* clubs */ +#endif +}; +#endif /* __i386__ */ + +static chtype *suits = letters; /* this may change to glyphs below */ + +static RETSIGTYPE die(int onsig) +{ + (void) signal(onsig, SIG_IGN); + endwin(); + exit(EXIT_SUCCESS); +} + +static void init_vars(void) +{ + int i; + + deck_size = PACK_SIZE; + for (i=0; i < PACK_SIZE; i++) + deck[i]=i; + for (i = 0; i < 4; i++) + freeptr[i]=i * GRID_WIDTH; +} + +static void shuffle(int size) +{ + int i,j,numswaps,swapnum,temp; + + numswaps=size*10; /* an arbitrary figure */ + + for (swapnum=0;swapnum=PACK_SIZE)) + return(NOCARD); + for(i = 0; i < GRID_LENGTH; i++) + if (grid[i] == card) + return i; + return(NOCARD); +} + +static void movecard(int src, int dst) +{ + grid[dst]=grid[src]; + grid[src]=NOCARD; + + move( BASEROW + (dst / GRID_WIDTH)*2+2, (dst % GRID_WIDTH)*5 + 1); + printcard(grid[dst]); + + move( BASEROW + (src / GRID_WIDTH)*2+2, (src % GRID_WIDTH)*5 + 1); + printcard(grid[src]); + + refresh(); +} + +static void play_game(void) +{ + int dead=0, i, j; + char c; + int selection[4], card; + + while (dead<4) + { + dead=0; + for (i=0;i<4;i++) + { + card=grid[freeptr[i]-1]; + + if ( ((card % SUIT_LENGTH)==KING) + || + (card==NOCARD) ) + selection[i]=NOCARD; + else + selection[i]=find(card+1); + + if (selection[i]==NOCARD) + dead++; + }; + + if (dead < 4) + { + char live[NSUITS+1], *lp = live; + + for (i=0;i<4;i++) + { + if (selection[i] != NOCARD) + { + move(BASEROW + (selection[i] / GRID_WIDTH)*2+3, + (selection[i] % GRID_WIDTH)*5); + (void)printw(" %c ", *lp++ = 'a' + i); + } + }; + *lp = '\0'; + + if (strlen(live) == 1) + { + move(PROMPTROW,0); + (void)printw( + "Making forced moves... "); + refresh(); + (void) sleep(1); + c = live[0]; + } + else + { + char buf[BUFSIZ]; + + (void)sprintf(buf, + "Type [%s] to move, r to redraw, q or INTR to quit: ", + live); + + do { + move(PROMPTROW,0); + (void) addstr(buf); + move(PROMPTROW, (int)strlen(buf)); + clrtoeol(); + (void) addch(' '); + } while + (((c = getch())<'a' || c>'d') && (c!='r') && (c!='q')); + } + + for (j = 0; j < 4; j++) + if (selection[j]!=NOCARD) + { + move(BASEROW + (selection[j] / GRID_WIDTH)*2+3, + (selection[j] % GRID_WIDTH)*5); + (void)printw(" "); + } + + if (c == 'r') + display_cards(deal_number); + else if (c == 'q') + die(SIGINT); + else + { + i = c-'a'; + if (selection[i] == NOCARD) + beep(); + else + { + movecard(selection[i], freeptr[i]); + freeptr[i]=selection[i]; + } + } + } + } + + move(PROMPTROW, 0); + standout(); + (void)printw("Finished deal %d - type any character to continue...", deal_number); + standend(); + (void) getch(); +} + +static int collect_discards(void) +{ + int row, col, cardno=0, finish, gridno; + + for (row=HEARTS;row<=CLUBS;row++) + { + finish=0; + for (col=1;col August 1989. diff --git a/test/bs.c b/test/bs.c new file mode 100644 index 00000000..98d6d060 --- /dev/null +++ b/test/bs.c @@ -0,0 +1,1248 @@ +/* + * bs.c - original author: Bruce Holloway + * salvo option by: Chuck A DeGaul + * with improved user interface, autoconfiguration and code cleanup + * by Eric S. Raymond + * v1.2 with color support and minor portability fixes, November 1990 + * v2.0 featuring strict ANSI/POSIX conformance, November 1993. + * v2.1 with ncurses mouse support, September 1995 + * + * $Id: bs.c,v 1.17 1997/04/06 01:42:57 tom Exp $ + */ + +#include + +#include +#include +#include +#include +#include + +#ifndef SIGIOT +#define SIGIOT SIGABRT +#endif + +#ifndef A_UNDERLINE /* BSD curses */ +#define beep() write(1,"\007",1); +#define cbreak crmode +#define saveterm savetty +#define resetterm resetty +#define nocbreak nocrmode +#define strchr index +#endif /* !A_UNDERLINE */ + +static int getcoord(int); + +/* + * Constants for tuning the random-fire algorithm. It prefers moves that + * diagonal-stripe the board with a stripe separation of srchstep. If + * no such preferred moves are found, srchstep is decremented. + */ +#define BEGINSTEP 3 /* initial value of srchstep */ + +/* miscellaneous constants */ +#define SHIPTYPES 5 +#define OTHER (1-turn) +#define PLAYER 0 +#define COMPUTER 1 +#define MARK_HIT 'H' +#define MARK_MISS 'o' +#define CTRLC '\003' /* used as terminate command */ +#define FF '\014' /* used as redraw command */ + +/* coordinate handling */ +#define BWIDTH 10 +#define BDEPTH 10 + +/* display symbols */ +#define SHOWHIT '*' +#define SHOWSPLASH ' ' +#define IS_SHIP(c) isupper(c) + +/* how to position us on player board */ +#define PYBASE 3 +#define PXBASE 3 +#define PY(y) (PYBASE + (y)) +#define PX(x) (PXBASE + (x)*3) +#define pgoto(y, x) (void)move(PY(y), PX(x)) + +/* how to position us on cpu board */ +#define CYBASE 3 +#define CXBASE 48 +#define CY(y) (CYBASE + (y)) +#define CX(x) (CXBASE + (x)*3) +#define CYINV(y) ((y) - CYBASE) +#define CXINV(x) (((x) - CXBASE) / 3) +#define cgoto(y, x) (void)move(CY(y), CX(x)) + +#define ONBOARD(x, y) (x >= 0 && x < BWIDTH && y >= 0 && y < BDEPTH) + +/* other board locations */ +#define COLWIDTH 80 +#define PROMPTLINE 21 /* prompt line */ +#define SYBASE CYBASE + BDEPTH + 3 /* move key diagram */ +#define SXBASE 63 +#define MYBASE SYBASE - 1 /* diagram caption */ +#define MXBASE 64 +#define HYBASE SYBASE - 1 /* help area */ +#define HXBASE 0 + +/* this will need to be changed if BWIDTH changes */ +static char numbers[] = " 0 1 2 3 4 5 6 7 8 9"; + +static char carrier[] = "Aircraft Carrier"; +static char battle[] = "Battleship"; +static char sub[] = "Submarine"; +static char destroy[] = "Destroyer"; +static char ptboat[] = "PT Boat"; + +static char name[40]; +static char dftname[] = "stranger"; + +/* direction constants */ +#define E 0 +#define SE 1 +#define S 2 +#define SW 3 +#define W 4 +#define NW 5 +#define N 6 +#define NE 7 +static int xincr[8] = {1, 1, 0, -1, -1, -1, 0, 1}; +static int yincr[8] = {0, 1, 1, 1, 0, -1, -1, -1}; + +/* current ship position and direction */ +static int curx = (BWIDTH / 2); +static int cury = (BDEPTH / 2); + +typedef struct +{ + char *name; /* name of the ship type */ + unsigned hits; /* how many times has this ship been hit? */ + char symbol; /* symbol for game purposes */ + unsigned char length; /* length of ship */ + char x, y; /* coordinates of ship start point */ + unsigned char dir; /* direction of `bow' */ + bool placed; /* has it been placed on the board? */ +} +ship_t; + +static bool checkplace(int b, ship_t *ss, int vis); + +static ship_t plyship[SHIPTYPES] = +{ + { carrier, 0, 'A', 5}, + { battle, 0, 'B', 4}, + { destroy, 0, 'D', 3}, + { sub, 0, 'S', 3}, + { ptboat, 0, 'P', 2}, +}; + +static ship_t cpuship[SHIPTYPES] = +{ + { carrier, 0, 'A', 5}, + { battle, 0, 'B', 4}, + { destroy, 0, 'D', 3}, + { sub, 0, 'S', 3}, + { ptboat, 0, 'P', 2}, +}; + +/* "Hits" board, and main board. */ +static char hits[2][BWIDTH][BDEPTH], board[2][BWIDTH][BDEPTH]; + +static int turn; /* 0=player, 1=computer */ +static int plywon=0, cpuwon=0; /* How many games has each won? */ + +static int salvo, blitz, closepack; + +#define PR (void)addstr + +static RETSIGTYPE uninitgame(int sig) GCC_NORETURN; + +static void uninitgame(int sig GCC_UNUSED) +/* end the game, either normally or due to signal */ +{ + clear(); + (void)refresh(); + (void)resetterm(); + (void)echo(); + (void)endwin(); + exit(EXIT_FAILURE); +} + +static void announceopts(void) +/* announce which game options are enabled */ +{ + if (salvo || blitz || closepack) + { + (void) printw("Playing optional game ("); + if (salvo) + (void) printw("salvo, "); + else + (void) printw("nosalvo, "); + if (blitz) + (void) printw("blitz "); + else + (void) printw("noblitz, "); + if (closepack) + (void) printw("closepack)"); + else + (void) printw("noclosepack)"); + } + else + (void) printw( + "Playing standard game (noblitz, nosalvo, noclosepack)"); +} + +static void intro(void) +{ + char *tmpname; + + srand((unsigned)(time(0L)+getpid())); /* Kick the random number generator */ + + (void) signal(SIGINT,uninitgame); + (void) signal(SIGINT,uninitgame); + (void) signal(SIGIOT,uninitgame); /* for assert(3) */ + if(signal(SIGQUIT,SIG_IGN) != SIG_IGN) + (void)signal(SIGQUIT,uninitgame); + + if((tmpname = getlogin()) != 0) + { + (void)strcpy(name,tmpname); + name[0] = toupper(name[0]); + } + else + (void)strcpy(name,dftname); + + (void)initscr(); +#ifdef KEY_MIN + keypad(stdscr, TRUE); +#endif /* KEY_MIN */ + (void)saveterm(); + (void)nonl(); + (void)cbreak(); + (void)noecho(); + +#ifdef PENGUIN + (void)clear(); + (void)mvaddstr(4,29,"Welcome to Battleship!"); + (void)move(8,0); + PR(" \\\n"); + PR(" \\ \\ \\\n"); + PR(" \\ \\ \\ \\ \\_____________\n"); + PR(" \\ \\ \\_____________ \\ \\/ |\n"); + PR(" \\ \\/ \\ \\/ |\n"); + PR(" \\/ \\_____/ |__\n"); + PR(" ________________/ |\n"); + PR(" \\ S.S. Penguin |\n"); + PR(" \\ /\n"); + PR(" \\___________________________________________________/\n"); + + (void) mvaddstr(22,27,"Hit any key to continue..."); (void)refresh(); + (void) getch(); +#endif /* PENGUIN */ + +#ifdef A_COLOR + start_color(); + + init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_BLACK); + init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK); + init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK); + init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK); + init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK); + init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK); + init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK); + init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK); +#endif /* A_COLOR */ + +#ifdef NCURSES_MOUSE_VERSION + (void) mousemask(BUTTON1_CLICKED, (mmask_t *)NULL); +#endif /* NCURSES_MOUSE_VERSION*/ +} + +/* VARARGS1 */ +static void prompt(int n, NCURSES_CONST char *f, const char *s) +/* print a message at the prompt line */ +{ + (void) move(PROMPTLINE + n, 0); + (void) clrtoeol(); + (void) printw(f, s); + (void) refresh(); +} + +static void error(NCURSES_CONST char *s) +{ + (void) move(PROMPTLINE + 2, 0); + (void) clrtoeol(); + if (s) + { + (void) addstr(s); + (void) beep(); + } +} + +static void placeship(int b, ship_t *ss, int vis) +{ + int l; + + for(l = 0; l < ss->length; ++l) + { + int newx = ss->x + l * xincr[ss->dir]; + int newy = ss->y + l * yincr[ss->dir]; + + board[b][newx][newy] = ss->symbol; + if (vis) + { + pgoto(newy, newx); + (void) addch((chtype)ss->symbol); + } + } + ss->hits = 0; +} + +static int rnd(int n) +{ + return(((rand() & 0x7FFF) % n)); +} + +static void randomplace(int b, ship_t *ss) +/* generate a valid random ship placement into px,py */ +{ + register int bwidth = BWIDTH - ss->length; + register int bdepth = BDEPTH - ss->length; + + do { + ss->y = rnd(bdepth); + ss->x = rnd(bwidth); + ss->dir = rnd(2) ? E : S; + } while + (!checkplace(b, ss, FALSE)); +} + +static void initgame(void) +{ + int i, j, unplaced; + ship_t *ss; + + (void) clear(); + (void) mvaddstr(0,35,"BATTLESHIPS"); + (void) move(PROMPTLINE + 2, 0); + announceopts(); + + memset(board, 0, sizeof(char) * BWIDTH * BDEPTH * 2); + memset(hits, 0, sizeof(char) * BWIDTH * BDEPTH * 2); + for (i = 0; i < SHIPTYPES; i++) + { + ss = cpuship + i; + ss->x = ss->y = ss->dir = ss->hits = ss->placed = 0; + ss = plyship + i; + ss->x = ss->y = ss->dir = ss->hits = ss->placed = 0; + } + + /* draw empty boards */ + (void) mvaddstr(PYBASE - 2, PXBASE + 5, "Main Board"); + (void) mvaddstr(PYBASE - 1, PXBASE - 3,numbers); + for(i=0; i < BDEPTH; ++i) + { + (void) mvaddch(PYBASE + i, PXBASE - 3, (chtype)(i + 'A')); +#ifdef A_COLOR + if (has_colors()) + attron(COLOR_PAIR(COLOR_BLUE)); +#endif /* A_COLOR */ + (void) addch(' '); + for (j = 0; j < BWIDTH; j++) + (void) addstr(" . "); +#ifdef A_COLOR + attrset(0); +#endif /* A_COLOR */ + (void) addch(' '); + (void) addch((chtype)(i + 'A')); + } + (void) mvaddstr(PYBASE + BDEPTH, PXBASE - 3,numbers); + (void) mvaddstr(CYBASE - 2, CXBASE + 7,"Hit/Miss Board"); + (void) mvaddstr(CYBASE - 1, CXBASE - 3, numbers); + for(i=0; i < BDEPTH; ++i) + { + (void) mvaddch(CYBASE + i, CXBASE - 3, (chtype)(i + 'A')); +#ifdef A_COLOR + if (has_colors()) + attron(COLOR_PAIR(COLOR_BLUE)); +#endif /* A_COLOR */ + (void) addch(' '); + for (j = 0; j < BWIDTH; j++) + (void) addstr(" . "); +#ifdef A_COLOR + attrset(0); +#endif /* A_COLOR */ + (void) addch(' '); + (void) addch((chtype)(i + 'A')); + } + + (void) mvaddstr(CYBASE + BDEPTH,CXBASE - 3,numbers); + + (void) mvprintw(HYBASE, HXBASE, + "To position your ships: move the cursor to a spot, then"); + (void) mvprintw(HYBASE+1,HXBASE, + "type the first letter of a ship type to select it, then"); + (void) mvprintw(HYBASE+2,HXBASE, + "type a direction ([hjkl] or [4862]), indicating how the"); + (void) mvprintw(HYBASE+3,HXBASE, + "ship should be pointed. You may also type a ship letter"); + (void) mvprintw(HYBASE+4,HXBASE, + "followed by `r' to position it randomly, or type `R' to"); + (void) mvprintw(HYBASE+5,HXBASE, + "place all remaining ships randomly."); + + (void) mvaddstr(MYBASE, MXBASE, "Aiming keys:"); + (void) mvaddstr(SYBASE, SXBASE, "y k u 7 8 9"); + (void) mvaddstr(SYBASE+1, SXBASE, " \\|/ \\|/ "); + (void) mvaddstr(SYBASE+2, SXBASE, "h-+-l 4-+-6"); + (void) mvaddstr(SYBASE+3, SXBASE, " /|\\ /|\\ "); + (void) mvaddstr(SYBASE+4, SXBASE, "b j n 1 2 3"); + + /* have the computer place ships */ + for(ss = cpuship; ss < cpuship + SHIPTYPES; ss++) + { + randomplace(COMPUTER, ss); + placeship(COMPUTER, ss, FALSE); + } + + ss = (ship_t *)NULL; + do { + char c, docked[SHIPTYPES + 2], *cp = docked; + + /* figure which ships still wait to be placed */ + *cp++ = 'R'; + for (i = 0; i < SHIPTYPES; i++) + if (!plyship[i].placed) + *cp++ = plyship[i].symbol; + *cp = '\0'; + + /* get a command letter */ + prompt(1, "Type one of [%s] to pick a ship.", docked+1); + do { + c = getcoord(PLAYER); + } while + (!strchr(docked, c)); + + if (c == 'R') + (void) ungetch('R'); + else + { + /* map that into the corresponding symbol */ + for (ss = plyship; ss < plyship + SHIPTYPES; ss++) + if (ss->symbol == c) + break; + + prompt(1, "Type one of [hjklrR] to place your %s.", ss->name); + pgoto(cury, curx); + } + + do { + c = getch(); + } while + (!strchr("hjklrR", c) || c == FF); + + if (c == FF) + { + (void)clearok(stdscr, TRUE); + (void)refresh(); + } + else if (c == 'r') + { + prompt(1, "Random-placing your %s", ss->name); + randomplace(PLAYER, ss); + placeship(PLAYER, ss, TRUE); + error((char *)NULL); + ss->placed = TRUE; + } + else if (c == 'R') + { + prompt(1, "Placing the rest of your fleet at random...", ""); + for (ss = plyship; ss < plyship + SHIPTYPES; ss++) + if (!ss->placed) + { + randomplace(PLAYER, ss); + placeship(PLAYER, ss, TRUE); + ss->placed = TRUE; + } + error((char *)NULL); + } + else if (strchr("hjkl8462", c)) + { + ss->x = curx; + ss->y = cury; + + switch(c) + { + case 'k': case '8': ss->dir = N; break; + case 'j': case '2': ss->dir = S; break; + case 'h': case '4': ss->dir = W; break; + case 'l': case '6': ss->dir = E; break; + } + + if (checkplace(PLAYER, ss, TRUE)) + { + placeship(PLAYER, ss, TRUE); + error((char *)NULL); + ss->placed = TRUE; + } + } + + for (unplaced = i = 0; i < SHIPTYPES; i++) + unplaced += !plyship[i].placed; + } while + (unplaced); + + turn = rnd(2); + + (void) mvprintw(HYBASE, HXBASE, + "To fire, move the cursor to your chosen aiming point "); + (void) mvprintw(HYBASE+1, HXBASE, + "and strike any key other than a motion key. "); + (void) mvprintw(HYBASE+2, HXBASE, + " "); + (void) mvprintw(HYBASE+3, HXBASE, + " "); + (void) mvprintw(HYBASE+4, HXBASE, + " "); + (void) mvprintw(HYBASE+5, HXBASE, + " "); + + (void) prompt(0, "Press any key to start...", ""); + (void) getch(); +} + +static int getcoord(int atcpu) +{ + int ny, nx, c; + + if (atcpu) + cgoto(cury,curx); + else + pgoto(cury, curx); + (void)refresh(); + for (;;) + { + if (atcpu) + { + (void) mvprintw(CYBASE + BDEPTH+1, CXBASE+11, "(%d, %c)", curx, 'A'+cury); + cgoto(cury, curx); + } + else + { + (void) mvprintw(PYBASE + BDEPTH+1, PXBASE+11, "(%d, %c)", curx, 'A'+cury); + pgoto(cury, curx); + } + + switch(c = getch()) + { + case 'k': case '8': +#ifdef KEY_MIN + case KEY_UP: +#endif /* KEY_MIN */ + ny = cury+BDEPTH-1; nx = curx; + break; + case 'j': case '2': +#ifdef KEY_MIN + case KEY_DOWN: +#endif /* KEY_MIN */ + ny = cury+1; nx = curx; + break; + case 'h': case '4': +#ifdef KEY_MIN + case KEY_LEFT: +#endif /* KEY_MIN */ + ny = cury; nx = curx+BWIDTH-1; + break; + case 'l': case '6': +#ifdef KEY_MIN + case KEY_RIGHT: +#endif /* KEY_MIN */ + ny = cury; nx = curx+1; + break; + case 'y': case '7': +#ifdef KEY_MIN + case KEY_A1: +#endif /* KEY_MIN */ + ny = cury+BDEPTH-1; nx = curx+BWIDTH-1; + break; + case 'b': case '1': +#ifdef KEY_MIN + case KEY_C1: +#endif /* KEY_MIN */ + ny = cury+1; nx = curx+BWIDTH-1; + break; + case 'u': case '9': +#ifdef KEY_MIN + case KEY_A3: +#endif /* KEY_MIN */ + ny = cury+BDEPTH-1; nx = curx+1; + break; + case 'n': case '3': +#ifdef KEY_MIN + case KEY_C3: +#endif /* KEY_MIN */ + ny = cury+1; nx = curx+1; + break; + case FF: + nx = curx; ny = cury; + (void)clearok(stdscr, TRUE); + (void)refresh(); + break; +#ifdef NCURSES_MOUSE_VERSION + case KEY_MOUSE: + { + MEVENT myevent; + + getmouse(&myevent); + if (atcpu + && myevent.y >= CY(0) && myevent.y <= CY(BDEPTH) + && myevent.x >= CX(0) && myevent.x <= CX(BDEPTH)) + { + curx = CXINV(myevent.x); + cury = CYINV(myevent.y); + return(' '); + } + else + { + beep(); + continue; + } + } + /* no fall through */ +#endif /* NCURSES_MOUSE_VERSION */ + + default: + if (atcpu) + (void) mvaddstr(CYBASE + BDEPTH + 1, CXBASE + 11, " "); + else + (void) mvaddstr(PYBASE + BDEPTH + 1, PXBASE + 11, " "); + return(c); + } + + curx = nx % BWIDTH; + cury = ny % BDEPTH; + } +} + +static int collidecheck(int b, int y, int x) +/* is this location on the selected zboard adjacent to a ship? */ +{ + int collide; + + /* anything on the square */ + if ((collide = IS_SHIP(board[b][x][y])) != 0) + return(collide); + + /* anything on the neighbors */ + if (!closepack) + { + int i; + + for (i = 0; i < 8; i++) + { + int xend, yend; + + yend = y + yincr[i]; + xend = x + xincr[i]; + if (ONBOARD(xend, yend)) + collide += IS_SHIP(board[b][xend][yend]); + } + } + return(collide); +} + +static bool checkplace(int b, ship_t *ss, int vis) +{ + int l, xend, yend; + + /* first, check for board edges */ + xend = ss->x + ss->length * xincr[ss->dir]; + yend = ss->y + ss->length * yincr[ss->dir]; + if (!ONBOARD(xend, yend)) + { + if (vis) + switch(rnd(3)) + { + case 0: + error("Ship is hanging from the edge of the world"); + break; + case 1: + error("Try fitting it on the board"); + break; + case 2: + error("Figure I won't find it if you put it there?"); + break; + } + return(0); + } + + for(l = 0; l < ss->length; ++l) + { + if(collidecheck(b, ss->y+l*yincr[ss->dir], ss->x+l*xincr[ss->dir])) + { + if (vis) + switch(rnd(3)) + { + case 0: + error("There's already a ship there"); + break; + case 1: + error("Collision alert! Aaaaaagh!"); + break; + case 2: + error("Er, Admiral, what about the other ship?"); + break; + } + return(FALSE); + } + } + return(TRUE); +} + +static int awinna(void) +{ + int i, j; + ship_t *ss; + + for(i=0; i<2; ++i) + { + ss = (i) ? cpuship : plyship; + for(j=0; j < SHIPTYPES; ++j, ++ss) + if(ss->length > ss->hits) + break; + if (j == SHIPTYPES) + return(OTHER); + } + return(-1); +} + +static ship_t *hitship(int x, int y) +/* register a hit on the targeted ship */ +{ + ship_t *sb, *ss; + char sym; + int oldx, oldy; + + getyx(stdscr, oldy, oldx); + sb = (turn) ? plyship : cpuship; + if((sym = board[OTHER][x][y]) == 0) + return((ship_t *)NULL); + for(ss = sb; ss < sb + SHIPTYPES; ++ss) + if(ss->symbol == sym) + { + if (++ss->hits < ss->length) /* still afloat? */ + return((ship_t *)NULL); + else /* sunk! */ + { + int i, j; + + if (!closepack) + for (j = -1; j <= 1; j++) + { + int bx = ss->x + j * xincr[(ss->dir + 2) % 8]; + int by = ss->y + j * yincr[(ss->dir + 2) % 8]; + + for (i = -1; i <= ss->length; ++i) + { + int x1, y1; + + x1 = bx + i * xincr[ss->dir]; + y1 = by + i * yincr[ss->dir]; + if (ONBOARD(x1, y1)) + { + hits[turn][x1][y1] = MARK_MISS; + if (turn % 2 == PLAYER) + { + cgoto(y1, x1); +#ifdef A_COLOR + if (has_colors()) + attron(COLOR_PAIR(COLOR_GREEN)); +#endif /* A_COLOR */ + (void)addch(MARK_MISS); +#ifdef A_COLOR + attrset(0); +#endif /* A_COLOR */ + } + } + } + } + + for (i = 0; i < ss->length; ++i) + { + int x1 = ss->x + i * xincr[ss->dir]; + int y1 = ss->y + i * yincr[ss->dir]; + + hits[turn][x1][y1] = ss->symbol; + if (turn % 2 == PLAYER) + { + cgoto(y1, x1); + (void) addch((chtype)(ss->symbol)); + } + } + + (void) move(oldy, oldx); + return(ss); + } + } + (void) move(oldy, oldx); + return((ship_t *)NULL); +} + +static int plyturn(void) +{ + ship_t *ss; + bool hit; + NCURSES_CONST char *m = NULL; + + prompt(1, "Where do you want to shoot? ", ""); + for (;;) + { + (void) getcoord(COMPUTER); + if (hits[PLAYER][curx][cury]) + { + prompt(1, "You shelled this spot already! Try again.", ""); + beep(); + } + else + break; + } + hit = IS_SHIP(board[COMPUTER][curx][cury]); + hits[PLAYER][curx][cury] = hit ? MARK_HIT : MARK_MISS; + cgoto(cury, curx); +#ifdef A_COLOR + if (has_colors()) + if (hit) + attron(COLOR_PAIR(COLOR_RED)); + else + attron(COLOR_PAIR(COLOR_GREEN)); +#endif /* A_COLOR */ + (void) addch((chtype)hits[PLAYER][curx][cury]); +#ifdef A_COLOR + attrset(0); +#endif /* A_COLOR */ + + prompt(1, "You %s.", hit ? "scored a hit" : "missed"); + if(hit && (ss = hitship(curx, cury))) + { + switch(rnd(5)) + { + case 0: + m = " You sank my %s!"; + break; + case 1: + m = " I have this sinking feeling about my %s...."; + break; + case 2: + m = " My %s has gone to Davy Jones's locker!"; + break; + case 3: + m = " Glub, glub -- my %s is headed for the bottom!"; + break; + case 4: + m = " You'll pick up survivors from my %s, I hope...!"; + break; + } + (void)printw(m, ss->name); + (void)beep(); + return(awinna() == -1); + } + return(hit); +} + +static int sgetc(const char *s) +{ + const char *s1; + int ch; + + (void)refresh(); + for(;;) + { + ch = getch(); + if (islower(ch)) + ch = toupper(ch); + if (ch == CTRLC) + uninitgame(0); + for (s1=s; *s1 && ch != *s1; ++s1) + continue; + if (*s1) + { + (void) addch((chtype)ch); + (void)refresh(); + return(ch); + } + } +} + + +static void randomfire(int *px, int *py) +/* random-fire routine -- implements simple diagonal-striping strategy */ +{ + static int turncount = 0; + static int srchstep = BEGINSTEP; + static int huntoffs; /* Offset on search strategy */ + int ypossible[BWIDTH * BDEPTH], xpossible[BWIDTH * BDEPTH], nposs; + int ypreferred[BWIDTH * BDEPTH], xpreferred[BWIDTH * BDEPTH], npref; + int x, y, i; + + if (turncount++ == 0) + huntoffs = rnd(srchstep); + + /* first, list all possible moves */ + nposs = npref = 0; + for (x = 0; x < BWIDTH; x++) + for (y = 0; y < BDEPTH; y++) + if (!hits[COMPUTER][x][y]) + { + xpossible[nposs] = x; + ypossible[nposs] = y; + nposs++; + if (((x+huntoffs) % srchstep) != (y % srchstep)) + { + xpreferred[npref] = x; + ypreferred[npref] = y; + npref++; + } + } + + if (npref) + { + i = rnd(npref); + + *px = xpreferred[i]; + *py = ypreferred[i]; + } + else if (nposs) + { + i = rnd(nposs); + + *px = xpossible[i]; + *py = ypossible[i]; + + if (srchstep > 1) + --srchstep; + } + else + { + error("No moves possible?? Help!"); + exit(EXIT_FAILURE); + /*NOTREACHED*/ + } +} + +#define S_MISS 0 +#define S_HIT 1 +#define S_SUNK -1 + +static bool cpufire(int x, int y) +/* fire away at given location */ +{ + bool hit, sunk; + ship_t *ss = NULL; + + hits[COMPUTER][x][y] = (hit = (board[PLAYER][x][y])) ? MARK_HIT : MARK_MISS; + (void) mvprintw(PROMPTLINE, 0, + "I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" : "miss"); + if ((sunk = (hit && (ss = hitship(x, y)))) != 0) + (void) printw(" I've sunk your %s", ss->name); + (void)clrtoeol(); + + pgoto(y, x); +#ifdef A_COLOR + if (has_colors()) + if (hit) + attron(COLOR_PAIR(COLOR_RED)); + else + attron(COLOR_PAIR(COLOR_GREEN)); +#endif /* A_COLOR */ + (void)addch((chtype)(hit ? SHOWHIT : SHOWSPLASH)); +#ifdef A_COLOR + attrset(0); +#endif /* A_COLOR */ + + return(hit ? (sunk ? S_SUNK : S_HIT) : S_MISS); +} + +/* + * This code implements a fairly irregular FSM, so please forgive the rampant + * unstructuredness below. The five labels are states which need to be held + * between computer turns. + */ +static bool cputurn(void) +{ +#define POSSIBLE(x, y) (ONBOARD(x, y) && !hits[COMPUTER][x][y]) +#define RANDOM_FIRE 0 +#define RANDOM_HIT 1 +#define HUNT_DIRECT 2 +#define FIRST_PASS 3 +#define REVERSE_JUMP 4 +#define SECOND_PASS 5 + static int next = RANDOM_FIRE; + static bool used[4]; + static ship_t ts; + int navail, x, y, d, n, hit = S_MISS; + + switch(next) + { + case RANDOM_FIRE: /* last shot was random and missed */ + refire: + randomfire(&x, &y); + if (!(hit = cpufire(x, y))) + next = RANDOM_FIRE; + else + { + ts.x = x; ts.y = y; + ts.hits = 1; + next = (hit == S_SUNK) ? RANDOM_FIRE : RANDOM_HIT; + } + break; + + case RANDOM_HIT: /* last shot was random and hit */ + used[E/2] = used[S/2] = used[W/2] = used[N/2] = FALSE; + /* FALLTHROUGH */ + + case HUNT_DIRECT: /* last shot hit, we're looking for ship's long axis */ + for (d = navail = 0; d < 4; d++) + { + x = ts.x + xincr[d*2]; y = ts.y + yincr[d*2]; + if (!used[d] && POSSIBLE(x, y)) + navail++; + else + used[d] = TRUE; + } + if (navail == 0) /* no valid places for shots adjacent... */ + goto refire; /* ...so we must random-fire */ + else + { + for (d = 0, n = rnd(navail) + 1; n; n--) + while (used[d]) + d++; + + assert(d <= 4); + + used[d] = FALSE; + x = ts.x + xincr[d*2]; + y = ts.y + yincr[d*2]; + + assert(POSSIBLE(x, y)); + + if (!(hit = cpufire(x, y))) + next = HUNT_DIRECT; + else + { + ts.x = x; ts.y = y; ts.dir = d*2; ts.hits++; + next = (hit == S_SUNK) ? RANDOM_FIRE : FIRST_PASS; + } + } + break; + + case FIRST_PASS: /* we have a start and a direction now */ + x = ts.x + xincr[ts.dir]; + y = ts.y + yincr[ts.dir]; + if (POSSIBLE(x, y) && (hit = cpufire(x, y))) + { + ts.x = x; ts.y = y; ts.hits++; + next = (hit == S_SUNK) ? RANDOM_FIRE : FIRST_PASS; + } + else + next = REVERSE_JUMP; + break; + + case REVERSE_JUMP: /* nail down the ship's other end */ + d = ts.dir + 4; + x = ts.x + ts.hits * xincr[d]; + y = ts.y + ts.hits * yincr[d]; + if (POSSIBLE(x, y) && (hit = cpufire(x, y))) + { + ts.x = x; ts.y = y; ts.dir = d; ts.hits++; + next = (hit == S_SUNK) ? RANDOM_FIRE : SECOND_PASS; + } + else + next = RANDOM_FIRE; + break; + + case SECOND_PASS: /* kill squares not caught on first pass */ + x = ts.x + xincr[ts.dir]; + y = ts.y + yincr[ts.dir]; + if (POSSIBLE(x, y) && (hit = cpufire(x, y))) + { + ts.x = x; ts.y = y; ts.hits++; + next = (hit == S_SUNK) ? RANDOM_FIRE: SECOND_PASS; + break; + } + else + next = RANDOM_FIRE; + break; + } + + /* check for continuation and/or winner */ + if (salvo) + { + (void)refresh(); + (void)sleep(1); + } + if (awinna() != -1) + return(FALSE); + +#ifdef DEBUG + (void) mvprintw(PROMPTLINE + 2, 0, + "New state %d, x=%d, y=%d, d=%d", + next, x, y, d); +#endif /* DEBUG */ + return(hit); +} + +static +int playagain(void) +{ + int j; + ship_t *ss; + + for (ss = cpuship; ss < cpuship + SHIPTYPES; ss++) + for(j = 0; j < ss->length; j++) + { + cgoto(ss->y + j * yincr[ss->dir], ss->x + j * xincr[ss->dir]); + (void)addch((chtype)ss->symbol); + } + + if(awinna()) + ++cpuwon; + else + ++plywon; + j = 18 + strlen(name); + if(plywon >= 10) + ++j; + if(cpuwon >= 10) + ++j; + (void) mvprintw(1,(COLWIDTH-j)/2, + "%s: %d Computer: %d",name,plywon,cpuwon); + + prompt(2, (awinna()) ? "Want to be humiliated again, %s [yn]? " + : "Going to give me a chance for revenge, %s [yn]? ",name); + return(sgetc("YN") == 'Y'); +} + +static void do_options(int c, char *op[]) +{ + register int i; + + if (c > 1) + { + for (i=1; ihits >= sp->length) + continue; /* dead ship */ + else + shots++; + } + return(shots); +} + +int main(int argc, char *argv[]) +{ + do_options(argc, argv); + + intro(); + do { + initgame(); + while(awinna() == -1) + { + if (!blitz) + { + if (!salvo) + { + if(turn) + (void) cputurn(); + else + (void) plyturn(); + } + else + { + register int i; + + i = scount(turn); + while (i--) + { + if (turn) + { + if (cputurn() && awinna() != -1) + i = 0; + } + else + { + if (plyturn() && awinna() != -1) + i = 0; + } + } + } + } + else + while(turn ? cputurn() : plyturn()) + continue; + turn = OTHER; + } + } while + (playagain()); + uninitgame(0); + /*NOTREACHED*/ +} + +/* bs.c ends here */ diff --git a/test/configure.in b/test/configure.in new file mode 100644 index 00000000..f28ce772 --- /dev/null +++ b/test/configure.in @@ -0,0 +1,182 @@ +dnl***************************************************************************** +dnl Copyright 1996,1997 by Thomas E. Dickey * +dnl All Rights Reserved. * +dnl * +dnl Permission to use, copy, modify, and distribute this software and its * +dnl documentation for any purpose and without fee is hereby granted, provided * +dnl that the above copyright notice appear in all copies and that both that * +dnl copyright notice and this permission notice appear in supporting * +dnl documentation, and that the name of the above listed copyright holder(s) * +dnl not be used in advertising or publicity pertaining to distribution of the * +dnl software without specific, written prior permission. THE ABOVE LISTED * +dnl COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * +dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * +dnl EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * +dnl SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * +dnl RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * +dnl CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * +dnl CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * +dnl***************************************************************************** +dnl $Id: configure.in,v 1.15 1997/05/06 00:36:02 tom Exp $ +dnl This is a simple configuration-script for the ncurses test programs that +dnl allows the test-directory to be separately configured against a reference +dnl system (i.e., sysvr4 curses) +dnl +dnl If you're configuring ncurses, you shouldn't need to use this script. +dnl It's only for testing purposes. +dnl +dnl dickey@clark.net (Thomas Dickey) +AC_PREREQ(2.12) +AC_INIT(ncurses.c) + +AC_PROG_CC + +CC_G_OPT="-g" AC_SUBST(CC_G_OPT) +CC_SHARED_OPTS=unknown AC_SUBST(CC_SHARED_OPTS) +CPPFLAGS="$CPPFLAGS" AC_SUBST(CPPFLAGS) +DFT_OBJ_SUBDIR=`pwd|sed -e's:.*/::'` AC_SUBST(DFT_OBJ_SUBDIR) +DFT_UPR_MODEL="NORMAL" AC_SUBST(DFT_UPR_MODEL) +EXTRA_LIBS="" AC_SUBST(EXTRA_LIBS) +LIB_NAME=curses AC_SUBST(LIB_NAME) +LINT=lint AC_SUBST(LINT) +LINT_OPTS="" AC_SUBST(LINT_OPTS) +TEST_ARGS="" AC_SUBST(TEST_ARGS) + +dnl SunOS 4.x +AC_ARG_WITH(5lib, + [ --with-5lib use SunOS sysv-libraries], + [LIBS="-L/usr/5lib $LIBS" + CPPFLAGS="$CPPFLAGS -I/usr/5include"]) + +dnl Ncurses, installed in conventional location +AC_ARG_WITH(ncurses, + [ --with-ncurses use ncurses-libraries (installed)], + [AC_CHECK_LIB(gpm,Gpm_Open) + LIB_NAME=ncurses + for p in $HOME /usr/local /usr + do + if test -f $p/include/ncurses/curses.h + then + CPPFLAGS="$CPPFLAGS -I$p/include/ncurses" + test $p != /usr && LIBS="-L$p/lib $LIBS" + break + elif test $p != /usr + then + if test -f $p/include/curses.h + then + CPPFLAGS="$CPPFLAGS -I$p/include" + LIBS="-L$p/lib $LIBS" + break + fi + fi + done + ],[test -d /usr/ccs/lib && LIBS="-L/usr/ccs/lib $LIBS"]) + +dnl If we've not specified a library, assume we're using sysvr4 libraries +dnl installed conventionally (e.g., SunOS 5.x - solaris). + +dnl Autoconf builds up the $LIBS in reverse order + +AC_CHECK_LIB($LIB_NAME,initscr) +AC_CHECK_LIB(form,form_driver,,,-lcurses) +AC_CHECK_LIB(menu,menu_driver,,,-lcurses) +AC_CHECK_LIB(panel,new_panel,,,-lcurses) + +AC_TYPE_SIGNAL + +AC_STDC_HEADERS +AC_HEADER_TIME +AC_CHECK_HEADERS( \ +form.h \ +getopt.h \ +menu.h \ +nc_alloc.h \ +panel.h \ +sys/ioctl.h \ +sys/select.h \ +sys/time.h \ +termios.h \ +unistd.h \ +) + +AC_CHECK_FUNCS( \ +gettimeofday \ +napms \ +resizeterm \ +strdup \ +vsscanf \ +) + +AC_CHECKING([for SCO by checking on /usr/bin/scosh]) +AC_PROGRAM_CHECK(COULD_BE_SCO, [scosh], maybe, maybenot) +if test "$COULD_BE_SCO" = "maybe" +then + AC_DEFINE(SYSTEM_LOOKS_LIKE_SCO) +fi + +dnl Things that we don't need (or must override) if we're not building ncurses +ECHO_LINK='@ echo linking $@ ... ;' +AC_SUBST(ECHO_LINK) + +LD_MODEL="" +AC_SUBST(LD_MODEL) + +LOCAL_LDFLAGS="" +AC_SUBST(LOCAL_LDFLAGS) + +nc_cv_abi_version="" +AC_SUBST(nc_cv_abi_version) + +TEST_DEPS="" +AC_SUBST(TEST_DEPS) + +LIB_PREFIX="-l" +AC_SUBST(LIB_PREFIX) + +DFT_DEP_SUFFIX="" +AC_SUBST(DFT_DEP_SUFFIX) + +rm -f config_h.in +echo '@DEFS@' >config_h.in + +changequote({,})dnl +AC_OUTPUT(config_h Makefile,{ + +### Special editing. We generate ncurses_cfg.h directly to allow all filenames +### to be MSDOS-compatible, as well as to make the list of definitions be +### dynamically determined by the configuration script -- a consideration when +### doing type-clean development testing. + +echo creating ncurses_cfg.h +rm -f ncurses_cfg.h +echo "/* generated by configure-script + * On host: $SYS_NAME + */ +#ifndef NC_CONFIG_H +#define NC_CONFIG_H" >ncurses_cfg.h +sed -e '/^ -D/!d' \ + -e 's/ -D/\ +#define /g' \ + -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \ + -e 's@\\@@g' \ + config_h | sort >>ncurses_cfg.h +echo " + /* The C compiler may not treat these properly, but C++ has to */ +#ifdef __cplusplus +#undef const +#undef inline +#endif + +#endif /* NC_CONFIG_H */" >> ncurses_cfg.h +echo removing config_h +rm config_h +},{ +### Special initialization commands, used to pass information from the +### configuration-run into config.status + +SYS_NAME="`(uname -a || hostname) 2>/dev/null | sed 1q`" +if test -z "\$SYS_NAME"; then SYS_NAME=unknown;fi +}) +changequote([,])dnl + +rm -f config_h.in diff --git a/test/firework.c b/test/firework.c new file mode 100644 index 00000000..a1a1e34a --- /dev/null +++ b/test/firework.c @@ -0,0 +1,154 @@ +/* + * $Id: firework.c,v 1.10 1997/05/03 18:37:56 tom Exp $ + */ +#include + +#include /* for tparm() */ + +#include +#include +#include + +static int get_colour(chtype *); +static void explode(int row, int col); +static void showit(void); +static void onsig(int sig); + +static int my_bg = COLOR_BLACK; + +int main( + int argc GCC_UNUSED, + char *argv[] GCC_UNUSED) +{ +int j; +int start,end,row,diff,flag = 0,direction; +unsigned seed; + + for (j=SIGHUP;j<=SIGTERM;j++) + if (signal(j,SIG_IGN)!=SIG_IGN) + signal(j,onsig); + + initscr(); + if (has_colors()) { + start_color(); +#ifdef NCURSES_VERSION + if (use_default_colors() == OK) + my_bg = -1; +#endif + } + curs_set(0); + + seed = time((time_t *)0); + srand(seed); + cbreak(); + for (;;) { + do { + start = rand() % (COLS -3); + end = rand() % (COLS - 3); + start = (start < 2) ? 2 : start; + end = (end < 2) ? 2 : end; + direction = (start > end) ? -1 : 1; + diff = abs(start-end); + } while (diff<2 || diff>=LINES-2); + attrset(A_NORMAL); + for (row=0;row 8) { + *bold = A_BOLD; + attr &= 7; + } + return(attr); +} + +static void +showit(void) +{ + refresh(); + napms(120); +} diff --git a/test/gdc.6 b/test/gdc.6 new file mode 100644 index 00000000..7fa60de9 --- /dev/null +++ b/test/gdc.6 @@ -0,0 +1,22 @@ +.TH GDC 6 +.SH NAME +gdc \- grand digital clock (curses) +.SH SYNOPSIS +.B gdc +[-s] [ +.I n +] +.SH DESCRIPTION +.I Gdc +runs a digital clock made of reverse-video blanks on a curses +compatible VDU screen. With an optional numeric argument +.I n +it stops after +.I n +seconds (default never). +The optional +.B -s +flag makes digits scroll as they change. In this curses mode implementation, +the scrolling option has trouble keeping up. +.SH AUTHOR +Amos Shapir, modified for curses by John Lupien. diff --git a/test/gdc.c b/test/gdc.c new file mode 100644 index 00000000..6bf38301 --- /dev/null +++ b/test/gdc.c @@ -0,0 +1,215 @@ +/* + * Grand digital clock for curses compatible terminals + * Usage: gdc [-s] [n] -- run for n seconds (default infinity) + * Flags: -s: scroll + * + * modified 10-18-89 for curses (jrl) + * 10-18-89 added signal handling + * + * $Id: gdc.c,v 1.8 1997/01/19 00:59:28 tom Exp $ + */ + +#include + +#include +#include +#include + +#define YBASE 10 +#define XBASE 10 +#define XLENGTH 54 +#define YDEPTH 5 + +/* it won't be */ +static time_t now; /* yeah! */ +static struct tm *tm; + +static short disp[11] = { + 075557, 011111, 071747, 071717, 055711, + 074717, 074757, 071111, 075757, 075717, 002020 +}; +static long old[6], next[6], new[6], mask; +static char scrol; + +static int sigtermed = 0; + +static int hascolor = 0; + +static void set(int, int); +static void standt(int); +static void movto(int, int); + +static +RETSIGTYPE sighndl(int signo) +{ + signal(signo, sighndl); + sigtermed=signo; +} + +int +main(int argc, char *argv[]) +{ +long t, a; +int i, j, s, k; +int n = 0; + + signal(SIGINT,sighndl); + signal(SIGTERM,sighndl); + signal(SIGKILL,sighndl); + + initscr(); + cbreak(); + noecho(); + nodelay(stdscr, 1); + + hascolor = has_colors(); + + if(hascolor) { + int bg = COLOR_BLACK; + start_color(); +#ifdef NCURSES_VERSION + if (use_default_colors() == OK) + bg = -1; +#endif + init_pair(1, COLOR_BLACK, COLOR_RED); + init_pair(2, COLOR_RED, bg); + init_pair(3, COLOR_WHITE, bg); + attrset(COLOR_PAIR(2)); + } + + clear(); + refresh(); + while(--argc > 0) { + if(**++argv == '-') + scrol = 1; + else + n = atoi(*argv); + } + + if(hascolor) { + attrset(COLOR_PAIR(3)); + + mvaddch(YBASE - 1, XBASE - 1, ACS_ULCORNER); + hline(ACS_HLINE, XLENGTH); + mvaddch(YBASE - 1, XBASE + XLENGTH, ACS_URCORNER); + + mvaddch(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER); + hline(ACS_HLINE, XLENGTH); + mvaddch(YBASE + YDEPTH, XBASE + XLENGTH, ACS_LRCORNER); + + move(YBASE, XBASE - 1); + vline(ACS_VLINE, YDEPTH); + + move(YBASE, XBASE + XLENGTH); + vline(ACS_VLINE, YDEPTH); + + attrset(COLOR_PAIR(2)); + } + do { + char buf[30]; + + mask = 0; + time(&now); + tm = localtime(&now); + set(tm->tm_sec%10, 0); + set(tm->tm_sec/10, 4); + set(tm->tm_min%10, 10); + set(tm->tm_min/10, 14); + set(tm->tm_hour%10, 20); + set(tm->tm_hour/10, 24); + set(10, 7); + set(10, 17); + for(k=0; k<6; k++) { + if(scrol) { + for(i=0; i<5; i++) + new[i] = (new[i]&~mask) | (new[i+1]&mask); + new[5] = (new[5]&~mask) | (next[k]&mask); + } else + new[k] = (new[k]&~mask) | (next[k]&mask); + next[k] = 0; + for(s=1; s>=0; s--) { + standt(s); + for(i=0; i<6; i++) { + if((a = (new[i]^old[i])&(s ? new : old)[i]) != 0) { + for(j=0,t=1<<26; t; t>>=1,j++) { + if(a&t) { + if(!(a&(t<<1))) { + movto(YBASE + i, XBASE + 2*j); + } + addstr(" "); + } + } + } + if(!s) { + old[i] = new[i]; + } + } + if(!s) { + refresh(); + } + } + } + + /* this depends on the detailed format of ctime(3) */ + (void) strcpy(buf, ctime(&now)); + (void) strcpy(buf + 10, buf + 19); + mvaddstr(16, 30, buf); + + movto(6, 0); + refresh(); + sleep(1); + while(wgetch(stdscr) != ERR) + continue; + if (sigtermed) { + standend(); + clear(); + refresh(); + endwin(); + fprintf(stderr, "gdc terminated by signal %d\n", sigtermed); + return EXIT_FAILURE; + } + } while(--n); + standend(); + clear(); + refresh(); + endwin(); + return EXIT_SUCCESS; +} + +static void +set(int t, int n) +{ +int i, m; + + m = 7<>(4-i)*3)&07)< + +#include + +#define NPEGS 3 /* This is not configurable !! */ +#define MINTILES 3 +#define MAXTILES 9 +#define DEFAULTTILES 7 +#define TOPLINE 6 +#define BASELINE 16 +#define STATUSLINE (LINES-3) +#define LEFTPEG 19 +#define MIDPEG 39 +#define RIGHTPEG 59 + +#define LENTOIND(x) (((x)-1)/2) +#define OTHER(a,b) (3-((a)+(b))) + +struct Peg { + size_t Length[MAXTILES]; + int Count; +}; + +static struct Peg Pegs[NPEGS]; +static int PegPos[] = { LEFTPEG, MIDPEG, RIGHTPEG }; +static int TileColour[] = { + COLOR_GREEN, /* Length 3 */ + COLOR_MAGENTA, /* Length 5 */ + COLOR_RED, /* Length 7 */ + COLOR_BLUE, /* Length 9 */ + COLOR_CYAN, /* Length 11 */ + COLOR_YELLOW, /* Length 13 */ + COLOR_GREEN, /* Length 15 */ + COLOR_MAGENTA, /* Length 17 */ + COLOR_RED, /* Length 19 */ +}; +static int NMoves = 0; + +static void InitTiles(int NTiles); +static void DisplayTiles(void); +static void MakeMove(int From, int To); +static void AutoMove(int From, int To, int Num); +static void Usage(void); +static int Solved(int NumTiles); +static int GetMove(int *From, int *To); +static int InvalidMove(int From, int To); + +int +main(int argc, char **argv) +{ +int NTiles, FromCol, ToCol; +unsigned char AutoFlag = 0; + + switch(argc) { + case 1: + NTiles = DEFAULTTILES; + break; + case 2: + NTiles = atoi(argv[1]); + if (NTiles > MAXTILES || NTiles < MINTILES) { + fprintf(stderr, "Range %d to %d\n", MINTILES, MAXTILES); + return EXIT_FAILURE; + } + break; + case 3: + if (strcmp(argv[2], "a")) { + Usage(); + return EXIT_FAILURE; + } + NTiles = atoi(argv[1]); + if (NTiles > MAXTILES || NTiles < MINTILES) { + fprintf(stderr, "Range %d to %d\n", MINTILES, MAXTILES); + return EXIT_FAILURE; + } + AutoFlag = TRUE; + break; + default: + Usage(); + return EXIT_FAILURE; + } +#ifdef NCURSES_VERSION + trace(TRACE_MAXIMUM); +#endif + initscr(); + if (has_colors()) { + int i; + int bg = COLOR_BLACK; + start_color(); +#ifdef NCURSES_VERSION + if (use_default_colors() == OK) + bg = -1; +#endif + for (i = 0; i < 9; i++) + init_pair(i+1, bg, TileColour[i]); + } + cbreak(); + if (LINES < 24) { + endwin(); + fprintf(stderr, "Min screen length 24 lines\n"); + return EXIT_FAILURE; + } + if(AutoFlag) + leaveok(stdscr, TRUE); /* Attempt to remove cursor */ + InitTiles(NTiles); + DisplayTiles(); + if(AutoFlag) { + do { + noecho(); + AutoMove(0, 2, NTiles); + } while(!Solved(NTiles)); + sleep(2); + } else { + echo(); + for(;;) { + if(GetMove(&FromCol, &ToCol)) + break; + if(InvalidMove(FromCol, ToCol)) { + mvaddstr(STATUSLINE, 0, "Invalid Move !!"); + refresh(); + beep(); + continue; + } + MakeMove(FromCol, ToCol); + if(Solved(NTiles)) { + mvprintw(STATUSLINE, 0, "Well Done !! You did it in %d moves", NMoves); + refresh(); + sleep(5); + break; + } + } + } + curs_set(1); + endwin(); + return EXIT_SUCCESS; +} + +static int +InvalidMove(int From, int To) +{ + if(From >= NPEGS) + return TRUE; + if(From < 0) + return TRUE; + if(To >= NPEGS) + return TRUE; + if(To < 0) + return TRUE; + if(From == To) + return TRUE; + if(!Pegs[From].Count) + return TRUE; + if(Pegs[To].Count && + Pegs[From].Length[Pegs[From].Count-1] > + Pegs[To].Length[Pegs[To].Count-1]) + return TRUE; + return FALSE; +} + +static void +InitTiles(int NTiles) +{ + int Size, SlotNo; + + for(Size=NTiles*2+1, SlotNo=0; Size>=3; Size-=2) + Pegs[0].Length[SlotNo++] = Size; + + Pegs[0].Count = NTiles; + Pegs[1].Count = 0; + Pegs[2].Count = 0; +} + +static void +DisplayTiles(void) +{ + int Line, Peg, SlotNo; + char TileBuf[BUFSIZ]; + + erase(); + mvaddstr(1, 24, "T O W E R S O F H A N O I"); + mvaddstr(3, 34, "SJR 1990"); + mvprintw(19, 5, "Moves : %d", NMoves); + attrset(A_REVERSE); + mvaddstr(BASELINE, 8, " "); + + for(Line=TOPLINE; Line] [a]\n"); + fprintf(stderr, "The 'a' option causes the tower to be solved automatically\n"); +} diff --git a/test/hashtest.c b/test/hashtest.c new file mode 100644 index 00000000..174495a7 --- /dev/null +++ b/test/hashtest.c @@ -0,0 +1,193 @@ +/* + * hashtest.c -- test hash mapping + * + * Generate timing statistics for vertical-motion optimization. + * + * $Id: hashtest.c,v 1.8 1997/01/18 19:09:30 tom Exp $ + */ + +#define NCURSES_TRACE + +#ifdef TRACE +#define Trace(p) _tracef p +#define USE_TRACE 1 +#else +#define Trace(p) /* nothing */ +#define TRACE 0 +#endif + +#include + +#include +#include +#include + +#define LO_CHAR ' ' +#define HI_CHAR '~' + +static void finish(int sig) GCC_NORETURN; + +static bool continuous = FALSE; +static bool reverse_loops = FALSE; +static bool extend_corner = FALSE; +static int foot_lines = 0; +static int head_lines = 0; + +static void genlines(int base) +{ + int i, j; + +#if USE_TRACE + if (base == 'a') + Trace(("Resetting screen")); + else + Trace(("Painting `%c' screen", base)); +#endif + + move(0,0); + for (i = 0; i < head_lines; i++) + for (j = 0; j < COLS; j++) + addch((j % 8 == 0) ? ('A' + j/8) : '-'); + + move(head_lines, 0); + for (i = head_lines; i < LINES - foot_lines; i++) { + int c = (base - LO_CHAR + i) % (HI_CHAR - LO_CHAR + 1) + LO_CHAR; + int hi = (extend_corner || (i < LINES - 1)) ? COLS : COLS - 1; + for (j = 0; j < hi; j++) + addch(c); + } + + move(LINES - foot_lines, 0); + for (i = LINES - foot_lines; i < LINES; i++) + for (j = 0; j < extend_corner ? COLS : COLS - 1; j++) + addch((j % 8 == 0) ? ('A' + j/8) : '-'); + refresh(); +} + +static void one_cycle(int ch) +{ + if (continuous) { + genlines(ch); + } else if (ch != 'a') { + genlines('a'); + genlines(ch); + } +} + +static void run_test(bool optimized) +{ + char ch; + int lo = continuous ? LO_CHAR : 'a' - LINES; + int hi = continuous ? HI_CHAR : 'a' + LINES; + +#ifdef NCURSES_VERSION + if (optimized) { + Trace(("With hash mapping")); + _nc_optimize_enable |= OPTIMIZE_HASHMAP; + } else { + Trace(("Without hash mapping")); + _nc_optimize_enable &= ~OPTIMIZE_HASHMAP; + } +#endif + + if (reverse_loops) + for (ch = hi; ch >= lo; ch--) + one_cycle(ch); + else + for (ch = lo; ch <= hi; ch++) + one_cycle(ch); +} + +static void usage(void) +{ + static const char *const tbl[] = { + "Usage: hashtest [options]" + ,"" + ,"Options:" + ," -c continuous (don't reset between refresh's)" + ," -f num leave 'num' lines constant for footer" + ," -h num leave 'num' lines constant for header" + ," -l num repeat test 'num' times" + ," -n test the normal optimizer" + ," -o test the hashed optimizer" + ," -r reverse the loops" + ," -x assume lower-right corner extension" + }; + size_t n; + + for (n = 0; n < sizeof(tbl)/sizeof(tbl[0]); n++) + fprintf(stderr, "%s\n", tbl[n]); + exit(EXIT_FAILURE); +} + +int main(int argc, char *argv[]) +{ + int c; + int test_loops = 1; + int test_normal = FALSE; + int test_optimize = FALSE; + + while ((c = getopt(argc, argv, "cf:h:l:norx")) != EOF) { + switch (c) { + case 'c': + continuous = TRUE; + break; + case 'f': + foot_lines = atoi(optarg); + break; + case 'h': + head_lines = atoi(optarg); + break; + case 'l': + test_loops = atoi(optarg); + break; + case 'n': + test_normal = TRUE; + break; + case 'o': + test_optimize = TRUE; + break; + case 'r': + reverse_loops = TRUE; + break; + case 'x': + extend_corner = TRUE; + break; + default: + usage(); + } + } + if (!test_normal && !test_optimize) { + test_normal = TRUE; + test_optimize = TRUE; + } +#if USE_TRACE + trace(TRACE_TIMES); +#endif + + (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ + + (void) initscr(); /* initialize the curses library */ + keypad(stdscr, TRUE); /* enable keyboard mapping */ + (void) nonl(); /* tell curses not to do NL->CR/NL on output */ + (void) cbreak(); /* take input chars one at a time, no wait for \n */ + (void) noecho(); /* don't echo input */ + scrollok(stdscr, TRUE); + + while (test_loops-- > 0) { + if (test_normal) + run_test(FALSE); + if (test_optimize) + run_test(TRUE); + } + + finish(0); /* we're done */ +} + +static RETSIGTYPE finish(int sig) +{ + endwin(); + exit(sig != 0 ? EXIT_FAILURE : EXIT_SUCCESS); +} + +/* hashtest.c ends here */ diff --git a/test/knight.c b/test/knight.c new file mode 100644 index 00000000..b9461068 --- /dev/null +++ b/test/knight.c @@ -0,0 +1,565 @@ +/* + * Knight's Tour - a brain game + * + * The original of this game was anonymous. It had an unbelievably bogus + * interface, you actually had to enter square coordinates! Redesign by + * Eric S. Raymond July 22 1995. Mouse support + * added September 20th 1995. + * + * $Id: knight.c,v 1.13 1997/01/19 00:55:17 tom Exp $ + */ + +#include + +#include +#include +#include + +/* board size */ +#define BDEPTH 8 +#define BWIDTH 8 + +/* where to start the instructions */ +#define INSTRY 2 +#define INSTRX 35 + +/* corner of board */ +#define BOARDY 2 +#define BOARDX 0 + +/* notification line */ +#define NOTIFYY 21 + +/* virtual color values */ +#define TRAIL_COLOR 1 +#define PLUS_COLOR 2 +#define MINUS_COLOR 3 + +#define CX(x) (2 + 4 * (x)) +#define CY(y) (1 + 2 * (y)) +#define cellmove(y, x) wmove(boardwin, CY(y), CX(x)) +#define CXINV(x) (((x) - 1) / 4) +#define CYINV(y) (((y) - 2) / 2) + +typedef struct +{ + short x, y; +} +cell; + +static short board[BDEPTH][BWIDTH]; /* the squares */ +static int rw,col; /* current row and column */ +static int lastrow,lastcol; /* last location visited */ +static cell history[BDEPTH*BWIDTH]; /* choice history */ +static int movecount; /* count of moves so far */ +static WINDOW *boardwin; /* the board window */ +static WINDOW *helpwin; /* the help window */ +static WINDOW *msgwin; /* the message window */ +static chtype trail = '#'; /* trail character */ +static chtype plus = '+'; /* cursor hot-spot character */ +static chtype minus = '-'; /* possible-move character */ +static chtype oldch; + +static void init(void); +static void play(void); +static void dosquares(void); +static void drawmove(char, int, int, int, int); +static bool evalmove(int, int); +static bool chkmoves(void); +static bool chksqr(int, int); +static int iabs(int); + +int main( + int argc GCC_UNUSED, + char *argv[] GCC_UNUSED) +{ + init(); + + play(); + + endwin(); + return EXIT_SUCCESS; +} + +static void init (void) +{ + srand ((unsigned)getpid()); + initscr (); + cbreak (); /* immediate char return */ + noecho (); /* no immediate echo */ + boardwin = newwin(BDEPTH * 2 + 1, BWIDTH * 4 + 1, BOARDY, BOARDX); + helpwin = newwin(0, 0, INSTRY, INSTRX); + msgwin = newwin(1, INSTRX-1, NOTIFYY, 0); + scrollok(msgwin, TRUE); + keypad(boardwin, TRUE); + + if (has_colors()) + { + int bg = COLOR_BLACK; + + start_color(); +#ifdef NCURSES_VERSION + if (use_default_colors() == OK) + bg = -1; +#endif + + (void) init_pair(TRAIL_COLOR, COLOR_CYAN, bg); + (void) init_pair(PLUS_COLOR, COLOR_RED, bg); + (void) init_pair(MINUS_COLOR, COLOR_GREEN, bg); + + trail |= COLOR_PAIR(TRAIL_COLOR); + plus |= COLOR_PAIR(PLUS_COLOR); + minus |= COLOR_PAIR(MINUS_COLOR); + } + +#ifdef NCURSES_MOUSE_VERSION + (void) mousemask(BUTTON1_CLICKED, (mmask_t *)NULL); +#endif /* NCURSES_MOUSE_VERSION*/ + + oldch = minus; +} + +static void help1(void) +/* game explanation -- initial help screen */ +{ + (void)waddstr(helpwin, "Knight's move is a solitaire puzzle. Your\n"); + (void)waddstr(helpwin, "objective is to visit each square of the \n"); + (void)waddstr(helpwin, "chessboard exactly once by making knight's\n"); + (void)waddstr(helpwin, "moves (one square right or left followed \n"); + (void)waddstr(helpwin, "by two squares up or down, or two squares \n"); + (void)waddstr(helpwin, "right or left followed by one square up or\n"); + (void)waddstr(helpwin, "down). You may start anywhere.\n\n"); + + (void)waddstr(helpwin, "Use arrow keys to move the cursor around.\n"); + (void)waddstr(helpwin, "When you want to move your knight to the \n"); + (void)waddstr(helpwin, "cursor location, press or Enter.\n"); + (void)waddstr(helpwin, "Illegal moves will be rejected with an \n"); + (void)waddstr(helpwin, "audible beep.\n\n"); + (void)waddstr(helpwin, "The program will detect if you solve the\n"); + (void)waddstr(helpwin, "puzzle; also inform you when you run out\n"); + (void)waddstr(helpwin, "of legal moves.\n\n"); + + (void)mvwaddstr(helpwin, NOTIFYY-INSTRY, 0, + "Press `?' to go to keystroke help."); +} + +static void help2(void) +/* keystroke help screen */ +{ + (void)waddstr(helpwin, "Possible moves are shown with `-'.\n\n"); + + (void)waddstr(helpwin, "You can move around with the arrow keys or\n"); + (void)waddstr(helpwin, "with the rogue/hack movement keys. Other\n"); + (void)waddstr(helpwin, "commands allow you to undo moves or redraw.\n"); + (void)waddstr(helpwin, "Your mouse may work; try left-button to\n"); + (void)waddstr(helpwin, "move to the square under the pointer.\n\n"); + + (void)waddstr(helpwin, "x,q -- exit y k u 7 8 9\n"); + (void)waddstr(helpwin, "r -- redraw screen \\|/ \\|/ \n"); + (void)waddstr(helpwin, "u -- undo move h-+-l 4-+-6\n"); + (void)waddstr(helpwin, " /|\\ /|\\ \n"); + (void)waddstr(helpwin, " b j n 1 2 3\n"); + + (void)waddstr(helpwin,"\nYou can place your knight on the selected\n"); + (void)waddstr(helpwin, "square with spacebar, Enter, or the keypad\n"); + (void)waddstr(helpwin, "center key. You can quit with `x' or `q'.\n"); + + (void)mvwaddstr(helpwin, NOTIFYY-INSTRY, 0, + "Press `?' to go to game explanation"); +} + +static void play (void) +/* play the game */ +{ + bool keyhelp; /* TRUE if keystroke help is up */ + int c, ny = 0, nx = 0; + int i, j, count; + + do { + /* clear screen and draw board */ + werase(boardwin); + werase(helpwin); + werase(msgwin); + dosquares(); + help1(); + wnoutrefresh(stdscr); + wnoutrefresh(helpwin); + wnoutrefresh(msgwin); + wnoutrefresh(boardwin); + doupdate(); + + for (i = 0; i < BDEPTH; i++) + for (j = 0; j < BWIDTH; j++) + { + board[i][j] = FALSE; + cellmove(i, j); + waddch(boardwin, minus); + } + memset(history, '\0', sizeof(history)); + history[0].y = history[0].x = -1; + lastrow = lastcol = -2; + movecount = 1; + keyhelp = FALSE; + + for (;;) + { + if (rw != lastrow || col != lastcol) + { + if (lastrow >= 0 && lastcol >= 0) + { + cellmove(lastrow, lastcol); + if (board[lastrow][lastcol]) + waddch(boardwin, trail); + else + waddch(boardwin, oldch); + } + + cellmove(rw, col); + oldch = winch(boardwin); + + lastrow = rw; + lastcol= col; + } + cellmove(rw, col); + waddch(boardwin, plus); + cellmove(rw, col); + + wrefresh(msgwin); + + c = wgetch(boardwin); + + werase(msgwin); + + switch (c) + { + case 'k': case '8': + case KEY_UP: + ny = rw+BDEPTH-1; nx = col; + break; + case 'j': case '2': + case KEY_DOWN: + ny = rw+1; nx = col; + break; + case 'h': case '4': + case KEY_LEFT: + ny = rw; nx = col+BWIDTH-1; + break; + case 'l': case '6': + case KEY_RIGHT: + ny = rw; nx = col+1; + break; + case 'y': case '7': + case KEY_A1: + ny = rw+BDEPTH-1; nx = col+BWIDTH-1; + break; + case 'b': case '1': + case KEY_C1: + ny = rw+1; nx = col+BWIDTH-1; + break; + case 'u': case '9': + case KEY_A3: + ny = rw+BDEPTH-1; nx = col+1; + break; + case 'n': case '3': + case KEY_C3: + ny = rw+1; nx = col+1; + break; + +#ifdef NCURSES_MOUSE_VERSION + case KEY_MOUSE: + { + MEVENT myevent; + + getmouse(&myevent); + if (myevent.y >= CY(0) && myevent.y <= CY(BDEPTH) + && myevent.x >= CX(0) && myevent.x <= CX(BWIDTH)) + { + nx = CXINV(myevent.x); + ny = CYINV(myevent.y); + ungetch('\n'); + break; + } + else + { + beep(); + continue; + } + } +#endif /* NCURSES_MOUSE_VERSION */ + + case KEY_B2: + case '\n': + case ' ': + if (evalmove(rw, col)) + { + drawmove(trail, + history[movecount-1].y, history[movecount-1].x, + rw, col); + history[movecount].y = rw; + history[movecount].x = col; + movecount++; + + if (!chkmoves()) + goto dropout; + } + else + beep(); + break; + + case KEY_REDO: + case '\f': + case 'r': + clearok(curscr, TRUE); + wnoutrefresh(stdscr); + wnoutrefresh(boardwin); + wnoutrefresh(msgwin); + wnoutrefresh(helpwin); + doupdate(); + break; + + case KEY_UNDO: + case KEY_BACKSPACE: + case '\b': + if (movecount == 1) + { + ny = lastrow; + nx = lastcol; + waddstr(msgwin, "\nNo previous move."); + beep(); + } + else + { + int oldy = history[movecount-1].y; + int oldx = history[movecount-1].x; + + board[oldy][oldx] = FALSE; + --movecount; + ny = history[movecount-1].y; + nx = history[movecount-1].x; + drawmove(' ', oldy, oldx, ny, nx); + + /* avoid problems if we just changed the current cell */ + cellmove(lastrow, lastcol); + oldch = winch(boardwin); + } + break; + + case 'q': + case 'x': + goto dropout; + + case '?': + werase(helpwin); + if (keyhelp) + { + help1(); + keyhelp = FALSE; + } + else + { + help2(); + keyhelp = TRUE; + } + wrefresh(helpwin); + break; + + default: + beep(); + break; + } + + col = nx % BWIDTH; + rw = ny % BDEPTH; + } + + dropout: + count = 0; + for (i = 0; i < BDEPTH; i++) + for (j = 0; j < BWIDTH; j++) + if (board[i][j] != 0) + count += 1; + if (count == (BWIDTH * BDEPTH)) + wprintw(msgwin, "\nYou won. Care to try again? "); + else + wprintw(msgwin, "\n%d squares filled. Try again? ", count); + } while + (tolower(wgetch(msgwin)) == 'y'); +} + +static void dosquares (void) +{ + int i, j; + + mvaddstr(0, 20, "KNIGHT'S MOVE -- a logical solitaire"); + + move(BOARDY,BOARDX); + waddch(boardwin, ACS_ULCORNER); + for (j = 0; j < 7; j++) + { + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_TTEE); + } + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_URCORNER); + + for (i = 1; i < BDEPTH; i++) + { + move(BOARDY + i * 2 - 1, BOARDX); + waddch(boardwin, ACS_VLINE); + for (j = 0; j < BWIDTH; j++) + { + waddch(boardwin, ' '); + waddch(boardwin, ' '); + waddch(boardwin, ' '); + waddch(boardwin, ACS_VLINE); + } + move(BOARDY + i * 2, BOARDX); + waddch(boardwin, ACS_LTEE); + for (j = 0; j < BWIDTH - 1; j++) + { + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_PLUS); + } + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_RTEE); + } + + move(BOARDY + i * 2 - 1, BOARDX); + waddch(boardwin, ACS_VLINE); + for (j = 0; j < BWIDTH; j++) + { + waddch(boardwin, ' '); + waddch(boardwin, ' '); + waddch(boardwin, ' '); + waddch(boardwin, ACS_VLINE); + } + + move(BOARDY + i * 2, BOARDX); + waddch(boardwin, ACS_LLCORNER); + for (j = 0; j < BWIDTH - 1; j++) + { + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_BTEE); + } + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_HLINE); + waddch(boardwin, ACS_LRCORNER); +} + +static void mark_possibles(int prow, int pcol, chtype mark) +{ + if (chksqr(prow+2,pcol+1)){cellmove(prow+2,pcol+1);waddch(boardwin,mark);}; + if (chksqr(prow+2,pcol-1)){cellmove(prow+2,pcol-1);waddch(boardwin,mark);}; + if (chksqr(prow-2,pcol+1)){cellmove(prow-2,pcol+1);waddch(boardwin,mark);}; + if (chksqr(prow-2,pcol-1)){cellmove(prow-2,pcol-1);waddch(boardwin,mark);}; + if (chksqr(prow+1,pcol+2)){cellmove(prow+1,pcol+2);waddch(boardwin,mark);}; + if (chksqr(prow+1,pcol-2)){cellmove(prow+1,pcol-2);waddch(boardwin,mark);}; + if (chksqr(prow-1,pcol+2)){cellmove(prow-1,pcol+2);waddch(boardwin,mark);}; + if (chksqr(prow-1,pcol-2)){cellmove(prow-1,pcol-2);waddch(boardwin,mark);}; +} + +static void drawmove(char tchar, int oldy, int oldx, int row, int column) +/* place the stars, update board & currents */ +{ + if (movecount <= 1) + { + int i, j; + + for (i = 0; i < BDEPTH; i++) + for (j = 0; j < BWIDTH; j++) + { + cellmove(i, j); + if (winch(boardwin) == minus) + waddch(boardwin, movecount ? ' ' : minus); + } + } + else + { + cellmove(oldy, oldx); + waddch(boardwin, '\b'); + waddch(boardwin, tchar); + waddch(boardwin, tchar); + waddch(boardwin, tchar); + mark_possibles(oldy, oldx, ' '); + } + + if (row != -1 && column != -1) + { + cellmove(row, column); + waddch(boardwin, '\b'); + waddch(boardwin, trail); + waddch(boardwin, trail); + waddch(boardwin, trail); + mark_possibles(row, column, minus); + board[row][column] = TRUE; + } + + wprintw(msgwin, "\nMove %d", movecount); +} + +static bool evalmove(int row, int column) +/* evaluate move */ +{ + if (movecount == 1) + return(TRUE); + else if (board[row][column] == TRUE) + { + waddstr(msgwin, "\nYou've already been there."); + return(FALSE); + } + else + { + int rdif = iabs(row - history[movecount-1].y); + int cdif = iabs(column - history[movecount-1].x); + + if (!((rdif == 1) && (cdif == 2)) && !((rdif == 2) && (cdif == 1))) + { + waddstr(msgwin, "\nThat's not a legal knight's move."); + return(FALSE); + } + } + + return(TRUE); +} + +static bool chkmoves (void) +/* check to see if valid moves are available */ +{ + if (chksqr(rw+2,col+1)) return(TRUE); + if (chksqr(rw+2,col-1)) return(TRUE); + if (chksqr(rw-2,col+1)) return(TRUE); + if (chksqr(rw-2,col-1)) return(TRUE); + if (chksqr(rw+1,col+2)) return(TRUE); + if (chksqr(rw+1,col-2)) return(TRUE); + if (chksqr(rw-1,col+2)) return(TRUE); + if (chksqr(rw-1,col-2)) return(TRUE); + return (FALSE); +} + +static int iabs(int num) +{ + if (num < 0) return (-num); + else return (num); +} + +static bool chksqr (int r1, int c1) +{ + if ((r1 < 0) || (r1 > BDEPTH - 1)) + return(FALSE); + if ((c1 < 0) || (c1 > BWIDTH - 1)) + return(FALSE); + return (!board[r1][c1]); +} + +/* knight.c ends here */ diff --git a/test/lrtest.c b/test/lrtest.c new file mode 100644 index 00000000..17168990 --- /dev/null +++ b/test/lrtest.c @@ -0,0 +1,49 @@ +/* + * Test lower-right-hand corner access + * + * by Eric S. Raymond + * + * This can't be part of the ncurses test-program, because ncurses rips off the + * bottom line to do labels. + * + * $Id: lrtest.c,v 0.6 1997/04/26 23:47:42 tom Exp $ + */ + +#include + +int +main( + int argc GCC_UNUSED, + char *argv[] GCC_UNUSED) +{ + initscr(); + + move(LINES/2-1, 4); + if (!has_ic()) + { + addstr("Your terminal lacks the capabilities needed to address the\n"); + move(LINES/2, 4); + addstr("lower-right-hand corner of the screen.\n"); + } + else + { + addstr("This is a test of access to the lower right corner.\n"); + move(LINES/2, 4); + addstr("If the top of the box is missing, the test failed.\n"); + move(LINES/2+1, 4); + addstr("Please report this (with a copy of your terminfo entry).\n"); + move(LINES/2+2, 4); + addstr("to the ncurses maintainers, at ncurses@bsdi.com.\n"); + } + + box(stdscr, 0, 0); + move(LINES-1, COLS-1); + + refresh(); + + getch(); + endwin(); + return 0; +} + +/* lrtest.c ends here */ diff --git a/test/modules b/test/modules new file mode 100644 index 00000000..82053789 --- /dev/null +++ b/test/modules @@ -0,0 +1,37 @@ +# Test-Program modules +# $Id: modules,v 1.1 1997/02/08 22:18:23 tom Exp $ +################################################################################ +# Copyright 1997 by Thomas E. Dickey # +# All Rights Reserved. # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, provided # +# that the above copyright notice appear in all copies and that both that # +# copyright notice and this permission notice appear in supporting # +# documentation, and that the name of the above listed copyright holder(s) not # +# be used in advertising or publicity pertaining to distribution of the # +# software without specific, written prior permission. THE ABOVE LISTED # +# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT # +# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, # +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # +# PERFORMANCE OF THIS SOFTWARE. # +################################################################################ +blue progs $(srcdir) ../include/term.h +bs progs $(srcdir) +firework progs $(srcdir) ../include/term.h +gdc progs $(srcdir) +hanoi progs $(srcdir) +hashtest progs $(srcdir) +knight progs $(srcdir) +lrtest progs $(srcdir) +ncurses progs $(srcdir) ../include/panel.h ../include/menu.h ../include/form.h +newdemo progs $(srcdir) +rain progs $(srcdir) ../include/term.h +tclock progs $(srcdir) +testcurs progs $(srcdir) +view progs $(srcdir) +worm progs $(srcdir) +xmas progs $(srcdir) diff --git a/test/ncurses.c b/test/ncurses.c new file mode 100644 index 00000000..faef03dc --- /dev/null +++ b/test/ncurses.c @@ -0,0 +1,3000 @@ +/**************************************************************************** + +NAME + ncurses.c --- ncurses library exerciser + +SYNOPSIS + ncurses + +DESCRIPTION + An interactive test module for the ncurses library. + +AUTHOR + This software is Copyright (C) 1993 by Eric S. Raymond, all rights reserved. +It is issued with ncurses under the same terms and conditions as the ncurses +library source. + +$Id: ncurses.c,v 1.91 1997/05/10 18:19:48 tom Exp $ + +***************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#if HAVE_GETTIMEOFDAY +#if HAVE_SYS_TIME_H && ! SYSTEM_LOOKS_LIKE_SCO +#include +#endif +#if HAVE_SYS_SELECT_H +#include +#endif +#endif + +#if HAVE_PANEL_H +#define USE_LIBPANEL 1 +#include +#else +#define USE_LIBPANEL 0 +#endif + +#if HAVE_MENU_H && HAVE_LIBMENU +#define USE_LIBMENU 1 +#include +#else +#define USE_LIBMENU 0 +#endif + +#if HAVE_FORM_H && HAVE_LIBFORM +#define USE_LIBFORM 1 +#include +#else +#define USE_LIBFORM 0 +#endif + +#ifdef NCURSES_VERSION + +#ifdef TRACE +static int save_trace = TRACE_ORDINARY|TRACE_CALLS; +extern int _nc_tracing; +#endif + +#if !HAVE_NAPMS +#define HAVE_NAPMS 1 +#endif + +#else + +#define mmask_t chtype /* not specified in XSI */ +#define attr_t chtype /* not specified in XSI */ +#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 */ + +#endif + +#define P(string) printw("%s\n", string) +#ifndef CTRL +#define CTRL(x) ((x) & 0x1f) +#endif + +#define SIZEOF(table) (sizeof(table)/sizeof(table[0])) +#define QUIT CTRL('Q') +#define ESCAPE CTRL('[') +#define BLANK ' ' /* this is the background character */ + +/* The behavior of mvhline, mvvline for negative/zero length is unspecified, + * though we can rely on negative x/y values to stop the macro. + */ +static void do_h_line(int y, int x, chtype c, int to) +{ + if ((to) > (x)) + mvhline(y, x, c, (to) - (x)); +} + +static void do_v_line(int y, int x, chtype c, int to) +{ + if ((to) > (y)) + mvvline(y, x, c, (to) - (y)); +} + +/* Common function to allow ^T to toggle trace-mode in the middle of a test + * so that trace-files can be made smaller. + */ +static int wGetchar(WINDOW *win) +{ + int c; +#ifdef TRACE + while ((c = wgetch(win)) == CTRL('T')) { + if (_nc_tracing) { + save_trace = _nc_tracing; + _tracef("TOGGLE-TRACING OFF"); + _nc_tracing = 0; + } else { + _nc_tracing = save_trace; + } + trace(_nc_tracing); + if (_nc_tracing) + _tracef("TOGGLE-TRACING ON"); + } +#else + c = wgetch(win); +#endif + return c; +} +#define Getchar() wGetchar(stdscr) + +static void Pause(void) +{ + move(LINES - 1, 0); + addstr("Press any key to continue... "); + (void) Getchar(); +} + +static void Cannot(const char *what) +{ + printw("\nThis %s terminal %s\n\n", getenv("TERM"), what); + Pause(); +} + +static void ShellOut(bool message) +{ + if (message) + addstr("Shelling out..."); + def_prog_mode(); + endwin(); + system("sh"); + if (message) + addstr("returned from shellout.\n"); + refresh(); +} + +/**************************************************************************** + * + * Character input test + * + ****************************************************************************/ + +static void getch_test(void) +/* test the keypad feature */ +{ +char buf[BUFSIZ]; +int c; +int incount = 0, firsttime = 0; +bool blocking = TRUE; +int y, x; + + refresh(); + +#ifdef NCURSES_MOUSE_VERSION + mousemask(ALL_MOUSE_EVENTS, (mmask_t *)0); +#endif + + (void) printw("Delay in 10ths of a second ( for blocking input)? "); + echo(); + getstr(buf); + noecho(); + nonl(); + + if (isdigit(buf[0])) + { + timeout(atoi(buf) * 100); + blocking = FALSE; + } + + c = '?'; + raw(); + for (;;) + { + if (firsttime++) + { + printw("Key pressed: %04o ", c); +#ifdef NCURSES_MOUSE_VERSION + if (c == KEY_MOUSE) + { + MEVENT event; + + getmouse(&event); + printw("KEY_MOUSE, %s\n", _tracemouse(&event)); + } + else +#endif /* NCURSES_MOUSE_VERSION */ + if (c >= KEY_MIN) + { + (void) addstr(keyname(c)); + addch('\n'); + } + else if (c > 0x80) + { + int c2 = (c & 0x7f); + if (isprint(c2)) + (void) printw("M-%c", c2); + else + (void) printw("M-%s", unctrl(c2)); + addstr(" (high-half character)\n"); + } + else + { + if (isprint(c)) + (void) printw("%c (ASCII printable character)\n", c); + else + (void) printw("%s (ASCII control character)\n", unctrl(c)); + } + getyx(stdscr, y, x); + if (y >= LINES-1) + move(0,0); + clrtoeol(); + } + + if (c == 'g') + { + addstr("getstr test: "); + echo(); getstr(buf); noecho(); + printw("I saw `%s'.\n", buf); + } + if (c == 's') + { + ShellOut(TRUE); + } + if (c == 'x' || c == 'q' || (c == ERR && blocking)) + break; + if (c == '?') + { + addstr("Type any key to see its keypad value. Also:\n"); + addstr("g -- triggers a getstr test\n"); + addstr("s -- shell out\n"); + addstr("q -- quit\n"); + addstr("? -- repeats this help message\n"); + } + + while ((c = Getchar()) == ERR) + if (!blocking) + (void) printw("%05d: input timed out\n", incount++); + else { + (void) printw("%05d: input error\n", incount++); + break; + } + } + +#ifdef NCURSES_MOUSE_VERSION + mousemask(0, (mmask_t *)0); +#endif + timeout(-1); + erase(); + noraw(); + nl(); + endwin(); +} + +static int show_attr(int row, chtype attr, const char *name, bool once, const char *capname) +{ + mvprintw(row, 8, "%s mode:", name); + mvprintw(row, 24, "|"); + if (once) + attron(attr); + else + attrset(attr); + addstr("abcde fghij klmno pqrst uvwxy z"); + if (once) + attroff(attr); + printw("|"); + if (capname != 0 && tigetstr(capname) == 0) + printw(" (N/A)"); + return row + 2; +} + +static void attr_test(void) +/* test text attributes */ +{ + int row = 2; + refresh(); + + mvaddstr(0, 20, "Character attribute test display"); + + row = show_attr(row, A_STANDOUT, "STANDOUT", TRUE, "smso"); + row = show_attr(row, A_REVERSE, "REVERSE", TRUE, "rev"); + row = show_attr(row, A_BOLD, "BOLD", TRUE, "bold"); + row = show_attr(row, A_UNDERLINE, "UNDERLINE", TRUE, "smul"); + row = show_attr(row, A_DIM, "DIM", TRUE, "dim"); + row = show_attr(row, A_BLINK, "BLINK", TRUE, "blink"); + row = show_attr(row, A_PROTECT, "PROTECT", TRUE, "prot"); + row = show_attr(row, A_INVIS, "INVISIBLE", TRUE, "invis"); + row = show_attr(row, A_NORMAL, "NORMAL", FALSE,0); + + mvprintw(row, 8, + "This terminal does %shave the magic-cookie glitch", + tigetnum("xmc") > -1 ? "" : "not "); + + refresh(); + + Pause(); + + erase(); + endwin(); +} + +/**************************************************************************** + * + * Color support tests + * + ****************************************************************************/ + +static NCURSES_CONST char *colors[] = +{ + "black", + "red", + "green", + "yellow", + "blue", + "magenta", + "cyan", + "white" +}; + +static void color_test(void) +/* generate a color test pattern */ +{ + int i; + + refresh(); + (void) printw("There are %d color pairs\n", COLOR_PAIRS); + + (void) mvprintw(1, 0, + "%dx%d matrix of foreground/background colors, bright *off*\n", + COLORS, COLORS); + for (i = 0; i < COLORS; i++) + mvaddstr(2, (i+1) * 8, colors[i]); + for (i = 0; i < COLORS; i++) + mvaddstr(3 + i, 0, colors[i]); + for (i = 1; i < COLOR_PAIRS; i++) + { + init_pair(i, i % COLORS, i / COLORS); + attron((attr_t)COLOR_PAIR(i)); + mvaddstr(3 + (i / COLORS), (i % COLORS + 1) * 8, "Hello"); + attrset(A_NORMAL); + } + + (void) mvprintw(COLORS + 4, 0, + "%dx%d matrix of foreground/background colors, bright *on*\n", + COLORS, COLORS); + for (i = 0; i < COLORS; i++) + mvaddstr(5 + COLORS, (i+1) * 8, colors[i]); + for (i = 0; i < COLORS; i++) + mvaddstr(6 + COLORS + i, 0, colors[i]); + for (i = 1; i < COLOR_PAIRS; i++) + { + init_pair(i, i % COLORS, i / COLORS); + attron((attr_t)(COLOR_PAIR(i) | A_BOLD)); + mvaddstr(6 + COLORS + (i / COLORS), (i % COLORS + 1) * 8, "Hello"); + attrset(A_NORMAL); + } + + Pause(); + + erase(); + endwin(); +} + +static void change_color(int current, int field, int value, int usebase) +{ + short red, green, blue; + + if (usebase) + color_content(current, &red, &green, &blue); + else + red = green = blue = 0; + + switch (field) { + case 0: + red += value; + break; + case 1: + green += value; + break; + case 2: + blue += value; + break; + } + + if (init_color(current, red, green, blue) == ERR) + beep(); +} + +static void color_edit(void) +/* display the color test pattern, without trying to edit colors */ +{ + int i, this_c = 0, value = 0, current = 0, field = 0; + int last_c; + + refresh(); + + for (i = 0; i < COLORS; i++) + init_pair(i, COLOR_WHITE, i); + + mvprintw(LINES-2, 0, "Number: %d", value); + + do { + short red, green, blue; + + attron(A_BOLD); + mvaddstr(0, 20, "Color RGB Value Editing"); + attroff(A_BOLD); + + for (i = 0; i < COLORS; i++) + { + mvprintw(2 + i, 0, "%c %-8s:", + (i == current ? '>' : ' '), + (i < (int) SIZEOF(colors) + ? colors[i] : "")); + attrset(COLOR_PAIR(i)); + addstr(" "); + attrset(A_NORMAL); + + /* + * Note: this refresh should *not* be necessary! It works around + * a bug in attribute handling that apparently causes the A_NORMAL + * attribute sets to interfere with the actual emission of the + * color setting somehow. This needs to be fixed. + */ + refresh(); + + color_content(i, &red, &green, &blue); + addstr(" R = "); + if (current == i && field == 0) attron(A_STANDOUT); + printw("%04d", red); + if (current == i && field == 0) attrset(A_NORMAL); + addstr(", G = "); + if (current == i && field == 1) attron(A_STANDOUT); + printw("%04d", green); + if (current == i && field == 1) attrset(A_NORMAL); + addstr(", B = "); + if (current == i && field == 2) attron(A_STANDOUT); + printw("%04d", blue); + if (current == i && field == 2) attrset(A_NORMAL); + attrset(A_NORMAL); + addstr(")"); + } + + mvaddstr(COLORS + 3, 0, + "Use up/down to select a color, left/right to change fields."); + mvaddstr(COLORS + 4, 0, + "Modify field by typing nnn=, nnn-, or nnn+. ? for help."); + + move(2 + current, 0); + + last_c = this_c; + this_c = Getchar(); + if (isdigit(this_c) && !isdigit(last_c)) + value = 0; + + switch (this_c) + { + case KEY_UP: + current = (current == 0 ? (COLORS - 1) : current - 1); + break; + + case KEY_DOWN: + current = (current == (COLORS - 1) ? 0 : current + 1); + break; + + case KEY_RIGHT: + field = (field == 2 ? 0 : field + 1); + break; + + case KEY_LEFT: + field = (field == 0 ? 2 : field - 1); + break; + + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + value = value * 10 + (this_c - '0'); + break; + + case '+': + change_color(current, field, value, 1); + break; + + case '-': + change_color(current, field, -value, 1); + break; + + case '=': + change_color(current, field, value, 0); + break; + + case '?': + erase(); + P(" RGB Value Editing Help"); + P(""); + P("You are in the RGB value editor. Use the arrow keys to select one of"); + P("the fields in one of the RGB triples of the current colors; the one"); + P("currently selected will be reverse-video highlighted."); + P(""); + P("To change a field, enter the digits of the new value; they are echoed"); + P("echoed. Finish by typing `='; the change will take effect instantly."); + P("To increment or decrement a value, use the same procedure, but finish"); + P("with a `+' or `-'."); + P(""); + P("To quit, do `x' or 'q'"); + + Pause(); + erase(); + break; + + case 'x': + case 'q': + break; + + default: + beep(); + break; + } + mvprintw(LINES-2, 0, "Number: %d", value); + clrtoeol(); + } while + (this_c != 'x' && this_c != 'q'); + + erase(); + endwin(); +} + +/**************************************************************************** + * + * Soft-key label test + * + ****************************************************************************/ + +static void slk_test(void) +/* exercise the soft keys */ +{ + int c, fmt = 1; + char buf[9]; + + c = CTRL('l'); + do { + move(0, 0); + switch(c) + { + case CTRL('l'): + erase(); + attron(A_BOLD); + mvaddstr(0, 20, "Soft Key Exerciser"); + attroff(A_BOLD); + + move(2, 0); + P("Available commands are:"); + P(""); + P("^L -- refresh screen"); + P("a -- activate or restore soft keys"); + P("d -- disable soft keys"); + P("c -- set centered format for labels"); + P("l -- set left-justified format for labels"); + P("r -- set right-justified format for labels"); + P("[12345678] -- set label; labels are numbered 1 through 8"); + P("e -- erase stdscr (should not erase labels)"); + P("s -- test scrolling of shortened screen"); + P("x, q -- return to main menu"); + P(""); + P("Note: if activating the soft keys causes your terminal to"); + P("scroll up one line, your terminal auto-scrolls when anything"); + P("is written to the last screen position. The ncurses code"); + P("does not yet handle this gracefully."); + refresh(); + /* fall through */ + + case 'a': + slk_restore(); + break; + + case 'e': + wclear(stdscr); + break; + + case 's': + mvprintw(20, 0, "Press Q to stop the scrolling-test: "); + while ((c = Getchar()) != 'Q' && (c != ERR)) + addch((chtype)c); + break; + + case 'd': + slk_clear(); + break; + + case 'l': + fmt = 0; + break; + + case 'c': + fmt = 1; + break; + + case 'r': + fmt = 2; + break; + + case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': + (void) mvaddstr(20, 0, "Please enter the label value: "); + echo(); + wgetnstr(stdscr, buf, 8); + noecho(); + slk_set((c - '0'), buf, fmt); + slk_refresh(); + move(20, 0); clrtoeol(); + break; + + case 'x': + case 'q': + goto done; + + default: + beep(); + } + } while + ((c = Getchar()) != EOF); + + done: + erase(); + endwin(); +} + +/**************************************************************************** + * + * Alternate character-set stuff + * + ****************************************************************************/ + +/* ISO 6429: codes 0x80 to 0x9f may be control characters that cause the + * terminal to perform functions. The remaining codes can be graphic. + */ +static void show_upper_chars(int first) +{ + bool C1 = (first == 128); + int code; + int last = first + 31; + int reply; + + erase(); + attron(A_BOLD); + mvprintw(0, 20, "Display of %s Character Codes %d to %d", + C1 ? "C1" : "GR", first, last); + attroff(A_BOLD); + refresh(); + + for (code = first; code <= last; code++) { + int row = 4 + ((code - first) % 16); + int col = ((code - first) / 16) * COLS / 2; + char tmp[80]; + sprintf(tmp, "%3d (0x%x)", code, code); + mvprintw(row, col, "%*s: ", COLS/4, tmp); + if (C1) + nodelay(stdscr, TRUE); + echochar(code); + if (C1) { + /* (yes, this _is_ crude) */ + while ((reply = Getchar()) != ERR) { + addch(reply); + napms(10); + } + nodelay(stdscr, FALSE); + } + } +} + +static int show_1_acs(int n, const char *name, chtype code) +{ + const int height = 16; + int row = 4 + (n % height); + int col = (n / height) * COLS / 2; + mvprintw(row, col, "%*s : ", COLS/4, name); + addch(code); + return n + 1; +} + +static void show_acs_chars(void) +/* display the ACS character set */ +{ + int n; + +#define BOTH(name) #name, name + + erase(); + attron(A_BOLD); + mvaddstr(0, 20, "Display of the ACS Character Set"); + attroff(A_BOLD); + refresh(); + + n = show_1_acs(0, BOTH(ACS_ULCORNER)); + n = show_1_acs(n, BOTH(ACS_LLCORNER)); + n = show_1_acs(n, BOTH(ACS_URCORNER)); + n = show_1_acs(n, BOTH(ACS_LRCORNER)); + n = show_1_acs(n, BOTH(ACS_RTEE)); + n = show_1_acs(n, BOTH(ACS_LTEE)); + n = show_1_acs(n, BOTH(ACS_BTEE)); + n = show_1_acs(n, BOTH(ACS_TTEE)); + n = show_1_acs(n, BOTH(ACS_HLINE)); + n = show_1_acs(n, BOTH(ACS_VLINE)); + n = show_1_acs(n, BOTH(ACS_PLUS)); + n = show_1_acs(n, BOTH(ACS_S1)); + n = show_1_acs(n, BOTH(ACS_S9)); + n = show_1_acs(n, BOTH(ACS_DIAMOND)); + n = show_1_acs(n, BOTH(ACS_CKBOARD)); + n = show_1_acs(n, BOTH(ACS_DEGREE)); + n = show_1_acs(n, BOTH(ACS_PLMINUS)); + n = show_1_acs(n, BOTH(ACS_BULLET)); + n = show_1_acs(n, BOTH(ACS_LARROW)); + n = show_1_acs(n, BOTH(ACS_RARROW)); + n = show_1_acs(n, BOTH(ACS_DARROW)); + n = show_1_acs(n, BOTH(ACS_UARROW)); + n = show_1_acs(n, BOTH(ACS_BOARD)); + n = show_1_acs(n, BOTH(ACS_LANTERN)); + n = show_1_acs(n, BOTH(ACS_BLOCK)); + n = show_1_acs(n, BOTH(ACS_S3)); + n = show_1_acs(n, BOTH(ACS_S7)); + n = show_1_acs(n, BOTH(ACS_LEQUAL)); + n = show_1_acs(n, BOTH(ACS_GEQUAL)); + n = show_1_acs(n, BOTH(ACS_PI)); + n = show_1_acs(n, BOTH(ACS_NEQUAL)); + n = show_1_acs(n, BOTH(ACS_STERLING)); +} + +static void acs_display(void) +{ + int c = 'a'; + + do { + switch (c) { + case 'a': + show_acs_chars(); + break; + case '0': + case '1': + case '2': + case '3': + show_upper_chars((c - '0') * 32 + 128); + break; + } + mvprintw(LINES-3,0, "Note: ANSI terminals may not display C1 characters."); + mvprintw(LINES-2,0, "Select: a=ACS, 0=C1, 1,2,3=GR characters, q=quit"); + refresh(); + } while ((c = Getchar()) != 'x' && c != 'q'); + + Pause(); + erase(); + endwin(); +} + +/* + * Graphic-rendition test (adapted from vttest) + */ +static void +test_sgr_attributes(void) +{ + int pass; + + for (pass = 0; pass < 2; pass++) { + int normal = ((pass == 0 ? A_NORMAL : A_REVERSE)) | BLANK; + + /* Use non-default colors if possible to exercise bce a little */ + if (has_colors()) { + init_pair(1, COLOR_WHITE, COLOR_BLUE); + normal |= COLOR_PAIR(1); + } + bkgdset(normal); + erase(); + mvprintw( 1,20, "Graphic rendition test pattern:"); + + mvprintw( 4, 1, "vanilla"); + +#define set_sgr(mask) bkgdset((normal^(mask))); + set_sgr(A_BOLD); + mvprintw( 4,40, "bold"); + + set_sgr(A_UNDERLINE); + mvprintw( 6, 6, "underline"); + + set_sgr(A_BOLD|A_UNDERLINE); + mvprintw( 6,45, "bold underline"); + + set_sgr(A_BLINK); + mvprintw( 8, 1, "blink"); + + set_sgr(A_BLINK|A_BOLD); + mvprintw( 8,40, "bold blink"); + + set_sgr(A_UNDERLINE|A_BLINK); + mvprintw(10, 6, "underline blink"); + + set_sgr(A_BOLD|A_UNDERLINE|A_BLINK); + mvprintw(10,45, "bold underline blink"); + + set_sgr(A_REVERSE); + mvprintw(12, 1, "negative"); + + set_sgr(A_BOLD|A_REVERSE); + mvprintw(12,40, "bold negative"); + + set_sgr(A_UNDERLINE|A_REVERSE); + mvprintw(14, 6, "underline negative"); + + set_sgr(A_BOLD|A_UNDERLINE|A_REVERSE); + mvprintw(14,45, "bold underline negative"); + + set_sgr(A_BLINK|A_REVERSE); + mvprintw(16, 1, "blink negative"); + + set_sgr(A_BOLD|A_BLINK|A_REVERSE); + mvprintw(16,40, "bold blink negative"); + + set_sgr(A_UNDERLINE|A_BLINK|A_REVERSE); + mvprintw(18, 6, "underline blink negative"); + + set_sgr(A_BOLD|A_UNDERLINE|A_BLINK|A_REVERSE); + mvprintw(18,45, "bold underline blink negative"); + + bkgdset(normal); + mvprintw(LINES-2,1, "%s background. ", pass == 0 ? "Dark" : "Light"); + clrtoeol(); + Pause(); + } + + bkgdset(A_NORMAL | BLANK); + erase(); + endwin(); +} + +/**************************************************************************** + * + * Windows and scrolling tester. + * + ****************************************************************************/ + +#define BOTLINES 4 /* number of line stolen from screen bottom */ + +typedef struct +{ + int y, x; +} +pair; + +#define FRAME struct frame +FRAME +{ + FRAME *next, *last; + bool do_scroll; + bool do_keypad; + WINDOW *wind; +}; + +/* We need to know if these flags are actually set, so don't look in FRAME. + * These names are known to work with SVr4 curses as well as ncurses. + */ +static bool HaveKeypad(FRAME *curp) +{ + WINDOW *win = (curp ? curp->wind : stdscr); + return win->_use_keypad; +} + +static bool HaveScroll(FRAME *curp) +{ + WINDOW *win = (curp ? curp->wind : stdscr); + return win->_scroll; +} + +static void newwin_legend(FRAME *curp) +{ + static const struct { + const char *msg; + int code; + } legend[] = { + { "^C = create window", 0 }, + { "^N = next window", 0 }, + { "^P = previous window", 0 }, + { "^F = scroll forward", 0 }, + { "^B = scroll backward", 0 }, + { "^K = keypad(%s)", 1 }, + { "^S = scrollok(%s)", 2 }, + { "^W = save window to file", 0 }, + { "^R = restore window", 0 }, +#ifdef NCURSES_VERSION + { "^X = resize", 0 }, +#endif + { "^Q%s = exit", 3 } + }; + size_t n; + int y, x; + bool do_keypad = HaveKeypad(curp); + bool do_scroll = HaveScroll(curp); + char buf[BUFSIZ]; + + move(LINES-4, 0); + for (n = 0; n < SIZEOF(legend); n++) { + switch (legend[n].code) { + default: + strcpy(buf, legend[n].msg); + break; + case 1: + sprintf(buf, legend[n].msg, do_keypad ? "yes" : "no"); + break; + case 2: + sprintf(buf, legend[n].msg, do_scroll ? "yes" : "no"); + break; + case 3: + sprintf(buf, legend[n].msg, do_keypad ? "/ESC" : ""); + break; + } + getyx(stdscr, y, x); + addstr((COLS < (x + 3 + (int)strlen(buf))) ? "\n" : (n ? ", " : "")); + addstr(buf); + } + clrtoeol(); +} + +static void transient(FRAME *curp, NCURSES_CONST char *msg) +{ + newwin_legend(curp); + if (msg) + { + mvaddstr(LINES - 1, 0, msg); + refresh(); + napms(1000); + } + + move(LINES-1, 0); + printw("%s characters are echoed, window should %sscroll.", + HaveKeypad(curp) ? "Non-arrow" : "All other", + HaveScroll(curp) ? "" : "not " ); + clrtoeol(); +} + +static void newwin_report(FRAME *curp) +/* report on the cursor's current position, then restore it */ +{ + WINDOW *win = (curp != 0) ? curp->wind : stdscr; + int y, x; + + if (win != stdscr) + transient(curp, (char *)0); + getyx(win, y, x); + move(LINES - 1, COLS - 17); + printw("Y = %2d X = %2d", y, x); + if (win != stdscr) + refresh(); + else + wmove(win, y, x); +} + +static pair *selectcell(int uli, int ulj, int lri, int lrj) +/* arrows keys move cursor, return location at current on non-arrow key */ +{ + static pair res; /* result cell */ + int si = lri - uli + 1; /* depth of the select area */ + int sj = lrj - ulj + 1; /* width of the select area */ + int i = 0, j = 0; /* offsets into the select area */ + + res.y = uli; + res.x = ulj; + for (;;) + { + move(uli + i, ulj + j); + newwin_report((FRAME *)0); + + switch(Getchar()) + { + case KEY_UP: i += si - 1; break; + case KEY_DOWN: i++; break; + case KEY_LEFT: j += sj - 1; break; + case KEY_RIGHT: j++; break; + case QUIT: + case ESCAPE: return((pair *)0); +#ifdef NCURSES_MOUSE_VERSION + case KEY_MOUSE: + { + MEVENT event; + + getmouse(&event); + if (event.y > uli && event.x > ulj) { + i = event.y - uli; + j = event.x - ulj; + } else { + beep(); + break; + } + } + /* FALLTHRU */ +#endif + default: res.y = uli + i; res.x = ulj + j; return(&res); + } + i %= si; + j %= sj; + } +} + +static void outerbox(pair ul, pair lr, bool onoff) +/* draw or erase a box *outside* the given pair of corners */ +{ + mvaddch(ul.y-1, lr.x-1, onoff ? ACS_ULCORNER : ' '); + mvaddch(ul.y-1, lr.x+1, onoff ? ACS_URCORNER : ' '); + mvaddch(lr.y+1, lr.x+1, onoff ? ACS_LRCORNER : ' '); + mvaddch(lr.y+1, ul.x-1, onoff ? ACS_LLCORNER : ' '); + move(ul.y-1, ul.x); hline(onoff ? ACS_HLINE : ' ', lr.x - ul.x + 1); + move(ul.y, ul.x-1); vline(onoff ? ACS_VLINE : ' ', lr.y - ul.y + 1); + move(lr.y+1, ul.x); hline(onoff ? ACS_HLINE : ' ', lr.x - ul.x + 1); + move(ul.y, lr.x+1); vline(onoff ? ACS_VLINE : ' ', lr.y - ul.y + 1); +} + +static WINDOW *getwindow(void) +/* Ask user for a window definition */ +{ + WINDOW *rwindow; + pair ul, lr, *tmp; + + move(0, 0); clrtoeol(); + addstr("Use arrows to move cursor, anything else to mark corner 1"); + refresh(); + if ((tmp = selectcell(2, 1, LINES-BOTLINES-2, COLS-2)) == (pair *)0) + return((WINDOW *)0); + memcpy(&ul, tmp, sizeof(pair)); + mvaddch(ul.y-1, ul.x-1, ACS_ULCORNER); + move(0, 0); clrtoeol(); + addstr("Use arrows to move cursor, anything else to mark corner 2"); + refresh(); + if ((tmp = selectcell(ul.y, ul.x, LINES-BOTLINES-2, COLS-2)) == (pair *)0) + return((WINDOW *)0); + memcpy(&lr, tmp, sizeof(pair)); + + rwindow = subwin(stdscr, lr.y - ul.y + 1, lr.x - ul.x + 1, ul.y, ul.x); + + outerbox(ul, lr, TRUE); + refresh(); + + wrefresh(rwindow); + + move(0, 0); clrtoeol(); + return(rwindow); +} + +static void newwin_move(FRAME *curp, int dy, int dx) +{ + WINDOW *win = (curp != 0) ? curp->wind : stdscr; + int cur_y, cur_x; + int max_y, max_x; + + getyx(win, cur_y, cur_x); + getmaxyx(win, max_y, max_x); + if ((cur_x += dx) < 0) + cur_x = 0; + else if (cur_x >= max_x) + cur_x = max_x - 1; + if ((cur_y += dy) < 0) + cur_y = 0; + else if (cur_y >= max_y) + cur_y = max_y - 1; + wmove(win, cur_y, cur_x); +} + +static FRAME *delete_framed(FRAME *fp, bool showit) +{ + FRAME *np; + + fp->last->next = fp->next; + fp->next->last = fp->last; + + if (showit) { + werase(fp->wind); + wrefresh(fp->wind); + } + delwin(fp->wind); + + np = (fp == fp->next) ? 0 : fp->next; + free(fp); + return np; +} + +static void acs_and_scroll(void) +/* Demonstrate windows */ +{ + int c, i; + FILE *fp; + FRAME *current = (FRAME *)0, *neww; + WINDOW *usescr = stdscr; + +#define DUMPFILE "screendump" + +#ifdef NCURSES_MOUSE_VERSION + mousemask(BUTTON1_CLICKED, (mmask_t *)0); +#endif + c = CTRL('C'); + raw(); + do { + transient((FRAME *)0, (char *)0); + switch(c) + { + case CTRL('C'): + neww = (FRAME *) calloc(1, sizeof(FRAME)); + if ((neww->wind = getwindow()) == (WINDOW *)0) + goto breakout; + + if (current == 0) /* First element, */ + { + neww->next = neww; /* so point it at itself */ + neww->last = neww; + } + else + { + neww->next = current->next; + neww->last = current; + neww->last->next = neww; + neww->next->last = neww; + } + current = neww; + current->do_keypad = HaveKeypad(current); + current->do_scroll = HaveScroll(current); + break; + + case CTRL('N'): /* go to next window */ + if (current) + current = current->next; + break; + + case CTRL('P'): /* go to previous window */ + if (current) + current = current->last; + break; + + case CTRL('F'): /* scroll current window forward */ + if (current) + wscrl(current->wind, 1); + break; + + case CTRL('B'): /* scroll current window backwards */ + if (current) + wscrl(current->wind, -1); + break; + + case CTRL('K'): /* toggle keypad mode for current */ + if (current) { + current->do_keypad = !current->do_keypad; + keypad(current->wind, current->do_keypad); + } + break; + + case CTRL('S'): + if (current) { + current->do_scroll = !current->do_scroll; + scrollok(current->wind, current->do_scroll); + } + break; + + case CTRL('W'): /* save and delete window */ + if (current == current->next) + break; + if ((fp = fopen(DUMPFILE, "w")) == (FILE *)0) + transient(current, "Can't open screen dump file"); + else + { + (void) putwin(current->wind, fp); + (void) fclose(fp); + + current = delete_framed(current, TRUE); + } + break; + + case CTRL('R'): /* restore window */ + if ((fp = fopen(DUMPFILE, "r")) == (FILE *)0) + transient(current, "Can't open screen dump file"); + else + { + neww = (FRAME *) calloc(1, sizeof(FRAME)); + + neww->next = current->next; + neww->last = current; + neww->last->next = neww; + neww->next->last = neww; + + neww->wind = getwin(fp); + (void) fclose(fp); + + wrefresh(neww->wind); + } + break; + +#ifdef NCURSES_VERSION + case CTRL('X'): /* resize window */ + if (current) + { + pair *tmp, ul, lr; + + move(0, 0); clrtoeol(); + addstr("Use arrows to move cursor, anything else to mark new corner"); + refresh(); + + getbegyx(current->wind, ul.y, ul.x); + + tmp = selectcell(ul.y, ul.x, LINES-BOTLINES-2, COLS-2); + if (tmp == (pair *)0) + { + beep(); + break; + } + + getmaxyx(current->wind, lr.y, lr.x); + lr.y += (ul.y - 1); + lr.x += (ul.x - 1); + outerbox(ul, lr, FALSE); + wnoutrefresh(stdscr); + + /* strictly cosmetic hack for the test */ + if (current->wind->_maxy > tmp->y - ul.y) + { + getyx(current->wind, lr.y, lr.x); + wmove(current->wind, tmp->y - ul.y + 1, 0); + wclrtobot(current->wind); + wmove(current->wind, lr.y, lr.x); + } + if (current->wind->_maxx > tmp->x - ul.x) + for (i = 0; i < current->wind->_maxy; i++) + { + wmove(current->wind, i, tmp->x - ul.x + 1); + wclrtoeol(current->wind); + } + wnoutrefresh(current->wind); + + memcpy(&lr, tmp, sizeof(pair)); + (void) wresize(current->wind, lr.y-ul.y+0, lr.x-ul.x+0); + + getbegyx(current->wind, ul.y, ul.x); + getmaxyx(current->wind, lr.y, lr.x); + lr.y += (ul.y - 1); + lr.x += (ul.x - 1); + outerbox(ul, lr, TRUE); + wnoutrefresh(stdscr); + + wnoutrefresh(current->wind); + move(0, 0); clrtoeol(); + doupdate(); + } + break; +#endif /* NCURSES_VERSION */ + + case KEY_F(10): /* undocumented --- use this to test area clears */ + selectcell(0, 0, LINES - 1, COLS - 1); + clrtobot(); + refresh(); + break; + + case KEY_UP: + newwin_move(current, -1, 0); + break; + case KEY_DOWN: + newwin_move(current, 1, 0); + break; + case KEY_LEFT: + newwin_move(current, 0, -1); + break; + case KEY_RIGHT: + newwin_move(current, 0, 1); + break; + + case KEY_BACKSPACE: + /* FALLTHROUGH */ + case KEY_DC: + { + int y, x; + getyx(current->wind, y, x); + if (--x < 0) { + if (--y < 0) + break; + x = getmaxx(current->wind) - 1; + } + mvwdelch(current->wind, y, x); + } + break; + + case '\r': + c = '\n'; + /* FALLTHROUGH */ + + default: + if (current) + waddch(current->wind, (chtype)c); + else + beep(); + break; + } + newwin_report(current); + usescr = (current ? current->wind : stdscr); + wrefresh(usescr); + } while + ((c = wGetchar(usescr)) + && !((c == ESCAPE) && (usescr->_use_keypad)) + && (c != ERR)); + + breakout: + while (current != 0) + current = delete_framed(current, FALSE); + + scrollok(stdscr, TRUE); /* reset to driver's default */ +#ifdef NCURSES_MOUSE_VERSION + mousemask(0, (mmask_t *)0); +#endif + noraw(); + erase(); + endwin(); +} + +/**************************************************************************** + * + * Panels tester + * + ****************************************************************************/ + +#if USE_LIBPANEL +static PANEL *p1; +static PANEL *p2; +static PANEL *p3; +static PANEL *p4; +static PANEL *p5; +static WINDOW *w1; +static WINDOW *w2; +static WINDOW *w3; +static WINDOW *w4; +static WINDOW *w5; + +static unsigned long nap_msec = 1; + +static NCURSES_CONST char *mod[] = +{ + "test ", + "TEST ", + "(**) ", + "*()* ", + "<--> ", + "LAST " +}; + +/*+------------------------------------------------------------------------- + wait_a_while(msec) +--------------------------------------------------------------------------*/ +static void +wait_a_while(unsigned long msec GCC_UNUSED) +{ +#if HAVE_NAPMS + if(nap_msec == 1) + wGetchar(stdscr); + else + napms(nap_msec); +#else + if(nap_msec == 1) + wGetchar(stdscr); + else if(msec > 1000L) + sleep((int)msec/1000L); + else + sleep(1); +#endif +} /* end of wait_a_while */ + +/*+------------------------------------------------------------------------- + saywhat(text) +--------------------------------------------------------------------------*/ +static void +saywhat(NCURSES_CONST char *text) +{ + wmove(stdscr,LINES - 1,0); + wclrtoeol(stdscr); + waddstr(stdscr, text); +} /* end of saywhat */ + +/*+------------------------------------------------------------------------- + mkpanel(rows,cols,tly,tlx) - alloc a win and panel and associate them +--------------------------------------------------------------------------*/ +static PANEL * +mkpanel(int rows, int cols, int tly, int tlx) +{ +WINDOW *win = newwin(rows,cols,tly,tlx); +PANEL *pan; + + if(!win) + return((PANEL *)0); + if((pan = new_panel(win))) + return(pan); + delwin(win); + return((PANEL *)0); +} /* end of mkpanel */ + +/*+------------------------------------------------------------------------- + rmpanel(pan) +--------------------------------------------------------------------------*/ +static void +rmpanel(PANEL *pan) +{ +WINDOW *win = panel_window(pan); + del_panel(pan); + delwin(win); +} /* end of rmpanel */ + +/*+------------------------------------------------------------------------- + pflush() +--------------------------------------------------------------------------*/ +static void +pflush(void) +{ + update_panels(); + doupdate(); +} /* end of pflush */ + +/*+------------------------------------------------------------------------- + fill_panel(win) +--------------------------------------------------------------------------*/ +static void +fill_panel(PANEL *pan) +{ +WINDOW *win = panel_window(pan); +int num = ((const char *)panel_userptr(pan))[1]; +int y,x; + + box(win, 0, 0); + wmove(win,1,1); + wprintw(win,"-pan%c-", num); + for(y = 2; y < getmaxy(win) - 1; y++) + { + for(x = 1; x < getmaxx(win) - 1; x++) + { + wmove(win,y,x); + waddch(win,num); + } + } +} /* end of fill_panel */ + +static void demo_panels(void) +{ +int itmp; +register y,x; + + refresh(); + + for(y = 0; y < LINES - 1; y++) + { + for(x = 0; x < COLS; x++) + wprintw(stdscr,"%d",(y + x) % 10); + } + for(y = 0; y < 5; y++) + { + p1 = mkpanel(LINES/2 - 2, COLS/8 + 1, 0, 0); + w1 = panel_window(p1); + set_panel_userptr(p1,"p1"); + + p2 = mkpanel(LINES/2 + 1, COLS/7, LINES/4, COLS/10); + w2 = panel_window(p2); + set_panel_userptr(p2,"p2"); + + p3 = mkpanel(LINES/4, COLS/10, LINES/2, COLS/9); + w3 = panel_window(p3); + set_panel_userptr(p3,"p3"); + + p4 = mkpanel(LINES/2 - 2, COLS/8, LINES/2 - 2, COLS/3); + w4 = panel_window(p4); + set_panel_userptr(p4,"p4"); + + p5 = mkpanel(LINES/2 - 2, COLS/8, LINES/2, COLS/2 - 2); + w5 = panel_window(p5); + set_panel_userptr(p5,"p5"); + + fill_panel(p1); + fill_panel(p2); + fill_panel(p3); + fill_panel(p4); + fill_panel(p5); + hide_panel(p4); + hide_panel(p5); + pflush(); + saywhat("press any key to continue"); + wait_a_while(nap_msec); + + saywhat("h3 s1 s2 s4 s5; press any key to continue"); + move_panel(p1,0,0); + hide_panel(p3); + show_panel(p1); + show_panel(p2); + show_panel(p4); + show_panel(p5); + pflush(); + wait_a_while(nap_msec); + + saywhat("s1; press any key to continue"); + show_panel(p1); + pflush(); + wait_a_while(nap_msec); + + saywhat("s2; press any key to continue"); + show_panel(p2); + pflush(); + wait_a_while(nap_msec); + + saywhat("m2; press any key to continue"); + move_panel(p2, LINES/3 + 1, COLS / 8); + pflush(); + wait_a_while(nap_msec); + + saywhat("s3;"); + show_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("m3; press any key to continue"); + move_panel(p3, LINES/4 + 1, COLS / 15); + pflush(); + wait_a_while(nap_msec); + + saywhat("b3; press any key to continue"); + bottom_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("s4; press any key to continue"); + show_panel(p4); + pflush(); + wait_a_while(nap_msec); + + saywhat("s5; press any key to continue"); + show_panel(p5); + pflush(); + wait_a_while(nap_msec); + + saywhat("t3; press any key to continue"); + top_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("t1; press any key to continue"); + top_panel(p1); + pflush(); + wait_a_while(nap_msec); + + saywhat("t2; press any key to continue"); + top_panel(p2); + pflush(); + wait_a_while(nap_msec); + + saywhat("t3; press any key to continue"); + top_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("t4; press any key to continue"); + top_panel(p4); + pflush(); + wait_a_while(nap_msec); + + for(itmp = 0; itmp < 6; itmp++) + { + saywhat("m4; press any key to continue"); + wmove(w4, LINES/8, 1); + waddstr(w4,mod[itmp]); + move_panel(p4, LINES/6, itmp*(COLS/8)); + wmove(w5, LINES/6, 1); + waddstr(w5,mod[itmp]); + pflush(); + wait_a_while(nap_msec); + saywhat("m5; press any key to continue"); + wmove(w4, LINES/6, 1); + waddstr(w4,mod[itmp]); + move_panel(p5, LINES/3 - 1,(itmp*10) + 6); + wmove(w5, LINES/8, 1); + waddstr(w5,mod[itmp]); + pflush(); + wait_a_while(nap_msec); + } + + saywhat("m4; press any key to continue"); + move_panel(p4, LINES/6, itmp*(COLS/8)); + pflush(); + wait_a_while(nap_msec); + + saywhat("t5; press any key to continue"); + top_panel(p5); + pflush(); + wait_a_while(nap_msec); + + saywhat("t2; press any key to continue"); + top_panel(p2); + pflush(); + wait_a_while(nap_msec); + + saywhat("t1; press any key to continue"); + top_panel(p1); + pflush(); + wait_a_while(nap_msec); + + saywhat("d2; press any key to continue"); + rmpanel(p2); + pflush(); + wait_a_while(nap_msec); + + saywhat("h3; press any key to continue"); + hide_panel(p3); + pflush(); + wait_a_while(nap_msec); + + saywhat("d1; press any key to continue"); + rmpanel(p1); + pflush(); + wait_a_while(nap_msec); + + saywhat("d4; press any key to continue"); + rmpanel(p4); + pflush(); + wait_a_while(nap_msec); + + saywhat("d5; press any key to continue"); + rmpanel(p5); + pflush(); + wait_a_while(nap_msec); + if(nap_msec == 1) + break; + nap_msec = 100L; + } + + erase(); + endwin(); +} + +/**************************************************************************** + * + * Pad tester + * + ****************************************************************************/ + +#define GRIDSIZE 3 + +static bool show_panner_legend = TRUE; + +static int panner_legend(int line) +{ + static const char *const legend[] = { + "Use arrow keys (or U,D,L,R) to pan, q to quit (?,t,s flags)", + "Use ! to shell-out. Toggle legend:?, timer:t, scroll mark:s.", + "Use +,- (or j,k) to grow/shrink the panner vertically.", + "Use <,> (or h,l) to grow/shrink the panner horizontally." + }; + int n = (SIZEOF(legend) - (LINES - line)); + if (line < LINES && (n >= 0)) { + move(line, 0); + if (show_panner_legend) + printw("%s", legend[n]); + clrtoeol(); + return show_panner_legend; + } + return FALSE; +} + +static void panner_h_cleanup(int from_y, int from_x, int to_x) +{ + if (!panner_legend(from_y)) + do_h_line(from_y, from_x, ' ', to_x); +} + +static void panner_v_cleanup(int from_y, int from_x, int to_y) +{ + if (!panner_legend(from_y)) + do_v_line(from_y, from_x, ' ', to_y); +} + +static void panner(WINDOW *pad, + int top_x, int top_y, int porty, int portx, + int (*pgetc)(WINDOW *)) +{ +#if HAVE_GETTIMEOFDAY + struct timeval before, after; + bool timing = TRUE; +#endif + bool scrollers = TRUE; + int basex = 0; + int basey = 0; + int pxmax, pymax, lowend, highend, c; + + getmaxyx(pad, pymax, pxmax); + scrollok(stdscr, FALSE); /* we don't want stdscr to scroll! */ + + c = KEY_REFRESH; + do { +#ifdef NCURSES_VERSION + /* + * During shell-out, the user may have resized the window. Adjust + * the port size of the pad to accommodate this. Ncurses automatically + * resizes all of the normal windows to fit on the new screen. + */ + if (top_x > COLS) top_x = COLS; + if (portx > COLS) portx = COLS; + if (top_y > LINES) top_y = LINES; + if (porty > LINES) porty = LINES; +#endif + switch(c) + { + case KEY_REFRESH: + erase(); + + /* FALLTHRU */ + case '?': + if (c == '?') + show_panner_legend = !show_panner_legend; + panner_legend(LINES - 4); + panner_legend(LINES - 3); + panner_legend(LINES - 2); + panner_legend(LINES - 1); + break; +#if HAVE_GETTIMEOFDAY + case 't': + timing = !timing; + if (!timing) + panner_legend(LINES-1); + break; +#endif + case 's': + scrollers = !scrollers; + break; + + /* Move the top-left corner of the pad, keeping the bottom-right + * corner fixed. + */ + case 'h': /* increase-columns: move left edge to left */ + if (top_x <= 0) + beep(); + else + { + panner_v_cleanup(top_y, top_x, porty); + top_x--; + } + break; + + case 'j': /* decrease-lines: move top-edge down */ + if (top_y >= porty) + beep(); + else + { + panner_h_cleanup(top_y - 1, top_x - (top_x > 0), portx); + top_y++; + } + break; + + case 'k': /* increase-lines: move top-edge up */ + if (top_y <= 0) + beep(); + else + { + top_y--; + panner_h_cleanup(top_y, top_x, portx); + } + break; + + case 'l': /* decrease-columns: move left-edge to right */ + if (top_x >= portx) + beep(); + else + { + panner_v_cleanup(top_y - (top_y > 0), top_x - 1, porty); + top_x++; + } + break; + + /* Move the bottom-right corner of the pad, keeping the top-left + * corner fixed. + */ + case KEY_IC: /* increase-columns: move right-edge to right */ + if (portx >= pxmax || portx >= COLS) + beep(); + else + { + panner_v_cleanup(top_y - (top_y > 0), portx - 1, porty); + ++portx; + } + break; + + case KEY_IL: /* increase-lines: move bottom-edge down */ + if (porty >= pymax || porty >= LINES) + beep(); + else + { + panner_h_cleanup(porty - 1, top_x - (top_x > 0), portx); + ++porty; + } + break; + + case KEY_DC: /* decrease-columns: move bottom edge up */ + if (portx <= top_x) + beep(); + else + { + portx--; + panner_v_cleanup(top_y - (top_y > 0), portx, porty); + } + break; + + case KEY_DL: /* decrease-lines */ + if (porty <= top_y) + beep(); + else + { + porty--; + panner_h_cleanup(porty, top_x - (top_x > 0), portx); + } + break; + + case KEY_LEFT: /* pan leftwards */ + if (basex > 0) + basex--; + else + beep(); + break; + + case KEY_RIGHT: /* pan rightwards */ + if (basex + portx - (pymax > porty) < pxmax) + basex++; + else + beep(); + break; + + case KEY_UP: /* pan upwards */ + if (basey > 0) + basey--; + else + beep(); + break; + + case KEY_DOWN: /* pan downwards */ + if (basey + porty - (pxmax > portx) < pymax) + basey++; + else + beep(); + break; + + default: + beep(); + break; + } + + mvaddch(top_y - 1, top_x - 1, ACS_ULCORNER); + do_v_line(top_y, top_x - 1, ACS_VLINE, porty); + do_h_line(top_y - 1, top_x, ACS_HLINE, portx); + + if (scrollers && (pxmax > portx - 1)) { + int length = (portx - top_x - 1); + float ratio = ((float) length) / ((float) pxmax); + + lowend = top_x + (basex * ratio); + highend = top_x + ((basex + length) * ratio); + + do_h_line(porty - 1, top_x, ACS_HLINE, lowend); + if (highend < portx) { + attron(A_REVERSE); + do_h_line(porty - 1, lowend, ' ', highend + 1); + attroff(A_REVERSE); + do_h_line(porty - 1, highend + 1, ACS_HLINE, portx); + } + } else + do_h_line(porty - 1, top_x, ACS_HLINE, portx); + + if (scrollers && (pymax > porty - 1)) { + int length = (porty - top_y - 1); + float ratio = ((float) length) / ((float) pymax); + + lowend = top_y + (basey * ratio); + highend = top_y + ((basey + length) * ratio); + + do_v_line(top_y, portx - 1, ACS_VLINE, lowend); + if (highend < porty) { + attron(A_REVERSE); + do_v_line(lowend, portx - 1, ' ', highend + 1); + attroff(A_REVERSE); + do_v_line(highend + 1, portx - 1, ACS_VLINE, porty); + } + } else + do_v_line(top_y, portx - 1, ACS_VLINE, porty); + + mvaddch(top_y - 1, portx - 1, ACS_URCORNER); + mvaddch(porty - 1, top_x - 1, ACS_LLCORNER); + mvaddch(porty - 1, portx - 1, ACS_LRCORNER); + +#if HAVE_GETTIMEOFDAY + gettimeofday(&before, 0); +#endif + wnoutrefresh(stdscr); + + pnoutrefresh(pad, + basey, basex, + top_y, top_x, + porty - (pxmax > portx) - 1, + portx - (pymax > porty) - 1); + + doupdate(); +#if HAVE_GETTIMEOFDAY + if (timing) { + double elapsed; + gettimeofday(&after, 0); + elapsed = (after.tv_sec + after.tv_usec / 1.0e6) + - (before.tv_sec + before.tv_usec / 1.0e6); + move(LINES-1, COLS-20); + printw("Secs: %2.03f", elapsed); + refresh(); + } +#endif + + } while + ((c = pgetc(pad)) != KEY_EXIT); + + scrollok(stdscr, TRUE); /* reset to driver's default */ +} + +static +int padgetch(WINDOW *win) +{ + int c; + + while(1) + switch(c = wGetchar(win)) + { + case '!': ShellOut(FALSE); return KEY_REFRESH; + case CTRL('r'): endwin(); refresh(); return KEY_REFRESH; + case CTRL('l'): return KEY_REFRESH; + case 'U': return(KEY_UP); + case 'D': return(KEY_DOWN); + case 'R': return(KEY_RIGHT); + case 'L': return(KEY_LEFT); + case '+': return(KEY_IL); + case '-': return(KEY_DL); + case '>': return(KEY_IC); + case '<': return(KEY_DC); + case ERR: /* FALLTHRU */ + case 'q': return(KEY_EXIT); + default: return(c); + } +} + +static void demo_pad(void) +/* Demonstrate pads. */ +{ + int i, j; + unsigned gridcount = 0; + WINDOW *panpad = newpad(200, 200); + + for (i = 0; i < 200; i++) + { + for (j = 0; j < 200; j++) + if (i % GRIDSIZE == 0 && j % GRIDSIZE == 0) + { + if (i == 0 || j == 0) + waddch(panpad, '+'); + else + waddch(panpad, (chtype)('A' + (gridcount++ % 26))); + } + else if (i % GRIDSIZE == 0) + waddch(panpad, '-'); + else if (j % GRIDSIZE == 0) + waddch(panpad, '|'); + else + waddch(panpad, ' '); + } + panner_legend(LINES - 4); + panner_legend(LINES - 3); + panner_legend(LINES - 2); + panner_legend(LINES - 1); + + keypad(panpad, TRUE); + + /* Make the pad (initially) narrow enough that a trace file won't wrap. + * We'll still be able to widen it during a test, since that's required + * for testing boundaries. + */ + panner(panpad, 2, 2, LINES - 5, COLS-15, padgetch); + + delwin(panpad); + endwin(); + erase(); +} +#endif /* USE_LIBPANEL */ + +/**************************************************************************** + * + * Tests from John Burnell's PDCurses tester + * + ****************************************************************************/ + +static void Continue (WINDOW *win) +{ + noecho(); + wmove(win, 10, 1); + mvwaddstr(win, 10, 1, " Press any key to continue"); + wrefresh(win); + wGetchar(win); +} + +static void flushinp_test(WINDOW *win) +/* Input test, adapted from John Burnell's PDCurses tester */ +{ + int w, h, bx, by, sw, sh, i; + + WINDOW *subWin; + wclear (win); + + w = win->_maxx; + h = win->_maxy; + bx = win->_begx; + by = win->_begy; + sw = w / 3; + sh = h / 3; + if((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2)) == 0) + return; + +#ifdef A_COLOR + if (has_colors()) + { + init_pair(2,COLOR_CYAN,COLOR_BLUE); + wattrset(subWin, COLOR_PAIR(2) | A_BOLD); + } + else + wattrset(subWin, A_BOLD); +#else + wattrset(subWin, A_BOLD); +#endif + box(subWin, ACS_VLINE, ACS_HLINE); + mvwaddstr(subWin, 2, 1, "This is a subwindow"); + wrefresh(win); + + nocbreak(); + mvwaddstr(win, 0, 1, "This is a test of the flushinp() call."); + + mvwaddstr(win, 2, 1, "Type random keys for 5 seconds."); + mvwaddstr(win, 3, 1, + "These should be discarded (not echoed) after the subwindow goes away."); + wrefresh(win); + + for (i = 0; i < 5; i++) + { + mvwprintw (subWin, 1, 1, "Time = %d", i); + wrefresh(subWin); + napms(1000); + flushinp(); + } + + delwin (subWin); + werase(win); + flash(); + wrefresh(win); + napms(1000); + + mvwaddstr(win, 2, 1, + "If you were still typing when the window timer expired,"); + mvwaddstr(win, 3, 1, + "or else you typed nothing at all while it was running,"); + mvwaddstr(win, 4, 1, + "test was invalid. You'll see garbage or nothing at all. "); + mvwaddstr(win, 6, 1, "Press a key"); + wmove(win, 9, 10); + wrefresh(win); + echo(); + wGetchar(win); + flushinp(); + mvwaddstr(win, 12, 0, + "If you see any key other than what you typed, flushinp() is broken."); + Continue(win); + + wmove(win, 9, 10); + wdelch(win); + wrefresh(win); + wmove(win, 12, 0); + clrtoeol(); + waddstr(win, + "What you typed should now have been deleted; if not, wdelch() failed."); + Continue(win); + + cbreak(); +} + +/**************************************************************************** + * + * Menu test + * + ****************************************************************************/ + +#if USE_LIBMENU + +#define MENU_Y 8 +#define MENU_X 8 + +static int menu_virtualize(int c) +{ + if (c == '\n' || c == KEY_EXIT) + return(MAX_COMMAND + 1); + else if (c == 'n' || c == KEY_DOWN) + return(REQ_NEXT_ITEM); + else if (c == 'p' || c == KEY_UP) + return(REQ_PREV_ITEM); + else if (c == ' ') + return(REQ_TOGGLE_ITEM); + else + return(c); +} + +static const char *animals[] = +{ + "Lions", "Tigers", "Bears", "(Oh my!)", "Newts", "Platypi", "Lemurs", + (char *)0 +}; + +static void menu_test(void) +{ + MENU *m; + ITEM *items[SIZEOF(animals)]; + ITEM **ip = items; + const char **ap; + int mrows, mcols; + WINDOW *menuwin; + + mvaddstr(0, 0, "This is the menu test:"); + mvaddstr(2, 0, " Use up and down arrow to move the select bar."); + mvaddstr(3, 0, " 'n' and 'p' act like arrows."); + mvaddstr(4, 0, " Press return to exit."); + refresh(); + + for (ap = animals; *ap; ap++) + *ip++ = new_item(*ap, ""); + *ip = (ITEM *)0; + + m = new_menu(items); + + scale_menu(m, &mrows, &mcols); + + menuwin = newwin(mrows + 2, mcols + 2, MENU_Y, MENU_X); + set_menu_win(m, menuwin); + keypad(menuwin, TRUE); + box(menuwin, 0, 0); + + set_menu_sub(m, derwin(menuwin, mrows, mcols, 1, 1)); + + post_menu(m); + + while (menu_driver(m, menu_virtualize(wGetchar(menuwin))) != E_UNKNOWN_COMMAND) + continue; + + (void) mvprintw(LINES - 2, 0, + "You chose: %s\n", item_name(current_item(m))); + (void) addstr("Press any key to continue..."); + wGetchar(stdscr); + + unpost_menu(m); + delwin(menuwin); + + free_menu(m); + for (ip = items; *ip; ip++) + free_item(*ip); +} + +#ifdef TRACE +#define T_TBL(name) { #name, name } +static struct { + const char *name; + int mask; +} t_tbl[] = { + T_TBL(TRACE_DISABLE), + T_TBL(TRACE_TIMES), + T_TBL(TRACE_TPUTS), + T_TBL(TRACE_UPDATE), + T_TBL(TRACE_MOVE), + T_TBL(TRACE_CHARPUT), + T_TBL(TRACE_ORDINARY), + T_TBL(TRACE_CALLS), + T_TBL(TRACE_VIRTPUT), + T_TBL(TRACE_IEVENT), + T_TBL(TRACE_BITS), + T_TBL(TRACE_ICALLS), + T_TBL(TRACE_CCALLS), + T_TBL(TRACE_MAXIMUM), + { (char *)0, 0 } +}; + +static char *tracetrace(int tlevel) +{ + static char *buf; + int n; + + if (buf == 0) { + size_t need = 12; + for (n = 0; t_tbl[n].name != 0; n++) + need += strlen(t_tbl[n].name) + 2; + buf = malloc(need); + } + sprintf(buf, "0x%02x = {", tlevel); + if (tlevel == 0) { + sprintf(buf + strlen(buf), "%s, ", t_tbl[0].name); + } else { + for (n = 1; t_tbl[n].name != 0; n++) + if ((tlevel & t_tbl[n].mask) == t_tbl[n].mask) + { + strcat(buf, t_tbl[n].name); + strcat(buf, ", "); + } + } + if (buf[strlen(buf) - 2] == ',') + buf[strlen(buf) - 2] = '\0'; + return(strcat(buf,"}")); +} + +/* fake a dynamically reconfigurable menu using the 0th entry to deselect + * the others + */ +static int run_trace_menu(MENU *m) +{ + ITEM **items; + ITEM *i, **p; + + for (;;) { + bool changed = FALSE; + switch (menu_driver(m, menu_virtualize(wGetchar(menu_win(m))))) { + case E_UNKNOWN_COMMAND: + return FALSE; + default: + items = menu_items(m); + i = current_item(m); + if (i == items[0]) { + if (item_value(i)) { + for (p = items+1; *p != 0; p++) + if (item_value(*p)) { + set_item_value(*p, FALSE); + changed = TRUE; + } + } + } else { + for (p = items+1; *p != 0; p++) + if (item_value(*p)) { + set_item_value(items[0], FALSE); + changed = TRUE; + break; + } + } + if (!changed) + return TRUE; + } + } +} + +static void trace_set(void) +/* interactively set the trace level */ +{ + MENU *m; + ITEM *items[SIZEOF(t_tbl)]; + ITEM **ip = items; + int mrows, mcols, newtrace; + int n; + WINDOW *menuwin; + + mvaddstr(0, 0, "Interactively set trace level:"); + mvaddstr(2, 0, " Press space bar to toggle a selection."); + mvaddstr(3, 0, " Use up and down arrow to move the select bar."); + mvaddstr(4, 0, " Press return to set the trace level."); + mvprintw(6, 0, "(Current trace level is %s)", tracetrace(_nc_tracing)); + + refresh(); + + for (n = 0; t_tbl[n].name != 0; n++) + *ip++ = new_item(t_tbl[n].name, ""); + *ip = (ITEM *)0; + + m = new_menu(items); + + set_menu_format(m, 0, 2); + scale_menu(m, &mrows, &mcols); + + menu_opts_off(m, O_ONEVALUE); + menuwin = newwin(mrows + 2, mcols + 2, MENU_Y, MENU_X); + set_menu_win(m, menuwin); + keypad(menuwin, TRUE); + box(menuwin, 0, 0); + + set_menu_sub(m, derwin(menuwin, mrows, mcols, 1, 1)); + + post_menu(m); + + for (ip = menu_items(m); *ip; ip++) { + int mask = t_tbl[item_index(*ip)].mask; + if (mask == 0) + set_item_value(*ip, _nc_tracing == 0); + else if ((mask & _nc_tracing) == mask) + set_item_value(*ip, TRUE); + } + + while (run_trace_menu(m)) + continue; + + newtrace = 0; + for (ip = menu_items(m); *ip; ip++) + if (item_value(*ip)) + newtrace |= t_tbl[item_index(*ip)].mask; + trace(newtrace); + _tracef("trace level interactively set to %s", tracetrace(_nc_tracing)); + + (void) mvprintw(LINES - 2, 0, + "Trace level is %s\n", tracetrace(_nc_tracing)); + (void) addstr("Press any key to continue..."); + wGetchar(stdscr); + + unpost_menu(m); + delwin(menuwin); + + free_menu(m); + for (ip = items; *ip; ip++) + free_item(*ip); +} +#endif /* TRACE */ +#endif /* USE_LIBMENU */ + +/**************************************************************************** + * + * Forms test + * + ****************************************************************************/ +#if USE_LIBFORM +static FIELD *make_label(int frow, int fcol, NCURSES_CONST char *label) +{ + FIELD *f = new_field(1, strlen(label), frow, fcol, 0, 0); + + if (f) + { + set_field_buffer(f, 0, label); + set_field_opts(f, field_opts(f) & ~O_ACTIVE); + } + return(f); +} + +static FIELD *make_field(int frow, int fcol, int rows, int cols) +{ + FIELD *f = new_field(rows, cols, frow, fcol, 0, 0); + + if (f) + set_field_back(f, A_UNDERLINE); + return(f); +} + +static void display_form(FORM *f) +{ + WINDOW *w; + int rows, cols; + + scale_form(f, &rows, &cols); + + if ((w =newwin(rows+2, cols+4, 0, 0)) != (WINDOW *)0) + { + set_form_win(f, w); + set_form_sub(f, derwin(w, rows, cols, 1, 2)); + box(w, 0, 0); + keypad(w, TRUE); + } + + if (post_form(f) != E_OK) + wrefresh(w); +} + +static void erase_form(FORM *f) +{ + WINDOW *w = form_win(f); + WINDOW *s = form_sub(f); + + unpost_form(f); + werase(w); + wrefresh(w); + delwin(s); + delwin(w); +} + +static int form_virtualize(WINDOW *w) +{ + static int mode = REQ_INS_MODE; + int c = wGetchar(w); + + switch(c) + { + case QUIT: + case ESCAPE: + return(MAX_FORM_COMMAND + 1); + + /* demo doesn't use these three, leave them in anyway as sample code */ + case KEY_NPAGE: + case CTRL('F'): + return(REQ_NEXT_PAGE); + case KEY_PPAGE: + return(REQ_PREV_PAGE); + + case KEY_NEXT: + case CTRL('N'): + return(REQ_NEXT_FIELD); + case KEY_PREVIOUS: + case CTRL('P'): + return(REQ_PREV_FIELD); + + case KEY_HOME: + return(REQ_FIRST_FIELD); + case KEY_END: + case KEY_LL: + return(REQ_LAST_FIELD); + + case CTRL('L'): + return(REQ_LEFT_FIELD); + case CTRL('R'): + return(REQ_RIGHT_FIELD); + case CTRL('U'): + return(REQ_UP_FIELD); + case CTRL('D'): + return(REQ_DOWN_FIELD); + + case CTRL('W'): + return(REQ_NEXT_WORD); + case CTRL('B'): + return(REQ_PREV_WORD); + case CTRL('S'): + return(REQ_BEG_FIELD); + case CTRL('E'): + return(REQ_END_FIELD); + + case KEY_LEFT: + return(REQ_LEFT_CHAR); + case KEY_RIGHT: + return(REQ_RIGHT_CHAR); + case KEY_UP: + return(REQ_UP_CHAR); + case KEY_DOWN: + return(REQ_DOWN_CHAR); + + case CTRL('M'): + return(REQ_NEW_LINE); + case CTRL('I'): + return(REQ_INS_CHAR); + case CTRL('O'): + return(REQ_INS_LINE); + case CTRL('V'): + return(REQ_DEL_CHAR); + + case CTRL('H'): + case KEY_BACKSPACE: + return(REQ_DEL_PREV); + case CTRL('Y'): + return(REQ_DEL_LINE); + case CTRL('G'): + return(REQ_DEL_WORD); + + case CTRL('C'): + return(REQ_CLR_EOL); + case CTRL('K'): + return(REQ_CLR_EOF); + case CTRL('X'): + return(REQ_CLR_FIELD); + case CTRL('A'): + return(REQ_NEXT_CHOICE); + case CTRL('Z'): + return(REQ_PREV_CHOICE); + + case CTRL(']'): + if (mode == REQ_INS_MODE) + return(mode = REQ_OVL_MODE); + else + return(mode = REQ_INS_MODE); + + default: + return(c); + } +} + +static int my_form_driver(FORM *form, int c) +{ + if (c == (MAX_FORM_COMMAND + 1) + && form_driver(form, REQ_VALIDATION) == E_OK) + return(TRUE); + else + { + beep(); + return(FALSE); + } +} + +static void demo_forms(void) +{ + WINDOW *w; + FORM *form; + FIELD *f[10]; + int finished = 0, c; + + mvaddstr(10, 57, "Forms Entry Test"); + + move(18, 0); + addstr("Defined form-traversal keys: ^Q/ESC- exit form\n"); + addstr("^N -- go to next field ^P -- go to previous field\n"); + addstr("Home -- go to first field End -- go to last field\n"); + addstr("^L -- go to field to left ^R -- go to field to right\n"); + addstr("^U -- move upward to field ^D -- move downward to field\n"); + addstr("^W -- go to next word ^B -- go to previous word\n"); + addstr("^S -- go to start of field ^E -- go to end of field\n"); + addstr("^H -- delete previous char ^Y -- delete line\n"); + addstr("^G -- delete current word ^C -- clear to end of line\n"); + addstr("^K -- clear to end of field ^X -- clear field\n"); + addstr("Arrow keys move within a field as you would expect."); + refresh(); + + /* describe the form */ + f[0] = make_label(0, 15, "Sample Form"); + f[1] = make_label(2, 0, "Last Name"); + f[2] = make_field(3, 0, 1, 18); + f[3] = make_label(2, 20, "First Name"); + f[4] = make_field(3, 20, 1, 12); + f[5] = make_label(2, 34, "Middle Name"); + f[6] = make_field(3, 34, 1, 12); + f[7] = make_label(5, 0, "Comments"); + f[8] = make_field(6, 0, 4, 46); + f[9] = (FIELD *)0; + + form = new_form(f); + + display_form(form); + + w = form_win(form); + raw(); + while (!finished) + { + switch(form_driver(form, c = form_virtualize(w))) + { + case E_OK: + break; + case E_UNKNOWN_COMMAND: + finished = my_form_driver(form, c); + break; + default: + beep(); + break; + } + } + + erase_form(form); + + free_form(form); + for (c = 0; f[c] != 0; c++) + free_field(f[c]); + noraw(); +} +#endif /* USE_LIBFORM */ + +/**************************************************************************** + * + * Overlap test + * + ****************************************************************************/ + +static void fillwin(WINDOW *win, char ch) +{ + int y, x; + + for (y = 0; y <= win->_maxy; y++) + { + wmove(win, y, 0); + for (x = 0; x <= win->_maxx; x++) + waddch(win, ch); + } +} + +static void crosswin(WINDOW *win, char ch) +{ + int y, x; + + for (y = 0; y <= win->_maxy; y++) + { + for (x = 0; x <= win->_maxx; x++) + if (((x > win->_maxx / 3) && (x <= 2 * win->_maxx / 3)) + || (((y > win->_maxy / 3) && (y <= 2 * win->_maxy / 3)))) + { + wmove(win, y, x); + waddch(win, ch); + } + } +} + +static void overlap_test(void) +/* test effects of overlapping windows */ +{ + int ch; + + WINDOW *win1 = newwin(9, 20, 3, 3); + WINDOW *win2 = newwin(9, 20, 9, 16); + + refresh(); + move(0, 0); + printw("This test shows the behavior of wnoutrefresh() with respect to\n"); + printw("the shared region of two overlapping windows A and B. The cross\n"); + printw("pattern in each window does not overlap the other.\n"); + + + move(18, 0); + printw("a = refresh A, then B, then doupdate. b = refresh B, then A, then doupdaute\n"); + printw("c = fill window A with letter A. d = fill window B with letter B.\n"); + printw("e = cross pattern in window A. f = cross pattern in window B.\n"); + printw("g = clear window A. h = clear window B.\n"); + printw("i = overwrite A onto B. j = overwrite B onto A.\n"); + printw("^Q/ESC = terminate test."); + + while ((ch = Getchar()) != QUIT && ch != ESCAPE) + switch (ch) + { + case 'a': /* refresh window A first, then B */ + wnoutrefresh(win1); + wnoutrefresh(win2); + doupdate(); + break; + + case 'b': /* refresh window B first, then A */ + wnoutrefresh(win2); + wnoutrefresh(win1); + doupdate(); + break; + + case 'c': /* fill window A so it's visible */ + fillwin(win1, 'A'); + break; + + case 'd': /* fill window B so it's visible */ + fillwin(win2, 'B'); + break; + + case 'e': /* cross test pattern in window A */ + crosswin(win1, 'A'); + break; + + case 'f': /* cross test pattern in window A */ + crosswin(win2, 'B'); + break; + + case 'g': /* clear window A */ + wclear(win1); + wmove(win1, 0, 0); + break; + + case 'h': /* clear window B */ + wclear(win2); + wmove(win2, 0, 0); + break; + + case 'i': /* overwrite A onto B */ + overwrite(win1, win2); + break; + + case 'j': /* overwrite B onto A */ + overwrite(win2, win1); + break; + } + + delwin(win2); + delwin(win1); + erase(); + endwin(); +} + +/**************************************************************************** + * + * Main sequence + * + ****************************************************************************/ + +static bool +do_single_test(const char c) +/* perform a single specified test */ +{ + switch (c) + { + case 'a': + getch_test(); + break; + + case 'b': + attr_test(); + break; + + case 'c': + if (!has_colors()) + Cannot("does not support color."); + else + color_test(); + break; + + case 'd': + if (!has_colors()) + Cannot("does not support color."); + else if (!can_change_color()) + Cannot("has hardwired color values."); + else + color_edit(); + break; + + case 'e': + slk_test(); + break; + + case 'f': + acs_display(); + break; + +#if USE_LIBPANEL + case 'o': + demo_panels(); + break; +#endif + + case 'g': + acs_and_scroll(); + break; + + case 'i': + flushinp_test(stdscr); + break; + + case 'k': + test_sgr_attributes(); + break; + +#if USE_LIBMENU + case 'm': + menu_test(); + break; +#endif + +#if USE_LIBPANEL + case 'p': + demo_pad(); + break; +#endif + +#if USE_LIBFORM + case 'r': + demo_forms(); + break; +#endif + + case 's': + overlap_test(); + break; + +#if USE_LIBMENU && defined(TRACE) + case 't': + trace_set(); + break; +#endif + + case '?': + (void) puts("This is the ncurses capability tester."); + (void) puts("You may select a test from the main menu by typing the"); + (void) puts("key letter of the choice (the letter to left of the =)"); + (void) puts("at the > prompt. The commands `x' or `q' will exit."); + break; + + default: + return FALSE; + } + + return TRUE; +} + +static void +usage(void) +{ + static const char *const tbl[] = { + "Usage: ncurses [options]" + ,"" + ,"Options:" + ," -e fmt specify format for soft-keys test (e)" + ," -f rip-off footer line (can repeat)" + ," -h rip-off header line (can repeat)" + ," -s msec specify nominal time for panel-demo (default: 1, to hold)" +#ifdef TRACE + ," -t mask specify default trace-level (may toggle with ^T)" +#endif + }; + size_t n; + for (n = 0; n < sizeof(tbl)/sizeof(tbl[0]); n++) + fprintf(stderr, "%s\n", tbl[n]); + exit(EXIT_FAILURE); +} + +static void +set_terminal_modes(void) +{ + noraw(); + cbreak(); + noecho(); + scrollok(stdscr, TRUE); + idlok(stdscr, TRUE); + keypad(stdscr, TRUE); +} + +#ifdef SIGUSR1 +static RETSIGTYPE announce_sig(int sig) +{ + (void) fprintf(stderr, "Handled signal %d\r\n", sig); +} +#endif + +static int rip_footer(WINDOW *win, int columns) +{ + wbkgd(win, A_REVERSE); + werase(win); + wmove(win, 0, 0); + wprintw(win, "footer: %d columns", columns); + wnoutrefresh(win); + return OK; +} + +static int rip_header(WINDOW *win, int columns) +{ + wbkgd(win, A_REVERSE); + werase(win); + wmove(win, 0, 0); + wprintw(win, "header: %d columns", columns); + wnoutrefresh(win); + return OK; +} + +/*+------------------------------------------------------------------------- + main(argc,argv) +--------------------------------------------------------------------------*/ + +int +main(int argc, char *argv[]) +{ + int command, c; + int my_e_param = 1; + + while ((c = getopt(argc, argv, "e:fhs:t:")) != EOF) { + switch (c) { + case 'e': + my_e_param = atoi(optarg); +#ifdef NCURSES_VERSION + if (my_e_param > 3) /* allow extended layouts */ + usage(); +#else + if (my_e_param > 1) + usage(); +#endif + break; + case 'f': + ripoffline(-1, rip_footer); + break; + case 'h': + ripoffline(1, rip_header); + break; + case 's': + nap_msec = atol(optarg); + break; +#ifdef TRACE + case 't': + save_trace = atoi(optarg); + break; +#endif + default: + usage(); + } + } + + /* + * If there's no menus (unlikely for ncurses!), then we'll have to set + * tracing on initially, just in case the user wants to test something that + * doesn't involve wGetchar. + */ +#ifdef TRACE + /* enable debugging */ +#if !USE_LIBMENU + trace(save_trace); +#else + if (!isatty(fileno(stdin))) + trace(save_trace); +#endif /* USE_LIBMENU */ +#endif /* TRACE */ + + /* tell it we're going to play with soft keys */ + slk_init(my_e_param); + +#ifdef SIGUSR1 + /* set up null signal catcher so we can see what interrupts to getch do */ + signal(SIGUSR1, announce_sig); +#endif + + /* we must initialize the curses data structure only once */ + initscr(); + bkgdset(BLANK); + + /* tests, in general, will want these modes */ + start_color(); + set_terminal_modes(); + def_prog_mode(); + + /* + * Return to terminal mode, so we're guaranteed of being able to + * select terminal commands even if the capabilities are wrong. + */ + endwin(); + + (void) puts("Welcome to ncurses. Press ? for help."); + + do { + (void) puts("This is the ncurses main menu"); + (void) puts("a = keyboard and mouse input test"); + (void) puts("b = character attribute test"); + (void) puts("c = color test pattern"); + (void) puts("d = edit RGB color values"); + (void) puts("e = exercise soft keys"); + (void) puts("f = display ACS characters"); + (void) puts("g = display windows and scrolling"); + (void) puts("i = test of flushinp()"); + (void) puts("k = display character attributes"); +#if USE_LIBMENU + (void) puts("m = menu code test"); +#endif +#if USE_LIBPANEL + (void) puts("o = exercise panels library"); + (void) puts("p = exercise pad features"); + (void) puts("q = quit"); +#endif +#if USE_LIBFORM + (void) puts("r = exercise forms code"); +#endif + (void) puts("s = overlapping-refresh test"); +#if USE_LIBMENU && defined(TRACE) + (void) puts("t = set trace level"); +#endif + (void) puts("? = repeat this command summary"); + + (void) fputs("> ", stdout); + (void) fflush(stdout); /* necessary under SVr4 curses */ + + /* + * This used to be an 'fgets()' call. However (on Linux, at least) + * mixing stream I/O and 'read()' (used in the library) causes the + * input stream to be flushed when switching between the two. + */ + command = 0; + for(;;) { + char ch; + if (read(fileno(stdin), &ch, 1) <= 0) { + if (command == 0) + command = 'q'; + break; + } else if (command == 0 && !isspace(ch)) { + command = ch; + } else if (ch == '\n' || ch == '\r') { + if (command != 0) + break; + (void) fputs("> ", stdout); + (void) fflush(stdout); + } + } + + if (do_single_test(command)) { + /* + * This may be overkill; it's intended to reset everything back + * to the initial terminal modes so that tests don't get in + * each other's way. + */ + flushinp(); + set_terminal_modes(); + reset_prog_mode(); + clear(); + refresh(); + endwin(); + continue; + } + } while + (command != 'q'); + + ExitProgram(EXIT_SUCCESS); +} + +/* ncurses.c ends here */ diff --git a/test/newdemo.c b/test/newdemo.c new file mode 100644 index 00000000..534d3791 --- /dev/null +++ b/test/newdemo.c @@ -0,0 +1,357 @@ +/* + * newdemo.c - A demo program using PDCurses. The program illustrate + * the use of colours for text output. + * + * $Id: newdemo.c,v 1.14 1997/04/06 01:43:32 tom Exp $ + */ + +#include + +#include +#include +#include + +static int SubWinTest(WINDOW *win); +static int WaitForUser(WINDOW *win); +static int BouncingBalls(WINDOW *win); +static RETSIGTYPE trap(int); + +#define delay_output(x) napms(x) + +/* + * The Australian map + */ +const char *AusMap[16] = +{ + " A A ", + " N.T. AAAAA AAAA ", + " AAAAAAAAAAA AAAAAAAA ", + " AAAAAAAAAAAAAAAAAAAAAAAAA Qld.", + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAA ", + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ", + " AAAAAAAAAAAAAAAAAAAAAAAAAAAA ", + " AAAAAAAAAAAAAAAAAAAAAAAAA N.S.W.", + "W.A. AAAAAAAAA AAAAAA Vic.", + " AAA S.A. AA", + " A Tas.", + "" +}; + +/* + * Funny messages + */ +#define NMESSAGES 6 + +NCURSES_CONST char *messages[] = +{ + "Hello from the Land Down Under", + "The Land of crocs. and a big Red Rock", + "Where the sunflower runs along the highways", + "the dusty red roads lead one to loneliness", + "Blue sky in the morning and", + "freezing nights and twinkling stars", + "" +}; + +/* + * Main driver + */ +int +main( + int argc GCC_UNUSED, + char *argv[] GCC_UNUSED) +{ +WINDOW *win; +int w, x, y, i, j, k, len; +char buffer[80]; +const char *message; +int width, height; +chtype save[80]; +chtype c; + + initscr(); + start_color(); + cbreak(); + signal(SIGINT, trap); + width = 48; + height = 14; /* Create a drawing window */ + win = newwin(height, width, (LINES-height)/2, (COLS-width)/2); + if(win == NULL) + { endwin(); + return 1; + } + + while(1) + { init_pair(1,COLOR_WHITE,COLOR_BLUE); + wattrset(win, COLOR_PAIR(1)); + werase(win); + + init_pair(2,COLOR_RED,COLOR_RED); + wattrset(win, COLOR_PAIR(2)); + box(win, ACS_VLINE, ACS_HLINE); + wrefresh(win); + /* Do ramdom output of a character */ + wattrset(win, COLOR_PAIR(1)); + c = 'a'; + for(i=0; i < 5000; ++i) + { x = rand() % (width-2) + 1; + y = rand() % (height-2) + 1; + mvwaddch(win, y, x, c); + wrefresh(win); + nodelay(win,TRUE); + if (wgetch(win) != ERR) + break; + if(i == 2000) + { c = 'b'; + init_pair(3,COLOR_CYAN,COLOR_YELLOW); + wattron(win, COLOR_PAIR(3)); + } + } + + SubWinTest(win); + /* Erase and draw green window */ + init_pair(4,COLOR_YELLOW,COLOR_GREEN); + wbkgd(win, COLOR_PAIR(4) | A_BOLD); + wattrset(win, COLOR_PAIR(4) | A_BOLD); + werase(win); + wrefresh(win); + /* Draw RED bounding box */ + wattrset(win, COLOR_PAIR(2)); + box(win, ' ', ' '); + wrefresh(win); + /* Display Australia map */ + wattrset(win, COLOR_PAIR(4) | A_BOLD); + i = 0; + while(*AusMap[i]) + { mvwaddstr(win, i+1, 8, AusMap[i]); + wrefresh(win); + delay_output(50); + ++i; + } + + init_pair(5,COLOR_BLUE,COLOR_WHITE); + wattrset(win, COLOR_PAIR(5) | A_BLINK); + mvwaddstr(win, height-2, 6, " PDCurses 2.1 for DOS, OS/2 and Unix"); + wrefresh(win); + + /* Draw running messages */ + init_pair(6,COLOR_YELLOW,COLOR_WHITE); + wattrset(win, COLOR_PAIR(6)); + message = messages[0]; + len = strlen(message); + j = 0; + i = 2; + w = width-2; + while(j < NMESSAGES) + { strncpy(buffer, message, (size_t)(w - i)); + buffer[w-i] = 0; + mvwaddstr(win, height/2, i, buffer); + if(w - i < len) + { memset(buffer, ' ', (size_t)i); + strcpy(buffer, message + (w - i)); + buffer[strlen(buffer)] = ' '; + buffer[i-2] = '\0'; + mvwaddstr(win, height/2, 2, buffer); + } + wrefresh(win); + nodelay(win,TRUE); + if (wgetch(win) != ERR) + { flushinp(); + break; + } + mvwaddch(win, height/2, i, ' '); + i = ++i % w; + if(i < 2) + { message = messages[++j%NMESSAGES]; + memset(buffer, ' ', (size_t)(w-2)); + buffer[w-2] = 0; + mvwaddstr(win, height/2, 2, buffer); + i = 2; + } + delay_output(100); + } + + j = 0; + /* Draw running As across in RED */ + init_pair(7,COLOR_RED,COLOR_GREEN); + wattron(win, COLOR_PAIR(7)); + for(i=2; i < width - 4; ++i) + { + k = mvwinch(win, 4, i); + if (k == ERR) + break; + save[j++] = c = k; + c &= A_CHARTEXT; + mvwaddch(win, 4, i, c); + } + wrefresh(win); + + /* Put a message up wait for a key */ + i = height-2; + wattrset(win, COLOR_PAIR(5)); + mvwaddstr(win, i, 5, " Type a key to continue or 'Q' to quit "); + wrefresh(win); + + if(WaitForUser(win) == 1) + break; + + j = 0; /* Restore the old line */ + for(i=2; i < width - 4; ++i) + mvwaddch(win, 4, i, save[j++]); + wrefresh(win); + + BouncingBalls(win); + /* Put a message up wait for a key */ + i = height-2; + wattrset(win, COLOR_PAIR(5)); + mvwaddstr(win, i, 5, " Type a key to continue or 'Q' to quit "); + wrefresh(win); + if(WaitForUser(win) == 1) + break; + } + endwin(); + return 0; +} + +/* + * Test sub windows + */ +static int +SubWinTest(WINDOW *win) +{ +int w, h, sw, sh, bx, by; +WINDOW *swin1, *swin2, *swin3; + + w = win->_maxx; + h = win->_maxy; + bx = win->_begx; + by = win->_begy; + sw = w / 3; + sh = h / 3; + if((swin1 = subwin(win, sh, sw, by+3, bx+5)) == NULL) + return 1; + if((swin2 = subwin(win, sh, sw, by+4, bx+8)) == NULL) + return 1; + if((swin3 = subwin(win, sh, sw, by+5, bx+11)) == NULL) + return 1; + + init_pair(8,COLOR_RED,COLOR_BLUE); + wattrset(swin1, COLOR_PAIR(8)); + werase(swin1); + mvwaddstr(swin1, 0, 3, "Sub-window 1"); + wrefresh(swin1); + + init_pair(8,COLOR_CYAN,COLOR_MAGENTA); + wattrset(swin2, COLOR_PAIR(8)); + werase(swin2); + mvwaddstr(swin2, 0, 3, "Sub-window 2"); + wrefresh(swin2); + + init_pair(8,COLOR_YELLOW,COLOR_GREEN); + wattrset(swin3, COLOR_PAIR(8)); + werase(swin3); + mvwaddstr(swin3, 0, 3, "Sub-window 3"); + wrefresh(swin3); + + delwin(swin1); + delwin(swin2); + delwin(swin3); + WaitForUser(win); + return 0; +} + +/* + * Bouncing balls + */ +static int +BouncingBalls(WINDOW *win) +{ +int w, h; +int x1, y1, xd1, yd1; +int x2, y2, xd2, yd2; +int x3, y3, xd3, yd3; + + w = win->_maxx; + h = win->_maxy; + x1 = 2 + rand() % (w - 4); + y1 = 2 + rand() % (h - 4); + x2 = 2 + rand() % (w - 4); + y2 = 2 + rand() % (h - 4); + x3 = 2 + rand() % (w - 4); + y3 = 2 + rand() % (h - 4); + xd1 = 1; yd1 = 1; + xd2 = 1; yd2 = 0; + xd3 = 0; yd3 = 1; + nodelay(win,TRUE); + while(wgetch(win) == ERR) + { x1 = xd1 > 0 ? ++x1 : --x1; + if(x1 <= 1 || x1 >= w - 2) + xd1 = xd1 ? 0 : 1; + y1 = yd1 > 0 ? ++y1 : --y1; + if(y1 <= 1 || y1 >= h - 2) + yd1 = yd1 ? 0 : 1; + + x2 = xd2 > 0 ? ++x2 : --x2; + if(x2 <= 1 || x2 >= w - 2) + xd2 = xd2 ? 0 : 1; + y2 = yd2 > 0 ? ++y2 : --y2; + if(y2 <= 1 || y2 >= h - 2) + yd2 = yd2 ? 0 : 1; + + x3 = xd3 > 0 ? ++x3 : --x3; + if(x3 <= 1 || x3 >= w - 2) + xd3 = xd3 ? 0 : 1; + y3 = yd3 > 0 ? ++y3 : --y3; + if(y3 <= 1 || y3 >= h - 2) + yd3 = yd3 ? 0 : 1; + + init_pair(8,COLOR_RED,COLOR_BLUE); + wattrset(win, COLOR_PAIR(8)); + mvwaddch(win, y1, x1, 'O'); + init_pair(8,COLOR_BLUE,COLOR_RED); + wattrset(win, COLOR_PAIR(8)); + mvwaddch(win, y2, x2, '*'); + init_pair(8,COLOR_YELLOW,COLOR_WHITE); + wattrset(win, COLOR_PAIR(8)); + mvwaddch(win, y3, x3, '@'); + wmove(win, 0, 0); + wrefresh(win); + delay_output(100); + } + return 0; +} + +/* + * Wait for user + */ +static int WaitForUser(WINDOW *win) +{ + time_t t; + chtype key; + + nodelay(win,TRUE); + t = time((time_t *)0); + while(1) + { + if ((int)(key = wgetch(win)) != ERR) + { + if (key == 'q' || key == 'Q') + return 1; + else + return 0; + } + if (time((time_t *)0) - t > 5) + return 0; + } +} + +/* + * Trap interrupt + */ +static RETSIGTYPE trap(int sig GCC_UNUSED) +{ + endwin(); + exit(EXIT_FAILURE); +} + +/* End of DEMO.C */ diff --git a/test/rain.c b/test/rain.c new file mode 100644 index 00000000..c0b39041 --- /dev/null +++ b/test/rain.c @@ -0,0 +1,106 @@ +/* + * $Id: rain.c,v 1.8 1997/05/03 18:38:27 tom Exp $ + */ +#include + +#include /* for tparm() */ + +#include + +/* rain 11/3/1980 EPS/CITHEP */ + +#define cursor(col,row) move(row,col) + +static float ranf(void); +static void onsig(int sig); + +int +main( + int argc GCC_UNUSED, + char *argv[] GCC_UNUSED) +{ +int x, y, j; +static int xpos[5], ypos[5]; +float r; +float c; + + for (j=SIGHUP;j<=SIGTERM;j++) + if (signal(j,SIG_IGN)!=SIG_IGN) signal(j,onsig); + + initscr(); + nl(); + noecho(); + curs_set(0); + + r = (float)(LINES - 4); + c = (float)(COLS - 4); + for (j=5;--j>=0;) { + xpos[j]=(int)(c* ranf())+2; + ypos[j]=(int)(r* ranf())+2; + } + for (j=0;;) { + x=(int)(c*ranf())+2; + y=(int)(r*ranf())+2; + + cursor(x,y); addch('.'); + + cursor(xpos[j],ypos[j]); addch('o'); + + if (j==0) j=4; else --j; + cursor(xpos[j],ypos[j]); addch('O'); + + if (j==0) j=4; else --j; + cursor(xpos[j],ypos[j]-1); + addch('-'); + cursor(xpos[j]-1,ypos[j]); + addstr("|.|"); + cursor(xpos[j],ypos[j]+1); + addch('-'); + + if (j==0) j=4; else --j; + cursor(xpos[j],ypos[j]-2); + addch('-'); + cursor(xpos[j]-1,ypos[j]-1); + addstr("/ \\"); + cursor(xpos[j]-2,ypos[j]); + addstr("| O |"); + cursor(xpos[j]-1,ypos[j]+1); + addstr("\\ /"); + cursor(xpos[j],ypos[j]+2); + addch('-'); + + if (j==0) j=4; else --j; + cursor(xpos[j],ypos[j]-2); + addch(' '); + cursor(xpos[j]-1,ypos[j]-1); + addstr(" "); + cursor(xpos[j]-2,ypos[j]); + addstr(" "); + cursor(xpos[j]-1,ypos[j]+1); + addstr(" "); + cursor(xpos[j],ypos[j]+2); + addch(' '); + xpos[j]=x; ypos[j]=y; + refresh(); + napms(50); + } +} + +static void +onsig(int n GCC_UNUSED) +{ + curs_set(1); + endwin(); + exit(EXIT_FAILURE); +} + +static float +ranf(void) +{ + float rv; + long r = rand(); + + r &= 077777; + rv =((float)r/32767.); + return rv; +} diff --git a/test/tclock.c b/test/tclock.c new file mode 100644 index 00000000..b46c5998 --- /dev/null +++ b/test/tclock.c @@ -0,0 +1,177 @@ +#include "test.priv.h" + +#include +#include +#include + +/* + tclock - analog/digital clock for curses. + If it gives you joy, then + (a) I'm glad + (b) you need to get out more :-) + + This program is copyright Howard Jones, September 1994 + (ha.jones@ic.ac.uk). It may be freely distributed as + long as this copyright message remains intact, and any + modifications are clearly marked as such. [In fact, if + you modify it, I wouldn't mind the modifications back, + especially if they add any nice features. A good one + would be a precalc table for the 60 hand positions, so + that the floating point stuff can be ditched. As I said, + it was a 20 hackup minute job.] + + COMING SOON: tfishtank. Be the envy of your mac-owning + colleagues. +*/ + +/* To compile: cc -o tclock tclock.c -lcurses -lm */ + +#ifndef PI +#define PI 3.141592654 +#endif + +#define sign(_x) (_x<0?-1:1) + +/* Plot a point */ +static void +plot(int x,int y,char col) +{ + mvaddch(y,x,(chtype)col); +} + + +/* Draw a diagonal(arbitrary) line using Bresenham's alogrithm. */ +static void +dline(int from_x, int from_y, int x2, int y2, char ch) +{ + int dx,dy; + int ax,ay; + int sx,sy; + int x,y; + int d; + + dx=x2-from_x; + dy=y2-from_y; + + ax=abs(dx*2); + ay=abs(dy*2); + + sx=sign(dx); + sy=sign(dy); + + x=from_x; + y=from_y; + + if(ax>ay) + { + d=ay-(ax/2); + + while(1) + { + plot(x,y,ch); + if(x==x2) return; + + if(d>=0) + { + y+=sy; + d-=ax; + } + x+=sx; + d+=ay; + } + } + else + { + d=ax-(ay/2); + + while(1) + { + plot(x,y,ch); + if(y==y2) return; + + if(d>=0) + { + x+=sx; + d-=ay; + } + y+=sy; + d+=ax; + } + } +} + +int +main( + int argc GCC_UNUSED, + char *argv[] GCC_UNUSED) +{ + int i,cx,cy; + double mradius, hradius, mangle, hangle; + double sangle, sradius, hours; + int hdx, hdy; + int mdx, mdy; + int sdx, sdy; + time_t tim; + struct tm *t; + char szChar[10]; + + initscr(); + noecho(); + + cx=39; + cy=12; + mradius=9; + hradius=6; + sradius=8; + + for(i=0;i<12;i++) + { + sangle=(i+1)*(2.0*PI)/12.0; + sradius=10; + sdx=2.0*sradius*sin(sangle); + sdy=sradius*cos(sangle); + sprintf(szChar,"%d",i+1); + + mvaddstr((int)(cy-sdy),(int)(cx+sdx),szChar); + } + + mvaddstr(0,0,"ASCII Clock by Howard Jones (ha.jones@ic.ac.uk),1994"); + + sradius=8; + while(1) + { + sleep(1); + + tim=time(0); + t=localtime(&tim); + + hours=(t->tm_hour + (t->tm_min/60.0)); + if(hours>12.0) hours-=12.0; + + mangle=(t->tm_min)*(2*PI)/60.0; + mdx=2.0*mradius*sin(mangle); + mdy=mradius*cos(mangle); + + hangle=(hours)*(2.0*PI)/12.0; + hdx=2.0*hradius*sin(hangle); + hdy=hradius*cos(hangle); + + sangle=(t->tm_sec%60)*(2.0*PI)/60.0; + sdx=2.0*sradius*sin(sangle); + sdy=sradius*cos(sangle); + + plot(cx+sdx,cy-sdy,'O'); + dline(cx,cy,cx+hdx,cy-hdy,'.'); + dline(cx,cy,cx+mdx,cy-mdy,'#'); + + mvaddstr(23,0,ctime(&tim)); + + refresh(); + plot(cx+sdx,cy-sdy,' '); + dline(cx,cy,cx+hdx,cy-hdy,' '); + dline(cx,cy,cx+mdx,cy-mdy,' '); + + } + + return 0; +} diff --git a/test/test.priv.h b/test/test.priv.h new file mode 100644 index 00000000..4228ff6f --- /dev/null +++ b/test/test.priv.h @@ -0,0 +1,76 @@ +/****************************************************************************** + * Copyright 1996 by Thomas E. Dickey * + * All Rights Reserved. * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * + * that the above copyright notice appear in all copies and that both that * + * copyright notice and this permission notice appear in supporting * + * documentation, and that the name of the above listed copyright holder(s) * + * not be used in advertising or publicity pertaining to distribution of the * + * software without specific, written prior permission. THE ABOVE LISTED * + * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * + * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + ******************************************************************************/ +/* $Id: test.priv.h,v 1.13 1997/04/06 01:44:04 tom Exp $ */ +#if HAVE_CONFIG_H +#include +#endif + +#include +#include + +#if HAVE_UNISTD_H +#include +#endif + +#include + +#ifdef NCURSES_NOMACROS +#include +#endif + +#if HAVE_GETOPT_H +#include +#else +/* 'getopt()' may be prototyped in , but declaring its variables + * doesn't hurt. + */ +extern char *optarg; +extern int optind; +#endif /* HAVE_GETOPT_H */ + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + +#if defined(NCURSES_VERSION) && HAVE_NC_ALLOC_H +#include +#endif + +#ifndef ExitProgram +#define ExitProgram(code) return code +#endif + +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif + +/* Use this to quiet gcc's -Wwrite-strings warnings, but accommodate SVr4 + * curses which doesn't have const parameters declared (so far) in the places + * that XSI shows. + */ +#ifndef NCURSES_CONST +#define NCURSES_CONST /* nothing */ +#endif diff --git a/test/testcurs.c b/test/testcurs.c new file mode 100644 index 00000000..3e6b49f7 --- /dev/null +++ b/test/testcurs.c @@ -0,0 +1,495 @@ +/* + * + * This is a test program for the PDCurses screen package for IBM PC type + * machines. + * This program was written by John Burnell (johnb@kea.am.dsir.govt.nz) + * esr changed the usleep calls to napms calls, 7 Nov 1995 + * + * $Id: testcurs.c,v 1.14 1997/04/06 01:44:16 tom Exp $ + */ + +#include + +static void display_menu (int,int); +static int initTest (WINDOW **); +static void inputTest (WINDOW *); +static void introTest (WINDOW *); +static void outputTest (WINDOW *); +static void padTest (WINDOW *); +#ifdef __PDCURSES__ +static void resizeTest (WINDOW *); +#endif +static void scrollTest (WINDOW *); + +struct commands +{ + NCURSES_CONST char *text; + void (*function)(WINDOW *); +}; +typedef struct commands COMMAND; + +const COMMAND command[] = +{ + {"Intro Test", introTest}, + {"Pad Test", padTest}, +#ifdef __PDCURSES__ + {"Resize Test", resizeTest}, +#endif + {"Scroll Test", scrollTest}, + {"Input Test", inputTest}, + {"Output Test", outputTest} +}; +#define MAX_OPTIONS ((sizeof(command)/sizeof(command[0]))) + +int width, height; + +int +main( + int argc GCC_UNUSED, + char *argv[] GCC_UNUSED) +{ +WINDOW *win; +int key,old_option=(-1),new_option=0; +bool quit=FALSE; + +#ifdef PDCDEBUG + PDC_debug("testcurs started\n"); +#endif + if (!initTest (&win)) return EXIT_FAILURE; + +#ifdef A_COLOR + if (has_colors()) + { + init_pair(1,COLOR_WHITE,COLOR_BLUE); + wattrset(win, COLOR_PAIR(1)); + } + else + wattrset(win, A_REVERSE); +#else + wattrset(win, A_REVERSE); +#endif + + erase(); + display_menu(old_option,new_option); + while(1) + { + noecho(); + keypad(stdscr,TRUE); + raw(); + key = getch(); + switch(key) + { + case 10: + case 13: + case KEY_ENTER: + erase(); + refresh(); + (*command[new_option].function)(win); + erase(); + display_menu(old_option,new_option); + break; + case KEY_UP: + new_option = (new_option == 0) ? new_option : new_option-1; + display_menu(old_option,new_option); + break; + case KEY_DOWN: + new_option = (new_option == MAX_OPTIONS-1) ? new_option : new_option+1; + display_menu(old_option,new_option); + break; + case 'Q': + case 'q': + quit = TRUE; + break; + default: break; + } + if (quit == TRUE) + break; + } + + delwin (win); + + endwin(); + return EXIT_SUCCESS; +} + +static +void Continue (WINDOW *win) +{ + wmove(win, 10, 1); +/* wclrtoeol(win); +*/ mvwaddstr(win, 10, 1, " Press any key to continue"); + wrefresh(win); + raw(); + wgetch(win); +} + +static +int initTest (WINDOW **win) +{ +#ifdef PDCDEBUG + PDC_debug("initTest called\n"); +#endif +#ifdef NCURSES_VERSION + trace(TRACE_MAXIMUM); +#endif + initscr(); +#ifdef PDCDEBUG + PDC_debug("after initscr()\n"); +#endif +#ifdef A_COLOR + if (has_colors()) + start_color(); +#endif + width = 60; + height = 13; /* Create a drawing window */ + *win = newwin(height, width, (LINES-height)/2, (COLS-width)/2); + if(*win == NULL) + { endwin(); + return 0; + } + return 1; +} + +static void +introTest (WINDOW *win) +{ + beep (); + werase(win); + + box(win, ACS_VLINE, ACS_HLINE); + wrefresh(win); + cbreak (); + mvwaddstr(win, 1, 1, "You should have rectangle in the middle of the screen"); + mvwaddstr(win, 2, 1, "You should have heard a beep"); + Continue(win); + return; +} + +static void +scrollTest (WINDOW *win) +{ + int i; + int OldX, OldY; + const char *Message = "The window will now scroll slowly"; + + wclear(win); + mvwprintw (win, height - 2, 1, Message); + wrefresh (win); + scrollok(win, TRUE); + for (i = 1; i <= height; i++) { + napms(250); + scroll(win); + wrefresh (win); + }; + + getmaxyx (win, OldY, OldX); + mvwprintw (win, 6, 1, "The top of the window will scroll"); + wmove (win, 1, 1); + wsetscrreg (win, 0, 4); + box(win, ACS_VLINE, ACS_HLINE); + wrefresh (win); + for (i = 1; i <= 5; i++) { + napms(500); + scroll(win); + wrefresh (win); + }; + wsetscrreg (win, 0, --OldY); + +} + +static void +inputTest (WINDOW *win) +{ + int w, h, bx, by, sw, sh, i, c,num; + char buffer [80]; + WINDOW *subWin; + wclear (win); + + w = win->_maxx; + h = win->_maxy; + bx = win->_begx; + by = win->_begy; + sw = w / 3; + sh = h / 3; + if((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2)) == NULL) + return; + +#ifdef A_COLOR + if (has_colors()) + { + init_pair(2,COLOR_CYAN,COLOR_BLUE); + wattrset(subWin, COLOR_PAIR(2) | A_BOLD); + } + else + wattrset(subWin, A_BOLD); +#else + wattrset(subWin, A_BOLD); +#endif + box(subWin, ACS_VLINE, ACS_HLINE); + wrefresh(win); + + nocbreak(); + mvwaddstr(win, 2, 1, "Press some keys for 5 seconds"); + mvwaddstr(win, 1, 1, "Pressing ^C should do nothing"); + wrefresh(win); + + for (i = 0; i < 5; i++) { + werase (subWin); + box(subWin, ACS_VLINE, ACS_HLINE); + mvwprintw (subWin, 1, 1, "Time = %d", i); + wrefresh(subWin); + napms(1000); + flushinp(); + } + + delwin (subWin); + werase(win); + flash(); + wrefresh(win); + napms(500); + + mvwaddstr(win, 2, 1, "Press a key, followed by ENTER"); + wmove(win, 9, 10); + wrefresh(win); + echo(); + noraw(); + wgetch(win); + flushinp(); + + wmove(win, 9, 10); + wdelch(win); + mvwaddstr(win, 4, 1, "The character should now have been deleted"); + Continue(win); + + wclear (win); + mvwaddstr(win, 2, 1, "Press a function key or an arrow key"); + wrefresh(win); + keypad(win, TRUE); + raw(); + c = wgetch(win); + + nodelay(win, TRUE); + wgetch(win); + nodelay(win, FALSE); + + refresh(); + wclear (win); + mvwaddstr(win, 3, 2, "The window should have moved"); + mvwaddstr(win, 4, 2, "This text should have appeared without you pressing a key"); + mvwprintw(win, 2, 2, "Keycode = %d", c); + mvwaddstr(win, 6, 2, "Enter a number then a string seperated by space"); + echo(); + noraw(); + mvwscanw(win, 7, 6, "%d %s", &num,buffer); + mvwprintw(win, 8, 6, "String: %s Number: %d", buffer,num); + Continue(win); +} + +static void +outputTest (WINDOW *win) +{ + WINDOW *win1; + char Buffer [80]; + chtype ch; + + nl (); + wclear (win); + mvwaddstr(win, 1, 1, "You should now have a screen in the upper left corner, and this text should have wrapped"); + mvwin(win, 2, 1); + Continue(win); + + wclear(win); + mvwaddstr(win, 1, 1, "A new window will appear with this text in it"); + mvwaddstr(win, 8, 1, "Press any key to continue"); + wrefresh(win); + wgetch(win); + + win1 = newwin(10, 50, 15, 25); + if(win1 == NULL) + { endwin(); + return; + } +#ifdef A_COLOR + if (has_colors()) + { + init_pair(3,COLOR_BLUE,COLOR_WHITE); + wattrset(win1, COLOR_PAIR(3)); + } + else + wattrset(win1, A_NORMAL); +#else + wattrset(win1, A_NORMAL); +#endif + wclear (win1); + mvwaddstr(win1, 5, 1, "This text should appear; using overlay option"); + copywin(win, win1,0,0,0,0,10,50,TRUE); + + box(win1,ACS_VLINE,ACS_HLINE); + + wmove(win1, 8, 26); + wrefresh(win1); + wgetch(win1); + + wclear(win1); + wattron(win1, A_BLINK); + mvwaddstr(win1, 4, 1, "This blinking text should appear in only the second window"); + wattroff(win1, A_BLINK); + wrefresh(win1); + wgetch(win1); + delwin(win1); + + wclear(win); + wrefresh(win); + mvwaddstr(win, 6, 2, "This line shouldn't appear"); + mvwaddstr(win, 4, 2, "Only half of the next line is visible"); + mvwaddstr(win, 5, 2, "Only half of the next line is visible"); + wmove(win, 6, 1); + wclrtobot (win); + wmove(win, 5, 20); + wclrtoeol (win); + mvwaddstr(win, 8, 2, "This line also shouldn't appear"); + wmove(win, 8, 1); + wdeleteln(win); + Continue(win); + + wmove (win, 5, 9); + ch = winch (win); + + wclear(win); + wmove (win, 6, 2); + waddstr (win, "The next char should be l: "); + winsch (win, ch); + Continue(win); + + wmove(win, 5, 1); + winsertln (win); + mvwaddstr(win, 5, 2, "The lines below should have moved down"); + Continue(win); + + wclear(win); + wmove(win, 2, 2); + wprintw(win, "This is a formatted string in a window: %d %s\n", 42, "is it"); + mvwaddstr(win, 10, 1, "Enter a string: "); + wrefresh(win); + noraw(); + echo(); + wscanw (win, "%s", Buffer); + + wclear(win); + mvwaddstr(win, 10, 1, "Enter a string"); + wrefresh(win); + clear(); + move(0,0); + printw("This is a formatted string in stdscr: %d %s\n", 42, "is it"); + mvaddstr(10, 1, "Enter a string: "); + refresh(); + noraw(); + echo(); + scanw ("%s", Buffer); + + wclear(win); + curs_set(2); + mvwaddstr(win, 1, 1, "The cursor should appear as a block (visible)"); + Continue(win); + + wclear(win); + curs_set(0); + mvwaddstr(win, 1, 1, "The cursor should have disappeared (invisible)"); + Continue(win); + + wclear(win); + curs_set(1); + mvwaddstr(win, 1, 1, "The cursor should be an underline (normal)"); + Continue(win); +} + +#ifdef __PDCURSES__ +static void +resizeTest(WINDOW *dummy GCC_UNUSED) +{ + WINDOW *win1; + + savetty (); + + clear(); + refresh(); + resize(50); + + + win1 = newwin(11, 50, 14, 25); + if(win1 == NULL) + { endwin(); + return; + } +#ifdef A_COLOR + if (has_colors()) + { + init_pair(3,COLOR_BLUE,COLOR_WHITE); + wattrset(win1, COLOR_PAIR(3)); + } +#endif + wclear (win1); + + mvwaddstr(win1, 1, 1, "The screen may now have 50 lines"); + Continue(win1); + + resetty (); + + wclear (win1); + mvwaddstr(win1, 1, 1, "The screen should now be reset"); + Continue(win1); + + delwin(win1); + + clear(); + refresh(); + +} +#endif + +static void +padTest(WINDOW *dummy GCC_UNUSED) +{ +WINDOW *pad; + + pad = newpad(50,100); + mvwaddstr(pad, 5, 2, "This is a new pad"); + mvwaddstr(pad, 8, 0, "The end of this line should be truncated here:abcd"); + mvwaddstr(pad,11, 1, "This line should not appear."); + wmove(pad, 10, 1); + wclrtoeol(pad); + mvwaddstr(pad, 10, 1, " Press any key to continue"); + prefresh(pad,0,0,0,0,10,45); + keypad(pad, TRUE); + raw(); + wgetch(pad); + + mvwaddstr(pad, 35, 2, "This is displayed at line 35 in the pad"); + mvwaddstr(pad, 40, 1, " Press any key to continue"); + prefresh(pad,30,0,0,0,10,45); + keypad(pad, TRUE); + raw(); + wgetch(pad); + + delwin(pad); +} + +static void +display_menu(int old_option,int new_option) +{ + register size_t i; + + attrset(A_NORMAL); + mvaddstr(3,20,"PDCurses Test Program"); + + for (i=0;i) +{ +CLASSIFY: { + # Transform window pointer addresses so it's easier to compare logs + $awaiting = "curscr" if ($_ =~ /creating curscr/); + $awaiting = "newscr" if ($_ =~ /creating newscr/); + $awaiting = "stdscr" if ($_ =~ /creating stdscr/); + if ($awaiting && $_ =~ /newwin: returned window is 0x([0-9a-f]+)/) + { + $curscr = "0x$1" if ($awaiting eq "curscr"); + $newscr = "0x$1" if ($awaiting eq "newscr"); + $stdscr = "0x$1" if ($awaiting eq "stdscr"); + $awaiting = ""; + } + + # Compactify runs of PutAttrChar calls (TR_CHARPUT) + if ($_ =~ /$putattr/) + { + $putattr_chars = $1; + $starty = $2; + $startx = $3; + while () + { + if ($_ =~ /$putattr/) { + $putattr_chars .= $1; + } else { + last; + } + } + print "RUN of PutAttrChar()s: \"$putattr_chars\" from ${starty}, ${startx}\n"; + redo CLASSIFY; + } + + # Compactify runs of waddnstr calls (TR_CALLS) + if ($_ =~ /$waddnstr/) + { + $waddnstr_chars = $2; + $winaddr = $1; + while () + { + if ($_ =~ /$waddnstr/ && $1 eq $winaddr) { + $waddnstr_chars .= $2; + } else { + last; + } + } + $winaddstr = &transaddr($winaddr); + print "RUN of waddnstr()s: $winaddr, \"$waddnstr_chars\"\n"; + redo CLASSIFY; + } + + # More transformations can go here + + # Repeated runs of anything + $anyline = &transaddr($_); + $repeatcount = 1; + while () { + if (&transaddr($_) eq $anyline) { + $repeatcount++; + } else { + last; + } + } + if ($repeatcount > 1) { + print "${repeatcount} REPEATS OF $anyline"; + } else { + print $anyline + } + redo CLASSIFY if $_; + + } # :CLASSIFY +} + +# tracemunch ends here diff --git a/test/view.c b/test/view.c new file mode 100644 index 00000000..bbcecf6b --- /dev/null +++ b/test/view.c @@ -0,0 +1,297 @@ +/* + * view.c -- a silly little viewer program + * + * written by Eric S. Raymond December 1994 + * to test the scrolling code in ncurses. + * + * modified by Thomas Dickey July 1995 to demonstrate + * the use of 'resizeterm()'. + * + * Takes a filename argument. It's a simple file-viewer with various + * scroll-up and scroll-down commands. + * + * n -- scroll one line forward + * p -- scroll one line back + * + * Either command accepts a numeric prefix interpreted as a repeat count. + * Thus, typing `5n' should scroll forward 5 lines in the file. + * + * The way you can tell this is working OK is that, in the trace file, + * there should be one scroll operation plus a small number of line + * updates, as opposed to a whole-page update. This means the physical + * scroll operation worked, and the refresh() code only had to do a + * partial repaint. + * + * $Id: view.c,v 1.20 1997/04/26 18:16:38 tom Exp $ + */ + +#include + +#include +#include +#include + +#if HAVE_TERMIOS_H +# include +#else +# include +#endif + +#if !defined(sun) || !HAVE_TERMIOS_H +# if HAVE_SYS_IOCTL_H +# include +# endif +#endif + +/* This is needed to compile 'struct winsize' */ +#if SYSTEM_LOOKS_LIKE_SCO +#include +#include +#endif + +#define MAXLINES 256 /* most lines we can handle */ + +static void finish(int sig) GCC_NORETURN; +static void show_all(void); + +#if defined(SIGWINCH) && defined(TIOCGWINSZ) && defined(NCURSES_VERSION) +#define CAN_RESIZE 1 +#else +#define CAN_RESIZE 0 +#endif + +#if CAN_RESIZE +static RETSIGTYPE adjust(int sig); +static int interrupted; +#endif + +static int waiting; +static int shift; + +static char *fname; +static char *lines[MAXLINES]; +static char **lptr; + +#if !HAVE_STRDUP +static char *strdup (char *s) +{ + char *p; + + p = malloc(strlen(s)+1); + if (p) + strcpy(p,s); + return(p); +} +#endif /* not HAVE_STRDUP */ + +int main(int argc, char *argv[]) +{ +FILE *fp; +char buf[BUFSIZ]; +int i; +char **olptr; +int done = FALSE; + +#ifdef TRACE + trace(TRACE_UPDATE); +#endif + + if (argc != 2) { + fprintf(stderr, "usage: view file\n"); + return EXIT_FAILURE; + } else { + fname = argv[1]; + if ((fp = fopen(fname, "r")) == (FILE *)NULL) { + perror(fname); + return EXIT_FAILURE; + } + } + + (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ +#if CAN_RESIZE + (void) signal(SIGWINCH, adjust); /* arrange interrupts to resize */ +#endif + + (void) initscr(); /* initialize the curses library */ + keypad(stdscr, TRUE); /* enable keyboard mapping */ + (void) nonl(); /* tell curses not to do NL->CR/NL on output */ + (void) cbreak(); /* take input chars one at a time, no wait for \n */ + (void) noecho(); /* don't echo input */ + idlok(stdscr, TRUE); /* allow use of insert/delete line */ + + /* slurp the file */ + for (lptr = &lines[0]; fgets(buf, BUFSIZ, fp) != (char *)NULL; lptr++) { + char temp[BUFSIZ], *s, *d; + int col; + + if (lptr - lines >= MAXLINES) { + endwin(); + (void) fprintf(stderr, "%s: %s is too large\n", argv[0], argv[1]); + return EXIT_FAILURE; + } + + /* convert tabs so that shift will work properly */ + for (s = buf, d = temp, col = 0; (*d = *s) != '\0'; s++) { + if (*d == '\n') { + *d = '\0'; + break; + } else if (*d == '\t') { + col = (col | 7) + 1; + while ((d-temp) != col) + *d++ = ' '; + } else if (isprint(*d)) { + col++; + d++; + } else { + sprintf(d, "\\%03o", *s); + d += strlen(d); + col = (d - temp); + } + } + *lptr = strdup(temp); + } + (void) fclose(fp); + + lptr = lines; + while (!done) { + int n, c; + bool explicit; + + show_all(); + + explicit = FALSE; + n = 0; + for (;;) { +#if CAN_RESIZE + if (interrupted) + adjust(0); +#endif + waiting = TRUE; + c = getch(); + waiting = FALSE; + if (c < 127 && isdigit(c)) { + n = 10 * n + (c - '0'); + explicit = TRUE; + } else + break; + } + if (!explicit && n == 0) + n = 1; + + switch(c) { + case KEY_DOWN: + case 'n': + olptr = lptr; + for (i = 0; i < n; i++) + if (lptr + LINES < lines + MAXLINES && lptr[LINES + 1]) + lptr++; + else + break; + wscrl(stdscr, lptr - olptr); + break; + + case KEY_UP: + case 'p': + olptr = lptr; + for (i = 0; i < n; i++) + if (lptr > lines) + lptr--; + else + break; + wscrl(stdscr, lptr - olptr); + break; + + case 'h': + case KEY_HOME: + lptr = lines; + break; + + case 'r': + case KEY_RIGHT: + shift++; + break; + + case 'l': + case KEY_LEFT: + if (shift) + shift--; + else + beep(); + break; + + case 'q': + done = TRUE; + break; + + default: + beep(); + } + } + + finish(0); /* we're done */ +} + +static RETSIGTYPE finish(int sig) +{ + endwin(); + exit(sig != 0 ? EXIT_FAILURE : EXIT_SUCCESS); +} + +#if CAN_RESIZE +/* + * This uses functions that are "unsafe", but it seems to work on SunOS and + * Linux. The 'wrefresh(curscr)' is needed to force the refresh to start from + * the top of the screen -- some xterms mangle the bitmap while resizing. + */ +static RETSIGTYPE adjust(int sig) +{ + if (waiting || sig == 0) { + struct winsize size; + + if (ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0) { + resizeterm(size.ws_row, size.ws_col); + beep(); + wrefresh(curscr); /* Linux needs this */ + show_all(); + } + interrupted = FALSE; + } else { + interrupted = TRUE; + } + (void) signal(SIGWINCH, adjust); /* some systems need this */ +} +#endif /* CAN_RESIZE */ + +static void show_all(void) +{ + int i; + char temp[BUFSIZ]; + char *s; + +#if CAN_RESIZE + sprintf(temp, "(%3dx%3d) col %d ", LINES, COLS, shift); + i = strlen(temp); + sprintf(temp+i, "view %.*s", (int)(sizeof(temp)-7-i), fname); +#else + sprintf(temp, "view %.*s", (int)sizeof(temp)-7, fname); +#endif + move(0,0); + printw("%.*s", COLS, temp); + clrtoeol(); + + scrollok(stdscr, FALSE); /* prevent screen from moving */ + for (i = 1; i < LINES; i++) { + move(i, 0); + if ((s = lptr[i-1]) != 0 && (int)strlen(s) > shift) + printw("%3d:%.*s", lptr+i-lines, COLS-4, s + shift); + else + printw("%3d:", lptr+i-lines); + clrtoeol(); + } + setscrreg(1, LINES-1); + scrollok(stdscr, TRUE); + refresh(); +} + +/* view.c ends here */ + diff --git a/test/worm.c b/test/worm.c new file mode 100644 index 00000000..ba54ba82 --- /dev/null +++ b/test/worm.c @@ -0,0 +1,371 @@ +/* + + @@@ @@@ @@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@ + @@@ @@@ @@@@@@@@@@@@ @@@@@@@@@@@@ @@@@@@@@@@@@@ + @@@ @@@ @@@@ @@@@ @@@@ @@@@ @@@ @@@@ + @@@ @@ @@@ @@@ @@@ @@@ @@@ @@@ @@@ + @@@ @@@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@ + @@@@ @@@@ @@@@ @@@ @@@ @@@ @@@ @@@ @@@ + @@@@@@@@@@@@ @@@@ @@@@ @@@ @@@ @@@ @@@ + @@@@ @@@@ @@@@@@@@@@@@ @@@ @@@ @@@ @@@ + @@ @@ @@@@@@@@@@ @@@ @@@ @@@ @@@ + + Eric P. Scott + Caltech High Energy Physics + October, 1980 + + Hacks to turn this into a test frame for cursor movement: + Eric S. Raymond + January, 1995 + + July 1995 (esr): worms is now in living color! :-) + +Options: + -f fill screen with copies of 'WORM' at start. + -l set worm length + -n set number of worms + -t make worms leave droppings + -T set trace interval + -S set single-stepping during trace interval + -N suppress cursor-movement optimization + + This program makes a good torture-test for the ncurses cursor-optimization + code. You can use -T to set the worm move interval over which movement + traces will be dumped. The program stops and waits for one character of + input at the beginning and end of the interval. + + $Id: worm.c,v 1.20 1997/05/03 18:38:57 tom Exp $ +*/ + +#include + +#include /* for tparm() */ + +#include + +#define cursor(col,row) move(row,col) + +short *ref[128]; +static chtype flavor[]={ + 'O' , '*', '#', '$', '%', '0', '@', +}; +#define MAXWORMS (sizeof(flavor)/sizeof(chtype)) +static const short xinc[]={ + 1, 1, 1, 0, -1, -1, -1, 0 +}, yinc[]={ + -1, 0, 1, 1, 1, 0, -1, -1 +}; +static struct worm { + int orientation, head; + short *xpos, *ypos; +} worm[40]; + +static const char *field; +static int length=16, number=3; +static chtype trail=' '; + +#ifdef TRACE +int generation, trace_start, trace_end, singlestep; +#endif /* TRACE */ +static const struct options { + int nopts; + int opts[3]; +} normal[8]={ + { 3, { 7, 0, 1 } }, + { 3, { 0, 1, 2 } }, + { 3, { 1, 2, 3 } }, + { 3, { 2, 3, 4 } }, + { 3, { 3, 4, 5 } }, + { 3, { 4, 5, 6 } }, + { 3, { 5, 6, 7 } }, + { 3, { 6, 7, 0 } } +}, upper[8]={ + { 1, { 1, 0, 0 } }, + { 2, { 1, 2, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 2, { 4, 5, 0 } }, + { 1, { 5, 0, 0 } }, + { 2, { 1, 5, 0 } } +}, left[8]={ + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 2, { 2, 3, 0 } }, + { 1, { 3, 0, 0 } }, + { 2, { 3, 7, 0 } }, + { 1, { 7, 0, 0 } }, + { 2, { 7, 0, 0 } } +}, right[8]={ + { 1, { 7, 0, 0 } }, + { 2, { 3, 7, 0 } }, + { 1, { 3, 0, 0 } }, + { 2, { 3, 4, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 2, { 6, 7, 0 } } +}, lower[8]={ + { 0, { 0, 0, 0 } }, + { 2, { 0, 1, 0 } }, + { 1, { 1, 0, 0 } }, + { 2, { 1, 5, 0 } }, + { 1, { 5, 0, 0 } }, + { 2, { 5, 6, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } } +}, upleft[8]={ + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 1, { 3, 0, 0 } }, + { 2, { 1, 3, 0 } }, + { 1, { 1, 0, 0 } } +}, upright[8]={ + { 2, { 3, 5, 0 } }, + { 1, { 3, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 1, { 5, 0, 0 } } +}, lowleft[8]={ + { 3, { 7, 0, 1 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 1, { 1, 0, 0 } }, + { 2, { 1, 7, 0 } }, + { 1, { 7, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } } +}, lowright[8]={ + { 0, { 0, 0, 0 } }, + { 1, { 7, 0, 0 } }, + { 2, { 5, 7, 0 } }, + { 1, { 5, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } }, + { 0, { 0, 0, 0 } } +}; + +static RETSIGTYPE onsig(int sig); +static float ranf(void); + +int +main(int argc, char *argv[]) +{ +int x, y; +int n; +struct worm *w; +const struct options *op; +int h; +short *ip; +int last, bottom; + + for (x=1;x1024) { + fprintf(stderr,"%s: Invalid length\n",*argv); + return EXIT_FAILURE; + } + break; + case 'n': + if (++x==argc) goto usage; + if ((number=atoi(argv[x]))<1||number>40) { + fprintf(stderr,"%s: Invalid number of worms\n",*argv); + return EXIT_FAILURE; + } + break; + case 't': + trail='.'; + break; +#ifdef TRACE + case 'S': + singlestep = TRUE; + break; + case 'T': + trace_start = atoi(argv[++x]); + trace_end = atoi(argv[++x]); + break; + case 'N': + _nc_optimize_enable ^= OPTIMIZE_ALL; /* declared by ncurses */ + break; +#endif /* TRACE */ + default: + usage: + fprintf(stderr, "usage: %s [-field] [-length #] [-number #] [-trail]\n",*argv); + return EXIT_FAILURE; + break; + } + } + + signal(SIGINT, onsig); + initscr(); + noecho(); + cbreak(); + nonl(); + + curs_set(0); + + bottom = LINES-1; + last = COLS-1; + +#ifdef A_COLOR + if (has_colors()) + { + int bg = COLOR_BLACK; + start_color(); +#ifdef NCURSES_VERSION + if (use_default_colors() == OK) + bg = -1; +#endif + + init_pair(COLOR_GREEN, COLOR_GREEN, -1); + init_pair(COLOR_RED, COLOR_RED, -1); + init_pair(COLOR_CYAN, COLOR_CYAN, -1); + init_pair(COLOR_WHITE, COLOR_WHITE, -1); + init_pair(COLOR_MAGENTA, COLOR_MAGENTA, -1); + init_pair(COLOR_BLUE, COLOR_BLUE, -1); + init_pair(COLOR_YELLOW, COLOR_YELLOW, -1); + + flavor[0] |= COLOR_PAIR(COLOR_GREEN) | A_BOLD; + flavor[1] |= COLOR_PAIR(COLOR_RED) | A_BOLD; + flavor[2] |= COLOR_PAIR(COLOR_CYAN) | A_BOLD; + flavor[3] |= COLOR_PAIR(COLOR_WHITE) | A_BOLD; + flavor[4] |= COLOR_PAIR(COLOR_MAGENTA) | A_BOLD; + flavor[5] |= COLOR_PAIR(COLOR_BLUE) | A_BOLD; + flavor[6] |= COLOR_PAIR(COLOR_YELLOW) | A_BOLD; + } +#endif /* A_COLOR */ + + ip=(short *)malloc(LINES*COLS*sizeof (short)); + + for (n=0;n=0;) *ip++=0; + +#ifdef BADCORNER + /* if addressing the lower right corner doesn't work in your curses */ + ref[bottom][last]=1; +#endif /* BADCORNER */ + + for (n=number, w= &worm[0];--n>=0;w++) { + w->orientation=w->head=0; + if (!(ip=(short *)malloc((length+1)*sizeof (short)))) { + fprintf(stderr,"%s: out of memory\n",*argv); + return EXIT_FAILURE; + } + w->xpos=ip; + for (x=length;--x>=0;) *ip++ = -1; + if (!(ip=(short *)malloc((length+1)*sizeof (short)))) { + fprintf(stderr,"%s: out of memory\n",*argv); + return EXIT_FAILURE; + } + w->ypos=ip; + for (y=length;--y>=0;) *ip++ = -1; + } + if (field) { + register const char *p; + p=field; + for (y=bottom;--y>=0;) { + for (x=COLS;--x>=0;) { + addch((chtype)(*p++)); + if (!*p) p=field; + } + addch('\n'); + } + } + refresh(); + + for (;;) { +#ifdef TRACE + if (trace_start || trace_end) { + if (generation == trace_start) { + trace(TRACE_CALLS); + getch(); + } else if (generation == trace_end) { + trace(0); + getch(); + } + + if (singlestep && generation > trace_start && generation < trace_end) + getch(); + + generation++; + } +#endif /* TRACE */ + + for (n=0,w= &worm[0];nxpos[h=w->head])<0) { + cursor(x=w->xpos[h]=0,y=w->ypos[h]=bottom); + addch(flavor[n % MAXWORMS]); + ref[y][x]++; + } + else y=w->ypos[h]; + if (++h==length) h=0; + if (w->xpos[w->head=h]>=0) { + register int x1, y1; + x1=w->xpos[h]; y1=w->ypos[h]; + if (--ref[y1][x1]==0) { + cursor(x1,y1); addch(trail); + } + } + op= &(x==0 ? (y==0 ? upleft : (y==bottom ? lowleft : left)) : + (x==last ? (y==0 ? upright : (y==bottom ? lowright : right)) : + (y==0 ? upper : (y==bottom ? lower : normal))))[w->orientation]; + switch (op->nopts) { + case 0: + refresh(); + curs_set(1); + endwin(); + return EXIT_SUCCESS; + case 1: + w->orientation=op->opts[0]; + break; + default: + w->orientation=op->opts[(int)(ranf()*(float)op->nopts)]; + } + cursor(x+=xinc[w->orientation], y+=yinc[w->orientation]); + + if (y < 0 ) y = 0; + addch(flavor[n % MAXWORMS]); + ref[w->ypos[h]=y][w->xpos[h]=x]++; + } + refresh(); + } +} + +static RETSIGTYPE +onsig(int sig GCC_UNUSED) +{ + standend(); + refresh(); + curs_set(1); + endwin(); + exit(EXIT_FAILURE); +} + +static float +ranf(void) +{ +float rv; +long r = rand(); + + r &= 077777; + rv =((float)r/32767.); + return rv; +} diff --git a/test/xmas.c b/test/xmas.c new file mode 100644 index 00000000..4204fe70 --- /dev/null +++ b/test/xmas.c @@ -0,0 +1,1069 @@ +/******************************************************************************/ +/* asciixmas */ +/* December 1989 Larry Bartz Indianapolis, IN */ +/* */ +/* */ +/* I'm dreaming of an ascii character-based monochrome Christmas, */ +/* Just like the one's I used to know! */ +/* Via a full duplex communications channel, */ +/* At 9600 bits per second, */ +/* Even though it's kinda slow. */ +/* */ +/* I'm dreaming of an ascii character-based monochrome Christmas, */ +/* With ev'ry C program I write! */ +/* May your screen be merry and bright! */ +/* And may all your Christmases be amber or green, */ +/* (for reduced eyestrain and improved visibility)! */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* IMPLEMENTATION */ +/* */ +/* Feel free to modify the defined string FROMWHO to reflect you, your */ +/* organization, your site, whatever. */ +/* */ +/* This really looks a lot better if you can turn off your cursor before */ +/* execution. I wanted to do that here but very few termcap entries or */ +/* terminfo definitions have the appropriate string defined. If you know */ +/* the string(s) for the terminal(s) you use or which your site supports, */ +/* you could call asciixmas from within a shell in which you issue the */ +/* string to the terminal. The cursor is distracting but it doesn't really */ +/* ruin the show. */ +/* */ +/* At our site, we invoke this for our users just after login and the */ +/* determination of terminal type. */ +/* */ +/* */ +/* PORTABILITY */ +/* */ +/* I wrote this using only the very simplest curses functions so that it */ +/* might be the most portable. I was personally able to test on five */ +/* different cpu/UNIX combinations. */ +/* */ +/* */ +/* COMPILE */ +/* */ +/* usually this: */ +/* */ +/* cc -O asciixmas.c -lcurses -o asciixmas -s */ +/* */ +/* */ +/* Zilog S8000 models 11, 21, 31, etc with ZEUS variant of SYSTEM III */ +/* maybe other SYSTEM III also: */ +/* */ +/* cc asciixmas.c -lcurses -ltermlib -o asciixmas -s */ +/* */ +/* as above with optional "peephole optimizer" installed: */ +/* */ +/* cc -O asciixmas.c -lcurses -ltermlib -o asciixmas -s */ +/* */ +/* */ +/* Zilog S8000 models 32, 130 with WE32100 chip and SYS V, REL2 */ +/* maybe 3B2 also? */ +/* */ +/* cc -f -O -K sd asciixmas.c -lcurses -o asciixmas -s */ +/* */ +/* */ +/* Pyramid, Sequent, any other "dual universe" types compile and execute */ +/* under either universe. The compile line for the ucb universe (as you */ +/* might expect) is the same as for SYS III UNIX: */ +/* */ +/* cc -O asciixmas.c -lcurses -ltermlib -o asciixmas -s */ +/* */ +/* The above compile will also hold true for other BSD systems. (I hope) */ +/* */ +/* */ +/* */ +/* */ +/* For the Scrooges out there among you who don't want this thing to loop */ +/* forever (or until the user hits a key), insert this into your compile */ +/* line just after "cc" : */ +/* */ +/* -DNOLOOP */ +/* */ +/* like so: */ +/* */ +/* cc -DNOLOOP -O asciixmas.c -lcurses -o asciixmas -s */ +/* */ +/* */ +/* */ +/******************************************************************************/ + +#include + +#include + +#define FROMWHO "Mark Hessling - (M.Hessling@gu.edu.au)" + +static int y_pos, x_pos; + +static WINDOW + *treescrn, *treescrn2,*treescrn3, *treescrn4,*treescrn5, *treescrn6, + *treescrn7, *treescrn8, + *dotdeer0, + *stardeer0, + *lildeer0, *lildeer1, *lildeer2, *lildeer3, + *middeer0, *middeer1, *middeer2, *middeer3, + *bigdeer0, *bigdeer1, *bigdeer2, *bigdeer3, *bigdeer4, + *lookdeer0, *lookdeer1, *lookdeer2, *lookdeer3, *lookdeer4, + *w_holiday, + *w_del_msg; + +static int boxit(void); +static int seas(void); +static int greet(void); +static int fromwho(void); +static int tree(void); +static int balls(void); +static int star(void); +static int strng1(void); +static int strng2(void); +static int strng3(void); +static int strng4(void); +static int strng5(void); +static int reindeer(void); +static int blinkit(void); +static RETSIGTYPE done(int sig) GCC_NORETURN ; + +int main( + int argc GCC_UNUSED, + char **argv GCC_UNUSED) +{ +int loopy; + + initscr(); + noecho(); + nonl(); + refresh(); + signal(SIGINT,done); + signal(SIGTERM,done); +#if !defined DOS && !defined OS2 + signal(SIGHUP,done); + signal(SIGQUIT,done); +#endif + + treescrn = newwin(16,27,3,53); + treescrn2 = newwin(16,27,3,53); + treescrn3 = newwin(16,27,3,53); + treescrn4 = newwin(16,27,3,53); + treescrn5 = newwin(16,27,3,53); + treescrn6 = newwin(16,27,3,53); + treescrn7 = newwin(16,27,3,53); + treescrn8 = newwin(16,27,3,53); + + dotdeer0 = newwin(3,71,0,8); + + stardeer0 = newwin(4,56,0,8); + + lildeer0 = newwin(7,53,0,8); + lildeer1 = newwin(2,4,0,0); + lildeer2 = newwin(2,4,0,0); + lildeer3 = newwin(2,4,0,0); + + middeer0 = newwin(15,42,0,8); + middeer1 = newwin(3,7,0,0); + middeer2 = newwin(3,7,0,0); + middeer3 = newwin(3,7,0,0); + + bigdeer0 = newwin(10,23,0,0); + bigdeer1 = newwin(10,23,0,0); + bigdeer2 = newwin(10,23,0,0); + bigdeer3 = newwin(10,23,0,0); + bigdeer4 = newwin(10,23,0,0); + + lookdeer0 = newwin(10,25,0,0); + lookdeer1 = newwin(10,25,0,0); + lookdeer2 = newwin(10,25,0,0); + lookdeer3 = newwin(10,25,0,0); + lookdeer4 = newwin(10,25,0,0); + + w_holiday = newwin(1,26,3,27); + + w_del_msg = newwin(1,19,23,60); + + mvwaddstr(w_del_msg,0,0,"Hit any key to quit"); + + mvwaddstr(w_holiday,0,0,"H A P P Y H O L I D A Y S"); + + /* set up the windows for our various reindeer */ + + /* lildeer1 */ + mvwaddch(lildeer1,0,0,(chtype)'V'); + mvwaddch(lildeer1,1,0,(chtype)'@'); + mvwaddch(lildeer1,1,1,(chtype)'<'); + mvwaddch(lildeer1,1,2,(chtype)'>'); + mvwaddch(lildeer1,1,3,(chtype)'~'); + + /* lildeer2 */ + mvwaddch(lildeer2,0,0,(chtype)'V'); + mvwaddch(lildeer2,1,0,(chtype)'@'); + mvwaddch(lildeer2,1,1,(chtype)'|'); + mvwaddch(lildeer2,1,2,(chtype)'|'); + mvwaddch(lildeer2,1,3,(chtype)'~'); + + /* lildeer3 */ + mvwaddch(lildeer3,0,0,(chtype)'V'); + mvwaddch(lildeer3,1,0,(chtype)'@'); + mvwaddch(lildeer3,1,1,(chtype)'>'); + mvwaddch(lildeer3,1,2,(chtype)'<'); + mvwaddch(lildeer2,1,3,(chtype)'~'); + + + /* middeer1 */ + mvwaddch(middeer1,0,2,(chtype)'y'); + mvwaddch(middeer1,0,3,(chtype)'y'); + mvwaddch(middeer1,1,2,(chtype)'0'); + mvwaddch(middeer1,1,3,(chtype)'('); + mvwaddch(middeer1,1,4,(chtype)'='); + mvwaddch(middeer1,1,5,(chtype)')'); + mvwaddch(middeer1,1,6,(chtype)'~'); + mvwaddch(middeer1,2,3,(chtype)'\\'); + mvwaddch(middeer1,2,4,(chtype)'/'); + + /* middeer2 */ + mvwaddch(middeer2,0,2,(chtype)'y'); + mvwaddch(middeer2,0,3,(chtype)'y'); + mvwaddch(middeer2,1,2,(chtype)'0'); + mvwaddch(middeer2,1,3,(chtype)'('); + mvwaddch(middeer2,1,4,(chtype)'='); + mvwaddch(middeer2,1,5,(chtype)')'); + mvwaddch(middeer2,1,6,(chtype)'~'); + mvwaddch(middeer2,2,3,(chtype)'|'); + mvwaddch(middeer2,2,5,(chtype)'|'); + + /* middeer3 */ + mvwaddch(middeer3,0,2,(chtype)'y'); + mvwaddch(middeer3,0,3,(chtype)'y'); + mvwaddch(middeer3,1,2,(chtype)'0'); + mvwaddch(middeer3,1,3,(chtype)'('); + mvwaddch(middeer3,1,4,(chtype)'='); + mvwaddch(middeer3,1,5,(chtype)')'); + mvwaddch(middeer3,1,6,(chtype)'~'); + mvwaddch(middeer3,2,2,(chtype)'/'); + mvwaddch(middeer3,2,6,(chtype)'\\'); + + + /* bigdeer1 */ + mvwaddch(bigdeer1,0,17,(chtype)'\\'); + mvwaddch(bigdeer1,0,18,(chtype)'/'); + mvwaddch(bigdeer1,0,20,(chtype)'\\'); + mvwaddch(bigdeer1,0,21,(chtype)'/'); + mvwaddch(bigdeer1,1,18,(chtype)'\\'); + mvwaddch(bigdeer1,1,20,(chtype)'/'); + mvwaddch(bigdeer1,2,19,(chtype)'|'); + mvwaddch(bigdeer1,2,20,(chtype)'_'); + mvwaddch(bigdeer1,3,18,(chtype)'/'); + mvwaddch(bigdeer1,3,19,(chtype)'^'); + mvwaddch(bigdeer1,3,20,(chtype)'0'); + mvwaddch(bigdeer1,3,21,(chtype)'\\'); + mvwaddch(bigdeer1,4,17,(chtype)'/'); + mvwaddch(bigdeer1,4,18,(chtype)'/'); + mvwaddch(bigdeer1,4,19,(chtype)'\\'); + mvwaddch(bigdeer1,4,22,(chtype)'\\'); + mvwaddstr(bigdeer1,5,7,"^~~~~~~~~// ~~U"); + mvwaddstr(bigdeer1,6,7,"( \\_____( /"); + mvwaddstr(bigdeer1,7,8,"( ) /"); + mvwaddstr(bigdeer1,8,9,"\\\\ /"); + mvwaddstr(bigdeer1,9,11,"\\>/>"); + + /* bigdeer2 */ + mvwaddch(bigdeer2,0,17,(chtype)'\\'); + mvwaddch(bigdeer2,0,18,(chtype)'/'); + mvwaddch(bigdeer2,0,20,(chtype)'\\'); + mvwaddch(bigdeer2,0,21,(chtype)'/'); + mvwaddch(bigdeer2,1,18,(chtype)'\\'); + mvwaddch(bigdeer2,1,20,(chtype)'/'); + mvwaddch(bigdeer2,2,19,(chtype)'|'); + mvwaddch(bigdeer2,2,20,(chtype)'_'); + mvwaddch(bigdeer2,3,18,(chtype)'/'); + mvwaddch(bigdeer2,3,19,(chtype)'^'); + mvwaddch(bigdeer2,3,20,(chtype)'0'); + mvwaddch(bigdeer2,3,21,(chtype)'\\'); + mvwaddch(bigdeer2,4,17,(chtype)'/'); + mvwaddch(bigdeer2,4,18,(chtype)'/'); + mvwaddch(bigdeer2,4,19,(chtype)'\\'); + mvwaddch(bigdeer2,4,22,(chtype)'\\'); + mvwaddstr(bigdeer2,5,7,"^~~~~~~~~// ~~U"); + mvwaddstr(bigdeer2,6,7,"(( )____( /"); + mvwaddstr(bigdeer2,7,7,"( / |"); + mvwaddstr(bigdeer2,8,8,"\\/ |"); + mvwaddstr(bigdeer2,9,9,"|> |>"); + + /* bigdeer3 */ + mvwaddch(bigdeer3,0,17,(chtype)'\\'); + mvwaddch(bigdeer3,0,18,(chtype)'/'); + mvwaddch(bigdeer3,0,20,(chtype)'\\'); + mvwaddch(bigdeer3,0,21,(chtype)'/'); + mvwaddch(bigdeer3,1,18,(chtype)'\\'); + mvwaddch(bigdeer3,1,20,(chtype)'/'); + mvwaddch(bigdeer3,2,19,(chtype)'|'); + mvwaddch(bigdeer3,2,20,(chtype)'_'); + mvwaddch(bigdeer3,3,18,(chtype)'/'); + mvwaddch(bigdeer3,3,19,(chtype)'^'); + mvwaddch(bigdeer3,3,20,(chtype)'0'); + mvwaddch(bigdeer3,3,21,(chtype)'\\'); + mvwaddch(bigdeer3,4,17,(chtype)'/'); + mvwaddch(bigdeer3,4,18,(chtype)'/'); + mvwaddch(bigdeer3,4,19,(chtype)'\\'); + mvwaddch(bigdeer3,4,22,(chtype)'\\'); + mvwaddstr(bigdeer3,5,7,"^~~~~~~~~// ~~U"); + mvwaddstr(bigdeer3,6,6,"( ()_____( /"); + mvwaddstr(bigdeer3,7,6,"/ / /"); + mvwaddstr(bigdeer3,8,5,"|/ \\"); + mvwaddstr(bigdeer3,9,5,"/> \\>"); + + /* bigdeer4 */ + mvwaddch(bigdeer4,0,17,(chtype)'\\'); + mvwaddch(bigdeer4,0,18,(chtype)'/'); + mvwaddch(bigdeer4,0,20,(chtype)'\\'); + mvwaddch(bigdeer4,0,21,(chtype)'/'); + mvwaddch(bigdeer4,1,18,(chtype)'\\'); + mvwaddch(bigdeer4,1,20,(chtype)'/'); + mvwaddch(bigdeer4,2,19,(chtype)'|'); + mvwaddch(bigdeer4,2,20,(chtype)'_'); + mvwaddch(bigdeer4,3,18,(chtype)'/'); + mvwaddch(bigdeer4,3,19,(chtype)'^'); + mvwaddch(bigdeer4,3,20,(chtype)'0'); + mvwaddch(bigdeer4,3,21,(chtype)'\\'); + mvwaddch(bigdeer4,4,17,(chtype)'/'); + mvwaddch(bigdeer4,4,18,(chtype)'/'); + mvwaddch(bigdeer4,4,19,(chtype)'\\'); + mvwaddch(bigdeer4,4,22,(chtype)'\\'); + mvwaddstr(bigdeer4,5,7,"^~~~~~~~~// ~~U"); + mvwaddstr(bigdeer4,6,6,"( )______( /"); + mvwaddstr(bigdeer4,7,5,"(/ \\"); + mvwaddstr(bigdeer4,8,0,"v___= ----^"); + + + /* lookdeer1 */ + mvwaddstr(lookdeer1,0,16,"\\/ \\/"); + mvwaddstr(lookdeer1,1,17,"\\Y/ \\Y/"); + mvwaddstr(lookdeer1,2,19,"\\=/"); + mvwaddstr(lookdeer1,3,17,"^\\o o/^"); + mvwaddstr(lookdeer1,4,17,"//( )"); + mvwaddstr(lookdeer1,5,7,"^~~~~~~~~// \\O/"); + mvwaddstr(lookdeer1,6,7,"( \\_____( /"); + mvwaddstr(lookdeer1,7,8,"( ) /"); + mvwaddstr(lookdeer1,8,9,"\\\\ /"); + mvwaddstr(lookdeer1,9,11,"\\>/>"); + + /* lookdeer2 */ + mvwaddstr(lookdeer2,0,16,"\\/ \\/"); + mvwaddstr(lookdeer2,1,17,"\\Y/ \\Y/"); + mvwaddstr(lookdeer2,2,19,"\\=/"); + mvwaddstr(lookdeer2,3,17,"^\\o o/^"); + mvwaddstr(lookdeer2,4,17,"//( )"); + mvwaddstr(lookdeer2,5,7,"^~~~~~~~~// \\O/"); + mvwaddstr(lookdeer2,6,7,"(( )____( /"); + mvwaddstr(lookdeer2,7,7,"( / |"); + mvwaddstr(lookdeer2,8,8,"\\/ |"); + mvwaddstr(lookdeer2,9,9,"|> |>"); + + /* lookdeer3 */ + mvwaddstr(lookdeer3,0,16,"\\/ \\/"); + mvwaddstr(lookdeer3,1,17,"\\Y/ \\Y/"); + mvwaddstr(lookdeer3,2,19,"\\=/"); + mvwaddstr(lookdeer3,3,17,"^\\o o/^"); + mvwaddstr(lookdeer3,4,17,"//( )"); + mvwaddstr(lookdeer3,5,7,"^~~~~~~~~// \\O/"); + mvwaddstr(lookdeer3,6,6,"( ()_____( /"); + mvwaddstr(lookdeer3,7,6,"/ / /"); + mvwaddstr(lookdeer3,8,5,"|/ \\"); + mvwaddstr(lookdeer3,9,5,"/> \\>"); + + /* lookdeer4 */ + mvwaddstr(lookdeer4,0,16,"\\/ \\/"); + mvwaddstr(lookdeer4,1,17,"\\Y/ \\Y/"); + mvwaddstr(lookdeer4,2,19,"\\=/"); + mvwaddstr(lookdeer4,3,17,"^\\o o/^"); + mvwaddstr(lookdeer4,4,17,"//( )"); + mvwaddstr(lookdeer4,5,7,"^~~~~~~~~// \\O/"); + mvwaddstr(lookdeer4,6,6,"( )______( /"); + mvwaddstr(lookdeer4,7,5,"(/ \\"); + mvwaddstr(lookdeer4,8,0,"v___= ----^"); + + + + /***********************************************/ + cbreak(); + nodelay(stdscr,TRUE); + do { + clear(); + werase(treescrn); + touchwin(w_del_msg); + touchwin(treescrn); + werase(treescrn2); + touchwin(treescrn2); + werase(treescrn8); + touchwin(treescrn8); + refresh(); + napms(150); + boxit(); + refresh(); + napms(150); + seas(); + refresh(); + napms(150); + greet(); + refresh(); + napms(150); + fromwho(); + refresh(); + napms(150); + tree(); + napms(150); + balls(); + napms(150); + star(); + napms(150); + strng1(); + strng2(); + strng3(); + strng4(); + strng5(); + + + /* set up the windows for our blinking trees */ + /* **************************************** */ + /* treescrn3 */ + + overlay(treescrn, treescrn3); + + /*balls*/ + mvwaddch(treescrn3, 4, 18, ' '); + mvwaddch(treescrn3, 7, 6, ' '); + mvwaddch(treescrn3, 8, 19, ' '); + mvwaddch(treescrn3, 11, 22, ' '); + + /*star*/ + mvwaddch(treescrn3, 0, 12, '*'); + + /*strng1*/ + mvwaddch(treescrn3, 3, 11, ' '); + + /*strng2*/ + mvwaddch(treescrn3, 5, 13, ' '); + mvwaddch(treescrn3, 6, 10, ' '); + + /*strng3*/ + mvwaddch(treescrn3, 7, 16, ' '); + mvwaddch(treescrn3, 7, 14, ' '); + + /*strng4*/ + mvwaddch(treescrn3, 10, 13, ' '); + mvwaddch(treescrn3, 10, 10, ' '); + mvwaddch(treescrn3, 11, 8, ' '); + + /*strng5*/ + mvwaddch(treescrn3, 11, 18, ' '); + mvwaddch(treescrn3, 12, 13, ' '); + + + /* treescrn4 */ + + overlay(treescrn, treescrn4); + + /*balls*/ + mvwaddch(treescrn4, 3, 9, ' '); + mvwaddch(treescrn4, 4, 16, ' '); + mvwaddch(treescrn4, 7, 6, ' '); + mvwaddch(treescrn4, 8, 19, ' '); + mvwaddch(treescrn4, 11, 2, ' '); + mvwaddch(treescrn4, 12, 23, ' '); + + /*star*/ + wstandout(treescrn4); + mvwaddch(treescrn4, 0, 12, '*'); + wstandend(treescrn4); + + /*strng1*/ + mvwaddch(treescrn4, 3, 13, ' '); + + /*strng2*/ + + /*strng3*/ + mvwaddch(treescrn4, 7, 15, ' '); + mvwaddch(treescrn4, 8, 11, ' '); + + /*strng4*/ + mvwaddch(treescrn4, 9, 16, ' '); + mvwaddch(treescrn4, 10, 12, ' '); + mvwaddch(treescrn4, 11, 8, ' '); + + /*strng5*/ + mvwaddch(treescrn4, 11, 18, ' '); + mvwaddch(treescrn4, 12, 14, ' '); + + + /* treescrn5 */ + + overlay(treescrn, treescrn5); + + /*balls*/ + mvwaddch(treescrn5, 3, 15, ' '); + mvwaddch(treescrn5, 10, 20, ' '); + mvwaddch(treescrn5, 12, 1, ' '); + + /*star*/ + mvwaddch(treescrn5, 0, 12, '*'); + + /*strng1*/ + mvwaddch(treescrn5, 3, 11, ' '); + + /*strng2*/ + mvwaddch(treescrn5, 5, 12, ' '); + + /*strng3*/ + mvwaddch(treescrn5, 7, 14, ' '); + mvwaddch(treescrn5, 8, 10, ' '); + + /*strng4*/ + mvwaddch(treescrn5, 9, 15, ' '); + mvwaddch(treescrn5, 10, 11, ' '); + mvwaddch(treescrn5, 11, 7, ' '); + + /*strng5*/ + mvwaddch(treescrn5, 11, 17, ' '); + mvwaddch(treescrn5, 12, 13, ' '); + + /* treescrn6 */ + + overlay(treescrn, treescrn6); + + /*balls*/ + mvwaddch(treescrn6, 6, 7, ' '); + mvwaddch(treescrn6, 7, 18, ' '); + mvwaddch(treescrn6, 10, 4, ' '); + mvwaddch(treescrn6, 11, 23, ' '); + + /*star*/ + wstandout(treescrn6); + mvwaddch(treescrn6, 0, 12, '*'); + wstandend(treescrn6); + + /*strng1*/ + + /*strng2*/ + mvwaddch(treescrn6, 5, 11, ' '); + + /*strng3*/ + mvwaddch(treescrn6, 7, 13, ' '); + mvwaddch(treescrn6, 8, 9, ' '); + + /*strng4*/ + mvwaddch(treescrn6, 9, 14, ' '); + mvwaddch(treescrn6, 10, 10, ' '); + mvwaddch(treescrn6, 11, 6, ' '); + + /*strng5*/ + mvwaddch(treescrn6, 11, 16, ' '); + mvwaddch(treescrn6, 12, 12, ' '); + + /* treescrn7 */ + + overlay(treescrn, treescrn7); + + /*balls*/ + mvwaddch(treescrn7, 3, 15, ' '); + mvwaddch(treescrn7, 6, 7, ' '); + mvwaddch(treescrn7, 7, 18, ' '); + mvwaddch(treescrn7, 10, 4, ' '); + mvwaddch(treescrn7, 11, 22, ' '); + + /*star*/ + mvwaddch(treescrn7, 0, 12, '*'); + + /*strng1*/ + mvwaddch(treescrn7, 3, 12, ' '); + + /*strng2*/ + mvwaddch(treescrn7, 5, 13, ' '); + mvwaddch(treescrn7, 6, 9, ' '); + + /*strng3*/ + mvwaddch(treescrn7, 7, 15, ' '); + mvwaddch(treescrn7, 8, 11, ' '); + + /*strng4*/ + mvwaddch(treescrn7, 9, 16, ' '); + mvwaddch(treescrn7, 10, 12, ' '); + mvwaddch(treescrn7, 11, 8, ' '); + + /*strng5*/ + mvwaddch(treescrn7, 11, 18, ' '); + mvwaddch(treescrn7, 12, 14, ' '); + + + napms(150); + reindeer(); + + touchwin(w_holiday); + wrefresh(w_holiday); + wrefresh(w_del_msg); + + napms(500); + for(loopy = 0;loopy < 100;loopy++) { + blinkit(); + } + +#ifdef NOLOOP + done(0); +#endif + + } + while(getch() == (ERR)); +/* while(!typeahead(stdin));*/ + done(0); + /*NOTREACHED*/ +} + +static int boxit(void) +{ + int x = 0; + + while(x < 20) { + mvaddch(x, 7, '|'); + ++x; + } + + x = 8; + + while(x < 80) { + mvaddch(19, x, '_'); + ++x; + } + + x = 0; + + while(x < 80) { + mvaddch(22, x, '_'); + ++x; + } + + return( 0 ); +} + +static int seas(void) +{ + mvaddch(4, 1, 'S'); + mvaddch(6, 1, 'E'); + mvaddch(8, 1, 'A'); + mvaddch(10, 1, 'S'); + mvaddch(12, 1, 'O'); + mvaddch(14, 1, 'N'); + mvaddch(16, 1, '`'); + mvaddch(18, 1, 'S'); + + return( 0 ); +} + + +static int greet(void) +{ + mvaddch(3, 5, 'G'); + mvaddch(5, 5, 'R'); + mvaddch(7, 5, 'E'); + mvaddch(9, 5, 'E'); + mvaddch(11, 5, 'T'); + mvaddch(13, 5, 'I'); + mvaddch(15, 5, 'N'); + mvaddch(17, 5, 'G'); + mvaddch(19, 5, 'S'); + + return( 0 ); +} + + +static int fromwho(void) +{ + mvaddstr(21, 13, FROMWHO); + return( 0 ); +} + +static int tree(void) +{ + mvwaddch(treescrn, 1, 11, (chtype)'/'); + mvwaddch(treescrn, 2, 11, (chtype)'/'); + mvwaddch(treescrn, 3, 10, (chtype)'/'); + mvwaddch(treescrn, 4, 9, (chtype)'/'); + mvwaddch(treescrn, 5, 9, (chtype)'/'); + mvwaddch(treescrn, 6, 8, (chtype)'/'); + mvwaddch(treescrn, 7, 7, (chtype)'/'); + mvwaddch(treescrn, 8, 6, (chtype)'/'); + mvwaddch(treescrn, 9, 6, (chtype)'/'); + mvwaddch(treescrn, 10, 5, (chtype)'/'); + mvwaddch(treescrn, 11, 3, (chtype)'/'); + mvwaddch(treescrn, 12, 2, (chtype)'/'); + + mvwaddch(treescrn, 1, 13, (chtype)'\\'); + mvwaddch(treescrn, 2, 13, (chtype)'\\'); + mvwaddch(treescrn, 3, 14, (chtype)'\\'); + mvwaddch(treescrn, 4, 15, (chtype)'\\'); + mvwaddch(treescrn, 5, 15, (chtype)'\\'); + mvwaddch(treescrn, 6, 16, (chtype)'\\'); + mvwaddch(treescrn, 7, 17, (chtype)'\\'); + mvwaddch(treescrn, 8, 18, (chtype)'\\'); + mvwaddch(treescrn, 9, 18, (chtype)'\\'); + mvwaddch(treescrn, 10, 19, (chtype)'\\'); + mvwaddch(treescrn, 11, 21, (chtype)'\\'); + mvwaddch(treescrn, 12, 22, (chtype)'\\'); + + mvwaddch(treescrn, 4, 10, (chtype)'_'); + mvwaddch(treescrn, 4, 14, (chtype)'_'); + mvwaddch(treescrn, 8, 7, (chtype)'_'); + mvwaddch(treescrn, 8, 17, (chtype)'_'); + + mvwaddstr(treescrn, 13, 0, "//////////// \\\\\\\\\\\\\\\\\\\\\\\\"); + + mvwaddstr(treescrn, 14, 11, "| |"); + mvwaddstr(treescrn, 15, 11, "|_|"); + + wrefresh(treescrn); + wrefresh(w_del_msg); + + return( 0 ); +} + + +static int balls(void) +{ + + overlay(treescrn, treescrn2); + + mvwaddch(treescrn2, 3, 9, (chtype)'@'); + mvwaddch(treescrn2, 3, 15, (chtype)'@'); + mvwaddch(treescrn2, 4, 8, (chtype)'@'); + mvwaddch(treescrn2, 4, 16, (chtype)'@'); + mvwaddch(treescrn2, 5, 7, (chtype)'@'); + mvwaddch(treescrn2, 5, 17, (chtype)'@'); + mvwaddch(treescrn2, 7, 6, (chtype)'@'); + mvwaddch(treescrn2, 7, 18, (chtype)'@'); + mvwaddch(treescrn2, 8, 5, (chtype)'@'); + mvwaddch(treescrn2, 8, 19, (chtype)'@'); + mvwaddch(treescrn2, 10, 4, (chtype)'@'); + mvwaddch(treescrn2, 10, 20, (chtype)'@'); + mvwaddch(treescrn2, 11, 2, (chtype)'@'); + mvwaddch(treescrn2, 11, 22, (chtype)'@'); + mvwaddch(treescrn2, 12, 1, (chtype)'@'); + mvwaddch(treescrn2, 12, 23, (chtype)'@'); + + wrefresh(treescrn2); + wrefresh(w_del_msg); + return( 0 ); +} + + +static int star(void) +{ + wstandout(treescrn2); + mvwaddch(treescrn2, 0, 12, (chtype)'*'); + wstandend(treescrn2); + + wrefresh(treescrn2); + wrefresh(w_del_msg); + return( 0 ); +} + + +static int strng1(void) +{ + mvwaddch(treescrn2, 3, 13, (chtype)'\''); + mvwaddch(treescrn2, 3, 12, (chtype)':'); + mvwaddch(treescrn2, 3, 11, (chtype)'.'); + + wrefresh(treescrn2); + wrefresh(w_del_msg); + return( 0 ); +} + + +static int strng2(void) +{ + mvwaddch(treescrn2, 5, 14, (chtype)'\''); + mvwaddch(treescrn2, 5, 13, (chtype)':'); + mvwaddch(treescrn2, 5, 12, (chtype)'.'); + mvwaddch(treescrn2, 5, 11, (chtype)','); + mvwaddch(treescrn2, 6, 10, (chtype)'\''); + mvwaddch(treescrn2, 6, 9, (chtype)':'); + + wrefresh(treescrn2); + wrefresh(w_del_msg); + return( 0 ); +} + + +static int strng3(void) +{ + mvwaddch(treescrn2, 7, 16, (chtype)'\''); + mvwaddch(treescrn2, 7, 15, (chtype)':'); + mvwaddch(treescrn2, 7, 14, (chtype)'.'); + mvwaddch(treescrn2, 7, 13, (chtype)','); + mvwaddch(treescrn2, 8, 12, (chtype)'\''); + mvwaddch(treescrn2, 8, 11, (chtype)':'); + mvwaddch(treescrn2, 8, 10, (chtype)'.'); + mvwaddch(treescrn2, 8, 9, (chtype)','); + + wrefresh(treescrn2); + wrefresh(w_del_msg); + return( 0 ); +} + + +static int strng4(void) +{ + mvwaddch(treescrn2, 9, 17, (chtype)'\''); + mvwaddch(treescrn2, 9, 16, (chtype)':'); + mvwaddch(treescrn2, 9, 15, (chtype)'.'); + mvwaddch(treescrn2, 9, 14, (chtype)','); + mvwaddch(treescrn2, 10, 13, (chtype)'\''); + mvwaddch(treescrn2, 10, 12, (chtype)':'); + mvwaddch(treescrn2, 10, 11, (chtype)'.'); + mvwaddch(treescrn2, 10, 10, (chtype)','); + mvwaddch(treescrn2, 11, 9, (chtype)'\''); + mvwaddch(treescrn2, 11, 8, (chtype)':'); + mvwaddch(treescrn2, 11, 7, (chtype)'.'); + mvwaddch(treescrn2, 11, 6, (chtype)','); + mvwaddch(treescrn2, 12, 5, (chtype)'\''); + + wrefresh(treescrn2); + wrefresh(w_del_msg); + return( 0 ); +} + + +static int strng5(void) +{ + mvwaddch(treescrn2, 11, 19, (chtype)'\''); + mvwaddch(treescrn2, 11, 18, (chtype)':'); + mvwaddch(treescrn2, 11, 17, (chtype)'.'); + mvwaddch(treescrn2, 11, 16, (chtype)','); + mvwaddch(treescrn2, 12, 15, (chtype)'\''); + mvwaddch(treescrn2, 12, 14, (chtype)':'); + mvwaddch(treescrn2, 12, 13, (chtype)'.'); + mvwaddch(treescrn2, 12, 12, (chtype)','); + + /* save a fully lit tree */ + overlay(treescrn2, treescrn); + + wrefresh(treescrn2); + wrefresh(w_del_msg); + return( 0 ); +} + + + +static int blinkit(void) +{ +static int cycle; + + if(cycle > 4) { + cycle = 0; + } + + + touchwin(treescrn8); + + switch(cycle) { + case 0: + overlay(treescrn3, treescrn8); + wrefresh(treescrn8); + wrefresh(w_del_msg); + break; + case 1: + overlay(treescrn4, treescrn8); + wrefresh(treescrn8); + wrefresh(w_del_msg); + break; + case 2: + overlay(treescrn5, treescrn8); + wrefresh(treescrn8); + wrefresh(w_del_msg); + break; + case 3: + overlay(treescrn6, treescrn8); + wrefresh(treescrn8); + wrefresh(w_del_msg); + break; + case 4: + overlay(treescrn7, treescrn8); + wrefresh(treescrn8); + wrefresh(w_del_msg); + break; + } + touchwin(treescrn8); + + /*ALL ON***************************************************/ + + overlay(treescrn, treescrn8); + wrefresh(treescrn8); + wrefresh(w_del_msg); + + ++cycle; + return( 0 ); +} + +static void +deer_step(WINDOW *win, int y, int x) +{ + mvwin(win, y, x); + wrefresh(win); + wrefresh(w_del_msg); + napms(5); +} + +static int reindeer(void) +{ + int looper; + y_pos = 0; + + + for(x_pos = 70; x_pos > 62; x_pos--) { + if(x_pos < 62) { + y_pos = 1; + } + for(looper = 0; looper < 4; looper++) { + mvwaddch(dotdeer0, y_pos, x_pos, (chtype)'.'); + wrefresh(dotdeer0); + wrefresh(w_del_msg); + werase(dotdeer0); + wrefresh(dotdeer0); + wrefresh(w_del_msg); + napms(50); + } + } + + y_pos = 2; + + for(; x_pos > 50; x_pos--) { + for(looper = 0; looper < 4; looper++) { + + if(x_pos < 56) { + y_pos = 3; + + mvwaddch(stardeer0, y_pos, x_pos, (chtype)'*'); + wrefresh(stardeer0); + wrefresh(w_del_msg); + werase(stardeer0); + wrefresh(stardeer0); + wrefresh(w_del_msg); + } else { + mvwaddch(dotdeer0, y_pos, x_pos, (chtype)'*'); + wrefresh(dotdeer0); + wrefresh(w_del_msg); + werase(dotdeer0); + wrefresh(dotdeer0); + wrefresh(w_del_msg); + } + } + } + + x_pos = 58; + + for(y_pos = 2; y_pos < 5; y_pos++) { + + touchwin(lildeer0); + wrefresh(lildeer0); + wrefresh(w_del_msg); + + for(looper = 0; looper < 4; looper++) { + deer_step(lildeer3, y_pos, x_pos); + deer_step(lildeer2, y_pos, x_pos); + deer_step(lildeer1, y_pos, x_pos); + deer_step(lildeer2, y_pos, x_pos); + deer_step(lildeer3, y_pos, x_pos); + + touchwin(lildeer0); + wrefresh(lildeer0); + wrefresh(w_del_msg); + + x_pos -= 2; + } + } + + + x_pos = 35; + + for(y_pos = 5; y_pos < 10; y_pos++) { + + touchwin(middeer0); + wrefresh(middeer0); + wrefresh(w_del_msg); + + for(looper = 0; looper < 2; looper++) { + deer_step(middeer3, y_pos, x_pos); + deer_step(middeer2, y_pos, x_pos); + deer_step(middeer1, y_pos, x_pos); + deer_step(middeer2, y_pos, x_pos); + deer_step(middeer3, y_pos, x_pos); + + touchwin(middeer0); + wrefresh(middeer0); + wrefresh(w_del_msg); + + x_pos -= 3; + } + } + + napms(300); + + y_pos = 1; + + for(x_pos = 8; x_pos < 16; x_pos++) { + deer_step(bigdeer4, y_pos, x_pos); + deer_step(bigdeer3, y_pos, x_pos); + deer_step(bigdeer2, y_pos, x_pos); + deer_step(bigdeer1, y_pos, x_pos); + deer_step(bigdeer2, y_pos, x_pos); + deer_step(bigdeer3, y_pos, x_pos); + deer_step(bigdeer4, y_pos, x_pos); + deer_step(bigdeer0, y_pos, x_pos); + } + + --x_pos; + + for(looper = 0; looper < 6; looper++) { + deer_step(lookdeer4, y_pos, x_pos); + deer_step(lookdeer3, y_pos, x_pos); + deer_step(lookdeer2, y_pos, x_pos); + deer_step(lookdeer1, y_pos, x_pos); + deer_step(lookdeer2, y_pos, x_pos); + deer_step(lookdeer3, y_pos, x_pos); + deer_step(lookdeer4, y_pos, x_pos); + } + + deer_step(lookdeer0, y_pos, x_pos); + + for(; y_pos < 10; y_pos++) { + for(looper = 0; looper < 2; looper++) { + deer_step(bigdeer4, y_pos, x_pos); + deer_step(bigdeer3, y_pos, x_pos); + deer_step(bigdeer2, y_pos, x_pos); + deer_step(bigdeer1, y_pos, x_pos); + deer_step(bigdeer2, y_pos, x_pos); + deer_step(bigdeer3, y_pos, x_pos); + deer_step(bigdeer4, y_pos, x_pos); + } + deer_step(bigdeer0, y_pos, x_pos); + } + + --y_pos; + + deer_step(lookdeer3, y_pos, x_pos); + return( 0 ); +} + +static RETSIGTYPE done(int sig GCC_UNUSED) +{ + signal(SIGINT,done); + signal(SIGTERM,done); +#if !defined DOS && !defined OS2 + signal(SIGHUP,done); + signal(SIGQUIT,done); +#endif + clear(); + refresh(); + endwin(); + exit(EXIT_SUCCESS); +}