Fortran Programmer's Guide

Fortran Programmer's Guide

Fortran Programmer’s Guide Fortran 77 4.2 Fortran 90 1.2 SunSoft, Inc. A Sun Microsystems, Inc. Business 2550 Garcia Avenue Mountain View, CA 94043 USA 415 960-1300 fax 415 969-9131 Part No.: 802-5664-10 Revision A, December 1996 Copyright 1996 Sun Microsystems, Inc., 2550 Garcia Avenue, Mountain View, California 94043-1100 U.S.A. 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 written authorization 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 other countries and is exclusively licensed by X/Open Company Ltd. Third-party software, including font technology in this product, is protected by copyright and licensed from Sun’s suppliers. RESTRICTED RIGHTS: Use, duplication, or disclosure by the U.S. Government is subject to restrictions of FAR 52.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, Solaris, SunSoft, Sun WorkShop, Sun Performance WorkShop and Sun Performance Library are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the United States and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK® and Sun™ Graphical User Interfaces were developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs and otherwise comply with Sun’s written license agreements. f90 IS DERIVED FROM CRAY CF90™, A PRODUCT OF CRAY RESEARCH, INC. 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, OR NON-INFRINGEMENT. Please Recycle Contents Preface . xiii 1. Introduction . 1 Standards Conformance. 1 Features of the Fortran Compilers . 2 Related Sun Documentation . 3 2. Fortran Input/Output . 5 Accessing Files From Fortran 77 Programs . 5 Accessing Named Files . 5 Opening Files Without a Name. 7 Preconnected Units. 7 Opening Files Without an OPEN Statement . 8 Passing File Names to Programs. 9 VAX / VMS Logical File Names (f77 Only) . 12 Direct I/O. 13 Internal Files . 15 Contents iii Tape I/O . 17 Using TOPEN Routines . 17 Fortran Formatted I/O for Tape . 17 Fortran Unformatted I/O for Tape . 17 Tape File Representation . 18 End-of-File . 18 Using Multifile Tapes . 19 Fortran 90 I/O Considerations . 19 3. Program Development . 21 Facilitating Program Builds With the make Utility. 21 The makefile. 21 make Command . 23 Macros . 23 Overriding of Macro Values . 24 Suffix Rules in make . 25 More Information . 25 Version Tracking and Control With SCCS . 26 Controlling Files With SCCS . 26 Checking Files Out and In . 28 More Information . 29 4. Libraries . 31 Understanding Libraries . 31 Advantages of Libraries. 32 Linker Debugging Options . 32 iv Fortran Programmer’s Guide Generating a Load Map . 32 Listing Other Information . 33 Consistent Compiling and Linking . 34 Library Search Paths and Order . 35 Search Order for Standard Library Paths. 35 Library Search Path and Order — Static Linking . 36 Library Search Path and Order — Dynamic Linking . 37 Creating Static Libraries. 39 Tradeoffs . 39 Creation of a Simple Static Library . 40 Creating Dynamic Libraries. 44 Tradeoffs . 44 Position-Independent Code and –pic. 45 Binding Options . 45 Naming Conventions . 46 A Simple Dynamic Library . 46 Libraries Provided with Sun Fortran Compilers. 48 Shippable Libraries . 50 5. Program Analysis and Debugging. 51 Global Program Checking (f77 Only) . 51 GPC Overview . 52 How to Invoke Global Program Checking . 53 Some Examples of -Xlist and Global Program Checking . 55 Suboptions for Global Checking Across Routines . 59 Contents v –Xlist Suboption Reference . 61 Some Examples Using Suboptions . 65 Special Compiler Options . 67 Subscript Bounds (–C) . 67 Undeclared Variable Types (–u) . 67 Version Checking (–V) . 68 Interactive Debugging With dbx and The WorkShop . 68 Debugging Optimized Programs . 69 Viewing Compiler Listing Diagnostics. 69 6. Floating-Point Arithmetic . 71 Introduction . 71 IEEE Floating-Point Arithmetic. 72 Handling Exceptions . 74 Trapping a Floating-Point Exception–f77 vs f90 . 74 IEEE Routines . 74 Flags and ieee_flags() . 75 IEEE Extreme Value Functions . 79 Exception Handlers and ieee_handler() . 80 Retrospective Summary . 86 SPARC: Nonstandard Arithmetic . 86 –ftrap=mode Compiler Options. 87 Floating-Point Exceptions–f77 vs f90 . 88 Debugging IEEE Exceptions . 88 Further Numerical Adventures. 91 vi Fortran Programmer’s Guide Simple Underflow. 92 Continuing With the Wrong Answer . 92 Excessive Underflow (SPARC Only) . 93 Porting from Scientific Mainframes . 94 7. Porting. 95 Time Functions . 95 Formats. 98 Carriage-Control . 98 Working With Files . 99 Data Representation . ..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    223 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us