[net.sources] TVX: Replacement Part 1 of 7

wampler@unmvax.UUCP (01/21/86)

	This is a reposting of part 1 of 7 which seems to have
gotten only to a few sites (same story for part 2, which I'm
reposting as 2a and 2b).  This version is different than the
original 1 in that it contains an additional file called porting.tvx
that I've written since the original posting to help a little
for porting to new systems.


	This is a mature, well debugged editor.  Unlike emacs, it
is a two mode editor (like vi).  Recent surveys indicate that about
40% of users prefer a two mode editor.  This code contains ifdefs
for 4.2 BSD Unix (on Vaxen and Suns), IBM-PC DOS, Generic MS-DOS,
CP/M-80, and the Atari 520ST.  It should be trivial to port it to
other systems with real C compilers.  It has never been tried on
little systems like 6502's.

	I would like to act as a central clearing house for bug
reports - I will fix all bugs I hear about.  I will post major
bugs to net.sources.bugs as I get reports.

	I would like to hear about new implementations and
possible extensions.  I don't want to hear any complaints about the
design or code.  This is an evolved editor, and if I were to start
from scratch, there would be things different - but...  I think
this will compare favorably with any public domain available.

	All postings are in shar format and contain directions for
splitting the files.

	Disclaimer: This editor has been used most heavily at UNM,
Sandia National Laboratories, and Los Alamos National Laboratories. 
It was originally designed in 1979, so the command set and user
interface are well debugged.  It is possible that there are some
code bugs, and that the TERMCAP version will not work on ALL terminals,
but it works on most. The SUN version still needs an interrupt
handle to be completely dynamic in windows - but the '(' command
will re-size the windows manually.  The University of New Mexico
has not had any part in the development of the editor.  It is
posted as is - there are no warranties of any kind with the editor.
--
Dr. Bruce E. Wampler
University of New Mexico
Department of Computer Science
Albuquerque, NM 87131

..{ucbvax | seismo!gatech | ihnp4!lanl}!unmvax!wampler


Distribution follows:  cut here and submit to sh.
#--------CUT---------CUT---------CUT---------CUT--------#
#########################################################
#                                                       #
# This is a shell archive file.  To extract files:      #
#                                                       #
#    1)	Make a directory (like tvx) for the files.      #
#    2) Write a file, such as "filen.shar", containing  #
#       this archive file into the directory.           #
#    3) Type "sh file.shar".  Do not use csh.           #
#                                                       #
#########################################################
#
#
echo Extracting readme:
sed 's/^X//' >readme <<\SHAR_EOF
X	TVX - A full screen editor in C
X
X===========================================================================
X**************************** RELEASE NOTES ********************************
X
XVersion 1/10/86
X
X	This is the USENET public domain distribution of TVX.
X
X===========================================================================
X
X	Developed by:
X		Dr. Bruce E. Wampler
X		University of New Mexico
X		Department of Computer Science
X		Farris Engineering Center
X		Albuquerque, NM 87131
X
X
X	USENET RELEASE NOTES:
X
X	Description of files included in distribution (unix versions use
X	lower case file names):
X
X	QUICKREF.TVX - text quick refernece charts for TVX
X	TVX_REF.DOC - documentation for TVX - it is ready for
X			80 col, 10 cpi, 66 line printer
X
X	Makefile    - File to make TVX on unix
X	TVX_MAKE.BAT - batch file to compile tvx + utilities with cii c-86
X			on IBM-PC or MS-DOS
X
X	TVX_1.C	   - main part of code (part 1), mostly os/terminal independent
X	TVX_2.C	   - main part of code (part 2), mostly os/terminal independent
X	TVX_LEX.C  - defaults, some os dependent stuff in here.  Major
X		     changes in defaults can be fixed by recompiling this file.
X	TVX_IO.C   - almost all I/O, including screen, confined to this file.
X	TVX_LIB.C  - misc library routines needed by TVX.
X	TVX_IBM.C  - IBM-PC screen driver
X	TVX_UNIX.C  - contains unix specific code, including termcap driver
X
X	TVX_DEFS.IC - #define's for version, os, terminal, defaults
X	TVX_GLBL.IC - global data structures
X	TVX_TERM.IC - definitions for various terminals and systems
X
X
X	TVX_CFG.C   - program used to build CONFIG.TVX file for -c switch
X	TVX_PTCH.C  - program used to patch TVX executable with CONFIG.TVX
X		      this is NOT a very polished program!
SHAR_EOF
echo Extracting quickref.tvx:
sed 's/^X//' >quickref.tvx <<\SHAR_EOF
X		*** Quick Reference Summary ***
X
X  Usage: tvx filename [-b -i -l -o=f -r -s -t -w -# {-z -c=f}]
X
X    -[no]b : backup file           -[no]i : autoindent
X    -[no]l : make command log file -t : tty mode
X    -o=outputfile                  -r : read only
X    -s : big save buff             -[no]w : word processing mode
X    -# : set virtual window lines to #
X
X  On MS-DOS versions:
X    -[no]z : use control-z for end of file
X    -c=configfile                  -c : use /bin/config.tvx
X
X
X               TVX Commands (n => count allowed)
X
X
X    nA Append lines to save buffer (previous contents retained)
X     B Buffer beginning - move cursor to top of current buffer
X    ^B File beginning - move cursor to beginning of file
X    nC Change chars - delete n characters, enter insert mode
X    nD Down line - move cursor to beginning of next nth line
X   n^D Down column - move to same column in nth line down.
X     E Buffer end - move cursor to end of current buffer
X   n^E Insert repeat buffer n into current text for Editing
X    nF Find pattern - terminated with Escape - wild cards possible
X    ^F Find across buffs - searches across file buffers
X     G Get save buffer - insert contents of save buffer into text
X    ^G Unkill last line - get back the last single line killed
X    nH Half page - move cursor down (+n) or up (-n) half screen
X    nI Insert (till $) - If n supplied, then single char inserted
X     J Jump back to line cursor was on before previous command
X    nK Kill character - deletes starting at char cursor is over
X   n^K Kill line - deletes n lines
X    nL Left - move cursor n characters left
X     M Memory status - show basic status
X    nN Note current location, up to 9 different places remembered
X   n^N Reset location - return cursor to location n
X    nO Open blank line - new line in front of cursor
X    ^O Operating system - allows operating system commands
X    nP Page - move cursor up (-n) or down (+n) screenfuls
X    ^P Print screen - only on PCs
X    nR Right - move cursor right n characters
X    ^R Restore edited buffer - Used with ^E command
X    nS Save n consecutive lines in save buffer - deletes old contents
X    nT Tidy (fill text) - uses margin set by :w
X    ^T Abort session - edits are lost!
X    nU Up - move cursor up n lines to line beginning
X   n^U Up column - retains column
X     V Verify - repaints the screen
X   n^W Write buff, get next part of large file, -n writes to cursor
X    ^X Exit, end session - save edits
X   n^Y Yank to(-n)/from(+n) file - prompt for filename will follow
X   nBS Delete character before the cursor
X    n; Find again - re-uses last find pattern
X     / Delete "last thing" - following g, s, a, f, ^f commands
X     = Change "last thing" - like /, but enters insert mode
X     ' Delete to line beginning - deletes before cursor
X     " Delete to line end - cursor onward to end of line
X     , Line beginning - move cursor to beginning of line
X     . Line end - move to end of current line
X  nTAB Word right - move to begining of word to right
X    n{ Word left - left a word. n=0 move to beg of current word.
X n<>$$ Repeat loop - execute commands between <>'s n times
X    n& Repeat again - execute current repeat buffer again
X   n#k Execute repeat buffer k n times
X     ? Help - gives a help screen
X     @ Invoke cmd file - execute file of TVX commands
X     * Insert pattern found last - leaves in command mode
X     $ Escape - end insert, find, repeat
X   n:p Set parameter p -  Possible parameters:
X        A - Autoindent (1=y,0=n)     D - display line
X        E - Expand tabs to n spaces  F - find case (0=exact,1=any)
X        M - Match wild cards         O - set output file name
X        S - scroll window            R - repeat buffer to use
X        T - tty mode                 U - define user wild card set
X        V - virtual window           W - autowrap width
X
X  Wild card matching - when wild card matching (:M) is enabled (default),
X  the following wild cards (control characters) are supported
X
X  ^A - alphanumeric character (a-z,0-9)   ^D - a digit (0-9)
X  ^L - any letter (a-z) ^O - Other - not ^A  ^P - Punctuation
X  ^X - any single character  ^U - a character from user set (:U to set)
X  Any of the above preceded by ^W matches a "word" of the wild card.
X  A ^N will match a "word" of characters NOT in the wild card set.
X 
SHAR_EOF
echo Extracting porting.tvx:
sed 's/^X//' >porting.tvx <<\SHAR_EOF
X	Additional notes for porting TVX
X
X	While the code is pretty well documented and contains some notes
Xfor porting TVX to new environments, I thought a few additional notes
Xmight be helpful.
X
X	It should be very simple to port TVX to a new machine for a
Xspecific terminal.  The only "hard" part comes when trying to use a
Xpackage like TERMCAP.  Then, the 4.2 Unix code can serve as a guide.
XIn effect, what that code does is get the screen controls and patch
Xthe regular TVX screen control locations.
X
X	Typically, however, it should be almost trivial (assuming a
Xfairly standard C implementation - the current code compiles unchanged
Xon 4 different C compilers) to generate a version of TVX for a specific
Xterminal.  The main steps:
X
X	1. Define the control codes for the terminal.  These are explained
Xin some detail in the manual.
X
X	2. Fix file I/O calls.  This may take no changes at all.  The
Xmain issue has been the mode argument to fopen.  TVX likes to get the
Xfile raw - with NO end of line handling by the C I/O system.  These
Xthings are identified by #define's in tvx_defs.ic.  The other issue
Xis what is the end of line character.  Unix likes LF only, while
XMS-DOS and descendants like CR/LF (actually DEC RT-11 descendants).
XThe #define FILELF and NEWLINE handle this.
X
X	3. The last issue is getting characters to and from the terminal.
XThese are isolated in tvx_io.c.  The critical routines:
X	ttrd() [ and ttrd_() ]:  This reads one character (ANY possible
Xcharacter, except possible ^S and ^Q) from the terminal, UNECHOED.
XThe routine ttinit is called to possibly initialize things, and ttclos
Xat the end to undo whatever ttinit did.
X
X	ttwt() and ttwtln():  These are used to send characters
Xto the screen.  ttwt sends a single character, immediately and unbuffered.
Xttwtln can be based on ttwt, but is provided and used whenever a chunk
Xis available to write.  This is essential on busy time shared systems.
X
X	That's really the only problem areas.  One good thing to do
Xwhen porting is to find all the uses of #ifdef (and #ifndef) for
Xthe implementations described: MSDOS, UNIX, GEMDOS.  Those certainly
Xidentify the areas most likely to be different on your system.
X
X	I'd be glad to answer any questions you might have about porting.
X
X--
XDr. Bruce E. Wampler
XUniversity of New Mexico
XDepartment of Computer Science
XAlbuquerque, NM 87131
X
X..{ucbvax | seismo!gatech | ihnp4!lanl}!unmvax!wampler
X
SHAR_EOF
echo ALL DONE!
exit 0