VAX PASCAL V4.0 Release Notes
VAX PASCAL V4.0 Release Notes
3 December 1989
3 December 1989
This document contains information about new features in VAX
PASCAL V4.0, differences between V4.0 and previous versions,
corrections included in VAX PASCAL V4.0, and other topics.
This file is of interest to both system management and
application programmers.
CONTENTS
CHAPTER 1 VAX PASCAL V4.0 RELEASE NOTES
1.1 Overview Of VAX Pascal V4.0 . . . . . . . . . . . 1-1
1.2 VAX Pascal V4.0 Installation . . . . . . . . . . . 1-1
1.2.1 VMS Version 5.2 Or Later Required . . . . . . . 1-1
1.2.2 PASCAL$STARTUP Startup File . . . . . . . . . . 1-1
1.2.3 Starlet Kit Now Combined With Pascal Kit . . . . 1-2
1.2.4 Online Examples Now Provided With Pascal Kit . . 1-2
1.3 Compatibility With Older Versions Of VAX Pascal . 1-2
1.3.1 /NOOPTIMIZE And Operand Evaluation Order . . . . 1-2
1.3.2 Default For /CHECK Qualifier And CHECK Attribute 1-3
1.3.3 SIZE And Related Routines Now Evaluate Operands 1-3
1.3.4 Multiple Parameters In The Same Parameter
Section . . . . . . . . . . . . . . . . . . . . 1-3
1.3.5 Environment Files . . . . . . . . . . . . . . . 1-4
1.3.6 Starlet Changes . . . . . . . . . . . . . . . . 1-4
1.3.7 Default ANA File Format Now Requires VAX SCA
V2.0 . . . . . . . . . . . . . . . . . . . . . . 1-4
1.4 New Features Of VAX Pascal V4.0 . . . . . . . . . 1-5
1.4.1 Schema Types . . . . . . . . . . . . . . . . . . 1-5
1.4.1.1 STRING Predefined Schema . . . . . . . . . . . . 1-7
1.4.1.2 The /CHECK=DECLARATIONS Qualifier . . . . . . . 1-7
1.4.1.3 Enhanced WITH Statement . . . . . . . . . . . . 1-8
1.4.2 AND_THEN And OR_ELSE Boolean Operators . . . . . 1-9
1.4.3 Initial State Specifiers . . . . . . . . . . . . 1-9
1.4.4 Enhanced Constructors . . . . . . . . . . . . 1-11
1.4.5 NEW Procedure Now Initializes Variant Tag
Fields . . . . . . . . . . . . . . . . . . . . 1-13
1.4.6 LOWER And UPPER Predeclard Functions . . . . . 1-14
1.4.7 FOR IN Statement . . . . . . . . . . . . . . . 1-14
1.4.8 Non-decimal Integer Constants . . . . . . . . 1-15
1.4.9 Array-indexing, Field-selecting, And
Deferencing FUNCTION Results . . . . . . . . . 1-15
1.4.10 Indexing And Selecting Structured Constants . 1-15
1.4.11 DATE, TIME And GETTIMESTAMP Builtin Routines . 1-16
1.4.12 Non-blank Padded String Comparison Routines . 1-16
1.4.13 Module Initialization And Finalization . . . . 1-16
1.4.14 New Predefined Constants . . . . . . . . . . . 1-17
1.4.15 The /STANDARD=EXTENDED Qualifier . . . . . . . 1-18
1.4.16 The /DESIGN Qualifier . . . . . . . . . . . . 1-18
1.4.17 DECwindows Compiler Interface . . . . . . . . 1-20
1.4.18 VAR/[CLASS_S] Packed Array Of Char Parameters 1-21
1.4.19 Code Quality Improvements . . . . . . . . . . 1-21
1.5 Documenation Information . . . . . . . . . . . . 1-21
1.6 Documentation Errors . . . . . . . . . . . . . . 1-22
1.7 Restrictions Lifted . . . . . . . . . . . . . . 1-23
1.7.1 Several OPEN Restrictions Now Removed . . . . 1-23
1.7.2 Non-printable Characters In Compile-Time
Expressions . . . . . . . . . . . . . . . . . 1-23
1.7.3 Multiple Parameters In The Same Parameter
Section . . . . . . . . . . . . . . . . . . . 1-23
1.7.4 Blank-Padding Fixed-Length String Formal
Parameters . . . . . . . . . . . . . . . . . . 1-24
1.8 Known Restrictions . . . . . . . . . . . . . . . 1-24
1.8.1 Schema Restrictions . . . . . . . . . . . . . 1-24
1.8.2 VMS Debugger Restrictions . . . . . . . . . . 1-26
1.8.2.1 Schema Types Require DBG$PROCESS NONE . . . . 1-26
1.8.2.2 Schema Types Require /NOOPTIMIZE . . . . . . . 1-26
1.8.2.3 Pointers To Undiscriminated Schema . . . . . . 1-26
1.8.3 AND_THEN And OR_ELSE In Constant Expressions . 1-26
1.8.4 SIZE Used With TIMESTAMP Type . . . . . . . . 1-27
1.8.5 Compile-time String Literals Cannot Be Larger
Than 8192 Characters . . . . . . . . . . . . . 1-27
1.8.6 PROGRAMs Cannot Generate Environment File If
Schema Are Present . . . . . . . . . . . . . . 1-27
1.8.7 Shareable Images Cannot Have File Variables In
[COMMON] . . . . . . . . . . . . . . . . . . . 1-27
1.8.8 Using The ARGUMENT Routine With VAR Parameters 1-27
1.8.9 Inherited Types And Standards Checking . . . . 1-28
1.8.10 Passing File Buffer Variables . . . . . . . . 1-29
CHAPTER 1
CHAPTER 1
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
1.1 Overview Of VAX Pascal V4.0
VAX Pascal V4.0 contains several new and powerful features. Most of
the features included in VAX Pascal V4.0 are from the Extended Pascal
standard (currently in draft form). These features provide such
things as run-time sized types and variables, ability to provide an
initial value for static, stack-based, and heap-based variables,
short-circuit Boolean evaluation, enhanced constructors, and many more
features.
VAX Pascal V4.0 also contains some features specific to the VAX/VMS
environment. Additionally, VAX Pascal V4.0 contains programming
design enhancements when used with VAX Language-Sensitive Editor and
VAX Source Code Analyzer.
1.2 VAX Pascal V4.0 Installation
The installation procedure for VAX Pascal V4.0 is described in the VAX
Pascal V4.0 Installation Guide included with the kit. Additionally,
some installation topics are also discussed below.
1.2.1 VMS Version 5.2 Or Later Required
VAX Pascal V4.0 requires VMS V5.2 or later due to run-time library
enhancements that were bundled with VAX/VMS V5.2.
1.2.2 PASCAL$STARTUP Startup File
An optional VAX Pascal startup file (PASCAL$STARTUP.COM) is placed in
SYS$STARTUP:. This file will install the VAX Pascal compiler,
Run-Time Library, and message files as known, shared images. It will
1-1
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
also define a system-wide logical name, PASCAL$EXAMPLES, to point to
the online examples provided by the installation. This startup file
should be invoked from SYS$MANAGER:SYSTARTUP_V5.COM. The
PASCAL$STARTUP.COM file is optional and VAX Pascal V4.0 will work just
fine without it.
1.2.3 Starlet Kit Now Combined With Pascal Kit
VAX Pascal V4.0 combines the Starlet files (PASSTR) into the main
Pascal kit. During installation, you will be asked if you want to
install the Pascal Library Files. These files provide definitions for
VMS system services and several Run-Time Libraries.
1.2.4 Online Examples Now Provided With Pascal Kit
VAX Pascal V4.0 provides several online examples. During
installation, you will be asked if you want to install the Pascal
Examples. These files will be placed in
SYS$COMMON:[SYSHLP.EXAMPLES.PASCAL]. The example programs demonstrate
many VAX Pascal features and calling system services and Run-Time
Library routines.
1.3 Compatibility With Older Versions Of VAX Pascal
VAX Pascal V4.0 will accept any valid V3.n source program. No
features of VAX Pascal V3 have been removed. However, several changes
have been made that may affect certain VAX Pascal programs that are
technically invalid.
1.3.1 /NOOPTIMIZE And Operand Evaluation Order
When VAX Pascal V2.0 was first introduced, the manuals stated that the
/NOOPTIMIZE qualifier caused the compiler to evaluate operands in
left-to-right order with complete evaluation. The reason for this
behavior was that /NOOPTIMIZE compilations usually meant that the
program was being debugged and tested. In these situations, it was
felt that evaluating all the operands would uncover any potential
errors that might be hidden by the compiler choosing short-circuiting
based on a heuristic.
However, due to a bug in V2.0, /NOOPTIMIZE only guaranteed
left-to-right order, but left the choosing of the short-circuit code
sequence based on a heuristic instead of the /NOOPTIMIZE qualifier.
The confusion was compounded by the fact that the VAX Pascal manuals
1-2
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
were later modified to say that /NOOPTIMIZE guaranteed left-to-right
evaluation with short-circuiting. Both statements were equally wrong.
By the time the real bug was discovered, it was felt that too many
existing programs relied on the current behavior of /NOOPTIMIZE
(left-to-right evaluation with mostly short-circuiting). Without
another method of forcing left-to-right evaluation with
short-circuiting, the compiler wasn't modified.
Now that the AND_THEN and OR_ELSE Boolean operators have been added,
the original behavior intended for the VAX Pascal compiler has been
implemented. If you desire left-to-right evaluation order with
short-circuiting, use these new operators. The /NOOPTIMIZE qualifier
now guarantees left-to-right evaluation order with full evaluation of
both operands of AND and OR Boolean operators.
1.3.2 Default For /CHECK Qualifier And CHECK Attribute
The default for the /CHECK qualifier has changed from /CHECK=BOUNDS to
/CHECK=(BOUNDS,DECLARATIONS). See the section on schema types for
more information on the new DECLARATIONS keyword.
1.3.3 SIZE And Related Routines Now Evaluate Operands
The SIZE, NEXT, BITSIZE, BITNEXT, BIT_OFFSET, and BYTE_OFFSET
predeclared functions may now evaluate their operands to detect
errors. In VAX Pascal V3, the following program was accepted:
VAR I : ARRAY [1..10] OF INTEGER;
BEGIN
WRITELN(SIZE(I[100]));
END
The compiler would accept I[100] even though 100 was not in the
correct index range. VAX Pascal V4.0 will now signal an error at
run-time if bounds checking was enabled.
1.3.4 Multiple Parameters In The Same Parameter Section
If several formal value parameters are declared in the same section
and have the same conformant packed array parameter, all corresponding
actual parameters must have the same bounds at run-time. For example:
PROCEDURE P( A,B : PACKED ARRAY [L..U:INTEGER] OF CHAR );
1-3
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
In a call to P, the actual parameters passed to A and B must have
identical string bounds. In previous versions of VAX Pascal, the
bounds of these parameters were not checked. VAX Pascal V4.0 now
correctly produces run-time checking code and an error will be
signalled if the corresponding bound identifiers of A and B will not
be equal.
This applies only to string expressions passed to value conformant
PACKED ARRAY OF CHAR parameters or conformant VARYING OF CHAR
parameters. For all other types of parameters (except schematic
parameters), bounds checking is done during compile-time.
1.3.5 Environment Files
VAX Pascal V4.0 will accept environment files generated by V3.n and
V2.n compilers. However, environment files generated by VAX Pascal
V4.0 will not be accepted by older compilers.
1.3.6 Starlet Changes
The Run-Time Library definition files now define the result types of
the RTL routines to be INTEGER instead of UNSIGNED to be consistent
with the system service definitions. This should not break any
existing programs, but should allow others to work where they received
syntax errors in the past.
1.3.7 Default ANA File Format Now Requires VAX SCA V2.0
For VAX Pascal V4.0, the default ANA file format is a VAX SCA V2 ANA
file. These ANA files will not be accepted by VAX SCA V1. We have
provided a mechanism to generate VAX SCA V1 ANA files for those sites
who wish to use VAX Pascal V4.0 with VAX SCA V1. If you explicitly
specify the /NODESIGN qualifier with the /ANALYSIS_DATA qualifier, the
ANA file produced will be compatible with VAX SCA V1.
NOTE: This mechanism is temporary. It will be removed in a
future maintenance release of VAX Pascal.
NOTE: VAX SCA V1 ANA files will be accepted by VAX SCA V2
with reduced capabilities.
1-4
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
1.4 New Features Of VAX Pascal V4.0
The following sections give descriptions of the new features included
in VAX Pascal V4.0.
The main emphasis of VAX Pascal V4.0 is the addition of several new
features from the Extended Pascal standard. However, VAX Pascal V4.0
does not completely conform to the Extended Pascal standard.
Additionally, several features listed below are VAX Pascal extensions.
These include the UPPER and LOWER predeclared functions, the program
design facility feature, and the enhancement of the [CLASS_S]
attribute to work with VAR conformant parameters.
1.4.1 Schema Types
Schema types are a new concept in the Pascal language. Unlike regular
type definitions which create a single type, schema definitions create
a family of types. A schema type can be thought of as a function
returning a type.
A schema definition has "parameters" called formal discriminants.
These formal discriminants can be referenced in any subrange
expression, variant record tag, or nested schema discrimination inside
the schema definition. For example,
TYPE
SCHEMA(FORMAL : INTEGER) = ARRAY [1..FORMAL] OF INTEGER;
This type definition creates a schema named "SCHEMA" with a single
formal parameter, "FORMAL", of type INTEGER. This schema can then be
"discriminated" with expressions to create arrays with different upper
bounds. For example,
VAR
I : SCHEMA(10);
J : SCHEMA(A+B);
You can also have pointers and parameters of undiscriminated schema
types.
You can examine the discriminants to determine their value. For
example,
VAR
P : ^SCHEMA;
PROCEDURE S( PARM : SCHEMA );
BEGIN
WRITELN('The parameter''s bounds are 1..',PARM.FORMAL');
1-5
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
END;
BEGIN
NEW(P,A+B+17); { Any run-time expression can be used }
S(P^);
S(I); { I and J are from previous example }
WRITELN('The bounds of J are 1..',J.FORMAL);
END
Schema definitions can be complex. For example,
TYPE
SCHEMA2( D1,D2 : CHAR; D3,D4 : INTEGER ) =
RECORD
FIELD1 : D1..D2;
FIELD2 : SCHEMA(D3+D4);
FIELD3 : ARRAY [D3..D4] OF INTEGER;
FIELD4 : ^SCHEMA2;
CASE D3 OF
1: (FIELD5 : INTEGER);
2,4,6: (FIELD6 : REAL);
OTHERWISE (FIELD7 : BOOLEAN);
END;
Discriminated schema types can be used like any other type. For
example, you can use a discriminated ordinal type as the index type of
an array type.
TYPE
SUBRANGE( D1,D2 : INTEGER ) = D1..D2;
VAR
I : ARRAY [SUBRANGE(10,20)] OF REAL;
J : ARRAY [SUBRANGE(EXPRESSION1,EXPRESSION2)] OF CHAR;
Schema types introduce the concept of run-time assignment
compatibility. In unextended Pascal, the compiler knew during
compilation if variables have the same type. However, schematic
variables are the same type if and only if they were produced from the
same schema and have matching actual discriminants. The compiler can
verify that they are produced from the same schema at compile-time,
but discriminant checking must wait until run-time. For example,
PROCEDURE A(P1,P2 : INTEGER);
TYPE
SCHEMA3( D : INTEGER ) = ARRAY [1..D] OF INTEGER;
VAR
I : SCHEMA3(P1);
J : SCHEMA3(P2);
1-6
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
BEGIN
I := J;
END;
Since the values of P1 and P2 may differ between activations of A, the
assignment of J into I might or might not be legal. A run-time check
is inserted to compare the discriminants of I and J before the
assignment is made. This checking is controlled by the /CHECK=BOUNDS
qualifier and can be disabled for previously debugged programs.
1.4.1.1 STRING Predefined Schema
A predefined schema called STRING has been defined with a single
formal discriminant called CAPACITY. The STRING schema behaves like
VAX Pascal's VARYING OF CHAR except that the maximum length can be a
run-time expression.
The predefined BODY and LENGTH portions of VARYING OF CHAR variables
are also available for STRING variables.
For example,
VAR S : STRING(EXPRESSION);
BEGIN
WRITELN('The maximum size of S is ',S.CAPACITY);
S := 'Hello world';
WRITELN('The current size of S is ',LENGTH(S));
END;
1.4.1.2 The /CHECK=DECLARATIONS Qualifier
Schema types require several run-time checks in the declaration
section. Since the values of the actual discriminants aren't known
until run-time, this qualifier (and corresponding attribute) have been
provided to turn off this checking in previously debugged programs.
Since these errors can produce subtle and hard to diagnose errors, the
DECLARATIONS keyword is enabled by default.
The checking controlled by /CHECK=DECLARATIONS includes:
1. Verifying actual discriminants are compatible with the type
of the corresponding formal discriminant. For example,
TYPE
SUBRANGE = 1..10;
SCHEMA3( D : SUBRANGE ) = PACKED ARRAY [1..D] OF CHAR;
1-7
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
VAR
I : SCHEMA3(11); { This is a run-time error }
2. Verifying that the lower bound of a subrange type is less
than or equal to the upper bound. For example,
TYPE
SCHEMA4( L,U : INTEGER ) = L..U;
VAR
J : SCHEMA4(10,5); { This is a run-time error }
3. Verifying that the maximum length of a STRING is less than
65536.
4. Verifying that the activation of a routine is complete before
a non-local GOTO is performed into the routine. For example,
PROCEDURE LEVEL1;
LABEL 1;
FUNCTION LEVEL2 : INTEGER;
BEGIN
GOTO 1;
LEVEL2 := 10;
END;
VAR
I : STRING(LEVEL2);
BEGIN
1:
WRITELN(I.CAPACITY);
END;
1.4.1.3 Enhanced WITH Statement
The WITH statement opens the scope of the discriminants of a schema
variable as well as the fields of a record variable.
VAR
I : STRING(10);
BEGIN
WITH I DO
1-8
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
WRITELN(CAPACITY);
END;
The WITH statement still does not open the scope of the predefined
BODY and LENGTH portions of VARYING OF CHAR or STRING variables since
BODY and LENGTH are neither discriminants or record fields.
1.4.2 AND_THEN And OR_ELSE Boolean Operators
Two new Boolean operators have been added to the Pascal language. The
AND_THEN and OR_ELSE operators behave just like the AND and OR
operators except they also guarantee left-to-right evaluation with
short-circuiting.
1.4.3 Initial State Specifiers
Initial state specifiers provide a method for specifying an initial
value for a type, variable, or record field.
Since types propagate their initial states, the initial state can be
used to provide an initial value to things like function results and
variant record tag types eventhough there is no explicit syntax to
provide an initial state for those cases. The initial state of a type
is ignored where it isn't applicable (the type of parameters, the type
of formal discriminants, etc.).
You can use initial state specifiers in conjunction with separate
compilation to provide secure datatypes. By specifying an initial
state on a type, you can be assured that no one will accidentally
forget to initialize a critical piece of data.
The initial state value is an assignment-compatible compile-time
expression.
Any variable (static, stack, or heap-allocated) can have an initial
state. The compiler will automatically generate the assignments to
initialize them.
TYPE
INITIALLY_ZERO = INTEGER VALUE 0;
VAR
I,J,K : INITIALLY_ZERO;
L : INITIALLY_ZERO VALUE 42;
P : ^INITIALLY_ZERO;
BEGIN
NEW(P);
1-9
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
WRITELN(I,J,K,L,P^);
END
The initial state can be overridden in another type denoter, but once
a variable or type has an initial state, it cannot be removed.
The current VAX Pascal syntax of ":=" to initialize variables has been
retained for compatibility with existing programs. However, you must
use the "value" keyword when creating initial states for types and
record fields.
By specifying initial states on record fields, you can achieve partial
initialization of an entire record.
TYPE
DATA_RECORD = RECORD
VALID : BOOLEAN VALUE FALSE;
DATA : ARRAY [1..100000] OF INTEGER;
NEXT : ^NODE VALUE NIL;
END;
VAR P : ^NODE;
BEGIN
NEW(P); { P.VALID and P.NEXT are initialized }
END;
Variant records are initialized based upon the value of the selector.
When created with the NEW(p,c1,...cn) form, the C's are used as
initial states for the selectors.
TYPE NODE = RECORD
CASE INTEGER OF
1:( F1 : INTEGER VALUE 42 );
2:( F2 : REAL VALUE 3.14 );
END;
VAR P : ^NODE;
A : NODE;
BEGIN
NEW(P,1);
WRITELN(P^.F1,A.F1);
END;
In the previous example, the "1"th variant was initialized because "1"
was specified on the NEW call. However, the variable A did not get
initialized because no variant was selected at the creation of the
variable. However, if the tag field had an initial state, then A
would have been initialized. For example,
TYPE I2 = INTEGER VALUE 2;
1-10
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
TYPE NODE = RECORD
CASE I2 OF
1:( F1 : INTEGER VALUE 42 );
2:( F2 : REAL VALUE 3.14 );
END;
VAR P : ^NODE;
A : NODE;
BEGIN
NEW(P,1);
WRITELN(P^.F1,A.F1);
END;
If the variant record is made with a formal discriminant, the value of
the formal discriminant is used to initialize the selector and thereby
initializing the corresponding variant part.
TYPE NODE(D:INTEGER) = RECORD
CASE D OF
1:( F1 : INTEGER VALUE 42 );
2:( F2 : REAL VALUE 3.14 );
END;
VAR P : ^NODE;
A : NODE(2);
BEGIN
NEW(P,1);
WRITELN(P^.F1,A.F1);
END;
Both variables are initialized because the actual discriminant of the
schema was used as the initial state of the selector.
1.4.4 Enhanced Constructors
VAX Pascal V4.0 added the new constructors from Extended Pascal.
These constructors are more powerful than the existing VAX Pascal
constructors. The current VAX Pascal constructor syntax has been
retained for compatibility with existing programs.
The new constructors provide run-time expressions and explicitly
specify indices and field names. For example,
TYPE
A = ARRAY [1..10] OF INTEGER;
R = RECORD
F1 : INTEGER;
F2 : REAL;
1-11
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
END;
CONST
CA = A[1..5: 42; 7,9: 84; OTHERWISE 0];
CR = R[F1: 42; F2: 3.14];
VAR
VA : A;
VR : R;
FUNCTION RANDOM : INTEGER; EXTERNAL;
VAR EXTERNAL_VAR : [EXTERNAL] INTEGER;
BEGIN
VA := A[1,3,5,7,9: RANDOM; OTHERWISE EXTERNAL_VAR + 12];
VR := R[F1: RANDOM+42; F2: SQRT(VA[5])];
END
Pascal provides the OTHERWISE clause for array constructors. VAX
Pascal has extended this concept and provides for OTHERWISE ZERO in
record constructors. OTHERWISE ZERO in a record constructor will zero
out the unspecified fields in the record.
TYPE T = RECORD
F1 : ARRAY [1..10] OF INTEGER;
F2 : RECORD
F3 : REAL;
END;
END;
VAR R : T;
BEGIN
R := T[OTHERWISE ZERO];
END;
The syntax for a constructor of a variant record includes a selector
value.
TYPE T = RECORD
F1 : INTEGER;
CASE TAG : INTEGER OF
1:( F2 : REAL );
2:( F3 : BOOLEAN );
END;
VAR R : T;
BEGIN
R := T[F1: 42; CASE TAG: 1 OF [F2: 3.14]];
END;
1-12
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
One additional extension for record constructors allows fields in
variants to be specified in the "fixed-part" of the constructor as
long as none of the fields overlap each other. This extension is
useful when dealing with FAB$TYPE, etc. from STARLET.PAS where you
want to initialize different fields in different variants.
VAR FAB : FAB$TYPE;
XAB : XAB$TYPE;
BEGIN
FAB := FAB$TYPE[FAB$B_BID: FAB$C_BID;
FAB$B_BLN: FAB$C_BLN;
FAB$L_XAB: IADDRESS(XAB);
OTHERWISE ZERO];
END;
Constructors for discriminated schema are similar, but the number of
components required isn't known until run-time.
TYPE S(D:INTEGER) = ARRAY [1..D] OF INTEGER;
DS = S(SOME-EXPRESSION);
VAR I : DS;
BEGIN
I := DS[1..10: 0];
END;
Without using an OTHERWISE clause, a run-time error would occur if the
number of components is not equal to 10. Even with an OTHERWISE
clause, you still must have at least 10 components in the array.
1.4.5 NEW Procedure Now Initializes Variant Tag Fields
In previous versions of VAX Pascal, the NEW function did not
initialize the tag field of a variant record even when the
NEW(p,c1,...,cn) form was used. Pascal now uses these constants in
the call to NEW as the initial state of the variant selector and will
initialize an explicit tag field to this value. For example,
TYPE R = RECORD
CASE TAG : INTEGER OF
1: (F1 : INTEGER);
2: (F2 : REAL);
OTHERWISE (F3 : BOOLEAN);
END;
VAR P : ^R;
BEGIN
1-13
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
NEW(P,2);
WRITELN(P^.TAG);
END;
1.4.6 LOWER And UPPER Predeclard Functions
The LOWER and UPPER functions (previously used only in conjunction
with VAX Pascal V1 dynamic array parameters) have been enhanced to
return the lower and upper bound of ordinal types, set base types, and
array index types. For multidimensional arrays, a second parameter
may be used to specify the dimension; the default is 1. LOWER and
UPPER will also work with schema types were the associated lower and
upper bound might have run-time known value.
TYPE ET = (ONE,TWO,THREE);
AT = ARRAY [1..10] OF INTEGER;
ST(L,U:INTEGER) = ARRAY [L..U] OF CHAR;
VAR SV : ST(23,32);
BEGIN
WRITELN(LOWER(ET),UPPER(ET));
WRITELN(LOWER(AT),UPPER(AT));
WRITELN(LOWER(SV),UPPER(SV));
END
1.4.7 FOR IN Statement
A new form of the FOR statement has been added to select each item
from a set expression. The statement has the following form:
FOR index-variable IN set-expression DO statement
For example,
FOR I IN [1,3,5,7,N..M] DO
WRITELN(I:1,' IS IN THE SET EXPRESSION');
The order in which the elements of the set expression will be
processed is implementation dependent.
1-14
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
1.4.8 Non-decimal Integer Constants
A new notation has been provided to specify integer constants in any
base between and including 2 and 36 in a source program. The notation
has the form:
base '#' extended-number
For example,
2#1001001
8#3777
16#FF00FF00
The current VAX Pascal extended digit syntax has been retained for
compatibility with existing programs.
1.4.9 Array-indexing, Field-selecting, And Deferencing FUNCTION
Results
Functions returning structured types can now be indexed, selected, and
dereferenced directly instead of requiring the use of a temporary
variable. For example,
TYPE
PTR_TO_INTEGER = ^INTEGER;
ARRAY_TYPE = ARRAY [1..5] OF INTEGER;
RECORD_TYPE = RECORD F1 : REAL END;
FUNCTION PTR_FN : PTR_TO_INTEGER; EXTERNAL;
FUNCTION ARRAY_FN : ARRAY_TYPE; EXTERNAL;
FUNCTION RECORD_FN : RECORD_TYPE; EXTERNAL;
BEGIN
WRITELN(PTR_FN^,ARRAY_FN[3],RECORD_FN.F1);
PTR_FN^ := 42;
END
1.4.10 Indexing And Selecting Structured Constants
Structured constants can now be array-indexed and field-selected just
like variables of the same types. For example,
TYPE CARR = ARRAY [1..3] OF INTEGER;
CONST C = CARR[1..3: 5];
1-15
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
BEGIN
WRITELN(C[2]);
END
1.4.11 DATE, TIME And GETTIMESTAMP Builtin Routines
A facility to deal with dates and times in a standard way has been
provided. A new procedure called GETTIMESTAMP will return the current
time or a user-specified time in the form of a TIMESTAMP record. This
record contains fields like SECONDS, MINUTES, HOURS, DAY, MONTH, etc.
Then the functions DATE and TIME will convert a timestamp variable
into the string representation of the DATE or TIME.
These routines use the LIB$DT conversion routines provided with VMS.
The current VAX Pascal DATE and TIME procedures has been retained for
compatibility with existing programs.
1.4.12 Non-blank Padded String Comparison Routines
Predeclared functions to compare strings without padding the shorter
string with blanks have been provided. These functions take two
string parameters and return TRUE or FALSE based upon the comparison.
For example, the EQ(S1,S2) function is equivalent to the expression
((S1 = S2) AND (LENGTH(S1) = LENGTH(S2))
The LT(S1,S2) function is equivalent to
IF LENGTH(S1) < LENGTH(S2)
THEN
S1 <= SUBSTR(S2,1,LENGTH(S1))
ELSE
SUBSTR(S1,1,LENGTH(S2)) < S2
1.4.13 Module Initialization And Finalization
The TO BEGIN DO and TO END DO sections have been added to the module
syntax. These sections provide for a statement to be executed at
module initialization or finalization.
Modules are initialized in ancestor-first order. This means that any
modules supplying (via the INHERIT attribute) a module are initialized
before that module is initialized. Modules are finalized in
1-16
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
descendent-first order. This means that any modules supplying a
module are finalized after that module is finalized. Programs do not
have TO BEGIN DO and TO END DO sections since you can put
initialization code after the BEGIN keyword and finalization code
before the final END keyword to achieve the same effect.
The syntax for modules now looks like:
[[attribute-list]] MODULE module-identifier [[(file_identifier,...)]];
[[label-declaration-section|
const-declaration-section|
type-definition-section|
variable-definition-section|
procedure-definition-section|
function-definition-section]]...
[[ TO BEGIN DO statement; ]]
[[ TO END DO statement; ]]
END.
1.4.14 New Predefined Constants
The Extended Pascal standard has defined the following constants:
MINREAL, MAXREAL, EPSREAL, and MAXCHAR. VAX Pascal V4.0 adds these
constants plus the following constants: MINDOUBLE, MAXDOUBLE,
EPSDOUBLE, MINQUADRUPLE, MAXQUADRUPLE, EPSQUADRUPLE, MAXUNSIGNED.
The MINxxx constants represent the smallest positive value of their
respective type. The MAXxxx constants represent the largest positive
value of their respective type. The EPSxxx constants represent the
smallest value such that (1.0 + EPSxxx) is larger than 1.0.
The values of these constants are:
MINREAL = 2.93874E-39
MAXREAL = 1.70141E+38
EPSREAL = 1.34110E-07
MINDOUBLE (D_Floating) = 2.9387358770557E-39
MAXDOUBLE (D_Floating) = 1.7014118346047E+38
EPSDOUBLE (D_Floating) = 3.1225022567583E-17
MINDOUBLE (G_Floating) = 5.562684646268E-309
MAXDOUBLE (G_Floating) = 8.988465674312E+307
EPSDOUBLE (G_Floating) = 2.220446049250E-016
MAXQUADRUPLE = 8.4052578577802337656566945433044E-4933
MINQUADRUPLE = 5.9486574767861588254287966331400E+4931
EPSQUADRUPLE = 1.9259299443872358530559779425849E-0034
1-17
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
MAXUNSIGNED = 4294967295
MAXCHAR = CHR(255)
1.4.15 The /STANDARD=EXTENDED Qualifier
A new Pascal standard has been developed by the X3/IEEE Pascal
Standards Committee. This new standard is called Extended Pascal. It
contains many of the features described so far and encompasses many
existing VAX Pascal extensions.
The following VAX Pascal extensions to the ANSI/IEEE or ISO standards
are now considered standard when compiling with the /STANDARD=EXTENDED
qualifier.
1. LABEL, CONST, TYPE, VAR, PROCEDURE, and FUNCTION declarations
can appear in any order and more than once
2. The string concatenation operator, "+"
3. Blank-padding string comparisons and assignments
4. Empty CASE lists
5. OTHERWISE clause in CASE statements and variant records
6. CASE label ranges in CASE statements and variant records
7. Constant expression anywhere that a constant was previously
allowed
8. Functions that return structured types
9. The EXTEND predeclared procedure
10. The CARD, LENGTH, SUBSTR, and INDEX predeclared functions
1.4.16 The /DESIGN Qualifier
The /DESIGN qualifier allows the compiler to process an input file as
a detailed design. Used with LSE and SCA, this new capability
provides an integrated software development environment that includes
the low-level design phase of the software development life cycle.
During the design phase, VAX Pascal can be your Program Design
Language (PDL). In the VMS environment, you create detailed designs
1-18
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
as follows:
o Using VAX Pascal or another traditional programming language
o Embedding design information in comments
o Writing algorithms with pseudocode and regular placeholders
With LSE, you can use pseudocode placeholders to express design
information. VAX Pascal uses the special brackets, « and » (and the
7-bit equivalents of << and >>) to delimit pseudocode placeholders.
You can express other design information in tagged header comments.
In addition, you can convert pseudocode placeholders into comments and
store the design information in SCA libraries.
With SCA, you can perform cross-referencing and static analysis on the
design information. In addition, SCA provides a report tool that
allows you to process and analyze designs to produce a variety of
design reports. Design reports can show the current state of design
work and help you understand existing code. You can generate help
libraries and routine templates from these design reports.
When implementing code, you can preserve the design information in
comments. You can reverse-engineer existing code to create a design
report that describes the design of the code as actually implemented.
When you specify the /DESIGN qualifier, the compiler modifies its
parsing according to the keywords you supply. If you specify the
PLACEHOLDERS keyword, the compiler accepts LSE placeholders (in
well-defined contexts) as valid program syntax. If you specify the
COMMENTS keyword, the compiler searches inside comments for program
design information. See the VAX Pascal Reference Supplement for VMS
Systems for more details on the /DESIGN qualifier.
The following is a very brief example of using pseudocode placeholders
and comment tags to express the design of a procedure. The comment
block has two tags: FUNCTIONAL DESCRIPTION and FORMAL PARAMETERS.
The first tag is a text tag, so it contains ordinary text. The second
tag is a structured tag, so it contains a subtag; namely, the name of
the parameter, and the text associated with the subtag.
The body of the procedure contains pseudocode, which is a mixture of
pure code and pseudocode placeholders. The parts that are real code,
such as the IF statement in this example, must conform to the regular
syntax of the language. The pseudocode placeholders may contain
arbitrary text (except, of course, for a closing pseudocode
delimiter). Great flexibility is available through appropriate
mixtures of real code and pseudocode placeholders, as shown in the
following example:
PROCEDURE Paycheck (Name : STRING);
1-19
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
{
FUNCTIONAL DESCRIPTION:
This procedure computes the amount of an employees salary
and prints a paycheck.
FORMAL PARAMETERS:
name - The name of the employee, lastname first.
}
VAR
Weekly_Salary : INTEGER;
BEGIN
<<Fetch the employee's record.>>;
{ Compute paychecks differently for salaried and hourly employees. }
IF <<employee is salaried>>
THEN
<<Use a fixed weekly salary from the employee's record.>>
ELSE
BEGIN
<<Fetch the number of regular and overtime hours worked.>>;
<<Compute the weekly pay.>>
END;
<<Print the paycheck>>
END;
For additional information, see the Guide to VAX Language-Sensitive
Editor and VAX Source Code Analyzer.
1.4.17 DECwindows Compiler Interface
VAX Pascal provides a DECwindows interface to the compiler from
FileView. You can active the interface from the "Compile" option in
the "Programming" pull-down or from the "Compile" option in the MB2
pop-up menu.
You can construct and save different configurations of compiler
options.
You can get help on any item by holding down the HELP key and clicking
MB1 on an item.
You cannot use concatenated filespecs (the "+" option) with the
DECwindows interface. If you use includes from text libraries, you
can use the PASCAL$LIBRARY logical name instead of using the /LIBRARY
1-20
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
qualifier.
1.4.18 VAR/[CLASS_S] Packed Array Of Char Parameters
VAX Pascal V3 allowed conformant packed array of characters to be
accepted as value parameters using a CLASS_S attribute. VAX Pascal
V4.0 now allows the [CLASS_S] attribute to appear on VAR conformant
packed array of character parameters also.
PROCEDURE UPDATE_STRING(
VAR P : [CLASS_S] PACKED ARRAY [L..U:INTEGER] OF CHAR);
BEGIN
P := 'Return a string';
END;
1.4.19 Code Quality Improvements
Several minor code quality improvements have been added to VAX Pascal
V4.0. Among these are:
1. Better register allocation when using DOUBLE and QUADRUPLE
datatypes
2. Better code for the PRED, SUCC, FIND_MEMBER, FIND_NONMEMBER,
and INDEX builtin routines
3. Better code for the IN operator
4. Better compile-time constant folding of string expressions
and builtin routines
5. The /G_FLOATING qualifier no longer implies that H_FLOATING
and OCTAWORD instructions are present on the machine. Only
an explicit use of QUADRUPLE will now cause the compiler to
generate these instructions.
1.5 Documenation Information
For VAX Pascal V4.0, the documentation set has been separated into
three manuals.
1-21
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
1. VAX Pascal Reference Manual
2. VAX Pascal Reference Supplement for VMS Systems
3. VAX Pascal User Manual
The Reference Manual has been streamlined to contain architecture
independent VAX Pascal material. Several chapters have been
alphabetized to provided faster and easier access.
The Supplement contains the architecture specific information that was
found in previous Reference and User Manuals.
The User Manual contains task oriented material, "how to use"
material, and compiler optimization information.
1.6 Documentation Errors
The following errors exist in the VAX Pascal V4.0 documentation.
1. Contrary to the statement in the User Manual, not all of the
example programs in the User Manual are available as online
examples.
2. Example 2-1 in the User Manual is incorrect. The declaration
of routine My_Routine looks like "My_Routine( X, VARY :
INTEGER );". It should look like "My_Routine( X : INTEGER;
VAR Y : INTEGER);".
3. Example 5-6 in the User Manual generates a compilation error
when calling LIB$SIGNAL. The call to LIB$SIGNAL should
include the %IMMED foreign mechanism specifier before the
second parameter.
4. Example 5-7 in the User Manual is missing an END in the CASE
STATUS( Rel_File ) OF statement.
5. In the sample output from Example 5-15 in the User Manual,
the file SHAREDFIL should be FILE_SHARING.
6. Example 5-29 in the User Manual is incorrect. The identifier
Itemlist should be Item_List, and Itemlist[1].Return_Len_Addr
:= 0; should be Item_List[1].Ret_Len_Addr := 0;.
7. Example 5-32 in the User Manual is incorrect. The identifier
Itmlst[n] should be Item_List[n], and the identifier
Itmlst_Cell should be Item_List_Cell.
1-22
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
1.7 Restrictions Lifted
The following restrictions from VAX Pascal V3 have been removed.
1.7.1 Several OPEN Restrictions Now Removed
1. The OPEN routine now allows CARRIAGE_CONTROL to be specified
on STREAM/STREAM_CR/STREAM_LF files.
2. The OPEN routine now allows RECORD_LENGTH to be specified on
STREAM/STREAM_CR/STREAM_LF files.
3. The OPEN routine now allows RECORD_LENGTH to be specified for
non-text files.
4. The OPEN routine now allows CARRIAGE_CONTROL to be specified
for non-text files.
1.7.2 Non-printable Characters In Compile-Time Expressions
The extended syntax for imbedding characters in string literals now
yields correct results when used in compile-time expressions. For
example:
PROGRAM A(OUTPUT);
CONST BOOL = 'BELL'(7) = 'BELL'(7)'CHAR';
VAR STRING : PACKED ARRAY [1..32] OF CHAR :=
'STRING WITH A BELL'(7)' CHARACTER';
BEGIN
WRITELN(BOOL,' ',STRING);
END.
1.7.3 Multiple Parameters In The Same Parameter Section
If several formal value parameters are declared in the same section
and have the same conformant packed array parameter, all corresponding
actual parameters must have the same bounds at run-time. For example:
PROCEDURE P( A,B : PACKED ARRAY [L..U:INTEGER] OF CHAR );
1-23
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
In a call to P, the actual parameters passed to A and B must have
identical string bounds. In previous versions of VAX Pascal, the
bounds of these parameters were not checked. VAX Pascal V4.0 now
correctly produces run-time checking code and an error will be
signalled if the corresponding bound identifiers of A and B will not
be equal.
This applies only to string expressions passed to value conformant
PACKED ARRAY OF CHAR parameters or conformant VARYING OF CHAR
parameters. For all other types of parameters (except schematic
parameters), bounds checking is done during compile-time.
1.7.4 Blank-Padding Fixed-Length String Formal Parameters
The restriction from VAX Pascal V3 regarding passing string
expressions to fixed-length string formal parameters has been lifted.
In VAX Pascal V4.0, if a string expression is shorter than the
corresponding fixed-length string value parameter, the actual
parameter is padded with blanks to the length of the formal parameter.
For example,
TYPE FIXED = PACKED ARRAY [1..10] OF CHAR;
PROCEDURE A( P : FIXED );
BEGIN
WRITELN(P);
END;
BEGIN
A('Pascal');
END
The compiler will also blank-pad the parameter to the WRITE routine if
the type of the file is a fixed-length string type.
1.8 Known Restrictions
The following restrictions exist in the VAX Pascal V4.0 compiler
1.8.1 Schema Restrictions
VAX Pascal implements schema types as defined by the Extended Pascal
standard with the following omissions.
1-24
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
1. Using Discriminated Schema as Formal Discriminant Types
Extended Pascal allows a discriminated ordinal schema type to
be subsequently used as the type of a formal schema
discriminant. For example,
TYPE SUBR(L,U:INTEGER) = L..U;
DSUBR = SUBR(expression,expression);
SCH1(D:DSUBR) = ARRAY [1..D] OF INTEGER;
SCH2(D:DSUBR) = RECORD
CASE D OF
1: (F1:INTEGER);
2: (F2:CHAR);
END;
VAX Pascal does not currently support this construct.
2. Files with Schema Components
Extended Pascal allows file components to contain schematic
items and therefore provide run-time sized file components.
For example,
TYPE SUBR(L,U:INTEGER) = L..U;
FILE_COMP = ARRAY [SUBR(expr,expr)] OF INTEGER;
VAR F : FILE OF FILE_COMP;
VAX Pascal does not currently support this feature and
requires that the component sizes of files be known at
compile-time.
3. Using Formal Discriminants Inside Initial State Specifiers
Extended Pascal allows the formal discriminant to appear in
an initial state specifier in the schema definition. For
example,
TYPE R(D:INTEGER) = RECORD
F1 : INTEGER VALUE D;
END;
A(D:INTEGER) = ARRAY [1..D] OF INTEGER VALUE [OTHERWISE D];
VAX Pascal does not currently support this feature and
requires that all initial state values be compile-time
expressions.
1-25
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
1.8.2 VMS Debugger Restrictions
1.8.2.1 Schema Types Require DBG$PROCESS NONE
Due to problems uncovered in the VAX Symbolic Debugger, debugging
programs containing schema types require the following logical name to
be defined:
$ DEFINE DBG$PROCESS NONE
This forces the debugger to use the same process as your image instead
of spawning a subprocess to do the debugging. This restriction will
be lifted in a future release of VMS.
1.8.2.2 Schema Types Require /NOOPTIMIZE
When debugging programs that contain schema, you must use the
/NOOPTIMIZE qualifier on the PASCAL DCL command. If you do not use
/NOOPTIMIZE, you might receive incorrect debug information or an
Internal Debug Error when manipulating schema.
1.8.2.3 Pointers To Undiscriminated Schema
Pointers to undiscriminated schema cannot be correctly described to
the debugger at this time since the type of the pointer is dependent
upon the value pointed to by the pointer. They are temporarily
described as pointers to UNSIGNED integers. We expect to improve the
debug information for these pointers in the future. For example,
TYPE S(I:INTEGER) = ARRAY [1..I] OF INTEGER;
VAR P : ^S;
BEGIN
NEW(P,expression);
END;
1.8.3 AND_THEN And OR_ELSE In Constant Expressions
The AND_THEN and OR_ELSE Boolean operators do not short-circuit when
used in constant expressions. All constant expressions currently do
full evaluation in a left-to-right order. For example,
CONST X = FALSE AND_THEN (1 DIV 0 = 0);
This example will currently generate a compilation error instead of
1-26
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
correctly definiting the constant X to be the value FALSE.
1.8.4 SIZE Used With TIMESTAMP Type
The VAX Pascal V4.0 compiler currently allows you to use the SIZE
function on TIMESTAMP variables. As in the case for file variables,
these types are abstract objects and the compiler should not permit
assumptions about their size to be used.
1.8.5 Compile-time String Literals Cannot Be Larger Than 8192
Characters
String literals and string constants created in the CONST section
cannot be larger than 8192 characters in length. Run-time strings
(PACKED ARRAY OF CHAR, VARYING OF CHAR, and STRING) still have a
maximum length of 65535 characters.
1.8.6 PROGRAMs Cannot Generate Environment File If Schema Are Present
PROGRAMs cannot generate environment files if they contain schema
types or variables at the outermost level. MODULEs do not have the
same restriction and can create environment files in all cases.
1.8.7 Shareable Images Cannot Have File Variables In [COMMON]
Due to an interaction with the VMS Linker and VMS Image Activator,
unknown results will occur if a compilation unit places a file
variable in a [COMMON] block and then a shareable image is made from
the object file. To share data in a shareable image, use environment
files or use the [GLOBAL]/[EXTERNAL] attributes.
1.8.8 Using The ARGUMENT Routine With VAR Parameters
The ARGUMENT builtin routine cannot be used on the left-hand side of
an assignment statement. However, you can still assign into VAR
parameters with the LIST attribute by using the IADDRESS builtin. For
example:
PROCEDURE A(VAR P : [LIST] INTEGER);
VAR I,PTR : ^INTEGER;
BEGIN
FOR I := 1 TO ARGUMENT_LIST_LENGTH(P) DO
1-27
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
BEGIN
PTR := IADDRESS(ARGUMENT(P,I));
PTR^ := 42;
END;
END;
We will consider further enhancements to the ARGUMENT routine in a
future release of VAX PASCAL.
1.8.9 Inherited Types And Standards Checking
Under certain conditions, the compiler will produce a
%PASCAL-I-STDSTRUCT, Nonstandard, types do have have same name
error message when using a combination of inherited types, inherited
procedures, and the /STANDARD qualifier.
Consider the following modules
[environment('make_array')]
module make_array;
type
ar = array [1..10] of integer;
end.
[environment('make_procedure'),inherit('make_array')]
module make_procedure;
procedure use_array( var p : ar );
begin
p := p;
end;
end.
[inherit('make_array','make_procedure')]
program show_error;
var
a : ar;
begin
use_array(a);
end.
1-28
VAX PASCAL V4.0 RELEASE NOTES
VAX PASCAL V4.0 RELEASE NOTES
At first examination, the error message appears to be incorrect since
only one type definition exists in the example. However, this is the
current expected behavior.
When the MAKE_PROCEDURE.PEN file was created, the compiler had to
place a representation of AR inside the environment file so any calls
to USE_ARRAY can have their actual parameters compared to the
corresponding formal parameter. When the SHOW_ERROR program inherited
both environment files, it inherited both array types; the type called
AR from MAKE_ARRAY and the unnamed type from MAKE_PROCEDURE that is a
copy of AR.
Since the VAX Pascal compiler has structural compatibility as an
extension, the call to USE_ARRAY is legal since A is structurally the
same as the formal parameter to USE_ARRAY. However, when /STANDARD is
enabled, the compiler doesn't realize that these two types originated
from the same type.
Enumerated types are excluded from this behavior due to a different
implementation required to support input/output on enumerated types.
1.8.10 Passing File Buffer Variables
When the buffer variable of a file is passed as a VAR parameter, the
allocation size of the formal VAR parameter must match that of the
components of the file. Failure to do so will result in an Internal
Compiler Error. For example:
PROGRAM A;
VAR
F : PACKED FILE OF 0..65535;
G : FILE OF [WORD] 0..65535;
PROCEDURE P( VAR I : INTEGER ); EXTERNAL;
BEGIN
P(F^); { causes an Internal Compiler Error }
P(G^); { causes an Internal Compiler Error }
END.
1-29