[mod.sources] tvx: 10 of 10

sources-request@panda.UUCP (03/11/86)

Mod.sources:  Volume 4, Issue 24
Submitted by: gatech!unmvax!wampler (Bruce Wampler)

#--------CUT---------CUT---------CUT---------CUT--------#
#########################################################
#  TVX: File 10 of 10                                    #
#                                                       #
# 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 tvx_ref2.doc:
sed 's/^X//' >tvx_ref2.doc <<\SHAR_EOF
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X                  *** USER CUSTOMIZATION of TVX ***
X 
X     A program called TVX_CFG is also provided with most versions of
XStandard TVX.  It allows you to customize TVX to a great extent.  The
Xprogram generates a file called CONFIG.TVX.  When TVX is started with
Xa command line of the form: 'TVX filename -c=config.tvx", the values
Xdefined in CONFIG.TVX will be used instead of the defaults.  (Warning:
XTVX_CFG may not be implemented for all systems.  It does not work with
Xthe emulator versions of TVX.)
X 
X     TVCONFIG is mostly self explanatory.  It allows you to change the
Xfollowing:
X 
X1. Commands.  All of the approximately 50 commands can be redefined.
XThere are some restrictions: all commands must be a single letter, and
Xcase is ignored.  The '@', ESCAPE, and '<>' commands cannot be
Xchanged.  Commands cannot be a number, including a '-'. 
X 
X2. Synonyms.  You may define some synonyms, such as space for right,
Xor RETURN for down.  You cannot duplicate previously defined
Xcommands. 
X 
X3. Function Keys.  Up to 50 function keys may be defined to be
Xequivalent to any command (in fact any letter or character).  When a
Xfunction key is pressed, TVX will translate it to the character you
Xspecify.  If your function keys use an ESCAPE as a prefix character,
Xyou will have to redefine a function key to be ESCAPE! 
X 
X4. Parameters.  You may change the default for any of the ':'
Xparameters. 
X 
X     After you have built a suitable working version of CONFIG.TVX,
Xanother program called TVX_PTCH has been provided to allow TVX.EXE (or
XTVX.COM) to be permanently patched with the options set by TVX_CFG.
XThis means you won't have keep track of the CONFIG.TVX file any more,
Xand won't need the '-c' switch. 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X                                 -22-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X                        *** Error Messages ***
X 
X*** Abort, are you sure? 
X     This message is displayed after the "abort" command has been
Xentered.  A reply of y or Y will cause the session to be terminated. 
X 
X*** Bad O= switch
X     An incorrect format was specified for the O= switch. 
X 
X*** Bad @ name
X     An invalid file name was specified.  Re-enter. 
X 
X*** Bad command: x
X     The command is not a valid TVX command. 
X 
X*** Bad file name
X     An invalid file name was specified.  Re-enter. 
X 
X*** Bad output file: filename
X     An invalid output file was specified. 
X 
X*** Bad par (val | name)
X     An invalid value or parameter name was specified. 
X 
X*** Bad rpt buff #
X     An invalid repeat loop number was entered. 
X 
X*** Bad switch
X     An invalid switch was specified.  Re-enter file name and
Xswitches. 
X 
X*** buffer empty
X     Information message.  Displayed after a new file has been
Xcreated, or when the write buffer command is executed and the text
Xbuffer is empty. 
X 
X*** Can't create new name
X     TVX was unable to create a new name for the output file.  Free
Xsome disk space, rename the file, try again. 
X 
X*** Can't insert that
X     There are three values that TVX uses internally, and thus are not
Xvalid as user inserted characters in the text buffer. 
X 
X*** Can't save last line twice! 
X     The last line of the buffer can only be saved once.  (That
Xapplies to the other lines, too, but the last line is a special case.)
X 
X*** Can't :o, R/O
X     It makes no sense to set a new file name when the file is read
Xonly. 
X 
X*** Can't, buffer empty.  Insert 1st
X     Most TVX commands are not valid until some text has been inserted
Xinto the buffer. 
X 
X 
X 
X                                 -23-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X*** Can't: R/O
X     File beginning is illegal when the file is read only. 
X 
X*** Compacting buffer
X     Information message.  Displayed when TVX is compacting the
Xbuffer.  The compaction process may take several seconds. 
X 
X*** Compacting done
X     Information.  The compaction is complete. 
X 
X*** Compactor lost: quit now! 
X     An internal error has been discovered.  Exit TVX immediately, and
Xpreserve the backup copy.  Try the session again. 
X 
X*** Create?  (y/n)
X     The file name specified does not exist.  A y answer will cause
Xthe file to be created.  A n answer will allow the file name to be
Xrespecified. 
X 
X*** Error reopening
X     Something has gone wrong with the 'File beginning' command.
XExit, and try editing the file again.  Be careful since an empty file
Xmay have been created. 
X 
X*** File only part read
X     There was not enough room in the save buffer to hold the entire
Xexternal file specified in the 'merge' command.  Try re-editing using
Xthe 's' big buffer switch. 
X 
X*** Line no longer there
X     Return to noted location can't work because the noted line has
Xbeen deleted. 
X 
X*** lines filled
X     TVX has run out of room to add more lines.  Use the 'write
Xbuffer' or 'file beginning' command to get more space for new lines. 
X 
X*** no get room
X     There is not enough room in the text buffer to insert all the
Xtext in the save buffer.  Use the 'file begin' or 'write buffer'
Xcommands, and try again.  The '-^W' command is often useful. 
X 
X*** no more lines for insert
X     See "lines filled". 
X 
X*** no nesting
X     TVX does not allow nested repeat loops: "<<..>>". 
X 
X*** no save room
X     There is not enough room left to save any more text in the save
Xbuffer.  Try saving smaller blocks, or use the 'file begin' command to
Xget more space. 
X 
X*** No more free lines for insert
X     The maximum number of lines have been used.  Write the buffer
Xbefore inserting more new lines. 
X 
X 
X                                 -24-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X*** not found
X     The current find pattern was not found. 
X 
X*** Not a valid rpt buff
X     The current line does not contain a valid repeat loop for the ^R
Xrestore command to use. 
X 
X*** reading file... 
X     Displayed while TVX is reading in the file. 
X 
X*** rename fails
X     Something has gone wrong with the 'File beginning' or 'quit'
Xcommands.  On timeshared systems, this may mean you didn't have write
Xcapability for the file.  The work file will probably be retained, and
Xcan be manually renamed or copied using standard operating system
Xcommands. 
X 
X*** search fails
X     A cross-buffer search has failed to find pattern. 
X 
X*** Save buffer empty! 
X     Tried to write to a file when save buffer empty. 
X 
X*** Unable to open external file
X     An invalid name was specified. 
X 
X*** Unable to open yank file
X     An invalid name was specified. 
X 
X*** writing buffer
X     Displayed when the buffer is being written out. 
X 
X*** writing partial buffer
X     Partial buffer only, as caused by the '-^W' command. 
X 
X*** Yank filename:
X     Enter the name of the file you want to read into the save
Xbuffer. 
X 
X*** 100 chars only
X     At most, 100 characters are allowed in each find pattern and each
Xrepeat loop. 
X 
X*** <> not complete
X     The repeat loop has terminated before the specified number times
Xhave been executed.  This is usually what you wanted, and can be
Xcaused by failing to find a pattern, or reaching the end of the
Xbuffer.  An invalid command or other error will also cause a repeat
Xloop to terminate. 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X                                 -25-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X                           *** TTY MODE ***
X 
X     Normally, TVX is uses as a full screen editor.  It will work on
Xdumb crt terminals or on hard copy terminals, however.  The alternate
Xmode of operation is called tty mode.  Tty mode is also useful for
Xterminals hooked up with slow baud rates.  Almost all TVX commands are
Xsupported in tty mode.  The main difference is that the editor no
Xlonger operates in a what you see is what you get mode. 
X 
X     When TVX is first started in tty mode (either by the -t command
Xline switch, or using 1:t), it will display a 'tvx>' prompt.  The
Xnormal mnemonic commands are then entered on the input line.  The
Xinput line is terminated by a <return> (which is not sent as a
Xcommand).  Each letter on the input line will be interpreted as a TVX
Xcommand.  Thus, entering a line: 'dddr' would move the cursor 3 lines
Xdown and one character right.  The result of the commands will not be
Xdisplayed however. 
X 
X     The 'V' verify command operates specially for tty mode, and is
Xused to type out lines of the file.  The normal procedure, then is to
Xenter commands on the command input line, then enter appropriate 'V'
Xcommands to display relevant lines of the buffer. 
X 
X     As long as normal TVX commands are entered, the command line
Xprompt is 'tvx>', and the terminating <return> sends commands to TVX
Xto execute.  In insert, find, and repeat, the prompt will change to
X'+'.  All text entered, including <return>'s is entered into the text,
Xthe find pattern, or the repeat loop buffer.  An Escape ends the
Xcommand, and an additional <return> sends the line to TVX. 
X 
X     Why is tty mode included in TVX?  The earliest versions of TVX
Xhad tty mode because there were a lot of TI Silent-700's around used
Xat 300 baud.  No longer.  One reason is that tty mode provides an
Xinterface useful to visually handicapped users.  The other is that it
Xis useful for certain things not possible in visual mode.  For
Xexample, suppose you wanted to see every line in a file containing a
Xcertain pattern.  Tty mode is useful for this.  Enter tty mode (1:t),
Xthen enter the following loop after the 'tvx>' prompt:
X     1000<fpattern$vd>$$
XThis command will find the pattern, print the line, and go to the next
Xline to search again.  Failure on the last find will exit the loop.
XThere are no doubt other subtle tricks like this that tty mode can be
Xused for. 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X                                 -26-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X                     *** INSTALLATION OF TVX ***
X 
X     If you have the C source code of TVX, this section has some notes
Xyou should find useful if you recompile the code to customize TVX for
Xyour system.  It should also be helpful if you are installing TVX on a
Xnew system.  If you are just a user, then you can ignore this
Xsection. 
X 
X 
X*** General Comments ***
X 
X     TVX has been designed to be portable.  It has had versions
Xrunning under CP/M-80, MS-DOS, GEMDOS, RT-11, RSX-11, VMS, and Unix
XBSD 4.2.  The heart of TVX portability is the terminal driver.  For
Xdedicated systems, the control codes used by a specific terminal are
Xhard wired into C global variables and a terminal specific version is
Xcompiled.  It has been customary to give a unique name to each
Xdifferent version such as TVV for a VT-52 version, TVT for a televideo
Xversion, etc.  The Unix 4.2 BSD version of TVX has been written to
Xtake advantage of the TERMCAP library usually provided, and is thus
Xterminal independent. 
X 
X     Since terminals differ widely, TVX tries to update the screen as
Xbest as possible using the control codes available.  The minimum set
Xof control sequences required by TVX include direct x-y cursor
Xpositioning, and erase from cursor to the end of the current line.
XAlmost all terminals have at least these two controls.  The only known
Xterminal widely available that does not have both of these is the
XADM-3a.  Thus, TVX will NOT work on ADM-3a's.  Another desirable
Xcontrol sequence is the ability to insert a blank line at the top of
Xthe screen (reverse scroll).  This allows TVX to scroll rather than
Xjump from one screen to the next.  However, TVX will perform
Xadequately even on terminals with only x-y and erase to end of line.
XIt has also been found that TVX does not always work on terminals with
Xmultiple pages of screen data.  The scroll bottom line command usually
Xfails. 
X 
X*** Quick and Dirty Porting ***
X 
X     It should be very simple to port TVX to a new machine for a
Xpecific 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
Xspecific terminal.  The main steps:
X 
X     1. Define the control codes for the terminal.  These are
Xexplained in 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
X 
X 
X                                 -27-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
Xthings are identified by #define's in tvx_defs.ic.  The other issue is
Xwhat is the end of line character.  Unix likes LF only, while MS-DOS
Xand descendants like CR/LF (actually DEC RT-11 descendants).  The
X#define FILELF and NEWLINE handle this. 
X 
X     3. The last issue is getting characters to and from the
Xterminal.  These are isolated in tvx_io.c.  The critical routines:
X 
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 to the
Xscreen.  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
Xsystems. 
X 
X     That's really the only problem areas.  One good thing to do when
Xporting is to find all the uses of #ifdef (and #ifndef) for the
Ximplementations described: MSDOS, UNIX, GEMDOS.  Those certainly
Xidentify the areas most likely to be different on your system. 
X 
X     Note that the Microsoft C compiler for MS-DOS is slightly brain
Xdamaged - the arguments to rename in its library are backwards from
Xthe rest of the world. 
X 
X 
X*** Source Files Supplied ***
X 
X     The following files are included in most distributions:
X 
X  TVX_1.C  - main part of code (part 1)
X  TVX_2.C  - main part of code (part 2)
X             These two files are mostly os and terminal independent.
X  TVX_EDIT.C - The main heart of the command parser.  Isolated to
X               make generating new emulators easy.  When generating
X               a new emulator, only TVX_EDIT and TVX_LEX need to
X               be recompiled.
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 specific code, specifically the screen driver
X              (TVX_IBM.ASM - hand optimized version of TVX_IBM.C)
X  TVX_UNIX.C - contains unix specific code, including termcap driver
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  TVX_CFG.C - used to build CONFIG.TVX file for -c switch
X  TVX_PTCH.C - MS-DOS versions only - used to permanently apply
X              config settings to TVX.EXE.
X
X  TVX_MAKE.BAT - MS-DOS Batch file to build TVX using cii c-86.
X 
X 
X                                 -28-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X  TVX_MAKE.UNX - Unix Makefile to make on unix.
X
X  TVX_REF.DOC - This file, preformatted for printing on a "standard"
X                printer - 80 columns by 66 lines.
X  TVX_TUT.DOC - A novice user tutorial for using Standard TVX.
X  xxx.ref -    a quick reference card for given version of TVX.
X 
X 
X*** Screen Driver and Control Sequences ***
X 
X     The actual codes used by TVX to update the screen are global
Xvariables in the 'tvx_glbl.ic' file.  Using the '#ifdef EXTERN' trick
Xdescribed in that file, the screen variables (plus most other relevant
Xglobal variables) are included as external references.  The actual
Xdefinitions for a given terminal are included in a file called
X'tvx_term.ic'.  Several sample definitions are included in the
Xdistribution code.  A description of each relevant variable follows:
X 
X 
X** X-Y Cursor Addressing
X 
Xint addx - amount to add to internal x position get terminal's x
Xvalue.  Terminals typically encode x-y as a single printable
Xcharacter, thus requiring the addition of a blank to make x-y
Xprintable.  Since TVX uses a 1,1 origin, this value will commonly be
X31. 
X 
Xint addy - same as addx, but for y position. 
X 
Xchar cxychr - true (1) if convert xy binary representation to ascii
Xstring. 
X 
Xchar cxy1st - 'l' if line coordinate first, 'c' if column first. 
X 
Xchar cxybeg[8], char cxymid[8], char cxyend[8] - The x-y cursor
Xcontrol sequence usually takes one of two forms: <control><x><y> or
X<control><x><middle><y><end>.  The x and y may be reversed.  These
Xthree arrays are used to send the proper control sequence for xy
Xpositioning. 
X 
X 
X*** Other control sequences
X 
Xchar cversn[12] - a version string to identify terminal. 
X 
Xchar cerrbg[8], char cerred[8] - sequences sent when an error message
Xsent to terminal's last line.  Note that cerrbe is sent BEFORE the
Xcursor is moved to the last line, and cerred is sent before the cursor
Xis returned to the original position.  Some terminals give problems if
Xa highlight sequence is sent before a cursor positioning sequence.  A
Xbell is usually safe for most versions. 
X 
Xchar ctopb[8] - This sequence should insert a blank line when the
Xcursor is at the top left corner.  It is often called reverse line
Xfeed.  A command to insert a line usually performs the same function,
Xbut some terminals don't have both. 
X 
X 
X                                 -29-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
Xchar cinit[20], char cendit[20] - these sequences are sent to
Xinitialize and reset the terminal. 
X 
Xchar cbotb[8] - this sequence scrolls the screen up one line when the
Xcursor is on the last line.  Line feed works for any terminal
Xencountered to date. 
X 
Xchar celin[8] - Erase from cursor to end of line.  This sequence is
Xrequired for operation of TVX. 
X 
Xchar cescr[8] - Erase from cursor to end of screen.  If the terminal
Xdoesn't have this, it is simulated using multiple celins. 
X 
Xchar ccsrcm[8], char ccsrin[8] - These are used to change the cursor
Xfrom command mode to insert mode.  Many terminals do not support a
Xmethod of changing the cursor shape.  These have been also been used
Xto change the screen from normal to reverse video and back. 
X 
Xchar ciline[8] - Insert a blank line.  A blank line is inserted on the
Xline the cursor is on.  If available, it can be used for ctopb, too. 
X 
Xchar ckline[8] - Kill a line.  The line the cursor is on is deleted,
Xand the following text scrolled up. 
X 
Xchar cundlb[8], cundle[8] - TVX has the capability to optionally
Xsupport bold and underline for some text processors.  For example, a
X^U can be used to toggle underscore.  This is only useful for a text
Xformatter that can recognize such a sequence. 
X 
Xchar cboldb[8], char cbolde[8] - Similar to undlb, but boldface. 
X 
X 
X*** Default settings
X 
Xint ddline - default display line.  This sets which line is the
Xdefault home display line.  For scrolling versions (dscrl != 0), right
Xin the middle is a good place.  For fixed cursor line versions,
Xsomething below the middle seems better (like 16 for 24 line
Xscreens). 
X 
Xint dscrl - default scroll lines.  If this is non-zero, the cursor
Xwill move up and down lines on the screen with cursor movement
Xcommands.  This requires a bit less screen update overhead, and is
Xbetter for slower time shared systems.  If it is zero, the cursor will
Xremain fixed on ddline, and text will scroll on and off the screen as
Xneeded.  Both these are resettable with the : command. 
X 
Xint dxcase - default search case.  0 means find is case insensitive, 1
Xmeans find must match exact case. 
X 
Xint usecz - MS-DOS versions only.  If 1, TVX will put a Control-Z end
Xof file mark in the file (this is CP/M compatible).  If 0, TVX uses
XMS-DOS end of file conventions. 
X 
Xint autoin - TRUE (1) if auto indent, FALSE (0) otherwise. 
X 
X 
X 
X                                 -30-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
Xint logdef - Create backup log file by default?  0->no, 1-> yes. 
X 
Xchar wildch - The character used as a wild card in finds. 
X 
Xchar delkey - the delete character key, usually backspace. 
X 
Xint tvhardlines - number of physical lines on screen. 
X 
Xint tvlins - number of lines on virtual screen.  Initially should be
Xsame value as tvhardlines. 
X 
Xint tvcols - number of columns on screen.  If the terminal wraps new
Xtext to the next line rather than discarding characters after the last
Xcolumn, then tvcols must be set to 1 less than the true width of the
Xterminal. 
X 
Xint isibmpc - TRUE (1) if this version uses the custom IBM-PC screen
Xdriver.  FALSE (0) if uses regular terminal output code. 
X 
Xchar synofr[20], char synoto[20] - These are used to map commands.
XThe synofr contains commands to be aliased to the corresponding
Xcommand in the synoto table.  For example, the '[' and '{' keys are
Xoften reversed on some terminals.  Making '[' in synofr a synonym to
X'{' in synoto will make the two commands the same. 
X 
Xchar funkey - If the terminal has function keys, they can be supported
Xby TVX by setting this variable to the first code sent by the function
Xkey, usually ESCAPE.  TVX supports only two code sequences for
Xfunction keys. 
X 
Xchar funchar[50] - this is the second code sent by a function key. 
X 
Xchar funcmd[50] - this is the equivalent command a given function key
Xwill be mapped to.  Similar to synofr and synoto. 
X 
X 
X*** #define options
X 
X     The file 'tvx_defs.ic' has many #define statements that can be
Xused to customize TVX for particular installations.  Ideally, the
Xsource for TVX should be maintained as one set, and differences
Xbetween versions handled by #defines.  Most #defines are explained in
Xthe source code, but a few deserve a few extra comments, and are
Xsummarized below. 
X 
X#define VERSION " - TVX (7/1/85) - " - This defines the version of
XTVX.  Any time a modification is made, the VERSION define should be
Xupdated. 
X 
X#define VB - whether or not to create backup log version or not.  This
Xdoes NOT imply the file "backup.log" will be used automatically (see
Xvariable logdef), simply that the code is included. 
X 
X#define ULBD - If defined, TVX supports underline, bold in ^U, ^B
Xformat. 
X 
X 
X 
X                                 -31-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X#define BACKUPNAME - This defines the name of the backup log file, if
Xused. 
X 
X#define BUFFLIMIT - This defines how much space is saved in the text
Xbuffer when reading in a file.  This determines how much space is
Xreserved for saving text with the 'S' command, and how much is left
Xover for new inserts.  Smaller values allow more text from the file to
Xbe read, larger values allow more text to be saved.  The '-s' switch
Xat runtime increases this value. 
X 
X#define FILEREAD, #define FILEWRITE - These define the string used for
Xfile mode in the fopen() calls.  Unix and MS-DOS versions are not
Xtypically exactly compatible, as most MS-DOS C's allow a different
Xmode to handle the CR/LF problem. 
X 
X#define FNAMESIZE - maximum length of file names. 
X 
X#define INT16 - If #defined, then the normal C int is 16 bits long.
XThis changes the way memory status is displayed. 
X 
X#define LINELIMIT - Like BUFFLIMIT, only number of lines. 
X 
X#define MAXBUFF - Defines maximum number of characters allocated to
Xtext buffer.  Malloc() is used to get the space from the runtime
Xsystem.  It is possible less than MAXBUFF will be available.  The
Xmaximum allowed for any given system must be less than the maximum
Xvalue represented by an unsigned int.  If MAXBUFF is very large, there
Xget to be a noticeable initialization delay. 
X 
X#define MAXLINE - This determines the maximum number of lines
Xallocated per buffer.  It is related to MAXBUFF. 
X 
X#define REPEATBUFS - defines how many repeat buffers are allocated.
XIf space is a problem, allocate fewer repeat buffers. 
X 
X#define USELF - This symbol should be defined if the terminal needs a
Xline feed character after each carriage return.  Almost always true. 
X 
X#define FILELF - This symbol is defined if text files use a CR/LF
Xcombination.  It causes a NEWLINE/LF to be written to files. 
X 
X#define NEWLINE - This defines the actual character used as a new line
Xin files.  On CR/LF systems, it should be a CR (13).  On systems like
XUnix with a single new line separator, it should be that character
X(LF). 
X 
X#define USECTRLZ - defined if the code for handling a Control-Z and
Xend of file mark should be used. 
X 
X#define NEEDTVLIB - define this if the standard C library provided
Xdoesn't have the routine in TVX_LIB. 
X 
X#define HELP - Define this if help should be supported.  The help
Xroutine uses significant space, which can be saved if help isn't
Xcompiled in. 
X 
X 
X 
X                                 -32-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X#define CONFIGFILE - define this if support for the '-c' switch is
Xdesired. 
X 
X 
X 
X**** MS-DOS Notes ***
X 
X     TVX can be built as a generic MS-DOS version and as an IBM-PC
Xspecific version.  The MS-DOS version uses the standard DOS character
Xoutput routines.  Thus, it could use the ANSI.SYS driver, but it would
Xrun very slowly then.  The IBM-PC version has a custom screen driver
Xthat calls the ROM BIOS directly, and is very fast.  Even more speed
Xcan be had by optimizing the output assembly code (the sysint
Xoverhead).  The definitions for and IBMPC included in "tvx_term.ic"
Xalso define the keypad keys to work in a predictable manner. 
X 
X 
X 
X*** Unix Notes ***
X 
X     The usual Unix version will be the TERMCAP version.  That version
Xworks very well, but is not in all cases optimal for a given
Xterminal.  It might be desirable to build a specific version for the
Xterminal you use most often.  Most notably, the TERMCAP version does
Xnot know about cursor shapes or other control sequences to distinguish
Xcommand mode from insert mode.  Also, it sets tvcols to one less than
Xthe true value to avoid wrapping problems.  The termcap version also
Xonly sends a bell for the error message. 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X                                 -33-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X                        *** TVX File Usage ***
X 
X     TVX uses four logical files: the original file, the destination
Xfile, a work file, and the source file.  The original file and the
Xdestination file are not touched until a normal exit from TVX. 
X 
X     The source file is the current copy of the file providing text to
Xbe entered.  When TVX is first started, the source file and the
Xoriginal file are the same.  The work file is used to hold the edited
Xoutput file. 
X 
X     When the '^B' file beginning command is issued, the remainder of
Xthe source input file is written to the work output file.  The work
Xfile then becomes the new source file, and a new work file is
Xcreated.  Thus, it is possible to have four copies of a file around:
XThe .BAK backup copy of the original file, the original copy of the
Xfile, the copy of the source file, and the (partially written) work
Xfile.  Under normal operation, there will only be two copies: the
Xsource file (which is really the original file) and the possibly
Xpartially written work file.  Only by using the '^B' commands can 3
Xcopies of the file exist. 
X 
X     When you issue the normal '^X' exit command, the following
Xactions take place: Any old .BAK files are deleted.  The original file
Xis renamed to be the new .BAK version.  If the source file is
Xdifferent than the original file, it will be deleted.  The work file
Xis then renamed to be the destination file.  If you don't have write
Xaccess to the directory with the original file, then the original file
Xand the work file will not be renamed.  A message to that effect will
Xbe printed.  The normal operating system copy and rename commands can
Xbe used to recover the work file, which contains the edits made to
Xdate. 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X                                 -34-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X               *** Standard Quick Reference Summary ***
X 
X 
X       TVX Commands (n => count allowed)
X
X    nA Append lines            B Buffer beginning
X    ^B File beginning         nC Change chars
X    nD Down line             n^D Down column
X     E Buffer end            n^E Edit repeat buffer
X    nF Find pattern           ^F Find across buffs
X     G Get save buffer        ^G Unkill last line
X    nH Half page              nI Insert (till $)
X     J Jump back              nK Kill character
X   n^K Kill line              nL Left
X     M Memory status          nN Note location
X   n^N Reset location         nO Open blank line
X    ^O Operating system       nP Page
X    ^P Print screen           nR Right
X    ^R Restore edited buffer  nS Save lines
X    nT Tidy (fill text)       ^T Abort session
X    nU Up                    n^U Up column
X     V Verify                n^W Write buff
X    ^X Exit, end session     n^Y Yank to(-n)/from(+n) file
X   nBS Delete prev. char.     n; Find again
X     / Delete last thing       = Change last thing
X     ' Del to line beginning   " Delete to line end
X     , Line beginning          . Line end
X  nTAB Word right             n{ Word left
X  n<>$$ Repeat loop           n& Repeat again
X   n#k Execute repeat buffer k n times
X     ? Help                    @ Invoke cmd file
X     * Insert pat found last  n~ Toggle case
X     $ Escape - end insert, find, repeat
X   n:p Set parameter p
X
X  Possible parameters:
X
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    C - cut mode
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                                 -35-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X                 VIX - A vi-like editor based on TVX
X 
X 
X     Vix is an extension to tvx that provides a close emulation of the
XUnix editor vi.  While the majority of the common commands are
Xidentical, there are some inherent differences in the way tvx and vi
Xtreat text.  Most of the commands were implemented directly using the
XTVX equivalent, although some commands were required new code.  If the
Xvi command could not be implemented, its command letter was left
Xunused, and will produce an error message. 
X 
X     Vix does not have the underlying ex editor, so none of the escape
Xto ex commands work.  Vix does have the TVX repeat loop, however, and
Xthis compensates to a great extent for the need for ex features.
XPlease consult the TVX manual for examples of using the repeat loop.
XNote that when using the repeat loop with vix, the commands will be
Xvix commands and not tvx commands. 
X 
X     Another significant difference is that tvx (and thus vix) treats
Xthe end of line character as just another character.  Thus cursor
Xmovement commands move over the end of line in a fashion one would
Xexpect.  However, when one moves to the end of the line, the cursor is
Xplaced 'over' the newline (displayed after the last real character in
Xthe line).  This makes the '$' command work somewhat differently.
XThis also means that you can include a <return> in a search pattern.
XVix and tvx use ESCAPE to end the search pattern instead of <return>. 
X 
X     Vi uses the ':' command to read and write the file (among other
Xthings).  Vix uses the ':' to set operating parameters such as
Xautoindent, screen size, etc.  The 'ZZ' (or 'ZA' to abort without
Xchanges) command is used by vix to exit. 
X 
X     Unlike vi and ex, tvx and vix try to load the entire file being
Xedited into memory (called the buffer by tvx/vix, as opposed to the
Xyank or save buffer).  If the entire file doesn't fit, the user must
Xmanually 'page' the file in and out of memory manually.  Most of the
X'q' ("tvx" prefix) commands are supplied to handle buffer
Xmanipulation.  For more details, consult the TVX manual.  TVX/vix also
Xuses the concept of the "last thing" as a major editing tool.
XWhenever you find a pattern, skip over a word with b or w, save text
Xinto the save buffer with the 'y' or 'Y' commands, or put text from
Xthe save buffer, that text is considered the "last thing".  The 'c/'
Xand 'd/' commands will delete the last thing.  Entering a new command
Xwill forget what the last thing was until you again enter a "last
Xthing" command. 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X                                 -36-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X     The available vix commands are summarized below.  The first
Xcolumn of each entry has a character noting similarities and
Xdifferences with the real vi commands in the following fashion:
X
X- means present in vi, not implemented in vix.
X= means commands work identically {with possible minor variations}
X+ means new or significantly different command
X* means "equivalent" command, somewhat different than vi
X<space> means command unused in both vi and vix.
X
X  n in front of command means command takes count argument
X  [synonyms indicated in brackets]
X
X   ^@: Unused
X   ^A: Unused
X= n^B: Backward window. {2 lines of continuity not preserved}
X   ^C: Unused
X= n^D: Down half window.
X-  ^E: Not implemented
X= n^F: Forward window.
X*  ^G: memory status, short info line
X= n^H: backspace Command mode: left; Insert mode: del last char
X=  ^I: inserts tab in insert mode, not a command.
X= n^J: down arrow in column [j,^N]
X+ n^K: up in column [k,^P]
X=  ^L: verify screen [^R,z]
X= n^M: down to beginning of line [+]
X= n^N: [j, ^J]
X   ^O: Unused
X= n^P: [k, ^K]
X=  ^Q: Unused (flow control)
X=  ^R: Redraw screen [^L,z]
X=  ^S: Unused (flow control)
X+  ^T: TVX prefix command - see q [q,Q,T]
X* n^U: Up half window.  ** in insert mode, does NOT erase line **
X*  ^V: Not a command.  NOT literal quote in insert mode.
X*  ^W: Not a command.  NOT used for delete word in insert.
X   ^X: Unused
X-  ^Y: Not implemented
X-  ^Z: Not implemented
X=  Escape: forces command mode, safe follow char for d,c,q.
X   ^: Unused
X-  ^]: Not implemented
X-  ^^: Not implemented
X   ^_: Unused
X=  <space>:  [r]
X+  n!: Tidy.  Fills n lines up to wrap margin. [see autowrap]
X-   ": Not implemented
X+ n#p: execute repeat loop number 'p' 'n' times
X=   $: goto end of current line {end is newline, not last char}
X-   %: Not implemented
X-   &: Not implemented
X-   ': Not implemented
X-   (: Not implemented
X-   ): Not implemented
X+   *: insert last matched pattern into text buffer
X 
X 
X                                 -37-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X=  n+: [CR, ^M]
X-   ,: Not implemented
X*   -: Used in vix for negative counts, use K for up line.
X-   .: Not implemented, repeat loops are a substitute
X=   /: search {Escape used to end pattern, multi-line patterns ok}
X*   0: 0 is used for counts (especially for : parameters)
X= 0-9: count value for numeric arguments {may be negative!}
X-   :: Not implemented - use ZZ and ZA to exit
X-   ;: Not implemented
X+  n<: Begin repeat loop. Loop terminated with >$$. ($ = Esc)
X+   =: Help screens
X+   >: Used to terminate repeat loops.
X=   ?: Reverse search {search begins on previous line}
X+  n@: execute current repeat loop n times (shorthand for n#p)
X=   A: append to end of line
X*  nB: back a word {vix's concept of words is different than vi}
X=   C: changes rest of line
X=   D: delete rest of the line
X-   E: Not implemented
X-   F: Not implemented
X=  nG: goes to line number n, or end of buffer if no n supplied
X*   H: Beginning of buffer (first line in buffer)
X=   I: inserts at beginning of line
X=   J: join lines {not needed since vix treats newlines as chars}
X+  nK: Up a line to beginning of line
X*   L: bottom line of file
X+  nM: return to marked location n (n from 1 to 9, see m)
X=   N: like n, but in reverse direction
X=  nO: open a line above current line. n opens n blank lines.
X=   P: put save buffer above current line {save buffers not named}
X+   T: tvx commands (see q) [^T,q,Q]
X*   U: very limited undo!! It only restores the LAST line killed!
X    V: Unused
X*  nW: Moves forward n words [w] {vix's concept of words not same}
X=  nX: delete n characters before cursor
X+  nY: append n lines to save buffer (see y), does not change buffer
X=+ Zx: exit from vix (ZZ: normal, writes file, ZA: abort, no changes)
X-  [[: Not implemented
X    : Unused
X-  ]]: Not implemented
X=   ^: beginning of line {1st char of line, NOT 1st non-white char}
X+   _: invoke indirect command file
X=   a: append text starting after cursor
X*   b: back up a word [see B]
X=   c: change c, <sp>, ^, $, or / (delete, enter insert mode)
X    =   c - change line
X    =   <sp> - change one character
X    =   ^ - to beginning of line
X    =   $ - to end of line
X    -   w, b, and any others not mentioned not implemented
X    +   / - the last thing found, yanked or put
X=  nd: delete d, <sp>, ^, $, or /
X    =   d - delete line
X    =   <sp> - delete character
X    =   ^ - to beginning of line
X    =   $ - to end of line
X 
X 
X                                 -38-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X    -   w, b, and any others not mentioned not implemented
X    +   / - the last thing found, yanked or put
X-   e: Not implemented
X-   f: Not implemented
X    g: Unused
X=  nh: Move left n characters [BS,^H] {will move over lines, too}
X=  ni: insert (if value n supplied, then that ascii code inserted)
X=  nj: down lines, in column [^J,^N]
X=  nk: Up lines, in column [^K,^P]
X=  nl: right n characters [<space>] {moves over lines, too}
X*  nm: mark cur. line as location n.  Use M to return to location.
X=   n: find next (in same direction as last ? or /)
X=  no: open n following lines
X=   p: put save buffer after cur line
X+   q: Prefix character for "tvx" extended commands
X        !: call operating system
X        b: goto real beginning of the file
X        e: edit repeat buffer
X        j: jump back to last location
X        p: put external file from save buffer
X        r: restore repeat buffer
X        s: print screen
X        w: read in next page of file
X        y: yank external file to save buffer
X        /: cross buffer search
X      n:p: set parameter 'p' to value 'n', parameters are:
X         a: autoindent (1 means on, 0 off for all "switch" pars)
X         c: "cut" mode (means 'dd' saves line in yank buffer, too)
X         e: expand tabs to n spaces (8 default)
X         d: home display line (where cursor homes after verify)
X         f: find case mode (0 is case insensitive, 1 exact match)
X         m: match wildcards (1 use ^A, ^L, etc., 0 no wild cards)
X         o: requests new name for output file
X         s: scroll window, cursor moves s lines before scrolling
X         t: tty mode - 1: tty mode, 0: visual mode
X         u: requests entry of user wild card set
X         v: virtual window size
X         w: autowrap limit.
X=   r: replace next char with next character entered
X=  ns: substitute: delete n characters, enter insert mode
X-   t: Not implemented
X-   u: Not implemented (see U)
X    v: Unused
X*  nw: advance word (see W)
X=  nx: delete n characters
X*  ny: yank text to save buffer - will save n lines into save buffer
X       (Only one save buffer, 1st y clears buffer, rest add until
X        non y command entered. dd works in a similar fashion, but
X        kills as it saves (if cut_mode enabled)).
X=   z: refresh screen (^L,^R)
X-   {: Not implemented
X-   |: Not implemented
X=  n~: Change case of next n characters
X* nDEL: Same as X, delete previous character
X 
X 
X 
X 
X                                 -39-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X                      EMAX - TVX emulating emacs
X 
X     Important differences: No windows, no marked region, no Q
Xregisters, no word delete or case change, ^K interacts differently
Xwith save buffer multiple keyboard macros (called repeat loops), much
Xdifferent file and buffer manipulation. 
X 
X     Partial line ^K's (no argument or 0 argument) will save the
Xdeleted text in the unkill buffer (^CU), but NOT the save/cut buffer.
XIf an argument is supplied, then the killed lines are save in the save
Xbuffer. 
X 
X     TVX'x kill last thing concept is implemented as ^C^K. 
X 
X     Values can be supplied in two ways.  Any of the <esc> commands
Xmay supply a count after the <esc>.  Thus, '<esc>10B' will back over
X10 words.  <esc> may also be used to specify the count for ctrl
Xcommands: '<esc>10^N' goes down 10 lines.  The usual emacs '^U' also
Xworks to supply arguments.  It works in the emacs multiples of 4, but
Xthe Arg: count echoes differently.  When you press ^U, then the
Xmessage 'Arg: 4' will appear on the bottom.  If you press ^U again, it
Xwill change to 'Arg: 16'.  However, if you enter any other numeric
Xvalue, the 'Arg' message disappears, and you get no additional
Xprompting of values. 
X 
X
X <ctrl-A>    Move to start of line.
Xn<ctrl-B>    (Back) Move backward by characters.
Xn<ctrl-C>    (Command) TVX Command: execute commands provided
X             by TVX base.  (These ^C commands have NO relation
X             to ^C commands of large emacs implemetations!)
X         ^A    Append line to save buffer
X         ^B    Move to absolute beginning of file
X         ^E    Edit repeat buffer
X         ^F    Fill n lines to autowrap margin
X         ^G    No op - exit ^C
X         ^H    Half screen down
X         ^J    Jump back to previous location
X         ^K    Delete last thing
X         ^N    Move to beginning of next line
X         ^M    Mark location n
X         ^P    Move to beginning of previous line
X         ^R    Restore edited repeat buffer
X         ^W    Write buffer, read next portion of file
X          ;    Search forward again
X          ~    Change case of next n characters
X          G    Goto line number n
X          H    Half page up
X          I    Insert ascii char n if n supplied,
X                 otherwise enter insert mode
X          L    Print screen on printer (micros only)
X          M    Return to marked location
X          P    Put line into save buffer
X          S    Search forward across file buffers
X          U    Unkill last single line killed
X          Vp   Set variable p (like TVX's : command)
X 
X 
X                                 -40-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X          W    Write save buffer to external file
X          Y    Yank external file into save buffer
Xn<ctrl-D>    (Delete) Delete next character.
X <ctrl-E>    (End) Move to end of line.
Xn<ctrl-F>    (Forward) Move forward by characters.
Xn<ctrl-H>    Backspace - delete n previous characters
Xn<ctrl-K>    (Kill) With no argument, kill from current position
X             to end of line; if at the end, kill the newline.
X             With argument 0, kill from beginning of line to
X             current position. Otherwise, kill argument lines
X             forward (if positive) or backward (if negative).
X <ctrl-L>    Redraw the screen.
Xn<ctrl-N>    (Next) Move to next line.
Xn<ctrl-O>    (Open) Open line above cursor.
Xn<ctrl-P>    (Previous) Move to previous line.
X <ctrl-R>    (Reverse) search backward.
X <ctrl-S>    (Search) search forward. { <Esc>S is a synonym }
X <ctrl-T>    (Transpose) Transpose characters.
X <ctrl-U>    Specify an argument, as described above.
Xn<ctrl-V>    Move forward by n pages.
X
X <ctrl-X><ctrl-C>  Abort edit session with no changes.
X <ctrl-X><ctrl-B>  Short buffer status line
Xn<ctrl-X>E   (Execute) Execute current repeat loop n times.
X
X <ctrl-Y>    (Yank) Yank save buffer to current location.
X <ctrl-Z>    Save current buffer to associated file and exit.
Xn<Del>       Delete the previous n characters. (^H is synonym)
X
X <esc>%      Invoke command file (TVX @ file)
X <esc>!      Call operating system
Xn<esc>#p     Execute repeat loop 'p' 'n' times.
Xn<esc>(      Repeat loop definition.  ')<esc><esc>' ends loop.
X <esc>-,0-9  Auto argument for other <esc> and CTRL commands.
X <esc><      Move to beginning of buffer.
X <esc>>      Move to end of buffer.
X <esc>?      Help and status screens
Xn<esc>B      (Back) Move backward by words.
Xn<esc>F      (Forward) Move forward by words.
Xn<esc>V      Move backward by pages.
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X 
X                                 -41-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
X                            *** INDEX ***
X                         TVX Reference Manual
X 
Xabort - 12
Xappend - 6, 12
Xauto wrap - 19
Xautoindent - 17
X 
Xbackspace - 1, 14, 20, 21
Xbackup file - 4, 6, 13, 20
Xbeginning of file - 6, 9
Xbuffer - 2, 6, 7, 9, 10, 12, 13
Xbuffer beginning - 6
X 
Xchange - 7
Xcommands - 1, 6
Xcursor - 1
Xcursor character - 6
Xcut mode - 18
X 
Xdefault source settings - 30
Xdefine options - 31
Xdelete last thing - 15
Xdelete line front - 15
Xdelete line tail - 15
Xdelete previous character - 14
Xdown - 7, 12
Xdown in column - 7
X 
Xend buffer - 7
Xend session - 14
XError Messages - 23
Xescape - 6, 8, 9, 20
Xexit - 14
Xexternal file - 14
X 
Xfind - 8, 9, 14, 18
Xfind case - 18
X 
Xget - 9
Xget killed line - 9
X 
Xhalf page - 9
Xhome display line - 18
X 
Xinsert - 9, 11
XInsert find pattern - 15
XInstallation - 27
XInstallation - MS-DOS - 33
XInstallation - Unix - 33
Xinvoke command file - 17
X 
Xjump - 10
X 
Xkill characters - 10
Xkill lines - 10
X 
X 
X                                 -42-
X 
X 
X 
X 
XTVX Reference Manual                                           2/25/86
X 
X 
Xleft - 10
Xline beginning - 15
Xline end - 15
Xlog file - 4, 14, 17, 20
X 
Xmemory - 10
Xmode - 6, 7, 9, 11, 15
X 
Xnote - 10, 11
X 
Xopen line - 11
Xoperating system - 11
Xother control sequences - 29
Xoutput file - 18
X 
Xpage - 9, 11
Xparameters - 17
Xprint - 11
X 
XQuick Reference Summary - 35
Xquit - 7
X 
Xrepeat buffer - 12
Xrepeat loop - 7, 16, 18
Xright - 11
X 
Xsave buffer - 6, 9, 12, 14
Xscroll lines - 18
Xsearch - 8
Xskip over words - 16
Xsource code - 27
Xstarting up - 4
Xstatus - 10
Xswitches - 5
X 
Xtab expansion - 18
Xterminate - 12
Xtidy - 12
Xtty mode - 18, 26
XTVX File Usage - 34
X 
Xunkill - 9
Xup - 13
Xup in column - 13
Xuser wild cards - 19
X 
Xverify - 13
Xvirtual window - 19
X 
Xwild card - 8, 18
Xword - 16
Xwrite buffer - 13
X 
XX-Y Cursor Addressing - 29
X 
Xyank external file - 14
X 
X 
X                                 -43-
X 
X 
SHAR_EOF
echo ALL DONE!
exit 0