#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 2 (of 13)."
# Contents:  stevie/Makefile stevie/VxWorksChanges stevie/ctags.c
#   stevie/env.h stevie/hexchars.c stevie/linefunc.c stevie/ptrfunc.c
#   stevie/regsub.c stevie/source.doc stevie/vxworks.mk
# Wrapped by thor@surt on Fri Oct 16 09:43:46 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'stevie/Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stevie/Makefile'\"
else
echo shar: Extracting \"'stevie/Makefile'\" \(2945 characters\)
sed "s/^X//" >'stevie/Makefile' <<'END_OF_FILE'
X#
X# Stevie Makefile for VxWorks.
X# Written for a VxWorks 4.0.2 environment using unmodified GNU tools (gcc etc).
X# Uses traditional K&R C instead of the new improved ANSI C for compatibility
X# with old source code. Result is an incompletely linked object file named
X# 'stevie' to link into your VxWorks system using 'ld'.
X#
X
X# Put the name of the program(s) here
XEXECS= stevie
X
XH=	ascii.h env.h keymap.h ops.h param.h regexp.h regmagic.h stevie.h \
X	term.h
X
XMACH=	unix.c kbhit.c sleep.c
X
XSRC=	crt0.s alloc.c cmdline.c edit.c enveval.c fileio.c help.c hexchars.c \
X	linefunc.c main.c mark.c misccmds.c normal.c ops.c param.c ptrfunc.c \
X	regexp.c regsub.c screen.c search.c sentence.c tagcmd.c term.c \
X	undo.c atoi.c version.c $(MACH)
X
XOBJ0=	$(SRC:.c=.o)
XOBJ=	$(OBJ0:.s=.o)
X
X# C compiler options go here. Also useful, in the end: -O
XCFLAGS= -g -O -traditional
X
X# C preprocesor options. Use -DMACRO to define preprocessor macro MACRO.
XCPPFLAGS= -DVxWorks -nostdinc -I$(VWDIR)/h -Ih
X# Linker options
XLDFLAGS= 
X
X############## This part can be ignored by most people ###############
X
X# Which tools to use
XCC= gcc
XAS= gas
XLD= gld
XINSTALL= cp -p
X
X# Root directory for VxWorks
XVWDIR=/usr1/vw
X# Where to install things
XDESTDIR=/xxx/bin
X
XTARGET_ARCH=
X
X# normal compile (no link)
XCOMPILE.c= $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
X
X# compile & link
XLINK.c= $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
X
X# normal link
XLINK= $(LD) $(LDFLAGS)
X
X.c.o:
X	$(COMPILE.c) $*.c
X
X.s.o:
X	${AS} -o $*.o $*.s
X	${LD} -r $*.o
X	mv a.out $*.o
X
X
Xall : $(EXECS)
X
X# We avoid linking with libraries here to prevent duplication of code already
X# linked by ros. If any parts of libraries needed here are not linked by ros,
X# force them to be by adding to the EXTRA_MODULES macro in the ros makefile.
X# Don't link any libraries here.
Xstevie : $(OBJ)
X	$(LINK) -r $(OBJ) -o stevie
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
Xcflow :
X	cflow $(SRC) > cflow.for
X	cflow -r $(SRC) > cflow.rev
X
X# Special make rules:
X
Xdepend: force
X	makedepend -- $(CPPFLAGS) $(CFLAGS) -- $(SRC)
X
Xinstall: $(EXECS) justinstall
X
X# This uses GNU strip with -S to remove all symbols except locals and globals,
X# just like the -S option of ld, to reduce the executable's size. This means
X# it can still be debugged under VxWorks but not by gdb. Therefore when running
X# gdbvw, use the pre-install version of stevie in this directory. GNU strip is
X# necessary because Sun's strip doesn't have the -S option.
Xjustinstall: force
X	@for name in $(EXECS) ; do \
X	           $(INSTALL) $${name} $(DESTDIR) ; \
X	           gstrip -S $(DESTDIR)/$${name} ; \
X	           ls -l $(DESTDIR)/$${name} ; \
X	           echo "(Installed $${name} in $(DESTDIR))" ; \
X	done
X
X
Xclean :
X	rm $(OBJ)
X
X# dummy target to force execution of a rule (do not create a file of this name)
Xforce:
X
X# DO NOT DELETE THIS LINE -- make depend depends on it.
X
END_OF_FILE
if test 2945 -ne `wc -c <'stevie/Makefile'`; then
    echo shar: \"'stevie/Makefile'\" unpacked with wrong size!
fi
# end of 'stevie/Makefile'
fi
if test -f 'stevie/VxWorksChanges' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stevie/VxWorksChanges'\"
else
echo shar: Extracting \"'stevie/VxWorksChanges'\" \(2792 characters\)
sed "s/^X//" >'stevie/VxWorksChanges' <<'END_OF_FILE'
XVxWorks-related Mods to Stevie
X------------------------------
X
XThis software has been modified to add features, remove bugs etc.
Xand to port to VxWorks. It should no longer be used to build stevie
Xon other systems such as Unix. See the original version 3.69a distribution 
Xfrom comp.sources.misc volume 11.
X
X 
X91/04/30   Georg Feil       Changed visual bell default to FALSE.
X91/04/30   Georg Feil       Fixed some null-pointer dereferencing bugs 
X                              with (,),{, and } commands. Null ptr check
X                              added to CHAR macro in ops.h, nextline() and
X                              prevline() functions in linefunc.c, findsent()
X                              in sentence.c.
X91/04/30   Georg Feil       Buffer size in hparm() routine (help.c) was too
X                              small at 25, led to core dumps! Increased to 85.
X                            Made yank buffer size 16384 (16K).
X91/05/01   Georg Feil       Ported to VxWorks. Used #ifdef VxWorks. Affected
X                              files Makefile, unix.c, ops.c (system() call),
X                              term.c,
X91/05/02   Georg Feil       Changed termcap handling so that padding count
X                              in terminal escape sequence strings treated
X                              properly, i.e. call tputs() --was being output
X                              by write().
X91/05/02   Georg Feil       Added isascii() check in Prenum calculation in
X                              edit.c, because isdigit() etc. undefined outside
X                              ascii range on some systems (i.e. VxWorks!).
X                              Added termination to left-cursor and right-cursor
X                              if beeps -- "9999h" would otherwise give _lots_
X                              of beeps!
X91/05/02   Georg Feil       Changed interpretation of "backup" flag (P_BK)
X                              for VxWorks: TRUE==use .bak files while writing,
X                              FALSE==don't. The .bak file is always deleted
X                              after a successful write. The reason for this
X                              is that in some cases there may not be room on
X                              the disk for both a file and its backup.
X91/05/03   Georg Feil       Fixed bugs with x, s, y<space> and d<space> on
X                              empty line/file.
X91/05/06   Georg Feil       Added "-t[erm]" command-line option to override
X                              terminal type from getenv().
X
X
XKnown Bugs:
X-----------
X
X- (, ), {, and } sentence/paragraph motion commands don't act exactly like
X in the real vi.
X- c-space doesn't work right on last or 2nd-last character of line.
X- cntl-F leaves the cursor in the middle of the screen, not the top.
X
X
END_OF_FILE
if test 2792 -ne `wc -c <'stevie/VxWorksChanges'`; then
    echo shar: \"'stevie/VxWorksChanges'\" unpacked with wrong size!
fi
# end of 'stevie/VxWorksChanges'
fi
if test -f 'stevie/ctags.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stevie/ctags.c'\"
else
echo shar: Extracting \"'stevie/ctags.c'\" \(2958 characters\)
sed "s/^X//" >'stevie/ctags.c' <<'END_OF_FILE'
X/*
X * ctags - first cut at a UNIX ctags re-implementation
X */
X
X/*
X * Caveats:
X *
X * Only simple function declarations are recognized, as in:
X *
X * type
X * fname(...)
X *
X * where "fname" is the name of the function and must come at the beginning
X * of a line. This is the form I always use, so the limitation doesn't
X * bother me.
X *
X * Macros (with or without parameters) of the following form are also detected:
X *
X * "#" [white space] "define" [white space] NAME
X *
X * No sorting or detection of duplicate functions is done.
X *
X * If there are no arguments, a list of filenames to be searched is read
X * from the standard input. Otherwise, all arguments are assumed to be
X * file names.
X *
X * Tony Andrews
X * August 1987
X */
X
X#include <stdio.h>
X#include <ctype.h>
X#include <string.h>
X
Xint	ac;
Xchar	**av;
X
Xmain(argc, argv)
Xint	argc;
Xchar	*argv[];
X{
X	char	*fname, *nextfile();
X	FILE	*tp, *fopen();
X
X	ac = argc;
X	av = argv;
X
X	if ((tp = fopen("tags", "w")) == NULL) {
X		fprintf(stderr, "Can't create tags file\n");
X		exit(1);
X	}
X
X	while ((fname = nextfile()) != NULL)
X		dofile(fname, tp);
X
X	fclose(tp);
X	exit(0);
X}
X
Xchar *
Xnextfile()	/* returns ptr to next file to be searched, null at end */
X{
X	static	char	buf[128];
X	static	int	ap = 1;
X	char	*gets();
X
X	if (ac <= 1) {		/* read from stdin */
X		if (feof(stdin))
X			return (char *) NULL;
X		return (gets(buf));
X	} else {
X		if (ap < ac)
X			return av[ap++];
X		else
X			return (char *) NULL;
X	}
X}
X
X#define	LSIZE	512	/* max. size of a line */
X
X#define	BEGID(c)	(isalpha(c) || (c) == '_')
X#define	MIDID(c)	(isalpha(c) || isdigit(c) || (c) == '_')
X
Xdofile(fn, tp)
Xchar	*fn;
XFILE	*tp;
X{
X	FILE	*fp, *fopen();
X	char	*cp, *strchr();
X	char	lbuf[LSIZE];
X	char	func[LSIZE];
X	int	i, j;
X
X	if ((fp = fopen(fn, "r")) == NULL) {
X		fprintf(stderr, "Can't open file '%s' - skipping\n", fn);
X		return;
X	}
X
X	while (fgets(lbuf, LSIZE, fp) != NULL) {
X
X		lbuf[strlen(lbuf)-1] = '\0';	/* bag the newline */
X
X		if (BEGID(lbuf[0])) {		/* could be a function */
X			for (i=0; MIDID(lbuf[i]) ;i++)	/* grab the name */
X				func[i] = lbuf[i];
X
X			func[i] = '\0';		/* null terminate the name */
X
X			/*
X			 * We've skipped to the end of what may be a function
X			 * name. Check to see if the next non-whitespace
X			 * char is a paren,
X			 * and make sure the closing paren is here too.
X			 */
X			while (lbuf[i]==' ' || lbuf[i]=='\t') i++;
X			if (lbuf[i]=='(' && (((cp = strchr(lbuf,')'))!=NULL))) {
X				*++cp = '\0';
X				fprintf(tp, "%s\t%s\t/^%s$/\n", func,fn,lbuf);
X			}
X
X		} else if (lbuf[0] == '#') {	/* could be a define */
X			for (i=1; isspace(lbuf[i]) ;i++)
X				;
X			if (strncmp(&lbuf[i], "define", 6) != 0)
X				continue;
X
X			i += 6;			/* skip "define" */
X
X			for (; isspace(lbuf[i]) ;i++)
X				;
X
X			if (!BEGID(lbuf[i]))
X				continue;
X
X			for (j=0; MIDID(lbuf[i]) ;i++, j++)
X				func[j] = lbuf[i];
X
X			func[j] = '\0';		/* null terminate the name */
X			lbuf[i] = '\0';
X			fprintf(tp, "%s\t%s\t/^%s/\n", func, fn, lbuf);
X		}
X	}
X	fclose(fp);
X}
END_OF_FILE
if test 2958 -ne `wc -c <'stevie/ctags.c'`; then
    echo shar: \"'stevie/ctags.c'\" unpacked with wrong size!
fi
# end of 'stevie/ctags.c'
fi
if test -f 'stevie/env.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stevie/env.h'\"
else
echo shar: Extracting \"'stevie/env.h'\" \(3320 characters\)
sed "s/^X//" >'stevie/env.h' <<'END_OF_FILE'
X/*
X * The defines in this file establish the environment we're compiling
X * in. Set these appropriately before compiling the editor.
X */
X
X/*
X * One (and only 1) of the following defines should be uncommented.
X * Most of the code is pretty machine-independent. Machine dependent
X * code goes in a file like tos.c or unix.c. The only other place
X * where machine dependent code goes is term.h for escape sequences.
X */
X
X/* #define	ATARI			/* For the Atari ST */
X#define	UNIX			/* System V or BSD */
X/* #define	OS2			/* Microsoft OS/2 1.1 */
X/* #define	DOS			/* MSDOS 3.3 (on AT) */
X/*
X * If DOS is defined, then a number of other defines are possible:
X */
X#ifdef	DOS
X#define	TURBOC		/* Use Borland Turbo C.  Otherwise, the code
X			 * uses Microsoft C.
X			 */
X/* #define	BIOS	/* Display uses the BIOS routines, rather than
X			 * depending on an ANSI driver.  More
X			 * self-contained, and supports colors and
X			 * the following param (only legal if BIOS defined).
X			 */
X#endif
X
X/*
X * If UNIX is defined above, then BSD may be defined.
X * Don't define BSD for SunOS 4 (forces use of termio).
X */
X#ifdef	UNIX
X/* #define	BSD			/* Berkeley UNIX */
X#endif
X
X/*
X * If ATARI is defined, MINIX may be defined. Otherwise, the editor
X * is set up to compile using the Sozobon C compiler under TOS.
X */
X#ifdef	ATARI
X#define	MINIX			/* Minix for the Atari ST */
X#endif
X
X/*
X * The yank buffer is still static, but its size can be specified
X * here to override the default of 4K.
X */
X#define	YBSIZE	16384		/* yank buffer size */
X
X/*
X * STRCSPN should be defined if the target system doesn't have the
X * routine strcspn() available. See regexp.c for details.
X */
X
X#ifdef	ATARI
X
X#ifdef	MINIX
X#define	STRCSPN
X#endif
X
X#endif
X
X#ifdef	VxWorks
X#define	STRCSPN
X#endif
X
X/*
X * The following defines control the inclusion of "optional" features. As
X * the code size of the editor grows, it will probably be useful to be able
X * to tailor the editor to get the features you most want in environments
X * with code size limits.
X *
X * TILDEOP
X *	Normally the '~' command works on a single character. This define
X *	turns on code that allows it to work like an operator. This is
X *	then enabled at runtime with the "tildeop" parameter.
X *
X * HELP
X *	If defined, a series of help screens may be views with the ":help"
X *	command. This eats a fair amount of data space.
X *
X * TERMCAP
X *	If defined, STEVIE uses TERMCAP to determine the escape sequences
X *	to control the screen; if so, TERMCAP support had better be there.
X *	If not defined, you generally get hard-coded escape sequences for
X *	some "reasonable" terminal. In Minix, this means the console. For
X *	UNIX, this means an ANSI standard terminal. For MSDOS, this means
X *	a good ANSI driver (like NANSI.SYS, not ANSI.SYS).
X *	See the file "term.h" for details about specific environments.
X *
X * TAGSTACK
X *	If defined, this includes code that stacks calls to ':ta'.  The
X *	additional command ':untag' pops the stack back to the point at
X *	which the call to ':ta' was made.  In this mode, if the tag stack
X *	is not empty, Ctrl-^ will be interpreted as ':untag' rather than
X *	':e #'.
X *
X */
X/* #define	TILDEOP		/* enable tilde to be an operator */
X#define	HELP		/* enable help command */
X#define	TERMCAP		/* enable termcap support */
X/* #define	TAGSTACK	/* enable stacking calls to tags */
END_OF_FILE
if test 3320 -ne `wc -c <'stevie/env.h'`; then
    echo shar: \"'stevie/env.h'\" unpacked with wrong size!
fi
# end of 'stevie/env.h'
fi
if test -f 'stevie/hexchars.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stevie/hexchars.c'\"
else
echo shar: Extracting \"'stevie/hexchars.c'\" \(3109 characters\)
sed "s/^X//" >'stevie/hexchars.c' <<'END_OF_FILE'
X/* $Header: /nw/tony/src/stevie/src/RCS/hexchars.c,v 1.4 89/03/11 22:42:27 tony Exp $
X *
X * Contains information concerning the representation of characters for
X * visual output by the editor.
X */
X
X#include "stevie.h"
X
X/*
X * This file shows how to display characters on the screen. This is
X * approach is something of an overkill. It's a remnant from the
X * original code that isn't worth messing with for now. TABS are
X * special-cased depending on the value of the "list" parameter.
X */
X
Xstruct charinfo chars[] = {
X	/* 000 */	1, NULL,
X	/* 001 */	2, "^A",
X	/* 002 */	2, "^B",
X	/* 003 */	2, "^C",
X	/* 004 */	2, "^D",
X	/* 005 */	2, "^E",
X	/* 006 */	2, "^F",
X	/* 007 */	2, "^G",
X	/* 010 */	2, "^H",
X	/* 011 */	2, "^I",
X	/* 012 */	7, "[ERROR]",	/* shouldn't occur */
X	/* 013 */	2, "^K",
X	/* 014 */	2, "^L",
X	/* 015 */	2, "^M",
X	/* 016 */	2, "^N",
X	/* 017 */	2, "^O",
X	/* 020 */	2, "^P",
X	/* 021 */	2, "^Q",
X	/* 022 */	2, "^R",
X	/* 023 */	2, "^S",
X	/* 024 */	2, "^T",
X	/* 025 */	2, "^U",
X	/* 026 */	2, "^V",
X	/* 027 */	2, "^W",
X	/* 030 */	2, "^X",
X	/* 031 */	2, "^Y",
X	/* 032 */	2, "^Z",
X	/* 033 */	2, "^[",
X	/* 034 */	2, "^\\",
X	/* 035 */	2, "^]",
X	/* 036 */	2, "^^",
X	/* 037 */	2, "^_",
X	/* 040 */	1, NULL,
X	/* 041 */	1, NULL,
X	/* 042 */	1, NULL,
X	/* 043 */	1, NULL,
X	/* 044 */	1, NULL,
X	/* 045 */	1, NULL,
X	/* 046 */	1, NULL,
X	/* 047 */	1, NULL,
X	/* 050 */	1, NULL,
X	/* 051 */	1, NULL,
X	/* 052 */	1, NULL,
X	/* 053 */	1, NULL,
X	/* 054 */	1, NULL,
X	/* 055 */	1, NULL,
X	/* 056 */	1, NULL,
X	/* 057 */	1, NULL,
X	/* 060 */	1, NULL,
X	/* 061 */	1, NULL,
X	/* 062 */	1, NULL,
X	/* 063 */	1, NULL,
X	/* 064 */	1, NULL,
X	/* 065 */	1, NULL,
X	/* 066 */	1, NULL,
X	/* 067 */	1, NULL,
X	/* 070 */	1, NULL,
X	/* 071 */	1, NULL,
X	/* 072 */	1, NULL,
X	/* 073 */	1, NULL,
X	/* 074 */	1, NULL,
X	/* 075 */	1, NULL,
X	/* 076 */	1, NULL,
X	/* 077 */	1, NULL,
X	/* 100 */	1, NULL,
X	/* 101 */	1, NULL,
X	/* 102 */	1, NULL,
X	/* 103 */	1, NULL,
X	/* 104 */	1, NULL,
X	/* 105 */	1, NULL,
X	/* 106 */	1, NULL,
X	/* 107 */	1, NULL,
X	/* 110 */	1, NULL,
X	/* 111 */	1, NULL,
X	/* 112 */	1, NULL,
X	/* 113 */	1, NULL,
X	/* 114 */	1, NULL,
X	/* 115 */	1, NULL,
X	/* 116 */	1, NULL,
X	/* 117 */	1, NULL,
X	/* 120 */	1, NULL,
X	/* 121 */	1, NULL,
X	/* 122 */	1, NULL,
X	/* 123 */	1, NULL,
X	/* 124 */	1, NULL,
X	/* 125 */	1, NULL,
X	/* 126 */	1, NULL,
X	/* 127 */	1, NULL,
X	/* 130 */	1, NULL,
X	/* 131 */	1, NULL,
X	/* 132 */	1, NULL,
X	/* 133 */	1, NULL,
X	/* 134 */	1, NULL,
X	/* 135 */	1, NULL,
X	/* 136 */	1, NULL,
X	/* 137 */	1, NULL,
X	/* 140 */	1, NULL,
X	/* 141 */	1, NULL,
X	/* 142 */	1, NULL,
X	/* 143 */	1, NULL,
X	/* 144 */	1, NULL,
X	/* 145 */	1, NULL,
X	/* 146 */	1, NULL,
X	/* 147 */	1, NULL,
X	/* 150 */	1, NULL,
X	/* 151 */	1, NULL,
X	/* 152 */	1, NULL,
X	/* 153 */	1, NULL,
X	/* 154 */	1, NULL,
X	/* 155 */	1, NULL,
X	/* 156 */	1, NULL,
X	/* 157 */	1, NULL,
X	/* 160 */	1, NULL,
X	/* 161 */	1, NULL,
X	/* 162 */	1, NULL,
X	/* 163 */	1, NULL,
X	/* 164 */	1, NULL,
X	/* 165 */	1, NULL,
X	/* 166 */	1, NULL,
X	/* 167 */	1, NULL,
X	/* 170 */	1, NULL,
X	/* 171 */	1, NULL,
X	/* 172 */	1, NULL,
X	/* 173 */	1, NULL,
X	/* 174 */	1, NULL,
X	/* 175 */	1, NULL,
X	/* 176 */	1, NULL,
X	/* 177 */	2, "^?",
X};
END_OF_FILE
if test 3109 -ne `wc -c <'stevie/hexchars.c'`; then
    echo shar: \"'stevie/hexchars.c'\" unpacked with wrong size!
fi
# end of 'stevie/hexchars.c'
fi
if test -f 'stevie/linefunc.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stevie/linefunc.c'\"
else
echo shar: Extracting \"'stevie/linefunc.c'\" \(2606 characters\)
sed "s/^X//" >'stevie/linefunc.c' <<'END_OF_FILE'
X/* $Header: /nw/tony/src/stevie/src/RCS/linefunc.c,v 1.2 89/03/11 22:42:32 tony Exp $
X *
X * Basic line-oriented motions.
X */
X
X#include "stevie.h"
X#include "ops.h"
X
X/*
X * nextline(curr)
X *
X * Return a pointer to the beginning of the next line after the one
X * referenced by 'curr'. Return NULL if there is no next line (at EOF).
X */
X
XLPTR *
Xnextline(curr)
XLPTR	*curr;
X{
X	static	LPTR	next;
X
X	if (curr!=NULL && curr->linep->next != Fileend->linep) {
X		next.index = 0;
X		next.linep = curr->linep->next;
X		return &next;
X	}
X	return (LPTR *) NULL;
X}
X
X/*
X * prevline(curr)
X *
X * Return a pointer to the beginning of the line before the one
X * referenced by 'curr'. Return NULL if there is no prior line.
X */
X
XLPTR *
Xprevline(curr)
XLPTR	*curr;
X{
X	static	LPTR	prev;
X
X	if (curr!=NULL && curr->linep->prev != Filetop->linep) {
X		prev.index = 0;
X		prev.linep = curr->linep->prev;
X		return &prev;
X	}
X	return (LPTR *) NULL;
X}
X
X/*
X * coladvance(p,col)
X *
X * Try to advance to the specified column, starting at p.
X */
X
XLPTR *
Xcoladvance(p, col)
XLPTR	*p;
Xregister int	col;
X{
X	static	LPTR	lp;
X	register int	c, in;
X
X	lp.linep = p->linep;
X	lp.index = p->index;
X
X	/* If we're on a blank ('\n' only) line, we can't do anything */
X	if (lp.linep->s[lp.index] == '\0')
X		return &lp;
X	/* try to advance to the specified column */
X	for ( c=0; col-- > 0; c++ ) {
X		/* Count a tab for what it's worth (if list mode not on) */
X		if ( gchar(&lp) == TAB && !P(P_LS) ) {
X			in = ((P(P_TS)-1) - c%P(P_TS));
X			col -= in;
X			c += in;
X		}
X		/* Don't go past the end of */
X		/* the file or the line. */
X		if (inc(&lp)) {
X			dec(&lp);
X			break;
X		}
X	}
X	return &lp;
X}
X
X
X/*
X * nextchar(curr)
X *
X * Return a line pointer to the next character after the
X * one referenced by 'curr'. Return NULL if there is no next one (at EOF).
X * NOTE: this COULD point to a \n or \0 character.
X */
X
XLPTR *
Xnextchar(curr)
XLPTR	*curr;
X{
X	static	LPTR	*next;
X	char	c;
X
X	next = curr;
X	c = CHAR( next );
X	if (c=='\n' || c=='\0')		/* end of line */
X		next = nextline (next);
X	else
X		next->index++;
X
X	return (next);
X}
X
X
X/*
X * prevchar(curr)
X *
X * Return a line pointer to the previous character before the
X * one referenced by 'curr'. Return NULL if there is no previous one.
X * Note: this COULD point to a \n or \0 character.
X */
X
XLPTR *
Xprevchar(curr)
XLPTR	*curr;
X{
X	static	LPTR	*prev;
X	char	c;
X
X	prev = curr;
X	if (prev->index == 0) {		/* beginning of line */
X		prev = prevline (prev);		/* jump back */
X		c = CHAR( prev );
X		while (c!='\n' && c!= '\0') {	/* go to end of line */
X			prev->index++;
X			c = CHAR( prev );
X		}
X	}
X	else
X		prev->index--;
X
X	return (prev);
X}
X
X
END_OF_FILE
if test 2606 -ne `wc -c <'stevie/linefunc.c'`; then
    echo shar: \"'stevie/linefunc.c'\" unpacked with wrong size!
fi
# end of 'stevie/linefunc.c'
fi
if test -f 'stevie/ptrfunc.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stevie/ptrfunc.c'\"
else
echo shar: Extracting \"'stevie/ptrfunc.c'\" \(2663 characters\)
sed "s/^X//" >'stevie/ptrfunc.c' <<'END_OF_FILE'
X/* $Header: /nw/tony/src/stevie/src/RCS/ptrfunc.c,v 1.5 89/03/11 22:43:12 tony Exp $
X *
X * The routines in this file attempt to imitate many of the operations
X * that used to be performed on simple character pointers and are now
X * performed on LPTR's. This makes it easier to modify other sections
X * of the code. Think of an LPTR as representing a position in the file.
X * Positions can be incremented, decremented, compared, etc. through
X * the functions implemented here.
X */
X
X#include "stevie.h"
X
X/*
X * inc(p)
X *
X * Increment the line pointer 'p' crossing line boundaries as necessary.
X * Return 1 when crossing a line, -1 when at end of file, 0 otherwise.
X */
Xint
Xinc(lp)
Xregister LPTR	*lp;
X{
X	register char	*p;
X
X	if (lp && lp->linep)
X		p = &(lp->linep->s[lp->index]);
X	else
X		return -1;
X
X	if (*p != NUL) {			/* still within line */
X		lp->index++;
X		return ((p[1] != NUL) ? 0 : 1);
X	}
X
X	if (lp->linep->next != Fileend->linep) {  /* there is a next line */
X		lp->index = 0;
X		lp->linep = lp->linep->next;
X		return 1;
X	}
X
X	return -1;
X}
X
X/*
X * dec(p)
X *
X * Decrement the line pointer 'p' crossing line boundaries as necessary.
X * Return 1 when crossing a line, -1 when at start of file, 0 otherwise.
X */
Xint
Xdec(lp)
Xregister LPTR	*lp;
X{
X	if (lp->index > 0) {			/* still within line */
X		lp->index--;
X		return 0;
X	}
X
X	if (lp->linep->prev != Filetop->linep) { /* there is a prior line */
X		lp->linep = lp->linep->prev;
X		lp->index = strlen(lp->linep->s);
X		return 1;
X	}
X
X	lp->index = 0;				/* stick at first char */
X	return -1;				/* at start of file */
X}
X
X/*
X * gchar(lp) - get the character at position "lp"
X */
Xint
Xgchar(lp)
Xregister LPTR	*lp;
X{
X	if (lp && lp->linep)
X		return (lp->linep->s[lp->index]);
X	else
X		return 0;
X}
X
X/*
X * pchar(lp, c) - put character 'c' at position 'lp'
X */
Xvoid
Xpchar(lp, c)
Xregister LPTR	*lp;
Xchar	c;
X{
X	lp->linep->s[lp->index] = c;
X}
X
X/*
X * pswap(a, b) - swap two position pointers
X */
Xvoid
Xpswap(a, b)
Xregister LPTR	*a, *b;
X{
X	LPTR	tmp;
X
X	tmp = *a;
X	*a  = *b;
X	*b  = tmp;
X}
X
X/*
X * Position comparisons
X */
X
Xbool_t
Xlt(a, b)
Xregister LPTR	*a, *b;
X{
X	register int	an, bn;
X
X	an = LINEOF(a);
X	bn = LINEOF(b);
X
X	if (an != bn)
X		return (an < bn);
X	else
X		return (a->index < b->index);
X}
X
X#if 0
Xbool_t
Xgt(a, b)
XLPTR	*a, *b;
X{
X	register int an, bn;
X
X	an = LINEOF(a);
X	bn = LINEOF(b);
X
X	if (an != bn)
X		return (an > bn);
X	else
X		return (a->index > b->index);
X}
X#endif
X
Xbool_t
Xequal(a, b)
Xregister LPTR	*a, *b;
X{
X	return (a->linep == b->linep && a->index == b->index);
X}
X
Xbool_t
Xltoreq(a, b)
Xregister LPTR	*a, *b;
X{
X	return (lt(a, b) || equal(a, b));
X}
X
X#if 0
Xbool_t
Xgtoreq(a, b)
XLPTR	*a, *b;
X{
X	return (gt(a, b) || equal(a, b));
X}
X#endif
END_OF_FILE
if test 2663 -ne `wc -c <'stevie/ptrfunc.c'`; then
    echo shar: \"'stevie/ptrfunc.c'\" unpacked with wrong size!
fi
# end of 'stevie/ptrfunc.c'
fi
if test -f 'stevie/regsub.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stevie/regsub.c'\"
else
echo shar: Extracting \"'stevie/regsub.c'\" \(2552 characters\)
sed "s/^X//" >'stevie/regsub.c' <<'END_OF_FILE'
X/* $Header: /nw/tony/src/stevie/src/RCS/regsub.c,v 1.4 89/03/11 22:43:30 tony Exp $
X *
X * NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
X *
X * This is NOT the original regular expression code as written by
X * Henry Spencer. This code has been modified specifically for use
X * with the STEVIE editor, and should not be used apart from compiling
X * STEVIE. If you want a good regular expression library, get the
X * original code. The copyright notice that follows is from the
X * original.
X *
X * NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
X *
X * regsub
X *
X *	Copyright (c) 1986 by University of Toronto.
X *	Written by Henry Spencer.  Not derived from licensed software.
X *
X *	Permission is granted to anyone to use this software for any
X *	purpose on any computer system, and to redistribute it freely,
X *	subject to the following restrictions:
X *
X *	1. The author is not responsible for the consequences of use of
X *		this software, no matter how awful, even if they arise
X *		from defects in it.
X *
X *	2. The origin of this software must not be misrepresented, either
X *		by explicit claim or by omission.
X *
X *	3. Altered versions must be plainly marked as such, and must not
X *		be misrepresented as being the original software.
X *
X */
X
X#include <stdio.h>
X#include "regexp.h"
X#include "regmagic.h"
X
X#ifndef CHARBITS
X#define	UCHARAT(p)	((int)*(unsigned char *)(p))
X#else
X#define	UCHARAT(p)	((int)*(p)&CHARBITS)
X#endif
X
X/*
X - regsub - perform substitutions after a regexp match
X */
Xvoid
Xregsub(prog, source, dest)
Xregexp *prog;
Xchar *source;
Xchar *dest;
X{
X	register char *src;
X	register char *dst;
X	register char c;
X	register int no;
X	register int len;
X	extern char *strncpy();
X
X	if (prog == NULL || source == NULL || dest == NULL) {
X		regerror("NULL parm to regsub");
X		return;
X	}
X	if (UCHARAT(prog->program) != MAGIC) {
X		regerror("damaged regexp fed to regsub");
X		return;
X	}
X
X	src = source;
X	dst = dest;
X	while ((c = *src++) != '\0') {
X		if (c == '&')
X			no = 0;
X		else if (c == '\\' && '0' <= *src && *src <= '9')
X			no = *src++ - '0';
X		else
X			no = -1;
X 		if (no < 0) {	/* Ordinary character. */
X 			if (c == '\\' && (*src == '\\' || *src == '&'))
X 				c = *src++;
X 			*dst++ = c;
X 		} else if (prog->startp[no] != NULL && prog->endp[no] != NULL) {
X			len = prog->endp[no] - prog->startp[no];
X			(void) strncpy(dst, prog->startp[no], len);
X			dst += len;
X			if (len != 0 && *(dst-1) == '\0') {	/* strncpy hit NUL. */
X				regerror("damaged match string");
X				return;
X			}
X		}
X	}
X	*dst++ = '\0';
X}
END_OF_FILE
if test 2552 -ne `wc -c <'stevie/regsub.c'`; then
    echo shar: \"'stevie/regsub.c'\" unpacked with wrong size!
fi
# end of 'stevie/regsub.c'
fi
if test -f 'stevie/source.doc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stevie/source.doc'\"
else
echo shar: Extracting \"'stevie/source.doc'\" \(3058 characters\)
sed "s/^X//" >'stevie/source.doc' <<'END_OF_FILE'
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.
END_OF_FILE
if test 3058 -ne `wc -c <'stevie/source.doc'`; then
    echo shar: \"'stevie/source.doc'\" unpacked with wrong size!
fi
# end of 'stevie/source.doc'
fi
if test -f 'stevie/vxworks.mk' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stevie/vxworks.mk'\"
else
echo shar: Extracting \"'stevie/vxworks.mk'\" \(2945 characters\)
sed "s/^X//" >'stevie/vxworks.mk' <<'END_OF_FILE'
X#
X# Stevie Makefile for VxWorks.
X# Written for a VxWorks 4.0.2 environment using unmodified GNU tools (gcc etc).
X# Uses traditional K&R C instead of the new improved ANSI C for compatibility
X# with old source code. Result is an incompletely linked object file named
X# 'stevie' to link into your VxWorks system using 'ld'.
X#
X
X# Put the name of the program(s) here
XEXECS= stevie
X
XH=	ascii.h env.h keymap.h ops.h param.h regexp.h regmagic.h stevie.h \
X	term.h
X
XMACH=	unix.c kbhit.c sleep.c
X
XSRC=	crt0.s alloc.c cmdline.c edit.c enveval.c fileio.c help.c hexchars.c \
X	linefunc.c main.c mark.c misccmds.c normal.c ops.c param.c ptrfunc.c \
X	regexp.c regsub.c screen.c search.c sentence.c tagcmd.c term.c \
X	undo.c atoi.c version.c $(MACH)
X
XOBJ0=	$(SRC:.c=.o)
XOBJ=	$(OBJ0:.s=.o)
X
X# C compiler options go here. Also useful, in the end: -O
XCFLAGS= -g -O -traditional
X
X# C preprocesor options. Use -DMACRO to define preprocessor macro MACRO.
XCPPFLAGS= -DVxWorks -nostdinc -I$(VWDIR)/h -Ih
X# Linker options
XLDFLAGS= 
X
X############## This part can be ignored by most people ###############
X
X# Which tools to use
XCC= gcc
XAS= gas
XLD= gld
XINSTALL= cp -p
X
X# Root directory for VxWorks
XVWDIR=/usr1/vw
X# Where to install things
XDESTDIR=/xxx/bin
X
XTARGET_ARCH=
X
X# normal compile (no link)
XCOMPILE.c= $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
X
X# compile & link
XLINK.c= $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
X
X# normal link
XLINK= $(LD) $(LDFLAGS)
X
X.c.o:
X	$(COMPILE.c) $*.c
X
X.s.o:
X	${AS} -o $*.o $*.s
X	${LD} -r $*.o
X	mv a.out $*.o
X
X
Xall : $(EXECS)
X
X# We avoid linking with libraries here to prevent duplication of code already
X# linked by ros. If any parts of libraries needed here are not linked by ros,
X# force them to be by adding to the EXTRA_MODULES macro in the ros makefile.
X# Don't link any libraries here.
Xstevie : $(OBJ)
X	$(LINK) -r $(OBJ) -o stevie
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
Xcflow :
X	cflow $(SRC) > cflow.for
X	cflow -r $(SRC) > cflow.rev
X
X# Special make rules:
X
Xdepend: force
X	makedepend -- $(CPPFLAGS) $(CFLAGS) -- $(SRC)
X
Xinstall: $(EXECS) justinstall
X
X# This uses GNU strip with -S to remove all symbols except locals and globals,
X# just like the -S option of ld, to reduce the executable's size. This means
X# it can still be debugged under VxWorks but not by gdb. Therefore when running
X# gdbvw, use the pre-install version of stevie in this directory. GNU strip is
X# necessary because Sun's strip doesn't have the -S option.
Xjustinstall: force
X	@for name in $(EXECS) ; do \
X	           $(INSTALL) $${name} $(DESTDIR) ; \
X	           gstrip -S $(DESTDIR)/$${name} ; \
X	           ls -l $(DESTDIR)/$${name} ; \
X	           echo "(Installed $${name} in $(DESTDIR))" ; \
X	done
X
X
Xclean :
X	rm $(OBJ)
X
X# dummy target to force execution of a rule (do not create a file of this name)
Xforce:
X
X# DO NOT DELETE THIS LINE -- make depend depends on it.
X
END_OF_FILE
if test 2945 -ne `wc -c <'stevie/vxworks.mk'`; then
    echo shar: \"'stevie/vxworks.mk'\" unpacked with wrong size!
fi
# end of 'stevie/vxworks.mk'
fi
echo shar: End of archive 2 \(of 13\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 13 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
