#! /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 'stevie/README' <<'END_OF_FILE' XThis is a version of the vi editor clone 'stevie' for VxWorks 4.0.2. XOS dependence is not severe, so it should work, or just about, with 5.0.x too. XIt requires termlib, previously submitted to the VxWorks archives on Xthor.atd.ucar.edu as part of the vw_curses package. X XAlso required is a getenv() routine of some sort which Stevie uses to Xobtain the terminal type and initialization string. If you don't have one, Xjust write a dummy routine to return hard-coded values as necesary, or Xremove the getenv() calls from the stevie source code. X XSome miscellaneous header files not readily available with VxWorks have Xbeen provided in the 'h' directory. A few .c files are included here just Xfor completeness, but may duplicate facilities already available in your Xenvironment: atoi.c, sleep.c, kbhit.c. X XThis code is not properly cleaned up for distribution or widely tested in Xdifferent environments, so you will need to do some work to integrate it Xinto your environment. 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 XStartup Sequence: vi() X----------------- X XVxWorks implicitly assumes it is running one big program, and each section Xof that program can only be run once after ld'ing or else initialized variables Xmay be wrong. To get around these problems, stevie includes a startup module Xcalled crt0.s (a name Unix hackers will recognize). This is unfortunately Xwritten in 68020 assembly code (Sun assembler format), so it's not particularly Xportable. It is quite short and simple and there is probably no good reason Xbesides historical laziness for it to be in assembler, so convert it to C if Xyou wish. Anyway, the entry point for stevie is _stevie_start() in crt0.s. XThis fiddles with initialized variables and then calls main(). X XThe _stevie_start() entry point is not a convenient way to start stevie from Xthe shell. There are worries such as stack space, task spawning, and argument Xconversion to deal with, so routine attached below should be used to run the Xeditor from the shell. It has the very obvious name vi() and should probably Xbe linked separately from the main body of stevie() (at least I do, you can Xtry combining it with stevie itself). All this may need to be fixed a bit Xfor VxWorks version 5.0.x. X XGeorg Feil, Oct 13, 1992 XInstitute for Space and Terrestrial Science XSpace Geodynamics Lab X4850 Keele St. XNorth York, Ont. Canada XM3J 3K1 X XEmail: georg@sgl.ists.ca X X X------------------------ cut here ----------------------------- Xint vi(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, X int arg8, int arg9, int arg10) X/* X * Starts up stevie as a task, and waits for it to finish. X * Handles command-line parms properly, reformats VxWorks parms into unix-style X * argc and argv. X */ X{ X#define STEVIE_START "_stevie_start" X#define TASK_PRI_STEVIE 200 X#define STACK_SIZE_STEVIE 10000 X#define SPAWN_OPTS VX_SUPERVISOR_MODE|VX_FP_TASK|VX_STDIO X FUNCPTR start; X UTINY symType; X int tid; X int argc; X char *argv[12]; /* array of pointers to arg strings. We must not X exit before the spawned stevie task, or these X arguments disappear! */ X X /* ensure stevie not already running */ X if (taskNameToId("stevie")!=ERROR) { X printf("vi (stevie) is already running!\n"); X return(ERROR); X } X X /* build arguments. Assumes first unused arg is passed as NULL by VxWorks */ X argv[0]="stevie"; X argv[1]=(char*)arg1; X argv[2]=(char*)arg2; X argv[3]=(char*)arg3; X argv[4]=(char*)arg4; X argv[5]=(char*)arg5; X argv[6]=(char*)arg6; X argv[7]=(char*)arg7; X argv[8]=(char*)arg8; X argv[9]=(char*)arg9; X argv[10]=(char*)arg10; X argv[11]=NULL; X argc=0; X while (argv[argc]!=NULL) /* count args */ X argc++; X X if (symFindByName(sysSymTbl,STEVIE_START,&(char*)start,&symType)==OK) { X /* taskSpawn(name,priority,options,stacksize,entryAddress,arg1,...) */ X tid=taskSpawn("stevie",TASK_PRI_STEVIE,SPAWN_OPTS,STACK_SIZE_STEVIE,start, X argc,argv); X if (tid==ERROR) { X printf("Error spawning stevie task: %s\n",vw_errmsg(0)); X return(ERROR); X } X /* wait for task to exit */ X while (taskIdVerify(tid)==OK) { X taskDelay(sysClkRateGet()/2); /* sleep for 1/2 second */ X } X return(0); X } X X printf("Symbol '%s' is undefined!\n",STEVIE_START); X return(ERROR); X} X END_OF_FILE if test 4621 -ne `wc -c <'stevie/README'`; then echo shar: \"'stevie/README'\" unpacked with wrong size! fi # end of 'stevie/README' fi if test -f 'stevie/README.dmt' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/README.dmt'\" else echo shar: Extracting \"'stevie/README.dmt'\" \(3678 characters\) sed "s/^X//" >'stevie/README.dmt' <<'END_OF_FILE' 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 END_OF_FILE if test 3678 -ne `wc -c <'stevie/README.dmt'`; then echo shar: \"'stevie/README.dmt'\" unpacked with wrong size! fi # end of 'stevie/README.dmt' fi if test -f 'stevie/alloc.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/alloc.c'\" else echo shar: Extracting \"'stevie/alloc.c'\" \(4589 characters\) sed "s/^X//" >'stevie/alloc.c' <<'END_OF_FILE' X/* $Header: /nw/tony/src/stevie/src/RCS/alloc.c,v 1.5 89/08/06 09:49:22 tony Exp $ X * X * Various allocation routines and routines returning information about X * allocated objects. X */ X X#include "stevie.h" X Xchar * Xalloc(size) Xunsigned size; X{ X char *p; /* pointer to new storage space */ X X p = malloc(size); X if ( p == (char *)NULL ) { /* if there is no more room... */ X emsg("alloc() is unable to find memory!"); X } X return(p); X} X Xchar * Xstrsave(string) Xchar *string; X{ X return(strcpy(alloc((unsigned)(strlen(string)+1)),string)); X} X Xscreenalloc() X{ X /* X * If we're changing the size of the screen, free the old arrays X */ X if (Realscreen != NULL) X free(Realscreen); X if (Nextscreen != NULL) X free(Nextscreen); X X Realscreen = malloc((unsigned)(Rows*Columns)); X Nextscreen = malloc((unsigned)(Rows*Columns)); X if (!Realscreen || !Nextscreen) X return (-1); X else return (0); X} X X/* X * Allocate and initialize a new line structure with room for X * 'nchars'+1 characters. We add one to nchars here to allow for X * null termination because all the callers would just do it otherwise. X */ XLINE * Xnewline(nchars) Xint nchars; X{ X register LINE *l; X X if ((l = (LINE *) alloc(sizeof(LINE))) == NULL) X return (LINE *) NULL; X X l->s = alloc((unsigned) (nchars+1)); /* the line is empty */ X if (l->s == NULL) return (LINE *) NULL; X l->s[0] = NUL; X l->size = nchars + 1; X X l->prev = (LINE *) NULL; /* should be initialized by caller */ X l->next = (LINE *) NULL; X X return l; X} X X/* X * filealloc() - construct an initial empty file buffer X */ Xvoid Xfilealloc() X{ X if ((Filemem->linep = newline(0)) == NULL) { X fprintf(stderr,"Unable to allocate file memory!\n"); X exit(1); X } X if ((Filetop->linep = newline(0)) == NULL) { X fprintf(stderr,"Unable to allocate file memory!\n"); X exit(1); X } X if ((Fileend->linep = newline(0)) == NULL) { X fprintf(stderr,"Unable to allocate file memory!\n"); X exit(1); X } X Filemem->index = 0; X Filetop->index = 0; X Fileend->index = 0; X X Filetop->linep->next = Filemem->linep; /* connect Filetop to Filemem */ X Filemem->linep->prev = Filetop->linep; X X Filemem->linep->next = Fileend->linep; /* connect Filemem to Fileend */ X Fileend->linep->prev = Filemem->linep; X X *Curschar = *Filemem; X *Topchar = *Filemem; X X Filemem->linep->num = 0; X Fileend->linep->num = 0xffff; X X clrall(); /* clear all marks */ X u_clear(); /* clear the undo buffer */ X} X X/* X * freeall() - free the current buffer X * X * Free all lines in the current buffer. X */ Xvoid Xfreeall() X{ X register LINE *lp, *xlp; X X for (lp = Filetop->linep; lp != NULL ;lp = xlp) { X if (lp->s != NULL) X free(lp->s); X xlp = lp->next; X free((char *)lp); X } X X Curschar->linep = NULL; /* clear pointers */ X Filetop->linep = NULL; X Filemem->linep = NULL; X Fileend->linep = NULL; X X u_clear(); X} X X/* X * bufempty() - return TRUE if the buffer is empty X */ Xbool_t Xbufempty() X{ X return (buf1line() && Filemem->linep->s[0] == NUL); X} X X/* X * buf1line() - return TRUE if there is only one line X */ Xbool_t Xbuf1line() X{ X return (Filemem->linep->next == Fileend->linep); X} X X/* X * lineempty() - return TRUE if the current line is empty X */ Xbool_t Xlineempty() X{ X return (Curschar->linep->s[0] == NUL); X} X X/* X * endofline() - return TRUE if the given position is at end of line X * X * This routine will probably never be called with a position resting X * on the NUL byte, but handle it correctly in case it happens. X */ Xbool_t Xendofline(p) Xregister LPTR *p; X{ X return (p->linep->s[p->index] == NUL || p->linep->s[p->index+1] == NUL); X} X/* X * canincrease(n) - returns TRUE if the current line can be increased 'n' bytes X * X * This routine returns immediately if the requested space is available. X * If not, it attempts to allocate the space and adjust the data structures X * accordingly. If everything fails it returns FALSE. X */ Xbool_t Xcanincrease(n) Xregister int n; X{ X register int nsize; X register char *s; /* pointer to new space */ X X nsize = strlen(Curschar->linep->s) + 1 + n; /* size required */ X X if (nsize <= Curschar->linep->size) X return TRUE; X X /* X * Need to allocate more space for the string. Allow some extra X * space on the assumption that we may need it soon. This avoids X * excessive numbers of calls to malloc while entering new text. X */ X if ((s = alloc((unsigned) (nsize + SLOP))) == NULL) { X emsg("Can't add anything, file is too big!"); X State = NORMAL; X return FALSE; X } X X Curschar->linep->size = nsize + SLOP; X strcpy(s, Curschar->linep->s); X free(Curschar->linep->s); X Curschar->linep->s = s; X X return TRUE; X} X Xchar * Xmkstr(c) Xchar c; X{ X static char s[2]; X X s[0] = c; X s[1] = NUL; X X return s; X} END_OF_FILE if test 4589 -ne `wc -c <'stevie/alloc.c'`; then echo shar: \"'stevie/alloc.c'\" unpacked with wrong size! fi # end of 'stevie/alloc.c' fi if test -f 'stevie/param.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/param.c'\" else echo shar: Extracting \"'stevie/param.c'\" \(4162 characters\) sed "s/^X//" >'stevie/param.c' <<'END_OF_FILE' X/* $Header: /nw/tony/src/stevie/src/RCS/param.c,v 1.10 89/08/02 10:59:10 tony Exp $ X * X * Code to handle user-settable parameters. This is all pretty much table- X * driven. To add a new parameter, put it in the params array, and add a X * macro for it in param.h. If it's a numeric parameter, add any necessary X * bounds checks to doset(). String parameters aren't currently supported. X */ X X#include "stevie.h" X Xstruct param params[] = { X X { "tabstop", "ts", 8, P_NUM }, X { "scroll", "scroll", 12, P_NUM }, X { "report", "report", 5, P_NUM }, X { "lines", "lines", 25, P_NUM }, X X { "vbell", "vb", FALSE, P_BOOL }, X { "showmatch", "sm", FALSE, P_BOOL }, X { "wrapscan", "ws", TRUE, P_BOOL }, X { "errorbells", "eb", FALSE, P_BOOL }, X { "showmode", "mo", FALSE, P_BOOL }, X { "backup", "bk", FALSE, P_BOOL }, X { "return", "cr", TRUE, P_BOOL }, X { "list", "list", FALSE, P_BOOL }, X { "ignorecase", "ic", FALSE, P_BOOL }, X { "autoindent", "ai", FALSE, P_BOOL }, X { "number", "nu", FALSE, P_BOOL }, X { "modelines", "ml", FALSE, P_BOOL }, X { "tildeop", "to", FALSE, P_BOOL }, X { "terse", "terse", FALSE, P_BOOL }, X { "tagstack", "tg", FALSE, P_BOOL }, X { "color", "co", -1, P_NUM }, X { "", "", 0, 0, } /* end marker */ X X}; X Xstatic void showparms(); X Xvoid Xdoset(arg) Xchar *arg; /* parameter string */ X{ X register int i; X register char *s; X bool_t did_lines = FALSE; X bool_t state = TRUE; /* new state of boolean parms. */ X X if (arg == NULL) { X showparms(FALSE); X return; X } X if (strncmp(arg, "all", 3) == 0) { X showparms(TRUE); X return; X } X if (strncmp(arg, "no", 2) == 0) { X state = FALSE; X arg += 2; X } X X for (i=0; params[i].fullname[0] != NUL ;i++) { X s = params[i].fullname; X if (strncmp(arg, s, strlen(s)) == 0) /* matched full name */ X break; X s = params[i].shortname; X if (strncmp(arg, s, strlen(s)) == 0) /* matched short name */ X break; X } X X if (params[i].fullname[0] != NUL) { /* found a match */ X if (params[i].flags & P_NUM) { X did_lines = (i == P_LI); X if (arg[strlen(s)] != '=' || state == FALSE) X emsg("Invalid set of numeric parameter"); X else { X params[i].value = atoi(arg+strlen(s)+1); X params[i].flags |= P_CHANGED; X if (i==P_CO) setcolor (P(P_CO)); X } X } else /* boolean */ { X if (arg[strlen(s)] == '=') X emsg("Invalid set of boolean parameter"); X else { X params[i].value = state; X params[i].flags |= P_CHANGED; X } X } X } else X emsg("Unrecognized 'set' option"); X X /* X * Update the screen in case we changed something like "tabstop" X * or "list" that will change its appearance. X */ X updatescreen(); X X if (did_lines) { X Rows = P(P_LI); X P(P_LI) = Rows = setrows( Rows ); X /* setrows() is system-dependent. X * This assures no impossible values X * will be set. X */ X if (screenalloc() == -1) return; /* allocate new screen buffers */ X screenclear(); X updatescreen(); X } X /* X * Check the bounds for numeric parameters here X */ X if (P(P_TS) <= 0 || P(P_TS) > 32) { X emsg("Invalid tab size specified"); X P(P_TS) = 8; X return; X } X X if (P(P_SS) <= 0 || P(P_SS) > Rows) { X emsg("Invalid scroll size specified"); X P(P_SS) = 12; X return; X } X X#ifndef TILDEOP X if (P(P_TO)) { X emsg("Tilde-operator not enabled"); X P(P_TO) = FALSE; X return; X } X#endif X /* X * Check for another argument, and call doset() recursively, if X * found. If any argument results in an error, no further X * parameters are processed. X */ X while (*arg != ' ' && *arg != '\t') { /* skip to next white space */ X if (*arg == NUL) X return; /* end of parameter list */ X arg++; X } X while (*arg == ' ' || *arg == '\t') /* skip to next non-white */ X arg++; X X if (*arg) X doset(arg); /* recurse on next parameter */ X} X Xstatic void Xshowparms(all) Xbool_t all; /* show ALL parameters */ X{ X register struct param *p; X char buf[64]; X X gotocmd(TRUE, 0); X outstr("Parameters:\r\n"); X X for (p = ¶ms[0]; p->fullname[0] != NUL ;p++) { X if (!all && ((p->flags & P_CHANGED) == 0)) X continue; X if (p->flags & P_BOOL) X sprintf(buf, "\t%s%s\r\n", X (p->value ? "" : "no"), p->fullname); X else X sprintf(buf, "\t%s=%d\r\n", p->fullname, p->value); X X outstr(buf); X } X wait_return(); X} END_OF_FILE if test 4162 -ne `wc -c <'stevie/param.c'`; then echo shar: \"'stevie/param.c'\" unpacked with wrong size! fi # end of 'stevie/param.c' fi if test -f 'stevie/sentence.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/sentence.c'\" else echo shar: Extracting \"'stevie/sentence.c'\" \(4667 characters\) sed "s/^X//" >'stevie/sentence.c' <<'END_OF_FILE' X/* Find the NEXT/PREVIOUS: X * - SENTENCE findsent (dir) X * - PARAGRAPH findpara (dir) X * - FUNCTION findfunc (dir) X * X * I've split these off from SEARCH.C, because they're alike and X * SEARCH.C is a big file already. findfunc() was already there. X * I added findsent() and findpara(). - Dave Tutelman X */ X X#include "stevie.h" X#include "ops.h" X X/* We'll be doing some classification of input characters, into: */ X#define BLANK 0 /* Whitespace */ X#define DOT 1 /* Period, exclamation, q-mark */ X#define EOL 2 /* End-of-line */ X#define OTHER 3 /* Any other non-blank stuff */ X Xextern int operator; /* From normal.c, is there an operator X * pending? X */ X Xint Xinclass (c) X char c; X{ X switch (c) { X case ' ': X case '\t': X return BLANK; X case '.': X case '!': X case '?': X return DOT; X case '\n': X case '\r': X case '\0': X return EOL; X default: X if (c<' ' || c>'~') return EOL; X else return OTHER; X } X} X X/* We'll also need to (1) tell if a line is just blanks, and X * (2) skip to the next OTHER character. X * Here are a couple of functions to do it. X */ X Xbool_t Xblankline (line) X LPTR *line; X{ X char *p; X int class; X X if (! line) return TRUE; X for (p = line->linep->s; (class=inclass(*p))!=EOL; p++) X if (class!=BLANK) return FALSE; X return TRUE; X} X X XLPTR * Xskiptotext (lp, dir) X LPTR *lp; X int dir; X{ X LPTR *lpp; X X lpp = lp; X while (inclass( CHAR( lpp )) != OTHER) { X lpp = (dir==FORWARD) ? nextchar (lpp) : prevchar (lpp); X if (!lpp) return (lp); /* hit the end */ X } X return (lpp); X} X X X/* X * findsent (dir) - Find the next sentence in direction 'dir' X * X * Return TRUE if a sentence was found. X * X * Algorithm: found end of a sentence if: X * FWD - current char is BLANK | EOL and last is DOT. X * BKWD- current char is DOT and last is BLANK | EOL. X * In either case, we then have to skip to text at beginning of next sentence. X * X */ Xbool_t Xfindsent (dir) Xint dir; X{ X LPTR *curr, *last; /* LPTR for current & last characters */ X int ccurr, clast; /* class of curr and last characters */ X int oldindex; /* need to keep in case search fails */ X X curr = Curschar; X oldindex = curr->index; X /* Get INTO most recent sentence sentence. */ X if (dir==BACKWARD) X curr = prevchar (curr); X curr = skiptotext (curr, BACKWARD); X ccurr = OTHER; X X X do { X /* Take a step */ X last = curr; clast = ccurr; X X curr = (dir == FORWARD) ? nextchar(curr) : prevchar(curr); X ccurr = inclass (CHAR( curr )); X X /* Test halting condition */ X if (dir==FORWARD && X (ccurr==BLANK || ccurr==EOL) && clast==DOT) { X setpcmark(); X last = skiptotext (last, FORWARD); X *Curschar = *last; X return TRUE; X } X else if (dir==BACKWARD && X ccurr==DOT && (clast==BLANK || clast==EOL)) { X setpcmark(); X last = skiptotext (last, FORWARD); X *Curschar = *last; X return TRUE; X } X } while (curr != NULL); X X Curschar->index = oldindex; /* restore if search failed */ X return FALSE; X} X X X/* X * findpara(dir) - Find the next paragraph in direction 'dir' X * X * Return TRUE if a paragraph was found. X * X * Algorithm: found beginning of paragraph if: X * FWD - current line is non-blank and last is blank. X * BKWD- current line is blank and last is non-blank. X * Then we skip to the first non-blank, non-dot text. X * X */ Xbool_t Xfindpara(dir) Xint dir; X{ X LPTR *curr, *last; /* current & last lines */ X LPTR *marker; /* end of current para */ X bool_t bcurr, blast; /* "blankness" value for lines */ X X curr = Curschar; X bcurr = (dir==FORWARD) ? FALSE : TRUE; /* keeps us from passing the X * text initially. */ X X while (curr != NULL) { X /* Take a step */ X last = curr; blast = bcurr; X curr = (dir == FORWARD) ? nextline(curr) : prevline(curr); X bcurr = blankline (curr); X X /* Test halting condition */ X if (dir==FORWARD && bcurr && !blast) { X setpcmark(); X last = skiptotext (last, FORWARD); X *Curschar = *last; X return TRUE; X } X else if (dir==BACKWARD && bcurr && !blast) { X setpcmark(); X last = skiptotext (last, FORWARD); X *Curschar = *last; X return TRUE; X } X } X X return FALSE; X} X X X/* X * findfunc(dir) - Find the next function in direction 'dir' X * X * Return TRUE if a function was found. X * X * Algorithm depends on a style of C coding in which the ONLY '{' X * in the first column occurs at the beginning of a function definition. X * This is a good and common style, but not syntactically required by C. X */ Xbool_t Xfindfunc(dir) Xint dir; X{ X LPTR *curr; X X curr = Curschar; X X do { X curr = (dir == FORWARD) ? nextline(curr) : prevline(curr); X X if (curr != NULL && curr->linep->s[0] == '{') { X setpcmark(); X *Curschar = *curr; X return TRUE; X } X } while (curr != NULL); X X return FALSE; X} X END_OF_FILE if test 4667 -ne `wc -c <'stevie/sentence.c'`; then echo shar: \"'stevie/sentence.c'\" unpacked with wrong size! fi # end of 'stevie/sentence.c' fi if test -f 'stevie/stevie.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/stevie.h'\" else echo shar: Extracting \"'stevie/stevie.h'\" \(4325 characters\) sed "s/^X//" >'stevie/stevie.h' <<'END_OF_FILE' 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 X#include X X#ifdef BSD X X#include 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 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(); END_OF_FILE if test 4325 -ne `wc -c <'stevie/stevie.h'`; then echo shar: \"'stevie/stevie.h'\" unpacked with wrong size! fi # end of 'stevie/stevie.h' fi if test -f 'stevie/term.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/term.c'\" else echo shar: Extracting \"'stevie/term.c'\" \(4206 characters\) sed "s/^X//" >'stevie/term.c' <<'END_OF_FILE' X/* $Header: /nw/tony/src/stevie/src/RCS/term.c,v 1.4 89/03/11 22:43:55 tony Exp $ X * X * Termcap initialization (optional). X */ X X#include X#include "stevie.h" X X#ifdef TERMCAP X Xstatic char buf[1024]; /* termcap entry read here */ Xstatic char cap[256]; /* capability strings go in here */ X X#ifdef VxWorks X# define VXWORKS_DFLT_TERM "vt100" /* last-resort terminal type */ Xextern char* DfltTerm; /* terminal type if specified in cmd line */ X#endif X Xchar *T_EL; /* erase the entire current line */ Xchar *T_IL; /* insert one line */ Xchar *T_DL; /* delete one line */ Xchar *T_SC; /* save the cursor position */ Xchar *T_ED; /* erase display (may optionally home cursor) */ Xchar *T_RC; /* restore the cursor position */ Xchar *T_CI; /* invisible cursor (very optional) */ Xchar *T_CV; /* visible cursor (very optional) */ X Xchar *T_CM; /* cursor motion string */ X Xchar *T_KU; /* code sequence sent by up-arrow key */ Xchar *T_KD; /* code sequence sent by down-arrow key */ Xchar *T_KR; /* code sequence sent by right-arrow key */ Xchar *T_KL; /* code sequence sent by left-arrow key */ X Xextern int tgetent(), tgetnum(); Xextern char *tgetstr(); Xextern char *getenv(); X Xint Xt_init() X{ X char *term; X int n; X char *cp = cap; X X#ifdef VxWorks X if ((term = DfltTerm) == NULL) /* cmd line overrides environment */ X#endif X if ((term = getenv("TERM")) == NULL) { X#ifdef VxWorks X printf("Cannot read 'term' parameter of defaults file\n"); X term=VXWORKS_DFLT_TERM; X printf("Defaulting to terminal type %s\n",term); X sleep(3); X#else X fprintf(stderr, "Cannot read TERM environment variable\n"); X return 0; X#endif /* VxWorks */ X } X X if (tgetent(buf, term) != 1) { X fprintf(stderr, "Unknown terminal type: %s\n",term); X#ifdef VxWorks X if (strcmp(term,VXWORKS_DFLT_TERM)==0) X return 0; X X term=VXWORKS_DFLT_TERM; X printf("Defaulting to terminal type %s\n",term); X sleep(3); X if (tgetent(buf, term) != 1) { X fprintf(stderr, "Unknown terminal type: %s\n",term); X return 0; X } X#else X return 0; X#endif /* VxWorks */ X } X X /* X * Get mandatory capability strings. X */ X if ((T_CM = tgetstr("cm", &cp)) == NULL) { /* cursor motion */ X fprintf(stderr, "Terminal type %s is not cursor addressable (cm)\n",term); X return 0; X } X X if ((T_EL = tgetstr("ce", &cp)) == NULL) { /* clear to end of line */ X fprintf(stderr, "Termcap for %s\n is missing clear-to-EOL capability (ce)\n",term); X return 0; X } X X if ((T_ED = tgetstr("cl", &cp)) == NULL) { /* clear screen */ X fprintf(stderr, "Termcap for %s\n is missing clear-screen capability (cl)\n",term); X return 0; X } X X if ((n = tgetnum("li")) == -1) { X fprintf(stderr, "Cannot read # lines (li) in termcap for %s\n",term); X return 0; X } X else X P(P_LI) = Rows = n; X X if ((n = tgetnum("co")) == -1) { X fprintf(stderr, "Cannot read # columns (co) in termcap for %s\n",term); X return 0; X } X else X Columns = n; X X /* X * Optional capabilities. We ignore them if they have padding X * characters, to simplify output, i.e. don't have to use tputs(). X */ X if ((T_IL = tgetstr("al", &cp)) == NULL || isdigit(T_IL[0])) X T_IL = ""; /* add new blank line */ X X if ((T_DL = tgetstr("dl", &cp)) == NULL || isdigit(T_DL[0])) X T_DL = ""; /* delete line */ X X if ((T_SC = tgetstr("sc", &cp)) == NULL || isdigit(T_SC[0])) X T_SC = ""; /* save cursor pos */ X X if ((T_RC = tgetstr("rc", &cp)) == NULL || isdigit(T_RC[0])) X T_RC = ""; /* restore cursor pos */ X X if ((T_CI = tgetstr("vi", &cp)) == NULL || isdigit(T_CI[0])) X T_CI = ""; /* make cursor invisible */ X X if ((T_CV = tgetstr("ve", &cp)) == NULL || isdigit(T_CV[0])) X T_CV = ""; /* make cursor normal */ X X /* X * Cursor keys X */ X if ((T_KU = tgetstr("ku", &cp)) == NULL) X T_KU = ""; X X if ((T_KD = tgetstr("kd", &cp)) == NULL) X T_KD = ""; X X if ((T_KR = tgetstr("kr", &cp)) == NULL) X T_KR = ""; X X if ((T_KL = tgetstr("kl", &cp)) == NULL) X T_KL = ""; X X return 1; X} X X#endif END_OF_FILE if test 4206 -ne `wc -c <'stevie/term.c'`; then echo shar: \"'stevie/term.c'\" unpacked with wrong size! fi # end of 'stevie/term.c' fi echo shar: End of archive 3 \(of 13\). cp /dev/null ark3isdone 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