From: " (Bernhard Lang)" 
Newsgroups: comp.programming.literate
Subject: Announcing FOLD2WEB for PCs
Message-ID: <9403102004.AA24557@kirk.ti1.tu-harburg.de>
Date: Thu, 10 Mar 1994 21:04:17 +0100
Organization: Litprog<==>Comp.Programming.Literate Gateway
X-Gateway-Source-Info: Mailing List
Lines: 86


Announcing FOLD2WEB for PCs
---------------------------

Let me introduce a new tool for semi-automatic generation of web-files.
It is based on the idea of "folded" source code. In folded source code 
you can fold away some portions of your code and will only see a top
level fold containing a description. Only if required you will open
a fold and will see its details. The fold structure is embedded in
a source text using comments. Defining a StartFold-, EndFold- and
TerminateFold-marker a folding structure may be embedded in most
programming languages.

I use e.g. the following markers:
  
  Pascal: 
    StartFold:     "(*{{{"
    EndFold:       "(*}}}"
    TerminateFold: "*)"
  C++:
    StartFold:     "//{{{"
    EndFold:       "//}}}"
    TerminateFold: ""
  TeX:
    StartFold:     "%%{{{"
    EndFold:       "%%}}}"
    TerminateFold: ""
    
Then a small pascal program will look like:

  PROGRAM test(input,output);
  (*{{{ variables *)
  VAR i:integer;
  (*}}} variables *)
  (*{{{ The main program *)
  begin
    for i:=0 to 10 do
      writeln('hello world');
  end.
  (*}}} The main program *)
  
In a folding editor the top level view will look like:

  PROGRAM test(input,output);
  ... variables 
  ... The main program   
  
In our institute we picked the "folding micro emacs" FUE from the net,
modified this editor to some extent and adapted it to the PC. This
editor allows the definition of different foldmarks based on the file
extension. Thus we produce a lot of source code that is really
beautiful structured using folds. The remaining problem was to
get a printout of these structured documents which will reflect the
embedded folding structure of the source.

To solve this problem I wrote a program FOLD2WEB which automatically
translates  a folded document to a NUWEB source file (I am really a FAN
of NUWEB due to its simplicity). This sourcefile can be tangled and
weaved either reproducing the program source or producing the TeX
source. FOLD2WEB is written in PASCAL and runs on PCs. 

The WEB file of FOLD2WEB can be generated with a complete embedded LaTeX
environement and thus can be translated to a printfile without knowing
anything about NUWEB or LaTeX. Only how to call the different
translators must be known. 

On the other hand if you have to modify old program sources it is very
helpful if you give them a structure based on (hopefully) embedded
comments using a folding editor. This costs not much time. Then the
FOLD2WEB program will translate this structured program automatically
to a NUWEB source which can be used as a basis for documented program
modifications.

For all who are interested in the described programs I packed the
executables of FUE.EXE (the folding editor) and FOLD2WEB.EXE and some
description onto our FTP server "kirk.ti1.tu-harburg.de:pub/fold2web".
Read the files FOLD2WEB.DOC and FUE.DOC for more information.

Bernhard.

{{{  Dr. Bernhard Lang  -----------------------------------------------
     email: lang@tu-harburg.d400.de        TU Hamburg Harburg
                                           Technische Informatik I
}}}
...  Enter this fold to view behind the scenes  -----------------------