
Fortran 77 Language Reference Manual Introduction This manual describes the Fortran 77 language specifications as implemented on the Silicon Graphics IRIS−4D series workstation. This implementation of Fortran 77 contains full American National Standard Institute (ANSI) Programming Language Fortran (X3.9−1978). It has extensions that provide full VMS Fortran compatibility to the extent possible without the VMS operating system or VAX data representation. It also contains extensions that provide partial compatibility with programs written in SVS Fortran and Fortran 66. This manual refers to Fortran 77 as Fortran, except where specific distinctions between Fortran 77 and Fortran 66 are discussed. The compiler can convert source programs written in VMS Fortran into machine programs executable under IRIX. Intended Audience This manual is intended as a reference manual, rather than a tutorial, and assumes familiarity with an algebraic language or prior exposure to Fortran. Corequisite Publications This manual describes the Fortran language specifications. Refer to the Fortran 77 Programmer’s Guide for information on • How to compile and link edit a Fortran program • Alignments, sizes, and variable ranges for the various data types • The coding interface between Fortran programs and programs written in C and Pascal • File formats, run−time error handling, and other information related to the IRIX operating system • Operating system functions and subroutines callable by Fortran programs Refer to the IRIS−4D Series Compiler Guide for information on: • An overview of the compiler system • Information on improving the program performance, showing how to use the profiling and optimization facilities of the compiler system • The dump utilities, archiver, and other tools for maintaining Fortran programs Refer to the dbx User’s Reference Manual for a detailed description of the debugger (dbx). For information on the interface to programs written in assembly language, refer to the Assembly Language Programmer’s Guide. Organization of Information Fortran 77 Language Reference Manual − Introduction − 1 This manual contains the following chapters and appendix: • Chapter 1, "Fortran Elements and Concepts," provides definitions for the various elements of a Fortran program. • Chapter 2, "Constants and Data Structures,"discusses the various types of Fortran constants and explains a few ways data can be structured. • Chapter 3, "Expressions," describes the formation, interpretation, and evaluation rules for each type of Fortran expression. • Chapter 4, "Specification Statements," summarizes the Fortran specification statements. • Chapter 5, "Assignment and Data Statements," discusses the types of assignment statements and explains how to use them. It also explains how to initialize variables and array elements using DATA statements. • Chapter 6, "Control Statements," explains the various Fortran control statements. • Chapter 7, "Input/Output Processing," discusses the programmer−related aspects of Fortran input/output processing. • Chapter 8, "Input/Output Statements," describes the statements that control the transfer of data within internal storage and between internal storage and external storage devices. It also provides an overview of the Fortran input/output statements and lists the syntax, rules, and examples for each. • Chapter 9, "Format Specification,"describes the FORMAT statement, field descriptors, edit descriptors, and list−directed formatting. • Chapter 10, "Statement Functions and Subprograms," discusses user−written subprograms and explains the syntax and rules for defining program units. • Chapter 11, "Compiler Options,"describes the options that affect source programs both during compilation and at run time. • Appendix A, "Intrinsic Functions,"lists the intrinsic functions supported. Typographical Conventions The following conventions and symbols are used in the text to describe the form of Fortran statements: Bold Indicates literal command line options, filenames, keywords, function/subroutine names, pathnames, and directory names. Italics Represents user−defined values. Replace the item in italics with a legal value. Italics are also used for command names, manual page names, and manual titles. Courier Indicates command syntax, program listings, computer output, and error messages. Courier bold Indicates user input. [ ] Enclose optional command arguments. Fortran 77 Language Reference Manual − Introduction − 2 () Surround arguments or are empty if the function has no arguments following function/subroutine names. Surround manual page section in which the command is described following IRIX commands. | Ssparates two or more optional items. ... Indicates that the preceding optional items can appear more than once in succession. # IRIX shell prompt for the superuser. % IRIX shell prompt for users other than superuser. Here are two examples illustrating the syntax conventions. DIMENSION a(d) [,a(d)] ... indicates that the Fortran keyword DIMENSION must be written as shown, that the user−defined entitya ( d) is required, and that one or more of a(d) can be optionally specified. Note that the pair of parentheses ( ) enclosing d is required. {STATIC | AUTOMATIC} v [,v] ... indicates that either the STATIC or AUTOMATIC keyword must be written as shown, that the user−defined entityv is required, and that one or more of v items can be optionally specified. Chapter 1 Fortran Elements and Concepts This chapter contains the following subsections: • "Fortran Character Set" • "Data Types" • "Collating Sequence" • "Symbolic Names" • "Variables" • "Source Program Lines" • "Statements" • "Program Units" • "Program Organization" This chapter provides definitions for the various elements of a Fortran program. The Fortran language is written using a specific set of characters that form the words, numbers, names, and expressions that make up Fortran statements. These statements form a Fortran program. The Fortran character set, the rules for writing Fortran statements, the main structural elements of a program, and the proper order of statements in a program are also discussed in this chapter. Fortran Character Set The Fortran character set consists of 26 uppercase and 26 lowercase letters (alphabetic characters), the numbers 0 through 9 (digits), and special characters. This manual refers to letters (uppercase and lowercase) together with the underscore (_) as extended alphabetic characters. The extended alphabetic characters together with the digits are also referred to as alphanumeric characters. The complete character set is Letters: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z Digits: 0 1 2 3 4 5 6 7 8 9 Special Characters: Blank = Equal + Plus − Minus * Asterisk Fortran 77 Language Reference Manual − Chapter 1, Fortran Elements and Concepts − 1 / Slash ( Left parenthesis ) Right parenthesis , Comma . Decimal point $ Currency symbol ’ Apostrophe : Colon ! Exclamation point _ Underscore " Quotation mark Lowercase alphabetic characters, the exclamation point (!), the underscore (_), and the double quote (") are extensions to Fortran 77. Digits are interpreted in base 10. A special character can serve as an operator, a part of a character constant, a part of a numeric constant, or some other function Blank Characters Use blank characters freely to improve the appearance and readability of Fortran statements. They have no significance in Fortran statements, except • in character constants • for H and character editing in format specifications • in Hollerith constants • to signify an initial line when used in column 6 of source line • when counting the total number of characters allowed in any one statement These special considerations are discussed in detail in later sections. Escape Sequences Table 1−1 lists escape sequences for representing non−graphic characters and for compatibility with the C programming language. Table 1−1 C Escape Sequences Sequence Meaning \n New line \t Tab \b Backspace \f Form feed Fortran 77 Language Reference Manual − Chapter 1, Fortran Elements and Concepts − 2 \0 Null \’ Apostrophe (does not terminate a string) \" Quotation mark (does not terminate a string) \\ \ \x x represents any character The compiler treats the backslash character as the beginning of an escape sequence by default. To use backslash as a normal character, compile the program with the -backslash option. Data Types In general, there are three kinds of entities that have a data type: constants, data names, and function names. The types of data allowed in Fortran are • INTEGERpositive and negative integral numbers and zero • REALpositive and negative numbers with a fractional part and zero • DOUBLE PRECISIONsame as REAL but using twice the storage space and possibly greater precision • COMPLEXordered pair of REAL data: real and imaginary components • DOUBLE COMPLEXordered pair of double−precision data • LOGICALBoolean data representing true or false • CHARACTERcharacter strings • HOLLERITHan historical data type for character definition Together, INTEGER, REAL, DOUBLE PRECISION, COMPLEX, and DOUBLE COMPLEX constitute the class of arithmetic data types. The type of data is established in one of two ways: implicitly, depending on the first letter of its symbolic name (described in this chapter), or explicitly through a type statement (described in Chapter 4). A data value can be a variable or a constant, that is, its value either can or cannot change during the execution of a program. An
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages197 Page
-
File Size-