02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Language elements<br />

Source format of program file<br />

Source format of program file<br />

The <strong>HP</strong> <strong>Fortran</strong> compiler accepts source files in fixed form (the standard source form for<br />

FORTRAN 77 programs) or free form. The following sections describe both forms.<br />

The compiler assumes that source files whose names end in the .f90 extension are in free<br />

source form and that files whose names end in the .f or .F extension are in fixed form. You<br />

can override these assumptions by compiling with the +source=free or +source=free<br />

option. See the <strong>HP</strong> <strong>Fortran</strong> Programmer’s Guide for more information.<br />

Althoughthetwoformsarequitedifferent,youcanformata<strong>Fortran</strong>90sourcefilesothatthe<br />

compiler would accept it as either fixed or free form. This would be necessary, for example,<br />

when preparing a source file containing code that will be inserted through the INCLUDE line<br />

into a file for which the form is not known. To format a source file to be acceptable as either<br />

free or fixed source form, use the following rules:<br />

16<br />

Put labels in columns1-5.<br />

Put statement bodies in columns 7-72.<br />

Begin comments with an exclamation mark in anycolumn except column 6.<br />

Indicate all continuations with an ampersand character (&) incolumn73ofthelinetobe<br />

continued and an ampersand character in column 6 of the continuing line.<br />

Do not insert blanks in tokens.<br />

Separate adjacent names and keywords with a space.<br />

Free source form<br />

In free source form, the source line is not divided into fields of predefined width, as in the fixed<br />

form. This makes entering text at an interactive terminal more convenient.<br />

Source lines<br />

Freeform lines can contain from 0 to 132 characters. The +extend_source option extends the<br />

line to column 254. This is described in the <strong>HP</strong> <strong>Fortran</strong> Programmer’s Guide. Several<br />

statements can appear on a single source line, separated by semicolons. A single <strong>Fortran</strong> 90<br />

statement can extend over more than one source line, as described below in “Statement<br />

continuation” on page 18.<br />

Multiple statements may appear on the same line, separated by a semicolon (;).<br />

Chapter 2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!