Newsgroups: comp.sys.transputer
From: teig@autro1.UUCP (Oyvind Teig)
Subject: Folding editor (versus) Code from Literate Programs
Organization: Autronica A/S, Trondheim, Norway
Date: 16 Sep 94 07:10:41 GMT
Message-ID: <182@autro1.UUCP>

Folding editors and Code from Literate Programming

  David J Clarke and Jouni Ryno comment about folding editors.
  In 1992 I made a version of Mr. Green's original Origami that
  has added functionality and is much more stable. I received
  his Pascal sources for it.

  I never submitted it to Hensa.

  Here are the help screens for it:
--------------------------------------------------------------------------------
        +-----F1:-----------F2:-----+
   Ctrl &Swap search/r&Cut part     &    Alt 1  Attach file to fold
  Shift &Browse/Edit  &File/Unfile  &    Alt 2  Save file as
    Alt &New search/r &             &    Alt 3  Copy string unto fold line
  F1-F2 &Help         &Line.. info  &    Alt 4  Insert template to fold
        +-----F3:-----+-----F4:-----&    Alt 5  Insert file
   Ctrl &Pick part    &Insert part  &    Alt 6  Insert template
  Shift &Put pick     &             &    Alt 7  Replace all
    Alt &Pick line    &Copy pick    &    Alt 8  Search
  F3-F4 &Move line    &Copy line    &    Alt 9  Replace
        +-----F5:-----+-----F6:-----&    Alt 0  Search and replace
   Ctrl &Top of file  &             &
  Shift &New file     &Avail.memory &    Esc:refresh screen
    Alt &             &Swap colours &
  F5-F6 &             &Language     &    Enter fold/Home  Up      Exit fold
        +-----F7:-----+-----F8:-----&    Delete to EOL            Remove fold
   Ctrl &             &             &
  Shift &Word <--     &Word -->     &    <--                      -->
    Alt &Delete line  &Restore line &    Word <--                 Word -->
  F7-F8 &Line <--     &Line -->     &
        +-----F9:-----+----F10:-----&    Open fold/EOL   Down     Close fold
   Ctrl &Define macro &Call macro   &    Finish                   Save file
  Shift &Top of fold  &End of fold  &
    Alt &Page up      &Page down    &    Create Fold              Delete -->
 F9-F10 &Line up      &Line down    &    Enter or Any
--------------------------------------------------------------------------------
^A ........ Autofold
^B ........ End of fold
^E ........ Del to EOL
^F ........ Word <--
^G ........ Word -->
^O ........ Browse/Edit
^Q ........ Quit (Asks for save)
^R ........ Remove fold
^S ........ Special char
^T ........ Top of fold
^U ........ Put Pick
^X and ^End Finish (Asks for save)
^Y ........ Delete line
^Z ........ Go to line number from top of entered fold

Change direction of search/replace with UpArrow or DownArrow during prompting.


Written by Martin Green in Turbo Pascal with inspiration from
R P Abrahams, H D Rawson-Harris, A Turnbull, A Mills, M Thomas, S J Oldham,
0 Teig (@inspiration from T Vollset, E I Ellingsen, O Johansen)
and the staff of INMOS

Origami 1.48 (C) 1989,90,92 Martin Green
Enter or Any
--------------------------------------------------------------------------------
Major news after version 1.4:
F2           Line number & fold info, until new F2 (or some other keys).
Alt 4        Insert template as fold, new search/replace strings.
Alt 6        Insert template directly, do one search/replace.
Alt 7        Replace all.
Alt 7+8+9+0  Search/Replace are now CaSe-sensitive.
Alt 0        Search and Replace (Old Alt 0 now is Alt 2).
Alt F6       Swap colours between Origami default and those set at DOS level.
Alt F9+F10   Now move screen 12 lines.
Ctrl F1      Search/Replace swap.
Ctrl F2/F3   Cut part / Pick part (additive) from line, move word right.
Ctrl F4      Insert part (made with Ctrl F2/F3) into line or into any prompt.
Ctrl F5      Repeated Exit Folds and Close Folds to top of file.
Ctrl PgDn    Save file.
Shift F6     Available memory (Needs approx. 170 bytes per ANY line).
Files        "LongFileName.Pascal" is legal, DOS will see "LONGFILE.PAS".
             Modified files are never stored automatically, and you will
             always be asked whether you want to store a modified file.
Templates    *.TE?, ?=N,O,P,C,L,D,F,U,N depending on "F6" choice.
             Extension is now: "*.TEN"
             Directory from DOS environment is now:
             origamitemplate="\edit\template\"
             Search string:"(-)", replace string:" "
Inmos F      Origami now reckognises "{{{  F " for folded files.
Other        Save As. Autofold:indents. "Origami+" means file modified.
--------------------------------------------------------------------------------
--

We have used it in a large project with quite a success.

HOWEVER:

At the moment I write my code both in MS-Word - together with a program 
called CLiP (Code from Literate Programs). In Word, I have graphichs 
like  data-flow diagrams etc., and descriptions of things. The source is 
the a DOC file! Then I extract a TXT version, that the CliP parses and 
extracts the files. At the moment 5 files are extracted. Occam code is 
now blue in my Word document, in Courier New ! I include folds as well, 
so the generated occam source files are folded. In the Word document the 
folds (or stubs as they call them) may be written up in any order. This 
is rather new to me, it seems ok, it certainly pinpoints the thinking 
process. However, I have to be a good writer, it seems, else the 
document might be a mess. 

I have for a long time undrestood that -- comments and documentation are 
two different things. This is far more than mere comments!

I haven't decided whether to code everything this way, but for the 
topmost level is seems fine. But I see that I move from Origami to Word 
in a way... In any case, 
I will keep the occam files folded, even if that adds some --{{{ etc in 
my Word file.

CLiP has been loaded via FTP from some address found in 
comp.literate.programming. It will work with any text-editor.

Knuth invented this, he made a system called WED that he used to program 
TEX as literate Pascal code.

0yvind Teig
Autronica

