fortran 77 version 5.0

Download Fortran 77 Version 5.0

Post on 03-Apr-2018

218 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • 7/28/2019 Fortran 77 Version 5.0

    1/372

    FORTRAN 77 Language Reference

    FORTRAN 77 Version 5.0

    901 San Antonio RoadPalo Alto, , CA 94303-4900

    USA 650 960-1300 fax 650 969-9131

    Part No: 805-4939Revision A, February 1999

  • 7/28/2019 Fortran 77 Version 5.0

    2/372

    Copyright Copyright 1999 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California 94303-4900 U.S.A. All rights reserved.

    All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying,distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior writtenauthorization of Sun and its licensors, if any.

    Portions of this product may be derived from the UNIX system, licensed from Novell, Inc., and from the Berkeley 4.3 BSD system,licensed from the University of California. UNIX is a registered trademark in the United States and in other countries and is exclusivelylicensed by X/Open Company Ltd. Third-party software, including font technology in this product, is protected by copyright and licensedfrom Suns suppliers. RESTRICTED RIGHTS: Use, duplication, or disclosure by the U.S. Government is subject to restrictions of FAR52.227-14(g)(2)(6/87) and FAR 52.227-19(6/87), or DFAR 252.227-7015(b)(6/95) and DFAR 227.7202-3(a).

    Sun, Sun Microsystems, the Sun logo, SunDocs, SunExpress, Solaris, Sun Performance Library, Sun Performance WorkShop, Sun VisualWorkShop, Sun WorkShop, and Sun WorkShop Professional are trademarks or registered trademarks of Sun Microsystems, Inc. in theUnited States and in other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARCInternational, Inc. in the United States and in other countries. Products bearing SPARC trademarks are based upon an architecturedeveloped by Sun Microsystems, Inc.

    The OPEN LOOK and SunTM

    Graphical User Interfaces were developed by Sun Microsystems, Inc. for its users and licensees. Sunacknowledges the pioneering efforts of Xerox Corporation in researching and developing the concept of visual or graphical user interfacesfor the computer industry. Sun holds a nonexclusive license from Xerox to the Xerox Graphical User Interface, which license also coversSuns licensees who implement OPEN LOOK GUIs and otherwise comply with Suns written license agreements.

    THIS PUBLICATION IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, ORNON-INFRINGEMENT.

    Copyright 1999 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, Californie 94303-4900 U.S.A. Tous droits rservs.

    Ce produit ou document est protg par un copyright et distribu avec des licences qui en restreignent lutilisation, la copie et ladcompilation. Aucune partie de ce produit ou de sa documentation associe ne peut tre reproduite sous aucune forme, par quelquemoyen que ce soit, sans lautorisation pralable et crite de Sun et de ses bailleurs de licence, sil y en a.

    Des parties de ce produit pourront tre derives du systme UNIX licenci par Novell, Inc. et du systme Berkeley 4.3 BSD licenci parlUniversit de Californie. UNIX est une marque enregistre aux Etats-Unis et dans dautres pays, et licencie exclusivement par X/OpenCompany Ltd. Le logiciel dtenu par des tiers, et qui comprend la technologie relative aux polices de caractres, est protg par uncopyright et licenci par des fournisseurs de Sun.

    Sun, Sun Microsystems, le logo Sun, SunDocs, SunExpress, Solaris, Sun Performance Library, Sun Performance WorkShop, Sun VisualWorkShop, Sun WorkShop, et Sun WorkShop Professional sont des marques dposes ou enregistres de Sun Microsystems, Inc. auxEtats-Unis et dans dautres pays. Toutes les marques SPARC, utilises sous licence, sont des marques dposes ou enregistres de SPARCInternational, Inc. aux Etats-Unis et dans dautres pays. Les produits portant les marques SPARC sont bass sur une architecturedveloppe par Sun Microsystems, Inc.

    Les utilisateurs dinterfaces graphiques OPEN LOOK et SunTM

    ont t dvelopps de Sun Microsystems, Inc. pour ses utilisateurs etlicencis. Sun reconnat les efforts de pionniers de Xerox Corporation pour la recherche et le dveloppement du concept des interfacesdutilisation visuelle ou graphique pour lindustrie de linformatique. Sun dtient une licence non exclusive de Xerox sur linterfacedutilisation graphique, cette licence couvrant aussi les licencis de Sun qui mettent en place les utilisateurs dinterfaces graphiques OPENLOOK et qui en outre se conforment aux licences crites de Sun.

    CETTE PUBLICATION EST FOURNIE "EN LETAT" SANS GARANTIE DAUCUNE SORTE, NI EXPRESSE NI IMPLICITE, Y COMPRIS,ET SANS QUE CETTE LISTE NE SOIT LIMITATIVE, DES GARANTIES CONCERNANT LA VALEUR MARCHANDE, LAPTITUDE DESPRODUITS A REPONDRE A UNE UTILISATION PARTICULIERE OU LE FAIT QUILS NE SOIENT PAS CONTREFAISANTS DEPRODUITS DE TIERS.

    PleaseRecycle

  • 7/28/2019 Fortran 77 Version 5.0

    3/372

    Contents

    Preface xix

    1. Elements of FORTRAN 1

    Standards Conformance 1

    Extensions 2

    Basic Terms 2

    Character Set 2

    Symbolic Names 4

    Program Units 6

    Statements 7

    Executable and Nonexecutable Statements 7

    FORTRAN Statements 7

    Source Line Formats 8

    Standard Fixed Format 9

    Tab-Format 9

    Mixing Formats 9

    Continuation Lines 9

    Extended Lines 10

    Padding 10

    Comments and Blank Lines 10

    Contents iii

  • 7/28/2019 Fortran 77 Version 5.0

    4/372

    Directives 11

    2. Data Types and Data Items 13

    Types 13

    Rules for Data Typing 13

    Array Elements 14

    Functions 14Properties of Data Types 15

    Size and Alignment of Data Types 20

    Constants 24

    Character Constants 24

    Complex Constants 27

    COMPLEX*16 Constants 27

    COMPLEX*32 (Quad Complex) Constants 27

    Integer Constants 28

    Logical Constants 29

    Real Constants 29

    REAL*8 (Double-Precision Real) Constants 31

    REAL*16 (Quad Real) Constants 32

    Typeless Constants (Binary, Octal, Hexadecimal) 32

    Fortran 90-Style Constants @ 36

    Variables 36

    Arrays 37

    Array Declarators 37

    Array Names with No Subscripts 40

    Array Subscripts 40

    Array Ordering 42

    Substrings 43

    Structures 45

    iv FORTRAN 77 Language Reference Revision A, February 1999

  • 7/28/2019 Fortran 77 Version 5.0

    5/372

    Syntax 45

    Field Declaration 45

    Rules and Restrictions for Structures 46

    Rules and Restrictions for Fields 46

    Record Declaration 47

    Record and Field Reference 48Substructure Declaration 49

    Unions and Maps 50

    Pointers 52

    Syntax Rules 52

    Usage of Pointers 53

    Address and Memory 53

    Optimization and Pointers 55

    3. Expressions 59

    Expressions, Operators, and Operands 59

    Arithmetic Expressions 60

    Basic Arithmetic Expressions 61

    Mixed Mode 62

    Arithmetic Assignment 65

    Character Expressions 66

    Character String Assignment 67

    Rules of Assignment 69

    Logical Expressions 69

    Relational Operator 72

    Constant Expressions 73

    Record Assignment 74

    Evaluation of Expressions 75

    4. Statements 77

    Contents v

  • 7/28/2019 Fortran 77 Version 5.0

    6/372

    ACCEPT 77

    Description 78

    ASSIGN 78

    Description 78

    Restrictions 78

    Examples 79Assignment 79

    Description 80

    Examples 82

    AUTOMATIC 84

    Description 84

    Restrictions 84

    Examples 85

    Restrictions 85

    BACKSPACE 85

    Description 86

    Examples 86

    BLOCK DATA 87

    Description 87

    Restrictions 88

    Example 88

    BYTE 88

    Description 89

    Example 89

    CALL 89

    Description 89

    Examples 91

    CHARACTER 92

    vi FORTRAN 77 Language Reference Revision A, February 1999

  • 7/28/2019 Fortran 77 Version 5.0

    7/372

    Description 93

    Examples 93

    CLOSE 95

    Description 95

    Comments 96

    Examples 96COMMON 97

    Description 97

    Restrictions 97

    Examples 98

    COMPLEX 98

    Description 99

    Comments 100

    Examples 100

    CONTINUE 101

    Description 101

    Example 101

    DATA 102

    Description 102

    Examples 104

    DECODE/ENCODE 105

    Description 105

    Example 106

    DIMENSION 107

    Description 107

    Examples 108

    DO 109

    Description 110

    Contents vii

  • 7/28/2019 Fortran 77 Version 5.0

    8/372

    Restrictions 112

    Comments 112

    Examples 112

    DO WHILE 113

    Description 114

    Restrictions 115Comments 115

    Examples 116

    DOUBLE COMPLEX 116

    Description 116

    Comments 117

    DOUBLE PRECISION 117

    Description 118

    Example 118

    ELSE 118

    Description 119

    Restrictions 119

    Examples 119

    ELSE IF 120

    Description 120

    Restrictions 121

    Example 121

    ENCODE/DECODE 121

    Description 122

    Example 122

    END 122

    Description 122

    Example 123

    viii FORTRAN 77 Language Reference Revision A, February 1999

  • 7/28/2019 Fortran 77 Version 5.0

    9/372

    END DO 123

    Description 123

    Examples 123

    END FILE 124

    Description 124

    Restrictions 125Examples 125

    END IF 125

    Description 126

    Examples 126

    END MAP 126

    Description 126

    Restrictions 126

    Example 127

    END STRUCTURE 127

    Description 127

    Example 127

    END UNION 127

    Description 128

    Exa

Recommended

View more >