Help Files: Fortran77: Source





     HELP                      Sep. 15, 1984                F77/SOURCE



            Format of Source Code Accepted by the f77 Compiler

     F77 recognizes standard Fortran 77 source.  Lines with 'C' or '*'
     in  column  one  or  that are blank in columns 1-72 are comments.
     Other lines have the following layout:

               1-5:  statement number field
                 6:  continuation column (continuation if not blank or 0)
              7-72:  statement body field
             73-80:  sequence field

     Short lines are padded with blanks to column 72.

     The rest of this help file describes non-standard  extensions  to
     the format and what they mean to f77.

     F77 normally ignores case (except within Hollerith constants  and
     character  strings);  thus  a  comment may also be indicated by a
     lower case 'c' in column one.

     In character strings, the following backslash escapes are  recog-
     nized:

             \n      newline character
             \t      tab character
             \b      backspace character
             \f      form feed character
             \0      null character
             \'      apostrophe (does not terminate string)
             \"      quotation mark (does not terminate string)
             \\      \

     F77 allows strings to be delimited by either apostrophes  (')  or
     double quotes (").  Whichever starts the string must also end the
     string.

     Variable names may be up to 16 characters in length, and  all  16
     characters are significant.

     Instead of using spaces to skip to column 7, a tab may  be  used.
     Continuation  lines  may  be  indicated by '&' in column one.  In
     both these cases, the statement body field starts with the  char-
     acter after the tab or '&' and continues to the last character of
     the source line whether before or after column 72.

     This can effect the length of Holleriths  and  strings  that  are
     split across several lines.  This is rare, but is documented here
     for completeness.  In the following example, there are no  trail-
     ing blanks in the source file.  Tabs are used in the first format
     statement to skip to the statement body field, blanks are used in
     the second format statement:

                     print 100
             c         tab between '100' and 'format'
             100     format ( 'abcdefghijklmn
                  .opq')

                   print 200
             c         spaces between '200' and 'format'
             200     format ( 'abcdefghijklmn
                  .opq')
                     end

     The printout is:

             abcdefghijklmnopq
             abcdefghijklmn                                        opq

     Because of the tab after '100' in the line containing format 100,
     that  line  is not padded with blanks; thus the 'opq' in the next
     line immediately follows the 'abcdefghijklmn' in  the  string  in
     the format and also in the output.

     Since blanks were used between '200' and  'format'  in  the  line
     containing  format  200,  that  line is padded with blanks out to
     column 72 so 'opq'  is  separated  from  'abcdefghijklmn'  by  40
     blanks in the format and in the output.


Comments to decf@euler.berkeley.edu
© 1998 UC Regents