[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP Pascal for OpenVMS
Language Reference Manual


Previous Contents Index


Appendix C
Description of Implementation Features

The standards for Pascal allow some features of the language to be defined by a particular implementation or to be dependent on an implementation.

This appendix describes the HP Pascal treatment of the following features:

For More Information:

On Pascal standards ( Section 1.1)

C.1 Implementation-Defined Features

The value of each character allowed in a character string
Treatment: See Section 1.2.1.

The range of real number values represented by the type REAL
Treatment: See Section 2.2.

The characters represented by the type CHAR and their ordinal values
Treatment: See Section 1.2.1.

The point at which the REWRITE, PUT, RESET, and GET procedures are performed on a file
Treatment: Performed immediately unless the file is a terminal file, in which case delayed device access occurs (see Section 9.5.3).

The value of MAXINT
Treatment: See Table 2-2

The accuracy to which the results of real-number operations are calculated
Treatment: See Table 2-7.

Default field widths
Treatment: See Section 9.6.

The number of digits used to represent the exponent of a floating-point number
Treatment:

REAL, SINGLE (F_floating and IEEE S floating-point format) 2
DOUBLE (D_floating) 2
DOUBLE (G_floating and IEEE T floating point-format) 3
QUADRUPLE (H_floating and X_floating) 4

The value of the exponent character
Explanation: 'E'.

The case (upper or lower) in which the Boolean values TRUE and FALSE are printed as output
Explanation: Uppercase; that is, TRUE and FALSE.

The effect of the PAGE procedure
Treatment: PAGE writes a line containing only the form-feed character (ASCII value 12).

C.2 Implementation-Dependent Features

The unextended Pascal standard and the Extended Pascal standard list features that can vary from implementation to implementation. It is illegal for a program to depend on these features. HP Pascal does not detect when a program depends on any of these features. Relying on them may yield incorrect results or unexpected program terminations.

Any or all of these implementation-dependent features may change without notice.

For those items in this section that pertain to order of evaluation, HP Pascal does not specify the order of evaluation. Depending on several heuristics in the compiler, the order of evaluation can be left-to-right, right-to-left, or random with complete or short-circuit evaluation. The order of evaluation is allowed to vary between invocations of the compiler and even between individual uses of source language features.

The order of evaluation of the following items:

  • Expressions used as discriminant values
  • Index expressions and access to the array or string variable in a indexed variable
  • Index values of an array variable
  • Expressions d1,...,dn in new(p,d1,...,dn)
  • Expressions of a set member designator
  • Set member designators in a set constructor
  • Operands of a dyadic (binary) operator, except for AND_THEN and OR_ELSE
  • Component values of a structured value constructor
  • Index expressions in an indexed constant
  • Expressions in a set constructor

Treatment: Random order.

Order of selecting members of the set value in the FOR IN statement
Treatment: Random order.

Whether the first character read when reading an integer or real from a text file is the value of the buffer variable or the value of the next character from the input record
Treatment: HP Pascal uses the next character in the input record and ignores the contents of the file buffer.

Order of evaluating, and accessing of actual parameters of a function call
Treatment: Random order.

Order of evaluating, and accessing of actual parameters of a procedure call
Treatment: Random order.

Order of accessing the variable and evaluating the expression in an assignment statement
Treatment: Random order.

The effect of reading a text file for which the PAGE procedure was called
Treatment: Reads a line containing only the form-feed character (ASCII value 12).

The binding of a nonfile variable whose name is listed in the program heading to entities that are external to the program
Treatment: Reported as an error at compile time.

The binding of a file variable whose name is listed in the program heading
Explanation: The file name (unless it is INPUT or OUTPUT) is equated to a logical name if a translation for the file name exists. If there is no corresponding translation, the file type DAT is appended to the name listed in the heading, as in INFILE.DAT. If the file name is INPUT, the file is equated to PAS$INPUT, if PAS$INPUT is defined; otherwise, the file is equated to SYS$INPUT. Similarly, if the file name is OUTPUT, the file is equated to PAS$OUTPUT, if PAS$OUTPUT is defined; otherwise, the file is equated to SYS$OUTPUT.


Appendix D
Compiler and Run-Time System Error Detection

This appendix describes how the HP Pascal compiler and run-time system detect violations of the Pascal language standards. Errors detected at run-time cause a program to terminate and return appropriate error messages. Errors described here as not detected cause a program to produce unexpected results.

For More Information:

  • On Pascal standards ( Section 1.1)
  • On HP Pascal error messages (HP Pascal for OpenVMS User Manual)

D.1 Error Message Information

The type of an index value is not assignment compatible with the index type of an array.
Explanation: Detected at run time if bounds checking was enabled during compilation.

The current variant changes while a reference to it exists.
Explanation: Not detected. An example of a reference to a variant is the passing of the variant to a formal VAR parameter.

The value of a variable to which a pointer refers (p^) is NIL.
Explanation: Usually detected at run time. Always detected if pointers checking was enabled during compilation.

The value of a variable to which a pointer refers (p^) is undefined.
Explanation: Not detected.

The DISPOSE procedure is called to dispose of a heap-allocated variable while a reference to the variable exists.
Explanation: Not detected. Examples of such references are passing the variable, or a component of it, to a formal VAR parameter, or using the variable in a WITH statement (if the variable is a record).

The value of file f changes while a reference to f^ exists.
Explanation: Not detected. An example of a reference to f^ is the passing of f^ by reference to a routine; until the routine has ceased execution, you cannot perform any operation on file f.

The ordinal type of an actual parameter is not assignment compatible with the type of the corresponding formal parameter.
Explanation: Detected at run time if subrange checking was enabled during compilation of the called routine.

The set type of an actual parameter is not assignment compatible with the type of the corresponding formal parameter.
Explanation: Detected at run time if subrange checking was enabled during compilation of the called routine.

A file is not in generation mode when a PUT, WRITE, WRITELN, or PAGE procedure is attempted.
Explanation: Detected at run time.

A file is in undefined mode when a PUT, WRITE, WRITELN, or PAGE procedure is attempted.
Explanation: Not detected.

The result of an EOF function is not TRUE when a PUT, WRITE, WRITELN, or PAGE procedure is attempted.
Explanation: Detected at run time. The operation is illegal only when the file is accessed sequentially.

The value of the file buffer variable is undefined when a PUT procedure is attempted.
Explanation: Not detected.

A file is in undefined mode when a RESET procedure is attempted.
Explanation: Not detected.

A file is not in inspection mode when a GET, READ, or READLN procedure is attempted.
Explanation: Detected at run time.

A file is in undefined mode when a GET, READ, or READLN procedure is attempted.
Explanation: Not detected.

The result of an EOF function is TRUE when a GET, READ, or READLN procedure is attempted.
Explanation: Detected at run time.

The type of the file buffer variable is not assignment compatible with the type of the variable that is a parameter to a READ or READLN procedure.
Explanation: Detected at run time.

The type of the expression being written by a WRITE or WRITELN procedure is not assignment compatible with the type of the file buffer variable.
Explanation: Detected at run time.

The current variant does not exist in the list of variants specified with the NEW procedure.
Explanation: Not detected.

The DISPOSE( p ) procedure is called to deallocate a pointer variable that was created using the variant form of the NEW procedure.
Explanation: Not detected.

The variant form of the DISPOSE procedure does not specify the disposal of the same number of variants that were created by the variant form of the NEW procedure.
Explanation: Not detected.

The variant form of the DISPOSE procedure does not specify the disposal of the same variants that were created by the variant form of the NEW procedure.
Explanation: Not detected.

The value of the parameter to the DISPOSE procedure is NIL.
Explanation: Detected at run time.

The value of the parameter to the DISPOSE procedure is undefined.
Explanation: Not detected.

A variant record created by the NEW procedure is accessed as a whole, rather than one component at a time.
Explanation: Not detected.

In the PACK( a,i,z ) procedure, the type of the index value i is not assignment compatible with the index type of a.
Explanation: Detected at run time if subrange checking was enabled during compilation.

The PACK procedure is attempted when the value of at least one component of a is undefined.
Explanation: Not detected.

The index value i in the PACK procedure is greater than the upper bound of the index type of a.
Explanation: Detected at run time if subrange checking was enabled during compilation.

In the UNPACK( z,i,a ) procedure, the type of the index value i is not assignment compatible with the index type of a.
Explanation: Detected at run time if subrange checking was enabled during compilation.

The UNPACK procedure is attempted when the value of at least one component of z is undefined.
Explanation: Not detected.

The index value i in the UNPACK procedure is greater than the upper bound of the index type of a.
Explanation: Detected at run time if subrange checking was enabled during compilation.

The resulting value of SQR( x ) does not exist.
Explanation: Detected at run time for integers if overflow checking was enabled during compilation; always detected at run time for real numbers.

In the expression LN( x ), the value of x is negative.
Explanation: Detected at run time.

In the expression SQRT( x ), the value of x is negative.
Explanation: Detected at run time.

The resulting value of TRUNC( x ) does not exist after the following calculations have been done: if the value of x is positive or zero, then 0 <= x-TRUNC( x ) < 1; otherwise, -1 < x-TRUNC( x ) <=0.
Explanation: Detected at run time if overflow checking was enabled during compilation.

The resulting value of ROUND( x ) does not exist after the following calculations have been done: if the value of 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 ).
Explanation: Detected at run time if overflow checking was enabled during compilation.

The resulting value of CHR( x ) does not exist.
Explanation: Detected at run time if subrange checking was enabled during compilation.

The resulting value of SUCC( x ) does not exist.
Explanation: Detected at run time if subrange checking was enabled during compilation.

The resulting value of PRED( x ) does not exist.
Explanation: Detected at run time if subrange checking was enabled during compilation.

The function EOF( f ) is called when the file f is undefined.
Explanation: Not detected.

The function EOLN( f ) is called when the file f is undefined.
Explanation: Not detected.

The function EOLN( f ) is called when the result of EOF( f ) is TRUE.
Explanation: Not detected.

A variable is not initialized before it is first used.
Explanation: Not detected.

In the expression x/y, the value of y is zero.
Explanation: Detected at run time.

In the expression i DIV j, the value of j is zero.
Explanation: Detected at run time.

In the expression i MOD j, the value of j is zero or negative.
Explanation: Detected at run time if subrange checking was enabled during compilation.

An operation or function involving integers does not conform to the mathematical rules for integer arithmetic.
Explanation: Detected at run time if overflow checking was enabled during compilation.

A function result is undefined when the function returns control to the calling block.
Explanation: Not detected.

The ordinal type of an expression is not assignment compatible with the type of the variable or function identifier to which it is assigned.
Explanation: Detected at run time if subrange checking was enabled during compilation.

The set type of an expression is not assignment compatible with the type of the variable or function identifier to which it is assigned.
Explanation: Detected at run time if subrange checking was enabled during compilation.

None of the case labels is equal in value to the case selector in a CASE statement.
Explanation: Detected at run time if case selector checking was enabled during compilation.

In a FOR statement, the type of the initial value is not assignment compatible with the type of the control variable, and the statement in the loop body is executed.
Explanation: Detected at run time if subrange checking was enabled during compilation. Assignment compatibility is not enforced if the statement in the loop body can never be executed.

In a FOR statement, the type of the final value is not assignment compatible with the type of the control variable and the statement in the loop body is executed.
Explanation: Detected at run time if subrange checking was enabled during compilation. Assignment compatibility is not enforced if the statement in the loop body can never be executed.

When an integer is being read from a text file, the digits read do not constitute a valid integer value. (Initial spaces and end-of-line markers are skipped.)
Explanation: Detected at run time.

When an integer is being read from a text file, the type of the value read is not assignment compatible with the type of the variable.
Explanation: Detected at run time if subrange checking was enabled during compilation.

When reading a real number from a text file, the digits read do not constitute a valid real number. (Initial spaces and end-of-line markers are skipped.)
Explanation: Detected at run time.

The value of the file buffer variable is undefined when a READ or READLN procedure is performed.
Explanation: Not detected.

A WRITE or WRITELN procedure specifies a field width in which the integers representing the total width and the number of fractional digits are less than 1.
Explanation: Not detected.

The bounds of an array passed to a conformant array parameter are outside the range specified by the conformant array's index type.
Explanation: Detected at run time if bounds checking was enabled during compilation.


Glossary


actual discriminant: The boundary or selector value that you specify in a schema type to form a valid data type.

actual parameter: A value passed to a routine in the routine call.

alternate key : A key value in components of a file of indexed organization from whichHP Pascal provides an index into the file. Your program can use an alternate key to provide another collating sequence (order of access) for the file components.

argument: A name in the routine header that specifies information about the type, size, and passing mechanism of data that is expected to be passed to the routine as an actual parameter. This term is synonymous with the term formal parameter.

array: A group of components, called elements, that all have the same data type and share a common identifier.

atomic instruction: An instruction that consists of one or more discrete operations that are handled by the hardware as a single operation, without interruption.

atomic operation: An operation that cannot be interrupted by other system events, such as an AST (asynchronous system trap) service routine; an atomic operation appears to other processes to be a single operation. Once an atomic operation starts, it will either complete without interruption or will restart itself from the beginning.

Read-modify-write operations are typically not atomic at an instruction level on a RISC machine.

attribute: An identifier that directs the HP Pascal compiler to change its behavior in some way.

attribute class: A category that indicates a common affect that a group of attributes has on programming, such as data alignment, storage allocation, and optimization classes.

automatic variable allocation: An attribute of a variable that indicates that the variable be allocated each time the program enters the routine in which the variable is declared and is deallocated each time the program exits from that routine.

base type: The data type of the data items in a set or of the object of a pointer. See also set.

cascade: An environment-file inheritance path that involves a compilation unit inheriting another compilation unit that inherits another compilation unit (and so forth). See also compilation unit and environment file.

case selector: An ordinal expression whose value at run time determines which statement in a CASE statement executes.

cells : A fixed-length file component in a file of relative file organization. Each cell is numbered consecutively from 1 to n.

compilation unit: A unit of code that can be compiled independently; the term compilation unit refers to either a program or a module.

compiler optimization: A set of processes or algorithms the compiler applies to your program to make it execute faster or use less memory.)

component: A single data item in a file.

component access mode: A method by which HP Pascal retrieves components from a file.

component format: A file characteristic that determines the size (or maximum size) of each component and any processing information needed in addition to the data portion of the component.

condition handler: A routine that is used to resolve an event, usually an error, that occurs during program execution and is detected by system hardware or software, or by the logic in a user application program.

constant expression: An expression that results in a value at the time you compile your program. See also run-time expression.

constructor: A list of values, surrounded by brackets ([]), used to assign values to structured objects, such as arrays, records, and sets.

control part: A data structure, internal to HP Pascal, that contains information used by the compiler to create and to access the data part of nonstatic types at run time. See also data part and nonstatic type.

current component: The file component that is currently located in the file buffer variable; this is the only file component accessible to the program at a given time.

data part: A data structure that contains an object of a variable whose type is nonstatic. HP Pascal usually accesses the data in the data part by accessing a pointer part that points to the object.

data type: A property of data that determines the range of values, set of valid operations, and maximum storage allocation for the data object.

HP Pascal extension: A language element that is not part of the unextended Pascal standard or the Extended Pascal standard. In the HP Pascal for OpenVMS Language Reference Manual, the term extension refers to language elements that are not part of the Extended Pascal standard. See also Extended Pascal standard and unextended Pascal standard.

declaration section: A part of a program, module, or routine that includes constant, label, type, variable, and routine declarations. A module can also contain an initialization (TO BEGIN DO) and a finalization (TO END DO) section. See also executable section, heading, and module.

delayed device access: An HP Pascal technique used to fill the file buffer. HP Pascal reads and inserts a file component into the file buffer only when the program is ready to process it (when the program makes the next reference to the file).

direct access : A component access method that locates a file component according to either the random access number or the key value. See also random access and key.

discriminated schema type: The data type resulting from applying actual discriminants to a schema type.

element: A component of an array. See also array.

environment file: A file, created using the ENVIRONMENT attribute, that contains descriptions of the constant, type, variable, procedure, and function identifiers contained in the outermost level of a compilation unit. Compilation units that inherit this file, using the INHERIT attribute, have access to the data items declared in the other compilation unit. See also attribute, compilation unit, and declaration section.

executable section: A part of a program or routine containing statements to execute. See also declaration section and heading.

expression: A group of identifiers and operators that result in a value. See also constant expression and run-time expression.

extended-digit notation: A standard format for integers that includes the specification of a base value (bases 2 to 32 are allowed), followed by the number sign (#), and followed by the extended-digit value.

Extended Pascal standard: The International Standard ISO 10206-1989. HP Pascal supports many features of this standard, but not all of them.

extended-string format: A format for character-string constants that allows you to place nonprinting ASCII characters, such as the bell and the backspace, into the character string.

extensions: See HP Pascal extension.

external file: A physical file that has a name and exists outside the context of a Pascal program. See also file.

field: A component of a record. The component can be of various data types.

file: An organized collection of logically related data items.

file component: See component.

fixed-length component format: A component format that specifies that all file components are the same length. See also component and component format.

formal discriminant: An identifier in a schema-type declaration that takes the place of specific boundary values or variant-record selectors. See also schema type.

formal parameter: A name in the routine header that specifies information about the type, size, and passing mechanism of data that is expected to be passed to the routine as an actual parameter. This term is synonymous with the term argument.

function: A subprogram that contains one or more statements to be executed once the function is called and that returns a single value.

generation mode: A file state that indicates when output is being written to a file. See also inspection mode and undefined mode.

heading: A part of a program, module, or routine that includes an identifier, a list of external files used (for programs and modules), a list of formal parameters (for routines), and a return value (for functions). See also declaration section, executable section, and formal parameter.

implementation module: A module that contains data to which you want to restrict access and that inherits an environment file from an interface module. See also environment file and interface module.

index : A internal data structure that provides pointers, based on key values, to file components in an indexed file.


Previous Next Contents Index