[CMake] ccmake and fortran

bpwlist at cox.net bpwlist at cox.net
Sat Aug 12 10:01:31 EDT 2006


Hi Alan,

My knowledgebase of fortran lies with fixed format f77 fortran, so your right the solution below only works for fixed format Fortran.  There is currently nothing in the .l file  to set the <fixed_fmt> state, so the line:

<fixed_fmt>^[cC*dD].*\n { return EOSTMT; } 

never gets triggered.  Having only worked with fixed format fortran and not having a newer fortran book on my book shelf... How does the compiler determine whether a file is fixed or free format?  A test needs to be put in the .l file to determine whether fixed or free format fortran is being used.

Bryan Walsh
---- "Alan W. Irwin" <irwin at beluga.phys.uvic.ca> wrote: 
> 
> Thanks very much for working on CMake fortran issues, Bryan!  For the PLplot
> project, we have had to deploy some ugly workarounds (e.g., "Use" ==> "Use_"
> in comments) to get around this fortran parsing issue for fixed-length style
> fortran source so getting this issue fixed is important to us.
> 
> I don't understand flex, but the above looks similar to a regular expression
> which I do understand.  Thus, I have a question about the change you have
> suggested above.  Won't that fail to parse free-form fortran code correctly
> that starts with [cC*dD] in the first column but which is not a comment?
> This may be an unlikely scenario (especially if the parsing is only looking
> for a very limited set of things in the fortran code), but nevertheless it
> makes me a bit uneasy.
> 
> To me, the real issue is that somehow fixed format fortran code is not being
> recognized.  I assume that is the function of the <fixed_fmt> above, but it
> is obviously not working for some reason so you had to remove it.  A more
> satisfactory fix would be to find the reason why <fixed_fmt> is not working.
> For our code we use the convention that fixed form fortran has a .f suffix
> and free-form fortran has a .f90 suffix.  That's consistent with the Intel
> compiler conventions, and that convention is also recognized by gfortran
> (i.e., we don't have to specify any special options to the gfortran compiler
> for either our fixed format or free-format fortran code so long as we follow
> that suffix rule).  Is that the source of the trouble?  Would CMake parse
> fixed-form source files properly if we used the -ffixed-form gfortran option?
> 
> Alan
> __________________________
> Alan W. Irwin
> 
> Astronomical research affiliation with Department of Physics and Astronomy,
> University of Victoria (astrowww.phys.uvic.ca).
> 
> Programming affiliations with the FreeEOS equation-of-state implementation
> for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
> package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the
> Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project
> (lbproject.sf.net).
> __________________________
> 
> Linux-powered Science
> __________________________



More information about the CMake mailing list