Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [photran] Fortran source beautifier, pretty printer

Hi,

the combination of sed, f90ppr and emacs does a got job.

Just to complete this thread I attached my solution to automatically beautify a f90 project.
Have fun :)

Regards,
Jens Henrik

Jens Henrik Goebbert schrieb:
Hi,

can anyone comment on this?

I found the following tools:
    floppy - http://www.netlib.org/floppy/ (fortran 77 only)
    SPAG - http://www.polyhedron.com/spag0html (commercial)
    f90ppr- http://www.ifremer.fr/ditigo/molagnon/fortran90/
    for_struct - http://www.cobalt-blue.com/fs/fsmain.htm (commercial)
    tidy - http://www.unb.ca/fredericton/science/chem/ajit/f_tidy.htm
(fortran 77 only)
    emacs - http://linux.about.com/od/emacs_doc/a/emacsdoc192.htm

In my point of view the best pretty printer for fortran90 is f90ppr,
which is part of moware-1.0
    1. download it from
ftp://ftp.ifremer.fr/ifremer/fortran90/moware-1.0.tar.gz
    2. change the compiler in the Makefile
    3. compile
    4. add some keywords to the top of your f90-file (check f90ppr.1 for
more infos):
        $define FPPR_MAX_LINE 132
        $define FPPR_STP_INDENT 4
        $define FPPR_FXD_IN 0
        $define FPPR_FXD_OUT 0
        $define FPPR_KWD_CASE FPPR_LOWER
        $define FPPR_USR_CASE 0
    5. call "f90ppr < orig.f90 > pretty.f90"

Regards,
Jens Henrik

P.S: emacs was a nice try, but failed with a line like this:
if(ierr.ne.0) then; write(*,*) 'MPI_File_set_atomicity() error:',ierr;
goto 10; endif

Jens Henrik Goebbert schrieb:
  
Hi photran-developer,

thanks for this great editor.
I am using it since a couple of years now and have not seen any better one.

There are already great tools to speedup coding and I wonder, if we will
see a source beautifier some day?
Right now I open my Fortran files once in a while with emacs to use its
f90-indent, but this will only fix some white spaces (and even gets
confused by a semicolon).
But if I get source from other projects, it is sometimes very difficult
to read.

For C/C++ source beautifier are very powerful.
It is possible to select a certain "style" and the source becomes
readable and uniform.
It would be great to have such a tool in photran.

Regards,
Jens Henrik

_______________________________________________
photran mailing list
photran@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/photran

  
    
_______________________________________________
photran mailing list
photran@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/photran

  

Attachment: beautify.sh
Description: application/shellscript

/\.LT\./s// < /g 
/\.lt\./s// < /g 
/\.lT\./s// < /g 
/\.Lt\./s// < /g 

/\.LE\./s// <= /g 
/\.Le\./s// <= /g 
/\.lE\./s// <= /g 
/\.le\./s// <= /g 

/\.EQ\./s// == /g 
/\.eQ\./s// == /g 
/\.Eq\./s// == /g 
/\.eq\./s// == /g 

/\.NE\./s//\/=/g 
/\.ne\./s//\/=/g 
/\.Ne\./s//\/=/g 
/\.nE\./s//\/=/g 

/\.GT\./s//>/g 
/\.Gt\./s//>/g 
/\.gT\./s//>/g 
/\.gt\./s//>/g 

/\.GE\./s//>=/g 
/\.gE\./s//>=/g 
/\.Ge\./s//>=/g 
/\.ge\./s//>=/g 

Back to the top