HP Pascal/HP-UX Reference Manual ABCDE HP Part No. 92431-90005 Printed in U.S.A.
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.
Printing History New editions are complete revisions of the manual. Update packages may be issued between editions. The software code printed alongside the date indicates the version level of the software product at the time the manual was issued. Many product updates and xes do not require manual changes and, conversely, manual corrections may be done without accompanying product changes. Therefore, do not expect a one-to-one correspondence between product updates and manual updates.
iv
Preface The HP Pascal/HP-UX Reference Manual provides material about HP Pascal and its system programming extensions. It is intended for experienced Pascal programmers. This manual covers material for the HP-UX and MPE/iX operating systems. MPE/iX, Multiprogramming Executive with Integrated POSIX, is the latest in a series of forward-compatible operating systems for the HP 3000 line of computers.
Additional Documentation Additional Documentation Additional information for the HP Pascal programmer can be found in the following documents: IEEE Standard Pascal Computer Programming Language , ANSI/IEEE 770 X3.97-1983, Library of Congress Catalog Number 82-84259. This book de nes the ANSI standard Pascal that is the basis for HP Pascal. HP Pascal/HP-UX Programmer's Guide (92431-90006), This book explains HP Pascal topics in detail. It describes how statements interact with each other, if necessary.
Additional Documentation Conventions UPPERCASE In a syntax statement, commands and keywords are shown in uppercase characters. The characters must be entered in the order shown; however, you can enter the characters in either upper or lowercase.
Additional Documentation Conventions (continued) [ . .. ] In a syntax statement, horizontal ellipses enclosed in brackets indicate that you can repeatedly select the element(s) that appear within the immediately preceding pair of brackets or braces. In the example below, you can select Parameter zero or more times. Each instance of Parameter must be preceded by a comma: [,Parameter][...
Additional Documentation Pascal Speci c Conventions The conventions followed in this manual are summarized below: For Text: The term PAC is used for the type PACKED ARRAY OF CHAR with the lower bound equal to 1. Reserved words and directives are in all uppercase letters. Examples: BEGIN, REPEAT, FORWARD Standard identi ers are in all lowercase letters. Examples: readln, maxint, text General information concerning an area of programming (topic) appears as a heading with initial capitalization.
Contents 1. Introduction Extensions to ANSI/IEEE and ISO Pascal Type Compatibility . . . . . . . . . CASE Statement . . . . . . . . . Compiler Options . . . . . . . . . Conformant Array Parameters . . . Constant Expressions . . . . . . . Constructors (Structured Constants) Declaration Part . . . . . . . . . Halt Procedure . . . . . . . . . . Heap Procedures . . . . . . . . . Identi ers . . . . . . . . . . . . File Input/Output . . . . . . . . Function Return . . . . . . . . . Longreal Numbers . . . . . . .
3. Data Types Simple Types . . . . . . . . . . Ordinal . . . . . . . . . . . Bit16 . . . . . . . . . . . Bit32 . . . . . . . . . . . Bit52 . . . . . . . . . . . Boolean . . . . . . . . . . Char . . . . . . . . . . . Enumerated . . . . . . . . Integer . . . . . . . . . . Longint . . . . . . . . . . Shortint . . . . . . . . . . Subrange . . . . . . . . . Real . . . . . . . . . . . . . Longreal . . . . . . . . . . . Structured Types . . . . . . . . ARRAY . . . . . . . . . . . Array Declarations . . . . . .
OR . . . . . . . . . . . Relational Operators . . . Simple Relational Operators Set Relational Operators . . IN . . . . . . . . . . Pointer Relational Operators String Relational Operators Concatenation Operator . . SET Operators . . . . . . Array Selector . . . . . . Record Selector . . . . . . Set Constructor . . . . . . File Bu er Selector . . . . Pointer dereferencing . . . Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7. Program Structure Program Heading . Block . . . . . . Declaration Part . PROCEDURE . . FUNCTION . . . MODULE . . . . EXPORT . . . . IMPORT . . . . IMPLEMENT . . . . . . . . . . . . . . . . . . . . 6-26 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
movebyteswhile . . . . . . scanuntil . . . . . . . . . scanwhile . . . . . . . . waddress . . . . . . . . . Arithmetic Functions . . . . abs . . . . . . . . . . . arctan . . . . . . . . . . cos . . . . . . . . . . . exp . . . . . . . . . . . ln . . . . . . . . . . . . sin . . . . . . . . . . . sqr . . . . . . . . . . . sqrt . . . . . . . . . . . Predicate Functions . . . . . odd . . . . . . . . . . . Numeric Conversion Functions binary . . . . . . . . . . hex . . . . . . . . . . . octal . . . . . . . . . .
rewrite . . . . . . . . . . . seek . . . . . . . . . . . . . write . . . . . . . . . . . . Formatting of Output to Text les writedir . . . . . . . . . . . writeln . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-33 10-35 10-36 10-38 10-41 10-42 11. System Programming Extensions ISO . .
Move R to L . . . Fast Fill . . . . . . Move Fast . . . . . Error Handling Routines Escape . . . . . . Escapecode . . . . Parameter Mechanisms Haveextension . . . Haveoptvarparm . . Routine Mechanisms . Call . . . . . . . . Fcall . . . . . . . Size Functions . . . . Bitsizeof . . . . . . Sizeof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
HEAP_DISPOSE . . . . HP_DESTINATION . . HP3000_16 . . . . . . . HP3000_32 . . . . . . . IF . . . . . . . . . . INCLUDE . . . . . . . INCLUDE SEARCH . . INLINE . . . . . . . . INTR NAME . . . . . KEEPASMB . . . . . . LINES . . . . . . . . . LIST . . . . . . . . . LIST CODE . . . . . . LISTINTR . . . . . . . LITERAL ALIAS . . . LOCALITY . . . . . . LONG CALLS . . . . . MAPINFO . . . . . . . MLIBRARY . . . . . . NLS SOURCE . . . . . NOTES . . . . . . . . OPTIMIZE . . . . . . OS . . . . . . . . . . OVFLCHECK .
VERSION . VOLATILE WARN . . WIDTH . . XREF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-131 12-132 12-133 12-134 12-135 A. Error Messages Reading Error Messages . Finding Undetected Errors Using This Appendix . . pc Driver Messages . . .
Figures 3-1. 11-1. 11-2. 11-3. 11-4. 11-5. 11-6. 11-7. 12-1. 12-2. 12-3. 12-4. HP Pascal Data Types . . . . . . . . . . . . . . . . . . . . . . . Relationship of STANDARD LEVEL Compiler Option Parameters . . . Extended Data Types . . . . . . . . . . . . . . . . . . . . . . . Layout of a Record . . . . . . . . . . . . . . . . . . . . . . . . Layout of a Crunched Record . . . . . . . . . . . . . . . . . . . . Pointer Class Relationship . . . . . . . . . . . . . . . . . . . . . Copying Order for move l to r .
1 Introduction HP Pascal originates from the Pascal language developed by Nicklaus Wirth in 1968. Wirth's Pascal is based on the ALGOL 60 programming language. His objective was to introduce Computer Science students to \good programming practices." Since then, Pascal has undergone extensions, particularly in its input-output capabilities. This has helped it become a dominant language not only in the academic world, but also in major commercial software projects.
Additional Documentation Extensions to ANSI/IEEE and ISO Pascal This section describes HP Pascal features that are extensions of ANSI/IEEE 770 X3.97-1983 and ISO 7185-1983 Pascal. For the full description of a feature, refer to the appropriate keyword or topic in this manual. Type Compatibility Note In the ISO 7185-1983 or ANSI/IEEE 770 X3.97-1983 standards for Pascal, the term \string" refers to any PACKED ARRAY of CHAR with a starting index of 1. HP Pascal, however, supports the standard type string.
Additional Documentation Compiler Options Compiler options appear between dollar signs ($). HP Pascal has two categories of compiler options: system-independent and system-dependent compiler options. The system-independent category of compiler options are further distinguished by the following categories: HP Standard Options, HP Pascal Options, and System Programming Options. The system-dependent either work on only one operating system, or work di erently on HP-UX and MPE/iX.
Additional Documentation HP Standard Options System Programming Options ANSI LINES LIST PAGE PARTIAL_EVAL RANGE STANDARD_LEVEL EXTNADDR TYPE_COERCION System-Dependent Compiler Options: MPE/iX Only MPE/iX and HP-UX HP-UX Only CALL_PRIVILEGE EXEC_PRIVILEGE FONT HP3000_16 HP3000_32 RLFILE RLINIT INCLUDE INCLUDE_SEARCH NLS_SOURCE SYMDEBUG CONVERT_MPE_NAMES GPROF HP_DESTINATION SHLIB_CODE SHLIB_VERSION Refer to Chapter 12 for details about these options.
Additional Documentation Declaration Part In the declaration part of a block, CONST, TYPE, VAR, MODULE, and IMPORT sections can be repeated and intermixed. Halt Procedure The halt procedure causes an abnormal termination of a program. Heap Procedures The procedure mark saves the allocation state of the heap. The procedure release restores the allocation state of the heap to a state previously marked.
Additional Documentation The routines page , overprint , prompt , and linepos operate on text les. The following lists what each routine does: Linepos returns the integer number of characters that the program has read from or written to a text le since the last end-of-line marker. Page causes a page eject when a text le is printed. Overprint causes the printer to perform a carriage return without a line feed, e ectively overprinting a line. Prompt displays the output bu er without writing a line marker.
Additional Documentation String or Character Literals HP Pascal permits the encoding of control characters or any other single ASCII character after the sharp symbol (#). For example, the string literal #G represents CTRL-G (or the bell). A character can also be encoded by specifying its ASCII ordinal value (0..255) after the sharp symbol. For example, #7 represents CTRL-G. These characters can be included in string literals by directly appending them in front of or behind a string literal.
Additional Documentation WITH Statement The record designator in a WITH statement can be a call to a function that returns a record as its result, or a structured constant. Numeric Conversion Functions The functions binary, octal, and hex convert a parameter of type string or PAC, or a string literal, to an integer. These functions interpret the parameter the following ways: Binary interprets the parameter as a binary value. Octal interprets the parameter as an octal value.
2 Language Elements A Pascal program is a sequence of statements that, when executed in a speci ed order, processes data to produce desired results. The elements of Pascal include basic symbols, reserved words, identi ers, numbers, comments, separators, and literals . The statements are made up of di erent elements depending on the needs of the program. This chapter describes in detail the elements of statements in the HP Pascal language.
Additional Documentation Table 2-1. Special Symbols (continued) Symbol 2-2 Description : Denotes a statement label, list of case constants, or variable identi ers. ^ De ne or dereference pointers, access le bu er. May be replaced by @. <> Not equal. <= Less than or equal, subset. >= Greater than or equal, superset. := Assign value to a variable. .. Delimit a subrange. { } Delimit a comment. May be replaced by the (* # Encode a control character. $ Delimit a compiler option.
Additional Documentation Reserved Words Reserved words are symbols that have special meaning to the Pascal language. They are the names of statements, data types, or operators. A reserved word can be used in a program only in the context for which it is de ned. A reserved word cannot be rede ned for use as an identi er. It may, however, be used within comments or string literals. A list of reserved words recognized by HP Pascal with a brief description of each is given in Table 2-2.
Additional Documentation Table 2-2. Reserved Words (continued) Reserved Word(s) Description Chapter Reference MODULE Begins a module declaration. 7 NIL Special pointer value. 5 NOT Boolean negation operator. 4 OR Boolean disjunction operator. 4 PACKED Controls allocation for structured type. 3 PROCEDURE Begins a procedure declaration. 7 PROGRAM Program heading. 7 RECORD . . . CASE . . . OF . . . END Structured type. 3 REPEAT . . . UNTIL Repetitive statement. 6 SET . . .
Additional Documentation Identifiers An HP Pascal identi er consists of a letter preceding an optional character sequence of letters, digits, or the underscore character (_) up to a source line in length with all characters signi cant without respect to case. Identi ers are used to denote declared constants, types, variables, procedures, functions, modules, and programs. A letter may be any of the letters in the subranges A through Z or a through z.
Additional Documentation Example GOOD_TIME_9 good_time_9 gOOd_TIme_9 { These identifiers { are { equivalent. } } } x2_GO a_long_identifier Boolean { Standard identifier.} Scope The scope of an identi er is its domain of accessibility or the region of a program in which it may be used. In general, a user-de ned identi er can appear anywhere in a block after its de nition. Furthermore, the identi er can appear in a block nested within the block in which it is de ned.
Additional Documentation Example PROGRAM show_scope (output); CONST asterisk = '*'; VAR x: char; {global variable} PROCEDURE writeit; CONST x = 'LOCAL AND GLOBAL IDENTIFIERS DO NOT CONFLICT'; BEGIN write (x) END; {writeit} BEGIN { show_scope } x:= asterisk; write (x); writeit; write (x); writeln; END.
Additional Documentation Numbers HP Pascal recognizes three kinds of numeric literals: integer, real, and longreal . Integer Literals An integer literal consists of a sequence of digits from the subrange 0 through 9. No spaces may separate the literal, and leading zeroes are not signi cant. The compiler interprets unsigned integer literals as positive values. The maximum unsigned integer literal is equal in value to the standard constant maxint .
Additional Documentation Real and Longreal Literals A real or longreal literal consists of a coe cient and a scale factor. An E preceding the scale factor is read as times ten to the power of and speci es a real literal . An L preceding scale factor also means times ten to the power of, but speci es a longreal literal . Lowercase e and l are legal. At least one digit must precede and follow a decimal point. A number containing a decimal point and no scale factor is considered a real literal .
Additional Documentation Comments Comments consist of a sequence of characters that starts with either of the equivalent symbols { or (*, and end with either of the equivalent symbols } or *). Comments are used to document a program. Since a comment is a separator , it may appear anywhere in a program where a separator may appear. However, nested comments are not legal. Note that comments do not have to be on lines by themselves and may cross line boundaries.
Additional Documentation Separators A separator is a space, a tab, an end-of-line marker, a compiler option, or a comment. Separators are used to separate reserved words, identi ers, numbers, strings, and special symbols. At least one separator must appear between any pair of consecutive identi ers, numbers, or reserved words. When one or both elements are special symbols, however, the separator is optional. Separators may not appear within special symbols having more than one component (:=, for example).
Additional Documentation String Literals String literals are sequences of characters, enclosed by single quote marks, that may not be longer than a single line of source code. String literals may consist of any combination of the following: A sequence of ASCII characters enclosed in single quote marks. A sharp symbol (#) followed by a single character. A sharp symbol (#) followed by up to three digits that represent the ASCII value of a character.
Additional Documentation Syntax String_literal: Example 'Please don''t!' { Single quote character. } 'A' '' { Null string.
3 Data Types One of the most important contributions and fundamental ideas of Pascal is the formalization of the concept of a data type . A data type is a collection of elements that belong together because they are all formed in the same way and are treated uniformly. There are three categories of data types in HP Pascal. They are: Simple Structured Pointer These data types are used to determine a set of attributes that include: The set of permissible values that an object of a speci ed type may assume.
Additional Documentation Figure 3-1.
Additional Documentation Simple Types The simple data types are made up of ordinal, real, and longreal types. Ordinal types include the standard types integer , char , and Boolean as well as enumerated , subrange , shortint , longint , bit16 , bit32 , and bit52 types. Syntax Simple_type: Ordinal Ordinal types are types that have a one-to-one correspondence with a subset of natural numbers.
Additional Documentation Syntax Ordinal_type: Note 3-4 For relational tests, the two operands must be compatible types. When membership tests are performed, the left-operand type must be a single ordinal value, while the right-operand is of a SET type.
Additional Documentation Bit16 The prede ned data type bit16 is a subrange, 0..65535, that is stored in 16 bits. bit16 is a unique HP Pascal type because arithmetic operations on bit16 data are truncated to modulo 65536 when stored.
Additional Documentation Bit32 The prede ned data type bit32 is a subrange, 0..232 -1, that is stored in 32 bits. bit32 is a unique HP Pascal type because arithmetic operations on bit32 data are performed with unsigned 32 bit integers.
Additional Documentation Example $standard_level 'hp_modcal'$ program bits2(output); var q,r:bit32; begin { one way to get bit32 constants >= 2 ** 31 } $push; type_coercion 'conversion'; range off$ q:=bit32(hex('ffffffff')) + 1; { q is now 0 } r:=bit32(hex('7fffffff')) + 1; { r is now > maxint } $pop$ writeln('wrapped around value = ',q:1); writeln('past maxint value = ',r:1); end.
Additional Documentation Bit52 The prede ned data type bit52 is a subrange, 0..252 -1, that is stored in 64 bits. bit52 is a unique HP Pascal type because arithmetic operations on bit52 data are performed with unsigned 64 bit integers.
Additional Documentation Boolean The Boolean type is a prede ned enumerated type that indicates logical values. The elements of this data type are two constant identi ers, true and false , where false is less than true .
Additional Documentation Char The char type is a prede ned ordinal type that is used to represent individual characters in the 8-bit ASCII character set. A char literal is either a single character surrounded by single quote marks, or a sharp (#) followed by a number or letter.
Additional Documentation Enumerated An enumerated type is a user-de ned, ordinal type that de nes an ordered set of values by the enumeration of identi ers in parentheses. The sequence in which the identi ers appear determines the ordering. The enumerated identi ers are de ned as constants. The ORD of the rst has the value zero, and the ORD of the others have successive integer values in order of their speci cation.
Additional Documentation Integer The integer type is a prede ned, ordinal type whose possible values are determined by a subrange of the negative and positive integers. The lower bound of the subrange is the prede ned constant minint , and the upper bound is the prede ned constant maxint . The integer type represents a signed number of at least nine digits.
Additional Documentation Longint The prede ned data type longint is an integer in the range -263 ..263-1 that is stored in 64 bits.
Additional Documentation Shortint The prede ned data type shortint is an integer in the range -32768..32767 that is stored in 16 bits. (In contrast, if you declare a variable to be in that range, it is stored in 32 bits.
Additional Documentation Subrange A subrange type is a user-de ned, ordinal type that is a sequential subset of a prede ned or user-de ned, ordinal base type. It consists of a lower bound and an upper bound separated by the special symbol \..". The upper and lower bounds must be constant values or constant expressions of the same ordinal type. The lower bound cannot be greater than the upper bound.
Additional Documentation Real The real type is a prede ned, simple type that represents a subset of the real numbers. For the range covered by the subset, see the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide , depending on your implementation.
Additional Documentation Longreal The longreal type is a prede ned, simple type that represents a subset of the real numbers. This type may have more precision and a larger range than the type real . The range the subset covers is implementation dependent in HP Pascal. For more details see the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide , depending on your implementation.
Additional Documentation Structured Types Structured data types are the array, le, record, set, and string types. These data types can be preceded by a packing modi er. The e ect of the packing modi er is implementation-de ned. Refer to the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide , depending on your implementation, for more information.
Additional Documentation Array Declarations An array type de nition consists of the reserved word ARRAY, an index type in square brackets, the reserved word OF, and the component type. The reserved word PACKED may precede ARRAY. It instructs the compiler to optimize storage space for the array components, possibly at the expense of execution time. An index that must be an ordinal type speci es the number of component of an array.
Additional Documentation One asterisk (*) after a routine name indicates that this routine can be used on all arrays, whereas two asterisks (**) indicates that this routine should be used with PAC arrays only. Note Example TYPE name list strange flag files = = = = = PACKED ARRAY [1..30] OF char; { PAC type } ARRAY [1..100] OF integer; ARRAY [Boolean] OF char; ARRAY [(red, white, blue)] OF 1..50; ARRAY [1..
Additional Documentation FILE This reserved word designates a declared data structure that consists of a sequence of components all of the same type. Files are usually associated with peripheral storage devices, and their length is not speci ed in the program. A le type consists of the reserved words FILE OF and a component type that may be prede ned or user-de ned. The type text is a special type of FILE OF CHAR that has additional attributes.
Additional Documentation Standard Textfiles text Text type variables are called text les . The standard le type text permits ordinary input and output that is oriented to characters and lines. Text type les have two important features: The components are type char . The le is subdivided into lines by special end-of-line markers . Text les cannot be opened for direct access with the procedure open . Text les can be sequentially accessed, however, with the procedures reset, rewrite, or append .
Additional Documentation input When the standard text le input appears as a program parameter, there are several important consequences: Input may not be declared in the global declaration of the source code. The system automatically associates input with an implementation-dependent physical le. The system automatically resets input . If certain le operations omit the logical le name parameter, input is the default le.
Additional Documentation Record A record is a structured type consisting of a collection of components that are not necessarily of the same type. Each component is termed a eld of the record and has its own identi er. A eld of a record is accessed by using the appropriate eld selector . A record type consists of the reserved word RECORD, a eld list, and the reserved word END. The reserved word PACKED may precede the reserved word RECORD.
Additional Documentation Fixed Part In the xed part of the eld list, a eld de nition consists of an identi er , a colon (:), and a type . Any simple, structured, or pointer type is legal. Several elds of the same type may be de ned by listing the identi ers separated by commas. Syntax Fixed_part: Variant Part In the variant part , the reserved word CASE introduces an optional tag eld identi er and a required ordinal type identi er .
Additional Documentation Syntax Variant_part: Permissible Operators assignment (entire record) := eld selection .
Additional Documentation Example TYPE word_type = (int, ch); word = RECORD { variant part only with tag } CASE word_tag: word_type OF int: (number: integer); ch : (chars : PACKED ARRAY [1..
Additional Documentation Set A set is a user-de ned, structured type that is the power set consisting of the set of all subsets of a base type . A set type consists of the reserved words SET OF and a base type . The base type may be any ordinal type. The maximum number of elements is implementation de ned, but must be at least 256 elements. It is legal to declare a packed set. However, whether this a ects the storage is implementation dependent.
Additional Documentation PACKED This reserved word indicates that the compiler should minimize data storage even if the access time may be increased. The reserved word PACKED may appear with an ARRAY, RECORD, SET, or FILE. By declaring a PACKED structured data type, the amount of memory needed to store an item is generally reduced. The decision to pack a particular data type depends on many factors including available memory size, processor speed, required response time, and volume of data.
Additional Documentation String In HP Pascal a string type consists of the standard identi er string and an integer constant expression in square brackets that speci es the maximum length. Integer constant expressions are constant expressions that return an integer value, an unsigned integer being the simple case. The limit for the maximum length is implementation de ned, but must be at least 255. The symbols (. and .) may replace the left and right brackets, respectively.
Additional Documentation Permissible Operators assignment concatenation relational := + =, <>, <=, >=, >, < Standard Functions string argument - str strpos strlen strrpt strltrim strrtrim strmax string return - str strltrim strrpt strrtrim Standard Procedures string parameter - prompt strinsert read strmove readdir strread readln strwrite setstrlen write strappend writedir strdelete writeln Example CONST maxlength = 100; TYPE name = string[30]; remark = string[maxlength * 2]; PROC
Additional Documentation Pointer Types Pointers A pointer is a data type that may reference any type, including type FILE. A pointer references a dynamically allocated variable on the heap. The pointer type consists of the caret (^) and a type identi er. The @ symbol may replace the caret. The type appearing after the caret need not be previously de ned. This is an exception to the general rule that HP Pascal identi ers are rst de ned and then used.
Additional Documentation Example TYPE ptr1 ptr2 rec1 rec2 = ^rec1; = ^rec2; = RECORD f1, f2: link: END; = RECORD f1, f2: link: END; integer; ptr2; real; ptr1; Data Types 3-33
Additional Documentation Type Compatibility Relative to each other, two HP Pascal types can be identical , type compatible , or incompatible . The guidelines that determine type compatibility are listed below. Identical Types Two types are identical if either of the following is true: Their types have the same type identi er.
Additional Documentation PROGRAM t(input,output); TYPE T1 = record a: integer; b: char; end; T2 = record c: integer; d: char; end; VAR v1: T1; v2: T2; v3: ^T1; v4: ^T2; BEGIN v1:= v3:= END.
Additional Documentation Assignment Compatibility A value of type T2 may only be assigned to a variable or function result of type T1 if T2 is assignment compatible with T1. For T2 to be assignment compatible with T1, any of the following conditions must be true: T1 and T2 are type compatible types that are neither les nor structures that contain les. T1 is real or longreal, and T2 is integer or an integer subrange. The compiler converts T2 to real or longreal prior to assignment.
Additional Documentation Table 3-1.
4 Expressions An expression is a construct composed of operators and operands that represent the computation of a result of a particular type. In the simplest case, an expression consists of a single operand with no operator. The type of an expression is known when the expression is written, and never changes. The actual value, however, may not be known until the system evaluates the expression at run time. It may di er for each evaluation.
Additional Documentation Syntax Expression: 4-2 Expressions
Additional Documentation Selector: Example x:= 19; { Simplest case. "19" is the expression { in the statement: "x := 19". } } 100 + x; { Arithmetic operator with literal and { variable operands. } } (A OR B) AND (C OR D) { Boolean operator with Boolean operands. } x > y { Relational operator with variable { operands. } } setA * setB; { Set operator with variable operands. } 'ice'+'cream' { Concatenation operator with string { literal operands.
Additional Documentation Operands An operand denotes the object that operators use in obtaining a value. An operand may be a literal , a declared constant , a variable access (variable) , a set constructor , a dereferenced pointer , or the value of another expression. Function calls are also operands in the sense that they return a result that an operator can use to compute another value. An operand may be acted upon by an operator.
Additional Documentation Operators An operator de nes an action to be performed on one or more operands and produces a value. An operator may be classi ed as arithmetic, Boolean, relational, set, or concatenation . A particular symbol may occur in more than one class of operators. For example, the symbol + is an arithmetic, set, and concatenation operator representing numeric addition, set union, and string concatenation, respectively. The class of the operator is determined by the type of the operands.
Additional Documentation Table 4-2.
Additional Documentation Arithmetic Operators Arithmetic operators perform integer and real arithmetic by taking numeric operands and producing a numeric result . These operators are +, -, *, /, DIV, and MOD. Most arithmetic operators permit real , longreal , or integral-type operands. However, DIV and MOD only accept integral-type operands. The type of the result of a unary operator is the same as the type of its operand.
Additional Documentation For example, if i is an integer and x is a real in the expression (x + i), then i is converted to real before the addition. In short, the two operands to an arithmetic operator must be compatible. For more details, refer to the section \Type Compatibility" in Chapter 3. Table 4-3.
Additional Documentation Example EXPRESSION RESULT -(+10) 5 + 2 5 - 2.0 5 * 2 5.0 / 2.0 5 / 2 -10 7 3.0 10 2.5 2.5 5.0 / 2 2.5 { { { { { { { { Unary -. Addition with integer operands. Subtraction with implicit conversion. Multiplication with integer operands. Division with real operands. Division with integer operands, real result. Division with implicit conversion. } } } } } } } } 5 DIV 2 5 DIV (-2) -5 DIV 2 -5 DIV (-2) 2 -2 -2 2 { Division with truncation.
Additional Documentation MOD This operator returns the modulus of two integers. The dividend must be an integral-type. The divisor must also be an integral-type. If the divisor is less than or equal to 0, an error will occur. The result is always positive, regardless of the sign of the left operand. The left operand must be parenthesized if it is a negative literal.
Additional Documentation Example IF NOT possible THEN forget_it; WHILE time AND money DO your_thing; REPEAT...
Additional Documentation AND This Boolean operator is used to perform the logical operation on two Boolean operands. The result is of type Boolean. The following truth table illustrates the operator AND along with its results. OPERATOR AND RESULT The evaluation of two Boolean operands produces a Boolean result, such that: (logical and) a b a AND b false false false false true false true false false true true true Example VAR bit6, bit7 : Boolean; counter : integer; BEGIN ...
Additional Documentation NOT This Boolean operator complements the value of the Boolean expression following the NOT operator. The result is of type Boolean. The truth table for NOT is given below. OPERATOR NOT RESULT The logical negation of a single Boolean operand, such that: (logical negation) a NOT a false true true false Example PROGRAM show_not(input,output); VAR time, money : Boolean; line : string[255]; test_file : text; BEGIN . . IF NOT (time AND money) THEN wait; . .
Additional Documentation OR This Boolean operator is used to perform the logical inclusive OR operation on two Boolean operands. The result is the logical OR of its two factors. The OR operator is shown below in terms of its truth table.
Additional Documentation Relational Operators Relational operators compare two operands and return a Boolean result. The relational operators are <, <=, =, <>, >=, >, and IN. The following lists the relational operators with their associated meanings: OPERATOR < <= = <> >= > IN MEANING less than less than or equal to equal not equal greater than or equal greater than set membership Depending on the type of its operands, a relational operator may be classi ed as simple, set, pointer, or string .
Additional Documentation Simple Relational Operators A simple relational operator has operands of any simple type such as integer, Boolean, char, real, longreal, enumerated, or subrange. All the operators listed above, except IN, may be simple relational operators. The operands must be type compatible, but the compiler may implicitly convert numeric types before evaluation. For more information about converting numeric types, refer to the section \Arithmetic Operators" in this chapter.
Additional Documentation Set Relational Operators A set relational operator has set operands. The set relational operators are =, <>, >=, <=, and IN. The operators = and <> compare two sets for equality or inequality, respectively. The <= operator denotes the subset operation, while >= indicates the superset operation such that Set A is a subset of Set B, if every element of A is also a member of B. When this is true, B is said to be the superset of A.
Additional Documentation IN This operator returns true if the speci ed element is a member of the speci ed set. The result is false if the expression is not a member of the set. Both the element being tested and the elements in the set must be of compatible types. Example PROGRAM show_in(output); VAR ch : char; good : SET OF char; member : Boolean; BEGIN ch := 'y'; good := ['y','Y','n','N']; IF ch IN good THEN member := true ELSE member := false; writeln(member); END.
Additional Documentation Pointer Relational Operators The pointer relational operators = and <> can be used to compare two pointers for equality or inequality, respectively. Two pointers are equal only if they point to exactly the same object or both contain the value NIL. Only two pointers of identical type or the constant NIL can be compared. Example PROGRAM show_pointer_relational; VAR a, b: boolean; p, q: ^boolean; x: ^char; BEGIN . .
Additional Documentation String Relational Operators The string relational operators =, <>, <, <=, >, or >= may be used to compare operands of type string , PAC , char, or string literals . The system performs the comparison character by character using the order de ned by the ASCII collating sequence. Note that it is not possible to compare a string variable with a PAC or char variable.
Additional Documentation Example PROGRAM show_string_relational (output) ; VAR s,t: pac: chr: b: string[80]; packed array [1..5] of char; char; boolean; BEGIN s:='abc'; t:='ab'; if s > t then b:=true else b:=false; writeln (b); b:= s > 'ab'; writeln (b); pac:='abc'; b:= pac > 'abc'; writeln (b); chr:= 'A'; b:= 'c' > chr; writeln (b); END. {string to string comparison.
Additional Documentation Concatenation Operator The concatenation operator + concatenates two operands that may be string variables, string literals, function results of a string type, or some combination of these types. The result of the concatenation is always type string. It is not legal to use the concatenation operator in a constant de nition.
Additional Documentation SET Operators The set operators perform set operations on two set operands . The result is of type set. The set operators are +, -, and *. Operands used with set operators may be variables, constant identi ers, or set constructors . The base types of the set operands must be type compatible with each other.
Additional Documentation Array Selector An array selector accesses a component of an array. The selector follows an array designator and consists of an ordinal expression in square brackets. For a string or PAC type, an array selector accesses a single component; for example, a character. The ordinal expressions must be assignment compatible with the index types of the array.
Additional Documentation Record Selector A record selector accesses a eld of a record. The record selector follows a record designator and consists of a period and the name of a eld. A record designator is the variable name of a record, the selected component of a structure that is a record, or a function call that returns a record. The WITH statement \opens the scope" of a record. This makes it unnecessary to specify a record selector.
Additional Documentation Set Constructor A set constructor designates one or more values as members of a set whose type may or may not have been previously declared. A set constructor consists of an optional set type identi er and one or more ordinal expressions in square brackets. Two expressions may serve as the lower and upper bound of a subrange. If the set type identi er is speci ed, the values in the brackets must be assignment compatible with the base type of the set.
Additional Documentation Example 1 PROGRAM show_setconstructor; TYPE int_set = SET OF 1..100; cap_set = SET OF 'A'..'Z'; VAR a,b: 0..255; s1: SET OF integer; s2: SET OF char; BEGIN . . s1:=[b, 7, 10]; { no type identifier } s1:= int_set[(a MOD 100) + (b MOD 100)]; s2:= cap_set['B'..'T', 'X', 'Z']; END. Example 2 VAR s1 : set of 0..366; i,j : integer; BEGIN s1 := [i..j] * s1; END. {in this context, [i..j] becomes a set of 0..366.} . . .
Additional Documentation File Buffer Selector A le bu er selector accesses the contents, if any, of the le bu er variable associated with the current position of a le. The selector follows a le designator and consists of the caret symbol (^). A le designator is the name of a le or the selected component of a structure which is a le. The @ symbol may replace the caret. If the le bu er variable is not de ned at the time of selection, a run-time error occurs.
Additional Documentation Pointer dereferencing A pointer variable points to a dynamically allocated variable on the heap. The current value of this variable may be accessed by dereferencing its pointer value. Pointer dereferencing occurs when the caret symbol (^) appears after a pointer designator in source code. A dereferenced pointer can be an operand in an expression. The pointer designator may be the name of a pointer or selected component of a structured variable that is a pointer.
Additional Documentation Function Calls A function call invokes the block of a standard or user de ned function and returns a value to the calling point of the program. An operator can perform some action on this value, and, for this reason, a function result is an expression. See Chapter 8 for a complete description of function calls. Example PROGRAM show_function_call; VAR x: integer; FUNCTION sum (A,B: integer): integer; BEGIN sum := A + B; END; BEGIN x:= sum (1,2) + 3; x:= sum(x,sum(x,sum(0,1))); END.
5 The Declaration Section The rst two parts of an HP Pascal block are the heading and the declaration section. The heading speci es the name of the program, module, procedure, or function. The declaration section contains sections that de ne constants and user-de ned types, and sections that declare labels, variables, procedures, functions, and modules. Each of these sections is introduced by an appropriate reserved word such as LABEL, CONST, IMPORT, MODULE, TYPE, VAR, PROCEDURE, or FUNCTION.
Additional Documentation Constant Definition A constant de nition establishes an identi er as a synonym for a constant value . The identi er may then be used in place of the value. The value of a symbolic constant may not be changed by a subsequent constant de nition in the same scope or by an assignment. The reserved word CONST precedes one or more constant de nitions. A constant de nition consists of an identi er, the equal sign, (=) and a constant value.
Additional Documentation CONST This reserved word indicates the beginning of one or more constant de nitions that introduces an identi er as a synonym for a constant value. The identi er may then be used in place of that value. Constant de nitions appear after the program header or any LABEL declarations, and before any procedure or function de nitions. In HP Pascal, CONST, TYPE, VAR, MODULE, and IMPORT de nitions may be intermixed.
Additional Documentation false This prede ned Boolean constant is equal to the Boolean value false . The ordinal value of false is 0. Example PROGRAM show_false(output); VAR what, lie : Boolean; BEGIN IF false THEN writeln('Always false, never printed.'); what := false; lie := NOT true; IF what = lie THEN writeln('Would I lie?'); END.
Additional Documentation true This prede ned Boolean constant is equal to the Boolean value true . The ordinal value of true is 1. Example PROGRAM show_true(output); VAR what, truth : boolean; BEGIN IF true THEN writeln('Always true, always printed.'); what := true; truth := NOT false; IF what = truth THEN writeln('Everything I say is a lie.'); END. Output: Always true, always printed. Everything I say is a lie.
Additional Documentation maxint This standard constant returns the upper bound of the integer type. The value is implementation de ned, however, it must allow for at least nine decimal digits. For more information, see the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide , depending on your implementation. Example PROGRAM show_maxint(input,output); VAR i,j : integer; r : real; BEGIN readln(i,j); r := i + j; IF r > maxint THEN writeln('Sum too large for integers.'); END.
Additional Documentation minint This standard constant returns the lower bound of the integer type. The value is implementation de ned, however, it must allow at least nine decimal digits. In general, the range of signed integers allows the absolute value of minint to be greater than maxint . For more information, see the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide , depending on your implementation.
Additional Documentation NIL This prede ned constant is the value of a pointer that designates that the pointer does not point at anything. NIL is compatible with any pointer type. A NIL pointer or pointer that has been assigned to NIL does not point to any variable at all. It is an error to dereference a NIL valued pointer. NIL pointers are useful in linked list applications where the link pointer points to the next element of the list.
Additional Documentation Array Constants and Array Constructors An array constant is a declared constant de ned with an array constructor that speci es values for the components of an array type. The values for all elements of the structured type must be speci ed and must have a type identical to the type of the corresponding elements. An array constructor consists of a previously de ned array type identi er and a list of values in square brackets.
Additional Documentation Example TYPE Boolean_table table row matrix color color_string color_array = = = = = = = CONST true_values init_values1 init_values2 identity = = = = colors ARRAY [1..5] OF Boolean; ARRAY [1..100] OF integer; ARRAY [1..5] OF integer; ARRAY [1..5] OF row; (red, yellow, blue); PACKED ARRAY [1..
Additional Documentation Record Constructor A record constant is a declared constant de ned with a record constructor that speci es values for the elds of a record type. A record constant may be used to initialize a variable in the body of a block. Individual elds of a record constant in the body of a block may be selected, but not when de ning other constants. A record constructor consists of a previously declared record type identi er and a list in square brackets of elds and values.
Additional Documentation Example TYPE securtype = (light, medium, heavy); counter = RECORD pages: integer; lines: integer; characters: integer; END; report = RECORD revision: char; price: real; info: counter; CASE securtag: securtype OF light: (); medium: (mcode: integer); heavy: (hcode: integer; password: string[10]); END; CONST no_count = counter [pages: 0, characters: 0, lines: 0]; big_report = report [revision: 'B', price: 19.
Additional Documentation Restricted Set Constructor A set constant is a declared constant de ned with a restricted set constructor that speci es set values. A restricted set constructor consists of an optional previously declared set type identi er and a list of constant values in square brackets. Subranges may appear in this list. Restricted set constructors may appear in a CONST section of a declaration part, or in executable statements and can be used to initialize a set variable in the body block.
Additional Documentation String Constructor A string constant is a declared constant de ned with a string constructor that speci es values for a string type. The length of the string constant may not exceed the maximum length of the string type used in its de nition. The number of characters in the de nition determines the current length of the string constant. A string constructor consists of a previously de ned string type identi er and a list of values in square brackets.
Additional Documentation Label Declaration A label declaration speci es integer labels that mark executable statements in the body of the block. The reserved word LABEL precedes one or more integers separated by commas. Control is transferred to a labeled statement by a GOTO statement. For more information about GOTO statements, see Chapter 6. Integers must be in the range 0 to 9999. Leading zeros are not signi cant. For example, the labels 9 and 00009 are identical.
Additional Documentation Type Definition A TYPE section introduces the name and set of values for a user-de ned type. HP Pascal requires that a type identi er be de ned before its subsequent use in the de nitions of other types. In the only exception to this rule, a base type identi er in a pointer type de nition is allowed before the base type is de ned. However, the base type must be de ned before the end of the TYPE section in which it is rst mentioned.
Additional Documentation TYPE This reserved word delimits the start of the type declarations in a program, module, procedure, or function. A type de nition establishes an identi er known as type identi er as a synonym for a data type . The identi er may then appear in subsequent type or constant de nitions or in variable declarations. The reserved word TYPE precedes one or more type de nitions. A type de nition consists of an identi er, the equals sign (=), and a type.
Additional Documentation Variable Declaration A variable declaration introduces an identi er as a variable of a speci ed type. Each variable is a statically-declared object that occupies storage and is accessible for the activation and duration of the program, procedure, or function in which it is declared. Components of a structured variable may be accessed using an appropriate selector. Pointer variable dereferencing accesses dynamic variables on the heap.
Additional Documentation VAR This reserved word delimits the beginning of variable declarations in an HP Pascal program or module. A variable declaration associates an identi er with a type. The identi er may then appear as a variable in executable statements. The reserved word VAR precedes one or more variable declarations. A variable declaration consists of an identi er , a colon (:), and a type . Any number of identi ers may be listed, separated by commas.
Additional Documentation Side-Effects A side-e ect is the modi cation by a procedure or function of a variable that is global or nonlocal in scope to the procedure or function. If a local variable is declared using the same identi er as a global variable, the local variable may be modi ed without a ecting the global variable.
6 Statements A statement is a sequence of special symbols , reserved words , and expressions that either performs a speci c set of actions on a program's data or controls program ow. Table 6-1 lists and describes statements. Table 6-1.
Additional Documentation Syntax Statements: 6-2 Statements
Additional Documentation Compound Statements A compound statement is a sequence of statements bracketed by the reserved words BEGIN and END. A semicolon (;) delimits one statement from the next. Certain statements may alter the ow of execution in order to achieve e ects such as selection, iteration, or invocation of another procedure or function. For instance, after the last statement in the body of a routine has executed, control is returned to the point in the program from which the routine is called.
Additional Documentation BEGIN .. END BEGIN and END are reserved words that signify the beginning and ending of a compound statement or block. BEGIN indicates to the compiler that a compound statement or block has started, whereas END indicates that a compound statement or block has terminated.
Additional Documentation Empty Statements The empty statement causes only the advancement of program ow to the next statement. It is often used to indicate that nothing occurs. In the example, no action occurs when i equals 2, 3, 4, 6, 7, 8, 9, or 10. Example CASE i OF 0 : start; 1 : proceed; 2..4 : ; 5 : report_error; 6..10: ; 11 : stop; OTHERWISE fatal_error; END; IF i IN [2..4,6..10] THEN { do nothing } ELSE { cases } Note In the following example, the last semicolon is not required.
Additional Documentation Assignment An assignment statement assigns a value to a variable access or a function result. The assignment statement consists of a variable or function identi er, an optional selector, a special symbol (:=), and an expression that computes a value. The type of the expression must be assignment compatible with the type of the receiving element. The receiving element may be of any type except le, or a structured type containing a le type component.
Additional Documentation Example PROGRAM show_assign(input,output); VAR aaa: integer; FUNCTION show_assign: integer; TYPE rec = RECORD f: integer; g: real; END; index = 1..3; table = ARRAY [index] of integer; CONST ct = table [10, 20, 30]; cr = rec [f:2, g:3.0]; VAR s: integer; a: table; i: index; r: rec; p1, p: ^integer; strg: string[10]; BEGIN { show_assign } s:= 5; i:= 3; a:= ct; a [i] := s + 5; r:= cr; r.f:= 5; new (p1); p:= p1; p^:= r.
Additional Documentation CASE The CASE statement selects a certain action based upon the value of an ordinal expression. It consists of the reserved word CASE, a selector, the reserved word OF, a list of case constants and statements, and the reserved word END. Optionally, the reserved word OTHERWISE and a list of statements may appear after the last constant and its statement. The selector must be an ordinal expression in that it must return an ordinal value.
Additional Documentation Example PROCEDURE scanner; BEGIN get_next_char; CASE current_char OF 'a'..'z', 'A'..'Z': scan_word; { Subrange CASE label } '0'..'9': scan_number; OTHERWISE scan_special; END; END; . . . . FUNCTION octal_digit (d:digit): Boolean; { TYPE digit = 0..9 } BEGIN CASE d OF 0..7: octal_digit := true; 8..9: octal_digit := false; END; END; . . . .
Additional Documentation IF .. THEN IF .. THEN .. ELSE An IF statement speci es a statement the system executes, if a particular condition is true . If the condition is false, then the system doesn't execute that statement, and optionally, it executes another statement starting after the ELSE. The IF statement consists of the reserved word IF, a Boolean expression, the reserved word THEN, a statement, and, optionally, the reserved word ELSE and another statement.
Additional Documentation A common use of the IF statement is to select an action from several choices. This often appears in the following form: IF e1 THEN ... ELSE IF e2 THEN ... ELSE IF e3 THEN ... ELSE ... This form is particularly useful to test for conditions involving real numbers or string literals of more than one character, since these types are not legal in CASE labels.
Additional Documentation Example PROGRAM show_if (output); VAR i,j : integer; s : PACKED ARRAY [1..5] OF char; found: Boolean; BEGIN . . IF i = 0 THEN writeln ('i = 0'); IF found THEN writeln ('Found it') ELSE writeln ('Still looking'); . . IF i = j THEN writeln ('i = j') ELSE IF i < j THEN writeln ('i < j') ELSE { i > j } writeln ('i > j'); . . IF s = 'RED' THEN i := 1 ELSE IF s = 'GREEN' THEN i := 2 ELSE IF s = 'BLUE' THEN i := 3; END. 6-12 Statements { IF with no ELSE. } { IF with an ELSE part.
Additional Documentation FOR .. DO The FOR statement executes a statement a predetermined number of times. The FOR statement consists of the reserved word FOR, a control variable initialized by an ordinal expression known as the initial value , either the reserved word TO indicating an increment or the reserved word DOWNTO indicating a decrement, another ordinal expression known as the nal value , the reserved word DO, and a statement.
Additional Documentation The FOR statement: FOR control_var := initial TO final DO statement is equivalent to the statement: BEGIN temp1 := initial; {No evaluation order is required } temp2 := final; {for temp1 and temp2. } IF temp1 <= temp2 THEN BEGIN control_var := temp1; WHILE control_var <= temp2 DO BEGIN statement; control_var := succ(control_var); { increment } END; END ELSE; { Don't execute the statement at all;} END; { control_var is now undefined.
Additional Documentation In the statement after DO, it is an error if assignment is made to the control variable. It cannot be used on the left-hand side of an assignment statement, passed as a reference parameter or used as the control variable of a second FOR statement nested within the rst. Furthermore, it may not appear as a parameter for the standard procedures read or readln .
Additional Documentation REPEAT .. UNTIL A REPEAT statement executes a statement or group of statements repeatedly until a Boolean expression is true . It consists of the reserved word REPEAT, one or more statements, the reserved word UNTIL, and a Boolean expression (the condition). The statements between REPEAT and UNTIL need not be bracketed with BEGIN..END. When the system executes a REPEAT statement, the following occurs: 1.
Additional Documentation Example sum := 0; count := 0; REPEAT writeln('Enter trial value, or "-1" to quit'); read (value); sum := sum + value; count := count + 1; average := sum / count; writeln ('value = ', value, ' average = ',average) UNTIL (count >= 10) OR (value = -1); . .
Additional Documentation WHILE .. DO The WHILE statement executes a statement repeatedly as long as a given condition is true . The WHILE statement consists of the reserved word WHILE, a Boolean expression (the condition), the reserved word DO, and a statement. When the system executes a WHILE statement, the following occurs: 1. It evaluates the condition. 2. If the condition is true, it executes the statement after DO, and then re-evaluates the condition.
Additional Documentation Example WHILE index <= limit DO BEGIN writeln (real_array[index]); index := index + 1; END; . .
Additional Documentation WITH .. DO A WITH statement allows reference to record elds by eld name alone. A WITH statement consists of the reserved word WITH, one or more record designators, the reserved word DO, and a statement. A record designator may be a record identi er, a function call that returns a record, or a selected record component. The statement after DO may be a compound statement.
Additional Documentation The statement: WITH record1, record2, ..., recordn DO BEGIN statement; END; is equivalent to: WITH record1 DO BEGIN WITH record2 DO BEGIN ... WITH recordn DO BEGIN statement; END; ... END; END; Therefore, if eld f is a component of both record1 and record2, the compiler interprets an unselected reference to f as a reference to record2.f. The synonymous eld in record1 can be accessed using normal eld selection; for example, record1.f.
Additional Documentation Syntax With_statement 6-22 Statements
Additional Documentation Example PROGRAM show_with; TYPE status = (married, widowed, divorced, single); date = RECORD month : (jan, feb, mar, apr, may, jun, july, aug, sept, oct, nov, dec); day : 1..31; year : integer; END; person = RECORD name : RECORD first, last: string[10] END; ss : integer; sex : (male, female); birth : date; ms : status; salary : real END; VAR employee : person; BEGIN {show_with} .
Additional Documentation GOTO A GOTO statement transfers control unconditionally to a statement marked by a label. It consists of the reserved word GOTO and the speci ed label. The scope of labels is restricted. They may only mark statements appearing in the executable portion of the block where they are declared. They cannot mark statements in inner blocks. GOTO statements, however, may appear in inner blocks and reference labels in an outer block.
Additional Documentation Example PROGRAM show_goto (output); LABEL 500, 501; TYPE index = 1..10; VAR i: index; target: integer; a: ARRAY[index] OF integer; PROCEDURE check; VAR answer: string [10]; BEGIN . { ask user if OK to search } IF answer= 'no' THEN GOTO 501; { jumping out of procedure } . END; BEGIN { show_goto } . check; . FOR i := 1 TO 10 DO IF target = a[i] THEN GOTO 500; writeln (' Not found'); GOTO 501; 500: writeln (' Found'); 501: END.
Additional Documentation Procedures A procedure statement transfers program control to the block of a declared or standard procedure. After the procedure has executed, control is returned to the statement following the procedure call. A procedure statement consists of a procedure identi er and, if required, a list of actual parameters in parentheses. The procedure identi er must be the name of a standard procedure or a procedure declared in a previous procedure declaration.
Additional Documentation Example PROGRAM show_pstate(output); PROCEDURE wow; BEGIN writeln('wow'); END; PROCEDURE bow; BEGIN write('bow-'); wow; END; PROCEDURE outer (a: integer; procedure proc_parm); PROCEDURE inner; BEGIN bow; END; BEGIN {outer} writeln('Hi'); inner; proc_parm; END; {outer} BEGIN { show_pstate } outer(30, bow); END.
7 Program Structure An HP Pascal program consists of two major parts: the program heading and the program block . The program block includes the declaration part which consists of de nitions of constants and types, and declarations of labels, variables, procedures, functions, and modules. This chapter describes in detail the program heading and program block . This includes the declaration part and module as well as the function and procedure. Below is an example of an HP Pascal program.
Additional Documentation Example PROGRAM minimum; { The minimum program that the HP Pascal } BEGIN END. { compiler will process successfully: { no program parameters. } PROGRAM show_form1 (output); { Uses the standard textfile output BEGIN writeln ('Greetings!') END. } } { and the standard procedure writeln.
Additional Documentation Program Heading The program heading consists of the reserved word PROGRAM, an identi er that speci es the program name and an optional parameter list. The program block consists of the declaration part and the statement or statements. The identi ers in the parameter list are variables that must be declared in the outer block, except for the standard text les input and output .
Additional Documentation Block A block is a syntactically complete section of code. There are two parts to a block; the declaration part and the executable part. Blocks may be nested . It is important that all objects appearing in the executable part be de ned in the declaration part or in the declaration part of an outer block. Syntax block: Note 7-4 MODULE declarations and IMPORT lists cannot appear in inner blocks such as in procedures or functions.
Additional Documentation Declaration Part The declaration part consists of de nitions of constants and types , and declarations of labels , variables , procedures, functions , and modules . The statement part is made up of a compound statement that may be empty or may contain several simple or structured statements. The statement part is also termed the body or executable portion of the block. For more information about statements, refer to Chapter 6.
Additional Documentation Example PROGRAM show_declarepart; LABEL 25; VAR birthday: integer; TYPE friends = (Joe, Simon, Leslie, Jill); CONST maxnuminvitee = 3; VAR invitee: friends; PROCEDURE hello; BEGIN writeln('Hi'); END; BEGIN . . END. 7-6 Program Structure { End of declaration part. } { Beginning of body.
Additional Documentation PROCEDURE A procedure is a block that is invoked with a PROCEDURE statement. A procedure declaration consists of a procedure heading, a semicolon (;), and a block or a directive followed by a semicolon. The procedure heading consists of the reserved word PROCEDURE, an identi er that speci es the procedure name, and optionally, a formal parameter list. A directive can replace the procedure block to inform the compiler of the location of the block. FORWARD is one of the directives.
Additional Documentation FUNCTION A function is a block that is invoked with a function call and that returns a value . A function declaration consists of a function heading, a semicolon (;), and a block or a directive followed by a semicolon (;). A function heading consists of the reserved word FUNCTION, an identi er that speci es a function name, an optional formal parameter list, and a result type. The result type may be any type, except a le type or a structured type containing a le.
Additional Documentation MODULE A module provides a mechanism for separate compilation of program segments. It is a program fragment with a completely de ned interface that can be compiled independently and later used to construct programs. A module usually de nes some data types , constants , variables , and some procedures and functions that operate on this data. Such de nitions are made accessible to users of the module by its export declarations.
Additional Documentation When an import declaration is seen, a module must be found matching each name in the import declaration. If a module of the required name appears in the compilation unit before the import declaration, the reference is to that module. Otherwise, external module libraries must be searched. See \SEARCH" in Chapter 12, and the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide , depending on your implementation, for more information.
Additional Documentation Example This example shows a source le that contains de nitions for the modules bit_types and char_info. MODULE bit_types and MODULE char_info are compiled into an object le called mod1.o. Note that mod1.o is referenced in the examples in section \IMPORT". MODULE bit_types; { Module declaration } EXPORT { Exported types } { Exported type } TYPE bits8 = 0..
Additional Documentation FUNCTION check (i: byte; flag: BOOLEAN): BOOLEAN; {Non-exported function} BEGIN IF i > 127 THEN BEGIN check := false; IF flag THEN writeln (error); END ELSE check := true; END; FUNCTION control (i: byte; flag: BOOLEAN): BOOLEAN;{ Exported function BEGIN last_byte := i; control := check (i,flag) AND (i < 32); END; END.
Additional Documentation EXPORT This reserved word precedes the constants , types , variables , procedures , and functions of a MODULE that can be used or imported by other programs and modules. The EXPORT section is used to de ne the constants, types, variables, procedures, and functions that the module supplies to any program or module that imports it. Procedures and functions are presented as headings without blocks or directives.
Additional Documentation Example EXPORT { Start of export text } TYPE control_num: 0..
Additional Documentation IMPORT This reserved word indicates which modules are needed to compile a program or module. The IMPORT section is used to name all other modules upon which the present one depends. One module, m1, depends on another, m2, if m1 makes use of the objects exported from m2. For instance, m1 calls procedures in m2, or assigns to m2's variables, or declares variables of a type exported from m2. There is no IMPORT section if the module is independent of all other modules.
Additional Documentation Example 2 Module show_import_export both imports and exports module bit_types at the same time. The main program uses type bits8. bits8 is de ned in bit_types, but is available to the main program because it imports show_import_export which exports bit_types. Module show_export is compiled into an object le called mod2.o and bit_types is compiled into an object le called mod1.o (see section \MODULE"). The main program imports module show_import_export only.
Additional Documentation IMPLEMENT This reserved word indicates the beginning of the internal part of a MODULE. The IMPLEMENT section may be empty or it may contain declarations of the constants, types, variables, procedures , and functions that are only used within the module. In addition, it contains the bodies of the procedures and functions whose headings appeared in the EXPORT section. A module does not have to export procedures or functions. It may be used simply to create data or data types.
8 Procedures and Functions When a procedure or function is declared, the heading may optionally include a list of parameters . This list is called the formal parameter list . A procedure statement or function call in the body of a block provides the matching actual parameters that correspond by their order in the list. The four kinds of formal parameters are value, reference, functional , and procedural parameters.
Additional Documentation Two formal parameter lists are congruent if they contain an equal number of parameters, and the parameters in corresponding positions are equivalent. Two parameters are equivalent if any of the following conditions are true : They are both value parameters of the identical type. They are both reference parameters of the identical type. They are both procedural parameters with congruent parameter lists.
Additional Documentation Example PROGRAM show_formparm (input); VAR test: boolean; FUNCTION chek1 (x, y, z: real): Boolean; BEGIN { Perform some type of validity check on x, y, z { and return appropriate value. END; } } FUNCTION chek2 (x, y, z: real): Boolean; BEGIN { Perform an alternate validity check on x, y, z { and return appropriate value.
Additional Documentation PROGRAM show_varparm(output); VAR i,j : integer; PROCEDURE fix(VAR a : integer; b : integer); BEGIN a := b; { i is passed by reference; it will return equal to 42.} b := 0; { j is passed by value; this assignment will } { not change the value of j in the main program. } END; BEGIN { show_varparm } i:= 0; j:= 42; fix(i,j); IF i = j THEN writeln('They both = 42'); END.
Additional Documentation PROGRAM show_conformantparm; CONST First=1; Last=10; TYPE inxtype=1..100; arr1=ARRAY[First..Last] of Integer; arr2=ARRAY[First..2*Last] of Integer; VAR a1,a2,a3:arr1; b1,b2,b3:arr2; PROCEDURE ADD_Array( VAR Result:ARRAY[L..U:inxtype] OF INTEGER; P1,P2:ARRAY[L1..
Additional Documentation Conformance A conformable test must be passed to pass an array as an actual conformant array parameter . Actual conformant array parameters must have a type conformable with the conformant array form corresponding to the parameter in the procedure declaration.
Additional Documentation Example TYPE inxtype = 0..20; ... PROCEDURE Proc1 ( P1: ARRAY[L1..H1:inxtype] OF ARRAY[L2..H2:inxtype] OF integer; P2: PACKED ARRAY[L3..H3:inxtype] OF integer; P3: ARRAY[L4..H4:inxtype] OF integer; P4: ARRAY[L5..H5:inxtype;L6..U6:inxtype] OF integer); ... VAR V1: PACKED ARRAY[0..10] of integer; V2: ARRAY [3..5,1..10] OF integer; V3: ARRAY[1..50] OF integer; V1 is conformable with P2, but not with P1, P3, and P4. V2 is conformable with P1 and P4, but not with P2 or P3.
Additional Documentation Directives A directive may replace a block in a procedure or function declaration. In HP Standard Pascal, the only directive is FORWARD. This directive makes it possible to postpone full declaration of a procedure or function. Additional directives may be provided by particular implementations. See the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide , depending on your implementation, for information about those directives.
Additional Documentation FORWARD Directive The FORWARD directive permits the full declaration of a procedure or function to appear after a call to the procedure or function. For example, if procedures A and B are declared on the same level, you must use the FORWARD directive if A and B will call each other. Example PROCEDURE A; FORWARD; PROCEDURE B; BEGIN . A; { calls A } . END; PROCEDURE A; BEGIN . B; .
Additional Documentation Recursion A recursive procedure or function is a procedure or function that calls itself. It is also legal for procedure A to call procedure B that in turn calls procedure A. This is indirect recursion and is often an instance when the FORWARD directive is useful. Note that when a routine is called recursively, new local variables are created for each invocation of the routine.
Additional Documentation Function Calls A function call invokes the block of a standard or declared function and returns a value to the calling point of the program. Because an operator can perform some action on this value, a function result is an expression. A function call consists of a function identi er and an optional list of actual parameters in parentheses. The actual parameters must match the formal parameters in number, type, and order .
Additional Documentation Example PROGRAM show_function (input,output); VAR n, coef, answer: integer; FUNCTION fact (p: integer) : integer; BEGIN IF p > 1 THEN fact := p * fact (p-1) ELSE fact := 1 END; FUNCTION binomial_coef (n, r: integer) : integer; BEGIN binomial_coef := fact (n) DIV (fact (r) * fact (n-r)) END; BEGIN { show_function } read(n); FOR coef := 0 TO n DO writeln (binomial_coef (n, coef)); END.
9 Standard Routines HP Pascal supplies prede ned procedures and functions that perform various commonly used operations. These are listed below, followed by a description of most in the subsequent pages of this chapter. Any procedure or function that is followed by an asterisk (*) is discussed in Chapter 10.
Additional Documentation Procedures for Allocation and Deallocation HP Pascal distinguishes two classes of variables . These are static and dynamic . A static variable is explicitly declared in the declaration part of a block, and may then be referred to by name in the body. The compiler allocates storage for this variable when the block is activated. The system does not deallocate this space until the process closes the scope of the variable.
Additional Documentation new Usage new(p) new(p, t1,...,tn) Parameters p Any pointer variable. t A case constant value representing tag values for the pointer variable p . Description The procedure new(p ) allocates storage for a dynamic variable on the heap and assigns its identifying value to the pointer variable p . If the dynamic variable is a record with variants, then the tag may be used to specify a case constant. This constant determines the amount of storage allocated.
Additional Documentation Example PROGRAM show_new (output); TYPE marital_status = (single, engaged, married, widowed, divorced); year = 1900..2100; ptr = ^person_info; person_info = RECORD name: string[25]; birdate: year; next_person: ptr; CASE status: marital_status OF married..divorced: (when: year; CASE has_kids: Boolean OF true: (how_many: 1..50); false: (); ); engaged: (date: year); single : (); END; VAR p : ptr; BEGIN . . new(p); . . new(p,engaged); . . new(p,married); . . new(p,widowed,false); . .
Additional Documentation dispose Usage dispose(p) dispose(p, t1,...,tn) Parameters p t A pointer expression that cannot be NIL or unde ned. A case constant value whose value matches the case constant value speci ed in new. Description This procedure indicates that the storage allocated for the given dynamic variable is no longer needed. It is an error if the argument to dispose is NIL or unde ned. After dispose, the system has closed any les in the disposed storage and p is unde ned.
Additional Documentation Example PROGRAM show_dispose (output); TYPE marital_status = (single, engaged, married, widowed, divorced); year = 1900..2100; ptr = ^person_info; person_info = RECORD name: string[25]; birdate: year; next_person: ptr; CASE status: marital_status OF married..divorced: (when: year; CASE has_kids: boolean OF true: (how_many:1..50); false: (); ); engaged: (date: year); single : (); END; VAR p : ptr; BEGIN . . new(p); . . dispose(p); . . new(p,engaged); . . dispose(p,engaged); . .
Additional Documentation mark Usage mark(p) Parameter p A pointer variable. Description The procedure mark(p) marks the allocation state of the heap and sets the value of p to specify that state. In other words, mark saves the allocation state of the heap in p , which must not subsequently be altered by assignment. If altered, the corresponding release cannot be performed. mark is used with release. Example PROGRAM show_markrelease; VAR w,x,y: ^integer; BEGIN . mark(w); . release(w); . mark(x); .
Additional Documentation release Usage release(p) Parameter p A pointer variable that previously appeared as a parameter in a call to mark, and should not have been previously passed to release or altered by assignment. Description The procedure release(p) returns the heap to its allocation state when mark was called with a parameter that has the value of p . This has the e ect of deallocating any heap variables allocated since the program called mark.
Additional Documentation String Procedures HP Pascal supports a number of string procedures that manipulate string expressions, variables, or literals. A string expression may consist of a string literal, a string variable, a string constant, a function result that is a string, or an expression formed with the concatenation operator. Note that strings must be initialized just like any other variable. The string procedures are setstrlen, strappend, strdelete, strinsert, strmove, strread, and strwrite.
Additional Documentation strappend Usage strappend(s1, s2) Parameters s1 s2 A string variable. A string expression whose length must be less than the di erence between the maximum and actual length of the string variable s1 . Description The procedure strappend(s1, s2) appends string s2 to s1 . It is an error if the strlen of s2 is greater than strmax(s1)-strlen(s1). That is, it cannot exceed the number of characters left to ll in s1 . The current length of s1 is updated to strlen(s1) +strlen(s2) .
Additional Documentation strdelete Usage strdelete(s, p, n) Parameters s A string variable. p An integer expression representing the starting index of the deletion. n An integer expression representing the number of characters to be deleted. Description The procedure strdelete(s, p, n) deletes n characters from s starting at component s [ p ] , and the current length of s is updated to the length of s-n . It is an error if n+p-1 is greater than the current length of s .
Additional Documentation strinsert Usage strinsert(s1, s2, p) Parameters s1 s2 p A string expression. A string variable. An integer or an integer expression representing the o set in s2 where insertion begins. Description The procedure strinsert(s1, s2, p) inserts string s1 into s2 starting at s2 [ p ] . Initially, s2 must be at least p -1 characters in length, or it is an error. The resulting string may not exceed strmax(s2). The current length of s2 is updated to strlen(s1) + strlen(s2) .
Additional Documentation strmove Usage strmove(n, s1, p1, s2, p2) Parameters n An integer expression indicating the number of characters to be copied. s1 A string expression or PAC variable. p1 An integer expression indicating the index in s1 from which copying starts. s2 A string or PAC variable. p2 An integer expression indicating the index in s2 where copying starts. Description The procedure strmove(n, s1, p1, s2, p2) copies n characters from s1 , starting at s1[p1] , to s2 , starting at s2[p2] .
Additional Documentation strread Usage strread(s, p, t, v) strread(s, p, t, v1,...,vn) Parameters s p t v A string expression. An integer expression. An integer or integer subrange variable. A simple, string, or PAC variable. Any number of v parameters may appear separated by commas. Description The procedure strread(s, p, t, v) reads a value from s , starting at s [ p ] , into the variable v .
Additional Documentation Example VAR s: string[80]; p,t: 1..80; m,n: integer; BEGIN . s:= ' 12 564 '; . p:= 1; strread(s,p,t,m); . . strread(s,t,t,n); . END. { The value of m will be 12; } { t will be 6. } { The value of n will be 564; } { t will be 11.
Additional Documentation strwrite Usage strwrite(s, p, t, e) strwrite(s, p, t, e1,...,en) Parameters s p t e A string variable. An integer expression. An integer or integer subrange variable. A simple or string expression, or a PAC variable. Any number of e parameters may appear separated by commas. Description The procedure strwrite(s, p, t, e) writes the value of e on s starting at s [ p ] .
Additional Documentation String Functions String functions may be used to manipulate string expressions, variables, or literals. A string expression may consist of a string literal, a string variable, a string constant, a function result that is a string, or an expression formed with the concatenation operator. Note that strings must be initialized just like any other variable. The string functions and procedures assume that the string parameters contain valid information.
Additional Documentation strlen Usage strlen(s) Argument s A string expression. Description The function strlen(s) returns the current length of the string or PAC expression s . If s is not initialized, strlen(s) is unde ned. Example VAR ars, vita: string[132]; b: boolean; BEGIN . ars:= 'HELLO'; vita:= 'TO YOU'; IF strlen(ars) > strlen(vita) THEN b:= true ELSE b:=false; . writeln (strlen(ars):2,strlen(vita):2); END.
Additional Documentation strltrim Usage strltrim(s) Argument s A string expression. Description The function strltrim(s) returns a string consisting of s trimmed of all leading blanks. The function strrtrim trims trailing blanks. Example VAR s: string[80]; BEGIN . s:= ' abc'; s:=strltrim(s); . END.
Additional Documentation strmax Usage strmax(s) Argument s A string variable. Description The function strmax(s) returns the maximum length of s . Strmax is useful for nding the maximum length of VAR string parameters whose maximum is not determined until run time. Example VAR s: string[15]; BEGIN s:= ' ABCDE '; IF strlen(s) = strmax(s) THEN BEGIN s:= strltrim(s); s:= strrtrim(s); END; writeln (s,strmax(s):3); . END.
Additional Documentation strpos Usage strpos(s1, s2) Arguments s1 A string expression. s2 A string expression. Description The function strpos(s1, s2) returns the integer index of the position of the rst occurrence of s2 in s1 . If s2 is not found, zero is returned. If the length of s2 is zero, the result is 1. Note Some HP Pascal implementations have the order of the two parameters reversed. Also, your implementation may have a compiler option that reverses the order of parameters.
Additional Documentation strrpt Usage strrpt(s, n) Arguments s n A string expression. An integer expression indicating the number of repetitions where n must be greater than or equal to zero. Description The function strrpt(s, n) returns a string composed of s repeated n times. If n is 0, a zero-length string is returned. Example CONST one = '1'; VAR b_num: string[12]; BEGIN . b_num:= strrpt(one,strmax(b_num)); b_num:= strrpt ('a',10); . END.
Additional Documentation strrtrim Usage strrtrim(s) Argument s A string expression. Description The function strrtrim(s) returns a string consisting of s trimmed of trailing blanks. Leading blanks are stripped by the function strltrim. Example VAR s: string[80]; BEGIN . s:= 'abc '; . s:= strrtrim(s); . END.
Additional Documentation Transfer Procedures The transfer procedures supported by HP Pascal are pack and unpack . A description of these procedures follows. pack Usage pack(a, i, z) Parameters a Any ARRAY [m..n] of t. i An expression that is type compatible with the index of the non-packed array. z Any PACKED ARRAY [u..v] of t. Description The standard procedure pack transfers data from unpacked arrays to packed arrays. For example, assuming that a is an ARRAY[m..n] OF t and z is a PACKED ARRAY[u..
Additional Documentation Example PROGRAM show_pack (input,output); TYPE clothes = (hat, glove, shirt, tie, sock); VAR dis : ARRAY [1..10] OF clothes; box : PACKED ARRAY [1..5] of clothes; index: integer; . . BEGIN . . index:= 1; pack(dis,index,box); . . index:= 8; pack(dis,index,box); . . END. { After pack executes, box contains { the first 5 components of dis. } } { An error results when pack attempts { to access nonexistent 11th component { of dis.
Additional Documentation unpack Usage unpack(z, a, i) Parameters z Any PACKED ARRAY [u..v] of t. a Any ARRAY [m..n] of t. i An expression that is type compatible with the index of the non-packed array. Description This procedure transfers data from a packed array to an unpacked array. For example, assuming that a is an ARRAY[m..n] OF t and z is a PACKED ARRAY [u..
Additional Documentation Example PROGRAM show_unpack (input,output); TYPE suit_types = (casual, business, leisure, birthday); VAR suit : PACKED ARRAY [1..5] OF suit_types; kase : ARRAY [1..10] OF suit_types; i : integer; . . BEGIN . . i := 1; unpack(suit,kase,i); { After execution, the first 5 . { components of kase contain the . { value of suit. . i := 7 unpack(suit,kase,i); { An error results because unpack . { attempts to assign a component of . { suit to a component of kase which . { is out of range.
Additional Documentation Program Control Procedures The only program control procedures supported by HP Pascal are halt and assert. The details of these procedures are given below. halt Usage halt(n) halt Parameter n An integer expression that may be omitted. Description This procedure terminates the execution of the program. What this means and what is done with the optional integer expression is implementation de ned.
Additional Documentation assert The prede ned procedure assert allows your program to test assumptions, specify invariant conditions, and check data structure integrity. Usage assert (b, i [, p]) Parameters b A Boolean expression that assert evaluates. If its value is true, the program executes the statement following the call to assert . If its value is false, the program's action depends upon whether p is speci ed and whether the ASSERT HALT compiler option is OFF or ON (see Figure 11-1).
Additional Documentation MPE V Migration Routines baddress Usage baddress(v) Parameters v A variable, procedure, or function. Description The function baddress(v) returns the byte address of v when v is a variable name, and the entry point when v is a procedure or function name. This variable may not be type le or a le type component of a structured variable. Also, v cannot be a component of a packed structure, except if it is a component of a PAC.
Additional Documentation Calls baddress(n) baddress(r) baddress(r.f3) baddress(p) baddress(p^) baddress(p^.f3) baddress(a) baddress(a[4]) baddress(pac) baddress(pac[2]) baddress(pab) baddress(pab[2]) { Legal since component type is char. } { Error.
Additional Documentation cmpbytes Usage cmpbytes (s1, s2, l) Parameters s1 s2 l A PAC or string variable that contains a byte string to compare. A PAC or string variable that contains a byte string to compare. A shortint or bit16 expression that indicates the number of bytes to be compared. Result A shortint indicating the result of the comparison: 0 : s1 is less than s2. 1 : s1 is greater than s2. 2 : s1 is equal to s2.
Additional Documentation Example $STANDARD_LEVEL 'EXT_MODCAL'$ program asmb005 (output) type pac20 = packed array[1..20] of char; var pac,pac1 : pac20; i : integer; s : shortint; c,m : char; b : boolean; result : shortint; begin s := 4; pac := 'abcd'; pac1 := 'abcd'; result := cmpbytes( pac,pac1,s ); writeln(result); {2} pac := 'aacd'; pac1 := 'abcd'; result := cmpbytes( pac,pac1,s ); writeln(result); {0} pac := 'abcd'; pac1 ;= 'aacd'; result := cmpbytes( pac,pac1,s ); writeln(result); {1} end.
Additional Documentation movebyteswhile Usage movebyteswhile (s, t, a, n, u, p) Parameter s t a A PAC or string variable that contains the source string to be copied. A PAC or string variable to which the source is to be copied. An ordinal constant expression whose ordinal value is 0 or 1, indicating whether the copy is to continue while the characters are alphabetic (1).
Additional Documentation Example $STANDARD_LEVEL 'EXT_MODCAL'$ program asmb005(output); type pac20 = packed array[1..
Additional Documentation scanuntil Usage scanuntil (s, t1, t2, p) Parameters s t1 t2 p A PAC or string variable that contains the source string to be scanned. An expression whose value is of any char type. An expression whose value is of any char type. A shortint variable which will indicate the position in the source byte string where t1 or t2 was found. Result A boolean value. true : indicates t2 was found. false : indicates t1 was found.
Additional Documentation Example $STANDARD_LEVEL 'EXT_MODCAL'$ program asmb005(output); type pac20 = packed array[1..20] of char; var pac : pac20; s : shortint; c,m : char; b : boolean; begin pac := 'thisoisoaotest56789 '; c := '6'; m := ' '; b := scanuntil( pac, c, m, s ); writeln (s); {16} writeln (b); {false} b := scanuntil( pac, 'x', m, s ); writeln (s); {20} writeln (b); {true} b := scanuntil( pac, #101, ' ', s ); writeln (s); {12} writeln (b); {false} end.
Additional Documentation scanwhile Usage scanwhile (s, t1, t2, p) Parameters s t1 t2 p A PAC or string variable that contains the source string to be scanned. An expression whose value is of any char type. An expression whose value is of any char type. A shortint variable into which an index is returned which indicates at which position in the source array the t2 was found or the t1 was not found. Result A boolean value: true : indicates t2 was found. false : indicates t1 was not found.
Additional Documentation Example $STANDARD_LEVEL 'EXT_MODCAL'$ program asmb005(output); type pac20 = packed array[1..20] of char; var pac : pac20; s : shortint; c,m : char; b : boolean begin pac := 'aaaaaaaaabaaaaaaaaaa'; c := 'a'; m := 'c'; b := scanwhile( pac, c, m, s ); writeln (s); {10} writeln(b); {false} b := scanwhile( pac, 'a', m, s ); writeln (s); {10} writeln(b); {false} b := scanwhile( pac,#98 ,'a', s ); writeln (s); {1} writeln(b); {true} end.
Additional Documentation waddress Usage waddress (i) Parameters i The name of a variable, procedure, or function. Description The function waddress(i) returns the byte address of i when i is a variable name, and the entry point when it is a procedure or function name. This variable cannot be type le or a le type component of a structured variable. Also, i cannot be a component of a packed structure as an argument, except when this component is an element of a PAC.
Additional Documentation Calls waddress(n) waddress(r) waddress(r.f2) waddress(p) waddress(p^) waddress(p^.f2) waddress(a) waddress(a[4]) waddress(pac) waddress(pac[3]) { Legal since component type is char. waddress(pab) waddress(pab[3]) { Error.
Additional Documentation Arithmetic Functions The eight standard arithmetic functions in HP Pascal are abs, arctan, cos, exp, ln, sin, sqr, and sqrt. Details about each of these functions are given in the following pages. abs Usage abs(x) Argument x A numeric expression. Description The abs function computes the absolute value of its argument, which must be an expression with a numeric type. The type of the result is the same as the type of the numeric expression.
Additional Documentation arctan Usage arctan(x) Argument x A numeric expression. Description The arctan function returns the principal value of the angle that has the tangent equal to the argument. The result is in radians within the range -pi/2..pi/2. This function returns a real for sub-integer, integer, or real arguments, and longreal for longreal or super-integer arguments. The value used for pi is implementation dependent. Example Input arctan(num_exp) arctan(2) arctan(-4.002) Result 1.
Additional Documentation cos Usage cos(x) Argument x A numeric expression. Description The cos function returns the cosine of the angle represented by its argument that is interpreted in radians. This function returns a real for sub-integer, integer, or real arguments, and longreal for longreal or super-integer arguments. The range of the returned value is -1.0 through +1.0. Example Input Result cos(x_rad) cos(1.62) -4.
Additional Documentation exp Usage exp(x) Argument x A numeric expression. Description The exp real function raises e to the power of the argument. This function returns a real for sub-integer, integer, or real arguments, and longreal for longreal or super-integer arguments. The value used for Naperian e is implementation dependent. Example Input Result exp(3) exp(8.8E-3) exp(8.8L-3) 2.008554E+01 1.008839E+00 1.
Additional Documentation ln Usage ln(x) Argument x Any positive numeric expression. Description The ln function returns the natural logarithm (base e) of the argument. This function returns a real for sub-integer, integer, or real arguments, and longreal for longreal or super-integer arguments. It is an error if x is 0 or less than 0. The value used for Naperian e is implementation dependent. Example Input Result ln(43) ln(2.121) ln(0) 3.761200E+00 7.
Additional Documentation sin Usage sin(x) Argument x A numeric expression. Description The sin function returns the sine of the angle interpreted in radians represented by its argument. This function returns a real for sub-integer, integer, or real arguments, and longreal for longreal or super-integer arguments. Note that the argument can be any numeric value. Example Input Result sin(rad) sin(0.024) sin(90) 2.399769E-02 8.
Additional Documentation sqr Usage sqr(x) Argument x Any numeric expression. Description The sqr function computes the square of its argument that must be an expression with a numeric type. The type of the result is the same as the base type of the numeric expression. Example Input Result sqr(3) sqr(1.198E3) sqr(-5) sqr(maxint) 9 1.435204E+06.
Additional Documentation sqrt Usage sqrt(x) Argument x Any positive numeric expression. Description The sqrt function computes the square root of its argument, which must be an expression with a numeric type. It is an error if the argument is less than 0. This function returns a real for sub-integer, integer, or real arguments, and longreal for longreal or super-integer arguments. Example Input Result sqrt(64) sqrt(13.5E12) sqrt(0) sqrt(-5) 8.000000E+00 3.674235E+06 0.
Additional Documentation Predicate Functions There are three predicate functions in HP Pascal. They are odd, eof, and eoln. The functions eof and eoln are described in Chapter 10 of this manual. odd Usage odd(x) Argument x Any integer expression. Description This function returns true if the integer expression is odd, and false otherwise.
Additional Documentation Numeric Conversion Functions binary, hex, and octal are the three numeric conversion functions supported in HP Pascal. binary, hex, and octal return an integer value. Therefore, all bits must be speci ed if a negative result is desired. Alternatively, the positive representation may be negated. A description of each of these functions follows. binary Usage binary(s) Argument s Any string or PAC expression whose range is implementation dependent.
Additional Documentation hex Usage hex(s) Argument s Any string or PAC expression whose range is implementation dependent. Description The hex function converts a string or PAC expression, that is interpreted as a hexadecimal value to an integer. Leading and trailing blanks are ignored. It is an error if any character is not a legal hex digit; for example, 0..9, 'A'..'F', or 'a'..'f'.
Additional Documentation octal Usage octal(s) Argument s Any string or PAC expression whose range is implementation dependent. Description The octal function converts a string or PAC expression that is interpreted as an octal value to an integer. Leading and trailing blanks in the argument are ignored. It is an error if any other character is not a legal octal digit; for example, 0..7.
Additional Documentation Transfer Functions Round and trunc are the transfer functions found in HP Pascal. These functions are described on the next two pages. round Usage round(x) Argument x Any real or longreal expression. Description The round function returns the argument rounded to the nearest integer. If x is positive or zero, then round (x ) is equivalent to trunc(x + 0.5); otherwise, round (x ) is equivalent to trunc(x - 0.5).
Additional Documentation trunc Usage trunc(x) Argument x Any real or longreal expression. Description The trunc function returns the integer part of a real or longreal expression that is the integral part of its argument. The absolute value of the result is not greater than the absolute value of x . It is an error if the result is greater than maxint or less than minint . Example Input Result trunc(real_exp) trunc(5.61) trunc(-3.38) trunc(18.
Additional Documentation Ordinal Functions The ordinal functions found in HP Pascal are chr, ord, pred, and succ. Each of these functions are discussed on the next few pages. chr Usage chr(x) Argument x An integer expression in the range 0..255. Description The chr function converts an integer numeric value into an ASCII character by returning the character value, if any, whose ordinal number is equal to the value of its argument. Note that it is an error if the argument is not within the range 0..255.
Additional Documentation ord Usage ord(x) Argument x An ordinal expression. Description The function ord(x) returns the integer representing the ordinal associated with the value of x . If x is an integer, x itself is returned. If x is type char, the result is an integer value between 0 and 255 determined by the ASCII order sequence.
Additional Documentation pred Usage pred(n) Argument x Any ordinal expression. Description The pred function returns the value whose ordinal number is one less than the ordinal number of the argument. The type of the result is identical to the type of the argument. pred(x ) must exist.
Additional Documentation succ succ(x) Argument x Any ordinal expression. Description The succ function returns the value whose ordinal number is one greater than the ordinal number of the argument. The type of the result is identical with the type of the argument. It is an error if succ(x) does not exist.
10 Input and Output Files are the means by which a program receives input and produces output. A le is a sequence of components of the same type. This may be any type except a le type or a structured type with a le type component. Logical les are les declared in a Pascal program. Physical les are les that exist independently of a program and are controlled by the operating system. Logical and physical les are associated so that a program manipulates data objects external to itself.
Additional Documentation Table 10-1. File Procedures and Functions Procedure or Function Action Permissible Files append Opens le in output state. Current position is after last component and eof is true. any associate Associates a logical le with an open physical le. any close Closes a le. any disassociate Disassociates a logical le from it's associated open physical le.
Additional Documentation Table 10-1. File Procedures and Functions (continued) Procedure or Function Action Permissible Files prompt A form of write which assures text le bu ers have been written to the device. No line marker is written. output text les put Assigns the value of the bu er variable to the current component and advances the current position. output or direct access les read Copies current component into speci ed variable parameter and advances current position.
Additional Documentation I/O Standard Procedures and Functions append Usage append(f) append(f, s) append(f, s, t) Parameters f A variable of type le. The parameter f may not be omitted. s The name of a physical le associated with f. This can be a string or PAC expression whose range is implementation de ned. t A string or PAC expression whose value is implementation dependent.
Additional Documentation Illustration Suppose examp_file is a closed logical le of char containing three components. In order to open it and write additional material without disturbing its contents, append is called.
Additional Documentation associate Usage associate(f, num, option str) Parameters f num option str A variable of type le. The system-provided le number of a previously opened le. Must be one of the following: READ associate to sequential access le with read access. WRITE associate to sequential access le with write access. READ, DIRECT associate to direct access le with read access. WRITE, DIRECT associate to direct access le with write access.
Additional Documentation Example associate(file_var,file_number,option_str) Illustration Suppose examp_file is an opened logical le of char with three components.
Additional Documentation close Usage close(f) close(f, t) Parameters f A variable of type le. f may not be omitted. t Options string that may be a string or PAC expression whose value is implementation dependent. Refer to the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide , depending on your implementation, for more information. Description The procedure close(f) closes the le f so that it is no longer accessible.
Additional Documentation disassociate Usage disassociate(f) Parameter f A variable of type le. Description This procedure removes the logical-physical le association that was previously created with the associate procedure. Consequently, the le f is no longer available to Pascal input and output routines. Normally a le is closed upon exit from the block in which it is declared.
Additional Documentation eof Usage eof(f) eof Parameter f A variable of type le that must be open. If f is omitted, the system uses the standard le input . Description This Boolean function returns true if the end of a le is reached. If the le f is open, the Boolean function eof(f) returns true when f is in the output state, when f is in the direct access state, and its current position is greater than the highest-indexed component ever written to f , or when no component remains for sequential input.
Additional Documentation eoln Usage eoln(f) eoln Parameter f A variable of type TEXT opened in the input state. If f is omitted, the system uses the standard le input . Description This Boolean function returns true when the end of a line is reached in a text le. This happens when the current position of text le f is at an end-of-line marker. The function references the bu er variable f ^, possibly causing an input operation to occur.
Additional Documentation get Usage get(f) get Parameter f A variable of type le opened in input or direct access state. If f is omitted, the system uses the standard le input . Description The procedure get(f) advances the current le position and causes a subsequent reference to the bu er variable f^ to actually load the bu er with the current component. This de nition of get is known as the deferred get. It is an error if f is in the output state or if eof(f) is true prior to the call to get.
Additional Documentation Illustration Suppose examp_file is a logical le of char with three components which has just been opened in the direct state. The current position is the rst component and examp_file^ is unde ned. To inspect the rst component, get is called. The current position is unchanged. Now, however, a reference to examp_file^ loads the rst component into the bu er. We assign the bu er to a variable.
Additional Documentation lastpos Usage lastpos(f) Parameter f A variable of type le opened in the direct access state. f must be speci ed. Description The function lastpos(f) returns the integer index of the last component of f that has been accessed while the program has been running, or in the life of the le. It is an error if f is not opened as a direct access le.
Additional Documentation linepos Usage linepos(f) Parameter f A text le variable that must be opened. f may not be omitted. The program must specify the standard les input and output by name. Description The function linepos(f) returns the integer number of characters read from or written to the text le f since the last end-of-line marker. This does not include the character in the bu er variable f ^.
Additional Documentation maxpos Usage maxpos(f) Parameter f A le variable that must be opened in the direct access state where f may not be omitted. Description The function maxpos(f) returns the integer index of the last component of f that the program could possibly access. An error occurs if f is not opened as a direct access le. Note that the value returned is implementation de ned.
Additional Documentation open Usage open(f) open(f, s) open(f, s, t) Parameters f A le variable that is not a text le. s The name of a physical le that the system associates with f . t A string or PAC expression whose value is implementation dependent. See the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide, depending on your implementation, for more details. Description The procedure open(f) opens f in the direct state and places the current position at the beginning of the le.
Additional Documentation Example open(file_var) open(file_var,phys_file_string) open(file_var,phys_file_string,opt_str) open(file_var,'TESTFILE') Illustration Suppose examp_file is a le of integer with three components.
Additional Documentation overprint Usage overprint(f) overprint(f, e) overprint(f, e1, ..., en) overprint overprint(e) overprint(e1, ..., en) Parameters f A text le variable that must be opened. If f is omitted, the system uses the standard le output . e An expression of simple, string, or PAC type, or a string literal. The system writes the value of e on f according to the formatting conventions described for the procedure write .
Additional Documentation page Usage page(f) page Parameter f A text le variable that must be open. If f is omitted, the system uses the standard le output . Description The procedure page(f) writes a special character to the text le f , which causes the printer to skip to the top of the form when f is printed. The current position in f advances, and the bu er variable f^ is unde ned.
Additional Documentation position Usage position(f) Parameter f A le variable that must not be a text le. Description The function position(f) returns the integer index of the current component of f , starting from 1. Input or output operations references this component. The parameter f must not be a text le.
Additional Documentation prompt Usage prompt(f) prompt(f, e) prompt(f, e1, ..., en) prompt prompt(e) prompt(e1, ..., en) Parameters f A text le variable. The system uses the standard le output if f is omitted. e The expression of any simple, string, or PAC type or string literal. Description The procedure prompt(f) causes the system to write any bu ers associated with text le f to the device. prompt does not write a line marker on f .
Additional Documentation put Usage put(f) put Parameter f A le variable opened in the output or direct access state. The system uses the standard le output if f is omitted. Description The procedure put(f) assigns the value of the bu er variable f^ to the current component and advances the current position. Following the call, f ^ is unde ned. It is an error if f is open in the input state.
Additional Documentation read Usage read(f,v) read(f, v1, ..., vn) read(v) read(v1, ..., vn) Parameters f A le variable opened in the input or direct access state. If f is omitted, the system uses the standard le input . v The name of a variable or component of a structure whose type is not FILE and does not contain a component of type FILE.
Additional Documentation Example read(file_var,variable) read(file,variable1,...,variablen) read(variable) read(variable1,...,variablen) Illustration Suppose examp_file is a le of char opened in the input state. The current position is at the second component.
Additional Documentation Implicit Data Conversion If f is a text le, its components are type char. The parameter, v , however, need not be of type char. It may be any simple, string, or PAC type, which is an HP extension. The read procedure performs an implicit conversion from the ASCII form that appears in the text le f to actual form stored in the variable v .
Additional Documentation Table 10-2 shows the results of calls to read with various sequences of characters for di erent types of v . Table 10-2. Implicit Data Conversion Type of v Sequence of Characters in f Following Current Position Result Stored in v (space)(space)1.850 real 1.850 (space)(linemarker)(space)1.850 longreal 1.850 10000(space)10 integer 10000 8135(end-of-line) integer 8135 54(end-of-line)36 integer 54 1.583E7 real 1.583x10(7) 1.583E+7 longreal 1.
Additional Documentation readdir Usage readdir(f, k, v) readdir(f, k, v1, ..., vn) Parameters f A le variable open to read that is not a text le. k The index of a component in f . v The name of a variable or component of a structure whose type is not FILE and does not contain a component of type FILE. Description The procedure readdir(f, k, v) places the current position at component k , and then reads the value of that component into v . The index, k , is relative to the beginning of the le.
Additional Documentation Illustration Suppose examp_file is a le of integer with four components just opened in the direct access state. The current position is the rst component. To read the third component into int_var, readdir is called. After readdir executes, the current position is the fourth component.
Additional Documentation readln Usage readln(f) readln(f, v) readln(f, v1, ..., vn) readln readln(v) readln(v1, ..., vn) Parameters f A text le variable. The system uses the standard le input if f is omitted. v The name of a variable or component of a structure whose type is not FILE and does not contain a component of type FILE. Description The procedure readln(f) reads zero or more values from a text le and then advances the current position to the beginning of the next line.
Additional Documentation reset Usage reset(f) reset(f, s) reset(f, s, t) Parameters f A le variable that may not be omitted. s The name of a physical le that the system associates with f . s may be a string or PAC expression. t An options string that may be a string or PAC expression whose value is implementation dependent. Description The procedure reset(f) opens the le f in the input state and places the current position at the rst component. The contents of f , if any, are undisturbed.
Additional Documentation Illustration Suppose examp_file is a closed le of char with three components.
Additional Documentation rewrite Usage rewrite(f) rewrite(f, s) rewrite(f, s, t) Parameters f A le variable that may not be omitted. s The name of a physical le the system associates with f . t May be a string or PAC expression whose value is implementation dependent. Description The procedure rewrite(f) opens the le f in the output state and places the current position at the rst component. The system discards any previously existing components of f .
Additional Documentation Illustration Suppose examp_file is a closed le of char with three components. To discard these components and write sequentially to examp_file, rewrite is called.
Additional Documentation seek Usage seek(f, k) Parameters f A le variable that must be opened in the direct access state. It may not be a text le. k The integer index of a component of f . This must be an integer expression >0. Description The procedure seek(f, k) places the current position of f at component k . If k is greater than the index of the highest-indexed component ever written to f , the function eof(f) returns true, otherwise false.
Additional Documentation write Usage write(f, e) write(f, e1, ..., en) write(e) write(e1, ..., en) Parameters f A le variable that must be open in the output or direct access state. e A variable or expression whose type is not FILE and which does not contain a component of type FILE. Description The procedure write(f, e) assigns the value of e to the current component of f and then advances the current position. After the call to write, the bu er variable f ^ is unde ned.
Additional Documentation Illustration Suppose examp_file is a le of integer opened in the output state, and that one number has been written to it.
Additional Documentation Formatting of Output to Textfiles When f is a text le, the result type of e need not be char. It may be any simple, string, or PAC type, or a string literal. The value of e may be formatted as it is written to f using the integer eld-width parameters m and, for real or longreal values, n . If m and n are omitted, the system uses default formatting values.
Additional Documentation When m is speci ed and the value of e requires less than m characters for its representation, the operation writes e on f preceded by an appropriate number of blanks. If the value of e is longer than m , it is written on f without loss of signi cance; such that m is defeated, provided that e is a numeric type. Otherwise, the operation writes only the leftmost m characters. m may be 0 if e is not a numeric type. When e is type real or longreal, you may specify n as well as m .
Additional Documentation Example PROGRAM show_formats (output); VAR x: real; lr: longreal; george: boolean; list: (yes, no, maybe); BEGIN writeln(999); {default formatting} writeln(999:1); {format defeated} writeln('abc'); writeln('abc':2); {string literal truncated} x:= 10.999; writeln(x); {default formatting} writeln(x:25); writeln(x:25:5); writeln(x:25:1); writeln(x:25:0); lr:= 19.
Additional Documentation writedir Usage writedir(f, k, e) writedir(f, k, e1, ..., en) Parameter f A le variable opened in direct access state. k The integer index of a component of f . e An expression whose result type must be assignment compatible with the components of f. Description The procedure writedir(f, k, e) places the current position at the component of f speci ed by k , and then writes the value of e to that component.
Additional Documentation writeln Usage writeln(f) writeln(f, e) writeln(f, e1, ..., en) writeln writeln(e) writeln(e1, ..., en) Parameters f A le variable for a text le opened in the output state. The system uses the standard le output if f is omitted. e A variable or expression whose type is not FILE and does not contain a component of type FILE.
11 System Programming Extensions This chapter describes extensions to HP Pascal for systems programming. The following subjects are covered: pointers type coercion error handling parameter mechanisms crunched packing routine mechanisms prede ned routine Some HP implementations of Pascal do not support all of these features.
Additional Documentation Figure 11-1 illustrates the relationship between the STANDARD LEVEL parameters. Figure 11-1. Relationship of STANDARD LEVEL Compiler Option Parameters The STANDARD LEVEL compiler option allows the user to choose one of ve options which speci es what features or extensions are to be allowed in a given program. The ve options correspond to sets which have the relationship depicted in Figure 11-1 above.
Additional Documentation ISO Conformant Arrays HP PASCAL Blank padding of PACs and string literals. Compiler Directives: EXTERNAL INTRINSIC Command line parameter handling.
Additional Documentation HP PASCAL (continued) Constant expressions. Enumerated type, string, PAC I/O. * File attribute options to: append close open reset rewrite Functions and procedures returning structured types. * Libraries. Literal control characters delimited by #. * Modules. * OTHERWISE in CASE statement.
Additional Documentation HP MODCAL ANYVAR parameters. Compiler Options: TYPE COERCION (MPE/iX,HP-UX) Error handling with: escape escapecode TRY-RECOVER Procedure and Function Types and Variables. Special Prede ned Routines: addr call EXT fcall statement_number MODCAL CRUNCHED packing.
Additional Documentation Language Elements Reserved Words The following words are added to the HP Pascal list of reserved words when the system programming extensions are enabled: Table 11-1. System Programming Extension Reserved Words Description Reserved Word ANYVAR Routine formal parameter. CRUNCHED Structure packing type parameter. READONLY Routine formal parameter. RECOVER Error recovery statement keyword. TRY Error recovery statement keyword. OPTION Routine option attribute header.
Additional Documentation Predefined Identifiers The system programming extensions add the following identi ers to the HP Pascal list of prede ned identi ers. The compiler issues warning messages if it encounters these identi ers and the standard level is too low. Like any prede ned identi ers, these identi ers may be rede ned by the user. Table 11-2.
Additional Documentation Data Types Figure 11-2 summarizes the types that are supplied by the system programming extensions. A detailed discussion of the data types follows in this chapter. This gure augments the HP Pascal data types summarized in Figure 11-1. Note that the HP Pascal prede ned data types are highlighted. Figure 11-2.
Additional Documentation Structured Types CRUNCHED In Pascal, a structure (array, record, or set) can be unpacked or packed. Packed structures are declared by specifying the reserved word PACKED at the start of a structured type declaration. The system programming extensions de ne a third type of packing in addition to unpacked and packed, namely CRUNCHED.
Additional Documentation The rst declaration for rec in the previous example may lead to the following storage allocation for an arbitrary processor: Figure 11-3. Layout of a Record Note that there are unused bits between the elds a and b, and between the elds b and c. The crunched record declaration for crec, that is identical to the uncrunched record rec with the addition of the reserved word CRUNCHED, would lead to the following storage allocation: Figure 11-4.
Additional Documentation Table 11-3 shows the lower and upper bound ranges and number of bits allocated for unsigned subranges. Table 11-4 gives the same information for signed subranges. Table 11-3. Number of Bits Allocated for Unsigned Subranges Lower Bound Range >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Upper Bound Range 0..1 2..3 4..7 8..15 16..31 32..63 64..127 128..255 256..511 512..
Additional Documentation Table 11-4. Number of Bits Allocated for Signed Subranges Lower Bound Range -1 -2 -4..-3 -8..-5 -16..-9 -32..-17 -64..-33 -128..-65 -256..-129 -512..-257 -1024..-513 -2048..-1025 -4096..-2049 -8192..-4097 -16384..-8193 -32768..-16385 -65536..-32769 -131072..-65537 -262144..-131073 -524288..-262145 -1048576..-524289 -2097152..-1048577 -4194304..-2097153 -8388608..-4194305 -16777216..-8388609 -33554432..-16777217 -67108864..-33554433 -134217728..-67108865 -268435456..
Additional Documentation Example TYPE cr1_t = f1 : f2 : f3 : f4 : END; cr2_t = f1 : f2 : f3 : END; CRUNCHED RECORD 0..15; -1..15; -16..15; 13..15; CRUNCHED CRUNCHED CRUNCHED CRUNCHED RECORD set of 0..15; set of 13..15; set of -5..
Additional Documentation Pointer Types In HP Pascal, pointers are designators that point only to a speci c class of objects , namely objects on the heap . When using the system programming extensions, pointers can point to any data; that is, objects on the heap, as well as global and local variables. In this sense pointers truly are addresses. In HP Pascal, the only way to create a pointer is by calling the prede ned procedure NEW or the intrinsic p_getheap to dynamically allocate a heap object.
Additional Documentation Localanyptr The prede ned type localanyptr is a pointer type that is assignment compatible with any other pointer type. It can be used to defeat type checking on pointers. A pointer of any type can be assigned to a pointer of type localanyptr, and a pointer of type localanyptr can be assigned to any pointer type. However, since pointers of type localanyptr are not bound to a base type, they cannot be dereferenced.
Additional Documentation Globalanyptr The prede ned type globalanyptr is a pointer type that is assignment compatible with any other pointer type. It can be used to defeat type checking on pointers. A pointer of any type can be assigned to a pointer of type globalanyptr , and a pointer of type globalanyptr can be assigned to any pointer type. However, since pointers of type globalanyptr are not bound to a base type, they cannot be dereferenced.
Additional Documentation Anyptr The prede ned type anyptr is a pointer type that is assignment compatible with any other pointer type. It can be used to defeat type checking on pointers. A pointer of any type can be assigned to a pointer of type anyptr, and a pointer of type anyptr can be assigned to any pointer type. However, since pointers of type anyptr are not bound to a base type, they cannot be dereferenced.
Additional Documentation Example VAR ptr1 ptr2 : pointer_type_1; : pointer_type_2; PROCEDURE proc( ptr : anyptr ); BEGIN ... END; BEGIN proc( ptr1 ); proc( ptr2 ); END; In the above example, the routine proc can accept any pointer as an actual parameter because the type of the formal parameter is anyptr. anyptr is assignment compatible with any pointer type.
Additional Documentation PROCEDURE and FUNCTION Types In Pascal, PROCEDURE and FUNCTION parameters allow dynamic reference to procedures and functions where the exact instance of the procedure or function is not known until run-time. The system programming extensions extend this concept to allow variables as well as parameters that refer to procedures and functions. Syntax A parallel can be drawn between pointers and PROCEDURE/FUNCTION variables.
Additional Documentation Permissible Operators assignment relational := =, <> Standard Procedures argument CALL Standard Functions argument return FCALL ADDR Example TYPE proc_0_type func_0_type proc_1_type func_2_type VAR proc_0 func_0 proc_1 func_2 : : : : = = = = PROCEDURE; FUNCTION: integer; PROCEDURE( ANYVAR i : integer ); FUNCTION( VAR s : string; i : integer ): boolean; proc_0_type; func_0_type; proc_1_type; func_2_type; PROCEDURE p1; external; PROCEDURE p2( n : shortint ); external; PRO
Additional Documentation Example TYPE proc_type = PROCEDURE; VAR proc_var_0 : proc_type; PROCEDURE proc_1; VAR proc_var_1 : proc_type; PROCEDURE proc_2; BEGIN {PROCEDURE proc_2} ...
Additional Documentation Expressions Type Coercion Pascal is very strict with respect to type checking. In any operation such as assignment, binary operations, passing parameter, or indexing, relevant types must be compatible according to the HP Pascal rules of compatible types. Refer to \Type Compatibility" in Chapter 3 for more information. Type coercion allows the user to selectively circumvent the normally strong type checking.
Additional Documentation Ordinal Type Coercion The ordinal types are viewed as di erent sets of names for the points on the integer number line. Given this view of ordinals, value type coercion of one ordinal type to another is simply a renaming operation.
Additional Documentation Pointer Type Coercion The pointer types are viewed as virtual addresses. Given this view, value type coercion from one pointer type to another is a mapping from one virtual address to another. On implementations that have alignment restrictions, it is an error if the alignment of the type that the source expression points to is smaller than the alignment of the type that the target type points to. If range checking is on, this causes a run-time error.
Additional Documentation Other Type Coercion All type coercions that do not fall under the categories of ordinal and pointer type coercion can be viewed as the use of a free union, or tagless variant record, where the implementation overlays the record variants onto the same storage area.
Additional Documentation Structural. A type coercion expression is considered to be structural if the following are true: The bitsizes of the source and target types are the same. The alignment of the source and target types are the same. The source and target types are compatible. If the source and target are structured, then the corresponding component in the two structures obey the above three rules of bitsizes, alignment and compatibility.
Additional Documentation Representation. A type coercion expression is considered to be representation type coercion if the bitsizes of the source and target types are the same. The internal structure of structured types for either the source or target does not matter. Representation type coercions are enabled by specifying 'REPRESENTATION' in the compiler option TYPE_COERCION . Example $STANDARD_LEVEL 'HP_MODCAL'$ PROCEDURE write_hex( n : integer ); TYPE nibble_array = PACKED ARRAY[0..7] OF 0..
Additional Documentation Storage. A type coercion expression is considered to be storage type coercion, if the size of the storage allocated for the source is greater than the size of the storage allocated for the target type. Storage type coercion guarantees that no nonexistent memory is accessed and that no unde ned bits are accessed. The following illustrates storage type coercion.
Additional Documentation Noncompatible. Noncompatible type coercion permits anything to be coerced to anything. There is no guarantee that the accessed storage exists, nor that there is any accessible storage. Example FUNCTION non_protected_space: integer; TYPE big_index = 0..
Additional Documentation Declaration Section Constant Definition NIL The de nition of the prede ned constant NIL is expanded for the system programming extensions. The prede ned constant NIL is compatible with any long or short pointer type. When NIL is used in a comparison or assignment, it assumes the pointer class (short or long) of the pointer with which it is being compared, or to which it is being assigned. The prede ned constant NIL is compatible with any PROCEDURE/FUNCTION type.
Additional Documentation Statements TRY-RECOVER A Pascal program that encounters a run-time error is aborted. Because this is not always acceptable, the system programming extensions de ne the TRY-RECOVER structured statement that allows the user to trap all run-time errors. The prede ned procedure escape allows the user to cause a run-time error to occur, and the prede ned function escapecode allows the user to determine the last type of error that occurred.
Additional Documentation The semantics of the TRY-RECOVER statement do not guarantee that the e ects of any statements executed in the body of the TRY are valid when executing the RECOVER statement. Certain implementations, however, may guarantee that the e ects of any executed statements are valid. Certain other implementations may provide the user with a method of indicating that certain variables preserve their value.
Additional Documentation In the previous example, any errors occurring in the TRY-RECOVER in proc1 cause execution to be transferred to the recover part of the try statement in proc1. Any errors occurring in the TRY-RECOVER in the outer block, in the recover statement in proc1, and outside of the TRY-RECOVER in proc1 cause execution to be transferred to the recover part of the try statement in the outer block.
Additional Documentation Procedures and Functions The system programming extensions de ne two new formal parameter mechanisms in addition to Pascal value and VAR formal parameters. These mechanisms are ANYVAR and READONLY. The system programming extensions also de ne an extension to the procedure and function header syntax for specifying additional attributes of a procedure or function. This extension is routine options .
Additional Documentation Example TYPE byte = 0..255; byte_array = PACKED ARRAY [1..max_bound] OF byte; VAR int : integer; rec : record_type; PROCEDURE zero_bytes( ANYVAR arr : byte_array ); VAR i : 0..max_bound; limit : 1..
Additional Documentation READONLY This formal parameter mechanism protects the actual parameter from modi cation within the procedure or function. A formal READONLY parameter may not be: The target of an assignment statement. Passed as an argument to a VAR or ANYVAR parameter. Passed as an argument to the addr prede ned function. Passed as an argument to any prede ned routine that modi es that argument.
Additional Documentation Example PROCEDURE proc1; VAR j : integer; PROCEDURE proc2 ( READONLY j : integer VAR m : integer ); BEGIN j := 0; m := 0; END; { modification by an uplevel reference } { modification by another reference parameter } BEGIN proc2 ( j,j ); END; The above example creates undetected errors.
Additional Documentation Routine Options The routine options specify additional attributes of a procedure or function. The routine options follow the parameter list in the declaration of a procedure or function header. $STANDARD_LEVEL 'EXT_MODCAL'$ must be speci ed when using routine options. Syntax The option-speci cation for each option is described in the following pages.
Additional Documentation DEFAULT PARMS Normally, all parameters appearing in a formal parameter list must be present in every corresponding actual parameter list. The routine option DEFAULT_PARMS allows parameters to be omitted from the actual parameter list. The option speci es which parameters may be omitted, and the default values that the omitted parameters will assume.
Additional Documentation EXTENSIBLE Normally, all parameters appearing in a formal parameter list must be present in a corresponding actual parameter list. The routine option EXTENSIBLE allows parameters to be omitted from the end of an actual parameter list. The option speci es the number of non-extension parameters (those that must be supplied) in the actual parameter list. The remaining trailing parameters may be omitted.
Additional Documentation INLINE The option INLINE speci es that the code for a procedure or function be expanded in line wherever it is invoked. This expansion removes most procedure call overhead and increases the amount of object code generated. Value parameters work the same with INLINE, that is, an assignment to a value parameter inside an inlined routine does not result in the modi cation of the actual parameter.
Additional Documentation UNCHECKABLE ANYVAR By default, every ANYVAR parameter is accompanied by a hidden size parameter that indicates the size of the actual parameter. The purpose of this parameter is to allow the routine with the formal ANYVAR parameter to verify that a reference to the formal parameter is within the bounds of the actual parameter by prede ned size functions such as sizeof.
Additional Documentation UNRESOLVED Procedure option UNRESOLVED denotes a procedure or function that is left unresolved by both the linker and the loader. The resolution of the symbolic name to its reference part is delayed until the procedure or function is used. The suggested way to use this kind of procedure or function is to use the prede ned function addr to determine if it can be resolved. NIL is returned if it cannot. This procedure option can be speci ed only on level one procedures or functions.
Additional Documentation Predefined Routines The system programming extensions de ne the following additional prede ned procedures and functions. Addressing and Pointers Addr The prede ned function addr allows the user to create references to routines or data. Usage addr(variable) addr(variable,o set) addr(routine-name) Parameters variable A variable or reference parameter, or a component of an unpacked structured variable or reference parameter.
Additional Documentation Example $STANDARD_LEVEL 'HP_MODCAL', TYPE_COERCION 'CONVERSION'$ TYPE p_to_p_type = ^ p_to_p_type; VAR p_to_p : p_to_p_type; BEGIN p_to_p := addr( p_to_p ); p_to_p := p_to_p_type( addr( p_to_p^, sizeof( p_to_p^ ) ) )^; END The rst assignment points the pointer p_to_p to itself.
Additional Documentation Addtopointer The prede ned function addtopointer allows the user to perform address arithmetic with pointers. Usage addtopointer(pointer, delta) Parameters pointer delta A pointer expression. A signed integer expression whose range restriction is implementation dependent. Description Addtopointer returns a pointer value that points delta bytes away from where the argument pointer pointed.
Additional Documentation Buildpointer The prede ned function buildpointer allows the user to construct pointer values. Usage buildpointer(space,o set) Parameters space A space identi er whose range restriction and semantics are implementation dependent. A bit32 expression whose range restriction is implementation dependent. o set Description buildpointer returns a pointer of type globalanyptr whose value is the address o set bytes into space .
Additional Documentation Move Routines The system programming extensions provide the prede ned procedures move_l_to_r, move_r_to_l , fast_fill, and move_fast for generalized and e cient data copying. Move L to R The prede ned procedure move_l_to_r provides a generalized array copying mechanism. Usage move_l_to_r(count,source,source index,target,target index) Parameters count source source index target target index A positive integer expression whose value is the number of elements to move.
Additional Documentation The following diagram shows the order of copying elements for move_l_to_r. Figure 11-6. Copying Order for move l to r Example TYPE Index_Type_1 = 0..20; Index_Type_2 = -3..
Additional Documentation Move R to L The prede ned procedure move_r_to_l provides a generalized array copying mechanism. Usage move_r_to_l(count,source,source index,target,target index) Parameters count source source index target target index A positive integer expression whose value is the number of elements to move. The source array from where elements will be moved. An integer expression whose value is the index into the source array from where the move will begin.
Additional Documentation Fast Fill The prede ned procedure fast_fill provides a generalized method of initializing an array to a single 8 bit constant. Usage fast_fill (ptr, ll char,count); Parameters ptr ll char count A pointer expression. A constant expression. A positive integer expression that contains the number of bytes to ll with ll char .
Additional Documentation Move Fast The prede ned procedure move_fast provides another generalized array copying mechanism. Usage move_fast(count,source,source index,target,target index) Parameters count source source index target target index A positive integer expression whose value is the number of elements to move. The source array from where elements will be moved. An integer expression whose value is the index into the source array of the leftmost element to be moved.
Additional Documentation Example f This example assumes certain packing which may not apply to your implementation. g TYPE IxType1 = 0..20; IxType2 = -3..17; Array1 Array2 Array3 Array4 VAR Avar1 Avar2 Avar3 Avar4 Ix = = = = : : : : : PACKED ARRAY [IxType1] of SHORTINT; ARRAY [IxType2] of SHORTINT; PACKED ARRAY [1..20] of -256..255; CRUNCHED ARRAY [1..20] of -256..
Additional Documentation Error Handling Routines Escape Usage escape(escape value) Parameters escape value An integer expression whose value will be available through the prede ned function escapecode. Description Calling this prede ned procedure indicates that a software error has been detected. Execution passes to the statement following the reserved word RECOVER of the rst enclosing TRY-RECOVER statement.
Additional Documentation Escapecode The prede ned function escapecode returns the last execution error number. Usage escapecode The function returns the value passed to the last implicit or explicit call to the prede ned procedure escape. An explicit call to escape is a call that was made by the user. In this case escapecode returns the value of the escape code passed by the user. An implicit call to escape is a call that was made by a subsystem on the user's behalf or by the run-time library.
Additional Documentation Parameter Mechanisms Haveextension The prede ned Boolean function haveextension determines if an extension parameter is accessible. Usage haveextension(parameter name) Parameters parameter name The name of a formal parameter in the current scope or a containing scope that is EXTENSIBLE.
Additional Documentation In the rst call to proc_with_opt_parms, both calls to haveextension return false because none of the extension parameters are passed. In the second call, haveextension returns true for the third parameter only. PROCEDURE proc_with_opt_parms( parm1 VAR parm2 parm3 VAR parm4 : : : : OPTION EXTENSIBLE 2 DEFAULT_PARMS ( parm3 := 0, parm4 := nil type1; type2; type3; type4 ) ); BEGIN ... IF (haveextension( parm3 )) THEN ... IF (haveextension( parm4 )) THEN ... ...
Additional Documentation Haveoptvarparm The prede ned Boolean function haveoptvarparm determines if a default reference parameter is accessible. Usage haveoptvarparm(parameter name) Parameters parameter name The name of a default formal parameter of this or a containing scope. In a routine with default reference parameters, it may be necessary to check a formal parameter to ensure that its actual parameter was supplied by the user.
Additional Documentation Routine Mechanisms Call The prede ned procedure call invokes a procedure. Usage call(procedure expression) call(procedure expression,parameter ...) Parameters procedure expression parameter An expression whose value is a reference to a procedure whose formal parameter list is congruent with the parameters speci ed in the call.
Additional Documentation Fcall The prede ned function fcall invokes a function. Usage fcall(function expression) fcall( function expression, parameter ... ) Parameters function expression parameter An expression whose value is a reference to a function whose formal parameter list is congruent with the parameters speci ed in the call. An actual parameter that is compatible with the corresponding formal parameter of the FUNCTION type of function expression , that is passed to the invoked function.
Additional Documentation Size Functions Bitsizeof The prede ned function bitsizeof returns an integer representing the size of its argument in bits. Usage bitsizeof(variable) bitsizeof(record variable,tag value ...) bitsizeof(type name) bitsizeof(record type name,tag value ...) bitsizeof(struc constant) bitsizeof(string literal) Parameters variable record variable tag value The name of a variable. The name of a record variable with variants.
Additional Documentation Example TYPE int_type = integer; rec_type = RECORD int : integer; CASE flag: Boolean OF true: ( r : real ); false:( lr : longreal ); end; VAR int : int_type; rec : rec_type; size : integer; BEGIN ... size := bitsizeof( int ); size := bitsizeof( int_type ); size := bitsizeof( rec, true ); ... END; Note 11-62 bitsizeof is allowed in CONST declarations except for ANYVAR, VAR string, and conformant array parameters.
Additional Documentation Sizeof The prede ned function sizeof returns an integer representing the size of its argument in bytes. Usage sizeof(variable) sizeof(record variable,tag value ...) sizeof(type name) sizeof(record type name,tag value ...) sizeof(struct constant) sizeof(string literal) Parameters variable record variable tag value The name of a variable. The name of a record variable with variants. The name of a case constant in the variant part of a record declaration.
Additional Documentation Example TYPE byte = 0..255; big_record = RECORD CASE Boolean OF true: ( arr : array [ 1..200 ] of byte ): false: ( f1 : integer; ... f99 : char ); BEGIN ... IF (sizeof(big_record,true) <> sizeof(big_record,false)) THEN BEGIN writeln ( 'variant size mismatch by', abs(sizeof(big_record,true)-sizeof(big_record,false)):1, 'bytes' ); HALT (1); END; ... END. Note 11-64 sizeof is allowed in CONST sections except for ANYVAR, VAR s, and conformant array parameters.
12 Compiler Options Introduction This chapter explains every HP Pascal compiler option. Compiler options fall into two categories: system-independent and system-dependent. System-independent options work the same way whether HP Pascal is running on the MPE/iX operating system or the HP-UX operating system. System-dependent options either work on only one operating system, or they work di erently on HP-UX and MPE/iX. The following table categorizes the compiler options.
Additional Documentation Each compiler option entry in this chapter gives the option's default value (if any) and location. Table 12-1 de nes the terms that describe option location (in terms of both option location and scope). Table 12-1. Compiler Option Locations and Scopes Location Term Option Location Option Scope Anywhere. Anywhere in the program. Depends upon the option. At front. Before PROGRAM or MODULE in the source le. Applies to the entire source le. Not in body.
Additional Documentation System-Independent Options System-independent options work the same way whether HP Pascal is running on the MPE/iX operating system or the HP-UX operating system.
Additional Documentation The following table categorizes the system-independent compiler options.
Additional Documentation HP Standard Options HP Standard compiler options are available on all versions of Pascal that run on HP computers. They are part of the HP Standard. An HP Pascal program containing only HP Standard options can be compiled by any Pascal compiler that runs on an HP computer. HP Pascal Options HP Pascal compiler options are not required by the HP Standard, but are available in HP Pascal. An HP Pascal program containing HP Pascal options must be compiled by the HP Pascal compiler.
Additional Documentation System-Dependent Options System-dependent options either work on only one operating system, or they work di erently on HP-UX and MPE/iX. Figure 12-2 diagrams the three categories of system-dependent options. Figure 12-2.
Additional Documentation System-wide File The compiler looks for a system-wide le called PASCNTL.PUB.SYS on MPE/iX or /usr/lib/pasopts on HP-UX. If the le exists and is not empty, the compiler opens and reads the le. The le should contain only compiler options and comments. If there is anything else in the le, the compiler emits an error message. On MPE/iX the message is: ONLY COMMENTS AND COMPILER OPTIONS ARE ALLOWED IN `PASCNTL.PUB.
ALIAS ALIAS is an HP Pascal Option. The ALIAS compiler option speci es an external name for a procedure, function, or global variable. Syntax $ALIAS 'string'$ Parameter string Default Location The external name. The compiler does not distinguish between uppercase and lowercase letters. By default, the external name is downshifted. The LITERAL ALIAS compiler option allows the external name to remain as it is. The UPPERCASE compiler option upshifts the external name.
ALIAS Example 2 PROGRAM show_alias; . . PROCEDURE $ALIAS 'intrinname'$ A; INTRINSIC; {One intrinsic } PROCEDURE $ALIAS 'intrinname'$ B; INTRINSIC; {has two internal} {names, A and B } . . PROCEDURE $ALIAS 'x''x'$ xx; INTRINSIC; {The intrinsic name} {x'x is illegal in Pascal} . . PROCEDURE proc1; FUNCTION $ALIAS 'D1'$ do_it (n : INTEGER): BOOLEAN; BEGIN {do_it} . . END; {do_it} BEGIN {proc1} . . END; {proc1} PROCEDURE proc2; FUNCTION $ALIAS 'D2'$ do_it (a,b : INTEGER): INTEGER; BEGIN {do_it} . .
ALIAS Example 3 PROGRAM show_alias; FUNCTION $ALIAS 'f'$ f1 (p1 : integer); EXTERNAL; FUNCTION $ALIAS 'f'$ f2 (p1,p2 : integer); EXTERNAL; BEGIN . . . END. Notice that the function f1 declares one parameter of the function f, while the function f2 declares two.
ALIGNMENT ALIGNMENT ALIGNMENT is an HP Pascal Option. The ALIGNMENT compiler option speci es the alignment requirements for a type (for the de nition of alignment see Chapter 5). It cannot be used with string or le types. The alignment of a record or array must be at least as large as its largest eld or element. ALIGNMENT does not support alignments greater than 8 bytes for variables. Only elds are aligned greater than 8 bytes.
ANSI ANSI is an HP Standard Option. When the ANSI compiler option is ON, the compiler issues an error whenever it encounters a feature in the source code that is illegal in ANSI Standard Pascal. The compiler compiles the illegal feature if possible; otherwise it is a syntax error. The error appears in the listing. The command line option -A also speci es this option. Syntax $ANSI Default Location ON $ OFF OFF Anywhere. The options $ANSI ON$ and $STANDARD_LEVEL 'ANSI'$ are equivalent.
ARG RELOCATION ARG RELOCATION ARG RELOCATION is an HP Pascal Option. The ARG RELOCATION option can be used to suppress parameter relocation information for all procedure or function de nitions and calls. This option is only useful for REAL and LONGREAL data types. Syntax $ARG_RELOCATION ON OFF $ Parameters ON OFF Default Location Relocation information is generated for parameters and function returns.
ARG RELOCATION Example $ARG_RELOCATION OFF$ program args; procedure p_r(x : real); external; begin p_r(1.5); end. Caution 12-14 If the ARG RELOCATION is used improperly, unexpected results may occur. Refer to the Procedure Calling Conventions Reference Manual for detailed information on how to use this option.
ASSERT HALT ASSERT HALT ASSERT HALT is an HP Pascal Option. The ASSERT HALT compiler option works with the prede ned function assert . IF an assert fails (that is, if its Boolean expression is false), and ASSERT HALT is ON, the program terminates. If ASSERT HALT is OFF, the program continues to execute. See the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide . Syntax $ASSERT_HALT Default Location ON $ OFF OFF Anywhere.
ASSUME ASSUME is an HP Pascal Option. The ASSUME compiler option speci es optimizer assumptions beyond those implied by the STANDARD LEVEL compiler option. It determines what the optimizer does, but it does not determine what the compiler accepts. If your program violates its optimizer assumptions, you can compile it with or without optimization; however, the optimized version may fail.
ASSUME The optimizer assumes that the actual parameters passed to the formal reference parameters do not overlap; that is, two formal parameters do not get the same actual parameter or the same eld of a record. (This is always true if the scope de nes only one reference parameter.) NO_PARMS_OVERLAP has no e ect without LOCAL_ACCESSES_ONLY . LOCAL_GOTOS_ONLY The optimizer assumes that no routine jumps to a label in a surrounding scope.
ASSUME Figure 12-3 shows how the parameters of the ASSUME compiler option are related. Figure 12-3. Relationships Between ASSUME Compiler Option Parameters * NO PARMS OVERLAP is ine ective without LOCAL ACCESSES. After compiling a routine, the compiler knows what it accesses and modi es, so the optimizer can derive the appropriate assumptions. Only exported, forward, and external routines require that you specify LOCAL GOTOS ONLY, LOCAL ACCESSES ONLY, NO SIDE EFFECTS, or NO HEAP CHANGES.
ASSUME Example 1 The following program skeleton demonstrates how to nest ASSUME options, using the PUSH and POP compiler options. $ASSUME 'PASCAL_FEATURES'$ PROGRAM prog ; LABEL 999 ; { Possible target for nonlocal GOTO } $PUSH$ $ASSUME 'NO_SIDE_EFFECTS'$ PROCEDURE extnl ; EXTERNAL ; { Optimizer assumes: { PASCAL_FEATURES (inherited) { NO_SIDE_EFFECTS (specified) } $POP$ $PUSH$ $ASSUME 'LOCAL_ACCESSES'$ $ASSUME 'LOCAL_GOTOS_ONLY'$ PROCEDURE intnl ; $PUSH$ $ASSUME 'NOTHING'$ { Optimizer assumes nothing.
ASSUME BEGIN {furthernested} { Modifying i violates NO_SIDE_EFFECTS } { Optimizer assumes: { PARM_TYPES_MATCH (inherited), { NO_SIDE_EFFECTS (specified) { NO_PARMS_OVERLAP (specified) { LOCAL_GOTOS_ONLY (known after compilation) } END ; {furthernested} $POP$ BEGIN {nested} { Optimizer assumes: { PARM_TYPES_MATCH (specified) { LOCAL_GOTOS_ONLY (known after compilation) } furthernested ; END ; {nested} $POP$ BEGIN {intnl} { Optimizer assumes: { PASCAL_POINTERS (inherited) { PARM_TYPES_MATCH (inherited) { LOC
ASSUME Example 2 The following example turns on the IEEE oating-point traps. (On HP-UX, the +FPZ option can be used instead of the call to HPENBLTRAP). This program would have aborted on the divide by 0 if the loop invariant expression was moved out of the loop. $ASSUME 'FLOAT_TRAPS_ON'$ $OPTIMIZE ON$ program trap; var r,s : real; i : integer; oldmask : integer; procedure hpenbltrap; intrinsic; begin hpenbltrap(hex('ffffffff'),oldmask); s := 0.0; r := 0.0; for i := 0 to 10 do begin if r <> 0.0 then s := 1.
BUILDINT BUILDINT is an HP Pascal Option. The BUILDINT compiler option causes the compiler to build an intrinsic le. Syntax $BUILDINT 'string'$ Parameter string Default Location Speci es the name of the intrinsic le that the compiler builds. If the speci ed le exists and is an intrinsic le, entries are added to it. If it exists, but is not an intrinsic le, it is an error. If the le does not exist, it is created (see the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide ).
BUILDINT Example $BUILDINT 'MYINTR'$ PROGRAM Show_Buildint; TYPE Smallint = -32768..32767; ByteArray = PACKED ARRAY [1..80] OF CHAR; RecType = RECORD F1 : Integer; F2 : ByteArray; END; PROCEDURE Proc1 ( EXTERNAL; P1 P2 VAR P3 VAR P4 P5 ); : : : : : Smallint; Integer; ByteArray; RecType; Real FUNCTION Func1 (P1 : Real) : Integer; EXTERNAL; BEGIN {Empty outer block} END. The BUILDINT compiler option is used with the LISTINTR and SYSINTR compiler options.
CALL PRIVILEGE and EXEC PRIVILEGE CALL PRIVILEGE and EXEC PRIVILEGE are System-Dependent MPE/iX Options. The CALL_PRIVILEGE and EXEC_PRIVILEGE compiler options allow routines to call and execute privileged mode routines. To use these compiler options, the option STANDARD_LEVEL 'EXT_MODCAL ' is required. The CALL_PRIVILEGE option speci es, for a given routine, the minimum privilege level that other routines must have to call the speci ed routine.
CALL PRIVILEGE and EXEC PRIVILEGE Example $STANDARD_LEVEL 'EXT_MODCAL'$ PROGRAM p; PROCEDURE proc1 $CALL_PRIVILEGE 1$ ( VAR i : integer); BEGIN END; PROCEDURE proc2 $EXEC_PRIVILEGE 2$ ( VAR i : integer); BEGIN END; PROCEDURE proc3 $CALL_PRIVILEGE 1$ $EXEC_PRIVILEGE 0$ ( VAR i: integer); BEGIN END; BEGIN END. Any routine calling procedure proc1 must execute at privilege level 1 or level 0. By default, proc1 executes at privilege level 3.
CHECK ACTUAL PARM CHECK ACTUAL PARM is an HP Pascal Option. The CHECK ACTUAL PARM compiler option determines how closely the actual parameters of routines must match their formal parameters in separately compiled sources. If the actual and formal parameters are incompatible, the linker does not link the program. Syntax $CHECK_ACTUAL_PARM integer$ Parameter integer In the range 0..3.
CHECK ACTUAL PARM Example PAGE 0 0 0 0 0 0 1 2 2 2 3 4 0 0 0 0 2 0 0 0 0 0 4 4 4 5 5 5 6 6 6 6 6 1 HEWLETT-PACKARD ... 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 9.000 10.000 11.000 12.000 13.000 14.000 15.000 16.000 17.000 18.000 19.000 20.000 21.000 22.000 23.000 24.000 24.000 25.000 26.000 27.000 28.000 29.000 30.000 31.000 32.000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 (C) HEWLETT-PACKARD CO. 1986 ...
CHECK FORMAL PARM CHECK FORMAL PARM is an HP Pascal Option. The CHECK FORMAL PARM compiler option determines how closely the formal parameters of a routine must match its actual parameters. If the formal and actual parameters are incompatible, the linker does not link the program. Syntax $CHECK_FORMAL_PARM integer$ Parameter integer In the range 0..3. Determines how the linker checks actual parameters against formal parameters, as follows: Value 0 1 2 3 Default Location The linker checks: Nothing.
CHECK FORMAL PARM Example PAGE 0 0 0 0 0 0 0 0 0 0 0 0 2 3 4 5 6 7 8 8 8 0 0 1 HEWLETT-PACKARD ... 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 9.000 10.000 11.000 12.000 13.000 14.000 15.000 16.000 17.000 18.000 19.000 20.000 21.000 22.000 23.000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 (C) HEWLETT-PACKARD CO. 1986 ...
CODE CODE is an HP Pascal Option. When the CODE compiler option is ON, the compiler generates object code after parsing a compilation block. The command line option -C also speci es this option. Syntax $CODE Default Location ON $ OFF ON Anywhere, but it a ects only the procedure, function, or outer block that contains it. The CODE option a ects an entire procedure, function, or outer block.
CODE OFFSETS CODE OFFSETS CODE OFFSETS is an HP Pascal Option. When the CODE OFFSETS compiler option is ON (and the LIST compiler option is ON), the compiler prints a table that contains the statement number and o set of each executable statement that it lists. Syntax $CODE_OFFSETS Default Location ON $ OFF OFF Anywhere. The o set is the address of the rst machine instruction generated for the statement, relative to the start of the routine or outer block. It is in hexadecimal.
CODE OFFSETS C O D E O F F S E T S PROGRAM STMT 5 10 15 OFFSET 70 1B0 3DC STMT 6 11 16 OFFSET 80 1B8 404 STMT 7 12 OFFSET 128 21C STMT 8 13 OFFSET 174 274 STMT 9 14 OFFSET 184 390 Example PROCEDURE outer; PROCEDURE inner; BEGIN . . . END; BEGIN . . . END; C O D E O F F S E T S outer$4$inner STMT 1 OFFSET 20 STMT 2 OFFSET 30 outer STMT 1 OFFSET 10 STMT 2 OFFSET 2C Outer$4$inner is the procedure label for the level two procedure, inner, contained in the level one procedure outer.
CONVERT MPE NAMES CONVERT MPE NAMES CONVERT MPE NAMES is a System-Dependent HP-UX Option. The CONVERT MPE NAMES compiler option converts le names in the BUILDINT, INCLUDE, LISTINTR, and SYSINTR compiler options from MPE format to HP-UX format. The command line option +C also speci es this option. Syntax $CONVERT_MPE_NAMES$ Default Location None. Anywhere. Fully quali ed HP-UX-format le names (those that begin with slash, like '/mnt/srf/file') are not converted.
COPYRIGHT COPYRIGHT is an HP Pascal Option. The COPYRIGHT compiler option puts a copyright notice in the relocatable object le and the program le. Syntax $COPYRIGHT 'string'$ Parameter string Default Location The name of the copyright owner, to appear in the copyright notice. The compiler distinguishes between uppercase and lowercase letters. None. At front. The copyright notice is: (C) Copyright date string by string. All rights reserved.
COPYRIGHT DATE COPYRIGHT DATE COPYRIGHT DATE is an HP Pascal Option. The COPYRIGHT DATE compiler option speci es the date that appears in the copyright notice. Syntax $COPYRIGHT_DATE 'date string'$ Parameter date string Speci es the date string to appear in the copyright notice, as follows: (C) Copyright date string by string. All rights reserved. No part of this program may be photocopied, reproduced, or transmitted without prior written consent of string.
ELSE ELSE is an HP Pascal Option. The ELSE compiler option speci es the code to be compiled when the Boolean expression in the IF compiler option has the value FALSE. See the IF option for more information. Syntax $ELSE$ Default Location Not applicable. Anywhere. Example 1 $SET 'group1=FALSE'$ . . . $IF 'group1'$ 2 6 6 4 source line . . . 3 7 7 5 $ELSE$ 2 6 6 4 source line . . . 3 7 7 5 $ENDIF$ In this example, the code following $ELSE is compiled because group1 is set to FALSE.
ELSE Example 2 $SET 'group3=true,group2=false;group1=false'$ . . . $IF 'group1'$ 2 6 6 4 source line . . . 3 78 9 7 group1 5 $ELSE$ $IF 'group2'$ 2 6 6 4 source line . . . 3 78 9 7 group2 5 $ELSE$ $IF 'group3'$ 2 6 6 4 source line . . . 3 78 9 7 group3 5 $ENDIF$ $ENDIF$ $ENDIF$ In this example, only group3 is compiled because it is set to true and group1 and group2 are set to false.
ENDIF ENDIF is an HP Pascal Option. The ENDIF compiler option ends the code to be conditionally compiled. See the IF compiler option for more information. Syntax $ENDIF$ Default Location Not applicable. Anywhere. Example $SET 'group1=true, group2=false'$ . . . $IF 'group1 AND (NOT group2)'$ 2 6 6 4 source line . . .
EXTERNAL EXTERNAL EXTERNAL is an HP Pascal Option. The EXTERNAL compiler option causes the compiler to generate code for routines, but not for statements in the outer block. It also generates symbolic information about global variables, allowing them to be matched (by external name) to their counterparts in the compilation unit compiled with the GLOBAL compiler option. (The EXTERNAL compiler option is used in compilation units compiled with the SUBPROGRAM compiler option.
EXTNADDR EXTNADDR is a System Programming Option. The EXTNADDR compiler option speci es that a pointer type or pointer variable is a long pointer, and a reference parameter is a long address. Syntax $EXTNADDR$ Default Location Not applicable. In a pointer type or variable declaration, between ^ or @ and the type name, or in a parameter list, between VAR, ANYVAR, or READONLY and the following parameter name.
FONT FONT FONT is a System-Dependent MPE/iX Option. The FONT compiler option speci es primary and secondary character sets to be used in the title and comments in the listing (provided that the printer supports multiple fonts, as the HP268x laser printers do.) Syntax $FONT 'string'$ Parameter string Is of the form: primary font,secondary font Where: primary font Is an unsigned integer that sets the number for the primary font.
GLOBAL GLOBAL is an HP Pascal Option. The GLOBAL compiler option causes the compiler to generate code for the entire compilation unit (including the outer block) and symbolic information about global variables that allows them to be matched with their counterparts in compilation units compiled with the EXTERNAL compiler option. See the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide , depending on your implementation, for more information.
GLOBAL Another compilation unit: $EXTERNAL$ PROGRAM show_external (input,output); VAR state : Boolean; PROCEDURE proc1; BEGIN . . . END; {Matches variable in show_global's outer block} {a,b,c,d need not be declared here because this compilation unit does not use them.} BEGIN {Empty outer block} END.
GPROF GPROF is a System-Dependent HP-UX Option. The compiler option GPROF causes the compiler to produce code that pro les itself as it runs. You can analyze the pro les with the HP-UX utility gprof. Syntax $GPROF ON $ OFF Default Location OFF. Anywhere before the keyword PROGRAM (illegal in modules). Example $GPROF ON$ PROGRAM a; PROCEDURE b; BEGIN END; BEGIN b; END; Note 12-44 A program containing the GPROF compiler option must be linked with the pc option -G.
HEAP_COMPACT _ HEAP COMPACT HEAP COMPACT is an HP Pascal Option. When the HEAP COMPACT compiler option is ON (and the HEAP DISPOSE option is also ON), free space in the heap is concatenated when the prede ned procedure dispose is called. Syntax $HEAP_COMPACT Default Location ON $ OFF OFF. At front. The HEAP COMPACT option is recommended for programs that manipulate many dynamic record variables of di erent sizes via calls to the prede ned procedures new and dispose .
_ HEAP DISPOSE HEAP DISPOSE is an HP Pascal Option. When the HEAP DISPOSE compiler option is ON, the prede ned procedure dispose frees space in the heap so that the prede ned procedure new can reallocate it. By default, such disposed space cannot be reused. Syntax $HEAP_DISPOSE Default Location ON $ OFF OFF At front. Example $HEAP DISPOSE ON$ PROGRAM show_heap; TYPE big_array = ARRAY [1..
HP_DESTINATION _ HP DESTINATION HP DESTINATION is a System-Dependent HP-UX Option. Syntax ARCHITECTURE PAmodel '$ $HP_DESTINATION ' SCHEDULER PAmodel Where: ARCHITECTURE PA Speci es the desired destination architecture. model Default Location SCHEDULER PA Default Location Can be a model number, such as 750 or 870, or one of the following architecture speci cations: 1.0 Generates object code for PA-RISC 1.0 architecture or higher. 1.1 Generates object code for PA-RISC 1.1 architecture.
HP_DESTINATION _DESTINATION HP 'ARCHITECTURE' Option The HP DESTINATION 'ARCHITECTURE' option generates object code for a particular version of the PA-RISC architecture. Specifying a destination architecture ensures that the compiler generates appropriate object code for the destination architecture. The rst occurrence of the HP DESTINATION 'ARCHITECTURE' option takes precedence over later occurrences of the same option.
HP3000_16 _ HP3000 16 HP3000 16 is a System-Dependent MPE/iX Option. The HP3000 16 compiler option speci es the Pascal/V packing algorithm for the allocation and alignment of all data structures. Syntax $HP3000_16$ Default Location HP Pascal optimized data structures (see the HP3000 32 compiler option). At front. The HP3000 16 compiler option causes all data types (except les and pointers) to be allocated and aligned according to the Pascal/V packing algorithm.
_ HP3000 32 HP3000 32 is a System-Dependent MPE/iX Option. The HP3000 32 compiler option speci es that a given type in an HP3000 16 program is to be allocated and aligned according to the HP Pascal packing algorithm. Syntax $HP3000_32$ Default Location HP3000 32 is the default when HP3000 16 is not used. After the symbol = in a type de nition. If a program does not specify HP3000 16, then HP3000 32 has no e ect, and the compiler issues a warning.
HP3000_32 t_rec = RECORD f1 : f2 : f3 : f4 : f5 : f6 : f7 : f8 : END; -32768..32767; real; string[10]; t_pac; s_pac; t_starray; s_starray; s_starray; s_rec = $HP3000_32$ RECORD f1 : -32768..32767; f2 : real; f3 : string[10]; f4 : t_pac; f5 : s_pac; f6 : t_starray; f7 : s_starray; END; {16 bits allocated} {HP 3000 real number} {16 bits allocated} {error} {error} {error} {32 bits allocated} {IEEE real number} {32 bits allocated} {error} {error} {error} t_array = ARRAY [1..
HP3000_32 VAR v_file1 v_file2 v_file3 v_file4 : : : : t_file; s_file; FILE OF t_rec; FILE OF s_rec; BEGIN END.
IF IF IF is an HP Pascal Option. The IF compiler option speci es code to be compiled conditionally, depending on the value of a Boolean expression. Syntax $IF 'Boolean expression'$ Parameter Boolean expression Default Location Any constant Boolean expression containing the operators AND, OR, NOT, or DEFINED and optional parentheses. On MPE/iX, the SET compiler option must assign the value TRUE or FALSE to each identi er before it appears in Boolean expression .
IF The DEFINED operator returns TRUE if its operand has been set to either TRUE or FALSE using the $SET option (or by using the -Dname =bool command-line option on HP-UX). Otherwise, the DEFINED operator returns FALSE. The DEFINED operator is useful in situations where many mutually exclusive alternatives exist. Rather than tediously set all but one identi er to FALSE, use the DEFINED operator to test for the one identi er which has been set (usually to TRUE). $SET 'HP = TRUE'$ $IF 'defined HP'$ . . .
IF Example 1 The following two program fragments are equivalent because, in both fragments, the block of code protected by the $IF options are compiled. {Fragment 1} $SET 'group1=true, group2=false'$ . . . $IF 'group1 AND (NOT group2)'$ 2 6 6 4 source line . . . 3 7 7 5 $ENDIF$ {Fragment 2} $SET 'group1 = true'$ $SET 'group2 = false'$ . . . $IF 'group1'$ $IF 'NOT group2'$ 2 6 6 4 source line . . .
IF Example 2 In the following example, because group1 has been set to FALSE, the code following $IF 'group1'$ is not compiled; the code following $ELSE$ is compiled instead. $SET 'group1=FALSE'$ . . . $IF 'group1'$ 2 6 6 4 source line . . . 3 7 7 5 $ELSE$ 2 6 6 4 source line . . .
IF Example 3 In the following example, even though group2 is true, that fragment is not compiled because it is nested within the $ELSE$ clause of the first $IF option, whose Boolean expression evaluates to TRUE. $SET 'group1=true,group2=true;group3=false'$ . . . $IF 'group1'$ 2 6 6 4 source line . . . 3 78 9 7 group1 5 $ELSE$ $IF 'group2'$ 2 6 6 4 source line . . . 3 78 9 7 group2 5 $ELSE$ $IF 'group3'$ 2 6 6 4 source line . . .
IF Example 4 In this example, if group1 has been set to TRUE or FALSE, the block of code following will be compiled; if group1 has not been set, the block of code will not be compiled. $IF 'defined group1'$ 2 6 6 4 source line . . .
INCLUDE INCLUDE INCLUDE is a System-Dependent MPE/iX and HP-UX Option. The INCLUDE compiler option includes text from a speci ed le in the source code being compiled. Syntax $INCLUDE 'string'$ Parameter string Default Location Speci es the name of the le to be included at the current position in the program. The le speci cation depends upon the operating system. None. Anywhere. The le that contains the INCLUDE option is the including le, and the le speci ed by string is the included le.
INCLUDE Example 1 This example applies only to HP-UX. PROGRAM show_include; VAR $INCLUDE '/users/pascal/prog1/global'$ BEGIN i := 3; j := 1.55; END. If the le /users/pascal/prog1/global is: i : INTEGER; j : REAL; Then the preceding program is equivalent to: PROGRAM show_include; VAR i : INTEGER; j : REAL; BEGIN i := 3; j := 1.55; END.
INCLUDE Example 2 This example applies only to MPE/iX. PROGRAM show_include; VAR $INCLUDE 'global.prog1.pascal'$ BEGIN i := 3; j := 1.55; END. If the le global.prog1.pascal is: i : INTEGER; j : REAL; Then the preceding program is equivalent to: PROGRAM show_include; VAR i : INTEGER; j : REAL; BEGIN i := 3; j := 1.55; END.
INCLUDE SEARCH INCLUDE SEARCH is a System-Dependent MPE/iX and HP-UX Option. You can use the INCLUDE_SEARCH compiler option to set or modify the search path used by the compiler. This search path speci es the order of directories a compiler searches to nd les speci ed in the INCLUDE directive. The search stops on t he rst successful attempt to open a le. Files speci ed in the INCLUDE directive are called included les. The command line option -I include-search path also speci es this option.
INCLUDE SEARCH MPE/iX Example PROGRAM show_include; $INCLUDE_SEARCH '&, .exp, .official, .official:indy'$ $INCLUDE 'globals.foo'$ BEGIN END. The compiler will attempt to nd the included le globals.foo by looking successively for it under each lename modi cation speci ed by the include path. In this example, the compiler will search successively for the following les: globals.foo globals.foo.exp globals.foo.official globals.foo.
INLINE INLINE is an HP Pascal Option. The INLINE compiler option causes the code for a certain routine to be duplicated in-line wherever it is called. Syntax $INLINE$ Default Location None. Heading. The advantage of duplicating routine code in-line is that it eliminates the overhead of routine calls. Unlike macro expansion, it preserves call-by-reference parameters as such and allows local parameters.
INLINE Example The le procfile contains this procedure, which other compilation units use in-line: PROCEDURE x (a,b : integer; VAR c : char) $INLINE$; BEGIN c := chr(a+b); END; The following compilation unit uses the procedure x in-line: PROGRAM prog; BEGIN . . . $INCLUDE 'procfile'$ . . . END. The INLINE compiler option is equivalent to the INLINE procedure option. The procedure option requires STANDARD LEVEL 'EXT MODCAL'; the compiler option does not.
INTR NAME INTR NAME is an HP Pascal Option. The INTR NAME compiler option speci es the name to be returned for an intrinsic. It is only valid when used in conjunction with the BUILDINT compiler option. Syntax $INTR_NAME 'string'$ Parameter string Default Location Speci es the return name of the intrinsic to be entered in the intrinsic le. Lowercase and uppercase are signi cant. None. Heading.
KEEPASMB KEEPASMB KEEPASMB is an HP Pascal Option. The KEEPASMB compiler option causes the compiler to leave behind an assembler source le containing the code for the entire compilation unit. This le can usually be run through the assembler to produce the same object le that the compiler produces directly. On MPE/iX, the KEEPASMB option produces a le with the formal designator PASASSM, which is a temporary le by default. You are recommended to le-equate this name.
KEEPASMB BL P_INIT_ARGS,2 ;offset NOP ;offset 0x10 .CALL ; BL U_INIT_TRAPS,2 ;offset NOP ;offset 0x18 $00002711 .CALL BL P_TERMINATE,2 ;offset NOP ;offset 0x20 NOP ;offset 0x24 .CALL BL U_EXIT,2 ;offset NOP ;offset 0x2c LDW -68(0,30),2 ;offset BV 0(2) ;offset 0x34 .EXIT LDO -48(30),30 ;offset .PROCEND ;ln=24,25,26; M$1 12-68 0xc 0x14 0x1c 0x28 0x30 0x38 .SUBSPA $UNWIND$,QUAD=0,ALIGN=8,ACCESS=44 .WORD PROGRAM .WORD PROGRAM+56 ; = 0x38 .WORD 24 ; = 0x18 .WORD 6 ; = 0x6 .
LINES LINES LINES is an HP Standard Option. The LINES compiler option speci es the number of lines per page of the listing. The command line option -P also speci es this option. Syntax $LINES integer$ Parameters integer Default Location Example Positive integer not less than 20. 59 Anywhere. PROGRAM show_lines (output); VAR i : shortint; BEGIN writeln('line 5'); writeln('line 6'); . . . writeln('line 58'); $LINES 20$ writeln('line 60'); writeln('line 61'); . . .
LINES The listing (simpli ed) looks like this: 12-70 Compiler Options
LIST LIST LIST is an HP Standard Option. When the LIST compiler option is ON, the compiler produces a listing of the source code. The command line option -L also speci es this option. Syntax $LIST Default Location ON $ OFF ON. Anywhere. The rst column of the listing shows the source statement number. This number appears in the code o set table, is used by the symbolic debugger, and is returned by the prede ned function statement number . The second column of the listing shows a line number.
LIST Example PAGE 0 0 0 0 0 0 1 2 ** ** ** ** 2 2 1 HEWLETT-PACKARD 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 8.100 8.200 8.300 8.400 9.000 10.000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 **** ERROR # 1 3 11.000 3 12.000 4 13.000 4 14.000 4 15.000 0 0 0 0 0 **** ERROR #2 5 16.000 5 17.000 6 18.000 6 19.000 0 0 0 0 PAGE 0 1 1 2 3 3 4 4 4 4 5 6 6 6 7 8 9 9 9 10 12-72 ... (C) HEWLETT-PACKARD CO. 1986 ...
LIST 10 0 PAGE 0 1 1 2 2 3 3 4 5 5 6 6 0 PAGE 6 6 7 7 8 40.000 41.000 0 0 $PAGE$ 3 HEWLETT-PACKARD 42.000 43.000 44.000 45.000 46.000 47.000 48.000 49.000 50.000 51.000 52.000 53.000 54.000 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 (C) HEWLETT-PACKARD CO. 1986 ... PROCEDURE write_data; VAR index : 0..max_array_size; BEGIN rewrite(outfile); FOR index := 1 TO array_size DO writeln(outfile,'data_array[index]); close(outfile); END; $PAGE$ 4 HEWLETT-PACKARD 55.000 56.000 57.000 58.000 59.000 ... ...
LIST Line numbers for statements in included les are independent of line numbers for the les that include them.
LIST CODE LIST CODE LIST CODE is an HP Pascal Option. When the LIST CODE compiler option is ON (and the LIST option is also ON), the compiler produces a mnemonic listing of the object code of each procedure in the program. The mnemonic listing appears at the end of the source listing of the compilation unit. Syntax $LIST_CODE Default Location Scope ON $ OFF OFF. Anywhere. Applies to the entire compilation unit that contains it.
LISTINTR LISTINTR is an HP Pascal Option. The LISTINTR compiler option lists to a speci ed le the contents of an intrinsic le. The intrinsic le is that speci ed by the BUILDINT or SYSINTR compiler option. If neither BUILDINT nor SYSINTR is speci ed, the system intrinsic le is accessed. Syntax $LISTINTR 'string'$ Parameter string Default Location Speci es the name of the le into which the compiler lists the contents of the intrinsic le that BUILDINT speci es. 'PASLIST'. Anywhere.
LISTINTR PARM # 7: SHORTINT(16) at OFFSET DefaultValue = 0 PARM # 8: SHORTINT(16) at OFFSET DefaultValue = 0 PARM # 9: SHORTINT(16) at OFFSET DefaultValue = 0 PARM # 10: INTEGER(32) at OFFSET DefaultValue = 0 PARM # 11: INTEGER(16) at OFFSET DefaultValue = 0 PARM # 12: INTEGER(16) at OFFSET DefaultValue = 0 PARM # 13: INTEGER(16) at OFFSET DefaultValue = 0 144 by VALUE 160 by VALUE 176 by VALUE 192 by VALUE 224 by VALUE 240 by VALUE 256 by VALUE fread (FREAD) : LANGUAGE is HP PASCAL FUNCTION [SHORTINT(16
LITERAL ALIAS LITERAL ALIAS is an HP Pascal Option. When the LITERAL ALIAS compiler option is ON, the compiler takes aliases literally (exactly as they are spelled, di erentiating between uppercase and lowercase letters). When LITERAL ALIAS is OFF, the compiler downshifts aliases (or upshifts them if the compiler option UPPERCASE is ON). Syntax $LITERAL_ALIAS Default Location ON $ OFF OFF Anywhere. The LITERAL ALIAS compiler option overrides the UPPERCASE compiler option.
LOCALITY LOCALITY LOCALITY is an HP Pascal Option. The LOCALITY compiler option speci es a locality name to be associated with the code for all subsequent routines until the next LOCALITY option. The compiler puts the locality name in the object le. Syntax $LOCALITY 'string'$ Parameter string Default Location Speci es a locality name for the object code. The compiler does not distinguish between uppercase and lowercase letters in string . The nameless locality. Anywhere.
LONG CALLS LONG CALLS is an HP Pascal option. The LONG CALLS option can be used to change the type of branches that are generated for calls or millicode calls. Syntax $LONG_CALLS Parameters 0 or OFF 1 or ON 2 3 Default 8 9 < integer = : ON OFF ; $ Regular short calls are generated. Long calls are generated for regular calls and millicode calls. Millicode calls are long and regular calls are short. Millicode calls are short and regular calls are long.
MAPINFO MAPINFO MAPINFO is an HP Pascal Option. The compiler option MAPINFO prints information for array and record types. Syntax $MAPINFO Default Location ON $ OFF OFF Anywhere. The information printed with the MAPINFO option is the same as that printed with the TABLES option set to ON (see \TABLES" in this chapter.) However, MAPINFO prints this information at the same time the type is declared instead of at the end of the scope in which the type is declared.
MLIBRARY MLIBRARY is an HP Pascal Option. The MLIBRARY compiler option speci es the le into which the compiler puts a compiled module de nition, instead of putting it in the object le. The le speci ed here can then be used in a SEARCH option (see \SEARCH"). Program comments must not be written on the same line as $MLIBRARY. Syntax $MLIBRARY 'string'$ Parameter string Speci es the name of the le into which the compiler writes the module de nition.
NLS SOURCE NLS SOURCE NLS SOURCE is a System-Dependent MPE/iX and HP-UX Option. When the NLS SOURCE compiler option is ON, the compiler supports the parsing of two-byte characters within string literals and comments. The command line option -Y also speci es this option. Syntax $NLS_SOURCE Default Location ON $ OFF OFF. Anywhere. NLS SOURCE ON enables the compiler to parse 16-bit characters within literal strings and comments. (Note that eight-bit characters are always parsed correctly.
NOTES NOTES is an HP Pascal Option. When the NOTES compiler option is ON, the compiler prints notes, which give you information that can help you correct possible run-time errors or make your program more e cient. Syntax $NOTES Default Location ON $ OFF ON. Anywhere. Example PAGE 1 HEWLETT-PACKARD ... 0 0 0 0 1 2 2 2 3 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 9.000 0 0 0 0 0 0 1 1 1 **** NOTE # 1 4 4 5 12-84 10.000 11.000 12.
OPTIMIZE OPTIMIZE OPTIMIZE is an HP Pascal Option. The OPTIMIZE compiler option speci es level one, level two, or no optimization for the program being compiled Refer to the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide , depending on your implementation, for more information on the optimizer. The command line options +O1, +O2, and -O also specify this option.
OPTIMIZE Basic Blocks A basic block is a sequence of code with a single entry point and a single exit point. A basic block has no internal branches. Optimizing procedures with a large number of basic blocks can take a long time and use a large amount of virtual memory. Therefore, the compiler behaves di erently on large procedures, when optimizing at Level 2. Any procedure containing more than 500 basic blocks causes the optimizer to drop down to Level 1 optimization for that procedure.
OPTIMIZE OPTIMIZE 'BASIC BLOCK FENCE num' Compiler Option This option allows you to change the default level of basic blocks (500) at which the optimizer drops down to Level 1 optimization. Syntax $OPTIMIZE 'BASIC_BLOCK_FENCE num'$ where num is the number of basic blocks at which the optimizer drops down to Level 1 optimization. This option does not request optimization; it only says that when Level 2 optimization is requested, to change the default level at which the optimizer drops down to Level 1.
OPTIMIZE Example $OPTIMIZE 'LEVEL1'$ PROGRAM x; PROCEDURE y $OPTIMIZE 'LEVEL2'$; {Compiled with level two optimization} BEGIN {y} . . . END; {y} PROCEDURE z; BEGIN {z} . . . END; {z} {Compiled with level two optimization} PROCEDURE a $OPTIMIZE OFF$; {Compiled with no optimization} PROCEDURE b; {Compiled with no optimization} BEGIN {b}; . . . END; {b}; BEGIN {a} . . . END; {a} BEGIN {x} {Compiled with no optimization} . . . END.
OS OS OS is an HP Pascal Option. The OS compiler option speci es the operating system on which the program is intended to run (not to be confused with the operating system on which it is compiled). Then, the compiler identi es language features that are not available on that operating system.
OS Prede ned function ccode . RUN command parameter INFO. RUN command parameter PARM. The compiler recognizes language features that are available on the MPE V operating system. MPE Default Location Available features are the same as for MPE/iX. Operating system on which the compiler is running. Anywhere. If the compiler encounters a language feature that is unavailable on the intended operating system, it issues an error.
OVFLCHECK OVFLCHECK OVFLCHECK is an HP Pascal Option. When the OVFLCHECK compiler option is ON, the compiler generates over ow checking code for all integer arithmetic operations. Over ow-checking code stops the program and issues an error message if an arithmetic operation results in an integer over ow. Syntax $OVFLCHECK Default Location ON $ OFF ON. Anywhere, but it a ects an entire statement at a time.
OVFLCHECK FUNCTION random : integer; BEGIN $PUSH, OVFLCHECK OFF$ rand_seed := (rand_seed * multiplier +1) MOD rand_range; $POP$ random := rand_seed; END; END; IMPORT rand; BEGIN init_random(1234567,1000); writeln(random); writeln(random); writeln(random); END.
PAGE PAGE PAGE is an HP Standard Option. The PAGE compiler option starts a new page of the listing if the LIST option is ON. Syntax $PAGE$ Default Location Not applicable. Anywhere. Example PROGRAM show_page (output); BEGIN writeln('First page'); $PAGE$ writeln('Second page'); END.
PAGEWIDTH PAGEWIDTH is an HP Pascal Option. The PAGEWIDTH compiler option speci es the width of the compiler listing. Syntax $PAGEWIDTH integer$ Parameter integer Default Location An integer in the range 80..132, the number of characters per line in the compiler listing. 120. Anywhere.
PARTIAL EVAL PARTIAL EVAL PARTIAL EVAL is an HP Standard Option. When the PARTIAL EVAL compiler option is ON, the compiler produces code that determines the value of each Boolean expression by evaluating the minimum number of operands, from left to right. When the PARTIAL EVAL option is OFF, the compiler produces code that evaluates every operand of each Boolean expression in an implementation dependent order. Syntax $PARTIAL_EVAL Default Location ON $ OFF ON. Statement.
POP POP is an HP Pascal Option. The POP compiler option restores the compiler option settings that the last PUSH option saved (with the exceptions listed below.) Syntax $POP$ Default Location Not applicable. Anywhere. Compiler options with the location \At front" are not a ected by POP.
PUSH PUSH PUSH is an HP Pascal Option. The PUSH compiler option saves the current compiler option settings. Syntax $PUSH$ Default Location Not applicable. Anywhere. The PUSH option can execute 15 times before the POP option must execute. Example {Include file for supporting types.} $PUSH, LIST OFF$ {Do not list the supporting types. To preserve the LIST state (ON or OFF) that this program set, save it first} TYPE bit1 = 0..1; bit2 = 0..2; bit3 = 0..7; . . . bit16 = 0..
RANGE RANGE is an HP Standard Option. When the RANGE compiler option is ON, the compiler generates range-checking code for assignments, array indices, parameter passing, extensible parameters, pointers, CASE statements, and set operations. If a range check fails, an error message is issued and the program aborts (or causes an escape to be executed if a TRY-RECOVER construct is active). The command line option +R also speci es this option. Syntax $RANGE Default Location Note 12-98 ON $ OFF ON.
RLFILE RLFILE RLFILE is a System-Dependent MPE/iX Option. When the RLFILE compiler option is ON, every level-one routine goes into its own object module in the RL le. (Routines nested within level-one routines go into the same object module as the level-one routine in which they are nested.) Syntax $RLFILE Default Location ON $ OFF OFF. At front. When RLFILE is OFF (the default), the entire compilation unit goes into one object le.
RLINIT RLINIT is a System-Dependent MPE/iX Option. The RLINIT compiler option initializes an RL le to empty. Syntax $RLINIT$ Default Location None. At front. The RLINIT compiler option initializes an RL le to empty before placing any object code in it. If RLINIT is not used, the compiler appends the new object code to any code that is already in the RL le. If $OLDPASS is used, or no le with the speci ed name exists, the system creates an RL le.
S300_EXTNAMES _ S300 EXTNAMES S300 EXTNAMES is an HP Pascal Option. The S300 EXTNAMES compiler option speci es that the external names of procedures in modules are of the form modulename procedurename . Syntax $S300_EXTNAMES Default Location ON $ OFF OFF. Before the EXPORT part of a module. The S300 EXTNAMES option tells the linker to use the external name modulename procedurename instead of procedurename when linking a program.
S300_EXTNAMES Example MODULE M1; $S300_EXTNAMES ON$ EXPORT VAR V1 : INTEGER; PROCEDURE P1 (P : CHAR); IMPLEMENT . . . END; MODULE M2; EXPORT VAR V2 : INTEGER; PROCEDURE P2 (P : INTEGER); IMPLEMENT . . . END; The external names for V1, P1, V2, and P2 are M1_V1, M1_P1, V2, and P2, respectively.
SEARCH SEARCH SEARCH is an HP Pascal Option. The SEARCH compiler option speci es one or more les for the compiler to search for module de nitions. The les can be: Created with the MLIBRARY compiler option. Object les into which the modules were compiled (without the MLIBRARY compiler option). Archives (.a les) of such object les. On MPE/iX, these are RL les created by the Link Editor using such object les.
SEARCH Pascal requires that lower level modules be included in the $SEARCH path, even if the higher level modules do not use them. For example: module a export . . . end. $search 'a.o'$ module b import a export . . . end. $search 'a.o, b.o'$ module c import b export . . . end. Example 1 $SEARCH 'file1,file2','file3'$ $SEARCH '+file4'$ IMPORT MOD1,MOD2,MOD3; . . . $SEARCH 'file5,file6', 'file7,file8'$ IMPORT MOD4; . . . {The search list contains file1, file2, file3.} {Adds file4 to the search list.
SET SET SET is an HP Pascal Option. The SET compiler option assigns a Boolean value (TRUE or FALSE) to each of one or more identi ers that appear in subsequent IF options. Syntax $SET 'identi er=Boolean , identi er=Boolean '$ ; Parameters identi er Appears in an IF option later in the program. The identi er cannot be AND, OR, or NOT. The value TRUE or FALSE (the compiler is not case-sensitive). Not applicable. Anywhere.
SHLIB CODE SHLIB CODE is a System Dependent HP-UX Option. The compiler option SHLIB CODE causes the compiler to generate position independent code (PIC) for use in shared libraries. The command line options +Z and +z also specify this option. Syntax $SHLIB_CODE 8 9 < integer = : ON OFF ; $ Parameters integer Must be in the range 0..2. Value Compiler generates: 0 Position dependent code. 1 Short load sequence PIC. 2 Long load sequence PIC. ON Compiler generates short load sequence PIC.
SHLIB VERSION SHLIB VERSION SHLIB Version is a System-Dependent HP-UX Option. The compiler option SHLIB VERSION causes the compiler to place a shared library version string into the resulting object le. $SHLIB_VERSION 'string'$ Parameters String Default Location Speci es the date stamp to be used by the linker for shared library version control. Must be in the form: mm/yy or mm/yyyy. '01/1990'. At front.
SKIP TEXT SKIP TEXT is an HP Pascal Option. The compiler ignores everything between $SKIP_TEXT ON$ and $SKIP_TEXT OFF$. Syntax $SKIP_TEXT Default Location ON $ OFF OFF Anywhere. Example PROGRAM show_skiptext (output); BEGIN writeln('This will print.'); $SKIP_TEXT ON$ writeln('This won''t print.'); $SKIP_TEXT OFF$ writeln('This will print.'); END. The preceding program prints: This will print. This will print.
SKIP TEXT There is one exception to how SKIP-TEXT works. Symbols that begin a comment ({ or (*) are recognized and cause text to be commented out until a closing comment symbol (} or *)) is encountered. Example 0 0 0 1 ** ** ** ** ** ** ** 1 1 2 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 9.000 10.000 11.000 12.000 13.000 14.000 0 1 1 1 1 1 1 1 1 1 1 1 1 1 PROGRAM show_skiptext_exception (output); BEGIN writeln('This will print.
SPLINTR SPLINTR is an HP Pascal Option. The SPLINTR compiler option speci es the intrinsic le that the compiler searches for information on intrinsic routines. It is the same as the SYSINTR compiler option and is provided only for backward compatibility with Pascal/V. Syntax $SPLINTR 'string'$ Parameter string Default Location Speci es the name of the intrinsic le that the compiler must search for information about intrinsic routines.
STANDARD_LEVEL _ STANDARD LEVEL STANDARD LEVEL is an HP Standard Option. The STANDARD LEVEL compiler option speci es the level of syntax that the compiler routinely processes. The compiler issues a warning if it encounters a language feature that is illegal at that level. The compiler compiles the illegal feature if possible; otherwise, it is a syntax error.
STANDARD_LEVEL Example $STANDARD_LEVEL 'ANSI'$ {equivalent to $ANSI ON$} $OS 'MPE'$ PROGRAM show_level (output); PROCEDURE proc1; VAR i : integer; b : Boolean; BEGIN assert(b,i); ^ **** WARNING #1 THIS FEATURE REQUIRES $STANDARD_LEVEL 'HP_PASCAL'$ (539) i := 0; b := true; END; BEGIN END. Figure 12-4 illustrates the relationship between the STANDARD LEVEL parameters. Figure 12-4.
STATEMENT_NUMBER _ STATEMENT NUMBER STATEMENT NUMBER is an HP Pascal Option. When the STATEMENT NUMBER compiler option is ON, the compiler generates a special instruction to identify a code sequence with its corresponding Pascal statement. Syntax $STATEMENT_NUMBER Default Location ON $ OFF OFF Anywhere. The special instruction that the compiler generates is a LoaD Immediate Left (LDIL) instruction with destination register R0. It is equivalent to a No OPeration (NOP) instruction.
STATEMENT_NUMBER The listing for the preceding program is: 0 0 0 0 0 3 3 4 5 6 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 9.000 10.000 0 0 0 0 0 1 1 1 1 1 $statement_number on$ $list_code on$ program x; var i,j,k : integer; begin i := 0; j := i; k := j + i; end.
STDPASCAL WARN STDPASCAL WARN STDPASCAL WARN is an HP Pascal Option. The STDPASCAL_WARN compiler option allows you to compile and execute syntax, which otherwise would have been issued an error message due to non-conformity with the ANSI/ISO standard. A new error message can now be issued for syntax in HP Pascal that does not conform to the ANSI/ISO standard. This message may be issued only when one of the following compiler options is speci ed: ANSI ON, STANDARD_LEVEL 'ANSI', or STANDARD_LEVEL 'ISO'.
STRINGTEMPLIMIT STRINGTEMPLIMIT is an HP Pascal Option. The STRINGTEMPLIMIT option causes all temporary strings of unknown size to be allocated a xed maximum size. Instead of being allocated in the heap, the temporary string is allocated in the stack. Syntax $STRINGTEMPLIMIT integer$ Parameters integer Maximum size in bytes of any string temporary that the compiler can not calculate at compile time. This value must include the length word of the string and any padding.
SUBPROGRAM SUBPROGRAM SUBPROGRAM is an HP Pascal Option. The SUBPROGRAM compiler option causes the compiler to emit code for speci ed level-one routines only. This includes routines nested within those routines, but not the outer block. Syntax $SUBPROGRAM ['pfname[*] [,pfname[*]]...']$ Parameters pfname * Default Location Name of a level-one routine. The compiler emits code for pfname and the routines nested within it, but not for the outer block.
SUBPROGRAM Example 0 0 0 0 0 0 2 2 3 3 0 2 2 3 3 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 9.000 10.000 11.000 12.000 13.000 14.000 15.000 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0 $SUBPROGRAM 'proc2#, proc3#'$ PROGRAM show_subprogram (output); PROCEDURE proc1 (p : integer); BEGIN writeln(p); END; PROCEDURE proc2 (p : integer); BEGIN writeln(p); END; I D E N T I F I E R IDENTIFIER CLASS TYPE ADDRESS/VALUE P PARAMETER INTEGER PSP-24.0 (4.0) LOCAL STORAGE USED = 0.0 PARAMETER STORAGE USED = 4.
SYMDEBUG SYMDEBUG SYMDEBUG is a System-Dependent MPE/iX and HP-UX Option. The SYMDEBUG compiler option emits symbolic debugging information for use with the HP TOOLSET/XL debugger or the HP Symbolic Debugger (see the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide , depending on your implementation, for more information). You cannot use the optimizer if you use the SYMDEBUG option. The command line option g also speci es this option.
SYSINTR SYSINTR is an HP Pascal Option. The SYSINTR compiler option speci es the intrinsic le that the compiler searches for information on intrinsic routines. Syntax $SYSINTR 'string'$ Parameter string Speci es the name of the intrinsic le that the compiler must search for information about intrinsic routines. System intrinsic le (see the HP Pascal/iX Programmer's Guide or the HP Pascal/HP-UX Programmer's Guide .) Anywhere.
SYSINTR Table 12-2 compares SPLINTR (SPL) and SYSINTR (HP Pascal) formats. Neither format can be converted to the other automatically. For instructions on conversion by hand, see the HP Pascal/iX Migration Guide or the HP Pascal/HPUX Migration Guide . Table 12-2.
SYSPROG SYSPROG is an HP Pascal Option. The SYSPROG compiler option is equivalent to $STANDARD_LEVEL 'EXT_MODCAL'$ (see \STANDARD_LEVEL" in this chapter). It provides compatibility with Pascal on the HP 9000 Series 300 and 400 machines. Syntax $SYSPROG Default Location ON $ OFF OFF. Heading. Example $SYSPROG ON$ PROGRAM machine_dependent; . . .
TABLES TABLES TABLES is an HP Pascal Option. When the TABLES compiler option is ON (and the LIST option is also ON), the listing includes an identi er map for each compilation block. Syntax $TABLES Default Location ON $ OFF OFF. Anywhere. In order for the listing to contain a table of a speci c compilation block, the TABLES and LIST options must be ON when the compiler nishes parsing that block.
TABLES Value DP+ SP- PSP- name The meanings of the four REG values are as follows. Meaning The o set is relative to the contents of the DP register (the \Data Pointer," register 27). This register points to the base of the global variables. Its value can be displayed in an assembly-level debugger. The o set is a negative o set from the contents of the SP register (the \Stack Pointer," register 30). This register points to the top of the activation record of the currently executing routine.
TABLES Example 0 0 0 0 1 2 3 3 4 5 6 7 8 9 9 9 10 0 2 2 3 3 4 4 6 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 9.000 10.000 11.000 12.000 13.000 14.000 15.000 16.000 17.000 18.000 19.000 20.000 21.000 22.000 23.000 24.000 25.000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 $TABLES ON$ PROGRAM show_map (input,output); CONST realnum = 19.9; maxsize = 100; title = 'Customer list'; TYPE answer = (yes,no); rec = RECORD ch : char; CASE tag : answer OF yes : (message : PACKED ARRAY [1..
TABLES 10 10 30.000 31.000 1 1 BEGIN END. I D E N T I F I E R M A P IDENTIFIER CLASS TYPE ADDRESS/VALUE ANSWER CUSTOMER FUNC1 INPUT MAXSIZE NO OUTPUT PROC1 REALNUM REC CH TAG MESSAGE I TITLE YES USER DEFINED VARIABLE FUNCTION PARAMETER CONSTANT CONSTANT PARAMETER PROCEDURE CONSTANT USER DEFINED FIELD TAG FIELD FIELD FIELD CONSTANT CONSTANT ENUMERATED RECORD DP+ FILE INTEGER ENUMERATED FILE input (248.0) 100 1 output (248.
TITLE TITLE TITLE is an HP Pascal Option. The TITLE compiler option speci es the title to appear on subsequent pages of the listing. (The title appears next to the page number in the top left-hand corner of the page.) Syntax $TITLE 'string'$ Parameter string Exact title (the compiler distinguishes between uppercase and lowercase letters.) The empty string ( '') restores the default title. The string literal ' ' speci es a blank title. Default {iX} HP PASCAL/{UX} HP product number.v.uu. CO.
TYPE COERCION TYPE COERCION is a System Programming Option. The TYPE COERCION compiler option determines the level of value type coercion that the compiler allows. Syntax $TYPE_COERCION ' 8 NONE > > > > > CONVERSION > > < 9 > > > > > > > = STRUCTURAL '$ > REPRESENTATION > > > > > > > > > STORAGE > > > > : ; NONCOMPATIBLE Parameters NONE CONVERSION STRUCTURAL REPRESENTATION STORAGE NONCOMPATIBLE Default Location Prevents type coercion. Permits value type coercion of ordinal and pointer types.
TYPE COERCION Example 0 0 0 0 0 1 2 3 3 4 4 4 5 6 6 6 6 8 8 8 8 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 9.000 10.000 11.000 12.000 13.000 14.000 15.000 16.000 17.000 18.000 19.000 20.000 21.000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 $STANDARD_LEVEL 'HP_MODCAL'$ PROGRAM show_type_coercion; TYPE Rec1 = RECORD F1 : integer; F2 : integer; END; Arr1 = PACKED ARRAY [1..8] OF char; VAR R : Rec1; A : Arr1; BEGIN R.F1 := 101; R.
UPPERCASE UPPERCASE is an HP Pascal Option. When the UPPERCASE compiler option is ON, the compiler upshifts all external names (names of routines and global variables), including aliases. When UPPERCASE is OFF, the compiler downshifts these names. The LITERAL ALIAS compiler option overrides the UPPERCASE compiler option in aliases. Syntax $UPPERCASE Default Location Scope ON $ OFF OFF.
VERSION VERSION VERSION is an HP Pascal Option. The VERSION compiler option speci es a string for the compiler to put in the version identi cation area of the current object module. The purpose of VERSION is to allow you to include the version number of your code in this area. Syntax $VERSION 'string'$ Parameter string Default Location Example Any string of characters (including unprintable characters). Not applicable. Anywhere. PROGRAM prog; $VERSION 'A.00.00'$ BEGIN . . . END.
VOLATILE VOLATILE is an HP Pascal Option. You can apply the VOLATILE compiler option to a variable to specify that the memory location associated with the variable may be modi ed by other processes. Using VOLATILE signals the optimizer that a speci ed variable must not reside in a register, but must always be updated. Syntax $VOLATILE$ Location The VOLATILE compiler option is allowed after the \:" in a VAR declaration. It is also allowed after a \^" in a pointer type or variable declaration.
WARN WARN WARN is an HP Pascal Option. The WARN compiler option suppresses warning messages and notes. The command line option -w also speci es this option. Syntax ON $WARN $ OFF Default Location ON. Anywhere. If neither ON nor OFF is speci ed, ON is assumed, and warning messages and notes are issued. Warning messages may indicate program bugs or faulty processing. Turning them o may cause these potential problems to go unreported.
WIDTH WIDTH is an HP Pascal Option. The WIDTH compiler option sets the number of columns of each source line that the compiler will read. Syntax $WIDTH integer$ Parameter integer In the range 10..132. Default 132. Location Anywhere. The WIDTH option allows the compiler to ignore text beyond a speci ed column. The WIDTH option applies only to the le that contains it, and not to les that it includes (see the INCLUDE option).
XREF XREF XREF is an HP Pascal Option. When the XREF compiler option is ON (and the LIST option is also ON), the listing includes a cross reference for each function, procedure, and outer block. Syntax $XREF ON $ OFF Default Location OFF. Anywhere. A cross reference lists each identi er that is accessible to the block. For each le that references the identi er, the cross reference shows the le name and gives the numbers of the lines on which the identi er is referenced.
XREF C R O S S --------B Page Line # Page R E F E R E N C E ----------------- Line # Page Line # PXA32.EXAMPLES.ATFTEST 1 00008.000@ 1 00010.000* BOOLEAN global scope PXA32.EXAMPLES.ATFTEST 1 00011.000* 1 00008.000 CHECK global scope PXA32.EXAMPLES.ATFTEST 1 00008.000 FALSE global scope PXA32.EXAMPLES.ATFTEST K N 1 00011.000 global scope PXA32.EXAMPLE.ATFTEST 1 00010.000 global scope PXA32.EXAMPLES.ATFTEST 1 00010.000 TRUE global scope PXA32.EXAMPLES.ATFTEST 1 00010.
XREF PAGE 2 Show_xref C R O S S --------- Page Line # Page BOOLEAN PXA32.EXAMPLES.ATFTEST Line # 1 00007.000 1 0008.000 1 00008.000 1 0015.000 CHECK PXA32.EXAMPLES.ATFTEST FALSE PXA32.EXAMPLES.ATFTEST R E F E R E N C E ----------------Page Line # Page Line # 1 00011.000 INPUT PXA32.EXAMPLES.ATFTEST 1 00003.000 INTEGER PXA32.EXAMPLES.ATFTEST K 1 00006.000 PXA32.EXAMPLES.ATFTEST const N 1 00010.000 1 00002.000 PXA32.EXAMPLES.ATFTEST 1 00006.000@ 1 00010.000 1 00014.
XREF OUTPUT PXA32.EXAMPLES.ATFTEST 1 00003.000 READLN PXA32.EXAMPLES.ATFTEST 1 00014.000 SHOW_XREF PXA32.EXAMPLES.ATFTEST T 1 00003.000 PXA32.EXAMPLES.ATFTEST 1 00007.000 12-138 Compiler Options 1 00015.000* 1 00016.
XREF PAGE 3 Show_xref C R O S S --------Page Line # Page TRUE PXA32.EXAMPLES.ATFTEST Line # R E F E R E N C E ----------------Page Line # Page Line # 1 00010.000 WRITELN PXA32.EXAMPLES.ATFTEST 1 00016.000 1 0017.
A Error Messages Reading Error Messages On HP-UX, error messages and their explanatory text are in the le named /usr/lib/paserrs . To list this le, use the command: cat usr/lib/paserrs On MPE/iX, error messages and their explanatory text are in the le named PASXLCAT.PUB.SYS . To list this le, use the command: :PRINT PASXLCAT.PUB.SYS In reading the error messages, note that: A dollar sign ($) in the left margin indicates a comment line containing explanatory text.
Additional Documentation Finding Undetected Errors The following errors are currently undetected by the compiler at compile time or by the system at run time. In any future release, an undetected error may become a detected error. Errors that are only detected when the ANSI option is ON, or when STANDARD LEVEL is set to ANSI, do not appear on this list. There is no signi cance to the order in which errors are listed here. 1.
Additional Documentation d. An uninitialized dynamic variable on the heap. (The compiler cannot detect this at run time.) e. Strwrite into an uninitialized string variable. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. However, some of the above errors are detected when the compiler option OPTIMIZE is ON. An actual reference parameter cannot be an expression consisting of a single variable in parentheses. Case constant labels cannot be constant expressions.
Additional Documentation Using This Appendix This appendix describes the errors, notes, and warnings that can be detected during the compilation or execution of an HP Pascal program. These errors are listed in two groups, each in numeric order. The rst group consists of messages from the pc driver. These messages are concerned with the appearance of the command-line options and arguments to pc. The message number is in the form pcnn , where nn is the message number.
Additional Documentation Table A-1.
Additional Documentation pc Driver Messages pc01 MESSAGE W CAUSE ACTION pc02 MESSAGE W CAUSE ACTION pc03 MESSAGE W CAUSE ACTION pc04 MESSAGE W CAUSE ACTION pc05 MESSAGE W CAUSE ACTION pc06 MESSAGE W CAUSE ACTION pc07 MESSAGE W CAUSE ACTION A-6 Error Messages Warning: '!' and '!' are incompatible: '!' ignored (pc01) These two command-line options are incompatible with each other; the rst option in the message will be ignored, regardless of the relative position of the options
Additional Documentation pc08 MESSAGE W CAUSE ACTION pc09 MESSAGE W CAUSE ACTION pc10 MESSAGE W CAUSE ACTION pc21 MESSAGE CT CAUSE ACTION pc22 MESSAGE CT CAUSE ACTION pc23 MESSAGE CT CAUSE ACTION pc24 MESSAGE CT CAUSE ACTION pc25 MESSAGE CT CAUSE ACTION pc27 MESSAGE CT CAUSE ACTION Warning: The +D option takes only 'A' and 'S' as arguments (pc08) You have speci ed +Dx , where x is a letter other than A or S.
Additional Documentation pc28 MESSAGE CT CAUSE ACTION pc41 MESSAGE I CAUSE ACTION pc42 MESSAGE I CAUSE ACTION pc43 MESSAGE I CAUSE ACTION pc44 MESSAGE I CAUSE ACTION pc45 MESSAGE I CAUSE ACTION Signal ! (!) while linking '!' (pc28) A signal was caught while linking the executable. Read the description, make necessary adjustments, and relink. Error: Out of memory while compiling '!' (pc41) The pc driver was unable to allocate dynamic memory. See CT message 6200.
Additional Documentation pc49 MESSAGE I CAUSE ACTION pc50 MESSAGE I CAUSE ACTION pc51 MESSAGE I CAUSE ACTION pc52 MESSAGE I CAUSE ACTION Error: This subprocess is not allowed with -t: '!' (pc49) You incorrectly speci ed the d subprocess to the -t command-line option. Because there is no d subprocess, use either c, 0, or l with the -t command-line option. Error: This subprocess speci ed more than once: '!' (pc50) More than one -tc or -tl command-line option was speci ed.
Additional Documentation Compiler Messages 001 MESSAGE CT CAUSE ACTION 002 MESSAGE CT CAUSE ACTION 003 MESSAGE CT CAUSE ACTION 004 MESSAGE CT CAUSE ACTION 005 MESSAGE CT CAUSE ACTION CAUSE ACTION 006 MESSAGE CT CAUSE ACTION 007 MESSAGE CT CAUSE ACTION 008 MESSAGE CT CAUSE ACTION 009 MESSAGE CT CAUSE ACTION A-10 Error Messages FLOATING POINT OVERFLOW (001) The absolute value of a real number is too large. Check the permitted range of real/longreal values.
Additional Documentation 010 MESSAGE CT CAUSE ACTION 011 MESSAGE CT CAUSE ACTION 012 MESSAGE CT CAUSE ACTION 013 MESSAGE CT CAUSE 100 ERRORS|PROGRAM TERMINATED (010) Only 100 errors are allowed before the compiler stops. Correct earlier errors so that compilation can continue. A COMMA IS REQUIRED HERE (011) A comma is needed to separate procedure/function names in the SUBPROGRAM compiler option. Check syntax and insert a comma where necessary.
Additional Documentation 016 MESSAGE CT CAUSE ACTION 017 MESSAGE CT CAUSE ACTION 018 MESSAGE CT CAUSE TYPE IDENTIFIER REQUIRED HERE (016) A constant or variable identi er has been used where a type identi er is required. Replace the constant or variable identi er with a type identi er. INVALID TYPE IDENTIFIER USE (017) A type identi er has been used where a constant or variable identi er is required. The construct in which the identi er occurs is not legal in this context.
Additional Documentation 024 MESSAGE CT CAUSE ACTION 025 MESSAGE CT CAUSE ACTION 026 MESSAGE CT CAUSE ACTION 027 MESSAGE CT CAUSE ACTION 028 MESSAGE CT CAUSE ACTION 029 MESSAGE CT CAUSE ACTION 030 MESSAGE CT CAUSE LOWER BOUND OF SUBRANGE IS GREATER THAN UPPER BOUND (024) The lower bound is greater than the upper bound in a subrange type declaration. Increase the upper bound, or decrease the lower bound.
Additional Documentation 032 MESSAGE CT CAUSE ACTION 033 MESSAGE CT CAUSE ACTION 034 MESSAGE CT CAUSE ACTION 035 MESSAGE CT CAUSE ACTION 036 MESSAGE CT CAUSE ACTION 037 MESSAGE CT CAUSE ACTION 038 MESSAGE CT CAUSE ACTION 039 MESSAGE CT CAUSE ACTION A-14 Error Messages EMPTY SOURCE FILE (032) The source le is empty. Check the le name. MISSPELLED RESERVED WORD: \! " (033) The reserved word is misspelled. Correct the spelling of the reserved word.
Additional Documentation 040 MESSAGE CT CAUSE ACTION 041 MESSAGE CT CAUSE ACTION 042 MESSAGE CT CAUSE ACTION 043 MESSAGE CT CAUSE 044 MESSAGE CT CAUSE ACTION INVALID STRING TYPE USE (040) The standard type identi er string is not used to de ne a string type. Use the standard identi er string to de ne this type. MISSING SEPARATOR BETWEEN NUMBER AND IDENTIFIER (041) A character was detected immediately following a number.
Additional Documentation 062 MESSAGE CT CAUSE ACTION 063 MESSAGE CT CAUSE ACTION 064 MESSAGE CT CAUSE ACTION 065 MESSAGE CT CAUSE TYPE OF OPERAND NOT ALLOWED WITH OPERATOR (062) An operand of this type cannot be used with this operator. Check and correct the operand or operator. BASE TYPE OF OPERAND AND SET DO NOT AGREE (063) The operand on the left of an IN operator is not type compatible with the set on the right. Check the operands to ensure compatible types.
Additional Documentation 070 MESSAGE CT CAUSE ACTION 072 MESSAGE CT CAUSE ACTION 080 MESSAGE CT CAUSE ACTION 081 MESSAGE CT CAUSE ACTION ILLEGAL TO ASSIGN TO (070) The identi er denotes an entity that cannot appear on the right side of an assignment statement; for example, a set or string type identi er. Correct the right-hand side of the assignment. REAL CONSTANT FOLDING NOT AVAILABLE IN $HP3000 16$ (072) Temporary restriction on real constant folding in $HP3000 16$.
Additional Documentation 086 MESSAGE CT CAUSE ACTION 087 MESSAGE CT CAUSE ACTION MAXIMUM STRING LENGTH MUST BE BETWEEN 1 AND ! (086) Tried to declare string with a maximum length < 1 or > the limit mentioned in the message. Correct the string maximum length speci cation so it is in the permitted range. EXPRESSION FOR MAXIMUM LENGTH MUST BE TYPE INTEGER (087) Tried to declare a string with a noninteger constant expression for the maximum length. Use an integer constant in this context.
Additional Documentation 104 MESSAGE CT CAUSE ACTION 106 MESSAGE CT CAUSE ACTION 120 MESSAGE CT CAUSE ACTION 121 MESSAGE CT CAUSE ACTION 122 MESSAGE CT CAUSE ACTION 123 MESSAGE CT CAUSE ACTION 124 MESSAGE CT CAUSE ACTION 125 MESSAGE CT CAUSE ACTION 140 MESSAGE CT CAUSE ACTION CAUSE ACTION POINTER VARIABLE IS REQUIRED HERE (104) NEW, DISPOSE, MARK, and RELEASE all require a pointer variable as the rst parameter. Declare and supply a pointer variable.
Additional Documentation 141 MESSAGE CT CAUSE RECORD CONSTANT HAS MISSING FIELD(S) (141) One or more elds missing in a record constructor. ACTION The name of a eld is misspelled. Correct erroneous eld name. Add the missing elds.
Additional Documentation 149 MESSAGE CT CAUSE ACTION TOO BIG STRUCTURED CONSTANT (149) The compiler's structured constant table has over owed. If there are one or more structured constants larger than the table size, break them up into smaller constants, if possible. If the total size of all the structured constants exceeds the limit, break your compilation unit into smaller pieces and spread the constants over them.
Additional Documentation 155 MESSAGE CT CAUSE ACTION CAUSE ACTION 156 MESSAGE CT CAUSE ACTION 157 MESSAGE CT CAUSE ACTION NON CONFORMANT ACTUAL PARAMETER (155) The parameter being passed as an actual conformant array parameter does not have an array type. Check the parameter and make sure it has an array type. The parameter being passed as an actual conformant array parameter does not have the same packing as the formal parameter.
Additional Documentation 162 MESSAGE CT CAUSE ACTION 163 MESSAGE CT CAUSE ACTION 164 MESSAGE CT CAUSE ACTION 165 MESSAGE CT CAUSE ACTION 166 MESSAGE CT CAUSE ACTION 167 MESSAGE CT CAUSE ACTION 168 MESSAGE CT CAUSE ACTION 169 MESSAGE CT CAUSE ACTION TEXTFILE NOT ALLOWED HERE (162) The standard procedure or function in question may not be used with a le of type text. Remove/change the le being referenced or the routine being used.
Additional Documentation 190 MESSAGE CT CAUSE ACTION 191 MESSAGE CT CAUSE ACTION 192 MESSAGE CT CAUSE ACTION 193 MESSAGE CT CAUSE ACTION 194 MESSAGE CT CAUSE ACTION 195 MESSAGE CT CAUSE ACTION 196 MESSAGE CT CAUSE ACTION 197 MESSAGE CT CAUSE ACTION 198 MESSAGE CT CAUSE ACTION A-24 Error Messages THIS PROGRAM PARAMETER WAS UNDECLARED: \! " (190) The identi er appeared in the program parameter list but was never declared. Add the identi er declaration.
Additional Documentation 199 MESSAGE CT CAUSE ACTION 200 MESSAGE CT CAUSE ACTION 201 MESSAGE CT CAUSE ACTION 202 MESSAGE CT CAUSE PROCEDURE NOT DECLARED (199) The identi er used in the procedure call either has not been declared, or it is not a procedure name. Check the spelling of the procedure and make sure it is declared. PARAMETER \! " MUST BE VAR PARAMETER.
Additional Documentation 204 MESSAGE CT CAUSE ACTION INVALID DIRECTIVE (204) EXTERNAL, EXTERNAL SPL, EXTERNAL SPL VARIABLE, EXTERNAL FORTRAN, EXTERNAL FTN77, EXTERNAL C, EXTERNAL COBOL, FORWARD, and INTRINSIC are the only legal directives. Remove the directive from the code or correct the spelling. 205 MESSAGE CT CAUSE INVALID LANGUAGE SPECIFICATION (205) The language speci ed was not FORTRAN, SPL, COBOL, FTN77, or C.
Additional Documentation 209 MESSAGE CT CAUSE NO FURTHER CASE CONSTANT PARAMETERS ALLOWED TO NEW (209) The pointer parameter to NEW points to a record that has no additional nested variant parts. The pointer parameter to NEW points to a record that does not have a variant part. ACTION 210 MESSAGE CT CAUSE The pointer parameter to NEW points to a structure that is not a record. Check the record type de nition for the correct variant record or remove the extra variant labels from the call.
Additional Documentation 216 MESSAGE CT CAUSE ACTION CAUSE ACTION 217 MESSAGE CT CAUSE ACTION CAUSE ACTION CAUSE ACTION 218 MESSAGE CT CAUSE ACTION 219 MESSAGE CT CAUSE ACTION 220 MESSAGE CT CAUSE ACTION 221 MESSAGE CT CAUSE ACTION A-28 Error Messages BAD CONSTANT PARAMETER (216) This string constant parameter to BINARY, OCTAL, or HEX either contains an invalid character or represents a value outside the range minint..maxint. Fix the character construct.
Additional Documentation 222 MESSAGE CT CAUSE VARIABLE PARAMETER REQUIRED HERE (222) An expression appears as an actual reference parameter instead of a variable. A constant appears as an actual reference parameter instead of a variable. ACTION 223 MESSAGE CT CAUSE A component of a structured constant appears as an actual reference parameter instead of a variable. Check the parameter; it must be a variable and not an expression or constant.
Additional Documentation 227 MESSAGE CT CAUSE ACTION 228 MESSAGE CT CAUSE ACTION CAUSE ACTION 229 MESSAGE CAUSE ACTION INCONSISTENT COMPILER OPTIONS IN FORWARD PROCEDURE OR FUNCTION (227) The compiler options speci ed in the de nition di er from the one in the FORWARD declaration of the procedure or function. Use the same compiler options in both declarations.
Additional Documentation 240 MESSAGE CT CAUSE ACTION 241 MESSAGE CT CAUSE ACTION 242 MESSAGE CT CAUSE ACTION 243 MESSAGE CT CAUSE ACTION 250 MESSAGE CT CAUSE MULTIPLE MODULE IMPLEMENTATIONS NOT PERMITTED (240) Only one MODULE is permitted for each module. Remove duplicate MODULE. MISSING EXPORT SECTION FOR THIS MODULE (241) Every module must have at least one EXPORT. Declare or de ne at least one 'object' in the EXPORT section.
Additional Documentation 271 MESSAGE CT CAUSE ACTION 272 MESSAGE CT CAUSE ACTION 273 MESSAGE CT CAUSE ACTION 274 MESSAGE CAUSE ACTION 275 MESSAGE CT CAUSE LABEL HAS NOT BEEN DECLARED (271) This label marks a statement, but never appeared in a LABEL declaration for this block. Declare the label. LABEL DECLARED MORE THAN ONCE (272) This label already appeared in this LABEL section or in a LABEL section in an enclosing scope. Delete the duplicate label declaration.
Additional Documentation 294 MESSAGE CT CAUSE 370 MESSAGE N CAUSE ACTION 371 MESSAGE N CAUSE ACTION 373 MESSAGE N CAUSE ACTION 374 MESSAGE N CAUSE ACTION 377 MESSAGE N CAUSE ACTION 378 MESSAGE N CAUSE ACTION 379 MESSAGE N CAUSE ACTION 380 MESSAGE N CAUSE ACTION 381 MESSAGE N CAUSE ACTION $ INCLUDE NOT ALLOWED HERE WHEN SYMBOLIC DEBUG IS ENABLED (294) $INCLUDE of a le in executable code must be on a Pascal statement boundary if symbolic debug is enabled.
Additional Documentation 382 MESSAGE N CAUSE ACTION 383 MESSAGE N CAUSE ACTION 384 MESSAGE N CAUSE ACTION 385 MESSAGE N CAUSE ACTION 400 MESSAGE CT CAUSE ACTION 401 MESSAGE CT CAUSE ACTION 402 MESSAGE CT CAUSE ACTION 403 MESSAGE CT CAUSE ACTION A-34 Error Messages SIZE OF MACHINE DEPENDENT TYPE IS NOT CONSISTENT WITH PACKING (382) A machine dependent type such as a pointer, string, or le, is used with $HP3000 16$.
Additional Documentation 404 MESSAGE CT CAUSE ACTION 405 MESSAGE CT CAUSE ACTION 406 MESSAGE CT CAUSE ACTION CAUSE ACTION 408 MESSAGE CT CAUSE ACTION 409 MESSAGE CT CAUSE ACTION UNMATCHED $ENDIF$ FOUND (404) An $ENDIF$ compiler option was found without a preceding $IF$ option. This may happen if either the compiler rejects an $IF$ because it was out of place, or the $IF$ is not in the code. Check for a missing or commented $IF$.
Additional Documentation 414 MESSAGE CT CAUSE ACTION 415 MESSAGE CT CAUSE ACTION 425 MESSAGE CT CAUSE NLS NOT INSTALLED OR SYSTEM VARIABLE NOT SET (414) NLS (Native Language Support) is not installed or the JCW 'GETUSERLANG" is not set (MPE/iX) or the environment variable 'LANG' is not set (HP-UX). Determine which of the above applies and correct the situation. $INCLUDE FILENAME IS NULL (415) The le speci ed in the include option is empty. Place a valid le name in the quotes.
Additional Documentation 461 MESSAGE CT CAUSE ACTION 500 MESSAGE W CAUSE ACTION 501 MESSAGE W CAUSE ACTION 502 MESSAGE W CAUSE ACTION PARSER STACK OVERFLOW - TOO MANY NESTED CONSTRUCTS (461) An internal compiler limit on nested structures has been reached. A common cause is a long list of ELSE-IFs. Break up a nested structure. Use a balanced IF-THEN-ELSE structure. OPTION NOT YET IMPLEMENTED (500) This compiler option is not yet implemented.
Additional Documentation 507 MESSAGE W CAUSE ACTION 508 MESSAGE W CAUSE ACTION 509 MESSAGE W CAUSE BOTH $GLOBAL$ AND $EXTERNAL$ NOT ALLOWED (507) The option $GLOBAL$ occurred after the option $EXTERNAL$ was speci ed. Since only one is allowed, $GLOBAL$ was ignored. The option $EXTERNAL$ occurred after the option $GLOBAL$ was speci ed. Since only one is allowed, $EXTERNAL$ was ignored. Remove $GLOBAL$ or $EXTERNAL$, whichever is appropriate.
Additional Documentation 512 MESSAGE W CAUSE RUN TIME DIVISION BY ZERO (512) In an expression A DIV B, B = 0. ACTION In a constant expression A DIV B, B = 0. Correct the expression. 513 MESSAGE W CAUSE ACTION 514 MESSAGE W CAUSE ACTION 515 MESSAGE W CAUSE ACTION 516 MESSAGE W CAUSE ACTION 519 MESSAGE W CAUSE EMPTY INCLUDE FILE (513) The INCLUDE le had no text in it. Verify that the lename is correct.
Additional Documentation 521 MESSAGE W CAUSE ACTION 522 MESSAGE W CAUSE ACTION 523 MESSAGE W CAUSE ACTION 524 MESSAGE W CAUSE ACTION 525 MESSAGE W CAUSE ACTION 526 MESSAGE W CAUSE ACTION 527 MESSAGE W CAUSE ACTION A-40 Error Messages BODY OF FOR LOOP WILL NEVER EXECUTE (521) Values of the initial and nal expressions will prevent the body of the FOR loop from ever executing.
Additional Documentation 528 MESSAGE W CAUSE CAUSE CAUSE 530 MESSAGE W CAUSE ACTION 532 MESSAGE W CAUSE ACTION 533 MESSAGE W CAUSE ACTION 534 MESSAGE W CAUSE ACTION 535 MESSAGE W CAUSE ACTION 536 MESSAGE W CAUSE ACTION PREVIOUS VERSION OF '!' INACTIVATED (528) A procedure or function by the same name already exists in the USL le and has been inactivated.
Additional Documentation 537 MESSAGE W CAUSE ACTION 538 MESSAGE W CAUSE ACTION 539 MESSAGE W CAUSE ACTION 540 MESSAGE W CAUSE ACTION 541 MESSAGE W CAUSE ACTION 549 MESSAGE W CAUSE ACTION 550 MESSAGE W CAUSE ACTION 551 MESSAGE W CAUSE ACTION 552 MESSAGE W CAUSE ACTION A-42 Error Messages THIS PREVIOUSLY UNIMPLEMENTED FEATURE IS NOW IMPLEMENTED (537) New functionality has been added of which the user should be aware. None.
Additional Documentation 553 MESSAGE W CAUSE ACTION CAUSE ACTION 554 MESSAGE W CAUSE ACTION 555 MESSAGE W CAUSE ACTION 556 MESSAGE W CAUSE ACTION 557 MESSAGE W CAUSE ACTION 558 MESSAGE W CAUSE ACTION '!' and '!' ARE INCOMPATIBLE COMPILER OPTIONS (553) These options are not compatible. The second was ignored. Delete one of the options.
Additional Documentation 559 MESSAGE W CAUSE ACTION 560 MESSAGE W CAUSE ACTION ACTION 561 MESSAGE W CAUSE ACTION ACTION 562 MESSAGE W CAUSE ACTION ACTION ACTION 568 MESSAGE W CAUSE ACTION A-44 Error Messages INVALID $SHLIB VERSION DATE STRING (559) The date string passed to the $SHLIB VERSION compiler option is invalid. The date string should be in the form: month/year. The year may be a 2 or 4 digit value. A month/year value representing a date earlier than January 1990 is invalid.
Additional Documentation 569 MESSAGE W CAUSE ACTION 570 MESSAGE W CAUSE ACTION 571 MESSAGE W CAUSE ACTION 572 MESSAGE W CAUSE ACTION 573 MESSAGE W CAUSE ACTION NO ASSEMBLY FILE FOUND. LIST CODE NOT PERFORMED (569) The compiler could not nd the le with the assembly listing (usually \???.s" on HP-UX or \PASASSM" on MPE/iX). On MPE/XL;, this usually happens because the PASASSM le is too small to hold the assembly output (the default size is 40,000 records).
Additional Documentation 575 MESSAGE W CAUSE ACTION 576 MESSAGE W CAUSE ACTION 577 MESSAGE W CAUSE ACTION 582 MESSAGE W CAUSE ACTION 584 MESSAGE W CAUSE ACTION 586 MESSAGE W CAUSE ACTION 587 MESSAGE W CAUSE ACTION 588 MESSAGE W CAUSE ACTION 590 MESSAGE W CAUSE ACTION 591 MESSAGE W CAUSE ACTION A-46 Error Messages VALUE OF ESCAPECODE IS QUESTIONABLE HERE (575) The value returned by ESCAPECODE outside a RECOVER construct is unde ned.
Additional Documentation 592 MESSAGE W CAUSE ACTION ACTION 593 MESSAGE W CAUSE ACTION 594 MESSAGE W CAUSE ACTION 595 MESSAGE W CAUSE ACTION 596 MESSAGE W CAUSE ACTION 597 MESSAGE W CAUSE ACTION 598 MESSAGE W CAUSE ACTION LONG TO SHORT POINTER CONVERSION EMITTED IN STATEMENT \! " (592) A 64 bit address was converted to a 32 bit address. Only addresses that are in space registers 4 through 7 can be converted without an error.
Additional Documentation 599 MESSAGE W CAUSE ACTION 600 MESSAGE RT CAUSE ACTION 601 MESSAGE RT CAUSE ACTION CAUSE ACTION 602 MESSAGE RT CAUSE ACTION 603 MESSAGE RT CAUSE CAUSE CAUSE ACTION 604 MESSAGE RT CAUSE ACTION A-48 Error Messages POSSIBLE PARAMETER ADDRESS ALIGNMENT MISMATCH (599) A VAR parameter of unknown alignment is being passed as a reference parameter to an INTRINSIC which has a strict alignment requirement for that parameter.
Additional Documentation 605 MESSAGE RT CAUSE ACTION CAUSE ACTION CAUSE ACTION 606 MESSAGE RT CAUSE ACTION 607 MESSAGE RT CAUSE ACTION 608 MESSAGE RT CAUSE INVALID RELEASE PARAMETER (PASCERR 605) The parameter to RELEASE was not set by a previous call to MARK. Initialize the parameter with MARK. The parameter to RELEASE was set by a call to MARK, but a previous call to RELEASE has been made with this parameter. Get rid of one of the uses of MARK.
Additional Documentation 609 MESSAGE RT CAUSE ACTION CAUSE ACTION 610 MESSAGE RT CAUSE ACTION CAUSE ACTION 611 MESSAGE RT CAUSE BAD ALIGNMENT (PASCERR 609) A call to new or dispose passed a bad value for the alignment parameter; for example, the type to which the pointer points has an alignment which is not recognized by NEW or DISPOSE. The only legal values for the alignment are 1, 2, 4, 8, 16, and 2048.
Additional Documentation 622 MESSAGE RT CAUSE INVALID POINTER (PASCERR 622) A pointer with the value of NIL was dereferenced. A pointer with an unde ned value was dereferenced. A pointer set by MARK was dereferenced.
Additional Documentation 650 MESSAGE RT CAUSE ACTION 651 MESSAGE RT CAUSE ACTION 652 MESSAGE RT CAUSE ACTION 653 MESSAGE RT CAUSE ACTION 654 MESSAGE RT CAUSE ACTION 655 MESSAGE RT CAUSE ACTION 670 MESSAGE RT CAUSE ACTION 671 MESSAGE RT CAUSE ACTION 672 MESSAGE RT CAUSE ACTION A-52 Error Messages STRING OVERFLOW (PASCERR 650) An attempt was made to index beyond the maximum length of the string.
Additional Documentation 673 MESSAGE RT CAUSE ACTION 690 MESSAGE RT CAUSE ACTION 691 MESSAGE RT CAUSE ACTION 692 MESSAGE RT CAUSE ACTION 693 MESSAGE RT CAUSE ACTION 694 MESSAGE RT CAUSE ACTION 695 MESSAGE RT CAUSE ACTION CAUSE ACTION NUMBER OF SIGNIFICANT DIGITS CAUSED OVERFLOW (PASCERR 673) The number of signi cant digits was more than 32 for the standard function BINARY, 11 for the function OCTAL, or 8 for the function HEX.
Additional Documentation 696 MESSAGE RT CAUSE ACTION 697 MESSAGE RT CAUSE ACTION 698 MESSAGE RT CAUSE ACTION 699 MESSAGE RT CAUSE ACTION 700 MESSAGE RT CAUSE ACTION 701 MESSAGE RT CAUSE ACTION 702 MESSAGE RT CAUSE ACTION 703 MESSAGE RT CAUSE ACTION 704 MESSAGE RT CAUSE ACTION A-54 Error Messages WRITE ON READ-ONLY FILE (PASCERR 696) An attempt was made to perform an output operation on a le opened for input access only.
Additional Documentation 705 MESSAGE RT CAUSE ACTION 706 MESSAGE RT CAUSE ACTION 707 MESSAGE RT CAUSE ACTION 708 MESSAGE RT CAUSE ACTION 709 MESSAGE RT CAUSE ACTION 710 MESSAGE RT CAUSE ACTION 711 MESSAGE RT CAUSE ACTION 712 MESSAGE RT CAUSE ACTION 713 MESSAGE RT CAUSE ACTION FILE NOT OPENED FOR DIRECT ACCESS (PASCERR 705) An attempt was made to perform a direct access le operation on a le not opened for direct access with the OPEN procedure.
Additional Documentation 714 MESSAGE RT CAUSE ACTION 715 MESSAGE RT CAUSE ACTION 716 MESSAGE RT CAUSE ACTION 717 MESSAGE RT CAUSE ACTION 718 MESSAGE RT CAUSE ACTION 719 MESSAGE RT CAUSE ACTION 720 MESSAGE RT CAUSE ACTION 721 MESSAGE RT CAUSE ACTION A-56 Error Messages INVALID CLOSE OPTION (PASCERR 714) An invalid disposition option was found in the second parameter to CLOSE. Correct the option.
Additional Documentation 722 MESSAGE RT CAUSE ACTION 723 MESSAGE RT CAUSE ACTION 724 MESSAGE RT CAUSE ACTION 725 MESSAGE RT CAUSE ACTION 799 MESSAGE RT CAUSE ACTION 808 MESSAGE CT CAUSE ACTION 809 MESSAGE CT CAUSE ACTION 810 MESSAGE CT CAUSE ACTION CANNOT \ASSOCIATE" FILE OPENED BY A PASCAL ROUTINE (PASCERR 722) An attempt was made to associate a le that was not opened with a system provided open routine. Instead, the le was opened with a PASCAL open routine.
Additional Documentation 811 MESSAGE CT CAUSE ACTION 813 MESSAGE CT CAUSE ACTION 814 MESSAGE CT CAUSE ACTION 816 MESSAGE CT CAUSE ACTION CAUSE ACTION 817 MESSAGE CT CAUSE ACTION 818 MESSAGE CT CAUSE ACTION COERCION REQUIRES $TYPE COERCION 'NONCOMPATIBLE'$ (811) The current $TYPE COERCION 'string'$ is insu cient to permit this type coercion. Set the type coercion level to that given in the message. This is very dangerous coding practice.
Additional Documentation 821 MESSAGE CT CAUSE ACTION 822 MESSAGE CT CAUSE ACTION 823 MESSAGE CT CAUSE ACTION 824 MESSAGE CT CAUSE ACTION 825 MESSAGE CT CAUSE ACTION 826 MESSAGE CT CAUSE ACTION 828 MESSAGE CT CAUSE ACTION 831 MESSAGE CT CAUSE ACTION 832 MESSAGE CT CAUSE ACTION BIAS + COUNT IS GREATER THAN MAXIMUM ARRAY INDEX (821) The bias and move count parameters to a MOVE procedure will always cause an index range error before the move is completed.
Additional Documentation 833 MESSAGE CT CAUSE ACTION 834 MESSAGE CT CAUSE ACTION CAUSE ACTION 835 MESSAGE CT CAUSE ACTION 836 MESSAGE CT CAUSE ACTION 837 MESSAGE CT CAUSE ACTION 838 MESSAGE CT CAUSE ACTION 839 MESSAGE CT CAUSE ACTION 841 MESSAGE CT CAUSE ACTION A-60 Error Messages INVALID ROUTINE OPTION (833) A routine option was declared that is not a known routine option. Check the spelling.
Additional Documentation 842 MESSAGE CT CAUSE ACTION 844 MESSAGE CT CAUSE ACTION 845 MESSAGE CT CAUSE ACTION 846 MESSAGE CT CAUSE ACTION 847 MESSAGE CT CAUSE ACTION 848 MESSAGE CT CAUSE ACTION 849 MESSAGE CT CAUSE ACTION 850 MESSAGE CT CAUSE ACTION 851 MESSAGE CT CAUSE ACTION DEFAULT VALUE NOT COMPATIBLE WITH FORMAL PARAMETER (842) A parameter was assigned a default value whose type does not match the type of the formal parameter. Fix the default value.
Additional Documentation 852 MESSAGE CT CAUSE ACTION 856 MESSAGE CT CAUSE ACTION 858 MESSAGE CT CAUSE ACTION 859 MESSAGE CT CAUSE ACTION 860 MESSAGE CT CAUSE ACTION CAUSE ACTION 861 MESSAGE CT CAUSE ACTION 862 MESSAGE CT CAUSE ACTION A-62 Error Messages NOT A DEFAULT FORMAL PARAMETER (852) A formal parameter supplied to the Haveoptvarparm function is not a default parameter. Remove this call or check the list of default parameters.
Additional Documentation 863 MESSAGE CT CAUSE ACTION 864 MESSAGE CT CAUSE ACTION 866 MESSAGE CT CAUSE ACTION 868 MESSAGE CT CAUSE ACTION THIS FEATURE IS NOT IMPLEMENTED (863) The feature in use has not been implemented in the current compiler. Remove this feature from the source code. BYTE OFFSET NOT PERMITTED WITH PROCEDURE OR FUNCTION VAR (864) ADDR takes a second parameter only if the rst parameter is not a procedure or function variable. Remove the second parameter.
Additional Documentation 871 MESSAGE CT CAUSE ACTION CAUSE ACTION 872 MESSAGE CT CAUSE ACTION 873 MESSAGE CT CAUSE ACTION 874 MESSAGE CT CAUSE ACTION 875 MESSAGE CT CAUSE ACTION 876 MESSAGE CT CAUSE ACTION A-64 Error Messages INVALID ARRAY PARAMETERS TO MOVE FAST. (871) Both array parameters to Move Fast must have elements with the same sizes. Use some other mechanism to move the array.
Additional Documentation 877 MESSAGE CT CAUSE ACTION INVALID DEREFERENCING OF AN IMPORTED POINTER (877) Trying to dereference an imported pointer whose type is not de ned. Import the type that the pointer points to. Do not dereference the pointer in this module. 878 MESSAGE CT CAUSE INVALID USE OF AN INLINED ROUTINE (878) The address of an inlined routine is being requested.
Additional Documentation 882 MESSAGE CT CAUSE ACTION 883 MESSAGE CT CAUSE ACTION 884 MESSAGE CT CAUSE ACTION 885 MESSAGE CT CAUSE ACTION 886 MESSAGE CT CAUSE ACTION 887 MESSAGE CT CAUSE ACTION 888 MESSAGE CT CAUSE ACTION A-66 Error Messages MIXED MODE PACKING NOT ALLOWED (882) Mixing $HP3000 16$ and $HP3000 32$ in data type de nitions is not allowed. Don't mix modes in data declarations.
Additional Documentation 889 MESSAGE CT CAUSE ACTION 890 MESSAGE CT CAUSE ACTION 891 MESSAGE CT CAUSE ACTION 892 MESSAGE CT CAUSE ACTION 893 MESSAGE CT CAUSE ACTION 894 MESSAGE CT CAUSE ACTION CONFORMANT ARRAYS NOT ALLOWED WITH $HP3000 16$ (889) Conformant arrays are not implemented when using $HP3000 16$. Do not use this feature with $HP3000 16$.
Additional Documentation 900 MESSAGE RT CAUSE ACTION 905 MESSAGE RT CAUSE INCORRECT POINTER ALIGNMENT (900) Internal parameter to CHKA. No action is required. Internal use only. INVALID PROCEDURAL/FUNCTIONAL VALUE REFERENCED (905) The value does not denote any actual procedure or function. The static nesting level of the value does not correspond to the current state of the activation stack. The value is NIL.
Additional Documentation 914 MESSAGE RT CAUSE ACTION 5001 MESSAGE W CAUSE ACTION 5002 MESSAGE W CAUSE ACTION 5004 MESSAGE W CAUSE ACTION GOTO EXECUTED BUT CANNOT UNWIND DESCRIPTOR FOR THE FRAME (914) A non-local GOTO was executed, but one or more of the procedures in the program stack has a frame that is not unwindable. Contact Hewlett-Packard. GOTO OUT OF BLOCK TO MULTIPLE ENTRY PT. (5001) Goto out of block to procedure with multiple entry points. Warning only. No action required.
Additional Documentation 5209 MESSAGE CT CAUSE CANNOT OPEN OBJECT FILE (5209) The compiler cannot open the object le. This may be because: (a) You do not have write permission in the group (on MPE/iX) or directory (on HP-UX) that you are working in. (b) You have exceeded some physical disk space limit. ACTION (a) Work in a group or directory in which you have write permission or get write permission in the current group or directory. (b) Remove some unnecessary les to make room for your object le.
Additional Documentation 5214 MESSAGE CT CAUSE CANNOT CLOSE ASSEMBLY FILE (5214) The compiler could not close the assembly le. This may be because: (a) You do not have write permission in the group (on MPE/iX) or directory (on HP-UX) that you are working in. (b) You have exceeded some physical disk space limit. ACTION (a) Work in a group or directory in which you have write permission or obtain write permission in the current group or directory.
Additional Documentation 6057 MESSAGE W CAUSE ACTION 6058 MESSAGE W CAUSE ACTION OPTDRIVER: BAD OPTIMIZATION LEVEL SPECIFIED; DEFAULT OF 0 USED. (6057) Internal compiler error. Report error to your HP Service Representative. OPTDRIVER: BAD SCHEDULER ALGORITHM SPECIFIED, USED DEFAULT. (6058) Internal compiler error. Check argument to +DS, then report error to your HP Service Representative. ACTION OPTDRIVER: !1 BASIC BLOCKS; DROPPING TO LEVEL 1 OPTIMIZATION FOR !2.
Additional Documentation 6305 MESSAGE CT CAUSE ACTION 6306 MESSAGE CT CAUSE ACTION 6307 MESSAGE CT CAUSE ACTION 6308 MESSAGE CT CAUSE ACTION RALLOC: OUT OF GENERAL REGISTERS. (6305) Possible overly complex expression. Simplify large or complex expression. RALLOC: OUT OF CALLEE SPACE REGISTERS. (6306) Long pointer expression too complex. Simplify long pointer expressions. RALLOC: OUT OF CALLER SPACE REGISTERS. (6307) Long pointer expression too complex. Simplify long pointer expressions.
Additional Documentation ON HP-UX, the following warnings are generated if you pass a model number that is not found in the /usr/lib/sched.models le. 7000 MESSAGE W CAUSE ACTION 7001 MESSAGE W CAUSE ACTION MODEL NUMBER IS UNKNOWN; WILL DEFAULT TO arch-rev CODE GENERATION. (7000) The model number given on a +DA option is not known to the compiler. The default code generation is as speci ed in the warning.
Additional Documentation 7100 to 7109 MESSAGE INTERNAL COMPILER ERROR. I CAUSE The compiler is in error. Report error to your HP Service Representative. ACTION 7110 MESSAGE I CAUSE ACTION DEBUG INFORMATION MAY BE CORRUPT; \! " UNRESOLVABLE REFERENCE(S). (7110) User errors. Correct all user errors or remove -g or $SYMDEBUG options and recompile. If there are no user errors, report error to your HP Service Representative.
Additional Documentation ACTION OBJECT IS TOO BIG TO FIT INTO RL. (7207) Object size is too large for the RL requested. Check for an RL le that is too small or split up object (MPE/iX). 7400 to 7999 MESSAGE INTERNAL COMPILER ERROR. I CAUSE The compiler is in error. Report error to your HP Service Representative.
B ASCII Character Codes Table B-1 maps each ASCII character to its decimal and hexadecimal code, its ASCII symbol, and its name. Each code is stored in eight bits; thus the decimal codes are between 0 and 255, and the hexadecimal codes are between 0 and FF. Table B-1.
Additional Documentation Table B-1.
Additional Documentation Table B-1. ASCII Character Codes (continued) Decimal Code Hexadecimal Code ASCII Symbol Name 36 24 $ Dollar sign 37 25 % Percent sign 38 26 & Ampersand 39 27 ' Apostrophe 40 28 ( Left parenthesis 41 29 ) Right parenthesis 42 2A * Asterisk 43 2B + Plus sign 44 2C , Comma 45 2D - Minus sign 46 2E .
Additional Documentation Table B-1.
Additional Documentation Table B-1.
Additional Documentation Table B-1.
Additional Documentation Table B-1.
C Compiler Limits and Values These compiler limits are maximum values that you cannot change: Number of: Maximum Value Bits per structure 2147483600 Characters per identi er 132 Characters per source line 132 Characters per string 268435447 Elements per array 268435455 Elements per enumerated type 17367 Elements per set 2147483616 Nested IF options * 12 Nested INCLUDE options * Operating system dependent Nested PUSH options * 15 Nested TRY-RECOVER constructs 30 * If a program contains one INCLUDE option, th
Glossary actual parameter An argument that is passed to a procedure, function, or subprogram. Contrast with formal parameter . address An exact location in memory. A program can store or retrieve data from this address. algorithm A procedure used to solve a task. It describes the sequence of steps or operations, done in a nite number of steps. allocate To set up a memory location to hold variable values. alpha character A character in the range of A through Z and a through z.
Additional Documentation assignment statement Assigns a value to a variable or function by using the special Pascal symbol \:=". binary The method used to represent numbers, alphabetic characters, and symbols in digital computers. It is a base two numbering system that uses only two digits, 0's and 1's, to express numeric quantities. bit A unit of information with a value of 1 or 0. Usually eight bits equal one byte. A bit is the smallest unit of information in a digital computer.
Additional Documentation compiler A program that translates source code into machine instructions. The compiler also diagnoses and reports syntax errors found in the application program. compound statement A group of statements enclosed with the reserved words begin and end , and which are treated as a single statement. concatenation The operation of joining two or more character strings together. constant A xed value, as opposed to a variable which is a symbol for a changing value.
Additional Documentation expression A construct composed of operators and operands that represent the computation of a result of a particular type. external routine A routine de ned in another compilation unit. le-equate To redirect the association of one physical le to another physical le, or to specify additional le attributes using the MPE XL FILE command. formal parameter A parameter which is de ned in a procedure, function, or subprogram header.
Additional Documentation minint The minimum value that an integer can contain. NLS An acronym for Native Language Support. operand The variables, constants, or literals that are used in an operation. operator De nes the action to be performed on one or more operands. optimization The process which the compiler uses to modify your program so that it uses machine resources more e ciently. parameter The argument used for sending and receiving information to and from functions and procedures.
Additional Documentation semantic error An error which is caused by using the wrong wording in a program. separate compilation The process of separating the source for a large program into pieces that can be compiled independently of other pieces. source code The input program that is to be translated by the compiler. Standard Pascal All of the rules and de nitions of Pascal as de ned by the ANSI standard. statement Pascal's single unit of activity. Each statement is separated by a semicolon.
Index 1 16-bit characters, parsing, 12-83 A abs function, 9-42 action, selecting an, 6-11 actual parameters, 12-26 addressing routines or data, 11-44 addr prede ned function, 11-44 addtopointer prede ned function, 11-46 advancement of program ow, 6-5 algorithm HP Pascal packing, 12-50 Pascal/V packing, 12-49 ALIAS compiler option, 12-8{10 ALIGNMENT compiler option, 12-11 allocation of storage, 9-2, 9-3 allocation procedures, 9-2 AND operator, 4-12 ANSI compiler option, 12-12 ANSI/IEEE Extensions, 1-2{8 ap
case selection, 6-8 CASE statement, 1-2, 6-8 character codes, ASCII, B-1{7 character literals, 1-7 char data type, 3-10 char literal, 3-10 CHECK ACTUAL PARM compiler option, 12-26{27 CHECK FORMAL PARM compiler option, 12-28{29 chr function, 9-56 close procedure, 10-8 closing les, 10-1, 10-8 cmpbytes function, 9-32 code duplication, 12-63 generation for routines, 12-39 range checking, 12-98 CODE compiler option, 12-30 CODE OFFSETS compiler option, 12-31{32 coercion, 11-22 noncompatible type, 11-29 ordinal an
PUSH, 12-97 RANGE, 12-98 restoring option settings, 12-96 RLFILE, 12-99 RLINIT, 12-100 S300 EXTNAMES, 12-101 saving option settings, 12-97 scopes, table of, 12-2 SEARCH, 12-103 SET, 12-105 SHLIB CODE, 12-106 SHLIB VERSION, 12-107 SKIP TEXT, 12-108 SPLINTR, 12-110, 12-121 standard, 12-5 STANDARD LEVEL, 12-111, 12-112 STATEMENT NUMBER, 12-113 STRINGTEMPLIMIT, 12-116 SUBPROGRAM, 12-117 SYMDEBUG, 12-119 SYSINTR, 12-120, 12-121 SYSPROG, 12-122 system-dependent, 12-1, 12-6 system-independent, 12-1, 12-3{5 system
declarations, 5-1 array, 3-19 constant de nition, 11-30 export, 7-9 import, 7-9 label, 5-15 system programming extensions, 11-30 variable, 5-18 DEFAULT PARMS routine options, 11-39 defaults eld widths, table of, 10-38 parameters, 11-39 de nitions type, 5-16 deleting characters from a string, 9-11 directives, 7-7 EXTERNAL, 12-39 FORWARD, 7-8, 8-8, 8-9 disassociate procedure, 10-9 dispose procedure, 9-5 disposing of storage, 9-5 DIV operator, 4-9 documenting a program, 2-10 +DS compiler option, 12-48 duplicat
font speci cation, 12-41 FOR..
HP-UX compiler options, 12-6 I identi er map, 12-123 identi ers, 1-5 de nition, 2-5 global, 2-6 local, 2-6 prede ned, table of, 11-7 scope of, 2-6 IF compiler option, 12-53{58 IF..THEN..ELSE statement, 6-10 IF..
string, 1-7, 2-12 unsigned integer, 2-8 ln function, 9-46 LOCALITY compiler option, 12-79 locality names, 12-79 local variables, 5-18 logical les, 3-21, 10-1 LONG CALLS compiler option, 12-80 longint data type, 3-13, 4-7 longreal data type, 3-3, 3-17, 4-7 longreal literals, 2-9 longreal numbers, 1-6 lowercase letter di erentiation, 12-78 M MAPINFO compiler option, 12-81 marking the allocation state, 9-7 mark procedure, 9-7 math libraries linking, 12-48 maxint, 5-6 de nition, 1-6 maxpos function, 10-16 migr
operands, 4-4 implicit conversion of, 4-7 table of, 4-4 operating systems HP-UX, available language features, 12-89 MPE, available language features, 12-90 MPE/iX, available language features, 12-89{90 speci cation, 12-89{90 operators, 4-5 AND, 4-12 arithmetic, 4-7 Boolean, 4-10 concatenation, 4-22 DIV, 4-9 dividend or divisor (DIV), 4-9 IN, 4-18 MOD, 4-10 modulus (MOD), 4-10 NOT, 4-13 OR, 4-14 pointer relational, 4-19 precedence, 4-6 relational, 4-15 SET, 4-23 set relational, 4-17 simple relational, 4-16 s
PAGEWIDTH compiler option, 12-94 parameters actual, 12-26 default, 11-38 extensible, 11-40 formal, 11-34, 12-28 FUNCTION, 11-19 functional, 6-26, 8-1, 8-11 hidden, 11-40 list of formal, 8-1 mechanisms, 11-56 procedural, 6-26, 8-1, 8-11 PROCEDURE, 11-19 reference, 6-26, 8-1, 8-11 relationship of standard level compiler option, 11-2 syntax of formal, 8-2 tables, 12-123 value, 6-26, 8-1 parsing 16-bit characters, 12-83 PARTIAL EVAL compiler option, 4-10, 12-95 partial evaluation of Boolean expressions, 12-95 P
put, 10-23 read, 10-24 readdir, 10-28 readln, 10-30 release, 9-8 reset, 10-31 rewrite, 10-33 round, 9-54 routine mechanisms, 11-59 scanuntil, 9-36 scanwhile, 9-38 seek, 10-35 setstrlen, 9-9 sin, 9-47 size functions, 11-61{64 sqr, 9-48 sqrt, 9-49 str, 9-17 strappend, 9-10 strdelete, 9-11 strinsert, 9-12 strlen, 9-18 strltrim, 9-19 strmax, 9-20 strmove, 9-13 strpos, 9-21 strread, 9-14 strrpt, 9-22 strrtrim, 9-23 strwrite, 9-16 succ, 9-59 system programming extensions, 11-44 trunc, 9-55 unpack, 9-26 waddress,
program control procedures, 9-28 assert, 9-29 halt, 9-28 program heading, 5-1, 7-3 program structure block, 7-4 declaration part, 7-5 directive, 7-7 example, 7-1 EXPORT, 7-13 function, 7-8 heading, 7-3 IMPLEMENT, 7-17 IMPORT, 7-15 module, 7-9 procedure, 7-7 prompt, 1-6 prompt procedure, 10-22 PUSH compiler option, 12-97 put procedure, 10-23 R range checking, 12-98 RANGE compiler option, 12-98 readdir procedure, 10-28 reading a value in strings, 9-14 readln procedure, 10-30 read procedure, 10-24 real data t
DEFAULT PARMS, 11-39 EXTENSIBLE, 11-40 extensible parameters, 11-40 INLINE, 11-41 UNCHECKABLE ANYVAR, 11-42 UNRESOLVED, 11-43 routine references, 11-44 routines prede ned, 11-44 routine type, 11-19 S S300 EXTNAMES compiler option, 12-101 saving compiler option settings, 12-97 scanning source byte strings, 9-36{39 scanuntil function, 9-36 scanwhile function, 9-38 SEARCH compiler option, 12-103 searching for module de nitions, 12-103 search path, 12-59 setting or modifying, 12-62 seek procedure, 10-35 select
stdoutput standard module, 7-10 STDPASCAL WARN compiler option, 12-115 stopping a program, 9-28 storage allocation, 9-2, 9-3 deallocation, 9-2, 9-5 storage type coercion, 11-28 strappend procedure, 9-10 strconvert procedure, 12-50 strdelete procedure, 9-11 str function, 9-17 string assignment compatibility, 3-36 table of rules, 3-36 string constructor, 5-14 string data types, 3-30 string functions, 9-17{23 string literals, 1-7, 2-12, 3-30 string procedures, 9-9{16 string relational operators, 4-20 string ro
formatting of output, 10-38 input, output, 3-23 standard, 3-22 TITLE compiler option, 12-127 title speci cation, 12-127 transfer functions, 9-54 pred, 9-58 round, 9-54 succ, 9-59 trunc, 9-55 transfer procedures, 9-24{27 pack, 9-24 unpack, 9-26 true, Boolean value, 5-5 trunc function, 9-55 type text, 3-21 type coercion, 11-22, 11-34 ordinal, 11-23 other, 11-25 pointer, 11-24 TYPE COERCION compiler option, 11-22, 12-128 type compatibility, 1-2, 3-34{36 type de nition, 5-16, 5-17 type identi er, 3-32 types int