Compaq Pascal V5.8-90 for OpenVMS VAX Systems Release Notes 4 October 2000 Copyright 2000 Compaq Computer Corporation COMPAQ Registered in U.S. Patent and Trademark Office. Confidential computer software. Valid license from Compaq required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license. This document contains information about Compaq Pascal V5.8-90 including new features, and other topics. This file is of interest to both system management and application programmers. CONTENTS CHAPTER 1 COMPAQ PASCAL V5.8-90 FOR OPENVMS VAX SYSTEMS RELEASE NOTES 1.1 Overview Of Compaq Pascal . . . . . . . . . . . . 1-1 1.2 New Features In Compaq Pascal . . . . . . . . . . 1-1 1.2.1 Compaq Pascal Web Page . . . . . . . . . . . . . 1-1 1.2.2 New /VERSION DCL Qualifier For Displaying Compiler Version . . . . . . . . . . . . . . . . 1-2 1.2.3 Support For Nul-Terminated Strings . . . . . . . 1-2 1.2.4 Features Requiring OpenVMS VAX V6.1 . . . . . . 1-3 1.3 Compaq Pascal Run-Time Library . . . . . . . . . . 1-4 1.3.1 Compaq Pascal Run-Time Library And DECthreads . 1-4 1.4 Using Condition Handlers That Return SS$_CONTINUE 1-4 1.5 Known Problems And Restrictions . . . . . . . . . 1-5 1.6 Documentation Errors . . . . . . . . . . . . . . . 1-8 1.6.1 Errors In The Compaq Pascal Reference Manual . . 1-8 1.7 STARLET Definition Files . . . . . . . . . . . . . 1-9 1.8 Compiling For Optimal Performance . . . . . . . 1-10 1.9 Problems Corrected Since Last Release Of Compaq Pascal . . . . . . . . . . . . . . . . . . . . . 1-10 CHAPTER 1 COMPAQ PASCAL V5.8-90 FOR OPENVMS VAX SYSTEMS RELEASE NOTES 1.1 Overview Of Compaq Pascal Compaq Pascal V5 is a major release of the Compaq Pascal language. The major new features of Compaq Pascal V5 are: 1. New platform support. Compaq Pascal now supports OpenVMS Alpha and Tru64 UNIX (formerly known as Digital UNIX) systems as well as continued support for OpenVMS VAX systems. 2. New functionality to be more compatible with Unix-based Pascals (ie, Pascal for RISC on the RISC/ULTRIX platforms). 3. New functionality to efficiently use the Alpha architecture from Compaq Pascal. Compaq Pascal V5.8-90 requires OpenVMS VAX V5.5 or later. 1.2 New Features In Compaq Pascal Since the release of V5.7, Compaq Pascal for OpenVMS VAX systems contain: 1. New /VERSION qualifier to easily display the compiler version from the command line 2. Bug fixes 1.2.1 Compaq Pascal Web Page You can find the Compaq Pascal home page at 1-1 COMPAQ PASCAL V5.8-90 FOR OPENVMS VAX SYSTEMS RELEASE NOTES http://www.openvms.compaq.com/commercial/pascal/pascal_index.html Please visit the web site and register with us via the "Pascal Feedback" button. By registering with us, we can send out updates on future Compaq Pascal releases as well as getting your feedback on Compaq Pascal features and future directions. 1.2.2 New /VERSION DCL Qualifier For Displaying Compiler Version A new DCL qualifier, /VERSION, has been added to display the compiler's version string from the command line. The display also includes the OpenVMS version and architecture name. When the /VERSION qualifier is present, the compiler will print out the version information and exit back to the operating system. No other qualifiers or source files will be processed. The syntax is /VERSION When using the SYS$SYSTEM:PASCAL$SET_VERSION.COM command file to select older versions of the Compaq Pascal, the older compiler may issue an error if the /VERSION qualifier is specified. Normally, older compilers will simply ignore any qualifiers that were added after its release. However, due to the implementation of /VERSION, older compilers will issue errors while trying to process other qualifiers. If you receive these errors, do not use /VERSION to determine the older compiler's version. You will need to look in the first line of a listing file or in the ANALYZE/IMAGE output. 1.2.3 Support For Nul-Terminated Strings Support for the C_STR_T predeclared type and the C_STR, MALLOC_C_STR, PAS_STR, and PAS_STRCPY predeclared functions have been added to Compaq Pascal for OpenVMS VAX Systems. This feature requires 2 RTL support routines that were included beginning with OpenVMS VAX V7.1. To use the nul-terminated string support on earlier versions of OpenVMS VAX, here are the current definitions (subject to change) of these two routines. However, you need to be aware that you'll have to remove these temporary routines after you upgrade your system to OpenVMS VAX V7.1 or later. #include #include /* 1-2 COMPAQ PASCAL V5.8-90 FOR OPENVMS VAX SYSTEMS RELEASE NOTES ** PAS$MALLOC_COPY -- malloc a buffer to hold len+1 characters, then ** copy string and NUL into buffer */ void* pas$malloc_copy (short len, char* str) { char* buf = malloc(len+1); strncpy(buf, str, len); buf[len] = 0; return buf; } /* ** PAS$STRCPY -- copy string and NUL into buffer */ void* pas$strcpy (char* buf, short len, char* str) { strncpy(buf, str, len); buf[len] = 0; return buf; } 1.2.4 Features Requiring OpenVMS VAX V6.1 DEC Pascal V5.0 added several features that require new RTL support. Since no version of OpenVMS VAX contained this support when V5.0 shipped, these features were flagged by the compiler as "not yet supported". The new RTL support has been provided with OpenVMS VAX V6.1. The compiler will now correctly compile these new features. However, the resulting object file must be linked on an OpenVMS VAX V6.1 or later system. Linking on an older system will result in linker messages about unknown symbols. The features that are now enabled are: 1. Writing ordinal numbers in non-decimal radix notation 2. Optional filename on the RESET, REWRITE, and EXTEND builtin routines 3. The ASSERT, RANDOM, SEED, and WALLCLOCK builtin routines 1-3 COMPAQ PASCAL V5.8-90 FOR OPENVMS VAX SYSTEMS RELEASE NOTES 1.3 Compaq Pascal Run-Time Library 1.3.1 Compaq Pascal Run-Time Library And DECthreads The Compaq Pascal Run-Time Library has been enhanced to work properly with DECthreads. The thread-safe support has been merged into OpenVMS VAX V7.1. 1.4 Using Condition Handlers That Return SS$_CONTINUE In Compaq Pascal, condition handlers can do one of the following things after doing whatever is appropriate for the error: 1. Use a non-local GOTO to transfer control to a label in an enclosing block. 2. Return SS$_CONTINUE if the handler wants the error dismissed and to continue processing. 3. Return SS$_RESIGNAL if the handler wants the system to continue searching for additional handlers to call. 4. Call the $UNWIND system service to establish a new point to resume execution when the handler returns to the system. When an exception occurs, the system calls a handler in the Pascal Run-Time Library that is established by the generated code. This handler in the RTL in turn calls the user's condition handler that was established with the ESTABLISH builtin routine. The RTL's handler contains a check to prevent a user's handler from returning SS$_CONTINUE for a certain class of Pascal Run-Time Errors that could cause an infinite loop if execution was to continue at the point of the error. There are two situations where this check may cause unexpected behavior. The first situation is where the user's handler called $UNWIND and then returned with SS$_CONTINUE. Since the $UNWIND service was called, execution won't resume at the point of the error even if SS$_CONTINUE is returned to the system. However, the RTL's handler isn't aware that $UNWIND has been called and complains that you cannot continue for this type of error. The solution is to return SS$_RESIGNAL instead of SS$_CONTINUE after calling $UNWIND in the user's handler. However, this solution isn't possible if you establish the 1-4 COMPAQ PASCAL V5.8-90 FOR OPENVMS VAX SYSTEMS RELEASE NOTES LIB$SIG_TO_RET routine with the ESTABLISH builtin routine. LIB$SIG_TO_RET is a routine that can be used as a condition handler to convert a signal into a "return to the caller of the routine that established LIB$SIG_TO_RET". Since LIB$SIG_TO_RET returns SS$_NORMAL which in turn is the same value as SS$_CONTINUE, the handler in the Pascal RTL will complain that you cannot continue from this type of error. The solution for this case is to establish your own handler with the ESTABLISH builtin routine that calls LIB$SIG_TO_RET and then returns SS$_RESIGNAL. You cannot establish LIB$SIG_TO_RET directly as a handler with the ESTABLISH builtin routine. The second situation where the RTL's check for SS$_CONTINUE from a user's handler can cause problem is moving code from OpenVMS VAX to OpenVMS Alpha. On OpenVMS VAX, only certain run-time errors were not allowed to return SS$_CONTINUE from a handler. These errors for those associated with the SUBSTR and PAD builtin routines as well as checking code for set constructors. On OpenVMS Alpha, many more run-time errors are not allowed to return SS$_CONTINUE from a handler. The exact lists of run-time errors which can be continued and which ones cannot be continued has never been provided. The compilers may choose to generate different code in the future which might move an error from one list to the other. We recommend that do you not return SS$_CONTINUE for any Pascal run-time error that is not due to a file operation. 1.5 Known Problems And Restrictions Here is a list of language features that are not yet implemented or do not work as documented in Compaq Pascal for OpenVMS VAX Systems. 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; Compaq Pascal does not currently support this construct. 1-5 COMPAQ PASCAL V5.8-90 FOR OPENVMS VAX SYSTEMS RELEASE NOTES 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; Compaq 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]; Compaq Pascal does not currently support this feature and requires that all initial state values be compile-time expressions. 4. Changing Variants When Selector Is A Discriminant If a formal discriminant is used as a variant tag, it is illegal to change the variant once the variable has been created. For example, TYPE R(D:INTEGER) = RECORD CASE D OF 1: (ONE : INTEGER); 2: (TWO : INTEGER); OTHERWISE (OTHERS : BOOLEAN); END; VAR V : R(1); BEGIN V.TWO := 2; { Is illegal since it changes variants from 1 to 2 } END; Compaq Pascal does not currently generate run-time checking code to detect this violation. 1-6 COMPAQ PASCAL V5.8-90 FOR OPENVMS VAX SYSTEMS RELEASE NOTES 5. 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 correctly definiting the constant X to be the value FALSE. 6. The Compaq Pascal 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. 7. 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. 8. The standard file variable ERR is not yet supported. 9. The MESSAGE builtin is not yet supported. 10. The LSE templates for the Pascal language are shipped as part of DECset. These templates have not yet been updated to reflect all the new language features added to Compaq Pascal. This will be corrected in a future release. 11. The HELP file has undergone extensive revision which included renaming some topic strings. This will cause problems with using the language-sensitive help feature from LSE. This will be corrected in a future release. 12. Due to an interaction with the OpenVMS Linker and OpenVMS Image Activator, unknown results will occur if a compilation unit places a file variable in a [COMMON] block and then a 1-7 COMPAQ PASCAL V5.8-90 FOR OPENVMS VAX SYSTEMS RELEASE NOTES shareable image is made from the object file. To share data in a shareable image, use environment files or use the [GLOBAL]/[EXTERNAL] attributes. 13. The ARGC and ARGV predeclared routines are not yet supported. 14. 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. 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 described as pointers to UNSIGNED integers instead. For example, TYPE S(I:INTEGER) = ARRAY [1..I] OF INTEGER; VAR P : ^S; BEGIN NEW(P,expression); END; 1.6 Documentation Errors 1.6.1 Errors In The Compaq Pascal Reference Manual 1. The descriptions of the TO BEGIN DO clause in Section 3.3 and the TO END DO clause in Section 3.4 should note that you can control the name of the compiler-generated routine that encapsulates the two clauses by using the GLOBAL attribute. 2. In Section 4.4, Type Conversions, the 5th paragraph omitted the "**" operators in the printed edition from the sentence: "When combined with other unsigned values, negative integer values are converted to large unsigned values by the calculation of the modulus with respect to 2**32 or 2**64." 3. The text for the "NOT IN" operator in Section 4.2.5 should be colored as an extension. 4. The text for the UINT function in Section 8.94 should indicate that the value returned is "x MOD 2**32". In the printed version of the manual, the "**" operator was omitted. 1-8 COMPAQ PASCAL V5.8-90 FOR OPENVMS VAX SYSTEMS RELEASE NOTES 5. The text for the UINT64 function in Section 8.95 lists the usage as "UINT(x)" instead of "UINT64(x)". Also, the section should indicate that the value returned is "x MOD 2**64". In the printed version of the manual, the "**" operator was omitted. 6. The description of the GLOBAL attribute in Section 10.2.17 should indicate that using the GLOBAL attribute on a MODULE changes the name of the MODULE's compiler-generatation initialization routine. Normally, the initialization routine, if needed, is named 'module-name'%INIT. However, the usage of the percent sign makes it difficult to use in a shareable image environment on OpenVMS. Using the GLOBAL attribute allows for the name to be changed so it can be inserted in the shareable image's symbol vector. 7. The following paragraph has been added to Section 11.4 for the %IF directive Note that skipped sections must still be valid Compaq Pascal tokens. The skipped tokens are not processed semantically by the compiler except for control expressions of nested %IF directives. All control expressions are semantically processed to ensure they result in a Boolean result. %INCLUDE and %DICTIONARY directives encountered while skipping tokens do not attempt to open the filename or access the dictionary path. Instead, they return the token 'TRUE'. 8. The text for %ARCH_NAME in Section 11.7 should indicate that the directive returns the string "VAX" or "Alpha". 9. The text for %SYSTEM_NAME in Section 11.7 should indicate that the directive returns the string "OpenVMS" or "DigitalUNIX". 10. The INTEGER8, UNSIGNED8, UNSIGNED16, UNSIGNED32, and UNSIGNED64 types are missing from the index. They should point back to Section 2.1.1.1 or 2.1.1.2. 1.7 STARLET Definition Files The contents of the STARLET.PAS and other definition files created during the Compaq Pascal installation are derived from a file of binary data provided by the OpenVMS system. The Compaq Pascal installation simply converts these definitions into Pascal source and places them in various files based on their usage. In previous releases of VAX Pascal on OpenVMS VAX systems, the 1-9 COMPAQ PASCAL V5.8-90 FOR OPENVMS VAX SYSTEMS RELEASE NOTES installation script did some limited censorship of the files as they were being converted. Beginning with DEC Pascal V5.0, all of the intermediate data is converted. This means that as the OpenVMS group adds new definitions to the intermediate data, the next Compaq Pascal installation will automatically provide them as Pascal source. Programs that provide their own Pascal version of system constants, data structures, or entry points may have to be modified if these items are provided by the OpenVMS system in the future. For example, the CLI$_ constants have now been provided by the system. Finally, be aware that OpenVMS VAX and OpenVMS Alpha systems may not provide the exact same set of definitions. 1.8 Compiling For Optimal Performance The following command line will result in producing the fastest code from the compiler. PASCAL /OPTIMIZE /NOCHECK You may also want to use the performance flagger ( /USAGE=PERFORMANCE ) to identify datatypes that could be modified for additional performance. 1.9 Problems Corrected Since Last Release Of Compaq Pascal o Improve the error message when using substring access on PACKED ARRAY OF CHAR arrays that are larger than 65535 characters long. These long arrays are not considered strings by Compaq Pascal. o When typecasting a variable to a smaller type, the compiler would incorrectly use the size of the variable instead of using the size of the smaller type. This affects SIZE(BigVar::SmallerType) which will now return the size of the SmallerType, not the size of the BigVar. It also affects assigning into BigVar::SmallerType by just updating the leading part of the BigVar without touching the bytes at the end. Previously, the extra bytes would be zero-filled. 1-10 COMPAQ PASCAL V5.8-90 FOR OPENVMS VAX SYSTEMS RELEASE NOTES It also affects passing BigVar::SmallerType to value conformant array parameters. Previously, the resulting conformant parameter's size and bounds would reflect the size of the BigVar, not of the SmallerType. It now reflects the size of the SmallerType. o The compiler might not issue the ASYREQVOL warning message when INPUT or OUTPUT is used as a default file variable inside of an asynchronous routine. This problem has been fixed. o Add the /VERSION qualifier on OpenVMS and the -version option on Tru64 UNIX to print the compiler and OS version information to standard output. If you use the SYS$SYSTEM:PASCAL$SET_VERSION command fine to select an older saved compiler, you will get an error if use specify /VERSION and that compiler didn't support the /VERSION qualifier. Normally, older compilers would just ignore qualifiers it wasn't aware of, but due to implementation details, older compilers will get confused if /VERSION is used. o The compiler or run-time system reported missing constructor components for a variable of schema array type, when, in fact, there were too many. This problem has been fixed. o When the /SHOW=STRUCTURE_LAYOUT option was used (-show structure_layout on Tru64 UNIX), the listing failed to display very large, though valid, sizes and offsets. This problem has been fixed. o Improve formatting of schema types in /SHOW=STRUCTURE_LAYOUT (-show structure_layout on Tru64 UNIX). o The compiler would print incorrectly position messages for symbols containing non-standard characters when /STANDARD was used. The symbols must be ones already defined by the compiler such as OR_ELSE, AND_ATOMIC, RECORD_LENGTH, etc. This problem has been fixed. The compiler will still print these standards messages when these symbols are being used with the builtin meaning. In theory, these messages should be supressed and only messages when redefining these symbols should be generated. This may be addressed in a future version of the compiler. 1-11 COMPAQ PASCAL V5.8-90 FOR OPENVMS VAX SYSTEMS RELEASE NOTES o The compiler did not produce a non-standard message when command line constants were declared and used. The compiler now will product a non-standard diagnostic when a command line constant is used in a program. o The compiler did not detect the use of IADDRESS on a record field that was not on a byte-boundary when a pointer-dereference was used to designate the record field. For example: IADDRESS(P.UNALIGNED_FIELD). Later in the compilation, an internal compiler error would occur when a subsequent phase of the compiler detected that it was requested to generate the address of something that was not on a byte-boundary. This problem has been fixed. 1-12