Documentation

main
Blake McBride 2015-05-31 16:26:12 -05:00
parent d2024d1a02
commit fab43de821
18 changed files with 447 additions and 70 deletions

68
README.md 100644
View File

@ -0,0 +1,68 @@
TECOC - TECO Editor
===================
Teco is a text editor written by Dan Murphy in 1962. It differs from
other editors in several ways as follows:
1. Character oriented
Vi and Emacs are screen oriented editors. You view the text on the whole
window or screen, and you edit the text right where you see it. Changes take
affect immediately.
ed, ex, edlin are line oriented editors. Edited text is viewed,
referenced, and edited by line.
Teco is character oriented. This means the unit of reference is a
single character. On one hand, this may make teco cumbersome to use,
but on the other hand, it gives teco very fine control over what is
happening.
Teco does have a video mode, however text is still edited with
commands on a character basis. The screen is simply updated once a
command is completed to give the user a visual representation of where
they are. Text is not edited in the screen view area.
2. Macros
In general, vi, ed, and edlin are not programmable. This means you
have the functions the editor provides and that is all you can do.
However, teco is highly programmable. Programs that you write are
called macros. In fact, the original version of Emacs was written as
teco macros. Also, "emacs" actually means "Editing Macros".
The original versions of Teco were written in the machine languages of
the machines it operated on. As newer machines and editor arose, teco
fell into increasing disuse and obscurity.
In the early '80's Pete Siemsen, a long-time teco user, created a
portable version of Teco in the C language called "tecoc". Rather
than create a new editor, Pete's goal was to duplicate the original teco
as closely as possible.
As time wore on, Tom Almy, Blake McBride, and others increasingly
assisted in tecoc's maintenance (porting, bug fixes, etc.).
Eventually, tecoc found a new home and principal support at Tom
Almy's home page where Tom kept up with ports to Windows, Mac, and
Linux.
Most recently, Blake McBride:
1. Merged Tom Almy's various ports along with work done by Blake
2. renewed the Windows, Mac, and Linux ports
3. re-enabled video support (on Mac & Linux)
4. bug fixes and speed improvements
5. tested on 64 bit machines
This latest work is available on github at:
https://github.com/blakemcbride/Tecoc
Other documents in the "doc" directory provide complete documentation.
See the following files in the "doc" directory:
BUILD.txt Build and setup instructions
INTRO.txt Introduction to using the tecoc
teco-manual.txt Complete manual

68
doc/BUILD.txt 100644
View File

@ -0,0 +1,68 @@
TECOC build & setup instructions
Please note my use of "teco" and "tecoc". "teco" refers to the editor
in general, and "tecoc" refers to the particular "tecoc"
implementation of teco.
TECOC has been tested on 64 bit Linux, 64 bit Mac, and 64 bit Windows
OSs that were current as of 2015. In the past, this system was build on
32 and even 16 bit machines, so I have every reason to believe that it
would build as-is on 32 bit environments.
I used GCC on Linux and Mac, and I used the Microsoft 2013 C compiler
on Windows. On the Mac, GCC came automatically when I installed the
Apple development kit. I did no special setup.
The Linux and Mac versions support video and non-video modes. The
Windows version only supports non-video mode. (Porting Windows to
video using ncurses would probably be pretty simple.) As-shipped, the
Linux and Mac versions are setup to build the video versions. This
can be controlled by editing their associated makefiles. Linux and
Mac machine would need to install the ncurses development library.
To build, go to the "src" directory and type:
Linux: make -f makefile.linux
Mac: make -f makefile.osx
Windows: nmake -f makefile.win
You will end up with an executable names "tecoc". That is all you
need from this directory.
Historically, the teco environment included a handful of utilities
including:
teco
munge
inspect
Make
Tecoc includes all of this functionality in the single tecoc
executable. Tecoc has two ways of determining which functionality you
desire as follows:
1. On file systems that have links, one can create an entry with one
of the above names that links to the tecoc executable.
2. Alternatively (especially on Windows), if you execute the tecoc
executable directly, then the first argument must be one of the
utility names above. "teco" is what you'd mainly use.
As mentioned, teco supports the ability to create your own macros.
User added macros would exist in files named XX.tec
where XX is the name of the macro. It need not be two characters long.
These macro files must exist somewhere tecoc can find them. To this end,
tecoc supports an environment variable named TEC_LIBRARY
You should set that environment variable to the directory (full path)
where the macros are to exist. Note that TEC_LIBRARY must contain a
trailing slash.
Lastly, the "tec" file extension means "teco macro". There is also a
file type "tes". That stands for "teco macro source". Generally, if you
have a small macro, you'd just put it in a .tec file. Larger macros
would be written in a .tes file allowing comments and space. Later
the squeeze function can be used to convery a .tes file into a .tec
file.

145
doc/INTRO.txt 100644
View File

@ -0,0 +1,145 @@
Introduction to using tecoc
Evocation
---------
As stated in BUILD.txt, tecoc can either be executed directly, or a
file link can be created, or a batch file or shell script can be
created. For example, if you want to edit a file name MyFile.txt,
if you have a link setup like:
teco -> tecoc
then you could execute:
teco MyFile.txt
However, if you want to run tecoc directly, you'd have to do:
tecoc teco MyFile.txt
The extra, and first, argument, "teco", tells tecoc what mode to run
under. The remainder of this document will assume you have the link
setup.
If you have video mode configured, tecoc nevertheless starts in non-video
mode by default. To start tecoc in video mode you could do:
teco -scroll:5 MyFile.txt
This would make the bottom 5 lines used for commands, and the remaining
lines above to be the video display area.
Additionally, video mode can be turned on or off while editing a file,
regardless of the startup parameters. See "video.txt"
Importantly, the command to save the file and exit is:
EX followed by two escape key presses
To exit the edit session without saving, do:
-1EX followed by two escape key presses
Commands
--------
Teco is a character based editor. This means that teco keeps track of
what character you are at, and not what line you are on. One normally
edits a file by positioning the point and editing there.
The "$" character functions as the "escape key". A single $ is used
to separate multiple commands. Two consecutive escapes, $$, cause
teco to execute all of the commands up to that point.
Other characters, besides $, each have a meaning to teco. Some
commands consist of more than one character. Teco commands are
case-insensitive. This means that "m" and "M" mean the same thing.
In this text I will show the commands in uppercase simply to avoid
confusion between such letters as ell and one.
For example, the "L" command causes teco to move its pointer to the
following line. If you type "L", nothing happens until you tell teco
to execute is by following the "L" with "$$". So,
L$$
will cause teco to go to the next line.
You may have any number of commands specified before executing them,
for example:
LLL$$
will go down three lines.
Also, commands may take numeric arguments. For example,
3L$$
will go down 3 lines.
Commands may also be negative, so the following:
-4L$$
will cause teco to go up 4 lines. Also, since the default argument is one,
-L$$
is the same as -1L$$
In video mode, you will see the changes occur as soon as you execute $$.
In non-video mode, you see nothing unless you ask teco to display a
portion of the text. For example, if you type:
V$$
you will see the line you are on.
The current character position is always available vie the "." command.
There is also the "=" command that causes teco to display a value, thus:
.=$$
causes teco to display the current character position.
Teco has many, many powerful commands. It has loops, conditionals,
variables, etc.. Each letter has a different function. See the
included documentation.
Macros
------
A series of commands, since they are only letters, may be entered into
a text file. A user may tell teco to read and execute the commands in
one of those files. The name associated to that set of commands is the name of
the file they are located in (minus the .tec extension). The command
used to execute a macro file is "EI", thus, for example, if you have a
macro file named "ab.tec" located in the TEC_LIBRARY directory,
executing:
EIab$$
will cause teco to execute the commands located in that file.
In this example, the command is "EI". It takes a trailing string argument
"ab", and the "$$" means execute it.
Moving On
---------
To learn more, I suggest you read the following, included, documents in
the order shown:
Summary.pdf
blake-notes.txt
teco-manual.txt
wchart.txt
Many of the other documentation files are either historical or provide
greater, tecoc specific, information.

BIN
doc/Summary.pdf 100644

Binary file not shown.

View File

@ -0,0 +1,48 @@
Blake's Tecoc notes
.TES Teco source file
.TEC Teco macro file (compressed .TES file)
The distribution has a lib directory that has some teco macros. The
SQU macro used to squeze / compress teco source files is included
there.
= display value
Use /nomemory to avoid memory files
mung is just a link to teco
To compile / compress a teco macro file do (np.tes to np.tec):
mung squ np.tec=np.tes/D:N/L:Y/B:Y/T:Y/C:Y/W:N/A:Y/E:N
My macros
bl beginning of line
bw beginning of word
cls clear screen
dw delete word
el end of line
ew end of word
jmp jump to line
np next page - display and move forward one screen
pp previous page - display and move back one screen
0^X case insensitive search mode (default)
-1^X case sensitive search mode
----------------------------------------------------------------------
Video mode of tecoc
5,7:w to evoke video display (5 command lines at bottom)
0,7:w video mode off
-4:w to redraw screen
^w put current line at top of screen
A file can be started in video mode with:
teco -scroll:5 myfile on linux or Mac

1
lib2/bl.tec 100644
View File

@ -0,0 +1 @@
-ll ! goto the beginning of a line !

1
lib2/bw.tec 100644
View File

@ -0,0 +1 @@
[0+0U0Q0"E1U0'Q0">Q0<<0A"R|0;'C><0A"R0;'C>>|-Q0<<-A"R0;'-C><-A"R|0;'-C>>']0

5
lib2/cls.tec 100644
View File

@ -0,0 +1,5 @@
! Clear Screen !
26<
>

101
lib2/commands 100644
View File

@ -0,0 +1,101 @@
TECO COMMANDS
-------------
File Commands
------------------------------------
EX save file - exit
EBfile open file for input/output with backup
ERfile open input file for reading
EWfile open output file for writing
EC save buffer - clear buffer - close input/output files
EF close output file
EK kill current output file (abort edit)
Y read the next page
P save page - read next page
nP perform n Ps
Positioning Commands
------------------------------------
J jump to beginning of buffer
nJ jump to character position n
L beginning of next line
nL move n relative lines (0 means beginning of line)
C move forward one character
nC move n characters
R move reverse one character
nR move n relative characters
Stext$ search buffer for text (position after search string)
(if no text use previous search text)
Ntext$ search entire file from current position
nS search for the nth occurance (negative n means reverse)
nN search for the nth occurance (all pages)
Type Commands
-------------------------------------
T type current position to EOL
nT type n relative lines (0 means from BOL)
HT type whole buffer
V view whole current line
nV view n lines around current line
Text modification commands
-----------------------------------------
Itext$ insert text
@I/txt/ insert txt (may contain escapes)
K kill to EOL
nK kill n relative lines (0 meands BOL to current position)
HK kill whole buffer
D delete one character
nD delete n relative characters
FDtext$ find and delete text
FKtext$ find and kill from initial location to final location
FRtext$ replace last found text with text
Constants & Misc. Commands
------------------------------------
Z number of characters in the buffer
B 0
H B,Z
. current position
= display value
n<cmd> execute command string cmd n times
n^Q convert line offset (from 0) to character offset
(only works when starting from beginning of buffer)
Command Line
--------------------------------------
^U erase command line
*q put last command line into q register q
Q Register Commands
----------------------------------------
nUq put n into q register q
Qq get value from q register q
^Uqstr put string str into q register q
nXq copy next n (default 1) lines into q register q
n:Xq append next n lines into q register q
Gq get text in q register q and insert into buffer
Mq execute macro commands in q register q

1
lib2/dw.tec 100644
View File

@ -0,0 +1 @@
[0+0U0Q0"E1U0'Q0">Q0<<0A"R0;'D><0A"R|0;'D>>|-Q0<<-A"R0;'-D><-A"R|0;'-D>>']0

1
lib2/el.tec 100644
View File

@ -0,0 +1 @@
l-2c ! goto the end of a line !

1
lib2/ew.tec 100644
View File

@ -0,0 +1 @@
[0+0U0Q0"E1U0'Q0">Q0<<0A"R0;'C><0A"R|0;'C>>|-Q0<<-A"R|0;'-C><-A"R0;'-C>>']0

1
lib2/jmp.tec 100644
View File

@ -0,0 +1 @@
[0-1U0JQ0J]0

1
lib2/np.tec 100644
View File

@ -0,0 +1 @@
ei20l-20t ! macro to display the next screen full !

1
lib2/pp.tec 100644
View File

@ -0,0 +1 @@
-20l20t ! display previous screen !

4
lib2/start.tec 100644
View File

@ -0,0 +1,4 @@
-1^x ! enable case sensitive searches !
5*256+^^!ev ! display context before prompt !
0,16ed ! retain dot after failed searches !
$$

View File

@ -1,70 +0,0 @@
Command line
------- ----
-NOPAGE
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.
-SCROLL:nnn
do nnn,7:w
-SCROLL:nnn:SEEALL
do nnn,7:W and 1,3:W
-INSPECT
Same as /INSPECT
-NOMEMORY
Same as /NOMEMORY
Video
-----
^W Immediate mode command - try to place line containing dot in
centre of scope window
-4W Complete redraw of screen
-1W Stop refreshing scope before each prompt
1W Start refreshing scope before each prompt
0W refresh scope
3:w Seeall Mode (set to 1 if SeeAll is on, 0 otherwise)
seeall is more unix style then you might expect
5:w Hold mode is not properly implemented. I don't like it anyway.
7:W Number of lines in command window. The size of the scope window
will be (Rows - 7:W (- 1 if ET&256))
8:w Attribute for special characters. This is highly implementation
dependent (curses implementation dependent). Under SUN OS 4.1
0 - no marking
1 - underline
2 - reverse
4 - blink
8 - dim
16 - bold
128 - ALT_CHARSET
currently controls marking of <CR> `
END OF PAGE (BTEE/+)
9:W Bit 0 - keypad support on
Bit 1 - do not do timeout escape sequence detection
ET&1 image mode - doesn't really do much with curses version
ET&2 use scope for delete and control-U
ET&4 accept lowercase input
ET&32 read with no wait on control-T (unimplemented - easy though)
ET&2048 reverse roles of BS and DEL (good if you use stty erase ^H,
in particular the key placement of BS is sometimes much easier
to get at then DEL). Should I have it detect the kill character
and automatically set this?
ET&8192 accept ` as escape (for VT220 terminals)
ET&16384 special VT200 mode
ET&32768 trap control-C
EZ&1 if false VMS style versioning for backup files (multiple backups)
if true only one backup level (foo, foo.bak)
EZ&8 if TRUE use LARROW (<) for CR, if false use `
EZ&16 if set then prefer audio beep else visual flash
EZ&32 winline divider for scope
EZ&128 if set DO NOT stop read on FF otherwise make pages as usual
EZ&256 UNIX NL-convert LF to <CR><LF> on input and invert on output
ED&512 controls scope display. If set will use VT100 line drawing
characters for CR and LF (in non-scope mode). May degrade
performance.
EZ&2048 if set use BTEE for end of buffer, else use DIAMOND
(desirable for pathological terminal types)
EZ&8192 don't show CR in scope - closer to TECO-11, but really
not as good in my opinion (Mark Henderson)