[comp.sources.misc] v11i009: Stevie 3.69a - 1/6

dmt@pegasus.ATT.COM (Dave Tutelman) (03/11/90)

Posting-number: Volume 11, Issue 9
Submitted-by: dmt@pegasus.ATT.COM (Dave Tutelman)
Archive-name: stevie3.69a/part01

Here's my improvements to Tony Andrews' vi clone Stevie.
It also includes some stuff that I integrated from Larry Shurr.
Tony has said it's OK to post.  It's a branch off 3.69,
which is the latest "official" distribution.  I'm also sending
it to Tony, and he will probably integrate it.

The first three files in the shell archive are:
  readme	Tony's intro, updated to 3.69a
  readme.dmt	Changes (enhancements & bugfixes) in 3.69a
  stevie.mm	Nroff -mm source for the documentation

I've tested it out on MSDOS (using Turbo C) and UNIX System V (using cc).
I've tried to keep the other versions up to date (TOS, OS/2, MINIX, and
MSDOS using Microsoft C), but I didn't have the means to make or test
them, and probably broke them somewhere.  (Even the Turbo C version is
sorta' broken; the makefile gives command lines too long for MSDOS.
Use the integrated environment or response files instead.)

Use and enjoy!
Dave
+---------------------------------------------------------------+
|    Dave Tutelman						|
|    Physical - AT&T Bell Labs  -  Lincroft, NJ			|
|    Logical -  ...att!pegasus!dmt				|
|    Audible -  (201) 576 2194					|
+---------------------------------------------------------------+
: This is a shar archive.  Extract with sh, not csh.
: The rest of this file will extract:
: readme readme.dmt stevie.mm source.doc porting.doc ctags.doc dos_msc.mk dos_tc.mk minix.mk os2.mk tos.mk unix.mk stevie.h term.h
echo extracting - readme
sed 's/^X//' > readme << '!EOR!'
XSTEVIE Source Release - 3.69a
X
XThis is a source release of the STEVIE editor, a public domain clone
Xof the UNIX editor 'vi'. The program was originally developed for the
XAtari ST, but has been ported to UNIX, OS/2, DOS, and Minix-ST as well.
XPorts done by others, but not directly supported by this release, include
XMinix-PC, Amiga, and a Data General system of some sort.
X
XThe good news about stevie is that it is extremely portable. It supports
Xsystems with virtually all combinations of integer size, pointer size,
Xand byte order. The only major issue remaining, for some environments,
Xis that the file is kept in memory. For most environments, this isn't a
Xproblem, but for Minix-PC it is particularly annoying.
X
XSome advantages of Stevie over other versions/clones of 'vi' are:
X   -	Built-in help facility.
X   -	Tag stacking (for users of CTAGS).
X   -	Extensive system-specific features (e.g.- the MSDOS version
X   	supports function keys, cursor keys, colors, 43-line mode;
X   	the stubs are there to add such support to other systems.)
X   -	You have the source code.
X
XThe files included in this release are:
X
XREADME
X	This file.
X
Xstevie.mm
Xstevie.doc
X	Reference manual for STEVIE. Assumes familiarity with vi.
X
Xsource.doc
X	Quick overview of the major data structures used.
X
Xporting.doc
X	Tips for porting STEVIE to other systems.
X
Xos2.mk
Xunix.mk
Xdos_msc.mk
Xdos_tc.mk
Xtos.mk
Xminix.mk
X	Makefiles for OS/2, UNIX, DOS, and the Atari ST (TOS and Minix).
X	(DOS_MSC & DOS_TC are for the two most popular DOS C compilers.)
X
Xos2.c
Xunix.c
Xdos.c
Xtos.c
Xminix.c
Xterm.h
Xenv.h
X	System-dependent code for the same.
X
Xalloc.c ascii.h cmdline.c edit.c enveval.c fileio.c help.c hexchars.c
Xkeymap.h linefunc.c main.c mark.c misccmds.c normal.c ops.c ops.h
Xparam.c param.h ptrfunc.c regexp.c regexp.h regmagic.h regsub.c
Xscreen.c search.c sentence.c stevie.h tagcmd.c term.c undo.c version.c
X
X	C source and header files for STEVIE.
X
Xctags.doc
X	Documentation for the accompanying program 'ctags'.
X
Xctags.c
X	Source code for the program 'ctags'.
X
Xsetenv.c
X	Source code for an improved SETENV for MSDOS.
X
X
XTo compile STEVIE for one of the provided systems:
X
X	1. Edit the file 'env.h' to set the system defines as needed.
X
X	2. Check the makefile for your system, and modify as needed.
X
X	3. Compile.
X
XGood Luck...
X
XDave Tutelman - Rel 3.69a
X2/27/90
X
XTony Andrews - Author
X8/6/89
!EOR!
echo extracting - readme.dmt
sed 's/^X//' > readme.dmt << '!EOR!'
X                       New in STEVIE 3.69a
X		Added by Dave Tutelman  -  Feb 1990
X
X
XEnhancements
X^^^^^^^^^^^^
X
XTAG STACKING:
X	Calls to ':ta' are now "stacked".  That is, the place from which
X	the call was made is remembered and pushed onto a tag stack.
X	A new command ':untag' takes you back to that place (and pops
X	the tag stack).
X
X	Tag stacking is enabled by the 'tg' parameter;  use ":set tg".
X	When it is enabled, the Ctrl-^ key doesn't automatically edit
X	the alternate file; if the tag stack isn't empty, Ctrl-^ causes
X	a ':untag'.
X
XIMPROVED HELP:
X	Rather than just stepping through the help screens sequentially,
X	you can now move "up" and "down" through the pages, using
X	keystrokes with the obvious analogies to 'vi' navigation.
X	You can also go directly to any screen by entering the number
X	of that screen.  (The 0th screen is a table of contents to 
X	the help screens.)
X
X	Also, a system-dependent help screen for DOS and OS/2 special
X	keys (cursor and function keys) has been added.
X
X	Finally, the help screens are state-dependent, in the sense
X	that they vary according to the settings of the parameters.
X	(E.g.- if 'tildeop' is enabled, the help screens show tilde
X	as an operator; if not, they show tilde as a character
X	replacement.)  Also, your last help screen is remembered, and
X	that is where you will return if you re-enter help.
X
XNEW SEARCHES:
X	Stevie 3.69 is missing some of the standard searches:
X	   }	next paragraph
X	   {	previous paragraph
X	   )	next sentence
X	   (	previous sentence
X	These now work.
X
XMORE UNIX-LIKE HANDLING OF FILES:
X	Environment variables are evaluated when dealing with filenames.
X	(Thus you can now say things like   :e $HOME\autoexec.bat).
X
X	The file mode is preserved.  (Editing with the old STEVIE
X	changed the mode of a file to the default mode.)  This could
X	be viewed as a bugfix rather than an enhancement.
X
XCOLOR AND 43-LINE MODE FOR MSDOS:
X	Thanks to Larry Shurr for a BIOS version for MSDOS.  I bought
X	back his color and 43-line additions into the NANSI.SYS version.
X	I also added stubs for color and lines-on-screen changes for
X	the other environments.  Larry has also supplied source for
X	a SETENV command for MSDOS that can handle embedded '=' signs
X	in the set string.
X
XDOS & OS/2 FUNCTION KEYS:
X	These have been modified to something I find more logical.
X	(The original author may disagree; it's largely a matter
X	of taste.  If you like still another choice, then the
X	changes you need to make are in files dos.c and help.c;
X	i.e., don't forget to update help screen 7.)
X
X
XBugs Fixed
X^^^^^^^^^^
X
X   -	Replacement commands 'r' and 'R' didn't handle newlines right;
X   	they inserted them instead of wiping out the current character.
X   	That is now fixed.
X
X   -	Esc in a command line was considered part of the command.  Now
X   	it [properly] aborts the command line.
X
X   -	In some implementations, the program would hang if asked to
X   	delete to a nonexistent mark.  That is now fixed.
X
X   -	If a delete ended at the beginning of a line, it would delete
X   	the leading character whether it should or not.  That is now
X   	fixed.  The same problem had to be fixed for yank.
X
X   -	The #define for the Ctrl-^ key was incorrectly called K_CGRAVE.
X   	(If you're going to use French terminology, PLEASE learn some
X   	French. This is an "accent circumflex", not an "accent grave".)
X   	This may not seem like a bug, but I wasted over an hour trying 
X	to find where Ctrl-^ had its effect.  Anyway, it's now called
X	K_CCIRCM.
X
X   -	The function search in CTAGS has been improved.  Before, it
X   	missed function definitions if there was whitespace between
X   	the function name and the open '('; this has been fixed.
X
!EOR!
echo extracting - stevie.mm
sed 's/^X//' > stevie.mm << '!EOR!'
X.\" $Header: /nw/tony/src/stevie/src/RCS/stevie.mm,v 3.69 89/08/13 11:44:04 tony Exp $
X.\"
X.\" Documentation for STEVIE. Process with nroff using the mm macros.
X.\"
X.nr Hu 1
X.SA 1
X.TL
XSTEVIE - An Aspiring VI Clone
X.sp
XUser Reference - 3.69a
X.AU "Tony Andrews"
X.AF ""
X.MT 4
X.PH "'STEVIE''User Reference'"
X.PF "''- \\\\nP -''"
X.H 1 "Overview"
XSTEVIE is an editor designed to mimic the interface of the UNIX
Xeditor 'vi'. The name (ST Editor for VI Enthusiasts) comes from the fact that
Xthe editor was first written for the Atari ST. The current version also supports
XUNIX, Minix (ST), MS-DOS, and OS/2, but I've left
Xthe name intact for now.
X.P
XThis program is the result of many late nights of hacking over the last
Xcouple of years.
XThe first version was written by Tim Thompson and posted
Xto USENET. From there, I reworked the data structures completely, added
XLOTS of features, and generally improved the overall performance in the
Xprocess.
X.P
XI've labelled STEVIE an 'aspiring' vi clone as a warning to those who
Xmay expect too much. On the whole, the editor is pretty complete.
XNearly all of the visual mode commands are supported.
XAnd several of the more important 'ex' commands are supported as well.
XI've tried hard to
Xcapture the feel of vi by getting the little things right.
XMaking lines
Xwrap correctly, supporting true operators, and even getting the cursor to
Xland on the right place for tabs are all a pain, but really help make
Xthe editor feel right.
XI've tried to resist the temptation to deviate from the behavior
Xof vi, even where I disagree with the original design.
X.P
XThe biggest problem remaining has to do with the fact that the edit buffer
Xis maintained entirely in memory, limiting the size of files that can
Xbe edited in some environments.
XOther missing features include named buffers and macros.
XPerformance is generally reasonable, although the screen update code
Xcould be more efficient.
XThis is generally only visible on fairly slow systems.
X.P
XSTEVIE may be freely distributed. The source isn't copyrighted or
Xrestricted in any way. If you pass the program along, please include all
Xthe documentation and, if practical, the source as well. I'm not fanatical
Xabout this, but I tried to make STEVIE fairly portable and I'd like to
Xsee as many people have access to the source as possible.
X.P
XThe remainder of this document describes the operation of the editor.
XThis is intended as a reference for users already familiar with the real
Xvi editor.
X.H 1 "Starting the Editor"
XThe following command line forms are supported:
X.VL 20
X.LI "stevie [file ...]"
XEdit the specified file(s)
X.LI "stevie -t tag"
XStart at the location of the given tag
X.LI "stevie + file"
XEdit file starting at end
X.LI "stevie +n file"
XEdit file starting a line number 'n'
X.LI "stevie +/pat file"
XEdit file starting at pattern 'pat'
X.LE
X.P
XIf multiple files are given on the command line (using the first form),
Xthe ":n" command goes to the next file, ":N" goes backward in the list,
Xand ":rew" can be used to rewind back to the start of the file list.
X.H 1 "Set Command Options"
XThe ":set" command works as usual to set parameters. Each parameter has
Xa long and an abbreviated name, either of which may be used. Boolean
Xparameters are set as in:
X.sp
X.ti +5
Xset showmatch
X.sp
Xor cleared by:
X.sp
X.ti +5
Xset noshowmatch
X.sp
XNumeric parameters are set as in:
X.sp
X.ti +5
Xset scroll=5
X.sp
XSeveral parameters may be set with a single command:
X.sp
X.ti +5
Xset novb sm report=1
X.P
XTo see the status of all parameters use ":set all". Typing ":set" with
Xno arguments will show only those parameters that have been changed.
XThe supported parameters, their names, abbreviations, defaults,
Xand descriptions are shown below:
X.VL 12
X.LI autoindent
XShort: ai, Default: noai, Type: Boolean
X.br
XWhen in insert mode, start new lines at the same column as the prior
Xline. Unlike vi, you can backspace over the indentation.
X.LI backup
XShort: bk, Default: nobk, Type: Boolean
X.br
XLeave a backup on file writes.
X(During file writes, a backup is always kept for
Xsafety anyway, until the write is completed.
XAt that point, the 'backup' parameter
Xdetermines whether the backup file is deleted.)
X.LI color
XShort: co, Default: system-dependent, Type: Numeric
X.br
XChange the screen color (video attributes).
XThere is a system-dependent mapping between numbers and colors.
X(For instance, in MSDOS we use the BIOS-type attributes for
XCGA or monochrome screens in alphanumeric mode.)
X.LI errorbells
XShort: eb, Default: noeb, Type: Boolean
X.br
XRing bell when error messages are shown.
X.LI ignorecase
XShort: ic, Default: noic, Type: Boolean
X.br
XIgnore case in string searches.
X.LI lines
XShort: lines, Default: lines=25, Type: Numeric
X.br
XNumber of physical lines on the screen. The default value
Xand possible settings depend on the host machine.
XThe default value is 25 on most systems.
X.LI list
XShort: list, Default: nolist, Type: Boolean
X.br
XShow tabs and newlines graphically.
X.LI modelines
XShort: ml, Default: noml, Type: Boolean
X.br
XEnable processing of modelines in files.
X.LI number
XShort: nu, Default: nonu, Type: Boolean
X.br
XDisplay lines on the screen with their line numbers.
X.LI report
XShort: report, Default: report=5, Type: Numeric
X.br
XMinimum number of lines to report operations on.
X.LI return
XShort: cr, Default: cr, Type: Boolean
X.br
XEnd lines with cr-lf when writing files.
X.LI scroll
XShort: scroll, Default: scroll=12, Type: Numeric
X.br
XNumber of lines to scroll for ^D & ^U.
X.LI showmatch
XShort: sm, Default: nosm, Type: Boolean
X.br
XWhen a ), }, or ] is typed, show the matching (, {, or [ if
Xit's on the current screen by moving the cursor there briefly.
X.LI showmode
XShort: mo, Default: nomo, Type: Boolean
X.br
XShow on status line when in insert mode.
X.LI tabstop
XShort: ts, Default: ts=8, Type: Numeric
X.br
XNumber of spaces in a tab.
X.LI tagstack
XShort: tg, Default: notg, Type: Boolean
X.br
XIf set, the tag command :ta is "stacked";
Xthat is, the place from which it was called is pushed onto a stack.
XA new command ":untag" goes back to that place, and pops the tag stack.
X.LI terse
XShort: terse, Default: noterse, Type: Boolean
X.br
XThis option is currently ignored.
XIt is provided only for compatibility with vi.
X.LI tildeop
XShort: to, Default: noto, Type: Boolean
X.br
XIf set, tilde is an operator. Otherwise, tilde acts as normal.
X.LI wrapscan
XShort: ws, Default: ws, Type: Boolean
X.br
XString searches wrap around the ends of the file.
X.LI vbell
XShort: vb, Default: vb, Type: Boolean
X.br
XUse a visual bell, if possible. (novb for audible bell)
X.LE
X.P
XThe EXINIT environment variable can be used to modify the default values
Xon startup as in:
X.sp
X.ti +5
Xsetenv EXINIT="set sm ts=4"
X.P
XIn environments (e.g. OS/2 or TOS) where lines are normally terminated by
XCR-LF, the 'return' parameter allows files to be written with only a LF
Xterminator (if the parameter is cleared).
XThis parameter is ignored on UNIX systems.
X.P
XThe 'lines' parameter tells the editor how many lines there are on the screen.
XThis is useful on systems like the ST (or OS/2 machines with an EGA adapter)
Xwhere various screen resolutions may be
Xused. By using the 'lines' parameter, different screen sizes can be easily
Xhandled.
X.H 1 "Colon Commands"
XSeveral of the normal 'vi' colon commands are supported by STEVIE.
XSome commands may be preceded by a
Xline range specification.
XFor commands that accept a range of lines,
Xthe following address forms are supported:
X.DS 1
Xaddr
Xaddr + number
Xaddr - number
X.DE
Xwhere 'addr' may be one of the following:
X.DS 1
Xa line number
Xa mark (as in 'a or 'b)
X\'.' (the current line)
X\'$' (the last line)
X.DE
X.P
XAn address range of "%" is accepted as an abbreviation of "1,$".
X.H 2 "Mode Lines"
XMode lines are a little-known, but often useful, feature of vi.
XTo use this feature, special strings are placed in the first or
Xlast five lines in a file.
XWhen the file is edited, these strings are detected and processed
Xas though typed as a colon command.
XOne instance where this can be useful is to set the "tabstop"
Xparameter on a per-file basis.
XThe following are examples of mode lines:
X.DS 1
Xvi:set ts=4 noai:
Xex:45:
X.DE
X.P
XMode lines are characterized by the string "vi" or "ex" followed
Xby a command surrounded by colons. Other text may appear on the
Xline, and multiple mode lines may be present. No guarantee is
Xmade regarding the order in which multiple mode lines will be
Xprocessed.
X.P
XThe processing of mode lines is enabled by setting the "ml"
Xparameter. This should be done in the "EXINIT" environment
Xvariable, so that mode line processing is enabled as soon
Xas the editor begins.
XBy default, mode lines are disabled for security reasons.
X.H 2 "The Global Command"
XA limited form of the global command is supported, accepting the
Xfollowing command form:
X.DS 1
Xg/pattern/X
X.DE
Xwhere X may be either 'd' or 'p' to delete or print lines that match
Xthe given pattern.
XIf a line range is given, only those lines are checked for a match
Xwith the pattern.
XIf no range is given, all lines are checked.
X.P
XIf the trailing command character is omitted, 'p' is assumed.
XIn this case, the trailing slash is also optional.
XThe current version of the editor does not support the undo operation
Xfollowing the deletion of lines with the global command.
X.H 2 "The Substitute Command"
XThe substitute command provides a powerful mechanism for making more
Xcomplex substitutions than can be done directly from visual mode.
XThe general form of the command is:
X.DS 1
Xs/pattern/replacement/g
X.DE
XEach line in the given range (or the current line, if no range was
Xgiven) is scanned for the given regular expression.
XWhen found, the string that matched the pattern is replaced with
Xthe given replacement string.
XIf the replacement string is null, each matching pattern string is
Xdeleted.
X.P
XThe trailing 'g' is optional and, if present, indicates that multiple
Xoccurrences of 'pattern' on a line should all be replaced.
X.P
XSome special sequences are recognized in the replacement string. The
Xampersand character is replaced by the entire pattern that was matched.
XFor example, the following command could be used to put all occurrences
Xof 'foo' or 'bar' within double quotes:
X.DS 1
X1,$s/foo|bar/"&"/g
X.DE
X.P
XThe special sequence "\\n" where 'n' is a digit from 1 to 9, is replaced
Xby the string the matched the corresponding parenthesized expression in
Xthe pattern. The following command could be used to swap the first two
Xparameters in calls to the C function "foo":
X.DS 1
X1,$s/foo\\\\(([^,]*),([^,]*),/foo(\\\\2,\\\\1,/g
X.DE
X.P
XLike the global command, substitutions can't be undone with this
Xversion of the editor.
X.H 2 "File Manipulation Commands"
XThe following table shows the supported file manipulation commands as
Xwell as some other 'ex' commands that aren't described elsewhere:
X.DS CB
X:w		write the current file
X:wq		write and quit
X:x		write (if necessary) and quit
XZZ		same as ":x"
X
X:e file		edit the named file
X:e!		re-edit the current file, discarding changes
X:e #		edit the alternate file
X
X:w file		write the buffer to the named file
X:x,yw file	write lines x through y to the named file
X:r file		read the named file into the buffer
X
X:n		edit the next file
X:N		edit the previous file
X:rew		rewind the file list
X
X:f		show the current file name
X:f name		change the current file name
X:x=		show the line number of address 'x'
X
X:ta tag		go to the named tag
X^]		like ":ta" using the current word as the tag
X:untag		go back to place from which ":ta" was called
X
X:help		display a command summary
X:ve		show the version number
X
X:sh		run an interactive shell
X:!cmd		run a command
X.DE
X.P
XThe commands above work pretty much like they do in 'vi'. Most of the
Xcommands support a '!' suffix (if appropriate) to discard any pending
Xchanges.
X.H 1 Help Facility
XThe ":help" command can also be invoked with the <HELP> key on the Atari
XST and the F1 key on MSDOS and OS/2 PCs.
XThis actually displays a pretty complete summary of the real vi with
Xunsupported features indicated appropriately.
XCertain features controlled by "set" parameters will have varied displays
Xon the Help screens, to correspond to the current
Xsetting of their parameters.
X.P
XThe help screens (there are multiple screens) can be traversed
Xusing "reasonable" keystrokes.  For instance, any key that would take you
X"down" in the vi editor, will take you to the next help screen in
Xthe help facility.  Similarly, "up" commands will take you to
Xthe previous screen. 
XThe screens are numbered, and any numeric key will take you to
Xthe corresponding screen.
XThe first screen (screen 0) is a table of contents for the
Xhelp screens.
X.H 1 "String Searches"
XString searches are supported, as in vi, accepting the usual regular
Xexpression syntax. This was done using a modified form of
XHenry Spencer's regular expression
Xlibrary. I added code outside the library to support
Xthe '\\<' and '\\>' extensions.
XThe parameter "ignorecase" can be set to ignore case in all string searches.
X.H 1 "Operators"
XThe vi operators (d, c, y, !, <, and >) work as true operators.
XThe tilde command may also be used as an operator if the parameter "tildeop"
Xhas been set. By default, this parameter is not set.
X.H 1 "Tags"
XTags are implemented and a fairly simple version of 'ctags' is supplied
Xwith the editor. The current version of ctags will find functions and
Xmacros following a specific (but common) form.  See 'ctags.doc' for a
Xcomplete discussion.
X.P
XA non-standard but useful variant of tags is the "stacking" of calls to
Xthe ':ta' command.
XWhen tag-stacking is enabled (with ':set tg'), stevie remembers
X(and stacks) the position from which any tag call is made.
XIn this mode, a new ':untag' command returns to the remembered position
Xand pops the stack.
XAlso while in the tagstack mode, the Ctrl-^ keystroke has a somewhat
Xdifferent effect.  Before it switches to edit the alternate file
X(its normal function), it checks to see if the tag stack is empty,
Xand does an ':untag' if not empty.
X.H 1 "System-Specific Comments"
XThe following sections provide additional relevant information for the
Xsystems to which STEVIE has been ported.
X(WARNING: If you compile Stevie for, or port Stevie to,
Xyour favorite environment, don't forget to edit ENV.H
Xto correspond to the target environment.)
X.H 2 "Atari ST"
X.H 3 "TOS"
XThe editor has been tested in all three resolutions, although low and
Xhigh res. are less tested than medium. The 50-line high res. mode can
Xbe used by setting the 'lines' parameter to 50. Alternatively, the
Xenvironment variable 'LINES' can be set. The editor doesn't actively
Xset the number of lines on the screen. It just operates using the number
Xof lines it was told.
X.P
XThe arrow keys, as well as the <INSERT>, <HELP>, and <UNDO> keys are
Xall mapped appropriately.
X.H 3 "Minix"
XThe editor is pretty much the same under Minix, but many of the
Xkeyboard mappings aren't yet supported.
X.H 2 "UNIX"
XThe editor has been ported to UNIX System V release 3 as well as 4.2 BSD.
XThis was done
Xmainly to get some profiling data so I haven't put much effort into
Xdoing the UNIX version right.
XWhile the termcap routines are supported, the editor is still fairly
Xpicky about the capabilities it wants and makes little effort to
Xdo clever things with less intelligent terminals.
X.H 2 "OS/2"
XThis port was done because the editor that comes with the OS/2 developer's
Xkit really stinks. Make sure 'ansi' mode is on (using the 'ansi' command).
XThe OS/2 console driver doesn't support insert/delete line, so STEVIE
Xbypasses the driver and makes the appropriate system calls directly.
XThis is all done in the system-specific part of the editor so the kludge
Xis at least localized.
X.P
XThe arrow keys, page up/down and home/end all do what
Xyou'd expect. The function keys are hard-coded to some useful macros until
XI can get true support for macros into the editor. The current mappings
Xare:
X.DS 1
XF1    Help
XF2    Next file (:n)             \h'|3.3i'Shift-F2  discard changes (:n!)
XF3    Previous file (:N)         \h'|3.3i'Shift-F3  discard changes (:N!)
XF4    Alternate file (:e #)      \h'|3.3i'Shift-F4  discard changes (:e! #)
XF5    Rewind file list (:rew)    \h'|3.3i'Shift-F5  discard changes (:rew!)
XF6    Next function (]])         \h'|3.3i'Shift-F6  Prev. function ([[)
XF8    Global subst. (:1,$s/)
XF9    Convert cdecl to English   \h'|3.3i'Shift-F9  Convert English to cdecl
XF10   Save & quit (:x)           \h'|3.3i'Shift-F10 discard changes (:q!)
X.DE
X.P
XFunction keys F9 and Shift-F9 assume the presence of the cdecl program.
X.H 2 "MSDOS"
XSTEVIE has been ported to MSDOS 3.3 using
X(1) the Microsoft C compiler, version 5.1, and
X(2) the Borland Turbo C compiler, version 2.0.
X.P
XThe keyboard mappings are the same as for OS/2.
XThe only problem with the PC version is that the inefficiency of
Xthe screen update code becomes painfully apparent on slower machines.
X(In Rev 3.69a, there are a couple of ways in which screen I/O
Xis significantly speeded up.)
X.P
XThere are two DOS versions:
Xone that uses an extended console driver,
Xand another that uses the BIOS directly.
XThe extended-console-driver version works well with "nansi.sys",
Xwhich is widely available shareware.
XIt does not work well with the "ANSI.SYS" driver included as part of
XMSDOS (at least through the 3.30 version).
XIn order to be independent of the console driver,
Xyou may compile with BIOS #defined;
Xthis uses the BIOS as the exclusive screen I/O mechanism.
X(Note that it is somewhat slower than nansi.sys.)
X.P
XThe color settings are the video attributes for the alphanumeric modes
Xof the CGA and monochrome displays.
XWhile these make most sense in binary or hex, they must be entered
Xin decimal.  The reference table below gives a few common values:
X.DS 1
X07    White on black          Initial default
X23    White on blue
X30    Bright yellow on blue   My favorite
X.DE
X.H 1 "Missing Features"
X.AL
X.LI
XThe ability to edit files larger than the available memory.
XThis isn't a problem on the machines I use, but it hits the
XMinix-PC people pretty hard.
X.LI
XMacros with support for function keys.
X.LI
XMore "set" options.
X.LI
XMany others...
X.LE
X.H 1 "Known Bugs and Problems"
X.AL
X.LI
XThe yank buffer uses statically allocated memory, so large yanks
Xwill fail. If a delete spans an area larger than the yank buffer,
Xthe program asks
Xfor confirmation before proceeding. That way, if you were moving text,
Xyou don't get screwed by the limited yank buffer. You just have to move
Xsmaller chunks at a time. All the internal buffers (yank, redo, etc.)
Xneed to be reworked to allocate memory dynamically. The 'undo' buffer
Xis now dynamically allocated, so any change can be undone.
X.LI
XIf you stay in insert mode for a long time, the insert buffer can overflow.
XThe editor will print a message and dump you back into command mode.
X.LI
XThe current version of the substitute and global commands
X(i.e. ":s/foo/bar" or ":g/foo/d") can't
Xbe undone.
XThis is due to the current design of the undo code.
XTo undo these
Xcommands would generally involve unreasonable amounts of memory.
X.LI
XSeveral other less bothersome glitches...
X.LE
X.SK
X.H 1 "Conclusion"
XThe editor has reached a pretty stable state, and performs well on
Xthe systems I use it on, so I'm pretty much in maintenance mode now.
XThere's still plenty to be done; the screen update code is still pretty
Xinefficient and the yank/put code is still primitive.
XI'm still interested in bug reports, and I do still add a new feature
Xfrom time to time, but the rate of change is way down now.
X.P
XI'd like to thank Tim Thompson for writing the original version of the
Xeditor. His program was well structured and quite readable. Thanks for
Xgiving me a good base to work with.
XThanks also to many users of STEVIE who have sent in their changes.
XMany of the changes I've received aren't portable to all the systems
XI support, but I'm working to get portable implementations integrated
Xinto the editor where possible.
X.P
XIf you're reading this file, but didn't get the source code for STEVIE,
Xit can be had by sending a disk with return postage to the address given
Xbelow. I can write disks for the Atari ST (SS or DS) or MSDOS (360K or
X1.2M). Please be sure to include the return postage. I don't intend to
Xmake money from this program, but I don't want to lose any either.
X.DS 1
XTony Andrews		UUCP: onecom!wldrdg!tony
X5902E Gunbarrel Ave.
XBoulder, CO 80301
X.DE
X.DS 1
X3.69a Additions from
XDave Tutelman           UUCP: pegasus.att.com!dmt
XLarry Shurr (The BIOS implementation)
X.DE
X.SK
X.HU "Character Function Summary"
XThe following list describes the meaning of each character that's used
Xby the editor. In some cases characters have meaning in both command and
Xinsert mode; these are all described.
X.SP 2
X.VL 8
X.LI ^@
XThe null character. Not used in any mode. This character may not
Xbe present in the file, as is the case with vi.
X.LI ^B
XBackward one screen.
X.LI ^D
XScroll the window down one half screen.
X.LI ^E
XScroll the screen up one line.
X.LI ^F
XForward one screen.
X.LI ^G
XSame as ":f" command. Displays file information.
X.LI ^H
X(Backspace) Moves cursor left one space in command mode.
XIn insert mode, erases the last character typed.
X.LI ^J
XMove the cursor down one line.
X.LI ^L
XClear and redraw the screen.
X.LI ^M
X(Carriage return) Move to the first non-white character
Xin the next line. In insert mode, a carriage return opens a new
Xline for input.
X.LI ^N
XMove the cursor down a line.
X.LI ^P
XMove the cursor up a line.
X.LI ^U
XScroll the window up one half screen.
X.LI ^Y
XScroll the screen down one line.
X.LI ^[
XEscape cancels a pending command in command mode, and is used to
Xterminate insert mode.
X.LI ^]
XMoves to the tag whose name is given by the word in which the cursor
Xresides.
X.LI ^`
XSame as ":e #" if supported (system-dependent).
X.LI SPACE
XMove the cursor right on column.
X.LI !
XThe filter operator always operates on a range of lines, passing the
Xlines as input to a program, and replacing them with the output of the
Xprogram. The shorthand command "!!" can be used to filter a number of
Xlines (specified by a preceding count). The command "!" is replaced
Xby the last command used, so "!!!<RETURN>" runs the given number of
Xlines through the last specified command.
X.LI $
XMove to the end of the current line.
X.LI %
XIf the cursor rests on a paren '()', brace '{}', or bracket '[]',
Xmove to the matching one.
X.LI \'
XUsed to move the cursor to a previously marked position, as
Xin 'a or 'b. The cursor moves to the start of the marked line. The
Xspecial mark '' refers to the "previous context".
X.LI +
XSame as carriage return, in command mode.
X.LI ,
XReverse of the last t, T, f, or F command.
X.LI -
XMove to the first non-white character in the previous line.
X.LI .
XRepeat the last edit command.
X.LI /
XStart of a forward string search command. String searches may be
Xoptionally terminated with a closing slash. To search for a slash
Xuse '\\/' in the search string.
X.LI 0
XMove to the start of the current line. Also used within counts.
X.LI 1-9
XUsed to add 'count' prefixes to commands.
X.LI :
XPrefix character for "ex" commands.
X.LI ;
XRepeat last t, T, f, or F command.
X.LI <
XThe 'left shift' operator.
X.LI >
XThe 'right shift' operator.
X.LI ?
XSame as '/', but search backward.
X.LI A
XAppend at the end of the current line.
X.LI B
XBackward one blank-delimited word.
X.LI C
XChange the rest of the current line.
X.LI D
XDelete the rest of the current line.
X.LI E
XEnd of the end of a blank-delimited word.
X.LI F
XFind a character backward on the current line.
X.LI G
XGo to the given line number (end of file, by default).
X.LI H
XMove to the first non-white char. on the top screen line.
X.LI I
XInsert before the first non-white char. on the current line.
X.LI J
XJoin two lines.
X.LI L
XMove to the first non-white char. on the bottom screen line.
X.LI M
XMove to the first non-white char. on the middle screen line.
X.LI N
XReverse the last string search.
X.LI O
XOpen a new line above the current line, and start inserting.
X.LI P
XPut the yank/delete buffer before the current cursor position.
X.LI R
XReplace characters until an "escape" character is received.
XSimilar to insert mode, but replaces instead of inserting.
XTyping a newline in replace mode is the same as in insert mode,
Xbut replacing continues on the new line.
X.LI T
XReverse search 'upto' the given character.
X.LI U
XRestore the current line to its state before you started changing it.
X.LI W
XMove forward one blank-delimited word.
X.LI X
XDelete one character before the cursor.
X.LI Y
XYank the current line. Same as 'yy'.
X.LI ZZ
XExit from the editor, saving changes if necessary.
X.LI [[
XMove backward one C function.
X.LI ]]
XMove forward one C function.
X.LI ^
XMove to the first non-white on the current line.
X.LI `
XMove to the given mark, as with '. The distinction between the two
Xcommands is important when used with operators. I support the
Xdifference correctly. If you don't know what I'm talking about,
Xdon't worry, it won't matter to you.
X.LI a
XAppend text after the cursor.
X.LI b
XBack one word.
X.LI c
XThe change operator.
X.LI d
XThe delete operator.
X.LI e
XMove to the end of a word.
X.LI f
XFind a character on the current line.
X.LI h
XMove left one column.
X.LI i
XInsert text before the cursor.
X.LI j
XMove down one line.
X.LI k
XMove up one line.
X.LI l
XMove right one column.
X.LI m
XSet a mark at the current position (e.g. ma or mb).
X.LI n
XRepeat the last string search.
X.LI o
XOpen a new line and start inserting text.
X.LI p
XPut the yank/delete buffer after the cursor.
X.LI r
XReplace a character.
X.LI s
XReplace characters.
X.LI t
XMove forward 'upto' the given character on the current line.
X.LI u
XUndo the last edit.
X.LI w
XMove forward one word.
X.LI x
XDelete the character under the cursor.
X.LI y
XThe yank operator.
X.LI z
XRedraw the screen with the current line at the top (zRETURN),
Xthe middle (z.), or the bottom (z-).
X.LI |
XMove to the column given by the preceding count.
X.LI ~
XInvert the case of the current character (if alpha) and move to the right.
XIf the parameter "tildeop" is set, this command functions as an operator.
X.LE
X.de TX
X.ce
XSTEVIE - User Guide
X.sp
X..
X.TC
!EOR!
echo extracting - source.doc
sed 's/^X//' > source.doc << '!EOR!'
X
X		 Release Notes for STEVIE - Version 3.68
X
X			      Source Notes
X
X			      Tony Andrews
X
X			 	  8/6/89
X
X
XOverview
X--------
X
X	This file provides a brief description of the source code for
XStevie. The data structures are described later as well. For information
Xspecific to porting the editor, see the file 'porting.doc'. This document
Xis more relevant to people who want to hack on the editor apart from doing
Xa simple port.
X
X	Most of this document was written some time ago so a lot of the
Xdiscussion centers on problems related to the Atari ST environment and
Xcompilers. Most of this can be ignored for other systems.
X
X
XCruft
X-----
X
X	Older versions of the editor used Henry Spencer's regular
Xexpression library directly. The current version incorporates a modified
Xversion of that same library.
X
X
XData Structures
X---------------
X
X	A brief discussion of the evolution of the data structures will
Xdo much to clarify the code, and explain some of the strangeness you may
Xsee.
X
X	In the original version, the file was maintained in memory as a
Xsimple contiguous buffer. References to positions in the file were simply
Xcharacter pointers. Due to the obvious performance problems inherent in
Xthis approach, I made the following changes.
X
X	The file is now represented by a doubly linked list of 'line'
Xstructures defined as follows:
X
Xstruct	line {
X	struct	line	*prev, *next;	/* previous and next lines */
X	char	*s;			/* text for this line */
X	int	size;			/* actual size of space at 's' */
X	unsigned long	num;		/* line "number" */
X};
X
XThe members of the line structure are:
X
Xprev	- pointer to the structure for the prior line, or NULL for the
X	  first line of the file
X
Xnext	- like 'prev' but points to the next line
X
Xs	- points to the contents of the line (null terminated)
X
Xsize	- contains the size of the chunk of space pointed to by s. This
X	  is used so we know when we can add text to a line without getting
X	  more space. When we DO need more space, we always get a little
X	  extra so we don't make so many calls to malloc.
X
Xnum	- This is a pseudo line number that makes it easy to compare
X	  positions within the file. Otherwise, we'd have to traverse
X	  all the links to tell which line came first.
X
X
X	Since character pointers served to mark file positions in the
Xoriginal, a similar data object was needed for the new data structures.
XThis purpose is served by the 'lptr' structure which is defined as:
X
Xstruct	lptr {
X	struct	line	*linep;		/* line we're referencing */
X	int	index;			/* position within that line */
X};
X
XThe member 'linep' points to the 'line' structure for the line containing
Xthe location of interest. The integer 'index' is the offset into the line
Xdata (member 's') of the character to be referenced.
X
XThe following typedef's are more commonly used:
X
Xtypedef	struct line	LINE;
Xtypedef	struct lptr	LPTR;
X
XMany operations that were trivial with character pointers had to be
Ximplemented by functions to manipulate LPTR's. Most of these are in the
Xfile 'ptrfunc.c'. There you'll find functions to increment, decrement,
Xand compare LPTR's.
!EOR!
echo extracting - porting.doc
sed 's/^X//' > porting.doc << '!EOR!'
X
X		 Release Notes for STEVIE - Version 3.68
X
X		   Atari ST Editor for VI Enthusiasts
X
X			        Porting
X
X
X			      Tony Andrews
X
X			 	 8/6/88
X
X
X	Porting the editor is a relatively simple task. Most of the
Xcode is pretty machine-independent. For each environment, there is
Xa file of routines that perform various low-level operations that
Xtend to vary a lot from one machine to another. Another file contains
Xthe escape sequences to be used for each machine.
X
X	The machine-dependent files currently used are:
X
Xtos.c:	  Atari ST running TOS
Xunix.c:	  UNIX System V or BSD
Xos2.c:	  Microsoft OS/2
Xdos.c:	  MS DOS 3.3
Xminix.c:  Minix on the Atari ST
X
X
X	Each of these files are around 250 lines long and deal with
Xlow-level issues like character I/O to the terminal, terminal
Xinitialization, signal handling (if supported), cursor addressing, and
Xso on. There are different tradeoffs to be made depending on the
Xenvironment. For example, the UNIX and Minix versions buffer terminal
Xoutput because of the relatively high overhead of system calls. A quick
Xlook at the files will make it clear what needs to be done in a new
Xenvironment.
X
X	The file "env.h" contains macro definitions to customize the
Xeditor for your particular environment. The macros there select the
Xmachine/os, enable various optional features, etc.
X
X	One of the options in env.h is whether to use the termcap
Xroutines or hard-wired escape sequences. The hard-wired sequences,
Xif used, are defined in term.h. The file term.c contains code to access
Xthe termcap database, if enabled. Termcap is only supported by some of
Xthe system-dependent files (unix.c and minix.c) but can be added easily
Xto others, if needed.
X
X
X	The basic process for doing a new port is:
X
X	1. Come up with a macro name to use when ifdef'ing your system-
X	   specific changes. Add a line to 'env.h' to define the macro
X	   name you've chosen.
X
X	2. Look at the system-dependent files and copy the one that comes
X	   closest to working on your system. Then modify your new file
X	   as needed.
X
X	3. Look at term.h and edit the file appropriately adding a new
X	   set of escape sequence definitions for your system.
X
X	4. Compile and debug the editor.
X
X
X	In most cases it should really be that simple. Other ports have
Xbeen done for which I don't have the code, including the Amiga, and a
XData General machine of some kind (in Australia).
!EOR!
echo extracting - ctags.doc
sed 's/^X//' > ctags.doc << '!EOR!'
X
Xctags - first cut at a UNIX ctags re-implementation
X
X
XThis is a public domain rewrite of the standard UNIX ctags command.
XIt is a simplified version written primarily for use with the 'stevie'
Xeditor. The command line syntax is:
X
X	ctags [file ...]
X
XCtags scans the all files given on the command line. If no files are
Xgiven, the standard input is scanned for a list of file names.
X
XFunction declarations and macros are supported. However, only simple
Xforms of each are recognized. Functions must be of the following form:
X
Xtype
Xfname(...)
X
Xwhere "fname" is the name of the function and must come at the beginning
Xof a line. This is the form I always use, so the limitation doesn't
Xbother me.
X
XMacros (with or without parameters) of the following form are also detected:
X
X"#" [white space] "define" [white space] NAME
X
XThe white space between the "#" and "define" is optional.
X
X
XOther Limitations and Changes
X
XNo sorting or detection of duplicate functions is done.
X
X 
XTony Andrews
XAugust 1987
!EOR!
echo extracting - dos_msc.mk
sed 's/^X//' > dos_msc.mk << '!EOR!'
X#
X# Makefile for DOS
X#
X# Microsoft make is brain-dead, so please bear with me.
X#
X
X#
X# Compact model lets us edit large files, but keep small model code
X#
XMODEL= /AC
XCFLAGS = $(MODEL) /DDOS
X
XMACH=	dos.obj
X
XOBJ=	alloc.obj \
X	main.obj \
X	cmdline.obj \
X	edit.obj \
X	enveval.obj \
X	fileio.obj \
X	help.obj \
X	hexchars.obj \
X	linefunc.obj \
X	mark.obj \
X	misccmds.obj \
X	normal.obj \
X	ops.obj \
X	param.obj \
X	ptrfunc.obj \
X	regexp.obj \
X	regsub.obj \
X	screen.obj \
X	search.obj \
X	sentence.obj \
X	tagcmd.obj \
X	undo.obj \
X	version.obj \
X	$(MACH)
X
Xall: stevie.exe
X
Xalloc.obj : alloc.c
X	cl -c $(CFLAGS) alloc.c
X
Xcmdline.obj : cmdline.c
X	cl -c $(CFLAGS) cmdline.c
X
Xedit.obj : edit.c
X	cl -c $(CFLAGS) edit.c
X
Xenveval.obj : enveval.c
X	cl -c $(CFLAGS) enveval.c
X
Xfileio.obj : fileio.c
X	cl -c $(CFLAGS) fileio.c
X
Xhelp.obj : help.c
X	cl -c $(CFLAGS) help.c
X
Xhexchars.obj : hexchars.c
X	cl -c $(CFLAGS) hexchars.c
X
Xlinefunc.obj : linefunc.c
X	cl -c $(CFLAGS) linefunc.c
X
Xmain.obj:	main.c
X	cl -c $(CFLAGS) main.c
X
Xmark.obj : mark.c
X	cl -c $(CFLAGS) mark.c
X
Xmisccmds.obj : misccmds.c
X	cl -c $(CFLAGS) misccmds.c
X
Xnormal.obj : normal.c
X	cl -c $(CFLAGS) normal.c
X
Xops.obj : ops.c
X	cl -c $(CFLAGS) ops.c
X
Xparam.obj : param.c
X	cl -c $(CFLAGS) param.c
X
Xptrfunc.obj : ptrfunc.c
X	cl -c $(CFLAGS) ptrfunc.c
X
Xregexp.obj : regexp.c
X	cl -c $(CFLAGS) regexp.c
X
Xregsub.obj : regsub.c
X	cl -c $(CFLAGS) regsub.c
X
Xscreen.obj : screen.c
X	cl -c $(CFLAGS) screen.c
X
Xsearch.obj : search.c
X	cl -c $(CFLAGS) search.c
X
Xsentence.obj : sentence.c
X	cl -c $(CFLAGS) sentence.c
X
Xtagcmd.obj : tagcmd.c
X	cl -c $(CFLAGS) tagcmd.c
X
Xundo.obj : undo.c
X	cl -c $(CFLAGS) undo.c
X
Xversion.obj : version.c
X	cl -c $(CFLAGS) version.c
X
Xdos.obj : dos.c
X	cl -c $(CFLAGS) dos.c
X
Xstevie.exe : $(OBJ)
X	cl $(MODEL) *.obj c:\pmsdk\lib\setargv.obj -o stevie.exe /F 6000 -link /NOE
!EOR!
echo extracting - dos_tc.mk
sed 's/^X//' > dos_tc.mk << '!EOR!'
X#
X# Makefile for MSDOS using Turbo C and any GOOD make program.
X# (Like, forget Microsoft Make; it's a joke.  Use Turbo Make - comes with TC,
X#  or NDMAKE - shareware, or PolyMake - from Polytron.  There are others...)
X#
X
XMODEL=	-mc
XDEFS=	-DDOS -DTURBOC -DTAGSTACK
XCFLAGS=	$(MODEL) $(DEFS)
XCC=	tcc
X
XPROGS=	alloc.c \
X	cmdline.c \
X	ctags.c \
X	dos.c \
X	edit.c \
X	enveval.c \
X	fileio.c \
X	help.c \
X	hexchars.c \
X	linefunc.c \
X	main.c \
X	mark.c \
X	minix.c \
X	misccmds.c \
X	normal.c \
X	ops.c \
X	os2.c \
X	param.c \
X	ptrfunc.c \
X	regexp.c \
X	regsub.c \
X	screen.c \
X	search.c \
X	sentence.c \
X        setenv.c \
X	tagcmd.c \
X	term.c \
X	tos.c \
X	undo.c \
X	unix.c \
X	version.c
X
XHDRS=	ascii.h \
X	env.h \
X	keymap.h \
X	ops.h \
X	param.h \
X	regexp.h \
X	regmagic.h \
X	stevie.h \
X	term.h
X
XMKFS=	dos_msc.mk \
X	dos_tc.mk \
X	minix.mk \
X	os2.mk \
X	tos.mk \
X	unix.mk
X
XMACH=	dos.obj
X
XOBJ=	alloc.obj \
X	cmdline.obj \
X	edit.obj \
X	enveval.obj. \
X	fileio.obj \
X	help.obj \
X	hexchars.obj \
X	linefunc.obj \
X	main.obj \
X	mark.obj \
X	misccmds.obj \
X	normal.obj \
X	ops.obj \
X	param.obj \
X	ptrfunc.obj \
X	screen.obj \
X	search.obj \
X	sentence.obj \
X	tagcmd.obj \
X	term.obj \
X	undo.obj \
X	version.obj
X
XOTHER=	regexp.obj regsub.obj \tc\lib\wildargs.obj
X
X.c.obj :
X	$(CC) -c $(CFLAGS) $*
X
Xall : stevie.exe stevie.doc
X
Xstevie.exe : $(OBJ) $(MACH) $(OTHER)
X	$(CC) -estevie $(OBJ) $(MACH) $(OTHER)
X
Xctags.exe : ctags.c
X	$(CC) ctags.c
X
Xsetenv.exe : setenv.c
X	$(CC) setenv.c
X
Xstevie.doc : stevie.mm
X	nroff -rB1 -Tlp -mm stevie.mm > stevie.doc
X
Xclean :
X	rm $(OBJ) $(MACH)
X
X# Clean out the .OBJs that depend on whether BIOS is defined.
Xcleanbios :
X        rm dos.obj screen.obj help.obj
X
X# Specific header dependencies.
X
X$(OBJ) : stevie.h env.h ascii.h keymap.h param.h term.h
X$(MACH) : stevie.h env.h ascii.h keymap.h param.h term.h
Xlinefunc.obj : ops.h
Xnormal.obj : ops.h
Xops.obj : ops.h
Xregexp.obj : regexp.h regmagic.h ops.h
Xregsub.obj : regexp.h regmagic.h
Xsearch.obj : regexp.h
Xsentence.obj : ops.h
X
X
Xzip : stevi369.zip
Xstevi369.zip : readme readme.dmt stevie.mm stevie.doc stevie.exe \
X                ctags.exe setenv.exe source.zip
X	pkzip -u stevi369 $?
X
Xsource.zip : $(PROGS) $(HDRS) $(MKFS) porting.doc source.doc stevie.prj
X	pkzip -u source $?
X
!EOR!
echo extracting - minix.mk
sed 's/^X//' > minix.mk << '!EOR!'
X#
X# Makefile for Atari ST Minix
X#
X
XLDFLAGS=
XCFLAGS= -O
X
XMACH=	minix.o
X
XOBJ=	alloc.o \
X	cmdline.o \
X	edit.o \
X	enveval.o \
X	fileio.o \
X	help.o \
X	hexchars.o \
X	linefunc.o \
X	main.o \
X	mark.o \
X	misccmds.o \
X	normal.o \
X	ops.o \
X	param.o \
X	ptrfunc.o \
X	regexp.o \
X	regsub.o \
X	screen.o \
X	search.o \
X	sentence.o \
X	tagcmd.o \
X	term.o \
X	undo.o \
X	version.o
X
Xall : stevie
X
Xstevie : $(OBJ) $(MACH)
X	$(CC) $(LDFLAGS) $(OBJ) $(MACH) -o stevie
X	chmem =150000 stevie
X
Xclean :
X	rm $(OBJ) $(MACH)
!EOR!
echo extracting - os2.mk
sed 's/^X//' > os2.mk << '!EOR!'
X#
X# Makefile for OS/2
X#
X# The make command with OS/2 is really stupid.
X#
X
X#
X# Compact model lets us edit large files, but keep small model code
X#
XMODEL= /AC
XCFLAGS = $(MODEL)
X
XMACH=	os2.obj
X
XOBJ=	alloc.obj \
X	cmdline.obj \
X	edit.obj \
X	envevla.obj \
X	fileio.obj \
X	help.obj \
X	hexchars.obj \
X	linefunc.obj \
X	main.obj \
X	mark.obj \
X	misccmds.obj \
X	normal.obj \
X	ops.obj \
X	param.obj \
X	ptrfunc.obj \
X	screen.obj \
X	search.obj \
X	sentence.obj \
X	tagcmd.obj \
X	undo.obj \
X	version.obj \
X	$(MACH)
X
Xalloc.obj : alloc.c
X	cl -c $(CFLAGS) alloc.c
X
Xcmdline.obj : cmdline.c
X	cl -c $(CFLAGS) cmdline.c
X
Xedit.obj : edit.c
X	cl -c $(CFLAGS) edit.c
X
Xfileio.obj : fileio.c
X	cl -c $(CFLAGS) fileio.c
X
Xhexchars.obj : hexchars.c
X	cl -c $(CFLAGS) hexchars.c
X
Xlinefunc.obj : linefunc.c
X	cl -c $(CFLAGS) linefunc.c
X
Xmain.obj:	main.c
X	cl -c $(CFLAGS) main.c
X
Xmark.obj : mark.c
X	cl -c $(CFLAGS) mark.c
X
Xmisccmds.obj : misccmds.c
X	cl -c $(CFLAGS) misccmds.c
X
Xnormal.obj : normal.c
X	cl -c $(CFLAGS) normal.c
X
Xhelp.obj : help.c
X	cl -c $(CFLAGS) help.c
X
Xops.obj : ops.c
X	cl -c $(CFLAGS) ops.c
X
Xparam.obj : param.c
X	cl -c $(CFLAGS) param.c
X
Xptrfunc.obj : ptrfunc.c
X	cl -c $(CFLAGS) ptrfunc.c
X
Xregexp.obj : regexp.c
X	cl -c $(CFLAGS) regexp.c
X
Xregsub.obj : regsub.c
X	cl -c $(CFLAGS) regsub.c
X
Xscreen.obj : screen.c
X	cl -c $(CFLAGS) screen.c
X
Xsearch.obj : search.c
X	cl -c $(CFLAGS) search.c
X
Xsentence.obj : sentence.c
X	cl -c $(CFLAGS) sentence.c
X
Xtagcmd.obj : tagcmd.c
X	cl -c $(CFLAGS) tagcmd.c
X
Xundo.obj : undo.c
X	cl -c $(CFLAGS) undo.c
X
Xversion.obj : version.c
X	cl -c $(CFLAGS) version.c
X
Xos2.obj : os2.c
X	cl -c $(CFLAGS) os2.c
X
Xstevie.exe : $(OBJ)
X	cl $(MODEL) *.obj \pmsdk\lib\setargv.obj -o stevie.exe /F 6000 -link /NOE
!EOR!
echo extracting - tos.mk
sed 's/^X//' > tos.mk << '!EOR!'
X#
X# Makefile for the Atari ST - Sozobon C Compiler
X#
X
XCFLAGS = -O
X
X.c.o:
X	$(CC) -c $(CFLAGS) $<
X	ar rv vi.lib $*.o
X
XMACH =	tos.o
X
XOBJ =	alloc.o \
X	cmdline.o \
X	edit.o \
X	enveval.o \
X	fileio.o \
X	help.o \
X	hexchars.o \
X	linefunc.o \
X	main.o \
X	mark.o \
X	misccmds.o \
X	normal.o \
X	ops.o \
X	param.o \
X	ptrfunc.o \
X	regexp.o \
X	regsub.o \
X	screen.o \
X	search.o \
X	sentence.o \
X	tagcmd.o \
X	undo.o \
X	version.o \
X	$(MACH)
X
Xall : stevie.ttp
X
Xstevie.ttp : $(OBJ)
X	$(CC) vi.lib -o stevie.ttp
X
Xclean :
X	$(RM) $(OBJ) vi.lib
!EOR!
echo extracting - unix.mk
sed 's/^X//' > unix.mk << '!EOR!'
X#
X# Makefile for UNIX (System V)
X#
X
XLDFLAGS=
XCFLAGS= -g
X
XH=	ascii.h \
X	env.h \
X	keymap.h \
X	ops.h \
X	param.h \
X	regexp.h \
X	regmagic.h \
X	stevie.h \
X	term.h
X
XMACH=	unix.o
X
XOBJ=	alloc.o \
X	cmdline.o \
X	edit.o \
X	enveval.o \
X	fileio.o \
X	help.o \
X	hexchars.o \
X	linefunc.o \
X	main.o \
X	mark.o \
X	misccmds.o \
X	normal.o \
X	ops.o \
X	param.o \
X	ptrfunc.o \
X	regexp.o \
X	regsub.o \
X	screen.o \
X	search.o \
X	sentence.o \
X	tagcmd.o \
X	term.o \
X	undo.o \
X	version.o
X
XSRC=	$(OBJ:.o=.c) $(MACH:.o=.c)
X
Xall : stevie stevie.doc
X
Xstevie : $(OBJ) $(MACH)
X	$(CC) $(LDFLAGS) $(OBJ) $(MACH) -o stevie -lcurses
X
Xlint :
X	lint $(SRC)
X
Xtags :
X	ctags $(SRC) $(H)
X
Xstevie.doc : stevie.mm
X	nroff -rB1 -Tlp -mm stevie.mm > stevie.doc
X
Xprint :
X	@pr $(H) $(SRC)
X
Xcflow :
X	cflow $(SRC) > cflow.for
X	cflow -r $(SRC) > cflow.rev
X
Xclean :
X	rm $(OBJ) $(MACH)
!EOR!
echo extracting - stevie.h
sed 's/^X//' > stevie.h << '!EOR!'
X/*
X * $Header: /nw/tony/src/stevie/src/RCS/stevie.h,v 1.19 89/07/12 21:33:32 tony Exp $
X *
X * Main header file included by all source files.
X */
X
X#include "env.h"	/* defines to establish the compile-time environment */
X
X#include <stdio.h>
X#include <ctype.h>
X
X#ifdef	BSD
X
X#include <strings.h>
X#define strchr index
X
X#else
X
X#ifdef	MINIX
X
Xextern	char	*strchr();
Xextern	char	*strrchr();
Xextern	char	*strcpy();
Xextern	char	*strcat();
Xextern	int	strlen();
X
X#else
X#include <string.h>
X#endif
X
X#endif
X
X#include "ascii.h"
X#include "keymap.h"
X#include "param.h"
X#include "term.h"
X
Xextern	char	*strchr();
X
X#define NORMAL 0
X#define CMDLINE 1
X#define INSERT 2
X#define REPLACE 3
X#define FORWARD 4
X#define BACKWARD 5
X
X/*
X * Boolean type definition and constants
X */
Xtypedef	short	bool_t;
X
X#ifndef	TRUE
X#define	FALSE	(0)
X#define	TRUE	(1)
X#endif
X
X/*
X * SLOP is the amount of extra space we get for text on a line during
X * editing operations that need more space. This keeps us from calling
X * malloc every time we get a character during insert mode. No extra
X * space is allocated when the file is initially read.
X */
X#define	SLOP	10
X
X/*
X * LINEINC is the gap we leave between the artificial line numbers. This
X * helps to avoid renumbering all the lines every time a new line is
X * inserted.
X */
X#define	LINEINC	10
X
X#define CHANGED		Changed=TRUE
X#define UNCHANGED	Changed=FALSE
X
Xstruct	line {
X	struct	line	*prev, *next;	/* previous and next lines */
X	char	*s;			/* text for this line */
X	int	size;			/* actual size of space at 's' */
X	unsigned long	num;		/* line "number" */
X};
X
X#define	LINEOF(x)	((x)->linep->num)
X
Xstruct	lptr {
X	struct	line	*linep;		/* line we're referencing */
X	int	index;			/* position within that line */
X};
X
Xtypedef	struct line	LINE;
Xtypedef	struct lptr	LPTR;
X
Xstruct charinfo {
X	char ch_size;
X	char *ch_str;
X};
X
Xextern struct charinfo chars[];
X
Xextern	int	State;
Xextern	int	Rows;
Xextern	int	Columns;
Xextern	char	*Realscreen;
Xextern	char	*Nextscreen;
Xextern	char	*Filename;
Xextern	LPTR	*Filemem;
Xextern	LPTR	*Filetop;
Xextern	LPTR	*Fileend;
Xextern	LPTR	*Topchar;
Xextern	LPTR	*Botchar;
Xextern	LPTR	*Curschar;
Xextern	LPTR	*Insstart;
Xextern	int	Cursrow, Curscol, Cursvcol, Curswant;
Xextern	bool_t	set_want_col;
Xextern	int	Prenum;
Xextern	bool_t	Changed;
Xextern	char	Redobuff[], Insbuff[];
Xextern	char	*Insptr;
Xextern	int	Ninsert;
Xextern	bool_t	got_int;
X
Xextern	char	*malloc(), *strcpy();
X
X/*
X * alloc.c
X */
Xchar	*alloc(), *strsave(), *mkstr();
Xint	screenalloc();
Xvoid	filealloc(), freeall();
XLINE	*newline();
Xbool_t	bufempty(), buf1line(), lineempty(), endofline(), canincrease();
X
X/*
X * cmdline.c
X */
Xvoid	docmdln(), msg(), emsg(), smsg(), gotocmd(), wait_return(), badcmd();
Xbool_t	doecmd();
Xchar	*getcmdln();
X
X/*
X * edit.c
X */
Xvoid	edit(), insertchar(), getout(), scrollup(), scrolldown(), beginline();
Xbool_t	oneright(), oneleft(), oneup(), onedown();
X
X/*
X * fileio.c
X */
Xvoid	filemess(), renum();
Xbool_t	readfile(), writeit();
X
X/*
X * help.c
X */
Xbool_t	help();
X
X/*
X * linefunc.c
X */
XLPTR	*nextline(), *prevline(), *coladvance(), *nextchar(), *prevchar();
X
X/*
X * main.c
X */
Xvoid	stuffin(), stuffnum();
Xvoid	do_mlines();
Xint	vgetc();
Xbool_t	anyinput();
X
X/*
X * mark.c
X */
Xvoid	setpcmark(), clrall(), clrmark();
Xbool_t	setmark();
XLPTR	*getmark();
X
X/*
X * misccmds.c
X */
Xvoid	opencmd(), fileinfo(), inschar(), delline();
Xbool_t	delchar();
Xint	cntllines(), plines();
XLPTR	*gotoline();
X
X/*
X * normal.c
X */
Xvoid	normal();
X
X/*
X * param.c
X */
Xvoid	doset();
X
X/*
X * ptrfunc.c
X */
Xint	inc(), dec();
Xint	gchar();
Xvoid	pchar(), pswap();
Xbool_t	lt(), equal(), ltoreq();
X#if 0
X/* not currently used */
Xbool_t	gtoreq(), gt();
X#endif
X
X/*
X * screen.c
X */
Xvoid	updatescreen(), updateline();
Xvoid	screenclear(), cursupdate();
Xvoid	s_ins(), s_del();
Xvoid	prt_line();
X
X/*
X * search.c
X */
Xvoid	dosub(), doglob();
Xbool_t	searchc(), crepsearch(), findfunc(), dosearch(), repsearch();
XLPTR	*showmatch();
XLPTR	*fwd_word(), *bck_word(), *end_word();
X
X/*
X * tagcmd.c
X */
Xvoid	dotag(), dountag();
X
X/*
X * undo.c
X */
Xvoid	u_save(), u_saveline(), u_clear();
Xvoid	u_lcheck(), u_lundo();
Xvoid	u_undo();
X
X/*
X * Machine-dependent routines.
X */
Xint	inchar();
Xvoid	flushbuf();
Xvoid	outchar(), outstr(), beep();
Xchar	*fixname();
X#ifndef	OS2
X#ifndef	DOS
Xvoid	remove(), rename();
X#endif
X#endif
Xvoid	windinit(), windexit(), windgoto();
Xvoid	pause();
Xvoid	doshell();
!EOR!
echo extracting - term.h
sed 's/^X//' > term.h << '!EOR!'
X/* $Header: /nw/tony/src/stevie/src/RCS/term.h,v 1.7 89/08/01 17:25:18 tony Exp $
X *
X * System-dependent escape sequence definitions.
X */
X
X#ifdef	TERMCAP
X
Xextern char *T_EL;		/* erase the entire current line */
Xextern char *T_IL;		/* insert one line */
Xextern char *T_DL;		/* delete one line */
Xextern char *T_SC;		/* save the cursor position */
Xextern char *T_ED;		/* erase display (may optionally home cursor) */
Xextern char *T_RC;		/* restore the cursor position */
Xextern char *T_CI;		/* invisible cursor (very optional) */
Xextern char *T_CV;		/* visible cursor (very optional) */
X
Xextern char *T_CM;		/* cursor motion string */
X
X#else
X
X/*
X * This file contains the machine dependent escape sequences that
X * the editor needs to perform various operations. Some of the sequences
X * here are optional. Anything not available should be indicated by
X * a null string. In the case of insert/delete line sequences, the
X * editor checks the capability and works around the deficiency, if
X * necessary.
X *
X * Currently, insert/delete line sequences are used for screen scrolling.
X * There are lots of terminals that have 'index' and 'reverse index'
X * capabilities, but no line insert/delete. For this reason, the editor
X * routines s_ins() and s_del() should be modified to use 'index'
X * sequences when the line to be inserted or deleted line zero.
X */
X
X/*
X * The macro names here correspond (more or less) to the actual ANSI names
X */
X
X#ifdef	ATARI
X#ifdef	MINIX
X
X#define	T_EL	"\033[2K"	/* erase the entire current line */
X#define	T_IL	"\033[L"	/* insert one line */
X#define	T_DL	"\033[M"	/* delete one line */
X#define	T_SC	"\0337"		/* save the cursor position */
X#define	T_ED	"\033[2J"	/* erase display (may optionally home cursor) */
X#define	T_RC	"\0338"		/* restore the cursor position */
X#define	T_CI	""		/* invisible cursor (very optional) */
X#define	T_CV	""		/* visible cursor (very optional) */
X
X#else
X
X#define	T_EL	"\033l"		/* erase the entire current line */
X#define	T_IL	"\033L"		/* insert one line */
X#define	T_DL	"\033M"		/* delete one line */
X#define	T_SC	"\033j"		/* save the cursor position */
X#define	T_ED	"\033E"		/* erase display (may optionally home cursor) */
X#define	T_RC	"\033k"		/* restore the cursor position */
X#define	T_CI	"\033f"		/* invisible cursor (very optional) */
X#define	T_CV	"\033e"		/* visible cursor (very optional) */
X
X#endif
X#endif
X
X#ifdef	UNIX
X/*
X * The following sequences are hard-wired for ansi-like terminals. To get
X * termcap support, define TERMCAP in env.h and these sequences go away.
X */
X#define	T_EL	"\033[2K"	/* erase the entire current line */
X#define	T_IL	"\033[L"	/* insert one line */
X#define	T_DL	"\033[M"	/* delete one line */
X#define	T_ED	"\033[2J"	/* erase display (may optionally home cursor) */
X#define	T_SC	"\0337"		/* save the cursor position */
X#define	T_RC	"\0338"		/* restore the cursor position */
X#define	T_CI	""		/* invisible cursor (very optional) */
X#define	T_CV	""		/* visible cursor (very optional) */
X#endif
X
X#ifdef	OS2
X/*
X * The OS/2 ansi console driver is pretty deficient. No insert or delete line
X * sequences. The erase line sequence only erases from the cursor to the end
X * of the line. For our purposes that works out okay, since the only time
X * T_EL is used is when the cursor is in column 0.
X *
X * The insert/delete line sequences marked here are actually implemented in
X * the file os2.c using direct OS/2 system calls. This makes the capability
X * available for the rest of the editor via appropriate escape sequences
X * passed to outstr().
X */
X#define	T_EL	"\033[K"	/* erase the entire current line */
X#define	T_IL	"\033[L"	/* insert one line - fake (see os2.c) */
X#define	T_DL	"\033[M"	/* delete one line - fake (see os2.c) */
X#define	T_ED	"\033[2J"	/* erase display (may optionally home cursor) */
X#define	T_SC	"\033[s"	/* save the cursor position */
X#define	T_RC	"\033[u"	/* restore the cursor position */
X#define	T_CI	""		/* invisible cursor (very optional) */
X#define	T_CV	""		/* visible cursor (very optional) */
X#endif
X
X
X#ifdef	DOS
X/*
X * DOS sequences
X *
X * Some of the following sequences require the use of the "nansi.sys"
X * console driver. The standard "ansi.sys" driver doesn't support
X * sequences for insert/delete line.
X */
X#define	T_EL	"\033[K"	/* erase the entire current line */
X#define	T_IL	"\033[L"	/* insert line (requires nansi.sys driver) */
X#define	T_DL	"\033[M"	/* delete line (requires nansi.sys driver) */
X#define	T_ED	"\033[2J"	/* erase display (may optionally home cursor) */
X#define	T_SC	"\033[s"	/* save the cursor position */
X#define	T_RC	"\033[u"	/* restore the cursor position */
X#define	T_CI	""		/* invisible cursor (very optional) */
X#define	T_CV	""		/* visible cursor (very optional) */
X#endif
X
X#endif
X
X/*
X * Machine-variant screen handling definitions.
X *
X * Define some macros which for invoking screen functions, whether by
X * callling a bios function or outputting an escape sequence to be
X * interpreted by a PC console driver or terminal.
X *
X * At this writing, not all of Stevie has been converted to use these
X * macros.  So far, only DOS and PC BIOS versions are completely converted.
X * Other versions are partly converted (because of changes I made in Stevie's
X * common code), but they have not been tested.  I'll convert others which I'm
X * in a position to test, but I'll leave any I can't test alone.  Hopefully,
X * this will minimize any damage to working versions which I can't test. -LAS
X */
X
X#ifdef BIOS
X
X#define	CANDL		TRUE		/* Can delete lines */
X#define	CANIL		TRUE		/* Can insert lines */
X#define	CLEOL		bios_t_el()	/* Erase to end-of-line */
X#define	CLS		bios_t_ed()	/* Erase entire display */
X#define	CRTDL(r,l)	bios_t_dl(r,l)	/* Delete lines from display */
X#define	CRTIL(r,l)	bios_t_il(r,l)	/* Insert lines in display */
X#define	CUROFF		bios_t_ci()	/* Make cursor invisible */
X#define	CURON		bios_t_cv()	/* Make cursor visible */
X#define	RESCUR		bios_t_rc()	/* Restore saved cursor position */
X#define	SAVCUR		bios_t_sc()	/* Save cursor position */
X
X#else		/* Not BIOS */
X
X#define	CANDL		(T_DL[0]!='\0')	/* Determine if can delete lines */
X#define	CANIL		(T_IL[0]!='\0')	/* Determine if can insert lines */
X#define	CLEOL		outstr(T_EL)	/* Erase to end-of-line */
X#define	CLS		outstr(T_ED)	/* Erase entire display */
X#define	CRTDL(r,l)	DO_DL(r,l)	/* Delete lines from display */
X#define	CRTIL(r,l)	DO_IL(r,l)	/* Insert lines in display */
X#define	CUROFF		outstr(T_CI)	/* Make cursor invisible */
X#define	CURON		outstr(T_CV)	/* Make cursor visible */
X#define	RESCUR		outstr(T_RC)	/* Restore saved cursor position */
X#define	SAVCUR		outstr(T_SC)	/* Save cursor position */
X
X#define	DO_DL(r,l) {\
X	int __xx_knt = l;\
X	while (__xx_knt-- > 0) {outstr(T_DL);}\
X}
X
X#define	DO_IL(r,l) {\
X	int __xx_knt = l;\
X	while (__xx_knt-- > 0) {outstr(T_IL);}\
X}
X
X#endif		/* Not BIOS */
X
X
!EOR!