[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP Pascal for OpenVMS

Language Reference Manual

Order Number: AA--PWVSD--TK


January 2005

This manual contains the complete description of the HP Pascal programming language.

Note

The HP Pascal extensions to the Extended Pascal standard are shown in teal in this HTML version of the manual.

Revision/Update Information: This revised manual supersedes the Compaq Pascal Language Reference Manual, Version 5.7.

Operating System: OpenVMS I64 Version 8.2 or higher
OpenVMS Alpha Version 6.1 or higher
OpenVMS VAX Version 5.5 or higher

Software Version: HP Pascal for OpenVMS I64 Systems Version 5.9
HP Pascal for OpenVMS Alpha Systems Version 5.9
HP Pascal for OpenVMS VAX Systems Version 5.8




Hewlett-Packard Company Palo Alto, California


© Copyright 2005 Hewlett-Packard Development Company, L.P.

Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license.

The information contained herein is subject to change without notice. The only warranties for HP products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein.

Intel and Itanium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

Printed in the US

ZK6083

This manual is available on CD-ROM.

Contents Index


Preface

This manual describes the HP Pascal programming language. It contains information on:

  • HP Pascal language syntax and semantics
  • HP Pascal adherence to Pascal standards
  • HP Pascal extensions to standards

All references to OpenVMS systems refer to the OpenVMS I64, OpenVMS Alpha, and OpenVMS VAX operating systems unless otherwise specified.

Intended Audience

This manual is for experienced applications programmers with a basic understanding of the Pascal language. Some familiarity with your operating system is helpful. This is not a tutorial manual.

Document Structure

This manual consists of the following chapters and appendixes:

  • Chapter 1 describes Pascal language standards and lexical elements.
  • Chapter 2 describes data types and values.
  • Chapter 3 describes declaration sections.
  • Chapter 4 describes expressions and operators.
  • Chapter 5 describes statements.
  • Chapter 6 describes user-written procedures and functions.
  • Chapter 7 describes program structure and scope.
  • Chapter 8 describes predeclared procedures and functions, except those that perform input and output.
  • Chapter 9 describes the predeclared procedures and functions that perform input and output.
  • Chapter 10 describes attributes.
  • Chapter 11 describes directives.
  • Appendix A describes the storage allocation and alignment for data types and the internal representation of each data type.
  • Appendix B describes the HP Pascal extensions to the Pascal standards.
  • Appendix C describes the HP Pascal implementation features that the Pascal standards allow each implementation to define.
  • Appendix D describes how the HP Pascal compiler detects errors defined by the Pascal standard.
  • The Glossary provides a glossary of HP Pascal terminology.

Related Documents

The following documents might also be useful when programming in HP Pascal:

  • HP Pascal for OpenVMS User Manual---Provides information about programming tasks, about using features in conjunction with one another, and about increasing the efficiency of program execution.
  • HP Pascal for OpenVMS Installation Guide---Provides information on how to install HP Pascal on your OpenVMS system.

Reader's Comments

HP welcomes your comments on this manual. Please send comments to either of the following addresses:

Internet openvmsdoc@hp.com
Postal Mail Hewlett-Packard Company
OSSG Documentation Group, ZKO3-4/U08
110 Spit Brook Rd.
Nashua, NH 03062-2698

HP Pascal Home Page

You can access the HP Pascal home page at:


http://h71000.www7.hp.com/commercial/pascal/pascal_index.html

Conventions

The following product names may appear in this manual:

  • HP OpenVMS Industry Standard 64 for Integrity Servers
  • OpenVMS I64
  • I64

All three names---the longer form and the two abbreviated forms---refer to the version of the OpenVMS operating system that runs on the Intel® Itanium® architecture.

The following typographic conventions might be used in this manual:

Ctrl/ x A sequence such as Ctrl/ x indicates that you must hold down the key labeled Ctrl while you press another key or a pointing device button.
PF1 x A sequence such as PF1 x indicates that you must first press and release the key labeled PF1 and then press and release another key or a pointing device button.
[Return] In examples, a key name enclosed in a box indicates that you press a key on the keyboard. (In text, a key name is not enclosed in a box.)

In the HTML version of this document, this convention appears as brackets, rather than a box.

... A horizontal ellipsis in examples indicates one of the following possibilities:
  • Additional optional arguments in a statement have been omitted.
  • The preceding item or items can be repeated one or more times.
  • Additional parameters, values, or other information can be entered.
.
.
.
A vertical ellipsis indicates the omission of items from a code example or command format; the items are omitted because they are not important to the topic being discussed.
( ) In command format descriptions, parentheses indicate that you must enclose choices in parentheses if you specify more than one.
[ ] In command format descriptions, brackets indicate optional choices. You can choose one or more items or no items. Do not type the brackets on the command line. However, you must include the brackets in the syntax for OpenVMS directory specifications and for a substring specification in an assignment statement.
| In command format descriptions, vertical bars separate choices within brackets or braces. Within brackets, the choices are optional; within braces, at least one choice is required. Do not type the vertical bars on the command line.
{ } In command format descriptions, braces indicate required choices; you must choose at least one of the items listed. Do not type the braces on the command line.
bold type Bold type represents the introduction of a new term. It also represents the name of an argument, an attribute, or a reason.
italic type Italic type indicates important information, complete titles of manuals, or variables. Variables include information that varies in system output (Internal error number), in command lines (/PRODUCER= name), and in command parameters in text (where dd represents the predefined code for the device type).
UPPERCASE TYPE Uppercase type indicates a command, the name of a routine, the name of a file, or the abbreviation for a system privilege.
- A hyphen at the end of a command format description, command line, or code line indicates that the command or statement continues on the following line.
numbers All numbers in text are assumed to be decimal unless otherwise noted. Nondecimal radixes---binary, octal, or hexadecimal---are explicitly indicated.


Chapter 1
Language Elements

HP Pascal is a general-purpose programming language. This chapter describes the following information and components of the HP Pascal language:

1.1 Pascal Language Standards

The HP Pascal compiler accepts programs that comply with two standards and a subset of programs that comply with a third. HP Pascal also provides features (called extensions) that are not part of any standard. For portable code, limit your use of these extensions or isolate the extensions in separate modules.

1.1.1 Unextended Pascal Standards

The unextended Pascal standards are as follows:

  • American National Standard ANSI/IEEE770X3.97-1989 (ANSI)
  • International Standard ISO 7185-1989 (ISO)

HP Pascal accepts programs that comply to either standard. In the HP Pascal documentation set, the term "unextended Pascal" applies to both the ANSI and ISO standards.

HP Pascal contains FIPS-109 (Federal Information Processing Standard) validation support.

The standards are divided into two levels of standardization: Level 0 and Level 1. An example of a technical difference between the Level 0 standard and the Level 1 standard is that Level 0 does not include conformant arrays, while Level 1 does.

HP Pascal has passed the validation suite for Pascal compilers. It received a CLASS A certificate for both levels of the ISO standard as well as the ANSI standard. CLASS A certificates are given to compilers with a fully conforming implementation.

For More Information:

  • On HP Pascal extensions to unextended Pascal (Appendix B)
  • On HP Pascal implementation-dependent features (Appendix C)
  • On HP Pascal error processing as defined by the standards (Appendix D)
  • On flagging nonstandard constructs during compilation (HP Pascal for OpenVMS User Manual)

1.1.2 Extended Pascal Standard

The Extended Pascal standard is a superset of the unextended Pascal standards. The Extended Pascal standards are as follows:

  • American National Standard ANSI/IEEE770X3.160-1989
  • International Standard ISO 10206-1989

In the HP Pascal documentation set, the term Pascal standard refers to these standards. Because HP Pascal supports most Extended Pascal standard features, it cannot compile all programs that comply with Extended Pascal.

For More Information:

  • On HP Pascal support for Extended Pascal features (Appendix B)
  • On flagging nonstandard constructs during compilation (HP Pascal for OpenVMS User Manual)

1.2 Lexical Elements

This section discusses lexical elements of the HP Pascal language.

1.2.1 Character Set

HP Pascal uses the extended American Standard Code for Information Interchange (ASCII) character set. This extended ASCII character set contains 256 characters, which include the following:

  • Uppercase letters A through Z and lowercase letters a through z
  • Integers 0 through 9
  • Special characters, such as the ampersand (&), question mark (?), and equal sign (=)
  • Nonprinting characters, such as the space, tab, line feed, carriage return, and form feed (use of these characters can improve the legibility of your programs)
  • Extended, unspecified characters with numeric codes from 128 to 255

Each ASCII character corresponds to a numeric value.

Each element of the character set is a constant of the predefined HP Pascal type CHAR. An ASCII decimal number is the same as the ordinal value (as returned by the Pascal ORD function) of the associated character in the type CHAR.

HP Pascal allows full use of eight-bit characters.

The HP Pascal compiler does not distinguish between uppercase and lowercase characters except when they appear inside single or double quotation marks. For example, the word PROGRAM has the same meaning when written as any of the following:


PROGRAM
PRogrAm
program

The characters in each pair of characters, however, represent different values:


'b'  'B'
"c"  "C"

1.2.2 Special Symbols

Special symbols represent operators, delimiters, and other syntactic elements. Some symbols are composed of more than one character; you cannot place a space between the characters of these special symbols. Table 1-1 lists the HP Pascal special symbols.

Table 1-1 Special Symbols
Symbol Name Symbol Name
' Apostrophe <= Less than or equal to
:= Assignment operator - Minus sign
[ ] or (. .) Brackets * Multiplication
: Colon <> Not equal
, Comma ( ) Parentheses
(* *) or { } Comments % Percent
/ Division . Period
" Double quote + Plus sign
= Equal sign ^ or @ Pointer
** Exponentiation ; Semicolon
> Greater than .. Subrange operator
>= Greater than or equal to :: Type cast operator
< Less than    

1.2.3 String Delimiters

HP Pascal accepts single-quote and double-quote characters as string and character delimiters.

1.2.4 Embedded String Constants

Within double quotation marks, HP Pascal supports constant characters specified with a backslash, in a syntax similar to that of the C programming language. Table 1-2 lists the constants supported by HP Pascal.

Table 1-2 Embedded String Constants
Constant Definition ASCII Value
\a Bell character 16#7
\b Backspace character 16#8
\f Form-feed character 16#C
\n Line-feed character 16#A
\r Carriage-return character 16#D
\t Horizontal tab character 16#9
\v Vertical character 16#B
\\ Backslash character 16#5C
\" Double-quotation character 16#22
\' Single-quotation character 16#27
\nnn Character whose value is nnn nnn is an octal number from 000 to 377. Leading zeros can be omitted.
\xnn Character whose value is nn nn is a hexadecimal number from 00 to FF. Leading zeros can be omitted.

1.2.5 Reserved Words

Reserved words are used to designate data types, directives, identifiers, specifiers, statements, and operators. You cannot redefine these identifiers. Table 1-3 presents the HP Pascal reserved words.

Table 1-3 Reserved Words
%DESCR %DICTIONARY %IMMED %INCLUDE
%REF %STDESCR %SUBTITLE %TITLE
AND ARRAY BEGIN CASE
CONST DIV DO DOWNTO
ELSE END FILE FOR
FUNCTION GOTO IF IN
LABEL MOD NIL NOT
OF OR PACKED PROCEDURE
PROGRAM RECORD REPEAT SET
THEN TO TYPE UNTIL
VAR WHILE WITH  

The manuals in the HP Pascal documentation set show these reserved words in uppercase letters. If you choose, you can express them in mixed case or lowercase in your programs.

Table 1-4 presents the redefinable reserved words that are used to name operators and identifiers. You can redeclare these words, but, if you do, the language feature becomes unavailable within the block in which you redeclare the word.

Table 1-4 Redefinable Reserved Words
AND_THEN BREAK CONTINUE MODULE
OR_ELSE OTHERWISE REM RETURN
VALUE VARYING    

Note

This table does not include statements that are only provided by HP Pascal for compatibility with other Pascal compilers.

This manual shows redefinable reserved words in uppercase letters. If you choose, you can express them in mixed case or lowercase in your programs.


Next Contents Index