Next: 2.3 Conditional code in Up: 2 Conditional code and Previous: 2.1 Specification of ftc

2.2 Structure of conditional Fortran code

Lines which begin cstart, celse, cend and c; are treated specially by ftc.
  1. cstart can be followed by a keyword, and if the flag corresponding to the keyword is true, all code up to the next cend is forced active, i.e., any leading c; is stripped away. If, conversely, the flag is false, all code up to cend is forced inactive, inserting c; as necessary. celse can be used to implement alternatives in an obvious way, for example,
     cstart unix-i8
     c;      write (6,*) 'Integer length is 8'
     celse
          write (6,*) 'Integer length is 4'
     cend
    
  2. More than one keyword can be given on the cstart line, with a logical or being assumed between each. If the requirement is for two flags to be set for the code to be active, the keywords may be separated by .and.; keywords may be preceded by .not.. For example,
     cstart cray .and. .not. mpp
           write (6,*) 'This is a Cray, but not MPP'
     cend
    
  3. cstart $\dots$ cend constructs may be nested up to some reasonable limit.



P.J. Knowles and H.-J. Werner
molpro-support@tc.bham.ac.uk
Jan 10, 2000