Fortran 90 Programmer's Reference

Total Page:16

File Type:pdf, Size:1020Kb

Fortran 90 Programmer's Reference Fortran 90 Programmer’s Reference First Edition Product Number: B3909DB Fortran 90 Compiler for HP-UX Document Number: B3908-90002 October 1998 Edition: First Document Number: B3908-90002 Remarks: Released October 1998. Initial release. Notice Copyright Hewlett-Packard Company 1998. All Rights Reserved. Reproduction, adaptation, or translation without prior written permission is prohibited, except as allowed under the copyright laws. The information contained in this document is subject to change without notice. Hewlett-Packard makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. Hewlett-Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance or use of this material. Contents Preface . xix New in HP Fortran 90 V2.0. .xx Scope. xxi Notational conventions . xxii Command syntax . xxiii Associated documents . xxiv 1 Introduction to HP Fortran 90 . 1 HP Fortran 90 features . .2 Source format . .2 Data types . .2 Pointers . .3 Arrays . .3 Control constructs . .3 Operators . .4 Procedures. .4 Modules . .5 I/O features . .5 Intrinsics . .6 2 Language elements . 7 Character set . .8 Lexical tokens . .9 Names. .9 Program structure . .10 Statement labels . .10 Statements . .11 Source format of program file . .13 Free source form . .13 Source lines . .14 Statement labels . .14 Spaces . .14 Comments . .15 Statement continuation . .15 Fixed source form . .16 Spaces . .16 Source lines . .16 Table of Contents i INCLUDE line . 19 3 Data types and data objects . 21 Intrinsic data types . 22 Type declaration for intrinsic types . 24 Implicit typing. 28 Constants. 29 Integer constants . 29 BOZ constants . 30 Hollerith constants . 30 Typeless constants . 31 Real constants . 33 Complex constants. 34 Character constants. 34 Logical constants . 35 Character substrings . 36 Character strings as automatic data objects . 37 Derived types . 39 Defining a derived type. 40 Sequence derived type . 41 Structure component. 41 Declaring a derived type-object . 43 Structure constructor . 43 Alignment of derived-type objects . 44 A derived-type example . 45 Pointers . 47 Pointer association status. 48 A pointer example . 49 4 Arrays . 51 Array fundamentals . 52 Array declarations . 54 Explicit-shape arrays . 55 Assumed-shape arrays . 56 Deferred-shape arrays . 58 Array pointers . 59 Allocatable arrays . 59 Assumed-size arrays . 61 Array sections. 63 Subscript triplet . 64 Vector subscripts . 65 Array-valued structure component references . 68 Array constructors . 71 ii Table of Contents Array expressions . ..
Recommended publications
  • Cognitive Programming Language (CPL) Programmer's Guide
    Cognitive Programming Language (CPL) Programmer's Guide 105-008-02 Revision C2 – 3/17/2006 *105-008-02* Copyright © 2006, Cognitive. Cognitive™, Cxi™, and Ci™ are trademarks of Cognitive. Microsoft® and Windows™ are trademarks of Microsoft Corporation. Other product and corporate names used in this document may be trademarks or registered trademarks of other companies, and are used only for explanation and to their owner’s benefit, without intent to infringe. All information in this document is subject to change without notice, and does not represent a commitment on the part of Cognitive. No part of this document may be reproduced for any reason or in any form, including electronic storage and retrieval, without the express permission of Cognitive. All program listings in this document are copyrighted and are the property of Cognitive and are provided without warranty. To contact Cognitive: Cognitive Solutions, Inc. 4403 Table Mountain Drive Suite A Golden, CO 80403 E-Mail: [email protected] Telephone: +1.800.525.2785 Fax: +1.303.273.1414 Table of Contents Introduction.............................................................................................. 1 Label Format Organization .................................................................. 2 Command Syntax................................................................................ 2 Important Programming Rules............................................................. 3 Related Publications...........................................................................
    [Show full text]
  • A Compiler for a Simple Language. V0.16
    Project step 1 – a compiler for a simple language. v0.16 Change log: v0.16, changes from 0.15 Make all push types in compiler actions explicit. Simplified and better documentation of call and callr instruction compiler actions. Let the print statement print characters and numbers. Added a printv statement to print variables. Changed compiler actions for retr to push a variable value, not a literal value. Changes are shown in orange. v0.15, changes from 0.14 Change compiler actions for ret, retr, jmp. Change the description and compiler actions for poke. Change the description for swp. Change the compiler actions for call and callr. Changes shown in green. v0.14, changes from 0.13 Add peek, poke and swp instructions. Change popm compiler actions. Change callr compiler actions. Other small changes to wording. Changes are shown in blue. v0.13, changes from 0.12 Add a count field to subr, call and callr to simplify code generation. Changes are shown in red. v0.12 Changes from 0.11. Added a callr statement that takes a return type. Fix the generated code for this and for call to allow arguments to be pushed by the call. Add a retr that returns a value and update the reg. v0.11: changes from 0.10. Put typing into push operators. Put opcodes for compare operators. fix actions for call. Make declarations reserve a stack location. Remove redundant store instruction (popv does the same thing.) v0.10: changes from 0.0. Comparison operators (cmpe, cmplt, cmpgt) added. jump conditional (jmpc) added. bytecode values added.
    [Show full text]
  • Programming Basics - FORTRAN 77
    CWCS Workshop May 2005 Programming Basics - FORTRAN 77 http://www.physics.nau.edu/~bowman/PHY520/F77tutor/tutorial_77.html Program Organization A FORTRAN program is just a sequence of lines of plain text. This is called the source code. The text has to follow certain rules (syntax) to be a valid FORTRAN program. We start by looking at a simple example: program circle real r, area, pi c This program reads a real number r and prints c the area of a circle with radius r. write (*,*) 'Give radius r:' read (*,*) r pi = atan(1.0e0)*4.0e0 area = pi*r*r write (*,*) 'Area = ', area end A FORTRAN program generally consists of a main program and possibly several subprograms (i.e., functions or subroutines). The structure of a main program is: program name declarations statements end Note: Words that are in italics should not be taken as literal text, but rather as a description of what belongs in their place. FORTRAN is not case-sensitive, so "X" and "x" are the same variable. Blank spaces are ignored in Fortran 77. If you remove all blanks in a Fortran 77 program, the program is still acceptable to a compiler but almost unreadable to humans. Column position rules Fortran 77 is not a free-format language, but has a very strict set of rules for how the source code should be formatted. The most important rules are the column position rules: Col. 1: Blank, or a "c" or "*" for comments Col. 1-5: Blank or statement label Col. 6: Blank or a "+" for continuation of previous line Col.
    [Show full text]
  • Control Flow Graphs • Can Be Done at High Level Or Low Level – E.G., Constant Folding
    Optimizations • Code transformations to improve program – Mainly: improve execution time – Also: reduce program size Control Flow Graphs • Can be done at high level or low level – E.g., constant folding • Optimizations must be safe – Execution of transformed code must yield same results as the original code for all possible executions 1 2 Optimization Safety Optimization Safety • Safety of code transformations usually requires certain • Safety of code transformations usually requires certain information that may not be explicit in the code information which may not explicit in the code • Example: dead code elimination • Example: dead code elimination (1) x = y + 1; (1) x = y + 1; (2) y = 2 * z; (2) y = 2 * z; (3) x=y+z;x = y + z; (3) x=y+z;x = y + z; (4) z = 1; (4) z = 1; (5) z = x; (5) z = x; • What statements are dead and can be removed? • Need to know whether values assigned to x at (1) is never used later (i.e., x is dead at statement (1)) – Obvious for this simple example (with no control flow) – Not obvious for complex flow of control 3 4 1 Dead Variable Example Dead Variable Example • Add control flow to example: • Add control flow to example: x = y + 1; x = y + 1; y = 2 * z; y = 2 * z; if (d) x = y+z; if (d) x = y+z; z = 1; z = 1; z = x; z = x; • Statement x = y+1 is not dead code! • Is ‘x = y+1’ dead code? Is ‘z = 1’ dead code? •On some executions, value is used later 5 6 Dead Variable Example Dead Variable Example • Add more control flow: • Add more control flow: while (c) { while (c) { x = y + 1; x = y + 1; y = 2 * z; y = 2
    [Show full text]
  • FORTRAN 77 Language Reference
    FORTRAN 77 Language Reference FORTRAN 77 Version 5.0 901 San Antonio Road Palo Alto, , CA 94303-4900 USA 650 960-1300 fax 650 969-9131 Part No: 805-4939 Revision A, February 1999 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 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 in 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, SunDocs, SunExpress, Solaris, Sun Performance Library, Sun Performance WorkShop, Sun Visual WorkShop, Sun WorkShop, and Sun WorkShop Professional are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and in other countries.
    [Show full text]
  • Dynamic Security Labels and Noninterference
    Dynamic Security Labels and Noninterference Lantian Zheng Andrew C. Myers Computer Science Department Cornell University {zlt,andru}@cs.cornell.edu Abstract This paper explores information flow control in systems in which the security classes of data can vary dynamically. Information flow policies provide the means to express strong security requirements for data confidentiality and integrity. Recent work on security-typed programming languages has shown that information flow can be analyzed statically, ensuring that programs will respect the restrictions placed on data. However, real computing systems have security policies that vary dynamically and that cannot be determined at the time of program analysis. For example, a file has associated access permissions that cannot be known with certainty until it is opened. Although one security-typed programming lan- guage has included support for dynamic security labels, there has been no examination of whether such a mechanism can securely control information flow. In this paper, we present an expressive language- based mechanism for securely manipulating dynamic security labels. The mechanism is presented both in the context of a Java-like programming language and, more formally, in a core language based on the typed lambda calculus. This core language is expressive enough to encode previous dynamic label mechanisms; as importantly, any well-typed program is provably secure because it satisfies noninterfer- ence. 1 Introduction Information flow control protects information security by constraining how information is transmitted among objects and users of various security classes. These security classes are expressed as labels associated with the information or its containers. Dynamic labels, labels that can be manipulated and checked at run time, are vital for modeling real systems in which security policies may be changed dynamically.
    [Show full text]
  • X86 Assembly Language Reference Manual
    x86 Assembly Language Reference Manual Part No: 817–5477–11 March 2010 Copyright ©2010 Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related software documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are “commercial computer software” or “commercial technical data” pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms setforth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065.
    [Show full text]
  • C Programming Tutorial
    C Programming Tutorial C PROGRAMMING TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i COPYRIGHT & DISCLAIMER NOTICE All the content and graphics on this tutorial are the property of tutorialspoint.com. Any content from tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws. This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the accuracy of the site or its contents including this tutorial. If you discover that the tutorialspoint.com site or this tutorial content contains some errors, please contact us at [email protected] ii Table of Contents C Language Overview .............................................................. 1 Facts about C ............................................................................................... 1 Why to use C ? ............................................................................................. 2 C Programs .................................................................................................. 2 C Environment Setup ............................................................... 3 Text Editor ................................................................................................... 3 The C Compiler ............................................................................................ 3 Installation on Unix/Linux ............................................................................
    [Show full text]
  • Full Speed Ahead with COBOL Into the Future
    Full Speed Ahead with COBOL Into the Future Speaker Name: Tom Ross IBM February 4, 2013 Session Number: 12334 Disclaimer IBM’s statements regarding its plans, directions, and intent are subject to change or withdrawal without notice at IBM’s sole discretion. Information regarding potential future products is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information mentioned regarding potential future products is not a commitment, promise, or legal obligation to deliver any material, code or functionality. Information about potential future products may not be incorporated into any contract. The development, release, and timing of any future features or functionality described for our products remains at our sole discretion. Agenda • COBOL and Java and … DB2! • COBOL development team in IBM • What are we up to these days? COBOL and Java and … DB2 COBOL and Java and … DB2 • COBOL and Java interoperability shipped in 2001 • As users started using these features they tried to use these applications in more complex environments (IE: More components/subsystems such as DB2) • Java has a different model for connecting to DB2 then 'traditional' z/OS programs • JDBC rather than CALL attach • type-2 z/OS connectivity or type-4 z/OS connectivity • When COBOL and Java were mixed, they ran as a single application, but got 2 separate connections to DB2 • Either COBOL or Java could fail without the other part of the application failing COBOL and Java and … DB2 • What are users finding when using the type-2 z/OS connectivity with mixed COBOL, Java and SQL? • We are using Enterprise COBOL from a batch job and trying to call a Java program that uses DB2.
    [Show full text]
  • Labelled Λ-Calculi with Explicit Copy and Erase
    Labelled λ-calculi with Explicit Copy and Erase Maribel Fern´andez, Nikolaos Siafakas King’s College London, Dept. Computer Science, Strand, London WC2R 2LS, UK [maribel.fernandez, nikolaos.siafakas]@kcl.ac.uk We present two rewriting systems that define labelled explicit substitution λ-calculi. Our work is motivated by the close correspondence between L´evy’s labelled λ-calculus and paths in proof-nets, which played an important role in the understanding of the Geometry of Interaction. The structure of the labels in L´evy’s labelled λ-calculus relates to the multiplicative information of paths; the novelty of our work is that we design labelled explicit substitution calculi that also keep track of exponential information present in call-by-value and call-by-name translations of the λ-calculus into linear logic proof-nets. 1 Introduction Labelled λ-calculi have been used for a variety of applications, for instance, as a technology to keep track of residuals of redexes [6], and in the context of optimal reduction, using L´evy’s labels [14]. In L´evy’s work, labels give information about the history of redex creation, which allows the identification and classification of copied β-redexes. A different point of view is proposed in [4], where it is shown that a label is actually encoding a path in the syntax tree of a λ-term. This established a tight correspondence between the labelled λ-calculus and the Geometry of Interaction interpretation of cut elimination in linear logic proof-nets [13]. Inspired by L´evy’s labelled λ-calculus, we define labelled λ-calculi where the labels attached to terms capture reduction traces.
    [Show full text]
  • Programming in C Computer Science
    Programming in C Computer Science Mr. P Raghavender Reddy M.Sc, M.Tech Govt. College for Men (A), Kadapa Email. Id : [email protected] Contents What is an Variable? Where Variables are Declared? What is Scope of a Variable? Types of Scopes Example Programs Learning Objects Understand the need of a variable in a program Know the different regions in a program for declaring a variable Understand the accessibility or visibility region of a variable in a program Declare the variables in different place based their use of region What is a Variable? Variable is a named memory location that have a type Before using a variable for computation, it has to be . Declare – name an object (gives a symbolic name) . Define – create an object (allocate memory) . Initialize – assign data or store data With one exception (extern variable), a variable is declared and defined at the same time. Single syntax for declaration and definition of a variable. Creation of Variable Syntax for Variable Declaration & Definition Data_Type Variable_List ; Examples: char code; int roll_no; double area, side; Syntax for Variable Initialization Variable_name = Expression ; Examples: code = ‘B’; roll_no = 532; area = side*side; Syntax for Variable Declaration, Definition & Initialization Data_Type Variable_name = Expression ; Examples: char code = ‘B’; double area, side=10.5; Creation of Variable Data Type Name of a Variable . Memory Size . An identifier . Range of Values Name of Location . Set of Operations Declaration Value code char code = ‘B’ ; B Initialization
    [Show full text]
  • The C-- Language Reference Manual
    The C-- Language Reference Manual Simon Peyton Jones Thomas Nordin Dino Oliva Pablo Nogueira Iglesias April 23, 1998 Contents 1 Introduction 3 2 Syntax definition 3 2.1 General ......................................... 3 2.2 Comments........................................ 6 2.3 Names.......................................... 6 2.4 Namescope....................................... 6 2.5 The import and export declarations ........................ 6 2.6 Constants ....................................... 7 2.6.1 Integer and floating point numbers . ...... 7 2.6.2 Characters and strings . ... 7 3 Fundamental concepts in C-- 7 3.1 Memory......................................... 7 3.2 Datasegment ..................................... 8 3.3 Codesegment..................................... 8 3.4 Types .......................................... 8 3.5 Local variables (or registers) . ......... 8 3.6 Addresses ....................................... 9 3.7 Names.......................................... 9 3.8 Foreign language interface . ....... 9 4 Data layout directives 9 4.1 Labels.......................................... 10 4.2 Initialisation.................................. ..... 10 4.3 Alignment....................................... 12 1 5 Procedures 12 5.1 Proceduredefinition..... ...... ..... ...... ...... .. ..... 12 5.2 Statements...................................... 13 5.2.1 skip; ..................................... 13 5.2.2 Declaration ................................... 13 5.2.3 Assignment................................... 13 5.2.4
    [Show full text]