VAX Pascal Reference Manual

*HyperReader

  CONTENTS

  Title Page

  Copyright Page

  Preface

  New and Changed Features

  1      Language Elements

  1.1     Pascal Language Standards
    1.1.1      Unextended Pascal Standards
    1.1.2      Extended Pascal Standard

  1.2     Lexical Elements
    1.2.1      Character Set
    1.2.2      Special Symbols
    1.2.3      Reserved Words
    1.2.4      Identifiers

  1.3     Comments

  1.4     Page Breaks and Form Feeds

  2      Data Types and Values

  2.1     Ordinal Types
    2.1.1      INTEGER Type
    2.1.2      UNSIGNED Type
    2.1.3      CHAR Type
    2.1.4      BOOLEAN Type
    2.1.5      Enumerated Types
    2.1.6      Subrange Types

  2.2     Real Types

  2.3     Pointer Type

  2.4     Structured Types
    2.4.1      ARRAY Types
      2.4.1.1      Array Constructors
    2.4.2      RECORD Types
      2.4.2.1      Records with Variants
      2.4.2.2      Record Constructors
    2.4.3      SET Type
      2.4.3.1      Set Constructors
    2.4.4      FILE Type
    2.4.5      Nonstandard Constructors
      2.4.5.1      Nonstandard Array Constructors
      2.4.5.2      Nonstandard Record Constructors

  2.5     Schema Types

  2.6     String Types
    2.6.1      PACKED ARRAY OF CHAR Types
    2.6.2      VARYING OF CHAR Types
    2.6.3      STRING Schema Type

  2.7     Predefined Structured and Schema Types
    2.7.1      TEXT Type
    2.7.2      TIMESTAMP Type

  2.8     Static and Nonstatic Types

  2.9     Type Compatibility
    2.9.1      Structural Compatibility
    2.9.2      Assignment Compatibility

  3      The Declaration Section

  3.1     The CONST Section

  3.2     The LABEL Section

  3.3     The TO BEGIN DO Section

  3.4     The TO END DO Section

  3.5     The TYPE Section

  3.6     The VALUE Section

  3.7     The VAR Section

  4      Expressions and Operators

  4.1     Expressions

  4.2     Operators
    4.2.1      Arithmetic Operators
    4.2.2      Relational Operators
    4.2.3      Logical Operators
    4.2.4      String Operators
    4.2.5      Set Operators
    4.2.6      Type Cast Operator
    4.2.7      Precedence of Operators

  4.3     Type Conversions

  5      Statements

  5.1     Assignment Statement

  5.2     CASE Statement

  5.3     Compound Statement

  5.4     Empty Statement

  5.5     FOR Statement

  5.6     GOTO Statement

  5.7     IF Statement

  5.8     Procedure Call

  5.9     REPEAT Statement

  5.10    WHILE Statement

  5.11    WITH Statement

  6      Procedures and Functions

  6.1     Routine Declarations

  6.2     Routine Calls

  6.3     Parameters
    6.3.1      Value Parameters
    6.3.2      Variable Parameters
    6.3.3      Routine Parameters
    6.3.4      Foreign Parameters
    6.3.5      Schema Parameters
      6.3.5.1      Schema Parameter Sections
    6.3.6      Conformant Parameters
      6.3.6.1      Conformant Array Parameters
      6.3.6.2      Conformant VARYING Parameter
      6.3.6.3      Conformant Parameter Sections
    6.3.7      Parameter Association
    6.3.8      Default Formal Parameters

  7      Program Structure and Scope

  7.1     Blocks

  7.2     Scope of Identifiers

  7.3     Modules and Programs
    7.3.1      Compilation Units and Data Sharing
      7.3.1.1      Environment Files
      7.3.1.2      Global and External Identifiers

  8      Predeclared Routines

  8.1     ABS Function

  8.2     ADD_INTERLOCKED Function

  8.3     ADDRESS Function

  8.4     ARCTAN Function

  8.5     ARGUMENT Function

  8.6     ARGUMENT_LIST_LENGTH Function

  8.7     BIN Function

  8.8     BITNEXT Function

  8.9     BIT_OFFSET Function

  8.10    BITSIZE Function

  8.11    BYTE_OFFSET Function

  8.12    CARD Function

  8.13    CHR Function

  8.14    CLEAR_INTERLOCKED Function

  8.15    CLOCK Function

  8.16    COS Function

  8.17    CREATE_DIRECTORY Procedure

  8.18    DATE and TIME Functions

  8.19    DATE and TIME Procedures

  8.20    DBLE Function

  8.21    DEC Function

  8.22    DELETE_FILE Procedure

  8.23    DISPOSE Procedure

  8.24    EQ Function

  8.25    ESTABLISH Procedure

  8.26    EXP Function

  8.27    EXPO Function

  8.28    FIND_FIRST_BIT_CLEAR Function

  8.29    FIND_FIRST_BIT_SET Function

  8.30    FIND_MEMBER Function

  8.31    FIND_NONMEMBER Function

  8.32    GE Function

  8.33    GT Function

  8.34    GETTIMESTAMP Procedure

  8.35    HALT Procedure

  8.36    HEX Function

  8.37    IADDRESS Function

  8.38    INDEX Function

  8.39    INT Function

  8.40    LE Function

  8.41    LENGTH Function

  8.42    LN Function

  8.43    LOWER Function

  8.44    LT Function

  8.45    MAX Function

  8.46    MFPR Function

  8.47    MIN Function

  8.48    MTPR Procedure

  8.49    NE Function

  8.50    NEW Procedure

  8.51    NEXT Function

  8.52    OCT Function

  8.53    ODD Function

  8.54    ORD Function

  8.55    PACK Procedure

  8.56    PAD Function

  8.57    PRED Function

  8.58    PRESENT Function

  8.59    QUAD Function

  8.60    READV Procedure

  8.61    RENAME_FILE Procedure

  8.62    REVERT Procedure

  8.63    ROUND Function

  8.64    SET_INTERLOCKED Function

  8.65    SIN Function

  8.66    SIZE Function

  8.67    SNGL Function

  8.68    SQR Function

  8.69    SQRT Function

  8.70    STATUSV Function

  8.71    SUBSTR Function

  8.72    SUCC Function

  8.73    TIME Function

  8.74    TIME Procedure

  8.75    TRUNC Function

  8.76    UAND Function

  8.77    UDEC Function

  8.78    UINT Function

  8.79    UNDEFINED Function

  8.80    UNOT Function

  8.81    UNPACK Procedure

  8.82    UOR Function

  8.83    UPPER Function

  8.84    UROUND Function

  8.85    UTRUNC Function

  8.86    UXOR Function

  8.87    WRITEV Procedure

  8.88    XOR Function

  8.89    ZERO Function

  9      Input and Output Processing

  9.1     Files and File Organizations
    9.1.1      Sequential File Organization
    9.1.2      Relative File Organization
    9.1.3      Indexed File Organization
      9.1.3.1      Keys

  9.2     Component Formats
    9.2.1      Fixed-Length Component Format
    9.2.2      Variable-Length Component Format
    9.2.3      Stream Component Format

  9.3     Component Access Modes
    9.3.1      Sequential Access
      9.3.1.1      Sequential Access to Sequential Files
      9.3.1.2      Sequential Access to Relative Files
      9.3.1.3      Sequential Access to Indexed Files
    9.3.2      Random Access
      9.3.2.1      Random Access by Relative Component Numbers (Direct Access)
      9.3.2.2      Random Access to Indexed Files (Keyed Access)

  9.4     File Locking

  9.5     TEXT Files
    9.5.1      Carriage Control
    9.5.2      Prompting on a Terminal
    9.5.3      Delayed Device Access to Text Files
    9.5.4      Writing Partial Lines to Terminals

  9.6     I/O Routines
    9.6.1      CLOSE Procedure
    9.6.2      DELETE Procedure
    9.6.3      EOF Function
    9.6.4      EOLN Function
    9.6.5      EXTEND Procedure
    9.6.6      FIND Procedure
    9.6.7      FINDK Procedure
    9.6.8      GET Procedure
    9.6.9      LINELIMIT Procedure
    9.6.10     LOCATE Procedure
    9.6.11     OPEN Procedure
    9.6.12     PAGE Procedure
    9.6.13     PUT Procedure
    9.6.14     READ Procedure
    9.6.15     READLN Procedure
    9.6.16     RESET Procedure
    9.6.17     RESETK Procedure
    9.6.18     REWRITE Procedure
    9.6.19     STATUS Function
    9.6.20     TRUNCATE Procedure
    9.6.21     UFB Function
    9.6.22     UNLOCK Procedure
    9.6.23     UPDATE Procedure
    9.6.24     WRITE Procedure
    9.6.25     WRITELN Procedure
    9.6.26     Error Processing and Formatting Output
      9.6.26.1     Error Processing Parameter
      9.6.26.2     Output with Specified Field Width
      9.6.26.3     Writing Binary, Decimal, Unsigned Decimal, Hexadecimal, and Octal Values

  10 Attributes

  10.1    Attribute Syntax

  10.2    Attributes
    10.2.1     ALIGNED
    10.2.2     ASYNCHRONOUS
    10.2.3     AT
    10.2.4     AUTOMATIC
    10.2.5     BIT
    10.2.6     BYTE
    10.2.7     CHECK
    10.2.8     CLASS_A
    10.2.9     CLASS_NCA
    10.2.10    CLASS_S
    10.2.11    COMMON
    10.2.12    ENVIRONMENT
    10.2.13    EXTERNAL
    10.2.14    G_FLOATING
    10.2.15    GLOBAL
    10.2.16    HIDDEN
    10.2.17    IDENT
    10.2.18    IMMEDIATE
    10.2.19    INHERIT
    10.2.20    INITIALIZE
    10.2.21    KEY
    10.2.22    LIST
    10.2.23    LOCAL
    10.2.24    LONG
    10.2.25    NOG_FLOATING
    10.2.26    NOOPTIMIZE
    10.2.27    OCTA
    10.2.28    OPTIMIZE
    10.2.29    OVERLAID
    10.2.30    POS
    10.2.31    PSECT
    10.2.32    QUAD
    10.2.33    READONLY
    10.2.34    REFERENCE
    10.2.35    STATIC
    10.2.36    TRUNCATE
    10.2.37    UNALIGNED
    10.2.38    UNBOUND
    10.2.39    UNSAFE
    10.2.40    VALUE
    10.2.41    VOLATILE
    10.2.42    WEAK_EXTERNAL
    10.2.43    WEAK_GLOBAL
    10.2.44    WORD
    10.2.45    WRITEONLY

  10.3    Attribute Classes

  11 Directives

  11.1    %INCLUDE Directive

  11.2    %DICTIONARY Directive

  11.3    %TITLE and %SUBTITLE Directives

  A   ASCII Character Set

  B   Language Syntax Summary

  C   Compatibility of VAX Pascal Versions

  C.1     Differences Between Version 1.0 and Subsequent Versions
    C.1.1      Decommitted Features
      C.1.1.1      Dynamic Array Parameters
      C.1.1.2      LOWER and UPPER Functions
      C.1.1.3      Printing Hexadecimal and Octal Values
      C.1.1.4      The OPEN Procedure
      C.1.1.5      Specifying Qualifiers in the Source Code
    C.1.2      /OLD_VERSION Qualifier
      C.1.2.1      Comment Delimiters
      C.1.2.2      %INCLUDE Files
      C.1.2.3      Multidimensional Packed Arrays
      C.1.2.4      Storage of Components
      C.1.2.5      Storage of Sets
      C.1.2.6      TEXT Files and FILE OF CHAR
      C.1.2.7      MOD Operator
      C.1.2.8      String Variable Parameters to the READ Procedure
      C.1.2.9      Field Widths
      C.1.2.10     Global Identifiers
      C.1.2.11     Allocation in Program Sections
    C.1.3      Minor Language Changes

  C.2     Differences Between the Current Version and Past Versions

  D   Summary of VAX Pascal Extensions

  D.1     VAX Pascal Extensions to Unextended Pascal

  D.2     VAX Pascal Extensions to Extended Pascal

  E   Description of Implementation Features

  E.1     Implementation-Defined Features

  E.2     Implementation-Dependent Features

  F   Error Detection

  F.1     Error-Detection Information

  FIGURES

  3-1 Order of Execution for TO BEGIN DO and TO END DO Sections

  7-1        Scope of Identifiers

  9-1        Sequential File Organization

  9-2 Relative File Organization

  9-3 Indexed File Organization

  9-4 A First Alternate Key

  9-5        File Buffer Contents

  9-6        Sequential Access to a Sequential File

  9-7 Using Sequential Access to Read from a Relative File

  9-8 Using Sequential Access to Write to a Relative File

  9-9 Using Random Access on Sequential and Relative Files

  9-10       File Position After GET Procedure

  11-1 %INCLUDE File Levels

  B-1        Syntax Illustration of an Actual Parameter List

  B-2        Syntax Illustration of a Standard Array Constructor

  B-3        Syntax Illustration of a Nonstandard Array Constructor

  B-4        Syntax Illustration of an Attribute List

  B-5        Syntax Illustration of Binary Digits

  B-6        Syntax Illustration of a Block

  B-7        Syntax Illustration of a Compilation Unit

  B-8        Syntax Illustration of a Conformant Parameter

  B-9        Syntax Illustration of Decimal Digits

  B-10       Syntax Illustration of a Declaration Part

  B-11       Syntax Illustration of an Expression

  B-12       Syntax Illustration of a Factor

  B-13       Syntax Illustration of a Field List

  B-14       Syntax Illustration of a Formal Parameter List

  B-15       Syntax Illustration of a Formal Parameter Section

  B-16       Syntax Illustration of a Function Heading

  B-17       Syntax Illustration of Hexadecimal Digits

  B-18       Syntax Illustration of an Identifier

  B-19       Syntax Illustration of an Initial Value

  B-20       Syntax Illustration of a Mechanism Specifier

  B-21       Syntax Illustration of a Numeric Constant

  B-22       Syntax Illustration of Octal Digits

  B-23       Syntax Illustration of a Primary

  B-24       Syntax Illustration of a Procedure Heading

  B-25       Syntax Illustration of a Real Constant

  B-26       Syntax Illustration of a Standard Record Constructor

  B-27       Syntax Illustration of a Nonstandard Record Constructor

  B-28       Syntax Illustration of a Routine Declaration

  B-29       Syntax Illustration of a Set Constructor

  B-30       Syntax Illustration of a Simple Expression

  B-31       Syntax Illustration of a Simple Statement

  B-32       Syntax Illustration of a Simple Type

  B-33       Syntax Illustration of a Statement

  B-34       Syntax Illustration of a String Constant

  B-35       Syntax Illustration of a Structured Statement

  B-36       Syntax Illustration of a Term

  B-37       Syntax Illustration of a Type

  B-38       Syntax Illustration of a Variable

  TABLES

  1 Conventions Used in This Manual

  1-1        Special Symbols

  1-2        Reserved Words

  1-3        Redefinable Reserved Words

  1-4        Predeclared Identifiers

  2-1        Predefined Identifiers For Use With Real Data Types

  2-2        Precision in Exponential Notation

  2-3        Assignment Compatibility

  4-1        Arithmetic Operators

  4-2        Results of Negative Exponents

  4-3        Result Types of Arithmetic Operators

  4-4        Relational Operators

  4-5        Logical Operators

  4-6        String Operators

  4-7        Set Operators

  4-8        Precedence of Operators

  6-1        Formal Parameter Semantics

  6-2        Parameter Passing Mechanisms

  6-3 Specifiers and Attributes for Passing Mechanisms

  6-4 Default Values on Formal Parameters

  8-1        Predeclared Routine Categories

  8-2 Return Values of Alignment Predeclared Routines

  8-3 Value of ZERO

  9-1        File Organization Support for Component Format

  9-2        File Organization Support for Component Access Modes

  9-3 Carriage Control Characters

  9-4        File Mode During I/O Processing

  9-5        Default Field Widths

  10-1 Summary of Checking Options

  10-2 KEY Attribute Options

  10-3 OPTIMIZE Attribute Options

  10-4 Attribute Classes

  10-5 Attributes on Routines and Compilation Units

  10-6 Attributes on Data Items

  A-1        The ASCII Character Set

  C-1        Summary of Version 1.0 OPEN Parameters

  D-1        VAX Pascal Extensions to Unextended Pascal

  D-2        VAX Pascal Extensions to Extended Pascal