#! /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 'MANIFEST' <<'END_OF_FILE' X File Name Archive # Description X----------------------------------------------------------- X MANIFEST 1 This shipping list X stevie 1 X stevie/Makefile 2 X stevie/README 3 X stevie/README.dmt 3 X stevie/VxWorksChanges 2 X stevie/alloc.c 3 X stevie/ascii.h 1 X stevie/atoi.c 1 X stevie/cmdline.c 6 X stevie/crt0.s 1 X stevie/ctags.c 2 X stevie/ctags.doc 1 X stevie/dos.c 11 X stevie/dos_msc.mk 1 X stevie/dos_tc.mk 1 X stevie/edit.c 4 X stevie/env.h 2 X stevie/enveval.c 1 X stevie/fileio.c 5 X stevie/h 1 X stevie/h/assert.h 1 X stevie/h/stdio.h 1 X stevie/h/string.h 1 X stevie/help.c 8 X stevie/hexchars.c 2 X stevie/kbhit.c 1 X stevie/keymap.h 1 X stevie/linefunc.c 2 X stevie/main.c 5 X stevie/mark.c 1 X stevie/minix.c 4 X stevie/minix.mk 1 X stevie/misccmds.c 6 X stevie/normal.c 9 X stevie/ops.c 7 X stevie/ops.h 1 X stevie/os2.c 4 X stevie/os2.mk 1 X stevie/param.c 3 X stevie/param.h 1 X stevie/porting.doc 1 X stevie/ptrfunc.c 2 X stevie/regexp.c 13 X stevie/regexp.h 1 X stevie/regmagic.h 1 X stevie/regsub.c 2 X stevie/screen.c 9 X stevie/search.c 10 X stevie/sentence.c 3 X stevie/setenv.c 8 X stevie/sleep.c 1 X stevie/source.doc 2 X stevie/stevie.h 3 X stevie/stevie.mm 12 X stevie/tagcmd.c 4 X stevie/term.c 3 X stevie/term.h 5 X stevie/tos.c 5 X stevie/tos.mk 1 X stevie/undo.c 4 X stevie/unix.c 6 X stevie/unix.mk 1 X stevie/version.c 7 X stevie/vxworks.mk 2 END_OF_FILE if test 2129 -ne `wc -c <'MANIFEST'`; then echo shar: \"'MANIFEST'\" unpacked with wrong size! fi # end of 'MANIFEST' fi if test ! -d 'stevie' ; then echo shar: Creating directory \"'stevie'\" mkdir 'stevie' fi if test -f 'stevie/ascii.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/ascii.h'\" else echo shar: Extracting \"'stevie/ascii.h'\" \(301 characters\) sed "s/^X//" >'stevie/ascii.h' <<'END_OF_FILE' X/* $Header: /nw/tony/src/stevie/src/RCS/ascii.h,v 1.2 89/03/11 22:42:03 tony Exp $ X * X * Definitions of various common control characters X */ X X#define NUL '\0' X#define BS '\010' X#define TAB '\011' X#define NL '\012' X#define CR '\015' X#define ESC '\033' X#define DEL '\177' X X#define CTRL(x) ((x) & 0x1f) END_OF_FILE if test 301 -ne `wc -c <'stevie/ascii.h'`; then echo shar: \"'stevie/ascii.h'\" unpacked with wrong size! fi # end of 'stevie/ascii.h' fi if test -f 'stevie/atoi.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/atoi.c'\" else echo shar: Extracting \"'stevie/atoi.c'\" \(284 characters\) sed "s/^X//" >'stevie/atoi.c' <<'END_OF_FILE' X Xint Xatoi(p) Xregister char *p; X{ X register int n; X register int f; X X n = 0; X f = 0; X for(;;p++) { X switch(*p) { X case ' ': X case '\t': X continue; X case '-': X f++; X case '+': X p++; X } X break; X } X while(*p >= '0' && *p <= '9') X n = n*10 + *p++ - '0'; X return(f? -n: n); X} END_OF_FILE if test 284 -ne `wc -c <'stevie/atoi.c'`; then echo shar: \"'stevie/atoi.c'\" unpacked with wrong size! fi # end of 'stevie/atoi.c' fi if test -f 'stevie/crt0.s' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/crt0.s'\" else echo shar: Extracting \"'stevie/crt0.s'\" \(2469 characters\) sed "s/^X//" >'stevie/crt0.s' <<'END_OF_FILE' X| Stevie startup module. Must be the first code linked for stevie, before main. X| X| This version for VxWorks. The main purpose is to properly initialize the X| user initialized data space between different runs of stevie. The first time X| it executes, this routine saves away the entire initialized data space in X| malloc'd memory. On subsequent runs it restores the initialized data. X| We would like to zero the bss area as well, but this is hard because we can't X| tell exactly where it starts or ends. Also, some BSS variables (those labeled X| as "common") seem to be placed outside the normal BSS block by the VxWorks X| loader. Therefore *never* depend on uninitialized variables to be X| automatically set to 0. Explicitly initialize them to zero instead. X| X| 90/06/27 Georg Feil Initial revision, from s2 dev system. X| 90/07/26 Georg Feil Fixed stack creep problem at malloc() call. X| 91/04/23 Georg Feil Cleaned up, added comments. X X| Declare 'first' symbol in bss area X| *** Note gdb bug: .globl statment before lcomm doesn't work! X .lcomm _stevie_edata,4 X .globl _stevie_edata X.data X .even X| Declare 'first' symbol in data area X .globl _stevie_etext X_stevie_etext: Xinit: X .long 0 | flag shows whether initialized data area X | has been copied (!=0 means yes) X | Value is start of malloc data area. X.text X .even X .globl _stevie_start X_stevie_start: X| clear uninitialized data area (bss) (incorrect, so removed): X| lea _edata,a3 | this is wrong (actually gets VxWorks _edata) X| lea _end,a4 | this is wrong (actually gets VxWorks _end) X| jra L6 X|L5: X| X| clrw a3@+ X|L6: X| cmpl a4,a3 X| jcs L5 X X| Copy initialized data area to save (1st time) or restore it (other times). X| (gets copied after end of uninitilaized data (bss)) X| Uses malloc() to obtain storage space. X lea _stevie_edata,a2 X lea _stevie_etext,a3 X movel init,a4 X tstl init X jne Lb2 X movel a2,d0 | compute size of initialized data region X subl a3,d0 X movel d0,sp@- X jbsr _malloc | malloc() enough memory to hold it X addqw #4,sp | pop malloc parm from stack X tstl d0 X jne Lb100 X rts | malloc() error (returned NULL), exit immediately XLb100: X movel d0,init | save malloc() address in init. X movel d0,a4 X jra Lb5 XLb6: X movew a3@+,a4@+ | save initialized data XLb5: X cmpl a2,a3 X jcs Lb6 X jra Lb7 XLb11: X movew a4@+,a3@+ | restore initialized data XLb2: X cmpl a2,a3 X jcs Lb11 XLb7: X X| Jump to main(): X jmp _main END_OF_FILE if test 2469 -ne `wc -c <'stevie/crt0.s'`; then echo shar: \"'stevie/crt0.s'\" unpacked with wrong size! fi # end of 'stevie/crt0.s' fi if test -f 'stevie/ctags.doc' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/ctags.doc'\" else echo shar: Extracting \"'stevie/ctags.doc'\" \(994 characters\) sed "s/^X//" >'stevie/ctags.doc' <<'END_OF_FILE' 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 END_OF_FILE if test 994 -ne `wc -c <'stevie/ctags.doc'`; then echo shar: \"'stevie/ctags.doc'\" unpacked with wrong size! fi # end of 'stevie/ctags.doc' fi if test -f 'stevie/dos_msc.mk' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/dos_msc.mk'\" else echo shar: Extracting \"'stevie/dos_msc.mk'\" \(1809 characters\) sed "s/^X//" >'stevie/dos_msc.mk' <<'END_OF_FILE' X# X# Makefile for DOS X# X# Microsoft make is brain-dead, so please bear with me. X# X X# X# Compact model lets us edit large files, but keep small model code X# XMODEL= /AC XCFLAGS = $(MODEL) /DDOS X XMACH= dos.obj X XOBJ= alloc.obj \ X main.obj \ X cmdline.obj \ X edit.obj \ X enveval.obj \ X fileio.obj \ X help.obj \ X hexchars.obj \ X linefunc.obj \ X mark.obj \ X misccmds.obj \ X normal.obj \ X ops.obj \ X param.obj \ X ptrfunc.obj \ X regexp.obj \ X regsub.obj \ X screen.obj \ X search.obj \ X sentence.obj \ X tagcmd.obj \ X undo.obj \ X version.obj \ X $(MACH) X Xall: stevie.exe X Xalloc.obj : alloc.c X cl -c $(CFLAGS) alloc.c X Xcmdline.obj : cmdline.c X cl -c $(CFLAGS) cmdline.c X Xedit.obj : edit.c X cl -c $(CFLAGS) edit.c X Xenveval.obj : enveval.c X cl -c $(CFLAGS) enveval.c X Xfileio.obj : fileio.c X cl -c $(CFLAGS) fileio.c X Xhelp.obj : help.c X cl -c $(CFLAGS) help.c X Xhexchars.obj : hexchars.c X cl -c $(CFLAGS) hexchars.c X Xlinefunc.obj : linefunc.c X cl -c $(CFLAGS) linefunc.c X Xmain.obj: main.c X cl -c $(CFLAGS) main.c X Xmark.obj : mark.c X cl -c $(CFLAGS) mark.c X Xmisccmds.obj : misccmds.c X cl -c $(CFLAGS) misccmds.c X Xnormal.obj : normal.c X cl -c $(CFLAGS) normal.c X Xops.obj : ops.c X cl -c $(CFLAGS) ops.c X Xparam.obj : param.c X cl -c $(CFLAGS) param.c X Xptrfunc.obj : ptrfunc.c X cl -c $(CFLAGS) ptrfunc.c X Xregexp.obj : regexp.c X cl -c $(CFLAGS) regexp.c X Xregsub.obj : regsub.c X cl -c $(CFLAGS) regsub.c X Xscreen.obj : screen.c X cl -c $(CFLAGS) screen.c X Xsearch.obj : search.c X cl -c $(CFLAGS) search.c X Xsentence.obj : sentence.c X cl -c $(CFLAGS) sentence.c X Xtagcmd.obj : tagcmd.c X cl -c $(CFLAGS) tagcmd.c X Xundo.obj : undo.c X cl -c $(CFLAGS) undo.c X Xversion.obj : version.c X cl -c $(CFLAGS) version.c X Xdos.obj : dos.c X cl -c $(CFLAGS) dos.c X Xstevie.exe : $(OBJ) X cl $(MODEL) *.obj c:\pmsdk\lib\setargv.obj -o stevie.exe /F 6000 -link /NOE END_OF_FILE if test 1809 -ne `wc -c <'stevie/dos_msc.mk'`; then echo shar: \"'stevie/dos_msc.mk'\" unpacked with wrong size! fi # end of 'stevie/dos_msc.mk' fi if test -f 'stevie/dos_tc.mk' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/dos_tc.mk'\" else echo shar: Extracting \"'stevie/dos_tc.mk'\" \(2210 characters\) sed "s/^X//" >'stevie/dos_tc.mk' <<'END_OF_FILE' X# X# Makefile for MSDOS using Turbo C and any GOOD make program. X# (Like, forget Microsoft Make; it's a joke. Use Turbo Make - comes with TC, X# or NDMAKE - shareware, or PolyMake - from Polytron. There are others...) X# X XMODEL= -mc XDEFS= -DDOS -DTURBOC -DTAGSTACK XCFLAGS= $(MODEL) $(DEFS) XCC= tcc X XPROGS= alloc.c \ X cmdline.c \ X ctags.c \ X dos.c \ X edit.c \ X enveval.c \ X fileio.c \ X help.c \ X hexchars.c \ X linefunc.c \ X main.c \ X mark.c \ X minix.c \ X misccmds.c \ X normal.c \ X ops.c \ X os2.c \ X param.c \ X ptrfunc.c \ X regexp.c \ X regsub.c \ X screen.c \ X search.c \ X sentence.c \ X setenv.c \ X tagcmd.c \ X term.c \ X tos.c \ X undo.c \ X unix.c \ X version.c X XHDRS= ascii.h \ X env.h \ X keymap.h \ X ops.h \ X param.h \ X regexp.h \ X regmagic.h \ X stevie.h \ X term.h X XMKFS= dos_msc.mk \ X dos_tc.mk \ X minix.mk \ X os2.mk \ X tos.mk \ X unix.mk X XMACH= dos.obj X XOBJ= alloc.obj \ X cmdline.obj \ X edit.obj \ X enveval.obj. \ X fileio.obj \ X help.obj \ X hexchars.obj \ X linefunc.obj \ X main.obj \ X mark.obj \ X misccmds.obj \ X normal.obj \ X ops.obj \ X param.obj \ X ptrfunc.obj \ X screen.obj \ X search.obj \ X sentence.obj \ X tagcmd.obj \ X term.obj \ X undo.obj \ X version.obj X XOTHER= regexp.obj regsub.obj \tc\lib\wildargs.obj X X.c.obj : X $(CC) -c $(CFLAGS) $* X Xall : stevie.exe stevie.doc X Xstevie.exe : $(OBJ) $(MACH) $(OTHER) X $(CC) -estevie $(OBJ) $(MACH) $(OTHER) X Xctags.exe : ctags.c X $(CC) ctags.c X Xsetenv.exe : setenv.c X $(CC) setenv.c X Xstevie.doc : stevie.mm X nroff -rB1 -Tlp -mm stevie.mm > stevie.doc X Xclean : X rm $(OBJ) $(MACH) X X# Clean out the .OBJs that depend on whether BIOS is defined. Xcleanbios : X rm dos.obj screen.obj help.obj X X# Specific header dependencies. X X$(OBJ) : stevie.h env.h ascii.h keymap.h param.h term.h X$(MACH) : stevie.h env.h ascii.h keymap.h param.h term.h Xlinefunc.obj : ops.h Xnormal.obj : ops.h Xops.obj : ops.h Xregexp.obj : regexp.h regmagic.h ops.h Xregsub.obj : regexp.h regmagic.h Xsearch.obj : regexp.h Xsentence.obj : ops.h X X Xzip : stevi369.zip Xstevi369.zip : readme readme.dmt stevie.mm stevie.doc stevie.exe \ X ctags.exe setenv.exe source.zip X pkzip -u stevi369 $? X Xsource.zip : $(PROGS) $(HDRS) $(MKFS) porting.doc source.doc stevie.prj X pkzip -u source $? X END_OF_FILE if test 2210 -ne `wc -c <'stevie/dos_tc.mk'`; then echo shar: \"'stevie/dos_tc.mk'\" unpacked with wrong size! fi # end of 'stevie/dos_tc.mk' fi if test -f 'stevie/enveval.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/enveval.c'\" else echo shar: Extracting \"'stevie/enveval.c'\" \(2424 characters\) sed "s/^X//" >'stevie/enveval.c' <<'END_OF_FILE' X/* X * Evaluate a string, expanding environment variables X * where encountered. X * We'll use the UNIX convention for representing environment X * variables: $xxx, where xxx is the shortest string that X * matches some environment variable. X */ X X#include X#include X Xchar *getenv(); X Xint XEnvEval (s, len) X char *s; X int len; X/*------------------------------------------------------------------ X * s= Pointer to buffer, currently containing string. It will be X * expanded in-place in the buffer. X * len=Maximum allowable length of the buffer. (In this version, we X * use a static buffer of 256 bytes internally.) X * X * RETURNS: X * 0 on success. X * -1 on failure. In this case, s may contain a partially X * converted string, but it won't contain a partial X * string. It will be the FULL string, with as X * many substitutions as we could find. X */ X X{ X#define LEN 256 X char buf [LEN]; X char *s1, *s2; X char *b1; X int done=0; X X if (len > LEN) X return (-1); X X s1 = s; X X /* Check for '$', and expand when we find one. */ X while (!done) { X if ((s1 = (char*)strchr (s1, '$')) == NULL) X done = 1; X else { X /* X * Here's where the real work gets done. X * We'll find the env.var., and convert X * it into buf, then copy back into s X * and continue. X */ X char c; X int need, got; X X /* Test successively longer strings, to see X * if they're env.vars. X */ X for (s2=++s1+1; ; s2++) { X c = *s2; /* save it */ X *s2 = '\0'; X b1 = getenv (s1); X *s2 = c; /* restore it */ X if (b1) /* found it */ X break; X if (!*s2) /* nothing to try */ X goto Failed; X } X --s1; /* Back to the '$' */ X X /* OK, we've found one (between s1 & s2, X * non-inclusive). Its value is in b1. X * Do the substitution into bufp, X * and copy back into s. X */ X need = strlen(b1) + strlen(s2) + 1; X got = len - (s1-s); X if (need > got) X goto Failed; X strcpy (buf, b1); X strcat (buf, s2); X strcpy (s1, buf); X } X } X X /* If we get here, the converted value is in s */ X return (0); X X Failed: X return (-1); X} X X X/* #define SAMPLE */ X#ifdef SAMPLE /***************************************************/ X Xmain (int argc, char **argv) X{ X int i, ret; X X for (i=1; i'stevie/h/assert.h' <<'END_OF_FILE' X/* Allow this file to be included multiple times X with different settings of NDEBUG. */ X#undef assert X#undef __assert X X#ifdef NDEBUG X#define assert(ignore) X#else X X#define assert(expression) \ X ((expression) ? 0 : __assert (#expression, __FILE__, __LINE__)) X Xvoid __eprintf (); /* Defined in gnulib */ X X#ifdef __STDC__ X X#define __assert(expression, file, line) \ X (fprintf (stderr,"Failed assertion " expression \ X " at line %d of `" file "'.\n", line), \ X exit(1)) X X#else /* no __STDC__; i.e. -traditional. */ X X#define __assert(expression, file, line) \ X (fprintf (stderr,"Failed assertion at line %d of `%s'.\n", line, file),\ X exit(1)) X X#endif /* no __STDC__; i.e. -traditional. */ X X#endif END_OF_FILE if test 715 -ne `wc -c <'stevie/h/assert.h'`; then echo shar: \"'stevie/h/assert.h'\" unpacked with wrong size! fi # end of 'stevie/h/assert.h' fi if test -f 'stevie/h/stdio.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/h/stdio.h'\" else echo shar: Extracting \"'stevie/h/stdio.h'\" \(117 characters\) sed "s/^X//" >'stevie/h/stdio.h' <<'END_OF_FILE' X#include X#include X X#ifndef VX_OK X# define VX_OK 0 X# define VX_ERROR (-1) X#endif not VX_OK END_OF_FILE if test 117 -ne `wc -c <'stevie/h/stdio.h'`; then echo shar: \"'stevie/h/stdio.h'\" unpacked with wrong size! fi # end of 'stevie/h/stdio.h' fi if test -f 'stevie/h/string.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/h/string.h'\" else echo shar: Extracting \"'stevie/h/string.h'\" \(20 characters\) sed "s/^X//" >'stevie/h/string.h' <<'END_OF_FILE' X#include END_OF_FILE if test 20 -ne `wc -c <'stevie/h/string.h'`; then echo shar: \"'stevie/h/string.h'\" unpacked with wrong size! fi # end of 'stevie/h/string.h' fi if test -f 'stevie/kbhit.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/kbhit.c'\" else echo shar: Extracting \"'stevie/kbhit.c'\" \(1027 characters\) sed "s/^X//" >'stevie/kbhit.c' <<'END_OF_FILE' X#include X#include X X Xint kbhit(void) X/* X * This function allows users to test if keyboard input (from stdin) is X * available without actually performing a read, useful for "non-blocking" X * keyboard I/O. Just a short form for fkbhit(stdin). X */ X{ X return(fkbhit(stdin)); X} X Xint fkbhit(FILE* stream) X/* X * Check if there is something to be read from a given stream. We check 2 X * things: the byte count in the stdio buffer, and the byte count in the X * I/O system's buffer. X */ X{ X STATUS code; X long int bytes_avail; X X if (stream->count>0) X return(TRUE); X X code=ioctl(fileno(stream),FIONREAD, (int) &bytes_avail); X X return(code==VX_OK && bytes_avail>0); X} X Xint fdkbhit(int fd) X/* X * Check if there is something to be read from a given file descriptor. X * Unlike fkbhit(), we need check only one thing: the byte count in the I/O X * system's buffer. X */ X{ X STATUS code; X long int bytes_avail; X X code=ioctl(fd,FIONREAD, (int) &bytes_avail); X X return(code==VX_OK && bytes_avail>0); X} X END_OF_FILE if test 1027 -ne `wc -c <'stevie/kbhit.c'`; then echo shar: \"'stevie/kbhit.c'\" unpacked with wrong size! fi # end of 'stevie/kbhit.c' fi if test -f 'stevie/keymap.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/keymap.h'\" else echo shar: Extracting \"'stevie/keymap.h'\" \(934 characters\) sed "s/^X//" >'stevie/keymap.h' <<'END_OF_FILE' X/* X * $Header: /nw/tony/src/stevie/src/RCS/keymap.h,v 1.2 89/03/11 22:42:30 tony Exp $ X * X * Keycode definitions for special keys X * X * On systems that have any of these keys, the routine 'inchar' in the X * machine-dependent code should return one of the codes here. X */ X X#define K_HELP 0x80 X#define K_UNDO 0x81 X#define K_INSERT 0x82 X#define K_HOME 0x83 X#define K_UARROW 0x84 X#define K_DARROW 0x85 X#define K_LARROW 0x86 X#define K_RARROW 0x87 X#define K_CCIRCM 0x88 /* control-circumflex */ X X#define K_F1 0x91 /* function keys */ X#define K_F2 0x92 X#define K_F3 0x93 X#define K_F4 0x94 X#define K_F5 0x95 X#define K_F6 0x96 X#define K_F7 0x97 X#define K_F8 0x98 X#define K_F9 0x99 X#define K_F10 0x9a X X#define K_SF1 0xa1 /* shifted function keys */ X#define K_SF2 0xa2 X#define K_SF3 0xa3 X#define K_SF4 0xa4 X#define K_SF5 0xa5 X#define K_SF6 0xa6 X#define K_SF7 0xa7 X#define K_SF8 0xa8 X#define K_SF9 0xa9 X#define K_SF10 0xaa END_OF_FILE if test 934 -ne `wc -c <'stevie/keymap.h'`; then echo shar: \"'stevie/keymap.h'\" unpacked with wrong size! fi # end of 'stevie/keymap.h' fi if test -f 'stevie/mark.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/mark.c'\" else echo shar: Extracting \"'stevie/mark.c'\" \(2186 characters\) sed "s/^X//" >'stevie/mark.c' <<'END_OF_FILE' X/* $Header: /nw/tony/src/stevie/src/RCS/mark.c,v 1.3 89/03/11 22:42:39 tony Exp $ X * X * Routines to save and retrieve marks. X */ X X#include "stevie.h" X X#define NMARKS 10 /* max. # of marks that can be saved */ X Xstruct mark { X char name; X LPTR pos; X}; X Xstatic struct mark mlist[NMARKS]; Xstatic struct mark pcmark; /* previous context mark */ Xstatic bool_t pcvalid = FALSE; /* true if pcmark is valid */ X X/* X * setmark(c) - set mark 'c' at current cursor position X * X * Returns TRUE on success, FALSE if no room for mark or bad name given. X */ Xbool_t Xsetmark(c) Xregister char c; X{ X register int i; X X if (!isalpha(c)) X return FALSE; X X /* X * If there is already a mark of this name, then just use the X * existing mark entry. X */ X for (i=0; i < NMARKS ;i++) { X if (mlist[i].name == c) { X mlist[i].pos = *Curschar; X return TRUE; X } X } X X /* X * There wasn't a mark of the given name, so find a free slot X */ X for (i=0; i < NMARKS ;i++) { X if (mlist[i].name == NUL) { /* got a free one */ X mlist[i].name = c; X mlist[i].pos = *Curschar; X return TRUE; X } X } X return FALSE; X} X X/* X * setpcmark() - set the previous context mark to the current position X */ Xvoid Xsetpcmark() X{ X pcmark.pos = *Curschar; X pcvalid = TRUE; X} X X/* X * getmark(c) - find mark for char 'c' X * X * Return pointer to LPTR or NULL if no such mark. X */ XLPTR * Xgetmark(c) Xregister char c; X{ X register int i; X X if (c == '\'' || c == '`') /* previous context mark */ X return pcvalid ? &(pcmark.pos) : (LPTR *) NULL; X X for (i=0; i < NMARKS ;i++) { X if (mlist[i].name == c) X return &(mlist[i].pos); X } X return (LPTR *) NULL; X} X X/* X * clrall() - clear all marks X * X * Used mainly when trashing the entire buffer during ":e" type commands X */ Xvoid Xclrall() X{ X register int i; X X for (i=0; i < NMARKS ;i++) X mlist[i].name = NUL; X pcvalid = FALSE; X} X X/* X * clrmark(line) - clear any marks for 'line' X * X * Used any time a line is deleted so we don't have marks pointing to X * non-existent lines. X */ Xvoid Xclrmark(line) Xregister LINE *line; X{ X register int i; X X for (i=0; i < NMARKS ;i++) { X if (mlist[i].pos.linep == line) X mlist[i].name = NUL; X } X if (pcvalid && (pcmark.pos.linep == line)) X pcvalid = FALSE; X} END_OF_FILE if test 2186 -ne `wc -c <'stevie/mark.c'`; then echo shar: \"'stevie/mark.c'\" unpacked with wrong size! fi # end of 'stevie/mark.c' fi if test -f 'stevie/minix.mk' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/minix.mk'\" else echo shar: Extracting \"'stevie/minix.mk'\" \(488 characters\) sed "s/^X//" >'stevie/minix.mk' <<'END_OF_FILE' X# X# Makefile for Atari ST Minix X# X XLDFLAGS= XCFLAGS= -O X XMACH= minix.o X XOBJ= alloc.o \ X cmdline.o \ X edit.o \ X enveval.o \ X fileio.o \ X help.o \ X hexchars.o \ X linefunc.o \ X main.o \ X mark.o \ X misccmds.o \ X normal.o \ X ops.o \ X param.o \ X ptrfunc.o \ X regexp.o \ X regsub.o \ X screen.o \ X search.o \ X sentence.o \ X tagcmd.o \ X term.o \ X undo.o \ X version.o X Xall : stevie X Xstevie : $(OBJ) $(MACH) X $(CC) $(LDFLAGS) $(OBJ) $(MACH) -o stevie X chmem =150000 stevie X Xclean : X rm $(OBJ) $(MACH) END_OF_FILE if test 488 -ne `wc -c <'stevie/minix.mk'`; then echo shar: \"'stevie/minix.mk'\" unpacked with wrong size! fi # end of 'stevie/minix.mk' fi if test -f 'stevie/ops.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/ops.h'\" else echo shar: Extracting \"'stevie/ops.h'\" \(1382 characters\) sed "s/^X//" >'stevie/ops.h' <<'END_OF_FILE' X/* $Header: /nw/tony/src/stevie/src/RCS/ops.h,v 1.2 89/07/19 08:08:21 tony Exp $ X * X * Macros and declarations for the operator code in ops.c X */ X X/* X * Operators X */ X#define NOP 0 /* no pending operation */ X#define DELETE 1 X#define YANK 2 X#define CHANGE 3 X#define LSHIFT 4 X#define RSHIFT 5 X#define FILTER 6 X#define TILDE 7 X Xextern int operator; /* current pending operator */ X X/* X * When a cursor motion command is made, it is marked as being a character X * or line oriented motion. Then, if an operator is in effect, the operation X * becomes character or line oriented accordingly. X * X * Character motions are marked as being inclusive or not. Most char. X * motions are inclusive, but some (e.g. 'w') are not. X */ X X/* X * Cursor motion types X */ X#define MBAD (-1) /* 'bad' motion type marks unusable yank buf */ X#define MCHAR 0 X#define MLINE 1 X Xextern int mtype; /* type of the current cursor motion */ Xextern bool_t mincl; /* true if char motion is inclusive */ X Xextern LPTR startop; /* cursor pos. at start of operator */ X X/* X * Macro to get current character from a LPTR * value. X * Evaluates to '\0' if pointer is null. X */ X#define CHAR( lpp ) (lpp ? lpp->linep->s[lpp->index] : '\0') X X/* X * Functions defined in ops.c X */ Xvoid doshift(), dodelete(), doput(), dochange(), dofilter(); X#ifdef TILDEOP Xvoid dotilde(); X#endif Xbool_t dojoin(), doyank(); Xvoid startinsert(); END_OF_FILE if test 1382 -ne `wc -c <'stevie/ops.h'`; then echo shar: \"'stevie/ops.h'\" unpacked with wrong size! fi # end of 'stevie/ops.h' fi if test -f 'stevie/os2.mk' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/os2.mk'\" else echo shar: Extracting \"'stevie/os2.mk'\" \(1696 characters\) sed "s/^X//" >'stevie/os2.mk' <<'END_OF_FILE' X# X# Makefile for OS/2 X# X# The make command with OS/2 is really stupid. X# X X# X# Compact model lets us edit large files, but keep small model code X# XMODEL= /AC XCFLAGS = $(MODEL) X XMACH= os2.obj X XOBJ= alloc.obj \ X cmdline.obj \ X edit.obj \ X envevla.obj \ X fileio.obj \ X help.obj \ X hexchars.obj \ X linefunc.obj \ X main.obj \ X mark.obj \ X misccmds.obj \ X normal.obj \ X ops.obj \ X param.obj \ X ptrfunc.obj \ X screen.obj \ X search.obj \ X sentence.obj \ X tagcmd.obj \ X undo.obj \ X version.obj \ X $(MACH) X Xalloc.obj : alloc.c X cl -c $(CFLAGS) alloc.c X Xcmdline.obj : cmdline.c X cl -c $(CFLAGS) cmdline.c X Xedit.obj : edit.c X cl -c $(CFLAGS) edit.c X Xfileio.obj : fileio.c X cl -c $(CFLAGS) fileio.c X Xhexchars.obj : hexchars.c X cl -c $(CFLAGS) hexchars.c X Xlinefunc.obj : linefunc.c X cl -c $(CFLAGS) linefunc.c X Xmain.obj: main.c X cl -c $(CFLAGS) main.c X Xmark.obj : mark.c X cl -c $(CFLAGS) mark.c X Xmisccmds.obj : misccmds.c X cl -c $(CFLAGS) misccmds.c X Xnormal.obj : normal.c X cl -c $(CFLAGS) normal.c X Xhelp.obj : help.c X cl -c $(CFLAGS) help.c X Xops.obj : ops.c X cl -c $(CFLAGS) ops.c X Xparam.obj : param.c X cl -c $(CFLAGS) param.c X Xptrfunc.obj : ptrfunc.c X cl -c $(CFLAGS) ptrfunc.c X Xregexp.obj : regexp.c X cl -c $(CFLAGS) regexp.c X Xregsub.obj : regsub.c X cl -c $(CFLAGS) regsub.c X Xscreen.obj : screen.c X cl -c $(CFLAGS) screen.c X Xsearch.obj : search.c X cl -c $(CFLAGS) search.c X Xsentence.obj : sentence.c X cl -c $(CFLAGS) sentence.c X Xtagcmd.obj : tagcmd.c X cl -c $(CFLAGS) tagcmd.c X Xundo.obj : undo.c X cl -c $(CFLAGS) undo.c X Xversion.obj : version.c X cl -c $(CFLAGS) version.c X Xos2.obj : os2.c X cl -c $(CFLAGS) os2.c X Xstevie.exe : $(OBJ) X cl $(MODEL) *.obj \pmsdk\lib\setargv.obj -o stevie.exe /F 6000 -link /NOE END_OF_FILE if test 1696 -ne `wc -c <'stevie/os2.mk'`; then echo shar: \"'stevie/os2.mk'\" unpacked with wrong size! fi # end of 'stevie/os2.mk' fi if test -f 'stevie/param.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/param.h'\" else echo shar: Extracting \"'stevie/param.h'\" \(1559 characters\) sed "s/^X//" >'stevie/param.h' <<'END_OF_FILE' X/* $Header: /nw/tony/src/stevie/src/RCS/param.h,v 1.8 89/08/02 10:59:35 tony Exp $ X * X * Settable parameters X */ X Xstruct param { X char *fullname; /* full parameter name */ X char *shortname; /* permissible abbreviation */ X int value; /* parameter value */ X int flags; X}; X Xextern struct param params[]; X X/* X * Flags X */ X#define P_BOOL 0x01 /* the parameter is boolean */ X#define P_NUM 0x02 /* the parameter is numeric */ X#define P_CHANGED 0x04 /* the parameter has been changed */ X X/* X * The following are the indices in the params array for each parameter X */ X X/* X * Numeric parameters X */ X#define P_TS 0 /* tab size */ X#define P_SS 1 /* scroll size */ X#define P_RP 2 /* report */ X#define P_LI 3 /* lines */ X X/* X * Boolean parameters X */ X#define P_VB 4 /* visual bell */ X#define P_SM 5 /* showmatch */ X#define P_WS 6 /* wrap scan */ X#define P_EB 7 /* error bells */ X#define P_MO 8 /* show mode */ X#define P_BK 9 /* make backups when writing out files */ X#define P_CR 10 /* use cr-lf to terminate lines on writes */ X#define P_LS 11 /* show tabs and newlines graphically */ X#define P_IC 12 /* ignore case in searches */ X#define P_AI 13 /* auto-indent */ X#define P_NU 14 /* number lines on the screen */ X#define P_ML 15 /* enables mode-lines processing */ X#define P_TO 16 /* if true, tilde is an operator */ X#define P_TE 17 /* ignored; here for compatibility */ X#define P_TG 18 /* enables stacking of tag calls */ X#define P_CO 19 /* color/attribute setting */ X X/* X * Macro to get the value of a parameter X */ X#define P(n) (params[n].value) END_OF_FILE if test 1559 -ne `wc -c <'stevie/param.h'`; then echo shar: \"'stevie/param.h'\" unpacked with wrong size! fi # end of 'stevie/param.h' fi if test -f 'stevie/porting.doc' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/porting.doc'\" else echo shar: Extracting \"'stevie/porting.doc'\" \(2368 characters\) sed "s/^X//" >'stevie/porting.doc' <<'END_OF_FILE' X X Release Notes for STEVIE - Version 3.68 X X Atari ST Editor for VI Enthusiasts X X Porting X X X Tony Andrews X X 8/6/88 X X X Porting the editor is a relatively simple task. Most of the Xcode is pretty machine-independent. For each environment, there is Xa file of routines that perform various low-level operations that Xtend to vary a lot from one machine to another. Another file contains Xthe escape sequences to be used for each machine. X X The machine-dependent files currently used are: X Xtos.c: Atari ST running TOS Xunix.c: UNIX System V or BSD Xos2.c: Microsoft OS/2 Xdos.c: MS DOS 3.3 Xminix.c: Minix on the Atari ST X X X Each of these files are around 250 lines long and deal with Xlow-level issues like character I/O to the terminal, terminal Xinitialization, signal handling (if supported), cursor addressing, and Xso on. There are different tradeoffs to be made depending on the Xenvironment. For example, the UNIX and Minix versions buffer terminal Xoutput because of the relatively high overhead of system calls. A quick Xlook at the files will make it clear what needs to be done in a new Xenvironment. X X The file "env.h" contains macro definitions to customize the Xeditor for your particular environment. The macros there select the Xmachine/os, enable various optional features, etc. X X One of the options in env.h is whether to use the termcap Xroutines or hard-wired escape sequences. The hard-wired sequences, Xif used, are defined in term.h. The file term.c contains code to access Xthe termcap database, if enabled. Termcap is only supported by some of Xthe system-dependent files (unix.c and minix.c) but can be added easily Xto others, if needed. X X X The basic process for doing a new port is: X X 1. Come up with a macro name to use when ifdef'ing your system- X specific changes. Add a line to 'env.h' to define the macro X name you've chosen. X X 2. Look at the system-dependent files and copy the one that comes X closest to working on your system. Then modify your new file X as needed. X X 3. Look at term.h and edit the file appropriately adding a new X set of escape sequence definitions for your system. X X 4. Compile and debug the editor. X X X In most cases it should really be that simple. Other ports have Xbeen done for which I don't have the code, including the Amiga, and a XData General machine of some kind (in Australia). END_OF_FILE if test 2368 -ne `wc -c <'stevie/porting.doc'`; then echo shar: \"'stevie/porting.doc'\" unpacked with wrong size! fi # end of 'stevie/porting.doc' fi if test -f 'stevie/regexp.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/regexp.h'\" else echo shar: Extracting \"'stevie/regexp.h'\" \(1167 characters\) sed "s/^X//" >'stevie/regexp.h' <<'END_OF_FILE' 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 * Definitions etc. for regexp(3) routines. X * X * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof], X * not the System V one. X */ X#define NSUBEXP 10 Xtypedef struct regexp { X char *startp[NSUBEXP]; X char *endp[NSUBEXP]; X char regstart; /* Internal use only. */ X char reganch; /* Internal use only. */ X char *regmust; /* Internal use only. */ X int regmlen; /* Internal use only. */ X char program[1]; /* Unwarranted chumminess with compiler. */ X} regexp; X Xextern regexp *regcomp(); Xextern int regexec(); Xextern void regsub(); Xextern void regerror(); X X#ifndef ORIGINAL Xextern int reg_ic; /* set non-zero to ignore case in searches */ X#endif END_OF_FILE if test 1167 -ne `wc -c <'stevie/regexp.h'`; then echo shar: \"'stevie/regexp.h'\" unpacked with wrong size! fi # end of 'stevie/regexp.h' fi if test -f 'stevie/regmagic.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/regmagic.h'\" else echo shar: Extracting \"'stevie/regmagic.h'\" \(655 characters\) sed "s/^X//" >'stevie/regmagic.h' <<'END_OF_FILE' 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 * The first byte of the regexp internal "program" is actually this magic X * number; the start node begins in the second byte. X */ X#define MAGIC 0234 END_OF_FILE if test 655 -ne `wc -c <'stevie/regmagic.h'`; then echo shar: \"'stevie/regmagic.h'\" unpacked with wrong size! fi # end of 'stevie/regmagic.h' fi if test -f 'stevie/sleep.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/sleep.c'\" else echo shar: Extracting \"'stevie/sleep.c'\" \(600 characters\) sed "s/^X//" >'stevie/sleep.c' <<'END_OF_FILE' X#include X#include X#include X XSTATUS sleep(secs) Xunsigned secs; X/* X * This function delays the calling task by an integral number of seconds. X */ X{ X return(taskDelay(secs*sysClkRateGet())); X} X XSTATUS usleep(usecs) Xunsigned usecs; X/* X * This function delays the calling task by a number of microseconds. X * It has a resolution determined by the system tick, normally 60 Hz. X * Therefore a time in microseconds least as long as one system tick X * (i.e. 16667 us) must be specified for any delay to occur. X */ X{ X return(taskDelay(usecs*sysClkRateGet()/1000000)); X} END_OF_FILE if test 600 -ne `wc -c <'stevie/sleep.c'`; then echo shar: \"'stevie/sleep.c'\" unpacked with wrong size! fi # end of 'stevie/sleep.c' fi if test -f 'stevie/tos.mk' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/tos.mk'\" else echo shar: Extracting \"'stevie/tos.mk'\" \(514 characters\) sed "s/^X//" >'stevie/tos.mk' <<'END_OF_FILE' X# X# Makefile for the Atari ST - Sozobon C Compiler X# X XCFLAGS = -O X X.c.o: X $(CC) -c $(CFLAGS) $< X ar rv vi.lib $*.o X XMACH = tos.o X XOBJ = alloc.o \ X cmdline.o \ X edit.o \ X enveval.o \ X fileio.o \ X help.o \ X hexchars.o \ X linefunc.o \ X main.o \ X mark.o \ X misccmds.o \ X normal.o \ X ops.o \ X param.o \ X ptrfunc.o \ X regexp.o \ X regsub.o \ X screen.o \ X search.o \ X sentence.o \ X tagcmd.o \ X undo.o \ X version.o \ X $(MACH) X Xall : stevie.ttp X Xstevie.ttp : $(OBJ) X $(CC) vi.lib -o stevie.ttp X Xclean : X $(RM) $(OBJ) vi.lib END_OF_FILE if test 514 -ne `wc -c <'stevie/tos.mk'`; then echo shar: \"'stevie/tos.mk'\" unpacked with wrong size! fi # end of 'stevie/tos.mk' fi if test -f 'stevie/unix.mk' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stevie/unix.mk'\" else echo shar: Extracting \"'stevie/unix.mk'\" \(837 characters\) sed "s/^X//" >'stevie/unix.mk' <<'END_OF_FILE' X# X# Makefile for UNIX (System V) X# X XLDFLAGS= XCFLAGS= -g -traditional XCC= gcc X XH= ascii.h \ X env.h \ X keymap.h \ X ops.h \ X param.h \ X regexp.h \ X regmagic.h \ X stevie.h \ X term.h X XMACH= unix.o X XOBJ= alloc.o \ X cmdline.o \ X edit.o \ X enveval.o \ X fileio.o \ X help.o \ X hexchars.o \ X linefunc.o \ X main.o \ X mark.o \ X misccmds.o \ X normal.o \ X ops.o \ X param.o \ X ptrfunc.o \ X regexp.o \ X regsub.o \ X screen.o \ X search.o \ X sentence.o \ X tagcmd.o \ X term.o \ X undo.o \ X version.o X XSRC= $(OBJ:.o=.c) $(MACH:.o=.c) X Xall : stevie X Xstevie : $(OBJ) $(MACH) X $(CC) $(LDFLAGS) $(OBJ) $(MACH) -o stevie -ltermlib X Xlint : X lint $(SRC) X Xtags : X ctags $(SRC) $(H) X Xstevie.doc : stevie.mm X nroff -rB1 -Tlp -mm stevie.mm > stevie.doc X Xprint : X @pr $(H) $(SRC) X Xcflow : X cflow $(SRC) > cflow.for X cflow -r $(SRC) > cflow.rev X Xclean : X rm $(OBJ) $(MACH) END_OF_FILE if test 837 -ne `wc -c <'stevie/unix.mk'`; then echo shar: \"'stevie/unix.mk'\" unpacked with wrong size! fi # end of 'stevie/unix.mk' fi echo shar: End of archive 1 \(of 13\). cp /dev/null ark1isdone 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