
                     tde, the Thomson-Davis Editor
                              Version 2.0
                             June 5, 1992
                              Frank Davis


Author:

               Program name:    tde, the Thomson-Davis Editor
                                version 2.0

               Author:          Frank Davis
                  Bitnet:       fmd@tifton.bitnet
                  Internet:     fmd%tifton.bitnet@uga.cc.uga.edu

               Home address:    102 Starr Street
                                Tifton, Georgia  31794
                                USA

               Work address:    U.S. Department of Agriculture
                                Southeast Watershed Research Laboratory
                                Georgia Coastal Plain Experiment Station
                                Tifton, Georgia  31793
                                USA


Based on an editor by:          Douglas Thomson
                                c/- Computing
                                M.U.C.G.
                                Switchback Road
                                Churchill
                                Victoria   3842
                                AUSTRALIA
                                doug@giaeb.cc.monash.edu.au

                                Doug's old e-mail address was doug@giaea.oz


Contributions by:

   Tom Waters, twaters@nswc-wo.navy.mil


Contacts:

   Pierre Jelenc, pcj1@cunixf.cc.columbia.edu, will maintain and
   distribute documentation and support files for translated versions of
   tde.  Some users are interested in using tde with non-English
   languages.  Check with Pierre before you translate the documentation,
   as he may have the language version you need.

   For those in the Department of Defence, Tom Waters, twaters@nswc-wo.navy.mil,
   will be available to answer questions and provide support.  He has
   worked with tde source code since version 1.0, so he knows how the guts
   of the program works.  Usually, the hardware and software at DoD are
   from the same manufacturor, so he may have a version of tde that
   takes advantage of the capabilities of those machines.


File descriptions:

   TDE.EXE       tde executable for IBM PC or compatible
   TDE.DOC       tde user's manual
   TDE.CFG       configuration file

   TDECFG.EXE    utility to customize color and keys in tde.exe
   TDECFG.DOC    tdecfg user's manual
   SAMPLE.HLP    sample file for redefining help screen

   READ_ME.TDE   this file (you're reading it now)


      All source for tde editor, not needed unless you want to modify tde.

   INT24.ASM     critical error replacement - interrupt 24
   SIMUL101.ASM  utility to simulate 101 scan codes on 83/84 key keyboards
   BLOCK.C       line, stream, and box block functions
   CRITER.C      critical error prompt and info
   DIRLIST.C     directory list functions
   ED.C          basic editor functions
   FINDREP.C     Boyer-Moore search routines
   HWIND.C       initialization and display routines
   MAIN.C        main function and hardware routines
   TDEASM.C      pointer/string/display assembly routines
   UTILS.C       misc. editor functions
   WINDOW.C      window routines
   WORDWRAP.C    word wrap functions
   COMMON.H      external global variable declarations
   CRITER.H      critical error info
   DEFAULT.H     default function key assignments
   DEFINE.H      editor function defs
   GLOBAL.H      initial global variable declarations and editor function array
   HELP.H        intro and help screen
   PROMPTS.H     all user prompts
   TDEFUNC.H     prototypes for all functions
   TDESTR.H      defs for all structures and defines
   TDE.NMK       MSC 6.0a make (nmake) file
   TDE.QMK       QuickC 2.5 make (nmake) file


  All source for configuration utility, not needed unless you want to modify.

   TDECFG.C      main configuration routines
   CFGCOLOR.C    color utility routines
   CFGFILE.C     parse routines for configuration file
   CFGHELP.C     redefine the help screen
   CFGKEYS.C     key redefinition routines
   CFGMACRO.C    save macro file in tde.exe
   CFGMODES.C    default editor routines
   TDECFG.H      global structures and prototypes for tdecfg
   CFGCOLOR.H    defines for color utility
   CFGFILE.H     structures for parse routines
   CFGHELP.H     defines for rewriting help screen
   CFGKEYS.H     structures for all available keys and functions
   CFGMACRO.H    defines for macro screen
   CFGMODES.H    structures for default editor modes
   TDECFG.NMK    MSC 6.0a make (nmake) file
   TDECFG.QMK    QuickC 2.5 make (nmake) file


Disclaimer:

  This program is provided "as is" without warranty of any kind, either
expressed or implied, including, but not limited to the fitness for a
particular purpose.  You assume all risk for the use, inability to use,
misuse, or abuse of this program.  In any event, you (and not Frank Davis)
assume the entire cost of loss of use; loss of information; loss of
savings; loss of business profits, business interruption; mental anguish,
mental distress; all direct, consequential, or incidental damages or
losses; all necessary servicing, repair, or correction; and all physical
and mental health problems, acute or chronic, caused by direct or indirect
use of this program by you or any of your relatives, friends, acquain-
tances, co-workers, or otherwise fellow man either known or unknown by
you.

  Your use of this software constitutes agreement with and notice of
acknowledgement of the above heretofore stated warranty and limitations.
In addition with your agreement, you henceforth and forever relinquish,
waive, and forfeit all claims, rights, rulings, or judgements against the
forementioned author of said software; however, you retain the right to
keep your first born.  If you decide that it is in your best interest to
waive your right to your first born child, the author is in no way
obligated to accept or support the offspring regardless of age, marital
or employment status of said offspring.

  This program is not a product of the U.S. Department of Agriculture or
any other branch of the U.S. Government.  I work on tde at night,
weekends, and holidays on my own personal time, Frank Davis.


Claimer:

  I use this program all-day-every-day on all of my FORTRAN, C, and
assembly source code at home and at work, Frank Davis.


Licensing:

  This program is released into the public domain.  You may use and
distribute it freely.  There is no copyright, no fee for use, no
licensing, no registration, no legal bull, no nothing.  This editor is not
user supported, corporate sponsored, or government subsidized - it is
sustained and maintained solely by Frank Davis.  This editor was written
for use not only as a simple text editor but also as a learning tool.
Examine the code and discover the basics of editor construction.
Experiment a little and add your favorite functions or modify the existing
functions to suit your needs/requirements/tastes/etc.  If anyone includes
tde with their own software, please use common courtesy and give Doug
Thomson and Frank Davis credit for their work (that's the only payment I
ask).  If you release any changes or additions to the tde editor, please
observe the original spirit of Doug Thomson's DTE 5.1 and release the
changes as public domain software.


Distribution Sites:

  You will always be able to find the latest version of tde in the
SIMTEL20 archives in the PD1:<MSDOS.EDITOR> directory or in Library 16 of
the Utilforum in PC MagNet on CompuServe (search for TDE as the keyword).
I do not upload tde to any other file archive, Frank.


                    Standard SIMTEL20 download Info

"SIMTEL20 files are also available from mirror sites OAK.Oakland.Edu
(141.210.10.117), wuarchive.wustl.edu (128.252.135.4), ftp.uu.net
(137.39.1.9), nic.funet.fi (128.214.6.100), src.doc.ic.ac.uk (146.169.3.7)
or archie.au (139.130.4.6), by e-mail through the BITNET/EARN file
servers, or by uucp from UUNET's 1-900-GOT-SRCS.  See UUNET file
uunet!~/info/archive-help for details.

If you cannot access them via FTP or e-mail, most SIMTEL20 MSDOS files,
including the PC-Blue collection, are also available for downloading from
Detroit Download Central (313) 885-3956.  DDC has multiple lines which
support 300/1200/2400/9600/14400 bps (103/212/V22bis/HST/V32bis/
V42bis/MNP).  This is a subscription system with an average hourly cost of
17 cents.  It is also accessible on Telenet via PC Pursuit and on Tymnet
via StarLink outdial.  New files uploaded to SIMTEL20 are usually
available on DDC within 24 hours."

You will be able to find foriegn language versions at SIMTEL20 and mirror
sites, Detroit Download Central, and Garbo.  At Garbo (128.214.87.1
garbo.uwasa.fi), these files will be in the linguistics directory.  At
SIMTEL20 and mirrors, these files will be in either the editor or the
linguistics directory.



Background:

  At work, I have written several editors that may only be used for a
certain type of file (almost an expert system).  I have always wanted to
write a general purpose public domain text editor.  It seems none of the
existing public domain or shareware editors have all of the features I
like.  Since I'm so stupid, the editor should be really easy to use.
My wish list of features are:

   Blocks:
      Line, stream, and box blocks.
      Move, delete, copy, kopy, overlay, fill, print, number, and sort.
      Block actions within or between files.

   Files:
      Multiple files limited only by memory.

   Windows:
      Multiple windows limited only by memory.
      Split screen horizontally and vertically
      Changes to text in one window are updated in all windows of same file.
      Interactively resize windows.
      Two windows of same size so two files can be easily compared.

   Search/Replace:
      Ignore or Match case of pattern.
      Prompt or no prompt replace.
      Boyer-Moore pattern matching algorithm.

   User Configuration:
      Ability to assign any editor function to any recognized function key.
      Redefine color attributes in all editor fields.
      Change default editor settings.
      Macro recording and playback.

   Other:
      Split/join line.
      Lines as long a 1040 characters.
      Paren balance.
      Mode/information line.
      Cursor sync.
      Directory list
      Ruler with a cursor pointer



Douglas Thomson's editor, DTE 5.1:

  Well, I found a public domain editor that had most of the features on my
wish list.  The original code was extremely well documented.  That editor
was DTE 5.1, written by Douglas Thomson, Gippsland, Victoria, Australia.
So instead of writing an editor from scratch, I based my editor around
Doug's well designed and documented program.   My editor was written using
DTE 5.1 as an outline.  Doug, thanks a lot for releasing the source code
for your editor.

  DTE 5.1 is pretty much machine independent.  It runs on PC's, HP 3000's,
and generic Unix system V release 2 systems.  It was designed to work well
over slow communication lines, eg 1200 baud.  Screen updates are kept to a
minimum which saves time and money when using dial-up phone lines.  DTE
5.1 uses the WordStar/Turbo x style key definitions.  If you need an
editor for use over slow communication terminals, check out Doug's editor.


tde, the Thomson-Davis Editor:

  My dream editor was to be written specifically for PC's.  At work, we
have an IBM mainframe.  The only reason I use the mainframe is for e-mail
and for backup of my PC files (I have exaggerated a little).  I use my PC
editors to compose my mail then upload to the mainframe to send it.  So, I
really don't need or desire a machine independent editor.  Although I have
IBM OS/2 1.3 on my machine at work, I don't use OS/2 enough to justify
writing a bound version.  To make a program run under both IBM/MS DOS and
OS/2, you have to bind it and refrain from doing neat BIOS and hardware
tricks.

  Another of my design considerations was the machine-compiler-memory
model factor.  At work I use a 16 Mhz 386 machine with Microsoft C 6.0a
and at home I use a 8 Mhz 286 machine with Microsoft QuickC 2.51 w/
QuickAssembler.  I wanted the editor to work fast on the slow machine, so
I wrote some of the often used string functions in assembly.  To edit
files larger than 64k, you just about have to use the huge memory model;
however, QuickC cannot debug programs compiled with the huge option.
Additionally, programs compiled using the huge model run a lot slower
because of all the compiler generated pointer arithmetic.  I wrote some
functions in assembly that allow my editor to be compiled with either the
small, compact, medium, or large memory model.  Now, I can run and debug
the program at work or at home.  All of those assembly routines that
support huge pointer arithmetic are original.  If you're into assembly,
check out the tdeasm.c module for some good assembly tips on manually
manipulating far pointers.

  I also wanted the ability to edit the files produced by our environmental
quality model at the USDA.  Null characters, or '\0', are allowed as part
of the normal text in those files.  Since DOS uses ^Z to mark the end of
files (in text mode), I decided to use ^Z to mark the end of strings.  Any
character, except ^Z, is allowed in the text file. Conse-damn-quently, the
standard C string library functions will not work when doing operations on
text in the file (can't rely on library functions to handle '\0'
properly).  The assembly language routines in tdeasm.c take care of the ^Z
terminated strings.

  I modified almost all of the algorithms in the original DTE 5.1 editor
and added several more.  The block and find/replace algorithms are
completely rewritten.  Block operations now use line, box, and stream
blocks.  Available block operations include move, delete, copy, kopy,
fill, overlay, block expand tabs, block print, block write to file, block
upper case, block lower case, block strip hi bit, trim block, number box
block, and sort box block (a few of these functions were available for
stream blocks in the original DTE 5.1).  Block operations are allowed
within or between files.  The "brute force" text find algorithm was
replaced by the Boyer-Moore string matching algorithm, a very fast text
search algorithm.  The text display algorithms were rewritten.  Window
operations were rewritten, enhanced, and streamlined.  Windows may now be
split vertically as well as horizontally.  Support for lines as long as
1040 characters was added.  Horizontal scrolling/paging are allowed.  A
mode/information lite bar was added to display the various modes at the
bottom of the screen.  Displayed in the lite bar are:  number of open
files and total number of windows, available memory for editing the
current file or additional files, and the editor mode flags.  Displayed
with the file name are:  file attributes, the total number of lines in the
file (size), and the current line number and column number of the cursor.
The join line, split line, and dup line functions were added.  Any ASCII
or Extended ASCII character, except control Z, can be entered into the
text file by using the ALT-xxx method.  Several often used string routines
were rewritten in assembly and optimized for 16 bit processors, which
makes cursor movement very fast through any size file.  One function that
I sorely missed, a simple undelete function, was added.  A few simple word
processing functions were also added:  word wrap, paragraph format, and
left, right, and center justify functions.  A dynamic left margin was
added for writers.  Smart tabs were added for use with tables and
formatted data files.  Also added was a cursor sync function.  After using
the sync function for a day, it became apparent that a hilited cursor line
was needed to keep track of cursor positions in all windows.  A directory
function was added so users may search directories for files to load.
Another useful feature, a key stroke record and playback (simple macros),
was added to make simple, repititive, editing tasks easier; recursive
macros are allowed.  A critical error handler was added to give the user
more info on hardware faults.  To help users construct formatted data or
formatted source code (FORTRAN) files, a ruler line with a column pointer
was added.  A configuration utility was written to allow the user to
customize all colors and the 233 recognized function keys with no
restrictions.  All keys, modes, and colors may be assigned from a
configuration file.  For users who work with alphabets that contain special
accent characters, any ASCII or Extended ASCII character may be assigned
to unused function keys by permanently storing a macro definition file in
tde.exe.  And last, an instant help screen with key definitions was added.


Programming Notes:

  This program makes extensive use of multi-segment pointers.  The
assembly routines in tdeasm.c were written to avoid a LOT of pointer
arithmetic generated by the compiler.  If you do decide to modify tde,
keep in mind that you are responsible for pointer integrity.  That is,
functions that use pointers to access text forwards through the file need
to check those pointers to make sure they don't "wrap" around a segment.
Same goes for accessing text backwards through the file.  The functions
responsible for pointer integrity are cpf (check pointer forwards) and cpb
(check pointer backwards).  Also, you can't reliably add large numbers to
pointers in all but the huge memory model.  The small, compact, medium,
and large memory models were not designed for use with multisegment or
huge pointers (you may always explicitly declare and use huge pointers
in those models, though).  Use the function addltop (add long to
pointer) to handle adding large numbers to pointers.

  The 101 key keyboard simulation utility requires an assembler to produce
object code.  If you don't have access to an assembler, you may comment
out the calls to function simulate_enh_kbd( ) in main.c.  tde will still
take advantage of the 101 enhanced keyboard, but will not be able to use
the simulated 101 keys on older 83/84 keyboard systems.

  Several functions in tde return an integer value that indicates whether
or not an ERROR occured.  The variable name most often used to return the
result is "rc".  For non-IBM mainframers, rc == return code.


Bug reports:

  There are no bugs in tde, only features that may inconvenience you. ;*)
Please send inconvenience reports via e-mail, if at all possible, to
fmd@tifton.bitnet.  For y'all over there on CompuServe, my e-mail address
is ">INTERNET:FMD%TIFTON.BITNET@UGA.CC.UGA.EDU" (don't type the quotes,
just everything between them).  I'll try to respond as quickly as possible
to reports received via e-mail.


About the author of tde, Frank Davis:

  Frank "yank" Davis, who has an impressive collection of inflatable bed
bunnies, graduated near the bottom of his class in 1983 from Georgia Tech
with a BS in Information and Computer Science.  He can be found drinking
massive quantities of beer in his underwear (boxer shorts) on his couch
while watching college football and Atlanta Braves baseball on his 19 inch
color TV.  Hobbies include:  sex, drugs, and rock 'n' roll.

  This program is another quality product from Yank Software, "Software
you just can't beat."
