This is an HTML document that can be used as input to ufpp(1)

If you are comfortable writing simple HTML documents, a simple feature of ufpp(1) allows you to easily maintain documentation, source, and links to external files all together. If you run the ufpp(1) Fortran Preprocessor on this file with the command

    ufpp -html -i THISFILE.html -o THISFILE.f90
    
the Fortran source is extracted using very simple rules: If lines begin with <xmp> start writing out the lines; quit if </xmp> is encountered.

TEST PROGRAM

$if .not.defined(WHICH_VERSION) $define WHICH_VERSION=1 ! Will only compile the first version of subroutine ONE $endif program testit write(*,*)'hello world' call one() call two() end program testit

ROUTINE ONE

There are three versions of subroutine ONE(). If WHICH_VERSION is not defined, the "third" version is written to output. If WHICH_VERSION = 1, version "first" is used. If WHICH_VERSION =2 , version "second" is used.

$IF WHICH_VERSION .EQ. 1 subroutine one() write(*,*)'called one, first version' end subroutine one $ELSEIF WHICH_VERSION .eq. 2 subroutine one() write(*,*)'called one, second version' end subroutine one $ELSE subroutine one() write(*,*)'called one, third version' end subroutine one $ENDIF

ROUTINE TWO

subroutine two() write(*,*)'called two' end subroutine two