[CMake] ccmake and fortran

bpwlist at cox.net bpwlist at cox.net
Sat Aug 12 20:21:34 EDT 2006


Something like this could be done in cmDependsFortranLexer.in.l

...

%option reentrant
%option noyywrap
%pointer

%s free_fmt fixed_fmt
%x str_sq str_dq

%%

%{
     bool fixed = cmDependsFortranParser_isFixedFormat(yyextra);
     if (fixed)
         BEGIN(fixed_fmt);
%}

\"              {
  cmDependsFortranParser_StringStart(yyextra);
  BEGIN(str_dq);
}

...

!.*\n                   { return EOSTMT; } /* Treat comments like */
<fixed_fmt>^[cC*dD].*\n { return EOSTMT; } /* empty lines */

cmDependsFortranParser_isFixedFormat would be a function that we could add to cmDependsFortran.cxx which returnss true if a given file is fixed format.   Part of the problem is that it would be a standalone function with just access to the parser pointer (yyextra).  I'm not sure how you would query a source file property from it.

Bryan Walsh

---- "Alan W. Irwin" <irwin at beluga.phys.uvic.ca> wrote: 
> Here is an alternative I wish you would consider instead. According to the
> SET_SOURCE_FILES_PROPERTIES documentation users can make up their own
> properties for source files so I suggest you assume the users has specified
> a BOOL property called FORTRAN_FIXED_FORM when their fortran source file is
> in fixed form.  Then you only have to interrogate this source-code property
> and set fixed_fmt accordingly.  (Note, I have glossed over the
> implementation details because I am unaware of those details.) When
> documenting the FORTRAN_FIXED_FORM property you would have to make it clear
> that this was only to help CMake parse the fortran source and it is the
> user's additional responsibility to figure out the compiler options for
> specifying fixed form to the fortran compiler of their choice.
> 
> 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