[comp.sources.misc] v08i009: stevie 3.69 - part 7 of 8

allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (08/20/89)

Posting-number: Volume 8, Issue 9
Submitted-by: tony@cs.utexas.edu@wldrdg.UUCP (Tony Andrews)
Archive-name: stevie3.68/part07

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	undo.c
#	stevie.doc
#	ctags.doc
# This archive created: Sun Aug 13 11:46:13 1989
export PATH; PATH=/bin:$PATH
echo shar: extracting "'undo.c'" '(6821 characters)'
if test -f 'undo.c'
then
	echo shar: will not over-write existing file "'undo.c'"
else
sed 's/^X//' << \HE_HATES_THESE_CANS > 'undo.c'
X/* $Header: /nw/tony/src/stevie/src/RCS/undo.c,v 1.7 89/08/06 09:51:06 tony Exp $
X *
X * Undo facility
X *
X * The routines in this file comprise a general undo facility for use
X * throughout the rest of the editor. The routine u_save() is called
X * before each edit operation to save the current contents of the lines
X * to be editted. Later, u_undo() can be called to return those lines
X * to their original state. The routine u_clear() should be called
X * whenever a new file is going to be editted to clear the undo buffer.
X */
X
X#include "stevie.h"
X
X/*
X * The next two variables mark the boundaries of the changed section
X * of the file. Lines BETWEEN the lower and upper bounds are changed
X * and originally contained the lines pointed to by u_lines. To undo
X * the last change, insert the lines in u_lines between the lower and
X * upper bounds.
X */
Xstatic	LINE	*u_lbound = NULL; /* line just prior to first changed line */
Xstatic	LINE	*u_ubound = NULL; /* line just after the last changed line */
X
Xstatic	LINE	*u_lline  = NULL; /* bounds of the saved lines */
Xstatic	LINE	*u_uline  = NULL;
X
Xstatic	int	u_col;
Xstatic	bool_t	u_valid = FALSE;  /* is the undo buffer valid */
X
X/*
X * Local forward declarations
X */
Xstatic	LINE	*copyline();
Xstatic	void	u_lsave();
Xstatic	void	u_lfree();
X
X/*
X * u_save(l, u) - save the current contents of part of the file
X *
X * The lines between 'l' and 'u' are about to be changed. This routine
X * saves their current contents into the undo buffer. The range l to u
X * is not inclusive because when we do an open, for example, there aren't
X * any lines in between. If no lines are to be saved, then l->next == u.
X */
Xvoid
Xu_save(l, u)
XLINE	*l, *u;
X{
X	LINE	*nl;			/* copy of the current line */
X
X	/*
X	 * If l or u is null, there's an error. We don't return an
X	 * indication to the caller. They should find the problem
X	 * while trying to perform whatever edit is being requested
X	 * (e.g. a join on the last line).
X	 */
X	if (l == NULL || u == NULL)
X		return;
X
X	u_clear();			/* clear the buffer, first */
X
X	u_lsave(l, u);		/* save to the "line undo" buffer, if needed */
X
X	u_lbound = l;
X	u_ubound = u;
X
X	if (l->next != u) {		/* there are lines in the middle */
X		l = l->next;
X		u = u->prev;
X
X		u_lline = nl = copyline(l);	/* copy the first line */
X		while (l != u) {
X			nl->next = copyline(l->next);
X			nl->next->prev = nl;
X			l = l->next;
X			nl = nl->next;
X		}
X		u_uline = nl;
X	} else
X		u_lline = u_uline = NULL;
X
X	u_valid = TRUE;
X	u_col = Cursvcol;
X}
X
X/*
X * u_saveline() - save the current line in the undo buffer
X */
Xvoid
Xu_saveline()
X{
X	u_save(Curschar->linep->prev, Curschar->linep->next);
X}
X
X/*
X * u_undo() - effect an 'undo' operation
X *
X * The last edit is undone by restoring the modified section of the file
X * to its original state. The lines we're going to trash are copied to
X * the undo buffer so that even an 'undo' can be undone. Rings the bell
X * if the undo buffer is empty.
X */
Xvoid
Xu_undo()
X{
X	LINE	*tl, *tu;
X
X	if (!u_valid) {
X		beep();
X		return;
X	}
X
X	/*
X	 * Get the first line of the thing we're undoing on the screen.
X	 */
X	Curschar->linep = u_lbound->next;
X	Curschar->index = 0;			/* for now */
X	if (Curschar->linep == Fileend->linep)
X		Curschar->linep = Curschar->linep->prev;
X	cursupdate();
X
X	/*
X	 * Save pointers to what's in the file now.
X	 */
X	if (u_lbound->next != u_ubound) {	/* there are lines to get */
X		tl = u_lbound->next;
X		tu = u_ubound->prev;
X		tl->prev = NULL;
X		tu->next = NULL;
X	} else
X		tl = tu = NULL;			/* no lines between bounds */
X
X	/*
X	 * Link the undo buffer into the right place in the file.
X	 */
X	if (u_lline != NULL) {		/* there are lines in the undo buf */
X
X		/*
X		 * If the top line of the screen is being undone, we need to
X		 * fix up Topchar to point to the new line that will be there.
X		 */
X		if (u_lbound->next == Topchar->linep)
X			Topchar->linep = u_lline;
X
X		u_lbound->next = u_lline;
X		u_lline->prev  = u_lbound;
X		u_ubound->prev = u_uline;
X		u_uline->next  = u_ubound;
X	} else {			/* no lines... link the bounds */
X		if (u_lbound->next == Topchar->linep)
X			Topchar->linep = u_ubound;
X		if (u_lbound == Filetop->linep)
X			Topchar->linep = u_ubound;
X			
X		u_lbound->next = u_ubound;
X		u_ubound->prev = u_lbound;
X	}
X
X	/*
X	 * If we swapped the top line, patch up Filemem appropriately.
X	 */
X	if (u_lbound == Filetop->linep)
X		Filemem->linep = Filetop->linep->next;
X
X	/*
X	 * Now save the old stuff in the undo buffer.
X	 */
X	u_lline = tl;
X	u_uline = tu;
X
X	renum();		/* have to renumber everything */
X
X	/*
X	 * Put the cursor on the first line of the 'undo' region.
X	 */
X	Curschar->linep = u_lbound->next;
X	Curschar->index = 0;
X	if (Curschar->linep == Fileend->linep)
X		Curschar->linep = Curschar->linep->prev;
X	*Curschar = *coladvance(Curschar, u_col);
X	cursupdate();
X	updatescreen();		/* now show the change */
X
X	u_lfree();		/* clear the "line undo" buffer */
X}
X
X/*
X * u_clear() - clear the undo buffer
X *
X * This routine is called to clear the undo buffer at times when the
X * pointers are about to become invalid, such as when a new file is
X * about to be editted.
X */
Xvoid
Xu_clear()
X{
X	LINE	*l, *nextl;
X
X	if (!u_valid)		/* nothing to do */
X		return;
X
X	for (l = u_lline; l != NULL ;l = nextl) {
X		nextl = l->next;
X		free(l->s);
X		free((char *)l);
X	}
X
X	u_lbound = u_ubound = u_lline = u_uline = NULL;
X	u_valid = FALSE;
X}
X
X/*
X * The following functions and data implement the "line undo" feature
X * performed by the 'U' command.
X */
X
Xstatic	LINE	*u_line;		/* pointer to the line we last saved */
Xstatic	LINE	*u_lcopy = NULL;	/* local copy of the original line */
X
X/*
X * u_lfree() - free the line save buffer
X */
Xstatic	void
Xu_lfree()
X{
X	if (u_lcopy != NULL) {
X		free(u_lcopy->s);
X		free((char *)u_lcopy);
X		u_lcopy = NULL;
X	}
X	u_line = NULL;
X}
X
X/*
X * u_lsave() - save the current line if necessary
X */
Xstatic	void
Xu_lsave(l, u)
XLINE	*l, *u;
X{
X
X	if (l->next != u->prev) {	/* not changing exactly one line */
X		u_lfree();
X		return;
X	}
X
X	if (l->next == u_line)		/* more edits on the same line */
X		return;
X
X	u_lfree();
X	u_line = l->next;
X	u_lcopy = copyline(l->next);
X}
X
X/*
X * u_lundo() - undo the current line (the 'U' command)
X */
Xvoid
Xu_lundo()
X{
X	if (u_lcopy != NULL) {
X		free(Curschar->linep->s);
X		Curschar->linep->s = u_lcopy->s;
X		Curschar->linep->size = u_lcopy->size;
X		free((char *)u_lcopy);
X	} else
X		beep();
X	Curschar->index = 0;
X
X	cursupdate();
X	updatescreen();		/* now show the change */
X
X	u_lcopy = NULL;	/* can't undo this kind of undo */
X	u_line = NULL;
X}
X
X/*
X * u_lcheck() - clear the "line undo" buffer if we've moved to a new line
X */
Xvoid
Xu_lcheck()
X{
X	if (Curschar->linep != u_line)
X		u_lfree();
X}
X
X/*
X * copyline(l) - copy the given line, and return a pointer to the copy
X */
Xstatic LINE *
Xcopyline(l)
XLINE	*l;
X{
X	LINE	*nl;		/* the new line */
X
X	nl = newline(strlen(l->s));
X	strcpy(nl->s, l->s);
X
X	return nl;
X}
HE_HATES_THESE_CANS
if test 6821 -ne "`wc -c < 'undo.c'`"
then
	echo shar: error transmitting "'undo.c'" '(should have been 6821 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'stevie.doc'" '(31977 characters)'
if test -f 'stevie.doc'
then
	echo shar: will not over-write existing file "'stevie.doc'"
else
sed 's/^X//' << \HE_HATES_THESE_CANS > 'stevie.doc'
X
X
X
X                      STEVIE - An Aspiring VI Clone
X
X                          User Reference - 3.69
X
X                               Tony Andrews
X
X
X
X       1.  _O_v_e_r_v_i_e_w
X
X       STEVIE is an editor designed to mimic the interface  of  the
X       UNIX  editor  'vi'.  The name (ST Editor for VI Enthusiasts)
X       comes from the fact that the editor was  first  written  for
X       the  Atari ST. The current version also supports UNIX, Minix
X       (ST), MS-DOS, and OS/2, but I've left the  name  intact  for
X       now.
X
X       This program is the result of many late  nights  of  hacking
X       over  the last couple of years.  The first version was writ-
X       ten by Tim Thompson and posted  to  USENET.  From  there,  I
X       reworked  the  data  structures  completely,  added  LOTS of
X       features, and generally improved the overall performance  in
X       the process.
X
X       I've labelled STEVIE an 'aspiring' vi clone as a warning  to
X       those  who  may expect too much. On the whole, the editor is
X       pretty complete.  Nearly all of the visual mode commands are
X       supported.   And several of the more important 'ex' commands
X       are supported as well.  I've tried hard to capture the  feel
X       of vi by getting the little things right.  Making lines wrap
X       correctly, supporting true operators, and even  getting  the
X       cursor  to  land on the right place for tabs are all a pain,
X       but really help make the editor feel right.  I've  tried  to
X       resist  the  temptation  to deviate from the behavior of vi,
X       even where I disagree with the original design.
X
X       The biggest problem remaining has to do with the  fact  that
X       the  edit  buffer is maintained entirely in memory, limiting
X       the size of files that can be edited in  some  environments.
X       Other  missing  features  include  named buffers and macros.
X       Performance is generally  reasonable,  although  the  screen
X       update code could be more efficient.  This is generally only
X       visible on fairly slow systems.
X
X       STEVIE may be freely distributed.  The  source  isn't  copy-
X       righted  or  restricted  in any way. If you pass the program
X       along, please include all the documentation and, if  practi-
X       cal, the source as well. I'm not fanatical about this, but I
X       tried to make STEVIE fairly portable and I'd like to see  as
X       many people have access to the source as possible.
X
X       The remainder of this document describes  the  operation  of
X       the  editor.   This  is  intended  as  a reference for users
X       already familiar with the real vi editor.
X
X
X
X
X                                  - 1 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X       2.  _S_t_a_r_t_i_n_g__t_h_e__E_d_i_t_o_r
X
X       The following command line forms are supported:
X
X       stevie [file ...]   Edit the specified file(s)
X
X       stevie -t tag       Start at the location of the given tag
X
X       stevie + file       Edit file starting at end
X
X       stevie +n file      Edit file starting a line number 'n'
X
X       stevie +/pat file   Edit file starting at pattern 'pat'
X
X       If multiple files are given on the command line  (using  the
X       first  form),  the  ":n" command goes to the next file, ":N"
X       goes backward in the list, and ":rew" can be used to  rewind
X       back to the start of the file list.
X
X
X       3.  _S_e_t__C_o_m_m_a_n_d__O_p_t_i_o_n_s
X
X       The ":set" command works as usual to  set  parameters.  Each
X       parameter  has  a  long  and  an abbreviated name, either of
X       which may be used. Boolean parameters are set as in:
X
X            set showmatch
X
X       or cleared by:
X
X            set noshowmatch
X
X       Numeric parameters are set as in:
X
X            set scroll=5
X
X       Several parameters may be set with a single command:
X
X            set novb sm report=1
X
X       To see the status of all parameters use ":set  all".  Typing
X       ":set"  with  no  arguments  will show only those parameters
X       that have been changed.   The  supported  parameters,  their
X       names,  abbreviations,  defaults, and descriptions are shown
X       below:
X
X       autoindent  Short: ai, Default: noai, Type: Boolean
X                   When in insert mode, start new lines at the same
X                   column  as  the  prior  line. Unlike vi, you can
X                   backspace over the indentation.
X
X
X
X
X                                  - 2 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X       backup      Short: bk, Default: nobk, Type: Boolean
X                   Leave a backup on file writes.
X
X       errorbells  Short: eb, Default: noeb, Type: Boolean
X                   Ring bell when error messages are shown.
X
X       ignorecase  Short: ic, Default: noic, Type: Boolean
X                   Ignore case in string searches.
X
X       lines       Short: lines, Default: lines=25, Type: Numeric
X                   Number of physical  lines  on  the  screen.  The
X                   default  value  actually  depends  on  the  host
X                   machine, but is generally 25.
X
X       list        Short: list, Default: nolist, Type: Boolean
X                   Show tabs and newlines graphically.
X
X       modelines   Short: ml, Default: noml, Type: Boolean
X                   Enable processing of modelines in files.
X
X       number      Short: nu, Default: nonu, Type: Boolean
X                   Display lines on  the  screen  with  their  line
X                   numbers.
X
X       report      Short: report, Default: report=5, Type: Numeric
X                   Minimum number of lines to report operations on.
X
X       return      Short: cr, Default: cr, Type: Boolean
X                   End lines with cr-lf when writing files.
X
X       scroll      Short: scroll, Default: scroll=12, Type: Numeric
X                   Number of lines to scroll for ^D & ^U.
X
X       showmatch   Short: sm, Default: nosm, Type: Boolean
X                   When a ), }, or ] is typed, show the matching (,
X                   {,  or [ if it's on the current screen by moving
X                   the cursor there briefly.
X
X       showmode    Short: mo, Default: nomo, Type: Boolean
X                   Show on status line when in insert mode.
X
X       tabstop     Short: ts, Default: ts=8, Type: Numeric
X                   Number of spaces in a tab.
X
X       terse       Short: terse, Default: noterse, Type: Boolean
X                   This option is currently ignored.   It  is  pro-
X                   vided only for compatibility with vi.
X
X       tildeop     Short: to, Default: noto, Type: Boolean
X                   If set, tilde is an operator.  Otherwise,  tilde
X                   acts as normal.
X
X
X
X                                  - 3 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X       wrapscan    Short: ws, Default: ws, Type: Boolean
X                   String searches wrap  around  the  ends  of  the
X                   file.
X
X       vbell       Short: vb, Default: vb, Type: Boolean
X                   Use a visual bell, if possible. (novb for  audi-
X                   ble bell)
X
X       The EXINIT environment variable can be used  to  modify  the
X       default values on startup as in:
X
X            setenv EXINIT="set sm ts=4"
X
X       The 'backup' parameter, if set, causes the editor to  retain
X       a  backup of any files that are written. During file writes,
X       a backup is always kept for safety until the write  is  com-
X       pleted.  At  that  point,  the 'backup' parameter determines
X       whether the backup file is deleted.
X
X       In environments (e.g. OS/2 or TOS) where lines are  normally
X       terminated  by CR-LF, the 'return' parameter allows files to
X       be written with only a LF terminator (if  the  parameter  is
X       cleared).  This parameter is ignored on UNIX systems.
X
X       The 'lines' parameter tells the editor how many lines  there
X       are  on  the  screen.  This is useful on systems like the ST
X       (or OS/2 machines with an EGA adapter) where various  screen
X       resolutions  may  be  used.  By using the 'lines' parameter,
X       different screen sizes can be easily handled.
X
X
X       4.  _C_o_l_o_n__C_o_m_m_a_n_d_s
X
X       Several of the normal 'vi' colon commands are  supported  by
X       STEVIE.   Some  commands  may  be  preceded  by a line range
X       specification.  For commands that accept a range  of  lines,
X       the following address forms are supported:
X
X            addr
X            addr + number
X            addr - number
X
X       where 'addr' may be one of the following:
X
X            a line number
X            a mark (as in 'a or 'b)
X            '.' (the current line)
X            '$' (the last line)
X
X       An address range of "%" is accepted as  an  abbreviation  of
X       "1,$".
X
X
X
X                                  - 4 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X       4.1  _M_o_d_e__L_i_n_e_s
X
X       Mode lines are a little-known, but often useful, feature  of
X       vi.   To use this feature, special strings are placed in the
X       first or last five lines  in  a  file.   When  the  file  is
X       edited,  these  strings are detected and processed as though
X       typed as a colon command.  One instance where  this  can  be
X       useful  is  to  set  the  "tabstop"  parameter on a per-file
X       basis.  The following are examples of mode lines:
X
X            vi:set ts=4 noai:
X            ex:45:
X
X       Mode lines are characterized by the string "vi" or "ex" fol-
X       lowed  by  a  command  surrounded  by colons. Other text may
X       appear on the line, and multiple mode lines may be  present.
X       No  guarantee  is made regarding the order in which multiple
X       mode lines will be processed.
X
X       The processing of mode lines is enabled by setting the  "ml"
X       parameter.  This  should be done in the "EXINIT" environment
X       variable, so that mode line processing is enabled as soon as
X       the  editor begins.  By default, mode lines are disabled for
X       security reasons.
X
X       4.2  _T_h_e__G_l_o_b_a_l__C_o_m_m_a_n_d
X
X       A limited form of the global command is supported, accepting
X       the following command form:
X
X            g/pattern/X
X
X       where X may be either 'd' or 'p' to delete  or  print  lines
X       that  match  the  given  pattern.  If a line range is given,
X       only those lines are checked for a match with  the  pattern.
X       If no range is given, all lines are checked.
X
X       If  the  trailing  command  character  is  omitted,  'p'  is
X       assumed.  In this case, the trailing slash is also optional.
X       The current version of the editor does not support the  undo
X       operation  following  the  deletion of lines with the global
X       command.
X
X       4.3  _T_h_e__S_u_b_s_t_i_t_u_t_e__C_o_m_m_a_n_d
X
X       The substitute command provides  a  powerful  mechanism  for
X       making  more complex substitutions than can be done directly
X       from visual mode.  The general form of the command is:
X
X            s/pattern/replacement/g
X
X
X
X
X                                  - 5 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X       Each line in the given range (or the  current  line,  if  no
X       range  was  given)  is scanned for the given regular expres-
X       sion.  When found, the string that matched  the  pattern  is
X       replaced with the given replacement string.  If the replace-
X       ment  string  is  null,  each  matching  pattern  string  is
X       deleted.
X
X       The trailing 'g' is optional and, if present, indicates that
X       multiple  occurrences  of  'pattern' on a line should all be
X       replaced.
X
X       Some special sequences are  recognized  in  the  replacement
X       string.  The  ampersand  character is replaced by the entire
X       pattern that was matched.  For example, the  following  com-
X       mand  could be used to put all occurrences of 'foo' or 'bar'
X       within double quotes:
X
X            1,$s/foo|bar/"&"/g
X
X       The special sequence "\n" where 'n' is a digit from 1 to  9,
X       is  replaced  by  the  string  the matched the corresponding
X       parenthesized expression in the pattern. The following  com-
X       mand could be used to swap the first two parameters in calls
X       to the C function "foo":
X
X            1,$s/foo\(([^,]*),([^,]*),/foo(\2,\1,/g
X
X       Like the global command, substitutions can't be undone  with
X       this version of the editor.
X
X       4.4  _F_i_l_e__M_a_n_i_p_u_l_a_t_i_o_n__C_o_m_m_a_n_d_s
X
X       The following table shows the  supported  file  manipulation
X       commands  as  well  as  some other 'ex' commands that aren't
X       described elsewhere:
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X                                  - 6 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X       :w              write the current file
X       :wq             write and quit
X       :x              write (if necessary) and quit
X       ZZ              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
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
X       The ":help" command can also be invoked with the <HELP>  key
X       on  the  Atari  ST. This actually displays a pretty complete
X       summary of the real vi with unsupported  features  indicated
X       appropriately.
X
X       The commands above work pretty much like they  do  in  'vi'.
X       Most  of  the commands support a '!' suffix (if appropriate)
X       to discard any pending changes.
X
X
X       5.  _S_t_r_i_n_g__S_e_a_r_c_h_e_s
X
X       String searches are supported, as in vi, accepting the usual
X       regular  expression  syntax.  This was done using a modified
X       form of Henry Spencer's regular expression library. I  added
X       code outside the library to support the '\<' and '\>' exten-
X       sions.  The parameter "ignorecase" can be set to ignore case
X       in all string searches.
X
X
X
X
X
X
X                                  - 7 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X       6.  _O_p_e_r_a_t_o_r_s
X
X       The vi operators (d, c, y, !, <, and >) work as true  opera-
X       tors.   The tilde command may also be used as an operator if
X       the parameter "tildeop"  has  been  set.  By  default,  this
X       parameter is not set.
X
X
X       7.  _T_a_g_s
X
X       Tags are implemented and a fairly simple version of  'ctags'
X       is  supplied  with  the editor. The current version of ctags
X       will find functions and macros  following  a  specific  (but
X       common) form.  See 'ctags.doc' for a complete discussion.
X
X
X       8.  _S_y_s_t_e_m_-_S_p_e_c_i_f_i_c__C_o_m_m_e_n_t_s
X
X       The following sections provide additional relevant  informa-
X       tion for the systems to which STEVIE has been ported.
X
X       8.1  _A_t_a_r_i__S_T
X
X       8.1.1  _T_O_S  The editor has been tested in all three  resolu-
X       tions,  although  low  and  high  res.  are less tested than
X       medium. The 50-line high res. mode can be  used  by  setting
X       the  'lines' parameter to 50. Alternatively, the environment
X       variable 'LINES' can be set. The editor doesn't actively set
X       the  number  of  lines on the screen. It just operates using
X       the number of lines it was told.
X
X       The arrow keys, as well as the <INSERT>, <HELP>, and  <UNDO>
X       keys are all mapped appropriately.
X
X       8.1.2  _M_i_n_i_x  The editor  is  pretty  much  the  same  under
X       Minix,  but  many  of  the keyboard mappings aren't yet sup-
X       ported.
X
X       8.2  _U_N_I_X
X
X       The editor has been ported to UNIX System  V  release  3  as
X       well as 4.2 BSD.  This was done mainly to get some profiling
X       data so I haven't put much effort into doing the  UNIX  ver-
X       sion  right.   While the termcap routines are supported, the
X       editor is still fairly picky about the capabilities it wants
X       and makes little effort to do clever things with less intel-
X       ligent terminals.
X
X
X
X
X
X
X
X                                  - 8 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X       8.3  _O_S_/_2
X
X       This port was done because the editor that  comes  with  the
X       OS/2 developer's kit really stinks. Make sure 'ansi' mode is
X       on (using the 'ansi'  command).   The  OS/2  console  driver
X       doesn't  support  insert/delete line, so STEVIE bypasses the
X       driver and makes  the  appropriate  system  calls  directly.
X       This  is  all done in the system-specific part of the editor
X       so the kludge is at least localized.
X
X       The arrow keys, page up/down and home/end all do what  you'd
X       expect. The function keys are hard-coded to some useful mac-
X       ros until I can get true support for macros into the editor.
X       The current mappings are:
X
X            F1      :N <RETURN>
X            F2      :n <RETURN>
X            F3      :e # <RETURN>
X            F4      :rew <RETURN>
X            F5      [[
X            F6      ]]
X            F7      Convert C declaration to pseudo-english (uses cdecl)
X            F8      Convert english-style declaration to C (uses cdecl)
X            F9      :x <RETURN>
X            F10     :help <RETURN>
X
X            S-F1    :N! <RETURN>
X            S-F2    :n! <RETURN>
X
X       The macros for F7 and F8 assume that the "cdecl" program  is
X       available.
X
X       8.4  _M_S_D_O_S
X
X       STEVIE has been ported to MSDOS 3.3 using  the  Microsoft  C
X       compiler,  version  5.1.  The keyboard mappings are the same
X       as for OS/2.  The only problem with the PC version  is  that
X       the inefficiency of the screen update code becomes painfully
X       apparent on slower machines.
X
X       The DOS version requires the  use  of  an  extended  console
X       driver  that  can  insert and delete lines.  The distributed
X       code uses "nansi.sys" which seems to be widely available.
X
X
X       9.  _M_i_s_s_i_n_g__F_e_a_t_u_r_e_s
X
X         1.  The ability to edit files larger  than  the  available
X             memory.   This  isn't a problem on the machines I use,
X             but it hits the Minix-PC people pretty hard.
X
X
X
X
X                                  - 9 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X         2.  Macros with support for function keys.
X
X         3.  More "set" options.
X
X         4.  Many others...
X
X
X       10.  _K_n_o_w_n__B_u_g_s__a_n_d__P_r_o_b_l_e_m_s
X
X         1.  The yank buffer uses statically allocated  memory,  so
X             large  yanks  will  fail.  If  a  delete spans an area
X             larger than the yank buffer, the program asks for con-
X             firmation  before  proceeding.  That  way, if you were
X             moving text, you don't get screwed by the limited yank
X             buffer.  You  just  have  to  move smaller chunks at a
X             time. All the  internal  buffers  (yank,  redo,  etc.)
X             need  to  be  reworked to allocate memory dynamically.
X             The 'undo' buffer is now dynamically allocated, so any
X             change can be undone.
X
X         2.  If you stay in insert mode for a long time, the insert
X             buffer  can overflow.  The editor will print a message
X             and dump you back into command mode.
X
X         3.  The current version of the substitute and global  com-
X             mands  (i.e.  ":s/foo/bar"  or  ":g/foo/d")  can't  be
X             undone.  This is due to the current design of the undo
X             code.   To undo these commands would generally involve
X             unreasonable amounts of memory.
X
X         4.  Several other less bothersome glitches...
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X                                  - 10 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X       11.  _C_o_n_c_l_u_s_i_o_n
X
X       The editor has reached a pretty stable state,  and  performs
X       well  on  the  systems  I  use  it on, so I'm pretty much in
X       maintenance mode now.  There's still plenty to be done;  the
X       screen  update  code  is  still  pretty  inefficient and the
X       yank/put code is still primitive.  I'm still  interested  in
X       bug  reports,  and I do still add a new feature from time to
X       time, but the rate of change is way down now.
X
X       I'd like to thank Tim Thompson for writing the original ver-
X       sion  of  the  editor.  His  program was well structured and
X       quite readable. Thanks for giving me a  good  base  to  work
X       with.   Thanks also to many users of STEVIE who have sent in
X       their changes.  Many of the  changes  I've  received  aren't
X       portable  to  all  the systems I support, but I'm working to
X       get portable  implementations  integrated  into  the  editor
X       where possible.
X
X       If you're reading this file, but didn't get the source  code
X       for STEVIE, it can be had by sending a disk with return pos-
X       tage to the address given below. I can write disks  for  the
X       Atari  ST (SS or DS) or MSDOS (360K or 1.2M). Please be sure
X       to include the return postage. I don't intend to make  money
X       from this program, but I don't want to lose any either.
X
X            Tony Andrews            UUCP: onecom!wldrdg!tony
X            5902E Gunbarrel Ave.
X            Boulder, CO 80301
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                                  - 11 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X       _C_h_a_r_a_c_t_e_r__F_u_n_c_t_i_o_n__S_u_m_m_a_r_y
X
X       The following list describes the meaning of  each  character
X       that's  used  by  the  editor. In some cases characters have
X       meaning in both command  and  insert  mode;  these  are  all
X       described.
X
X
X       ^@      The null character. Not used in any mode. This char-
X               acter may not be present in the file, as is the case
X               with vi.
X
X       ^B      Backward one screen.
X
X       ^D      Scroll the window down one half screen.
X
X       ^E      Scroll the screen up one line.
X
X       ^F      Forward one screen.
X
X       ^G      Same as ":f" command. Displays file information.
X
X       ^H      (Backspace) Moves cursor left one space  in  command
X               mode.   In  insert  mode,  erases the last character
X               typed.
X
X       ^J      Move the cursor down one line.
X
X       ^L      Clear and redraw the screen.
X
X       ^M      (Carriage return) Move to the first non-white  char-
X               acter  in  the next line. In insert mode, a carriage
X               return opens a new line for input.
X
X       ^N      Move the cursor down a line.
X
X       ^P      Move the cursor up a line.
X
X       ^U      Scroll the window up one half screen.
X
X       ^Y      Scroll the screen down one line.
X
X       ^[      Escape cancels a pending command  in  command  mode,
X               and is used to terminate insert mode.
X
X       ^]      Moves to the tag whose name is given by the word  in
X               which the cursor resides.
X
X       ^`      Same as ":e #" if supported (system-dependent).
X
X
X
X
X
X                                  - 12 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X       SPACE   Move the cursor right on column.
X
X       !       The filter operator always operates on  a  range  of
X               lines,  passing the lines as input to a program, and
X               replacing them with the output of the  program.  The
X               shorthand  command  "!!"  can  be  used  to filter a
X               number of lines (specified by  a  preceding  count).
X               The  command  "!"  is  replaced  by the last command
X               used, so "!!!<RETURN>"  runs  the  given  number  of
X               lines through the last specified command.
X
X       $       Move to the end of the current line.
X
X       %       If the cursor rests on a paren '()', brace '{}',  or
X               bracket '[]', move to the matching one.
X
X       '       Used to move the cursor to a previously marked posi-
X               tion,  as in 'a or 'b. The cursor moves to the start
X               of the marked line. The special mark  ''  refers  to
X               the "previous context".
X
X       +       Same as carriage return, in command mode.
X
X       ,       Reverse of the last t, T, f, or F command.
X
X       -       Move to the first non-white character in the  previ-
X               ous line.
X
X       .       Repeat the last edit command.
X
X       /       Start of a forward  string  search  command.  String
X               searches may be optionally terminated with a closing
X               slash. To search for a slash use '\/' in the  search
X               string.
X
X       0       Move to the start of the  current  line.  Also  used
X               within counts.
X
X       1-9     Used to add 'count' prefixes to commands.
X
X       :       Prefix character for "ex" commands.
X
X       ;       Repeat last t, T, f, or F command.
X
X       <       The 'left shift' operator.
X
X       >       The 'right shift' operator.
X
X       ?       Same as '/', but search backward.
X
X
X
X
X
X                                  - 13 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X       A       Append at the end of the current line.
X
X       B       Backward one blank-delimited word.
X
X       C       Change the rest of the current line.
X
X       D       Delete the rest of the current line.
X
X       E       End of the end of a blank-delimited word.
X
X       F       Find a character backward on the current line.
X
X       G       Go to  the  given  line  number  (end  of  file,  by
X               default).
X
X       H       Move to the first non-white char. on the top  screen
X               line.
X
X       I       Insert before  the  first  non-white  char.  on  the
X               current line.
X
X       J       Join two lines.
X
X       L       Move to the first  non-white  char.  on  the  bottom
X               screen line.
X
X       M       Move to the first  non-white  char.  on  the  middle
X               screen line.
X
X       N       Reverse the last string search.
X
X       O       Open a new line above the current  line,  and  start
X               inserting.
X
X       P       Put the yank/delete buffer before the current cursor
X               position.
X
X       R       Replace characters until an  "escape"  character  is
X               received.   Similar  to  insert  mode,  but replaces
X               instead of inserting.  Typing a newline  in  replace
X               mode  is  the  same as in insert mode, but replacing
X               continues on the new line.
X
X       T       Reverse search 'upto' the given character.
X
X       U       Restore the current line to  its  state  before  you
X               started changing it.
X
X       W       Move forward one blank-delimited word.
X
X
X
X
X
X                                  - 14 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X       X       Delete one character before the cursor.
X
X       Y       Yank the current line. Same as 'yy'.
X
X       ZZ      Exit from the editor, saving changes if necessary.
X
X       [[      Move backward one C function.
X
X       ]]      Move forward one C function.
X
X       ^       Move to the first non-white on the current line.
X
X       `       Move to the given mark, as with '.  The  distinction
X               between the two commands is important when used with
X               operators. I support the  difference  correctly.  If
X               you  don't know what I'm talking about, don't worry,
X               it won't matter to you.
X
X       a       Append text after the cursor.
X
X       b       Back one word.
X
X       c       The change operator.
X
X       d       The delete operator.
X
X       e       Move to the end of a word.
X
X       f       Find a character on the current line.
X
X       h       Move left one column.
X
X       i       Insert text before the cursor.
X
X       j       Move down one line.
X
X       k       Move up one line.
X
X       l       Move right one column.
X
X       m       Set a mark at the current position (e.g. ma or mb).
X
X       n       Repeat the last string search.
X
X       o       Open a new line and start inserting text.
X
X       p       Put the yank/delete buffer after the cursor.
X
X       r       Replace a character.
X
X
X
X
X
X                                  - 15 -
X
X
X
X
X
X
X
X       STEVIE                                        User Reference
X
X
X
X       s       Replace characters.
X
X       t       Move forward  'upto'  the  given  character  on  the
X               current line.
X
X       u       Undo the last edit.
X
X       w       Move forward one word.
X
X       x       Delete the character under the cursor.
X
X       y       The yank operator.
X
X       z       Redraw the screen with the current line at  the  top
X               (zRETURN), the middle (z.), or the bottom (z-).
X
X       |       Move to the column given by the preceding count.
X
X       ~       Invert the case of the current character (if  alpha)
X               and  move  to the right.  If the parameter "tildeop"
X               is set, this command functions as an operator.
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
X
X
X                                  - 16 -
X
X
X
X
X
X
X
X
X
X
X
X                           STEVIE - User Guide
X
X                                 CONTENTS
X
X
X        1.  Overview...........................................   1
X
X        2.  Starting the Editor................................   2
X
X        3.  Set Command Options................................   2
X
X        4.  Colon Commands.....................................   4
X            4.1  Mode Lines....................................   5
X            4.2  The Global Command............................   5
X            4.3  The Substitute Command........................   5
X            4.4  File Manipulation Commands....................   6
X
X        5.  String Searches....................................   7
X
X        6.  Operators..........................................   8
X
X        7.  Tags...............................................   8
X
X        8.  System-Specific Comments...........................   8
X            8.1  Atari ST......................................   8
X            8.2  UNIX..........................................   8
X            8.3  OS/2..........................................   9
X            8.4  MSDOS.........................................   9
X
X        9.  Missing Features...................................   9
X
X       10.  Known Bugs and Problems............................  10
X
X       11.  Conclusion.........................................  11
X
X       Character Function Summary..............................  12
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X                                  - i -
X
X
X
X
HE_HATES_THESE_CANS
echo shar: 271 control characters may be missing from "'stevie.doc'"
if test 31977 -ne "`wc -c < 'stevie.doc'`"
then
	echo shar: error transmitting "'stevie.doc'" '(should have been 31977 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'ctags.doc'" '(994 characters)'
if test -f 'ctags.doc'
then
	echo shar: will not over-write existing file "'ctags.doc'"
else
sed 's/^X//' << \HE_HATES_THESE_CANS > 'ctags.doc'
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
HE_HATES_THESE_CANS
if test 994 -ne "`wc -c < 'ctags.doc'`"
then
	echo shar: error transmitting "'ctags.doc'" '(should have been 994 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0
--