DEC Ada Run-Time Reference Manual for OpenVMS Systems

*HyperReader

CONTENTS

  Title Page

  Copyright Page

  Preface

  New and Changed Features

  1      Object Representation and Storage
    1.1 Type and Object Representations
      1.1.1      Enumeration Types and Objects
      1.1.2      Integer Types and Objects
      1.1.3      Floating-Point Types and Objects
        1.1.3.1      Pragma FLOAT_REPRESENTATION
        1.1.3.2      Pragma LONG_FLOAT
      1.1.4      Fixed-Point Types and Objects
      1.1.5      Array Types and Objects
      1.1.6      Record Types and Objects
      1.1.7      Access Types and Objects
      1.1.8      Address Types and Objects
      1.1.9      Task Types and Objects
    1.2 Data Optimization
      1.2.1      Pragma PACK
      1.2.2      Pragma COMPONENT_ALIGNMENT
      1.2.3      Length Representation Clauses
      1.2.4      Enumeration Representation Clauses
      1.2.5      Record Representation Clauses
      1.2.6      Alignment Clauses
      1.2.7      Address Clauses
    1.3 Determining the Sizes of Types and Objects
    1.4 Storage Allocation and Deallocation
      1.4.1      Storage Allocation
      1.4.2      Storage Deallocation

  2      Input-Output Facilities
    2.1 Files and File Access
      2.1.1      Ada Sequential Files
      2.1.2      Ada Direct Files
      2.1.3      Ada Relative Files
      2.1.4      Ada Indexed Files
      2.1.5      Ada Text Files
    2.2 Naming External Files
      2.2.1      File Specification Syntax
      2.2.2      Logical Names
    2.3 Specifying External File Attributes
      2.3.1      The OpenVMS File Definition Language (FDL): Primary and Secondary Attributes
      2.3.2      Creation-Time and Run-Time Attributes
      2.3.3      Default External File Attributes
    2.4 File Sharing
    2.5 Record Locking
    2.6 Binary Input-Output
      2.6.1      Sequential File Input-Output
      2.6.2      Direct File Input-Output
      2.6.3      Relative File Input-Output
      2.6.4      Indexed File Input-Output
    2.7 Text Input-Output
      2.7.1      Using the Package TEXT_IO for Terminal Input-Output
        2.7.1.1      Line-Oriented Method
        2.7.1.2      Data-Oriented Method
        2.7.1.3      Mixed Method
        2.7.1.4      Flexible Method
      2.7.2      Line Terminators, Page Terminators, and File Terminators
      2.7.3      Text Input-Output Buffering
      2.7.4      TEXT_IO Carriage Control
      2.7.5      Predefined Instantiations of TEXT_IO Packages
    2.8 Input-Output and Exception Handling
    2.9 Input-Output and Tasking

  3      Exception Handling
    3.1 Relationship Between Ada Exception Handling and OpenVMS Condition Handling
      3.1.1      Naming and Encoding Ada Exceptions
      3.1.2      Copying Exception Signal Arguments
      3.1.3      The Matching of Ada Exceptions and System-Defined Conditions
    3.2 Making the Best Use of Ada Exception Handling
    3.3 Suppressing Checks
    3.4 Mixed-Language Exception Handling
      3.4.1      Importing Exceptions
      3.4.2      Exporting Exceptions
      3.4.3      The Exception Choice NON_ADA_ERROR
      3.4.4      Signaling OpenVMS Conditions
      3.4.5      Effects of Handling OpenVMS Conditions from an Ada Program
      3.4.6      Fault Handlers (VAX Systems Only)
    3.5 Exceptions and Tasking

  4      Mixed-Language Programming
    4.1 Calling External Routines from Ada Subprograms
    4.2 Calling Ada Subprograms from External Routines
    4.3 Controlling the Passing Mechanisms for Imported and Exported Subprogram Parameters and Function Results
      4.3.1      Using the MECHANISM and RESULT_MECHANISM Options
      4.3.2      Working with Imported Routine Parameters or Function Results for Which There Are No Defaults
      4.3.3      DEC Ada Equivalents for OpenVMS Data Types
    4.4 Ada Conventions for Passing Parameters and Returning Function Results in Mixed-Language Programs
      4.4.1      Ada Semantics
      4.4.2      DEC Ada Linkage Conventions
    4.5 Sharing Data with Non-Ada Routines
      4.5.1      Data Layout and Alignment in Mixed-Language Programs
      4.5.2      Importing and Exporting Objects
      4.5.3      Sharing Common Storage Areas for Objects
    4.6 Mixing C and Ada Code
    4.7 Mixing Fortran and Ada Code

  5      Calling System or Other Callable Routines
    5.1 Using the DEC Ada OpenVMS System-Routine Packages
      5.1.1      Parameter Types
      5.1.2      Parameter-Passing Mechanisms
      5.1.3      Naming Conventions
      5.1.4      Record Type Declarations
      5.1.5      Default and Optional Parameters
      5.1.6      Calling Asynchronous System Services
      5.1.7      Calling Mathematical Routines
    5.2 Writing Your Own Routine Interfaces
      5.2.1      Parameter Types
      5.2.2      Determining the Kind of Call
      5.2.3      Determining the Access Method
      5.2.4      Passing Parameters
      5.2.5      Passing Routines or Subprograms as Parameters
      5.2.6      Default and Optional Parameters
    5.3 Obtaining Symbol Definitions
    5.4 Testing Return Condition Values
    5.5 OpenVMS Routine Examples

  6      Using CDD/Repository from DEC Ada
    6.1 Using the DEC Ada-from-CDD Translator Utility
    6.2 Equivalent DEC Ada and CDDL Data Types
    6.3 Example of Using the Ada-from-CDD Translator

  7      Tasking
    7.1 Introduction to Using Ada Tasks on the OpenVMS Operating System
    7.2 Task Storage Allocation
      7.2.1      Storage Created for a Task Object-The Task Control Block
      7.2.2      Storage Created for a Task Activation-The Task Stack
        7.2.2.1      Controlling the Stack Sizes of Task Objects
        7.2.2.2      Controlling the Size of a Main Task Stack (VAX Systems Only)
      7.2.3      Stack Overflow and Non-Ada Code
    7.3 Task Switching and Scheduling
      7.3.1      Controlling Task Priorities
      7.3.2      Using Time Slicing
    7.4 Special Tasking Considerations
      7.4.1      Passive Tasks
        7.4.1.1      Passive Tasks and Rendezvous
        7.4.1.2      Pragma PASSIVE
      7.4.2      Deadlock
      7.4.3      Busy Waiting and Non-Ada Code
      7.4.4      Tentative Rendezvous
      7.4.5      Using Delay Statements
      7.4.6      Using Abort Statements
      7.4.7      Interrupting Your Program with Ctrl/Y
      7.4.8      Using Shared Variables
      7.4.9      Reentrancy
        7.4.9.1      Coding Reentrant Ada Subprograms
        7.4.9.2      Ensuring that Nonreentrant Routines are Called by One Task at a Time
        7.4.9.3      Serializing Calls to Nonreentrant Code
    7.5 Calling OpenVMS System Service Routines from Tasks
      7.5.1      Effects of System Service Calls on Tasks
      7.5.2      System Services Requiring Special Care
    7.6 Calling DECthreads Routines from Tasks (Alpha Systems Only)
    7.7 Handling Asynchronous System Traps (ASTs)
      7.7.1      The Pragma AST_ENTRY and the AST_ENTRY Attribute
      7.7.2      Constraints on Handling ASTs
      7.7.3      Calling Ada Subprograms from Non-Ada AST Service Routines
      7.7.4      Examples of Handling ASTs from Ada Programs
    7.8 Measuring and Tuning Tasking Performance

  8      Improving Run-Time Performance
    8.1 Compiler Optimizations
    8.2 Using the Pragma INLINE
      8.2.1      Explicit Use
      8.2.2      Implicit Use
      8.2.3      Pragma INLINE Examples
        8.2.3.1      Inline Expansion of Subprogram Specifications and Bodies
        8.2.3.2      Inline Expansion of Generic Subprograms
    8.3 Making Use of Generics
      8.3.1      Using the Pragma INLINE_GENERIC
      8.3.2      Using the Pragma SHARE_GENERIC
      8.3.3      Library-Level Generic Instantiations
    8.4 Techniques for Reducing CPU Time and Elapsed Time
      8.4.1      Decreasing the CPU Time of a DEC Ada Program
        8.4.1.1      Eliminating Run-Time Checks
        8.4.1.2      Reducing Function and Procedure Call Costs
        8.4.1.3      Using Scalar Variables and Avoiding Expensive Operations on Composite Types
      8.4.2      Decreasing the Elapsed Time of a DEC Ada Program
        8.4.2.1      Controlling Paging Behavior
        8.4.2.2      Improving Input-Output Behavior
        8.4.2.3      Overlapping Unrelated Input-Output and Instruction Execution

  9      Additional Programming Considerations
    9.1 Working with Address Values
    9.2 Unchecked Conversion of Access Types
    9.3 Using Low-Level System Features
      9.3.1      The VAX Device and Processor Register and Interlocked Operations (VAX Systems Only)
      9.3.2      Unsigned Types in the Package SYSTEM
    9.4 Working with Varying Strings
    9.5 Assigning Array Values
    9.6 Sharing Memory Between CPUs

  A DEC Ada Predefined Instantiations

  B Implementation Details Related to Mixed-Language Programs on OpenVMS Systems
    B.1 Constrainedness Bits
    B.2 Area Control Block
    B.3 Descriptors
      B.3.1     UBS Descriptor
      B.3.2     UBSB Descriptor
      B.3.3     UBA Descriptor
      B.3.4     S Descriptor
      B.3.5     SB Descriptor
      B.3.6     A Descriptor
      B.3.7     NCA Descriptor
      B.3.8     Passing Parameters by Descriptor to Exported Subprograms

  C DEC Ada Packages