Initial commit of merged but untouched source from

Tom Almy on 2015-05-29
main
Blake McBride 2015-05-30 10:04:47 -05:00
commit 0e17d45276
224 changed files with 54618 additions and 0 deletions

7
.gitignore vendored 100644
View File

@ -0,0 +1,7 @@
*.o
*.obj
*~
*.bak
*.exe

1
bin/Make 120000
View File

@ -0,0 +1 @@
tecoc

1
bin/inspect 120000
View File

@ -0,0 +1 @@
tecoc

1
bin/inspect.bat 100644
View File

@ -0,0 +1 @@
tecoc teco/inspect %$

1
bin/inspect.cmd 100644
View File

@ -0,0 +1 @@
tecoc teco/inspect %$

1
bin/mung 120000
View File

@ -0,0 +1 @@
tecoc

1
bin/mung.bat 100644
View File

@ -0,0 +1 @@
tecoc mung %$

1
bin/mung.cmd 100644
View File

@ -0,0 +1 @@
tecoc mung %$

1
bin/teco 120000
View File

@ -0,0 +1 @@
tecoc

1
bin/teco.bat 100644
View File

@ -0,0 +1 @@
tecoc teco %$

1
bin/teco.cmd 100644
View File

@ -0,0 +1 @@
tecoc teco %$

4
bin/tecocmd.btm 100644
View File

@ -0,0 +1,4 @@
alias teco tecoc teco/norename
alias inspect tecoc/inspect
alias mung tecoc mung
alias tmake tecoc make

1
bin/tmake.bat 100644
View File

@ -0,0 +1 @@
tecoc make %$

1
bin/tmake.cmd 100644
View File

@ -0,0 +1 @@
tecoc make %$

469
doc/aareadme.txt 100644
View File

@ -0,0 +1,469 @@
AAREADME.TXT
This directory contains TECO-C, a version of TECO written in C.
It was written in C so the author could move comfortably from VAX/VMS
to various other machines, including MicroVaxes, which couldn't execute
TECO-11 prior to VMS 5.0 because they don't support PDP-11 compatibility
mode. TECO32, distributed with v5.0, solved this problem.
TECO-C is meant to be a complete implementation of TECO as defined
by the Standard TECO User's Guide, which is in file TECO.DOC. There is no
manual for TECO-C itself, but the Standard TECO manual was the specification
for TECO-C, so it serves as an excellent manual. TECO-C departs from the
Standard manual in only a few places (like no video mode), listed in file
PROBLEMS.TXT. There is quick-and-dirty "wall chart" of all TECO commands
in file WCHART.TXT.
This version of TECO-C runs under VMX/VMS, MS-DOS, AmigaDOS and Unix
(SunOS, Ultrix and System V on a Data General Aviion). If you find bugs or
have any comments about TECO-C, please contact
Pete Siemsen Pete Siemsen
645 Ohio Avenue #302 University of Southern California
Long Beach, Ca. 90814 1020 West Jefferson Blvd.
Los Angeles, CA 90089-0251
(213) 433-3059 (home) (213) 740-7391 (work)
Internet: siemsen@usc.edu
The following sections describe how to use or build TECO-C for
different environments. The command line syntax is the same as the syntax
for TECO-11 command lines.
###########################################################################
U N D E R V A X / V M S
TECO-C was mostly developed under VAX/VMS. It compiles and links
using VAX C 3.1 under VMS version 5.3.
To set up: inspect and modify ZVLOGIN.COM and then add it to your
LOGIN.COM
To compile: inspect/edit ZVBLD.COM, then SUBMIT it
To link: use the "LT" command (defined in ZVLOGIN.COM)
To run: inspect/edit the symbol definitions in ZVLOGIN.COM
Note: TECO-C uses the same command line syntax as TECO32
###########################################################################
U N D E R M S - D O S
TECO-C compiles/links under Turbo C v2.00 under MS-DOS 4.01 and
Concurrent DOS 386 v3.0.
To build: run MAKE on MAKEFILE.TC. to build TECO from scratch say:
"make -fmakefile.tc -DALL". see MAKEFILE.TC for other make
-D options. also see MAKETECO.BAT.
To run: use TECO.BAT to edit a file or MUNG.BAT to run a macro,
for example: TECO filename.
###########################################################################
U N D E R U N I X
To compile and link: use the make utility on "makefile.sun" (for SunOS) or
"makefile.ulx" (for Ultrix) or "makefile.dg" (for System V Unix
on a Data General Aviion).
To run: define aliases and environment variables in your .cshrc file.
Here's an example, assuming my initialization file is named
.tecorc and it's in my home directory, and my macros are in a
directory named tecoc under my main directory. You'll have to
change the directory names, of course.
setenv TEC_INIT \$/home/sol/siemsen/.tecorc
setenv TEC_LIBRARY /home/sol/siemsen/tecoc/
alias te '/home/sol/siemsen/tecoc/tecoc teco -nocreate'
alias mung '/home/sol/siemsen/tecoc/tecoc mung'
alias tma '/home/sol/siemsen/tecoc/tecoc make'
After doing this, "te" runs tecoc.
Unix Command line
---- ------- ----
To make Unix users more comfortable, TECO-C uses Unix-like options syntax
instead of the familiar "/" style used under VAX/VMS. The options can be
abbreviated. They are (optional characters in square brackets):
-in[spect]
-noc[reate]
-noi[ni]
-nom[emory]
-sc[roll]
-scroll:nnn:SEEALL
do nnn,7:W and 1,3:W
-nop[age]
Don't separate input into pages. Instead, treat form feeds as
normal characters.
+nnn
where nnn is any number of digits. Go to line number nnn and set
nopage. Note this uses the UNIX end of line convention for use with
cc output &c. The non-unix line termination will still be used for
nL and other intrinsic TECO commands, this just controls the
starting line AT INVOCATION.
EZ Mode Control Flag
-- ---- ------- ----
To add functionality, TECO-C is sensitive to bits in an extra mode control
flag in addition to the standard ones. Bits in the EZ mode control flag are
used in different ways by different operating systems. Under Unix, bits in
the flag have the following meanings:
1 Mark Henderson, who did much of the Unix port, likes the way
VAX/VMS keeps versions of files. VMS appends a semicolon followed
by a version number to files, and has the PURGE command to clean
out old versions of files. If this bit is off, TECO-C will handle
file version numbers, appending the appropriate version number to
file names. Mark supplied a "purge" program (distributed with TECO-C)
for users of this feature. Setting this flag turns off the feature,
to make TECO-C function as expected by the average Unix user. This
flag is set by default.
8 I don't know what this flag does. It only makes sense when TECO-C
is compiled with CURSES support.
16 If set, when it's time to beep, use an audio beep, and if it fails,
then try a video flash. If clear, try a video flash, and if it
fails, use an audio beep. This bit works only if TECO-C was compiled
with CURSES support. This bit is off by default.
32 If set, and split screen scrolling mode is on (see the 7:W command),
TECO-C puts a line between the upper and lower scrolling regions.
If off, don't display a line. This bit works only if TECO-C was
compiled with CURSES support. This bit is off by default.
128 If set, don't stop on form feeds when reading. If clear, a form
fed in the input stream stops the read (the standard TECO style).
This bit is off by default.
256 If set, use Unix-style newline terminators. This means when files
are read in, carriage-returns are not added to the end of lines,
and when the user types the RETURN key, only a newline is entered
into the command line (usually a carriage-return/line-feed pair is
entered). Old macros (and old TECO users) may get confused if this
bit is set, but it's required if CURSES support is compiled into
TECO-C.
2048 If set, use a bottom-tee symbol instead of a diamond to indicate
the end-of-buffer. This bit works only if TECO-C was compiled with
CURSES support. This bit is off by default.
8192 If set, don't show CR in SCROLL mode (like standard TECO). If clear,
show CR (a graphics character indicating a carriage return) when in
SCROLL mode. This bit works only if TECO-C was compiled with CURSES
support. This bit is on by default.
Filename Memory
-------- ------
TECO tries to remember the last file edited by TECO, so that after you've
edited a file once, you can re-edit without having to type the file name
on the command line. TECO-C implements this under Unix by writing and reading
files named /tmp/tecoxxx.tmp, where "xxx" is the process id of the parent
process.
NOTE: There is another TECO in C, written by Matt Fichtenbaum, which
runs under Unix. It is part of the DECUS TECO Collection. Contact Pete
Siemsen at the above address for a copy.
###########################################################################
U N D E R A M I G A D O S
To compile and link: see makefile.ami, (note: it needs tecoc.lnk)
Comments from the author of the Amiga code:
I've completed my TECOC port to the Amiga. It has been tested on an
Amiga 1000 under AmigaDOS 1.3.2. My system configuration is:
68000 microprocessor
2.5 megs memory
80 meg hard drive
Old Amiga chip set
SAS Institute C for the Amiga version 5.10
TECO-C runs in the CLI window it was started from, and it should run
over a terminal hooked to an Amiga serial port as well.
Adding 'W' command stuff would probably best be done by one of the
termcap ports to the Amiga, however, TECO would have to handle
SIGWINCH-like events, unless it is modified to open it's own window of
a particular size without a resizing gadget. It wouldn't be to hard to
write a terminal driver for Amiga windows using hard-coded escape
sequences either, but then that would lose over a serial port.
EzFlag
------
The EZ flag is system-dependent. Under AmigaDOS, bits in the flag have the
following meanings:
128 If set, don't stop on form feeds when reading. If clear, a form
fed in the input stream stops the read (the standard TECO style).
This bit os off by default.
256 If set, use Unix-style newline terminators. This means when files
are read in, carriage-returns are not added to the end of lines,
and when the user types the RETURN key, only a newline is entered
into the command line (usually a carriage-return/line-feed pair is
entered). Old macros (and old TECO users) may get confused if this
bit is set, but it's required if CURSES support is compiled into
TECO-C.
###########################################################################
F I L E S
aareadme.txt this readme file
baksrc.c backwards search
bldstr.c build a string with string build constructs
change.tec change macro squished
change.tes change macro source. this macro allows you to
replace one string with another in a group of
files using match constructs.
changes.txt contains teco-c release notes starting from
version 1.00 (TVERSION = 100)
chmacs.h ctype.h for teco-c
clenup.c clean up before exiting teco-c
clpars.h command line parsing macro, created by genclp.c
clpars.tec command line parsing macro squished
clpars.tes command line parsing macro source
cmatch.c match character with match construct
date.tec date macro squished
date.tes date macro source. this macro displays the
date and time.
dchars.h define identifiers for control characters
deferr.h define identifiers for error messages
defext.h EXTERN decarations for global variables
detab.tec de-tabify macro squished
detab.tes de-tabify macro source. this macro converts
tabs to spaces
dir.tec "display directory" macro, in squished form
dir.tes "display directory" macro source. This macro simply
displays the directory. a wildcarded filename
in the edit buffer can control what is displayed.
docjr.c code common to ExeC, ExeJ, and ExeR
doeves.c work code for EV and ES
doflag.c changes a mode control flag (ED,EH,ES,ET,EU,EV,^X)
dscren.h terminal types for 0:W command
echoit.c display character in its printable form
err.c display teco-c's error messages
exea.c execute A
exeats.c execute at-sign @
exeb.c execute B
exebar.c execute |
exebsl.c execute backslash \
exec.c execute C
execcc.c execute control-caret ^^
execln.c execute colon modifiers : and ::
execom.c execute comma ,
execrt.c execute caret ^
execst.c execute a TECO command string
execta.c execute ^A
exectc.c execute ^C
exectd.c execute ^D
execte.c execute ^E
execti.c execute ^I
exectl.c execute ^L
exectn.c execute ^N
execto.c execute ^O
exectp.c execute ^P
exectq.c execute ^Q
exectr.c execute ^R
exects.c execute ^S
exectt.c execute ^T
exectu.c execute ^U
exectv.c execute ^V
exectw.c execute ^W
exectx.c execute ^X
execty.c execute ^Y
exectz.c execute ^Z
exed.c execute D
exedgt.c execute digit (0-9)
exedot.c execute dot .
exedqu.c execute double quote "
exee.c execute E
exeequ.c execute equals =, ==, and ===
exeesc.c execute escape
exeexc.c execute exclamation point !
exeey.c execute EY
exef.c execute F
exefb.c execute FB
exeg.c execute G
exegtr.c execute greater than sign >
exeh.c execute H
exei.c execute I
exeill.c "execute" illegal command
exej.c execute J
exek.c execute K
exel.c execute L
exelbr.c execute left-bracket [
exelst.c execute less than sign <
exem.c execute M
exen.c execute N
exenul.c execute null ^@
exenyi.c "execute" not-yet-implemented command
exeo.c execute O
exeopr.c execute operator (+,-,(,#,/,&,^_,*)
exep.c execute P (see singlp.c)
exeprc.c execute percent sign %
exepw.c execute PW
exeq.c execute Q
exeqes.c execute question mark ?
exer.c execute R
exerbr.c execute right bracket ]
exertp.c execute right paren )
exes.c execute S
exescl.c execute semicolon ;
exet.c execute T
exeu.c execute U
exeund.c execute underscore _
exeusc.c execute unit separator character ^_
exev.c execute V
exew.c execute W
exex.c execute X
exey.c execute Y
exez.c execute Z
findes.c find end of string
findqr.c find q-register name
flowec.c flow to end of conditional
flowee.c flow to else part of conditional
flowel.c flow to end of loop
fmtmac.tec PDP-11 .MAC formatter squished
fmtmac.tes PDP-11 .MAC formatter source. this macro does
case formatting for PDP-11 macro (.MAC) source files
format.tec FORTRAN formatter squished
format.tes FORTRAN formatter source. formats the first part of
a FORTRAN source line.
genclp.c generates the command line parsing macro in clpars.h
getara.c get area in edit buffer an "m,n" argument defines
getnma.c get numeric argument off expression stack
inccbp.c increments command buffer pointer
init.c teco-c initializatin routines
insstr.c insert string into edit buffer
isradx.c is digit within current radix?
ln2chr.c convert line-number to character-number (^Q)
lowcase.tec convert edit buffer to lowercase macro, see upcase.tec
makdbf.c make digit buffer, binary to ascii in current radix
makefile.ami AmigaDOS make file
makefile.cct CodeCenter under SunOS
makefile.dg System V Unix make file (works on Data General Aviion)
makefile.sun SunOS make file
makefile.tc Turbo C make file (MS-DOS)
makefile.ulx Ultrix make file
maketeco.bat MS-DOS batch file to make teco. this is probably how
the temdos.exe executable file was made.
makprnt.tec make printable macro squished
makprnt.tes make printable macro squished. this macro makes a
string with embedded control characters printable
makrom.c make room in Q-register for new text
mung.bat MS-DOS batch to execute a teco macro from command line
pg.mem a programmer's guide. it may be useful to anyone
fixing bugs, adding features, or porting teco-c to
a new environment.
pkzip.rsp a PKZIP response file used to build TECOC.ZIP archive
popmac.c pop macro environment off macro stack
problems.txt contains notes about bugs and ideas
pshmac.c push current macro environment on macro stack
pushex.c push expression onto stack, try to reduce it
rdline.c read a line
rdpage.c read a page
readcs.c read command string
replac.c code for search and replace commands
search.c code for most of the search comamnds
search.tec search macro squished
search.tes search macro source. this macro finds a string in
a group of files using teco match constructs
singlp.c does a single P command
skpcmd.c skip over current command in command bufer
squ.bat MS-DOS batch file to run squ.tec w/standard options
squ.tec squish macro squished
squ.tes squish macro source. this macro takes a teco macro
source file and makes it as small and as fast (and
as unreadable) as possible
srclop.c search loop, handles loop arguments for search
sserch.c do a simple search
sub.tec ?
tabort.c terminate teco-c
tctlib.rsp a Turbo C TLIB response file used by makefile.tc
teco.bat MS-DOS batch file to run teco-c
teco.doc Standard TECO documentation from DECUS
teco.tes teco initialization file
tecoc.c the main source module, contains all the definitions
of system-independent global variables, as well as
comments explaining what they are.
tecoc.exe the teco-c executable for VMS
tecoc.h defines structures, general identifiers, and
the in-line debugging scheme.
tecoc.lnk link file needed under AmigaDOS (see makefile.ami)
tecoin.tes teco initialization file
temsdos.exe the teco-c executable for MS-DOS
tst.bat MS-DOS batch file to run the test macros
tst.com VMS command procedure to run the test macros
tstbsl.tec --
tstcss.tec |
tstequ.tec | these macros contain code which tests some
tsto.tec | aspects of teco-c
tstpw.tec |
tstqr.tec |
tstsrc.tec --
typbuf.c types a buffer on the screen, converting unprintable
characters to printable as nescessary.
type.tec type a file macro squished
type.tes type a file macro source. this macro apparently
types a file on the console with all kinds of
wonderful options.
typest.c types the erroneous command string for errors
uminus.c unary minus (converts -C to -1C)
unsqu.tec unsquish macro squished
unsqu.tes unsquish macro source. this macro does some simple
formatting of a squished teco macro to make it more
readable (like indenting)
upcase.tec convert edit buffer to uppercase macro, see lowcase.tec
vrbmsg.h verbose forms of teco error messages
vtedit.tec vtedit macro squished
vtedit.tes vtedit macro source. humongous screen editor macro.
note: this macro does NOT run under teco-c.
wchart.txt contains a wall chart of TECO commands
wrpage.c write a page
zamiga.c AmigaDOS system dependent code.
zfirst.c dummy module used if CHECKSUM_CODE is TRUE in zport.h
zfrsrc.c do a forward search using VAX SCANC instruction
zmsdos.c MS-DOS system dependant code
zport.h portability header file.
zunix.c SunOS (Unix) system dependant code
zunkn.c UNKNOWN system dependant code (function stubs)
zvms.c VAX/VMS system dependant code
The W command does not work, but the EXEW.C file contains code
to tell you what the command would have done if it had been executed. I used
this to play with executing VTEDIT.TEC under TECOC in order to find bugs.
I maintain the DECUS TECO Collection, a bunch of stuff relating to
TECO. It includes sources for DEC's TECO-11 v39, three TECOs written in C,
including ones for VAX/VMS, MS-DOS, SunOS (Unix) and Ultrix, the current
Standard TECO manual, two EMACs-like macro packages and LOTS of macros.
I you have something that you feel should be included in this
collection, or if you would like to improve the software, please contact
me at the above address.
Pete Siemsen

118
doc/fixes.txt 100644
View File

@ -0,0 +1,118 @@
FINDQR.C:
Cast is needed to get it to compile under Borland C.
CLPARS.TES:
If no EGMEM or if EGMEM and filename starts with a $, then CLPARS
gets totally hosed. Major hacking was needed to fix.
ZMSDOS.C, EXEE.C TECOC.H:
Backup file is created for EW and other occasions. It should only be
created with the EB command (or TECOC TECO on the command line).
Added BOOLEAN Backup argument to ZMSDOS:ZOpOut. Only make backup if
Backup==TRUE. Argument is passed through in EXEE:OpnOut. In
EXEE:ExeEB, value passed is TRUE. In EXEE:ExeEW and EXEE:ExeEPr the
value passed is False. When file is closed in ZMSDOS:ZOClos then if
no backup was wanted we won't create one.
EXEM.C:
Colon modified macros pass the colon into the internal command. This
prevented the tstqr.tec test file from working.
The fix is to clear the colon flag if it is set within ExeM().
EXEM.C:
Execution of local macros caused new set of local q registers to be
generated.
The fix is to not generate new macro set if macro is local.
SRCLOP.C:
n,mFB command did not work unless at gap. Fixed.
SEARCH.C:
ES now ignored if in macro or loop
WCHART.TXT:
Changed FB and FC as "implemented" Also G* and G_ as implemented.
ZMSDOS.C: CLPARS.TES:
Added test for ED_FF flag (in EZ??) to ignore form feeds. Then change
clpars.tes so /NOPAGE will set it *before* yanking.
ZMSDOS.C TECOC.H EXEE.C:
ZDoCmd used the file name buffer for the command, while ExeEG keeps the
command in a local buffer. This prevents EG from working in any version!
I added arguments to ZDoCmd to pass the command string.
ZMSDOS.C
The TEC$LIBRARY environment variable was not being examined for the EI
command, unlike at least the UNIX version. This basically made TEC$LIBARY
worthless since its only other use was during initializaton for video
support, which doesn't exist in MSDOS. So I fixed it.
ZMSDOS.C
Tecoc has the ugly habit of allowing you to edit a readonly file,
only to die on you when you finish. It's easy enough to check that
the output file is writable first. The problem is in ZOpOut().
Because MSDOS TECOC creates the temp file in the current directory,
any attempt to EW or EB a file in another drive will cause failure
when the rename is attempted. In these cases the file must be copied.
ZOClos() is the culprit.
I added a "fastcopy" function, much like what was done in zunix.c,
but quite a bit simpler. The OS/2 version will need this since OS/2
prefers copying over renaming to preserve file extended attributes
and PM references. The handling in the OS/2 code is slightly
different in that the only file that ever gets deleted is the
temporary file. When this code is included in the MSDOS version, it
takes too much space for compact model, so I don't update the time stamp
(that allows it to squeek by).
Along the same lines, Tecoc will create a backup file in the wrong
directory if the file name has an explicit path and has a "." in one
of the directory names. ZOClos() is the culprit, again.
I added the "% Superseding existing file" warning message. Why wasn't
it there??
CLPARS.TES
After the attempt to do an EB fails, clpars assumed the failure was
caused by the input file not being found. Added new code to attempt
to open the file via ER - if that succeeds, prints message that file
is being opened read-only.
Added handling for a /NORENAME switch, needed by OS/2. I also added
code to remove quotes in a quoted file name string if OS/2. Reason:
file names can have embedded spaces, yet quotes are not allowed.
I couldn't see any reason to strip spaces from the filename saved
in "memory" since the name had already been processed. This was causing
a problem with the OS/2 version since I stripped the quotes.
I removed the restriction of the +nnn commandline argument so it
would work with MS/DOS and OS/2. Why limit it to UNIX?
Clpars leaves the macro .T around after completion (remember -- it's
not called as a macro if USE_ANSI_CLPARS, which makes it a top level
local macro), and also leaves non-zero values in qy, q8, q.l, q4, and
possibly q.1. Fixed. However I don't understand the reasoning for
*saving* q registers during execution of clpars since there is
nothing in them at the start of the macro execution.

856
doc/prog-guide.txt 100644
View File

@ -0,0 +1,856 @@
TECO-C
Programmer's Guide
(last updated February 18, 1991 to reflect TECO-C version 140)
1 INTRODUCTION
These notes apply to TECOC version 135, which runs under VAX/VMS,
MS-DOS, and Unix (SunOS, which is BSD). See file AAREADME.TXT for the
specifics of operating system and compilers which have been used.
TECO-C is meant to be a complete implementation of TECO as defined by
the Standard TECO User's Guide and Language Reference Manual, (in file
TECO.DOC). It was written so that the author could move to many machines
without knowing many editors.
2 COMPILING AND LINKING
Conditional compilation directives are used to build TECO-C correctly
for different environments. Identifiers automatically defined by
the different compilers are used. Some identifiers defined in file ZPORT.H
control whether video support or extra debugging code is included. See
"VIDEO" and "DEBUGGING". Files are provided which "build" TECO-C in various
environments. See file AAREADME.TXT for details.
3 RUNNING TECO-C
When you run TECO, the command line used to invoke TECO is parsed for
an input/output file name and several optional switches. TECO-11 parses the
command line using a TECO macro imbedded in the program. TECO-C does the
same thing. Actually, the imbedded macro used to parse the command line
was stolen from TECO-11. I commented it and then modified it to repair
minor inconsistencies. Use of TECO-11's macro makes TECO-C invocation
identical to TECO-11's, even responding to "make love" with "Not war?".
The macro is in file CLPARS.TES. The compressed version (no comments
or whitespace) is in file CLPARS.TEC. The GENCLP program converts
CLPARS.TEC into CLPARS.H, an include file suitable for compiling into
TECO-C.
4 CODE CONVENTIONS
The code is not modular. Communication between almost all functions
is through global variables, not argument lists. There is a reason: the
nature of the basic parsing algorithm is to use the characters in the
command string as indices into a table of functions. This makes for very
fast command parsing, but it means that all the functions have to modify
Page 2
global values, because no arguments are passed in. In other words, there
were going to be 130 or so un-modular functions anyway, so I gave up on
modularity. This explanation does not explain some of the complications in
the search code, like the global variable SrcTyp. Oh, well.
Here's a brief list of some of the conventions followed by the code:
1. TECO-C is portable, so some convention was needed to separate
portable code from system-dependent code. There is one file
containing the system-dependent code for each platform TECO-C
supports. These files have names that start with a "Z": ZVMS.C,
ZMSDOS.C and ZUNIX.C.
All the system-dependent functions in those files start with a
"Z". For example, the function that allocates memory is called
ZAlloc. A VMS version of ZAlloc can be found in ZVMS.C, and an
MS-DOS version can be found in ZMSDOS.C.
An extra file called ZUNKN.C exists to help efforts to port TECO-C
to a new environment. This file contains stubs for all the
system-dependent functions.
2. All system-independent global variables are declared
alphabetically in file TECOC.C. They are defined in DEFEXT.H,
which is included by all modules.
3. File TECOC.H contains the "global" definitions, including those
for most structures.
4. Variables and functions are defined using the portability
identifiers defined in the ZPORT.H file. Functions which do not
return a value are defined as VOID. TECO-C should compile and
link on different machines by changing only the environment
definitions in the ZPORT.H file.
5. At one time, every function was in a file with the same name
as the function. This made it easy to find the code for a
function. The problem was that some groups of functions use data
not needed by the other functions. This was especially true of
the system-dependent functions. Also, some functions were called
only by one other function, so it made sense for them to be in the
same module as the caller and be made "static". So now, most
functions are in a file named the same as the function, with the
following exceptions:
1. All the "Z" functions are in are in the "Z" file for the given
system.
2. The conditionally-compiled functions (ZCpyBl in ZINIT.C, the
"Dbg" functions at the bottom of TECOC.C, the "v" functions in
EXEW.C) aren't in their own files. If they were, then the
command procedures/makefiles that compile the files would need
to contain logic to conditionally compile the files.
Page 3
3. The functions for the "E" and "F" commands are in EXEE.C and
EXEF.C, respectively. So if you want to find function ExeEX,
don't look for a file named EXEEX.C.
6. Symbols are 6 characters long or less. The way I remember it,
this was caused by the first system I wrote TECOC for: CP/M-68k,
which had a limit of 8 characters for file names. The last two
characters had to be ".C", so 6 characters were left for the file
name. Since the file name was the same as the function it
contained, functions were limited to 6 characters in length. When
I saw how nicely the function declarations looked (they fit in one
tab slot), I used 6 characters for other symbols too.
I've since been told that CP/M-68k has 8-character file names
followed by 3-character file types, so CP/M-68k can't be blamed.
So shoot me.
This standard has prevented problems from occurring with compilers
that don't support very many characters of uniqueness.
In order to make up for the resultant cryptic names, upper and
lower case are mixed. An uppercase letter indicates a new word.
For example, "EBfEnd" stands for "Edit Buffer End". If you need
to know what a variable name means, look at the definition of the
variable in DEFEXT.H. The expanded version of the abbreviated
name appears in the comment on the same line as the variable
definition. A detailed description can be found with the
declaration of the variable in TECOC.C.
The limit of 6 letters in variable names is relaxed in
system-dependent code.
7. Variable and function names follow patterns where possible. For
instance, "EBfBeg" and "EBfEnd" are the beginning and end of the
edit buffer. If you see a variable named "BBfBeg", you can assume
that it is the beginning of some other buffer, and that a "BBfEnd"
exists which is the end of that buffer.
8. Character strings are usually represented in C by a pointer to a
sequences of bytes terminated with a null character. I didn't do
that in TECO-C because I thought it was too inefficient. To get
the length of a string, you have to count characters. Most
strings in TECO-C are therefore represented by two pointers, on to
the first character and one to the character following the last
character. With this representation, it's easy to add characters
to a string and trivial to get the length.
9. Each file has a consistent format, which is:
1. a comment describing the function
2. include directives
3. the function declaration
Page 4
4. local variable definitions, in alphabetical order
5. code
5 TOP LEVEL EXECUTION AND COMMAND PARSING
The top level code for TECO-C is contained in file TECOC.C. It is
very simple: after initializing, a loop is entered which reads a command
string from the user, executes it, and loops back to read another command
string. If the user executes a command which causes TECO-C to exit, the
program is exited directly via a call to the TAbort function. TECO-C never
exits by "falling out the bottom" of the main function.
After a command string is read, the ExeCSt function is called to
execute the command string. ExeCSt contains the top-level parsing code.
The parse is trivial: each command character is used as an index into a
table of functions. The table contains one entry for each of the 128
possible characters. Each function is responsible for "consuming" its
command so that when it returns, the command string pointer points to the
next command.
5.1 Error Handling
When an error is detected, an error message is displayed at the point
that the error is detected, and the function in which the error was
detected returns a FAILURE status to its caller. Almost always, the caller
returns a FAILURE status to it's caller, which returns a FAILURE status to
it's caller, etc. When a FAILURE status is returned to the main command
string parser, parsing of the command string stops and the user is prompted
for a new command string.
This style tends to cause all function calls to follow the same form,
which is
if (function() == FAILURE)
return(FAILURE);
Things get more complicated in the system-dependent code (in the files
with names that start with a "Z"). I extended TECO's error reporting
slightly to allow the user to see the operating system's reason for an
error, as this is often useful. For example, under VAX/VMS there are many
reasons why an attempt to create an output file might fail. They include:
errors in file name syntax, destination directory non-existence, file
protection violations or disk quota violation. In order to supply enough
information to the user, TECO-C outputs multiple-line error messages when a
system error occurs.
Multiple-line error messages contain one line that describes the
operating system's perception of the error and one line that describe's
TECO's perception of the error. For instance, if a user of VAX/VMS does a
"EW[abc]test.txt$$" command when the directory [abc] does not exist, the
Page 5
error message generated by TECO-C is:
?SYS %RMS-F-DNF, directory not found
?UFO unable to open file "[abc]test.txt" for output
System errors are therefore reported in a system-dependent fashion,
using whatever messages the operating system can supply. Under VAX/VMS,
the system service $GETMSG provides human-readable messages that TECO-C can
use in the "SYS" part of the error message. Under UNIX, syserrlist[error]
is a pointer to these messages.
There is another way in which error reporting in the system-dependent
code is tricky. Under VAX/VMS, some system calls may return a code that is
"successful" but contains extra information. For instance, when a user has
set his directories so that only a limited number of versions of a file can
exist, RMS will automatically purge the oldest version of the file when the
user creates a file. This only happens if the newly created file would
cause too many versions of the file to exist. When this happens, the VMS
service returns a FILEPURGED status, which is successful. TECO-C informs
the user about these things by displaying the message in brackets.
5.2 Command Modifiers (CmdMod)
Command parsing is complicated by command modifiers and numeric
arguments, which may precede some commands. These are implemented in a way
that maintains the basic "jump table" idea. For instance, when an at-sign
(@) modifier is encountered in a command string, the at-sign command
function (ExeAtS) is called. The only thing ExeAtS does is set a flag
indicating that an at-sign has been encountered. Commands which are
affected by an at-sign modifier check this flag and behave accordingly.
The flags which indicate command modifiers are contained in global
variable CmdMod. A bit in CmdMod is reserved for each command modifier.
The modifiers are "@", ":" and "::". Of course, once the flag has been
set, it must be cleared. With this parsing algorithm, the only way to do
that is to make every command function explicitly reset CmdMod before a
successful return. This is not too bad: clearing all the flags in CmdMod
is done with one statement: "CmdMod = '\0';".
For numeric arguments to commands, an expression stack is used (see
Stacks). The EstTop variable is the pointer to the top of the expression
stack. Commands which handle numeric arguments check EStTop to see if the
expression stack contains a value.
A special case of numeric arguments is "m,n". The "m" part is
encountered and causes the value to be pushed onto the expression stack.
The comma causes the ExeCom function to move the value into a special
"m-argument" global variable (MArgmt), clear the expression stack and set
another flag in CmdMod indicating that the "m" part of an "m,n" pair is
defined. Then the "n" is encountered and pushed onto the stack. Commands
which can take "m,n" pairs check the flag in CmdMod.
Page 6
To summarize, CmdMod and EStTop are variables which describe the
context of a command. Each command function tests these variables to see
if it was preceded by modifiers or numbers. For this to work, it is
important that the expression stack and the flags in CmdMod are cleared at
the right times. It is the responsibility of each command function to
leave CmdMod and EStTop with the proper values before successfully
returning. The rules are:
1. If the command function is returning FAILURE, don't worry about
clearing CmdMod or EStTop. They will be cleared before the next
command string is executed.
2. If the command function leaves a value on the expression stack, do
not clear EStTop before returning SUCCESS. If the command calls
GetNmA, do not clear EStTop, as GetNmA does it for you.
Otherwise, clear EStTop before returning SUCCESS.
3. Clear CmdMod unless the command function sets flags or needs to
leave them alone. ExeDgt, for example, handles digit strings and
doesn't clear CmdMod because the MARGIS bit may be set.
6 SEARCHING
The search algorithm in TECO-C is complex. The war between the desire
for a fast search and the need to handle all the features of TECO'ssearch
commands has produced code which can be a real pain to follow. This
section attempts to explain how things got the way they are. The code is
explained in a bottom-up fashion, to follow the way it evolved in the
author's twisted mind.
The basic search idea is to scan a contiguous edit buffer for a search
string. The steps are:
1. Search the edit buffer for the first character in the search
string. If you reach the end of the edit buffer without matching,
the search fails.
2. When the first character of the search string matches a character
in the edit buffer, try to match successive characters in the
search string with the characters which follow the found character
in the edit buffer. If they all match, the search succeeds. If
one doesn't, go back to step 1.
This is basically what TECO-C does. The features of TECO's search
commands has buried these steps deep within some confusing code.
The first complication is introduced by pattern matching characters.
TECO has 17 "match constructs", whiceh are indicated in the search string
by the special characters ^X, ^S, ^N and ^Ex where "x" can be several other
characters. For instance, a ^X in the search string means that any
character is to be accepted as a match in place of the ^X. Characters
Page 7
other than the match constructs represent themselves. An example: the
search string "a^Xb" contains 3 match constructs: a, ^X and b.
TECO also supports forward or backward searching. When searching
backwards, only the search for the first match construct in the search
string is done in a backwards direction. When the character is found, the
characters following it are compared in a forward direction to the edit
buffer characters. This means that once the first match construct has been
found, a single piece of code can be used to compare successive characters
in the search string with successive characters in the edit buffer,
regardless of whether the search is forwards or backwards.
Adding these new features, the new description of searching is:
1. Search the edit buffer forwards or backwards for a character which
matches the first match construct in the search string. If you
reach the end of the edit buffer without matching, the search
fails.
2. When the first match construct of the search string matches a
character in the edit buffer, try to match successive match
constructs in the search string with the characters which follow
the found character in the edit buffer. If they all match, the
search succeeds. If one doesn't, go back to step 1.
To begin a description of which routines implement the above steps,
and in order to have a reference for later discussion, the following
hierarchy chart of "who calls who" is presented.
Page 8
ExeEUn ExeFB ExeFC ExeFD ExeFK ExeFN ExeFS ExeFUn ExeN ExeS ExeUnd
| | | | | | | | | | |
| | | | | | | | | | |
------------------------------------------------------------
|
V
Search
|
V
SrcLop
|
V
SSerch
| | |
+------+ | +------+
+---+ | | | +---+
| V V | V V |
| ZFrSrc | BakSrc |
| | | | | | |
+---+ | | | +---+
+------+ | +------+
V V V
CMatch <--+
| |
+--------+
At the top are the functions that implement search commands (E_, FB,
FC, FD, FK, FN, FS, F_, N, S and _). All of these functions call the main
search function: Search.
At the lower level are the functions which implement steps 1 and 2
described above. ZFrSrc searches forwards in the edit buffer for
characters which match the first character in the search string. BakSrc
does the same thing, but searches backwards. SSerch calls one of these two
functions and then executes a loop which calls CMatch to compare successive
match constructs in the search string to characters following the found
character in the edit buffer. The reason that ZFrSrc, BakSrc and CMatch
call themselves is to handle some of the more esoteric match constructs.
Case dependence in TECO is controlled by the search mode flag (see the
^X command). The variable SMFlag holds the value of the search mode flag,
and is used by ZFrSrc, BakSrc and CMatch.
One final point to help confuse things: ZFrSrc is system-dependent.
It contains a VAX/VMS-specific version which uses the LIB$SCANC run-time
library routine to access the SCANC instruction. The SCANC instruction
looks like it was designed to handle TECO's match constructs. I couldn't
resist using it, but it was a mistake, as it needlessly complicates an
already messy algorithm. I have decided to remove the VMS-specific code
some time in the future.
Further complications of the search algorithm arise because of the
following capabilities of TECO searches:
Page 9
1. If there is no text argument, use the previous search argument.
2. If colon modified, return success/failure and no error message
3. If the search fails and we're in a loop and a semicolon follows
the search command, exit the loop without displaying an error
message.
4. Handle optional repeat counts
5. If the ES flag is non-zero, verify the search based on the value
of the flag.
6. If bit 64 of the ED flag is set, move dot by one on multiple
searches.
7. If bit 16 of the ED flag is set, don't move after a failing
search.
8. Be fast.
7 MEMORY MANAGEMENT
7.1 The Edit Buffer And Input Buffer
TECO-C is based on TECO-11, but it uses a different form of edit
buffer memory management. Here's why.
The edit buffer in TECO-11 is implemented as a continuous block of
memory. This allows rapid movement through the edit buffer (by just
maintaining a pointer to the current spot) and makes searches very
straightforward. Insertion and deletion of text is expensive, because each
insertion or deletion requires moving the text following the spot where the
insertion or deletion occurs in order to maintain a continuous block of
memory. This gets to be a real pain when a video editing capability is
added to TECO, because in video mode text is added/deleted one character at
a time very rapidly.
TECO-C uses a edit buffer gap scheme. The edit buffer occupies a
continuous piece of memory, but there is a gap at the "current spot" in the
edit buffer. When the user moves around the edit buffer, the gap is moved
by shuffling text from one side of the gap to the other. This means that
moving around the text buffer is slower than for TECO-11's scheme, but text
insertion and deletion is very fast. Searches are still fast because most
searches start at the current spot and go forwards or backwards, so a
continuous piece of memory is searched. In the future, when some kind of
video mode is added, insertion and deletion one-character-at-a-time will be
fast using the gap scheme.
The variables that maintain pointers to the edit buffer and the gap
within the buffer can be confusing, so here's some examples. Suppose that
10000 bytes are allocated for the edit buffer when TECO-C is initialized.
Page 10
Suppose the allocated memory starts at address 3000.
Empty edit buffer (the gap spans the whole edit buffer):
EBfBeg = 3000 (edit buffer beginning)
GapBeg = 3000 (gap beginning)
GapEnd = 13000 (gap end)
EBfEnd = 13000 (edit buffer end)
Buffer contains "test", character pointer is before the first 't':
EBfBeg = 3000 (edit buffer beginning)
GapBeg = 3000 (gap beginning)
GapEnd = 12996 (gap end)
12997 't'
12998 'e'
12999 's'
EBfEnd = 13000 't' (edit buffer end)
Buffer contains "test", character pointer is after the last 't':
EBfBeg = 3000 't' (edit buffer beginning)
3001 'e'
3002 's'
3003 't'
GapBeg = 3004 (gap beginning)
GapEnd = 13000 (gap end)
EBfEnd = 13000 (edit buffer end)
Buffer contains "test", character pointer is after the 'e':
EBfBeg = 3000 't' (edit buffer beginning)
3001 'e'
GapBeg = 3002 (gap beginning)
GapEnd = 12998 (gap end)
12999 's'
EBfEnd = 13000 't' (edit buffer end)
When an insertion command is executed, the text is inserted starting
at GapBeg. When a deletion command is executed, GapEnd is incremented for
a forward delete or GapBeg is decremented for a backwards delete. When the
character pointer is moved forwards, the gap is moved forwards by copying
text from the end of the gap to the beginning. When the character pointer
is moved backwards, the gap is moved backwards by copying text from the the
area just before the gap to the area at the end of the gap.
There are a few messy cases, such as when a bounded search is executed
and the bounded text area includes the edit buffer gap. In this case, the
gap is temporarily moved so that the search can proceed over a continuous
memory area.
Page 11
In order to confuse things a little, TECO-C has one addition to the
basic edit buffer gap management. Following the end of the edit buffer
(EBfEnd) is the current input stream buffer. Since file input commands
always cause text to be appended to the end of the edit buffer, this is
natural. Thus, no input buffer is needed: text is input directly into the
edit buffer. This makes the code a little confusing, but it avoids the
problem of having an input buffer. When you have an input buffer, you have
to deal with the question of how large the buffer should be and what to do
with it when it's too small. this scheme is fast and and saves some
memory. (see File Input)
7.2 Q-registers
Q-registers have two parts: a numeric part and a text part. Each
q-register is represented by a structure containing three fields: one to
hold the numeric part and two to point to the beginning and end of the
memory holding the text part. If the text part of the q-register is empty,
then the pointer to the beginning of the text is NULL.
There are 36 global q-registers, one for each letter of the alphabet
and 1 for each digit from 0 to 9. These q-registers are accessible from
any macro level. There are 36 local q-registers for each macro level. The
names for local q-registers are preceded by a period. Thus the command
"1xa" inserts a line into global q-register "a", while the command "1x.a"
inserts a line into local q-register ".a". Storage for the data structure
defining local q-registers is not allocated until a local q-register is
first used. This saves space and time, because local q-registers are
rarely used, and doing things this way avoids allocating and freeing memory
every time a macro is executed.
8 STACKS
8.1 Expression Stack
An expression stack is used to parse TECO's expressions. Consider the
command string QA+50=$$. When the command string is executed, the value of
QA is pushed on the expression stack, then the operator "+" is pushed on
the expression stack, and then the value "50" is pushed on the expression
stack. Whenever a full expression that can be reduced is on the expression
stack, it is reduced. For the above example, the stack is reduced when the
value "50" is pushed.
The expression stack is implemented in the following variables:
EStack the stack itself, containing saved operators and operands
EStTop index of the top element in EStack
EStBot index of the current "bottom" of the stack in EStack
The "bottom" of the expression stack can change because an expression
can include a macro invocation. For example, the command QA+M3=$$ causes
the value of "QA" to be pushed on the expression stack, then the "+" is
Page 12
pushed, and then the macro contained in q-register 3 is executed. The
macro in q-register 3 returns a value to be used in the expression. When
the macro is entered, a new expression stack "bottom" is established. This
allows the macro to have a "local" expression stack bottom while
maintaining the stack outside the macro.
8.2 Loop Stack
The loop stack contains the loop count and the address of the first
command in the loop. For example, in the command 5<FSMP$mt$>$$, the loop
stack contains the loop count (5) and the address of the first command in
the loop (F). Whenever the end-of-loop character (>) is encountered, the
loop count is decremented. If the loop count is still greater than zero
after it has been decremented, then the command string pointer is reset to
point to the first character in the loop (F).
The loop stack is implemented in the following variables:
LStack the stack itself, containing saved counts and addresses
LStTop index of the top element in LStack
LStBot index of the current "bottom" of the stack in LStack
The loop stack needs a "floating" bottom for the same reason that the
expression stack needs one: macros. Consider the command string
4<Smp$M7$>$$. When the "<" in is encountered, the loop count (4) and the
address of the first character in the loop (S) are placed on the loop
stack. Command execution continues, and the "M7" command is encountered.
Suppose that q-register 7 contains the erroneous command string 10>DL>$$.
When the ">" command is encountered in the macro, TECO expects the loop
stack to contain a loop count and an address for the first character in the
loop. In this example, there is no matching "<" command in the macro which
would have set up the loop stack. It would be very bad if TECO were to
think that the loop count was 4 and the first command in the loop was "S".
In this situation, what TECO should do is generate the error message "BNI >
not in iteration". In order to implement this, the variable LStBot is
adjusted each time a macro is entered or exited. LStBot represents the
bottom of the loop stack for the current macro level.
8.3 Macro Stack
The macro stack is used to preserve context each time a macro is
entered. All important values are pushed onto the stack before a macro is
entered and popped off the stack when the macro is exited. The macro stack
is also used by the EI command, which means it's used when executing
initialization files and mung files.
9 HELP
This section discusses on-line HELP, which is available only under
Page 13
VAX/VMS.
The HELP command is not documented in the TECO manual distributed by
DEC., even though it is supported in TECO-11 and TECO-32. To get help,
simply type "HELP" followed by a carriage return. HELP is the only TECO
command that is not terminated by double escapes.
Help in TECOC is different than help in TECO-11. In TECO-C,
interactive help mode is entered, so that a user can browse through a help
tree, as he can from DCL. In TECO-C, access is provided to only two
libraries: the library specific to TECO-C (pointed to by logical name
TEC$INIT) and the system help library. To get help on TECO-C, just say
"HELP", with or without arguments. To get help from the system library,
say "HELP/S". I find this easier to use than TECO-11's syntax.
The help library for TECO-C is contained in file TECOC.HLB, which is
generated from TECOC.HLP, which is generated from TECOC.RNH. See file
TECOC.RNH for a description of how to do it. This help library is far
broader than the library for TECO-11, but much of it has yet to be filled
in.
The help library is also the repository for verbose error messages,
which are displayed when the help flag (EH) is set to 3. For systems other
than VMS, the ZHelp function displays verbose text contained in static
memory (see file ZHELP.C).
10 FILE INPUT
TECO has an elegant design that allows high speed input. There are no
linked list data structures to keep track of, and most file input goes
directly to the end of the edit buffer.
TECO-C takes advantage of this by reading normal file input directly
to the end of the edit buffer. After each input call, nothing needs to be
moved; the pointer to the end of the edit buffer is simply adjusted to
point to the end of the new record. The pointer to the end of the edit
buffer (EBfEnd) serves two purposes: it points to the end of the edit
buffer and to the beginning of the input buffer.
A side effect of this scheme is the sharing of memory between the edit
buffer and the input buffer. When the edit buffer is empty, it can be made
smaller by shrinking the edit buffer gap in order to make the input buffer
larger. Obviously, if the edit buffer needs to be expanded, the input
buffer can suffer before more memory is actually requested from the
operating system. This is easily achieved by moving the pointer to the
"end-of-the-edit-buffer"/ "beginning-of-the-input-buffer".
This scheme works, but provides no support for the other forms of file
input. The EP and ER$ commands provide a complete secondary input stream
which can be open at the same time as the primary stream (two input files
at once). The EI command reads and executes files containing TECO
commands, and is used to execute the initialization file, if one exists.
The EQq command, if implemented, reads the entire contents of a file
Page 14
directly into a Q-register.
A second problem arises: on each of the open files, the quantum unit
of input is not standard. For A, Y and P commands, a form feed or
end-of-file "terminate" the read. For n:A commands, form feed, end-of-line
or end-of-file "terminate" each read. For EI commands, two escapes or
end-of-file "terminate" the read. The input code must "save" the portion
of an input record following a special character and yield the saved text
when the next command for the file is executed.
The scheme used in TECO-C is to read text from the current input
stream directly to the end of the edit buffer. When the input stream is
switched via a EP or ER$ command, the obvious switching of file descriptors
happens, and any text that's "leftover" from the last read is explicitly
saved elsewhere. Note that this happens VERY rarely, so a malloc/free is
acceptable.
For EI and EQq commands, the input memory following the edit buffer is
used as a temporary input buffer. After the file is read, the text is
copied to a Q-register in the case of EQq and to a separate buffer in the
case of EI.
11 VIDEO
As of 18-Feb-1991, TECO-C supports video only under Unix. The code
was written by Mark Henderson, using the CURSES package. See file
VIDEO.TXT for a discussion of how it works.
12 PORTABILITY
TECO-C was written with portability in mind. The first development
machine was "minimal": a SAGE IV (68000) running CP/M-68k. In that
environment, there was no "make" utility.
Initially, the system-independent code (files that don't start with a
"Z") had absolutely no calls to standard C runtime functions. This was
because I had several problems with the "standard" functions not being
"standard" on different machines. With the onset of ANSI C I've grown less
timid, but the main code still references almost no standard functions.
This is less of a limitation than you might think: TECO-C doesn't use
null-terminated strings. It also doesn't use unions, floating point or bit
fields.
13 PORTING TO A NEW ENVIRONMENT
1. Move the source code to the target machine.
Page 15
2. Inspect file ZPORT.H. You need to select the compiler you want
the code compiled for. For instance, if you are porting to a Unix
system, then fix ZPORT.H so that the unix identifier is defined
(it is usually defined by default by the compiler). If your
compiler is nothing like anything supported by ZPORT.H, then set
the UNKNOWN identifier.
3. Compile and link. See file AAREADME.TXT for descriptions of how
TECO-C is built in supported environments, and steal like mad.
The problem here is that you need a "Z" file for your environment,
containing all the "Z" functions needed by TECO-C. The easiest
thing to do is copy ZUNKN.C to your own "Z" file and link against
that. For instance, if I ever port TECO-C to a Macintosh, I'll
copy ZUNKN.C to ZMAC.C.
4. Fix things so the compile/link is successful. If you have
compiled with UNKNOWN set, you should get an executable file that
displays a message and dies when the first system-dependent
function is called. The strategy is to fix that function (often
by stealing from the code for other operating systems), relink and
deal with the next message until you have something that works.
Functions should be implemented in roughly the following order:
ZInit, ZTrmnl, ZExit, ZDspCh, ZAlloc, ZRaloc, ZFree, ZChin. This
will give you a TECO with everything but file I/O. You can run
it, add text to the edit buffer, delete text, search, use
expressions and the = sign command (a calculator). Then do file
input: ZOpInp, ZRdLin, ZIClos. Then do file output: ZOpout,
ZWrBfr, ZOClos, ZOClDe. Use the test macros (*tst*.tec) to test
how everything works (see Testing).
14 TESTING
Testing of TECO-C is performed by executing macros. The macros are
contained in files named TSTxxx.TEC, where XXX is some kind of indication
as to what is tested. For instance, TSTQR.TEC tests q-registers. The test
macros do not test all the functions provided by TECO. They were
originally used to verify that TECO-C performs exactly the same as TECO-11
under the VMS operating system. When I needed to test a chunk of code, I
sometimes did it the right way and wrote a macro.
15 DEBUGGING
A debugging system (very ugly, very useful) is imbedded within the
code. It is conditionally complied into the code by turning on or off an
identifier (DEBUGGING) defined in the TECOC.H file. When debugging code is
compiled in, you can access it using the ^P command, which is not used by
regular TECO. The ^P command with no argument will display help about how
to use ^P.
Page 16
If you are working under VMS, it sometimes helps to compare the
execution of TECO-C with TECO-11. Put a test command string into a file.
Use DEFINE/USER_MODE to redirect the output of TECO-C to a file and execute
the macro with TECO-C. Then do the same thing with TECO-11. Use the
DIFFERENCES command to compare the two output files. They should be 100
percent identical.

44
doc/readme.1st 100644
View File

@ -0,0 +1,44 @@
TECO-C (version number 146)
Copyright 1983, 1990 by Pete Siemsen. This software is provided to
you free of charge for your own use. Use it as you see fit; if it doesn't
work, I disclaim all responsibility. You may re-distribute this software
UNCHANGED only if you include this copy-right notice. Alternatively, if
you change this software, you may re-distribute the result only if you
include BOTH this copyright notice, AND an additional notice identifying
you and indicating that you have changed the software.
This program is still under development. See file PROBLEMS.TXT for
notes I've written to myself about things to do to the program. If you
modify this code to enhance it or fix a bug, please communicate the changes
to me. My address is
Pete Siemsen
645 Ohio Avenue #302
Long Beach, Ca. 90814
(213) 433-3059 (home)
(213) 740-7391 (work)
Internet: siemsen@usc.edu
[NOTE -- This is old information. Better to contact me, Tom Almy, below.]
*******************************************************
This archive contains TECO-C modified and compiled for DOS, Win32,
OS/2, and Linux (on Intel 32bit architecture). The modifications have been made by:
Tom Almy
tomalmy@aracnet.com
who is a "old time" TECO user. Not only did I port TECO-C but I also
corrected some bugs. For OS/2 modified the file backup algorithm to do
copying rather than renaming as an option. This makes it Workplace
Shell friendly. The Win32, Linux and OS/2 versions allow long file names.
Included files in this archive:
doc:
readme.1st This file
readme.txt Operating and install instructions for Linux users
wchart.txt List of all the implemented commands.
teco.doc The official teco reference. TECOC IS CLOSE TO TECO-11 IN FUNCTIONALITY
bin:
tecoc Executable
Make link to tecoc
mung link to tecoc
teco link to tecoc
Inspect link to tecoc
lib:
*.tes *.tec TECO macros
src:
Full source files for Linux version

171
doc/readme.osx 100644
View File

@ -0,0 +1,171 @@
Running TECOC on OS X
Tecoc takes a first argument of mung, teco, or make to control its
operating mode. In this Linux version, the name of the executable is
tested to provide this first argument. Typically soft links are used
to the tecoc executable, however aliases could be used instead. The
mapping is:
Make is tecoc make (note uppercase first letter)
teco is tecoc teco
mung is tecoc mung
inspect is tecoc teco -inspect
The provided TAR file has these four soft links defined. Extract the
TAR file into a directory in your execution path
after making sure none of the command names already exist for other
applications. Necessary environment variables and files are described below.
Several option switches are allowed on the TECO command line:
-in[spect] -- Read file only, don't create an output file.
-noc[reate] -- If file doesn't exist, don't create it.
-noi[ni] -- Don't execute INI file. (valid for MAKE or MUNG as well)
-nom[emory] -- don't save filename as "last edited file" (valid for
MAKE also)
-nop[age] -- Formfeeds don't stop file reads (valid for MAKE also)
+nnn -- sets NOPAGE and positions dot to line nnn.
The part of the switch name in the square brackets is optional. For
instance "-in" is the same as "-inspect".
MAKE filespec
starts tecoc to create file filespec. Does equivalent of EWfilespec$$
TECO filespec
starts tecoc to edit file filespec. Does equivalent of
EBfilespec$Y$
TECO filespec2=filespec1
starts tecoc to edit filespec1, writing to filespec2. Does
equivalent of ERfilespec1$EWfilespec2$Y$$
TECO
starts tecoc to edit last edited file. Filename is saved in file
named teco*.tmp in the current directory, unless overriden
(described below).
MUNG filespec <args>
starts tecoc to execute filespec. Equivalent to
I<args>$JEIfilespec$$
You can use "TECO @filespec <args>" instead of MUNG.
**************
Key Bindings
The keys mentioned in the teco.doc file are somewhat confusing.
This should help:
<DELIM> The "Esc" key, "Esc" echoes as "$", however the
teco.doc file shows it as '`'.
<BS> Type as Control-h, this isn't the "Backspace" key.
<DELETE> The "Backspace" key. This isn't the "Delete" key.
<CR> The "Enter" key.
<LF> Type as Control-j.
Note that the assignments for <BS> and <DELETE> shown here are
swapped. <BS> can be "Backspace" and <DELETE> can be control-h by
clearing ET&2048, e.g. 2048,0ET
**************
The Initialization File.
Tecoc mungs (executes as teco commands) the file TECO.INI in the
current directory before processing the command line. Initialization
can be done instead by defining a TEC_INIT environment variable. The
value is either the list of teco commands to execute or a "$" followed
by the pathname of the file containing the initialization file. This
allows a single, centrally located initialization file. REMEMBER that
the "$" must be escaped, i.e. "\$"
The initialization file can be used to make initial settings. It can
return a value, but the value setting is somewhat obscure.
Example:
export TEC_INIT=1es
will cause successful searches to auto-display in all teco sessions.
**************
Changing the location of the memory file.
Define the environment variable TEC_MEMORY to be "$" followed by the
pathname of the file designated the memory file.
Examples (csh):
export TEC_MEMORY=~/teco.mem
export TEC_MEMORY=\$$TEC_MEMORY
will cause the name of the last edit file to be stored in the file
teco.mem in the home directory. By default the file name is tecoN.tmp in
the current directory, where "N" is the process ID of the parent process to
teco.
**************
The Libary directory
Defining the environment variable TEC_LIBRARY to be a directory path
(including the final "/") will allow the EI command to fetch
teco commands from this directory if the file is not found in the
current directory.
Example:
export TEC_LIBRARY=\$/usr/local/lib/
will cause the directory /usr/local/lib to be searched for teco command files.
**************
Implemented flags:
ED&1 Allow carat "^" character in string searches
ED&2 Allow yank and _ unconditionally
ED&16 Failed searches preserve dot
ED&64 Move dot by one after each match in multiple occurance searches
ET&1 Type out in image mode
ET&2 Use scope for delete and control-U (default=1)
ET&4 Accept lowercase input (default=1)
ET&8 ^T reads without echo
ET&32 ^T reads with no wait
ET&128 MUNG mode (abort on error) cleared by "*" prompt
ET&2048 Swap backspace and delete
ET&4096 We are using 8 bit characters (default=1)
ET&32768 Trap control-C
EZ&1 Mark Henderson, who did much of the Unix port, likes the way
VAX/VMS keeps versions of files. VMS appends a semicolon followed
by a version number to files, and has the PURGE command to clean
out old versions of files. If this bit is off, TECO-C will handle
file version numbers, appending the appropriate version number to
file names. Mark supplied a "purge" program (distributed with TECO-C)
for users of this feature. Setting this flag turns off the feature,
to make TECO-C function as expected by the average Unix user. This
flag is set by default.
EZ&128 Don't stop read on formfeeds
EZ&256 If set, don't do newline translation on file read/write -- binary mode.
TECO is based on separate carriage return (CR) and line feed (LF)
line termination. Normally on file input newline (line feed)
characters are converted to CRLF pairs unless preceded
by a CR -- this allows reading DOS format files. On output CRLF pairs
are converted back to new line characters. Set this bit before starting
to edit a binary file, or when editing a DOS file for which no format
conversion is desired (ie file is saved back in DOS format).
EZ&8192 This bit is set by default, but has no significance in this release.
EZ&16384 Normally the backup file name is created by replacing the file extension
with "bak" -- foo.c becomes foo.bak, however if this bit is set then
the backup file name is created by simply adding ".bak" to the name -- foo.c
becomes foo.c.bak. This choice is overridden by EZ&1 = 0.

134
doc/readme.txt 100644
View File

@ -0,0 +1,134 @@
Running TECOC on Linux
Tecoc takes a first argument of mung, teco, or make to control its
operating mode. In this Linux version, the name of the executable is
tested to provide this first argument. Typically soft links are used
to the tecoc executable, however aliases could be used instead. The
mapping is:
Make is tecoc make (note uppercase first letter)
teco is tecoc teco
mung is tecoc mung
inspect is tecoc teco -inspect
The provided TAR file has these four soft links defined. Extract the
TAR file into a directory in your path, typically /usr/local/bin,
after making sure none of the command names already exist for other
applications. Necessary environment variables and files are described below.
Several option switches are allowed on the TECO command line:
-in[spect] -- Read file only, don't create an output file.
-noc[reate] -- If file doesn't exist, don't create it.
-noi[ni] -- Don't execute INI file. (valid for MAKE or MUNG as well)
-nom[emory] -- don't save filename as "last edited file" (valid for
MAKE also)
-nop[age] -- Formfeeds don't stop file reads (valid for MAKE also)
-nor[ename] -- Don't rename files, but copy them to keep references correct
(OS/2 only)
+nnn -- sets NOPAGE and positions dot to line nnn.
The part of the switch name in the square brackets is optional. For
instance "-in" is the same as "-inspect".
MAKE filespec
starts tecoc to create file filespec. Does equivalent of EWfilespec$$
TECO filespec
starts tecoc to edit file filespec. Does equivalent of
EBfilespec$Y$
TECO filespec2=filespec1
starts tecoc to edit filespec1, writing to filespec2. Does
equivalent of ERfilespec1$EWfilespec2$Y$$
TECO
starts tecoc to edit last edited file. Filename is saved in file
named teco*.tmp in the current directory, unless overriden
(described below).
MUNG filespec <args>
starts tecoc to execute filespec. Equivalent to
I<args>$JEIfilespec$$
You can use "TECO @filespec <args>" instead of MUNG.
**************
Key Bindings
The keys mentioned in the teco.doc file are somewhat confusing.
This should help:
<DELIM> The "Esc" key, "Esc" echoes as "$", however the
teco.doc file shows it as '`'.
<BS> Type as Control-h, this isn't the "Backspace" key.
<DELETE> The "Backspace" key. This isn't the "Delete" key.
<CR> The "Enter" key.
<LF> Type as Control-j.
Note that the assignments for <BS> and <DELETE> shown here are
swapped. <BS> can be "Backspace" and <DELETE> can be control-h by
clearing ET&2048, e.g. 2048,0ET
**************
The Initialization File.
Tecoc mungs (executes as teco commands) the file TECO.INI in the
current directory before processing the command line. Initialization
can be done instead by defining a TEC_INIT environment variable. The
value is either the list of teco commands to execute or a "$" followed
by the pathname of the file containing the initialization file. This
allows a single, centrally located initialization file. REMEMBER that
the "$" must be escaped, i.e. "\$"
The initialization file can be used to make initial settings. It can
return a value, but the value setting is somewhat obscure.
Example (csh):
setenv TEC_INIT 1es
Example (bash):
TEC_INIT=1es
export TEC_INIT
will cause successful searches to auto-display in all teco sessions.
**************
Changing the location of the memory file.
Define the environment variable TEC_MEMORY to be "$" followed by the
pathname of the file designated the memory file.
Example (csh):
setenv TEC_MEMORY ~/teco.mem
setenv TEC_MEMORY \$$TEC_MEMORY
Example (bash):
TEC_MEMORY = ~/teco.mem
TEC_MEMORY = \$$TEC_MEMORY
export TEC_MEMORY
will cause the name of the last edit file to be stored in the file
teco.mem in the home directory. By default the file name is tecoN.tmp in
the current directory, where "N" is the process ID of the parent process to
teco.
**************
The Libary directory
Defining the environment variable TEC_LIBRARY to be a directory path
(including the final "/") will allow the EI command to fetch
teco commands from this directory if the file is not found in the
current directory.
Example (csh):
setenv TEC_LIBRARY=\$/usr/local/lib/
will cause the directory /usr/local/lib to be searched for teco command files.
**************
Implemented flags:
ED&1 Allow carat "^" character in string searches
ED&2 Allow yank and _ unconditionally
ED&16 Failed searches preserve dot
ED&64 Move dot by one after each match in multiple occurance searches
ET&1 Type out in image mode
ET&2 Use scope for delete and control-U (default=1)
ET&4 Accept lowercase input (default=1)
ET&8 ^T reads without echo
ET&32 ^T reads with no wait
ET&128 MUNG mode (abort on error) cleared by "*" prompt
ET&2048 Swap backspace and delete
ET&4096 We are using 8 bit characters (default=1)
ET&32768 Trap control-C
EZ&1 Mark Henderson, who did much of the Unix port, likes the way
VAX/VMS keeps versions of files. VMS appends a semicolon followed
by a version number to files, and has the PURGE command to clean
out old versions of files. If this bit is off, TECO-C will handle
file version numbers, appending the appropriate version number to
file names. Mark supplied a "purge" program (distributed with TECO-C)
for users of this feature. Setting this flag turns off the feature,
to make TECO-C function as expected by the average Unix user. This
flag is set by default.
EZ&128 Don't stop read on formfeeds
EZ&256 If set, don't do newline translation on file read/write -- binary mode.
TECO is based on separate carriage return (CR) and line feed (LF)
line termination. Normally on file input newline (line feed)
characters are converted to CRLF pairs unless preceded
by a CR -- this allows reading DOS format files. On output CRLF pairs
are converted back to new line characters. Set this bit before starting
to edit a binary file, or when editing a DOS file for which no format
conversion is desired (ie file is saved back in DOS format).
EZ&8192 This bit is set by default, but has no significance in this release.
EZ&16384 Normally the backup file name is created by replacing the file extension
with "bak" -- foo.c becomes foo.bak, however if this bit is set then
the backup file name is created by simply adding ".bak" to the name -- foo.c
becomes foo.c.bak. This choice is overridden by EZ&1 = 0.

121
doc/readme.win 100644
View File

@ -0,0 +1,121 @@
Running TECOC
Tecoc is typically started via batch commands to set the first
argument to MUNG, TECO, or MAKE. The batch files are typically called
mung, teco, make, and inspect. (Inspect does a TECO/INSPECT.)
Several option switches are allowed on the TECO command line:
/IN[SPECT] -- Read file only, don't create an output file.
/NOC[REATE] -- If file doesn't exist, don't create it.
/NOI[NI] -- Don't execute INI file. (valid for MAKE or MUNG as well)
/NOM[EMORY] -- don't save filename as "last edited file" (valid for
MAKE also)
/NOP[AGE] -- Formfeeds don't stop file reads (valid for MAKE also)
/NOR[ENAME] -- Don't rename files, but copy them to keep references correct
(OS/2 only)
+nnn -- sets NOPAGE and positions dot to line nnn.
The part of the switch name in the square brackets is optional. For
instance "/IN" is the same as "/INSPECT".
MAKE filespec
starts tecoc to create file filespec. Does equivalent of EWfilespec$$
TECO filespec
starts tecoc to edit file filespec. Does equivalent of
EBfilespec$Y$
TECO filespec2=filespec1
starts tecoc to edit filespec1, writing to filespec2. Does
equivalent of ERfilespec1$EWfilespec2$Y$$
TECO
starts tecoc to edit last edited file. Filename is saved in file
named teco*.tmp in the current directory, unless overriden
(described below).
MUNG filespec <args>
starts tecoc to execute filespec. Equivalent to
I<args>$JEIfilespec$$
You can use "TECO @filespec <args>" instead of MUNG.
**************
The Initialization File.
Tecoc mungs (executes as teco commands) the file TECO.INI in the
current directory before processing the command line. Initialization
can be done instead by defining a TEC$INIT environment variable (the
DOS "SET" command does this). The value is either the list of teco
commands to execute or a "$" followed by the pathname of the file
containing the initialization file. This allows a single, centrally
located initialization file.
The initialization file can be used to make initial settings. It can
return a value, but the value setting is somewhat obscure.
Example:
set TEC$INIT=1es
will cause successful searches to auto-display in all teco sessions.
**************
Changing the location of the memory file.
Define the environment variable TEC$MEMORY to be "$" followed by the
pathname of the file designated the memory file.
Example:
set TEC$MEMORY=$c:\teco.mem
will cause the name of the last edit file to be stored in the file
teco.mem in the root directory of drive C.
**************
The Libary directory
Defining the environment variable TEC$LIBRARY to be a directory path
(including the final "\" or "/") will allow the EI command to fetch
teco commands from this directory if the file is not found in the
current directory.
Example:
set TEC$LIBRARY=c:\lib\teco\
will cause the directory c:\lib\teco to be searched for teco command files.
**************
Implemented flags:
ED&1 Allow carat "^" character in string searches
ED&2 Allow yank and _ unconditionally
ED&16 Failed searches preserve dot
ED&64 Move dot by one after each match in multiple occurance searches
ET&1 Type out in image mode
ET&2 Use scope for delete and control-U (default=1)
ET&4 Accept lowercase input (default=1)
ET&8 ^T reads without echo
ET&32 ^T reads with no wait
ET&128 MUNG mode (abort on error) cleared by "*" prompt
ET&2048 Swap backspace and delete (default=1)
ET&4096 We are using 8 bit characters (default=1)
ET&32768 Trap control-C
EZ&2 Don't rename files, copy them (OS/2 Version)
EZ&128 Don't stop read on formfeeds

61
doc/readme2.1st 100644
View File

@ -0,0 +1,61 @@
TECO-C (version number 146)
Copyright 1983, 1990 by Pete Siemsen. This software is provided to
you free of charge for your own use. Use it as you see fit; if it doesn't
work, I disclaim all responsibility. You may re-distribute this software
UNCHANGED only if you include this copy-right notice. Alternatively, if
you change this software, you may re-distribute the result only if you
include BOTH this copyright notice, AND an additional notice identifying
you and indicating that you have changed the software.
This program is still under development. See file PROBLEMS.TXT for
notes I've written to myself about things to do to the program. If you
modify this code to enhance it or fix a bug, please communicate the changes
to me. My address is
Pete Siemsen
645 Ohio Avenue #302
Long Beach, Ca. 90814
(213) 433-3059 (home)
(213) 740-7391 (work)
Internet: siemsen@usc.edu
[NOTE -- This is old information. Better to contact me, Tom Almy, below.]
*******************************************************
This archive contains TECO-C modified and compiled for DOS, Win32,
and OS/2. The modifications have been made by:
Tom Almy
tomalmy@aracnet.com -or-
tom_almy@ieee.org
who is a "old time" TECO user. Not only did I port TECO-C but I also
corrected some bugs and modified the file backup algorithm to do
copying rather than renaming as an option. This makes it Workplace
Shell friendly. Both the Win32 and OS/2 version allow long file names.
Included files in this archive:
readme.1st This file
readme.txt Quick operating instructions for the TECO literate
wchart.txt List of all the implemented commands.
teco.doc The official teco reference.
inspect.cmd Command files to invoke tecoc
inspect.bat (cmd for OS/2, bat for DOS/Win32)
mung.cmd
mung.bat
teco.cmd
teco.bat
tmake.cmd this would be "make" but most people use the program
"make".
tmake.bat
tecocmd.btm Equivalent aliases for JPSoft products (4DOS, et cetera)
*.tes TECO command files for various things
*.tec Compressed TECO command files
The executable program is downloaded as a separate file.

142
doc/readme2.osx 100644
View File

@ -0,0 +1,142 @@
Running TECOC
NOTE -- IF YOU ARE USING LINUX, READ THE FILE README.LNX INSTEAD!
Tecoc is typically started via batch commands to set the first
argument to MUNG, TECO, or MAKE. The batch files are typically called
mung, teco, make, and inspect. (Inspect does a TECO/INSPECT.)
Several option switches are allowed on the TECO command line:
/IN[SPECT] -- Read file only, don't create an output file.
/NOC[REATE] -- If file doesn't exist, don't create it.
/NOI[NI] -- Don't execute INI file. (valid for MAKE or MUNG as well)
/NOM[EMORY] -- don't save filename as "last edited file" (valid for
MAKE also)
/NOP[AGE] -- Formfeeds don't stop file reads (valid for MAKE also)
/NOR[ENAME] -- Don't rename files, but copy them to keep references correct
(OS/2 only)
+nnn -- sets NOPAGE and positions dot to line nnn.
The part of the switch name in the square brackets is optional. For
instance "/IN" is the same as "/INSPECT".
MAKE filespec
starts tecoc to create file filespec. Does equivalent of EWfilespec$$
TECO filespec
starts tecoc to edit file filespec. Does equivalent of
EBfilespec$Y$
TECO filespec2=filespec1
starts tecoc to edit filespec1, writing to filespec2. Does
equivalent of ERfilespec1$EWfilespec2$Y$$
TECO
starts tecoc to edit last edited file. Filename is saved in file
named teco*.tmp in the current directory, unless overriden
(described below).
MUNG filespec <args>
starts tecoc to execute filespec. Equivalent to
I<args>$JEIfilespec$$
You can use "TECO @filespec <args>" instead of MUNG.
**************
Key Bindings
The keys mentioned in the teco.doc file are somewhat confusing.
This should help:
<DELIM> The "Esc" key, "Esc" echoes as "$", however the
teco.doc file shows it as '`'.
<BS> Type as Control-h, this isn't the "Backspace" key.
<DELETE> The "Backspace" key. This isn't the "Delete" key.
<CR> The "Enter" key.
<LF> Type as Control-j.
Note that the assignments for <BS> and <DELETE> shown here are
swapped. <BS> can be "Backspace" and <DELETE> can be control-h by
clearing ET&2048, e.g. 2048,0ET
**************
The Initialization File.
Tecoc mungs (executes as teco commands) the file TECO.INI in the
current directory before processing the command line. Initialization
can be done instead by defining a TEC$INIT environment variable (the
DOS "SET" command does this). The value is either the list of teco
commands to execute or a "$" followed by the pathname of the file
containing the initialization file. This allows a single, centrally
located initialization file.
The initialization file can be used to make initial settings. It can
return a value, but the value setting is somewhat obscure.
Example:
set TEC$INIT=1es
will cause successful searches to auto-display in all teco sessions.
**************
Changing the location of the memory file.
Define the environment variable TEC$MEMORY to be "$" followed by the
pathname of the file designated the memory file.
Example:
set TEC$MEMORY=$c:\teco.mem
will cause the name of the last edit file to be stored in the file
teco.mem in the root directory of drive C.
**************
The Libary directory
Defining the environment variable TEC$LIBRARY to be a directory path
(including the final "\" or "/") will allow the EI command to fetch
teco commands from this directory if the file is not found in the
current directory.
Example:
set TEC$LIBRARY=c:\lib\teco\
will cause the directory c:\lib\teco to be searched for teco command files.
**************
Implemented flags:
ED&1 Allow carat "^" character in string searches
ED&2 Allow yank and _ unconditionally
ED&16 Failed searches preserve dot
ED&64 Move dot by one after each match in multiple occurance searches
ET&1 Type out in image mode
ET&2 Use scope for delete and control-U (default=1)
ET&4 Accept lowercase input (default=1)
ET&8 ^T reads without echo
ET&32 ^T reads with no wait
ET&128 MUNG mode (abort on error) cleared by "*" prompt
ET&2048 Swap backspace and delete (default=1)
ET&4096 We are using 8 bit characters (default=1)
ET&32768 Trap control-C
EZ&2 Don't rename files, copy them (OS/2 Version)
EZ&128 Don't stop read on formfeeds

80
doc/readme2.txt 100644
View File

@ -0,0 +1,80 @@
Running TECOC
Tecoc is typically started via batch commands to set the first
argument to MUNG, TECO, or MAKE. The batch files are typically called
mung, teco, make, and inspect. (Inspect does a TECO/INSPECT.)
Several option switches are allowed on the TECO command line:
/IN[SPECT] -- Read file only, don't create an output file.
/NOC[REATE] -- If file doesn't exist, don't create it.
/NOI[NI] -- Don't execute INI file. (valid for MAKE or MUNG as well)
/NOM[EMORY] -- don't save filename as "last edited file" (valid for
MAKE also)
/NOP[AGE] -- Formfeeds don't stop file reads (valid for MAKE also)
/NOR[ENAME] -- Don't rename files, but copy them to keep references correct
(OS/2 only)
+nnn -- sets NOPAGE and positions dot to line nnn.
The part of the switch name in the square brackets is optional. For
instance "/IN" is the same as "/INSPECT".
MAKE filespec
starts tecoc to create file filespec. Does equivalent of EWfilespec$$
TECO filespec
starts tecoc to edit file filespec. Does equivalent of
EBfilespec$Y$
TECO filespec2=filespec1
starts tecoc to edit filespec1, writing to filespec2. Does
equivalent of ERfilespec1$EWfilespec2$Y$$
TECO
starts tecoc to edit last edited file. Filename is saved in file
named teco*.tmp in the current directory, unless overriden
(described below).
MUNG filespec <args>
starts tecoc to execute filespec. Equivalent to
I<args>$JEIfilespec$$
You can use "TECO @filespec <args>" instead of MUNG.
**************
The Initialization File.
Tecoc mungs (executes as teco commands) the file TECO.INI in the
current directory before processing the command line. Initialization
can be done instead by defining a TEC$INIT environment variable (the
DOS "SET" command does this). The value is either the list of teco
commands to execute or a "$" followed by the pathname of the file
containing the initialization file. This allows a single, centrally
located initialization file.
The initialization file can be used to make initial settings. It can
return a value, but the value setting is somewhat obscure.
Example:
set TEC$INIT=1es
will cause successful searches to auto-display in all teco sessions.
**************
Changing the location of the memory file.
Define the environment variable TEC$MEMORY to be "$" followed by the
pathname of the file designated the memory file.
Example:
set TEC$MEMORY=$c:\teco.mem
will cause the name of the last edit file to be stored in the file
teco.mem in the root directory of drive C.
**************
The Libary directory
Defining the environment variable TEC$LIBRARY to be a directory path
(including the final "\" or "/") will allow the EI command to fetch
teco commands from this directory if the file is not found in the
current directory.
Example:
set TEC$LIBRARY=c:\lib\teco\
will cause the directory c:\lib\teco to be searched for teco command files.
**************
Implemented flags:
ED&1 Allow carat "^" character in string searches
ED&2 Allow yank and _ unconditionally
ED&16 Failed searches preserve dot
ED&64 Move dot by one after each match in multiple occurance searches
ET&1 Type out in image mode
ET&2 Use scope for delete and control-U (default=1)
ET&4 Accept lowercase input (default=1)
ET&8 ^T reads without echo
ET&32 ^T reads with no wait
ET&128 MUNG mode (abort on error) cleared by "*" prompt
ET&2048 Swap backspace and delete (default=1)
ET&4096 We are using 8 bit characters (default=1)
ET&32768 Trap control-C
EZ&2 Don't rename files, copy them (OS/2 Version)
EZ&128 Don't stop read on formfeeds

11104
doc/teco.doc 100644

File diff suppressed because it is too large Load Diff

212
doc/wchart.txt 100644
View File

@ -0,0 +1,212 @@
NULL ignored
^A output message to terminal
^B current date
^C interrupt
^D set radix to decimal
^E form feed flag
^E<n> (match char) match ASCII code n
^E[] (match char) match one of list
^EA (match char) match alphabetics
^EB (match char) match separator character
^EC (match char) match symbol constituent
^ED (match char) match digit
^EGq (match char) match contents of q-register
^EL (match char) match line terminators
^EMx (match char) match any number of x
^EQq (string build char) use contents of q-register q
^ER (match char) match alphanumerics
^ES (match char) match spaces and/or tabs
^EUq (string build char) use ASCII code in q-register
^EV (match char) match lowercase
^EW (match char) match uppercase
^EX (match char) match anything
^F not implemented
^G^G kill command string
^G<SP> retype current command line
^G* retype entire current command line
^H current time
BS immediate mode: back up one line and type one line
TAB insert tab and text
LF ignored in commands
LF immediate mode: advance one line and type one line
VT not a TECO command
FF output a form feed to terminal
CR ignored
^N end of file flag
^Nx (match char) match any character but x
^O set radix to octal
^P not a TECO command
n^Q convert line offset to character offset
^Qx (string char) use x literally
^R value of current radix
n^R set radix to n
^Rx (string char) use x literally
^S -(length of last inserted string or found search string)
^S immediate mode: not yet implemented
^S (match char) match any separator character
^T ASCII value of next character typed in
n^T output character whose ASCII value is n to the terminal screen
^U (command line) erase current command line
^Uq put string into q-register
:^Uq append string to q-register
n^Uq put ASCII character "n" into q-register
n:^Uq append ASCII "n" to q-register
^V convert search strings to lowercase
^Vx (string char) convert x to lowercase
^W convert search strings to uppercase
^Wx (string char) convert x to uppercase
^X search mode flag
^X (match char) match any character
^Y equivalent to ".+^S,."
^Z size of text in all q-registers, plus command line
^Z^Z^Z quit TECO, leave everything as it was before TECO was entered
ESC command and string terminator
^[ like ESC
^\ not a TECO command
^] not a TECO command
^^x ASCII value of x
n^_ ones complement of n
SP ignored
! define tag
n"< test for less than zero
n"= test for equal to zero
n"> test for greater than zero
n"A test for alphabetic
n"C test for symbol constituent
n"D test for digit
n"E test for equal to zero
n"F test for false
n"G test for greater than zero
n"L test for less than zero
n"N test for not equal to zero
n"R test for alphanumeric
n"S test for successful
n"T test for true
n"U test for unsuccessful
n"V test for lowercase
n"W test for uppercase
# logical OR
$ separate TECO commands
n%q add n to q-register q, return the result
& logical AND
' end of conditional
( numeric expression grouping
) numeric expression grouping
* multiplication
*q immediate mode: save last command string in q-register q
+ addition
, numeric argument separator
- subtraction or negation
. current pointer position
/ division
/ immediate mode: type detailed explanation of error
0-9 numeric argument constructors
: modify next command
n; exit iteration of n is greater than or equal to zero
n:; exit iteration if n is less than or equal to zero
n< iterate n times
n= type n in decimal
n== type n in octal
n=== type n in hexadecimal
n:= type n in decimal, no carriage return
n:== type n in octal, no carriage return
n:=== type n in hexadecimal, no carriage return
> end iteration
? toggle trace mode
? immediate mode: type out erroneous command string
@ modify next text argument
A append next input page to edit buffer
nA ASCII value of character at .+n
n:A append n lines to input buffer
B always zero. represents beginning of edit buffer
nC advance n characters
nD delete n characters
m,nD delete between m and n (same as m,nK)
E%q write q-register to file
nE_ destructive search without page protection
EA select secondary output stream
EB open input and output files
EC copy input file to output file and close files
nEC not yet implemented
ED edit mode flag
EF close output file
EH help level flag
EI open indirect command file
EK kill output file
EL open log file
EN wildcard lookup
EO return version number of TECO
EP select secondary input stream
EQq read from file into q-register
ER open input file
ES search verification flag
ET type out control flag
EU case flagging flag
EV edit verify flag
EW open output file
EX close files and exit
EY read without yank protection
nF_ destructive search and replace
F' flow to end of conditional
F< flow to start of iteration
F> flow to end of iteration
F| flow to ELSE part of conditional
m,nFB search between locations m and n
nFB search, bounded by n lines
m,nFC search and replace between m and n
nFC search and replace over n lines
nFD search for and delete string
nFK search for string and delete intervening text
nFN paged search and replace
FR replace last string
nFS search and replace
Gq get string from q-register into edit buffer
G* get string from filespec buffer into edit buffer
G_ get string from search buffer into edit buffer
:Gq type text in q-register q
:G* type filespec
:G_ type search string
H equivalent to B,Z
I insert text
nI insert character whose ASCII value is n
nJ move pointer to J
nK kill n lines
m,nK delete between m and n (same as m,nD)
nL advance n lines
Mq execute commands in q-register
nN paged search
O go to label
nO goto selected label in list
nP advance n pages
m,nP write out characters m to n
nPW write edit buffer n times
m,nPW write out characters m to n
Qq number in q-register q
:Qq size of text in q-register q
nR back up n characters
nS search for nth occurrence of a string
::S compare string
nT type n lines
m,nT type characters between m and n
nUq put n into q-register q
nV view n lines
m,nV view m lines before, n lines after pointer
W not yet implemented
nXq put n lines into q-register q
m,nXq put character m through n into q-register q
n:Xq append n lines to q-register q
m,n:Xq append characters m through n to q-register q
Y yank a page into the edit buffer
Z end of buffer (number of characters in the edit buffer)
[q push q-register q onto q-register stack
\ value of string in edit buffer
n\ convert n to digits in edit buffer
]q pop q-register stack into q-register q
n_ destructive paged search
` not a TECO command
a-z treated as uppercase equivalents
{ not a TECO command
| start of ELSE part of conditional
} not a TECO command
~ not a TECO command
DEL not a TECO command

1
lib/change.tec 100644
View File

@ -0,0 +1 @@
ED#2EDFilename(s): ^UBenEI<UAQA-127"E8328HKGBB,Z-1XBHK|QA-27"E13101;|QA-13"E0,32ET32,0ET1;|QA:^UB'''>27:^UB27:^UBMB@^UB\0UX<HK:EN"SIEBG*27I27IHXEMEY0UW0UZ<:FN\Search string: UAQA-27"E1UE|0UEON1'<UA!N1!QA-127"E8328HKGBB,Z-1XBHK|QA-27"E13101;|QA-13"EQE"E0,32ET32,0ET1;|QA:^UB:^UB'|QA:^UB'''>27:^UBNew string to replace search string: UAQA-27"E1UE|0UEON2'<UA!N2!QA-127"E8328HKGBB,Z-1XBHK|QA-27"E13101;|QA-13"EQE"E0,32ET32,0ET1;|QA:^UB:^UB'|QA:^UB'''>@:^UB\"SQW"E1UX1310:G*1310101UW'V1UZ|1;'>QZ"NEC|EK'|1;'>QX"ENo matches.'ex\27:^UBMB

237
lib/change.tes 100644
View File

@ -0,0 +1,237 @@
! This TECO macro written by Pete Siemsen of Midcom (Orange, Ca.) to !
! run under VAX/VMS V2.3 running TECO V36, 9-Mar-1982 !
! !
! This TECO macro changes one string to another in a set of files. It prompts!
! the user for a file specification (wildcards ok) and two strings: the old !
! one and the new one. It then goes through the file(s), making the change. !
! It is designed to be a convenient tool for users who are familiar with !
! the SEARCH program on most VAXes. CHANGE prompts for input and displays its!
! output very like the SEARCH program. Note that the strings prompted for by !
! this macro can be delimited: if the first character of the string is an !
! <ESC>, then only an <ESC> will terminate the string, else both <ESC> and !
! <CR><LF> will terminate the string. !
! !
! The general way this macro works is to build a hideous TECO command string !
! in q-register B, then execute the command string. We need to build the !
! string because we have to create an FN command, at least, to make the !
! changes. !
! !
! The following Q-registers are used: !
! !
! QA number ascii value of text character from the terminal !
! !
! QW number 0 if we haven't output the file specification of !
! the file in which the string was found, 1 if we !
! already have. This guy lets us output file specs !
! only for those files which contain the string !
! !
! QX number 0 if no changes have been made, else > 0 !
! This is only used to tell us if we should output !
! the "No matches." string when we're done. !
! !
! QZ number 0 if we haven't changed a string in the file, 1 if !
! we have. This guy tells us whether to close and kill !
! the output file (when no changes were made in the !
! file) or to close the output file normally (when !
! changes have been made). !
! !
! QB text This is the biggee. It holds the TECO command string !
! we are building. It is used twice, once to build and !
! execute the EN command that presets the TECO !
! wildcard lookup buffer, and once to build and !
! execute the command string that does all the work. !
! We could build just one string and execute it, but !
! then the user wouldn't know that he's misspelled his !
! file specification until after he's typed in the !
! old and new strings. !
! !
! QE text holds an EB command so we can execute it !
ED#2ED ! make Y command work like it should !
Filename(s):  ! prompt for a file specification !
! read the wildcard file specification from the terminal and use it !
! in a TECO EN command to preset the wildcard lookup file specification !
@^UB%en% ! put EN in q-register B !
! Do an EI$ to throw away extraneous input in the type-ahead buffer. See !
! page 117-118 of the PDP-11 TECO User's Guide for an explanation of why !
! this is necessary. !
EI
<
UA ! get a character from the terminal !
QA-127"E ! if it's a delete !
8 ! send a backspace to the terminal !
32 ! send a space to the terminal !
8 ! send a backspace to the terminal !
HK ! clear the edit buffer !
GB ! get contents of q-register B !
B,Z-1XB ! copy back all but last character !
HK ! clear the edit buffer !
| ! else (it's not a delete) !
QA-27"E ! if it's an escape !
1310 ! output <CR><LF> !
1; ! get out of the loop !
| ! else (it's not a delete or escape) !
QA-13"E ! if it's a <CR> !
0,32ET ! set "read with no wait" !
 ! get the line feed that follows !
0,32ET ! set "read with wait" !
1; ! and get out of the loop !
| ! else (not <DEL>, <ESC>, or <CR>) !
QA:^UB ! append it to q-register B !
' ! endif !
' ! endif !
' ! endif !
>
27:^UB ! append an escape to q-register B !
27:^UB ! append an escape to q-register B !
MB ! execute the command in q-register B !
! The unsquished code inserted in Q-register B does the following: !
! 0UX zero the 'strings changed' flag !
! < loop through all files !
! HK clear the edit buffer !
! :EN^["S try to get a file specification !
! IEB^[ start building an EB command !
! G* fill in the file specification !
! 27I^[ put in the first terminating <ESC> !
! 27I^[ put in the second terminating <ESC> !
! HXE load the EB command into q-reg E !
! ME the EB command opens the file !
! Y get the first page of input !
! 0UW zero the 'display filespec?' flag !
! 0UZ zero the 'save output file?' flag !
! < loop for all changes in this file !
! :FN make the actual change !
@^UB%0UX < HK :EN"S IEB G* 27I 27I HXE ME Y 0UW 0UZ < :FN%
Search string:  ! prompt for the search string !
UA
QA-27"E ! if it's an <ESC> !
1UE ! set 'escape terminator only' flag !
| ! else (first character not <ESC>) !
0UE ! clear 'escape terminator only' flag !
ON1 ! jump into the loop !
' ! endif !
<
UA ! get a character from the terminal !
!N1!
QA-127"E ! if it's a delete !
8 ! send a backspace to the terminal !
32 ! send a space to the terminal !
8 ! send a backspace to the terminal !
HK ! clear the edit buffer !
GB ! get contents of q-register B !
B,Z-1XB ! copy back all but last character !
HK ! clear the edit buffer !
| ! else (it's not a delete) !
QA-27"E ! if it's an escape !
1310 ! output <CR><LF> !
1; ! get out of the loop !
| ! else (it's not a delete or escape) !
QA-13"E ! if it's a <CR> !
QE"E ! if carriage returns terminate !
0,32ET ! set "read with no wait" !
 ! get the line feed that follows !
0,32ET ! set "read with wait" !
1; ! and get out of the loop !
|
QA:^UB
:^UB
'
| ! else (not <DEL>, <ESC>, or <CR>) !
QA:^UB ! append it to q-register B !
' ! endif !
' ! endif !
' ! endif !
>
27:^UB
New string to replace search string: 
UA
QA-27"E ! if it's an <ESC> !
1UE ! set 'escape terminator only' flag !
| ! else (first character not <ESC>) !
0UE ! clear 'escape terminator only' flag !
ON2 ! jump into the loop !
' ! endif !
<
UA ! get a character from the terminal !
!N2!
QA-127"E ! if it's a delete !
8 ! send a backspace to the terminal !
32 ! send a space to the terminal !
8 ! send a backspace to the terminal !
HK ! clear the edit buffer !
GB ! get contents of q-register B !
B,Z-1XB ! copy back all but last character !
HK ! clear the edit buffer !
| ! else (it's not a delete) !
QA-27"E ! if it's an escape !
1310 ! output <CR><LF> !
1; ! get out of the loop !
| ! else (it's not a delete or escape) !
QA-13"E ! if it's a <CR> !
QE"E ! if carriage returns terminate !
0,32ET ! set "read with no wait" !
 ! get the line feed that follows !
0,32ET ! set "read with wait" !
1; ! and get out of the loop !
|
QA:^UB
:^UB
'
| ! else (not <DEL>, <ESC>, or <CR>) !
QA:^UB ! append it to q-register B !
' ! endif !
' ! endif !
' ! endif !
>
! The unsquished code appended to Q-register B does the following !
! ^[ terminate the :FN command !
! "S if a string was found !
! QW"E if haven't displayed file spec yet !
! 1UX^[ make the 'any found?' flag true !
! 13^T display a <CR> !
! 10^T display a <LF> !
! :G* display the file specification !
! 13^T display a <CR> !
! 10^T display a <LF> !
! 10^T display a <LF> !
! 1UW make 'display filespec?' flag false !
! ' endif !
! V view the changed line !
! 1UZ make the 'any found?' flag true !
! | else (search string not in file) !
! 1; terminate this loop !
! ' endif !
! > end of loop over the file !
! QZ"N if a string was found in this file !
! EC close and save the output file !
! | else (search string not in file) !
! EK close and delete the output file !
! ' endif !
! | else (no more files) !
! 1; terminate this loop !
! ' endif !
! > end of loop over all files !
! QX"E if didn't match the search string !
! ^ANo matches.^A tell the user !
! ' endif !
! ex^[ and we are finally done !
@:^UB%  "S QW"E 1UX 13 10 :G* 13 10 10 1UW ' V 1UZ | 1; ' >
QZ"N EC | EK ' | 1; ' > QX"E No matches. ' ex %
27:^UB
MB


36
lib/checkqr.tec 100644
View File

@ -0,0 +1,36 @@
Q Register A qA:= :qA=Q Register .A q.A:= :q.A=^T
Q Register B qB:= :qB=Q Register .B q.B:= :q.B=^T
Q Register C qC:= :qC=Q Register .C q.C:= :q.C=^T
Q Register D qD:= :qD=Q Register .D q.D:= :q.D=^T
Q Register E qE:= :qE=Q Register .E q.E:= :q.E=^T
Q Register F qF:= :qF=Q Register .F q.F:= :q.F=^T
Q Register G qG:= :qG=Q Register .G q.G:= :q.G=^T
Q Register H qH:= :qH=Q Register .H q.H:= :q.H=^T
Q Register I qI:= :qI=Q Register .I q.I:= :q.I=^T
Q Register J qJ:= :qJ=Q Register .J q.J:= :q.J=^T
Q Register K qK:= :qK=Q Register .K q.K:= :q.K=^T
Q Register L qL:= :qL=Q Register .L q.L:= :q.L=^T
Q Register M qM:= :qM=Q Register .M q.M:= :q.M=^T
Q Register N qN:= :qN=Q Register .N q.N:= :q.N=^T
Q Register O qO:= :qO=Q Register .O q.O:= :q.O=^T
Q Register P qP:= :qP=Q Register .P q.P:= :q.P=^T
Q Register Q qQ:= :qQ=Q Register .Q q.Q:= :q.Q=^T
Q Register R qR:= :qR=Q Register .R q.R:= :q.R=^T
Q Register S qS:= :qS=Q Register .S q.S:= :q.S=^T
Q Register T qT:= :qT=Q Register .T q.T:= :q.T=^T
Q Register U qU:= :qU=Q Register .U q.U:= :q.U=^T
Q Register V qV:= :qV=Q Register .V q.V:= :q.V=^T
Q Register W qW:= :qW=Q Register .W q.W:= :q.W=^T
Q Register X qX:= :qX=Q Register .X q.X:= :q.X=^T
Q Register Y qY:= :qY=Q Register .Y q.Y:= :q.Y=^T
Q Register Z qZ:= :qZ=Q Register .Z q.Z:= :q.Z=^T
Q Register 0 q0:= :q0=Q Register .0 q.0:= :q.0=^T
Q Register 1 q1:= :q1=Q Register .1 q.1:= :q.1=^T
Q Register 2 q2:= :q2=Q Register .2 q.2:= :q.2=^T
Q Register 3 q3:= :q3=Q Register .3 q.3:= :q.3=^T
Q Register 4 q4:= :q4=Q Register .4 q.4:= :q.4=^T
Q Register 5 q5:= :q5=Q Register .5 q.5:= :q.5=^T
Q Register 6 q6:= :q6=Q Register .6 q.6:= :q.6=^T
Q Register 7 q7:= :q7=Q Register .7 q.7:= :q.7=^T
Q Register 8 q8:= :q8=Q Register .8 q.8:= :q.8=^T
Q Register 9 q9:= :q9=Q Register .9 q.9:= :q.9=^T

8
lib/date.tec 100644
View File

@ -0,0 +1,8 @@
!DATE.TES!EI[D[Y[W[H[M[S[0[1U0(Q0/32)&15UM(Q0)&31UD(Q0/512)UYQDUW
QM-2"=31%W'QM-3"=59%W'QM-4"=90%W'QM-5"=120%W'QM-6"=151%W'QM-7"=181%W'
QM-8"=212%W'QM-9"=243%W'QM-10"=273%W'QM-11"=304%W'QM-12"=334%W'QY&3"=
QW-59">1%W''QY+QW+(QY-1/4)U1Q1-(Q1/7*7)U1Q1"=WSUN'Q1-1"=WMON'
Q1-2"=WTUE'Q1-3"=WWED'Q1-4"=WTHU'Q1-5"=WFRI'Q1-6"=WSAT'*2U0
Q0/3600UHQH*3600U1(Q0-Q1)/60UN(Q0-Q1)-(QN*60)US:GW32QM-10"<48'QM:=
47QD-10"<48'QD:=471900+QY:=32QH-10"<48'QH:=58QN-10"<48'QN:=58
QS-10"<48'QS=]1]0]S]M]H]W]Y]D]M

96
lib/date.tes 100644
View File

@ -0,0 +1,96 @@
!DATE.TEC!
! display the current date and time: !
! ^B == ((year-1900)*16+month)*32+day !
! ^H == (seconds since midnight)/2 !
ei
[M[D[Y[W[H[M[S[0[1 ! save used Q-reg's !
! Get MM/DD/YYYY in Q-reg's M,D,Y !
^B U0 ! 0.num = encoded date !
(Q0/32) & 15 UM ! M.num = month !
(Q0) & 31 UD ! D.num = day !
(Q0/512) UY ! Y.num = year !
! Get day of week in Q-reg W !
QD UW ! W.num = days this month !
QM-2 "= 31%W | ! add days before this month !
QM-3 "= 59%W |
QM-4 "= 90%W |
QM-5 "= 120%W |
QM-6 "= 151%W |
QM-7 "= 181%W |
QM-8 "= 212%W |
QM-9 "= 243%W |
QM-10 "= 273%W |
QM-11 "= 304%W |
QM-12 "= 334%W '''''''''''
QY & 3 "= ! correct for leap years !
QW-59 ">
1%W
'
'
QY+QW+(QY-1/4) U1
Q1-(Q1/7*7) U1
Q1-0"= @^UW%Sunday% |
Q1-1"= @^UW%Monday% |
Q1-2"= @^UW%Tuesday% |
Q1-3"= @^UW%Wednesday% |
Q1-4"= @^UW%Thursday% |
Q1-5"= @^UW%Friday% |
Q1-6"= @^UW%Saturday% '''''''
QM-1"= @^UM%January% | ! get name of month in Q-reg M !
QM-2"= @^UM%February% |
QM-3"= @^UM%March% |
QM-4"= @^UM%April% |
QM-5"= @^UM%May% |
QM-6"= @^UM%June% |
QM-7"= @^UM%July% |
QM-8"= @^UM%August% |
QM-9"= @^UM%September% |
QM-10"= @^UM%October% |
QM-11"= @^UM%November% |
QM-12"= @^UM%December% ''''''''''''
! Get HH:MM:SS in Q-reg's H,N,S !
^H*2 U0 ! 0.num = second's since midnight !
Q0/3600 UH ! H.num = hours !
QH*3600 U1 ! 1.num = hours (in seconds) !
(Q0-Q1)/60 UN ! N.num = minutes !
(Q0-Q1)-(QN*60) US ! S.num = seconds !
! Display DAY MM/DD/YYYY !
:GW ! display DAY !
32 ! display <SP> !
:GM ! display MONTH !
32 ! display <SP> !
! QM-10"< 48^T ' display leading zero? !
! QM:= display MM !
! 47^T display / !
QD-10"< 48^T ' ! display leading zero? !
QD:= ! display DD !
! 47^T display / !
44 ! display , !
32 ! display <SP> !
1900+QY := ! display YYYY !
32 ! display <SP> !
! Display HH:MM:DD !
QH-10"< 48^T ' ! display leading zero? !
QH:= ! display HH !
58^T ! display : !
QN-10"< 48^T ' ! display leading zero? !
QN:= ! display MM !
58^T ! display : !
QS-10"< 48^T ' ! display leading zero? !
QS= ! display SS<CR><LF> !
]1]0]S]M]H]W]Y]D]M ! restore used Q-reg's !


8
lib/detab.tec 100644
View File

@ -0,0 +1,8 @@

********************************************************
This macro will read the file and transform all <TAB>
characters into the appropriate number of <SPACE> chars.
Note that tab stops are assumed to be at every 8 spaces.
********************************************************
FEBH:XF27:FHKMFY<:N "U1;'.UB0L.UAQB-QAUC<QC-9"L1;'-8%C>9-QCUD
S -DQD<I >>EX

44
lib/detab.tes 100644
View File

@ -0,0 +1,44 @@
! Author: John Guidi, sped up by Pete Siemsen
Date: 20-July-79
Useage: MUNG DETAB filespec
Abstract: All tabs in the file specified will be replaced with
spaces. Tab stops are assumed to be at every 8 spaces.
!

********************************************************
This macro will read the file and transform all <TAB>
characters into the appropriate number of <SPACE> chars.
Note that tab stops are assumed to be at every 8 spaces.
********************************************************

@^UF%EB% ! set F up with EB command !
H:XF ! append filespec to F !
27@:^UF%% ! append <ESC> to F !
HK ! clear text buffer !
MF ! execute F to open input and output files !
Y ! pull first page into text buffer !
<
:@N/ /"U1;' ! search for a tab, leave loop when unsuccessful !
.UB ! put current pointer in B !
0L .UA ! put pointer to begining of line in A !
QB-QAUC ! put how many characters up to TAB in C !
< ! subtract 8 until QC is less than 9 !
QC-9"L
1;
'
-8%C
>
9-QCUD ! put number of spaces into D !
@S/ /-D ! find the tab again and delete it !
QD< ! insert the spaces !
@I/ /
>
>
EX ! close files !


3
lib/dir.tec 100644
View File

@ -0,0 +1,3 @@
!dir.tes-display directory![0[1[2.U0ZJ.U10U21*.*Q1"N80-Q1"G0,Q1X1''
EN^eq1Q1J<:EN;G*(1%2)-5"E13I10I0U2|15+<32I>'>Q1,ZTQ1,ZKQ0J]2]1]0


32
lib/dir.tes 100644
View File

@ -0,0 +1,32 @@
!dir.tes-display directory!
[0 [1 [2 ! save Q-regs 0-2 !
.u0 ! remember where we are !
zj ! jump to end of buffer !
.u1 ! remember old end of buffer !
0u2 ! zero column count !
@^u1%*.*% ! default is get dir of everything !
q1"n ! is buffer not empty? !
80-q1"g ! is buffer length < maxpath? !
0,q1x1 ! assume edit buf = filespec !
' ! endif !
' ! endif !
en^eq1 ! preset wildcard lookup !
q1j ! jump to end of buffer !
< ! <build filename display !
:en; ! return filename, break if none !
g* ! put filename into edit buffer !
(1%2)-5"e ! is fifth and final column? !
13@i%% ! insert <CR> !
10@i%% ! insert <LF> !
0u2 ! reset column count !
| ! else !
15+^S< ! <do column mod 15 times !
32@i%% ! insert <SPACE> !
> ! > !
' ! endif !
> ! > !
q1,zt ! display what we built !
q1,zk ! kill what we built !
q0j ! jump to where we were !
]2 ]1 ]0 ! restore Q-regs 0-2 !


3
lib/lowcase.tec 100644
View File

@ -0,0 +1,3 @@
@^ul/<0a-13"e1;'0a"w0a+32id|c'>v/
 q - register L loaded


6
lib/makprnt.tec 100644
View File

@ -0,0 +1,6 @@
This TECO macro makes a TECO command string printable by converting
escape characters to dollar signs and all control characters to the
tilde-character string which is usually printed on the terminal, except
for ^I (tab), ^M (cr), ^L (ff), and ^J (lf).
<Z-."E1;'0A-31"GCF<'0A-27"EI$DF<'0A-13"ECF<'0A-10"ECF<'0A-9"ECF<'
0A-12"ECF<'I^0A+64ID>

16
lib/makprnt.tes 100644
View File

@ -0,0 +1,16 @@
This TECO macro makes a TECO command string printable by converting
escape characters to dollar signs and all control characters to the
tilde-character string which is usually printed on the terminal, except
for ^I (tab), ^M (cr), ^L (ff), and ^J (lf).

<
z-."e1;' ! if at end of buffer, exit the loop !
0a-31"gcf<' ! it it's already printable, skip it !
0a-27"ei$df<' ! if it's ESCAPE, make it into a dollar-sign !
0a-13"ecf<' ! if it's carriage return, skip it !
0a-10"ecf<' ! if it's line feed, skip it !
0a-9"ecf<' ! if it's TAB, skip it !
0a-12"ecf<' ! if it's form feed, skip it !
i^0a+64id
>


80
lib/squ.tec 100644
View File

@ -0,0 +1,80 @@
!SQU.TEC V40.00!@F0ED0ET&128"N0,0XP'0,128ETJ<@FS%^ES%%;>J:S/UB
QB"TET&64"E
''@R\[0[1[2[3+0U3X0K.U1ZJ.U2Q3&127"R|
?Invalid Q-register in INPLIN
OEXIT'IQ2,.XQ3&127IQ2,.X1Q2,.K!PROMPT!13ET&512"N0,1ET271,0ET
0:W-4"E['J|10'.-Q2+(0)"G0T|:G0Q2,ZT'!GETCH!U0Q0-127"EZ-Q2"N-D'
OPROMPT'Q0-21"EQ2,ZKOPROMPT'Q0-18"E1310:G0Q2,ZTOGETCH'Q0-26"E
Q2,ZK%0'Q0-27"E1310ODONE'Q3&128"EQ0-10"E13ODONE'Q0-13"EODONE'
'Q0IOGETCH!DONE!M1Q2,.K!EXIT!Q1J]3]2]1]0\0,0X9J:@FS%/D%%"S
::@FS%:%%"S0AQD|QY'|QB"TQ|IDelete CR/LF (Y/N) <N>? QMR''0QQ"A
0QQ&95-Y"E9DA.......TD..D.......U....Z...V.D''!BADNUM!0UO:Q9"NJ
:@FS%/L%%"S%/L specified with /D, /L ignored
::@FS%:%%"S0A"D<D.-Z;0A"D>'|D'''|J:@FS%/L%%"S::@FS%:%%"S0AQ0A"D<D
.-Z;0A"D0A:Q>'|D'|QY'|QB"TQ|
ISet line lengths (Y for 70, N, or length) <N>? QMR''0QQ"A
0QQ&95-Y"E9DA.......TO..O.......U....Z...V.O70UO''0QQ"D.UQZJGQC\UO
D.-Z"NZKQQJOBADNUM'QQJQO"EOBADNUM'
9DA.......TO..O.......U....Z...V.O'':Q9"NJ:@FS%/B%%"S::@FS%:%%"S
0A-N"E%/B:N specified with /D or /L, /B:N ignored
'D''|J:@FS%/B%%"S::@FS%:%%"S0AQD|QY'|QB"TQ|
IDelete blank lines (Y/N) <N>? QMR''0QQ"A0QQ&95-Y"E
9DA.......TB..........U....Z...V.D''':Q9"E
9DA.......T...........U....Z...V.D'J:@FS%/T%%"S::@FS%:%%"S0AQD|
QY'|QB"TQ|IDelete lexical TABs and FORM FEEDs (Y/N) <N>? QMR''
0QQ"A0QQ&95Q'0QQ-Y"EJG99JDIO12JDIOJ0,33X90,33K'CJ:@FS%/C%%"S
::@FS%:%%"S0AQD|QY'|QB"TQ|
IDelete comments (Y for SP/TAB, N, or set) <N>? QMR'':QQ"EQN'0QQUQ
QQ"VQQ-32UQ'QQ-N"E:9A|:9CQQ-Y"E32C9:C|GQXCK''
:91..1..........................:9@....EF1.$...1$$.1.$.1..1..1.1^$
:9.LLLLLLLLLLLLLLLLLLLLLLLLLL....D8/#*&\?()$!@1U8126<Q8:8%8>W
ET&512"EJ:@FS%/W%%"S::@FS%:%%"SD''|J:@FS%/W%%"S::@FS%:%%"S0AQD|QY'
|QB"TQ|IWatch progress (Y/N) <N>? QMR''0QQ"A0QQ&95-Y"E0:W-2"E
4,0:W'W-1W'''KJ:@FS%/A%%"S::@FS%:%%"S0AQD|QY'|QB"TQY|
IAutomatic mode (Y for %, N, or set) <N>? QMR'':QQ"N0QQUQQQ"VQQ-32UQ
'QQ-N"NQQ-Y"E%K|GQXKK'''0UHJ:@FS%/E%%"S::@FS%:%%"S0AQD|QY'|
QB"TQ|IAllow adjacent ESCapes (Y/N) <N>? QMR''0QQ"A0QQ&95-Y"E-1UH
''@Z*[10U1:QW"N-1,3:W0,4:W0,5:W'<!..!MW!.!ME;0AU0Q0"LOOFFEND'C
Q0&128"NQ0&127U0-DQ0I'!DISP!Q0Q90O^EQ0!L!Q0-32U0-DQ0IODISP!^!
0A&31U0C-2DQH"FQ0-27"E0A-27"EI^[CO..'.US0UT<-.;R0AUTQT&128"EQT-10"N
0;|-.;-1A-128-13"N0;'''>QSJQT-27"EI '''Q0IODISP!B!-1+2"E-2D'O..
!O!-D."N-1A&128"N-D'.-1"G-1A-10"E-2A-128-13"EQ0-13"E-2D|O..''''
Q0#128IQ0-13"E.-Z"E10IR'0A&127-10"ED'10I''O..!U!271.UC0AU0C
Q0-."E0AU0C'Q0"VQ0-32U0-DQ0I'Q1"T0A-(1A)"EO$$'|0A-27"EO$$''.USQ1"T
0A1D':QW"N:S^EQ1"UOSTRINGFAIL'.,4:WQSJMW':QK"E:QW"E0T10T'7ETUQ
ET#8#4-4ETU0QQET|G1R::S^EGK"S-DNU0|DYU0'':QW"N0,4:W32768W'Q0-Y"E
[E[C[SE-1UE0A-^^0Q1:E:E"E0UE'QEMZ]S]C]E"NOPRIORFAIL'CO$$$$'
O$$$!T!0U1!$!271.UC!$$!.USQ1"T0A1D'!$$$!:S^EQ1"UOSTRINGFAIL'
!$$$$!-D.UT27U0!AA!Q00QT-QS"GQSJ.,.+QT-QS:FB^EQ0"SG8:X1K0U0<
Q0Q10QSJ.,.+QT-QSFB^EQ0;%0-:Q8"EONOQUOTE'>Q0Q1U0QSJQ0IQC-1JI@
2%T''QTJQ0I0U1O..!1!0A-."EC'0A"V0A-32U0DQ0IO.'!V!CO.!@!-1U1!D!
-DO.!F!271.UC0AU0CQ0"VQ0-32U0-DQ0I'Q0-B"EO$$'Q0-C"EOF$$'
Q0-R"EO$$'Q0-S"EOF$$'Q0-N"EOF$$'Q0-_"EOF$$'O.!F$$!.US271
Q1"T0A1D':S^EQ1"UOSTRINGFAIL'-D.UT:S^EQ1"UOSTRINGFAIL'-D.UUQH"T
27U0Q00QU-QS"GQSJ.,.+QU-QS:FB^EQ0"UOF0'|OF0'|QU-QT"G27U0Q00QSJ
.,.+QU-QS:FB^EQ0"UOF0'''G8:X1K0U0<Q0Q10QSJ.,.+QU-QSFB^EQ0;
%0-:Q8"EONOQUOTE'>Q0Q1U0QSJQ0IQC-1JI@2%T2%U!F0!QTJQ0IQU-QTCQ0I
0U1O..!A!Q01.UC.USQ1"T0A1D':S^EQ1"UOSTRINGFAIL'-D.UTOAA!C!
::S^EGC"UOA'R.UCQ01Q1"T0A1D':S^EQ1"UOSTRINGFAIL'QC-1,.K0U1O..
!E!271.UC0AU0CQ0"VQ0-32U0-DQ0I'Q0-B"EO$$'Q0-G"EO$$'Q0-I"EO$$'
Q0-N"EO$$'Q0-R"EO$$'Q0-W"EO$$'Q0-_"EO$$'O.!Z!-DI^ZO..>Q1"T
1Trailing, pending @OERROR'0U10"N!OFFEND!
1End of buffer while sub-squishingOERROR!NOQUOTE!
1Can't find a quote characterOSETPOS!PRIORFAIL!
1Prior recursion level failedOSETPOS!STRINGFAIL!
1Unterminated string!SETPOS!:1 from squished .=QC\:X1K13:1
10:1QCJ0+.,.:X1|:110:1|:1.,+.:X1!ERROR!ZJMW0,0XW7?:G17
1310-1U1'Q1]1*@A*-1E.-ZQO"NZJI 'JMZ"EQO"N:QW"N-1,3:W0,4:W
0,5:W'J<MW<0A&128"N0;'C>0A&127-13"ED'D.-Z;.U0<0A&128"N0;'C><.U10L
.-Q0-1"L0;'R>Q1J-(0)-QO"GQ0J-1A-27"EI 'I
'><ZJ-Z;-1A-10"N-1A-13"N-1A-32"N0;'''-D>MW'QH"FZJ."E10I'-1A-10"N10I
'R."E13I'-1A-13"N13I''ZJ:QW"N0:W-4"E2,0:W'-1,3:W0,4:WMW'|
?Squish run failed; aborting any output
0,0XF'0*Z"EIFile <.TES or .TEC>? QMRGQ'0,0XR0,0XQEIMF0,0XFZ"E
Enter your macro then type MA$$
|J:@FS%=%%"SFEW0,.:XF.UF-:S."U:F.TEC'QFJ27:FQB"TET&64"E:F
Creating ":G*"
''0,.K'J:S."UZJI.TESHXQ:ER^EQQ"U-FS.TES.TEC''HXQHKER^EQQQB"T
ET&64"ESquishing ":G*"
'':QF"EY128,0ET<"TZJ12I':A;>MAMP|YQB"F128,0ET'"T"TZJ12I'MAMFHPW
HK|MF<"TZJ12I'MAHPWHK:Y;>'EFEX''

1773
lib/squ.tes 100644

File diff suppressed because it is too large Load Diff

9
lib/sub.tec 100644
View File

@ -0,0 +1,9 @@
:EN*.DIR"FNo subdirectories1310^C'
<:EN"FOL1'G*I
>!L1!J:S]"FNo subdirectories
^C'
Subdirectories of 0T
-C0,.XAJ<FS].;FS.DIR;1];L>J< :S:"F^C'T-6C.U1I:ENL-2CI*.DIR27II"FOL327II'<:EN27II"FOL227II'I27IIG*27II0LFS]27II.27IIFS.27II]27II0L S:27II.U1S]27IIQ1,.T
SR;127II0,.K>!L3!^C27II!L2!0,.XN0,.KMNL>

6
lib/tst.tec 100644
View File

@ -0,0 +1,6 @@
10u.n ! put 10 in main-level q-register .n !
@^U1/20u.n:m2/27:^U1 ! put 20u.n$:m2$$ in q-register 1 !
@^U2/:m3/27:^U2 ! put :m3$$ in q-register 2 !
@^U3/q.n=/27:^U3 ! put q.n=$$ into q-register 3 !


92
lib/tstbsl.tec 100644
View File

@ -0,0 +1,92 @@

Test the backslash command

! test 1: \ to get a number that's terminated by end-of-edit-buffer
test 2: \ to get a number that's terminated by characters
test 3: \ to get a number that's preceded by a unary plus
test 4: \ to get a number that's preceded by a unary minus
test 5: \ to write a digit string into the edit buffer
!
i1234
js1j ! set ^S to 1, to be sure the backslash sets it !
\-1234"e
.-4"e
^s+4"e
test 1 passed13^T10^T
|
test 1 failed, ^s is wrong13^T10^T
'
|
test 1 failed, dot is wrong13^T10^T
'
|
test 1 failed, should be 123413^T10^T
'
hki1234xyz
js1j ! set ^S to 1, to be sure the backslash sets it !
\-1234"e
.-4"e
^s+4"e
test 2 passed13^T10^T
|
test 2 failed, ^s is wrong13^T10^T
'
|
test 2 failed, dot is wrong13^T10^T
'
|
test 2 failed, should be 123413^T10^T
'
hki+1234xyz
js1j ! set ^S to 1, to be sure the backslash sets it !
\-1234"e
.-5"e
^s+5"e
test 3 passed13^T10^T
|
test 3 failed, ^s is wrong13^T10^T
'
|
test 3 failed, dot is wrong13^T10^T
'
|
test 3 failed, should be 123413^T10^T
'
hki-1234xyz
js1j ! set ^S to 1, to be sure the backslash sets it !
\+1234"e
.-5"e
^s+5"e
test 4 passed13^T10^T
|
test 4 failed, ^s is wrong13^T10^T
'
|
test 4 failed, dot is wrong13^T10^T
'
|
test 4 failed, should be 123413^T10^T
'
hk
i1js1jhk ! set ^S to 1, to be sure the backslash sets it !
1234\j::s1234"s
^s+4"e
test 5 passed13^T10^T
|
test 5 failed, ^s is wrong13^T10^T
'
|
test 5 failed.13^T10^T
'
hkex

73
lib/tstcss.tec 100644
View File

@ -0,0 +1,73 @@

Test the ::S command

! test 1: 1-character argument
test 2: 2-character argument
test 3: 3-character argument last char on end-of-buffer
test 4: no argument: use same one as test 3
test 5: 3-character argument that can't be found
!
iabcdef
3j::sd"s
.-4"e
^s+1"e
test 1 passed1310
|
test 1 failed, ^S is wrong13^T10^T
'
|
test 1 failed, dot is wrong13^T10^T
'
|
test 1 failed, search failed13^t10^T
'
3j::sde"s
.-5"e
^s+2"e
test 2 passed1310
|
test 2 failed, ^S is wrong13^T10^T
'
|
test 2 failed, dot is wrong13^T10^T
'
|
test 2 failed, search failed13^t10^T
'
3j::sdef"s
.-6"e
^s+3"e
test 3 passed1310
|
test 3 failed, ^S is wrong13^T10^T
'
|
test 3 failed, dot is wrong13^T10^T
'
|
test 3 failed, search failed13^t10^T
'
3j::s"s
.-6"e
^s+3"e
test 4 passed1310
|
test 4 failed, ^S is wrong13^T10^T
'
|
test 4 failed, dot is wrong13^T10^T
'
|
test 4 failed, search failed13^t10^T
'
3j::sabc"f
.-3"e
test 5 passed1310
|
test 5 failed, dot is wrong13^T10^T
'
|
test 5 succeeded, search failed13^t10^T
'
hkex

102
lib/tstequ.tec 100644
View File

@ -0,0 +1,102 @@

This file tests the =, ==, ===, :=, :== and :=== commands.
It is dependent on the size in bytes of the variables used to
hold TECO numbers. This test gives the results to be expected
for a 16-bit implementation like TECO-11 and a 32-bit implementation
like TECO-C on a VAX.
Please strike any key to continue, or ^A to exit

-1"eex'

Test of = command. You should see
(16-bit implementation) (32-bit implementation)
-31072 100000
2 2
1 1
0 0
-1 -1
-2 -2
31072 -100000

100000=2=1=0=-1=-2=-100000=

Please strike any key to continue, or ^A to exit

-1"eex'

Test of == command. You should see
(16-bit implementation) (32-bit implementation)
72460 72460
2 2
1 1
0 0
177777 37777777777
177776 37777777776
105320 37777705320

30000==2==1==0==-1==-2==-30000==

Please strike any key to continue, or ^A to exit

-1"eex'

Test of === command. You should see
(16-bit implementation) (32-bit implementation)
7530 7530
2 2
1 1
0 0
FFFF FFFFFFFF
FFFE FFFFFFFE
8AD0 FFFF8AD0

30000===2===1===0===-1===-2===-30000===

Please strike any key to continue, or ^A to exit

-1"eex'

Test of := command. You should see
30000,2,1,0,-1,-2,-30000 (16 or 32 bit implementation)

30000:=,2:=,1:=,0:=,-1:=,-2:=,-30000:=

Please strike any key to continue, or ^A to exit

-1"eex'

Test of :== command. You should see
72460,2,1,0,177777,177776,105320 (16 bit implementation)
72460,2,1,0,37777777777,37777777776,37777705320 (32 bit implementation)

30000:==,2:==,1:==,0:==,-1:==,-2:==,-30000:==

Please strike any key to continue, or ^A to exit

-1"eex'

Test of :=== command. You should see
7530,2,1,0,FFFF,FFFE,8AD0 (16 bit implementation)
7350,2,1,0,FFFFFFFF,FFFFFFFE,FFFF8AD0 (32 bit implementation)

30000:===,2:===,1:===,0:===,-1:===,-2:===,-30000:===
ex

129
lib/tsto.tec 100644
View File

@ -0,0 +1,129 @@

Test the O command.

!
Testing jump commands is a little hairy. I do it by setting a
state variable. At every label, I test that we're in the proper state.
!
1us@O!test1!
!tag2!
qs-4"e
test 4 passed (jumping to 3rd (last) tag in a list works)13^T10^T
|
reached tag2 by mistake, terminating.13^T10^Todone
'
5usOtest5
!tag1!
qs-3"e
test 3 passed (jumping to 2nd (middle) tag in a list works)13^T10^T
|
reached tag1 by mistake, terminating.13^T10^Todone
'
4us2@O!tag0,tag1,tag2!
!tag0!
qs-2"e
test 2 passed (jumping to 0th (first) tag in a list works)13^T10^T
|
reached tag0 by mistake, terminating.13^T10^Todone
'
3us1@O!tag0,tag1,tag2!
!test1!
qs-1"e
test 1 passed (a simple jump works)13^T10^T
|
reached test1 by mistake, terminating.13^T10^Todone
'
2us0@O!tag0,tag1,tag2!
!test5!
qs-5"e
test 5 passed (another simple jump, escape-terminated)13^T10^T
|
reached test5 by mistake, terminating.13^T10^Todone
'
6us3@O!tag0,tag1,tag2!
qs-6"e
test 6 passed (too large tag index causes fall through)13^T10^T
|
test 6 failed, 13^T10^T
'
7us-1@O!tag0,tag1,tag2!
qs-7"e
test 7 passed (too small tag index causes fall through)13^T10^T
|
test 7 failed, 13^T10^T
'
8us2@O!tag0,tag1,,tag2!
qs-8"e
test 8 passed (an index to a null tag causes fall through)13^T10^T
|
test 8 failed, 13^T10^T
'
9us3@O!tag0,tag1,,test9!
test 9 failed, 13^T10^T
10usotest10
!test9!
qs-9"e
test 9 passed (index to tag past null tag works)13^T10^T
|
test 9 failed, 13^T10^T
'
10us2@O!,,test10!
test 9 failed, 13^T10^T
10usotest10
!test10!
qs-10"e
test 10 passed (index to tag past 2 null tags works)13^T10^T
|
test 10 failed, 13^T10^T
'
11us
<
<
<
<
@O!endloop2!
>
>
>
!endloop2!
qs-11"e
test 11 passed (jumping from inner to outer loop works)13^T10^T
12us@O!done!
|
reached endloop2 by mistake, terminating.13^T10^Todone
'
>
!done!
qs-12"e
test 12 passed (jumping completely out of nested loops works)13^T10^T
|
test 12 failed, 13^T10^T
'
ex

120
lib/tstqr.tec 100644
View File

@ -0,0 +1,120 @@
ei
Test q-register commands

1uaqa-1"nobadtest1'
2ubqb-2"nobadtest1'
3ucqc-3"nobadtest1'
4udqd-4"nobadtest1'
5ueqe-5"nobadtest1'
6ufqf-6"nobadtest1'
7ugqg-7"nobadtest1'
8uhqh-8"nobadtest1'
9uiqi-9"nobadtest1'
10ujqj-10"nobadtest1'
11ukqk-11"nobadtest1'
12ulql-12"nobadtest1'
13umqm-13"nobadtest1'
14unqn-14"nobadtest1'
15uoqo-15"nobadtest1'
16upqp-16"nobadtest1'
17uqqq-17"nobadtest1'
18urqr-18"nobadtest1'
19usqs-19"nobadtest1'
20utqt-20"nobadtest1'
21uuqu-21"nobadtest1'
22uvqv-22"nobadtest1'
23uwqw-23"nobadtest1'
24uxqx-24"nobadtest1'
25uyqy-25"nobadtest1'
26uzqz-26"nobadtest1'
1uAqA-1"nobadtest1'
2uBqB-2"nobadtest1'
3uCqC-3"nobadtest1'
4uDqD-4"nobadtest1'
5uEqE-5"nobadtest1'
6uFqF-6"nobadtest1'
7uGqG-7"nobadtest1'
8uHqH-8"nobadtest1'
9uIqI-9"nobadtest1'
10uJqJ-10"nobadtest1'
11uKqK-11"nobadtest1'
12uLqL-12"nobadtest1'
13uMqM-13"nobadtest1'
14uNqN-14"nobadtest1'
15uOqO-15"nobadtest1'
16uPqP-16"nobadtest1'
17uQqQ-17"nobadtest1'
18uRqR-18"nobadtest1'
19uSqS-19"nobadtest1'
20uTqT-20"nobadtest1'
21uUqU-21"nobadtest1'
22uVqV-22"nobadtest1'
23uWqW-23"nobadtest1'
24uXqX-24"nobadtest1'
25uYqY-25"nobadtest1'
26uZqZ-26"nobadtest1'
-9u0q0+9"nobadtest1'
-8u1q1+8"nobadtest1'
-7u2q2+7"nobadtest1'
-6u3q3+6"nobadtest1'
-5u4q4+5"nobadtest1'
-4u5q5+4"nobadtest1'
-3u6q6+3"nobadtest1'
-2u7q7+2"nobadtest1'
-1u8q8+1"nobadtest1'
0u9q9"nobadtest1'
101,102ua-101"nobadtest1'qa-102"nobadtest1'
 test 1 passed (basic U and Q commands work)13^T10^T
otest1done
!badtest1!
 test 1 failed.13^T10^T
!test1done!
10ua5ub2uc(qa+qb+qc)-17"e
 test 2 passed (q-registers seem to work in expressions)13^T10^T
|
 test 2 failed13^T10^T
'
! This test helps to see what's really supposed to happen in TECO when
you do a :M command and then refer to local q-registers in the macro.
The correct behavior is to use the local q-registers from the previous
macro level, if there are any. If not, use the ones from the previous
level, etc. The test verifies that three levels deep, values from
level 1 can be accessed if no intervening levels have local q-registers.
!
10u.n ! put 10 in main-level q-register .n !
@^U1/20u.n:m2/ ! put 20u.n$:m2$$ in q-register 1 !
27:^U1
@^U2/:m3/ ! put :m3$$ in q-register 2 !
27:^U2
@^U3/q.n/ ! put q.n$$ into q-register 3 !
27:^U3
m1+q.n-30"e
 test 3 passed (:M commands use old local q-registers)13^T10^T
|
 test 3 failed13^T10^T
'
:m1+q.n-40"e
 test 4 passed (:M commands use old local q-registers)13^T10^T
|
 test 4 failed13^T10^T
'
! If local macros are called, the : modifier is assumed (no local regs) !
10u.n ! put 10 in main-level q-register .n !
@^U1/20u.nm.2/ ! put 20u.n$m.2$$ in q-register .1 !
27:^U1
@^U.2/m.3/ ! put m.3$$ in q-register .2 !
27:^U.2
@^U.3/q.n/ ! put q.n$$ into q-register .3 !
27:^U.3
:m1+q.n-40"e
 test 5 passed (M. commands use old local q-registers)13^T10^T
|
 test 5 failed13^T10^T
'
ex

544
lib/tstsrc.tec 100644
View File

@ -0,0 +1,544 @@

This file tests search commands.
Please press the space bar to continue, or CTRL-A to exit

-1"eex'

Test some simple searches

hk iabcdefghi j
forward search for 1st char  sa .-1"e passed
 | failed!!!
 '
forward search for 4th char  sd .-4"e passed
 | failed!!!
'
forward search for last char  si .-9"e passed
 | failed!!!
'
backwards search for 4th char  -sd .-4"e passed
 | failed!!!
'
backwards search for 1st char  -sa .-1"e passed
 | failed!!!
'

Please press the space bar to continue, or CTRL-A to exit

-1"eex'

Test the ^Ea match construct

test 1  jsa .-1"e passed
 | failed!!!
'
test 2  jsba .-3"e passed
 | failed!!!
'
test 3  jsha .-9"e passed
 | failed!!!
'
test 4  jsbad .-4"e passed
 | failed!!!
'
test 5  jsbaaa .-5"e passed
 | failed!!!
'
test 6  jsaaaaaaaaa .-9"e passed
 | failed!!!
'
hk
0i1i2i3i4i5i6i7i8i9i10i11i12i13i14i15i16i17i
18i19i20i21i22i23i24i25i26i27i28i29i30i31i
i !"#$%&'()*+,-./0123456789:;<=>?@[\]^_`{|}~127iiA
test 7  jsa .-77"e passed
 | failed!!!
'

Test the ^Eb match construct

hki!@#$%&*()
jsb.-1"etest 1 passed
|test 1 failed!!!
'
js!b.-2"etest 2 passed
|test 2 failed!!!
'
js(b.-9"etest 3 passed
|test 3 failed!!!
'
js!b#.-3"etest 4 passed
|test 4 failed!!!
'
js!bbb.-4"etest 5 passed
|test 5 failed!!!
'
jsbbbbbbbbb.-9"etest 6 passed
|test 6 failed!!!
'
hkiABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!
jsb.-63"etest 7 passed
|test 7 failed!!!
'

Please press the space bar to continue, or CTRL-A to exit

-1"eex'

Test the ^Ec match construct

hkiabcdefghi
jsc.-1"etest 1 passed
|test 1 failed!!!
'
jsbc.-3"etest 2 passed
|test 2 failed!!!
'
jshc.-9"etest 3 passed
|test 3 failed!!!
'
jsbcd.-4"etest 4 passed
|test 4 failed!!!
'
jsbccc.-5"etest 5 passed
|test 5 failed!!!
'
jsccccccccc.-9"etest 6 passed
|test 6 failed!!!
'
hk0i1i2i3i4i5i6i7i8i9i10i11i12i13i14i15i16i17i
18i19i20i21i22i23i24i25i26i27i28i29i30i31i
i !"#%&'()*+,-/:;<=>?@[\]^`{|}~127iiA
jsc.-64"etest 7 passed
|test 7 failed!!!
'
hki0123456789$.
jscccccccccccc.-12"etest 8 passed
|test 8 failed!!!
'

Test the ^Ed match construct

hki0123456789
jsd.-1"etest 1 passed
|test 1 failed!!!
'
js1d.-3"etest 2 passed
|test 2 failed!!!
'
js8d.-10"etest 3 passed
|test 3 failed!!!
'
js2d4.-5"etest 4 passed
|test 4 failed!!!
'
js2ddd.-6"etest 5 passed
|test 5 failed!!!
'
jsdddddddddd.-10"etest 6 passed
|test 6 failed!!!
'
hk0i1i2i3i4i5i6i7i8i9i10i11i12i13i14i15i16i17i
18i19i20i21i22i23i24i25i26i27i28i29i30i31i
i !"#$%&'()*+,-./:;<=>?@ABCDEFGHIJKLMNOPQRSTU
iVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~127ii0
jsd.-119"etest 7 passed
|test 7 failed!!!
'

Please press the space bar to continue, or CTRL-A to exit

-1"eex'

Test the ^Eg match construct

^Uadef
hkiabcdefghi
jsGa.-4"etest 1 passed
|test 1 failed!!!
'
0^Ua1:^Ua2:^Ua3:^Ua4:^Ua5:^Ua6:^Ua7:^Ua8:^Ua9:^Ua10:^Ua11:^Ua
12:^Ua13:^Ua14:^Ua15:^Ua16:^Ua17:^Ua18:^Ua19:^Ua20:^Ua21:^Ua
22:^Ua23:^Ua24:^Ua25:^Ua26:^Ua27:^Ua28:^Ua29:^Ua30:^Ua31:^Ua
:^Ua !"#$%&'()*+,-./0123456789:;<=>?@JKLMNOPQRSTU
:^UaVWXYZ[\]^_`jklmnopqrstuvwxyz{|}127i
j:sga"ftest 2 passed
|test 2 failed!!!
'
hkiabcdefghi@
jsga.-10"etest 3 passed
|test 3 failed!!!
'
hki@
jsga.-1"etest 4 passed
|test 4 failed!!!
'

Test the ^El match construct

!10 is line feed, 11 is vertical tab, 12 is form feed!
hk10i10i10i10i10i10i10i10i11i12i
jsl.-1"etest 1 passed
|test 1 failed!!!
'
hkixx10i10i10i10i10i10i10i11i12i
jsxxl.-3"etest 2 passed
|test 2 failed!!!
'
hkixxxxxxxx11i12i
js l.-10"etest 3 passed
|test 3 failed!!!
'
hk10i10i10i10i10i10i10i10i11i12i
jsllllllllll.-10"etest 4 passed
|test 4 failed!!!
'
hk0i1i2i3i4i5i6i7i8i9i13i14i15i16i17i18i19i20i21i22i
23i24i25i26i27i28i29i30i31i
i !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU
iVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~127i12i
jsl.-126"etest 5 passed
|test 5 failed!!!
'

Please press the space bar to continue, or CTRL-A to exit

-1"eex'

Test the ^Er match construct

hki0123456789
jsr.-1"etest 1 passed
|test 1 failed!!!
'
js1r.-3"etest 2 passed
|test 2 failed!!!
'
js8r.-10"etest 3 passed
|test 3 failed!!!
'
js2r4.-5"etest 4 passed
|test 4 failed!!!
'
js2rrr.-6"etest 5 passed
|test 5 failed!!!
'
jsrrrrrrrrrr.-10"etest 6 passed
|test 6 failed!!!
'
hk0i1i2i3i4i5i6i7i8i9i10i11i12i13i14i15i16i17i
18i19i20i21i22i23i24i25i26i27i28i29i30i31i
i !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~127iia
jsr.-67"etest 7 passed
|test 7 failed!!!
'

Please press the space bar to continue, or CTRL-A to exit

-1"eex'

Test the ^Es match construct

hki 
jss.-1"etest 1 passed
|test 1 failed!!!
'
hkiab cde
jsbs.-3"etest 2 passed
|test 2 failed!!!
'
hkiab de
jss.-7"etest 3 passed
|test 3 failed!!!
'
hkiab de
jsbsd.-4"etest 4 passed
|test 4 failed!!!
'
hkiab de
jsbsd.-11"etest 5 passed
|test 5 failed!!!
'
hk0i1i2i3i4i5i6i7i8i10i11i12i13i14i15i16i17i18i
19i20i21i22i23i24i25i26i27i28i29i30i31i
i!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ
i[\]^_`abcdefghijklmnopqrstuvwxyz{|}~127ii 
jss.-127"etest 6 passed
|test 6 failed!!!
'

Test the ^Ev match construct

hkiabcdefghij
jsv.-1"etest 1 passed
|test 1 failed!!!
'
jsabv.-3"etest 2 passed
|test 2 failed!!!
'
jsiv.-10"etest 3 passed
|test 3 failed!!!
'
jsbvd.-4"etest 4 passed
|test 4 failed!!!
'
jsbvvv.-5"etest 5 passed
|test 5 failed!!!
'
jsvvvvvvvvvv.-10"etest 6 passed
|test 6 failed!!!
'
hk0i1i2i3i4i5i6i7i8i9i10i11i12i13i14i15i16i17i
18i19i20i21i22i23i24i25i26i27i28i29i30i31i
i !"#$%&'()*+,-./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`{|}~127iia
jsv.-93"etest 7 passed
|test 7 failed!!!
'

Please press the space bar to continue, or CTRL-A to exit

-1"eex'

Test the ^Ew match construct

hkiABCDEFGHIJ
jsw.-1"etest 1 passed
|test 1 failed!!!
'
jsabw.-3"etest 2 passed
|test 2 failed!!!
'
jsiw.-10"etest 3 passed
|test 3 failed!!!
'
jsbwd.-4"etest 4 passed
|test 4 failed!!!
'
jsbwww.-5"etest 5 passed
|test 5 failed!!!
'
jswwwwwwwwww.-10"etest 6 passed
|test 6 failed!!!
'
hk0i1i2i3i4i5i6i7i8i9i10i11i12i13i14i15i16i17i
18i19i20i21i22i23i24i25i26i27i28i29i30i31i
i !"#$%&'()*+,-./:;<=>?@[\]^_`abcdefghijklmnopqrstuvwxyz{|}~127iiA
jsw.-93"etest 7 passed
|test 7 failed!!!
'

Test the ^Ex match construct

hki0123456789
jsx.-1"etest 1 passed
|test 1 failed!!!
'
js1x.-3"etest 2 passed
|test 2 failed!!!
'
js8x.-10"etest 3 passed
|test 3 failed!!!
'
js2x4.-5"etest 4 passed
|test 4 failed!!!
'
js2xxx.-6"etest 5 passed
|test 5 failed!!!
'
jsxxxxxxxxxx.-10"etest 6 passed
|test 6 failed!!!
'

Please press the space bar to continue, or CTRL-A to exit

-1"eex'

Test the ^N match construct

hkiaaaaaaaaab
jsa.-10"etest 1 passed
|test 1 failed!!!
'
jsa^Na.-10"etest 2 passed
|test 2 failed!!!
'
hkiAAAbAAA
jsaaa.-5"etest 3 passed
|test 3 failed!!!
'
hki0123456789x9876543210
jsd.-11"etest 4 passed
|test 4 failed!!!
'
hkiABCDEFGHIJKLMNOPQRSTUVWXYZaZZZZZ
js^N^EW.-27"etest 5 passed
|test 5 failed!!!
'
hkiabcdefghijklmnopqrstuvwxyz#oooo
jsv.-27"etest 6 passed
|test 6 failed!!!
'

Test the ^S match construct

hki!@#$%&*()
js^S.-1"etest 1 passed
|test 1 failed!!!
'
js!^S.-2"etest 2 passed
|test 2 failed!!!
'
js(^S.-9"etest 3 passed
|test 3 failed!!!
'
js!^S#.-3"etest 4 passed
|test 4 failed!!!
'
js!^S^S^S.-4"etest 5 passed
|test 5 failed!!!
'
js^S^S^S^S^S^S^S^S^S.-9"etest 6 passed
|test 6 failed!!!
'
hkiABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!
js^S.-63"etest 7 passed
|test 7 failed!!!
'

Please press the space bar to continue, or CTRL-A to exit

-1"eex'

Test the ^X match construct

hki0123456789
js^X.-1"etest 1 passed
|test 1 failed!!!
'
js1^X.-3"etest 2 passed
|test 2 failed!!!
'
js8^X.-10"etest 3 passed
|test 3 failed!!!
'
js2^X4.-5"etest 4 passed
|test 4 failed!!!
'
js2^x^x^x.-6"etest 5 passed
|test 5 failed!!!
'
js^X^x^x^X^X^X^X^X^X^X.-10"etest 6 passed
|test 6 failed!!!
'

The remaining tests test features not found in TECO-11.

eo-99"lexiting.
oexit'

Test the ^Em match construct

hkiabcdefghi
jsma.-1"etest 1 passed
|test 1 failed!!!
'
jsmd.-4"etest 2 passed
|test 2 failed!!!
'
jsmi.-9"etest 3 passed
|test 3 failed!!!
'
hkiabbbbbc
jsmb.-6"etest 4 passed
|test 4 failed!!!
'
jsa^Embc.-7"etest 5 passed
|test 5 failed!!!
'
jsabbbbb^Emc.-7"etest 6 passed
|test 6 failed!!!
'

Test the ^E<nnn> match construct

hkiabcdefghi
js<141>.-1"etest 1 passed
|test 1 failed!!!
'
jsb<143>.-3"etest 2 passed
|test 2 failed!!!
'
jsh<151>.-9"etest 3 passed
|test 3 failed!!!
'
jsb<143>d.-4"etest 4 passed
|test 4 failed!!!
'
jsb<143><144><145>.-5"etest 5 passed
|test 5 failed!!!
'
js<141><142><143><144><145><146><147><150><151>.-9"etest 6 passed
|test 6 failed!!!
'
hk0i1i2i3i4i5i6i7i8i9i10i11i12i13i14i15i16i17i
18i19i20i21i22i23i24i25i26i27i28i29i30i31i
i !"#$&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU
iVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~127ii%
js<45>.-128"etest 7 passed
|test 7 failed!!!
'

Please press the space bar to continue, or CTRL-A to exit

-1"eex'

Test the ^E[a,b,c...] match construct ???

hki!@#$%&*()
js[a,b,%,d].-5"etest 1 passed
|test 1 failed!!!
'
js![a,b,c,@].-2"etest 2 passed
|test 2 failed!!!
'
js([)].-9"etest 3 passed
|test 3 failed!!!
'
js![a,b,c,d,e,f,g,h,i,j,k,l,m,@]#.-3"etest 4 passed
|test 4 failed!!!
'
js!^S^S^S.-4"etest 5 passed
|test 5 failed!!!
'
js^S^S^S^S^S^S^S^S^S.-9"etest 6 passed
|test 6 failed!!!
'
hkiABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!
js^S.-63"etest 7 passed
|test 7 failed!!!
'
!exit!
ex

6
lib/unsqu.tec 100644
View File

@ -0,0 +1,6 @@
[i@^U.c/i
/27:^U.c@^U.i/qi<i >/27:^U.i27u.e0ui<z-."e1;'0u.a0u.d0u.s!c!0a"ecf<'0a-^^"ecsm.cm.if<'0a-^^"ec-1u.doc'0a-^^"ecm.cm.if<'0a-^^"ecm.cm.if<'0a-^^"ec-1u.doc'0a-^^"e2cm.cm.if<'0a-8"ec-1u.doc'0a-9"esu.em.cm.if<'0a-^^"ec-1u.doc'0a-^^"ecm.cm.if<'0a-^^"ec-1u.doc'0a-^^"ecq.d"tm.cm.if<|-1u.doc''0a-^^"ec-1u.doc'0a-^^"ecq.d"tm.cm.if<|-1u.doc''0a-^^"esu.em.cm.if<'0a-^^"ecm.cm.if<'0a-^^"ecm.cm.if<'0a-^^"ecq.d"tm.cm.if<|-1u.doc''0a-^^"ec-1u.doc'0a-27"ecm.cm.if<'0a-^^!"ecs!m.cm.if<'0a-^^""e2cm.c%im.if<'0a-^^%"e2c-1u.doc'0a-^^'"e-4dc-1%im.cm.if<'0a-^^@"ec-1q.aoc'0a-^^|"e-4dcm.cm.if<'0a-^^."ec-1u.doc'0a-^^;"ecm.cm.if<'0a-^^<"e2cm.c%im.if<'0a-^^>"ec-1%im.cm.if<'0a-^^["e2cm.cm.if<'0a-^^]"e2cm.cm.if<'0a-47"g0a-58"lc-1u.doc'
0a-^^a"ecm.cm.if<'0a-^^A"ecm.cm.if<'0a-^^b"ec-1u.doc'0a-^^B"ec-1u.doc'0a-^^c"ecm.cm.if<'0a-^^C"ecm.cm.if<'0a-^^d"ecm.cm.if<'0a-^^D"ecm.cm.if<'0a-^^e"eoe'0a-^^E"eoe'0a-^^f"eof'0a-^^F"eof'0a-^^g"e2cm.cm.if<'0a-^^G"e2cm.cm.if<'0a-^^h"ecf<'0a-^^H"ecf<'0a-^^i"esu.em.cm.if<'0a-^^I"esu.em.cm.if<'0a-^^j"ecm.cm.if<'0a-^^J"ecm.cm.if<'0a-^^k"ecm.cm.if<'0a-^^K"ecm.cm.if<'0a-^^l"ecm.cm.if<'0a-^^L"ecm.cm.if<'0a-^^m"e2cm.cm.if<'0a-^^M"e2cm.cm.if<'0a-^^n"esu.em.cm.if<'0a-^^N"esu.em.cm.if<'0a-^^o"esu.em.cm.if<'0a-^^O"esu.em.cm.if<'0a-^^q"e2c-1u.doc'0a-^^Q"e2c-1u.doc'0a-^^r"ecm.cm.if<'0a-^^R"ecm.cm.if<'0a-^^s"esu.em.cm.if<'0a-^^S"esu.em.cm.if<'0a-^^t"ecm.cm.if<'0a-^^T"ecm.cm.if<'0a-^^u"e2cm.cm.if<'0a-^^U"e2cm.cm.if<'0a-^^v"ecm.cm.if<'
0a-^^V"ecm.cm.if<'0a-^^w"ecm.cm.if<'0a-^^W"ecm.cm.if<'0a-^^x"e2cm.cm.if<'0a-^^X"e2cm.cm.if<'0a-^^y"ecm.cm.if<'0a-^^Y"ecm.cm.if<'0a-^^z"ec-1u.doc'0a-^^Z"ec-1u.doc'cf<!e!c0a-^^a"ecm.cm.if<'0A-^^a"ecm.cm.if<'0a-^^b"esu.em.cm.if<'0a-^^B"esu.em.cm.if<'0a-^^c"ecm.cm.if<'0a-^^C"ecm.cm.if<'0a-^^d"ecq.d"tm.cm.if<|-1u.doc''0a-^^D"ecq.d"tm.cm.if<|-1u.doc''0a-^^f"ecm.cm.if<'0a-^^F"ecm.cm.if<'0a-^^g"esu.em.cm.if<'0a-^^G"esu.em.cm.if<'0a-^^h"ecq.d"tm.cm.if<|-1u.doc''0a-^^H"ecq.d"tm.cm.if<|-1u.doc''0a-^^i"esu.em.cm.if<'0a-^^I"esu.em.cm.if<'0a-^^j"ec-1u.doc''0a-^^J"ec-1u.doc''0a-^^k"ecm.cm.if<'0a-^^K"ecm.cm.if<'0a-^^n"esu.em.cm.if<'0a-^^N"esu.em.cm.if<'0a-^^o"ec-1u.doc''0a-^^O"ec-1u.doc''0a-^^p"ecm.cm.if<'0a-^^P"ecm.cm.if<'
0a-^^q"ecm.cm.if<'0a-^^Q"ecm.cm.if<'0a-^^r"esu.em.cm.if<'0a-^^R"esu.em.cm.if<'0a-^^s"ecq.d"tm.cm.if<|-1u.doc''0a-^^S"ecq.d"tm.cm.if<|-1u.doc''0a-^^t"ecq.d"tm.cm.if<|-1u.doc''0a-^^T"ecq.d"tm.cm.if<|-1u.doc''0a-^^u"ecq.d"tm.cm.if<|-1u.doc''0a-^^U"ecq.d"tm.cm.if<|-1u.doc''0a-^^v"ecq.d"tm.cm.if<|-1u.doc''0a-^^V"ecq.d"tm.cm.if<|-1u.doc''0a-^^w"esu.em.cm.if<'0a-^^W"esu.em.cm.if<'0a-^^x"ecm.cm.if<'0a-^^X"ecm.cm.if<'cf<!f!c0a-^^'"ecm.cm.if<'0a-^^<"ecm.cm.if<'0a-^^>"ecm.cm.if<'0a-^^|"ecm.cm.if<'0a-^^b"esu.em.cm.if<'0a-^^B"esu.em.cm.if<'0a-^^c"esu.esu.em.cm.if<'0a-^^C"esu.esu.em.cm.if<'0a-^^d"esu.em.cm.if<'0a-^^D"esu.em.cm.if<'0a-^^n"esu.esu.em.cm.if<'0a-^^N"esu.esu.em.cm.if<'0a-^^r"esu.em.cm.if<'0a-^^R"esu.em.cm.if<'
0a-^^s"esu.esu.em.cm.if<'0a-^^S"esu.esu.em.cm.if<'0a-^^_"esu.esu.em.cm.if<'c>[i

187
lib/unsqu.tes 100644
View File

@ -0,0 +1,187 @@
! This TECO macro indents TECO code to help make it readable
It does NOT handle @-modified commands correctly or caret-preceeded commands.
Q-REGISTERS USED:
q-register usage
.a true if @-sign modified
.c (text) insert carriage return/line feed
.d true if numeric argument
.i (text) insert indenting spaces
i indenting level
!
[i
@^U.c/i
/27:^U.c
@^U.i/qi<i >/27:^U.i
27u.e
0ui
<
z-."e1;'
0u.a
0u.d
0u.s
!c!
0a"ecf<'
0a-^^^A"ecs^Am.cm.if<'
0a-^^^B"ec-1u.doc'
0a-^^^C"ecm.cm.if<'
0a-^^^D"ecm.cm.if<'
0a-^^^E"ec-1u.doc'
0a-^^^G"e2cm.cm.if<'
0a-8"ec-1u.doc'
0a-9"es^Eu.em.cm.if<'
0a-^^^N"ec-1u.doc'
0a-^^^O"ecm.cm.if<'
0a-^^^Q"ec-1u.doc'
0a-^^^R"ecq.d"tm.cm.if<|-1u.doc''
0a-^^^S"ec-1u.doc'
0a-^^^T"ecq.d"tm.cm.if<|-1u.doc''
0a-^^^U"es^Eu.em.cm.if<'
0a-^^^V"ecm.cm.if<'
0a-^^^W"ecm.cm.if<'
0a-^^^X"ecq.d"tm.cm.if<|-1u.doc''
0a-^^^Z"ec-1u.doc'
0a-27"ecm.cm.if<'
0a-^^!"ecs!m.cm.if<'
0a-^^""e2cm.c%im.if<'
0a-^^%"e2c-1u.doc'
0a-^^'"e-4dc-1%im.cm.if<'
0a-^^@"ec-1q.aoc'
0a-^^|"e-4dcm.cm.if<'
0a-^^."ec-1u.doc'
0a-^^;"ecm.cm.if<'
0a-^^<"e2cm.c%im.if<'
0a-^^>"ec-1%im.cm.if<'
0a-^^["e2cm.cm.if<'
0a-^^]"e2cm.cm.if<'
0a-47"g0a-58"lc-1u.doc'
0a-^^a"ecm.cm.if<'
0a-^^A"ecm.cm.if<'
0a-^^b"ec-1u.doc'
0a-^^B"ec-1u.doc'
0a-^^c"ecm.cm.if<'
0a-^^C"ecm.cm.if<'
0a-^^d"ecm.cm.if<'
0a-^^D"ecm.cm.if<'
0a-^^e"eoe'
0a-^^E"eoe'
0a-^^f"eof'
0a-^^F"eof'
0a-^^g"e2cm.cm.if<'
0a-^^G"e2cm.cm.if<'
0a-^^h"ecf<'
0a-^^H"ecf<'
0a-^^i"es^Eu.em.cm.if<'
0a-^^I"es^Eu.em.cm.if<'
0a-^^j"ecm.cm.if<'
0a-^^J"ecm.cm.if<'
0a-^^k"ecm.cm.if<'
0a-^^K"ecm.cm.if<'
0a-^^l"ecm.cm.if<'
0a-^^L"ecm.cm.if<'
0a-^^m"e2cm.cm.if<'
0a-^^M"e2cm.cm.if<'
0a-^^n"es^Eu.em.cm.if<'
0a-^^N"es^Eu.em.cm.if<'
0a-^^o"es^Eu.em.cm.if<'
0a-^^O"es^Eu.em.cm.if<'
0a-^^q"e2c-1u.doc'
0a-^^Q"e2c-1u.doc'
0a-^^r"ecm.cm.if<'
0a-^^R"ecm.cm.if<'
0a-^^s"es^Eu.em.cm.if<'
0a-^^S"es^Eu.em.cm.if<'
0a-^^t"ecm.cm.if<'
0a-^^T"ecm.cm.if<'
0a-^^u"e2cm.cm.if<'
0a-^^U"e2cm.cm.if<'
0a-^^v"ecm.cm.if<'
0a-^^V"ecm.cm.if<'
0a-^^w"ecm.cm.if<'
0a-^^W"ecm.cm.if<'
0a-^^x"e2cm.cm.if<'
0a-^^X"e2cm.cm.if<'
0a-^^y"ecm.cm.if<'
0a-^^Y"ecm.cm.if<'
0a-^^z"ec-1u.doc'
0a-^^Z"ec-1u.doc'
c
f<
!e!
c
0a-^^a"ecm.cm.if<'
0A-^^a"ecm.cm.if<'
0a-^^b"es^Eu.em.cm.if<'
0a-^^B"es^Eu.em.cm.if<'
0a-^^c"ecm.cm.if<'
0a-^^C"ecm.cm.if<'
0a-^^d"ecq.d"tm.cm.if<|-1u.doc''
0a-^^D"ecq.d"tm.cm.if<|-1u.doc''
0a-^^f"ecm.cm.if<'
0a-^^F"ecm.cm.if<'
0a-^^g"es^Eu.em.cm.if<'
0a-^^G"es^Eu.em.cm.if<'
0a-^^h"ecq.d"tm.cm.if<|-1u.doc''
0a-^^H"ecq.d"tm.cm.if<|-1u.doc''
0a-^^i"es^Eu.em.cm.if<'
0a-^^I"es^Eu.em.cm.if<'
0a-^^j"ec-1u.doc''
0a-^^J"ec-1u.doc''
0a-^^k"ecm.cm.if<'
0a-^^K"ecm.cm.if<'
0a-^^n"es^Eu.em.cm.if<'
0a-^^N"es^Eu.em.cm.if<'
0a-^^o"ec-1u.doc''
0a-^^O"ec-1u.doc''
0a-^^p"ecm.cm.if<'
0a-^^P"ecm.cm.if<'
0a-^^q"ecm.cm.if<'
0a-^^Q"ecm.cm.if<'
0a-^^r"es^Eu.em.cm.if<'
0a-^^R"es^Eu.em.cm.if<'
0a-^^s"ecq.d"tm.cm.if<|-1u.doc''
0a-^^S"ecq.d"tm.cm.if<|-1u.doc''
0a-^^t"ecq.d"tm.cm.if<|-1u.doc''
0a-^^T"ecq.d"tm.cm.if<|-1u.doc''
0a-^^u"ecq.d"tm.cm.if<|-1u.doc''
0a-^^U"ecq.d"tm.cm.if<|-1u.doc''
0a-^^v"ecq.d"tm.cm.if<|-1u.doc''
0a-^^V"ecq.d"tm.cm.if<|-1u.doc''
0a-^^w"es^Eu.em.cm.if<'
0a-^^W"es^Eu.em.cm.if<'
0a-^^x"ecm.cm.if<'
0a-^^X"ecm.cm.if<'
c
f<
!f!
c
0a-^^'"ecm.cm.if<'
0a-^^<"ecm.cm.if<'
0a-^^>"ecm.cm.if<'
0a-^^|"ecm.cm.if<'
0a-^^b"es^Eu.em.cm.if<'
0a-^^B"es^Eu.em.cm.if<'
0a-^^c"es^Eu.es^Eu.em.cm.if<'
0a-^^C"es^Eu.es^Eu.em.cm.if<'
0a-^^d"es^Eu.em.cm.if<'
0a-^^D"es^Eu.em.cm.if<'
0a-^^n"es^Eu.es^Eu.em.cm.if<'
0a-^^N"es^Eu.es^Eu.em.cm.if<'
0a-^^r"es^Eu.em.cm.if<'
0a-^^R"es^Eu.em.cm.if<'
0a-^^s"es^Eu.es^Eu.em.cm.if<'
0a-^^S"es^Eu.es^Eu.em.cm.if<'
0a-^^_"es^Eu.es^Eu.em.cm.if<'
c
>
[i


3
lib/upcase.tec 100644
View File

@ -0,0 +1,3 @@
@^uu/<0a-13"e1;'0a"v0a-32id|c'>v/
 q - register U loaded


469
src/aaout.txt 100644
View File

@ -0,0 +1,469 @@
AAREADME.TXT
This directory contains TECO-C, a version of TECO written in C.
It was written in C so the author could move comfortably from VAX/VMS
to various other machines, including MicroVaxes, which couldn't execute
TECO-11 prior to VMS 5.0 because they don't support PDP-11 compatibility
mode. TECO32, distributed with v5.0, solved this problem.
TECO-C is meant to be a complete implementation of TECO as defined
by the Standard TECO User's Guide, which is in file TECO.DOC. There is no
manual for TECO-C itself, but the Standard TECO manual was the specification
for TECO-C, so it serves as an excellent manual. TECO-C departs from the
Standard manual in only a few places (like no video mode), listed in file
PROBLEMS.TXT. There is quick-and-dirty "wall chart" of all TECO commands
in file WCHART.TXT.
This version of TECO-C runs under VMX/VMS, MS-DOS, AmigaDOS and Unix
(SunOS, Ultrix and System V on a Data General Aviion). If you find bugs or
have any comments about TECO-C, please contact
Pete Siemsen Pete Siemsen
645 Ohio Avenue #302 University of Southern California
Long Beach, Ca. 90814 1020 West Jefferson Blvd.
Los Angeles, CA 90089-0251
(213) 433-3059 (home) (213) 740-7391 (work)
Internet: siemsen@usc.edu
The following sections describe how to use or build TECO-C for
different environments. The command line syntax is the same as the syntax
for TECO-11 command lines.
###########################################################################
U N D E R V A X / V M S
TECO-C was mostly developed under VAX/VMS. It compiles and links
using VAX C 3.1 under VMS version 5.3.
To set up: inspect and modify ZVLOGIN.COM and then add it to your
LOGIN.COM
To compile: inspect/edit ZVBLD.COM, then SUBMIT it
To link: use the "LT" command (defined in ZVLOGIN.COM)
To run: inspect/edit the symbol definitions in ZVLOGIN.COM
Note: TECO-C uses the same command line syntax as TECO32
###########################################################################
U N D E R M S - D O S
TECO-C compiles/links under Turbo C v2.00 under MS-DOS 4.01 and
Concurrent DOS 386 v3.0.
To build: run MAKE on MAKEFILE.TC. to build TECO from scratch say:
"make -fmakefile.tc -DALL". see MAKEFILE.TC for other make
-D options. also see MAKETECO.BAT.
To run: use TECO.BAT to edit a file or MUNG.BAT to run a macro,
for example: TECO filename.
###########################################################################
U N D E R U N I X
To compile and link: use the make utility on "makefile.sun" (for SunOS) or
"makefile.ulx" (for Ultrix) or "makefile.dg" (for System V Unix
on a Data General Aviion).
To run: define aliases and environment variables in your .cshrc file.
Here's an example, assuming my initialization file is named
.tecorc and it's in my home directory, and my macros are in a
directory named tecoc under my main directory. You'll have to
change the directory names, of course.
setenv TEC_INIT \$/home/sol/siemsen/.tecorc
setenv TEC_LIBRARY /home/sol/siemsen/tecoc/
alias te '/home/sol/siemsen/tecoc/tecoc teco -nocreate'
alias mung '/home/sol/siemsen/tecoc/tecoc mung'
alias tma '/home/sol/siemsen/tecoc/tecoc make'
After doing this, "te" runs tecoc.
Unix Command line
---- ------- ----
To make Unix users more comfortable, TECO-C uses Unix-like options syntax
instead of the familiar "/" style used under VAX/VMS. The options can be
abbreviated. They are (optional characters in square brackets):
-in[spect]
-noc[reate]
-noi[ni]
-nom[emory]
-sc[roll]
-scroll:nnn:SEEALL
do nnn,7:W and 1,3:W
-nop[age]
Don't separate input into pages. Instead, treat form feeds as
normal characters.
+nnn
where nnn is any number of digits. Go to line number nnn and set
nopage. Note this uses the UNIX end of line convention for use with
cc output &c. The non-unix line termination will still be used for
nL and other intrinsic TECO commands, this just controls the
starting line AT INVOCATION.
EZ Mode Control Flag
-- ---- ------- ----
To add functionality, TECO-C is sensitive to bits in an extra mode control
flag in addition to the standard ones. Bits in the EZ mode control flag are
used in different ways by different operating systems. Under Unix, bits in
the flag have the following meanings:
1 Mark Henderson, who did much of the Unix port, likes the way
VAX/VMS keeps versions of files. VMS appends a semicolon followed
by a version number to files, and has the PURGE command to clean
out old versions of files. If this bit is off, TECO-C will handle
file version numbers, appending the appropriate version number to
file names. Mark supplied a "purge" program (distributed with TECO-C)
for users of this feature. Setting this flag turns off the feature,
to make TECO-C function as expected by the average Unix user. This
flag is set by default.
8 I don't know what this flag does. It only makes sense when TECO-C
is compiled with CURSES support.
16 If set, when it's time to beep, use an audio beep, and if it fails,
then try a video flash. If clear, try a video flash, and if it
fails, use an audio beep. This bit works only if TECO-C was compiled
with CURSES support. This bit is off by default.
32 If set, and split screen scrolling mode is on (see the 7:W command),
TECO-C puts a line between the upper and lower scrolling regions.
If off, don't display a line. This bit works only if TECO-C was
compiled with CURSES support. This bit is off by default.
128 If set, don't stop on form feeds when reading. If clear, a form
fed in the input stream stops the read (the standard TECO style).
This bit is off by default.
256 If set, use Unix-style newline terminators. This means when files
are read in, carriage-returns are not added to the end of lines,
and when the user types the RETURN key, only a newline is entered
into the command line (usually a carriage-return/line-feed pair is
entered). Old macros (and old TECO users) may get confused if this
bit is set, but it's required if CURSES support is compiled into
TECO-C.
2048 If set, use a bottom-tee symbol instead of a diamond to indicate
the end-of-buffer. This bit works only if TECO-C was compiled with
CURSES support. This bit is off by default.
8192 If set, don't show CR in SCROLL mode (like standard TECO). If clear,
show CR (a graphics character indicating a carriage return) when in
SCROLL mode. This bit works only if TECO-C was compiled with CURSES
support. This bit is on by default.
Filename Memory
-------- ------
TECO tries to remember the last file edited by TECO, so that after you've
edited a file once, you can re-edit without having to type the file name
on the command line. TECO-C implements this under Unix by writing and reading
files named /tmp/tecoxxx.tmp, where "xxx" is the process id of the parent
process.
NOTE: There is another TECO in C, written by Matt Fichtenbaum, which
runs under Unix. It is part of the DECUS TECO Collection. Contact Pete
Siemsen at the above address for a copy.
###########################################################################
U N D E R A M I G A D O S
To compile and link: see makefile.ami, (note: it needs tecoc.lnk)
Comments from the author of the Amiga code:
I've completed my TECOC port to the Amiga. It has been tested on an
Amiga 1000 under AmigaDOS 1.3.2. My system configuration is:
68000 microprocessor
2.5 megs memory
80 meg hard drive
Old Amiga chip set
SAS Institute C for the Amiga version 5.10
TECO-C runs in the CLI window it was started from, and it should run
over a terminal hooked to an Amiga serial port as well.
Adding 'W' command stuff would probably best be done by one of the
termcap ports to the Amiga, however, TECO would have to handle
SIGWINCH-like events, unless it is modified to open it's own window of
a particular size without a resizing gadget. It wouldn't be to hard to
write a terminal driver for Amiga windows using hard-coded escape
sequences either, but then that would lose over a serial port.
EzFlag
------
The EZ flag is system-dependent. Under AmigaDOS, bits in the flag have the
following meanings:
128 If set, don't stop on form feeds when reading. If clear, a form
fed in the input stream stops the read (the standard TECO style).
This bit os off by default.
256 If set, use Unix-style newline terminators. This means when files
are read in, carriage-returns are not added to the end of lines,
and when the user types the RETURN key, only a newline is entered
into the command line (usually a carriage-return/line-feed pair is
entered). Old macros (and old TECO users) may get confused if this
bit is set, but it's required if CURSES support is compiled into
TECO-C.
###########################################################################
F I L E S
aareadme.txt this readme file
baksrc.c backwards search
bldstr.c build a string with string build constructs
change.tec change macro squished
change.tes change macro source. this macro allows you to
replace one string with another in a group of
files using match constructs.
changes.txt contains teco-c release notes starting from
version 1.00 (TVERSION = 100)
chmacs.h ctype.h for teco-c
clenup.c clean up before exiting teco-c
clpars.h command line parsing macro, created by genclp.c
clpars.tec command line parsing macro squished
clpars.tes command line parsing macro source
cmatch.c match character with match construct
date.tec date macro squished
date.tes date macro source. this macro displays the
date and time.
dchars.h define identifiers for control characters
deferr.h define identifiers for error messages
defext.h EXTERN decarations for global variables
detab.tec de-tabify macro squished
detab.tes de-tabify macro source. this macro converts
tabs to spaces
dir.tec "display directory" macro, in squished form
dir.tes "display directory" macro source. This macro simply
displays the directory. a wildcarded filename
in the edit buffer can control what is displayed.
docjr.c code common to ExeC, ExeJ, and ExeR
doeves.c work code for EV and ES
doflag.c changes a mode control flag (ED,EH,ES,ET,EU,EV,^X)
dscren.h terminal types for 0:W command
echoit.c display character in its printable form
err.c display teco-c's error messages
exea.c execute A
exeats.c execute at-sign @
exeb.c execute B
exebar.c execute |
exebsl.c execute backslash \
exec.c execute C
execcc.c execute control-caret ^^
execln.c execute colon modifiers : and ::
execom.c execute comma ,
execrt.c execute caret ^
execst.c execute a TECO command string
execta.c execute ^A
exectc.c execute ^C
exectd.c execute ^D
execte.c execute ^E
execti.c execute ^I
exectl.c execute ^L
exectn.c execute ^N
execto.c execute ^O
exectp.c execute ^P
exectq.c execute ^Q
exectr.c execute ^R
exects.c execute ^S
exectt.c execute ^T
exectu.c execute ^U
exectv.c execute ^V
exectw.c execute ^W
exectx.c execute ^X
execty.c execute ^Y
exectz.c execute ^Z
exed.c execute D
exedgt.c execute digit (0-9)
exedot.c execute dot .
exedqu.c execute double quote "
exee.c execute E
exeequ.c execute equals =, ==, and ===
exeesc.c execute escape
exeexc.c execute exclamation point !
exeey.c execute EY
exef.c execute F
exefb.c execute FB
exeg.c execute G
exegtr.c execute greater than sign >
exeh.c execute H
exei.c execute I
exeill.c "execute" illegal command
exej.c execute J
exek.c execute K
exel.c execute L
exelbr.c execute left-bracket [
exelst.c execute less than sign <
exem.c execute M
exen.c execute N
exenul.c execute null ^@
exenyi.c "execute" not-yet-implemented command
exeo.c execute O
exeopr.c execute operator (+,-,(,#,/,&,^_,*)
exep.c execute P (see singlp.c)
exeprc.c execute percent sign %
exepw.c execute PW
exeq.c execute Q
exeqes.c execute question mark ?
exer.c execute R
exerbr.c execute right bracket ]
exertp.c execute right paren )
exes.c execute S
exescl.c execute semicolon ;
exet.c execute T
exeu.c execute U
exeund.c execute underscore _
exeusc.c execute unit separator character ^_
exev.c execute V
exew.c execute W
exex.c execute X
exey.c execute Y
exez.c execute Z
findes.c find end of string
findqr.c find q-register name
flowec.c flow to end of conditional
flowee.c flow to else part of conditional
flowel.c flow to end of loop
fmtmac.tec PDP-11 .MAC formatter squished
fmtmac.tes PDP-11 .MAC formatter source. this macro does
case formatting for PDP-11 macro (.MAC) source files
format.tec FORTRAN formatter squished
format.tes FORTRAN formatter source. formats the first part of
a FORTRAN source line.
genclp.c generates the command line parsing macro in clpars.h
getara.c get area in edit buffer an "m,n" argument defines
getnma.c get numeric argument off expression stack
inccbp.c increments command buffer pointer
init.c teco-c initializatin routines
insstr.c insert string into edit buffer
isradx.c is digit within current radix?
ln2chr.c convert line-number to character-number (^Q)
lowcase.tec convert edit buffer to lowercase macro, see upcase.tec
makdbf.c make digit buffer, binary to ascii in current radix
makefile.ami AmigaDOS make file
makefile.cct CodeCenter under SunOS
makefile.dg System V Unix make file (works on Data General Aviion)
makefile.sun SunOS make file
makefile.tc Turbo C make file (MS-DOS)
makefile.ulx Ultrix make file
maketeco.bat MS-DOS batch file to make teco. this is probably how
the temdos.exe executable file was made.
makprnt.tec make printable macro squished
makprnt.tes make printable macro squished. this macro makes a
string with embedded control characters printable
makrom.c make room in Q-register for new text
mung.bat MS-DOS batch to execute a teco macro from command line
pg.mem a programmer's guide. it may be useful to anyone
fixing bugs, adding features, or porting teco-c to
a new environment.
pkzip.rsp a PKZIP response file used to build TECOC.ZIP archive
popmac.c pop macro environment off macro stack
problems.txt contains notes about bugs and ideas
pshmac.c push current macro environment on macro stack
pushex.c push expression onto stack, try to reduce it
rdline.c read a line
rdpage.c read a page
readcs.c read command string
replac.c code for search and replace commands
search.c code for most of the search comamnds
search.tec search macro squished
search.tes search macro source. this macro finds a string in
a group of files using teco match constructs
singlp.c does a single P command
skpcmd.c skip over current command in command bufer
squ.bat MS-DOS batch file to run squ.tec w/standard options
squ.tec squish macro squished
squ.tes squish macro source. this macro takes a teco macro
source file and makes it as small and as fast (and
as unreadable) as possible
srclop.c search loop, handles loop arguments for search
sserch.c do a simple search
sub.tec ?
tabort.c terminate teco-c
tctlib.rsp a Turbo C TLIB response file used by makefile.tc
teco.bat MS-DOS batch file to run teco-c
teco.doc Standard TECO documentation from DECUS
teco.tes teco initialization file
tecoc.c the main source module, contains all the definitions
of system-independent global variables, as well as
comments explaining what they are.
tecoc.exe the teco-c executable for VMS
tecoc.h defines structures, general identifiers, and
the in-line debugging scheme.
tecoc.lnk link file needed under AmigaDOS (see makefile.ami)
tecoin.tes teco initialization file
temsdos.exe the teco-c executable for MS-DOS
tst.bat MS-DOS batch file to run the test macros
tst.com VMS command procedure to run the test macros
tstbsl.tec --
tstcss.tec |
tstequ.tec | these macros contain code which tests some
tsto.tec | aspects of teco-c
tstpw.tec |
tstqr.tec |
tstsrc.tec --
typbuf.c types a buffer on the screen, converting unprintable
characters to printable as nescessary.
type.tec type a file macro squished
type.tes type a file macro source. this macro apparently
types a file on the console with all kinds of
wonderful options.
typest.c types the erroneous command string for errors
uminus.c unary minus (converts -C to -1C)
unsqu.tec unsquish macro squished
unsqu.tes unsquish macro source. this macro does some simple
formatting of a squished teco macro to make it more
readable (like indenting)
upcase.tec convert edit buffer to uppercase macro, see lowcase.tec
vrbmsg.h verbose forms of teco error messages
vtedit.tec vtedit macro squished
vtedit.tes vtedit macro source. humongous screen editor macro.
note: this macro does NOT run under teco-c.
wchart.txt contains a wall chart of TECO commands
wrpage.c write a page
zamiga.c AmigaDOS system dependent code.
zfirst.c dummy module used if CHECKSUM_CODE is TRUE in zport.h
zfrsrc.c do a forward search using VAX SCANC instruction
zmsdos.c MS-DOS system dependant code
zport.h portability header file.
zunix.c SunOS (Unix) system dependant code
zunkn.c UNKNOWN system dependant code (function stubs)
zvms.c VAX/VMS system dependant code
The W command does not work, but the EXEW.C file contains code
to tell you what the command would have done if it had been executed. I used
this to play with executing VTEDIT.TEC under TECOC in order to find bugs.
I maintain the DECUS TECO Collection, a bunch of stuff relating to
TECO. It includes sources for DEC's TECO-11 v39, three TECOs written in C,
including ones for VAX/VMS, MS-DOS, SunOS (Unix) and Ultrix, the current
Standard TECO manual, two EMACs-like macro packages and LOTS of macros.
I you have something that you feel should be included in this
collection, or if you would like to improve the software, please contact
me at the above address.
Pete Siemsen

333
src/amodem.c 100644
View File

@ -0,0 +1,333 @@
/*****************************************************************************
This program provides basic communication with a remote computer.
The remote machine is connected to /dev/tty01. It is assumed to be a VAX
running VMS. This program sends whatever is typed at the keyboard to the
remote machine and puts whatever the remote machine sends on the terminal
screen.
When this program is invoked, connections to the serial port and
the keyboard are made and the user is left in the communication state. To
terminate the program, use control-N, then period.
A special feature is the "trapping" of what the modem sends to one
or more files. Basically, the program was written to provide a way to
get a large number of files from the VAX to this machine (XENIX). The idea
is to log in to the VAX and execute a command like "TYPE *.C". When VAX/VMS
types out files which match the wildcard filename "*.C", it
precedes the text of each file with a header line containing the file name.
This program is sensitive to these headers, and uses them to name output
files. Thus, running this program and typing "TYPE *.C" to VMS on the
remote machine should produce one file in the current directory for each
file typed on the remote machine.
This program seems to be similar to the CU program provided by UNIX.
When I wrote the first version of this program, I didn't know about CU.
When I learned of CU, I had trouble getting it working, so I just decided
to use this program.
A feature of setting port characteristics with stty is that the port's
characteristics remain set after the program exits. This is inconvenient in
the case of the console, so this program tries to re-set the characteristics
before exiting.
*****************************************************************************/
#include <ctype.h>
#include <sgtty.h>
#include <signal.h>
#include <stdio.h>
#define BOOLEAN char
#define CMPECHO 0777767 /* complement of ECHO in sgtty.h */
#define KEY "SD0:[PETE.TECO.TECOC]"
#define KEY_LEN 21
#define FALSE 0
#define TRUE 1
char buffer[100]; /* character buffer */
char chr; /* one character */
struct sgttyb cons_cb; /* console charactertistics block */
int cons_fd; /* console file descriptor */
int cons_flags_saved; /* saved value of cons_cb.sg_flags */
BOOLEAN cons_opened; /* console need to be closed? */
BOOLEAN cons_set; /* console characteristics changed? */
struct sgttyb modm_cb; /* modem characteristics block */
int modm_fd; /* modem file descriptor */
int modm_flags_saved; /* saved value of modm_cb.sg_flags */
char modm_ispeed_saved; /* saved value of modm_cb.sg_ispeed */
char modm_ospeed_saved; /* saved value of modm_cb.sg_ospeed */
BOOLEAN modm_opened; /* does the modem need to be closed? */
BOOLEAN modm_set; /* modem characteristics changed? */
int proc_id; /* process identification */
BOOLEAN trapping; /* trapping modem input to a file? */
FILE *splice_fp; /* splice file descriptor */
FILE *trap_fp; /* capture file descriptor */
reset_modm_port()
{
modm_cb.sg_ispeed = modm_ispeed_saved;
modm_cb.sg_ospeed = modm_ospeed_saved;
modm_cb.sg_flags = modm_flags_saved;
printf("Amodem: re-sttying the modem port\n");
if (stty(modm_fd, &modm_cb) != 0)
{
printf("Amodem: couldn't re-stty the modem port\n");
exit(1);
}
}
close_modm_port()
{
printf("Amodem: closing the modem port\n");
if (close(modm_fd) == -1)
{
printf("Amodem: couldn't close the modem port\n");
exit(1);
}
}
reset_cons_port()
{
cons_cb.sg_flags = cons_flags_saved;
printf("Amodem: re-sttying the console port\r\n");
if (stty(cons_fd, &cons_cb) != 0)
{
printf("Amodem: couldn't re-stty the console port\n");
exit(1);
}
}
close_cons_port()
{
printf("Amodem: closing the console port\r\n");
if (close(cons_fd) == -1)
{
printf("Amodem: couldn't close the console port\n");
exit(1);
}
}
cleanup_and_exit()
{
if (proc_id == 0)
{
if (trapping)
{
printf("Amodem: closing trap file\r\n");
if (fclose(trap_fp) == EOF)
printf("cleanup: unable to close trap file\n");
}
}
else
{
if (cons_set)
reset_cons_port();
if (cons_opened)
close_cons_port();
if (modm_set)
reset_modm_port();
if (modm_opened)
close_modm_port();
}
exit(1);
}
open_console() /* open console port */
{
cons_fd = open("/dev/tty",2);
if (cons_fd == -1)
{
printf ("Amodem: couldn't open the console port\n");
cleanup_and_exit();
}
cons_opened = TRUE;
if (gtty(cons_fd, &cons_cb) != 0)
{
printf("Amodem: couldn't gtty the console port\n");
cleanup_and_exit();
}
cons_flags_saved = cons_cb.sg_flags;
cons_cb.sg_flags = RAW;
if (stty(cons_fd, &cons_cb) != 0)
{
printf("Amodem: couldn't stty the console port\n");
cleanup_and_exit();
}
cons_set = TRUE;
}
open_modem() /* open modem port (serial port A, or /dev/tty01)*/
{
modm_fd = open("/dev/tty01",2);
if (modm_fd == -1)
{
printf ("Amodem: couldn't open the modem port\n");
cleanup_and_exit();
}
modm_opened = TRUE;
if (gtty(modm_fd, &modm_cb) != 0)
{
printf("Amodem: couldn't gtty the modem port\n");
cleanup_and_exit();
}
modm_ispeed_saved = modm_cb.sg_ispeed;
modm_ospeed_saved = modm_cb.sg_ospeed;
modm_cb.sg_ispeed = modm_cb.sg_ospeed = B1200;
modm_flags_saved = modm_cb.sg_flags;
modm_cb.sg_flags = RAW;
if (stty(modm_fd, &modm_cb) != 0)
{
printf("Amodem: couldn't stty the modem port\n");
cleanup_and_exit();
}
modm_set = TRUE;
}
cmd_char()
{
#define FBFSIZ 20
#define MAXLINE 132
int idx;
char FNamBuf[FBFSIZ];
char fline[MAXLINE];
char *line;
read(cons_fd, &chr, 1);
switch (chr){
case '.':
if (kill(proc_id, SIGTERM) != 0)
printf("cmd_char: kill failed\n");
cleanup_and_exit();
break;
case '\016':
break;
case 's':
case 'S':
printf("\r\nname of file to splice into output: ");
idx = 0;
while (chr != '\15')
{
read(cons_fd, &chr, 1);
write(cons_fd, &chr, 1);
if (chr == '\15')
{
FNamBuf[idx] = '\0';
write(cons_fd, "\n", 1);
break;
}
else
{
FNamBuf[idx] = chr;
if (idx++ > FBFSIZ)
{
printf("file name too long\r\n");
chr = '\15';
return;
}
}
}
if (access(FNamBuf, 4) != 0)
{
printf("that file does not exist\r\n");
return;
}
if ((splice_fp = fopen(FNamBuf, "r")) == NULL)
{
printf("\tUnable to open %s\r\n", FNamBuf);
return;
}
line = &fline[0];
for (;;)
{
line = fgets(line, MAXLINE, splice_fp);
if (line == NULL)
break;
write(modm_fd, line, strlen(line) - 1);
write(modm_fd, "\r", 1);
}
if (fclose(splice_fp) == EOF)
{
printf("Unable to close %s\r\n", FNamBuf);
cleanup_and_exit();
}
break;
default:
printf("\r\n");
printf("\r\n");
printf("Control-N options are:");
printf("\r\n");
printf("\r\n");
printf("1.\t. to terminate this program");
printf("\r\n");
printf("2.\t^n to send a control-N");
printf("\r\n");
printf("3.\ts to splice a file into the output");
printf("\r\n");
printf("\r\n");
break;
}
}
tst_line() /* if line contains the key, trap to file */
{
char *index();
char *semi;
char *tmpptr;
if (strncmp(buffer, KEY, KEY_LEN) == 0)
{
if (trapping)
if (fclose(trap_fp) == EOF)
{
printf("Amodem: unable to close trap file\n");
cleanup_and_exit();
}
semi = index(buffer, ';');
*semi = '\0';
tmpptr = buffer;
while (*tmpptr != '\0')
{
if (isupper(*tmpptr))
*tmpptr = tolower(*tmpptr);
tmpptr++;
}
if ((trap_fp = fopen(&buffer[KEY_LEN], "w")) == NULL)
{
printf("Unable to create file AMODEM.OUT\r\n");
cleanup_and_exit();
}
trapping = TRUE;
}
}
parent_send() /* reads keyboard, sends to tty01 */
{
for (;;)
{
read(cons_fd, &chr, 1);
if (chr == '\016')
cmd_char();
write(modm_fd, &chr, 1);
}
}
child_receive() /* reads tty01, sends to terminal screen */
{
char *ptr;
ptr = &buffer[0];
for (;;)
{
read(modm_fd, &chr, 1);
write(cons_fd, &chr, 1);
if ((trapping) && (chr != '\r'))
putc(chr, trap_fp);
*ptr++ = chr;
if (chr == '\n')
{
tst_line();
ptr = &buffer[0];
}
}
}
main()
{
cons_opened = cons_set = modm_opened = modm_set = trapping = FALSE;
signal(SIGINT, cleanup_and_exit);
signal(SIGTERM, cleanup_and_exit);
open_console(),
open_modem();
printf("\r\n");
printf("\r\n");
printf("Communication established.");
printf("\r\n");
printf("\r\n");
proc_id = fork();
if (proc_id == -1)
{
printf("Amodem: fork failed\n");
cleanup_and_exit();
}
if (proc_id == 0)
child_receive();
else
parent_send();
}

338
src/baksrc.c 100644
View File

@ -0,0 +1,338 @@
/*****************************************************************************
BakSrc()
This recursive function does a backward search in the edit buffer,
looking for a string which will match the first match construct in the search
buffer. Basically, it is the high-speed part of the search algorithm: it
scans the edit buffer looking for the first character in the search string.
On entry, SStPtr points to the first match construct in the search
buffer. On exit, SStPtr points to the last character of the first match
construct in the search buffer.
SBfPtr points to the character following the last character in
the search string. This function does not modify SBfPtr.
On entry, EBPtr1 points to the place in the edit buffer where
the search starts. On exit, if the search was successful, EBPtr1 will
point to the found character. If the search was unsuccessful, EBPtr1 will
be less than EndSAr.
On entry, EBPtr2 is undefined. On exit, if the search was
successful, EBPtr2 points to the last character of the found string. If
the search was unsuccessful, EBPtr2 is undefined.
EndSAr points to the end of the search area (where the search ends).
Note that for backwards searches, EndSAr is less than EBPtr1. This function
does not modify EndSAr.
Match constructs are:
^X match any character
^S match a separator character (not letter or digit)
^N match anything but following match construct
^EA match any alphabetic
^EB match a separator character (not letter or digit)
^EC match symbol constituent
^ED match any digit
^EGq match any character in q-register q
^EL match any line terminator (LF, VT, FF)
^EM match non-null string of following match construct
^ER match any alphanumeric
^ES match non-null string of spaces and/or tabs
^EV match lowercase alphabetic
^EW match uppercase alphabetic
^EX match any character
^E<nnn> match character with ASCII code nnn (octal)
^E[x1,x2,...xn] match any of the match constructs x1, x2, etc.
else match the character itself
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "dchars.h" /* define identifiers for characters */
#include "chmacs.h" /* define character processing macros */
#include "deferr.h" /* define identifiers for error messages */
DEFAULT BakSrc() /* forward search for 1st search char */
{
unsigned char Charac; /* holds a character */
charptr LstBeg; /* beginning of ^E[x1,x2,...] list */
char OtCase; /* "other" case character */
charptr QRPtr; /* pointer into q-register text */
BOOLEAN SamChr; /* same character indicator */
charptr SavEP2; /* temporary holder of EBPtr2 */
charptr SavSSP; /* temporary holder of SStPtr */
DEFAULT Status; /* FindQR() status for ^EGq */
charptr TCBfPt; /* temporary holder of CBfPtr */
charptr TCStEn; /* temporary holder of CStEnd */
LONG TmpLng; /* holds octal number for ^E<nnn> */
#if DEBUGGING
static char *DbgFNm = "BakSrc";
sprintf(DbgSBf,"*SStPtr = '%c', *EBPtr1 = '%c'", *SStPtr, *EBPtr1);
DbgFEn(3,DbgFNm,DbgSBf);
#endif
switch (*SStPtr) {
case CTRL_X: /* ^X match any char */
break;
case CTRL_S: /* ^S match separator char */
for (; EBPtr1 >= EndSAr; --EBPtr1) {
if (!Is_Alnum(*EBPtr1)) {
break;
}
}
break;
case CTRL_N: /* ^Nx match any BUT next match construct */
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ISS); /* illegal search string */
DBGFEX(3,DbgFNm,"FAILURE, no ^N arg");
return FAILURE;
}
SavSSP = SStPtr;
for (;EBPtr1>=EndSAr;--EBPtr1) {
EBPtr2 = EBPtr1;
SStPtr = SavSSP;
if (CMatch(&SamChr) == FAILURE) {
DBGFEX(3,DbgFNm,"FAILURE, CMatch failed");
return FAILURE;
}
if (!SamChr) {
break;
}
}
break;
case CTRL_E: /* ^E match construct */
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE); /* ICE = illegal ^E */
DBGFEX(3,DbgFNm,"FAILURE, no ^E arg");
return FAILURE;
}
switch (To_Upper(*SStPtr)) {
case 'A': /* ^EA match any alphabetic */
for (; EBPtr1 >= EndSAr; --EBPtr1) {
if (Is_Alpha(*EBPtr1)) {
break;
}
}
break;
case 'B': /* ^EB match any separator (==^S) */
for (; EBPtr1 >= EndSAr; --EBPtr1) {
if (!Is_Alnum(*EBPtr1)) {
break;
}
}
break;
case 'C': /* ^EC match symbol constitient */
for (; EBPtr1 >= EndSAr; --EBPtr1) {
if (Is_SyCon(*EBPtr1)) {
break;
}
}
break;
case 'D': /* ^ED match any digit */
for (; EBPtr1 >= EndSAr; --EBPtr1) {
if (Is_Digit(*EBPtr1)) {
break;
}
}
break;
case 'G': /* ^EGq match any char in Q-reg q */
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE, no ^EG arg");
return FAILURE;
}
TCBfPt = CBfPtr; /* save CBfPtr */
TCStEn = CStEnd; /* save CStEnd */
CBfPtr = SStPtr;
CStEnd = SBfPtr;
Status = FindQR();
SStPtr = CBfPtr;
SBfPtr = CStEnd;
CBfPtr = TCBfPt; /* restore CBfPtr */
CStEnd = TCStEn; /* restore CStEnd */
if (Status == FAILURE) {
DBGFEX(3,DbgFNm,"FAILURE, ^EG FindQR failed");
return FAILURE;
}
for (; EBPtr1 >= EndSAr; --EBPtr1) {
QRPtr = QR->Start;
while (QRPtr < QR->End_P1) {
if (*QRPtr++ == *EBPtr1) {
goto kludge;
}
}
}
kludge: break;
case 'L': /* ^EL match line terminator */
for (; EBPtr1 >= EndSAr; --EBPtr1) {
if (IsEOL(*EBPtr1)) {
break;
}
}
break;
case 'M': /* ^EM match multiple next constructs */
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE, no ^EM arg");
return FAILURE;
}
SavSSP = SStPtr;
if (BakSrc() == FAILURE) {
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
if (EBPtr1 < EndSAr) { /* if not found */
break;
}
SavEP2 = EBPtr2;
while (EBPtr1 > EndSAr) {
EBPtr1--;
EBPtr2 = EBPtr1;
SStPtr = SavSSP;
if (CMatch(&SamChr) == FAILURE) {
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
if (!SamChr) {
EBPtr1++;
EBPtr2 = SavEP2;
break;
}
}
DBGFEX(3,DbgFNm,"SUCCESS");
return SUCCESS;
case 'R': /* ^ER match any alphanumeric */
for (; EBPtr1 >= EndSAr; --EBPtr1) {
if (Is_Alnum(*EBPtr1)) {
break;
}
}
break;
case 'S': /* ^ES match any spaces/tabs */
for (; EBPtr1 >= EndSAr; --EBPtr1) {
if ((*EBPtr1 == SPACE) || (*EBPtr1 == TABCHR)) {
EBPtr2 = EBPtr1;
while (EBPtr1 > EndSAr) {
EBPtr1--;
if ((*EBPtr1 != SPACE) &&
(*EBPtr1 != TABCHR)) {
EBPtr1++;
break;
}
}
DBGFEX(3,DbgFNm,"SUCCESS");
return SUCCESS;
}
}
break;
case 'V': /* ^EV match any lowercase char */
for (; EBPtr1 >= EndSAr; --EBPtr1) {
if (Is_Lower(*EBPtr1)) {
break;
}
}
break;
case 'W': /* ^EW match any uppercase character */
for (; EBPtr1 >= EndSAr; --EBPtr1) {
if (Is_Upper(*EBPtr1)) {
break;
}
}
break;
case 'X': /* ^EX match any char (==^X) */
break;
case '<': /* ^E<n> match char w/ASCII octal code n */
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE, no ^E<> arg");
return FAILURE;
}
TmpLng = 0;
while (Is_Digit(*SStPtr)) {
TmpLng = (TmpLng * 8) + (*SStPtr - '0');
if (TmpLng > 127) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
}
if (*SStPtr != '>') {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
Charac = (unsigned char)TmpLng;
for (; EBPtr1 >= EndSAr; --EBPtr1) {
if (*EBPtr1 == Charac) {
break;
}
}
break;
case '[': /* ^E[x1,x2,...] match any one of x1,x2,... */
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE, no ^E[] arg");
return FAILURE;
}
LstBeg = SStPtr;
for (; EBPtr1 >= EndSAr; --EBPtr1) {
while (*SStPtr != ']') {
if (*SStPtr == ',') {
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
} else {
EBPtr2 = EBPtr1;
if (CMatch(&SamChr) == FAILURE) {
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
if (SamChr) {
while (*SStPtr != ']') {
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
}
EBPtr2 = EBPtr1;
DBGFEX(3,DbgFNm,"SUCCESS");
return SUCCESS;
}
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
}
}
SStPtr = LstBeg;
}
break;
default:
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE, bad ^E arg");
return FAILURE;
} /* end of ^E switch */
break;
default: /* edit buffer char must match search string char */
if (SMFlag) { /* if case dependence */
for (; EBPtr1 >= EndSAr; --EBPtr1) {
if (*EBPtr1 == *SStPtr) {
break;
}
}
} else { /* else case independence */
OtCase = Is_Upper(*SStPtr)
? To_Lower(*SStPtr)
: To_Upper(*SStPtr);
for (; EBPtr1 >= EndSAr; --EBPtr1) {
if ((*EBPtr1 == *SStPtr) || (*EBPtr1 == OtCase)) {
break;
}
}
}
} /* end of switch */
EBPtr2 = EBPtr1;
DBGFEX(3,DbgFNm,"SUCCESS");
return SUCCESS;
}

243
src/bldstr.c 100644
View File

@ -0,0 +1,243 @@
/*****************************************************************************
BldStr()
This function "builds" a string. This means converting string
build constructs in the input string into their intended equivalents
in the output string. The string build constructs are as follows:
^Q use next character literally, not as a string build char
^R use next character literally, not as a string build char
^V lowercase the next character
^V^V lowercase all following characters
^W uppercase the next character
^W^W uppercase all following characters
^EQq use string in q-register q here
^EUq use ASCII char for number in q-register q here
When this function is called, CBfPtr points to the first character
of the input string. It is assumed that the string is terminated by an ESCAPE
character (or something else if the calling command was @-modified). If the
string is not properly terminated this function will die with "unterminated
command" when it encounters CStEnd while looking for the terminator character.
When this function returns, CBfPtr points to the ESCAPE which
terminates the string, the built string is in the buffer pointed to by
XBfBeg, and XBfPtr points to the character after the last character in
the built string.
The commands which contain a filename (EB, EI, EN, ER and
EW) use this function. The EG command, which exits with an operating system
command line, uses this function. The O command, which jumps to a tag, uses
this function. The search commands (E_, FK, FN, FS, F_, N, S and _) use this
function.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "deferr.h" /* define identifiers for error messages */
#include "dchars.h" /* define identifiers for characters */
#include "chmacs.h" /* define character processing macros */
#if USE_PROTOTYPES
static DEFAULT DoCtVW(charptr EndArg, unsigned char TmpChr);
static DEFAULT DoCtE(charptr EndArg, charptr XBfEnd);
#endif
static charptr BBfPtr; /* pointer into XBf */
static int CaseCv; /* case conversion */
static unsigned char WVFlag; /* ^W or ^V flag */
static DEFAULT DoCtVW(EndArg, TmpChr) /* do a control-V or control-W */
charptr EndArg; /* ptr to end of string argument */
unsigned char TmpChr; /* temporary character */
{
DBGFEN(3,"DoCtVW",NULL);
WVFlag = TmpChr;
if (++CBfPtr == EndArg) { /* move past ^W or ^V, too far? */
ErrMsg(ERR_ISS); /* yes, illegal search string */
DBGFEX(2,DbgFNm,"FAILURE");
return FAILURE;
}
if ((*CBfPtr == '^') && ((EdFlag & ED_CARET_OK) == 0)) {
if (++CBfPtr == EndArg) {
ErrMsg(ERR_ISS);
DBGFEX(2,DbgFNm,"FAILURE");
return FAILURE;
}
TmpChr = To_Upper(*CBfPtr);
if ((TmpChr < '@') || (TmpChr > '_')) {
ErrChr(ERR_IUC, *CBfPtr);
DBGFEX(2,DbgFNm,"FAILURE");
return FAILURE;
}
TmpChr &= '\077';
} else {
TmpChr = *CBfPtr;
}
if (WVFlag == CTRL_V) {
if (TmpChr == CTRL_V) {
CaseCv = LOWER;
} else {
*BBfPtr++ = To_Lower(TmpChr);
}
} else {
if (TmpChr == CTRL_W) {
CaseCv = UPPER;
} else {
*BBfPtr++ = To_Upper(TmpChr);
}
}
WVFlag = '\0';
DBGFEX(2,DbgFNm,"SUCCESS");
return SUCCESS;
}
static DEFAULT DoCtE(EndArg, XBfEnd) /* do a control-E */
charptr EndArg; /* ptr to end of string argument */
charptr XBfEnd; /* end of build-string buffer */
{
DEFAULT Status; /* returned from FindQR */
charptr TCStEn; /* temporary holder of CStEnd */
DBGFEN(3,"DoCtE",NULL);
if (++CBfPtr == EndArg) { /* move past ^E, too far? */
ErrMsg(ERR_ICE); /* yes, illegal ^E command */
DBGFEX(2,DbgFNm,"FAILURE");
return FAILURE;
}
if ((*CBfPtr == 'Q') || (*CBfPtr == 'q')) {
if (++CBfPtr == EndArg) {
ErrMsg(ERR_ISS);
DBGFEX(2,DbgFNm,"FAILURE");
return FAILURE;
}
/*
* handle filespec buffer and search string buffer
*/
if (*CBfPtr=='*' || *CBfPtr=='_') {
charptr BufPtr, BufBeg;
if (*CBfPtr=='*') {
BufPtr=FBfPtr;
BufBeg=FBfBeg;
} else {
BufPtr=SBfPtr;
BufBeg=SBfBeg;
}
if ((BufPtr-BufBeg) > (XBfEnd-BBfPtr)) {
ErrMsg(ERR_STL);
DBGFEX(2,DbgFNm,"FAILURE");
return FAILURE;
}
MEMMOVE(BBfPtr, BufBeg, (SIZE_T)(BufPtr - BufBeg));
BBfPtr += BufPtr-BufBeg;
} else {
/*
* it really must be a Q reg reference after all
*/
TCStEn = CStEnd; /* save CStEnd */
CStEnd = EndArg;
Status = FindQR();
CStEnd = TCStEn; /* restore CStEnd */
if (Status == FAILURE) {
DBGFEX(2,DbgFNm,"FAILURE");
return FAILURE;
}
if ((QR->End_P1-QR->Start) > (XBfEnd-BBfPtr)) {
ErrMsg(ERR_STL);
DBGFEX(2,DbgFNm,"FAILURE");
return FAILURE;
}
MEMMOVE(BBfPtr, QR->Start, (SIZE_T)(QR->End_P1 - QR->Start));
BBfPtr += QR->End_P1 - QR->Start;
}
} else if ((*CBfPtr == 'U') || (*CBfPtr == 'u')) {
if (++CBfPtr == EndArg) {
ErrMsg(ERR_ISS);
DBGFEX(2,DbgFNm,"FAILURE");
return FAILURE;
}
TCStEn = CStEnd; /* save CStEnd */
CStEnd = EndArg;
Status = FindQR();
CStEnd = TCStEn; /* restore CStEnd */
if (Status == FAILURE) {
DBGFEX(2,DbgFNm,"FAILURE");
return FAILURE;
}
*BBfPtr++ = (char)QR->Number;
} else {
*BBfPtr++ = CTRL_E;
*BBfPtr++ = *CBfPtr;
}
DBGFEX(2,DbgFNm,"SUCCESS");
return SUCCESS;
}
DEFAULT BldStr(XBfBeg, XBfEnd, XBfPtr) /* build a string */
charptr XBfBeg; /* beginning of build-string buffer */
charptr XBfEnd; /* end of build-string buffer */
charptr (*XBfPtr); /* pointer into build-string buffer */
{
charptr EndArg; /* end of input string, plus 1 */
unsigned char TmpChr; /* temporary character */
DBGFEN(2,"BldStr",NULL);
if (FindES(ESCAPE) == FAILURE) { /* move CBfPtr to end of argument */
DBGFEX(2,DbgFNm,"FAILURE, FindES(ESCAPE) failed");
return FAILURE;
}
WVFlag = '\0'; /* initialize ^W and ^V flag */
CaseCv = IniSrM; /* initialize internal search mode */
BBfPtr = XBfBeg; /* initialize ptr into build-string buffer */
EndArg = CBfPtr; /* save pointer to end of argument */
CBfPtr = ArgPtr; /* reset to beginning of argument */
while (CBfPtr < EndArg) {
if ((*CBfPtr == '^') && ((EdFlag & ED_CARET_OK) == 0)) {
if (++CBfPtr == EndArg) {
ErrMsg(ERR_ISS);
DBGFEX(2,DbgFNm,"FAILURE, no char after ^");
return FAILURE;
}
TmpChr = To_Upper(*CBfPtr);
if ((TmpChr < '@') || (TmpChr > '_')) {
ErrChr(ERR_IUC, *CBfPtr);
DBGFEX(2,DbgFNm,"FAILURE, bad char after ^");
return FAILURE;
}
TmpChr &= '\077';
} else {
TmpChr = *CBfPtr;
}
switch (TmpChr) {
case CTRL_R:
case CTRL_Q:
if (++CBfPtr == EndArg) {
ErrMsg(ERR_ISS);
DBGFEX(2,DbgFNm,"FAILURE");
return FAILURE;
}
*BBfPtr++ = *CBfPtr;
break;
case CTRL_V:
case CTRL_W:
if (DoCtVW(EndArg, TmpChr) == FAILURE) {
DBGFEX(2,DbgFNm,"FAILURE, DoCtVW failed");
return FAILURE;
}
break;
case CTRL_E:
if (DoCtE(EndArg, XBfEnd) == FAILURE) {
DBGFEX(2,DbgFNm,"FAILURE, DoCtE failed");
return FAILURE;
}
break;
default:
if (CaseCv == LOWER) {
TmpChr = To_Lower(TmpChr);
} else if (CaseCv == UPPER) {
TmpChr = To_Upper(TmpChr);
}
*BBfPtr++ = TmpChr;
}
if (BBfPtr > XBfEnd) {
ErrMsg(ERR_STL); /* string too long */
DBGFEX(2,DbgFNm,"FAILURE, string too long");
return FAILURE;
}
++CBfPtr;
}
*XBfPtr = BBfPtr;
#if DEBUGGING
sprintf(DbgSBf,"string = \"%.*s\"", (int)(BBfPtr-XBfBeg), XBfBeg);
DbgFEx(2,DbgFNm,DbgSBf);
#endif
return SUCCESS;
}

816
src/changes.txt 100644
View File

@ -0,0 +1,816 @@
This file contains release notes for TECOC. The "base version"
is 100 (reported by the EO command). The version number starts at 100 to
avoid confusion with TECO-11 version numbers, which were close to 40 as of
01-Jan-1987.
10-Dec-1987 version 100
baseline version as of Fall Decus Symposium, Anaheim
04-Jan-1988 version 101 (mostly stuff for XENIX)
1. created this file
2. changed EXEEO.C to make the version number 101.
3. changed FBFSIZ (file name size) to 20 in AMODEM.C
4. changed XAFTER.CSH to execute under CSH instead of SH
5. removed unused tags IFTag and OFTag from ZPORT.H
6. added comment about this file to AAAREADME.TXT
7. Created an updated XBUILD.CSH.
8. added a tab to INIT.C.
9. Added debugging code to PARSCL.C, MEMINI.C, ZINIFL.C, MUNG.C, ZREMBR.C,
and INIOPN.C. This code is activated only if the variable DbgLvl is
initialized to 1 in DBGDSP.C.
10. Added semi-colon to line 181 of ZOPINP.C so it'll compile.
11. Changed ZREMBR.C so it returns NO in XENIX section.
12. Added code to set TrmTyp in XENIX section of ZTRMNL.C.
13. Changed SCRNOP.C so it tests TrmTyp (not OpCode) against UNTERM.
14. Added XENIX sections to ZDSPCH.C, ZDSPBF.C and ZCHIN.C.
23-Jan-1988 version 102
1. changed EXEEO.C to make the version number 102.
2. changed the debugging code in ZABORT.C to avoid an infinite loop
3. removed "signal(SIGTERM, ZAbort)" from XENIX code in ZINIT.C
4. changed ZTRMNL.C to support control-Cs under XENIX
5. check for control-C in ZCHIN.C, needed to do it in all other Z routines
6. added XENIX section to ZRDLIN.C
7. define sys$close in ZOPINP.C and ZOPOUT.C
8. define sys$get, sys$putmsg in ZRDEI.C
9. renamed/modified all the .CSH and .COM files so they start with "Z" and
updated AAAREADME.TXT to reflect the changes.
10. added file FALL87.RNO, updated AAAREADME.TXT about it
11. fixed comment in RDLINE.C.
12. changed || to | in ZHELP.C so / immediate commands are okay under VMS.
13. fixed "invalid buffer size" bug for reading large files by changing
"65536" to "65535" in ZRDLIN.C.
14. fixed control-C handling, so that type-out of a large buffer works.
Changed EXECST.C, ZDSPBF.C, FRSTCH.C, READCS.C.
15. added a test to EXECST.C so that commands like "<test$$" will
now produce "unterminated command" errors, as they should
16. modified EXEEI.C to make EI$$ a null command to make CHANGE.TEC work
30-Jan-1988 version 103 ( to make CHANGE.TEC work )
1. changed EXEEO.C to make the version number 103.
2. changed definition of Mung from DEFAULT to VOID in MUNG.C.
3. changed TmpEI from DEFAULT to VOID in TMPEI.C, ZINIFL.C, MUNG.C
4. removed superfluous "else" from ZSWILD.C
5. moved WFab, WNam initialization from ZINIFL.C to ZINIT.C
6. set WFab.fab$l_fna in ZINIT.C to make EN command work
7. added XENIX section to ZCPYBL.C
8. fixed XENIX section of ZICLOS.C
9. fixed XENIX section of ZOPOUT.C
10. fixed XENIX section of ZRDLIN.C
11. fixed XENIX section of ZWRITE.C
12. changed constants for XENIX in ZPORT.H
13. changed calloc to malloc in ZALLOC.C, merged similar sections
14. added debugging code to RDLINE.C
15. added debugging line to WRBUFR.C
16. fixed unlink call in ZOCLOS.C, added debugging code
17. fixed unlink call in ZOCLDE.C
18. added -O switch to CC commands in XMKBLD.CSH (optimizes code)
31-Mar-1988 version 104
1. changed EXEEO.C to make the version number 104.
2. changed the way code is compiled under XENIX: deleted XMKBLD.CSH,
created ZXBLD.CSH and ZXDBLD.CSH, modified ZXLOGIN.CSH and ZXCCC.CSH
3. fixed XENIX file creation mode in ZOPOUT.C
4. fixed XENIX section of ZMKOFN.C
5. fixed setting of CmdMod and EStTop in EXEEB.C
6. removed unnecessary call to ExeEY in INIOPN.C
7. fixed XENIX file renaming in ZOCLOS.C
8. used auto-decrement instead of addition in MEMINI.C
9. Renamed CHRFUNCS.H to CHRMACS.H. All references to CHRFUNCS.H
had to be changed: many files modified. Also changed macros that
are in CHRMACS.H to use an array. Merged that array with the one that
was in ReadCS.
10. made ZTrmnl define TrmTyp as UNTERM when we're running in a batch job.
11. took out "dying" message in GETNMA.C
12. fixed CR/LF appending in EXEEQU.C
13. fixed file output code in ZDSPCH.C
13-Apr-1988 version 105
1. changed EXEEO.C to make the version number 105.
2. removed extra tab from ZINIT.C
3. renamed XAFTER.CSH to ZXAFTER.CSH
4. changed ZXAFTER.CSH so it renames CHRMACS.H, not CHRFUNCS.H
5. added improved error reporting in ZOPINP.C
6. added "cc -c tecoc.c" to ZXBLD.CSH
7. added "/STANDARD=PORTABLE" qualifiers to CC commands in ZVBLD.COM
8. Fixed ZWrite to append LFs correctly under XENIX
9. Fixed ZChIn to make CR/LFs under XENIX out of LFs.
10. changed ZOpOut to use fopen instead of creat/fdopen.
11. overhauled error reporting. Many modules changed, including all "Z" files.
Added OpnOut and ZErMsg.
12. Replaced GroEBf with InsStr to merge several copies of the same code
sequence. Affected ExeBSl, ExeCtI, ExeG, ExeI, Replac.
13. Removed post-copy of memory after ZRaloc calls. ZRaloc does it.
14. Took /STANDARD=PORTABLE off VMS compile commands to prevent warnings
about "globalref".
30-Jul-1988 version 106
1. changed EXEEO.C to make the version number 106.
2. fixed some error reporting bugs.
3. check for mung mode failure in ExeCSt, not ErrMsg
4. changed EI buffer size to 20000 to let TSTSRC.TEC be input
06-Aug-1988 version 107
1. changed EXEEO.C to make the version number 107.
2. fixed FR command.
3. fixed it so two control-C's terminate TECOC, as it should be.
4. overhauled command-line parsing to make it use a TECO macro to do it,
like TECO-11 does. Major changes to initialization code. I did this to
provide the extra power and to make invocation of TECOC the same as TECO-11
under VAX/VMS. Created ExeEG, ZExeEJ, ZEgIni, ZEgLib, ZEgMem, ZEgSym
and ZEgVte. Deleted ZIniFl, Mung, ZExeEG.
5. fixed ::S command.
6. fixed ] command's memory deallocation.
22-Feb-1989 version 108 ( porting to Turbo C )
1. changed EXEEO.C to make the version number 108.
2. created function prototypes (without arguments) in DefTeco.h and removed
them from all other files.
3. changed /REPLACE to /INSERT in ZVBLD.COM
4. fixed definition of ErrTxt in BldStr.
5. moved "#include stsdef" into VAX section of ZErMsg.
6. moved expressions out of "if" statements to avoid compiler warnings in
FindQR, MakDBf, PshMac, StCopy, ZTrmnl.
7. Deleted reference to ZDefErr.h from ZOClDe.
8. deleted ZError.h
9. changed "ErrMag" to "ErrMsg" in ZOClos.
10. removed variables declared but never used in DoEI, ExeEG, WrBufr, ZOClos.
11. removed "return(xxx)" from XENIX section of ZHhelp, which is a VOID
function.
12. Express 32768 in octal in DefTeco.h for ET_TRAP_CTRL_C to avoid problems
putting it into an unsigned EtFlag.
13. Added type-cast to ZCpyBl call in RdLine.
14. changed XENIX section of ZExeEJ so it defines ZExeEJ, not ZExCtH.
15. Replaced the Execut function with syntax for calling a function whose
address you have in a variable.
16. Made mods to make it run under Turbo C under MS-DOS. Added __TURBOC__
sections to Zxxxx.c files and created ZPBLD.BAT and ZPDBLD.BAT.
19. Fixed Turbo C section in ZDspBf, ZDspCh, ZChIn, ZWrite.
20. Changed "LONG" to "ptrdiff_t" in several files.
21. Added Turbo C section to ZPrsCL.
Just to get it working, commented out the Turbo C code in ZPrsCL.
This prevents the command-line macro from executing, which avoids the
execution of EJ and EG commands in the macro. EJ and EG are not yet
supported for non-VMS environments. It now limps under Turbo C/MS-DOS
28-Feb-1989 version 109 ( more porting to Turbo C )
1. changed EXEEO.C to make the version number 109.
2. made type conversions explicit via type casts in various functions.
3. replaced calls to ZChrIt with type-cast "(char)" and deleted ZChrIt
4. appended all the Dbgxxx functions to the end of TECOC.C and changed
compile/link so there is no separate debugging library. This simplifies
the link sequence.
5. fixed VDOW.C and VSETW.C so setting DEBUGGING to NO will not cause
compilation errors.
6. changed references to .h files to lowercase so you don't have to
explicitly rename them after copying them from one machine to another
7. various minor changes so it will build for an UNKNOWN environment
8. use FILENAME_MAX, an ANSI C identifier
9. changed the XENIX identifier to the more general __UNIX__ and restructured
the conditional compilation code to use "#elif".
10. replaced StCopy with strcpy
11. replaced ZCpyBl with MEMMOVE
12. created a file named MAKEFILE for use with Unix "make".
13. improved type definitions and casting to keep lint happy.
14. use EXIT_FAILURE and EXIT_SUCCESS in calls to exit() and ZAbort().
15. Defined return codes for the EJ command in systems other than VMS
so the command-line parsing macro could function.
16. Removed references to StCopy and ZCpyBl from ZPBLD.BAT and deleted
ZPLNK.BAT. Fixed ZPLNK.BAT to not refer to DBGTECOC.LIB.
28-Feb-1989 version 110
1. changed EXEEO.C to make the version number 110.
2. made the 2048 bit of the ET flag cause the BACKSPACE character to be
treated just like the DEL character on input. This supports the
conventions used by IBM PCs and Unix. On those systems, you'll have
trouble getting a BACKSPACE into the command line, a minor problem.
3. to simplify an effort to port TECO-C to RT-11, renamed the following
files so the name portion of the filespec is 6 characters or less.
renamed CHRMACS.H to CHMACS.H
renamed COMMANDS.TXT to WCHART.TXT
renamed DEFCHARS.H to DCHARS.H
renamed DEFSCREN.H to DSCREN.H
renamed DEFTECO.H to TECOC.H
renamed TEC0_V40.TEC to TECV40.TEC
renamed TECO_V40.TES to TECV40.TES
The following files were not renamed, and are the only remaining files
with names longer than 6 characters.
AAAREADME.TXT I just didn't want to rename this one
GETTECO. used only on Unix systems
MAKEFILE. used only on Unix systems
PROBLEMS.TXT I just didn't want to rename this one
RELEASE.TXT I just didn't want to rename this one
ZVLOGIN.COM used only on VAX/VMS systems
ZXAFTER.CSH used only on Xenix systems
ZXLOGIN.CSH used only on Xenix systems
4. Fixed ZPBLD.BAT: removed superfluous -I option, added ECHO statements so
you can tell how far it's gotten, lowercased file names.
5. Removed definition of TraceM from ZExCtC, which doesn't use TraceM.
6. Don't return a value from ZDoCmd or ZHelp, they're VOID functions.
7. Fixed Sun and Turbo C sections of ZExeEJ and ZClnEG.
8. Changed second argument of PushEx from BYTE to DEFAULT.
9. Made ZClnEG a LONG function to match it's use in ExeEG.
10. Made MakDBf calls in PushEx and GetNMA use a type cast when passing
EstTop and EstBot so it works under Turbo C.
12. Fixed expression syntax in CLPARS.TES.
13. Fixed handling of :ER commands in Turbo C section of ZOpInp.
14. Added function prototypes to tecoc.h. They're conditionally compiled
based on the new USE_PROTOTYPES identifier defined in zport.h.
15. Replaced GENCLP.TEC with GENCLP.C.
11-Jun-1989 version 111
1. changed EXEEO.C to make the version number 111.
2. More type-casts added to allow Turbo C to compile the code when the
function prototypes are used (USE_PROTOTYPE == YES).
3. Moved setting of EtFlag out of ZInit.c and into ZTrmnl.c.
28-Jun-1989 version 112
1. changed EXEEO.C to make the version number 112.
2. changed || to | in ZTrmnl.c to fix setting of EtFlag.
3. changed CrType to VT100 in ZTrmnl.c for IBM-PC so ANSI sequences are used.
4. rewrote logic to fix bugs and improve readability in InpDel.c.
5. renamed ScrnOp to ZScrOp so IBM-PC screen handling could be added.
6. replaced old usage of ET_BKSP_IS_DEL with new code in ZChIn.
7. added error message generation to ZChIn
8. fixed ZVBLD.COM so the link of GENCLP has LNK$LIBRARY defined
9. changed mktemp to tmpnam (ANSI) in ZOpOut.c.
10. merged VDoW, VGetW and VSetW into ExeW
11. Lots of little changes to reduce messages produced by lint and by
Turbo C when the -w switch (maximum warnings) is used.
19-Jul-1989 version 113
1. changed EXEEO.C to make the version number 113.
2. Fixed ZPBLD.BAT and ZPTLIB.BAT
3. Added code for IBM PC to ZScrOp.c
4. Added FFLINS, used in InpDel and ReadCS.
5. Fixed comments in FindQR and tecoc
6. Changed ugly \015 to \r, \012 to \n, \011 to \t in all files
7. More type casting to reduce warnings from Turbo C.
8. Changed almost every file to insert new "charptr" and "QRptr" types.
These are needed to support the brain-damaged memory access on IBM-PCs,
where the pointers need to be "HUGE" to work.
9. fixed a bug in MakRom that caused :X commands (among others) to fail.
10. Converted QBfBeg, QBfPtr and QNumbr to the simpler QR
11. Rewrote GENCLP so it makes a file that Turbo C reads correctly.
12. Made a SIZE_T typedef to support Turbo C.
13. Used farmalloc in ZAlloc, farfree in ZFree and farrealloc in ZRaloc in
Turbo C sections.
14. made 0EJ return 0 for Turbo C.
15. Fixed ZWrite code for Turbo C.
02-Aug-1989 version 114
1. changed EXEEO.C to make the version number 114.
2. Renamed RELEASE.TXT to CHANGES.TXT
3. merged all the Z files into ZVMS,C, ZMSDOS.C, ZUNIX.C, ZUNKN.C
4. merged all the SKP files into SKPCMD.C
5. merged CHKHLP.C, FRSTCH.C and INPDEL.C into READCS.C
6. merged REDUCE.C into PUSHEX.C
7. merged MEMINI.C into INIT.C
8. merged DOEI.C into EXEEI.C
9. merged DOFBFC.C into SRCLOP.C
10. merged EXEE*.C files into EXEE.C (EXEEB.C is an exception)
11. merged EXEF*.C files into EXEF.C (EXEFB.C is an exception)
12. Implemented colon modifier on EW command. This is an undocumented
feature required for the CLPARS macro to work on non-VAXen.
13. merged ZFILES.H into ZVMS.C, ZMSDOS.C, ZUNIX.C
14. fixed GENCLP.C yet again, for VMS
15. fixed memory shuffling bug in RDLINE.C
21-Aug-1989 version 115 (Manfred Siemsen)
1. Changed ExeEO() in EXEE.C to make the version number 115
2. Created DEFEXT.H, replaced all EXTERN lines with #include "defext.h"
3. Modified all #if DEBUGGING...#endif lines to call 3 debugging
functions: DbgFEn() upon function entry, DbgFEx() upon function
exit, and DbgFMs() for messages in the body of a function. Also,
indented the debugging lines so they line up under the code they
"belong" with, instead of being munched over on the left margin.
4. Modified debugging routines to use sprintf/printf to display
values of variables instead of displaying things "manually" through
other Teco-C build/display routines. We still avoid the use of
sprint/printf in non-debugging code.
5. Modified the indentation scheme to more closely match K&R
6. Put squiggly braces '{}' around ALL statements, even if they
aren't required.
7. Modified the comment scheme to be consistent with Pete's
latest X-window'ish standard.
8. Created a Turbo C MAKEFILE (MAKEFILE.TC).
9. Began implementation of ZPWild() and ZSWild() in ZMSDOS.C. It
seems to work ok, but there should be more error checking put in
to guard against the user entering a bizarre filename.
10 Implememted ZDoCmd() in ZMSDOS.C. Required change to ExeEG() in
EXEE.C. If it wasn't :EG, TxtLen was never set, might have been
garbage, moved TxtLen assignment out of "if (COLON..." statement.
Also, ZAbort() was called if TxtLen was not zero, should have
been called if TxtLen *is* zero.
30-Aug-1989 version 116
1. Changed ExeEO() in EXEE.C to make the version number 116
2. rearranged includes in "Z" files so that my .h files come after the
system ones. This was needed so ZPORT.H can redefine FILENAME_MAX,
which on VMS is wrong (38 ain't right). Rearranged ZPORT.H for the
same reason.
3. Replaced ERRMSG.C with ERR.C and created the new error reporting
functions ErrChr and ErrStr. Doing this removes places where I was
writing into string literals, which worked but wasn't real kosher.
It also makes lint happy about ErrMsg (fixed number of arguments now)
and modularizes the error code. Merged DSPCHR.C and VRBERR.C into
ERR.C.
4. Created ZVrbos.
5. Fixed error message numbering.
6. Fixed prototype for ErrDsp and ErrPst in ERR.C.
7. Commented out illegal test case in TSTQR.TEC.
8. Made Charac a char instead of an int in ZChIn to fix bug.
21-Oct-1989 version 117
1. Changed ExeEO() in EXEE.C to make the version number 117
2. Moved #endif in TECOC.C from just after DbgSlv() to just after
DbgDsp() so DbgDsp() wasn't included when DEBUGGING is FALSE.
3. Updated MAKEFILE.TC.
4. Updated ZPTLIB.BAT.
6. Changed prototype of ZVrbos in ZMSDOS.C, ZVMS.C, ZUNIX.C,
ZUNKN.C, and TECOC.H.
7. Changed DoEI() comment in EXEE.C.
8. Made ZRdEI() call ZRdLin() instead of calling fgets() directly.
9. Changed ZWrite() to ZWrLin(), it's more descriptive.
23-Oct-1989 version 118
1. Changed ExeEO() in EXEE.C to make the version number 118
2. minor fixes to make lint happy
3. Changed ZChIn() in ZMSDOS.C to ignore any IBM PC scan code
other than DEL to eliminate the "Unrecognized character" bomb.
4. Changed CLPARS.TES so filespec memory works on PC's.
5. Changed EXEQ.C to fix numeric expression parsing
6. Change definition of FEArry[] from (*F[])() to (*F[])(VOID)
to eliminate Turboc C "function w/no prototype" warning.
03-Nov-1989 version 119 (Manfred)
1. Changed ExeEO() in EXEE.C to make the version number 119.
2. Because of some bizzare behaviour, the CHECKSUM_CODE #define and routines
were added to check code at runtime to make sure it wasn't being
overwritten. These routines read the Turbo C .MAP file to get the order
and length of all the modules, calculates and stores an initial checksum
for each module; and then compares the initial checksum of each module
with the checksum calculated after every command is executed in ExeCSt().
3. Changed ZAlloc(), ZRaloc(), and ZFree() to return and expect a new
type "voidptr" instead of charptr's. I then removed the casts before
ZAlloc() and ZRaloc() returns in the code. Borland Turbo C says that
explictly casting returns from malloc/realloc hides things from the
compiler and is bad practice in ANSI C.
4. Changed "struct QReg *LQTabl" to "QRptr LQTabl" in the definition of
MStck in TECOC.H per phone call w/Pete.
5. Changed an incorrect call to DbgFEn() in ZOpOut()...should have displayed
DbgSBf instead of "".
6. Changed the DbgFEn(), DbgFEx(), and DbgFMs() calls to send NULL instead
of "" if there is no special debugging message to display. This saves
space when Turbo C is not merging duplicate strings (tcc -d). Otherwise
there are billions of "" strings in the .EXE file ("" strings take 1
byte of space because they contain a '\0'). I used CHANGE.TEC to do it!
7. Changed ZRaloc() in ZMSDOS.C to manually reallocate blocks. There is a
problem with Turbo C's farrealloc() in that it uses movedata() to move
data from the old block to the new block. Movedata() expects a size_t
as the number of bytes to move. size_t under Turbo C v2 is *always* a
16-bit unsigned int regardless of memory model. This means that if the
old block is >64K, movedata() won't move the data correctly from the old
block to the new block when the old block is >64K.
8. Implemented the ^B system date (ZExCtB) and ^H system time (ZExCtH)
routines in ZMSDOS.C using DOS calls. EIDATE.TES$ will display the
current date and time.
9. Initialized ff_status in ZMSDOS.C to -1 so EN$$ with no preceding
ENfilename$$ doesn't blow up by calling findnext() with no initial
findfirst(). Is <File Not Found ""> a reasonable return?
10.Changed ExeRBr() so that End_P1 is set to NULL when Start is set to
NULL after the ZFree(QR->Start). Otherwise, End_P1 might not be NULL
and will cause problems for those routines which blindly subtract
End_P1 from Start to get the length of text in the Q-register.
11.Changed the line in ^EQq logic part of BldStr() where QR->End_P1 was
being subtracted from QR-Start, when it should be the other way around.
12.Changed FArray[] in ExeCSt(). The ^Q entry was ExeNYI(), it should have
been ExeCtQ(). The ^_ entry was ExeOpr(), it should have been ExeUsc().
Actually, both ExeOpr() and ExeUsc() would have pushed ^_ on the stack,
so it was a...uh...push.
13.Changed ^G entry FCAray[] in ExeCrt() from ExeNul() to ExeIll() so it
jibes with FArray[] in ExeCSt() entry.
14.The logic in ReadEI() in EXEE.C determining whether or not to add a
trailing CR-LF to the line read from the EI file was wrong. ReadEI()
now calls ZRdlin() to read lines from the EI file. ZRdLin() returns
the length of the read line *without* the trailing newline returned by
fgets(). The ReadEI() logic was checking if the line ended in VT or
in ESC-CR-LF. Since the line returned by ZRdLin() should never end in
CR-LF, the ESC check was bogus. I changed it to only add a CR-LF if
the line did NOT end in VT or ESC which I think was the original intent.
15.While playing with ReadEI() in EXEE.C, I was having problems reading in
a huge macro (>ZBFINIT bytes long). The problem was that if the EI
buffer became full (ie: BufPtr == ZBfEnd), ReadEI() was calling
ZRdLin() with (ZBfEnd-BufPtr == 0). ZRdLin() was in turn essentially
calling "fgets(buf,0,fp)". When told to read into a 0 size buffer,
fgets() simply returns the buffer. ZRdLin() only fails if fgets()
returned NULL or if an error happened, otherwise it will happily
return 0 as the length of the line it read, therefore, back in
ReadEI(), the "BufPtr += line_len" never incremented BufPtr
anywhere and ReadEI() never broke out of it's FOREVER loop, it
looped infinitely, reading zero bytes into a zero length buffer.
I added the ZBFMIN and ZBFEXP #defines in ZPORT.H and changed ReadEI()
so it dynamically reallocates the EI buffer when it is close to
becoming full.
16.Changed ExeCtu(). The call to MakRom() used to make the Q-register
text area 1 character longer when doing a "n^Qq" was sending the wrong
argument. It was sending the new *total* size of the text area
(end-start+1) instead of the *additional* size of the text area (1 byte).
17.Changed the way the CLPARS macro is handled:
a) If USE_ANSI_CLPARS is FALSE.
Changed CLPARS.TES to not clear itself out of memory when it was
finished. The CLPARS macro is loaded and executed in Q-register Y.
The last thing it did was a "0,0XY" to clear itself out. The problem
is that ExeX() would call ZFree() to clear Q-register Y, leaving
CBfPtr effectively pointing into a free'ed memory area. This wasn't
fatal because the "0,0XY" was the very last thing in the CLPARS macro
so no further TECO instructions were looked for in the free'ed area;
but, technically it was wrong. I removed the "0,0XY" from the CLPARS
macro and changed ZPrsCl() so it manually ZFree()'s Q-register Y after
it finishes executing it.
Note: SQU also uses this technique: issuing a '0,0Xq' at the tail end of
a macro loaded in Q-register 'q' to clear the macro out after it
finishes executing. If this is a common TECO macro practice, maybe
we'll have to think this through a little more.
b) If USE_ANSI_CLPARS is TRUE
If USE_ANSI_CLPARS is true, the CLPARS macro is stored as one
gigantic string in clpars[]. If USE_ANSI_CLPARS is false, the
CLPARS macro is split into lines and stored as an array of strings
in *clpars[]. The advantage to USE_ANSI_CLPARS is that to execute
the CLPARS macro, ZPrsCL() simply made the text area pointers of
Q-register Y point at clpars[] to "load" Q-register Y before doing
the MY$$. Otherwise, if USE_ANSI_CLPARS is false, the CLPARS
macro is executed by (slowly) loading it from *clpars[], line-by-line,
into Q-register Y and then doing the "MY$$".
The problem was that if USE_ANSI_CLPARS was true, Q-register Y held
statically allocated data which could cause problems when the CLPARS
macro did the "0,0XY" to clean up. "0,0XY" would make ExeX() try to
ZFree() the statically allocated clpars[] string.
While looking at this problem I noticed that, other than for historical
reasons, there is no reason the CLPARS macro *has* to be executed from
Q-register Y. I changed ZPrsCL() so that if USE_ANSI_CLPRS is true, it
directly executes the CLPARS macro from the clpars[] string without
bothering to load it into Q-register Y first.
18.Removed TRACE_IMBEDDED_MACRO.
19.Removed static initialization of QRgstr[] in TECOC.C and moved it
into MemIni() in INIT.C along with the other initializations of
global static arrays (QStack[], etc). [See suggestion (1) below]
20.Changed ExeEO to return ExeNYI() for "nEO".
21.Changed DoEI(). DoEI() calls PshMac(), ExeCSt(), and PopMac(). If the
ExeCSt() failed, it would do a return(FAILURE) without doing the PopMac(),
leaving the macro stack off and CBfPtr pointing into the EI buffer. DoEI()
was changed so that it does a PopMac() even if ExeCSt() fails. This same
type of logic was changed in ExeM().
This problem didn't appear unless you tried executing a macro from a file
or from a Q-register which failed miserably.
22.Changed ReadEI() <again>. When ReadEI() finds a line containing double
<ESC>'s, it returns to DoEI(), which then executes everything up to that
point. DoEI() then re-calls ReadEI() to finish reading the EI file. The
problem was that if there were any commands *after* the two <ESC>'s on
the last line read, they would be lost in the shuffle because ReadEI()
would start reading into the beginning of ZBf. The SQU.TEC macro had
a line with commands after a double <ESC>.
23.Fixed ExeO(). ExeO() wasn't completely comparing the desired tag with
the tag in the command string. So, if the command string had two tag
names which start out the same way, for example:
!aa!
!a!
"Oa" would goto !aa!.
24.Changed the way some of the colon-modified commands work. I ran into a
situation in SQU where "Y<:A;>" was used. If the yank read in the entire
buffer, ExeA() would fail immediately, without clearing the colon-modified
bit in CmdMod, thus "passing" CmdMod to ";" converting it to ":;". "n;"
breaks if n is zero or positive, "n:;" breaks if n is negative. "Passing"
CmdMod to ExeSCl() this way completely altered the sense of the ";" break.
25.Fixed case flagging in TypBuf() and made it faster by not doing the
Is_Lower() and Is_Upper() checking if EuFlag() is set to EU_NONE.
26.Rewrote ZCpyBl() in ZMSDOS.C to use memmove() and memcpy(). They
both use 80x86 string instructions and make things much faster.
27.PopMac() was clearing the contents of the local Q-register table,
but wasn't de-allocating the table itself.
28.Changed PshMac(), PopMac(), FindQR(), and Init() to use pointers into
the MStack[] and MStack[].QRgstr tables instead of doing redundant array
references. Changed Reduce() in PUSHEX.C to use pointers into EStack[]
for the same reason. Using pointers should be faster?
29.The digit buffer (DBfBeg) was initialized in TECOC.C as:
charptr *DBfBeg = " ";
then digits were poked into this statically allocated string which really
isn't kosher. Changed it so DBfBeg is initialized in MemIni() in INIT.C.
06-Dec-1989 version 120
1. Changed ExeEO() in EXEE.C to make the version number 120.
2. Fixed bug in ZDspBf caused by "length" wrapping when unsigned.
3. various little fixups.
07-Dec-1989 version 121
1. Changed ExeEO() in EXEE.C to make the version number 121.
2. Made EC clear the edit buffer after writing files. Thanks, Phil.
3. Fixed ZFWrite in ZMSDOS.C to handle files > 64k better.
20-Dec-1989 version 122
1. Changed ExeEO() in EXEE.C to make the version number 122.
2. Added TVERSION (version number of TECOC-C) to TECOC.C
3. Fixed ZRdLin in ZVMS.C to make EI commands work.
4. Removed the ZInit function. It was being called late (after MemIni),
and turned out to be unused anyway.
04-Feb-1990 version 123
1. Changed ExeEO() in EXEE.C to make the version number 123.
2. Removed funny handling of lines terminated with <ESC><CR><LF> do let
MS-DOS users edit macros without funnyness.
3. Regularized the "debugging level" numbers documented with DbgDMs in
TECOC.C.
4. Fixed looping logic in SrcLop to make "n_text$" commands work.
5. Fixed bug in ClTrEx in ZVMS.C so running from batch works.
20-Feb-1990 version 124
1. Changed TVERSION in TECOC.H to 124.
2. Rewrote MakDBf to make it more portable.
2-Mar-1990 version 125
1. Changed TVERSION in TECOC.H to 125.
2. Fixed so HP with an empty buffer doesn't cause an error message.
3. Moved the decision about whether to add/remove CR/LF pairs to/from the end
of lines when doing file I/O into the system-dependent functions. This
was needed to make MD-DOS happy, and is really where this stuff should
be anyway.
4. Defined GotCtC as "volatile".
5. Rewrote ZRdLin in ZVMS.C to do what TECO-11 really does with all the
special characters.
6. Put a check for an open output file into ExeEC, so the command HKEFEX
will work even if there's more pages in the input file.
7. Merged WrBufr and ZWrLin into a singl function called ZWrBfr. Deleted
WRBUFR.C and updated the build files. This was needed to provide system
dependent control over output so MS-DOS I/O could be cleaned up.
22-May-1990 version 126
1. Changed TVERSION in TECOC.H to 126.
2. Removed code that adds a CR/LF to each record read by ReadEI.
3. Fixed VMS output code in ZWrBfr broken in version 125.
4. Changed TypBuf so it is interruptable by ^C after displaying a line.
5. Defined ChkCtC() so that ^C's work better under MS-DOS.
6. Changed ZSWild & ZPWild to work better under CHANGE.TEC.
7. Folded wildcard filename buffer (WBf) into "normal" filename buffer (FBf)
so G* after ENfilespec$ returns "filespec".
1-June-1990 version 127
1. Changed TVERSION in TECOC.H to 127.
2. Modified ZDoCmd() in ZMSDOS.C so you can EGfilename.BAT$.
3. Added EBfFul to avoid "?MEM memory overflow" messages when reading large
files. Now TECO-C quietly stops reading.
4. Reduced number of times ChkCtC() is called to speed display up.
5. renamed AAAREADME.TXT to AAREADME.TXT, needed by MS-DOS
8-June-1990 version 128
1. Changed TVERSION in TECOC.H to 128.
2. Fixed loops that initialize IsOpnI, IsEofI and IsOpnO in Memini. Thanks
to Chuck Cranor.
3. Added ZExit, ZClnUp and ClenUp and replaced ZAbort with TAbort. This
modularizes exit handling.
4. Applied lots of fixes to zunix.c suggested by Chuck Cranor. These include
terminal initialization and use of termcap for terminal sequences.
5. Added a type cast to FindQR to prevent a compiler warning.
13-June-1990 version 129
1. Changed TVERSION in TECOC.H to 129.
2. Made n^T display n modulo 256 instead of generating an error when n
is out-of-range. Now it matches documentation.
3. Worked on file I/O in ZUNIX.C.
20-June-1990 version 130
1. Changed TVERSION in TECOC.H to 130.
2. Applied Tom Almy's MS-DOS fixes to prevent conversions of line feeds
written to the terminal to carriage-return/line-feed pairs.
3. Applied Tom Almy's fixes to the search code. Now backwards searches
work better.
4. Applied Tom Almy's fixes so eight-bit characters are better supported.
5. Minor fixes to ExeW.
6. Replaced ZRdLin in ZMSDOS.C with Tom Almy's superior version.
7. EBfFul was a global used only by RdLine, ExeA and RdPage. I made it
an argument. Seemed like the right thing to do.
8. Changed the type of the length argument to InsStr from LONG to ptrdiff_t.
9. Applied Tom Almy's fixes to DoEvEs and ReadCS.
10. Fixed up PG.RNO and created a new PG.MEM.
11. Removed BYTE identifier from ZPORT.H and did related fixups.
12. Started (by no means complete) supporting 8-bit characters throughout
the code. In most cases, this means changing things declared "char"
to be declared "unsigned char".
13. Deleted DSPCHR.C, which wasn't even compiled.
17-July-1990 version 131 (Manfred)
0. Changed TVERSION in TECOC.H to 131
1. In TECOC.C, ChrMsk[], changed 128 RCS_DEL entries Pete added to RCS_DEF.
2. In ZMSDOS.C, added #include <fcntl.h> to get O_BINARY #define. In
ZTrmnl(), added "setmode(fileno(stdout),O_BINARY)" per Tom Almy.
3. In MAKEFILE.TC, added -K (default to unsigned char) to TCC so string
literals which are signed char ptr's don't conflict with the unsigned
char ptr's now used all over to get eight-bit chars per Tom Almy.
Also added tabort.obj to TECOC_OBJS macro. Also added -DTCPP100 macro.
4. In ZPORT.H, changed EBFEXP, EBFINIT, IBFEXP, IBFINIT from 64000
to 64000L to get rid of TC++'s "Constant is long" warnings.
5. In ERR.C, ToErr(), got rid of TC++'s "Conversion may lose significant
digits" in Sbuf[DBfPtr-DBfBeg] line by using SLen to hold DBf length;
changed bogus compare "> '\126'" to "> '\177'"; also, the final ']'
was overwriting last digit in SBuf.
6. In RDLINE.C, changed function return type of expand_ibf from an
"static" to "static void". Also added prototype.
7. In TECOC.H, added prototype for errprt().
8. In RDLINE.C, expand_ibf(), added #if DEBUGGING lines so DbgFNm is declared.
9. In ZMSDOS.C, ZRdLin(), fixed typo in #if DEBUGGING "FAILURE" section.
10. In ZMSDOS.C, ZRaloc(), added test for TC++ v1.00 since the heap layout
has changed. In TC v2.0? mimic farrealloc(), in TC++ v1.00 call
farrealloc() directly.
18-July-1990 version 132
0. Changed TVERSION in TECOC.H to 132
1. lots more work to resolve type mismatches, so lint and gcc don't
complain so much.
2. fixed the ? immediate-mode command.
3. used GAPMIN in RdLine to fix wasteful memory use.
4. removed superflous parentheses from return statements.
5. to test that identifiers defined in ZPORT.H are minimally consistent,
added some tests in TECOC.C
6. To finish up eightbit handling, added ZSetTT, a function to let TECO set
terminal characteristics. Since it's there, added code so the 1:W and
2:W commands change screen size. Not video yet, but a little closer.
7. Changed ZMkOFN into a macro named ZMKOFN.
8. Fixed ZChIn to handle NoWait correctly.
9. Fixed handling of 0,32et bit.
(8-August-1990 Manfred)
10. In TECOC.C, changed "\n" to "\r\n" in debugging displays since stdout
is now in binary mode.
11. In INIT.C, in MemIni(), added Tom Almy's suggestion to temporarily
allocate a small chunk of memory to be used as a small-allocation
memory pool which may help keep memory fragmentation down.
12. In ZPORT.H, removed unused UWORD typedef.
13. In ZMSDOS.C, in ZVrBos(), changed old style function definition.
14. In ZMSDOS.C, propagated MPtrs[] dynamic allocation tracking to ZRaloc(),
added TC++'s new heapcheck() routines to check the heap on every alloc,
realloc, and free. We *are* DEBUGGING and don't care about speed
penalties, right?
15. In ERR.C, the one-line error messages for ERR_PES and ERR_PDO were
switched (Argh!).
16. In ZPORT.H, expanded EXS_SIZE, LPS_SIZE, MCS_SIZE, and QRS_SIZE so
SQU.TEC has some breathing room. Should these expand themselves?
17. Some of the .TEC and .TES files supplied with TECO-C were padded with
NUL's and some lines ending with ESC had an extra CR.
18. In ZMSDOS.C, ZDspCH() called write(). should call fwrite() or we're
mixing calls to write/fwrite on stdout which is bad. also, the code
which directly set stdout->flags'_F_BIN bit after setmode(stdout) in
ZTrmnl() somehow was lost between Pete's version and mine (?)
19. In ZMSDOS.C, in ZRdLin(), iBuf was cast as "char far *", should have
been cast simply as a "char *" otherwise compiling w/small data model
doesn't work.
20. In CHANGE.TES, changed some ^U constructs so it's now SQUishable.
21. In ZMSDOS.C, added ff_path[] to save ENfilespec$ wildcard lookup
filename since we can't be sure FBf will still contain the wildcard
lookup filename between ENfilespec$ and EN$.
22. Changed CLPARS.TES so when you MUNG there's no leftover trash in
q-register 0. (Pete)
19-August-1990 version 133 (Manfred)
0. Changed TVERSION in TECOC.H to 133
1. In EXEO.C, added support for computed gotos (nOtag0,tag1...$)
2. In INIT.C, in MemIni(), the digit buffer was being overrun on -1== since
the calculation to allocate the digit buffer either: a) didn't take into
account that 32-bits-per-long/3-bits-per-octal-digit doesn't divide evenly
(loses 2 bits), or b) didn't take into account that ExeEqu() might append
<CR><LF> to the digit buffer for =, ==, or === display purposes.
3. In ZMSDOS.C, fixed MPtrs[] tracking in ZRaloc, didn't work correctly
when farrealloc() eventually returns NULL.
4. In TECOC.C, added Turbo C's heapcheck() routine to check_consistency().
5. In RDLINE.C, in RdLine(), after expand_ibf(), was calling ZRdLin() even
if EBfFul was set TRUE. I don't think it should, even though we might be
able to read a line less than IBFMIN bytes long.
9-September-1990 version 134 (Pete)
0. Changed TVERSION in TECOC.H to 134
1. Changed the way I handle conditional inclusion of debugging code.
Borrowing from the way the ANSI assert macro works, all the debugging
functions are now macros, which don't produce any code if DEBUGGING
is FALSE.
2. Added TECOC.OPT so the VAX linker puts literal text strings into a
non-writeable PSECT.
3. Fixed ExeBSl so it will read a numeric string from the edit buffer even
if it's preceded by a minus-sign or plus-sign, and fixed TSTBSL.TEC
so it tests for these cases.
18-October-1990 version 135 (Pete)
0. Changed TVERSION in TECOC.H to 135.
1. Updated PG.RNH/PG.MEM again.
2. Fixed define of DBGFEX in TECOC.H so DEBUGGING works again.
3. Fixed FindQR and ExeM to make TECO-C handle :M commands correctly.
21-November-1990 version 136
0. Changed TVERSION in TECOC.H to 136.
1. Fixed DBGFEX syntax bug on line 1118 of ZMSDOS.C
2. Removed extra close parenthesis in EXEW.C
3. Fixed BLDSTR.C to allow searching for nulls. Thanks to Tom Almy.
4. Fixed ExeFGt to work correctly. Bug found by Richard Graham.
5. Added missing enblosing braces in InsStr. Thanks to Mark Henderson.
6. Added Mark Henderson's additional code to BldStr to provide ^EQ* (file
spec buffer) and ^EQ_ (search string buffer) support. Then broke BldStr
into functions for readability.
7. Inserted Mark Henderson's time and date code into ZUNIX.C. Testing with
DATE.TEC revealed a slight bug, fixed.
8. Added ZAMIGA.C and some mods to ZPORT.H from Ben Mesander to support
TECO-C under Amiga-DOS. Thanks Ben!
9. Fixed ExeEQ so it preserves the state of FFPage when reading files.
Thanks to Mark Henderson.
10. Added ZBell function to make the bell sound better under MS-DOS.
Thanks to Steve Freyder.
11. Added Mark Henderson's code (he got glob.c from Berkeley stuff)
to do wild-carding of file names. Reorganized it some. Thanks, Mark.
12. Added Mark's code to name backup files sort of like VMS. Not sure I
like this yet, because I haven't tried it. ED bit 4 controls it, like
so (from Mark:)
ED&4 now specifies the mechanism for backup files
if ED&4 is set then we use the foo foo.bak mechanism (as originally)
if ED&4 is clear the first backup file will be named foo;1, the
second foo;2, ...&c. Sort of VMS like, but the most recent
version will be known by the name foo.
13. Mark added TECFILES environment variable.
If for ei commands and TECO.INI the file is not found in the
current directory the directory $(TECFILES) will be searched.
I've been keeping my teco startup files in ~/.teco
26-December-1990 version 137
0. Changed TVERSION in TECOC.H to 137.
1. Minor fixups to get ZUNIX.C to compile.
2. Moved the line that resets FFPage to zero. It was in RdPage, now it's
in RdLine so a 1:a command now correctly resets flag. Thanks to Richard
Graham for reporting this one.
3. Modified ExeCtE so you can now set the flag as well as get its value,
like in TECO-11 and TECO-32.
4. Fixed ExeBSl so it sets RefLen when it converts a digit string in the
edit buffer into a binary value. Thanks to Mark Henderson.
5. Merged in new Amiga support files from Ben Mesander. There's a new
ZAMIGA.C, which now has time and date support. Ben supplied files
MAKEFILE.AMI and TECOC.LNK for building on the Amiga.
29-December-1990 version 138
0. Changed TVERSION in TECOC.H to 138.
1. Rewrote the TSTO.TEC macro, which pointed out a bug in TECO-32!
2. Added "smallcode smalldata" to LFLAGS vlue in MAKEFILE.AMI to make TECO-C
smaller (for faster startup) under AmigaDOS. Thanks to Ben Mesander.
3. Moved OpnInp and OpnOut into ExeE because only ExeE functions call them.
4. Changed ZOpInp function in ZVMS to do the right thing with the default
macro library directory. ZAMIGA.C, ZUNIX.C and ZMSDOS.C need to be
changed.
10-January-1991 version 139
0. Changed TVERSION in TECOC.H to 139.
1. Fixed ZUNIX.C so it handles default EI file names correctly. Still needs
ZClnEG to be implemented.
2. Applied Mark Henderson's patch to ZChIn to fix Control-C handling.
3. Applied Mark Henderson's patch to ExeEQ to fix EBFEnd pointer screw-up
when reading a large file with EQ. Thanks again, Mark!
4. Applied Ben Masander's patch to ZAMIGA.C to correctly call isatty.
5. Implemented "SYM" part of :EG command for VAX/VMS, so TECO-C can set DCL
symbols like DEC's TECO.
20-January-1991 version 140
0. Changed TVERSION in TECOC.H to 140.
1. Reworked ExeEG and ZClnEG to make it work under Unix and to do the
system dependent stuff in the right places.
2. Modified GENCLP to make it create clpars as "unsigned char" instead of
"signed char" to remove a gcc warning. Made GENCLP compile/link/run under
SunOS and modified MAKEFILE.SUN to include processing of GENCLP.
3. Changed GENCLP.C to define clpars as "const" for ANSI compilers.
4. Received another ZAMIGA.C from Ben Mesander. He is now using RCS to
control revisions, so there'll be version numbers for ZAMIGA.C from now
on. This is version 1.4.
5. Implemented Mark Henderson's suggestion to make the size of error
message buffers a #define'd identifier. I named it ERBFSIZ.
6. Merged in Mark Henderson's video support. This involved a LOT of
changes, including:
a. Merged MOVE.C into ZUNIX.C
b. changed VOID to VVOID to avoid clashing with CURSES.H
c. lots of added code with "#if CURSES" control
d. created VIDEO.TXT
e. created an EZ mode control flag for Mark's bits.
f. added exetil.c
23-February-1991 version 141
0. Changed TVERSION in TECOC.H to 141.
1. Some slight changes to make lint happy.
2. From Manfred: added DBGFEN calls to DoCtVW and DoCtE in BldStr, fixed
DbgFNm in ExeF, removed extra "#include <dos.h>" from ZMSDOS.C, added
"fclose(fp)" to init_code_checksums in ZMSDOS.C, and some other minor
fixups in ZMSDOS.C. Changed MAKEFILE.TC to avoid "Abnormal Program
Termination".
3. Added check of terminal width & height to ExeW for 0,1:w error.
4. Added Mark Henderson's fix to let ZUNIX.C compile under SunOS 4.0.
15-March-1991 version 142
0. Changed TVERSION in TECOC.H to 142.
1. Added Ben's fixes to slight build problems on AmigaDOS.
2. Fixed makefile.sun to make it handle SunOS 4.1 as well as 4.0. Still
needs hand-editing to the makefile before running it. Defaults to 4.1.
3. Added some fixes to ZUNIX.C to reduce gcc warnings.
4. Repaired makefile.sun, which was broken.
5. Fixed EXEFTIL.C and EXEF.C so they compile when DEBUGGING is defined.
20-April-1991 version 143
0. Changed TVERSION in TECOC.H to 143.
1. Changed CLPARS.TEC to parse Unix command lines with "-" for options
instead of "/".
2. Under Unix, changed ZClnEg to implement last-file-edited memory using
files in /tmp instead of gawdawful TECF00.TMP files in the current
directory.
3. Slight include file #ifdef changes to let it compile under SunOS 4.1.1.
4. Changed makefile.sun to not use a library. It's much faster this way.
5. Added case for tilde command to SkpCmd.c.
6. Those C files that directly include curses.h needed to have the
#include moved above zport.h.
7. Fixed ExeW so if we're not compiled with video, it returns nothing
instead of FAILURE, like TECO32. Returning FAILURE causes the current
macro to fail, and the current macro might be CLPARS!
8. Fixed ZUNIX.C so ET_UNIXNL is correctly defined.
9. Added Jerry Leichter's fixes to port to Ultrix, including makefile.ulx.
10. Fixed bug in ZUNIX.C where ZDspCh was being called with a string instead
of a character. Thanks Jerry!
2-June-1991 version 144
0. Changed TVERSION in TECOC.H to 144.
1. For the ^P command (for debugging, must compile with DEBUGGING set)
to work, each function that starts with a call to DBGFEN needs to have
a call to DBGFEX before every exit point, or the pretty nesting gets
screwed up. Added some DBGFEX calls to BldStr and ZOClos (in ZUNIX.C)
to fix the display when 4,0 is used.
2. Fixed DoFlag, ExeCtR, ExeCtT, ExeW and ExeBSl so they check the expression
stack correctly. They can now be used in expressions without problems.
Thanks to Mark Henderson and Jerry Leichter for reporting this.
3. Moved the check for "negative argument to comma" from ExeCom to GetAra,
where it belongs. This allows -1,5:w commands to work. Thanks to Jerry
Leichter.
4. Instead of "unterminated command", GetNmA now returns "ill-formed
expression", an new error message, when the stack is bogus.
5-June-1991 version 145
0. Changed TVERSION in TECOC.H to 145.
1. Modified PshMac to test set NumArg correctly, so a command like
^UA1$2+MA=$$ will work.
2. The "#else" on line 122 of ZUNIX.C should be a "#endif".
5-June-1991 to 18-June-1993 version 146
0. Changed TVERSION in TECOC.H to 146.
1. Removed the ~ and F~ commands (the EXETIL.C file and the ExeFTi function)
They were temporary commands used by Mark Henderson.
3. Added makefile.cct, fixed various minor nits suggested by CodeCenter.
4. Fixed error in the way the EI command reads files. If the file being
read was too large for the buffer, memory was getting stomped. Thanks
to Mark Henderson for reporting the bug in detail and suggesting a fix.

22
src/chmacs.h 100644
View File

@ -0,0 +1,22 @@
/*****************************************************************************
Chmacs.h
These are tested relational expressions. The ones defined for some
C's, like isalnum, tolower, etc do not always work, because they rely on bit
patterns within ASCII. These work.
Note: if this file is included, the tecoc.h file must precede it.
*****************************************************************************/
extern unsigned char ChrMsk[];
#define Is_Upper(ch) (ChrMsk[(ch)] & CM_UPPER)
#define Is_Lower(ch) (ChrMsk[(ch)] & CM_LOWER)
#define Is_Digit(ch) (ChrMsk[(ch)] & CM_DIGIT)
#define Is_Alpha(ch) (ChrMsk[(ch)] & (CM_UPPER | CM_LOWER))
#define Is_Alnum(ch) (ChrMsk[(ch)] & (CM_UPPER | CM_LOWER | CM_DIGIT))
#define To_Lower(ch) (Is_Upper(ch) ? (ch)+' ' : (ch) )
#define To_Upper(ch) (Is_Lower(ch) ? (ch)-' ' : (ch) )
/*****************************************************************************
these are TECO-specific. The above are not.
*****************************************************************************/
/* is line terminator */
#define IsEOL(ch) (ChrMsk[(ch)] & CM_LINE_TERM)
/* is symbol constituent */
#define Is_SyCon(ch) (Is_Alnum(ch) || ch == '.' || ch == '_' || ch == '$')

50
src/clenup.c 100644
View File

@ -0,0 +1,50 @@
/*****************************************************************************
ClenUp()
This function "cleans up" in preparation for terminating TECO-C. All
open files are closed and memory is freed.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
VVOID ClenUp (VVOID) /* cleanup for TECO-C abort */
{
QRptr QRp;
int i;
ZIClos(PINPFL); /* Close the primary and secondary... */
ZIClos(SINPFL); /* ...input streams, if they're open */
ZOClDe(POUTFL); /* Close the primary and secondary... */
ZOClDe(SOUTFL); /* ...output streams, if they're open */
/*
* free dynamically allocated buffers
*/
if (CBfBeg) ZFree((voidptr)CBfBeg); /* the command buffer */
if (DBfBeg) ZFree((voidptr)DBfBeg); /* the digit buffer */
if (EBfBeg) ZFree((voidptr)EBfBeg); /* the edit buffer */
if (FBfBeg) ZFree((voidptr)FBfBeg); /* the filename buffer */
if (SBfBeg) ZFree((voidptr)SBfBeg); /* the search string buffer */
/*
* free the global [0-35] and main-level local [36-71] Q-registers,
* and then the Q-register stack.
*/
for (QRp = QRgstr, i = 0; i < 72; ++i, ++QRp) {
if (QRp->Start != NULL) {
ZFree((voidptr)QRp->Start);
}
}
for (QRp = QStack, i = 0; i < QRS_SIZE; ++i, ++QRp) {
if (QRp->Start != NULL) {
ZFree((voidptr)QRp->Start);
}
}
ZClnUp(); /* do system-dependent cleanup */
#if DEBUGGING
{
/*
* at this point, there shouldn't be any block malloc'ed by TECO-C.
* except if we're here because we EX'ed out of a macro, and we can't
* get to the ZBf buffer allocated in ExeEI, so the ZBf buffer is
* left hanging.
*/
}
#endif
}

72
src/clpars.tec 100644
View File

@ -0,0 +1,72 @@
!CLPARS.TEC V2.3 14-May-2004 Tom Almy, Pete Siemsen, and Mark Henderson!
[F0,0XF[90,0X9[00,0X0[20,0X210U0[0U0[00EDU0[0ED&4EDEUU0[0-1EU
ESU0[00ESETU0[032768#32#8#1,0ETQ1U00U1[10,0X10U4
(-1EJ-25600)*(-1EJ-25858)"E-UY|/UY'@.T/:QF"E.U.1Iteco0EJ\.-Q1U.L
Q.L-8"GQ.1+4JQ.L-8D4C'I.tmpQ.1,.XFQ.1,.D'/27:.TQ0+1"E32768U0'
32768"E:EITECO"S]1Q0#32768U1[1JODONE''Z"EGZ0,0XZ'J::S^ES"SD'
::STECO32"S-2D'ZJ-:S^ES"S.-Z"EFR''Z"EODONE'Q0&32767U10,0X10,0X9
J:S^ES^EUYNOI"SONOINI'J:S^EUYNOI"FONONOINI'!NOINI!
D::SN"S-D::SI"S-D''::S^ES"SD0A"AI ''Q1#4096U1!NONOINI!Q1&4096"E
HX0HKEPEAEF:EGINI"SG*J0A-36"EDHX1HK:ER^EQ1"SYHX1HKECG1|
%Can't find initialization file ":G1"1310''0,0X1|0,0X1
(-1EJ-5)*(-1EJ-1024)"EEN[]*.*:EN"SG*JS[R0KFS.]JS]0,.X1HK''
:ER^EQ1TECO.INI"SYHX9HKECG90,0X9''EREWZ"NZJ.U0G1I=G0Q0JZX9ZK]1
]0Q0ET]0Q0ES]0Q0EU]0Q0ED]0Q0]0Q0]2HX0HKG9JS=0,.-1X90,.KM0+0U90,0X0
[20,0X210U0[0U0[00EDU0[0ED&4EDEUU0[0-1EUESU0[00ES
ETU0[032768#32#8#1,0ET[1G9X1K0,0X9Q9U1J::S^ES"SD'
ZJ-:S^ES"S.-Z"EFR''Z"EOSCOPES'|G0''J:S^ES^EUYNOM"SONOMEMORY'
J:S^EUYNOM"FONONOMEMORY'!NOMEMORY!
D::SE"S-D::SM"S-D::SO"S-D::SR"S-D::SY"S-D'''''
::S^ES"SD0A"AI ''Q1#4U1!NONOMEMORY!J:S^ES^EUYNOC"SONOCREATE'
J:S^EUYNOC"FONONOCREATE'!NOCREATE!
D::SR"S-D::SE"S-D::SA"S-D::ST"S-D::SE"S-D'''''
::S^ES"SD0A"AI ''Q1#256U1!NONOCREATE!J:S^ES^EUYNOP"SONOPAGE'
J:S^EUYNOP"FONONOPAGE'!NOPAGE!D::SA"S-D::SG"S-D::SE"S-D'''
::S^ES"SD0A"AI ''Q1#64U1!NONOPAGE!J:S^ES^EUYNOR"SONORENAME'
J:S^EUYNOR"FONONORENAME'!NORENAME!D::SA"S-D::SG"S-D::SE"S-D'''
::S^ES"SD0A"AI ''Q1#512U1!NONORENAME!
J::STE"S<0A"AC|1;'>::S^ES@"S0KIMUNG ''J::SMU"S-2D<0A"AD|1;'>
::S^ES"SD'(-1EJ-5)*(-1EJ-1024)"EJ::S""S-D::S^ES"SD'''ZU0
(-1EJ-25600)*(-1EJ-25858)"EJ:S-"SR.-Q0"L.U0''|J:S/"SR.-Q0"L.U0'''
J:S^ES"S.-Q0"L.U0''J<S,;.U1Q1-1J-:S["S:S]"S.-Q1"GF<'''
Q1-1J-:S<"S:S>"S.-Q1"GF<'''Q1-1J-:S("S:S)"S.-Q1"GF<'''
Q1-1J.-1-Q0"LD.U0'0;>Q0J<-.;-1A-32"N-1A-9"N0;''-D>0,.X.0
:Q.0"E?How can I MUNG nothing?1310'::S^ES 0,.K0U0EI^EQ.0
JODONE'J:S^ES^EUYVT"SOVTEDIT'J:S^EUYVT"FONOVTEDIT'!VTEDIT!
The VTEDIT command line option is not supported by TECOC1310
!NOVTEDIT!J:S^ES+"SD\U40,128EZD::Ss"SD0A"AI '''Q1&64"N0,128EZ'
J:S^ES^EUYSC"SOSCROLL'J:S^EUYSC"FONOSCROLL'!SCROLL!
D::SR"S-D::SO"S-D::SL"S-D::SL"S-D''''::S:^ED"SR-D\U2FR|0U2'
::S:S"S-2D::SE"S-D::SE"S-D::SA"S-D::SL"S-D::SL"S-D'''''Q1#16U1'
::S^ES"SD0A"AI ''Q1#128U1!NOSCROLL!J::STE"S-2D<0A"AD|1;'>
::S^ES"SD'J:S^ES^EUYIN"SOINSPECT'J:S^EUYIN"FONOINSPECT'!INSPECT!
D::SS"S-D::SP"S-D::SE"S-D::SC"S-D::ST"S-D'''''
::S^ES"SD0A"AI ''Q1#2U1!NOINSPECT!J:S^ES^EUYFI"SOFIND'
J:S^EUYFI"FONOFIND'!FIND!
The /FIND command line option is not supported by TECOC1310
!NOFIND!J<.-Z;0A-9"EDF<'0A-32"EDF<'C-1A-""E:S""S
(-1EJ-25857)*(-1EJ-25858)"E0J2<@FS/"//>ZJ'|ZJ''>Q1&4#Z"E:EGMEM"SG*J
::S$"SD|OGOTIT'|M.TGF'HX0HKEPEAEF:ER^EQ0"SYL."N-1A-10"E-D''
."N-1A-13"E-D''ZKHX0HKECG0'EREW0,0X0!GOTIT!ZJZ"NQ1#32768#16384U1''
Q1&16384"NQ1&2"EEdi|Inspec'ting file "HT"1310'Z"E
Q1&2"EOSCOPES'?How can I inspect nothing?1310'Q1&2"EJ:S="S
0,.-1X00,.KZU0HX2HK:Q2"N:ER^EQ2"UG2HX0HKONOTFND'':Q0"NEW^EQ0'Q0"N
Q1#2048U1'OREMEM''HX0HKQ1&2"E:EB^EQ0"SQ1#2048U1OREMEM':ERQ0"S
Q1#2048U1%Can't write to file -- opening for input only1310OREMEM
'Q1&256"NQ1&32768"EONOTFND''%Can't find file ":G0"1310
Q1&32768"E%Creating new file1310OCREATE|
%Ignoring TECO's memory1310Q1#8192U10,0X0OREMEM'':ER^EQ0"S
Q1#2048U1OSCOPES'!NOTFND!?Can't find file ":G0"?1310'
J::SMA"S-2D<0A"AD|1;'>::S^ES"SD'J<.-Z;0A-9"EDF<'0A-32"EDF<'C
-1A-""E:S""S(-1EJ-25857)*(-1EJ-25858)"E0J2<@FS/"//>ZJ'|ZJ''>
Z"E?How can I MAKE nothing?1310'
Z-4"EJ::SLOVE"SNot war?1310''HX0HK!CREATE!EW^EQ0OREMEM'
%Unrecognized command "HTHK"1310OSCOPES!REMEM!Q1&8192"E
Q1&(32768#4)"NOSCOPES':Q0"EOSCOPES'':EGMEM"SZJG*C::S$"U
ZK:EGMEM ^EQ0OSCOPES|-1DZXFZK'|M.T'EA:EW^EQF"SG0HPWHKEF'EW!SCOPES!
!YANK!Q1&2048"NY'JQ1&128"NET&512"E
%Your terminal is not an interactive scope1310|Q2"E2:W-4U2'0,3:W
Q1&16"N1,3:W'0,5:WQ1&32"N1,5:W'Q2,7:W-Q2"N
%Your terminal doesn't support scrolling1310'''!DONE!Q4-1"G
Q4-1:S^J"U0J''Q1&64"N0,128EZ'Q1&512"N0,2EZ']1]0Q0ET]0Q0ES]0Q0EU]0Q0ED
]0Q0]0Q0]2]0]9]F0U.10U.L0U40UY0,0X.T

808
src/clpars.tes 100644
View File

@ -0,0 +1,808 @@
!CLPARS.TEC V2.3 14-May-2004 Tom Almy, Pete Siemsen, and Mark Henderson!
!+***************************************************************************
This macro is the imbedded command-line parsing macro for TECOC. It
was created by extracting the imbedded command-line parsing macro from the
TECO-11 executable file and then modifying it.
This macro is compiled into TECO-C. This is the human-readable
source code. To compress it (remove comments, extra whitespace, etc.)
into an unreadable version in file CLPARS.TEC, do the following command
with a working TECO:
mung squ clpars.tec=clpars.tes/d:n/l:y/b:y/t:n/c:+/w:n/a:y/e:n
Then run genclp to convert CLPARS.TEC into CLPARS.H, a C include file.
Notes:
1. On entry, Q1 contains a value
2. Bits in Q-register 1 have the following meanings:
1 /VTEDIT
2 /INSPECT
4 /NOMEMORY
8 /FIND
16 /SEEALL
32 /HOLD
64 /NOPAGE
128 /SCROLL
256 /NOCREATE
512 /NORENAME
1024 unused
2048 input file is open
4096 /NOINI
8192 force setting of filespec memory
16384 input filename is in edit buffer
32768 ???
3. Q-register 2 holds numeric argument of /SCROLL:n switch
4. Q-register Y holds the command-line option character, which
is a slash on most systems, and a dash under Unix.
5. Q-register .T holds a macro which is needed only when the :EGMEM
command isn't supported. It generates (in q-register F) the
name of a file that holds filename memory.
6. Q-register F holds the name of the file used to save file names.
7. Q-register 4 holds the line number to go to.
****************************************************************************!
!+ save the q-registers that we'll be changing !
[F0,0XF
[90,0X9
[00,0X0
[20,0X2
10U0[0 !+ radix 10 !
U0[00 !+ case independent searching !
EDU0[0ED&4ED !+ turn on automatic memory expansion !
EUU0[0-1EU !+ no case flagging on typeout !
ESU0[00ES !+ no typeout after searches !
ETU0[032768#32#8#1,0ET !+ ^C trap, read nowait and noecho, image typeout !
Q1U0 !+ Q0 = Q1 !
0U1[1
0,0X1
0U4
(-1EJ-25600)*(-1EJ-25858)"E !+ if Unix or Linux !
^^-UY !+ Unix command lines delimit options with '-' !
|
^^/UY !+ VMS command lines delimit options with '/' !
'
!+***************************************************************************
Put a subroutine into Q-register .T which, when called, fills Q-register
F with a filename to be used to store filespec memory. This subroutine
will only be needed if the :EGMEM isn't supported.
****************************************************************************!
@^U.T/
:QF"E !+ if we haven't already set q-register F !
.U.1 !+ remember where we are in edit buffer !
Iteco !+ start building "tecoxxxx.tmp" !
0EJ\ !+ insert process id into edit buffer !
.-Q1U.L !+ length of "tecoxxxx" part of filename !
Q.L-8"G !+ if it's longer than 8 characters !
Q.1+4J !+ go to front of the digits !
Q.L-8D !+ prune most significant digits from front !
4C !+ and move to the end again !
'
I.tmp !+ finish it off !
!+ RSTS/E and RT-11 aren't supported by TECO-C
-1EJ-4"E ~* if RSTS/E ~
I<60>-MODE:#3000
|
-1EJ-7"N ~* if not RT-11 ~
I;1--CR
'
'
!
Q.1,.XFQ.1,.D !+ save it in q-register F and clean up !
'/
27:^U.T
!+***************************************************************************
If we're on RSTS/E, do something special
****************************************************************************!
!+-1EJ-4"E:QZ#Z"E-1G_J::FSdcl tecoTECO"UHK':S ^[J0''!
Q0+1"E !+ if Q1 was equal to -1 on entry !
32768U0 !+ Q0 = 32768 !
'
32768"E !+ if we're on a 16-bit machine (?) !
:EITECO"S !+ try to execute macro in file TECO !
]1
Q0#32768U1
[1
J
ODONE
'
'
!+***************************************************************************
Get the command line string from q-register Z into the edit buffer
****************************************************************************!
Z"EGZ0,0XZ' !+ get command line string from Z and clear Z !
J
::S^ES"S^SD' !+ remove leading whitespace !
::STECO32"S-2D' !+ change TECO32 to TECO, if needed !
ZJ-:S^ES"S.-Z"EFR'' !+ remove trailing whitespace !
Z"EODONE' !+ if there's no command line, don't initialize !
Q0&32767U1
0,0X1
0,0X9
!+***************************************************************************
If there's a -NOINI switch, (-NOINI if under Unix) delete it, compact
any trailing whitespace, and set the 4096 bit of q-register 1.
****************************************************************************!
J:S^ES^EUYNOI"SONOINI'
J:S^EUYNOI"FONONOINI'
!NOINI!
^SD::SN"S-D::SI"S-D''
::S^ES"S^SD0A"AI ''
Q1#4096U1
!NONOINI!
!+***************************************************************************
Execute the initialization file.
****************************************************************************!
Q1&4096"E !+ if there's no NOINI switch !
HX0HK !+ save the command line in Q0 !
EPEA !+ switch to secondary I-O streams !
EF
!+ Get the INI macro into the edit buffer !
:EGINI"S !+ get the INI file specification !
G*
J0A-36"ED !+ if the first character is a dollar-sign !
HX1
HK
:ER^EQ1"S !+ open the file for reading !
YHX1HKECG1 !+ and put it's contents into the edit buffer !
|
%Can't find initialization file ":G1"1310
'
'
0,0X1
| !+ else (no defined INI filename) !
0,0X1
(-1EJ-5)*(-1EJ-1024)"E !+ if VAX/VMS !
EN[]*.*:EN"S !+ get current dir spec into Q1 !
G*JS[R0KFS.]JS]0,.X1HK
'
'
:ER^EQ1TECO.INI"S !+ if TECO.INI exists in current directory !
YHX9HKECG90,0X9 !+ get it's contents into the edit buffer !
'
'
EREW !+ switch back to primary streams !
Z"N !+ if there's an INI macro to execute !
ZJ
.U0
G1
I=
G0
Q0J
ZX9
ZK
]1
]0Q0ET
]0Q0ES
]0Q0EU
]0Q0ED
]0Q0
]0Q0
]2
HX0
HK
G9
J
S=
0,.-1X9
0,.K
M0+0U9 !+ execute INI macro, save result in Q9 !
0,0X0
[2
0,0X2
10U0[0 !+ radix 10 !
U0[00 !+ case independent searching !
EDU0[0ED&4ED !+ turn on no-memory-expansion bit !
EUU0[0-1EU !+ no case flagging on typeout !
ESU0[00ES !+ no typeout after searches !
ETU0[032768#32#8#1,0ET !+ image mode, ^T noecho and nowait, ^C trap !
[1
G9
X1
K
0,0X9
Q9U1
J::S^ES"S^SD' !+ delete leading whitespace !
ZJ-:S^ES"S.-Z"EFR'' !+ delete trailing whitespace !
Z"E
OSCOPES
'
|
G0
'
'
!+***************************************************************************
If there's a -NOMEMORY switch (-NOMEMORY under Unix), delete it, compact
any trailing whitespace, and set the 4 bit of q-register 1.
****************************************************************************!
J:S^ES^EUYNOM"SONOMEMORY'
J:S^EUYNOM"FONONOMEMORY'
!NOMEMORY!
^SD::SE"S-D::SM"S-D::SO"S-D::SR"S-D::SY"S-D'''''
::S^ES"S^SD0A"AI ''
Q1#4U1
!NONOMEMORY!
!+***************************************************************************
If there's a /NOCREATE switch, (-NOCREATE under Unix), delete it, compact
any trailing whitespace, and set the 256 bit of q-register 1.
****************************************************************************!
J:S^ES^EUYNOC"SONOCREATE'
J:S^EUYNOC"FONONOCREATE'
!NOCREATE!
^SD::SR"S-D::SE"S-D::SA"S-D::ST"S-D::SE"S-D'''''
::S^ES"S^SD0A"AI ''
Q1#256U1
!NONOCREATE!
!+***************************************************************************
If there's a /NOPAGE switch, (-NOPAGE under Unix), delete it, compact
any trailing whitespace, and set the 64 bit of q-register 1.
****************************************************************************!
J:S^ES^EUYNOP"SONOPAGE'
J:S^EUYNOP"FONONOPAGE'
!NOPAGE!
^SD::SA"S-D::SG"S-D::SE"S-D'''
::S^ES"S^SD0A"AI ''
Q1#64U1
!NONOPAGE!
!+***************************************************************************
If there's a /NORENAME switch, (-NORENAME under Unix), delete it, compact
any trailing whitespace, and set the 512 bit of q-register 1.
****************************************************************************!
J:S^ES^EUYNOR"SONORENAME'
J:S^EUYNOR"FONONORENAME'
!NORENAME!
^SD::SA"S-D::SG"S-D::SE"S-D'''
::S^ES"S^SD0A"AI ''
Q1#512U1
!NONORENAME!
!+***************************************************************************
If we're not under RSTS/E, and the command is "TECO @file", then change
it to "MUNG file".
****************************************************************************!
!+ -1EJ-4"N! !+ if not RSTS/E !
J::STE"S<0A"AC|1;'>::S^ES@"S0KIMUNG ''
!+ '!
!+***************************************************************************
If it's a MUNG command, find the file specification, delete it from
the edit buffer, and do an EI on the file.
****************************************************************************!
J::SMU"S-2D !+ if it's a MUNG command !
<0A"AD|1;'> !+ delete alphabetics following MU !
::S^ES"S^SD' !+ delete trailing whitespace !
(-1EJ-5)*(-1EJ-1024)"E !+ if VAX/VMS !
J::S""S-D !+ and it starts with double quote !
::S^ES"S^SD' !+ remove whitespace following the " !
'
'
!+ The MUNG file specification might be followed by data to be put into
the edit buffer. The file specification and the data are separated by
a comma, a slash, or whitespace. Set Q0 to point to the end of the
file specification, regardless of how its terminated.!
ZU0 !+ put edit buffer length in Q0 !
(-1EJ-25600)*(-1EJ-25858)"E !+ if Unix or Linux !
J:S-"SR.-Q0"L.U0'' !+ if - precedes Q0, change Q0 !
|
J:S/"SR.-Q0"L.U0'' !+ if / precedes Q0, change Q0 !
'
J:S^ES"S.-Q0"L.U0'' !+ if whitespace precedes Q0, change Q0 !
J<S,; !+ if a comma precedes Q0, change Q0 !
.U1
Q1-1J-:S["S:S]"S.-Q1"GF<'''
Q1-1J-:S<"S:S>"S.-Q1"GF<'''
Q1-1J-:S("S:S)"S.-Q1"GF<'''
Q1-1J.-1-Q0"LD.U0'
0;
>
Q0J<-.;-1A-32"N-1A-9"N0;''-D> !+ delete whitespace preceding Q0 !
!+ copy the file specification into q-register .0. If there's no file
specification, complain and die. !
0,.X.0
:Q.0"E?How can I MUNG nothing?1310'
!+ delete the file specification and trailing whitespace (if any) from the
edit buffer, execute the MUNG file and we're done. !
::S^ES^[ !+ locate end of whitespace, if any !
0,.K !+ delete spec + trailing whitespace !
0U0 !+ don't leave trash in Q0 !
EI^EQ.0 !+ execute the MUNG file !
JODONE !+ and we're done !
'
!+***************************************************************************
If there's a /VTEDIT (-VTEDIT under Unix), switch...
****************************************************************************!
J:S^ES^EUYVT"SOVTEDIT'
J:S^EUYVT"FONOVTEDIT'
!VTEDIT!
The VTEDIT command line option is not supported by TECOC1310

!+
::SE"S^SD::SD"S^SD::SI"S^SD::ST"S^SD''''
::S:H"S-2D::SO"S-D::SL"S-D::SD"S-D'''Q1#32U1'
::S:S"S-2D::SE"S-D::SE"S-D::SA"S-D::SL"S-D::SL"S-D'''''Q1#16U1'
::S:H"S-2D::SO"S-D::SL"S-D::SD"S-D'''Q1#32U1'
::S^ES"S^SD0A"AI ''
Q1#1U1
!
!NOVTEDIT!
!+***************************************************************************
If we're running Unix, check for a +nnn option. If there is one, set
the 128 bit of the EZ flag (to read in the whole file, regardless of form
feeds) and put the number in Q-register 4.
****************************************************************************!
!+ -1EJ-25600"E if Unix !
J:S^ES+"S
^SD\U40,128EZ^sd::ss"S^sD0A"AI ''
'
!+ ' !
!+Set EZ flag if nopage!
Q1&64"N0,128ez'
!+***************************************************************************
If there's a /SCROLL switch (-SCROLL under Unix), delete it, get the
numeric argument (or default to 0) into q-register 2.
If :SEEALL follows -SCROLL, then set bit 16 of q-register 1.
Delete any trailing whitespace and set bit 128 of q-register 1.
****************************************************************************!
J:S^ES^EUYSC"SOSCROLL'
J:S^EUYSC"FONOSCROLL'
!SCROLL!
^SD::SR"S-D::SO"S-D::SL"S-D::SL"S-D''''
::S:^ED"SR-D\U2FR|0U2' !+ get numeric arg into Q2!
::S:S"S-2D::SE"S-D::SE"S-D::SA"S-D::SL"S-D::SL"S-D'''''
Q1#16U1
'
::S^ES"S^SD0A"AI '' !+ delete trailing whitespace!
Q1#128U1
!NOSCROLL!
!+***************************************************************************
If it's a TECO command...
****************************************************************************!
J::STE"S-2D !+ if it's a TE command !
<0A"AD|1;'> !+ delete alphabetics following TE !
::S^ES"S^SD' !+ delete trailing whitespace !
!+***************************************************************************
If there's a /INSPECT switch, (-INSPECT if under Unix) delete it, compact
any trailing whitespace, and set the 2 bit of q-register 1.
****************************************************************************!
J:S^ES^EUYIN"SOINSPECT'
J:S^EUYIN"FONOINSPECT'
!INSPECT!
^SD::SS"S-D::SP"S-D::SE"S-D::SC"S-D::ST"S-D'''''
::S^ES"S^SD0A"AI ''
Q1#2U1
!NOINSPECT!
!+***************************************************************************
If there's a /FIND switch, (-FIND if under Unix) delete it, compact
any trailing whitespace, and set the 8 bit of q-register 1.
****************************************************************************!
J:S^ES^EUYFI"SOFIND'
J:S^EUYFI"FONOFIND'
!FIND!
The /FIND command line option is not supported by TECOC1310

!+
^SD::SN"S-D::SD"S-D''
::S^ES"S^SD0A"AI ''
Q1#8U1
!
!NOFIND!
!+ If there's more to the command, then delete preceding whitespace and
if the remainder of the command line contains a quoted string, do a ZJ. !
J
<
.-Z;
0A-9"EDF<'
0A-32"EDF<'
C
-1A-""E:S""S
(-1EJ-25857)*(-1EJ-25858)"E !+ If OS/2 or Linux then delete quotes !
0J2<@FS/"//>ZJ'|
ZJ'' !+ if no second quote, go to end !
>
!+ Get the remembered file specification into the edit buffer. !
Q1&4#Z"E !+ if there's no file name and no -NOMEMORY !
:EGMEM"S !+ if :EGMEM is supported !
G*J !+ get it into the edit buffer !
::S$"S^SD !+ if leading dollar sign, delete and... !
|OGOTIT' !+ otherwise got it and get outa here !
| !+ else :EGMEM isn't supported !
M.T !+ generate file name in F !
GF !+ and get it !
'
HX0HK !+ save filename in Q0 and clear buffer !
EPEA !+ select secondary I-O streams !
EF !+ close current output file !
:ER^EQ0"S !+ open file (name is in Q0) !
Y
L
."N-1A-10"E-D'' !+ remove trailing lf, if any !
."N-1A-13"E-D'' !+ remove trailing cr, if any !
ZK
HX0HK
EC !+ copy input to output and close streams !
G0
'
EREW !+ select primary I-O streams !
0,0X0
!GOTIT!
!+ If there's a file specification, then delete preceding whitespace and
if the remainder of the filespec contains a quoted string, do a ZJ. !
!+ However there shouldn't be any whitespace -- don't do this step
because it messes up names with embedded spaces
J
<
.-Z;
0A-9"EDF<'
0A-32"EDF<'
C
-1A-""E:S""UZJ''
>
! ZJ !+ but move to end just in case !
Z"N
Q1#32768#16384U1
'
' !+ endif (no filename and no -NOMEMORY) !
Q1&16384"N !+ if input filename in edit buffer !
Q1&2"E !+ if not -INSPECT !
Edi
|
Inspec
'
ting file "HT"1310
'
Z"E !+ if there's no file name !
Q1&2"EOSCOPES' !+ if not -INSPECT, goto SCOPES !
?How can I inspect nothing?1310

'
Q1&2"E !+ if not -INSPECT !
J:S="S !+ if it's ofile=ifile !
0,.-1X00,.K !+ save ofile name in Q0 !
ZU0 !+ save length of ifile name in Q0 !
HX2HK !+ save ifile name in Q2 !
:Q2"N !+ if there's an ifile name !
:ER^EQ2"U !+ try to open the ifile !
G2HX0HKONOTFND !+ and goto NOTFND if it fails !
'
'
:Q0"N !+ if there's an ofile name !
EW^EQ0 !+ open the ofile !
'
Q0"N !+ if the ifile name length not = 0 !
Q1#2048U1 !+ remember: input file is open !
'
OREMEM
'
'
HX0HK
Q1&2"E !+ if not -INSPECT !
:EB^EQ0"S !+ open it for reading-writing !
Q1#2048U1 !+ remember: input file is open !
OREMEM
'
:ERQ0"S !+ TAA Added -- try to open for read !
Q1#2048U1
%Can't write to file -- opening for input only1310
OREMEM
'
Q1&256"N !+ EB failed, so if -NOCREATE !
Q1&32768"E
ONOTFND
'
'
%Can't find file ":G0"1310
Q1&32768"E
%Creating new file1310
OCREATE
|
%Ignoring TECO's memory1310
Q1#8192U1
0,0X0
OREMEM
'
'
:ER^EQ0"S !+ it's -INSPECT, open input file !
Q1#2048U1 !+ remember: input file is open !
OSCOPES
'
!NOTFND!
?Can't find file ":G0"?1310

'
!+***************************************************************************
If it's a MAKE command...
****************************************************************************!
J::SMA"S-2D
<0A"AD|1;'> !+ delete letters following MA !
::S^ES"S^SD' !+ delete trailing whitespace !
J
<
.-Z;
0A-9"EDF<'
0A-32"EDF<'
C
-1A-""E:S""S
(-1EJ-25857)*(-1EJ-25858)"E !+ If OS/2 or Linux then delete quotes !
0J2<@FS/"//>ZJ'|
ZJ'' !+ if no second quote, go to end !
>
Z"E?How can I MAKE nothing?1310'
Z-4"EJ::SLOVE"SNot war?1310''
HX0HK !+ save the filespec in Q0 for REMEM !
!CREATE!
EW^EQ0 !+ Open file for writing !
OREMEM !+ and go remember !
'
%Unrecognized command "HTHK"1310
OSCOPES
!+***************************************************************************
Remember the filename in filespec memory. The filespec is in Q0.
****************************************************************************!
!REMEM!
Q1&8192"E !+ if 8192 bit is off in Q1 !
Q1&(32768#4)"NOSCOPES' !+ if ??? or -NOMEMORY, goto SCOPES !
:Q0"EOSCOPES' !+ if Q0 is empty, goto SCOPES !
'
!+ The file specification is now in Q0. If :EGMEM is unsupported, a file
is used to implement filespec memory.
!
:EGMEM"S !+ if :EGMEM is supported !
ZJG*C !+ append remembered spec to buffer !
::S$"U !+ no leading $ !
ZK:EGMEM ^EQ0 !+ set remembered filespec to Q0 !
OSCOPES !+ Goto SCOPES !
|
-1D !+ delete dollar !
ZXFZK !+ Save in q reg F !
'
|
M.T !+ Generate file name !
'
EA !+ switch to secondary output stream !
:EW^EQF"S !+ open the file !
G0 HPW HK EF !+ and write the filespec into it !
'
EW !+ switch to primary output stream !
!+***************************************************************************
****************************************************************************!
!SCOPES!
!+ -VTEDIT is not supported
Q1&1"N ~* if /VTEDIT ~
ET&512"E
%Your terminal is not an interactive scope1310
Q1#1-1U1
|
0,3:W ~* clear SEEALL mode ~
Q1&16"N-1,3:W' ~* if /SEEALL, set SEEALL mode ~
0,5:W ~* clear hold mode ~
Q1&32"N/1,5:W' ~* if /HOLD, set hold mode ~
'
'
Q1&1"E
OYANK
'
~* load the VTEDIT macro file name into q-register 9 ~
:EGVTE"S ~* if :EGVTE is supported ~
1G*X9K
|
:@9%DIT%
:Q1"E
(-1EJ-5)*(-1EJ-1024)"E
EN[]*.*:EN"S
ZJ
.U0
G*
Q0J
S[ R
Q0,.K
FS.] Q0J
S] Q0,.X1
Q0,ZK
'
'
'
'
:Q9"N ~* if Q9 isn't empty ~
:EI^EQ1^EQ9"S
Q1#2048-2048U1
OYANK
'
'
~****************************************************************************
Get the library directory specification into q-register 1.
If there's no defined library directory, define the default one.
****************************************************************************~
:EGLIB"S ~* if there's a defined lib dir ~
G*X1K ~* use it ~
| ~* else ~
-1EJ-0"E @1%LB:[1,2]% | ~* if RSX-11D: LB:[1,2] else~
-1EJ-1"E @1%LB:[1,2]% | ~* if RSX-11M: LB:[1,2] else~
-1EJ-2"E @1%LB:[1,2]% | ~* if RSX-11S: LB:[1,2] else~
-1EJ-3"E @1%LB:[1,2]% | ~* if IAS: LB:[1,2] else~
(-1EJ-5)*(-1EJ-1024)"E ~* if VAX/VMS ~
@1%SYS$LIBRARY:% | ~* SYS$LIBRARY: else~
-1EJ-6"E @1%LB:[1,2]% | ~* if RSX-11S: LB:[1,2] else~
-1EJ-7"E @1%SY:% | ~* if RT-11: SY: else~
@1%% ~* default: nothing ~
'''''''
'
:Q1"N ~* if there's a library directory ~
:EI^EQ1VTEDIT"S ~* execute the macro in there ~
Q1#2048-2048U1
OYANK
'
'
%The :G9 macro is not available1310
!
!+**************************************************************************!
!YANK!
Q1&2048"N !+ if input file is open !
Y !+ read in the first page !
'
J
!+
Q1&8"N ~* if /FIND ~
Finding position marker...1310
EW G*
X0
K
-1
:Q0"N
:N~~/\~~
"S^SD'
U0
|
:_~~/\~~
"S^SD'
U0
'
0
Q0"U
?Position marker not found?1310

'
'
!
!+***************************************************************************
On entry, Q2 contains the numeric argument given in the -SCROLL:n
switch, or 0 if no -SCROLL switch was specified.
****************************************************************************!
Q1&128"N !+ if -SCROLL !
ET&512"E
%Your terminal is not an interactive scope1310
|
Q2"E
2:W-4U2
'
0,3:W Q1&16"N !+ if -SEEALL !
1,3:W '
0,5:W Q1&32"N !+ if -HOLD!
1,5:W '
Q2,7:W-Q2"N
%Your terminal doesn't support scrolling1310
'
'
'
!+***************************************************************************
****************************************************************************!
!DONE!
q4-1"G !+ if q4 greater than 1 !
q4-1:s^J"U0J' !+ search for q4th line feed !
'
q1&64"N !+ NOPAGE switch? !
0,128EZ
'
q1&512"N !+ NORENAME switch? !
0,2EZ
'
]1
]0Q0ET
]0Q0ES
]0Q0EU
]0Q0ED
]0Q0
]0Q0
]2
]0
]9
]F
0U.10U.L0U40UY0,0X.T !+ reset q registers !


279
src/cmatch.c 100644
View File

@ -0,0 +1,279 @@
/*****************************************************************************
CMatch()
This recursive function trys to match one match construct with the
character pointed to by EBPtr2. It sets SamChr, which indicates whether the
match was successful or not. SStPtr is left pointing to the last character
of the match construct.
If the match construct is ^Em or ^S, then EBPtr2 will be updated to
point to the last matched character. In this case, RhtSid is needed to
indicate the limit past which EBPtr2 should not be incremented.
Match constructs are:
^X match any character
^S match a separator character (not letter or digit)
^N match anything but following match construct
^EA match any alphabetic
^EB match a separator character (not letter or digit)
^EC match symbol constituent
^ED match any digit
^EGq match any character in q-register q
^EL match any line terminator (LF, VT, FF)
^EM match non-null string of following match construct
^ER match any alphanumeric
^ES match non-null string of spaces and/or tabs
^EV match lowercase alphabetic
^EW match uppercase alphabetic
^EX match any character
^E<nnn> match character with ASCII code nnn (octal)
^E[x1,x2,...xn] match any of the match constructs x1, x2, etc.
else match the character itself
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "dchars.h" /* define identifiers for characters */
#include "chmacs.h" /* define character processing macros */
#include "deferr.h" /* define identifiers for error messages */
DEFAULT CMatch(SamChr) /* match a character */
BOOLEAN *SamChr; /* returned match indicator */
{
BOOLEAN ChrMat; /* character match indicator */
char OtCase; /* "other" case character */
charptr QRPtr; /* pointer into q-register text */
charptr SavEP2; /* temporary holder of EBPtr2 */
charptr SavSSP; /* temporary holder of SStPtr */
DEFAULT Status; /* FindQR() status for ^EGq */
charptr TCBfPt; /* temporary holder of CBfPtr */
charptr TCStEn; /* temporary holder of CStEnd */
unsigned int TmpChr; /* accumulator for ^E<nnn> */
#if DEBUGGING
static char *DbgFNm = "CMatch";
sprintf(DbgSBf,"*SStPtr = '%c', *EBPtr2 = '%c'", *SStPtr, *EBPtr2);
DbgFEn(3,DbgFNm,DbgSBf);
#endif
switch (*SStPtr) {
case CTRL_X:
*SamChr = TRUE;
break;
case CTRL_S:
*SamChr = !Is_Alnum(*EBPtr2);
break;
case CTRL_N:
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ISS); /* ill. search str. */
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
if (CMatch(&ChrMat) == FAILURE) {
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
*SamChr = !ChrMat;
#if DEBUGGING
sprintf(DbgSBf,"SUCCESS, *SamChr = %s",
(*SamChr == TRUE) ? "TRUE" : "FALSE");
DbgFEx(3,DbgFNm,DbgSBf);
#endif
return SUCCESS;
case CTRL_E:
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE); /* ICE = illegal ^E */
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
switch (To_Upper(*SStPtr)) {
case 'A':
*SamChr = Is_Alpha(*EBPtr2);
break;
case 'B':
*SamChr = !Is_Alnum(*EBPtr2);
break;
case 'C':
*SamChr = Is_SyCon(*EBPtr2);
break;
case 'D':
*SamChr = Is_Digit(*EBPtr2);
break;
case 'G':
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE); /* ill. ^E command */
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
TCBfPt = CBfPtr; /* save CBfPtr */
TCStEn = CStEnd; /* save CStEnd */
CBfPtr = SStPtr;
CStEnd = SBfPtr;
Status = FindQR();
SStPtr = CBfPtr;
SBfPtr = CStEnd;
CBfPtr = TCBfPt; /* restore CBfPtr */
CStEnd = TCStEn; /* restore CStEnd */
if (Status == FAILURE) {
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
QRPtr = QR->Start;
while (QRPtr < QR->End_P1) {
if (*QRPtr++ == *EBPtr2) {
*SamChr = TRUE;
#if DEBUGGING
sprintf(DbgSBf,"SUCCESS, *SamChr = %s", (*SamChr)?"TRUE":"FALSE");
DbgFEx(3,DbgFNm,DbgSBf);
#endif
return SUCCESS;
}
}
*SamChr = FALSE;
break;
case 'L':
*SamChr = IsEOL(*EBPtr2);
break;
case 'M':
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
SavSSP = SStPtr;
if (CMatch(&ChrMat) == FAILURE) {
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
*SamChr = ChrMat;
if (ChrMat) {
while (EBPtr2 <= RhtSid) {
SavEP2 = EBPtr2;
++EBPtr2;
SStPtr = SavSSP;
if (CMatch(&ChrMat) == FAILURE) {
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
if (!ChrMat) {
EBPtr2 = SavEP2;
break;
}
}
}
#if DEBUGGING
sprintf(DbgSBf,"SUCCESS, *SamChr = %s",(*SamChr)?"TRUE":"FALSE");
DbgFEx(3,DbgFNm,DbgSBf);
#endif
return SUCCESS;
case 'R':
*SamChr = Is_Alnum(*EBPtr2);
break;
case 'S':
if ((*EBPtr2 != SPACE) && (*EBPtr2 != TABCHR)) {
*SamChr = FALSE;
} else {
*SamChr = TRUE;
while (EBPtr2 <= RhtSid) {
++EBPtr2;
if ((*EBPtr2 != SPACE) && (*EBPtr2 != TABCHR)) {
EBPtr2--;
break;
}
}
}
break;
case 'V':
*SamChr = Is_Lower(*EBPtr2);
break;
case 'W':
*SamChr = Is_Upper(*EBPtr2);
break;
case 'X':
*SamChr = TRUE;
break;
case '<':
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3, DbgFNm,"FAILURE");
return FAILURE;
}
TmpChr = 0;
while (Is_Digit(*SStPtr)) {
TmpChr *= 8;
TmpChr += *SStPtr - '0';
if (TmpChr > 255) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
}
if (*SStPtr != '>') {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
*SamChr = (*EBPtr2 == (unsigned char)TmpChr);
break;
case '[':
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
while (*SStPtr != ']') {
if (*SStPtr == ',') {
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
} else {
if (CMatch(&ChrMat) == FAILURE) {
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
if (ChrMat) {
while (*SStPtr != ']') {
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
}
*SamChr = TRUE;
#if DEBUGGING
sprintf(DbgSBf,"SUCCESS, *SamChr = %s",
(*SamChr) ? "TRUE" : "FALSE");
DbgFEx(3,DbgFNm,DbgSBf);
#endif
return SUCCESS;
}
if (++SStPtr == SBfPtr) {
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
}
}
}
break;
default:
ErrMsg(ERR_ICE);
DBGFEX(3,DbgFNm,"FAILURE");
return FAILURE;
} /* end of ^E switch */
break;
default:
if (SMFlag == 0) { /* if case independence */
OtCase = Is_Upper(*SStPtr) ? To_Lower(*SStPtr)
: To_Upper(*SStPtr);
*SamChr = ((*EBPtr2 == *SStPtr) || (*EBPtr2 == OtCase));
} else {
*SamChr = (*EBPtr2 == *SStPtr);
}
} /* end of switch */
#if DEBUGGING
sprintf(DbgSBf,"SUCCESS, *SamChr = %s", (*SamChr) ? "TRUE" : "FALSE");
DbgFEx(3,DbgFNm,DbgSBf);
#endif
return SUCCESS;
}

37
src/dchars.h 100644
View File

@ -0,0 +1,37 @@
/*****************************************************************************
DChars.h
This header file defines identifiers for control characters.
*****************************************************************************/
#define CTRL_A '\001' /* SOH - start of heading */
#define CTRL_B '\002' /* STX - start of text */
#define CTRL_C '\003' /* ETX - end of text */
#define CTRL_D '\004' /* EOT - end of transmission */
#define CTRL_E '\005' /* ENQ - enquiry */
#define CTRL_F '\006' /* ACK - acknowledge */
#define CTRL_G '\007' /* BEL - bell */
#define BAKSPC '\010' /* BS - backspace control H */
#define TABCHR '\011' /* HT - horizontal tab control I */
#define LINEFD '\012' /* LF - line feed control J */
#define VRTTAB '\013' /* VT - vertical tab control K */
#define FORMFD '\014' /* FF - form feed control L */
#define CRETRN '\015' /* CR - carriage return control M */
#define CTRL_N '\016' /* SO - shift out */
#define CTRL_O '\017' /* SI - shift in */
#define CTRL_P '\020' /* DLE - data link escape */
#define CTRL_Q '\021' /* DC1 - device control 1 */
#define CTRL_R '\022' /* DC2 - device control 2 */
#define CTRL_S '\023' /* DC3 - device control 3 */
#define CTRL_T '\024' /* DC4 - device control 4 */
#define CTRL_U '\025' /* NAK - negative acknowledge */
#define CTRL_V '\026' /* SYN - synchronous idle */
#define CTRL_W '\027' /* ETB - end of transmission block */
#define CTRL_X '\030' /* CAN - cancel */
#define CTRL_Y '\031' /* EM - end of medium */
#define CTRL_Z '\032' /* SUB - substitute */
#define ESCAPE '\033' /* ESC - escape control [ */
#define FSCHAR '\034' /* FS - file separator control \ */
#define GSCHAR '\035' /* GS - group separator control ] */
#define RSCHAR '\036' /* RS - record separator control ^ */
#define USCHAR '\037' /* US - unit separator control _ */
#define SPACE '\040' /* SP - space */
#define DELETE '\177' /* DEL - delete */

93
src/deferr.h 100644
View File

@ -0,0 +1,93 @@
/*****************************************************************************
DefErr.h
This file defines identifiers for error messages generated by TECOC-C.
The codes that are commented out are those that were defined in TECO-11, but
are not used by TECOC-C.
IMPORTANT: if you change this file, you will need to change
TECOC.RNH, DEFERR.H, VRBMSG.H and ERR.C.
*****************************************************************************/
#define ERR_XXX -1 /* no error */
#define ERR_ARG 0 /* improper arguments */
#define ERR_BNI 1 /* > not in iteration */
#define ERR_DTB 2 /* delete too big */
#define ERR_FNF 3 /* file not found "filename" */
#define ERR_ICE 4 /* illegal ^E command in search argument */
#define ERR_IEC 5 /* illegal character "x" after E */
#define ERR_IFC 6 /* illegal character "x" after F */
#define ERR_IIA 7 /* illegal insert argument */
#define ERR_ILL 8 /* illegal command "x" */
#define ERR_ILN 9 /* illegal number */
#define ERR_IPA 10 /* negative or 0 argument to P */
#define ERR_IQC 11 /* illegal character "x" following " */
#define ERR_IQN 12 /* illegal q-register name "x" */
#define ERR_IRA 13 /* illegal radix argument to ^R */
#define ERR_ISA 14 /* illegal search argument */
#define ERR_ISS 15 /* illegal search string */
#define ERR_IUC 16 /* illegal character "x" following ^ */
#define ERR_MAP 17 /* missing ' */
#define ERR_MEM 18 /* memory overflow */
#define ERR_NAB 19 /* no argument before ^_ */
#define ERR_NAC 20 /* no argument before , */
#define ERR_NAE 21 /* no argument before = */
#define ERR_NAP 22 /* no argument before ) */
#define ERR_NAQ 23 /* no argument before " */
#define ERR_NAS 24 /* no argument before ; */
#define ERR_NAU 25 /* no argument before U */
#define ERR_NCA 26 /* negative argument to , */
#define ERR_NFI 27 /* no file for input */
#define ERR_NFO 28 /* no file for output */
#define ERR_NYA 29 /* numeric argument with Y */
#define ERR_NYI 30 /* not yet implemented */
#define ERR_OFO 31 /* output file already open */
#define ERR_PDO 32 /* push-down list overflow */
#define ERR_PES 33 /* attempt to pop empty stack */
#define ERR_POP 34 /* attempt to move pointer off page with "x" */
#define ERR_SNI 35 /* ; not in iteration */
#define ERR_SRH 36 /* search failure "text" */
#define ERR_STL 37 /* string too long */
#define ERR_TAG 38 /* missing tag !tag! */
#define ERR_UTC 39 /* unterminated command "x" */
#define ERR_UTM 40 /* unterminated macro */
#define ERR_XAB 41 /* execution aborted */
#define ERR_YCA 42 /* Y command aborted */
/*
* The following errors aren't listed in the Standard TECO Manual, but
* were added for use by TECO-C.
*/
#define ERR_IFE 43 /* ill-formed numeric expression */
#define ERR_SYS 44 /* %s */
#define ERR_UCD 45 /* unable to close and delete output file */
#define ERR_UCI 46 /* unable to close input file */
#define ERR_UCO 47 /* unable to close output file */
#define ERR_UFI 48 /* unable to open file "x" for input */
#define ERR_UFO 49 /* unable to open file "x" for output */
#define ERR_URC 50 /* unable to read character from terminal */
#define ERR_URE 51 /* unable to read TECO command file */
#define ERR_URL 52 /* unable to read line from input file */
#define ERR_UWL 53 /* unable to write line to output file */
/*
Standard TECO errors that possibly should be generated by TECOC-C:
?CON Confused use of conditionals
?FER File error
?INP Input error
?OUT Output error
Standard TECO errors not used by TECO-C are:
?CCL CCL.SV not found or EG argument too long
?CPQ Can't pop into Q-register (TECO-C uses PES)
?DEV Invalid device
?ERR RSTS/E error message (RSTS/E only)
?FUL Output Command would have overflowed output device
?IFN Illegal character "x" in filename
?MLA Missing Left Angle Bracket
?MLP Missing (
?MRA Missing Right Angle Bracket
?MRP Missing )
?MSC Missing Start of Conditional
?NPA Negative or 0 argument to P (TECO-C uses IPA)
?NRO No room for output
?UTM Unterminated macro
?WLO System Device Write-Locked
?nnn I/O Error or Directive Error (RSX-11 only)
%Superseding existing filed (TECO-11 only)
%Search fail in iter (TECO-11 only)
*/

89
src/defext.h 100644
View File

@ -0,0 +1,89 @@
/*****************************************************************************
DefExt.h
This header file declares as EXTERN all the variables declared as
GLOBAL in Tecoc.c for use by everyone else.
*****************************************************************************/
EXTERN charptr AraBeg; /* beginning of text m,n area */
EXTERN charptr AraEnd; /* end of text m,n area */
EXTERN charptr ArgPtr; /* beginning of text argument */
EXTERN charptr CBfBeg; /* command buffer beginning */
EXTERN charptr CBfEnd; /* command buffer end */
EXTERN charptr CBfPtr; /* pointer into command string */
EXTERN char CmdMod; /* command modifiers flags for @, ;, etc. */
EXTERN DEFAULT CrType; /* value of 0:W (terminal type) */
EXTERN charptr CStBeg; /* command string beginning */
EXTERN charptr CStEnd; /* pointer to last char of command string */
EXTERN DEFAULT CurInp; /* index of current input stream in IFiles */
EXTERN DEFAULT CurOut; /* index of current output stream in OFiles */
EXTERN charptr DBfBeg; /* digit buffer beginning */
EXTERN charptr DBfPtr; /* digit buffer pointer */
#if DEBUGGING
EXTERN char DbgSBf[]; /* debug message sprintf() buffer */
#endif
EXTERN charptr EBfBeg; /* edit buffer beginning */
EXTERN charptr EBfEnd; /* edit buffer end */
EXTERN charptr EBPtr1; /* pointer to start of found string */
EXTERN charptr EBPtr2; /* pointer to end of found string */
EXTERN WORD EdFlag; /* ED mode control flag */
EXTERN WORD EhFlag; /* EH mode control flag */
EXTERN charptr EndSAr; /* end of search area */
EXTERN char ErrTxt[]; /* holds part of error message */
EXTERN WORD EsFlag; /* ES mode control flag */
EXTERN WORD EStBot; /* expression stack bottom */
EXTERN struct EStck EStack[]; /* expression stack */
EXTERN WORD EStTop; /* expression stack top */
EXTERN WORD EtFlag; /* ET mode control flag */
EXTERN WORD EuFlag; /* EU mode control flag */
EXTERN WORD EvFlag; /* EV mode control flag */
EXTERN WORD EzFlag; /* EZ mode control flag */
EXTERN charptr FBfBeg; /* beginning of filename buffer */
EXTERN charptr FBfEnd; /* end of filename buffer */
EXTERN charptr FBfPtr; /* pointer into filename buffer */
EXTERN LONG FFPage; /* form feed flag (returned by ^E command) */
EXTERN charptr GapBeg; /* edit buffer gap beginning */
EXTERN charptr GapEnd; /* end of edit buffer gap */
EXTERNV BOOLEAN GotCtC; /* TRUE if the user just hit a control-C */
EXTERN charptr IBfEnd; /* end of input buffer */
EXTERN charptr IBfEnd; /* input buffer end */
EXTERN int IniSrM; /* initial search mode */
EXTERN BOOLEAN IsEofI[]; /* input file has reached end of file */
EXTERN BOOLEAN IsOpnI[]; /* input file is opened indicators */
EXTERN BOOLEAN IsOpnO[]; /* output file is opened indicators */
EXTERN WORD LStBot; /* loop stack bottom */
EXTERN struct LStck LStack[]; /* loop stack */
EXTERN struct LStck LStack[]; /* loop stack */
EXTERN WORD LstErr; /* number of last error message */
EXTERN WORD LStTop; /* loop stack top */
EXTERN LONG MArgmt; /* m part of m,n numeric argument pair */
EXTERN BOOLEAN Matchd; /* indicates successful search */
EXTERN struct MStck MStack[]; /* macro stack */
EXTERN WORD MStTop; /* macro stack top */
EXTERN LONG NArgmt; /* numeric argument */
EXTERN QRptr QR; /* pointer to q-register structure */
EXTERN struct QReg QRgstr[]; /* global q-registers */
EXTERN struct QReg QStack[]; /* q-register stack */
EXTERN WORD QStTop; /* top of q-register stack */
EXTERN DEFAULT Radix; /* TECO-C's current radix, 2-36 */
EXTERN LONG RefLen; /* value returned by ^S command */
EXTERN charptr RhtSid; /* right-hand side of area to be searched */
EXTERN charptr SBfBeg; /* search string buffer beginning */
EXTERN charptr SBfEnd; /* search string buffer end */
EXTERN charptr SBfPtr; /* end of search string, plus one */
EXTERN LONG SIncrm; /* search increment, 1 (forward), -1 (back) */
EXTERN WORD SMFlag; /* search mode flag */
EXTERN WORD SrcTyp; /* type of search (E_SEARCH, N_SEARCH, etc) */
EXTERN charptr SStPtr; /* pointer into search string */
EXTERN BOOLEAN TraceM; /* trace mode flag */
#if VIDEO
EXTERN DEFAULT HldFlg; /* value of 5:W (hold mode flag) */
EXTERN DEFAULT HtSize; /* value of 1:W (screen width) */
EXTERN DEFAULT MrkFlg; /* value of 4:W */
EXTERN DEFAULT ScroLn; /* value of 7:W */
EXTERN DEFAULT SeeAll; /* value of 3:W */
EXTERN DEFAULT TopDot; /* value of 6:W */
EXTERN DEFAULT VtSize; /* value of 2:W (screen height) */
#if CURSES
EXTERN DEFAULT SpcMrk; /* value of 8:W */
EXTERN DEFAULT KeyPad; /* value of 9:W */
#endif
#endif

54
src/docjr.c 100644
View File

@ -0,0 +1,54 @@
/*****************************************************************************
DoCJR()
This function contains the code that's common to the C, J and R
commands. It is called by ExeC, ExeJ and ExeR only.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "deferr.h" /* define identifiers for error messages */
DEFAULT DoCJR(HowFar) /* do C, J or R stuff */
LONG HowFar; /* positive or negative displacement */
{
LONG InRange;
BOOLEAN ColonMod;
#if DEBUGGING
static char *DbgFNm = "DoCJR";
sprintf(DbgSBf,"HowFar = %ld", HowFar);
DbgFEn(2,DbgFNm,DbgSBf);
#endif
ColonMod = (CmdMod & COLON); /* is it :C, :J, or :R? */
CmdMod &= ~COLON; /* clear : flag */
InRange = -1; /* -1 means SUCCESS in TECO */
if (HowFar > 0) {
if ((GapEnd+HowFar) > EBfEnd) {
InRange = 0; /* 0 means FAILURE in TECO */
} else {
MEMMOVE(GapBeg, GapEnd+1, HowFar);
GapBeg += HowFar;
GapEnd += HowFar;
}
} else {
if ((GapBeg+HowFar) < EBfBeg) {
InRange = 0; /* 0 means FAILURE in TECO */
} else {
GapBeg += HowFar;
GapEnd += HowFar;
MEMMOVE(GapEnd+1, GapBeg, -(HowFar));
}
}
if (ColonMod) { /* if colon modifier */
DBGFEX(2,DbgFNm,"PushEx");
return PushEx(InRange, OPERAND);
} else {
if (InRange == 0) { /* if out-of-bounds */
ErrChr(ERR_POP, *CBfPtr);
DBGFEX(2,DbgFNm,"FAILURE");
return FAILURE;
}
}
CmdMod = '\0'; /* clear modifiers flags */
EStTop = EStBot; /* clear expression stack */
DBGFEX(2,DbgFNm,"SUCCESS");
return SUCCESS;
}

88
src/doeves.c 100644
View File

@ -0,0 +1,88 @@
/*****************************************************************************
DoEvEs()
This function "does" what's specified by the EV (edit verify) or
ES (search verify) flag. The ES and EV flags are mode control flags that
allow the user to cause TECO to display a part of the edit buffer after
executing a command string (edit verify) or after a search (search verify).
Both the ES and EV flags are 0 by default, which means don't do anything.
This function is only called when the ES or EV flag is non-zero.
The flag is passed to this function for decoding. This function
examines the flag and acts accordingly. Both the ES and EV flags have the
following meaning:
-1 do a 1V command to display the current line
0 do nothing (this function is not even called)
1-31 type out current line with line-feed at CP
32-255 type out current line with ASCII character (32-255) at CP
else bottom byte as above, top byte is argument to V command
*****************************************************************************/
#if CURSES /* need to define standout and standend? */
#if ULTRIX
#include <cursesX.h> /* note: this has to come before zport.h */
#else
#include <curses.h> /* note: this has to come before zport.h */
#endif
#endif
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "dchars.h" /* define identifiers for characters */
VVOID DoEvEs(Flag) /* EV or ES flag code */
WORD Flag;
{
unsigned char PtChar; /* special "CP" character */
unsigned char VLines; /* argument to V command */
if (Flag == 0) {
return;
}
if (Flag == -1) { /* -1 means do a 1V command */
VLines = 1; /* view 1 line */
PtChar = '\0';
} else {
PtChar = (unsigned char)Flag;
VLines = (unsigned char)(Flag >> 8);
if (VLines == 0) { /* be sure it's at least 1 */
VLines = 1;
}
}
TypBuf(GapBeg+Ln2Chr((LONG)1 - (LONG)VLines), GapBeg);
#if CURSES
if (GapEnd+1 < EBfEnd) {
unsigned char c = *(GapEnd + 1);
standout();
if (c=='\b') {
ZDspBf("^H", 2);
} else if (c=='\r') {
ZDspBf("^M", 2);
} else if (c=='\n') {
ZDspBf("^J", 2);
} else if (c & 0200) {
int i;
char a,b;
c = c & 0177;
i = c/16;
if (i==0)
a='8';
else if (i==1)
a=9;
else
a = i - 2 + 'A';
i = (c % 16);
b = (i > 9) ? i - 10 + 'A' : i + '0';
ZDspCh('[');
ZDspCh(a);
ZDspCh(b);
ZDspCh(']');
} else
ZDspCh(c);
standend();
TypBuf(GapEnd+2, GapEnd + Ln2Chr((LONG)VLines)+1);
}
#else
if ((PtChar >= '\001') && (PtChar <= '\037')) {
ZDspCh(LINEFD);
} else if (PtChar != 0) {
ZDspCh(PtChar);
}
TypBuf(GapEnd+1, GapEnd+Ln2Chr((LONG)VLines)+1);
#endif
}

38
src/doflag.c 100644
View File

@ -0,0 +1,38 @@
/*****************************************************************************
DoFlag()
This function gets or sets the value of a TECO mode control flag.
The TECO mode control flags are ED, EH, ES, ET, EU, EV, EZ and ^X.
The EO flag can only be examined, not set, so ExeEO does not call this
function.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT DoFlag(Flag) /* handle a mode control flag */
WORD *Flag;
{
DBGFEN(2,"DoFlag",NULL);
if ((EStTop == EStBot) || /* if no numeric arg or */
(EStack[EStTop].ElType != OPERAND)) { /* partial expression */
DBGFEX(2,DbgFNm,"PushEx");
return PushEx((LONG)*Flag, OPERAND); /* return the flag */
}
if (GetNmA() == FAILURE) { /* get the numeric argument */
DBGFEX(2,DbgFNm,"FAILURE, GetNmA() failed");
return FAILURE;
}
if ((CmdMod & MARGIS) == '\0') { /* if it's n<flag> */
*Flag = (WORD)NArgmt; /* set the flag to n */
} else if (MArgmt && NArgmt) { /* else if it's m,n<flag> */
*Flag &= (WORD)~MArgmt; /* turn off m bits */
*Flag |= (WORD)NArgmt; /* turn on n bits */
} else if ((MArgmt == 0) && NArgmt) { /* else if it's 0,n<flag> */
*Flag |= (WORD)NArgmt; /* turn on n bits */
} else if ((MArgmt) && (NArgmt == 0)) { /* else if it's m,0<flag> */
*Flag &= (WORD)~MArgmt; /* turn off m bits */
}
EStTop = EStBot; /* clear expression stack */
CmdMod = '\0'; /* clear modifiers flags */
DBGFEX(2,DbgFNm,"SUCCESS");
return SUCCESS;
}

24
src/dscren.h 100644
View File

@ -0,0 +1,24 @@
/*****************************************************************************
DScren.h
Terminal types (0:W command, CrType variable). The strange
numbering is what is used in TECO-11.
*****************************************************************************/
#define UNTERM -1 /* unknown */
#define VT52 0 /* VT52 */
#define VT61 1 /* VT61 */
#define VT100V 2 /* VT100 in VT52 mode */
#define VT100 4 /* VT100 in ANSI mode */
#define VT05 6 /* VT05 */
#define VT102 8 /* VT102 */
#define VK100 10 /* VK100 */
#define VT200 11 /* VT200 in VT200 mode */
#define VT200A 12 /* VT200 in ANSI (VT100) mode */
#define VT200V 13 /* VT200 in VT52 mode */
#define IBMPC 14 /* IBM PC console */
/*****************************************************************************
Screen function codes. These are used in calls to ZScrOp.
*****************************************************************************/
#define SCR_CUP 1 /* move cursor up 1 row */
#define SCR_EEL 2 /* erase to end of line */
#define SCR_RON 3 /* reverse-video on */
#define SCR_ROF 4 /* reverse-video off */

51
src/echoit.c 100644
View File

@ -0,0 +1,51 @@
/*****************************************************************************
EchoIt()
This function displays a character in it's printable form, either
as CH, ^CH, or [CH].
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global identifiers */
#include "dchars.h" /* define identifiers for characters */
VVOID EchoIt(Charac)
unsigned char Charac;
{
if (Charac > USCHAR && Charac < DELETE) { /* displayable? */
ZDspCh(Charac);
} else if (Charac & '\200') { /* eighth bit set? */
if (EtFlag & ET_EIGHTBIT) { /* term can display */
ZDspCh(Charac);
} else {
ZDspCh('['); /* display as [ch] */
MakDBf((LONG)Charac,16);
*DBfPtr++ = ']';
ZDspBf(DBfBeg, DBfPtr-DBfBeg);
}
} else {
switch (Charac) {
case BAKSPC:
case TABCHR:
case LINEFD:
case CRETRN:
ZDspCh(Charac);
break;
case ESCAPE:
ZDspCh('$');
break;
case FORMFD:
ZDspCh('\r');
/* fall through to VRTTAB */
case VRTTAB:
ZDspBf("\n\n\n\n", 4);
break;
case DELETE:
break;
case CTRL_G:
ZDspCh(CTRL_G);
/* fall through to default case */
default: /* display as ^ch */
ZDspCh('^');
ZDspCh(Charac | '\100');
}
}
}

273
src/err.c 100644
View File

@ -0,0 +1,273 @@
/*****************************************************************************
ErrChr(), ErrMsg(), ErrStr(), ErrUTC(), ErrVrb()
These functions display TECO's error messages.
ErrChr display a message that contains a special character
ErrMsg display a message given the message number
ErrStr display a message that contains a special string
ErrUTC display UTC or UTM based on macro stack depth
ErrVrb display the verbose form of an error message
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "deferr.h" /* define error message codes */
#include "dchars.h" /* define identifiers for characters */
#include <string.h> /* prototype for strlen() */
#if USE_PROTOTYPES
static VVOID ErrDsp(WORD ErrNum, unsigned char *ELine);
static VVOID ToErr(unsigned char Charac, charptr *PtrPtr);
#endif
/****
IMPORTANT: if you change this list, you must also change DEFERR.H,
TECOC.RNH and VRBMSG.H !!!
****/
static char *Errors[] = {
/* 0*/ "ARG Improper arguments",
/* 1*/ "BNI > not in iteration",
/* 2*/ "DTB Delete too big",
/* 3*/ "FNF File not found \"%s\"",
/* 4*/ "ICE Illegal ^E command in search argument",
/* 5*/ "IEC Illegal character \"%s\" after E",
/* 6*/ "IFC Illegal character \"%s\" after F",
/* 7*/ "IIA Illegal insert argument",
/* 8*/ "ILL Illegal command \"%s\"",
/* 9*/ "ILN Illegal number",
/* 10*/ "IPA Negative or 0 argument to P",
/* 11*/ "IQC Illegal \" character",
/* 12*/ "IQN Illegal Q-register name \"%s\"",
/* 13*/ "IRA Illegal radix argument to ^R",
/* 14*/ "ISA Illegal search argument",
/* 15*/ "ISS Illegal search string",
/* 16*/ "IUC Illegal character \"%s\" following ^",
/* 17*/ "MAP Missing '",
/* 18*/ "MEM Memory overflow",
/* 19*/ "NAB No argument before ^_ ",
/* 20*/ "NAC No argument before ,",
/* 21*/ "NAE No argument before =",
/* 22*/ "NAP No argument before )",
/* 23*/ "NAQ No argument before \"",
/* 24*/ "NAS No argument before ;",
/* 25*/ "NAU No argument before U",
/* 26*/ "NCA Negative argument to ,",
/* 27*/ "NFI No file for input",
/* 28*/ "NFO No file for output",
/* 29*/ "NYA Numeric argument with Y",
/* 30*/ "NYI Not yet implemented",
/* 31*/ "OFO Output file already open",
/* 32*/ "PDO Push-down list overflow",
/* 33*/ "PES Attempt to pop an empty stack",
/* 34*/ "POP Attempt to move pointer off page with \"%s\"",
/* 35*/ "SNI ; not in iteration",
/* 36*/ "SRH Search failure \"%s\"",
/* 37*/ "STL String too long",
/* 38*/ "TAG Missing tag !%s!",
/* 39*/ "UTC Unterminated command",
/* 40*/ "UTM Unterminated macro",
/* 41*/ "XAB Execution aborted",
/* 42*/ "YCA Y command aborted",
/* 43*/ "IFE ill-formed numeric expression",
/* 44*/ "SYS %s",
/* 45*/ "UCD unable to close and delete output file %s",
/* 46*/ "UCI unable to close input file",
/* 47*/ "UCO unable to close output file",
/* 48*/ "UFI unable to open file %s for input",
/* 49*/ "UFO unable to open file %s for output",
/* 50*/ "URC unable to read character from terminal",
/* 51*/ "URE unable to read TECO command file",
/* 52*/ "URL unable to read line from input file",
/* 53*/ "UWL unable to write line to output file"
};
/*****************************************************************************
ErrUTC()
Simply call ErrMsg with either ERR_UTC (unterminated command) or
ERR_UTM (unterminated macro) depending on whether we're in a macro or not.
*****************************************************************************/
VVOID ErrUTC()
{
ErrMsg((MStTop < 0) ? ERR_UTC : ERR_UTM);
}
/*****************************************************************************
ErrVrb()
This function displays the verbose form of an error message.
The verbose form is a short paragraph explaining the error condition in
some detail. This function is called from ErrDsp when the least significant
two bits of the EH flag are set to 3, or from FrstCh when the user types
a / immediately after receiving a short error message.
Verbose explanations of error messages are stored in the HELP system
so that they can be accessed using the HELP command. Therefore this function
calls ZHelp to display the verbose messages.
*****************************************************************************/
VVOID ErrVrb(ErrNum) /* display verbose error message */
WORD ErrNum; /* error message number */
{
DBGFEN(3,"ErrVrb",NULL);
ZVrbos(ErrNum, Errors[ErrNum]);
DBGFEX(3,DbgFNm,NULL);
}
/*****************************************************************************
ErrDsp()
This function displays a TECO error message on the terminal screen.
This function is passed the number of the error message and the text of the
error message.
The EH flag controls how verbose the error message will be. The two
least significant bits of the EH flag control how verbose the error message
is. The third bit (mask is EH_COMMAND) causes the erroneous command string up
to and including the erroneous command to be displayed.
The low two bits of EH have the following meanings:
0 same as 2
1 only the three letter code is output
2 three letter code and one-line error message
3 three letter code, one-lien message and paragraph
*****************************************************************************/
static VVOID ErrDsp(ErrNum, ELine)
WORD ErrNum; /* the error number */
unsigned char *ELine; /* error message text */
{
WORD HlpLvl;
ptrdiff_t lenn;
HlpLvl = (EhFlag & 3) ? (EhFlag & 3) : 2;
lenn = (HlpLvl < 2) ? 4 : strlen(ELine);
ZDspBf(ELine, lenn);
if (HlpLvl == 3) { /* if paragraph */
ErrVrb(ErrNum); /* display paragraph */
}
ZDspBf("\r\n", 2);
if (EhFlag & EH_COMMAND) { /* if error string display is on */
TypESt();
}
LstErr = ErrNum;
}
/*****************************************************************************
ToErr()
Given a character and a buffer pointer, this function puts the
displayable representation for the character into the buffer and updates
the buffer position. For most characters, the displayable representation
is the character itself.
*****************************************************************************/
static VVOID ToErr(Charac, PtrPtr)
unsigned char Charac;
charptr *PtrPtr;
{
char SBuf[5];
char *SPtr;
size_t SLen;
switch (Charac) {
case TABCHR: SPtr = "<TAB>"; SLen = 5; break;
case LINEFD: SPtr = "<LF>"; SLen = 4; break;
case VRTTAB: SPtr = "<VT>"; SLen = 4; break;
case FORMFD: SPtr = "<FF>"; SLen = 4; break;
case CRETRN: SPtr = "<CR>"; SLen = 4; break;
case ESCAPE: SPtr = "<ESC>"; SLen = 5; break;
case '\0': SPtr = "<NUL>"; SLen = 5; break;
default: if (Charac >= DELETE) {
SPtr = SBuf;
MakDBf((LONG)Charac, 16);
SLen = (size_t) (DBfPtr - DBfBeg);
SBuf[0] = '[';
MEMMOVE(&SBuf[1], DBfBeg, SLen);
SBuf[++SLen] = ']';
++SLen;
} else if (Charac < SPACE) {
SPtr = SBuf;
MEMMOVE(SBuf, "<^x>", 4);
SBuf[2] = Charac + '@';
SLen = 4;
} else {
SPtr = (char *)&Charac;
SLen = 1;
}
break;
}
MEMMOVE(*PtrPtr, SPtr, SLen);
*PtrPtr += SLen;
}
/*****************************************************************************
*****************************************************************************/
VVOID ErrChr(ErrNum, EChr) /* display error message with character arg */
WORD ErrNum; /* the error number */
unsigned char EChr; /* character to imbed in message */
{
char *TmpPtr;
unsigned char ErrBuf[ERBFSIZ];
charptr EPtr = ErrBuf;
*EPtr++ = '?';
TmpPtr = Errors[ErrNum];
while (*TmpPtr != '%') { /* copy up to "%" */
*EPtr++ = *TmpPtr++;
}
ToErr(EChr, &EPtr); /* copy the %c character */
TmpPtr++; /* skip % */
TmpPtr++; /* skip c */
while (*TmpPtr) { /* copy rest of string */
*EPtr++ = *TmpPtr++;
}
*EPtr = '\0';
ErrDsp(ErrNum, ErrBuf);
}
/*****************************************************************************
*****************************************************************************/
VVOID ErrMsg(ErrNum) /* display error message */
WORD ErrNum; /* the error number */
{
char *TmpPtr;
unsigned char ErrBuf[ERBFSIZ];
charptr EPtr = ErrBuf;
*EPtr++ = '?';
TmpPtr = Errors[ErrNum];
while (*TmpPtr) { /* copy rest of string */
*EPtr++ = *TmpPtr++;
}
*EPtr = '\0';
ErrDsp(ErrNum, ErrBuf);
}
/*****************************************************************************
*****************************************************************************/
VVOID ErrStr(ErrNum, EStr) /* display error message with string arg */
WORD ErrNum; /* the error number */
char *EStr; /* string to imbed in message */
{
char *TmpPtr;
unsigned char ErrBuf[ERBFSIZ];
charptr EPtr = ErrBuf;
*EPtr++ = '?';
TmpPtr = Errors[ErrNum];
while (*TmpPtr != '%') { /* copy up to "%" */
*EPtr++ = *TmpPtr++;
}
while (*EStr) { /* copy %s string */
ToErr((unsigned char)*EStr++, &EPtr);
}
TmpPtr++; /* skip % */
TmpPtr++; /* skip s */
while (*TmpPtr) { /* copy rest of string */
*EPtr++ = *TmpPtr++;
}
*EPtr = '\0';
ErrDsp(ErrNum, ErrBuf);
}
/*****************************************************************************
*****************************************************************************/
VVOID ErrPSt(ErrNum, EBeg, EEnd) /* display error message with string arg */
WORD ErrNum; /* the error number */
charptr EBeg; /* string to imbed in message */
charptr EEnd; /* ptr to char after last char */
{
char *TmpPtr;
unsigned char ErrBuf[ERBFSIZ];
charptr EPtr = ErrBuf;
*EPtr++ = '?';
TmpPtr = Errors[ErrNum];
while (*TmpPtr != '%') { /* copy up to "%" */
*EPtr++ = *TmpPtr++;
}
while (EBeg < EEnd) { /* copy %s string */
ToErr(*EBeg++, &EPtr);
}
TmpPtr++; /* skip % */
TmpPtr++; /* skip s */
while (*TmpPtr) { /* copy rest of string */
*EPtr++ = *TmpPtr++;
}
*EPtr = '\0';
ErrDsp(ErrNum, ErrBuf);
}

113
src/exea.c 100644
View File

@ -0,0 +1,113 @@
/*****************************************************************************
ExeA()
This function executes an A command.
A Appends the next page of the input file to the contents
of the text buffer, thus combining the two pages of
text on a single page with no intervening form feed
character. This command takes no argument. To perform
n Appends, use the n<A> construct. Note that nA is a
completely different command.
:A Equivalent to the A command except that a value is
returned. -1 is returned if the append succeeded, and
0 is returned if the append failed because the
end-of-the-input-file had previously been reached (^N
flag is -1 at start of this command).
n:A Appends n lines of text from the input file to the
contents of the text buffer. The value of n must not
be negative. A value is returned indicating whether or
not there were in fact n lines remaining in the input
file. -1 is returned if the command succeeded. 0 is
returned if end-of-file on the input file was
encountered before all n lines were read in. Note that
the command can succeed and yet read in fewer than n
lines in the case that the text buffer fills up.
nA Equivalent to the ASCII code for the .+n+1th character
in the buffer (that is, the character to the right of
buffer pointer position .+n). The expression -1A is
equivalent to the ASCII code of the character
immediately preceding the pointer and 0A is equivalent
to the ASCII code of the character immediately
following the pointer (the current character). If the
character position referenced lies outside the bounds
of the text buffer, this command returns a -1.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "deferr.h" /* define identifiers for error messages */
DEFAULT ExeA() /* execute an A command */
{
BOOLEAN EBfFul;
unsigned char TmpChr;
BOOLEAN ColonMod;
DBGFEN(1,"ExeA",NULL);
ColonMod = (CmdMod & COLON); /* is it :A or n:A */
CmdMod &= ~COLON; /* clear : flag */
/*
* if we have a numeric argument, it's nA or n:A
*/
if (EStTop > EStBot) { /* if numeric argument */
UMinus(); /* if it's -A, make it -1A */
if (GetNmA() == FAILURE) { /* get numeric argument */
DBGFEX(1,DbgFNm,"FAILURE, GetNmA() failed");
return FAILURE;
}
if (ColonMod) { /* if it's n:A */
if (NArgmt < 1) {
ErrMsg(ERR_IPA);
DBGFEX(1,DbgFNm,"FAILURE, n:A, n < 1");
return FAILURE;
}
while (NArgmt-- > 0) {
EBfFul = FALSE;
if (RdLine(&EBfFul) == FAILURE) {
DBGFEX(1,DbgFNm,"FAILURE, RdLine() failed");
return FAILURE;
}
if (EBfFul) {
break;
}
if (IsEofI[CurInp]) { /* if end-of-file */
DBGFEX(1,DbgFNm,"PushEx(0)");
return PushEx(0L, OPERAND);
}
}
DBGFEX(1,DbgFNm,"PushEx(-1)");
return PushEx(-1L, OPERAND);
}
/*
* it's nA
*/
if (NArgmt < 0) {
if ((GapBeg+NArgmt) < EBfBeg) {
DBGFEX(1,DbgFNm,"PushEx(-1)");
return PushEx(-1L, OPERAND);
}
TmpChr = *(GapBeg+NArgmt);
} else {
if ((GapEnd+NArgmt+1) > EBfEnd) {
DBGFEX(1,DbgFNm,"PushEx(-1)");
return PushEx(-1L, OPERAND);
}
TmpChr = *(GapEnd+NArgmt+1);
}
#if DEBUGGING
sprintf(DbgSBf,"PushEx(%d)", TmpChr);
DbgFEx(1,DbgFNm,DbgSBf);
#endif
return PushEx((LONG)TmpChr, OPERAND);
}
/*
* if there is no numeric argument, must be A or :A
*/
if (IsEofI[CurInp]) { /* if already at end-of-file */
DBGFEX(1,DbgFNm,(ColonMod) ? "PushEx(0)" : "SUCCESS");
return ((ColonMod) ? PushEx(0L,OPERAND) : SUCCESS);
}
if (RdPage() == FAILURE) { /* read a page */
DBGFEX(1,DbgFNm,"FAILURE, RdPage() failed");
return FAILURE;
}
DBGFEX(1,DbgFNm,(ColonMod) ? "PushEx(-1)" : "SUCCESS");
return (ColonMod) ? PushEx(-1L, OPERAND) : SUCCESS;
}

17
src/exeats.c 100644
View File

@ -0,0 +1,17 @@
/*****************************************************************************
ExeAtS()
This function executes an @ (at-sign) command.
This function implements the at-sign modifier by setting a bit in
the CmdMod variable. Commands which are sensitive to at-sign modification
check CmdMod explicitly.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT ExeAtS() /* execute an @ (at sign) command */
{
DBGFEN(1,"ExeAtS",NULL);
CmdMod |= ATSIGN; /* set at sign */
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}

15
src/exeb.c 100644
View File

@ -0,0 +1,15 @@
/*****************************************************************************
ExeB()
This function executes a B command.
B Always equivalent to zero. Thus, B represents the
position preceding the first character in the buffer.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT ExeB() /* execute a B command */
{
DBGFEN(1,"ExeB",NULL);
DBGFEX(1,DbgFNm,"PushEx(0)");
return PushEx(0L, OPERAND);
}

21
src/exebar.c 100644
View File

@ -0,0 +1,21 @@
/*****************************************************************************
ExeBar()
This function executes a | (vertical bar) command.
| Start ELSE part of conditional
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "deferr.h" /* define identifiers for error messages */
DEFAULT ExeBar() /* execute | (vertical bar) command */
{
DBGFEN(1,"ExeBar",NULL);
if (FlowEC() == FAILURE) { /* flow to ' */
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
CmdMod = '\0'; /* clear modifiers flags */
EStTop = EStBot; /* clear expression stack */
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}

86
src/exebsl.c 100644
View File

@ -0,0 +1,86 @@
/*****************************************************************************
ExeBSl()
This function executes a \ (backslash) command.
\ Value of digit string in buffer
n\ Convert n to digits in buffer
The backslash command allows the user to convert binary numbers
to/from their ASCII representations. If a numeric argument precedes the
backslash command, then the ASCII representation for the number is inserted
into the edit buffer at the current point. If there is no preceding numeric
argument, then the number in it's ASCII representation in the edit buffer is
converted to binary, and is returned by the backslash command. In either
case, TECO's current radix controls how the numbers are represented. If
the current radix is decimal, then a plus or minus sign can precede an
ASCII number being read, and a minus sign will be generated if necessary
for a number being generated. When converting a string that's in the edit
buffer, the character pointer is left at the end of the string in the buffer.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "chmacs.h" /* define character processing macros */
DEFAULT ExeBSl() /* execute a \ (backslash) command */
{
DBGFEN(1,"ExeBSl",NULL);
/*
* Handle the case where there's no numeric argument: convert the digit
* string in the edit buffer into a binary value and push it onto the
* expression stack.
*/
if ((EStTop == EStBot) || /* if no numeric arg or */
(EStack[EStTop].ElType != OPERAND)) { /* partial expression */
LONG StrVal = 0;
RefLen=0;
if (GapEnd != EBfEnd) { /* if not at end of buffer */
BOOLEAN negative = FALSE;
char NxtChr;
if (*(GapEnd+1) == '-') { /* minus sign? */
RefLen--;
GapEnd++; /* move forward... */
*GapBeg++ = *GapEnd; /* ... one character */
negative = TRUE;
} else if (*(GapEnd+1) == '+') { /* plus sign? */
RefLen--;
GapEnd++; /* move forward... */
*GapBeg++ = *GapEnd; /* ... one character */
}
while ((GapEnd != EBfEnd) && (IsRadx(*(GapEnd+1)))) {
RefLen--;
GapEnd++; /* move forward... */
*GapBeg++ = *GapEnd; /* ... one character */
NxtChr = *GapEnd;
if (Is_Digit(NxtChr))
NxtChr -= '0';
else if (Is_Upper(NxtChr))
NxtChr -= '\67';
else
NxtChr -= '\127';
StrVal = (StrVal * Radix) + NxtChr;
}
if (negative)
StrVal = -StrVal;
}
CmdMod = '\0'; /* clear modifiers flags */
#if DEBUGGING
sprintf(DbgSBf,"PushEx(%ld)", StrVal);
DbgFEx(1,DbgFNm,DbgSBf);
#endif
return PushEx(StrVal,OPERAND);
}
/*
* If we made it to here, then there is a numeric argument
*/
if (GetNmA() == FAILURE) { /* get numeric argument */
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
MakDBf(NArgmt, Radix); /* convert it to ASCII */
if (InsStr(DBfBeg, DBfPtr-DBfBeg) == FAILURE) {
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
CmdMod = '\0'; /* clear modifiers flags */
EStTop = EStBot; /* clear expression stack */
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}

23
src/exec.c 100644
View File

@ -0,0 +1,23 @@
/*****************************************************************************
ExeC()
This function executes a C command.
nC Advance n characters
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT ExeC() /* execute a C command */
{
DBGFEN(1,"ExeC",NULL);
if (EStTop == EStBot) { /* if no numeric argument */
NArgmt = 1; /* default is 1C */
} else {
UMinus(); /* if it's -C, make it -1C */
if (GetNmA() == FAILURE) {
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
}
DBGFEX(1,DbgFNm,"DoCJR");
return DoCJR(NArgmt);
}

19
src/execcc.c 100644
View File

@ -0,0 +1,19 @@
/*****************************************************************************
ExeCCC()
This function executes a ^^ (control-caret or caret-caret) command.
^^x Equivilent to the ASCII value of x
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "deferr.h" /* define identifiers for error messages */
DEFAULT ExeCCC() /* execute a control-^ command */
{
DBGFEN(1,"ExeCCC",NULL);
if (IncCBP() == FAILURE) {
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
DBGFEX(1,DbgFNm,"PushEx()");
return PushEx((LONG)*CBfPtr, OPERAND);
}

22
src/execln.c 100644
View File

@ -0,0 +1,22 @@
/*****************************************************************************
ExeCln()
This function handles the colon and double-colon modifiers.
This function implements the modifiers by setting bits in the
CmdMod variable. Commands which are sensitive to colon or double colon
modification check CmdMod explicitly.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT ExeCln() /* execute : or :: modifiers */
{
DBGFEN(1,"ExeCln",NULL);
if (CmdMod & COLON) { /* if colon bit is set */
CmdMod &= ~COLON; /* clear colon bit */
CmdMod |= DCOLON; /* set double-colon bit */
} else {
CmdMod |= COLON; /* set colon bit */
}
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}

25
src/execom.c 100644
View File

@ -0,0 +1,25 @@
/*****************************************************************************
ExeCom()
This function executes a , (comma argument separator) command.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "deferr.h" /* define identifiers for error messages */
DEFAULT ExeCom() /* execute a , (comma) command */
{
DBGFEN(1,"ExeCom",NULL);
if (EStTop == EStBot) { /* if no numeric argument */
ErrMsg(ERR_NAC); /* no arg before , */
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
if (GetNmA() == FAILURE) {
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
MArgmt = NArgmt;
CmdMod |= MARGIS;
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}

38
src/execrt.c 100644
View File

@ -0,0 +1,38 @@
/*****************************************************************************
ExeCrt()
This function "executes" a ^ (caret) command. Most TECO commands
which are control characters (^A, ^B, etc) can also be entered as a caret
and letter combination. For example, control-A can also be entered as
caret-A.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "chmacs.h" /* define character processing macros */
#include "deferr.h" /* define identifiers for error messages */
DEFAULT ExeCrt() /* execute a ^ (caret) command */
{
unsigned char TmpChr;
static DEFAULT (*FCAray[])(VVOID) = {
/* ^A*/ ExeCtA, /* ^B*/ ZExCtB, /* ^C*/ ExeCtC,
/* ^D*/ ExeCtD, /* ^E*/ ExeCtE, /* ^F*/ ExeNYI,
/* ^G*/ ExeIll, /* ^H*/ ZExCtH, /*TAB*/ ExeCtI,
/* LF*/ ExeNul, /* VT*/ ExeIll, /* FF*/ ExeCtL,
/* CR*/ ExeNul, /* ^N*/ ExeCtN, /* ^O*/ ExeCtO,
/* ^P*/ ExeCtP, /* ^Q*/ ExeCtQ, /* ^R*/ ExeCtR,
/* ^S*/ ExeCtS, /* ^T*/ ExeCtT, /* ^U*/ ExeCtU,
/* ^V*/ ExeCtV, /* ^W*/ ExeCtW, /* ^X*/ ExeCtX,
/* ^Y*/ ExeCtY, /* ^Z*/ ExeCtZ, /* ^[*/ ExeEsc,
/* ^\*/ ExeIll, /* ^]*/ ExeIll, /* ^^*/ ExeCCC,
/* ^_*/ ExeUsc
};
if (IncCBP() == FAILURE) {
return FAILURE;
}
TmpChr = To_Upper(*CBfPtr);
if ((TmpChr < 'A') || (TmpChr > '_')) {
ErrChr(ERR_IUC, *CBfPtr);
return FAILURE;
}
return (*FCAray[TmpChr-'A'])();
}

113
src/execst.c 100644
View File

@ -0,0 +1,113 @@
/*****************************************************************************
ExeCSt()
This function executes a TECO command string. The string is pointed
to by CBfPtr. The last character in the string is pointed to by CStEnd.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "deferr.h" /* define identifiers for error messages */
DEFAULT ExeCSt() /* execute command string */
{
DEFAULT status;
static DEFAULT (*FArray[])(VVOID) = {
/*NUL*/ ExeNul, /* ^A*/ ExeCtA, /* ^B*/ ZExCtB, /* ^C*/ ExeCtC,
/* ^D*/ ExeCtD, /* ^E*/ ExeCtE, /* ^F*/ ExeNYI, /* ^G*/ ExeIll,
/* ^H*/ ZExCtH, /* ^I*/ ExeCtI, /* LF*/ ExeNul, /* VT*/ ExeIll,
/* ^L*/ ExeCtL, /* CR*/ ExeNul, /* ^N*/ ExeCtN, /* ^O*/ ExeCtO,
/* ^P*/ ExeCtP, /* ^Q*/ ExeCtQ, /* ^R*/ ExeCtR, /* ^S*/ ExeCtS,
/* ^T*/ ExeCtT, /* ^U*/ ExeCtU, /* ^V*/ ExeCtV, /* ^W*/ ExeCtW,
/* ^X*/ ExeCtX, /* ^Y*/ ExeCtY, /* ^Z*/ ExeCtZ, /*ESC*/ ExeEsc,
/* ^\*/ ExeIll, /* ^]*/ ExeIll, /* ^^*/ ExeCCC, /* ^_*/ ExeUsc,
/* SP*/ ExeNul, /* ! */ ExeExc, /* " */ ExeDQu, /* # */ ExeOpr,
/* $ */ ExeEsc, /* % */ ExePrc, /* & */ ExeOpr, /* ' */ ExeNul,
/* ( */ ExeOpr, /* ) */ ExeRtP, /* * */ ExeOpr, /* + */ ExeOpr,
/* , */ ExeCom, /* - */ ExeOpr, /* . */ ExeDot, /* / */ ExeOpr,
/* 0 */ ExeDgt, /* 1 */ ExeDgt, /* 2 */ ExeDgt, /* 3 */ ExeDgt,
/* 4 */ ExeDgt, /* 5 */ ExeDgt, /* 6 */ ExeDgt, /* 7 */ ExeDgt,
/* 8 */ ExeDgt, /* 9 */ ExeDgt, /* : */ ExeCln, /* ; */ ExeSCl,
/* < */ ExeLst, /* = */ ExeEqu, /* > */ ExeGtr, /* ? */ ExeQes,
/* @ */ ExeAtS, /* A */ ExeA, /* B */ ExeB, /* C */ ExeC,
/* D */ ExeD, /* E */ ExeE, /* F */ ExeF, /* G */ ExeG,
/* H */ ExeH, /* I */ ExeI, /* J */ ExeJ, /* K */ ExeK,
/* L */ ExeL, /* M */ ExeM, /* N */ ExeN, /* O */ ExeO,
/* P */ ExeP, /* Q */ ExeQ, /* R */ ExeR, /* S */ ExeS,
/* T */ ExeT, /* U */ ExeU, /* V */ ExeV, /* W */ ExeW,
/* X */ ExeX, /* Y */ ExeY, /* Z */ ExeZ, /* [ */ ExeLBr,
/* \ */ ExeBSl, /* ] */ ExeRBr, /* ^ */ ExeCrt, /* _ */ ExeUnd,
/* ` */ ExeIll, /* a */ ExeA, /* b */ ExeB, /* c */ ExeC,
/* d */ ExeD, /* e */ ExeE, /* f */ ExeF, /* g */ ExeG,
/* h */ ExeH, /* i */ ExeI, /* j */ ExeJ, /* k */ ExeK,
/* l */ ExeL, /* m */ ExeM, /* n */ ExeN, /* o */ ExeO,
/* p */ ExeP, /* q */ ExeQ, /* r */ ExeR, /* s */ ExeS,
/* t */ ExeT, /* u */ ExeU, /* v */ ExeV, /* w */ ExeW,
/* x */ ExeX, /* y */ ExeY, /* z */ ExeZ, /* { */ ExeIll,
/* | */ ExeBar, /* } */ ExeIll, /* ~ */ ExeIll, /*DEL*/ ExeIll,
/*129*/ ExeIll, /*130*/ ExeIll, /*131*/ ExeIll, /*132*/ ExeIll,
/*133*/ ExeIll, /*134*/ ExeIll, /*135*/ ExeIll, /*136*/ ExeIll,
/*137*/ ExeIll, /*138*/ ExeIll, /*139*/ ExeIll, /*140*/ ExeIll,
/*141*/ ExeIll, /*142*/ ExeIll, /*143*/ ExeIll, /*144*/ ExeIll,
/*145*/ ExeIll, /*146*/ ExeIll, /*147*/ ExeIll, /*148*/ ExeIll,
/*149*/ ExeIll, /*150*/ ExeIll, /*151*/ ExeIll, /*152*/ ExeIll,
/*153*/ ExeIll, /*154*/ ExeIll, /*155*/ ExeIll, /*156*/ ExeIll,
/*157*/ ExeIll, /*158*/ ExeIll, /*159*/ ExeIll, /*160*/ ExeIll,
/*161*/ ExeIll, /*162*/ ExeIll, /*163*/ ExeIll, /*164*/ ExeIll,
/*165*/ ExeIll, /*166*/ ExeIll, /*167*/ ExeIll, /*168*/ ExeIll,
/*169*/ ExeIll, /*170*/ ExeIll, /*171*/ ExeIll, /*172*/ ExeIll,
/*173*/ ExeIll, /*174*/ ExeIll, /*175*/ ExeIll, /*176*/ ExeIll,
/*177*/ ExeIll, /*178*/ ExeIll, /*179*/ ExeIll, /*180*/ ExeIll,
/*181*/ ExeIll, /*182*/ ExeIll, /*183*/ ExeIll, /*184*/ ExeIll,
/*185*/ ExeIll, /*186*/ ExeIll, /*187*/ ExeIll, /*188*/ ExeIll,
/*189*/ ExeIll, /*190*/ ExeIll, /*191*/ ExeIll, /*192*/ ExeIll,
/*193*/ ExeIll, /*194*/ ExeIll, /*195*/ ExeIll, /*196*/ ExeIll,
/*197*/ ExeIll, /*198*/ ExeIll, /*199*/ ExeIll, /*200*/ ExeIll,
/*201*/ ExeIll, /*202*/ ExeIll, /*203*/ ExeIll, /*204*/ ExeIll,
/*205*/ ExeIll, /*206*/ ExeIll, /*207*/ ExeIll, /*208*/ ExeIll,
/*209*/ ExeIll, /*210*/ ExeIll, /*211*/ ExeIll, /*212*/ ExeIll,
/*213*/ ExeIll, /*214*/ ExeIll, /*215*/ ExeIll, /*216*/ ExeIll,
/*217*/ ExeIll, /*218*/ ExeIll, /*219*/ ExeIll, /*220*/ ExeIll,
/*221*/ ExeIll, /*222*/ ExeIll, /*223*/ ExeIll, /*224*/ ExeIll,
/*225*/ ExeIll, /*226*/ ExeIll, /*227*/ ExeIll, /*228*/ ExeIll,
/*229*/ ExeIll, /*230*/ ExeIll, /*231*/ ExeIll, /*232*/ ExeIll,
/*233*/ ExeIll, /*234*/ ExeIll, /*235*/ ExeIll, /*236*/ ExeIll,
/*237*/ ExeIll, /*238*/ ExeIll, /*239*/ ExeIll, /*240*/ ExeIll,
/*241*/ ExeIll, /*242*/ ExeIll, /*243*/ ExeIll, /*244*/ ExeIll,
/*245*/ ExeIll, /*246*/ ExeIll, /*247*/ ExeIll, /*248*/ ExeIll,
/*249*/ ExeIll, /*250*/ ExeIll, /*251*/ ExeIll, /*252*/ ExeIll,
/*253*/ ExeIll, /*254*/ ExeIll, /*255*/ ExeIll, /*256*/ ExeIll
};
DBGFEN(4,"ExeCSt",NULL);
while (CBfPtr <= CStEnd) { /* while more commands */
if (TraceM) { /* if trace mode is on */
EchoIt(*CBfPtr); /* display the command */
}
status = (*FArray[*CBfPtr])(); /* execute command */
#if CONSISTENCY_CHECKING
check_consistency();
#endif
#if CHECKSUM_CODE
check_code_checksums ();
#endif
ZCHKKB(); /* kludge for MS-DOS only */
if (GotCtC) { /* if got a control-C */
GotCtC = FALSE;
ErrMsg(ERR_XAB); /* XAB = execution aborted */
DBGFEX(4,DbgFNm,"SUCCESS");
return SUCCESS;
}
if (status == FAILURE) { /* did command fail? */
if (EtFlag & ET_MUNG_MODE) { /* if in mung mode */
TAbort(EXIT_FAILURE); /* ... terminate */
} else {
DBGFEX(4,DbgFNm,"FAILURE");
return FAILURE;
}
}
CBfPtr++; /* move to next command */
}
if (LStTop != LStBot) { /* if unclosed loop */
ErrUTC(); /* unterminated command */
}
DBGFEX(4,DbgFNm,"SUCCESS");
return SUCCESS;
}

25
src/execta.c 100644
View File

@ -0,0 +1,25 @@
/*****************************************************************************
ExeCtA()
This function executes a ^A (control-A or caret-A) command.
^Atext^A Types "text" on the terminal. The closing
character must be a control-A.
@^A/text/ Equivilent to ^A except text can be bracketed
with any character, avoids need for second ^A.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "dchars.h" /* define identifiers for characters */
DEFAULT ExeCtA() /* execute a ^A (control-A) command */
{
DBGFEN(1,"ExeCtA",NULL);
if (FindES(CTRL_A) == FAILURE) { /* find end of string */
DBGFEX(1,DbgFNm,"FAILURE, FindES() failed");
return FAILURE;
}
TypBuf(ArgPtr, CBfPtr);
CmdMod = '\0'; /* clear modifiers flags */
EStTop = EStBot; /* clear expression stack */
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}

19
src/exectc.c 100644
View File

@ -0,0 +1,19 @@
/*****************************************************************************
ExeCtC()
This function executes a control-C command.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "dchars.h" /* define identifiers for characters */
DEFAULT ExeCtC() /* execute an control-C command */
{
DBGFEN(1,"ExeCtC",NULL);
if ((CBfPtr < CStEnd) && (*(CBfPtr+1) == CTRL_C)) { /* if it's ^C^C */
TAbort(EXIT_SUCCESS);
}
CmdMod = '\0'; /* clear modifiers flags */
EStTop = EStBot; /* clear expression stack */
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}

16
src/exectd.c 100644
View File

@ -0,0 +1,16 @@
/*****************************************************************************
ExeCtD()
This function executes a ^D (control-D or caret-D) command. This
command sets the radix to decimal.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT ExeCtD() /* execute a ^D (control-D) command */
{
DBGFEN(1,"ExeCtD",NULL);
Radix = 10;
CmdMod = '\0'; /* clear modifiers flags */
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}

30
src/execte.c 100644
View File

@ -0,0 +1,30 @@
/*****************************************************************************
ExeCtE()
This function executes a ^E (control-E or caret-E) command, which
returns the value of the form feed flag. The form feed flag is -1 if the
last read operation was terminated because a form feed was encountered. It
is 0 otherwise. If the ^E command is preceded by a numeric argument, then
the command sets the value of the form feed flag. The form feed flag is
used by the output code to indicate whether a form feed should be appended
when the edit buffer is written to the output file.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT ExeCtE() /* execute a ^E (control-E) command */
{
DBGFEN(1,"ExeCtE",NULL);
if (EStTop > EStBot) { /* if numeric argument */
if (GetNmA() == FAILURE) { /* get numeric arg */
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
FFPage = (NArgmt == -1) ? -1 : 0;
CmdMod = '\0'; /* clear modifiers flags */
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}
CmdMod = '\0'; /* clear modifiers flags */
DBGFEX(1,DbgFNm,"PushEx(FFPage)");
return PushEx(FFPage, OPERAND);
}

25
src/execti.c 100644
View File

@ -0,0 +1,25 @@
/*****************************************************************************
ExeCtI()
This function executes a ^I (control-I or caret-I) command. This
is equivilent to the I command, except the <TAB> is inserted as well.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "dchars.h" /* define identifiers for characters */
DEFAULT ExeCtI() /* execute control-I (tab) command */
{
DBGFEN(1,"ExeCtI",NULL);
if (FindES(ESCAPE) == FAILURE) { /* find end of text arg */
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
if (InsStr(ArgPtr-1, (CBfPtr-ArgPtr)+1) == FAILURE) {
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
CmdMod = '\0'; /* clear modifiers flags */
EStTop = EStBot; /* clear expression stack */
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}

13
src/exectl.c 100644
View File

@ -0,0 +1,13 @@
/*****************************************************************************
ExeCtL()
This function executes a ^L (control-L or caret-L) command.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "dchars.h" /* define identifiers for characters */
DEFAULT ExeCtL() /* execute an ^L (control-L) command */
{
ZDspCh(FORMFD);
return SUCCESS;
}

17
src/exectn.c 100644
View File

@ -0,0 +1,17 @@
/*****************************************************************************
ExeCtN()
This function executes a ^N (control-N or caret-N) command.
^N <CTRL/N> (caret/N) is the end of file flag. It is
equivalent to -1 if the file open on the currently
selected input stream is at end of file, and zero
otherwise.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT ExeCtN() /* execute a ^N (control-N) command */
{
DBGFEN(1,"ExeCtN",NULL);
DBGFEX(1,DbgFNm,"PushEx()");
return PushEx((IsEofI[CurInp] ? -1L : 0L), OPERAND);
}

16
src/execto.c 100644
View File

@ -0,0 +1,16 @@
/*****************************************************************************
ExeCtO()
This function executes a ^O (control-O or caret-O) command. This
command sets the radix to octal.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT ExeCtO() /* execute a ^O (control-O) command */
{
DBGFEN(1,"ExeCtO",NULL);
Radix = 8; /* set radix to octal */
CmdMod = '\0'; /* clear modifiers flags */
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}

23
src/exectp.c 100644
View File

@ -0,0 +1,23 @@
/*****************************************************************************
ExeCtP()
This function executes a ^P (control-P or caret-P) command. ^P
is not a TECO command and is used to set TECO-C debugging parameters. For
more information on the debugging routines, see the DEBUGGING lines in
Tecoc.c.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT ExeCtP() /* execute a ^P (control-P) command */
{
#if DEBUGGING
if (DbgDsp() == FAILURE) {
return FAILURE;
}
EStTop = EStBot; /* clear expression stack */
CmdMod = '\0'; /* clear modifiers flags */
return SUCCESS;
#else
return (ExeIll ()); /* Illegal command */
#endif
}

24
src/exectq.c 100644
View File

@ -0,0 +1,24 @@
/*****************************************************************************
ExeCtQ()
This function executes a ^Q (control-Q or caret-Q) command.
n^Q returns number of characters between the buffer pointer
and the nth line separator (n^QC == nL).
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT ExeCtQ() /* execute a ^Q (control-Q) command */
{
DBGFEN(1,"ExeCtQ",NULL);
CmdMod = '\0'; /* clear modifiers flags */
if (EStTop == EStBot) { /* if no numeric argument */
DBGFEX(1,DbgFNm,"PushEx(0)");
return PushEx(0L, OPERAND);
}
if (GetNmA() == FAILURE) { /* get numeric argument */
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
DBGFEX(1,DbgFNm,"PushEx()");
return PushEx(Ln2Chr(NArgmt), OPERAND);
}

33
src/exectr.c 100644
View File

@ -0,0 +1,33 @@
/*****************************************************************************
ExeCtR()
This function executes a ^R (control-R or caret-R) command. The
control-R command sets TECO's radix, which controls how ASCII strings are
converted to/from their binary representations. The current radix is used
by the backslash command and whenever TECO encounters a string of digits in
a command string.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "deferr.h" /* define identifiers for error messages */
DEFAULT ExeCtR() /* execute a ^R (control-R) command */
{
DBGFEN(1,"ExeCtR",NULL);
if ((EStTop == EStBot) || /* if no numeric arg or */
(EStack[EStTop].ElType != OPERAND)) { /* partial expression */
DBGFEX(1,DbgFNm,"PushEx");
return PushEx((LONG)Radix, OPERAND);
}
if (GetNmA() == FAILURE) {
DBGFEX(1,DbgFNm,"FAILURE, GetNmA() failed");
return FAILURE;
}
if ((NArgmt != 8) && (NArgmt != 10) && (NArgmt != 16)) {
ErrMsg(ERR_IRA); /* illegal radix with ^R */
DBGFEX(1,DbgFNm,"FAILURE, illegal radix");
return FAILURE;
}
Radix = (DEFAULT)NArgmt;
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}

15
src/exects.c 100644
View File

@ -0,0 +1,15 @@
/*****************************************************************************
ExeCtS()
This function executes a ^S (control-S or caret-S) command. This
is equivilent to the negative of the last referenced string (last insert,
string found, or string inserted with "G" command).
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT ExeCtS() /* execute a ^S (control-S) command */
{
DBGFEN(1,"ExeCtS",NULL);
DBGFEX(1,DbgFNm,"PushEx(RefLen)");
return PushEx(RefLen, OPERAND);
}

40
src/exectt.c 100644
View File

@ -0,0 +1,40 @@
/*****************************************************************************
ExeCtT()
This function executes a ^T (control-T or caret-T) command.
^T ASCII value of next char typed
n^T Types out character for ASCII code n.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "deferr.h" /* define identifiers for error messages */
DEFAULT ExeCtT() /* execute a ^T (control-T) command */
{
DEFAULT lchar;
DBGFEN(1,"ExeCtT",NULL);
if ((EStTop == EStBot) || /* if no numeric arg or */
(EStack[EStTop].ElType != OPERAND)) { /* partial expression */
lchar = ZChIn(EtFlag & ET_NO_WAIT); /* read a character */
if (GotCtC) { /* if got a control-C */
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
if (((EtFlag & ET_NO_ECHO) == 0) && (lchar != -1)) {
EchoIt((unsigned char)lchar);
}
DBGFEX(1,DbgFNm,"PushEx()");
return PushEx((LONG)lchar, OPERAND);
}
if (GetNmA() == FAILURE) { /* get numeric arg */
DBGFEX(1,DbgFNm,"FAILURE, GetNmA() failed");
return FAILURE;
}
if ((CmdMod & COLON) || (EtFlag & ET_IMAGE_MODE)) {
ZDspCh((char)NArgmt);
} else {
EchoIt((unsigned char)NArgmt);
}
CmdMod = '\0'; /* clear modifiers flags */
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}

136
src/exectu.c 100644
View File

@ -0,0 +1,136 @@
/*****************************************************************************
ExeCtU()
This function executes a ^U (control-U or caret-U) command.
^Uqstring`
This command inserts character string "string" into the text
storage area of Q-register q. When entering a command string
from the terminal, you must specify ^U using the caret/U
format, since the <CTRL/U> character is the line erase
immediate action command.
:^Uqstring`
This command appends character string "string" to the text
storage area of Q-register "q".
n^Uq' This form of the ^Uq` command inserts the single character
whose ASCII code is n into the text storage area of
Q-register "q". (n is taken modulo 256 in TECO-11, modulo
128 in other TECOs.)
n:^Uq` This form of the :^Uq` command appends the single character
whose ASCII code is n to the text storage area of Q-register
"q". (n is taken modulo 256 in TECO-11, modulo 128 in other
TECOs.) [not in TECO-8]
@^Uq/string/
@:^Uq/string/
n@^Uq//
n@:^Uq//
Equivalent, respectively, to the ^Uqstring`, :^Uqstring`,
n^Uq`, and n:^Uq` commands, except that alternate delimiters
are used and no <DELIM> characters are necessary.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "deferr.h" /* define identifiers for error messages */
#include "dchars.h" /* define identifiers for characters */
DEFAULT ExeCtU() /* execute a ^U (control-U) command */
{
ptrdiff_t TmpSiz;
DBGFEN(1,"ExeCtU",NULL);
/*
* increment CBfPtr past ^U
*/
if (IncCBP() == FAILURE) {
DBGFEX(1,DbgFNm,"FAILURE, IncCBP() failed");
return FAILURE;
}
/*
* try to find Q-register name after ^U
*/
if (FindQR() == FAILURE) {
DBGFEX(1,DbgFNm,"FAILURE, FindQR() failed");
return FAILURE;
}
/*
* If there is a colon modifier, we are appending to the Q-register text.
* If there isn't a colon modifier, we are replacing the text currently
* in the Q-register. If there is any text currently in the Q-register,
* we have to zap it first.
*/
if (!(CmdMod & COLON)) { /* if no colon modifier */
if (QR->Start != NULL) { /* if not empty */
ZFree((voidptr)QR->Start); /* free the memory */
QR->Start = QR->End_P1 = NULL;
}
}
/*
* If there is a numeric argument n, we are dealing with a character to
* place into or append to the Q-register.
*/
if (EStTop > EStBot) { /* if numeric argument */
if (GetNmA() == FAILURE) { /* get numeric argument */
DBGFEX(1,DbgFNm,"FAILURE, GetNmA() failed");
return FAILURE;
}
if (CmdMod & ATSIGN) { /* it's @^U// */
/*
* increment CBfPtr to 1st delimiter
*/
if (IncCBP() == FAILURE) {
DBGFEX(1,DbgFNm,"FAILURE, IncCBP() failed");
return FAILURE;
}
/*
* increment CBfPtr to 2nd delimiter
*/
if (IncCBP() == FAILURE) {
DBGFEX(1,DbgFNm,"FAILURE, IncCBP() failed");
return FAILURE;
}
/*
* the two delimiters should be the same
*/
if (*CBfPtr != *(CBfPtr-1)) {
ErrMsg(ERR_IIA);
DBGFEX(1,DbgFNm,"FAILURE, ERR_IIA");
return FAILURE;
}
}
/*
* Increase the size of the text area by 1 character
*/
if (MakRom((SIZE_T) 1) == FAILURE) {
DBGFEX(1,DbgFNm,"FAILURE, MakRom() failed");
return FAILURE;
}
/*
* Append the character to the Q-register
*/
*(QR->End_P1) = (char) NArgmt;
QR->End_P1++;
} else { /* else no numeric argument */
/*
* We must be dealing with a string, find the end of the string.
*/
if (FindES(ESCAPE) == FAILURE) {
DBGFEX(1,DbgFNm,"FAILURE, FindES() failed");
return FAILURE;
}
TmpSiz = CBfPtr - ArgPtr;
if (TmpSiz > 0) {
/*
* make room for the string
*/
if (MakRom((SIZE_T)TmpSiz) == FAILURE) {
DBGFEX(1,DbgFNm,"FAILURE, MakRom() failed");
return FAILURE;
}
/*
* Append the string to the Q-register text
*/
MEMMOVE(QR->End_P1, ArgPtr, (SIZE_T)TmpSiz);
QR->End_P1 += TmpSiz;
}
}
CmdMod = '\0'; /* clear modifiers flags */
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}

29
src/exectv.c 100644
View File

@ -0,0 +1,29 @@
/*****************************************************************************
ExeCtV()
This function executes a ^V (control-V or caret-V) command.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "deferr.h" /* define identifiers for error messages */
DEFAULT ExeCtV() /* execute a ^V (control-V) command */
{
DBGFEN(1,"ExeCtV",NULL);
if (EStTop == EStBot) { /* if no numeric argument */
IniSrM = LOWER;
} else {
if (GetNmA() == FAILURE) { /* get numeric argument */
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
if (NArgmt) { /* if it wasn't 0^V */
ErrMsg(ERR_ARG); /* improper arguments */
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
IniSrM = NONE;
}
CmdMod = '\0'; /* clear modifiers flags */
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}

29
src/exectw.c 100644
View File

@ -0,0 +1,29 @@
/*****************************************************************************
ExeCtW()
This function executes a control-W command.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
#include "deferr.h" /* define identifiers for error messages */
DEFAULT ExeCtW() /* execute a ^W (control-W) command */
{
DBGFEN(1,"ExeCtW",NULL);
if (EStTop == EStBot) { /* if no numeric argument */
IniSrM = UPPER;
} else {
if (GetNmA() == FAILURE) { /* get numeric argument */
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
if (NArgmt) { /* if it wasn't 0^W */
ErrMsg(ERR_ARG); /* improper arguments */
DBGFEX(1,DbgFNm,"FAILURE");
return FAILURE;
}
IniSrM = NONE;
}
CmdMod = '\0'; /* clear modifiers flags */
DBGFEX(1,DbgFNm,"SUCCESS");
return SUCCESS;
}

13
src/exectx.c 100644
View File

@ -0,0 +1,13 @@
/*****************************************************************************
ExeCtX()
This function executes a control-X command.
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT ExeCtX() /* execute a ^X (control-X) command */
{
DBGFEN(1,"ExeCtX",NULL);
DBGFEX(1,DbgFNm,"DoFlag()");
return DoFlag(&SMFlag);
}

23
src/execty.c 100644
View File

@ -0,0 +1,23 @@
/*****************************************************************************
ExeCtY()
This function executes a control-Y command.
^Y <CTRL/Y> (caret/Y) is equivalent to ".+^S,.", the n,m
numeric argument spanning the text just searched for or
inserted. This value may be used to recover from
inserting a string in the wrong place. Type "^YXSFR`"
to store the string in Q-register S and remove it from
the buffer. You can then position the pointer to the
right place and type "GS" to insert the string.
[TECO-11 only]
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT ExeCtY() /* execute ^Y command */
{
DBGFEN(1,"ExeCtY",NULL);
MArgmt = (GapBeg-EBfBeg) + RefLen; /* set m part of m,n pair */
CmdMod |= MARGIS; /* say that m part exists */
DBGFEX(1,DbgFNm,"PushEx()");
return PushEx((LONG)(GapBeg-EBfBeg), OPERAND); /* push n part */
}

25
src/exectz.c 100644
View File

@ -0,0 +1,25 @@
/*****************************************************************************
ExeCtZ()
This function executes a control-Z command.
^Z <CTRL/Z> (caret/Z) is equivalent to the total space
occupied by text in the Q-registers (including the
command line currently being executed).
*****************************************************************************/
#include "zport.h" /* define portability identifiers */
#include "tecoc.h" /* define general identifiers */
#include "defext.h" /* define external global variables */
DEFAULT ExeCtZ() /* execute a ^Z (control-Z) command */
{
LONG TmpLng;
WORD TmpWrd;
DBGFEN(1,"ExeCtZ",NULL);
TmpLng = (CStEnd - CStBeg) + 1;
for (TmpWrd = 0; TmpWrd < 36; ++TmpWrd) {
TmpLng += QRgstr[TmpWrd].End_P1 - QRgstr[TmpWrd].Start;
}
#if DEBUGGING
sprintf(DbgSBf,"PushEx(%ld)", TmpLng);
DbgFEx(1,DbgFNm,DbgSBf);
#endif
return PushEx(TmpLng,OPERAND);
}

Some files were not shown because too many files have changed in this diff Show More