


                    EEEEEEE CCCCCC CCCCCC EEEEEE
                    E       C      C      E
                    EEE     C      C      EEE
                    E       C      C      E
                    EEEEEEE CCCCCC CCCCCC EEEEEE .

                    Edinburgh
                            Compatible
                                   Context
                                          Editor.


                       A review by Graham Toal
  
                          for CPMSDOSUGUK.


   Ecce is one of those editors, like TECO, EMACS & VI, which gather a small
but loyal fan club.  I thought I would write this review to try and recruit
some new members!

   Ecce was designed in the 60's with two objectives:  it should be powerful,
and it should be small.  Editors at that time were simple line-based programs
- you would move to a given line by number and insert, delete, or replace the
whole line.  Very few editors had support for repeated commands or automatic
text processing by macros.  The limitation on size was because the machines
of the day had anywhere between 8K and 32K of core (yes, real core!) and any
room taken by the editor subtracted directly from the size of file you could
edit.

   Hamish Dewar, who designed ECCE, was a compiler-writer, and used this
experience to select a command-set which could be easily parsed and converted
into an internal format which allowed complex commands to be built up cheaply
- a bit like Forth's notion of threaded code.  The result was that ECCE
commands are regular, fast, and powerful.

   It is quite easy to learn how to use ECCE - half a dozen commands can get
you started, and the rest can be learned as you go along.  Lets look at some
examples:

               p               Print the current line

               m               Move down a line
               g               Get a new line
               k               Kill the current line

'Move' is obvious...

'Get' gives you a ':' prompt, and you type a line of text at it.
When you press return, that line is inserted in your file.

'Kill' deletes the entire current line.

Two more concepts are needed and you will be able to edit any file with these
commands:  firstly, if you put a number after a command, the command will be
executed that number of times, e.g.

                 p23            Print the next 23 lines
                 m10            Move down ten lines
                 g5             Make space for and accept 5 new lines of text

Secondly, any command which can sensibly be done in reverse (such as Move)
will do so if invoked with a '-', as in:

                  m-10           Move back up 10 lines

   These are the simplest commands of ECCE, and let you get started editing a
file.  Lots of editors look like this, and there is nothing really special
here.  Here are a few others which are self-explanatory and the sort of thing
you will be sed to in your own editor.

                 i/text/         Insert a text string here in the line.
                 f/text/         Find the quoted text.

                 r               Move Right one character on the current line
                 l               ditto Left

                 e               Erase one character on this line

Similarly, all these can take repeat counts where appropriate:

                 f/text/4        Find the 4th occurance of "text"
                 r40             Move Right 40 characters

And can be strung together quite happily:

                 m23 f/text/ p3

  Where ECCE comes in to its own is in its more advanced features:


                   Failures, Conditionals, and Repeat groups.

   Any of the commands above can fail - for instance, if you try to print 25
lines, and you are only ten lines from the end of the file, then the print
command will fail with an error after those ten lines have been printed.

   The smart bit about ECCE is that it allows you to test for such a failure,
and if one has happened, let you do something else instead.  The epitome of
this condition testing is the Verify command:

                   v/text/       Verify that the quoted text is at the
                                 current point in the line.

This command does nothing at all if the text is present, and does nothing but
issue a failure message if it is not!

   However, rather than print a failure message and abandon the command, we
can test whether the command worked and do something else instead.

                    v/text 1/ i/First text: /, i/Not first text: /




