next up previous contents
Next: 4.2 SRC2TEX Up: 4.1 FWEB Previous: 4.1 FWEB

Example:

A simple FWEB program is depicted in Table 4.

 

@n % Set \FWEB\ language to \Fortran.

\Title{example.web} % \Title is an \FWEB\ \TeX\ macro.
\author{J. A. Krommes} % \author is a \LaTeX\ macro.

@* INTRODUCTION. 
This code is intended to illustrate the use of the |write| statement.
It also provides a simple example of the FWEB macro preprocessor.

@m PI 3.14159 // FWEB preprocessor macro definition.

@a
        program main
        call compute
        end

@ The computational routine is pretty boring.
@a
        subroutine compute
        write(*,*) 'pi = ', PI
        end

@* \INDEX.

 
Table 4: An example of a simple program documented with FWEB, containing a main program and a subroutine.

FWEB is a complete and somewhat complicated system which would exceed the DAO's needs. The documentation system is very strict: FWEB is an ``all-or-nothing'' system. The FWEB files have a non-compilable format, and the compilable code must be extracted with ftangle. The rationale for this is to force programmers into a rigid framework where they have to document there code since they are actually writing a document which happens to contain code.

While this concept may be valuable for developers of new industrial Fortran code, it is inappropriate for the DAO, which is a research institution and is obliged to use much ``dusty deck'' code: it is necessary that the documented code is compilable since there will be by necessity a range of code from well-documented new codes to uncommented classical codes. In addition we believe that the learning curve would be too large for it to gain acceptance at the DAO, we feel than using it would be to large a step at this time. We seek a simpler solution.



Will Sawyer
Fri Mar 6 18:02:18 EST 1998